home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / JSAGE / ZSUS / PROGPACK / SCZ01BET.LBR / -CLIB01.ZZZ / -CLIB01.
Text File  |  1989-05-24  |  15KB  |  536 lines

  1. SmallC/Z  05/08/89
  2.  
  3. This is a list of modules and routine names in CLIB. Short documentation on 
  4. function and calling arguments for some is included. Descriptions of the
  5. more standard C functions and many very low level internal routines are for
  6. the time being omitted. Hopefully, as time allows, they can be added. Most
  7. or all significantly new or different code has associated descriptions.
  8.  
  9. While this may not be the most convenient possible format (as opposed to by
  10. alphabetical order or by functionality) of documentation, it was easier for
  11. me to construct and keep track of, and offers the other advantage that you
  12. can easily tell which routines are grouped in which modules. This way, you'll
  13. know, when you use a function which ones you get "free", i.e. without increase
  14. in program size.
  15.  
  16. Note that routine names that begin with "U" are in almost all cases runtime
  17. system routines, typically intended for calls from assembler.
  18.  
  19. The phrase "Intended for calls from assembler" mainly means that arguments are
  20. being passed in registers, rather than on the stack. The phrase "Intended for
  21. calls from C" means the reverse, and certainly doesn't preclude calls from
  22. assembler. There are sometimes alternate entry points into routines.
  23.  
  24. The full names are given. If you're using M80/L80 format (as opposed to SLR), 
  25. bear in mind that extrnals and entries are truncated to six characters.
  26.  
  27. Last checked against SLRLIB module map: 04/30/89.
  28.  
  29. copyright (c) Al Grabauskas, 1989
  30.  
  31. -------------------------------------------------------------------------------
  32.  
  33. UENTRY
  34.     -------    UENTRY
  35.  
  36.     Uentry
  37.     saves the o/s value of HL and the return to o/s pointer, then walks
  38.     through entry vector Uinvec, emulating calls to those routines.
  39.     entered through initial jump in assembler configuration header.
  40.  
  41.     -------    UNULRTN
  42.  
  43.     Unultrn
  44.     null routine (a single "ret" assembler instruction). Used to disable
  45.     pointer based routines in entry and exit vectors like user exit traps.
  46.  
  47.     -------    URETCPM
  48.  
  49.     Uretcpm
  50.     routine to return to the o/s without a warmboot, using the return to
  51.     o/s pointer saved by Uentry (above).
  52.     entered through Usysret pointer in the exit vector if setwbt() has
  53.     not been executed to set warm boot on.
  54.  
  55. UEXCD
  56.     -------    UEXCD
  57.  
  58.     Uexcd
  59.     vanilla cp/m exit code interpreter. calls standard runtime exit code
  60.     message function sysexcod(), then then returns.
  61.     Called by exit() as it walks the exit vector through Usetecd pointer.
  62.  
  63. SYSEXCOD
  64.     -------    SYSEXCOD
  65.  
  66.     sysexcod()
  67.     runtime system exit code interpreter. sends a message to the console
  68.     if the code passed to exit() was a runtime function termination code
  69.     as defined in sysexits.h #include file. 
  70.     Called by Uexcd routine (from both CLIB and CZVLIB).
  71.  
  72. USYSINIT
  73.     -------    USYSINIT
  74.  
  75.     Usysinit
  76.     initializes the cp/m environment in a SmallC/Z program.
  77.     Primarily a null routine.
  78.     Called by Uentry as it walks the initilization vector.
  79.  
  80.  
  81. CSYSLIB
  82.     -------    UADVANCE
  83.     -------    UCLREOF
  84.     -------    UCONIN
  85.     -------    UCONOUT
  86.     -------    UDEFUSER
  87.     -------    UDIRTST
  88.     -------    UFBDOS
  89.     -------    UFIELD
  90.     -------    UGETSEC
  91.     -------    UIOEXIT
  92.     -------    ULOADFN
  93.     -------    UMAIN
  94.     -------    UMODE
  95.     -------    UNEWFCB
  96.     -------    UNEXTC
  97.     -------    UOPEN
  98.     -------    UPARSE
  99.     -------    UPUTSEC
  100.     -------    UREAD
  101.     -------    UREDIREC
  102.     -------    USECTOR
  103.     -------    USETEOF
  104.     -------    USETERR
  105.     -------    USTATUS
  106.     -------    UWRITE
  107.  
  108.     Description of this module as a whole:
  109.  
  110.     This module contains the basic runtime support code for SmallC/Z.
  111.  
  112.     Note:    it would be good to segregate the i/o primitives here into
  113.         separate module for purposes of making them independent of
  114.         the rest of the runtime code.
  115.  
  116.         also need a list of the primitive names used by the runtime,
  117.         so that a replacement i/o package would be able to satisfy
  118.         the needs of the runtime.
  119.  
  120. SETXTRAP
  121.     -------    SETXTRAP
  122.  
  123.     setxtrap(ptr) int *ptr;
  124.     sets the user exit trap vector Uextrap to point at routine specified
  125.     by ptr (pointer to function, actually). If ptr is NULL, sets user
  126.     exit trap vector to point at Unulrtn.
  127.     Intended for calls from C.
  128.     No meaningful return value.
  129.  
  130. SETWBT
  131.     -------    SETWBT
  132.  
  133.     setwbt()
  134.     sets return to o/s exit vector Usysret to 0, effectively causing
  135.     a warm boot to take place at program termination.
  136.     Intended for calls from C.
  137.     No meaningful return value.
  138.  
  139. AUXBUF
  140.     -------    AUXBUF
  141.     -------    UXFLUSH
  142.     -------    UXINIT
  143.     -------    UXREAD
  144.     -------    UXWRITE
  145. BDOS
  146.     -------    BDOS
  147.  
  148.     bdos(funct,arg)
  149.     corresponds to bdos((bc),(de)) int funct, arg;
  150.     BOTH ARGUMENTS MUST BE SPECIFIED.
  151.     Intended for calls from C.
  152.     BDOS errors are returned as -1.
  153.  
  154. BIOS
  155.     -------    BIOS
  156.  
  157.     bios(funct,arg1,arg2)
  158.     corresponds to bios(func,(bc),(de)) int funct, arg1, arg2;
  159.     ALL 3 ARGUMENTS MUST BE SPECIFIED, even tho the last is used only
  160.     by SELDSK and SECTRAN.
  161.     Intended for calls from C.
  162.     BIOS return value.
  163.  
  164. PUTS
  165.     -------    PUTS
  166. FGETS
  167.     -------    FGETS
  168.     -------    GETS
  169.     -------    UGETS
  170. FPRINTF
  171.     -------    FPRINTF
  172.     -------    PRINTF
  173.     -------    UGETS
  174. FPUTS
  175.     -------    FPUTS
  176. PUTCHAR
  177.     -------    PUTCHAR
  178. FPUTC
  179.     -------    FPUTC
  180.     -------    PUTC
  181. FREAD
  182.     -------    FREAD
  183.     -------    READ
  184. FREOPEN
  185.     -------    FREOPEN
  186. FSCANF
  187.     -------    FSCANF
  188.     -------    SCANF
  189.     -------    USCAN
  190. FWRITE
  191.     -------    FWRITE
  192.     -------    WRITE
  193. GETCHAR
  194.     -------    GETCHAR
  195. PAD
  196.     -------    PAD
  197.     -------    STRINIT
  198. POLL
  199.     -------    POLL
  200. RENAME
  201.     -------    RENAME
  202. REWIND
  203.     -------    REWIND
  204. ABS
  205.     -------    ABS
  206. ATOI
  207.     -------    ATOI
  208. ATOIB
  209.     -------    ATOIB
  210. MRELEASE
  211.     -------    MRELEASE
  212.  
  213.     mrelease(bp,x,f) int *bp, *x, f;
  214.     releases core that would normally not be considered for dynamic
  215.     allocation purposes to the free chain. you can use it to release
  216.     the ccp or parts of a program used only once to the dynamic
  217.     allocation kernel routines. you MUST be using the newer and larger
  218.     memory routines (which are now defaulted in CLIB).
  219.     if you release all or part of the ccp, it is your responsibility
  220.     to use setwbt() (set warm boot on). if you omit this, unpredicatble 
  221.     things may occur on exit from your program.
  222.     you should NOT use this to free core that is or was already part
  223.     of the memory considered for dynamic allocation.
  224.     usage:    mrelease(bp,x,f);
  225.         where:    bp    is a pointer to base of memory to free.
  226.                 an integer size will be placed here, and
  227.                 the pointer bumped up by two. see ualcfre
  228.                 module for the reasoning.
  229.             x    either a size (integer), or a pointer
  230.                 to end of memory to free (byte past, not
  231.                 inclusive).
  232.             f    true if x is a size, false if a ptr.
  233.     No meaningful value returned.
  234.  
  235.  
  236. XALCFRE
  237.     -------    XAINIT
  238.     -------    XALLOC
  239.     -------    XFREE
  240.  
  241.     Description of module as a whole:
  242.  
  243.     Routines to allow using the low level allocation primitives
  244.     in the UALCFRE module to subdivide core within a block
  245.     allocated from global core. These routines allow you to
  246.     control memory fragmentation to any extent you desire, by 
  247.     letting you use the same memory allocation primitives used 
  248.     by the runtime within a block of core allocated to you. You 
  249.     can nest this type of usage to any depth you desire, can 
  250.     think of a reason for, and feel like keeping track of.
  251.     usage:    block=malloc(blksize);
  252.         xainit(block);
  253.         while (whatever) {
  254.             .
  255.             xaptr=xalloc(block,reqsize);
  256.             .
  257.             xfree(block,xaptr);
  258.             .
  259.         }
  260.     The global block can be freed to global memory at any time
  261.     using the standard free() function, but bear in mind that 
  262.     this will invalidate any pointers you have into it, since that
  263.     causes it to be considered for further malloc() and calloc()
  264.     requests.
  265.  
  266.     xainit(bp) int *bp;
  267.     Initializes a previously allocated block for "in-block" memory
  268.     management routines xfree() and xalloc(). This initialization
  269.     consists of setting up control information analogous to that
  270.     for global memory management in the block, so that xfree() and
  271.     xalloc() can then parcel out requests from within it. xainit()
  272.     leaves the first word in the block alone. This allows freeing
  273.     and reallocating (in certain ways), without trashing the in-block
  274.     memory status. The caller can use that word for chaining such
  275.     blocks, etc. It is left somewhat open.
  276.     Intended for calls from C.
  277.     returns HL=pointer passed to it (bp, above) if successful,
  278.         HL=0 otherwise (block too small for control info)
  279.  
  280.     xalloc(bp,size) int *bp, size;
  281.     Allocates "size" bytes from the globally allocated block pointed
  282.     to by bp. That block should already be initialized using xainit().
  283.     (under certain circumstances xalloc is smart enough to take care
  284.     of this itself, but you shouldn't depend on that).
  285.     Intended for calls from C.
  286.     returns HL=pointer to satisfied request if successful,
  287.         HL=0 otherwise
  288.  
  289.     xfree(bp,fp) int *bp, *fp;
  290.     Frees the memory pointed to by fp back into the block pointed to
  291.     by bp. That memory should have been allocated from that block to
  292.     begin with, or VERY unpredictable results can occur.
  293.     Intended for calls from C.
  294.     No meaningful return code.
  295.  
  296. UALCFRE
  297.     -------    UALLOC
  298.     -------    UFREE
  299.     -------    UMEMINIT
  300.  
  301.     Description of module as a whole:
  302.  
  303.     This module contains the primitive operations for the new SmallC/Z
  304.     memory management scheme. These routines are called by calloc(),
  305.     malloc(), and free(), as well as by the routines in the XALCFRE and
  306.     MRELEASE modules, and potentially other routines in the runtime
  307.     support code. These routines work very well, but what they are doing
  308.     is managing a fairly complex data structure which must not be
  309.     corrupted by code going out of the bounds of memory allocated to it.
  310.     With that caveat in mind, these routines (as opposed to the original 
  311.     Small-C memory management functions still available in the separate
  312.     module SMALLALC) provide the ability to build arbitrarily complex
  313.     data structures within the limitations of available memory with
  314.     relative ease.
  315.  
  316.     Ualloc(size,initflag) int size, initflag;
  317.     Allocates "size" bytes from memory pool described by global variables
  318.     as shown in diagram in other documentation. Allocates from the current
  319.     free memory chain in a best fit, closest to top of memory fashion.
  320.     Retains size word in the two bytes just preceeding the pointer
  321.     returned to the user for later use by Ufree(). Not corrupting the size
  322.     word is the responsibility of the programmer. Initializes allocated
  323.     node to zeroes if initflag is true.
  324.     Intended for calls from C.
  325.     returns HL=pointer to allocated memory if successful,
  326.         HL=0 otherwise
  327.  
  328.     Ufree(ptr) char ptr;
  329.     Frees block previously allcated using Ualloc() to current free memory 
  330.     chain, defragmenting as necessary. Obviously assumes a valid memory
  331.     management data structure (i.e., size word of node to free has not
  332.     been corrupted, no other parts of free chain have been corrupted, 
  333.     the memory to free is being put into the context it was taken from -
  334.     global or in-block, etc.)
  335.     Intended for calls from C.
  336.     No meaningful return code.
  337.  
  338.     Umeminit
  339.     Memory management initialization routine called from entry vector as
  340.     Uentry walks it. Takes the Umembot and Umemtop global variable values,
  341.     splits available memory in half, and places dynamic allocation heap
  342.     in top half, and runtime stack in bottom half.
  343.     Intended for call from entry vector only.
  344.  
  345. CALLOC
  346.     -------    CALLOC
  347. CLEARERR
  348.     -------    CLEARERR
  349. CSEEK
  350.     -------    CSEEK
  351. CTELL
  352.     -------    CTELLC
  353.     -------    CTELL
  354. DTOI
  355.     -------    DTOI
  356. EXIT
  357.     -------    ABORT
  358.     -------    EXABRT
  359.     -------    EXIT
  360.  
  361.     exabrt()
  362.     when called from a user exit trap, causes a clean abort of the exit
  363.     (i.e. the program continues from the point following its call to
  364.     exit()). Side effects of aborting various exits are the responsibility
  365.     of the programmer, since most code is **NOT** written expecting a
  366.     return from exit(). Be sure you know what you are doing when using
  367.     this facility. Likely DISASTROUS if called from any but an exit vector
  368.     based routine, since assumptions about the stack are made.
  369.     Intended for calls from C or assembler exit vector routines.
  370.     No meaningful return code.
  371.  
  372.     abort(code) char code;    /* alias for exit()    */
  373.     exit(code)  char code;    /* alias for abort()    */
  374.     stores value of code in global Uexcode, then proceeds to walk the
  375.     exit vector, emulating calls to its routines.
  376.     Intended for calls from C.
  377.     Not normally returned from, except by exabrt() in user exit trap.
  378.  
  379. FCLOSE
  380.     -------    FCLOSE
  381. FEOF
  382.     -------    FEOF
  383. FERROR
  384.     -------    FERROR
  385. FFLUSH
  386.     -------    FFLUSH
  387. FGETC
  388.     -------    FGETC
  389.     -------    GETC
  390. FOPEN
  391.     -------    FOPEN
  392. FREE
  393.     -------    CFREE
  394.     -------    FREE
  395. GETARG
  396.     -------    GETARG
  397. ISATTY
  398.     -------    ISATTY
  399. ISCONS
  400.     -------    INCONS
  401. ISFCNS
  402.     -------    ISALNUM
  403.     -------    ISALPHA
  404.     -------    ISASCII
  405.     -------    ISCNTRL
  406.     -------    ISDIGIT
  407.     -------    ISGRAPH
  408.     -------    ISLOWER
  409.     -------    ISPRINT
  410.     -------    ISPUNCT
  411.     -------    ISSPACE
  412.     -------    ISUPPER
  413.     -------    ISXDIGIT
  414. ITOA
  415.     -------    ITOA
  416. ITOAB
  417.     -------    ITOAB
  418. ITOD
  419.     -------    ITOD
  420. ITOO
  421.     -------    ITOO
  422. ITOU
  423.     -------    ITOU
  424. ITOX
  425.     -------    ITOX
  426. CMATCH
  427.     -------    CMATCH
  428.  
  429.     cmatch(s,ch,from)
  430.     find occurrence of a character in a string starting at offset "from".
  431.  
  432. LEFT
  433.     -------    LEFT
  434. LEXCMP
  435.     -------    LEXCMP
  436.     -------    LEXORDER
  437.     -------    ULEX
  438. MALLOC
  439.     -------    MALLOC
  440. OTOI
  441.     -------    OTOI
  442. REVERSE
  443.     -------    REVERSE
  444. SIGN
  445.     -------    SIGN
  446. STRCAT
  447.     -------    STRCAT
  448. STRCHR
  449.     -------    STRCHR
  450. STRCMP
  451.     -------    STRCMP
  452. STRCPY
  453.     -------    STRCPY
  454. STRLEN
  455.     -------    STRLEN
  456. STRNCAT
  457.     -------    STRNCAT
  458. STRNCMP
  459.     -------    STRNCMP
  460. STRNCPY
  461.     -------    STRNCPY
  462. STRRCHR
  463.     -------    STRRCHR
  464. TOASCII
  465.     -------    TOASCII
  466. TOLOWER
  467.     -------    TOLOWER
  468. TOUPPER
  469.     -------    TOUPPER
  470. UNGETC
  471.     -------    UNGETC
  472. UNLINK
  473.     -------    DELETE
  474.     -------    UNLINK
  475. UTOI
  476.     -------    UTOI
  477. XTOI
  478.     -------    XTOI
  479. CALL
  480.     -------    CCAND
  481.     -------    CCARGC
  482.     -------    CCASL
  483.     -------    CCASR
  484.     -------    CCCMP
  485.     -------    CCCOM
  486.     -------    CCDCAL
  487.     -------    CCDDGC
  488.     -------    CCDDGI
  489.     -------    CCDECC
  490.     -------    CCDECI
  491.     -------    CCDIV
  492.     -------    CCDSGC
  493.     -------    CCDSGI
  494.     -------    CCEQ
  495.     -------    CCGCHAR
  496.     -------    CCGE
  497.     -------    CCGINT
  498.     -------    CCGT
  499.     -------    CCINCC
  500.     -------    CCINCI
  501.     -------    CCLE
  502.     -------    CCLNEG
  503.     -------    CCLT
  504.     -------    CCMULT
  505.     -------    CCNEG
  506.     -------    CCNE
  507.     -------    CCOR
  508.     -------    CCPCHAR
  509.     -------    CCPDPC
  510.     -------    CCPDPI
  511.     -------    CCPINT
  512.     -------    CCSUB
  513.     -------    CCSWITCH
  514.     -------    CCSXT
  515.     -------    CCUCMP
  516.     -------    CCUGE
  517.     -------    CCUGT
  518.     -------    CCULE
  519.     -------    CCULT
  520.     -------    CCXOR
  521.     -------    CDPDPC
  522.     -------    CDPDPI
  523.  
  524.     Description of this module as a whole:
  525.  
  526.     This contains the internal arithmetic and logical routines - the
  527.     stuff that makes "if" expressions and operators operate. Called
  528.     by name by compiler generated in-line code.
  529.  
  530. UPGMEND
  531.     -------    UPGMEND * not a routine, but important enough to include
  532.             * SCZ CLIB version number follows pgm end eyecatcher
  533.             * db '>>>>SCZCLB0.1',0
  534.             * this is also default stack bottom
  535.  
  536.