MXVM 1.8.1
Virtual Machine, Compiler, and Pascal Frontend
Loading...
Searching...
No Matches
std.c File Reference

Standard library module C implementation — math, string conversion, and utility functions. More...

#include "mx_std.h"
#include <stdlib.h>
#include <string.h>
Include dependency graph for std.c:

Go to the source code of this file.

Functions

static char * mx_strdup_c (const char *s)
void free_program_args (void)
 Free the stored command-line argument memory.
void set_program_args (int argc, const char **argv)
 Store command-line arguments for later access via argc()/argv().
int argc (void)
 Return the number of stored command-line arguments.
const char * argv (int idx)
 Return the command-line argument at the given index.
int64_t float_to_int (double d)
double int_to_float (int64_t i)
void release (void *ptr)

Variables

static int g_argc = 0
static char ** g_argv = NULL
static int g_args_registered = 0

Detailed Description

Standard library module C implementation — math, string conversion, and utility functions.

Author
Jared Bruni

Definition in file std.c.

Function Documentation

◆ argc()

int argc ( void )

Return the number of stored command-line arguments.

Definition at line 72 of file std.c.

References g_argc.

Referenced by mx::Argz< String >::Argz(), mx::Argz< String >::initArgs(), main(), mxvm_std_argc(), mxvm_std_set_program_args(), mx::proc_args(), proc_args(), and set_program_args().

◆ argv()

const char * argv ( int idx)

Return the command-line argument at the given index.

Parameters
idxZero-based argument index
Returns
Pointer to the argument string

Definition at line 76 of file std.c.

References g_argc, and g_argv.

Referenced by mx::Argz< String >::Argz(), action_interpret(), mx::Argz< String >::initArgs(), main(), mxvm_std_argv(), mxvm_std_set_program_args(), mx::proc_args(), proc_args(), set_program_args(), and mxvm::Program::setArgs().

◆ float_to_int()

int64_t float_to_int ( double d)

Definition at line 82 of file std.c.

◆ free_program_args()

void free_program_args ( void )

Free the stored command-line argument memory.

Definition at line 23 of file std.c.

References g_argc, and g_argv.

Referenced by mxvm_std_free_program_args(), and set_program_args().

◆ int_to_float()

double int_to_float ( int64_t i)

Definition at line 86 of file std.c.

◆ mx_strdup_c()

char * mx_strdup_c ( const char * s)
static

Definition at line 15 of file std.c.

Referenced by set_program_args().

◆ release()

void release ( void * ptr)

Definition at line 90 of file std.c.

◆ set_program_args()

void set_program_args ( int argc,
const char ** argv )

Store command-line arguments for later access via argc()/argv().

Parameters
argcNumber of arguments
argvArgument string array

Definition at line 35 of file std.c.

References argc(), argv(), free_program_args(), g_argc, g_args_registered, g_argv, and mx_strdup_c().

Referenced by mxvm_std_set_program_args().

Variable Documentation

◆ g_argc

int g_argc = 0
static

Definition at line 11 of file std.c.

Referenced by argc(), argv(), free_program_args(), and set_program_args().

◆ g_args_registered

int g_args_registered = 0
static

Definition at line 13 of file std.c.

Referenced by set_program_args().

◆ g_argv

char** g_argv = NULL
static

Definition at line 12 of file std.c.

Referenced by argv(), free_program_args(), and set_program_args().