wiki:Registry2Notes

Version 5 (modified by raimue (Rainer Müller), 15 years ago) (diff)

typo

Introduction

Note that some source files have doxygen-style comments, so some docs can be created by running doxygen on them.

registry2.0 code

Code: trunk/base/src/registry2.0

Tcl commands created

  • registry::entry cmd ?arg ...?
    • Run a command against registry entries (implemented in entry.c)
    • Commands are:
      • create - entry_create()
      • delete - entry_delete()
      • open - entry_open()
      • close - entry_close()
      • search - entry_search()
      • exists - entry_exists()
      • imaged - entry_imaged()
      • installed - entry_installed()
      • owner - entry_owner()
  • ${entry} cmd ?arg ...?
    • Commands specific to just one registry entry (usually gained from registry::entry) (implemented in entryobj.c)
    • Commands are:
      • name - entry_obj_prop()
      • portfile - entry_obj_prop()
      • url - entry_obj_prop()
      • location - entry_obj_prop()
      • epoch - entry_obj_prop()
      • version - entry_obj_prop()
      • revision - entry_obj_prop()
      • variants - entry_obj_prop()
      • default_variants - entry_obj_prop()
      • date - entry_obj_prop()
      • state - entry_obj_prop()
      • installtype - entry_obj_prop()
      • map - entry_obj_filemap()
      • unmap - entry_obj_filemap()
      • files - entry_obj_files()
      • imagefiles - entry_obj_imagefiles()
      • activate - entry_obj_activate()
      • deactivate - entry_obj_filemap()
      • dependents - entry_obj_dependents()
      • dependencies - entry_obj_dependencies()
      • depends - entry_obj_depends()
  • item cmd ?arg ...?
    • Implemented in item.c
    • Commands are:
      • create - item_create()
      • search - item_search()
      • exists - item_exists()
      • others are commented-out (retain, release, name, url, path, worker, options, and variants)
  • ${item} cmd ?arg ...?
    • Implemented in itemobj.c
    • Commands are:
      • retain - item_obj_retain()
      • release - item_obj_release()
      • key - item_obj_key()
  • Top-level registry commands (implemented in registry.c):
    • registry::open - registry_open()
    • registry::close - registry_close()
    • registry::read - registry_read()
    • registry::write - registry_write()
    • registry::entry - entry_cmd()

C code files

entry.[ch]

  • void delete_entry(ClientData clientData)
    • to be used as the 'Tcl_CmdDeleteProc' for an entry object
  • int entry_cmd(ClientData clientData UNUSED, Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[])
    • implements "registry::entry cmd ?arg ...?"

entryobj.[ch]

  • int entry_obj_cmd(ClientData clientData, Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[])
    • implements "${entry} cmd ?arg ...?" (procs for entry objects from "registry::entry")

graph.[ch]

graphobj.[ch]

  • Not completed, not built

item.[ch]

  • int item_cmd(ClientData clientData UNUSED, Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[])
    • implements "item cmd ?arg ...?"

itemobj.[ch]

  • int item_obj_cmd(ClientData clientData, Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[])
    • implements "${item} cmd ?arg ...?" (procs for item objects from "item"

registry.[ch]

  • reg_registry* registry_for(Tcl_Interp* interp, int status)
    • Get the appropriate registry for the given Tcl interpreter
  • int registry_failed(Tcl_Interp* interp, reg_error* errPtr)
    • Sets a Tcl object result based on errPtr
  • int Registry_Init(Tcl_Interp* interp)

util.[ch]

  • char* unique_name(Tcl_Interp* interp, char* prefix)
    • Generate a unique proc name starting with the given prefix (eg, <prefix>123, <prefix>124, etc)
  • int parse_flags(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[], int* start, option_spec options[], int* flags)
    • Handle flags (-flag) in Tcl command strings
  • void* get_object(Tcl_Interp* interp, char* name, char* type, Tcl_ObjCmdProc* proc, reg_error* errPtr)
    • Retrieves the object whose proc is named by the given name
  • int set_object(Tcl_Interp* interp, char* name, void* value, char* type, Tcl_ObjCmdProc* proc, Tcl_CmdDeleteProc* deleteProc, reg_error* errPtr)
    • Sets the object whose proc is named by the given name
  • int set_entry(Tcl_Interp* interp, char* name, reg_entry* entry, reg_error* errPtr)
    • Sets a given name to be an entry object
  • void set_sqlite_result(Tcl_Interp* interp, sqlite3* db, const char* query)
    • Reports a sqlite3 error to Tcl
  • int all_objects(Tcl_Interp* interp, sqlite3* db, char* query, char* prefix, set_object_function* setter)
    • Sets the result of the Tcl interpreter to all objects returned by a query
  • const char* string_or_null(Tcl_Obj* obj)
    • Return the char * for a Tcl object, or if it is a string with only NULL, return NULL
  • int recast(void* userdata, cast_function* fn, free_function* del, void* outv, void inv, int inc, reg_error* errPtr)
  • int entry_to_obj(Tcl_Interp* interp, Tcl_Obj obj, reg_entry* entry, reg_error* errPtr)
    • Return Tcl string for a given entry object
  • int list_entry_to_obj(Tcl_Interp* interp, Tcl_Obj* objs, reg_entry entries, int entry_count, reg_error* errPtr)
    • Call entry_to_obj() for an array of entries
  • void free_strings(void* userdata UNUSED, char strings, int count)
    • Defined in util.h but doesn't actually exist
  • int list_obj_to_string(char* strings, Tcl_Obj objv, int objc, reg_error* errPtr)
    • Convert an array of Tcl objects to char * array
  • int list_string_to_obj(Tcl_Obj* objv, char strings, int objc, reg_error* errPtr)
    • Convert an array of char * to Tcl object array

cregistry code

Code: trunk/base/src/cregistry

Tcl commands created

C code files

entry.[ch]

  • reg_entry* reg_entry_create(reg_registry* reg, char* name, char* version, char* revision, char* variants, char* epoch, reg_error* errPtr)
    • Creates a new entry in the ports registry
  • reg_entry* reg_entry_open(reg_registry* reg, char* name, char* version, char* revision, char* variants, char* epoch, reg_error* errPtr)
    • Opens an existing entry in the registry
  • int reg_entry_delete(reg_entry* entry, reg_error* errPtr)
    • Deletes an entry. After calling this, reg_entry_free needs to be called manually on the entry. Care should be taken to not free the entry if this deletion is rolled back
  • void reg_entry_free(reg_entry* entry)
    • Frees an entry
  • int reg_entry_search(reg_registry* reg, char keys, char vals, int key_count, int strategy, reg_entry* entries, reg_error* errPtr)
    • Searches the registry for ports for which each key's value is equal to the given value. To find all ports, pass a key_count of 0
  • int reg_entry_imaged(reg_registry* reg, const char* name, const char* version, const char* revision, const char* variants, reg_entry* entries, reg_error* errPtr)
    • Finds ports which are installed as an image, and/or those which are active in the filesystem. When the install mode is 'direct', this will be equivalent to reg_entry_installed
  • int reg_entry_installed(reg_registry* reg, char* name, reg_entry* entries, reg_error* errPtr)
    • Finds ports which are active in the filesystem. These ports are able to meet dependencies, and properly own the files they map.
  • int reg_entry_owner(reg_registry* reg, char* path, reg_entry entry, reg_error* errPtr)
    • Finds the owner of a given file. Only ports active in the filesystem will be returned
  • int reg_entry_propget(reg_entry* entry, char* key, char value, reg_error* errPtr)
    • Gets a named property of an entry
  • int reg_entry_propset(reg_entry* entry, char* key, char* value, reg_error* errPtr)
    • Sets a named property of an entry
  • int reg_entry_map(reg_entry* entry, char files, int file_count, reg_error* errPtr)
    • Maps files to the given port in the filemap. The list of files must not contain files that are already mapped to the given port
  • int reg_entry_unmap(reg_entry* entry, char files, int file_count, reg_error* errPtr)
    • Unaps files from the given port in the filemap. The files must be owned by the given entry
  • int reg_entry_files(reg_entry* entry, char* files, reg_error* errPtr)
    • Gets a list of files owned by the given port. These files are active in the filesystem and could be different from the port's imagefiles
  • int reg_entry_imagefiles(reg_entry* entry, char* files, reg_error* errPtr)
    • Gets a list of files provided by the given port. These files are in the port image and do not necessarily correspond to active files on the filesystem
  • int reg_entry_activate(reg_entry* entry, char files, char as_files, int file_count, reg_error* errPtr)
    • Sets an entry's files as being active in the filesystem
  • int reg_entry_deactivate(reg_entry* entry, char files, int file_count, reg_error* errPtr)
    • Deactivates files owned by a given entry
  • int reg_entry_dependents(reg_entry* entry, reg_entry* dependents, reg_error* errPtr)
    • Gets a list of ports that depend on this one
  • int reg_entry_dependencies(reg_entry* entry, reg_entry* dependencies, reg_error* errPtr)
    • Gets a list of ports that this one depends on
  • int reg_entry_depends(reg_entry* entry, char* name, reg_error* errPtr)
    • Sets the given port to depend on the named port
  • int reg_all_open_entries(reg_registry* reg, reg_entry* entries)
    • Fetches a list of all open entries

registry.[ch]

sql.[ch]