Posting here so everyone can view. The Emergence BASIC compiler for Linux is the furthest along so that is the one that is included in the preview version. It is very "raw" right now, meaning you have the choice of using it from the command line or from an IDE like anjunta which I have been doing.
First step is to extract the files from the eb_linux archive.
After downloading the .zip and extracting:
Copy ebparse and ebstd.incc into your /usr/bin directory
Copy libebasic.a into the /usr/lib directory
Change the ownership of ebparse and libebasic.a to root and make ebparse executable.
Then you will need the following packages (list to be adjusted as necessary)
binutils
nasm
libgtk2.0-0
libc6-dev
libgtk2.0-dev
libgtk2.0-doc (optional)
You probably have some/most of them already installed by default. Check the synaptic package manager (or use apt-get) to verify. The dependancies of libgtk2.0 will bring in anything else needed.
the compiler under linux works a bit differently than under windows. Assembling is no longer a separate step and the parser calls nasm directly to create an object file ready to be linked. After you have everything installed there are two steps to compile an .eba file namely #1 creating the object file, #2 linking into an executable.
For example if you have a directory named ebasic_test_programs under your home directory, and a program you want to compile named test.eba the procedure may look like this:
cd ebasic_test_programs
ebparse "test.eba" "test.o"
ld -lc -lgtk-x11-2.0 -o "test" "test.o" /usr/lib/libebasic.a --dynamic-linker /lib/ld-linux.so.2
And you would run the program by typing:
./test
The "ld" line might look a little scary at first, stick it in a batch file to make it easier, or set up a third party IDE. Broken down it means:
ld {invoke the linker)
-lc {link against the C runtime}
-lgtk-x11-2.0 {link against the GTK2 library}
-o "test" {create the exectuable named 'test'}
"test.o" {input file}
/usr/lib/libebasic.a {input file}
--dynamic-linker /lib/ld-linux.so.2 {the dynamic loader to use for shared libraries}
For a simple shell program you can, in most cases, omit the gtk-x11-2.0 line, it doesn't hurt to leave it in of course, and won't make your executable any larger if your only using shell I/O. I recommend just leaving it in.
Now a test program to make sure your installation is working:
Save as keno.eba
'keno example program for Emergence BASIC Linux
'Green = selected, yellow = miss, red = hit
'the balls are represented in an integer array
'values for the array are:
'0 = not selected, 1 = selected, 2 = hit, 3 = miss
'Compile as a WINDOWS target
extern _argc as int
extern _argv as pointer
declare cdecl extern gtk_init(argc as pointer,argv as pointer)
declare cdecl extern gtk_main()
declare cdecl extern gtk_main_quit()
$main
gtk_init(&_argc,&_argv)
DEF playwin:window
DEF l,t,w,h,x,y,num,selectcount,picked,hitcount:int
DEF balls[80]:int
DEF pay[10,10]:int
DEF bet:int
DEF credits:int
bet = 1
credits = 100
DEF selected,hit,colorball,miss,cacheDC:int
DEF strball,strstat:STRING
DECLARE selectball(mx:int,my:int)
'The balls colors
selected = RGB(0,255,0)
hit = RGB(255,0,0)
miss = RGB(255,255,0)
'load the paytable
for x=0 to 9
for y=0 to 9
getdata paytable,h
pay[x,y] = h
next y
next x
'the play window
OPENWINDOW playwin,0,0,540,400,@NOAUTODRAW|@MINBOX,0,"Keno",&playhandler
SETWINDOWCOLOR playwin,RGB(0,0,255)
CONTROL playwin,@BUTTON,"START",5,340,70,22,0x50000000,1
CONTROL playwin,@BUTTON,"CLEAR",80,340,70,22,0x50000000,2
CONTROL playwin,@BUTTON,"Up",250,340,30,23,0x50000000,3
CONTROL playwin,@BUTTON,"Dn",311,340,30,23,0x50000000,4
CONTROL playwin,@EDIT,"1",280,340,30,23,0x50000000|@CTEDITRO,5
control playwin,@BUTTON,"+1",405,340,34,22,0x50000000,6
control playwin,@BUTTON,"+5",439,340,34,22,0x50000000,7
control playwin,@BUTTON,"+20",473,340,34,22,0x50000000,8
control playwin,@BUTTON,"+50",507,340,34,22,0x50000000,9
'normal stuff
run = 1
playing = 0
gtk_main()
CLOSEWINDOW playwin
END
'The playwin window procedure subroutine
'Center the window on creation.
'Process the left mouse button to select/unselect balls.
'Process the timer to pick random balls.
'Start and clear the board in response to our two buttons
SUB playhandler
SELECT @CLASS
CASE @IDCLOSEWINDOW
gtk_main_quit()
CASE @IDCREATE
'CENTERWINDOW playwin
CASE @IDPAINT
GOSUB drawballs
'RETURN TRUE
CASE @IDLBUTTONDN
selectball(@MOUSEX,@MOUSEY)
CASE @IDCONTROL
IF @NOTIFYCODE = 0
SELECT @CONTROLID
CASE 1
if credits < bet
MessageBox playwin,"Not enough credits to play","Keno"
else
GOSUB startplay
endif
CASE 2
GOSUB clearboard
CASE 3:'bet up
bet+=1
if bet > 10 then bet = 10
SetControlText playwin,5,LTRIM$(STR$(bet))
GOSUB drawballs
CASE 4:'bet down
bet-=1
if bet < 1 then bet = 1
SetControlText playwin,5,LTRIM$(STR$(bet))
GOSUB drawballs
case 6:
credits+=1
GOSUB drawballs
case 7:
credits+=5
GOSUB drawballs
case 8:
credits+=20
GOSUB drawballs
case 9:
credits+=50
GOSUB drawballs
ENDSELECT
ENDIF
CASE @IDCHAR
SELECT @CODE
CASE ASC("s")
CASE& ASC("S")
GOSUB startplay
CASE ASC("c")
CASE& ASC("C")
GOSUB clearboard
ENDSELECT
CASE @IDTIMER
if picked < 20
GOSUB pickball
picked = picked + 1
GOSUB drawballs
else
GOSUB endplay
playing = 0
endif
ENDSELECT
RETURN
ENDSUB
'------------------- DRAWBALLS ---------------
'Draw 80 balls and the status text
'Balls are colored depending on the value of
'the balls array.
'0 = not selected, 1 = selected, 2 = hit, 3 = miss
'---------------------------------------------
SUB drawballs
int width,height
SETFONT playwin,"Arial",12,400
DRAWMODE playwin,@TRANSPARENT
FRONTPEN playwin,RGB(0,0,0)
cacheDC = GetHDC(playwin)
num = 1
for y = 0 to 7
for x = 0 to 9
colorball = 0xFFFFFF
if balls[num-1] = 1 THEN colorball = selected
if balls[num-1] = 2 THEN colorball = hit
if balls[num-1] = 3 THEN colorball = miss
CIRCLE playwin,(x*40)+20,(y*40)+20,20,0,colorball
MOVE playwin,(x*40) + 10, (y*40) + 10
strball = ltrim$(str$(num))
if num < 10 THEN strball = "0" + strball
PRINT playwin,strball
num = num + 1
next x
next y
ReleaseHDC playwin,cacheDC
SETFONT playwin,"Lucida Console",10,800
cacheDC = GetHDC(playwin)
RECT playwin,407,5,120,310,RGB(255,255,0),RGB(0,0,255)
DRAWMODE playwin,@TRANSPARENT
for x = 1 to selectcount
if(hitcount = x)
RECT playwin,408,x*26-14,118,26,RGB(0,255,0),RGB(0,255,0)
move playwin,410,x*26-10
print playwin,using("## ######",x,pay[x-1,selectcount-1]*bet)
else
move playwin,410,x*26-10
print playwin,using("## ######",x,pay[x-1,selectcount-1]*bet)
endif
next x
ReleaseHDC playwin,cacheDC
DRAWMODE playwin,@OPAQUE
SETFONT playwin,"MS Sans Serif",10,400
cacheDC = GetHDC(playwin)
BACKPEN playwin,RGB(0,0,255)
GETTEXTSIZE playwin,"Hits",width,height
move playwin,407+60-width/2,0
print playwin,"Hits"
MOVE playwin,155,342
strstat = "Drawn: " + ltrim$(str$(picked))
PRINT playwin,strstat," "
MOVE playwin,420,322
FRONTPEN playwin,RGB(255,255,100)
PRINT "CREDITS: ",ltrim$(str$(credits))," "
MOVE playwin,282,322
PRINT "BET"
ReleaseHDC playwin,cacheDC
RETURN
ENDSUB
'------------------- SELECTBALL ---------------
'The mouse coordinates are converted to a ball number
'Balls can be deselected by clicking a second time
'Only a maximum of 10 balls can be selected in standard keno
'----------------------------------------------
SUB selectball(mx:int,my:int)
IF playing THEN RETURN
x = (mx - 10) / 40.0
y = (my - 10) / 40.0
num = x + (y * 10)
if (num > 79) | (num < 0) THEN RETURN
SELECT balls[num]
CASE 3
CASE& 0
IF selectcount < 10
balls[num] = 1
selectcount = selectcount + 1
ENDIF
CASE 1
CASE& 2
balls[num] = 0
selectcount = selectcount - 1
ENDSELECT
GOSUB drawballs
RETURN
ENDSUB
'---------------- STARTPLAY -----------------
'The previous draws are cleared and a timer is
'started. One ball will be randomly picked every
'time the timer expires
'The two buttons are disabled until play completes
'--------------------------------------------
SUB startplay
IF selectcount > 0
credits -= bet
playing = 1
picked = 0
hitcount = 0
FOR x = 0 to 79
IF balls[x]=3 THEN balls[x] = 0
IF balls[x]=2 THEN balls[x] = 1
NEXT x
drawballs()
for x=1 to 9
ENABLECONTROL playwin,x,0
next x
STARTTIMER playwin,100
ENDIF
RETURN
ENDSUB
'----------------- ENDPLAY ------------------
'After 20 balls are generated the timer is stopped
'The two buttons are re-enabled
'--------------------------------------------
SUB endplay
STOPTIMER playwin
for x=1 to 9
ENABLECONTROL playwin,x,1
next x
credits += pay[hitcount-1,selectcount-1]*bet
DrawBalls()
RETURN
ENDSUB
'---------------- CLEARBOARD ----------------
'Clears all the selected balls and resets the counters
'--------------------------------------------
SUB clearboard
FOR x = 0 TO 79
balls[x] = 0
NEXT x
selectcount = 0
picked = 0
hitcount = 0
GOSUB drawballs
RETURN
ENDSUB
'---------------- PICKBALL -----------------
'Generates a random number between 0 and 79
'if the number has already been drawn then
'continues generating a random number until
'a non drawn ball is found
'-------------------------------------------
SUB pickball
done = 0
DO
x = int(rnd(80))
if (balls[x] <> 3) & (balls[x] <> 2) THEN done = 1
UNTIL done
'If its a selected ball then set it to 'hit'
IF balls[x] = 1
balls[x] = 2
hitcount = hitcount + 1
ENDIF
'If its a non selected ball then set it to 'miss'
IF balls[x] = 0 THEN balls[x] = 3
RETURN
ENDSUB
'balls picked
' 1,2,3,4,5,6,7,8,9,10
databegin paytable
data 3,0,0,0,0,0,0,0,0,0: 'match 1
data 0,15,2,2,0,0,0,0,0,0: 'match 2
data 0,0,46,5,3,3,1,0,0,0: 'match 3
data 0,0,0,91,12,4,2,2,1,0: 'match 4
data 0,0,0,0,810,70,26,12,6,5: 'match 5
data 0,0,0,0,0,1600,400,98,44,24: 'match 6
data 0,0,0,0,0,0,7000,1652,335,142: 'match 7
data 0,0,0,0,0,0,0,10000,4700,1000: 'match 8
data 0,0,0,0,0,0,0,0,10000,4700: 'match 9
data 0,0,0,0,0,0,0,0,0,20000: 'match 10
dataend
/* TABLE 1
NUMBER OF SPOTS SELECTED
HITS 1 2 3 4 5 6 7 8 9 10
1 3 0 0 0 0 0 0 0 0 0
2 -- 15 2 2 0 0 0 0 0 0
3 -- -- 46 5 3 3 1 0 0 0
4 -- -- -- 91 12 4 2 2 1 1
5 -- -- -- -- 810 70 26 12 6 5
6 -- -- -- -- -- 1600 400 98 44 24
7 -- -- -- -- -- -- 7000 1652 335 142
8 -- -- -- -- -- -- -- 10000 4700 1000
9 -- -- -- -- -- -- -- -- 10000 4700
10 -- -- -- -- -- -- -- -- -- 20000
*/
You will notice there are some differences from the Windows version. I am not totally done desiging the startup/shutdown code hence the need for the gtk_init call. Also message processing is still in the early stages which necessitates the gtk_main and gtk_main_quit calls.
For a console test program use this:
Save as heapsort.eba
$main
'EBASIC heapsort demo
'For EBASIC 1.0 or greater
'Compile as a CONSOLE target
type timeval
int tv_sec
uint tv_usec
endtype
declare cdecl extern gettimeofday(tv as timeval,tz as pointer),int
DEF i:INT
DEF display as CHAR
DECLARE hsort(A[]:STRING,inr:INT)
DECLARE heapify(A[]:STRING,hleft:INT,hright:INT)
DECLARE swap(A[]:STRING,ij:INT,ik:INT)
DECLARE cdecl extern clock(),uint
setprecision 4
def maxsize:int
def testarray as POINTER
'OPENCONSOLE
INPUT "Number of items to sort: ",maxsize
INPUT "Display sorted array (Y/N)?",display
testarray = new(STRING,maxsize+1)
print "generating a random array with ",maxsize,"elements"
' fill an array with random integers -- array generator by David
for i = 1 to MaxSize
a = int(rnd(26)+65)
a$ = chr$(a)
b$ = ""
while len(B$) < int(rnd(4)) + 4
b = int(rnd(26)+97)
b$ = b$+chr$(b)
endwhile
rndStr$ = a$ + b$
#testarray[i,0] = rndStr$
next i
PRINT "Sorting..."
aa = msecs()
hsort(#testarray,maxsize)
bb = msecs()
IF (display = ASC("Y")) | (display = ASC("y"))
FOR i = 1 TO maxsize
IF i = maxsize
PRINT #testarray[i,0]
ELSE
PRINT #testarray[i,0],",",
ENDIF
NEXT i
ENDIF
PRINT
print "Sorted ",maxsize,"items in ",(bb-aa)/1000.0," seconds -------"
DELETE testarray
print "Press any key to exit"
DO:UNTIL INKEY$ <> ""
'CLOSECONSOLE
END
'-----------------------------------------------
SUB hsort(A[]:STRING,inr:INT)
DEF ix:INT
'first phase -- build heap
ix=INT(inr/2)
WHILE (ix >= 1)
heapify(A,ix,inr)
ix=ix-1
ENDWHILE
'second phase -- put largest at end of array,
'use heapify to grab the next remaining largest
ix = inr
WHILE (ix > 1)
swap(A,1,ix)
heapify(A,1,ix-1)
ix=ix-1
ENDWHILE
RETURN
ENDSUB
'-----------------------------------------------
'instill heap condition
SUB heapify(A[]:STRING,hleft:INT,hright:INT)
DEF ic,ip:INT
ip = hleft
ic = 2*ip
WHILE (ic <= hright)
IF (ic < hright) & (A[ic+1] > A[ic]) THEN ic = ic + 1
IF (A[ip] < A[ic]) THEN swap(A,ic,ip)
ip = ic
ic=2*ip
ENDWHILE
RETURN
ENDSUB
'------------------------------------------------
SUB swap(A[]:STRING,ij:INT,ik:INT)
DEF t:STRING
t=A[ij]: A[ij]=A[ik]: A[ik]=t
RETURN
ENDSUB
SUB msecs(),uint
timeval tv
gettimeofday(tv,NULL)
return (tv.tv_sec - 1167606262) * 1000 + tv.tv_usec / 1000
ENDSUB
You will notice the $main statement. The Windows IDE uses the optional /m setting of ebparse to automatically declare "main" in a single file build, in the background without you noticing. You can as well like so:
ebparse "heapsort.eba" "heapsort.o" /m
ld -lc -lgtk-x11-2.0 -o "heapsort" "heapsort.o" /usr/lib/libebasic.a --dynamic-linker /lib/ld-linux.so.2
Which allows you to omit the $main statement.
OK too tired to think now. Let's see how many of you that purchased the preview version get it to work.
Paul.
Okay... it's 2:35 am and I'm gonna pay dearly for this tomorrow at work, but what the heck.
I can claim first dibs to an error message if nothing else. ;)
Here's my code:
OPENCONSOLE
PRINT "EBasic for Linux Rocks!"
PRINT ""
PRINT "Press Any Key To Close"
DO:UNTIL INKEY$ <> ""
CLOSECONSOLE
END
and here's the error I get:
/usr/lib/libebasic.a(conmain.o): In function `_start':
conmain.asm:(.text+0x23): undefined reference to `_ib_main'
I tried it both with and without the "-lgtk-x11-2.0 " added so I'm not sure what went wrong.
-Doc-
Edit: Using text editor and command shell on Ubuntu 7.04
(I did cheat because it was late, copying a portion of the code from the CHM file to speed things up)
Put $main at the top of the file. OPENCONSOLE can be omitted because it doesn't do anything ;)
QuotePut $main at the top of the file
That works like a charm! ...actually I knew that openconsole wouldn't open anything in Linux. ;) I Just didn't know whether you had left it for some reason or not.
Speaking of, will there be a simple text list of the working stuff available anytime soon?
-Doc-
All of the text based (shell) commands should be working. Opening windows, adding buttons and edit controls, changing fonts, colors, etc are all working.
You will know when you hit a command I haven't converted yet. The linker will complain about unresolved references since the command I haven't ported still have references to the Win API in them, which of course won't resolve on Linux ;)
Paul.
QuoteYou will know when you hit a command I haven't converted yet.
Heh heh... no doubt about that... as in first hand experience!
::) :o ::)
-Doc-
Okay, I *promise* that I won't be continually bugging you. Just trying to get my feet wet a little bit.
This code:
DEF w1 as WINDOW
OPENWINDOW w1,0,0,350,350,@MINBOX|@MAXBOX|@SIZE,NULL,"Ebasic For Linux",&main
WAITUNTIL w1 = 0
END
SUB main
IF @MESSAGE = @IDCLOSEWINDOW
CLOSEWINDOW w1
ENDIF
RETURN
ENDSUB
Creates the biggest mess of errors I've seen since back when I was playing around with C and C++
What do I have wrong there?
After I can get a simple window functional, I'll be off and running for a while without hounding you. ;)
-Doc-
thats why I gave you the keno source code. And the instuctions. Sorry about the double spaced code, it just ended up that way when cutting and pasting from Anjunta.
You have to follow the same startup stuff. gtk_init, gtk_main, etc.
gtk_main is the substitute for WAIT/WAITUNTIL for now.
Unlike Windows, GTK actually discourages writting your own message loop, in fact they make it really difficult. So instead of using a controlling variable like 'run' and a loop like WAITUNTIL, you just have two functions which as stated in the example are gtk_main and gtk_main_quit. I just haven't wrapped them into actual commands yet.
I'll whip up a shorter example in a little while.
Paul.
I don't have the Linux version, but I would say you probably need some GTK calls.
extern _argc as int
extern _argv as pointer
declare cdecl extern gtk_init(argc as pointer,argv as pointer)
declare cdecl extern gtk_main()
declare cdecl extern gtk_main_quit()
$main
gtk_init(&_argc,&_argv)
DEF w1 as WINDOW
OPENWINDOW w1,0,0,350,350,@MINBOX|@MAXBOX|@SIZE,NULL,"Ebasic For Linux",&main
gtk_main()
gtk_main_quit()
SUB main
IF @MESSAGE = @IDCLOSEWINDOW
CLOSEWINDOW w1
ENDIF
RETURN
ENDSUB
Try that. I've never used GTK before, but it seems like it should work, looking at the keno example.
Okay, I'm stupid! ...I grabbed the keno code and then forgot all about it.
sheesh, what a nutcase.
sorry to bother.
-Doc-
I am having problems with the loader - is there more than one version.
I am running Ubuntu ( 2.6.17-11-generic).
I re-installed the dev lib and it now works.
Hey Parker,
You were dead on the money with your code!
Sometimes I amaze myself with the stupid stuff I do... really early this morning I actually downloaded the entire forum thread to serve as a point of reference, then went right back to sleep and completely forgot about it.
Didn't even read it through even once! ::)
Everyone please accept my apologies... I'm like the proverbial bull in the china closet.
-Doc-
My simple example is slightly delayed.
gtk_main_quit is in the wrong place in Parkers code. Should be...
extern _argc as int
extern _argv as pointer
declare cdecl extern gtk_init(argc as pointer,argv as pointer)
declare cdecl extern gtk_main()
declare cdecl extern gtk_main_quit()
$main
gtk_init(&_argc,&_argv)
DEF w1 as WINDOW
OPENWINDOW w1,0,0,350,350,@MINBOX|@MAXBOX|@SIZE,NULL,"Ebasic For Linux",&main
gtk_main()
END
SUB main
IF @MESSAGE = @IDCLOSEWINDOW
CLOSEWINDOW w1
gtk_main_quit()
ENDIF
RETURN
ENDSUB
gtk_main starts an interal messaage loop. gtk_main_quit() ends that loop and execution continues after the gtk_main call.
.............
Mu Ubuntu install hosed itself sometime between last night and now. I got impatient waiting for it to finish shutting down and hit the power button...as a note to everyone..DON'T DO THAT!
Luckily all of my files are still on the drive, and I can actually boot into gnome. But my ethernet driver, ntfs driver, CDROM driver, and sound driver are all non functional at the moment. So I can't access the net to do a refresh of files or access my Windows drives to copy from there. I suppose my only option is to burn the latest version in Windows and reinstall the core OS.
Can't blame Linux, it was my own fault for not waiting for a complete shutdown. Still a pain though.
Thanks for the sample Paul.
After finding a few processes hanging using the system monitor, I've been trying to figure out where to put the gtk_main_quit() for a clean end to the program. That makes it perfectly clear. :)
Ouch! Too bad about the Linux box... I learned that the hard way once upon a time myself.
At least you didn't lose your data. :)
-Doc-
Turned out to be an easy fix, once I realized what was going on. The actual kernel image was corrupted so the solution was to boot with an earlier version of the kernel, update the latest one, and reboot.
I always keep the last two previous kernels in my grub boot menu just in case an upgrade breaks something. So Ubunutu now happy again, typing from it now, so back to answering questions you may have ;)
Paul.
Paul
Do you want to know when we encounter a featrue that is not yet working?
I am sure you know what is not converted - do you need to know what we are trying to use so you will
know where to start first?
I already know what I haven't ported yet ;)
I can give you a rough estimate of when something will be worked on. Right now I am porting controls and their commands. Dialogs will have to be simulated so don't expect them anytime soon. There are no 'dialogs' in X, just windows. GTK2 has a reasonable simulation of a dialog that I am adapting. Things like 2D commands are far off into the future.
Paul.
ok heres my first problem :P
when i try to ebparse keno.eba i got this error:
Segmentation fault (core dumped)
am i forgetting something?
OS? Other Information? Did you install the packages mentioned in the first post?
A segmentation fault is Linux's version of the Windows GPF. Not much to go on ;)
Everything's working fine here Paul.
'm using ubuntu 7.04 live cd
binutils was install
i installed nasm
and skip the optional file
id put libebasic.a in /libs and set owner to root
ebparse in /bin and set owner to root and make excutable
put ebstd.incc inthe /bin too
put keno.eba in my home folder
send ebparse "keno.eba" "keno.o" to terminal
and this return the segmentation error ???
Hi Krypt!
I would imagine that you've already checked, but it can't hurt to ask anyway... how about the libgtk2.0-dev library?
The all important dev package isn't installed by default.
-Doc-
hi David ;)
installed the libgtk2.0-dev and binutils-dev in case
then retry the ebparse command in the terminal
still getting the segmentation fault
I've not tried it with a live CD yet. Don't know if that would make a difference or not, but it might.
ok thanx , its what i was thinkin too...
will need to install that linux ;)
just need an answer to one question about installing ubuntu if you dont mind...
I'm working on a Mobile computer with a recover partition...when the computer boot
the recover system give me a 2 secs bootscreen to recover my system to default
if i install ubuntu in dual boot with the default system (windows xp home edition).. will this affect the recover bootscreen?
Quoteif i install ubuntu in dual boot with the default system (windows xp home edition).. will this affect the recover bootscreen?
I'm guessing that not all systems are alike but I recently purchased a Compaq desktop that had Vista on it. Ubuntu 7.04 is now the only OS installed on it and even the recovery partition is gone, but it still shows the recovery option available at boot up.
-Doc-
thanks David
Ubuntu installed now in another partition
recovery option is availlable in grub :P cool!!
working now ;)
must be the live cd ...
here's a little screen of the Heapsort
is the FILEREQUEST command working?
because i'm having problem... ;)
Not yet. What is working is the compiler itself, 99% of the shell (console) commands. the basic GUI system for managing windows, a few control types, the font subsystem, etc.
The dialog based commands will take a while. The file dialog, font dialog, etc all relied on direct Win32 calls to create them. And they will be worked on after more of the control types are finished.
Working on the multiline edit control now, harder than it sounds since there isn't a simple multiline edit control in GTK like there is in Windows. In Windows the difference between a single line edit and a multiline edit control is just a style bit. In GTK it is a completely different control requiring allocating text buffers, a separate function set, etc. To keep the syntax the same I have to simulate the functionality of the Windows control.
Paul.
ok thanks Paul.
I'm trying to build a little launcher for the compiler.
is there a gtk function to start another application, like the system() ...
im into looking in http://developer.gnome.org/doc/API/
for reference but didnt find anything similar...
The SYSTEM command should work. You can create a detached process using the & symbol as a parameter.
ok thank you.
i should try it before asking next time ;)
;D I finally found some time this am and ran heapsort without a hitch, well, I did have to learn how to be a superuser with Konsole. I'm using Mepis 6.0 based on Ubuntu 7 I think.
Great! Next I will try out KrYpT's program to launch a program easier!!
Thanks Paul for the opportunity to try EBasic out now. I was using Gambas in Linux but am much more comfortable with EBasic!
Jerry Clement
Hummm... it's been awhile since we've heard much.
Anything new and exciting going on with the Linux version?
-Doc-
Paul,
I would like to ask if your Linux compiler works with other libraries yet?
for example could the libX11.so.6 be used now?
Allan
Yes. Just declare the function as extern and include the library in the linker command. That particular one is already linked against due to GTK being used.
Paul.
Paul
QuoteWhat is working is the compiler itself...
Could the compiler be used to make a library as it is?
Yes. Just use AR which comes on every linux system. Which is how I create the static ebstdlib library.
Paul, Thanks for your reply.
My Last Question....
Are Class Objects (as in EBasic Windows) available now??
Windows work fine. But OOP isn't in the linux parser yet.
Thank you Paul for the info.
Look forward to seeing your Linux at work?
Will it be added to your downloads on the main web page?
Allan
One thing at a time ;)
No Sweat - she's apples - Allan
:) ;D :D
QuotePaul
Quote
What is working is the compiler itself...
Could the compiler be used to make a library as it is?
QuoteYes. Just use AR which comes on every linux system. Which is how I create the static ebstdlib library.
Another question please...
' abclib.eba
GLOBAL GetNumber
sub GetNumber(x:int),Int
def y:int
y = x * 2
return y
endsub
GLOBAL UndoNumber
sub UndoNumber(x:int),Int
def y:int
if x <> 0
y = x / 2
else
y = -1
endif
return y
endsub
ebparse "abclib.eba" "abclib.o"
ar -rcs libabclib.a abclib.o
Is that functional now or still to come?
Allan,
ar is a linux command, and has always been working ;)
So I guest I would need clarification of your question. Can you make libraries in Linux, yes.
Although it is kind of strange to have a library with just one object file in it. Normally you would want each function in its own source file so any linker that is using the static library can use just the functions referenced in the target executable.
also you don't need the quotes. It is just
ebparse blah.eba blah.o
When I build the library for Emergence I use:
ar -rcs libebasic.a *.o
in the directory that all of the object files are, one for each command in the language.
Paul.
Paul,
I am just doing a test to get the procedures right before building a real library. I wanted the library because it would be used in more than one program.
I suppose the object file 'abclib.o' could be used instead of making a library.
Here is the code I wrote to use the library I had created and placed in /usr/lib - set as 'root'
$main
$USE "/usr/lib/libabclib.a"
DECLARE extern GetNumber(x:int),int
DECLARE extern UndoNumber(x:int),int
def win:window
OPENWINDOW win,0,0,260,160,@SIZE|@MINBOX|@MAXBOX,0,"Test - Library abclib",&mainwindow
CONTROL win,@STATIC,"Number",58,37,45,18,0x50000000,1
CONTROL win,@EDIT,"4",105,34,70,20,0x50000000|@CTEDITRO,2
CONTROL win,@STATIC,"Answer",58,66,45,18,0x50000000,3
CONTROL win,@EDIT,"",105,65,70,20,0x50000000|@CTEDITRO,4
CONTROL win,@BUTTON,"Get Number",30,113,70,26,0x50000000,5
CONTROL win,@BUTTON,"Undo Number",151,114,70,26,0x50000000,6
run = 1
'process messages until someone closes us
WAITUNTIL run = 0
CLOSEWINDOW win
END
sub mainwindow
select @MESSAGE
case @IDCLOSEWINDOW
run = 0
case @IDCREATE
CenterWindow win
CASE @IDCONTROL
IF @NOTIFYCODE = 0
SELECT @CONTROLID
CASE 5
GOSUB WorkGetNum
CASE 6
GOSUB WorkUndoNum
ENDSELECT
ENDIF
endselect
return
endsub
sub WorkGetNum
Def a:int
Def b:int
def text:string
text = Getcontroltext(win, 2)
a = val(text)
b = GetNumber(a)
text = str$(b)
setcontroltext win, 4, ltrim$(text)
return
endsub
sub WorkUndoNum
Def a:int
def b:int
def text:string
text = getcontroltext(win, 2)
a = val(text)
b = UndoNumber(a)
text = str$(b)
setcontroltext win, 4, ltrim$(text)
return
endsub
I am getting link errors. I must be doing something wrong:
QuoteCompiling...
testlib.eba
No Errors
Linking...
/home/bpak/EBasic_Linux/MyProgs/testlib.o: In function `WorkGetNum.bf':
/home/bpak/EBasic_Linux/MyProgs/testlib.asm:(.text+0x3d5): undefined reference to `GetNumber'
/home/bpak/EBasic_Linux/MyProgs/testlib.o: In function `WorkUndoNum.bf':
/home/bpak/EBasic_Linux/MyProgs/testlib.asm:(.text+0x4b2): undefined reference to `UndoNumber'
Error(s) linking testlib.eba
Hope that makes it more clear what I am trying to do?
Thank you.
Allan,
I'll look when I get back into Linux. Had Windows work to do over the last few days.
I don't see any complaints by the linker that it couldn't find the file. Case looks correct.
Paul.
Thank you Paul.
Whenever you have the time will do fine.
Linking this manually, I got it to link correctly like so:
ld -e _gtkstart -o ./testlib ./testlib.o ../libebasic.a ./libabclib.a -lc -lgtk-x11-2.0 -ldl -I /lib/ld-linux.so.2
Executed from the folder containing the source and object files.
I have the ebasic lib one level up, thus the ../libebasic.a.
@Paul: Would it be possible to modify the editor so that the path to the lib isn't hardcoded to /usr/lib? Just have it use the same location as the ebparse file?
The reason I ask is so that I can place the entire package on a thumb drive and not have to copy the lib over to that location when going from machine to machine.
Also, when invoking $USE is the parameter passed to the linker as is? Trying $USE "./libabclib.a" resulted in linker errors.
Thanks!
Quick tip: Nasm adds a .comment section to every file it assembles. To make things a bit smaller, you can strip the final executable with:
strip -R.comment <filename>
If you want to gain an additional reduction of about 20-25K in Gui apps, just strip the executable with:
strip -s <filename>
You can always combine the two, if you like.
Cheers!
AIR.
Armando,
No fear as the real IDE will have configurable paths. ebtinyide i just something to use while I am working with the language proper. The error with $use "./libabclib.a" is probably due to the ide, and not the linker.
Paul.
Hello AIR
Really pleased to see you on this forum.
regards,
Allan
Thanks, Allan.
I've been lurking for a long while, and finally took the plunge. I'm really liking what I'm seeing so far!
AIR.
I also think it will be an excellent language the way it is looking!
I still have those links to X11 and linux topics you gave me, way back.
They have been really helpful but some are a bit heavy reading.
Allan
Cool, glad you're still using 'em!
If you want GTK/GLib etc docs on your system, install the DevHelp package and the *-doc packages for each.
I have to say that I was a bit hesitant to take the plunge, but I'm glad I did. The language is feature rich, but I can still get down and dirty with Gtk/Glade api. The best of both worlds, and it's only been two days!
What really sealed the deal is Nasm. Gotta have my Nasm! When I discovered that EB was using it, I was sold.
Awesome job, Paul. My hat's off to ya! Just a quick question: for the upcoming IDE, will you be using GtkSourceView, or Scintilla? Not rushing you, just curious.
If asked, I would say Scintilla because I think it's more robust, I've used it, and it would be an easier migration path since you've used it too....;)
Right now, I'm using SciTE which is an awesome editor. An IDE would be sweet though...
AIR.
Scintilla of course. The development IDE used GtkSourceView for convenience.
Paul.
Hi AIR
Just had another look through your original examples with GTK and Glade from a year or so ago. They are great.
Liked your editor too but I did not have the compiler you needed so I could not do much 'playing around' with the code.
Thanks for the advise on the Help Files. Just what I need at the moment as I want to get into the 'API' side of it for a while.
Allan
Just installed the latest Ubuntu version this evening along with all of the required pkgs and can't seem to get anything to compile...
Using the shell:
~/eb_linux$ ebparse "lines.eba" "lines.o"
Segmentation fault
Using Tiny IDE:
Compiling...
lines.eba
Segmentation fault
Error(s) compiling lines.eb
Even tried using bumblebee's mineide without luck
I've checked and double-checked the file locations and permissions and as best I can tell, everything is in order. Any ideas?
-Doc-
P.S. You guys knew I couldn't resist for very long, didn't ya? ;)
Hi Doc
I had that segment fault the other week - see this link
http://www.ionicwind.com/forums/index.php/topic,2714.0.html
The segment fault i had was not in the installation but in the source code of the EBA.
A pointer was used as an INT and ebparse said segment fault.
So check your .eba code out for errors.
regards,
Allan