home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume1 / 8707 / 7 < prev    next >
Encoding:
Text File  |  1993-09-02  |  68.7 KB  |  2,281 lines

  1. Article 98 of comp.sources.misc:
  2. Relay-Version: version B 2.10.3 alpha 5/22/85; site osu-eddie.UUCP
  3. Path: osu-eddie!cbosgd!ihnp4!ptsfa!ames!necntc!ncoast!allbery
  4. From: rcb@rti.UUCP (Randy Buckland)
  5. Newsgroups: comp.sources.misc
  6. Subject: VMS DVI preview (part 1 of 3)
  7. Message-ID: <2807@ncoast.UUCP>
  8. Date: 7 Jul 87 01:46:15 GMT
  9. Date-Received: 8 Jul 87 03:33:28 GMT
  10. Sender: allbery@ncoast.UUCP
  11. Lines: 2264
  12. Approved: allbery@ncoast.UUCP
  13. X-Archive: comp.sources.misc/8707/7
  14.  
  15. [It came in two chunks, but part 2 was 96K so I split it in half.  ++bsa]
  16.  
  17. This is it folks!!! The VMS DVI previewer source. It is a DCL archive file,
  18. so cut at the obvious point and execute it as a ".COM" file (i.e. @foobar)
  19. This archive is in 2 parts, so you will have to get both parts and 
  20. concatenate them together into a single command file and then execute it.
  21. There is a file "read.me" in the "[.doc]" subdirectory. It will tell you
  22. how to build this beast. Have fun.
  23.  
  24. ---------------------------cut here--------------------------
  25. $ write sys$output "Creating ada.reb"
  26. $ create ada.reb
  27. $ deck
  28. $SET DEFAULT USER:[RCB.PREVIEW]
  29. $ADA := ""
  30. $ON ERROR THEN CONTINUE
  31. $ADA/LIBR=tex_base:[misc.preview.ada]/NOCHECK-
  32.  tex_base:[misc.preview.src]FONT_DEF_.ADA-
  33. ,UIS_.ADA-
  34. ,tex_base:[misc.preview.rtl]OTS_.ADA-
  35. ,tex_base:[misc.preview.src]DVI_DEF_.ADA-
  36. ,tex_base:[misc.preview.rtl]STR_.ADA-
  37. ,STR.ADA-
  38. ,SYS_.ADA-
  39. ,SYS.ADA-
  40. ,CLI_.ADA-
  41. ,CLI.ADA-
  42.  
  43. $ON ERROR THEN CONTINUE
  44. $ADA/LIBR=tex_base:[misc.preview.ada]/NOCHECK-
  45.  tex_base:[misc.preview.src]FONT_IO_.ADA-
  46. ,FONT_IO_PK.ADA-
  47. ,DVI_IO_.ADA-
  48. ,DVI_IO.ADA-
  49. ,FONT_TASKS_.ADA-
  50. ,FONT_TASKS.ADA-
  51. ,FONT.ADA-
  52. ,DVI_TRANSLATE_.ADA-
  53. ,DVI_TRANSLATE.ADA-
  54. ,DVI_TASKS_.ADA-
  55.  
  56. $ON ERROR THEN CONTINUE
  57. $ADA/LIBR=tex_base:[misc.preview.ada]/NOCHECK-
  58.  tex_base:[misc.preview.src]DVI_TASKS.ADA-
  59. ,PREVIEW.ADA-
  60.  
  61. $EOD
  62. $ eod
  63. $ checksum ada.reb
  64. $ if checksum$checksum .nes. "158486304" then write sys$output -
  65.     "    ******Checksum error for file ada.reb******"
  66. $ create/directory [.doc]
  67. $ write sys$output "Creating font.cld"
  68. $ create font.cld
  69. $ deck
  70. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  71. !!                                     !!
  72. !!  Title:  Font                             !!
  73. !!  Date:   23-JUN-1987                             !!
  74. !!  Name:   Randy Buckland                         !!
  75. !!                                     !!
  76. !!  Purpose:    Display a font file on a vaxstation.             !!
  77. !!                                     !!
  78. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  79. !!                                      !!
  80. !!  Copyright (c) 1987 by Research Triangle Institute.             !!
  81. !!  Written by Randy Buckland. Not derived from licensed software.     !!
  82. !!                                      !!
  83. !!  Permission is granted to anyone to use this software for any     !!
  84. !!  purpose on any computer system, and to redistribute it freely,     !!
  85. !!  subject to the following restrictions.                 !!
  86. !!                                      !!
  87. !!  1. Research Triangle Institute supplies this software "as is",     !!
  88. !!     without any warranty. The author and the Institute do not     !!
  89. !!     accept any responsibility for any damage caused by use or     !!
  90. !!     mis-use of this program.                     !!
  91. !!  2. The copyright notice must remain a part of all sources files.     !!
  92. !!  3. This software may not be sold in any fashion.             !!
  93. !!                                      !!
  94. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  95. define verb font
  96.     image user:[rcb.preview]font
  97.     
  98.     parameter p1, prompt="Font file", label=font_file,value(required,type=$file)
  99. $ eod
  100. $ checksum font.cld
  101. $ if checksum$checksum .nes. "1567830183" then write sys$output -
  102.     "    ******Checksum error for file font.cld******"
  103. $ write sys$output "Creating preview.cld"
  104. $ create preview.cld
  105. $ deck
  106. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  107. !!                                     !!
  108. !!  Title:  Preview                             !!
  109. !!  Date:    3-SEP-1986                             !!
  110. !!  Name:   Randy Buckland                         !!
  111. !!                                     !!
  112. !!  Purpose:    Preview a dvi file on a vaxstation.             !!
  113. !!                                     !!
  114. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  115. !!                                      !!
  116. !!  Copyright (c) 1987 by Research Triangle Institute.             !!
  117. !!  Written by Randy Buckland. Not derived from licensed software.     !!
  118. !!                                      !!
  119. !!  Permission is granted to anyone to use this software for any     !!
  120. !!  purpose on any computer system, and to redistribute it freely,     !!
  121. !!  subject to the following restrictions.                 !!
  122. !!                                      !!
  123. !!  1. Research Triangle Institute supplies this software "as is",     !!
  124. !!     without any warranty. The author and the Institute do not     !!
  125. !!     accept any responsibility for any damage caused by use or     !!
  126. !!     mis-use of this program.                     !!
  127. !!  2. The copyright notice must remain a part of all sources files.     !!
  128. !!  3. This software may not be sold in any fashion.             !!
  129. !!                                      !!
  130. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  131. define verb preview
  132.     image user:[rcb.preview]preview
  133.     
  134.     parameter p1, prompt="Dvi file", label=dvi_file, value (required,type=$file)
  135.  
  136.     qualifier magstep, default, value (type=$number, default=0)
  137. $ eod
  138. $ checksum preview.cld
  139. $ if checksum$checksum .nes. "493566788" then write sys$output -
  140.     "    ******Checksum error for file preview.cld******"
  141. $ create/directory [.rtl]
  142. $ create/directory [.src]
  143. $ write sys$output "Creating waits.mf_frag"
  144. $ create waits.mf_frag
  145. $ deck
  146. %
  147. %   Definition for a VAXstation or VAXstation/GPX
  148. %
  149. mode_def gpx =  % VaxStation GPX
  150.  proofing:=0;      % no, we're not making proofs
  151.  fontmaking:=1;      % yes, we are making a font
  152.  tracingtitles:=0;    % no, don't show titles in the log
  153.  pixels_per_inch:=78;    % lowres
  154.  blacker:=0;      % don't make the pens any blacker
  155.  fillin:=0;      % and don't compensate for fillin
  156.  o_correction:=0;    % kill the overshoots
  157.  enddef;
  158. $ eod
  159. $ checksum waits.mf_frag
  160. $ if checksum$checksum .nes. "275470781" then write sys$output -
  161.     "    ******Checksum error for file waits.mf_frag******"
  162. $ write sys$output "Creating [.doc]preview.hlp"
  163. $ create [.doc]preview.hlp
  164. $ deck
  165. 1 PREVIEW
  166.  
  167.  Previews a DVI file created by TeX or LaTeX.  Will operate  only
  168.  on the graphics tube of a VAXstation.
  169.  
  170.  Format:
  171.  
  172.            $ PREVIEW dvi-file-spec
  173.  
  174. 2 Parameters
  175.  
  176.  dvi-file-spec
  177.  
  178.      Specification of the DVI file to be previewed.  No wildcards
  179.      are allowed in this specification.  The default extension is
  180.      ".DVI".
  181.  
  182. 2 /MAGSTEP=n
  183.  
  184.  Magnify the displayed page by  the  integer  magstep  specified.
  185.  Applies an overall magnification of the page by 1.2**n
  186.  
  187. 2 Keypad
  188.  
  189. 3 Control/Z
  190.  
  191.  Exit program.
  192.  
  193. 3 Find (E1)
  194.  
  195.  Overlay display with a grid  for  alignment  purposes.   Program
  196.  will  prompt terminal window for the spacing of the grid.  (real
  197.  number)
  198.  
  199. 3 Select (E4)
  200.  
  201.  Goto aribtrary page  in  the  file.   Page  numbers  are  simply
  202.  physical page numbers as measured from the front of the file.
  203.  
  204. 3 Prev Screen (E5)
  205.  
  206.  Goto previous page.
  207.  
  208. 3 Next Screen (E6)
  209.  
  210.  Goto next page.
  211.  
  212. 3 Arrow keys
  213.  
  214.  When page does not fit on the display window, the arrow keys can
  215.  be  used to move the the window relative to the page (i.e.  Down
  216.  arrow will let you see something that is off the bottom  of  the
  217.  window)
  218. $ eod
  219. $ checksum [.doc]preview.hlp
  220. $ if checksum$checksum .nes. "1516589356" then write sys$output -
  221.     "    ******Checksum error for file [.doc]preview.hlp******"
  222. $ write sys$output "Creating [.doc]preview.rnh"
  223. $ create [.doc]preview.rnh
  224. $ deck
  225. .!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  226. .!!                                      !!
  227. .!!  Title:  Preview.rnh                          !!
  228. .!!  Date:   25-JUN-1987                          !!
  229. .!!  Name:   Randy Buckland                          !!
  230. .!!                                      !!
  231. .!!  Purpose:    Preview help file.                      !!
  232. .!!                                      !!
  233. .!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  234. .!!                                      !!
  235. .!!  Revision History                              !!
  236. .!!                                      !!
  237. .!!  Who        Date    Description                  !!
  238. .!!  ---        ----    -----------                  !!
  239. .!!  rcb        25-JUN-1987    New file.                  !!
  240. .!!                                      !!
  241. .!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  242. .!!                                       !!
  243. .!!  Copyright (c) 1987 by Research Triangle Institute.              !!
  244. .!!  Written by Randy Buckland. Not derived from licensed software.      !!
  245. .!!                                       !!
  246. .!!  Permission is granted to anyone to use this software for any      !!
  247. .!!  purpose on any computer system, and to redistribute it freely,      !!
  248. .!!  subject to the following restrictions.                  !!
  249. .!!                                       !!
  250. .!!  1. Research Triangle Institute supplies this software "as is",      !!
  251. .!!     without any warranty. The author and the Institute do not      !!
  252. .!!     accept any responsibility for any damage caused by use or      !!
  253. .!!     mis-use of this program.                      !!
  254. .!!  2. The copyright notice must remain a part of all sources files.      !!
  255. .!!  3. This software may not be sold in any fashion.              !!
  256. .!!                                       !!
  257. .!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  258. .lm 1
  259. .rm 65
  260. .ap
  261. .i-1
  262. 1 PREVIEW
  263. .b
  264. Previews a DVI file created by TeX or LaTeX. Will operate only on the
  265. graphics tube of a VAXstation.
  266. .b
  267. Format:
  268. .b.i+10    
  269. $ PREVIEW dvi-file-spec
  270. .b.i-1
  271. 2 Parameters
  272. .b
  273. dvi-file-spec
  274. .b.lm 5
  275. Specification of the DVI file to be previewed. No wildcards are allowed
  276. in this specification. The default extension is ".DVI".
  277. .lm 1
  278. .b.i-1
  279. 2 /MAGSTEP=n
  280. .b
  281. Magnify the displayed page by the integer magstep specified. Applies an
  282. overall magnification of the page by 1.2**n
  283. .b.i-1
  284. 2 Keypad
  285. .b.i-1
  286. 3 Control/Z
  287. .b
  288. Exit program.
  289. .b.i-1
  290. 3 Find (E1)
  291. .b
  292. Overlay display with a grid for alignment purposes. Program will prompt
  293. terminal window for the spacing of the grid. (real number)
  294. .b.i-1
  295. 3 Select (E4)
  296. .b
  297. Goto aribtrary page in the file. Page numbers are simply physical page
  298. numbers as measured from the front of the file.
  299. .b.i-1
  300. 3 Prev Screen (E5)
  301. .b
  302. Goto previous page.
  303. .b.i-1
  304. 3 Next Screen (E6)
  305. .b
  306. Goto next page.
  307. .b.i-1
  308. 3 Arrow keys
  309. .b
  310. When page does not fit on the display window, the arrow keys can be used
  311. to move the the window relative to the page (i.e. Down arrow will let you
  312. see something that is off the bottom of the window)
  313. $ eod
  314. $ checksum [.doc]preview.rnh
  315. $ if checksum$checksum .nes. "1920434122" then write sys$output -
  316.     "    ******Checksum error for file [.doc]preview.rnh******"
  317. $ write sys$output "Creating [.doc]read.me"
  318. $ create [.doc]read.me
  319. $ deck
  320. Hi,
  321.     You are now the proud owner of a copy of the VMS previewer program.
  322. The file ADA.REB will allow you to rebuild the source by following these
  323. steps:
  324.     
  325.     - Create an ada library directory as in
  326.     
  327.     ACS CREATE LIBRARY [.ADA]
  328.     
  329.     - Edit the file ADA.REB to show the location of the source files and the
  330.     ada library directory. It is set up so that everything is in 
  331.     subdirectories off of TEX_BASE:[MISC.PREVIEW]
  332.     
  333.     - Execute the file ADA.REB
  334.     
  335.     - Link the two programs PREVIEW and FONT
  336.     
  337.     - PREVIEW is the main previewer programs
  338.     - FONT is a utility program to view a font file one character at a time
  339.     
  340.     - Insert the command defintions into the DCLTABLES file. These files,
  341.     FONT.CLD and PREVIEW.CLD, need to be edited first to reflect where
  342.     you wish to place the executables. The command to create these commands
  343.     is
  344.         SET COMMAND/TABLES=SYS$SHARE:DCLTABLES/OUTPUT=SYS$SHARE:DCLTABLES -
  345.         FONT.CLD,PREVIEW.CLD
  346.     
  347.     - Define a system wide logical name TEX_VS_FONTS to point to the 
  348.     directory that will contain the preview fonts.
  349.     
  350.     - Insert the files WAITS.MF_FRAG into your WAITS.MF file and rebuild
  351.     the programs MF and CMMF.
  352.     
  353.     - Run METAFONT to build a set of fonts for the device GPX. You should
  354.     build a wide set of magsteps to allow for magnifications of files.
  355.     You may also need different "halfsteps" (i.e. magstep 1.5, 2.5, 3.5...)
  356.     if you normally use magstephalf or LaTeX 11pt and wish to magnify
  357.     the image. The commands to run CMMF for a set of magnifications
  358.     should look something like:
  359.     
  360.         @TEX_BASE:[CM]FONTS "\MODE=GPX" "MAGSTEP 0"
  361.         @TEX_BASE:[CM]FONTS "\MODE=GPX" "MAGSTEP 0.5"
  362.         @TEX_BASE:[CM]FONTS "\MODE=GPX" "MAGSTEP 1"
  363.         @TEX_BASE:[CM]FONTS "\MODE=GPX" "MAGSTEP 1.5"
  364.         @TEX_BASE:[CM]FONTS "\MODE=GPX" "MAGSTEP 2"
  365.  
  366.     - You then have to convert the fonts to PK format as this is the only
  367.     supported file format currently. This is done with the program
  368.     GFTOPK that is part of the TeX distribution. Just enter the
  369.     command 
  370.         
  371.         GFPK font_file_name
  372.     
  373.     for each file file produced in the previous step.
  374.     
  375.     - Move the file PK fonts into the proper directory pointed to by
  376.     TEX_VS_FONTS. They should be named something like
  377.     
  378.         CMR10.78PK, CMR10.85PK...
  379.     
  380.     - Start previewing! If you have any questions or bug report 
  381.     (or bug fixes) you can contact me by the E-mail or phone.
  382.     
  383.         Randy Buckland
  384.         rcb@rti.rti.org [128.109.139.2]
  385.         {decvax,seismo,ihnp4}!mcnc!rti!rcb
  386.         (919)-541-7103
  387.         
  388. $ eod
  389. $ checksum [.doc]read.me
  390. $ if checksum$checksum .nes. "1261261701" then write sys$output -
  391.     "    ******Checksum error for file [.doc]read.me******"
  392. $ write sys$output "Creating [.rtl]cli.ada"
  393. $ create [.rtl]cli.ada
  394. $ deck
  395. ---------------------------------------------------------------------------
  396. --|                                    |--
  397. --| Title:  Cli                                |--
  398. --| Date:   21-APR-1986                            |--
  399. --| Name:   Randy Buckland                        |--
  400. --|                                    |--
  401. --| Purpose:    Useful cli routines.                    |--
  402. --|                                    |--
  403. ---------------------------------------------------------------------------
  404. --|                                    |--
  405. --| Revision History                            |--
  406. --|                                    |--
  407. --| Who        Date    Description                    |--
  408. --| ---        ----    -----------                    |--
  409. --| rcb        21-APR-1986    New file.                    |--
  410. --|                                    |--
  411. ---------------------------------------------------------------------------
  412. --|                                    |--
  413. --| Copyright (c) 1987 by Research Triangle Institute.            |--
  414. --| Written by Randy Buckland. Not derived from licensed software.    |--
  415. --|                                    |--
  416. --| Permission is granted to anyone to use this software for any    |--
  417. --| purpose on any computer system, and to redistribute it freely,    |--
  418. --| subject to the following restrictions.                |--
  419. --|                                    |--
  420. --| 1. The author is not responsible for the consequences of use of    |--
  421. --|    this software, no matter how awful, even if they arise from    |--
  422. --|    defects in it.                            |--
  423. --| 2. The copyright notice must remain a part of all sources files.    |--
  424. --| 3. This software may not be sold in any fashion.            |--
  425. --|                                    |--
  426. ---------------------------------------------------------------------------
  427. with text_io, integer_text_io;
  428. use  text_io, integer_text_io;
  429.  
  430. with starlet;
  431.  
  432. package body cli is
  433.  
  434. ---------------------------------------------------------------------------
  435. --|                                    |--
  436. --| Global variables.                            |--
  437. --|                                    |--
  438. ---------------------------------------------------------------------------
  439. command_file : file_type;
  440. current_line : d_string;
  441.  
  442. get_value_temp : d_string;
  443.  
  444. ---------------------------------------------------------------------------
  445. --|                                    |--
  446. --| Next_line                                |--
  447. --|                                    |--
  448. ---------------------------------------------------------------------------
  449. --|                                    |--
  450. --| Parameters:        1. Status value.                    |--
  451. --|            2. Output string.                    |--
  452. --|            3. Prompt string.                    |--
  453. --|            4. Output length.                    |--
  454. --|                                    |--
  455. --| Description:    Get the next line from the command file.        |--
  456. --|                                    |--
  457. ---------------------------------------------------------------------------
  458. procedure next_line (
  459.     status  : out    cond_value_type;
  460.     out_str : in out d_string;
  461.     prompt  : in     d_string;
  462.     out_len : in out integer) is
  463.  
  464. begin
  465.     copy (current_line, "");
  466.     get_line (command_file, current_line);
  467.     copy (out_str, current_line);
  468.     out_len := length (current_line);
  469.     status := 1;
  470.  
  471. exception
  472.     when end_error =>
  473.     out_len := 0;
  474.     copy (out_str, "");
  475.     status := import_value ("RMS$_EOF");
  476.     
  477.     when others =>
  478.     out_len := 0;
  479.     copy (out_str, "");
  480.     status := 0;
  481. end;
  482.  
  483. ---------------------------------------------------------------------------
  484. --|                                    |--
  485. --| Execute_file                            |--
  486. --|                                    |--
  487. ---------------------------------------------------------------------------
  488. --|                                    |--
  489. --| Parameters:        1. Command file name.                |--
  490. --|            2. Command table address.                |--
  491. --|                                    |--
  492. --| Description:    Execute the commands in a given file.        |--
  493. --|                                    |--
  494. ---------------------------------------------------------------------------
  495. function execute_file (
  496.     command_file_name : in string;
  497.     command_table     : in address;
  498.     default_name      : in string := "")
  499.     return cond_value_type is
  500.  
  501. status : cond_value_type;        -- System service status value.
  502.  
  503. begin
  504.     open (command_file, in_file, command_file_name, 
  505.     "file; default_name " & default_name & ";");
  506.     loop
  507.     status := dcl_parse (
  508.         table    => command_table, 
  509.         param_r  => address_zero,
  510.         prompt_r => next_line'address);
  511.  
  512.     if (status /= import_value ("CLI$_NOCOMD")) then
  513.         if success (status) then
  514.         status := dispatch;
  515.         if not success (status) then
  516.             exit;
  517.         end if;
  518.         else
  519.         if (status = import_value ("RMS$_EOF")) then
  520.             status := 1;
  521.             exit;
  522.         else
  523.             exit;
  524.         end if;
  525.         end if;
  526.     end if;
  527.     end loop;
  528.     close (command_file);
  529.     return status;
  530.  
  531. exception
  532.     when status_error | name_error | use_error =>
  533.     put_line ("Error accessing file '" & command_file_name & "'.");
  534.     return 0;
  535.  
  536. end;
  537.  
  538. ---------------------------------------------------------------------------
  539. --|                                    |--
  540. --| Get_entity                                |--
  541. --|                                    |--
  542. ---------------------------------------------------------------------------
  543. --|                                    |--
  544. --| Parameters:        1. String with name of entity.            |--
  545. --|                                    |--
  546. --| Description:    Return either string or integer value.        |--
  547. --|                                    |--
  548. ---------------------------------------------------------------------------
  549. function get_entity (
  550.     entity : in string)
  551.     return string is
  552.  
  553. status : cond_value_type;
  554.  
  555. begin
  556.     get_value (status, entity, get_value_temp);
  557.     if not success (status) then
  558.     raise list_end_error;
  559.     end if;
  560.     return (value (get_value_temp));
  561. end;
  562.  
  563. function get_entity (
  564.     entity : in string)
  565.     return integer is
  566.  
  567. status : cond_value_type;
  568. temp   : integer;
  569. last   : natural;
  570.  
  571. begin
  572.     get_value (status, entity, get_value_temp);
  573.     if not success (status) then
  574.     raise list_end_error;
  575.     end if;
  576.     get (value (get_value_temp), temp, last);
  577.     return temp;
  578. end;
  579.  
  580. end;
  581. $ eod
  582. $ checksum [.rtl]cli.ada
  583. $ if checksum$checksum .nes. "1831581613" then write sys$output -
  584.     "    ******Checksum error for file [.rtl]cli.ada******"
  585. $ write sys$output "Creating [.rtl]cli_.ada"
  586. $ create [.rtl]cli_.ada
  587. $ deck
  588. ---------------------------------------------------------------------------
  589. --|                                    |--
  590. --| Title:  Cli                                |--
  591. --| Date:   21-APR-1986                            |--
  592. --| Name:   Randy Buckland                        |--
  593. --|                                    |--
  594. --| Purpose:    Define access to the cli$ routines.            |--
  595. --|                                    |--
  596. ---------------------------------------------------------------------------
  597. --|                                    |--
  598. --| Revision History                            |--
  599. --|                                    |--
  600. --| Who        Date    Description                    |--
  601. --| ---        ----    -----------                    |--
  602. --| rcb        21-APR-1986    New file.                    |--
  603. --|                                    |--
  604. ---------------------------------------------------------------------------
  605. --|                                    |--
  606. --| Copyright (c) 1987 by Research Triangle Institute.            |--
  607. --| Written by Randy Buckland. Not derived from licensed software.    |--
  608. --|                                    |--
  609. --| Permission is granted to anyone to use this software for any    |--
  610. --| purpose on any computer system, and to redistribute it freely,    |--
  611. --| subject to the following restrictions.                |--
  612. --|                                    |--
  613. --| 1. The author is not responsible for the consequences of use of    |--
  614. --|    this software, no matter how awful, even if they arise from    |--
  615. --|    defects in it.                            |--
  616. --| 2. The copyright notice must remain a part of all sources files.    |--
  617. --| 3. This software may not be sold in any fashion.            |--
  618. --|                                    |--
  619. ---------------------------------------------------------------------------
  620. with str, condition_handling, system;
  621. use  str, condition_handling, system;
  622.  
  623. package cli is
  624.  
  625. ---------------------------------------------------------------------------
  626. --|                                    |--
  627. --| Utility routines.                            |--
  628. --|                                    |--
  629. ---------------------------------------------------------------------------
  630. --|
  631. --| Get next line from file.
  632. --|
  633. procedure next_line (
  634.     status  : out    cond_value_type;
  635.     out_str : in out d_string;
  636.     prompt  : in     d_string;
  637.     out_len : in out integer);
  638. --|
  639. --| Execute a file as a command set.
  640. --|
  641. function execute_file (
  642.     command_file_name : in string;
  643.     command_table     : in address;
  644.     default_name      : in string := "")
  645.     return cond_value_type;
  646. --|
  647. --| Get values in a more reasonable fashion
  648. --|
  649. function get_entity (
  650.     entity : in string)
  651.     return string;
  652.  
  653. function get_entity (
  654.     entity : in string)
  655.     return integer;
  656.     
  657. list_end_error : exception;
  658.  
  659. ---------------------------------------------------------------------------
  660. --|                                    |--
  661. --| Cli routines.                            |--
  662. --|                                    |--
  663. ---------------------------------------------------------------------------
  664. --|
  665. --| Parse a string.
  666. --|
  667. function dcl_parse (
  668.     command  : in string := string'null_parameter;
  669.     table    : in address;
  670.     param_r  : in address := address_zero;
  671.     prompt_r : in address := address_zero;
  672.     prompt   : in string := string'null_parameter)
  673.     return cond_value_type;
  674. --|
  675. --| Dispatch a function routine.
  676. --|
  677. function dispatch (
  678.     userarg : in address := address_zero)
  679.     return cond_value_type;
  680. --|
  681. --| Get a value for a parameter or switch
  682. --|
  683. procedure get_value (
  684.     status : out    cond_value_type;
  685.     entity : in     string;
  686.     value  : in out d_string);
  687. --|
  688. --| See if a value is present
  689. --|
  690. function present (
  691.     entity : in string)
  692.     return cond_value_type;
  693.  
  694. ---------------------------------------------------------------------------
  695. --|                                    |--
  696. --| Import everything.                            |--
  697. --|                                    |--
  698. ---------------------------------------------------------------------------
  699. private
  700.  
  701. pragma export_valued_procedure (next_line, "cli_next_line");
  702.  
  703. pragma interface (rtl, dcl_parse);
  704. pragma import_function (dcl_parse, "cli$dcl_parse",
  705.     (string, address, address, address, string), cond_value_type,
  706.     (descriptor(s), value, value, value, descriptor(s)));
  707.  
  708. pragma interface (rtl, dispatch);
  709. pragma import_function (dispatch, "cli$dispatch",
  710.     (address), cond_value_type, (value));
  711.  
  712. pragma interface (rtl, get_value);
  713. pragma import_valued_procedure (get_value, "cli$get_value",
  714.     (cond_value_type, string, d_string),
  715.     (value, descriptor(s), reference));
  716.  
  717. pragma interface (rtl, present);
  718. pragma import_function (present, "cli$present");
  719.  
  720. end cli;
  721. $ eod
  722. $ checksum [.rtl]cli_.ada
  723. $ if checksum$checksum .nes. "69221235" then write sys$output -
  724.     "    ******Checksum error for file [.rtl]cli_.ada******"
  725. $ write sys$output "Creating [.rtl]ots_.ada"
  726. $ create [.rtl]ots_.ada
  727. $ deck
  728. ---------------------------------------------------------------------------
  729. --|                                    |--
  730. --| Title:  Ots                                |--
  731. --| Date:   21-APR-1986                            |--
  732. --| Name:   Randy Buckland                        |--
  733. --|                                    |--
  734. --| Purpose:    Define access to the OTS routines.            |--
  735. --|                                    |--
  736. ---------------------------------------------------------------------------
  737. --|                                    |--
  738. --| Revision History                            |--
  739. --|                                    |--
  740. --| Who        Date    Description                    |--
  741. --| ---        ----    -----------                    |--
  742. --| rcb        21-APR-1986    New file.                    |--
  743. --|                                    |--
  744. ---------------------------------------------------------------------------
  745. --|                                    |--
  746. --| Copyright (c) 1987 by Research Triangle Institute.            |--
  747. --| Written by Randy Buckland. Not derived from licensed software.    |--
  748. --|                                    |--
  749. --| Permission is granted to anyone to use this software for any    |--
  750. --| purpose on any computer system, and to redistribute it freely,    |--
  751. --| subject to the following restrictions.                |--
  752. --|                                    |--
  753. --| 1. The author is not responsible for the consequences of use of    |--
  754. --|    this software, no matter how awful, even if they arise from    |--
  755. --|    defects in it.                            |--
  756. --| 2. The copyright notice must remain a part of all sources files.    |--
  757. --| 3. This software may not be sold in any fashion.            |--
  758. --|                                    |--
  759. ---------------------------------------------------------------------------
  760. with system, condition_handling;
  761. use  system, condition_handling;
  762.  
  763. package ots is
  764.  
  765. ---------------------------------------------------------------------------
  766. --|                                    |--
  767. --| Ots routines.                            |--
  768. --|                                    |--
  769. ---------------------------------------------------------------------------
  770. --|
  771. --| Convert text binary to longword
  772. --|
  773. function cvt_tb_l (
  774.     in_str   : in string;
  775.     value    : in address;
  776.     val_size : in integer;
  777.     flags    : in integer := 1)
  778.     return cond_value_type;
  779. --|
  780. --| Convert text integer to longword
  781. --|
  782. function cvt_ti_l (
  783.     in_str   : in string;
  784.     value    : in address;
  785.     val_size : in integer;
  786.     flags    : in integer := 1)
  787.     return cond_value_type;
  788. --|
  789. --| Convert text octal to longword
  790. --|
  791. function cvt_to_l (
  792.     in_str   : in string;
  793.     value    : in address;
  794.     val_size : in integer;
  795.     flags    : in integer := 1)
  796.     return cond_value_type;
  797. --|
  798. --| Convert unsigned decimal to longword
  799. --|
  800. function cvt_tu_l (
  801.     in_str   : in string;
  802.     value    : in address;
  803.     val_size : in integer;
  804.     flags    : in integer := 1)
  805.     return cond_value_type;
  806. --|
  807. --| Convert text hex to longword
  808. --|
  809. function cvt_tz_l (
  810.     in_str   : in string;
  811.     value    : in address;
  812.     val_size : in integer;
  813.     flags    : in integer := 1)
  814.     return cond_value_type;
  815. --|
  816. --| Convert longword to text binary
  817. --|
  818. procedure cvt_l_tb (
  819.     status   : out    cond_value_type;
  820.     value    : in     address;
  821.     out_str  : in out string;
  822.     int_dig  : in     integer;
  823.     val_size : in     integer;
  824.     flags    : in     integer := 1);
  825. --|
  826. --| Convert longword to text integer
  827. --|
  828. procedure cvt_l_ti (
  829.     status   : out    cond_value_type;
  830.     value    : in     address;
  831.     out_str  : in out string;
  832.     int_dig  : in     integer;
  833.     val_size : in     integer;
  834.     flags    : in     integer := 1);
  835. --|
  836. --| Convert longword to text octal
  837. --|
  838. procedure cvt_l_to (
  839.     status   : out    cond_value_type;
  840.     value    : in     address;
  841.     out_str  : in out string;
  842.     int_dig  : in     integer;
  843.     val_size : in     integer;
  844.     flags    : in     integer := 1);
  845. --|
  846. --| Convert longword to text unsigned decimal
  847. --|
  848. procedure cvt_l_tu (
  849.     status   : out    cond_value_type;
  850.     value    : in     address;
  851.     out_str  : in out string;
  852.     int_dig  : in     integer;
  853.     val_size : in     integer;
  854.     flags    : in     integer := 1);
  855. --|
  856. --| Convert longword to text hex.
  857. --|
  858. procedure cvt_l_tz (
  859.     status   : out    cond_value_type;
  860.     value    : in     address;
  861.     out_str  : in out string;
  862.     int_dig  : in     integer;
  863.     val_size : in     integer;
  864.     flags    : in     integer := 1);
  865. --|
  866. --| Convert text to f_float
  867. --|
  868. procedure cvt_t_f (
  869.     status :    out cond_value_type;
  870.     in_str : in     string;
  871.     value  : in out f_float;
  872.     fdigit : in     integer := 0;
  873.     scale  : in     integer := 0;
  874.     flags  : in     integer := 39);
  875. --|
  876. --| Convert text to d_float
  877. --|
  878. procedure cvt_t_d (
  879.     status :    out cond_value_type;
  880.     in_str : in     string;
  881.     value  : in out d_float;
  882.     fdigit : in     integer := 0;
  883.     scale  : in     integer := 0;
  884.     flags  : in     integer := 39);
  885. --|
  886. --| Convert text to g_float
  887. --|
  888. procedure cvt_t_g (
  889.     status :    out cond_value_type;
  890.     in_str : in     string;
  891.     value  : in out g_float;
  892.     fdigit : in     integer := 0;
  893.     scale  : in     integer := 0;
  894.     flags  : in     integer := 39);
  895. --|
  896. --| Convert text to h_float
  897. --|
  898. procedure cvt_t_h (
  899.     status :    out cond_value_type;
  900.     in_str : in     string;
  901.     value  : in out h_float;
  902.     fdigit : in     integer := 0;
  903.     scale  : in     integer := 0;
  904.     flags  : in     integer := 39);
  905. --|
  906. --| Move bytes
  907. --|
  908. procedure move3 (
  909.     length : in integer;
  910.     source : in address;
  911.     dest   : in address);
  912.  
  913. procedure move5 (
  914.     srclen : in integer;
  915.     source : in address;
  916.     fill   : in integer;
  917.     dstlen : in integer;
  918.     dest   : in address);
  919.  
  920. ---------------------------------------------------------------------------
  921. --|                                    |--
  922. --| Import everybody.                            |--
  923. --|                                    |--
  924. ---------------------------------------------------------------------------
  925. private
  926. --
  927. --  Import all procedures
  928. --
  929. pragma interface (rtl, cvt_tb_l);
  930. pragma import_function (cvt_tb_l, "ots$cvt_tb_l", 
  931.     (string, address, integer, integer), cond_value_type,
  932.     (descriptor(s), value, value, value));
  933.  
  934. pragma interface (rtl, cvt_ti_l);
  935. pragma import_function (cvt_ti_l, "ots$cvt_ti_l",
  936.     (string, address, integer, integer), cond_value_type,
  937.     (descriptor(s), value, value, value));
  938.  
  939. pragma interface (rtl, cvt_to_l);
  940. pragma import_function (cvt_to_l, "ots$cvt_to_l",
  941.     (string, address, integer, integer), cond_value_type,
  942.     (descriptor(s), value, value, value));
  943.  
  944. pragma interface (rtl, cvt_tu_l);
  945. pragma import_function (cvt_tu_l, "ots$cvt_tu_l",
  946.     (string, address, integer, integer), cond_value_type,
  947.     (descriptor(s), value, value, value));
  948.  
  949. pragma interface (rtl, cvt_tz_l);
  950. pragma import_function (cvt_tz_l, "ots$cvt_tz_l",
  951.     (string, address, integer, integer), cond_value_type,
  952.     (descriptor(s), value, value, value));
  953.  
  954. pragma interface (rtl, cvt_l_tb);
  955. pragma import_valued_procedure (cvt_l_tb, "ots$cvt_l_tb",
  956.     (cond_value_type, address, string, integer, integer, integer),
  957.     (value, value, descriptor(s), value, value, value));
  958.  
  959. pragma interface (rtl, cvt_l_ti);
  960. pragma import_valued_procedure (cvt_l_ti, "ots$cvt_l_ti",
  961.     (cond_value_type, address, string, integer, integer, integer),
  962.     (value, value, descriptor(s), value, value, value));
  963.  
  964. pragma interface (rtl, cvt_l_to);
  965. pragma import_valued_procedure (cvt_l_to, "ots$cvt_l_to",
  966.     (cond_value_type, address, string, integer, integer, integer),
  967.     (value, value, descriptor(s), value, value, value));
  968.  
  969. pragma interface (rtl, cvt_l_tu);
  970. pragma import_valued_procedure (cvt_l_tu, "ots$cvt_l_tu",
  971.     (cond_value_type, address, string, integer, integer, integer),
  972.     (value, value, descriptor(s), value, value, value));
  973.  
  974. pragma interface (rtl, cvt_l_tz);
  975. pragma import_valued_procedure (cvt_l_tz, "ots$cvt_l_tz",
  976.     (cond_value_type, address, string, integer, integer, integer),
  977.     (value, value, descriptor(s), value, value, value));
  978.  
  979. pragma interface (rtl, cvt_t_f);
  980. pragma import_valued_procedure (cvt_t_f, "ots$cvt_t_f",
  981.     (cond_value_type, string, f_float, integer, integer, integer),
  982.     (value, descriptor(s), reference, value, value, value));
  983.  
  984. pragma interface (rtl, cvt_t_d);
  985. pragma import_valued_procedure (cvt_t_d, "ots$cvt_t_d",
  986.     (cond_value_type, string, d_float, integer, integer, integer),
  987.     (value, descriptor(s), reference, value, value, value));
  988.  
  989. pragma interface (rtl, cvt_t_g);
  990. pragma import_valued_procedure (cvt_t_g, "ots$cvt_t_g",
  991.     (cond_value_type, string, g_float, integer, integer, integer),
  992.     (value, descriptor(s), reference, value, value, value));
  993.  
  994. pragma interface (rtl, cvt_t_h);
  995. pragma import_valued_procedure (cvt_t_h, "ots$cvt_t_h",
  996.     (cond_value_type, string, h_float, integer, integer, integer),
  997.     (value, descriptor(s), reference, value, value, value));
  998.  
  999. pragma interface (rtl, move3);
  1000. pragma import_procedure (move3, "ots$move3",
  1001.     (integer, address, address),
  1002.     value);
  1003.  
  1004. pragma interface (rtl, move5);
  1005. pragma import_procedure (move5, "ots$move5",
  1006.     (integer, address, integer, integer, address),
  1007.     value);
  1008.  
  1009.  
  1010. end;
  1011. $ eod
  1012. $ checksum [.rtl]ots_.ada
  1013. $ if checksum$checksum .nes. "574206714" then write sys$output -
  1014.     "    ******Checksum error for file [.rtl]ots_.ada******"
  1015. $ write sys$output "Creating [.rtl]str.ada"
  1016. $ create [.rtl]str.ada
  1017. $ deck
  1018. ---------------------------------------------------------------------------
  1019. --|                                    |--
  1020. --| Title:  Str                                |--
  1021. --| Date:   18-APR-1986                            |--
  1022. --| Name:   Randy Buckland                        |--
  1023. --|                                    |--
  1024. --| Purpose:    Body for string utility procedures.            |--
  1025. --|                                    |--
  1026. ---------------------------------------------------------------------------
  1027. --|                                    |--
  1028. --| Revision History                            |--
  1029. --|                                    |--
  1030. --| Who        Date    Description                    |--
  1031. --| ---        ----    -----------                    |--
  1032. --| rcb        18-APR-1986    New file.                    |--
  1033. --|                                    |--
  1034. ---------------------------------------------------------------------------
  1035. --|                                    |--
  1036. --| Copyright (c) 1987 by Research Triangle Institute.            |--
  1037. --| Written by Randy Buckland. Not derived from licensed software.    |--
  1038. --|                                    |--
  1039. --| Permission is granted to anyone to use this software for any    |--
  1040. --| purpose on any computer system, and to redistribute it freely,    |--
  1041. --| subject to the following restrictions.                |--
  1042. --|                                    |--
  1043. --| 1. The author is not responsible for the consequences of use of    |--
  1044. --|    this software, no matter how awful, even if they arise from    |--
  1045. --|    defects in it.                            |--
  1046. --| 2. The copyright notice must remain a part of all sources files.    |--
  1047. --| 3. This software may not be sold in any fashion.            |--
  1048. --|                                    |--
  1049. ---------------------------------------------------------------------------
  1050. package body str is
  1051.  
  1052. ---------------------------------------------------------------------------
  1053. --|                                    |--
  1054. --| De_tab                                |--
  1055. --|                                    |--
  1056. ---------------------------------------------------------------------------
  1057. --|                                    |--
  1058. --| Parameters:        1. Output string.                    |--
  1059. --|            2. Input string.                    |--
  1060. --|                                    |--
  1061. --| Description:    Remove all tabs from an string and replace        |--
  1062. --|            them with spaces.                    |--
  1063. --|                                    |--
  1064. ---------------------------------------------------------------------------
  1065. procedure de_tab (
  1066.     out_str : in out d_string;
  1067.     in_str  : in     string) is
  1068.  
  1069. tmp_str : string (1..(in_str'last)*8);        -- Temporary string
  1070. tmp_ptr : integer := 1;                -- Pointer to temp string
  1071. in_ptr  : integer := 1;                -- Pointer to input string.
  1072.  
  1073. begin
  1074.     while (in_str'last >= in_ptr) loop
  1075.     case in_str(in_ptr) is
  1076.     
  1077.         when ascii.ht =>
  1078.         loop
  1079.             tmp_str(tmp_ptr) := ' ';
  1080.             tmp_ptr := tmp_ptr + 1;
  1081.             exit when ((tmp_ptr mod 8) = 0);
  1082.         end loop;
  1083.         
  1084.         when others =>
  1085.         tmp_str(tmp_ptr) := in_str(in_ptr);
  1086.         tmp_ptr := tmp_ptr + 1;
  1087.     
  1088.     end case;
  1089.     
  1090.     in_ptr := in_ptr + 1;
  1091.     end loop;
  1092.     
  1093.     if (tmp_ptr = 1) then
  1094.     copy(out_str, "");
  1095.     else
  1096.     copy(out_str, tmp_str(1..tmp_ptr-1));
  1097.     end if;
  1098. end;
  1099. --|
  1100. --| Conversion calls
  1101. --|
  1102. procedure de_tab (
  1103.     out_str : in out string;
  1104.     in_str  : in     d_string) is
  1105.  
  1106. tmp_str : d_string;
  1107.  
  1108. begin
  1109.     de_tab(tmp_str, value(in_str));
  1110.     copy(out_str, tmp_str);
  1111.     free(tmp_str);
  1112. end;
  1113.  
  1114. procedure de_tab (
  1115.     out_str : in out d_string;
  1116.     in_str  : in     d_string) is
  1117.  
  1118. tmp_str : d_string;
  1119.  
  1120. begin
  1121.     de_tab(out_str, value(tmp_str));
  1122. end;
  1123.  
  1124. procedure de_tab (
  1125.     out_str : in out string;
  1126.     in_str  : in     string) is
  1127.  
  1128. tmp_str : d_string;
  1129.  
  1130. begin
  1131.     de_tab(tmp_str, in_str);
  1132.     copy(out_str, tmp_str);
  1133.     free(tmp_str);
  1134. end;
  1135.  
  1136. ---------------------------------------------------------------------------
  1137. --|                                    |--
  1138. --| Value                                |--
  1139. --|                                    |--
  1140. ---------------------------------------------------------------------------
  1141. --|                                    |--
  1142. --| Parameters:        1. Dynamic string.                    |--
  1143. --|                                    |--
  1144. --| Description:    Return static string from dynamic.            |--
  1145. --|                                    |--
  1146. ---------------------------------------------------------------------------
  1147. function value (
  1148.     item : in d_string) 
  1149.     return string is
  1150.  
  1151. begin
  1152.     if (item.length /= 0) then
  1153.     return item.addr(1 .. integer(item.length));
  1154.     else
  1155.     return "";
  1156.     end if;
  1157. end;
  1158.  
  1159. ---------------------------------------------------------------------------
  1160. --|                                    |--
  1161. --| Length                                |--
  1162. --|                                    |--
  1163. ---------------------------------------------------------------------------
  1164. --|                                    |--
  1165. --| Parameters:        1. Dynamic string.                    |--
  1166. --|                                    |--
  1167. --| Description:    Return length of the string.            |--
  1168. --|                                    |--
  1169. ---------------------------------------------------------------------------
  1170. function length (
  1171.     item : in d_string)
  1172.     return integer is
  1173.  
  1174. begin
  1175.     return integer(item.length);
  1176. end;
  1177.  
  1178. ---------------------------------------------------------------------------
  1179. --|                                    |--
  1180. --| Put, Put_line                            |--
  1181. --|                                    |--
  1182. ---------------------------------------------------------------------------
  1183. --|                                    |--
  1184. --| Parameters:        1. Optional file pointer.                |--
  1185. --|            2. Dynamic string.                    |--
  1186. --|                                    |--
  1187. --| Description:    Output a dynamic string to a file.            |--
  1188. --|                                    |--
  1189. ---------------------------------------------------------------------------
  1190. procedure put (
  1191.     item : in d_string) is
  1192.  
  1193. begin
  1194.     put(value(item));
  1195. end;
  1196.  
  1197. procedure put (
  1198.     file : in file_type;
  1199.     item : in d_string) is
  1200.  
  1201. begin
  1202.     put(file, value(item));
  1203. end;
  1204.  
  1205. procedure put_line (
  1206.     item : in d_string) is
  1207.  
  1208. begin
  1209.     put_line(value(item));
  1210. end;
  1211.  
  1212. procedure put_line (
  1213.     file : in file_type;
  1214.     item : in d_string) is
  1215.  
  1216. begin
  1217.     put_line(file, value(item));
  1218. end;
  1219.  
  1220. ---------------------------------------------------------------------------
  1221. --|                                    |--
  1222. --| Get_line                                |--
  1223. --|                                    |--
  1224. ---------------------------------------------------------------------------
  1225. --|                                    |--
  1226. --| Parameters:        1. Optional file pointer.                |--
  1227. --|            2. Dynamic string.                    |--
  1228. --|                                    |--
  1229. --| Description:    Get a dynamic string from a file.            |--
  1230. --|                                    |--
  1231. ---------------------------------------------------------------------------
  1232. procedure get_line (
  1233.     item : out d_string) is
  1234.  
  1235. temp_str : string(1..1024);
  1236. last     : natural;
  1237.  
  1238. begin
  1239.     get_line(temp_str, last);
  1240.     trim(item, temp_str(1..last));
  1241. end;
  1242.  
  1243. procedure get_line (
  1244.     file : in  file_type;
  1245.     item : out d_string) is
  1246.  
  1247. temp_str : string(1..1024);
  1248. last     : natural;
  1249.  
  1250. begin
  1251.     get_line(file, temp_str, last);
  1252.     trim(item, temp_str(1..last));
  1253. end;
  1254.  
  1255. end;
  1256. $ eod
  1257. $ checksum [.rtl]str.ada
  1258. $ if checksum$checksum .nes. "290857973" then write sys$output -
  1259.     "    ******Checksum error for file [.rtl]str.ada******"
  1260. $ write sys$output "Creating [.rtl]str_.ada"
  1261. $ create [.rtl]str_.ada
  1262. $ deck
  1263. ---------------------------------------------------------------------------
  1264. --|                                    |--
  1265. --| Title:  Str                                |--
  1266. --| Date:   18-APR-1986                            |--
  1267. --| Name:   Randy Buckland                        |--
  1268. --|                                    |--
  1269. --| Purpose:    Define a dynamic string data type and definitions    |--
  1270. --|        for all the str$ functions.                |--
  1271. --|                                    |--
  1272. ---------------------------------------------------------------------------
  1273. --|                                    |--
  1274. --| Revision History                            |--
  1275. --|                                    |--
  1276. --| Who        Date    Description                    |--
  1277. --| ---        ----    -----------                    |--
  1278. --| rcb        18-APR-1986    New file.                    |--
  1279. --|                                    |--
  1280. ---------------------------------------------------------------------------
  1281. --|                                    |--
  1282. --| Copyright (c) 1987 by Research Triangle Institute.            |--
  1283. --| Written by Randy Buckland. Not derived from licensed software.    |--
  1284. --|                                    |--
  1285. --| Permission is granted to anyone to use this software for any    |--
  1286. --| purpose on any computer system, and to redistribute it freely,    |--
  1287. --| subject to the following restrictions.                |--
  1288. --|                                    |--
  1289. --| 1. The author is not responsible for the consequences of use of    |--
  1290. --|    this software, no matter how awful, even if they arise from    |--
  1291. --|    defects in it.                            |--
  1292. --| 2. The copyright notice must remain a part of all sources files.    |--
  1293. --| 3. This software may not be sold in any fashion.            |--
  1294. --|                                    |--
  1295. ---------------------------------------------------------------------------
  1296. with system, text_io, condition_handling;
  1297. use  system, text_io, condition_handling;
  1298.  
  1299. package str is
  1300.  
  1301. ---------------------------------------------------------------------------
  1302. --|                                    |--
  1303. --| Type definitions.                            |--
  1304. --|                                    |--
  1305. ---------------------------------------------------------------------------
  1306. type d_string_pointer is access string(1..32767);
  1307.  
  1308. type d_string is record
  1309.     length : unsigned_word := 0;
  1310.     d_type : unsigned_byte := 14;
  1311.     class  : unsigned_byte := 2;
  1312.     addr   : d_string_pointer := null;
  1313. end record;
  1314.  
  1315. type s_string is record
  1316.     length : unsigned_word := 0;
  1317.     d_type : unsigned_byte := 14;
  1318.     class  : unsigned_byte := 1;
  1319.     addr   : address := address_zero;
  1320. end record;
  1321.  
  1322. ---------------------------------------------------------------------------
  1323. --|                                    |--
  1324. --| Utility routines.                            |--
  1325. --|                                    |--
  1326. ---------------------------------------------------------------------------
  1327. procedure de_tab (
  1328.     out_str : in out d_string;
  1329.     in_str  : in     d_string);
  1330.  
  1331. procedure de_tab (
  1332.     out_str : in out string;
  1333.     in_str  : in     d_string);
  1334.  
  1335. procedure de_tab (
  1336.     out_str : in out d_string;
  1337.     in_str  : in     string);
  1338.  
  1339. procedure de_tab (
  1340.     out_str : in out string;
  1341.     in_str  : in     string);
  1342.  
  1343. procedure put (
  1344.     item : in d_string);
  1345.  
  1346. procedure put (
  1347.     file : in file_type;
  1348.     item : in d_string);
  1349.  
  1350. procedure put_line (
  1351.     item : in d_string);
  1352.  
  1353. procedure put_line (
  1354.     file : in file_type;
  1355.     item : in d_string);
  1356.  
  1357. procedure get_line (
  1358.     item : out d_string);
  1359.  
  1360. procedure get_line (
  1361.     file : in  file_type;
  1362.     item : out d_string);
  1363.  
  1364. function value (
  1365.     item : in d_string)
  1366.     return string;
  1367.  
  1368. function length (
  1369.     item : in d_string)
  1370.     return integer;
  1371.  
  1372. ---------------------------------------------------------------------------
  1373. --|                                    |--
  1374. --| Str$ calls.                                |--
  1375. --|                                    |--
  1376. ---------------------------------------------------------------------------
  1377. --|
  1378. --| Append one string to another.
  1379. --|
  1380. procedure append (
  1381.     destination : in out d_string;
  1382.     source      : in     d_string);
  1383.  
  1384. procedure append (
  1385.     destination : in out d_string;
  1386.     source      : in     string);
  1387.  
  1388. pragma interface (rtl, append);
  1389. pragma import_procedure (append, "str$append", (d_string, d_string), 
  1390.     (reference, reference));
  1391. pragma import_procedure (append, "str$append", (d_string, string),
  1392.     (reference, descriptor(s)));
  1393. --|
  1394. --| Compare two strings without regard to case.
  1395. --|
  1396. function case_blind_compare (
  1397.     string1 : in d_string;
  1398.     string2 : in d_string)
  1399.     return integer;
  1400.  
  1401. function case_blind_compare (
  1402.     string1 : in string;
  1403.     string2 : in d_string)
  1404.     return integer;
  1405.  
  1406. function case_blind_compare (
  1407.     string1 : in d_string;
  1408.     string2 : in string)
  1409.     return integer;
  1410.  
  1411. function case_blind_compare (
  1412.     string1 : in string;
  1413.     string2 : in string)
  1414.     return integer;
  1415.  
  1416. pragma interface (rtl, case_blind_compare);
  1417. pragma import_function (case_blind_compare, "str$case_blind_compare",
  1418.     (d_string, d_string), integer, (reference, reference));
  1419. pragma import_function (case_blind_compare, "str$case_blind_compare",
  1420.     (string, d_string), integer, (descriptor(s), reference));
  1421. pragma import_function (case_blind_compare, "str$case_blind_compare",
  1422.     (d_string, string), integer, (reference, descriptor(s)));
  1423. pragma import_function (case_blind_compare, "str$case_blind_compare",
  1424.     (string, string), integer, (descriptor(s), descriptor(s)));
  1425. --|
  1426. --| Compare two strings.
  1427. --|
  1428. function compare (
  1429.     string1 : in d_string;
  1430.     string2 : in d_string)
  1431.     return integer;
  1432.  
  1433. function compare (
  1434.     string1 : in string;
  1435.     string2 : in d_string)
  1436.     return integer;
  1437.  
  1438. function compare (
  1439.     string1 : in d_string;
  1440.     string2 : in string)
  1441.     return integer;
  1442.  
  1443. function compare (
  1444.     string1 : in string;
  1445.     string2 : in string)
  1446.     return integer;
  1447.  
  1448. pragma interface (rtl, compare);
  1449. pragma import_function (compare, "str$compare",
  1450.     (d_string, d_string), integer, (reference, reference));
  1451. pragma import_function (compare, "str$compare",
  1452.     (string, d_string), integer, (descriptor(s), reference));
  1453. pragma import_function (compare, "str$compare",
  1454.     (d_string, string), integer, (reference, descriptor(s)));
  1455. pragma import_function (compare, "str$compare",
  1456.     (string, string), integer, (descriptor(s), descriptor(s)));
  1457. --|
  1458. --| Concatenate two strings.
  1459. --|
  1460. procedure concat (
  1461.     output : out d_string;
  1462.     input1 : in  d_string;
  1463.     input2 : in  d_string);
  1464.  
  1465. procedure concat (
  1466.     output : out d_string;
  1467.     input1 : in  string;
  1468.     input2 : in  d_string);
  1469.  
  1470. procedure concat (
  1471.     output : out d_string;
  1472.     input1 : in  d_string;
  1473.     input2 : in  string);
  1474.  
  1475. procedure concat (
  1476.     output : out d_string;
  1477.     input1 : in  string;
  1478.     input2 : in  string);
  1479.  
  1480. procedure concat (
  1481.     output : out string;
  1482.     input1 : in  d_string;
  1483.     input2 : in  d_string);
  1484.  
  1485. procedure concat (
  1486.     output : out string;
  1487.     input1 : in  string;
  1488.     input2 : in  d_string);
  1489.  
  1490. procedure concat (
  1491.     output : out string;
  1492.     input1 : in  d_string;
  1493.     input2 : in  string);
  1494.  
  1495. procedure concat (
  1496.     output : out string;
  1497.     input1 : in  string;
  1498.     input2 : in  string);
  1499.  
  1500. pragma interface (rtl, concat);
  1501. pragma import_procedure (concat, "str$concat",
  1502.     (d_string, d_string, d_string), (reference, reference, reference));
  1503. pragma import_procedure (concat, "str$concat",
  1504.     (d_string, string, d_string), (reference, descriptor(s), reference));
  1505. pragma import_procedure (concat, "str$concat",
  1506.     (d_string, d_string, string), (reference, reference, descriptor(s)));
  1507. pragma import_procedure (concat, "str$concat",
  1508.     (d_string, string, string), (reference, descriptor(s), descriptor(s)));
  1509. pragma import_procedure (concat, "str$concat",
  1510.     (string, d_string, d_string), (descriptor(s), reference, reference));
  1511. pragma import_procedure (concat, "str$concat",
  1512.     (string, string, d_string), (descriptor(s), descriptor(s), reference));
  1513. pragma import_procedure (concat, "str$concat",
  1514.     (string, d_string, string), (descriptor(s), reference, descriptor(s)));
  1515. pragma import_procedure (concat, "str$concat",
  1516.     (string, string, string), (descriptor(s), descriptor(s), descriptor(s)));
  1517. --|
  1518. --| Copy one string to another
  1519. --|
  1520. procedure copy (
  1521.     destination : out d_string;
  1522.     source      : in  d_string);
  1523.  
  1524. procedure copy (
  1525.     destination : out s_string;
  1526.     source      : in  d_string);
  1527.  
  1528. procedure copy (
  1529.     destination : out string;
  1530.     source      : in  d_string);
  1531.  
  1532. procedure copy (
  1533.     destination : out d_string;
  1534.     source      : in  s_string);
  1535.  
  1536. procedure copy (
  1537.     destination : out s_string;
  1538.     source      : in  s_string);
  1539.  
  1540. procedure copy (
  1541.     destination : out string;
  1542.     source      : in  s_string);
  1543.  
  1544. procedure copy (
  1545.     destination : out d_string;
  1546.     source      : in  string);
  1547.  
  1548. procedure copy (
  1549.     destination : out s_string;
  1550.     source      : in  string);
  1551.  
  1552. procedure copy (
  1553.     destination : out string;
  1554.     source      : in  string);
  1555.  
  1556. pragma interface (rtl, copy);
  1557. pragma import_procedure (copy, "str$copy_dx",
  1558.     (d_string, d_string), (reference, reference));
  1559. pragma import_procedure (copy, "str$copy_dx",
  1560.     (s_string, d_string), (reference, reference));
  1561. pragma import_procedure (copy, "str$copy_dx",
  1562.     (string, d_string), (descriptor(s), reference));
  1563. pragma import_procedure (copy, "str$copy_dx",
  1564.     (d_string, s_string), (reference, reference));
  1565. pragma import_procedure (copy, "str$copy_dx",
  1566.     (s_string, s_string), (reference, reference));
  1567. pragma import_procedure (copy, "str$copy_dx",
  1568.     (string, s_string), (descriptor(s), reference));
  1569. pragma import_procedure (copy, "str$copy_dx",
  1570.     (d_string, string), (reference, descriptor(s)));
  1571. pragma import_procedure (copy, "str$copy_dx",
  1572.     (s_string, string), (reference, descriptor(s)));
  1573. pragma import_procedure (copy, "str$copy_dx",
  1574.     (string, string), (descriptor(s), descriptor(s)));
  1575. --|
  1576. --| Duplicate a character into a string
  1577. --|
  1578. procedure duplicate (
  1579.     destination : out d_string;
  1580.     length      : in  integer   := 1;
  1581.     char        : in  character := ' ');
  1582.  
  1583. procedure duplicate (
  1584.     destination : out string;
  1585.     length      : in  integer   := 1;
  1586.     char        : in  character := ' ');
  1587.  
  1588. pragma interface (rtl, duplicate);
  1589. pragma import_procedure (duplicate, "str$dupl_char",
  1590.     (d_string, integer, character), (reference, reference, reference));
  1591. pragma import_procedure (duplicate, "str$dupl_char",
  1592.     (string, integer, character), (descriptor(s), reference, reference));
  1593. --|
  1594. --| Find first match in a string
  1595. --|
  1596. function find_first (
  1597.     instring : in d_string;
  1598.     char_set : in d_string)
  1599.     return integer;
  1600.  
  1601. function find_first (
  1602.     instring : in string;
  1603.     char_set : in d_string)
  1604.     return integer;
  1605.  
  1606. function find_first (
  1607.     instring : in d_string;
  1608.     char_set : in string)
  1609.     return integer;
  1610.  
  1611. function find_first (
  1612.     instring : in string;
  1613.     char_set : in string)
  1614.     return integer;
  1615.  
  1616. pragma interface (rtl, find_first);
  1617. pragma import_function (find_first, "str$find_first_in_set",
  1618.     (d_string, d_string), integer, (reference, reference));
  1619. pragma import_function (find_first, "str$find_first_in_set",
  1620.     (string, d_string), integer, (descriptor(s), reference));
  1621. pragma import_function (find_first, "str$find_first_in_set",
  1622.     (d_string, string), integer, (reference, descriptor(s)));
  1623. pragma import_function (find_first, "str$find_first_in_set",
  1624.     (string, string), integer, (descriptor(s), descriptor(s)));
  1625. --|
  1626. --| Find first non match in a string
  1627. --|
  1628. function find_first_not (
  1629.     instring : in d_string;
  1630.     char_set : in d_string)
  1631.     return integer;
  1632.  
  1633. function find_first_not (
  1634.     instring : in string;
  1635.     char_set : in d_string)
  1636.     return integer;
  1637.  
  1638. function find_first_not (
  1639.     instring : in d_string;
  1640.     char_set : in string)
  1641.     return integer;
  1642.  
  1643. function find_first_not (
  1644.     instring : in string;
  1645.     char_set : in string)
  1646.     return integer;
  1647.  
  1648. pragma interface (rtl, find_first_not);
  1649. pragma import_function (find_first_not, "str$find_first_not_in_set",
  1650.     (d_string, d_string), integer, (reference, reference));
  1651. pragma import_function (find_first_not, "str$find_first_not_in_set",
  1652.     (string, d_string), integer, (descriptor(s), reference));
  1653. pragma import_function (find_first_not, "str$find_first_not_in_set",
  1654.     (d_string, string), integer, (reference, descriptor(s)));
  1655. pragma import_function (find_first_not, "str$find_first_not_in_set",
  1656.     (string, string), integer, (descriptor(s), descriptor(s)));
  1657. --|
  1658. --| Free a string
  1659. --|
  1660. procedure free (
  1661.     in_str : in out d_string);
  1662.  
  1663. pragma interface (rtl, free);
  1664. pragma import_procedure (free, "str$free1_dx", (d_string), reference);
  1665. --|
  1666. --| Get left part of string
  1667. --|
  1668. procedure left (
  1669.     destination : in d_string;
  1670.     source      : in d_string;
  1671.     position    : in integer);
  1672.  
  1673. procedure left (
  1674.     destination : in string;
  1675.     source      : in d_string;
  1676.     position    : in integer);
  1677.  
  1678. procedure left (
  1679.     destination : in d_string;
  1680.     source      : in string;
  1681.     position    : in integer);
  1682.  
  1683. procedure left (
  1684.     destination : in string;
  1685.     source      : in string;
  1686.     position    : in integer);
  1687.  
  1688. pragma interface (rtl, left);
  1689. pragma import_procedure (left, "str$left",
  1690.     (d_string, d_string, integer), (reference, reference, reference));
  1691. pragma import_procedure (left, "str$left",
  1692.     (string, d_string, integer), (descriptor(s), reference, reference));
  1693. pragma import_procedure (left, "str$left",
  1694.     (d_string, string, integer), (reference, descriptor(s), reference));
  1695. pragma import_procedure (left, "str$left",
  1696.     (string, string, integer), (descriptor(s), descriptor(s), reference));
  1697. --|
  1698. --| Get a substring by length
  1699. --|
  1700. procedure len_extr (
  1701.     destination : in d_string;
  1702.     source      : in d_string;
  1703.     start       : in integer;
  1704.     length      : in integer);
  1705.  
  1706. procedure len_extr (
  1707.     destination : in string;
  1708.     source      : in d_string;
  1709.     start       : in integer;
  1710.     length      : in integer);
  1711.  
  1712. procedure len_extr (
  1713.     destination : in d_string;
  1714.     source      : in string;
  1715.     start       : in integer;
  1716.     length      : in integer);
  1717.  
  1718. procedure len_extr (
  1719.     destination : in string;
  1720.     source      : in string;
  1721.     start       : in integer;
  1722.     length      : in integer);
  1723.  
  1724. pragma interface (rtl, len_extr);
  1725. pragma import_procedure (len_extr, "str$len_extr",
  1726.     (d_string, d_string, integer, integer), (reference, reference, reference, reference));
  1727. pragma import_procedure (len_extr, "str$len_extr",
  1728.     (string, d_string, integer, integer), (descriptor(s), reference, reference, reference));
  1729. pragma import_procedure (len_extr, "str$len_extr",
  1730.     (d_string, string, integer, integer), (reference, descriptor(s), reference, reference));
  1731. pragma import_procedure (len_extr, "str$len_extr",
  1732.     (string, string, integer, integer), (descriptor(s), descriptor(s), reference, reference));
  1733. --|
  1734. --| Match a string with a wildcard specification
  1735. --|
  1736. function match_wild (
  1737.     candidate : in d_string;
  1738.     pattern   : in d_string)
  1739.     return cond_value_type;
  1740.  
  1741. function match_wild (
  1742.     candidate : in string;
  1743.     pattern   : in d_string)
  1744.     return cond_value_type;
  1745.  
  1746. function match_wild (
  1747.     candidate : in d_string;
  1748.     pattern   : in string)
  1749.     return cond_value_type;
  1750.  
  1751. function match_wild (
  1752.     candidate : in string;
  1753.     pattern   : in string)
  1754.     return cond_value_type;
  1755.  
  1756. pragma interface (rtl, match_wild);
  1757. pragma import_function (match_wild, "str$match_wild",
  1758.     (d_string, d_string), cond_value_type, (reference, reference));
  1759. pragma import_function (match_wild, "str$match_wild",
  1760.     (string, d_string), cond_value_type, (descriptor(s), reference));
  1761. pragma import_function (match_wild, "str$match_wild",
  1762.     (d_string, string), cond_value_type, (reference, descriptor(s)));
  1763. pragma import_function (match_wild, "str$match_wild",
  1764.     (string, string), cond_value_type, (descriptor(s), descriptor(s)));
  1765. --|
  1766. --| Find substring in string
  1767. --|
  1768. function position (
  1769.     source     : in d_string;
  1770.     sub_string : in d_string;
  1771.     start      : in integer := 1)
  1772.     return integer;
  1773.  
  1774. function position (
  1775.     source     : in string;
  1776.     sub_string : in d_string;
  1777.     start      : in integer := 1)
  1778.     return integer;
  1779.  
  1780. function position (
  1781.     source     : in d_string;
  1782.     sub_string : in string;
  1783.     start      : in integer := 1)
  1784.     return integer;
  1785.  
  1786. function position (
  1787.     source     : in string;
  1788.     sub_string : in string;
  1789.     start      : in integer := 1)
  1790.     return integer;
  1791.  
  1792. pragma interface (rtl, position);
  1793. pragma import_function (position, "str$position",
  1794.     (d_string, d_string, integer), integer,( reference, reference, reference));
  1795. pragma import_function (position, "str$position",
  1796.     (string, d_string, integer), integer, (descriptor(s), reference, reference));
  1797. pragma import_function (position, "str$position",
  1798.     (d_string, string, integer), integer, (reference, descriptor(s), reference));
  1799. pragma import_function (position, "str$position",
  1800.     (string, string, integer), integer, (descriptor(s), descriptor(s), reference));
  1801. --|
  1802. --| Extract a substring by position
  1803. --|
  1804. procedure pos_extr (
  1805.     destination : in d_string;
  1806.     source      : in d_string;
  1807.     start       : in integer;
  1808.     stop        : in integer);
  1809.  
  1810. procedure pos_extr (
  1811.     destination : in string;
  1812.     source      : in d_string;
  1813.     start       : in integer;
  1814.     stop        : in integer);
  1815.  
  1816. procedure pos_extr (
  1817.     destination : in d_string;
  1818.     source      : in string;
  1819.     start       : in integer;
  1820.     stop        : in integer);
  1821.  
  1822. procedure pos_extr (
  1823.     destination : in string;
  1824.     source      : in string;
  1825.     start       : in integer;
  1826.     stop        : in integer);
  1827.  
  1828. pragma interface (rtl, pos_extr);
  1829. pragma import_procedure (pos_extr, "str$pos_extr",
  1830.     (d_string, d_string, integer, integer), (reference, reference, reference, reference));
  1831. pragma import_procedure (pos_extr, "str$pos_extr",
  1832.     (string, d_string, integer, integer), (descriptor(s), reference, reference, reference));
  1833. pragma import_procedure (pos_extr, "str$pos_extr",
  1834.     (d_string, string, integer, integer), (reference, descriptor(s), reference, reference));
  1835. pragma import_procedure (pos_extr, "str$pos_extr",
  1836.     (string, string, integer, integer), (descriptor(s), descriptor(s), reference, reference));
  1837. --|
  1838. --| Prefix a string with another
  1839. --|
  1840. procedure prefix (
  1841.     destination : in out d_string;
  1842.     source      : in d_string);
  1843.  
  1844. procedure prefix (
  1845.     destination : in out d_string;
  1846.     source      : in string);
  1847.  
  1848. pragma interface (rtl, prefix);
  1849. pragma import_procedure (prefix, "str$prefix",
  1850.     (d_string, d_string), (reference, reference));
  1851. pragma import_procedure (prefix, "str$prefix",
  1852.     (d_string, string), (reference, descriptor(s)));
  1853. --|
  1854. --| Get right part of a string.
  1855. --|
  1856. procedure right (
  1857.     destination : in d_string;
  1858.     source      : in d_string;
  1859.     position    : in integer);
  1860.  
  1861. procedure right (
  1862.     destination : in string;
  1863.     source      : in d_string;
  1864.     position    : in integer);
  1865.  
  1866. procedure right (
  1867.     destination : in d_string;
  1868.     source      : in string;
  1869.     position    : in integer);
  1870.  
  1871. procedure right (
  1872.     destination : in string;
  1873.     source      : in string;
  1874.     position    : in integer);
  1875.  
  1876. pragma interface (rtl, right);
  1877. pragma import_procedure (right, "str$right",
  1878.     (d_string, d_string, integer), (reference, reference, reference));
  1879. pragma import_procedure (right, "str$right",
  1880.     (string, d_string, integer), (descriptor(s), reference, reference));
  1881. pragma import_procedure (right, "str$right",
  1882.     (d_string, string, integer), (reference, descriptor(s), reference));
  1883. pragma import_procedure (right, "str$right",
  1884.     (string, string, integer), (descriptor(s), descriptor(s), reference));
  1885. --|
  1886. --| Translate a string
  1887. --|
  1888. procedure translate (
  1889.     destination : out d_string;
  1890.     source      : in  d_string;
  1891.     translate   : in  d_string;
  1892.     match       : in  d_string);
  1893.  
  1894. procedure translate (
  1895.     destination : out string;
  1896.     source      : in  d_string;
  1897.     translate   : in  d_string;
  1898.     match       : in  d_string);
  1899.  
  1900. procedure translate (
  1901.     destination : out d_string;
  1902.     source      : in  string;
  1903.     translate   : in  d_string;
  1904.     match       : in  d_string);
  1905.  
  1906. procedure translate (
  1907.     destination : out d_string;
  1908.     source      : in  d_string;
  1909.     translate   : in  string;
  1910.     match       : in  d_string);
  1911.  
  1912. procedure translate (
  1913.     destination : out d_string;
  1914.     source      : in  d_string;
  1915.     translate   : in  d_string;
  1916.     match       : in  string);
  1917.  
  1918. procedure translate (
  1919.     destination : out string;
  1920.     source      : in  string;
  1921.     translate   : in  d_string;
  1922.     match       : in  d_string);
  1923.  
  1924. procedure translate (
  1925.     destination : out string;
  1926.     source      : in  d_string;
  1927.     translate   : in  string;
  1928.     match       : in  d_string);
  1929.  
  1930. procedure translate (
  1931.     destination : out string;
  1932.     source      : in  d_string;
  1933.     translate   : in  d_string;
  1934.     match       : in  string);
  1935.  
  1936. procedure translate (
  1937.     destination : out d_string;
  1938.     source      : in  string;
  1939.     translate   : in  string;
  1940.     match       : in  d_string);
  1941.  
  1942. procedure translate (
  1943.     destination : out d_string;
  1944.     source      : in  string;
  1945.     translate   : in  d_string;
  1946.     match       : in  string);
  1947.  
  1948. procedure translate (
  1949.     destination : out d_string;
  1950.     source      : in  d_string;
  1951.     translate   : in  string;
  1952.     match       : in  string);
  1953.  
  1954. procedure translate (
  1955.     destination : out string;
  1956.     source      : in  string;
  1957.     translate   : in  string;
  1958.     match       : in  d_string);
  1959.  
  1960. procedure translate (
  1961.     destination : out string;
  1962.     source      : in  string;
  1963.     translate   : in  d_string;
  1964.     match       : in  string);
  1965.  
  1966. procedure translate (
  1967.     destination : out string;
  1968.     source      : in  d_string;
  1969.     translate   : in  string;
  1970.     match       : in  string);
  1971.  
  1972. procedure translate (
  1973.     destination : out d_string;
  1974.     source      : in  string;
  1975.     translate   : in  string;
  1976.     match       : in  string);
  1977.  
  1978. procedure translate (
  1979.     destination : out string;
  1980.     source      : in  string;
  1981.     translate   : in  string;
  1982.     match       : in  string);
  1983.  
  1984. pragma interface (rtl, translate);
  1985. pragma import_procedure (translate, "str$translate",
  1986.     (d_string, d_string, d_string, d_string), (reference, reference, reference, reference));
  1987. pragma import_procedure (translate, "str$translate",
  1988.     (string, d_string, d_string, d_string), (descriptor(s), reference, reference, reference));
  1989. pragma import_procedure (translate, "str$translate",
  1990.     (d_string, string, d_string, d_string), (reference, descriptor(s), reference, reference));
  1991. pragma import_procedure (translate, "str$translate",
  1992.     (d_string, d_string, string, d_string), (reference, reference, descriptor(s), reference));
  1993. pragma import_procedure (translate, "str$translate",
  1994.     (d_string, d_string, d_string, string), (reference, reference, reference, descriptor(s)));
  1995. pragma import_procedure (translate, "str$translate",
  1996.     (string, string, d_string, d_string), (descriptor(s), descriptor(s), reference, reference));
  1997. pragma import_procedure (translate, "str$translate",
  1998.     (string, d_string, string, d_string), (descriptor(s), reference, descriptor(s), reference));
  1999. pragma import_procedure (translate, "str$translate",
  2000.     (string, d_string, d_string, string), (descriptor(s), reference, reference, descriptor(s)));
  2001. pragma import_procedure (translate, "str$translate",
  2002.     (d_string, string, string, d_string), (reference, descriptor(s), descriptor(s), reference));
  2003. pragma import_procedure (translate, "str$translate",
  2004.     (d_string, string, d_string, string), (reference, descriptor(s), reference, descriptor(s)));
  2005. pragma import_procedure (translate, "str$translate",
  2006.     (d_string, d_string, string, string), (reference, reference, descriptor(s), descriptor(s)));
  2007. pragma import_procedure (translate, "str$translate",
  2008.     (string, string, string, d_string), (descriptor(s), descriptor(s), descriptor(s), reference));
  2009. pragma import_procedure (translate, "str$translate",
  2010.     (string, string, d_string, string), (descriptor(s), descriptor(s), reference, descriptor(s)));
  2011. pragma import_procedure (translate, "str$translate",
  2012.     (string, d_string, string, string), (descriptor(s), reference, descriptor(s), descriptor(s)));
  2013. pragma import_procedure (translate, "str$translate",
  2014.     (d_string, string, string, string), (reference, descriptor(s), descriptor(s), descriptor(s)));
  2015. pragma import_procedure (translate, "str$translate",
  2016.     (string, string, string, string), (descriptor(s), descriptor(s), descriptor(s), descriptor(s)));
  2017. --|
  2018. --| Trim trailing blanks from a string
  2019. --|
  2020. procedure trim (
  2021.     destination : out    d_string;
  2022.     source      : in     d_string;
  2023.     length      : in out integer);
  2024.  
  2025. procedure trim (
  2026.     destination : out d_string;
  2027.     source      : in  d_string);
  2028.  
  2029. procedure trim (
  2030.     destination : out    string;
  2031.     source      : in     d_string;
  2032.     length      : in out integer);
  2033.  
  2034. procedure trim (
  2035.     destination : out string;
  2036.     source      : in  d_string);
  2037.  
  2038. procedure trim (
  2039.     destination : out    d_string;
  2040.     source      : in     string;
  2041.     length      : in out integer);
  2042.  
  2043. procedure trim (
  2044.     destination : out d_string;
  2045.     source      : in  string);
  2046.  
  2047. procedure trim (
  2048.     destination : out    string;
  2049.     source      : in     string;
  2050.     length      : in out integer);
  2051.  
  2052. procedure trim (
  2053.     destination : out string;
  2054.     source      : in  string);
  2055.  
  2056. pragma interface (rtl, trim);
  2057. pragma import_procedure (trim, "str$trim",
  2058.     (d_string, d_string, integer), (reference, reference, reference)); 
  2059. pragma import_procedure (trim, "str$trim",
  2060.     (string, d_string, integer), (descriptor(s), reference, reference));
  2061. pragma import_procedure (trim, "str$trim",
  2062.     (d_string, string, integer), (reference, descriptor(s), reference));
  2063. pragma import_procedure (trim, "str$trim",
  2064.     (string, string, integer), (descriptor(s), descriptor(s), reference));
  2065. pragma import_procedure (trim, "str$trim",
  2066.     (d_string, d_string), (reference, reference));
  2067. pragma import_procedure (trim, "str$trim",
  2068.     (string, d_string), (descriptor(s), reference));
  2069. pragma import_procedure (trim, "str$trim",
  2070.     (d_string, string), (reference, descriptor(s)));
  2071. pragma import_procedure (trim, "str$trim",
  2072.     (string, string), (descriptor(s), descriptor(s)));
  2073. --|
  2074. --| Convert a string to upper case
  2075. --|
  2076. procedure upcase (
  2077.     destination : out d_string;
  2078.     source      : in  d_string);
  2079.  
  2080. procedure upcase (
  2081.     destination : out string;
  2082.     source      : in  d_string);
  2083.  
  2084. procedure upcase (
  2085.     destination : out d_string;
  2086.     source      : in  string);
  2087.  
  2088. procedure upcase (
  2089.     destination : out string;
  2090.     source      : in  string);
  2091.  
  2092. pragma interface (rtl, upcase);
  2093. pragma import_procedure (upcase, "str$upcase",
  2094.     (d_string, d_string), (reference, reference));
  2095. pragma import_procedure (upcase, "str$upcase",
  2096.     (string, d_string), (descriptor(s), reference));
  2097. pragma import_procedure (upcase, "str$upcase",
  2098.     (d_string, string), (reference, descriptor(s)));
  2099. pragma import_procedure (upcase, "str$upcase",
  2100.     (string, string), (descriptor(s), descriptor(s)));
  2101.  
  2102. end;
  2103. $ eod
  2104. $ checksum [.rtl]str_.ada
  2105. $ if checksum$checksum .nes. "478034284" then write sys$output -
  2106.     "    ******Checksum error for file [.rtl]str_.ada******"
  2107. $ write sys$output "Creating [.rtl]sys.ada"
  2108. $ create [.rtl]sys.ada
  2109. $ deck
  2110. ---------------------------------------------------------------------------
  2111. --|                                    |--
  2112. --| Title:  Sys                                |--
  2113. --| Date:   20-MAR-1987                            |--
  2114. --| Name:   Randy Buckland                        |--
  2115. --|                                    |--
  2116. --| Purpose:    System service easy routines.                |--
  2117. --|                                    |--
  2118. ---------------------------------------------------------------------------
  2119. --|                                    |--
  2120. --| Revision History                            |--
  2121. --|                                    |--
  2122. --| Who        Date    Description                    |--
  2123. --| ---        ----    -----------                    |--
  2124. --| rcb        20-MAR-1987    New file.                    |--
  2125. --|                                    |--
  2126. ---------------------------------------------------------------------------
  2127. --|                                    |--
  2128. --| Copyright (c) 1987 by Research Triangle Institute.            |--
  2129. --| Written by Randy Buckland. Not derived from licensed software.    |--
  2130. --|                                    |--
  2131. --| Permission is granted to anyone to use this software for any    |--
  2132. --| purpose on any computer system, and to redistribute it freely,    |--
  2133. --| subject to the following restrictions.                |--
  2134. --|                                    |--
  2135. --| 1. The author is not responsible for the consequences of use of    |--
  2136. --|    this software, no matter how awful, even if they arise from    |--
  2137. --|    defects in it.                            |--
  2138. --| 2. The copyright notice must remain a part of all sources files.    |--
  2139. --| 3. This software may not be sold in any fashion.            |--
  2140. --|                                    |--
  2141. ---------------------------------------------------------------------------
  2142. with str, system;
  2143. use  str, system;
  2144.  
  2145. with starlet;
  2146.  
  2147. package body sys is
  2148.  
  2149. ---------------------------------------------------------------------------
  2150. --|                                    |--
  2151. --| Exi                                    |--
  2152. --|                                    |--
  2153. ---------------------------------------------------------------------------
  2154. --|                                    |--
  2155. --| Parameters:        1. Exit status value.                |--
  2156. --|                                    |--
  2157. --| Description:    Exit with a given status value.            |--
  2158. --|                                    |--
  2159. ---------------------------------------------------------------------------
  2160. procedure sys_exit (
  2161.     status : in cond_value_type := 1) is
  2162.  
  2163. ret_stat : cond_value_type;
  2164.  
  2165. begin
  2166.     starlet.exi (ret_stat, status);
  2167. end;
  2168.  
  2169. ---------------------------------------------------------------------------
  2170. --|                                    |--
  2171. --| Trnlnm                                |--
  2172. --|                                    |--
  2173. ---------------------------------------------------------------------------
  2174. --|                                    |--
  2175. --| Parameters:        1. String to translate.                |--
  2176. --|            2. Index of value to return.            |--
  2177. --|                                    |--
  2178. --| Description:    Translate a logical name to it's value.        |--
  2179. --|            Return a null string if no translation.        |--
  2180. --|                                    |--
  2181. ---------------------------------------------------------------------------
  2182. function trnlnm (
  2183.     lognam : in string;
  2184.     index  : in integer := 0)
  2185.     return string is
  2186.  
  2187. status : cond_value_type;
  2188. items  : starlet.item_list_type(1..3);
  2189. val    : string(1..256);
  2190. len    : integer := 0;
  2191.  
  2192. begin
  2193.     items(1).item_code := starlet.lnm_index;
  2194.     items(1).buf_len := 4;
  2195.     items(1).buf_address := index'address;
  2196.     items(1).ret_address := address_zero;
  2197.     
  2198.     items(2).item_code := starlet.lnm_string;
  2199.     items(2).buf_len := 256;
  2200.     items(2).buf_address := val'address;
  2201.     items(2).ret_address := len'address;
  2202.     
  2203.     items(3).buf_len := 0;
  2204.     items(3).item_code := 0;
  2205.     
  2206.     starlet.trnlnm (status, starlet.lnm_m_case_blind, "LNM$DCL_LOGICAL", 
  2207.     lognam, 3, items);
  2208.     
  2209.     if success (status) then
  2210.     return val(1..len);
  2211.     else
  2212.     return "";
  2213.     end if;
  2214. end;
  2215.  
  2216. end;
  2217. $ eod
  2218. $ checksum [.rtl]sys.ada
  2219. $ if checksum$checksum .nes. "319727695" then write sys$output -
  2220.     "    ******Checksum error for file [.rtl]sys.ada******"
  2221. $ write sys$output "Creating [.rtl]sys_.ada"
  2222. $ create [.rtl]sys_.ada
  2223. $ deck
  2224. ---------------------------------------------------------------------------
  2225. --|                                    |--
  2226. --| Title:  Sys                                |--
  2227. --| Date:   20-MAR-1987                            |--
  2228. --| Name:   Randy Buckland                        |--
  2229. --|                                    |--
  2230. --| Purpose:    System service easy routines.                |--
  2231. --|                                    |--
  2232. ---------------------------------------------------------------------------
  2233. --|                                    |--
  2234. --| Revision History                            |--
  2235. --|                                    |--
  2236. --| Who        Date    Description                    |--
  2237. --| ---        ----    -----------                    |--
  2238. --| rcb        20-MAR-1987    New file.                    |--
  2239. --|                                    |--
  2240. ---------------------------------------------------------------------------
  2241. --|                                    |--
  2242. --| Copyright (c) 1987 by Research Triangle Institute.            |--
  2243. --| Written by Randy Buckland. Not derived from licensed software.    |--
  2244. --|                                    |--
  2245. --| Permission is granted to anyone to use this software for any    |--
  2246. --| purpose on any computer system, and to redistribute it freely,    |--
  2247. --| subject to the following restrictions.                |--
  2248. --|                                    |--
  2249. --| 1. The author is not responsible for the consequences of use of    |--
  2250. --|    this software, no matter how awful, even if they arise from    |--
  2251. --|    defects in it.                            |--
  2252. --| 2. The copyright notice must remain a part of all sources files.    |--
  2253. --| 3. This software may not be sold in any fashion.            |--
  2254. --|                                    |--
  2255. ---------------------------------------------------------------------------
  2256. with condition_handling;
  2257. use  condition_handling;
  2258.  
  2259. package sys is
  2260.  
  2261. ---------------------------------------------------------------------------
  2262. --|                                    |--
  2263. --| Routine defintions.                            |--
  2264. --|                                    |--
  2265. ---------------------------------------------------------------------------
  2266. procedure sys_exit (
  2267.     status : in cond_value_type := 1);
  2268.  
  2269. function trnlnm (
  2270.     lognam : in string;
  2271.     index  : in integer := 0)
  2272.     return string;
  2273.  
  2274. end;
  2275. $ eod
  2276. $ checksum [.rtl]sys_.ada
  2277. $ if checksum$checksum .nes. "24748231" then write sys$output -
  2278.     "    ******Checksum error for file [.rtl]sys_.ada******"
  2279.  
  2280.  
  2281.