home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / MUTIL.ZIP / UTIL.PRN < prev   
Encoding:
Text File  |  1988-04-19  |  18.5 KB  |  877 lines

  1.  
  2.  
  3.  
  4.   
  5.   
  6.   
  7.   
  8.   
  9.   
  10.   
  11.   
  12.   Turbo Pascal 4.0 
  13.   Programmers Utilities
  14.   
  15.   
  16.   
  17.   
  18.   
  19.   
  20.   
  21.   
  22.   
  23.   
  24.   
  25.   
  26.   
  27.   
  28.   
  29.   
  30.   
  31.   
  32.   
  33.   
  34.   
  35.   
  36.   Copyright 1988, Michael A. Eissinger.  
  37.   All Rights Reserved.
  38.   
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. Turbo Pascal 4.0 Utilities
  68.  
  69.  
  70. Introduction
  71.   
  72.   This small set of DOS programmer's utilities are designed to make
  73.   life just a bit easier.  Unix is a rich operating system for
  74.   programmers, offering a vast array of useful, if not always used
  75.   tools.  Some of the utilities included here provide functions
  76.   similar to those available in Unix, others offer functions not
  77.   present in either Unix or MS/DOS.  
  78.   
  79.   The Utilities Extract, Indent and SGCvert and SGTest as well as
  80.   the Unit SGDisp.tpu are all for TP4.  Indent and Extract can also
  81.   be used with Turbo Pascal Version 2 or 3.  
  82.   
  83.   The remaining utilities - BldBat, Paste, Meld and PutCurs are for
  84.   batch file building, modification and use and do not require TP4
  85.   or any other programming language.
  86.   
  87.   This package is released as ShareWare, and as such are not
  88.   released by the author to the public domain.  These are
  89.   copyrighted programs and remain the property of the author.  To
  90.   register please send $25.00 to
  91.   
  92.   Michael A. Eissinger
  93.   Microcomputer Consultant
  94.   346 East Cedar
  95.   Hanford, CA 93230
  96.   209-582-5830
  97.   
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  5:08pm  4/19/88               User's Guide                    Page: 2 
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133. Turbo Pascal 4.0 Utilities
  134.  
  135.  
  136. Batch File Utilities
  137.   BldBat - Batch File Build Utility
  138.     
  139.     BldBat (Build Batch) is a simple little utility that provides a
  140.     function similar to using Unix's LS command with the file 
  141.     option.  In other words, it builds a text file of the filenames
  142.     specified in the command line parameters.  Unlike using DIR and
  143.     redirecting the output to a file, BldBat only writes the actual
  144.     filenames to the resulting output text file.
  145.     
  146.     Syntax
  147.     
  148.     BldBat <filemask> <outputfilename>
  149.     
  150.     where <filemask> is any valid MS/DOS file mask - wild cards are
  151.     supported and outputfilename is a valid DOS filename, normally
  152.     .bat. BldBat does not assume/impose any specific file extensions,
  153.     so the user can specify any or no filename extension. 
  154.     
  155.     If <outputfilename> already exists, BldBat will notify the user 
  156.     and ask if it should be overwritten.  If the user responds [Y] 
  157.     for yes, the existing file will be overwritten.  [N] terminates
  158.     BldBat and returns to the DOS commandline. 
  159.     
  160.     examples
  161.     
  162.     BldBat \*.bat temp.txt
  163.     
  164.     produces a text file that looks like this . . .
  165.     
  166.     autoexec.bat
  167.     shutdown.bat
  168.         .
  169.         .
  170.     temp.bat
  171.     
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  5:08pm  4/19/88               User's Guide                    Page: 3 
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199. Turbo Pascal 4.0 Utilities
  200.  
  201.  
  202.   Paste - Unix-like paste command
  203.     
  204.     Unix offers the PASTE command to allow two files to be merged. 
  205.     PASTE takes a line from the first file, appends a line from the
  206.     second file and writes the newly created line to a third file. 
  207.     This version of PASTE differs somewhat from the Unix equivalent,
  208.     however, these differences are slight.
  209.     
  210.     Syntax
  211.     
  212.     PASTE <inputfilename1> <inputfilename2> <outputfilename> n ch
  213.     
  214.     where
  215.     <inputfilename1> file used to build the 1st part of each line. 
  216.     <inputfilename2> file used to build the 2nd part of each line. 
  217.     <outputfilename> resulting file. 
  218.     n - if delimited by spaces, how many spaces.  Default = 1. 
  219.     ch delimiter character between the two parts of the line. 
  220.     
  221.     If <outputfilename> already exists, PASTE will notify the user 
  222.     and ask if it should be overwritten.  If the user responds [Y] 
  223.     for yes, the existing file will be overwritten.  [N] terminates
  224.     PASTE and returns to the DOS commandline. 
  225.     
  226.     example:
  227.     given the following two text files . . .
  228.     
  229.     part1.txt
  230.     
  231.     copy fileone.txt
  232.     copy filetwo.txt
  233.     copy filethr.txt
  234.     copy filefor.txt
  235.     copy filefiv.txt
  236.     
  237.     part2.txt
  238.     
  239.     file1.txt 
  240.     file2.txt 
  241.     file3.txt 
  242.     file4.txt 
  243.     file5.txt 
  244.     
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  5:08pm  4/19/88               User's Guide                    Page: 4 
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265. Turbo Pascal 4.0 Utilities
  266.  
  267.  
  268.     issuing the following at the DOS command line . . .
  269.     
  270.     PASTE part1 part2 moveit.bat
  271.     
  272.     will produce the following file
  273.     
  274.     moveit.txt
  275.     
  276.     copy fileone.txt file1.txt
  277.     copy filetwo.txt file2.txt
  278.     copy filethr.txt file3.txt
  279.     copy filefor.txt file4.txt
  280.     copy filefiv.txt file5.txt
  281.     
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  5:08pm  4/19/88               User's Guide                    Page: 5 
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331. Turbo Pascal 4.0 Utilities
  332.  
  333.  
  334.   Meld
  335.     
  336.     Meld is sort of like paste, except that instead of butting the 
  337.     two lines together, meld writes a line from the first file, then
  338.     on a new line a line from the second file, continuing to the end
  339.     of the longest file.  This is like shuffling a deck of cards and
  340.     can be quite handy for taking two batch files that work on the
  341.     same list and inserting the commands from the second batch file
  342.     between the commands in the first.
  343.     
  344.     meld <inputfilename1> <inputfilename2> <outputfilename>
  345.     
  346.     <inputfilename1> file used to build the 1st part of each line. 
  347.     <inputfilename2> file used to build the 2nd part of each line. 
  348.     <outputfilename> resulting file. 
  349.     
  350.     If <outputfilename> already exists, meld will notify the user 
  351.     and ask if it should be overwritten.  If the user responds [Y] 
  352.     for yes, the existing file will be overwritten.  [N] for no 
  353.     terminates meld and returns to the DOS commandline. 
  354.     
  355.     Example:
  356.     
  357.     Lets take the file we created above using paste - moveit.txt - 
  358.     and create a new batch file that not only copies the files, 
  359.     changing the names of the new files and then deletes the 
  360.     original files.
  361.     
  362.     If we have another file called part3.txt that looks like . . .
  363.     
  364.     del fileone.txt
  365.     del filetwo.txt
  366.     del filethr.txt
  367.     del filefor.txt
  368.     del filefiv.txt
  369.     
  370.     we can then meld it with the moveit.txt above 
  371.     
  372.     meld moveit.txt part3.txt moveit.bat
  373.     
  374.     the following batch file would then be the result.
  375.     
  376.     copy fileone.txt file1.txt
  377.     del fileone.txt
  378.     copy filetwo.txt file2.txt
  379.     del filetwo.txt
  380.     copy filethr.txt file3.txt
  381.     del filethr.txt
  382.     copy filefor.txt file4.txt
  383.     del filefor.txt
  384.     copy filefiv.txt file5.txt
  385.     del filefiv.txt
  386.  
  387.  5:08pm  4/19/88               User's Guide                    Page: 6 
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397. Turbo Pascal 4.0 Utilities
  398.  
  399.  
  400.   PutCurs
  401.     
  402.     One small utility, that is especially helpful in batch files, is
  403.     PUTCURS.  This utility will move the cursor to the designated
  404.     line on the screen, moving the DOS prompt to the specified line.
  405.     Any line on the screen can be addressed.  Especially helpful when
  406.     using either text files or Screen Genie .com files within batch
  407.     file menu systems. 
  408.     
  409.     Syntax
  410.     
  411.     putcurs <n> </c>
  412.     
  413.     where
  414.     <n>   = line number is the line to move the DOS prompt to. If 
  415.             no line number is specified, of if the line number is 
  416.             less than zero or greater than 25, the utility will 
  417.             simply move the cursor down two lines. 
  418.     
  419.     </c>  = clear screen.  If this option is included, PUTCURS will 
  420.             clear the screen prior to positioning the cursor.
  421.     
  422.     The order of the options does not matter.  They can be entered 
  423.     in either order.
  424.     
  425.     Line 1 is tricky.  It will properly move the cursor to line 1,
  426.     but then the cursor will jump to line two.  Since cls will 
  427.     normally move the cursor to 1,1 anyway, this should pose no 
  428.     problem - simply use cls if you want the cursor to go to the 
  429.     upper corner of the screen, as normal; use PUTCURS when you want
  430.     to put the cursor somewhere else on the screen. 
  431.     
  432.     If using putcurs within a batch file with the echo command, add
  433.     one to the line number you want.  That will actually position the
  434.     cursor at the right location.  This may sound a bit confusing,
  435.     however if you play with PUTCURS in its various  modes, you'll
  436.     understand just how to get it to function the way you want it to.
  437.     
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  5:08pm  4/19/88               User's Guide                    Page: 7 
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463. Turbo Pascal 4.0 Utilities
  464.  
  465.  
  466. Pascal Utilities
  467.   Indent - Source Indent and Case Conversion Utility
  468.     
  469.     Every Pascal programmer or shop has a favorite way to put code 
  470.     into the file.  Some people like to use all upper case, others 
  471.     prefer all lower case, while yet others prefer the upper/lower 
  472.     case combination sometimes called the Borland Convention.  Some
  473.     programmers prefer to indent one, two, three or even four 
  474.     characters when indenting various structures in the code.  These
  475.     are highly subjective judgements on the part of the individual
  476.     programmer or the software shop and all are "Right" depending on
  477.     what standards are established. Sometimes code will come from a
  478.     third party in a format different than the one that a user
  479.     prefers.  Sometimes two people working on the same project have
  480.     deep preferences and can't even read code that is presented in a
  481.     format other than the one that he/she is used to. These sound
  482.     like trivial problems, but they do occur and can bring
  483.     development to a complete standstill.  There are many extensive
  484.     "PrettyLister" programs around that will handle these problems. 
  485.     Indent is another source formatting utility that handles both
  486.     indents and case. 
  487.     
  488.     There are several limitations to indent, including the handling
  489.     of some indent cases and only being able to provide all upper or
  490.     all lower or no change in case.  The case conversion functions do
  491.     not effect literals (enclosed in single quotes) or comments. 
  492.     
  493.     The indent functions can get confused when indenting complex 
  494.     case or record structures.  These sections will have to be hand
  495.     edited after using indent.
  496.     
  497.     However even with these limitations, indent can be the quickest
  498.     way to change the case or indent structure of source code. 
  499.     
  500.     Syntax
  501.     
  502.     Indent <SourceFileName>
  503.     
  504.     where
  505.      <SourceFileName> Name of source file to indent.
  506.     
  507.     Note:  Indent generates a newly indented file using the same name
  508.            as the original file.  The original file is kept in a file
  509.            with the same name and the extension of .bak.
  510.     
  511.     
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  5:08pm  4/19/88               User's Guide                    Page: 8 
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529. Turbo Pascal 4.0 Utilities
  530.  
  531.  
  532.   Extract - Source Comment/Structure Extraction Utility
  533.     
  534.     Extract is a hot and dirty technical documentation utility that
  535.     pulls out the names of all procedures and functions along with
  536.     all inline comments.  Extract simply passes a source file,
  537.     extracting the data from the file and placing it into an output
  538.     file.  The resulting text file can be edited, just like any other
  539.     text file.
  540.     
  541.     Syntax
  542.     
  543.     extract <SourceFileName> <ExtractFileName>
  544.     
  545.     where
  546.     <SourceFileName>  is the name of the original source file
  547.     <ExtractFileName> is the name for the extract document file
  548.     
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  5:08pm  4/19/88               User's Guide                    Page: 9 
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595. Turbo Pascal 4.0 Utilities
  596.  
  597.  
  598. Screen Genie
  599.   
  600.   Screen Genie from Nostradamus Software is a good screen 
  601.   generator for Turbo Pascal.  Under Turbo Pascal 3 Screen Genie 
  602.   provided .com files that could be loaded as externals, wrote 
  603.   code and provided editing, window and screen management 
  604.   facilities. 
  605.   
  606.   The facilities provided here are intended as a method of 
  607.   utilizing only part of older versions of Screen Genie, and are 
  608.   by no means intended to replace the upgraded version from 
  609.   Nostradamus.  Their use is limited to full screen displays and 
  610.   only work with that one area of a product that provides a great
  611.   deal more in terms of functions, power and flexibility. 
  612.  
  613.   SGCvert - Screen Genie Work File Conversion Utility
  614.     
  615.     One way that a few people used Screen Genie that was not 
  616.     documented was to use the Screen Genie work file as the screen. 
  617.     The work file is 2000 attribute/character pairs with a small
  618.     header record.  SGCvert strips off the header and converts Screen
  619.     Genie work files into straight binary files that can either be
  620.     used with the DisplayGenieScreen procedure in the enclosed unit
  621.     SGDisp.tpu or converted to an .obj file using Borland's Bin2Obj
  622.     utility. 
  623.     
  624.     Syntax
  625.     
  626.     SGCvert <workfilename> <binaryfilename>
  627.     
  628.     where
  629.     <workfilename> is the name used for the Screen Genie work file
  630.     <binaryfilename> is the name for the final screen file 
  631.  
  632.   SGTest - Screen Genie Work File Conversion Test Utility
  633.     
  634.     SGTest is a Screen Genie conversion test utility.  Once a work 
  635.     file has been converted using the SGCvert utility, SGTest allows
  636.     the user to test the final file without having to write a program
  637.     to display the file.  Since SGTest uses exactly the same facility
  638.     as those provided in the SGDisp unit, SGTest shows the file as it
  639.     would appear in the final application.
  640.     
  641.     Syntax
  642.     
  643.     sgtest <binaryfilename>
  644.     
  645.     where
  646.     <binaryfilename> is the name of the screen file.
  647.  
  648.   SGDisp - Screen Genie Display Unit
  649.     
  650.  
  651.  5:08pm  4/19/88               User's Guide                    Page:10 
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661. Turbo Pascal 4.0 Utilities
  662.  
  663.     This unit provides the facility to display the binary file 
  664.     produced by SGCvert from a Screen Genie work file.  The space 
  665.     required for the screen file is dynamically allocated and 
  666.     released, so the amount of program overhead is minimized.  The 
  667.     TPU is selfcontained and only contains the code for the one 
  668.     procedure.  The interface declaration for the procedure is . . 
  669.     
  670.     procedure DisplayGenieScreen(filename:string);
  671.     
  672.     the Syntax for using this procedure is then . . .
  673.     
  674.     DisplayGenieScreen('file.scn');
  675.     
  676.     Where file.scn is the name of a valid converted file.
  677.     
  678.     Currently DisplayGenieScreen only provides for full screen 
  679.     displays.  The windowing functions of Screen Genie are not 
  680.     supported. 
  681.     
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  5:08pm  4/19/88               User's Guide                    Page:11 
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727. Turbo Pascal 4.0 Utilities
  728.  
  729.  
  730. Conclusion
  731.   
  732.   This package of Programmer's Utilities for Turbo Pascal Version
  733.   4.0 are not public domain. They are the Copyrighted property of
  734.   the author and as such are protected by all relevant copyright
  735.   laws, provisions and treaties. 
  736.   
  737.   This software is shareware, which means that it, like most 
  738.   shareware, may be freely copied and distributed as long as no 
  739.   consideration is required for its distribution, except a
  740.   copying and media charge not to exceed $10.00, including the
  741.   cost of the means of distribution (i.e. diskette). Users who
  742.   find the programs of value to them should consider sending a
  743.   registration to Michael A. Eissinger, Microcomputer Consultant
  744.   at the address listed below.
  745.   
  746.   Users sending a dontation of $25.00 or more are registered, and
  747.   will one years free of upgrades and one year free phone support
  748.  
  749.   These programs are copyrighted programs, and are protected by 
  750.   the laws of the United States and of its various states, as well
  751.   as international treaties and conventions. A license is hereby
  752.   granted to all persons to use these programs according to the
  753.   terms and restrictions contained herein. 
  754.   
  755.   These programs are distributed as-is and by its use each person
  756.   agrees to the terms and conditions of this license, and 
  757.   acknowledges that Michael A. Eissinger, Microcomputer
  758.   Consultant has made no warranties, either express or implied,
  759.   concerning the performance of this software, including
  760.   warranties of merchantability or fitness for a particular
  761.   purpose.
  762.   
  763.   Please send all comments, suggestions, bug reports, donations 
  764.   and registration information to:
  765.  
  766.   
  767.           Michael A. Eissinger 
  768.           Microcomputer Consultant 
  769.           346 E. Cedar, 
  770.           Hanford, CA 93230 
  771.           209-582-5830
  772.   
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  5:08pm  4/19/88               User's Guide                    Page:12 
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792. Turbo Pascal 4.0 Utilities
  793.  
  794.  
  795. Other Software Available
  796.   
  797.   Michael A. Eissinger, Microcomputer Consultant provides a
  798.   complete line of Broadcast Management software used by radio
  799.   stations to help manage music, requests, contests and promotions
  800.   commercial copy and production and production room facilities.
  801.   
  802.   For more information on any of this software, including the
  803.   latest catalog and prices, call Michael Eissinger, 209-582-5830.
  804.   
  805.   Demo and/or ShareWare versions of some of the titles are
  806.   available.
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  5:08pm  4/19/88               User's Guide                    Page:13 
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858. Turbo Pascal 4.0 Utilities
  859.  
  860.      Table of Contents
  861.  
  862.      Introduction. . . . . . . . . . . . . . . . . . . . . . . . 2
  863.      Batch File Utilities. . . . . . . . . . . . . . . . . . . . 3
  864.        BldBat - Batch File Build Utility . . . . . . . . . . . . 3
  865.        Paste - Unix-like paste command . . . . . . . . . . . . . 4
  866.        Meld. . . . . . . . . . . . . . . . . . . . . . . . . . . 6
  867.        PutCurs . . . . . . . . . . . . . . . . . . . . . . . . . 7
  868.      Pascal Utilities. . . . . . . . . . . . . . . . . . . . . . 8
  869.        Indent - Source Indent and Case Conversion Utility. . . . 8
  870.        Extract - Source Comment/Structure Extraction Utility . . 9
  871.      Screen Genie. . . . . . . . . . . . . . . . . . . . . . . .10
  872.        SGCvert - Screen Genie Work File Conversion Utility . . .10
  873.        SGTest - Screen Genie Work File Conversion Test Utility .10
  874.        SGDisp - Screen Genie Display Unit. . . . . . . . . . . .10
  875.      Conclusion. . . . . . . . . . . . . . . . . . . . . . . . .12
  876.      Other Software Available. . . . . . . . . . . . . . . . . .13
  877.