Pattern File Parsing [was: 1st Real Thread]
chunky at icculus.org
Tue Jun 8 20:31:54 EDT 2004
On Tue, Jun 08, 2004 at 11:51:44AM -0400, Chunky Kibbles wrote:
> Eh. I'll put it up later today, if I get the chance. It's mostly the
> same as the parsing in patt.cpp [ie, healthy use of sscanf], but without
> stupid C++isms, and generally cleaner and better written.
I've just done the first cvs commit on this.
Simply, go into src/jmlib, and type "make p"
The code is actually C, but pulls in a C++ header for types. I think
I'll fix this soon, but in the meantime, it requries C++ :-/
I've not yet decided how I'm going to use this, but obviously it can
replace huge swathes of code in patt.cpp in jmdlx, and aajm can now
probably take advantage of it.
struct groups_t g;
struct styles_t s;
FILE *f = fopen("patterns.jm","r");
ParsePatterns(f, &g, &s);
This can be used for whatever you want, including [possibly] a new
file that contains all styles you want to make available through a
styles menu [eg normal, windmill, mills].
The FreeGroups and FreeStyles functions are currently rather rudely
non-existant. I'll get round to it :-)
More information about the Jugglemaster