# 2.11BSD#431 - /usr/ingres/source/equel/runtime/IIw_left.c

##### Functions

    IIw_left          X

       1: # include   "../../ingres.h"
       2: # include   "../constants.h"
       3: # include   "../../pipes.h"
       4: # include   "IIglobals.h"
       5: /*
       6: **	IIw_left -- writes down a "tupret's" target list.
       7: **
       8: **	Parameters:
       9: **		string -- a char * to a string containing everything
      10: **			inside the equivalent "retrieve" statement,
      11: **			but instead of result domain names, the string
      12: **			should have '%<ingres_type>', where <ingres_type>
      13: **			is the ingres type of the resulting C variable.
      14: **			To escape a '%' use 2 ("%%").
      15: **			'String' is left unchanged after the call.
      16: **		argv -- a vector of pointers to the
      17: **			corresponding C variables.
      18: **
      19: **	Usage:
      20: **		argv [0] = &double_var;
      21: **		argv [1] = &int_var;
      22: **		IIw_left("%f8 = i.double, %i2=i.ifield", argv);
      23: **
      24: **	Required by:
      25: **		parametrized retrieves without a target relation
      26: **
      27: **	Requires:
      28: **		Uses the ret_sym array IIretsym, and the old equel
      29: **		method for doing tuprets. NOTE that this does not
      30: **		allow dynamic (before each tuple) resolution of
      31: **		the result C variables as does the new tupret method.
      32: **
      33: **	Error numbers:
      34: **		1003 -- 1 parameter, the erroneous string.
      35: **			"Bad format for a domain in a param retrieve
      36: **			without a result relation"
      37: **
      38: **	History:
      39: **		9/5/78 -- (marc) written
      40: */
      41:
      42:
      43: IIw_left(string, argv)
      44: char    *string;
      45: char    **argv;
      46: {
      47:     register char   *b_st, *e_st;
      48:     register char   **av;
      49:     int     type;
      50:     char        *IIitos();
      51:
      52:     if (IIdebug)
      53:         printf("ent IIw_left : string \"%s\"\n",
      54:         string);
      55:     av = argv;
      56:     for (b_st = e_st = string; *e_st; )
      57:     {
      58:         if (*e_st != '%')
      59:         {
      60:             e_st++;
      61:             continue;
      62:         }
      63:
      64:         /* provide escape method */
      65:         if (e_st [1] == '%')
      66:         {
      67:             e_st [1] = '\0';
      68:             IIwrite(b_st);
      69:             /* leave string intact */
      70:             e_st [1] = '%';
      71:             b_st = e_st = &e_st [2];
      72:             continue;
      73:         }
      74:         *e_st = '\0';
      75:         IIwrite(b_st);
      76:         *e_st++ = '%';
      77:         IIwrite(" RET_VAR ");
      78:
      79:         switch (*e_st)
      80:         {
      81:
      82:           case 'f' :
      83:             switch (*++e_st)
      84:             {
      85:
      86:               case '8' :
      87:                 type = opDOUBLE;
      88:                 break;
      89:
      90:               case '4' :
      91:                 type = opFLOAT;
      92:                 break;
      93:
      94:               default :
      95:                 goto error_label;
      96:             }
      97:             break;
      98:
      99:           case 'i' :
     100:             switch (*++e_st)
     101:             {
     102:
     103:               case '4' :
     104:                 type = opLONG;
     105:                 break;
     106:
     107:               case '2' :
     108:                 type = opINT;
     109:                 break;
     110:
     111:               default :
     112:                 goto error_label;
     113:             }
     114:             break;
     115:
     116:           case 'c' :
     117:             type = opSTRING;
     118:             break;
     119:         }
     120:         IIretrieve(*av++, type);
     121:         b_st = ++e_st;
     122:     }
     123:     IIwrite(b_st);
     124:     return;
     125:
     126:
     127: error_label :
     128:     IIerror(1003, 1, &string);
     129:     IIerrflag = 1003;
     130:     /* make sure that part already written down will
     131: 	 * cause an error, and ignore that error
     132: 	 */
     133:     IIwrite(",");
     134:     IIo_print = IIprint_err;
     135:     IIprint_err = IIno_err;
     136: }

#### Defined functions

IIw_left defined in line 43; never used

Last modified: 1980-12-17 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 530 |