|
Post by Pjot on May 30, 2014 22:18:53 GMT 1
All,
The way the options for PRAGMA is being treated has changed slightly as of BaCon 3.0. The reason is that older Linux versions (for example Redhat 5.x) cannot accept C flags and linker flags at the same time on the same line.
Therefore, the program needs a slight change, as follows:
PRAGMA OPTIONS `pkg-config --cflags gtk+-2.0` PRAGMA LDFLAGS `pkg-config --libs gtk+-2.0` PRAGMA INCLUDE gtk-2.0/gtk/gtk.h ... <rest of program>
You'll have the same problem when compiling original C code in an older Linux version. The line `pkg-config --cflags --libs gtk+-2.0` simply does not work.
BR Peter
|
|
|
Post by packetteer on May 30, 2014 22:57:53 GMT 1
Hi Peter, vovchik Thank you both for all your help. It is greatly appreciated.
The Program now works with the Changes you described Peter.
Best Regards John
|
|
|
Post by Pjot on Aug 1, 2014 17:18:40 GMT 1
Folks, I had to come back to this promise: Well, it turns out to be more difficult than I thought. However, below a proof of concept to show M4 in its full glory BR Peter divert(-1)dnl # # Attempt to create a BASIC converter using M4. This should demonstrate the principle. # (c) PvE, August 2014 # # Run as: m4 basic.m4 <prog.bac> | indent # define(PRINT,`define(FORMAT,`divert(2) `,' divert(1)') divert(0) undivert printf( divert(4)); divert(3)') define(WHILE,`define(DO,`divert(0) undivert') divert(0) undivert while( divert(2)){ divert(1)') define(WEND,`divert(0) undivert }') define(LET,`divert(0) undivert divert(2); divert(1)') define(DECLARE,`divert(0) undivert long divert(2)=0; divert(1)') define(END,`divert(0) undivert return(0);}') define(REM,`divert(0) undivert dnl') define(ABS,((($1) < 0) ? -($1) : ($1)) ) define(TRUE,`1') define(FALSE,`0') divert(0)dnl #include <stdio.h> int main(int argc, char* argv[]){dnl
Simple demonstration BASIC program which can be converted: REM We must declare a variable DECLARE a
WHILE a < 10 DO PRINT "Hello" FORMAT "%s\n" LET a = a + 1 WEND
REM Testing the ABS function PRINT ABS(-5) FORMAT "%d\n"
PRINT "End\n"
END
|
|
|
Post by Pjot on Aug 3, 2014 4:19:25 GMT 1
All, So I worked a little bit more on the M4 stuff. It's pretty powerful I made a small page where the progress can be found. Right now, the implementation contains a very small subset of BaCon commands. BR Peter
|
|