Mail Archives: djgpp/1999/07/07/01:40:00
Yes!..that is what I meant. Ive done that with the functions, but when
I try to do it with the variables, my compiler (DJGPP for dos) keeps
telling me that I cannot assign the pointer of my variable to a pointer
because it is not constant.
struct vars
{
char *vname;
double *var;
};
struct vars variables[]
= {
*drive,
*room,
*picture,
*house
};
and this does not work.
Endlisnis wrote:
>
> Are you saying you have a variable declared in your bison code like:
> int status;
>
> And when you parse the input file and find a line reading something like:
> status = 12
> you want to assign 12 to the status variable inside the parser?
>
> If so, there is no trivial way to do it, the easiest way I can think of is
> to make an array of structs containing strings and int pointers. Each time you
> find a VAR = exp, compare the string version of VAR to every entry in your array
> of structs, when you find the right struct, make an assinment to the pointer,
> and make sure to initialize the pointer to point to the correct variable.
>
> --
> (\/) Endlisnis (\/)
> s257m AT unb DOT ca
> Endlisnis AT HotMail DOT com
> ICQ: 32959047
- Raw text -