On Tue, May 03, 2011 at 09:21:54AM -0700, Jeff Johnson wrote:
> If I have a perl script that creates the enum.h and a Javascript version
> (enum.js), I'm not sure how to handle this:
>   >   #if TAG_MAJOR_VERSION == 32
>   >       OBJ_UNKNOWN_I, // (use unknown) labeled as books in invent.cc
> {dlb}
>   >   #endif
> 
> With the enum macro business, this #if is easily handled.

cpp enum.h

> Also, if I send the strings instead of the numbers the Javascript side
> doesn't need anything from enum.h.  It will just use the strings directly
> (e.g.  if(item.base_type = 'OBJ_WEAPON')).  Only one file (jsclient.cc)
> needs to double include the .h file since everyone else just needs the
> standard enum.h.  All of the non-jsclient files do not need to change.

So even using the preprocessor is not required.

> I concede there is a readability issue, but even if I have a enum-data.txt
> file that I parse with a perl script, there is a minor readability issue and
> a minor maintainability issue (.txt and .pl files to create a single .h).

A separate text file is not required, it's trivial to parse enum syntax.

-- 
1KB             // Microsoft corollary to Hanlon's razor:
                //      Never attribute to stupidity what can be
                //      adequately explained by malice.

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Crawl-ref-discuss mailing list
Crawl-ref-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/crawl-ref-discuss

Reply via email to