Re: RDMS Database's and/or Record Managers What good is Euphoria?

new topic     » topic index » view thread      » older message » newer message

This is a multi-part message in MIME format.
--------------040908020200040303020701

Kat wrote:

>Besides, for R&D purposes, my purposes, for this moment, right now, not 
>necessarily appropriate for you, i prefer they stay in a human-readable form. 
>Making them fixed-anything, or coded, or anysuch munging would just make 
>things more difficult for me right now.
>
>  
I see that. There is another option, though, which is to create a 
database system that has a GUI tool for editing and viewing. That's what 
I've been working on for a video game system (the project, a sprite 
based RTS, for which has almost fallen apart, and wasn't writing in 
Euphoria or I'd just post the source for people to play with).

>>>contents are not fixed in any way or form. 
>>>
>>>      
>>For a business application, that could be a bad thing, though personally 
>>I do like flexibility to add fields to records, etc.
>>    
>>
>To each their own solution.
>  
>
To each *project*, yes. But we all, as developers and designers, have to 
be flexible enough to use both. Sometimes fixed records are better, 
sometimes flexible records are better.

> 
>  
>>>If i turn her lose, there is no way 
>>>the 5 gigs of data can be put in a Eu sequence in memory,, i'd need 20gig to
>>>load it, and another 40gig to manipulate it, and i don't have the money to
>>>waste like that. How you store and access the data on the drive is not
>>>strtok's
>>>business. 
>>> 
>>>
>>It should be, because serious databases have most of their data on the 
>>HDD most of the time.
>>    
>>
>I didn't write the disk access methods, or the memory storage methods, 
>used by euphoria programs. And i didn't say the strtok lib made up a whole 
>and complete database "system".
>  
>
Alright, well, thank you for repeating yourself, but I think I'll 
clarify what I meant anyway.

A database more or less *directly* accesses it's data files. It doesn't 
keep everything in memory, so it's important that the disk access 
methods used to write and read Euphoria objects are part of the database 
system.

Basically, a database system written in Euphoria should use nothing but 
**get_bytes* <cid:part1.02020800.09030803 at blueapples.org>* to read it's 
data. [By the way, does that link work for everyone with an HTML browser?]*
*

> 
>
>Besides, not much happens quickly on a multitasking OS like win95 on a 
>233mhz cpu. I am sure it would have done faster on dos32. And the time i 
>quoted was one file, of one megabyte, not a small file on a database of 1 
>million records. The small file in one million records would have been read 
>much much faster. Heck, using an direct windoze api call would have been 
>much faster.
>  
>
I was talking about doing searches over multi megabyte or even gigabyte 
databases in milliseconds.

> 
>  
>>Through all of this discussion, please keep in mind that I am talking 
>>about truly massive databases. At least thousands of records.
>>    
>>
>Really, "at least thousands"? Let me look at harddrive T:/ here....
>3.4 Gigabytes, 353,815 "records" in 1,185 "folders".
> 
>
>The Eu plugin for mirc could open 15 "folders", read in one record from each, 
>parse out a field from each record, parse out the fields in that field, and 
>display the data almost before i could get my finger off the <enter> key. I 
>was doing natural language parsing with 150,000+ "records", each with 
>multiply nested "sub-records". I used getxml() heavily, which isn't in the 
>current release of strtok, no one was interested in it. To get carried away, my
>
>translator files have outgrown the 2 gigabyte partition they started out on. Is
>
>2Gigs a big enough database for you to consider "massive"? That's E:/. One 
>of it's "records" has 355,742 "sub-records". How about if you add the 
>aforementioned T:/ to E:/? What if you toss in F:/ with it's 4.6 Gigs of data
>(in
>105,052 "records" )?
>  
>
I didn't follow any of this. Are you talking about NTFS or Linux 
partitions with files on them? I have an 80 gig hard drive in my laptop, 
and it takes forever to search because of the way the file system was 
created. If it where a database, as it will be in Longhorn (The crowd 
shudders at the mention of the name of Evil.), it'd be almost instant. 
Indexing service doesn't help either, with is somewhat similar to adding 
indexing to an existing file storage system such as EDS.

><kat> apa khabar?
><[Tiggr]> all's kool here smile
>
>  
>>>YMMV
>>> 
>>>
>>Forgive me, I don't understand this... ?
>>    
>>
><kat> Tiggr, can you tell me what YMMV means?
><[Tiggr]> Your Mileage May Vary
>
>
>Kat,
>just luvs it when people feel the need to explain such simple concepts as 
>"massive" to her. none
>( say something Lomax.... )
>  
>
Don't get mean. I was trying to be clear.


~ Isaac


--------------040908020200040303020701
Content-Type: multipart/related;
 boundary="------------070000050804060706000906"


--------------070000050804060706000906
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body>
Kat wrote:<br>
<blockquote type="cite"
 cite="mid990583183-1463792638-1074859139 at boing.topica.com">
  <pre wrap="">
Besides, for R&amp;D purposes, my purposes, for this moment, right now, not 
necessarily appropriate for you, i prefer they stay in a human-readable form. 
Making them fixed-anything, or coded, or anysuch munging would just make 
things more difficult for me right now.

  </pre>
</blockquote>
I see that. There is another option, though, which is to create a
database system that has a GUI tool for editing and viewing. That's
what I've been working on for a video game system (the project, a
sprite based RTS, for which has almost fallen apart, and wasn't writing
in Euphoria or I'd just post the source for people to play with).<br>
<blockquote type="cite"
 cite="mid990583183-1463792638-1074859139 at boing.topica.com">
  <pre wrap=""></pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <pre wrap="">contents are not fixed in any way or form. 

      </pre>
    </blockquote>
<pre wrap="">For a business application, that could be a bad thing, though
    personally
I do like flexibility to add fields to records, etc.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
To each their own solution.
  </pre>
</blockquote>
To each *project*, yes. But we all, as developers and designers, have
to be flexible enough to use both. Sometimes fixed records are better,
sometimes flexible records are better.<br>
<blockquote type="cite"
 cite="mid990583183-1463792638-1074859139 at boing.topica.com">
  <pre wrap=""> 
  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <pre wrap="">If i turn her lose, there is no way 
the 5 gigs of data can be put in a Eu sequence in memory,, i'd need 20gig to
load it, and another 40gig to manipulate it, and i don't have the money to
waste like that. How you store and access the data on the drive is not strtok's
business. 
 

      </pre>
    </blockquote>
<pre wrap="">It should be, because serious databases have most of their data
    on the
HDD most of the time.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
I didn't write the disk access methods, or the memory storage methods, 
used by euphoria programs. And i didn't say the strtok lib made up a whole 
and complete database "system".
  </pre>
</blockquote>
Alright, well, thank you for repeating yourself, but I think I'll
clarify what I meant anyway.<br>
<br>
A database more or less *directly* accesses it's data files. It doesn't
keep everything in memory, so it's important that the disk access
methods used to write and read Euphoria objects are part of the
database system.<br>
<br>
Basically, a database system written in Euphoria should use nothing but
<b><a href="cid:part1.02020800.09030803 at
blueapples.org"><b>get_bytes</b></a></b>
to read it's data. [By the way, does that link work for everyone with
an HTML browser?]<b><br>
</b>
<blockquote type="cite"
 cite="mid990583183-1463792638-1074859139 at boing.topica.com">
  <pre wrap=""> 

Besides, not much happens quickly on a multitasking OS like win95 on a 
233mhz cpu. I am sure it would have done faster on dos32. And the time i 
quoted was one file, of one megabyte, not a small file on a database of 1 
million records. The small file in one million records would have been read 
much much faster. Heck, using an direct windoze api call would have been 
much faster.
  </pre>
</blockquote>
I was talking about doing searches over multi megabyte or even gigabyte
databases in milliseconds.<br>
<blockquote type="cite"
 cite="mid990583183-1463792638-1074859139 at boing.topica.com">
  <pre wrap=""> 
  </pre>
  <blockquote type="cite">
<pre wrap="">Through all of this discussion, please keep in mind that I am
    talking
about truly massive databases. At least thousands of records.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Really, "at least thousands"? Let me look at harddrive T:/ here....
3.4 Gigabytes, 353,815 "records" in 1,185 "folders".
 

The Eu plugin for mirc could open 15 "folders", read in one record from each, 
parse out a field from each record, parse out the fields in that field, and 
display the data almost before i could get my finger off the &lt;enter&gt; key.
I
was doing natural language parsing with 150,000+ "records", each with 
multiply nested "sub-records". I used getxml() heavily, which isn't in the 
current release of strtok, no one was interested in it. To get carried away, my 
translator files have outgrown the 2 gigabyte partition they started out on. Is 
2Gigs a big enough database for you to consider "massive"? That's E:/. One 
of it's "records" has 355,742 "sub-records". How about if you add the 
aforementioned T:/ to E:/? What if you toss in F:/ with it's 4.6 Gigs of data
(in
105,052 "records" )?
  </pre>
</blockquote>
I didn't follow any of this. Are you talking about NTFS or Linux
partitions with files on them? I have an 80 gig hard drive in my
laptop, and it takes forever to search because of the way the file
system was created. If it where a database, as it will be in Longhorn
(The crowd shudders at the mention of the name of Evil.), it'd be
almost instant. Indexing service doesn't help either, with is somewhat
similar to adding indexing to an existing file storage system such as
EDS.<br>
<blockquote type="cite"
 cite="mid990583183-1463792638-1074859139 at boing.topica.com">
  <pre wrap="">
&lt;kat&gt; apa khabar?
&lt;[Tiggr]&gt; all's kool here smile

  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <pre wrap="">YMMV
 

      </pre>
    </blockquote>
    <pre wrap="">Forgive me, I don't understand this... ?
    </pre>
  </blockquote>
  <pre wrap=""><!---->
&lt;kat&gt; Tiggr, can you tell me what YMMV means?
&lt;[Tiggr]&gt; Your Mileage May Vary


Kat,
just luvs it when people feel the need to explain such simple concepts as 
"massive" to her. none
( say something Lomax.... )
  </pre>
</blockquote>
Don't get mean. I was trying to be clear.<br>
<br>
<br>
~ Isaac<br>
<br>

--------------070000050804060706000906
Content-Type: text/html; charset=ISO-8859-1;
 name="lib_e_g.htm"
Content-Transfer-Encoding: 7bit
Content-ID: <part1.02020800.09030803 at blueapples.org>
Content-Disposition: inline;
 filename="lib_e_g.htm"

<!-- GENERATED BY A EUPHORIA PROGRAM. DO NOT EDIT! -->


<html>
<head><title>Euphoria v2.4 Reference Manual Part II - Section 3</title>
<style type="text/css">
<!--
body        {background-color: "#FFFFFF";}
a           {text-decoration: none;}
a:link      {color: "#0033BB"; text-decoration: underline;}
a:visited   {color: "#006699"; text-decoration: underline;}
a:active    {color: red; text-decoration: underline;}
a:hover     {color: red; text-decoration: underline;}
a.blue    {text-decoration: none;}
a.blue:link      {color: "#5500FF"; text-decoration: underline;}
a.blue:visited   {color: "#5500FF"; text-decoration: underline;}
a.blue:active    {color: red; text-decoration: underline;}
a.blue:hover     {color: red; text-decoration: underline;}
a.brown      {text-decoration: none;}
a.brown:link      {color: "#993333"; text-decoration: underline;}
a.brown:visited   {color: "#993333"; text-decoration: underline;}
a.brown:active    {color: red; text-decoration: underline;}
a.brown:hover     {color: red; text-decoration: underline;}
-->
</style>

</head>
<body bgcolor="#FFFFFF" link="#0033BB" vlink="#006699">
<br>


<a name=ellipse></a><font color="#006633" size=+2><br>
<center><b>ellipse</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Platform:</b></td>
<td><font color="#CC3366"><b>DOS32</b></font>
</td></tr>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> include graphics.e<BR>
 ellipse(i1, i2, s1, s2)
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>Draw an ellipse with color i1 on a
 <font color="#CC3366">pixel-graphics</font> screen. The
 ellipse will neatly fit inside the rectangle defined by diagonal
 points s1 {x1, y1} and s2 {x2, y2}. If the rectangle is a square
 then the ellipse will be a circle. Fill the ellipse when i2 is 1.
 Don't fill when i2 is 0. 
</td></tr>

<tr><td valign=top><b>Example:</b></td>
<td>
</td></tr>

<tr><td></td><td>
<pre><font color="#330033">ellipse(MAGENTA, 0, </font><font
color="#993333">{</font><font color="#330033">10, 10</font><font
color="#993333">}</font><font color="#330033">, </font><font
color="#993333">{</font><font color="#330033">20, 20</font><font
color="#993333">}</font><font color="#330033">)</font>
<font color="#330033"></font>
<font color="#FF0055">-- This would make a magenta colored circle just
fitting</font>
<font color="#FF0055">-- inside the square: </font>
<font color="#FF0055">--        {10, 10}, {10, 20}, {20, 20}, {20, 10}.</font>
<font color="#330033"></font>
</pre></td></tr>

<tr><td valign=top><b>Example Program:</b></td>
<td><font color="#5500FF"><b>demo\dos32\sb.ex</b></font>
</td></tr>


 <tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_p_r.htm#polygon">polygon</a>,
<a href="lib_c_d.htm#draw_line">draw_line</a>
</td></tr>

</table>


<a name=equal></a><font color="#006633" size=+2><br>
<center><b>equal</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> i = equal(x1, x2)
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>  Compare two Euphoria objects to see if they are the same.
 Return 1 (true) if they are the same. Return 0 (false) if
 they are different. 
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td> This is equivalent to the expression: <b>compare(x1, x2) = 0</b>
 
</td></tr>

<tr><td valign=top><b>Example 1:</b></td>
<td>
</td></tr>

<tr><td></td><td>
<pre><font color="#0000FF">if </font><font color="#FF00FF">equal</font><font
color="#330033">(PI, 3.14) </font><font color="#0000FF">then</font>
<font color="#FF00FF">    puts</font><font color="#330033">(1, </font><font
color="#00A033">"give me a better value for PI!\n"</font><font
color="#330033">)</font>
<font color="#0000FF">end if</font>
<font color="#330033"></font>
</pre></td></tr>

<tr><td valign=top><b>Example 2:</b></td>
<td>
</td></tr>

<tr><td></td><td>
<pre><font color="#0000FF">if </font><font color="#FF00FF">equal</font><font
color="#330033">(name, </font><font color="#00A033">"George"</font><font
color="#330033">) </font><font color="#0000FF">or </font><font
color="#FF00FF">equal</font><font color="#330033">(name, </font><font
color="#00A033">"GEORGE"</font><font color="#330033">) </font><font
color="#0000FF">then</font>
<font color="#FF00FF">    puts</font><font color="#330033">(1, </font><font
color="#00A033">"name is George\n"</font><font color="#330033">)</font>
<font color="#0000FF">end if</font>
<font color="#330033"></font>
</pre></td></tr>

<tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_c_d.htm#compare">compare</a>,
               <a href="refman_2.htm#23">equals operator (=)</a>
</td></tr>

</table>


<a name=find></a><font color="#006633" size=+2><br>
<center><b>find</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> i = find(x, s)
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>  Find x as an element of s. If successful, return the index
 of the first element of s that matches. If unsuccessful
 return 0. 
</td></tr>

<tr><td valign=top><b>Example 1:</b></td>
<td>
</td></tr>

<tr><td></td><td>
<pre><font color="#330033">location = </font><font
color="#FF00FF">find</font><font color="#330033">(11, </font><font
color="#993333">{</font><font color="#330033">5, 8, 11, 2, 3</font><font
color="#993333">}</font><font color="#330033">)</font>
<font color="#FF0055">-- location is set to 3</font>
<font color="#330033"></font>
</pre></td></tr>

<tr><td valign=top><b>Example 2:</b></td>
<td>
</td></tr>

<tr><td></td><td>
<pre><font color="#330033">names = {</font><font
color="#00A033">"fred"</font><font color="#330033">, </font><font
color="#00A033">"rob"</font><font color="#330033">, </font><font
color="#00A033">"george"</font><font color="#330033">, </font><font
color="#00A033">"mary"</font><font color="#330033">, </font><font
color="#00A033">""</font><font color="#330033">}</font>
<font color="#330033">location = </font><font color="#FF00FF">find</font><font
color="#330033">(</font><font color="#00A033">"mary"</font><font
color="#330033">, names)</font>
<font color="#FF0055">-- location is set to 4</font>
<font color="#330033"></font>
</pre></td></tr>

<tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_h_o.htm#match">match</a>,
<a href="lib_c_d.htm#compare">compare</a>
</td></tr>

</table>


<a name=float32_to_atom></a><font color="#006633" size=+2><br>
<center><b>float32_to_atom</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> include machine.e<BR>
 a1 = float32_to_atom(s)
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>  Convert a sequence of 4 bytes to an atom. These 4 bytes must
 contain an IEEE floating-point number in 32-bit format. 
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td> Any 32-bit IEEE floating-point number can be converted to an
 atom.
 
</td></tr>

<tr><td valign=top><b>Example:</b></td>
<td>
</td></tr>

<tr><td></td><td>
<pre><font color="#330033">f = </font><font color="#FF00FF">repeat</font><font
color="#330033">(0, 4)</font>
<font color="#330033">fn = </font><font color="#FF00FF">open</font><font
color="#330033">(</font><font color="#00A033">"numbers.dat"</font><font
color="#330033">, </font><font color="#00A033">"rb"</font><font color="#330033">)
</font><font color="#FF0055">-- read binary</font>
<font color="#330033">f[1] = </font><font color="#FF00FF">getc</font><font
color="#330033">(fn)</font>
<font color="#330033">f[2] = </font><font color="#FF00FF">getc</font><font
color="#330033">(fn)</font>
<font color="#330033">f[3] = </font><font color="#FF00FF">getc</font><font
color="#330033">(fn)</font>
<font color="#330033">f[4] = </font><font color="#FF00FF">getc</font><font
color="#330033">(fn)</font>
<font color="#330033">a = float32_to_atom(f)</font>
<font color="#330033"></font>
</pre></td></tr>

<tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_e_g.htm#float64_to_atom">float64_to_atom</a>,
<a href="lib_a_b.htm#atom_to_float32">atom_to_float32</a>
</td></tr>

</table>


<a name=float64_to_atom></a><font color="#006633" size=+2><br>
<center><b>float64_to_atom</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> include machine.e<BR>
 a1 = float64_to_atom(s)
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>  Convert a sequence of 8 bytes to an atom. These 8 bytes must
 contain an IEEE floating-point number in 64-bit format. 
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td> Any 64-bit IEEE floating-point number can be converted to an
 atom.
 
</td></tr>

<tr><td valign=top><b>Example:</b></td>
<td>
</td></tr>

<tr><td></td><td>
<pre><font color="#330033">f = </font><font color="#FF00FF">repeat</font><font
color="#330033">(0, 8)</font>
<font color="#330033">fn = </font><font color="#FF00FF">open</font><font
color="#330033">(</font><font color="#00A033">"numbers.dat"</font><font
color="#330033">, </font><font color="#00A033">"rb"</font><font color="#330033">)
 </font><font color="#FF0055">-- read binary</font>
<font color="#0000FF">for </font><font color="#330033">i = 1 </font><font
color="#0000FF">to </font><font color="#330033">8 </font><font
color="#0000FF">do</font>
<font color="#330033">    f[i] = </font><font color="#FF00FF">getc</font><font
color="#330033">(fn)</font>
<font color="#0000FF">end for</font>
<font color="#330033">a = float64_to_atom(f)</font>
<font color="#330033"></font>
</pre></td></tr>

<tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_e_g.htm#float32_to_atom">float32_to_atom</a>,
<a href="lib_a_b.htm#atom_to_float64">atom_to_float64</a>
</td></tr>

</table>


<a name=floor></a><font color="#006633" size=+2><br>
<center><b>floor</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> x2 = floor(x1)
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>  Return the greatest integer less than or equal to x1. (Round
 down to an integer.) 
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td> This function may be applied to an atom or to all elements
 of a sequence.
 
</td></tr>

<tr><td valign=top><b>Example:</b></td>
<td>
</td></tr>

<tr><td></td><td>
<pre><font color="#330033">y = </font><font color="#FF00FF">floor</font><font
color="#330033">(</font><font color="#993333">{</font><font color="#330033">0.5,
-1.6, 9.99, 100</font><font color="#993333">}</font><font
color="#330033">)</font>
<font color="#FF0055">-- y is {0, -2, 9, 100}</font>
<font color="#330033"></font>
</pre></td></tr>

<tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_p_r.htm#remainder">remainder</a>
</td></tr>

</table>


<a name=flush></a><font color="#006633" size=+2><br>
<center><b>flush</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> include file.e<BR>flush(fn)
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>When you write data to a file, Euphoria normally stores the data
in a memory buffer until a large enough chunk of data has accumulated. 
This large chunk can then be written to disk very efficiently. 
Sometimes you may want to force, or flush, all data out immediately, 
even if the memory buffer is not full. To do this you must call flush(fn),
where fn is the file number of a file open for writing or appending.
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td>When a file is closed, (see close()), all buffered data is flushed out. 
 When a program terminates, all open files are flushed and closed 
 automatically. <P>Use flush() when another process may need to
 see all of the data written so far, but you aren't ready
  to close the file yet.
</td></tr>


<tr><td valign=top><b>Example:</b></td>
<td>
</td></tr>

<tr><td></td><td>
<pre><font color="#330033">f = </font><font color="#FF00FF">open</font><font
color="#330033">(</font><font color="#00A033">"logfile"</font><font
color="#330033">, </font><font color="#00A033">"w"</font><font
color="#330033">)</font>
<font color="#FF00FF">puts</font><font color="#330033">(f, </font><font
color="#00A033">"Record#1\n"</font><font color="#330033">)</font>
<font color="#FF00FF">puts</font><font color="#330033">(1, </font><font
color="#00A033">"Press Enter when ready\n"</font><font color="#330033">)</font>
<font color="#330033"></font>
<font color="#330033">flush(f)  </font><font color="#FF0055">-- This forces
"Record #1" into "logfile" on disk.</font>
<font color="#FF0055">          -- Without this, "logfile" will appear to have
</font>
<font color="#FF0055">          -- 0 characters when we stop for keyboard
input.</font>
<font color="#330033"></font>
<font color="#330033">s = </font><font color="#FF00FF">gets</font><font
color="#330033">(0) </font><font color="#FF0055">-- wait for keyboard
input</font>
<font color="#330033"></font>
</pre></td></tr>

<tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_c_d.htm#close">close</a>,
               <a href="lib_h_o.htm#lock_file">lock_file</a>
</td></tr>

</table>


<a name=free></a><font color="#006633" size=+2><br>
<center><b>free</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> include machine.e<BR>
 free(a)
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>  Free up a previously allocated block of memory by specifying the
 address of the start of the block, i.e. the address that was
 returned by allocate(). 
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td> Use free() to recycle blocks of memory during execution. This
 will reduce the chance of running out of memory or getting into
 excessive virtual memory swapping to disk. Do not reference
 a block of memory that has been freed. When your program
 terminates, all allocated memory will be returned to the system.
<P>
Do not use free() to deallocate memory that was allocated using
 <a href="lib_a_b.htm#allocate_low">allocate_low()</a>.
 Use free_low() for this purpose.
</td></tr>

<tr><td valign=top><b>Example Program:</b></td>
<td><font color="#5500FF"><b>demo\callmach.ex</b></font>
</td></tr>


 <tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_a_b.htm#allocate">allocate</a>,
<a href="lib_e_g.htm#free_low">free_low</a>
</td></tr>

</table>


<a name=free_console></a><font color="#006633" size=+2><br>
<center><b>free_console</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Platform:</b></td>
<td><font color="#CC3366"><b>WIN32, Linux, FreeBSD</b></font>
</td></tr>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> include dll.e<BR>
 free_console()
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>Free (delete) any console window associated with your program.
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td>Euphoria will create a console <font color="CC3366">text</font> window
 for your program the first time that your program prints something to the
 screen, reads something from the keyboard, or in some way needs a
 console (similar to a DOS-prompt window). On WIN32 this window will
 automatically disappear when your program terminates, but you
 can call free_console() to make it disappear sooner. On Linux or FreeBSD, 
 the text mode console is always there, but an xterm window will disappear
 after Euphoria issues a "Press Enter" prompt at the end of execution.

<p>
 On Linux or FreeBSD, free_console()
 will set the terminal parameters back to normal, undoing the effect
 that curses has on the screen.
<p>
In a Linux or FreeBSD xterm window, a call to free_console(), without any
further printing to the screen or reading from the keyboard, will eliminate
the "Press Enter" prompt that Euphoria normally issues at 
the end of execution.
<P>
After freeing the console window, you can create a new console
 window by printing something to the screen, or simply calling
 clear_screen(), <a href="lib_p_r.htm#position">position()</a> or any
 other routine that needs a console.
<P>
When you use the <font color="#993333"><b>trace</b></font> facility,
 or when your program has an
 error, Euphoria will automatically create a console window
 to display trace information, error messages etc.
<P>
There's a WIN32 API routine, FreeConsole() that does something
 similar to free_console(). You should use free_console(),
 because it lets the interpreter know that there is no longer
 a console.
</td></tr>

<tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_c_d.htm#clear_screen">clear_screen</a>,
 <a class="blue" href="platform.htm#win32plat"><b>platform.doc</b>
 </a>
</td></tr>

</table>


<a name=free_low></a><font color="#006633" size=+2><br>
<center><b>free_low</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Platform:</b></td>
<td><font color="#CC3366"><b>DOS32</b></font>
</td></tr>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> include machine.e<BR>
 free_low(i)
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>  Free up a previously allocated block of conventional memory by
 specifying the address of the start of the block, i.e. the
 address that was returned by allocate_low(). 
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td> Use free_low() to recycle blocks of conventional memory during
 execution. This will reduce the chance of running out of
 conventional memory. Do not reference a block of memory that has
 been freed. When your program terminates, all allocated memory
 will be returned to the system.
<P>
Do not use free_low() to deallocate memory that was allocated using
 <a href="lib_a_b.htm#allocate">allocate()</a>. Use free() for this purpose.
</td></tr>

<tr><td valign=top><b>Example Program:</b></td>
<td><font color="#5500FF"><b>demo\dos32\dosint.ex</b></font>
</td></tr>


 <tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_a_b.htm#allocate_low">allocate_low</a>,
<a href="lib_c_d.htm#dos_interrupt">dos_interrupt</a>,
<a href="lib_e_g.htm#free">free</a>
</td></tr>

</table>


<a name=get></a><font color="#006633" size=+2><br>
<center><b>get</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> include get.e<BR>
 s = get(fn)
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>Input, from file fn, a human-readable string of characters
 representing a Euphoria object. Convert the string into the
 numeric value of that object. s will be a 2-element sequence:
 <b>{error status, value}</b>. Error status codes are:
</td></tr>

<tr><td></td><td>
<pre><font color="#330033">    GET_SUCCESS </font><font color="#FF0055">--
object was read successfully</font>
<font color="#330033">    GET_EOF     </font><font color="#FF0055">-- end of
file before object was read</font>
<font color="#330033">    GET_FAIL    </font><font color="#FF0055">-- object is
not syntactically correct</font>
</pre></td></tr>

 
 <tr><td valign=top><b></b></td>
<td>get() can read arbitrarily complicated Euphoria objects. You
 could have a long sequence of values in braces and separated by
 commas, e.g. {23, {49, 57}, 0.5, -1, 99, 'A', "john"}.
 <font color="#CC0099"><b>A single call to get() will read in this
 entire sequence and return it's value as a result.</b></font>
<P>
Each call to get() picks up where the previous call left off. For
 instance, a series of 5 calls to get() would be needed to read
 in:
<P>
99 5.2 {1,2,3} "Hello" -1
<P>
On the sixth and any subsequent call to get() you would see a
 GET_EOF status. If you had something like:
<P>
{1, 2, xxx}
<P>
in the input stream you would see a GET_FAIL error status
 because xxx is not a Euphoria object.
<P>
Multiple "top-level" objects in the input stream must be
 separated from each other with one or more "whitespace"
 characters (blank, tab, \r or \n). Whitespace is not necessary
 <b><i>within</i></b> a top-level object. A call to get() will 
 read one entire top-level object, plus one additional 
 (whitespace) character.
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td>The combination of print() and get() can be used to save a
 Euphoria object to disk and later read it back. This technique
 could be used to implement a database as one or more large
 Euphoria sequences stored in disk files. The sequences could be
 read into memory, updated and then written back to disk after
 each series of transactions is complete. Remember to write out
 a whitespace character (using puts()) after each call to print().
<P>
The value returned is not meaningful unless you have a
 GET_SUCCESS status.
 
</td></tr>

<tr><td valign=top><b>Example:</b></td>
<td>Suppose your program asks the user to enter a number from the
  keyboard.
</td></tr>

<tr><td></td><td>
<pre><font color="#FF0055">-- If he types 77.5, get(0) would return:</font>
<font color="#330033"></font>
<font color="#330033">{GET_SUCCESS, 77.5}</font>
<font color="#330033"></font>
<font color="#FF0055">-- whereas gets(0) would return:</font>
<font color="#330033"></font>
<font color="#00A033">"77.5\n"</font>
<font color="#330033"></font>
</pre></td></tr>

<tr><td valign=top><b>Example Program:</b></td>
<td><font color="#5500FF"><b>demo\mydata.ex</b></font>
</td></tr>


 <tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_p_r.htm#print">print</a>,
<a href="lib_u_z.htm#value">value</a>,
<a href="lib_e_g.htm#gets">gets</a>,
<a href="lib_e_g.htm#getc">getc</a>,
<a href="lib_p_r.htm#prompt_number">prompt_number</a>,
<a href="lib_p_r.htm#prompt_string">prompt_string</a>
</td></tr>

</table>


<a name=get_active_page></a><font color="#006633" size=+2><br>
<center><b>get_active_page</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Platform:</b></td>
<td><font color="#CC3366"><b>DOS32</b></font>
</td></tr>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> include image.e<BR>
 i = get_active_page()
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>Some graphics modes on most video cards have
 multiple pages of memory. This lets you write screen output to one page
 while displaying a different page. get_active_page() returns
 the current page number that screen output is being sent to.
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td> The active and display pages are both 0 by default.
<P>
video_config() will tell you how many pages are available in
 the current graphics mode.
</td></tr>

<tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_s_t.htm#set_active_page">set_active_page</a>,
<a href="lib_e_g.htm#get_display_page">get_display_page</a>,
<a href="lib_u_z.htm#video_config">video_config</a>
</td></tr>

</table>


<a name=get_all_palette></a><font color="#006633" size=+2><br>
<center><b>get_all_palette</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Platform:</b></td>
<td><font color="#CC3366"><b>DOS32</b></font>
</td></tr>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> include image.e<BR>
 s = get_all_palette()
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>Retrieve color intensities for the entire set of colors in the current
 graphics mode. s is a sequence of the form:<p>
 {{r,g,b}, {r,g,b}, ..., {r,g,b}}
<p>
Each element specifies a color intensity {red, green, blue}
 for the corresponding color number, starting with color
 number 0. The values for red, green and blue will be in the
 range 0 to 63.
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td> This function might be used to get the palette values needed
 by save_bitmap(). Remember to multiply these values by 4 before
 calling save_bitmap(), since save_bitmap() expects values in the
 range 0 to 255.
 
</td></tr>

<tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_p_r.htm#palette">palette</a>,
<a href="lib_a_b.htm#all_palette">all_palette</a>,
<a href="lib_p_r.htm#read_bitmap">read_bitmap</a>,
<a href="lib_s_t.htm#save_bitmap">save_bitmap</a>,
<a href="lib_s_t.htm#save_screen">save_screen</a>
</td></tr>

</table>


<a name=get_bytes></a><font color="#006633" size=+2><br>
<center><b>get_bytes</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> include get.e<BR>
 s = get_bytes(fn, i)
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>Read the next i bytes from file number fn. Return the bytes
 as a sequence. The sequence will be of length i, except
 when there are fewer than i bytes remaining to be read in the
 file. 
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td>When i > 0 and <a href="lib_h_o.htm#length">length(s)</a> < i you know
 you've reached the end of file. Eventually, an
 <a href="refman_2.htm#empty_seq">empty sequence</a> will be returned
 for s.
 <P>
 This function is normally used with files opened in binary mode, "rb".
This avoids the confusing situation in text mode where DOS will convert CR LF
 pairs to LF.
</td></tr>


<tr><td valign=top><b>Example:</b></td>
<td>
</td></tr>

<tr><td></td><td>
<pre><font color="#0000FF">include </font><font color="#330033">get.e</font>
<font color="#330033"></font>
<font color="#FF00FF">integer </font><font color="#330033">fn</font>
<font color="#330033">fn = </font><font color="#FF00FF">open</font><font
color="#330033">(</font><font color="#00A033">"temp"</font><font
color="#330033">, </font><font color="#00A033">"rb"</font><font color="#330033">)
 </font><font color="#FF0055">-- an existing file</font>
<font color="#330033"></font>
<font color="#FF00FF">sequence </font><font color="#330033">whole_file</font>
<font color="#330033">whole_file = {}</font>
<font color="#330033"></font>
<font color="#FF00FF">sequence </font><font color="#330033">chunk</font>
<font color="#330033"></font>
<font color="#0000FF">while </font><font color="#330033">1 </font><font
color="#0000FF">do</font>
<font color="#330033">    chunk = get_bytes(fn, 100) </font><font
color="#FF0055">-- read 100 bytes at a time</font>
<font color="#330033">    whole_file &= chunk        </font><font
color="#FF0055">-- chunk might be empty, that's ok</font>
<font color="#0000FF">    if </font><font color="#FF00FF">length</font><font
color="#330033">(chunk) < 100 </font><font color="#0000FF">then</font>
<font color="#0000FF">        exit</font>
<font color="#0000FF">    end if</font>
<font color="#0000FF">end while</font>
<font color="#330033"></font>
<font color="#FF00FF">close</font><font color="#330033">(fn)</font>
<font color="#330033">? </font><font color="#FF00FF">length</font><font
color="#330033">(whole_file)  </font><font color="#FF0055">-- should match DIR
size of "temp"</font>
<font color="#330033"></font>
</pre></td></tr>

<tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_e_g.htm#getc">getc</a>,
<a href="lib_e_g.htm#gets">gets</a>
</td></tr>

</table>


<a name=get_display_page></a><font color="#006633" size=+2><br>
<center><b>get_display_page</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Platform:</b></td>
<td><font color="#CC3366"><b>DOS32</b></font>
</td></tr>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> include image.e<BR>
 i = get_display_page()
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>Some graphics modes on most video cards
 have multiple pages of memory. This lets you write screen output to one page
 while displaying another. get_display_page() returns the current
 page number that is being displayed on the monitor.
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td>The active and display pages are both 0 by default.
<P>
video_config() will tell you how many pages are available in
 the current graphics mode.
</td></tr>

<tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_s_t.htm#set_display_page">set_display_page</a>,
<a href="lib_e_g.htm#get_active_page">get_active_page</a>,
<a href="lib_u_z.htm#video_config">video_config</a>
</td></tr>

</table>


<a name=get_key></a><font color="#006633" size=+2><br>
<center><b>get_key</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> i = get_key()
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>Return the key that was pressed by the user, without waiting.
 Return -1 if no key was pressed. Special
 codes are returned for the function keys, arrow keys etc. 
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td>The operating system can hold a small number of key-hits in its 
 keyboard buffer. get_key() will return the next one from the buffer, 
 or -1 if the buffer is empty.
<P>
Run the <font color="#5500FF"><b>key.bat</b></font> program to see what
 key code is generated for each key on your keyboard.
</td></tr>

<tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_u_z.htm#wait_key">wait_key</a>,
<a href="lib_e_g.htm#getc">getc</a>
</td></tr>

</table>


<a name=get_mouse></a><font color="#006633" size=+2><br>
<center><b>get_mouse</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Platform:</b></td>
<td><font color="#CC3366"><b>DOS32, Linux</b></font>
</td></tr>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> include mouse.e<BR>
 x1 = get_mouse()
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>Return the last mouse event in the form: <b>{event, x, y}</b> or
 return -1 if there has not been a mouse event since the last
 time get_mouse() was called.
<P>
Constants have been defined in
 <font color="#5500FF"><b>mouse.e</b></font> for the possible mouse
 events:
</td></tr>

<tr><td></td><td>
<pre><font color="#0000FF">    global constant </font><font color="#330033">MOVE
= 1,</font>
<font color="#330033">               LEFT_DOWN = 2,</font>
<font color="#330033">                 LEFT_UP = 4,</font>
<font color="#330033">              RIGHT_DOWN = 8,</font>
<font color="#330033">                RIGHT_UP = 16,</font>
<font color="#330033">             MIDDLE_DOWN = 32,</font>
<font color="#330033">               MIDDLE_UP = 64</font>
</pre></td></tr>


 <tr><td valign=top><b></b></td>
<td>x and y are the coordinates of the mouse pointer at the time that
 the event occurred. get_mouse() returns immediately with either
 a -1 or a mouse event. It does not wait for an event to occur.
 You must check it frequently enough to avoid missing an event.
 When the next event occurs, the current event will be lost, if
 you haven't read it. In practice it is not hard to catch almost
 all events. Losing a MOVE event is generally not too serious,
 as the next MOVE will tell you where the mouse pointer is.
<P>
Sometimes multiple events will be reported. For example, if the
 mouse is moving when the left button is clicked, get_mouse()
 will report an event value of LEFT_DOWN+MOVE, i.e. 2+1 or 3.
 For this reason you should test for a particular event using
 and_bits(). See examples below.
 
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td>In <font color="#CC3366">pixel-graphics modes</font> that are 320 pixels
 wide, you need to divide the x value by 2 to get the correct position on
 the screen. (A strange feature of DOS.)
<P>
In DOS32 <font color="#CC3366">text modes</font> you need to scale the x and y
 coordinates to get line and column positions. In Linux, 
 no scaling is
 required - x and y correspond to the line and column on the screen, 
 with (1,1) at the top left. 
<P>
In DOS32, you need a DOS mouse driver to use this routine. In Linux, 
GPM Server must be running.
<p>
In Linux, mouse movement events are not reported in an xterm window, 
only in the text console. 
<P>
In Linux, LEFT_UP, RIGHT_UP and MIDDLE_UP are not distinguishable 
from one another.
<P>
You can use get_mouse() in <font color="#CC3366">most text and
 pixel-graphics modes</font>.
<P>
The first call that you make to get_mouse() will turn on a
 mouse pointer, or a highlighted character.
<P>
DOS generally does not support the use of a mouse in SVGA
 graphics modes (beyond 640x480 pixels). This restriction
 has been removed in Windows 95 (DOS 7.0). <b>Graeme Burke</b>,
 <b>Peter Blue</b> and others have contributed <b>mouse routines</b> that
 get around the problems with using a mouse in SVGA. See the
 Euphoria <a href="http://www.RapidEuphoria.com/exestuff.htm">Archive
 Web page</a>.
<P>
The x,y coordinate returned could be that of the very tip of the
 mouse pointer or might refer to the pixel pointed-to by
 the mouse pointer. Test this if you are trying to read the
 pixel color using <a href="lib_e_g.htm#get_pixel">get_pixel()</a>. You
 may have to read x-1,y-1 instead.
</td></tr>

<tr><td valign=top><b>Example 1:</b></td>
<td> a return value of:
</td></tr>


<tr><td></td><td>
<pre><font color="#330033">{2, 100, 50}</font>
</pre></td></tr>


<tr><td valign=top><b></b></td>
<td>would indicate that the left button was pressed down when the
 mouse pointer was at location x=100, y=50 on the screen.
</td></tr>


<tr><td valign=top><b>Example 2:</b></td>
<td> To test for LEFT_DOWN, write something like the following:
</td></tr>


<tr><td></td><td>
<pre><font color="#FF00FF">object </font><font color="#330033">event</font>
<font color="#330033"></font>
<font color="#0000FF">while </font><font color="#330033">1 </font><font
color="#0000FF">do</font>
<font color="#330033">    event = get_mouse()</font>
<font color="#0000FF">    if </font><font color="#FF00FF">sequence</font><font
color="#330033">(event) </font><font color="#0000FF">then</font>
<font color="#0000FF">        if </font><font
color="#FF00FF">and_bits</font><font color="#330033">(event</font><font
color="#993333">[</font><font color="#330033">1</font><font
color="#993333">]</font><font color="#330033">, LEFT_DOWN) </font><font
color="#0000FF">then</font>
<font color="#FF0055">            -- left button was pressed</font>
<font color="#0000FF">            exit</font>
<font color="#0000FF">        end if</font>
<font color="#0000FF">    end if</font>
<font color="#0000FF">end while</font>
<font color="#330033"></font>
</pre></td></tr>

<tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_h_o.htm#mouse_events">mouse_events</a>,
<a href="lib_h_o.htm#mouse_pointer">mouse_pointer</a>,
<a href="lib_a_b.htm#and_bits">and_bits</a>
</td></tr>

</table>


<a name=get_pixel></a><font color="#006633" size=+2><br>
<center><b>get_pixel</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Platform:</b></td>
<td><font color="#CC3366"><b>DOS32</b></font>
</td></tr>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> x = get_pixel(s)
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>When s is a 2-element screen coordinate {x, y}, get_pixel()
 returns the color (a small integer) of the pixel on the
 <font color="#CC3366">pixel-graphics</font> screen
 at that point.<P>
When s is a 3-element sequence of the form: {x, y, n}
 get_pixel() returns a sequence of n colors for the
 points starting at {x, y} and moving to the right {x+1, y},
 {x+2, y} etc.
<P>
Points off the screen have unpredictable color values.
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td>When n is specified, a very fast algorithm is used to read the
 pixel colors on the screen. It is much faster to call get_pixel()
 once, specifying a large value of n, than it is to call it many
 times, reading one pixel color at a time.
</td></tr>

<tr><td valign=top><b>Example:</b></td>
<td>
</td></tr>

<tr><td></td><td>
<pre><font color="#FF00FF">object </font><font color="#330033">x</font>
<font color="#330033"></font>
<font color="#330033">x = </font><font color="#FF00FF">get_pixel</font><font
color="#330033">(</font><font color="#993333">{</font><font
color="#330033">30,40</font><font color="#993333">}</font><font
color="#330033">)</font>
<font color="#FF0055">-- x is set to the color value of point x=30, y=40</font>
<font color="#330033"></font>
<font color="#330033">x = </font><font color="#FF00FF">get_pixel</font><font
color="#330033">(</font><font color="#993333">{</font><font
color="#330033">30,40,100</font><font color="#993333">}</font><font
color="#330033">)</font>
<font color="#FF0055">-- x is set to a sequence of 100 integer values,
representing</font>
<font color="#FF0055">-- the colors starting at {30,40} and going to the
right</font>
<font color="#330033"></font>
</pre></td></tr>

<tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_p_r.htm#pixel">pixel</a>,
<a href="lib_e_g.htm#graphics_mode">graphics_mode</a>,
<a href="lib_e_g.htm#get_position">get_position</a>
</td></tr>

</table>


<a name=get_position></a><font color="#006633" size=+2><br>
<center><b>get_position</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> include graphics.e<BR>
 s = get_position()
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>Return the current line and column position of the cursor as a
 2-element sequence <b>{line, column}</b>. 
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td>get_position() works in both <font color="#CC3366">text and
 pixel-graphics modes</font>.
 In <font color="#CC3366">pixel-graphics modes</font> no cursor will be
 displayed, but get_position() will return the line and column where the
 next character will be displayed.
<P>
The coordinate system for displaying text is different from the
 one for displaying pixels. Pixels are displayed such that the
 top-left is (x=0,y=0) and the first coordinate controls the
 horizontal, left-right location. In pixel-graphics modes
 you can display both text and pixels. get_position() returns the
 current line and column for the text that you are displaying,
 not the pixels that you may be plotting. There is no
 corresponding routine for getting the current pixel position.
 
</td></tr>

<tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_p_r.htm#position">position</a>,
<a href="lib_e_g.htm#get_pixel">get_pixel</a>
</td></tr>

</table>


<a name=get_screen_char></a><font color="#006633" size=+2><br>
<center><b>get_screen_char</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>

 <tr><td valign=top><b>Platform:</b></td>
<td><font color="#CC3366"><b>DOS32, Linux, FreeBSD</b></font>
</td></tr>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> include image.e<BR>
 s = get_screen_char(i1, i2)
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>Return a 2-element sequence s, of the form
  <b>{ascii-code, attributes}</b> for
 the character on the screen at line i1, column i2. s consists of
 two atoms. The first is the ASCII code for the character. The second
 is an atom that contains the foreground and background color of the character,
 and possibly other information describing the appearance of the character
 on the screen.
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td>With get_screen_char() and put_screen_char() you can
   save and restore a character on the screen along with its attributes.
</td></tr>

<tr><td valign=top><b>Example:</b></td>
<td>
</td></tr>

<tr><td></td><td>
<pre><font color="#FF0055">-- read character and attributes at top left
corner</font>
<font color="#330033">s = get_screen_char(1,1) </font>
<font color="#FF0055">-- store character and attributes at line 25, column
10</font>
<font color="#330033">put_screen_char(25, 10, </font><font
color="#993333">{</font><font color="#330033">s</font><font
color="#993333">}</font><font color="#330033">)</font>
</pre></td></tr>

<tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_p_r.htm#put_screen_char">put_screen_char</a>,
<a href="lib_s_t.htm#save_text_image">save_text_image</a>
</td></tr>

</table>


<a name=get_vector></a><font color="#006633" size=+2><br>
<center><b>get_vector</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Platform:</b></td>
<td><font color="#CC3366"><b>DOS32</b></font>
</td></tr>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> include machine.e<BR>
 s = get_vector(i)
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>Return the current protected mode far address of the handler
 for interrupt number i. s will be a 2-element sequence:
 <b>{16-bit segment, 32-bit offset}</b>.
</td></tr>

<tr><td valign=top><b>Example:</b></td>
<td>
</td></tr>

<tr><td></td><td>
<pre><font color="#330033">s = get_vector(#1C)</font>
<font color="#FF0055">-- s will be set to the far address of the clock
tick</font>
<font color="#FF0055">-- interrupt handler, for example: {59, 808}</font>
<font color="#330033"></font>
</pre></td></tr>

<tr><td valign=top><b>Example Program:</b></td>
<td><font color="#5500FF"><b>demo\dos32\hardint.ex</b></font>
</td></tr>


 <tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_s_t.htm#set_vector">set_vector</a>,
<a href="lib_h_o.htm#lock_memory">lock_memory</a>
</td></tr>

</table>


<a name=getc></a><font color="#006633" size=+2><br>
<center><b>getc</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> i = getc(fn)
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>Get the next character (byte) from file or device fn. The character will
 have a value from 0 to 255. -1 is returned at end of file.
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td>File input using getc() is buffered, i.e. getc() does not actually
 go out to the disk for each character. Instead, a large block of
 characters will be read in at one time and returned to you one
 by one from a memory buffer.
 <p>
 When getc() reads from the keyboard, it will not see any characters until
 the user presses Enter.
 Note that the user can type
 control-Z, which the operating system treats as "end of file".
 -1 will be returned.
</td></tr>

<tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_e_g.htm#gets">gets</a>,
<a href="lib_e_g.htm#get_key">get_key</a>,
<a href="lib_u_z.htm#wait_key">wait_key</a>,
<a href="lib_h_o.htm#open">open</a>
</td></tr>

</table>


<a name=getenv></a><font color="#006633" size=+2><br>
<center><b>getenv</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> x = getenv(s)
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>Return the value of an environment variable. If the variable
 is undefined, return -1.
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td> Because either a sequence or an atom (-1) might be returned, you
 should probably assign the result to a variable declared as
 object.
</td></tr>

<tr><td valign=top><b>Example:</b></td>
<td>
</td></tr>

<tr><td></td><td>
<pre><font color="#330033">e = </font><font color="#FF00FF">getenv</font><font
color="#330033">(</font><font color="#00A033">"EUDIR"</font><font
color="#330033">)</font>
<font color="#FF0055">-- e will be "C:\EUPHORIA" -- or perhaps D:, E:
etc.</font>
<font color="#330033"></font>
</pre></td></tr>

<tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_c_d.htm#command_line">command_line</a>
</td></tr>

</table>


<a name=gets></a><font color="#006633" size=+2><br>
<center><b>gets</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> x = gets(fn)
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>Get the next sequence (one line, including '\n') of characters
 from file or device fn. The characters will have values from 0
 to 255. The atom -1 is returned on end of file.
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td>Because either a sequence or an atom (-1) might be returned, you
 should probably assign the result to a variable declared as
 object.
<P>
After reading a line of text from the keyboard, you should
 normally output a \n character, e.g. puts(1, '\n'), before
 printing something. Only on the last line of the screen does the
 operating system automatically scroll the screen and advance to
 the next line.
<P>
The last line in a file might not end with a new-line '\n'
 character.
<P>
When your program reads from the keyboard, the user can type
 control-Z, which the operating system treats as "end of file".
 -1 will be returned.
<P>
In SVGA modes, DOS might set the wrong cursor position, after a call to
 gets(0) to read the keyboard. You should set it yourself using
 <a href="lib_p_r.htm#position">position()</a>.
</td></tr>

<tr><td valign=top><b>Example 1:</b></td>
<td>
</td></tr>

<tr><td></td><td>
<pre><font color="#FF00FF">sequence </font><font color="#330033">buffer</font>
<font color="#FF00FF">object </font><font color="#330033">line</font>
<font color="#FF00FF">integer </font><font color="#330033">fn</font>
<font color="#330033"></font>
<font color="#FF0055">-- read a text file into a sequence</font>
<font color="#330033">fn = </font><font color="#FF00FF">open</font><font
color="#330033">(</font><font color="#00A033">"myfile.txt"</font><font
color="#330033">, </font><font color="#00A033">"r"</font><font
color="#330033">)</font>
<font color="#0000FF">if </font><font color="#330033">fn = -1 </font><font
color="#0000FF">then</font>
<font color="#FF00FF">    puts</font><font color="#330033">(1, </font><font
color="#00A033">"Couldn't open myfile.txt\n"</font><font color="#330033">)</font>
<font color="#FF00FF">    abort</font><font color="#330033">(1)</font>
<font color="#0000FF">end if</font>
<font color="#330033"></font>
<font color="#330033">buffer = {}</font>
<font color="#0000FF">while </font><font color="#330033">1 </font><font
color="#0000FF">do</font>
<font color="#330033">    line = </font><font color="#FF00FF">gets</font><font
color="#330033">(fn)</font>
<font color="#0000FF">    if </font><font color="#FF00FF">atom</font><font
color="#330033">(line) </font><font color="#0000FF">then</font>
<font color="#0000FF">        exit   </font><font color="#FF0055">-- -1 is
returned at end of file</font>
<font color="#0000FF">    end if</font>
<font color="#330033">    buffer = </font><font
color="#FF00FF">append</font><font color="#330033">(buffer, line)</font>
<font color="#0000FF">end while</font>
<font color="#330033"></font>
</pre></td></tr>

<tr><td valign=top><b>Example 2:</b></td>
<td>
</td></tr>

<tr><td></td><td>
<pre><font color="#FF00FF">object </font><font color="#330033">line</font>
<font color="#330033"></font>
<font color="#FF00FF">puts</font><font color="#330033">(1, </font><font
color="#00A033">"What is your name?\n"</font><font color="#330033">)</font>
<font color="#330033">line = </font><font color="#FF00FF">gets</font><font
color="#330033">(0)  </font><font color="#FF0055">-- read standard input
(keyboard)</font>
<font color="#330033">line = line[1..</font><font
color="#FF00FF">length</font><font color="#993333">(</font><font
color="#330033">line</font><font color="#993333">)</font><font
color="#330033">-1] </font><font color="#FF0055">-- get rid of \n character at
end</font>
<font color="#FF00FF">puts</font><font color="#330033">(1, </font><font
color="#00A033">'\n'</font><font color="#330033">)   </font><font
color="#FF0055">-- necessary</font>
<font color="#FF00FF">puts</font><font color="#330033">(1, line & </font><font
color="#00A033">" is a nice name.\n"</font><font color="#330033">)</font>
<font color="#330033"></font>
</pre></td></tr>

<tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_e_g.htm#getc">getc</a>,
<a href="lib_p_r.htm#puts">puts</a>,
<a href="lib_h_o.htm#open">open</a>
</td></tr>

</table>


<a name=graphics_mode></a><font color="#006633" size=+2><br>
<center><b>graphics_mode</b></center>
</font><p>

<table border=0 cellspacing=2 cellpadding=2>


 <tr><td valign=top><b>Platform:</b></td>
<td><font color="#CC3366"><b>DOS32</b></font>
</td></tr>


 <tr><td valign=top><b>Syntax:</b></td>
<td><font face = "Arial, Helvetica"> include graphics.e<BR>
 i1 = graphics_mode(i2)
</font>
</td></tr>

 <tr><td valign=top><b>Description:</b></td>
<td>Select graphics mode i2. See <font color="#5500FF"><b>graphics.e</b></font>
 for a list of valid graphics modes. If successful, i1 is set to 0,
 otherwise i1 is set to 1.
</td></tr>

<tr><td valign=top><b>Comments:</b></td>
<td>Some modes are referred to as <font color="#CC3366">text modes</font>
 because they only let you display text. Other modes are referred to as
 <font color="#CC3366">pixel-graphics modes</font> because you can
 display pixels, lines, ellipses etc., as well as text.
<P>
As a convenience to your users, it is usually a good idea to
 switch back from a pixel-graphics mode to the standard text
 mode before your program terminates. You can do this with
 graphics_mode(-1). If a pixel-graphics program leaves your screen
 in a mess, you can clear it up with the DOS CLS command, or
 by running <font color="#993333"><b>ex</b></font> or
 <font color="#993333"><b>ed</b></font>.
<P>
Some graphics cards will be unable to enter some SVGA modes,
 under some conditions. You can't always tell from the i1 value,
 whether the graphics mode was set up successfully.
<P>
On the <font color="#CC3366"><b>WIN32</b></font> and 
<font color="#CC3366"><b>Linux/FreeBSD</b></font>
platforms, graphics_mode() will allocate a plain, text mode console if one
does not exist yet. It will then return 0, no matter what value is 
passed as i2.
</td></tr>

<tr><td valign=top><b>Example:</b></td>
<td>
</td></tr>

<tr><td></td><td>
<pre><font color="#0000FF">if </font><font color="#330033">graphics_mode(18)
</font><font color="#0000FF">then</font>
<font color="#FF00FF">    puts</font><font color="#330033">(SCREEN, </font><font
color="#00A033">"need VGA graphics!\n"</font><font color="#330033">)</font>
<font color="#FF00FF">    abort</font><font color="#330033">(1)</font>
<font color="#0000FF">end if</font>
<font color="#330033">draw_line(BLUE, </font><font color="#993333">{</font><font
color="#0000FF">{</font><font color="#330033">0,0</font><font
color="#0000FF">}</font><font color="#330033">, </font><font
color="#0000FF">{</font><font color="#330033">50,50</font><font
color="#0000FF">}</font><font color="#993333">}</font><font
color="#330033">)</font>
<font color="#330033"></font>
</pre></td></tr>

<tr><td valign=top><b>See Also:</b></td>
<td><a href="lib_s_t.htm#text_rows">text_rows</a>,
<a href="lib_u_z.htm#video_config">video_config</a>
</td></tr>

</table>

<p>&nbsp;<p><center>
<font color="#006633" face="Arial, Helvetica" size=+1>...
continue</font><br>&nbsp;<br>
<font face="Arial, Helvetica" size=-1>
<a href="lib_a_b.htm">from A to B</a> &nbsp; | &nbsp;
<a href="lib_c_d.htm">from C to D</a> &nbsp; | &nbsp;
from E to G &nbsp; | &nbsp;
<a href="lib_h_o.htm">from H to O</a> &nbsp; | &nbsp;
<a href="lib_p_r.htm">from P to R</a> &nbsp; | &nbsp;
<a href="lib_s_t.htm">from S to T</a> &nbsp; | &nbsp;
<a href="lib_u_z.htm">from U to Z</a></font></center><p>&nbsp;




--------------070000050804060706000906--

--------------040908020200040303020701--

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu