[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[open-cobol-list] Initialize
From: |
Hans-Martin Rasch |
Subject: |
[open-cobol-list] Initialize |
Date: |
Mon Jun 6 01:55:06 2005 |
User-agent: |
KMail/1.6 |
Hi,
the implicit initialize at program start should not change ANY redefined
field, whereas the INITIALIZE statement should change it's direct argument
even if it is a redefine.
To differ this cases, we could add in tree.h an item
int flag_statement;
to the structure cb_initialize, and define it in tree.c
cb_build_initialize (cb_tree var, cb_tree val, cb_tree rep, cb_tree def,
int flag )
......
p->flag_statement = flag;
Then the calls to cb_build_initialize() shoud be
cb_emit (cb_build_initialize (CB_VALUE (l), value, replacing, def, 1));
in typeck.c and
output_stmt (cb_build_initialize (x, cb_true, NULL, def, 0));
in codegen.c.
To give all this a meaning, the initialize_type() gets an additional argument
"topfield", which is checked immediately:
initialize_type (struct cb_initialize *p, struct cb_field *f, int
topfield)
{
if (f->redefines && (!topfield || !p->flag_statement))
return INITIALIZE_NONE;
and finally this argument is set to "0" in every call of initialize_type(),
except in the beginning of the function output_initialize(), where it should
be
switch (initialize_type (p, f, 1))
I hope this will work.
Hans-Martin Rasch
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [open-cobol-list] Initialize,
Hans-Martin Rasch <=