Operating System
Macros | Functions
stdio.h File Reference

my stdio.h implementation More...

#include "graphic.h"
#include "utilities.h"
#include <stdarg.h>

Go to the source code of this file.

Macros

#define DEFAULT_STYLE_DARK   (G_DEFAULT | G_DARK)
 
#define DEFAULT_STYLE   (G_DEFAULT)
 

Functions

static int16_t _draw_char (char ch, int offset, uint8_t style)
 
static int16_t putch_style (char ch, uint8_t style)
 
static int16_t putch (char ch)
 
static int16_t padding (int16_t num)
 
static int16_t __uts_read_int (const char *s, int16_t *readNum)
 
static int16_t draw_str (char const *str, int row, int col)
 
static int16_t newline ()
 
static int16_t draw_str_style (char const *str, int row, int col, uint8_t style)
 
static int16_t draw_char_style (char ch, int row, int col, uint8_t style)
 
static int16_t puts_style (char const *str, uint8_t style)
 
static int16_t puts (char const *str)
 
static int16_t putln (char const *str)
 
static int16_t puti (int32_t num)
 
static int16_t putiln (int num)
 
static int printf (const char *format,...)
 
static int getch ()
 
static int16_t putn (const char *s, uint16_t size)
 

Detailed Description

my stdio.h implementation

Definition in file stdio.h.

Macro Definition Documentation

◆ DEFAULT_STYLE

#define DEFAULT_STYLE   (G_DEFAULT)

Definition at line 12 of file stdio.h.

◆ DEFAULT_STYLE_DARK

#define DEFAULT_STYLE_DARK   (G_DEFAULT | G_DARK)

Definition at line 11 of file stdio.h.

Function Documentation

◆ __uts_read_int()

static int16_t __uts_read_int ( const char *  s,
int16_t *  readNum 
)
inlinestatic

no need to used this. inner function that used to parce int from string

Definition at line 82 of file stdio.h.

◆ _draw_char()

static int16_t _draw_char ( char  ch,
int  offset,
uint8_t  style 
)
inlinestatic

low level char output function

Parameters
chthat character that want to draw
offsetthe offset from (0, 0) in terminal counted by ((row * 80) + column) * 2
styleprint style
Returns
always 1

Definition at line 21 of file stdio.h.

◆ draw_char_style()

static int16_t draw_char_style ( char  ch,
int  row,
int  col,
uint8_t  style 
)
inlinestatic

Definition at line 131 of file stdio.h.

◆ draw_str()

static int16_t draw_str ( char const *  str,
int  row,
int  col 
)
inlinestatic
Parameters
strstring to output
rowthe starting row in terminal (0 based, count from left)
col(0 based, count from up)

Definition at line 104 of file stdio.h.

◆ draw_str_style()

static int16_t draw_str_style ( char const *  str,
int  row,
int  col,
uint8_t  style 
)
inlinestatic

Definition at line 120 of file stdio.h.

◆ getch()

static int getch ( )
inlinestatic

Definition at line 242 of file stdio.h.

◆ newline()

static int16_t newline ( )
inlinestatic

Definition at line 115 of file stdio.h.

◆ padding()

static int16_t padding ( int16_t  num)
inlinestatic

output space specified by num

Parameters
numhow much space to output
Returns
same as num

Definition at line 71 of file stdio.h.

◆ printf()

static int printf ( const char *  format,
  ... 
)
inlinestatic

almost same as printf. currently support d, s, c, and %<num>d ...

Returns
TODO: BUG.

Definition at line 190 of file stdio.h.

◆ putch()

static int16_t putch ( char  ch)
inlinestatic

Definition at line 62 of file stdio.h.

◆ putch_style()

static int16_t putch_style ( char  ch,
uint8_t  style 
)
inlinestatic

Definition at line 33 of file stdio.h.

◆ puti()

static int16_t puti ( int32_t  num)
inlinestatic

put integer.

Parameters
numthe int to be print

Definition at line 159 of file stdio.h.

◆ putiln()

static int16_t putiln ( int  num)
inlinestatic

Definition at line 179 of file stdio.h.

◆ putln()

static int16_t putln ( char const *  str)
inlinestatic

Definition at line 149 of file stdio.h.

◆ putn()

static int16_t putn ( const char *  s,
uint16_t  size 
)
inlinestatic

Definition at line 245 of file stdio.h.

◆ puts()

static int16_t puts ( char const *  str)
inlinestatic

Definition at line 146 of file stdio.h.

◆ puts_style()

static int16_t puts_style ( char const *  str,
uint8_t  style 
)
inlinestatic

put string with style

Definition at line 137 of file stdio.h.