DataMuseum.dk

Presents historical artifacts from the history of:

RC4000/8000/9000

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about RC4000/8000/9000

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦c9ab035dd⟧ TextFile

    Length: 18432 (0x4800)
    Types: TextFile
    Names: »tstmolst«

Derivation

└─⟦a41ae585a⟧ Bits:30001842 SW-save af projekt 1000, Alarm-system
    └─⟦72244f0ef⟧ 
        └─⟦this⟧ »tstmolst« 

TextFile

\f

tstmolst    81.04.10.   12.30.                                                    page     1

   10    1           
\f

tstmolst    81.04.10.   12.30.                                                    page     2

 1010    2        PROCESS timout (
 1020    3          opsem : ^semaphore;         (*  operator sem     *)
 1030    4          VAR main_sem : !ts_pointer;        (*  main semaphore         *)
 1040    5          (* var simtim : semaphore;     (*** only when using sim timer prog ***)
 1050    6          ticklength,                 (*  # msec per tick         *)
 1060    7          max: integer);              (*  max # bookings simultan *)
 1070    8          
 1080    9            (*  the process receives bookings with moduletimeouts              *)
 1090   10            (*  and updates of tickcount.                                      *)
 1100   11            (*  tickcount is decreased by 1 for each tick of ticklength        *)
 1110   12            (*  m sec. when tickcount reaches zero the corresponding module-   *)
 1120   13            (*  timeout is returned.                                           *)
 1130   14          
 1140   15            (*     date   version   init   changes                             *)
 1150   16            (*  80.04.18      0     hej    first edition                       *)
 1160   17            (*  80.06.02    1.2     hej    new message formats, one sem.       *)
 1170   18            (*  80.07.18    1.9     hej    save function                       *)
 1180   19            (*  80.07.23    2.1     hej    read function    ( for demo )       *)
 1190   20            (*  80.08.06    2.4     hej    object from book                    *)
 1200   21            (*  80.08.11    2.5     hej    sender ident from book update       *)
 1210   22            (*  80.08.25    2.6     hej    date and version                    *)
 1220   23            (*  80.09.03    1.10    hej    new lambda                          *)
 1230   24            (*  80.10.28    2.00    hej    mainsem -> sempointer               *)
 1240   25            (*  80.11.11    2.02    hej    u3 = dummy_route  (= 0 )            *)
 1250   26          
 1260   27          
 1270   28        CONST               (*  constant section  *)
 1280   29          
 1290   30          version = "vers  2.03 /" ;
 1300   31          
 1310   32            (**sim      sim= false;       (*  run with timer sim   **)
 1320   33          first= 1;
 1330   34          cmax= timeout_l;     (* max number of simultanious bookings, should be process param  *)
 1340   35          
 1350   36            (* other constants   *)
 1360   37          inactive= -2;                       (*  value in unused tickcounters  *)
 1370   38          result_ok   = 1;
 1380   39          result_full = 2;
 1390   40          result_wrong= 3;
 1400   41          result_obj  = 4;
 1410   42          result_index= 5;
 1420   43          result_unknw= 6;
 1430   44          
 1440   45          read= 2;            (**demo       **)
 1450   46          readstatus= 3;
 1460   47          write= 4;
\f

tstmolst    81.04.10.   12.30.                                                    page     3

 1470   48          writecontrol= 5;
 1480   49          readwrite= 6;
 1490   50          rwcontrol= 7;
 1500   51          forever= false;
 1510   52          dummy = dummy_route;
 1520   53          
 1530   54          
 1540   55        TYPE          (*  type section  *)
 1550   56          
 1560   57          modules= first..cmax;     (*  should be  first..max     *)
 1570   58          params= RECORD index, count, object: integer   END;
 1580   59          identdata = RECORD   object: integer   END;
 1590   60          savedata = RECORD   count: integer   END;
 1600   61          
 1610   62          
 1620   63        VAR           (*  variables section  *)
 1630   64          
 1640   65          console: zone;
 1650   66          hour, min, sec : integer := 0;     (**demo       **)
 1660   67          delay: integer;               (*  # msec. in a tick  *)
 1670   68          delay1, delay2: byte:= 0;
 1680   69          index, used: modules:= first;
 1690   70          tickcount,
 1700   71          objects :  ARRAY(modules) OF integer;
 1710   72          saved:     ARRAY(modules) OF reference;
 1720   73          msg, timer_msg: reference;
 1730   74          tickmess: pool 1;   (*  of header only  *)
 1740   75          
 1750   76            (*   end of datasection   *) 
\f

tstmolst    81.04.10.   12.30.                                                    page     4

 2010   77          
 2020   78        BEGIN           (*   program section     *)
 2030   79    1   ! 
 2040   80    2   ! 
 2050   81    3   ! testopen ( console, own.incname, opsem );
 2060   82    4   ! testout  ( console, version, al_env_version );
 2070   83    5   ! 
 2080   84    6   ! delay:= ticklength;
 2090   85    7   ! WHILE delay > 255 DO
 2100   86    8   !   BEGIN
 2110   87    9   !   ! delay:= delay DIV 2;
 2120   88   10   !   ! delay2:= delay2+1
 2130   89   11   !   END;
 2140   90   12   ! delay1:= delay;
 2150   91   13   ! 
 2160   92   14   ! alloc ( msg, tickmess, main_sem.s^);
 2170   93   15   ! msg^.u1:= readwrite;
 2180   94   16   ! msg^.u3:= delay1;
 2190   95   17   ! msg^.u4:= delay2;
 2200   96   18   !   (*  if sim then signal ( msg, simtim ) else      (**sim   only with sim timer   **)
 2210   97   19   ! sendtimer ( msg);
 2220   98   20   ! 
 2230   99   21   !   (* main loop  *)
 2240  100   22   ! REPEAT
 2250  101   23   ! ! wait ( msg, main_sem.w^);      (* answer from timer, save, booking, or update  *)
 2260  102   24   ! ! 
 2270  103   25   ! ! IF ownertest ( tickmess, msg ) THEN       (*  tick   *)
 2280  104   26   ! !   BEGIN
 2290  105   27   ! !   ! msg^.u3:= delay1;
 2300  106   28   ! !   ! msg^.u4:= delay2;
 2310  107   29   ! !   !   (*  if sim then signal ( msg, simtim )  else    (**sim    **)
 2320  108   30   ! !   ! sendtimer ( msg);
 2330  109   31   ! !   ! 
 2340  110   32   ! !   !   (**demo  only     update hour, min, sec    **)
 2350  111   33   ! !   ! sec:= sec+1;
 2360  112   34   ! !   ! IF sec = 60 THEN
 2370  113   35   ! !   !   BEGIN
 2380  114   36   ! !   !   ! sec:= 0;
 2390  115   37   ! !   !   ! min:= min+1;
 2400  116   38   ! !   !   ! IF min = 60 THEN
 2410  117   39   ! !   !   !   BEGIN
 2420  118   40   ! !   !   !   ! min:= 0;
 2430  119   41   ! !   !   !   ! hour:= hour+1;
 2440  120   42   ! !   !   !   ! IF hour=24 THEN hour:= 0
 2450  121   43   ! !   !   !   END
 2460  122   44   ! !   !   END;
\f

tstmolst    81.04.10.   12.30.                                                    page     5

 2470  123   45   ! !   ! 
 2480  124   46   ! !   ! FOR index:= first TO used DO    (*  decrease tickcounters  *)
 2490  125   47   ! !   !   BEGIN
 2500  126   48   ! !   !   ! IF tickcount(index) > 0 THEN
 2510  127   49   ! !   !   !   tickcount(index):= tickcount(index)-1  ELSE
 2520  128   50   ! !   !   !   IF tickcount(index) = 0 THEN
 2530  129   51   ! !   !   !     BEGIN
 2540  130   52   ! !   !   !     ! IF NOT nil ( saved(index)) THEN return ( saved(index));
 2550  131   53   ! !   !   !     ! tickcount(index):= inactive
 2560  132   54   ! !   !   !     END
 2570  133   55   ! !   !   END
 2580  134   56   ! !   END    (*  tick  *)
 2590  135   57   ! ! ELSE
 2600  136   58   ! !   
 2610  137   59   ! !   IF msg^.u3 = dummy THEN return ( msg)
 2620  138   60   ! !   ELSE
 2630  139   61   ! !     
 2640  140   62   ! !     CASE msg^.u1 OF
 2650  141   63   ! !     ! 
 2660  142   64   ! !     ! read:                 (**demo     only            **)
 2670  143   65   ! !     !   BEGIN
 2680  144   66   ! !     !   ! LOCK msg AS buf: RECORD hh, mm: integer END  DO
 2690  145   67   ! !     !   !   BEGIN
 2700  146   68   ! !     !   !   ! buf.hh:= hour;
 2710  147   69   ! !     !   !   ! buf.mm:= min*100 + sec
 2720  148   70   ! !     !   !   END;
 2730  149   71   ! !     !   ! msg^.u2:= result_ok;
 2740  150   72   ! !     !   ! return ( msg)
 2750  151   73   ! !     !   END;
 2760  152   74   ! !     ! 
 2770  153   75   ! !     ! writecontrol:           (**demo  only     **)
 2780  154   76   ! !     !   BEGIN
 2790  155   77   ! !     !   ! LOCK msg AS buf: RECORD hh, mm: integer END DO
 2800  156   78   ! !     !   !   BEGIN
 2810  157   79   ! !     !   !   ! hour:= buf.hh;
 2820  158   80   ! !     !   !   ! min:= buf.mm DIV 100;
 2830  159   81   ! !     !   !   ! sec:= buf.mm MOD 100
 2840  160   82   ! !     !   !   END;
 2850  161   83   ! !     !   ! msg^.u2:= result_ok;
 2860  162   84   ! !     !   ! return ( msg)
 2870  163   85   ! !     !   END;
 2880  164   86   ! !     ! 
 2890  165   87   ! !     ! readstatus:                 (*   save   *)
 2900  166   88   ! !     !   BEGIN
 2910  167   89   ! !     !   ! index:= first;
 2920  168   90   ! !     !   ! WHILE NOT nil ( saved(index) ) DO index:= index+1;
\f

tstmolst    81.04.10.   12.30.                                                    page     6

 2930  169   91   ! !     !   ! IF index = cmax THEN
 2940  170   92   ! !     !   !   BEGIN
 2950  171   93   ! !     !   !   ! msg^.u2:= result_full;
 2960  172   94   ! !     !   !   ! return ( msg)
 2970  173   95   ! !     !   !   END   ELSE
 2980  174   96   ! !     !   !   BEGIN
 2990  175   97   ! !     !   !   ! msg^.u2:= result_ok;
 3000  176   98   ! !     !   !   ! LOCK msg AS buf: savedata DO
 3010  177   99   ! !     !   !   !   BEGIN
 3020  178  100   ! !     !   !   !   ! IF buf.count < 1 THEN buf.count:= 1;
 3030  179  101   ! !     !   !   !   ! tickcount(index):= buf.count;
 3040  180  102   ! !     !   !   !   END;
 3050  181  103   ! !     !   !   ! objects(index):= index;
 3060  182  104   ! !     !   !   ! saved(index) :=: msg;
 3070  183  105   ! !     !   !   ! IF index > used THEN used:= index
 3080  184  106   ! !     !   !   END
 3090  185  107   ! !     !   END;     (*  save  *)
 3100  186  108   ! !     ! 
 3110  187  109   ! !     ! rwcontrol:                  (*  booking  *)
 3120  188  110   ! !     !   BEGIN
 3130  189  111   ! !     !   ! pop ( timer_msg, msg );
 3140  190  112   ! !     !   ! timer_msg^.u3:= msg^.u3;
 3150  191  113   ! !     !   ! index:= first;
 3160  192  114   ! !     !   ! WHILE NOT nil( saved(index)) DO index:= index+1;
 3170  193  115   ! !     !   ! IF index = cmax THEN
 3180  194  116   ! !     !   !   BEGIN
 3190  195  117   ! !     !   !   ! timer_msg^.u2:= result_full;
 3200  196  118   ! !     !   !   ! return ( timer_msg);
 3210  197  119   ! !     !   !   ! msg^.u2:= result_full
 3220  198  120   ! !     !   !   END  ELSE
 3230  199  121   ! !     !   !   BEGIN
 3240  200  122   ! !     !   !   ! timer_msg^.u2:= result_ok;
 3250  201  123   ! !     !   !   ! msg^.u2:= result_ok;
 3260  202  124   ! !     !   !   ! LOCK msg AS buf: params DO
 3270  203  125   ! !     !   !   !   BEGIN
 3280  204  126   ! !     !   !   !   ! tickcount(index):= buf.count;
 3290  205  127   ! !     !   !   !   ! objects(index):= buf.object;
 3300  206  128   ! !     !   !   !   ! buf.index:= index;
 3310  207  129   ! !     !   !   !   END;
 3320  208  130   ! !     !   !   ! LOCK timer_msg AS data:identdata DO data.object:= objects(index);
 3330  209  131   ! !     !   !   ! saved(index) :=: timer_msg;
 3340  210  132   ! !     !   !   ! IF index > used THEN used:= index
 3350  211  133   ! !     !   !   END;
 3360  212  134   ! !     !   ! return ( msg)
 3370  213  135   ! !     !   END; (* booking *)
 3380  214  136   ! !     ! 
\f

tstmolst    81.04.10.   12.30.                                                    page     7

 3390  215  137   ! !     ! write:                    (* update tickcount  *)
 3400  216  138   ! !     !   BEGIN
 3410  217  139   ! !     !   ! LOCK msg AS buf:params DO
 3420  218  140   ! !     !   !   BEGIN
 3430  219  141   ! !     !   !   ! IF ( first<=buf.index ) AND ( buf.index<=cmax ) THEN
 3440  220  142   ! !     !   !   !   IF nil( saved(buf.index)) THEN  msg^.u2:= result_wrong  ELSE
 3450  221  143   ! !     !   !   !     IF buf.object = objects(buf.index) THEN
 3460  222  144   ! !     !   !   !       BEGIN
 3470  223  145   ! !     !   !   !       ! saved(buf.index)^.u3:= msg^.u3;
 3480  224  146   ! !     !   !   !       ! IF buf.count = 0 THEN return ( saved(buf.index))  ELSE
 3490  225  147   ! !     !   !   !       !   tickcount(buf.index):= buf.count;
 3500  226  148   ! !     !   !   !       ! msg^.u2:= result_ok
 3510  227  149   ! !     !   !   !       END  ELSE   msg^.u2:= result_obj
 3520  228  150   ! !     !   !   !     ELSE  msg^.u2:= result_index
 3530  229  151   ! !     !   !   END;
 3540  230  152   ! !     !   ! return ( msg)
 3550  231  153   ! !     !   END;
 3560  232  154   ! !     ! 
 3570  233  155   ! !     ! OTHERWISE                 (*  all unknown functions  *)
 3580  234  156   ! !     ! BEGIN
 3590  235  157   ! !     ! ! msg^.u2:= result_unknw;
 3600  236  158   ! !     ! ! return ( msg )
 3610  237  159   ! !     ! END;
 3620  238  160   ! !     END;   (*  case  *)
 3630  239  161   ! UNTIL forever
 3640  240  162   ! 
 3650  241  163   END .    (* of time out process *)
 3660  242        
\f

tstmolst    81.04.10.   12.30.                                                    page     8

           0   66*   68*  114   118   120   126   128   224 
           1   33*   38*   74*   88   111   115   119   127   168   178   178   192 
           2   37*   39*   45*   87 
           3   40*   46*
           4   41*   47*
           5   42*   48*
           6   43*   49*
           7   50*
          24  120 
          60  112   116 
         100  147   158   159 
         255   85 
alloc          92 
al_env_version                                                   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
               82 
as            144:  155:  176:  202:  208:  217:
buf           144:  146   147   155:  157   158   159   176:  178   178   179   202:  204   205   206 
              217:  219   219   220   221   221   223   224   224   225   225 
byte           68*
cmax           34*   57*  169   193   219 
console        65*   81    82 
count          58*   60*  178   178=  179   204   224   225 
data          208:  208 
delay          67*   84=   85    87=   87    90 
delay1         68*   90=   94   105 
delay2         68*   88=   88    95   106 
dummy          52*  137 
dummy_route    52*
false          51*
first          33*   57*   69*  124   167   191   219 
forever        51*  239 
hh            144:  146=  155:  157 
hour           66*  119=  119   120   120=  146   157=
identdata      59*  208 
inactive       37*  131 
incname        81 
index          58*   69*  124=  126   127   127   128   130   130   131   167=  168   168=  168   169 
              179   181   181   182   183   183   191=  192   192=  192   193   204   205   206=  206 
              208   209   210   210   219   219   220   221   223   224   225 
integer         7*   58*   59*   60*   66*   67*   71*  144   155 
lock          144:  155:  176:  202:  208:  217:
main_sem        4*   92   101 
max             7*
min            66*  115=  115   116   118=  147   158=
\f

tstmolst    81.04.10.   12.30.                                                    page     9

mm            144:  147=  155:  158   159 
modules        57*   69*   71*   72*
msg            73*   92    93    94    95    97   101   103   105   106   108   137   137   140   144:
              149   150   155:  161   162   171   172   175   176:  182   189   190   197   201   202:
              212   217:  220   223   226   227   228   230   235   236 
object         58*   59*  205   208=  221 
objects        71*  181=  205=  208   221 
opsem           3*   81 
own            81 
ownertest     103 
params         58*  202   217 
pool           74*
pop           189 
process         2*
read           45*  142:
readstatus     46*  165:
readwrite      49*   93 
reference      72*   73*
result_full    39*  171   195   197 
result_index   42*  228 
result_obj     41*  227 
result_ok      38*  149   161   175   200   201   226 
result_unknw   43*  235 
result_wrong   40*  220 
return        130   137   150   162   172   196   212   224   230   236 
rwcontrol      50*  187:
s              92 
saved          72*  130   130   168   182=  192   209=  220   223   224 
savedata       60*  176 
sec            66*  111=  111   112   114=  147   159=
semaphore       3*
sendtimer      97   108 
testopen       81 
testout        82 
tickcount      70*  126   127=  127   128   131=  179=  204=  225=
ticklength      6*   84 
tickmess       74*   92   103 
timeout_l      34*
timer_msg      73*  189   190   195   196   200   208:  209 
timout          2*
ts_pointer      4*
u1             93=  140 
u2            149=  161=  171=  175=  195=  197=  200=  201=  220=  226=  227=  228=  235=
u3             94=  105=  137   190=  190   223=  223 
\f

tstmolst    81.04.10.   12.30.                                                    page    10

u4             95=  106=
used           69*  124   183   183=  210   210=
version        30*   82 
w             101 
wait          101 
write          47*  215:
writecontrol   48*  153:
zone           65*
\f

tstmolst    81.04.10.   12.30.                                                    page    11

AND                1
ARRAY              2
BEGIN             23
CASE               1
CONST              1
DIV                2
DO                10
ELSE               9
END               29
FOR                1
IF                17
MOD                1
NIL                4
NOT                3
OF                 3
OTHERWISE          1
RECORD             5
REPEAT             1
THEN              17
TO                 1
TYPE               1
UNTIL              1
VAR                2
WHILE              3
▶EOF◀