1. Linux Pre-Alpha #4

I've uploaded a new Linux release at:

     http://members.aol.com/FilesEu/v20.htm

The main new feature is that you can now
call C routines in Linux shared libraries.
It works exactly the same as in WIN32:

   1. open_dll()

   2. define_c_proc() / define_c_func()

   3. c_proc() / c_func()

There's an example program in euphoria/demo/linux.

Some minor bugs were fixed in exu, and some small
improvements were made in ed.ex - see readme.doc.

Note: I downloaded euphor21.tgz successfully using IE 4.0,
but with Netscape 3.0 I keep getting the same, incorrect,
file downloaded, even though I cleared the Netscape cache
each time - it's about 1.5 K too large and won't
decompress. Let me know if you have a similar experience.
With Netscape I have to right-click to download it.
I tried it 4 times.

Regards,
     Rob Craig
     Rapid Deployment Software
     http://members.aol.com/FilesEu/

new topic     » topic index » view message » categorize

2. Re: Linux Pre-Alpha #4

Robert Craig wrote:
>
> Note: I downloaded euphor21.tgz successfully using IE 4.0,
> but with Netscape 3.0 I keep getting the same, incorrect,
> file downloaded, even though I cleared the Netscape cache
> each time - it's about 1.5 K too large and won't
> decompress. Let me know if you have a similar experience.
> With Netscape I have to right-click to download it.
> I tried it 4 times.
>
> Regards,
>      Rob Craig
>      Rapid Deployment Software
>      http://members.aol.com/FilesEu/

Robert,

        I'm not sure which version of Netscape I have it came with my copy of
Red Hat 5.1.  When I downloaded euphor21.tgz just a few minutes ago, it
came up in my browser as a bunch of junk.  I clicked on the File Menu
and chose Save and it saved it as euphor21.tgz I then used tar -xvz -f
euphor21.tgz and went to using it with no problem, also on another note,
I did download it through a proxy server CSM and it went through some
kind of Virus Check.

Later,

--
+ + +  Rev. Ferlin Scarborough  -  Centreville, Alabama  -  USA

          http://sites.netscape.net/fscarborough/homepage

email: ferlin at sandw.net
email: ferlin at email.com
email: fscarborough at netscape.net

new topic     » goto parent     » topic index » view message » categorize

3. Re: Linux Pre-Alpha #4

Robert Craig wrote:

> I've uploaded a new Linux release at: ...

Wicked! be there to see it!

>   Note: I downloaded euphor21.tgz successfully using IE 4.0,
> but with Netscape 3.0 I keep getting the same, incorrect,
> file downloaded, even though I cleared the Netscape cache
> each time - it's about 1.5 K too large and won't
> decompress. Let me know if you have a similar experience.
> With Netscape I have to right-click to download it.
> I tried it 4 times.
>

Oh wow... I thought it was me the whole time! (err, I even
right-clicked, and it didn't work)

Weird.

Blessed Be! --"LEVIATHAN"

new topic     » goto parent     » topic index » view message » categorize

4. Re: Linux Pre-Alpha #4

> The main new feature is that you can now
> call C routines in Linux shared libraries.
> It works exactly the same as in WIN32:

Awesome!!  Thank you for this cool feature!  Now we can link to X-windows,
SVGALIB, MikMod, etc.  Though to use SVGALIB, we will have to change exu to
be setuid root so that it has permissions to mess with the graphics
hardware.

> Note: I downloaded euphor21.tgz successfully using IE 4.0,
> but with Netscape 3.0 I keep getting the same, incorrect,
> file downloaded, even though I cleared the Netscape cache
> each time - it's about 1.5 K too large and won't
> decompress. Let me know if you have a similar experience.
> With Netscape I have to right-click to download it.
> I tried it 4 times.

It downloaded and uncompressed fine for me.  Netscape 4.61. [en] 99147
Perhaps Netscape is interpreting the file as ascii instead of binary, and
is adding 1.5K of formfeed chars...

>
>
> Regards,
>      Rob Craig
>      Rapid Deployment Software
>      http://members.aol.com/FilesEu/



Here's a simple program that pops up a window for 5 seconds in X.

-------------------------
-- x.ex
--
-- Simple X Window
--
-- notes: define_c_func, define_c_proc are currently lax in
--        defining the parameters and/or return value
-- Xwindows macros are "hard" to do

include dll.e
include machine.e

atom display
atom window
integer screen
integer foreground, background

procedure assert(integer bool, sequence msg)
    if not bool then
         puts(2, msg)
         abort(1)
    end if
end procedure

constant X11 = open_dll("/usr/X11R6/lib/libX11.so")
assert(X11 != 0, "Could not open X11\n")

constant XOpenDisplay = define_c_func(X11, "XOpenDisplay", {C_POINTER}, C_INT)
assert(XOpenDisplay != -1, "XOpenDisplay could not be linked\n")

constant str0 = allocate_string("")

display = c_func(XOpenDisplay, {str0})
assert(display != 0, "cannot connect to server\n")

--constant DefaultScreen = define_c_func(X11, "DefaultScreen", {}, 0)
--assert(DefaultScreen != 0, "DefaultScreen could not be linked\n")
function DefaultScreen(atom eax)
    return peek4u(eax + 132)
end function

screen = DefaultScreen(display)
puts(1, "screen: ")
? screen


function WhitePixel(atom eax, atom ecx)
    atom edx
    edx = ecx
    edx = edx * 4
    edx = edx + ecx
    ecx = edx
    ecx = ecx * 16
    eax = peek4u(140 + eax)
    edx = peek4u(52 + eax + ecx)
    return edx
end function

function BlackPixel(atom eax, atom ecx)
    atom edx
    edx = ecx
    edx = edx * 4
    edx = edx + ecx
    ecx = edx
    ecx = ecx * 16
    eax = peek4u(140 + eax)
    edx = peek4u(56 + eax + ecx)
    return edx
end function

background = WhitePixel(display, screen)
foreground = BlackPixel(display, screen)

puts(1, "background: ")
? background
puts(1, "foreground: ")
? foreground


--constant DefaultRootWindow = define_c_func(X11, "DefaultRootWindow", {}, 0)
--assert(DefaultRootWindow != 0, "DefaultRootWindow could not be linked\n")

function DefaultRootWindow(atom eax)
    atom ecx, edx
    edx = eax
    ecx = peek4u(132 + edx)
    edx = ecx
    edx = edx * 4
    edx = edx + ecx
    ecx = edx
    ecx = ecx * 16
    eax = peek4u(140 + eax)
    edx = peek4u(8 + eax + ecx)
    return edx
end function

puts(1, "DefaultRootWindow: ")
? DefaultRootWindow(display)

constant XCreateSimpleWindow = define_c_func(X11, "XCreateSimpleWindow",
   {C_INT,C_INT,C_INT,C_INT,C_INT,C_INT,C_INT,C_INT,C_INT}, C_INT)
assert(XCreateSimpleWindow != -1, "XCreateSimpleWindow could not be linked\n")

window = c_func(XCreateSimpleWindow, {display,
    DefaultRootWindow(display), 100, 50, 350, 250, 2,
    foreground, background})

assert(window != 0, "cannot create window\n")

constant XMapRaised = define_c_proc(X11, "XMapRaised", {C_INT,C_INT})
assert(XMapRaised != -1, "XMapRaised could not be linked\n")

c_proc(XMapRaised, {display, window})

constant XFlush = define_c_proc(X11, "XFlush", {C_INT})
assert(XFlush != -1, "XFlush could not be linked\n")

c_proc(XFlush, {display})


procedure sleep(atom t)
    t = t + time()
    while time() < t do
    end while
end procedure

sleep(5)


constant XDestroyWindow = define_c_proc(X11, "XDestroyWindow", {C_INT,C_INT})
assert(XDestroyWindow != -1, "XDestroyWindow could not be linked\n")

c_proc(XDestroyWindow, {display, window})

constant XCloseDisplay = define_c_proc(X11, "XCloseDisplay", {C_INT})
assert(XCloseDisplay != -1, "XCloseDisplay could not be linked\n")

c_proc(XCloseDisplay, {display})

-----------------------------------

Enjoy
 _______  ______  _______  ______
[    _  \[    _ ][ _   _ ][    _ ]
[/| [_] |[/| [_\][/ | | \][/| [_\]
  |  ___/  |  _]    | |     |  _]
[\| [/]  [\| [_/] [\| |/] [\| [_/]
[_____]  [______] [_____] [______]
xseal at harborside.com  ICQ:13466657
http://www.harborside.com/home/x/xseal/euphoria/

new topic     » goto parent     » topic index » view message » categorize

5. Re: Linux Pre-Alpha #4

Robert Craig wrote:


>I've uploaded a new Linux release at:


Great! Now I don't have any excuses for not writing the XLib wrappers.
(argh!)

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

6. Re: Linux Pre-Alpha #4

On Thu, 15 Jul 1999, you wrote:
> I've uploaded a new Linux release at:
>
>      http://members.aol.com/FilesEu/v20.htm
>
> The main new feature is that you can now
> call C routines in Linux shared libraries.
> It works exactly the same as in WIN32:
>
>    1. open_dll()
>
>    2. define_c_proc() / define_c_func()
>
>    3. c_proc() / c_func()
>
> There's an example program in euphoria/demo/linux.

Woo Hoo! Now we're on our way to web-enabled apps in Euphoria.
Minor bug report:
 I ran callc.exu in Dave's EE, and added the obligatory wait_key()
routine at the end (so I could see the output). Strangely, the previous
line which prints the numbers 111,222...etc, doesn't print until _after_
a key is struck. This happens whether running in the editor, or right from
the prompt.

puts(1, "\n> printf test:\n")
s = define_c_proc(libc, "printf", {C_POINTER, C_INT, C_DOUBLE, C_INT, C_DOUBLE})
format = allocate_string("Here are 4 numbers: %d, %.3f, %d, %e\n")
c_proc(s, {format, 111, 222.222, 333, 444.4444})

k = wait_key()

Regards,
Irv

new topic     » goto parent     » topic index » view message » categorize

7. Re: Linux Pre-Alpha #4

On Thu, 15 Jul 1999, you wrote:
> > The main new feature is that you can now
> > call C routines in Linux shared libraries.
> > It works exactly the same as in WIN32:
>
> Awesome!!  Thank you for this cool feature!  Now we can link to X-windows,
> SVGALIB, MikMod, etc.  Though to use SVGALIB, we will have to change exu to
> be setuid root so that it has permissions to mess with the graphics
> hardware.
>
> Here's a simple program that pops up a window for 5 seconds in X.
> -- x.ex

Cool! I clipped the code from your e-mail, pasted it into a blank file,
dropped the file on the exu icon, and blam! there was a window!
Gee this linux stuff is making faster progress than I expected.

Irv

new topic     » goto parent     » topic index » view message » categorize

8. Re: Linux Pre-Alpha #4

Pete Eberlein writes:
> Perhaps Netscape is interpreting the file as ascii
> instead of binary, and is adding 1.5K of formfeed chars...

I think you are right. It's probably converting all the \n's to \r\n
(on DOS/Windows at least).
I did some checking, and apparently .tgz is not a well-known
file type among Web browsers. On the other hand, .tar seems
to be well known, so I've renamed the file as euphor21.tar.
As a result, Netscape and IE both download it with a left-click,
and both are successful.

Thanks,
     Rob Craig
     Rapid Deployment Software
     http://members.aol.com/FilesEu/

new topic     » goto parent     » topic index » view message » categorize

9. Re: Linux Pre-Alpha #4

Irv Mullins writes:
> I ran callc.exu in Dave's EE, and added the obligatory
> wait_key() routine at the end (so I could see the output).
> Strangely, the previous line which prints the numbers
> 111,222...etc, doesn't print until _after_ a key is struck.
> This happens whether running in the editor, or right from
> the prompt.
> puts(1, "\n> printf test:\n")
> s = define_c_proc(libc, "printf", {C_POINTER, C_INT,
> C_DOUBLE, C_INT, C_DOUBLE})
> format = allocate_string(
> "Here are 4 numbers: %d, %.3f, %d, %e\n")
> c_proc(s, {format, 111, 222.222, 333, 444.4444})
> k = wait_key()

The output from calling C's printf() is not flushed immediately.
In this case it doesn't get flushed until the program terminates
(after wait_key()).

The output from Euphoria's puts, printf etc *is* flushed
automatically by Euphoria whenever it's going to the screen.

Another potential complication in a situation like this
is that the output is being written directly to the screen
without ncurses knowing about it. ncurses optimizes screen
writes by maintaining its own copy of what it thinks is
currently on the screen.

Regards,
     Rob Craig
     Rapid Deployment Software
     http://members.aol.com/FilesEu/

new topic     » goto parent     » topic index » view message » categorize

10. Re: Linux Pre-Alpha #4

On Sat, 17 Jul 1999, you wrote:
> Irv Mullins writes:
> > I ran callc.exu in Dave's EE, and added the obligatory
> > wait_key() routine at the end (so I could see the output).
> > Strangely, the previous line which prints the numbers
> > 111,222...etc, doesn't print until _after_ a key is struck.

> The output from calling C's printf() is not flushed immediately.
> In this case it doesn't get flushed until the program terminates
> (after wait_key()).
>
> The output from Euphoria's puts, printf etc *is* flushed
> automatically by Euphoria whenever it's going to the screen.

Thanks for the explanation. I don't see this as being a problem,
since there doesn't seem any real reason to do screen writes by
calling a c routine.  (As long as it doesn't affect other writes, such as to
files.)

Irv

new topic     » goto parent     » topic index » view message » categorize

11. Re: Linux Pre-Alpha #4

Can't you use GCC ?
Instead of using printf function can't you use IOSTREAM ?
If you can then use the I/O Manipulators endl or flush to flush the stream.
Bernie

new topic     » goto parent     » topic index » view message » categorize

12. Re: Linux Pre-Alpha #4

Why don't you call it euphor21.tar.gz like most other do? I wouldn't
recommend naming something .tar if it can't be read with tar xvf .

Another point is that extensions are not used in linux the same way
than in dos/windows. File types are recognized from contents,
not from extension. KDE has some MIME support, but it isn't
generalized yet.

Riwal Raude
rauder at thmulti.com

> -----Original Message-----
> From: Robert Craig [SMTP:rds at ATTCANADA.NET]
> Sent: Friday, July 16, 1999 6:57 AM
> To:   EUPHORIA at LISTSERV.MUOHIO.EDU
> Subject:      Re: Linux Pre-Alpha #4
>
> Pete Eberlein writes:
> > Perhaps Netscape is interpreting the file as ascii
> > instead of binary, and is adding 1.5K of formfeed chars...
>
> I think you are right. It's probably converting all the \n's to \r\n
> (on DOS/Windows at least).
> I did some checking, and apparently .tgz is not a well-known
> file type among Web browsers. On the other hand, .tar seems
> to be well known, so I've renamed the file as euphor21.tar.
> As a result, Netscape and IE both download it with a left-click,
> and both are successful.
>
> Thanks,
>      Rob Craig
>      Rapid Deployment Software
>      http://members.aol.com/FilesEu/

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu