Sig/M volume 22 miscellaneous Pascal Z utilities (original materials from Pascal Z User Group volume 4) -CATALOG.022 contents of Sig/M volume 22 ABSTRACT.022 comments CRCKFILE.022 CRC of volume 22 22.1 CFIO.LIB 2K program to open files 22.2 CONCORD.COM 10K program that builds an alphabetical 22.3 CONCORD.PAS 11K listing of distinct words 22.4 COSINE.PAS 2K Cosine program 22.5 COSINE.REL 2K / 22.6 COSINE.SRC 6K / 22.7 GEN5.COM 8K demo on accessing CP/M files 22.8 GEN5.PAS 5K / 22.9 GRAPH1.COM 10K demo on creating a graphic representation 22.10 GRAPH1.PAS 1K / of a function. 22.11 ISORTV1.COM 6K insertion sort with linked list 22.12 ISORTV1.PAS 4K / 22.13 LINENOS.COM 8K keep track of text lines 22.14 LINENOS.PAS 4K / 22.15 POINT.COM 6K demo on the use of pointers 22.16 POINT.PAS 2K / 22.17 RANDOM.MAC 4K "professional" random number generator 22.18 RANDOM.PAS 1K simple random number generator 22.19 SINCOS.SRC 5K sine/cosine utility 22.20 SINCOS.REL 1K / 22.21 STRLIB.DOC 5K Ray Penley's latest updated string lib. 22.22 STRLIB.LIB 13K / 22.23 TRIG4.COM 9K simple Demo program that builds a 22.24 TRIG4.PAS 2K / short Trig chart 22.25 XREFG2.COM 13K a binary tree type cross-ref generator 22.26 XREFG2.PAS 18K / 22.27 ZPTEX.COM 8K very simple text formatter 22.28 ZPTEX.PAS 8K / 22.29 LESSON4. 5K / 22.30 RECIPE.COM 12K recipe program 22.31 RECIPE.PAS 17K / 22.32 RECIPE.MST 1K / 22.33 RCPDAT.YYY 1K / 22.34 FCLOSE.COM 8K three different ways to close a file 22.35 FCLOSE.PAS 4K / in Pascal Z. Frankly¬  É thoughô thaô thió disë woulä takå á littlå whilå tï geô togeather® Buô Raù Penley¬ Boâ Harscè anä á milä donatioî bù  må  broughô  thió  volumå  togeatheò sï  fasô  É  almosô  goô overloaded®  Thå  utilitù leveì ió increasinç also®  Therå  arå somå  verù  gooä programó oî thió disë thaô arå  oæ  professionaì quality. It seems that we are a success. 1. CFIO.LIB Add this to your library. It is a program to help you open files, really nice. By the way ,the CF means Connect Files. 2. CONCORD.COM This a program that builds an alphabetical .PAS listing of all the distinct words which .CCD appear in a text file.(Useful by a programer in locating garbage variables in a program) Makes heavy use of pointers and the data string. Some good ideas here. 3. COSINE.PAS Before the bug got fixed, this was our .REL subsituted Cosine program. It is now new .SRC and improved. 4. GEN5.COM A demo on accessing CP/M files and read- .PAS them back. Instructional for the noivce. 5. GRAPH1.COM A demo on creating a graphic representation .PAS of a function. 6. ISORTV1.COM A insertion sort with linked list.This .PAS program can be easily adapted to sort single characters, integer numbers, real numbers months or any item that can be ordered. 7. LINENOS.COM Many times it is difficult to keep track .PAS of text lines. This program will number your lines for you so it will be easy to count or find. 8. POINT.COM A demo on the use of pointers taken from .PAS page 49 of the Pascal/Z manual. 9. RANDOM.MAC A professional random number generator for your library. Two years of testing went into this one, should be good. 9A. RANDOM.PAS Something simple Bob threw in. 10. SINCOS.SRC A debugged sine/cosine that works. .REL 11. STRLIB.DOC Ray Penley's latest updated string lib. .LIB Š 12. TRIG4.COM A simple Demo program that builds a .PAS short Trig chart. 13. XREFG2.COM This is a binary tree type cross-ref .PAS generator. Very useful and very in- structive. 14. ZPTEX.COM A very simple text formatter intended .PAS for CAI. Lesson 4 is a sample. LESSON4. 15. RECIPE.COM Here is a good example of what can .PAS be done. RAY took a Basic program and .MST converted it to Pascal/Z. Your wifes RCPDAT.YYY will love this program because it is practical, useable AND its not your simple recipe program. Its for left overs also. 16. FCLOSE.COM Three different ways to close a file .PAS in Pascal/Z. (************************************************) (* *) (* STRING LIBRARY *) (* *) (************************************************) (* Version 3.1 6 July 1980/Raymond E. Penley *) (************************************************) FUNCTION INDEX(SOURCE,Pattern) : INTEGER ; EXTERNAL; (*---this is a Pascal/Z extension---*) Returns the position of the first occurrence of the Pattern in SOURCE to be scanned. The integer value of the position of the first character in the matched pattern will be returned. If no match occurred then zero will be returned. If for example the string THIS contained: 'Today is the first day.' PATTERN := 'is'; N := INDEX(THIS,pattern); writeln(N); would write: 7 (****************************************) (* UCSD PASCAL *) (* *) (* K := POS(Pattern,SOURCE); *) (* *) (* NOTE that Pascal/Z is 180 degrees *) (* out of wack! *) (****************************************) (************************************************) PROCEDURE PRINT(STRING); Prints to the console the string passed; does NOT issue a carriage-return/line-feed. PRINT(This); {no CR/LF } PRINT(This);writeln; {with CR/LF } PRINT(A[5]);write(' ');PRINT(Newstr);writeln; (************************************************) PROCEDURE COPY(New_string,Source,POS,COUNT); COPY( := ,,<# of chars>); COPY(Newstr,Title,1,9); Returns a string containing count starting at position in SOURCE. (*****************************************) (* UCSD PASCAL *) (* *) (* New_string := COPY(Source,POS,COUNT); *) (* *) (*****************************************) (************************************************) PROCEDURE CONCAT(New_string,arg1_string,arg2_string); CONCAT(Newstr,ThisString, ThatString); This CONCAT works in the same fashion as CPM's PIP does. That is: CONCAT( New String := Arg1, Arg2 ); There may be only two arguments. A string is returned which is the concatenation of both strings passed provided that the combined length of all strings does not exceed the max length allowed for strings. (********************************************) (* UCSD PASCAL *) (* *) (* New_string := CONCAT(arg1,arg2,...argn); *) (* *) (********************************************) (************************************************) PROCEDURE REPLACE(Source, Destination, INDEX); REPLACE(Main,Next,N); PRINT(Next); Replaces the characters in Destination with those from the substring Source starting at position INDEX. (*****************************************) (* UCSD PASCAL *) (* *) (* INSERT(SOURCE,DESTINATION,INDEX); *) (* *) (*****************************************) (************************************************) PROCEDURE GetLine(STRING,count); Returns a string and the strings length input from the console. The string must be a valid ASCII character. Returns a length of zero if an error is made. For example: GetLine(BUFFER,12); Gets characters from the console into the String 'BUFFER' but up to a max of 12 characters. (************************************************) FUNCTION VAL(AlphaNumeric char): INTEGER; I := VAL(ch); N := N * 10 + VAL(CH); Returns the integer value of a single alphanumeric char. (************************************************) FUNCTION RDR(AlphaNumericString): REAL; Z := RDR('112.25'); ZX := RDR('2.0E8'); Dollar := RDR(dollar.field); I := trunc(RDR(oddjob)); Returns a real number from an alphanumeric string. Returns 0.0 if an error is encountered. (************************************************) PROCEDURE STR(AlphaNumericString, IntegerValue); STR(Dollar,number); Returns an integer value from an alphanumeric string. (************************************************)