home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / vmsnet / monhl104 / part13 < prev    next >
Encoding:
Internet Message Format  |  1992-08-02  |  43.0 KB

  1. Path: uunet!mcsun!news.funet.fi!hydra!klaava!hurtta
  2. From: Kari.Hurtta@Helsinki.FI (Kari E. Hurtta)
  3. Newsgroups: vmsnet.sources.games
  4. Subject: Monster Helsinki V 1.04 - part 13/32
  5. Keywords: Monster, a multiplayer adventure game
  6. Message-ID: <1992Jun14.021837.4404@klaava.Helsinki.FI>
  7. Date: 14 Jun 92 02:18:37 GMT
  8. Sender: hurtta@klaava.Helsinki.FI (Kari Hurtta)
  9. Followup-To: vmsnet.sources.d
  10. Organization: University of Helsinki
  11. Lines: 1272
  12.  
  13. Archieve-name: monster_helsinki_104/part13
  14. Author: Kari.Hurtta@Helsinki.FI
  15. Product: Monster Helsinki V 1.04
  16. Environment: VMS, Pascal
  17. Part: 13/32
  18.  
  19. -+-+-+-+-+-+-+-+ START OF PART 13 -+-+-+-+-+-+-+-+
  20. X    else buffer `091used`093 := ''`009`009`009
  21. X    end;
  22. X
  23. X    old_prompt := prompt;
  24. X    s := line;`009`009`009`009`009
  25. X    if eof_detected then eof_handler;
  26. X
  27. Xend; `123 grab_line `125       `009`009`009`123 end of grab line`009`125
  28. X
  29. X`032
  30. X
  31. X`091external(LIB$SPAWN)`093`032
  32. X   Function SPAWN      ( %DESCR command_string:     string := %IMMED 0;`032
  33. X                         %DESCR input_file:         string := %IMMED 0;
  34. X                         %DESCR output_file:        string := %IMMED 0;
  35. X                         %REF   flags:              unsigned := %IMMED 0;
  36. X                         %DESCR process_name:       STRING := %IMMED 0;
  37. V        `032
  38. X                         %REF   process_id:         unsigned := %IMMED 0;
  39. X                         %REF   completion_status:  integer := %IMMED 0;
  40. X`009`009`009 %REF   completion_efn:     integer := %IMMED 0;
  41. X                         %REF   AST:  `091unsafe`093      integer := %IMMED
  42. V 0;
  43. X                                ASTarg: `091unsafe`093    integer := %IMMED
  44. V 0;
  45. X                         %DESCR prompt:             STRING  := %IMMED 0;
  46. X                         %DESCR cli:                STRING  := %IMMED 0
  47. X                       ): unsigned; EXTERNAL;
  48. X
  49. X
  50. X
  51. XProcedure ReadTerminalType;     `123 By Kari Hurtta `125
  52. XVar result: Unsigned;
  53. XBegin
  54. X  if not odd (GetDvi (DVI$_TRM,,'SYS$OUTPUT',result)) then
  55. X`009terminal := false`009`009`123 Some bad failure (?) `125
  56. X  Else `009Terminal := Odd (Result);       `123 Is this terminal `009`125
  57. X `032
  58. X  If terminal then begin
  59. X`009if not odd (GetDvi (DVI$_TT_DECCRT,,'SYS$OUTPUT',result)) then
  60. X`009`009DecCrt := false`009`009`123 some bad failure (?)`009`125
  61. X`009else`009DecCrt := Odd (result)
  62. X  End;
  63. X
  64. X    if not odd (GetDvi(DVI$_DEVBUFSIZ,,'SYS$OUTPUT',result)) then
  65. X`009terminal_line_len := 80`009`009`123 some wrong so default `125
  66. X    else terminal_line_len := int(result);
  67. X
  68. X    if not odd (GetDvi(DVI$_TT_PAGE,,'SYS$OUTPUT',result)) then
  69. X`009terminal_page_len := 24`009`009`123 some wrong so default `125
  70. X    else terminal_page_len := int(result);
  71. X
  72. Xend; `123 ReadTerminalType `125
  73. X                                        `032
  74. X`091 global`093
  75. Xprocedure setup_guts;
  76. Xvar
  77. X        border: unsigned;
  78. X        rows,cols: integer;
  79. X        mask: unsigned;
  80. X`032
  81. Xbegin
  82. X        seed := clock;
  83. X        old_prompt := '';
  84. X     `032
  85. X`009ReadTerminalType;
  86. X`032
  87. X    syscall($assign('SYS$OUTPUT',out_chan));
  88. X    syscall($assign('SYS$INPUT',inp_chan));
  89. X
  90. X    syscall($clref(tmr_efn));`009`009`123 timer not yet launced `125
  91. X    check_timer(force := true);`009`009`123 activate timer `125
  92. X
  93. X
  94. X   mask := %X'02000000';        `123 CTRL/Y  Just for DCL `125
  95. X`123 mask := ...21... for ctrl-t too `125
  96. X   syscall( lib$disable_ctrl( mask, save_dcl_ctrl ));`032
  97. X`032
  98. Xend;
  99. X`032
  100. X`091global`093
  101. Xprocedure finish_guts;
  102. X`032
  103. Xbegin
  104. X`009
  105. X       syscall( lib$enable_ctrl(save_dcl_ctrl));       `123 re-enable dcl ct
  106. Vrls `125
  107. Xend;
  108. X
  109. X
  110. X`091global`093           `032
  111. XProcedure do_dcl (command: string := '');
  112. X
  113. XConst dcl_efn = 32;`009`009`123 EF:n numero `125
  114. X                    `032
  115. XVar end_dcl: boolean;           `123 True kun aliohjelma suoritettu loppuun
  116. V `125
  117. X    code:    unsigned;           `123 Tapahtumalipun tila `125
  118. X    succeed: boolean;           `123 onnistuiko k`228sky `125
  119. X    Id:      unsigned;          `123 prosessin pid `125
  120. X    name:    string;            `123 prosessin nimi `125
  121. X    mask:    unsigned := 2 ** (dcl_efn-base_efn) + 2 ** (tmr_efn-base_efn);
  122. XBegin    `032
  123. X
  124. X  name := Substr ('_'+userident,1,10);`032
  125. X `032
  126. X  WriteLn ('Control switch to child-process: ',name);`032
  127. X  if command = '' Then WriteLn ('Use LOG to return Monster.');
  128. X                                        `032
  129. X  succeed := odd (SPawn ( command, '' , '' , 1 ,
  130. X                            name , Id , 0, dcl_efn,,,'Dcl> '));
  131. X  If not succeed Then WriteLn ('Oops ! Can''t start child process ..');
  132. X `032
  133. X  end_dcl := not succeed;
  134. X  while not end_dcl do  `123 odotetaan loppumista `125
  135. X    begin
  136. X     `032
  137. X      syscall($wflor(base_efn,mask));   `123 odotetaan ett`228 timerin tai a
  138. Vliprosessin
  139. X`009`009`009`009      EF laukeaa `125
  140. X
  141. X      if (check_timer) then checkevents (true);`032
  142. X`009`009`009`123 check_timer my`246skin laittaa timeri uudestaan `125
  143. X`009`009`009`123 k`228yntiin. alunperin se on k`228ynistetty `125
  144. X`009`009`009`123 setup_guts:issa `125
  145. X
  146. X      syscall ($readef (base_efn,code));
  147. X      end_dcl := uand(code,2 ** (dcl_efn-base_efn)) > 0; `123 onko lapsi kuo
  148. Vllut `125
  149. X    end;
  150. X
  151. X WriteLn ('Control return to Monster');
  152. X
  153. XEnd; `123 do_dcl `125
  154. X
  155. X`032
  156. Xend.
  157. $ CALL UNPACK GUTS.PAS;147 3047530017
  158. $ create/nolog 'f'
  159. XWelcome to the game Monster!
  160. X
  161. XBut what now?
  162. X
  163. XGoodgulf the Grey appears in a puff of orange smoke!
  164. XHe is very angry...
  165. X
  166. X"What are you doing here? The Dungeon is now closed!"
  167. X
  168. XHe waves his Iron Staff and yells "Begone!"
  169. X
  170. XYou disappear in a burst of multicolored light...
  171. X
  172. XOn wall you see announcement:
  173. X
  174. X**********************************************************************
  175. X*                                                                    *
  176. X*                    Dungeon is closed on weekdays                   *
  177. X*                         between 09.00-17.00                        *
  178. X*                                                                    *
  179. X**********************************************************************
  180. $ CALL UNPACK ILMOITUS.TXT;5 1426665687
  181. $ create/nolog 'f'
  182. X! Monster initialization file    (c) Kari Hurtta
  183. X!`032
  184. X! Name of this file must be MONSTER.INIT
  185. X! The file must be located in the same direction as the monster's image.
  186. X
  187. XMM_userid: %manager%
  188. X`009
  189. X! The Monster Manager has the most power; this should be
  190. X! the game administrator.`032
  191. X
  192. X! protected_MM: true
  193. X
  194. Xgen_debug:   false
  195. X!`009`009   this tells whether everyone may use the debug command.
  196. X!                  it must be able to be disabled because it tells players
  197. X!                  too much about monsters. On the other hand, it must also`
  198. V032
  199. X!                  be able to be enabled, if we want to do test runs under
  200. X!                  an unprivileged userid`009`009
  201. X
  202. XREBUILD_OK: true
  203. X
  204. X!`009`009  if this is true, the MM can blow away and reformat the
  205. X!`009`009  entire universe. It's a good idea to set this to false
  206. X
  207. Xroot:    %db1% ! world database
  208. Xcoderoot:%db2% ! mdl database
  209. X       `032
  210. X!`009`009  This is where the Monster database goes.
  211. X!`009`009  The root directory must be  world:e  and
  212. X!`009`009  the  datafiles  Monster  creates  in  it
  213. X!`009`009  world:rw for people to be able to  play.
  214. X!`009`009  The  coderoot  directory  is  where  the
  215. X!`009`009  codefiles for monsters go. The directory
  216. X!`009`009  must additionally have  an  ACL  default
  217. X!`009`009  world:rw  for  files  and ACL rw for the
  218. X!`009`009  managers. This sucks, but we don't  have
  219. X!`009`009  setgid to games on VMS.`032
  220. X
  221. XLEVELTABLE:
  222. X!  name`009`009    exp`009         priv`009 health`009   h.fac    pow    hid
  223. Vden`032
  224. XBeginner,           0,           0,      10,       40,      0,     nohidden
  225. XNovice,             1,           0,      10,       40,      2,     nohidden
  226. XRanger,             500,         0,      15,       50,      3,     nohidden
  227. XAdventurer,         1000,        0,      20,       60,      5,     nohidden
  228. XHero,               2000,        32,     30,       60,      10,    nohidden
  229. XChampion,           6000,        0,      40,       70,      10,    nohidden
  230. XConjurer,           12000,       16,     50,       70,      12,    nohidden
  231. XMagician,           20000,       0,      60,       70,      15,    nohidden
  232. XEnchanter,          40000,       2,      80,       75,      20,    nohidden
  233. XSorcerer,           70000,       256,      100,      80,      20,    nohidde
  234. Vn
  235. XWarlock,            120000,      4,      120,      85,      35,    nohidden
  236. XApprentice wizard,  300000,      8,      150,      85,      50,    nohidden
  237. XWizard,             700000,      64,     300,      90,      80,    nohidden
  238. XAlmost Dead,        1000100,     0,      10,       40,      2,     hidden
  239. XManager,            2000000,     1,      500,      100,     500,   hidden
  240. XDruid,              2001000,     0,      500,      100,     500,   hidden
  241. XCharlatan,          2008000,     0,      500,      100,     500,   hidden
  242. XWanderer,           2009000,     0,      500,      100,     500,   hidden
  243. XChief Architect,    3000000,     0,      500,      100,     500,   hidden
  244. XBug Hunter,         5000000,     0,      500,      100,     500,   hidden
  245. XEND OF LEVELTABLE
  246. XArchpriv:   0
  247. XArchhealth: 800
  248. XArchfactor: 100
  249. XArchpower:  1000
  250. X
  251. Xmaxexperience: 1000000
  252. X!  Monster Manager's experience is MaxInt
  253. X
  254. Xprotect_exp: 700000
  255. X!  gives protection agaist violence
  256. X
  257. XPlaytime: +++++++++--------+++++++
  258. X! Eli suomeksi:
  259. X! Monster on suljettu arkisin 09-17.
  260. X
  261. X!Playtime: ++++++++++++++++++++++++   ! Miten niin suljettu ?
  262. X!                                       onpa taas suljettu.
  263. X
  264. Xdefault_allow: 20    ! How many rooms players made at default
  265. Xmin_room:      5     ! How many rooms players can made without exit request
  266. Xmin_accept:    5     ! How many accepts must players made
  267. $ CALL UNPACK INIT.PROTO;2 994737065
  268. $ create/nolog 'f'
  269. X`091inherit ('Global','Guts','Database','Parser'),environment`093
  270. Xmodule interpreter (output);`009`009`009    `123 hurtta@finuh `125
  271. X`123+
  272. XCOMPONENT: Interpreter for MDL
  273. X`009   MDL = Monster Definition Language
  274. X
  275. XPROGRAM DESCRIPTION:
  276. X`032
  277. X   `032
  278. X`032
  279. XAUTHORS:
  280. X`032
  281. X    Kari Hurtta
  282. X`032
  283. XCREATION DATE: (unknown) about ?.3.1989
  284. X`032
  285. XDESIGN ISSUES:
  286. X`032
  287. X
  288. X`032
  289. XVERSION:
  290. X
  291. X
  292. X`032
  293. XMODIFICATION HISTORY:
  294. X`032
  295. X     Date     `124   Name  `124 Description
  296. X--------------+---------+---------------------------------------------------
  297. V----
  298. X   11.2.1991  `124         `124 This comment header created
  299. X   26.5.1992  `124 Hurtta  `124 Now parser print error line also (LINE_* in
  300. V parse)
  301. X--------------+---------+---------------------------------------------------
  302. V----
  303. X
  304. X-`125
  305. X`032
  306. X`123 Interpreter for MDL `125
  307. X`123 MDL = Monster Definition Language `125
  308. X
  309. X`123 Kooditiedoston rakenne:
  310. X
  311. XYksi atomi (= yksi rivi kooditiedostossa):
  312. X
  313. XTapaus 1:
  314. X
  315. X<atomin numero>,
  316. Xkaksoispiste,
  317. X<parametrin 1 numero>,
  318. Xkaksoispiste,
  319. X<parametrin 2 numero>,
  320. Xkaksoispiste,
  321. X<parametrin 3 numero>,
  322. Xkaksoispiste,
  323. X<funktion nimi>,
  324. XEOLN
  325. X
  326. XTapaus 2:
  327. X
  328. X<atomin numero negatiivisena>,
  329. Xkaksoispiste,
  330. X<parametrin 1 numero>,
  331. Xkaksoispiste,
  332. X<parametrin 2 numero>,
  333. Xkaksoispiste,
  334. X<parametrin 3 numero>,
  335. Xkaksoispiste,
  336. X<funktion numero>,
  337. XEOLN
  338. X
  339. XTapaus 3:
  340. X
  341. X<atomin numero negatiivisena>,
  342. Xkaksoispiste,
  343. X<parametrin 1 numero>,
  344. Xkaksoispiste,
  345. X<parametrin 2 numero>,
  346. Xkaksoispiste,
  347. X<parametrin 3 numero>,
  348. Xkaksoispiste,
  349. X<funktion numero>,
  350. Xkaksoispiste,
  351. X<parametrien lukum`228`228r`228 - 3>,
  352. Xkaksoispiste,
  353. X<loput parametrit kaksoipistell`228 erotettuina>,
  354. XEOLN
  355. X
  356. XTapaus 4:
  357. XH,
  358. X<header -funktion numero>,
  359. Xkaksoispiste,
  360. X<parametrien lukum`228`228r`228>,
  361. Xkaksoispiste,
  362. X<parametrit kaksoispisteell`228 erotettuina>,
  363. Xkaksoispiste,
  364. Xlabel_kentt`228,
  365. XEOLN
  366. X
  367. XTapaus 5:
  368. XJ,
  369. X<hyppyosoite>,
  370. Xkaksoispiste,
  371. X<parametrien lukum`228`228r`228>,
  372. Xkaksoispiste,
  373. X<parametrit kaksoispisteell`228 erotettuina>,
  374. XEOLN
  375. X
  376. X`125
  377. X
  378. X
  379. Xconst atom_length = shortlen;  `032
  380. X
  381. X
  382. X      string_length = mega_length;
  383. X
  384. X`032
  385. X      max_functions = 80;  `123 esimerkiksi null,get, ...   `125
  386. X      max_headers   = 10;  `123 esimerkiksi SUBMIT, FOR ... `125
  387. X      max_labels    = 50;`032
  388. X
  389. X`009max_flag = 5;
  390. X`009max_param = 30;
  391. X
  392. X`009new_line_limit = 3;`009`123 kuinka monta parametria pit`228`228 olla ett
  393. V`228 `125
  394. X`009`009`009`009`123 parametrit tulostetaan kukin omalle`032
  395. X`009`009`009`009    rivilleen `125
  396. X
  397. X`009max_buffer = 5;`009`009`123 Puskurien lukum`228`228r`228 `125
  398. X
  399. X`009ERROR_ID = 70;`009`009`123 virheen numero `125
  400. X`009LABEL_ID = 6;`009`009`123 LABEL headerin numero `125
  401. X`009GOSUB_ID = 3;`009`009`123 GOSUB headerin numero `125
  402. X                     `032
  403. Xtype  atom_t = shortstring; `009`009`009    `123 Muuttujat ja k`228skyt   `1
  404. V25
  405. X`009`009`009`009`009`009    `123 ja listan alkiot`009    `125
  406. X      string_t = mega_string;                       `123 merkkijonot`009
  407. V    `125
  408. X      string_l = string;`009`009`009`123 rivin pituiset merkkijonot `125
  409. X`009`123 class moved to parser.pas `125
  410. X
  411. X      name_type = (n_function, n_header, n_const, n_comment,
  412. X`009`009   n_head, n_error,n_variable, n_gosub);
  413. X`009`009`009`009`009`009    `123 loodin k`228skyjen tyyppi `125
  414. X
  415. X      paramtable = array `091 1 .. max_param `093 of integer;
  416. X
  417. X
  418. X      atom = record`009`009`009`009    `123 yksi ohjelman k`228sky   `125
  419. X`009`009nametype: name_type;
  420. X                name: integer;
  421. X                long_name: `094string_t;
  422. X`009`009params: paramtable
  423. X                `123 p1,p2,p3: integer `125
  424. X             end;                `032
  425. X
  426. X     tabletyp = array `091 1 .. MAXATOM `093 of atom;`009`123 Ohjelman talle
  427. Vtuspaikka   `125
  428. X    `032
  429. X     buffer = record
  430. X`009table: tabletyp;
  431. X`009used: 0 .. MAXATOM;`009`009`009`123 Ohjelman koko`009`009    `125
  432. X`009current_program: integer;`009`009`123 T`228m`228nhetkinen ohjelmakood `1
  433. V25
  434. X`009current_version: integer;`009`009`123 ja sen versionumero`009    `125
  435. X`009time: 0 .. maxint;`009`009`009`123 Kuinka paljon aikaa`009    `125
  436. X`009`009`009`009`009`009`123 k`228yt`246st`228 `125
  437. X    end; `123 buffer `125
  438. X                     `032
  439. XVar`009line_i: string_t := '';
  440. X      code_running : boolean := false; `123 est`228`228 p`228`228lekk`228ise
  441. Vn suorittamisen `125
  442. X      cursor: integer := 0;
  443. X      cl,ql: class;      `032
  444. X      error_counter : integer := 0;
  445. X
  446. X`009pool : array `091 1 .. max_buffer `093 of buffer;
  447. X`009current_buffer : 1 .. max_buffer;
  448. X
  449. X`009monster_level: integer;`009    `123 0 jos ei tasoa `125`032
  450. X`009used_attack:   integer;
  451. X`009attack_limit:  integer;
  452. X
  453. X      privilegion: boolean;`009    `123 lippu: onko koodi privileged-moodiss
  454. Va `125
  455. X      system_code: boolean;`009    `123 lippu: omistaako systeemi koodin`009
  456. V    `125
  457. X      spell_mode:  boolean;`009    `123 lippu: onko spell-moodissa
  458. V            `125
  459. X         `032
  460. X      ftable: array `091 1 .. max_functions `093 of record
  461. X`009    name: atom_t;
  462. X`009    min:  0 .. max_param;
  463. X`009    max:  0 .. max_param
  464. X      end;
  465. X
  466. X      htable: array `091 1 .. max_headers `093   of record
  467. X`009    name: atom_t;
  468. X`009    min:  0 .. max_param;
  469. X`009    max:  0 .. max_param
  470. X      end;
  471. X
  472. X      flagtable: array `0911 .. max_flag `093 of record
  473. X`009`009value: unsigned;
  474. X`009`009off: string_l;
  475. X`009`009on: string_l;
  476. X`009    end;
  477. X
  478. XValue ftable := (
  479. X`009('+',`009`0092,  max_param),`009    `123 1 `125
  480. X`009('=',`009`0092,  2),`009`009    `123 2 `125
  481. X`009('inv',`009`0090,  0),`009`009    `123 3 `125
  482. X`009('pinv',`0090,  0),`009`009    `123 4 `125
  483. X`009('players',`0090,  0),`009`009    `123 5 `125
  484. X`009('objects',`0090,  0),`009`009    `123 6 `125
  485. X`009('get',`009`0091,  1),`009`009    `123 7 `125
  486. X`009('pget',`0091,  1),`009`009    `123 8 `125
  487. X`009('drop',`0091,  1),`009`009    `123 9 `125
  488. X`009('pdrop',`0091,  1),`009`009    `123 10 `125
  489. X`009('and',`009`0092,  2),`009`009    `123 11 `125
  490. X`009('or',`009`0091,  3),`009`009    `123 12 `125
  491. X`009('move',`0091,  1),`009`009    `123 13 `125
  492. X`009('pmove',`0091,  1),`009`009    `123 14 `125
  493. X`009('pprint',`0090,  max_param),`009    `123 15 `125
  494. X`009('print',`0090,  max_param),`009    `123 16 `125
  495. X`009('oprint',`0090,  max_param),`009    `123 17 `125
  496. X`009('pprint raw',`0090,  max_param),`009    `123 18 `125
  497. X`009('print raw',`0090,  max_param),`009    `123 19 `125
  498. X`009('oprint raw',`0090,  max_param),`009    `123 20 `125
  499. X`009('print null',`0091,  max_param),`009    `123 21 `125
  500. X`009('if',`009`0092,  3),`009`009    `123 22 `125
  501. X`009('where',`0091,  1),`009`009    `123 23 `125
  502. X`009('null',`0090,  max_param),`009    `123 24 `125
  503. X`009('attack',`0091,  1),`009`009    `123 25 `125
  504. X`009('heal',`0091,  1),`009`009    `123 26 `125
  505. X`009('not',`009`0091,  1),`009`009    `123 27 `125
  506. X`009('random',`0091,  1),`009`009    `123 28 `125
  507. X`009('strip',`0091,  1),`009`009    `123 29 `125
  508. X`009('experience',`0091,  1),`009`009    `123 30 `125
  509. X`009('plus',`0092,  2),`009`009    `123 31 `125
  510. X`009('difference',`0092,  2),`009`009    `123 32 `125
  511. X`009('times',`0092,  2),`009`009    `123 33 `125
  512. X`009('quotient',`0092,  2),`009`009    `123 34 `125
  513. X`009('set experience',  1,`0091),`009    `123 35 `125
  514. X`009('get state',`0090,  0),`009`009    `123 36 `125
  515. X`009('set state',`0091,  1),`009`009    `123 37 `125
  516. X`009('less',`0092,  2),`009`009    `123 38 `125
  517. X`009('number',`0091,  1),`009`009    `123 39 `125
  518. X`009('health',`0091,  1),`009`009    `123 40 `125
  519. X`009('all objects',`0090,  0),`009`009    `123 41 `125
  520. X`009('all rooms',`0090,  0),`009`009    `123 42 `125
  521. X`009('all players',`0090,  0),`009`009    `123 43 `125
  522. X`009('control',`0092,  2),`009`009    `123 44 `125
  523. X`009('exclude',`0092,  2),`009`009    `123 45 `125
  524. X`009('get remote state',`0091,  1),`009    `123 46 `125
  525. X`009('set remote state',`0092,  2),`009    `123 47 `125
  526. X`009('remote players',`0091,  1),`009    `123 48 `125
  527. X`009('remote objects',`0091,  1),`009    `123 49 `125
  528. X`009('duplicate',`0091,  1),`009`009    `123 50 `125
  529. X`009('pduplicate',`0091,  1),`009`009    `123 51 `125
  530. X`009('destroy',`009`0091,  1),`009    `123 52 `125
  531. X`009('pdestroy',`009`0091,  1),`009    `123 53 `125
  532. X`009('string head',`009`0091,  1),`009    `123 54 `125
  533. X`009('string tail',`009`0091,  1),`009    `123 55 `125
  534. X`009('head',`009`0091,  1),`009    `123 56 `125
  535. X`009('tail',`009`0091,  1),`009    `123 57 `125
  536. X`009('lookup object',`0091,  1),`009    `123 58 `125
  537. X`009('lookup player',`0091,  1),`009    `123 59 `125
  538. X`009('lookup room',`009`0091,  1),`009    `123 60 `125
  539. X`009('privilege',`009`0092,  2),`009    `123 61 `125
  540. X`009('parse player',`0091,  1),`009    `123 62 `125
  541. X`009('parse object',`0091,  1),`009    `123 63 `125
  542. X`009('parse room',`009`0091,  1),`009    `123 64 `125
  543. X`009('userid',`009`0091,  1),`009    `123 65 `125
  544. X`009('list',`0091,  max_param),`009    `123 66 `125
  545. X`009('mattack',`0092,  2),`009`009    `123 67 `125
  546. X`009('mheal',`0092,  2),`009`009    `123 68 `125
  547. X`009('include',`0092,  2),`009`009    `123 69 `125
  548. X`009('-ERROR-',`009`0090,  0),`009    `123 70 `125
  549. X`009('lookup direction',`0091,1),`009    `123 71 `125
  550. X`009('prog',1, max_param),`009`009    `123 72 `125
  551. X`009('get global flag',1,1),`009    `123 73 `125
  552. X`009('==',2,2),`009`009`009    `123 74 `125
  553. X`009('===',2,2),`009`009`009    `123 75 `125
  554. X`009('spell level',0,0),`009`009    `123 76 `125
  555. X`009('set spell level',1,1),`009    `123 77 `125
  556. X`009('',0,0),`009`009`123 78 `125
  557. X`009('',0,0),`009`009`123 79 `125
  558. X`009('',0,0)`009`009`123 80 `125
  559. X    );`032
  560. X
  561. X    htable := (
  562. X`009('SUBMIT ',`0092,2),`009`123 1 `125
  563. X`009('FOR ',`0092,2),`009`123 2 `125
  564. X`009('GOSUB ',`0090,max_param),`009`123 3 `125
  565. X`009('DEFINE ',`0091,1),`009`123 4 `125
  566. X`009('SET ',`0091,1),`009`123 5 `125
  567. X`009('LABEL ',`0090,max_param),`009`123 6 `125
  568. X`009('',0,0),`009`009`123 7 `125
  569. X`009('',0,0),`009`009`123 8 `125
  570. X`009('',0,0),`009`009`123 9 `125
  571. X`009('',0,0)`009`009`123 10 `125
  572. X`009);
  573. X   `032
  574. X
  575. X    flagtable := (
  576. X`009( 1, 'Control access enabled', 'Control access disabled' ),
  577. X`009( 2, 'Spell mode disabled', 'Spell mode enabled' ),
  578. X`009( 4, '', '' ),
  579. X`009( 8, '', '' ),
  580. X`009( 16, '', '' ));
  581. X
  582. X`123 muduulissa QUEUE olevia proseduureja `125
  583. X`091external`093
  584. Xfunction send_submit (monster: atom_t; code: integer;
  585. X`009label_name: atom_t; deltatime: integer; player: atom_t): boolean;
  586. Xexternal;
  587. X               `032
  588. X`123 moduulissa GUTS olevia proseduureja `125
  589. X
  590. X`123 moduulissa MON olevia globaaleja muuttujia `125
  591. Xvar  myname : `091external`093 atom_t;    `032
  592. X     `123 debug ja indx on nyt DATABASE.PASiissa `125
  593. X     userid: `091external`093 varying `09112`093 of char; `123 pit`228`228 o
  594. Vla yht`228 pitk`228 kuin `125
  595. X`009`009`009`009`009`009`123 weryshortstring `125
  596. X
  597. X`123 moduulissa MON olevia globaaleja rutiineja `125
  598. X
  599. X`091external`093                                                        `032
  600. Xprocedure checkevents (silent: boolean := false); external;
  601. X`091external`093
  602. Xfunction alloc_general(class: integer; var n: integer): boolean; external;
  603. X`091external`093
  604. Xprocedure delete_general(class: integer; var n: integer); external;
  605. X
  606. X`091external`093
  607. Xfunction int_userid(player: atom_t): atom_t; `123 = "" not found `125
  608. Xexternal;
  609. X`091external`093
  610. Xfunction int_set_experience(player: atom_t; amount: integer): boolean;
  611. Xexternal;
  612. X`091external`093
  613. Xfunction int_get_experience(player: atom_t): integer; external;
  614. X`091external`093
  615. Xfunction int_get_code(player: atom_t): integer; external;
  616. X
  617. X`091external`093
  618. Xfunction int_ask_privilege(player,privilege: atom_t): boolean; external;
  619. X
  620. X`091external`093
  621. Xfunction int_get_health(player: atom_t): integer; external;
  622. X
  623. X`123 int_lookup_X functions are in PARSER.PAS and no longer need definations
  624. V `125
  625. X
  626. X`091external`093`032
  627. Xfunction int_inv (player: atom_t): string_t; external;
  628. X`091external`093
  629. Xfunction int_objects(player: atom_t): string_t; external;
  630. X
  631. X
  632. X`091external`093
  633. Xfunction int_l_object: string_t; external;
  634. X
  635. X`091external`093
  636. Xfunction int_l_player: string_t; external;
  637. X
  638. X`091external`093
  639. Xfunction int_l_room: string_t; external;
  640. X
  641. X
  642. X`091external`093
  643. Xfunction int_players(player: atom_t): string_t; external;
  644. X`091external`093
  645. Xfunction int_remote_objects(room: atom_t): string_t; external;
  646. X`091external`093
  647. Xfunction int_remote_players(room: atom_t): string_t; external;
  648. X
  649. X
  650. X
  651. X`091external`093
  652. Xfunction int_get(player,object: atom_t): boolean; external;
  653. X`091external`093
  654. Xfunction int_drop(player,object: atom_t): boolean; external;
  655. X`091external`093
  656. Xfunction int_duplicate(player,object,owner: atom_t; privileged: boolean):
  657. X         boolean; external;
  658. Xfunction int_destroy(player,object,owner: atom_t; privileged: boolean):
  659. X         boolean; external;
  660. X
  661. X`091external`093
  662. Xfunction int_poof (player,room,owner: atom_t;`032
  663. X         general,own: boolean): boolean; external;
  664. X`091external`093
  665. Xfunction int_login (player: atom_t; force: boolean): integer; external;
  666. X`091external`093
  667. Xprocedure int_logout (player: atom_t); external;
  668. X`091external`093
  669. Xfunction int_where (player: atom_t): atom_t; external;
  670. Xfunction int_attack(player: atom_t; power: integer): boolean; external;
  671. X`091external`093
  672. Xfunction int_heal(player: atom_t; amount: integer): boolean; external;
  673. X`091external`093
  674. Xprocedure int_broadcast(player: atom_t; s: string_l; to_other: boolean);`032
  675. Xexternal;
  676. X
  677. X
  678. X`123 write_debug moved to parser.pas `125
  679. X
  680. X`123 cut_atom moved to parser.pas `125
  681. X
  682. Xfunction exact_function (var x: integer; s: atom_t): boolean;
  683. Xvar i: integer;
  684. Xbegin
  685. X    write_debug('%exact_function : s = ',s);
  686. X    x := 0;
  687. X    for i := 1 to max_functions do
  688. X`009if ftable`091i`093.name > '' then
  689. X`009    if EQ (s,ftable`091i`093.name) then x := i;
  690. X    exact_function := x <> 0;
  691. X    if x > 0 then write_debug('%exact_function : ok');
  692. Xend;
  693. X
  694. Xfunction exact_header (var x: integer; s: atom_t): boolean;
  695. Xvar i: integer;
  696. Xbegin
  697. X    write_debug('%exact_header : s = ',s);
  698. X    x := 0;
  699. X    for i := 1 to max_headers do
  700. X`009if htable`091i`093.name > '' then
  701. X`009    if index (s,htable`091i`093.name) = 1 then x := i;
  702. X    exact_header := x <> 0;
  703. X    if x > 0 then write_debug('%exact_header : ok');
  704. Xend;
  705. X
  706. Xfunction x_monster_owner (code: integer; class : integer := 0): atom_t;
  707. Xforward; `123 sama kuin monster_owner, muutta yht`228aikaa global & forward
  708. V `125
  709. X         `123 ei onnistunut `125
  710. X
  711. Xfunction x_get_flag(code: integer; flag: integer): boolean; forward;
  712. X
  713. X`123 classify moved to parser.pas `125   `032
  714. X
  715. X`123 clean_spaces moved to parser.pas `125
  716. X
  717. Xfunction count_params(params: paramtable): integer;
  718. Xvar i,count: integer;`009
  719. Xbegin`009`009`009    `009`123 lasketaan parametrien m`228`228r`228 `125
  720. X    write_debug('%count_params');
  721. X    count := 0;
  722. X    for i := 1 to max_param do if params`091i`093 <> 0 then count := i;
  723. X    count_params := count;
  724. Xend;`009`123 count_params `125
  725. X
  726. Xprocedure clear_program (buffer: integer);
  727. Xvar ln,i: integer;
  728. Xbegin
  729. X    with pool`091buffer`093 do begin
  730. X`009for ln := 1 to used do with table `091 ln `093 do begin
  731. X`009    for i := 1 to max_param do params`091i`093 := 0;
  732. X`009    if long_name <> nil then dispose(long_name);
  733. X`009    long_name := nil;
  734. X`009    nametype := n_comment;
  735. X`009    name := 0;
  736. X`009end;
  737. X`009used := 0;
  738. X`009time := 0;
  739. X`009current_program := 0;
  740. X`009current_version := 0;
  741. X    end;
  742. Xend; `123 clear program `125
  743. X  `032
  744. X
  745. Xprocedure parse (var source,result: text);      `032
  746. Xlabel 999;
  747. Xvar atom_count: integer;
  748. X    atom_readed: boolean;
  749. X    current_atom: string_t;
  750. X    error_flag: boolean;
  751. X    label_count: integer;
  752. X    labels : array `091 1 .. max_labels `093 of
  753. X`009record
  754. X`009    name: atom_t;
  755. X`009    loc: integer;
  756. X`009end;
  757. X
  758. X    line: string_t;
  759. X    linep,atom_line_p: integer;
  760. X    linecount: integer;
  761. X
  762. X    procedure read_line;
  763. X    begin
  764. X`009if EOF(source) then begin
  765. X`009    line := '';
  766. X`009    linep := 0;
  767. X`009    linecount := linecount +1;
  768. X`009    atom_line_p := -1;
  769. X`009end else begin
  770. X`009    READLN(source,line);
  771. X`009    linep := 1;
  772. X`009    atom_line_p := -1;
  773. X`009    linecount := linecount +1;
  774. X`009end;
  775. X    end; `123 read_line `125
  776. X
  777. X    function LINE_EOF: boolean;
  778. X    begin
  779. X`009if linep > 0 then LINE_EOF := false
  780. X`009else LINE_EOF := eof(source);
  781. X    end; `123 LINE_EOF `125
  782. X
  783. X    function LINE_EOLN: boolean;
  784. X    begin
  785. X`009LINE_EOLN := length(line) < linep;
  786. X    end; `123 LINE_EOLN `125
  787. X
  788. X    function LINE_C : char;
  789. X    begin
  790. X`009if length(line) < linep then LINE_C := ' '
  791. X`009else LINE_C := line`091linep`093;
  792. X    end; `123 LINE_C `125
  793. X
  794. X    procedure LINE_GET;
  795. X    begin
  796. X`009if length(line) < linep then read_line
  797. X`009else linep := linep  +1;
  798. X    end; `123 LINE_GET `125
  799. X`009
  800. X    procedure LINE_error;`032
  801. X    var I: integer;
  802. X    begin
  803. X`009writeln;
  804. X`009write(linecount:4,' ');
  805. X`009for I := 1 to length(line) do
  806. X`009    if classify(line`091i`093) = space then write (' ')
  807. X`009    else write (line`091i`093);
  808. X`009writeln;
  809. X`009if linep > 0 then begin
  810. X`009    if atom_line_p > 0 then writeln('     ','!':atom_line_p)
  811. X`009    else `009`009    writeln('near ','!':linep);
  812. X`009end;
  813. X    end; `123 LINE_error `125
  814. X
  815. X    procedure replace_GOSUB;
  816. X    var i,j,loc: integer;
  817. X    begin
  818. X`009for i := 1 to atom_count do
  819. X`009    with pool`091current_buffer`093.table`091i`093 do
  820. X`009`009if nametype = n_header then if name = GOSUB_ID then begin
  821. X`009`009    loc := 0;
  822. X`009`009    for j := 1 to label_count do
  823. X`009`009`009if EQ(long_name`094,labels`091j`093.name) then loc := j;
  824. X
  825. X`009`009    if loc = 0 then begin
  826. X`009`009`009LINE_error;
  827. X`009`009`009writeln('Error: GOSUB ',long_name`094);
  828. X`009`009`009writeln('       without LABEL ',long_name`094);
  829. X`009`009`009error_flag := true;
  830. X`009`009    end else begin
  831. X`009`009`009dispose(long_name);
  832. X`009`009`009long_name := nil;
  833. X`009`009`009nametype := n_gosub;
  834. X`009`009`009name := labels`091loc`093.loc;
  835. X`009`009    end;
  836. X`009`009end;
  837. X    end; `123 replace_GOSUB `125
  838. X
  839. X`009  procedure write_comment; forward;
  840. X
  841. X`009  function read_comment: string_t;
  842. X             var bf: string_t;`032
  843. X                 ok: boolean;
  844. X`009`009 too_long: boolean;
  845. X`009  begin
  846. X`009`009write_debug('%read_comment');
  847. X`009`009too_long := false;
  848. X                bf := LINE_C;
  849. X                if classify(LINE_C) <> comment then halt;
  850. X                LINE_GET;`032
  851. X                ok := LINE_EOF;
  852. X                if not ok then
  853. X                   if LINE_EOLN then ok := true;
  854. X
  855. X                while not ok do begin
  856. X                   if length(bf) >= string_length-2 then too_long := true`03
  857. V2
  858. X                   else if classify(LINE_C) = space then bf := bf + ' '
  859. X                   else bf := bf + LINE_C;
  860. X                   LINE_GET;
  861. X                   ok := LINE_EOF;
  862. X                   if not ok then
  863. X                      if LINE_EOLN then ok := true;
  864. X
  865. X                end; `032
  866. X                if too_long then begin
  867. X`009`009   error_flag := true;
  868. X`009`009   LINE_error;
  869. X                   Writeln ('Error: Too long comment.');
  870. X                   Writeln ('       Limit comments to ',string_length-2:1,'
  871. V characters.');
  872. X                end;
  873. X`009`009read_comment := bf;
  874. X`009`009write_debug('%read_comment = ',bf);
  875. X`009  end; `123 read_comment `125
  876. X
  877. X
  878. X
  879. X          function atom:string_t;
  880. X          var a: string_t;                `032
  881. X
  882. X`009
  883. X             function read_string: string_t;
  884. X             var bf: string_t;`032
  885. X                 ok,detec: boolean;
  886. X`009`009 too_long: boolean;
  887. X             begin
  888. X`009`009write_debug('%read_string');
  889. X`009`009too_long := false;
  890. X                bf := '';
  891. X                repeat
  892. X                   if classify(LINE_C) <> string_c then halt;
  893. X                   LINE_GET;`032
  894. X                   ok := LINE_EOF;
  895. X                   if not ok then
  896. X                      if LINE_eoln then ok := true
  897. X                      else if classify (LINE_C) = string_c then ok := true
  898. X`009`009      else if classify (LINE_C) = comment then begin
  899. X`009`009`009write_comment;
  900. X`009`009`009ok := true;
  901. X`009`009      end;
  902. X                   while not ok do begin
  903. X                      if length(bf) >= string_length-2 then too_long := true
  904. X                      else if classify(LINE_C) = space then bf := bf + ' '
  905. X                      else bf := bf + LINE_C;
  906. X                      LINE_GET;
  907. X                      ok := LINE_EOF;
  908. X                      if not ok then
  909. X                         if LINE_EOLN then ok := true
  910. X                         else if classify (LINE_C) = string_c then ok := tru
  911. Ve;
  912. X                   end; `032
  913. X                   if not(LINE_EOF) then LINE_GET;
  914. X                   if not(LINE_EOF) then if LINE_C = '&' then begin
  915. X                      LINE_GET;
  916. X                      detec := false;
  917. X                      repeat
  918. X                         if LINE_EOF then detec := true
  919. X                         else if LINE_EOLN then LINE_GET
  920. X                         else if classify(LINE_C) = space then LINE_GET
  921. X`009`009`009 else if classify(LINE_C) = comment then begin
  922. X`009`009`009    write_comment;
  923. X                         end else detec := true;
  924. X                      until detec;
  925. X                      if not(LINE_EOF) then`032
  926. X                         if classify(LINE_C) = string_c then ok := false;
  927. X                   end;
  928. X                until ok;
  929. X                read_string := '"' + bf + '"';
  930. X                if too_long then begin
  931. X`009`009   error_flag := true;
  932. X`009`009   LINE_error;
  933. X                   writeln('Error: String constant is too long.');
  934. X                   writeln('       Limit it to ',string_length-2:1,' charact
  935. Vers.');
  936. X                end;
  937. X`009`009write_debug('%read_string = ','"' + bf + '"');
  938. X             end; `123 read_string `125
  939. X
  940. X             function read_letter: atom_t;
  941. X             var bf: string_t;`032
  942. X                 ok: boolean;
  943. X             begin
  944. X`009`009write_debug('%read_letter');
  945. X                bf := LINE_C;
  946. X                if classify(LINE_C) <> letter then halt;
  947. X                LINE_GET;`032
  948. X                ok := LINE_EOF;
  949. X                if not ok then
  950. X                   if LINE_EOLN then ok := true
  951. X                   else ok := not (classify (LINE_C) in `091letter, space `0
  952. V93);
  953. X                while not ok do begin
  954. X                   if length(bf) >= string_length-2 then `123 too_long := tr
  955. Vue `125
  956. X                   else if classify(LINE_C) = space then bf := bf + ' '
  957. X                   else bf := bf + LINE_C;
  958. X                   LINE_GET;
  959. X                   ok := LINE_EOF;
  960. X                   if not ok then
  961. X                      if LINE_EOLN then ok := true
  962. X                      else ok := not (classify (LINE_C) in `091letter, space
  963. V `093);
  964. X                end; `032
  965. X                if length(bf) <= atom_length then read_letter := bf`032
  966. X                else begin
  967. X`009`009   LINE_error;
  968. X                   Writeln ('Error: Too long symbol.');
  969. X                   Writeln ('       Limit symbols to ',atom_length:1,' chara
  970. Vcters.');
  971. X`009`009   error_flag := true;
  972. X                   read_letter := substr(bf,1,atom_length)
  973. X                end;
  974. X`009`009write_debug('%read_letter = ',bf);
  975. X             end; `123 read_letter `125
  976. X
  977. X
  978. X      var ok : boolean;
  979. X
  980. X      begin `123 atom `125
  981. X`009write_debug('%atom');
  982. X`009atom_line_p := -1;
  983. X        ok := classify (LINE_C) <> space;
  984. X`009if classify(LINE_C) = comment then begin
  985. X`009    write_comment;
  986. X`009    ok := LINE_EOF;
  987. X`009end;
  988. X        while not ok do begin`032
  989. X          LINE_GET;
  990. X          if LINE_EOF then ok := true
  991. X          else if classify (LINE_C) = comment then begin
  992. X`009    write_comment;
  993. X`009    ok := LINE_EOF;
  994. X`009  end else ok :=  classify (LINE_C) <> space;
  995. X        end;
  996. X       `032
  997. X        atom := '';
  998. X        if not (LINE_EOF) then begin
  999. X`009   atom_line_p := linep;
  1000. X           case classify(LINE_C) of
  1001. X              space: halt;
  1002. X`009      comment: halt;
  1003. X              string_c: atom := read_string;
  1004. X              bracket: begin
  1005. X                 atom := LINE_C;
  1006. X                 LINE_GET;
  1007. X              end;
  1008. X             letter: atom := clean_spaces(read_letter);
  1009. X           end;
  1010. X        end;
  1011. X      end; `123 atom `125
  1012. X
  1013. X          procedure read_atom;`009 `032
  1014. X          begin
  1015. X`009    write_debug('%read_atom');
  1016. X            if not atom_readed then begin
  1017. X               if LINE_EOF then begin
  1018. X`009`009  LINE_error;
  1019. X                  writeln('Error: END OF FILE detected');
  1020. X`009`009  error_flag := true;
  1021. X
  1022. X                  goto 999
  1023. X               end;
  1024. X               current_atom := atom;
  1025. X               if current_atom > '' then if current_atom `0911`093 = '_' the
  1026. Vn begin
  1027. X`009`009  error_flag := true;
  1028. X`009`009  LINE_error;
  1029. X                  writeln('Error: Symbol can''t start with _');
  1030. X
  1031. X`009       end;
  1032. X            end;
  1033. X`009    write_debug('%read_atom : current_atom = ',current_atom);
  1034. X            atom_readed := true
  1035. X          end;
  1036. X
  1037. X`009  function search_atom: integer;
  1038. X`009  var i,j,loc: integer;
  1039. X`009    flag: boolean;
  1040. X`009  begin
  1041. X`009    loc := 0;
  1042. X`009    for i := 1 to atom_count -1 do
  1043. X`009`009if pool`091current_buffer`093.table`091atom_count`093.nametype =
  1044. X`009`009    pool`091current_buffer`093.table`091i`093.nametype `032
  1045. X`009`009then if pool`091current_buffer`093.table`091atom_count`093.name =
  1046. X`009`009    pool`091current_buffer`093.table`091i`093.name`032
  1047. X`009`009then if (pool`091current_buffer`093.table`091atom_count`093.long_nam
  1048. Ve`032
  1049. X`009`009`009= nil) =
  1050. X`009`009    (pool`091current_buffer`093.table`091i`093.long_name = nil)`032
  1051. X`009`009then begin
  1052. X`009`009   if pool`091current_buffer`093.table`091i`093.long_name = nil then
  1053. V flag`032
  1054. X`009`009`009:= true
  1055. X`009`009   else flag :=`032
  1056. X`009`009    EQ(pool`091current_buffer`093.table`091atom_count`093.long_name`
  1057. V094,
  1058. X`009`009`009pool`091current_buffer`093.table`091i`093.long_name`094);
  1059. X`009`009    `123 EQ: NonPadding comparison `125
  1060. X
  1061. X`009`009    if flag then for j := 1 to max_param do
  1062. X`009`009`009if pool`091current_buffer`093.table`091atom_count`093.params`091
  1063. Vj`093 <>
  1064. X`009`009`009    pool`091current_buffer`093.table`091i`093.params`091j`093 th
  1065. Ven
  1066. X`009`009`009`009flag := false;
  1067. X
  1068. X`009`009    if flag then loc := i;
  1069. X
  1070. X`009`009end;
  1071. X`009   `032
  1072. X`009`009if loc = 0 then search_atom := atom_count
  1073. X`009`009else begin
  1074. X`009`009    with pool`091current_buffer`093.table `091 atom_count `093 do be
  1075. Vgin
  1076. X`009`009`009for i := 1 to max_param do params`091i`093 := 0;
  1077. X`009`009`009    if long_name <> nil then dispose(long_name);
  1078. X`009`009`009long_name := nil;
  1079. X`009`009`009nametype := n_comment;
  1080. X`009`009`009name := 0;
  1081. X`009`009    end;
  1082. X`009`009    atom_count := atom_count -1;
  1083. X`009`009    search_atom := loc;
  1084. X`009`009end;
  1085. X`009  end;
  1086. X           `032
  1087. X          function put_atom (name:string_t; p1,p2,p3: integer := 0): integer
  1088. V;
  1089. X          begin   `032
  1090. X`009    write_debug('%put_atom');
  1091. X            if atom_count >= MAXATOM then begin
  1092. X`009       LINE_error;
  1093. X               WriteLn ('Error: Too many atom in program.');
  1094. X               WriteLn ('       Limit atom number to ',MAXATOM:1,
  1095. X                       ' atoms.');
  1096. X`009       error_flag := true;
  1097. X               goto 999
  1098. X            end;
  1099. X            atom_count := atom_count + 1;
  1100. X`009    pool`091current_buffer`093.table`091atom_count`093.params`0911`093 :
  1101. V= p1;
  1102. X`009    pool`091current_buffer`093.table`091atom_count`093.params`0912`093 :
  1103. V= p2;
  1104. X`009    pool`091current_buffer`093.table`091atom_count`093.params`0913`093 :
  1105. V= p3;
  1106. X`009    pool`091current_buffer`093.table`091atom_count`093.name := 0;
  1107. X`009    new(pool`091current_buffer`093.table`091atom_count`093.long_name);
  1108. X            pool`091current_buffer`093.table`091atom_count`093.long_name`094
  1109. V := '!!!';
  1110. X
  1111. X`009    case name`0911`093 of
  1112. X`009`009'_': begin
  1113. X`009`009    pool`091current_buffer`093.table`091atom_count`093.nametype `032
  1114. X`009`009`009:= n_variable;
  1115. X
  1116. X`009`009    pool`091current_buffer`093.table`091atom_count`093.long_name`094
  1117. X`009`009`009:= substr(name,2,length(name)-1);
  1118. X`009`009end;
  1119. X`009`009'"': begin
  1120. X`009`009    pool`091current_buffer`093.table`091atom_count`093.nametype `032
  1121. X`009`009`009:= n_const;
  1122. X
  1123. X`009`009    pool`091current_buffer`093.table`091atom_count`093.long_name`094
  1124. V     `032
  1125. X`009`009`009    := substr(name,2,length(name)-2);
  1126. X
  1127. X
  1128. X
  1129. X`009`009end;
  1130. X`009`009'!':  begin
  1131. X`009`009    pool`091current_buffer`093.table`091atom_count`093.nametype := n
  1132. V_comment;
  1133. X`009`009    pool`091current_buffer`093.table`091atom_count`093.long_name`094
  1134. V := name
  1135. X
  1136. X`009`009end;
  1137. X`009`009'-':  begin
  1138. X`009`009    pool`091current_buffer`093.table`091atom_count`093.nametype := n
  1139. V_head;
  1140. X`009`009    pool`091current_buffer`093.table`091atom_count`093.long_name`094
  1141. V := name
  1142. X
  1143. X`009`009end;
  1144. X`009    end; `123 case `125
  1145. X
  1146. X            put_atom := search_atom;
  1147. X          end;
  1148. X
  1149. X`009  procedure write_comment;
  1150. X`009  begin
  1151. X`009    put_atom(read_comment);
  1152. X`009  end; `123 write_comment `125
  1153. X
  1154. X`009  function put_atom_H(code:integer; params: paramtable; atom: string):
  1155. X`009    integer;
  1156. X`009  var i,count,result,loc: integer;
  1157. X`009  begin
  1158. X`009    write_debug('%put_atom_H');   `032
  1159. X            if atom_count >= MAXATOM then begin
  1160. X`009       LINE_error;
  1161. X               WriteLn ('Error: Too many atom in program.');
  1162. X               WriteLn ('       Limit atom number to ',MAXATOM:1,
  1163. X                       ' atoms.');
  1164. X`009       error_flag := true;
  1165. X               goto 999
  1166. X            end;
  1167. X            atom_count := atom_count + 1;
  1168. X`009    pool`091current_buffer`093.table`091atom_count`093.name     := code;
  1169. X`009    pool`091current_buffer`093.table`091atom_count`093.nametype := n_hea
  1170. Vder;
  1171. X`009    pool`091current_buffer`093.table`091atom_count`093.params   := param
  1172. Vs;
  1173. X`009    new(pool`091current_buffer`093.table`091atom_count`093.long_name);
  1174. X`009    pool`091current_buffer`093.table`091atom_count`093.long_name`094
  1175. V     := atom;
  1176. X`009    if code = LABEL_ID then begin`032
  1177. X`009`009if label_count >= max_labels then begin
  1178. X`009`009    LINE_error;
  1179. X`009`009    WriteLn ('Error: Too many LABELs in program.');
  1180. X`009`009    WriteLn ('       Limit label number to ',max_labels:1,
  1181. X                       ' labels.');
  1182. X`009`009    error_flag := true;
  1183. X`009`009    goto 999
  1184. X`009`009end;
  1185. X`009`009loc := 0;
  1186. X`009`009for i := 1 to label_count do`032
  1187. X`009`009    if EQ(labels`091i`093.name,atom) then loc := i;
  1188. X`009`009if loc > 0 then begin
  1189. X`009`009    LINE_error;
  1190. X`009`009    writeln('Error: Dublicate LABEL ',atom);
  1191. X`009`009    error_flag := true;
  1192. X`009`009end;
  1193. X`009`009label_count := label_count +1;
  1194. X`009`009labels`091label_count`093.name := atom;
  1195. X`009`009result := search_atom;
  1196. X`009`009labels`091label_count`093.loc := result;
  1197. X`009`009put_atom_H := result;
  1198. X`009    end else put_atom_H := search_atom;;
  1199. X`009end;`032
  1200. X
  1201. X          function put_atom_2 (code:integer; params: paramtable): integer;
  1202. X`009  var i,count: integer;
  1203. X          begin
  1204. X`009    write_debug('%put_atom_2');   `032
  1205. X            if atom_count >= MAXATOM then begin
  1206. X`009       LINE_error;
  1207. X               WriteLn ('Error: Too many atom in program.');
  1208. X               WriteLn ('       Limit atom number to ',MAXATOM:1,
  1209. X                       ' atoms.');
  1210. X`009       error_flag := true;
  1211. X               goto 999
  1212. X            end;
  1213. X            atom_count := atom_count + 1;
  1214. X`009    pool`091current_buffer`093.table`091atom_count`093.name := code;
  1215. X`009    pool`091current_buffer`093.table`091atom_count`093.nametype := n_fun
  1216. Vction;
  1217. X`009    pool`091current_buffer`093.table`091atom_count`093.params := params;
  1218. X            put_atom_2 := search_atom;
  1219. X          end;
  1220. X
  1221. X`009  function put_error(message: string_t): integer;
  1222. X`009  var params: paramtable;
  1223. X`009      counter: integer;
  1224. X`009  begin
  1225. X`009    for counter := 1 to max_param do params`091counter`093 := 0;
  1226. X`009    params`0911`093 := put_atom('"'+message+'"');
  1227. X`009    put_error := put_atom_2(ERROR_ID,params);
  1228. X`009    error_flag := true;
  1229. X
  1230. X`009  end; `123 put_error `125 `032
  1231. X`009             `032
  1232. X          function eval: integer;
  1233. X          var params: paramtable;
  1234. X`009      counter: integer;  `032
  1235. X              name,refer: string_t;
  1236. X`009      fcode: integer;
  1237. X`009      min,max:`009integer;
  1238. X
  1239. X`009      function_type: name_type;
  1240. X
  1241. X          begin`032
  1242. X`009    write_debug('%eval');
  1243. X`009    for counter := 1 to max_param do params`091counter`093 := 0;
  1244. X`009    counter := 0;
  1245. X`009    fcode := 0;
  1246. X            read_atom;
  1247. X            if current_atom = '-' then begin
  1248. X`009`009LINE_error;
  1249. X`009`009writeln ('Error: Parameter expected.');
  1250. X`009`009writeln ('       ''-'' detected.');
  1251. X`009`009eval := put_error ('Parameter expected.');
  1252. X
  1253. X            end else if current_atom = ')' then begin
  1254. X`009`009LINE_error;
  1255. X`009`009writeln ('Error: Parameter expected.');
  1256. X`009`009writeln ('       '')'' detected.');
  1257. X`009`009eval := put_error ('Parameter expected.');
  1258. X
  1259. X            end else if current_atom = ',' then begin
  1260. X`009       LINE_error;
  1261. X               writeln ('Error: Parameter expected.');
  1262. X               writeln ('       '','' detected.');
  1263. X               eval := put_error ('Parameter expected.');
  1264. X
  1265. X            end else begin  `032
  1266. X               name := clean_spaces (current_atom);
  1267. X               atom_readed := false;
  1268. X               if name = '' then begin
  1269. X`009`009  LINE_error;
  1270. X                  writeln ('Error: Empty parameter detected.');
  1271. X                  writeln ('       Internal error or end of file.');
  1272. X                  eval := put_error ('Empty parameter detected.');
  1273. X
  1274. X               end else if (name = '(') or (name = ')') or`032
  1275. X`009`009           (name = ',') or (name = '-') then begin
  1276. X`009`009    LINE_error;
  1277. X`009`009    writeln('Error: ''',name,''' detected.');
  1278. X`009`009    writeln('       Function, variable or string expected.');
  1279. X`009`009    error_flag := true;
  1280. X
  1281. X`009`009    if (name = '(') then begin
  1282. X`009`009`009atom_readed := false;
  1283. X`009`009`009eval := eval;
  1284. +-+-+-+-+-+-+-+-  END  OF PART 13 +-+-+-+-+-+-+-+-
  1285.