#include <maloc/maloc_base.h>
Go to the source code of this file.
Defines | |
#define | VPOW_SAFE(x, y) (Vnm_powsafe(x,y)) |
A safe VPOW function (avoids division by zero). | |
#define | VTIMERS 100 |
the maiximal timer constant | |
Functions | |
int | Vnm_sigInt (void) |
Signal and setjmp handling routine. Return the signal interrupt flag. | |
void | Vnm_sigIntSet (void) |
Signal and setjmp handling routine. Set the signal interrupt flag. | |
void | Vnm_sigIntClear (void) |
Signal and setjmp handling routine. Clear the signal interrupt flag. | |
int | Vnm_jmpOk (void) |
Signal and setjmp handling routine. Return the "ok-to-jump" flag. | |
void | Vnm_jmpOkSet (void) |
Signal and setjmp handling routine. Set the "okay-to-jump" flag. | |
void | Vnm_jmpOkClear (void) |
Signal and setjmp handling routine. Clear the "okay-to-jump" flag. | |
jmp_buf * | Vnm_signalInit (void) |
Initialize the signal handling data structures. | |
void | Vnm_regHand (void) |
Register the signal handler with the operating system. | |
void | Vnm_sigHand (int num) |
Handle events such as SIGINT. We must have first been registered with "Vnm_signalInit". | |
double | Vnm_powsafe (double x, double y) |
A safe VPOW function (avoids division by zero). | |
void | Vnm_typeChk (void) |
Check out the sizes of various datatypes. | |
double | Vnm_epsmac (void) |
Computes the unit roundoff of the machine in single precision. This is defined as the smallest positive machine number u such that 1.0d0 + u .ne. 1.0d0 (in single precision). A safe hardcoded machine epsilon as alternative: double value; value = 1.0e-9; return value;. | |
int | Vnm_gentokens (char *buf, char **argv, const int argvmax, const char *white, const char *comment) |
Generate an [argv,argc] pair from a character string "buf" (assumed NULL-terminated) in which tokens are separated by whitespace "white" with possible comments "comment" occuring. THE INPUT STRING IS MODIFIED HERE! | |
void | Vnm_tstart (int timer, const char *name) |
Starts the timer on the particular machine. | |
void | Vnm_tstop (int timer, const char *name) |
Stops the timer on the particular machine. | |
char * | Vnm_getuser (char *user, int usermax) |
Ask the system for the username. | |
char * | Vnm_getos (char *os, int osmax) |
Ask the system for the operating system name. | |
char * | Vnm_gethost (char *host, int hostmax) |
Ask the system for the hostname. | |
char * | Vnm_gethome (char *path, int pathmax) |
Ask the system for the home directory. | |
char * | Vnm_getcwd (char *path, int pathmax) |
Ask the system for the current working directory. | |
int | Vnm_chdir (const char *path) |
Interact with the system to change the working directory. | |
int | Vnm_mkdir (const char *path) |
Interact with the system to make a new directory. | |
int | Vnm_system (const char *cmd) |
An improved ANSI-C "system" call. | |
int | Vnm_systemBack (const char *cmd) |
A background variant of the ANSI-C "system" call. | |
int | Vnm_systemKill (const char *cmd) |
Something like a UNIX "killall" call. | |
int | Vnm_exec (int argc, char **argv) |
An improved UNIX "exec" call. This routine does not return except on error. | |
void | Vnm_sleep (int nusecs) |
Implement a sleep function with microsecond resolution. | |
int | Vnm_ioTag (void) |
Return my I/O tag. | |
int | Vnm_nTags (void) |
Return the total number of tags. | |
void | Vnm_setIoTag (int myTag, int numTags) |
Set my id. | |
FILE * | Vnm_open (const int unit) |
Open an I/O console. | |
int | Vnm_close (const int unit) |
Close an I/O console. We MUST NOT use VASSERT (or Vnm_print!) in this routine. | |
void | Vnm_flush (const int unit) |
Attempt to flush the specified i/o stream. We MUST NOT use VASSERT (or Vnm_print!) in this routine. | |
void | Vnm_redirect (const int flag) |
Set/unset the redirect flag for UNIT zero. When redirected, I/O goes to the file: ${MCSH_HOME}/io.mc. We MUST NOT use VASSERT (or Vnm_print!) in this routine. | |
void | Vnm_print (const int unit, const char *format,...) |
External interface to the console i/o routine. We MUST NOT use VASSERT (or Vnm_print!) in this routine. | |
void | Vnm_tprint (const int unit, const char *format,...) |
Add our ioTag to Vnm_print output. We MUST NOT use VASSERT (or Vnm_print!) in this routine. | |
void | Vnm_qsort (int *u, int size) |
Front-end to quick sort integer array from [-large] to [+large]. | |
void | Vnm_qsortOrd (int *u, int *ord, int size) |
Front-end to quick sort integer array from [-large] to [+large]. | |
void | Vnm_dqsort (double *u, int size) |
Front-end to quick sort integer array from [-large] to [+large]. | |
void | Vnm_dqsortOrd (double *u, int *ord, int size) |
Front-end to quick sort integer array from [-large] to [+large]. |
* * MALOC = < Minimal Abstraction Layer for Object-oriented C > * Copyright (C) 1994--2008 Michael Holst * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *
#define VPOW_SAFE | ( | x, | |||
y | ) | (Vnm_powsafe(x,y)) |
A safe VPOW function (avoids division by zero).
#define VTIMERS 100 |
the maiximal timer constant
int Vnm_chdir | ( | const char * | path | ) |
Interact with the system to change the working directory.
path | Pointer to the path |
int Vnm_close | ( | const int | unit | ) |
Close an I/O console. We MUST NOT use VASSERT (or Vnm_print!) in this routine.
unit | index for the file unit |
void Vnm_dqsort | ( | double * | u, | |
int | size | |||
) |
Front-end to quick sort integer array from [-large] to [+large].
u | Pointer to quick sort integer array | |
size | size of the integer array |
void Vnm_dqsortOrd | ( | double * | u, | |
int * | ord, | |||
int | size | |||
) |
Front-end to quick sort integer array from [-large] to [+large].
u | Pointer to quick sort integer array | |
ord | Pointer to reordered array | |
size | size of the integer array |
double Vnm_epsmac | ( | void | ) |
Computes the unit roundoff of the machine in single precision. This is defined as the smallest positive machine number u such that 1.0d0 + u .ne. 1.0d0 (in single precision).
A safe hardcoded machine epsilon as alternative:
double value;
value = 1.0e-9;
return value;.
int Vnm_exec | ( | int | argc, | |
char ** | argv | |||
) |
An improved UNIX "exec" call. This routine does not return except on error.
argc | number of the command line arguments | |
argv | the command line arguments |
void Vnm_flush | ( | const int | unit | ) |
Attempt to flush the specified i/o stream. We MUST NOT use VASSERT (or Vnm_print!) in this routine.
unit | index for the file unit |
int Vnm_gentokens | ( | char * | buf, | |
char ** | argv, | |||
const int | argvmax, | |||
const char * | white, | |||
const char * | comment | |||
) |
Generate an [argv,argc] pair from a character string "buf" (assumed NULL-terminated) in which tokens are separated by whitespace "white" with possible comments "comment" occuring. THE INPUT STRING IS MODIFIED HERE!
buf | buffer containing message | |
argv | the command line arguments | |
argvmax | maximal number of the command line arguments | |
white | Pointer to the input string | |
comment | token which begins with a comment character |
char* Vnm_getcwd | ( | char * | path, | |
int | pathmax | |||
) |
Ask the system for the current working directory.
path | Pointer to the path | |
pathmax | index for the size of path |
char* Vnm_gethome | ( | char * | path, | |
int | pathmax | |||
) |
Ask the system for the home directory.
=
path | Pointer to the path | |
pathmax | index for the size of path |
char* Vnm_gethost | ( | char * | host, | |
int | hostmax | |||
) |
Ask the system for the hostname.
host | Pointer to the hostname. | |
hostmax | index for maximal size of host name |
char* Vnm_getos | ( | char * | os, | |
int | osmax | |||
) |
Ask the system for the operating system name.
os | Pointer to the OS type | |
osmax | index for maximal size of OS name |
char* Vnm_getuser | ( | char * | user, | |
int | usermax | |||
) |
Ask the system for the username.
user | Pointer to the username of the system | |
usermax | index for maximal size of user name |
int Vnm_ioTag | ( | void | ) |
Return my I/O tag.
int Vnm_jmpOk | ( | void | ) |
Signal and setjmp handling routine. Return the "ok-to-jump" flag.
void Vnm_jmpOkClear | ( | void | ) |
Signal and setjmp handling routine. Clear the "okay-to-jump" flag.
void Vnm_jmpOkSet | ( | void | ) |
Signal and setjmp handling routine. Set the "okay-to-jump" flag.
int Vnm_mkdir | ( | const char * | path | ) |
Interact with the system to make a new directory.
path | Pointer to the path |
int Vnm_nTags | ( | void | ) |
Return the total number of tags.
FILE* Vnm_open | ( | const int | unit | ) |
Open an I/O console.
We MUST NOT use VASSERT (or Vnm_print!) in this routine. The following codes are used: unit# C output unit ------- ------------- unit==0 garbage -- Non-interactive i/o; lots of stuff (can be redirected to ${MCSH_HOME/io.mc) unit==1 stdout -- standard output (Interactive I/O) unit==2 stderr -- standard error (IMPORTANT interactive I/O) unit==3 history -- History file ${MCSH_HOME}/hist.mcsh unit==else /dev/null -- Error...
unit | index for the file unit |
double Vnm_powsafe | ( | double | x, | |
double | y | |||
) |
A safe VPOW function (avoids division by zero).
x | input parameter | |
y | input parameter |
void Vnm_print | ( | const int | unit, | |
const char * | format, | |||
... | ||||
) |
External interface to the console i/o routine. We MUST NOT use VASSERT (or Vnm_print!) in this routine.
unit | index for the file unit | |
format | Pointer to the print format |
void Vnm_qsort | ( | int * | u, | |
int | size | |||
) |
Front-end to quick sort integer array from [-large] to [+large].
u | Pointer to quick sort integer array | |
size | size of the integer array |
void Vnm_qsortOrd | ( | int * | u, | |
int * | ord, | |||
int | size | |||
) |
Front-end to quick sort integer array from [-large] to [+large].
u | Pointer to quick sort integer array | |
ord | Pointer to reordered array | |
size | size of the integer array |
void Vnm_redirect | ( | const int | flag | ) |
Set/unset the redirect flag for UNIT zero. When redirected, I/O goes to the file: ${MCSH_HOME}/io.mc. We MUST NOT use VASSERT (or Vnm_print!) in this routine.
flag | index for the redirect flag |
void Vnm_regHand | ( | void | ) |
Register the signal handler with the operating system.
void Vnm_setIoTag | ( | int | myTag, | |
int | numTags | |||
) |
Set my id.
myTag | index for the tag | |
numTags | number of tags |
void Vnm_sigHand | ( | int | num | ) |
Handle events such as SIGINT. We must have first been registered with "Vnm_signalInit".
int Vnm_sigInt | ( | void | ) |
Signal and setjmp handling routine. Return the signal interrupt flag.
void Vnm_sigIntClear | ( | void | ) |
Signal and setjmp handling routine. Clear the signal interrupt flag.
void Vnm_sigIntSet | ( | void | ) |
Signal and setjmp handling routine. Set the signal interrupt flag.
jmp_buf* Vnm_signalInit | ( | void | ) |
Initialize the signal handling data structures.
void Vnm_sleep | ( | int | nusecs | ) |
Implement a sleep function with microsecond resolution.
nusecs | number of microseconds |
int Vnm_system | ( | const char * | cmd | ) |
An improved ANSI-C "system" call.
cmd | Pointer to the command |
int Vnm_systemBack | ( | const char * | cmd | ) |
A background variant of the ANSI-C "system" call.
cmd | Pointer to the command |
int Vnm_systemKill | ( | const char * | cmd | ) |
Something like a UNIX "killall" call.
cmd | Pointer to the command |
void Vnm_tprint | ( | const int | unit, | |
const char * | format, | |||
... | ||||
) |
Add our ioTag to Vnm_print output. We MUST NOT use VASSERT (or Vnm_print!) in this routine.
unit | index for the file unit | |
format | Pointer to the print format |
void Vnm_tstart | ( | int | timer, | |
const char * | name | |||
) |
Starts the timer on the particular machine.
timer | index for the starting timer | |
name | Pointer to the object |
void Vnm_tstop | ( | int | timer, | |
const char * | name | |||
) |
Stops the timer on the particular machine.
timer | index for the starting timer | |
name | Pointer to the object |
void Vnm_typeChk | ( | void | ) |
Check out the sizes of various datatypes.