Skip to content
Snippets Groups Projects
Commit 6b73c96e authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Create read_uifc_ini() for a common method of reading UIFC/CIOLIB .ini files

Copied from read_scfg_ini() in scfg.c
parent 7dcfa20f
No related branches found
No related tags found
1 merge request!455Update branch with changes from master
OBJS = $(OBJODIR)$(DIRSEP)uifcx$(OFILE)
OBJS = $(OBJODIR)/uifcx.o
MT_OBJS = $(MTOBJODIR)/uifc32.o \
$(MTOBJODIR)/uifcx.o \
$(MTOBJODIR)/uifc_ini.o
MT_OBJS = $(MTOBJODIR)$(DIRSEP)uifc32$(OFILE) \
$(MTOBJODIR)$(DIRSEP)uifcx$(OFILE)
......@@ -22,6 +22,9 @@
#ifndef _UIFC_H_
#define _UIFC_H_
#include "gen_defs.h" // int64_t
#include "ciolib.h" // enum text_modes
#include <time.h>
#include <fcntl.h>
#include <ctype.h>
......@@ -523,6 +526,8 @@ UIFCEXPORT int uifcinix(uifcapi_t*); /* Standard I/O implementation */
UIFCEXPORT int uifcini32(uifcapi_t*); /* modern implementation */
/****************************************************************************/
void read_uifc_ini(const char* path, uifcapi_t*, int* ciolib_mode, enum text_modes*);
#ifdef __cplusplus
}
#endif
......
......@@ -123,8 +123,9 @@
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="uifc_ini.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
\ No newline at end of file
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* See the GNU Lesser General Public License for more details: lgpl.txt or *
* http://www.fsf.org/copyleft/lesser.html *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
#include "uifc.h"
#include "ini_file.h"
#include "ciolib.h"
void read_uifc_ini(const char* path, uifcapi_t* uifc, int* ciolib_mode, enum text_modes* video_mode)
{
FILE* fp = iniOpenFile(path, /* update: */false);
const char* section = ROOT_SECTION;
*video_mode = iniReadInteger(fp, section, "video_mode", *video_mode);
uifc->mode = iniReadInteger(fp, section, "uifc_mode", uifc->mode);
uifc->scrn_len = iniReadInteger(fp, section, "lines", uifc->scrn_len);
uifc->insert_mode = iniReadBool(fp, section, "insert", uifc->insert_mode);
uifc->esc_delay = iniReadInteger(fp, section, "esc_delay", uifc->esc_delay);
*ciolib_mode = iniReadInteger(fp, section, "ciolib_mode", *ciolib_mode);
ciolib_initial_scaling = iniReadFloat(fp, section, "scaling", ciolib_initial_scaling);
if (fp != NULL)
iniCloseFile(fp);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment