|
|
1.1 ! root 1: static char ID[] = "@(#) chstack.c: 1.1 3/16/82"; ! 2: #include <stdio.h> ! 3: #include "sdp.h" ! 4: #include "define2.h" ! 5: #include "define3.h" ! 6: ! 7: #define CS01 "CS01 " ! 8: #define CS02 "CS02 " ! 9: #define CS03 "CS03 " ! 10: #define CS04 "CS04 " ! 11: #define CS05 "CS05 " ! 12: #define CS06 "CS06 " ! 13: ! 14: ! 15: int ! 16: sdp_chstack(sp,c,v) ! 17: struct SPACE *sp ; ! 18: unsigned c ; ! 19: int v[] ; ! 20: { ! 21: ITEMID id ; ! 22: struct STAXINFO *ptr ; ! 23: struct SPACE tmp_sp ; ! 24: int i ; ! 25: ! 26: if ( c > 1 ) ! 27: for ( i=1 ; i<c ; i++ ) ! 28: if ( v[i] - v[i-1] < sizeof(ITEMID) ) ! 29: ERR_RET(CS01,ERROR) ! 30: ! 31: tmp_sp = *sp ; ! 32: sp->staxinfo = (struct STAXINFO *)ALLOC((c+1)*sizeof(struct STAXINFO)) ; ! 33: if ( sp->staxinfo == NULL ) ! 34: ERR_RET(CS02,ERROR) ! 35: sp->numbstax = c+1 ; ! 36: ! 37: sp->staxinfo[0].top = IDNULL ; ! 38: sp->staxinfo[0].size = 0 ; ! 39: sp->staxinfo[0].depth = 0 ; ! 40: for ( i=1 ; i<c+1 ; i++ ) ! 41: { ! 42: sp->staxinfo[i].top = IDNULL ; ! 43: sp->staxinfo[i].size = v[i-1] ; ! 44: sp->staxinfo[i].depth = 0 ; ! 45: } ! 46: ! 47: for ( i=0 ; i<tmp_sp.numbstax ; i++ ) ! 48: while ( (id=pop_id(&tmp_sp,tmp_sp.staxinfo[i].size)) != IDNOTFOUND ) ! 49: if ( id == IDNULL ) ! 50: ERR_RET(CS03,ERROR) ! 51: else ! 52: { ! 53: ptr = (struct STAXINFO *)sdp_use(sp,id,RNLY) ; ! 54: if ( ptr == NULL ) ! 55: ERR_RET(CS04,ERROR) ! 56: if ( push_id(sp,id,ptr->size) == NULL ) ! 57: ERR_RET(CS05,ERROR) ! 58: if ( sdp_unuse(sp,id,RNLY) == NULL ) ! 59: ERR_RET(CS06,ERROR) ! 60: } ! 61: return(SUCCESS) ; ! 62: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.