功能: 服务端生成完整报告并保护单任务

- 使用 libxlsxwriter 常量内存导出 Excel\n- 增加全局任务占用提示与原始数据持久化\n- 保留运行时任务数据并更新接口文档
This commit is contained in:
cloud
2026-08-05 16:47:31 +08:00
parent 07274797af
commit 99ed321d24
2292 changed files with 134317 additions and 126 deletions
+1
View File
@@ -0,0 +1 @@
custom: ["paypal.me/xlsxwriter"]
@@ -0,0 +1,85 @@
# libxlsxwriter: Reporting Bugs
Here are some tips on reporting bugs in `libxlsxwriter`.
### Upgrade to the latest version of the library
Upgrade to the latest version of the library since the bug you are reporting
may already be fixed.
Check the [Changes][changes] section of the documentation to see what has
changed in the latest versions.
[changes]: http://libxlsxwriter.github.io/changes.html
You can check which version of `libxlsxwriter` that you are using by checking
the `xlsxwriter.h` header file or by adding the following to your program:
```C
#include <stdio.h>
#include "xlsxwriter.h"
int main() {
printf("Libxlsxwriter version = %s\n", lxw_version());
return 0;
}
```
### Read the documentation
Read or search the `libxlsxwriter` [documentation][docs] to see if the issue
you are encountering is already explained.
[docs]: http://libxlsxwriter.github.io/index.html
### Look at the example programs
There are many [examples programs][examples] in the distribution. Try to
identify an example program that corresponds to your query and adapt it to use
as a bug report.
[examples]: http://libxlsxwriter.github.io/examples.html
### Tips for submitting a bug report
1. Describe the problem as clearly and as concisely as possible.
2. Include a sample program. This is probably the most important step.
It is generally easier to describe a problem in code than in written
prose.
3. The sample program should be as small as possible to demonstrate the
problem. Don't copy and paste large non-relevant sections of your
program.
A sample bug report is shown below. This format helps analyze and respond to
the bug report more quickly.
> Subject: Issue with SOMETHING
>
> Greetings,
>
> I am using libxlsxwriter to do SOMETHING but it appears to do SOMETHING ELSE.
>
> I am using CC version X.Y.Z, OS = uname and libxlsxwriter x.y.z.
>
> Here is some code that demonstrates the problem:
>
>
>```C
>#include "xlsxwriter.h"
>
>int main() {
>
> lxw_workbook *workbook = workbook_new("bug_report.xlsx");
> lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
>
> worksheet_write_string(worksheet, 0, 0, "Hello", NULL);
> worksheet_write_number(worksheet, 1, 0, 123, NULL);
>
> return workbook_close(workbook);
>}
>```
>
@@ -0,0 +1,130 @@
# libxlsxwriter: Submitting Pull Requests
# Pull Requests and Contributing to Libxlsxwriter
All patches and pull requests are welcome but in general you should start with
an issue tracker to describe what you intend to do before you do it.
### Getting Started
1. Pull requests and new feature proposals must start with an [issue
tracker][issues]. This serves as the focal point for the design discussion.
2. Describe what you plan to do. If there are API changes add some code
example to demonstrate them.
3. Fork the repository.
4. Run all the tests to make sure the current code works on your system using
`make test`. See the [Running the Test Suite][tests] section of the docs
for instructions.
5. Create a feature branch for your new feature.
[tests]: http://libxlsxwriter.github.io/running_the_tests.html
### Code Style
The code style is mainly K&R style with 4 space indents.
The author uses GNU indent (`gindent`) 2.2.10 with the following options:
```
--braces-on-if-line
--braces-on-struct-decl-line
--case-indentation 4
--continue-at-parentheses
--declaration-comment-column 0
--format-first-column-comments
--honour-newlines
--ignore-profile
--indent-label 0
--indent-level 4
--no-space-after-function-call-names
--no-tabs
--swallow-optional-blank-lines
```
The [indent configuration file][indentpro] is available in the repo. The code
can be indented automatically if the same version of `gindent` is used with
the following make command:
```shell
make indent
```
Note, make sure you have backed up your files or added them to the index
before running this command.
In general follow the existing style in the code.
[indentpro]: https://github.com/jmcnamara/libxlsxwriter/blob/master/.indent.pro
### Writing and Running Tests
Any significant features should be accompanied by a test. See the `test`
directory and the [Running the Test Suite][tests] section of the docs for
details of the test setup.
The tests can be run as follows:
```shell
make test
```
Same as:
```shell
make test_unit
make test_functional
```
The functional tests require the Python module [pytest][pytest] as a test runner.
If you have `valgrind` installed you can use the test suite to check for memory leaks:
```shell
make test_valgrind
```
When you push your changes they will also be tested automatically using
[GitHub Actions][actions].
[actions]: https://github.com/jmcnamara/libxlsxwriter/actions
[pytest]: http://pytest.org/
### Documentation
The `libxlsxwriter` documentation is written in Doxygen format in the header
files and in additional `.dox` files in the `docs/src` directory of the
repo. The documentation can be built as follows:
```shell
make docs
open docs/html/index.html
```
### Example programs
If applicable add an example program to the `examples` directory. Example
files can be built using:
```shell
make docs
```
### Copyright and License
Copyright remains with the original author. Do not include additional
copyright claims or Licensing requirements. GitHub and the `git` repository
will record your contribution and it will be acknowledged it in the Changes
file.
### Submitting the Pull Request
If your change involves several incremental `git` commits then `rebase` or
`squash` them onto another branch so that the Pull Request is a single commit
or a small number of logical commits.
Push your changes to GitHub and submit the Pull Request with a hash link to
the to the Issue tracker that was opened above.
@@ -0,0 +1,46 @@
name: Build with CMake
on: [push, pull_request]
jobs:
build:
name:
Cmake
strategy:
matrix:
cc: [gcc, clang]
cmake_flags: ["",
"-DBUILD_EXAMPLES=ON -DBUILD_TESTS=ON",
"-DUSE_DTOA_LIBRARY=ON -DBUILD_TESTS=ON",
"-DUSE_MEM_FILE=ON -DBUILD_TESTS=ON",
"-DUSE_NO_MD5=ON -DBUILD_TESTS=ON",
"-DUSE_OPENSSL_MD5=ON -DBUILD_TESTS=ON",
"-DUSE_STANDARD_TMPFILE=ON -DBUILD_TESTS=ON",
"-DUSE_SYSTEM_MINIZIP=ON -DBUILD_TESTS=ON",
"-DUSE_SYSTEM_MINIZIP=ON -DUSE_OPENSSL_MD5=ON -DBUILD_TESTS=ON"]
runs-on: ubuntu-latest
env:
CC: ${{ matrix.cc }}
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
sudo apt-get -y install zlib1g-dev
sudo apt-get -y install libminizip-dev
sudo apt-get -y install libssl-dev
- name: Configure CMake
working-directory: ${{ github.workspace }}/cmake
run: cmake .. -DBUILD_TESTS=ON ${{ matrix.cmake_flags }} -DCMAKE_BUILD_TYPE=Release
- name: Build
working-directory: ${{ github.workspace }}/cmake
run: cmake --build . --config Release --parallel
- name: Test
working-directory: ${{ github.workspace }}/cmake
run: ctest -C Release -V
@@ -0,0 +1,23 @@
name: Check code style
on: [push, pull_request]
jobs:
build:
name:
Check code style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get -y install indent
sudo ln -s /usr/bin/indent /usr/bin/gindent
- name: Make indent
run: |
make indent
git status | grep 'nothing to commit'
@@ -0,0 +1,22 @@
name: Coverity Scan
on:
push:
branches: [coverity]
jobs:
coverity:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build third party libs to exclude them from scan
run: make third_party
- uses: vapier/coverity-scan-action@v1
with:
project: libxlsxwriter
email: ${{ secrets.COVERITY_SCAN_EMAIL }}
token: ${{ secrets.COVERITY_SCAN_TOKEN }}
command: make -C src libxlsxwriter.a
@@ -0,0 +1,50 @@
name: Build with Make
on: [push, pull_request]
jobs:
build:
name:
Make
strategy:
matrix:
cc: [gcc, clang]
make_flags: ["",
"USE_STANDARD_TMPFILE=1",
"USE_SYSTEM_MINIZIP=1",
"USE_DTOA_LIBRARY=1",
"USE_NO_MD5=1",
"USE_OPENSSL_MD5=1",
"USE_MEM_FILE=1"]
runs-on: ubuntu-latest
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cc }}
CFLAGS: '-Werror'
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
sudo apt-get -y install zlib1g-dev
sudo apt-get -y install libminizip-dev
sudo apt-get -y install libssl-dev
sudo apt-get -y install valgrind
- name: make
run: ${{ matrix.make_flags }} make V=1
- name: test unit
run: ${{ matrix.make_flags }} make test_unit V=1
- name: test functional
run: ${{ matrix.make_flags }} make test_functional V=1 -j
- name: test cpp
run: ${{ matrix.make_flags }} make test_cpp V=1
- name: test examples
run: ${{ matrix.make_flags }} make examples V=1
@@ -0,0 +1,22 @@
name: Test for memory leaks
on: [push, pull_request]
jobs:
build:
name:
Valgrind
runs-on: ubuntu-latest
env:
CC: gcc
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get -y install valgrind
sudo apt-get -y install zlib1g-dev
- name: test valgrind
run: make test_valgrind V=1 -j 2
@@ -0,0 +1,52 @@
name: Cmake on Windows
on: [push, pull_request]
jobs:
build:
name: CMake on Windows
strategy:
matrix:
cmake_flags: ["-DBUILD_EXAMPLES=ON -DBUILD_TESTS=ON",
"-DUSE_DTOA_LIBRARY=ON -DBUILD_TESTS=ON",
"-DUSE_OPENSSL_MD5=ON -DBUILD_TESTS=ON",
"-DUSE_SYSTEM_MINIZIP=ON -DBUILD_TESTS=ON",
"-DUSE_SYSTEM_MINIZIP=ON -DUSE_OPENSSL_MD5=ON -DBUILD_TESTS=ON"]
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
working-directory: ${{env.GITHUB_WORKSPACE}}
shell: cmd
run: |
vcpkg.exe install zlib:x64-windows minizip:x64-windows openssl:x64-windows
vcpkg.exe integrate install
pip install pytest
- name: Configure CMake
working-directory: ${{env.GITHUB_WORKSPACE}}
shell: cmd
run: |
cd cmake
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cmake .. -DCMAKE_BUILD_TYPE=Release ${{ matrix.cmake_flags }} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -A x64
- name: Build
working-directory: ${{env.GITHUB_WORKSPACE}}
shell: cmd
run: |
cd cmake
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cmake --build . --config Release
- name: Test
working-directory: ${{env.GITHUB_WORKSPACE}}
shell: cmd
run: |
cd cmake
copy test\functional\src\Release\*.exe test\functional\src
pytest -v test/functional
+62
View File
@@ -0,0 +1,62 @@
*.a
*.o
*.so
*.so.*
*.to
*.lo
*.la
*.dylib
*.dll
*.gcno
*.gcda
test_*
!test_*.c
!test_*.cpp
!test_*.py
*.tar.gz
*~
TAGS
.#*
*#
~*xlsx
*.xlsx
*.bak
!test/functional/xlsx_files/*.xlsx
*.pyc
.pytest_cache/
.cproject
.project
.pydevproject
.settings/
.DS_Store
__pycache__
.cache
docs/html
docs/latex
.deps
.dirstamp
_temp.c
examples/*
!examples/*.c
!examples/*.png
!examples/Makefile
!examples/vbaProject.bin
cov-int
libxlsxwriter-coverity.tgz
build
third_party/zlib-1.2.8/configure.log
third_party/zlib-1.2.8/contrib/minizip/miniunz
third_party/zlib-1.2.8/contrib/minizip/minizip
third_party/zlib-1.2.8/example
third_party/zlib-1.2.8/examplesh
third_party/zlib-1.2.8/minigzip
third_party/zlib-1.2.8/minigzipsh
third_party/zlib-1.2.8/zlib.pc
cmake
!cmake/FindMINIZIP.cmake
!cmake/FindPackage.cmake
!cmake/i686-toolchain.cmake
.vscode
+157
View File
@@ -0,0 +1,157 @@
/*
* Indent rules for libxlsxwriter.
*
* The rules for user defined typedefs can be update as follows:
*
perl -i -pe 'print and last if /[l]ibxlsxwriter typedefs/' .indent.pro
ack -h typedef include/xlsxwriter/*.h src/*.c | perl -lne 'print "-T $1" if /\w+\s+\w+\s+(\w+)/' | sort >> .indent.pro
*
*/
/* Command line options used with GNU indent 2.2.10 */
--braces-on-if-line
--braces-on-struct-decl-line
--case-indentation 4
--continue-at-parentheses
--declaration-comment-column 0
--format-first-column-comments
--honour-newlines
--ignore-profile
--indent-label 0
--indent-level 4
--no-space-after-function-call-names
--no-tabs
--swallow-optional-blank-lines
/* Typedefs used in the code. */
-T int8_t
-T int16_t
-T int32_t
-T int64_t
-T uint8_t
-T uint16_t
-T uint32_t
-T uint64_t
-T ssize_t
-T size_t
-T time_t
-T LIST_ENTRY
-T RB_ENTRY
-T SLIST_ENTRY
-T STAILQ_ENTRY
-T TAILQ_ENTRY
/* libxlsxwriter typedefs. */
-T lxw_app
-T lxw_author_id
-T lxw_autofilter
-T lxw_border
-T lxw_button_options
-T lxw_cell
-T lxw_chart
-T lxw_chart_axis
-T lxw_chart_axis_display_unit
-T lxw_chart_axis_label_alignment
-T lxw_chart_axis_label_position
-T lxw_chart_axis_tick_mark
-T lxw_chart_axis_tick_position
-T lxw_chart_axis_type
-T lxw_chart_blank
-T lxw_chart_custom_label
-T lxw_chart_data_label
-T lxw_chart_error_bar_axis
-T lxw_chart_error_bar_cap
-T lxw_chart_error_bar_direction
-T lxw_chart_error_bar_type
-T lxw_chart_fill
-T lxw_chart_font
-T lxw_chart_gridline
-T lxw_chart_label_position
-T lxw_chart_label_separator
-T lxw_chart_legend
-T lxw_chart_legend_position
-T lxw_chart_line
-T lxw_chart_line_dash_type
-T lxw_chart_marker
-T lxw_chart_marker_type
-T lxw_chart_options
-T lxw_chart_pattern
-T lxw_chart_pattern_type
-T lxw_chart_point
-T lxw_chart_series
-T lxw_chart_title
-T lxw_chart_trendline_type
-T lxw_chart_type
-T lxw_chartsheet
-T lxw_chartsheet_name
-T lxw_col_options
-T lxw_col_t
-T lxw_color_t
-T lxw_comment
-T lxw_comment_options
-T lxw_cond_format_hash_element
-T lxw_cond_format_obj
-T lxw_conditional_format
-T lxw_content_types
-T lxw_core
-T lxw_custom
-T lxw_custom_property
-T lxw_data_val_obj
-T lxw_data_validation
-T lxw_datetime
-T lxw_defined_name
-T lxw_doc_properties
-T lxw_drawing
-T lxw_drawing_coords
-T lxw_drawing_object
-T lxw_drawing_rel_id
-T lxw_error
-T lxw_fill
-T lxw_filter_rule
-T lxw_filter_rule_obj
-T lxw_font
-T lxw_format
-T lxw_hash_element
-T lxw_hash_table
-T lxw_header_footer_options
-T lxw_heading_pair
-T lxw_image_md5
-T lxw_image_options
-T lxw_merged_range
-T lxw_metadata
-T lxw_object_properties
-T lxw_packager
-T lxw_panes
-T lxw_part_name
-T lxw_print_area
-T lxw_protection
-T lxw_protection_obj
-T lxw_rel_tuple
-T lxw_relationships
-T lxw_repeat_cols
-T lxw_repeat_rows
-T lxw_rich_string_tuple
-T lxw_row
-T lxw_row_col_options
-T lxw_row_t
-T lxw_selection
-T lxw_series_data_point
-T lxw_series_error_bars
-T lxw_series_range
-T lxw_sheet
-T lxw_sst
-T lxw_styles
-T lxw_table
-T lxw_table_column
-T lxw_table_obj
-T lxw_table_options
-T lxw_theme
-T lxw_tuple
-T lxw_vml
-T lxw_vml_obj
-T lxw_workbook
-T lxw_workbook_options
-T lxw_worksheet
-T lxw_worksheet_init_data
-T lxw_worksheet_name
+424
View File
@@ -0,0 +1,424 @@
# :copyright: (c) 2017 Alex Huszagh.
# :license: FreeBSD, see LICENSE.txt for more details.
# Description
# ===========
#
# Use:
# Move to a custom directory, ideally out of source, and
# type `cmake $LXW_SOURCE $FLAGS`, where `LXW_SOURCE` is the
# path to the libxlsxwriter project, and `FLAGS` are custom
# flags to pass to the compiler.
#
# Example:
# For example, in the project directory, to build libxlsxwriter
# and the unittests in release mode, type:
# mkdir build && cd build
# cmake .. -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release
# cmake --build . --config Release
# ctest -C Release -V
# cmake --build . --config Release --target install
#
# If using a Makefile generator, you may use the simpler
# mkdir build && cd build
# cmake .. -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release
# make
# make test
# make install
#
# Flags:
# ZLIB_ROOT
# The ZLIB root directory can be specified either through
# an environment variable (`export ZLIB_ROOT=/usr/include`)
# or using a flag with CMake (`-DZLIB_ROOT:STRING=/usr/include`).
# This sets the preferred search path for the ZLIB installation.
#
# BUILD_TESTS
# Build unittests (default off). To build the unittests,
# pass `-DBUILD_TESTS=ON` during configuration.
#
# BUILD_EXAMPLES
# Build example files (default off). To build the examples,
# pass `-DBUILD_EXAMPLES=ON` during configuration.
#
# USE_STANDARD_TMPFILE
# Use the standard tmpfile() function (default off). To enable
# the standard tmpfile, pass `-DUSE_STANDARD_TMPFILE=ON`
# during configuration. This may produce bugs while cross-
# compiling or using MinGW/MSYS.
#
# USE_DTOA_LIBRARY
# Use the third party emyg_dtoa() library (default off). The
# emyg_dtoa() library is used to avoid sprintf double issues with
# different locale settings. To enable this library, pass
# `-DUSE_DTOA_LIBRARY=ON` during configuration.
#
# USE_NO_MD5
# Compile without third party MD5 support. This will turn off the
# functionality of avoiding duplicate image files in the output xlsx
# file. To enable this option pass `-DUSE_NO_MD5=ON` during
# configuration.
#
# USE_OPENSSL_MD5 Compile with OpenSSL MD5 support. This will link
# against libcrypto for MD5 support rather than using the local MD5
# support. MD5 support is required to avoid duplicate image files in
# the output xlsx file. To enable this option pass
# `-DUSE_OPENSSL_MD5=ON` during configuration.
#
# USE_STATIC_MSVC_RUNTIME
# Use the static msvc runtime library when compiling with msvc (default off)
# To enable, pass `-DUSE_STATIC_MSVC_RUNTIME` during configuration.
#
# Toolchains:
# On multiarch Linux systems, which can build and run multiple
# binary targets on the same system, we include an `i686-toolchain`
# file to enable building i686 (x86 32-bit) targets on x86_64 systems.
# To use the i686 toolchain, pass the `-DCMAKE_TOOLCHAIN_FILE` option
# during CMake configuration. For example, from the build directory,
# you would use:
# cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/i686-toolchain.cmake
#
# CMake Options:
# CMake sets debug and release builds with the `CMAKE_BUILD_TYPE`
# option, which can be set as a flag during configuration.
# To build in release mode, pass `-DCMAKE_BUILD_TYPE=Release`
# during configuration.
#
# CMake sets the creation of static and shared libraries with the
# `BUILD_SHARED_LIBS` option, which can be set as a flag during
# configuration. To build a static library, pass
# `-DBUILD_SHARED_LIBS=OFF` during configuration.
#
# Generators:
# CMake also supports custom build generators, such as MakeFiles,
# Ninja, Visual Studio, and XCode. For example, to generate
# a Visual Studio solution, configure with:
# cmake .. -G "Visual Studio 14 2015 Win64"
#
# For more information on using generators, see:
# https://cmake.org/cmake/help/v3.0/manual/cmake-generators.7.html
#
set(CMAKE_LEGACY_CYGWIN_WIN32 1)
if(MSVC)
cmake_minimum_required(VERSION 3.4)
else()
cmake_minimum_required(VERSION 3.1)
endif()
SET(XLSX_PROJECT_NAME "xlsxwriter" CACHE STRING "Optional project and binary name")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
project(${XLSX_PROJECT_NAME} C)
enable_testing()
# POLICY
# ------
# The use of the word ZLIB_ROOT should still work prior to "3.12.0",
# just it's been generalized for all packages now. Just set the policy
# to new, so we use it, and it will be used prior to 3.12 anyway.
if(${CMAKE_VERSION} VERSION_GREATER "3.12" OR ${CMAKE_VERSION} VERSION_EQUAL "3.12")
cmake_policy(SET CMP0074 NEW)
endif()
# OPTIONS
# -------
SET(ZLIB_ROOT "" CACHE STRING "Optional root for the ZLIB installation")
option(BUILD_TESTS "Build libxlsxwriter tests" OFF)
option(BUILD_EXAMPLES "Build libxlsxwriter examples" OFF)
option(USE_SYSTEM_MINIZIP "Use system minizip installation" OFF)
option(USE_STANDARD_TMPFILE "Use the C standard library's tmpfile()" OFF)
option(USE_NO_MD5 "Build libxlsxwriter without third party MD5 lib" OFF)
option(USE_OPENSSL_MD5 "Build libxlsxwriter with the OpenSSL MD5 lib" OFF)
option(USE_MEM_FILE "Use fmemopen()/open_memstream() in place of temporary files" OFF)
option(IOAPI_NO_64 "Disable 64-bit filesystem support" OFF)
option(USE_DTOA_LIBRARY "Use the locale independent third party Milo Yip DTOA library" OFF)
if(MSVC)
option(USE_STATIC_MSVC_RUNTIME "Use the static runtime library" OFF)
endif()
if(DEFINED ENV{${ZLIB_ROOT}})
set(ZLIB_ROOT $ENV{ZLIB_ROOT})
endif()
if(IOAPI_NO_64)
list(APPEND LXW_PRIVATE_COMPILE_DEFINITIONS IOAPI_NO_64=1)
endif()
# CONFIGURATIONS
# --------------
if(USE_SYSTEM_MINIZIP)
list(APPEND LXW_PRIVATE_COMPILE_DEFINITIONS USE_SYSTEM_MINIZIP)
endif()
if(USE_STANDARD_TMPFILE)
list(APPEND LXW_PRIVATE_COMPILE_DEFINITIONS USE_STANDARD_TMPFILE)
endif()
if(NOT USE_OPENSSL_MD5 AND USE_NO_MD5)
list(APPEND LXW_PRIVATE_COMPILE_DEFINITIONS USE_NO_MD5)
endif()
if(USE_OPENSSL_MD5)
list(APPEND LXW_PRIVATE_COMPILE_DEFINITIONS USE_OPENSSL_MD5)
if(NOT MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations")
endif()
endif()
if(USE_MEM_FILE OR USE_FMEMOPEN)
list(APPEND LXW_PRIVATE_COMPILE_DEFINITIONS USE_FMEMOPEN)
endif()
if(USE_DTOA_LIBRARY)
list(APPEND LXW_PRIVATE_COMPILE_DEFINITIONS USE_DTOA_LIBRARY)
endif()
if(NOT BUILD_SHARED_LIBS)
if(UNIX)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
elseif(MINGW OR MSYS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static -static-libgcc -Wno-char-subscripts -Wno-long-long")
list(APPEND LXW_PRIVATE_COMPILE_DEFINITIONS USE_FILE32API)
elseif(MSVC)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Fd\"${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pdb\"")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Ox /Zi /Fd\"${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pdb\"")
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /Zi /Fd\"${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pdb\"")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /Fd\"${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pdb\"")
endif()
endif()
if(MSVC AND USE_STATIC_MSVC_RUNTIME)
foreach(flag_var CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif()
endforeach()
endif()
# Configure pkg-config
file(READ "include/xlsxwriter.h" ver)
string(REGEX MATCH "LXW_VERSION \"([^\"]+)\"" _ ${ver})
set(VERSION ${CMAKE_MATCH_1})
string(REGEX MATCH "LXW_SOVERSION \"([^\"]+)\"" _ ${ver})
set(SOVERSION ${CMAKE_MATCH_1})
set(PREFIX ${CMAKE_INSTALL_PREFIX})
configure_file(dev/release/pkg-config.txt xlsxwriter.pc @ONLY)
# INCLUDES
# --------
enable_language(CXX)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# ZLIB
find_package(ZLIB REQUIRED "1.0")
list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS})
message("zlib version: " ${ZLIB_VERSION})
# MINIZIP
if (USE_SYSTEM_MINIZIP)
find_package(MINIZIP REQUIRED "1.0")
list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS})
endif()
# LIBRARY
# -------
list(APPEND LXW_PRIVATE_COMPILE_DEFINITIONS NOCRYPT NOUNCRYPT)
# Ensure CRT Secure warnings are disabled
if(MSVC)
list(APPEND LXW_PRIVATE_COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS)
endif()
# Ensure "TESTING" macro is defined if building tests
if(BUILD_TESTS)
list(APPEND LXW_PRIVATE_COMPILE_DEFINITIONS TESTING)
endif()
file(GLOB LXW_SOURCES src/*.c)
file(GLOB_RECURSE LXW_HEADERS RELATIVE include *.h)
if(NOT USE_SYSTEM_MINIZIP)
list(APPEND LXW_SOURCES third_party/minizip/ioapi.c third_party/minizip/zip.c)
if(MSVC)
list(APPEND LXW_SOURCES third_party/minizip/iowin32.c)
endif()
endif()
if (NOT USE_STANDARD_TMPFILE)
list(APPEND LXW_SOURCES third_party/tmpfileplus/tmpfileplus.c)
endif()
if(NOT USE_OPENSSL_MD5 AND NOT USE_NO_MD5)
list(APPEND LXW_SOURCES third_party/md5/md5.c)
endif()
if(USE_OPENSSL_MD5)
find_package(OpenSSL REQUIRED)
if(OpenSSL_FOUND)
include_directories(${OPENSSL_INCLUDE_DIR})
message(STATUS "OpenSSL version: ${OPENSSL_VERSION}")
endif()
endif()
if (USE_DTOA_LIBRARY)
list(APPEND LXW_SOURCES third_party/dtoa/emyg_dtoa.c)
endif()
set(LXW_PROJECT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(LXW_LIB_DIR "${LXW_PROJECT_DIR}/lib")
add_library(${PROJECT_NAME} "")
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${SOVERSION})
target_sources(${PROJECT_NAME}
PRIVATE ${LXW_SOURCES}
PUBLIC ${LXW_HEADERS}
)
target_link_libraries(${PROJECT_NAME} LINK_PUBLIC ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${LIB_CRYPTO} ${OPENSSL_CRYPTO_LIBRARY})
target_compile_definitions(${PROJECT_NAME} PRIVATE ${LXW_PRIVATE_COMPILE_DEFINITIONS})
# /utf-8 needs VS2015 Update 2 or above.
# In CMake 3.7 and above, we can use (MSVC_VERSION GREATER_EQUAL 1900) here.
if(MSVC AND NOT (MSVC_VERSION LESS 1900))
target_compile_options(${PROJECT_NAME} PRIVATE /utf-8)
endif()
if (WINDOWSSTORE)
target_compile_definitions(${PROJECT_NAME} PRIVATE -DIOWIN32_USING_WINRT_API)
endif()
target_include_directories(${PROJECT_NAME}
PRIVATE ${LXW_PRIVATE_INCLUDE_DIRS}
PUBLIC include include/xlsxwriter
)
# TESTS
# -----
# Create test and runner.
#
# Args:
# sources Name of variable holding source files
# target Test name
#
macro(CreateTest sources target)
set(output_name xlsxwriter_${target})
set(dependencies ${output_name})
add_executable(${output_name} ${${sources}})
target_link_libraries(${output_name} ${PROJECT_NAME})
target_compile_definitions(${output_name} PRIVATE TESTING COLOR_OK)
add_test(NAME ${output_name}
COMMAND ${output_name}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
endmacro(CreateTest)
file(GLOB LXW_UTILITY_SOURCES test/unit/utility/test*.c)
file(GLOB LXW_XMLWRITER_SOURCES test/unit/xmlwriter/test*.c)
file(GLOB LXW_WORKSHEET_SOURCES test/unit/worksheet/test*.c)
file(GLOB LXW_SST_SOURCES test/unit/sst/test*.c)
file(GLOB LXW_WORKBOOK_SOURCES test/unit/workbook/test*.c)
file(GLOB LXW_APP_SOURCES test/unit/app/test*.c)
file(GLOB LXW_CONTENTTYPES_SOURCES test/unit/content_types/test*.c)
file(GLOB LXW_CORE_SOURCES test/unit/core/test*.c)
file(GLOB LXW_RELATIONSHIPS_SOURCES test/unit/relationships/test*.c)
file(GLOB LXW_FORMAT_SOURCES test/unit/format/test*.c)
file(GLOB LXW_STYLES_SOURCES test/unit/styles/test*.c)
file(GLOB LXW_DRAWING_SOURCES test/unit/drawing/test*.c)
file(GLOB LXW_CHART_SOURCES test/unit/chart/test*.c)
file(GLOB LXW_CUSTOM_SOURCES test/unit/custom/test*.c)
file(GLOB LXW_FUNCTIONAL_SOURCES test/functional/src/*.c)
set(LXW_UNIT_SOURCES
test/unit/test_all.c
${LXW_UTILITY_SOURCES}
${LXW_XMLWRITER_SOURCES}
${LXW_WORKSHEET_SOURCES}
${LXW_SST_SOURCES}
${LXW_WORKBOOK_SOURCES}
${LXW_APP_SOURCES}
${LXW_CONTENTTYPES_SOURCES}
${LXW_CORE_SOURCES}
${LXW_RELATIONSHIPS_SOURCES}
${LXW_FORMAT_SOURCES}
${LXW_STYLES_SOURCES}
${LXW_DRAWING_SOURCES}
${LXW_CHART_SOURCES}
${LXW_CUSTOM_SOURCES}
)
if(BUILD_TESTS)
# unit tests
CreateTest(LXW_UNIT_SOURCES unit)
# functional tests
find_package(Python COMPONENTS Interpreter REQUIRED)
find_program(Pytest_EXECUTABLE NAMES pytest)
if (NOT Pytest_EXECUTABLE)
message("Please install the Python pytest library to run functional tests:")
message(" pip install pytest\n")
endif()
foreach(source ${LXW_FUNCTIONAL_SOURCES})
get_filename_component(basename ${source} NAME_WE)
add_executable(${basename} ${source})
target_link_libraries(${basename} xlsxwriter)
set_target_properties(${basename} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "test/functional/src")
endforeach(source)
add_custom_command(TARGET xlsxwriter_unit POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/test/functional test/functional
)
if(USE_NO_MD5)
add_test(NAME functional
COMMAND pytest -v test/functional -m "not skipif"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
else()
add_test(NAME functional
COMMAND pytest -v test/functional
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
endif()
endif()
# EXAMPLES
# --------
file(GLOB LXW_EXAMPLE_SOURCES examples/*.c)
if(BUILD_EXAMPLES)
foreach(source ${LXW_EXAMPLE_SOURCES})
get_filename_component(basename ${source} NAME_WE)
add_executable(${basename} ${source})
target_link_libraries(${basename} ${PROJECT_NAME})
set_target_properties(${basename} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "examples")
endforeach(source)
endif()
# INSTALL
# -------
include(GNUInstallDirs)
install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(FILES include/xlsxwriter.h DESTINATION include)
install(DIRECTORY include/xlsxwriter
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h"
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/xlsxwriter.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+226
View File
@@ -0,0 +1,226 @@
# libxlsxwriter: Reporting Bugs and submitting Pull Requests
## Reporting Bugs
Here are some tips on reporting bugs in `libxlsxwriter`.
### Upgrade to the latest version of the library
Upgrade to the latest version of the library since the bug you are reporting
may already be fixed.
Check the [Changes][changes] section of the documentation to see what has
changed in the latest versions.
[changes]: http://libxlsxwriter.github.io/changes.html
You can check which version of `libxlsxwriter` that you are using by checking
the `xlsxwriter.h` header file or by adding the following to your program:
```C
#include <stdio.h>
#include "xlsxwriter.h"
int main() {
printf("Libxlsxwriter version = %s\n", lxw_version());
return 0;
}
```
### Read the documentation
Read or search the `libxlsxwriter` [documentation][docs] to see if the issue
you are encountering is already explained.
[docs]: http://libxlsxwriter.github.io/index.html
### Look at the example programs
There are many [examples programs][examples] in the distribution. Try to
identify an example program that corresponds to your query and adapt it to use
as a bug report.
[examples]: http://libxlsxwriter.github.io/examples.html
### Use the xlsxwriter Issue Tracker
The [libxlsxwriter issue tracker][issues] is on GitHub.
[issues]: https://github.com/jmcnamara/libxlsxwriter/issues
### Tips for submitting a bug report
1. Describe the problem as clearly and as concisely as possible.
2. Include a sample program. This is probably the most important step.
It is generally easier to describe a problem in code than in written
prose.
3. The sample program should be as small as possible to demonstrate the
problem. Don't copy and paste large non-relevant sections of your
program.
A sample bug report is shown below. This format helps analyze and respond to
the bug report more quickly.
> Subject: Issue with SOMETHING
>
> Greetings,
>
> I am using libxlsxwriter to do SOMETHING but it appears to do SOMETHING ELSE.
>
> I am using CC version X.Y.Z, OS = uname and libxlsxwriter x.y.z.
>
> Here is some code that demonstrates the problem:
>
>
>```C
>#include "xlsxwriter.h"
>
>int main() {
>
> lxw_workbook *workbook = workbook_new("bug_report.xlsx");
> lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
>
> worksheet_write_string(worksheet, 0, 0, "Hello", NULL);
> worksheet_write_number(worksheet, 1, 0, 123, NULL);
>
> return workbook_close(workbook);
>}
>```
>
# Pull Requests and Contributing to Libxlsxwriter
All patches and pull requests are welcome but in general you should start with
an issue tracker to describe what you intend to do before you do it.
### Getting Started
1. Pull requests and new feature proposals must start with an [issue
tracker][issues]. This serves as the focal point for the design discussion.
2. Describe what you plan to do. If there are API changes add some code
example to demonstrate them.
3. Fork the repository.
4. Run all the tests to make sure the current code works on your system using
`make test`. See the [Running the Test Suite][tests] section of the docs
for instructions.
5. Create a feature branch for your new feature.
[tests]: http://libxlsxwriter.github.io/running_the_tests.html
### Code Style
The code style is mainly K&R style with 4 space indents.
The author uses GNU indent (`gindent`) 2.2.10 with the following options:
```
--braces-on-if-line
--braces-on-struct-decl-line
--case-indentation 4
--continue-at-parentheses
--declaration-comment-column 0
--format-first-column-comments
--honour-newlines
--ignore-profile
--indent-label 0
--indent-level 4
--no-space-after-function-call-names
--no-tabs
--swallow-optional-blank-lines
```
The [indent configuration file][indentpro] is available in the repo. The code
can be indented automatically if the same version of `gindent` is used with
the following make command:
```shell
make indent
```
Note, make sure you have backed up your files or added them to the index
before running this command.
In general follow the existing style in the code.
[indentpro]: https://github.com/jmcnamara/libxlsxwriter/blob/master/.indent.pro
### Writing and Running Tests
Any significant features should be accompanied by a test. See the `test`
directory and the [Running the Test Suite][tests] section of the docs for
details of the test setup.
The tests can be run as follows:
```shell
make test
```
Same as:
```shell
make test_unit
make test_functional
```
The functional tests require the Python module [pytest][pytest] as a test runner.
If you have `valgrind` installed you can use the test suite to check for memory leaks:
```shell
make test_valgrind
```
When you push your changes they will also be tested automatically using
[GitHub Actions][actions].
[actions]: https://github.com/jmcnamara/libxlsxwriter/actions
[pytest]: http://pytest.org/
### Documentation
The `libxlsxwriter` documentation is written in Doxygen format in the header
files and in additional `.dox` files in the `docs/src` directory of the
repo. The documentation can be built as follows:
```shell
make docs
open docs/html/index.html
```
### Example programs
If applicable add an example program to the `examples` directory. Example
files can be built using:
```shell
make docs
```
### Copyright and License
Copyright remains with the original author. Do not include additional
copyright claims or Licensing requirements. GitHub and the `git` repository
will record your contribution and it will be acknowledged it in the Changes
file.
### Submitting the Pull Request
If your change involves several incremental `git` commits then `rebase` or
`squash` them onto another branch so that the Pull Request is a single commit
or a small number of logical commits.
Push your changes to GitHub and submit the Pull Request with a hash link to
the to the Issue tracker that was opened above.
File diff suppressed because it is too large Load Diff
+208
View File
@@ -0,0 +1,208 @@
/**
@page license License
Libxlsxwriter is released under a FreeBSD license:
Copyright 2014-2022, John McNamara <jmcnamara@cpan.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are
those of the authors and should not be interpreted as representing
official policies, either expressed or implied, of the FreeBSD Project.
Libxlsxwriter includes the `queue.h` and `tree.h` macros from FreeBSD. It also
includes and, unless overridden, uses the optional libraries `minizip`,
`tmpfileplus` and `md5`. It also includes the `emyg_dtoa` library but doesn't
use it by default. These components have the following licenses:
Queue.h from FreeBSD:
Copyright (c) 1991, 1993
The Regents of the University of California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
4. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Tree.h from FreeBSD:
Copyright 2002 Niels Provos <provos@citi.umich.edu>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The `minizip` files used in the libxlsxwriter source tree are taken from the
`zlib` ` contrib/minizip` directory. [Zlib](http://www.zlib.net) has the
following License/Copyright:
(C) 1995-2013 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu
The `minizip` files have the following additional copyright declarations:
Copyright (C) 1998-2010 Gilles Vollant
(minizip) ( http://www.winimage.com/zLibDll/minizip.html )
Modifications for Zip64 support
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
Note, it is possible to compile libxlsxwriter without statically linking the
`minizip` files and instead dynamically linking to `lminizip`, see
@ref gsg_minizip.
[Tmpfileplus](http://www.di-mgt.com.au/c_function_to_create_temp_file.html)
has the following license:
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (c) 2012-16 David Ireland, DI Management Services Pty Ltd
<http://www.di-mgt.com.au/contact/>.
See the [Mozilla Public License, v. 2.0](http://mozilla.org/MPL/2.0/).
Note, it is possible to compile libxlsxwriter using the standard library
`tmpfile()` function instead of `tmpfileplus`, see @ref gsg_tmpdir.
The [Milo Yip DTOA library](https://github.com/miloyip/dtoa-benchmark) for
converting doubles to strings. It has the following license:
Copyright (C) 2015 Doug Currie
based on dtoa_milo.h
Copyright (C) 2014 Milo Yip
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 Milo Yip DTOA library (emyg_dtoa) is used to avoid issues where the
standard sprintf() dtoa function changes output based on locale settings. It
is also 40-50% faster than the standard dtoa for raw numeric data. The use of
this library is optional. If you wish to use it you can pass
`USE_DTOA_LIBRARY=1` to make when compiling.
[Openwall MD5](https://openwall.info/wiki/people/solar/software/public-domain-source-code/md5)
has the following licence:
This software was written by Alexander Peslyak in 2001. No copyright is
claimed, and the software is hereby placed in the public domain.
In case this attempt to disclaim copyright and place the software in the
public domain is deemed null and void, then the software is
Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
general public under the following terms:
Redistribution and use in source and binary forms, with or without
modification, are permitted.
There's ABSOLUTELY NO WARRANTY, express or implied.
(This is a heavily cut-down "BSD license".)
Note, the MD5 library is used to avoid including duplicate image files in the
xlsx file. If you don't want to use this code, and the additional licence, you
can use OpenSSL's MD5 functions instead by passing `USE_OPENSSL_MD5=1` to
make. If this functionality isn't required it is possible to compile
libxlsxwriter without image deduplication by passing `USE_NO_MD5=1` to make.
See also @ref gsg_md5.
Next: @ref changes
*/
+275
View File
@@ -0,0 +1,275 @@
###############################################################################
#
# Makefile for libxlsxwriter library.
#
# Copyright 2014-2022, John McNamara, jmcnamara@cpan.org
#
# Keep the output quiet by default.
Q=@
ifdef V
Q=
endif
DESTDIR ?=
PREFIX ?= /usr/local
PYTEST ?= py.test
PYTESTFILES ?= test
VERSION = $(shell sed -n -e 's/.*LXW_VERSION \"\(.*\)\"/\1/p' include/xlsxwriter.h)
SOVERSION = $(shell sed -n -e 's/.*LXW_SOVERSION \"\(.*\)\"/\1/p' include/xlsxwriter.h)
.PHONY: docs tags examples third_party
# Build libxlsxwriter.
all : third_party
$(Q)$(MAKE) -C src
# Build the third party libs.
third_party :
ifndef USE_SYSTEM_MINIZIP
$(Q)$(MAKE) -C third_party/minizip
endif
ifndef USE_STANDARD_TMPFILE
$(Q)$(MAKE) -C third_party/tmpfileplus
endif
ifndef USE_NO_MD5
ifndef USE_OPENSSL_MD5
$(Q)$(MAKE) -C third_party/md5
endif
endif
ifdef USE_DTOA_LIBRARY
$(Q)$(MAKE) -C third_party/dtoa
endif
# Build a macOS universal binary.
universal_binary :
$(Q)$(MAKE) clean
$(Q)TARGET_ARCH="-target x86_64-apple-macos10.12" $(MAKE) all
$(Q)mv lib/libxlsxwriter.a libxlsxwriter_x86_64.a
$(Q)mv lib/libxlsxwriter.$(SOVERSION).dylib libxlsxwriter_x86_64.dylib
$(Q)$(MAKE) clean
$(Q)TARGET_ARCH="-target arm64-apple-macos11" $(MAKE) all
$(Q)mv lib/libxlsxwriter.a lib/libxlsxwriter_arm64.a
$(Q)mv lib/libxlsxwriter.$(SOVERSION).dylib lib/libxlsxwriter_arm64.dylib
$(Q)mv libxlsxwriter_x86_64.a libxlsxwriter_x86_64.dylib lib
$(Q)lipo -create -output lib/libxlsxwriter.a lib/libxlsxwriter_x86_64.a lib/libxlsxwriter_arm64.a
$(Q)lipo -create -output lib/libxlsxwriter.$(SOVERSION).dylib lib/libxlsxwriter_x86_64.dylib lib/libxlsxwriter_arm64.dylib
$(Q)rm -f lib/libxlsxwriter_x86_64.* lib/libxlsxwriter_arm64.*
# Build the example programs.
examples : all
$(Q)$(MAKE) -C examples
# Clean src and test directories.
clean :
$(Q)$(MAKE) clean -C src
$(Q)$(MAKE) clean -C test/unit
$(Q)$(MAKE) clean -C test/functional/src
$(Q)$(MAKE) clean -C test/cpp
$(Q)$(MAKE) clean -C examples
$(Q)rm -rf docs/html
$(Q)rm -rf test/functional/__pycache__
$(Q)rm -f test/functional/*.pyc
$(Q)rm -f lib/*
$(Q)$(MAKE) clean -C third_party/minizip
$(Q)$(MAKE) clean -C third_party/tmpfileplus
$(Q)$(MAKE) clean -C third_party/md5
$(Q)$(MAKE) clean -C third_party/dtoa
# Clean src and lib dir only, as a precursor for static analysis.
clean_src :
$(Q)$(MAKE) clean -C src
$(Q)rm -f lib/*
# Run the unit tests.
test : all test_cpp test_unit test_functional
# Test for C++ const correctness on APIs.
test_const : all
$(Q)$(MAKE) clean -C test/functional/src
$(Q)! $(MAKE) -C test/functional/src CFLAGS=-Wwrite-strings 2>&1 | grep -A 1 "note:"
# Run the functional tests.
test_functional : all
$(Q)$(MAKE) -C test/functional/src
$(Q)$(PYTEST) test/functional -v -k $(PYTESTFILES)
# Run all tests.
test_unit : all
$(Q)$(MAKE) -C src test_lib
$(Q)$(MAKE) -C test/unit test
# Test C++ compilation.
test_cpp : all
$(Q)$(MAKE) -C test/cpp
# Test Cmake. This test should really be done with Cmake in the cmake dir but
# this is a workaround for now.
test_cmake :
ifneq ($(findstring m32,$(CFLAGS)),m32)
$(Q)$(MAKE) -C src clean
$(Q)cd cmake; cmake .. -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON; make clean; make; cp libxlsxwriter.a ../src/
$(Q)cmake/xlsxwriter_unit
$(Q)$(MAKE) -C test/functional/src
$(Q)$(PYTEST) test/functional -v -k $(PYTESTFILES)
else
@echo "Skipping Cmake tests on 32 bit target."
endif
# Test the functional test exes with valgrind (in 64bit mode only).
test_valgrind : all
ifndef NO_VALGRIND
$(Q)$(MAKE) -C test/functional/src test_valgrind
$(Q)$(MAKE) -C examples test_valgrind
endif
# Minimal target for quick compile without creating the libs.
test_compile :
$(Q)$(MAKE) -C src test_compile
# Indent the source files with the .indent.pro settings.
indent:
$(Q)gindent src/*.c include/*.h include/xlsxwriter/*.h
tags:
$(Q)rm -f TAGS
$(Q)etags src/*.c include/*.h include/xlsxwriter/*.h
# Build the doxygen docs.
doc: docs
docs:
$(Q)$(MAKE) -C docs
@echo "Docs built."
docs_doxygen_only:
$(Q)$(MAKE) -C docs docs_doxygen_only
docs_external:
$(Q)make -C ../libxlsxwriter.github.io release
# Simple install.
install: all
$(Q)mkdir -p $(DESTDIR)$(PREFIX)/include
$(Q)cp -R include/* $(DESTDIR)$(PREFIX)/include
$(Q)mkdir -p $(DESTDIR)$(PREFIX)/lib
$(Q)cp -R lib/* $(DESTDIR)$(PREFIX)/lib
$(Q)mkdir -p $(DESTDIR)$(PREFIX)/lib/pkgconfig
$(Q)sed -e 's|@PREFIX@|$(PREFIX)|g' -e 's|@VERSION@|$(VERSION)|g' dev/release/pkg-config.txt > $(DESTDIR)$(PREFIX)/lib/pkgconfig/xlsxwriter.pc
# Simpler uninstall.
uninstall:
$(Q)rm -rf $(DESTDIR)$(PREFIX)/include/xlsxwriter*
$(Q)rm $(DESTDIR)$(PREFIX)/lib/libxlsxwriter.*
$(Q)rm $(DESTDIR)$(PREFIX)/lib/pkgconfig/xlsxwriter.pc
# Strip the lib files.
strip:
$(Q)strip lib/*
# Run a coverity static analysis.
coverity: clean_src third_party
$(Q)rm -rf cov-int
$(Q)rm -f libxlsxwriter-coverity.tgz
$(Q)../../cov-analysis-linux64-2019.03/bin/cov-build --dir cov-int make -C src libxlsxwriter.a
$(Q)tar -czf libxlsxwriter-coverity.tgz cov-int
$(Q)$(MAKE) -C src clean
$(Q)rm -f lib/*
# Run gcov coverage analysis.
gcov: third_party
$(Q)$(MAKE) -C src clean
$(Q)$(MAKE) -C src GCOV="--coverage" OPT_LEVEL="-O0"
$(Q)$(MAKE) -C src test_lib GCOV="--coverage"
$(Q)$(MAKE) -C test/unit test GCOV="--coverage"
$(Q)$(MAKE) -C test/functional/src GCOV="--coverage"
$(Q)$(PYTEST) test/functional -v -k $(PYTESTFILES)
$(Q)mkdir -p build
$(Q)gcovr -r src --html-details -o build/libxlsxwriter_gcov.html
$(Q)gcovr -r . -f src --sonarqube build/coverage.xml
# Run sonarcloud analysis.
sonarcloud: gcov
ifndef SONAR_TOKEN
@echo "Please define SONAR_TOKEN to run this analysis."
@exit 1
endif
$(Q)$(MAKE) clean
$(Q)../sonar-scanner-4.6.1.2450-macosx/bin/build-wrapper-macosx-x86 --out-dir build make all
$(Q)../sonar-scanner-4.6.1.2450-macosx/bin/sonar-scanner \
-Dsonar.organization=jmcnamara-github \
-Dsonar.projectKey=jmcnamara_libxlsxwriter \
-Dsonar.projectName=libxlsxwriter \
-Dsonar.projectVersion=$(VERSION) \
-Dsonar.sources=src \
-Dsonar.sourceEncoding=UTF-8 \
-Dsonar.cfamily.build-wrapper-output=build \
-Dsonar.working.directory=build/scannerwork \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.cfamily.threads=4 \
-Dsonar.coverageReportPaths=build/coverage.xml \
-Dsonar.cfamily.cache.enabled=false
sonarcloud_no_gcov:
ifndef SONAR_TOKEN
@echo "Please define SONAR_TOKEN to run this analysis."
@exit 1
endif
$(Q)$(MAKE) clean
$(Q)../sonar-scanner-4.6.1.2450-macosx/bin/build-wrapper-macosx-x86 --out-dir build make all
$(Q)../sonar-scanner-4.6.1.2450-macosx/bin/sonar-scanner \
-Dsonar.organization=jmcnamara-github \
-Dsonar.projectKey=jmcnamara_libxlsxwriter \
-Dsonar.projectName=libxlsxwriter \
-Dsonar.projectVersion=$(VERSION) \
-Dsonar.sources=src \
-Dsonar.sourceEncoding=UTF-8 \
-Dsonar.cfamily.build-wrapper-output=build \
-Dsonar.working.directory=build/scannerwork \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.cfamily.threads=4 \
-Dsonar.cfamily.cache.enabled=false
# Run a scan-build static analysis.
scan_build: clean_src third_party
$(Q)scan-build make -C src libxlsxwriter.a
$(Q)$(MAKE) -C src clean
$(Q)rm -f lib/*
spellcheck:
$(Q)for f in docs/src/*.dox; do aspell --lang=en_US --check $$f; done
$(Q)for f in include/xlsxwriter/*.h; do aspell --lang=en_US --check $$f; done
$(Q)for f in src/*.c; do aspell --lang=en_US --check $$f; done
$(Q)for f in examples/*.c; do aspell --lang=en_US --check $$f; done
$(Q)aspell --lang=en_US --check Changes.txt
$(Q)aspell --lang=en_US --check Readme.md
$(Q)aspell --lang=en_US --check docs/src/examples.txt
releasecheck:
$(Q)dev/release/release_check.sh
release: releasecheck
@echo
@echo "Pushing to git main ..."
$(Q)git push origin main
$(Q)git push --tags
@echo
@echo "Pushing updated docs ..."
$(Q)make -C ../libxlsxwriter.github.io release
@echo
@echo "Pushing the cocoapod ..."
$(Q)pod trunk push libxlsxwriter.podspec --use-libraries
@echo
@echo "Finished. Opening files."
$(Q)open https://libxlsxwriter.github.io/changes.html
$(Q)open https://cocoadocs.org/docsets/libxlsxwriter
$(Q)open https://github.com/jmcnamara/libxlsxwriter
$(Q)open https://github.com/jmcnamara/libxlsxwriter/releases
+82
View File
@@ -0,0 +1,82 @@
# libxlsxwriter
Libxlsxwriter: A C library for creating Excel XLSX files.
![demo image](http://libxlsxwriter.github.io/demo.png)
## The libxlsxwriter library
Libxlsxwriter is a C library that can be used to write text, numbers, formulas
and hyperlinks to multiple worksheets in an Excel 2007+ XLSX file.
It supports features such as:
- 100% compatible Excel XLSX files.
- Full Excel formatting.
- Merged cells.
- Defined names.
- Autofilters.
- Charts.
- Data validation and drop down lists.
- Conditional formatting.
- Worksheet PNG/JPEG/GIF images.
- Cell comments.
- Support for adding Macros.
- Memory optimization mode for writing large files.
- Source code available on [GitHub](https://github.com/jmcnamara/libxlsxwriter).
- FreeBSD license.
- ANSI C.
- Works with GCC, Clang, Xcode, MSVC 2015, ICC, TCC, MinGW, MingGW-w64/32.
- Works on Linux, FreeBSD, OpenBSD, OS X, iOS and Windows. Also works on MSYS/MSYS2 and Cygwin.
- Compiles for 32 and 64 bit.
- Compiles and works on big and little endian systems.
- The only dependency is on `zlib`.
Here is an example that was used to create the spreadsheet shown above:
```C
#include "xlsxwriter.h"
int main() {
/* Create a new workbook and add a worksheet. */
lxw_workbook *workbook = workbook_new("demo.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
/* Add a format. */
lxw_format *format = workbook_add_format(workbook);
/* Set the bold property for the format */
format_set_bold(format);
/* Change the column width for clarity. */
worksheet_set_column(worksheet, 0, 0, 20, NULL);
/* Write some simple text. */
worksheet_write_string(worksheet, 0, 0, "Hello", NULL);
/* Text with formatting. */
worksheet_write_string(worksheet, 1, 0, "World", format);
/* Write some numbers. */
worksheet_write_number(worksheet, 2, 0, 123, NULL);
worksheet_write_number(worksheet, 3, 0, 123.456, NULL);
/* Insert an image. */
worksheet_insert_image(worksheet, 1, 2, "logo.png");
workbook_close(workbook);
return 0;
}
```
See the [full documentation](http://libxlsxwriter.github.io) for the getting
started guide, a tutorial, the main API documentation and examples.
@@ -0,0 +1,37 @@
#import <Foundation/Foundation.h>
#import "../xlsxwriter.h"
#import "app.h"
#import "chart.h"
#import "chartsheet.h"
#import "comment.h"
#import "common.h"
#import "content_types.h"
#import "core.h"
#import "custom.h"
#import "drawing.h"
#import "format.h"
#import "hash_table.h"
#import "metadata.h"
#import "packager.h"
#import "relationships.h"
#import "shared_strings.h"
#import "styles.h"
#import "table.h"
#import "theme.h"
#import "third_party/emyg_dtoa.h"
#import "third_party/ioapi.h"
#import "third_party/md5.h"
#import "third_party/queue.h"
#import "third_party/tmpfileplus.h"
#import "third_party/tree.h"
#import "third_party/zip.h"
#import "utility.h"
#import "vml.h"
#import "workbook.h"
#import "worksheet.h"
#import "xmlwriter.h"
FOUNDATION_EXPORT double xlsxwriterVersionNumber;
FOUNDATION_EXPORT const unsigned char xlsxwriterVersionString[];
@@ -0,0 +1,7 @@
framework module xlsxwriter {
umbrella header "xlsxwriter/libxlsxwriter-umbrella.h"
header "xlsxwriter.h"
export *
module * { export * }
}
+4
View File
@@ -0,0 +1,4 @@
This directory contains some release utilities that are mainly useful
to the library developer.
+7
View File
@@ -0,0 +1,7 @@
#/bin/bash
# Perform some minor clean-ups/fixes to the docs.
perl -i -pe "s/_page/_8h/" html/pages.html
perl -i ../dev/release/fix_example_docs.pl html/examples.html
cp menudata.js html
@@ -0,0 +1,127 @@
#!/usr/bin/perl
#
# Simple program to arrange the example programs in a user defined order
# instead of a sorted order. Also add a caption.
#
# Copyright 2014-2022, John McNamara, jmcnamara@cpan.org
#
use warnings;
use strict;
# The required example order and descriptions.
my @examples = (
[ 'hello.c', 'A simple hello world example' ],
[ 'anatomy.c', 'The anatomy of a libxlsxwriter program' ],
[ 'demo.c', 'Demo of some of the libxlsxwriter features' ],
[ 'tutorial1.c', 'Tutorial 1 from the documentation' ],
[ 'tutorial2.c', 'Tutorial 2 from the documentation' ],
[ 'tutorial3.c', 'Tutorial 3 from the documentation' ],
[ 'format_font.c', 'Example of writing data with font formatting' ],
[ 'format_num_format.c', 'Example of writing data with number formatting' ],
[ 'dates_and_times01.c', 'Writing dates and times with numbers' ],
[ 'dates_and_times02.c', 'Writing dates and times with datetime' ],
[ 'dates_and_times03.c', 'Writing dates and times with Unix datetimes' ],
[ 'dates_and_times04.c', 'Dates and times with different formats' ],
[ 'hyperlinks.c', 'A example of writing urls/hyperlinks' ],
[ 'rich_strings.c', 'A example of writing "rich" multi-format strings' ],
[ 'array_formula.c', 'A example of using array formulas' ],
[ 'dynamic_arrays.c', 'A example of using Excel 365 dynamic array formulas' ],
[ 'utf8.c', 'A example of some UTF-8 text' ],
[ 'constant_memory.c', 'Write a large file with constant memory usage' ],
[ 'output_buffer.c', 'Write a file to a memory buffer' ],
[ 'image_buffer.c', 'Example of adding an image from a memory buffer.' ],
[ 'merge_range.c', 'Create a merged range of cells' ],
[ 'merge_rich_string.c', 'Create a merged range with a rich string' ],
[ 'autofilter.c', 'An example of a worksheet autofilter' ],
[ 'data_validate.c', 'Examples of worksheet data validation and drop down lists' ],
[ 'conditional_format1.c', 'A simple conditional formatting example' ],
[ 'conditional_format2.c', 'An advanced conditional formatting example' ],
[ 'tables.c', 'Example of table to a worksheet.' ],
[ 'images.c', 'Example of adding images to a worksheet.' ],
[ 'headers_footers.c', 'Example of adding worksheet headers/footers' ],
[ 'defined_name.c', 'Example of how to create defined names' ],
[ 'outline.c', 'Example of grouping and outlines' ],
[ 'outline_collapsed.c', 'Example of grouping and collapsed outlines' ],
[ 'watermark.c', 'Example of how to set a watermark image for a worksheet' ],
[ 'background.c', 'Example of how to set the background image for a worksheet' ],
[ 'tab_colors.c', 'Example of how to set worksheet tab colors' ],
[ 'diagonal_border.c', 'Example of how to set a worksheet cell diagonal border.' ],
[ 'hide_sheet.c', 'Example of hiding a worksheet' ],
[ 'doc_properties.c', 'Example of setting workbook doc properties' ],
[ 'doc_custom_properties.c','Example of setting custom doc properties' ],
[ 'worksheet_protection.c', 'Example of enabling worksheet protection' ],
[ 'hide_row_col.c', 'Example of hiding worksheet rows and columns' ],
[ 'comments1.c', 'Example of adding cell comments to a worksheet' ],
[ 'comments2.c', 'Example of adding cell comments with options' ],
[ 'macro.c', 'Example of adding a VBA macro to a workbook' ],
[ 'panes.c', 'Example of how to create worksheet panes' ],
[ 'ignore_errors.c', 'Example of ignoring worksheet errors/warnings' ],
[ 'lambda.c', 'Example of using the EXCEL 365+ LAMBDA() function' ],
[ 'chart.c', 'Example of a simple column chart' ],
[ 'chart_area.c', 'Examples of area charts' ],
[ 'chart_bar.c', 'Examples of bar charts' ],
[ 'chart_column.c', 'Examples of column charts' ],
[ 'chart_line.c', 'Example of a line chart' ],
[ 'chart_scatter.c', 'Examples of scatter charts' ],
[ 'chart_radar.c', 'Examples of radar charts' ],
[ 'chart_pie.c', 'Examples of pie charts' ],
[ 'chart_doughnut.c', 'Examples of doughnut charts' ],
[ 'chart_clustered.c', 'Examples of clustered category chart' ],
[ 'chart_data_table.c', 'Examples of charts with data tables' ],
[ 'chart_data_tools.c', 'Examples of charts data tools' ],
[ 'chart_data_labels.c', 'Examples of charts data labels' ],
[ 'chart_fonts.c', 'Examples of using charts fonts' ],
[ 'chart_pattern.c', 'Examples of using charts patterns' ],
[ 'chart_styles.c', 'Examples of built-in charts styles' ],
[ 'chartsheet.c', 'Example of a chartsheet chart' ],
);
# Convert the array refs to a hash for lookups.
my %examples;
for my $example (@examples) {
$examples{$example->[0]} = 1;
}
my $in_list = 0;
while ( my $line = <> ) {
# Print all lines not in the <ul> list.
print $line if !$in_list;
# Check for <ul> list.
if ( $line =~ /<div class="textblock">/ ) {
$in_list = 1;
}
# Capture the <li> items of the list.
if ( $line =~ /<li><a class="el" href="[^"]+">([^<]+)/ ) {
my $example = $1;
# Warn if there are any new/unkown items.
if ( !exists $examples{$example} ) {
warn "$0 Unknown example: $example\n";
}
next;
}
# At the end of the <ul> list print out the <li> items in user defined order.
if ( $line =~ m{^</ul>} ) {
$in_list = 0;
for my $aref ( @examples ) {
my $example = $aref->[0];
my $filename = $aref->[0];
my $desc = $aref->[1];
$example =~ s/\.c/_8c-example.html/;
printf qq(<li><a class="el" href="%s">%s</a> %s</li>\n\n),
$example, $filename, $desc;
}
print $line;
}
}
__END__
@@ -0,0 +1,78 @@
#!/usr/bin/perl
#
# Simple program to generate the examples.dox file from a simple text file,
# with links to the next/previous examples.
#
# Copyright 2014-2022, John McNamara, jmcnamara@cpan.org
#
use strict;
use warnings;
my @examples;
my @sections;
my @links;
my $buffer = '';
# Sample through the example sections and break the text into blocks.
while ( my $line = <> ) {
# Ignore comments in the input file.
next if $line =~ /^#/;
# Match the start of an example block.
if ( $line =~ /^\@example/ ) {
chomp $buffer;
# Store the example name and the section body.
push @examples, $line;
push @sections, $buffer;
$buffer = '';
next;
}
$buffer .= $line;
}
# Store the last example section and omit the first blank element.
push @sections, $buffer;
shift @sections;
# Generate a set of @ref links targets from the example program names.
for ( @examples ) {
my $link = $_;
chomp $link;
$link =~ s/\@example //;
push @links, [ $link, $link ];
}
# Add the first and last links back to the examples.
unshift @links, [ "examples", "Examples page" ];
push @links, [ "examples", "Examples page" ];
# Add the start of the Doxygen header.
print "/**\n";
print "\@page examples Example Programs\n\n";
# Print out each section.
for my $i ( 0 .. @examples - 1 ) {
print $examples[$i];
# Add a simple header table with next/previous links.
printf qq{\n<table width="600">\n};
printf qq{<tr>\n};
printf qq{ <td>\@ref %s "&lt;&lt; %s"</td>\n},
$links[$i]->[0], $links[$i]->[1];
printf qq{ <td align="right">\@ref %s "%s &gt;&gt;"</td>\n},
$links[ $i + 2 ]->[0], $links[ $i + 2 ]->[1];
printf qq{</tr>\n};
printf qq{</table>\n};
print $sections[$i], "\n\n\n\n";
}
# Print the end of the doxygen comment.
print "*/\n";
@@ -0,0 +1,49 @@
#!/usr/bin/perl
#
# Simple program to generate the string array for the lxw_strerror() function
# from the Doxygen comments in the lxw_error enum:
#
# perl dev/release/gen_error_strings.pl include/xlsxwriter/common.h
#
# Copyright 2014-2022, John McNamara, jmcnamara@cpan.org
#
use warnings;
use strict;
my $in_enum = 0;
my @strings;
my $filename = shift || 'include/xlsxwriter/common.h';
open my $fh, '<', $filename or die "Couldn't open $filename: $!\n";
while (<$fh>) {
$in_enum = 1 if /typedef enum lxw_error/;
$in_enum = 0 if /} lxw_error;/;
# Match doxygen strings in the enum.
if ($in_enum && m{/\*\*}) {
# Strip the comment parts.
s{/\*\*}{};
s{\*/}{};
s{^\s+}{};
s{\s+$}{};
push @strings, $_;
}
}
# Print out an array of strings based on the doxygen comments.
print "\n";
print "// Copy to src/utility.c\n\n";
print "char *error_strings[LXW_MAX_ERRNO + 1] = {\n";
for my $string (@strings) {
print qq{ "$string",\n};
}
print qq{ "Unknown error number."\n};
print "};\n\n";
@@ -0,0 +1,36 @@
#!/usr/bin/perl
#
# Simple program to generate the coccoapods unbrella file.
# Run from the libxlsxwriter root dir.
#
# Copyright 2014-2022, John McNamara, jmcnamara@cpan.org
#
use warnings;
use strict;
use File::Find;
my @includes;
# Callback to match header files.
sub match_include {
push @includes, $File::Find::name if /^.*\.h\z/s;
}
# Use File::Find to find header files.
find({wanted => \&match_include}, 'include/xlsxwriter');
# Sort and remove leading dirs from the include files.
@includes = sort @includes;
s{^include/xlsxwriter/}{} for @includes;
# Generate the unbrella file.
print qq{#import <Foundation/Foundation.h>\n\n};
print qq{#import "../xlsxwriter.h"\n};
print qq{#import "$_"\n} for @includes;
print qq{\n};
print qq{FOUNDATION_EXPORT double xlsxwriterVersionNumber;\n};
print qq{FOUNDATION_EXPORT const unsigned char xlsxwriterVersionString[];\n\n};
@@ -0,0 +1,50 @@
#!/usr/bin/perl
#
# Simple program to generate a Windows .def file from the exported symbols in
# libxlsxwriter.a.
#
# perl dev/release/gen_windows_def_file.pl lib/libxlsxwriter.a
#
# Copyright 2014-2022, John McNamara, jmcnamara@cpan.org
#
use warnings;
use strict;
my $lib_file = shift;
die "$0: Path to .a lib file required.\n" if !$lib_file;
die "$0: File '$lib_file' not found\n" if !-e $lib_file;
# Get the symbols from the libxlsxwriter.a file.
my @symbols = `nm $lib_file`;
my %unique;
for my $symbol ( @symbols ) {
chomp $symbol;
# Get the last field in the row.
my @fields = split " ", $symbol;
$symbol = $fields[-1];
next unless $symbol;
# Skip symbols not belonging to libxlsxwriter.
next if $symbol !~ /^_(lxw|work|format|chart|new)/;
# Skip some the RedBlack functions.
next if $symbol =~ m{RB};
# Strip the leading underscore.
$symbol =~ s/^_//;
# Remove duplicate instances of some symbols.
$unique{$symbol}++;
}
# Generate the .def file.
print "EXPORTS\r\n";
for my $symbol ( sort keys %unique ) {
print " ", $symbol, "\r\n";
}
@@ -0,0 +1,10 @@
prefix=@PREFIX@
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib
Name: libxlsxwriter
Description: A C library for creating Excel XLSX files
Version: @VERSION@
Cflags: -I${includedir}
Libs: -L${libdir} -lxlsxwriter -lz
+332
View File
@@ -0,0 +1,332 @@
#!/bin/bash
clear
echo "|"
echo "| Pre-release checks."
echo "|"
echo
#############################################################
#
# Run tests.
#
function check_test_status {
echo
echo -n "Are all tests passing? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo -n " Run all tests now? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo
echo -e "Please run: make test\n";
exit 1
else
echo " Running tests...";
make test
check_test_status
fi
fi
}
#############################################################
#
# Run test for C++ const correctness.
#
function check_test_const {
echo
echo -n "Is the const test passing? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo -n " Run test now? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo
echo -e "Please run: make test_const\n";
exit 1
else
echo " Running test...";
make test_const
check_test_const
fi
fi
}
#############################################################
#
# Run spellcheck.
#
function check_spellcheck {
echo
echo -n "Is the spellcheck ok? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo -n " Run spellcheck now? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo
echo -e "Please run: make spellcheck\n";
exit 1
else
echo " Running spellcheck...";
make spellcheck
check_spellcheck
fi
fi
}
#############################################################
#
# Check Changes file is up to date.
#
function check_changefile {
clear
echo "Latest change in Changes file: "
perl -ne '$rev++ if /^##/; exit if $rev > 1; print " | $_"' Changes.txt
echo
echo -n "Is the Changes file updated? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo
echo -e "Please update the Change file to proceed.\n";
exit 1
fi
}
#############################################################
#
# Check the versions are up to date.
#
function check_versions {
clear
echo
echo "Latest file versions: "
echo
awk '/s.version / {print "\t" FILENAME "\t" $1 "\t" $3}' libxlsxwriter.podspec
awk '/ LXW/ {print "\t" FILENAME "\t" $2 "\t" $3}' include/xlsxwriter.h
echo
echo -n "Are the versions up to date? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo -n " Update versions? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo
echo -e "Please update the versions to proceed.\n";
exit 1
else
echo " Updating versions...";
perl -i dev/release/update_revison.pl include/xlsxwriter.h libxlsxwriter.podspec
check_versions
fi
fi
}
#############################################################
#
# Check that the docs build cleanly.
#
function check_docs {
# clear
echo
echo -n "Do the docs build cleanly? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo -n " Build docs now? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo
echo -e "Please run: make docs\n";
exit 1
else
echo " Building docs...";
make docs
check_docs
fi
fi
}
#############################################################
#
# Generate the cocoapods umbrella file.
#
function gen_umbrella_file {
echo
echo -n "Is the umbrella file up to date? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo -n " Update umbrella file now? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo
echo -e "Please update cocoapods/libxlsxwriter-umbrella.h\n";
exit 1
else
echo " Updating file...";
perl dev/release/gen_umbrella_file.pl > cocoapods/libxlsxwriter-umbrella.h
fi
fi
}
#############################################################
#
# Check the cocoapods spec file.
#
function check_pod_spec {
echo
echo -n "Is the coacoapod file ok? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo -n " Run lint now? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo
echo -e "Please run: pod spec lint libxlsxwriter.podspec\n";
exit 1
else
echo " Running lint...";
pod spec lint libxlsxwriter.podspec --use-libraries
check_pod_spec
fi
fi
}
#############################################################
#
# Update the pod repo. This can take some time.
#
function update_pod_repo {
echo
echo -n "Is the pod repo updated? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo -n " Update now? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo
echo -e "Please run: pod spec lint libxlsxwriter.podspec\n";
exit 1
else
echo " Running update...";
cd ~/.cocoapods/repos/master
git pull --ff-only
cd -
update_pod_repo
fi
fi
}
#############################################################
#
# Run release checks.
#
function check_git_status {
clear
echo "Git status: "
git status | awk '{print " | ", $0}'
echo "Git log: "
git log -1 | awk '{print " | ", $0}'
echo "Git latest tag: "
git tag -l -n1 | tail -1 | awk '{print " | ", $0}'
echo
echo -n "Is the git status okay? [y/N]: "
read RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo
echo -e "Please fix git status.\n";
echo -e "\ngit add -u";
git tag -l -n1 | tail -1 | perl -lane 'printf "git commit -m \"Prep for release %s\"\ngit tag \"%s\"\n\n", $F[4], $F[0]' | perl dev/release/update_revison.pl
exit 1
fi
}
check_test_status
clear
check_test_const
clear
check_spellcheck
clear
check_docs
check_changefile
clear
gen_umbrella_file
check_pod_spec
clear
update_pod_repo
check_versions
check_git_status
#############################################################
#
# All checks complete.
#
clear
echo
echo "Everything is configured.";
echo
echo -n "Confirm release: [y/N]: ";
read RESPONSE
if [ "$RESPONSE" == "y" ]; then
exit 0
else
exit 1
fi
@@ -0,0 +1,42 @@
#!/usr/bin/perl
# Simple script to increment x.y.z style version numbers in a file.
use strict;
use warnings;
use Perl::Version;
while (<>) {
# Increment any x.y.z version strings.
if (m/(\d\.\d\.\d)/) {
my $version = Perl::Version->new( $1 );
# Components are: revision, version and subversion.
if ( $version->version == 9 && $version->subversion == 9 ) {
$version->inc_revision();
}
elsif ( $version->subversion == 9 ) {
$version->inc_version();
}
else {
$version->inc_subversion();
}
my $new_version = $version->stringify();
s/\d\.\d\.\d/$new_version/;
}
# Increment the LXW_VERSION_ID number in xlsxwriter.h
if (m/LXW_VERSION_ID (\d+)/) {
my $version = $1;
my $new_version = $version + 1;
s/\d+/$new_version/;
}
print;
}
__END__
File diff suppressed because it is too large Load Diff
+180
View File
@@ -0,0 +1,180 @@
<doxygenlayout version="1.0">
<!-- Generated by doxygen 1.8.7 -->
<!-- Navigation index tabs for HTML output -->
<navindex>
<tab type="mainpage" visible="yes" title=""/>
<tab type="modules" visible="yes" title="" intro=""/>
<tab type="pages" visible="yes" title="" intro=""/>
<tab type="files" visible="yes" title="">
<tab type="filelist" visible="yes" title="" intro=""/>
</tab>
<tab type="examples" visible="yes" title="" intro="Example programs using libxlsxwriter:"/>
</navindex>
<!-- Layout definition for a class page -->
<class>
<briefdescription visible="yes"/>
<detaileddescription title=""/>
<inheritancegraph visible="$CLASS_GRAPH"/>
<collaborationgraph visible="$COLLABORATION_GRAPH"/>
<memberdecl>
<nestedclasses visible="yes" title=""/>
<publictypes title=""/>
<services title=""/>
<interfaces title=""/>
<publicslots title=""/>
<signals title=""/>
<publicmethods title=""/>
<publicstaticmethods title=""/>
<publicattributes title=""/>
<publicstaticattributes title=""/>
<protectedtypes title=""/>
<protectedslots title=""/>
<protectedmethods title=""/>
<protectedstaticmethods title=""/>
<protectedattributes title=""/>
<protectedstaticattributes title=""/>
<packagetypes title=""/>
<packagemethods title=""/>
<packagestaticmethods title=""/>
<packageattributes title=""/>
<packagestaticattributes title=""/>
<properties title=""/>
<events title=""/>
<privatetypes title=""/>
<privateslots title=""/>
<privatemethods title=""/>
<privatestaticmethods title=""/>
<privateattributes title=""/>
<privatestaticattributes title=""/>
<friends title=""/>
<related title="" subtitle=""/>
<membergroups visible="yes"/>
</memberdecl>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<services title=""/>
<interfaces title=""/>
<constructors title=""/>
<functions title=""/>
<related title=""/>
<variables title=""/>
<properties title=""/>
<events title=""/>
</memberdef>
<allmemberslink visible="yes"/>
<usedfiles visible="$SHOW_USED_FILES"/>
<authorsection visible="yes"/>
</class>
<!-- Layout definition for a namespace page -->
<namespace>
<briefdescription visible="yes"/>
<memberdecl>
<nestednamespaces visible="yes" title=""/>
<constantgroups visible="yes" title=""/>
<classes visible="yes" title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
</memberdef>
<authorsection visible="yes"/>
</namespace>
<!-- Layout definition for a file page -->
<file>
<detaileddescription title="Description"/>
<sourcelink visible="yes"/>
<memberdecl>
<functions title=""/>
</memberdecl>
<memberdef>
<functions title=""/>
<inlineclasses title=""/>
<typedefs title=""/>
<defines title=""/>
<enums title=""/>
<variables title=""/>
</memberdef>
<memberdecl>
<classes visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<constantgroups visible="yes" title=""/>
<typedefs title=""/>
<variables title=""/>
<enums title=""/>
<defines title=""/>
<membergroups visible="yes"/>
</memberdecl>
<authorsection/>
</file>
<!-- Layout definition for a group page -->
<group>
<briefdescription visible="yes"/>
<groupgraph visible="$GROUP_GRAPHS"/>
<memberdecl>
<nestedgroups visible="yes" title=""/>
<dirs visible="yes" title=""/>
<files visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<classes visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<pagedocs/>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
</memberdef>
<authorsection visible="yes"/>
</group>
<!-- Layout definition for a directory page -->
<directory>
<briefdescription visible="yes"/>
<directorygraph visible="yes"/>
<memberdecl>
<dirs visible="yes"/>
<files visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
</directory>
</doxygenlayout>
+28
View File
@@ -0,0 +1,28 @@
###############################################################################
#
# Makefile for libxlsxwriter library.
#
# Copyright 2014-2022, John McNamara, jmcnamara@cpan.org
#
# Keep the output quiet by default.
Q=@
ifdef V
Q=
endif
# Make everything.
all : docs
# Clean up.
clean :
$(Q)rm -rf html/*
# Build the doxygen docs.
docs:
$(Q)perl ../dev/release/fix_example_links.pl src/examples.txt > src/examples.dox
$(Q)doxygen
$(Q)../dev/release/fix_dox.sh
docs_doxygen_only:
$(Q)doxygen
File diff suppressed because it is too large Load Diff
+18
View File
@@ -0,0 +1,18 @@
<!-- HTML footer for doxygen 1.8.20-->
<!-- start footer part -->
<!--BEGIN GENERATE_TREEVIEW-->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
$navpath
<li class="footer">Copyright 2014-2022 John McNamara. $generatedby <a href="http://www.doxygen.org/index.html"><img class="footer" src="$relpath^doxygen.svg" width="104" height="31" alt="doxygen"/></a> $doxygenversion </li>
</ul>
</div>
<!--END GENERATE_TREEVIEW-->
<!--BEGIN !GENERATE_TREEVIEW-->
<hr class="footer"/><address class="footer"><small>
Copyright 2014-2022 John McNamara.
$generatedby&#160;<a href="http://www.doxygen.org/index.html"><img class="footer" src="$relpath^doxygen.svg" width="104" height="31" alt="doxygen"/></a> $doxygenversion
</small></address>
<!--END !GENERATE_TREEVIEW-->
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

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