1. exu 3, key.ex

Hi
integer code

puts(1, "Press any key. I'll show you the key code. Press q to quit\n\n")
while 1 do
    code = get_key()
    if code != -1 then
	printf(1, "The key code is: %d\n", code)
	if code = 'q' then
	    exit
	end if  
    end if
end while


works



integer code

puts(1, "Press any key. I'll show you the key code. Press q to quit\n\n")
while 1 do
    code = get_key()
    if code != -1 then
	printf(1, "The key code is: %d\n", code)
	if code = 'q' then
	    exit
	end if  
    else
        printf(1, "\n", {})          
    end if
end while


seg faults

??

Chris

new topic     » topic index » view message » categorize

2. Re: exu 3, key.ex

ChrisBurch2 wrote:
> Hi
> }}}
<eucode>
> integer code
> 
> puts(1, "Press any key. I'll show you the key code. Press q to quit\n\n")
> while 1 do
>     code = get_key()
>     if code != -1 then
> 	printf(1, "The key code is: %d\n", code)
> 	if code = 'q' then
> 	    exit
> 	end if  
>     end if
> end while
> 
> </eucode>
{{{

> 
> works
> 
> 
> }}}
<eucode>
> integer code
> 
> puts(1, "Press any key. I'll show you the key code. Press q to quit\n\n")
> while 1 do
>     code = get_key()
>     if code != -1 then
> 	printf(1, "The key code is: %d\n", code)
> 	if code = 'q' then
> 	    exit
> 	end if  
>     else
>         printf(1, "\n", {})          
>     end if
> end while
> 
> </eucode>
{{{

> 
> seg faults
> 
> ??

It fails on my machine too, creating a debug.log file as well.
It shouldn't be too hard to fix. Thanks for reporting it.
Did you also get a debug.log file? What Linux distribution 
are you using?

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

3. Re: exu 3, key.ex

Robert Craig wrote:
> 
> ChrisBurch2 wrote:
> > Hi
> > }}}
<eucode>
> > integer code
> > 
> > puts(1, "Press any key. I'll show you the key code. Press q to quit\n\n")
> > while 1 do
> >     code = get_key()
> >     if code != -1 then
> > 	printf(1, "The key code is: %d\n", code)
> > 	if code = 'q' then
> > 	    exit
> > 	end if  
> >     end if
> > end while
> > 
> > </eucode>
{{{

> > 
> > works
> > 
> > 
> > }}}
<eucode>
> > integer code
> > 
> > puts(1, "Press any key. I'll show you the key code. Press q to quit\n\n")
> > while 1 do
> >     code = get_key()
> >     if code != -1 then
> > 	printf(1, "The key code is: %d\n", code)
> > 	if code = 'q' then
> > 	    exit
> > 	end if  
> >     else
> >         printf(1, "\n", {})          
> >     end if
> > end while
> > 
> > </eucode>
{{{

> > 
> > seg faults
> > 
> > ??
> 
> It fails on my machine too, creating a debug.log file as well.
> It shouldn't be too hard to fix. Thanks for reporting it.
> Did you also get a debug.log file? What Linux distribution 
> are you using?
> 
> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>
Hi

Yes, filled with lots of line corrupted, finally s is the keycode is 105, col is
0

Linux version SuSE 10.0 64 bit

Chris

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

4. Re: exu 3, key.ex

ChrisBurch2 wrote:
> Robert Craig wrote:
> > It fails on my machine too, creating a debug.log file as well.
> > It shouldn't be too hard to fix. Thanks for reporting it.
> > Did you also get a debug.log file? What Linux distribution 
> > are you using?
> 
> Yes, filled with lots of line corrupted, finally s is the keycode is 105, col
> is 0
> 
> Linux version SuSE 10.0 64 bit

OK, thanks. I've put a fix into exu and uploaded a
new "pre-alpha-2" version here:

   http://www.rapideuphoria.com/uploads/exu

Be careful not to pick up a cached copy of
pre-alpha-1 from your browser's cache.
Also, with Internet Explorer, it seems
to want to name it exu.txt. You just have
to rename it as exu once it has been downloaded.

Thanks,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

5. Re: exu 3, key.ex

Robert Craig wrote:
> Be careful not to pick up a cached copy of
> pre-alpha-1 from your browser's cache.
> Also, with Internet Explorer, it seems
> to want to name it exu.txt. You just have
> to rename it as exu once it has been downloaded.
> 
> Thanks,
>    Rob Craig
>    Rapid Deployment Software

I only just got the pre-alpha-2 to test now.  I'm using Slackware 10.1 with 
2.4.29 kernel.  I have no problems with keymappings without curses, but the
bright colors don't come out on my console.  Also, under the official 2.5
exu, ed.ex fills my 112x30 console screen, where the no-curses version only
fills 80x25.  Besides those little quibbles, I have no complaints.

Michael Sabal

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

6. Re: exu 3, key.ex

Michael J. Sabal wrote:
> I only just got the pre-alpha-2 to test now.  I'm using Slackware 10.1 with
> 
> 2.4.29 kernel.  I have no problems with keymappings without curses, but the
> bright colors don't come out on my console.  

Yes, I'm aware of that.
I couldn't figure out how to get the brighter versions
of the colors using ANSI codes. Maybe someone has an idea.

> Also, under the official 2.5
> exu, ed.ex fills my 112x30 console screen, where the no-curses version only
> fills 80x25.  Besides those little quibbles, I have no complaints.

Yes, I'm aware of that too.
exu looks for the environment variables, LINES and COLUMNS,
which I can see when I type:
   set | more
but for some reason those variables do not show up when
I do a C getenv() call. Maybe someone has an idea there too.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

7. Re: exu 3, key.ex

~[ WingZone ]~
http://wingzone.tripod.com/




>From: Robert Craig <guest at RapidEuphoria.com>
>Reply-To: EUforum at topica.com
>To: EUforum at topica.com
>Subject: Re: exu 3, key.ex
>Date: Mon, 19 Jun 2006 19:05:18 -0700
>
>
>posted by: Robert Craig <rds at RapidEuphoria.com>
>
>Michael J. Sabal wrote:
> > I only just got the pre-alpha-2 to test now.  I'm using Slackware 10.1 
>with
> >
> > 2.4.29 kernel.  I have no problems with keymappings without curses, but 
>the
> > bright colors don't come out on my console.
>
>Yes, I'm aware of that.
>I couldn't figure out how to get the brighter versions
>of the colors using ANSI codes. Maybe someone has an idea.
>

Apparently, you need to turn Bold on.
http://pueblo.sourceforge.net/doc/manual/ansi_color_codes.html
http://en.wikipedia.org/wiki/ANSI_escape_code#Examples

> > Also, under the official 2.5
> > exu, ed.ex fills my 112x30 console screen, where the no-curses version 
>only
> > fills 80x25.  Besides those little quibbles, I have no complaints.
>
>Yes, I'm aware of that too.
>exu looks for the environment variables, LINES and COLUMNS,
>which I can see when I type:
>    set | more
>but for some reason those variables do not show up when
>I do a C getenv() call. Maybe someone has an idea there too.
>

   Um, using which shell? Maybe you need to use something different, like 
"export LINES" or "setenv LINES". I think using <LINES="25" COLUMNS="80" 
./exu> will make sure that the env vars will be available to exu (not sure 
if that works on every shell).

>Regards,
>    Rob Craig
>    Rapid Deployment Software
>    http://www.RapidEuphoria.com
>
>
>
>

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

8. Re: exu 3, key.ex

Hi,
FWIW the first code runs fine, the second loops. Both using Robs Eu 3.0
pre-alpha-2 . No segfaults.
My linux is DSL, cat /proc/version says kernel 2.6.11, gcc version 3.3.5 
(Debian 1:3.3.5-12)

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

9. Re: exu 3, key.ex

Robert Craig wrote:
> 
> Michael J. Sabal wrote:
> > I only just got the pre-alpha-2 to test now.  I'm using Slackware 10.1 with
> > 
> > 2.4.29 kernel.  I have no problems with keymappings without curses, but the
> > bright colors don't come out on my console.  
> 
> Yes, I'm aware of that.
> I couldn't figure out how to get the brighter versions
> of the colors using ANSI codes. Maybe someone has an idea.
> 
> > Also, under the official 2.5
> > exu, ed.ex fills my 112x30 console screen, where the no-curses version only
> > fills 80x25.  Besides those little quibbles, I have no complaints.
> 
> Yes, I'm aware of that too.
> exu looks for the environment variables, LINES and COLUMNS,
> which I can see when I type:
>    set | more
> but for some reason those variables do not show up when
> I do a C getenv() call. Maybe someone has an idea there too.
> 
> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>
Hi

Will this help

#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <unistd.h>

struct winsize ws;

int main()
{
char *buffer, *env;
int lines;
int rows, cols;

buffer = getenv("LINES");
if (buffer != NULL )
    printf("LINES are %s\n", buffer);
//lines = atoi("400");
//printf("Lines number :%d\n", lines);

if (ioctl(1, TIOCGWINSZ, &ws) == -1) 
	{
	rows = 24;
	cols = 80;
	} 
else 
	{
	if (!ioctl(STDIN_FILENO, TIOCGWINSZ, &ws)) 
		{
		 rows = ws.ws_row;
		 cols = ws.ws_col;
		 if (!rows) 
			 {
			  env = getenv("LINES");
			  if (env)
				rows = atoi(env);
			  if (!rows)
				rows = 24;
		     }
		if (!cols) 
			{
			 env = getenv("COLUMNS");
			 if (env)
				cols = atoi(env);
			 if (!cols)
				cols = 80;
		    }
		}
	}

if (!rows) 
	{
	env = getenv("LINES");
	if (env)
		rows = atoi(env);
	if (!rows)
		rows = 24;
	}

if (!cols) 
	{
	env = getenv("COLUMNS");
	if (env)
		cols = atoi(env);
	if (!cols)
		cols = 80;
	}

printf("%d %d\n", rows, cols);

printf("Program completed successfully\n");

}


Note, this was trawled off the net, and involves very little in the way of
personal knowledge


Chris



http://members.aol.com/chriscrylex/euphoria.htm
http://uboard.proboards32.com/
http://members.aol.com/chriscrylex/EUSQLite/eusql.html

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

10. Re: exu 3, key.ex

Elliott S. de Andrade wrote:
> Robert Craig wrote:
> > I couldn't figure out how to get the brighter versions
> > of the colors using ANSI codes. Maybe someone has an idea.
> 
> Apparently, you need to turn Bold on.
> <a
> href="http://pueblo.sourceforge.net/doc/manual/ansi_color_codes.html">http://pueblo.sourceforge.net/doc/manual/ansi_color_codes.html</a>
> <a
> href="http://en.wikipedia.org/wiki/ANSI_escape_code#Examples">http://en.wikipedia.org/wiki/ANSI_escape_code#Examples</a>

That worked. Excellent. Thanks.
The bright colors now appear.
You can download exu pre-alpha-3 for Linux from:
  
    http://www.rapideuphoria.com/uploads/exu

(I'm still investigating the LINES & COLUMNS environment issue)

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

11. Re: exu 3, key.ex

Robert Craig wrote:
> 
> Elliott S. de Andrade wrote:
> > Robert Craig wrote:
> > > I couldn't figure out how to get the brighter versions
> > > of the colors using ANSI codes. Maybe someone has an idea.
> > 
> > Apparently, you need to turn Bold on.
> > <a
> > href="http://pueblo.sourceforge.net/doc/manual/ansi_color_codes.html">http://pueblo.sourceforge.net/doc/manual/ansi_color_codes.html</a>
> > <a
> > href="http://en.wikipedia.org/wiki/ANSI_escape_code#Examples">http://en.wikipedia.org/wiki/ANSI_escape_code#Examples</a>
> 
> That worked. Excellent. Thanks.
> The bright colors now appear.
> You can download exu pre-alpha-3 for Linux from:
>   
>     <a
>     href="http://www.rapideuphoria.com/uploads/exu">http://www.rapideuphoria.com/uploads/exu</a>
> 
> (I'm still investigating the LINES & COLUMNS environment issue)
> 
> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>

Will this help

#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <unistd.h>

struct winsize ws;

int main()
{
char *buffer, *env;
int lines;
int rows, cols;

buffer = getenv("LINES");
if (buffer != NULL )
    printf("LINES are %s\n", buffer);
//lines = atoi("400");
//printf("Lines number :%d\n", lines);

if (ioctl(1, TIOCGWINSZ, &ws) == -1) 
	{
	rows = 24;
	cols = 80;
	} 
else 
	{
	if (!ioctl(STDIN_FILENO, TIOCGWINSZ, &ws)) 
		{
		 rows = ws.ws_row;
		 cols = ws.ws_col;
		 if (!rows) 
			 {
			  env = getenv("LINES");
			  if (env)
				rows = atoi(env);
			  if (!rows)
				rows = 24;
		     }
		if (!cols) 
			{
			 env = getenv("COLUMNS");
			 if (env)
				cols = atoi(env);
			 if (!cols)
				cols = 80;
		    }
		}
	}

if (!rows) 
	{
	env = getenv("LINES");
	if (env)
		rows = atoi(env);
	if (!rows)
		rows = 24;
	}

if (!cols) 
	{
	env = getenv("COLUMNS");
	if (env)
		cols = atoi(env);
	if (!cols)
		cols = 80;
	}

printf("%d %d\n", rows, cols);

printf("Program completed successfully\n");

}


Note, this was trawled off the net, and involves very little in the way of
personal
knowledge


Chris


http://members.aol.com/chriscrylex/euphoria.htm
http://uboard.proboards32.com/
http://members.aol.com/chriscrylex/EUSQLite/eusql.html

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

12. Re: exu 3, key.ex

Well, does it help, if not its easy enough to compile it into a shared library
which will even give dynamic console size updates.

Chris

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

13. Re: exu 3, key.ex

Chris Burch wrote:
> Will this help
> 
> #include <stdio.h>
> #include <stdlib.h>
> #include <sys/ioctl.h>
> #include <unistd.h>
> 
> struct winsize ws;
> 
> int main()
> {
> char *buffer, *env;
> int lines;
> int rows, cols;
> 
> buffer = getenv("LINES");
> if (buffer != NULL )
>     printf("LINES are %s\n", buffer);
> //lines = atoi("400");
> //printf("Lines number :%d\n", lines);
> 
> if (ioctl(1, TIOCGWINSZ, &ws) == -1) 
> 	{
> 	rows = 24;
> 	cols = 80;
> 	} 
> else 
> 	{
> 	if (!ioctl(STDIN_FILENO, TIOCGWINSZ, &ws)) 
> 		{
> 		 rows = ws.ws_row;
> 		 cols = ws.ws_col;
> 		 if (!rows) 
> 			 {
> 			  env = getenv("LINES");
> 			  if (env)
> 				rows = atoi(env);
> 			  if (!rows)
> 				rows = 24;
> 		     }
> 		if (!cols) 
> 			{
> 			 env = getenv("COLUMNS");
> 			 if (env)
> 				cols = atoi(env);
> 			 if (!cols)
> 				cols = 80;
> 		    }
> 		}
> 	}
> 
> if (!rows) 
> 	{
> 	env = getenv("LINES");
> 	if (env)
> 		rows = atoi(env);
> 	if (!rows)
> 		rows = 24;
> 	}
> 
> if (!cols) 
> 	{
> 	env = getenv("COLUMNS");
> 	if (env)
> 		cols = atoi(env);
> 	if (!cols)
> 		cols = 80;
> 	}
> 
> printf("%d %d\n", rows, cols);
> 
> printf("Program completed successfully\n");
> 
> }

Yes, it works! Thanks a lot. That code will be very useful.
It's actually the ioctl call that successfully picks up
the lines and columns. As I had found earlier, getenv() 
doesn't retrieve these variables. Though, if I say:
    export LINES
    export COLUMNS
before running the program, then getenv() does work. (Thanks Elliott).
But that's a bit inconvenient.

Sorry for the long delay in testing your code and replying.
I had a lot of distractions lately (such as watching Saw II smile).

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

14. Re: exu 3, key.ex

Robert Craig wrote:
> Yes, it works! Thanks a lot. That code will be very useful.
> It's actually the ioctl call that successfully picks up
> the lines and columns. As I had found earlier, getenv() 
> doesn't retrieve these variables. Though, if I say:
>     export LINES
>     export COLUMNS
> before running the program, then getenv() does work. (Thanks Elliott).
> But that's a bit inconvenient.

OK, a new version of exu, that recognizes the size of the
text window, is now available as pre-alpha-4:

    http://www.rapideuphoria.com/uploads/exu

For instance, ed will automatically give you more lines and 
more columns, if available.

It looks for LINES and COLUMNS first, then tries ioctl(),
then defaults to 24x80 if all else fails. On the two systems
I tried, it picked up the size correctly.

I think that eliminates the last deficiency of the new exu
(doesn't use ncurses) versus 2.5 (needs ncurses).

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

15. Re: exu 3, key.ex

Robert Craig wrote:

> 
> OK, a new version of exu, that recognizes the size of the
> text window, is now available as pre-alpha-4:
> 
>     <a
>     href="http://www.rapideuphoria.com/uploads/exu">http://www.rapideuphoria.com/uploads/exu</a>
> 
> For instance, ed will automatically give you more lines and 
> more columns, if available.
> 
> It looks for LINES and COLUMNS first, then tries ioctl(),
> then defaults to 24x80 if all else fails. On the two systems
> I tried, it picked up the size correctly.
> 
> I think that eliminates the last deficiency of the new exu
> (doesn't use ncurses) versus 2.5 (needs ncurses).
> 
> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>

The only glitch I notice with pre-alpha-4 is that lines longer than 80
don't seem to scroll... look at the 2nd line below.


-- or
--     exwc ed.ex (quicker response but some control-key combinations aren't rec
--                                                                             
ognized)
-- How it Works:

I'm using Konsole under Fluxbox, SUSE 10.0.  



Ken Rhodes
Folding at Home: http://folding.stanford.edu/
100% MicroSoft Free
SuSE Linux 10.0
No AdWare, SpyWare, or Viruses!
Life is Good,  smile

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

16. Re: exu 3, key.ex

Kenneth Rhodes wrote:
> The only glitch I notice with pre-alpha-4 is that lines longer than 80
> don't seem to scroll... look at the 2nd line below.

Whoops... I had hard-coded an "80" in one place, 
instead of "col_max". You can now download pre-alpha-5:

   http://www.rapideuphoria.com/uploads/exu

(be careful - pre-alpha-4 might be in your browser's cache.)

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

17. Re: exu 3, key.ex

Robert Craig wrote:
> 
> Kenneth Rhodes wrote:
> > The only glitch I notice with pre-alpha-4 is that lines longer than 80
> > don't seem to scroll... look at the 2nd line below.
> 
> Whoops... I had hard-coded an "80" in one place, 
> instead of "col_max". You can now download pre-alpha-5:
> 
>    <a
>    href="http://www.rapideuphoria.com/uploads/exu">http://www.rapideuphoria.com/uploads/exu</a>
> 
> (be careful - pre-alpha-4 might be in your browser's cache.)
> 
> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>

Thats what I call a quick fix!  blink  pre-alph-5 scrolls 80+ character lines
correctly now.

Thanks,

Ken Rhodes
Folding at Home: http://folding.stanford.edu/
100% MicroSoft Free
SuSE Linux 10.0
No AdWare, SpyWare, or Viruses!
Life is Good,  smile

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

18. Re: exu 3, key.ex

Robert Craig wrote:
> 
> Kenneth Rhodes wrote:
> > The only glitch I notice with pre-alpha-4 is that lines longer than 80
> > don't seem to scroll... look at the 2nd line below.
> 
> Whoops... I had hard-coded an "80" in one place, 
> instead of "col_max". You can now download pre-alpha-5:
> 

Rob,

Could you investigate this issue for windows (or maybe changing that 
hard code will fix it)?  I often use a wider console, and scrolling text
can be a problem.

Matt Lewis

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

19. Re: exu 3, key.ex

Matt Lewis wrote:
> 
> Robert Craig wrote:
> > 
> > Kenneth Rhodes wrote:
> > > The only glitch I notice with pre-alpha-4 is that lines longer than 80
> > > don't seem to scroll... look at the 2nd line below.
> > 
> > Whoops... I had hard-coded an "80" in one place, 
> > instead of "col_max". You can now download pre-alpha-5:
> > 
> 
> Rob,
> 
> Could you investigate this issue for windows (or maybe changing that 
> hard code will fix it)?  I often use a wider console, and scrolling text
> can be a problem.

Yes, I think I'm assuming 80 for a Windows console 
somewhere in the code. I already have this as an item to fix 
for the next release. Thanks for reminding me.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

Search



Quick Links

User menu

Not signed in.

Misc Menu