16 size_t len = strlen(s) + 1;
17 char *d = (
char *)malloc(len);
26 for (i = 0; i <
g_argc; ++i) {
45 g_argv = (
char **)malloc(
sizeof(
char *) * (
size_t)
argc);
51 for (i = 0; i <
argc; ++i) {
52 const char *s =
argv[i] ?
argv[i] :
"";
56 for (j = 0; j < i; ++j)
77 if (idx < 0 || idx >=
g_argc)
Standard library module C API — function declarations exported to MXVM programs.
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.
void free_program_args(void)
Free the stored command-line argument memory.
int64_t float_to_int(double d)
void set_program_args(int argc, const char **argv)
Store command-line arguments for later access via argc()/argv().
static char * mx_strdup_c(const char *s)
static int g_args_registered
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.
double int_to_float(int64_t i)