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

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


extern struct dbg_info* dbg_info_unify_spacing;
#undef MY_TRACE_FLAG
#define MY_TRACE_FLAG unify_spacing_TRACE
int unify_spacing_TRACE;
extern struct OPS *int_ops;
extern struct OPS *array_of_char_ops;
static Vlist2 owns_unify_spacing = {0, 2,{ {0, 2, "_init", &int_ops}
,  {0, 2, "buf", &array_of_char_ops}}
};
extern errcode unify_spacing_IB_1();
extern errcode arrayOPpredict();
extern errcode arrayOPtrim();
extern errcode stringOPchars();
extern errcode charOPequal();
extern errcode arrayOPaddh();
extern errcode arrayOPtop();
extern errcode arrayOPremh();
extern errcode stringOPac2s();
extern OWN_req char_ownreqs;
extern struct OPS *char_ops;
extern struct REQS *array_of_t_reqs;
extern OWN_req array_ownreqs;
extern struct OPS *array_ops;
struct OPS *array_of_char_table;
struct OPS *array_of_char_ops;
struct OPS *array_of_char_ops;
OWNPTR array_of_char_owns;
static int unify_spacing_own_init = 0;
CLUREF unify_spacingOPbuf;

/**** BEGIN PROCEDURE unify_spacing ****/

errcode unify_spacing(s, ret_1)
CLUREF s;
CLUREF *ret_1;
    {
    struct {
        struct dbg_info *DBG_INFO;
        int DBG_LINE;
        errcode err;
        errcode ecode2;
        CLUREF ever;
        CLUREF out;
        CLUREF c;
        CLUREF s;
        } locals;
    locals.ever.num = UNINIT;
    locals.out.num = UNINIT;
    locals.c.num = UNINIT;
    locals.s.num = UNINIT;
    locals.DBG_INFO = dbg_info_unify_spacing;
    locals.s = s;
        if (unify_spacing_own_init == 0) {
        add_parm_info_type(0, char_ops, array_of_t_reqs);
        find_type_instance(array_ops, 1, &array_ownreqs, &(array_of_char_ops));
        unify_spacing_own_init = 1;
        {
            {CLUREF T_0_1;
            CLUREF T_0_2;
            T_0_1.num = 100;
            locals.err = arrayOPpredict(CLU_1, T_0_1, &T_0_2);
            if (locals.err != ERR_ok) goto ex_0;
            unify_spacingOPbuf.num = T_0_2.num;
            }
            }
    }
    enter_proc(3);

  LINE(6);
    {
    locals.err = arrayOPtrim(unify_spacingOPbuf, CLU_1, CLU_0);
    if (locals.err != ERR_ok) goto ex_0;
    }

  LINE(7);
    {
        {locals.ever.tf = false;
        }
        }

  LINE(8);
    {
        {locals.out.tf = false;
        }
        }

  LINE(9);
    {
        locals.err = stringOPchars(locals.s, unify_spacing_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(29);
    {
    if (locals.ever.num == true) {

  LINE(30);
        {
        CLUREF T_3_1;
        CLUREF T_3_2;
        CLUREF T_3_3;
        locals.err = arrayOPtop(unify_spacingOPbuf, &T_3_1);
        if (locals.err != ERR_ok) goto ex_1;
        T_3_2.ch = ' ';
        T_3_3.num = (T_3_1.ch == T_3_2.ch)? true : false;
        if (T_3_3.num == true) {

  LINE(31);
            {
            CLUREF T_4_1;
            locals.err = arrayOPremh(unify_spacingOPbuf, &T_4_1);
            if (locals.err != ERR_ok) goto ex_1;
            }
            }
            }/* end if */
            goto end_1;
            ex_1:
                if ((locals.err == ERR_bounds)) {
                }
                else {
                    goto ex_0;
                }
            end_1:;

  LINE(33);
        {
        CLUREF T_2_1;
        locals.err = stringOPac2s(unify_spacingOPbuf, &T_2_1);
        if (locals.err != ERR_ok) goto ex_0;
        locals.s.num = T_2_1.num;
        }
        }
        }/* end if */

  LINE(35);
    {
    locals.err = arrayOPtrim(unify_spacingOPbuf, CLU_1, CLU_0);
    if (locals.err != ERR_ok) goto ex_0;
    }

  LINE(36);
    {
    {
    ret_1->num = locals.s.num;
    }
    {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 unify_spacing ****/

extern struct OPS *string_ops;
extern struct OPS *bool_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;
    Vlist6 *locals;
    Vlist2 *owns;
    Vlist0 *ptowns;
    Vlist0 *popowns;
    Slist0 *type_formals;
    Slist0 *op_formals;
    } dbg_info_unify_spacing_actual;
static Vlist1 vals_unify_spacing = {0, 1, { {0, 2, "", &string_ops}}
};
static siglist0 sigs_unify_spacing = {0, 0};
static Vlist6 locals_unify_spacing = {0, 6,{ {0, 2, "err", &int_ops},  {0, 2, "ecode2", &int_ops},  {0, 2, "ever", &bool_ops},  {0, 2, "out", &bool_ops},  {0, 2, "c", &char_ops},  {0, 2, "s", &string_ops}}
};
static Vlist0 popowns_unify_spacing = {0, 0};
Slist0 tformals_unify_spacing = {0, 0};
Slist0 opformals_unify_spacing = {0, 0};
dbg_info_unify_spacing_actual dbg_info_unify_spacing_data = {0, 12, 
    "unify_spacing", "/common/pub/dcurtis-temp/pclu/lib/clu/unify_spacing.clu", 0, 0, (int)unify_spacing, 1, 
    &vals_unify_spacing, &sigs_unify_spacing, &locals_unify_spacing, &owns_unify_spacing, &NO_VALS, &NO_VALS, &NO_PARMS, &NO_PARMS};
    struct dbg_info *dbg_info_unify_spacing = (struct dbg_info*)&dbg_info_unify_spacing_data;

/**** BEGIN ITERATOR BODIES for unify_spacing ****/

errcode unify_spacing_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 ever;
    CLUREF out;
    CLUREF c;
    CLUREF s;
    } *locals;
{
    locals->c.num = iv_1.num;
    enter_iter_body_proc(10);

  FB_LINE(10);
    {
    CLUREF T_1_1;
    CLUREF T_1_2;
    T_1_1.ch = '\t';
    T_1_2.num = (locals->c.ch == T_1_1.ch)? true : false;
    if (T_1_2.num == true) {

  FB_LINE(11);
        {
        locals->ever.tf = true;
        }

  FB_LINE(12);
        {
        if (locals->out.num == true) {

  FB_LINE(13);
            {
            CLUREF T_3_1;
            T_3_1.ch = ' ';
            locals->err = arrayOPaddh(unify_spacingOPbuf, T_3_1);
            if (locals->err != ERR_ok) goto ex_0;
            }

  FB_LINE(14);
            {
            locals->out.tf = false;
            }
            }
            }/* end if */

  FB_LINE(16);
        {signal(ERR_ok);}
        }
    else {
    CLUREF T_1_3;
    CLUREF T_1_4;
    T_1_3.ch = ' ';
    T_1_4.num = (locals->c.ch == T_1_3.ch)? true : false;
    if (T_1_4.num == true) {

  FB_LINE(18);
        {
        if (locals->out.num == true) {

  FB_LINE(19);
            {
            CLUREF T_3_1;
            T_3_1.ch = ' ';
            locals->err = arrayOPaddh(unify_spacingOPbuf, T_3_1);
            if (locals->err != ERR_ok) goto ex_0;
            }

  FB_LINE(20);
            {
            locals->out.tf = false;
            }

  FB_LINE(21);
            {signal(ERR_ok);}
            }
            }/* end if */

  FB_LINE(23);
        {
        locals->ever.tf = true;
        }

  FB_LINE(24);
        {signal(ERR_ok);}
        }
        }}/* end if */

  FB_LINE(26);
    {
    locals->err = arrayOPaddh(unify_spacingOPbuf, locals->c);
    if (locals->err != ERR_ok) goto ex_0;
    }

  FB_LINE(27);
    {
    locals->out.tf = true;
    }
    {signal(ERR_ok);}
    ex_0:
        {
            *iecode = locals->err;
            {signal(ERR_iterbodyexit);}}
    end_0: {signal(ERR_ok);}
    }/* end unify_spacing_IB_1 */

/**** END ITERATOR BODIES for unify_spacing ****/

