|
GrafX2 2.9.3227
The ultimate 256-color painting program
|
#include <stdio.h>#include <string.h>#include <stdlib.h>#include <ctype.h>#include "const.h"#include "errors.h"#include "global.h"#include "misc.h"#include "readini.h"#include "setup.h"#include "realpath.h"#include "io.h"#include "windows.h"#include "gfx2log.h"#include "gfx2mem.h"
Include dependency graph for readini.c:Functions | |
| void | Load_INI_clear_string (char *str, byte keep_comments) |
| Clean a line of the ini file. More... | |
| int | Load_INI_seek_pattern (const char *buffer, const char *pattern) |
| Search for a substring in a string. More... | |
| static int | Load_INI_reach_group (FILE *file, char *buffer, const char *group) |
| Read lines until a group is found. More... | |
| static int | Load_INI_get_string (FILE *file, char *buffer, const char *option_name, char *return_code, byte raw_text) |
| Find the next string in the .INI file. More... | |
| static int | Load_INI_get_value (const char *str, int *index, int *value) |
| Read a value from the string. More... | |
| static int | Load_INI_get_values (FILE *file, char *buffer, const char *option_name, int nb_expected_values, int *values) |
| Read all values from a string. More... | |
| int | Load_INI (T_Config *conf) |
| Load config from the gfx2.ini file. More... | |
| void Load_INI_clear_string | ( | char * | str, |
| byte | keep_comments | ||
| ) |
Clean a line of the ini file.
Comments start with ";". The result will be in the following format : KEY=value
| [in,out] | str | |
| [in] | keep_comments | if set, the comments are kept |
Referenced by Load_INI_get_string(), Load_INI_get_values(), Load_INI_reach_group(), Save_INI_reach_group(), Save_INI_set_strings(), and Save_INI_set_values().
| int Load_INI_seek_pattern | ( | const char * | buffer, |
| const char * | pattern | ||
| ) |
Search for a substring in a string.
| buffer | the string to search into |
| pattern | the string to search for |
Referenced by Load_INI_get_string(), Load_INI_get_value(), Load_INI_get_values(), Load_INI_reach_group(), Save_INI_reach_group(), Save_INI_set_strings(), and Save_INI_set_values().
|
static |
Read lines until a group is found.
References ERROR_INI_CORRUPTED, Line_number_in_INI_file, Load_INI_clear_string(), and Load_INI_seek_pattern().
Referenced by Load_INI().
|
static |
Find the next string in the .INI file.
| file | INI file currently opened |
| buffer | Current text buffer, preserved from one call to the next |
| option_name | string to search |
| return_code | the found value will be copied there. (must be allocaed) |
| raw_text | Boolean: true to return the raw value (up to end-of-line), false to strip comments. |
References ERROR_INI_CORRUPTED, Line_number_in_INI_file, Load_INI_clear_string(), Load_INI_seek_pattern(), and NULL.
Referenced by Load_INI().
|
static |
Read a value from the string.
GrafX2 is updated according to the number of characters read from the source string.
| str | the source string (option "values") |
| index | a pointer to the current index in the source string |
| value | the read value will be put there |
References ERROR_INI_CORRUPTED, and Load_INI_seek_pattern().
Referenced by Load_INI_get_values().
|
static |
Read all values from a string.
The values are comma separated
| file | handle to gfx2.ini | |
| buffer | Current text buffer, preserved from one call to the next | |
| option_name | name of the option to read | |
| nb_expected_values | number of values to read from the line | |
| [out] | values | the values will be put there |
References ERROR_INI_CORRUPTED, Line_number_in_INI_file, Load_INI_clear_string(), Load_INI_get_value(), and Load_INI_seek_pattern().
Referenced by Load_INI().
| int Load_INI | ( | T_Config * | conf | ) |
Load config from the gfx2.ini file.
| [out] | conf | the configuration to read to |
References T_Config::Adjust_brush_pick, T_Config::Allow_multi_shortcuts, T_Config::Auto_discontinuous, T_Config::Auto_nb_used, T_Config::Auto_save, T_Config::Auto_set_res, T_Components::B, T_Config::Backup, T_Config::Bookmark_directory, T_Config::Bookmark_label, T_Config::Clear_palette, T_Config::Clear_with_stencil, Config_directory, Convert_videomode_arg(), T_Config::Coords_rel, T_Config::Cursor, Data_directory, DEFAULT_FONT_FILENAME, T_Config::Default_mode_layers, T_Config::Default_resolution, DEFAULT_SKIN_FILENAME, Default_window_height, Default_window_width, T_Config::Delay_left_click_on_slider, T_Config::Delay_right_click_on_slider, T_Config::Display_image_limits, T_Config::Double_click_speed, T_Config::Double_key_speed, ERROR_INI_CORRUPTED, ERROR_INI_MISSING, T_Config::Fast_zoom, T_Config::Fav_menu_colors, Filepath_append_to_dir(), T_Config::Find_file_fast, T_Config::Font_file, T_Config::FX_Feedback, T_Components::G, GFX2_DEBUG, GFX2_ERROR, GFX2_Log(), GFX2_malloc, GFX2_MOD_ALT, GFX2_MOD_CTRL, T_Video_mode::Height, INI_FILENAME, INIDEF_FILENAME, Line_number_in_INI_file, Load_INI_get_string(), Load_INI_get_values(), Load_INI_reach_group(), T_Config::Max_undo_pages, T_Config::Maximize_preview, Menu_bars, MENUBAR_ANIMATION, MENUBAR_LAYERS, MENUBAR_TOOLS, mode, T_Config::MOTO_gamma, T_Config::Mouse_merge_movement, T_Config::Mouse_motion_debounce, T_Config::Mouse_sensitivity_index_x, T_Config::Mouse_sensitivity_index_y, NB_BOOKMARKS, T_Config::Nb_max_vertices_per_polygon, NULL, T_Config::Opening_message, T_Config::Palette_cells_X, T_Config::Palette_cells_Y, T_Config::Palette_vertical, PIXEL_DOUBLE, PIXEL_QUAD, Pixel_ratio, PIXEL_SIMPLE, PIXEL_TALL, PIXEL_TALL2, PIXEL_TALL3, PIXEL_TRIPLE, PIXEL_WIDE, PIXEL_WIDE2, T_Components::R, T_Config::Ratio, Realpath(), T_Config::Right_click_colorpick, T_Config::Safety_colors, T_Config::Screen_size_in_GIF, T_Config::Scripts_directory, SCRIPTS_SUBDIRECTORY, T_Config::Separate_colors, T_Config::Set_resolution_according_to, T_Config::Show_hidden_directories, T_Config::Show_hidden_files, T_Config::Skin_file, T_Config::Stylus_mode, T_Config::Swap_buttons, T_Config::Sync_views, T_Config::Tilemap_allow_flipped_x, T_Config::Tilemap_allow_flipped_y, T_Config::Tilemap_show_count, T_Config::Timer_delay, T_Config::Use_virtual_keyboard, Video_mode, T_Menu_Bar::Visible, T_Video_mode::Width, T_Config::Window_pos_x, and T_Config::Window_pos_y.
Referenced by Init_program(), and Settings_load_config().