struct Specifier * CopySpecifier(struct Specifier * spec) { if(spec) switch(spec->type) { case 0: return MkSpecifier(spec->specifier); case 2: { struct Identifier * id = CopyIdentifier(spec->id); struct __ecereNameSpace__ecere__sys__OldList * list = MkList(); struct Enumerator * enumerator; if(spec->list) { for(enumerator = (*spec->list).first; enumerator; enumerator = enumerator->next) ListAdd(list, CopyEnumerator(enumerator)); } return MkEnum(id, list); } case 3: case 4: { struct Identifier * id = CopyIdentifier(spec->id); struct __ecereNameSpace__ecere__sys__OldList * list = (((void *)0)); struct ClassDef * def; struct Specifier * s; if(spec->definitions) { list = MkList(); if(spec->list) { for(def = (*spec->list).first; def; def = def->next) ListAdd(list, CopyClassDef(def)); } } s = MkStructOrUnion(spec->type, id, list); s->extDeclStruct = CopyExtDecl(spec->extDeclStruct); return s; } case 1: { struct Specifier * copy = (copy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Specifier), copy->type = 1, copy->name = __ecereNameSpace__ecere__sys__CopyString(spec->name), copy->symbol = spec->symbol, copy->templateArgs = (((void *)0)), copy); return copy; } case 7: return MkSpecifierSubClass(CopySpecifier(spec->_class)); case 8: return __extension__ ({ struct Specifier * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Specifier); __ecereInstance1->loc = spec->loc, __ecereInstance1->type = 8, __ecereInstance1->templateParameter = spec->templateParameter, __ecereInstance1; }); case 5: return MkSpecifierExtended(CopyExtDecl(spec->extDecl)); }
struct Declaration * QMkDeclarationBase(int base, struct InitDeclarator * initDecl) { struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * initDecls = (((void *)0)); ListAdd(specs, MkSpecifier(base)); if(initDecl) { initDecls = MkList(); ListAdd(initDecls, initDecl); } return MkDeclaration(specs, initDecls); }
BOOL ZipDlg::ListMove( BOOL blnUp) { int intSize = ListView_GetItemCount( hwndList) ; bool blnMoved = false ; // 動く余地があるかどうか int intIndex ; vector<BOOL> vecSelected ; BOOL blnTop = TRUE ; for( int i = 0; i < intSize; i++) { intIndex = blnUp ? i : intSize - i - 1 ; if( ListView_GetItemState( hwndList, intIndex, LVIS_SELECTED)) { if( !blnMoved) { continue ; } // リストビュー ListView_DeleteItem( hwndList, intIndex) ; if( blnUp) // index減少 { ListAdd( vecFileList[ intIndex], intIndex - 1) ; } else { ListAdd( vecFileList[ intIndex], intIndex + 1) ; } if( blnTop) { ListView_SetItemState( hwndList, intIndex + ( blnUp ? -1 : 1), LVIS_FOCUSED, LVIS_FOCUSED) ; ListView_EnsureVisible( hwndList, intIndex + ( blnUp ? -1 : 1), FALSE) ; blnTop = FALSE ; } // ドキュメント ListReload() ; } else { blnMoved = true ; } } return TRUE ; }
void AddOpenNeighboursToList (location_t here) { if (HasExit (here, NORTH)) { ListAdd (Neighbour (here, NORTH)); } if (HasExit (here, EAST)) { ListAdd (Neighbour (here, EAST)); } if (HasExit (here, SOUTH)) { ListAdd (Neighbour (here, SOUTH)); } if (HasExit (here, WEST)) { ListAdd (Neighbour (here, WEST)); } }
static void mimeTypeAdd(MIMEType * const MIMETypeP, const char * const type, const char * const ext, bool * const successP) { uint16_t index; void * mimeTypesItem; bool typeIsInList; assert(MIMETypeP != NULL); typeIsInList = ListFindString(&MIMETypeP->typeList, type, &index); if (typeIsInList) mimeTypesItem = MIMETypeP->typeList.item[index]; else mimeTypesItem = (void*)PoolStrdup(&MIMETypeP->pool, type); if (mimeTypesItem) { bool extIsInList; extIsInList = ListFindString(&MIMETypeP->extList, ext, &index); if (extIsInList) { MIMETypeP->typeList.item[index] = mimeTypesItem; *successP = TRUE; } else { void * extItem = (void*)PoolStrdup(&MIMETypeP->pool, ext); if (extItem) { bool addedToMimeTypes; addedToMimeTypes = ListAdd(&MIMETypeP->typeList, mimeTypesItem); if (addedToMimeTypes) { bool addedToExt; addedToExt = ListAdd(&MIMETypeP->extList, extItem); *successP = addedToExt; if (!*successP) ListRemove(&MIMETypeP->typeList); } else *successP = FALSE; if (!*successP) PoolReturn(&MIMETypeP->pool, extItem); } else *successP = FALSE; } } else *successP = FALSE; }
LRESULT ZipDlg::OnDropFiles( HWND hwnd, WPARAM wParam, LPARAM lParam) { HDROP hDrop = (HDROP)wParam ; unsigned int intIndex = DragQueryFile( hDrop, 0xFFFFFFFF, NULL, 0) ; for( unsigned int i = 0; i < intIndex; i++) { char pszBuf[ MAX_PATH + 1] ; DragQueryFile( hDrop, i, pszBuf, MAX_PATH) ; string s = pszBuf ; // フォルダか? if( GetFileAttributes( s.c_str()) & FILE_ATTRIBUTE_DIRECTORY) { // 検索開始 string strFind = s + "\\*.*" ; WIN32_FIND_DATA wfd ; HANDLE hFind = FindFirstFile( strFind.c_str(), &wfd) ; if( hFind == INVALID_HANDLE_VALUE) { return 0 ; } do { // アイテム名のフィルタリング string strFile = wfd.cFileName ; if( strFile == "." || strFile == "..") { continue ; } Mp3File* pMp3 = new Mp3File( s + "\\" + strFile) ; pMp3->SetSaveName( GetFileName( s) + "\\" + strFile) ; ListAdd( pMp3, vecFileList.size()) ; } while( FindNextFile( hFind, &wfd)) ; FindClose( hFind) ; } else if( !Profile::blnOnlyMp3 || s.rfind( ".mp3") == s.size() - 4 || s.rfind( ".MP3") == s.size() - 4) { Mp3File* pMp3 = new Mp3File( pszBuf) ; ListAdd( pMp3, vecFileList.size()) ; } } DragFinish( hDrop) ; return TRUE ; }
static struct Instantiation * CopyInstantiation(struct Instantiation * inst) { struct Instantiation * copy; struct __ecereNameSpace__ecere__sys__OldList * list = MkList(); struct MembersInit * member; if(inst->members) { for(member = (*inst->members).first; member; member = member->next) ListAdd(list, CopyMembersInit(member)); } copy = MkInstantiation(CopySpecifier(inst->_class), CopyExpression(inst->exp), list); copy->data = inst->data; if(inst->data) { struct Symbol * classSym = FindClass(inst->_class->name); struct __ecereNameSpace__ecere__com__Class * _class = classSym ? classSym->registered : (((void *)0)); if(_class) { if(_class->type == 0) ((struct __ecereNameSpace__ecere__com__Instance *)(char *)((struct __ecereNameSpace__ecere__com__Instance *)copy->data))->_refCount++; } } copy->loc = inst->loc; copy->isConstant = inst->isConstant; return copy; }
/** * Reads a float array, such as verticies, normals, text cords, etc... * @param tempory The ModelTempory struct to hold the array. * @param mesh The mesh using the floats * @param xnode The XML node containing the data. * @return */ FloatArray* RCBC_MiniXML_ProcessGeometries_Mesh_FloatArray(ModelTempory *tempory, Mesh *mesh, mxml_node_t *xnode) { DEBUG_M("Entering function..."); const char* id = mxmlElementGetAttr(xnode, "id"); const char* count_s = mxmlElementGetAttr(xnode, "count"); int count = atoi(count_s); FloatArray* newarray = NEW(FloatArray, count); if(!newarray) { return NULL; } GLfloat f = 0.0f; int i = 0; char* pch = strtok(xnode->child->value.opaque, " "); while(pch && i < count) { sscanf(pch, "%f", &f); newarray->values[i] = f; pch = strtok(NULL, " "); i++; } ListAdd(tempory->deleteme, newarray); DEBUG_M("exiting function"); return newarray; }
int ListAddFromString(TList *list,char *c) { char *t = 0; char *p = 0; /* sanity */ if (!list) { return FALSE; } if (c) while (1) { NextToken(&c); while (*c==',') c++; if (!(t=GetToken(&c))) break; p=c-2; while (*p==',') *(p--)='\0'; if (*t) if (!ListAdd(list,t)) return FALSE; }; return TRUE; }
static NotificationAttributes * LookupNotificationAttributes(struct ListHead * attributesList, int shortServerID, ObjectIDType objectID, ObjectInstanceIDType objectInstanceID, ResourceIDType resourceID) { NotificationAttributes * result = NULL; if (attributesList != NULL) { struct ListHead * i; ListForEach(i, attributesList) { NotificationAttributes * attributes = ListEntry(i, NotificationAttributes, list); if ((attributes != NULL) && (attributes->ShortServerID == shortServerID) && (attributes->ObjectID == objectID) && (attributes->ObjectInstanceID == objectInstanceID) && (attributes->ResourceID == resourceID)) { result = attributes; break; } } if (result == NULL) { // doesn't exist yet, so create result = malloc(sizeof(NotificationAttributes)); memset(result, 0, sizeof(NotificationAttributes)); memset(result->Valid, 0, sizeof(result->Valid)); result->ObjectID = objectID; result->ObjectInstanceID = objectInstanceID; result->ResourceID = resourceID; result->ShortServerID = shortServerID; ListAdd(&result->list, attributesList); } }
struct TypeName * QMkClass(char * spec, struct Declarator * decl) { struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(); ListAdd(specs, MkSpecifierName(spec)); return MkTypeName(specs, decl); }
/* Process the <library_effects><effect><profile_COMMON><newparam> section of COLLADA */ void RCBC_MiniXML_ProcessTextureEffects_Newparam(ModelTempory *tempory, mxml_node_t *node, Hookup* fx_hookup) { DEBUG_M("Entering function..."); mxml_node_t* child; //const char* newparam_sid = mxmlElementGetAttr(node, "id"); //const char* surface_type; const char* init_from; assert(tempory); assert(node); assert(fx_hookup); DumpNodeInfo(node); for(node = node->child; node != NULL; node = node->next) { DumpNodeInfo(node); if(node->type == MXML_ELEMENT && strcasecmp(node->value.element.name, "surface") == 0) { for(child = node->child; child != NULL; child = child->next) { if(child->type == MXML_ELEMENT && strcasecmp(child->value.element.name, "init_from") == 0) { //surface_type = mxmlElementGetAttr(child, "type"); init_from = child->child->value.opaque; Hookup* img_hookup = NEW(Hookup, (char*)init_from, &fx_hookup->ptr); ListAdd(tempory->sinks, img_hookup); } } } } }
struct Expression * QBrackets(struct Expression * exp) { struct __ecereNameSpace__ecere__sys__OldList * expList = MkList(); ListAdd(expList, exp); return MkExpBrackets(expList); }
/* Process the <library_effects> section of COLLADA */ void RCBC_MiniXML_ProcessTextureEffects(ModelTempory *tempory, mxml_node_t *node) { DEBUG_M("Entering function..."); const char* id; mxml_node_t* child; assert(tempory); if(!node) { return; } /* Loop through all the effect nodes */ for(node = node->child; node != NULL; node = node->next) { if(node->type == MXML_ELEMENT && strcasecmp(node->value.element.name, "effect") == 0) { id = mxmlElementGetAttr(node, "id"); for(child = node->child; child != NULL; child = child->next) { if(child->type == MXML_ELEMENT && strcasecmp(child->value.element.name, "profile_COMMON") == 0) { Hookup* fx_hookup = NEW(Hookup, (char*)id, NULL); ListAdd(tempory->sources, fx_hookup); RCBC_MiniXML_ProcessTextureEffects_Profile(tempory, child, fx_hookup); } } } } }
struct Expression * QMkExpCond(struct Expression * cond, struct Expression * exp, struct Expression * elseExp) { struct __ecereNameSpace__ecere__sys__OldList * expList = MkList(); ListAdd(expList, exp); return MkExpCondition(cond, expList, elseExp); }
// return 0 (success) or -1 (fail) int ListInsert(LIST *list, void *item) { list->curr = list->curr->prev; if (list->curr == list->head) { list->boundary = -1; } return ListAdd(list, item); }
void HashMapAdd(struct HashMap* HashMap, Data dat) { int datHash = (HashMap->HashFunction)(dat); if(datHash >= HashMap->MaxHashValue) datHash %= HashMap->MaxHashValue; dat.c = HashMapDeleteAll(HashMap, dat, cmpData) + 1; ListAdd( (HashMap->Map)[datHash], dat); }
/* Enter Monitor Status * If it is locked add to queue and add * to the enter semaphore's sleep counter */ void MonEnter(){ if(isLocked){ ListAdd(enterQueue, MyPid()); P(enterSem); }else{ isLocked = 1; } }
int ServerCreate(TServer *srv,POOL *pool,char *name,uint16 port,char *filespath, char *modulepath, char *logfilename) { /* sanity */ if (!srv) { return FALSE; } srv->name = (name ? strdup(name) : 0); srv->port=port; srv->defaulthandler=(void *)ServerDefaultHandlerFunc; srv->rootpath = strdup( DEFAULT_ROOT ); srv->filespath = (filespath ? strdup(filespath) : 0); srv->modulepath = ( modulepath ? strdup(modulepath) : 0 ); srv->keepalivetimeout=15; srv->keepalivemaxconn=100000; srv->timeout=15; srv->stopped = 0; srv->pool = ap_make_sub_pool( pool ); srv->uri_handlers = 0; srv->uri_wildcard_handlers = 0; srv->content_handlers = 0; srv->content_wildcard_handlers = 0; if( srv->max_conn == 0 ) srv->max_conn = DEFAULT_MAX_CONN; srv->conn = (TConn *)malloc( sizeof(TConn)*srv->max_conn ); memset(srv->conn, 0, sizeof(TConn) * srv->max_conn); srv->stat_data_time = 0; srv->stat_conns = 0; srv->stat_inbytes = 0; srv->stat_outbytes = 0; #ifdef _UNIX srv->pidfile.fd=srv->uid=srv->gid=(-1); #endif /* _UNIX */ ListInitAutoFree(&srv->defaultfilenames); if (logfilename) { if( srv->error_fname ) free( srv->error_fname ); srv->error_fname = strdup( logfilename ); } else srv->error_fname=NULL; srv->conf_fname = NULL; srv->diag_fname = NULL; srv->configDB_fname = NULL; /* enter into the global serv list */ ListAdd( &srv_list,srv ); return TRUE; }
/* Monitor Signal * If we have something in the condition variable * list then remove it from that list and add it to * the urguentQueue list and we release the condition * variable semaphore and add to the urguentQueue's semaphore */ void MonSignal(int cv){ if(ListCount(condLists[cv]) > 0){ ListRemove(condLists[cv]); ListAdd(urgentQueue, MyPid()); V(condSems[cv]); P(urgentSem); } }
void CJabberProto::GroupchatJoinRoom( const TCHAR* server, const TCHAR* room, const TCHAR* nick, const TCHAR* password, bool autojoin ) { JabberGcRecentInfo info( this ); int i = 0; bool found = false; for (i = 0 ; i < 5; ++i) { if (!info.loadRecent(i)) continue; if (info.equals(room, server, nick, password)) { found = true; break; } } if (!found) { for (int i = 4; i--; ) { if (info.loadRecent(i)) info.saveRecent(i + 1); } info.fillData(room, server, nick, password); info.saveRecent(0); } TCHAR jid[512]; mir_sntprintf( jid, SIZEOF(jid), _T("%s@%s/%s"), room, server, nick ); JABBER_LIST_ITEM* item = ListAdd( LIST_CHATROOM, jid ); item->bAutoJoin = autojoin; replaceStr( item->nick, nick ); replaceStr( item->password, info.password ); int status = ( m_iStatus == ID_STATUS_INVISIBLE ) ? ID_STATUS_ONLINE : m_iStatus; XmlNode x( _T("x")); x << XATTR( _T("xmlns"), _T(JABBER_FEAT_MUC)); if ( info.password && info.password[0] ) x << XCHILD( _T("password"), info.password ); if (m_options.GcLogChatHistory) { HANDLE hContact = ChatRoomHContactFromJID(jid); time_t lasteventtime = JGetDword(hContact, "muc_lastevent", 0); if (hContact && lasteventtime) { TCHAR lasteventdate[40]; tmi.printTimeStamp(UTC_TIME_HANDLE, lasteventtime, _T("I"), lasteventdate, SIZEOF(lasteventdate), 0); x << XCHILD( _T("history") ) << XATTR( _T("since"), lasteventdate); } } SendPresenceTo( status, jid, x ); }
/* Process the <library_materials> section of COLLADA */ void RCBC_MiniXML_ProcessTextureMaterial(ModelTempory *tempory, mxml_node_t *node) { DEBUG_M("Entering function..."); mxml_node_t* child; const char* id; const char* url; assert(tempory); if(!node) { return; } /* Loop through all the material nodes */ for(node = node->child; node != NULL; node = node->next) { if(node->type == MXML_ELEMENT && strcasecmp(node->value.element.name, "material") == 0) { id = mxmlElementGetAttr(node, "id"); for(child = node->child; child != NULL; child = child->next) { if(child->type == MXML_ELEMENT && strcasecmp(child->value.element.name, "instance_effect") == 0) { url = mxmlElementGetAttr(child, "url"); DEHASH(url); Hookup* material_hookup = NEW(Hookup, (char*)id, NULL); ListAdd(tempory->sources, material_hookup); Hookup* fx_hookup = NEW(Hookup, (char*)url, &material_hookup->ptr); ListAdd(tempory->sinks, fx_hookup); } } } } DEBUG_M("Exiting function..."); }
/** * Process the <library_images> section of COLLADA. */ void RCBC_MiniXML_ProcessTextureImages(ModelTempory *tempory, mxml_node_t *node) { DEBUG_M("Entering function..."); assert(tempory); if(!node) { return; } int debug = 0; const char* id; mxml_node_t* child; char* fullname = NULL; char* filename = NULL; char* rname = NULL; int rname_len = 0; /* Loop through all the image nodes */ for(node = node->child; node != NULL; node = node->next) { if(node->type == MXML_ELEMENT && strcasecmp(node->value.element.name, "image") == 0) { id = mxmlElementGetAttr(node, "id"); /* Process the image filename */ for(child = node->child; child != NULL; child = child->next) { if(child->type == MXML_ELEMENT && strcasecmp(child->value.element.name, "init_from") == 0) { fullname = child->child->value.opaque; /* Find the final path element since we want only the filename */ filename = strrchr(fullname, '/')+1; /* Sane OSes path seperator */ if(!filename) { filename = strrchr(fullname, '\\')+1; /* Or try for a windows style path seperator */ } if(!filename) { /* If we didn't find a path seperator, assume filename only */ rname = fullname; } else { /* Append texture directory name */ rname_len = strlen(DIRECTORY_TEXTURES)+strlen(filename)+1; rname = malloc(rname_len * sizeof(char)); snprintf(rname, rname_len, "%s%s", DIRECTORY_TEXTURES, filename); } Image* image = Image_Add(tempory->images, rname, 1); Hookup* hookup = NEW(Hookup, (char*)id, (void*)image); ListAdd(tempory->sources, hookup); free(rname); } } } } }
bool ListAddFromString(TList * const list, const char * const stringArg) { bool retval; if (!stringArg) retval = TRUE; else { char * buffer; buffer = strdup(stringArg); if (!buffer) retval = FALSE; else { bool endOfString; bool error; char * c; for (c = &buffer[0], endOfString = FALSE, error = FALSE; !endOfString && !error; ) { const char * t; NextToken((const char **)&c); while (*c == ',') ++c; t = GetToken(&c); if (!t) endOfString = TRUE; else { char * p; for (p = c - 2; *p == ','; --p) *p = '\0'; if (t[0] != '\0') { bool added; added = ListAdd(list, (void*)t); if (!added) error = TRUE; } } } retval = !error; xmlrpc_strfree(buffer); } } return retval; }
void G_AddSmoke(vec3 pos, vec3 vel, float radius, int timeLeft) { smoke* s = malloc(sizeof(smoke)); s->p.p[0] = pos[0]; s->p.p[1] = pos[1]; s->p.p[2] = pos[2]; s->p.v[0] = vel[0]; s->p.v[1] = vel[1]; s->p.v[2] = vel[2]; s->radius = radius; s->timeLeft = timeLeft; ListAdd(&smokeParts, s); }
int RCBC_MiniXML_ProcessGeometries_Mesh_Verticies(ModelTempory *tempory, Mesh *mesh, mxml_node_t *xnode) { DEBUG_M("Entering function..."); assert(mesh); assert(xnode); mxml_node_t *node; char input_id[512]; const char *source; const char *semantic; const char *id = mxmlElementGetAttr(xnode, "id"); for(node = xnode->child; node != NULL; node = node->next) { DumpNodeInfo(node); if(node->type == MXML_ELEMENT) { if(strcasecmp(node->value.element.name, "input") == 0) { semantic = mxmlElementGetAttr(node, "semantic"); source = mxmlElementGetAttr(node, "source"); DEHASH(source); int input_id_len = strlen(id)+strlen(semantic)+2; char* input_id = malloc(input_id_len); snprintf(input_id, input_id_len, "%s_%s", id, semantic); ListAdd(tempory->freeme, input_id); /* free after hookups */ Hookup* idhookup = NEW(Hookup, (char*)input_id, NULL); Hookup* sourcehookup = NEW(Hookup, (char*)source, (void*)&idhookup->ptr); ListAdd(tempory->sources, idhookup); ListAdd(tempory->sinks, sourcehookup); } } } return 0; }
AudioSource* S_CreateSource(Ship* ship) { AudioSource* s = calloc(1, sizeof(AudioSource)); s->s = ship; alGenSources(1, &s->sourceID); alSourcef(s->sourceID, AL_PITCH, 1); alSourcef(s->sourceID, AL_GAIN, S_GLOBAL_VOLUME / 100.0); alSource3f(s->sourceID, AL_POSITION, 0, 0, 0); alSource3f(s->sourceID, AL_VELOCITY, 0, 0, 0); ListAdd(&S_sources, s); return s; }
/* * lListDuplicate * * Author: Christian Schafmeister (1991) * * Return a duplicate of the list. * Should only be called by the collectionduplicate * routine (TODO - delete collection), which is * called by oObjectDuplicate(), * which sets objekt attributes. */ LIST lListDuplicate( LIST lOld ) { OBJEKT lNew, oObj, oNew; LISTLOOP llLoop; lNew = oCreate(LISTid); llLoop = llListLoop(lOld); while ( ( oObj = oListNext(&llLoop) ) != NULL ) { oNew = oObjectDuplicate(oObj); ListAdd( (LIST)lNew, oNew ); oNew->iReferences = 1; /* since ListAdd() increments */ } return((LIST)lNew); }
// return void void ListConcat(LIST *list1, LIST *list2) { void *item; // add to list1 //list1->curr = list1->head->prev; //list2->curr = list2->head->next; ListLast(list1); ListFirst(list2); while (list2->curr != list2->head) { item = ListRemove(list2); ListAdd(list1, item); } // rmv list2 free_list(list2); }
void AllocaListaAUX(Albero* alb, lista** res, int prof, int currentProf) { if(currentProf==prof) { ListAdd(res, alb->val); } else { currentProf++; if(alb->left!=NULL) AllocaListaAUX(alb->left, res, prof, currentProf); if(alb->right!=NULL) AllocaListaAUX(alb->right, res, prof, currentProf); } }