On Sat, Oct 3, 2009 at 4:00 PM, Eric McDonald <mcdon...@phy.cmich.edu> wrote:
> Hi,
>
>  I've noticed that the output files from templates, which use the
> 'extract' Autogen Scheme function, are set to writable. Looking at the
> 'loadExtractData' function in agen5/expExtract.c, I can see that this
> appears to be deliberate:
>
>      if (! HAVE_OPT( WRITABLE ))
>        SET_OPT_WRITABLE;
>
> I am having trouble understanding why this is desirable. I read the
> documentation for the 'extract' function, as well as the comments in its
> implementation, and nothing really stands out as a reason. Even if the
> output files are not going to be kept around long-term, as in the case
> of the example code mentioned in the documentation, they should still be
> able to get forcefully renamed or removed. Hence, it should be safe to
> leave them read-only by default.
>
>  Any insights?

The theory behind it is that if you are extracting something from the previous
incarnation of the same file, then your client wants to be able to edit the
text that was extracted.  Witness the file agen5/cgi-fsm.c:

        case CGI_TR_NAME_EQUAL:
            /* START == NAME_EQUAL == DO NOT CHANGE THIS COMMENT */
            strcpy( pzOut, "='" );
            outlen -= 2;
            pzOut += 2;
            /* END   == NAME_EQUAL == DO NOT CHANGE THIS COMMENT */
            break;

The code between the "START" and "END" is hand crafted.
The rest changes if my FSM state machine template changes.
This is in line with what is done by GUI code generators, for example.
If you use the option, ``--not-writable'', then loadExtractData will not
force the output to be writable.  (You "have" the option and it was set
to the disabled state.)

I will augment the doc for "extract".  Thanks!  Regards, Bruce

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Autogen-users mailing list
Autogen-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/autogen-users

Reply via email to