FreeBSD/sys/contrib/dev/acpica/compiler/asloperands.c
/*******************************************************************************
 *
 * FUNCTION:    OpnDoDefinitionBlock
 *
 * PARAMETERS:  Op        - The parent parse node
 *
 * RETURN:      None
 *
 * DESCRIPTION: Construct the AML operands for the DEFINITIONBLOCK ASL keyword
 *
 ******************************************************************************/
OpnDoDefinitionBlock
PARAMETERS:  Op        - The parent parse node

None

Construct the AML operands for the DEFINITIONBLOCK ASL keyword
OpnDoDefinitionBlock PARAMETERS : Op - The parent parse node None Construct the AML operands for the DEFINITIONBLOCK ASL keyword
static void
OpnDoDefinitionBlock (
    ACPI_PARSE_OBJECT       *Op)
{
    ACPI_PARSE_OBJECT       *Child;
    ACPI_SIZE               Length;
    UINT32                  i;
    char                    *Filename;
    Child = Op->Asl.Child;
    if (Child->Asl.Value.Buffer  &&
        *Child->Asl.Value.Buffer &&
        (Gbl_UseDefaultAmlFilename))
    {
        Filename = UtStringCacheCalloc (strlen (Gbl_DirectoryPath) +
            strlen ((char *) Child->Asl.Value.Buffer) + 1);
        strcpy (Filename, Gbl_DirectoryPath);
        strcat (Filename, (char *) Child->Asl.Value.Buffer);
        Gbl_OutputFilenamePrefix = Filename;
        UtConvertBackslashes (Gbl_OutputFilenamePrefix);
    }
    Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
    Child = Child->Asl.Next;
    Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
    if (Child->Asl.Value.String)
    {
        Gbl_TableSignature = Child->Asl.Value.String;
        if (strlen (Gbl_TableSignature) != ACPI_NAME_SIZE)
        {
            AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child,
                "Length is not exactly 4");
        }
        for (i = 0; i < ACPI_NAME_SIZE; i++)
        {
            if (!isalnum ((int) Gbl_TableSignature[i]))
            {
                AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child,
                    "Contains non-alphanumeric characters");
            }
        }
    }
    Child = Child->Asl.Next;
    Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
    Child = Child->Asl.Next;
    Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
    Child = Child->Asl.Next;
    Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
    if (Child->Asl.Value.String)
    {
        Length = strlen (Child->Asl.Value.String);
        Gbl_TableId = UtStringCacheCalloc (Length + 1);
        strcpy (Gbl_TableId, Child->Asl.Value.String);
        for (i = 0; i < Length; i++)
        {
            if (!isalnum ((int) Gbl_TableId[i]))
            {
                Gbl_TableId[i] = '_';
            }
        }
    }
    Child = Child->Asl.Next;
    Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
}
static void OpnDoDefinitionBlock ( ACPI_PARSE_OBJECT * Op ) { ACPI_PARSE_OBJECT * Child ; ACPI_SIZE Length ; UINT32 i ; char * Filename ; Child = Op -> Asl . Child ; if ( Child -> Asl . Value . Buffer && * Child -> Asl . Value . Buffer && ( Gbl_UseDefaultAmlFilename ) ) { Filename = UtStringCacheCalloc ( strlen ( Gbl_DirectoryPath ) + strlen ( ( char * ) Child -> Asl . Value . Buffer ) + 1 ) ; strcpy ( Filename , Gbl_DirectoryPath ) ; strcat ( Filename , ( char * ) Child -> Asl . Value . Buffer ) ; Gbl_OutputFilenamePrefix = Filename ; UtConvertBackslashes ( Gbl_OutputFilenamePrefix ) ; } Child -> Asl . ParseOpcode = PARSEOP_DEFAULT_ARG ; Child = Child -> Asl . Next ; Child -> Asl . ParseOpcode = PARSEOP_DEFAULT_ARG ; if ( Child -> Asl . Value . String ) { Gbl_TableSignature = Child -> Asl . Value . String ; if ( strlen ( Gbl_TableSignature ) != ACPI_NAME_SIZE ) { AslError ( ASL_ERROR , ASL_MSG_TABLE_SIGNATURE , Child , " " ) ; } for ( i = 0 ; i < ACPI_NAME_SIZE ; i ++ ) { if ( ! isalnum ( ( int ) Gbl_TableSignature [ i ] ) ) { AslError ( ASL_ERROR , ASL_MSG_TABLE_SIGNATURE , Child , " " ) ; } } } Child = Child -> Asl . Next ; Child -> Asl . ParseOpcode = PARSEOP_DEFAULT_ARG ; Child = Child -> Asl . Next ; Child -> Asl . ParseOpcode = PARSEOP_DEFAULT_ARG ; Child = Child -> Asl . Next ; Child -> Asl . ParseOpcode = PARSEOP_DEFAULT_ARG ; if ( Child -> Asl . Value . String ) { Length = strlen ( Child -> Asl . Value . String ) ; Gbl_TableId = UtStringCacheCalloc ( Length + 1 ) ; strcpy ( Gbl_TableId , Child -> Asl . Value . String ) ; for ( i = 0 ; i < Length ; i ++ ) { if ( ! isalnum ( ( int ) Gbl_TableId [ i ] ) ) { Gbl_TableId [ i ] = ' ' ; } } } Child = Child -> Asl . Next ; Child -> Asl . ParseOpcode = PARSEOP_DEFAULT_ARG ; }
FUNCTION:    OpnDoDefinitionBlock
 PARAMETERS:  Op        - The parent parse node
FUNCTION : OpnDoDefinitionBlock PARAMETERS : Op - The parent parse node
/*
     * These nodes get stuffed into the table header. They are special
     * cased when the table is written to the output file.
     *
     * Mark all of these nodes as non-usable so they won't get output
     * as AML opcodes!
     */ /* Get AML filename. Use it if non-null */ /*
         * We will use the AML filename that is embedded in the source file
         * for the output filename.
         */ /* Prepend the current directory path */ /* Signature */ /* Revision */ /*
     * We used the revision to set the integer width earlier
     */ /* OEMID */ /* OEM TableID */ /*
         * Convert anything non-alphanumeric to an underscore. This
         * allows us to use the TableID to generate unique C symbols.
         */ /* OEM Revision */