Annotation of 43BSD/ingres/source/libq/IIw_left.c, revision 1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.