@starseeker little surprised by the asc-g comments as that doesn't jive with my recollection.. it just directly reads/writes out structures to disk. It's an old serialization method (not platform-independent, hence v5).
I may be misinterpreting what I'm seeing in the code - it's not even clear to me that g2asc will actually write out a v4 properly... I don't know if that logic is tested by anything we've got running right now
Wait - v4 ASC files aren't platform independent?
g2asc writes out a v4, unless we introduced a bug
it's got two formats, from what I can see - an older asc format, and the "tcl script" v5 asc format
db/moss.asc is in the older format, from what I can tell
No "title" or "puts" commands, args aren't Tcl lists
an asc2g g2asc round trip produces a newer, Tcl script style asc
g2asc fails to export a downgraded v4 moss.g - just get the header and a title written out, that's it...
Actually, I'm wrong - looks like it was the downgrade that didn't produce geometry
hmm.
Well, presumably feeding a proper v4 .g to g2asc would produce a v4 asc file then...
yes, most of the old asc files are in v4-asc format, which is a simple DSL
v4-asc is platform independent, it's just a text file. it's v4 binary I was referring to.
how are you making a v4? dbupgrade has an intentionally hidden -r flag to downgrade to v4 for testing
yeah, tried that on moss.g - got back a file with no geometry, as far as I can tell - haven't glinted it yet
My first look suggested that the v4 asc output requires/assumes v4 .g input, which would make that code a headache to upgrade for libgcv - have to unwire those assumptions and generate v4 asc lines from the modern in-mem data structures we would get from a v5 .g file to do it cleanly...
that would be a relatively new bug if it's busted... I used it last year iirc
could be - I don't think we regress that feature at all and I've not used it in a long time
for gcv, could also do whatever n-steps needed, like export to .g, downgrade to v4, reopen as if it were the input, then export v4 asc ... all within the asc plugin
plugins don't need to be pretty if they work :)
heh - point. Since we "own" the format I was wanting to be reasonably nice, but I'm also not sure it's worth preserving v4 asc output at all...
the bit I want most is to read v4 asc without Tcl, so I can re-enable a lot of the regression tests with BRLCAD_ENABLE_TCL=OFF - the rest just comes along if I want to properly clean up asc2g/g2asc and move them into libgcv, rather than snarfing the minimal bits I need... the later increases code complexity rather than cleaning things up.
the former increases headaches
/me supposes we really ought to add a downgrade, upgrade, diff check to dbupgrade to make sure it stays working... can be an important tool under some circumstances.
that's why g2asc / asc2g have been mostly left alone. it's good to support them, but they're not likely worth the effort to modernize them.
Main problem is a lot of the red/ted type commands rely on that format... that has baked it into a lot of users' workflows
well, v5 may prove easier to deal with and v4 I only really need reading (and I'm a fair ways towards cleaning up the reading code already, I think...)
Can probably reject v4 conversion for non v4 dbip instances, actually, since g2asc doesn't have that ability
yeah, I know -- v4 is also baked into a number of 3rd party applications (EF for example, ugh)
Ouch.
could separate the v4 from v5 and leave it in a v4asc tool
I take it back .. EF was using v4 asc direct, but they switched to actually bundling and invoking asc2g
I'm going to see if I can cheat a bit - I like your idea about calling the downgrade, but as an interim step I might be able to recognize a v4 dbip, grab the filename from the dbip, and feed it to this logic
er, or maybe g2asc, and then parsing the asc? I forget. it was atrocious however it was, but they seem adamant that it's simpler than a librt linkage
O.o
or just lazy
and they weren't the only ones. I believe the other force folks have asc integrated into a number of low level tools that are in use too, folks that don't even know because the tools just work and have never changed/needed to change.
$DEITY help them if they hit a NURBS database
@Sean nevermind, I must have done something weird or run in a half-built state somehow - dbupgrade -r worked when I tried it after building again.
/me is reminded of Tim Daly's mantra... "There's no such thing as a simple job."
Need a better test file than moss... ick.
Well, progress - can generate .g files from a couple samples at any rate.
Last updated: Jan 09 2025 at 00:46 UTC