home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / ace_basic / ace / include / dos / rdargs.h < prev    next >
C/C++ Source or Header  |  1977-12-31  |  5KB  |  139 lines

  1. #ifndef DOS_RDARGS_H
  2. #define DOS_RDARGS_H 1
  3. /*
  4. ** rdargs.h for ACE Basic
  5. **
  6. ** Note: Translated to ACE by ConvertC2ACE
  7. **       @ MapMeadow Software, Nils Sjoholm
  8. **
  9. **
  10. ** Date: 09/02/95
  11. **
  12. **
  13. */
  14.  
  15. /*
  16. ** This are the StructPointer defines for rdargs.h
  17. */
  18. #ifndef CSourcePtr
  19. #define CSourcePtr ADDRESS
  20. #endif
  21. #ifndef RDArgsPtr
  22. #define RDArgsPtr ADDRESS
  23. #endif
  24. /*
  25. ** End of StructPointer defines for rdargs.h
  26. */
  27.     
  28. #ifndef EXEC_TYPES_H
  29. #include <exec/types.h>
  30. #endif
  31.  
  32. #ifndef EXEC_NODES_H
  33. #include <exec/nodes.h>
  34. #endif
  35.  
  36.  
  37. /**********************************************************************
  38.  *
  39.  * The CSource data structure defines the input source for "ReadItem()"
  40.  * as well as the ReadArgs call.  It is a publicly defined structure
  41.  * which may be used by applications which use code that follows the
  42.  * conventions defined for access.
  43.  *
  44.  * When passed to the dos.library functions,  the value passed as
  45.  * STRUCT *CSource is defined as follows:
  46.  *  if ( CSource == 0)  Use buffered IO "ReadChar()" as data source
  47.  *  else            Use CSource for input character stream
  48.  *
  49.  * The following two pseudo-code routines define how the CSource structure
  50.  * is used:
  51.  *
  52.  * LONGINT CS_ReadChar( STRUCT CSource *CSource )
  53.  *  
  54.  *  if ( CSource == 0 ) return ReadChar() 
  55.  *  if ( CSource->CurChr >= CSource->Length )   return ENDSTREAMCHAR 
  56.  *  return CSource->Buffer[CSource->CurChr++] 
  57.  * END STRUCT
  58.  *
  59.  * SHORTINT CS_UnReadChar( STRUCT CSource *CSource )
  60.  *  
  61.  *  if ( CSource == 0 ) return UnReadChar() 
  62.  *  if ( CSource->CurChr <= 0 ) return FALSE 
  63.  *  CSource->CurChr-- 
  64.  *  return TRUE 
  65.  * END STRUCT
  66.  *
  67.  * To initialize a STRUCT CSource,  you set CSource->CS_Buffer to
  68.  * a string which is used as the data source,  and set CS_Length to
  69.  * the number of characters in the string.  Normally CS_CurChr should
  70.  * be initialized to ZERO,  or left as it was from prior use as
  71.  * a CSource.
  72.  *
  73.  **********************************************************************/
  74.  
  75. STRUCT CSource  
  76.     ADDRESS   CS_Buffer 
  77.     LONGINT    CS_Length 
  78.     LONGINT    CS_CurChr 
  79. END STRUCT 
  80.  
  81. /**********************************************************************
  82.  *
  83.  * The RDArgs data structure is the input parameter passed to the DOS
  84.  * ReadArgs() function call.
  85.  *
  86.  * The RDA_Source structure is a CSource as defined above 
  87.  * if RDA_Source.CS_Buffer is non-null,  RDA_Source is used as the input
  88.  * character stream to parse,  else the input comes from the buffered STDIN
  89.  * calls ReadChar/UnReadChar.
  90.  *
  91.  * RDA_DAList is a private address which is used internally to track
  92.  * allocations which are freed by FreeArgs().  This MUST be initialized
  93.  * to NULL prior to the first call to ReadArgs().
  94.  *
  95.  * The RDA_Buffer and RDA_BufSiz fields allow the application to supply
  96.  * a fixed-size buffer in which to store the parsed data.  This allows
  97.  * the application to pre-allocate a buffer rather than requiring buffer
  98.  * space to be allocated.  If either RDA_Buffer or RDA_BufSiz is NULL, 
  99.  * the application has not supplied a buffer.
  100.  *
  101.  * RDA_ExtHelp is a text string which will be displayed instead of the
  102.  * template string,  if the user is prompted for input.
  103.  *
  104.  * RDA_Flags bits control how ReadArgs() works.  The flag bits are
  105.  * defined below.  Defaults are initialized to ZERO.
  106.  *
  107.  **********************************************************************/
  108.  
  109. STRUCT RDArgs  
  110.     CSource RDA_Source  /* Select input source */
  111.     LONGINT    RDA_DAList      /* PRIVATE. */
  112.     ADDRESS   RDA_Buffer         /* Optional string parsing space. */
  113.     LONGINT    RDA_BufSiz      /* Size of RDA_Buffer (0..n) */
  114.     ADDRESS   RDA_ExtHelp        /* Optional extended help */
  115.     LONGINT    RDA_Flags       /* Flags for any required control */
  116. END STRUCT 
  117.  
  118. #define RDAB_STDIN  0   /* Use "STDIN" rather than "COMMAND LINE" */
  119. #define RDAF_STDIN  1
  120. #define RDAB_NOALLOC    1   /* If set,  do not allocate extra string space.*/
  121. #define RDAF_NOALLOC    2
  122. #define RDAB_NOPROMPT   2   /* Disable reprompting for string input. */
  123. #define RDAF_NOPROMPT   4
  124.  
  125. /**********************************************************************
  126.  * Maximum number of template keywords which can be in a template passed
  127.  * to ReadArgs(). IMPLEMENTOR NOTE - must be a multiple of 4.
  128.  **********************************************************************/
  129. #define MAX_TEMPLATE_ITEMS  100
  130.  
  131. /**********************************************************************
  132.  * Maximum number of MULTIARG items returned by ReadArgs(),  before
  133.  * an ERROR_LINE_TOO_LONG.  These two limitations are due to stack
  134.  * usage.  Applications should allow "a lot" of stack to use ReadArgs().
  135.  **********************************************************************/
  136. #define MAX_MULTIARGS       128
  137.  
  138. #endif /* DOS_RDARGS_H */
  139.