/* Copyright (C) 2015-2020, Dirk Krause SPDX-License-Identifier: BSD-3-Clause */ /* WARNING: This file was generated by the dkct program (see http://dktools.sourceforge.net/ for details). Changes you make here will be lost if dkct is run again! You should modify the original source and run dkct on it. Original source: dk4enc.ctr */ #ifndef DK4ENC_H_INCLUDED /** Avoid multiple inclusions. */ #define DK4ENC_H_INCLUDED 1 #line 10 "dk4enc.ctr" /** @file File and memory encodings for characters. CRT on Windows: Optional, disabling CRT degrades performance. */ #ifndef DK4CONF_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include "dk4conf.h" #else #include #endif #endif #ifndef DK4TYPES_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include "dk4types.h" #else #include #endif #endif #ifndef DK4ERROR_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include "dk4error.h" #else #include #endif #endif /** Encodings for text files. */ enum { /** Bytes 0x00 to 0xff represent U+0000 to U+00FF. Formerly misleading named "ASCII". */ DK4_FILE_ENCODING_PLAIN = 0, /** Encoding used in Windows GUI programs. */ DK4_FILE_ENCODING_WIN1252 , /** UTF-8 encoding used on Linux and Unix. */ DK4_FILE_ENCODING_UTF8 , /** UTF-16 encoding, least significant byte first. */ DK4_FILE_ENCODING_UTF16_LE , /** UTF-16 encoding, most significant byte first. */ DK4_FILE_ENCODING_UTF16_BE , /** 32-bit unicode characters, least significant byte first. */ DK4_FILE_ENCODING_32_LE , /** 32-bit unicode characters, most significant byte first. */ DK4_FILE_ENCODING_32_BE }; /** Encoding for characters in memory. */ enum { /** Bytes 0x00 to 0xFF represent U+0000 to U+00FF. */ DK4_ENCODING_PLAIN = DK4_FILE_ENCODING_PLAIN, /** Encoding used by Windows GUI programs. */ DK4_ENCODING_WIN1252 = DK4_FILE_ENCODING_WIN1252, /** UTF-8 encoding used on Linux and Unix. */ DK4_ENCODING_UTF8 = DK4_FILE_ENCODING_UTF8, #if DK4_WORDS_BIGENDIAN /** UTF-16 encoding. */ DK4_ENCODING_UTF16 = DK4_FILE_ENCODING_UTF16_BE , /** 32-bit unicode characters. */ DK4_ENCODING_32 = DK4_FILE_ENCODING_32_BE #else /** UTF-16 encoding. */ DK4_ENCODING_UTF16 = DK4_FILE_ENCODING_UTF16_LE , /** 32-bit unicode characters. */ DK4_ENCODING_32 = DK4_FILE_ENCODING_32_LE #endif }; #ifdef __cplusplus extern "C" { #endif /** Find encoding by name. @param encptr Pointer to result variable for encoding. @param bomptr Pointer to result variable for BOM writing. @param src Source text containing encoding name. @param erp Error report, may be NULL. @return 1 on success, 0 on error. Error codes: - DK4_E_INVALID_ARGUMENTS
if encptr or src is NULL, - DK4_E_BUFFER_TOO_SMALL
if the text is too long to create a local copy for modification, or - DK4_E_SYNTAX
if invalid encoding, options or encoding/option combinations are specified. */ int dk4enc_find(int *encptr, int *bomptr, const dkChar *src, dk4_er_t *erp); #ifdef __cplusplus } #endif #endif