Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 21 Sep 2014, 14:12
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Unsorted
PuppyBasic 2.6 (updated august, 06, 2008)
Moderators: deshlab, Flash, GuestToo, Ian, JohnMurga, Lobster
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Sat 16 Sep 2006, 13:06    Post_subject:  PuppyBasic 2.6 (updated august, 06, 2008)
Sub_title: (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

Edited_times_total
Back to top
View user's profile Send_private_message Visit_website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: 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
View user's profile Send_private_message Visit_website 
GuestToo
Puppy Master

Joined: 04 May 2005
Posts: 4078

PostPosted: 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
View user's profile Send_private_message 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: 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
View user's profile Send_private_message Visit_website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: 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 Cool

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
View user's profile Send_private_message Visit_website 
klhrevolutionist


Joined: 08 Jun 2005
Posts: 1124

PostPosted: 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
View user's profile Send_private_message 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: 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
View user's profile Send_private_message Visit_website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: 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
View user's profile Send_private_message Visit_website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: 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
View user's profile Send_private_message Visit_website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: 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
View user's profile Send_private_message Visit_website 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Unsorted
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0913s ][ Queries: 12 (0.0275s) ][ GZIP on ]