The time now is Thu 19 Apr 2018, 12:16
All times are UTC - 4 |
Author |
Message |
MU

Joined: 24 Aug 2005 Posts: 13648 Location: Karlsruhe, Germany
|
Posted: Sat 16 Sep 2006, 13:06 Post subject:
PuppyBasic 2.6 (updated august, 06, 2008) Subject description: (programming language based on wxBasic) |
|
2 major changes from my side:
xwin_system() explained here:
http://wxbasic.sourceforge.net/phpBB2/viewtopic.php?t=992
So now like in the bash you can run
Code: |
mylist = xwin_system("ls /root")
for each folder in mylist
print folder
next
|
Or any other programs.
puppybasic -v works now (version-information).
And a new comandlineargument "-e" for "execute"
Now you can run
puppybasic -e 'print 2*4'
Or
puppybasic -e 'a=2:b=4:print a*b'
Minor changes:
added "cutleftfromright()" to basefunctions.inc
Added basefunctions2.inc, this is identical to basefunctions.inc, but also works if you use "option explicit" to create safer/cleaner code.
It is based on wxBasic 2.5.
Readme, source, binary:
http://noforum.de/files/wxbasic/PuppyBasic-2.5/
UPDATE 2.6:
http://www.murga-linux.com/puppy/viewtopic.php?p=220475#220475
Mark
Last edited by MU on Wed 06 Aug 2008, 04:48; edited 4 times in total
|
Back to top
|
|
 |
MU

Joined: 24 Aug 2005 Posts: 13648 Location: Karlsruhe, Germany
|
Posted: Sat 16 Sep 2006, 20:59 Post subject:
|
|
Updated the files, there was a small error with the returncodes (they were not divided by 256).
With the new version, you can use them for example to check, if a folder exists:
Code: | #!/usr/bin/puppybasic
//-- using stdout for a custom "input":
print "enter a foldername to test, if it exists:"
a,b = xwin_system("read a;echo $a")
//-- trim removes linefeeds
testfolder = trim(a[0])
//-- test if the folder exists by using the exitcode
a,b = xwin_system("if [ -d '" & testfolder & "' ];then exit 0;else exit 1;fi")
if b = 0 then
print "dir " & testfolder & " exists"
else
print "dir " & testfolder & " does not exist"
end if
|
This example shows the real name of the "home" folder:
Code: | #!/usr/bin/puppybasic
//-- find out homefolder
a,b = xwin_system("echo ~")
print "the homefolder is: " & trim(a[0])
|
Code: | #!/usr/bin/puppybasic
//------------------
//- using xmessage
//-- return Button-CODES
a,b = xwin_system("xmessage -center -buttons 'yes,no' 'choose a button'")
print "result from xmessage: " & b
//-- return Button-TEXT
a,b = xwin_system("xmessage -print -center -buttons 'yes,no' 'choose a button';echo $?")
print "result from xmessage: " & trim(a[0])
|
Mark
|
Back to top
|
|
 |
GuestToo
Puppy Master
Joined: 04 May 2005 Posts: 4078
|
Posted: Sat 16 Sep 2006, 23:25 Post subject:
|
|
that's useful ... an interface to the system shell
i think this is how i would do it:
cmd = "test -d '" & testfolder & "'"
a,b = xwin_system(cmd)
|
Back to top
|
|
 |
MU

Joined: 24 Aug 2005 Posts: 13648 Location: Karlsruhe, Germany
|
Posted: Sun 17 Sep 2006, 05:50 Post subject:
|
|
yes, that's a good way.
You could use the resulting exitcode to choose the resulting text from a list:
Code: | //-- a shorter way to test if a folder exists:
cmd = "test -d '" & testfolder & "'"
a,b = xwin_system(cmd)
dirchecktext = {}
dirchecktext[0] = " exists"
dirchecktext[1] = " does not exist"
print "the folder " & testfolder & dirchecktext[b] |
Mark
|
Back to top
|
|
 |
MU

Joined: 24 Aug 2005 Posts: 13648 Location: Karlsruhe, Germany
|
Posted: Sun 17 Sep 2006, 10:59 Post subject:
|
|
I updated the files.
The interpreter is unchanged, but I added "natsort" and "reducelist" to the basefunctions.inc
natsort:
newlist = natsort (oldlist)
if oldlist is
r t g T
then newlist is
g r T t
reducelist:
deletes double-entries that follow each other..
a a a f t
will become
a f t
You usually will run natsort or bubblesort first, then reducelist.
Here is a prototype of a quite fast dependency-checker using these functions:
http://dotpups.de/tests/PSI-dev/checkdep-standalone
run it like this:
checkdep-standalone Gimp-2.3.10-CVS-Gtk-2.8.files
Look in /root/.packages/ for existing ones.
It displays a gauge of the process
It is very fast, as it excludes files like ".png" ".txt" from the checks.
It works in PSI, bit is not finished yet (must add a check for existing libraries in gimp.files, too).
Mark
|
Back to top
|
|
 |
klhrevolutionist

Joined: 08 Jun 2005 Posts: 1124
|
Posted: Fri 06 Oct 2006, 11:53 Post subject:
|
|
Seeing as I cannot comprehend any of these languages out there.
I came across this http://easynews.dl.sourceforge.net/sourceforge/kidbasic/kidbasic-0.3.tar.gz
http://kidbasic.sourceforge.net/ - line-oriented language
I also saw something about gtkhtml. But it looks like it requires a bunch of gnome...
MU give me or us your thoughts on this please.
_________________ Heaven is on the way, until then let's get the truth out!
|
Back to top
|
|
 |
MU

Joined: 24 Aug 2005 Posts: 13648 Location: Karlsruhe, Germany
|
Posted: Fri 06 Oct 2006, 13:10 Post subject:
|
|
Kidbasic needs Qt4 (that will be the base for KDE4).
We don't have a dotpup yet.
But you can run the windows-version in Wine.
Gtkhtml: the current version heavily depends on Gnome, but I think there is an older library that works without gnome.
Liferea uses Gtkhtml:
http://www.murga.org/~puppy/viewtopic.php?t=10127
But Gtkhtml is not easy to program, it requires C-code.
Mark
|
Back to top
|
|
 |
MU

Joined: 24 Aug 2005 Posts: 13648 Location: Karlsruhe, Germany
|
Posted: Sat 02 Aug 2008, 15:43 Post subject:
|
|
Updated to PuppyBasic 2.6.
Changes:
- the file-fuctions had limitations.
Line input would read only 1024 characters, I extended this to 10240.
Also now 254 instead of 32 filehandles are supported.
- added 2 new functions to basefunctions.inc and asefunctions2.inc:
thelist = quicknatsort (thelist , startitem , lastitem)
thevalue = getargs("test")
This would return "fine", if you ran your program like this:
program --test fine
- I also cleaned up the dialog-functions, they no longer use temporary files.
And I added gtkdialog3() to run templates with gtkdialog 3.
- added the latest xwin_ functions from GtkBasic, that do not depend on Gtk.
I compiled it in Muppy007 (Puppy 2.12), because like this I could avoid unneeded dependencies (libxcb from Puppy3 or libpixmap from Puppy4).
Tested in Puppy 2, 3,4.
Download:
http://dotpups.de/dotpups/Programming/PuppyBasic-2.6.pet
mirror:
http://puppyfiles.ca/dotpupsde/dotpups/Programming/
source:
http://noforum.de/files/wxbasic/PuppyBasic-2.6/
Mark
_________________ my recommended links
|
Back to top
|
|
 |
MU

Joined: 24 Aug 2005 Posts: 13648 Location: Karlsruhe, Germany
|
Posted: Sun 03 Aug 2008, 11:55 Post subject:
|
|
updated the 2.6 pet and source.
There was a bug in using Xdialog, fixed it.
Mark
_________________ my recommended links
|
Back to top
|
|
 |
MU

Joined: 24 Aug 2005 Posts: 13648 Location: Karlsruhe, Germany
|
Posted: Wed 06 Aug 2008, 04:49 Post subject:
|
|
there was another bug with the new Xdialog code.
It did not work correct with erratic Gtk-Themes.
Updated Puppybasic 2.6 again.
Mark
_________________ my recommended links
|
Back to top
|
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|