No one seems to be responding to vovchik`s thread, so I`ll risk double posting here...

I`m writing a function file to do file I/O for text and arrays.

Strange problem with writing an array to a file.

Code:

SUB OUTARRAY(STRING Txt$[Size], int Size)
OPEN File$ FOR WRITING AS file
FOR i = 0 TO Size-1
WRITELN Txt$[i] TO file
NEXT
CLOSE FILE file
END SUB

Error is: Cause: 'Size' undeclared here (not in a function)
It looks like the Size needs to be a literal declaration.
If so, then passing an array to a SUB can`t be done.

To use a global array not a passed one, limits the usefulness of the function.

The Bacon docs say the array dimension isn`t needed to pass it to a SUB.
But that errors saying:
ERROR: cannot pass string array without dimension at line 54 in file 'test_FileIO.bac'!
So you can pass a numerical array without a dimension, but not a string array?
If that`s the case, then the Bacon docs should mention that little detail...
.

I downloaded and compiled BaCon, and am able to compile and run the examples from the web page using Geany.

But when I try to compile Bacongui, it fails, maybe because the version of Bash is 3.0 and it needs 4? There is a Pet for 4, I installed it, but it says the executable is named to Bash4. Am I going to have to change stuff around?

Thanks for any help you can give ...

Damn I hate being such a noob. I tried all this awhile back in Wary and ended up giving up after breaking a bunch of stuff trying to change and install things, when I had to concentrate on work. Decided I'd be better off waiting for a newer Puppy to try to use for Bacon programming.

Yep, Bash-4 is required to compile any newer BaCon files.
I had to patch Puppy-5.4.X.5 and it`s new enough that it should have had 4.!

# Q: What kinds of things are you working/planning on for BaCon?

I`m working on a enhancement that will load/copy SUB/FUNCs to any level.
So SUB/FUNC dependencies can be chained allowing truly reusable code.
SUB/FUNCs currently are only 1 level deep and 1 raw code file beyond that.
So SUB/FUNC libraries will be able to use anyone`s libraries, on and on, etc.

It then writes the HUG INCLUDE and INIT lines, so this is automated,
This is needed as SUBs and FUNCs. can contain HUG widgets.
Then runs bacon on the file to convert and compile it in the normal manner.

Yep, Bash-4 is required to compile any newer BaCon files.
I had to patch Puppy-5.4.X.5 and it`s new enough that it should have had 4.!

# Q: What kinds of things are you working/planning on for BaCon?

I`m working on a enhancement that will load/copy SUB/FUNCs to any level.
So SUB/FUNC dependencies can be chained allowing truly reusable code.
SUB/FUNCs currently are only 1 level deep and 1 raw code file beyond that.
So SUB/FUNC libraries will be able to use anyone`s libraries, on and on, etc.

It then writes the HUG INCLUDE and INIT lines, so this is automated,
This is needed as SUBs and FUNCs. can contain HUG widgets.
Then runs bacon on the file to convert and compile it in the normal manner.

sunburnt,

It is a very rare occasion that I would find out something before you had a chance to..... I'll try to make sure it won't happen again (that will not be difficult)

I didn't bother to install bash4, I just have the bash4 binary and run "#bash4 bacon.bash bacon.bac" which produces the bacon binary which works just fine in bash 3.

I don't really have anything particular in mind for bacon (perhaps because almost everything that crosses my mind is more in the "tool" category which seems just about as quick in bash as being compiled)

Your work in Bacon sounds interesting and I'll have to check out what you're doing over at the Bacon forum.

Ok, it looks like it has to compile from bacon.bash using bash 4 or bash above 3.

Attached is the Bacon-2.1.2 binary below, in case anyone would like it.

Bacongui still starts slowly first time.

Cheers,
s

Thank you for that. I downloaded and extracted it, then renamed the file that was in /usr/bin and copied the new one there. When I try to compile bacongui.bac

I get the same error.

Dunno what I'm doing wrong. Also on searching, I see there is a file for (older?) bacongui already there. The reason I was trying to compile it in the first place was because I didn't know it was there, hehe. If there is a launcher for it somewhere in Racy's menu system I didn't find it. LOL.

Ok, it looks like it has to compile from bacon.bash using bash 4 or bash above 3.

Attached is the Bacon-2.1.2 binary below, in case anyone would like it.

Bacongui still starts slowly first time.

Cheers,
s

Thank you for that. I downloaded and extracted it, then renamed the file that was in /usr/bin and copied the new one there. When I try to compile bacongui.bac

I get the same error.

Dunno what I'm doing wrong. Also on searching, I see there is a file for (older?) bacongui already there. The reason I was trying to compile it in the first place was because I didn't know it was there, hehe. If there is a launcher for it somewhere in Racy's menu system I didn't find it. LOL.

--97T--

NinerSevenTango,

Well, I'm not sure why that happened, but here's a copy of the 2.1.2-bacongui.

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum