mruby/c VM Source Code release 3.4
Loading...
Searching...
No Matches
console.c File Reference

console output module. (not yet input) More...

#include "mrubyc.h"
Include dependency graph for console.c:

Go to the source code of this file.

Macros

#define MRBC_PRINTF_MAX_WIDTH   82

Functions

static int mrbc_printf_sub_output_arg (mrbc_printf_t *pf, va_list *ap)
void mrbc_putchar (char c)
void mrbc_print_symbol (mrbc_sym sym_id)
void mrbc_nprint (const char *str, int size)
void mrbc_printf (const char *fstr,...)
void mrbc_asprintf (char **buf, int bufsiz, const char *fstr,...)
void mrbc_snprintf (char *buf, int bufsiz, const char *fstr,...)
void mrbc_vprintf (const char *fstr, va_list ap)
void mrbc_vasprintf (char **buf, int bufsiz, const char *fstr, va_list ap)
void mrbc_p (const mrbc_value *v)
int mrbc_p_sub (const mrbc_value *v)
int mrbc_puts_sub (const mrbc_value *v)
int mrbc_print_sub (const mrbc_value *v)
void mrbc_printf_replace_buffer (mrbc_printf_t *pf, char *buf, int size)
int mrbc_printf_main (mrbc_printf_t *pf)
int mrbc_printf_char (mrbc_printf_t *pf, int ch)
int mrbc_printf_bstr (mrbc_printf_t *pf, const char *str, int len, int pad)
int mrbc_printf_int (mrbc_printf_t *pf, mrbc_int_t value, unsigned int base)
int mrbc_printf_bit (mrbc_printf_t *pf, mrbc_int_t value, int bit)
int mrbc_printf_float (mrbc_printf_t *pf, double value)
int mrbc_printf_pointer (mrbc_printf_t *pf, void *ptr)

Detailed Description

console output module. (not yet input)

Copyright (C) 2015- Kyushu Institute of Technology.
Copyright (C) 2015- Shimane IT Open-Innovation Center.

This file is distributed under BSD 3-Clause License.

Definition in file console.c.

Macro Definition Documentation

◆ MRBC_PRINTF_MAX_WIDTH

#define MRBC_PRINTF_MAX_WIDTH   82

Definition at line 31 of file console.c.

Function Documentation

◆ mrbc_asprintf()

void mrbc_asprintf ( char ** buf,
int bufsiz,
const char * fstr,
... )

formatted output conversion, output to heap buffer.

Parameters
bufdouble pointer to output buffer. must be allocated by mrbc_alloc.
bufsizbuffer size.
fstrformat string.

Definition at line 198 of file console.c.

Here is the call graph for this function:

◆ mrbc_nprint()

void mrbc_nprint ( const char * str,
int size )

output string with length parameter.

Parameters
strstr
sizebyte length.

Definition at line 151 of file console.c.

Here is the caller graph for this function:

◆ mrbc_p()

void mrbc_p ( const mrbc_value * v)

print mrbc_value

Parameters
vpointer to target value.

Definition at line 321 of file console.c.

Here is the call graph for this function:

◆ mrbc_p_sub()

int mrbc_p_sub ( const mrbc_value * v)

p - sub function

Parameters
vpointer to target value.

Definition at line 333 of file console.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_print_sub()

int mrbc_print_sub ( const mrbc_value * v)

print - sub function

Parameters
vpointer to target value.
Return values
0normal return.
1already output LF.

Definition at line 421 of file console.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_print_symbol()

void mrbc_print_symbol ( mrbc_sym sym_id)

display symbol name.

Parameters
sym_idsymbol ID to print.

Definition at line 127 of file console.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_printf()

void mrbc_printf ( const char * fstr,
... )

formatted output conversion, output to console.

Parameters
fstrformat string.

Definition at line 180 of file console.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_printf_bit()

int mrbc_printf_bit ( mrbc_printf_t * pf,
mrbc_int_t value,
int bit )

sprintf subcontract function for 'x', 'o', 'b'

Parameters
pfpointer to mrbc_printf.
valueoutput value.
bitn bit. (4=hex, 3=oct, 1=bin)
Return values
0done.
-1buffer full.
Note
not terminate ('\0') buffer tail.

Definition at line 774 of file console.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_printf_bstr()

int mrbc_printf_bstr ( mrbc_printf_t * pf,
const char * str,
int len,
int pad )

sprintf subcontract function for byte array.

Parameters
pfpointer to mrbc_printf.
strpointer to byte array.
lenbyte length.
padpadding character.
Return values
0done.
-1buffer full.
Note
not terminate ('\0') buffer tail.

Definition at line 635 of file console.c.

Here is the caller graph for this function:

◆ mrbc_printf_char()

int mrbc_printf_char ( mrbc_printf_t * pf,
int ch )

sprintf subcontract function for char 'c'

Parameters
pfpointer to mrbc_printf
choutput character (ASCII)
Return values
0done.
-1buffer full.
Note
not terminate ('\0') buffer tail.

Definition at line 602 of file console.c.

Here is the caller graph for this function:

◆ mrbc_printf_float()

int mrbc_printf_float ( mrbc_printf_t * pf,
double value )

sprintf subcontract function for float(double) 'f'

Parameters
pfpointer to mrbc_printf.
valueoutput value.
Return values
0done.
-1buffer full.

Definition at line 834 of file console.c.

Here is the caller graph for this function:

◆ mrbc_printf_int()

int mrbc_printf_int ( mrbc_printf_t * pf,
mrbc_int_t value,
unsigned int base )

sprintf subcontract function for integer 'd', 'u'

Parameters
pfpointer to mrbc_printf.
valueoutput value.
basen base.
Return values
0done.
-1buffer full.
Note
not terminate ('\0') buffer tail.

Definition at line 687 of file console.c.

Here is the caller graph for this function:

◆ mrbc_printf_main()

int mrbc_printf_main ( mrbc_printf_t * pf)

sprintf subcontract function

Parameters
pfpointer to mrbc_printf
Return values
0(format string) done.
1found a format identifier.
-1buffer full.
Note
not terminate ('\0') buffer tail.

Definition at line 542 of file console.c.

Here is the caller graph for this function:

◆ mrbc_printf_pointer()

int mrbc_printf_pointer ( mrbc_printf_t * pf,
void * ptr )

sprintf subcontract function for pointer 'p'

Parameters
pfpointer to mrbc_printf.
ptroutput value.
Return values
0done.
-1buffer full.
Note
display '$00000000' style only. up to 8 digits, even if 64bit machines. not support sign, width, precision and other parameters.

Definition at line 868 of file console.c.

Here is the caller graph for this function:

◆ mrbc_printf_replace_buffer()

void mrbc_printf_replace_buffer ( mrbc_printf_t * pf,
char * buf,
int size )

replace output buffer

Parameters
pfpointer to mrbc_printf
bufpointer to output buffer.
sizebuffer size.

Definition at line 524 of file console.c.

Here is the caller graph for this function:

◆ mrbc_printf_sub_output_arg()

int mrbc_printf_sub_output_arg ( mrbc_printf_t * pf,
va_list * ap )
static

Definition at line 44 of file console.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_putchar()

void mrbc_putchar ( char c)

output a character

Parameters
ccharacter

Definition at line 106 of file console.c.

Here is the caller graph for this function:

◆ mrbc_puts_sub()

int mrbc_puts_sub ( const mrbc_value * v)

puts - sub function

Parameters
vpointer to target value.
Return values
0normal return.
1already output LF.

Definition at line 398 of file console.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_snprintf()

void mrbc_snprintf ( char * buf,
int bufsiz,
const char * fstr,
... )

formatted output conversion, output to fixed buffer.

Parameters
bufoutput buffer.
bufsizbuffer size.
fstrformat string.

Definition at line 216 of file console.c.

Here is the call graph for this function:

◆ mrbc_vasprintf()

void mrbc_vasprintf ( char ** buf,
int bufsiz,
const char * fstr,
va_list ap )

formatted output conversion with va_list, output to heap buffer.

Parameters
bufdouble pointer to output buffer. must be allocated by mrbc_alloc.
bufsizbuffer size.
fstrformat string.
apvariable argument pointer.

Definition at line 276 of file console.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_vprintf()

void mrbc_vprintf ( const char * fstr,
va_list ap )

formatted output conversion with va_list, output to console.

Parameters
fstrformat string.
apvariable argument pointer.

Definition at line 241 of file console.c.

Here is the call graph for this function:
Here is the caller graph for this function: