1. Questions...
Hi all,
I have three questions:
1.- How do I access absolute memory addresses? Suppose I want to poke,
mem_set or mem_copy to the Video Memory, I just do it to address
#A000?
2.- Is there any way to get the errorlevel returned after a system()
call?
3.- Is it possible to make another program to execute just after
exiting my Euphoria program? I guess it has something to do with
sutffing into the keyboard buffer, but just can't figure it out. If
you can't do it, my suggetion to Rob is that perhaps the abort()
command include this option, or maybe an "at_exit()" function.
--
Regards,
Daniel Berstein
architek at geocities.com
http://www.geocities.com/SiliconValley/Heights/9316
2. Questions...
Hy,
I was wondering if there is a procedure/function
that converts EG : "12345" to 12345
I created this :
[BEGIN]
function kwadraat(integer dinges,integer totde,integer extra)
integer temp1
temp1=dinges
if totde=1 then
elsif totde=0 then temp1=1 else
if extra=1 then
for a=2 to totde do
temp1=temp1*dinges
end for
else
for a=2 to totde-1 do
temp1=temp1*dinges
end for
end if
end if
return temp1
end function
global function seq2int9(sequence string) -- ONLY 1-9 DIGIT SEQUENCES
!!!!
integer number,tnmb
if length(string)=1 then
number=string[1]-48
else
number=kwadraat(10,length(string),0)
number=number*(string[1]-48)
for a=1 to length(string)-1 do
tnmb=kwadraat(10,length(string)-a-1,1)
number=number+(tnmb*(string[a+1]-48))
end for
end if
return number
end function
[END]
EG.
test=seq2int9("12345")
RESULT:
test=12345
-------------------------------------------------------------------
And also, if there's a proc/func that is like match(),
but gives ALL the locations back.
I wrote this :
[BEGIN]
function add_place(sequence str)
sequence tmp
tmp=""
if length(str)=0 then
str=repeat(" ",1)
else
tmp=str
str=""
str=repeat(" ",length(tmp)+1)
for a=1 to length(tmp) do
str[a]=tmp[a]
end for
end if
return str
end function
function remove_place(sequence str,integer place)
if length(str)=1 then
str=""
else
if place=length(str) then
str=str[1..length(str)-1]
elsif place=1 then
str=str[2..length(str)]
else
str=str[1..place-1]&str[place+1..length(str)]
end if
end if
return str
end function
global function multimatch(sequence str,sequence cstr)
sequence temp1,temp2
object loc,pl
temp1=""
temp2=cstr
pl=0
while 1 do
loc=match(str,temp2)
if loc=0 then exit else
pl=pl+1
temp1=add_place(temp1)
temp1[pl]=loc+((pl-1)*length(str))
for a=1 to length(str) do
temp2=remove_place(temp2,loc)
end for
end if
end while
return temp1
end function
[END]
EG.
test=multimatch(" ","Hy, how are you doing ?")
RESULT:
test={4,8,12,16,22}
Bye,
PQ
QC
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
3. Re: Questions...
- Posted by Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL>
Feb 17, 1999
-
Last edited Feb 18, 1999
>I was wondering if there is a procedure/function
>that converts EG : "12345" to 12345
Its called value (), you can find it in get.e
>I created this :
>
>[BEGIN]
>
>function kwadraat(integer dinges,integer totde,integer extra)
Nederlands ?
>And also, if there's a proc/func that is like match(),
>but gives ALL the locations back.
That would be handy. I personally dislike the whole system of find () and
match ().
I just wish we were able to do this tiny little trick that the language
'ICON' lets us do.
That is: be able to 'store' the position in a certain routine. That the next
time it is called, it returns at the position
it has left. It would only time one new key word.
'leave'
Off course the syntax to call it 'again' and the syntax to call it for the
first time should be different. In ICON this is
done with the keyword 'each' but im not that certain is such recursion tricks
are good for Euphoria. It would allow you to
write, if you want any recursive algorithm in one statement. But the idea to be
able to have a static position in a routine
alone, should at least provide us with the technique to easily write recursive
algorithms with an undefined length of
information, of which we need an undefined amount of.
Oh, well, we can do this with Euphoria already, if we want. Just split the
function up appropiately into different routines,
so maybe Im just being silly. (That would be a nice interface, a declare_find
(item, sequence) procedure and a next () function)
Ralf
4. Re: Questions...
>From: Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL>
>Subject: Re: Questions...
>To: EUPHORIA at LISTSERV.MUOHIO.EDU
>
>>I was wondering if there is a procedure/function
>>that converts EG : "12345" to 12345
>
> Its called value (), you can find it in get.e
>
>>I created this :
>>
>>[BEGIN]
>>
>>function kwadraat(integer dinges,integer totde,integer extra)
>
> Nederlands ?
>
No Dutch, (HAHA!!)
>>And also, if there's a proc/func that is like match(),
>>but gives ALL the locations back.
>
> That would be handy. I personally dislike the whole system of find
() and match ().
> I just wish we were able to do this tiny little trick that the
language 'ICON' lets us do.
> That is: be able to 'store' the position in a certain routine. That
the next time it is called, it returns at the position
>it has left. It would only time one new key word.
>
> 'leave'
>
> Off course the syntax to call it 'again' and the syntax to call it
for the first time should be different. In ICON this is
>done with the keyword 'each' but im not that certain is such recursion
tricks are good for Euphoria. It would allow you to
>write, if you want any recursive algorithm in one statement. But the
idea to be able to have a static position in a routine
>alone, should at least provide us with the technique to easily write
recursive algorithms with an undefined length of
>information, of which we need an undefined amount of.
>
> Oh, well, we can do this with Euphoria already, if we want. Just
split the function up appropiately into different routines,
>so maybe Im just being silly. (That would be a nice interface, a
declare_find (item, sequence) procedure and a next () function)
>
>Ralf
So... You don't know anything about such procedures?
Bye,
PQ
QC
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
5. Re: Questions...
>From: Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL>
>Subject: Re: Questions...
>To: EUPHORIA at LISTSERV.MUOHIO.EDU
>
>>I was wondering if there is a procedure/function
>>that converts EG : "12345" to 12345
>
> Its called value (), you can find it in get.e
>
>>I created this :
>>
>>[BEGIN]
>>
>>function kwadraat(integer dinges,integer totde,integer extra)
>
> Nederlands ?
>
No Dutch, (HAHA!!)
>>And also, if there's a proc/func that is like match(),
>>but gives ALL the locations back.
>
> That would be handy. I personally dislike the whole system of find
() and match ().
> I just wish we were able to do this tiny little trick that the
language 'ICON' lets us do.
> That is: be able to 'store' the position in a certain routine. That
the next time it is called, it returns at the position
>it has left. It would only time one new key word.
>
> 'leave'
>
> Off course the syntax to call it 'again' and the syntax to call it
for the first time should be different. In ICON this is
>done with the keyword 'each' but im not that certain is such recursion
tricks are good for Euphoria. It would allow you to
>write, if you want any recursive algorithm in one statement. But the
idea to be able to have a static position in a routine
>alone, should at least provide us with the technique to easily write
recursive algorithms with an undefined length of
>information, of which we need an undefined amount of.
>
> Oh, well, we can do this with Euphoria already, if we want. Just
split the function up appropiately into different routines,
>so maybe Im just being silly. (That would be a nice interface, a
declare_find (item, sequence) procedure and a next () function)
>
>Ralf
So... You don't know anything about such procedures?
Well, I gave one now....
Bye,
PQ
QC
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
6. Re: Questions...
- Posted by Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL>
Feb 17, 1999
-
Last edited Feb 18, 1999
>> Oh, well, we can do this with Euphoria already, if we want. Just
>split the function up appropiately into different routines,
>>so maybe Im just being silly. (That would be a nice interface, a
>declare_find (item, sequence) procedure and a next () function)
>>
>>Ralf
>
>So... You don't know anything about such procedures?
I was talking about a language improvement/change, a feature that would be
simerlar to what ICON offers.
Ive seen the procedures you gave and understand the uses for them. However often
we dont want one result or all result, but just
a number of results.. and the number often depends on what and where we find it.
So, I was considering a different syntax.
Actually, a syntax that allowed us to use the same algorithm on different ways.
Ralf
7. Re: Questions...
Ralfy wrote :
>>
>>So... You don't know anything about such procedures?
>
>
>I was talking about a language improvement/change, a feature that would
be simerlar to what ICON offers.
>Ive seen the procedures you gave and understand the uses for them.
However often we dont want one result or all result, but just
>a number of results.. and the number often depends on what and where we
find it. So, I was considering a different syntax.
>Actually, a syntax that allowed us to use the same algorithm on
different ways.
>
I read this a hundred times and
I still don't understand anything of it.
Can you give an example ?
Bye,
PQ
QC
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
8. Re: Questions...
>I read this a hundred times and
>I still don't understand anything of it.
>Can you give an example ?
Say, we're looking for 'e' in a string, but only for those on every 2nd place.
declare_find ('e', "Maybe I should try to explain in Dutch")
integer i
i = find_next ()
while i / 2 != floor (i/2) or i = 0 do
i = find_next ()
end while
if i then
puts (1, "Found a \'E\' at some 2nd place ")
else
puts (1, "Not found!")
end if
This is without the syntax. The new 'interface' of find allows us to do this,
but now, it doesnt allow us to use it in the
normal way, or to use it in the way you suggested (returning *all* results).
This means, we would need to rewrite the *same* algorithm three times, for three
different uses.
Ralf
9. Re: Questions...
- Posted by Bernie Ryan <bwryan at PCOM.NET>
Feb 17, 1999
-
Last edited Feb 18, 1999
ralf
In "C" that function is longjump() and setjmp() :)
bernie