GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-77aab223bc
defs/manage.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void M__add_element (const char *, const char *)
 Add element to the list. More...
 
int M_do_copy (int, const char *, const char *, const char *)
 Copy element. More...
 
void M_do_list (int, const char *)
 List elements. More...
 
int M_do_remove (int, const char *)
 Remove elements from data base. More...
 
int M_do_rename (int, const char *, const char *)
 Rename element. More...
 
int M__empty (char *)
 Check if element is empty. More...
 
const char * M_find (int, char *, const char *)
 Find element in data base. More...
 
int M__get_description_len (int)
 Get max length of element's description. More...
 
int M_get_element (const char *)
 Find element type by name. More...
 
const struct listM_get_list (int)
 Get list structure. More...
 
int M_read_list (int, int *)
 Read list of elements. More...
 
struct OptionM_define_option (int, const char *, int)
 Define option for parser. More...
 
const char * M_get_options (int)
 Get list of element types separated by comma. More...
 
const char * M_get_option_desc (int)
 Get list of element desc separated by comma. More...
 
void M_show_elements (void)
 Print element name/desc to stdout. More...
 
int M__hold_signals (int)
 Hold signals. More...
 

Function Documentation

◆ M__add_element()

void M__add_element ( const char *  elem,
const char *  desc 
)

Add element to the list.

Parameters
elemelement name
descdescription of the element

Definition at line 24 of file add_elem.c.

References list::desc, list::element, G_realloc, G_store(), list::nelem, and nlist.

◆ M__empty()

int M__empty ( char *  elem)

Check if element is empty.

Parameters
elemelement name
Returns
1 empty
0 not empty

Definition at line 28 of file empty.c.

References G_file_name(), G_mapset(), GPATH_MAX, and NULL.

◆ M__get_description_len()

int M__get_description_len ( int  n)

Get max length of element's description.

Parameters
nelement id
Returns
buffer length

Definition at line 25 of file get_len.c.

References l, and list::nelem.

◆ M__hold_signals()

int M__hold_signals ( int  hold)

Hold signals.

Parameters
hold
Returns
0

Definition at line 24 of file sighold.c.

Referenced by M_do_copy(), M_do_remove(), and M_do_rename().

◆ M_define_option()

struct Option* M_define_option ( int  n,
const char *  desc,
int  multiple 
)

Define option for parser.

Parameters
nelement id
Returns
pointer to Option structure
NULL on error

Definition at line 28 of file option.c.

References _, list::alias, Option::description, G_asprintf(), G_define_option(), Option::gisprompt, Option::guisection, Option::key, Option::key_desc, Option::multiple, nlist, NO, NULL, Option::required, Option::type, and TYPE_STRING.

◆ M_do_copy()

int M_do_copy ( int  n,
const char *  old,
const char *  mapset,
const char *  new 
)

Copy element.

Parameters
nelement id
oldsource name
mapsetname of source mapset
newdestination name
Returns
0 on success
1 on error

Definition at line 35 of file do_copy.c.

References _, G_debug(), G_file_name(), G_fully_qualified_name(), G_make_mapset_object_group(), G_mapset(), G_message(), G_recursive_copy(), G_remove(), G_strcasecmp(), G_verbose_message(), G_warning(), GMAPSET_MAX, GPATH_MAX, M__hold_signals(), list::nelem, and Vect_copy().

◆ M_do_list()

void M_do_list ( int  n,
const char *  mapset 
)

List elements.

Parameters
nelement index in the array (negative value for all elements)
mapsetname of mapset ("" for search path)

Definition at line 25 of file do_list.c.

References _, G_fatal_error(), G_list_element(), nlist, and NULL.

◆ M_do_remove()

int M_do_remove ( int  n,
const char *  old 
)

Remove elements from data base.

Parameters
nelement id
oldname of element to be removed
Returns
0 on success
1 on error

Definition at line 33 of file do_remove.c.

References _, G_fatal_error(), G_find_raster2(), G_find_raster3d(), G_find_vector2(), G_mapset(), G_message(), G_name_is_fully_qualified(), G_remove(), G_strcasecmp(), G_verbose_message(), G_warning(), GMAPSET_MAX, GNAME_MAX, M__hold_signals(), list::nelem, NULL, and Vect_delete().

◆ M_do_rename()

int M_do_rename ( int  n,
const char *  old,
const char *  new 
)

Rename element.

Parameters
nelement id
oldsource name
newdestination name
Returns
0 on success
1 on error

Definition at line 35 of file do_rename.c.

References _, G_find_raster2(), G_find_raster3d(), G_find_vector2(), G_mapset(), G_message(), G_remove(), G_rename(), G_strcasecmp(), G_verbose_message(), G_warning(), GMAPSET_MAX, M__hold_signals(), list::nelem, NULL, and Vect_rename().

◆ M_find()

const char* M_find ( int  n,
char *  name,
const char *  mapsets 
)

Find element in data base.

Parameters
nelement id
nameelement name
mapsetsname of mapsets
Returns
mapset if found
if not found

Definition at line 29 of file manage/find.c.

References G_find_file2(), GNAME_MAX, name, and strcpy.

◆ M_get_element()

int M_get_element ( const char *  data_type)

Find element type by name.

Parameters
data_typeelement type
Returns
element id
-1 not found

Definition at line 42 of file manage/list.c.

References list::alias, G_strcasecmp(), and nlist.

◆ M_get_list()

const struct list* M_get_list ( int  n)

Get list structure.

Parameters
nelement id
Returns
pointer to list structure
NULL on error

Definition at line 26 of file manage/list.c.

References nlist, and NULL.

◆ M_get_option_desc()

const char* M_get_option_desc ( int  do_all)

Get list of element desc separated by comma.

String buffer is allocated by G_malloc().

Parameters
do_allTRUE to add "all" to the buffer
Returns
pointer to allocated buffer with desc

Definition at line 105 of file option.c.

References G_malloc, nlist, and strcpy.

◆ M_get_options()

const char* M_get_options ( int  do_all)

Get list of element types separated by comma.

String buffer is allocated by G_malloc().

Parameters
do_allTRUE to add "all" to the buffer
Returns
pointer to allocated buffer with types

Definition at line 70 of file option.c.

References G_malloc, nlist, and strcpy.

◆ M_read_list()

int M_read_list ( int  check_if_empty,
int *  num 
)

Read list of elements.

Format:

# ... comments
main element:alias:description:menu text
sub element:description
sub element:description
.
.
.
int main(int argc, char *argv[])
Definition: main.c:25
Definition: lidar.h:85
Parameters
check_if_emptyTRUE for check if element is empty
Returns
0
1

Definition at line 48 of file read_list.c.

References list::alias, list::desc, GPATH_MAX, and list::text.

◆ M_show_elements()

void M_show_elements ( void  )

Print element name/desc to stdout.

Definition at line 22 of file show_elem.c.

References nlist.