home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 300-399 / ff384.lzh / NorthC / NorthC1.LZH / clibs / libc.doc < prev    next >
Text File  |  1990-09-04  |  29KB  |  1,255 lines

  1.  
  2.   NorthC Version 1.2  (c) 1990 S.Hawtin.
  3.  
  4.   Permission is granted to copy this file and libc.a provided that:
  5.    1) Neither are used for commercial gain
  6.    2) This notice is included in all copies
  7.    3) Altered copies are marked as such
  8.    4) All copies of libc.a are accompanied by copies of this file.
  9.  
  10.   No liability is accepted for the contents of these files.
  11.  
  12.   libc.doc    within        NorthC library
  13.  
  14.   This file outlines the functions available within the 'NorthC' standard 
  15. 'C' library.  In this file I have just listed the functions that exist in 
  16. the 'C' library, I felt that it would be a waste of time to explain them 
  17. all in detail, there are a lot of books on 'C' that do that better than I 
  18. could.
  19.  
  20.   This file is split into three sections, firstly the NorthC specific 
  21. functions, next some general functions that are not part of ANSI and 
  22. finally the standard ANSI 'C' functions.  The only functions in the 
  23. library that are not described in this document are the AmigaDOS functions 
  24. that are supported, these are listed in the file "AmigaDOS.doc" within 
  25. this directory.
  26.  
  27.   The NorthC specific extensions are described in full, or at least as 
  28. close to full as you will find anywhere.
  29.  
  30.   The extra functions are outlined, they are mostly fairly obvious 
  31. extensions of the standard functions.
  32.  
  33.   A complete description of the ANSI C specifics can be obtained from any 
  34. book on ANSI C.  I have used the descriptions in the 1989 edition of 
  35. "Standard C" by Plauger & Brodie, published by Microsoft Press, "The Waite 
  36. Group's Essential Guide to ANSI C" by Naba Barkakati is another book that 
  37. describes all the ANSI functions quite well.  I have attempted to get as 
  38. close to the ANSI standard as possible and have tried to document all the 
  39. cases where the NorthC function deviates from the standard.
  40.  
  41.  
  42. NorthC Specifics
  43.  
  44.   When you create a program with NorthC it will automagically open the 
  45. 'dos.library', 'mathffp.library' and 'mathtrans.library'.  The 
  46. 'exec.library' is of course always open.  These libraries will be closed 
  47. for you when the program has completed.
  48.  
  49.   There are a number of other libraries within AmigaDOS 1.3 that you may 
  50. want to use, the stubs for most of these libraries are provided by the 
  51. NorthC 'C' library,
  52.  
  53.     Library                      Opened by
  54.     -------                      ---------
  55.     "diskfont.library"           OpenLibrary("diskfont.library",0L);
  56.     "dos.library"                - always open
  57.     "exec.library"               - always open
  58.     "expansion.library"          OpenLibrary("expansion.library",0L);
  59.     "graphics.library"           OpenLibrary("graphics.library",0L);
  60.     "icon.library"               OpenLibrary("icon.library",0L);
  61.     "intuition.library"          OpenLibrary("intuition.library",0L);
  62.     "layers.library"             OpenLibrary("layers.library",0L);
  63.     "mathffp.library"            - always open
  64.     "mathieeedoubbas.library"    - not supported
  65.     "mathieeedoubtrans.library"  - not supported
  66.     "mathtrans.library"          - always open
  67.     "translator.library"         OpenLibrary("translator.library",0L);
  68.  
  69. if you want to call any of the 'C' library routines within these libraries 
  70. you must ensure that it is open first.  It is important that you open the 
  71. library with a call to the routine OpenLibrary() from the NorthC 'C' 
  72. library otherwise the routines will not be able to find the library.  For 
  73. example
  74.  
  75.     extern long OpenLibrary();
  76.  
  77.     unsigned long icon_lib = 0;
  78.  
  79.     new_name(name)
  80.         char *name;
  81.        {char temp_name[32];
  82.         if (icon_lib==0)
  83.            {/* Call OpenLibrary(), 
  84.                NOTE second argument is 32 bits 0L not 0 */
  85.             icon_lib = OpenLibrary("icon.library",0L);
  86.             if(icon_lib==0)
  87.                {printf("Cannot open Icon.library\n");
  88.                 exit(10);
  89.                 }
  90.             }
  91.         BumpRevision(temp_name,name);
  92.         strcpy(name,temp_name);
  93.         }
  94.  
  95. by using the 'C' library OpenLibrary() call the library will be 
  96. automagically linked to the calling routines and closed when the program 
  97. calls exit(), or when the main() function returns.
  98.  
  99.  
  100. AMIGA NORTHC MC68000
  101.  
  102.   These three preprocessor symbols are set to 1 for each compilation.  Use 
  103. these in preprocessor statements to insert and remove sections of AMIGA or 
  104. NORTHC specific code.  See the documentation on setlocale() for an example 
  105. of how to use these symbols.
  106.  
  107.  
  108. char *chipcalloc(num_bytes,num)
  109.     int num_bytes;
  110.     int num;
  111.  
  112. char *chiprealloc(ptr,size)
  113.     char *ptr;
  114.     int  size;
  115.  
  116. char *chipmalloc(num_bytes)
  117.     int num_bytes;
  118.  
  119.   These three functions allocate space within the chip memory.  In NorthC 
  120. 1.2 there are three ways to ensure that you have "chip" memory, you can 
  121. allocate the space yourself with an AmigaDOS AllocMem() call, you can call 
  122. one of these three functions or you can call NorthC with the "-C" flag 
  123. set.  If you call AllocMem() you must ensure that the memory is freed 
  124. before you end the program, the 'C' library knows nothing about 
  125. AllocMem().  If you use the NorthC "-C" flag then all the static variables 
  126. within the file should be loaded into chip memory when you run the 
  127. program, I haven't fully tested this but it should work.
  128.  
  129.  
  130. char *_WBConsole
  131.  
  132.   This string describes the console the program should use when called 
  133. from the workbench, by default "con:20/20/400/100/NorthC Program", it is 
  134. specified by including a global variable declaration such as
  135.  
  136.     char *_WBConsole="newcon:0/0/640/200/My Prog";
  137.  
  138. in one of the source files of your program.  You could get by editing the 
  139. "defaults.c" program and adding the "defaults.o" file to your build.
  140.  
  141.  
  142. int _stdoutUnbuffered
  143.  
  144.   Most versions of 'C' buffer their output, that is when you call fputc() 
  145. the character doesn't get written to the file immediatly, the program 
  146. stores up the characters until it has a full line, then writes the whole 
  147. lot to the file in one go.  When you are dealing with files this is of 
  148. course the best thing to do, however 'C' also treats the standard output 
  149. as a file, if the standard output is buffered then you can get strange 
  150. effects for example
  151.  
  152.     printf("Type <Return>:");
  153.     getchar();
  154.  
  155. will not print the string "Type <Return>:" until you put an end of line in 
  156. the buffer.  You can get around this problem with the fflush() function, 
  157. but NorthC also allows the programmer to define an integer called 
  158. _stdoutUnbuffered if this is not zero then the "stdout" file will be 
  159. opened as an unbuffered file.  Again this is in the "defaults.c" file.
  160.  
  161.  
  162. debug()
  163.  
  164.   The NorthC 'C' library includes a function debug(), this allows computer 
  165. wizards to wander around the machine memory.  If the program executes a 
  166. call such as
  167.  
  168.     char *foo;
  169.     .
  170.     .
  171.     debug(foo);
  172.  
  173. then the routine will push the value foo on to the stack and print out 
  174. aline such as
  175.  
  176.       C00674:  80003132  ..12
  177.     NorthC:
  178.  
  179. this shows the address of the top of the stack, "C00674", and the contents 
  180. of the top of the stack in hexidecimal and ASCII.  The NorthC: prompt 
  181. shows that the routine is waiting for input, you can type the following characters
  182.  
  183.     Q   Quit the debugger and restart the program
  184.     X   eXit the debugger and exit() the program
  185.     R   Reset the address to its initial value at this level
  186.     <   Go up a level
  187.     >   Go down a level, make the contents of the current
  188.         location the address.  This will cause problems if
  189.         the current address contains an odd number.
  190.     +   Move the address on by 4, to next long word
  191.     -   Move the address back by 4
  192.     \   Move the address on by 2, to the next short word
  193.  
  194. if you type in a hexidecimal number it will be stored at the current 
  195. address.  If you want to examine a random address overwrite the top stack 
  196. element with the address you want to examine, then type '>'.  While using 
  197. debug() exercise extreme caution, it is easy to awaken the evil red guru.
  198.  
  199.  
  200. FOPEN_MODE  UNGET_TWICE  UNKNOWN_FILE  FILE_OFLOW  MALLOC_ZERO 
  201. NOT_YET_DONE  ASSERT_WRONG  FP_ERROR  WRITE_FAILED  SEEK_FAILED
  202.  
  203.   These are the error codes returned if the library is asked to do 
  204. something it doesn't like.  If your program dies with a message like 
  205. "Error: 1004" look in the ":include/errno.h" file to find out what it is 
  206. complaining about.
  207.  
  208.   If you want to do it properly the function strerror() will translate 
  209. this error code into a string describing the error.
  210.  
  211.  
  212. _cmndlen  _cmndstr  _stdin  _stdout  _fromWB  _WBmsg  _Task
  213.  
  214.   When your program first starts the "crt0.asm" routines are called, these 
  215. set up some global variables as follows
  216.  
  217.     _cmndlen   the value of D0 at startup
  218.     _cmndstr   the value of A0 at startup
  219.     _stdin     the input file handle
  220.     _stdout    the output file handle
  221.     _fromWB    set to 0 if called from CLI
  222.     _WBmsg     the startup workbench message
  223.     _Task      the processes task structure
  224.  
  225. the _main() function uses these values to set up the argv[] array, and the 
  226. stdin, stdout and stderr file structures.  If for some reason you want to 
  227. get at the original startup string, or if you need to know when you were 
  228. called from the WorkBench you can use these variables, however if you 
  229. change them then any nasty effects are your fault.
  230.  
  231.  
  232. Special functions
  233.  
  234.   The standard 'C' library includes a number of functions that are not 
  235. part of ANSI C but are obvious extensions of functions that are.  This 
  236. section gives details of these functions.  Some of these originally came 
  237. from the Sozobon 'C' library on "FISH 171".
  238.  
  239.  
  240. void _div(ret,numer,denom)
  241.     div_t *ret;
  242.     int   numer;
  243.     int   denom;
  244.  
  245.   This function computes the quotient and remainder of (numer/denom) and 
  246. places the result in the structure pointed to by ret.  This function 
  247. allows programs that depend on the ANSI div() function to be ported to 
  248. NorthC, examine the section on div() to see how to use this function.
  249.  
  250.  
  251. void _ldiv(ret,numer,denom)
  252.     ldiv_t *ret;
  253.     long  numer;
  254.     long  denom;
  255.  
  256.   This function computes the quotient and remainder of (numer/denom) and 
  257. places the result in the structure pointed to by ret.  This is the long 
  258. version of _div().
  259.  
  260.  
  261. char *_tmpnam(base,str)
  262.     char *base;
  263.     char *str;
  264.  
  265.   This function returns a temporary filename, just like tmpnam().  The 
  266. name is created by adding a decimal number to the "base" string, for example
  267.  
  268.     foo = _tmpnam("df1:temp",NULL);
  269.  
  270. will set "foo" to a name such as "df1:temp47".  The name is guaranteed not 
  271. to be the name of an existing file.  As a matter of interest the function 
  272. tmpnam() is defined as
  273.  
  274.     char *
  275.     tmpnam(str)
  276.         char *str;
  277.        {return(_tmpnam("T:TEMP",str));
  278.         }
  279.  
  280. to create a filename in the "t:" directory.
  281.  
  282.  
  283. long fsystem(cmnd,infp,outfp)
  284.     char *cmnd;
  285.     FILE *infp;
  286.     FILE *outfp;
  287.  
  288.   This function performs a system() call, however when the program is 
  289. called it uses the file "infp" as "stdin" and "outfp" as "stdout" and 
  290. "stderr".  Like the Execute() function this will cause problems if you 
  291. attach a full file to "infp".
  292.  
  293.   This function is a half-way house between system(), that just calls the 
  294. command, and Execute(), that needs the file handles.  The function acts 
  295. like Execute() with FILE pointers.  Whatever you do don't pass stdin as 
  296. the value of "infp".
  297.  
  298.  
  299. char *itoa(n, buffer, radix)
  300.     int n;
  301.     char *buffer;
  302.     int radix;
  303.  
  304.   Print a representation of the integer n into the buffer, the radix can 
  305. be any value from 2 to 16.
  306.  
  307.  
  308. char *ltoa(n, buffer, radix)
  309.     long n;
  310.     char *buffer;
  311.     int radix;
  312.  
  313.   Print a representation of the long n into the buffer, radix can be any 
  314. value between 2 and 16.
  315.  
  316.  
  317. char *strdup(str)
  318.     char *str;
  319.  
  320.   Make a copy of the string that can be manipulated.
  321.  
  322.  
  323. int stricmp(str1, str2)
  324.     char *str1, *str2;
  325.  
  326.   Case independent string compare routine.
  327.  
  328.  
  329. int strirpl(string, ptrn, rpl, n)
  330.     char *string, *ptrn;
  331.     char *rpl;
  332.     int n;
  333.  
  334.   Case independent strrpl() routine.
  335.  
  336.  
  337. char *stristr(string, pattern)
  338.     char *string, *pattern;
  339.  
  340.   Case independent strstr().
  341.  
  342.  
  343. int strnicmp(str1, str2, limit)
  344.     char *str1, *str2;
  345.     int limit;
  346.  
  347.   Case independent versions of strncmp().
  348.  
  349.  
  350. char *strlwr(string)
  351.     char *string;
  352.  
  353.  Convert string to lower case.
  354.  
  355.  
  356. char *strnset(string, c, n)
  357.     char *string;
  358.     char c;
  359.     int n;
  360.  
  361.   Set the first n elements of the string to c.
  362.  
  363.  
  364. char *strset(string, c)
  365.     char *string;
  366.     char c;
  367.  
  368.   Set all the elements of a string to c.
  369.  
  370.  
  371. char *strpcpy(dest, start, end)
  372.     char *dest;
  373.     char *start;
  374.     char *end;
  375.  
  376.   Copy the string from start to end into dest.
  377.  
  378.  
  379. int strpos(string,c)
  380.     char *string;
  381.     char c;
  382.  
  383.   Return the index to the first occurrence of c in the string.
  384.  
  385.  
  386. char *strrev(string)
  387.     char *string;
  388.  
  389.   Reverse the string.
  390.  
  391.  
  392. int strrpl(string, ptrn, rpl, n)
  393.     char *string, *ptrn;
  394.     char *rpl;
  395.     int n;
  396.  
  397.   Replace the first n copies of ptrn with rpl, return the number of 
  398. replacements.  If n is -1 all copies will be replaced.
  399.  
  400.  
  401. int strrpos(string,c)
  402.     char *string;
  403.     char c;
  404.  
  405.   Find the index of the last character c in the string.
  406.  
  407.  
  408. char *strrpbrk(string, set)
  409.     char *string, *set;
  410.  
  411.   strpbrk() looking from the end of the string backwards.
  412.  
  413.  
  414. char *strupr(string)
  415.     char *string;
  416.  
  417.   Convert a string to upper case.
  418.  
  419.  
  420. char *ultoa(n, buffer, radix)
  421.     unsigned long n;
  422.     char *buffer;
  423.     int radix;
  424.  
  425.   Print the unsigned long n into the string using the base radix, radix 
  426. can be any value from 2 to 16.
  427.  
  428.  
  429. ANSI C
  430.  
  431.   Within the ANSI part of the library I have tried to follow the 
  432. standard,here is a list of the ANSI functions and macros, I have tried to 
  433. note all the special points.
  434.  
  435.  
  436. __FILE__  __LINE__  __DATE__  __TIME__    CLOCKS_PER_SEC CHAR_BIT  
  437. CHAR_MAX  CHAR_MIN  INT_MAX  INT_MIN  LONG_MAX  LONG_MIN SCHAR_MAX  
  438. SCHAR_MIN  SHRT_MAX  SHRT_MIN  UCHAR_MAX  UINT_MAX  ULONG_MAX USHRT_MAX  
  439. EXIT_FAILURE  EXIT_SUCCESS  MB_LEN_MAX  MB_CUR_MAX  RAND_MAX_IOFBF  
  440. _IOLBF  _IONBF  BUFSIZ  CHAR_BIT  CHAR_MAX  CHAR_MIN  EOF  FILE  
  441. FILENAME_MAX  FOPEN_MAX  L_tmpnam  NULL  TMP_MAX  EDOM  ERANGE
  442.  
  443.   All these are defined as normal.
  444.  
  445.  
  446. __STDC__
  447.  
  448.   This is not defined as NorthC is not a complete standard ANSI 'C'.
  449.  
  450.  
  451. SEEK_CUR  SEEK_END  SEEK_SET  
  452.  
  453.   The SEEK values are different from UNIX, AmigaDOS uses the more 
  454. intuitive -1, 0 and +1, this might cause problems when porting from UNIX 
  455. or MSDOS, if you find any code that calls fseek() with explicit numbers like
  456.  
  457.     fseek(fptr,0L,0);
  458.  
  459. you will have to change it to
  460.  
  461.     fseek(fptr,0L,SEEK_SET);
  462.  
  463. and slap the programmer that perpetrated the original code on the wrist.
  464.  
  465.  
  466. DBL_DIG  DBL_EPSILON  DBL_MANT_DIG  DBL_MAX  DBL_MAX_10_EXP  DBL_MAX_EXP 
  467. DBL_MIN  DBL_MIN_10_EXP  DBL_MIN_EXP  FLT_DIG  FLT_EPSILON  FLT_MANT_DIG  
  468. FLT_MAX  FLT_MAX_10_EXP  FLT_MAX_EXP  FLT_MIN  FLT_MIN_10_EXP  FLT_RADIX  
  469. FLT_ROUNDS  LDBL_DIG  LDBL_EPSILON  LDBL_MANT_DIG  LDBL_MAX  
  470. LDBL_MAX_10_EXP  LDBL_MAX_EXP  LDBL_MIN  LDBL_MIN_10_EXP  LDBL_MIN_EXP  
  471. LC_ALL  LC_COLLATE  LC_CTYPE  LC_MONETARY  LC_NUMERIC  LC_TIME SIGABRT  
  472. SIGFPE  SIGILL  SIGINT  SIGSEGV  SIGTERM  SIG_DFL  SIG_ERR  SIG_IGN
  473.  
  474.   Not yet defined.
  475.  
  476.  
  477. void abort()
  478.  
  479.   Since I have not yet done any of the signal handling code this function 
  480. does not exist, one day it will perform
  481.  
  482.     raise(SIGABRT);
  483.  
  484. to do the right things.
  485.  
  486. int abs(i)
  487.     int i;
  488.  
  489. double acos(num)
  490.     double num;
  491.  
  492.   Does not set errno to EDOM if |num| is greater than 1.
  493.  
  494. char *asctime(tptr)
  495.     struct tm *tptr;
  496.  
  497. double asin(num)
  498.     double num;
  499.  
  500.   Does not set errno to EDOM if |num| is greater than 1.
  501.  
  502. void assert(test)
  503.     int test;
  504.  
  505.   Will not print out the text of the test if the assertion is incorrect.
  506.  
  507. double atan(num)
  508.     double num;
  509.  
  510. double atan2(num1,num2)
  511.     double num1;
  512.     double num2;
  513.  
  514. int atexit(fun)
  515.     void (*fun)();
  516.  
  517. double atof(s)
  518.     char *s;
  519.  
  520. int atoi(s)
  521.     char *s;
  522.  
  523. long atol(s)
  524.     char *s;
  525.  
  526. char *bsearch(key,base,nelem,size,cmp)
  527.     char *key;
  528.     char *base;
  529.     int nelem;
  530.     int size;
  531.     int (*cmp)();
  532.  
  533. char *calloc(num_bytes,num)
  534.     int num_bytes;
  535.     int num;
  536.  
  537. double ceil(num)
  538.     double num;
  539.  
  540. void clearerr(stream)
  541.     FILE *stream;
  542.  
  543. clock_t clock()
  544.  
  545.   As in ANSI spec this function always returns -1 as I don't know how to 
  546. get hold of the elapsed processor time since the machine was booted.
  547.  
  548. typedef ... clock_t;
  549.  
  550. double cos(num)
  551.     double num;
  552.  
  553. double cosh(num)
  554.     double num;
  555.  
  556.   Does not set errno to ERANGE if num is too large.
  557.  
  558. char *ctime(cal)
  559.     time_t *cal;
  560.  
  561. double difftime(t1,t0)
  562.     time_t t1;
  563.     time_t t0;
  564.  
  565. div_t div(numer,denom)
  566.     int numer;
  567.     int denom;
  568.  
  569.   As I have no plans to implement structure returning functions this will 
  570. probably not be written.  Use the _div() function described in the 
  571. extensions section above, replace
  572.  
  573.     the_div = div(numer,denom);
  574.  
  575. with
  576.  
  577.     #ifndef NORTHC
  578.     the_div = div(numer,denom);
  579.     #else
  580.     _div(&the_div,numer,denom);
  581.     #endif
  582.  
  583. to achieve the same effect.
  584.  
  585. typedef ... div_t;
  586.  
  587. int errno;
  588.  
  589.   Not set in all the places it should be.
  590.  
  591. void exit(code)
  592.     int code;
  593.  
  594. double exp(num)
  595.     double num;
  596.  
  597.   Does not set errno to ERANGE if the argument is too large.
  598.  
  599. double fabs(num)
  600.     double num;
  601.  
  602. void fclose(stream)
  603.     FILE *stream;
  604.  
  605. int feof(stream)
  606.     FILE *stream;
  607.  
  608. int ferror(stream)
  609.     FILE *stream;
  610.  
  611. void fflush(stream)
  612.     FILE *stream;
  613.  
  614. char fgetc(stream)
  615.     FILE *stream;
  616.  
  617. int fgetpos(stream,pos)
  618.     FILE *stream;
  619.     int pos;
  620.  
  621. char *fgets(str, n, stream)
  622.     char *str;
  623.     int  n;
  624.     FILE *stream;
  625.  
  626. double floor(num)
  627.     double num;
  628.  
  629. double fmod(num1,num2)
  630.     double num1;
  631.     double num2;
  632.  
  633. FILE *fopen(fname,mode)
  634.     char *fname;
  635.     char *mode;
  636.  
  637. typedef ... fpos_t;
  638.  
  639. void fprintf(stream, format, ...)
  640.     FILE *stream;
  641.     char *format;
  642.  
  643. void fputc(c,stream)
  644.     char c;
  645.     FILE *stream;
  646.  
  647. int fputs(str,stream)
  648.     char *str;
  649.     FILE *stream;
  650.  
  651. int fread(ptr,size,nelem,stream)
  652.     char *ptr;
  653.     int  size;
  654.     int nelem;
  655.     FILE *stream;
  656.  
  657. void free(ptr)
  658.     char *ptr;
  659.  
  660. FILE *freopen(name,mode,stream)
  661.     char *name;
  662.     char *mode;
  663.     FILE *stream;
  664.  
  665. double frexp(x,pexp)
  666.     double x;
  667.     int *pexp;
  668.  
  669. void fscanf(stream, format, ...)
  670.     FILE *stream;
  671.     char *format;
  672.  
  673.   Floating point formats in scanf() don't work yet, however since they 
  674. don't work in the same way on any two 'C' compilers I am not worried.  If 
  675. you must read floating point numbers try fgets() and strtod().  NOTE some 
  676. UNIX 'C' libraries I know cannot even get strtod() right.
  677.  
  678. int fseek(stream,offset,mode)
  679.     FILE *stream;
  680.     long offset;
  681.     int  mode;
  682.  
  683. int fsetpos(stream,pos)
  684.     FILE *stream;
  685.     int  pos;
  686.  
  687. long ftell(stream)
  688.     FILE *stream;
  689.  
  690. int fwrite(ptr,size,nelem,stream)
  691.     char *ptr;
  692.     int  size;
  693.     int  nelem;
  694.     FILE *stream;
  695.  
  696. int getc(stream)
  697.     FILE *stream;
  698.  
  699. int getchar()
  700.  
  701. char *getenv(str)
  702.     char *str;
  703.  
  704.   Uses the "env:" directory to get the value of environment variables, 
  705. will only work under AmigaDOS 1.3 or later.
  706.  
  707. char *gets(s)
  708.     char *s;
  709.  
  710. struct tm *gmtime(tod)
  711.     time_t tod;
  712.  
  713.   Since I have no idea of the current time zone this is the same as 
  714. localtime(), this is normally good enough, at least here in the UK in the 
  715. winter.
  716.  
  717. int isalnum(c)
  718.     char c;
  719.  
  720. int isalpha(c)
  721.     char c;
  722.  
  723. int iscntrl(c)
  724.     char c;
  725.  
  726. int isdigit(c)
  727.     char c;
  728.  
  729. int isgraph(c)
  730.     char c;
  731.  
  732. int islower(c)
  733.     char c;
  734.  
  735. int isprint(c)
  736.     char c;
  737.  
  738. int ispunct(c)
  739.     char c;
  740.  
  741. int isspace(c)
  742.     char c;
  743.  
  744. int isupper(c)
  745.     char c;
  746.  
  747. int isxdigit(c)
  748.     char c;
  749.  
  750. typedef ... jmp_buf;
  751.  
  752. long labs(i)
  753.     long i;
  754.  
  755. struct lconv{...};
  756.  
  757.   I don't plan to implement any locale stuff, I have never met a program 
  758. that uses it (probably because I am English).
  759.  
  760. double ldexp(x,exp)
  761.     double x;
  762.     int    exp;
  763.  
  764. ldiv_t ldiv(numer,denom)
  765.     long numer;
  766.     long denom;
  767.  
  768.   No structure returns in NorthC, use the _ldiv() function as shown in the 
  769. div() description.
  770.  
  771. typedef ... ldiv_t;
  772.  
  773. struct lconv *localeconv()
  774.  
  775.   I have no plans to implement any of the locale stuff, just assume that 
  776. NorthC is always in the "C" locale.  If this is really required create an 
  777. lconv structure
  778.  
  779.     struct lconv
  780.        {char *currency_symbol;
  781.         char *decimal_point;
  782.         char *grouping;
  783.         char *int_curr_symbol;
  784.         char *mon_decimal_point;
  785.         char *mon_grouping;
  786.         char *mon_thousands_sep;
  787.         char *negative_sign;
  788.         char *positive_sign;
  789.         char *thousands_sep;
  790.         char frac_digits;
  791.         char int_frac_digits;
  792.         char n_cs_precedes;
  793.         char n_sep_by_space;
  794.         char n_sign_posn;
  795.         char p_cs_precedes;
  796.         char p_sep_by_space;
  797.         char p_sign_posn;
  798.         } mylconv = {"$",".","\3","USD ",".", "\3",",","-","+",",",
  799.                      2,2,1,0,4,  1,0,4};
  800.  
  801. and replace all calls to localeconv() with (&mylconv).
  802.  
  803. struct tm *localtime(tod)
  804.     time_t *tod;
  805.  
  806.   Same as gmtime() because I don't know which time zone we are in, for the 
  807. same reason the tm_isdst field is always 0.
  808.  
  809. double log(num)
  810.     double num;
  811.  
  812. double log10(num)
  813.     double num;
  814.  
  815. void longjmp(env,val)
  816.     jmp_buf env;
  817.     int val;
  818.  
  819. char *malloc(num_bytes)
  820.     int num_bytes;
  821.  
  822. int mblen(s,n)
  823.     char *s;
  824.     int n;
  825.  
  826.   Multibyte characters are not supported, replace all calls to mblen() with
  827.  
  828.     #ifndef NORTHC
  829.     foo = mblen(str,n);
  830.     #else
  831.     foo = (str==NULL?0:1);
  832.     #endif
  833.  
  834. this will be about the same.
  835.  
  836. int mbstowcs(wcs,s,n)
  837.     wchar_t *wcs;
  838.     char *s;
  839.     int  n;
  840.  
  841.   Multibyte characters are not supported, replace all calls to mbstowcs() with
  842.  
  843.     #ifndef NORTHC
  844.     foo = mbstowcs(wcs,s,n);
  845.     #else
  846.     foo = (s!=NULL?strncpy(wcs,s,n):0);
  847.     #endif
  848.  
  849. to emulate the mbstowcs() function.
  850.  
  851. int mbtowc(pwc,s,n)
  852.     wchar_t *pwc;
  853.     char *s;
  854.     int n;
  855.  
  856.   Multibyte characters are not supported, replace all calls to mbtowc() with
  857.  
  858.     #ifndef NORTHC
  859.     foo = mbtowc(wcs,s,n);
  860.     #else
  861.     foo = ((s!=NULL && n!=0)?*wcs=*s:0);
  862.     #endif
  863.  
  864. to emulate the function.
  865.  
  866. char *memchr(s,c,n)
  867.     char *s;
  868.     int c;
  869.     int n;
  870.  
  871. int memcmp(s1,s2,n)
  872.     char *s1;
  873.     char *s2;
  874.     int n;
  875.  
  876. void memcpy(dest,source,length)
  877.     char *dest;
  878.     char *source;
  879.     int  length;
  880.  
  881. char *memmove(s1,s2,n)
  882.     char *s1;
  883.     char *s2;
  884.     int  n;
  885.  
  886. char *memset(s,c,n)
  887.     char *s;
  888.     int  c;
  889.     int  n;
  890.  
  891. time_t mktime(tptr)
  892.     struct tm *tptr;
  893.  
  894.   Not yet written.  If you want to find out the real date of 57/57/1990 
  895. you can write the function yourself.  When you have done so send me a copy 
  896. and I will put it in the library.
  897.  
  898. double modf(x,pint)
  899.     double x;
  900.     double *pint;
  901.  
  902. int offsetof(type,member)
  903.  
  904. void perror(s)
  905.     char *s;
  906.  
  907. double pow(num1,num2)
  908.     double num1;
  909.     double num2;
  910.  
  911.   Does not set errno to EDOM when it should.
  912.  
  913. void printf(format, ...)
  914.     char *format;
  915.  
  916. typedef ... ptrdiff_t;
  917.  
  918. int putc(c,stream)
  919.     int c;
  920.     FILE *stream;
  921.  
  922. int putchar(c)
  923.     int c;
  924.  
  925. int puts(s)
  926.     char *s;
  927.  
  928. void qsort(base,nelem,size,cmp)
  929.     char *base;
  930.     int  nelem;
  931.     int  size;
  932.     int (*cmp)();
  933.  
  934. int raise(sig)
  935.     int sig;
  936.  
  937.   None of the signal routines have been written yet.
  938.  
  939. int rand()
  940.  
  941. char *realloc(ptr,size)
  942.     char *ptr;
  943.     int  size;
  944.  
  945.   Always creates a new block, never reuses the old location.
  946.  
  947. int remove(name)
  948.     char *name;
  949.  
  950. int rename(old,new)
  951.     char *old;
  952.     char *new;
  953.  
  954. int rewind(stream)
  955.     FILE *stream;
  956.  
  957. void scanf(format, ...)
  958.     char *format;
  959.  
  960.   Cannot read floating point formats, see fscanf().
  961.  
  962. void setbuf(stream,buf)
  963.     FILE *stream;
  964.     char *buf;
  965.  
  966. int setjmp(env)
  967.     jmp_buf env;
  968.  
  969. char *setlocale(cat,locale)
  970.     int cat;
  971.     char *locale;
  972.  
  973.   Locales are not supported, if you want to fake it assume that NorthC is 
  974. always in the "C" locale.  Replace all calls with
  975.  
  976.     #ifndef NORTHC
  977.     loc = setlocale(cat,locale);
  978.     #else
  979.     loc = ((locale==NULL || strcmp(locale,"C")==0)?"C":NULL);
  980.     #endif
  981.  
  982. this will fake the call.
  983.  
  984. int setvbuf(stream,buf,mode,size)
  985.     FILE *stream;
  986.     unsigned char *buf;
  987.     int mode;
  988.     int size;
  989.  
  990. void (*signal(sig,fun)
  991.     int sig;
  992.     void (*fun)();)()
  993.  
  994.   None of the signal stuff is written in NorthC yet.
  995.  
  996. typedef ... sig_atomic_t;
  997.  
  998.   None of the signal stuff is written in NorthC yet.
  999.  
  1000. double sin(num)
  1001.     double num;
  1002.  
  1003. double sinh(num)
  1004.     double num;
  1005.  
  1006. typedef ... size_t;
  1007.  
  1008. void sprintf(buf, format, ...)
  1009.     char *buf;
  1010.     char *format;
  1011.  
  1012. double sqrt(num)
  1013.     double num;
  1014.  
  1015.   Does not set errno to EDOM if num is negative.
  1016.  
  1017. void srand(seed)
  1018.     int seed;
  1019.  
  1020. void sscanf(buf, format, ...)
  1021.     char *buf;
  1022.     char *format;
  1023.  
  1024.   Cannot read floating point formats yet, see fscanf().
  1025.  
  1026. FILE *stderr,*stdin,*stdout;
  1027.  
  1028. char *strcat(dest, source)
  1029.     char *dest, *source;
  1030.  
  1031. char *strchr(string, symbol)
  1032.     char *string;
  1033.     char symbol;
  1034.  
  1035. int strcmp(str1, str2)
  1036.     char *str1;
  1037.     char *str2;
  1038.  
  1039. int strcoll(str1,str2)
  1040.     char *str1;
  1041.     char *str2;
  1042.  
  1043.   Since locales are not supported this function does not exist.  If you 
  1044. want to fake it replace all calls with
  1045.  
  1046.     #ifndef NORTHC
  1047.     val = strcoll(str1,str2);
  1048.     #else
  1049.     val = strcmp(str1,str2);
  1050.     #endif
  1051.  
  1052. this will do the right type of thing.
  1053.  
  1054. char *strcpy(to, from)
  1055.     char *to;
  1056.     char *from;
  1057.  
  1058. int strcspn(str, set)
  1059.     char *str;
  1060.     char *set;
  1061.  
  1062. char *strerror(code)
  1063.     int code;
  1064.  
  1065. long strftime(s,n,format,tptr)
  1066.     char *s;
  1067.     size_t n;
  1068.     char *format;
  1069.     struct tm *tptr;
  1070.  
  1071.   The "%U" and "%W" specifiers are not implemented.  The "%Z" specifier is 
  1072. ignored, because I have no idea of the timezone.
  1073.  
  1074. int strlen(string)
  1075.     char *string;
  1076.  
  1077. char *strncat(dest, source, limit)
  1078.     char *dest, *source;
  1079.     int limit;
  1080.  
  1081. int strncmp(str1, str2, limit)
  1082.     char *str1, *str2;
  1083.     int limit;
  1084.  
  1085. char *strncpy(dest, source, limit)
  1086.     char *dest, *source;
  1087.     int limit;
  1088.  
  1089. char *strpbrk(string, set)
  1090.     char *string, *set;
  1091.  
  1092. char *strrchr(string, symbol)
  1093.     char *string;
  1094.     char symbol;
  1095.  
  1096. int strspn(string, set)
  1097.     char *string, *set;
  1098.  
  1099. char *strstr(string, pattern)
  1100.     char *string, *pattern;
  1101.  
  1102. double strtod(s,endptr)
  1103.     char *s;
  1104.     char **endptr;
  1105.  
  1106.   Does not set errno to ERANGE if the number is too large.
  1107.  
  1108. char *strtok(string, delim)
  1109.     char *string, *delim;
  1110.  
  1111. long strtol(number, nptr, base)
  1112.     char *number;
  1113.     char **nptr;
  1114.     int base;
  1115.  
  1116.   No overflow checking or setting of errno.
  1117.  
  1118. unsigned long strtoul(number, nptr, base)
  1119.     char *number;
  1120.     char **nptr;
  1121.     int base;
  1122.  
  1123.   No overflow checking or setting of errno.
  1124.  
  1125. int strxfrm(s1,s2,n)
  1126.     char *s1;
  1127.     char *s2;
  1128.     int  n;
  1129.  
  1130.   Locales are not supported in NorthC.  You can fake the call with
  1131.  
  1132.     #ifndef NORTHC
  1133.     num = strxfrm(s1,s2,n);
  1134.     #else
  1135.     num = strncpy(s1,s2,n);
  1136.     #endif
  1137.  
  1138. long system(cmnd)
  1139.     char *cmnd;
  1140.  
  1141.   Executes CLI commands, assigns NULL to the input and output files, if 
  1142. you want to attach a file use fsystem().  This function should return the 
  1143. exit code of the program called, since I cannot work out how to get this 
  1144. it always returns the value returned by the Execute() function, that is -1.
  1145.  
  1146. double tan(num)
  1147.     double num;
  1148.  
  1149.   Does not set errno to EDOM if num is an odd multiple of PI/2.
  1150.  
  1151. double tanh(num)
  1152.     double num;
  1153.  
  1154. time_t time(tod)
  1155.     time_t *tod;
  1156.  
  1157. struct tm {...};
  1158.  
  1159. FILE *tmpfile()
  1160.  
  1161.   I am not sure how to create a file that disappears when it is closed, so 
  1162. this function does not yet exist.  If you want to emulate it you could try 
  1163. something like
  1164.  
  1165.     #ifdef NORTHC
  1166.     char TempFileName[L_tmpnam];
  1167.     char *TPtr;
  1168.  
  1169.     DelTempFile()
  1170.        {/* Delete the created temp file */
  1171.         remove(TempFileName);
  1172.         }
  1173.     #endif
  1174.     .
  1175.     .
  1176.     #ifndef NORTHC
  1177.     fptr = tmpfile();
  1178.     #else
  1179.     TPtr = tmpnam();
  1180.     if(TPtr)
  1181.        {fptr = fopen(TPtr,"w+");
  1182.         strcpy(TempFileName,TPtr);
  1183.         atexit(DelTempFile);
  1184.         }
  1185.     #endif
  1186.  
  1187. and make sure that you close the file before exiting the program.
  1188.  
  1189. char *tmpnam(s)
  1190.     char *s;
  1191.  
  1192.   Always creates a file name in the "t:" directory, this is usually on the 
  1193. ram disk, use the "assign" command to put "t:" somewhere else if you want 
  1194. to move it.  If you want to create a temporary file in your current 
  1195. directory use _tmpnam().
  1196.  
  1197. char tolower(ch)
  1198.     char ch;
  1199.  
  1200. char toupper(ch)
  1201.     char ch;
  1202.  
  1203. void ungetc(ch,stream)
  1204.     char ch;
  1205.     FILE *stream;
  1206.  
  1207. va_arg va_end va_list va_start
  1208.  
  1209. void vfprintf(stream, format, ap)
  1210.     FILE *stream;
  1211.     char *format;
  1212.     va_list ap;
  1213.  
  1214. void vprintf(format, ap)
  1215.     char *format;
  1216.     va_list ap;
  1217.  
  1218. void vsprintf(buf, format, ap)
  1219.     char *buf;
  1220.     char *format;
  1221.     va_list ap;
  1222.  
  1223. typedef ... wchar_t;
  1224.  
  1225. int wcstombs(s,wcs,n)
  1226.     char *s;
  1227.     wchar_t *wcs;
  1228.     int n;
  1229.  
  1230.   No multibyte characters so this function does not exist, you can fake it 
  1231. with
  1232.  
  1233.     #ifndef NORTHC
  1234.     num = wcstombs(s,wcs,n);
  1235.     #else
  1236.     num = strncpy(s,wcs,n);
  1237.     #endif
  1238.  
  1239. this will perform the same type of function.
  1240.  
  1241. int wctomb(s,wchar)
  1242.     char *s;
  1243.     wchar_t *wchar;
  1244.  
  1245.   There are no multibyte characters in NorthC. You can emulate this 
  1246. function with
  1247.  
  1248.     #ifndef NORTHC
  1249.     num = wctomb(s,wchar);
  1250.     #else
  1251.     *s=*wchar;
  1252.     num = 1;
  1253.     #endif
  1254.  
  1255.