Main Page   Modules   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

naming.h File Reference

#include <koLib/sets.h>

Go to the source code of this file.

Compounds

struct  kdsDomain
 rules for a namespace domain. More...

struct  kdsNamer
 structure of the bindings-registerer (the Namer) More...

struct  kdsBinding
 structure of a binding (linking a name to a value) More...

struct  kdsKey
 define a key for a binding (the symbolic name) More...

struct  kdsReverseBinding
 structure for an entry in the reverse index (for rLookup). More...

union  kdsValue
 possible types for a value in KDS. More...


Defines

#define __VIRTUAL_SETS__
#define KDS_BINDINGS_NUMBER   20
#define KDS_BINDINGS_BITS   2
#define __KDS_COMMON_SERIALIZER__
#define KINT(x)   KDS_ATOMIC|KDSA_POINTER,(kdsValue){i:x}
#define KSTR(x)   KDS_ATOMIC|KDSA_ALPHA,(kdsValue){str:x}
#define KPTR(x)   KDS_ATOMIC|KDSA_POINTER,(kdsValue){ptr:x}
#define KSET(x)   KDS_SET,(kdsValue){set:x}
#define KMKSET(flags, sizehint)   KDS_SET,(kdsValue){i:(sizehint<<8)|(flags&0xff)}
#define KOBJ(x)   KDS_OBJECT,(kdsValue){ptr:x}
#define KSERIAL()   KDS_SERIAL,(kdsValue){}
#define kdsNil   (kdsValue){i:0}
#define kdsGetGlobalType(pnamer)   ((pnamer->flags & 0x70)>>4)
#define KDS_STOPCHARS   ".$%*:?!@#"
 characters defining the end of a path item.

#define KDS_VALIDCHARS   "0123456789-_&"
 characters allowed in names (plus A->Z and a->z)

#define kdsCheck(_ptr, place)   if (!_ptr) _ptr=kdsDoCheck(place)

Typedefs

typedef enum kdsBindingFlag kdsBindingFlag
 Flags for typing the binding (what type is the value?).

typedef enum kdsAtomsTags kdsAtomsTags
 tells sub-types for ATOMIC values

typedef kdsKey kdsKey
 define a key for a binding (the symbolic name)

typedef kdsBinding kdsBinding
 structure of a binding (linking a name to a value)

typedef kdsReverseBinding kdsReverseBinding
 structure for an entry in the reverse index (for rLookup).

typedef enum kdsNamerFlags kdsNamerFlags
 encoding of access rights for user-level progs.

typedef unsigned kdsSerial
typedef kdsDomain kdsDomain
 rules for a namespace domain.

typedef kdsNamer kdsNamer
 structure of the bindings-registerer (the Namer)


Enumerations

enum  kdsBindingFlag {
  KDS_CONSTANT = 8, KDS_TYPEMASK = 7, KDS_ATOMIC = 4, KDS_INVALID = 0,
  KDS_OBJECT = 1, KDS_SET = 2, KDS_SERIAL = 3, KDS_SERIAL_REQUEST = 16,
  KDS_REUSE = 32
}
 Flags for typing the binding (what type is the value?). More...

enum  kdsAtomsTags { KDSA_POINTER = 0, KDSA_INT = 1, KDSA_ALPHA = 2 }
 tells sub-types for ATOMIC values More...

enum  kdsNamerFlags {
  KDS_USRNONE = 0, KDS_USRREAD = 1, KDS_USRMODIFY = 2, KDS_USRMANAGE = 3,
  KDS_ACCESSMASK = 3, KDS_HAS_REVERSE_INDEX = 4, KDS_COMMON_SERIALS = 8, KDS_UNIFORM = 0x80
}
 encoding of access rights for user-level progs. More...


Functions

kdsNamerkdsFindPath (kdsNamer *from, char *path, char **terminal, int user)
 gets the last (terminal) namer of a path

kStatus kdsRegister (kdsNamer *n, char *path, kdsBindingFlag f, kdsValue val)
 Adds a binding in a namer.

kdsValue kdsLookup (kdsNamer *n, char *path, byte *type)
 retrieves a value in a namer

char * kdsRLookup (kdsNamer *n, char *path, int uid, byte *type)
 looks for a key from a serial ID

kStatus kdsUpdate (kdsNamer *n, char *path, kdsValue val)
 updates the value of a "variable".

kStatus kdsUnregister (kdsNamer *n, char *path)
 removes a key from a set

char * kdsIntern (kdsDomain *, char *ext)
 Copies a string into KDS' internal mempory.

char * kdsValidate (kdsDomain *, char *i)
 confirm using the symbol

void kdsDiscard (kdsDomain *, char *i)
 cancel a symbol registration.

void * kdsDoCheck (char *path)

Variables

kdsDomain kdsMain


Define Documentation

#define __KDS_COMMON_SERIALIZER__
 

#define __VIRTUAL_SETS__
 

********************************************************************* Naming System ** -------------------------------------------------------------------** Functions that let us use a SET (btree, hash table, ...) to store ** bindings between symbolic names (strings) and values with a hierar** chy possibility (you can define subsets and give path to them ** -------------------------------------------------------------------** Initial Release: Pype - 14.11.00 - ** Last Change: Pype - 24.11.00 - Added the "kdsUpdate" method ** Pype - 17.05.01 - Common Serials ** Pype - 24.11.01 - Adding the recognizer field in the kdsNamer ** 01.05.02 - namer now have its own name and parent in its structure**

#define KDS_BINDINGS_BITS   2
 

#define KDS_BINDINGS_NUMBER   20
 

#define KDS_STOPCHARS   ".$%*:?!@#"
 

characters defining the end of a path item.

for now, we just use '.' and ':' '.' separates components of a path : "abc.xyz" means "xyz" in the namer identified by "abc" like for directories in a filesystem.

'*' used to skip the "leaf" part when doing a reverse search in KDS2.0, it will be able to return a enumeration of held items if you use it in a "direct" lookup. ex: kdsLookup("system.modules.*"); kdsRLookup("koLib.*",my_class_id);

':' separation between an interface name and a method name.

'?' will be used to register an object recognizer on a set. kdsRegister("system.modules.?",modules_recognizer);

'$' apply the built-in "toString" method on an object. ex: kdsLookup("system.modules.microkernel$");

'!' in KDS2.0, apply a specific method to an object ex: kdsRegister("system.modules.debug!remove",<args>);

'@' in KDS2.0, used to create a Wrapper around a given object.

'#' in KDS2.0, used to set up a specific reverse set on a subset.

#define KDS_VALIDCHARS   "0123456789-_&"
 

characters allowed in names (plus A->Z and a->z)

#define kdsCheck _ptr,
place       if (!_ptr) _ptr=kdsDoCheck(place)
 

#define kdsGetGlobalType pnamer       ((pnamer->flags & 0x70)>>4)
 

#define kdsNil   (kdsValue){i:0}
 

#define KINT      KDS_ATOMIC|KDSA_POINTER,(kdsValue){i:x}
 

#define KMKSET flags,
sizehint       KDS_SET,(kdsValue){i:(sizehint<<8)|(flags&0xff)}
 

#define KOBJ      KDS_OBJECT,(kdsValue){ptr:x}
 

#define KPTR      KDS_ATOMIC|KDSA_POINTER,(kdsValue){ptr:x}
 

 
#define KSERIAL      KDS_SERIAL,(kdsValue){}
 

#define KSET      KDS_SET,(kdsValue){set:x}
 

#define KSTR      KDS_ATOMIC|KDSA_ALPHA,(kdsValue){str:x}
 


Typedef Documentation

typedef enum kdsAtomsTags kdsAtomsTags
 

tells sub-types for ATOMIC values

typedef struct kdsBinding kdsBinding
 

structure of a binding (linking a name to a value)

typedef enum kdsBindingFlag kdsBindingFlag
 

Flags for typing the binding (what type is the value?).

typedef struct kdsDomain kdsDomain
 

rules for a namespace domain.

typedef struct kdsKey kdsKey
 

define a key for a binding (the symbolic name)

we use a hash function on each name we get and store the result as a 24-bits with the key. This gives better results when comparing keys while most of the time, we only need to check hash values (ints) instead of strcmp() the whole names

typedef struct kdsNamer kdsNamer
 

structure of the bindings-registerer (the Namer)

typedef enum kdsNamerFlags kdsNamerFlags
 

encoding of access rights for user-level progs.

it also defines the flags for kdsNamer options (like the presence of a reverse index, ...)

typedef struct kdsReverseBinding kdsReverseBinding
 

structure for an entry in the reverse index (for rLookup).

typedef unsigned kdsSerial
 


Enumeration Type Documentation

enum kdsAtomsTags
 

tells sub-types for ATOMIC values

Enumeration values:
KDSA_POINTER  pointer to unknown-structured
KDSA_INT  integer (32 bits)
KDSA_ALPHA  pointer to a characters string

enum kdsBindingFlag
 

Flags for typing the binding (what type is the value?).

Enumeration values:
KDS_CONSTANT  the value cannot be modified
KDS_TYPEMASK 
KDS_ATOMIC  the value is an atomic type (int, ...)
KDS_INVALID 
KDS_OBJECT  the value is an OBJECT reference
KDS_SET  the value is a subset
KDS_SERIAL  the value is some serial number ...
KDS_SERIAL_REQUEST  generate a serial number for an object.
KDS_REUSE  don't fail if the object already exist

when KDS_SERIAL|KDS_REUSE is given to kdsRegister(), the call will not fail in case of an existent key: it will return the already-registered value.

enum kdsNamerFlags
 

encoding of access rights for user-level progs.

it also defines the flags for kdsNamer options (like the presence of a reverse index, ...)

Enumeration values:
KDS_USRNONE  no access to user level
KDS_USRREAD  access granted for reading.
KDS_USRMODIFY  access granted for reading and updating
KDS_USRMANAGE  access granted for reading, updating and (un)registering
KDS_ACCESSMASK 
KDS_HAS_REVERSE_INDEX  do we have a reverse (value->key) index?
KDS_COMMON_SERIALS  Single "SERIALS" manager for all subsets.
KDS_UNIFORM  All objects have the same structure.

this is implied if you register an Objects Recognizer...


Function Documentation

void kdsDiscard kdsDomain  ,
char *    i
 

cancel a symbol registration.

void* kdsDoCheck char *    path
 

shouldn't we prevent the removal of CONSTants ?

char* kdsIntern kdsDomain   dom,
char *    str
 

Copies a string into KDS' internal mempory.

the binding between str and kdsIntern(str) is registered in an internal Namer. If the same 'str' is given further, we *won't* copy the string twice ;)

char* kdsRLookup kdsNamer   n,
char *    path,
int    uid,
byte   type
 

looks for a key from a serial ID

we only looks in KDS_SERIAL bindings. usually, the path is a ".*" or "." terminated If the serial key is not located in the target namer, then we'll

char* kdsValidate kdsDomain  ,
char *    i
 

confirm using the symbol


Variable Documentation

struct kdsDomain kdsMain
 


Generated on Mon Jul 14 17:00:30 2003 for Clicker32Kernel by doxygen1.2.18