IonicWind Software

IWBasic for Linux => General IWLP Discussion => Topic started by: Ionic Wind Support Team on May 29, 2007, 11:32:09 PM

Title: Preview Version instructions
Post by: Ionic Wind Support Team on May 29, 2007, 11:32:09 PM
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.
Title: Re: Preview Version instructions
Post by: Doc on May 30, 2007, 01:41:41 AM
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)
Title: Re: Preview Version instructions
Post by: Ionic Wind Support Team on May 30, 2007, 06:27:12 AM
Put $main at the top of the file.  OPENCONSOLE can be omitted because it doesn't do anything ;)
Title: Re: Preview Version instructions
Post by: Doc on May 30, 2007, 04:50:05 PM
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-
Title: Re: Preview Version instructions
Post by: Ionic Wind Support Team on May 30, 2007, 05:32:53 PM
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.
Title: Re: Preview Version instructions
Post by: Doc on May 30, 2007, 05:41:13 PM
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-
Title: Re: Preview Version instructions
Post by: Doc on May 30, 2007, 06:00:12 PM
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-
Title: Re: Preview Version instructions
Post by: Ionic Wind Support Team on May 30, 2007, 06:17:11 PM
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.
Title: Re: Preview Version instructions
Post by: Parker on May 30, 2007, 06:18:00 PM
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.
Title: Re: Preview Version instructions
Post by: Doc on May 30, 2007, 06:33:59 PM
Okay, I'm stupid! ...I grabbed the keno code and then forgot all about it.
sheesh, what a nutcase.
sorry to bother.

-Doc-
Title: Re: Preview Version instructions
Post by: Rock Ridge Farm (Larry) on May 30, 2007, 06:42:28 PM
I am having problems with the loader - is there more than one version.
I am running Ubuntu ( 2.6.17-11-generic).
Title: Re: Preview Version instructions
Post by: Rock Ridge Farm (Larry) on May 30, 2007, 06:50:11 PM
I re-installed the dev lib and it now works.
Title: Re: Preview Version instructions
Post by: Doc on May 30, 2007, 07:05:28 PM
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-
Title: Re: Preview Version instructions
Post by: Ionic Wind Support Team on May 30, 2007, 07:37:18 PM
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.
Title: Re: Preview Version instructions
Post by: Doc on May 30, 2007, 07:59:00 PM
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-
Title: Re: Preview Version instructions
Post by: Ionic Wind Support Team on May 30, 2007, 10:40:19 PM
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.
Title: Re: Preview Version instructions
Post by: Rock Ridge Farm (Larry) on May 31, 2007, 09:15:09 AM
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?
Title: Re: Preview Version instructions
Post by: Ionic Wind Support Team on May 31, 2007, 09:26:15 AM
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.
Title: Re: Preview Version instructions
Post by: ExMember001 on May 31, 2007, 03:44:09 PM
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?
Title: Re: Preview Version instructions
Post by: Ionic Wind Support Team on May 31, 2007, 03:50:54 PM
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 ;)
Title: Re: Preview Version instructions
Post by: David on May 31, 2007, 04:09:23 PM
Everything's working fine here Paul.
Title: Re: Preview Version instructions
Post by: ExMember001 on May 31, 2007, 04:21:21 PM
'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  ???
Title: Re: Preview Version instructions
Post by: Doc on May 31, 2007, 04:32:58 PM
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-
Title: Re: Preview Version instructions
Post by: ExMember001 on May 31, 2007, 04:40:16 PM
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
Title: Re: Preview Version instructions
Post by: Ionic Wind Support Team on May 31, 2007, 04:48:58 PM
I've not tried it with a live CD yet.  Don't know if that would make a difference or not, but it might.
Title: Re: Preview Version instructions
Post by: ExMember001 on May 31, 2007, 04:57:47 PM
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?

Title: Re: Preview Version instructions
Post by: Doc on May 31, 2007, 05:25:39 PM
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-
Title: Re: Preview Version instructions
Post by: ExMember001 on May 31, 2007, 06:03:52 PM
thanks David
Ubuntu installed now in another partition
recovery option is availlable in grub :P cool!!
Title: Re: Preview Version instructions
Post by: ExMember001 on May 31, 2007, 07:04:14 PM
working now ;)
must be the live cd ...
Title: Re: Preview Version instructions
Post by: ExMember001 on May 31, 2007, 07:30:33 PM
here's a little screen of the Heapsort
Title: Re: Preview Version instructions
Post by: ExMember001 on June 02, 2007, 01:47:28 PM
is the FILEREQUEST command working?
because i'm having problem... ;)
Title: Re: Preview Version instructions
Post by: Ionic Wind Support Team on June 02, 2007, 02:27:08 PM
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.
Title: Re: Preview Version instructions
Post by: ExMember001 on June 02, 2007, 02:42:39 PM
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...
Title: Re: Preview Version instructions
Post by: Ionic Wind Support Team on June 02, 2007, 02:56:15 PM
The SYSTEM command should work.   You can create a detached process using the & symbol as a parameter. 
Title: Re: Preview Version instructions
Post by: ExMember001 on June 02, 2007, 03:32:26 PM
ok thank you.
i should try it before asking next time ;)
Title: Re: Preview Version instructions
Post by: jerryclement on June 03, 2007, 10:17:36 AM
 ;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
Title: Re: Preview Version instructions
Post by: Doc on July 27, 2007, 05:42:03 PM
Hummm... it's been awhile since we've heard much.
Anything new and exciting going on with the Linux version?

-Doc-
Title: Re: Preview Version instructions
Post by: Allan on July 27, 2007, 07:30:53 PM
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
Title: Re: Preview Version instructions
Post by: Ionic Wind Support Team on July 27, 2007, 09:40:28 PM
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.
Title: Re: Preview Version instructions
Post by: Allan on July 31, 2007, 04:16:18 PM
Paul

QuoteWhat is working is the compiler itself...

Could the compiler be used to make a library as it is?
Title: Re: Preview Version instructions
Post by: Ionic Wind Support Team on July 31, 2007, 04:34:34 PM
Yes.  Just use AR which comes on every linux system.  Which is how I create the static ebstdlib library. 

Title: Re: Preview Version instructions
Post by: Allan on July 31, 2007, 07:52:37 PM
Paul, Thanks for your reply.

My Last Question....

Are Class Objects (as in EBasic Windows) available now??
Title: Re: Preview Version instructions
Post by: Ionic Wind Support Team on July 31, 2007, 08:13:37 PM
Windows work fine.  But OOP isn't in the linux parser yet.
Title: Re: Preview Version instructions
Post by: Allan on August 12, 2007, 09:56:51 PM
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
Title: Re: Preview Version instructions
Post by: Ionic Wind Support Team on August 12, 2007, 10:00:56 PM
One thing at a time ;)
Title: Re: Preview Version instructions
Post by: Allan on August 12, 2007, 10:22:54 PM
No Sweat - she's apples - Allan

:)  ;D  :D
Title: Re: Preview Version instructions
Post by: Allan on August 08, 2008, 06:36:01 PM
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?

Title: Re: Preview Version instructions
Post by: Ionic Wind Support Team on August 08, 2008, 07:16:59 PM
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.
Title: Re: Preview Version instructions
Post by: Allan on August 08, 2008, 07:33:46 PM
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.
Title: Re: Preview Version instructions
Post by: Ionic Wind Support Team on August 08, 2008, 08:11:59 PM
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.
Title: Re: Preview Version instructions
Post by: Allan on August 08, 2008, 08:21:13 PM
Thank you Paul.
Whenever you have the time will do fine.
Title: Re: Preview Version instructions
Post by: Armando Rivera on September 01, 2008, 01:20:54 AM
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.
Title: Re: Preview Version instructions
Post by: Ionic Wind Support Team on September 01, 2008, 08:56:04 AM
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.
Title: Re: Preview Version instructions
Post by: Allan on September 01, 2008, 08:26:36 PM
Hello AIR

Really pleased to see you on this forum.

regards,
Allan
Title: Re: Preview Version instructions
Post by: Armando Rivera on September 01, 2008, 08:48:28 PM
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.
Title: Re: Preview Version instructions
Post by: Allan on September 01, 2008, 10:52:44 PM
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
Title: Re: Preview Version instructions
Post by: Armando Rivera on September 03, 2008, 01:30:13 AM
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.
Title: Re: Preview Version instructions
Post by: Ionic Wind Support Team on September 03, 2008, 08:16:52 AM
Scintilla of course.  The development IDE used GtkSourceView for convenience.

Paul.
Title: Re: Preview Version instructions
Post by: Allan on September 03, 2008, 06:52:08 PM
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
Title: Re: Preview Version instructions
Post by: Doc on September 12, 2008, 11:27:04 PM
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?  ;)
Title: Re: Preview Version instructions
Post by: Allan on September 13, 2008, 03:26:37 PM
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