Hi !
does someone know what is gadget mode in cTAFileParser.cpp ? (cf gadget_mode / g_mode)
cTAFileParser and gadget mode ?
cTAFileParser and gadget mode ?
Damien Gerard
Ta3d & Yuni Developer
Ta3d & Yuni Developer
- zuzuf
- Administrateur - Site Admin
- Posts: 3281
- Joined: Mon Oct 30, 2006 8:49 pm
- Location: Toulouse, France
- Contact:
some TA's tdf files use keys named "gadget%d", in many files %d ranges from 0 (or 1 don't remember quite well) to N with all integers between 0 and N. But there are also some files which use nearly random numbers and since those numbers aren't important I wrote a gadget mode that rewrites all the keys with known numbers (from 0 to N like expected).
That way we can easily read the list of primary keys from a TDF file using the hash table structure where we store all the data. Note you can also get the original name of a key using : PullAsString("gadget%d"), it'll return the original name.
This is used by the GUI module to load *.gui/*.tdf files. I think I may have used it too elsewhere I don't remember where exactly ... just to make things easier
That way we can easily read the list of primary keys from a TDF file using the hash table structure where we store all the data. Note you can also get the original name of a key using : PullAsString("gadget%d"), it'll return the original name.
This is used by the GUI module to load *.gui/*.tdf files. I think I may have used it too elsewhere I don't remember where exactly ... just to make things easier
=>;-D Penguin Powered
To be sure...
...will give ...
right ?
Code: Select all
[pika2] // the first section
{
key = 42;
}
[gadget42] // another section
{
key = 11;
[ nested-section ]
{
foo = bar;
}
}
Code: Select all
gadget0 = pika2
gadget1 = gadget42
gadget0.key = 42
gadget1.key = 11
gadget1.nested-section.foo = bar
Damien Gerard
Ta3d & Yuni Developer
Ta3d & Yuni Developer
I have nearly finished a new implementation (with a parser more tolerant to errors and warnings for misplaced '}' and ignored text), which seems promising :
I will try it this evening within TA3D and see if it is a bit faster on my PC laptop (and if it works too ^^).
Code: Select all
./ta3d-bin-TA3D-TDFParser 13.10s user 0.51s system 95% cpu 14.303 total
./ta3d-bin-TA3D-UTILS-cTAFileParser 21.18s user 0.61s system 98% cpu 22.085 total
(Core2Duo 2.16GHz)
Code: Select all
for (int i = 0; i < 5000; ++i)
{
TA3D::UTILS::cTAFileParser p("gui/mdrn_config_display.tdf");
//TA3D::TDFParser p("gui/mdrn_config_display.tdf");
if (p.pullAsString("window.object8.name") != "waves")
LOG_ERROR("Does not match !");
}
Damien Gerard
Ta3d & Yuni Developer
Ta3d & Yuni Developer
Who is online
Users browsing this forum: No registered users and 38 guests