1: # include <ingres.h> 2: # include <symbol.h> 3: # include "IIglobals.h" 4: # include <sccs.h> 5: 6: SCCSID(@(#)IIn_get.c 8.1 12/31/84) 7: 8: 9: /* 10: ** IIn_get -- Routine to check if there is a next 11: ** tuple coming up the data pipe in a retrieve. 12: ** Loads IIr_sym with the length and type of 13: ** the next domain. 14: ** 15: ** Returns: 16: ** 0 -- on error or end of tuple 17: ** 1 -- otherwise 18: ** 19: */ 20: 21: 22: IIn_get(file_name, line_no) 23: char *file_name; 24: int line_no; 25: { 26: register struct retsym *ret; 27: 28: if (IIproc_name = file_name) 29: IIline_no = line_no; 30: 31: # ifdef xATR1 32: if (IIdebug) 33: { 34: printf("%s ent ", IIproc_name ? IIproc_name : ""); 35: printf("IIn_get : IIdomains %d IIr_sym type, len %d %d IIerrflag %d\n", 36: IIdomains, IIr_sym.type, IIr_sym.len, IIerrflag); 37: } 38: # endif 39: 40: while (IIpb.pb_type != PB_REG) 41: { 42: IIreadinput(&IIpb); 43: if (bitset(IIpb.pb_stat, PB_INFO)) 44: IIpb_prime(&IIpb, PB_NOTYPE); 45: else 46: return (0); 47: } 48: 49: IIdomains = 0; 50: /* in case of overflow error, a tuple has been skipped */ 51: if (IIerrflag == 1001) 52: IIerrflag = 0; 53: if (IIerrflag) 54: return (0); 55: 56: ret = &IIr_sym; 57: if (ret->type && ret->type != EOTUP) 58: IIsyserr("bad type in IIn_get : %d", ret->type); 59: 60: /* read next type, length pair */ 61: if (IIpb_get(&IIpb, ret, 2) != 2) 62: IIsyserr("IIrdpipe error in IIn_get"); 63: 64: if (ret->type == EXIT) 65: return (0); 66: 67: return (1); 68: } 69: 70: /* 71: ** IIerrtest -- Test if an error occurred within a retrieve. 72: ** 73: ** Returns: 74: ** 0 -- if not 75: ** error that occurred if not 76: ** 77: ** Called By: 78: ** USER -- used to skip over C_CODE in a retrieve {} 79: ** when an error ocurred in getting the tuple. 80: ** A call to this routine is generated by equel, 81: ** because IIerrflag should not need to be vi- 82: ** sible from inside a users program. 83: ** 84: */ 85: 86: IIerrtest() 87: { 88: return (IIerrflag); 89: }