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

Defined functions

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