1: # include "../../ingres.h" 2: # include "../../symbol.h" 3: # include "../../pipes.h" 4: # include "IIglobals.h" 5: 6: /* 7: ** IIcvar -- write C variable values to parser 8: ** 9: ** 10: ** IIcvar is used to write the contents 11: ** of a C-variable to the quel parser. 12: ** 13: ** Floats are converted to doubles first. 14: ** 15: */ 16: 17: IIcvar(obj, type, len) 18: char *obj; 19: int type; 20: int len; 21: { 22: register int length; 23: register char *addr; 24: int t; 25: double d; 26: 27: t = type; /* copy type of symbol */ 28: length = len; /* and its length */ 29: addr = obj; /* and a pointer to it */ 30: 31: switch (t) 32: { 33: 34: case opFLOAT: 35: /* convert from f4 to f8 */ 36: d = *((float *)addr); 37: addr = (char *) &d; 38: length = sizeof d; 39: t = opDOUBLE; 40: break; 41: 42: case opSTRING: 43: length = IIlength(addr) + 1; /* length includes null byte at end */ 44: 45: case opINT: 46: case opLONG: 47: case opDOUBLE: 48: break; 49: 50: default: 51: IIsyserr("IIcvar:bad type %d", t); 52: } 53: 54: 55: # ifdef xETR1 56: if (IIdebug) 57: printf("IIcvar:type %d, length %d\n", t, length); 58: # endif 59: 60: if (IIwrpipe(P_NORM, &IIoutpipe, IIw_down, &t, 1) != 1) 61: IIsyserr("IIcvar:can't write to parser(1) %d", IIw_down); 62: 63: if (IIwrpipe(P_NORM, &IIoutpipe, IIw_down, addr, length) != length) 64: IIsyserr("IIcvar:can't write to parser(2) %d", IIw_down); 65: }