Csaboka wrote:I agree with Michael. Decrypting something like \2+ isn't much better than decrypting a hex byte.
Personally, I always need to use the wiki when I want to code something, because I can't remember the format of the actions.
I must code entirely too much NFO then. I need to check the wiki when writing action 0, 6, and 12s, when using most of the listed constructs, when checking bits in action 7 variable 85, and when looking for an action2 variable that contains the info I want.
I'd probably have to check for 5s, As, and Fs, but those are rare enough that it's not annoying.
Csaboka wrote:This, of course, may be too much work for too little benefit, but I think it would make more sense than making cryptic shortcuts for cryptic originals.
ObNit: Unless you're talking about the quoted escapes, they're cryptic long-cuts. The originals are all two characters long, and case insensitive, while the escape sequences run from three to five characters, and are case sensitive.
Personally, I would expect even the ugliest of those (with the possible exception of \U####; a hex string really isn't better than a single character) to be better than its byte(s), or at least no worse (\[bwd].*)
Csaboka wrote:If we want to make NFOs more readable, I think we should make them more like a high level language instead, making it more verbose, but more human-readable at the same time.
That's tantamount to writing a compiler, something I'd prefer to avoid, at least not without a more complete format.
At one point I had generated a very C-like action 2 format:
Code: Select all
CapacityCallback(){
switch_byte(var47&FF){
case 00:fail;//Passengers
case 01:return d132; //tourists
default:return (d112*d16)/(var47[1]&FF);
}
}
CallbackCheck(){
switch_byte(var0C){
case 19:CapacityCallback();
case 15:LiveryCallback();
default:GetGraphics();
}
}
And so on, but I haven't done anything similar for Action1, Standard2, or Action3, and writing a parser for that does not strike me as particularly easy.
(Parsing backslash-escapes, OTOH, is quite easy.)
In a different vein, it shouldn't be too hard (just tedious) to create a header file with a bunch of defines:
#define action0 00
...
#define random_self 80
#define byte_self 81
#define byte_related 82
#define random_related 83
...
#define action2_add 00
...
and then #include it in an NFO and run the C preprocessor before pointing NFORenum or grfcodec at it.
This doesn't solve the format problem, though; you still have to get all the right keywords in all the right orders.
I'd also like to avoid adding a C preprocessor to grfcodec, or settling on a format that requires a Makefile to encode.