void ScriptHandler::SetName( const char * name) { FreeName(); AllocName(name); }
static sym_id AddField( char *name, uint length ) //================================================= // Add a symbol table entry to the symbol table. Return a pointer to the // new symbol table entry. { sym_id sym; sym = FMemAlloc( sizeof( field ) + AllocName( length ) ); sym->u.fd.name_len = length; memcpy( &sym->u.fd.name, name, length ); return( sym ); }
ScriptHandler::ScriptHandler( const unsigned long id, const char * name) { fId = id; AllocName(name); if (!sCoercions) { sCoercions = new Coercions; sCoercions->AddCoercionHandler(new StandardNumberCoercions); sCoercions->AddCoercionHandler(new StandardGraphicsCoercions); sCoercions->AddCoercionHandler(new StandardTextCoercions); } }
static sym_id LnkNewGlobal( sym_id local ) { //============================================ // Allocate a global symbol and link it into the global list. sym_id global; int len; len = sizeof( symbol ) + AllocName( local->ns.name_len ); global = FMemAlloc( len ); memcpy( global, local, len ); HashInsert( GHashTable, HashValue, &GList, global ); return( global ); }
static sym_id AddStruct( char *name, int length ) { //=================================================== // Add a symbol table entry to the symbol table. Return a pointer to the // new symbol table entry. sym_id sym; sym = FMemAlloc( sizeof( fstruct ) + AllocName( length ) ); sym->u.sd.dbh = 0; sym->u.sd.name_len = length; memcpy( &sym->u.sd.name, name, length ); return( sym ); }
sym_id STAdd( char *name, int length ) { //======================================= // Add a symbol table entry to the symbol table. Return a pointer to the // new symbol table entry. sym_id sym; sym = FMemAlloc( sizeof( symbol ) + AllocName( length ) ); sym->u.ns.u2.name_len = length; memcpy( &sym->u.ns.name, name, length ); sym->u.ns.flags = 0; sym->u.ns.u1.s.xflags = 0; if( !(Options & OPT_REFERENCE) ) { sym->u.ns.u1.s.xflags |= SY_FAKE_REFERENCE; } return( sym ); }
VOID __cdecl main ( IN int argc, IN char **argv ) { // // Initialize // InitParse (); ParseArgs (argc, argv); InitializeListHead (&VerifyRef); if (!Source) { HelpAndExit (NULL); } printf ("ACPI Souce Language Assembler Version 0.1\n"); printf ("Copyright (C) Microsoft Corp 1996. All rights reserved.\n"); fflush (stdout); // // Build top level scope & ASL data package for which image // can be built in // DataImage = AllocAl(); DataImage->Name = AllocName(); DataImage->Flags |= F_AMLPACKAGE | F_PVARIABLE; DataImage->Term = &ImageTerm; DataImage->Parent = DataImage; DataImage->DataType = TypeRoot; InitializeListHead(&DataImage->FixedList); InitializeListHead(&DataImage->u1.VariableList); DataImage->Name->NameSeg = (ULONG) '\\'; AlLoc = DataImage; // // Parse source // while (Source) { ParseSource (); CloseSource (); } if (Verbose > 1) { printf ("NameSpaceDump:\n"); DumpNameSpace (DataImage->Name, 0); //not valid anymore... //if (Verbose > 2) { // DumpImage(); // printf ("AMLSize %d\n", AMLSize); //} } // // Enable AML for data image, and calculate package sizes // DataImage->Flags |= F_AMLENCODE; WriteDefinitionBlocks (DataImage); // // Remove AML package size from image Al // DataImage->Flags &= ~F_AMLENCODE; DataImage->u.Data.Length = 0; // // ... // Terminate (); }
static dw_handle BIGetStructType( sym_id ste_ptr, dw_handle handle ) { //==================================================================== // get a struct type of a non named symbol struct field *fields; dw_handle ret; sym_id data = alloca( sizeof(symbol) + AllocName(MAX_SYMLEN) ); char *name; char buffer[MAX_SYMLEN+1]; long un = 0; if ( handle ) { ret = handle; } else if ( ste_ptr->u.ns.xt.record->dbh ) { return( ste_ptr->u.ns.xt.record->dbh ); } else { // consider: record /bar/ function x() // .... // we want to use the handle we used when the function // was defined if ( ste_ptr->u.ns.xt.record == SubProgId->u.ns.xt.record ) { ret = subProgTyHandle; } else { ret = DWStruct( cBIId, DW_ST_STRUCT ); } } ste_ptr->u.ns.xt.record->dbh = ret; DWDeclPos( cBIId, CurrFile->rec, 0 ); memset( buffer, 0, MAX_SYMLEN+1 ); DWBeginStruct( cBIId, ret, ste_ptr->u.ns.xt.record->size, strncpy( buffer, ste_ptr->u.ns.xt.record->name, ste_ptr->u.ns.xt.record->name_len ), 0, 0 ); fields = ste_ptr->u.ns.xt.record->fl.fields; while( fields ) { data->u.ns.u1.s.typ = fields->typ; data->u.ns.xt.record = fields->xt.record; name = NULL; if ( fields->typ == FT_UNION ) { data->u.ns.si.va.u.dim_ext = NULL; data->u.ns.u2.name_len = 0; data->u.ns.name[0] = 0; un++; name = data->u.ns.name; } else { data->u.ns.si.va.u.dim_ext = fields->dim_ext; data->u.ns.u2.name_len = fields->name_len; strncpy( data->u.ns.name, fields->name, fields->name_len ); data->u.ns.name[ fields->name_len ] = 0; if ( *(data->u.ns.name) ) { name = data->u.ns.name; } } if ( data->u.ns.si.va.u.dim_ext ) { DWAddField(cBIId, BIGetArrayType(data), justJunk, name, 0); } else { DWAddField( cBIId, BIGetType( data ), justJunk, name, 0 ); } fields = &fields->link->u.fd; } DWEndStruct( cBIId ); return( ret ); }