Analyser/Is_Tool [ Functions ]

SYNOPSIS

static char        *Is_Tool(
    char *cur_char,
    enum ItemLineKind *itemkind,
    int *tool_active )

FUNCTION

Checks for tool start and end markers

SOURCE

{
    char               *s = cur_char + 1;

    if ( *cur_char == '|' && *s )
    {
        // Check if tool starts or ends
        if ( !strncmp( "tool ", s, 5 ) )
        {
            if ( *tool_active )
            {
                *itemkind = ITEM_LINE_TOOL_END;
                *tool_active = 0;
            }
            else
            {
                *itemkind = ITEM_LINE_TOOL_START;
                *tool_active = 1;
            }

            return ( s + 5 );
        }
        // Check if DOT starts or ends
        if ( !strncmp( "dot ", s, 4 ) )
        {
            if ( *tool_active )
            {
                *itemkind = ITEM_LINE_DOT_END;
                *tool_active = 0;
            }
            else
            {
                *itemkind = ITEM_LINE_DOT_START;
                *tool_active = 1;
            }

            return ( s + 4 );
        }
        // Check for DOT file includes
        else if ( !strncmp( "dotfile ", s, 8 ) && !*tool_active )
        {
            *itemkind = ITEM_LINE_DOT_FILE;
            return ( s + 8 );
        }
        // Check for exec items
        else if ( !strncmp( "exec ", s, 5 ) && !*tool_active )
        {
            *itemkind = ITEM_LINE_EXEC;
            return ( s + 5 );
        }
    }

    return NULL;
}