Re: Help me!

Date: Mon, 29 Aug 1994 16:16:26 -0500

From: "Dennis Gannon" <gannon@cs.indiana.edu>

To: mgolden@demon.eecs.umich.edu, sage-bugs@cica.indiana.edu

Subject: Re: Help me!

Hi Michael,
I have most recently looked and modified the declareAVar() code,
so it is best for me to respond. here is the problem:
you are using an old version of sage.
I took your code and ran it with the current version
(and i modified the line where you get the type so that
it does not do the true type (you don't want to do that here)
and the result is:
type = var_decl->symbol(0)->type();
when i run your example,
rainier:~/sage/Sage++/demos/global_ptr(119)> cat y.c
test()
{
int original1;
int *original2;
int (*original3)();
int original4();
}
rainier:~/sage/Sage++/demos/global_ptr(120)> a.out y.proj
Opening and initializing project : y.proj
Here are the files in y.proj :
y.c
Restructured code...
Unparsing to y.decls.c
rainier:~/sage/Sage++/demos/global_ptr(121)> cat y.decls.c
test(){
int original4_copy;
int (*original3_copy)();
int *original2_copy;
int original1_copy;
int original1;
int *original2;
int (*original3)();
int original4();
}
_____________________________
note that it *almost* works. you are correct,
there is still one bug. the problem is this:
int original4();
has become a variable instead of a function
prototype. one the other hand the others worked
fin because they are variables. declareAVar
is not inteded to work with function prototypes
and it should give you a warning instead of doing
what it does.
the problem with declaring function prototypes is that
they can have very complicated lists of arguments.
in the new version of the sage++ distribution there
is a demo program in Sage++/demos/new_file that
shows you the best way to make prototypes. there is
also some new documentation that describes this.
Let me know if you need help finding the new version.
(i don't think it is public yet, but it should be.)
d.