Here are the functions to customize browser and access browser database. The examples can be placed in a SmacLib file.
Cpp functions:
void browser_set_pp(char * mode, char * exec)
To indicate where the C and C++ pre-processor are
(default pre-processor is /lib/cpp for each mode).
mode must be "C-mode
or "C++mode"
,
and exec must be an absolute filename.
void browser_set_pp_options(char * mode, char *options)
mode must be "C-mode
or "C++mode"
.
If options is 0, removes pre-processing before
parsing, else indicates the pre-processor options and
asks for a pre-processing before parsing.
File management:
void browser_add(char * path [, int rec])
parses the given file or directory, momentary forces the browser toggle button to Rec if the second argument is given not equal to 0.
void browser_del([char * name])
deletes the file name (or all files if the function is called without argument) from the browser database.
int browser_dump(char * filename)
Saves the current browser database in the specified file, Returns 1 if the dump can be made, else 0 (file is write protected or other error).
int browser_restore(char * filename)
Restores (quickly) the browser database information dumped in the specified file. Returns 1 on success, else 0 (file doesn't not exist or other error).
An implicit Del is made before updating the browser database, for all the files referenced in the dump.
Access functions:
char * browser_class_file(char * type\_name [, int * pline])
Returns the file pathname where type_name is defined, if pline is given, it is modified to the line number. Returns 0 if type_name is not in the browser database or if cannot allocate memory to memorize the result.
Be careful, the string is allocated each time the function is called, use free() to release it.
char ** browser_class_parents(char * class_name)
Returns a vector containing the class_name parents names and the inheritance specifier, or 0 if class_name is not in the browser database or if cannot allocate memory to memorize the result.
Be careful, the result is allocated each time the function is called, use free() to release it. The vector and its included strings are placed in a unique allocated block.
char ** browser_class_children(char * class_name)
Returns a vector containing the class_name children names, or 0 if class_name is not in the browser database or if cannot allocate memory to memorize the result.
Be careful, the result is allocated each time the function is called, use free() to release it. The vector and its included strings are placed in a unique allocated block.
char ** browser_class_methods(char * class_name)
Returns a vector containing the class_name methods declaration with its flags, their declaration and definition files, their lines, and information bits. Returns 0 if class_name is not in the browser database or if cannot allocate memory to memorize the result.
Be careful, the result is allocated each time the function is called, use free() to release it. The vector and its included strings are placed in a unique allocated block.
char ** browser_class_attributes(char * class_name)
Returns a vector containing the class_name attributes declaration with its flags, their declaration file, their line, and information bits. Returns 0 if class_name is not in the browser database or if cannot allocate memory to memorize the result.
Be careful, the result is allocated each time the function is called, use free() to release it. The vector and its included strings are placed in a unique allocated block.
char * browser_class_flags(char * class_name)
Returns the class flags and name, or 0 if class_name is not in the browser database or if cannot allocate memory to memorize the result.
Be careful, the string is allocated each time the function is called, use free() to release it.
char ** browser_functions(char * prefix)
Returns a vector containing the list of functions (with their flags, definition file and line) which name and eventually parameter type list begins with the given prefix.
Returns 0 if cannot allocate memory to memorize the result.
Be careful, the result is allocated each time the function is called, use free() to release it. The vector and its included strings are placed in a unique allocated block.
char ** browser_globals(char * prefix)
Returns a vector containing the list of globals (with their flags and definition file and line) which name begins with the given prefix. Returns 0 if cannot allocate memory to memorize the result.
Be careful, the result is allocated each time the function is called, use free() to release it. The vector and its included strings are placed in a unique allocated block.
int browser_select_class(char * prefix)
Selects the first type in the browser subwindow Types which name matches prefix as you can do it with the mouse. Returns 1 if a type name is found, else 0 (an hidden class cannot be selected).
int browser_select_method(char * prefix)
Selects the first method in the browser subwindow Methods which name (and optionally parameter type list) matches prefix as you can do it with the mouse. Returns 1 if a method is found, else 0 (an hidden method cannot be selected).
int browser_select_attribute(char * prefix)
Selects the first attribute in the browser subwindow Attribute which name matches prefix as you can do it with the mouse. Returns 1 if an attribute is found, else 0 (an hidden attribute cannot be selected).
int browser_select_function(char * prefix)
Selects the first function in the browser subwindow Functions which name (and optionally parameter type list) matches prefix as you can do it with the mouse. Returns 1 if a function is found, else 0 (an hidden function cannot be selected).
int browser_select_global(char * prefix)
Selects the first global in the browser subwindow Globals which name matches prefix as you can do it with the mouse. Returns 1 if a global is found, else 0 (an hidden global cannot be selected).
Edits the last selected item, as a double click on the browser window.
int browser_class_entry(char * prefix)
Returns the rank of the first visible or hidden type in the browser Types list (alphabetically sorted) which name matches prefix, or -1 if a type cannot be found. See browser_class() described below.
int browser_function_entry(char * prefix)
Returns the rank of the first visible or hidden function in the browser Functions list (alphabetically sorted) which name (and optionally parameter type list) matches prefix, or -1 if a function cannot be found. See browser_function() described below.
int browser_global_entry(char * prefix)
Returns the rank of the first visible or hidden global in the browser Globals list (alphabetically sorted) which name matches prefix, or -1 if a global cannot be found. See browser_global() described below.
int browser_file_entry(char * prefix)
Returns the rank of the first file in the browser Files list (alphabetically sorted) with complete pathname matching prefix, or -1. See browser_global() described below.
Returns the name (without flags) of the nth type from the browser Types list (alphabetically sorted), or 0 for invalid index.
char * browser_function(int n)
Returns the name (without flags) and parameter type list of the nth function from the browser Function list (alphabetically sorted), or 0 for invalid index.
Returns the name (without flags) of the nth global from the browser Global list (alphabetically sorted), or 0 for invalid index.
Returns the pathname of the nth file from the browser File list (alphabetically sorted), or 0 for invalid index.
Visibility:
By default, all browser information are displayed on its
window, but you can hide some of them with the following
functions (or browser window Hide buttons
§3.2 page ).
All browser information become visible.
void browser_hide_private_members()
Hides all private class members (methods and attributes).
void browser_hide_protected_and_private_members()
Hides all protected and private class members (methods and attributes). Only public members still visible.
void browser_show_protected_and_private_members()
All class members (methods and attributes) become visible.
void browser_hide_inherited_members()
Hides all inherited class members.
void browser_show_inherited_members()
All class inherited members become visible
void browser_hide_internal_types()
Hides types defined inside another type. For instance if the browser knows the following definitions:
the types displayed on the browser window are S and
S::SS
, this last will be hidden after calling
browser_hide_internal_types.
void browser_show_internal_types()
Types defined inside one type become visible.
void browser_hide_static_functions()
Hides functions declared static.
void browser_show_static_functions()
Shows all functions
void browser_hide_static_globals()
Hides globals declared static.
void browser_show_static_globals()
Shows all globals.
void browser_hide_children_of(char * parent)
Hides sub classes of the specified class. Re-browsing the specified class definition cancels this hidding.
void browser_show_children_of(char * parent)
Show sub classes of the specified class (except if another hidding cause exists).
void browser_hide_class(char * name)
Hides the specified class, but the visibility of its sub classes is not affected. Re-browsing the specified class definition cancels this hidding.
void browser_show_class(char * name)
The specified class becomes visible (except if another hidding cause exists).
void browser_hide_global(char * name)
Hides the specified global. Re-browsing the specified global definition cancels this hidding.
void browser_show_global(char * name)
The specified global becomes visible (except if another hidding cause exists).
void browser_hide_function(char * name)
Hides the specified function (name may contain parameters type list). Re-browsing the specified function definition cancels this hidding.
void browser_show_function(char * name)
The specified function becomes visible (except if another hidding cause exists).