home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol030 / sigmlog.022 < prev    next >
Encoding:
Text File  |  1985-02-10  |  9.0 KB  |  298 lines

  1. Sig/M volume 22        miscellaneous Pascal Z utilities
  2.  
  3.     (original materials from Pascal Z User Group volume 4)
  4.  
  5.     -CATALOG.022        contents of Sig/M volume 22
  6.     ABSTRACT.022        comments
  7.     CRCKFILE.022        CRC of volume 22
  8.      
  9. 22.1    CFIO.LIB         2K     program to open files   
  10. 22.2    CONCORD.COM     10K     program that builds an alphabetical
  11. 22.3    CONCORD.PAS     11K       listing of distinct words 
  12. 22.4    COSINE.PAS       2K     Cosine program
  13. 22.5    COSINE.REL       2K     /
  14. 22.6    COSINE.SRC       6K    /
  15. 22.7    GEN5.COM         8K     demo on accessing CP/M files 
  16. 22.8    GEN5.PAS         5K    /
  17. 22.9    GRAPH1.COM      10K     demo on creating a graphic representation
  18. 22.10   GRAPH1.PAS       1K     /   of a function.
  19. 22.11   ISORTV1.COM      6K     insertion sort with linked list
  20. 22.12   ISORTV1.PAS      4K    /
  21. 22.13   LINENOS.COM      8K     keep track of text lines
  22. 22.14   LINENOS.PAS      4K    /
  23. 22.15   POINT.COM        6K     demo on the use of pointers 
  24. 22.16   POINT.PAS           2K    /
  25. 22.17   RANDOM.MAC       4K     "professional" random number generator
  26. 22.18   RANDOM.PAS       1K     simple random number generator
  27. 22.19   SINCOS.SRC       5K     sine/cosine utility
  28. 22.20   SINCOS.REL     1K    /
  29. 22.21   STRLIB.DOC       5K     Ray Penley's latest updated string lib.
  30. 22.22   STRLIB.LIB    13K    /
  31. 22.23   TRIG4.COM        9K     simple Demo program that builds a
  32. 22.24   TRIG4.PAS        2K     /    short Trig chart
  33. 22.25   XREFG2.COM      13K     a binary tree type cross-ref generator
  34. 22.26   XREFG2.PAS      18K    /
  35. 22.27   ZPTEX.COM        8K     very simple text formatter 
  36. 22.28   ZPTEX.PAS        8K     /
  37. 22.29   LESSON4.     5K    /
  38. 22.30   RECIPE.COM      12K    recipe program
  39. 22.31   RECIPE.PAS      17K      /
  40. 22.32   RECIPE.MST       1K     /                    
  41. 22.33   RCPDAT.YYY         1K    /
  42. 22.34   FCLOSE.COM       8K    three different ways to close a file
  43. 22.35   FCLOSE.PAS     4K    /    in Pascal Z.
  44.  
  45.  
  46.  
  47.      Frankly¼á ╔ though⌠ tha⌠ thi≤ disδ woulΣ takσ ß littlσ whilσ ì
  48. t∩ ge⌠ togeather«  Bu⌠ Ra∙ Penley¼ BoΓ HarscΦ anΣ ß milΣ donatioε ì
  49. b∙á mσá brough⌠á thi≤á volumσá togeathe≥ s∩á fas⌠á ╔á almos⌠á go⌠ ì
  50. overloaded«á  Thσá utilit∙ leve∞ i≤ increasinτ also«á  Therσá arσ ì
  51. somσá ver∙á gooΣ program≤ oε thi≤ disδ tha⌠ arσá oµá professiona∞ ì
  52. quality.  It seems that we are a success.
  53.      
  54. 1.   CFIO.LIB       Add this to your library.  It is a program
  55.                     to help you open files, really nice. By the
  56.                     way ,the CF means Connect Files.   
  57.  
  58. 2.   CONCORD.COM    This a program that builds an alphabetical
  59.             .PAS    listing of all the distinct words which
  60.             .CCD    appear in a text file.(Useful by a programer
  61.                     in locating garbage variables in a program)
  62.                     Makes heavy use of pointers and the data
  63.                     string. Some good ideas here.
  64.  
  65. 3.   COSINE.PAS     Before the bug got fixed, this was our
  66.            .REL     subsituted Cosine program. It is now new
  67.            .SRC     and improved.
  68.  
  69. 4.   GEN5.COM       A demo on accessing CP/M files and read-
  70.          .PAS       them back. Instructional for the noivce.
  71.  
  72. 5.   GRAPH1.COM     A demo on creating a graphic representation
  73.            .PAS     of a function.
  74.  
  75. 6.   ISORTV1.COM    A insertion sort with linked list.This
  76.             .PAS    program can be easily adapted to sort single
  77.                     characters, integer numbers, real numbers
  78.                     months or any item that can be ordered.
  79.  
  80. 7.   LINENOS.COM    Many times it is difficult to keep track
  81.             .PAS    of text lines. This program will number
  82.                     your lines for you so it will be easy to
  83.                     count or find.
  84.  
  85. 8.   POINT.COM      A demo on the use of pointers taken from
  86.           .PAS      page 49 of the Pascal/Z manual.
  87.  
  88. 9.   RANDOM.MAC     A professional random number generator
  89.                     for your library. Two years of testing
  90.                     went into this one, should be good.
  91. 9A.  RANDOM.PAS     Something simple Bob threw in.       
  92.  
  93. 10.  SINCOS.SRC     A debugged sine/cosine that works.
  94.            .REL
  95.  
  96. 11.  STRLIB.DOC     Ray Penley's latest updated string lib.
  97.            .LIBè
  98. 12.  TRIG4.COM      A simple Demo program that builds a
  99.           .PAS      short Trig chart.
  100.  
  101. 13.  XREFG2.COM     This is a binary tree type cross-ref
  102.            .PAS     generator. Very useful and very in-
  103.                     structive.
  104.  
  105. 14.  ZPTEX.COM      A very simple text formatter intended
  106.           .PAS     for CAI. Lesson 4 is a sample.
  107.      LESSON4.
  108.  
  109. 15.  RECIPE.COM     Here is a good example of what can
  110.            .PAS     be done. RAY took a Basic program and
  111.            .MST     converted it to Pascal/Z. Your wifes
  112.      RCPDAT.YYY     will love this program because it is
  113.                     practical, useable AND its not your
  114.                     simple recipe program. Its for left
  115.                     overs also.
  116.  
  117. 16.  FCLOSE.COM     Three different ways to close a file
  118.        .PAS        in Pascal/Z.
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.     (************************************************)
  126.     (*                        *)
  127.     (*        STRING LIBRARY            *)
  128.     (*                        *)
  129.     (************************************************)
  130.  
  131.  
  132.  
  133.  
  134. (*    Version 3.1  6 July 1980/Raymond E. Penley *)
  135.  
  136.     (************************************************)
  137.  
  138.  
  139.  
  140. FUNCTION INDEX(SOURCE,Pattern) : INTEGER ; EXTERNAL;
  141.     (*---this is a Pascal/Z extension---*)
  142.  
  143.     Returns the position of the first occurrence of the
  144. Pattern in SOURCE to be scanned. The integer value of the
  145. position of the first character in the matched pattern will
  146. be returned. If no match occurred then zero will be returned.
  147.  
  148.   If for example the string THIS contained:
  149.     'Today is the first day.'
  150.     PATTERN := 'is';
  151.     N := INDEX(THIS,pattern);
  152.     writeln(N);
  153.  
  154.     would write:    7
  155.  
  156.     (****************************************)
  157.     (*    UCSD PASCAL            *)
  158.     (*                    *)
  159.     (*     K := POS(Pattern,SOURCE);    *)
  160.     (*                    *)
  161.     (* NOTE that Pascal/Z is 180 degrees    *)
  162.     (* out of wack!                *)
  163.     (****************************************)
  164.  
  165.     (************************************************)
  166.  
  167.  
  168.  
  169. PROCEDURE PRINT(STRING);
  170.  
  171.   Prints to the console the string passed; does NOT issue a
  172.   carriage-return/line-feed. 
  173.  
  174.     PRINT(This);          {no CR/LF    }
  175.     PRINT(This);writeln;    {with CR/LF    }
  176.     PRINT(A[5]);write('    ');PRINT(Newstr);writeln;
  177.  
  178.     (************************************************)
  179.  
  180.  
  181.  
  182. PROCEDURE COPY(New_string,Source,POS,COUNT);
  183.  
  184.     COPY(<NEW> := <SOURCE>,<starting at>,<# of chars>);
  185.     COPY(Newstr,Title,1,9);
  186.  
  187.     Returns a string containing count <chars> starting at
  188.     <POS> position in SOURCE.
  189.  
  190.     (*****************************************)
  191.     (*    UCSD PASCAL             *)
  192.     (*                     *)
  193.     (* New_string := COPY(Source,POS,COUNT); *)
  194.     (*                     *)
  195.     (*****************************************)
  196.  
  197.     (************************************************)
  198.  
  199.  
  200.  
  201. PROCEDURE CONCAT(New_string,arg1_string,arg2_string);
  202.  
  203.     CONCAT(Newstr,ThisString, ThatString);
  204.  
  205.     This CONCAT works in the same fashion as CPM's PIP does.
  206.   That is:
  207.         CONCAT( New String := Arg1, Arg2 );
  208.  
  209.   There may be only two arguments. A string is returned which is
  210.   the concatenation of both strings passed provided that the 
  211.   combined length of all strings does not exceed the max length
  212.   allowed for strings.
  213.  
  214.     (********************************************)
  215.     (*    UCSD PASCAL                *)
  216.     (*                        *)
  217.     (* New_string := CONCAT(arg1,arg2,...argn); *)
  218.     (*                        *)
  219.     (********************************************)
  220.  
  221.     (************************************************)
  222.  
  223.  
  224.  
  225. PROCEDURE REPLACE(Source, Destination, INDEX);
  226.  
  227.     REPLACE(Main,Next,N);
  228.     PRINT(Next);
  229.  
  230.     Replaces the characters in Destination with those
  231.   from the substring Source starting at position INDEX.
  232.  
  233.  
  234.     (*****************************************)
  235.     (*    UCSD PASCAL             *)
  236.     (*                     *)
  237.     (* INSERT(SOURCE,DESTINATION,INDEX);     *)
  238.     (*                     *)
  239.     (*****************************************)
  240.  
  241.     (************************************************)
  242.  
  243.  
  244.  
  245. PROCEDURE GetLine(STRING,count);
  246.  
  247.     Returns a string and the strings length input
  248.  from the console. The string must be a valid ASCII
  249.  character. Returns a length of zero if an error is
  250.  made.
  251.  
  252.   For example:
  253.  
  254.     GetLine(BUFFER,12);
  255.  
  256.     Gets characters from the console into the String 'BUFFER'
  257.   but up to a max of 12 characters.
  258.  
  259.     (************************************************)
  260.  
  261.  
  262.  
  263. FUNCTION VAL(AlphaNumeric char): INTEGER;
  264.  
  265.     I := VAL(ch);
  266.     N := N * 10 + VAL(CH);
  267.  
  268.     Returns the integer value of a single alphanumeric char.
  269.  
  270.     (************************************************)
  271.  
  272.  
  273.  
  274. FUNCTION RDR(AlphaNumericString): REAL;
  275.  
  276.     Z := RDR('112.25');
  277.     ZX := RDR('2.0E8');
  278.     Dollar := RDR(dollar.field);
  279.     I := trunc(RDR(oddjob));
  280.  
  281.     Returns a real number from an alphanumeric string.
  282.     Returns 0.0 if an error is encountered.
  283.  
  284.     (************************************************)
  285.  
  286.  
  287.  
  288. PROCEDURE STR(AlphaNumericString, IntegerValue);
  289.  
  290.  
  291.     STR(Dollar,number);
  292.  
  293.  
  294.     Returns an integer value from an alphanumeric string.
  295.  
  296.     (************************************************)
  297.  
  298.