gtkbasic-0.0.2
Ok, I can ask my mum to send me instant coffee from germany
I updated:
http://dotpups.de/dotpups/Programming/Gtkbasic-002.pup
It now includes a *simple* IDE.
It might be unstable, I encountered Xlib-errors again, but more seldom now.
I however decided to release it, as it already might help to get started.
The IDE itself does not "save" files, it just uses leafpad and Glade.
So it is not so worse, if it should crash.
You currently can create new projects (a button or a calculator), run them, modify them, dotpup them.
Not much more yet, but I think for someone completely new it is hepfull to have everything available from one interface.
Here is a screenshot:
Limitations:
occasional crashes when the "new"-dialog opens.
The Textview crashes often, if the text you load contains ":".
For this reason I wrote a function as a workaround, that replaces ":" with "-->".
Very dirty, just to avoid crashes, until I found out what the heck is going on here.
Please see it still in Prototype-stadium, but now at least somewhat usable.
You can use xkill to delete crashed windows:
http://www.murga-linux.com/puppy/viewto ... ach&id=217
Mark
I updated:
http://dotpups.de/dotpups/Programming/Gtkbasic-002.pup
It now includes a *simple* IDE.
It might be unstable, I encountered Xlib-errors again, but more seldom now.
I however decided to release it, as it already might help to get started.
The IDE itself does not "save" files, it just uses leafpad and Glade.
So it is not so worse, if it should crash.
You currently can create new projects (a button or a calculator), run them, modify them, dotpup them.
Not much more yet, but I think for someone completely new it is hepfull to have everything available from one interface.
Here is a screenshot:
Limitations:
occasional crashes when the "new"-dialog opens.
The Textview crashes often, if the text you load contains ":".
For this reason I wrote a function as a workaround, that replaces ":" with "-->".
Very dirty, just to avoid crashes, until I found out what the heck is going on here.
Please see it still in Prototype-stadium, but now at least somewhat usable.
You can use xkill to delete crashed windows:
http://www.murga-linux.com/puppy/viewto ... ach&id=217
Mark
You need the pup and libglade.
I think libglade is already in the PuppIso, if not, install it with pupget.
The small dotpup includes everything you need, except the list of supported Gtk-functions.
That one is in the source-dotpup
http://noforum.de/files/wxbasic/gtkbasi ... source.tgz
The source-dotpup is a bit out of date, I'll upload a new one later.
I'm currently messing around with clists, so my sourcefolder is a bit unclean.
It is not required however, just for people who need that functionlist and want to hack the C code.
Mark
I think libglade is already in the PuppIso, if not, install it with pupget.
The small dotpup includes everything you need, except the list of supported Gtk-functions.
That one is in the source-dotpup
http://noforum.de/files/wxbasic/gtkbasi ... source.tgz
The source-dotpup is a bit out of date, I'll upload a new one later.
I'm currently messing around with clists, so my sourcefolder is a bit unclean.
It is not required however, just for people who need that functionlist and want to hack the C code.
Mark
Here is the first "stable" version.
I finally could fix the xlib-errors, my first fix was buggy.
Now you can use Gtkbasic to control space-stations
Ok, there still might be smaller bugs.
If I right-click the textview in the IDE, it crashes.
But that is not a Gtkbasic problem, but one of the widget or gins.
I made some quickchecks, and it should be fixable soon.
I also added a Clist-Demo.
Clists are lists with text (pictures come later).
You can drag entries from one list to another one.
The function-calls might change, as I plan to add more stuff.
But if you will use it already, just tell me, then I use different names for backwards-compatibility.
Here is a picture of 2 clists supporting Drag'n'Drop:
Download the dotpup with everything needed:
http://dotpups.de/dotpups/Programming/Gtkbasic-002.pup (158 kb)
Download source with functionslists, only for people who want to try more than available in the example-programs of the dotpup:
http://noforum.de/files/wxbasic/gtkbasi ... source.tgz (800 kb)
That is a snapshot not cleaned up (backups and such), so it is a bit huge.
Mark
I finally could fix the xlib-errors, my first fix was buggy.
Now you can use Gtkbasic to control space-stations
Ok, there still might be smaller bugs.
If I right-click the textview in the IDE, it crashes.
But that is not a Gtkbasic problem, but one of the widget or gins.
I made some quickchecks, and it should be fixable soon.
I also added a Clist-Demo.
Clists are lists with text (pictures come later).
You can drag entries from one list to another one.
The function-calls might change, as I plan to add more stuff.
But if you will use it already, just tell me, then I use different names for backwards-compatibility.
Here is a picture of 2 clists supporting Drag'n'Drop:
Download the dotpup with everything needed:
http://dotpups.de/dotpups/Programming/Gtkbasic-002.pup (158 kb)
Download source with functionslists, only for people who want to try more than available in the example-programs of the dotpup:
http://noforum.de/files/wxbasic/gtkbasi ... source.tgz (800 kb)
That is a snapshot not cleaned up (backups and such), so it is a bit huge.
Mark
Mark,
I believe this may be what I have been looking for, a small linux basic language with a GUI designer that can produce attractive, advanced applications. Now maybe I can dump wxLua!
From what I understand GtkBasic is based on wxBasic, correct? Does GtkBasic support all of the wxBasic data types and language features listed at http://noforum.de/wxBasicscript-documen ... ameset.htm ? I'm also a little confused about when to use the gins functions verses the Gtk functions. I looked at gtkfunctions.txt and ginsfunctions.txt and they seem almost identical. So which ones would you recommend that we use?
Cheers,
Komodo
I believe this may be what I have been looking for, a small linux basic language with a GUI designer that can produce attractive, advanced applications. Now maybe I can dump wxLua!
From what I understand GtkBasic is based on wxBasic, correct? Does GtkBasic support all of the wxBasic data types and language features listed at http://noforum.de/wxBasicscript-documen ... ameset.htm ? I'm also a little confused about when to use the gins functions verses the Gtk functions. I looked at gtkfunctions.txt and ginsfunctions.txt and they seem almost identical. So which ones would you recommend that we use?
Cheers,
Komodo
Yes.Does GtkBasic support all of the wxBasic data types and language features listed at http://noforum.de/wxBasicscript-documen ... ameset.htm ?
Also all Puppybasic-programs should run with it.
gtkfunctions.txt is a file generated by my buildscript.
It then is used to generate ginsfunctions.txt.
So that one lists the supported Gtk-functions, though some still might not work. This currently requires trial and error, until my scripts become more intelligent.
ginsfuntions.txt lists a few less, as it does not list those functions my script had to drop because of typeconversion-problems.
Now that the clists work, I hope I soon can add a list of inbuilt functions to the IDE
Please be aware, that Gtkbasic is a new project, and far not as functional yet as wxLua.
You can build small wizards with it, so it often could be used as an alternative to Gtkdialog or Xdialog,
But wxLua supports a lot more widgets you need to build advanced window-layouts.
The Demos I include give a quick overview, of what currently can be done with Gtkbasic.
However, now that I got it working stable, I can concentrate again on adding more widgets and functions
This bug-search was very timeconsuming.
Mark
Hi Mark,
Even though it's still early this looks like it could be really useful. One maybe bug, sometimes I find I have to press buttons twice to make them work, or maybe hold down a bit longer on the click, I'm not sure.
Also can you tell me where to find libglade, the Glade button in the IDE doesn't seem to work and I couldn't find it in petget package manager.
One last question, is there a way to run C functions from a compiled lib?
Thanks in advance. David
Even though it's still early this looks like it could be really useful. One maybe bug, sometimes I find I have to press buttons twice to make them work, or maybe hold down a bit longer on the click, I'm not sure.
Also can you tell me where to find libglade, the Glade button in the IDE doesn't seem to work and I couldn't find it in petget package manager.
One last question, is there a way to run C functions from a compiled lib?
Thanks in advance. David
I also mad a dotpup once:
http://puppyfiles.org/dotpupsde/dotpups ... -3.0.3.pup
I think it includes Glade and all required libs.
I think I renamed glade to glade3 , so you might rename it to glade.
Concerning own functions:
You cannot run functions from external .so or .dll files, as they have no interfaces in wxBasic (Gtkbasic is based on wxBasic).
But you can add own functions to Gtkbasic, if you are a bit common with C.
Look at builtin.h in the sourcepackage, I'll explain it using a function I added in the past.
A function is declared by 2 lines:
and
The "1" means, that this function expects 1 argument.
"xwin" is an extension I once wrote, similar to the Gtk extension.
Now where is the code for this function?
in main.c you find:
#include "xwin.c"
So that file has my function.
Lets look at it:
Confused?
I'll explain it.
wxBasic internally uses variant as datatype. Variant allows to use variables without declaration, so they can be int, char or others.
In C you had to declare
char mystring[1024];
int mynumber;
In Basic you just do:
myvariable = "test"
or
myvariable = 1 + 4
When a Basic-function passes an argument to C, it is a variant lying on a stack.
So you do not pass it as it usually is done in C, like
Instead you pass nothing directly to the function, but get the argument later.
So we must get it from there with this inbuilt function of the interpreter:
variant = wStackPopString();
As C does not know variant, we then must convert it to a standard C type.
wStringChar( variant )
It is used in a typical C function, that in this case runs the command(program) passed as argument using popen(), and then returns the result.
This result can have several lines (for example if you run "ls").
So the resulting lines then are converted to a wxBasic table/list and returned to wxBasic.
xwin.c is rather old, it were my first serious attempts to program C.
In gins.c , I meanwhile have added some more functions that simplify the use of variants, like
and
If you added own functions, run
make&&make install
to compile your own Basic-interpreter
Mark
http://puppyfiles.org/dotpupsde/dotpups ... -3.0.3.pup
I think it includes Glade and all required libs.
I think I renamed glade to glade3 , so you might rename it to glade.
Concerning own functions:
You cannot run functions from external .so or .dll files, as they have no interfaces in wxBasic (Gtkbasic is based on wxBasic).
But you can add own functions to Gtkbasic, if you are a bit common with C.
Look at builtin.h in the sourcepackage, I'll explain it using a function I added in the past.
A function is declared by 2 lines:
Code: Select all
void wBuiltin_xwin_system(void);
Code: Select all
{"xwin_system", wBuiltin_xwin_system, 1, 0},
"xwin" is an extension I once wrote, similar to the Gtk extension.
Now where is the code for this function?
in main.c you find:
#include "xwin.c"
So that file has my function.
Lets look at it:
Code: Select all
void wBuiltin_xwin_system()
{
wVariant *variant;
variant = (wVariant *)wMalloc( sizeof( wVariant ) );
variant = wStackPopString();
char bufline[10240];
char mystring[1000];
wVariant *mylist;
wVariant *myvariant;
wVariant *mykey;
int c=0;
myvariant = (wVariant *)wMalloc( sizeof( wVariant ) );
mylist = (wVariant *)wMalloc( sizeof( wVariant ) );
wTableNew(mylist);
mykey = (wVariant *)wMalloc( sizeof( wVariant ) );
FILE *fp;
int status;
fp = popen(wStringChar( variant ), "r");
if (fp == NULL){
return;
}
while (!feof(fp)){
fgets(bufline,10240,fp);
//-- create a key
sprintf( mystring,"%d" , c );
wVariantFromChar( mykey, mystring ,3,3 );
//-- create a string
wVariantFromChar( myvariant, bufline ,4,4 );
//-- append it to the list
wTableInsert(mylist , mykey, myvariant );
c++;
}
status = pclose(fp);
if (c>0){
wTableRemove(mylist , mykey );
}
//-- return the wList to wxBasic
wVariantMove( wStackPushNothing(), mylist );
sprintf( mystring,"%d" , status/256 );
wVariantFromChar( mykey, mystring ,3,3 );
wVariantMove( wStackPushNothing(), mykey );
//-- cleanup
wVariantDeref( myvariant );
wFree(myvariant);
wVariantDeref( mylist );
wFree(mylist);
wVariantDeref( mykey );
wFree(mykey);
return;
}
I'll explain it.
wxBasic internally uses variant as datatype. Variant allows to use variables without declaration, so they can be int, char or others.
In C you had to declare
char mystring[1024];
int mynumber;
In Basic you just do:
myvariable = "test"
or
myvariable = 1 + 4
When a Basic-function passes an argument to C, it is a variant lying on a stack.
So you do not pass it as it usually is done in C, like
Code: Select all
void myfunction ( char *argument){
So we must get it from there with this inbuilt function of the interpreter:
variant = wStackPopString();
As C does not know variant, we then must convert it to a standard C type.
wStringChar( variant )
It is used in a typical C function, that in this case runs the command(program) passed as argument using popen(), and then returns the result.
This result can have several lines (for example if you run "ls").
So the resulting lines then are converted to a wxBasic table/list and returned to wxBasic.
xwin.c is rather old, it were my first serious attempts to program C.
In gins.c , I meanwhile have added some more functions that simplify the use of variants, like
Code: Select all
//-- gets an argument from the wxBasic stack and returns it as string --
gchar *getstringarg(){
Code: Select all
//-- return a string to wxBasic
void returnstring(char *thestring){
make&&make install
to compile your own Basic-interpreter
Mark
Last edited by MU on Tue 26 Jun 2007, 18:43, edited 1 time in total.
That probably wont happen this weekend but I reckon the source of wxDllLoader class should have most of the clues I need, and it shouldn't really be that difficult. Ideally you would use it the same as in VB with 'Declare' reserved word...
Declare FunctionX(Y as CString, Z as Long) in LibraryPathA.
DB
Declare FunctionX(Y as CString, Z as Long) in LibraryPathA.
DB
no need to hurry
I develop Gtkbasic on weekends, and beside that I want to discover the new region where I live now.
I think in 1-2 month Gtkbasic is so far, that it could serve for many tasks already (small wizards and such as you already have them in Puppy).
But it will be still far away from being a full featured programming language.
I estimate about a year until it *might* cover most of the full set of Gtk functions.
If I fall in love or leave germany (what I seriously think of), it might take even longer.
Mark
I develop Gtkbasic on weekends, and beside that I want to discover the new region where I live now.
I think in 1-2 month Gtkbasic is so far, that it could serve for many tasks already (small wizards and such as you already have them in Puppy).
But it will be still far away from being a full featured programming language.
I estimate about a year until it *might* cover most of the full set of Gtk functions.
If I fall in love or leave germany (what I seriously think of), it might take even longer.
Mark
Hi Mark, saw in another post you were thinking about England. I prefer France myself but live in the antipodes like BarryK so they are both a long way off.
Just curious, what do you use for a development environment? I'm still new to linux still trying to find a nice set up ... well two really, a heavy duty one for C++, and another for simple things (which is the reason for my interest in Gtkbasic). A working debugger for both is very desirable.
DB
Just curious, what do you use for a development environment? I'm still new to linux still trying to find a nice set up ... well two really, a heavy duty one for C++, and another for simple things (which is the reason for my interest in Gtkbasic). A working debugger for both is very desirable.
DB