home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 13 / AACD13.ISO / AACD / Programming / ini_library / AutoDoc / ini_lib.doc next >
Text File  |  2000-08-08  |  132KB  |  4,734 lines

  1. TABLE OF CONTENTS
  2. 0001 ini.library/--background--
  3. 0002 ini.library/iniAddContext
  4. 0003 ini.library/iniAddContextItem
  5. 0004 ini.library/iniAllocNameStr
  6. 0005 ini.library/iniAllocPMem
  7. 0006 ini.library/iniCheckComment
  8. 0007 ini.library/iniClose
  9. 0008 ini.library/iniCreateContext
  10. 0009 ini.library/iniCreateContextItem
  11. 0010 ini.library/iniDeleteContext
  12. 0011 ini.library/iniDeleteContextItem
  13. 0012 ini.library/iniFindContext
  14. 0013 ini.library/iniFindItem
  15. 0014 ini.library/iniFloatToStr
  16. 0015 ini.library/iniFreeContext
  17. 0016 ini.library/iniFreeContextItem
  18. 0017 ini.library/iniFreeNameStr
  19. 0018 ini.library/iniFreePMem
  20. 0019 ini.library/iniGetArrayLine
  21. 0020 ini.library/iniGetArrayPos
  22. 0021 ini.library/iniGetByteA
  23. 0022 ini.library/iniGetContextItem
  24. 0023 ini.library/iniGetContextItemData
  25. 0024 ini.library/iniGetContextItemDataA
  26. 0025 ini.library/iniGetContextName
  27. 0026 ini.library/iniGetFloat
  28. 0027 ini.library/iniGetFloatA
  29. 0028 ini.library/iniGetLong
  30. 0029 ini.library/iniGetLongA
  31. 0030 ini.library/iniGetNumArrays
  32. 0031 ini.library/iniGetStr
  33. 0032 ini.library/iniGetStrA
  34. 0033 ini.library/iniGetWordA
  35. 0034 ini.library/iniInsertContext
  36. 0035 ini.library/iniInsertContextItem
  37. 0036 ini.library/iniIntToStr
  38. 0037 ini.library/iniOpenDefault
  39. 0038 ini.library/iniOpenFile
  40. 0039 ini.library/iniOpenFromFH
  41. 0040 ini.library/iniOpenMem
  42. 0041 ini.library/iniPutByteA
  43. 0042 ini.library/iniPutFloat
  44. 0043 ini.library/iniPutFloatA
  45. 0044 ini.library/iniPutLong
  46. 0045 ini.library/iniPutLongA
  47. 0046 ini.library/iniPutStr
  48. 0047 ini.library/iniPutStrA
  49. 0048 ini.library/iniPutWordA
  50. 0049 ini.library/iniReadByteA
  51. 0050 ini.library/iniReadFloat
  52. 0051 ini.library/iniReadFloatA
  53. 0052 ini.library/iniReadLong
  54. 0053 ini.library/iniReadLongA
  55. 0054 ini.library/iniReadStr
  56. 0055 ini.library/iniReadStrA
  57. 0056 ini.library/iniReadWordA
  58. 0057 ini.library/iniRemContext
  59. 0058 ini.library/iniRemContextItem
  60. 0059 ini.library/iniSaveFile
  61. 0060 ini.library/iniSaveToFH
  62. 0061 ini.library/iniSetNameStr
  63. 0062 ini.library/iniSetString
  64. 0063 ini.library/iniStrToFloat
  65. 0064 ini.library/iniStrToInt
  66. 0065 ini.library/iniWriteByteA
  67. 0066 ini.library/iniWriteFloat
  68. 0067 ini.library/iniWriteFloatA
  69. 0068 ini.library/iniWriteLong
  70. 0069 ini.library/iniWriteLongA
  71. 0070 ini.library/iniWriteStr
  72. 0071 ini.library/iniWriteStrA
  73. 0072 ini.library/iniWriteWordA
  74. ini.library/--background--
  75.  
  76. PURPOSE
  77.  
  78.        The 'ini.library' was created, because there was no easy way of
  79.        handling configuration files. Each program had it's own format.
  80.  
  81.        This library tries to help you in making a standard file format for
  82.        configuration files. These files are in plain ASCII, so you can use
  83.        your favourite text editor to edit them, and, in addition, of course,
  84.        you can use the prefs section of your program.
  85.  
  86.  
  87. OVERVIEW
  88.  
  89.        The initialization files (INI files) come from Microsoft Windows 3.x.
  90.        They are built up as follows:
  91.        [Context1]
  92.          Item1 = Long1
  93.          Item2 = Long2
  94.          Item3 = LongA1, LongA2, LongA3,
  95.                  LongA4, LongA5, LongA6,
  96.          Item4 = Float1
  97.          Item5 = String1
  98.  
  99.        [Context2]
  100.          Item1 = Float1
  101.        ...
  102.  
  103.        * Easy accessable
  104.  
  105.        The library makes it easy to read/write access those context/item
  106.        fields. You can easily add/remove new items, contexts, etc.
  107.  
  108.        * Comments, etc. are all handled & preserved automatically!
  109.  
  110.        Yes, if you update an INI context item, the comment after the line
  111.        is preserved. That means, if you update the INI file in a program,
  112.        you don't need to have any fears of lossing something.
  113.  
  114.        * Both high- and low-level access functions
  115.   
  116.        You can choose between simply access and complex access. Low level
  117.        functions are for complex access, high level functions are for quick
  118.        and easy access. But the high level functions are a little slower.
  119.  
  120.  
  121.  
  122. ini.library/iniAddContext
  123.  
  124. NAME
  125.        iniAddContext -- adds a new freshly allocated context to an INI file
  126.                         structure
  127.  
  128.  
  129. SYNOPSIS
  130.        iniAddContext( iniFile, ContextStr );
  131.                       A0       A1
  132.  
  133.        void iniAddContext( struct iniFile *, struct iniContext *);
  134.  
  135.  
  136. FUNCTION
  137.        Adds a freshly created context to a specified INI file.
  138.        To add items, you first need to add context items, see there.
  139.  
  140.  
  141. INPUTS
  142.        iniFile - Pointer to INI structure where to add it
  143.        ContextStr - Freshly context structure to add
  144.  
  145.  
  146. EXAMPLE
  147.        struct iniFile *ini;
  148.        struct iniContext *context;
  149.  
  150.        /* Let's open an INI file */
  151.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  152.  
  153.        /* Check if "MyContext" already exists */
  154.        if (!( context = FindContext ( ini, "MyContext" )))
  155.        {
  156.          /* If not, create it! */
  157.          if (!( context = CreateContext ( "MyContext" )))
  158.          {
  159.            puts ( "Couldn't create my context !" );
  160.  
  161.            exit ( 20 );
  162.          }
  163.  
  164.          /* Make context available for access */
  165.          AddContext ( ini, context );
  166.        }
  167.  
  168.  
  169. NOTES
  170.        You need to call this function to make a *NEW* context available
  171.        to the other functions.
  172.  
  173.  
  174. BUGS
  175.  
  176.  
  177. SEE ALSO
  178.        iniCreateContext(), iniFreeContext(), iniRemContext(),
  179.        iniInsertContext(), iniDeleteContext(), <libraries/ini_lib.h>
  180.  
  181.  
  182. ini.library/iniAddContextItem
  183.  
  184. NAME
  185.        iniAddContextItem -- adds a new freshly allocated context item to
  186.                             an context structure
  187.  
  188.  
  189. SYNOPSIS
  190.        iniAddContextItem( ContextStr, ContextItemLine );
  191.                           A0          A1
  192.  
  193.        void iniAddContextItem( struct iniContext *,
  194.            struct iniContextItemLine *);
  195.  
  196.  
  197. FUNCTION
  198.        Adds a freshly created context item to a specified context.
  199.  
  200.  
  201. INPUTS
  202.        ContextStr - Pointer to context structure where to add it
  203.        ContextItemLine - Freshly context item structure to add
  204.  
  205.  
  206. EXAMPLE
  207.        struct iniFile *ini;
  208.        struct iniContext *context;
  209.        struct iniContextItemLine *contextitem;
  210.  
  211.        /* Let's open an INI file */
  212.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  213.  
  214.        context = FindContext ( ini, "MyContext" );
  215.  
  216.        if (!( contextitem = FindContextItem ( context, "MyItem" )))
  217.        {
  218.          /* If not, create it! */
  219.          if (!( contextitem = CreateContextItem ( "MyItem" )))
  220.          {
  221.            puts ( "Couldn't create my context item !" );
  222.  
  223.            exit ( 20 );
  224.          }
  225.  
  226.          /* Make context available for access */
  227.          AddContextItem ( context, contextitem );
  228.        }
  229.  
  230.  
  231. NOTES
  232.        You need to call this function to make a *NEW* context item available
  233.        to the other functions.
  234.  
  235.  
  236. BUGS
  237.  
  238.  
  239. SEE ALSO
  240.        iniCreateContextItem(), iniFreeContextItem(), iniRemContextItem(),
  241.        iniInsertContextItem(), iniDeleteContextItem(), <libraries/ini_lib.h>
  242.  
  243.  
  244. ini.library/iniAllocNameStr
  245.  
  246. NAME
  247.        iniAllocNameStr -- allocate a name string compatible with the library
  248.  
  249.  
  250. SYNOPSIS
  251.        namestring = iniAllocNameStr( string );
  252.        D0                            A0
  253.  
  254.        STRPTR iniAllocNameStr( STRPTR string );
  255.  
  256.  
  257. FUNCTION
  258.        Allocates a name string out of a standard C-String. This is required
  259.        if you use own strings in the library handlers.
  260.  
  261.  
  262. INPUTS
  263.        string - The string to be allocated. Must be null terminated.
  264.  
  265.  
  266. RESULT
  267.        namestring - The initialized name structure. To deallocate, use
  268.            iniFreeNameStr() on this result.
  269.  
  270.  
  271. NOTES
  272.        The namestring is a copy of string, but it's freed via iniFreePMem()
  273.  
  274.  
  275. BUGS
  276.  
  277.  
  278. SEE ALSO
  279.        iniFreeNameStr(), iniSetNameStr(), iniSetString()
  280.  
  281.  
  282. ini.library/iniAllocPMem
  283.  
  284. NAME
  285.        iniAllocPMem -- allocate MEMF_PUBLIC|MEMF_CLEAR memory like AllocMem()
  286.                        but use memory pools if running under OS3.0+
  287.  
  288.  
  289. SYNOPSIS
  290.        memoryBlock = iniAllocPMem( byteSize );
  291.        D0                          D0
  292.  
  293.        APTR iniAllocPMem( ULONG );
  294.  
  295.  
  296. FUNCTION
  297.        Allocates memory always with MEMF_PUBLIC and MEMF_CLEAR flags set and
  298.        uses, if possible, the OS3.0+ memory pools. I have decided to
  299.        implement this function, because the INI library allocates often
  300.        very small chunks of memory, which is handled more efficiency with
  301.        memory pools.
  302.  
  303.        Each memory pool has a size of 32768 bytes and a threshold of
  304.        4096 bytes.
  305.  
  306.  
  307. INPUTS
  308.        byteSize - number of bytes to allocate.
  309.  
  310.  
  311. RESULT
  312.        memoryBlock - the first byte of the allocated memory or NULL if
  313.            the allocation failed.
  314.  
  315.  
  316. NOTES
  317.        Please note that you MUST deallocate memory allocated with
  318.        iniAllocPMem() with iniFreePMem() or it *MAY* crash!
  319.  
  320.        iniAllocPMem() is used always for internal purposes, so that you
  321.        *MUST* allocate all structures used with this lib with this function.
  322.  
  323.  
  324. BUGS
  325.  
  326.  
  327. SEE ALSO
  328.        iniFreePMem(), exec.library/AllocMem(), exec.library/AllocPooled()
  329.  
  330.  
  331. ini.library/iniCheckComment
  332.  
  333. NAME
  334.        iniCheckComment -- Checks if a context line belongs to a comment
  335.  
  336.  
  337. SYNOPSIS
  338.        success = iniCheckComment( ContextStr, ContextItemLine );
  339.        D0                         A0          A1
  340.  
  341.        BOOL iniCheckComment( struct iniContext *,
  342.            struct iniContextItemLine *);
  343.  
  344.  
  345. FUNCTION
  346.        Checks if the given context item line is part of a multiline comment.
  347.        This function is mainly for internal use to easy handle the parsing
  348.        of lines.
  349.  
  350.  
  351. INPUTS
  352.        ContextStr - A pointer to context structure which contains the line
  353.            to be examined.
  354.        ContextItemLine - A pointer to the context item line which should be
  355.            examined.
  356.  
  357.  
  358. RESULT
  359.        success - TRUE if the line is commented else NULL.
  360.  
  361.  
  362. NOTES
  363.  
  364.  
  365. BUGS
  366.  
  367.  
  368. SEE ALSO
  369.        <libraries/ini_lib.h>
  370.  
  371.  
  372. ini.library/iniClose
  373.  
  374. NAME
  375.        iniClose -- Deallocate a loaded INI file
  376.  
  377.  
  378. SYNOPSIS
  379.        iniClose( iniFile );
  380.                  A0
  381.  
  382.        void iniClose( struct iniFile *);
  383.  
  384.  
  385. FUNCTION
  386.        This function is used to deallocate the memory required by the
  387.        the loaded INI file. It deallocates everything in the given INI
  388.        file structure.
  389.  
  390.  
  391. INPUTS
  392.        iniFile - A pointer to the INI file structure to be freed
  393.  
  394.  
  395. EXAMPLE
  396.        struct iniFile *ini;
  397.        ULONG Width;
  398.  
  399.        /* Let's open an INI file to fiddle around with */
  400.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  401.  
  402.        /* Let's do some evaluating (read screen width) */
  403.        Width = iniReadLong ( ini, "Screen", "Width", 640L, 0L );
  404.  
  405.        /* We have the info we need. So close it and free memory */
  406.        iniClose ( ini );
  407.  
  408.  
  409. NOTES
  410.        All memory blocks inside must be allocated using iniAllocPMem() or
  411.        iniAllocNameStr() or it may crash!
  412.  
  413.  
  414. BUGS
  415.  
  416.  
  417. SEE ALSO
  418.        iniOpenFile(), iniOpenFromFH(), iniOpenMem(), <libraries/ini_lib.h>
  419.  
  420.  
  421. ini.library/iniCreateContext
  422.  
  423. NAME
  424.        iniCreateContext -- Creates a new context chunk to be used
  425.  
  426.  
  427. SYNOPSIS
  428.        ContextStr = iniCreateContext( ContextName );
  429.        D0                             A0
  430.  
  431.        struct iniContext *iniCreateContext( STRPTR ContextName );
  432.  
  433.  
  434. FUNCTION
  435.        Creates a new context structure. It must be added with iniAddContext()
  436.        to an INI file structure. The name given mustn't be an AllocNameStr()
  437.        string. Because it's created automatically during the creation
  438.        process.
  439.  
  440.  
  441. INPUTS
  442.        ContextName - The line string of the context
  443.  
  444.  
  445. EXAMPLE
  446.        struct iniFile *ini;
  447.        struct iniContext *context;
  448.  
  449.        /* Let's open an INI file */
  450.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  451.  
  452.        /* Check if "MyContext" already exists */
  453.        if (!( context = FindContext ( ini, "MyContext" )))
  454.        {
  455.          /* If not, create it! */
  456.          if (!( context = CreateContext ( "MyContext" )))
  457.          {
  458.            puts ( "Couldn't create my context !" );
  459.  
  460.            exit ( 20 );
  461.          }
  462.  
  463.          /* Make context available for access */
  464.          AddContext ( ini, context );
  465.        }
  466.  
  467.  
  468. NOTES
  469.        ContextName is only the context name itself, not the full line,
  470.        e.g. "Display", and not "[ Display ]".
  471.  
  472.  
  473. BUGS
  474.        In ini.library v31 you had to give the full context line, i.e.
  475.        "[ Display ]".
  476.  
  477.  
  478. SEE ALSO
  479.        iniCreateContextItem(), iniFreeContext(), iniAddContext(),
  480.        iniInsertContext(), <libraries/ini_lib.h>
  481.  
  482.  
  483. ini.library/iniCreateContextItem
  484.  
  485. NAME
  486.        iniCreateContextItem -- creates a new context item to be used
  487.  
  488.  
  489. SYNOPSIS
  490.        ContextItemLine = iniCreateContextItem( CStr );
  491.        D0                                      A0
  492.  
  493.        struct iniContextItemLine *iniCreateContextItem( STRPTR CStr );
  494.  
  495.  
  496. FUNCTION
  497.        Creates a new context item line to be used. The string will be used
  498.        as a context line name. Add the result structure to the context
  499.        structure to make it available in the INI file structure.
  500.  
  501.  
  502. INPUTS
  503.        CStr - A null terminated string which will be stored as a
  504.            iniAllocNameStr() string.
  505.  
  506.  
  507. RESULT
  508.        ContextItemLine - The context item structure that can be added to
  509.            the desired context.
  510.  
  511.  
  512. EXAMPLE
  513.        struct iniFile *ini;
  514.        struct iniContext *context;
  515.        struct iniContextItemLine *contextitem;
  516.  
  517.        /* Let's open an INI file */
  518.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  519.  
  520.        context = FindContext ( ini, "MyContext" );
  521.  
  522.        if (!( contextitem = FindContextItem ( context, "MyItem" )))
  523.        {
  524.          /* If not, create it! */
  525.          if (!( contextitem = CreateContextItem ( "MyItem" )))
  526.          {
  527.            puts ( "Couldn't create my context item !" );
  528.  
  529.            exit ( 20 );
  530.          }
  531.  
  532.          /* Make context available for access */
  533.          AddContextItem ( context, contextitem );
  534.        }
  535.  
  536.  
  537. NOTES
  538.        The context item is initialized with 0.
  539.  
  540.  
  541. BUGS
  542.        In ini.library v31 the context item was not initialized.
  543.  
  544.  
  545. SEE ALSO
  546.       iniCreateContext(), iniFreeContextItem(), iniAddContextItem(),
  547.       iniInsertContextItem(), <libraries/ini_lib.h>
  548.  
  549.  
  550. ini.library/iniDeleteContext
  551.  
  552. NAME
  553.        iniDeleteContext -- deletes a context from an INI file structure
  554.  
  555.  
  556. SYNOPSIS
  557.        iniDeleteContext( ContextStr );
  558.                          A0
  559.  
  560.        void iniDeleteContext( struct iniContext *);
  561.  
  562.  
  563. FUNCTION
  564.        Deletes a context of an INI file and all its associated lines.
  565.        Memory will not be freed. To deallocate, use iniFreeContext()
  566.  
  567.  
  568. INPUTS
  569.        ContextStr - The context structure to be deleted
  570.  
  571.  
  572. RESULT
  573.  
  574.  
  575. NOTES
  576.        Please note that this function removes only the node from the
  577.        INI file structure and doesn't deallocate any memory.
  578.  
  579.  
  580. BUGS
  581.  
  582.  
  583. SEE ALSO
  584.       iniFreeContext(), iniRemContext(), iniInsertContext(),
  585.       <libraries/ini_lib.h>
  586.  
  587.  
  588. ini.library/iniDeleteContextItem
  589.  
  590. NAME
  591.        iniDeleteContextItem -- deletes a context item line from an INI file.
  592.  
  593.  
  594. SYNOPSIS
  595.        iniDeleteContextItem( ContextItemLine );
  596.                              A0
  597.  
  598.        void iniDeleteContextItem( struct iniContextItemLine *);
  599.  
  600.  
  601. FUNCTION
  602.        Deletes a context item line from an INI context. It doesn't
  603.        deallocate any memory, so it can be added otherwise.
  604.  
  605.  
  606. INPUTS
  607.        ContextItemLine - The pointer of the context item line to be deleted.
  608.  
  609.  
  610. RESULT
  611.  
  612.  
  613. NOTES
  614.        Please note that just the node is removed from the context structure
  615.        and there are no deallocation processes. Use iniFreeContextItem()
  616.        for this purpose.
  617.  
  618.  
  619. BUGS
  620.  
  621.  
  622. SEE ALSO
  623.        iniFreeContextItem(), iniRemContextItem(), iniInsertContextItem(),
  624.        <libraries/ini_lib.h>
  625.  
  626.  
  627. ini.library/iniFindContext
  628.  
  629. NAME
  630.        iniFindContext -- Search for a context in an INI file.
  631.  
  632.  
  633. SYNOPSIS
  634.        ContextStr = iniFindContext( iniFile, ContextName, Flags );
  635.        D0                           A0       A1           D0
  636.  
  637.        struct iniContext *iniFindContext( struct iniFile *,
  638.            STRPTR, ULONG );
  639.  
  640.  
  641. FUNCTION
  642.        Searches a loaded INI file for the specified context.
  643.  
  644.  
  645. INPUTS
  646.        iniFile - Pointer to INI structure to search
  647.        ContextName - Name of the context to be searched
  648.        Flags - Search flags. They're currently defined as:
  649.            INIF_ContextCase - Set this flag if the search of the context
  650.                name should be case sensitive.
  651.  
  652.  
  653. RESULT
  654.        ContextStr - The context structure if the context was found else
  655.            NULL.
  656.  
  657.  
  658. EXAMPLE
  659.        struct iniFile *ini;
  660.        struct iniContext *context;
  661.  
  662.        /* Let's open an INI file */
  663.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  664.  
  665.        /* Check if "MyContext" already exists */
  666.        if (!( context = FindContext ( ini, "MyContext" )))
  667.        {
  668.          /* If not, create it! */
  669.          if (!( context = CreateContext ( "MyContext" )))
  670.          {
  671.            puts ( "Couldn't create my context !" );
  672.  
  673.            exit ( 20 );
  674.          }
  675.  
  676.          /* Make context available for access */
  677.          AddContext ( ini, context );
  678.        }
  679.  
  680.  
  681. NOTES
  682.  
  683.  
  684. BUGS
  685.  
  686.  
  687. SEE ALSO
  688.        iniCreateContext(), iniFindItem(), <libraries/ini_lib.h>
  689.  
  690.  
  691. ini.library/iniFindItem
  692.  
  693. NAME
  694.        iniFindItem -- finds a context item in a specified context
  695.  
  696.  
  697. SYNOPSIS
  698.        ContextItemLine = iniFindItem( ContextStr, ContextItemName, Flags );
  699.        D0                             A0          A1               D0
  700.  
  701.        struct iniContextItemLine *iniFindItem( struct iniContext *,
  702.            STRPTR, ULONG );
  703.  
  704.  
  705. FUNCTION
  706.        Searches for a context item in the specified context
  707.  
  708.  
  709. INPUTS
  710.        ContextStr - Context structure where to search in
  711.        ContextItemName - Name of the context item to be searched
  712.        Flags - Search flags. They're currently defined as:
  713.            INIF_ContextItemCase - Set this flag if the search of the context
  714.                item name should be case sensitive.
  715.  
  716.  
  717. RESULT
  718.        ContextItemLine - The context item structure if the context item
  719.            was found else NULL.
  720.  
  721.  
  722. EXAMPLE
  723.        struct iniFile *ini;
  724.        struct iniContext *context;
  725.        struct iniContextItemLine *contextitem;
  726.  
  727.        /* Let's open an INI file */
  728.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  729.  
  730.        context = FindContext ( ini, "MyContext" );
  731.  
  732.        if (!( contextitem = FindContextItem ( context, "MyItem" )))
  733.        {
  734.          /* If not, create it! */
  735.          if (!( contextitem = CreateContextItem ( "MyItem" )))
  736.          {
  737.            puts ( "Couldn't create my context item !" );
  738.  
  739.            exit ( 20 );
  740.          }
  741.  
  742.          /* Make context available for access */
  743.          AddContextItem ( context, contextitem );
  744.        }
  745.  
  746.  
  747. NOTES
  748.  
  749.  
  750. BUGS
  751.  
  752.  
  753. SEE ALSO
  754.       iniCreateContextItem(), iniFindContext(), <libraries/ini_lib.h>
  755.  
  756.  
  757. ini.library/iniFloatToStr
  758.  
  759. NAME
  760.        iniFloatToStr -- Converts a quick float value to a string.
  761.  
  762.  
  763. SYNOPSIS
  764.        string = iniFloatToStr( Buffer, Float, FltFormat, IntLen, FracLen,
  765.        D0                      A0      D0     D1         D2      D3
  766.                                ZeroSep );
  767.                                D4:8
  768.  
  769.        STRPTR iniFloatToStr( STRPTR, ULONG, ULONG, ULONG, ULONG, UBYTE );
  770.  
  771.  
  772. FUNCTION
  773.        This function is used to convert a quick float value to a standard
  774.        ASCII string. A quick float value has in it's upper 16-bits the
  775.        decimal value and in the lower 16-bits the fraction. That means, the
  776.        highest possible accuracy is 1/65536.
  777.  
  778.  
  779. INPUTS
  780.        Buffer - A pointer to at least a 128 byte buffer or NULL to create a
  781.            new one.
  782.        Float - Quick float value to convert.
  783.        FltFormat - Format of the floating point value. Can be any of:
  784.            INI_FLOAT_FORMAT_DEC - Use decimal with point separator
  785.            INI_FLOAT_UNSIGNED - Add this to indicate unsigned quick float
  786.        IntLen - Forced length of integer part or NULL for no force.
  787.        FracLen - Forced length of fractional part or NULL for no force.
  788.        ZeroSep - Zero character for IntLen leading zeroes. Usually " " or "0"
  789.  
  790.  
  791. RESULT
  792.        string - Pointer to the string where the converted string is stored.
  793.  
  794.  
  795. EXAMPLE
  796.        STRPTR Buffer;
  797.  
  798.        Buffer = iniFloatToStr ( 0x28000, INI_FLOAT_FORMAT_DEC, 3, 2, ' ');
  799.  
  800.        /* Buffer will contain: "  2.50" */
  801.  
  802.        puts ( Buffer );
  803.  
  804.        iniFreeNameStr ( Buffer );
  805.  
  806. NOTES
  807.  
  808.  
  809. BUGS
  810.       The buffer is not checked for overflow. That means, IntLen and FracLen
  811.       should not be greater than 90% of your buffer when added together.
  812.  
  813.  
  814. SEE ALSO
  815.       iniStrToFloat(), iniStrToInt(), iniIntToStr(), <libraries/ini_lib.h>
  816.  
  817.  
  818. ini.library/iniFreeContext
  819.  
  820. NAME
  821.        iniFreeContext -- Deletes if necessary and deallocates a context
  822.            structure.
  823.  
  824.  
  825. SYNOPSIS
  826.        iniFreeContext( ContextStr );
  827.                        A0
  828.  
  829.        void iniFreeContext( struct iniContext *);
  830.  
  831.  
  832. FUNCTION
  833.        This function removes first (see iniDeleteContext()), if necessary a
  834.        context structure and then deallocates the memory used by it using
  835.        iniFreePMem() and iniFreeNameStr().
  836.  
  837.  
  838. INPUTS
  839.        ContextStr - A pointer to a context structure to be deallocated.
  840.  
  841.  
  842. RESULT
  843.  
  844.  
  845. NOTES
  846.        The structure MUST be allocated with iniAllocPMem() and the strings
  847.        must be allocated with iniAllocNameStr()
  848.  
  849.  
  850. BUGS
  851.  
  852.  
  853. SEE ALSO
  854.        iniCreateContext(), iniRemContext(), iniDeleteContext(),
  855.        iniFreeContextItem(), <libraries/ini_lib.h>
  856.  
  857.  
  858. ini.library/iniFreeContextItem
  859.  
  860. NAME
  861.        iniFreeContextItem -- Deallocates a context item structure
  862.  
  863.  
  864. SYNOPSIS
  865.        iniFreeContextItem( ContextItemLine );
  866.                            A0
  867.  
  868.        void iniFreeContextItem( struct iniContextItemLine *);
  869.  
  870.  
  871. FUNCTION
  872.        Removes (if necessary) a context item line and deallocates the memory
  873.        required by it afterwards. iniFreePMem() and iniFreeNameStr() are
  874.        used for deallocation.
  875.  
  876.  
  877. INPUTS
  878.        ContextItemLine - Pointer to the context item line to be deallocated.
  879.  
  880.  
  881. RESULT
  882.  
  883.  
  884. NOTES
  885.        The structure MUST be allocated with iniAllocPMem() and the strings
  886.        need to be allocated with iniAllocNameStr().
  887.  
  888.  
  889. BUGS
  890.  
  891.  
  892. SEE ALSO
  893.       iniCreateContextItem(), iniRemContextItem(), iniDeleteContextItem(),
  894.       iniFreeContext(), <libraries/ini_lib.h>
  895.  
  896.  
  897. ini.library/iniFreeNameStr
  898.  
  899. NAME
  900.        iniFreeNameStr -- Deallocate an iniAllocNameStr() name structure.
  901.  
  902.  
  903. SYNOPSIS
  904.        iniFreeNameStr( namestring );
  905.                        A0
  906.  
  907.        void iniFreeNameStr( STRPTR );
  908.  
  909.  
  910. FUNCTION
  911.        Deallocates a name structure, allocated previously by
  912.        iniAllocNameStr()
  913.  
  914.  
  915. INPUTS
  916.        namestring - A pointer to a previously allocated name string. The
  917.            size of deallocation is calculated automatically.
  918.  
  919.  
  920. RESULT
  921.  
  922.  
  923. NOTES
  924.        Please deallocate ONLY those things allocated with iniAllocNameStr()
  925.        with this function, since the allocation mechanism may change at any
  926.        time!
  927.  
  928.  
  929. BUGS
  930.  
  931.  
  932. SEE ALSO
  933.        iniAllocNameStr(), iniAllocPMem(), iniFreePMem()
  934.  
  935.  
  936. ini.library/iniFreePMem
  937.  
  938. NAME
  939.        iniFreePMem -- deallocates memory allocated by iniAllocPMem()
  940.  
  941.  
  942. SYNOPSIS
  943.        iniFreePMem( memoryBlock, byteSize)
  944.                     A1           D0
  945.  
  946.        void iniFreePMem( APTR, ULONG );
  947.  
  948.  
  949. FUNCTION
  950.        Deallocates any memory allocated by iniFreePMem(), it works just like
  951.        the exec.library/FreeMem function.
  952.  
  953.  
  954. INPUTS
  955.        memoryBlock - The block that should be deallocated
  956.        byteSize - Number of bytes to be deallocated. It is aligned
  957.            automatically.
  958.  
  959.  
  960. RESULT
  961.  
  962.  
  963. NOTES
  964.        Please use this function to deallocate ONLY iniAllocPMem() blocks,
  965.        if you don't do this, the system may crash within OS3.0+, since the
  966.        function uses memory pools in that case.
  967.  
  968.  
  969. BUGS
  970.  
  971.  
  972. SEE ALSO
  973.        iniAllocPMem()
  974.  
  975.  
  976. ini.library/iniGetArrayLine
  977.  
  978. NAME
  979.        iniGetArrayLine -- Returns the array line of the context item number
  980.  
  981.  
  982. SYNOPSIS
  983.        ContextItemPos = iniGetArrayLine( ContextStr, ContextItemLine,
  984.        D0                                A0          A1
  985.                                          Number );
  986.                                          D0
  987.  
  988.        struct iniContextItemLine *iniGetArrayLine( struct iniContext *,
  989.                              struct iniContextItemLine *, ULONG );
  990.  
  991.  
  992. FUNCTION
  993.        Gets the context item line structure of the given context item's nth
  994.        array (nth is the Number given in D0)
  995.  
  996.  
  997. INPUTS
  998.        ContextStr - Context structure where context item is
  999.        ContextItemLine - Context item line where's array's first entry.
  1000.        Number - Array number of which the line address should be returned.
  1001.  
  1002.  
  1003. RESULT
  1004.        ContextItemLine - Context item line address of the number given.
  1005.  
  1006.  
  1007. NOTES
  1008.        This function is mainly only for internal purposes. It allows
  1009.        array handling faster.
  1010.  
  1011.  
  1012. BUGS
  1013.  
  1014.  
  1015. SEE ALSO
  1016.        iniGetNumArrays(), iniGetArrayPos(), <libraries/ini_lib.h>
  1017.  
  1018.  
  1019. ini.library/iniGetArrayPos
  1020.  
  1021. NAME
  1022.        iniGetArrayPos -- Returns the position of the context item number.
  1023.  
  1024.  
  1025. SYNOPSIS
  1026.        ContextItemPos = iniGetArrayPos( ContextStr, ContextItemLine,
  1027.        D0                               A0          A1
  1028.                                         Number );
  1029.                                         D0
  1030.  
  1031.        struct iniContextItemLine *iniGetArrayPos( struct iniContext *,
  1032.                              struct iniContextItemLine *, ULONG );
  1033.  
  1034.  
  1035. FUNCTION
  1036.        Gets the line position of the given context item's nth array
  1037.        (nth is the Number given in D0)
  1038.  
  1039.  
  1040. INPUTS
  1041.        ContextStr - Context structure where context item is
  1042.        ContextItemLine - Context item line where's array's first entry.
  1043.        Number - Array number of which the line position should be returned.
  1044.  
  1045.  
  1046. RESULT
  1047.        ContextItemLine - Context item line address of the number given.
  1048.  
  1049.  
  1050. NOTES
  1051.        This function is mainly only for internal purposes. It allows
  1052.        easy array access.
  1053.  
  1054.  
  1055. BUGS
  1056.  
  1057.  
  1058. SEE ALSO
  1059.        iniGetNumArrays(), iniGetArrayLine(), <libraries/ini_lib.h>
  1060.  
  1061.  
  1062. ini.library/iniGetByteA
  1063.  
  1064. NAME
  1065.        iniGetByteA -- reads a context item array into a (U)BYTE array.
  1066.  
  1067.  
  1068. SYNOPSIS
  1069.        success = iniGetByteA( ContextStr, ContextItemLine, Array, Entries );
  1070.        D0                     A0          A1               A2     D0
  1071.  
  1072.        BOOL iniGetByteA( struct iniContext *, struct iniContextItemLine *,
  1073.            BYTE *, ULONG );
  1074.  
  1075.  
  1076. FUNCTION
  1077.        Reads a context item array and stores the read bytes into a
  1078.        (U)BYTE table you specified.
  1079.  
  1080.  
  1081. INPUTS
  1082.        ContextStr - The context structure where the context line is in
  1083.        ContextItemLine - The context item line where the array is
  1084.        Array - An (U)BYTE array where to store the values
  1085.        Entries - Number of entries to read (further entries will be ignored)
  1086.  
  1087.  
  1088. RESULT
  1089.        success - TRUE if line could be evaluated else FALSE
  1090.  
  1091.  
  1092. EXAMPLE
  1093.        struct iniFile *ini;
  1094.        struct iniContext *context;
  1095.        struct iniContextItemLine *contextitem;
  1096.        BYTE MyArray[4] = {-2, -1, -0, 1};
  1097.  
  1098.        /* Let's open an INI file */
  1099.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  1100.  
  1101.        context = FindContext ( ini, "MyContext" );
  1102.  
  1103.        if (!( contextitem = FindContextItem ( context, "MyItem" )))
  1104.        {
  1105.          /* If not, create it! */
  1106.          if (!( contextitem = CreateContextItem ( "MyItem" )))
  1107.          {
  1108.            puts ( "Couldn't create my context item !" );
  1109.  
  1110.            exit ( 20 );
  1111.          }
  1112.  
  1113.          /* Make context available for access */
  1114.          AddContextItem ( context, contextitem );
  1115.        }
  1116.  
  1117.        iniGetByteA ( context, contextitem, MyArray, sizeof (MyArray));
  1118.  
  1119.        /* Let's say, ENVARC:MyPrefs.INI contains:
  1120.           [MyContext]
  1121.           MyItem = 25, 50, 75, 100
  1122.  
  1123.           then
  1124.           MyArray[4] = {25, 50, 75, 100};
  1125.           Entries which can't be evaluated are left unchanged.
  1126.        */
  1127.  
  1128.  
  1129. NOTES
  1130.        Make sure that the given array is big enough to hold all values or
  1131.        some memory area may be overwritten.
  1132.  
  1133.        Fields which can't be evaluated are left unchanged.
  1134.  
  1135.  
  1136. BUGS
  1137.  
  1138.  
  1139. SEE ALSO
  1140.        iniGetWordA(), iniGetLongA(), iniReadByteA(), iniPutByteA(),
  1141.        <libraries/ini_lib.h>
  1142.  
  1143.  
  1144. ini.library/iniGetContextItem
  1145.  
  1146. NAME
  1147.        iniGetContextItem -- Gets the name of the context item
  1148.  
  1149.  
  1150. SYNOPSIS
  1151.        Buffer = iniGetContextItem( ContextStr, ContextItemLine, Buffer );
  1152.        D0                          A0          A1               A2
  1153.  
  1154.        STRPTR iniGetContextItem( struct iniContext *,
  1155.            struct iniContextItemLine *, STRPTR );
  1156.  
  1157.  
  1158. FUNCTION
  1159.        Gets the context item name of the context item line given
  1160.  
  1161.  
  1162. INPUTS
  1163.        ContextStr - Context structure where context item lies
  1164.        ContextItemLine - Pointer to context item line structure
  1165.        Buffer - Optional buffer where to store name or NULL to create new
  1166.  
  1167.  
  1168. RESULT
  1169.        Buffer - STRPTR to newly created buffer if none was specified or NULL
  1170.            on error. If existing buffer was given, it will be returned
  1171.            instead.
  1172.  
  1173.  
  1174. NOTES
  1175.        This function is called by all functions which evaluate INI file
  1176.        context item data. It is, in fact, a low level function. The given
  1177.        buffer must have a mininum size of 128 bytes.
  1178.        If no buffer is given, the new one must be freed with iniFreeNameStr()
  1179.  
  1180.  
  1181. BUGS
  1182.  
  1183.  
  1184. SEE ALSO
  1185.        iniGetContextName(), iniGetContextItemData(),
  1186.        iniGetContextItemDataA(), <libraries/ini_lib.h>
  1187.  
  1188.  
  1189. ini.library/iniGetContextItemData
  1190.  
  1191. NAME
  1192.        iniGetContextItemData -- Gets the data of the context item
  1193.  
  1194.  
  1195. SYNOPSIS
  1196.        Buffer = iniGetContextItemData( ContextStr, ContextItemLine, Buffer );
  1197.        D0                              A0          A1               A2
  1198.  
  1199.        STRPTR iniGetContextItemData( struct iniContext *,
  1200.            struct iniContextItemLine *, STRPTR );
  1201.  
  1202.  
  1203. FUNCTION
  1204.        Gets the context item data of the context item line given
  1205.  
  1206.  
  1207. INPUTS
  1208.        ContextStr - Context structure where context item data lies
  1209.        ContextItemLine - Pointer to context item line structure
  1210.        Buffer - Optional buffer where to store data or NULL to create new
  1211.  
  1212.  
  1213. RESULT
  1214.        Buffer - STRPTR to newly created buffer if none was specified or NULL
  1215.            on error. If existing buffer was given, it will be returned
  1216.            instead.
  1217.  
  1218.  
  1219. NOTES
  1220.        This function is called by all functions which evaluate INI file
  1221.        context item data. It is, in fact, a low level function. The given
  1222.        buffer must have a mininum size of 128 bytes.
  1223.        If no buffer is given, the new one must be freed with iniFreeNameStr()
  1224.  
  1225.  
  1226. BUGS
  1227.  
  1228.  
  1229. SEE ALSO
  1230.        iniGetContextName(), iniGetContextItem(), iniContextItemDataA(),
  1231.        <libraries/ini_lib.h>
  1232.  
  1233.  
  1234. ini.library/iniGetContextItemDataA
  1235.  
  1236. NAME
  1237.        iniGetContextItemDataA -- Gets the data of the context item array
  1238.  
  1239.  
  1240. SYNOPSIS
  1241.        Buffer = iniGetContextItemDataA( ContextStr, ContextItemLine,
  1242.        D0                               A0          A1
  1243.                                         Buffer, Number );
  1244.                                         A2      D0
  1245.  
  1246.        STRPTR iniGetContextItemDataA( struct iniContext *,
  1247.            struct iniContextItemLine *, STRPTR, ULONG );
  1248.  
  1249.  
  1250. FUNCTION
  1251.        Gets the context item array data of the context item line given
  1252.  
  1253.  
  1254. INPUTS
  1255.        ContextStr - Context structure where context item array lies
  1256.        ContextItemLine - Pointer to context item line structure
  1257.        Buffer - Optional buffer where to store data or NULL to create new
  1258.        Number - The entry which should be extracted out of the array. NULL
  1259.            is the first one
  1260.  
  1261.  
  1262. RESULT
  1263.        Buffer - STRPTR to newly created buffer if none was specified or NULL
  1264.            on error. If existing buffer was given, it will be returned
  1265.            instead.
  1266.  
  1267.  
  1268. NOTES
  1269.        This function is called by all functions which evaluate INI file
  1270.        context item array data. It is, in fact, a low level function. The
  1271.        given buffer must have a mininum size of 128 bytes.
  1272.        If no buffer is given, the new one must be freed with iniFreeNameStr()
  1273.  
  1274.  
  1275. BUGS
  1276.  
  1277.  
  1278. SEE ALSO
  1279.        iniGetContextName(), iniGetContextItem(), iniGetContextItemData(),
  1280.        <libraries/ini_lib.h>
  1281.  
  1282.  
  1283. ini.library/iniGetContextName
  1284.  
  1285. NAME
  1286.        iniGetContextName - Gets the name of the context
  1287.  
  1288.  
  1289. SYNOPSIS
  1290.        Buffer = iniGetContextName( ContextLine, Buffer );
  1291.        D0                          A0           A1
  1292.  
  1293.        STRPTR iniGetContextName( STRPTR, STRPTR );
  1294.  
  1295.  
  1296. FUNCTION
  1297.        Gets the context name of the context line given
  1298.  
  1299.  
  1300. INPUTS
  1301.        ContextStr - Context structure where context line lies
  1302.        Buffer - Optional buffer where to store name or NULL to create new
  1303.  
  1304.  
  1305. RESULT
  1306.        Buffer - STRPTR to newly created buffer if none was specified or NULL
  1307.            on error. If existing buffer was given, it will be returned
  1308.            instead.
  1309.  
  1310.  
  1311. NOTES
  1312.        This function is called by all functions which evaluate INI file
  1313.        context names. It is, in fact, a low level function. The given
  1314.        buffer must have a mininum size of 128 bytes.
  1315.        If no buffer is given, the new one must be freed with iniFreeNameStr()
  1316.  
  1317.  
  1318. BUGS
  1319.  
  1320.  
  1321. SEE ALSO
  1322.        iniGetContextItem(), iniGetContextItemData(),
  1323.        iniGetContextItemDataA(), <libraries/ini_lib.h>
  1324.  
  1325.  
  1326. ini.library/iniGetFloat
  1327.  
  1328. NAME
  1329.        iniGetFloat -- Gets a quick floating point value
  1330.  
  1331.  
  1332. SYNOPSIS
  1333.        QFloatValue = iniGetFloat( ContextStr, ContextItemLine, Default );
  1334.        D0                         A0          A1               D0
  1335.  
  1336.        LONG iniGetFloat( struct iniContext *, struct iniContextItemLine *,
  1337.            LONG );
  1338.  
  1339.  
  1340. FUNCTION
  1341.        Reads a quick float value out of the given context item line
  1342.  
  1343.  
  1344. INPUTS
  1345.        ContextStr - Context structure where quick float value lies in
  1346.        ContextItemLine - Context item line where to extract quick float
  1347.        Default - Default value to take if it can't be evaluated
  1348.  
  1349.  
  1350. RESULT
  1351.        QFloatValue - The quick float value extracted out of the context item
  1352.            line
  1353.  
  1354.  
  1355. EXAMPLE
  1356.        struct iniFile *ini;
  1357.        struct iniContext *context;
  1358.        struct iniContextItemLine *contextitem;
  1359.        LONG MyFloat;
  1360.  
  1361.        /* Let's open an INI file */
  1362.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  1363.  
  1364.        context = FindContext ( ini, "MyContext" );
  1365.  
  1366.        if (!( contextitem = FindContextItem ( context, "MyItem" )))
  1367.        {
  1368.          /* If not, create it! */
  1369.          if (!( contextitem = CreateContextItem ( "MyItem" )))
  1370.          {
  1371.            puts ( "Couldn't create my context item !" );
  1372.  
  1373.            exit ( 20 );
  1374.          }
  1375.  
  1376.          /* Make context available for access */
  1377.          AddContextItem ( context, contextitem );
  1378.        }
  1379.  
  1380.        MyFloat = iniGetFloat ( context, contextitem, 0x28000 ));
  1381.  
  1382.        /* Let's say, ENVARC:MyPrefs.INI contains:
  1383.           [MyContext]
  1384.           MyItem = 3.0
  1385.  
  1386.           then MyFloat will contain 0x30000. If this context or context item
  1387.           is not available, MyFloat will contain 0x28000 (default) instead.
  1388.        */
  1389.  
  1390.  
  1391. NOTES
  1392.        This function is called from iniReadFloat().
  1393.        Only the first four fractional digits are evaluated. However, the
  1394.        5th digit is evaluated for rounding purposes.
  1395.  
  1396.  
  1397. BUGS
  1398.  
  1399.  
  1400. SEE ALSO
  1401.        iniGetLong(), iniGetStr(), iniGetFloatA(), iniPutFloat(),
  1402.        iniReadFloat(), iniWriteFloat(), <libraries/ini_lib.h>
  1403.  
  1404.  
  1405. ini.library/iniGetFloatA
  1406.  
  1407. NAME
  1408.        iniGetFloatA -- Gets quick floating point value(s) out of an array
  1409.  
  1410.  
  1411. SYNOPSIS
  1412.        success = iniGetFloatA( ContextStr, ContextItemLine, Array, Entries );
  1413.        D0                      A0          A1               A2     D0
  1414.  
  1415.        BOOL iniGetFloatA( struct iniContext *, struct iniContextItemLine *,
  1416.            LONG *, ULONG );
  1417.  
  1418.  
  1419. FUNCTION
  1420.        Reads one or more quick float value(s) out of the given context item
  1421.        line
  1422.  
  1423.  
  1424. INPUTS
  1425.        ContextStr - Context structure where quick float values lie in
  1426.        ContextItemLine - Context item line where to extract quick floats
  1427.        Array - The array where to store the quick float values
  1428.        Entries - Number of array entries. If the array in the INI file is
  1429.             bigger, the remaining entries will be ignored.
  1430.  
  1431.  
  1432. RESULT
  1433.        success - TRUE if accessing was successful else NULL.
  1434.  
  1435.  
  1436. EXAMPLE
  1437.        struct iniFile *ini;
  1438.        struct iniContext *context;
  1439.        struct iniContextItemLine *contextitem;
  1440.        LONG MyFloat[4] = {-0x10000, -0x8000, 0, 0x8000};
  1441.  
  1442.        /* Let's open an INI file */
  1443.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  1444.  
  1445.        context = FindContext ( ini, "MyContext" );
  1446.  
  1447.        if (!( contextitem = FindContextItem ( context, "MyItem" )))
  1448.        {
  1449.          /* If not, create it! */
  1450.          if (!( contextitem = CreateContextItem ( "MyItem" )))
  1451.          {
  1452.            puts ( "Couldn't create my context item !" );
  1453.  
  1454.            exit ( 20 );
  1455.          }
  1456.  
  1457.          /* Make context available for access */
  1458.          AddContextItem ( context, contextitem );
  1459.        }
  1460.  
  1461.        iniGetFloatA ( context, contextitem, MyFloat,
  1462.                       (sizeof (MyFloat) / sizeof (LONG)) );
  1463.  
  1464.        /* Let's say, ENVARC:MyPrefs.INI contains:
  1465.           [MyContext]
  1466.           MyItem = 1.0, 1.5, 2.0, 2.5
  1467.  
  1468.           then
  1469.           MyFloat[4] = {0x10000, 0x18000, 0x20000, 0x28000};
  1470.           Entries which can't be evaluated are left unchanged.
  1471.        */
  1472.  
  1473.  
  1474. NOTES
  1475.        This function is called from iniReadFloatA().
  1476.        Only the first four fractional digits are evaluated. However, the
  1477.        5th digit is evaluated for rounding purposes.
  1478.        Array fields which can't be evaluated (e.g. bad syntax) are left
  1479.        unchanged. So it's good to fill the array with default values first.
  1480.  
  1481.  
  1482. BUGS
  1483.  
  1484.  
  1485. SEE ALSO
  1486.        iniGetLongA(), iniGetStrA(), iniGetFloat(), iniPutFloatA(),
  1487.        iniReadFloatA(), iniWriteFloatA(), <libraries/ini_lib.h>
  1488.  
  1489.  
  1490. ini.library/iniGetLong
  1491.  
  1492. NAME
  1493.        iniGetLong -- Gets a long integer value
  1494.  
  1495.  
  1496. SYNOPSIS
  1497.        LongValue = iniGetLong( ContextStr, ContextItemLine, Default );
  1498.        D0                      A0          A1               D0
  1499.  
  1500.        LONG iniGetLong( struct iniContext *, struct iniContextItemLine *,
  1501.            LONG );
  1502.  
  1503.  
  1504. FUNCTION
  1505.        Reads a long integer value out of the given context item line
  1506.  
  1507.  
  1508. INPUTS
  1509.        ContextStr - Context structure where long integer value lies in
  1510.        ContextItemLine - Context item line where to extract long integer
  1511.        Default - Default value to take if it can't be evaluated
  1512.  
  1513.  
  1514. RESULT
  1515.        LongValue - The long integer value extracted out of the context item
  1516.            line
  1517.  
  1518.  
  1519. EXAMPLE
  1520.        struct iniFile *ini;
  1521.        struct iniContext *context;
  1522.        struct iniContextItemLine *contextitem;
  1523.        LONG MyLong;
  1524.  
  1525.        /* Let's open an INI file */
  1526.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  1527.  
  1528.        context = FindContext ( ini, "MyContext" );
  1529.  
  1530.        if (!( contextitem = FindContextItem ( context, "MyItem" )))
  1531.        {
  1532.          /* If not, create it! */
  1533.          if (!( contextitem = CreateContextItem ( "MyItem" )))
  1534.          {
  1535.            puts ( "Couldn't create my context item !" );
  1536.  
  1537.            exit ( 20 );
  1538.          }
  1539.  
  1540.          /* Make context available for access */
  1541.          AddContextItem ( context, contextitem );
  1542.        }
  1543.  
  1544.        MyLong = iniGetLong ( context, contextitem, 12345678 );
  1545.  
  1546.        /* Let's say, ENVARC:MyPrefs.INI contains:
  1547.           [MyContext]
  1548.           MyItem = -256
  1549.  
  1550.           then MyLong will contain -256. If this context or context item
  1551.           is not available, MyLong will contain 12345678 (default) instead.
  1552.        */
  1553.  
  1554.  
  1555. NOTES
  1556.        This function is called from iniReadLong().
  1557.  
  1558.  
  1559. BUGS
  1560.  
  1561.  
  1562. SEE ALSO
  1563.        iniGetFloat(), iniGetStr(), iniGetLongA(), iniPutLong(),
  1564.        iniReadLong(), iniWriteLong(), <libraries/ini_lib.h>
  1565.  
  1566.  
  1567. ini.library/iniGetLongA
  1568.  
  1569. NAME
  1570.        iniGetLongA -- Gets long integer value(s) out of an array
  1571.  
  1572.  
  1573. SYNOPSIS
  1574.        success = iniGetLongA( ContextStr, ContextItemLine, Array, Entries );
  1575.        D0                     A0          A1               A2     D0
  1576.  
  1577.        BOOL iniGetLongA( struct iniContext *, struct iniContextItemLine *,
  1578.            LONG *, ULONG );
  1579.  
  1580.  
  1581. FUNCTION
  1582.        Reads one or more long integer value(s) out of the given context item
  1583.        line
  1584.  
  1585.  
  1586. INPUTS
  1587.        ContextStr - Context structure where long integer values lie in
  1588.        ContextItemLine - Context item line where to extract long integers
  1589.        Array - The array where to store the long integer values
  1590.        Entries - Number of array entries. If the array in the INI file is
  1591.             bigger, the remaining entries will be ignored.
  1592.  
  1593.  
  1594. RESULT
  1595.        success - TRUE if accessing was successful else NULL.
  1596.  
  1597.  
  1598. EXAMPLE
  1599.        struct iniFile *ini;
  1600.        struct iniContext *context;
  1601.        struct iniContextItemLine *contextitem;
  1602.        LONG MyArray[4] = {4096, 65536, 16777216, 2147483647};
  1603.  
  1604.        /* Let's open an INI file */
  1605.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  1606.  
  1607.        context = FindContext ( ini, "MyContext" );
  1608.  
  1609.        if (!( contextitem = FindContextItem ( context, "MyItem" )))
  1610.        {
  1611.          /* If not, create it! */
  1612.          if (!( contextitem = CreateContextItem ( "MyItem" )))
  1613.          {
  1614.            puts ( "Couldn't create my context item !" );
  1615.  
  1616.            exit ( 20 );
  1617.          }
  1618.  
  1619.          /* Make context available for access */
  1620.          AddContextItem ( context, contextitem );
  1621.        }
  1622.  
  1623.        iniGetLongA ( context, contextitem, MyArray,
  1624.                      (sizeof (MyArray) / sizeof (LONG)) );
  1625.  
  1626.        /* Let's say, ENVARC:MyPrefs.INI contains:
  1627.           [MyContext]
  1628.           MyItem = -4096, -65536, -16777216, -2147483648
  1629.  
  1630.           then
  1631.           MyArray[4] = {-4096, -65536, -16777216, -2147483648};
  1632.           Entries which can't be evaluated are left unchanged.
  1633.        */
  1634.  
  1635.  
  1636. NOTES
  1637.        This function is called from iniReadLongA().
  1638.        Array fields which can't be evaluated (e.g. bad syntax) are left
  1639.        unchanged. So it's good to fill the array with default values first.
  1640.  
  1641.  
  1642. BUGS
  1643.  
  1644.  
  1645. SEE ALSO
  1646.        iniGetFloatA(), iniGetStrA(), iniGetLong(), iniPutLongA(),
  1647.        iniReadLongA(), iniWriteLongA(), <libraries/ini_lib.h>
  1648.  
  1649.  
  1650. ini.library/iniGetNumArrays
  1651.  
  1652. NAME
  1653.        iniGetNumArrays -- Gets the amount of array fields
  1654.  
  1655.  
  1656. SYNOPSIS
  1657.        Arrays = iniGetNumArrays( ContextStr, ContextItemLine );
  1658.        D0                        A0          A1
  1659.  
  1660.        ULONG iniGetNumArrays( struct iniContext *,
  1661.            struct iniContextItemLine *);
  1662.  
  1663.  
  1664. FUNCTION
  1665.        Returns the amount of array entries in the given context item array.
  1666.  
  1667.  
  1668. INPUTS
  1669.        ContextStr - Context structure where array lies in
  1670.        ContextItemLine - Context item line structure where array starts
  1671.  
  1672.  
  1673. RESULT
  1674.        Arrays - Number of arrays in the given context item line
  1675.  
  1676. EXAMPLE
  1677.        struct iniFile *ini;
  1678.        WORD *Palette;
  1679.        ULONG PaletteEntries;
  1680.  
  1681.        /* Let's open an INI file */
  1682.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  1683.  
  1684.        context = FindContext ( ini, "Screen" );
  1685.  
  1686.        if (!( contextitem = FindContextItem ( context, "Palette" )))
  1687.        {
  1688.          /* If not, create it! */
  1689.          if (!( contextitem = CreateContextItem ( "Palette" )))
  1690.          {
  1691.            puts ( "Couldn't create my context item !" );
  1692.  
  1693.            exit ( 20 );
  1694.          }
  1695.  
  1696.          /* Make context available for access */
  1697.          AddContextItem ( context, contextitem );
  1698.        }
  1699.  
  1700.        PaletteEntries = iniGetNumArrays ( context, contextitem )
  1701.  
  1702.        Palette = (WORD *) AllocMem ( PaletteEntries * sizeof (WORD),
  1703.                                      MEMF_CHIP|MEMF_PUBLIC|MEMF_CLEAR );
  1704.  
  1705.        iniGetWordA ( context, contextitem, Palette, PaletteEntries );
  1706.  
  1707.  
  1708. NOTES
  1709.        This function usually is used for dynamic array fields.
  1710.        If an error occurs during evaluation, NULL is returned.
  1711.  
  1712.  
  1713. BUGS
  1714.  
  1715.  
  1716. SEE ALSO
  1717.        iniGetLongA(), iniGetWordA(), iniGetByteA(), iniGetFloatA(),
  1718.        iniGetStrA(), <libraries/ini_lib.h>
  1719.  
  1720.  
  1721. ini.library/iniGetStr
  1722.  
  1723. NAME
  1724.        iniGetStr -- Gets a string
  1725.  
  1726.  
  1727. SYNOPSIS
  1728.        String = iniGetStr( ContextStr, ContextItemLine, Default );
  1729.        D0                  A0          A1               A2
  1730.  
  1731.        STRPTR iniGetStr( struct iniContext *, struct iniContextItemLine *,
  1732.            STRPTR );
  1733.  
  1734. FUNCTION
  1735.        Reads a string out of the given context item line
  1736.  
  1737.  
  1738. INPUTS
  1739.        ContextStr - Context structure where string lies in
  1740.        ContextItemLine - Context item line where to extract string
  1741.        Default - Default value to take if it can't be evaluated
  1742.  
  1743.  
  1744. RESULT
  1745.        String - The string extracted out of the context item line
  1746.  
  1747.  
  1748. EXAMPLE
  1749.        struct iniFile *ini;
  1750.        struct iniContext *context;
  1751.        struct iniContextItemLine *contextitem;
  1752.        STRPTR MyStr;
  1753.  
  1754.        /* Let's open an INI file */
  1755.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  1756.  
  1757.        context = FindContext ( ini, "MyContext" );
  1758.  
  1759.        if (!( contextitem = FindContextItem ( context, "MyItem" )))
  1760.        {
  1761.          /* If not, create it! */
  1762.          if (!( contextitem = CreateContextItem ( "MyItem" )))
  1763.          {
  1764.            puts ( "Couldn't create my context item !" );
  1765.  
  1766.            exit ( 20 );
  1767.          }
  1768.  
  1769.          /* Make context available for access */
  1770.          AddContextItem ( context, contextitem );
  1771.        }
  1772.  
  1773.        MyStr = iniGetStr ( context, contextitem, "MyString" ));
  1774.  
  1775.        puts ( MyStr );
  1776.  
  1777.        iniFreeNameStr ( MyStr );
  1778.  
  1779.        /* Let's say, ENVARC:MyPrefs.INI contains:
  1780.           [MyContext]
  1781.           MyItem = Hello world!
  1782.  
  1783.           then MyStr will contain "Hello world!". If this context or context
  1784.           item is not available, MyStr will contain "MyString" (default)
  1785.           instead.
  1786.        */
  1787.  
  1788.  
  1789. NOTES
  1790.        This function is called from iniReadStr().
  1791.        This function calls iniGetContextItemData() with no buffer, this
  1792.        means that the string returned must be deallocated with
  1793.        iniFreeNameStr()
  1794.  
  1795.  
  1796. BUGS
  1797.  
  1798.  
  1799. SEE ALSO
  1800.        iniGetContextItemData(), iniGetLongA(), iniGetFloatA(), iniGetStr(),
  1801.        iniPutStr(), iniReadStrA(), iniWriteStrA(), <libraries/ini_lib.h>
  1802.  
  1803.  
  1804. ini.library/iniGetStrA
  1805.  
  1806. NAME
  1807.        iniGetStrA -- Extracts strings out of an array
  1808.  
  1809.  
  1810. SYNOPSIS
  1811.        success = iniGetStrA( ContextStr, ContextItemLine, Array, Entries );
  1812.        D0                    A0          A1               A2     D0
  1813.  
  1814.        BOOL iniGetStrA( struct iniContext *, struct iniContextItemLine *,
  1815.            STRPTR *, ULONG );
  1816.  
  1817.  
  1818. FUNCTION
  1819.        Reads one or more strings out of the given context item line
  1820.  
  1821.  
  1822. INPUTS
  1823.        ContextStr - Context structure where string values lie in
  1824.        ContextItemLine - Context item line where to extract strings
  1825.        Array - The array where to store the pointers to the strings
  1826.        Entries - Number of array entries. If the array in the INI file is
  1827.             bigger, the remaining entries will be ignored.
  1828.  
  1829.  
  1830. RESULT
  1831.        success - TRUE if accessing was successful else NULL.
  1832.  
  1833.  
  1834. EXAMPLE
  1835.        struct iniFile *ini;
  1836.        struct iniContext *context;
  1837.        struct iniContextItemLine *contextitem;
  1838.        STRPTR MyStr[4] = {NULL, NULL, NULL, NULL};
  1839.  
  1840.        MyStr[0] = iniAllocNameStr ( "String 1" );
  1841.        MyStr[1] = iniAllocNameStr ( "String 2" );
  1842.        MyStr[2] = iniAllocNameStr ( "String 3" );
  1843.        MyStr[3] = iniAllocNameStr ( "String 4" );
  1844.  
  1845.        /* Let's open an INI file */
  1846.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  1847.  
  1848.        context = FindContext ( ini, "MyContext" );
  1849.  
  1850.        if (!( contextitem = FindContextItem ( context, "MyItem" )))
  1851.        {
  1852.          /* If not, create it! */
  1853.          if (!( contextitem = CreateContextItem ( "MyItem" )))
  1854.          {
  1855.            puts ( "Couldn't create my context item !" );
  1856.  
  1857.            exit ( 20 );
  1858.          }
  1859.  
  1860.          /* Make context available for access */
  1861.          AddContextItem ( context, contextitem );
  1862.        }
  1863.  
  1864.        iniGetStrA ( context, contextitem, MyStr,
  1865.                      (sizeof (MyStr) / sizeof (STRPTR)) );
  1866.  
  1867.        printf ( "%s, %s, %s, %s\n", MyStr[0], MyStr[1], MyStr[2], MyStr[3]);
  1868.  
  1869.        iniFreeNameStr ( MyStr[0] );
  1870.        iniFreeNameStr ( MyStr[1] );
  1871.        iniFreeNameStr ( MyStr[2] );
  1872.        iniFreeNameStr ( MyStr[3] );
  1873.  
  1874.        /* Let's say, ENVARC:MyPrefs.INI contains:
  1875.           [MyContext]
  1876.           MyItem = Hello 1, Hello 2, Hello 3, Hello 4
  1877.  
  1878.           then
  1879.           MyStr[4] = {"Hello 1", "Hello 2", "Hello 3", "Hello 4"};
  1880.           Entries which can't be evaluated are left unchanged.
  1881.        */
  1882.  
  1883.  
  1884. NOTES
  1885.        This function is called from iniReadStrA().
  1886.        This function calls iniGetContextItemData() with no buffer.
  1887.        Array fields which can't be evaluated (e.g. bad syntax) are left
  1888.        unchanged. So it's good to fill the array with default strings first.
  1889.        All entries of the array must be deallocated with iniFreeNameStr()
  1890.        when the strings are no longer of use. This means that the default
  1891.        entries of the array must be iniAllocNameStr() strings!
  1892.  
  1893.  
  1894. BUGS
  1895.  
  1896.  
  1897. SEE ALSO
  1898.        iniGetLongA(), iniGetFloatA(), iniGetStr(), iniPutStrA(),
  1899.        iniReadStrA(), iniWriteStrA(), <libraries/ini_lib.h>
  1900.  
  1901.  
  1902. ini.library/iniGetWordA
  1903.  
  1904. NAME
  1905.        iniGetWordA -- reads a context item array into a (U)WORD array.
  1906.  
  1907.  
  1908. SYNOPSIS
  1909.        success = iniGetWordA( ContextStr, ContextItemLine, Array, Entries );
  1910.        D0                     A0          A1               A2     D0
  1911.  
  1912.        BOOL iniGetWordA( struct iniContext *, struct iniContextItemLine *,
  1913.            WORD *, ULONG );
  1914.  
  1915.  
  1916. FUNCTION
  1917.        Reads a context item array and stores the read words into a
  1918.        (U)WORD table you specified.
  1919.  
  1920.  
  1921. INPUTS
  1922.        ContextStr - The context structure where the context line is in
  1923.        ContextItemLine - The context item line where the array is
  1924.        Array - An (U)WORD array where to store the values
  1925.        Entries - Number of entries to read (further entries will be ignored)
  1926.  
  1927.  
  1928. RESULT
  1929.        success - TRUE if line could be evaluated else FALSE
  1930.  
  1931.  
  1932. EXAMPLE
  1933.        struct iniFile *ini;
  1934.        struct iniContext *context;
  1935.        struct iniContextItemLine *contextitem;
  1936.        WORD MyArray[4] = {16, 64, 256, 4096};
  1937.  
  1938.        /* Let's open an INI file */
  1939.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  1940.  
  1941.        context = FindContext ( ini, "MyContext" );
  1942.  
  1943.        if (!( contextitem = FindContextItem ( context, "MyItem" )))
  1944.        {
  1945.          /* If not, create it! */
  1946.          if (!( contextitem = CreateContextItem ( "MyItem" )))
  1947.          {
  1948.            puts ( "Couldn't create my context item !" );
  1949.  
  1950.            exit ( 20 );
  1951.          }
  1952.  
  1953.          /* Make context available for access */
  1954.          AddContextItem ( context, contextitem );
  1955.        }
  1956.  
  1957.        iniGetWordA ( context, contextitem, MyArray,
  1958.                      (sizeof (MyArray) / sizeof (WORD)) );
  1959.  
  1960.        /* Let's say, ENVARC:MyPrefs.INI contains:
  1961.           [MyContext]
  1962.           MyItem = 10000, 1000, 10, 1
  1963.  
  1964.           then
  1965.           MyArray[4] = {10000, 1000, 10, 1};
  1966.           Entries which can't be evaluated are left unchanged.
  1967.        */
  1968.  
  1969.  
  1970. NOTES
  1971.        Make sure that the given array is big enough to hold all values or
  1972.        some memory area may be overwritten.
  1973.  
  1974.        Fields which can't be evaluated are left unchanged.
  1975.  
  1976.  
  1977. BUGS
  1978.  
  1979.  
  1980. SEE ALSO
  1981.        iniGetByteA(), iniGetLongA(), iniReadWordA(), iniPutWordA(),
  1982.        <libraries/ini_lib.h>
  1983.  
  1984.  
  1985. ini.library/iniInsertContext
  1986.  
  1987. NAME
  1988.        iniInsertContext -- inserts a context in an INI file structure
  1989.  
  1990.  
  1991. SYNOPSIS
  1992.        iniInsertContext( iniFile, ContextStr, PredContext );
  1993.                          A0       A1          A2
  1994.  
  1995.        void iniInsertContext( struct iniFile *, struct iniContext *,
  1996.            struct iniContext *);
  1997.  
  1998.  
  1999. FUNCTION
  2000.        Inserts a context in an INI file and all its associated lines.
  2001.  
  2002.  
  2003. INPUTS
  2004.        iniFile - INI file structure where to insert context structure
  2005.        ContextStr - The context structure to be inserted
  2006.        PredContext - Context structure of the structure where to insert it
  2007.  
  2008.  
  2009. RESULT
  2010.  
  2011.  
  2012. NOTES
  2013.  
  2014.  
  2015. BUGS
  2016.  
  2017.  
  2018. SEE ALSO
  2019.       iniFreeContext(), iniRemContext(), iniDeleteContext(),
  2020.       <libraries/ini_lib.h>
  2021.  
  2022.  
  2023. ini.library/iniInsertContextItem
  2024.  
  2025. NAME
  2026.        iniInsertContextItem -- inserts a context item line in an INI file.
  2027.  
  2028.  
  2029. SYNOPSIS
  2030.        iniInsertContextItem( ContextStr, ContextItemLine, PredLine );
  2031.                              A0          A1               A2
  2032.  
  2033.        void iniInsertContextItem( struct iniContext *,
  2034.            struct iniContextItemLine *, struct iniContextItemLine *);
  2035.  
  2036.  
  2037. FUNCTION
  2038.        Inserts a context item line in an INI context.
  2039.  
  2040.  
  2041. INPUTS
  2042.        ContextStr - The pointer of the context structure where to insert item
  2043.        ContextItemLine - The pointer of the context item line to be inserted.
  2044.        PredLine - The context item line where to insert it.
  2045.  
  2046.  
  2047. RESULT
  2048.  
  2049.  
  2050. NOTES
  2051.  
  2052.  
  2053. BUGS
  2054.  
  2055.  
  2056. SEE ALSO
  2057.        iniFreeContextItem(), iniRemContextItem(), iniDeleteContextItem(),
  2058.        <libraries/ini_lib.h>
  2059.  
  2060. ini.library/iniIntToStr
  2061.  
  2062. NAME
  2063.        iniIntToStr -- Converts an integer value to a string.
  2064.  
  2065.  
  2066. SYNOPSIS
  2067.        string = iniIntToStr( Buffer, Integer, Format, Len, ZeroSep );
  2068.        D0                    A0      D0       D1      D2   D3:8
  2069.  
  2070.        STRPTR iniIntToStr( STRPTR, ULONG, ULONG, ULONG, UBYTE );
  2071.  
  2072.  
  2073. FUNCTION
  2074.        This function is used to convert an integer value to a standard
  2075.        ASCII string.
  2076.  
  2077.  
  2078. INPUTS
  2079.        Buffer - A pointer to a buffer or NULL to create a new one.
  2080.            The buffer must be large enough to hold all values.
  2081.        Integer - Integer value to convert.
  2082.        Format - Format of the outputted string. Can be any of:
  2083.            INI_FORMAT_DEC - Use decimal with no precedor
  2084.            INI_FORMAT_DEC_CHAR - Use decimal with # precedor
  2085.            INI_FORMAT_HEX - Use hexadecimal with $ precedor
  2086.            INI_FORMAT_HEX_0X - Use hexadecimal with 0x precedor
  2087.            INI_FORMAT_BIN - Use binary with % precedor
  2088.            INI_FORMAT_OCT - Use octal with & precedor
  2089.            INI_FORMAT_YESNO - Use No for zero, Yes for all others
  2090.            INI_FORMAT_YN - Use N for zero, Y for all others
  2091.            INI_FORMAT_TRUEFALSE - Use False for zero, True for all others
  2092.            INI_FORMAT_ONOFF - Use Off for zero, On for all others
  2093.            INI_UNSIGNED - Add this to indicate unsigned integer
  2094.        Len - Forced length of outputted string or NULL for no force.
  2095.        ZeroSep - Zero character for IntLen leading zeroes. Usually " " or "0"
  2096.  
  2097.  
  2098. RESULT
  2099.        string - Pointer to the string where the converted string is stored.
  2100.  
  2101.  
  2102. EXAMPLE
  2103.        STRPTR Buffer;
  2104.  
  2105.        Buffer = iniIntToStr ( 0x4000, INI_FORMAT_DEC_CHAR, 7, '0');
  2106.  
  2107.        /* Buffer will contain: "#0016384" */
  2108.  
  2109.        puts ( Buffer );
  2110.  
  2111.        iniFreeNameStr ( Buffer );
  2112.  
  2113.  
  2114. NOTES
  2115.  
  2116.  
  2117. BUGS
  2118.       The buffer is not checked for overflow. That means, IntLen should
  2119.       should be lesser than your buffer.
  2120.  
  2121.  
  2122. SEE ALSO
  2123.       iniStrToInt(), iniStrToFloat(), iniFloatToStr(), <libraries/ini_lib.h>
  2124.  
  2125.  
  2126. ini.library/iniOpenDefault
  2127.  
  2128. NAME
  2129.        iniOpenDefault -- Opens INI file for read access
  2130.  
  2131.  
  2132. SYNOPSIS
  2133.        iniFile = iniOpenDefault( address, name, len );
  2134.        D0                        A0       A1    D0
  2135.  
  2136.        struct iniFile *iniOpenDefault( APTR, STRPTR name, ULONG );
  2137.  
  2138.  
  2139. FUNCTION
  2140.        Opens an INI file for read access and creates a iniFile structure
  2141.        for it. If the file doesn't exist, a default file will be created.
  2142.  
  2143.  
  2144. INPUTS
  2145.        address - Address where default INI file lies (in memory)
  2146.        name - File name of the INI file to be accessed
  2147.        len - Length of the default INI file
  2148.  
  2149.  
  2150. RESULT
  2151.        iniFile - A valid INI file structure ready to be evaluated.
  2152.  
  2153.  
  2154. EXAMPLE
  2155.        char DefaultINI[] = "/* Default INI file settings */\n\
  2156.            [MyContext]\n\
  2157.            MyItem = 5\n";
  2158.        struct iniFile *ini;
  2159.        ULONG MyValue;
  2160.  
  2161.        /* Now let's open the INI file and create, if necessary an default
  2162.           ini file */
  2163.  
  2164.        ini = iniOpenDefault ( DefaultINI, "ENVARC:MyPrefs.INI",
  2165.                               sizeof (DefaultINI));
  2166.  
  2167.        MyValue = iniReadLong ( ini, "MyContext", "MyItem", 5L, 0L );
  2168.  
  2169.        printf ( "%ld\n", MyValue );
  2170.  
  2171.        iniClose ( ini );
  2172.  
  2173.  
  2174. NOTES
  2175.        The default file will only be created, if the Open() fails with
  2176.        an ERROR_OBJECT_NOT_FOUND (code 205) error.
  2177.        If the default file can't be created (disk full, etc.) the function
  2178.        will use the default file in memory.
  2179.  
  2180.  
  2181. BUGS
  2182.  
  2183.  
  2184. SEE ALSO
  2185.        iniOpenFile(), iniOpenMem(), iniClose(), iniSaveFile(),
  2186.        <libraries/ini_lib.h>
  2187.  
  2188.  
  2189. ini.library/iniOpenFile
  2190.  
  2191. NAME
  2192.        iniOpenFile -- Prepares an INI file for context access
  2193.  
  2194.  
  2195. SYNOPSIS
  2196.        iniFile = iniOpenFile( name, accessMode );
  2197.        D0                     D1    D2
  2198.  
  2199.        struct iniFile *iniOpenFile( STRPTR name, LONG );
  2200.  
  2201.  
  2202. FUNCTION
  2203.        Opens an INI file for read access and prepares an iniFile structure
  2204.        for evaluation. After this the INI file contents can be evaluated
  2205.  
  2206.  
  2207. INPUTS
  2208.        name - Name of the INI file to be opened.
  2209.        accessMode - Read mode of file (see <libraries/dos.h> for details)
  2210.  
  2211.  
  2212. RESULT
  2213.        iniFile - An INI file structure which is ready for evaluation
  2214.  
  2215.  
  2216. EXAMPLE
  2217.        struct iniFile *ini;
  2218.        ULONG MyValue;
  2219.  
  2220.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  2221.  
  2222.        MyValue = iniReadLong ( ini, "MyContext", "MyItem", 5L, 0L );
  2223.  
  2224.        printf ( "%ld\n", MyValue );
  2225.  
  2226.        iniClose ( ini );
  2227.  
  2228.  
  2229. NOTES
  2230.  
  2231.  
  2232. BUGS
  2233.  
  2234.  
  2235. SEE ALSO
  2236.        iniOpenDefault(), iniOpenFromFH(), iniOpenMem(), iniClose(),
  2237.        iniSaveFile(), <libraries/ini_lib.h>, <libraries/dos.h>
  2238.  
  2239.  
  2240. ini.library/iniOpenFromFH
  2241.  
  2242. NAME
  2243.        iniOpenFromFH -- initializes an INI file from an already open file
  2244.  
  2245.  
  2246. SYNOPSIS
  2247.        iniFile = iniOpenFromFH( fh, len );
  2248.        D0                       D1  D2
  2249.  
  2250.        struct iniFile *iniOpenFromFH( BPTR, ULONG );
  2251.  
  2252.  
  2253. FUNCTION
  2254.        Reads the INI data from an already open file and initializes the
  2255.        iniFile structure.
  2256.  
  2257.  
  2258. INPUTS
  2259.        fh - BPTR to an file handle of the already opened file to be read.
  2260.        len - Length of file (or length of bytes to read at maximum)
  2261.  
  2262.  
  2263. RESULT
  2264.        iniFile - An initialized INI file structure ready for evaluation
  2265.  
  2266.  
  2267. EXAMPLE
  2268.        struct iniFile *ini;
  2269.        BPTR fh;
  2270.        ULONG MyValue;
  2271.  
  2272.        fh = Open ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  2273.        ini = iniOpenFromFH ( fh, -1 );
  2274.  
  2275.        MyValue = iniReadLong ( ini, "MyContext", "MyItem", 5L, 0L );
  2276.  
  2277.        printf ( "%ld\n", MyValue );
  2278.  
  2279.        iniClose ( ini );
  2280.  
  2281.  
  2282. NOTES
  2283.  
  2284.  
  2285. BUGS
  2286.  
  2287.  
  2288. SEE ALSO
  2289.        iniOpenDefault(), iniOpenFile(), iniOpenMem(), iniClose(),
  2290.        iniSaveFile(), iniSaveToFH(), <libraries/ini_lib.h>
  2291.  
  2292.  
  2293. ini.library/iniOpenMem
  2294.  
  2295. NAME
  2296.        iniOpenMem -- Initializes a INI file structure from an INI file
  2297.            already in memory.
  2298.  
  2299.  
  2300. SYNOPSIS
  2301.        iniFile = iniOpenMem( address, len );
  2302.        D0                    A0       D0
  2303.  
  2304.        struct iniFile *iniOpenMem( APTR, ULONG );
  2305.  
  2306.  
  2307. FUNCTION
  2308.        Initializes an INI file structure from an INI file already in
  2309.        memory.
  2310.  
  2311.  
  2312. INPUTS
  2313.        address - Address where the INI file lies
  2314.        len - Length of INI file in memory
  2315.  
  2316.  
  2317. RESULT
  2318.        iniFile - Valid initialized INI file structure ready to be evaluated
  2319.  
  2320.  
  2321. NOTES
  2322.        Used internally. Comes also in handy when you're going to read the
  2323.        file by yourself when it's crunched (so you can read XPK packed INIs).
  2324.  
  2325.  
  2326. BUGS
  2327.  
  2328.  
  2329. SEE ALSO
  2330.       iniOpenDefault(), iniOpenFile(), iniOpenFromFH(), iniClose(),
  2331.       iniSaveFile(), iniSaveToFH(), <libraries/ini_lib.h>
  2332.  
  2333.  
  2334. ini.library/iniPutByteA
  2335.  
  2336. NAME
  2337.        iniPutByteA -- writes an (U)BYTE array into an context item array.
  2338.  
  2339.  
  2340. SYNOPSIS
  2341.        success = iniPutByteA( ContextStr, ContextItemLine, Array, Entries,
  2342.        D0                     A0          A1               A2     D0
  2343.                               Format, Len, ZeroSep );
  2344.                               D1      D2   D3:8
  2345.  
  2346.        BOOL iniPutByteA( struct iniContext *, struct iniContextItemLine *,
  2347.            BYTE *, ULONG, ULONG, ULONG, UBYTE );
  2348.  
  2349.  
  2350. FUNCTION
  2351.        Writes the values of the given (U)BYTE table to the specified context
  2352.        item array.
  2353.  
  2354.  
  2355. INPUTS
  2356.        ContextStr - The context structure where context line should be put
  2357.        ContextItemLine - The context item line where the array is
  2358.        Array - An (U)BYTE array where to take the values from
  2359.        Entries - Number of entries to write
  2360.        Format - Format of array entries to write out:
  2361.            INI_FORMAT_DEC - Use decimal with no precedor
  2362.            INI_FORMAT_DEC_CHAR - Use decimal with # precedor
  2363.            INI_FORMAT_HEX - Use hexadecimal with $ precedor
  2364.            INI_FORMAT_HEX_0X - Use hexadecimal with 0x precedor
  2365.            INI_FORMAT_BIN - Use binary with % precedor
  2366.            INI_FORMAT_OCT - Use octal with & precedor
  2367.            INI_FORMAT_YESNO - Use No for zero, Yes for all others
  2368.            INI_FORMAT_YN - Use N for zero, Y for all others
  2369.            INI_FORMAT_TRUEFALSE - Use False for zero, True for all others
  2370.            INI_FORMAT_ONOFF - Use Off for zero, On for all others
  2371.            INI_UNSIGNED - Add this to indicate unsigned integer
  2372.        Len - Forced length of outputted string or NULL for no force.
  2373.        ZeroSep - Zero character for IntLen leading zeroes. Usually " " or "0"
  2374.  
  2375.  
  2376. RESULT
  2377.        success - TRUE if line could be written else FALSE
  2378.  
  2379.  
  2380. EXAMPLE
  2381.        struct iniFile *ini;
  2382.        struct iniContext *context;
  2383.        struct iniContextItemLine *contextitem;
  2384.        BYTE MyArray[4] = {-2, -1, 0, 1};
  2385.  
  2386.        /* Let's open an INI file */
  2387.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  2388.  
  2389.        context = FindContext ( ini, "MyContext" );
  2390.  
  2391.        if (!( contextitem = FindContextItem ( context, "MyItem" )))
  2392.        {
  2393.          /* If not, create it! */
  2394.          if (!( contextitem = CreateContextItem ( "MyItem" )))
  2395.          {
  2396.            puts ( "Couldn't create my context item !" );
  2397.  
  2398.            exit ( 20 );
  2399.          }
  2400.  
  2401.          /* Make context available for access */
  2402.          AddContextItem ( context, contextitem );
  2403.        }
  2404.  
  2405.        iniPutByteA ( context, contextitem, MyArray, sizeof (MyArray),
  2406.                      INI_FORMAT_DEC, 3L, '0' );
  2407.  
  2408.        /* Let's say, ENVARC:MyPrefs.INI contains:
  2409.           [MyContext]
  2410.           MyItem = 25, 50, 75, 100
  2411.  
  2412.           then it will become:
  2413.           [MyContext]
  2414.           MyItem = -002, -001, 000, 001
  2415.  
  2416.           Entries which can't be stored are left unchanged.
  2417.        */
  2418.  
  2419.  
  2420. NOTES
  2421.        This function is currently relatively slow. Especially with
  2422.        arrays with more than 16 entries.
  2423.  
  2424.  
  2425. BUGS
  2426.  
  2427.  
  2428. SEE ALSO
  2429.        iniPutWordA(), iniPutLongA(), iniWriteByteA(), iniGetByteA(),
  2430.        <libraries/ini_lib.h>
  2431.  
  2432.  
  2433. ini.library/iniPutFloat
  2434.  
  2435. NAME
  2436.        iniPutFloat -- Puts a quick floating point value into given item line
  2437.  
  2438.  
  2439. SYNOPSIS
  2440.        success = iniPutFloat( ContextStr, ContextItemLine, Value,
  2441.        D0                     A0          A1               D0
  2442.                               Format, Len, ZeroSep );
  2443.                               D1      D2   D3:8
  2444.  
  2445.        BOOL iniPutFloat( struct iniContext *, struct iniContextItemLine *,
  2446.            LONG, ULONG, UBYTE );
  2447.  
  2448.  
  2449. FUNCTION
  2450.        Writes a quick float value into the given context item line
  2451.  
  2452.  
  2453. INPUTS
  2454.        ContextStr - Context structure where quick float value should be put
  2455.        ContextItemLine - Context item line where to store quick float
  2456.        Value - Value to be written
  2457.        FltFormat - Format of the floating point value. Can be any of:
  2458.            INI_FLOAT_FORMAT_DEC - Use decimal with point separator
  2459.            INI_FLOAT_UNSIGNED - Add this to indicate unsigned quick float
  2460.        IntLen - Forced length of integer part or NULL for no force.
  2461.        FracLen - Forced length of fractional part or NULL for no force.
  2462.        ZeroSep - Zero character for IntLen leading zeroes. Usually " " or "0"
  2463.  
  2464.  
  2465. RESULT
  2466.        success - TRUE if successful write else FALSE
  2467.  
  2468.  
  2469. EXAMPLE
  2470.        struct iniFile *ini;
  2471.        struct iniContext *context;
  2472.        struct iniContextItemLine *contextitem;
  2473.  
  2474.        /* Let's open an INI file */
  2475.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  2476.  
  2477.        context = FindContext ( ini, "MyContext" );
  2478.  
  2479.        if (!( contextitem = FindContextItem ( context, "MyItem" )))
  2480.        {
  2481.          /* If not, create it! */
  2482.          if (!( contextitem = CreateContextItem ( "MyItem" )))
  2483.          {
  2484.            puts ( "Couldn't create my context item !" );
  2485.  
  2486.            exit ( 20 );
  2487.          }
  2488.  
  2489.          /* Make context available for access */
  2490.          AddContextItem ( context, contextitem );
  2491.        }
  2492.  
  2493.        iniPutFloat ( context, contextitem, 0x28000, INI_FLOAT_FORMAT_DEC,
  2494.                      0L, 3L, ' ' );
  2495.  
  2496.        /* After this, ENVARC:MyPrefs.INI will contain:
  2497.           [MyContext]
  2498.           MyItem = 2.500
  2499.  
  2500.           If the context or the context item doesn't exist, the value won't
  2501.           be written.
  2502.        */
  2503.  
  2504.  
  2505. NOTES
  2506.        This function is called from iniWriteFloat().
  2507.  
  2508.  
  2509. BUGS
  2510.  
  2511.  
  2512. SEE ALSO
  2513.        iniPutLong(), iniPutStr(), iniPutFloatA(), iniGetFloat(),
  2514.        iniWriteFloat(), iniReadFloat(), <libraries/ini_lib.h>
  2515.  
  2516.  
  2517. ini.library/iniPutFloatA
  2518.  
  2519. NAME
  2520.        iniPutFloatA -- Puts quick floating point value(s) into item line(s)
  2521.  
  2522.  
  2523. SYNOPSIS
  2524.        success = iniPutFloatA( ContextStr, ContextItemLine, Array, Entries,
  2525.        D0                      A0          A1               A2     D0
  2526.                                FltFormat, IntLen, FracLen, ZeroSep );
  2527.                                D1         D2      D3       D4:8
  2528.  
  2529.        BOOL iniPutFloatA( struct iniContext *, struct iniContextItemLine *,
  2530.            LONG *, ULONG, ULONG, ULONG, ULONG, UBYTE );
  2531.  
  2532.  
  2533. FUNCTION
  2534.        Writes one or more quick float value(s) from an array into the given
  2535.        context item line
  2536.  
  2537.  
  2538. INPUTS
  2539.        ContextStr - Context structure where quick float values should be put
  2540.        ContextItemLine - Context item line where to store quick floats
  2541.        Array - The array where to take the quick float values from
  2542.        Entries - Number of array entries. If the array in the INI file is
  2543.             bigger, the remaining entries will be ignored.
  2544.        FltFormat - Format of the floating point value. Can be any of:
  2545.            INI_FLOAT_FORMAT_DEC - Use decimal with point separator
  2546.            INI_FLOAT_UNSIGNED - Add this to indicate unsigned quick float
  2547.        IntLen - Forced length of integer part or NULL for no force.
  2548.        FracLen - Forced length of fractional part or NULL for no force.
  2549.        ZeroSep - Zero character for IntLen leading zeroes. Usually " " or "0"
  2550.  
  2551.  
  2552. RESULT
  2553.        success - TRUE if accessing was successful else NULL.
  2554.  
  2555.  
  2556. EXAMPLE
  2557.        struct iniFile *ini;
  2558.        struct iniContext *context;
  2559.        struct iniContextItemLine *contextitem;
  2560.        LONG MyFloat[4] = {-0x10000, -0x8000, 0, 0x8000};
  2561.  
  2562.        /* Let's open an INI file */
  2563.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  2564.  
  2565.        context = FindContext ( ini, "MyContext" );
  2566.  
  2567.        if (!( contextitem = FindContextItem ( context, "MyItem" )))
  2568.        {
  2569.          /* If not, create it! */
  2570.          if (!( contextitem = CreateContextItem ( "MyItem" )))
  2571.          {
  2572.            puts ( "Couldn't create my context item !" );
  2573.  
  2574.            exit ( 20 );
  2575.          }
  2576.  
  2577.          /* Make context available for access */
  2578.          AddContextItem ( context, contextitem );
  2579.        }
  2580.  
  2581.        iniPutFloatA ( context, contextitem, MyFloat,
  2582.                       (sizeof (MyFloat) / sizeof (LONG)),
  2583.                       INI_FLOAT_FORMAT_DEC, 3L, 4L, '0' );
  2584.  
  2585.        /* Let's say, ENVARC:MyPrefs.INI contains:
  2586.           [MyContext]
  2587.           MyItem = 13.5, 17.25, 1.116, 3.1416
  2588.  
  2589.           then it will become:
  2590.           [MyContext]
  2591.           MyItem = -001.0000, -000.5000, 000.0000, 000.5000
  2592.  
  2593.           Entries which can't be stored are left unchanged.
  2594.        */
  2595.  
  2596.  
  2597. NOTES
  2598.        This function is called from iniWriteFloatA().
  2599.        This function is currently relatively slow. Especially with
  2600.        arrays with more than 16 entries.
  2601.  
  2602.  
  2603. BUGS
  2604.  
  2605.  
  2606. SEE ALSO
  2607.        iniPutLongA(), iniPutStrA(), iniPutFloat(), iniGetFloatA(),
  2608.        iniWriteFloatA(), iniReadFloatA(), <libraries/ini_lib.h>
  2609.  
  2610.  
  2611. ini.library/iniPutLong
  2612.  
  2613. NAME
  2614.        iniPutLong -- Puts a long integer value into the context item line
  2615.  
  2616.  
  2617. SYNOPSIS
  2618.        success = iniPutLong( ContextStr, ContextItemLine, Value, Format,
  2619.        D0                    A0          A1               D0     D1
  2620.                              Len, ZeroSep );
  2621.                              D2   D3:8
  2622.  
  2623.        BOOL iniPutLong( struct iniContext *, struct iniContextItemLine *,
  2624.            LONG, ULONG, ULONG, UBYTE );
  2625.  
  2626.  
  2627. FUNCTION
  2628.        Writes a long integer value into the given context item line
  2629.  
  2630.  
  2631. INPUTS
  2632.        ContextStr - Context structure where the long integers should be put
  2633.        ContextItemLine - Context item line where to store long integer
  2634.        Value - Value to be written
  2635.        Format - Format of the outputted string. Can be any of:
  2636.            INI_FORMAT_DEC - Use decimal with no precedor
  2637.            INI_FORMAT_DEC_CHAR - Use decimal with # precedor
  2638.            INI_FORMAT_HEX - Use hexadecimal with $ precedor
  2639.            INI_FORMAT_HEX_0X - Use hexadecimal with 0x precedor
  2640.            INI_FORMAT_BIN - Use binary with % precedor
  2641.            INI_FORMAT_OCT - Use octal with & precedor
  2642.            INI_FORMAT_YESNO - Use No for zero, Yes for all others
  2643.            INI_FORMAT_YN - Use N for zero, Y for all others
  2644.            INI_FORMAT_TRUEFALSE - Use False for zero, True for all others
  2645.            INI_FORMAT_ONOFF - Use Off for zero, On for all others
  2646.            INI_UNSIGNED - Add this to indicate unsigned integer
  2647.        Len - Forced length of outputted string or NULL for no force.
  2648.        ZeroSep - Zero character for IntLen leading zeroes. Usually " " or "0"
  2649.  
  2650.  
  2651. RESULT
  2652.        success - TRUE if value could successfully be written or FALSE
  2653.  
  2654.  
  2655. EXAMPLE
  2656.        struct iniFile *ini;
  2657.        struct iniContext *context;
  2658.        struct iniContextItemLine *contextitem;
  2659.  
  2660.        /* Let's open an INI file */
  2661.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  2662.  
  2663.        context = FindContext ( ini, "MyContext" );
  2664.  
  2665.        if (!( contextitem = FindContextItem ( context, "MyItem" )))
  2666.        {
  2667.          /* If not, create it! */
  2668.          if (!( contextitem = CreateContextItem ( "MyItem" )))
  2669.          {
  2670.            puts ( "Couldn't create my context item !" );
  2671.  
  2672.            exit ( 20 );
  2673.          }
  2674.  
  2675.          /* Make context available for access */
  2676.          AddContextItem ( context, contextitem );
  2677.        }
  2678.  
  2679.        iniPutLong ( context, contextitem, 13750, INI_FORMAT_HEX_0X,
  2680.                     8L, ' ' );
  2681.  
  2682.        /* After this, ENVARC:MyPrefs.INI will contain:
  2683.           [MyContext]
  2684.           MyItem = 0x000035B6
  2685.  
  2686.           If the context or the context item doesn't exist, the value won't
  2687.           be written.
  2688.        */
  2689.  
  2690.  
  2691. NOTES
  2692.        This function is called from iniWriteLong().
  2693.  
  2694.  
  2695. BUGS
  2696.  
  2697.  
  2698. SEE ALSO
  2699.        iniPutFloat(), iniPutStr(), iniPutLongA(), iniGetLong(),
  2700.        iniWriteLong(), iniReadLong(), <libraries/ini_lib.h>
  2701.  
  2702.  
  2703. ini.library/iniPutLongA
  2704.  
  2705. NAME
  2706.        iniPutLongA -- Puts long integer value(s) into context item line(s)
  2707.  
  2708.  
  2709. SYNOPSIS
  2710.        success = iniPutLongA( ContextStr, ContextItemLine, Array, Entries,
  2711.        D0                     A0          A1               A2     D0
  2712.                               Format, Len, ZeroSep );
  2713.                               D1      D2   D3:8
  2714.  
  2715.        BOOL iniPutLongA( struct iniContext *, struct iniContextItemLine *,
  2716.            LONG *, ULONG, ULONG, ULONG, UBYTE );
  2717.  
  2718.  
  2719. FUNCTION
  2720.        Writes one or more long integer value(s) from the given array into
  2721.        the specified context item line(s).
  2722.  
  2723.  
  2724. INPUTS
  2725.        ContextStr - Context structure where the long integers should be put
  2726.        ContextItemLine - Context item line where to store long integers
  2727.        Array - The array where to take the long integer values from
  2728.        Entries - Number of array entries.
  2729.        Format - Format of the outputted string. Can be any of:
  2730.            INI_FORMAT_DEC - Use decimal with no precedor
  2731.            INI_FORMAT_DEC_CHAR - Use decimal with # precedor
  2732.            INI_FORMAT_HEX - Use hexadecimal with $ precedor
  2733.            INI_FORMAT_HEX_0X - Use hexadecimal with 0x precedor
  2734.            INI_FORMAT_BIN - Use binary with % precedor
  2735.            INI_FORMAT_OCT - Use octal with & precedor
  2736.            INI_FORMAT_YESNO - Use No for zero, Yes for all others
  2737.            INI_FORMAT_YN - Use N for zero, Y for all others
  2738.            INI_FORMAT_TRUEFALSE - Use False for zero, True for all others
  2739.            INI_FORMAT_ONOFF - Use Off for zero, On for all others
  2740.            INI_UNSIGNED - Add this to indicate unsigned integer
  2741.        Len - Forced length of outputted string or NULL for no force.
  2742.        ZeroSep - Zero character for IntLen leading zeroes. Usually " " or "0"
  2743.  
  2744.  
  2745. RESULT
  2746.        success - TRUE if accessing was successful else NULL.
  2747.  
  2748.  
  2749. EXAMPLE
  2750.        struct iniFile *ini;
  2751.        struct iniContext *context;
  2752.        struct iniContextItemLine *contextitem;
  2753.        LONG MyArray[4] = {-200000, -100000, 0, 100000};
  2754.  
  2755.        /* Let's open an INI file */
  2756.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  2757.  
  2758.        context = FindContext ( ini, "MyContext" );
  2759.  
  2760.        if (!( contextitem = FindContextItem ( context, "MyItem" )))
  2761.        {
  2762.          /* If not, create it! */
  2763.          if (!( contextitem = CreateContextItem ( "MyItem" )))
  2764.          {
  2765.            puts ( "Couldn't create my context item !" );
  2766.  
  2767.            exit ( 20 );
  2768.          }
  2769.  
  2770.          /* Make context available for access */
  2771.          AddContextItem ( context, contextitem );
  2772.        }
  2773.  
  2774.        iniPutLongA ( context, contextitem, MyArray,
  2775.                      (sizeof (MyArray) / sizeof (LONG)),
  2776.                      INI_FORMAT_DEC, 0L, '0' );
  2777.  
  2778.        /* Let's say, ENVARC:MyPrefs.INI contains:
  2779.           [MyContext]
  2780.           MyItem = 12345678, 76543210, 50000, -12345678
  2781.  
  2782.           then it will become:
  2783.           [MyContext]
  2784.           MyItem = -200000, -100000, 0, 100000
  2785.  
  2786.           Entries which can't be stored are left unchanged.
  2787.        */
  2788.  
  2789.  
  2790. NOTES
  2791.        This function is called from iniWriteLongA().
  2792.        This function is currently relatively slow. Especially with
  2793.        arrays with more than 16 entries.
  2794.  
  2795.  
  2796. BUGS
  2797.  
  2798.  
  2799. SEE ALSO
  2800.        iniPutFloatA(), iniPutStrA(), iniPutLong(), iniGetLongA(),
  2801.        iniWriteLongA(), iniReadLongA(), <libraries/ini_lib.h>
  2802.  
  2803.  
  2804. ini.library/iniPutStr
  2805.  
  2806. NAME
  2807.        iniPutStr -- Puts a string into context item line
  2808.  
  2809.  
  2810. SYNOPSIS
  2811.        success = iniPutStr( ContextStr, ContextItemLine, String );
  2812.        D0                   A0          A1               A2
  2813.  
  2814.        BOOL iniPutStr( struct iniContext *, struct iniContextItemLine *,
  2815.            STRPTR );
  2816.  
  2817.  
  2818. FUNCTION
  2819.        Writes a string into the given context item line.
  2820.  
  2821.  
  2822. INPUTS
  2823.        ContextStr - Context structure where string should be put
  2824.        ContextItemLine - Context item line where to store string
  2825.        String - String to be written
  2826.  
  2827.  
  2828. RESULT
  2829.        success - TRUE if writing was successful else FALSE
  2830.  
  2831.  
  2832. EXAMPLE
  2833.        struct iniFile *ini;
  2834.        struct iniContext *context;
  2835.        struct iniContextItemLine *contextitem;
  2836.  
  2837.        /* Let's open an INI file */
  2838.        ini = iniOpenFile ( "ENVARC:MyMessages.INI", MODE_OLDFILE );
  2839.  
  2840.        context = FindContext ( ini, "Messages" );
  2841.  
  2842.        if (!( contextitem = FindContextItem ( context, "Basty" )))
  2843.        {
  2844.          /* If not, create it! */
  2845.          if (!( contextitem = CreateContextItem ( "Basty" )))
  2846.          {
  2847.            puts ( "Couldn't create my context item !" );
  2848.  
  2849.            exit ( 20 );
  2850.          }
  2851.  
  2852.          /* Make context available for access */
  2853.          AddContextItem ( context, contextitem );
  2854.        }
  2855.  
  2856.        iniPutStr ( context, contextitem, "I love Zuzana Burkertová !" );
  2857.  
  2858.        /* After this, ENVARC:MyMessages.INI will contain:
  2859.           [Messages]
  2860.           Basty = I love Zuzana Burkertová !
  2861.  
  2862.           If the context or the context item doesn't exist, the value won't
  2863.           be written.
  2864.        */
  2865.  
  2866.  
  2867. NOTES
  2868.        This function is called from iniReadStr().
  2869.  
  2870.  
  2871. BUGS
  2872.  
  2873.  
  2874. SEE ALSO
  2875.        iniPutLongA(), iniPutFloatA(), iniPutStr(), iniGetStr(),
  2876.        iniWriteStrA(), iniReadStrA(), <libraries/ini_lib.h>
  2877.  
  2878.  
  2879. ini.library/iniPutStrA
  2880.  
  2881. NAME
  2882.        iniPutStrA -- Stores array(s) of string into the context item line(s)
  2883.  
  2884.  
  2885. SYNOPSIS
  2886.        success = iniPutStrA( ContextStr, ContextItemLine, Array, Entries );
  2887.        D0                    A0          A1               A2     D0
  2888.  
  2889.        BOOL iniPutStrA( struct iniContext *, struct iniContextItemLine *,
  2890.            STRPTR *, ULONG );
  2891.  
  2892.  
  2893. FUNCTION
  2894.        Writes one or more strings into the given context item line from an
  2895.        specified array.
  2896.  
  2897.  
  2898. INPUTS
  2899.        ContextStr - Context structure where strings should be put
  2900.        ContextItemLine - Context item line where to store strings
  2901.        Array - The array where to take the pointers to the strings from
  2902.        Entries - Number of array entries. If the array in the INI file is
  2903.             bigger, the remaining entries will be ignored.
  2904.  
  2905.  
  2906. RESULT
  2907.        success - TRUE if accessing was successful else NULL.
  2908.  
  2909.  
  2910. EXAMPLE
  2911.        struct iniFile *ini;
  2912.        struct iniContext *context;
  2913.        struct iniContextItemLine *contextitem;
  2914.        STRPTR MyStr[4] = {"String 1", "String 2", "String 3", "String 4"};
  2915.  
  2916.        /* Let's open an INI file */
  2917.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  2918.  
  2919.        context = FindContext ( ini, "MyContext" );
  2920.  
  2921.        if (!( contextitem = FindContextItem ( context, "MyItem" )))
  2922.        {
  2923.          /* If not, create it! */
  2924.          if (!( contextitem = CreateContextItem ( "MyItem" )))
  2925.          {
  2926.            puts ( "Couldn't create my context item !" );
  2927.  
  2928.            exit ( 20 );
  2929.          }
  2930.  
  2931.          /* Make context available for access */
  2932.          AddContextItem ( context, contextitem );
  2933.        }
  2934.  
  2935.        iniPutStrA ( context, contextitem, MyStr,
  2936.                      (sizeof (MyStr) / sizeof (STRPTR)) );
  2937.  
  2938.        /* Let's say, ENVARC:MyPrefs.INI contains:
  2939.           [MyContext]
  2940.           MyItem = Hello 1, Hello 2, Hello 3, Hello 4
  2941.  
  2942.           then it will become:
  2943.           [MyContext]
  2944.           MyItem = String 1, String 2, String 3, String 4
  2945.  
  2946.           Entries which can't be written are left unchanged.
  2947.        */
  2948.  
  2949.  
  2950. NOTES
  2951.        This function is called from iniWriteStrA().
  2952.  
  2953.  
  2954. BUGS
  2955.  
  2956.  
  2957. SEE ALSO
  2958.        iniPutLongA(), iniPutFloatA(), iniPutStr(), iniGetStrA(),
  2959.        iniWriteStrA(), iniReadStrA(), <libraries/ini_lib.h>
  2960.  
  2961.  
  2962. ini.library/iniPutWordA
  2963.  
  2964. NAME
  2965.        iniPutWordA -- writes a (U)WORD array into a context item array.
  2966.  
  2967.  
  2968. SYNOPSIS
  2969.        success = iniPutWordA( ContextStr, ContextItemLine, Array, Entries,
  2970.        D0                     A0          A1               A2     D0
  2971.                               Format, Len, ZeroSep );
  2972.                               D1      D2   D3:8
  2973.  
  2974.        BOOL iniPutWordA( struct iniContext *, struct iniContextItemLine *,
  2975.            WORD *, ULONG, ULONG, ULONG, UBYTE );
  2976.  
  2977.  
  2978. FUNCTION
  2979.        Writes a context item array and stores the write words from a
  2980.        (U)WORD table you specified.
  2981.  
  2982.  
  2983. INPUTS
  2984.        ContextStr - The context structure where the context line is in
  2985.        ContextItemLine - The context item line where the array is
  2986.        Array - An (U)WORD array where to store the values
  2987.        Entries - Number of entries to read (further entries will be ignored)
  2988.        Format - Format of the outputted string. Can be any of:
  2989.            INI_FORMAT_DEC - Use decimal with no precedor
  2990.            INI_FORMAT_DEC_CHAR - Use decimal with # precedor
  2991.            INI_FORMAT_HEX - Use hexadecimal with $ precedor
  2992.            INI_FORMAT_HEX_0X - Use hexadecimal with 0x precedor
  2993.            INI_FORMAT_BIN - Use binary with % precedor
  2994.            INI_FORMAT_OCT - Use octal with & precedor
  2995.            INI_FORMAT_YESNO - Use No for zero, Yes for all others
  2996.            INI_FORMAT_YN - Use N for zero, Y for all others
  2997.            INI_FORMAT_TRUEFALSE - Use False for zero, True for all others
  2998.            INI_FORMAT_ONOFF - Use Off for zero, On for all others
  2999.            INI_UNSIGNED - Add this to indicate unsigned integer
  3000.        Len - Forced length of outputted string or NULL for no force.
  3001.        ZeroSep - Zero character for IntLen leading zeroes. Usually " " or "0"
  3002.  
  3003.  
  3004. RESULT
  3005.        success - TRUE if accessing was successful else NULL.
  3006.  
  3007.  
  3008. EXAMPLE
  3009.        struct iniFile *ini;
  3010.        struct iniContext *context;
  3011.        struct iniContextItemLine *contextitem;
  3012.        WORD MyArray[4] = {-2000, -1000, 0, 1000};
  3013.  
  3014.        /* Let's open an INI file */
  3015.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  3016.  
  3017.        context = FindContext ( ini, "MyContext" );
  3018.  
  3019.        if (!( contextitem = FindContextItem ( context, "MyItem" )))
  3020.        {
  3021.          /* If not, create it! */
  3022.          if (!( contextitem = CreateContextItem ( "MyItem" )))
  3023.          {
  3024.            puts ( "Couldn't create my context item !" );
  3025.  
  3026.            exit ( 20 );
  3027.          }
  3028.  
  3029.          /* Make context available for access */
  3030.          AddContextItem ( context, contextitem );
  3031.        }
  3032.  
  3033.        iniPutWordA ( context, contextitem, MyArray,
  3034.                      (sizeof (MyArray) / sizeof (WORD)),
  3035.                      INI_FORMAT_DEC_CHAR, 0L, '0' );
  3036.  
  3037.        /* Let's say, ENVARC:MyPrefs.INI contains:
  3038.           [MyContext]
  3039.           MyItem = 1000, 2000, 3000, -10000
  3040.  
  3041.           then it will become:
  3042.           [MyContext]
  3043.           MyItem = -#2000, -#1000, #0, #1000
  3044.  
  3045.           Entries which can't be stored are left unchanged.
  3046.        */
  3047.  
  3048.  
  3049. NOTES
  3050.        This function is currently relatively slow. Especially with
  3051.        arrays with more than 16 entries.
  3052.  
  3053.  
  3054. BUGS
  3055.  
  3056.  
  3057. SEE ALSO
  3058.        iniPutByteA(), iniPutLongA(), iniWriteWordA(), iniReadWordA(),
  3059.        <libraries/ini_lib.h>
  3060.  
  3061.  
  3062. ini.library/iniReadByteA
  3063.  
  3064. NAME
  3065.        iniReadByteA -- reads a context item array into a (U)BYTE array.
  3066.  
  3067.  
  3068. SYNOPSIS
  3069.        success = iniReadByteA( iniFile, ContextName, ItemName, Array,
  3070.        D0                      A0       A1           A2        A3
  3071.                                Entries, Flags );
  3072.                                D0       D1
  3073.  
  3074.        BOOL iniReadByteA( struct iniFile *, STRPTR, STRPTR, BYTE *,
  3075.            ULONG, ULONG );
  3076.  
  3077.  
  3078. FUNCTION
  3079.        Searches a context item in a context you specified by name and stores
  3080.        the read bytes into a (U)BYTE table you specified.
  3081.  
  3082.  
  3083. INPUTS
  3084.        iniFile - INI file to be evaluated
  3085.        ContextName - Name of the context where context item is
  3086.            v32+: ContextName can be NULL. In this case all are searched
  3087.        ItemName - Name of the context item to be searched
  3088.        Array - An (U)BYTE array where to store the values
  3089.        Entries - Number of entries to read (further entries will be ignored)
  3090.        Flags - Search flags. They're currently defined as:
  3091.            INIF_ContextCase - Set this flag if the search of the context
  3092.                name should be case sensitive.
  3093.            INIF_ContextItemCase - Set this flag if the search of the context
  3094.                item name should be case sensitive.
  3095.  
  3096.  
  3097. RESULT
  3098.        success - TRUE if line could be evaluated else FALSE
  3099.  
  3100.  
  3101. EXAMPLE
  3102.        struct iniFile *ini;
  3103.        BYTE MyArray[4] = {-2, -1, -0, 1};
  3104.  
  3105.        /* Let's open an INI file */
  3106.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  3107.  
  3108.        iniReadByteA ( ini, "MyContext", "MyItem", MyArray,
  3109.                       sizeof (MyArray), 0L );
  3110.  
  3111.        /* Let's say, ENVARC:MyPrefs.INI contains:
  3112.           [MyContext]
  3113.           MyItem = 25, 50, 75, 100
  3114.  
  3115.           then
  3116.           MyArray[4] = {25, 50, 75, 100};
  3117.           Entries which can't be evaluated are left unchanged.
  3118.        */
  3119.  
  3120.  
  3121. NOTES
  3122.        Make sure that the given array is big enough to hold all values or
  3123.        some memory area may be overwritten.
  3124.  
  3125.        Fields which can't be evaluated are left unchanged.
  3126.  
  3127.  
  3128. BUGS
  3129.  
  3130.  
  3131. SEE ALSO
  3132.        iniReadWordA(), iniReadLongA(), iniGetByteA(), iniWriteByteA(),
  3133.        <libraries/ini_lib.h>
  3134.  
  3135.  
  3136. ini.library/iniReadFloat
  3137.  
  3138. NAME
  3139.        iniReadFloat -- Reads a quick floating point value
  3140.  
  3141.  
  3142. SYNOPSIS
  3143.        QFloatValue = iniReadFloat( iniFile, ContextName, ItemName, Default,
  3144.        D0                          A0       A1           A2        D0
  3145.                                    Flags );
  3146.                                    D1
  3147.  
  3148.        LONG iniReadFloat( struct iniFile *, STRPTR, STRPTR, LONG, ULONG );
  3149.  
  3150.  
  3151. FUNCTION
  3152.        Searches the INI file for the desired context and the desired context
  3153.        items and returns its quick floating point value.
  3154.  
  3155.  
  3156. INPUTS
  3157.        
  3158.        iniFile - INI file to be evaluated
  3159.        ContextName - Name of the context where context item is
  3160.            v32+: ContextName can be NULL. In this case all are searched
  3161.        ItemName - Name of the context item to be searched
  3162.        Default - Default value to take if contents could not be evaluated
  3163.        Flags - Search flags. They're currently defined as:
  3164.            INIF_ContextCase - Set this flag if the search of the context
  3165.                name should be case sensitive.
  3166.            INIF_ContextItemCase - Set this flag if the search of the context
  3167.                item name should be case sensitive.
  3168.  
  3169.  
  3170. RESULT
  3171.        QFloatValue - The quick float value extracted out
  3172.  
  3173.  
  3174. EXAMPLE
  3175.        struct iniFile *ini;
  3176.        LONG MyFloat;
  3177.  
  3178.        /* Let's open an INI file */
  3179.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  3180.  
  3181.        MyFloat = iniReadFloat ( ini, "MyContext", "MyItem", 0x28000, 0L ));
  3182.  
  3183.        /* Let's say, ENVARC:MyPrefs.INI contains:
  3184.           [MyContext]
  3185.           MyItem = 3.0
  3186.  
  3187.           then MyFloat will contain 0x30000. If this context or context item
  3188.           is not available, MyFloat will contain 0x28000 (default) instead.
  3189.        */
  3190.  
  3191.  
  3192. NOTES
  3193.        Only the first four fractional digits are evaluated. However, the
  3194.        5th digit is evaluated for rounding purposes.
  3195.  
  3196.  
  3197. BUGS
  3198.  
  3199.  
  3200. SEE ALSO
  3201.        iniReadLong(), iniReadStr(), iniReadFloatA(), iniWriteFloat(),
  3202.        GetFloat(), iniPutFloat(), <libraries/ini_lib.h>
  3203.  
  3204.  
  3205. ini.library/iniReadFloatA
  3206.  
  3207. NAME
  3208.        iniReadFloatA -- Reads quick floating point value(s) into an array
  3209.  
  3210.  
  3211. SYNOPSIS
  3212.        success = iniReadFloatA( iniFile, ContextName, ItemName, Array,
  3213.        D0                       A0       A1           A2        D0
  3214.                                 Entries, Flags );
  3215.                                 D1       D2
  3216.  
  3217.        BOOL iniReadFloatA( struct iniFile *, STRPTR, STRPTR, LONG *,
  3218.            ULONG, ULONG );
  3219.  
  3220.  
  3221. FUNCTION
  3222.        Searches the context given for the string given in context item and
  3223.        reads one or more quick float value(s) and stores them into the
  3224.        specified array.
  3225.  
  3226.  
  3227. INPUTS
  3228.        iniFile - INI file to be evaluated
  3229.        ContextName - Name of the context where context item is
  3230.            v32+: ContextName can be NULL. In this case all are searched
  3231.        ItemName - Name of the context item to be searched
  3232.        Default - Default value to take if contents could not be evaluated
  3233.        Flags - Search flags. They're currently defined as:
  3234.            INIF_ContextCase - Set this flag if the search of the context
  3235.                name should be case sensitive.
  3236.            INIF_ContextItemCase - Set this flag if the search of the context
  3237.                item name should be case sensitive.
  3238.  
  3239.  
  3240. RESULT
  3241.        success - TRUE if accessing was successful else NULL.
  3242.  
  3243.  
  3244. EXAMPLE
  3245.        struct iniFile *ini;
  3246.        LONG MyFloat[4] = {-0x10000, -0x8000, 0, 0x8000};
  3247.  
  3248.        /* Let's open an INI file */
  3249.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  3250.  
  3251.        iniReadFloatA ( ini, "MyContext", "MyItem", MyFloat,
  3252.                        (sizeof (MyFloat) / sizeof (LONG)), 0L );
  3253.  
  3254.        /* Let's say, ENVARC:MyPrefs.INI contains:
  3255.           [MyContext]
  3256.           MyItem = 1.0, 1.5, 2.0, 2.5
  3257.  
  3258.           then
  3259.           MyFloat[4] = {0x10000, 0x18000, 0x20000, 0x28000};
  3260.           Entries which can't be evaluated are left unchanged.
  3261.        */
  3262.  
  3263.  
  3264. NOTES
  3265.        This function is currently relatively slow. Especially with
  3266.        arrays with more than 16 entries.
  3267.        Only the first four fractional digits are evaluated. However, the
  3268.        5th digit is evaluated for rounding purposes.
  3269.        Array fields which can't be evaluated (e.g. bad syntax) are left
  3270.        unchanged. So it's good to fill the array with default values first.
  3271.  
  3272.  
  3273. BUGS
  3274.  
  3275.  
  3276. SEE ALSO
  3277.        iniWriteLongA(), iniWriteStrA(), iniReadFloat(), iniWriteFloatA(),
  3278.        iniGetFloatA(), iniPutFloatA(), <libraries/ini_lib.h>
  3279.  
  3280.  
  3281. ini.library/iniReadLong
  3282.  
  3283. NAME
  3284.        iniReadLong -- Reads a long integer value
  3285.  
  3286.  
  3287. SYNOPSIS
  3288.        LongValue = iniReadLong( iniFile, ContextName, ItemName, Default,
  3289.        D0                       A0       A1           A2        D0
  3290.                                 Flags );
  3291.                                 D1
  3292.  
  3293.        LONG iniReadLong( struct iniFile *, STRPTR, STRPTR, LONG, ULONG );
  3294.  
  3295.  
  3296. FUNCTION
  3297.        Searches the INI file for the desired context and the desired context
  3298.        items and returns its long integer value.
  3299.  
  3300.  
  3301. INPUTS
  3302.        
  3303.        iniFile - INI file to be evaluated
  3304.        ContextName - Name of the context where context item is
  3305.            v32+: ContextName can be NULL. In this case all are searched
  3306.        ItemName - Name of the context item to be searched
  3307.        Default - Default value to take if contents could not be evaluated
  3308.        Flags - Search flags. They're currently defined as:
  3309.            INIF_ContextCase - Set this flag if the search of the context
  3310.                name should be case sensitive.
  3311.            INIF_ContextItemCase - Set this flag if the search of the context
  3312.                item name should be case sensitive.
  3313.  
  3314.  
  3315. RESULT
  3316.        LongValue - The long integer extracted out
  3317.  
  3318.  
  3319. EXAMPLE
  3320.        struct iniFile *ini;
  3321.        LONG MyLong;
  3322.  
  3323.        /* Let's open an INI file */
  3324.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  3325.  
  3326.        context = FindContext ( ini, "MyContext" );
  3327.  
  3328.        MyLong = iniReadLong ( ini, "MyContext", "MyItem", 12345678, 0L );
  3329.  
  3330.        /* Let's say, ENVARC:MyPrefs.INI contains:
  3331.           [MyContext]
  3332.           MyItem = -256
  3333.  
  3334.           then MyLong will contain -256. If this context or context item
  3335.           is not available, MyLong will contain 12345678 (default) instead.
  3336.        */
  3337.  
  3338.  
  3339. NOTES
  3340.  
  3341.  
  3342. BUGS
  3343.  
  3344.  
  3345. SEE ALSO
  3346.        iniReadLong(), iniReadStr(), iniReadFloatA(), iniWriteFloat(),
  3347.        iniGetFloat(), iniPutFloat(), <libraries/ini_lib.h>
  3348.  
  3349.  
  3350. ini.library/iniReadLongA
  3351.  
  3352. NAME
  3353.        iniReadLongA -- Reads long integer value(s) into an array
  3354.  
  3355.  
  3356. SYNOPSIS
  3357.        success = iniReadLongA( iniFile, ContextName, ItemName, Array,
  3358.        D0                      A0          A1        A2        D0
  3359.                                Entries, Flags );
  3360.  
  3361.        BOOL iniReadLongA( struct iniFile *, STRPTR, STRPTR, LONG *,
  3362.            LONG, ULONG );
  3363.  
  3364.  
  3365. FUNCTION
  3366.        Searches the context given for the string given in context item and
  3367.        reads one or more long integer value(s) and stores them into the
  3368.        specified array.
  3369.  
  3370.  
  3371. INPUTS
  3372.        iniFile - INI file to be evaluated
  3373.        ContextName - Name of the context where context item is
  3374.            v32+: ContextName can be NULL. In this case all are searched
  3375.        ItemName - Name of the context item to be searched
  3376.        Default - Default value to take if contents could not be evaluated
  3377.        Flags - Search flags. They're currently defined as:
  3378.            INIF_ContextCase - Set this flag if the search of the context
  3379.                name should be case sensitive.
  3380.            INIF_ContextItemCase - Set this flag if the search of the context
  3381.                item name should be case sensitive.
  3382.  
  3383.  
  3384. RESULT
  3385.        success - TRUE if accessing was successful else NULL.
  3386.  
  3387.  
  3388. EXAMPLE
  3389.        struct iniFile *ini;
  3390.        LONG MyArray[4] = {4096, 65536, 16777216, 2147483647};
  3391.  
  3392.        /* Let's open an INI file */
  3393.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  3394.  
  3395.        iniReadLongA ( ini, "MyContext", "MyItem", MyArray,
  3396.                       (sizeof (MyArray) / sizeof (LONG)), 0L );
  3397.  
  3398.        /* Let's say, ENVARC:MyPrefs.INI contains:
  3399.           [MyContext]
  3400.           MyItem = -4096, -65536, -16777216, -2147483648
  3401.  
  3402.           then
  3403.           MyArray[4] = {-4096, -65536, -16777216, -2147483648};
  3404.           Entries which can't be evaluated are left unchanged.
  3405.        */
  3406.  
  3407.  
  3408. NOTES
  3409.        Array fields which can't be evaluated (e.g. bad syntax) are left
  3410.        unchanged. So it's good to fill the array with default values first.
  3411.  
  3412.  
  3413. BUGS
  3414.  
  3415.  
  3416. SEE ALSO
  3417.        iniPutLongA(), iniPutStrA(), iniGetFloat(), iniPutFloatA(),
  3418.        iniReadFloatA(), iniWriteFloatA(), <libraries/ini_lib.h>
  3419.  
  3420.  
  3421. ini.library/iniReadStr
  3422.  
  3423. NAME
  3424.        iniReadStr -- Gets a string
  3425.  
  3426.  
  3427. SYNOPSIS
  3428.        String = iniReadStr( iniFile, ContextName, ItemName, Default,
  3429.        D0                   A0       A1           A2        A3
  3430.                             Flags );
  3431.                             D0
  3432.  
  3433.        STRPTR iniReadStr( struct iniFile *, STRPTR, STRPTR, STRPTR, ULONG );
  3434.  
  3435.  
  3436. FUNCTION
  3437.        Searches the given context item in the given context and returns, if
  3438.        found the context item data as a string.
  3439.  
  3440.  
  3441. INPUTS
  3442.        iniFile - INI file to be evaluated
  3443.        ContextName - Name of the context where context item is
  3444.            v32+: ContextName can be NULL. In this case all are searched
  3445.        ItemName - Name of the context item to be searched
  3446.        Default - Default string to take if contents could not be evaluated
  3447.        Flags - Search flags. They're currently defined as:
  3448.            INIF_ContextCase - Set this flag if the search of the context
  3449.                name should be case sensitive.
  3450.            INIF_ContextItemCase - Set this flag if the search of the context
  3451.                item name should be case sensitive.
  3452.  
  3453.  
  3454. RESULT
  3455.        String - The string value extracted out
  3456.  
  3457.  
  3458. EXAMPLE
  3459.        struct iniFile *ini;
  3460.        STRPTR MyStr;
  3461.  
  3462.        /* Let's open an INI file */
  3463.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  3464.  
  3465.        MyStr = iniReadStr ( ini, "MyContext", "MyItem", "MyString", 0L ));
  3466.  
  3467.        puts ( MyStr );
  3468.  
  3469.        iniFreeNameStr ( MyStr );
  3470.  
  3471.        /* Let's say, ENVARC:MyPrefs.INI contains:
  3472.           [MyContext]
  3473.           MyItem = Hello world!
  3474.  
  3475.           then MyStr will contain "Hello world!". If this context or context
  3476.           item is not available, MyStr will contain "MyString" (default)
  3477.           instead.
  3478.        */
  3479.  
  3480.  
  3481. NOTES
  3482.        The string returned must be deallocated with iniFreeNameStr() after
  3483.        use.
  3484.  
  3485.  
  3486. BUGS
  3487.  
  3488.  
  3489. SEE ALSO
  3490.        iniReadLongA(), iniReadFloatA(), iniWriteStr(), iniGetStrA(),
  3491.        iniPutStrA(), <libraries/ini_lib.h>
  3492.  
  3493.  
  3494. ini.library/iniReadStrA
  3495.  
  3496. NAME
  3497.        iniReadStrA -- Extracts strings out of an array
  3498.  
  3499.  
  3500. SYNOPSIS
  3501.        success = iniReadStrA( iniFile, ContextName, ItemName, Array,
  3502.        D0                     A0       A1           A2        A3
  3503.                               Entries, Flags );
  3504.                               D0       D1
  3505.  
  3506.        BOOL iniReadStrA( struct iniFile *, STRPTR, STRPTR, STRPTR *, ULONG,
  3507.            ULONG );
  3508.  
  3509.  
  3510. FUNCTION
  3511.        Searches for the given context item in the given context and reads
  3512.        the string(s) into the specified array.
  3513.  
  3514.  
  3515. INPUTS
  3516.        iniFile - INI file to be evaluated
  3517.        ContextName - Name of the context where context item is
  3518.            v32+: ContextName can be NULL. In this case all are searched
  3519.        ItemName - Name of the context item to be searched
  3520.        Array - Array where to put the pointers to the strings
  3521.        Flags - Search flags. They're currently defined as:
  3522.            INIF_ContextCase - Set this flag if the search of the context
  3523.                name should be case sensitive.
  3524.            INIF_ContextItemCase - Set this flag if the search of the context
  3525.                item name should be case sensitive.
  3526.  
  3527.  
  3528. RESULT
  3529.        success - TRUE if accessing was successful else NULL.
  3530.  
  3531.  
  3532. EXAMPLE
  3533.        struct iniFile *ini;
  3534.        STRPTR MyStr[4] = {NULL, NULL, NULL, NULL};
  3535.  
  3536.        MyStr[0] = iniAllocNameStr ( "String 1" );
  3537.        MyStr[1] = iniAllocNameStr ( "String 2" );
  3538.        MyStr[2] = iniAllocNameStr ( "String 3" );
  3539.        MyStr[3] = iniAllocNameStr ( "String 4" );
  3540.  
  3541.        /* Let's open an INI file */
  3542.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  3543.  
  3544.        iniReadStrA ( ini, "MyContext", "MyItem", MyStr,
  3545.                      (sizeof (MyStr) / sizeof (STRPTR)), 0L );
  3546.  
  3547.        printf ( "%s, %s, %s, %s\n", MyStr[0], MyStr[1], MyStr[2], MyStr[3]);
  3548.  
  3549.        iniFreeNameStr ( MyStr[0] );
  3550.        iniFreeNameStr ( MyStr[1] );
  3551.        iniFreeNameStr ( MyStr[2] );
  3552.        iniFreeNameStr ( MyStr[3] );
  3553.  
  3554.        /* Let's say, ENVARC:MyPrefs.INI contains:
  3555.           [MyContext]
  3556.           MyItem = Hello 1, Hello 2, Hello 3, Hello 4
  3557.  
  3558.           then
  3559.           MyStr[4] = {"Hello 1", "Hello 2", "Hello 3", "Hello 4"};
  3560.           Entries which can't be evaluated are left unchanged.
  3561.        */
  3562.  
  3563.  
  3564. NOTES
  3565.        Array fields which can't be evaluated (e.g. bad syntax) are left
  3566.        unchanged. So it's good to fill the array with default strings first.
  3567.        All array fields must be deallocated with iniFreeNameStr() when they
  3568.        are not required anymore. This means that the default entries of the
  3569.        array must be iniAllocNameStr() strings!
  3570.  
  3571. BUGS
  3572.  
  3573.  
  3574. SEE ALSO
  3575.        iniReadLongA(), iniReadFloatA(), iniReadStr(), iniWriteStrA(),
  3576.        iniGetStrA(), iniPutStrA(), <libraries/ini_lib.h>
  3577.  
  3578.  
  3579. ini.library/iniReadWordA
  3580.  
  3581. NAME
  3582.        iniReadWordA -- reads a context item array into a (U)WORD array.
  3583.  
  3584.  
  3585. SYNOPSIS
  3586.        success = iniReadWordA( iniFile, ContextName, ItemName, Array,
  3587.        D0                      A0       A1           A2        A3
  3588.                                Entries, Flags );
  3589.                                D0       D1
  3590.  
  3591.        BOOL iniReadWordA( struct iniFile *, STRPTR, STRPTR, WORD *,
  3592.            ULONG, ULONG );
  3593.  
  3594.  
  3595. FUNCTION
  3596.        Searches a context item in a context you specified by name and stores
  3597.        the read bytes into a (U)WORD table you specified.
  3598.  
  3599.  
  3600. INPUTS
  3601.        iniFile - INI file to be evaluated
  3602.        ContextName - Name of the context where context item is
  3603.            v32+: ContextName can be NULL. In this case all are searched
  3604.        ItemName - Name of the context item to be searched
  3605.        Array - An (U)WORD array where to store the values
  3606.        Entries - Number of entries to read (further entries will be ignored)
  3607.        Flags - Search flags. They're currently defined as:
  3608.            INIF_ContextCase - Set this flag if the search of the context
  3609.                name should be case sensitive.
  3610.            INIF_ContextItemCase - Set this flag if the search of the context
  3611.                item name should be case sensitive.
  3612.  
  3613.  
  3614. RESULT
  3615.        success - TRUE if line could be evaluated else FALSE
  3616.  
  3617.  
  3618. EXAMPLE
  3619.        struct iniFile *ini;
  3620.        WORD MyArray[4] = {16, 64, 256, 4096};
  3621.  
  3622.        /* Let's open an INI file */
  3623.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  3624.  
  3625.        iniReadWordA ( ini, "MyContext", "MyItem",
  3626.                       (sizeof (MyArray) / sizeof (WORD)), 0L );
  3627.  
  3628.        /* Let's say, ENVARC:MyPrefs.INI contains:
  3629.           [MyContext]
  3630.           MyItem = 10000, 1000, 10, 1
  3631.  
  3632.           then
  3633.           MyArray[4] = {10000, 1000, 10, 1};
  3634.           Entries which can't be evaluated are left unchanged.
  3635.        */
  3636.  
  3637.  
  3638. NOTES
  3639.        Make sure that the given array is big enough to hold all values or
  3640.        some memory area may be overwritten.
  3641.  
  3642.        Fields which can't be evaluated are left unchanged.
  3643.  
  3644.  
  3645. BUGS
  3646.  
  3647.  
  3648. SEE ALSO
  3649.        iniReadByteA(), iniReadLongA(), iniGetWordA(), iniWriteWordA(),
  3650.        <libraries/ini_lib.h>
  3651.  
  3652.  
  3653. ini.library/iniRemContext
  3654.  
  3655. NAME
  3656.        iniRemContext -- removes the last context from an INI file structure
  3657.  
  3658.  
  3659. SYNOPSIS
  3660.        iniRemContext( iniFile );
  3661.                       A0
  3662.  
  3663.        void iniRemContext( struct iniFile *);
  3664.  
  3665.  
  3666. FUNCTION
  3667.        Removes a previously generated and added context from a specified
  3668.        INI file structure. The entry removed is the last one.
  3669.  
  3670.  
  3671. INPUTS
  3672.        iniFile - Pointer to INI structure where to remove from
  3673.  
  3674.  
  3675. NOTES
  3676.        This function *DOESN'T* do any deallocations. It just removes the
  3677.        node from the context list.
  3678.  
  3679.  
  3680. BUGS
  3681.  
  3682.  
  3683. SEE ALSO
  3684.        iniCreateContext(), iniFreeContext(), iniAddContext(),
  3685.        iniInsertContext(), iniDeleteContext(), <libraries/ini_lib.h>
  3686.  
  3687.  
  3688. ini.library/iniRemContextItem
  3689.  
  3690. NAME
  3691.        iniRemContextItem -- removes the last context item line from a
  3692.                             context structure
  3693.  
  3694.  
  3695. SYNOPSIS
  3696.        iniRemContextItem( ContextStr );
  3697.                           A0
  3698.  
  3699.        void iniRemContextItem( struct iniContext *);
  3700.  
  3701.  
  3702. FUNCTION
  3703.        Removes a previously generated context item line from a context
  3704.        structure. The context item line removed is the last one.
  3705.  
  3706.  
  3707. INPUTS
  3708.        ContextStr - Pointer to context structure where to remove from
  3709.  
  3710.  
  3711. NOTES
  3712.        This function just removes the node, it *DOESN'T* deallocate any
  3713.        memory.
  3714.  
  3715.  
  3716. BUGS
  3717.  
  3718.  
  3719. SEE ALSO
  3720.        iniCreateContextItem(), iniFreeContextItem(), iniRemContextItem(),
  3721.        iniInsertContextItem(), iniDeleteContextItem(), <libraries/ini_lib.h>
  3722.  
  3723.  
  3724. ini.library/iniSaveFile
  3725.  
  3726. NAME
  3727.        iniSaveFile -- Saves an .INI file from an INI structure to disk
  3728.  
  3729.  
  3730. SYNOPSIS
  3731.        written = iniSaveFile( iniFile, name, accessMode );
  3732.        D0                     A0       D1    D2
  3733.  
  3734.        ULONG iniSaveFile( struct iniFile *, STRPTR, LONG );
  3735.  
  3736.  
  3737. FUNCTION
  3738.        Saves an INI file to disk using the current INI structure. This
  3739.        function usually is called when the user selects 'Save' in an
  3740.        application.
  3741.  
  3742.  
  3743. INPUTS
  3744.        iniFile - INI structure to be saved
  3745.        name - Name of the INI file to be created.
  3746.        accessMode - Write mode of file (see <libraries/dos.h> for details)
  3747.  
  3748.  
  3749. RESULT
  3750.        written - Number of bytes written in total or -1 on error.
  3751.  
  3752.  
  3753. EXAMPLE
  3754.        struct iniFile *ini;
  3755.        ULONG Length;
  3756.  
  3757.        /* Open old INI file */
  3758.  
  3759.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  3760.  
  3761.        /* Write some value. Create contexts and/or
  3762.           context item if necessary */
  3763.  
  3764.        iniWriteLong ( ini, "MyContext", "MyItem", 5L, 0L );
  3765.  
  3766.        /* Now write back the INI file to disk */
  3767.  
  3768.        Length = iniSaveFile ( ini, "ENVARC:MyPrefs.INI", MODE_NEWFILE );
  3769.  
  3770.        iniClose ( ini );
  3771.  
  3772.  
  3773. NOTES
  3774.  
  3775.  
  3776. BUGS
  3777.  
  3778.  
  3779. SEE ALSO
  3780.        iniOpen(), iniOpenDefault(), iniOpenFromFH(), iniOpenMem(),
  3781.        iniClose(), <libraries/ini_lib.h>, <libraries/dos.h>
  3782.  
  3783.  
  3784. ini.library/iniSaveToFH
  3785.  
  3786. NAME
  3787.        iniSaveToFH -- Saves an INI structure to an already opened file
  3788.  
  3789.  
  3790. SYNOPSIS
  3791.        written = iniSaveToFH( fh, iniFile );
  3792.        D0                     A0  A1
  3793.  
  3794.        ULONG iniSaveToFH( BPTR, struct iniFile *);
  3795.  
  3796.  
  3797. FUNCTION
  3798.        Writes the INI data from the specified INI structure to the file
  3799.        already opened. The file won't be closed after writing, so you can
  3800.        add more data manually.
  3801.  
  3802.  
  3803. INPUTS
  3804.        fh - BPTR to an file handle of the already opened file to be written.
  3805.        iniFile - INI structure to be saved
  3806.  
  3807.  
  3808. RESULT
  3809.        written - Number of bytes written in total or -1 on error.
  3810.  
  3811.  
  3812. NOTES
  3813.        The file is not closed after the data is written. Called from
  3814.        iniSaveFile() after opening the file.
  3815.  
  3816.  
  3817. BUGS
  3818.  
  3819.  
  3820. SEE ALSO
  3821.        iniOpenDefault(), iniOpenFile(), iniOpenFromFH(), iniOpenMem(),
  3822.        iniClose(), iniSaveFile(), <libraries/ini_lib.h>
  3823.  
  3824.  
  3825. ini.library/iniSetNameStr
  3826.  
  3827. NAME
  3828.        iniSetNameStr -- sets a name string in a given structure offset
  3829.  
  3830.  
  3831. SYNOPSIS
  3832.        namestring = iniSetNameStr( StructPos, namestring );
  3833.        D0                          A0
  3834.  
  3835.        STRPTR iniSetNameStr( STRPTR *, STRPTR namestring );
  3836.  
  3837.  
  3838. FUNCTION
  3839.        Stores a name string into an structure position. This is required
  3840.        if you use own strings in the library handlers.
  3841.  
  3842.  
  3843. INPUTS
  3844.        StructPos - A memory pointer where the string pointer should be
  3845.            assigned.
  3846.        namestring - The already iniAllocNameStr()ed name string to be
  3847.            assigned.
  3848.  
  3849.  
  3850. RESULT
  3851.        namestring - The name string stored or NULL on error. 
  3852.  
  3853.  
  3854. EXAMPLE
  3855.        STRPTR MyStr[4] = {NULL, NULL, NULL, NULL}
  3856.        STRPTR TmpStr;
  3857.  
  3858.        /* Fill in the buffers with some shit */
  3859.  
  3860.        MyStr[0] = iniAllocNameStr ( "String 1" );
  3861.        MyStr[1] = iniAllocNameStr ( "String 2" );
  3862.        MyStr[2] = iniAllocNameStr ( "String 3" );
  3863.        MyStr[3] = iniAllocNameStr ( "String 4" );
  3864.  
  3865.        /* Now we have to change the strings for some reasons. We don't have
  3866.           to care about the old values, they're freed automatically. */
  3867.  
  3868.        TmpStr = iniAllocNameStr ( "Changed 1" );
  3869.        iniSetNameStr ( (STRPTR *) &(MyStr[0]), TmpStr );
  3870.  
  3871.        TmpStr = iniAllocNameStr ( "Changed 2" );
  3872.        iniSetNameStr ( (STRPTR *) &(MyStr[1]), TmpStr );
  3873.  
  3874.        TmpStr = iniAllocNameStr ( "Changed 3" );
  3875.        iniSetNameStr ( (STRPTR *) &(MyStr[2]), TmpStr );
  3876.  
  3877.        TmpStr = iniAllocNameStr ( "Changed 4" );
  3878.        iniSetNameStr ( (STRPTR *) &(MyStr[3]), TmpStr );
  3879.  
  3880.  
  3881. NOTES
  3882.        Internally called from iniSetString(). You need this function to
  3883.        assign a already iniAllocNameStr()ed to a structure.
  3884.  
  3885.  
  3886. BUGS
  3887.  
  3888.  
  3889. SEE ALSO
  3890.       iniAllocNameStr(), iniFreeNameStr(), iniSetString()
  3891.  
  3892.  
  3893. ini.library/iniSetString
  3894.  
  3895. NAME
  3896.        iniSetString -- allocates and sets a name string in a given structure
  3897.            offset
  3898.  
  3899.  
  3900. SYNOPSIS
  3901.        namestring = iniSetString( StructPos, string );
  3902.        D0                          A0
  3903.  
  3904.        STRPTR iniSetNameStr( STRPTR *, STRPTR string );
  3905.  
  3906.  
  3907. FUNCTION
  3908.        Allocates a name string out of a standard NULL-terminated C-String
  3909.        and assigns the allocated pointer to the structure position.
  3910.        This is required if you use own strings in the library handlers.
  3911.  
  3912.  
  3913. INPUTS
  3914.        StructPos - A memory pointer where the string pointer should be
  3915.            assigned.
  3916.        string - The C-String to be assigned.
  3917.  
  3918.  
  3919. RESULT
  3920.        namestring - The name string stored or NULL on error. 
  3921.  
  3922.  
  3923. EXAMPLE
  3924.        STRPTR MyStr[4] = {NULL, NULL, NULL, NULL}
  3925.  
  3926.        /* Fill in the buffers with some shit */
  3927.  
  3928.        MyStr[0] = iniAllocNameStr ( "String 1" );
  3929.        MyStr[1] = iniAllocNameStr ( "String 2" );
  3930.        MyStr[2] = iniAllocNameStr ( "String 3" );
  3931.        MyStr[3] = iniAllocNameStr ( "String 4" );
  3932.  
  3933.        /* Now we have to change the strings for some reasons. We don't have
  3934.           to care about the old values, they're freed automatically. */
  3935.  
  3936.        iniSetString ( (STRPTR *) &(MyStr[0]), "Changed 1" );
  3937.        iniSetString ( (STRPTR *) &(MyStr[1]), "Changed 2" );
  3938.        iniSetString ( (STRPTR *) &(MyStr[2]), "Changed 3" );
  3939.        iniSetString ( (STRPTR *) &(MyStr[3]), "Changed 4" );
  3940.  
  3941.  
  3942. NOTES
  3943.        The namestring is a copy of string, but it's freed via iniFreePMem()
  3944.  
  3945.  
  3946. BUGS
  3947.  
  3948.  
  3949. SEE ALSO
  3950.       iniAllocNameStr(), iniFreeNameStr(), iniSetNameStr()
  3951.  
  3952.  
  3953. ini.library/iniStrToFloat
  3954.  
  3955. NAME
  3956.        iniStrToFloat -- Converts a string to a quick float value.
  3957.  
  3958.  
  3959. SYNOPSIS
  3960.        QFloat = iniStrToFloat( String, Default );
  3961.        D0                      A0      D0
  3962.  
  3963.        LONG iniStrToFloat( STRPTR, LONG );
  3964.  
  3965.  
  3966. FUNCTION
  3967.        This function is used to convert a standard ASCII string to a
  3968.        quick float value. The string may have signs (+/-) and a decimal
  3969.        point. A quick float value has in it's upper 16-bits the decimal
  3970.        value and in the lower 16-bits the fraction. That means, the highest
  3971.        possible accuracy is 1/65536. If the string can't be converted for
  3972.        any reason, the default value is used.
  3973.  
  3974.  
  3975. INPUTS
  3976.        String - The string containing the quick float value.
  3977.        Default - Default quick float value to use if error.
  3978.  
  3979.  
  3980. RESULT
  3981.        QFloat - The converted quick float value or the default value.
  3982.  
  3983.  
  3984. EXAMPLE
  3985.        LONG QFloat;
  3986.  
  3987.        QFloat = iniStrToFloat ( "3.14159", 0x10000 );
  3988.  
  3989.        QFloat will be 0x3243F (3.1416). If an error would have occured,
  3990.        QFloat would default to 0x10000 (1.0).
  3991.  
  3992.  
  3993. NOTES
  3994.        The string's value may not exceed -65536/+65535 or an overflow error
  3995.        will occur. The value after the period will only be interpreted up
  3996.        to 4 digits. However, the 5th digit will be interpreted for rounding
  3997.        purposes.
  3998.  
  3999.  
  4000. BUGS
  4001.  
  4002.  
  4003. SEE ALSO
  4004.       iniStrToInt(), iniIntToStr(), iniFloatToStr(), <libraries/ini_lib.h>
  4005.  
  4006.  
  4007. ini.library/iniStrToInt
  4008.  
  4009. NAME
  4010.        iniStrToInt -- Converts a string to an (un)signed 32-bit integer.
  4011.  
  4012.  
  4013. SYNOPSIS
  4014.        Integer = iniStrToInt( String, Default );
  4015.        D0                     A0      D0
  4016.  
  4017.        LONG iniStrToInt( STRPTR, LONG );
  4018.  
  4019.  
  4020. FUNCTION
  4021.        This function is used to convert a standard ASCII string to a
  4022.        standard 32-bit (un)signed integer value. The string may have signs
  4023.        (+/-) and can be in hexadecimal, decimal, binary and octal formats.
  4024.        Hexadecimal strings are preceded with $ or 0x. Binary strings with
  4025.        %, octal strings with & and decimal strings start either with nothing
  4026.        or with a #. In addition to this, the following strings will return
  4027.        -1: Yes, Y, True, On
  4028.         0: No, N, False, Off
  4029.  
  4030.        The match isn't case sensitive, so e.g. YES will also return -1.
  4031.        This makes evaluations easier of context items like:
  4032.        EnableFunction = Yes.
  4033.  
  4034.        This means that iniReadLong, etc. automatically take care of this.
  4035.  
  4036. INPUTS
  4037.        String - The string containing the integer value.
  4038.        Default - Default integer value to use if error.
  4039.  
  4040.  
  4041. RESULT
  4042.        Integer - The converted integer value or the default value.
  4043.  
  4044.  
  4045. EXAMPLE
  4046.        LONG IntValue;
  4047.  
  4048.        IntValue = iniStrToInt ( "%1111000011110000", 0x10000 );
  4049.  
  4050.        IntValue will be 0xF0F0 (61680) after calling this function.
  4051.        If an error would have occured during conversion, IntValue would
  4052.        default to 0x10000 (65536).
  4053.  
  4054.  
  4055. NOTES
  4056.        However, the string's value may not exceed -4,294,967,296 and
  4057.        +4,294,967,295 (32 bit limit) or an overflow error will occur.
  4058.        This function is used for all string to integer conversions.
  4059.  
  4060.  
  4061. BUGS
  4062.  
  4063.  
  4064. SEE ALSO
  4065.       iniStrToFloat(), iniIntToStr(), iniFloatToStr(), <libraries/ini_lib.h>
  4066.  
  4067.  
  4068. ini.library/iniWriteByteA
  4069.  
  4070. NAME
  4071.        iniWriteByteA -- writes an (U)BYTE array into an context item array.
  4072.  
  4073.  
  4074. SYNOPSIS
  4075.        success = iniWriteByteA( iniFile, ContextName, ItemName, Array,
  4076.        D0                       A0       A1           A2        A3
  4077.                                 Entries, Flags, Format, Len, ZeroSep );
  4078.                                 D0       D1     D2      D3   D4:8
  4079.  
  4080.        BOOL iniWriteByteA( struct iniFile *, STRPTR, STRPTR, BYTE *,
  4081.            ULONG, ULONG, ULONG, ULONG, UBYTE );
  4082.  
  4083.  
  4084. FUNCTION
  4085.        Writes the values of the given (U)BYTE table to the specified context
  4086.        item in the given context.
  4087.  
  4088.  
  4089. INPUTS
  4090.        iniFile - INI structure of the INI file which should be affected
  4091.        ContextName - The context name (C-String) in which context to store
  4092.            v32+: the context will be created if it's not existant
  4093.        ItemName - The context item name (C-String) in which the context item
  4094.            lies to write to.
  4095.            v32+: the context item will be created if it's not existant
  4096.        Array - An (U)BYTE array where to take the values from
  4097.        Entries - Number of entries to write
  4098.        Flags - Search flags. They're currently defined as:
  4099.            INIF_ContextCase - Set this flag if the search of the context
  4100.                name should be case sensitive.
  4101.            INIF_ContextItemCase - Set this flag if the search of the context
  4102.                item name should be case sensitive.
  4103.        Format - Format of array entries to write out:
  4104.            INI_FORMAT_DEC - Use decimal with no precedor
  4105.            INI_FORMAT_DEC_CHAR - Use decimal with # precedor
  4106.            INI_FORMAT_HEX - Use hexadecimal with $ precedor
  4107.            INI_FORMAT_HEX_0X - Use hexadecimal with 0x precedor
  4108.            INI_FORMAT_BIN - Use binary with % precedor
  4109.            INI_FORMAT_OCT - Use octal with & precedor
  4110.            INI_FORMAT_YESNO - Use No for zero, Yes for all others
  4111.            INI_FORMAT_YN - Use N for zero, Y for all others
  4112.            INI_FORMAT_TRUEFALSE - Use False for zero, True for all others
  4113.            INI_FORMAT_ONOFF - Use Off for zero, On for all others
  4114.            INI_UNSIGNED - Add this to indicate unsigned integer
  4115.        Len - Forced length of outputted string or NULL for no force.
  4116.        ZeroSep - Zero character for IntLen leading zeroes. Usually " " or "0"
  4117.  
  4118.  
  4119. RESULT
  4120.        success - TRUE if line could be written else FALSE
  4121.  
  4122.  
  4123. EXAMPLE
  4124.        struct iniFile *ini;
  4125.        BYTE MyArray[4] = {-2, -1, 0, 1};
  4126.  
  4127.        /* Let's open an INI file */
  4128.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  4129.  
  4130.        iniWriteByteA ( ini, "MyContext", "MyItem", MyArray,
  4131.                        sizeof (MyArray), INI_FORMAT_DEC, 3L, '0' );
  4132.  
  4133.        /* Let's say, ENVARC:MyPrefs.INI contains:
  4134.           [MyContext]
  4135.           MyItem = 25, 50, 75, 100
  4136.  
  4137.           then it will become (even if MyContext or MyItem don't exist yet):
  4138.           [MyContext]
  4139.           MyItem = -002, -001, 000, 001
  4140.  
  4141.           Entries which can't be stored are left unchanged.
  4142.        */
  4143.  
  4144.  
  4145. NOTES
  4146.        This function calls iniPutByteA() which is currently relatively slow.
  4147.        Especially with arrays with more than 16 entries.
  4148.  
  4149.  
  4150. BUGS
  4151.  
  4152.  
  4153. SEE ALSO
  4154.        iniWriteWordA(), iniWriteLongA(), iniPutByteA(), iniReadByteA(),
  4155.        <libraries/ini_lib.h>
  4156.  
  4157.  
  4158. ini.library/iniWriteFloat
  4159.  
  4160. NAME
  4161.        iniWriteFloat -- Writes a quick floating point value into given
  4162.            item line
  4163.  
  4164.  
  4165. SYNOPSIS
  4166.        success = iniWriteFloat( iniFile, ContextName, ItemName, Value,
  4167.        D0                       A0       A1           A2        D0
  4168.                                 Flags, FltFormat, IntLen, FracLen, ZeroSep );
  4169.                                 D1     D2         D3      D4       D5:8
  4170.  
  4171.        BOOL iniWriteFloat( struct iniFile *, STRPTR, STRPTR, LONG, ULONG,
  4172.            ULONG, ULONG, UBYTE );
  4173.  
  4174.  
  4175. FUNCTION
  4176.        Writes a quick float value into the given context item, belonging
  4177.        to the specified context.
  4178.  
  4179.  
  4180. INPUTS
  4181.        iniFile - INI structure of the INI file to be accessed
  4182.        ContextName - Name of the context where context item lies
  4183.            v32+: the context will be created if it's not existant
  4184.        ItemName - Name of the context item where context item line lies
  4185.            v32+: the context item will be created if it's not existant
  4186.        Value - Quick float value to be written
  4187.        Flags - Search flags. They're currently defined as:
  4188.            INIF_ContextCase - Set this flag if the search of the context
  4189.                name should be case sensitive.
  4190.            INIF_ContextItemCase - Set this flag if the search of the context
  4191.                item name should be case sensitive.
  4192.        FltFormat - Format of the floating point value. Can be any of:
  4193.            INI_FLOAT_FORMAT_DEC - Use decimal with point separator
  4194.            INI_FLOAT_UNSIGNED - Add this to indicate unsigned quick float
  4195.        IntLen - Forced length of integer part or NULL for no force.
  4196.        FracLen - Forced length of fractional part or NULL for no force.
  4197.        ZeroSep - Zero character for IntLen leading zeroes. Usually " " or "0"
  4198.  
  4199.  
  4200. RESULT
  4201.        success - TRUE if successful write else FALSE
  4202.  
  4203.  
  4204. EXAMPLE
  4205.        struct iniFile *ini;
  4206.  
  4207.        /* Let's open an INI file */
  4208.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  4209.  
  4210.        iniWriteFloat ( ini, "MyContext", "MyItem", 0x28000,
  4211.                        INI_FLOAT_FORMAT_DEC, 0L, 3L, ' ' );
  4212.  
  4213.        /* After this, ENVARC:MyPrefs.INI will contain:
  4214.           [MyContext]
  4215.           MyItem = 2.500
  4216.  
  4217.           If the context or the context item doesn't exist, they will be
  4218.           created in order to be written.
  4219.        */
  4220.  
  4221.  
  4222. NOTES
  4223.        This function calls from iniPutFloat().
  4224.  
  4225.  
  4226. BUGS
  4227.  
  4228.  
  4229. SEE ALSO
  4230.        iniWriteLong(), iniWriteStr(), iniWriteFloatA(), iniReadFloat(),
  4231.        iniPutFloat(), iniGetFloat(), <libraries/ini_lib.h>
  4232.  
  4233.  
  4234. ini.library/iniWriteFloatA
  4235.  
  4236. NAME
  4237.        iniWriteFloatA -- Writes quick floating point value(s) into
  4238.            item line(s)
  4239.  
  4240.  
  4241. SYNOPSIS
  4242.        success = iniWriteFloatA( iniFile, ContextName, ItemName, Array,
  4243.        D0                        A0       A1           A2        A3
  4244.                                  Entries, Flags, FltFormat, IntLen, FracLen,
  4245.                                  D0       D1     D2         D3      D4:8
  4246.                                  ZeroSep );
  4247.                                  D5
  4248.  
  4249.        BOOL iniWriteFloatA( struct iniFile *, STRPTR, STRPTR, LONG *,
  4250.            ULONG, ULONG, ULONG, ULONG, ULONG, UBYTE );
  4251.  
  4252.  
  4253. FUNCTION
  4254.        Writes one or more quick float value(s) from an array into the given
  4255.        context item, belonging to the specified context.
  4256.  
  4257.  
  4258. INPUTS
  4259.        iniFile - INI structure where to assign write to
  4260.        ContextName - The name of the context to be affected
  4261.            v32+: the context will be created if it's not existant
  4262.        ItemName - The name of the context item where to write array to
  4263.            v32+: the context item will be created if it's not existant
  4264.        Array - The array where to write the quick float values to
  4265.        Entries - Number of array entries. If the array in the INI file is
  4266.             bigger, the remaining entries will be ignored.
  4267.        Flags - Search flags. They're currently defined as:
  4268.            INIF_ContextCase - Set this flag if the search of the context
  4269.                name should be case sensitive.
  4270.            INIF_ContextItemCase - Set this flag if the search of the context
  4271.                item name should be case sensitive.
  4272.        FltFormat - Format of the floating point value. Can be any of:
  4273.            INI_FLOAT_FORMAT_DEC - Use decimal with point separator
  4274.            INI_FLOAT_UNSIGNED - Add this to indicate unsigned quick float
  4275.        IntLen - Forced length of integer part or NULL for no force.
  4276.        FracLen - Forced length of fractional part or NULL for no force.
  4277.        ZeroSep - Zero character for IntLen leading zeroes. Usually " " or "0"
  4278.  
  4279.  
  4280. RESULT
  4281.        success - TRUE if accessing was successful else NULL.
  4282.  
  4283.  
  4284. EXAMPLE
  4285.        struct iniFile *ini;
  4286.        LONG MyFloat[4] = {-0x10000, -0x8000, 0, 0x8000};
  4287.  
  4288.        /* Let's open an INI file */
  4289.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  4290.  
  4291.        iniWriteFloatA ( ini, "MyContext", "MyItem", MyFloat,
  4292.                         (sizeof (MyFloat) / sizeof (LONG)),
  4293.                         INI_FLOAT_FORMAT_DEC, 3L, 4L, '0' );
  4294.  
  4295.        /* Let's say, ENVARC:MyPrefs.INI contains:
  4296.           [MyContext]
  4297.           MyItem = 13.5, 17.25, 1.116, 3.1416
  4298.  
  4299.           then it will become:
  4300.           [MyContext]
  4301.           MyItem = -001.0000, -000.5000, 000.0000, 000.5000
  4302.  
  4303.           If the context or the context item do not exist, they will be
  4304.           created in order to be written.
  4305.        */
  4306.  
  4307.  
  4308. NOTES
  4309.        This function calls iniPutFloatA() which is currently relatively slow.
  4310.        Especially with arrays with more than 16 entries.
  4311.  
  4312.  
  4313. BUGS
  4314.  
  4315.  
  4316. SEE ALSO
  4317.        iniWriteLongA(), iniWriteStrA(), iniWriteFloat(), iniReadFloatA(),
  4318.        iniPutFloatA(), iniGetFloatA(), <libraries/ini_lib.h>
  4319.  
  4320.  
  4321. ini.library/iniWriteLong
  4322.  
  4323. NAME
  4324.        iniWriteLong -- Writes a long integer value into the context item line
  4325.  
  4326.  
  4327. SYNOPSIS
  4328.        success = iniWriteLong( iniFile, ContextName, ItemName, Value,
  4329.        D0                      A0       A1           A2        D0
  4330.                                Flags, Format, Len, ZeroSep );
  4331.                                D1     D2      D3   D4:8
  4332.  
  4333.        BOOL iniWriteLong( struct iniFile *, STRPTR, STRPTR, LONG, ULONG,
  4334.            ULONG, UBYTE );
  4335.  
  4336.  
  4337. FUNCTION
  4338.        Writes a long integer value into the specified context item line,
  4339.        belonging to the given context.
  4340.  
  4341.  
  4342. INPUTS
  4343.        iniFile - INI structure of the INI file which should be affected
  4344.        ContextName - Name of the context where the value should be stored
  4345.            v32+: the context will be created if it's not existant
  4346.        ItemName - Name of the context item where to store value to
  4347.            v32+: the context item will be created if it's not existant
  4348.        Value - Value to be written
  4349.        Flags - Search flags. They're currently defined as:
  4350.            INIF_ContextCase - Set this flag if the search of the context
  4351.                name should be case sensitive.
  4352.            INIF_ContextItemCase - Set this flag if the search of the context
  4353.                item name should be case sensitive.
  4354.        Format - Format of the outputted string. Can be any of:
  4355.            INI_FORMAT_DEC - Use decimal with no precedor
  4356.            INI_FORMAT_DEC_CHAR - Use decimal with # precedor
  4357.            INI_FORMAT_HEX - Use hexadecimal with $ precedor
  4358.            INI_FORMAT_HEX_0X - Use hexadecimal with 0x precedor
  4359.            INI_FORMAT_BIN - Use binary with % precedor
  4360.            INI_FORMAT_OCT - Use octal with & precedor
  4361.            INI_FORMAT_YESNO - Use No for zero, Yes for all others
  4362.            INI_FORMAT_YN - Use N for zero, Y for all others
  4363.            INI_FORMAT_TRUEFALSE - Use False for zero, True for all others
  4364.            INI_FORMAT_ONOFF - Use Off for zero, On for all others
  4365.            INI_UNSIGNED - Add this to indicate unsigned integer
  4366.        Len - Forced length of outputted string or NULL for no force.
  4367.        ZeroSep - Zero character for IntLen leading zeroes. Usually " " or "0"
  4368.  
  4369.  
  4370. RESULT
  4371.        success - TRUE if value could successfully be written or FALSE
  4372.  
  4373.  
  4374. EXAMPLE
  4375.        struct iniFile *ini;
  4376.  
  4377.        /* Let's open an INI file */
  4378.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  4379.  
  4380.        iniWriteLong ( ini, "MyContext", "MyItem", 13750,
  4381.                       INI_FORMAT_HEX_0X, 8L, ' ' );
  4382.  
  4383.        /* After this, ENVARC:MyPrefs.INI will contain:
  4384.           [MyContext]
  4385.           MyItem = 0x000035B6
  4386.  
  4387.           If the context or the context item do not exist, they will be
  4388.           created in order to be written.
  4389.        */
  4390.  
  4391.  
  4392. NOTES
  4393.        This function calls iniPutLong().
  4394.  
  4395.  
  4396. BUGS
  4397.  
  4398.  
  4399. SEE ALSO
  4400.        iniWriteFloat(), iniWriteStr(), iniWriteLongA(), iniReadLong(),
  4401.        iniPutLong(), iniGetLong(), <libraries/ini_lib.h>
  4402.  
  4403.  
  4404. ini.library/iniWriteLongA
  4405.  
  4406. NAME
  4407.        iniWriteLongA -- writes an (U)LONG array into an context item array.
  4408.  
  4409.  
  4410. SYNOPSIS
  4411.        success = iniWriteLongA( iniFile, ContextName, ItemName, Array,
  4412.        D0                       A0       A1           A2        A3
  4413.                                 Entries, Flags, Format, Len, ZeroSep );
  4414.                                 D0       D1     D2      D3   D4:8
  4415.  
  4416.        BOOL iniWriteLongA( struct iniFile *, STRPTR, STRPTR, LONG *,
  4417.            ULONG, ULONG, ULONG, ULONG, UBYTE );
  4418.  
  4419.  
  4420. FUNCTION
  4421.        Writes the values of the given (U)LONG table to the specified context
  4422.        item in the given context.
  4423.  
  4424.  
  4425. INPUTS
  4426.        iniFile - INI structure of the INI file which should be affected
  4427.        ContextName - The context name (C-String) in which context to store
  4428.            v32+: the context will be created if it's not existant
  4429.        ItemName - The context item name (C-String) in which the context item
  4430.            lies to write to.
  4431.            v32+: the context item will be created if it's not existant
  4432.        Array - An (U)LONG array where to take the values from
  4433.        Entries - Number of entries to write
  4434.        Flags - Search flags. They're currently defined as:
  4435.            INIF_ContextCase - Set this flag if the search of the context
  4436.                name should be case sensitive.
  4437.            INIF_ContextItemCase - Set this flag if the search of the context
  4438.                item name should be case sensitive.
  4439.        Format - Format of array entries to write out:
  4440.            INI_FORMAT_DEC - Use decimal with no precedor
  4441.            INI_FORMAT_DEC_CHAR - Use decimal with # precedor
  4442.            INI_FORMAT_HEX - Use hexadecimal with $ precedor
  4443.            INI_FORMAT_HEX_0X - Use hexadecimal with 0x precedor
  4444.            INI_FORMAT_BIN - Use binary with % precedor
  4445.            INI_FORMAT_OCT - Use octal with & precedor
  4446.            INI_FORMAT_YESNO - Use No for zero, Yes for all others
  4447.            INI_FORMAT_YN - Use N for zero, Y for all others
  4448.            INI_FORMAT_TRUEFALSE - Use False for zero, True for all others
  4449.            INI_FORMAT_ONOFF - Use Off for zero, On for all others
  4450.            INI_UNSIGNED - Add this to indicate unsigned integer
  4451.        Len - Forced length of outputted string or NULL for no force.
  4452.        ZeroSep - Zero character for IntLen leading zeroes. Usually " " or "0"
  4453.  
  4454.  
  4455. RESULT
  4456.        success - TRUE if line could be written else FALSE
  4457.  
  4458.  
  4459. EXAMPLE
  4460.        struct iniFile *ini;
  4461.        LONG MyArray[4] = {-200000, -100000, 0, 100000};
  4462.  
  4463.        /* Let's open an INI file */
  4464.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  4465.  
  4466.        iniWriteLongA ( ini, "MyContext", "MyItem", MyArray,
  4467.                        (sizeof (MyArray) / sizeof (LONG)),
  4468.                        INI_FORMAT_DEC, 0L, '0' );
  4469.  
  4470.        /* Let's say, ENVARC:MyPrefs.INI contains:
  4471.           [MyContext]
  4472.           MyItem = 12345678, 76543210, 50000, -12345678
  4473.  
  4474.           then it will become:
  4475.           [MyContext]
  4476.           MyItem = -200000, -100000, 0, 100000
  4477.  
  4478.           If the context or the context item do not exist, they will be
  4479.           created in order to be written.
  4480.        */
  4481.  
  4482.  
  4483. NOTES
  4484.        This function calls iniPutLongA() which is currently relatively slow.
  4485.        Especially with arrays with more than 16 entries.
  4486.  
  4487.  
  4488. BUGS
  4489.  
  4490.  
  4491. SEE ALSO
  4492.        iniWriteByteA(), iniWriteWordA(), iniPutLongA(), iniReadLongA(),
  4493.        <libraries/ini_lib.h>
  4494.  
  4495.  
  4496. ini.library/iniWriteStr
  4497.  
  4498. NAME
  4499.        iniWriteStr -- Writes a string into a context item line
  4500.  
  4501.  
  4502. SYNOPSIS
  4503.        success = iniWriteStr( iniFile, ContextName, ItemName, String,
  4504.        D0                     A0       A1           A2        A3
  4505.                               Flags );
  4506.                               D0
  4507.                               
  4508.  
  4509.        BOOL iniWriteStr( struct iniFile *, STRPTR, STRPTR, STRPTR, ULONG );
  4510.  
  4511.  
  4512. FUNCTION
  4513.        Writes a string into the given context item belonging to the
  4514.        specified context.
  4515.  
  4516.  
  4517. INPUTS
  4518.        iniFile - INI structure of the INI file to be written
  4519.        ContextName - Name of the context where the item lies
  4520.            v32+: the context will be created if it's not existant
  4521.        ItemName - Name of the context item where string should be put
  4522.            v32+: the context item will be created if it's not existant
  4523.        String - String to be written
  4524.        Flags - Search flags. They're currently defined as:
  4525.            INIF_ContextCase - Set this flag if the search of the context
  4526.                name should be case sensitive.
  4527.            INIF_ContextItemCase - Set this flag if the search of the context
  4528.                item name should be case sensitive.
  4529.  
  4530.  
  4531. RESULT
  4532.        success - TRUE if writing was successful else FALSE
  4533.  
  4534.  
  4535. EXAMPLE
  4536.        struct iniFile *ini;
  4537.  
  4538.        /* Let's open an INI file */
  4539.        ini = iniOpenFile ( "ENVARC:MyMessages.INI", MODE_OLDFILE );
  4540.  
  4541.        iniWriteStr ( ini, "Messages", "Basty",
  4542.                      "I love Zuzana Burkertová !" );
  4543.  
  4544.        /* After this, ENVARC:MyMessages.INI will contain:
  4545.           [Messages]
  4546.           Basty = I love Zuzana Burkertová !
  4547.  
  4548.           If the context or the context item do not exist, they will be
  4549.           created in order to be written.
  4550.        */
  4551.  
  4552.  
  4553. NOTES
  4554.        This function calls iniPutStr().
  4555.  
  4556.  
  4557. BUGS
  4558.  
  4559.  
  4560. SEE ALSO
  4561.        iniWriteLongA(), iniWriteFloatA(), iniWriteStr(), iniReadStr(),
  4562.        iniPutStrA(), iniGetStrA(), <libraries/ini_lib.h>
  4563.  
  4564.  
  4565. ini.library/iniWriteStrA
  4566.  
  4567. NAME
  4568.        iniWriteStrA -- Writes an array of string(s) into the context item
  4569.            line(s)
  4570.  
  4571.  
  4572. SYNOPSIS
  4573.        success = iniWriteStrA( iniFile, ContextName, ItemName, Array,
  4574.        D0                      A0       A1           A2        A3
  4575.                                Entries, Flags );
  4576.                                D0       D1
  4577.  
  4578.        BOOL iniWriteStrA( struct iniFile *, STRPTR, STRPTR, STRPTR *,
  4579.            ULONG, ULONG );
  4580.  
  4581.  
  4582. FUNCTION
  4583.        Writes one or more strings into the given context item line,
  4584.        belonging to the specified context from an given array.
  4585.  
  4586.  
  4587. INPUTS
  4588.        iniFile - INI file structure 
  4589.        ContextName - Name of the context where context item lies
  4590.            v32+: the context will be created if it's not existant
  4591.        ItemName - Name of the context item to be accessed
  4592.            v32+: the context item will be created if it's not existant
  4593.        Array - The array where to take the pointers of the strings from
  4594.        Entries - Number of array entries. If the array in the INI file is
  4595.             bigger, the remaining entries will be ignored.
  4596.        Flags - Search flags. They're currently defined as:
  4597.            INIF_ContextCase - Set this flag if the search of the context
  4598.                name should be case sensitive.
  4599.            INIF_ContextItemCase - Set this flag if the search of the context
  4600.                item name should be case sensitive.
  4601.  
  4602.  
  4603. RESULT
  4604.        success - TRUE if accessing was successful else NULL.
  4605.  
  4606.  
  4607. EXAMPLE
  4608.        struct iniFile *ini;
  4609.        STRPTR MyStr[4] = {"String 1", "String 2", "String 3", "String 4"};
  4610.  
  4611.        /* Let's open an INI file */
  4612.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  4613.  
  4614.        iniWriteStrA ( ini, "MyContext", "MyItem" MyStr,
  4615.                       (sizeof (MyStr) / sizeof (STRPTR)) );
  4616.  
  4617.        /* Let's say, ENVARC:MyPrefs.INI contains:
  4618.           [MyContext]
  4619.           MyItem = Hello 1, Hello 2, Hello 3, Hello 4
  4620.  
  4621.           then it will become:
  4622.           [MyContext]
  4623.           MyItem = String 1, String 2, String 3, String 4
  4624.  
  4625.           If the context or the context item do not exist, they will be
  4626.           created in order to be written.
  4627.        */
  4628.  
  4629.  
  4630. NOTES
  4631.        This function calls iniPutStrA().
  4632.  
  4633.  
  4634. BUGS
  4635.  
  4636.  
  4637. SEE ALSO
  4638.        iniWriteLongA(), iniWriteFloatA(), iniWriteStr(), iniReadStrA(),
  4639.        iniPutStrA(), iniGetStrA(), <libraries/ini_lib.h>
  4640.  
  4641.  
  4642. ini.library/iniWriteWordA
  4643.  
  4644. NAME
  4645.        iniWriteWordA -- writes an (U)WORD array into an context item array.
  4646.  
  4647.  
  4648. SYNOPSIS
  4649.        success = iniWriteWordA( iniFile, ContextName, ItemName, Array,
  4650.        D0                       A0       A1           A2        A3
  4651.                                 Entries, Flags, Format, Len, ZeroSep );
  4652.                                 D0       D1     D2      D3   D4:8
  4653.  
  4654.        BOOL iniWriteWordA( struct iniFile *, STRPTR, STRPTR, WORD *,
  4655.            ULONG, ULONG, ULONG, ULONG, UBYTE );
  4656.  
  4657.  
  4658. FUNCTION
  4659.        Writes the values of the given (U)WORD table to the specified context
  4660.        item in the given context.
  4661.  
  4662.  
  4663. INPUTS
  4664.        iniFile - INI structure of the INI file which should be affected
  4665.        ContextName - The context name (C-String) in which context to store
  4666.            v32+: the context will be created if it's not existant
  4667.        ItemName - The context item name (C-String) in which the context item
  4668.            lies to write to.
  4669.            v32+: the context item will be created if it's not existant
  4670.        Array - An (U)WORD array where to take the values from
  4671.        Entries - Number of entries to write
  4672.        Flags - Search flags. They're currently defined as:
  4673.            INIF_ContextCase - Set this flag if the search of the context
  4674.                name should be case sensitive.
  4675.            INIF_ContextItemCase - Set this flag if the search of the context
  4676.                item name should be case sensitive.
  4677.        Format - Format of array entries to write out:
  4678.            INI_FORMAT_DEC - Use decimal with no precedor
  4679.            INI_FORMAT_DEC_CHAR - Use decimal with # precedor
  4680.            INI_FORMAT_HEX - Use hexadecimal with $ precedor
  4681.            INI_FORMAT_HEX_0X - Use hexadecimal with 0x precedor
  4682.            INI_FORMAT_BIN - Use binary with % precedor
  4683.            INI_FORMAT_OCT - Use octal with & precedor
  4684.            INI_FORMAT_YESNO - Use No for zero, Yes for all others
  4685.            INI_FORMAT_YN - Use N for zero, Y for all others
  4686.            INI_FORMAT_TRUEFALSE - Use False for zero, True for all others
  4687.            INI_FORMAT_ONOFF - Use Off for zero, On for all others
  4688.            INI_UNSIGNED - Add this to indicate unsigned integer
  4689.        Len - Forced length of outputted string or NULL for no force.
  4690.        ZeroSep - Zero character for IntLen leading zeroes. Usually " " or "0"
  4691.  
  4692.  
  4693. RESULT
  4694.        success - TRUE if line could be written else FALSE
  4695.  
  4696.  
  4697. EXAMPLE
  4698.        struct iniFile *ini;
  4699.        WORD MyArray[4] = {-2000, -1000, 0, 1000};
  4700.  
  4701.        /* Let's open an INI file */
  4702.        ini = iniOpenFile ( "ENVARC:MyPrefs.INI", MODE_OLDFILE );
  4703.  
  4704.        iniWriteWordA ( ini, "MyContext", "MyItem", MyArray,
  4705.                        (sizeof (MyArray) / sizeof (WORD)),
  4706.                        INI_FORMAT_DEC_CHAR, 0L, '0' );
  4707.  
  4708.        /* Let's say, ENVARC:MyPrefs.INI contains:
  4709.           [MyContext]
  4710.           MyItem = 1000, 2000, 3000, -10000
  4711.  
  4712.           then it will become:
  4713.           [MyContext]
  4714.           MyItem = -#2000, -#1000, #0, #1000
  4715.  
  4716.           If the context or the context item do not exist, they will be
  4717.           created in order to be written.
  4718.        */
  4719.  
  4720.  
  4721. NOTES
  4722.        This function calls iniPutWordA() which is currently relatively slow.
  4723.        Especially with arrays with more than 16 entries.
  4724.  
  4725.  
  4726. BUGS
  4727.  
  4728.  
  4729. SEE ALSO
  4730.        iniWriteByteA(), iniWriteLongA(), iniPutWordA(), iniReadWordA(),
  4731.        <libraries/ini_lib.h>
  4732.  
  4733.  
  4734.