MVG UTILITY ROUTINES by Design aids data services This document describes the mvg utilitiy routines found in MVGALL.OLB Version as of 31-Jan-85 Page 2 1.0 Multiple String Concatenation ________ ______ _____________ ********** * aggreg * ********** NAME: aggreg -- Multiple String Concatenation SYNOPSIS: int aggreg(destr, numstr, s1, s2, s3, ... sn) char *destr; /* destination string */ unsigned numstr; /* number of concatenations */ char *s1,*s2...; /* strings to be concatenated */ DESCRIPTION: aggreg() concatenates numstr strings to the end of destr. Returns a pointer to where we started concatenating. BUGS: AUTHOR: Machiavelli Systems Page 3 aggreg Multiple String Concatenation 2.0 Allocate a Copy of a String ________ _ ____ __ _ ______ ********** * allstr * ********** NAME: allstr -- Allocate a Copy of a String SYNOPSIS: char * allstr(s) char *s; /* string to be duplicated */ DESCRIPTION: allstr() Allocates memory for a copy of the string s, and returns a pointer to the new string. BUGS: AUTHOR: Machiavelli Systems Page 4 allstr Allocate a Copy of a String 3.0 ********* * angle * ********* NAME: angle -- SYNOPSIS: int DESCRIPTION: BUGS: AUTHOR: Machiavelli Systems Page 5 angle 4.0 Edit a Buffer on Screen ____ _ ______ __ ______ ********** * edtbuf * ********** NAME: edtbuf -- Edit a Buffer on Screen SYNOPSIS: int edtbuf(buf,len,startcol,row,col) char *buf; /* buffer to edit */ int len; /* length of buf (bytes) */ int startcol; /* column to start editing */ int row; /* row position to place the buffer on screen */ int col; /* column position to place the buffer on screen */ DESCRIPTION: Edtbuf() places the buffer on the screen at the specified position, and places the cursor at the specified column {startcol}, for the operator to edit, via the numeric keypad on a vt100/220. Before edtbuf() can be used, zbegin() must be called. Edit commnads : terminates editing aborts editing erases the previous character moves cursor back one character moves cursor back one character moves cursor on one character <,> erases the character under the cursor <-> erases to end of buffer Returns The line terminator, used to exit editing mode. BUGS: AUTHOR: Machiavelli Systems Page 6 edtbuf Edit a Buffer on Screen 5.0 Format Data Into Buffer ______ ____ ____ ______ ********** * fieldp * ********** NAME: fieldp -- Format Data Into Buffer SYNOPSIS: char * fieldpt(destr, typ, wid, jst, fltfmt, left, right, sour) char *destr; /* append output to here */ char typ; /* the data type */ int wid; /* field width */ char jst; /* justification */ char *fltfmt; /* floating point format */ char *left; /* left string */ char *right; /* right string */ type *sour; /* pointer to the data to be formatted */ DESCRIPTION: fieldpt() formats data to the users specifications : a) field size : wid is the total width of the field b) type is the data type { I F $ } c) just is the justification { L C R } d) fltfmt is the format for a float number (pointer to a null if not being used. format : Ftot.dec e) left is a string to be appended to the left of the data f) right is a string to be appended to the right of the data g) sour is where the data is to come from (pointer) Returns a pointer to the end of destr. BUGS: AUTHOR: Machiavelli Systems Page 7 fieldp Format Data Into Buffer 6.0 Open New Fixed File ____ ___ _____ ____ ********** * fopenc * ********** NAME: fopenc -- Open New Fixed File SYNOPSIS: FILE * fopenc(filnam,recz) char *filnam; /* pointer to the name of the file to open */ unsigned recz; /* record size in the file */ DESCRIPTION: fopenc() creates and opens a fixed length file. 0 is returned on error, $$ferr contains the error code. BUGS: AUTHOR: Machiavelli Systems Page 8 fopenc Open New Fixed File 7.0 Open a Fixed File for Update ____ _ _____ ____ ___ ______ ********** * fopenx * ********** NAME: fopenx -- Open a Fixed File for Update SYNOPSIS: FILE * fopenx(filnam,recz) char *filnam; /* pointer to name of file to open */ unsigned recz; /* record size of file being opened */ DESCRIPTION: fopenx() opens the specified fixed length file for update. The pointer to the file descriptor is returned, of 0 for error. If an error occurs, $$ferr is set. BUGS: AUTHOR: Machiavelli Systems Page 9 fopenx Open a Fixed File for Update 8.0 Fixed Length Get _____ ______ ___ ********* * frget * ********* NAME: frget -- Fixed Length Get SYNOPSIS: int frget(buffer,bufsiz,ioptr,number) char *buffer; /* where to put it */ unsigned bufsiz; /* how much to get */ FILE *ioptr; /* where to get it from */ long number; /* which record to get */ DESCRIPTION: frget() get's a specified record of a specified length from the specified input file, and places it in the buffer. This is a FCS 'C' interface routine. Returns 0 for sucess, or $$ferr on error. See RSX11M I/O error codes. BUGS: Very sleezy, and needs to be re-written. AUTHOR: Machiavelli Systems Page 10 frget Fixed Length Get 9.0 Random Acess Put ______ _____ ___ ********* * frput * ********* NAME: frput -- Random Acess Put SYNOPSIS: int frput(buffer,bufsiz,ioptr,number) char *buffer; /* pointer to output buffer */ unsigned bufsiz; /* size of buffer */ FILE *ioptr; /* output file pointer */ long number; /* record number to write */ DESCRIPTION: frput() puts a record to a fixed length file, at a specified record number. BUGS: AUTHOR: Machiavelli Systems Page 11 frput Random Acess Put 10.0 Get File Size in Bytes ___ ____ ____ __ _____ ********* * fsize * ********* NAME: fsize -- Get File Size in Bytes SYNOPSIS: long fsize(ioptr) FILE *ioptr; /* file to be looked at */ DESCRIPTION: fsize() returns the file size, in bytes, of the specified file. BUGS: AUTHOR: Machiavelli Systems Page 12 fsize Get File Size in Bytes 11.0 Get Current Alpha Field ___ _______ _____ _____ ********** * getalp * ********** NAME: getalp -- Get Current Alpha Field SYNOPSIS: int getalpha(start,buff) char **start; /* pointer to source buffer pointer */ char *buff; /* pointer to destination buffer */ DESCRIPTION: getalpha() copies data from start to buff, until a non-alpha character is encounted. Nothing is returned. BUGS: AUTHOR: Machiavelli Systems Page 13 getalp Get Current Alpha Field 12.0 Get Fresh Edited Keyboard Input ___ _____ ______ ________ _____ ********** * getbuf * ********** NAME: getbuf -- Get Fresh Edited Keyboard Input SYNOPSIS: int getbuf(buf,len,row,col) char *buf; /* destination buffer */ int len; /* maximum bytes to be read */ int row; /* input row on screen */ int col; /* input column on screen */ DESCRIPTION: getbuf(buf,len,row,col) gets input from the console, with editing facilities. The cursor is positioned at (row,col) on the screen, and the user inputs the data, terminated with a carrage return. The editing codes are described in documentation for edtbuf(). Returns '\r' or terminator. Before getbuf() can be used, zbegin() must be called. BUGS: AUTHOR: Machiavelli Systems Page 14 getbuf Get Fresh Edited Keyboard Input 13.0 Get a Group of Characters ___ _ _____ __ __________ ********** * getgro * ********** NAME: getgro -- Get a Group of Characters SYNOPSIS: int getgroup(ccp, dest, openchar, closechar) char **ccp; /* pointer to buffer pointer */ char *dest; /* pointer to destination buffer */ char openchar; /* start character */ char closechar; /* end character */ DESCRIPTION: Get a group of characters from a string. Its extent is determined by the openchar, and closechar characters. If ccp contains nothing then NULL is returned. If the brackets don't exist in ccp, then the string passed is copied into the destination buffer. Nothing is returned. BUGS: AUTHOR: Machiavelli Systems Page 15 getgro Get a Group of Characters 14.0 Get Literal From Buffer ___ _______ ____ ______ ********** * getlit * ********** NAME: getlit -- Get Literal From Buffer SYNOPSIS: int getliteral(ccp,dest) char **ccp; /* pointer to buffer pointer */ char *dest; /* pointer to destination buffer */ DESCRIPTION: Function to copy a data element from a buffer to a given destination, starting with the character currently pointed to. The function copies all of the data, including any quotemarks, starting from the current character, up to the next whitespace or NUL. The pointer is left pointing to the first whitespace character or NUL. Nothing is returned. BUGS: AUTHOR: Machiavelli Systems Page 16 getlit Get Literal From Buffer 15.0 Get Next Data Item After White Space ___ ____ ____ ____ _____ _____ _____ ********** * getnex * ********** NAME: getnex -- Get Next Data Item After White Space SYNOPSIS: int getnext(ccp,dest) char **ccp; char *dest; DESCRIPTION: getnext() is a composite function call made from within leading whitespace to find the next data item and transfer it to the required buffer, dest. A pointer to where the data was taken from, is returned. Eg: ccp -> * -> < there> After: ccp -> * -> dest -> BUGS: AUTHOR: Machiavelli Systems Page 17 getnex Get Next Data Item After White Space 16.0 Get a Number From Screen ___ _ ______ ____ ______ ********** * getnum * ********** NAME: getnum -- Get a Number From Screen SYNOPSIS: int getnum(row,col,mess) int row; /* row to put message */ int col; /* column to put message */ char *mess; /* message to be displayed */ DESCRIPTION: getnum() positions the cursor a the specified position, displays a message, and accepts input. Input must be numeric, and editing is available. See edtbuf() for details on editing. The input is returned, or 0 for ESCAPE. BUGS: AUTHOR: Machiavelli Systems Page 18 getnum Get a Number From Screen 17.0 Get Qouted Literal ___ ______ _______ ********** * getqli * ********** NAME: getqli -- Get Qouted Literal SYNOPSIS: int getqlit(ccp, dest) char **ccp; /* pointer to buffer pointer */ char *dest; /* pointer to destination buffer */ DESCRIPTION: Getqlit relies on the data being in the following format: ...... where there are no white chars in the unquoted string. The data is teminated by: 1) ENDSTRING 2) Any white character. Destination buffer will contain the quoted literals, (including quotes). eg. "lit1""lit2""lit3"0\. BUGS: AUTHOR: Machiavelli Systems Page 19 getqli Get Qouted Literal 18.0 Get Quoted Text ___ ______ ____ ********** * getqte * ********** NAME: getqte -- Get Quoted Text SYNOPSIS: int getqtext(ccp,dest) char **ccp; /* buffer pointer pointer */ char *dest; /* destination buffer */ DESCRIPTION: getqtext() copys a data element from a buffer to a given destination, starting with the character currently pointed to. If the data element is not a quoted string, the function is analogous to strcopy() but using whitespace as its terminator. The pointer is left pointing to the first whitespace character. If first character indicates that the data element is a quoted string, the function accepts the whole string but discards the quotes, leaving the pointer immediately after the closing quotes. Its main use is to accept a complete field, but it may also be used to extract quoted text embedded in another string (for example, when decoding a "format string". This function modifies the pointer to the source string (*ccp). BUGS: AUTHOR: Machiavelli Systems Page 20 getqte Get Quoted Text 19.0 Get a Sanitary Character Input ___ _ ________ _________ _____ ******** * get1 * ******** NAME: get1 -- Get a Sanitary Character Input SYNOPSIS: int get1(row,col) int row; /* row to get it at */ int col; /* column to get it at */ DESCRIPTION: get1() awaits a sanitary character input, followed by '\r' do not return until something is seen before '\r' Returns the character typed before '\r', or the function key pressed. BUGS: AUTHOR: Machiavelli Systems Page 21 get1 Get a Sanitary Character Input 20.0 Skip Whitespace In Buffer ____ __________ __ ______ ********* * glide * ********* NAME: glide -- Skip Whitespace In Buffer SYNOPSIS: int glide(ccp) char **ccp; /* pointer to buffer pointer */ DESCRIPTION: Function to skip over whitespace in a buffer, leaving the pointer set to the first nonwhite character. BUGS: AUTHOR: Machiavelli Systems Page 22 glide Skip Whitespace In Buffer 21.0 Test For a Blank Character ____ ___ _ _____ _________ ********** * isblan * ********** NAME: isblan -- Test For a Blank Character SYNOPSIS: int isblank(c) char c; /* character to be tested */ DESCRIPTION: isblank returns TRUE if chacacter is a space of tab, and FALSE if the character is otherwise. BUGS: AUTHOR: Machiavelli Systems Page 23 isblan Test For a Blank Character 22.0 String Equality Test ______ ________ ____ ********** * issame * ********** NAME: issame -- String Equality Test SYNOPSIS: BOOL issame(s1,s2) char *s1; /* first string to compare */ char *s2; /* second string to compate */ DESCRIPTION: issame() returns TRUE if both strings are equal. BUGS: AUTHOR: Machiavelli Systems Page 24 issame String Equality Test 23.0 Test For Whitespace ____ ___ __________ ********** * iswhit * ********** NAME: iswhit -- Test For Whitespace SYNOPSIS: int iswhite(c) char c; /* character to be tested */ DESCRIPTION: iswhite() returns TRUE if the character is a whitespace, and FALSE otherwise. BUGS: AUTHOR: Machiavelli Systems Page 25 iswhit Test For Whitespace 24.0 Check Memory Address _____ ______ _______ ********** * _mchec * ********** NAME: _mchec -- Check Memory Address SYNOPSIS: int _mcheck(adr) char *adr; /* address to check */ DESCRIPTION: _mcheck() examines a section of memory to be free'd, and if it can't be free'd, then an error message is displayed, and the program is aborted. BUGS: AUTHOR: Machiavelli Systems Page 26 _mchec Check Memory Address 25.0 Get First Occurance in Words ___ _____ _________ __ _____ ********* * pos16 * ********* NAME: pos16 -- Get First Occurance in Words SYNOPSIS: int pos16(c,s) char c; /* character to be looked for */ char *s; /* pointer to the buffer to look in */ DESCRIPTION: Using 16-bit characters (in ints) find the position of character c in string s return -1 if it isn't there return the index of 1st occurence if it is there. BUGS: AUTHOR: Machiavelli Systems Page 27 pos16 Get First Occurance in Words 26.0 Define the File as Random Access ______ ___ ____ __ ______ ______ ********** * ranacc * ********** NAME: ranacc -- Define the File as Random Access SYNOPSIS: int ranacc(ioptr) FILE *ioptr; /* the file to define */ DESCRIPTION: ranacc() sets the random access bits in the file header block, allowing the user to use recnum(). This routine will set the R.FIX bit, when the file is closed. BUGS: AUTHOR: Machiavelli Systems Page 28 ranacc Define the File as Random Access 27.0 Set Record Number ___ ______ ______ ********** * recnum * ********** NAME: recnum -- Set Record Number SYNOPSIS: int recnum(ioptr,number) FILE *ioptr; /* the file to have it's record number set in */ long number; /* the record number to point it at */ DESCRIPTION: recnum() points a file's record pointer at the specified record. ranacc() must have been called before access to the file via this routine can be used (recnum will work, but read/write wont). BUGS: AUTHOR: Machiavelli Systems Page 29 recnum Set Record Number 28.0 Set File Record Size ___ ____ ______ ____ ********** * recsiz * ********** NAME: recsiz -- Set File Record Size SYNOPSIS: int recsiz(ioptr,size) FILE *ioptr; /* pointer to file to be set */ unsigned size; /* what to set the record size to */ DESCRIPTION: recsiz() sets the record size in the file descriptor block. recsiz() doesn't check for a previously set record size. The size set, will stay set in the file, after the file is closed. BUGS: AUTHOR: Machiavelli Systems Page 30 recsiz Set File Record Size 29.0 Skip Nonwhite in Buffer ____ ________ __ ______ ********** * scrape * ********** NAME: scrape -- Skip Nonwhite in Buffer SYNOPSIS: int scrape(cpp) char *cpp; /* pointer to buffer pointer */ DESCRIPTION: Function to skip over nonwhite characters, leaving the pointer set to the first whitespace character or ENDSTRING or NEWLINE. Returns Nothing. BUGS: AUTHOR: Machiavelli Systems Page 31 scrape Skip Nonwhite in Buffer 30.0 Move Past Next Whitespace ____ ____ ____ __________ ******** * skip * ******** NAME: skip -- Move Past Next Whitespace SYNOPSIS: int skip(ccp) char **ccp; /* pointer to buffer pointer */ DESCRIPTION: Function to move past NEXT whitespace encountered (if any) and update the current buffer pointer to the position of next nonwhite character. We may be either in the previous data or in the whitespace but there must be at least one whitespace character - which may be the character currently pointed to - before the next data. Return ERROR if a \0 or \n is encountered instead, as the field expected may be an optional field. Return NOERROR otherwise. BUGS: AUTHOR: Machiavelli Systems Page 32 skip Move Past Next Whitespace 31.0 Transfer Next Data Item To Buffer ________ ____ ____ ____ __ ______ ********** * skipne * ********** NAME: skipne -- Transfer Next Data Item To Buffer SYNOPSIS: int skipnext(ccp, dest) char **ccp; /* pointer to buffer pointer */ char *dest; /* pointer to destination buffer */ DESCRIPTION: Skipnext() is a composite function call which may be invoked either from within a data item or in whitespace to find and get the next data item and transfer it to the required buffer. Returns a pointer to where the data was picked up from. BUGS: AUTHOR: Machiavelli Systems Page 33 skipne Transfer Next Data Item To Buffer 32.0 Skip Over Alpha ____ ____ _____ ********** * skpalf * ********** NAME: skpalf -- Skip Over Alpha SYNOPSIS: char * skpalf(ccp) char **ccp; /* pointer to buffer pointer */ DESCRIPTION: skpalf() skips over any leading alpha's or whitespaces. The pointer *ccp is left pointing to the first numeric. If no numeric exists, skipalf points *ccp at the terminating Null, and returns 0. Skipalf returns *ccp; BUGS: AUTHOR: Machiavelli Systems Page 34 skpalf Skip Over Alpha 33.0 Put A Character to the Terminal ___ _ _________ __ ___ ________ ********** * _sputc * ********** NAME: _sputc -- Put A Character to the Terminal SYNOPSIS: int _sputchar(c) char c; /* chacacter to be displayed */ DESCRIPTION: _sputchar() displays a character on the screen at the current cursor position. BUGS: AUTHOR: Machiavelli Systems Page 35 _sputc Put A Character to the Terminal 34.0 Remove White From String ______ _____ ____ ______ ********** * squeez * ********** NAME: squeez -- Remove White From String SYNOPSIS: char * squeeze(string) char *string; /* pointer to string to be squeezed */ DESCRIPTION: squeeze() removes all white spaces from a null-terminated string. Returns a pointer to the string. BUGS: AUTHOR: Machiavelli Systems Page 36 squeez Remove White From String 35.0 block i/o _____ ___ ********* * block * ********* NAME: block -- block i/o DESCRIPTION: These routines, are used to immitate the fcs block i/o functons. a file is opened with open(), and it's record size is set to 512. random access is set, and we're cooking. to access the file, read(), write(), and lseek() work as per Kernigan & Ritchie. BUGS: AUTHOR: Design aids data services Page 37 block block i/o 36.0 Skip Over Digits ____ ____ ______ ******* * udn * ******* NAME: udn -- Skip Over Digits SYNOPSIS: int udn(ccp) char **ccp; /* pointer to buffer pointer */ DESCRIPTION: Function to skip over digits in a buffer, leaving the pointer set to the first non-digit character. Returns Nothing. BUGS: AUTHOR: Machiavelli Systems Page 38 udn Skip Over Digits 37.0 Convert String to Upper Case _______ ______ __ _____ ____ ********* * upstr * ********* NAME: upstr -- Convert String to Upper Case SYNOPSIS: char * upstr(source) char *source; /* pointer to string to be converted */ DESCRIPTION: upstr() converts a null-terminated string to upper case, and returns a pointer to the string. BUGS: AUTHOR: Machiavelli Systems Page 39 upstr Convert String to Upper Case 38.0 Get Byte Posn. in File ___ ____ _____ __ ____ ********** * _utell * ********** NAME: _utell -- Get Byte Posn. in File SYNOPSIS: unsigned _utell(fp) FILEP fp; /* file pointer of file to be checked */ DESCRIPTION: _utell() returns an unsigned byte position within the file. The value returned is 0-org byte posn. in file. BUGS: All this does is cast ftell to unsigned. AUTHOR: Machiavelli Systems Page 40 _utell Get Byte Posn. in File 39.0 Wait For a Carriage Return ____ ___ _ ________ ______ ********** * wait4r * ********** NAME: wait4r -- Wait For a Carriage Return SYNOPSIS: int wait4return() DESCRIPTION: wait4return() displays "HIT [RETURN]" on the mode line, and waits for the user to hit a carriage return, and clears the mode line. BUGS: AUTHOR: Machiavelli Systems Page 41 wait4r Wait For a Carriage Return 40.0 Walk over next whitespace ____ ____ ____ __________ ******** * walk * ******** NAME: walk -- Walk over next whitespace SYNOPSIS: int walk(cpp) char **cpp; /* string pointer pointer */ DESCRIPTION: Function to move past next whitespace encountered (if any) and return position of next nonwhite character. The current position is in the whitespace, with at least one whitespace character - which may be the character currently pointed to - before the next data. Return ERROR if a \0 or \n is encountered instead, as the field expected may be an optional field. Return NOERROR otherwise. BUGS: AUTHOR: Machiavelli Systems Page 42 walk Walk over next whitespace 41.0 Beep the Terminal ____ ___ ________ ********* * zbeep * ********* NAME: zbeep -- Beep the Terminal SYNOPSIS: int zbeep() DESCRIPTION: zbeep() sounds the terminal bell once. BUGS: AUTHOR: Machiavelli Systems Page 43 zbeep Beep the Terminal 42.0 Set Up the Vt100 Before Use ___ __ ___ _____ ______ ___ ********** * zbegin * ********** NAME: zbegin -- Set Up the Vt100 Before Use SYNOPSIS: int zbegin() DESCRIPTION: zbegin() sets the vt100 into application keypad mode, with cursor key mode set on the directional keys. It also sets up other rsx'y things for the keyboad input channel. This routine must be called at the begining of a program, that used the application keypad. BUGS: AUTHOR: Machiavelli Systems Page 44 zbegin Set Up the Vt100 Before Use 43.0 Close Data Dictionary _____ ____ __________ ******** * zdci * ******** NAME: zdci -- Close Data Dictionary SYNOPSIS: int zdci(ioptr) FILE *ioptr; /* pointer to file descriptor to close */ DESCRIPTION: zdci() closes the data dictionary file pointed to by ioptr. If an error occurs in closing the file, an error message is printed. BUGS: Like a lot of other DLOW routines, this one is the same as a library function. fclose(). AUTHOR: Machiavelli Systems Page 45 zdci Close Data Dictionary 44.0 Clear Section Of Display _____ _______ __ _______ ********** * zdispc * ********** NAME: zdispc -- Clear Section Of Display SYNOPSIS: int zdispclear(height,width,rowoff,coloff) int height; /* number of lines to clear */ int width; /* display width (columns) [not implimented] */ int rowoff; /* line to start clearing from */ int coloff; /* column to start clearing from [not implimented] */ DESCRIPTION: zdispclear() clears height lines on the screen starting from rowoff. BUGS: AUTHOR: Machiavelli Systems Page 46 zdispc Clear Section Of Display 45.0 Open a data dict. File for Read ____ _ ____ _____ ____ ___ ____ ******** * zdoi * ******** NAME: zdoi -- Open a data dict. File for Read SYNOPSIS: FILEP zdoi(name) char *name; /* name of file to open */ DESCRIPTION: zdoi() opens a file, using the standard open, for read. zdoi() returns a FILE *. displays an error if file can't be opened. BUGS: why not use fopen(name,"r") instead AUTHOR: Machiavelli Systems Page 47 zdoi Open a data dict. File for Read 46.0 Set Numeric Keypad Mode ___ _______ ______ ____ ******** * zend * ******** NAME: zend -- Set Numeric Keypad Mode SYNOPSIS: int zend() DESCRIPTION: zend() sets the ti:, assuming it's a VT100 back into numeric keypad mode, and resets the cursor key mode. BUGS: AUTHOR: Machiavelli Systems Page 48 zend Set Numeric Keypad Mode 47.0 Display On Error Line _______ __ _____ ____ ********** * zerror * ********** NAME: zerror -- Display On Error Line SYNOPSIS: int zerror(s) char *s; /* pointer to message to be displayed */ DESCRIPTION: zerror() Displays an error message on the error line of the screen, after, first clearing that line. BUGS: AUTHOR: Machiavelli Systems Page 49 zerror Display On Error Line 48.0 Read a Line from a File ____ _ ____ ____ _ ____ ********** * zgetli * ********** NAME: zgetli -- Read a Line from a File SYNOPSIS: int zgetline(ioptr,buffer,buflen) FILE *ioptr; /* pointer to file discriptor block */ char *buffer; /* pointer to destination buffer */ unsigned buflen; /* maximum bytes to read into the buffer */ DESCRIPTION: zgetline() gets a line of input from the specified file, leaving no '\n' at the end of the line. zgetline() returns byte position in file, or -1 on error. BUGS: How about fgetss() ? AUTHOR: Machiavelli Systems Page 50 zgetli Read a Line from a File 49.0 Get Fixed Length Record ___ _____ ______ ______ ********** * zinrec * ********** NAME: zinrec -- Get Fixed Length Record SYNOPSIS: int zinrec(fptr,recnum,buf) FILE *fptr; /* pointer to file descriptor */ long recnum; /* record number to be got */ char *buf; /* where record is to be put */ DESCRIPTION: zinrec() gets the specified record from the specified file into a buffer. The number of bytes read in is equil to the file's record size, this means that exactly 1 record is read in. Returns 0 for success, or $$ferr on error. BUGS: AUTHOR: Machiavelli Systems Page 51 zinrec Get Fixed Length Record 50.0 Clear All Specified Line _____ ___ _________ ____ ********** * zsline * ********** NAME: zsline -- Clear All Specified Line SYNOPSIS: int zslineclear(row) int row; /* line to clear */ DESCRIPTION: zslineclear() clears all of the specified line on the screen. BUGS: AUTHOR: Machiavelli Systems Page 52 zsline Clear All Specified Line 51.0 Allocate Memory or Bust ________ ______ __ ____ ********** * zmallo * ********** NAME: zmallo -- Allocate Memory or Bust SYNOPSIS: int zmalloc(size) unsigned size; /* number of byte to allocate */ DESCRIPTION: zmalloc() allocates size bytes, and returns a pointer to the area allocated. If it can't allocate size bytes, an error message is displayed, and program execution is terminated. BUGS: AUTHOR: Machiavelli Systems Page 53 zmallo Allocate Memory or Bust 52.0 Free up Allocated Memory ____ __ _________ ______ ********** * zmfree * ********** NAME: zmfree -- Free up Allocated Memory SYNOPSIS: int zmfree(addr) int *addr; DESCRIPTION: zmfree() goes out, checks the memory you wish to free, if it's bad, an error message is displayed, and program executoion is aborted. If the memory specified is valid, then that memory is free'd. BUGS: AUTHOR: Machiavelli Systems Page 54 zmfree Free up Allocated Memory 53.0 Display on Mode Line _______ __ ____ ____ ********* * zmode * ********* NAME: zmode -- Display on Mode Line SYNOPSIS: int zmode(s) char *s /* string to be displayed */ DESCRIPTION: zmode() displays a string on the mode line, at the right side of the screen, after clearing it. BUGS: AUTHOR: Machiavelli Systems Page 55 zmode Display on Mode Line 54.0 Display on Mode+1 _______ __ ______ ********** * zmode1 * ********** NAME: zmode1 -- Display on Mode+1 SYNOPSIS: int zmode1(s) char *s; /* string to be displayed */ DESCRIPTION: zmode1() displays a string on the line after the mode line, at the right side of the screen after clearing that line. BUGS: AUTHOR: Machiavelli Systems Page 56 zmode1 Display on Mode+1 55.0 Get uncommented line from file ___ ___________ ____ ____ ____ ********** * znextl * ********** NAME: znextl -- Get uncommented line from file SYNOPSIS: int znextline(fil,inbuf,len) FILEP fil; /* pointer to the file structure */ char *inbuf /* pointer to the destination buffer */ int len; /* maximum bytes to be read */ DESCRIPTION: znextline() gets a line from the specified input file, skips white spaces, and checks for COMMENT_CHAR. If COMMENT_CHAR is the first non-white on the line, a new line is input, and the same done. If an error occurs in reading the file, then ERROR is returned. BUGS: AUTHOR: Machiavelli Systems Page 57 znextl Get uncommented line from file 56.0 Display a No Memory Panic Message _______ _ __ ______ _____ _______ ********** * znomem * ********** NAME: znomem -- Display a No Memory Panic Message SYNOPSIS: int znomem() DESCRIPTION: znomem() displays "no memory - call a programmer - +61(9)322-2777", and aborts program execution. BUGS: A waste of a routine... Just call error(). AUTHOR: Machiavelli Systems Page 58 znomem Display a No Memory Panic Message 57.0 Open Any Type Of File Any Mode ____ ___ ____ __ ____ ___ ____ ********* * zopen * ********* NAME: zopen -- Open Any Type Of File Any Mode SYNOPSIS: FILE *zopen(fname,mode,recsiz,err) char *fname; /* name of file to be opened */ char *mode; /* open mode of the file (as above) */ int recsiz; /* record size of the file (as above) */ char *err; /* optional error code string */ DESCRIPTION: char *fname : file name of file to be opened char *mode : open mode for file. Values are: "a" - append [ File is opened for r/w , the record pointer is initialy set to the end of the file. The record size, file format, and if the file exists, is checked. If the file does not exist, then an error code is returned to that effect. ] "r" - read [ File is opened for r/w , the record pointer is initialy set to the begining of the file. The record size, file format, and if the file exists, is checked. If the file does not exist, then an error code is returned to that effect. ] "w" - write [ File is created, the record pointer is initialy set to the begining of the file, and the file header is set up according to the mode of access (see recsiz). If the file already exists, or the file can't be created, an error occurs. ] "t" - trap [ Error Trapping is enabled. This means that on an error, an error code is returned in err, rather than the routine taking things into it's own hands. ] "f" - force [ Force a new version of the file. This means that the open creates a new version of the file, wether or not and old version exists. ] Page 59 zopen Open Any Type Of File Any Mode int recsiz : The record size, in bytes. 0 specifies a stream record. char *err : Optional pointer to string, which the routine returns an error code into, if the trap is specified. Error values are : "n" - File does not exist, or is zero-length. Occurs only on "r" or "a" modes. File is opened in the "w" mode. "l" - File opened, has different record length, than the specified record length. Occurs only on "r" or "a" modes. File is opened, and the reclen of the file is not changed. The file record lengh is returned after the "l". "a" - Bad file attributes, for that mode, ie file opened for fixed length, is steam, or visa versa Occurs only on "r" or "a" modes. File is opened, and the file attributes are not altered. "e" - File already exists. The file to be created, already exists. The file will be opened in the "r" mode. Occurs only on "w" mode. "c" - Conflicting modes. More than one open mode is specified, in the mode string. "r" "w" "a" can't be specified together. If this error occurs, the the file is not opened. "b" - Blank file name. File is not opened. "m" - No open mode was specified in the mode string. Either "r" "w" or "a" has to be specified. "f" - A force mode was specified, without a Write mode. A new version cannot be created, if you are reading, or appending. "s" - System opening error. File could'nt be opened for some reason besides the above. The error can be found in $$ferr. BUGS: AUTHOR: Machiavelli Systems Page 60 zopen Open Any Type Of File Any Mode 58.0 Write a Fixed Length Record _____ _ _____ ______ ______ ********** * zoutre * ********** NAME: zoutre -- Write a Fixed Length Record SYNOPSIS: int zoutrec(fptr,recnum,buf) FILE *fptr; /* file to be written to */ long recnum; /* the record number to put */ char *buf; /* where to get the data from */ DESCRIPTION: zinrec() puts a buffer into the specified record in the specified file. The number of bytes written is equil to the file's record size, this means that exactly 1 record is written. Returns 0 on success, or $$ferr on error. BUGS: AUTHOR: Machiavelli Systems Page 61 zoutre Write a Fixed Length Record 59.0 Close Report Specs. File _____ ______ ______ ____ ******** * zrci * ******** NAME: zrci -- Close Report Specs. File SYNOPSIS: int zrci(ioptr) FILEP ioptr; /* file structure pointer of file to close */ DESCRIPTION: zrci() closes a report specs. file, and displays an error if file is not able to be closed. BUGS: Why not use fclose(ioptr). AUTHOR: Machiavelli Systems Page 62 zrci Close Report Specs. File 60.0 Open a Report Specs. File ____ _ ______ ______ ____ ******** * zroi * ******** NAME: zroi -- Open a Report Specs. File SYNOPSIS: int zroi(name) char *name; DESCRIPTION: zroi() opens a report specs. file for random input. If the file can't be opened, then an error message is printed. BUGS: It only calls zdoi(). This routine exists only so that a different name can be used. It is a waste of room. Why no use fopen(name,"r") AUTHOR: Machiavelli Systems Page 63 zroi Open a Report Specs. File 61.0 Dummy Screen Close Routine _____ ______ _____ _______ ******* * zsc * ******* NAME: zsc -- Dummy Screen Close Routine SYNOPSIS: int zsc() DESCRIPTION: zsc() is a dummy screen close routine, for people who wish to close their ti:. It does absolutly NOTHING !!! BUGS: AUTHOR: Machiavelli Systems Page 64 zsc Dummy Screen Close Routine 62.0 Clear Screen Leave Cursor _____ ______ _____ ______ ********** * zsclea * ********** NAME: zsclea -- Clear Screen Leave Cursor SYNOPSIS: int zsclear() DESCRIPTION: zsclear() clears the whole screen, leaving the cursor in it's current position. BUGS: AUTHOR: Machiavelli Systems Page 65 zsclea Clear Screen Leave Cursor 63.0 Clear Glass and Display Title _____ _____ ___ _______ _____ ********** * zscrcl * ********** NAME: zscrcl -- Clear Glass and Display Title SYNOPSIS: int zscrclear(title) char *title; DESCRIPTION: zscrclear() clears the glass, dispays "Co-Ordinate transform Utility" in the top left corner, and displays title in the top right corner. BUGS: AUTHOR: Machiavelli Systems Page 66 zscrcl Clear Glass and Display Title 64.0 Move Record Pointer ____ ______ _______ ********* * zseek * ********* NAME: zseek -- Move Record Pointer SYNOPSIS: int zseek(fp,byte) FILE *fp; unsigned byte; DESCRIPTION: zseek() positions the file's record pointer to a specified position in the file. If the seek failed, then an error message is displayed. For more information look a fseek() in wizard.doc (large manual). BUGS: Another case where a library function only needs casting. zseek(fp,byte) := fseek(fp,(long)byte,0) AUTHOR: Machiavelli Systems Page 67 zseek Move Record Pointer 65.0 Turn On Highlite Attribute ____ __ ________ _________ ********** * zshili * ********** NAME: zshili -- Turn On Highlite Attribute SYNOPSIS: int zshilite() DESCRIPTION: zshilite() turns on the highlite attribute on the ti:, assuming that the ti: is a VT100. BUGS: AUTHOR: Machiavelli Systems Page 68 zshili Turn On Highlite Attribute 66.0 Turn Off Highlite Attribute ____ ___ ________ _________ ********** * zslowl * ********** NAME: zslowl -- Turn Off Highlite Attribute SYNOPSIS: int zslolite() DESCRIPTION: zslolite() turns off the highlite attribute on the ti:, assuming that the ti: is a VT100. BUGS: AUTHOR: Machiavelli Systems Page 69 zslowl Turn Off Highlite Attribute 67.0 Get A Group Fron ti ___ _ _____ ____ __ ********** * zsnatc * ********** NAME: zsnatc -- Get A Group Fron ti SYNOPSIS: int zsnatch() DESCRIPTION: zsnatch() gets a character from the keyboard, and if it's a special sequence, it is converted into a negative value, for distinction. Conversions: up arrow -7 down arrow -9 right arrow -2 left arrow -1 0 -12 1 -10 2 -42 3 -42 4 -8 5 -13 6 -14 7 -11 8 -42 9 -42 - -15 , -16 . -42 enter -6 pf1 -21 pf2 -22 pf3 -23 pf4 -24 bad 'O' sequ. -127 bad esc sequ. -126 esc/esc -5 BUGS: AUTHOR: Machiavelli Systems Page 70 zsnatc Get A Group Fron ti 68.0 Open a Slab File ____ _ ____ ____ ******** * zsoi * ******** NAME: zsoi -- Open a Slab File SYNOPSIS: int zsoi(name) char *name; /* name of file to be opened */ DESCRIPTION: zsoi() openes a slab file for random access read. zsoi() returns FILE *, or 0 if file unable to be opened. BUGS: Why not use fopen(name,"r"). Very similar to zdoi. AUTHOR: Machiavelli Systems Page 71 zsoi Open a Slab File 69.0 Put a Character On the Terminal ___ _ _________ __ ___ ________ ********** * zsputc * ********** NAME: zsputc -- Put a Character On the Terminal SYNOPSIS: int zsputchar(c) char c; /* the character to be put on the screen */ DESCRIPTION: zsputchar() places a character, c, on the screen at the current cursor position. BUGS: All this does is to call _sputchar(). This function should not exist. AUTHOR: Machiavelli Systems Page 72 zsputc Put a Character On the Terminal 70.0 Put a String to the Console ___ _ ______ __ ___ _______ ********** * zsputs * ********** NAME: zsputs -- Put a String to the Console SYNOPSIS: int zsputs(s) char *s; DESCRIPTION: zsputs() places a string on the screen at the current cursor position. Any newline, is converted into a carrage return. BUGS: AUTHOR: Machiavelli Systems Page 73 zsputs Put a String to the Console 71.0 Position The Cursor on a VT100 ________ ___ ______ __ _ _____ ********** * zsrowc * ********** NAME: zsrowc -- Position The Cursor on a VT100 SYNOPSIS: int zsrowcol(row,col) int row; /* row to put it in */ int col; /* column to put it in */ DESCRIPTION: zsrowcol() places the cursor, on a VT100, at row, col on the screen. BUGS: AUTHOR: Machiavelli Systems Page 74 zsrowc Position The Cursor on a VT100 72.0 Set Up Escape seq. and Keypad ___ __ ______ ____ ___ ______ ********** * z1b4sn * ********** NAME: z1b4sn -- Set Up Escape seq. and Keypad SYNOPSIS: int z1b4snatch() DESCRIPTION: z1b4snatch() assigns a lun to ti:, sets up escape sequence recognition in the terminal driver, turns on the alternate keypad on ti: ,providing the terminal is a vt100, and puts the cursor keys into alternate cursor key mode. BUGS: AUTHOR: Machiavelli Systems Page 75 z1b4sn Set Up Escape seq. and Keypad 73.0 Get One Character From Ti ___ ___ _________ ____ __ ********** * z1snat * ********** NAME: z1snat -- Get One Character From Ti SYNOPSIS: char z1snatch() DESCRIPTION: z1snatch() does a qiow to the terminal driver to get one character from ti:. If an error occurs executing the qiow, an error message is displayed, and program execution is halted. A char type is returned. If the user hit's a '\3' (^C), and zsnatch() get's it, an error message will be displayed, and program execution will stop. BUGS: AUTHOR: Machiavelli Systems APPENDIX A MVGALL INDEX The following is a keyword in context index to the MVG routines The entry in the left-hand column is the title of the routine in the mvgall documentation ranacc the File as random access define frput random acess Put _mchec check Memory address getnex Get next data item after white space zsline Clear all specified line zmallo allocate Memory or bust allstr allocate a Copy of a string zmfree free up Allocated memory getalp get current Alpha field skpalf Skip over alpha zopen open any type of File ranacc define the File as random access zslowl turn off Highlite attribute zshili turn on Highlite attribute zbeep Beep the terminal zbegin Set up the vt100 before use isblan Test for a blank character block block i/o fieldp Format Data Into Buffer scrape Skip nonwhite in buffer getlit get Literal from buffer glide skip Whitespace in buffer skipne next Data item to buffer transfer edtbuf Edit a buffer on screen zmallo allocate Memory or bust _utell get byte posn. in File fsize get file Size in bytes wait4r wait for a Carriage return upstr convert String to upper case get1 get a sanitary Character input isblan Test for a blank character z1snat Get one character from ti zsputc Put a character on the terminal _sputc Put a character to the terminal getgro get a Group of characters MVG Utilities routines Page A-2 MVG index _mchec check Memory address zsline Clear all specified line zscrcl title Clear glass and display zsclea Clear screen leave cursor zdispc Clear section of display zdci Close data dictionary zsc dummy screen Close routine zrci close report specs. File aggreg multiple String concatenation zsputs Put a string to the console upstr case convert String to upper allstr allocate a Copy of a string getalp get current Alpha field zsrowc position the Cursor on a vt100 zsclea Clear screen leave cursor fieldp Format Data Into Buffer skipne transfer next Data item to buffer zdoi open a data dict. File for read zdci Close data dictionary getnex Get next data item after white space ranacc access define the File as random zdoi open a data dict. File for read zdci Close data dictionary udn Skip over digits zerror Display on error line zmode Display on mode line zmode1 Display on mode+1 zdispc Clear section of display znomem message display a no Memory panic zscrcl Clear glass and display title zsc dummy screen Close routine edtbuf Edit a buffer on screen getbuf get fresh Edited keyboard input issame String equality test zerror Display on error line z1b4sn Set up escape seq. and keypad getalp get current Alpha field zrci close report specs. File _utell get byte posn. in File zroi open a report specs. File zsoi open a slab File zopen open any type of File zgetli read a line from a File ranacc define the File as random access zdoi open a data dict. File for read fopenx open a Fixed File for update znextl uncommented line from file Get fopenc Open new fixed file recsiz set file Record size fsize get file Size in bytes pos16 get first Occurance in words fopenx open a Fixed File for update zoutre Write a Fixed Length Record MVG Utilities routines Page A-3 MVG index zinrec get Fixed length record fopenc Open new fixed file frget fixed length Get fieldp Format Data Into Buffer zmfree free up Allocated memory getbuf get fresh Edited keyboard input frget fixed length Get zsnatc Get a group from ti getnum Get a number from screen getnex white space Get next data item after z1snat Get one character from ti getqte Get quoted text znextl file Get uncommented line from zinrec get Fixed length record getlit get Literal from buffer getqli get Quoted literal getgro get a Group of characters get1 input get a sanitary Character _utell get byte posn. in File getalp get current Alpha field fsize get file Size in bytes pos16 words get first Occurance in getbuf input get fresh Edited keyboard zscrcl Clear glass and display title getgro get a Group of characters zsnatc Get a group from ti zslowl turn off Highlite attribute zshili turn on Highlite attribute block block i/o get1 get a sanitary Character input getbuf fresh Edited keyboard input get fieldp Format Data Into Buffer getnex Get next data item after white space skipne transfer next Data item to buffer getbuf get fresh Edited keyboard input z1b4sn Set up escape seq. and keypad zend Set numeric keypad mode zsclea Clear screen leave cursor zoutre Write a Fixed Length Record frget fixed length Get zinrec get Fixed length record zsline Clear all specified line zerror Display on error line zmode Display on mode line zgetli read a line from a File znextl Get uncommented line from file getlit get Literal from buffer getqli get Quoted literal _mchec check Memory address zmallo allocate Memory or bust znomem display a no Memory panic message zmfree free up Allocated memory znomem a no Memory panic message display MVG Utilities routines Page A-4 MVG index zend Set numeric keypad mode zmode Display on mode line zmode1 Display on mode+1 zseek move Record pointer skip move past next Whitespace aggreg concatenation multiple String fopenc Open new fixed file skipne transfer next Data item to buffer skip move past next Whitespace walk walk over next Whitespace getnex space Get next data item after white znomem display a no Memory panic message scrape Skip nonwhite in buffer recnum set Record number getnum Get a number from screen zend Set numeric keypad mode pos16 get first Occurance in words zslowl turn off Highlite attribute z1snat Get one character from ti fopenc Open new fixed file fopenx update open a Fixed File for zdoi read open a data dict. File for zroi open a report specs. File zsoi open a slab File zopen open any type of File zmallo allocate Memory or bust skpalf Skip over alpha udn Skip over digits walk walk over next Whitespace znomem display a no Memory panic message skip move past next Whitespace zseek move Record pointer zsrowc vt100 position the Cursor on a _utell get byte posn. in File frput random acess Put zsputc terminal Put a character on the _sputc terminal Put a character to the zsputs Put a string to the console getqli get Quoted literal getqte Get quoted text ranacc define the File as random access frput random acess Put zdoi a data dict. File for read open zgetli read a line from a File zoutre Write a Fixed Length Record recnum set Record number zseek move Record pointer recsiz set file Record size zinrec get Fixed length record squeez remove white from String zrci close report specs. File zroi open a report specs. File wait4r wait for a Carriage return MVG Utilities routines Page A-5 MVG index zsc dummy screen Close routine get1 get a sanitary Character input edtbuf Edit a buffer on screen getnum Get a number from screen zsc dummy screen Close routine zsclea Clear screen leave cursor zdispc Clear section of display z1b4sn Set up escape seq. and keypad zend Set numeric keypad mode z1b4sn keypad Set up escape seq. and zbegin Set up the vt100 before use recnum set Record number recsiz set file Record size fsize get file Size in bytes recsiz set file Record size scrape Skip nonwhite in buffer skpalf Skip over alpha udn Skip over digits glide skip Whitespace in buffer zsoi open a slab File getnex data item after white space Get next zsline Clear all specified line zrci close report specs. File zroi open a report specs. File squeez remove white from String aggreg multiple String concatenation issame String equality test upstr convert String to upper case allstr allocate a Copy of a string zsputs Put a string to the console zbeep Beep the terminal zsputc Put a character on the terminal _sputc Put a character to the terminal isblan Test for a blank character iswhit Test for whitespace issame String equality test getqte Get quoted text zsnatc Get a group from ti z1snat Get one character from ti zscrcl Clear glass and display title skipne buffer transfer next Data item to zslowl turn off Highlite attribute zshili turn on Highlite attribute zopen open any type of File znextl Get uncommented line from file zmfree free up Allocated memory z1b4sn Set up escape seq. and keypad zbegin Set up the vt100 before use fopenx open a Fixed File for update upstr convert String to upper case zbegin Set up the vt100 before use zsrowc position the Cursor on a vt100 zbegin Set up the vt100 before use MVG Utilities routines Page A-6 MVG index wait4r wait for a Carriage return walk walk over next Whitespace squeez remove white from String getnex Get next data item after white space skip move past next Whitespace walk walk over next Whitespace glide skip Whitespace in buffer iswhit Test for whitespace pos16 get first Occurance in words zoutre Write a Fixed Length Record