ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
_infrastructure.c File Reference
#include <math.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdarg.h>
#include "../../ugbc.h"

Go to the source code of this file.

Macros

#define strcmp_nocase   strcasecmp
#define UNESCAPE_COLOR(c, d)

Functions

void memory_area_assign (MemoryArea *_first, Variable *_variable)
void memory_area_unassign (MemoryArea *_first, Variable *_variable)
Bankbank_find (Bank *_first, char *_name)
Constantconstant_create (Environment *_environment, char *_name)
Constantconstant_find (Environment *_environment, char *_name)
Offsettingoffsetting_size_count (Environment *_environment, int _size, int _count)
void offsetting_add_variable_reference (Environment *_environment, Offsetting *_first, Variable *_var, int _sequence)
void variable_global (Environment *_environment, char *_pattern)
Variablevariable_retrieve_internal (Environment *_environment, char *_name, int _mandatory)
 Retrieve the definition of a variable.
Variablevariable_define (Environment *_environment, char *_name, VariableType _type, int _value)
 Define a variable for the program.
Variablevariable_import (Environment *_environment, char *_name, VariableType _type, int _size_or_value)
Variablevariable_export (Environment *_environment, char *_name, VariableType _type, int _size_or_value)
Variablevariable_define_no_init (Environment *_environment, char *_name, VariableType _type)
Variablevariable_retrieve_by_realname (Environment *_environment, char *_name)
Variablevariable_retrieve (Environment *_environment, char *_name)
int variable_exists (Environment *_environment, char *_name)
int variable_exists_by_realname (Environment *_environment, char *_name)
int variable_delete (Environment *_environment, char *_name)
Variablevariable_retrieve_or_define (Environment *_environment, char *_name, VariableType _type, int _value)
void variable_reset (Environment *_environment)
 Reset the usage flags for the temporary variable pool.
Variablevariable_array_type (Environment *_environment, char *_name, VariableType _type)
Variablevariable_temporary (Environment *_environment, VariableType _type, char *_meaning)
 Define a temporary variable.
Variablevariable_resident (Environment *_environment, VariableType _type, char *_meaning)
Variablevariable_cast (Environment *_environment, char *_source, VariableType _type)
 Cast a variable from a type to another.
Variablevariable_store (Environment *_environment, char *_destination, unsigned int _value)
 Store a direct value to a variable.
Variablevariable_store_type (Environment *_environment, char *_destination, char *_field, unsigned int _value)
Variablevariable_by_constant (Environment *_environment, VariableType _type, int _value)
char * unescape_string (Environment *_environment, char *_value, int _printing, int *_final_size)
Variablevariable_store_string (Environment *_environment, char *_destination, char *_value)
 Store a string to a variable.
Variablevariable_store_float (Environment *_environment, char *_destination, double _value)
 Store a string to a variable.
Variablevariable_resize_buffer (Environment *_environment, char *_destination, int _size)
 Resize the (static) size of a buffer.
Variablevariable_store_buffer (Environment *_environment, char *_destination, unsigned char *_buffer, int _size, int _at)
Variablevariable_store_array (Environment *_environment, char *_destination, unsigned char *_buffer, int _size, int _at)
Variablevariable_move (Environment *_environment, char *_source, char *_destination)
 Store the value of a variable inside another variable by converting it.
Variablevariable_add_const (Environment *_environment, char *_source, int _destination)
 Add a variable with a constant, and return the sum of them.
Variablevariable_move_naked (Environment *_environment, char *_source, char *_destination)
 Store the value of a variable inside another variable without conversion.
Variablevariable_add (Environment *_environment, char *_source, char *_destination)
 Add two variable and return the sum of them.
void variable_add_inplace (Environment *_environment, char *_source, int _destination)
void variable_add_inplace_type (Environment *_environment, char *_source, char *_field, int _destination)
void variable_add_inplace_vars (Environment *_environment, char *_source, char *_destination)
 Add two variable and return the sum of them on the first.
void variable_add_inplace_type_vars (Environment *_environment, char *_source, char *_field, char *_destination)
void variable_add_inplace_array (Environment *_environment, char *_source, char *_destination)
 Add a variable to an array element, and return the sum of them on the array element.
void variable_add_inplace_mt (Environment *_environment, char *_source, char *_destination)
 Add two variable and return the sum of them on the first.
void variable_xor_inplace (Environment *_environment, char *_source, int _destination)
void variable_xor_inplace_vars (Environment *_environment, char *_source, char *_destination)
 Add two variable and return the sum of them on the first.
void variable_xor_inplace_mt (Environment *_environment, char *_source, char *_destination)
 Add two variable and return the sum of them on the first.
Variablevariable_sub (Environment *_environment, char *_source, char *_dest)
 Make a differenze between two variable and return the difference of them.
Variablevariable_sub_const (Environment *_environment, char *_source, int _destination)
 Make a differenze between a variable a constant, and return the difference of them.
void variable_sub_inplace (Environment *_environment, char *_source, char *_dest)
 Make a differenze between two variable and assign the difference of them to the first.
void variable_swap (Environment *_environment, char *_source, char *_dest)
 Swap values of two variables.
Variablevariable_complement_const (Environment *_environment, char *_source, int _value)
 Calculate the complement of a variable.
Variablevariable_mul (Environment *_environment, char *_source, char *_destination)
 Make a multiplication between two variable and return the product of them.
Variablevariable_div (Environment *_environment, char *_source, char *_destination, char *_remainder)
 Make a division between two variable and return the product of them.
Variablevariable_div_const (Environment *_environment, char *_source, int _destination, char *_remainder)
void variable_increment (Environment *_environment, char *_source)
 Increment a variable by one.
void variable_increment_type (Environment *_environment, char *_source, char *_field)
void variable_store_mt (Environment *_environment, char *_source, unsigned int _value)
 Store a variable's value.
Variablevariable_move_from_mt (Environment *_environment, char *_source, char *_destination)
 Increment a variable by one.
Variablevariable_move_to_mt (Environment *_environment, char *_source, char *_destination)
void variable_increment_mt (Environment *_environment, char *_source)
 Increment a variable by one.
void variable_decrement (Environment *_environment, char *_source)
 Decrement a variable by one.
void variable_decrement_type (Environment *_environment, char *_source, char *_field)
void variable_decrement_mt (Environment *_environment, char *_source)
 Decrement a variable by one.
void variable_compare_and_branch_const (Environment *_environment, char *_source, int _destination, char *_name, int _positive)
Variablevariable_compare (Environment *_environment, char *_source, char *_destination)
 Compare two variable and return the result of comparation.
Variablevariable_compare_const (Environment *_environment, char *_source, int _destination)
 Compare two variable and return the result of comparation.
Variablevariable_compare_not_const (Environment *_environment, char *_source, int _destination)
 Compare two variable and return the result of comparation.
Variablevariable_compare_not (Environment *_environment, char *_source, char *_destination)
 Compare two variable and return the result of comparation.
Variablevariable_mul2_const (Environment *_environment, char *_destination, int _steps)
 Double a variable for various times and return the result.
Variablevariable_sl_const (Environment *_environment, char *_destination, int _steps)
Variablevariable_div2_const (Environment *_environment, char *_destination, int _bits, char *_remainder)
 Subdivide by two a variable for various times and return the result.
Variablevariable_sr_const (Environment *_environment, char *_destination, int _bits)
Variablevariable_and_const (Environment *_environment, char *_destination, int _mask)
 Calculate "and" mask for a variable and it as the result.
Variablevariable_and (Environment *_environment, char *_left, char *_right)
 Calculate logical "and" and return it as the result.
Variablevariable_xor (Environment *_environment, char *_left, char *_right)
 Calculate logical "xor" and return it as the result.
Variablevariable_or (Environment *_environment, char *_left, char *_right)
 Calculate logical "or" and return it as the result.
Variablevariable_not (Environment *_environment, char *_value)
 Calculate logical "not" and return it as the result.
Variablevariable_less_than (Environment *_environment, char *_source, char *_destination, int _equal)
 Compare two variable and return the result of comparation.
Variablevariable_less_than_const (Environment *_environment, char *_source, int _destination, int _equal)
Variablevariable_greater_than (Environment *_environment, char *_source, char *_destination, int _equal)
 Compare two variable and return the result of comparation.
Variablevariable_greater_than_const (Environment *_environment, char *_source, int _destination, int _equal)
Variablevariable_string_left (Environment *_environment, char *_string, char *_position)
 Emit code for = LEFT( ..., ... ).
void variable_string_left_assign (Environment *_environment, char *_string, char *_position, char *_expression)
 Emit code for LEFT( ..., ... ) = ....
Variablevariable_string_right (Environment *_environment, char *_string, char *_position)
 Emit code for = LEFT( ..., ... ).
void variable_string_right_assign (Environment *_environment, char *_string, char *_position, char *_expression)
 Emit code for RIGHT( ..., ... ) = ....
Variablevariable_string_mid (Environment *_environment, char *_string, char *_position, char *_len)
 Emit code for = MID( ..., ... [, ...] ).
Variablevariable_string_substring (Environment *_environment, char *_string, char *_start, char *_end)
 Emit code for = SUBSTRING( ..., ... [, ...] ).
void variable_string_mid_assign (Environment *_environment, char *_string, char *_position, char *_len, char *_expression)
 Emit code for MID( ..., ... [, ...] ) = ....
Variablevariable_string_instr (Environment *_environment, char *_search, char *_searched, char *_start)
 Emit code for = INSTR( ..., ... [, ...] ).
Variablevariable_string_lower (Environment *_environment, char *_string)
 Emit code for = UPPER( ... ).
Variablevariable_string_upper (Environment *_environment, char *_string)
 Emit code for = UPPER( ... ).
Variablevariable_string_str (Environment *_environment, char *_value)
 Emit code for = STR( ... ).
Variablevariable_string_val (Environment *_environment, char *_value)
 Emit code for = VAL( ... ).
Variablevariable_hex (Environment *_environment, char *_value, int _separator)
 Emit code for = HEX( ... ).
Variablevariable_hex2bin (Environment *_environment, char *_value, char *_variable)
 Emit code for = HEX2BIN( ... ).
Variablevariable_string_string (Environment *_environment, char *_string, char *_repetitions)
 Emit code for = STRING( ..., ... ).
Variablevariable_string_dup (Environment *_environment, char *_string, char *_repetitions)
Variablevariable_string_space (Environment *_environment, char *_repetitions)
 Emit code for = SPACE( ... ).
Variablevariable_string_flip (Environment *_environment, char *_string)
 Emit code for = FLIP( ... ).
Variablevariable_flip (Environment *_environment, char *_variable)
Variablevariable_string_chr (Environment *_environment, char *_ascii)
 Emit code for = CHR( ... ).
Variablevariable_string_asc (Environment *_environment, char *_char)
 Emit code for = ASC( ... ).
Variablevariable_string_len (Environment *_environment, char *_string)
 Emit code for = LEN( ... ).
void variable_store_array_const_bit (Environment *_environment, Variable *_array, int _value)
void variable_store_array_const_byte (Environment *_environment, Variable *_array, int _value)
void variable_store_array_const (Environment *_environment, char *_array, int _value)
void variable_move_array_bit (Environment *_environment, Variable *_array, char *_value)
void variable_move_array_byte (Environment *_environment, Variable *_array, char *_value)
void variable_move_array (Environment *_environment, char *_array, char *_value)
void variable_move_array_string (Environment *_environment, char *_array, char *_string)
Variablevariable_move_from_array_bit_inplace (Environment *_environment, Variable *_array, Variable *_result)
Variablevariable_move_from_array_bit (Environment *_environment, Variable *_array)
void variable_move_from_array_byte_inplace (Environment *_environment, Variable *_array, Variable *_result)
Variablevariable_move_from_array_byte (Environment *_environment, Variable *_array)
void variable_move_from_array_inplace (Environment *_environment, char *_array, char *_result)
Variablevariable_move_from_array (Environment *_environment, char *_array)
int pattern_match (char *_pattern, char *_value)
Variablevariable_bin (Environment *_environment, char *_value, char *_digits, char *_zero, char *_one)
 Emit code for <string>BIN(...).
Variablevariable_bit (Environment *_environment, char *_value, char *_position)
 Emit code for HAS BIT / BIT(...).
int reset_screen_mode_selected (Environment *_environment)
int count_screen_mode_selected (Environment *_environment)
ScreenModefind_screen_mode_by_suggestion (Environment *_environment, int _bitmap, int _width, int _height, int _colors, int _tile_width, int _tile_height)
ScreenModefind_screen_mode_by_id (Environment *_environment, int _id)
Variablevariable_mod (Environment *_environment, char *_source, char *_destination)
int label_exists_numeric (Environment *_environment, int _label)
int label_exists_named (Environment *_environment, char *_label)
void label_define_numeric (Environment *_environment, int _label)
void label_define_named (Environment *_environment, char *_label)
int label_referred_exists_numeric (Environment *_environment, int _label)
int label_referred_exists_named (Environment *_environment, char *_label)
void label_referred_define_numeric (Environment *_environment, int _label)
void label_referred_define_named (Environment *_environment, char *_label)
int label_stored_exists_named (Environment *_environment, char *_label)
void label_stored_define_named (Environment *_environment, char *_label)
void const_define_numeric (Environment *_environment, char *_name, int _value)
void const_define_string (Environment *_environment, char *_name, char *_value)
Variablevariable_array_count_vars (Environment *_environment, char *_name, char *_target)
Variablevariable_array_sum_vars (Environment *_environment, char *_name)
Variablevariable_array_max_vars (Environment *_environment, char *_name)
Variablevariable_array_min_vars (Environment *_environment, char *_name)
void variable_array_fill (Environment *_environment, char *_name, int _value)
void variable_array_fill_random (Environment *_environment, char *_name, int _base, int _min_value, int _max_value, int _count, int _boolean)
void variable_array_fill_incremental (Environment *_environment, char *_name, int _min, int _count)
void variable_array_shuffle (Environment *_environment, char *_name, int _rounds)
void image_converter_asserts (Environment *_environment, int _width, int _height, int _offset_x, int _offset_y, int *_frame_width, int *_frame_height, int _modulo_x, int _modulo_y)
void image_converter_asserts_free (Environment *_environment, int _width, int _height, int _offset_x, int _offset_y, int *_frame_width, int *_frame_height)
void image_converter_asserts_free_width (Environment *_environment, int _width, int _height, int _offset_x, int _offset_y, int *_frame_width, int *_frame_height, int _modulo_y)
void image_converter_asserts_free_height (Environment *_environment, int _width, int _height, int _offset_x, int _offset_y, int *_frame_width, int *_frame_height, int _modulo_x)
char * resource_load_asserts (Environment *_environment, char *_filename)
void variable_temporary_remove (Environment *_environment, char *_name)
int calculate_white_area (TileData *_tileData)
int calculate_horizontal_edges (TileData *_tileData, int _position)
int calculate_vertical_edges (TileData *_tileData, int _position)
TileDescriptorcalculate_tile_descriptor (TileData *_tileData)
TileDescriptorsprecalculate_tile_descriptors_for_font (char *_fontData, int _fontSize)
int calculate_tile_affinity (TileDescriptor *_first, TileDescriptor *_second)
int calculate_nearest_tile (TileDescriptor *_tile, TileDescriptors *_tiles)
int calculate_exact_tile (TileDescriptor *_tile, TileDescriptors *_tiles)
int tile_allocate (TileDescriptors *_tiles, char *_data)
char * parse_buffer (Environment *_environment, char *_buffer, int *_size, int _hex_only)
Variableparse_buffer_definition (Environment *_environment, char *_buffer, VariableType _type, int _hex_only)
char * image_flip_x (Environment *_environment, char *_source, int _width, int _height, int _depth)
char * image_flip_y (Environment *_environment, char *_source, int _width, int _height, int _depth)
char * image_roll_x_right (Environment *_environment, char *_source, int _width, int _height)
char * image_roll_x_left (Environment *_environment, char *_source, int _width, int _height)
char * image_roll_y_down (Environment *_environment, char *_source, int _width, int _height)
char * image_enlarge_right (Environment *_environment, char *_source, int _width, int _height, int _delta)
char * image_enlarge_bottom (Environment *_environment, char *_source, int _width, int _height, int _delta)
char * image_extract_subimage (Environment *_environment, char *_source, int _width, int _height, int _frame_width, int _frame_height, int _x, int _y, int _depth)
int rgbi_equals_rgb (RGBi *_first, RGBi *_second)
int rgbi_equals_rgba (RGBi *_first, RGBi *_second)
void rgbi_move (RGBi *_source, RGBi *_destination)
int rgbi_distance (RGBi *_e1, RGBi *_e2)
 Calculate the distance between two colors.
int rgbi_extract_palette (Environment *_environment, unsigned char *_source, int _width, int _height, int _depth, RGBi _palette[], int _palette_size, int _sorted)
 Extract the color palette from the given image.
float max_of_two (float _x, float _y)
float max_of_three (float _m, float _n, float _p)
float min_of_two (float _x, float _y)
float min_of_three (float _m, float _n, float _p)
char * get_temporary_filename (Environment *_environment)
int system_call (Environment *_environment, char *_commandline)
 Call an external executable.
int system_remove_safe (Environment *_environment, char *_filename)
char * escape_newlines_full (char *_string, int _size)
char * escape_newlines (char *_string)
int check_if_filename_is_valid (Environment *_environment, char *_filename)
RGBimalloc_palette (int _size)
 Allocate a palette space.
RGBipalette_match (RGBi *_source, int _source_size, RGBi *_system, int _system_size)
 Make a "palette match".
RGBipalette_match_hardware_index (RGBi *_source, int _source_size, RGBi *_system, int _system_size)
RGBipalette_remove_duplicates (RGBi *_source, int _source_size, int *_unique_size)
 Remove duplicates from a palette.
RGBipalette_promote_color_as_background (int _index, RGBi *_source, int _source_size)
 Promote an index color in a palette.
RGBipalette_promote_color_as_foreground (int _index, RGBi *_source, int _source_size, int _max_size)
 Promote an index color in a palette.
RGBipalette_shift (RGBi *_source, int _source_size, int _offset)
 Shift colors in palette.
RGBipalette_merge (RGBi *_palette1, int _palette1_size, RGBi *_palette2, int _palette2_size, int *_size)
 Make a "palette merge".
int assemblyLineIsAComment (char *_buffer)
char * strtoupper (char *_string)
char * basename (char *_path)
Variableorigin_resolution_relative_transform_x (Environment *_environment, char *_x, int _is_relative)
Variableorigin_resolution_relative_transform_y (Environment *_environment, char *_y, int _is_relative)
void font_descriptors_init (Environment *_environment, int _embedded_present)
char * address_displacement (Environment *_environment, char *_address, char *_displacement)
Variablecalculate_frame_by_type (Environment *_environment, TsxTileset *_tileset, char *_images, char *_description)
int find_frame_by_type (Environment *_environment, TsxTileset *_tileset, char *_images, char *_description)
Variablevariable_direct_assign (Environment *_environment, char *_var, char *_expr)
StaticStringstring_reserve (Environment *_environment, char *_value)
ArrayReferenceparser_array_retrieve (Environment *_environment)
void parser_array_init (Environment *_environment)
void parser_array_init_by (Environment *_environment, ArrayReference *_array_reference)
void parser_array_cleanup (Environment *_environment)
void parser_array_index_symbolic (Environment *_environment, char *_index)
void parser_array_index_numeric (Environment *_environment, int _index)
VariableType variable_type_from_numeric_value (Environment *_environment, int _number)
Variableparser_adapted_numeric (Environment *_environment, int _number)
Variableparser_casted_numeric (Environment *_environment, VariableType _type, int _number)
DataSegmentdata_segment_define (Environment *_environment, char *_name)
DataSegmentdata_segment_define_numeric (Environment *_environment, int _number)
DataSegmentdata_segment_find (Environment *_environment, char *_name)
DataSegmentdata_segment_find_numeric (Environment *_environment, int _number)
DataSegmentdata_segment_define_or_retrieve (Environment *_environment, char *_name)
DataSegmentdata_segment_define_or_retrieve_numeric (Environment *_environment, int _number)
void buffered_fprintf (Environment *_environment, FILE *_stream, const char *_format,...)
int buffered_fputs (Environment *_environment, const char *_string, FILE *_stream)
size_t buffered_fwrite (Environment *_environment, void *_data, size_t _size, size_t _count, FILE *_stream)
void buffered_push_output (Environment *_environment)
void buffered_pop_output (Environment *_environment)
void buffered_prepend_output (Environment *_environment)
void buffered_output (Environment *_environment, FILE *_stream)
void get_image_overwrite_size (Environment *_environment, char *_image, char *_x1, char *_y1, char *_x2, char *_y2)
Resourcebuild_resource_for_sequence (Environment *_environment, char *_image, char *_frame, char *_sequence)
Variablevariable_int (Environment *_environment, char *_expression)
char * get_default_temporary_path ()
char * find_last_path_separator (char *_path)
void prepare_variable_storage (Environment *_environment, char *_name, Variable *_source)
char * generate_storage_filename (Environment *_environment, char *_prefix, char *_suffix, int _number)
int file_get_size (Environment *_environment, char *_filename)
Variablevariable_string_insert (Environment *_environment, char *_string, char *_altstring, char *_pos)
Variablevariable_string_inst (Environment *_environment, char *_string, char *_altstring, char *_pos)
Variablevariable_string_pick (Environment *_environment, char *_string, int _position)
char * resolve_color (Environment *_environment, char *_color)
int show_troubleshooting_and_exit (Environment *_environment, int _argc, char *_argv[])
int system_move_safe (Environment *_environment, char *_source, char *_destination)
int procedure_exists (Environment *_environment, char *_name)
const char * strstrcase (const char *_x, const char *_y)
const char * strrstr (const char *haystack, const char *needle)
void define_implicit_array_if_needed (Environment *_environment, char *_name)
int check_datatype_limits (VariableType _type, int _value)
char * file_read_csv (Environment *_environment, char *_filename, VariableType _type, int *_size, int *_count)
Typetype_find (Type *_first, char *_name)
Fieldfield_find (Type *_type, char *_name)
void variable_set_type (Environment *_environment, char *_name, char *_type)
Variablevariable_move_from_type (Environment *_environment, char *_type, char *_field)
void variable_move_from_type_inplace (Environment *_environment, char *_type, char *_field, char *_value)
void variable_move_type (Environment *_environment, char *_type, char *_field, char *_value)
void variable_move_array_type (Environment *_environment, char *_array, char *_field, char *_value)
Variablevariable_move_from_array_type (Environment *_environment, char *_array, char *_field)
void variable_move_from_array_type_inplace (Environment *_environment, char *_array, char *_field, char *_value)
void variable_move_from_array1_type_inplace (Environment *_environment, char *_array, char *_index, char *_field, char *_value)
Variablevariable_move_from_array1_type (Environment *_environment, char *_array, char *_index, char *_field)
void variable_move_array1_type (Environment *_environment, char *_array, char *_index, char *_field, char *_value)
void variable_move_array1_type_fields (Environment *_environment, char *_array, char *_index, char *_field1, char *_field2)
void variable_move_array1_type_const (Environment *_environment, char *_array, char *_index, char *_field, int _value)
void variable_increment_array_type (Environment *_environment, char *_source, char *_field)
void variable_decrement_array_type (Environment *_environment, char *_source, char *_field)
void variable_increment_array (Environment *_environment, char *_source)
void variable_decrement_array (Environment *_environment, char *_source)
char * strcopy (char *_dest, char *_source)
char * strreplace (const char *_orig, const char *_rep, const char *_with)
CopperListfind_copper_list (Environment *_environment, char *_name)
char * import_file_name (char *_import_path)
StaticStringstatic_string_find_by_value (Environment *_environment, char *_value, int _size)
StaticStringstatic_string_create_filled (Environment *_environment, int _size, char _value)
StaticStringstatic_string_create (Environment *_environment, char *_value, int _size)
Environmentenvironment_create (void)
 Create a new environment.
void environment_setup_default (Environment *_environment)
 Setup default environment values.
void environment_parse_command_line (Environment *_environment, int _argc, char *_argv[])
 Parse command line parameters.
void environment_setup_10liner (Environment *_environment)
void environment_setup_retrohack (Environment *_environment)

Variables

char targetName [] = "atari"
RGBi SYSTEM_PALETTE []
char BANK_TYPE_AS_STRING [][16]
 Description of BANK TYPE, in readable format.
char DATATYPE_AS_STRING [][16]
 Emit code for BEGIN COPPER.
char OUTPUT_FILE_TYPE_AS_STRING [][16]
int yydebug
char * importPath

Macro Definition Documentation

◆ strcmp_nocase

#define strcmp_nocase   strcasecmp

Definition at line 118 of file _infrastructure.c.

◆ UNESCAPE_COLOR

#define UNESCAPE_COLOR ( c,
d )
Value:
else if ( strcmp_nocase( word, c ) == 0 ) { \
int c2 = COLOR_##d;\
if ( ! c2 ) { \
c2 = 0xff; \
} \
if ( _printing ) { \
*q = '*'; \
} else { \
*q = 1; \
} \
++q; \
if ( _printing ) { \
*q = '*'; \
} else { \
*q = c2; \
} \
++q; \
}
#define strcmp_nocase
uint16_t word
Definition sidreloc.c:274

Definition at line 1855 of file _infrastructure.c.

Function Documentation

◆ address_displacement()

char * address_displacement ( Environment * _environment,
char * _address,
char * _displacement )

Definition at line 14516 of file _infrastructure.c.

◆ assemblyLineIsAComment()

int assemblyLineIsAComment ( char * _buffer)

Definition at line 14280 of file _infrastructure.c.

◆ bank_find()

Bank * bank_find ( Bank * _first,
char * _name )

Definition at line 251 of file _infrastructure.c.

◆ basename()

char * basename ( char * _path)

Definition at line 14314 of file _infrastructure.c.

◆ buffered_fprintf()

void buffered_fprintf ( Environment * _environment,
FILE * _stream,
const char * _format,
... )

Definition at line 15011 of file _infrastructure.c.

◆ buffered_fputs()

int buffered_fputs ( Environment * _environment,
const char * _string,
FILE * _stream )

Definition at line 15021 of file _infrastructure.c.

◆ buffered_fwrite()

size_t buffered_fwrite ( Environment * _environment,
void * _data,
size_t _size,
size_t _count,
FILE * _stream )

Definition at line 15026 of file _infrastructure.c.

◆ buffered_output()

void buffered_output ( Environment * _environment,
FILE * _stream )

Definition at line 15051 of file _infrastructure.c.

◆ buffered_pop_output()

void buffered_pop_output ( Environment * _environment)

Definition at line 15035 of file _infrastructure.c.

◆ buffered_prepend_output()

void buffered_prepend_output ( Environment * _environment)

Definition at line 15041 of file _infrastructure.c.

◆ buffered_push_output()

void buffered_push_output ( Environment * _environment)

Definition at line 15031 of file _infrastructure.c.

◆ build_resource_for_sequence()

Resource * build_resource_for_sequence ( Environment * _environment,
char * _image,
char * _frame,
char * _sequence )

Definition at line 15073 of file _infrastructure.c.

◆ calculate_exact_tile()

int calculate_exact_tile ( TileDescriptor * _tile,
TileDescriptors * _tiles )

Definition at line 13128 of file _infrastructure.c.

◆ calculate_frame_by_type()

Variable * calculate_frame_by_type ( Environment * _environment,
TsxTileset * _tileset,
char * _images,
char * _description )

Definition at line 14541 of file _infrastructure.c.

◆ calculate_horizontal_edges()

int calculate_horizontal_edges ( TileData * _tileData,
int _position )

Definition at line 13001 of file _infrastructure.c.

◆ calculate_nearest_tile()

int calculate_nearest_tile ( TileDescriptor * _tile,
TileDescriptors * _tiles )

Definition at line 13108 of file _infrastructure.c.

◆ calculate_tile_affinity()

int calculate_tile_affinity ( TileDescriptor * _first,
TileDescriptor * _second )

Definition at line 13093 of file _infrastructure.c.

◆ calculate_tile_descriptor()

TileDescriptor * calculate_tile_descriptor ( TileData * _tileData)

Definition at line 13041 of file _infrastructure.c.

◆ calculate_vertical_edges()

int calculate_vertical_edges ( TileData * _tileData,
int _position )

Definition at line 13021 of file _infrastructure.c.

◆ calculate_white_area()

int calculate_white_area ( TileData * _tileData)

Definition at line 12988 of file _infrastructure.c.

◆ check_datatype_limits()

int check_datatype_limits ( VariableType _type,
int _value )

Definition at line 15912 of file _infrastructure.c.

◆ check_if_filename_is_valid()

int check_if_filename_is_valid ( Environment * _environment,
char * _filename )

Definition at line 13942 of file _infrastructure.c.

◆ const_define_numeric()

void const_define_numeric ( Environment * _environment,
char * _name,
int _value )

Definition at line 11862 of file _infrastructure.c.

◆ const_define_string()

void const_define_string ( Environment * _environment,
char * _name,
char * _value )

Definition at line 11907 of file _infrastructure.c.

◆ constant_create()

Constant * constant_create ( Environment * _environment,
char * _name )

Definition at line 348 of file _infrastructure.c.

◆ constant_find()

Constant * constant_find ( Environment * _environment,
char * _name )

Definition at line 373 of file _infrastructure.c.

◆ count_screen_mode_selected()

int count_screen_mode_selected ( Environment * _environment)

Definition at line 11498 of file _infrastructure.c.

◆ data_segment_define()

DataSegment * data_segment_define ( Environment * _environment,
char * _name )

Definition at line 14901 of file _infrastructure.c.

◆ data_segment_define_numeric()

DataSegment * data_segment_define_numeric ( Environment * _environment,
int _number )

Definition at line 14925 of file _infrastructure.c.

◆ data_segment_define_or_retrieve()

DataSegment * data_segment_define_or_retrieve ( Environment * _environment,
char * _name )

Definition at line 14977 of file _infrastructure.c.

◆ data_segment_define_or_retrieve_numeric()

DataSegment * data_segment_define_or_retrieve_numeric ( Environment * _environment,
int _number )

Definition at line 14989 of file _infrastructure.c.

◆ data_segment_find()

DataSegment * data_segment_find ( Environment * _environment,
char * _name )

Definition at line 14949 of file _infrastructure.c.

◆ data_segment_find_numeric()

DataSegment * data_segment_find_numeric ( Environment * _environment,
int _number )

Definition at line 14963 of file _infrastructure.c.

◆ define_implicit_array_if_needed()

void define_implicit_array_if_needed ( Environment * _environment,
char * _name )

Definition at line 15899 of file _infrastructure.c.

◆ environment_create()

Environment * environment_create ( void )

Create a new environment.

Allocate space and reset (put to zero) the content of the Environment structure.

Returns
Environment just created

Definition at line 17283 of file _infrastructure.c.

◆ environment_parse_command_line()

void environment_parse_command_line ( Environment * _environment,
int _argc,
char * _argv[] )

Parse command line parameters.

Parameters
_environmentEnvironment to change
_argcThe number of parameters given on the command line.
_argvThe array of parameters given on the command line.

Definition at line 17365 of file _infrastructure.c.

◆ environment_setup_10liner()

void environment_setup_10liner ( Environment * _environment)

Definition at line 17748 of file _infrastructure.c.

◆ environment_setup_default()

void environment_setup_default ( Environment * _environment)

Setup default environment values.

Parameters
_environmentEnvironment to change

Definition at line 17294 of file _infrastructure.c.

◆ environment_setup_retrohack()

void environment_setup_retrohack ( Environment * _environment)

Definition at line 17755 of file _infrastructure.c.

◆ escape_newlines()

char * escape_newlines ( char * _string)

Definition at line 13936 of file _infrastructure.c.

◆ escape_newlines_full()

char * escape_newlines_full ( char * _string,
int _size )

Definition at line 13798 of file _infrastructure.c.

◆ field_find()

Field * field_find ( Type * _type,
char * _name )

Definition at line 16144 of file _infrastructure.c.

◆ file_get_size()

int file_get_size ( Environment * _environment,
char * _filename )

Definition at line 15271 of file _infrastructure.c.

◆ file_read_csv()

char * file_read_csv ( Environment * _environment,
char * _filename,
VariableType _type,
int * _size,
int * _count )

Definition at line 15940 of file _infrastructure.c.

◆ find_copper_list()

CopperList * find_copper_list ( Environment * _environment,
char * _name )

Definition at line 17181 of file _infrastructure.c.

◆ find_frame_by_type()

int find_frame_by_type ( Environment * _environment,
TsxTileset * _tileset,
char * _images,
char * _description )

Definition at line 14612 of file _infrastructure.c.

◆ find_last_path_separator()

char * find_last_path_separator ( char * _path)

Definition at line 15206 of file _infrastructure.c.

◆ find_screen_mode_by_id()

ScreenMode * find_screen_mode_by_id ( Environment * _environment,
int _id )

Definition at line 11570 of file _infrastructure.c.

◆ find_screen_mode_by_suggestion()

ScreenMode * find_screen_mode_by_suggestion ( Environment * _environment,
int _bitmap,
int _width,
int _height,
int _colors,
int _tile_width,
int _tile_height )

Definition at line 11514 of file _infrastructure.c.

◆ font_descriptors_init()

void font_descriptors_init ( Environment * _environment,
int _embedded_present )

Definition at line 14474 of file _infrastructure.c.

◆ generate_storage_filename()

char * generate_storage_filename ( Environment * _environment,
char * _prefix,
char * _suffix,
int _number )

Definition at line 15261 of file _infrastructure.c.

◆ get_default_temporary_path()

char * get_default_temporary_path ( )

Definition at line 15156 of file _infrastructure.c.

◆ get_image_overwrite_size()

void get_image_overwrite_size ( Environment * _environment,
char * _image,
char * _x1,
char * _y1,
char * _x2,
char * _y2 )

Definition at line 15055 of file _infrastructure.c.

◆ get_temporary_filename()

char * get_temporary_filename ( Environment * _environment)

Definition at line 13672 of file _infrastructure.c.

◆ image_converter_asserts()

void image_converter_asserts ( Environment * _environment,
int _width,
int _height,
int _offset_x,
int _offset_y,
int * _frame_width,
int * _frame_height,
int _modulo_x,
int _modulo_y )

Definition at line 12722 of file _infrastructure.c.

◆ image_converter_asserts_free()

void image_converter_asserts_free ( Environment * _environment,
int _width,
int _height,
int _offset_x,
int _offset_y,
int * _frame_width,
int * _frame_height )

Definition at line 12762 of file _infrastructure.c.

◆ image_converter_asserts_free_height()

void image_converter_asserts_free_height ( Environment * _environment,
int _width,
int _height,
int _offset_x,
int _offset_y,
int * _frame_width,
int * _frame_height,
int _modulo_x )

Definition at line 12819 of file _infrastructure.c.

◆ image_converter_asserts_free_width()

void image_converter_asserts_free_width ( Environment * _environment,
int _width,
int _height,
int _offset_x,
int _offset_y,
int * _frame_width,
int * _frame_height,
int _modulo_y )

Definition at line 12783 of file _infrastructure.c.

◆ image_enlarge_bottom()

char * image_enlarge_bottom ( Environment * _environment,
char * _source,
int _width,
int _height,
int _delta )

Definition at line 13465 of file _infrastructure.c.

◆ image_enlarge_right()

char * image_enlarge_right ( Environment * _environment,
char * _source,
int _width,
int _height,
int _delta )

Definition at line 13436 of file _infrastructure.c.

◆ image_extract_subimage()

char * image_extract_subimage ( Environment * _environment,
char * _source,
int _width,
int _height,
int _frame_width,
int _frame_height,
int _x,
int _y,
int _depth )

Definition at line 13478 of file _infrastructure.c.

◆ image_flip_x()

char * image_flip_x ( Environment * _environment,
char * _source,
int _width,
int _height,
int _depth )

Definition at line 13205 of file _infrastructure.c.

◆ image_flip_y()

char * image_flip_y ( Environment * _environment,
char * _source,
int _width,
int _height,
int _depth )

Definition at line 13253 of file _infrastructure.c.

◆ image_roll_x_left()

char * image_roll_x_left ( Environment * _environment,
char * _source,
int _width,
int _height )

Definition at line 13346 of file _infrastructure.c.

◆ image_roll_x_right()

char * image_roll_x_right ( Environment * _environment,
char * _source,
int _width,
int _height )

Definition at line 13301 of file _infrastructure.c.

◆ image_roll_y_down()

char * image_roll_y_down ( Environment * _environment,
char * _source,
int _width,
int _height )

Definition at line 13391 of file _infrastructure.c.

◆ import_file_name()

char * import_file_name ( char * _import_path)

Definition at line 17204 of file _infrastructure.c.

◆ label_define_named()

void label_define_named ( Environment * _environment,
char * _label )

Definition at line 11739 of file _infrastructure.c.

◆ label_define_numeric()

void label_define_numeric ( Environment * _environment,
int _label )

Definition at line 11718 of file _infrastructure.c.

◆ label_exists_named()

int label_exists_named ( Environment * _environment,
char * _label )

Definition at line 11705 of file _infrastructure.c.

◆ label_exists_numeric()

int label_exists_numeric ( Environment * _environment,
int _label )

Definition at line 11692 of file _infrastructure.c.

◆ label_referred_define_named()

void label_referred_define_named ( Environment * _environment,
char * _label )

Definition at line 11807 of file _infrastructure.c.

◆ label_referred_define_numeric()

void label_referred_define_numeric ( Environment * _environment,
int _label )

Definition at line 11786 of file _infrastructure.c.

◆ label_referred_exists_named()

int label_referred_exists_named ( Environment * _environment,
char * _label )

Definition at line 11773 of file _infrastructure.c.

◆ label_referred_exists_numeric()

int label_referred_exists_numeric ( Environment * _environment,
int _label )

Definition at line 11760 of file _infrastructure.c.

◆ label_stored_define_named()

void label_stored_define_named ( Environment * _environment,
char * _label )

Definition at line 11841 of file _infrastructure.c.

◆ label_stored_exists_named()

int label_stored_exists_named ( Environment * _environment,
char * _label )

Definition at line 11828 of file _infrastructure.c.

◆ malloc_palette()

RGBi * malloc_palette ( int _size)

Allocate a palette space.

Parameters
_sizeSize of palette, in entries
Returns
RGBi* Memory storage for the palette

Definition at line 13962 of file _infrastructure.c.

◆ max_of_three()

float max_of_three ( float _m,
float _n,
float _p )

Definition at line 13660 of file _infrastructure.c.

◆ max_of_two()

float max_of_two ( float _x,
float _y )

Definition at line 13656 of file _infrastructure.c.

◆ memory_area_assign()

void memory_area_assign ( MemoryArea * _first,
Variable * _variable )

Definition at line 189 of file _infrastructure.c.

◆ memory_area_unassign()

void memory_area_unassign ( MemoryArea * _first,
Variable * _variable )

Definition at line 225 of file _infrastructure.c.

◆ min_of_three()

float min_of_three ( float _m,
float _n,
float _p )

Definition at line 13668 of file _infrastructure.c.

◆ min_of_two()

float min_of_two ( float _x,
float _y )

Definition at line 13664 of file _infrastructure.c.

◆ offsetting_add_variable_reference()

void offsetting_add_variable_reference ( Environment * _environment,
Offsetting * _first,
Variable * _var,
int _sequence )

Definition at line 455 of file _infrastructure.c.

◆ offsetting_size_count()

Offsetting * offsetting_size_count ( Environment * _environment,
int _size,
int _count )

Definition at line 397 of file _infrastructure.c.

◆ origin_resolution_relative_transform_x()

Variable * origin_resolution_relative_transform_x ( Environment * _environment,
char * _x,
int _is_relative )

Definition at line 14332 of file _infrastructure.c.

◆ origin_resolution_relative_transform_y()

Variable * origin_resolution_relative_transform_y ( Environment * _environment,
char * _y,
int _is_relative )

Definition at line 14401 of file _infrastructure.c.

◆ palette_match()

RGBi * palette_match ( RGBi * _source,
int _source_size,
RGBi * _system,
int _system_size )

Make a "palette match".

Parameters
_sourceSource palette to match
_source_sizeSize of the source palette
_systemSystem palette to use as reference
_system_sizeSize of the reference palette
Returns
RGBi* Matched palette

Definition at line 13981 of file _infrastructure.c.

◆ palette_match_hardware_index()

RGBi * palette_match_hardware_index ( RGBi * _source,
int _source_size,
RGBi * _system,
int _system_size )

Definition at line 14015 of file _infrastructure.c.

◆ palette_merge()

RGBi * palette_merge ( RGBi * _palette1,
int _palette1_size,
RGBi * _palette2,
int _palette2_size,
int * _size )

Make a "palette merge".

Parameters
_palette1First palette to merge
_palette1_sizeSize of the first palette to merge
_palette2Second palette to merge
_palette2_sizeSize of the second palette to merge
_sizeSize of the merged palette
Returns
RGBi* Merged palettes

Definition at line 14216 of file _infrastructure.c.

◆ palette_promote_color_as_background()

RGBi * palette_promote_color_as_background ( int _index,
RGBi * _source,
int _source_size )

Promote an index color in a palette.

Parameters
_indexSource palette index
_sourceSource palette to check
_source_sizeSize of the source palette
_unique_sizeSize of the unique palette
Returns
RGBi* Palette without duplications

Definition at line 14105 of file _infrastructure.c.

◆ palette_promote_color_as_foreground()

RGBi * palette_promote_color_as_foreground ( int _index,
RGBi * _source,
int _source_size,
int _max_size )

Promote an index color in a palette.

Parameters
_indexSource palette index
_sourceSource palette to check
_source_sizeSize of the source palette
_unique_sizeSize of the unique palette
Returns
RGBi* Palette without duplications

Definition at line 14141 of file _infrastructure.c.

◆ palette_remove_duplicates()

RGBi * palette_remove_duplicates ( RGBi * _source,
int _source_size,
int * _unique_size )

Remove duplicates from a palette.

Parameters
_sourceSource palette to check
_source_sizeSize of the source palette
_unique_sizeSize of the unique palette
Returns
RGBi* Palette without duplications

Definition at line 14052 of file _infrastructure.c.

◆ palette_shift()

RGBi * palette_shift ( RGBi * _source,
int _source_size,
int _offset )

Shift colors in palette.

Parameters
_sourceSource palette to shift
_source_sizeSize of the source palette
_offsetOffset to shift (> 0 to right, < 0 to left)
Returns
RGBi* Shifted palette

Definition at line 14183 of file _infrastructure.c.

◆ parse_buffer()

char * parse_buffer ( Environment * _environment,
char * _buffer,
int * _size,
int _hex_only )

Definition at line 13168 of file _infrastructure.c.

◆ parse_buffer_definition()

Variable * parse_buffer_definition ( Environment * _environment,
char * _buffer,
VariableType _type,
int _hex_only )

Definition at line 13194 of file _infrastructure.c.

◆ parser_adapted_numeric()

Variable * parser_adapted_numeric ( Environment * _environment,
int _number )

Definition at line 14874 of file _infrastructure.c.

◆ parser_array_cleanup()

void parser_array_cleanup ( Environment * _environment)

Definition at line 14785 of file _infrastructure.c.

◆ parser_array_index_numeric()

void parser_array_index_numeric ( Environment * _environment,
int _index )

Definition at line 14799 of file _infrastructure.c.

◆ parser_array_index_symbolic()

void parser_array_index_symbolic ( Environment * _environment,
char * _index )

Definition at line 14791 of file _infrastructure.c.

◆ parser_array_init()

void parser_array_init ( Environment * _environment)

Definition at line 14767 of file _infrastructure.c.

◆ parser_array_init_by()

void parser_array_init_by ( Environment * _environment,
ArrayReference * _array_reference )

Definition at line 14776 of file _infrastructure.c.

◆ parser_array_retrieve()

ArrayReference * parser_array_retrieve ( Environment * _environment)

Definition at line 14755 of file _infrastructure.c.

◆ parser_casted_numeric()

Variable * parser_casted_numeric ( Environment * _environment,
VariableType _type,
int _number )

Definition at line 14889 of file _infrastructure.c.

◆ pattern_match()

int pattern_match ( char * _pattern,
char * _value )

Definition at line 11100 of file _infrastructure.c.

◆ precalculate_tile_descriptors_for_font()

TileDescriptors * precalculate_tile_descriptors_for_font ( char * _fontData,
int _fontSize )

Definition at line 13073 of file _infrastructure.c.

◆ prepare_variable_storage()

void prepare_variable_storage ( Environment * _environment,
char * _name,
Variable * _source )

Definition at line 15218 of file _infrastructure.c.

◆ procedure_exists()

int procedure_exists ( Environment * _environment,
char * _name )

Definition at line 15841 of file _infrastructure.c.

◆ reset_screen_mode_selected()

int reset_screen_mode_selected ( Environment * _environment)

Definition at line 11487 of file _infrastructure.c.

◆ resolve_color()

char * resolve_color ( Environment * _environment,
char * _color )

Definition at line 15426 of file _infrastructure.c.

◆ resource_load_asserts()

char * resource_load_asserts ( Environment * _environment,
char * _filename )

Definition at line 12847 of file _infrastructure.c.

◆ rgbi_distance()

int rgbi_distance ( RGBi * _e1,
RGBi * _e2 )

Calculate the distance between two colors.

This function calculates the color distance between two colors(_a and _b). By "distance" we mean the geometric distance between two points in a three-dimensional space, where each dimension corresponds to one of the components (red, green and blue). The returned value is normalized to the nearest 8-bit value.

Parameters
_e1First color
_e2Second color
Returns
int distance

Definition at line 13523 of file _infrastructure.c.

◆ rgbi_equals_rgb()

int rgbi_equals_rgb ( RGBi * _first,
RGBi * _second )

Definition at line 13498 of file _infrastructure.c.

◆ rgbi_equals_rgba()

int rgbi_equals_rgba ( RGBi * _first,
RGBi * _second )

Definition at line 13502 of file _infrastructure.c.

◆ rgbi_extract_palette()

int rgbi_extract_palette ( Environment * _environment,
unsigned char * _source,
int _width,
int _height,
int _depth,
RGBi _palette[],
int _palette_size,
int _sorted )

Extract the color palette from the given image.

Parameters
_source
_palette
_palette_size
Returns
int

Definition at line 13566 of file _infrastructure.c.

◆ rgbi_move()

void rgbi_move ( RGBi * _source,
RGBi * _destination )

Definition at line 13506 of file _infrastructure.c.

◆ show_troubleshooting_and_exit()

int show_troubleshooting_and_exit ( Environment * _environment,
int _argc,
char * _argv[] )

Definition at line 15502 of file _infrastructure.c.

◆ static_string_create()

StaticString * static_string_create ( Environment * _environment,
char * _value,
int _size )

Definition at line 17258 of file _infrastructure.c.

◆ static_string_create_filled()

StaticString * static_string_create_filled ( Environment * _environment,
int _size,
char _value )

Definition at line 17238 of file _infrastructure.c.

◆ static_string_find_by_value()

StaticString * static_string_find_by_value ( Environment * _environment,
char * _value,
int _size )

Definition at line 17226 of file _infrastructure.c.

◆ strcopy()

char * strcopy ( char * _dest,
char * _source )

Definition at line 17121 of file _infrastructure.c.

◆ string_reserve()

StaticString * string_reserve ( Environment * _environment,
char * _value )

Definition at line 14727 of file _infrastructure.c.

◆ strreplace()

char * strreplace ( const char * _orig,
const char * _rep,
const char * _with )

Definition at line 17133 of file _infrastructure.c.

◆ strrstr()

const char * strrstr ( const char * haystack,
const char * needle )

Definition at line 15882 of file _infrastructure.c.

◆ strstrcase()

const char * strstrcase ( const char * _x,
const char * _y )

Definition at line 15857 of file _infrastructure.c.

◆ strtoupper()

char * strtoupper ( char * _string)

Definition at line 14299 of file _infrastructure.c.

◆ system_call()

int system_call ( Environment * _environment,
char * _commandline )

Call an external executable.

Parameters
_environmentEnviroment to call
_commandlineCommand line to execute
Returns
int 0 if success, != 0 if failed

Definition at line 13709 of file _infrastructure.c.

◆ system_move_safe()

int system_move_safe ( Environment * _environment,
char * _source,
char * _destination )

Definition at line 15800 of file _infrastructure.c.

◆ system_remove_safe()

int system_remove_safe ( Environment * _environment,
char * _filename )

Definition at line 13784 of file _infrastructure.c.

◆ tile_allocate()

int tile_allocate ( TileDescriptors * _tiles,
char * _data )

Definition at line 13152 of file _infrastructure.c.

◆ type_find()

Type * type_find ( Type * _first,
char * _name )

Definition at line 16129 of file _infrastructure.c.

◆ unescape_string()

char * unescape_string ( Environment * _environment,
char * _value,
int _printing,
int * _final_size )

Definition at line 1875 of file _infrastructure.c.

◆ variable_add()

Variable * variable_add ( Environment * _environment,
char * _source,
char * _destination )

Add two variable and return the sum of them.

This function allows you to sum the value of two variables. Note that both variables must pre-exist before the operation, under penalty of an exception.

Precondition
_source and _destination variables must exist
Parameters
_environmentCurrent calling environment
_sourceSource variable's name
_destinationDestination variable's name
Returns
Variable* The sum of source and destination variable
Exceptions
EXIT_FAILURE"Destination variable does not cast"
EXIT_FAILURE"Source variable does not exist"

Definition at line 4147 of file _infrastructure.c.

◆ variable_add_const()

Variable * variable_add_const ( Environment * _environment,
char * _source,
int _destination )

Add a variable with a constant, and return the sum of them.

This function allows you to sum the value of a variables and a constant. Note that variable must pre-exist before the operation, under penalty of an exception.

Precondition
_source variables must exist
Parameters
_environmentCurrent calling environment
_sourceSource variable's name
_destinationDestination value to use
Returns
Variable* The sum of source and destination variable
Exceptions
EXIT_FAILURE"Destination variable does not cast"
EXIT_FAILURE"Source variable does not exist"

Definition at line 3868 of file _infrastructure.c.

◆ variable_add_inplace()

void variable_add_inplace ( Environment * _environment,
char * _source,
int _destination )

Definition at line 4288 of file _infrastructure.c.

◆ variable_add_inplace_array()

void variable_add_inplace_array ( Environment * _environment,
char * _source,
char * _destination )

Add a variable to an array element, and return the sum of them on the array element.

Parameters
_environmentCurrent calling environment
_sourceSource variable's name and destination of sum
_destinationValue to sum

Definition at line 4483 of file _infrastructure.c.

◆ variable_add_inplace_mt()

void variable_add_inplace_mt ( Environment * _environment,
char * _source,
char * _destination )

Add two variable and return the sum of them on the first.

This function allows you to sum the value of two variables. Note that both variables must pre-exist before the operation, under penalty of an exception.

Precondition
_source and _destination variables must exist
Parameters
_environmentCurrent calling environment
_sourceSource variable's name and destination of sum
_destinationValue to sum
Exceptions
EXIT_FAILURE"Destination variable does not cast"
EXIT_FAILURE"Source variable does not exist"

Definition at line 4513 of file _infrastructure.c.

◆ variable_add_inplace_type()

void variable_add_inplace_type ( Environment * _environment,
char * _source,
char * _field,
int _destination )

Definition at line 4326 of file _infrastructure.c.

◆ variable_add_inplace_type_vars()

void variable_add_inplace_type_vars ( Environment * _environment,
char * _source,
char * _field,
char * _destination )

Definition at line 4443 of file _infrastructure.c.

◆ variable_add_inplace_vars()

void variable_add_inplace_vars ( Environment * _environment,
char * _source,
char * _destination )

Add two variable and return the sum of them on the first.

This function allows you to sum the value of two variables. Note that both variables must pre-exist before the operation, under penalty of an exception.

Precondition
_source and _destination variables must exist
Parameters
_environmentCurrent calling environment
_sourceSource variable's name and destination of sum
_destinationValue to sum
Exceptions
EXIT_FAILURE"Destination variable does not cast"
EXIT_FAILURE"Source variable does not exist"

Definition at line 4377 of file _infrastructure.c.

◆ variable_and()

Variable * variable_and ( Environment * _environment,
char * _left,
char * _right )

Calculate logical "and" and return it as the result.

This function allows you to emit code to make a logical AND between two expressions, and return the result as boolean.

Parameters
_environmentCurrent calling environment
_leftLeft expression to check
_rightRight expression to check
Returns
Variable* The result of operation

Definition at line 6816 of file _infrastructure.c.

◆ variable_and_const()

Variable * variable_and_const ( Environment * _environment,
char * _destination,
int _mask )

Calculate "and" mask for a variable and it as the result.

This function allows you to subdivide the value of a variable for two for various times. Note that variable must pre-exist before the operation, under penalty of an exception.

Precondition
_destination variables must exist
Parameters
_environmentCurrent calling environment
_destinationDestination variable's name
_maskAnd mask to apply
Returns
Variable* The result of operation
Exceptions
EXIT_FAILURE"Destination variable does not exist"

Definition at line 6781 of file _infrastructure.c.

◆ variable_array_count_vars()

Variable * variable_array_count_vars ( Environment * _environment,
char * _name,
char * _target )

Definition at line 12042 of file _infrastructure.c.

◆ variable_array_fill()

void variable_array_fill ( Environment * _environment,
char * _name,
int _value )

Definition at line 12423 of file _infrastructure.c.

◆ variable_array_fill_incremental()

void variable_array_fill_incremental ( Environment * _environment,
char * _name,
int _min,
int _count )

Definition at line 12563 of file _infrastructure.c.

◆ variable_array_fill_random()

void variable_array_fill_random ( Environment * _environment,
char * _name,
int _base,
int _min_value,
int _max_value,
int _count,
int _boolean )

Definition at line 12449 of file _infrastructure.c.

◆ variable_array_max_vars()

Variable * variable_array_max_vars ( Environment * _environment,
char * _name )

Definition at line 12230 of file _infrastructure.c.

◆ variable_array_min_vars()

Variable * variable_array_min_vars ( Environment * _environment,
char * _name )

Definition at line 12321 of file _infrastructure.c.

◆ variable_array_shuffle()

void variable_array_shuffle ( Environment * _environment,
char * _name,
int _rounds )

Definition at line 12637 of file _infrastructure.c.

◆ variable_array_sum_vars()

Variable * variable_array_sum_vars ( Environment * _environment,
char * _name )

Definition at line 12142 of file _infrastructure.c.

◆ variable_array_type()

Variable * variable_array_type ( Environment * _environment,
char * _name,
VariableType _type )

Definition at line 1138 of file _infrastructure.c.

◆ variable_bin()

Variable * variable_bin ( Environment * _environment,
char * _value,
char * _digits,
char * _zero,
char * _one )

Emit code for <string>BIN(...).

Emit the code to convert the given value in a binary string.

Parameters
_environmentCurrent calling environment
_valueValue to convert into string
_digitsNumber of digits to represent
Returns
Variable* String with the binary representation

Definition at line 11219 of file _infrastructure.c.

◆ variable_bit()

Variable * variable_bit ( Environment * _environment,
char * _value,
char * _position )

Emit code for HAS BIT / BIT(...).

Parameters
_environmentCurrent calling environment
_valueValue to check at bit level
_positionPosition to check at bit level
Returns
Variable* Bit value for that position

Definition at line 11461 of file _infrastructure.c.

◆ variable_by_constant()

Variable * variable_by_constant ( Environment * _environment,
VariableType _type,
int _value )

Definition at line 1848 of file _infrastructure.c.

◆ variable_cast()

Variable * variable_cast ( Environment * _environment,
char * _source,
VariableType _type )

Cast a variable from a type to another.

This function can be called to convert a variable from one type to another. The function takes care of both creating a temporary variable and copying the value into it, conveying it differently depending on the type. The variable must exist in order to work, otherwise an exception will be thrown.

Precondition
_source variable must exist
Parameters
_environmentCurrent calling environment
_sourceSource variable's name
_typeRequired type
Returns
Variable* A new temporary variable with the content converted to the required type
Exceptions
EXIT_FAILURE"Cannot find source var"

Definition at line 1636 of file _infrastructure.c.

◆ variable_compare()

Variable * variable_compare ( Environment * _environment,
char * _source,
char * _destination )

Compare two variable and return the result of comparation.

This function allows you to compare the value of two variables. Note that both variables must pre-exist before the operation, under penalty of an exception.

Precondition
_source and _destination variables must exist
Parameters
_environmentCurrent calling environment
_sourceSource variable's name
_destinationDestination variable's name
Returns
Variable* The product of source and destination variable
Exceptions
EXIT_FAILURE"Destination variable does not cast"
EXIT_FAILURE"Source variable does not exist"

Definition at line 5979 of file _infrastructure.c.

◆ variable_compare_and_branch_const()

void variable_compare_and_branch_const ( Environment * _environment,
char * _source,
int _destination,
char * _name,
int _positive )

Definition at line 5920 of file _infrastructure.c.

◆ variable_compare_const()

Variable * variable_compare_const ( Environment * _environment,
char * _source,
int _destination )

Compare two variable and return the result of comparation.

This function allows you to compare the value of two variables. Note that both variables must pre-exist before the operation, under penalty of an exception.

Precondition
_source and _destination variables must exist
Parameters
_environmentCurrent calling environment
_sourceSource variable's name
_destinationDestination variable's name
Returns
Variable* The product of source and destination variable
Exceptions
EXIT_FAILURE"Destination variable does not cast"
EXIT_FAILURE"Source variable does not exist"

Definition at line 6409 of file _infrastructure.c.

◆ variable_compare_not()

Variable * variable_compare_not ( Environment * _environment,
char * _source,
char * _destination )

Compare two variable and return the result of comparation.

This function allows you to compare the value of two variables. Note that both variables must pre-exist before the operation, under penalty of an exception.

Precondition
_source and _destination variables must exist
Parameters
_environmentCurrent calling environment
_sourceSource variable's name
_destinationDestination variable's name
Returns
Variable* The product of source and destination variable
Exceptions
EXIT_FAILURE"Destination variable does not cast"
EXIT_FAILURE"Source variable does not exist"

Definition at line 6489 of file _infrastructure.c.

◆ variable_compare_not_const()

Variable * variable_compare_not_const ( Environment * _environment,
char * _source,
int _destination )

Compare two variable and return the result of comparation.

This function allows you to compare the value of two variables. Note that both variables must pre-exist before the operation, under penalty of an exception.

Precondition
_source and _destination variables must exist
Parameters
_environmentCurrent calling environment
_sourceSource variable's name
_destinationDestination variable's name
Returns
Variable* The product of source and destination variable
Exceptions
EXIT_FAILURE"Destination variable does not cast"
EXIT_FAILURE"Source variable does not exist"

Definition at line 6449 of file _infrastructure.c.

◆ variable_complement_const()

Variable * variable_complement_const ( Environment * _environment,
char * _source,
int _value )

Calculate the complement of a variable.

This function allows you to calculate a complement of the value of one variable. Note that the variable must pre-exist before the operation, under penalty of an exception.

Precondition
_destination variables must exist
Parameters
_environmentCurrent calling environment
_destinationDestination variable's name
_valueValue to use for complement
Returns
Variable* The complement of _destination variable
Exceptions
EXIT_FAILURE"Destination variable does not exist"

Definition at line 5060 of file _infrastructure.c.

◆ variable_decrement()

void variable_decrement ( Environment * _environment,
char * _source )

Decrement a variable by one.

Parameters
_environmentCurrent calling environment
_sourceSource variable's name
Returns
Variable* The source variable

Definition at line 5814 of file _infrastructure.c.

◆ variable_decrement_array()

void variable_decrement_array ( Environment * _environment,
char * _source )

Definition at line 17117 of file _infrastructure.c.

◆ variable_decrement_array_type()

void variable_decrement_array_type ( Environment * _environment,
char * _source,
char * _field )

Definition at line 17109 of file _infrastructure.c.

◆ variable_decrement_mt()

void variable_decrement_mt ( Environment * _environment,
char * _source )

Decrement a variable by one.

Parameters
_environmentCurrent calling environment
_sourceSource variable's name
Returns
Variable* The source variable

Definition at line 5890 of file _infrastructure.c.

◆ variable_decrement_type()

void variable_decrement_type ( Environment * _environment,
char * _source,
char * _field )

Definition at line 5846 of file _infrastructure.c.

◆ variable_define()

Variable * variable_define ( Environment * _environment,
char * _name,
VariableType _type,
int _value )

Define a variable for the program.

This function is necessary to define a variable within the program. This call reserves a space compatible with the given variable type, and assigns it to the given name. The initial value of the variable is also passed.

Allowed types:

It is possible to call the function several times with the same variable name: a single memory space will always be reserved. If the type differs, an exception will be thrown. Note that the variable will be defined in the last bank defined by the BANK command as VARIABLES. In other words, it is possible to define different variables in different banks, thus optimizing the space occupied by the program.

Parameters
_environmentCurrent calling environment
_nameName of the variable to define
_typeType of the variable to define
_valueInital valure
Returns
Variable* The variable definition
Exceptions
EXIT_FAILURE"Variable redefined with a different type"

Definition at line 718 of file _infrastructure.c.

◆ variable_define_no_init()

Variable * variable_define_no_init ( Environment * _environment,
char * _name,
VariableType _type )

Definition at line 912 of file _infrastructure.c.

◆ variable_delete()

int variable_delete ( Environment * _environment,
char * _name )

Definition at line 1006 of file _infrastructure.c.

◆ variable_direct_assign()

Variable * variable_direct_assign ( Environment * _environment,
char * _var,
char * _expr )

Definition at line 14639 of file _infrastructure.c.

◆ variable_div()

Variable * variable_div ( Environment * _environment,
char * _source,
char * _destination,
char * _remainder )

Make a division between two variable and return the product of them.

Parameters
_environmentCurrent calling environment
_sourceSource variable's name
_destinationDestination variable's name
Returns
Variable* The quotient of source and destination variable

Definition at line 5238 of file _infrastructure.c.

◆ variable_div2_const()

Variable * variable_div2_const ( Environment * _environment,
char * _destination,
int _bits,
char * _remainder )

Subdivide by two a variable for various times and return the result.

This function allows you to subdivide the value of a variable for two for various times. Note that variable must pre-exist before the operation, under penalty of an exception.

Precondition
_destination variables must exist
Parameters
_environmentCurrent calling environment
_destinationDestination variable's name
_bitsTimes to subdivide
Returns
Variable* The result of operation
Exceptions
EXIT_FAILURE"Destination variable does not exist"

Definition at line 6608 of file _infrastructure.c.

◆ variable_div_const()

Variable * variable_div_const ( Environment * _environment,
char * _source,
int _destination,
char * _remainder )

Definition at line 5385 of file _infrastructure.c.

◆ variable_exists()

int variable_exists ( Environment * _environment,
char * _name )

Definition at line 994 of file _infrastructure.c.

◆ variable_exists_by_realname()

int variable_exists_by_realname ( Environment * _environment,
char * _name )

Definition at line 1000 of file _infrastructure.c.

◆ variable_export()

Variable * variable_export ( Environment * _environment,
char * _name,
VariableType _type,
int _size_or_value )

Definition at line 849 of file _infrastructure.c.

◆ variable_flip()

Variable * variable_flip ( Environment * _environment,
char * _variable )

Definition at line 9746 of file _infrastructure.c.

◆ variable_global()

void variable_global ( Environment * _environment,
char * _pattern )

Definition at line 467 of file _infrastructure.c.

◆ variable_greater_than()

Variable * variable_greater_than ( Environment * _environment,
char * _source,
char * _destination,
int _equal )

Compare two variable and return the result of comparation.

This function allows you to compare the value of two variables. Note that both variables must pre-exist before the operation, under penalty of an exception.

Precondition
_source and _destination variables must exist
Parameters
_environmentCurrent calling environment
_sourceSource variable's name
_destinationDestination variable's name
_equalTrue if equal
Returns
Variable* The product of source and destination variable
Exceptions
EXIT_FAILURE"Destination variable does not cast"
EXIT_FAILURE"Source variable does not exist"

Definition at line 7580 of file _infrastructure.c.

◆ variable_greater_than_const()

Variable * variable_greater_than_const ( Environment * _environment,
char * _source,
int _destination,
int _equal )

Definition at line 7917 of file _infrastructure.c.

◆ variable_hex()

Variable * variable_hex ( Environment * _environment,
char * _value,
int _separator )

Emit code for = HEX( ... ).

Parameters
_environmentCurrent calling environment
_valueNumber to convert to hexadecimal
Returns
Variable* Result of conversion

Definition at line 9303 of file _infrastructure.c.

◆ variable_hex2bin()

Variable * variable_hex2bin ( Environment * _environment,
char * _value,
char * _variable )

Emit code for = HEX2BIN( ... ).

Parameters
_environmentCurrent calling environment
_valueNumber to convert to hexadecimal
Returns
Variable* Result of conversion

Definition at line 9393 of file _infrastructure.c.

◆ variable_import()

Variable * variable_import ( Environment * _environment,
char * _name,
VariableType _type,
int _size_or_value )

Definition at line 778 of file _infrastructure.c.

◆ variable_increment()

void variable_increment ( Environment * _environment,
char * _source )

Increment a variable by one.

Parameters
_environmentCurrent calling environment
_sourceSource variable's name
Returns
Variable* The source variable

Definition at line 5494 of file _infrastructure.c.

◆ variable_increment_array()

void variable_increment_array ( Environment * _environment,
char * _source )

Definition at line 17113 of file _infrastructure.c.

◆ variable_increment_array_type()

void variable_increment_array_type ( Environment * _environment,
char * _source,
char * _field )

Definition at line 17105 of file _infrastructure.c.

◆ variable_increment_mt()

void variable_increment_mt ( Environment * _environment,
char * _source )

Increment a variable by one.

Parameters
_environmentCurrent calling environment
_sourceSource variable's name
Returns
Variable* The source variable

Definition at line 5740 of file _infrastructure.c.

◆ variable_increment_type()

void variable_increment_type ( Environment * _environment,
char * _source,
char * _field )

Definition at line 5524 of file _infrastructure.c.

◆ variable_int()

Variable * variable_int ( Environment * _environment,
char * _expression )

Definition at line 15145 of file _infrastructure.c.

◆ variable_less_than()

Variable * variable_less_than ( Environment * _environment,
char * _source,
char * _destination,
int _equal )

Compare two variable and return the result of comparation.

This function allows you to compare the value of two variables. Note that both variables must pre-exist before the operation, under penalty of an exception.

Precondition
_source and _destination variables must exist
Parameters
_environmentCurrent calling environment
_sourceSource variable's name
_destinationDestination variable's name
_equalTrue if equal
Returns
Variable* The product of source and destination variable
Exceptions
EXIT_FAILURE"Destination variable does not cast"
EXIT_FAILURE"Source variable does not exist"

Definition at line 7225 of file _infrastructure.c.

◆ variable_less_than_const()

Variable * variable_less_than_const ( Environment * _environment,
char * _source,
int _destination,
int _equal )

Definition at line 7533 of file _infrastructure.c.

◆ variable_mod()

Variable * variable_mod ( Environment * _environment,
char * _source,
char * _destination )

Definition at line 11646 of file _infrastructure.c.

◆ variable_move()

Variable * variable_move ( Environment * _environment,
char * _source,
char * _destination )

Store the value of a variable inside another variable by converting it.

This function allows you to store the value of one variable in another, making it (implicitly) cast (type conversion). Note that both variables must pre-exist before the operation, under penalty of an exception.

Precondition
_source and _dest variables must exist
Parameters
_environmentCurrent calling environment
_sourceDestination variable's name
_destinationDestination variable's name
Returns
Variable* The destination variable
Exceptions
EXIT_FAILURE"Destination variable does not exist"
EXIT_FAILURE"Source variable does not cast"

Definition at line 3089 of file _infrastructure.c.

◆ variable_move_array()

void variable_move_array ( Environment * _environment,
char * _array,
char * _value )

Definition at line 10527 of file _infrastructure.c.

◆ variable_move_array1_type()

void variable_move_array1_type ( Environment * _environment,
char * _array,
char * _index,
char * _field,
char * _value )

Definition at line 16687 of file _infrastructure.c.

◆ variable_move_array1_type_const()

void variable_move_array1_type_const ( Environment * _environment,
char * _array,
char * _index,
char * _field,
int _value )

Definition at line 16914 of file _infrastructure.c.

◆ variable_move_array1_type_fields()

void variable_move_array1_type_fields ( Environment * _environment,
char * _array,
char * _index,
char * _field1,
char * _field2 )

Definition at line 16796 of file _infrastructure.c.

◆ variable_move_array_bit()

void variable_move_array_bit ( Environment * _environment,
Variable * _array,
char * _value )

Definition at line 10269 of file _infrastructure.c.

◆ variable_move_array_byte()

void variable_move_array_byte ( Environment * _environment,
Variable * _array,
char * _value )

Definition at line 10291 of file _infrastructure.c.

◆ variable_move_array_string()

void variable_move_array_string ( Environment * _environment,
char * _array,
char * _string )

Definition at line 10551 of file _infrastructure.c.

◆ variable_move_array_type()

void variable_move_array_type ( Environment * _environment,
char * _array,
char * _field,
char * _value )

Definition at line 16288 of file _infrastructure.c.

◆ variable_move_from_array()

Variable * variable_move_from_array ( Environment * _environment,
char * _array )

Definition at line 11077 of file _infrastructure.c.

◆ variable_move_from_array1_type()

Variable * variable_move_from_array1_type ( Environment * _environment,
char * _array,
char * _index,
char * _field )

Definition at line 16655 of file _infrastructure.c.

◆ variable_move_from_array1_type_inplace()

void variable_move_from_array1_type_inplace ( Environment * _environment,
char * _array,
char * _index,
char * _field,
char * _value )

Definition at line 16546 of file _infrastructure.c.

◆ variable_move_from_array_bit()

Variable * variable_move_from_array_bit ( Environment * _environment,
Variable * _array )

Definition at line 10635 of file _infrastructure.c.

◆ variable_move_from_array_bit_inplace()

Variable * variable_move_from_array_bit_inplace ( Environment * _environment,
Variable * _array,
Variable * _result )

Definition at line 10606 of file _infrastructure.c.

◆ variable_move_from_array_byte()

Variable * variable_move_from_array_byte ( Environment * _environment,
Variable * _array )

Definition at line 11046 of file _infrastructure.c.

◆ variable_move_from_array_byte_inplace()

void variable_move_from_array_byte_inplace ( Environment * _environment,
Variable * _array,
Variable * _result )

Definition at line 10645 of file _infrastructure.c.

◆ variable_move_from_array_inplace()

void variable_move_from_array_inplace ( Environment * _environment,
char * _array,
char * _result )

Definition at line 11056 of file _infrastructure.c.

◆ variable_move_from_array_type()

Variable * variable_move_from_array_type ( Environment * _environment,
char * _array,
char * _field )

Definition at line 16406 of file _infrastructure.c.

◆ variable_move_from_array_type_inplace()

void variable_move_from_array_type_inplace ( Environment * _environment,
char * _array,
char * _field,
char * _value )

Definition at line 16438 of file _infrastructure.c.

◆ variable_move_from_mt()

Variable * variable_move_from_mt ( Environment * _environment,
char * _source,
char * _destination )

Increment a variable by one.

Parameters
_environmentCurrent calling environment
_sourceSource variable's name
Returns
Variable* The source variable

Definition at line 5696 of file _infrastructure.c.

◆ variable_move_from_type()

Variable * variable_move_from_type ( Environment * _environment,
char * _type,
char * _field )

Definition at line 16177 of file _infrastructure.c.

◆ variable_move_from_type_inplace()

void variable_move_from_type_inplace ( Environment * _environment,
char * _type,
char * _field,
char * _value )

Definition at line 16196 of file _infrastructure.c.

◆ variable_move_naked()

Variable * variable_move_naked ( Environment * _environment,
char * _source,
char * _destination )

Store the value of a variable inside another variable without conversion.

This function allows you to store the value of one variable in another, without cast (type conversion). Note that both variables must pre-exist before the operation, under penalty of an exception.

Precondition
_source and _dest variables must exist
Parameters
_environmentCurrent calling environment
_sourceDestination variable's name
_destinationDestination variable's name
Returns
Variable* The destination variable
Exceptions
EXIT_FAILURE"Destination variable does not exist"
EXIT_FAILURE"Source variable does not exist"

Definition at line 3922 of file _infrastructure.c.

◆ variable_move_to_mt()

Variable * variable_move_to_mt ( Environment * _environment,
char * _source,
char * _destination )

Definition at line 5716 of file _infrastructure.c.

◆ variable_move_type()

void variable_move_type ( Environment * _environment,
char * _type,
char * _field,
char * _value )

Definition at line 16243 of file _infrastructure.c.

◆ variable_mul()

Variable * variable_mul ( Environment * _environment,
char * _source,
char * _destination )

Make a multiplication between two variable and return the product of them.

This function allows you to multiplicate the value of two variables. Note that both variables must pre-exist before the operation, under penalty of an exception.

Precondition
_source and _destination variables must exist
Parameters
_environmentCurrent calling environment
_sourceSource variable's name
_destinationDestination variable's name
Returns
Variable* The product of source and destination variable
Exceptions
EXIT_FAILURE"Destination variable does not cast"
EXIT_FAILURE"Source variable does not exist"

Definition at line 5097 of file _infrastructure.c.

◆ variable_mul2_const()

Variable * variable_mul2_const ( Environment * _environment,
char * _destination,
int _steps )

Double a variable for various times and return the result.

This function allows you to double the value of a variable for various times. Note that variable must pre-exist before the operation, under penalty of an exception.

Precondition
_destination variables must exist
Parameters
_environmentCurrent calling environment
_destinationDestination variable's name
Returns
Variable* The result of operation
Exceptions
EXIT_FAILURE"Destination variable does not exist"

Definition at line 6508 of file _infrastructure.c.

◆ variable_not()

Variable * variable_not ( Environment * _environment,
char * _value )

Calculate logical "not" and return it as the result.

This function allows you to emit code to make a logical OR between two expressions, and return the result as boolean.

Parameters
_environmentCurrent calling environment
_valueLeft expression to check
Returns
Variable* The result of operation

Definition at line 7183 of file _infrastructure.c.

◆ variable_or()

Variable * variable_or ( Environment * _environment,
char * _left,
char * _right )

Calculate logical "or" and return it as the result.

This function allows you to emit code to make a logical OR between two expressions, and return the result as boolean.

Parameters
_environmentCurrent calling environment
_leftLeft expression to check
_rightRight expression to check
Returns
Variable* The result of operation

Definition at line 7070 of file _infrastructure.c.

◆ variable_reset()

void variable_reset ( Environment * _environment)

Reset the usage flags for the temporary variable pool.

This function allows you to reset the use flag of each temporary variable in the pool. The purpose of this function is to allow the reuse of variables.

Parameters
_environmentCurrent calling environment

Definition at line 1128 of file _infrastructure.c.

◆ variable_resident()

Variable * variable_resident ( Environment * _environment,
VariableType _type,
char * _meaning )

Definition at line 1518 of file _infrastructure.c.

◆ variable_resize_buffer()

Variable * variable_resize_buffer ( Environment * _environment,
char * _destination,
int _size )

Resize the (static) size of a buffer.

Parameters
_environmentCurrent calling environment
_destinationDestination variable's name
_sizeSize of the buffer, in bytes
Returns
Variable* The destination variable

Definition at line 2162 of file _infrastructure.c.

◆ variable_retrieve()

Variable * variable_retrieve ( Environment * _environment,
char * _name )

Definition at line 988 of file _infrastructure.c.

◆ variable_retrieve_by_realname()

Variable * variable_retrieve_by_realname ( Environment * _environment,
char * _name )

Definition at line 967 of file _infrastructure.c.

◆ variable_retrieve_internal()

Variable * variable_retrieve_internal ( Environment * _environment,
char * _name,
int _mandatory )

Retrieve the definition of a variable.

This function allows you to retrieve the definition of an actual or temporary variable, searching for it by name. Where the variable does not exist, a NULL will be returned. Otherwise, a pointer to the structure with the variable definition.

Parameters
_environmentCurrent calling environment
_nameName of the variable to look for.
Returns
Variable* Definition of the variable (if it exists) or NULL.

Definition at line 521 of file _infrastructure.c.

◆ variable_retrieve_or_define()

Variable * variable_retrieve_or_define ( Environment * _environment,
char * _name,
VariableType _type,
int _value )

Definition at line 1040 of file _infrastructure.c.

◆ variable_set_type()

void variable_set_type ( Environment * _environment,
char * _name,
char * _type )

Definition at line 16159 of file _infrastructure.c.

◆ variable_sl_const()

Variable * variable_sl_const ( Environment * _environment,
char * _destination,
int _steps )

Definition at line 6553 of file _infrastructure.c.

◆ variable_sr_const()

Variable * variable_sr_const ( Environment * _environment,
char * _destination,
int _bits )

Definition at line 6647 of file _infrastructure.c.

◆ variable_store()

Variable * variable_store ( Environment * _environment,
char * _destination,
unsigned int _value )

Store a direct value to a variable.

This function outputs code to initialize a variable to a specific direct value. The variable must exist in order to work, otherwise an exception will be thrown.

Precondition
_destination variable must exist
Parameters
_environmentCurrent calling environment
_destinationDestination variable's name
_valueValue to assign
Returns
Variable* The destination variable
Exceptions
EXIT_FAILURE"Destination variable does not exists"

Definition at line 1720 of file _infrastructure.c.

◆ variable_store_array()

Variable * variable_store_array ( Environment * _environment,
char * _destination,
unsigned char * _buffer,
int _size,
int _at )

Definition at line 2224 of file _infrastructure.c.

◆ variable_store_array_const()

void variable_store_array_const ( Environment * _environment,
char * _array,
int _value )

Definition at line 10245 of file _infrastructure.c.

◆ variable_store_array_const_bit()

void variable_store_array_const_bit ( Environment * _environment,
Variable * _array,
int _value )

Definition at line 10111 of file _infrastructure.c.

◆ variable_store_array_const_byte()

void variable_store_array_const_byte ( Environment * _environment,
Variable * _array,
int _value )

Definition at line 10134 of file _infrastructure.c.

◆ variable_store_buffer()

Variable * variable_store_buffer ( Environment * _environment,
char * _destination,
unsigned char * _buffer,
int _size,
int _at )

Definition at line 2175 of file _infrastructure.c.

◆ variable_store_float()

Variable * variable_store_float ( Environment * _environment,
char * _destination,
double _value )

Store a string to a variable.

Parameters
_environmentCurrent calling environment
_destinationDestination variable's name
_valueValue to assign
Returns
Variable* The destination variable

Definition at line 2038 of file _infrastructure.c.

◆ variable_store_mt()

void variable_store_mt ( Environment * _environment,
char * _source,
unsigned int _value )

Store a variable's value.

Parameters
_environmentCurrent calling environment
_sourceSource variable's name
Returns
Variable* The source variable

Definition at line 5675 of file _infrastructure.c.

◆ variable_store_string()

Variable * variable_store_string ( Environment * _environment,
char * _destination,
char * _value )

Store a string to a variable.

Parameters
_environmentCurrent calling environment
_destinationDestination variable's name
_valueValue to assign
Returns
Variable* The destination variable

Definition at line 1995 of file _infrastructure.c.

◆ variable_store_type()

Variable * variable_store_type ( Environment * _environment,
char * _destination,
char * _field,
unsigned int _value )

Definition at line 1808 of file _infrastructure.c.

◆ variable_string_asc()

Variable * variable_string_asc ( Environment * _environment,
char * _char )

Emit code for = ASC( ... ).

Parameters
_environmentCurrent calling environment
_charString to convert to ascii
Returns
Variable* Result of conversion

Definition at line 9927 of file _infrastructure.c.

◆ variable_string_chr()

Variable * variable_string_chr ( Environment * _environment,
char * _ascii )

Emit code for = CHR( ... ).

Parameters
_environmentCurrent calling environment
_asciiASCII value to convert to string
Returns
Variable* Result of conversion

Definition at line 9822 of file _infrastructure.c.

◆ variable_string_dup()

Variable * variable_string_dup ( Environment * _environment,
char * _string,
char * _repetitions )

Definition at line 9578 of file _infrastructure.c.

◆ variable_string_flip()

Variable * variable_string_flip ( Environment * _environment,
char * _string )

Emit code for = FLIP( ... ).

Parameters
_environmentCurrent calling environment
_stringString to flip
Returns
Variable* Result of flip

Definition at line 9710 of file _infrastructure.c.

◆ variable_string_insert()

Variable * variable_string_insert ( Environment * _environment,
char * _string,
char * _altstring,
char * _pos )

Definition at line 15281 of file _infrastructure.c.

◆ variable_string_inst()

Variable * variable_string_inst ( Environment * _environment,
char * _string,
char * _altstring,
char * _pos )

Definition at line 15357 of file _infrastructure.c.

◆ variable_string_instr()

Variable * variable_string_instr ( Environment * _environment,
char * _search,
char * _searched,
char * _start )

Emit code for = INSTR( ..., ... [, ...] ).

Parameters
_environmentCurrent calling environment
_searchString to be searched
_searchedString to search
_startStarting position to start to search
Returns
Variable* Result of text search

Definition at line 8795 of file _infrastructure.c.

◆ variable_string_left()

Variable * variable_string_left ( Environment * _environment,
char * _string,
char * _position )

Emit code for = LEFT( ..., ... ).

Parameters
_environmentCurrent calling environment
_stringString to extract text from
_positionPosition to start from
Returns
Variable* Result of text extraction

Definition at line 7994 of file _infrastructure.c.

◆ variable_string_left_assign()

void variable_string_left_assign ( Environment * _environment,
char * _string,
char * _position,
char * _expression )

Emit code for LEFT( ..., ... ) = ....

Parameters
_environmentCurrent calling environment
_stringString to extract text from
_positionPosition to start from
Returns
Variable* Result of text extraction

Definition at line 8085 of file _infrastructure.c.

◆ variable_string_len()

Variable * variable_string_len ( Environment * _environment,
char * _string )

Emit code for = LEN( ... ).

Parameters
_environmentCurrent calling environment
_stringString to examinate
Returns
Variable* Result of length measurement

Definition at line 10007 of file _infrastructure.c.

◆ variable_string_lower()

Variable * variable_string_lower ( Environment * _environment,
char * _string )

Emit code for = UPPER( ... ).

Parameters
_environmentCurrent calling environment
_stringString to convert in lower case
Returns
Variable* Result of case conversion

Definition at line 8944 of file _infrastructure.c.

◆ variable_string_mid()

Variable * variable_string_mid ( Environment * _environment,
char * _string,
char * _position,
char * _len )

Emit code for = MID( ..., ... [, ...] ).

Parameters
_environmentCurrent calling environment
_stringString to extract text from
_positionPosition to start from
_lenLength to extract
Returns
Variable* Result of text extraction

Definition at line 8397 of file _infrastructure.c.

◆ variable_string_mid_assign()

void variable_string_mid_assign ( Environment * _environment,
char * _string,
char * _position,
char * _len,
char * _expression )

Emit code for MID( ..., ... [, ...] ) = ....

Parameters
_environmentCurrent calling environment
_stringString to extract text from
_positionPosition to start from
_lenLength to extract
Returns
Variable* Result of text extraction

Definition at line 8657 of file _infrastructure.c.

◆ variable_string_pick()

Variable * variable_string_pick ( Environment * _environment,
char * _string,
int _position )

Definition at line 15401 of file _infrastructure.c.

◆ variable_string_right()

Variable * variable_string_right ( Environment * _environment,
char * _string,
char * _position )

Emit code for = LEFT( ..., ... ).

Parameters
_environmentCurrent calling environment
_stringString to extract text from
_positionPosition to start from
Returns
Variable* Result of text extraction

Definition at line 8201 of file _infrastructure.c.

◆ variable_string_right_assign()

void variable_string_right_assign ( Environment * _environment,
char * _string,
char * _position,
char * _expression )

Emit code for RIGHT( ..., ... ) = ....

Parameters
_environmentCurrent calling environment
_stringString to extract text from
_positionPosition to start from
Returns
Variable* Result of text extraction

Definition at line 8307 of file _infrastructure.c.

◆ variable_string_space()

Variable * variable_string_space ( Environment * _environment,
char * _repetitions )

Emit code for = SPACE( ... ).

Parameters
_environmentCurrent calling environment
_repetitionsNumber of spaces to produce in output string
Returns
Variable* Result of production

Definition at line 9669 of file _infrastructure.c.

◆ variable_string_str()

Variable * variable_string_str ( Environment * _environment,
char * _value )

Emit code for = STR( ... ).

Parameters
_environmentCurrent calling environment
_valueNumber to convert to string
Returns
Variable* Result of conversion

Definition at line 9104 of file _infrastructure.c.

◆ variable_string_string()

Variable * variable_string_string ( Environment * _environment,
char * _string,
char * _repetitions )

Emit code for = STRING( ..., ... ).

Parameters
_environmentCurrent calling environment
_stringString to use as base (the first letter)
_repetitionsNumber of repetition of output string
Returns
Variable* Result of production

Definition at line 9495 of file _infrastructure.c.

◆ variable_string_substring()

Variable * variable_string_substring ( Environment * _environment,
char * _string,
char * _start,
char * _end )

Emit code for = SUBSTRING( ..., ... [, ...] ).

Parameters
_environmentCurrent calling environment
_stringString to extract text from
_startPosition to start from
_endLength to end to
Returns
Variable* Result of text extraction

Definition at line 8566 of file _infrastructure.c.

◆ variable_string_upper()

Variable * variable_string_upper ( Environment * _environment,
char * _string )

Emit code for = UPPER( ... ).

Parameters
_environmentCurrent calling environment
_stringString to convert in uppercase
Returns
Variable* Result of case conversion

Definition at line 9039 of file _infrastructure.c.

◆ variable_string_val()

Variable * variable_string_val ( Environment * _environment,
char * _value )

Emit code for = VAL( ... ).

Parameters
_environmentCurrent calling environment
_valueString to convert to number
Returns
Variable* Result of conversion

Definition at line 9201 of file _infrastructure.c.

◆ variable_sub()

Variable * variable_sub ( Environment * _environment,
char * _source,
char * _dest )

Make a differenze between two variable and return the difference of them.

This function allows you to difference the value of two variables. Note that both variables must pre-exist before the operation, under penalty of an exception.

Precondition
_source and _destination variables must exist
Parameters
_environmentCurrent calling environment
_sourceSource variable's name
_destinationDestination variable's name
Returns
Variable* The sum of source and destination variable
Exceptions
EXIT_FAILURE"Destination variable does not cast"
EXIT_FAILURE"Source variable does not exist"

Definition at line 4660 of file _infrastructure.c.

◆ variable_sub_const()

Variable * variable_sub_const ( Environment * _environment,
char * _source,
int _destination )

Make a differenze between a variable a constant, and return the difference of them.

This function allows you to difference the value of a variable and a constant. Note that both variable must pre-exist before the operation, under penalty of an exception.

Precondition
_source variable must exist
Parameters
_environmentCurrent calling environment
_sourceSource variable's name
_destinationValue to subtract
Returns
Variable* The difference of source and destination variable
Exceptions
EXIT_FAILURE"Destination variable does not cast"
EXIT_FAILURE"Source variable does not exist"

Definition at line 4786 of file _infrastructure.c.

◆ variable_sub_inplace()

void variable_sub_inplace ( Environment * _environment,
char * _source,
char * _dest )

Make a differenze between two variable and assign the difference of them to the first.

This function allows you to difference the value of two variables. Note that both variables must pre-exist before the operation, under penalty of an exception.

Precondition
_source and _destination variables must exist
Parameters
_environmentCurrent calling environment
_sourceSource variable's name and destination of the subtraction
_destinationDestination variable's name
Exceptions
EXIT_FAILURE"Destination variable does not cast"
EXIT_FAILURE"Source variable does not exist"

Definition at line 4834 of file _infrastructure.c.

◆ variable_swap()

void variable_swap ( Environment * _environment,
char * _source,
char * _dest )

Swap values of two variables.

This function allows you to swap the value of two variables. Note that none variable must pre-exist before the operation.

Parameters
_environmentCurrent calling environment
_sourceSource variable's name
_destinationDestination variable's name

Definition at line 4984 of file _infrastructure.c.

◆ variable_temporary()

Variable * variable_temporary ( Environment * _environment,
VariableType _type,
char * _meaning )

Define a temporary variable.

This function is necessary to define a temporary variable. This call will search for a (unused) temporary variable of the same type. If there is none, a new temporary variable will be reserved. The name will be chosen so as not to collide with either existing temporary variables or already defined actual variables. Note that the variable will be defined in the last bank defined by the BANK command as TEMPORARY. In other words, it is possible to define different variables in different banks, thus optimizing the space occupied by the program.

Allowed types:

Parameters
_environmentCurrent calling environment
_typeType of the variable to define
Returns
Variable* The variable definition

Definition at line 1388 of file _infrastructure.c.

◆ variable_temporary_remove()

void variable_temporary_remove ( Environment * _environment,
char * _name )

Definition at line 12956 of file _infrastructure.c.

◆ variable_type_from_numeric_value()

VariableType variable_type_from_numeric_value ( Environment * _environment,
int _number )

Definition at line 14807 of file _infrastructure.c.

◆ variable_xor()

Variable * variable_xor ( Environment * _environment,
char * _left,
char * _right )

Calculate logical "xor" and return it as the result.

This function allows you to emit code to make a logical XOR between two expressions, and return the result as boolean.

Parameters
_environmentCurrent calling environment
_leftLeft expression to check
_rightRight expression to check
Returns
Variable* The result of operation

Definition at line 6943 of file _infrastructure.c.

◆ variable_xor_inplace()

void variable_xor_inplace ( Environment * _environment,
char * _source,
int _destination )

Definition at line 4537 of file _infrastructure.c.

◆ variable_xor_inplace_mt()

void variable_xor_inplace_mt ( Environment * _environment,
char * _source,
char * _destination )

Add two variable and return the sum of them on the first.

This function allows you to sum the value of two variables. Note that both variables must pre-exist before the operation, under penalty of an exception.

Precondition
_source and _destination variables must exist
Parameters
_environmentCurrent calling environment
_sourceSource variable's name and destination of sum
_destinationValue to sum
Exceptions
EXIT_FAILURE"Destination variable does not cast"
EXIT_FAILURE"Source variable does not exist"

Definition at line 4620 of file _infrastructure.c.

◆ variable_xor_inplace_vars()

void variable_xor_inplace_vars ( Environment * _environment,
char * _source,
char * _destination )

Add two variable and return the sum of them on the first.

This function allows you to sum the value of two variables. Note that both variables must pre-exist before the operation, under penalty of an exception.

Precondition
_source and _destination variables must exist
Parameters
_environmentCurrent calling environment
_sourceSource variable's name and destination of sum
_destinationValue to sum
Exceptions
EXIT_FAILURE"Destination variable does not cast"
EXIT_FAILURE"Source variable does not exist"

Definition at line 4576 of file _infrastructure.c.

Variable Documentation

◆ BANK_TYPE_AS_STRING

char BANK_TYPE_AS_STRING[][16]
Initial value:
= {
"CODE",
"VARIABLES",
"TEMPORARY",
"DATA",
"STRINGS"
}

Description of BANK TYPE, in readable format.

Definition at line 125 of file _infrastructure.c.

◆ DATATYPE_AS_STRING

char DATATYPE_AS_STRING[][16]

Emit code for BEGIN COPPER.

This variable defines as an array of constant pointers. Each element of the array represents the "human" name of a ugBASIC's data type. The main reason is to map an IDto a readable string. If ugBASIC encounters an error, you don't want it to print "Error in type 2," but rather "Error in type FLOAT.". Note that it's vital that the order of strings in the array exactly reflects the order of the IDs in your enum. If you move an element to one, you must also move it to the other, otherwise the mapping will be staggered. Often, a final NULL or UNKNOWN string is added to handle error cases or to allow you to loop through the array without knowing its size beforehand.

Definition at line 133 of file _infrastructure.c.

◆ importPath

char* importPath
extern

This variable holds the name of the folder containing the set of definitions to be used with the IMPORT DECLARES command. Executing this statement loads the relevant ugBASIC file for the target in question from this location. If NULL, the import path will be search against the following paths: ../../imports, ../imports and, finally, ./imports.

Definition at line 250 of file ugbc.tab.c.

◆ OUTPUT_FILE_TYPE_AS_STRING

char OUTPUT_FILE_TYPE_AS_STRING[][16]
Initial value:
= {
"bin",
"prg",
"xex",
"k7 (original)",
"k7 (new)",
"tap",
"cas",
"rom",
"d64",
"dsk",
"atr",
"reu",
"ram",
"sddrive"
}

In technical terms, it's an array (or list) of constant strings. Each string represents the description of the generated format. This variable has three main purposes in the compiler workflow: the compiler uses this array to rename output files based on the source filename; òets the compiler know which output "stages" the user has requested; finally, before writing a file, the system checks whether the desired extension is one of the "managed" or supported types on the target architecture.

Definition at line 172 of file _infrastructure.c.

◆ SYSTEM_PALETTE

RGBi SYSTEM_PALETTE[]
extern

◆ targetName

char targetName[] = "atari"

Definition at line 55 of file _infrastructure.c.

◆ yydebug

int yydebug
extern

In Bison, the yydebug variable is the primary tool for runtime debugging of the generated parser. When enabled, it allows you to see exactly what's happening "under the hood" as the parser parses the input.

Normally, a Bison parser operates silently: it reads tokens and reduces the rules. If there's an error, you only receive a generic "syntax error". When yydebug is enabled (1), the parser prints a detailed log to standard error (stderr), including when a token is read and pushed onto the stack (shifts), when a sequence of symbols is transformed into a non-terminal according to a grammatical rule (reductions) and the evolution of parser states (stack state).

This variable is a global integer variable (of type int). To enable logging, you must set it to a non-zero value (usually 1). This value is driven by "-y" command line parameter (-y0 or -y1) Inside the Bison definition, we defined the debug macro to include the code needed for tracing support.

Definition at line 168 of file ugbc.tab.c.