My GSoC is getting underway with improvements to the NCI system. After
reading over the current work and suggestions for the NCI system I have come
up with the following suggestions/improvements to the current system.
Current NCI System:
v - Void. As a return type it indicates that there is no return
type.Not valid as a parameter type.
c - Char. This is an integer type, taken from (or put into) an I
register. NOTE: it might be signed or unsigned because that is how an
unadorned C 'char' works.
s - short. An integer type, taken from or put into an I register. It
is always signed, not unsigned.
i - int. An integer type. It is always signed, not unsigned.
l - long. An integer type. You know the drill. It is always signed,
not unsigned.
f - float. F register denizen.
d - double. F register, double-precision floating point type
P - A PMC register.
p - PMC thingie. A generic pointer, taken from a PMC by using its
get_pointer vtable function, or NULL for a PMCNULL. If this is a
return type and the value is NULL, PMCNULL is returned, otherwise
parrot will create a new UnManagedStruct PMC type, which is just a
generic "pointer to something" PMC type which Parrot does no
management of.
2 - A pointer to a short, taken from an P register of an int-like PMC.
3 - A pointer to an int, taken from an P register of an int-like PMC.
4 - A pointer to a long, taken from an P register of an int-like PMC.
t - string pointer. Taken from, or stuck into, a string register.
(Converted to a null-terminated C string before passing in)
U - This parameter is used for passing user data to a callback
creation. More explanation in the callbacks section.
New Extensions:
Base Data Types:
c = char - 8 bit
b = int8 - 8 bit
w = w_char, system dependent
s = short - 16 bit
l = long - 32 bit
i = int
q = long long - 64 bit
f = float
d = double
D = long doulbe (if supported)
v = void
t = string pointer. From a string register. (null-terminated C String)
U = Callback
Modifiers:
Prefix:
* = Pointer
su = Signed or Unsigned
& = pass_by_ref in functions, only valid in function defintions
! = Native Type
^ = UnManaged
> = force big-endian
< = force little-endian
Infix:
| = union of left two right
Postfix:
i# = int of size ##, eg. i8, i16, i32, i64, i128...
{...} = key name, only valid in a structure after a definition.
[...] = array of a set size
Circumfix:
(...) = structure
Examples:
*c = char*
*(iuqd) = struct { int; unsigned long long; double}*
*(i{foo}d{bar}) = struct { int foo; double bar }*
***i = int*** (pointer's can point to pointers)
Also, whitespace would be legal, inside the string, it just has no effect on
anything. It might be useful for visually separating components, eg.
*(d{price} i{id}) = struct { double price; int id; }*;
Questions, comments, suggestions?
--
John Harrison
_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev