예제 #1
0
static void copyact( int pnum, a_sym *lhs, a_sym **rhs, unsigned base, unsigned n )
{
    char        *b;
    char        *p;
    char        *s;
    char        *type;
    unsigned    i;
    int         errs;
    int         total_errs;
    size_t      total_len;
    char        buff[ 80 ];

    if( ! lineflag ) {
        /* we don't need line numbers to correspond to the grammar */
        total_errs = 0;
        total_len = strlen( buf ) + 1;
        for( s = buf; *s != '\0'; ) {
            if( *s == '$' ) {
                s = checkAttrib( s, &type, buff, &errs, lhs, rhs, base, n );
                total_len += strlen( buff );
                if( type != NULL ) {
                    total_len += strlen( type ) + 1;
                }
                free( type );
                total_errs += errs;
            } else {
                ++s;
            }
        }
        if( total_errs == 0 ) {
            b = MALLOC( total_len, char );
            p = b;
            for( s = buf; *s != '\0'; ) {
                if( *s == '$' ) {
                    s = checkAttrib( s, &type, buff, &errs, lhs, rhs, base, n );
                    p = strpcpy( p, buff );
                    if( type != NULL ) {
                        *p++ = '.';
                        p = strpcpy( p, type );
                        free( type );
                    }
                } else {
                    *p++ = *s++;
                }
            }
            *p = '\0';
            insertUniqueAction( pnum, b, lhs );
        }
예제 #2
0
 GLuint Shader::attribLocation (const char* attribName)
 {
   GLint attr = checkAttrib (attribName);
   return attr;
 }