Changeset 58677f97 in OpenModelica
- Timestamp:
- 2022-05-16T16:57:03+02:00 (2 years ago)
- Children:
- dea6384f
- Parents:
- caa3fcca
- Location:
- OMCompiler/SimulationRuntime/c
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
OMCompiler/SimulationRuntime/c/simulation/solver/events.c
rcaa3fcca r58677f97 355 355 while(listLen(&tmpEventList) > 0) 356 356 { 357 /* TODO do this directly w/o free-malloc */358 357 long event_id = *((long*)listFirstData(&tmpEventList)); 359 listPopFront(&tmpEventList); 360 listPushFront(eventList, &event_id); 361 358 listPushFrontNodeNoCopy(eventList, listPopFrontNode(&tmpEventList)); 362 359 infoStreamPrint(LOG_ZEROCROSSINGS, 0, "Event id: %ld", event_id); 363 360 } -
OMCompiler/SimulationRuntime/c/simulation/solver/nonlinearValuesList.c
r83be5f2b r58677f97 75 75 { 76 76 elem = (VALUE*) listFirstData(tmpList->valueList); 77 list PopFront(tmpList->valueList);77 listRemoveFront(tmpList->valueList); 78 78 } 79 79 freeList(tmpList->valueList); -
OMCompiler/SimulationRuntime/c/simulation/solver/synchronous.c
r30bf2469 r58677f97 292 292 type = nextTimer->type; 293 293 activationTime = nextTimer->activationTime; 294 list PopFront(data->simulationInfo->intvlTimers);294 listRemoveFront(data->simulationInfo->intvlTimers); 295 295 switch(type) 296 296 { … … 375 375 type = nextTimer->type; 376 376 activationTime = nextTimer->activationTime; 377 list PopFront(data->simulationInfo->intvlTimers);377 listRemoveFront(data->simulationInfo->intvlTimers); 378 378 switch(type) 379 379 { -
OMCompiler/SimulationRuntime/c/util/list.c
rcaa3fcca r58677f97 90 90 } 91 91 92 /** 93 * @brief Pushes node to the front of list 94 * 95 * @param list Pointer to list 96 * @param node Pointer to node (will not be copied) 97 */ 98 void listPushFrontNodeNoCopy(LIST *list, LIST_NODE *node) 99 { 100 assertStreamPrint(NULL, 0 != list, "invalid list-pointer"); 101 assertStreamPrint(NULL, 0 != node, "invalid list-node"); 102 103 node->next = list->first; 104 ++(list->length); 105 list->first = node; 106 if(!list->last) 107 list->last = list->first; 108 } 109 92 110 void listPushBack(LIST *list, const void *data) 93 111 { … … 151 169 } 152 170 153 void listPopFront(LIST *list) 154 { 155 if(list) 171 /** 172 * @brief Return first node and pop from list 173 * 174 * @param list Pointer to list 175 * @return node Pointer to node (must be freed by caller) 176 */ 177 LIST_NODE *listPopFrontNode(LIST *list) 178 { 179 assertStreamPrint(NULL, 0 != list, "invalid list-pointer"); 180 assertStreamPrint(NULL, 0 != list->first, "empty list"); 181 182 LIST_NODE *node = list->first; 183 list->first = node->next; 184 //node->next = NULL; 185 --(list->length); 186 if(!list->first) 187 list->last = list->first; 188 return node; 189 } 190 191 /** 192 * @brief Remove and free first node from list 193 * 194 * @param list Pointer to list 195 */ 196 void listRemoveFront(LIST *list) 197 { 198 assertStreamPrint(NULL, 0 != list, "invalid list-pointer"); 199 if(list->first) 156 200 { 157 if(list->first) 158 { 159 LIST_NODE *tmpNode = list->first->next; 160 freeNode(list->first); 161 162 list->first = tmpNode; 163 --(list->length); 164 if(!list->first) 165 list->last = list->first; 166 } 201 LIST_NODE *tmpNode = list->first->next; 202 freeNode(list->first); 203 204 list->first = tmpNode; 205 --(list->length); 206 if(!list->first) 207 list->last = list->first; 167 208 } 168 209 } -
OMCompiler/SimulationRuntime/c/util/list.h
rcaa3fcca r58677f97 61 61 62 62 void listPushFront(LIST *list, const void *data); 63 void listPushFrontNodeNoCopy(LIST *list, LIST_NODE *node); 63 64 void listPushBack(LIST *list, const void *data); 64 65 void listInsert(LIST *list, LIST_NODE* prevNode, const void *data); … … 69 70 void *listLastData(LIST *list); 70 71 71 void listPopFront(LIST *list); 72 LIST_NODE *listPopFrontNode(LIST *list); 73 void listRemoveFront(LIST *list); 72 74 73 75 void listClear(LIST *list);
Note: See TracChangeset
for help on using the changeset viewer.