
/* This file was automatically generated by pclu.*/

#include "pclu_err.h"
#include "pclu_sys.h"


extern struct dbg_info* dbg_info__last_indexc;
#undef MY_TRACE_FLAG
#define MY_TRACE_FLAG _last_indexc_TRACE
int _last_indexc_TRACE;
extern struct OPS *int_ops;
static Vlist1 owns__last_indexc = {0, 1,{ {0, 2, "_init", &int_ops}
}
};
extern errcode _last_indexc_IB_1();
extern errcode intOPfrom_to_by();
extern errcode stringOPsize();
extern errcode charOPequal();
extern errcode stringOPfetch();
extern OWN_req int_ownreqs;
static int _last_indexc_own_init = 0;

/**** BEGIN PROCEDURE _last_indexc ****/

errcode _last_indexc(c, s, ret_1)
CLUREF c;
CLUREF s;
CLUREF *ret_1;
    {
    struct {
        struct dbg_info *DBG_INFO;
        int DBG_LINE;
        errcode err;
        errcode ecode2;
        CLUREF i;
        CLUREF c;
        CLUREF s;
        } locals;
    locals.i.num = UNINIT;
    locals.c.num = UNINIT;
    locals.s.num = UNINIT;
    locals.DBG_INFO = dbg_info__last_indexc;
    locals.c = c;
    locals.s = s;
        if (_last_indexc_own_init == 0) {
        _last_indexc_own_init = 1;
    }
    enter_proc(3);

  LINE(4);
    {
        CLUREF T_1_1;
        CLUREF T_1_2;
        locals.err = stringOPsize(locals.s, &T_1_1);
        if (locals.err != ERR_ok) goto ex_0;
        T_1_2.num = -1;
        locals.err = intOPfrom_to_by(T_1_1, CLU_1, T_1_2, _last_indexc_IB_1, &locals, &locals.ecode2);
        if (locals.err == ERR_iterbodyreturn) {
        ret_1->num = elist[0].num;
        signal(ERR_ok);}
        if (locals.err == ERR_iterbodysignal) {signal(locals.ecode2);}
        if (locals.err == ERR_break) locals.err = ERR_ok;
        if (locals.err == ERR_iterbodyexit) locals.err = locals.ecode2;
        if (locals.err != ERR_ok) goto ex_0;
        }

  LINE(8);
    {
    {
    ret_1->num = 0;
    }
    {signal (ERR_ok);}}
    goto end_0;
    ex_0:
        {
            if (locals.err == ERR_failure) {signal(ERR_failure);}
            elist[0] = _pclu_erstr(locals.err);
            {signal(ERR_failure);}
        }
    end_0: elist[0].str = no_return_values_STRING;
        {signal(ERR_failure);}
    }

/**** END PROCEDURE _last_indexc ****/

extern struct OPS *char_ops;
extern struct OPS *string_ops;
typedef struct {
    int hdr;
    int count;
    char *name;
    char *fname;
    bool is_iter;
    int is_parmd;
    int addr;
    int nargs;
    Vlist1 *vals;
    siglist0 *sigs;
    Vlist5 *locals;
    Vlist1 *owns;
    Vlist0 *ptowns;
    Vlist0 *popowns;
    Slist0 *type_formals;
    Slist0 *op_formals;
    } dbg_info__last_indexc_actual;
static Vlist1 vals__last_indexc = {0, 1, { {0, 2, "", &int_ops}}
};
static siglist0 sigs__last_indexc = {0, 0};
static Vlist5 locals__last_indexc = {0, 5,{ {0, 2, "err", &int_ops},  {0, 2, "ecode2", &int_ops},  {0, 2, "i", &int_ops},  {0, 2, "c", &char_ops},  {0, 2, "s", &string_ops}}
};
static Vlist0 popowns__last_indexc = {0, 0};
Slist0 tformals__last_indexc = {0, 0};
Slist0 opformals__last_indexc = {0, 0};
dbg_info__last_indexc_actual dbg_info__last_indexc_data = {0, 12, 
    "_last_indexc", "/common/pub/dcurtis-temp/pclu/sys/clu/_last_indexc", 0, 0, (int)_last_indexc, 2, 
    &vals__last_indexc, &sigs__last_indexc, &locals__last_indexc, &owns__last_indexc, &NO_VALS, &NO_VALS, &NO_PARMS, &NO_PARMS};
    struct dbg_info *dbg_info__last_indexc = (struct dbg_info*)&dbg_info__last_indexc_data;

/**** BEGIN ITERATOR BODIES for _last_indexc ****/

errcode _last_indexc_IB_1(iv_1, locals, iecode)
errcode *iecode;
CLUREF iv_1;
struct {
    struct dbg_info *DBG_INFO;
    int DBG_LINE;
    errcode err;
    errcode ecode2;
    CLUREF i;
    CLUREF c;
    CLUREF s;
    } *locals;
{
    locals->i.num = iv_1.num;
    enter_iter_body_proc(5);

  FB_LINE(5);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    locals->err = stringOPfetch(locals->s, locals->i, &T_1_1);
    if (locals->err != ERR_ok) goto ex_0;
    T_1_2.num = (T_1_1.ch == locals->c.ch)? true : false;
    if (T_1_2.num == true) {

  FB_LINE(6);
        {
        {
        elist[0] = locals->i;
        }
        *iecode = ERR_ok;
        {signal(ERR_iterbodyreturn);}
        }
        }
        }/* end if */
    {signal(ERR_ok);}
    ex_0:
        {
            *iecode = locals->err;
            {signal(ERR_iterbodyexit);}}
    end_0: {signal(ERR_ok);}
    }/* end _last_indexc_IB_1 */

/**** END ITERATOR BODIES for _last_indexc ****/

