|
Post by alexfish on Dec 7, 2014 16:31:29 GMT 1
Hi Peter
Can U test this version of FOR loop
define(FOR,`_FC undefine(`TO')pushdef(`_FC',`) popdef(`_FC') ') _FA(') define(_FA,` for(substr($@,0,eval(index(`$@',`TO')-2)) ; substr($@,0,index($@,=)) ifelse(eval(regexp(substr($@,eval(index($@,STEP)+4), eval(len($@)eval(- eval( 4+ index($@,STEP))))), `[-]')>0),1,>=,<=) substr($@,eval(2+index($@,TO)),eval(eval(index($@,STEP) eval(-eval(2+index($@,TO)))))) ; substr($@,0,index($@,=))+=substr($@,eval( 4+ index($@,STEP)),eval(len($@)eval(- eval( 4+ index($@,STEP))))) ) {')
BR Alex
Update; from my side the for loop looking good
now looking at the open file , as regards the POP FOR define(OPEN,`_FC pushdef(`FOR',`divert(3),') define(AS,`popdef(`FOR') divert(1)') divert(4)); divert(2)=fopen(')
|
|
|
Post by Pjot on Dec 8, 2014 20:27:10 GMT 1
Hi Alex, Well I am afraid your nightmarish piece of M4 code doesn't work well with the hello program: It's not going to be easy... BR Peter
|
|
|
Post by alexfish on Dec 8, 2014 20:56:00 GMT 1
Hi Peter
The For works if certain declares are at the head of code as per normal c layout
I mentioned this in earlier thread that in some instances the can be a displacement of the " ; " this is prior to the attempt of the for loop
as far as the m4basic have allowed for include , have also pushed some of the headers to divert 0 , upto now nothing showing
also think it be important to allow for the includes so the declares can have a Global scope.
I am still testing this , when done I will post the modded m4basic + the code for testing.
BR Alex
ADDED
did a simple test of
STRING ad,ab,ac INTEGER t
this will produce an err where the return from main is : IE the bottom wrapper code is missing
if do code like this
STRING ad,ab,ac INTEGER t DECLARE s TYPE char*
the the code compiles
hope can see what I mean
|
|
|
Post by alexfish on Dec 9, 2014 2:07:42 GMT 1
Hi Peter this is what is compiling using the forloop - the m4basic.m4 doing inside is hello2 exec , the m4 hello2.m4 think that matches the your hello + the c code. next archive is the modded m4 code BR Alex Attachments:testing.tar.bz2 (9.16 KB)
basic.m4.tar.bz2 (2.91 KB)
|
|
|
Post by alexfish on Dec 27, 2014 20:40:47 GMT 1
Hi all
thought would give gtk a try , here using same convention as used in proto scheme without the gtk Header file
IE get out of the Header calling conventions, did try glade + builder with the header files and getting weird results . IE in best part did not work ?! this method works with both. I think says he.
the following will not work in the editor so
use the m4basic from the command line
BR Alex
REM convert using m4basic from the terminal REM compile as gtk2 cc -g -o gtkdem gtkdem.c -lm -lgc `pkg-config --cflags --libs gtk+-2.0` REM compile as gtk3 cc -g -o gtkdem gtkdem.c -lm -lgc `pkg-config --cflags --libs gtk+-3.0` REM this type call also works with Glade files + gtk builder CONST GTK_WINDOW_TOPLEVEL = 0 DECLARE win, layout, but ,stock_but TYPE long
SUB exit_prog() PRINT "Bye" NL CALL gtk_main_quit() ENDSUB
SUB set_text () PRINT "but clicked" NL CALL gtk_button_set_label(but,"Clicked") ENDSUB
CALL gtk_init(0, 0)
LET win = gtk_window_new(GTK_WINDOW_TOPLEVEL) CALL gtk_window_set_title(win,"Test win") CALL gtk_widget_set_size_request(win,400,400) CALL g_signal_connect_data (win, "delete-event", exit_prog, 0, 0, 0)
LET layout=gtk_layout_new() CALL gtk_container_add(win,layout)
LET but=gtk_button_new_with_mnemonic("Button 1") CALL gtk_layout_put(layout,but,5,5) CALL gtk_widget_set_size_request(but,150,20) CALL g_signal_connect_data (but, "clicked", set_text, 0, 0, 0)
LET stock_but= gtk_button_new_from_stock("gtk-quit") CALL gtk_layout_put(layout,stock_but,300,350) CALL gtk_widget_set_size_request(stock_but,80,20) CALL g_signal_connect_data (stock_but, "clicked", exit_prog, 0, 0, 0)
CALL gtk_widget_show_all(win) CALL gtk_main()
|
|
|
Post by alexfish on Nov 22, 2022 13:13:44 GMT 1
BUMP
|
|