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 Tue 21 Oct 2014, 07:13
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
BaCon - Bash-based Basic-to-C converter/compiler
Post new topic   Reply to topic View previous topic :: View next topic
Page 24 of 36 [526 Posts]   Goto page: Previous 1, 2, 3, ..., 22, 23, 24, 25, 26, ..., 34, 35, 36 Next
Author Message
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Sun 25 Sep 2011, 01:48    Post subject:  

updated so you can compile most apps from inside the geany GUI
updated Nov-5-2011 for HUG highlighting and upx compression
this is a "hack" going for geany syntax highlighting with BaCon!

geany fix with rxvt_hold
http://www.puppy2.org/slaxer/geany_bacon-2-1_SLXR.tgz

upx compression
http://www.puppy2.org/slaxer/upx-3.07-i386_linux-1_SLXR.tgz

note in geany I had to recycle the build button
so after you compile the app you click on build
which build now uses upx to compress your already compiled bin


then open geany with any *.bac and select
Document -->Set Filetype-->Programming Languages-->FreeBasic source file


just install the package
and upx
and you get the BaCon commands highlighted !

I cant use gtksourceview with my gtk version so this is how to get
another GUI going


*since FreeBasic was compiled in the GUI as an option that was used
later when all the commands are added and tested Bacon would be used and compiled into geany the right way

if we keep at we could get an official bacon filetype someday it can be done



----------------------------------------------------------------------------
as a side note

*you can also call the rxvt_hold script for other apps too
like this

Code:
 rxvt_hold ls -1   



you could change the "ls -1" for any command you want to run
it works for keeping rxvt or urxvt open after the command is executed
geany-compile-bacon.png
 Description   
 Filesize   66.05 KB
 Viewed   1037 Time(s)

geany-compile-bacon.png


_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though

Last edited by big_bass on Sun 06 Nov 2011, 16:09; edited 21 times in total
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5037
Location: Arizona, U.S.A.

PostPosted: Sun 25 Sep 2011, 02:15    Post subject:  

big_bass; I had to set the Programming Language to: FreeBasic

Click: Document > Set Filetype > Programming Languages > FreeBasic source file

I was surprised I didn`t have to add ".bac;" to the file: filetype_extensions.conf
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Sun 25 Sep 2011, 10:22    Post subject:  

Hey sunburnt
thanks for confirming that
I had that in my first post viewtopic.php?t=48901&sort=author&start=73
but thought it wasnt needed with the new changes I made

I'll update the above post
Quote:

I was surprised I didn`t have to add ".bac;" to the file: filetype_extensions.conf


thats for when you click on any source program with the *.bac
it opens automatically with geany

*its nice to know that parts of geany are scriptable without having to
hack it and recompile it to test if it works or not


thanks
Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Sun 25 Sep 2011, 16:17    Post subject:  

Dear Joe,

Although bacongui works on my system, I prefer your method with geany and the modded filetypes.freebasic. I guess I am just used to geany, and the syntax highlighting works perfectly.

Thanks.

With kind regards,
vovchik
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Sun 25 Sep 2011, 18:45    Post subject:  

Hey vovchik

thanks for the comments
I updated the post above to fix it so it now compiles
files that have INCLUDES Very Happy

I also added a little terminal so the user can see the
progress while it compiles in geany

there is a script called rxvt_hold
that goes in /usr/sbin the ( app depends on it)

*you can also call that script for other apps too
as a side note like this
Code:
 rxvt_hold ls -1   


you could change the "ls -1" for any command you want to run
it works for keeping rxvt or urxvt open after the command is executed

Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5037
Location: Arizona, U.S.A.

PostPosted: Mon 26 Sep 2011, 00:55    Post subject:  

big_bass; Now you need to add HUG highlighting and it`ll be complete!

I still think API libraries should be made of all this stuff, there`s lots of it !
I wrote shell libraries for dealing with files, file systems, lists, gtkDialog, etc.

But written in Bacon and compiled they can become far more useful.
Especially to Bacon as it`s so limited by the standard Basic language.
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Mon 26 Sep 2011, 11:31    Post subject:  

sunburnt
Quote:
Now you need to add HUG high lighting and it`ll be complete


great idea
thanks
its now added in the above post

*Hey guys if you find a missing command let me know
It will be added


Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5037
Location: Arizona, U.S.A.

PostPosted: Thu 29 Sep 2011, 08:20    Post subject:  

Problem with an associative array: SEGMENTATION FAULT array out of bounds?

Array gives out correct data, clicking a button and calling a sub gets error.
But the button`s ID array is a std. array, not the associative array.
Sub called has widget_ passed to it: SUB btnCLK(int widget_)

Put the files in: "/tmp/apps.sq"
Compile: "sqApps.mnu.bac" and run in rxvt.
Click Menu button and menu Item and it errors calling sub.

It never even makes it to the SYSTEM command, line #65.

Print command shows the associative array is properly filled.

If it finally runs properly, it`ll error because there`s no Squash App. file.
AssociativeArrayError.zip
Description  Make dir.: /tmp/apps.sq , copy file to it and unzip it.
zip

 Download 
Filename  AssociativeArrayError.zip 
Filesize  1.34 KB 
Downloaded  276 Time(s) 
Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Thu 29 Sep 2011, 13:06    Post subject:  

Terry,
Code:
CALLBACK(btnIDs_[i], "btnCLK")
Nix the quotes Razz
Code:
CALLBACK(btnIDs_[i], btnCLK)


(interesting code, by the way Idea )

rod

(IMHO)There doesn't seem to be an exact correlation between button geometry and window geometry in HUG.
Most of the time it doesn't mater, but you're trying to keep this widget compact.
Did this to fit all the buttons vertically in the widget, with a slight visual
spacing between buttons. It may need more fudging when more buttons
are present; but it's a good start.
Code:
'added to variable presets
btnSpc = 2
btnY = btnH + btnSpc
...
'mod'ed these two lines
btnY = btnY + btnH + btnSpc
winH = winH_0 + ( (btnH + (btnSpc * 2)) * btnCNT ) + btnSpc

...
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5037
Location: Arizona, U.S.A.

PostPosted: Thu 29 Sep 2011, 13:37    Post subject:  

L.O.L. _ _ _ Late night coding, a real quality producer...
The compiler could be better sometimes, but it can`t out-guess dumb!

I`ll look at your spacing to see it`s visual appeal, any other ideas?

Maybe Puppy has a new pop-menu, with sub menus when I get it added.

Thanks Rod ( the GatorDog )
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5037
Location: Arizona, U.S.A.

PostPosted: Thu 29 Sep 2011, 19:21    Post subject:  

EXEC keeps giving me grief no matter how I try to use it.
What`s wrong with this? ......... Get options from args.
Code:
FOR i = 2 TO 5
   Opt$ = CHOP$(EXEC$("echo", ARGUMENT$, "|cut -d'-' -f", i))
'   IF Opt$ = "" THEN BREAK

PRINT Opt$

NEXT

"echo ....." works from the shell, but not here. Empty output lines.
Tried CONCAT$ also, looks like EXEC$ only sees "echo".

I spent hours trying to get INSTRREV to work, it will not with MID$ !
I got INSTR to work, but decided to take my own advice and do it in the shell.
Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Thu 29 Sep 2011, 23:25    Post subject:  

Code:
Opt$ = CHOP$(EXEC$("echo", ARGUMENT$, "|cut -d'-' -f", i))

You just insist on hittin' your thumb with a hammer Razz
EXEC$ is seeing 3 strings and a number. 3 strikes you're out.

Code:
Cmd$ = CONCAT$("echo ", ARGUMENT$, "|cut -d'-' -f", STR$(i))
Opt$ = CHOP$(EXEC$(Cmd$))


-----------------------------------------
However, this may serve you better
Code:
SPLIT ARGUMENT$ BY " -" TO Arg$ SIZE Arg_count

That'll give you all the command line arguments.
Arg$[0] is the command/program name
Arg_count gives the number of arguments
Then you can pick them off one-by-one Arg$[1] Arg$[2] ....Arg$[Arg_count]

Note that I used a "space dash" ( " -" ) in the SPLIT as the seperator.
That should preclude a trailing space on the Arg$[] variables.

The Arg$[] number is affected by the use of OPTION BASE 1; adjust accordingly. Wink

rod

By the way, I didn't actually test any of that. Ye pays yer money and ye takes yer chances! RRR...
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5037
Location: Arizona, U.S.A.

PostPosted: Fri 30 Sep 2011, 02:46    Post subject:  

Your code works of course... But the Bacon docs are wrong... >Sad

Also the command "FILETYPE" doesn`t correctly report a sym. link as "6".
It says it`s a "1", a Regular file. I thought it was reporting the file the link points to.
But I made a link pointing to a link and it still reports it as "1", a Regular file.
Seems "FILETYPE" can`t be relied on for sym. links at least.
Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Fri 30 Sep 2011, 11:29    Post subject:  

Quote:
Also the command "FILETYPE" doesn`t correctly report a sym. link as "6".
It says it`s a "1", a Regular file. I thought it was reporting the file the link points to.

This is probably something to address in the Bacon Forum. Either to be explained or
if it's a bug, then to be dealt with.

GatorDog
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5037
Location: Arizona, U.S.A.

PostPosted: Sat 01 Oct 2011, 17:47    Post subject:  

Hey big_bass; The Geany syntax highlighting is great!

Problem with Geany... The filetypes.freebasic selection in Document doesn`t stay that way.

Not a problem with your mod. I know, but I`m sure there`s a simple fix.
Thanks for the help... Terry
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 24 of 36 [526 Posts]   Goto page: Previous 1, 2, 3, ..., 22, 23, 24, 25, 26, ..., 34, 35, 36 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

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
[ Time: 0.0945s ][ Queries: 12 (0.0096s) ][ GZIP on ]