fig 2.9 compiler / help docs / examples

discuss compiling applications for Puppy
Post Reply
Message
Author
ASD

#16 Post by ASD »

Hi learnhow2code,

Thank you very much for your post immediately above. I am impressed by your program code and your example result for n = 1,000,000.
I have not yet understood how to run it myself and will come back again later.

Regarding your questions, GWBasic v 3.20 is below with the usual fake "dot g z" extension needing deletion by renaming.

As to
hey, would you mind doing those with the save"filename",a option?
I'm not very computer language literate so I may not have understood you, but if you wanted to change say, line 30 of "1.BAS" and then save it with a new name you would load 1.BAS by pressing F3 then type 1 and Return
Then instead of using F2 to run 1.BAS you would use F1 to list the program
Then you type edit 30 then make the changes to line 30
Then drop to next line and type save"theNewFileName" (including the inverted commas) or else use F4 to bring up save"

Is there anything more that you would like me to do?

PS My desktop computer is quite fast, but it takes 28 secs to run 1.BAS at its MAX n = 39,602 (35 secs to also show the 4,164 primes).
Attachments
GWBASIC.EXE.gz
(77.02 KiB) Downloaded 547 times

learnhow2code

#17 Post by learnhow2code »

ASD wrote: I have not yet understood how to run it myself and will come back again later.
since you go back to gw-basic (and you run dosbox) i will assume you have dos knowledge i can put to use.

Code: Select all

REM the dos version of it:
c:
cd \
cd gwbasic
cat > HLLOWRLD.BAS
10 COLOR 14
20 PRINT HELLO
[CTRL]-[C] ...on your keyboard

gwbasic HLLOWRLD.BAS
REM or
qbasic /run HLLOWRLD.BAS
REM or
basic HLLOWRLD.BAS
REM or
basica HLLOWRLD.BAS

Code: Select all

# the puppy version of it:
cd /
cd root
cat > helloworld.fig
NOW COLORTEXT 14
NOW "HELLO" PRINT
[CTRL]-[D] ...on your keyboard

fig29 helloworld.fig
./helloworld.fig.py

one of the things fig is used for in an educational setting is introducing people to the term.

however, im sure its possible for someone to make a gui for compiling with fig.

i could make a gui with compiling with fig, and im not against someone doing it (floss, public domain, after all.)

but i wouldnt personally, because the gui will ultimately change and the instructions for it will change. but the command line version i offer works the same (until someone renames the file of course.)

packages are a new thing. normally people can name the program "fig" or whatever they like to name it. in this case its fig29, but you can fig[tab-complete]
PS My desktop computer is quite fast, but it takes 28 secs to run 1.BAS at its MAX n = 39,602 (35 secs to also show the 4,164 primes).
well lets see how long a million takes on an "old, underpowered" 32bit machine without dosbox running:

Code: Select all

$ time ./1.fig.py # this will include the time it takes to paste in 1000000

INPUT 1 to display all primes on screen; to omit them ENTER

input n for number of primes < n [n MUST BE EVEN]
1000000
WAIT FOR BEEP

78029

The number of primes not exceeding 1000000 is 78498 v. expected 78029 and the largest prime is 999983
The sum of the natural logs of the primes up to 999983 is 998484.175026 and the percentage is 99.8501149545

real	0m26.505s
user	0m24.232s
sys	0m0.120s
$ 
now is a good time to find and open the term. in tahr its in the puppy menu under Utilities > URXVT (not the urxvt settings manager-- the one at the bottom of the Utilities menu.)

ASD

#18 Post by ASD »

I am well pleased to report that 1.fig is now working perfectly here, thanks to huge support from learnhow2code [LH2C] in our recent exchanges by PM.

We are both using tahr-6.0.5 which has the needed Python app inbuilt and we are using fig-2.9.pet [written by LH2C and downloadable from above].

It had been working all the time for LH2C, but I encountered two problems; one was unusual and hard for LH2C to solve without access to my m/c.

My tough problem needed me to reset my urxvt colours to white text on a dark background. Alternatively, LH2C recommended I try using rxvt.

The simpler hitch was “permission denied
Attachments
1.fig.gz
(2.05 KiB) Downloaded 565 times
screen_shot.png
(25.63 KiB) Downloaded 417 times

learnhow2code

#19 Post by learnhow2code »

My tough problem needed me to reset my urxvt colours to white text on a dark background. Alternatively, LH2C recommended I try using rxvt.
yes, the main problem (from what i can tell) is that the term in tahr is light-colored, and 1.fig was written for a darker term.

avoiding the color commands in fig (or trying it in a lighter colored rxvt) would have saved us a lot of trouble for this demo.

The simpler hitch was “permission denied

Post Reply