Added upstream version.
[vlp.git] / examp / classes / machine.inc
1 unit Machine: IIUWGRAPH class;
2
3   unit NodeInfo:class;
4    var num:integer,addr:array_of char,
5         Next:NodeInfo;
6   begin
7     Next:=none; num:=0;
8     addr:=none;
9   end NodeInfo;
10
11  unit LocalNode:function:integer;
12  var res:array_of char;
13  begin
14   res:=hfont8(501,0,0,0,"",0,0,0);
15   result:=ord(res(0));
16  end LocalNode;
17   
18  unit NodesNum:function:integer;
19  var res:array_of char;
20  begin
21   res:=hfont8(502,0,0,0,"",0,0,0);
22   result:=ord(res(0));
23  end NodesNum;
24
25  unit NodeExists:function(n:integer):boolean;
26  var res:array_of char;
27  begin
28   res:=hfont8(503,n,0,0,"",0,0,0);
29   if ord(res(0))=1 then result:=TRUE; 
30   else result:=FALSE;fi;
31  end NodeExists;
32
33  unit MachineInfo:function:NodeInfo;
34  var t,pomt:array_of char,c:char,i,j,k,l,m,n:integer,
35        pomi,List:NodeInfo;
36  begin
37   t:=hfont8(504,0,0,0,"",0,0,0); 
38   List:=none;
39   if t<>none then
40                       j:=upper(t);i:=lower(t);
41                       while i<j do
42                             k:=i;
43                             while i<j and t(i)<>';' do i:=i+1;od;
44                             l:=k; while t(l)<>'=' do l:=l+1; od;
45                             if List=none then List:=new NodeInfo;  
46                                                       pomi:=List;
47                             else pomi.Next:=new NodeInfo;
48                                    pomi:=pomi.Next;
49                             fi;  
50                              array pomi.addr dim (1:i-l-1);
51                              for m:=l+1 to i-1 do pomi.addr(m-l):=t(m); od;
52                              n:=1;
53                              for m:=l-1 downto k do 
54                                 pomi.num:=pomi.num+(ord(t(m))-48)*n;
55                                 n:=n*10;
56                              od; 
57                             i:=i+1;
58                         od;     
59                    result:=List;
60                   else result:=none;
61                   fi;
62  end MachineInfo;
63
64 begin
65 end Machine;\0\0