1: # include   "ctlmod.h"
   2: # include   <ingres.h>
   3: # include   <tree.h>
   4: # include   <aux.h>
   5: # include   <sccs.h>
   6: 
   7: SCCSID(@(#)setp.c	8.1	12/31/84)
   8: 
   9: /*
  10: **  SETP -- set parameter
  11: **
  12: **	Sets a parameter, to be later sent by 'call' to whomever.
  13: **
  14: **	Parameters:
  15: **		type -- parameter type.
  16: **			PV_STRING -- a string, 'len' is ignored.
  17: **			PV_TUPLE -- a tuple of length 'len'.
  18: **			PV_QTREE -- a query tree pointer, 'len'
  19: **				is ignored.
  20: **			PV_INT -- an integer, 'len' is ignored.
  21: **		val -- the value (real value if PV_INT, pointer
  22: **			otherwise).
  23: **		len -- the length of the tuple in PV_TUPLE mode.
  24: **
  25: **	Returns:
  26: **		none
  27: **
  28: **	Side Effects:
  29: **		Adjusts Ctx.ctx_pc & Ctx.ctx_pv.
  30: **
  31: **	Trace Flags:
  32: **		4.8 - 4.15
  33: */
  34: 
  35: setp(type, val, len)
  36: register int    type;
  37: char        *val;
  38: register int    len;
  39: {
  40:     register PARM   *pp;
  41:     register char   *newp;
  42:     extern char *need();
  43: 
  44:     /*
  45: 	**  Check the magic bounds.
  46: 	*/
  47: 
  48:     if (!Ctx.ctx_init)
  49: /*
  50: 		pp = &Resp.resp_rval;
  51: */      syserr("setp: no initp");
  52:     else if (Ctx.ctx_pc >= PV_MAXPC)
  53:         syserr("setp: overflow");
  54:     else
  55:         pp = &Ctx.ctx_pv[Ctx.ctx_pc++];
  56: 
  57:     /*
  58: 	**  Figure out the length from the type.
  59: 	*/
  60: 
  61:     switch (type)
  62:     {
  63:       case PV_STR:
  64:         len = length(val) + 1;
  65:         newp = need(Qbuf, len);
  66:         bmove(val, newp, len);
  67:         pp->pv_val.pv_str = newp;
  68:         break;
  69: 
  70:       case PV_TUPLE:
  71:         pp->pv_val.pv_tuple = (char *) val;
  72:         break;
  73: 
  74:       case PV_QTREE:
  75:         len = sizeof pp->pv_val.pv_qtree;
  76:         pp->pv_val.pv_qtree = (QTREE *) val;
  77:         break;
  78: 
  79:       case PV_INT:
  80:         len = sizeof (short);
  81:         pp->pv_val.pv_int = (short) val;
  82:         break;
  83: 
  84: 
  85:       default:
  86:         syserr("setp: type %d", type);
  87:     }
  88: 
  89:     /*
  90: 	**  Set up the parameter.
  91: 	*/
  92: 
  93:     pp->pv_type = type;
  94:     pp->pv_len = len;
  95: 
  96: # ifdef xCTR1
  97:     if (tTf(4, 8))
  98:     {
  99:         lprintf("setp: ");
 100:         pr_parm(pp);
 101:     }
 102: # endif
 103: }

Defined functions

setp defined in line 7; used 4 times
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 788
Valid CSS Valid XHTML 1.0 Strict