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

World: r3wp

[Core] Discuss core issues

Pekr
9-Nov-2006
[6137]
other - lowering dekstop timeout - absolutly obtrusive experience 
trying to connect to internet, when you are behind the proxy. I would 
not connect by default
Anton
9-Nov-2006
[6138x2]
Hmm.... I think "medium".  It's good to also note in your bug report 
why it was a problem for you (the space was sucked out of the block).
(also note the workaround you use.)
Rebolek
9-Nov-2006
[6140x2]
I've no workaround right now, because I've noticed it half an hour 
ago, but Cyphre's example looks promising.
I'm not sure why I'm using first [ < ] instead of "<" because the 
second looks more logical
Maxim
9-Nov-2006
[6142x6]
I have a little question regarding extern library useage...
I am supplying a string! to a function, which is supposed to be used 
as a buffer.
lets say:

buf: make string! 100
but when the function returns, my string is still size 0.  although 
I know the call has worked!
cause If I send a string filled up with 100 spaces, I actually get 
some chars overwritten and a 0 char where it should...
so my question is basically, what is the proper/expected means of 
submitting a buffer ?
Pekr
9-Nov-2006
[6148x3]
if you submit string to your function, it sends just pointer
so it should work correctly, expecting zero terminator in C level?
maybe it would be better to see your wrapper
Maxim
9-Nov-2006
[6151]
hum... I think I understand something... because the call, is not 
returning a string!, but filling up a buffer, REBOL has no means 
to know that it should fix the string! and resize it to the zero 
terminator, right?
Graham
9-Nov-2006
[6152x2]
don't  you define in your wrapper call what the function returns?
You don't pass a string as a bit of memory to be filled ...
Maxim
9-Nov-2006
[6154x2]
yes it returns success, but fills up the buffer I send it... it does 
not return the buffer itself...
well many C calls expect a buffer as an argument... what's the prefered 
method then?
Pekr
9-Nov-2006
[6156x2]
it would be good to see original C function spec. Because - e.g. 
when I was wrapping one function (trying to investigate red-icons 
problem IIRC), the function was clearly expecting chars (certain 
amount), but it did not work, untill Ladislav came in and changed 
it to struct for that part of function.
I just hope, that for R3, more automatic wrapping will be possible.
Maxim
9-Nov-2006
[6158x3]
yeah... like .h file loading ;-)  we can always dream  ;-)
my routine spec:

		username: make routine! [
			"Get the current logon name of thread which launched REBOL"
			buffer [char*]
			count [string!]
			return: [integer!]
		] libinfo "GetUserNameA"
C spec:

BOOL GetUserName(
  LPTSTR lpBuffer,
  LPDWORD lpnSize
);
Gabriele
9-Nov-2006
[6161]
about [<] - I think I have reported the problem like 5 years ago. 
In my scripts I use to lit-word! "<".
Pekr
9-Nov-2006
[6162]
is double word correctly specified as a string? (count). Should not 
it be an integer?
Rebolek
9-Nov-2006
[6163]
Five years ago? OK, why do I care:)))
Maxim
9-Nov-2006
[6164x2]
pekr:  its actually a word pointer  and  MS example look like so:
GetUserName( infoBuf, &bufCharCount )
which is why I supplied a string, so that the get user name would 
receive a pointer instead of a number.
Pekr
9-Nov-2006
[6166]
pointer is a number
Maxim
9-Nov-2006
[6167]
&bufCharCount  asks to get the pointer to the word, not the value 
of the word... no?
Pekr
9-Nov-2006
[6168x2]
what about trying putting struct instead of buffer [char] in there? 
:-), with first element being a string? Struct itself will be represented 
as a pointer
well, maybe better wait for someone like Ladislav or Anton or Gabriele 
or anyone else more experience than me. I always work by guess, try, 
change aproach, till it works (or it does not :-))
Maxim
9-Nov-2006
[6170]
just one question, how many bytes is a double word (in MS) supposed 
to have 4 or 8?
Pekr
9-Nov-2006
[6171x3]
16?
sorry, mixed bytes and bits :-)
bit, byte=8bit, nibble=4bit, word=32bit=4bytes, double=64bit=8bytes?
Maxim
9-Nov-2006
[6174]
k thanks, just wanted to confirm.. I've just not been thinking in 
those terms for soo long.
Pekr
9-Nov-2006
[6175x2]
my friend suggests me, that it can't be said - it depends upon platform. 
Typically it is good to use sizeo(word) to get the idea ...
sizeof
Maxim
9-Nov-2006
[6177]
I think that is more a problem with the use of int and long.
Pekr
9-Nov-2006
[6178]
try wikipedia - some good entries there ...
Maxim
9-Nov-2006
[6179x2]
but... anyhow... thanks... by chatting with you I realized why my 
string was staying at 0 length, while its actually filled with the 
data.
yesss... I do more and more... computer sciences are very well explained 
on it.
Pekr
9-Nov-2006
[6181]
so what actuall you realized?
Maxim
9-Nov-2006
[6182x5]
string! have an internal size and an external size.  using a string 
within rebol, will always update the size, so that it returns the 
current amount of the string! which has been "filled"
which is why 
>>  make string 100
== {}
internally, its 100 bytes long, but externally, it hasn't been filled 
so its still length? 0
now the external call dumps chars directly in the string and add 
a null termination.
but obviously, since REBOL didn't fill it... it still thinks it length? 
0  ... but its internal buffer really does contain data!