On Fri, Oct 31, 2014 at 11:43 AM, Christopher Sean Morrison <brl...@mac.com>
wrote:
>
>
> On Oct 30, 2014, at 2:35 AM, Gurwinder Singh Bains <gswithba...@gmail.com>
wrote:
>
> > On Sun, Oct 19, 2014 at 11:14 PM, Gurwinder Singh Bains
> > <gswithba...@gmail.com> wrote:
> >> BRL-CAD stores database into binary format. I am trying to store it in
> >> text format.
>Why? This is not needed or recommended.
Because I want to know how and why headers and footers are stored in binary.
>g2asc does set the title, units, objects, mater info, combs, and more,
writing out a binary .g file into our .asc format. I’m not sure >why you’d
want to do this, but it will write out all of the database information in
ascii format.
I have read in documentation of BRL-CAD BRL-CAD database "All objects share
certain common properties, which are stored in a standardized object
wrapper consisting of an Object Header and an Object Footer.". So when I
run g2asc, it converts but header and footer are not written in converted
.asc file.
>There are not flex and bison files for parsing our binary .g file format.
There doesn’t exist a BNF either, so creating a formalized
>parser that way would be quite complicated.
But e.g. In /brlcad/misc/tools/perplex/ there is a file named as parser.y
and in /brlcad/src/mged/points/ there is points_scan.l file.
>Academically interesting, but certainly not easy or highly beneficial.
Yes.
>You did narrow down on a few of the files related to reading/writing the
.g format, but 'w+b’ doesn’t exactly mean what you suggest it >means… The
‘b’ is only used on the Windows platform and does absolutely nothing on
most any other platform. All it does is cause >newlines to get
carriage-return characters inserted automatically. From your description,
you’re using the function wrong and it’s not >at all clear to me what
you’re trying to accomplish where you’d be concerned about writing ascii
data.
>What exactly are you trying to accomplish? Your comments suggest several
misunderstandings about how file operations work, and >more generally how
data is written and read to/from memory and disk.
Thanks :P.
We can write in file in text mode using fprintf. So I use g2asc file for
writing header in asc file. I include "db5.h" header file and write
"db5_crack_disk_header" function( same as in db5_io.c ) in which pointer
points to the header.
I got the output as
http://ctrlv.in/463147
Why headers are not written in asc, why headers are in binary? Or its only
for storing information of object? Is header used for telling how object is
stored and how much space does it occupy?
>If this is related to your g-pov work, the best relevant examples are
still the various other g-* converters in the src/conv directory with
>g-dot.c being particularly relevant as a simple high-level format. Just
don’t ignore all the other converters in there too. Lots of >examples that
have different characteristics.
Yes, there are other formats that helps me in g-pov and I am taking help
from these also, but its not related to our g-pov. As a user, there is a
question in mind that why headers are only in binary not in text? :)
Thanks :)
Gurwinder Singh Bains
http://gurwindersinghbains93.wordpress.com
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Developer mailing list
brlcad-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-devel