home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / pascal / strings.lbr / STRINGS.DZC / STRINGS.DOC
Encoding:
Text File  |  1987-02-28  |  3.6 KB  |  79 lines

  1. Pascal String Package documentation                  85/10/18 C.B. Falconer
  2. ===================================
  3.  
  4. For the benefit of those who require a set of string operations with the
  5. PASCALP system, here is one.  It is almost entirely written in STANDARD Pascal,
  6. with the exception of the use of the "scanfor" standard procedure, and this
  7. can easily be replaced by a Pascal procedure, at the cost of efficiency.
  8.  
  9. For the procedures/functions available, scan the STRINGS.INC file for the words
  10. PROCEDURE or FUNCTION, or see below.  The usage should be obvious.  TESTER.PAS
  11. file exercises each operation, and should further show usage.
  12.  
  13. Note that the input sequences (used in readstring, and in the TESTER module)
  14. assume that the file system follows the ISO and ANSI standards (as originally
  15. specified in Jensen & Wirth).  If you are using a system with non-standard
  16. protocols (e.g. interactive files on UCSD) these areas must to be modified.
  17.  
  18. Strings "cleaned" by STRINGCLEAN can be compared directly, as in "IF s1 < s2"
  19. and will collate in the ASCII character sequence.  Use of STRINGUPSHIFT can
  20. eliminate character case differences.
  21.  
  22. The following is the slightly edited (blank lines have been added) output of
  23. REFRENCE on the mini-file consisting of the first and last lines below.
  24.  
  25. Procedural Cross-Referencer - Version Y-01-02
  26. =============================================
  27.  
  28.  Line   Program/procedure/function heading
  29. -------------------------------------------
  30.  
  31.     0   PROGRAM temp(input,output); (*$i'strings.inc'*)
  32.  
  33.     9     PROCEDURE readstring(VAR f : text; VAR s : string)
  34.    10     (* At exit, eoln(f) is true, and no readln(f) has been called *);
  35.  
  36.    27     PROCEDURE readlnstring(VAR f : text; VAR s : string)
  37.    28     (* differs from readstring in that at exit readln has been called *);
  38.  
  39.    36     FUNCTION length(VAR s : string) : xstrindex;
  40.  
  41.    46     PROCEDURE writestring(VAR f : text; VAR s : string);
  42.  
  43.    57     PROCEDURE wrtfldstring(VAR f : text; VAR s : string; field : integer)
  44.    58     (* Analog to the normal Pascal write(f, x : field). Rt. justifies *);
  45.  
  46.    73     PROCEDURE concat(s1, s2 : string; VAR sdest : string)
  47.    74     (* Arguments may be the same string, correctly handled *);
  48.  
  49.    89     PROCEDURE stringdeblank(VAR s : string)
  50.    90     (* remove trailing blanks, if any *);
  51.  
  52.   105     PROCEDURE stringextend(VAR s : string; ch : char; always : boolean)
  53.   106     (* always false prevents extension if the terminal *)
  54.   107     (* char is ch, or if the string is null (length=0) *);
  55.  
  56.   125     PROCEDURE substring(si : string; index : strindex; len : integer;
  57.   126                         VAR sdest : string)
  58.   127     (* if index outside of si, then return the null string *)
  59.   128     (* if index + len > length of si, then truncate len    *);
  60.  
  61.   146     PROCEDURE stringclean(VAR s : string)
  62.   147     (* This standardizes the portion beyond the eos marker. *);
  63.  
  64.   166     FUNCTION stringfind(VAR s, searchee : string; start : strindex)
  65.   167                          : xstrindex
  66.   168     (* returns the index in searchee (from start up) where    *)
  67.   169     (* the substring s may be found.  Returns 0 if not found. *);
  68.  
  69.   202     PROCEDURE stringupshift(VAR s : string);
  70.  
  71.   218     FUNCTION stoi(VAR s : string; start : strindex;
  72.   219                   VAR value : integer) : xstrindex
  73.   220     (* returns 0 for no valid number, else index past number *);
  74.  
  75.   241     PROCEDURE itos(i : integer; VAR s : string)
  76.   242     (* Creates a string with the left justified representation of i *);
  77.  
  78.   271     BEGIN END.
  79. r