home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / cbm / nduk-v37.lha / V37 / include / dos / rdargs.i < prev    next >
Text File  |  1991-11-27  |  4KB  |  118 lines

  1.     IFND    DOS_RDARGS_I
  2. DOS_RDARGS_I SET 1
  3. **
  4. **    $Filename: dos/rdargs.i $
  5. **    $Release: 2.04 Includes, V37.4 $
  6. **    $Revision: 36.7 $
  7. **    $Date: 90/07/12 $
  8. **
  9. **    ReadArgs() structure definitions
  10. **
  11. **    (C) Copyright 1989-1991 Commodore-Amiga, Inc.
  12. **        All Rights Reserved
  13. **
  14.  
  15.     IFND EXEC_NODES_I
  16.     INCLUDE "exec/nodes.i"
  17.     ENDC
  18.  
  19. **********************************************************************
  20. *
  21. * The CSource data structure defines the input source for "RdItem()"
  22. * as well as the ReadArgs call.  It is a publicly defined structure
  23. * which may be used by applications which use code that follows the
  24. * conventions defined for access.
  25. *
  26. * When passed to the dos.library functions, the value passed as
  27. * struct *CSource is defined as follows:
  28. *    if ( CSource == 0)    Use buffered IO "ReadChar()" as data source
  29. *    else            Use CSource for input character stream
  30. *
  31. * The following two pseudo-code routines define how the CSource structure
  32. * is used:
  33. *
  34. * long CS_ReadChar( struct CSource *CSource )
  35. * {
  36. *    if ( CSource == 0 )    return ReadChar();
  37. *    if ( CSource->CurChr >= CSource->Length )    return ENDSTREAMCHAR;
  38. *    return CSource->Buffer[ CSource->CurChr++ ];
  39. * }
  40. *
  41. * BOOL CS_UnReadChar( struct CSource *CSource )
  42. * {
  43. *    if ( CSource == 0 )    return UnReadChar();
  44. *    if ( CSource->CurChr <= 0 )    return FALSE;
  45. *    CSource->CurChr--;
  46. *    return TRUE;
  47. * }
  48. *
  49. * To initialize a struct CSource, you set CSource->CS_Buffer to
  50. * a string which is used as the data source, and set CS_Length to
  51. * the number of characters in the string.  Normally CS_CurChr should
  52. * be initialized to ZERO, or left as it was from prior use as
  53. * a CSource.
  54. *
  55. **********************************************************************
  56.  
  57.     STRUCTURE    CSource,0
  58.         APTR    CS_Buffer
  59.         LONG    CS_Length
  60.         LONG    CS_CurChr
  61.         LABEL    CS_SIZEOF
  62.  
  63. **********************************************************************
  64. *
  65. * The RDArgs data structure is the input parameter passed to the DOS
  66. * ReadArgs() function call.
  67. *
  68. * The RDA_Source structure is a CSource as defined above;
  69. * if RDA_Source.CS_Buffer is non-null, RDA_Source is used as the input
  70. * character stream to parse, else the input comes from the buffered STDIN
  71. * calls ReadChar/UnReadChar.
  72. *
  73. * RDA_DAList is a private address which is used internally to track
  74. * allocations which are freed by FreeArgs().  This MUST be initialized
  75. * to NULL prior to the first call to ReadArgs().
  76. *
  77. * The RDA_Buffer and RDA_BufSiz fields allow the application to supply
  78. * a fixed-size buffer in which to store the parsed data.  This allows
  79. * the application to pre-allocate a buffer rather than requiring buffer
  80. * space to be allocated.  If either RDA_Buffer or RDA_BufSiz is NULL,
  81. * the application has not supplied a buffer.
  82. *
  83. * RDA_ExtHelp is a text string which will be displayed instead of the
  84. * template string, if the user is prompted for input.
  85. *
  86. * RDA_Flags bits control how ReadArgs() works.    The flag bits are
  87. * defined below.  Defaults are initialized to ZERO.
  88. *
  89. **********************************************************************
  90.  
  91.     STRUCTURE    RDArgs,0
  92.         STRUCT    RDA_Source,CS_SIZEOF    ; Select input source
  93.         APTR    RDA_DAList        ; PRIVATE.
  94.         LONG    RDA_Buffer        ; Optional string parsing space.
  95.         LONG    RDA_BufSiz        ; Size of RDA_Buffer (0..n)
  96.         APTR    RDA_ExtHelp        ; Optional extended help
  97.         LONG    RDA_Flags        ; Flags for any required control
  98.         LABEL    RDA_SIZEOF
  99.  
  100.     BITDEF    RDA,STDIN,0    ; Use "STDIN" rather than "COMMAND LINE"
  101.     BITDEF    RDA,NOALLOC,1    ; If set, do not allocate extra string space.
  102.     BITDEF    RDA,NOPROMPT,2    ; Disable reprompting for string input.
  103.  
  104. **********************************************************************
  105. * Maximum number of template keywords which can be in a template passed
  106. * to ReadArgs(). IMPLEMENTOR NOTE - must be a multiple of 4.
  107. **********************************************************************
  108. MAX_TEMPLATE_ITEMS    equ    100
  109.  
  110. **********************************************************************
  111. * Maximum number of MULTIARG items returned by ReadArgs(), before
  112. * an ERROR_LINE_TOO_LONG.  These two limitations are due to stack
  113. * usage.  Applications should allow "a lot" of stack to use ReadArgs().
  114. **********************************************************************
  115. MAX_MULTIARGS    equ    128
  116.  
  117.     ENDC    ; DOS_RDARGS_I
  118.