Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth > Re: why is it c...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 8 of 13 Topic 3991 of 4065
Post > Topic >>

Re: why is it called a buffer

by Elizabeth D Rather <erather@[EMAIL PROTECTED] > Apr 10, 2008 at 07:32 AM

Tinkerer wrote:
> m_l_g3 <m_l_g3@[EMAIL PROTECTED]
> wrote:
> 
>> Try
>>
>> SEE BUFFER:
>>
>> if it shows something like
>>
>> : buffer: create allot ;
>>
>> then it allocates a static buffer that you cannot resize later.
> 
> I can't tell on my Open Firmware's built-in forth, but I will try some
> experiments to test if it is implemented llike that.
> 
> My (admittedly very brief) experience is that the comma operator can't
> poke data into previously named storage, which would make it unsuitable
> for what I was hoping it would be useful for. At the moment I am
> barrelling full speed ahead trying to get something done. Hopefully I
> will be able to make use of the help I have received next time, or -
> heaven forbid - if I have to scrap my original approach and start again
> from scratch.

Ok, if you're using Open Firmware, then BUFFER: is definitely defined in 
terms of CREATE ALLOT.  If you want a truly temporary buffer, use 
ALLOCATE (and FREE when you're done with it):

14.6.1.0707 ALLOCATE   ( u -- a-addr ior )
Allocate u address units of contiguous data space. The data-space 
pointer is unaffected by this operation. The initial content of the 
allocated space is undefined.

If the allocation succeeds, a-addr is the aligned starting address of 
the allocated space and ior is zero.

If the operation fails, a-addr does not represent a valid address and 
ior is the implementationdefined I/O result code.


14.6.1.1605 FREE  ( a-addr -- ior )
Return the contiguous region of data space indicated by a-addr to the 
system for later allocation. a-addr shall indicate a region of data 
space that was previously obtained by ALLOCATE or RESIZE. The data-space 
pointer is unaffected by this operation.

If the operation succeeds, ior is zero. If the operation fails, ior is 
the implementation-defined I/O result code.

The comma operator actually adds a value to the dictionary.  If you want 
to store something into an existing address, use ! (store).

Actually, if you could tell us what you're trying to do perhaps we could 
be more helpful

Cheers,
Elizabeth

-- 
==================================================
Elizabeth D. Rather   (US & Canada)   800-55-FORTH
FORTH Inc.                         +1 310-491-3356
5155 W. Rosecrans Ave. #1018  Fax: +1 310-978-9454
Hawthorne, CA 90250
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================




 13 Posts in Topic:
why is it called a buffer
tinkerer@[EMAIL PROTECTED  2008-04-09 23:52:07 
Re: why is it called a buffer
Jerry Avins <jya@[EMAI  2008-04-09 11:13:32 
Re: why is it called a buffer
Elizabeth D Rather <er  2008-04-09 07:37:55 
Re: why is it called a buffer
tinkerer@[EMAIL PROTECTED  2008-04-10 23:04:19 
Re: why is it called a buffer
Clever Monkey <spamtra  2008-04-14 12:56:45 
Re: why is it called a buffer
m_l_g3 <m_l_g3@[EMAIL   2008-04-09 14:02:59 
Re: why is it called a buffer
tinkerer@[EMAIL PROTECTED  2008-04-10 23:04:19 
Re: why is it called a buffer
Elizabeth D Rather <er  2008-04-10 07:32:27 
Re: why is it called a buffer
tinkerer@[EMAIL PROTECTED  2008-04-15 02:05:03 
Re: why is it called a buffer
Albert van der Horst <  2008-04-17 02:27:04 
Re: why is it called a buffer
vandys@[EMAIL PROTECTED]   2008-04-17 02:33:44 
Re: why is it called a buffer
Bruce McFarling <agila  2008-04-10 09:58:19 
Re: why is it called a buffer
Jonah Thomas <jethomas  2008-04-14 13:31:36 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 4:29:37 CDT 2008.