• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

AltME groups: search

Help · search scripts · search articles · search mailing list

results summary

worldhits
r4wp5907
r3wp58701
total:64608

results window for this page: [start: 59001 end: 59100]

world-name: r3wp

Group: !REBOL3 Extensions ... REBOL 3 Extensions discussions [web-public]
Oldes:
10-Nov-2010
true, once I will understand the patterns, I will make a script, 
which will create the C code for me.
Oldes:
11-Nov-2010
When I have integer (from REBOL side) and want to use it as a pointer, 
what I must do?
Oldes:
11-Nov-2010
Is it correct? It's working but maybe there is something I don't 
see as a C newbie.
BrianH:
11-Nov-2010
Why are you using an integer on the REBOL side to store a pointer? 
That is what handle! is for.
BrianH:
11-Nov-2010
REBOL doesn't have pointers, it has references, and it doesn't have 
addresses. So the only way you could legitimately get a pointer is 
to return it from a command. But you don't want to have any way to 
construct an illegitimate pointer in REBOL and pass it to a command 
because that would be a much worse security and stability problem 
than just having commands at all, and treating pointers as integers 
lets you do that. So there is the handle! type to store pointers. 
A handle! is an immediate value that is the size of a pointer, but 
that you can't convert directly to or from any other value, or even 
mold it to see its contents. When you return a pointer from a command 
you set the value to the handle! type. Then that handle! will be 
usable when passed back to other commands in the same extension, 
and maybe even when passed to other extensions, depending on address 
space issues. Handles are also used to store function pointers in 
R3, and other opaque system values like library addresses.
PeterWood:
11-Nov-2010
Oldes: HAve you tested the function with a string including a unicode 
code point which translates to a three-byte utf-8 character? The 
size of utf8str appears to beonly  twice the number of codepoints 
in the REBOL stirng.


A good example of a three-byte utf-8 character is the Euro sign - 
Unicode 20AC UTF-8 E2 82 AC
PeterWood:
11-Nov-2010
The maximum length of a utf-8 translation of a UCS-2 string would 
be 1.5 times the length of the string. So if wcslen returns the number 
of codepoints in a string, the length of the utf-8 should be the 
length of the str multiplied by 3 integer divided by 2 plus 1.
Maxim:
11-Nov-2010
what you can do, is wrap your command within a function in the extension's 
module and expose that function.  this allows you to control the 
return type of the command better and handle it within the comfort 
of rebol.
Oldes:
12-Nov-2010
Again with Cyphre's help, here is a function which converts MultiByte 
(utf-8) string from C side to REBSER used to return the string to 
REBOL side:

REBSER* MultiByteToRebser(char* mbStr) {

    int len = MultiByteToWideChar( CP_UTF8, 0, mbStr, -1, NULL, 0);
    //the len is length of the string + null terminator
    wchar_t *wcStr = malloc(len * sizeof(wchar_t));

    int result = MultiByteToWideChar(CP_UTF8, 0, mbStr, strlen(mbStr), 
    wcStr, len);
    if (result == 0) {
        int err = GetLastError();
        RL->print("ERROR: MultiByteToWideChar -> %d\n", err);
        exit(-1); //how to throw ERROR on REBOL side?
    }
    REBSER *ser = RL_MAKE_STRING(len-1,TRUE);
    REBUNI *dst;

    //hack! - will set the tail to len
    REBINT *s = (REBINT*)ser;
    s[1] = len-1;

    RL_GET_STRING(ser,0,(void**)&dst);
    wcscpy(dst, wcStr);

    free(wcStr);
    wcStr = NULL;
    return ser;
}

I'm not sure how safe it is, but it seems to be working.
To return the string value I use:

RXA_TYPE(frm, 1) = RXT_STRING;
RXA_SERIES(frm, 1) = (REBSER *)MultiByteToRebser(utf8str);
return RXR_VALUE;
Oldes:
30-Nov-2010
I have a minute again.. so next step in my lesson...  Lets have:
typedef enum
{
  UndefinedResolution,
  PixelsPerInchResolution,
  PixelsPerCentimeterResolution
} ResolutionType;

and function like:  SomeFunc(const ResolutionType units);

What's the best way how to provide the units from the REBOL side 
to the extension's command?
ChristianE:
30-Nov-2010
Than you mentioned the wrapper you're going to write. Let me think 
about that a bit.
ChristianE:
30-Nov-2010
How is the above superior to

---- REBOL ----
some-func 'pixels-per-centimeter-resolution

---- C ----
if (unit == RL_MAP_WORD("pixels-per-centimeter-resolution") {
    SomeFunc(unit);
    return RXR_TRUE;
}

But a dialected approach like


>> some-func: func [unit [word!]] [select [pixels-per-inch-resolution 
1 pixels-per-centimeter-resolution 2] unit] 


does look ok to me, though. At least, that way, assigning other numerical 
values to the "keywords" wouldn't harm.
ChristianE:
30-Nov-2010
That is expected ;-) The numbers you'll get are fairly random. You 
would have to get the word-number of a supplied word and compare 
it to the word-number of the allowed words. If they match, act accordingly.
Oldes:
30-Nov-2010
(never mind, time to sleep for a while:)
Oldes:
1-Dec-2010
hm.. I think I understand how it's supposed to work now, but it looks 
it's just a temp solution. Here is the init part for graphics:
words: [
	;gui-metric
    screen-size
    border-size
    border-fixed
    title-size
    work-origin
    work-size
]
;temp hack - will be removed later
init-words: command [
	words [block!]
]
init-words words
ChristianE:
1-Dec-2010
Here's how I explained to myself how things went:


With A102, the time I started playing around with extensions, there 
was this RL_FIND_WORD which is supposed to map words against an "extension 
local" word block. But sadly, I never got that working.

It was the "temp hack" comment from which I concluded that the preferred 
method then became RL_MAP_WORD, which maps a word to a global word 
id, hence the 1381 number you've got yesterday. With that, you don't 
need to ENUM in your code but can just compare words supplied with 
words known.


But, I may be totally off track with that reasoning ... wouldn't 
take me any wonder :-)
Oldes:
5-Dec-2010
I just would like to know if it's possible for example to change 
the series tail on C side (and to avoid a need to init the series 
on REBOL side).
Oldes:
6-Dec-2010
I know I could just do it with different approach, but I'm still 
in a learning phase.
Oldes:
6-Dec-2010
That's the approach I was thinking about. It probably makes a sense 
as REBOL internal storage may differ.
Oldes:
6-Dec-2010
But I would like to know, if I can just change the provided variable 
without returning it back as a command result. (as it's possible 
with series).
BrianH:
6-Dec-2010
And you don't have to worry about the GC collecting a double since 
it will always be in a value slot, so all you have to do is protect 
the series or context it is in.
Cyphre:
6-Dec-2010
Brian, I'm not sure about that. IIRC the value slot of double passed 
as command! arg is just on the 'function command frame' at the time 
the command! is executed so it is a copy of the real value you are 
refering to.
BrianH:
6-Dec-2010
He was asking about changing the original. The only way to do that 
is to pass a reference to the series or context that contains the 
original value slot.
Oldes:
6-Dec-2010
if the frame is just a copy, is it possible to get the original?
BrianH:
6-Dec-2010
The frame is just another set of value slots that the values are 
copied into. You can only get the original by passing a reference 
to the value slot container. There are no free value slots.
Cyphre:
6-Dec-2010
because the arg passed to the command function is just a copy of 
the real value
Oldes:
6-Dec-2010
but it a little bit complicates the automatic building of wrappers 
for functions like that. btw... at this moment I can build imageMagick 
extension by parsing it's doc (~4500 lines of C code:).  Just must 
solve a few functions where it's using this approach to return multiple 
values and add some validity checks to make the extension safer.
Cyphre:
6-Dec-2010
The only way is to generate rebol wrapper func which will pass the 
args in a block! or object! imo.
Group: !REBOL3 Host Kit ... [web-public]
ssolie:
12-Oct-2010
I would like to try working on the Amiga-native graphics for R3. 
Please send me a copy of whatever sources I need to get started. 
I also need a copy of R3 for Amiga which Carl has not yet released.
ssolie:
12-Oct-2010
Yeah, I thought it was strange as well. Thought I read a note from 
Carl somewhere about a restore with a corrupt file... possibly a 
casualty?
ssolie:
12-Oct-2010
good idea.. is there a link to the sources?
Maxim:
12-Oct-2010
then, once carl or maybe henrik, gives you a link to a file with 
the Amiga stuff, you'll be in a much better position to port it.
ssolie:
12-Oct-2010
Thanks for the link Maxim! I'll take a look into this more once I 
get to my real job... lol
Maxim:
12-Oct-2010
your email lists you on a domain .ca... are you in canada? and if 
so where?  (if you don't mind)
Kaj:
12-Oct-2010
OK, but you also said there was a Linux distro in there
BrianH:
12-Oct-2010
Especially for a highly experimental release.
BrianH:
12-Oct-2010
I was pleasantly (but extremely) surprised that the a107 release 
was stable enough to build a new core with. The a1xx series has been 
really experimental, almost as unstable as other people's alpha software.
Kaj:
12-Oct-2010
Other people's betas are released, like, say a year after their alphas 
- but let's not dwell on that
BrianH:
12-Oct-2010
And less and less of R3 is in it with each release. We are externalizing 
a lot of it into the host portion, where you can see and modify the 
source.
ssolie:
12-Oct-2010
Is there a unit test framework for R3 (e.g. I use CppUnit for C++)?
BrianH:
12-Oct-2010
Not published at least. There is apparently a massive test suite 
for R2 (and possibly R3) that RT uses internally.
Kaj:
12-Oct-2010
I thought Carl generated a test suite for R3 a few years ago? And 
Ladislav seemed to be executing them
ssolie:
12-Oct-2010
For the to-be-made amiga host-kit, would it be possible to include 
both dynamic (libr3.so) and static (libr3.a) linked r3 core libs?
Andreas:
12-Oct-2010
libr3.a is unrealistic.
Andreas:
12-Oct-2010
I think we have a remote chance at eventually getting a partially 
linked libr3.o (which can then of course be wrapped in an .a on it's 
own).
Andreas:
12-Oct-2010
I don't know about Amiga or Win32, but at least with Linux linkers 
it's possible to achieve this in a way that should satisfy Carl.
BrianH:
12-Oct-2010
Why those restrictions, Andreas? Core is a statically linked host 
kit.
ssolie:
12-Oct-2010
I worked on the amiga python port and we provide a libpython.so which 
is what apps like Blender then utilize for embedding python
ssolie:
12-Oct-2010
just thinking out loud a bit while browsing the host-kit here..
Andreas:
12-Oct-2010
The primary reason there's no OSX hostkit is that Carl has not yet 
managed to generate a libr3 to his satisfaction :)
Maxim:
12-Oct-2010
he says he can't generate a .so on OSX that doesn't export all symbols
Andreas:
12-Oct-2010
Yeah, which is precisely what an .a does as well ("exporting all 
symbols", that is) :)
Andreas:
12-Oct-2010
Yeah, I sent Carl a complete example of how to achieve what he wants 
on OSX. But up until today he didn't get around to look into it.
Maxim:
12-Oct-2010
I really just think that maintaining several repos is currently to 
much work since it changes sooo oftern.  once the hostkit stabilizes 
a bit (within two or three releases is my guess) he should get around 
to concentrating on getting other distros their .so  


The amiga port was probably a good exercise in making the core lib 
even more cpu/platform agnostic.
BrianH:
12-Oct-2010
You can't reproduce Core from the host kit? I understand that you 
can't make official binaries, but there shouldn't be anything stopping 
you from creating a single program that does everything Core does 
from the host kit once the host kit is out of alpha.
ssolie:
12-Oct-2010
I imagine one idea would be to provide a single executable which 
contains r3 core and the app to keep things as simple as possible 
for some devices.
ssolie:
12-Oct-2010
oh, and a makefile I expect (or whatever build system)
ssolie:
12-Oct-2010
I think gmake is a good common denominator these days for build systems
Andreas:
12-Oct-2010
Agreed. The current makefiles are written for a much lower common 
denominator, though.
ssolie:
12-Oct-2010
ttfn.. this looks like it will be a fun little project.. just need 
to get the blessed libr3.so from carl
Andreas:
13-Oct-2010
And I agree, the current linking is quite annoying. Here's a patch 
how I fixed it: https://gist.github.com/d1c120789a4b7acb635d
Andreas:
13-Oct-2010
Yes, just didn't yet get around to opening a CC issue for it.
ssolie:
13-Oct-2010
Considering I was the one who ported AGG to Amiga I don't think it 
will be a big issue... :-)
Kaj:
13-Oct-2010
Thanks. This is still using the same trick as the first port almost 
a year ago, by using the Linux binary of the R3 interpreter library
Kaj:
13-Oct-2010
It's become a bit more complicated because R3 is now using the dynamic 
loader, but the Linux library still works on Syllable Desktop
Kaj:
13-Oct-2010
R3 Chat still doesn't work, though, but for a different reason than 
on Syllable Server
Kaj:
13-Oct-2010
I'm only testing it by starting the interpreter and trying a few 
commands
Maxim:
14-Oct-2010
Anyone know if we can shorten a block supplied to us in an extension?

it has to be the same block, not a copy.
Maxim:
15-Oct-2010
I think I'll be able to run the custom Gob Renderers in a multi-threaded 
setup by next week.


This means one thread will simply be rendering while the other will 
be handling events and manipulating data.


it should work since I've got changed state control built-into the 
primitve API, which lets the renderer know when to update its internal 
data... this will simply be set by the other thread.
Maxim:
15-Oct-2010
if a data change takes more time than a single refresh interval, 
(i.e. the change is still occuring when the renderer awakes for its 
next refresh) then the renderer simply reuses the previous internal 
data. while its new user data is being setup.
Maxim:
15-Oct-2010
primitives will have the possibility to setup run-time manipulators, 
which modify the internal primitive data on their own.  


this means you might not even notice that there is a frame jump in 
setup because the manipulators are still active, using the old data.... 

ex:  

'PRIMITIVE-A  has a targeting manipulator which keeps this model 
always aiming another model, 

'PRIMITIVE-B has a manipulator using a constant speed which ends 
up moving it in space.


now picture a situation where the scene update where taking longer 
than the sleeping time (or it just started at the wrong moment and 
occurs just before rendering starts).

if the main thread where responsible for triggering the refresh, 
you would see a noticeable lag. 


 but with this setup,  both primitives  would still continue to move, 
 while the speed is adjusted... when all the setup is done, the renderer 
 knows it can update and it then adjusts its internal data to reflect 
 the high-level changes made by the main thread.


the manipulators are C functions, so they will be very fast.  (there 
will be a special REBOL callback mode for testing, but it will be 
much slower)
Maxim:
15-Oct-2010
Added a few recommendations in the host-lib section of R3 chat.... 
please add comments there, if you have any... 

just saying you agree is good as it shows Carl that the ideas are 
shared by several of us.
Maxim:
15-Oct-2010
Added a few recommendations in the host-lib section of R3 chat.... 
please add comments there, if you have any... 

just saying you agree is good as it shows Carl that the ideas are 
shared by several of us.
Pekr:
19-Oct-2010
What does it mean?:

- Embedded GOB containers in text
- Gob - Renders GOB embedded in text


I can't imagine, how this stuff works, and is organised. However 
- i am buying a book on text typography and layout, but so far from 
what I have read, you basically divide page into columns or boxes 
section, you can link them, those columns/rows have those typical 
margins, origings, etc. set, but we are talking DTP tools here :-) 
Are we getting something similar here?:


It is possible to have multiple paragraphs defined in one Rich Text 
block. Paragraphs are positioned one ofter another vertically. Vertical 
space between pargraphs is defined by PARA/INDENT/Y values. Use COLUMNS 
command(see below) to define how many paragraph columns should be 
used for paragraph layout.


... some wireframe model showing the terms on the image would be 
usefull ... but maybe others will understand, what's your idea ...
Oldes:
19-Oct-2010
Just a detail... first paragraph should not be indented. The indent 
should be used only between paragraphs.
AdrianS:
19-Oct-2010
indent is not typically used as a term to mean spacing between columns 
- is the dialect already set?
Maxim:
19-Oct-2010
one thing which is sorely missing in the general GUI concepts of 
text is flowing text from boxes to boxes.
  

multi-columns are an example of a simple floating text box implementation... 
maybe you could go all the way and add support for arbitrary text 
boxes which flow with content from "previous" boxes when text reaches 
the end of the previous box?
Maxim:
19-Oct-2010
its actualy not that complicated... in the sense that you must only 
know the coords of the boxes (something like sub gobs) and then when 
the text reaches the lower right corner of a box, a decision is made... 
either the box can stretch a little or you jump to a new box to render 
into.


implementing columns thus becomes a specific case of a generalized 
solution.  just provide two sub gobs and texts flows from one to 
the other.


note that the text boxes are independent from paragraph... these 
boxes are the actual "page" area which the rtf uses to calculate 
bounds and word-wrapping and offsets and such.
BrianH:
19-Oct-2010
Some DTP or word processing functions let you embed non-rectangular 
objects in their text, and the text wraps around their curves. I 
don't expect your system to do this, but it's a really cool feature.
Cyphre:
19-Oct-2010
ah, got it...since the gobs are rectangular we would need to provide 
kind of mask for that. Could be a cool feature but I'd play with 
this once everything else is working :)
Oldes:
19-Oct-2010
in InDesign you can also specify number of rows which should be indetnet 
at the beginning of the paragraph (not just one line) so you can 
place image as a first letter.
Oldes:
19-Oct-2010
Hm.. when I think about it, it would be better not to use image, 
but letter with bigger height.. but than it would be required to 
be able flow around such a letter. But that's maybe too complicated. 
Better to have something working first.
Pekr:
20-Oct-2010
Cyphre - I am not sure if we should accept CSS document model here, 
as users/designers are used to it? I tried to search for some typography 
vocabulary, but there is not much in it:

http://www.proximasoftware.com/fontexpert/terms/


Then I also looked into MS Word (well, not the best DTP option, I 
know :-), but I am somehow satisfied, how paragraph styling is done 
in it, and I find it pretty much flexible. So few of my notes:

PAGE:
--------
- text-gob - let's say it equals to page


- margin should allow to set 4 sides, as is with CSS and even DTP 
systems. DTP system talk about margin as about the space to the edge 
of the paper. I don't know, how such terms are used in conjunction 
to R3 GUI, but we should somehow find-out, how to not be confusing. 
But - having just a single marign is not imo sufficient.


- origin should replace scroll, and it should mean offset. But looking 
into VID2, origin just did what you propose - but I don't like it, 
as it required us to introduce offset to VID2.

PARA:


- indent - e.g. MS Word defines: indent-left, indent-right (kind 
of creates margins/padding, if you relate to CSS terms), then they 
have indent-special - first-line | "pre-indent" (-first-line,not 
much usefull). It also has check-box for "mirror setting", which 
changes indent-left to inner, and indent-right to outer (dunno what 
it is good for)


- spacing - top-space | bottom-space - but here, it is not inner 
space in paragraph, it is more of an indentation between paragraphs. 
In other words - I can imagine calling it even padding (as we are 
used from VID2, we used space there for the auto-spacing). It allows 
you to set, that it will not add space in between two paragraphs 
of the same style. It also allows you to set spacing for rows - either 
by float, or by multiples, 1,5 rows, double, the-least-possible (pixels), 
exactly (pixels)


- paging - some stuff to set in regards to paragraph and paging, 
as linking of paragraphs, linking of lines

- runaround settings (dunno if correct english term)
Maxim:
20-Oct-2010
CSS is VERY bad at text layout.  I would not want use that model 
for a rich text editor... really it would be aggravating.
Pekr:
21-Oct-2010
When I translate it is just the same :-) You allow indentation of 
more than one line as a bonus :-)
Pekr:
21-Oct-2010
But negative indent just means - start at the first pixel from left 
for the first indented lines, use the value as a padding-left value 
from the left. Paragraph itself should stay where it is ....
Pekr:
21-Oct-2010
Hmm, here's how I understand bullet points in MS Word - they allow 
you to choose various symbols, or numbers. You can have even number 
hierarchies. But then they made it rather easy. Simply put, indentation 
of paragraph defines, where bullet point starts. In our case, it 
is going to be pad-left value in paragraph. And then they use special 
inden - in our case we could use indent with just single integer 
value - that defines indentation of bullet point and text which follows 
it.


Typically the text is block-aligned in such a case, but you can also 
set it otherwise ....
Carl:
23-Oct-2010
Pekr... on MS Word, it puzzles me how such a horrible product has 
made it as a world standard this long.
Henrik:
23-Oct-2010
Related to text handling discussion, which I suppose occurs at the 
host-kit level. But it should probably have a separate group.
Maxim:
23-Oct-2010
doing a bit of stress-testing... I've just loaded a 15MB polygonal 
model of a tree in my 3d system ... it has ~350000 polygons and ~180000 
vertices.

a bit slow using the current unoptimized Old-school OpenGL commands, 
but I'm still averaging about 10 frames a sec on my 4 year old mobile 
nvidia GPU (which is like 16 times slower than an average desktop 
card of today ).
Maxim:
23-Oct-2010
so the gruesome task of making a release starts tomorrow. now that 
I've got at least a measure of assurances that CGRs are stable.
Maxim:
23-Oct-2010
note that this release will not actually be usefull for any application 
work, its just a proof of concept which hopefully will allow Carl 
and others to see just how flexible the host-kit already is.
Maxim:
23-Oct-2010
Andreas, \thanks for the Fix notes (posted int !REBOL3 group)


I'll add your changes to my A109 and embed the latest CGR code into 
it.  I'll to release this by tomorrow, but no guarantees, i've got 
a lot of other stuff to do.
Maxim:
24-Oct-2010
I just crapped one of the files of my custom host kit environment... 
doh... just as I was doing a backup.
Maxim:
24-Oct-2010
trying a disk restore app to find it in the deleted files on disk.
Maxim:
25-Oct-2010
I can't seem to be able to use the function 'REPLACE from within 
the init code of an extension under A109.   

in A107, using the same source code I have no problems

but now (in A109) I get this error:
** Script error: replace word is not bound to a context
BrianH:
25-Oct-2010
In a fresh console:
>> in lib to-word "replace"
== replace
>> sys/load-module "rebol [] print type? :replace"
function!
== [none make module! [
    ]]

So that is not the problem - REPLACE is defined in lib at startup.
BrianH:
25-Oct-2010
The extension module source is loaded the same way as other modules. 
Are you using a different boot level?
BrianH:
25-Oct-2010
Host code goes through a process at load time and loading most of 
the mezzanines happens later in the process. If you load your extension 
before the mezzanines finish loading, no REPLACE.
BrianH:
25-Oct-2010
Something occurred to me after I left torun errands: You could use 
options: [delay]. Your extension object would be loaded, but the 
module itself wouldn't be imported until the first time you refer 
to it with the IMPORT function or a Needs header. That way you can 
run the RL_Extend whenever you want, but delay actually setting up 
the extension until the runtime is in place.
59001 / 6460812345...589590[591] 592593...643644645646647