void insert(SYMBOL *in, HASHTABLE *table) { if (table) { #ifdef PARSER_ONLY if (table != defsyms && table != kwhash && table != labelSyms && table != ccHash) ccSetSymbol(in); #endif if (cparams.prm_extwarning) if (in->storage_class == sc_parameter || in->storage_class == sc_auto || in->storage_class == sc_register) { SYMBOL *sp; if ((sp = gsearch(in->name)) != NULL) preverror(ERR_VARIABLE_OBSCURES_VARIABLE_AT_HIGHER_SCOPE, in->name, sp->declfile, sp->declline); } #if defined (PARSER_ONLY) if (AddName(in, table) && table != ccHash) #else if (AddName(in, table)) #endif { #if defined(CPREPROCESSOR) || defined(PARSER_ONLY) pperrorstr(ERR_DUPLICATE_IDENTIFIER, in->name); #else preverrorsym(ERR_DUPLICATE_IDENTIFIER, in, in->declfile, in->declline); #endif } } else { diag("insert: cannot insert"); } }
void AnnotWriter::WriteFont(PDFFont* font) { if (!is_empty_ref(font->GetRef())) return; // already saved font->SetRef(mXRefTable.GetNewRef(xrefEntryUncompressed)); mWrittenFonts.push_back(font); Object dict; dict.initDict(mXRef); AddName(&dict, "Type", "Font"); AddName(&dict, "Subtype", "Type1"); AddName(&dict, "BaseFont", (char*)font->GetName()); AddName(&dict, "Encoding", "WinAnsiEncoding"); WriteObject(font->GetRef(), &dict); dict.free(); }
void id::AddName(festring& Name, int Case, int Amount) const { if(Amount == 1) AddName(Name, Case&~PLURAL); else { if((Case & ARTICLE_BIT) && (GetArticleMode() == FORCE_THE || (!GetArticleMode() && !(Case & INDEFINE_BIT)))) Name << "the "; Name << Amount << ' '; AddName(Name, Case&~ARTICLE_BIT|PLURAL); } }
bool netbios_name::Register() { m_managed = true; UCHAR ret = AddName (); LOG("Register NetBIOS name \"%s\" on lana %d num=%d : 0x%02x \"%s\"", GetANSIFullName(), m_lana, netbiosed.name_num, ret, GetNetbiosError( ret ) ); m_registered = (ret == NRC_GOODRET); m_duplicated = (ret == NRC_DUPNAME); if ( ret != NRC_GOODRET && ret != NRC_DUPNAME ) { WarningBox (NULL, (DWORD)MAKE_HRESULT (0, FACILITY_NETBIOS, ret), _T("%s: %s"), TranslateT ("Cannot register NetBIOS name"), (LPCTSTR)CA2T( GetANSIFullName() ) ); } if (!m_term) m_term = CreateEvent (NULL, TRUE, FALSE, NULL); else ResetEvent (m_term); if ( m_term && !m_listener ) m_listener = (HANDLE)mir_forkthread( ListenerThread, this ); if ( m_term && !m_dgreceiver && // NOTE: Под Win9x нельзя запускать ожидание датаграмм для имён-дубликатов // т.к. потом невозможно выбить управление из функции Netbios() даже если // разрегистрировать имя !m_duplicated ) { m_dgreceiver = (HANDLE)mir_forkthread( DatagramReceiverThread, this ); } return m_registered; }
festring id::GetName(int Case, int Amount) const { static festring Name; Name.Empty(); AddName(Name, Case, Amount); return Name; }
festring material::GetName(truth Articled, truth Adjective) const { static festring Name; Name.Empty(); AddName(Name, Articled, Adjective); return Name; }
// // Function: main // // Description: // Initialize the NetBIOS interface, allocate some resources, add // the server name to each LANA, post an asynch NCBLISTEN on each // LANA with the appropriate callback. Then wait for incoming // client connections at which time, spawn a worker thread to handle // it. The main thread simply waits while the server threads are // handling client requests. You wouldn't do this in a real app, // but this sample is for illustrative purposes only... // int main(int argc, char **argv) { LANA_ENUM lenum; int i, num=0; // Enumerate all LANAs and reset each one // if (LanaEnum(&lenum) != NRC_GOODRET) return 1; if (ResetAll(&lenum, 254, 254, FALSE) != NRC_GOODRET) return 1; // // Add the server name to each LANA and issue a listen on each // for(i=0; i < lenum.length ;i++) { printf("Registering name '%s' on lana %d\n", SERVER_NAME, num); AddName(lenum.lana[i], SERVER_NAME, &num); Listen(lenum.lana[i], SERVER_NAME); } while (1) { Sleep(5000); } }
int FName::NameManager::FindName (const char *text, bool noCreate) { if (!Inited) { InitBuckets (); } if (text == NULL) { return 0; } unsigned int hash = MakeKey (text); unsigned int bucket = hash % HASH_SIZE; int scanner = Buckets[bucket]; // See if the name already exists. while (scanner >= 0) { if (NameArray[scanner].Hash == hash && stricmp (NameArray[scanner].Text, text) == 0) { return scanner; } scanner = NameArray[scanner].NextHash; } // If we get here, then the name does not exist. if (noCreate) { return 0; } return AddName (text, hash, bucket); }
bool ppInclude::SrchPath(bool system) { const char *path; if (system) path = sysSrchPath.c_str(); else path = srchPath.c_str(); char buf[260]; do { path = RetrievePath(buf, path); AddName(buf); while (char *p = strchr(buf, '/')) { *p = CmdFiles::DIR_SEP[0]; } FILE *fil = fopen(buf, "rb"); if (fil) { fclose(fil); name = buf; return true; } } while (path); return false; }
void libcxx_init(void) { int i; intrinsicHash = CreateHashTable(32); for (i=0; i < sizeof(defaults)/sizeof(defaults[0]); i++) AddName((SYMBOL *)&defaults[i], intrinsicHash); }
bool MpContextSave::ContextAdd (name_t name, const bool *ref, unsigned cnt) { bool status; data_t *d; AddName(name,&d,status); d->type = t_bool; d->cnt = cnt; d->data = (const void*)(ref); return status; }
void AnnotWriter::DoStyledAnnot(StyledAnnot* s) { AddAnnotContents(s); // border style char* style = NULL; Object bs; bs.initDict(mXRef); AddName(&bs, "Type", "Border"); AddInteger(&bs, "W", (float)s->GetBorderStyle()->GetWidth()); // width switch (s->GetBorderStyle()->GetStyle()) { case BorderStyle::solid_style: style = "S"; case BorderStyle::dashed_style: style = "D"; case BorderStyle::beveled_style: style = "B"; case BorderStyle::inset_style: style = "I"; case BorderStyle::underline_style: style = "U"; } if (style != NULL) { AddName(&bs, "S", style); // border style } AddDict(&mAnnot, "BS", &bs); }
cLocalApplication::cLocalApplication(char *name, char *basePath, char *initialClass, ApplicationInfo::cTransportProtocol *tp) { SetBaseDir(basePath); SetInitialClass(initialClass); SetTransportProtocol(tp); //give local apps unique app ids, even if illegal ones SetAid(nextId--); SetOid(-1); SetControlCode(Present); SetApplicationType(LocalDVBJApplication); SetServiceBound(false); AddName("deu", name); //TODO: change "deu" to real VDR language }
void AnnotWriter::UpdateBePDFAcroForm() { if (mWrittenFonts.empty()) return; Object acroForm; Object oldDR; acroForm.initDict(mXRef); oldDR.initNull(); if (is_empty_ref(mBePDFAcroForm->GetRef())) { Ref fieldsRef = mXRefTable.GetNewRef(xrefEntryUncompressed); // create empty array for fields Object fields; fields.initArray(mXRef); WriteObject(fieldsRef, &fields); fields.free(); // create new BePDFAcroForm mBePDFAcroFormRef = mXRefTable.GetNewRef(xrefEntryUncompressed); AddName(&acroForm, "Type", "BePDFAcroForm"); AddRef(&acroForm, "Fields", fieldsRef); } else { // copy existing BePDFAcroForm except DR mBePDFAcroFormRef = mBePDFAcroForm->GetRef(); Object ref; Object oldForm; ref.initRef(mBePDFAcroFormRef.num, mBePDFAcroFormRef.gen); ref.fetch(mXRef, &oldForm); CopyDict(&oldForm, &acroForm, acroFormExcludeKeys); oldForm.dictLookup("DR", &oldDR); oldForm.free(); ref.free(); } // Add DR to BePDFAcroForm Object dr; dr.initDict(mXRef); if (oldDR.isDict()) { CopyDict(&oldDR, &dr, drExcludeKeys); oldDR.free(); } // Add font dict Object font; font.initDict(mXRef); // add old fonts AddFonts(&font, mBePDFAcroForm->GetFonts()); // add new fonts AddFonts(&font, &mWrittenFonts); AddDict(&dr, "Font", &font); AddDict(&acroForm, "DR", &dr); WriteObject(mBePDFAcroFormRef, &acroForm); acroForm.free(); }
void CreatSymbolTable(idrec *ptr) { unsigned int i; if(ptr!=NULL){ CreatSymbolTable(ptr->right); if(ptr->rectok==tk_apiproc){ for(unsigned int j=0;j<posts;j++){ //поиск использования процедуры if((postbuf+j)->num==(unsigned long)ptr->recnumber&&((postbuf+j)->type==CALL_32I||(postbuf+j)->type==CALL_32)){ goto nameext; } } } else if((externnum!=0&&ptr->rectok==tk_undefproc&&(ptr->flag&f_extern)!=0)|| ((ptr->rectok==tk_proc||ptr->rectok==tk_interruptproc)&&ptr->recsegm>=NOT_DYNAMIC)|| ((ptr->rectok>=tk_bits&&ptr->rectok<=tk_doublevar)||ptr->rectok==tk_structvar)){ nameext: if(numsymbol+1>=maxnumsymbol){ maxnumsymbol+=MAXNUMSYMBOL; isymbol=(IMAGE_SYMBOL *)REALLOC(isymbol,maxnumsymbol*sizeof(IMAGE_SYMBOL)); memset(isymbol+maxnumsymbol*sizeof(IMAGE_SYMBOL)-MAXSIZESYMBOL,0,MAXSIZESYMBOL); //очистить ее } if(ptr->rectok==tk_apiproc||ptr->rectok==tk_undefproc|| ptr->rectok==tk_proc||ptr->rectok==tk_interruptproc)(isymbol+numsymbol)->Type=32; i=strlen(ptr->recid); if(i>8){ (isymbol+numsymbol)->N.Name.Short=0; (isymbol+numsymbol)->N.Name.Long=sizelistName+4; AddName(ptr->recid,i); } else strncpy((isymbol+numsymbol)->N.sname,ptr->recid,i); if(ptr->rectok!=tk_apiproc&&ptr->rectok!=tk_undefproc&&(ptr->flag&f_extern)==0){ (isymbol+numsymbol)->Value=ptr->recnumber; if(ptr->rectok==tk_proc||ptr->rectok==tk_interruptproc)(isymbol+numsymbol)->SectionNumber=(short)(textnum+1); else (isymbol+numsymbol)->SectionNumber=(short)((ptr->recpost==0?textnum:bssnum)+1); } else{ (NameId+numextern)->num=ptr->recnumber; (NameId+numextern)->id=numsymbol; numextern++; if(numextern>=maxnumnameid){ maxnumnameid+=MAXNUMSYMBOL; NameId=(NAMEID *)REALLOC(NameId,maxnumnameid*sizeof(NAMEID)); } } (isymbol+numsymbol)->StorageClass=2; numsymbol++; } CreatSymbolTable(ptr->left); } }
GameObject::GameObject(bool collides) { Life = 1; Depth=0; AddName("GameObject"); Name = "GameObject"; Position=Point<float>(); Velocity=Point<float>(); Dimensions=Point<int>(); Sprite = NULL; Image = NULL; World=true; Collides = collides; _CS->Add(this); }
bool AnnotWriter::WriteAS(Ref& ref, Annotation* a) { if (is_empty_ref(ref)) return true; Object xobj; xobj.initDict(mXRef); // setup XObject dictionary AddName(&xobj, "Type", "XObject"); AddName(&xobj, "Subtype", "Form"); AddInteger(&xobj, "FormType", 1); PDFRectangle r = *a->GetRect(); r.x2 -= r.x1; r.y2 -= r.y1; r.x1 = r.y1 = 0; AddRect(&xobj, "BBox", &r); // setup resource dictionary Object resources, array, name; resources.initDict(mXRef); array.initArray(mXRef); name.initName("PDF"); array.arrayAdd(&name); resources.dictAdd(copyString("ProcSet"), &array); xobj.dictAdd(copyString("Resources"), &resources); // create appearance stream AnnotAppearance as; a->Visit(&as); // set length AddInteger(&xobj, "Length", as.GetLength()); ASSERT(as.GetLength() > 0); // write form XObject WriteObject(ref, &xobj, as.GetStream()); xobj.free(); ref = empty_ref; return true; }
static int ccWriteNameInTable( sqlite3_stmt **whndl, sqlite3_stmt **shndl, char *name, char *tabname, sqlite3_int64 *id, HASHTABLE *table) { static char *query = "INSERT INTO %s (name) VALUES (?)"; int rc; rc = ccSelectIdFromNameTable(shndl, name, tabname, id, table); if (rc != SQLITE_OK) { rc = SQLITE_OK; if (!*whndl) { char qbuf[256]; sprintf(qbuf, query, tabname); rc = sqlite3_prepare_v2(dbPointer, qbuf, strlen(qbuf)+1, whndl, NULL); } if (rc == SQLITE_OK) { int done = FALSE; sqlite3_reset(*whndl); sqlite3_bind_text(*whndl, 1, name, strlen(name), SQLITE_STATIC); while (!done) { switch(rc = sqlite3_step(*whndl)) { case SQLITE_BUSY: done = TRUE; break; case SQLITE_DONE: rc = SQLITE_OK; done = TRUE; break; default: done = TRUE; break; } } } if (rc == SQLITE_OK) { SYMID *v = (SYMID *)Alloc(sizeof(SYMID)); v->name = name; *id = sqlite3_last_insert_rowid(dbPointer); v->id = *id; AddName((SYMBOL *)v, table); } } return rc; }
GameObject::GameObject(std::string file, Point<float> xy, bool collides) { Image = _E.LoadImage(file); Image->SetSmooth(false); Sprite = new sf::Sprite(*Image); Dimensions=Point<int>(Image->GetWidth(),Image->GetHeight()); Position=xy; Center=Position+Pointf(Dimensions.x,Dimensions.y)/Pointf(2); Depth=0; Velocity=Point<float>(); AddName("GameObject"); this->Name = "GameObject"; this->Life = 1; this->DoNotDelete = false; World=true; Collides = collides; _CS->Add(this); }
bool AnnotWriter::UpdateAnnot(Annotation* annot) { if (annot->HasChanged()) { Ref ref = annot->GetRef(); ASSERT(!is_empty_ref(ref)); mASRef = empty_ref; mAnnot.initDict(mXRef); AddName(&mAnnot, "Type", "Annot"); annot->Visit(this); DoAnnotation(annot); WriteObject(ref, &mAnnot); mAnnot.free(); WriteAS(mASRef, annot); } if (annot->GetPopup() != NULL) { return UpdateAnnot(annot->GetPopup()); } return true; }
Particle::Particle(std::string img,Point<float> xy,Point<int> dim,int fps,Point<float> vel,sf::Color stint,sf::Color etint,float fric,float turn,float wiggle,bool loop,bool World):AniObject(img,xy,dim,fps,loop){ Particle::Part_Count++; AddName("Particle"); SetCollides(false); Etint=etint; Stint=stint; Mtint=sf::Color((etint.r+stint.r)/2,(etint.g+stint.g)/2,(etint.b+stint.b)/2,(etint.a+stint.a)/2); Loop=loop; Slife=Life; Decay=0; Fade=false; Friction=fric; Turn=turn; Wiggle=wiggle; Acceleration=0; Gravity=Pointf(); Velocity=vel; }
Particle::Particle(Particle::DNA dna):AniObject(dna.Img,dna.Position,dna.Dimensions,dna.FPS,dna.Loop){ Particle::Part_Count++; SetCollides(false); AddName("Particle"); Etint=dna.Etint; Stint=dna.Stint; Mtint=dna.Mtint; Loop=dna.Loop; Slife=dna.Slife; Life=Slife; Decay=dna.Decay; Fade=dna.Fade; Friction=dna.Friction; Turn=dna.Turn; Wiggle=dna.Wiggle; Acceleration=dna.Acceleration; Gravity=dna.Gravity; Velocity=dna.Velocity; }
// // Function: main // // Description: // Setup the NetBIOS interface, parse the arguments, and call the // adapter status command either locally or remotely depending on // the user supplied arguments. // int main(int argc, char **argv) { LANA_ENUM lenum; int i, num; ValidateArgs(argc, argv); // // Make sure both command line flags weren't set // if (bLocalName && bRemoteName) { printf("usage: astat [/l:LOCALNAME | /r:REMOTENAME]\n"); return 1; } // Enumerate all LANAs and reset each one // if (LanaEnum(&lenum) != NRC_GOODRET) return 1; if (ResetAll(&lenum, (UCHAR)MAX_SESSIONS, (UCHAR)MAX_NAMES, FALSE) != NRC_GOODRET) return 1; // // If we're called with a local name we need to add it to // the name table. // if (bRemoteName == FALSE) { for(i=0; i < lenum.length ;i++) { if (bLocalName) AddName(lenum.lana[i], szLocalName, &num); LanaStatus(lenum.lana[i], szLocalName); } } else { for(i=0; i < lenum.length ;i++) LanaStatus(lenum.lana[i], szRemoteName); } return 0; }
static int ccWriteMap( sqlite_int64 smpl_id, sqlite_int64 cplx_id, sqlite_int64 main_id) { char id[256]; static char *query = "INSERT INTO CPPNameMapping (simpleId, complexId, mainid) VALUES (?, ?, ?)"; int rc = SQLITE_OK; static sqlite3_stmt *handle, *handle1; if (!handle) rc = sqlite3_prepare_v2(dbPointer, query, strlen(query)+1, &handle, NULL); sprintf(id, "%d,%d", (int)smpl_id, (int)cplx_id); if (!LookupName(id, map)) { int done = FALSE; SYMID *v = (SYMID *)Alloc(sizeof(SYMID)); v->name = litlate(id); AddName((SYMBOL *)v, map); rc = SQLITE_DONE; sqlite3_reset(handle); sqlite3_bind_int64(handle, 1, smpl_id); sqlite3_bind_int64(handle, 2, cplx_id); sqlite3_bind_int64(handle, 3, main_id); while (!done) { switch(rc = sqlite3_step(handle)) { case SQLITE_BUSY: done = TRUE; break; case SQLITE_DONE: done = TRUE; rc = SQLITE_OK; break; default: done = TRUE; break; } } } return rc; }
void ccLoadIdsFromNameTable(char *tabname, HASHTABLE *table) { static char *query = "SELECT name, id FROM %s"; int rc = SQLITE_OK; char qbuf[256]; SYMID *v; sqlite3_stmt *handle; sprintf(qbuf, query, tabname); rc = sqlite3_prepare_v2(dbPointer, qbuf, strlen(qbuf)+1, &handle, NULL); if (rc == SQLITE_OK) { BOOLEAN done = FALSE; while (!done) { switch(rc = sqlite3_step(handle)) { case SQLITE_BUSY: done = TRUE; break; case SQLITE_DONE: done = TRUE; break; case SQLITE_ROW: v = (SYMID *)Alloc(sizeof(SYMID)); v->name = litlate((char *)sqlite3_column_text(handle, 0)); v->id = sqlite3_column_int64(handle, 1); AddName((SYMBOL *)v, table); rc = SQLITE_OK; break; default: done = TRUE; break; } } sqlite3_finalize(handle); } }
NonMapEntityListComponent::NonMapEntityListComponent() { AddName("NonMapEntityListComponent"); Init(); }
static int CompLink( void ) { //================================ int rc; const char *file; bool comp_err; PGROUP pg; int i; list *currobj; list *nextobj; if( Flags.quiet ) { Fputnl( "option quiet", Fp ); } fputs( DebugOptions[ DebugFlag ], Fp ); if( Flags.link_for_sys ) { fputs( "system ", Fp ); Fputnl( SystemName, Fp ); } else { #if defined( __QNX__ ) Fputnl( "system qnx", Fp ); #elif defined( __LINUX__ ) Fputnl( "system linux", Fp ); #elif _CPU == 386 #if defined( __OS2__ ) Fputnl( "system os2v2", Fp ); #elif defined( __NT__ ) Fputnl( "system nt", Fp ); #else Fputnl( "system dos4g", Fp ); #endif #elif _CPU == 8086 if( Flags.windows ) { Fputnl( "system windows", Fp ); } else if( Flags.link_for_dos ) { Fputnl( "system dos", Fp ); } else if( Flags.link_for_os2 ) { Fputnl( "system os2", Fp ); } else { #if defined( __OS2__ ) Fputnl( "system os2", Fp ); #else Fputnl( "system dos", Fp ); #endif } #elif _CPU == _AXP Fputnl( "system ntaxp", Fp ); #else #error Unknown System #endif } comp_err = false; ObjList = NULL; for( currobj = FileList; currobj != NULL; currobj = nextobj ) { strcpy( Word, currobj->filename ); MakeName( Word, ".for" ); // if no extension, assume ".for" file = DoWildCard( Word ); while( file != NULL ) { // while more filenames: strcpy( Word, file ); #ifndef __UNIX__ strlwr( Word ); #endif _splitpath2( Word, pg.buffer, &pg.drive, &pg.dir, &pg.fname, &pg.ext ); if( strcmp( pg.ext, OBJ_EXT ) != 0 ) { // if not object, compile rc = tool_exec( TYPE_FOR, Word, CmpOpts ); if( rc != 0 ) { comp_err = true; if( ( rc == -1 ) || ( rc == 255 ) ) { rc = 1; break; } } } _makepath( Word, NULL, NULL, pg.fname, NULL ); if( ExeName[0] == '\0' ) { fputs( "name '", Fp ); fputs( Word, Fp ); Fputnl( "'", Fp ); strcpy( ExeName, Word ); } _makepath( Word, NULL, NULL, pg.fname, OBJ_EXT ); AddName( Word, Fp ); // add obj filename file = DoWildCard( NULL ); // get next filename } DoWildCardClose(); nextobj = currobj->next; free( currobj->filename ); free( currobj ); } for( currobj = LibList; currobj != NULL; currobj = nextobj ) { fputs( "library ", Fp ); Fputnl( currobj->filename, Fp ); nextobj = currobj->next; free( currobj->filename ); free( currobj ); } fclose( Fp ); // close TempFile if( comp_err ) { rc = 1; } else { rc = 0; if( ( ObjList != NULL ) && !Flags.no_link ) { rc = tool_exec( TYPE_LINK, "@" TEMPFILE, NULL ); if( rc == 0 && Flags.do_cvpack ) { rc = tool_exec( TYPE_PACK, ExeName, NULL ); } if( rc != 0 ) { rc = 2; // return 2 to show Temp_File already closed } } } for( currobj = ObjList; currobj != NULL; currobj = nextobj ) { nextobj = currobj->next; free( currobj->filename ); free( currobj ); } for( i = 0; i < TYPE_MAX; ++i ) { if( tools[i].path != NULL ) { free( tools[i].path ); tools[i].path = NULL; } } return( rc ); }
/** Start this driver on Controller. @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. @param[in] ControllerHandle The handle of the controller to start. This handle must support a protocol interface that supplies an I/O abstraction to the driver. @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This parameter is ignored by device drivers, and is optional for bus drivers. @retval EFI_SUCCESS The device was started. @retval EFI_DEVICE_ERROR The device could not be started due to a device error. Currently not implemented. @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. @retval Others The driver failded to start the device. **/ EFI_STATUS EFIAPI FdcControllerDriverStart ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) { EFI_STATUS Status; FDC_BLK_IO_DEV *FdcDev; EFI_ISA_IO_PROTOCOL *IsaIo; UINTN Index; LIST_ENTRY *List; BOOLEAN Found; EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath; FdcDev = NULL; IsaIo = NULL; // // Open the device path protocol // Status = gBS->OpenProtocol ( Controller, &gEfiDevicePathProtocolGuid, (VOID **) &ParentDevicePath, This->DriverBindingHandle, Controller, EFI_OPEN_PROTOCOL_BY_DRIVER ); if (EFI_ERROR (Status)) { return Status; } // // Report enable progress code // REPORT_STATUS_CODE_WITH_DEVICE_PATH ( EFI_PROGRESS_CODE, EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_ENABLE, ParentDevicePath ); // // Open the ISA I/O Protocol // Status = gBS->OpenProtocol ( Controller, &gEfiIsaIoProtocolGuid, (VOID **) &IsaIo, This->DriverBindingHandle, Controller, EFI_OPEN_PROTOCOL_BY_DRIVER ); if (EFI_ERROR (Status)) { goto Done; } // // Allocate the floppy device's Device structure // FdcDev = AllocateZeroPool (sizeof (FDC_BLK_IO_DEV)); if (FdcDev == NULL) { goto Done; } // // Initialize the floppy device's device structure // FdcDev->Signature = FDC_BLK_IO_DEV_SIGNATURE; FdcDev->Handle = Controller; FdcDev->IsaIo = IsaIo; FdcDev->Disk = (EFI_FDC_DISK) IsaIo->ResourceList->Device.UID; FdcDev->Cache = NULL; FdcDev->Event = NULL; FdcDev->ControllerState = NULL; FdcDev->DevicePath = ParentDevicePath; FdcDev->ControllerNameTable = NULL; AddName (FdcDev); // // Look up the base address of the Floppy Disk Controller which controls this floppy device // for (Index = 0; FdcDev->IsaIo->ResourceList->ResourceItem[Index].Type != EfiIsaAcpiResourceEndOfList; Index++) { if (FdcDev->IsaIo->ResourceList->ResourceItem[Index].Type == EfiIsaAcpiResourceIo) { FdcDev->BaseAddress = (UINT16) FdcDev->IsaIo->ResourceList->ResourceItem[Index].StartRange; } } // // Maintain the list of floppy disk controllers // Found = FALSE; List = mControllerHead.ForwardLink; while (List != &mControllerHead) { FdcDev->ControllerState = FLOPPY_CONTROLLER_FROM_LIST_ENTRY (List); if (FdcDev->BaseAddress == FdcDev->ControllerState->BaseAddress) { Found = TRUE; break; } List = List->ForwardLink; } if (!Found) { // // A new floppy disk controller controlling this floppy disk drive is found // FdcDev->ControllerState = AllocatePool (sizeof (FLOPPY_CONTROLLER_CONTEXT)); if (FdcDev->ControllerState == NULL) { goto Done; } FdcDev->ControllerState->Signature = FLOPPY_CONTROLLER_CONTEXT_SIGNATURE; FdcDev->ControllerState->FddResetPerformed = FALSE; FdcDev->ControllerState->NeedRecalibrate = FALSE; FdcDev->ControllerState->BaseAddress = FdcDev->BaseAddress; FdcDev->ControllerState->NumberOfDrive = 0; InsertTailList (&mControllerHead, &FdcDev->ControllerState->Link); } // // Create a timer event for each floppy disk drive device. // This timer event is used to control the motor on and off // Status = gBS->CreateEvent ( EVT_TIMER | EVT_NOTIFY_SIGNAL, TPL_NOTIFY, FddTimerProc, FdcDev, &FdcDev->Event ); if (EFI_ERROR (Status)) { goto Done; } // // Reset the Floppy Disk Controller // if (!FdcDev->ControllerState->FddResetPerformed) { FdcDev->ControllerState->FddResetPerformed = TRUE; FdcDev->ControllerState->FddResetStatus = FddReset (FdcDev); } if (EFI_ERROR (FdcDev->ControllerState->FddResetStatus)) { Status = EFI_DEVICE_ERROR; goto Done; } REPORT_STATUS_CODE_WITH_DEVICE_PATH ( EFI_PROGRESS_CODE, EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_PRESENCE_DETECT, ParentDevicePath ); // // Discover the Floppy Drive // Status = DiscoverFddDevice (FdcDev); if (EFI_ERROR (Status)) { Status = EFI_DEVICE_ERROR; goto Done; } // // Install protocol interfaces for the serial device. // Status = gBS->InstallMultipleProtocolInterfaces ( &Controller, &gEfiBlockIoProtocolGuid, &FdcDev->BlkIo, NULL ); if (!EFI_ERROR (Status)) { FdcDev->ControllerState->NumberOfDrive++; } Done: if (EFI_ERROR (Status)) { REPORT_STATUS_CODE_WITH_DEVICE_PATH ( EFI_ERROR_CODE | EFI_ERROR_MINOR, EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_EC_CONTROLLER_ERROR, ParentDevicePath ); // // If a floppy drive device structure was allocated, then free it // if (FdcDev != NULL) { if (FdcDev->Event != NULL) { // // Close the event for turning the motor off // gBS->CloseEvent (FdcDev->Event); } FreeUnicodeStringTable (FdcDev->ControllerNameTable); FreePool (FdcDev); } // // Close the ISA I/O Protocol // if (IsaIo != NULL) { gBS->CloseProtocol ( Controller, &gEfiIsaIoProtocolGuid, This->DriverBindingHandle, Controller ); } // // Close the device path protocol // gBS->CloseProtocol ( Controller, &gEfiDevicePathProtocolGuid, This->DriverBindingHandle, Controller ); } return Status; }
GuiPanelComponent::GuiPanelComponent() { AddName("GuiPanelComponent"); Init(); }
SpriteComponent::SpriteComponent() { AddName("SpriteComponent"); Init(); }