1. RE: command_line() - convert a sequence to an atom value?

> it would be a whole lot nicer if there happens to be a way of storing the
> numerical value of the command_line() sequence {51,48} as 30 in my atom.
>
> Any ideas?
>
> Joel Garcia

>From the EUPHORIA Reference Manual:

value
Syntax: include get.e
s = value(st)
Description: Read the string representation of a Euphoria object, and
compute the value of that object. A 2-element sequence, {error_status,
value} is actually returned, where error_status can be one of:
     GET_SUCCESS -- a valid object representation was found
    GET_EOF     -- end of string reached too soon
    GET_FAIL    -- syntax is wrong


Comments: This works the same as get(), but it reads from a string that you
supply, rather than from a file or device.
After reading one valid representation of a Euphoria object, value() will
stop reading and ignore any additional characters in the string. For
example, "36" and "36P" will both give you {GET_SUCCESS, 36}.

Example 1:
 s = value("12345"}
-- s is {GET_SUCCESS, 12345}



Example 2:
 s = value("{0, 1, -99.9}")
-- s is {GET_SUCCESS, {0, 1, -99.9}}



Example 3:
 s = value("+++")
-- s is {GET_FAIL, 0}

new topic     » topic index » view message » categorize

2. RE: command_line() - convert a sequence to an atom value?

Euman,

The problem, I think, is that he's got a sequence and needs the value it
represents. How would you poke the value of the sequence into the memory
address without FIRST getting the value of the sequence? And if you have to
do that first, why poke the value into memory?

-CuriousKid

> CK presents one method or you can use something like this
> which is ultra fast,
>
> address = allocate(256) -- 'warning' only 256 bytes can be used
> mem_set(address, 0, 256)
>
> poke your value staring at 'address' location
> and then you can peek the value from 'address' later
> when its needed again.
>
> be sure to free the allocated space when your finished with
> the data contained in 'address' useing free(address)
>
> if you have some code, I could help you modify it some to work like this.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu