World: r3wp
[!REBOL3]
older newer | first last |
BrianH 20-Apr-2010 [2203x2] | That's the 8088 and its like. Real 8bit CPUs worked in bytes. |
I worked on CPM and DOS 1, so I know the difference :) | |
Ladislav 20-Apr-2010 [2205] | I meant e.g. http://en.wikipedia.org/wiki/Intel_8080 |
BrianH 20-Apr-2010 [2206x2] | (worked on in this case not meaning developing the OSes, but developing *on* the OSes) |
The 8bit vs. 16bit thing as most understand it referred to address space, not integer size :) | |
Pekr 20-Apr-2010 [2208] | The same was with Amiga and Motorola, just reverse, no? MC68000 was 32bit CPU with 16bit bus, whereas adress space and registers were 32bit? |
Ladislav 20-Apr-2010 [2209] | Actually, I remember MC68000 being called 16-bit processor (which is analogical as for I8080, mentioning the bus size, not the address space, or the integer size) |
BrianH 20-Apr-2010 [2210] | Ah, the good old days :) |
Ladislav 20-Apr-2010 [2211] | :-D |
Henrik 20-Apr-2010 [2212] | Anton, that might be a good syntax. A "shame" that x is already taken for pairs. |
Pekr 20-Apr-2010 [2213] | Henrik - I just wanted to say the same (re "x") ... I thought about "*", but not sure ... |
BrianH 20-Apr-2010 [2214] | I prefer to think that "shame" was put in quotes sarcastically :) |
amacleod 20-Apr-2010 [2215x2] | From R3 twitter: The first R3 embedded extension function evaluated! I think many of you are going to like this capability. |
A few days old but I did not see mention of it here. | |
BrianH 20-Apr-2010 [2217] | Yeah, based on the proposals and the docs it looks like it will be really simple and powerful, great stuff. |
Pekr 21-Apr-2010 [2218] | awake: func [event][ switch event/type [ connect [return true] read [read event/port all [0 = last event/port/data return true]] lookup [open event/port] wrote [read event/port] ] false ] p: open tcp://router-ip:8777 ;--- obfuscated, web public group p/awake: :awake wait [p 10] ;wait for connection write p "^F/login^@" wait [p 10] ;wait for data print to-string p/data close p >> ?!done%=ret=5faf15d6f67b41e74644b85dfef81ca6 Thanks Steeve, good work ... although thouse synchronous wait [p 10] are scary :-) I now have some noob questions: 1) I wonder, if we could have "more regular" way of handling timeouts? I mean - could there be a time event type, which could be put directly in the 'awake? Hmm, but that would be similar to face/rate probably, or would even require multitasking/threading, or would not be usefull at all :-) 2) Would it be possible to have at least minimal 'awake handler awailable for schemes like TCP? I know Carl told us, that having async networking comes with some price - it is not so easy to handle. But R2 simplicity of opening the port, inserting data, copying result, closing port, - is greatly missed ... |
Graham 21-Apr-2010 [2219x2] | sure .. why not |
create your own scheme, and put the waits in the scheme definitions for read or write etc | |
Pekr 21-Apr-2010 [2221x2] | I don't want my own scheme, I want bere-bones TCP/UDP to have some handler by default :-) |
(not talking about putting 'time inside the handler, that was just an idea) | |
Graham 21-Apr-2010 [2223x3] | Well, the http scheme has sync handler because Gab wrote one. |
so your microtik scheme can do the same | |
tcp is low level async .. so not really sync | |
Pekr 21-Apr-2010 [2226] | yes, I know. I don't care about Mikrotik right now, but about easy prototyping. With R2, I was able to start, just like with Telned - you open the port, insert some data, and watch things happening. Not so with R3. I would welcome, if even R3 TCP had some default awake handler, which could be later overriden, if needed ... |
Graham 21-Apr-2010 [2227x2] | so you have to type one more line ... |
the r3 port model makes things much easier to write schemes | |
Pekr 21-Apr-2010 [2229] | one more line? Do you mean port/awake: :my-awake? But I first have to define 'my-awake, no? Just trying to understand the situation ... |
Graham 21-Apr-2010 [2230] | and users should be using schemes and not low level tcp |
Pekr 21-Apr-2010 [2231] | Graham - I know ... and I would not trade R3 port model for R2. I am just asking, if there might be some "shortcut", to "simulate" R2 way of doing things :-) |
Graham 21-Apr-2010 [2232] | Yes, define a simple awake handler |
Pekr 21-Apr-2010 [2233] | OK, so there can't be any way :-) |
Graham 21-Apr-2010 [2234x2] | ask Carl I guess |
or create a new scheme called stcp:// for sync tcp | |
Pekr 21-Apr-2010 [2236x2] | There is a lots of possible usage to raw TCP .... this is for those, who like to try stuff in console. They will stop right after opening the port .... OK, I will ask Carl ... because - If all is needed is for me to define at least simple TCP awake, then why is it not included by default then? Or we can have some handler storage, from which you could choose just one ... |
ah, yes, that might be the way too. Such scheme could be then added to default distro, if found usefull | |
Graham 21-Apr-2010 [2238] | I haven't touched r3 or schemes since I finished the imap:// so I've forgotten everything now |
Pekr 21-Apr-2010 [2239] | just not probably stcp - evokes "secure" .... that would rise too much of expectations ... whereas we have no SSL in R3 :-( |
Graham 21-Apr-2010 [2240x3] | But I think it should be easy enough |
I thought you might say that ... | |
but encryption occurs at a higher level than tcp | |
Pekr 21-Apr-2010 [2243] | I know guys will not like it, but now I have "safe" way to OR/AND binaries the way I want :-) ... just not sure the way I find out the integer size is a good method ... pad-bin: funct [bin [binary!]][ bit-base: 8 * length? to-binary -1 switch bit-base [ 64 [return join #{000000000000} bin] ] ] >> (to-binary 1022) or pad-bin #{8000} == #{00000000000083FE} |
Ladislav 21-Apr-2010 [2244] | It *may be* what you want, but... What is the #{8000} binary? If it is a 16-bit signed integer, then it should be interpreted as -32768, not as 32768. |
Pekr 21-Apr-2010 [2245] | Ladislav - it came from Python's 0x8000 ... which is, if I understand guys correctly, not binary, but some kind of "binary literal integer" way of representation, which we don't have in REBOL. But, I know, that what Python mens, is 32678 ... and so that it fits my case :-) |
Ladislav 21-Apr-2010 [2246] | I think, that they confused you. It is not related to the Rebol binary datatype in any sense, it is just an alternative (hexadecimal) representation of integer. It is equivalent to date values in Rebol, where we can use alternative representations of values, e.g. 01-01-2010 , or 1/1/2010, or 1/Jan/2010. |
Pekr 21-Apr-2010 [2247x4] | Yes, I know. And I tried to help myself with binary. Suggestion to use integers, and shifting, might be accurate, but I am not here to crash my brain with operations I can't easily understand. So I try to find a convenient way. And what is convenient for me? To look into sources and to see, what is happening: >> a: to-binary 1022 == #{00000000000003FE} >> b: pad-bin #{8000} == #{0000000000008000} >> a or b == #{00000000000083FE} ... you see? I could imediatelly check, that OR was correct. And if I would be mistaken, or needed to perform shift, I can even use bitmap form, to see, what is happening: >> 2#{0000001111111110} == #{03FE} So - no, I will not use integers. And I don't have to, if my model fits what I am doing right now ... I still think that it can't fail me, and all those "you can't know what #{8000} means" are just theory for me right now :-) |
... and then - instead of Python equivalent code with 3 lines of shifting, I can just perform: append result to-char my-binary/7 append result to-char my-binary/8 ... or so I think ... | |
... the REBOL way, not just translated Python code ... | |
Is there any resolution to this topic? (Console) ... when playing with R3, I can't stand that ugly Windows "console" more and more :-) We can't even have multiline cut & paste :-( http://www.rebol.net/r3blogs/0282.html I don't remember the outcome - will we put R2 console back to Windows distro? Or wait for our own GUI based one? | |
Ladislav 21-Apr-2010 [2251] | >> ; R2 code converting integer -1 to 32-bit binary >> debase/base to-hex -1 16 == #{FFFFFFFF} ; R3 code converting the said binary to integer >> to integer! #{FFFFFFFF} == 4294967295 As far as I am concerned, it looks incompatible to me, and I would prefer -1 to be the result of the conversion in R3 |
Pekr 21-Apr-2010 [2252] | R3: >> to-hex -1 == #FFFFFFFFFFFFFFFF >> to-integer #{FFFFFFFFFFFFFFFF} == -1 |
older newer | first last |