I think sym2ijs might have been written by Martin as he helped port J to 
Linux.  However I have never used sym2ijs it seems overskill for my
purpose. mysqlconst.c was just handcrafted.  I imagine you may just
need no sym2ijs either.

offsets in gtk addons are also generated by a simple C program like the
following, but it was not uploaded to repository.

g_print ("\nsizeof GdkColor %d\n", sizeof (GdkColor));
g_print ("GdkColor,pixel %ld\n", G_STRUCT_OFFSET(GdkColor,pixel));
g_print ("GdkColor,red %ld\n", G_STRUCT_OFFSET(GdkColor,red));
g_print ("GdkColor,green %ld\n", G_STRUCT_OFFSET(GdkColor,green));
g_print ("GdkColor,blue %ld\n", G_STRUCT_OFFSET(GdkColor,blue));

Срд, 01 Июн 2011, Ric Tikkanz писал(а):
> Thanks Bill,
> I had a look in the base7 repository in the main/defs directory as
> well as your data/ddmysql/source/ directory.
> 
> So if I create a .sym file according to the docs in sym2ijs.ijs , I
> can run sym2ijs on it to create a .c file which I then compile on the
> platform of interest to generate a .ijs file which will contain
> definitions that I can use to find the size and offsets of the various
> fields in a structure.
> 
> Is sym2ijs.ijs an evolution of Martin's work that Ken linked to
> earlier in the thread?
> 
> Am I on the right track?
> Ric
> 
> On Wed, Jun 1, 2011 at 11:04 AM, bill lam <[email protected]> wrote:
> > Even you know the size for 32 and 64 byte size of each field, you still
> > cannot know the offset of each of them because of alignment (packing).  One
> > way is to let C compiler to figure out.
> >
> > Please refer to mysqlconst.c in data/ddmysql or netdefs.c in jsource.
> >
> > There should be an article on C structure compiler of J in early Vector
> > one or two decades ago. Please seach www.vector.org.uk if it is available.
> >
> > Срд, 01 Июн 2011, Ric Tikkanz писал(а):
> >> I need to interact with some binary files that are basically stored C
> >> structures.
> >> Before I attempt to reinvent the wheel, I was wondering if anybody has
> >> any tools/utilities they are willing to share for reading such files
> >> an converting them to J arrays?
> >> I have the declared type structure of the files - for example:
> >>
> >> struct INDIV  {
> >>     int id;
> >>     int sireid;
> >>     int damid;
> >>     unsigned short breed;
> >>     unsigned short yob;
> >>     short inbreed;
> >>     float brd[4];
> >> };
> >>
> >> Alternatively I'm also open to advice on how best to approach the task.
> >> Ric
> >> ----------------------------------------------------------------------
> >> For information about J forums see http://www.jsoftware.com/forums.htm
> >
> > --
> > regards,
> > ====================================================
> > GPG key 1024D/4434BAB3 2008-08-24
> > gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to