According to Christian Bockermann:
Sorry, if this does not really fit to Pascal-related programming, but I think it fits to GPC !?
Perfectly. :)
I have a question to all the people working on the improvement of GPC : I want to insert a function of my own, written in C, into GPC. In which file do I have to put it ? For example if I want to insert a function of bpcompat direct into the compiler. Is there any way to do this ?
While one can easily fill books with this topic, here is a short description what to do:
* Locate your file in the `rts' subdirectory of the GPC source tree. (It may be written in C, Pascal, or any other GNU language, BTW.)
* Edit `rts/Makefile.in', so your file will be compiled and included into `libgpc.a', GPC's run-time library.
* In `util.c', add your routine to the `KItable'.
* In `parse.y', assign a token to your routine, make it `%type <ttype>', add it to `new_identifier_1', so the identifier remains redefinable, and - implement it. For this last point, look at an existing routine which is called in a similar way as yours (`Assign', for instance, is a good example).
* If your implementation in `parse.y' is through `rts_proc_parlist' or similar, the actual work will be done in `build_rts_call()'. So you will have to edit `rts.c' and to add your routine to the big `switch' statement in `build_rts_call()'. Depending on what you intend to implement, this can be quite easy or a nightmare. Again, look at an existing feature that is called in a similar way as yours.
* Everywhere within GPC you will have to deal with so-called "tree nodes". I have written a short introduction to those things and more - see the chapter "GPC source" of the GPC online documentation.
Good luck! If you succeed or have further questions, please let us know!
Peter
Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [971005] maintainer GNU Pascal [971001] - http://home.pages.de/~gnu-pascal/ [971005]