DataMuseum.dk

Presents historical artifacts from the history of:

CP/M

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about CP/M

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦b9df33036⟧ TextFile

    Length: 4992 (0x1380)
    Types: TextFile
    Names: »READCMD.DOC«

Derivation

└─⟦dd59903ef⟧ Bits:30005887 Klub diskette for udveksling af software
    └─ ⟦this⟧ »READCMD.DOC« 

TextFile

    Filename:  Readcmd.doc                      Date:   12/20/82

        This document is intended to serve as a guide to the use
        of the accompanying files:
                                    READCMD.P/REL
                                    GETNUMS.P/REL
                                    TESTCMD.PAS/COM
                                    CTOI.REL    
    READCMD
        
        The procedure READCMD provides a means of dealing with the 
        command tail of a program call.  The approach taken is to 
        read in the whole line of up to 80 characters, and then to 
        extract the arguments; rather than to read in one argument
        at a time.  The arguments are returned to the calling program
        as an array, ARG, of MAXARGS strings.
        
        The need for something of this sort arises when you have a
        program that you sometimes want called with one argument,
        sometimes with several, or sometimes with no argument at all.
        
        The introductory comment block in READCMD.P outlines the 
        details necessary to use the procedure effectively.  To 
        further clarify the use of this procedure, the demonstration
        program, TESTCMD, has been included.  
        
    GETNUMS
        
            Getnums is an accessory procedure for use when some of
            the arguments are numeric.  It translates all arguments
            which start with a digit into integers, and returns them
            to the calling program as an array, NMBR, of N integers.
        
    TESTCMD
        
        1.  Note that it is here, in the calling program, that the 
            maximum number, MAXARGS, of arguments is set, and the 
            maximum number, MAXWORD, of characters in any argument.
        
        2.  In this example, the first argument, NAMEÆ1Å, is simply
            set equal to "source", as if it were a filename, and then
            is written to the console, as a check.
            
        3.  Then, the first character of the second argument is made
            equal to "key", and also written to the console.
        
        4.  The program also always writes out the number of arguments
            entered, - NARGS.
        
        5.  Other program action is made to depend on the "key".  If
            the key is:
        
            a   The program will list all NARGS of the arguments
                entered.

            m   It will print all MAXARGS arguments, including dummies 
                if MAXARGS > NARGS.  (You will note that I have 
				arbitrarily set the dummy argument to be a backslash,
				 "Ø".)  In addition, it will print the length of each 
				argument.
        
            n   It calls GETNUMS and prints out the N (NUMCT) numeric 
                arguments.  To show that they are indeed integers, it 
                also prints their sum.



        
        6.  If no arguments are entered, READCMD assumes you forgot 
            them, and prompts you, unless you enter a double space 
            after the program call.  In that case, all arguments become
            dummies.  To show this, I have made Testcmd print out
            everything if the first argument is a dummy.
        
        7.  I suggest you try TESTCMD with:

            a.  a, m, and n as the first letter of the second 
                argument.

            b.  Fewer than and more than MAXARGS (11) arguments,
                and with no arguments.

            c.  Arguments having more than MAXWORD (14) characters.

            d.  Arguments spread out over more than 77 characters.

            e.  Strings of digits less than MAXINT and greater than 
                MAXINT.

            f.  Tab characters; - But don't expect it to work!  It
                doesn't on my system.  If someone can explain that
                to me, I shall be very grateful.

    EXTENSIONS

        .P      READCMD.P and GETNUMS.P are ready to be "included"
                into the .PAS file of a calling program.  GETNUMS.P
                incorporates the subsidiary Function, CTOI.

        .REL    These files are ready to be linked into a library.

                READCMD.REL has been compiled with MAXWORD = 14 and 
                MAXARGS = 11, and the calling program must declare
                them to have the same values.  Otherwise, the program
                will probably crash.

                GETNUMS.REL does not incorporate CTOI.  CTOI will
                have to be linked into the library separately.
                Therefore CTOI.REL is included on the disk also.



    Suggestions and comments will be greatly appreciated by:

                Clif Kinne              617-444-9055
                159 Dedham Ave.
                Needham, Mass. 02192
«eof»