home *** CD-ROM | disk | FTP | other *** search
- { ╔═══╦══════════════════════════════════════════════╦═══╗
- ║ ║ Pascal Library by Scott Wade ║ ║
- ║ ║ 715 FM 1959 Apt 310 ║ ║
- ║ ║ Houston, TX 77034 ║ ║
- ┌──────╨───╨──────────────────────────────────────────────╨───╨──────┐
- │ This group of routines is contributed to public domain, and no │
- │ one can possibly get any commercial value out of them since they │
- │ must be used in other programs. I require that if these are used │
- │ as is in any program, that this banner remain with the source │
- │ code of the program. I would appreciate any comments or sugges- │
- │ tions on improvements, & am curious to hear how these are used. │
- │ You can leave a message for me on these BBS's: │
- │ Ziggy's 821-1391 ScoreBoard 583-7848 │
- │ TBL-COMM 661-9040 Test-Mode 660-9252 │
- └────────────────────────────────────────────────────────────────────┘
-
- TOPTION.TST v1.0 Command option parser.
- v1.0: 4/11/86 : Given a buffer, this will extract a one-letter option that
- is preceded by /. For example:
- JOBRUN /f filename.ext
- will return 70, the ascii equivalent of 'F', and the buffer will be
- 'filename.ext' NOTE: it converts to uppercase!
- }
-
- Type
- Buffer = string[ 255 ];
- LongWord = string[ 20 ];
- Word = string[ 10 ];
- LongWordList = array[ 1..16 ] of LongWord ;
- WordList = array[ 1..16 ] of Word ;
- { NOTE: all of the above are global types for INC and LIB files. }
- var
- Loop, AscOpt : Integer ;
- TestBuf : Buffer ;
-
- {$I tOption.LIB}
-
- Function SelectBuffer( var SetOption : Integer ): Buffer;
- begin
- Case SetOption of
- 1 : SelectBuffer := '' ;
- 2 : SelectBuffer := '/' ;
- 3 : SelectBuffer := '/A';
- 4 : SelectBuffer := '/f filejunk' ;
- 5 : SelectBuffer := 'filejunk /f' ;
- 6 : SelectBuffer := '/a junkfile /f';
- 7 : SelectBuffer := 'No Option Here!';
- end{ Case };
- end{ F SelectBuffer };
-
- begin
- { Try it with TestBuf set to the following:
- || Null |/| slash only |/A| option only, uppercase
- |/f filejunk| |junkfile /f| |/a junkfile /f|
- In the case of multiple options, will return the first encountered.
- }
- GoToXY(1,10);
- writeln('Test of tOption.LIB v1.0 ');
- writeln;
- For Loop := 1 to 7 do begin
- TestBuf := SelectBuffer( Loop );
- AscOpt := 0;
- writeln;
- write('Buffer In: |',TestBuf,'| ');
- tOption( TestBuf, AscOpt );
- writeln('Buffer Out: |',TestBuf,'| Option:',
- chr( AscOpt ), AscOpt:5 );
- end{ Loop };
- end{ tOption.TST }.
-
-
-
-