|
int | Vnm_sigInt (void) |
| Signal and setjmp handling routine. Return the signal interrupt flag. More...
|
|
void | Vnm_sigIntSet (void) |
| Signal and setjmp handling routine. Set the signal interrupt flag. More...
|
|
void | Vnm_sigIntClear (void) |
| Signal and setjmp handling routine. Clear the signal interrupt flag. More...
|
|
int | Vnm_jmpOk (void) |
| Signal and setjmp handling routine. Return the "ok-to-jump" flag. More...
|
|
void | Vnm_jmpOkSet (void) |
| Signal and setjmp handling routine. Set the "okay-to-jump" flag. More...
|
|
void | Vnm_jmpOkClear (void) |
| Signal and setjmp handling routine. Clear the "okay-to-jump" flag. More...
|
|
jmp_buf * | Vnm_signalInit (void) |
| Initialize the signal handling data structures. More...
|
|
void | Vnm_regHand (void) |
| Register the signal handler with the operating system. More...
|
|
void | Vnm_sigHand (int num) |
| Handle events such as SIGINT. We must have first been registered with "Vnm_signalInit". More...
|
|
double | Vnm_powsafe (double x, double y) |
| A safe VPOW function (avoids division by zero). More...
|
|
void | Vnm_typeChk (void) |
| Check out the sizes of various datatypes. More...
|
|
double | Vnm_epsmac (void) |
| Computes the unit roundoff of the machine in single. More...
|
|
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! More...
|
|
void | Vnm_tstart (int timer, const char *name) |
| Starts the timer on the particular machine. More...
|
|
void | Vnm_tstop (int timer, const char *name) |
| Stops the timer on the particular machine. More...
|
|
char * | Vnm_getuser (char *user, int usermax) |
| Ask the system for the username. More...
|
|
char * | Vnm_getos (char *os, int osmax) |
| Ask the system for the operating system name. More...
|
|
char * | Vnm_gethost (char *host, int hostmax) |
| Ask the system for the hostname. More...
|
|
char * | Vnm_gethome (char *path, int pathmax) |
| Ask the system for the home directory. More...
|
|
char * | Vnm_getcwd (char *path, int pathmax) |
| Ask the system for the current working directory. More...
|
|
int | Vnm_chdir (const char *path) |
| Interact with the system to change the working directory. More...
|
|
int | Vnm_mkdir (const char *path) |
| Interact with the system to make a new directory. More...
|
|
int | Vnm_system (const char *cmd) |
| An improved ANSI-C "system" call. More...
|
|
int | Vnm_systemBack (const char *cmd) |
| A background variant of the ANSI-C "system" call. More...
|
|
int | Vnm_systemKill (const char *cmd) |
| Something like a UNIX "killall" call. More...
|
|
int | Vnm_exec (int argc, char **argv) |
| An improved UNIX "exec" call. This routine does not return except on error. More...
|
|
void | Vnm_sleep (int nusecs) |
| Implement a sleep function with microsecond resolution. More...
|
|
int | Vnm_ioTag (void) |
| Return my I/O tag. More...
|
|
int | Vnm_nTags (void) |
| Return the total number of tags. More...
|
|
void | Vnm_setIoTag (int myTag, int numTags) |
| Set my id. More...
|
|
FILE * | Vnm_open (const int unit) |
| Open an I/O console. More...
|
|
int | Vnm_close (const int unit) |
| Close an I/O console. We MUST NOT use VASSERT (or Vnm_print!) in this routine. More...
|
|
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. More...
|
|
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. More...
|
|
void | Vnm_print (const int unit, const char *format,...) |
| External interface to the console i/o routine. More...
|
|
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. More...
|
|
void | Vnm_qsort (int *u, int size) |
| Front-end to quick sort integer array from [-large] to [+large]. More...
|
|
void | Vnm_qsortOrd (int *u, int *ord, int size) |
| Front-end to quick sort integer array from [-large] to [+large]. More...
|
|
void | Vnm_dqsort (double *u, int size) |
| Front-end to quick sort integer array from [-large] to [+large]. More...
|
|
void | Vnm_dqsortOrd (double *u, int *ord, int size) |
| Front-end to quick sort integer array from [-large] to [+large]. More...
|
|
Header file for an ISO C [V]irtual [N]umerical [M]achine.
- Author
- Michael Holst
- Note
- None
- Version
- Id
- vnm.h,v 1.22 2010/08/12 05:40:36 fetk Exp
- Attention
*
* MALOC = < Minimal Abstraction Layer for Object-oriented C >
* Copyright (C) 1994-- 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
*
*
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!
- Author
- Michael Holst
- Note
- Useful constants and functions (timers, epsilon, token generators, i/o)
Again, the input string "buf" IS MODIFIED; white space characters (defined in the input string "white") are replaced by the NULL character '\0'. The output "argv" is simply a list of pointers
to the start of the tokens in "buf", which are NULL-terminated
after we replace the white space with NULLs.
We follow convention and "NULL"-terminate "argv" by setting the pointer following the last token to "VNULL". The return value is "argc", the number of tokens found (not including the terminating NULL pointer). For safety you must pass in the maximal length of argv in the parameter "argvmax".
If we encounter a token which begins with a comment character (defined in the input string "comment"), then we ignore the rest of the tokens in the input buffer "buf". This is suitable
for parsing shell languages such as sh/ksh/bash which have comments that start with e.g. "#" and continue until a newline.
We DO NOT use the C library function strtok in this routine. (There are some bad implementations of strtok around apparently; the internal state variables maintained by strtok can get very
messed up if you use strtok in multiple places in a code.)
- Returns
- number of tokens
- Parameters
-
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 |