int main(int argc, const char** argv) { //fprintf(stderr,"%s\n","Who even knows the even what?"); FILE* f; const char* fname = 0; char* buf; if (argc > 1) fname = argv[1]; f = fopen(fname,"r"); int buflen = 120; iter* fiter = new_iter(f,0,buflen,'\n'); buf = fiter->buf; int h = -1; char* s = 0; char c[1024]; char n = 0; int i = 0; do { //fprintf(stderr,"n: %i, %i, %08x\n",n,fiter->bufcount,fiter->flags); s = iter_next(fiter); printf("%s\n",s); i++; } while (s && i < 15); free_iter(fiter); fclose(f); return 0; }
int Task_Entry::reframe (ACE_Unbounded_Set <Dispatch_Entry *> &dispatch_entries, Task_Entry &owner, ACE_Ordered_MultiSet <Dispatch_Entry_Link> &set, u_long &set_period, u_long new_period) { int result = 0; // if the set period is zero, treat it as uninitialized, // and simply value the set period with the new period if (set_period) { // make sure the new period is greater than the current // set period, and that they are harmonically related if (new_period <= set_period) // return an error if they're not harmonically related, // do nothing if set's frame is a multiple of the new frame return (set_period % new_period) ? -1 : 0; else if (new_period % set_period) return -1; // make a shallow copy of the set in a new ordered multiset // using the Dispatch_Entry_Link smart pointers ACE_Ordered_MultiSet <Dispatch_Entry_Link> new_set; ACE_Ordered_MultiSet_Iterator <Dispatch_Entry_Link> new_iter (new_set); ACE_Ordered_MultiSet_Iterator <Dispatch_Entry_Link> set_iter (set); for (set_iter.first (); set_iter.done () == 0; set_iter.advance ()) { Dispatch_Entry_Link *link; if (set_iter.next (link) == 0) return -1; else if (new_set.insert (*link, new_iter) < 0) return -1; } // Do a deep copy merge back into the set using the new period // and starting after the 0th sub-frame: this puts all // dispatches after the 0th sub-frame of the new period into the // set, and leaves existing dispatches in the 0th sub-frame of // the new period in the set as well. result = merge_frames (dispatch_entries, owner, set, new_set, new_period, set_period, 1, 1); } // update the set's period to be the new frame set_period = new_period; return result; }