LibGame  v0.4.0
The LG Game Engine - Copyright (C) 2024-2025 ETMSoftware
lg_goodies.c File Reference

Functions

char * l_str_new2 (int n,...)
 
char * l_str_cat2 (char *str, int n,...)
 
LG_Stack_ilg_stack_i_new (int max_n)
 
void lg_stack_i_free (LG_Stack_i *s)
 
zboolean push_i (LG_Stack_i *s, int v)
 
zboolean pop_i (LG_Stack_i *s, int *v)
 
LG_Stack_flg_stack_f_new (int max_n)
 
void lg_stack_f_free (LG_Stack_f *s)
 
zboolean push_f (LG_Stack_f *s, float v)
 
zboolean pop_f (LG_Stack_f *s, float *v)
 
void lg_stack_show_full_empty_errors (zboolean show_errors)
 

Detailed Description

=== Only amazingly convenient stuff ===

Function Documentation

◆ l_str_new2()

char* l_str_new2 ( int  n,
  ... 
)

Dynamically create a new string made of n sub-strings

Parameters
nNumber of sub-strings
...Sequence of n sub-strings (const char *)
Returns
The new string - should be freed when you're done with it with l_str_free()

◆ l_str_cat2()

char* l_str_cat2 ( char *  str,
int  n,
  ... 
)

Dynamically concanate n sub-strings to a string created with l_str_new() or l_str_new2()

Parameters
strA dynamically created string
nNumber of sub-strings
...Sequence of n sub-strings (const char *)
Returns
The new string - should be freed when you're done with it with l_str_free()

◆ lg_stack_i_new()

LG_Stack_i* lg_stack_i_new ( int  max_n)

Create and init a new LG_Stack_i instance

Parameters
max_nMax num of elements of the stack
Returns
A new LG_Stack_i instance if OK, NULL on error

◆ lg_stack_i_free()

void lg_stack_i_free ( LG_Stack_i s)

Free a LG_Stack_i instance and all associated resources

Parameters
sA LG_Stack_i instance

◆ push_i()

zboolean push_i ( LG_Stack_i s,
int  v 
)

Push int value into LG_Stack_i

Parameters
sAddr of LG_Stack_i
vint value
Returns
TRUE if OK, FALSE otherwise

◆ pop_i()

zboolean pop_i ( LG_Stack_i s,
int *  v 
)

Pop int value from LG_Stack_i

Parameters
sAddr of LG_Stack_i
vAddr of int
Returns
TRUE if OK, FALSE otherwise

◆ lg_stack_f_new()

LG_Stack_f* lg_stack_f_new ( int  max_n)

Create and init a new LG_Stack_f instance

Parameters
max_nMax num of elements of the stack
Returns
A new LG_Stack_f instance if OK, NULL on error

◆ lg_stack_f_free()

void lg_stack_f_free ( LG_Stack_f s)

Free a LG_Stack_f instance and all associated resources

Parameters
sA LG_Stack_f instance

◆ push_f()

zboolean push_f ( LG_Stack_f s,
float  v 
)

Push float value into LG_Stack_f

Parameters
sAddr of LG_Stack_f
vfloat value
Returns
TRUE if OK, FALSE otherwise

◆ pop_f()

zboolean pop_f ( LG_Stack_f s,
float *  v 
)

Pop float value from LG_Stack_f

Parameters
sAddr of LG_Stack_f
vAddr of float
Returns
TRUE if OK, FALSE otherwise

◆ lg_stack_show_full_empty_errors()

void lg_stack_show_full_empty_errors ( zboolean  show_errors)

Show / don't show (= default) "Stack is full" / "Stack is empty" errors, which can be numerous

Parameters
show_errors