1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
#-*- perl -*-
# Copyright (C) 2000 Ken'ichi Fukamachi
#
# $Id$
# $FML$ # ����: cvs �Υ����� $FML$ �ˤ���
#
package FML::PCB;
use strict;
use Carp;
use vars qw(%_fml_PCB); # PCB: Process Control Block (malloc it here)
=head1 NAME
FML::PCB -- manipulate Process Control Block
=head1 SYNOPSIS
$pcb = new FML::PCB;
$pcb->set('lock', 'object', $lockobj);
$lockobj = $pcb->get('lock', 'object');
=head1 DESCRIPTION
=head2 DATA STRUCTURE
C<$CurProc>->C<{ pcb }> area holds the CURrent PROCess information.
The hash holds several references to other data structures,
which are mainly hashes.
$CurProc = {
pcb => {
key => value,
},
incoming_message => $r_msg,
article => $r_msg,
... snip ...
};
=head1 METHODS
=head2 C<new( $args )>
initialize the C<pcb> memory area.
If $args HASH REFERENCE is specified,
copy the hash content in it to C<pcb> area.
=cut
sub new
{
my ($self, $args) = @_;
unless (defined %_fml_PCB) { %_fml_PCB = ();}
my $me = \%_fml_PCB;
# import variables
if (defined $args) {
my ($k, $v);
while (($k, $v) = each %$args) { set($me, $k, $v);}
}
return bless $me, $self;
}
=head2 C<dump_variables()>
show all {key => value} for debug.
=head2 C<get( category, key )>
You must specify C<category> and C<key>.
=head2 C<set( category, key, value)>
You must specify C<category>, C<key> and the C<value>.
=cut
sub dump_variables
{
my ($k, $v);
while (($k, $v) = each %_fml_PCB) {
print "${k}: $v\n";
}
}
sub get
{
my ($self, $category, $key) = @_;
$self->{ $category }->{ $key };
}
sub set
{
my ($self, $category, $key, $value) = @_;
$self->{ $category }->{ $key } = $value;
}
=head1 AUTHOR
Ken'ichi Fukamachi
=head1 COPYRIGHT
Copyright (C) 2001 Ken'ichi Fukamachi
All rights reserved. This program is free software; you can
redistribute it and/or modify it under the same terms as Perl itself.
=head1 HISTORY
FML::PCB appeared in fml5 mailing list driver package.
See C<http://www.fml.org/> for more details.
=cut
1;
|