Search the web
Sign In
New User? Sign Up
win32forth
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Click here for the latest updates on Groups Message search

Messages

  Messages Help
Advanced
Reading numbers   Message List  
Reply Message #14367 of 14766 |
Re: [win32forth] Re: Reading numbers

On Tue, Jul 7, 2009 at 10:48 AM, Rick Collins<gnuarm.2006@...> wrote:
> --- In win32forth@yahoogroups.com, "George Hubert" <georgeahubert@...> wrote:
>> --- In win32forth@yahoogroups.com, psg0912@ wrote:
>> >
>> >
>> > Hi,
>> >
>> > I have a text file which consists of a number of lines. Each line has 7
numbers which are tab-separated. I read a line from a file into a buffer in
memory.
<snip>> >
> Just a question to the OP, would it make sense to read and process your
numbers one at a time rather than stacking them?  I'm not up with my Forth
enough to offer some code, but I remember doing something like this where I read
in a line from the source and evaluated the words one at a time.  I wrote a word
to evaluate one word, if the input buffer was empty it would read a new line, if
the source was empty (for file sources) it would return nothing.  I did what was
required with each value read as I read it.  No need to evaluate them all and
clog up the stack... at least in my case.
>
> Does that make sense?  I think this is simpler than recursing to fill the
stack in the order you need.
>
> Rick

Again to the OP, but you are right Rick. As pointed out by others in
this thread, you can easily blow up the stack if your spreadsheet
contains more than a trivial number of entries. I do have code at
http://vf-plugins.googlecode.com/files/pfDatabase-4.zip that includes
a csvParser.fth which parses comma separated values and passes them to
a user defined word. I can't remember if there is an example in those
tools and I'm sure it will need to be modified to work on Win32Forth,
but the concept is there and I could probably come up with an example
without too much effort. The code is presently configured for
VentureForth and came from polyForth, via SwiftForth, via gforth, so
it's relatively generic and the database is even fairly well
documented. It's free for your use I'd be glad to help to get it
ported to yet another system.

DaR



Tue Jul 7, 2009 9:38 pm

DaRuffer
Offline Offline
Send Email Send Email

Message #14367 of 14766 |
Expand Messages Author Sort by Date

Hi,   I have a text file which consists of a number of lines. Each line has 7 numbers which are tab-separated. I read a line from a file into a buffer in...
psg0912@...
psg0912
Offline Send Email
Jul 6, 2009
6:45 pm

... Hi Prad, ... it standard. I've done some similar stuff to what your trying to do. Here is a snippet of (ugly and verbose) code that you may be able to...
Thomas Dixon
phenomenaltom
Offline Send Email
Jul 6, 2009
7:41 pm

Try this No guarantee. I am not hte programmer but I have access to him. John A. Peters ... \ $Id: Getat.f,v 1.2 2009/04/17 22:23:48 brookline Exp $...
japeters@...
japeters1939
Online Now Send Email
Jul 7, 2009
3:59 am

Hi Thomas,   I used >number because its listed in the ANS standard word list. When I started off I had a vague idea of writing a wrod similar to the...
P G
psg0912
Offline Send Email
Jul 7, 2009
10:34 am

Hi John,   It will take me a while to work through this one. One thing that does come to mind is that :: #line.bytes  #line.addr  cursor-line  cursor-col ...
P G
psg0912
Offline Send Email
Jul 7, 2009
10:52 am

... Try ... -IF 2DUP 09 SCAN DUP>R -IF 1- SWAP 1+ SWAP THEN 2SWAP R> - EVALUATE >R RECURSE R> ELSE 2DROP THEN ; which should read any number...
George Hubert
georgeahubert
Offline Send Email
Jul 7, 2009
3:31 pm

... Just a question to the OP, would it make sense to read and process your numbers one at a time rather than stacking them? I'm not up with my Forth enough...
Rick Collins
gnuarm
Offline Send Email
Jul 7, 2009
3:48 pm

... <snip>> > ... Again to the OP, but you are right Rick. As pointed out by others in this thread, you can easily blow up the stack if your spreadsheet ...
Dennis Ruffer
DaRuffer
Offline Send Email
Jul 7, 2009
9:39 pm

Hi John, It will take me a while to work through this one. One thing that does come to mind is that :: #line.bytes #line.addr cursor-line cursor-col ...
japeters@...
japeters1939
Online Now Send Email
Jul 7, 2009
3:51 pm

I have been able to adapt the solutions given previously. Thomas's one was easier for me to understand. George's one was neat  ( not something I would have...
psg0912@...
psg0912
Offline Send Email
Jul 8, 2009
11:58 am
Advanced

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help