manpagez: man pages & more
info flex
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

How do I execute code only during initialization (only before the first scan)?

You can specify an initial action by defining the macro YY_USER_INIT (though note that yyout may not be available at the time this macro is executed). Or you can add to the beginning of your rules section:

%%
    /* Must be indented! */
    static int did_init = 0;

    if ( ! did_init ){
do_my_init();
        did_init = 1;
    }

This document was generated on November 4, 2011 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.