1: # include   <ingres.h>
   2: # undef MAXNAME
   3: # include   "../equel/constants.h"
   4: # include   "IIglobals.h"
   5: # include   <sccs.h>
   6: # include   <errors.h>
   7: 
   8: SCCSID(@(#)IIw_right.c	8.2	2/8/85)
   9: 
  10: 
  11: /*
  12: **  IIw_right -- Write down to the Quel parser a string
  13: **	for a target list of anything but a tupret.
  14: **
  15: **	Parameters:
  16: **		string -- a string which contains the target list
  17: **			of a quel statement, where values from C variables
  18: **			to be plugged in are flagged by the construct
  19: **			'%<ingres_type>" a la printf(). String is left
  20: **			unchanged.
  21: **			To escape the '%' mechanism use '%%'.
  22: **
  23: **		argv -- a vector of pointers to
  24: **			variables from which the values flagged by the '%'
  25: **			mechanism are taken.
  26: **
  27: **	Usage:
  28: **		argv [0] = &double_raise;
  29: **		IIw_right("dom1 = i.ifield * (1+%f8)", argv);
  30: **
  31: **	Required By:
  32: **		all the parametrized statements except "tupret_p".
  33: **
  34: **	Error numbers:
  35: **		1004 -- bad type in parametrized statement.
  36: */
  37: 
  38: 
  39: 
  40: IIw_right(string, argv)
  41: char    *string;
  42: char    **argv;
  43: {
  44:     register char   *b_st, *e_st;
  45:     register char   **av;
  46:     int     type;
  47:     char        *IIitos();
  48: 
  49:     if (IIdebug)
  50:         printf("ent IIw_right : string \"%s\"\n",
  51:         string);
  52:     av = argv;
  53:     for (b_st = e_st = string; *e_st; )
  54:     {
  55:         if (*e_st != '%')
  56:         {
  57:             e_st++;
  58:             continue;
  59:         }
  60: 
  61:         /* provide '%%' escape mechanism */
  62:         if (e_st [1] == '%')
  63:         {
  64:             e_st [1] = '\0';
  65:             IIwrite(b_st);
  66:             e_st [1] = '%';
  67:             b_st = e_st = &e_st [2];
  68:             continue;
  69:         }
  70:         *e_st = '\0';
  71:         IIwrite(b_st);
  72:         *e_st++ = '%';
  73: 
  74:         switch (*e_st)
  75:         {
  76: 
  77:           case 'f' :
  78:             switch (*++e_st)
  79:             {
  80: 
  81:               case '8' :
  82:                 IIcvar(*av, opDOUBLE, 8);
  83:                 break;
  84: 
  85:               case '4' :
  86:                 IIcvar(*av, opFLOAT, 4);
  87:                 break;
  88: 
  89:               default :
  90:                 goto error_label;
  91:             }
  92:             av++;
  93:             break;
  94: 
  95:           case 'i' :
  96:             switch (*++e_st)
  97:             {
  98: 
  99:               case '4' :
 100:                 IIcvar(*av, opLONG, 4);
 101:                 break;
 102: 
 103:               case '2' :
 104:                 IIcvar(*av, opSHORT, 2);
 105:                 break;
 106: 
 107:               case '1' :
 108:                 IIcvar(*av, opCHAR, 1);
 109: 
 110:               default :
 111:                 goto error_label;
 112:             }
 113:             av++;
 114:             break;
 115: 
 116:           case 'c' :
 117:             IIcvar(*av++, opSTRING, 0);
 118:             break;
 119:         }
 120:         b_st = ++e_st;
 121:     }
 122:     IIwrite(b_st);
 123:     return;
 124: 
 125: 
 126: error_label :
 127:     IIerror(BADSTMT, 1, &string);
 128:     IIerrflag = 1004;
 129:     /* make sure that part already written down will
 130: 	 * cause an error, and don't print it.
 131: 	 *	The old IIprint_err is restored in IIerror()
 132: 	 */
 133:     IIwrite(",");
 134:     IIo_print = IIprint_err;
 135:     IIprint_err = IIno_err;
 136: }

Defined functions

IIw_right defined in line 8; never used
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 825
Valid CSS Valid XHTML 1.0 Strict