diff options
Diffstat (limited to 'source/compiler/dtfield.c')
-rw-r--r-- | source/compiler/dtfield.c | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/source/compiler/dtfield.c b/source/compiler/dtfield.c index 1f7167618dc4..18d44110d507 100644 --- a/source/compiler/dtfield.c +++ b/source/compiler/dtfield.c @@ -576,6 +576,14 @@ DtCompileBuffer ( StringValue = DtNormalizeBuffer (StringValue, &Count); Substring = StringValue; + if (Count != ByteLength) + { + sprintf(AslGbl_MsgBuffer, + "Found %u values, must match expected count: %u", + Count, ByteLength); + DtError (ASL_ERROR, ASL_MSG_BUFFER_LIST, Field, AslGbl_MsgBuffer); + goto Exit; + } /* Each element of StringValue is now three chars (2 hex + 1 space) */ @@ -721,3 +729,122 @@ DtCompileFlag ( *Buffer |= (UINT8) (Value << BitPosition); } + + +/****************************************************************************** + * + * FUNCTION: DtCreateField + * + * PARAMETERS: Name + * Value + * Line + * Offset + * Column + * NameColumn + * + * RETURN: None + * + * DESCRIPTION: Create a field + * + *****************************************************************************/ + +void +DtCreateField ( + DT_TABLE_UNIT *FieldKey, + DT_TABLE_UNIT *FieldValue, + UINT32 Offset) +{ + DT_FIELD *Field = UtFieldCacheCalloc (); + + + Field->StringLength = 0; + if (FieldKey->Value) + { + Field->Name = + strcpy (UtLocalCacheCalloc (strlen (FieldKey->Value) + 1), FieldKey->Value); + } + + if (FieldValue->Value) + { + Field->StringLength = strlen (FieldValue->Value); + Field->Value = + strcpy (UtLocalCacheCalloc (Field->StringLength + 1), FieldValue->Value); + } + + Field->Line = FieldValue->Line; + Field->ByteOffset = Offset; + Field->NameColumn = FieldKey->Column; + Field->Column = FieldValue->Column; + DtLinkField (Field); + + DtDumpFieldList (AslGbl_FieldList); +} + + +/****************************************************************************** + * + * FUNCTION: DtCreateTableUnit + * + * PARAMETERS: Data + * Line + * Column + * + * RETURN: a table unit + * + * DESCRIPTION: Create a table unit + * + *****************************************************************************/ + +DT_TABLE_UNIT * +DtCreateTableUnit ( + char *Data, + UINT32 Line, + UINT32 Column) +{ + DT_TABLE_UNIT *Unit = (DT_TABLE_UNIT *) UtFieldCacheCalloc (); + + + Unit->Value = Data; + Unit->Line = Line; + Unit->Column = Column; + return (Unit); +} + + +/****************************************************************************** + * + * FUNCTION: DtLinkField + * + * PARAMETERS: Field - New field object to link + * + * RETURN: None + * + * DESCRIPTION: Link one field name and value to the list + * + *****************************************************************************/ + +void +DtLinkField ( + DT_FIELD *Field) +{ + DT_FIELD *Prev; + DT_FIELD *Next; + + + Prev = Next = AslGbl_FieldList; + + while (Next) + { + Prev = Next; + Next = Next->Next; + } + + if (Prev) + { + Prev->Next = Field; + } + else + { + AslGbl_FieldList = Field; + } +} |