Monday, January 21, 2019

Understanding the symbol layout

I ran into a reuse problem, all snippets need to define their own value types, in the key value pair. So I couldn't define the symbol type until the user defined a value se usin the uion statement.

Symbols come with a type field the snippet uses. That will be a small set of enums, at least.  Then the value field is designed to point to any memory construct the snippet has defined, unique or not.  The result is a simple type specifier, a Val is:

v.l  a long or  v.cookie, one of the xcb cookie things or v.src a pointer back to original source or.. ro..

The snippet defines that first, the uses the SYMBOL macro and the entire symbol table hold the user  defined pointers, a 64 bi fields which covers the entire system address space, remember this is all one user, the user's master console, so to speak.

There is another union, the Arg. That is in the commons and it defines all the things a valid linux arg can be, on the Bus. And we have conversion from non Arg types;

arg = arg_long(arg.l);

That one is fun, it unnecessarily moves arg into and out of a processor register.

So unions are big in a 64 bit address world, but not everything is reversable. Packing chars loses the src pointer, as I mentioned before.

I still do not think I have violated the no header rule. I still hold, if any snippet knows that a return of 0 means command no found, then it will be fine.

No comments: