33 Commits

Author SHA1 Message Date
Serendipity 720ebb535d feat(ui): 添加深色模式支持
- 新增深色/浅色模式切换按钮,位于主窗口底部
- 在配置文件中定义主题颜色(浅色/深色背景、列表背景、前景色)
- 更新 UI 工具函数以支持动态主题切换,包括列表斑马纹适配
- 添加翻译条目(Dark Mode/Light Mode)并更新编译脚本
- 修改主窗口创建逻辑,集成主题切换回调
- 调整列表背景色属性从 BACKCOLOR 改为 BGCOLOR 以保持一致性
2026-05-02 01:32:56 +08:00
Serendipity 3df2988915 feat(merge): 添加合并预览 Tab 页
- 新增第三个 Tab「合并预览」,只读展示系统+用户 PATH 完整列表
- 选项卡切换时自动刷新合并列表
- 支持无效/重复路径高亮
- 新增中英文翻译

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 23:54:53 +08:00
Serendipity c5c5517ded feat(multi-select): 支持列表多选及批量删除
- 列表控件启用 MULTIPLE=YES 属性
- btn_del_cb 支持批量删除:解析分号分隔的多选索引,从大到小删除
- 批量删除推送一条合并的 undo record,支持一步撤销

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 23:49:44 +08:00
Serendipity 485d16a180 feat(tooltip): 添加环境变量展开预览悬停提示
- 新增 expand_env_vars 函数,调用 ExpandEnvironmentStringsA 展开 %VAR%
- sync_string_list_to_ui 中对含 % 的路径设置 ITEMTIP 属性
- 鼠标悬停时显示展开后的完整路径

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 23:45:58 +08:00
Serendipity e5d24389b4 feat(shortcuts): 添加全局快捷键 Ctrl+N/S/F
- Ctrl+N: 新建路径
- Ctrl+S: 保存(确定)
- Ctrl+F: 聚焦搜索框
- 对话框级 K_ANY 回调,列表级 K_ANY 保持 Ctrl+Z/Y/DEL

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 23:17:14 +08:00
Serendipity 5bb0ac66cf docs: 添加全局快捷键设计文档
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 23:16:05 +08:00
Serendipity ec0ca5a3f6 fix(undo): 修复撤销按钮状态不刷新及空指针防护
- 将 refresh_undo_redo_buttons 提升为公共函数(声明在 callbacks_internal.h,实现在 callbacks.c)
- 在所有 push_record 的操作回调末尾调用 refresh_undo_redo_buttons,确保按钮状态实时更新
- 修复 redo() 中 OP_CLEAN/OP_IMPORT 的 new_paths 空指针风险
- 移除 undo_redo.c 中废弃的 apply_record 函数

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 23:12:42 +08:00
Serendipity bbcfc25aea feat(undo): 重新编译 .mo 翻译文件以包含撤销/重做文本
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 23:04:24 +08:00
Serendipity a8002aeba4 feat(undo): 添加撤销/重做的中英文翻译
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 23:00:47 +08:00
Serendipity aac4cc4b54 feat(undo): 在 Lua 配置中添加撤销/重做按钮文本 2026-05-01 22:54:20 +08:00
Serendipity c8d9b32c70 feat(undo): 在 UI 中添加撤销/重做按钮并集成布局
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 22:53:18 +08:00
Serendipity f9628f6e8c feat(undo): 实现撤销/重做按钮回调及 Ctrl+Z/Y 快捷键
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 22:50:39 +08:00
Serendipity e0af409ef5 feat(undo): 声明撤销/重做按钮回调函数
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 22:48:14 +08:00
Serendipity 256e793ee4 feat(undo): 添加撤销/重做按钮的 UI 常量
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 22:47:14 +08:00
Serendipity 8bd8c0a0aa docs: 添加撤销/重做 UI 集成的实现计划
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 22:45:06 +08:00
Serendipity 1f48551199 feat: 实现撤销/重做功能和CSV导出支持
- 添加撤销/重做管理器,支持添加、删除、编辑、移动等操作的撤销/重做
- 在应用上下文中集成撤销/重做管理器,最大支持50条历史记录
- 为所有基本操作(新建、编辑、删除、上移、下移、清理)添加撤销记录
- 扩展导出功能,支持CSV格式导出(除原有JSON格式外)
- 添加路径格式验证函数,确保导入数据的有效性
- 更新UI文件对话框过滤器以包含CSV格式选项
2026-05-01 22:42:56 +08:00
Serendipity 06e4c15b5c docs: 添加撤销/重做 UI 集成设计文档
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 22:39:39 +08:00
Serendipity 32e6bb262b feat(test): 添加单元测试框架并完善国际化支持
- 新增 CMake 测试框架配置,支持 safe_string、string_ext 和 path_manager 模块的单元测试
- 实现 Windows API Mock 机制,便于测试编码转换函数
- 添加 error_code 模块的字符串表示函数,支持英文错误日志
- 在 UI 回调函数中集成国际化翻译,覆盖新建、编辑、导入导出等操作提示
- 扩展 string_list 功能,新增重复路径检查函数
- 更新翻译文件,同步所有用户界面的中英文文本
2026-04-30 11:38:34 +08:00
Serendipity cf19a37a97 feat(test): 添加单元测试框架并完善国际化支持
- 新增 CMake 测试框架配置,支持 safe_string、string_ext 和 path_manager 模块的单元测试
- 实现 Windows API Mock 机制,便于测试编码转换函数
- 添加 error_code 模块的字符串表示函数,支持英文错误日志
- 在 UI 回调函数中集成国际化翻译,覆盖新建、编辑、导入导出等操作提示
- 扩展 string_list 功能,新增重复路径检查函数
- 更新翻译文件,同步所有用户界面的中英文文本
2026-04-30 11:38:05 +08:00
Serendipity ceed90aea8 feat(backup): 支持自定义备份目录和备份跳过选项
- 在 Lua 配置中新增 backup.dir 配置项,允许设置默认备份路径
- 修改 backup_registry() 函数,接受自定义备份路径参数,优先级为:传入参数 > Lua 配置 > 默认 %APPDATA% 路径
- 在保存操作前,通过对话框让用户选择“使用默认路径”、“自定义目录”或“跳过备份”
- 更新 README 文档,说明新的备份功能和多语言支持等架构细节
2026-04-29 16:08:58 +08:00
Serendipity 3bc2f00cb1 feat(backup): 增强备份失败时的用户提示和错误处理
- 在备份失败时显示具体原因(如无法获取AppData路径、创建备份目录失败等)
- 改进备份函数的错误处理,添加详细的日志记录
- 备份失败时允许用户选择是否继续保存操作
- 修复备份目录创建失败时的错误码返回
- 添加备份过程的详细文档说明
2026-04-28 22:40:50 +08:00
Serendipity e777b26879 fix: 修复JSON导入、备份目录创建和内存安全等问题
修复JSON导入时转义字符处理不完整的问题,添加对\b、\f等控制字符的转义
改进备份目录创建逻辑,使用SHCreateDirectoryExW递归创建目录
修复内存分配失败处理,避免空指针解引用
修正选项卡标题设置位置,从Dialog改为Tabs控件
增强导入功能,支持TXT文件导入时选择目标变量类型
优化清理无效路径算法,使用标记数组减少内存移动
修复宽字符环境变量设置,使用_wputenv_s替代putenv
添加导入数据初始化,防止未初始化内存访问
改进文件属性检查,使用宽字符API支持Unicode路径
2026-04-28 22:21:06 +08:00
Serendipity 7908bad1f4 refactor(controller): 拆分回调函数到模块化文件并添加字符串列表访问器
- 将 callbacks.c 拆分为多个按功能分类的文件(callbacks_basic.c、callbacks_nav.c、callbacks_search.c、callbacks_io.c、callbacks_sys.c)
- 新增 callbacks_internal.h 提供内部辅助函数声明,减少代码重复
- 在 string_ext 模块中添加 string_list_get 和 string_list_set 安全访问器函数
- 更新 CMakeLists.txt 和 ui_utils.c 以使用新的模块结构和访问器
- 重构旨在提高代码可维护性和可读性,便于后续功能扩展
2026-04-28 21:54:47 +08:00
Serendipity ea3d678d22 feat(ui): 统一管理IUP控件名称常量,增强可维护性
refactor(core): 移除未使用的get_app_context函数
refactor(os_env): 修改backup_registry函数以返回错误码并备份到指定目录
refactor(path_manager): 增强路径管理函数的错误处理
2026-04-28 21:01:52 +08:00
Serendipity 86792012e2 feat(i18n): 为UI添加gettext国际化支持
- 将配置中的中文文本改为英文原文,作为翻译源字符串
- 在C代码中为所有UI字符串添加_()包装以启用gettext翻译
- 更新对话框、主窗口和配置文件的文本处理方式
2026-03-26 22:06:05 +08:00
Serendipity 4fe7dc47e4 feat(i18n): 添加多语言支持功能
- 新增国际化系统,支持中英文切换
- 添加语言选择对话框和语言切换按钮回调
- 扩展配置系统以支持语言设置存储
- 创建语言文件目录结构和占位文件
- 更新主窗口支持UI文本动态刷新
2026-03-26 20:44:22 +08:00
Serendipity 9a78b88c4a refactor(core): 统一使用ErrorCode并添加错误日志记录
- 将path_manager和import_export模块的返回值从int/void改为ErrorCode
- 在关键操作中添加日志记录,便于调试和错误追踪
- 更新调用代码以检查错误码并记录错误
- 修改运行命令以管理员权限启动程序
2026-03-26 18:27:38 +08:00
Serendipity 3af0e96060 refactor: 移除未使用的布局配置并增强日志与安全字符串
- 删除未使用的 layout_config.h 头文件及其引用
- 在 main.c 和 callbacks.c 中添加日志记录以追踪程序启动、关闭和关键操作
- 将多处 strncpy 调用替换为安全的 safe_strcpy 函数
- 在 dialogs.c 中引入 safe_string.h 以使用安全字符串函数
2026-03-26 13:20:34 +08:00
Serendipity 6ba7e702f2 refactor(registry): 使用ErrorCode类型替换int作为错误返回值
- 将registry_service.h/c中的函数返回值从int改为ErrorCode枚举
- 更新callbacks.c中的错误检查逻辑,使用ERR_OK常量进行比较
- 在内部辅助函数中返回具体的错误码(ERR_REGISTRY_FAILED等)
- 提高代码类型安全性和错误处理可读性
2026-03-26 13:02:14 +08:00
Serendipity 9aa1e208ba docs: 更新 README 中的架构与工具库说明
更新“架构与二次开发”章节的图标,并补充了项目中包含的开发工具库列表,如统一错误码系统、安全字符串函数等,以便开发者更全面地了解项目结构。
2026-03-26 12:50:29 +08:00
Serendipity d934d21323 feat: 新增安全字符串处理和日志系统模块
- 添加 safe_string 模块,提供安全的字符串复制、拼接和复制功能
- 添加 logger 模块,支持多级别日志记录和文件输出
- 添加 error_code 模块,定义统一的错误代码枚举
- 添加 layout_config 模块,定义布局配置结构
- 更新 CMakeLists.txt 包含新增的源文件
2026-03-26 12:47:44 +08:00
Serendipity 8767271e96 feat(导入导出): 支持同时导出和导入系统与用户PATH变量
- 重构导出功能,将系统变量和用户变量合并到单个JSON文件中
- 重构导入功能,支持解析包含系统变量和用户变量的JSON文件
- 在导入时提供选项让用户选择导入目标(系统变量、用户变量或全部)
- 更新UI交互逻辑,适配新的导入导出数据结构
- 改进JSON文件格式,包含版本信息和导出时间戳
2026-03-26 12:16:48 +08:00
Serendipity 55ff64b92d docs: 更新 README 以反映新增的导入导出功能
更新功能列表,新增“导入导出”模块的说明,包括 JSON 备份/恢复和旧版 TXT 格式兼容。
更新架构说明,将“统一配置中心”修改为“热配置系统”,以反映从 C++ 头文件到 Lua 配置文件的变更。
2026-03-25 19:56:10 +08:00
2388 changed files with 133325 additions and 875 deletions
+7
View File
@@ -0,0 +1,7 @@
{
"permissions": {
"allow": [
"Bash(cmake --build build)"
]
}
}
+44
View File
@@ -1,6 +1,10 @@
# 定义项目信息
cmake_minimum_required(VERSION 3.10) cmake_minimum_required(VERSION 3.10)
project(PathEditor VERSION 3.0 LANGUAGES C) project(PathEditor VERSION 3.0 LANGUAGES C)
# 选项:是否构建测试
option(BUILD_TESTS "Build unit tests" OFF)
# 启用资源编译器以处理 .rc 文件 # 启用资源编译器以处理 .rc 文件
enable_language(RC) enable_language(RC)
@@ -14,6 +18,10 @@ set(SOURCES
src/main.c src/main.c
src/utils/string_ext.c src/utils/string_ext.c
src/utils/os_env.c src/utils/os_env.c
src/utils/safe_string.c
src/utils/logger.c
src/utils/i18n.c
src/utils/error_code.c
src/ui/ui_utils.c src/ui/ui_utils.c
src/ui/dialogs.c src/ui/dialogs.c
src/ui/main_window.c src/ui/main_window.c
@@ -22,7 +30,13 @@ set(SOURCES
src/core/app_context.c src/core/app_context.c
src/core/lua_config.c src/core/lua_config.c
src/core/import_export.c src/core/import_export.c
src/core/undo_redo.c
src/controller/callbacks.c src/controller/callbacks.c
src/controller/callbacks_basic.c
src/controller/callbacks_nav.c
src/controller/callbacks_search.c
src/controller/callbacks_io.c
src/controller/callbacks_sys.c
ico/resources.rc ico/resources.rc
) )
@@ -54,12 +68,14 @@ target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_SOURCE_DIR}/include/utils ${CMAKE_SOURCE_DIR}/include/utils
${CMAKE_SOURCE_DIR}/libs/IUP/include ${CMAKE_SOURCE_DIR}/libs/IUP/include
${CMAKE_SOURCE_DIR}/libs/lua/include ${CMAKE_SOURCE_DIR}/libs/lua/include
${CMAKE_SOURCE_DIR}/libs/gettext/include
) )
# 设置库文件搜索路径 # 设置库文件搜索路径
target_link_directories(${PROJECT_NAME} PRIVATE target_link_directories(${PROJECT_NAME} PRIVATE
${CMAKE_SOURCE_DIR}/libs/IUP ${CMAKE_SOURCE_DIR}/libs/IUP
${CMAKE_SOURCE_DIR}/libs/lua ${CMAKE_SOURCE_DIR}/libs/lua
${CMAKE_SOURCE_DIR}/libs/gettext/lib
) )
# 链接所需库 # 链接所需库
@@ -73,11 +89,15 @@ target_link_libraries(${PROJECT_NAME} PRIVATE
uuid uuid
ole32 ole32
advapi32 advapi32
intl
iconv
) )
# 编译完成后,复制程序实际需要的核心 DLL 文件到构建输出目录 # 编译完成后,复制程序实际需要的核心 DLL 文件到构建输出目录
set(IUP_REQUIRED_DLLS "${CMAKE_CURRENT_SOURCE_DIR}/libs/IUP/iup.dll") set(IUP_REQUIRED_DLLS "${CMAKE_CURRENT_SOURCE_DIR}/libs/IUP/iup.dll")
set(LUA_REQUIRED_DLLS "${CMAKE_CURRENT_SOURCE_DIR}/libs/lua/lua55.dll") set(LUA_REQUIRED_DLLS "${CMAKE_CURRENT_SOURCE_DIR}/libs/lua/lua55.dll")
set(GETTEXT_REQUIRED_DLLS "${CMAKE_CURRENT_SOURCE_DIR}/libs/gettext/bin/libintl-8.dll")
set(ICONV_REQUIRED_DLLS "${CMAKE_CURRENT_SOURCE_DIR}/libs/gettext/bin/libiconv-2.dll")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different COMMAND ${CMAKE_COMMAND} -E copy_if_different
${IUP_REQUIRED_DLLS} ${IUP_REQUIRED_DLLS}
@@ -90,3 +110,27 @@ add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
"$<TARGET_FILE_DIR:${PROJECT_NAME}>" "$<TARGET_FILE_DIR:${PROJECT_NAME}>"
COMMENT "Copying Lua DLL to build directory..." COMMENT "Copying Lua DLL to build directory..."
) )
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${GETTEXT_REQUIRED_DLLS}
"$<TARGET_FILE_DIR:${PROJECT_NAME}>"
COMMENT "Copying gettext DLL to build directory..."
)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${ICONV_REQUIRED_DLLS}
"$<TARGET_FILE_DIR:${PROJECT_NAME}>"
COMMENT "Copying iconv DLL to build directory..."
)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/locale
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/locale"
COMMENT "Copying locale directory to build directory..."
)
# 测试支持
if(BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
+26 -4
View File
@@ -6,7 +6,7 @@
## ✨ 功能特点 ## ✨ 功能特点
* **🛡️ 安全第一** * **🛡️ 安全第一**
* **自动备份**:每次保存前自动备份注册表,防止意外 * **自动备份**:每次保存前自动备份,支持自定义备份目录(默认 `%APPDATA%/PathEditor/backups/`
* **只读模式**:非管理员运行时自动切换到只读模式,防止误操作。 * **只读模式**:非管理员运行时自动切换到只读模式,防止误操作。
* **权限检测**:智能检测当前运行权限。 * **权限检测**:智能检测当前运行权限。
@@ -24,6 +24,15 @@
* **实时搜索**:顶部搜索框支持不区分大小写的实时过滤查找。 * **实时搜索**:顶部搜索框支持不区分大小写的实时过滤查找。
* **快捷键**:支持 Delete 键快速删除选中项。 * **快捷键**:支持 Delete 键快速删除选中项。
* **🔄 导入导出**
* **导出备份**:将 PATH 导出为 JSON 文件,方便备份和迁移。
* **导入恢复**:从 JSON 文件导入路径配置。
* **格式兼容**:支持旧版 TXT 格式导入。
* **🌍 多语言支持**
* 内置中文和英文界面,支持运行时切换。
* 基于 gettext 国际化框架,易于扩展其他语言。
* **便捷管理** * **便捷管理**
* **新建**:添加新路径到列表。 * **新建**:添加新路径到列表。
* 📂 **浏览**:直接从文件资源管理器选择目录添加。 * 📂 **浏览**:直接从文件资源管理器选择目录添加。
@@ -33,17 +42,30 @@
* **轻量级**:原生 C 语言编写,无臃肿依赖,运行速度极快。 * **轻量级**:原生 C 语言编写,无臃肿依赖,运行速度极快。
## 🏗 架构与二次开发 ## 🛠 架构与二次开发
本项目注重代码的模块化和可维护性,采用了经典的 **MVC 分层架构**,非常适合作为 C 语言桌面程序开发的参考: 本项目注重代码的模块化和可维护性,采用了经典的 **MVC 分层架构**,非常适合作为 C 语言桌面程序开发的参考:
* **分层设计** * **分层设计**
* `src/core/` (Model): 核心数据与业务逻辑,完全脱离 UI 框架(无任何 `<iup.h>` 依赖)。 * `src/core/` (Model): 核心数据与业务逻辑,完全脱离 UI 框架(无任何 `<iup.h>` 依赖)。
* `src/ui/` (View): 负责界面布局与组件的纯视觉展示。 * `src/ui/` (View): 负责界面布局与组件的纯视觉展示。
* `src/controller/` (Controller): 负责连接用户交互与底层数据 * `src/controller/` (Controller): 负责连接用户交互与底层数据,已按功能拆分为 6 个模块:
* `callbacks.c` - 辅助函数与上下文管理
* `callbacks_basic.c` - 基础 CRUD 操作(新建、编辑、浏览、删除)
* `callbacks_nav.c` - 导航操作(上移、下移、清理)
* `callbacks_search.c` - 搜索过滤与拖拽
* `callbacks_io.c` - 导入导出
* `callbacks_sys.c` - 系统操作(保存、取消、帮助、语言切换)
* `src/utils/` (Utils): 纯粹的底层工具类封装(系统级调用、字符串处理)。 * `src/utils/` (Utils): 纯粹的底层工具类封装(系统级调用、字符串处理)。
* **统一配置中心**:所有 UI 尺寸、间距、颜色等常量配置均提取在 `include/config.h` 中,只需修改宏定义即可轻松定制属于你的专属界面风格 * **热配置系统**:所有 UI 参数(窗口大小、按钮文本、布局间距等)均通过 `lua/config.lua` 配置,修改无需重新编译即可生效
* **国际化支持**:基于 gettext 框架,支持中英文运行时切换,语言文件位于 `locale/` 目录。
* **清晰的应用状态**:摒弃了脆弱的全局变量模式,采用 `AppContext` 统一管理应用运行时的上下文状态,通过指针传递,安全可靠。 * **清晰的应用状态**:摒弃了脆弱的全局变量模式,采用 `AppContext` 统一管理应用运行时的上下文状态,通过指针传递,安全可靠。
* **开发工具库**
* 统一错误码系统 (`utils/error_code.h`) - 11 种细分错误码
* 安全字符串函数 (`utils/safe_string.h`)
* 字符串列表封装 (`utils/string_ext.h`) - 带访问器函数的安全动态数组
* 日志系统 (`utils/logger.h`) - 支持 DEBUG/INFO/WARN/ERROR 四个级别
* 控件名称常量 (`utils/ui_constants.h`) - 集中管理所有 IUP 控件名称
## 📦 下载与安装 ## 📦 下载与安装
+275
View File
@@ -0,0 +1,275 @@
# PathEditor 代码审查修复日志
> 审查日期:2026-04-28
> 审查范围:全项目代码质量审查
> 修复状态:29/29 已完成
---
## 一、高严重度问题(7 项)
### 1.1 add_string_list 中 realloc 失败导致内存泄漏
- **文件**`src/utils/string_ext.c`
- **问题**`realloc` 返回 NULL 时,原 `list->items` 指针被覆盖为 NULL,导致原有数组及其中所有字符串指针永久泄漏
- **修复**:使用临时变量保存 `realloc` 结果,失败时保留原数据不变
```c
// 修复前
list->items = (char **)realloc(list->items, list->capacity * sizeof(char *));
// 修复后
char **new_items = (char **)realloc(list->items, new_capacity * sizeof(char *));
if (!new_items)
return; // 失败时保留原数据
list->items = new_items;
```
### 1.2 add_string_list 中 _strdup 失败未检查
- **文件**`src/utils/string_ext.c`
- **问题**`_strdup` 可能返回 NULL,但代码未检查就存入数组并递增 count,后续字符串操作会崩溃
- **修复**:检查 `_strdup` 返回值,失败时不递增 count
### 1.3 string_list_set 中先 free 后 strdup 导致数据丢失
- **文件**`src/utils/string_ext.c`
- **问题**:先释放旧字符串,然后 `_strdup` 可能失败,导致旧数据丢失且无法恢复
- **修复**:先调用 `_strdup` 获取新字符串,成功后再释放旧字符串
### 1.4 wcsftime 缓冲区大小以字节而非宽字符数传入
- **文件**`src/utils/os_env.c`
- **问题**`sizeof(timestamp)` 返回字节数(128),而 `wcsftime` 期望宽字符数(64),可能导致栈缓冲区溢出
- **修复**:改用 `sizeof(timestamp) / sizeof(timestamp[0])`
```c
// 修复前
wcsftime(timestamp, sizeof(timestamp), L"%Y%m%d_%H%M%S", tm_info);
// 修复后
wcsftime(timestamp, sizeof(timestamp) / sizeof(timestamp[0]), L"%Y%m%d_%H%M%S", &tm_info);
```
### 1.5 load_single_path 在 malloc 失败时仍返回 ERR_OK
- **文件**`src/core/registry_service.c`
- **问题**`malloc` 失败时跳过数据读取,但仍返回 `ERR_OK`,调用者认为加载成功
- **修复**`malloc` 失败时返回 `ERR_OUT_OF_MEMORY`
### 1.6 导入数据内存泄漏
- **文件**`src/controller/callbacks_io.c`
- **问题**`btn_import_cb``ExportData imported``system``user` 从未调用 `clear_string_list` 释放
- **修复**:在函数所有返回路径前调用 `clear_string_list` 释放导入数据
### 1.7 JSON 导入解析器完全失效
- **文件**`src/core/import_export.c`
- **问题**:键名检测逻辑被 `in_string` 状态翻转拦截,`"system"``"user"` 的检测永远无法触发
- **修复**:重写 JSON 解析器,在字符串结束时检测键名,合并重复的数组解析逻辑
---
## 二、中严重度问题(9 项)
### 2.1 backup_registry 部分备份成功时错误报告为完全成功
- **文件**`src/utils/os_env.c`
- **修复**:分别跟踪系统和用户 PATH 的备份状态
### 2.2 btn_ok_cb 未检查 backup_registry 返回值
- **文件**`src/controller/callbacks_sys.c`
- **修复**:检查返回值,备份失败时提示用户是否继续保存
```c
// 修复后
ErrorCode backup_result = backup_registry();
if (backup_result != ERR_OK)
{
int choice = IupAlarm("警告", "备份失败!是否继续保存?",
"继续保存", "取消", NULL);
if (choice != 1)
return IUP_DEFAULT;
}
```
### 2.3 TABTITLE 设置在 Dialog 而非 Tabs 控件上
- **文件**`src/ui/main_window.c`
- **问题**`TABTITLE0``TABTITLE1``IupTabs` 属性,不是 `IupDialog` 属性,导致语言切换后选项卡标题不更新
- **修复**:先获取 Tabs 控件句柄,再设置 TABTITLE
### 2.4 list_dropfiles_cb 使用 ANSI 版本 API
- **文件**`src/controller/callbacks_search.c`
- **问题**`GetFileAttributesA` 无法正确处理中文等 Unicode 字符路径
- **修复**:改用 `utf8_to_wide` + `GetFileAttributesW`
### 2.5 load_all_paths 用户路径加载失败时未通知用户
- **文件**`src/controller/callbacks_sys.c`
- **修复**:添加 else 分支,在用户路径加载失败时弹出提示
### 2.6 escape_json_string 未处理所有控制字符
- **文件**`src/core/import_export.c`
- **问题**:只处理了 `\\``"``\n``\r``\t`,其他 0x00-0x1F 控制字符未转义
- **修复**:添加 `\b``\f` 处理,其他控制字符使用 `\uXXXX` 格式
### 2.7 CreateDirectoryW 不创建中间目录
- **文件**`src/utils/os_env.c`
- **修复**:改用 `SHCreateDirectoryExW` 递归创建目录
### 2.8 ExportData 浅拷贝隐患
- **文件**`include/core/import_export.h`
- **修复**:添加文档注释说明只读语义,防止误用 `clear_string_list`
### 2.9 export_paths_to_file 未检查 fprintf 返回值
- **文件**`src/core/import_export.c`
- **修复**:在 `fclose` 后检查 `ferror(fp)`,发现错误时返回 `ERR_FAILED`
---
## 三、低严重度问题(13 项)
### 3.1 JSON 解析器代码重复
- **文件**`src/core/import_export.c`
- **修复**:合并 system/user 数组解析逻辑为统一的键名检测机制
### 3.2 get_app_context_from_dlg 依赖指针到字符串的不安全转换
- **状态**:保留现状(IUP 框架标准用法)
### 3.3 putenv 使用字符串字面量的可移植性问题
- **文件**`src/main.c`
- **修复**:改用 `_wputenv_s`
### 3.4 path_manager_clean 时间复杂度为 O(n³)
- **文件**`src/core/path_manager.c`
- **修复**:使用标记+批量删除优化为 O(n²)
### 3.5 全局日志状态非线程安全
- **状态**:保留现状(当前是单线程 GUI 应用)
### 3.6 localtime 返回静态缓冲区指针,非线程安全
- **文件**`src/utils/os_env.c``src/core/import_export.c`
- **修复**:改用 `localtime_s`
### 3.7 JSON 解析器原地修改输入缓冲区
- **修复**:重写解析器时已解决,不再修改原始缓冲区
### 3.8 JSON 解析器对 `\\"` 场景处理错误
- **修复**:重写解析器时已解决,使用 `is_quote_escaped` 检查连续反斜杠
### 3.9 TXT 格式导入只能导入到系统路径
- **文件**`src/controller/callbacks_io.c`
- **修复**:添加选择对话框,允许用户选择导入到系统变量或用户变量
### 3.10 trim_whitespace 未检查 NULL 输入
- **文件**`src/core/import_export.c`
- **修复**:添加防御性 NULL 检查
### 3.11 is_json_file 使用 strcasecmp 限制可移植性
- **文件**`src/core/import_export.c`
- **修复**:改用 `_stricmp`MSVC/MinGW 都支持)
### 3.12 localtime 可能返回 NULL
- **修复**:改用 `localtime_s`,无需 NULL 检查
### 3.13 main.c 中 _() 嵌套调用可能崩溃
- **文件**`src/main.c`
- **问题**`_(lua_config_get_string(...))` 嵌套调用,若配置键不存在,`gettext(NULL)` 行为未定义
- **修复**:先将结果保存到临时变量并检查非 NULL
```c
// 修复前
IupMessage(_("Warning"), _(lua_config_get_string("status", "admin_warning")));
// 修复后
const char *admin_msg = lua_config_get_string("status", "admin_warning");
IupMessage(_("Warning"), admin_msg ? _(admin_msg) : "需要管理员权限才能编辑环境变量");
```
---
## 四、第一轮修复(原10条锐评)
| # | 问题 | 状态 |
|---|------|------|
| 1 | core层用了iup.h(架构矛盾) | ✅ 已修复 |
| 2 | main.c管理员权限检测代码灾难 | ✅ 已修复 |
| 3 | refresh_main_window_ui重复代码 | ✅ 已修复 |
| 4 | 字符串溢出风险(buffer不统一) | ✅ 已修复 |
| 5 | 错误码乱用(ERR_NULL_PTR误用) | ✅ 已修复 |
| 6 | 硬编码字符串满天飞 | ✅ 已修复 |
| 7 | backup_registry未实现 | ✅ 已修复 |
| 8 | callbacks.c 600行回调地狱 | ✅ 已拆分 |
| 9 | StringList封装不透明 | ✅ 已修复 |
| 10 | refresh_single_list_style黑盒 | ✅ 已修复 |
---
## 五、修改文件清单
| 文件 | 修改类型 |
|------|----------|
| `include/utils/string_ext.h` | 添加访问器函数声明 |
| `include/utils/ui_constants.h` | 新建,控件名称常量 |
| `include/core/import_export.h` | 添加文档注释 |
| `include/controller/callbacks_internal.h` | 新建,内部辅助函数声明 |
| `src/utils/string_ext.c` | 修复 realloc/strdup 安全性 |
| `src/utils/os_env.c` | 修复 wcsftime、localtime、目录创建 |
| `src/core/registry_service.c` | 修复 malloc 错误处理 |
| `src/core/import_export.c` | 重写 JSON 解析器、修复转义函数 |
| `src/core/path_manager.c` | 优化清理算法、修复错误码 |
| `src/main.c` | 修复 putenv、_() 嵌套调用 |
| `src/ui/main_window.c` | 修复 TABTITLE 设置位置 |
| `src/controller/callbacks.c` | 拆分后只保留辅助函数 |
| `src/controller/callbacks_basic.c` | 新建,基础 CRUD 回调 |
| `src/controller/callbacks_nav.c` | 新建,导航回调 |
| `src/controller/callbacks_search.c` | 新建,搜索/拖拽回调 |
| `src/controller/callbacks_io.c` | 新建,导入导出回调 |
| `src/controller/callbacks_sys.c` | 新建,系统操作回调 |
| `CMakeLists.txt` | 添加新源文件 |
---
## 六、编译验证
```bash
cmake -B build -G "MinGW Makefiles"
cmake --build build
```
**结果**:编译通过,无错误,无警告。
---
## 七、剩余已知问题(设计决策,非 Bug)
| 问题 | 原因 | 建议 |
|------|------|------|
| IUP 指针存储模式 | IUP 框架标准用法 | 保持现状 |
| 日志线程安全 | 当前是单线程应用 | 多线程时再处理 |
| localtime 线程安全 | 已改用 localtime_s | 已修复 |
---
*审查完成于 2026-04-28*
@@ -0,0 +1,422 @@
# 撤销/重做 UI 集成 — 实现计划
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** 将已完成的撤销/重做后端逻辑暴露到 UI 层——添加撤销/重做按钮及 Ctrl+Z/Ctrl+Y 快捷键
**Architecture:** 在现有 MVC 架构上,新增两个按钮回调(`btn_undo_cb`/`btn_redo_cb`),它们调用 `undo_redo.c` 中已有的 `undo()`/`redo()` 函数,然后同步 UI 列表。Ctrl+Z/Y 快捷键在 `list_k_any_cb` 中检测并分发到对应的按钮回调。
**Tech Stack:** C17, IUP GUI, GCC/MinGW-w64
---
## 文件结构
| 操作 | 文件 | 职责 |
|------|------|------|
| 修改 | `include/utils/ui_constants.h` | 新增 2 个按钮名称常量 |
| 修改 | `include/controller/callbacks.h` | 声明 `btn_undo_cb` / `btn_redo_cb` |
| 修改 | `src/controller/callbacks_nav.c` | 实现 `btn_undo_cb` / `btn_redo_cb``list_k_any_cb` 增加 Ctrl+Z/Y |
| 修改 | `src/ui/main_window.c` | 创建撤销/重做按钮,加入布局,绑定回调 |
| 修改 | `lua/config.lua` | 新增 `button.undo` / `button.redo` 配置 |
| 修改 | `po/zh_CN.po` | 新增 "Undo"→"撤销" / "Redo"→"重做" 翻译 |
| 修改 | `po/en_US.po` | 新增 "Undo"→"Undo" / "Redo"→"Redo" 翻译 |
| 修改 | `po/messages.pot` | 新增 msgid 条目 |
| 重新生成 | `locale/zh_CN/LC_MESSAGES/zh_CN.mo` | msgfmt 编译 |
| 重新生成 | `locale/en_US/LC_MESSAGES/en_US.mo` | msgfmt 编译 |
---
### Task 1: 添加 UI 常量
**Files:**
- Modify: `include/utils/ui_constants.h`
- [ ] **Step 1: 在 ui_constants.h 添加按钮常量**
`CTRL_BTN_LANG` 之后、`#endif` 之前添加:
```c
// 撤销/重做按钮
#define CTRL_BTN_UNDO "BTN_UNDO"
#define CTRL_BTN_REDO "BTN_REDO"
```
- [ ] **Step 2: 提交**
```bash
git add include/utils/ui_constants.h
git commit -m "feat(undo): 添加撤销/重做按钮的 UI 常量"
```
---
### Task 2: 声明回调函数
**Files:**
- Modify: `include/controller/callbacks.h`
- [ ] **Step 1: 在 callbacks.h 声明新回调函数**
`btn_lang_cb` 声明之后、搜索回调声明之前添加:
```c
// 撤销/重做回调
int btn_undo_cb(Ihandle *self);
int btn_redo_cb(Ihandle *self);
```
- [ ] **Step 2: 提交**
```bash
git add include/controller/callbacks.h
git commit -m "feat(undo): 声明撤销/重做按钮回调函数"
```
---
### Task 3: 实现撤销/重做回调逻辑
**Files:**
- Modify: `src/controller/callbacks_nav.c`
> 需要新增的 include`#include "core/app_context.h"`(已存在)、`#include "ui/ui_utils.h"`(已存在)
- [ ] **Step 1: 在 callbacks_nav.c 头部添加 app_context 头文件引用**
检查第 3 行已有 `#include "core/undo_redo.h"`,第 10 行已有 `#include "utils/ui_constants.h"`。确认无需添加新的 include。
- [ ] **Step 2: 添加刷新撤销/重做按钮状态的辅助函数**
在文件末尾 `list_k_any_cb` 之前添加:
```c
// 刷新撤销/重做按钮的启用状态
static void refresh_undo_redo_buttons(Ihandle *dlg)
{
AppContext *ctx = get_app_context_from_dlg(dlg);
if (!ctx || !ctx->undo_redo_mgr)
return;
Ihandle *btn_undo = IupGetDialogChild(dlg, CTRL_BTN_UNDO);
Ihandle *btn_redo = IupGetDialogChild(dlg, CTRL_BTN_REDO);
if (btn_undo)
IupSetAttribute(btn_undo, "ACTIVE", can_undo(ctx->undo_redo_mgr) ? "YES" : "NO");
if (btn_redo)
IupSetAttribute(btn_redo, "ACTIVE", can_redo(ctx->undo_redo_mgr) ? "YES" : "NO");
}
```
- [ ] **Step 3: 实现 btn_undo_cb**
`refresh_undo_redo_buttons` 之后添加:
```c
int btn_undo_cb(Ihandle *self)
{
Ihandle *dlg = IupGetDialog(self);
AppContext *ctx = get_app_context_from_dlg(dlg);
if (!ctx || !ctx->undo_redo_mgr)
return IUP_DEFAULT;
if (!can_undo(ctx->undo_redo_mgr))
return IUP_DEFAULT;
undo(ctx->undo_redo_mgr, &ctx->sys_paths, &ctx->user_paths);
Ihandle *list_sys = IupGetDialogChild(dlg, CTRL_LIST_SYS);
Ihandle *list_user = IupGetDialogChild(dlg, CTRL_LIST_USER);
sync_string_list_to_ui(list_sys, &ctx->sys_paths);
sync_string_list_to_ui(list_user, &ctx->user_paths);
Ihandle *lbl_status = IupGetDialogChild(dlg, CTRL_LBL_STATUS);
if (lbl_status)
IupSetAttribute(lbl_status, "TITLE", _("Undo completed"));
refresh_undo_redo_buttons(dlg);
return IUP_DEFAULT;
}
```
- [ ] **Step 4: 实现 btn_redo_cb**
`btn_undo_cb` 之后添加:
```c
int btn_redo_cb(Ihandle *self)
{
Ihandle *dlg = IupGetDialog(self);
AppContext *ctx = get_app_context_from_dlg(dlg);
if (!ctx || !ctx->undo_redo_mgr)
return IUP_DEFAULT;
if (!can_redo(ctx->undo_redo_mgr))
return IUP_DEFAULT;
redo(ctx->undo_redo_mgr, &ctx->sys_paths, &ctx->user_paths);
Ihandle *list_sys = IupGetDialogChild(dlg, CTRL_LIST_SYS);
Ihandle *list_user = IupGetDialogChild(dlg, CTRL_LIST_USER);
sync_string_list_to_ui(list_sys, &ctx->sys_paths);
sync_string_list_to_ui(list_user, &ctx->user_paths);
Ihandle *lbl_status = IupGetDialogChild(dlg, CTRL_LBL_STATUS);
if (lbl_status)
IupSetAttribute(lbl_status, "TITLE", _("Redo completed"));
refresh_undo_redo_buttons(dlg);
return IUP_DEFAULT;
}
```
- [ ] **Step 5: 修改 list_k_any_cb 添加 Ctrl+Z / Ctrl+Y 检测**
将现有的 `list_k_any_cb` 函数(第 149-164 行)替换为:
```c
int list_k_any_cb(Ihandle *self, int c)
{
if (IupGetInt(self, "ACTIVE") == 0)
return IUP_DEFAULT;
if (c == K_cZ) // Ctrl+Z 撤销
{
btn_undo_cb(self);
return IUP_IGNORE;
}
if (c == K_cY) // Ctrl+Y 重做
{
btn_redo_cb(self);
return IUP_IGNORE;
}
if (c == K_DEL) // DEL 键
{
btn_del_cb(self);
return IUP_IGNORE;
}
return IUP_DEFAULT;
}
```
- [ ] **Step 6: 提交**
```bash
git add src/controller/callbacks_nav.c
git commit -m "feat(undo): 实现撤销/重做按钮回调及 Ctrl+Z/Y 快捷键"
```
---
### Task 4: 在 UI 中添加撤销/重做按钮
**Files:**
- Modify: `src/ui/main_window.c`
- [ ] **Step 1: 在 main_window.c 头部添加 app_context 引用**
检查当前 include。如果尚未包含 `<iupkey.h>`,需要在 `#include <iup.h>` 之后添加(但 iup.h 通常已包含 iupkey.h)。确认无需新增 include。
- [ ] **Step 2: 创建撤销/重做按钮并绑定回调**
`btn_down` 按钮创建之后(第 67 行附近)、`btn_clean` 之前,添加新按钮:
```c
Ihandle *btn_undo = IupButton(_(lua_config_get_string("button", "undo")), NULL);
IupSetAttribute(btn_undo, "NAME", CTRL_BTN_UNDO);
IupSetAttribute(btn_undo, "ACTIVE", "NO"); // 初始无操作可撤销
Ihandle *btn_redo = IupButton(_(lua_config_get_string("button", "redo")), NULL);
IupSetAttribute(btn_redo, "NAME", CTRL_BTN_REDO);
IupSetAttribute(btn_redo, "ACTIVE", "NO"); // 初始无操作可重做
```
- [ ] **Step 3: 设置按钮回调**
在现有按钮回调设置区域(第 84-93 行),`btn_down` 回调之后添加:
```c
IupSetCallback(btn_undo, "ACTION", (Icallback)btn_undo_cb);
IupSetCallback(btn_redo, "ACTION", (Icallback)btn_redo_cb);
```
- [ ] **Step 4: 设置按钮大小**
在按钮大小设置区域(第 96-106 行),`btn_export` 之后添加:
```c
IupSetAttribute(btn_undo, "RASTERSIZE", btn_size);
IupSetAttribute(btn_redo, "RASTERSIZE", btn_size);
```
- [ ] **Step 5: 将按钮加入垂直布局**
修改 `vbox_btns` 布局(第 109-118 行),在 `btn_up, btn_down` 之后、`NULL` 之前加入 `btn_undo, btn_redo`
```c
Ihandle *vbox_btns = IupVbox(
btn_new, btn_edit, btn_browse, btn_del,
IupFill(),
btn_clean,
IupFill(),
btn_import, btn_export,
btn_up, btn_down,
btn_undo, btn_redo,
NULL);
```
- [ ] **Step 6: 在 refresh_main_window_ui 中添加按钮文本刷新**
`refresh_main_window_ui` 函数的 `SET_CHILD_TITLE` 宏调用区域(第 198-209 行),`CTRL_BTN_EXPORT` 之后添加:
```c
SET_CHILD_TITLE(CTRL_BTN_UNDO, "undo");
SET_CHILD_TITLE(CTRL_BTN_REDO, "redo");
```
- [ ] **Step 7: 提交**
```bash
git add src/ui/main_window.c
git commit -m "feat(undo): 在 UI 中添加撤销/重做按钮并集成布局"
```
---
### Task 5: 更新 Lua 配置
**Files:**
- Modify: `lua/config.lua`
- [ ] **Step 1: 在 config.lua 的 button 表中添加 undo 和 redo**
`button` 表的 `help = "Help"` 之后添加:
```lua
undo = "Undo",
redo = "Redo",
```
- [ ] **Step 2: 提交**
```bash
git add lua/config.lua
git commit -m "feat(undo): 在 Lua 配置中添加撤销/重做按钮文本"
```
---
### Task 6: 更新翻译文件
**Files:**
- Modify: `po/zh_CN.po`
- Modify: `po/en_US.po`
- Modify: `po/messages.pot`
- [ ] **Step 1: 在 zh_CN.po 中添加翻译条目**
在 "Clean Invalid" 条目之后、其他条目之前插入:
```
#: src/ui/main_window.c
msgid "Undo"
msgstr "撤销"
#: src/ui/main_window.c
msgid "Redo"
msgstr "重做"
```
以及状态栏消息:
```
#: src/controller/callbacks_nav.c
msgid "Undo completed"
msgstr "已撤销"
#: src/controller/callbacks_nav.c
msgid "Redo completed"
msgstr "已重做"
```
- [ ] **Step 2: 在 en_US.po 中添加翻译条目**
```
#: src/ui/main_window.c
msgid "Undo"
msgstr "Undo"
#: src/ui/main_window.c
msgid "Redo"
msgstr "Redo"
#: src/controller/callbacks_nav.c
msgid "Undo completed"
msgstr "Undo completed"
#: src/controller/callbacks_nav.c
msgid "Redo completed"
msgstr "Redo completed"
```
- [ ] **Step 3: 在 messages.pot 中添加翻译模板条目**
```
#: src/ui/main_window.c
msgid "Undo"
msgstr ""
#: src/ui/main_window.c
msgid "Redo"
msgstr ""
#: src/controller/callbacks_nav.c
msgid "Undo completed"
msgstr ""
#: src/controller/callbacks_nav.c
msgid "Redo completed"
msgstr ""
```
- [ ] **Step 4: 重新编译 .mo 文件**
```bash
cd D:/Code/doing_exercises/programs/PathEditor
msgfmt po/zh_CN.po -o locale/zh_CN/LC_MESSAGES/zh_CN.mo
msgfmt po/en_US.po -o locale/en_US/LC_MESSAGES/en_US.mo
```
- [ ] **Step 5: 提交**
```bash
git add po/zh_CN.po po/en_US.po po/messages.pot locale/zh_CN/LC_MESSAGES/zh_CN.mo locale/en_US/LC_MESSAGES/en_US.mo
git commit -m "feat(undo): 添加撤销/重做的中英文翻译"
```
---
### Task 7: 编译验证
- [ ] **Step 1: 编译项目**
```bash
cd D:/Code/doing_exercises/programs/PathEditor
cmake --build build
```
预期输出:编译成功,无错误无警告。
- [ ] **Step 2: 功能验证清单**
1. 启动程序,确认出现「撤销」「重做」按钮
2. 新建一条路径 → 撤销按钮变可用 → 点击撤销 → 路径消失 → 重做按钮变可用
3. 按 Ctrl+Z 撤销 → Ctrl+Y 重做
4. 删除一条路径 → 撤销恢复 → 重做再次删除
5. 无历史记录时,撤销/重做按钮灰色不可点击
6. 语言切换后按钮文本正确切换
@@ -0,0 +1,37 @@
# 全局快捷键 — 设计文档
## 背景
Ctrl+Z/Y 撤销/重做已在功能 1 中实现(列表级 K_ANY)。新增 Ctrl+N/S/F 作为对话框级的全局快捷键。
## 目标
添加三个全局快捷键:`Ctrl+N` 新建、`Ctrl+S` 保存、`Ctrl+F` 聚焦搜索框。
## 改动文件
| 文件 | 改动 |
|------|------|
| `include/controller/callbacks.h` | 声明 `dlg_k_any_cb` |
| `src/controller/callbacks_sys.c` | 实现 `dlg_k_any_cb` |
| `src/ui/main_window.c` | 对话框注册 `K_ANY` 回调 |
## 核心逻辑
```
dlg_k_any_cb(dlg, c):
if c == K_cN → btn_new_cb(dlg)
if c == K_cS → btn_ok_cb(dlg)
if c == K_cF → IupSetFocus(txt_search)
else → IUP_DEFAULT
```
## 快捷键传播
IUP 键盘事件从子控件向父控件传播。列表的 `list_k_any_cb`Ctrl+Z/Y/DEL)返回 `IUP_IGNORE` 阻止传播;未识别的键返回 `IUP_DEFAULT` 使事件继续传播到对话框的 `dlg_k_any_cb`
## 不做的事
- 不新增翻译条目
- 不修改 Lua 配置
- 列表级 `K_ANY` 保持不变
@@ -0,0 +1,65 @@
# 撤销/重做 UI 集成 — 设计文档
## 背景
撤销/重做后端(`src/core/undo_redo.c`)已完整实现,支持 7 种操作类型的记录与回滚。所有 UI 操作(新建/编辑/删除/上移/下移/清理)均已调用 `push_undo_record()` 写入历史。但 `undo()``redo()` 函数未被任何 UI 代码调用——用户无法触发撤销或重做。
## 目标
在界面上添加撤销/重做按钮,并绑定 Ctrl+Z / Ctrl+Y 快捷键,让用户可以回退和恢复操作。
## 改动文件
| 文件 | 改动内容 |
|------|---------|
| `include/utils/ui_constants.h` | 新增 `CTRL_BTN_UNDO``CTRL_BTN_REDO` 常量 |
| `src/ui/main_window.c` | 创建撤销/重做按钮,绑定回调,调整布局 |
| `src/controller/callbacks_nav.c` | 新增 `btn_undo_cb``btn_redo_cb``list_k_any_cb` 增加 Ctrl+Z/Y 检测 |
| `lua/config.lua` | 新增 `button.undo``button.redo` 配置项 |
| `locale/` 翻译文件 | 同步新增按钮的中英文翻译 |
## 核心逻辑
```
btn_undo_cb(dlg):
ctx = get_app_context_from_dlg(dlg)
if !can_undo(ctx->undo_redo_mgr): return
undo(ctx->undo_redo_mgr, &ctx->sys_paths, &ctx->user_paths)
sync both lists to UI
update undo/redo button enabled state
btn_redo_cb(dlg):
同上,调用 redo()
list_k_any_cb:
新增分支:
if c == K_cZ → btn_undo_cb
if c == K_cY → btn_redo_cb
```
## 按钮布局
撤销/重做按钮放在上移/下移按钮下方:
```
[新建] [编辑]
[浏览] [删除]
(分隔)
[一键清理]
(分隔)
[导入] [导出]
[上移] [下移]
[撤销] [重做] ← 新增
```
## 按钮状态
- `can_undo() == false` → 撤销按钮 `ACTIVE=NO`
- `can_redo() == false` → 重做按钮 `ACTIVE=NO`
- 每次 undo/redo 执行后刷新按钮状态
## 不做的事
- 不修改 `undo_redo.c` 后端代码(已完备)
- 不添加操作历史面板(保持简洁,通过按钮状态反馈即可)
- 不在保存后清空历史(当前设计由 `clear_undo_redo_history` 决定,保持现有行为)
@@ -0,0 +1,170 @@
# 1. 问题
这个问题位于系统 PATH 保存回调与注册表备份工具之间的交界处。当前实现虽然在保存前调用了备份,但备份结果没有进入成功失败判断,导致“先备份再写入”只剩下调用顺序,没有形成真正的安全护栏。
## 1.1. **备份没有成为保存前置条件**
`src/controller/callbacks_sys.c:25-34``btn_ok_cb` 在管理员校验后直接调用 `backup_registry()`,随后继续执行 `save_system_paths``save_user_paths`。这里最大的问题不是“没做备份”,而是“做了也等于没做校验”。
```c
if (!check_admin())
{
IupMessage("错误", "需要管理员权限才能保存更改!");
return IUP_DEFAULT;
}
backup_registry();
ErrorCode sys_ok = save_system_paths(&ctx->sys_paths);
ErrorCode user_ok = save_user_paths(&ctx->user_paths);
```
这会带来两个直接后果:
- 备份目录创建失败、备份文件打开失败、注册表读取失败时,保存流程仍然继续。
- 用户看到的只是“保存成功”或“保存失败”,看不到“备份失败但仍然写入”的中间状态。
对于修改系统 PATH 这类高风险操作,备份不是可有可无的副作用,而应该是明确的前置步骤。否则一旦写入结果不符合预期,用户既没有可靠回退副本,也很难知道问题发生在哪一段。
## 1.2. **备份函数的失败语义过于粗糙**
`src/utils/os_env.c:50-131``backup_registry` 把多个失败场景都折叠成 `ERR_FAILED`,而且只用一个 `success` 标记表示“系统 PATH 或用户 PATH 只要有一处写入成功即可”。这让调用方几乎无法做出正确反馈。
```c
if (SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, 0, appdata_path) != S_OK)
{
return ERR_FAILED;
}
FILE *fp = _wfopen(backup_file, L"w, ccs=UTF-8");
if (!fp)
return ERR_FAILED;
...
return success ? ERR_OK : ERR_FAILED;
```
这里的问题有两层:
- 调用方拿不到失败原因,界面层只能给出笼统提示。
- 备份结果粒度太粗,后续如果要区分“文件系统失败”“系统 PATH 读取失败”“用户 PATH 读取失败”,需要再次拆函数,改动会扩散。
这类错误语义粗糙的问题,短期看只是提示不够友好,长期看会让保存链路的错误处理越来越分散。
# 2. 收益
把备份纳入保存链路的显式校验后,PATH 修改流程会从“尽力而为”变成“可判断、可阻断、可回退”。
## 2.1. **降低误写后无法回退的风险**
当前最危险的情况,是备份失败但注册表写入成功。调整后,保存前先确认备份成功,能直接消除这条风险路径。对系统 PATH 这种会影响命令行、编译器和工具链的配置,这个收益是最核心的。
## 2.2. **让失败位置更容易定位**
现在保存链路里至少有 **3** 个备份失败点:目录准备、文件创建、注册表读取。把这些失败显式返回后,界面层和日志可以明确知道失败发生在保存前,而不是笼统归为“保存异常”。
## 2.3. **减少后续错误处理分散**
把备份检查集中到保存入口,可以让 `btn_ok_cb` 成为统一决策点。后续如果要加入“跳过备份需二次确认”或“导出备份路径”,只需要在一个入口扩展,而不是在多个保存分支里补判断。
# 3. 方案
总体思路是:把备份从隐式副作用改成显式的保存前置步骤,同时把备份失败原因转换成 UI 可消费的信息。
## 3.1. **引入保存前置校验:解决“备份没有成为保存前置条件”**
方案核心是为 `btn_ok_cb` 增加一个明确的“准备保存”阶段。只有备份成功,后续系统 PATH 和用户 PATH 的写入才允许继续。
实施步骤:
- 在控制层增加 `ErrorCode backup_ok = backup_registry();` 的显式判断。
- 当备份失败时,立即记录日志、更新状态栏并弹出错误提示,然后提前返回。
- 将“广播环境变量变更”和“保存成功提示”保留在备份成功且写入成功之后。
修改前:
```c
backup_registry();
ErrorCode sys_ok = save_system_paths(&ctx->sys_paths);
ErrorCode user_ok = save_user_paths(&ctx->user_paths);
```
修改后(实际实现):
```c
ErrorCode backup_result = backup_registry();
if (backup_result != ERR_OK)
{
log_error("Backup failed: error code %d", backup_result);
int choice = IupAlarm("警告", "备份失败!是否继续保存?\n(继续保存可能导致无法恢复)",
"继续保存", "取消", NULL);
if (choice != 1)
return IUP_DEFAULT;
}
ErrorCode sys_ok = save_system_paths(&ctx->sys_paths);
ErrorCode user_ok = save_user_paths(&ctx->user_paths);
```
实际实现采用了更灵活的策略:备份失败时给予用户选择权,而非直接阻断。这样既保留了安全护栏(默认提示风险),又允许用户在确认有其他备份时继续操作。
## 3.2. **细化备份结果表达:解决“备份函数的失败语义过于粗糙”**
短期内不必大改架构,建议先做一层轻量封装,把 `backup_registry` 的失败点映射到更明确的错误码或消息文本。这样可以在不改动主流程结构的前提下,把错误反馈补齐。
实施步骤:
- 为备份过程补充更细的返回值,至少区分“目录或路径获取失败”“文件打开失败”“注册表读取失败”。
- 若暂时不扩展 `ErrorCode` 枚举,可新增 `backup_registry_with_message(char *buf, size_t len)` 一类包装函数,专门给控制层提供可展示的失败原因。
- 保持注册表读写逻辑仍在工具层,避免控制层直接拼装底层错误文本。
修改前:
```c
if (!fp)
return ERR_FAILED;
...
return success ? ERR_OK : ERR_FAILED;
```
修改后(实际实现):
```c
// 使用 SHCreateDirectoryExW 递归创建目录,解决中间目录不存在的问题
SHCreateDirectoryExW(NULL, backup_dir, NULL);
// localtime_s 替代 localtime,提升线程安全性
struct tm tm_info;
localtime_s(&tm_info, &t);
wcsftime(timestamp, sizeof(timestamp) / sizeof(timestamp[0]), L"%Y%m%d_%H%M%S", &tm_info);
```
实际实现暂未扩展细粒度错误码,但已通过以下方式改进:
- 使用 `SHCreateDirectoryExW` 递归创建目录,解决中间目录不存在的问题
- 使用 `localtime_s` 替代 `localtime`,提升线程安全性
- 通过日志记录具体失败原因,便于问题定位
后续可考虑扩展 `ErrorCode` 枚举以区分不同失败场景。
# 4. 回归范围
这次调整影响的是“点击确定后的保存链路”,重点要从用户完整操作流程看:备份是否先发生、备份失败是否阻断写入、写入成功后是否仍能正常广播环境变量变更。
## 4.1. 主链路
- 正常编辑系统 PATH 和用户 PATH后点击“确定”。
- 预期先生成备份,再分别写入系统和用户 PATH。
- 写入成功后,状态栏、成功提示和环境变量广播行为保持不变。
建议重点检查以下业务结果:
- 备份文件是否实际生成。
- 成功提示是否只在备份成功且写入完成后出现。
- 写入后新开的命令行窗口是否能读取最新 PATH。
## 4.2. 边界情况
- 备份目录无法创建:应立即终止保存,注册表值保持不变,界面给出明确错误提示。
- 备份文件无法打开:应立即终止保存,避免出现“没有备份但已经写入”的状态。
- 系统或用户 PATH 读取失败:应视策略决定是否整体阻断。若当前目标是“完整备份后再保存”,则任一关键读取失败都应阻断。
- 仅保存阶段失败:备份已经成功生成时,仍要验证现有失败提示是否准确,避免把备份失败和写入失败混为一类。
+7
View File
@@ -16,6 +16,12 @@ int btn_export_cb(Ihandle *self);
int btn_ok_cb(Ihandle *self); int btn_ok_cb(Ihandle *self);
int btn_cancel_cb(Ihandle *self); int btn_cancel_cb(Ihandle *self);
int btn_help_cb(Ihandle *self); int btn_help_cb(Ihandle *self);
int btn_lang_cb(Ihandle *self);
int darkmode_cb(Ihandle *self);
// 撤销/重做回调
int btn_undo_cb(Ihandle *self);
int btn_redo_cb(Ihandle *self);
// 搜索回调 // 搜索回调
int txt_search_cb(Ihandle *self); int txt_search_cb(Ihandle *self);
@@ -28,6 +34,7 @@ int list_dropfiles_cb(Ihandle *self, const char *filename, int num, int x, int y
// 键盘按键回调 // 键盘按键回调
int list_k_any_cb(Ihandle *self, int c); int list_k_any_cb(Ihandle *self, int c);
int dlg_k_any_cb(Ihandle *self, int c);
// 载入数据与更新UI // 载入数据与更新UI
void load_all_paths(void); void load_all_paths(void);
+29
View File
@@ -0,0 +1,29 @@
#ifndef CALLBACKS_INTERNAL_H
#define CALLBACKS_INTERNAL_H
#include <iup.h>
#include "core/app_context.h"
#include "utils/i18n.h"
// 内部辅助函数声明(供各 callbacks_*.c 文件共享)
// 这些函数不对外暴露,仅在 controller 层内部使用
// 获取主对话框句柄
Ihandle *get_main_dlg(void);
// 从对话框获取应用上下文
AppContext *get_app_context_from_dlg(Ihandle *dlg);
// 获取当前活动的数据列表(根据 Tab 页切换)
StringList *get_current_raw_data(Ihandle *dlg);
// 获取当前活动的列表 UI 控件
Ihandle *get_current_list(Ihandle *dlg);
// 刷新撤销/重做按钮的启用状态
void refresh_undo_redo_buttons(Ihandle *dlg);
// 同步合并预览列表
void sync_merged_list(Ihandle *dlg);
#endif // CALLBACKS_INTERNAL_H
+2 -4
View File
@@ -2,12 +2,13 @@
#define APP_CONTEXT_H #define APP_CONTEXT_H
#include "utils/string_ext.h" #include "utils/string_ext.h"
#include <iup.h> #include "core/undo_redo.h"
// 应用上下文结构体,用于存储应用运行时的状态 // 应用上下文结构体,用于存储应用运行时的状态
typedef struct { typedef struct {
StringList sys_paths; StringList sys_paths;
StringList user_paths; StringList user_paths;
UndoRedoManager *undo_redo_mgr; // 撤销/重做管理器
} AppContext; } AppContext;
// 创建应用上下文 // 创建应用上下文
@@ -16,7 +17,4 @@ AppContext* create_app_context(void);
// 销毁应用上下文 // 销毁应用上下文
void destroy_app_context(AppContext* ctx); void destroy_app_context(AppContext* ctx);
// 获取应用上下文
AppContext* get_app_context(Ihandle *ih);
#endif // APP_CONTEXT_H #endif // APP_CONTEXT_H
+24 -3
View File
@@ -2,13 +2,34 @@
#define IMPORT_EXPORT_H #define IMPORT_EXPORT_H
#include "utils/string_ext.h" #include "utils/string_ext.h"
#include "utils/error_code.h"
#define EXPORT_VERSION "1.0" #define EXPORT_VERSION "1.0"
// 导出 PATH 到文件 // 导出数据类型
int export_paths_to_file(const StringList *list, const char *filepath, int is_system); typedef enum {
EXPORT_JSON, // JSON 格式
EXPORT_CSV // CSV 格式
} ExportFormat;
// 导出数据结构
// 注意:此结构体用于导出时是只读的,items 指针指向外部 StringList 的数据
// 不要对 ExportData 调用 clear_string_list,会破坏原始数据
typedef struct {
StringList system;
StringList user;
} ExportData;
// 导出 PATH 到文件(自动根据扩展名选择格式)
ErrorCode export_paths_to_file(const ExportData *data, const char *filepath);
// 导出 PATH 到指定格式的文件
ErrorCode export_paths_to_format(const ExportData *data, const char *filepath, ExportFormat format);
// 从文件导入 PATH // 从文件导入 PATH
int import_paths_from_file(const char *filepath, StringList *list); ErrorCode import_paths_from_file(const char *filepath, ExportData *data);
// 验证路径格式是否有效
int is_valid_path_format(const char *path);
#endif // IMPORT_EXPORT_H #endif // IMPORT_EXPORT_H
+7
View File
@@ -31,4 +31,11 @@ int lua_config_reload(void);
// 返回值: 1 已加载, 0 未加载 // 返回值: 1 已加载, 0 未加载
int lua_config_is_loaded(void); int lua_config_is_loaded(void);
// 设置字符串配置值
// section: 配置章节名
// key: 配置键名
// value: 配置值
// 返回值: 0 成功, -1 失败
int lua_config_set_string(const char *section, const char *key, const char *value);
#endif // LUA_CONFIG_H #endif // LUA_CONFIG_H
+5 -5
View File
@@ -2,18 +2,18 @@
#define PATH_MANAGER_H #define PATH_MANAGER_H
#include "utils/string_ext.h" #include "utils/string_ext.h"
#include "utils/error_code.h"
// 移除列表中指定索引的项 // 移除列表中指定索引的项
void path_manager_remove_at(StringList *list, int index); ErrorCode path_manager_remove_at(StringList *list, int index);
// 上移指定索引的项 // 上移指定索引的项
void path_manager_move_up(StringList *list, int index); ErrorCode path_manager_move_up(StringList *list, int index);
// 下移指定索引的项 // 下移指定索引的项
void path_manager_move_down(StringList *list, int index); ErrorCode path_manager_move_down(StringList *list, int index);
// 清理无效和重复的路径 // 清理无效和重复的路径
// 返回被清理的项数 ErrorCode path_manager_clean(StringList *list);
int path_manager_clean(StringList *list);
#endif // PATH_MANAGER_H #endif // PATH_MANAGER_H
+5 -4
View File
@@ -2,13 +2,14 @@
#define REGISTRY_SERVICE_H #define REGISTRY_SERVICE_H
#include "utils/string_ext.h" #include "utils/string_ext.h"
#include "utils/error_code.h"
// 加载系统变量和用户变量到字符串列表 // 加载系统变量和用户变量到字符串列表
int load_system_paths(StringList *list); ErrorCode load_system_paths(StringList *list);
int load_user_paths(StringList *list); ErrorCode load_user_paths(StringList *list);
// 从字符串列表保存系统变量和用户变量 // 从字符串列表保存系统变量和用户变量
int save_system_paths(const StringList *list); ErrorCode save_system_paths(const StringList *list);
int save_user_paths(const StringList *list); ErrorCode save_user_paths(const StringList *list);
#endif // REGISTRY_SERVICE_H #endif // REGISTRY_SERVICE_H
+66
View File
@@ -0,0 +1,66 @@
#ifndef UNDO_REDO_H
#define UNDO_REDO_H
#include "utils/string_ext.h"
// 操作类型
typedef enum {
OP_ADD, // 添加路径
OP_DELETE, // 删除路径
OP_EDIT, // 编辑路径
OP_MOVE_UP, // 上移
OP_MOVE_DOWN, // 下移
OP_CLEAN, // 清理(批量删除)
OP_CLEAR, // 清空列表
OP_IMPORT // 导入
} OperationType;
// 目标类型(哪个列表)
typedef enum {
TARGET_SYSTEM, // 系统变量
TARGET_USER // 用户变量
} TargetType;
// 单个操作记录
typedef struct {
OperationType type;
TargetType target;
int index;
int count; // 用于批量操作(如清理、导入)
char **old_paths; // 操作前的路径列表(用于撤销)
char **new_paths; // 操作后的路径列表(用于重做)
} OpRecord;
// 撤销/重做管理器
typedef struct {
OpRecord *records;
int max_size; // 最大历史记录数
int current; // 当前指针位置(-1表示最新操作之后)
int count; // 实际记录数
} UndoRedoManager;
// 创建撤销/重做管理器
UndoRedoManager *create_undo_redo_manager(int max_size);
// 销毁撤销/重做管理器
void destroy_undo_redo_manager(UndoRedoManager *mgr);
// 添加操作记录
int push_undo_record(UndoRedoManager *mgr, const OpRecord *record);
// 执行撤销
int undo(UndoRedoManager *mgr, StringList *sys_paths, StringList *user_paths);
// 执行重做
int redo(UndoRedoManager *mgr, StringList *sys_paths, StringList *user_paths);
// 检查是否可以撤销
int can_undo(const UndoRedoManager *mgr);
// 检查是否可以重做
int can_redo(const UndoRedoManager *mgr);
// 清空历史记录
void clear_undo_redo_history(UndoRedoManager *mgr);
#endif // UNDO_REDO_H
+4
View File
@@ -5,4 +5,8 @@
// 返回值:0-取消,1-确认 // 返回值:0-取消,1-确认
int custom_input_dialog(const char *title, const char *label_text, char *buffer, int buffer_size); int custom_input_dialog(const char *title, const char *label_text, char *buffer, int buffer_size);
// 语言选择对话框
// 返回值:0-取消,1-确认
int language_select_dialog(void);
#endif // DIALOGS_H #endif // DIALOGS_H
+3
View File
@@ -6,4 +6,7 @@
// 创建主窗口 // 创建主窗口
Ihandle* create_main_window(void); Ihandle* create_main_window(void);
// 刷新 UI 文本(语言切换时调用)
void refresh_main_window_ui(Ihandle *main_dlg);
#endif // MAIN_WINDOW_H #endif // MAIN_WINDOW_H
+11
View File
@@ -5,9 +5,20 @@
#include "utils/string_ext.h" #include "utils/string_ext.h"
// 刷新单个列表框样式 // 刷新单个列表框样式
// 功能说明:
// 1. 路径有效性检查:无效路径显示红色前景色 (255 0 0)
// 2. 重复检查:重复路径显示橙色前景色 (255 128 0),只检查当前项之前的项
// 3. 斑马纹背景:奇偶行交替显示不同背景色 (白/灰)
// 注意: 该函数需要IUP控件已设置NAME属性
void refresh_single_list_style(Ihandle *list); void refresh_single_list_style(Ihandle *list);
// 同步字符串列表到 UI 列表框 // 同步字符串列表到 UI 列表框
// 将StringList中的所有项同步到IUP FlatList控件中
// 会先清空列表然后重新添加所有项,最后刷新样式
void sync_string_list_to_ui(Ihandle *list_ui, const StringList *str_list); void sync_string_list_to_ui(Ihandle *list_ui, const StringList *str_list);
// 深色模式状态管理
void set_dark_mode(int enabled);
int get_dark_mode(void);
#endif // UI_UTILS_H #endif // UI_UTILS_H
+21
View File
@@ -0,0 +1,21 @@
#ifndef ERROR_CODE_H
#define ERROR_CODE_H
typedef enum {
ERR_OK = 0, // 成功
ERR_FAILED = -1, // 失败
ERR_NULL_PTR = -2, // 空指针
ERR_OUT_OF_MEMORY = -3, // 内存不足
ERR_FILE_NOT_FOUND = -4, // 文件不存在
ERR_PERMISSION_DENIED = -5, // 权限拒绝
ERR_INVALID_FORMAT = -6, // 无效格式
ERR_REGISTRY_FAILED = -7, // 注册表操作失败
ERR_NOT_FOUND = -8, // 未找到
ERR_EXISTS = -9, // 已存在
ERR_INVALID_INDEX = -10 // 无效索引
} ErrorCode;
// 获取错误码的字符串表示(英文,用于日志)
const char* error_code_to_string(ErrorCode code);
#endif // ERROR_CODE_H
+23
View File
@@ -0,0 +1,23 @@
#ifndef I18N_H
#define I18N_H
#include <libintl.h>
#include <locale.h>
#ifndef _
#define _(s) gettext(s)
#endif
// 初始化国际化系统
void i18n_init(const char* default_lang);
// 检测系统语言并返回语言代码
const char* i18n_detect_system_language(void);
// 切换语言
void i18n_change_language(const char* lang);
// 获取当前语言
const char* i18n_get_current_language(void);
#endif // I18N_H
+33
View File
@@ -0,0 +1,33 @@
#ifndef LOGGER_H
#define LOGGER_H
// 日志级别
typedef enum {
LOG_LEVEL_DEBUG, // 调试日志级别
LOG_LEVEL_INFO, // 信息日志级别
LOG_LEVEL_WARN, // 警告日志级别
LOG_LEVEL_ERROR // 错误日志级别
} LogLevel;
// 初始化日志系统
void log_init(const char *log_file, LogLevel level);
// 销毁日志系统
void log_destroy(void);
// 日志函数
void log_debug(const char *fmt, ...);
// 信息日志函数
void log_info(const char *fmt, ...);
// 警告日志函数
void log_warn(const char *fmt, ...);
// 错误日志函数
void log_error(const char *fmt, ...);
// 设置日志级别
void log_set_level(LogLevel level);
#endif // LOGGER_H
+4 -1
View File
@@ -1,6 +1,8 @@
#ifndef OS_ENV_H #ifndef OS_ENV_H
#define OS_ENV_H #define OS_ENV_H
#include "utils/error_code.h"
// 检查是否以管理员权限运行 // 检查是否以管理员权限运行
int check_admin(void); int check_admin(void);
@@ -8,6 +10,7 @@ int check_admin(void);
int is_path_valid(const char *path); int is_path_valid(const char *path);
// 备份注册表 // 备份注册表
void backup_registry(void); // 参数 backup_path: 自定义备份目录路径,传 NULL 使用 Lua 配置中的默认路径
ErrorCode backup_registry(const char *backup_path);
#endif // OS_ENV_H #endif // OS_ENV_H
+15
View File
@@ -0,0 +1,15 @@
#ifndef SAFE_STRING_H
#define SAFE_STRING_H
#include <stddef.h>
// 安全字符串操作函数
char* safe_strcpy(char *dst, size_t dst_size, const char *src);
// 安全字符串拼接函数
char* safe_strcat(char *dst, size_t dst_size, const char *src);
// 安全字符串复制函数
char* safe_strdup(const char *src);
#endif // SAFE_STRING_H
+13
View File
@@ -16,9 +16,22 @@ void init_string_list(StringList *list);
void add_string_list(StringList *list, const char *str); void add_string_list(StringList *list, const char *str);
void clear_string_list(StringList *list); void clear_string_list(StringList *list);
// 访问器函数 - 安全访问内部数据
// 获取指定索引的字符串(只读),越界返回 NULL
const char *string_list_get(const StringList *list, int index);
// 设置指定索引的字符串(会复制新字符串并释放旧字符串),越界返回 -1,成功返回 0
int string_list_set(StringList *list, int index, const char *str);
// 字符串转换函数 // 字符串转换函数
char *wide_to_utf8(const wchar_t *wstr); char *wide_to_utf8(const wchar_t *wstr);
wchar_t *utf8_to_wide(const char *str); wchar_t *utf8_to_wide(const char *str);
char *stristr(const char *haystack, const char *needle); char *stristr(const char *haystack, const char *needle);
// 检查字符串列表中是否存在指定路径(不区分大小写)
int string_list_contains(const StringList *list, const char *str);
// 展开环境变量(如 %JAVA_HOME%\bin → C:\Java\bin
// 返回 malloc 分配的字符串,调用者负责释放;无变量返回 NULL
char *expand_env_vars(const char *path);
#endif // STRING_EXT_H #endif // STRING_EXT_H
+44
View File
@@ -0,0 +1,44 @@
#ifndef UI_CONSTANTS_H
#define UI_CONSTANTS_H
// 缓冲区大小常量
#define PATH_BUFFER_SIZE 4096
// 控件名称常量 - 统一管理所有IUP控件名称字符串
// 使用这些常量替代硬编码字符串,便于维护和减少拼写错误
// 列表控件
#define CTRL_LIST_SYS "LIST_SYS"
#define CTRL_LIST_USER "LIST_USER"
#define CTRL_LIST_MERGED "LIST_MERGED"
// 选项卡
#define CTRL_TABS_MAIN "TABS_MAIN"
// 搜索框
#define CTRL_TXT_SEARCH "TXT_SEARCH"
// 状态标签
#define CTRL_LBL_STATUS "LBL_STATUS"
// 操作按钮
#define CTRL_BTN_NEW "BTN_NEW"
#define CTRL_BTN_EDIT "BTN_EDIT"
#define CTRL_BTN_BROWSE "BTN_BROWSE"
#define CTRL_BTN_DEL "BTN_DEL"
#define CTRL_BTN_UP "BTN_UP"
#define CTRL_BTN_DOWN "BTN_DOWN"
#define CTRL_BTN_CLEAN "BTN_CLEAN"
#define CTRL_BTN_IMPORT "BTN_IMPORT"
#define CTRL_BTN_EXPORT "BTN_EXPORT"
#define CTRL_BTN_OK "BTN_OK"
#define CTRL_BTN_CANCEL "BTN_CANCEL"
#define CTRL_BTN_HELP "BTN_HELP"
#define CTRL_BTN_LANG "BTN_LANG"
#define CTRL_BTN_DARKMODE "BTN_DARKMODE"
// 撤销/重做按钮
#define CTRL_BTN_UNDO "BTN_UNDO"
#define CTRL_BTN_REDO "BTN_REDO"
#endif // UI_CONSTANTS_H
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+70
View File
@@ -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 */
+420
View File
@@ -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 */
+243
View File
@@ -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 */
+45
View File
@@ -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
+137
View File
@@ -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 */
+707
View File
@@ -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 */
+45
View File
@@ -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 */
+30
View File
@@ -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 */
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+30
View File
@@ -0,0 +1,30 @@
MIT License
Copyright (c) 2013-2026 Michele Locati
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
This project includes the following third-party components:
- iconv ( https://www.gnu.org/software/libiconv/ )
See license in the file licenses/iconv.txt
- gettext ( https://www.gnu.org/software/gettext/ )
See license in the file licenses/gettext.txt
- The GCC ( https://gcc.gnu.org/ ) runtime libraries provided by mingw-w64
See license in the file licenses/gcc.txt
+340
View File
@@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 2 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, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
+674
View File
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/philosophy/why-not-lgpl.html>.
+674
View File
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+31
View File
@@ -0,0 +1,31 @@
# nls.m4
# serial 7 (gettext-1.0)
dnl Copyright (C) 1995-2026 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This file is offered as-is, without any warranty.
dnl
dnl This file can be used in projects which are not available under
dnl the GNU General Public License or the GNU Lesser General Public
dnl License but which still want to provide support for the GNU gettext
dnl functionality.
dnl Please note that the actual code of the GNU gettext library is covered
dnl by the GNU Lesser General Public License, and the rest of the GNU
dnl gettext package is covered by the GNU General Public License.
dnl They are *not* in the public domain.
dnl From Ulrich Drepper, Bruno Haible.
AC_PREREQ([2.50])
AC_DEFUN([AM_NLS],
[
AC_MSG_CHECKING([whether NLS is requested])
dnl Default is enabled NLS
AC_ARG_ENABLE([nls],
[ --disable-nls do not use Native Language Support],
USE_NLS=$enableval, USE_NLS=yes)
AC_MSG_RESULT([$USE_NLS])
AC_SUBST([USE_NLS])
])
@@ -0,0 +1,148 @@
<!-- Creator : groff version 1.22.3 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>AUTOPOINT</title>
</head>
<body>
<h1 align="center">AUTOPOINT</h1>
<a href="#NAME">NAME</a><br>
<a href="#SYNOPSIS">SYNOPSIS</a><br>
<a href="#DESCRIPTION">DESCRIPTION</a><br>
<a href="#OPTIONS">OPTIONS</a><br>
<a href="#AUTHOR">AUTHOR</a><br>
<a href="#REPORTING BUGS">REPORTING BUGS</a><br>
<a href="#COPYRIGHT">COPYRIGHT</a><br>
<a href="#SEE ALSO">SEE ALSO</a><br>
<hr>
<h2>NAME
<a name="NAME"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">autopoint
- copies standard gettext infrastructure</p>
<h2>SYNOPSIS
<a name="SYNOPSIS"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em"><b>autopoint</b>
[<i>OPTION</i>]...</p>
<h2>DESCRIPTION
<a name="DESCRIPTION"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">Copies standard
gettext infrastructure files into a source package.</p>
<h2>OPTIONS
<a name="OPTIONS"></a>
</h2>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p style="margin-top: 1em"><b>--help</b></p></td>
<td width="2%"></td>
<td width="36%">
<p style="margin-top: 1em">print this help and exit</p></td>
<td width="42%">
</td></tr>
</table>
<p style="margin-left:11%;"><b>--version</b></p>
<p style="margin-left:22%;">print version information and
exit</p>
<p style="margin-left:11%;"><b>-f</b>,
<b>--force</b></p>
<p style="margin-left:22%;">force overwriting of files that
already exist</p>
<p style="margin-left:11%;"><b>-n</b>,
<b>--dry-run</b></p>
<p style="margin-left:22%;">print modifications but
don&rsquo;t perform them</p>
<h2>AUTHOR
<a name="AUTHOR"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">Written by
Bruno Haible.</p>
<h2>REPORTING BUGS
<a name="REPORTING BUGS"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">Report bugs in
the bug tracker at
&lt;https://savannah.gnu.org/projects/gettext&gt; or by
email to &lt;bug-gettext@gnu.org&gt;.</p>
<h2>COPYRIGHT
<a name="COPYRIGHT"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">Copyright
&copy; 2002-2026 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
&lt;https://gnu.org/licenses/gpl.html&gt; <br>
This is free software: you are free to change and
redistribute it. There is NO WARRANTY, to the extent
permitted by law.</p>
<h2>SEE ALSO
<a name="SEE ALSO"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">The full
documentation for <b>autopoint</b> is maintained as a
Texinfo manual. If the <b>info</b> and <b>autopoint</b>
programs are properly installed at your site, the
command</p>
<p style="margin-left:22%; margin-top: 1em"><b>info
autopoint</b></p>
<p style="margin-left:11%; margin-top: 1em">should give you
access to the complete manual.</p>
<hr>
</body>
</html>
@@ -0,0 +1,158 @@
<!-- Creator : groff version 1.22.3 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>BIND_TEXTDOMAIN_CODESET</title>
</head>
<body>
<h1 align="center">BIND_TEXTDOMAIN_CODESET</h1>
<a href="#NAME">NAME</a><br>
<a href="#SYNOPSIS">SYNOPSIS</a><br>
<a href="#DESCRIPTION">DESCRIPTION</a><br>
<a href="#RETURN VALUE">RETURN VALUE</a><br>
<a href="#ERRORS">ERRORS</a><br>
<a href="#BUGS">BUGS</a><br>
<a href="#SEE ALSO">SEE ALSO</a><br>
<hr>
<h2>NAME
<a name="NAME"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">bind_textdomain_codeset
- set encoding of message translations</p>
<h2>SYNOPSIS
<a name="SYNOPSIS"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em"><b>#include
&lt;libintl.h&gt;</b></p>
<p style="margin-left:11%; margin-top: 1em"><b>char *
bind_textdomain_codeset (const char *</b>
<i>domainname</i><b>, <br>
const char *</b> <i>codeset</i><b>);</b></p>
<h2>DESCRIPTION
<a name="DESCRIPTION"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">The
<b>bind_textdomain_codeset</b> function sets the output
codeset for message catalogs for domain
<i>domainname</i>.</p>
<p style="margin-left:11%; margin-top: 1em">A message
domain is a set of translatable <i>msgid</i> messages.
Usually, every software package has its own message
domain.</p>
<p style="margin-left:11%; margin-top: 1em">By default, the
<b>gettext</b> family of functions returns translated
messages in the locale&rsquo;s character encoding, which can
be retrieved as <b>nl_langinfo (CODESET)</b>. The need for
calling <b>bind_textdomain_codeset</b> arises for programs
which store strings in a locale independent way (e.g. UTF-8)
and want to avoid an extra character set conversion on the
returned translated messages.</p>
<p style="margin-left:11%; margin-top: 1em"><i>domainname</i>
must be a non-empty string.</p>
<p style="margin-left:11%; margin-top: 1em">If
<i>codeset</i> is not NULL, it must be a valid encoding name
which can be used for the <b>iconv_open</b> function. The
<b>bind_textdomain_codeset</b> function sets the output
codeset for message catalogs belonging to domain
<i>domainname</i> to <i>codeset</i>. The function makes
copies of the argument strings as needed.</p>
<p style="margin-left:11%; margin-top: 1em">If
<i>codeset</i> is NULL, the function returns the previously
set codeset for domain <i>domainname</i>. The default is
NULL, denoting the locale&rsquo;s character encoding.</p>
<h2>RETURN VALUE
<a name="RETURN VALUE"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">If successful,
the <b>bind_textdomain_codeset</b> function returns the
current codeset for domain <i>domainname</i>, after possibly
changing it. The resulting string is valid until the next
<b>bind_textdomain_codeset</b> call for the same
<i>domainname</i> and must not be modified or freed. If a
memory allocation failure occurs, it sets <b>errno</b> to
<b>ENOMEM</b> and returns NULL. If no codeset has been set
for domain <i>domainname</i>, it returns NULL.</p>
<h2>ERRORS
<a name="ERRORS"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">The following
error can occur, among others:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>ENOMEM</b></p></td>
<td width="2%"></td>
<td width="43%">
<p>Not enough memory available.</p></td>
<td width="35%">
</td></tr>
</table>
<h2>BUGS
<a name="BUGS"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">The return type
ought to be <b>const char *</b>, but is <b>char *</b> to
avoid warnings in C code predating ANSI C.</p>
<h2>SEE ALSO
<a name="SEE ALSO"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em"><b>gettext</b>(3),
<b>dgettext</b>(3), <b>dcgettext</b>(3), <b>ngettext</b>(3),
<b>dngettext</b>(3), <b>dcngettext</b>(3),
<b>textdomain</b>(3), <b>nl_langinfo</b>(3),
<b>iconv_open</b>(3)</p>
<hr>
</body>
</html>
@@ -0,0 +1,154 @@
<!-- Creator : groff version 1.22.3 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>BINDTEXTDOMAIN</title>
</head>
<body>
<h1 align="center">BINDTEXTDOMAIN</h1>
<a href="#NAME">NAME</a><br>
<a href="#SYNOPSIS">SYNOPSIS</a><br>
<a href="#DESCRIPTION">DESCRIPTION</a><br>
<a href="#RETURN VALUE">RETURN VALUE</a><br>
<a href="#ERRORS">ERRORS</a><br>
<a href="#BUGS">BUGS</a><br>
<a href="#SEE ALSO">SEE ALSO</a><br>
<hr>
<h2>NAME
<a name="NAME"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">bindtextdomain
- set directory containing message catalogs</p>
<h2>SYNOPSIS
<a name="SYNOPSIS"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em"><b>#include
&lt;libintl.h&gt;</b></p>
<p style="margin-left:11%; margin-top: 1em"><b>char *
bindtextdomain (const char *</b> <i>domainname</i><b>, const
char *</b> <i>dirname</i><b>);</b></p>
<h2>DESCRIPTION
<a name="DESCRIPTION"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">The
<b>bindtextdomain</b> function sets the base directory of
the hierarchy containing message catalogs for a given
message domain.</p>
<p style="margin-left:11%; margin-top: 1em">A message
domain is a set of translatable <i>msgid</i> messages.
Usually, every software package has its own message domain.
The need for calling <b>bindtextdomain</b> arises because
packages are not always installed with the same prefix as
the &lt;libintl.h&gt; header and the libc/libintl
libraries.</p>
<p style="margin-left:11%; margin-top: 1em">Message
catalogs will be expected at the pathnames
<i>dirname</i>/<i>locale</i>/<i>category</i>/<i>domainname</i>.mo,
where <i>locale</i> is a locale name and <i>category</i> is
a locale facet such as <b>LC_MESSAGES</b>.</p>
<p style="margin-left:11%; margin-top: 1em"><i>domainname</i>
must be a non-empty string.</p>
<p style="margin-left:11%; margin-top: 1em">If
<i>dirname</i> is not NULL, the base directory for message
catalogs belonging to domain <i>domainname</i> is set to
<i>dirname</i>. The function makes copies of the argument
strings as needed. If the program wishes to call the
<b>chdir</b> function, it is important that <i>dirname</i>
be an absolute pathname; otherwise it cannot be guaranteed
that the message catalogs will be found.</p>
<p style="margin-left:11%; margin-top: 1em">If
<i>dirname</i> is NULL, the function returns the previously
set base directory for domain <i>domainname</i>.</p>
<h2>RETURN VALUE
<a name="RETURN VALUE"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">If successful,
the <b>bindtextdomain</b> function returns the current base
directory for domain <i>domainname</i>, after possibly
changing it. The resulting string is valid until the next
<b>bindtextdomain</b> call for the same <i>domainname</i>
and must not be modified or freed. If a memory allocation
failure occurs, it sets <b>errno</b> to <b>ENOMEM</b> and
returns NULL.</p>
<h2>ERRORS
<a name="ERRORS"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">The following
error can occur, among others:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>ENOMEM</b></p></td>
<td width="2%"></td>
<td width="43%">
<p>Not enough memory available.</p></td>
<td width="35%">
</td></tr>
</table>
<h2>BUGS
<a name="BUGS"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">The return type
ought to be <b>const char *</b>, but is <b>char *</b> to
avoid warnings in C code predating ANSI C.</p>
<h2>SEE ALSO
<a name="SEE ALSO"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em"><b>gettext</b>(3),
<b>dgettext</b>(3), <b>dcgettext</b>(3), <b>ngettext</b>(3),
<b>dngettext</b>(3), <b>dcngettext</b>(3),
<b>textdomain</b>(3), <b>realpath</b>(3)</p>
<hr>
</body>
</html>
@@ -0,0 +1,8 @@
<HTML>
<BODY BGCOLOR="#FFFFFF">
<I>GNU.Gettext Namespace</I><P>
<A HREF="GNU_Gettext_GettextResourceManager.html" TARGET="contents">GettextResourceManager</A><BR>
<A HREF="GNU_Gettext_GettextResourceSet.html" TARGET="contents">GettextResourceSet</A><BR>
</BODY>
</HTML>
@@ -0,0 +1,305 @@
<HTML>
<HEAD>
<TITLE>GNU.Gettext.GettextResourceManager Class</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H3>GNU.Gettext.GettextResourceManager Class</H3>
<BLOCKQUOTE>
<TABLE COLS="1" ROWS="1" WIDTH="100%">
<TR><TD BGCOLOR="#C0C0C0"><PRE>public class GettextResourceManager: System.Resources.ResourceManager</PRE></TD></TR>
</TABLE>
</BLOCKQUOTE>
<H4>Base Types</H4>
<BLOCKQUOTE>
System.Resources.ResourceManager<BR>
&nbsp;&nbsp;GettextResourceManager<P>
</BLOCKQUOTE>
<H4>Library</H4>
<BLOCKQUOTE>
GNU.Gettext
</BLOCKQUOTE>
<H4>Summary</H4>
<BLOCKQUOTE>
Each instance of this class can be used to lookup translations for a
given resource name. For each <CODE>CultureInfo</CODE>, it performs the lookup
in several assemblies, from most specific over territory-neutral to
language-neutral.
</BLOCKQUOTE>
<H4>See Also</H4>
<BLOCKQUOTE>
<A HREF="GNU_Gettext.html" TARGET="members">GNU.Gettext Namespace</A>
</BLOCKQUOTE>
<H4>Members</H4>
<BLOCKQUOTE>
<P>
GettextResourceManager Constructors<P>
<A HREF="#GettextResourceManager%28System.String%29%20Constructor" TARGET="contents">GettextResourceManager(System.String) Constructor</A><BR>
<A HREF="#GettextResourceManager%28System.String%2C%20System.Reflection.Assembly%29%20Constructor" TARGET="contents">GettextResourceManager(System.String, System.Reflection.Assembly) Constructor</A><BR>
<P>
GettextResourceManager Methods<P>
<A HREF="#GettextResourceManager.GetPluralString%28System.String%2C%20System.String%2C%20long%2C%20System.Globalization.CultureInfo%29%20Method" TARGET="contents">GettextResourceManager.GetPluralString(System.String, System.String, long, System.Globalization.CultureInfo) Method</A><BR>
<A HREF="#GettextResourceManager.GetPluralString%28System.String%2C%20System.String%2C%20long%29%20Method" TARGET="contents">GettextResourceManager.GetPluralString(System.String, System.String, long) Method</A><BR>
<A HREF="#GettextResourceManager.GetString%28System.String%2C%20System.Globalization.CultureInfo%29%20Method" TARGET="contents">GettextResourceManager.GetString(System.String, System.Globalization.CultureInfo) Method</A><BR>
<A HREF="#GettextResourceManager.GetString%28System.String%29%20Method" TARGET="contents">GettextResourceManager.GetString(System.String) Method</A><BR>
</BLOCKQUOTE>
<HR>
<A NAME="GettextResourceManager%28System.String%29%20Constructor"><H3>GettextResourceManager(System.String) Constructor</H3>
<BLOCKQUOTE>
<TABLE COLS="1" ROWS="1" WIDTH="100%">
<TR><TD BGCOLOR="#C0C0C0"><PRE>public GettextResourceManager(System.String baseName);</PRE></TD></TR>
</TABLE>
</BLOCKQUOTE>
<H4>Summary</H4>
<BLOCKQUOTE>
Constructor.
</BLOCKQUOTE>
<H4>Parameters</H4>
<BLOCKQUOTE>
<DL>
<DT>baseName</DT>
<DD>the resource name, also the assembly base
name</DD>
</DL>
</BLOCKQUOTE>
<H4>See Also</H4>
<BLOCKQUOTE>
<A HREF="GNU_Gettext_GettextResourceManager.html" TARGET="contents">GNU.Gettext.GettextResourceManager Class</A>, <A HREF="GNU_Gettext.html" TARGET="members">GNU.Gettext Namespace</A>
</BLOCKQUOTE>
<HR>
<A NAME="GettextResourceManager%28System.String%2C%20System.Reflection.Assembly%29%20Constructor"><H3>GettextResourceManager(System.String, System.Reflection.Assembly) Constructor</H3>
<BLOCKQUOTE>
<TABLE COLS="1" ROWS="1" WIDTH="100%">
<TR><TD BGCOLOR="#C0C0C0"><PRE>public GettextResourceManager(System.String baseName, System.Reflection.Assembly assembly);</PRE></TD></TR>
</TABLE>
</BLOCKQUOTE>
<H4>Summary</H4>
<BLOCKQUOTE>
Constructor.
</BLOCKQUOTE>
<H4>Parameters</H4>
<BLOCKQUOTE>
<DL>
<DT>baseName</DT>
<DD>the resource name, also the assembly base
name</DD>
</DL>
</BLOCKQUOTE>
<H4>See Also</H4>
<BLOCKQUOTE>
<A HREF="GNU_Gettext_GettextResourceManager.html" TARGET="contents">GNU.Gettext.GettextResourceManager Class</A>, <A HREF="GNU_Gettext.html" TARGET="members">GNU.Gettext Namespace</A>
</BLOCKQUOTE>
<HR>
<A NAME="GettextResourceManager.GetPluralString%28System.String%2C%20System.String%2C%20long%2C%20System.Globalization.CultureInfo%29%20Method"><H3>GettextResourceManager.GetPluralString(System.String, System.String, long, System.Globalization.CultureInfo) Method</H3>
<BLOCKQUOTE>
<TABLE COLS="1" ROWS="1" WIDTH="100%">
<TR><TD BGCOLOR="#C0C0C0"><PRE>public virtual System.String GetPluralString(System.String msgid, System.String msgidPlural, long n, System.Globalization.CultureInfo culture);</PRE></TD></TR>
</TABLE>
</BLOCKQUOTE>
<H4>Summary</H4>
<BLOCKQUOTE>
Returns the translation of <I>msgid</I> and
<I>msgidPlural</I> in a given culture, choosing the right
plural form depending on the number <I>n</I>.
</BLOCKQUOTE>
<H4>Parameters</H4>
<BLOCKQUOTE>
<DL>
<DT>msgid</DT>
<DD>the key string to be translated, an ASCII
string</DD>
<DT>msgidPlural</DT>
<DD>the English plural of <I>msgid</I>,
an ASCII string</DD>
<DT>n</DT>
<DD>the number, should be &gt;= 0</DD>
</DL>
</BLOCKQUOTE>
<H4>Return Value</H4>
<BLOCKQUOTE>
the translation, or <I>msgid</I> or
<I>msgidPlural</I> if none is found
</BLOCKQUOTE>
<H4>See Also</H4>
<BLOCKQUOTE>
<A HREF="GNU_Gettext_GettextResourceManager.html" TARGET="contents">GNU.Gettext.GettextResourceManager Class</A>, <A HREF="GNU_Gettext.html" TARGET="members">GNU.Gettext Namespace</A>
</BLOCKQUOTE>
<HR>
<A NAME="GettextResourceManager.GetPluralString%28System.String%2C%20System.String%2C%20long%29%20Method"><H3>GettextResourceManager.GetPluralString(System.String, System.String, long) Method</H3>
<BLOCKQUOTE>
<TABLE COLS="1" ROWS="1" WIDTH="100%">
<TR><TD BGCOLOR="#C0C0C0"><PRE>public virtual System.String GetPluralString(System.String msgid, System.String msgidPlural, long n);</PRE></TD></TR>
</TABLE>
</BLOCKQUOTE>
<H4>Summary</H4>
<BLOCKQUOTE>
Returns the translation of <I>msgid</I> and
<I>msgidPlural</I> in the current culture, choosing the
right plural form depending on the number <I>n</I>.
</BLOCKQUOTE>
<H4>Parameters</H4>
<BLOCKQUOTE>
<DL>
<DT>msgid</DT>
<DD>the key string to be translated, an ASCII
string</DD>
<DT>msgidPlural</DT>
<DD>the English plural of <I>msgid</I>,
an ASCII string</DD>
<DT>n</DT>
<DD>the number, should be &gt;= 0</DD>
</DL>
</BLOCKQUOTE>
<H4>Return Value</H4>
<BLOCKQUOTE>
the translation, or <I>msgid</I> or
<I>msgidPlural</I> if none is found
</BLOCKQUOTE>
<H4>See Also</H4>
<BLOCKQUOTE>
<A HREF="GNU_Gettext_GettextResourceManager.html" TARGET="contents">GNU.Gettext.GettextResourceManager Class</A>, <A HREF="GNU_Gettext.html" TARGET="members">GNU.Gettext Namespace</A>
</BLOCKQUOTE>
<HR>
<A NAME="GettextResourceManager.GetString%28System.String%2C%20System.Globalization.CultureInfo%29%20Method"><H3>GettextResourceManager.GetString(System.String, System.Globalization.CultureInfo) Method</H3>
<BLOCKQUOTE>
<TABLE COLS="1" ROWS="1" WIDTH="100%">
<TR><TD BGCOLOR="#C0C0C0"><PRE>public override System.String GetString(System.String msgid, System.Globalization.CultureInfo culture);</PRE></TD></TR>
</TABLE>
</BLOCKQUOTE>
<H4>Summary</H4>
<BLOCKQUOTE>
Returns the translation of <I>msgid</I> in a given culture.
</BLOCKQUOTE>
<H4>Parameters</H4>
<BLOCKQUOTE>
<DL>
<DT>msgid</DT>
<DD>the key string to be translated, an ASCII
string</DD>
</DL>
</BLOCKQUOTE>
<H4>Return Value</H4>
<BLOCKQUOTE>
the translation of <I>msgid</I>, or
<I>msgid</I> if none is found
</BLOCKQUOTE>
<H4>See Also</H4>
<BLOCKQUOTE>
<A HREF="GNU_Gettext_GettextResourceManager.html" TARGET="contents">GNU.Gettext.GettextResourceManager Class</A>, <A HREF="GNU_Gettext.html" TARGET="members">GNU.Gettext Namespace</A>
</BLOCKQUOTE>
<HR>
<A NAME="GettextResourceManager.GetString%28System.String%29%20Method"><H3>GettextResourceManager.GetString(System.String) Method</H3>
<BLOCKQUOTE>
<TABLE COLS="1" ROWS="1" WIDTH="100%">
<TR><TD BGCOLOR="#C0C0C0"><PRE>public override System.String GetString(System.String msgid);</PRE></TD></TR>
</TABLE>
</BLOCKQUOTE>
<H4>Summary</H4>
<BLOCKQUOTE>
Returns the translation of <I>msgid</I> in the current
culture.
</BLOCKQUOTE>
<H4>Parameters</H4>
<BLOCKQUOTE>
<DL>
<DT>msgid</DT>
<DD>the key string to be translated, an ASCII
string</DD>
</DL>
</BLOCKQUOTE>
<H4>Return Value</H4>
<BLOCKQUOTE>
the translation of <I>msgid</I>, or
<I>msgid</I> if none is found
</BLOCKQUOTE>
<H4>See Also</H4>
<BLOCKQUOTE>
<A HREF="GNU_Gettext_GettextResourceManager.html" TARGET="contents">GNU.Gettext.GettextResourceManager Class</A>, <A HREF="GNU_Gettext.html" TARGET="members">GNU.Gettext Namespace</A>
</BLOCKQUOTE>
</BODY>
</HTML>
@@ -0,0 +1,356 @@
<HTML>
<HEAD>
<TITLE>GNU.Gettext.GettextResourceSet Class</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H3>GNU.Gettext.GettextResourceSet Class</H3>
<BLOCKQUOTE>
<TABLE COLS="1" ROWS="1" WIDTH="100%">
<TR><TD BGCOLOR="#C0C0C0"><PRE>public class GettextResourceSet: System.Resources.ResourceSet</PRE></TD></TR>
</TABLE>
</BLOCKQUOTE>
<H4>Base Types</H4>
<BLOCKQUOTE>
System.Resources.ResourceSet<BR>
&nbsp;&nbsp;GettextResourceSet<P>
</BLOCKQUOTE>
<H4>Library</H4>
<BLOCKQUOTE>
GNU.Gettext
</BLOCKQUOTE>
<H4>Summary</H4>
<BLOCKQUOTE>
Each instance of this class encapsulates a single PO file.
<P>
This API of this class is not meant to be used directly; use
<CODE>GettextResourceManager</CODE> instead.
<P>
</BLOCKQUOTE>
<H4>See Also</H4>
<BLOCKQUOTE>
<A HREF="GNU_Gettext.html" TARGET="members">GNU.Gettext Namespace</A>
</BLOCKQUOTE>
<H4>Members</H4>
<BLOCKQUOTE>
<P>
GettextResourceSet Constructors<P>
<A HREF="#GettextResourceSet%28%29%20Constructor" TARGET="contents">GettextResourceSet() Constructor</A><BR>
<A HREF="#GettextResourceSet%28System.Resources.IResourceReader%29%20Constructor" TARGET="contents">GettextResourceSet(System.Resources.IResourceReader) Constructor</A><BR>
<A HREF="#GettextResourceSet%28System.IO.Stream%29%20Constructor" TARGET="contents">GettextResourceSet(System.IO.Stream) Constructor</A><BR>
<A HREF="#GettextResourceSet%28System.String%29%20Constructor" TARGET="contents">GettextResourceSet(System.String) Constructor</A><BR>
<P>
GettextResourceSet Methods<P>
<A HREF="#GettextResourceSet.GetPluralString%20Method" TARGET="contents">GettextResourceSet.GetPluralString Method</A><BR>
<A HREF="#GettextResourceSet.GetString%28System.String%29%20Method" TARGET="contents">GettextResourceSet.GetString(System.String) Method</A><BR>
<A HREF="#GettextResourceSet.GetString%28System.String%2C%20bool%29%20Method" TARGET="contents">GettextResourceSet.GetString(System.String, bool) Method</A><BR>
<A HREF="#GettextResourceSet.PluralEval%20Method" TARGET="contents">GettextResourceSet.PluralEval Method</A><BR>
<P>
GettextResourceSet Properties<P>
<A HREF="#GettextResourceSet.Keys%20Property" TARGET="contents">GettextResourceSet.Keys Property</A><BR>
</BLOCKQUOTE>
<HR>
<A NAME="GettextResourceSet%28%29%20Constructor"><H3>GettextResourceSet() Constructor</H3>
<BLOCKQUOTE>
<TABLE COLS="1" ROWS="1" WIDTH="100%">
<TR><TD BGCOLOR="#C0C0C0"><PRE>protected GettextResourceSet();</PRE></TD></TR>
</TABLE>
</BLOCKQUOTE>
<H4>Summary</H4>
<BLOCKQUOTE>
Creates a new message catalog. When using this constructor, you
must override the <CODE>ReadResources</CODE> method, in order to initialize
the <CODE>Table</CODE> property. The message catalog will support plural
forms only if the <CODE>ReadResources</CODE> method installs values of type
<CODE>String[]</CODE> and if the <CODE>PluralEval</CODE> method is overridden.
</BLOCKQUOTE>
<H4>See Also</H4>
<BLOCKQUOTE>
<A HREF="GNU_Gettext_GettextResourceSet.html" TARGET="contents">GNU.Gettext.GettextResourceSet Class</A>, <A HREF="GNU_Gettext.html" TARGET="members">GNU.Gettext Namespace</A>
</BLOCKQUOTE>
<HR>
<A NAME="GettextResourceSet%28System.Resources.IResourceReader%29%20Constructor"><H3>GettextResourceSet(System.Resources.IResourceReader) Constructor</H3>
<BLOCKQUOTE>
<TABLE COLS="1" ROWS="1" WIDTH="100%">
<TR><TD BGCOLOR="#C0C0C0"><PRE>public GettextResourceSet(System.Resources.IResourceReader reader);</PRE></TD></TR>
</TABLE>
</BLOCKQUOTE>
<H4>Summary</H4>
<BLOCKQUOTE>
Creates a new message catalog, by reading the string/value pairs from
the given <I>reader</I>. The message catalog will support
plural forms only if the reader can produce values of type
<CODE>String[]</CODE> and if the <CODE>PluralEval</CODE> method is overridden.
</BLOCKQUOTE>
<H4>See Also</H4>
<BLOCKQUOTE>
<A HREF="GNU_Gettext_GettextResourceSet.html" TARGET="contents">GNU.Gettext.GettextResourceSet Class</A>, <A HREF="GNU_Gettext.html" TARGET="members">GNU.Gettext Namespace</A>
</BLOCKQUOTE>
<HR>
<A NAME="GettextResourceSet%28System.IO.Stream%29%20Constructor"><H3>GettextResourceSet(System.IO.Stream) Constructor</H3>
<BLOCKQUOTE>
<TABLE COLS="1" ROWS="1" WIDTH="100%">
<TR><TD BGCOLOR="#C0C0C0"><PRE>public GettextResourceSet(System.IO.Stream stream);</PRE></TD></TR>
</TABLE>
</BLOCKQUOTE>
<H4>Summary</H4>
<BLOCKQUOTE>
Creates a new message catalog, by reading the string/value pairs from
the given <I>stream</I>, which should have the format of
a <CODE>.resources</CODE> file. The message catalog will not support plural
forms.
</BLOCKQUOTE>
<H4>See Also</H4>
<BLOCKQUOTE>
<A HREF="GNU_Gettext_GettextResourceSet.html" TARGET="contents">GNU.Gettext.GettextResourceSet Class</A>, <A HREF="GNU_Gettext.html" TARGET="members">GNU.Gettext Namespace</A>
</BLOCKQUOTE>
<HR>
<A NAME="GettextResourceSet%28System.String%29%20Constructor"><H3>GettextResourceSet(System.String) Constructor</H3>
<BLOCKQUOTE>
<TABLE COLS="1" ROWS="1" WIDTH="100%">
<TR><TD BGCOLOR="#C0C0C0"><PRE>public GettextResourceSet(System.String fileName);</PRE></TD></TR>
</TABLE>
</BLOCKQUOTE>
<H4>Summary</H4>
<BLOCKQUOTE>
Creates a new message catalog, by reading the string/value pairs from
the file with the given <I>fileName</I>. The file should
be in the format of a <CODE>.resources</CODE> file. The message catalog will
not support plural forms.
</BLOCKQUOTE>
<H4>See Also</H4>
<BLOCKQUOTE>
<A HREF="GNU_Gettext_GettextResourceSet.html" TARGET="contents">GNU.Gettext.GettextResourceSet Class</A>, <A HREF="GNU_Gettext.html" TARGET="members">GNU.Gettext Namespace</A>
</BLOCKQUOTE>
<HR>
<A NAME="GettextResourceSet.GetPluralString%20Method"><H3>GettextResourceSet.GetPluralString Method</H3>
<BLOCKQUOTE>
<TABLE COLS="1" ROWS="1" WIDTH="100%">
<TR><TD BGCOLOR="#C0C0C0"><PRE>public virtual System.String GetPluralString(System.String msgid, System.String msgidPlural, long n);</PRE></TD></TR>
</TABLE>
</BLOCKQUOTE>
<H4>Summary</H4>
<BLOCKQUOTE>
Returns the translation of <I>msgid</I> and
<I>msgidPlural</I>, choosing the right plural form
depending on the number <I>n</I>.
</BLOCKQUOTE>
<H4>Parameters</H4>
<BLOCKQUOTE>
<DL>
<DT>msgid</DT>
<DD>the key string to be translated, an ASCII
string</DD>
<DT>msgidPlural</DT>
<DD>the English plural of <I>msgid</I>,
an ASCII string</DD>
<DT>n</DT>
<DD>the number, should be &gt;= 0</DD>
</DL>
</BLOCKQUOTE>
<H4>Return Value</H4>
<BLOCKQUOTE>
the translation, or <CODE>null</CODE> if none is found
</BLOCKQUOTE>
<H4>See Also</H4>
<BLOCKQUOTE>
<A HREF="GNU_Gettext_GettextResourceSet.html" TARGET="contents">GNU.Gettext.GettextResourceSet Class</A>, <A HREF="GNU_Gettext.html" TARGET="members">GNU.Gettext Namespace</A>
</BLOCKQUOTE>
<HR>
<A NAME="GettextResourceSet.GetString%28System.String%29%20Method"><H3>GettextResourceSet.GetString(System.String) Method</H3>
<BLOCKQUOTE>
<TABLE COLS="1" ROWS="1" WIDTH="100%">
<TR><TD BGCOLOR="#C0C0C0"><PRE>public override System.String GetString(System.String msgid);</PRE></TD></TR>
</TABLE>
</BLOCKQUOTE>
<H4>Summary</H4>
<BLOCKQUOTE>
Returns the translation of <I>msgid</I>.
</BLOCKQUOTE>
<H4>Parameters</H4>
<BLOCKQUOTE>
<DL>
<DT>msgid</DT>
<DD>the key string to be translated, an ASCII
string</DD>
</DL>
</BLOCKQUOTE>
<H4>Return Value</H4>
<BLOCKQUOTE>
the translation of <I>msgid</I>, or <CODE>null</CODE> if
none is found
</BLOCKQUOTE>
<H4>See Also</H4>
<BLOCKQUOTE>
<A HREF="GNU_Gettext_GettextResourceSet.html" TARGET="contents">GNU.Gettext.GettextResourceSet Class</A>, <A HREF="GNU_Gettext.html" TARGET="members">GNU.Gettext Namespace</A>
</BLOCKQUOTE>
<HR>
<A NAME="GettextResourceSet.GetString%28System.String%2C%20bool%29%20Method"><H3>GettextResourceSet.GetString(System.String, bool) Method</H3>
<BLOCKQUOTE>
<TABLE COLS="1" ROWS="1" WIDTH="100%">
<TR><TD BGCOLOR="#C0C0C0"><PRE>public override System.String GetString(System.String msgid, bool ignoreCase);</PRE></TD></TR>
</TABLE>
</BLOCKQUOTE>
<H4>Summary</H4>
<BLOCKQUOTE>
Returns the translation of <I>msgid</I>, with possibly
case-insensitive lookup.
</BLOCKQUOTE>
<H4>Parameters</H4>
<BLOCKQUOTE>
<DL>
<DT>msgid</DT>
<DD>the key string to be translated, an ASCII
string</DD>
</DL>
</BLOCKQUOTE>
<H4>Return Value</H4>
<BLOCKQUOTE>
the translation of <I>msgid</I>, or <CODE>null</CODE> if
none is found
</BLOCKQUOTE>
<H4>See Also</H4>
<BLOCKQUOTE>
<A HREF="GNU_Gettext_GettextResourceSet.html" TARGET="contents">GNU.Gettext.GettextResourceSet Class</A>, <A HREF="GNU_Gettext.html" TARGET="members">GNU.Gettext Namespace</A>
</BLOCKQUOTE>
<HR>
<A NAME="GettextResourceSet.PluralEval%20Method"><H3>GettextResourceSet.PluralEval Method</H3>
<BLOCKQUOTE>
<TABLE COLS="1" ROWS="1" WIDTH="100%">
<TR><TD BGCOLOR="#C0C0C0"><PRE>protected virtual long PluralEval(long n);</PRE></TD></TR>
</TABLE>
</BLOCKQUOTE>
<H4>Summary</H4>
<BLOCKQUOTE>
Returns the index of the plural form to be chosen for a given number.
The default implementation is the Germanic plural formula:
zero for <I>n</I> == 1, one for <I>n</I> != 1.
</BLOCKQUOTE>
<H4>See Also</H4>
<BLOCKQUOTE>
<A HREF="GNU_Gettext_GettextResourceSet.html" TARGET="contents">GNU.Gettext.GettextResourceSet Class</A>, <A HREF="GNU_Gettext.html" TARGET="members">GNU.Gettext Namespace</A>
</BLOCKQUOTE>
<HR>
<A NAME="GettextResourceSet.Keys%20Property"><H3>GettextResourceSet.Keys Property</H3>
<BLOCKQUOTE>
<TABLE COLS="1" ROWS="1" WIDTH="100%">
<TR><TD BGCOLOR="#C0C0C0"><PRE>public virtual System.Collections.ICollection Keys { get; }</PRE></TD></TR>
</TABLE>
</BLOCKQUOTE>
<H4>Summary</H4>
<BLOCKQUOTE>
Returns the keys of this resource set, i.e. the strings for which
<CODE>GetObject()</CODE> can return a non-null value.
</BLOCKQUOTE>
<H4>See Also</H4>
<BLOCKQUOTE>
<A HREF="GNU_Gettext_GettextResourceSet.html" TARGET="contents">GNU.Gettext.GettextResourceSet Class</A>, <A HREF="GNU_Gettext.html" TARGET="members">GNU.Gettext Namespace</A>
</BLOCKQUOTE>
</BODY>
</HTML>
@@ -0,0 +1,11 @@
<HTML>
<HEAD><TITLE>-</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF">
<H1>-</H1>
<BLOCKQUOTE>
<A HREF="GNU_Gettext.html" TARGET="members">GNU.Gettext Namespace</A><BR>
</BLOCKQUOTE>
</BODY>
</HTML>
@@ -0,0 +1,10 @@
<HTML>
<HEAD><TITLE>-</TITLE></HEAD>
<FRAMESET COLS="150,*">
<FRAMESET ROWS="50%,50%">
<FRAME SRC="namespaces.html" NAME="namespaces">
<FRAME SRC="GNU_Gettext.html" NAME="members">
</FRAMESET>
<FRAME SRC="begin.html" NAME="contents">
</FRAMESET>
</HTML>
@@ -0,0 +1,6 @@
<HTML>
<BODY BGCOLOR="#FFFFFF">
<I>Namespaces</I><P>
<A HREF="GNU_Gettext.html" TARGET="members">GNU.Gettext</A><BR>
</BODY>
</HTML>
@@ -0,0 +1,117 @@
This directory contains simple examples of the use of GNU gettext.
Each example is a simple "hello world" program with a very small message
catalog, written in a particular programming language for a particular
environment.
Example Language GUI Environment
hello-c C
hello-c-gnome2 C GNOME 2 (obsolete)
hello-c-gnome3 C GNOME 3.10 or later
hello-c-http C web browser
hello-c++ C++
hello-c++20 C++ 20
hello-c++-qt C++ Qt
hello-c++-kde C++ KDE
hello-c++-gnome2 C++ GNOME 2 (obsolete)
hello-c++-gnome3 C++ GNOME 3.10 or later
hello-c++-wxwidgets C++ wxWidgets
hello-objc ObjectiveC
hello-objc-gnustep ObjectiveC GNUstep
hello-objc-gnome2 ObjectiveC GNOME 2 (obsolete)
hello-python Python
hello-java Java
hello-java-awt Java AWT
hello-java-swing Java Swing
hello-java-qtjambi Java Qt
hello-csharp C#
hello-csharp-forms C# Forms
hello-guile Scheme
hello-clisp Lisp
hello-librep librep
hello-rust Rust
hello-go Go
hello-go-http Go web browser
hello-ruby Ruby
hello-sh Shell
hello-gawk awk
hello-pascal Pascal
hello-modula2 Modula-2
hello-d D
hello-ocaml OCaml
hello-smalltalk Smalltalk
hello-tcl Tcl
hello-tcl-tk Tcl Tk
hello-perl Perl
hello-php PHP
hello-ycp YCP libyui
Before building an example, you need to
1. Build and install the GNU gettext package, as described in the INSTALL
file.
2. cd to the example and do
./autogen.sh
3. Then you can build the example as usual:
./configure --prefix=/some/prefix
make
make install
and see it work by executing
/some/prefix/bin/hello
The po/ directories of the examples use different binary catalog formats and
Makefile types:
Example Binary catalog format Makefile type
hello-c .gmo Makefile.in.in
hello-c-gnome2 .gmo Makefile.in.in
hello-c-gnome3 .gmo Makefile.in.in
hello-c-http .gmo Makefile.in.in
hello-c++ .gmo Makefile.in.in
hello-c++20 .gmo Makefile.in.in
hello-c++-kde .gmo Makefile.in.in
hello-c++-gnome2 .gmo Makefile.in.in
hello-c++-gnome3 .gmo Makefile.in.in
hello-objc .gmo Makefile.in.in
hello-objc-gnome2 .gmo Makefile.in.in
hello-c++-wxwidgets .gmo Makefile.am
hello-python .gmo Makefile.am
hello-guile .gmo Makefile.am
hello-clisp .gmo Makefile.am
hello-librep .gmo Makefile.am
hello-rust .gmo Makefile.am
hello-go .gmo Makefile.am
hello-go-http .gmo Makefile.am
hello-ruby .gmo Makefile.am
hello-sh .gmo Makefile.am
hello-gawk .gmo Makefile.am
hello-pascal .gmo Makefile.am
hello-modula2 .gmo Makefile.am
hello-d .gmo Makefile.am
hello-ocaml .gmo Makefile.am
hello-smalltalk .gmo Makefile.am
hello-perl .gmo Makefile.am
hello-php .gmo Makefile.am
hello-ycp .gmo Makefile.am
hello-java .properties Makefile.am
hello-java-awt .properties Makefile.am
hello-java-swing .properties Makefile.am
hello-java-qtjambi .properties Makefile.am
hello-csharp .resources.dll Makefile.am
hello-csharp-forms .resources.dll Makefile.am
hello-tcl .msg Makefile.am
hello-tcl-tk .msg Makefile.am
hello-c++-qt .qm Makefile.am
hello-objc-gnustep .strings GNUmakefile
The Makefiles in the po/ directories make use of the variable assignment
operator != standardized by POSIX:2024
<https://pubs.opengroup.org/onlinepubs/9799919799/utilities/make.html>.
They thus require a 'make' implementation that supports this operator !=.
As of 2024, these are: GNU make >= 4.0, FreeBSD make, NetBSD make,
OpenBSD make. This means that building on specific platforms requires
use of GNU make:
- On macOS, use /opt/homebrew/bin/gmake.
- On Solaris 11 OpenIndiana, use /usr/bin/gmake = /usr/gnu/bin/make.
- On Solaris 11.4, install GNU make yourself.
- On AIX, use /opt/freeware/bin/make.
@@ -0,0 +1,34 @@
# csharp.m4
# serial 5
dnl Copyright (C) 2004-2005, 2009-2026 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This file is offered as-is, without any warranty.
# Sets CSHARP_CHOICE to the preferred C# implementation:
# 'mono' or 'dotnet' or 'any' or 'no'.
# Here
# - 'mono' means <https://en.wikipedia.org/wiki/Mono_(software)>.
# - 'dotnet' means the (newer) .NET <https://en.wikipedia.org/wiki/.NET>,
# *not* the .NET framework <https://en.wikipedia.org/wiki/.NET_Framework>.
AC_DEFUN([gt_CSHARP_CHOICE],
[
AC_MSG_CHECKING([for preferred C[#] implementation])
AC_ARG_ENABLE([csharp],
[ --enable-csharp[[=IMPL]] choose preferred C[#] implementation (mono, dotnet)],
[CSHARP_CHOICE="$enableval"],
CSHARP_CHOICE=any)
AC_SUBST([CSHARP_CHOICE])
AC_MSG_RESULT([$CSHARP_CHOICE])
case "$CSHARP_CHOICE" in
mono)
AC_DEFINE([CSHARP_CHOICE_MONO], [1],
[Define if mono is the preferred C# implementation.])
;;
dotnet)
AC_DEFINE([CSHARP_CHOICE_DOTNET], [1],
[Define if dotnet is the preferred C# implementation.])
;;
esac
])
@@ -0,0 +1,93 @@
# csharpcomp.m4
# serial 11
dnl Copyright (C) 2003-2005, 2007, 2009-2026 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This file is offered as-is, without any warranty.
# Prerequisites of csharpcomp.sh.
# Checks for a C# compiler.
# Sets at most one of HAVE_MCS, HAVE_DOTNET_SDK, HAVE_DOTNET_CSC, HAVE_CSC.
# Sets HAVE_CSHARPCOMP to nonempty if csharpcomp.sh will work.
# Also sets CSHARPCOMPFLAGS.
AC_DEFUN([gt_CSHARPCOMP],
[
AC_REQUIRE([gt_CSHARP_CHOICE])
AC_MSG_CHECKING([for C[#] compiler])
HAVE_CSHARPCOMP=1
pushdef([AC_MSG_CHECKING],[:])dnl
pushdef([AC_CHECKING],[:])dnl
pushdef([AC_MSG_RESULT],[:])dnl
AC_CHECK_PROG([HAVE_MCS_IN_PATH], [mcs], [yes])
AC_CHECK_PROG([HAVE_DOTNET_IN_PATH], [dotnet], [yes])
AC_CHECK_PROG([HAVE_CSC_IN_PATH], [csc], [yes])
popdef([AC_MSG_RESULT])dnl
popdef([AC_CHECKING])dnl
popdef([AC_MSG_CHECKING])dnl
for impl in "$CSHARP_CHOICE" mono dotnet sscli no; do
case "$impl" in
mono)
if test -n "$HAVE_MCS_IN_PATH" \
&& mcs --version >/dev/null 2>/dev/null \
&& mcs --version 2>/dev/null | grep Mono >/dev/null; then
HAVE_MCS=1
ac_result="mcs"
break
fi
;;
dotnet)
# The dotnet compiler is called "Roslyn".
# <https://en.wikipedia.org/wiki/Roslyn_(compiler)>
# There are two situations:
# - A dotnet SDK, that contains a 'dotnet' program and the Roslyn
# compiler as csc.dll.
# - An MSVC installation, that contains the Roslyn compiler as csc.exe
# (e.g. in C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\csc.exe).
# In the first case, the user only has to make sure that 'dotnet' is
# found in $PATH.
# In the second case, they need to make sure that both 'dotnet' and
# 'csc' are found in $PATH.
if test -n "$HAVE_DOTNET_IN_PATH" \
&& dotnet --list-runtimes >/dev/null 2>/dev/null \
&& test -n "`dotnet --list-sdks 2>/dev/null`"; then
HAVE_DOTNET_SDK=1
ac_result="dotnet"
break
else
if test -n "$HAVE_CSC_IN_PATH" \
&& csc -help 2>/dev/null | grep analyzer >/dev/null \
&& { if csc -help 2>/dev/null | grep -i chicken > /dev/null; then false; else true; fi; }; then
HAVE_DOTNET_CSC=1
ac_result="dotnet"
break
fi
fi
;;
sscli)
if test -n "$HAVE_CSC_IN_PATH" \
&& csc -help >/dev/null 2>/dev/null \
&& { if csc -help 2>/dev/null | grep -i chicken > /dev/null; then false; else true; fi; }; then
HAVE_CSC=1
ac_result="csc"
break
fi
;;
no)
HAVE_CSHARPCOMP=
ac_result="no"
break
;;
esac
done
AC_MSG_RESULT([$ac_result])
AC_SUBST([HAVE_MCS])
AC_SUBST([HAVE_DOTNET_SDK])
AC_SUBST([HAVE_DOTNET_CSC])
AC_SUBST([HAVE_CSC])
dnl Provide a default for CSHARPCOMPFLAGS.
if test -z "${CSHARPCOMPFLAGS+set}"; then
CSHARPCOMPFLAGS="-O -g"
fi
AC_SUBST([CSHARPCOMPFLAGS])
])
@@ -0,0 +1,247 @@
#!/bin/sh
# Compile a C# program.
# Copyright (C) 2003-2026 Free Software Foundation, Inc.
# Written by Bruno Haible <bruno@clisp.org>, 2003.
#
# 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/>.
# This uses the same choices as csharpcomp.c, but instead of relying on the
# environment settings at run time, it uses the environment variables
# present at configuration time.
#
# This is a separate shell script, because the various C# compilers have
# different command line options.
#
# Usage: /bin/sh csharpcomp.sh [OPTION] SOURCE.cs ... RES.resource ...
# Options:
# -o PROGRAM.exe or -o LIBRARY.dll
# set the output assembly name
# -L DIRECTORY search for C# libraries also in DIRECTORY
# -l LIBRARY reference the C# library LIBRARY.dll
# -O optimize
# -g generate debugging information
# func_tmpdir
# creates a temporary directory.
# Sets variable
# - tmp pathname of freshly created temporary directory
func_tmpdir ()
{
# Use the environment variable TMPDIR, falling back to /tmp. This allows
# users to specify a different temporary directory, for example, if their
# /tmp is filled up or too small.
: "${TMPDIR=/tmp}"
{
# Use the mktemp program if available. If not available, hide the error
# message.
tmp=`(umask 077 && mktemp -d -q "$TMPDIR/gtXXXXXX") 2>/dev/null` &&
test -n "$tmp" && test -d "$tmp"
} ||
{
# Use a simple mkdir command. It is guaranteed to fail if the directory
# already exists. $RANDOM is bash specific and expands to empty in shells
# other than bash, ksh and zsh. Its use does not increase security;
# rather, it minimizes the probability of failure in a very cluttered /tmp
# directory.
tmp=$TMPDIR/gt$$-$RANDOM
(umask 077 && mkdir "$tmp")
} ||
{
echo "$0: cannot create a temporary directory in $TMPDIR" >&2
{ (exit 1); exit 1; }
}
}
# In order to construct a command that invokes csc, we need 'eval', because
# some of the arguments may contain spaces.
command_for_print=
command_for_eval=
options_csc_for_print=
options_csc_for_eval=
sources_csc_for_print=
sources_csc_for_eval=
# Protecting special characters, hiding them from 'eval':
# Double each backslash.
sed_protect_1='s/\\/\\\\/g'
# Escape each dollar, backquote, double-quote.
sed_protect_2a='s/\$/\\$/g'
sed_protect_2b='s/`/\\`/g'
sed_protect_2c='s/"/\\"/g'
# Add double-quotes at the beginning and end of the word.
sed_protect_3a='1s/^/"/'
sed_protect_3b='$s/$/"/'
func_add_word_to_command ()
{
command_for_print="${command_for_print:+$command_for_print }$1"
word_protected=`echo "$1" | sed -e "$sed_protect_1" -e "$sed_protect_2a" -e "$sed_protect_2b" -e "$sed_protect_2c" -e "$sed_protect_3a" -e "$sed_protect_3b"`
command_for_eval="${command_for_eval:+$command_for_eval }$word_protected"
}
func_add_word_to_options_csc ()
{
options_csc_for_print="${options_csc_for_print:+$options_csc_for_print }$1"
word_protected=`echo "$1" | sed -e "$sed_protect_1" -e "$sed_protect_2a" -e "$sed_protect_2b" -e "$sed_protect_2c" -e "$sed_protect_3a" -e "$sed_protect_3b"`
options_csc_for_eval="${options_csc_for_eval:+$options_csc_for_eval }$word_protected"
}
func_add_word_to_sources_csc ()
{
sources_csc_for_print="${sources_csc_for_print:+$sources_csc_for_print }$1"
word_protected=`echo "$1" | sed -e "$sed_protect_1" -e "$sed_protect_2a" -e "$sed_protect_2b" -e "$sed_protect_2c" -e "$sed_protect_3a" -e "$sed_protect_3b"`
sources_csc_for_eval="${sources_csc_for_eval:+$sources_csc_for_eval }$word_protected"
}
sed_quote_subst='s/\([|&;<>()$`"'"'"'*?[#~=% \\]\)/\\\1/g'
options_mcs=
sources=
func_add_word_to_options_csc "-nologo"
while test $# != 0; do
case "$1" in
-o)
case "$2" in
*.dll)
options_mcs="$options_mcs -target:library"
func_add_word_to_options_csc "-target:library"
;;
*.exe)
func_add_word_to_options_csc "-target:exe"
;;
esac
options_mcs="$options_mcs -out:"`echo "$2" | sed -e "$sed_quote_subst"`
# On Windows, assume that 'dotnet' and 'csc' are native Windows programs,
# not Cygwin programs.
arg="$2"
case "@build_os@" in
cygwin*)
arg=`cygpath -w "$arg"`
;;
esac
func_add_word_to_options_csc "-out:$arg"
shift
;;
-L)
options_mcs="$options_mcs -lib:"`echo "$2" | sed -e "$sed_quote_subst"`
# On Windows, assume that 'dotnet' and 'csc' are native Windows programs,
# not Cygwin programs.
arg="$2"
case "@build_os@" in
cygwin*)
arg=`cygpath -w "$arg"`
;;
esac
func_add_word_to_options_csc "-lib:$arg"
shift
;;
-l)
options_mcs="$options_mcs -reference:"`echo "$2" | sed -e "$sed_quote_subst"`
func_add_word_to_options_csc "-reference:$2.dll"
shift
;;
-O)
func_add_word_to_options_csc "-optimize+"
;;
-g)
options_mcs="$options_mcs -debug"
func_add_word_to_options_csc "-debug+"
;;
-*)
echo "csharpcomp: unknown option '$1'" 1>&2
exit 1
;;
*.resources)
options_mcs="$options_mcs -resource:"`echo "$1" | sed -e "$sed_quote_subst"`
# On Windows, assume that 'dotnet' and 'csc' are native Windows programs,
# not Cygwin programs.
arg="$1"
case "@build_os@" in
cygwin*)
arg=`cygpath -w "$arg"`
;;
esac
func_add_word_to_options_csc "-resource:$arg"
;;
*.cs)
sources="$sources "`echo "$1" | sed -e "$sed_quote_subst"`
# On Windows, assume that 'dotnet' and 'csc' are native Windows programs,
# not Cygwin programs.
arg="$1"
case "@build_os@" in
cygwin*)
arg=`cygpath -w "$arg"`
;;
esac
func_add_word_to_sources_csc "$arg"
;;
*)
echo "csharpcomp: unknown type of argument '$1'" 1>&2
exit 1
;;
esac
shift
done
if test -n "@HAVE_MCS@"; then
# mcs prints it errors and warnings to stdout, not stderr. Furthermore it
# adds a useless line "Compilation succeeded..." at the end. Correct both.
sed_drop_success_line='${
/^Compilation succeeded/d
}'
func_tmpdir
trap 'rm -rf "$tmp"' HUP INT QUIT TERM
test -z "$CSHARP_VERBOSE" || echo mcs $options_mcs $sources 1>&2
mcs $options_mcs $sources > "$tmp"/mcs.err
result=$?
sed -e "$sed_drop_success_line" < "$tmp"/mcs.err >&2
rm -rf "$tmp"
exit $result
else
if test -n "@HAVE_DOTNET_SDK@"; then
dotnet_runtime_dir=`dotnet --list-runtimes | sed -n -e 's/Microsoft.NETCore.App \([^ ]*\) \[\(.*\)\].*/\2\/\1/p' | sed -e 1q`
dotnet_sdk_dir=`dotnet --list-sdks | sed -e 's/\([^ ]*\) \[\(.*\)\].*/\2\/\1/p' | sed -e 1q`
# Add -lib and -reference options, so that the compiler finds Object, Console, String, etc.
arg="$dotnet_runtime_dir"
case "@build_os@" in
cygwin*)
arg=`cygpath -w "$arg"`
;;
esac
func_add_word_to_options_csc "-lib:$arg"
for file in `cd "$dotnet_runtime_dir" && echo [ABCDEFGHIJKLMNOPQRSTUVWXYZ]*.dll`; do
case "$file" in
*.Native.*) ;;
*) func_add_word_to_options_csc "-reference:$file" ;;
esac
done
func_add_word_to_command dotnet
csc="$dotnet_sdk_dir/Roslyn/bincore/csc.dll"
case "@build_os@" in
cygwin*)
csc=`cygpath -w "$csc"`
;;
esac
func_add_word_to_command "$csc"
test -z "$CSHARP_VERBOSE" || echo "$command_for_print $options_csc_for_print $sources_csc_for_print" 1>&2
eval "$command_for_eval $options_csc_for_eval $sources_csc_for_eval"
exit $?
else
if test -n "@HAVE_DOTNET_CSC@" || test -n "@HAVE_CSC@"; then
test -z "$CSHARP_VERBOSE" || echo "csc $options_csc_for_print $sources_csc_for_print" 1>&2
eval "csc $options_csc_for_eval $sources_csc_for_eval"
exit $?
else
echo 'C# compiler not found, try installing mono or dotnet, then reconfigure' 1>&2
exit 1
fi
fi
fi
@@ -0,0 +1,88 @@
# csharpexec.m4
# serial 10
dnl Copyright (C) 2003-2005, 2009-2026 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This file is offered as-is, without any warranty.
# Prerequisites of csharpexec.sh.
# Checks for a C# execution engine.
# gt_CSHARPEXEC or gt_CSHARPEXEC(testexecutable, its-directory)
# Sets at most one of HAVE_MONO, HAVE_DOTNET, HAVE_CLIX.
# Sets HAVE_CSHARPEXEC to nonempty if csharpexec.sh will work.
AC_DEFUN([gt_CSHARPEXEC],
[
AC_REQUIRE([gt_CSHARP_CHOICE])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_MSG_CHECKING([for C[#] program execution engine])
AC_EGREP_CPP([yes], [
#if defined _WIN32 || defined __EMX__ || defined __DJGPP__
yes
#endif
], MONO_PATH_SEPARATOR=';', MONO_PATH_SEPARATOR=':')
HAVE_CSHARPEXEC=1
pushdef([AC_MSG_CHECKING],[:])dnl
pushdef([AC_CHECKING],[:])dnl
pushdef([AC_MSG_RESULT],[:])dnl
AC_CHECK_PROG([HAVE_MONO_IN_PATH], [mono], [yes])
AC_CHECK_PROG([HAVE_DOTNET_IN_PATH], [dotnet], [yes])
AC_CHECK_PROG([HAVE_CLIX_IN_PATH], [clix], [yes])
popdef([AC_MSG_RESULT])dnl
popdef([AC_CHECKING])dnl
popdef([AC_MSG_CHECKING])dnl
for impl in "$CSHARP_CHOICE" mono dotnet no; do
case "$impl" in
mono)
if test -n "$HAVE_MONO_IN_PATH" \
&& mono --version >/dev/null 2>/dev/null \
m4_if([$1], , , [&& mono $2/$1 >/dev/null 2>/dev/null]); then
HAVE_MONO=1
ac_result="mono"
break
fi
;;
dotnet)
if test -n "$HAVE_DOTNET_IN_PATH" \
&& dotnet --list-runtimes >/dev/null 2>/dev/null; then
HAVE_DOTNET=1
ac_result="dotnet"
break
fi
;;
sscli)
if test -n "$HAVE_CLIX_IN_PATH" \
m4_if([$1], , , [&& clix $2/$1 >/dev/null 2>/dev/null]); then
HAVE_CLIX=1
case $host_os in
cygwin* | mingw* | windows* | pw32*)
CLIX_PATH_VAR=PATH
;;
darwin* | rhapsody*)
CLIX_PATH_VAR=DYLD_LIBRARY_PATH
;;
*)
CLIX_PATH_VAR=LD_LIBRARY_PATH
;;
esac
eval CLIX_PATH=\"\$CLIX_PATH_VAR\"
ac_result="clix"
break
fi
;;
no)
HAVE_CSHARPEXEC=
ac_result="no"
break
;;
esac
done
AC_MSG_RESULT([$ac_result])
AC_SUBST([MONO_PATH])
AC_SUBST([MONO_PATH_SEPARATOR])
AC_SUBST([CLIX_PATH_VAR])
AC_SUBST([CLIX_PATH])
AC_SUBST([HAVE_MONO])
AC_SUBST([HAVE_DOTNET])
AC_SUBST([HAVE_CLIX])
])
@@ -0,0 +1,213 @@
#!/bin/sh
# Execute a C# program.
# Copyright (C) 2003-2026 Free Software Foundation, Inc.
# Written by Bruno Haible <bruno@clisp.org>, 2003.
#
# 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/>.
# This uses the same choices as csharpexec.c, but instead of relying on the
# environment settings at run time, it uses the environment variables
# present at configuration time.
#
# This is a separate shell script, because the various C# interpreters have
# different command line options.
#
# Usage: /bin/sh csharpexec.sh [OPTION] program.exe [ARGUMENTS]
# Options:
# -L DIRECTORY search for C# libraries also in DIRECTORY
# func_tmpdir
# creates a temporary directory.
# Sets variable
# - tmp pathname of freshly created temporary directory
func_tmpdir ()
{
# Use the environment variable TMPDIR, falling back to /tmp. This allows
# users to specify a different temporary directory, for example, if their
# /tmp is filled up or too small.
: "${TMPDIR=/tmp}"
{
# Use the mktemp program if available. If not available, hide the error
# message.
tmp=`(umask 077 && mktemp -d -q "$TMPDIR/gtXXXXXX") 2>/dev/null` &&
test -n "$tmp" && test -d "$tmp"
} ||
{
# Use a simple mkdir command. It is guaranteed to fail if the directory
# already exists. $RANDOM is bash specific and expands to empty in shells
# other than bash, ksh and zsh. Its use does not increase security;
# rather, it minimizes the probability of failure in a very cluttered /tmp
# directory.
tmp=$TMPDIR/gt$$-$RANDOM
(umask 077 && mkdir "$tmp")
} ||
{
echo "$0: cannot create a temporary directory in $TMPDIR" >&2
{ (exit 1); exit 1; }
}
}
libdirs_mono=
libdirs_dotnet=
prog=
while test $# != 0; do
case "$1" in
-L)
libdirs_mono="${libdirs_mono:+$libdirs_mono@MONO_PATH_SEPARATOR@}$2"
libdirs_dotnet="${libdirs_dotnet:+$libdirs_dotnet|}$2"
shift
;;
-*)
echo "csharpexec: unknown option '$1'" 1>&2
exit 1
;;
*)
prog="$1"
break
;;
esac
shift
done
if test -z "$prog"; then
echo "csharpexec: no program specified" 1>&2
exit 1
fi
case "$prog" in
*.exe) ;;
*)
echo "csharpexec: program is not a .exe" 1>&2
exit 1
;;
esac
if test -n "@HAVE_MONO@"; then
CONF_MONO_PATH='@MONO_PATH@'
if test -n "$libdirs_mono"; then
MONO_PATH="$libdirs_mono${CONF_MONO_PATH:+@MONO_PATH_SEPARATOR@$CONF_MONO_PATH}"
else
MONO_PATH="$CONF_MONO_PATH"
fi
export MONO_PATH
test -z "$CSHARP_VERBOSE" || echo mono "$@" 1>&2
exec mono "$@"
else
if test -n "@HAVE_DOTNET@"; then
# Invoke 'dotnet $prog ...'.
# Documentation:
# <https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet#options-for-running-an-application>
# This could be optimized on Windows platforms, because C# .exe files are
# directly executable there. But there's no point in optimizing specifically
# a non-free platform, especially since it would increase the test matrix.
shift
# On Windows, assume that 'dotnet' is a native Windows program, not a Cygwin program.
prog_arg="$prog"
case "@build_os@" in
cygwin*)
prog_arg=`cygpath -w "$prog"`
;;
esac
# Handle the -L options.
# The way this works is that we have to copy (or symlink) the DLLs into the
# directory where FOO.exe resides.
# Maybe there is another way to do this, but I haven't found it, trying
# - the --additionalprobingpath command-line option,
# - the additionalProbingPaths property in runtimeconfig.json,
# - adding a --deps deps.json option,
# cf. <https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet#options-for-running-an-application>
# and <https://github.com/dotnet/runtime/blob/main/docs/design/features/host-probing.md>.
tmpfiles=
if test -n "$libdirs_dotnet"; then
# Make sure the added DLLs are removed when this script terminates.
func_cleanup_tmpfiles()
{
saved_IFS="$IFS"
IFS='|'
for file in $tmpfiles; do
IFS="$saved_IFS"
rm -f "$file"
done
IFS="$saved_IFS"
}
trap func_cleanup_tmpfiles HUP INT QUIT PIPE TERM
trap 'exit_status=$?; func_cleanup_tmpfiles; exit $exit_status' EXIT
# Copy the DLLs.
prog_dir=`dirname "$prog"`
saved_IFS="$IFS"
IFS='|'
for dir in $libdirs_dotnet; do
IFS="$saved_IFS"
for file in `cd "$dir" && echo *.dll`; do
if test -f "$prog_dir/$file"; then
# A DLL of this name is already at the expected location.
:
else
tmpfiles="${tmpfiles:+$tmpfiles|}$prog_dir/$file"
cp "$dir/$file" "$prog_dir/$file" || exit 1
fi
done
done
IFS="$saved_IFS"
fi
if test -f "${prog%.exe}.runtimeconfig.json"; then
# There is already a FOO.runtimeconfig.json alongside FOO.exe.
dotnet exec "$prog_arg" "$@"
result=$?
else
# dotnet needs a FOO.runtimeconfig.json alongside FOO.exe in order to
# execute FOO.exe. Create a dummy one in a temporary directory
# (because the directory where FOO.exe sits is not necessarily writable).
# Documentation of this file format:
# <https://learn.microsoft.com/en-us/dotnet/core/runtime-config/>
func_tmpdir
runtimeconfig="$tmp"/runtimeconfig.json
dotnet --list-runtimes | sed -n -e 's/Microsoft.NETCore.App \([^ ]*\) .*/{ "runtimeOptions": { "framework": { "name": "Microsoft.NETCore.App", "version": "\1" } } }/p' > "$runtimeconfig"
runtimeconfig_arg="$runtimeconfig"
case "@build_os@" in
cygwin*)
runtimeconfig_arg=`cygpath -w "$runtimeconfig"`
;;
esac
test -z "$CSHARP_VERBOSE" || echo dotnet exec --runtimeconfig "$runtimeconfig_arg" "$prog_arg" "$@" 1>&2
dotnet exec --runtimeconfig "$runtimeconfig_arg" "$prog_arg" "$@"
result=$?
rm -f "$runtimeconfig"
rmdir "$tmp"
fi
exit $result
else
if test -n "@HAVE_CLIX@"; then
CONF_CLIX_PATH='@CLIX_PATH@'
if test -n "$libdirs_mono"; then
@CLIX_PATH_VAR@="$libdirs_mono${CONF_CLIX_PATH:+@MONO_PATH_SEPARATOR@$CONF_CLIX_PATH}"
else
@CLIX_PATH_VAR@="$CONF_CLIX_PATH"
fi
export @CLIX_PATH_VAR@
shift
# On Windows, assume that 'clix' is a native Windows program,
# not a Cygwin program.
case "@build_os@" in
cygwin*)
prog=`cygpath -w "$prog"`
;;
esac
test -z "$CSHARP_VERBOSE" || echo clix "$prog" "$@" 1>&2
exec clix "$prog" "$@"
else
echo 'C# virtual machine not found, try installing mono or dotnet, then reconfigure' 1>&2
exit 1
fi
fi
fi
@@ -0,0 +1,100 @@
# dcomp.m4
# serial 3
dnl Copyright (C) 2025-2026 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This file is offered as-is, without any warranty.
# There are three D implementations, see
# <https://en.wikipedia.org/wiki/D_(programming_language)#Implementations>
# <https://wiki.dlang.org/Compilers>
# <https://dub.pm/dub-reference/build_settings/#buildoptions>
# Although each has different possible options, a few options are accepted by
# all of the implementations: -c, -I, -g, -O. Some essential options, however,
# are different:
# gdc ldc2 dmd
# ---------- ------------------- ------------
# -oFILE -of=FILE, --of=FILE -of=FILE
# -lLIBRARY -L -lLIBRARY -L=-lLIBRARY
# -LDIR -L -LDIR -L=-LDIR
# -Wl,OPTION -L OPTION -L=OPTION
# Checks for a D implementation.
# Sets DC and DFLAGS (options that can be used with "$DC").
AC_DEFUN([gt_DCOMP],
[
AC_MSG_CHECKING([for D compiler])
pushdef([AC_MSG_CHECKING],[:])dnl
pushdef([AC_CHECKING],[:])dnl
pushdef([AC_MSG_RESULT],[:])dnl
AC_ARG_VAR([DC], [D compiler command])
AC_ARG_VAR([DFLAGS], [D compiler options])
dnl On OpenBSD, gdc is called 'egdc' and works less well than dmd.
dnl Like AC_CHECK_TOOLS([DC], [gdc ldc2 dmd egdc]) but check whether the
dnl compiler can actually compile a trivial program. We may simplify this
dnl once <https://savannah.gnu.org/support/index.php?111256> is implemented.
if test -z "$DC"; then
echo > empty.d
if test -n "${host_alias}"; then
if test -z "$DC"; then
DC="${host_alias}-gdc"
echo "$as_me:${as_lineno-$LINENO}: trying ${DC}..." >&AS_MESSAGE_LOG_FD
if ${DC} -c empty.d 2>&AS_MESSAGE_LOG_FD; then :; else DC= ; fi
fi
if test -z "$DC"; then
DC="${host_alias}-ldc2"
echo "$as_me:${as_lineno-$LINENO}: trying ${DC}..." >&AS_MESSAGE_LOG_FD
if ${DC} -c empty.d 2>&AS_MESSAGE_LOG_FD; then :; else DC= ; fi
fi
if test -z "$DC"; then
DC="${host_alias}-dmd"
echo "$as_me:${as_lineno-$LINENO}: trying ${DC}..." >&AS_MESSAGE_LOG_FD
if ${DC} -c empty.d 2>&AS_MESSAGE_LOG_FD; then :; else DC= ; fi
fi
if test -z "$DC"; then
DC="${host_alias}-egdc"
echo "$as_me:${as_lineno-$LINENO}: trying ${DC}..." >&AS_MESSAGE_LOG_FD
if ${DC} -c empty.d 2>&AS_MESSAGE_LOG_FD; then :; else DC= ; fi
fi
fi
if test -z "$DC"; then
DC="gdc"
echo "$as_me:${as_lineno-$LINENO}: trying ${DC}..." >&AS_MESSAGE_LOG_FD
if ${DC} -c empty.d 2>&AS_MESSAGE_LOG_FD; then :; else DC= ; fi
fi
if test -z "$DC"; then
DC="ldc2"
echo "$as_me:${as_lineno-$LINENO}: trying ${DC}..." >&AS_MESSAGE_LOG_FD
if ${DC} -c empty.d 2>&AS_MESSAGE_LOG_FD; then :; else DC= ; fi
fi
if test -z "$DC"; then
DC="dmd"
echo "$as_me:${as_lineno-$LINENO}: trying ${DC}..." >&AS_MESSAGE_LOG_FD
if ${DC} -c empty.d 2>&AS_MESSAGE_LOG_FD; then :; else DC= ; fi
fi
if test -z "$DC"; then
DC="egdc"
echo "$as_me:${as_lineno-$LINENO}: trying ${DC}..." >&AS_MESSAGE_LOG_FD
if ${DC} -c empty.d 2>&AS_MESSAGE_LOG_FD; then :; else DC= ; fi
fi
rm -f empty.d empty.o empty.obj
fi
popdef([AC_MSG_RESULT])dnl
popdef([AC_CHECKING])dnl
popdef([AC_MSG_CHECKING])dnl
if test -n "$DC"; then
ac_result="$DC"
else
ac_result="no"
fi
AC_MSG_RESULT([$ac_result])
AC_SUBST([DC])
if test -z "$DFLAGS" && test -n "$DC"; then
case `$DC --version | sed -e 's/ .*//' -e 1q` in
gdc | *-gdc | egdc | *-egdc | LDC*) DFLAGS="-g -O2" ;;
*) DFLAGS="-g -O" ;;
esac
fi
AC_SUBST([DFLAGS])
])
@@ -0,0 +1,139 @@
#!/bin/sh
# Compile a D program, library, or compilation unit.
# Copyright (C) 2025-2026 Free Software Foundation, Inc.
# Written by Bruno Haible <bruno@clisp.org>, 2025.
#
# 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/>.
# Usage: /bin/sh dcomp.sh [OPTION] SOURCE.d ...
# where the supported OPTIONs are:
# -I DIR
# -c
# -g
# -O (mapped to -O or -O2, depending on implementation)
# -o FILE (for libtool compatibility)
# -lLIBRARY (for libtool compatibility)
# -LDIR (for libtool compatibility)
# -pthread (for libtool compatibility)
# -Wl,OPTION (for libtool compatibility)
# Find out which implementation we are using.
case `@DC@ --version | sed -e 's/ .*//' -e 1q` in
gdc | *-gdc | egdc | *-egdc) flavor=gdc ;;
LDC*) flavor=ldc ;;
DMD*) flavor=dmd ;;
*)
echo "Warning: implementation flavor of '"'@DC@'"' not recognized." 1>&2
flavor=dmd ;;
esac
# In order to construct a command that invokes the D compiler, we need 'eval',
# because some of the arguments may contain spaces.
options_for_print=
options_for_eval=
# Protecting special characters, hiding them from 'eval':
# Double each backslash.
sed_protect_1='s/\\/\\\\/g'
# Escape each dollar, backquote, double-quote.
sed_protect_2a='s/\$/\\$/g'
sed_protect_2b='s/`/\\`/g'
sed_protect_2c='s/"/\\"/g'
# Add double-quotes at the beginning and end of the word.
sed_protect_3a='1s/^/"/'
sed_protect_3b='$s/$/"/'
func_add_word_to_options ()
{
options_for_print="${options_for_print:+$options_for_print }$1"
word_protected=`echo "$1" | sed -e "$sed_protect_1" -e "$sed_protect_2a" -e "$sed_protect_2b" -e "$sed_protect_2c" -e "$sed_protect_3a" -e "$sed_protect_3b"`
options_for_eval="${options_for_eval:+$options_for_eval }$word_protected"
}
# Process the arguments.
next_is_arg_of=
for arg
do
if test -z "$next_is_arg_of"; then
case "$arg" in
-I | -l | -L)
echo "dcomp: Unsupported option: $arg. Combine with next argument." 1>&2
exit 1
;;
-I* | -c | -g)
func_add_word_to_options "$arg"
;;
-O)
case "$flavor" in
gdc | ldc) func_add_word_to_options "-O2" ;;
dmd) func_add_word_to_options "-O" ;;
esac
;;
-o) next_is_arg_of='o' ;;
-l* | -L* | -pthread)
case "$arg" in
-pthread) arg='-lpthread' ;;
esac
case "$flavor" in
gdc) func_add_word_to_options "$arg" ;;
ldc) func_add_word_to_options '-L'; func_add_word_to_options "$arg" ;;
dmd) func_add_word_to_options "-L=$arg" ;;
esac
;;
-Wl,*)
if test "$flavor" = gdc; then
func_add_word_to_options "$arg"
else
option=`echo "$arg" | sed -e 's/^-Wl,//'`
case "$flavor" in
ldc) func_add_word_to_options '-L'; func_add_word_to_options "$option" ;;
dmd) func_add_word_to_options "-L=$option" ;;
esac
fi
;;
-*)
echo "dcomp: Unsupported option: $arg" 1>&2
exit 1
;;
*)
# dmd rejects shared library file names such as libfoo.so.1.3:
# "Error: unrecognized file extension 3"
if test "$flavor" = dmd \
&& case `basename "$arg"` in lib*.so.*) true ;; *) false ;; esac; then
func_add_word_to_options "-L=$arg"
else
func_add_word_to_options "$arg"
fi
;;
esac
else
case "$next_is_arg_of" in
o)
case "$flavor" in
gdc) func_add_word_to_options '-o'; func_add_word_to_options "$arg" ;;
*) func_add_word_to_options "-of=$arg" ;;
esac
;;
esac
next_is_arg_of=
fi
done
if test -n "$next_is_arg_of"; then
echo "dcomp: missing argument to option -$next_is_arg_of" 1>&2
exit 1
fi
# Execute the command.
test -z "$D_VERBOSE" || echo "@DC@ @DFLAGS@ $options_for_print" 1>&2
eval "@DC@ @DFLAGS@ $options_for_eval"
exit $?
@@ -0,0 +1,127 @@
# gocomp.m4
# serial 1
dnl Copyright (C) 2025-2026 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This file is offered as-is, without any warranty.
# There are two Go implementations, that differ essentially only regarding
# the compiler and the used runtime version:
# * The golang Go is the original implementation, typically a little more
# up-to-date. It supports only the major computing platforms.
# * The GCC Go implementation is part of the GNU Compiler Collection.
# It lags behind a bit. It supports all platforms supported by GCC.
# The golang Go implementation produces smaller executables, and the
# binary packages needed for development are smaller as well.
#
# Therefore the preferred implementation is
# * golang where available,
# * GCC on the platforms where golang is not available. This includes in
# particular:
# - Linux/alpha, Linux/hppa, Linux/m68k, Linux/sparc, Linux/powerpc (32-bit)
# - GNU/Hurd
# - Solaris/sparc
# - Haiku
# Sets GO_CHOICE to the preferred Go compiler implementation:
# 'golang' or 'gcc' or 'any' or 'no'.
# Here
# - 'golang' means the original Go compiler.
# - 'gcc' means GCC Go compiler.
# The runtime library of both is the same (possibly in different versions,
# though).
AC_DEFUN([gt_GO_CHOICE],
[
AC_MSG_CHECKING([for preferred Go compiler])
AC_ARG_ENABLE([go],
[ --enable-go[[=IMPL]] choose preferred Go compiler (golang, gcc)],
[GO_CHOICE="$enableval"],
[GO_CHOICE=any])
AC_SUBST([GO_CHOICE])
AC_MSG_RESULT([$GO_CHOICE])
])
# How to run Go programs?
# Assume you want to distribute a Go program. In which form? And what are
# the dependencies to do so?
#
# There are three ways to do so:
#
# * Run the program by compiling it on-the-fly in a temporary directory
# and running it from there:
# ${GO} run foo.go
# You would distribute foo.go (very small).
# But the dependencies are large: the Go development environment.
# On Ubuntu 24.04 this is:
# - with 'golang': the package 'golang-go'
# 11 MB for /usr/lib/go-1.22/bin/go,
# 85 MB for /usr/lib/go-1.22/pkg/tool/linux_amd64/*
# = 96 MB in total
# - with 'gccgo': the package 'gccgo-13'
# 60 MB for /usr/lib/x86_64-linux-gnu/libgo.so.22.0.0,
# > 40 MB for /usr/libexec/gcc/x86_64-linux-gnu/13/go1
# and /usr/bin/x86_64-linux-gnu-go-13,
# 116 MB for /usr/lib/gcc/x86_64-linux-gnu/13/libgo.a
# = 216 MB in total.
#
# * You distribute the binary, linked against the shared Go runtime library.
# Running the program is just invoking that binary.
# On Ubuntu the dependencies are:
# - with 'golang': unsupported.
# - with 'gccgo': the package 'libgo22'
# 60 MB for /usr/lib/x86_64-linux-gnu/libgo.so.22.0.0
# = 60 MB in total.
#
# * You distribute the binary, linked statically with the needed parts
# of the Go runtime library:
# ${GO} build ${GOCOMPFLAGS} foo.go
# Running the program is just invoking that binary.
# On Ubuntu the dependencies are:
# - with 'golang': No dependencies; the binary is statically linked.
# The stripped executable's size is >= 1 MB.
# - with 'gccgo': No dependencies; the binary is statically linked
# (when using GOCOMPFLAGS='-static') or statically linked except for
# the standard C library (when using GOCOMPFLAGS='-static-libgo').
# The stripped executable's size is 5 MB or 6 MB, respectively.
# Distros generally prefer avoiding dynamic linking with libc,
# so let's use that.
#
# It is clear that the third approach will be preferred for small programs.
# Prerequisites of gocomp.sh.
# Checks for a Go implementation.
# Sets HAVE_GOCOMP to nonempty if gocomp.sh will work.
# Also sets GO and GOCOMPFLAGS (options that can be used with "$GO build").
AC_DEFUN([gt_GOCOMP],
[
AC_REQUIRE([gt_GO_CHOICE])
AC_MSG_CHECKING([for Go compiler])
HAVE_GOCOMP=1
pushdef([AC_MSG_CHECKING],[:])dnl
pushdef([AC_CHECKING],[:])dnl
pushdef([AC_MSG_RESULT],[:])dnl
dnl Prefer golang over gcc by default, because it produces much smaller
dnl executables (see above).
if test "$GO_CHOICE" = gcc; then
AC_PATH_PROGS([GO], [go-30 go-29 go-28 go-27 go-26 go-25 go-24 go-23 go-22 go-21 go-20 go-19 go-18 go-17 go-16 go-15 go-14 go-13 go-12 go-11 go-10 go-9 go-8 go-7 go-6 go-5 go])
else
AC_PATH_PROGS([GO], [go go-30 go-29 go-28 go-27 go-26 go-25 go-24 go-23 go-22 go-21 go-20 go-19 go-18 go-17 go-16 go-15 go-14 go-13 go-12 go-11 go-10 go-9 go-8 go-7 go-6 go-5])
fi
popdef([AC_MSG_RESULT])dnl
popdef([AC_CHECKING])dnl
popdef([AC_MSG_CHECKING])dnl
if test -n "$GO"; then
case "$GO" in
go | */go ) GOCOMPFLAGS= ;;
*) GOCOMPFLAGS='-gccgoflags=-static-libgo' ;;
esac
ac_result="$GO"
else
HAVE_GOCOMP=
ac_result="no"
fi
AC_MSG_RESULT([$ac_result])
AC_SUBST([GO])
AC_SUBST([GOCOMPFLAGS])
])
@@ -0,0 +1,32 @@
#!/bin/sh
# Compile a Go program.
# Copyright (C) 2025-2026 Free Software Foundation, Inc.
# Written by Bruno Haible <haible@clisp.cons.org>, 2025.
#
# 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/>.
# Usage: /bin/sh gocomp.sh [OPTION] SOURCE.go ...
#
# Limitation: Go programs that make use of the C to Go interface ('cgo') are
# unsupported.
# Avoid error "CC environment variable is relative; must be absolute path"
# on native Windows. Cf.
# <https://github.com/golang/go/commit/aa161e799df7e1eba99d2be10271e76b6f758142>
unset CC
unset CXX
test -z "$GO_VERBOSE" || echo "@GO@ build @GOCOMPFLAGS@ $@"
exec @GO@ build @GOCOMPFLAGS@ "$@"
@@ -0,0 +1,477 @@
# javacomp.m4
# serial 27
dnl Copyright (C) 2001-2003, 2006-2007, 2009-2026 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This file is offered as-is, without any warranty.
# Prerequisites of javacomp.sh.
# gt_JAVACOMP([source-version], [target-version])
# Sets HAVE_JAVACOMP to nonempty if javacomp.sh will allow Java source code
# according to source-version to be compiled to Java bytecode classes in the
# target-version format.
#
# source-version can be: support for
# 1.8 lambdas
# 9 private interface methods
# 10 type inference for local variables
# 11 'var' in parameters of lambda expressions
# ...
# (For reference, see <https://en.wikipedia.org/wiki/Java_version_history>.)
# If source-version 1.3 or 1.4 or 1.5 or 1.6 or 1.7 is requested, it gets mapped
# to 1.8, for backward compatibility. (Currently the minimum Java and javac
# version we need to support is Java 1.8, since older versions are
# out-of-support, see
# <https://en.wikipedia.org/wiki/Java_version_history#Release_table>.)
#
# target-version can be: classfile version:
# 1.8 52.0
# 9 53.0
# 10 54.0
# 11 55.0
# ... ...
# The classfile version of a .class file can be determined through the "file"
# command. More portably, the classfile major version can be determined through
# "od -A n -t d1 -j 7 -N 1 classfile".
# If a target-version below 1.8 is requested, it gets mapped to 1.8, for
# backward compatibility. (Currently the minimum Java and javac version we need
# to support is Java 1.8, since older versions are out-of-support, see
# <https://en.wikipedia.org/wiki/Java_version_history#Release_table>.)
#
# target-version can also be omitted. In this case, the required target-version
# is determined from the found JVM (see macro gt_JAVAEXEC):
# target-version for JVM
# 1.8 JDK/JRE 8
# 9 JDK/JRE 9
# 10 JDK/JRE 10
# 11 JDK/JRE 11
# ... ...
#
# Specifying target-version is useful when building a library (.jar) that is
# useful outside the given package. Omitting target-version is useful when
# building an application.
#
# It is unreasonable to ask for a target-version < source-version, such as
# - target-version < 1.4 with source-version >= 1.4, or
# - target-version < 1.5 with source-version >= 1.5, or
# - target_version < 1.6 with source_version >= 1.6, or
# - target_version < 1.7 with source_version >= 1.7, or
# - target_version < 1.8 with source_version >= 1.8, or
# - target_version < 9 with source_version >= 9, or
# - target_version < 10 with source_version >= 10, or
# - target_version < 11 with source_version >= 11, or
# - ...
# because even Sun's/Oracle's javac doesn't support these combinations.
#
# It is redundant to ask for a target-version > source-version, since the
# smaller target-version = source-version will also always work and newer JVMs
# support the older target-versions too.
AC_DEFUN([gt_JAVACOMP],
[
m4_if([$2], [], [AC_REQUIRE([gt_JAVAEXEC])], [])
AC_EGREP_CPP([yes], [
#if defined _WIN32 || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
yes
#endif
], CLASSPATH_SEPARATOR=';', CLASSPATH_SEPARATOR=':')
source_version=$1
test -n "$source_version" || {
AC_MSG_ERROR([missing source-version argument to gt_@&t@JAVACOMP])
}
case "$source_version" in
1.1 | 1.2 | 1.3 | 1.4 | 1.5 | 1.6 | 1.7) source_version='1.8' ;;
esac
m4_if([$2], [],
[if test -n "$HAVE_JAVAEXEC"; then
dnl Use $CONF_JAVA to determine the JVM's version.
changequote(,)dnl
cat > conftestver.java <<EOF
public class conftestver {
public static void main (String[] args) {
System.out.println(System.getProperty("java.specification.version"));
}
}
EOF
changequote([,])dnl
dnl A precompiled version of conftestver.java, compiled with
dnl "javac -target 1.1". This avoids having to compile conftestver.java
dnl during each test for a suitable Java compiler.
dnl For the conversion from binary to this ASCII encapsulation, avoiding
dnl to assume the presence of uudecode, use the command
dnl $ od -A n -t o1 < conftestver.class | tr ' ' '\012'| sort | uniq | sed -e '/^$/d' -e 's,^,\\,' | tr -d '\012'
dnl and the long tr command in opposite direction.
dnl Finally move the position corresponding to \055 to the last position,
dnl to work around a coreutils-5.x bug.
echo 'yzwx!$!I!D,!)!3+!4!5*!6,!4!7,!8!9)!:)!;"!(MeienN"!$FGW"!%Ojab"!2QeibRohZblVYZgb"!%hYei"!9FXQfYpYKgYidKUnleidLGW"!,Ujol_bPegb"!3_jicnbmnpblJfYpY/!*!+)!</!=!>"!=fYpYJmkb_ece_YnejiJpblmeji/!?!@)!A/!B!C"!._jicnbmnpbl"!3fYpYKgYidKSZfb_n"!3fYpYKgYidKUqmnbh"!$jon"!8QfYpYKejKTleinUnlbYhL"!.dbnTljkblnq"!EFQfYpYKgYidKUnleidLGQfYpYKgYidKUnleidL"!6fYpYKejKTleinUnlbYh"!)kleingi"!8FQfYpYKgYidKUnleidLGW!D!(!)!!!!!#!"!*!+!"!,!!!@!"!"!!!&Hu!"r!!!"!.!!!(!"!!!"!+!/!0!"!,!!!F!#!"!!!/s!#5$v!%t!&r!!!"!.!!!,!#!!!$!.!%!"!1!!!#!2' \
| tr -d '\012\015' \
| tr '!"#$%&()*+,./0123456789:;<=>?@ABCDEFGHJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyzI' '\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\046\050\051\052\056\057\073\074\076\103\106\114\116\117\120\123\124\126\133\141\142\143\144\145\146\147\151\152\154\155\156\157\160\162\163\164\165\166\171\261\262\266\267\270\272\276\312\376\055' \
> conftestver.class
java_exec_version=`{
unset JAVA_HOME
echo "$as_me:__oline__: CLASSPATH=.${CLASSPATH:+$CLASSPATH_SEPARATOR$CLASSPATH} $CONF_JAVA conftestver" >&AS_MESSAGE_LOG_FD
CLASSPATH=.${CLASSPATH:+$CLASSPATH_SEPARATOR$CLASSPATH} $CONF_JAVA conftestver 2>&AS_MESSAGE_LOG_FD
}`
case "$java_exec_version" in
null)
dnl JDK 1.1.X returns null.
java_exec_version=1.1 ;;
esac
case "$java_exec_version" in
1.1 | 1.2 | 1.3 | 1.4 | 1.5 | 1.6 | 1.7)
AC_MSG_WARN([$CONF_JAVA is too old, cannot compile Java code for this old version any more])
target_version=1.8 ;;
changequote(,)dnl
1.8 | 9 | [1-9][0-9])
changequote([,])dnl
dnl Here we could choose any target_version between $source_version
dnl and the $java_exec_version. (If it is too small, it will be
dnl incremented below until it works.) Since we documented above that
dnl it is determined from the JVM, we do that:
target_version="$java_exec_version" ;;
*) AC_MSG_WARN([unknown target-version $target_version, please update gt_@&t@JAVACOMP macro])
target_version=1.8 ;;
esac
else
target_version="1.8"
fi
],
[target_version=$2
case "$target_version" in
1.1 | 1.2 | 1.3 | 1.4 | 1.5 | 1.6 | 1.7) target_version='1.8' ;;
esac
])
case "$source_version" in
changequote(,)dnl
1.8 | 9 | [1-9][0-9]) ;;
changequote([,])dnl
*) AC_MSG_ERROR([invalid source-version argument to gt_@&t@JAVACOMP: $source_version]) ;;
esac
case "$target_version" in
changequote(,)dnl
1.8 | 9 | [1-9][0-9]) ;;
changequote([,])dnl
*) AC_MSG_ERROR([invalid target-version argument to gt_@&t@JAVACOMP: $target_version]) ;;
esac
# Function to output the classfile version of a file (8th byte) in decimal.
if od -A x < /dev/null >/dev/null 2>/dev/null; then
# Use POSIX od.
func_classfile_version ()
{
od -A n -t d1 -j 7 -N 1 "[$]1"
}
else
# Use BSD hexdump.
func_classfile_version ()
{
dd if="[$]1" bs=1 count=1 skip=7 2>/dev/null | hexdump -e '1/1 "%3d "'
echo
}
fi
AC_MSG_CHECKING([for Java compiler])
dnl
dnl The support of Sun/Oracle javac for target-version and source-version:
dnl
dnl javac 1.8: -target 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 default: 1.8
dnl -source 1.3 1.4 1.5 1.6 1.7 1.8 default: 1.8
dnl -target 1.1/1.2/1.3 only possible with -source 1.3
dnl -target 1.4 only possible with -source 1.3/1.4
dnl -target 1.5 only possible with -source 1.3/1.4/1.5
dnl -target 1.6 only possible with -source 1.3/1.4/1.5/1.6
dnl -target 1.7 only possible with -source 1.3/1.4/1.5/1.6/1.7
dnl
dnl javac 9: -target 1.6 1.7 1.8 9 default: 9
dnl -source 1.6 1.7 1.8 9 default: 9
dnl -target 1.6 only possible with -source 1.6
dnl -target 1.7 only possible with -source 1.6/1.7
dnl -target 1.8 only possible with -source 1.6/1.7/1.8
dnl
dnl javac 10: -target 1.6 1.7 1.8 9 10 default: 10
dnl -source 1.6 1.7 1.8 9 10 default: 10
dnl -target 1.6 only possible with -source 1.6
dnl -target 1.7 only possible with -source 1.6/1.7
dnl -target 1.8 only possible with -source 1.6/1.7/1.8
dnl -target 9 only possible with -source 1.6/1.7/1.8/9
dnl
dnl and so on.
dnl This can be summarized in this table:
dnl
dnl javac classfile valid -source and obsolete -source
dnl version default version -target values and -target values
dnl ------- --------------- ----------------- ------------------
dnl 1.8 52.0 1.3 .. 1.8 1.3 .. 1.5
dnl 9 53.0 1.6 .. 9 1.6
dnl 10 54.0 1.6 .. 10 1.6
dnl 11 55.0 1.6 .. 11 1.6
dnl 12 56.0 1.7 .. 12 1.7
dnl 13 57.0 1.7 .. 13 1.7
dnl 14 58.0 1.7 .. 14 1.7
dnl 15 59.0 1.7 .. 15 1.7
dnl 16 60.0 1.7 .. 16 1.7
dnl 17 61.0 1.7 .. 17 1.7
dnl 18 62.0 1.7 .. 18 1.7
dnl 19 63.0 1.7 .. 19 1.7
dnl 20 64.0 1.8 .. 20 1.8
dnl
dnl The -source option value must be <= the -target option value.
dnl The minimal -source and -target option value produces an "is obsolete"
dnl warning (in javac 1.8 or newer). Additionally, if the -source option
dnl value is not the maximal possible one, i.e. not redundant, it produces a
dnl "bootstrap class path not set in conjunction with -source ..." warning
dnl (in javac 1.7 or newer).
dnl
dnl To get rid of these warnings, two options are available:
dnl * -nowarn. This option is supported since javac 1.6 at least. But
dnl it is overkill, because it would also silence warnings about the
dnl code being compiled.
dnl * -Xlint:-options. This option is supported since javac 1.6 at least.
dnl In javac 1.6 it is an undocumented no-op.
dnl We use -Xlint:-options and omit it only if we find that the compiler
dnl does not support it (which is unlikely).
dnl
dnl Canonicalize source_version and target_version, for easier arithmetic.
case "$source_version" in
1.*) source_version=`echo "$source_version" | sed -e 's/^1\.//'` ;;
esac
case "$target_version" in
1.*) target_version=`echo "$target_version" | sed -e 's/^1\.//'` ;;
esac
CONF_JAVAC=
HAVE_JAVAC_ENVVAR=
HAVE_JAVAC=
HAVE_JAVACOMP=
dnl Sanity check.
if expr $source_version '<=' $target_version >/dev/null; then
echo 'class conftest {}' > conftest.java
dnl If the user has set the JAVAC environment variable, use that, if it
dnl satisfies the constraints (possibly after adding -target and -source
dnl options).
if test -n "$JAVAC"; then
dnl Test whether $JAVAC is usable.
dnl At the same time, determine which option to use to inhibit warnings;
dnl see the discussion above.
nowarn_option=' -Xlint:-options'
if { rm -f conftest.class \
&& { echo "$as_me:__oline__: $JAVAC$nowarn_option -d . conftest.java" >&AS_MESSAGE_LOG_FD
$JAVAC$nowarn_option -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
} \
&& test -f conftest.class
} || { \
nowarn_option=
rm -f conftest.class \
&& { echo "$as_me:__oline__: $JAVAC$nowarn_option -d . conftest.java" >&AS_MESSAGE_LOG_FD
$JAVAC$nowarn_option -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
} \
&& test -f conftest.class
}; then
compiler_cfversion=`func_classfile_version conftest.class`
compiler_target_version=`expr $compiler_cfversion - 44`
dnl It is hard to determine the compiler_source_version. This would
dnl require a list of code snippets that can be compiled only with a
dnl specific '-source' option and up, and this list would need to grow
dnl every 6 months.
dnl Also, $JAVAC may already include a '-source' option.
dnl Therefore, pass a '-source' option always.
source_option=' -source '`case "$source_version" in 6|7|8) echo 1. ;; esac`"$source_version"
dnl And pass a '-target' option as well, if needed.
dnl (All supported javac versions support both, see the table above.)
if expr $target_version = $compiler_target_version >/dev/null; then
target_option=
else
target_option=' -target '`case "$target_version" in 6|7|8) echo 1. ;; esac`"$target_version"
fi
if { echo "$as_me:__oline__: $JAVAC$nowarn_option$source_option$target_option -d . conftest.java" >&AS_MESSAGE_LOG_FD
$JAVAC$nowarn_option$source_option$target_option -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
} \
&& test -f conftest.class; then
dnl The compiler directly supports the desired source_version and
dnl target_version. Perfect.
CONF_JAVAC="$JAVAC$nowarn_option$source_option$target_option"
HAVE_JAVAC_ENVVAR=1
HAVE_JAVACOMP=1
else
dnl If the desired source_version or target_version were too large
dnl for the compiler, there's nothing else we can do.
compiler_version=`echo "$as_me:__oline__: $JAVAC -version | sed -e 1q" >&AS_MESSAGE_LOG_FD
$JAVAC -version | sed -e 1q`
changequote(,)dnl
compiler_version=`echo "$compiler_version" | sed -e 's/^[^0-9]*\([0-9][0-9.]*\).*/\1/'`
changequote([,])dnl
case "$compiler_version" in
1.*) dnl Map 1.8.0_151 to 8.
compiler_version=`echo "$compiler_version" | sed -e 's/^1\.//' -e 's/\..*//'`
;;
*) dnl Map 9.0.4 to 9, 10.0.2 to 10, etc.
compiler_version=`echo "$compiler_version" | sed -e 's/\..*//'`
;;
esac
if expr $source_version '<=' "$compiler_version" >/dev/null \
&& expr $target_version '<=' "$compiler_version" >/dev/null; then
dnl Increase $source_version and $compiler_version until the
dnl compiler accepts these values. This is necessary to make
dnl e.g. $source_version = 6 work with Java 12 or newer, or
dnl $source_version = 7 work with Java 20 or newer.
try_source_version="$source_version"
try_target_version="$target_version"
while true; do
dnl Invariant: $try_source_version <= $try_target_version.
if expr $try_source_version = $try_target_version >/dev/null; then
try_target_version=`expr $try_target_version + 1`
fi
try_source_version=`expr $try_source_version + 1`
expr $try_source_version '<=' $compiler_version >/dev/null || break
source_option=' -source '`case "$try_source_version" in 8) echo 1. ;; esac`"$try_source_version"
if expr $try_target_version = $compiler_target_version >/dev/null; then
target_option=
else
target_option=' -target '`case "$try_target_version" in 8) echo 1. ;; esac`"$try_target_version"
fi
if { echo "$as_me:__oline__: $JAVAC$nowarn_option$source_option$target_option -d . conftest.java" >&AS_MESSAGE_LOG_FD
$JAVAC$nowarn_option$source_option$target_option -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
} \
&& test -f conftest.class; then
dnl The compiler supports the try_source_version and
dnl try_target_version. It's better than nothing.
CONF_JAVAC="$JAVAC$nowarn_option$source_option$target_option"
HAVE_JAVAC_ENVVAR=1
HAVE_JAVACOMP=1
break
fi
done
fi
fi
fi
fi
if test -z "$HAVE_JAVACOMP"; then
pushdef([AC_MSG_CHECKING],[:])dnl
pushdef([AC_CHECKING],[:])dnl
pushdef([AC_MSG_RESULT],[:])dnl
AC_CHECK_PROG([HAVE_JAVAC_IN_PATH], [javac], [yes])
popdef([AC_MSG_RESULT])dnl
popdef([AC_CHECKING])dnl
popdef([AC_MSG_CHECKING])dnl
if test -z "$HAVE_JAVACOMP" && test -n "$HAVE_JAVAC_IN_PATH"; then
dnl Test whether javac is usable.
dnl At the same time, determine which option to use to inhibit warnings;
dnl see the discussion above.
nowarn_option=' -Xlint:-options'
if { rm -f conftest.class \
&& { echo "$as_me:__oline__: javac$nowarn_option -d . conftest.java" >&AS_MESSAGE_LOG_FD
javac$nowarn_option -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
} \
&& test -f conftest.class
} || { \
nowarn_option=
rm -f conftest.class \
&& { echo "$as_me:__oline__: javac$nowarn_option -d . conftest.java" >&AS_MESSAGE_LOG_FD
javac$nowarn_option -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
} \
&& test -f conftest.class
}; then
compiler_cfversion=`func_classfile_version conftest.class`
compiler_target_version=`expr $compiler_cfversion - 44`
dnl It is hard to determine the compiler_source_version. This would
dnl require a list of code snippets that can be compiled only with a
dnl specific '-source' option and up, and this list would need to grow
dnl every 6 months.
dnl Also, javac may point to a shell script that already includes a
dnl '-source' option.
dnl Therefore, pass a '-source' option always.
source_option=' -source '`case "$source_version" in 8) echo 1. ;; esac`"$source_version"
dnl And pass a '-target' option as well, if needed.
dnl (All supported javac versions support both, see the table above.)
if expr $target_version = $compiler_target_version >/dev/null; then
target_option=
else
target_option=' -target '`case "$target_version" in 8) echo 1. ;; esac`"$target_version"
fi
if { echo "$as_me:__oline__: javac$nowarn_option$source_option$target_option -d . conftest.java" >&AS_MESSAGE_LOG_FD
javac$nowarn_option$source_option$target_option -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
} \
&& test -f conftest.class; then
dnl The compiler directly supports the desired source_version and
dnl target_version. Perfect.
CONF_JAVAC="javac$nowarn_option$source_option$target_option"
HAVE_JAVAC=1
HAVE_JAVACOMP=1
else
dnl If the desired source_version or target_version were too large
dnl for the compiler, there's nothing else we can do.
compiler_version=`echo "$as_me:__oline__: javac -version | sed -e 1q" >&AS_MESSAGE_LOG_FD
javac -version | sed -e 1q`
changequote(,)dnl
compiler_version=`echo "$compiler_version" | sed -e 's/^[^0-9]*\([0-9][0-9.]*\).*/\1/'`
changequote([,])dnl
case "$compiler_version" in
1.*) dnl Map 1.8.0_151 to 8.
compiler_version=`echo "$compiler_version" | sed -e 's/^1\.//' -e 's/\..*//'`
;;
*) dnl Map 9.0.4 to 9, 10.0.2 to 10, etc.
compiler_version=`echo "$compiler_version" | sed -e 's/\..*//'`
;;
esac
if expr $source_version '<=' "$compiler_version" >/dev/null \
&& expr $target_version '<=' "$compiler_version" >/dev/null; then
dnl Increase $source_version and $compiler_version until the
dnl compiler accepts these values. This is necessary to make
dnl e.g. $source_version = 6 work with Java 12 or newer, or
dnl $source_version = 7 work with Java 20 or newer.
try_source_version="$source_version"
try_target_version="$target_version"
while true; do
dnl Invariant: $try_source_version <= $try_target_version.
if expr $try_source_version = $try_target_version >/dev/null; then
try_target_version=`expr $try_target_version + 1`
fi
try_source_version=`expr $try_source_version + 1`
expr $try_source_version '<=' $compiler_version >/dev/null || break
source_option=' -source '`case "$try_source_version" in 8) echo 1. ;; esac`"$try_source_version"
if expr $try_target_version = $compiler_target_version >/dev/null; then
target_option=
else
target_option=' -target '`case "$try_target_version" in 8) echo 1. ;; esac`"$try_target_version"
fi
if { echo "$as_me:__oline__: javac$nowarn_option$source_option$target_option -d . conftest.java" >&AS_MESSAGE_LOG_FD
javac$nowarn_option$source_option$target_option -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
} \
&& test -f conftest.class; then
dnl The compiler supports the try_source_version and
dnl try_target_version. It's better than nothing.
CONF_JAVAC="javac$nowarn_option$source_option$target_option"
HAVE_JAVAC=1
HAVE_JAVACOMP=1
break
fi
done
fi
fi
fi
fi
fi
rm -f conftest*.java conftest*.class
fi
if test -n "$HAVE_JAVACOMP"; then
ac_result="$CONF_JAVAC"
else
ac_result="no"
fi
AC_MSG_RESULT([$ac_result])
AC_SUBST([CONF_JAVAC])
AC_SUBST([CLASSPATH])
AC_SUBST([CLASSPATH_SEPARATOR])
AC_SUBST([HAVE_JAVAC_ENVVAR])
AC_SUBST([HAVE_JAVAC])
])
# Simulates gt_JAVACOMP when no Java support is desired.
AC_DEFUN([gt_JAVACOMP_DISABLED],
[
CONF_JAVAC=
HAVE_JAVAC_ENVVAR=
HAVE_JAVAC=
AC_SUBST([CONF_JAVAC])
AC_SUBST([HAVE_JAVAC_ENVVAR])
AC_SUBST([HAVE_JAVAC])
])
@@ -0,0 +1,54 @@
#!/bin/sh
# Compile a Java program.
# Copyright (C) 2001-2026 Free Software Foundation, Inc.
# Written by Bruno Haible <haible@clisp.cons.org>, 2001.
#
# 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/>.
# This uses the same choices as javacomp.c, but instead of relying on the
# environment settings at run time, it uses the environment variables
# present at configuration time.
#
# This is a separate shell script, because it must be able to unset JAVA_HOME
# in some cases, which a simple shell command cannot do.
#
# The extra CLASSPATH must have been set prior to calling this script.
# Options that can be passed are -O, -g and "-d DIRECTORY".
CONF_JAVAC='@CONF_JAVAC@'
CONF_CLASSPATH='@CLASSPATH@'
if test -n "@HAVE_JAVAC_ENVVAR@"; then
# Combine given CLASSPATH and configured CLASSPATH.
if test -n "$CLASSPATH"; then
CLASSPATH="$CLASSPATH${CONF_CLASSPATH:+@CLASSPATH_SEPARATOR@$CONF_CLASSPATH}"
else
CLASSPATH="$CONF_CLASSPATH"
fi
export CLASSPATH
test -z "$JAVA_VERBOSE" || echo "$CONF_JAVAC $@" 1>&2
exec $CONF_JAVAC "$@"
else
unset JAVA_HOME
if test -n "@HAVE_JAVAC@"; then
# In this case, $CONF_JAVAC starts with "javac".
CLASSPATH="$CLASSPATH"
export CLASSPATH
test -z "$JAVA_VERBOSE" || echo "$CONF_JAVAC $@" 1>&2
exec $CONF_JAVAC "$@"
else
echo 'Java compiler not found, try setting $JAVAC, then reconfigure' 1>&2
exit 1
fi
fi
@@ -0,0 +1,93 @@
# javaexec.m4
# serial 11
dnl Copyright (C) 2001-2003, 2006, 2009-2026 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This file is offered as-is, without any warranty.
# Prerequisites of javaexec.sh.
# gt_JAVAEXEC or gt_JAVAEXEC(testclass, its-directory)
# Sets HAVE_JAVAEXEC to nonempty if javaexec.sh will work.
AC_DEFUN([gt_JAVAEXEC],
[
AC_MSG_CHECKING([for Java virtual machine])
AC_EGREP_CPP([yes], [
#if defined _WIN32 || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
yes
#endif
], CLASSPATH_SEPARATOR=';', CLASSPATH_SEPARATOR=':')
CONF_JAVA=
HAVE_JAVA_ENVVAR=
HAVE_JAVA=
HAVE_JRE=
HAVE_JAVAEXEC=1
if test -n "$JAVA"; then
HAVE_JAVA_ENVVAR=1
CONF_JAVA="$JAVA"
else
pushdef([AC_MSG_CHECKING],[:])dnl
pushdef([AC_CHECKING],[:])dnl
pushdef([AC_MSG_RESULT],[:])dnl
AC_CHECK_PROG([HAVE_JAVA_IN_PATH], [java], [yes])
AC_CHECK_PROG([HAVE_JRE_IN_PATH], [jre], [yes])
popdef([AC_MSG_RESULT])dnl
popdef([AC_CHECKING])dnl
popdef([AC_MSG_CHECKING])dnl
m4_if([$1], , , [
gt_saved_CLASSPATH="$CLASSPATH"
CLASSPATH="$2"${CLASSPATH+"$CLASSPATH_SEPARATOR$CLASSPATH"}
])
export CLASSPATH
if test -n "$HAVE_JAVA_IN_PATH" \
&& java -version >/dev/null 2>/dev/null \
m4_if([$1], , , [&& {
echo "$as_me:__oline__: java $1" >&AS_MESSAGE_LOG_FD
java $1 >&AS_MESSAGE_LOG_FD 2>&1
}]); then
HAVE_JAVA=1
CONF_JAVA="java"
else
if test -n "$HAVE_JRE_IN_PATH" \
&& (jre >/dev/null 2>/dev/null || test $? = 1) \
m4_if([$1], , , [&& {
echo "$as_me:__oline__: jre $1" >&AS_MESSAGE_LOG_FD
jre $1 >&AS_MESSAGE_LOG_FD 2>&1
}]); then
HAVE_JRE=1
CONF_JAVA="jre"
else
HAVE_JAVAEXEC=
fi
fi
m4_if([$1], , , [
CLASSPATH="$gt_saved_CLASSPATH"
])
fi
if test -n "$HAVE_JAVAEXEC"; then
ac_result="$CONF_JAVA"
else
ac_result="no"
fi
AC_MSG_RESULT([$ac_result])
AC_SUBST([CONF_JAVA])
AC_SUBST([CLASSPATH])
AC_SUBST([CLASSPATH_SEPARATOR])
AC_SUBST([HAVE_JAVA_ENVVAR])
AC_SUBST([HAVE_JAVA])
AC_SUBST([HAVE_JRE])
])
# Simulates gt_JAVAEXEC when no Java support is desired.
AC_DEFUN([gt_JAVAEXEC_DISABLED],
[
CONF_JAVA=
HAVE_JAVA_ENVVAR=
HAVE_JAVA=
HAVE_JRE=
AC_SUBST([CONF_JAVA])
AC_SUBST([HAVE_JAVA_ENVVAR])
AC_SUBST([HAVE_JAVA])
AC_SUBST([HAVE_JRE])
])
@@ -0,0 +1,58 @@
#!/bin/sh
# Execute a Java program.
# Copyright (C) 2001-2026 Free Software Foundation, Inc.
# Written by Bruno Haible <haible@clisp.cons.org>, 2001.
#
# 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/>.
# This uses the same choices as javaexec.c, but instead of relying on the
# environment settings at run time, it uses the environment variables
# present at configuration time.
#
# This is a separate shell script, because it must be able to unset JAVA_HOME
# in some cases, which a simple shell command cannot do.
#
# The extra CLASSPATH must have been set prior to calling this script.
CONF_JAVA='@CONF_JAVA@'
CONF_CLASSPATH='@CLASSPATH@'
if test -n "@HAVE_JAVA_ENVVAR@"; then
# Combine given CLASSPATH and configured CLASSPATH.
if test -n "$CLASSPATH"; then
CLASSPATH="$CLASSPATH${CONF_CLASSPATH:+@CLASSPATH_SEPARATOR@$CONF_CLASSPATH}"
else
CLASSPATH="$CONF_CLASSPATH"
fi
export CLASSPATH
test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@" 1>&2
exec $CONF_JAVA "$@"
else
unset JAVA_HOME
export CLASSPATH
if test -n "@HAVE_JAVA@"; then
# In this case, $CONF_JAVA is "java".
test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@" 1>&2
exec $CONF_JAVA "$@"
else
if test -n "@HAVE_JRE@"; then
# In this case, $CONF_JAVA is "jre".
test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@" 1>&2
exec $CONF_JAVA "$@"
else
echo 'Java virtual machine not found, try setting $JAVA, then reconfigure' 1>&2
exit 1
fi
fi
fi
@@ -0,0 +1,34 @@
# modula2comp.m4
# serial 1
dnl Copyright (C) 2025-2026 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This file is offered as-is, without any warranty.
# Checks for a Modula-2 implementation.
# Sets M2C and M2FLAGS (options that can be used with "$M2C").
AC_DEFUN([gt_MODULA2COMP],
[
AC_MSG_CHECKING([for GNU Modula-2 compiler])
pushdef([AC_MSG_CHECKING],[:])dnl
pushdef([AC_CHECKING],[:])dnl
pushdef([AC_MSG_RESULT],[:])dnl
AC_ARG_VAR([M2C], [Modula-2 compiler command])
AC_ARG_VAR([M2FLAGS], [Modula-2 compiler options])
AC_CHECK_TOOLS([M2C], [gm2])
popdef([AC_MSG_RESULT])dnl
popdef([AC_CHECKING])dnl
popdef([AC_MSG_CHECKING])dnl
if test -n "$M2C"; then
ac_result="$M2C"
else
ac_result="no"
fi
AC_MSG_RESULT([$ac_result])
AC_SUBST([M2C])
if test -z "$M2FLAGS" && test -n "$M2C"; then
M2FLAGS="-g -O2"
fi
AC_SUBST([M2FLAGS])
])
@@ -0,0 +1,19 @@
This example relies on:
- the GNOME libraries (libgnomeui, libgnome, libgnomesupport, libart_lgpl)
and their dependencies: imlib (libgdk_imlib), audiofile (libaudiofile),
esound (libesd), zlib (libz).
- the GTK libraries (libgtk, libgdk)
- the glib libraries (libglib, libgmodule)
- the X11 libraries
- the GTK / C++ bindings (libgtkmm, libgdkmm)
- the C++ signal/slot library (libsigc++)
- the C++ runtime libraries (libstdc++)
Installation:
./autogen.sh
./configure --prefix=/some/prefix
make
make install
Cleanup:
make distclean
./autoclean.sh
@@ -0,0 +1,29 @@
# Example for use of GNU gettext.
# This file is in the public domain.
#
# Makefile configuration - processed by automake.
# General automake options.
AUTOMAKE_OPTIONS = foreign no-dependencies
ACLOCAL_AMFLAGS = -I m4
# The list of subdirectories containing Makefiles.
SUBDIRS = m4 po
# The list of programs that are built.
bin_PROGRAMS = hello
# The source files of the 'hello' program.
hello_SOURCES = hello.cc
# Define a C macro LOCALEDIR indicating where catalogs will be installed.
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
# Make sure the gnome.h include file is found.
AM_CPPFLAGS = $(GTKMM_CFLAGS) $(GNOME_INCLUDEDIR)
# Link time dependencies.
LDADD = $(GTKMM_LIBS) $(GNOME_LIBDIR) $(GNOMEUI_LIBS) @LIBINTL@
# Additional files to be distributed.
EXTRA_DIST = autogen.sh autoclean.sh
@@ -0,0 +1,44 @@
#!/bin/sh
# Example for use of GNU gettext.
# This file is in the public domain.
#
# Script for cleaning all autogenerated files.
test ! -f Makefile || make distclean
rm -rf autom4te.cache
# Brought in by autopoint.
rm -f ABOUT-NLS
rm -f config.rpath
rm -f m4/gettext.m4
rm -f m4/build-to-host.m4
rm -f m4/host-cpu-c-abi.m4
rm -f m4/iconv.m4
rm -f m4/intlmacosx.m4
rm -f m4/lib-ld.m4
rm -f m4/lib-link.m4
rm -f m4/lib-prefix.m4
rm -f m4/nls.m4
rm -f m4/po.m4
rm -f m4/progtest.m4
rm -f po/Makefile.in.in
rm -f po/fetch-po
rm -f po/remove-potcdate.sed
# Generated by aclocal.
rm -f aclocal.m4
# Generated by autoconf.
rm -f configure
# Generated or brought in by automake.
rm -f Makefile.in
rm -f m4/Makefile.in
rm -f compile
rm -f install-sh
rm -f missing
rm -f config.guess
rm -f config.sub
rm -f po/*.pot
rm -f po/stamp-po
rm -f po/*.gmo
@@ -0,0 +1,29 @@
#!/bin/sh
# Example for use of GNU gettext.
# This file is in the public domain.
#
# Script for regenerating all autogenerated files.
autopoint -f # was: gettextize -f -c
rm po/Makevars.template
rm po/Rules-quot
rm po/boldquot.sed
rm po/en@boldquot.header
rm po/en@quot.header
rm po/insert-header.sed
rm po/quot.sed
aclocal -I m4
autoconf
automake -a -c
cd po
for f in *.po; do
if test -r "$f"; then
lang=`echo $f | sed -e 's,\.po$,,'`
msgfmt -c -o $lang.gmo $lang.po
fi
done
cd ..
@@ -0,0 +1,24 @@
dnl Example for use of GNU gettext.
dnl This file is in the public domain.
dnl
dnl Configuration file - processed by autoconf.
AC_INIT([hello-c++-gnome2], [0], , [hello-c++-gnome2])
AC_CONFIG_SRCDIR([hello.cc])
AM_INIT_AUTOMAKE([1.11])
AC_PROG_CXX
GNOME_INIT
GTKMM_CFLAGS=`gtkmm-config --cflags`
AC_SUBST([GTKMM_CFLAGS])
GTKMM_LIBS=`gtkmm-config --libs`
AC_SUBST([GTKMM_LIBS])
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([1.0])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([m4/Makefile])
AC_CONFIG_FILES([po/Makefile.in])
AC_OUTPUT
@@ -0,0 +1,92 @@
/* Example for use of GNU gettext.
This file is in the public domain.
Source code of the C++ program. */
/* Get GNOME declarations. */
#include <gnome.h>
#include <gtk--.h>
/* Get getpid() declaration. */
#if defined _WIN32 && !defined __CYGWIN__
/* native Windows API */
# include <process.h>
# define getpid _getpid
#else
/* POSIX API */
# include <unistd.h>
#endif
static Gtk::Main *application;
static gint
quit_callback (GdkEventAny*)
{
application->quit ();
}
int
main (int argc, char *argv[])
{
Gtk::Window *window;
Gtk::VBox *panel;
Gtk::Label *label1;
Gtk::Alignment *label1aligned;
Gtk::Label *label2;
Gtk::Alignment *label2aligned;
Gtk::Button *button;
Gtk::HButtonBox *buttonbar;
/* Initializations. */
setlocale (LC_ALL, "");
application = new Gtk::Main (argc, argv);
textdomain ("hello-c++-gnome2");
bindtextdomain ("hello-c++-gnome2", LOCALEDIR);
/* Create the GUI elements. */
window = new Gtk::Window (GTK_WINDOW_TOPLEVEL);
window->set_title ("Hello example");
window->realize ();
window->delete_event.connect (SigC::slot (quit_callback));
label1 = new Gtk::Label (_("Hello, world!"));
label1aligned = new Gtk::Alignment (0.0, 0.5, 0, 0);
label1aligned->add (*label1);
label2 = new Gtk::Label (g_strdup_printf (_("This program is running as process number %d."), getpid ()));
label2aligned = new Gtk::Alignment (0.0, 0.5, 0, 0);
label2aligned->add (*label2);
button = new Gtk::Button ("OK");
button->clicked.connect (Gtk::Main::quit.slot()); //slot (quit_callback));
buttonbar = new Gtk::HButtonBox (GTK_BUTTONBOX_END);
buttonbar->pack_start (*button);
panel = new Gtk::VBox (false, GNOME_PAD_SMALL);
panel->pack_start (*label1aligned);
panel->pack_start (*label2aligned);
panel->pack_start (*buttonbar);
window->add (*panel);
/* Make the GUI elements visible. */
label1->show ();
label1aligned->show ();
label2->show ();
label2aligned->show ();
button->show ();
buttonbar->show ();
panel->show ();
window->show ();
/* Start the event loop. */
application->run ();
}
@@ -0,0 +1,6 @@
EXTRA_DIST = \
gettext.m4 build-to-host.m4 host-cpu-c-abi.m4 \
iconv.m4 intlmacosx.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 \
nls.m4 po.m4 progtest.m4 \
gnome.m4 gnome-gnorba-check.m4 gnome-orbit-check.m4 \
gtk.m4 gtk--.m4
@@ -0,0 +1,35 @@
dnl
dnl GNOME_GNORBA_HOOK (script-if-gnorba-found, failflag)
dnl
dnl if failflag is "failure" it aborts if gnorba is not found.
dnl
AC_DEFUN([GNOME_GNORBA_HOOK],[
GNOME_ORBIT_HOOK([],$2)
AC_CACHE_CHECK([for gnorba libraries],gnome_cv_gnorba_found,[
gnome_cv_gnorba_found=no
if test x$gnome_cv_orbit_found = xyes; then
GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`"
GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`"
if test -n "$GNORBA_LIBS"; then
gnome_cv_gnorba_found=yes
fi
fi
])
AM_CONDITIONAL(HAVE_GNORBA, test x$gnome_cv_gnorba_found = xyes)
if test x$gnome_cv_orbit_found = xyes; then
$1
GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`"
GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`"
AC_SUBST(GNORBA_CFLAGS)
AC_SUBST(GNORBA_LIBS)
else
if test x$2 = xfailure; then
AC_MSG_ERROR(gnorba library not installed or installation problem)
fi
fi
])
AC_DEFUN([GNOME_GNORBA_CHECK], [
GNOME_GNORBA_HOOK([],failure)
])
@@ -0,0 +1,33 @@
dnl
dnl GNOME_ORBIT_HOOK (script-if-orbit-found, failflag)
dnl
dnl if failflag is "failure" it aborts if orbit is not found.
dnl
AC_DEFUN([GNOME_ORBIT_HOOK],[
AC_PATH_PROG(ORBIT_CONFIG,orbit-config,no)
AC_PATH_PROG(ORBIT_IDL,orbit-idl,no)
AC_CACHE_CHECK([for working ORBit environment],gnome_cv_orbit_found,[
if test x$ORBIT_CONFIG = xno -o x$ORBIT_IDL = xno; then
gnome_cv_orbit_found=no
else
gnome_cv_orbit_found=yes
fi
])
AM_CONDITIONAL(HAVE_ORBIT, test x$gnome_cv_orbit_found = xyes)
if test x$gnome_cv_orbit_found = xyes; then
$1
ORBIT_CFLAGS=`orbit-config --cflags client server`
ORBIT_LIBS=`orbit-config --use-service=name --libs client server`
AC_SUBST(ORBIT_CFLAGS)
AC_SUBST(ORBIT_LIBS)
else
if test x$2 = xfailure; then
AC_MSG_ERROR(ORBit not installed or installation problem)
fi
fi
])
AC_DEFUN([GNOME_ORBIT_CHECK], [
GNOME_ORBIT_HOOK([],failure)
])
@@ -0,0 +1,128 @@
dnl
dnl GNOME_INIT_HOOK (script-if-gnome-enabled, [failflag], [additional-inits])
dnl
dnl if failflag is "fail" then GNOME_INIT_HOOK will abort if gnomeConf.sh
dnl is not found.
dnl
AC_DEFUN([GNOME_INIT_HOOK],[
AC_SUBST(GNOME_LIBS)
AC_SUBST(GNOMEUI_LIBS)
AC_SUBST(GNOMEGNORBA_LIBS)
AC_SUBST(GTKXMHTML_LIBS)
AC_SUBST(ZVT_LIBS)
AC_SUBST(GNOME_LIBDIR)
AC_SUBST(GNOME_INCLUDEDIR)
AC_ARG_WITH(gnome-includes,
[ --with-gnome-includes Specify location of GNOME headers],[
CFLAGS="$CFLAGS -I$withval"
])
AC_ARG_WITH(gnome-libs,
[ --with-gnome-libs Specify location of GNOME libs],[
LDFLAGS="$LDFLAGS -L$withval"
gnome_prefix=$withval
])
AC_ARG_WITH(gnome,
[ --with-gnome Specify prefix for GNOME files],
if test x$withval = xyes; then
want_gnome=yes
dnl Note that an empty true branch is not
dnl valid sh syntax.
ifelse([$1], [], :, [$1])
else
if test "x$withval" = xno; then
want_gnome=no
else
want_gnome=yes
LDFLAGS="$LDFLAGS -L$withval/lib"
CFLAGS="$CFLAGS -I$withval/include"
gnome_prefix=$withval/lib
fi
fi,
want_gnome=yes)
if test "x$want_gnome" = xyes; then
AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
if test "$GNOME_CONFIG" = "no"; then
no_gnome_config="yes"
else
AC_MSG_CHECKING(if $GNOME_CONFIG works)
if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then
AC_MSG_RESULT(yes)
GNOME_GNORBA_HOOK([],$2)
GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`"
GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`"
GNOMEGNORBA_LIBS="`$GNOME_CONFIG --libs-only-l gnorba gnomeui`"
GTKXMHTML_LIBS="`$GNOME_CONFIG --libs-only-l gtkxmhtml`"
ZVT_LIBS="`$GNOME_CONFIG --libs-only-l zvt`"
GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`"
GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`"
$1
else
AC_MSG_RESULT(no)
no_gnome_config="yes"
fi
fi
if test x$exec_prefix = xNONE; then
if test x$prefix = xNONE; then
gnome_prefix=$ac_default_prefix/lib
else
gnome_prefix=$prefix/lib
fi
else
gnome_prefix=`eval echo \`echo $libdir\``
fi
if test "$no_gnome_config" = "yes"; then
AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix)
if test -f $gnome_prefix/gnomeConf.sh; then
AC_MSG_RESULT(found)
echo "loading gnome configuration from" \
"$gnome_prefix/gnomeConf.sh"
. $gnome_prefix/gnomeConf.sh
$1
else
AC_MSG_RESULT(not found)
if test x$2 = xfail; then
AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install)
fi
fi
fi
fi
if test -n "$3"; then
n="$3"
for i in $n; do
AC_MSG_CHECKING(extra library \"$i\")
case $i in
applets)
AC_SUBST(GNOME_APPLETS_LIBS)
GNOME_APPLETS_LIBS=`$GNOME_CONFIG --libs-only-l applets`
AC_MSG_RESULT($GNOME_APPLETS_LIBS);;
docklets)
AC_SUBST(GNOME_DOCKLETS_LIBS)
GNOME_DOCKLETS_LIBS=`$GNOME_CONFIG --libs-only-l docklets`
AC_MSG_RESULT($GNOME_DOCKLETS_LIBS);;
capplet)
AC_SUBST(GNOME_CAPPLET_LIBS)
GNOME_CAPPLET_LIBS=`$GNOME_CONFIG --libs-only-l capplet`
AC_MSG_RESULT($GNOME_CAPPLET_LIBS);;
*)
AC_MSG_RESULT(unknown library)
esac
done
fi
])
dnl
dnl GNOME_INIT ([additional-inits])
dnl
AC_DEFUN([GNOME_INIT],[
GNOME_INIT_HOOK([],fail,$1)
])
@@ -0,0 +1,195 @@
# Configure paths for GTK--
# Erik Andersen 30 May 1998
# Modified by Tero Pulkkinen (added the compiler checks... I hope they work..)
# Modified by Thomas Langen 16 Jan 2000 (corrected CXXFLAGS)
dnl Test for GTKMM, and define GTKMM_CFLAGS and GTKMM_LIBS
dnl to be used as follows:
dnl AM_PATH_GTKMM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl
AC_DEFUN([AM_PATH_GTKMM],
[dnl
dnl Get the cflags and libraries from the gtkmm-config script
dnl
AC_ARG_WITH(gtkmm-prefix,[ --with-gtkmm-prefix=PREFIX
Prefix where GTK-- is installed (optional)],
gtkmm_config_prefix="$withval", gtkmm_config_prefix="")
AC_ARG_WITH(gtkmm-exec-prefix,[ --with-gtkmm-exec-prefix=PREFIX
Exec prefix where GTK-- is installed (optional)],
gtkmm_config_exec_prefix="$withval", gtkmm_config_exec_prefix="")
AC_ARG_ENABLE(gtkmmtest, [ --disable-gtkmmtest Do not try to compile and run a test GTK-- program],
, enable_gtkmmtest=yes)
if test x$gtkmm_config_exec_prefix != x ; then
gtkmm_config_args="$gtkmm_config_args --exec-prefix=$gtkmm_config_exec_prefix"
if test x${GTKMM_CONFIG+set} != xset ; then
GTKMM_CONFIG=$gtkmm_config_exec_prefix/bin/gtkmm-config
fi
fi
if test x$gtkmm_config_prefix != x ; then
gtkmm_config_args="$gtkmm_config_args --prefix=$gtkmm_config_prefix"
if test x${GTKMM_CONFIG+set} != xset ; then
GTKMM_CONFIG=$gtkmm_config_prefix/bin/gtkmm-config
fi
fi
AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no)
min_gtkmm_version=ifelse([$1], ,0.10.0,$1)
AC_MSG_CHECKING(for GTK-- - version >= $min_gtkmm_version)
AC_LANG_SAVE
no_gtkmm=""
if test "$GTKMM_CONFIG" = "no" ; then
no_gtkmm=yes
else
AC_LANG_CPLUSPLUS
GTKMM_CFLAGS=`$GTKMM_CONFIG $gtkmm_config_args --cflags`
GTKMM_LIBS=`$GTKMM_CONFIG $gtkmm_config_args --libs`
gtkmm_config_major_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
gtkmm_config_minor_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
gtkmm_config_micro_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_gtkmmtest" = "xyes" ; then
ac_save_CXXFLAGS="$CXXFLAGS"
ac_save_LIBS="$LIBS"
CXXFLAGS="$CXXFLAGS $GTKMM_CFLAGS"
LIBS="$LIBS $GTKMM_LIBS"
dnl
dnl Now check if the installed GTK-- is sufficiently new. (Also sanity
dnl checks the results of gtkmm-config to some extent
dnl
rm -f conf.gtkmmtest
AC_TRY_RUN([
#include <gtk--.h>
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
int major, minor, micro;
char *tmp_version;
system ("touch conf.gtkmmtest");
/* HP/UX 0 (%@#!) writes to sscanf strings */
tmp_version = g_strdup("$min_gtkmm_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_gtkmm_version");
exit(1);
}
if ((gtkmm_major_version != $gtkmm_config_major_version) ||
(gtkmm_minor_version != $gtkmm_config_minor_version) ||
(gtkmm_micro_version != $gtkmm_config_micro_version))
{
printf("\n*** 'gtkmm-config --version' returned %d.%d.%d, but GTK-- (%d.%d.%d)\n",
$gtkmm_config_major_version, $gtkmm_config_minor_version, $gtkmm_config_micro_version,
gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
printf ("*** was found! If gtkmm-config was correct, then it is best\n");
printf ("*** to remove the old version of GTK--. You may also be able to fix the error\n");
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
printf("*** required on your system.\n");
printf("*** If gtkmm-config was wrong, set the environment variable GTKMM_CONFIG\n");
printf("*** to point to the correct copy of gtkmm-config, and remove the file config.cache\n");
printf("*** before re-running configure\n");
}
/* GTK-- does not have the GTKMM_*_VERSION constants */
/*
else if ((gtkmm_major_version != GTKMM_MAJOR_VERSION) ||
(gtkmm_minor_version != GTKMM_MINOR_VERSION) ||
(gtkmm_micro_version != GTKMM_MICRO_VERSION))
{
printf("*** GTK-- header files (version %d.%d.%d) do not match\n",
GTKMM_MAJOR_VERSION, GTKMM_MINOR_VERSION, GTKMM_MICRO_VERSION);
printf("*** library (version %d.%d.%d)\n",
gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
}
*/
else
{
if ((gtkmm_major_version > major) ||
((gtkmm_major_version == major) && (gtkmm_minor_version > minor)) ||
((gtkmm_major_version == major) && (gtkmm_minor_version == minor) && (gtkmm_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** An old version of GTK-- (%d.%d.%d) was found.\n",
gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
printf("*** You need a version of GTK-- newer than %d.%d.%d. The latest version of\n",
major, minor, micro);
printf("*** GTK-- is always available from ftp://ftp.gtk.org.\n");
printf("***\n");
printf("*** If you have already installed a sufficiently new version, this error\n");
printf("*** probably means that the wrong copy of the gtkmm-config shell script is\n");
printf("*** being found. The easiest way to fix this is to remove the old version\n");
printf("*** of GTK--, but you can also set the GTKMM_CONFIG environment to point to the\n");
printf("*** correct copy of gtkmm-config. (In this case, you will have to\n");
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
printf("*** so that the correct libraries are found at run-time))\n");
}
}
return 1;
}
],, no_gtkmm=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CXXFLAGS="$ac_save_CXXFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_gtkmm" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$GTKMM_CONFIG" = "no" ; then
echo "*** The gtkmm-config script installed by GTK-- could not be found"
echo "*** If GTK-- was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the GTKMM_CONFIG environment variable to the"
echo "*** full path to gtkmm-config."
echo "*** The gtkmm-config script was not available in GTK-- versions"
echo "*** prior to 0.9.12. Perhaps you need to update your installed"
echo "*** version to 0.9.12 or later"
else
if test -f conf.gtkmmtest ; then
:
else
echo "*** Could not run GTK-- test program, checking why..."
CXXFLAGS="$CXXFLAGS $GTKMM_CFLAGS"
LIBS="$LIBS $GTKMM_LIBS"
AC_TRY_LINK([
#include <gtk--.h>
#include <stdio.h>
], [ return ((gtkmm_major_version) || (gtkmm_minor_version) || (gtkmm_micro_version)); ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding GTK-- or finding the wrong"
echo "*** version of GTK--. If it is not finding GTK--, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means GTK-- was incorrectly installed"
echo "*** or that you have moved GTK-- since it was installed. In the latter case, you"
echo "*** may want to edit the gtkmm-config script: $GTKMM_CONFIG" ])
CXXFLAGS="$ac_save_CXXFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
GTKMM_CFLAGS=""
GTKMM_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_LANG_RESTORE
AC_SUBST(GTKMM_CFLAGS)
AC_SUBST(GTKMM_LIBS)
rm -f conf.gtkmmtest
])
@@ -0,0 +1,194 @@
# Configure paths for GTK+
# Owen Taylor 97-11-3
dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
dnl
AC_DEFUN([AM_PATH_GTK],
[dnl
dnl Get the cflags and libraries from the gtk-config script
dnl
AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
gtk_config_prefix="$withval", gtk_config_prefix="")
AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
, enable_gtktest=yes)
for module in . $4
do
case "$module" in
gthread)
gtk_config_args="$gtk_config_args gthread"
;;
esac
done
if test x$gtk_config_exec_prefix != x ; then
gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
if test x${GTK_CONFIG+set} != xset ; then
GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
fi
fi
if test x$gtk_config_prefix != x ; then
gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
if test x${GTK_CONFIG+set} != xset ; then
GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
fi
fi
AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
min_gtk_version=ifelse([$1], ,0.99.7,$1)
AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
no_gtk=""
if test "$GTK_CONFIG" = "no" ; then
no_gtk=yes
else
GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_gtktest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GTK_CFLAGS"
LIBS="$GTK_LIBS $LIBS"
dnl
dnl Now check if the installed GTK is sufficiently new. (Also sanity
dnl checks the results of gtk-config to some extent
dnl
rm -f conf.gtktest
AC_TRY_RUN([
#include <gtk/gtk.h>
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
int major, minor, micro;
char *tmp_version;
system ("touch conf.gtktest");
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = g_strdup("$min_gtk_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_gtk_version");
exit(1);
}
if ((gtk_major_version != $gtk_config_major_version) ||
(gtk_minor_version != $gtk_config_minor_version) ||
(gtk_micro_version != $gtk_config_micro_version))
{
printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
$gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
gtk_major_version, gtk_minor_version, gtk_micro_version);
printf ("*** was found! If gtk-config was correct, then it is best\n");
printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
printf("*** required on your system.\n");
printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
printf("*** before re-running configure\n");
}
#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
(gtk_minor_version != GTK_MINOR_VERSION) ||
(gtk_micro_version != GTK_MICRO_VERSION))
{
printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
printf("*** library (version %d.%d.%d)\n",
gtk_major_version, gtk_minor_version, gtk_micro_version);
}
#endif /* defined (GTK_MAJOR_VERSION) ... */
else
{
if ((gtk_major_version > major) ||
((gtk_major_version == major) && (gtk_minor_version > minor)) ||
((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
gtk_major_version, gtk_minor_version, gtk_micro_version);
printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
major, minor, micro);
printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
printf("***\n");
printf("*** If you have already installed a sufficiently new version, this error\n");
printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
printf("*** being found. The easiest way to fix this is to remove the old version\n");
printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
printf("*** correct copy of gtk-config. (In this case, you will have to\n");
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
printf("*** so that the correct libraries are found at run-time))\n");
}
}
return 1;
}
],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_gtk" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$GTK_CONFIG" = "no" ; then
echo "*** The gtk-config script installed by GTK could not be found"
echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the GTK_CONFIG environment variable to the"
echo "*** full path to gtk-config."
else
if test -f conf.gtktest ; then
:
else
echo "*** Could not run GTK test program, checking why..."
CFLAGS="$CFLAGS $GTK_CFLAGS"
LIBS="$LIBS $GTK_LIBS"
AC_TRY_LINK([
#include <gtk/gtk.h>
#include <stdio.h>
], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding GTK or finding the wrong"
echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
echo "***"
echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
echo "*** came with the system with the command"
echo "***"
echo "*** rpm --erase --nodeps gtk gtk-devel" ],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means GTK was incorrectly installed"
echo "*** or that you have moved GTK since it was installed. In the latter case, you"
echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
GTK_CFLAGS=""
GTK_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
rm -f conf.gtktest
])
@@ -0,0 +1,5 @@
# Example for use of GNU gettext.
# This file is in the public domain.
#
# Set of available languages.
af ast bg ca cs da de el eo es fi fr ga gl hr hu id it ja ka ky lv ms mt nb nl nn pl pt pt_BR ro ru sk sl sq sr sv ta tr uk vi zh_CN zh_HK zh_TW

Some files were not shown because too many files have changed in this diff Show More