Re: Config file Parser
From: Alex Fraser (me_at_privacy.net)
Date: 11/24/05
- Previous message: Maxim Yegorushkin: "Re: String Pointer to Functions"
- In reply to: Murali: "Config file Parser"
- Next in thread: Brian C: "Re: Config file Parser"
- Reply: Brian C: "Re: Config file Parser"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: Maxim Yegorushkin: "Re: String Pointer to Functions"
- In reply to: Murali: "Config file Parser"
- Next in thread: Brian C: "Re: Config file Parser"
- Reply: Brian C: "Re: Config file Parser"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|