|
|
@@ -190,6 +190,29 @@ int set_entry(Tcl_Interp* interp, char* name, reg_entry* entry, |
|
|
return 0; |
|
|
} |
|
|
|
|
|
/** |
|
|
* Sets a given name to be an snapshot object. |
|
|
* |
|
|
* @param [in] interp Tcl interpreter to create the snapshot within |
|
|
* @param [in] name name to associate the given snapshot with |
|
|
* @param [in] snapshot snapshot to associate with the given name |
|
|
* @param [out] errPtr description of error if it couldn't be set |
|
|
* @return true if success; false if failure |
|
|
* @see set_object |
|
|
*/ |
|
|
int set_snapshot(Tcl_Interp* interp, char* name, reg_snapshot* snapshot, |
|
|
reg_error* errPtr) { |
|
|
if (set_object(interp, name, snapshot, "snapshot", snapshot_obj_cmd, NULL, |
|
|
errPtr)) { |
|
|
snapshot->proc = strdup(name); |
|
|
if (!snapshot->proc) { |
|
|
return 0; |
|
|
} |
|
|
return 1; |
|
|
} |
|
|
return 0; |
|
|
} |
|
|
|
|
|
/** |
|
|
* Sets a given name to be a file object. |
|
|
* |
|
|
@@ -303,6 +326,23 @@ int entry_to_obj(Tcl_Interp* interp, Tcl_Obj** obj, reg_entry* entry, |
|
|
return 1; |
|
|
} |
|
|
|
|
|
int snapshot_to_obj(Tcl_Interp* interp, Tcl_Obj** obj, reg_snapshot* snapshot, |
|
|
int* lower_bound, reg_error* errPtr) { |
|
|
if (snapshot->proc == NULL) { |
|
|
char* name = unique_name(interp, "::registry::snapshot", lower_bound); |
|
|
if (!name) { |
|
|
return 0; |
|
|
} |
|
|
if (!set_snapshot(interp, name, entry, errPtr)) { |
|
|
free(name); |
|
|
return 0; |
|
|
} |
|
|
free(name); |
|
|
} |
|
|
*obj = Tcl_NewStringObj(snapshot->proc, -1); |
|
|
return 1; |
|
|
} |
|
|
|
|
|
int file_to_obj(Tcl_Interp* interp, Tcl_Obj** obj, reg_file* file, |
|
|
int* lower_bound, reg_error* errPtr) { |
|
|
if (file->proc == NULL) { |
|
|
@@ -344,6 +384,13 @@ int list_entry_to_obj(Tcl_Interp* interp, Tcl_Obj*** objs, |
|
|
(void***)objs, (void**)entries, entry_count, errPtr); |
|
|
} |
|
|
|
|
|
int list_snapshot_to_obj(Tcl_Interp* interp, Tcl_Obj*** objs, |
|
|
reg_snapshot** snapshots, int snapshot_count, reg_error* errPtr) { |
|
|
int lower_bound = 0; |
|
|
return recast(interp, (cast_function*)snapshot_to_obj, &lower_bound, NULL, |
|
|
(void***)objs, (void**)snapshots, snapshot_count, errPtr); |
|
|
} |
|
|
|
|
|
int list_file_to_obj(Tcl_Interp* interp, Tcl_Obj*** objs, |
|
|
reg_file** files, int file_count, reg_error* errPtr) { |
|
|
int lower_bound = 0; |
|
|
|