r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

PeterWood
8-Dec-2008
[11434]
No all Rebol platforms store integers in little endian format.
[unknown: 5]
8-Dec-2008
[11435]
Steeve thanks  for the help, I think I can get bye with the debase/base 
to-hex 256 16
Steeve
8-Dec-2008
[11436]
Peter, no one says the opposite
Graham
9-Dec-2008
[11437]
Anyone got a robust dialect for dealing with command line, or other 
parameters passed by dropping ?
Robert
9-Dec-2008
[11438]
Is there a way that I can constrain a listening port to only accept 
connection from localhost? Using:
	open tcp://:40000

opens a listening port on port 40000 for all connections. Something 
like: open tcp://:127.0.0.1:44000
Pekr
9-Dec-2008
[11439x2]
you can check on incoming adress, no?
Robert - look at port/remote-ip item ...
Robert
9-Dec-2008
[11441]
Does this work or is it your assumption?
Pekr
9-Dec-2008
[11442x2]
Why shouldn't it work? IIRC IOS worked that way too, or it was some 
other script I saw. The simplest "firewall", by IP address ....
Opening local tcp listening port, waiting for connection. Then opening 
second console, connecting to first one:

local-ip: 127.0.0.1
remote-ip: 127.0.0.1
local-port: 8008
remote-port: 61532
Gregg
9-Dec-2008
[11444x2]
Robert, look at Maarten's Rugby source. He allows IP filtering, which 
may be all you need, or at least the clue.
Graham, I started an experimental command line dialect long ago, 
but it wasn't targeted specifically at file drops.
Graham
9-Dec-2008
[11446]
Is it around still?
Gregg
9-Dec-2008
[11447]
Need to look for the public location, if there was one, or just look 
at what I have here. 


Are you dropping on a desktop icon, or using the system port to file 
drop on a console window? (I assume the former)
Graham
9-Dec-2008
[11448x2]
mainly passing thru command line
but sometimes the former
Gregg
9-Dec-2008
[11450]
Regular command line parsing (args, switches, etc.) is what it was 
for. Should work for icon drops, since we just have to know what 
we're getting.
Graham
9-Dec-2008
[11451]
one is passed as a block, the other as a string
Maxim
10-Dec-2008
[11452x4]
yep
pretty powerfull too.
I'll put it on rebol.org is that ok?
Graham... FYI, I am working on my args.r module in order to make 
it public... just for you ... adding in-script documentation and 
cleaning up a few details  :-)
[unknown: 5]
12-Dec-2008
[11456x2]
what is the differences between port/size port/state/index and port/tail? 
 Port/tail does seem to point to the last posiition in the file port 
but what about the others.  I know that port/size doesn't really 
tell me the size of the file. I'm wondering thy that is.
I should say that port/tail does point to tail.
eFishAnt
18-Dec-2008
[11458]
I have a situation where I wish inside a while loop I could do a 
continue.  There is break, but I just want to go back to the top 
where my wait sits and wait for the next event coming in.

Has anyone done some solution to this?
Steeve
18-Dec-2008
[11459x4]
i use port/state/index to skip in the opened file.
beware, port/state/index is a zero-based index
to read the first byte of a file, you need to set port/state/inedx: 
0
i think it's a bug but it wroks like that
i should say too, that it works well with the low primitives read-io 
write-io, but i don't remember if it works as well with the standard 
functions like copy
Sunanda
18-Dec-2008
[11463]
EFishAnt -- use  a loop 1 [...] inside the while to simuate a "continue"
n: 1
while [n <> 10][
   loop 1 [
    n: n + 1
    if n = 5 [break]
    print n  
   ]
 ]
sqlab
18-Dec-2008
[11464]
forever [
	catch [
		wait [events]
		do-some-thing 
		if want-no-more [ throw ]
		do-more
	]
]
Steeve
18-Dec-2008
[11465]
generaly, i  like to use a case structure inside my loop.
while [n <> 10][
	n: n + 1
	case [
		n = 5 []		; break
		other-case [...]
		true [print n]   
	]
]
Sunanda
18-Dec-2008
[11466]
With my suggestion, it would look like this (Sqlab's may be more 
elegant)
n: 0
while [n <> 10][
	n: n + 1
   loop 1 [
	case [

		n = 5 [break]		; break
		n = 7 [print "its seven"]  ; example of another case
		true [print n]   
	  ]
	]
]
BrianH
18-Dec-2008
[11467]
R3 has a CONTINUE native. Not much help now I guess...
Pekr
18-Dec-2008
[11468x2]
How does 'continue in R3 work? I can't see it on wiki. Console help 
shows it, so yes, it does exist :-)
It would be good to mentione it eventually in Function notes section 
- there are new usefull R3 funcs .... well, if this one is generally 
usefull :-)
Steeve
18-Dec-2008
[11470]
i have done this too for more clarity:
continue: []
while [n <> 10][
	n: n + 1
	case [
		n = 5 continue		
		other-case [...]
		true [print n]   
	]
]
BrianH
18-Dec-2008
[11471x3]
The R3 continue works the way it does in any structured language 
with a continue operation. It's basically goto the end of the loop, 
while break is goto the point right after the loop.
R3's functions are still in flux. People often expect stuff put into 
the documentation to exist as documented.
Still, CONTINUE is likely to remain as it is.
Sunanda
18-Dec-2008
[11474]
That works. Steeve -- unless there is termination code between the 
end of the CASE and the end of the WHILE. That code does not get 
skipped:

continue: []
n: 0
while [n <> 10][
	n: n + 1
	case [
		n = 5 continue		
		n = 7 [print "it's seven"]
		true [print n]   
  ]
 print ["this gets printed even for n=5...." n]
 ]
BrianH
18-Dec-2008
[11475]
Sorry, my mention of R3 is probably off topic for this group. Nevermind.
Steeve
18-Dec-2008
[11476]
yes Sunanda no code must be inserted between the end of the case 
and the end of the loop.

If you can't refactoring your code to follow this rule, it's useless
BrianH
18-Dec-2008
[11477]
Sqlab's solution will still work though.
eFishAnt
18-Dec-2008
[11478x2]
Thanks, those are clever.  Muchos Appprechioto
I'm sure if I asked for Goto hacks, they must abound as well, or 
perhaps not be bound.
BrianH
18-Dec-2008
[11480]
Outside of rebcode, you can't goto down, but you can goto up with 
CATCH/name and THROW/name. Of course the structured goto replacements 
still work (RETURN, EXIT, BREAK).
Steeve
18-Dec-2008
[11481]
in fact i remember having to simulate a goto command when i tried 
to develop a Z80 emulator.
i had build a simple engine working like that:
code: [
	[ some code....]
	[ some code...]
	[ some code ... GOTO: 1]	; goto the first line of code
]
GOTO: 0
forever [
	GOTO: GOTO + 1
	do pick code goto
]
BrianH
18-Dec-2008
[11482]
That's a pretty standard switch interpreter model.
Steeve
18-Dec-2008
[11483]
yep, even if there is an error in my code, it's very easy to do