mirror of
https://github.com/LHY0125/PathEditor.git
synced 2026-05-10 10:19:47 +08:00
feat(i18n): 添加多语言支持功能
- 新增国际化系统,支持中英文切换 - 添加语言选择对话框和语言切换按钮回调 - 扩展配置系统以支持语言设置存储 - 创建语言文件目录结构和占位文件 - 更新主窗口支持UI文本动态刷新
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
/* Class autosprintf - formatted output to an ostream.
|
||||
Copyright (C) 2002, 2012-2026 Free Software Foundation, Inc.
|
||||
|
||||
This program 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.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Bruno Haible. */
|
||||
|
||||
#ifndef _AUTOSPRINTF_H
|
||||
#define _AUTOSPRINTF_H
|
||||
|
||||
/* This feature is available in gcc versions 2.5 and later and in clang. */
|
||||
#if !((__GNUC__ >= 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5) || defined __clang__) && !__STRICT_ANSI__)
|
||||
# define _AUTOSPRINTF_ATTRIBUTE_FORMAT() /* empty */
|
||||
#else
|
||||
/* The __-protected variants of 'format' and 'printf' attributes are
|
||||
accepted by gcc versions 2.6.4 (effectively 2.7) and later and in clang. */
|
||||
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || defined __clang__
|
||||
# define _AUTOSPRINTF_ATTRIBUTE_FORMAT() \
|
||||
__attribute__ ((__format__ (__printf__, 2, 3)))
|
||||
# else
|
||||
# define _AUTOSPRINTF_ATTRIBUTE_FORMAT() \
|
||||
__attribute__ ((format (printf, 2, 3)))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
namespace gnu
|
||||
{
|
||||
/* A temporary object, usually allocated on the stack, representing
|
||||
the result of an asprintf() call. */
|
||||
class autosprintf
|
||||
{
|
||||
public:
|
||||
/* Constructor: takes a format string and the printf arguments. */
|
||||
autosprintf (const char *format, ...)
|
||||
_AUTOSPRINTF_ATTRIBUTE_FORMAT();
|
||||
/* Copy constructor. */
|
||||
autosprintf (const autosprintf& src);
|
||||
/* Assignment operator. */
|
||||
autosprintf& operator = (autosprintf temporary);
|
||||
/* Destructor: frees the temporarily allocated string. */
|
||||
~autosprintf ();
|
||||
/* Conversion to string. */
|
||||
operator char * () const;
|
||||
operator std::string () const;
|
||||
/* Output to an ostream. */
|
||||
friend inline std::ostream& operator<< (std::ostream& stream, const autosprintf& tmp)
|
||||
{
|
||||
stream << (tmp.str ? tmp.str : "(error in autosprintf)");
|
||||
return stream;
|
||||
}
|
||||
private:
|
||||
char *str;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* _AUTOSPRINTF_H */
|
||||
@@ -0,0 +1,420 @@
|
||||
/* Public API for GNU gettext PO files - contained in libgettextpo.
|
||||
Copyright (C) 2003-2026 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Bruno Haible. */
|
||||
|
||||
#ifndef _GETTEXT_PO_H
|
||||
#define _GETTEXT_PO_H 1
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* =========================== Meta Information ============================ */
|
||||
|
||||
/* Version number: (major<<16) + (minor<<8) + subminor */
|
||||
#define LIBGETTEXTPO_VERSION 0x010000
|
||||
extern __declspec (dllimport) int libgettextpo_version;
|
||||
|
||||
/* ================================= Types ================================= */
|
||||
|
||||
/* A po_file_t represents the contents of a PO file. */
|
||||
typedef struct po_file *po_file_t;
|
||||
|
||||
/* A po_message_iterator_t represents an iterator through a domain of a
|
||||
PO file. */
|
||||
typedef struct po_message_iterator *po_message_iterator_t;
|
||||
|
||||
/* A po_message_t represents a message in a PO file. */
|
||||
typedef struct po_message *po_message_t;
|
||||
|
||||
/* A po_filepos_t represents a string's position within a source file. */
|
||||
typedef struct po_filepos *po_filepos_t;
|
||||
|
||||
/* A po_flag_iterator_t represents an iterator through the workflow flags or
|
||||
the sticky flags of a message. */
|
||||
typedef struct po_flag_iterator *po_flag_iterator_t;
|
||||
|
||||
/* A po_error_handler handles error situations. No longer used. */
|
||||
struct po_error_handler
|
||||
{
|
||||
/* Signal an error. The error message is built from FORMAT and the following
|
||||
arguments. ERRNUM, if nonzero, is an errno value.
|
||||
Must increment the error_message_count variable declared in error.h.
|
||||
Must not return if STATUS is nonzero. */
|
||||
void (*error) (int status, int errnum,
|
||||
const char *format, ...)
|
||||
#if (((__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3) || defined __clang__) && !__STRICT_ANSI__
|
||||
__attribute__ ((__format__ (__printf__, 3, 4)))
|
||||
#endif
|
||||
;
|
||||
|
||||
/* Signal an error. The error message is built from FORMAT and the following
|
||||
arguments. The error location is at FILENAME line LINENO. ERRNUM, if
|
||||
nonzero, is an errno value.
|
||||
Must increment the error_message_count variable declared in error.h.
|
||||
Must not return if STATUS is nonzero. */
|
||||
void (*error_at_line) (int status, int errnum,
|
||||
const char *filename, unsigned int lineno,
|
||||
const char *format, ...)
|
||||
#if (((__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3) || defined __clang__) && !__STRICT_ANSI__
|
||||
__attribute__ ((__format__ (__printf__, 5, 6)))
|
||||
#endif
|
||||
;
|
||||
|
||||
/* Signal a multiline warning. The PREFIX applies to all lines of the
|
||||
MESSAGE. Free the PREFIX and MESSAGE when done. */
|
||||
void (*multiline_warning) (char *prefix, char *message);
|
||||
|
||||
/* Signal a multiline error. The PREFIX applies to all lines of the
|
||||
MESSAGE. Free the PREFIX and MESSAGE when done.
|
||||
Must increment the error_message_count variable declared in error.h if
|
||||
PREFIX is non-NULL. */
|
||||
void (*multiline_error) (char *prefix, char *message);
|
||||
};
|
||||
typedef const struct po_error_handler *po_error_handler_t;
|
||||
|
||||
/* A po_xerror_handler handles warnings, error and fatal error situations. */
|
||||
#define PO_SEVERITY_WARNING 0 /* just a warning, tell the user */
|
||||
#define PO_SEVERITY_ERROR 1 /* an error, the operation cannot complete */
|
||||
#define PO_SEVERITY_FATAL_ERROR 2 /* an error, the operation must be aborted */
|
||||
struct po_xerror_handler
|
||||
{
|
||||
/* Signal a problem of the given severity.
|
||||
MESSAGE and/or FILENAME + LINENO indicate where the problem occurred.
|
||||
If FILENAME is NULL, FILENAME and LINENO and COLUMN should be ignored.
|
||||
If LINENO is (size_t)(-1), LINENO and COLUMN should be ignored.
|
||||
If COLUMN is (size_t)(-1), it should be ignored.
|
||||
MESSAGE_TEXT is the problem description (if MULTILINE_P is true,
|
||||
multiple lines of text, each terminated with a newline, otherwise
|
||||
usually a single line).
|
||||
Must not return if SEVERITY is PO_SEVERITY_FATAL_ERROR. */
|
||||
void (*xerror) (int severity,
|
||||
po_message_t message,
|
||||
const char *filename, size_t lineno, size_t column,
|
||||
int multiline_p, const char *message_text);
|
||||
/* Signal a problem that refers to two messages.
|
||||
Similar to two calls to xerror.
|
||||
If possible, a "..." can be appended to MESSAGE_TEXT1 and prepended to
|
||||
MESSAGE_TEXT2. */
|
||||
void (*xerror2) (int severity,
|
||||
po_message_t message1,
|
||||
const char *filename1, size_t lineno1, size_t column1,
|
||||
int multiline_p1, const char *message_text1,
|
||||
po_message_t message2,
|
||||
const char *filename2, size_t lineno2, size_t column2,
|
||||
int multiline_p2, const char *message_text2);
|
||||
};
|
||||
typedef const struct po_xerror_handler *po_xerror_handler_t;
|
||||
|
||||
/* Memory allocation:
|
||||
The memory allocations performed by these functions use xmalloc(),
|
||||
therefore will cause a program exit if memory is exhausted.
|
||||
The memory allocated by po_file_read, and implicitly returned through
|
||||
the po_message_* functions, lasts until freed with po_file_free. */
|
||||
|
||||
|
||||
/* ============================= po_file_t API ============================= */
|
||||
|
||||
/* Create an empty PO file representation in memory. */
|
||||
extern po_file_t po_file_create (void);
|
||||
|
||||
/* Read a PO file into memory.
|
||||
Return its contents. Upon failure, call function from handler. */
|
||||
#define po_file_read po_file_read_v3
|
||||
extern po_file_t po_file_read (const char *filename,
|
||||
po_xerror_handler_t handler);
|
||||
|
||||
/* Write an in-memory PO file to a file.
|
||||
Upon failure, call function from handler. */
|
||||
#define po_file_write po_file_write_v2
|
||||
extern po_file_t po_file_write (po_file_t file, const char *filename,
|
||||
po_xerror_handler_t handler);
|
||||
|
||||
/* Free a PO file from memory. */
|
||||
extern void po_file_free (po_file_t file);
|
||||
|
||||
/* Return the names of the domains covered by a PO file in memory. */
|
||||
extern const char * const * po_file_domains (po_file_t file);
|
||||
|
||||
|
||||
/* =========================== Header entry API ============================ */
|
||||
|
||||
/* Return the header entry of a domain of a PO file in memory.
|
||||
The domain NULL denotes the default domain.
|
||||
Return NULL if there is no header entry. */
|
||||
extern const char * po_file_domain_header (po_file_t file, const char *domain);
|
||||
|
||||
/* Return the value of a field in a header entry.
|
||||
The return value is either a freshly allocated string, to be freed by the
|
||||
caller, or NULL. */
|
||||
extern char * po_header_field (const char *header, const char *field);
|
||||
|
||||
/* Return the header entry with a given field set to a given value. The field
|
||||
is added if necessary.
|
||||
The return value is a freshly allocated string. */
|
||||
extern char * po_header_set_field (const char *header, const char *field, const char *value);
|
||||
|
||||
|
||||
/* ======================= po_message_iterator_t API ======================= */
|
||||
|
||||
/* Create an iterator for traversing a domain of a PO file in memory.
|
||||
The domain NULL denotes the default domain. */
|
||||
extern po_message_iterator_t po_message_iterator (po_file_t file, const char *domain);
|
||||
|
||||
/* Free an iterator. */
|
||||
extern void po_message_iterator_free (po_message_iterator_t iterator);
|
||||
|
||||
/* Return the next message, and advance the iterator.
|
||||
Return NULL at the end of the message list. */
|
||||
extern po_message_t po_next_message (po_message_iterator_t iterator);
|
||||
|
||||
/* Insert a message in a PO file in memory, in the domain and at the position
|
||||
indicated by the iterator. The iterator thereby advances past the freshly
|
||||
inserted message. */
|
||||
extern void po_message_insert (po_message_iterator_t iterator, po_message_t message);
|
||||
|
||||
|
||||
/* =========================== po_message_t API ============================ */
|
||||
|
||||
/* Return a freshly constructed message.
|
||||
To finish initializing the message, you must set the msgid and msgstr. */
|
||||
extern po_message_t po_message_create (void);
|
||||
|
||||
|
||||
/* Return the context of a message, or NULL for a message not restricted to a
|
||||
context. */
|
||||
extern const char * po_message_msgctxt (po_message_t message);
|
||||
|
||||
/* Change the context of a message. NULL means a message not restricted to a
|
||||
context. */
|
||||
extern void po_message_set_msgctxt (po_message_t message, const char *msgctxt);
|
||||
|
||||
|
||||
/* Return the msgid (untranslated English string) of a message. */
|
||||
extern const char * po_message_msgid (po_message_t message);
|
||||
|
||||
/* Change the msgid (untranslated English string) of a message. */
|
||||
extern void po_message_set_msgid (po_message_t message, const char *msgid);
|
||||
|
||||
/* Return the msgid_plural (untranslated English plural string) of a message,
|
||||
or NULL for a message without plural. */
|
||||
extern const char * po_message_msgid_plural (po_message_t message);
|
||||
|
||||
/* Change the msgid_plural (untranslated English plural string) of a message.
|
||||
NULL means a message without plural. */
|
||||
extern void po_message_set_msgid_plural (po_message_t message, const char *msgid_plural);
|
||||
|
||||
|
||||
/* Return the msgstr (translation) of a message.
|
||||
Return the empty string for an untranslated message. */
|
||||
extern const char * po_message_msgstr (po_message_t message);
|
||||
|
||||
/* Change the msgstr (translation) of a message.
|
||||
Use an empty string to denote an untranslated message. */
|
||||
extern void po_message_set_msgstr (po_message_t message, const char *msgstr);
|
||||
|
||||
/* Return the msgstr[index] for a message with plural handling, or
|
||||
NULL when the index is out of range or for a message without plural. */
|
||||
extern const char * po_message_msgstr_plural (po_message_t message, int index);
|
||||
|
||||
/* Change the msgstr[index] for a message with plural handling.
|
||||
Use a NULL value at the end to reduce the number of plural forms. */
|
||||
extern void po_message_set_msgstr_plural (po_message_t message, int index, const char *msgstr);
|
||||
|
||||
|
||||
/* Return the comments for a message. */
|
||||
extern const char * po_message_comments (po_message_t message);
|
||||
|
||||
/* Change the comments for a message.
|
||||
comments should be a multiline string, ending in a newline, or empty. */
|
||||
extern void po_message_set_comments (po_message_t message, const char *comments);
|
||||
|
||||
|
||||
/* Return the extracted comments for a message. */
|
||||
extern const char * po_message_extracted_comments (po_message_t message);
|
||||
|
||||
/* Change the extracted comments for a message.
|
||||
comments should be a multiline string, ending in a newline, or empty. */
|
||||
extern void po_message_set_extracted_comments (po_message_t message, const char *comments);
|
||||
|
||||
|
||||
/* Return the i-th file position for a message, or NULL if i is out of
|
||||
range. */
|
||||
extern po_filepos_t po_message_filepos (po_message_t message, int i);
|
||||
|
||||
/* Remove the i-th file position from a message.
|
||||
The indices of all following file positions for the message are decremented
|
||||
by one. */
|
||||
extern void po_message_remove_filepos (po_message_t message, int i);
|
||||
|
||||
/* Add a file position to a message, if it is not already present for the
|
||||
message.
|
||||
file is the file name.
|
||||
start_line is the line number where the string starts, or (size_t)(-1) if no
|
||||
line number is available. */
|
||||
extern void po_message_add_filepos (po_message_t message, const char *file, size_t start_line);
|
||||
|
||||
|
||||
/* Return the previous context of a message, or NULL for none. */
|
||||
extern const char * po_message_prev_msgctxt (po_message_t message);
|
||||
|
||||
/* Change the previous context of a message. NULL is allowed. */
|
||||
extern void po_message_set_prev_msgctxt (po_message_t message, const char *prev_msgctxt);
|
||||
|
||||
/* Return the previous msgid (untranslated English string) of a message, or
|
||||
NULL for none. */
|
||||
extern const char * po_message_prev_msgid (po_message_t message);
|
||||
|
||||
/* Change the previous msgid (untranslated English string) of a message.
|
||||
NULL is allowed. */
|
||||
extern void po_message_set_prev_msgid (po_message_t message, const char *prev_msgid);
|
||||
|
||||
/* Return the previous msgid_plural (untranslated English plural string) of a
|
||||
message, or NULL for none. */
|
||||
extern const char * po_message_prev_msgid_plural (po_message_t message);
|
||||
|
||||
/* Change the previous msgid_plural (untranslated English plural string) of a
|
||||
message. NULL is allowed. */
|
||||
extern void po_message_set_prev_msgid_plural (po_message_t message, const char *prev_msgid_plural);
|
||||
|
||||
|
||||
/* Return true if the message is marked obsolete. */
|
||||
extern int po_message_is_obsolete (po_message_t message);
|
||||
|
||||
/* Change the obsolete mark of a message. */
|
||||
extern void po_message_set_obsolete (po_message_t message, int obsolete);
|
||||
|
||||
|
||||
/* Return true if the message is marked fuzzy. */
|
||||
extern int po_message_is_fuzzy (po_message_t message);
|
||||
|
||||
/* Change the fuzzy mark of a message. */
|
||||
extern void po_message_set_fuzzy (po_message_t message, int fuzzy);
|
||||
|
||||
/* Return true if the message has a given workflow flag.
|
||||
This function is a generalization of po_message_is_fuzzy. */
|
||||
extern int po_message_has_workflow_flag (po_message_t message, const char *workflow_flag);
|
||||
|
||||
/* Set or unset a given workflow flag on a message.
|
||||
This function is a generalization of po_message_set_fuzzy. */
|
||||
extern void po_message_set_workflow_flag (po_message_t message, const char *workflow_flag, int value);
|
||||
|
||||
/* Create an iterator for traversing the list of workflow flags of a message.
|
||||
This includes the "fuzzy" flag. */
|
||||
extern po_flag_iterator_t po_message_workflow_flags_iterator (po_message_t message);
|
||||
|
||||
|
||||
/* Return true if the message is marked as being a format string of the given
|
||||
type (e.g. "c-format"). */
|
||||
extern int po_message_is_format (po_message_t message, const char *format_type);
|
||||
|
||||
/* Return the format string mark for a given type (e.g. "c-format") of a
|
||||
message.
|
||||
Returns 1 if the the mark is set,
|
||||
0 if the opposite mark ("no-*") is set,
|
||||
-1 if neither the mark nor the opposite mark is set. */
|
||||
extern int po_message_get_format (po_message_t message, const char *format_type);
|
||||
|
||||
/* Change the format string mark for a given type of a message.
|
||||
Pass value = 1 to assert the format string mark (e.g. "c-format"),
|
||||
value = 0 to assert the opposite (leading to e.g. "no-c-format"),
|
||||
or value = -1 to remove the format string mark and its opposite. */
|
||||
extern void po_message_set_format (po_message_t message, const char *format_type, int value);
|
||||
|
||||
/* Return true if the message has a given sticky flag.
|
||||
This function is a generalization of po_message_is_format and
|
||||
po_message_get_format. */
|
||||
extern int po_message_has_sticky_flag (po_message_t message, const char *sticky_flag);
|
||||
|
||||
/* Set or unset a given sticky flag on a message.
|
||||
This function is a generalization of po_message_set_format. */
|
||||
extern void po_message_set_sticky_flag (po_message_t message, const char *sticky_flag, int value);
|
||||
|
||||
/* Create an iterator for traversing the list of sticky flags of a message.
|
||||
This includes the "*-format" and "no-*-format" flags, as well as the
|
||||
"no-wrap" flag.
|
||||
It does *not* include the "range", because that is not a flag. */
|
||||
extern po_flag_iterator_t po_message_sticky_flags_iterator (po_message_t message);
|
||||
|
||||
|
||||
/* If a numeric range of a message is set, return true and store the minimum
|
||||
and maximum value in *MINP and *MAXP. */
|
||||
extern int po_message_is_range (po_message_t message, int *minp, int *maxp);
|
||||
|
||||
/* Change the numeric range of a message. MIN and MAX must be non-negative,
|
||||
with MIN < MAX. Use MIN = MAX = -1 to remove the numeric range of a
|
||||
message. */
|
||||
extern void po_message_set_range (po_message_t message, int min, int max);
|
||||
|
||||
|
||||
/* =========================== po_filepos_t API ============================ */
|
||||
|
||||
/* Return the file name. */
|
||||
extern const char * po_filepos_file (po_filepos_t filepos);
|
||||
|
||||
/* Return the line number where the string starts, or (size_t)(-1) if no line
|
||||
number is available. */
|
||||
extern size_t po_filepos_start_line (po_filepos_t filepos);
|
||||
|
||||
|
||||
/* ============================ Format type API ============================= */
|
||||
|
||||
/* Return a NULL terminated array of the supported format types. */
|
||||
extern const char * const * po_format_list (void);
|
||||
|
||||
/* Return the pretty name associated with a format type.
|
||||
For example, for "csharp-format", return "C#".
|
||||
Return NULL if the argument is not a supported format type. */
|
||||
extern const char * po_format_pretty_name (const char *format_type);
|
||||
|
||||
|
||||
/* ========================= po_flag_iterator_t API ========================= */
|
||||
|
||||
/* Free an iterator. */
|
||||
extern void po_flag_iterator_free (po_flag_iterator_t iterator);
|
||||
|
||||
/* Return the next flag, and advance the iterator.
|
||||
Return NULL at the end of the list of flags. */
|
||||
extern const char * po_flag_next (po_flag_iterator_t iterator);
|
||||
|
||||
|
||||
/* ============================= Checking API ============================== */
|
||||
|
||||
/* Test whether an entire file PO file is valid, like msgfmt does it.
|
||||
If it is invalid, pass the reasons to the handler. */
|
||||
extern void po_file_check_all (po_file_t file, po_xerror_handler_t handler);
|
||||
|
||||
/* Test a single message, to be inserted in a PO file in memory, like msgfmt
|
||||
does it. If it is invalid, pass the reasons to the handler. The iterator
|
||||
is not modified by this call; it only specifies the file and the domain. */
|
||||
extern void po_message_check_all (po_message_t message, po_message_iterator_t iterator, po_xerror_handler_t handler);
|
||||
|
||||
/* Test whether the message translation is a valid format string if the message
|
||||
is marked as being a format string. If it is invalid, pass the reasons to
|
||||
the handler. */
|
||||
#define po_message_check_format po_message_check_format_v2
|
||||
extern void po_message_check_format (po_message_t message, po_xerror_handler_t handler);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _GETTEXT_PO_H */
|
||||
@@ -0,0 +1,243 @@
|
||||
/* Copyright (C) 1999-2026 Free Software Foundation, Inc.
|
||||
This file is part of the GNU LIBICONV Library.
|
||||
|
||||
The GNU LIBICONV 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.1
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
The GNU LIBICONV Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU LIBICONV Library; see the file COPYING.LIB.
|
||||
If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* When installed, this file is called "iconv.h". */
|
||||
|
||||
#ifndef _LIBICONV_H
|
||||
#define _LIBICONV_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define _LIBICONV_VERSION 0x0113 /* version number: (major<<8) + minor */
|
||||
extern __declspec (dllimport) int _libiconv_version; /* Likewise */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* We would like to #include any system header file which could define
|
||||
iconv_t, in order to eliminate the risk that the user gets compilation
|
||||
errors because some other system header file includes /usr/include/iconv.h
|
||||
which defines iconv_t or declares iconv after this file.
|
||||
But gcc's #include_next is not portable. Thus, once libiconv's iconv.h
|
||||
has been installed in /usr/local/include, there is no way any more to
|
||||
include the original /usr/include/iconv.h. We simply have to get away
|
||||
without it.
|
||||
The risk that a system header file does
|
||||
#include "iconv.h" or #include_next "iconv.h"
|
||||
is small. They all do #include <iconv.h>. */
|
||||
|
||||
/* Define iconv_t ourselves. */
|
||||
#undef iconv_t
|
||||
#define iconv_t libiconv_t
|
||||
typedef void* iconv_t;
|
||||
|
||||
/* Get size_t declaration.
|
||||
Get wchar_t declaration if it exists. */
|
||||
#include <stddef.h>
|
||||
|
||||
/* Get errno declaration and values. */
|
||||
#include <errno.h>
|
||||
/* Some systems, like SunOS 4, don't have EILSEQ. Some systems, like BSD/OS,
|
||||
have EILSEQ in a different header. On these systems, define EILSEQ
|
||||
ourselves. */
|
||||
#ifndef EILSEQ
|
||||
#define EILSEQ
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Allocates descriptor for code conversion from encoding ‘fromcode’ to
|
||||
encoding ‘tocode’. */
|
||||
#define iconv_open libiconv_open
|
||||
extern iconv_t iconv_open (const char* tocode, const char* fromcode);
|
||||
|
||||
/* Converts, using conversion descriptor ‘cd’, at most ‘*inbytesleft’ bytes
|
||||
starting at ‘*inbuf’, writing at most ‘*outbytesleft’ bytes starting at
|
||||
‘*outbuf’.
|
||||
Decrements ‘*inbytesleft’ and increments ‘*inbuf’ by the same amount.
|
||||
Decrements ‘*outbytesleft’ and increments ‘*outbuf’ by the same amount. */
|
||||
#define iconv libiconv
|
||||
extern size_t iconv (iconv_t cd, char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
|
||||
|
||||
/* Frees resources allocated for conversion descriptor ‘cd’. */
|
||||
#define iconv_close libiconv_close
|
||||
extern int iconv_close (iconv_t cd);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Nonstandard extensions. */
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
|
||||
<wchar.h>.
|
||||
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
|
||||
included before <wchar.h>. */
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#endif
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* A type that holds all memory needed by a conversion descriptor.
|
||||
A pointer to such an object can be used as an iconv_t. */
|
||||
typedef struct {
|
||||
void* dummy1[28];
|
||||
#if 1
|
||||
mbstate_t dummy2;
|
||||
#endif
|
||||
} iconv_allocation_t;
|
||||
|
||||
/* Allocates descriptor for code conversion from encoding ‘fromcode’ to
|
||||
encoding ‘tocode’ into preallocated memory. Returns an error indicator
|
||||
(0 or -1 with errno set). */
|
||||
#define iconv_open_into libiconv_open_into
|
||||
extern int iconv_open_into (const char* tocode, const char* fromcode,
|
||||
iconv_allocation_t* resultp);
|
||||
|
||||
/* Control of attributes. */
|
||||
#define iconvctl libiconvctl
|
||||
extern int iconvctl (iconv_t cd, int request, void* argument);
|
||||
|
||||
/* Hook performed after every successful conversion of a Unicode character. */
|
||||
typedef void (*iconv_unicode_char_hook) (unsigned int uc, void* data);
|
||||
/* Hook performed after every successful conversion of a wide character. */
|
||||
typedef void (*iconv_wide_char_hook) (wchar_t wc, void* data);
|
||||
/* Set of hooks. */
|
||||
struct iconv_hooks {
|
||||
iconv_unicode_char_hook uc_hook;
|
||||
iconv_wide_char_hook wc_hook;
|
||||
void* data;
|
||||
};
|
||||
|
||||
/* Fallback function. Invoked when a small number of bytes could not be
|
||||
converted to a Unicode character. This function should process all
|
||||
bytes from inbuf and may produce replacement Unicode characters by calling
|
||||
the write_replacement callback repeatedly. */
|
||||
typedef void (*iconv_unicode_mb_to_uc_fallback)
|
||||
(const char* inbuf, size_t inbufsize,
|
||||
void (*write_replacement) (const unsigned int *buf, size_t buflen,
|
||||
void* callback_arg),
|
||||
void* callback_arg,
|
||||
void* data);
|
||||
/* Fallback function. Invoked when a Unicode character could not be converted
|
||||
to the target encoding. This function should process the character and
|
||||
may produce replacement bytes (in the target encoding) by calling the
|
||||
write_replacement callback repeatedly. */
|
||||
typedef void (*iconv_unicode_uc_to_mb_fallback)
|
||||
(unsigned int code,
|
||||
void (*write_replacement) (const char *buf, size_t buflen,
|
||||
void* callback_arg),
|
||||
void* callback_arg,
|
||||
void* data);
|
||||
/* Fallback function. Invoked when a number of bytes could not be converted to
|
||||
a wide character. This function should process all bytes from inbuf and may
|
||||
produce replacement wide characters by calling the write_replacement
|
||||
callback repeatedly. */
|
||||
typedef void (*iconv_wchar_mb_to_wc_fallback)
|
||||
(const char* inbuf, size_t inbufsize,
|
||||
void (*write_replacement) (const wchar_t *buf, size_t buflen,
|
||||
void* callback_arg),
|
||||
void* callback_arg,
|
||||
void* data);
|
||||
/* Fallback function. Invoked when a wide character could not be converted to
|
||||
the target encoding. This function should process the character and may
|
||||
produce replacement bytes (in the target encoding) by calling the
|
||||
write_replacement callback repeatedly. */
|
||||
typedef void (*iconv_wchar_wc_to_mb_fallback)
|
||||
(wchar_t code,
|
||||
void (*write_replacement) (const char *buf, size_t buflen,
|
||||
void* callback_arg),
|
||||
void* callback_arg,
|
||||
void* data);
|
||||
/* Set of fallbacks. */
|
||||
struct iconv_fallbacks {
|
||||
iconv_unicode_mb_to_uc_fallback mb_to_uc_fallback;
|
||||
iconv_unicode_uc_to_mb_fallback uc_to_mb_fallback;
|
||||
iconv_wchar_mb_to_wc_fallback mb_to_wc_fallback;
|
||||
iconv_wchar_wc_to_mb_fallback wc_to_mb_fallback;
|
||||
void* data;
|
||||
};
|
||||
|
||||
/* Surfaces.
|
||||
The concept of surfaces is described in the 'recode' manual. */
|
||||
#define ICONV_SURFACE_NONE 0
|
||||
/* In EBCDIC encodings, 0x15 (which encodes the "newline function", see the
|
||||
Unicode standard, chapter 5) maps to U+000A instead of U+0085. This is
|
||||
for interoperability with C programs and Unix environments on z/OS. */
|
||||
#define ICONV_SURFACE_EBCDIC_ZOS_UNIX 1
|
||||
|
||||
/* Requests for iconvctl. */
|
||||
#define ICONV_TRIVIALP 0 /* int *argument */
|
||||
#define ICONV_GET_TRANSLITERATE 1 /* int *argument */
|
||||
#define ICONV_SET_TRANSLITERATE 2 /* const int *argument */
|
||||
#define ICONV_GET_DISCARD_ILSEQ 3 /* int *argument */
|
||||
#define ICONV_SET_DISCARD_ILSEQ 4 /* const int *argument */
|
||||
#define ICONV_SET_HOOKS 5 /* const struct iconv_hooks *argument */
|
||||
#define ICONV_SET_FALLBACKS 6 /* const struct iconv_fallbacks *argument */
|
||||
#define ICONV_GET_FROM_SURFACE 7 /* unsigned int *argument */
|
||||
#define ICONV_SET_FROM_SURFACE 8 /* const unsigned int *argument */
|
||||
#define ICONV_GET_TO_SURFACE 9 /* unsigned int *argument */
|
||||
#define ICONV_SET_TO_SURFACE 10 /* const unsigned int *argument */
|
||||
#define ICONV_GET_DISCARD_INVALID 11 /* int *argument */
|
||||
#define ICONV_SET_DISCARD_INVALID 12 /* const int *argument */
|
||||
#define ICONV_GET_DISCARD_NON_IDENTICAL 13 /* int *argument */
|
||||
#define ICONV_SET_DISCARD_NON_IDENTICAL 14 /* const int *argument */
|
||||
|
||||
/* Listing of locale independent encodings. */
|
||||
#define iconvlist libiconvlist
|
||||
extern void iconvlist (int (*do_one) (unsigned int namescount,
|
||||
const char * const * names,
|
||||
void* data),
|
||||
void* data);
|
||||
|
||||
/* Canonicalize an encoding name.
|
||||
The result is either a canonical encoding name, or name itself. */
|
||||
extern const char * iconv_canonicalize (const char * name);
|
||||
|
||||
/* Support for relocatable packages. */
|
||||
|
||||
/* Sets the original and the current installation prefix of the package.
|
||||
Relocation simply replaces a pathname starting with the original prefix
|
||||
by the corresponding pathname with the current prefix instead. Both
|
||||
prefixes should be directory names without trailing slash (i.e. use ""
|
||||
instead of "/"). */
|
||||
extern void libiconv_set_relocation_prefix (const char *orig_prefix,
|
||||
const char *curr_prefix);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _LIBICONV_H */
|
||||
@@ -0,0 +1,45 @@
|
||||
/* Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
This file is part of the GNU CHARSET Library.
|
||||
|
||||
The GNU CHARSET 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.
|
||||
|
||||
The GNU CHARSET Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the GNU CHARSET Library; see the file COPYING.LIB. If not,
|
||||
see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _LIBCHARSET_H
|
||||
#define _LIBCHARSET_H
|
||||
|
||||
#include <localcharset.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Support for relocatable packages. */
|
||||
|
||||
/* Sets the original and the current installation prefix of the package.
|
||||
Relocation simply replaces a pathname starting with the original prefix
|
||||
by the corresponding pathname with the current prefix instead. Both
|
||||
prefixes should be directory names without trailing slash (i.e. use ""
|
||||
instead of "/"). */
|
||||
extern void libcharset_set_relocation_prefix (const char *orig_prefix,
|
||||
const char *curr_prefix);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _LIBCHARSET_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,137 @@
|
||||
/* Determine a canonical name for the current locale's character encoding.
|
||||
Copyright (C) 2000-2003, 2009-2019 Free Software Foundation, Inc.
|
||||
This file is part of the GNU CHARSET Library.
|
||||
|
||||
This program 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, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program; if not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _LOCALCHARSET_H
|
||||
#define _LOCALCHARSET_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Determine the current locale's character encoding, and canonicalize it
|
||||
into one of the canonical names listed below.
|
||||
The result must not be freed; it is statically allocated. The result
|
||||
becomes invalid when setlocale() is used to change the global locale, or
|
||||
when the value of one of the environment variables LC_ALL, LC_CTYPE, LANG
|
||||
is changed; threads in multithreaded programs should not do this.
|
||||
If the canonical name cannot be determined, the result is a non-canonical
|
||||
name. */
|
||||
extern const char * locale_charset (void);
|
||||
|
||||
/* About GNU canonical names for character encodings:
|
||||
|
||||
Every canonical name must be supported by GNU libiconv. Support by GNU libc
|
||||
is also desirable.
|
||||
|
||||
The name is case insensitive. Usually an upper case MIME charset name is
|
||||
preferred.
|
||||
|
||||
The current list of these GNU canonical names is:
|
||||
|
||||
name MIME? used by which systems
|
||||
(darwin = Mac OS X, windows = native Windows)
|
||||
|
||||
ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin minix cygwin
|
||||
ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos
|
||||
ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos
|
||||
ISO-8859-3 Y glibc solaris cygwin
|
||||
ISO-8859-4 Y hpux osf solaris freebsd netbsd openbsd darwin
|
||||
ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos
|
||||
ISO-8859-6 Y glibc aix hpux solaris cygwin
|
||||
ISO-8859-7 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos
|
||||
ISO-8859-8 Y glibc aix hpux osf solaris cygwin zos
|
||||
ISO-8859-9 Y glibc aix hpux irix osf solaris freebsd darwin cygwin zos
|
||||
ISO-8859-13 glibc hpux solaris freebsd netbsd openbsd darwin cygwin
|
||||
ISO-8859-14 glibc cygwin
|
||||
ISO-8859-15 glibc aix irix osf solaris freebsd netbsd openbsd darwin cygwin
|
||||
KOI8-R Y glibc hpux solaris freebsd netbsd openbsd darwin
|
||||
KOI8-U Y glibc freebsd netbsd openbsd darwin cygwin
|
||||
KOI8-T glibc
|
||||
CP437 dos
|
||||
CP775 dos
|
||||
CP850 aix osf dos
|
||||
CP852 dos
|
||||
CP855 dos
|
||||
CP856 aix
|
||||
CP857 dos
|
||||
CP861 dos
|
||||
CP862 dos
|
||||
CP864 dos
|
||||
CP865 dos
|
||||
CP866 freebsd netbsd openbsd darwin dos
|
||||
CP869 dos
|
||||
CP874 windows dos
|
||||
CP922 aix
|
||||
CP932 aix cygwin windows dos
|
||||
CP943 aix zos
|
||||
CP949 osf darwin windows dos
|
||||
CP950 windows dos
|
||||
CP1046 aix
|
||||
CP1124 aix
|
||||
CP1125 dos
|
||||
CP1129 aix
|
||||
CP1131 freebsd darwin
|
||||
CP1250 windows
|
||||
CP1251 glibc hpux solaris freebsd netbsd openbsd darwin cygwin windows
|
||||
CP1252 aix windows
|
||||
CP1253 windows
|
||||
CP1254 windows
|
||||
CP1255 glibc windows
|
||||
CP1256 windows
|
||||
CP1257 windows
|
||||
GB2312 Y glibc aix hpux irix solaris freebsd netbsd darwin cygwin zos
|
||||
EUC-JP Y glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin
|
||||
EUC-KR Y glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin zos
|
||||
EUC-TW glibc aix hpux irix osf solaris netbsd
|
||||
BIG5 Y glibc aix hpux osf solaris freebsd netbsd darwin cygwin zos
|
||||
BIG5-HKSCS glibc hpux solaris netbsd darwin
|
||||
GBK glibc aix osf solaris freebsd darwin cygwin windows dos
|
||||
GB18030 glibc hpux solaris freebsd netbsd darwin
|
||||
SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin
|
||||
JOHAB glibc solaris windows
|
||||
TIS-620 glibc aix hpux osf solaris cygwin zos
|
||||
VISCII Y glibc
|
||||
TCVN5712-1 glibc
|
||||
ARMSCII-8 glibc freebsd netbsd darwin
|
||||
GEORGIAN-PS glibc cygwin
|
||||
PT154 glibc netbsd cygwin
|
||||
HP-ROMAN8 hpux
|
||||
HP-ARABIC8 hpux
|
||||
HP-GREEK8 hpux
|
||||
HP-HEBREW8 hpux
|
||||
HP-TURKISH8 hpux
|
||||
HP-KANA8 hpux
|
||||
DEC-KANJI osf
|
||||
DEC-HANYU osf
|
||||
UTF-8 Y glibc aix hpux osf solaris netbsd darwin cygwin zos
|
||||
|
||||
Note: Names which are not marked as being a MIME name should not be used in
|
||||
Internet protocols for information interchange (mail, news, etc.).
|
||||
|
||||
Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
|
||||
must understand both names and treat them as equivalent.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _LOCALCHARSET_H */
|
||||
@@ -0,0 +1,707 @@
|
||||
/* Public API of the libtextstyle library.
|
||||
Copyright (C) 2006-2007, 2019-2026 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Bruno Haible. */
|
||||
|
||||
#ifndef _TEXTSTYLE_H
|
||||
#define _TEXTSTYLE_H
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <textstyle/woe32dll.h>
|
||||
|
||||
/* Meta information. */
|
||||
#include <textstyle/version.h>
|
||||
|
||||
/* ----------------------------- From ostream.h ----------------------------- */
|
||||
|
||||
/* Describes the scope of a flush operation. */
|
||||
typedef enum
|
||||
{
|
||||
/* Flushes buffers in this ostream_t.
|
||||
Use this value if you want to write to the underlying ostream_t. */
|
||||
FLUSH_THIS_STREAM = 0,
|
||||
/* Flushes all buffers in the current process.
|
||||
Use this value if you want to write to the same target through a
|
||||
different file descriptor or a FILE stream. */
|
||||
FLUSH_THIS_PROCESS = 1,
|
||||
/* Flushes buffers in the current process and attempts to flush the buffers
|
||||
in the kernel.
|
||||
Use this value so that some other process (or the kernel itself)
|
||||
may write to the same target. */
|
||||
FLUSH_ALL = 2
|
||||
} ostream_flush_scope_t;
|
||||
|
||||
|
||||
/* An output stream is an object to which one can feed a sequence of bytes. */
|
||||
|
||||
struct any_ostream_representation;
|
||||
typedef struct any_ostream_representation * ostream_t;
|
||||
|
||||
/* Functions that invoke the methods. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void ostream_write_mem (ostream_t first_arg, const void *data, size_t len);
|
||||
extern void ostream_flush (ostream_t first_arg, ostream_flush_scope_t scope);
|
||||
extern void ostream_free (ostream_t first_arg);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Write a string's contents to a stream. */
|
||||
extern void ostream_write_str (ostream_t stream, const char *string);
|
||||
|
||||
/* Writes formatted output to a stream.
|
||||
Returns the size of formatted output, or a negative value in case of an
|
||||
error. */
|
||||
extern ptrdiff_t ostream_printf (ostream_t stream, const char *format, ...)
|
||||
#if (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3
|
||||
__attribute__ ((__format__ (__printf__, 2, 3)))
|
||||
#endif
|
||||
;
|
||||
extern ptrdiff_t ostream_vprintf (ostream_t stream,
|
||||
const char *format, va_list args)
|
||||
#if (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3
|
||||
__attribute__ ((__format__ (__printf__, 2, 0)))
|
||||
#endif
|
||||
;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ------------------------- From styled-ostream.h ------------------------- */
|
||||
|
||||
/* A styled output stream is an object to which one can feed a sequence of
|
||||
bytes, marking some runs of text as belonging to specific CSS classes,
|
||||
where the rendering of the CSS classes is defined through a CSS (cascading
|
||||
style sheet). */
|
||||
|
||||
/* styled_ostream_t is a subtype of ostream_t. */
|
||||
typedef ostream_t styled_ostream_t;
|
||||
|
||||
/* Functions that invoke the methods. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void styled_ostream_write_mem (styled_ostream_t first_arg, const void *data, size_t len);
|
||||
extern void styled_ostream_flush (styled_ostream_t first_arg, ostream_flush_scope_t scope);
|
||||
extern void styled_ostream_free (styled_ostream_t first_arg);
|
||||
extern void styled_ostream_begin_use_class (styled_ostream_t first_arg, const char *classname);
|
||||
extern void styled_ostream_end_use_class (styled_ostream_t first_arg, const char *classname);
|
||||
extern const char *styled_ostream_get_hyperlink_ref (styled_ostream_t first_arg);
|
||||
extern const char *styled_ostream_get_hyperlink_id (styled_ostream_t first_arg);
|
||||
extern void styled_ostream_set_hyperlink (styled_ostream_t first_arg, const char *ref, const char *id);
|
||||
/* Like styled_ostream_flush (first_arg, FLUSH_THIS_STREAM), except that it
|
||||
leaves the destination with the current text style enabled, instead
|
||||
of with the default text style.
|
||||
After calling this function, you can output strings without newlines(!)
|
||||
to the underlying stream, and they will be rendered like strings passed
|
||||
to 'ostream_write_mem', 'ostream_write_str', or 'ostream_write_printf'. */
|
||||
extern void styled_ostream_flush_to_current_style (styled_ostream_t stream);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Test whether a given output stream is a styled_ostream. */
|
||||
extern bool is_instance_of_styled_ostream (ostream_t stream);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* -------------------------- From file-ostream.h -------------------------- */
|
||||
|
||||
/* file_ostream_t is a subtype of ostream_t. */
|
||||
typedef ostream_t file_ostream_t;
|
||||
|
||||
/* Functions that invoke the methods. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void file_ostream_write_mem (file_ostream_t first_arg, const void *data, size_t len);
|
||||
extern void file_ostream_flush (file_ostream_t first_arg, ostream_flush_scope_t scope);
|
||||
extern void file_ostream_free (file_ostream_t first_arg);
|
||||
/* Accessors. */
|
||||
extern FILE *file_ostream_get_stdio_stream (file_ostream_t stream);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Create an output stream referring to FP.
|
||||
Note that the resulting stream must be closed before FP can be closed. */
|
||||
extern file_ostream_t file_ostream_create (FILE *fp);
|
||||
|
||||
|
||||
/* Test whether a given output stream is a file_ostream. */
|
||||
extern bool is_instance_of_file_ostream (ostream_t stream);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* --------------------------- From fd-ostream.h --------------------------- */
|
||||
|
||||
/* fd_ostream_t is a subtype of ostream_t. */
|
||||
typedef ostream_t fd_ostream_t;
|
||||
|
||||
/* Functions that invoke the methods. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void fd_ostream_write_mem (fd_ostream_t first_arg, const void *data, size_t len);
|
||||
extern void fd_ostream_flush (fd_ostream_t first_arg, ostream_flush_scope_t scope);
|
||||
extern void fd_ostream_free (fd_ostream_t first_arg);
|
||||
/* Accessors. */
|
||||
extern int fd_ostream_get_descriptor (fd_ostream_t stream);
|
||||
extern const char *fd_ostream_get_filename (fd_ostream_t stream);
|
||||
extern bool fd_ostream_is_buffered (fd_ostream_t stream);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Create an output stream referring to the file descriptor FD.
|
||||
FILENAME is used only for error messages.
|
||||
Note that the resulting stream must be closed before FD can be closed. */
|
||||
extern fd_ostream_t fd_ostream_create (int fd, const char *filename,
|
||||
bool buffered);
|
||||
|
||||
|
||||
/* Test whether a given output stream is a fd_ostream. */
|
||||
extern bool is_instance_of_fd_ostream (ostream_t stream);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* -------------------------- From term-ostream.h -------------------------- */
|
||||
|
||||
/* Querying and setting of text attributes.
|
||||
The stream has a notion of the current text attributes; they apply
|
||||
implicitly to all following output. The attributes are automatically
|
||||
reset when the stream is closed.
|
||||
Note: Not all terminal types can actually render all attributes adequately.
|
||||
For example, xterm cannot render POSTURE_ITALIC nor the combination of
|
||||
WEIGHT_BOLD and UNDERLINE_ON. */
|
||||
|
||||
/* Colors are represented by indices >= 0 in a stream dependent format. */
|
||||
typedef int term_color_t;
|
||||
/* The value -1 denotes the default (foreground or background) color. */
|
||||
enum
|
||||
{
|
||||
COLOR_DEFAULT = -1 /* unknown */
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WEIGHT_NORMAL = 0,
|
||||
WEIGHT_BOLD,
|
||||
WEIGHT_DEFAULT = WEIGHT_NORMAL
|
||||
} term_weight_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
POSTURE_NORMAL = 0,
|
||||
POSTURE_ITALIC, /* same as oblique */
|
||||
POSTURE_DEFAULT = POSTURE_NORMAL
|
||||
} term_posture_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
UNDERLINE_OFF = 0,
|
||||
UNDERLINE_ON,
|
||||
UNDERLINE_DEFAULT = UNDERLINE_OFF
|
||||
} term_underline_t;
|
||||
|
||||
/* The amount of control to take over the underlying tty in order to avoid
|
||||
garbled output on the screen, due to interleaved output of escape sequences
|
||||
and output from the kernel (such as when the kernel echoes user's input
|
||||
or when the kernel prints '^C' after the user pressed Ctrl-C). */
|
||||
typedef enum
|
||||
{
|
||||
TTYCTL_AUTO = 0, /* Automatic best-possible choice. */
|
||||
TTYCTL_NONE, /* No control.
|
||||
Result: Garbled output can occur, and the terminal can
|
||||
be left in any state when the program is interrupted. */
|
||||
TTYCTL_PARTIAL, /* Signal handling.
|
||||
Result: Garbled output can occur, but the terminal will
|
||||
be left in the default state when the program is
|
||||
interrupted. */
|
||||
TTYCTL_FULL /* Signal handling and disabling echo and flush-upon-signal.
|
||||
Result: No garbled output, and the the terminal will
|
||||
be left in the default state when the program is
|
||||
interrupted. */
|
||||
} ttyctl_t;
|
||||
|
||||
/* term_ostream_t is a subtype of ostream_t. */
|
||||
typedef ostream_t term_ostream_t;
|
||||
|
||||
/* Functions that invoke the methods. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void term_ostream_write_mem (term_ostream_t first_arg, const void *data, size_t len);
|
||||
extern void term_ostream_flush (term_ostream_t first_arg, ostream_flush_scope_t scope);
|
||||
extern void term_ostream_free (term_ostream_t first_arg);
|
||||
extern term_color_t term_ostream_rgb_to_color (term_ostream_t first_arg, int red, int green, int blue);
|
||||
extern term_color_t term_ostream_get_color (term_ostream_t first_arg);
|
||||
extern void term_ostream_set_color (term_ostream_t first_arg, term_color_t color);
|
||||
extern term_color_t term_ostream_get_bgcolor (term_ostream_t first_arg);
|
||||
extern void term_ostream_set_bgcolor (term_ostream_t first_arg, term_color_t color);
|
||||
extern term_weight_t term_ostream_get_weight (term_ostream_t first_arg);
|
||||
extern void term_ostream_set_weight (term_ostream_t first_arg, term_weight_t weight);
|
||||
extern term_posture_t term_ostream_get_posture (term_ostream_t first_arg);
|
||||
extern void term_ostream_set_posture (term_ostream_t first_arg, term_posture_t posture);
|
||||
extern term_underline_t term_ostream_get_underline (term_ostream_t first_arg);
|
||||
extern void term_ostream_set_underline (term_ostream_t first_arg, term_underline_t underline);
|
||||
extern const char *term_ostream_get_hyperlink_ref (term_ostream_t first_arg);
|
||||
extern const char *term_ostream_get_hyperlink_id (term_ostream_t first_arg);
|
||||
extern void term_ostream_set_hyperlink (term_ostream_t first_arg, const char *ref, const char *id);
|
||||
/* Like term_ostream_flush (first_arg, FLUSH_THIS_STREAM), except that it
|
||||
leaves the terminal with the current text attributes enabled, instead of
|
||||
with the default text attributes.
|
||||
After calling this function, you can output strings without newlines(!)
|
||||
to the underlying file descriptor, and they will be rendered like strings
|
||||
passed to 'ostream_write_mem', 'ostream_write_str', or
|
||||
'ostream_write_printf'. */
|
||||
extern void term_ostream_flush_to_current_style (term_ostream_t first_arg);
|
||||
/* Accessors. */
|
||||
extern int term_ostream_get_descriptor (term_ostream_t stream);
|
||||
extern const char *term_ostream_get_filename (term_ostream_t stream);
|
||||
extern ttyctl_t term_ostream_get_tty_control (term_ostream_t stream);
|
||||
extern ttyctl_t term_ostream_get_effective_tty_control (term_ostream_t stream);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Create an output stream referring to the file descriptor FD.
|
||||
FILENAME is used only for error messages.
|
||||
TTY_CONTROL specifies the amount of control to take over the underlying tty.
|
||||
The resulting stream will be line-buffered.
|
||||
Note that the resulting stream must be closed before FD can be closed. */
|
||||
extern term_ostream_t
|
||||
term_ostream_create (int fd, const char *filename, ttyctl_t tty_control);
|
||||
|
||||
|
||||
/* Test whether a given output stream is a term_ostream. */
|
||||
extern bool is_instance_of_term_ostream (ostream_t stream);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ------------------------- From memory-ostream.h ------------------------- */
|
||||
|
||||
/* memory_ostream_t is a subtype of ostream_t. */
|
||||
typedef ostream_t memory_ostream_t;
|
||||
|
||||
/* Functions that invoke the methods. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void memory_ostream_write_mem (memory_ostream_t first_arg, const void *data, size_t len);
|
||||
extern void memory_ostream_flush (memory_ostream_t first_arg, ostream_flush_scope_t scope);
|
||||
extern void memory_ostream_free (memory_ostream_t first_arg);
|
||||
extern void memory_ostream_contents (memory_ostream_t first_arg, const void **bufp, size_t *buflenp);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Create an output stream that accumulates the output in a memory buffer. */
|
||||
extern memory_ostream_t memory_ostream_create (void);
|
||||
|
||||
|
||||
/* Test whether a given output stream is a memory_ostream. */
|
||||
extern bool is_instance_of_memory_ostream (ostream_t stream);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* -------------------------- From iconv-ostream.h -------------------------- */
|
||||
|
||||
#if LIBTEXTSTYLE_USES_ICONV
|
||||
|
||||
/* iconv_ostream_t is a subtype of ostream_t. */
|
||||
typedef ostream_t iconv_ostream_t;
|
||||
|
||||
/* Functions that invoke the methods. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void iconv_ostream_write_mem (iconv_ostream_t first_arg, const void *data, size_t len);
|
||||
extern void iconv_ostream_flush (iconv_ostream_t first_arg, ostream_flush_scope_t scope);
|
||||
extern void iconv_ostream_free (iconv_ostream_t first_arg);
|
||||
/* Accessors. */
|
||||
extern const char *iconv_ostream_get_from_encoding (iconv_ostream_t stream);
|
||||
extern const char *iconv_ostream_get_to_encoding (iconv_ostream_t stream);
|
||||
extern ostream_t iconv_ostream_get_destination (iconv_ostream_t stream);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Create an output stream that converts from FROM_ENCODING to TO_ENCODING,
|
||||
writing the result to DESTINATION. */
|
||||
extern iconv_ostream_t iconv_ostream_create (const char *from_encoding,
|
||||
const char *to_encoding,
|
||||
ostream_t destination);
|
||||
|
||||
|
||||
/* Test whether a given output stream is an iconv_ostream. */
|
||||
extern bool is_instance_of_iconv_ostream (ostream_t stream);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBTEXTSTYLE_USES_ICONV */
|
||||
|
||||
/* -------------------------- From html-ostream.h -------------------------- */
|
||||
|
||||
/* html_ostream_t is a subtype of ostream_t. */
|
||||
typedef ostream_t html_ostream_t;
|
||||
|
||||
/* Functions that invoke the methods. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void html_ostream_write_mem (html_ostream_t first_arg, const void *data, size_t len);
|
||||
extern void html_ostream_flush (html_ostream_t first_arg, ostream_flush_scope_t scope);
|
||||
extern void html_ostream_free (html_ostream_t first_arg);
|
||||
extern void html_ostream_begin_span (html_ostream_t first_arg, const char *classname);
|
||||
extern void html_ostream_end_span (html_ostream_t first_arg, const char *classname);
|
||||
extern const char *html_ostream_get_hyperlink_ref (html_ostream_t first_arg);
|
||||
extern void html_ostream_set_hyperlink_ref (html_ostream_t first_arg, const char *ref);
|
||||
/* Like html_ostream_flush (first_arg, FLUSH_THIS_STREAM), except that it
|
||||
leaves the destination with the current text style enabled, instead
|
||||
of with the default text style.
|
||||
After calling this function, you can output strings without newlines(!)
|
||||
to the underlying stream, and they will be rendered like strings passed
|
||||
to 'ostream_write_mem', 'ostream_write_str', or 'ostream_write_printf'. */
|
||||
extern void html_ostream_flush_to_current_style (html_ostream_t stream);
|
||||
/* Accessors. */
|
||||
extern ostream_t html_ostream_get_destination (html_ostream_t stream);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Create an output stream that takes input in the UTF-8 encoding and
|
||||
writes it in HTML form on DESTINATION.
|
||||
This stream produces a sequence of lines. The caller is responsible
|
||||
for opening the <body><html> elements before and for closing them after
|
||||
the use of this stream.
|
||||
Note that the resulting stream must be closed before DESTINATION can be
|
||||
closed. */
|
||||
extern html_ostream_t html_ostream_create (ostream_t destination);
|
||||
|
||||
|
||||
/* Test whether a given output stream is a html_ostream. */
|
||||
extern bool is_instance_of_html_ostream (ostream_t stream);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ----------------------- From term-styled-ostream.h ----------------------- */
|
||||
|
||||
/* term_styled_ostream_t is a subtype of styled_ostream_t. */
|
||||
typedef styled_ostream_t term_styled_ostream_t;
|
||||
|
||||
/* Functions that invoke the methods. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void term_styled_ostream_write_mem (term_styled_ostream_t first_arg, const void *data, size_t len);
|
||||
extern void term_styled_ostream_flush (term_styled_ostream_t first_arg, ostream_flush_scope_t scope);
|
||||
extern void term_styled_ostream_free (term_styled_ostream_t first_arg);
|
||||
extern void term_styled_ostream_begin_use_class (term_styled_ostream_t first_arg, const char *classname);
|
||||
extern void term_styled_ostream_end_use_class (term_styled_ostream_t first_arg, const char *classname);
|
||||
extern const char *term_styled_ostream_get_hyperlink_ref (term_styled_ostream_t first_arg);
|
||||
extern const char *term_styled_ostream_get_hyperlink_id (term_styled_ostream_t first_arg);
|
||||
extern void term_styled_ostream_set_hyperlink (term_styled_ostream_t first_arg, const char *ref, const char *id);
|
||||
extern void term_styled_ostream_flush_to_current_style (term_styled_ostream_t first_arg);
|
||||
/* Accessors. */
|
||||
extern term_ostream_t term_styled_ostream_get_destination (term_styled_ostream_t stream);
|
||||
extern const char *term_styled_ostream_get_css_filename (term_styled_ostream_t stream);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Create an output stream referring to the file descriptor FD, styled with
|
||||
the file CSS_FILENAME.
|
||||
FILENAME is used only for error messages.
|
||||
TTY_CONTROL specifies the amount of control to take over the underlying tty.
|
||||
Note that the resulting stream must be closed before FD can be closed.
|
||||
Return NULL upon failure. */
|
||||
extern term_styled_ostream_t
|
||||
term_styled_ostream_create (int fd, const char *filename,
|
||||
ttyctl_t tty_control,
|
||||
const char *css_filename);
|
||||
|
||||
|
||||
/* Test whether a given output stream is a term_styled_ostream. */
|
||||
extern bool is_instance_of_term_styled_ostream (ostream_t stream);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ----------------------- From html-styled-ostream.h ----------------------- */
|
||||
|
||||
/* html_styled_ostream_t is a subtype of styled_ostream_t. */
|
||||
typedef styled_ostream_t html_styled_ostream_t;
|
||||
|
||||
/* Functions that invoke the methods. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void html_styled_ostream_write_mem (html_styled_ostream_t first_arg, const void *data, size_t len);
|
||||
extern void html_styled_ostream_flush (html_styled_ostream_t first_arg, ostream_flush_scope_t scope);
|
||||
extern void html_styled_ostream_free (html_styled_ostream_t first_arg);
|
||||
extern void html_styled_ostream_begin_use_class (html_styled_ostream_t first_arg, const char *classname);
|
||||
extern void html_styled_ostream_end_use_class (html_styled_ostream_t first_arg, const char *classname);
|
||||
extern const char *html_styled_ostream_get_hyperlink_ref (html_styled_ostream_t first_arg);
|
||||
extern const char *html_styled_ostream_get_hyperlink_id (html_styled_ostream_t first_arg);
|
||||
extern void html_styled_ostream_set_hyperlink (html_styled_ostream_t first_arg, const char *ref, const char *id);
|
||||
extern void html_styled_ostream_flush_to_current_style (html_styled_ostream_t first_arg);
|
||||
/* Accessors. */
|
||||
extern ostream_t html_styled_ostream_get_destination (html_styled_ostream_t stream);
|
||||
extern html_ostream_t html_styled_ostream_get_html_destination (html_styled_ostream_t stream);
|
||||
extern const char *html_styled_ostream_get_css_filename (html_styled_ostream_t stream);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Create an output stream that takes input in the UTF-8 encoding and
|
||||
writes it in HTML form on DESTINATION, styled with the file CSS_FILENAME.
|
||||
Note that the resulting stream must be closed before DESTINATION can be
|
||||
closed. */
|
||||
extern html_styled_ostream_t
|
||||
html_styled_ostream_create (ostream_t destination,
|
||||
const char *css_filename);
|
||||
|
||||
|
||||
/* Test whether a given output stream is a html_styled_ostream. */
|
||||
extern bool is_instance_of_html_styled_ostream (ostream_t stream);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ----------------------- From noop-styled-ostream.h ----------------------- */
|
||||
|
||||
/* noop_styled_ostream_t is a subtype of styled_ostream_t. */
|
||||
typedef styled_ostream_t noop_styled_ostream_t;
|
||||
|
||||
/* Functions that invoke the methods. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void noop_styled_ostream_write_mem (noop_styled_ostream_t first_arg, const void *data, size_t len);
|
||||
extern void noop_styled_ostream_flush (noop_styled_ostream_t first_arg, ostream_flush_scope_t scope);
|
||||
extern void noop_styled_ostream_free (noop_styled_ostream_t first_arg);
|
||||
extern void noop_styled_ostream_begin_use_class (noop_styled_ostream_t first_arg, const char *classname);
|
||||
extern void noop_styled_ostream_end_use_class (noop_styled_ostream_t first_arg, const char *classname);
|
||||
extern const char *noop_styled_ostream_get_hyperlink_ref (noop_styled_ostream_t first_arg);
|
||||
extern const char *noop_styled_ostream_get_hyperlink_id (noop_styled_ostream_t first_arg);
|
||||
extern void noop_styled_ostream_set_hyperlink (noop_styled_ostream_t first_arg, const char *ref, const char *id);
|
||||
extern void noop_styled_ostream_flush_to_current_style (noop_styled_ostream_t first_arg);
|
||||
/* Accessors. */
|
||||
extern ostream_t noop_styled_ostream_get_destination (noop_styled_ostream_t stream);
|
||||
extern bool noop_styled_ostream_is_owning_destination (noop_styled_ostream_t stream);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Create an output stream that delegates to DESTINATION and that supports
|
||||
the styling operations as no-ops.
|
||||
If PASS_OWNERSHIP is true, closing the resulting stream will automatically
|
||||
close the DESTINATION.
|
||||
Note that if PASS_OWNERSHIP is false, the resulting stream must be closed
|
||||
before DESTINATION can be closed. */
|
||||
extern noop_styled_ostream_t
|
||||
noop_styled_ostream_create (ostream_t destination, bool pass_ownership);
|
||||
|
||||
|
||||
/* Test whether a given output stream is a noop_styled_ostream. */
|
||||
extern bool is_instance_of_noop_styled_ostream (ostream_t stream);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ------------------------------ From color.h ------------------------------ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Whether to output a test page. */
|
||||
extern LIBTEXTSTYLE_DLL_VARIABLE bool color_test_mode;
|
||||
|
||||
/* Color option. */
|
||||
enum color_option { color_no, color_tty, color_yes, color_html };
|
||||
extern LIBTEXTSTYLE_DLL_VARIABLE enum color_option color_mode;
|
||||
|
||||
/* Style to use when coloring. */
|
||||
extern LIBTEXTSTYLE_DLL_VARIABLE const char *style_file_name;
|
||||
|
||||
/* --color argument handling. Return an error indicator. */
|
||||
extern bool handle_color_option (const char *option);
|
||||
|
||||
/* --style argument handling. */
|
||||
extern void handle_style_option (const char *option);
|
||||
|
||||
/* Print a color test page. */
|
||||
extern void print_color_test (void);
|
||||
|
||||
/* Assign a default value to style_file_name if necessary.
|
||||
STYLE_FILE_ENVVAR is an environment variable that, when set to a non-empty
|
||||
value, specifies the style file to use. This environment variable is meant
|
||||
to be set by the user.
|
||||
STYLESDIR_ENVVAR is an environment variable that, when set to a non-empty
|
||||
value, specifies the directory with the style files, or NULL. This is
|
||||
necessary for running the testsuite before "make install".
|
||||
STYLESDIR_AFTER_INSTALL is the directory with the style files after
|
||||
"make install".
|
||||
DEFAULT_STYLE_FILE is the file name of the default style file, relative to
|
||||
STYLESDIR. */
|
||||
extern void style_file_prepare (const char *style_file_envvar,
|
||||
const char *stylesdir_envvar,
|
||||
const char *stylesdir_after_install,
|
||||
const char *default_style_file);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ------------------------------ From misc.h ------------------------------ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Create an output stream referring to the file descriptor FD, styled with
|
||||
the file CSS_FILENAME if possible.
|
||||
FILENAME is used only for error messages.
|
||||
TTY_CONTROL specifies the amount of control to take over the underlying tty.
|
||||
Note that the resulting stream must be closed before FD can be closed. */
|
||||
extern styled_ostream_t
|
||||
styled_ostream_create (int fd, const char *filename,
|
||||
ttyctl_t tty_control,
|
||||
const char *css_filename);
|
||||
|
||||
/* Set the exit value upon failure within libtextstyle. */
|
||||
extern void libtextstyle_set_failure_exit_code (int exit_code);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ----------------------- Exported gnulib overrides ----------------------- */
|
||||
|
||||
#if defined _WIN32 && ! defined __CYGWIN__
|
||||
|
||||
# include <io.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# if !((defined isatty && defined _GL_UNISTD_H) || defined GNULIB_overrides_isatty) /* don't override gnulib */
|
||||
extern int libtextstyle_isatty (int fd);
|
||||
# undef isatty
|
||||
# define isatty libtextstyle_isatty
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#endif /* _TEXTSTYLE_H */
|
||||
@@ -0,0 +1,45 @@
|
||||
/* Meta information about GNU libtextstyle.
|
||||
Copyright (C) 2009-2026 Free Software Foundation, Inc.
|
||||
|
||||
This program 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Bruno Haible. */
|
||||
|
||||
#ifndef _TEXTSTYLE_VERSION_H
|
||||
#define _TEXTSTYLE_VERSION_H
|
||||
|
||||
/* Get LIBTEXTSTYLE_DLL_VARIABLE. */
|
||||
#include <textstyle/woe32dll.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Version number: (major<<16) + (minor<<8) + subminor. */
|
||||
#define _LIBTEXTSTYLE_VERSION 0x010000
|
||||
extern LIBTEXTSTYLE_DLL_VARIABLE const int _libtextstyle_version; /* Likewise */
|
||||
|
||||
|
||||
/* 1 if libtextstyle was built with iconv support, 0 if not. */
|
||||
#define LIBTEXTSTYLE_USES_ICONV 1
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _TEXTSTYLE_VERSION_H */
|
||||
@@ -0,0 +1,30 @@
|
||||
/* Support for variables in shared libraries on Windows platforms.
|
||||
Copyright (C) 2009-2026 Free Software Foundation, Inc.
|
||||
|
||||
This program 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Bruno Haible. */
|
||||
|
||||
#ifndef _TEXTSTYLE_WOE32DLL_H
|
||||
#define _TEXTSTYLE_WOE32DLL_H
|
||||
|
||||
#ifdef IN_LIBTEXTSTYLE
|
||||
/* All code is collected in a single library, */
|
||||
# define LIBTEXTSTYLE_DLL_VARIABLE
|
||||
#else
|
||||
/* References from outside of libtextstyle. */
|
||||
# define LIBTEXTSTYLE_DLL_VARIABLE __declspec (dllimport)
|
||||
#endif
|
||||
|
||||
#endif /* _TEXTSTYLE_WOE32DLL_H */
|
||||
Reference in New Issue
Block a user