scol_gbase.c File Reference

all functions of this API More...

#include "../include/scol_gbase.h"
#include "main.h"
#include <glib/gstdio.h>

Defines

#define SCSP_MAX_SIZE   1024*32

Functions

int SCOL_gbaseUserName (mmachine m)
 _gbaseUserName : Returns the user (or real) name
int SCOL_gBaseHostName (mmachine m)
 _gBaseHostName : Returns the host name
int SCOL_gBaseDirCur (mmachine m)
 _gBaseDirCur : Returns the current directory (by default on MS Windows "C:\Program Files\Scol Voyager")
int SCOL_gBasePathAbsolute (mmachine m)
 _gBasePathAbsolute : Returns 1 if the given file_name is an absolute file name.
int SCOL_gBasePathBase (mmachine m)
 _gBasePathBase : Returns the last component of the filename
int SCOL_gBasePathDir (mmachine m)
 _gBasePathDir : Returns the directory components of a file name.
int SCOL_gBasePathBuild (mmachine m)
 _gBasePathBuild : Creates a filename from a list of elements using the correct separator for filenames.
int SCOL_gBaseStringUTF8 (mmachine m)
 _gBaseStringUTF8 : Converts a string in the current locale into a UTF-8 string or reverse.
int SCOL_gbaseChecksumS (mmachine m)
 _gbaseChecksumS : Computes the checksum of a string.
int SCOL_gbaseChecksumP (mmachine m)
 _gbaseChecksumP : Computes the checksum of a file.
int SCOL_gbaseSleep (mmachine m)
 _gbaseSleep : Pauses the current thread for the given number of milliseconds.
int SCOL_gbaseFileStat (mmachine m)
 _gbaseFileStat : it should not be used, at this time
int SCOL_gbaseIsIp (mmachine m)
 _gbaseIsIp : Tests if a string is a form of an IPv4 or IPv6 address (like "123.210.012.231"). fun [S] I
int SCOLinitGbaseClass (mmachine m)
int GBaseRelease ()

Variables

mmachine mm
char * gbase_name [GBASE_PKG_NB]
int(* gbase_fun [GBASE_PKG_NB])(mmachine m)
int gbase_narg [GBASE_PKG_NB]
char * gbase_type [GBASE_PKG_NB]

Detailed Description

all functions of this API

Author:
Stephane Bisaro

Function Documentation

int SCOL_gbaseUserName ( mmachine  m  ) 

_gbaseUserName : Returns the user (or real) name

fun [] S

Parameters:
: nothing
Returns:
S : this name
int SCOL_gBaseHostName ( mmachine  m  ) 

_gBaseHostName : Returns the host name

fun [] S

Parameters:
: nothing
Returns:
S : this name
int SCOL_gBaseDirCur ( mmachine  m  ) 

_gBaseDirCur : Returns the current directory (by default on MS Windows "C:\Program Files\Scol Voyager")

fun [] S

Parameters:
: nothing
Returns:
S : this directory or "unknown" if undefined
int SCOL_gBasePathAbsolute ( mmachine  m  ) 

_gBasePathAbsolute : Returns 1 if the given file_name is an absolute file name.

fun [S] I

Parameters:
S : any path
Returns:
I : 1 if TRUE,otherwise 0
int SCOL_gBasePathBase ( mmachine  m  ) 

_gBasePathBase : Returns the last component of the filename

fun [S] S

Parameters:
S : any path
Returns:
S : this last component
int SCOL_gBasePathDir ( mmachine  m  ) 

_gBasePathDir : Returns the directory components of a file name.

fun [S] S

Parameters:
S : any path
Returns:
S : this directory
int SCOL_gBasePathBuild ( mmachine  m  ) 

_gBasePathBuild : Creates a filename from a list of elements using the correct separator for filenames.

fun [[S r1] I] S

Parameters:
[S r1] : a list of elements (typically, a list of directory : a :: b :: c :: file.ext)
I : 1 : OS separator (e.g. "\" on MS Windows, "/" on Linux), otherwise Scol separator ("/")
Returns:
S : the filename
int SCOL_gBaseStringUTF8 ( mmachine  m  ) 

_gBaseStringUTF8 : Converts a string in the current locale into a UTF-8 string or reverse.

fun [S I] S

Parameters:
S : any string
I : 1 from locale to UTF8, 0 from UTF-8 to current locale
Returns:
: the new string
int SCOL_gbaseChecksumS ( mmachine  m  ) 

_gbaseChecksumS : Computes the checksum of a string.

fun [S I] S

Parameters:
S : any string
I : the hashing algorithm to use : 0 -> MD5 (default), 1 -> SHA-1, 2 -> SHA-256
Returns:
S : the checksum as an hexadecimal string.
int SCOL_gbaseChecksumP ( mmachine  m  ) 

_gbaseChecksumP : Computes the checksum of a file.

fun [P I] S

Parameters:
S : any file (read referenced only)
I : the hashing algorithm to use : 0 -> MD5 (default), 1 -> SHA-1, 2 -> SHA-256
Returns:
S : the checksum as an hexadecimal string.
int SCOL_gbaseSleep ( mmachine  m  ) 

_gbaseSleep : Pauses the current thread for the given number of milliseconds.

fun [I] I

Parameters:
I : the number of milliseconds
Returns:
I : 0 if success, nil if error
int SCOL_gbaseFileStat ( mmachine  m  ) 

_gbaseFileStat : it should not be used, at this time

fun [P] [I I I I]

Parameters:
P : a filename (read reference only)
Returns:
[I I I I] : size, last access, last modification, last state changed
int SCOL_gbaseIsIp ( mmachine  m  ) 

_gbaseIsIp : Tests if a string is a form of an IPv4 or IPv6 address (like "123.210.012.231"). fun [S] I

Parameters:
S : any string
Returns:
I : 1 if TRUE (the string is an IP address), 0 if FALSE

Variable Documentation

char* gbase_name[GBASE_PKG_NB]
Initial value:
{
    "_gbaseUserName",
    "_gBaseHostName",
    "_gBaseDirCur",
    "_gBasePathAbsolute",
    "_gBasePathBase",
    "_gBasePathDir",
    "_gBasePathBuild",
    "_gBaseStringUTF8",
    "_gbaseChecksumS",
    "_gbaseChecksumP",
    "_gbaseSleep",
    "_gbaseFileStat",
    "_gbaseIsIp"
}
int(* gbase_fun[GBASE_PKG_NB])(mmachine m)
int gbase_narg[GBASE_PKG_NB]
Initial value:
{
    0,      
    0,      
    0,      
    1,      
    1,      
    1,      
    2,      
    2,       
    2,       
    2,       
    1,       
    1,       
    1       
}
char* gbase_type[GBASE_PKG_NB]
Initial value:
{
    "fun [] S",                     
    "fun [] S",                     
    "fun [] S",                     
    "fun [S] I",                    
    "fun [S] S",                    
    "fun [S] S",                    
    "fun [[S r1] I] S",             
    "fun [S I] S",                  
    "fun [S I] S",                  
    "fun [P I] S",                  
    "fun [I] I",                    
    "fun [P] [I I I I]",            
    "fun [S] I"                    
}
Generated on Fri Mar 11 15:06:43 2011 for gBase by  doxygen 1.6.3