home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / internet-tools / connect-line / cl / devkit / c / include / cllib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-12  |  4.3 KB  |  165 lines

  1. /*
  2.  * $NAME: cllib.h
  3.  * $VER: 11.0
  4.  *
  5.  */
  6.  
  7. #ifndef _CL_CLLIB_H
  8. #define _CL_CLLIB_H
  9.  
  10. #ifndef UTILITY_HOOKS_H
  11. #include <utility/hooks.h>
  12. #endif
  13.  
  14. /*
  15.  *  "cl.lib" 2.0 memory support functions
  16.  *
  17.  *  The cl.lib memory support functions consist of a constructor/destructor
  18.  *  pair which initializes and destroy an exec memory pool via clutil.library.
  19.  *  cl_alloc(), cl_free() and cl_strdup() work as their standard counterparts,
  20.  *  just via the pool. Every and all memory left ist automagically freed
  21.  *  upon program termination.
  22.  *
  23.  *  You can modify the pool attributes with three longwords. Default defines
  24.  *  are also contained within "cl.lib", but may be overriden on your behalf.
  25.  *
  26.  *  long __clpoolmemflags       Default: MEMF_CLEAR
  27.  *  long __clpoolpuddlesize    Default: 8192
  28.  *  long __clpooltresholdsize  Default: 4096
  29.  *
  30.  *  These functions are not reentrant (unless linked with "cres.o")
  31.  *
  32.  *  These functions are just a _very_ thin layer over "clutil.library"
  33.  *  and quite efficient.
  34.  */
  35.  
  36. void * __regargs cl_alloc( int );     /* allocate some memory from the pool */
  37. void __regargs cl_free( void * );     /* free it afterwards */
  38. char * __regargs cl_strdup( char * ); /* duplicate string */
  39.  
  40. /*
  41.  * "cl.lib" 4.0 hook support
  42.  *
  43.  * cl_allochook( function_pointer, data ) allocates a hook structure
  44.  * via cl_alloc() and fills out the h_Entry and h_Data fields
  45.  *
  46.  * cl_allochooka4( funcptr ) allocates a hook with automagic
  47.  * A4 saving.
  48.  *
  49.  * cl_allochooka4d( funcptr, APTR ) allocates a hook with automagic
  50.  * A4 saving and fills out h_Data.
  51.  *
  52.  */
  53.  
  54. struct Hook * __regargs cl_allochook( void*(*)(), APTR );
  55. #define cl_allochook(f,d) cl_allochook((void*(*)())f,(APTR)(d))
  56. struct Hook * __regargs cl_allochooka4( void*(*)());
  57. #define cl_allochooka4(f) cl_allochooka4((void*(*)())f)
  58. struct Hook * __regargs cl_allochooka4d( void*(*)(), APTR );
  59. #define cl_allochooka4d(f,d) cl_allochooka4d((void*(*)())f,(APTR)(d))
  60.  
  61. /*
  62.  * "cl.lib" 2.0 ReadArgs() template support functions
  63.  *
  64.  * Define your command template by setting
  65.  * char *__clargstemplate = "<ReadArgs-Template>"
  66.  * The args array will automagically be allocated by
  67.  * the lib function.
  68.  *
  69.  * Setting "__clargshelp" to a non-NULL value enables
  70.  * ReadArgs's extend help facility.
  71.  *
  72.  * A ReadArgs() error will cause your application to
  73.  * terminate immediately, printing an errorcode consisting
  74.  * of the CLI program name and the errorstring (via PrintFault())
  75.  *
  76.  * The ReadArgs() function is linked in by
  77.  * referencing "__clargs" inside your code.
  78.  *
  79.  * New for V6: setting __clargsquiet to the integer index
  80.  * of a switch item inside your args list causes your
  81.  * process Input/Output handles to be replaced bei NIL:.
  82.  * This is for easy implementation of QUIET/S-like
  83.  * template options.
  84.  *
  85.  */
  86.  
  87. /*
  88. extern char * __clargshelp;
  89. extern long __clargsquiet;
  90. extern struct myargs * __clargs;
  91. */
  92.  
  93. /*
  94.  * "cl.lib" 3.0 Locale support
  95.  *
  96.  * Define the name of your program's catalog as
  97.  * char *__clcatalogname = "prefs/system.catalog";
  98.  * and dereference the given LocaleInfo structure.
  99.  *
  100.  * The constructor temporarly changes PROGDIR:
  101.  * to point to CONNECTLINE: in order to allow
  102.  * applications to be started from wherever the
  103.  * user wants without worrying about the path.
  104.  *
  105.  * You may set
  106.  * char *__clbuiltinlanguage = "...";
  107.  * to change the builtin language name. Defaults
  108.  * to "Deutsch".
  109.  *
  110.  */
  111.  
  112. extern struct LocaleInfo __cllocaleinfo;
  113.  
  114. /*
  115.  * "cl.lib" 5.0 priority support
  116.  *
  117.  * Modify your process' priority using
  118.  * this function. The old priority will
  119.  * be restored upon program exit.
  120.  *
  121.  */
  122.  
  123. void __regargs cl_setpri( int );
  124.  
  125. /*
  126.  * "cl.lib" 5.0 pr_WindowPtr support
  127.  *
  128.  * Modify your process' pr_WindowPtr using
  129.  * this function. The old pr_WindowPtr will
  130.  * be restored upon program exit.
  131.  *
  132.  */
  133.  
  134. void __regargs cl_setprwindowptr( struct Window * );
  135.  
  136. #define PRWINDOWPTR_QUIET ((struct Window*)-1)
  137.  
  138. /*
  139.  * "cl.lib" 7.0 logfile support
  140.  *
  141.  * Output log entries via cl_addlog(). The log prefix
  142.  * for your application is defined by setting
  143.  *
  144.  *  char *__cllogid = "YOURAPP";
  145.  *
  146.  */
  147.  
  148. /*
  149.  * NEW FOR V11: now loglevel is supported!
  150.  */
  151.  
  152. void __stdargs cl_addlog( LONG loglevel, STRPTR fmt, ... );
  153. void __regargs cl_addlogargs( LONG loglevel, STRPTR, APTR );
  154.  
  155.  
  156. /*
  157.  * "cl.lib" 8.0 current directory stack support
  158.  *
  159.  */
  160.  
  161. BOOL __regargs cl_pushdir( STRPTR );
  162. void __regargs cl_popdir( void );
  163.  
  164. #endif
  165.