home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 2: PC / frozenfish_august_1995.bin / bbs / d09xx / d0948.lha / Snoopy / Ini / Includes / libraries / ini.h next >
C/C++ Source or Header  |  1993-12-20  |  3KB  |  110 lines

  1. #ifndef LIBRARIES_INI_H
  2. #define LIBRARIES_INI_H
  3.  
  4. #ifndef EXEC_NODES_H
  5. #include "exec/nodes.h"
  6. #endif /* EXEC_NODES_H */
  7.  
  8. #ifndef EXEC_LISTS_H
  9. #include "exec/lists.h"
  10. #endif /* EXEC_LISTS_H */
  11.  
  12. #ifndef EXEC_LIBRARIES_H
  13. #include "exec/libraries.h"
  14. #endif /* EXEC_LIBRARIES_H */
  15.  
  16. #define INIERROR_NONE            0
  17. #define INIERROR_NOT_ENOUGH_MEMORY    1
  18. #define INIERROR_CANNOT_OPEN_FILE    2
  19. #define INIERROR_CANNOT_EXAMINE_FILE    3
  20. #define INIERROR_CANNOT_READ_FILE    4
  21. #define INIERROR_CANNOT_WRITE_FILE    5
  22. #define INIERROR_INVALID_PARSER        6
  23. #define INIERROR_HEADER_NOT_FOUND    7
  24. #define INIERROR_VARIABLE_NOT_FOUND    8
  25. #define INIERROR_INVALID_ARGS        9
  26. #define INIERROR_TEMPLATE_FAILED    10
  27. #define INIERROR_INVALID_INI_FILE    11
  28. #define INIERROR_INITFAILED        12
  29. #define INIERROR_NO_TEMPLATE_INPUT    13
  30. #define INIERROR_INVALID_PASSWORD    14
  31.  
  32. #define INIFLAG_UNKNOWN            0
  33. #define INIFLAG_VARIABLE        1
  34. #define INIFLAG_HEADER            2
  35. #define INIFLAG_COMMENT            4
  36.  
  37. typedef struct IniLineInfo
  38.     {
  39.         struct Node node;        /* for internal linkage */
  40.         UBYTE    flags;            /* one of the above flags */
  41.         UBYTE    reserved;        /* INTERNAL USE, currently ZERO    */
  42.         STRPTR    variable;        /* ptr to variable or NULL (if not variable) */
  43.         STRPTR    contents;        /* ptr to contents or NULL (if no contents) */
  44.         STRPTR    allocated;        /* ptr to allocated memory */
  45.         LONG    size;            /* size of allocated memory */
  46.     } INILINEINFO;
  47.  
  48. typedef struct IniParser
  49.     {
  50.         struct List table;        /* INILINEINFO anchor */
  51.         LONG flags;
  52.         UBYTE    Private[12];
  53.     } INIPARSER;
  54.  
  55. /* the lowest 4 bits tell you about the "real" location of your
  56.    inifile (which may be anywhere, since the ini.library does
  57.    the path dispatching for you) */
  58.  
  59. #define INIPARSER_UNKNOWN    0    /* uses fixed path (or current directory) */
  60. #define INIPARSER_S        (1<<0)    /* uses S: */
  61. #define INIPARSER_INI        (1<<1)    /* uses INI: */
  62. #define INIPARSER_ENV        (1<<2)    /* uses ENV: */
  63. #define INIPARSER_USER        (1<<3)    /* uses USER: */
  64.  
  65. /* if this bit is set, the extensions to the ini-standard are DISABLED
  66.    (which you shouldn't normally insist on) */
  67. #define INIPARSERB_NOEXTENSIONS    31
  68. #define INIPARSERF_NOEXTENSIONS    (1<<31)
  69.  
  70. /* Note well : LN_NAME does NOT point to a valid name but to 
  71.    a "struct Task" (or rather "struct Process") if the config is
  72.    local (this is how the ini.library knows which local node to use)
  73.    if the config is global, LN_NAME will probably always be NULL */
  74.  
  75. typedef struct IniLibConfig
  76.     {
  77.         struct Node node;
  78.         LONG Flags;        
  79.         STRPTR UserAssign;
  80. /* this structure may well grow in the future; use ini_NewConfig()/
  81.    ini_DeleteConfig() if you want to create one yourself */
  82.     } INICONFIG;
  83.  
  84. /* Flagbits same as above for parser */
  85. #define INICONFIGB_NOINIMASK 8
  86. #define INICONFIGF_NOINIMASK (1<<8)
  87.  
  88. #define INI_Dummy         (TAG_USER+100)
  89. #define ICFG_ENABLE_S        (INI_Dummy+1)
  90. #define ICFG_ENABLE_INI        (INI_Dummy+2)
  91. #define ICFG_ENABLE_ENV        (INI_Dummy+3)
  92. #define ICFG_ENABLE_USER    (INI_Dummy+4)
  93. #define ICFG_INIMASK        (INI_Dummy+5)
  94. #define ICFG_ASSIGN        (INI_Dummy+6)
  95.  
  96. typedef struct IniBase
  97.     {
  98.         struct Library Base;
  99.         ULONG    SegList;
  100.         APTR    SysBase;
  101.         APTR    DosBase;
  102.         INICONFIG *GlobalConfig;
  103.         struct List LocalConfig;
  104.         LONG Flags;
  105.     } INIBASE;
  106.  
  107. typedef long INIERROR;
  108.  
  109. #endif /* LIBRARIES_INI_H */
  110.