Re: Config file Parser

From: Alex Fraser (me_at_privacy.net)
Date: 11/24/05

  • Next message: Maxim Yegorushkin: "Re: A question about signals"
    Date: Thu, 24 Nov 2005 10:35:48 -0000
    
    

    "Murali" <maha.murali@gmail.com> wrote in message
    news:1132681214.199257.319950@o13g2000cwo.googlegroups.com...
    > I need to store the contents of a menu system (main menu, arbitrary
    > deep submenus, and each entry has a few attributes) in a simple text
    > file. I also need a parser for this file.
    [snip]
    > * Parser must be in C
    > * The C routine will get a long string which has the contents of the
    > whole file (not expected to be more than 20 to 30K)
    > * Code should be romable, i.e. should not use C functions which
    > eventually translate to system calls, i.e. printf is not allowed but
    > strlen is fine.
    >
    > Is there a standard format for storing such information and parsing
    > them. The INI file format is natively not heirarchical, and I dont
    > think I know of any ROMable parsers for XML in C. In the worst case, I
    > will have to come up with my own format, but just wanted to check if
    > this problem has already been solved.

    XML might be appropriate but probably isn't practical. INI files could work
    if you link menus with IDs; for example, something like:

    [menu]
    title=title
    items=item1 item2 item3 item4
    ...

    [item1]
    descr=description
    submenu=menu2
    ...

    [item2]
    descr=another description
    attr1=value1
    attr2=value2
    ...

    [menu2]
    ...

    While this is easy to parse, the downside is that it is not so simple to
    maintain. But there is nothing stopping you from creating a program which
    generates the INI file from some other format, where that program is free
    from the restrictions of the embedded system.

    Alex


  • Next message: Maxim Yegorushkin: "Re: A question about signals"

    Relevant Pages

    • [OT] ini files
      ... Hi all, perhaps this is not the right newsgroup but, does anybody know ... a library that manages ini file (text, xml, the format you want but ...
      (comp.lang.cpp)
    • Re: QuickBasic 4.5 Colours
      ... In the editing mode, it was difficult to read watch point values, ... While QB only allows you to change 3 color settings, ... like 20 some stored in the INI file. ... have a different format. ...
      (comp.lang.basic.misc)
    • Re: [OT] ini files
      ... mirco wrote: ... > a library that manages ini file (text, xml, the format you want but ... Are the initialization files the same format under Windows ... C++ Faq: http://www.parashift.com/c++-faq-lite ...
      (comp.lang.cpp)
    • Re: The hard coded links in the VB6 apps to the Access databases
      ... Please send me an example of code in Ini file. ... The example code I posted will work just fine if you ONLY store the path ... the datapath.ini was not really in ".ini" format, ... if you do want code to actually read/write a .ini file...then see ...
      (microsoft.public.access.gettingstarted)
    • Re: registry entry or file
      ... Is there any specific format to follow in INI file. ... Should I copy it to system directory so that other users will ... >> prompted me to spout my opinion because they disagree with me). ...
      (microsoft.public.win32.programmer.ui)