NuSMV/code/nusmv/core/utils/utils.h File Reference

#include "nusmv/core/utils/defs.h"
#include "nusmv/core/cinit/NuSMVEnv.h"
#include "nusmv/core/utils/list.h"

Go to the source code of this file.

Defines

#define NUSMV_FUNCATTR_NORETURN
 External header of the utils package.

Functions

boolean Utils_exe_file_exists (const char *filename)
 Checks if a file exists in file system and it has executable permission granted.
boolean Utils_file_can_be_written (const char *filename)
 Checks if a file can be written in file system.
boolean Utils_file_exists (const char *filename)
 Checks if a file exists in file system.
int Utils_file_exists_in_directory (const char *filename, char *directory)
 Checks for the existence of a file within a directory.
int Utils_file_exists_in_paths (const char *filename, const char *paths, const char *delimiters)
 Checks a list of directories for a given file.
boolean Utils_files_are_the_same (const char *fname1, const char *fname3)
 check if given file names are referring the same file node
void Utils_FreeListOfLists (lsList list_of_lists)
 Destroys a list of list.
char * Utils_get_temp_filename_in_dir (const char *dir, const char *templ)
size_t Utils_int_size_as_string (const int an_int)
 Returns the size than an ant would need if represented as a string.
char * Utils_int_to_str (const int an_int)
 Convert an int to a string.
int Utils_log2_round (unsigned long long int a)
 Computes the log2 of the given unsigned argument rounding the result to the closest upper integer. 0 gives 1 as result.
void Utils_pkg_init (const NuSMVEnv_ptr env)
 Initializes the utils package.
void Utils_pkg_quit (const NuSMVEnv_ptr env)
 De-initializes the utils package.
void Utils_print_timer (const NuSMVEnv_ptr env, const char *name, const char *msg)
 prints info about a timer whose name is given
int Utils_ptr_compar (const void *a, const void *b)
 Compare function for c library qsort.
void Utils_reset_timer (const NuSMVEnv_ptr env, const char *name)
 Resets a timer whose name is given.
void Utils_start_timer (const NuSMVEnv_ptr env, const char *name)
 Starts a timer whose name is given.
void Utils_stop_timer (const NuSMVEnv_ptr env, const char *name)
 Stops a timer whose name is given.
void Utils_str_escape_xml_file (const char *str, FILE *file)
 Escapes all characters in given string, and dumps them into the xml file.
int Utils_strcasecmp (const char *s1, const char *s2)
 An abstraction over BSD strcasecmp.
const char * Utils_StripPath (const char *pathfname)
 Returns pathname without path prefix.
void Utils_StripPathNoExtension (const char *fpathname, char *filename)
 Returns filename without path and extension.
void Utils_StripPathNoFilenameNoExtension (const char *fpathname, char *dirname)
 Returns directory part of fpathname without filename and extension.
char * Utils_util_tilde_expand (char *fname)
 Substitutes tilde, and '/' with '\' under windows.

Define Documentation

#define NUSMV_FUNCATTR_NORETURN

External header of the utils package.

Author:
Marco Roveri External header of the utils package.
Todo:
Missing synopsis
Todo:
Missing description

Function Documentation

boolean Utils_exe_file_exists ( const char *  filename  ) 

Checks if a file exists in file system and it has executable permission granted.

filename is absolute or relative to the current working dir

boolean Utils_file_can_be_written ( const char *  filename  ) 

Checks if a file can be written in file system.

filename is absolute or relative to the current working dir

boolean Utils_file_exists ( const char *  filename  ) 

Checks if a file exists in file system.

filename is absolute or relative to the current working dir

int Utils_file_exists_in_directory ( const char *  filename,
char *  directory 
)

Checks for the existence of a file within a directory.

Returns:
: 0 if not existing 1 if exists 2 if unknown
See also:
Utils_file_exists_in_paths
int Utils_file_exists_in_paths ( const char *  filename,
const char *  paths,
const char *  delimiters 
)

Checks a list of directories for a given file.

The list of directories (delimited by the charaters given) are checked for the existence of the file.

Returns:
: 0 if not existing 1 if exists 2 if unknown
See also:
Utils_file_exists_in_directory
boolean Utils_files_are_the_same ( const char *  fname1,
const char *  fname3 
)

check if given file names are referring the same file node

void Utils_FreeListOfLists ( lsList  list_of_lists  ) 

Destroys a list of list.

This function can be used to destroy lists of list. The contained set of lists is removed from memory as the top level list. More than two levels are not handled at the moment.

Lists are deallocated

See also:
lsDestroy
char* Utils_get_temp_filename_in_dir ( const char *  dir,
const char *  templ 
)
Todo:
Missing synopsis
Todo:
Missing description
size_t Utils_int_size_as_string ( const int  an_int  ) 

Returns the size than an ant would need if represented as a string.

char* Utils_int_to_str ( const int  an_int  ) 

Convert an int to a string.

The string must be freed after use

int Utils_log2_round ( unsigned long long int  a  ) 

Computes the log2 of the given unsigned argument rounding the result to the closest upper integer. 0 gives 1 as result.

This function can be used to calculate the number of bits needed to represent a value.

void Utils_pkg_init ( const NuSMVEnv_ptr  env  ) 

Initializes the utils package.

None

void Utils_pkg_quit ( const NuSMVEnv_ptr  env  ) 

De-initializes the utils package.

None

void Utils_print_timer ( const NuSMVEnv_ptr  env,
const char *  name,
const char *  msg 
)

prints info about a timer whose name is given

The timer must be already existing. msg can be NULL

int Utils_ptr_compar ( const void *  a,
const void *  b 
)

Compare function for c library qsort.

Compares pointers

required

See also:
optional
void Utils_reset_timer ( const NuSMVEnv_ptr  env,
const char *  name 
)

Resets a timer whose name is given.

The timer must be already existing.

void Utils_start_timer ( const NuSMVEnv_ptr  env,
const char *  name 
)

Starts a timer whose name is given.

If the timer does not exist, it will be created and started. If already started an error occurs.

void Utils_stop_timer ( const NuSMVEnv_ptr  env,
const char *  name 
)

Stops a timer whose name is given.

The timer must be already existing and running.

void Utils_str_escape_xml_file ( const char *  str,
FILE *  file 
)

Escapes all characters in given string, and dumps them into the xml file.

int Utils_strcasecmp ( const char *  s1,
const char *  s2 
)

An abstraction over BSD strcasecmp.

Compares the two strings s1 and s2, ignoring the case of the characters.

const char* Utils_StripPath ( const char *  pathfname  ) 

Returns pathname without path prefix.

None

void Utils_StripPathNoExtension ( const char *  fpathname,
char *  filename 
)

Returns filename without path and extension.

Example: given "~/.../test.smv", "test" will be returned. filename must be a string whose length is large enought to contain the "pure" filename

the string pointed by 'filename' changes

void Utils_StripPathNoFilenameNoExtension ( const char *  fpathname,
char *  dirname 
)

Returns directory part of fpathname without filename and extension.

dirname must be a string whose length is large enough to contain the directory part

The string pointed to by 'dirname' changes

See also:
Utils_StripPathNoExtension, Utils_StripPath
char* Utils_util_tilde_expand ( char *  fname  ) 

Substitutes tilde, and '/' with '\' under windows.

Returned string must be destroyed. Returned string is equal (but not it) to the input string if home could not be find

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on 14 Oct 2015 for NuSMV Developers Manual by  doxygen 1.6.1