初始化PHP-Xlswrite扩展
This commit is contained in:
commit
879cf9584d
|
@ -0,0 +1,323 @@
|
|||
version: "{branch}.build.{build}"
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- dev
|
||||
|
||||
clone_folder: c:\projects\xlswriter
|
||||
|
||||
install:
|
||||
ps: |
|
||||
if (-not (Test-Path c:\build-cache)) {
|
||||
mkdir c:\build-cache
|
||||
}
|
||||
$bname = 'php-sdk-' + $env:BIN_SDK_VER + '.zip'
|
||||
if (-not (Test-Path c:\build-cache\$bname)) {
|
||||
Invoke-WebRequest "https://github.com/OSTC/php-sdk-binary-tools/archive/$bname" -OutFile "c:\build-cache\$bname"
|
||||
}
|
||||
$dname0 = 'php-sdk-binary-tools-php-sdk-' + $env:BIN_SDK_VER
|
||||
$dname1 = 'php-sdk-' + $env:BIN_SDK_VER
|
||||
if (-not (Test-Path c:\build-cache\$dname1)) {
|
||||
7z x c:\build-cache\$bname -oc:\build-cache
|
||||
move c:\build-cache\$dname0 c:\build-cache\$dname1
|
||||
}
|
||||
$lname0 = 'zlib-' + $env:ZLIB_VER + '-' + $env:VC.toLower() + '-' + $env:ARCH + '.zip'
|
||||
$lname1 = 'zlib'
|
||||
if (-not (Test-Path c:\build-cache\$lname0)) {
|
||||
$zliurl = "https://windows.php.net/downloads/php-sdk/deps/" + $env:VC.toLower() + "/" + $env:ARCH + "/" + $lname0
|
||||
Invoke-WebRequest $zliurl -OutFile "c:\build-cache\$lname0"
|
||||
}
|
||||
if (-not (Test-Path c:\build-cache\$lname1)) {
|
||||
7z x c:\build-cache\$lname0 -oc:\build-cache\$lname1
|
||||
}
|
||||
|
||||
cache:
|
||||
c:\build-cache -> .appveyor.yml
|
||||
|
||||
environment:
|
||||
BIN_SDK_VER: 2.2.0
|
||||
matrix:
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ARCH: x64
|
||||
VC: VC14
|
||||
PHP_VER: 7.0.28
|
||||
ZLIB_VER: 1.2.8
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ARCH: x64
|
||||
VC: VC14
|
||||
PHP_VER: 7.0.28
|
||||
ZLIB_VER: 1.2.8
|
||||
TS: 1
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ARCH: x86
|
||||
VC: VC14
|
||||
PHP_VER: 7.0.28
|
||||
ZLIB_VER: 1.2.8
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ARCH: x86
|
||||
VC: VC14
|
||||
PHP_VER: 7.0.28
|
||||
ZLIB_VER: 1.2.8
|
||||
TS: 1
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ARCH: x64
|
||||
VC: VC14
|
||||
PHP_VER: 7.1.15
|
||||
ZLIB_VER: 1.2.8
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ARCH: x64
|
||||
VC: VC14
|
||||
PHP_VER: 7.1.15
|
||||
ZLIB_VER: 1.2.8
|
||||
TS: 1
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ARCH: x86
|
||||
VC: VC14
|
||||
PHP_VER: 7.1.15
|
||||
ZLIB_VER: 1.2.8
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ARCH: x86
|
||||
VC: VC14
|
||||
PHP_VER: 7.1.15
|
||||
ZLIB_VER: 1.2.8
|
||||
TS: 1
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
ARCH: x64
|
||||
VC: VC15
|
||||
PHP_VER: 7.2.3
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
ARCH: x64
|
||||
VC: VC15
|
||||
PHP_VER: 7.2.3
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 1
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
ARCH: x86
|
||||
VC: VC15
|
||||
PHP_VER: 7.2.3
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
ARCH: x86
|
||||
VC: VC15
|
||||
PHP_VER: 7.2.3
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 1
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
ARCH: x64
|
||||
VC: VC15
|
||||
PHP_VER: 7.3.0
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
ARCH: x64
|
||||
VC: VC15
|
||||
PHP_VER: 7.3.0
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 1
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
ARCH: x86
|
||||
VC: VC15
|
||||
PHP_VER: 7.3.0
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
ARCH: x86
|
||||
VC: VC15
|
||||
PHP_VER: 7.3.0
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 1
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
ARCH: x64
|
||||
VC: VC15
|
||||
PHP_VER: 7.4.0
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
ARCH: x64
|
||||
VC: VC15
|
||||
PHP_VER: 7.4.0
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 1
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
ARCH: x86
|
||||
VC: VC15
|
||||
PHP_VER: 7.4.0
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
ARCH: x86
|
||||
VC: VC15
|
||||
PHP_VER: 7.4.0
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 1
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
ARCH: x64
|
||||
VC: vs16
|
||||
PHP_VER: 8.0.0
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
ARCH: x64
|
||||
VC: vs16
|
||||
PHP_VER: 8.0.0
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 1
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
ARCH: x86
|
||||
VC: vs16
|
||||
PHP_VER: 8.0.0
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
ARCH: x86
|
||||
VC: vs16
|
||||
PHP_VER: 8.0.0
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 1
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
ARCH: x64
|
||||
VC: vs16
|
||||
PHP_VER: 8.1.9
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
ARCH: x64
|
||||
VC: vs16
|
||||
PHP_VER: 8.1.9
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 1
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
ARCH: x86
|
||||
VC: vs16
|
||||
PHP_VER: 8.1.9
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
ARCH: x86
|
||||
VC: vs16
|
||||
PHP_VER: 8.1.9
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 1
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
ARCH: x64
|
||||
VC: vs16
|
||||
PHP_VER: 8.2.5
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
ARCH: x64
|
||||
VC: vs16
|
||||
PHP_VER: 8.2.5
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 1
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
ARCH: x86
|
||||
VC: vs16
|
||||
PHP_VER: 8.2.5
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
ARCH: x86
|
||||
VC: vs16
|
||||
PHP_VER: 8.2.5
|
||||
ZLIB_VER: 1.2.11
|
||||
TS: 1
|
||||
|
||||
build_script:
|
||||
ps: |
|
||||
$ts_part = ''
|
||||
if ('0' -eq $env:TS) { $ts_part = '-nts' }
|
||||
$bname = 'php-devel-pack-' + $env:PHP_VER + $ts_part + '-Win32-' + $env:VC + '-' + $env:ARCH + '.zip'
|
||||
if (-not (Test-Path c:\build-cache\$bname)) {
|
||||
try {
|
||||
Invoke-WebRequest "http://windows.php.net/downloads/releases/archives/$bname" -OutFile "c:\build-cache\$bname"
|
||||
} catch {
|
||||
if (-not (Test-Path c:\build-cache\$bname)) {
|
||||
Invoke-WebRequest "http://windows.php.net/downloads/releases/$bname" -OutFile "c:\build-cache\$bname"
|
||||
}
|
||||
}
|
||||
}
|
||||
$dname0 = 'php-' + $env:PHP_VER + '-devel-' + $env:VC + '-' + $env:ARCH
|
||||
$dname1 = 'php-' + $env:PHP_VER + $ts_part + '-devel-' + $env:VC + '-' + $env:ARCH
|
||||
if (-not (Test-Path c:\build-cache\$dname1)) {
|
||||
7z x c:\build-cache\$bname -oc:\build-cache
|
||||
move c:\build-cache\$dname0 c:\build-cache\$dname1
|
||||
}
|
||||
cd c:\projects\xlswriter
|
||||
$env:PATH = 'c:\build-cache\' + $dname1 + ';' + $env:PATH
|
||||
#echo "@echo off" | Out-File -Encoding "ASCII" task.bat
|
||||
#echo "" | Out-File -Encoding "ASCII" -Append task.bat
|
||||
echo "" | Out-File -Encoding "ASCII" task.bat
|
||||
echo "php -m 2>&1" | Out-File -Encoding "ASCII" -Append task.bat
|
||||
echo "call git submodule update --init 2>&1" | Out-File -Encoding "ASCII" -Append task.bat
|
||||
echo "call phpize 2>&1" | Out-File -Encoding "ASCII" -Append task.bat
|
||||
$conf_cmd = 'call configure --with-xlswriter --with-extra-libs=c:\build-cache\zlib\lib --with-extra-includes=c:\build-cache\zlib\include --enable-debug-pack 2>&1'
|
||||
echo $conf_cmd | Out-File -Encoding "ASCII" -Append task.bat
|
||||
echo "nmake /nologo 2>&1" | Out-File -Encoding "ASCII" -Append task.bat
|
||||
echo "exit %errorlevel%" | Out-File -Encoding "ASCII" -Append task.bat
|
||||
$here = (Get-Item -Path "." -Verbose).FullName
|
||||
$runner = 'c:\build-cache\php-sdk-' + $env:BIN_SDK_VER + '\phpsdk' + '-' + $env:VC + '-' + $env:ARCH + '.bat'
|
||||
$task = $here + '\task.bat'
|
||||
& $runner -t $task
|
||||
|
||||
after_build:
|
||||
ps: |
|
||||
$ts_part = 'ts'
|
||||
if ('0' -eq $env:TS) { $ts_part = 'nts' }
|
||||
$zip_bname = 'php-windows-xlswriter-' + $env:APPVEYOR_REPO_COMMIT.substring(0, 8) + '-' + $env:PHP_VER.substring(0, 3) + '-' + $ts_part + '-' + $env:VC + '-' + $env:ARCH + '.zip'
|
||||
$dir = 'c:\projects\xlswriter\';
|
||||
if ('x64' -eq $env:ARCH) { $dir = $dir + 'x64\' }
|
||||
$dir = $dir + 'Release'
|
||||
if ('1' -eq $env:TS) { $dir = $dir + '_TS' }
|
||||
if (-not (Test-Path c:\build-cache\zlib\lib\zlib.pdb)) {
|
||||
7z a c:\$zip_bname $dir\php_xlswriter.dll c:\projects\xlswriter\LICENSE c:\build-cache\zlib\lib\zlib_a.lib c:\build-cache\zlib\lib\zlib_a.pdb
|
||||
} else {
|
||||
7z a c:\$zip_bname $dir\php_xlswriter.dll c:\projects\xlswriter\LICENSE c:\build-cache\zlib\lib\zlib_a.lib c:\build-cache\zlib\lib\zlib.pdb
|
||||
}
|
||||
Push-AppveyorArtifact c:\$zip_bname
|
||||
|
||||
test_script:
|
||||
ps: |
|
||||
$ts_part = ''
|
||||
if ('0' -eq $env:TS) { $ts_part = '-nts' }
|
||||
$bname = 'php-' + $env:PHP_VER + $ts_part + '-Win32-' + $env:VC + '-' + $env:ARCH + '.zip'
|
||||
if (-not (Test-Path c:\build-cache\$bname)) {
|
||||
try {
|
||||
Invoke-WebRequest "http://windows.php.net/downloads/releases/archives/$bname" -OutFile "c:\build-cache\$bname"
|
||||
} catch {
|
||||
if (-not (Test-Path c:\build-cache\$bname)) {
|
||||
Invoke-WebRequest "http://windows.php.net/downloads/releases/$bname" -OutFile "c:\build-cache\$bname"
|
||||
}
|
||||
}
|
||||
}
|
||||
$dname = 'php-' + $env:PHP_VER + $ts_part + '-' + $env:VC + '-' + $env:ARCH
|
||||
if (-not (Test-Path c:\build-cache\$dname)) {
|
||||
7z x c:\build-cache\$bname -oc:\build-cache\$dname
|
||||
}
|
||||
cd c:\projects\xlswriter
|
||||
echo "" | Out-File -Encoding "ASCII" task.bat
|
||||
echo "set REPORT_EXIT_STATUS=1" | Out-File -Encoding "ASCII" -Append task.bat
|
||||
$cmd = 'call configure --with-xlswriter --with-extra-libs=c:\build-cache\zlib\lib --with-extra-includes=c:\build-cache\zlib\include --with-prefix=c:\build-cache\' + $dname + ' 2>&1'
|
||||
echo $cmd | Out-File -Encoding "ASCII" -Append task.bat
|
||||
echo 'nmake /nologo test TESTS="-q --show-all --set-timeout 120" 2>&1' | Out-File -Encoding "ASCII" -Append task.bat
|
||||
echo "exit %errorlevel%" | Out-File -Encoding "ASCII" -Append task.bat
|
||||
$here = (Get-Item -Path "." -Verbose).FullName
|
||||
$runner = 'c:\build-cache\php-sdk-' + $env:BIN_SDK_VER + '\phpsdk' + '-' + $env:VC + '-' + $env:ARCH + '.bat'
|
||||
$task = $here + '\task.bat'
|
||||
& $runner -t $task
|
||||
|
||||
deploy:
|
||||
provider: GitHub
|
||||
auth_token: $(GITHUB_OAUTH_TOKEN)
|
||||
draft: false
|
||||
prerelease: false
|
||||
on:
|
||||
APPVEYOR_REPO_TAG: true
|
|
@ -0,0 +1,12 @@
|
|||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: php-ext-xlswriter # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
|
@ -0,0 +1,42 @@
|
|||
name: php-ext-xlswriter
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
run:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest]
|
||||
php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
|
||||
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
|
||||
- name: Setup Dependencies
|
||||
run: |
|
||||
sudo apt-get --fix-broken install
|
||||
sudo apt-get update
|
||||
sudo apt-get install zlib1g-dev valgrind -y
|
||||
|
||||
- name: Setup Submodule
|
||||
run: git submodule update --init
|
||||
|
||||
- name: Build Extension And Execute Tests
|
||||
run: |
|
||||
php -m
|
||||
phpize && ./configure --enable-reader
|
||||
make clean && make && make test
|
||||
|
||||
- name: Build Extension And Execute Valgrind Tests
|
||||
if: contains('7.0,7.1,7.2', matrix.php-versions)
|
||||
run: |
|
||||
phpize && ./configure --enable-reader
|
||||
make clean && make && make test
|
||||
REPORT_EXIT_STATUS=1 php -n run-tests.php -m -n -d extension_dir=./modules/ -d extension=xlswriter.so -P --show-all --set-timeout 120
|
|
@ -0,0 +1,49 @@
|
|||
.deps
|
||||
*.lo
|
||||
*.la
|
||||
.libs
|
||||
.idea
|
||||
.DS_Store
|
||||
.dockerignore
|
||||
Dockerfile
|
||||
debug
|
||||
debug.php
|
||||
php
|
||||
acinclude.m4
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
build
|
||||
config.guess
|
||||
config.h
|
||||
config.h.in
|
||||
config.log
|
||||
config.nice
|
||||
config.status
|
||||
config.sub
|
||||
configure
|
||||
configure.ac
|
||||
configure.in
|
||||
install-sh
|
||||
libtool
|
||||
ltmain.sh
|
||||
ltmain.sh.backup
|
||||
Makefile
|
||||
Makefile.fragments
|
||||
Makefile.global
|
||||
Makefile.objects
|
||||
missing
|
||||
mkinstalldirs
|
||||
modules
|
||||
run-tests.php
|
||||
tests/*/*.diff
|
||||
tests/*/*.out
|
||||
tests/*/*.php
|
||||
tests/*/*.exp
|
||||
tests/*/*.log
|
||||
tests/*/*.sh
|
||||
tmp-php.ini
|
||||
cmake-build-debug
|
||||
CMakeLists.txt
|
||||
local_test.php
|
||||
xlswriter-*.tgz
|
||||
benchmark.c
|
|
@ -0,0 +1,8 @@
|
|||
[submodule "library/libxlsxwriter"]
|
||||
path = library/libxlsxwriter
|
||||
url = https://github.com/jmcnamara/libxlsxwriter.git
|
||||
branch = RELEASE_1.0.0
|
||||
[submodule "library/libexpat"]
|
||||
path = library/libexpat
|
||||
url = https://github.com/libexpat/libexpat.git
|
||||
branch = R_2_2_7
|
|
@ -0,0 +1,44 @@
|
|||
language: php
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
|
||||
os:
|
||||
- linux
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- php: 7.0
|
||||
env: USE_VALGRIND=1
|
||||
- php: 7.1
|
||||
env: USE_VALGRIND=1
|
||||
- php: 7.2
|
||||
env: USE_VALGRIND=1
|
||||
- php: 7.3
|
||||
- php: 7.4
|
||||
- php: nightly
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages: valgrind
|
||||
|
||||
notifications:
|
||||
email: dev@service.viest.me
|
||||
|
||||
before_script:
|
||||
- php -m
|
||||
- git submodule update --init
|
||||
- sudo apt-get install zlib1g-dev -y
|
||||
- phpize && ./configure --enable-reader && make clean && make
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- dev
|
||||
|
||||
script:
|
||||
- ./travis/run-test.sh
|
||||
- make clean && phpize --clean
|
||||
- phpize && ./configure --enable-reader && make clean && make
|
||||
- if [ -n "$USE_VALGRIND" ]; then REPORT_EXIT_STATUS=1 php -n run-tests.php -m -n -d extension_dir=./modules/ -d extension=xlswriter.so -P --show-all --set-timeout 120; fi
|
|
@ -0,0 +1,22 @@
|
|||
* Copyright (c) 2017-2018, Jiexin Wang <dev@service.viest.me>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * 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 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 AND 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.
|
|
@ -0,0 +1,149 @@
|
|||
<div align=center>
|
||||
<img alt="php-ext-xlswriter" height="214" src="resource/logo_now.png"/>
|
||||
</div>
|
||||
|
||||
<div align=center>
|
||||
<a href="https://github.com/viest/php-ext-xlswriter/releases"><img alt="php-ext-xlswriter" src="https://img.shields.io/github/release/viest/php-ext-excel-export.svg"/></a>
|
||||
</div>
|
||||
|
||||
<div align=center>
|
||||
<a href="https://github.com/viest/php-ext-xlswriter"><img alt="php-ext-xlswriter" src="https://img.shields.io/badge/platform-macos%20%7C%20linux%20%7C%20windows-brightgreen.svg"/></a>
|
||||
</div>
|
||||
|
||||
<div align=center>
|
||||
<a href="https://github.com/viest/php-ext-xlswriter/actions"><img alt="php-ext-xlswriter" src="https://img.shields.io/github/actions/workflow/status/viest/php-ext-xlswriter/main.yml?branch=master&logo=github"></a>
|
||||
<a href="https://travis-ci.com/viest/php-ext-xlswriter"><img alt="php-ext-xlswriter" src="https://travis-ci.com/viest/php-ext-xlswriter.svg?branch=master"/></a>
|
||||
<a href="https://ci.appveyor.com/project/viest/php-ext-excel-export/branch/master"><img alt="php-ext-xlswriter" src="https://ci.appveyor.com/api/projects/status/w4cfjo9e4gsrs6rn/branch/master?svg=true"/></a>
|
||||
<a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fviest%2Fphp-ext-xlswriter?ref=badge_shield"><img alt="php-ext-xlswriter" src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fviest%2Fphp-ext-xlswriter.svg?type=shield"/></a>
|
||||
</div>
|
||||
|
||||
<div align=center>
|
||||
<a href="https://opencollective.com/php-ext-xlswriter"><img alt="php-ext-xlswriter" src="https://opencollective.com/php-ext-xlswriter/all/badge.svg?label=financial+contributors"/></a>
|
||||
<a href="https://github.com/viest/php-ext-xlswriter"><img alt="php-ext-xlswriter" src="https://img.shields.io/badge/PHP-%3E%3D%207.0-brightgreen.svg"/></a>
|
||||
<a href="https://github.com/viest/php-ext-xlswriter"><img alt="php-ext-xlswriter" src="https://img.shields.io/github/contributors/viest/php-ext-excel-export.svg"/></a>
|
||||
<a href="https://github.com/viest/php-ext-xlswriter"><img alt="php-ext-xlswriter" src="https://img.shields.io/badge/license-BSD-green.svg"/></a>
|
||||
<a href="https://github.com/viest/php-ext-xlswriter"><img alt="php-ext-xlswriter" src="https://img.shields.io/github/issues/viest/php-ext-excel-export.svg"/></a>
|
||||
<a href="https://hits.seeyoufarm.com"><img alt="php-ext-xlswriter" src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fviest%2Fphp-ext-xlswriter&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false"/></a>
|
||||
</div>
|
||||
|
||||
## Why use xlswriter
|
||||
|
||||
Please refer to the image below. PHPExcel has been unable to work properly for memory reasons at 40,000 and 100000 points, but it can be resolved by modifying the ini configuration, but the time may take longer to complete the work;
|
||||
|
||||
![php-excel](resource/performance_comparison.png)
|
||||
|
||||
xlswriter is a PHP C Extension 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:
|
||||
|
||||
###### Writer
|
||||
|
||||
* 100% compatible Excel XLSX files.
|
||||
* Full Excel formatting.
|
||||
* Merged cells.
|
||||
* Defined names.
|
||||
* Autofilters.
|
||||
* Charts.
|
||||
* Data validation and drop down lists.
|
||||
* Worksheet PNG/JPEG images.
|
||||
* Memory optimization mode for writing large files.
|
||||
* Works on Linux, FreeBSD, OpenBSD, OS X, Windows.
|
||||
* Compiles for 32 and 64 bit.
|
||||
* FreeBSD License.
|
||||
* The only dependency is on zlib.
|
||||
|
||||
###### Reader
|
||||
|
||||
* Full read data
|
||||
* Cursor read data
|
||||
* Read by data type
|
||||
|
||||
#### Install
|
||||
|
||||
###### Unix
|
||||
|
||||
```bash
|
||||
pecl install xlswriter
|
||||
```
|
||||
|
||||
###### Windows
|
||||
|
||||
[download dll](https://github.com/viest/php-ext-xlswriter/releases)
|
||||
|
||||
#### Benchmark
|
||||
|
||||
Test environment: Macbook Pro 13 inch, Intel Core i5, 16GB 2133MHz LPDDR3 Memory, 128GB SSD Storage.
|
||||
|
||||
##### Export
|
||||
|
||||
> Two memory modes export 1 million rows of data (27 columns, data is string)
|
||||
|
||||
* Normal mode: only 29S is needed, and the memory only needs 2083MB;
|
||||
* Fixed memory mode: only need 52S, memory only needs <1MB;
|
||||
|
||||
##### Import
|
||||
|
||||
> 1 million rows of data (1 columns, data is inter)
|
||||
|
||||
* Full mode: Just 3S, the memory is only 558MB;
|
||||
* Cursor mode: Just 2.8S, memory is only <1MB;
|
||||
|
||||
## [Documents](https://xlswriter-docs.viest.me/)
|
||||
|
||||
Includes extensive and detailed instructions that make it easy to get started with xlswriter.
|
||||
|
||||
## PECL Repository
|
||||
|
||||
[![pecl](resource/pecl.png)](https://pecl.php.net/package/xlswriter)
|
||||
|
||||
## IDE Helper
|
||||
|
||||
```bash
|
||||
composer require viest/php-ext-xlswriter-ide-helper:dev-master
|
||||
```
|
||||
|
||||
## Exchange group
|
||||
|
||||
<img alt="php-ext-xlswriter" width="160" src="resource/qq.jpg"/>
|
||||
|
||||
## Financial donation
|
||||
|
||||
<img alt="php-ext-xlswriter" height="220" src="resource/pay.jpg"/>
|
||||
|
||||
## Contributors
|
||||
|
||||
### Code Contributors
|
||||
|
||||
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
|
||||
<a href="https://github.com/viest/php-ext-xlswriter/graphs/contributors"><img src="https://opencollective.com/php-ext-xlswriter/contributors.svg?width=890&button=false" /></a>
|
||||
|
||||
### Financial Contributors
|
||||
|
||||
Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/php-ext-xlswriter/contribute)]
|
||||
|
||||
#### Individuals
|
||||
|
||||
<a href="https://opencollective.com/php-ext-xlswriter"><img src="https://opencollective.com/php-ext-xlswriter/individuals.svg?width=890"></a>
|
||||
|
||||
#### Organizations
|
||||
|
||||
Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/php-ext-xlswriter/contribute)]
|
||||
|
||||
<a href="https://opencollective.com/php-ext-xlswriter/organization/0/website"><img src="https://opencollective.com/php-ext-xlswriter/organization/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/php-ext-xlswriter/organization/1/website"><img src="https://opencollective.com/php-ext-xlswriter/organization/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/php-ext-xlswriter/organization/2/website"><img src="https://opencollective.com/php-ext-xlswriter/organization/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/php-ext-xlswriter/organization/3/website"><img src="https://opencollective.com/php-ext-xlswriter/organization/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/php-ext-xlswriter/organization/4/website"><img src="https://opencollective.com/php-ext-xlswriter/organization/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/php-ext-xlswriter/organization/5/website"><img src="https://opencollective.com/php-ext-xlswriter/organization/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/php-ext-xlswriter/organization/6/website"><img src="https://opencollective.com/php-ext-xlswriter/organization/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/php-ext-xlswriter/organization/7/website"><img src="https://opencollective.com/php-ext-xlswriter/organization/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/php-ext-xlswriter/organization/8/website"><img src="https://opencollective.com/php-ext-xlswriter/organization/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/php-ext-xlswriter/organization/9/website"><img src="https://opencollective.com/php-ext-xlswriter/organization/9/avatar.svg"></a>
|
||||
|
||||
## License
|
||||
|
||||
BSD License
|
||||
|
||||
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fviest%2Fphp-ext-xlswriter.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fviest%2Fphp-ext-xlswriter?ref=badge_large)
|
||||
|
||||
## Stargazers over time
|
||||
|
||||
[![Stargazers over time](https://starchart.cc/viest/php-ext-xlswriter.svg)](https://starchart.cc/viest/php-ext-xlswriter)
|
|
@ -0,0 +1,136 @@
|
|||
<div align=center>
|
||||
<img alt="php-ext-xlswriter" height="214" src="resource/logo_now.png"/>
|
||||
</div>
|
||||
|
||||
<div align=center>
|
||||
<a href="https://github.com/viest/php-ext-xlswriter/releases"><img alt="php-ext-xlswriter" src="https://img.shields.io/github/release/viest/php-ext-excel-export.svg"/></a>
|
||||
</div>
|
||||
|
||||
<div align=center>
|
||||
<a href="https://github.com/viest/php-ext-xlswriter"><img alt="php-ext-xlswriter" src="https://img.shields.io/badge/platform-macos%20%7C%20linux%20%7C%20windows-brightgreen.svg"/></a>
|
||||
</div>
|
||||
|
||||
<div align=center>
|
||||
<a href="https://github.com/viest/php-ext-xlswriter/actions"><img alt="php-ext-xlswriter" src="https://img.shields.io/github/actions/workflow/status/viest/php-ext-xlswriter/main.yml?branch=master&logo=github"></a>
|
||||
<a href="https://travis-ci.com/viest/php-ext-xlswriter"><img alt="php-ext-xlswriter" src="https://travis-ci.com/viest/php-ext-xlswriter.svg?branch=master"/></a>
|
||||
<a href="https://ci.appveyor.com/project/viest/php-ext-excel-export/branch/master"><img alt="php-ext-xlswriter" src="https://ci.appveyor.com/api/projects/status/w4cfjo9e4gsrs6rn/branch/master?svg=true"/></a>
|
||||
<a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fviest%2Fphp-ext-xlswriter?ref=badge_shield"><img alt="php-ext-xlswriter" src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fviest%2Fphp-ext-xlswriter.svg?type=shield"/></a>
|
||||
</div>
|
||||
|
||||
<div align=center>
|
||||
<a href="https://opencollective.com/php-ext-xlswriter"><img alt="php-ext-xlswriter" src="https://opencollective.com/php-ext-xlswriter/all/badge.svg?label=financial+contributors"/></a>
|
||||
<a href="https://github.com/viest/php-ext-xlswriter"><img alt="php-ext-xlswriter" src="https://img.shields.io/badge/PHP-%3E%3D%207.0-brightgreen.svg"/></a>
|
||||
<a href="https://github.com/viest/php-ext-xlswriter"><img alt="php-ext-xlswriter" src="https://img.shields.io/github/contributors/viest/php-ext-excel-export.svg"/></a>
|
||||
<a href="https://github.com/viest/php-ext-xlswriter"><img alt="php-ext-xlswriter" src="https://img.shields.io/badge/license-BSD-green.svg"/></a>
|
||||
<a href="https://github.com/viest/php-ext-xlswriter"><img alt="php-ext-xlswriter" src="https://img.shields.io/github/issues/viest/php-ext-excel-export.svg"/></a>
|
||||
<a href="https://hits.seeyoufarm.com"><img alt="php-ext-xlswriter" src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fviest%2Fphp-ext-xlswriter&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false"/></a>
|
||||
</div>
|
||||
|
||||
## 为什么使用xlswriter
|
||||
|
||||
请参考下方对比图;由于内存原因,PHPExcel数据量`相对较大`的情况下无法正常工作,虽然可以通过`修改memory_limit`配置来解决内存问题,但完成工作的时间可能会更长;
|
||||
|
||||
![php-excel](resource/performance_comparison.png)
|
||||
|
||||
xlswriter是一个 PHP C 扩展,可用于在 Excel 2007+ XLSX 文件中读取数据,插入多个工作表,写入文本、数字、公式、日期、图表、图片和超链接。
|
||||
|
||||
它具备以下特性:
|
||||
|
||||
###### 一、写入
|
||||
|
||||
* 100%兼容的Excel XLSX文件
|
||||
* 完整的Excel格式
|
||||
* 合并单元格
|
||||
* 定义工作表名称
|
||||
* 过滤器
|
||||
* 图表
|
||||
* 数据验证和下拉列表
|
||||
* 工作表PNG/JPEG图像
|
||||
* 用于写入大文件的内存优化模式
|
||||
* 适用于Linux,FreeBSD,OpenBSD,OS X,Windows
|
||||
* 编译为32位和64位
|
||||
* FreeBSD许可证
|
||||
* 唯一的依赖是zlib
|
||||
|
||||
###### 二、读取
|
||||
|
||||
* 完整读取数据
|
||||
* 光标读取数据
|
||||
* 按数据类型读取
|
||||
|
||||
#### 基准测试
|
||||
|
||||
测试环境: Macbook Pro 13 inch, Intel Core i5, 16GB 2133MHz LPDDR3 Memory, 128GB SSD Storage.
|
||||
|
||||
##### 导出
|
||||
|
||||
> 两种内存模式导出100万行数据(单行27列,数据类型均为字符串,单个字符串长度为19)
|
||||
|
||||
* 普通模式:耗时 `29S`,内存只需 `2083MB`;
|
||||
* 固定内存模式:仅需 `52S`,内存仅需 `<1MB`;
|
||||
|
||||
##### 导入
|
||||
|
||||
> 100万行数据(单行1列,数据类型为INT)
|
||||
|
||||
* 全量模式:耗时 `3S`,内存仅 `558MB`;
|
||||
* 游标模式:耗时 `2.8S`,内存仅 `<1MB`;
|
||||
|
||||
## 从这里开始
|
||||
|
||||
[文档|Documents](https://xlswriter-docs.viest.me/)
|
||||
|
||||
## PECL 仓库
|
||||
|
||||
[![pecl](resource/pecl.png)](https://pecl.php.net/package/xlswriter)
|
||||
|
||||
## IDE Helper
|
||||
|
||||
```bash
|
||||
composer require viest/php-ext-xlswriter-ide-helper:dev-master
|
||||
```
|
||||
|
||||
## 交流群
|
||||
|
||||
<img width="160" src="resource/qq.jpg"/>
|
||||
|
||||
## 贡献者
|
||||
|
||||
### 代码贡献者
|
||||
|
||||
这个项目的存在要感谢所有贡献者。 [[Contribute](CONTRIBUTING.md)].
|
||||
<a href="https://github.com/viest/php-ext-xlswriter/graphs/contributors"><img src="https://opencollective.com/php-ext-xlswriter/contributors.svg?width=890&button=false" /></a>
|
||||
|
||||
### 财务捐赠者
|
||||
|
||||
成为财务捐赠者,并帮助我们维持我们的社区。[[Contribute](https://opencollective.com/php-ext-xlswriter/contribute)]
|
||||
|
||||
#### 个人
|
||||
|
||||
<a href="https://opencollective.com/php-ext-xlswriter"><img src="https://opencollective.com/php-ext-xlswriter/individuals.svg?width=890"></a>
|
||||
|
||||
#### 组织机构
|
||||
|
||||
与您的组织一起支持该项目。您的徽标将显示在此处,并带有指向您网站的链接。[[Contribute](https://opencollective.com/php-ext-xlswriter/contribute)]
|
||||
|
||||
<a href="https://opencollective.com/php-ext-xlswriter/organization/0/website"><img src="https://opencollective.com/php-ext-xlswriter/organization/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/php-ext-xlswriter/organization/1/website"><img src="https://opencollective.com/php-ext-xlswriter/organization/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/php-ext-xlswriter/organization/2/website"><img src="https://opencollective.com/php-ext-xlswriter/organization/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/php-ext-xlswriter/organization/3/website"><img src="https://opencollective.com/php-ext-xlswriter/organization/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/php-ext-xlswriter/organization/4/website"><img src="https://opencollective.com/php-ext-xlswriter/organization/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/php-ext-xlswriter/organization/5/website"><img src="https://opencollective.com/php-ext-xlswriter/organization/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/php-ext-xlswriter/organization/6/website"><img src="https://opencollective.com/php-ext-xlswriter/organization/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/php-ext-xlswriter/organization/7/website"><img src="https://opencollective.com/php-ext-xlswriter/organization/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/php-ext-xlswriter/organization/8/website"><img src="https://opencollective.com/php-ext-xlswriter/organization/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/php-ext-xlswriter/organization/9/website"><img src="https://opencollective.com/php-ext-xlswriter/organization/9/avatar.svg"></a>
|
||||
|
||||
|
||||
## License
|
||||
|
||||
BSD license
|
||||
|
||||
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fviest%2Fphp-ext-xlswriter.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fviest%2Fphp-ext-xlswriter?ref=badge_large)
|
||||
|
||||
## Stargazers over time
|
||||
|
||||
[![Stargazers over time](https://starchart.cc/viest/php-ext-xlswriter.svg)](https://starchart.cc/viest/php-ext-xlswriter)
|
|
@ -0,0 +1,184 @@
|
|||
version: "{branch}.build.{build}"
|
||||
skip_tags: true
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- dev
|
||||
|
||||
clone_folder: c:\projects\xlswriter
|
||||
|
||||
install:
|
||||
ps: |
|
||||
if (-not (Test-Path c:\build-cache)) {
|
||||
mkdir c:\build-cache
|
||||
}
|
||||
$bname = 'php-sdk-' + $env:BIN_SDK_VER + '.zip'
|
||||
if (-not (Test-Path c:\build-cache\$bname)) {
|
||||
Invoke-WebRequest "https://github.com/OSTC/php-sdk-binary-tools/archive/$bname" -OutFile "c:\build-cache\$bname"
|
||||
}
|
||||
$dname0 = 'php-sdk-binary-tools-php-sdk-' + $env:BIN_SDK_VER
|
||||
$dname1 = 'php-sdk-' + $env:BIN_SDK_VER
|
||||
if (-not (Test-Path c:\build-cache\$dname1)) {
|
||||
7z x c:\build-cache\$bname -oc:\build-cache
|
||||
move c:\build-cache\$dname0 c:\build-cache\$dname1
|
||||
}
|
||||
$lname2 = 'zlib-1.2.11.tar.gz'
|
||||
$lname3 = 'zlib'
|
||||
if (-not (Test-Path c:\build-cache\$lname2)) {
|
||||
$zliurl = "http://zlib.net/" + $lname2
|
||||
Invoke-WebRequest $zliurl -OutFile "c:\build-cache\$lname2"
|
||||
}
|
||||
if (-not (Test-Path c:\build-cache\$lname3)) {
|
||||
& 7z x c:\build-cache\$lname2 -oc:\build-cache
|
||||
& 7z x c:\build-cache\zlib-1.2.11.tar -oc:\build-cache\$lname3
|
||||
}
|
||||
if (-not (Test-Path c:\build-cache\$lname3\Release)) {
|
||||
cd c:\build-cache\$lname3\zlib-1.2.11
|
||||
$cmakegen = 'Visual Studio 15 2017'
|
||||
if ($env:VC -Match "vc14") {
|
||||
$cmakegen = "Visual Studio 14 2015"
|
||||
}
|
||||
& cmake -G $cmakegen -DCMAKE_BUILD_TYPE="Release" -DCMAKE_C_FLAGS_RELEASE="/MT"
|
||||
& cmake --build . --config "Release"
|
||||
}
|
||||
|
||||
cache:
|
||||
c:\build-cache -> .appveyor.yml
|
||||
|
||||
environment:
|
||||
BIN_SDK_VER: 2.1.2
|
||||
LIBXLSXWRITER_VER: 0.7.7
|
||||
matrix:
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ARCH: x64
|
||||
VC: vc14
|
||||
PHP_VER: 7.0.28
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ARCH: x64
|
||||
VC: vc14
|
||||
PHP_VER: 7.0.28
|
||||
TS: 1
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ARCH: x86
|
||||
VC: vc14
|
||||
PHP_VER: 7.0.28
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ARCH: x86
|
||||
VC: vc14
|
||||
PHP_VER: 7.0.28
|
||||
TS: 1
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ARCH: x64
|
||||
VC: vc14
|
||||
PHP_VER: 7.1.15
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ARCH: x64
|
||||
VC: vc14
|
||||
PHP_VER: 7.1.15
|
||||
TS: 1
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ARCH: x86
|
||||
VC: vc14
|
||||
PHP_VER: 7.1.15
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ARCH: x86
|
||||
VC: vc14
|
||||
PHP_VER: 7.1.15
|
||||
TS: 1
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
ARCH: x64
|
||||
VC: vc15
|
||||
PHP_VER: 7.2.3
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
ARCH: x64
|
||||
VC: vc15
|
||||
PHP_VER: 7.2.3
|
||||
TS: 1
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
ARCH: x86
|
||||
VC: vc15
|
||||
PHP_VER: 7.2.3
|
||||
TS: 0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
ARCH: x86
|
||||
VC: vc15
|
||||
PHP_VER: 7.2.3
|
||||
TS: 1
|
||||
|
||||
build_script:
|
||||
ps: |
|
||||
$ts_part = ''
|
||||
if ('0' -eq $env:TS) { $ts_part = '-nts' }
|
||||
$bname = 'php-devel-pack-' + $env:PHP_VER + $ts_part + '-Win32-' + $env:VC.toUpper() + '-' + $env:ARCH + '.zip'
|
||||
if (-not (Test-Path c:\build-cache\$bname)) {
|
||||
Invoke-WebRequest "http://windows.php.net/downloads/releases/archives/$bname" -OutFile "c:\build-cache\$bname"
|
||||
if (-not (Test-Path c:\build-cache\$bname)) {
|
||||
Invoke-WebRequest "http://windows.php.net/downloads/releases/$bname" -OutFile "c:\build-cache\$bname"
|
||||
}
|
||||
}
|
||||
$dname0 = 'php-' + $env:PHP_VER + '-devel-' + $env:VC.toUpper() + '-' + $env:ARCH
|
||||
$dname1 = 'php-' + $env:PHP_VER + $ts_part + '-devel-' + $env:VC.toUpper() + '-' + $env:ARCH
|
||||
if (-not (Test-Path c:\build-cache\$dname1)) {
|
||||
7z x c:\build-cache\$bname -oc:\build-cache
|
||||
move c:\build-cache\$dname0 c:\build-cache\$dname1
|
||||
}
|
||||
cd c:\projects\xlswriter
|
||||
$env:PATH = 'c:\build-cache\' + $dname1 + ';' + $env:PATH
|
||||
#echo "@echo off" | Out-File -Encoding "ASCII" task.bat
|
||||
#echo "" | Out-File -Encoding "ASCII" -Append task.bat
|
||||
echo "" | Out-File -Encoding "ASCII" task.bat
|
||||
echo "call git submodule update --init 2>&1" | Out-File -Encoding "ASCII" -Append task.bat
|
||||
echo "call phpize 2>&1" | Out-File -Encoding "ASCII" -Append task.bat
|
||||
$conf_cmd = 'call configure --with-xlswriter --with-extra-libs=c:\build-cache\zlib\zlib-1.2.11\Release --with-extra-includes=c:\build-cache\zlib\zlib-1.2.11 --enable-debug-pack 2>&1'
|
||||
echo $conf_cmd | Out-File -Encoding "ASCII" -Append task.bat
|
||||
echo "nmake /nologo 2>&1" | Out-File -Encoding "ASCII" -Append task.bat
|
||||
echo "exit %errorlevel%" | Out-File -Encoding "ASCII" -Append task.bat
|
||||
$here = (Get-Item -Path "." -Verbose).FullName
|
||||
$runner = 'c:\build-cache\php-sdk-' + $env:BIN_SDK_VER + '\phpsdk' + '-' + $env:VC + '-' + $env:ARCH + '.bat'
|
||||
$task = $here + '\task.bat'
|
||||
& $runner -t $task
|
||||
|
||||
after_build:
|
||||
ps: |
|
||||
$ts_part = 'ts'
|
||||
if ('0' -eq $env:TS) { $ts_part = 'nts' }
|
||||
$zip_bname = 'php_xlswriter-' + $env:APPVEYOR_REPO_COMMIT.substring(0, 8) + '-' + $env:PHP_VER.substring(0, 3) + '-' + $ts_part + '-' + $env:VC + '-' + $env:ARCH + '.zip'
|
||||
$dir = 'c:\projects\xlswriter\';
|
||||
if ('x64' -eq $env:ARCH) { $dir = $dir + 'x64\' }
|
||||
$dir = $dir + 'Release'
|
||||
if ('1' -eq $env:TS) { $dir = $dir + '_TS' }
|
||||
& 7z a c:\$zip_bname $dir\php_xlswriter.dll c:\projects\xlswriter\LICENSE
|
||||
Push-AppveyorArtifact c:\$zip_bname
|
||||
|
||||
test_script:
|
||||
ps: |
|
||||
$ts_part = ''
|
||||
if ('0' -eq $env:TS) { $ts_part = '-nts' }
|
||||
$bname = 'php-' + $env:PHP_VER + $ts_part + '-Win32-' + $env:VC.toUpper() + '-' + $env:ARCH + '.zip'
|
||||
if (-not (Test-Path c:\build-cache\$bname)) {
|
||||
Invoke-WebRequest "http://windows.php.net/downloads/releases/archives/$bname" -OutFile "c:\build-cache\$bname"
|
||||
if (-not (Test-Path c:\build-cache\$bname)) {
|
||||
Invoke-WebRequest "http://windows.php.net/downloads/releases/$bname" -OutFile "c:\build-cache\$bname"
|
||||
}
|
||||
}
|
||||
$dname = 'php-' + $env:PHP_VER + $ts_part + '-' + $env:VC.toUpper() + '-' + $env:ARCH
|
||||
if (-not (Test-Path c:\build-cache\$dname)) {
|
||||
7z x c:\build-cache\$bname -oc:\build-cache\$dname
|
||||
}
|
||||
cd c:\projects\xlswriter
|
||||
echo "" | Out-File -Encoding "ASCII" task.bat
|
||||
echo "set REPORT_EXIT_STATUS=1" | Out-File -Encoding "ASCII" -Append task.bat
|
||||
$cmd = 'call configure --with-xlswriter --with-xlswriter --with-extra-libs=c:\build-cache\zlib\zlib-1.2.11\Release --with-extra-includes=c:\build-cache\zlib\zlib-1.2.11 --with-prefix=c:\build-cache\' + $dname + ' 2>&1'
|
||||
echo $cmd | Out-File -Encoding "ASCII" -Append task.bat
|
||||
echo 'nmake /nologo test TESTS="-q --show-diff --set-timeout 120" 2>&1' | Out-File -Encoding "ASCII" -Append task.bat
|
||||
echo "exit %errorlevel%" | Out-File -Encoding "ASCII" -Append task.bat
|
||||
$here = (Get-Item -Path "." -Verbose).FullName
|
||||
$runner = 'c:\build-cache\php-sdk-' + $env:BIN_SDK_VER + '\phpsdk' + '-' + $env:VC + '-' + $env:ARCH + '.bat'
|
||||
$task = $here + '\task.bat'
|
||||
& $runner -t $task
|
|
@ -0,0 +1,28 @@
|
|||
// vim:ft=javascript
|
||||
|
||||
ARG_WITH("xlswriter", "xlswriter support", "no");
|
||||
|
||||
if (PHP_XLSWRITER != "no") {
|
||||
|
||||
MESSAGE("Include Path:" + configure_module_dirname + "\\include");
|
||||
|
||||
if (CHECK_LIB("zlib_a.lib;zlib.lib", "zlib", PHP_XLSWRITER) &&
|
||||
CHECK_HEADER_ADD_INCLUDE("zlib.h", "CFLAGS_XLSWRITER", "..\\zlib;" + php_usual_include_suspects) &&
|
||||
CHECK_HEADER_ADD_INCLUDE("xlsxwriter.h", "CFLAGS_XLSWRITER", PHP_XLSWRITER + ";" + configure_module_dirname + "\\library\\include") &&
|
||||
CHECK_HEADER_ADD_INCLUDE("packager.h", "CFLAGS_XLSWRITER", PHP_XLSWRITER + ";" + configure_module_dirname + "\\library\\include\\xlsxwriter") &&
|
||||
CHECK_HEADER_ADD_INCLUDE("zip.h", "CFLAGS_XLSWRITER", PHP_XLSWRITER + ";" + configure_module_dirname + "\\library\\include\\xlsxwriter\\third_party")) {
|
||||
|
||||
EXTENSION("xlswriter", "xls_writer.c");
|
||||
|
||||
ADD_SOURCES(configure_module_dirname + "\\library\\third_party\\minizip", "ioapi.c iowin32.c mztools.c unzip.c zip.c", "xlswriter");
|
||||
ADD_SOURCES(configure_module_dirname + "\\library\\third_party\\tmpfileplus", "tmpfileplus.c", "xlswriter");
|
||||
ADD_SOURCES(configure_module_dirname + "\\library\\src", "app.c chart.c content_types.c core.c custom.c drawing.c format.c hash_table.c packager.c relationships.c shared_strings.c styles.c theme.c utility.c workbook.c worksheet.c xmlwriter.c", "xlswriter");
|
||||
ADD_SOURCES(configure_module_dirname + "\\kernel", "common.c resource.c exception.c excel.c write.c format.c", "xlswriter");
|
||||
|
||||
ADD_FLAG("CFLAGS_XLSWRITER", ' /I "' + configure_module_dirname + '" ');
|
||||
|
||||
} else {
|
||||
WARNING("xlswriter not enabled, headers not found");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,233 @@
|
|||
PHP_ARG_WITH(xlswriter, xlswriter support,
|
||||
[ --with-xlswriter Include xlswriter support], yes)
|
||||
|
||||
PHP_ARG_WITH(libxlsxwriter, system libxlsxwriter,
|
||||
[ --with-libxlsxwriter=DIR Use system libxlsxwriter], no, no)
|
||||
|
||||
PHP_ARG_WITH(libxlsxio, system libxlsxio,
|
||||
[ --with-libxlsxio=DIR Use system libxlsxio], no, no)
|
||||
|
||||
PHP_ARG_WITH(openssl, openssl MD5,
|
||||
[ --with-openssl=DIR Use openssl MD5], no, no)
|
||||
|
||||
PHP_ARG_ENABLE(reader, enable xlsx reader support,
|
||||
[ --enable-reader Enable xlsx reader?], yes, yes)
|
||||
|
||||
if test "$PHP_XLSWRITER" != "no"; then
|
||||
xls_writer_sources="
|
||||
xlswriter.c \
|
||||
kernel/chart.c \
|
||||
kernel/common.c \
|
||||
kernel/excel.c \
|
||||
kernel/exception.c \
|
||||
kernel/format.c \
|
||||
kernel/help.c \
|
||||
kernel/resource.c \
|
||||
kernel/rich_string.c \
|
||||
kernel/validation.c \
|
||||
kernel/write.c \
|
||||
"
|
||||
|
||||
xls_read_sources="
|
||||
kernel/read.c \
|
||||
kernel/csv.c \
|
||||
"
|
||||
|
||||
minizip_sources="
|
||||
library/libxlsxwriter/third_party/minizip/ioapi.c \
|
||||
library/libxlsxwriter/third_party/minizip/mztools.c \
|
||||
library/libxlsxwriter/third_party/minizip/unzip.c \
|
||||
library/libxlsxwriter/third_party/minizip/zip.c \
|
||||
"
|
||||
|
||||
md5_sources="
|
||||
library/libxlsxwriter/third_party/md5/md5.c \
|
||||
"
|
||||
|
||||
libxlsxwriter_sources="
|
||||
library/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c \
|
||||
library/libxlsxwriter/src/app.c \
|
||||
library/libxlsxwriter/src/chart.c \
|
||||
library/libxlsxwriter/src/chartsheet.c \
|
||||
library/libxlsxwriter/src/comment.c \
|
||||
library/libxlsxwriter/src/content_types.c \
|
||||
library/libxlsxwriter/src/core.c \
|
||||
library/libxlsxwriter/src/custom.c \
|
||||
library/libxlsxwriter/src/drawing.c \
|
||||
library/libxlsxwriter/src/format.c \
|
||||
library/libxlsxwriter/src/hash_table.c \
|
||||
library/libxlsxwriter/src/metadata.c \
|
||||
library/libxlsxwriter/src/packager.c \
|
||||
library/libxlsxwriter/src/relationships.c \
|
||||
library/libxlsxwriter/src/shared_strings.c \
|
||||
library/libxlsxwriter/src/styles.c \
|
||||
library/libxlsxwriter/src/theme.c \
|
||||
library/libxlsxwriter/src/utility.c \
|
||||
library/libxlsxwriter/src/vml.c \
|
||||
library/libxlsxwriter/src/workbook.c \
|
||||
library/libxlsxwriter/src/worksheet.c \
|
||||
library/libxlsxwriter/src/xmlwriter.c \
|
||||
"
|
||||
|
||||
libexpat="
|
||||
library/libexpat/expat/lib/loadlibrary.c \
|
||||
library/libexpat/expat/lib/xmlparse.c \
|
||||
library/libexpat/expat/lib/xmlrole.c \
|
||||
library/libexpat/expat/lib/xmltok.c \
|
||||
library/libexpat/expat/lib/xmltok_impl.c \
|
||||
library/libexpat/expat/lib/xmltok_ns.c \
|
||||
"
|
||||
|
||||
libxlsxio="
|
||||
library/libxlsxio/lib/xlsxio_read.c \
|
||||
library/libxlsxio/lib/xlsxio_read_sharedstrings.c \
|
||||
"
|
||||
|
||||
AC_MSG_CHECKING([Check libxlsxwriter library])
|
||||
|
||||
if test "$PHP_OPENSSL" != "no"; then
|
||||
AC_MSG_RESULT([use the openssl md5 library])
|
||||
for i in $PHP_OPENSSL /usr/local /usr /usr/local/opt; do
|
||||
if test -r $i/include/openssl/md5.h; then
|
||||
OPENSSL_DIR=$i
|
||||
AC_MSG_RESULT([found in $i])
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if test -z "$OPENSSL_DIR"; then
|
||||
PHP_SETUP_OPENSSL(XLSWRITER_SHARED_LIBADD,
|
||||
[
|
||||
AC_DEFINE(USE_OPENSSL_MD5, 1, [ use openssl md5 ])
|
||||
], [
|
||||
AC_MSG_ERROR([openssl library not found])
|
||||
])
|
||||
else
|
||||
PHP_ADD_INCLUDE($OPENSSL_DIR/include)
|
||||
|
||||
PHP_CHECK_LIBRARY(crypto, MD5_Init,
|
||||
[
|
||||
PHP_ADD_LIBRARY_WITH_PATH(crypto, $OPENSSL_DIR/lib, XLSWRITER_SHARED_LIBADD)
|
||||
],[
|
||||
AC_MSG_ERROR([Wrong openssl MD5_Init not found])
|
||||
],[
|
||||
-L$OPENSSL_DIR/lib -lcrypto
|
||||
])
|
||||
|
||||
AC_DEFINE(USE_OPENSSL_MD5, 1, [ use openssl md5 ])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([use the bundled md5 library])
|
||||
xls_writer_sources="$xls_writer_sources $md5_sources"
|
||||
fi
|
||||
|
||||
if test "$PHP_LIBXLSXWRITER" != "no"; then
|
||||
for i in $PHP_LIBXLSXWRITER /usr/local /usr /usr/local/opt; do
|
||||
if test -r $i/include/xlsxwriter.h; then
|
||||
XLSXWRITER_DIR=$i
|
||||
AC_MSG_RESULT([found in $i])
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if test -z "$XLSXWRITER_DIR"; then
|
||||
AC_MSG_ERROR([libxlsxwriter library not found])
|
||||
else
|
||||
PHP_ADD_INCLUDE($XLSXWRITER_DIR/include)
|
||||
PHP_CHECK_LIBRARY(xlsxwriter, lxw_worksheet_find_cell_in_row,
|
||||
[
|
||||
PHP_ADD_LIBRARY_WITH_PATH(xlsxwriter, $i/$PHP_LIBDIR, XLSWRITER_SHARED_LIBADD)
|
||||
],[
|
||||
AC_MSG_ERROR([Wrong libxlsxwriter version or library not found, 0.9.3 required])
|
||||
],[
|
||||
-L$XLSXWRITER_DIR/$PHP_LIBDIR -lm
|
||||
])
|
||||
PHP_CHECK_LIBRARY(xlsxwriter, lxw_fopen,
|
||||
[
|
||||
AC_DEFINE(HAVE_LXW_OPEN, 1, [ lxw_fopen available in 0.8.8 ])
|
||||
],[
|
||||
],[
|
||||
-L$XLSXWRITER_DIR/$PHP_LIBDIR -lm
|
||||
])
|
||||
fi
|
||||
|
||||
AC_DEFINE(HAVE_LIBXLSXWRITER, 1, [ use system libxlsxwriter ])
|
||||
else
|
||||
AC_MSG_RESULT([use the bundled library])
|
||||
xls_writer_sources="$xls_writer_sources $libxlsxwriter_sources"
|
||||
PHP_ADD_INCLUDE([PHP_EXT_SRCDIR/library/libxlsxwriter/include])
|
||||
|
||||
dnl see library/CMakeLists.txt
|
||||
LIBOPT="$LIBOPT -DNOCRYPT -DNOUNCRYPT"
|
||||
fi
|
||||
|
||||
if test "$PHP_READER" = "yes"; then
|
||||
AC_MSG_CHECKING([Check libxlsxwriter library])
|
||||
if test "$PHP_LIBXLSXIO" != "no"; then
|
||||
|
||||
for i in $PHP_LIBXLSXIO /usr/local /usr; do
|
||||
if test -r $i/include/xlsxio_read.h; then
|
||||
XLSXIO_DIR=$i
|
||||
AC_MSG_RESULT([found in $i])
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if test -z "$XLSXIO_DIR"; then
|
||||
AC_MSG_ERROR([libxlsxio library not found])
|
||||
else
|
||||
PHP_ADD_INCLUDE($XLSXIO_DIR/include)
|
||||
PHP_CHECK_LIBRARY(xlsxio_read, xlsxioread_sheet_open,
|
||||
[
|
||||
PHP_ADD_LIBRARY_WITH_PATH(xlsxio_read, $i/$PHP_LIBDIR, XLSWRITER_SHARED_LIBADD)
|
||||
],[
|
||||
AC_MSG_ERROR([Wrong libxlsxio version or library not found])
|
||||
],[
|
||||
-L$XLSXWRITER_DIR/$PHP_LIBDIR -lm
|
||||
])
|
||||
fi
|
||||
|
||||
AC_DEFINE(HAVE_LIBXLSXIO, 1, [ use system libxlsxwriter ])
|
||||
else
|
||||
AC_MSG_RESULT([use the bundled library])
|
||||
|
||||
xls_writer_sources="$xls_writer_sources $libexpat"
|
||||
PHP_ADD_INCLUDE([PHP_EXT_SRCDIR/library/libexpat/expat/lib])
|
||||
PHP_ADD_BUILD_DIR([PHP_EXT_BUILDDIR/library/libexpat/expat/lib])
|
||||
LIBOPT="$LIBOPT -DXML_POOR_ENTROPY"
|
||||
|
||||
xls_writer_sources="$xls_writer_sources $libxlsxio"
|
||||
PHP_ADD_INCLUDE([PHP_EXT_SRCDIR/library/libxlsxio/include])
|
||||
PHP_ADD_BUILD_DIR([PHP_EXT_BUILDDIR/library/libxlsxio/lib])
|
||||
LIBOPT="$LIBOPT -DUSE_MINIZIP"
|
||||
|
||||
fi
|
||||
|
||||
xls_writer_sources="$xls_writer_sources $xls_read_sources"
|
||||
AC_DEFINE(ENABLE_READER, 1, [enable reader])
|
||||
fi
|
||||
|
||||
if test "$PHP_LIBXLSXIO" = "no" || test "$PHP_LIBXLSXWRITER" = "no"; then
|
||||
xls_writer_sources="$xls_writer_sources $minizip_sources"
|
||||
fi
|
||||
|
||||
if test -z "$PHP_DEBUG"; then
|
||||
AC_ARG_ENABLE(debug, [--enable-debug compile with debugging system], [PHP_DEBUG=$enableval],[PHP_DEBUG=no])
|
||||
fi
|
||||
|
||||
PHP_SUBST(XLSWRITER_SHARED_LIBADD)
|
||||
|
||||
PHP_NEW_EXTENSION(xlswriter, $xls_writer_sources, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 $LIBOPT)
|
||||
|
||||
PHP_ADD_INCLUDE([PHP_EXT_SRCDIR])
|
||||
PHP_ADD_INCLUDE([PHP_EXT_SRCDIR/include])
|
||||
|
||||
PHP_ADD_BUILD_DIR([PHP_EXT_BUILDDIR/kernel])
|
||||
PHP_ADD_BUILD_DIR([PHP_EXT_BUILDDIR/library/libxlsxwriter/src])
|
||||
PHP_ADD_BUILD_DIR([PHP_EXT_BUILDDIR/library/libxlsxwriter/third_party/minizip])
|
||||
PHP_ADD_BUILD_DIR([PHP_EXT_BUILDDIR/library/libxlsxwriter/third_party/tmpfileplus])
|
||||
PHP_ADD_BUILD_DIR([PHP_EXT_BUILDDIR/library/libxlsxwriter/third_party/md5])
|
||||
|
||||
PHP_ADD_BUILD_DIR([PHP_EXT_BUILDDIR/library/libexpat/expat/lib])
|
||||
PHP_ADD_BUILD_DIR([PHP_EXT_BUILDDIR/library/libxlsxio/lib])
|
||||
fi
|
|
@ -0,0 +1,91 @@
|
|||
// vim:ft=javascript
|
||||
|
||||
ARG_WITH("xlswriter", "xlswriter support", "no");
|
||||
|
||||
if (PHP_XLSWRITER != "no") {
|
||||
|
||||
if (
|
||||
CHECK_HEADER_ADD_INCLUDE("minizip/zip.h", "CFLAGS_XLSWRITER", configure_module_dirname + "\\library\\libxlsxwriter\\third_party;" + PHP_EXTRA_INCLUDES) &&
|
||||
CHECK_HEADER_ADD_INCLUDE("xlsxwriter.h", "CFLAGS_XLSWRITER", configure_module_dirname + "\\library\\libxlsxwriter\\include;" + PHP_EXTRA_INCLUDES) &&
|
||||
CHECK_HEADER_ADD_INCLUDE("expat.h", "CFLAGS_XLSWRITER", configure_module_dirname + "\\library\\libexpat\\expat\\lib;" + PHP_EXTRA_INCLUDES) &&
|
||||
CHECK_HEADER_ADD_INCLUDE("xlsxio_read.h", "CFLAGS_XLSWRITER", configure_module_dirname + "\\library\\libxlsxio\\include;" + PHP_EXTRA_INCLUDES) &&
|
||||
CHECK_HEADER_ADD_INCLUDE("xlswriter.h", "CFLAGS_XLSWRITER", configure_module_dirname + "\\include;" + PHP_EXTRA_INCLUDES)
|
||||
) {
|
||||
EXTENSION("xlswriter", "xlswriter.c")
|
||||
|
||||
ADD_FLAG("CFLAGS_XLSWRITER", ' /D ENABLE_READER /D USE_SYSTEM_MINIZIP /D USE_MINIZIP /I "' + configure_module_dirname + '" ');
|
||||
|
||||
AC_DEFINE("HAVE_LXW_VERSION", 1, "lxw_version available in 0.7.7");
|
||||
|
||||
ADD_SOURCES(configure_module_dirname + "\\kernel", "\
|
||||
chart.c \
|
||||
common.c \
|
||||
csv.c \
|
||||
excel.c \
|
||||
exception.c \
|
||||
format.c \
|
||||
help.c \
|
||||
read.c \
|
||||
resource.c \
|
||||
rich_string.c \
|
||||
validation.c \
|
||||
write.c \
|
||||
", "xlswriter");
|
||||
|
||||
ADD_SOURCES(configure_module_dirname + "\\library\\libxlsxwriter\\third_party\\minizip", "\
|
||||
ioapi.c \
|
||||
iowin32.c \
|
||||
mztools.c \
|
||||
unzip.c \
|
||||
zip.c \
|
||||
", "xlswriter", "libxlsxwriter");
|
||||
|
||||
ADD_SOURCES(configure_module_dirname + "\\library\\libxlsxwriter\\third_party\\tmpfileplus", "\
|
||||
tmpfileplus.c \
|
||||
", "xlswriter", "libxlsxwriter");
|
||||
|
||||
ADD_SOURCES(configure_module_dirname + "\\library\\libxlsxwriter\\third_party\\md5", "\
|
||||
md5.c \
|
||||
", "xlswriter", "libxlsxwriter");
|
||||
|
||||
ADD_SOURCES(configure_module_dirname + "\\library\\libxlsxwriter\\src", "\
|
||||
app.c \
|
||||
chart.c \
|
||||
chartsheet.c \
|
||||
comment.c \
|
||||
content_types.c \
|
||||
core.c \
|
||||
custom.c \
|
||||
drawing.c \
|
||||
format.c \
|
||||
hash_table.c \
|
||||
metadata.c \
|
||||
packager.c \
|
||||
relationships.c \
|
||||
shared_strings.c \
|
||||
styles.c \
|
||||
theme.c \
|
||||
utility.c \
|
||||
vml.c \
|
||||
workbook.c \
|
||||
worksheet.c \
|
||||
xmlwriter.c \
|
||||
", "xlswriter", "libxlsxwriter");
|
||||
|
||||
ADD_SOURCES(configure_module_dirname + "\\library\\libexpat\\expat\\lib", "\
|
||||
loadlibrary.c \
|
||||
xmlparse.c \
|
||||
xmlrole.c \
|
||||
xmltok.c \
|
||||
xmltok_impl.c \
|
||||
xmltok_ns.c \
|
||||
", "xlswriter", "libexpat");
|
||||
|
||||
ADD_SOURCES(configure_module_dirname + "\\library\\libxlsxio\\lib", "\
|
||||
xlsxio_read.c \
|
||||
xlsxio_read_sharedstrings.c \
|
||||
", "xlswriter", "libxlsxio");
|
||||
} else {
|
||||
WARNING("xlswriter not enabled, xlsxwriter.lib or headers not found");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
$config = ['path' => './tests/'];
|
||||
$excel = new \Vtiful\Kernel\Excel($config);
|
||||
$fileFd = $excel->fileName('tutorial01.xlsx');
|
||||
var_dump($fileFd);
|
||||
$setHeader = $fileFd->header(['Item', 'Cost']);
|
||||
var_dump($setHeader);
|
||||
$setData = $setHeader->data([
|
||||
['Rent', 1000],
|
||||
['Gas', 100],
|
||||
['Food', 300],
|
||||
['Gym', 50],
|
||||
|
||||
]);
|
||||
var_dump($setData);
|
||||
$output = $setData->output();
|
||||
var_dump($output);
|
||||
?>
|
||||
|
|
@ -0,0 +1,723 @@
|
|||
<?php
|
||||
|
||||
namespace Vtiful\Kernel;
|
||||
|
||||
/**
|
||||
* Class Excel
|
||||
*
|
||||
* @author viest
|
||||
*
|
||||
* @package Vtiful\Kernel
|
||||
*/
|
||||
class Excel
|
||||
{
|
||||
const TYPE_STRING = 0x01;
|
||||
const TYPE_INT = 0x02;
|
||||
const TYPE_DOUBLE = 0x04;
|
||||
const TYPE_TIMESTAMP = 0x08;
|
||||
|
||||
const SKIP_NONE = 0x00;
|
||||
const SKIP_EMPTY_ROW = 0x01;
|
||||
const SKIP_EMPTY_CELLS = 0x02;
|
||||
|
||||
const GRIDLINES_HIDE_ALL = 0;
|
||||
const GRIDLINES_SHOW_SCREEN = 1;
|
||||
const GRIDLINES_SHOW_PRINT = 2;
|
||||
const GRIDLINES_SHOW_ALL = 3;
|
||||
|
||||
/**
|
||||
* Excel constructor.
|
||||
*
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct(array $config)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* File Name
|
||||
*
|
||||
* @param string $fileName
|
||||
* @param string $sheetName
|
||||
*
|
||||
* @return Excel
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function fileName(string $fileName, string $sheetName = 'Sheet1'): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Const memory model
|
||||
*
|
||||
* @param string $fileName
|
||||
* @param string $sheetName
|
||||
*
|
||||
* @return Excel
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function constMemory(string $fileName, string $sheetName = 'Sheet1'): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new worksheet to a workbook.
|
||||
*
|
||||
* The worksheet name must be a valid Excel worksheet name, i.e. it must be
|
||||
* less than 32 character and it cannot contain any of the characters:
|
||||
*
|
||||
* / \ [ ] : * ?
|
||||
*
|
||||
* In addition, you cannot use the same, case insensitive, `$sheetName` for more
|
||||
* than one worksheet.
|
||||
*
|
||||
* @param string|NULL $sheetName
|
||||
*
|
||||
* @return Excel
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function addSheet(?string $sheetName): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checkout worksheet
|
||||
*
|
||||
* @param string $sheetName
|
||||
*
|
||||
* @return Excel
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function checkoutSheet(string $sheetName): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert data on the first line of the worksheet
|
||||
*
|
||||
* @param array $header
|
||||
*
|
||||
* @return Excel
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function header(array $header): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert data on the worksheet
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return Excel
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function data(array $data): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate file
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function output(): string
|
||||
{
|
||||
return 'FilePath';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get file resource
|
||||
*
|
||||
* @return resource
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function getHandle()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Auto filter on the worksheet
|
||||
*
|
||||
* @param string $range
|
||||
*
|
||||
* @return Excel
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function autoFilter(string $range): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert data on the cell
|
||||
*
|
||||
* @param int $row
|
||||
* @param int $column
|
||||
* @param int|string|double $data
|
||||
* @param string|null $format
|
||||
* @param resource|null $formatHandle
|
||||
*
|
||||
* @return Excel
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function insertText(int $row, int $column, $data, string $format = NULL, $formatHandle = NULL): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert date on the cell
|
||||
*
|
||||
* @param int $row
|
||||
* @param int $column
|
||||
* @param int $timestamp
|
||||
* @param string|NULL $format
|
||||
* @param resource|null $formatHandle
|
||||
*
|
||||
* @return Excel
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function insertDate(int $row, int $column, int $timestamp, string $format = NULL, $formatHandle = NULL): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert chart on the cell
|
||||
*
|
||||
* @param int $row
|
||||
* @param int $column
|
||||
* @param resource $chartResource
|
||||
*
|
||||
* @return Excel
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function insertChart(int $row, int $column, $chartResource): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert url on the cell
|
||||
*
|
||||
* @param int $row
|
||||
* @param int $column
|
||||
* @param string $url
|
||||
* @param resource|null $formatHandle
|
||||
*
|
||||
* @return Excel
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function insertUrl(int $row, int $column, string $url, $formatHandle = NULL): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert image on the cell
|
||||
*
|
||||
* @param int $row
|
||||
* @param int $column
|
||||
* @param string $imagePath
|
||||
* @param float $width
|
||||
* @param float $height
|
||||
*
|
||||
* @return Excel
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function insertImage(int $row, int $column, string $imagePath, float $width = 1, float $height = 1): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert Formula on the cell
|
||||
*
|
||||
* @param int $row
|
||||
* @param int $column
|
||||
* @param string $formula
|
||||
*
|
||||
* @return Excel
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function insertFormula(int $row, int $column, string $formula): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge cells
|
||||
*
|
||||
* @param string $range
|
||||
* @param string $data
|
||||
*
|
||||
* @return Excel
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function MergeCells(string $range, string $data): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column cells width or format
|
||||
*
|
||||
* @param string $range
|
||||
* @param float $cellWidth
|
||||
* @param resource|null $formatHandle
|
||||
*
|
||||
* @return Excel
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function setColumn(string $range, float $cellWidth, $formatHandle = NULL): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set row cells height or format
|
||||
*
|
||||
* @param string $range
|
||||
* @param float $cellHeight
|
||||
* @param resource|null $formatHandle
|
||||
*
|
||||
* @return Excel
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function setRow(string $range, float $cellHeight, $formatHandle = NULL): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open xlsx file
|
||||
*
|
||||
* @param string $fileName
|
||||
*
|
||||
* @return Excel
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function openFile(string $fileName): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open sheet
|
||||
*
|
||||
* default open first sheet
|
||||
*
|
||||
* @param string|NULL $sheetName
|
||||
* @param int skipFlag
|
||||
*
|
||||
* @return Excel
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function openSheet(string $sheetName = NULL, int $skipFlag = 0x00): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set row cell data type
|
||||
*
|
||||
* @param array $types
|
||||
*
|
||||
* @return Excel
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function setType(array $types): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read values from the sheet
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function getSheetData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Read values from the sheet
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function nextRow(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Next Cell In Callback
|
||||
*
|
||||
* @param callable $callback function(int $row, int $cell, string $data)
|
||||
* @param string|NULL $sheetName sheet name
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function nextCellCallback(callable $callback, string $sheetName = NULL): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Freeze panes
|
||||
*
|
||||
* freezePanes(1, 0); // Freeze the first row.
|
||||
* freezePanes(0, 1); // Freeze the first column.
|
||||
* freezePanes(1, 1); // Freeze first row/column.
|
||||
*
|
||||
* @param int $row
|
||||
* @param int $column
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function freezePanes(int $row, int $column): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gridline
|
||||
*
|
||||
* Display or hide screen and print gridlines using one of the values of
|
||||
*
|
||||
* \Vtiful\Kernel\Excel::GRIDLINES_HIDE_ALL
|
||||
* \Vtiful\Kernel\Excel::GRIDLINES_SHOW_ALL
|
||||
* \Vtiful\Kernel\Excel::GRIDLINES_SHOW_PRINT
|
||||
* \Vtiful\Kernel\Excel::GRIDLINES_SHOW_SCREEN
|
||||
*
|
||||
* Excel default is that the screen gridlines are on and the printed worksheet is off.
|
||||
*
|
||||
* @param int $option
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function gridline(int $option): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Worksheet zoom
|
||||
*
|
||||
* Set the worksheet zoom factor in the range 10 <= zoom <= 400:
|
||||
*
|
||||
* @param int $scale
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function zoom(int $scale): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Format
|
||||
*
|
||||
* @author viest
|
||||
*
|
||||
* @package Vtiful\Kernel
|
||||
*/
|
||||
class Format
|
||||
{
|
||||
const UNDERLINE_SINGLE = 0x00;
|
||||
const UNDERLINE_DOUBLE = 0x00;
|
||||
const UNDERLINE_SINGLE_ACCOUNTING = 0x00;
|
||||
const UNDERLINE_DOUBLE_ACCOUNTING = 0x00;
|
||||
|
||||
const FORMAT_ALIGN_LEFT = 0x00;
|
||||
const FORMAT_ALIGN_CENTER = 0x00;
|
||||
const FORMAT_ALIGN_RIGHT = 0x00;
|
||||
const FORMAT_ALIGN_FILL = 0x00;
|
||||
const FORMAT_ALIGN_JUSTIFY = 0x00;
|
||||
const FORMAT_ALIGN_CENTER_ACROSS = 0x00;
|
||||
const FORMAT_ALIGN_DISTRIBUTED = 0x00;
|
||||
const FORMAT_ALIGN_VERTICAL_TOP = 0x00;
|
||||
const FORMAT_ALIGN_VERTICAL_BOTTOM = 0x00;
|
||||
const FORMAT_ALIGN_VERTICAL_CENTER = 0x00;
|
||||
const FORMAT_ALIGN_VERTICAL_JUSTIFY = 0x00;
|
||||
const FORMAT_ALIGN_VERTICAL_DISTRIBUTED = 0x00;
|
||||
|
||||
const COLOR_BLACK = 0x00;
|
||||
const COLOR_BLUE = 0x00;
|
||||
const COLOR_BROWN = 0x00;
|
||||
const COLOR_CYAN = 0x00;
|
||||
const COLOR_GRAY = 0x00;
|
||||
const COLOR_GREEN = 0x00;
|
||||
const COLOR_LIME = 0x00;
|
||||
const COLOR_MAGENTA = 0x00;
|
||||
const COLOR_NAVY = 0x00;
|
||||
const COLOR_ORANGE = 0x00;
|
||||
const COLOR_PINK = 0x00;
|
||||
const COLOR_PURPLE = 0x00;
|
||||
const COLOR_RED = 0x00;
|
||||
const COLOR_SILVER = 0x00;
|
||||
const COLOR_WHITE = 0x00;
|
||||
const COLOR_YELLOW = 0x00;
|
||||
|
||||
const PATTERN_NONE = 0x00;
|
||||
const PATTERN_SOLID = 0x00;
|
||||
const PATTERN_MEDIUM_GRAY = 0x00;
|
||||
const PATTERN_DARK_GRAY = 0x00;
|
||||
const PATTERN_LIGHT_GRAY = 0x00;
|
||||
const PATTERN_DARK_HORIZONTAL = 0x00;
|
||||
const PATTERN_DARK_VERTICAL = 0x00;
|
||||
const PATTERN_DARK_DOWN = 0x00;
|
||||
const PATTERN_DARK_UP = 0x00;
|
||||
const PATTERN_DARK_GRID = 0x00;
|
||||
const PATTERN_DARK_TRELLIS = 0x00;
|
||||
const PATTERN_LIGHT_HORIZONTAL = 0x00;
|
||||
const PATTERN_LIGHT_VERTICAL = 0x00;
|
||||
const PATTERN_LIGHT_DOWN = 0x00;
|
||||
const PATTERN_LIGHT_UP = 0x00;
|
||||
const PATTERN_LIGHT_GRID = 0x00;
|
||||
const PATTERN_LIGHT_TRELLIS = 0x00;
|
||||
const PATTERN_GRAY_125 = 0x00;
|
||||
const PATTERN_GRAY_0625 = 0x00;
|
||||
|
||||
const BORDER_THIN = 0x00;
|
||||
const BORDER_MEDIUM = 0x00;
|
||||
const BORDER_DASHED = 0x00;
|
||||
const BORDER_DOTTED = 0x00;
|
||||
const BORDER_THICK = 0x00;
|
||||
const BORDER_DOUBLE = 0x00;
|
||||
const BORDER_HAIR = 0x00;
|
||||
const BORDER_MEDIUM_DASHED = 0x00;
|
||||
const BORDER_DASH_DOT = 0x00;
|
||||
const BORDER_MEDIUM_DASH_DOT = 0x00;
|
||||
const BORDER_DASH_DOT_DOT = 0x00;
|
||||
const BORDER_MEDIUM_DASH_DOT_DOT = 0x00;
|
||||
const BORDER_SLANT_DASH_DOT = 0x00;
|
||||
|
||||
/**
|
||||
* Format constructor.
|
||||
*
|
||||
* @param resource $fileHandle
|
||||
*/
|
||||
public function __construct($fileHandle)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap
|
||||
*
|
||||
* @return Format
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function wrap(): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bold
|
||||
*
|
||||
* @return Format
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function bold(): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Italic
|
||||
*
|
||||
* @return Format
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function italic(): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cells border
|
||||
*
|
||||
* @param int $style const BORDER_***
|
||||
*
|
||||
* @return Format
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function border(int $style): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Align
|
||||
*
|
||||
* @param int ...$style const FORMAT_ALIGN_****
|
||||
*
|
||||
* @return Format
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function align(...$style): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number format
|
||||
*
|
||||
* @param string $format
|
||||
*
|
||||
* #,##0
|
||||
*
|
||||
* @return Format
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function number(string $format): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Font color
|
||||
*
|
||||
* @param int $color const COLOR_****
|
||||
*
|
||||
* @return Format
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function fontColor(int $color): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Font
|
||||
*
|
||||
* @param string $fontName
|
||||
*
|
||||
* @return Format
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function font(string $fontName): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Font size
|
||||
*
|
||||
* @param float $size
|
||||
*
|
||||
* @return Format
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function fontSize(float $size): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* String strikeout
|
||||
*
|
||||
* @return Format
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function strikeout(): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Underline
|
||||
*
|
||||
* @param int $style const UNDERLINE_****
|
||||
*
|
||||
* @return Format
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function underline(int $style): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cell background
|
||||
*
|
||||
* @param int $color const COLOR_****
|
||||
* @param int $pattern const PATTERN_****
|
||||
*
|
||||
* @return Format
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function background(int $color, int $pattern = self::PATTERN_SOLID): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format to resource
|
||||
*
|
||||
* @return resource
|
||||
*
|
||||
* @author viest
|
||||
*/
|
||||
public function toResource()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef PHP_EXT_EXCEL_EXPORT_CHART_H
|
||||
#define PHP_EXT_EXCEL_EXPORT_CHART_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
extern zend_class_entry *vtiful_chart_ce;
|
||||
|
||||
VTIFUL_STARTUP_FUNCTION(chart);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef PHP_EXT_XLS_WRITER_COMMON_H
|
||||
#define PHP_EXT_XLS_WRITER_COMMON_H
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
# define PHP_VTIFUL_API __declspec(dllexport)
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define PHP_VTIFUL_API __attribute__ ((visibility("default")))
|
||||
#else
|
||||
# define PHP_VTIFUL_API
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
#include "TSRM.h"
|
||||
#endif
|
||||
|
||||
#if PHP_VERSION_ID >= 80000
|
||||
#define TSRMLS_D void
|
||||
#define TSRMLS_DC
|
||||
#define TSRMLS_C
|
||||
#define TSRMLS_CC
|
||||
#endif
|
||||
|
||||
#define VTIFUL_RESOURCE_NAME "xlsx"
|
||||
|
||||
#define VTIFUL_STARTUP_MODULE(module) ZEND_MODULE_STARTUP_N(xlsxwriter_##module)(INIT_FUNC_ARGS_PASSTHRU)
|
||||
#define VTIFUL_STARTUP_FUNCTION(module) ZEND_MINIT_FUNCTION(xlsxwriter_##module)
|
||||
|
||||
#if defined(ZTS) && defined(COMPILE_DL_VTIFUL)
|
||||
ZEND_TSRMLS_CACHE_EXTERN();
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef PHP_EXT_XLS_WRITER_CSV_H
|
||||
#define PHP_EXT_XLS_WRITER_CSV_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
unsigned int xlsx_to_csv(
|
||||
zval *stream_resource,
|
||||
const char *delimiter_str, int delimiter_str_len,
|
||||
const char *enclosure_str, int enclosure_str_len,
|
||||
const char *escape_str, int escape_str_len,
|
||||
xlsxioreadersheet sheet_t,
|
||||
zval *zv_type_arr_t, zend_long data_type_default,
|
||||
unsigned int flag, zend_fcall_info *fci, zend_fcall_info_cache *fci_cache
|
||||
);
|
||||
|
||||
#endif // PHP_EXT_XLS_WRITER_CSV_H
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef VTIFUL_XLS_H
|
||||
#define VTIFUL_XLS_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define V_XLS_HANDLE "handle"
|
||||
#define V_XLS_FIL "fileName"
|
||||
#define V_XLS_COF "config"
|
||||
#define V_XLS_PAT "path"
|
||||
#define V_XLS_TYPE "read_row_type"
|
||||
|
||||
#define V_XLS_CONST_READ_TYPE_INT "TYPE_INT"
|
||||
#define V_XLS_CONST_READ_TYPE_DOUBLE "TYPE_DOUBLE"
|
||||
#define V_XLS_CONST_READ_TYPE_STRING "TYPE_STRING"
|
||||
#define V_XLS_CONST_READ_TYPE_DATETIME "TYPE_TIMESTAMP"
|
||||
|
||||
#define V_XLS_CONST_READ_SKIP_NONE "SKIP_NONE"
|
||||
#define V_XLS_CONST_READ_SKIP_EMPTY_ROW "SKIP_EMPTY_ROW"
|
||||
#define V_XLS_CONST_READ_SKIP_HIDDEN_ROW "SKIP_HIDDEN_ROW"
|
||||
#define V_XLS_CONST_READ_SKIP_EMPTY_CELLS "SKIP_EMPTY_CELLS"
|
||||
#define V_XLS_CONST_READ_SKIP_EMPTY_VALUE "SKIP_EMPTY_VALUE"
|
||||
|
||||
#define READ_TYPE_EMPTY 0x00
|
||||
#define READ_TYPE_STRING 0x01
|
||||
#define READ_TYPE_INT 0x02
|
||||
#define READ_TYPE_DOUBLE 0x04
|
||||
#define READ_TYPE_DATETIME 0x08
|
||||
|
||||
#define GET_CONFIG_PATH(dir_path_res, class_name, object) \
|
||||
do { \
|
||||
zval rv; \
|
||||
zval *_config = zend_read_property(class_name, object, ZEND_STRL(V_XLS_COF), 0, &rv); \
|
||||
(dir_path_res) = zend_hash_str_find(Z_ARRVAL_P(_config), ZEND_STRL(V_XLS_PAT)); \
|
||||
} while(0)
|
||||
|
||||
extern zend_class_entry *vtiful_xls_ce;
|
||||
|
||||
VTIFUL_STARTUP_FUNCTION(excel);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef VTIFUL_XLS_EXCEPTION_H
|
||||
#define VTIFUL_XLS_EXCEPTION_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
extern zend_class_entry *vtiful_exception_ce;
|
||||
|
||||
VTIFUL_STARTUP_FUNCTION(exception);
|
||||
|
||||
char* exception_message_map(int code);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef PHP_EXT_XLS_EXPORT_FORMAT_H
|
||||
#define PHP_EXT_XLS_EXPORT_FORMAT_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
extern zend_class_entry *vtiful_format_ce;
|
||||
|
||||
VTIFUL_STARTUP_FUNCTION(format);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef PHP_EXT_XLS_EXPORT_HELP_H
|
||||
#define PHP_EXT_XLS_EXPORT_HELP_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
unsigned int file_exists(const char *path);
|
||||
unsigned int directory_exists(const char *path);
|
||||
zend_long date_double_to_timestamp(double value);
|
||||
|
||||
#endif //PHP_EXT_XLS_EXPORT_HELP_H
|
|
@ -0,0 +1,208 @@
|
|||
/* ioapi.h -- IO base function header for compress/uncompress .zip
|
||||
part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
|
||||
|
||||
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 )
|
||||
|
||||
For more info read MiniZip_info.txt
|
||||
|
||||
Changes
|
||||
|
||||
Oct-2009 - Defined ZPOS64_T to fpos_t on windows and u_int64_t on linux. (might need to find a better why for this)
|
||||
Oct-2009 - Change to fseeko64, ftello64 and fopen64 so large files would work on linux.
|
||||
More if/def section may be needed to support other platforms
|
||||
Oct-2009 - Defined fxxxx64 calls to normal fopen/ftell/fseek so they would compile on windows.
|
||||
(but you should use iowin32.c for windows instead)
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _ZLIBIOAPI64_H
|
||||
#define _ZLIBIOAPI64_H
|
||||
|
||||
#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
|
||||
|
||||
// Linux needs this to support file operation on files larger then 4+GB
|
||||
// But might need better if/def to select just the platforms that needs them.
|
||||
|
||||
#ifndef __USE_FILE_OFFSET64
|
||||
#define __USE_FILE_OFFSET64
|
||||
#endif
|
||||
#ifndef __USE_LARGEFILE64
|
||||
#define __USE_LARGEFILE64
|
||||
#endif
|
||||
#ifndef _LARGEFILE64_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
#endif
|
||||
#ifndef _FILE_OFFSET_BIT
|
||||
#define _FILE_OFFSET_BIT 64
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "zlib.h"
|
||||
|
||||
#if defined(USE_FILE32API)
|
||||
#define fopen64 fopen
|
||||
#define ftello64 ftell
|
||||
#define fseeko64 fseek
|
||||
#else
|
||||
#if defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
#define fopen64 fopen
|
||||
#define ftello64 ftello
|
||||
#define fseeko64 fseeko
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
#define fopen64 fopen
|
||||
#if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC)))
|
||||
#define ftello64 _ftelli64
|
||||
#define fseeko64 _fseeki64
|
||||
#else // old MSC
|
||||
#define ftello64 ftell
|
||||
#define fseeko64 fseek
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
#ifndef ZPOS64_T
|
||||
#ifdef _WIN32
|
||||
#define ZPOS64_T fpos_t
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#define ZPOS64_T uint64_t
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
|
||||
#ifdef HAVE_MINIZIP64_CONF_H
|
||||
#include "mz64conf.h"
|
||||
#endif
|
||||
|
||||
/* a type choosen by DEFINE */
|
||||
#ifdef HAVE_64BIT_INT_CUSTOM
|
||||
typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
|
||||
#else
|
||||
#ifdef HAS_STDINT_H
|
||||
#include "stdint.h"
|
||||
typedef uint64_t ZPOS64_T;
|
||||
#else
|
||||
|
||||
/* Maximum unsigned 32-bit value used as placeholder for zip64 */
|
||||
#define MAXU32 0xffffffff
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
typedef unsigned __int64 ZPOS64_T;
|
||||
#else
|
||||
typedef unsigned long long int ZPOS64_T;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define ZLIB_FILEFUNC_SEEK_CUR (1)
|
||||
#define ZLIB_FILEFUNC_SEEK_END (2)
|
||||
#define ZLIB_FILEFUNC_SEEK_SET (0)
|
||||
|
||||
#define ZLIB_FILEFUNC_MODE_READ (1)
|
||||
#define ZLIB_FILEFUNC_MODE_WRITE (2)
|
||||
#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
|
||||
|
||||
#define ZLIB_FILEFUNC_MODE_EXISTING (4)
|
||||
#define ZLIB_FILEFUNC_MODE_CREATE (8)
|
||||
|
||||
|
||||
#ifndef ZCALLBACK
|
||||
#if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
|
||||
#define ZCALLBACK CALLBACK
|
||||
#else
|
||||
#define ZCALLBACK
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
|
||||
typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
|
||||
typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
|
||||
typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
|
||||
typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
|
||||
|
||||
typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
|
||||
typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
|
||||
|
||||
|
||||
/* here is the "old" 32 bits structure structure */
|
||||
typedef struct zlib_filefunc_def_s
|
||||
{
|
||||
open_file_func zopen_file;
|
||||
read_file_func zread_file;
|
||||
write_file_func zwrite_file;
|
||||
tell_file_func ztell_file;
|
||||
seek_file_func zseek_file;
|
||||
close_file_func zclose_file;
|
||||
testerror_file_func zerror_file;
|
||||
voidpf opaque;
|
||||
} zlib_filefunc_def;
|
||||
|
||||
typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream));
|
||||
typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
|
||||
typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode));
|
||||
|
||||
typedef struct zlib_filefunc64_def_s
|
||||
{
|
||||
open64_file_func zopen64_file;
|
||||
read_file_func zread_file;
|
||||
write_file_func zwrite_file;
|
||||
tell64_file_func ztell64_file;
|
||||
seek64_file_func zseek64_file;
|
||||
close_file_func zclose_file;
|
||||
testerror_file_func zerror_file;
|
||||
voidpf opaque;
|
||||
} zlib_filefunc64_def;
|
||||
|
||||
void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));
|
||||
void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
|
||||
|
||||
/* now internal definition, only for zip.c and unzip.h */
|
||||
typedef struct zlib_filefunc64_32_def_s
|
||||
{
|
||||
zlib_filefunc64_def zfile_func64;
|
||||
open_file_func zopen32_file;
|
||||
tell_file_func ztell32_file;
|
||||
seek_file_func zseek32_file;
|
||||
} zlib_filefunc64_32_def;
|
||||
|
||||
|
||||
#define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
|
||||
#define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
|
||||
/* #define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream)) */
|
||||
/* #define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode)) */
|
||||
#define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream))
|
||||
#define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream))
|
||||
|
||||
voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode));
|
||||
long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin));
|
||||
ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream));
|
||||
|
||||
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
|
||||
|
||||
#define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode)))
|
||||
#define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream)))
|
||||
#define ZSEEK64(filefunc,filestream,pos,mode) (call_zseek64((&(filefunc)),(filestream),(pos),(mode)))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,437 @@
|
|||
/* unzip.h -- IO for uncompress .zip files using zlib
|
||||
Version 1.1, February 14h, 2010
|
||||
part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
|
||||
|
||||
Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
|
||||
|
||||
Modifications of Unzip for Zip64
|
||||
Copyright (C) 2007-2008 Even Rouault
|
||||
|
||||
Modifications for Zip64 support on both zip and unzip
|
||||
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
|
||||
|
||||
For more info read MiniZip_info.txt
|
||||
|
||||
---------------------------------------------------------------------------------
|
||||
|
||||
Condition of use and distribution are the same than zlib :
|
||||
|
||||
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.
|
||||
|
||||
---------------------------------------------------------------------------------
|
||||
|
||||
Changes
|
||||
|
||||
See header of unzip64.c
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _unz64_H
|
||||
#define _unz64_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _ZLIB_H
|
||||
#include "zlib.h"
|
||||
#endif
|
||||
|
||||
#ifndef _ZLIBIOAPI_H
|
||||
#include "ioapi.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BZIP2
|
||||
#include "bzlib.h"
|
||||
#endif
|
||||
|
||||
#define Z_BZIP2ED 12
|
||||
|
||||
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
|
||||
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
||||
from (void*) without cast */
|
||||
typedef struct TagunzFile__ { int unused; } unzFile__;
|
||||
typedef unzFile__ *unzFile;
|
||||
#else
|
||||
typedef voidp unzFile;
|
||||
#endif
|
||||
|
||||
|
||||
#define UNZ_OK (0)
|
||||
#define UNZ_END_OF_LIST_OF_FILE (-100)
|
||||
#define UNZ_ERRNO (Z_ERRNO)
|
||||
#define UNZ_EOF (0)
|
||||
#define UNZ_PARAMERROR (-102)
|
||||
#define UNZ_BADZIPFILE (-103)
|
||||
#define UNZ_INTERNALERROR (-104)
|
||||
#define UNZ_CRCERROR (-105)
|
||||
|
||||
/* tm_unz contain date/time info */
|
||||
typedef struct tm_unz_s
|
||||
{
|
||||
uInt tm_sec; /* seconds after the minute - [0,59] */
|
||||
uInt tm_min; /* minutes after the hour - [0,59] */
|
||||
uInt tm_hour; /* hours since midnight - [0,23] */
|
||||
uInt tm_mday; /* day of the month - [1,31] */
|
||||
uInt tm_mon; /* months since January - [0,11] */
|
||||
uInt tm_year; /* years - [1980..2044] */
|
||||
} tm_unz;
|
||||
|
||||
/* unz_global_info structure contain global data about the ZIPfile
|
||||
These data comes from the end of central dir */
|
||||
typedef struct unz_global_info64_s
|
||||
{
|
||||
ZPOS64_T number_entry; /* total number of entries in
|
||||
the central dir on this disk */
|
||||
uLong size_comment; /* size of the global comment of the zipfile */
|
||||
} unz_global_info64;
|
||||
|
||||
typedef struct unz_global_info_s
|
||||
{
|
||||
uLong number_entry; /* total number of entries in
|
||||
the central dir on this disk */
|
||||
uLong size_comment; /* size of the global comment of the zipfile */
|
||||
} unz_global_info;
|
||||
|
||||
/* unz_file_info contain information about a file in the zipfile */
|
||||
typedef struct unz_file_info64_s
|
||||
{
|
||||
uLong version; /* version made by 2 bytes */
|
||||
uLong version_needed; /* version needed to extract 2 bytes */
|
||||
uLong flag; /* general purpose bit flag 2 bytes */
|
||||
uLong compression_method; /* compression method 2 bytes */
|
||||
uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
|
||||
uLong crc; /* crc-32 4 bytes */
|
||||
ZPOS64_T compressed_size; /* compressed size 8 bytes */
|
||||
ZPOS64_T uncompressed_size; /* uncompressed size 8 bytes */
|
||||
uLong size_filename; /* filename length 2 bytes */
|
||||
uLong size_file_extra; /* extra field length 2 bytes */
|
||||
uLong size_file_comment; /* file comment length 2 bytes */
|
||||
|
||||
uLong disk_num_start; /* disk number start 2 bytes */
|
||||
uLong internal_fa; /* internal file attributes 2 bytes */
|
||||
uLong external_fa; /* external file attributes 4 bytes */
|
||||
|
||||
tm_unz tmu_date;
|
||||
} unz_file_info64;
|
||||
|
||||
typedef struct unz_file_info_s
|
||||
{
|
||||
uLong version; /* version made by 2 bytes */
|
||||
uLong version_needed; /* version needed to extract 2 bytes */
|
||||
uLong flag; /* general purpose bit flag 2 bytes */
|
||||
uLong compression_method; /* compression method 2 bytes */
|
||||
uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
|
||||
uLong crc; /* crc-32 4 bytes */
|
||||
uLong compressed_size; /* compressed size 4 bytes */
|
||||
uLong uncompressed_size; /* uncompressed size 4 bytes */
|
||||
uLong size_filename; /* filename length 2 bytes */
|
||||
uLong size_file_extra; /* extra field length 2 bytes */
|
||||
uLong size_file_comment; /* file comment length 2 bytes */
|
||||
|
||||
uLong disk_num_start; /* disk number start 2 bytes */
|
||||
uLong internal_fa; /* internal file attributes 2 bytes */
|
||||
uLong external_fa; /* external file attributes 4 bytes */
|
||||
|
||||
tm_unz tmu_date;
|
||||
} unz_file_info;
|
||||
|
||||
extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
|
||||
const char* fileName2,
|
||||
int iCaseSensitivity));
|
||||
/*
|
||||
Compare two filename (fileName1,fileName2).
|
||||
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
|
||||
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
|
||||
or strcasecmp)
|
||||
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
|
||||
(like 1 on Unix, 2 on Windows)
|
||||
*/
|
||||
|
||||
|
||||
extern unzFile ZEXPORT unzOpen OF((const char *path));
|
||||
extern unzFile ZEXPORT unzOpen64 OF((const void *path));
|
||||
/*
|
||||
Open a Zip file. path contain the full pathname (by example,
|
||||
on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
|
||||
"zlib/zlib113.zip".
|
||||
If the zipfile cannot be opened (file don't exist or in not valid), the
|
||||
return value is NULL.
|
||||
Else, the return value is a unzFile Handle, usable with other function
|
||||
of this unzip package.
|
||||
the "64" function take a const void* pointer, because the path is just the
|
||||
value passed to the open64_file_func callback.
|
||||
Under Windows, if UNICODE is defined, using fill_fopen64_filefunc, the path
|
||||
is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char*
|
||||
does not describe the reality
|
||||
*/
|
||||
|
||||
|
||||
extern unzFile ZEXPORT unzOpen2 OF((const char *path,
|
||||
zlib_filefunc_def* pzlib_filefunc_def));
|
||||
/*
|
||||
Open a Zip file, like unzOpen, but provide a set of file low level API
|
||||
for read/write the zip file (see ioapi.h)
|
||||
*/
|
||||
|
||||
extern unzFile ZEXPORT unzOpen2_64 OF((const void *path,
|
||||
zlib_filefunc64_def* pzlib_filefunc_def));
|
||||
/*
|
||||
Open a Zip file, like unz64Open, but provide a set of file low level API
|
||||
for read/write the zip file (see ioapi.h)
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzClose OF((unzFile file));
|
||||
/*
|
||||
Close a ZipFile opened with unzOpen.
|
||||
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
|
||||
these files MUST be closed with unzCloseCurrentFile before call unzClose.
|
||||
return UNZ_OK if there is no problem. */
|
||||
|
||||
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
|
||||
unz_global_info *pglobal_info));
|
||||
|
||||
extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file,
|
||||
unz_global_info64 *pglobal_info));
|
||||
/*
|
||||
Write info about the ZipFile in the *pglobal_info structure.
|
||||
No preparation of the structure is needed
|
||||
return UNZ_OK if there is no problem. */
|
||||
|
||||
|
||||
extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
|
||||
char *szComment,
|
||||
uLong uSizeBuf));
|
||||
/*
|
||||
Get the global comment string of the ZipFile, in the szComment buffer.
|
||||
uSizeBuf is the size of the szComment buffer.
|
||||
return the number of byte copied or an error code <0
|
||||
*/
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/* Unzip package allow you browse the directory of the zipfile */
|
||||
|
||||
extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
|
||||
/*
|
||||
Set the current file of the zipfile to the first file.
|
||||
return UNZ_OK if there is no problem
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzGoToNextFile OF((unzFile file));
|
||||
/*
|
||||
Set the current file of the zipfile to the next file.
|
||||
return UNZ_OK if there is no problem
|
||||
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzLocateFile OF((unzFile file,
|
||||
const char *szFileName,
|
||||
int iCaseSensitivity));
|
||||
/*
|
||||
Try locate the file szFileName in the zipfile.
|
||||
For the iCaseSensitivity signification, see unzStringFileNameCompare
|
||||
|
||||
return value :
|
||||
UNZ_OK if the file is found. It becomes the current file.
|
||||
UNZ_END_OF_LIST_OF_FILE if the file is not found
|
||||
*/
|
||||
|
||||
|
||||
/* ****************************************** */
|
||||
/* Ryan supplied functions */
|
||||
/* unz_file_info contain information about a file in the zipfile */
|
||||
typedef struct unz_file_pos_s
|
||||
{
|
||||
uLong pos_in_zip_directory; /* offset in zip file directory */
|
||||
uLong num_of_file; /* # of file */
|
||||
} unz_file_pos;
|
||||
|
||||
extern int ZEXPORT unzGetFilePos(
|
||||
unzFile file,
|
||||
unz_file_pos* file_pos);
|
||||
|
||||
extern int ZEXPORT unzGoToFilePos(
|
||||
unzFile file,
|
||||
unz_file_pos* file_pos);
|
||||
|
||||
typedef struct unz64_file_pos_s
|
||||
{
|
||||
ZPOS64_T pos_in_zip_directory; /* offset in zip file directory */
|
||||
ZPOS64_T num_of_file; /* # of file */
|
||||
} unz64_file_pos;
|
||||
|
||||
extern int ZEXPORT unzGetFilePos64(
|
||||
unzFile file,
|
||||
unz64_file_pos* file_pos);
|
||||
|
||||
extern int ZEXPORT unzGoToFilePos64(
|
||||
unzFile file,
|
||||
const unz64_file_pos* file_pos);
|
||||
|
||||
/* ****************************************** */
|
||||
|
||||
extern int ZEXPORT unzGetCurrentFileInfo64 OF((unzFile file,
|
||||
unz_file_info64 *pfile_info,
|
||||
char *szFileName,
|
||||
uLong fileNameBufferSize,
|
||||
void *extraField,
|
||||
uLong extraFieldBufferSize,
|
||||
char *szComment,
|
||||
uLong commentBufferSize));
|
||||
|
||||
extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
|
||||
unz_file_info *pfile_info,
|
||||
char *szFileName,
|
||||
uLong fileNameBufferSize,
|
||||
void *extraField,
|
||||
uLong extraFieldBufferSize,
|
||||
char *szComment,
|
||||
uLong commentBufferSize));
|
||||
/*
|
||||
Get Info about the current file
|
||||
if pfile_info!=NULL, the *pfile_info structure will contain somes info about
|
||||
the current file
|
||||
if szFileName!=NULL, the filemane string will be copied in szFileName
|
||||
(fileNameBufferSize is the size of the buffer)
|
||||
if extraField!=NULL, the extra field information will be copied in extraField
|
||||
(extraFieldBufferSize is the size of the buffer).
|
||||
This is the Central-header version of the extra field
|
||||
if szComment!=NULL, the comment string of the file will be copied in szComment
|
||||
(commentBufferSize is the size of the buffer)
|
||||
*/
|
||||
|
||||
|
||||
/** Addition for GDAL : START */
|
||||
|
||||
extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file));
|
||||
|
||||
/** Addition for GDAL : END */
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/* for reading the content of the current zipfile, you can open it, read data
|
||||
from it, and close it (you can close it before reading all the file)
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
|
||||
/*
|
||||
Open for reading data the current file in the zipfile.
|
||||
If there is no error, the return value is UNZ_OK.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
|
||||
const char* password));
|
||||
/*
|
||||
Open for reading data the current file in the zipfile.
|
||||
password is a crypting password
|
||||
If there is no error, the return value is UNZ_OK.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
|
||||
int* method,
|
||||
int* level,
|
||||
int raw));
|
||||
/*
|
||||
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
||||
if raw==1
|
||||
*method will receive method of compression, *level will receive level of
|
||||
compression
|
||||
note : you can set level parameter as NULL (if you did not want known level,
|
||||
but you CANNOT set method parameter as NULL
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
|
||||
int* method,
|
||||
int* level,
|
||||
int raw,
|
||||
const char* password));
|
||||
/*
|
||||
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
||||
if raw==1
|
||||
*method will receive method of compression, *level will receive level of
|
||||
compression
|
||||
note : you can set level parameter as NULL (if you did not want known level,
|
||||
but you CANNOT set method parameter as NULL
|
||||
*/
|
||||
|
||||
|
||||
extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
|
||||
/*
|
||||
Close the file in zip opened with unzOpenCurrentFile
|
||||
Return UNZ_CRCERROR if all the file was read but the CRC is not good
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
|
||||
voidp buf,
|
||||
unsigned len));
|
||||
/*
|
||||
Read bytes from the current file (opened by unzOpenCurrentFile)
|
||||
buf contain buffer where data must be copied
|
||||
len the size of buf.
|
||||
|
||||
return the number of byte copied if somes bytes are copied
|
||||
return 0 if the end of file was reached
|
||||
return <0 with error code if there is an error
|
||||
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
||||
*/
|
||||
|
||||
extern z_off_t ZEXPORT unztell OF((unzFile file));
|
||||
|
||||
extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file));
|
||||
/*
|
||||
Give the current position in uncompressed data
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzeof OF((unzFile file));
|
||||
/*
|
||||
return 1 if the end of file was reached, 0 elsewhere
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
|
||||
voidp buf,
|
||||
unsigned len));
|
||||
/*
|
||||
Read extra field from the current file (opened by unzOpenCurrentFile)
|
||||
This is the local-header version of the extra field (sometimes, there is
|
||||
more info in the local-header version than in the central-header)
|
||||
|
||||
if buf==NULL, it return the size of the local extra field
|
||||
|
||||
if buf!=NULL, len is the size of the buffer, the extra header is copied in
|
||||
buf.
|
||||
the return value is the number of bytes copied in buf, or (if <0)
|
||||
the error code
|
||||
*/
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
/* Get the current file offset */
|
||||
extern ZPOS64_T ZEXPORT unzGetOffset64 (unzFile file);
|
||||
extern uLong ZEXPORT unzGetOffset (unzFile file);
|
||||
|
||||
/* Set the current file offset */
|
||||
extern int ZEXPORT unzSetOffset64 (unzFile file, ZPOS64_T pos);
|
||||
extern int ZEXPORT unzSetOffset (unzFile file, uLong pos);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _unz64_H */
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef PHP_READ_INCLUDE_H
|
||||
#define PHP_READ_INCLUDE_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define READ_SKIP_ROW 0
|
||||
#define READ_ROW 0x01
|
||||
#define SKIP_EMPTY_VALUE 0x100
|
||||
|
||||
int is_number(const char *value);
|
||||
void data_to_null(zval *zv_result_t);
|
||||
int sheet_read_row(xlsxioreadersheet sheet_t);
|
||||
void sheet_list(xlsxioreader file_t, zval *zv_result_t);
|
||||
xlsxioreader file_open(const char *directory, const char *file_name);
|
||||
void skip_rows(xlsxioreadersheet sheet_t, zval *zv_type_t, zend_long data_type_default, zend_long zl_skip_row);
|
||||
void load_sheet_all_data(xlsxioreadersheet sheet_t, zend_long sheet_flag, zval *zv_type_t, zend_long data_type_default, zval *zv_result_t);
|
||||
void load_sheet_row_data (xlsxioreadersheet sheet_t, zend_long sheet_flag, zval *zv_type_t, zend_long data_type_default, zval *zv_result_t);
|
||||
xlsxioreadersheet sheet_open(xlsxioreader file_t, const zend_string *zs_sheet_name_t, const zend_long zl_flag);
|
||||
unsigned int load_sheet_current_row_data(xlsxioreadersheet sheet_t, zval *zv_result_t, zval *zv_type, zend_long data_type_default, unsigned int flag);
|
||||
unsigned int load_sheet_current_row_data_callback(zend_string *zs_sheet_name_t, xlsxioreader file_t, void *callback_data);
|
||||
void data_to_custom_type(const char *string_value, const size_t string_value_length, const zend_ulong type, zval *zv_result_t, const zend_ulong zv_hashtable_index);
|
||||
|
||||
#endif //PHP_READ_INCLUDE_H
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef PHP_EXT_XLS_EXPORT_RICH_STRING_H
|
||||
#define PHP_EXT_XLS_EXPORT_RICH_STRING_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
extern zend_class_entry *vtiful_rich_string_ce;
|
||||
|
||||
VTIFUL_STARTUP_FUNCTION(rich_string);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef PHP_EXT_XLS_WRITER_VALIDATION_H
|
||||
#define PHP_EXT_XLS_WRITER_VALIDATION_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
extern zend_class_entry *vtiful_validation_ce;
|
||||
|
||||
VTIFUL_STARTUP_FUNCTION(validation);
|
||||
|
||||
#endif // PHP_EXT_XLS_WRITER_VALIDATION_H
|
|
@ -0,0 +1,364 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef PHP_XLS_WRITER_INCLUDE_H
|
||||
#define PHP_XLS_WRITER_INCLUDE_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <php.h>
|
||||
#include "ext/date/php_date.h"
|
||||
|
||||
#include "zend_smart_str.h"
|
||||
#include "zend_exceptions.h"
|
||||
#include "zend.h"
|
||||
#include "zend_API.h"
|
||||
#include "php.h"
|
||||
|
||||
#include "xlsxwriter.h"
|
||||
#include "xlsxwriter/packager.h"
|
||||
#include "xlsxwriter/format.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "php_xlswriter.h"
|
||||
#include "excel.h"
|
||||
#include "validation.h"
|
||||
#include "exception.h"
|
||||
#include "format.h"
|
||||
#include "chart.h"
|
||||
#include "rich_string.h"
|
||||
#include "help.h"
|
||||
|
||||
#ifdef ENABLE_READER
|
||||
#include "xlsxio_read.h"
|
||||
#include "read.h"
|
||||
#include "csv.h"
|
||||
|
||||
typedef struct {
|
||||
xlsxioreader file_t;
|
||||
xlsxioreadersheet sheet_t;
|
||||
zend_long data_type_default;
|
||||
zend_long sheet_flag;
|
||||
} xls_resource_read_t;
|
||||
|
||||
typedef struct {
|
||||
zend_long data_type_default;
|
||||
zval *zv_type_t;
|
||||
zend_fcall_info *fci;
|
||||
zend_fcall_info_cache *fci_cache;
|
||||
} xls_read_callback_data;
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_READER
|
||||
typedef struct {
|
||||
void *file_t;
|
||||
void *sheet_t;
|
||||
zend_long data_type_default;
|
||||
zend_long sheet_flag;
|
||||
} xls_resource_read_t;
|
||||
#endif
|
||||
|
||||
enum xlswriter_boolean {
|
||||
XLSWRITER_FALSE,
|
||||
XLSWRITER_TRUE
|
||||
};
|
||||
|
||||
enum xlswirter_printed_direction {
|
||||
XLSWRITER_PRINTED_LANDSCAPE,
|
||||
XLSWRITER_PRINTED_PORTRAIT,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
lxw_workbook *workbook;
|
||||
lxw_worksheet *worksheet;
|
||||
} xls_resource_write_t;
|
||||
|
||||
typedef struct {
|
||||
lxw_format *format;
|
||||
} xls_resource_format_t;
|
||||
|
||||
typedef struct {
|
||||
lxw_data_validation *validation;
|
||||
} xls_resource_validation_t;
|
||||
|
||||
typedef struct {
|
||||
lxw_chart *chart;
|
||||
lxw_chart_series *series;
|
||||
} xls_resource_chart_t;
|
||||
|
||||
typedef struct {
|
||||
lxw_rich_string_tuple *tuple;
|
||||
} xls_resource_rich_string_t;
|
||||
|
||||
typedef struct _vtiful_xls_object {
|
||||
xls_resource_read_t read_ptr;
|
||||
xls_resource_write_t write_ptr;
|
||||
zend_long write_line;
|
||||
xls_resource_format_t format_ptr;
|
||||
zend_object zo;
|
||||
} xls_object;
|
||||
|
||||
typedef struct _vtiful_format_object {
|
||||
xls_resource_format_t ptr;
|
||||
zend_object zo;
|
||||
} format_object;
|
||||
|
||||
typedef struct _vtiful_chart_object {
|
||||
xls_resource_chart_t ptr;
|
||||
zend_object zo;
|
||||
} chart_object;
|
||||
|
||||
typedef struct _vtiful_validation_object {
|
||||
xls_resource_validation_t ptr;
|
||||
zend_object zo;
|
||||
} validation_object;
|
||||
|
||||
typedef struct _vtiful_rich_string_object {
|
||||
xls_resource_rich_string_t ptr;
|
||||
zend_object zo;
|
||||
} rich_string_object;
|
||||
|
||||
#define REGISTER_CLASS_CONST_LONG(class_name, const_name, value) \
|
||||
zend_declare_class_constant_long(class_name, const_name, sizeof(const_name)-1, (zend_long)value);
|
||||
|
||||
#define REGISTER_CLASS_PROPERTY_NULL(class_name, property_name, acc) \
|
||||
zend_declare_property_null(class_name, ZEND_STRL(property_name), acc);
|
||||
|
||||
#define Z_XLS_P(zv) php_vtiful_xls_fetch_object(Z_OBJ_P(zv));
|
||||
#define Z_CHART_P(zv) php_vtiful_chart_fetch_object(Z_OBJ_P(zv));
|
||||
#define Z_FORMAT_P(zv) php_vtiful_format_fetch_object(Z_OBJ_P(zv));
|
||||
#define Z_VALIDATION_P(zv) php_vtiful_validation_fetch_object(Z_OBJ_P(zv));
|
||||
#define Z_RICH_STR_P(zv) php_vtiful_rich_string_fetch_object(Z_OBJ_P(zv));
|
||||
|
||||
#define WORKBOOK_NOT_INITIALIZED(xls_object_t) \
|
||||
do { \
|
||||
if(xls_object_t->write_ptr.workbook == NULL) { \
|
||||
zend_throw_exception(vtiful_exception_ce, "Please create a file first, use the filename method", 130); \
|
||||
return; \
|
||||
} \
|
||||
} while(0);
|
||||
|
||||
#define WORKSHEET_NOT_INITIALIZED(xls_object_t) \
|
||||
do { \
|
||||
if (xls_object_t->write_ptr.worksheet == NULL) { \
|
||||
zend_throw_exception(vtiful_exception_ce, "worksheet not initialized", 200); \
|
||||
return; \
|
||||
} \
|
||||
} while(0);
|
||||
|
||||
#define WORKSHEET_INDEX_OUT_OF_CHANGE_IN_OPTIMIZE_EXCEPTION(xls_resource_write_t, error) \
|
||||
do { \
|
||||
if(xls_resource_write_t->worksheet->optimize && error == LXW_ERROR_WORKSHEET_INDEX_OUT_OF_RANGE) { \
|
||||
zend_throw_exception(vtiful_exception_ce, "In const memory mode, you cannot modify the placed cells", 170); \
|
||||
return; \
|
||||
} \
|
||||
} while(0);
|
||||
|
||||
#define WORKSHEET_INDEX_OUT_OF_CHANGE_EXCEPTION(error) \
|
||||
do { \
|
||||
if(error == LXW_ERROR_WORKSHEET_INDEX_OUT_OF_RANGE) { \
|
||||
zend_throw_exception(vtiful_exception_ce, "Worksheet row or column index out of range", 180); \
|
||||
return; \
|
||||
} \
|
||||
} while(0);
|
||||
|
||||
#define WORKSHEET_WRITER_EXCEPTION(error) \
|
||||
do { \
|
||||
if(error > LXW_NO_ERROR) { \
|
||||
zend_throw_exception(vtiful_exception_ce, exception_message_map(error), error); \
|
||||
return; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define FCALL_TWO_ARGS(bucket) \
|
||||
ZVAL_COPY_VALUE(&args[0], &bucket->val); \
|
||||
if (bucket->key) { \
|
||||
ZVAL_STR(&args[1], bucket->key); \
|
||||
} else { \
|
||||
ZVAL_LONG(&args[1], bucket->h); \
|
||||
} \
|
||||
zend_call_function(&fci, &fci_cache);
|
||||
|
||||
#define ROW(range) \
|
||||
lxw_name_to_row(range)
|
||||
|
||||
#define ROWS(range) \
|
||||
lxw_name_to_row(range), lxw_name_to_row_2(range)
|
||||
|
||||
#define SHEET_LINE_INIT(obj_p) \
|
||||
obj_p->write_line = 0;
|
||||
|
||||
#define SHEET_LINE_ADD(obj_p) \
|
||||
++obj_p->write_line;
|
||||
|
||||
#define SHEET_LINE_SET(obj_p, current_line) \
|
||||
obj_p->write_line = current_line;
|
||||
|
||||
#define SHEET_CURRENT_LINE(obj_p) obj_p->write_line
|
||||
|
||||
#ifdef LXW_HAS_SNPRINTF
|
||||
#define lxw_snprintf snprintf
|
||||
#else
|
||||
#define lxw_snprintf __builtin_snprintf
|
||||
#endif
|
||||
|
||||
#if PHP_VERSION_ID < 80000
|
||||
#define PROP_OBJ(zv) (zv)
|
||||
#else
|
||||
#define PROP_OBJ(zv) Z_OBJ_P(zv)
|
||||
#endif
|
||||
|
||||
#if PHP_VERSION_ID < 80000
|
||||
#define Z_PARAM_STRING_OR_NULL(dest, dest_len) \
|
||||
Z_PARAM_STRING_EX(dest, dest_len, 1, 0)
|
||||
#define Z_PARAM_STR_OR_NULL(dest) \
|
||||
Z_PARAM_STR_EX(dest, 1, 0)
|
||||
#define Z_PARAM_RESOURCE_OR_NULL(dest) \
|
||||
Z_PARAM_RESOURCE_EX(dest, 1, 0)
|
||||
#define Z_PARAM_DOUBLE_OR_NULL(dest, is_null) \
|
||||
Z_PARAM_DOUBLE_EX(dest, is_null, 1, 0)
|
||||
#define Z_PARAM_LONG_OR_NULL(dest, is_null) \
|
||||
Z_PARAM_LONG_EX(dest, is_null, 1, 0)
|
||||
#define Z_PARAM_ARRAY_OR_NULL(dest) \
|
||||
Z_PARAM_ARRAY_EX(dest, 1, 0)
|
||||
#define Z_PARAM_BOOL_OR_NULL(dest, is_null) \
|
||||
Z_PARAM_BOOL_EX(dest, is_null, 1, 0)
|
||||
#endif
|
||||
|
||||
static inline xls_object *php_vtiful_xls_fetch_object(zend_object *obj) {
|
||||
if (obj == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (xls_object *)((char *)(obj) - XtOffsetOf(xls_object, zo));
|
||||
}
|
||||
|
||||
static inline format_object *php_vtiful_format_fetch_object(zend_object *obj) {
|
||||
if (obj == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (format_object *)((char *)(obj) - XtOffsetOf(format_object, zo));
|
||||
}
|
||||
|
||||
static inline chart_object *php_vtiful_chart_fetch_object(zend_object *obj) {
|
||||
if (obj == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (chart_object *)((char *)(obj) - XtOffsetOf(chart_object, zo));
|
||||
}
|
||||
|
||||
static inline validation_object *php_vtiful_validation_fetch_object(zend_object *obj) {
|
||||
if (obj == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (validation_object *)((char *)(obj) - XtOffsetOf(validation_object, zo));
|
||||
}
|
||||
|
||||
static inline rich_string_object *php_vtiful_rich_string_fetch_object(zend_object *obj) {
|
||||
if (obj == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (rich_string_object *)((char *)(obj) - XtOffsetOf(validation_object, zo));
|
||||
}
|
||||
|
||||
static inline void php_vtiful_close_resource(zend_object *obj) {
|
||||
if (obj == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
xls_object *intern = php_vtiful_xls_fetch_object(obj);
|
||||
|
||||
SHEET_LINE_INIT(intern);
|
||||
|
||||
if (intern->write_ptr.workbook != NULL) {
|
||||
lxw_workbook_free(intern->write_ptr.workbook);
|
||||
intern->write_ptr.workbook = NULL;
|
||||
}
|
||||
|
||||
if (intern->format_ptr.format != NULL) {
|
||||
intern->format_ptr.format = NULL;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_READER
|
||||
if (intern->read_ptr.sheet_t != NULL) {
|
||||
xlsxioread_sheet_close(intern->read_ptr.sheet_t);
|
||||
intern->read_ptr.sheet_t = NULL;
|
||||
}
|
||||
|
||||
if (intern->read_ptr.file_t != NULL) {
|
||||
xlsxioread_close(intern->read_ptr.file_t);
|
||||
intern->read_ptr.file_t = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
intern->read_ptr.data_type_default = READ_TYPE_EMPTY;
|
||||
}
|
||||
|
||||
lxw_format * zval_get_format(zval *handle);
|
||||
lxw_data_validation * zval_get_validation(zval *resource);
|
||||
lxw_rich_string_tuple * zval_get_rich_string(zval *resource);
|
||||
xls_resource_write_t * zval_get_resource(zval *handle);
|
||||
xls_resource_chart_t * zval_get_chart(zval *resource);
|
||||
|
||||
STATIC lxw_error _store_defined_name(lxw_workbook *self, const char *name, const char *app_name, const char *formula, int16_t index, uint8_t hidden);
|
||||
|
||||
STATIC int _compare_defined_names(lxw_defined_name *a, lxw_defined_name *b);
|
||||
|
||||
STATIC void _prepare_drawings(lxw_workbook *self);
|
||||
STATIC void _add_chart_cache_data(lxw_workbook *self);
|
||||
STATIC void _prepare_vml(lxw_workbook *self);
|
||||
STATIC void _prepare_defined_names(lxw_workbook *self);
|
||||
STATIC void _populate_range(lxw_workbook *self, lxw_series_range *range);
|
||||
STATIC void _populate_range_dimensions(lxw_workbook *self, lxw_series_range *range);
|
||||
|
||||
void comment_show(xls_resource_write_t *res);
|
||||
void hide_worksheet(xls_resource_write_t *res);
|
||||
void first_worksheet(xls_resource_write_t *res);
|
||||
void zoom(xls_resource_write_t *res, zend_long zoom);
|
||||
void paper(xls_resource_write_t *res, zend_long type);
|
||||
void gridlines(xls_resource_write_t *res, zend_long option);
|
||||
void printed_scale(xls_resource_write_t *res, zend_long scale);
|
||||
void auto_filter(zend_string *range, xls_resource_write_t *res);
|
||||
void protection(xls_resource_write_t *res, zend_string *password);
|
||||
void format_copy(lxw_format *new_format, lxw_format *other_format);
|
||||
void printed_direction(xls_resource_write_t *res, unsigned int direction);
|
||||
void xls_file_path(zend_string *file_name, zval *dir_path, zval *file_path);
|
||||
void freeze_panes(xls_resource_write_t *res, zend_long row, zend_long column);
|
||||
void margins(xls_resource_write_t *res, double left, double right, double top, double bottom);
|
||||
void set_row(zend_string *range, double height, xls_resource_write_t *res, lxw_format *format);
|
||||
void validation(xls_resource_write_t *res, zend_string *range, lxw_data_validation *validation);
|
||||
void set_column(zend_string *range, double width, xls_resource_write_t *res, lxw_format *format);
|
||||
void merge_cells(zend_string *range, zval *value, xls_resource_write_t *res, lxw_format *format);
|
||||
void comment_writer(zend_string *comment, zend_long row, zend_long columns, xls_resource_write_t *res);
|
||||
void call_object_method(zval *object, const char *function_name, uint32_t param_count, zval *params, zval *ret_val);
|
||||
void chart_writer(zend_long row, zend_long columns, xls_resource_chart_t *chart_resource, xls_resource_write_t *res);
|
||||
void worksheet_set_rows(lxw_row_t start, lxw_row_t end, double height, xls_resource_write_t *res, lxw_format *format);
|
||||
void image_writer(zval *value, zend_long row, zend_long columns, double width, double height, xls_resource_write_t *res);
|
||||
void formula_writer(zend_string *value, zend_long row, zend_long columns, xls_resource_write_t *res, lxw_format *format);
|
||||
void type_writer(zval *value, zend_long row, zend_long columns, xls_resource_write_t *res, zend_string *format, lxw_format *format_handle);
|
||||
void rich_string_writer(zend_long row, zend_long columns, xls_resource_write_t *res, zval *rich_strings, lxw_format *format);
|
||||
void datetime_writer(lxw_datetime *datetime, zend_long row, zend_long columns, zend_string *format, xls_resource_write_t *res, lxw_format *format_handle);
|
||||
void url_writer(zend_long row, zend_long columns, xls_resource_write_t *res, zend_string *url, zend_string *text, zend_string *tool_tip, lxw_format *format);
|
||||
|
||||
lxw_error workbook_file(xls_resource_write_t *self);
|
||||
|
||||
lxw_datetime timestamp_to_datetime(zend_long timestamp);
|
||||
zend_string* char_join_to_zend_str(const char *left, const char *right);
|
||||
zend_string* str_pick_up(zend_string *left, const char *right, size_t len);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,343 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "xlswriter.h"
|
||||
|
||||
zend_class_entry *vtiful_chart_ce;
|
||||
|
||||
/* {{{ format_objects_new
|
||||
*/
|
||||
static zend_object_handlers chart_handlers;
|
||||
|
||||
static zend_always_inline void *vtiful_char_object_alloc(size_t obj_size, zend_class_entry *ce) {
|
||||
void *obj = emalloc(obj_size);
|
||||
memset(obj, 0, obj_size);
|
||||
return obj;
|
||||
}
|
||||
|
||||
PHP_VTIFUL_API zend_object *chart_objects_new(zend_class_entry *ce)
|
||||
{
|
||||
chart_object *format = (chart_object *)vtiful_char_object_alloc(sizeof(chart_object), ce);
|
||||
|
||||
zend_object_std_init(&format->zo, ce);
|
||||
object_properties_init(&format->zo, ce);
|
||||
|
||||
format->ptr.chart = NULL;
|
||||
format->ptr.series = NULL;
|
||||
format->zo.handlers = &chart_handlers;
|
||||
|
||||
return &format->zo;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ chart_objects_free
|
||||
*/
|
||||
static void chart_objects_free(zend_object *object)
|
||||
{
|
||||
chart_object *intern = php_vtiful_chart_fetch_object(object);
|
||||
|
||||
if (intern->ptr.series != NULL) {
|
||||
// free by workbook
|
||||
intern->ptr.series = NULL;
|
||||
}
|
||||
|
||||
if (intern->ptr.chart != NULL) {
|
||||
// free by workbook
|
||||
intern->ptr.chart = NULL;
|
||||
}
|
||||
|
||||
zend_object_std_dtor(&intern->zo);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ ARG_INFO
|
||||
*/
|
||||
ZEND_BEGIN_ARG_INFO_EX(chart_construct_arginfo, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, handle)
|
||||
ZEND_ARG_INFO(0, type)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(chart_series_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, value)
|
||||
ZEND_ARG_INFO(0, categories)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(chart_series_name_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, value)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(chart_style_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, style)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(chart_axis_name_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, name)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(chart_title_name_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, title)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(chart_legend_set_position_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, type)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(chart_to_resource_arginfo, 0, 0, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Chart::__construct(resource $handle, int $type)
|
||||
*/
|
||||
PHP_METHOD(vtiful_chart, __construct)
|
||||
{
|
||||
zval *handle;
|
||||
chart_object *obj;
|
||||
zend_long type = 0;
|
||||
xls_resource_write_t *xls_res;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(2, 2)
|
||||
Z_PARAM_RESOURCE(handle)
|
||||
Z_PARAM_LONG(type)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
xls_res = zval_get_resource(handle);
|
||||
obj = Z_CHART_P(getThis());
|
||||
|
||||
if (obj->ptr.chart == NULL) {
|
||||
obj->ptr.chart = workbook_add_chart(xls_res->workbook, (uint8_t)type);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Chart::series(string $value, string $categories)
|
||||
*/
|
||||
PHP_METHOD(vtiful_chart, series)
|
||||
{
|
||||
chart_object *obj;
|
||||
zend_string *values, *categories = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 2)
|
||||
Z_PARAM_STR(values)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_STR(categories)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj = Z_CHART_P(getThis());
|
||||
|
||||
if (ZEND_NUM_ARGS() == 2) {
|
||||
obj->ptr.series = chart_add_series(obj->ptr.chart, ZSTR_VAL(categories), ZSTR_VAL(values));
|
||||
}
|
||||
|
||||
if (ZEND_NUM_ARGS() == 1) {
|
||||
obj->ptr.series = chart_add_series(obj->ptr.chart, NULL, ZSTR_VAL(values));
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Chart::seriesName(string $value)
|
||||
*/
|
||||
PHP_METHOD(vtiful_chart, seriesName)
|
||||
{
|
||||
chart_object *obj;
|
||||
zend_string *values;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(values)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj = Z_CHART_P(getThis());
|
||||
|
||||
chart_series_set_name(obj->ptr.series, ZSTR_VAL(values));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Chart::style(int $style)
|
||||
*/
|
||||
PHP_METHOD(vtiful_chart, style)
|
||||
{
|
||||
chart_object *obj;
|
||||
zend_long style = 0;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(style)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj = Z_CHART_P(getThis());
|
||||
|
||||
chart_set_style(obj->ptr.chart, (uint8_t)style);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Chart::axisNameX(string $name)
|
||||
*/
|
||||
PHP_METHOD(vtiful_chart, axisNameX)
|
||||
{
|
||||
chart_object *obj;
|
||||
zend_string *name;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(name)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj = Z_CHART_P(getThis());
|
||||
|
||||
chart_axis_set_name(obj->ptr.chart->x_axis, ZSTR_VAL(name));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Chart::axisNameY(string $name)
|
||||
*/
|
||||
PHP_METHOD(vtiful_chart, axisNameY)
|
||||
{
|
||||
chart_object *obj;
|
||||
zend_string *name;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(name)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj = Z_CHART_P(getThis());
|
||||
|
||||
chart_axis_set_name(obj->ptr.chart->y_axis, ZSTR_VAL(name));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Chart::title(string $title)
|
||||
*/
|
||||
PHP_METHOD(vtiful_chart, title)
|
||||
{
|
||||
chart_object *obj;
|
||||
zend_string *title;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(title)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj = Z_CHART_P(getThis());
|
||||
|
||||
chart_title_set_name(obj->ptr.chart, ZSTR_VAL(title));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Chart::legendSetPosition(int $type)
|
||||
*/
|
||||
PHP_METHOD(vtiful_chart, legendSetPosition)
|
||||
{
|
||||
zend_long type = 0;
|
||||
chart_object *obj;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(type)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj = Z_CHART_P(getThis());
|
||||
|
||||
chart_legend_set_position(obj->ptr.chart, (uint8_t)type);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Chart::toResource()
|
||||
*/
|
||||
PHP_METHOD(vtiful_chart, toResource)
|
||||
{
|
||||
chart_object *obj = Z_CHART_P(getThis());
|
||||
|
||||
RETURN_RES(zend_register_resource(&obj->ptr, le_xls_writer));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ chart_methods
|
||||
*/
|
||||
zend_function_entry chart_methods[] = {
|
||||
PHP_ME(vtiful_chart, __construct, chart_construct_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_chart, series, chart_series_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_chart, seriesName, chart_series_name_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_chart, style, chart_style_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_chart, axisNameY, chart_axis_name_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_chart, axisNameX, chart_axis_name_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_chart, title, chart_title_name_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_chart, legendSetPosition, chart_legend_set_position_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_chart, toResource, chart_to_resource_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_FE_END
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
VTIFUL_STARTUP_FUNCTION(chart)
|
||||
{
|
||||
zend_class_entry ce;
|
||||
|
||||
INIT_NS_CLASS_ENTRY(ce, "Vtiful\\Kernel", "Chart", chart_methods);
|
||||
ce.create_object = chart_objects_new;
|
||||
vtiful_chart_ce = zend_register_internal_class(&ce);
|
||||
|
||||
memcpy(&chart_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
|
||||
chart_handlers.offset = XtOffsetOf(chart_object, zo);
|
||||
chart_handlers.free_obj = chart_objects_free;
|
||||
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_BAR", LXW_CHART_BAR)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_BAR_STACKED", LXW_CHART_BAR_STACKED)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_BAR_STACKED_PERCENT", LXW_CHART_BAR_STACKED_PERCENT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_AREA", LXW_CHART_AREA)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_AREA_STACKED", LXW_CHART_AREA_STACKED)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_AREA_STACKED_PERCENT", LXW_CHART_AREA_STACKED_PERCENT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LINE", LXW_CHART_LINE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_COLUMN", LXW_CHART_COLUMN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_COLUMN_STACKED", LXW_CHART_COLUMN_STACKED)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_COLUMN_STACKED_PERCENT", LXW_CHART_COLUMN_STACKED_PERCENT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_DOUGHNUT", LXW_CHART_DOUGHNUT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_PIE", LXW_CHART_PIE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_SCATTER", LXW_CHART_SCATTER)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_SCATTER_STRAIGHT", LXW_CHART_SCATTER_STRAIGHT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_SCATTER_STRAIGHT_WITH_MARKERS", LXW_CHART_SCATTER_STRAIGHT_WITH_MARKERS)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_SCATTER_SMOOTH", LXW_CHART_SCATTER_SMOOTH)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_SCATTER_SMOOTH_WITH_MARKERS", LXW_CHART_SCATTER_SMOOTH_WITH_MARKERS)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_RADAR", LXW_CHART_RADAR)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_RADAR_WITH_MARKERS", LXW_CHART_RADAR_WITH_MARKERS)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_RADAR_FILLED", LXW_CHART_RADAR_FILLED)
|
||||
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LEGEND_NONE", LXW_CHART_LEGEND_NONE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LEGEND_RIGHT", LXW_CHART_LEGEND_RIGHT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LEGEND_LEFT", LXW_CHART_LEGEND_LEFT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LEGEND_TOP", LXW_CHART_LEGEND_TOP)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LEGEND_BOTTOM", LXW_CHART_LEGEND_BOTTOM)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LEGEND_OVERLAY_RIGHT", LXW_CHART_LEGEND_OVERLAY_RIGHT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LEGEND_OVERLAY_LEFT", LXW_CHART_LEGEND_OVERLAY_LEFT)
|
||||
|
||||
#if defined(LXW_VERSION_ID) && LXW_VERSION_ID >= 95
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LINE_STACKED", LXW_CHART_LINE_STACKED)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LINE_STACKED_PERCENT", LXW_CHART_LINE_STACKED_PERCENT)
|
||||
#endif
|
||||
|
||||
// PECL Windows version is 0.7.7, but define in 0.7.8
|
||||
//REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LEGEND_TOP_RIGHT", LXW_CHART_LEGEND_TOP_RIGHT)
|
||||
//REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LEGEND_OVERLAY_TOP_RIGHT", LXW_CHART_LEGEND_OVERLAY_TOP_RIGHT)
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
|
@ -0,0 +1,121 @@
|
|||
kernel/chart.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/chart.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "xlswriter.h"
|
||||
|
||||
/* {{{ */
|
||||
void xls_file_path(zend_string *file_name, zval *dir_path, zval *file_path)
|
||||
{
|
||||
zend_string *full_path, *zstr_path;
|
||||
|
||||
zstr_path = zval_get_string(dir_path);
|
||||
|
||||
if (Z_STRVAL_P(dir_path)[Z_STRLEN_P(dir_path)-1] == '/') {
|
||||
full_path = zend_string_extend(zstr_path, ZSTR_LEN(zstr_path) + ZSTR_LEN(file_name), 0);
|
||||
memcpy(ZSTR_VAL(full_path)+ZSTR_LEN(zstr_path), ZSTR_VAL(file_name), ZSTR_LEN(file_name)+1);
|
||||
} else {
|
||||
full_path = zend_string_extend(zstr_path, ZSTR_LEN(zstr_path) + ZSTR_LEN(file_name) + 1, 0);
|
||||
ZSTR_VAL(full_path)[ZSTR_LEN(zstr_path)] ='/';
|
||||
memcpy(ZSTR_VAL(full_path)+ZSTR_LEN(zstr_path)+1, ZSTR_VAL(file_name), ZSTR_LEN(file_name)+1);
|
||||
}
|
||||
|
||||
ZVAL_STR(file_path, full_path);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
zend_string* str_pick_up(zend_string *left, const char *right, size_t len)
|
||||
{
|
||||
zend_string *full = NULL;
|
||||
|
||||
size_t _left_length = ZSTR_LEN(left);
|
||||
size_t _extend_length = _left_length + len;
|
||||
|
||||
full = zend_string_extend(left, _extend_length, 0);
|
||||
|
||||
memcpy(ZSTR_VAL(full) + _left_length, right, len);
|
||||
|
||||
ZSTR_VAL(full)[_extend_length] = '\0';
|
||||
|
||||
return full;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
zend_string* char_join_to_zend_str(const char *left, const char *right)
|
||||
{
|
||||
size_t _new_len = strlen(left) + strlen(right);
|
||||
|
||||
zend_string *str = zend_string_alloc(_new_len, 0);
|
||||
|
||||
memcpy(ZSTR_VAL(str), left, strlen(left));
|
||||
memcpy(ZSTR_VAL(str) + strlen(left), right, strlen(right) + 1);
|
||||
|
||||
ZSTR_VAL(str)[_new_len] = '\0';
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
void call_object_method(zval *object, const char *function_name, uint32_t param_count, zval *params, zval *ret_val)
|
||||
{
|
||||
uint32_t index;
|
||||
zval z_f_name;
|
||||
|
||||
ZVAL_STRINGL(&z_f_name, function_name, strlen(function_name));
|
||||
call_user_function(NULL, object, &z_f_name, ret_val, param_count, params);
|
||||
|
||||
if (Z_ISUNDEF_P(ret_val)) {
|
||||
ZVAL_NULL(ret_val);
|
||||
}
|
||||
|
||||
for (index = 0; index < param_count; index++) {
|
||||
zval_ptr_dtor(¶ms[index]);
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&z_f_name);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
lxw_datetime timestamp_to_datetime(zend_long timestamp)
|
||||
{
|
||||
int yearLocal = php_idate('Y', timestamp, 0);
|
||||
int monthLocal = php_idate('m', timestamp, 0);
|
||||
int dayLocal = php_idate('d', timestamp, 0);
|
||||
int hourLocal = php_idate('H', timestamp, 0);
|
||||
int minuteLocal = php_idate('i', timestamp, 0);
|
||||
int secondLocal = php_idate('s', timestamp, 0);
|
||||
|
||||
lxw_datetime datetime = {
|
||||
yearLocal, monthLocal, dayLocal, hourLocal, minuteLocal, secondLocal
|
||||
};
|
||||
|
||||
return datetime;
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
kernel/common.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/common.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "xlswriter.h"
|
||||
#include "php_streams.h"
|
||||
#include "ext/standard/file.h"
|
||||
|
||||
/* {{{ */
|
||||
unsigned int xlsx_to_csv(
|
||||
zval *stream_resource,
|
||||
const char *delimiter_str, int delimiter_str_len,
|
||||
const char *enclosure_str, int enclosure_str_len,
|
||||
const char *escape_str, int escape_str_len,
|
||||
xlsxioreadersheet sheet_t,
|
||||
zval *zv_type_arr_t, zend_long data_type_default,
|
||||
unsigned int flag, zend_fcall_info *fci, zend_fcall_info_cache *fci_cache
|
||||
)
|
||||
{
|
||||
ssize_t ret = 0;
|
||||
zval *_zv_type_arr_t = NULL;
|
||||
php_stream *_stream_t = NULL;
|
||||
char delimiter = ',', enclosure = '"', escape_char = '\\';
|
||||
|
||||
ZEND_ASSERT(Z_TYPE_P(stream_resource) == IS_RESOURCE);
|
||||
|
||||
if (((_stream_t) = (php_stream *)zend_fetch_resource2((Z_RES_P(stream_resource)),
|
||||
"stream", php_file_le_stream(), php_file_le_pstream())) == NULL) {
|
||||
return XLSWRITER_FALSE;
|
||||
}
|
||||
|
||||
if (delimiter_str != NULL) {
|
||||
if (delimiter_str_len < 1) {
|
||||
zend_throw_exception(vtiful_exception_ce, "delimiter must be a character", 190);
|
||||
return XLSWRITER_FALSE;
|
||||
} else if (delimiter_str_len > 1) {
|
||||
zend_throw_exception(vtiful_exception_ce, "delimiter must be a single character", 191);
|
||||
return XLSWRITER_FALSE;
|
||||
}
|
||||
|
||||
delimiter = *delimiter_str;
|
||||
}
|
||||
|
||||
if (enclosure_str != NULL) {
|
||||
if (enclosure_str_len < 1) {
|
||||
zend_throw_exception(vtiful_exception_ce, "enclosure must be a character", 192);
|
||||
return XLSWRITER_FALSE;
|
||||
} else if (enclosure_str_len > 1) {
|
||||
zend_throw_exception(vtiful_exception_ce, "enclosure must be a single character", 193);
|
||||
return XLSWRITER_FALSE;
|
||||
}
|
||||
|
||||
enclosure = *enclosure_str;
|
||||
}
|
||||
|
||||
if (escape_str != NULL) {
|
||||
if (escape_str_len < 1) {
|
||||
zend_throw_exception(vtiful_exception_ce, "escape must be a character", 194);
|
||||
return XLSWRITER_FALSE;
|
||||
} else if (escape_str_len > 1) {
|
||||
zend_throw_exception(vtiful_exception_ce, "escape must be a single character", 195);
|
||||
return XLSWRITER_FALSE;
|
||||
}
|
||||
|
||||
escape_char = *escape_str;
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(zv_type_arr_t) == IS_ARRAY) {
|
||||
_zv_type_arr_t = zv_type_arr_t;
|
||||
}
|
||||
|
||||
zval _zv_tmp_row;
|
||||
ZVAL_NULL(&_zv_tmp_row);
|
||||
|
||||
while (sheet_read_row(sheet_t))
|
||||
{
|
||||
load_sheet_current_row_data(sheet_t, &_zv_tmp_row, _zv_type_arr_t, data_type_default, flag);
|
||||
|
||||
if (fci != NULL && fci_cache != NULL) {
|
||||
zval retval;
|
||||
|
||||
fci->retval = &retval;
|
||||
fci->params = &_zv_tmp_row;
|
||||
fci->param_count = 1;
|
||||
|
||||
zend_call_function(fci, fci_cache);
|
||||
|
||||
if (Z_TYPE(retval) == IS_ARRAY) {
|
||||
#if PHP_VERSION_ID >= 80100
|
||||
ret = php_fputcsv(_stream_t, &retval, delimiter, enclosure, escape_char, NULL);
|
||||
#else
|
||||
ret = php_fputcsv(_stream_t, &retval, delimiter, enclosure, escape_char);
|
||||
#endif
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&retval);
|
||||
goto CLEAN_UP_SCENE;
|
||||
}
|
||||
|
||||
#if PHP_VERSION_ID >= 80100
|
||||
ret = php_fputcsv(_stream_t, &_zv_tmp_row, delimiter, enclosure, escape_char, NULL);
|
||||
#else
|
||||
ret = php_fputcsv(_stream_t, &_zv_tmp_row, delimiter, enclosure, escape_char);
|
||||
#endif
|
||||
|
||||
CLEAN_UP_SCENE:
|
||||
|
||||
zend_hash_clean(Z_ARRVAL(_zv_tmp_row));
|
||||
|
||||
if (ret < 0) {
|
||||
return XLSWRITER_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
zval_dtor(&_zv_tmp_row);
|
||||
|
||||
return XLSWRITER_TRUE;
|
||||
}
|
||||
/* }}} */
|
|
@ -0,0 +1,123 @@
|
|||
kernel/csv.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/csv.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h \
|
||||
/usr/local/etc/php/include/php/ext/standard/file.h \
|
||||
/usr/local/etc/php/include/php/main/php_network.h
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,121 @@
|
|||
kernel/excel.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/excel.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "xlswriter.h"
|
||||
|
||||
zend_class_entry *vtiful_exception_ce;
|
||||
|
||||
/** {{{ exception_methods
|
||||
*/
|
||||
zend_function_entry exception_methods[] = {
|
||||
PHP_FE_END
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/** {{{ VTIFUL_STARTUP_FUNCTION
|
||||
*/
|
||||
VTIFUL_STARTUP_FUNCTION(exception) {
|
||||
zend_class_entry ce;
|
||||
|
||||
INIT_NS_CLASS_ENTRY(ce, "Vtiful\\Kernel", "Exception", exception_methods);
|
||||
|
||||
vtiful_exception_ce = zend_register_internal_class_ex(&ce, zend_ce_exception);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ exception_message_map
|
||||
*/
|
||||
char* exception_message_map(int code) {
|
||||
switch (code) {
|
||||
case LXW_ERROR_MEMORY_MALLOC_FAILED:
|
||||
return "Memory error, failed to malloc() required memory.";
|
||||
case LXW_ERROR_CREATING_XLSX_FILE:
|
||||
return "Error creating output xlsx file. Usually a permissions error.";
|
||||
case LXW_ERROR_CREATING_TMPFILE:
|
||||
return "Error encountered when creating a tmpfile during file assembly.";
|
||||
case LXW_ERROR_READING_TMPFILE:
|
||||
return "Error reading a tmpfile.";
|
||||
case LXW_ERROR_ZIP_FILE_OPERATION:
|
||||
return "Zlib error with a file operation while creating xlsx file.";
|
||||
case LXW_ERROR_ZIP_FILE_ADD:
|
||||
return "Zlib error when adding sub file to xlsx file.";
|
||||
case LXW_ERROR_ZIP_CLOSE:
|
||||
return "Zlib error when closing xlsx file.";
|
||||
case LXW_ERROR_NULL_PARAMETER_IGNORED:
|
||||
return "NULL function parameter ignored.";
|
||||
case LXW_ERROR_PARAMETER_VALIDATION:
|
||||
return "Function parameter validation error.";
|
||||
case LXW_ERROR_SHEETNAME_LENGTH_EXCEEDED:
|
||||
return "Worksheet name exceeds Excel's limit of 31 characters.";
|
||||
case LXW_ERROR_INVALID_SHEETNAME_CHARACTER:
|
||||
return "Worksheet name contains invalid.";
|
||||
case LXW_ERROR_SHEETNAME_ALREADY_USED:
|
||||
return "Worksheet name is already in use.";
|
||||
case LXW_ERROR_32_STRING_LENGTH_EXCEEDED:
|
||||
return "Parameter exceeds Excel's limit of 32 characters.";
|
||||
case LXW_ERROR_128_STRING_LENGTH_EXCEEDED:
|
||||
return "Parameter exceeds Excel's limit of 128 characters.";
|
||||
case LXW_ERROR_255_STRING_LENGTH_EXCEEDED:
|
||||
return "Parameter exceeds Excel's limit of 255 characters.";
|
||||
case LXW_ERROR_MAX_STRING_LENGTH_EXCEEDED:
|
||||
return "String exceeds Excel's limit of 32:767 characters.";
|
||||
case LXW_ERROR_SHARED_STRING_INDEX_NOT_FOUND:
|
||||
return "Error finding internal string index.";
|
||||
case LXW_ERROR_WORKSHEET_INDEX_OUT_OF_RANGE:
|
||||
return "Worksheet row or column index out of range.";
|
||||
case LXW_ERROR_WORKSHEET_MAX_NUMBER_URLS_EXCEEDED:
|
||||
return "Maximum number of worksheet URLs (65530) exceeded.";
|
||||
case LXW_ERROR_IMAGE_DIMENSIONS:
|
||||
return "Couldn't read image dimensions or DPI.";
|
||||
default:
|
||||
return "Unknown error";
|
||||
}
|
||||
}
|
||||
/* }}} */
|
|
@ -0,0 +1,121 @@
|
|||
kernel/exception.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/exception.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h
|
|
@ -0,0 +1,602 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "xlswriter.h"
|
||||
|
||||
zend_class_entry *vtiful_format_ce;
|
||||
|
||||
/* {{{ format_objects_new
|
||||
*/
|
||||
static zend_object_handlers format_handlers;
|
||||
|
||||
static zend_always_inline void *vtiful_format_object_alloc(size_t obj_size, zend_class_entry *ce) {
|
||||
void *obj = emalloc(obj_size);
|
||||
memset(obj, 0, obj_size);
|
||||
return obj;
|
||||
}
|
||||
|
||||
PHP_VTIFUL_API zend_object *format_objects_new(zend_class_entry *ce)
|
||||
{
|
||||
format_object *format = vtiful_format_object_alloc(sizeof(format_object), ce);
|
||||
|
||||
zend_object_std_init(&format->zo, ce);
|
||||
object_properties_init(&format->zo, ce);
|
||||
|
||||
format->ptr.format = NULL;
|
||||
format->zo.handlers = &format_handlers;
|
||||
|
||||
return &format->zo;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ format_objects_free
|
||||
*/
|
||||
static void format_objects_free(zend_object *object)
|
||||
{
|
||||
format_object *intern = php_vtiful_format_fetch_object(object);
|
||||
|
||||
if (intern->ptr.format != NULL) {
|
||||
// free by workbook
|
||||
intern->ptr.format = NULL;
|
||||
}
|
||||
|
||||
zend_object_std_dtor(&intern->zo);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ ARG_INFO
|
||||
*/
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_construct_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, handle)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_wrap_arginfo, 0, 0, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_bold_arginfo, 0, 0, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_italic_arginfo, 0, 0, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_underline_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, style)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_unlocked_arginfo, 0, 0, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_align_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_VARIADIC_INFO(0, style)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_color_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, color)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_size_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, size)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_strikeout_arginfo, 0, 0, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_number_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, format)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_background_arginfo, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, pattern)
|
||||
ZEND_ARG_INFO(0, color)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_border_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, style)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_border_of_the_four_sides_arginfo, 0, 0, 4)
|
||||
ZEND_ARG_INFO(0, top)
|
||||
ZEND_ARG_INFO(0, right)
|
||||
ZEND_ARG_INFO(0, bottom)
|
||||
ZEND_ARG_INFO(0, left)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_border_color_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, color)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_border_color_of_the_four_sides_arginfo, 0, 0, 4)
|
||||
ZEND_ARG_INFO(0, top_color)
|
||||
ZEND_ARG_INFO(0, right_color)
|
||||
ZEND_ARG_INFO(0, bottom_color)
|
||||
ZEND_ARG_INFO(0, left_color)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_font_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, font)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_to_resource_arginfo, 0, 0, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::__construct()
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, __construct)
|
||||
{
|
||||
zval *handle;
|
||||
format_object *obj;
|
||||
xls_resource_write_t *xls_res;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_RESOURCE(handle)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
xls_res = zval_get_resource(handle);
|
||||
obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format == NULL) {
|
||||
obj->ptr.format = workbook_add_format(xls_res->workbook);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::bold()
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, bold)
|
||||
{
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_bold(obj->ptr.format);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::italic()
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, italic)
|
||||
{
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_italic(obj->ptr.format);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::underline()
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, underline)
|
||||
{
|
||||
zend_long style = 0;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(style)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_underline(obj->ptr.format, style);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::unlocked()
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, unlocked)
|
||||
{
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_unlocked(obj->ptr.format);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::align()
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, align)
|
||||
{
|
||||
zval *args = NULL;
|
||||
int argc, i;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, -1)
|
||||
Z_PARAM_VARIADIC('+', args, argc)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
for (i = 0; i < argc; ++i) {
|
||||
zval *arg = args + i;
|
||||
|
||||
if (Z_TYPE_P(arg) != IS_LONG) {
|
||||
zend_throw_exception(vtiful_exception_ce, "Format exception, please view the manual", 150);
|
||||
}
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_align(obj->ptr.format, Z_LVAL_P(arg));
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::fontColor(int $color)
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, fontColor)
|
||||
{
|
||||
zend_long color = 0;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(color)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_font_color(obj->ptr.format, color);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::number(string $format)
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, number)
|
||||
{
|
||||
zend_string *format;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(format)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_num_format(obj->ptr.format, ZSTR_VAL(format));
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::background(int $color [, int $pattern = \Vtiful\Kernel\Format::PATTERN_SOLID])
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, background)
|
||||
{
|
||||
zend_long pattern = LXW_PATTERN_SOLID, color = 0;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 2)
|
||||
Z_PARAM_LONG(color)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(pattern)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_pattern(obj->ptr.format, pattern);
|
||||
format_set_bg_color(obj->ptr.format, color);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::fontSize(double $size)
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, fontSize)
|
||||
{
|
||||
double size;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_DOUBLE(size)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_font_size(obj->ptr.format, size);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::font(string $fontName)
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, font)
|
||||
{
|
||||
zend_string *font_name = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(font_name)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_font_name(obj->ptr.format, ZSTR_VAL(font_name));
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::strikeout()
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, strikeout)
|
||||
{
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_font_strikeout(obj->ptr.format);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::wrap()
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, wrap)
|
||||
{
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_text_wrap(obj->ptr.format);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::border()
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, border)
|
||||
{
|
||||
zend_long style = 0;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(style)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_border(obj->ptr.format, style);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::borderOfTheFourSides(int $top, int $right, int $bottom, int $left)
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, borderOfTheFourSides)
|
||||
{
|
||||
zend_long top = LXW_BORDER_NONE, right = LXW_BORDER_NONE, bottom = LXW_BORDER_NONE, left = LXW_BORDER_NONE;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(0, 4)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG_OR_NULL(top, _dummy)
|
||||
Z_PARAM_LONG_OR_NULL(right, _dummy)
|
||||
Z_PARAM_LONG_OR_NULL(bottom, _dummy)
|
||||
Z_PARAM_LONG_OR_NULL(left, _dummy)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_top(obj->ptr.format, top);
|
||||
format_set_right(obj->ptr.format, right);
|
||||
format_set_bottom(obj->ptr.format, bottom);
|
||||
format_set_left(obj->ptr.format, left);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::borderColor(int $color)
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, borderColor)
|
||||
{
|
||||
zend_long color = -1;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(color)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format && color > 0) {
|
||||
format_set_border_color(obj->ptr.format, color);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::borderColorOfTheFourSides(int $topColor, int $rightColor, int $bottomColor, int $leftColor)
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, borderColorOfTheFourSides)
|
||||
{
|
||||
zend_long top = -1, right = -1, bottom = -1, left = -1;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(0, 4)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG_OR_NULL(top, _dummy)
|
||||
Z_PARAM_LONG_OR_NULL(right, _dummy)
|
||||
Z_PARAM_LONG_OR_NULL(bottom, _dummy)
|
||||
Z_PARAM_LONG_OR_NULL(left, _dummy)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
if (top > 0) {
|
||||
format_set_top_color(obj->ptr.format, top);
|
||||
}
|
||||
|
||||
if (right > 0) {
|
||||
format_set_right_color(obj->ptr.format, right);
|
||||
}
|
||||
|
||||
if (bottom > 0) {
|
||||
format_set_bottom_color(obj->ptr.format, bottom);
|
||||
}
|
||||
|
||||
if (left > 0) {
|
||||
format_set_left_color(obj->ptr.format, left);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::toResource()
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, toResource)
|
||||
{
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
RETURN_RES(zend_register_resource(obj->ptr.format, le_xls_writer));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ format_methods
|
||||
*/
|
||||
zend_function_entry format_methods[] = {
|
||||
PHP_ME(vtiful_format, __construct, format_construct_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, wrap, format_wrap_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, bold, format_bold_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, italic, format_italic_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, border, format_border_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, borderOfTheFourSides, format_border_of_the_four_sides_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, borderColor, format_border_color_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, borderColorOfTheFourSides, format_border_color_of_the_four_sides_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, align, format_align_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, number, format_number_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, fontColor, format_color_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, font, format_font_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, fontSize, format_size_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, strikeout, format_strikeout_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, underline, format_underline_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, unlocked, format_unlocked_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, toResource, format_to_resource_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, background, format_background_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_FE_END
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/** {{{ VTIFUL_STARTUP_FUNCTION
|
||||
*/
|
||||
VTIFUL_STARTUP_FUNCTION(format) {
|
||||
zend_class_entry ce;
|
||||
|
||||
INIT_NS_CLASS_ENTRY(ce, "Vtiful\\Kernel", "Format", format_methods);
|
||||
ce.create_object = format_objects_new;
|
||||
vtiful_format_ce = zend_register_internal_class(&ce);
|
||||
|
||||
memcpy(&format_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
|
||||
format_handlers.offset = XtOffsetOf(format_object, zo);
|
||||
format_handlers.free_obj = format_objects_free;
|
||||
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "UNDERLINE_SINGLE", LXW_UNDERLINE_SINGLE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "UNDERLINE_DOUBLE ", LXW_UNDERLINE_DOUBLE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "UNDERLINE_SINGLE_ACCOUNTING", LXW_UNDERLINE_SINGLE_ACCOUNTING)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "UNDERLINE_DOUBLE_ACCOUNTING", LXW_UNDERLINE_DOUBLE_ACCOUNTING)
|
||||
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_LEFT", LXW_ALIGN_LEFT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_CENTER", LXW_ALIGN_CENTER)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_RIGHT", LXW_ALIGN_RIGHT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_FILL", LXW_ALIGN_FILL)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_JUSTIFY", LXW_ALIGN_JUSTIFY)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_CENTER_ACROSS", LXW_ALIGN_CENTER_ACROSS)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_DISTRIBUTED", LXW_ALIGN_DISTRIBUTED)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_VERTICAL_TOP", LXW_ALIGN_VERTICAL_TOP)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_VERTICAL_BOTTOM", LXW_ALIGN_VERTICAL_BOTTOM)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_VERTICAL_CENTER", LXW_ALIGN_VERTICAL_CENTER)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_VERTICAL_JUSTIFY", LXW_ALIGN_VERTICAL_JUSTIFY)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_VERTICAL_DISTRIBUTED", LXW_ALIGN_VERTICAL_DISTRIBUTED)
|
||||
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_BLACK", LXW_COLOR_BLACK)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_BLUE", LXW_COLOR_BLUE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_BROWN", LXW_COLOR_BROWN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_CYAN", LXW_COLOR_CYAN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_GRAY", LXW_COLOR_GRAY)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_GREEN", LXW_COLOR_GREEN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_LIME", LXW_COLOR_LIME)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_MAGENTA", LXW_COLOR_MAGENTA)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_NAVY", LXW_COLOR_NAVY)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_ORANGE", LXW_COLOR_ORANGE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_PINK", LXW_COLOR_PINK)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_PURPLE", LXW_COLOR_PURPLE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_RED", LXW_COLOR_RED)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_SILVER", LXW_COLOR_SILVER)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_WHITE", LXW_COLOR_WHITE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_YELLOW", LXW_COLOR_YELLOW)
|
||||
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_NONE", LXW_PATTERN_NONE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_SOLID", LXW_PATTERN_SOLID)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_MEDIUM_GRAY", LXW_PATTERN_MEDIUM_GRAY)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_DARK_GRAY", LXW_PATTERN_DARK_GRAY)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_LIGHT_GRAY", LXW_PATTERN_LIGHT_GRAY)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_DARK_HORIZONTAL", LXW_PATTERN_DARK_HORIZONTAL)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_DARK_VERTICAL", LXW_PATTERN_DARK_VERTICAL)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_DARK_DOWN", LXW_PATTERN_DARK_DOWN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_DARK_UP", LXW_PATTERN_DARK_UP)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_DARK_GRID", LXW_PATTERN_DARK_GRID)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_DARK_TRELLIS", LXW_PATTERN_DARK_TRELLIS)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_LIGHT_HORIZONTAL", LXW_PATTERN_LIGHT_HORIZONTAL)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_LIGHT_VERTICAL", LXW_PATTERN_LIGHT_VERTICAL)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_LIGHT_DOWN", LXW_PATTERN_LIGHT_DOWN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_LIGHT_UP", LXW_PATTERN_LIGHT_UP)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_LIGHT_GRID", LXW_PATTERN_LIGHT_GRID)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_LIGHT_TRELLIS", LXW_PATTERN_LIGHT_TRELLIS)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_GRAY_125", LXW_PATTERN_GRAY_125)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_GRAY_0625", LXW_PATTERN_GRAY_0625)
|
||||
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_NONE", LXW_BORDER_NONE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_THIN", LXW_BORDER_THIN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_MEDIUM", LXW_BORDER_MEDIUM)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_DASHED", LXW_BORDER_DASHED)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_DOTTED", LXW_BORDER_DOTTED)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_THICK", LXW_BORDER_THICK)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_DOUBLE", LXW_BORDER_DOUBLE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_HAIR", LXW_BORDER_HAIR)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_MEDIUM_DASHED", LXW_BORDER_MEDIUM_DASHED)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_DASH_DOT", LXW_BORDER_DASH_DOT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_MEDIUM_DASH_DOT", LXW_BORDER_MEDIUM_DASH_DOT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_DASH_DOT_DOT", LXW_BORDER_DASH_DOT_DOT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_MEDIUM_DASH_DOT_DOT", LXW_BORDER_MEDIUM_DASH_DOT_DOT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_SLANT_DASH_DOT", LXW_BORDER_SLANT_DASH_DOT)
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
|
@ -0,0 +1,121 @@
|
|||
kernel/format.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/format.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "xlswriter.h"
|
||||
#include "ext/date/php_date.h"
|
||||
#include "ext/standard/php_math.h"
|
||||
#include "ext/standard/php_filestat.h"
|
||||
|
||||
/* {{{ */
|
||||
zend_long date_double_to_timestamp(double value) {
|
||||
double days, partDay, hours, minutes, seconds;
|
||||
|
||||
days = floor(value);
|
||||
partDay = value - days;
|
||||
hours = floor(partDay * 24);
|
||||
partDay = partDay * 24 - hours;
|
||||
minutes = floor(partDay * 60);
|
||||
partDay = partDay * 60 - minutes;
|
||||
seconds = _php_math_round(partDay * 60, 0, PHP_ROUND_HALF_UP);
|
||||
|
||||
zval datetime;
|
||||
php_date_instantiate(php_date_get_date_ce(), &datetime);
|
||||
php_date_initialize(Z_PHPDATE_P(&datetime), ZEND_STRL("1899-12-30"), NULL, NULL, 1);
|
||||
|
||||
zval _modify_args[1], _modify_result;
|
||||
smart_str _modify_arg_string = {0};
|
||||
if (days >= 0) {
|
||||
smart_str_appendl(&_modify_arg_string, "+", 1);
|
||||
}
|
||||
smart_str_append_long(&_modify_arg_string, days);
|
||||
smart_str_appendl(&_modify_arg_string, " days", 5);
|
||||
ZSTR_VAL(_modify_arg_string.s)[ZSTR_LEN(_modify_arg_string.s)] = '\0';
|
||||
ZVAL_STR(&_modify_args[0], _modify_arg_string.s);
|
||||
call_object_method(&datetime, "modify", 1, _modify_args, &_modify_result);
|
||||
zval_ptr_dtor(&datetime);
|
||||
|
||||
zval _set_time_args[3], _set_time_result;
|
||||
ZVAL_LONG(&_set_time_args[0], (zend_long)hours);
|
||||
ZVAL_LONG(&_set_time_args[1], (zend_long)minutes);
|
||||
ZVAL_LONG(&_set_time_args[2], (zend_long)seconds);
|
||||
call_object_method(&_modify_result, "setTime", 3, _set_time_args, &_set_time_result);
|
||||
zval_ptr_dtor(&_modify_result);
|
||||
|
||||
zval _format_args[1], _format_result;
|
||||
ZVAL_STRING(&_format_args[0], "U");
|
||||
call_object_method(&_set_time_result, "format", 1, _format_args, &_format_result);
|
||||
zval_ptr_dtor(&_set_time_result);
|
||||
|
||||
zend_long timestamp = ZEND_STRTOL(Z_STRVAL(_format_result), NULL ,10);
|
||||
zval_ptr_dtor(&_format_result);
|
||||
|
||||
return timestamp;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
unsigned int directory_exists(const char *path) {
|
||||
zval dir_exists;
|
||||
|
||||
#if PHP_VERSION_ID >= 80100
|
||||
zend_string *zs_path = zend_string_init(path, strlen(path), 0);
|
||||
php_stat(zs_path, FS_IS_DIR, &dir_exists);
|
||||
zend_string_release(zs_path);
|
||||
#else
|
||||
php_stat(path, strlen(path), FS_IS_DIR, &dir_exists);
|
||||
#endif
|
||||
|
||||
if (Z_TYPE(dir_exists) == IS_FALSE) {
|
||||
zval_ptr_dtor(&dir_exists);
|
||||
return XLSWRITER_FALSE;
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&dir_exists);
|
||||
return XLSWRITER_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
unsigned int file_exists(const char *path) {
|
||||
zval file_exists;
|
||||
|
||||
#if PHP_VERSION_ID >= 80100
|
||||
zend_string *zs_path = zend_string_init(path, strlen(path), 0);
|
||||
php_stat(zs_path, FS_IS_FILE, &file_exists);
|
||||
zend_string_release(zs_path);
|
||||
#else
|
||||
php_stat(path, strlen(path), FS_IS_FILE, &file_exists);
|
||||
#endif
|
||||
|
||||
if (Z_TYPE(file_exists) == IS_FALSE) {
|
||||
zval_ptr_dtor(&file_exists);
|
||||
return XLSWRITER_FALSE;
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&file_exists);
|
||||
return XLSWRITER_TRUE;
|
||||
}
|
||||
/* }}} */
|
|
@ -0,0 +1,123 @@
|
|||
kernel/help.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/help.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h \
|
||||
/usr/local/etc/php/include/php/ext/standard/php_math.h \
|
||||
/usr/local/etc/php/include/php/ext/standard/php_filestat.h
|
|
@ -0,0 +1,470 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "xlswriter.h"
|
||||
#include "ext/date/php_date.h"
|
||||
|
||||
/* {{{ */
|
||||
xlsxioreader file_open(const char *directory, const char *file_name) {
|
||||
char *path = (char *)emalloc(strlen(directory) + strlen(file_name) + 2);
|
||||
xlsxioreader file;
|
||||
|
||||
strcpy(path, directory);
|
||||
strcat(path, "/");
|
||||
strcat(path, file_name);
|
||||
|
||||
if (file_exists(path) == XLSWRITER_FALSE) {
|
||||
zend_string *message = char_join_to_zend_str("File not found, file path:", path);
|
||||
zend_throw_exception(vtiful_exception_ce, ZSTR_VAL(message), 121);
|
||||
|
||||
zend_string_free(message);
|
||||
efree(path);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((file = xlsxioread_open(path)) == NULL) {
|
||||
zend_string *message = char_join_to_zend_str("Failed to open file, file path:", path);
|
||||
zend_throw_exception(vtiful_exception_ce, ZSTR_VAL(message), 100);
|
||||
|
||||
zend_string_free(message);
|
||||
efree(path);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
efree(path);
|
||||
return file;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
xlsxioreadersheet sheet_open(xlsxioreader file_t, const zend_string *zs_sheet_name_t, const zend_long zl_flag)
|
||||
{
|
||||
if (zs_sheet_name_t == NULL) {
|
||||
return xlsxioread_sheet_open(file_t, NULL, zl_flag);
|
||||
}
|
||||
|
||||
return xlsxioread_sheet_open(file_t, ZSTR_VAL(zs_sheet_name_t), zl_flag);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
void sheet_list(xlsxioreader file_t, zval *zv_result_t)
|
||||
{
|
||||
const char *sheet_name = NULL;
|
||||
xlsxioreadersheetlist sheet_list = NULL;
|
||||
|
||||
if (Z_TYPE_P(zv_result_t) != IS_ARRAY) {
|
||||
array_init(zv_result_t);
|
||||
}
|
||||
|
||||
if ((sheet_list = xlsxioread_sheetlist_open(file_t)) == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
while ((sheet_name = xlsxioread_sheetlist_next(sheet_list)) != NULL) {
|
||||
add_next_index_stringl(zv_result_t, sheet_name, strlen(sheet_name));
|
||||
}
|
||||
|
||||
xlsxioread_sheetlist_close(sheet_list);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
int is_number(const char *value)
|
||||
{
|
||||
if (strspn(value, ".0123456789") == strlen(value)) {
|
||||
return XLSWRITER_TRUE;
|
||||
}
|
||||
|
||||
return XLSWRITER_FALSE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
void data_to_null(zval *zv_result_t)
|
||||
{
|
||||
if (Z_TYPE_P(zv_result_t) == IS_ARRAY) {
|
||||
add_next_index_null(zv_result_t);
|
||||
} else {
|
||||
ZVAL_NULL(zv_result_t);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
void data_to_custom_type(const char *string_value, const size_t string_value_length, const zend_ulong type, zval *zv_result_t, const zend_ulong zv_hashtable_index)
|
||||
{
|
||||
if (type == 0) {
|
||||
goto STRING;
|
||||
}
|
||||
|
||||
if (!is_number(string_value)) {
|
||||
goto STRING;
|
||||
}
|
||||
|
||||
if (type & READ_TYPE_DATETIME) {
|
||||
if (string_value_length == 0) {
|
||||
data_to_null(zv_result_t);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
zend_long timestamp = date_double_to_timestamp(zend_strtod(string_value, NULL));
|
||||
|
||||
// GMT
|
||||
// if (value != 0) {
|
||||
// timestamp = (value - 25569) * 86400;
|
||||
// }
|
||||
|
||||
if (Z_TYPE_P(zv_result_t) == IS_ARRAY) {
|
||||
add_index_long(zv_result_t, zv_hashtable_index, timestamp);
|
||||
} else {
|
||||
ZVAL_LONG(zv_result_t, timestamp);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (type & READ_TYPE_DOUBLE) {
|
||||
if (string_value_length == 0) {
|
||||
data_to_null(zv_result_t);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(zv_result_t) == IS_ARRAY) {
|
||||
add_index_double(zv_result_t, zv_hashtable_index,strtod(string_value, NULL));
|
||||
} else {
|
||||
ZVAL_DOUBLE(zv_result_t, strtod(string_value, NULL));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (type & READ_TYPE_INT) {
|
||||
if (string_value_length == 0) {
|
||||
data_to_null(zv_result_t);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
zend_long _long_value;
|
||||
|
||||
sscanf(string_value, ZEND_LONG_FMT, &_long_value);
|
||||
|
||||
if (Z_TYPE_P(zv_result_t) == IS_ARRAY) {
|
||||
add_index_long(zv_result_t, zv_hashtable_index, _long_value);
|
||||
} else {
|
||||
ZVAL_LONG(zv_result_t, _long_value);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
STRING:
|
||||
|
||||
{
|
||||
if (!(type & READ_TYPE_STRING)) {
|
||||
zend_long _long = 0; double _double = 0;
|
||||
is_numeric_string(string_value, string_value_length, &_long, &_double, 0);
|
||||
|
||||
if (Z_TYPE_P(zv_result_t) == IS_ARRAY) {
|
||||
if (_double > 0 && _double <= (double)ZEND_LONG_MAX) {
|
||||
add_index_double(zv_result_t, zv_hashtable_index, _double);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_long > 0 && _long <= ZEND_LONG_MAX) {
|
||||
add_index_long(zv_result_t, zv_hashtable_index, _long);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (_double > 0 && _double <= (double)ZEND_LONG_MAX) {
|
||||
ZVAL_DOUBLE(zv_result_t, _double);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_long > 0 && _long <= ZEND_LONG_MAX) {
|
||||
ZVAL_LONG(zv_result_t, _long);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(zv_result_t) == IS_ARRAY) {
|
||||
add_index_stringl(zv_result_t, zv_hashtable_index, string_value, string_value_length);
|
||||
return;
|
||||
}
|
||||
|
||||
ZVAL_STRINGL(zv_result_t, string_value, string_value_length);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
int sheet_read_row(xlsxioreadersheet sheet_t)
|
||||
{
|
||||
return xlsxioread_sheet_next_row(sheet_t);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
unsigned int load_sheet_current_row_data(xlsxioreadersheet sheet_t, zval *zv_result_t, zval *zv_type_arr_t, zend_long data_type_default, unsigned int flag)
|
||||
{
|
||||
zend_long _type, _cell_index = 0, _last_cell_index = 0;
|
||||
zend_bool _skip_empty_value_cell = 0;
|
||||
zend_array *_za_type_t = NULL;
|
||||
char *_string_value = NULL;
|
||||
zval *_current_type = NULL;
|
||||
|
||||
if (flag && !sheet_read_row(sheet_t)) {
|
||||
return XLSWRITER_FALSE;
|
||||
}
|
||||
|
||||
if (xlsxioread_sheet_flags(sheet_t) & SKIP_EMPTY_VALUE) {
|
||||
_skip_empty_value_cell = 1;
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(zv_result_t) != IS_ARRAY) {
|
||||
array_init(zv_result_t);
|
||||
}
|
||||
|
||||
if (zv_type_arr_t != NULL && Z_TYPE_P(zv_type_arr_t) == IS_ARRAY) {
|
||||
_za_type_t = Z_ARR_P(zv_type_arr_t);
|
||||
}
|
||||
|
||||
while ((_string_value = xlsxioread_sheet_next_cell(sheet_t)) != NULL)
|
||||
{
|
||||
size_t _string_value_length = strlen(_string_value);
|
||||
|
||||
_type = READ_TYPE_EMPTY;
|
||||
_last_cell_index = xlsxioread_sheet_last_column_index(sheet_t) - 1;
|
||||
|
||||
if (_last_cell_index < 0 || (_skip_empty_value_cell && _string_value_length == 0)) {
|
||||
goto FREE_TMP_VALUE;
|
||||
}
|
||||
|
||||
if (_last_cell_index > _cell_index) {
|
||||
_cell_index = _last_cell_index;
|
||||
}
|
||||
|
||||
if (_za_type_t != NULL) {
|
||||
_current_type = zend_hash_index_find(_za_type_t, _cell_index);
|
||||
|
||||
if (_current_type != NULL && Z_TYPE_P(_current_type) == IS_LONG) {
|
||||
_type = Z_LVAL_P(_current_type);
|
||||
} else {
|
||||
_type = data_type_default;
|
||||
}
|
||||
} else {
|
||||
_type = data_type_default;
|
||||
}
|
||||
|
||||
data_to_custom_type(_string_value, _string_value_length, _type, zv_result_t, _cell_index);
|
||||
|
||||
FREE_TMP_VALUE:
|
||||
|
||||
++_cell_index;
|
||||
free(_string_value);
|
||||
}
|
||||
|
||||
return XLSWRITER_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
int sheet_row_callback (size_t row, size_t max_col, void* callback_data)
|
||||
{
|
||||
if (callback_data == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
xls_read_callback_data *_callback_data = (xls_read_callback_data *)callback_data;
|
||||
|
||||
zval args[3], retval;
|
||||
|
||||
_callback_data->fci->retval = &retval;
|
||||
_callback_data->fci->params = args;
|
||||
_callback_data->fci->param_count = 3;
|
||||
|
||||
ZVAL_LONG(&args[0], (row - 1));
|
||||
ZVAL_LONG(&args[1], (max_col - 1));
|
||||
ZVAL_STRING(&args[2], "XLSX_ROW_END");
|
||||
|
||||
zend_call_function(_callback_data->fci, _callback_data->fci_cache);
|
||||
|
||||
zval_ptr_dtor(&args[2]);
|
||||
zval_ptr_dtor(&retval);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
int sheet_cell_callback (size_t row, size_t col, const char *value, void *callback_data)
|
||||
{
|
||||
size_t _value_length = 0;
|
||||
|
||||
if (value != NULL) {
|
||||
_value_length = strlen(value);
|
||||
}
|
||||
|
||||
if (callback_data == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
xls_read_callback_data *_callback_data = (xls_read_callback_data *)callback_data;
|
||||
|
||||
if (_callback_data->fci == NULL || _callback_data->fci_cache == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
zval args[3], retval;
|
||||
|
||||
_callback_data->fci->retval = &retval;
|
||||
_callback_data->fci->params = args;
|
||||
_callback_data->fci->param_count = 3;
|
||||
|
||||
ZVAL_LONG(&args[0], (row - 1));
|
||||
ZVAL_LONG(&args[1], (col - 1));
|
||||
ZVAL_NULL(&args[2]);
|
||||
|
||||
if (value == NULL) {
|
||||
goto CALL_USER_FUNCTION;
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(_callback_data->zv_type_t) != IS_ARRAY && _callback_data->data_type_default == READ_TYPE_EMPTY) {
|
||||
zend_long _long = 0; double _double = 0;
|
||||
|
||||
if (is_numeric_string(value, _value_length, &_long, &_double, 0)) {
|
||||
if (_double > 0) {
|
||||
ZVAL_DOUBLE(&args[2], _double);
|
||||
} else {
|
||||
ZVAL_LONG(&args[2], _long);
|
||||
}
|
||||
} else {
|
||||
ZVAL_STRINGL(&args[2], value, _value_length);
|
||||
}
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(_callback_data->zv_type_t) != IS_ARRAY && _callback_data->data_type_default != READ_TYPE_EMPTY) {
|
||||
data_to_custom_type(value, _value_length, _callback_data->data_type_default, &args[2], 0);
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(_callback_data->zv_type_t) == IS_ARRAY) {
|
||||
zval *_current_type = NULL;
|
||||
zend_ulong _type = READ_TYPE_EMPTY;
|
||||
|
||||
if ((_current_type = zend_hash_index_find(Z_ARR_P(_callback_data->zv_type_t), (col - 1))) != NULL) {
|
||||
if (Z_TYPE_P(_current_type) == IS_LONG) {
|
||||
_type = Z_LVAL_P(_current_type);
|
||||
}
|
||||
}
|
||||
|
||||
data_to_custom_type(value, _value_length, _type, &args[2], 0);
|
||||
}
|
||||
|
||||
CALL_USER_FUNCTION:
|
||||
|
||||
zend_call_function(_callback_data->fci, _callback_data->fci_cache);
|
||||
|
||||
zval_ptr_dtor(&args[2]);
|
||||
zval_ptr_dtor(&retval);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
unsigned int load_sheet_current_row_data_callback (zend_string *zs_sheet_name_t, xlsxioreader file_t, void *callback_data)
|
||||
{
|
||||
if (zs_sheet_name_t == NULL) {
|
||||
return xlsxioread_process(file_t, NULL, XLSXIOREAD_SKIP_NONE, sheet_cell_callback, sheet_row_callback, callback_data);
|
||||
}
|
||||
|
||||
return xlsxioread_process(file_t, ZSTR_VAL(zs_sheet_name_t), XLSXIOREAD_SKIP_NONE, sheet_cell_callback, sheet_row_callback, callback_data);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
void load_sheet_row_data (xlsxioreadersheet sheet_t, zend_long sheet_flag, zval *zv_type_t, zend_long data_type_default, zval *zv_result_t)
|
||||
{
|
||||
size_t row_index = 0;
|
||||
|
||||
do {
|
||||
load_sheet_current_row_data(sheet_t, zv_result_t, zv_type_t, data_type_default, READ_ROW);
|
||||
|
||||
if (row_index == xlsxioread_sheet_last_row_index(sheet_t)) {
|
||||
return;
|
||||
}
|
||||
|
||||
row_index = xlsxioread_sheet_last_row_index(sheet_t);
|
||||
|
||||
if (sheet_flag & XLSXIOREAD_SKIP_EMPTY_ROWS
|
||||
&& Z_TYPE_P(zv_result_t) == IS_ARRAY
|
||||
&& zend_hash_num_elements(Z_ARR_P(zv_result_t)) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return;
|
||||
} while (1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
void load_sheet_all_data (xlsxioreadersheet sheet_t, zend_long sheet_flag, zval *zv_type_t, zend_long data_type_default, zval *zv_result_t)
|
||||
{
|
||||
if (Z_TYPE_P(zv_result_t) != IS_ARRAY) {
|
||||
array_init(zv_result_t);
|
||||
}
|
||||
|
||||
while (sheet_read_row(sheet_t))
|
||||
{
|
||||
zval _zv_tmp_row;
|
||||
ZVAL_NULL(&_zv_tmp_row);
|
||||
|
||||
load_sheet_current_row_data(sheet_t, &_zv_tmp_row, zv_type_t, data_type_default, READ_SKIP_ROW);
|
||||
|
||||
if (sheet_flag & XLSXIOREAD_SKIP_EMPTY_ROWS
|
||||
&& Z_TYPE(_zv_tmp_row) == IS_ARRAY
|
||||
&& zend_hash_num_elements(Z_ARR(_zv_tmp_row)) == 0) {
|
||||
zval_ptr_dtor(&_zv_tmp_row);
|
||||
continue;
|
||||
}
|
||||
|
||||
add_next_index_zval(zv_result_t, &_zv_tmp_row);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void skip_rows(xlsxioreadersheet sheet_t, zval *zv_type_t, zend_long data_type_default, zend_long zl_skip_row)
|
||||
{
|
||||
while (sheet_read_row(sheet_t))
|
||||
{
|
||||
zval _zv_tmp_row;
|
||||
ZVAL_NULL(&_zv_tmp_row);
|
||||
|
||||
if (xlsxioread_sheet_last_row_index(sheet_t) < zl_skip_row) {
|
||||
sheet_read_row(sheet_t);
|
||||
}
|
||||
|
||||
load_sheet_current_row_data(sheet_t, &_zv_tmp_row, zv_type_t, data_type_default, READ_SKIP_ROW);
|
||||
|
||||
zval_ptr_dtor(&_zv_tmp_row);
|
||||
|
||||
if (xlsxioread_sheet_last_row_index(sheet_t) >= zl_skip_row) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
kernel/read.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/read.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "xlswriter.h"
|
||||
|
||||
/* {{{ */
|
||||
xls_resource_write_t * zval_get_resource(zval *handle)
|
||||
{
|
||||
xls_resource_write_t *res;
|
||||
|
||||
if((res = (xls_resource_write_t *)zend_fetch_resource(Z_RES_P(handle), VTIFUL_RESOURCE_NAME, le_xls_writer)) == NULL) {
|
||||
zend_throw_exception(vtiful_exception_ce, "XLS resources resolution fail", 210);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
lxw_format * zval_get_format(zval *handle)
|
||||
{
|
||||
lxw_format *res = NULL;
|
||||
|
||||
if (handle == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (zval_get_type(handle) != IS_RESOURCE) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if((res = (lxw_format *)zend_fetch_resource(Z_RES_P(handle), VTIFUL_RESOURCE_NAME, le_xls_writer)) == NULL) {
|
||||
zend_throw_exception(vtiful_exception_ce, "format resources resolution fail", 210);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
xls_resource_chart_t *zval_get_chart(zval *resource)
|
||||
{
|
||||
xls_resource_chart_t *res;
|
||||
|
||||
if((res = (xls_resource_chart_t *)zend_fetch_resource(Z_RES_P(resource), VTIFUL_RESOURCE_NAME, le_xls_writer)) == NULL) {
|
||||
zend_throw_exception(vtiful_exception_ce, "chart resources resolution fail", 210);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
lxw_rich_string_tuple *zval_get_rich_string(zval *resource)
|
||||
{
|
||||
lxw_rich_string_tuple *res;
|
||||
|
||||
if((res = (lxw_rich_string_tuple *)zend_fetch_resource(Z_RES_P(resource), VTIFUL_RESOURCE_NAME, le_xls_writer)) == NULL) {
|
||||
zend_throw_exception(vtiful_exception_ce, "rich string resources resolution fail", 210);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
lxw_data_validation *zval_get_validation(zval *resource)
|
||||
{
|
||||
lxw_data_validation *res;
|
||||
|
||||
if((res = (lxw_data_validation *)zend_fetch_resource(Z_RES_P(resource), VTIFUL_RESOURCE_NAME, le_xls_writer)) == NULL) {
|
||||
zend_throw_exception(vtiful_exception_ce, "validation resources resolution fail", 210);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
/* }}} */
|
|
@ -0,0 +1,121 @@
|
|||
kernel/resource.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/resource.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h
|
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "xlswriter.h"
|
||||
|
||||
zend_class_entry *vtiful_rich_string_ce;
|
||||
|
||||
/* {{{ rich_string_objects_new
|
||||
*/
|
||||
static zend_object_handlers rich_string_handlers;
|
||||
|
||||
static zend_always_inline void *vtiful_rich_string_object_alloc(size_t obj_size, zend_class_entry *ce) {
|
||||
void *obj = emalloc(obj_size);
|
||||
memset(obj, 0, obj_size);
|
||||
return obj;
|
||||
}
|
||||
|
||||
PHP_VTIFUL_API zend_object *rich_string_objects_new(zend_class_entry *ce)
|
||||
{
|
||||
rich_string_object *rich_string = vtiful_rich_string_object_alloc(sizeof(rich_string_object), ce);
|
||||
|
||||
zend_object_std_init(&rich_string->zo, ce);
|
||||
object_properties_init(&rich_string->zo, ce);
|
||||
|
||||
rich_string->ptr.tuple = NULL;
|
||||
rich_string->zo.handlers = &rich_string_handlers;
|
||||
|
||||
return &rich_string->zo;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ rich_string_objects_free
|
||||
*/
|
||||
static void rich_string_objects_free(zend_object *object)
|
||||
{
|
||||
rich_string_object *intern = php_vtiful_rich_string_fetch_object(object);
|
||||
|
||||
if (intern->ptr.tuple != NULL) {
|
||||
efree(intern->ptr.tuple);
|
||||
intern->ptr.tuple = NULL;
|
||||
}
|
||||
|
||||
zend_object_std_dtor(&intern->zo);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ ARG_INFO
|
||||
*/
|
||||
ZEND_BEGIN_ARG_INFO_EX(rich_string_construct_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, text)
|
||||
ZEND_ARG_INFO(0, format_handle)
|
||||
ZEND_END_ARG_INFO()
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\RichString::__construct(string $text, resource $format)
|
||||
*/
|
||||
PHP_METHOD(vtiful_rich_string, __construct)
|
||||
{
|
||||
zend_string *text = NULL;
|
||||
zval *format_handle = NULL;
|
||||
rich_string_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 2)
|
||||
Z_PARAM_STR(text)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_RESOURCE_OR_NULL(format_handle)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj = Z_RICH_STR_P(getThis());
|
||||
|
||||
if (obj->ptr.tuple != NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
lxw_rich_string_tuple *instance = (lxw_rich_string_tuple *)ecalloc(1, sizeof(lxw_rich_string_tuple));
|
||||
|
||||
zend_string *zstr = zend_string_copy(text);
|
||||
|
||||
if (format_handle == NULL) {
|
||||
instance->format = NULL;
|
||||
instance->string = ZSTR_VAL(zstr);
|
||||
} else {
|
||||
instance->format = zval_get_format(format_handle);
|
||||
instance->string = ZSTR_VAL(zstr);
|
||||
}
|
||||
|
||||
obj->ptr.tuple = instance;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ rich_string_methods
|
||||
*/
|
||||
zend_function_entry rich_string_methods[] = {
|
||||
PHP_ME(vtiful_rich_string, __construct, rich_string_construct_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_FE_END
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/** {{{ VTIFUL_STARTUP_FUNCTION
|
||||
*/
|
||||
VTIFUL_STARTUP_FUNCTION(rich_string) {
|
||||
zend_class_entry ce;
|
||||
|
||||
INIT_NS_CLASS_ENTRY(ce, "Vtiful\\Kernel", "RichString", rich_string_methods);
|
||||
ce.create_object = rich_string_objects_new;
|
||||
vtiful_rich_string_ce = zend_register_internal_class(&ce);
|
||||
|
||||
memcpy(&rich_string_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
|
||||
rich_string_handlers.offset = XtOffsetOf(rich_string_object, zo);
|
||||
rich_string_handlers.free_obj = rich_string_objects_free;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
|
@ -0,0 +1,121 @@
|
|||
kernel/rich_string.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/rich_string.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h
|
|
@ -0,0 +1,826 @@
|
|||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "xlswriter.h"
|
||||
|
||||
zend_class_entry *vtiful_validation_ce;
|
||||
|
||||
/* {{{ validation_objects_new
|
||||
*/
|
||||
static zend_object_handlers validation_handlers;
|
||||
|
||||
static zend_always_inline void *vtiful_validation_object_alloc(size_t obj_size, zend_class_entry *ce) {
|
||||
void *obj = emalloc(obj_size);
|
||||
memset(obj, 0, obj_size);
|
||||
return obj;
|
||||
}
|
||||
|
||||
PHP_VTIFUL_API zend_object *validation_objects_new(zend_class_entry *ce)
|
||||
{
|
||||
validation_object *validation = vtiful_validation_object_alloc(sizeof(validation_object), ce);
|
||||
|
||||
zend_object_std_init(&validation->zo, ce);
|
||||
object_properties_init(&validation->zo, ce);
|
||||
|
||||
validation->ptr.validation = NULL;
|
||||
|
||||
validation->zo.handlers = &validation_handlers;
|
||||
|
||||
return &validation->zo;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ validation_objects_free
|
||||
*/
|
||||
static void validation_objects_free(zend_object *object)
|
||||
{
|
||||
validation_object *intern = php_vtiful_validation_fetch_object(object);
|
||||
|
||||
if (intern->ptr.validation->value_list != NULL) {
|
||||
int index = 0;
|
||||
|
||||
do {
|
||||
if (intern->ptr.validation->value_list[index] == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
efree(intern->ptr.validation->value_list[index]);
|
||||
index++;
|
||||
} while (1);
|
||||
|
||||
efree(intern->ptr.validation->value_list);
|
||||
}
|
||||
|
||||
if (intern->ptr.validation != NULL) {
|
||||
efree(intern->ptr.validation);
|
||||
}
|
||||
|
||||
zend_object_std_dtor(&intern->zo);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ ARG_INFO
|
||||
*/
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_construct_arginfo, 0, 0, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_type_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, type)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_criteria_type_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, type)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_ignore_blank_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, ignore_blank)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_show_input_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, show_input)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_show_error_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, show_error)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_error_type_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, error_type)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_dropdown_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, dropdown)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_value_number_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, value_number)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_value_formula_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, value_formula)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_value_list_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, value_list)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_value_date_time_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, timestamp)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_minimum_number_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, minimum_number)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_minimum_formula_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, minimum_formula)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_minimum_datetime_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, timestamp)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_maximum_number_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, maximum_number)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_maximum_formula_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, maximum_formula)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_maximum_datetime_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, maximum_datetime)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_input_title_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, input_title)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_input_message_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, input_message)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_error_title_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, error_titile)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_error_message_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, error_message)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_to_resource_arginfo, 0, 0, 1)
|
||||
ZEND_END_ARG_INFO()
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::__construct()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, __construct)
|
||||
{
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
obj->ptr.validation = ecalloc(1, sizeof(lxw_data_validation));
|
||||
}
|
||||
|
||||
obj->ptr.validation->value_list = NULL;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::validationType()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, validationType)
|
||||
{
|
||||
zend_long zl_validate_type = 0;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(zl_validate_type)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
if (zl_validate_type < LXW_VALIDATION_TYPE_NONE || zl_validate_type > LXW_VALIDATION_TYPE_ANY) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->validate = zl_validate_type;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::criteriaType()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, criteriaType)
|
||||
{
|
||||
zend_long zl_criteria_type = 0;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(zl_criteria_type)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
if (zl_criteria_type < LXW_VALIDATION_CRITERIA_NONE || zl_criteria_type > LXW_VALIDATION_CRITERIA_LESS_THAN_OR_EQUAL_TO) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->criteria = zl_criteria_type;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::ignoreBlank()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, ignoreBlank)
|
||||
{
|
||||
zend_bool zb_ignore_blank = 1;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_BOOL(zb_ignore_blank)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
if (zb_ignore_blank) {
|
||||
obj->ptr.validation->ignore_blank = LXW_VALIDATION_ON;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
obj->ptr.validation->ignore_blank = LXW_VALIDATION_OFF;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::showInput()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, showInput)
|
||||
{
|
||||
zend_bool zb_show_input = 1;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_BOOL(zb_show_input)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
if (zb_show_input) {
|
||||
obj->ptr.validation->show_input = LXW_VALIDATION_ON;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
obj->ptr.validation->show_input = LXW_VALIDATION_OFF;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::showError()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, showError)
|
||||
{
|
||||
zend_bool zb_show_error = 1;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_BOOL(zb_show_error)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
if (zb_show_error) {
|
||||
obj->ptr.validation->show_error = LXW_VALIDATION_ON;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
obj->ptr.validation->show_error = LXW_VALIDATION_OFF;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::errorType()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, errorType)
|
||||
{
|
||||
zend_long zl_error_type = 0;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(zl_error_type)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
if (zl_error_type < LXW_VALIDATION_ERROR_TYPE_STOP || zl_error_type > LXW_VALIDATION_ERROR_TYPE_INFORMATION) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->error_type = zl_error_type;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::dropdown()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, dropdown)
|
||||
{
|
||||
zend_bool zb_dropdown = 1;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_BOOL(zb_dropdown)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
if (zb_dropdown) {
|
||||
obj->ptr.validation->dropdown = LXW_VALIDATION_ON;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
obj->ptr.validation->dropdown = LXW_VALIDATION_OFF;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::valueNumber()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, valueNumber)
|
||||
{
|
||||
zend_long zl_value_number = 0;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(zl_value_number)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->value_number = zl_value_number;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::valueFormula()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, valueFormula)
|
||||
{
|
||||
zend_string *zs_value_formula = NULL;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(zs_value_formula)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->value_formula = ZSTR_VAL(zs_value_formula);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::valueList()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, valueList)
|
||||
{
|
||||
int index = 0;
|
||||
char **list = NULL;
|
||||
|
||||
zval *data;
|
||||
zval *zv_value_list = NULL;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_ARRAY(zv_value_list)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
if (obj->ptr.validation->value_list != NULL) {
|
||||
do {
|
||||
if (obj->ptr.validation->value_list[index] == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
efree(obj->ptr.validation->value_list[index]);
|
||||
index++;
|
||||
} while (1);
|
||||
|
||||
efree(obj->ptr.validation->value_list);
|
||||
obj->ptr.validation->value_list = NULL;
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
zend_array *za_value_list = Z_ARR_P(zv_value_list);
|
||||
|
||||
ZEND_HASH_FOREACH_VAL(za_value_list, data) {
|
||||
if (Z_TYPE_P(data) != IS_STRING) {
|
||||
zend_throw_exception(vtiful_exception_ce, "Arrays can only consist of strings.", 300);
|
||||
return;
|
||||
}
|
||||
if (Z_STRLEN_P(data) == 0 ) {
|
||||
zend_throw_exception(vtiful_exception_ce, "Array value is empty string.", 301);
|
||||
return;
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
index = 0;
|
||||
list = ecalloc(za_value_list->nNumOfElements + 1, sizeof(char *));
|
||||
|
||||
ZEND_HASH_FOREACH_VAL(za_value_list, data) {
|
||||
list[index] = ecalloc(1, Z_STRLEN_P(data) + 1);
|
||||
strcpy(list[index], Z_STRVAL_P(data));
|
||||
index++;
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
list[index] = NULL;
|
||||
|
||||
obj->ptr.validation->value_list = list;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::valueDatetime(int $timestamp)
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, valueDatetime)
|
||||
{
|
||||
zend_long timestamp = 0;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(timestamp)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
obj->ptr.validation->value_datetime = timestamp_to_datetime(timestamp);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::minimumNumber(double $minimumNumber)
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, minimumNumber)
|
||||
{
|
||||
double minimum_number = 0;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_DOUBLE(minimum_number)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->minimum_number = minimum_number;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::minimumFormula()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, minimumFormula)
|
||||
{
|
||||
zend_string *zs_minimum_formula = NULL;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(zs_minimum_formula)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->minimum_formula = ZSTR_VAL(zs_minimum_formula);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::minimumDatetime(int $timestamp)
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, minimumDatetime)
|
||||
{
|
||||
zend_long timestamp = 0;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(timestamp)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
obj->ptr.validation->minimum_datetime = timestamp_to_datetime(timestamp);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::maximumNumber(double $maximumNumber)
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, maximumNumber)
|
||||
{
|
||||
double maximum_number = 0;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_DOUBLE(maximum_number)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->maximum_number = maximum_number;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::maximumFormula()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, maximumFormula)
|
||||
{
|
||||
zend_string *zs_maximum_formula = NULL;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(zs_maximum_formula)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->maximum_formula = ZSTR_VAL(zs_maximum_formula);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::maximumDatetime(int $timestamp)
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, maximumDatetime)
|
||||
{
|
||||
zend_long timestamp = 0;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(timestamp)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
obj->ptr.validation->maximum_datetime = timestamp_to_datetime(timestamp);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::inputTitle()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, inputTitle)
|
||||
{
|
||||
zend_string *zs_input_title = NULL;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(zs_input_title)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->input_title = ZSTR_VAL(zs_input_title);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::inputMessage()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, inputMessage)
|
||||
{
|
||||
zend_string *zs_input_message = NULL;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(zs_input_message)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->input_message = ZSTR_VAL(zs_input_message);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::errorTitle()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, errorTitle)
|
||||
{
|
||||
zend_string *zs_error_title = NULL;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(zs_error_title)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->error_title = ZSTR_VAL(zs_error_title);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::errorMessage()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, errorMessage)
|
||||
{
|
||||
zend_string *zs_error_message = NULL;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(zs_error_message)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->error_message = ZSTR_VAL(zs_error_message);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::toResource()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, toResource)
|
||||
{
|
||||
validation_object *obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
RETURN_RES(zend_register_resource(obj->ptr.validation, le_xls_writer));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ validation_methods
|
||||
*/
|
||||
zend_function_entry validation_methods[] = {
|
||||
PHP_ME(vtiful_validation, __construct, validation_construct_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, validationType, validation_type_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, criteriaType, validation_criteria_type_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, ignoreBlank, validation_ignore_blank_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, showInput, validation_show_input_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, showError , validation_show_error_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, errorType , validation_error_type_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, dropdown , validation_dropdown_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, valueNumber, validation_value_number_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, valueFormula, validation_value_formula_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, valueList, validation_value_list_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, valueDatetime, validation_value_date_time_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, minimumNumber, validation_minimum_number_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, minimumFormula, validation_minimum_formula_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, minimumDatetime, validation_minimum_datetime_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, maximumNumber, validation_maximum_number_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, maximumFormula, validation_maximum_formula_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, maximumDatetime, validation_maximum_datetime_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, inputTitle, validation_input_title_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, inputMessage, validation_input_message_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, errorTitle, validation_error_title_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, errorMessage, validation_error_message_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, toResource, validation_to_resource_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_FE_END
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/** {{{ VTIFUL_STARTUP_FUNCTION
|
||||
*/
|
||||
VTIFUL_STARTUP_FUNCTION(validation) {
|
||||
zend_class_entry ce;
|
||||
|
||||
INIT_NS_CLASS_ENTRY(ce, "Vtiful\\Kernel", "Validation", validation_methods);
|
||||
ce.create_object = validation_objects_new;
|
||||
vtiful_validation_ce = zend_register_internal_class(&ce);
|
||||
|
||||
memcpy(&validation_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
|
||||
validation_handlers.offset = XtOffsetOf(validation_object, zo);
|
||||
validation_handlers.free_obj = validation_objects_free;
|
||||
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_INTEGER", LXW_VALIDATION_TYPE_INTEGER)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_INTEGER_FORMULA", LXW_VALIDATION_TYPE_INTEGER_FORMULA)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_DECIMAL", LXW_VALIDATION_TYPE_DECIMAL)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_DECIMAL_FORMULA", LXW_VALIDATION_TYPE_DECIMAL_FORMULA)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_LIST", LXW_VALIDATION_TYPE_LIST)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_LIST_FORMULA", LXW_VALIDATION_TYPE_LIST_FORMULA)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_DATE", LXW_VALIDATION_TYPE_DATE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_DATE_FORMULA", LXW_VALIDATION_TYPE_DATE_FORMULA)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_DATE_NUMBER", LXW_VALIDATION_TYPE_DATE_NUMBER)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_TIME", LXW_VALIDATION_TYPE_TIME)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_TIME_FORMULA", LXW_VALIDATION_TYPE_TIME_FORMULA)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_TIME_NUMBER", LXW_VALIDATION_TYPE_TIME_NUMBER)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_LENGTH", LXW_VALIDATION_TYPE_LENGTH)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_LENGTH_FORMULA", LXW_VALIDATION_TYPE_LENGTH_FORMULA)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_CUSTOM_FORMULA", LXW_VALIDATION_TYPE_CUSTOM_FORMULA)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_ANY", LXW_VALIDATION_TYPE_ANY)
|
||||
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "CRITERIA_BETWEEN", LXW_VALIDATION_CRITERIA_BETWEEN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "CRITERIA_NOT_BETWEEN", LXW_VALIDATION_CRITERIA_NOT_BETWEEN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "CRITERIA_EQUAL_TO", LXW_VALIDATION_CRITERIA_EQUAL_TO)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "CRITERIA_NOT_EQUAL_TO", LXW_VALIDATION_CRITERIA_NOT_EQUAL_TO)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "CRITERIA_GREATER_THAN", LXW_VALIDATION_CRITERIA_GREATER_THAN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "CRITERIA_LESS_THAN", LXW_VALIDATION_CRITERIA_LESS_THAN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "CRITERIA_GREATER_THAN_OR_EQUAL_TO", LXW_VALIDATION_CRITERIA_GREATER_THAN_OR_EQUAL_TO)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "CRITERIA_LESS_THAN_OR_EQUAL_TO", LXW_VALIDATION_CRITERIA_LESS_THAN_OR_EQUAL_TO)
|
||||
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "ERROR_TYPE_STOP", LXW_VALIDATION_ERROR_TYPE_STOP)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "ERROR_TYPE_WARNING", LXW_VALIDATION_ERROR_TYPE_WARNING)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "ERROR_TYPE_INFORMATION", LXW_VALIDATION_ERROR_TYPE_INFORMATION)
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
|
@ -0,0 +1,121 @@
|
|||
kernel/validation.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/validation.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,121 @@
|
|||
kernel/write.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/write.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h
|
|
@ -0,0 +1,37 @@
|
|||
# CVS default ignores begin
|
||||
tags
|
||||
TAGS
|
||||
.make.state
|
||||
.nse_depinfo
|
||||
*~
|
||||
#*
|
||||
.#*
|
||||
,*
|
||||
_$*
|
||||
*$
|
||||
*.old
|
||||
*.bak
|
||||
*.BAK
|
||||
*.orig
|
||||
*.rej
|
||||
.del-*
|
||||
*.a
|
||||
*.olb
|
||||
*.o
|
||||
*.obj
|
||||
*.so
|
||||
*.exe
|
||||
*.Z
|
||||
*.elc
|
||||
*.ln
|
||||
core
|
||||
# CVS default ignores end
|
||||
expat/win32/bin/
|
||||
expat/win32/tmp/
|
||||
expat/.vs/
|
||||
expat/**/*.vcxproj.user
|
||||
expat/**/*.suo
|
||||
expat/**/*.sdf
|
||||
expat/**/*.VC.db
|
||||
expat/tests/**/Debug/
|
||||
expat/tests/**/Release/
|
|
@ -0,0 +1,64 @@
|
|||
#! /bin/bash
|
||||
# __ __ _
|
||||
# ___\ \/ /_ __ __ _| |_
|
||||
# / _ \\ /| '_ \ / _` | __|
|
||||
# | __// \| |_) | (_| | |_
|
||||
# \___/_/\_\ .__/ \__,_|\__|
|
||||
# |_| XML parser
|
||||
#
|
||||
# Copyright (c) 2017 Expat development team
|
||||
# Licensed under the MIT license:
|
||||
#
|
||||
# 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.
|
||||
|
||||
set -e
|
||||
|
||||
if [[ ${TRAVIS_OS_NAME} = osx ]]; then
|
||||
export PATH="/usr/local/opt/coreutils/libexec/gnubin${PATH:+:}${PATH}"
|
||||
fi
|
||||
|
||||
PS4='# '
|
||||
set -x
|
||||
|
||||
cd expat
|
||||
./buildconf.sh
|
||||
|
||||
if [[ ${MODE} = distcheck ]]; then
|
||||
./configure
|
||||
make distcheck
|
||||
|
||||
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
|
||||
ln -v -s "$PWD"/expat-*.tar.bz2 ~/rpmbuild/SOURCES/
|
||||
rpmbuild -ba expat.spec
|
||||
elif [[ ${MODE} = cmake ]]; then
|
||||
cmake .
|
||||
make all test
|
||||
make DESTDIR="${PWD}"/ROOT install
|
||||
find ROOT -printf "%P\n" | sort
|
||||
elif [[ ${MODE} = cmake-oos ]]; then
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make all test
|
||||
make DESTDIR="${PWD}"/ROOT install
|
||||
find ROOT -printf "%P\n" | sort
|
||||
else
|
||||
./qa.sh "${MODE}"
|
||||
fi
|
|
@ -0,0 +1,46 @@
|
|||
# Copyright (C) 2017 Sebastian Pipping <sebastian@pipping.org>
|
||||
# Licensed under the MIT license
|
||||
|
||||
language: cpp
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
dist: trusty
|
||||
|
||||
# Unbreak clang address sanitizer, needs SYS_PTRACE
|
||||
# https://github.com/google/sanitizers/issues/764#issuecomment-276663297
|
||||
# https://github.com/travis-ci/travis-ci/issues/9033
|
||||
sudo: required
|
||||
|
||||
git:
|
||||
depth: 1
|
||||
|
||||
env:
|
||||
global:
|
||||
- CFLAGS='-g -pipe'
|
||||
matrix:
|
||||
- MODE=address
|
||||
- MODE=cmake
|
||||
- MODE=cmake-oos
|
||||
- MODE=distcheck
|
||||
- MODE=lib-coverage
|
||||
|
||||
matrix:
|
||||
exclude:
|
||||
- os: osx
|
||||
env: MODE=lib-coverage
|
||||
|
||||
addons:
|
||||
homebrew:
|
||||
update: true
|
||||
brewfile: true
|
||||
apt:
|
||||
packages:
|
||||
- cmake
|
||||
- docbook2x
|
||||
- dos2unix
|
||||
- lzip
|
||||
- rpm
|
||||
|
||||
script:
|
||||
- ./.travis.sh
|
|
@ -0,0 +1,13 @@
|
|||
brew "autoconf"
|
||||
brew "automake"
|
||||
brew "cmake"
|
||||
brew "coreutils"
|
||||
brew "docbook2x"
|
||||
brew "dos2unix"
|
||||
brew "gcc"
|
||||
brew "gettext"
|
||||
brew "ghostscript"
|
||||
brew "libtool"
|
||||
brew "lzip"
|
||||
brew "m4"
|
||||
brew "rpm"
|
|
@ -0,0 +1 @@
|
|||
expat/README.md
|
|
@ -0,0 +1,175 @@
|
|||
# AppVeyor configuration
|
||||
# __ __ _
|
||||
# ___\ \/ /_ __ __ _| |_
|
||||
# / _ \\ /| '_ \ / _` | __|
|
||||
# | __// \| |_) | (_| | |_
|
||||
# \___/_/\_\ .__/ \__,_|\__|
|
||||
# |_| XML parser
|
||||
#
|
||||
# Copyright (C) 2017 José Gutiérrez de la Concha <jose@zeroc.com>
|
||||
# Copyright (C) 2017 Expat development team
|
||||
# Licensed under the MIT license:
|
||||
#
|
||||
# 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.
|
||||
|
||||
# scripts that are called at very beginning, before repo cloning
|
||||
init:
|
||||
- git config --global core.autocrlf input
|
||||
|
||||
# version format
|
||||
version: libexpat-{build}
|
||||
|
||||
# set clone depth, clone entire repository history if not defined
|
||||
clone_depth: 1
|
||||
|
||||
# clone directory
|
||||
clone_folder: c:\projects\libexpat
|
||||
|
||||
configuration: Debug
|
||||
|
||||
# AppVeyor pre-installed software:
|
||||
# https://www.appveyor.com/docs/build-environment/#pre-installed-software
|
||||
#
|
||||
# CMake Visual Studio generators:
|
||||
# https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#visual-studio-generators
|
||||
environment:
|
||||
matrix:
|
||||
# Visual Studio 2010 Win32
|
||||
- GENERATOR: Visual Studio 10 2010
|
||||
PLATFORM: Win32
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
|
||||
# Visual Studio 2010 Win32 XML_UNICODE_WCHAR_T
|
||||
- GENERATOR: Visual Studio 10 2010
|
||||
PLATFORM: Win32
|
||||
CFLAGS: -DXML_UNICODE -DXML_UNICODE_WCHAR_T
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
|
||||
# Visual Studio 2010 x64
|
||||
- GENERATOR: Visual Studio 10 2010 Win64
|
||||
PLATFORM: x64
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
|
||||
# Visual Studio 2010 x64 XML_UNICODE_WCHAR_T
|
||||
- GENERATOR: Visual Studio 10 2010 Win64
|
||||
PLATFORM: x64
|
||||
CFLAGS: -DXML_UNICODE -DXML_UNICODE_WCHAR_T
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
|
||||
# Visual Studio 2012 Win32
|
||||
- GENERATOR: Visual Studio 11 2012
|
||||
PLATFORM: Win32
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
|
||||
# Visual Studio 2012 Win32 XML_UNICODE_WCHAR_T
|
||||
- GENERATOR: Visual Studio 11 2012
|
||||
PLATFORM: Win32
|
||||
CFLAGS: -DXML_UNICODE -DXML_UNICODE_WCHAR_T
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
|
||||
# Visual Studio 2012 x64
|
||||
- GENERATOR: Visual Studio 11 2012 Win64
|
||||
PLATFORM: x64
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
|
||||
# Visual Studio 2012 x64 XML_UNICODE_WCHAR_T
|
||||
- GENERATOR: Visual Studio 11 2012 Win64
|
||||
PLATFORM: x64
|
||||
CFLAGS: -DXML_UNICODE -DXML_UNICODE_WCHAR_T
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
|
||||
# Visual Studio 2013 Win32
|
||||
- GENERATOR: Visual Studio 12 2013
|
||||
PLATFORM: Win32
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
|
||||
# Visual Studio 2013 Win32 XML_UNICODE_WCHAR_T
|
||||
- GENERATOR: Visual Studio 12 2013
|
||||
PLATFORM: Win32
|
||||
CFLAGS: -DXML_UNICODE -DXML_UNICODE_WCHAR_T
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
|
||||
# Visual Studio 2013 x64
|
||||
- GENERATOR: Visual Studio 12 2013 Win64
|
||||
PLATFORM: x64
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
|
||||
# Visual Studio 2013 x64 XML_UNICODE_WCHAR_T
|
||||
- GENERATOR: Visual Studio 12 2013 Win64
|
||||
PLATFORM: x64
|
||||
CFLAGS: -DXML_UNICODE -DXML_UNICODE_WCHAR_T
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
|
||||
# Visual Studio 2015 Win32
|
||||
- GENERATOR: Visual Studio 14 2015
|
||||
PLATFORM: Win32
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
|
||||
# Visual Studio 2015 Win32 XML_UNICODE_WCHAR_T
|
||||
- GENERATOR: Visual Studio 14 2015
|
||||
PLATFORM: Win32
|
||||
CFLAGS: -DXML_UNICODE -DXML_UNICODE_WCHAR_T
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
|
||||
# Visual Studio 2015 x64
|
||||
- GENERATOR: Visual Studio 14 2015 Win64
|
||||
PLATFORM: x64
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
|
||||
# Visual Studio 2015 x64 XML_UNICODE_WCHAR_T
|
||||
- GENERATOR: Visual Studio 14 2015 Win64
|
||||
PLATFORM: x64
|
||||
CFLAGS: -DXML_UNICODE -DXML_UNICODE_WCHAR_T
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
|
||||
# Visual Studio 2017 Win32
|
||||
- GENERATOR: Visual Studio 15 2017
|
||||
PLATFORM: Win32
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
|
||||
# Visual Studio 2017 Win32 XML_UNICODE_WCHAR_T
|
||||
- GENERATOR: Visual Studio 15 2017
|
||||
PLATFORM: Win32
|
||||
CFLAGS: -DXML_UNICODE -DXML_UNICODE_WCHAR_T
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
|
||||
# Visual Studio 2017 x64
|
||||
- GENERATOR: Visual Studio 15 2017 Win64
|
||||
PLATFORM: x64
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
|
||||
# Visual Studio 2017 x64 XML_UNICODE_WCHAR_T
|
||||
- GENERATOR: Visual Studio 15 2017 Win64
|
||||
PLATFORM: x64
|
||||
CFLAGS: -DXML_UNICODE -DXML_UNICODE_WCHAR_T
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
|
||||
before_build:
|
||||
- echo Running cmake...
|
||||
- cd c:\projects\libexpat
|
||||
- cmake -DWARNINGS_AS_ERRORS=ON -G"%GENERATOR%" expat
|
||||
|
||||
build:
|
||||
parallel: true # enable MSBuild parallel builds
|
||||
project: expat.sln # path to Visual Studio solution or project
|
||||
|
||||
test_script:
|
||||
- cp Debug\expatd.dll tests\Debug
|
||||
- tests\Debug\runtests.exe
|
|
@ -0,0 +1,39 @@
|
|||
/autom4te.cache/
|
||||
m4/
|
||||
CMakeFiles/
|
||||
Testing/
|
||||
aclocal.m4
|
||||
CMakeCache.txt
|
||||
cmake_install.cmake
|
||||
CTestTestfile.cmake
|
||||
install_manifest.txt
|
||||
Makefile
|
||||
.deps
|
||||
Makefile.in
|
||||
.libs
|
||||
*.la
|
||||
configure
|
||||
config.cache
|
||||
config.log
|
||||
config.status
|
||||
expat_config.h.in
|
||||
expat_config.h
|
||||
libtool
|
||||
expat.ncb
|
||||
expat.opt
|
||||
.project
|
||||
expat.pc
|
||||
*.gcda
|
||||
*.gcno
|
||||
*.gcov
|
||||
*.nccout
|
||||
*.expand
|
||||
/callgraph.svg
|
||||
/libexpat.so.*
|
||||
/run.sh
|
||||
build__R*
|
||||
coverage__R*
|
||||
source__R*
|
||||
/expat-*.tar.bz2
|
||||
/expat-*.tar.bz2.asc
|
||||
/stamp-h1
|
|
@ -0,0 +1,10 @@
|
|||
Expat is brought to you by:
|
||||
|
||||
Clark Cooper
|
||||
Fred L. Drake, Jr.
|
||||
Greg Stein
|
||||
James Clark
|
||||
Karl Waclawek
|
||||
Rhodri James
|
||||
Sebastian Pipping
|
||||
Steven Solie
|
|
@ -0,0 +1,42 @@
|
|||
== How to build expat with cmake (experimental) ==
|
||||
|
||||
The cmake based buildsystem for expat works on Windows (cygwin, mingw, Visual
|
||||
Studio) and should work on all other platform cmake supports.
|
||||
|
||||
Assuming ~/expat-2.2.7 is the source directory of expat, add a subdirectory
|
||||
build and change into that directory:
|
||||
~/expat-2.2.7$ mkdir build && cd build
|
||||
~/expat-2.2.7/build$
|
||||
|
||||
From that directory, call cmake first, then call make, make test and
|
||||
make install in the usual way:
|
||||
~/expat-2.2.7/build$ cmake ..
|
||||
-- The C compiler identification is GNU
|
||||
-- The CXX compiler identification is GNU
|
||||
....
|
||||
-- Configuring done
|
||||
-- Generating done
|
||||
-- Build files have been written to: /home/patrick/expat-2.2.7/build
|
||||
|
||||
If you want to specify the install location for your files, append
|
||||
-DCMAKE_INSTALL_PREFIX=/your/install/path to the cmake call.
|
||||
|
||||
~/expat-2.2.7/build$ make && make test && make install
|
||||
Scanning dependencies of target expat
|
||||
[ 5%] Building C object CMakeFiles/expat.dir/lib/xmlparse.c.o
|
||||
[ 11%] Building C object CMakeFiles/expat.dir/lib/xmlrole.c.o
|
||||
....
|
||||
-- Installing: /usr/local/lib/pkgconfig/expat.pc
|
||||
-- Installing: /usr/local/bin/xmlwf
|
||||
-- Installing: /usr/local/share/man/man1/xmlwf.1
|
||||
|
||||
For Windows builds, you must make sure to call cmake from an environment where
|
||||
your compiler is reachable, that means either you call it from the
|
||||
Visual Studio Command Prompt or when using mingw, you must open a cmd.exe and
|
||||
make sure that gcc can be called. On Windows, you also might want to specify a
|
||||
special Generator for CMake:
|
||||
for Visual Studio builds do:
|
||||
cmake .. -G "Visual Studio 10" && vcexpress expat.sln
|
||||
for mingw builds do:
|
||||
cmake .. -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=D:\expat-install
|
||||
&& gmake && gmake install
|
|
@ -0,0 +1,21 @@
|
|||
Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper
|
||||
Copyright (c) 2001-2017 Expat maintainers
|
||||
|
||||
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.
|
|
@ -0,0 +1,635 @@
|
|||
NOTE: We are looking for help with a few things:
|
||||
https://github.com/libexpat/libexpat/labels/help%20wanted
|
||||
If you can help, please get in touch. Thanks!
|
||||
|
||||
Release 2.2.7 Wed June 19 2019
|
||||
Security fixes:
|
||||
#186 #262 Fix extraction of namespace prefixes from XML names;
|
||||
XML names with multiple colons could end up in the
|
||||
wrong namespace, and take a high amount of RAM and CPU
|
||||
resources while processing, opening the door to
|
||||
use for denial-of-service attacks
|
||||
|
||||
Other changes:
|
||||
#195 #197 Autotools/CMake: Utilize -fvisibility=hidden to stop
|
||||
exporting non-API symbols
|
||||
#227 Autotools: Add --without-examples and --without-tests
|
||||
#228 Autotools: Modernize configure.ac
|
||||
#245 #246 Autotools: Fix check for -fvisibility=hidden for Clang
|
||||
#247 #248 Autotools: Fix compilation for lack of docbook2x-man
|
||||
#236 #258 Autotools: Produce .tar.{gz,lz,xz} release archives
|
||||
#212 CMake: Make libdir of pkgconfig expat.pc support multilib
|
||||
#158 #263 CMake: Build man page in PROJECT_BINARY_DIR not _SOURCE_DIR
|
||||
#219 Remove fallback to bcopy, assume that memmove(3) exists
|
||||
#257 Use portable "/usr/bin/env bash" shebang (e.g. for OpenBSD)
|
||||
#243 Windows: Fix syntax of .def module definition files
|
||||
Version info bumped from 7:8:6 to 7:9:6
|
||||
|
||||
Special thanks to:
|
||||
Benjamin Peterson
|
||||
Caolán McNamara
|
||||
Hanno Böck
|
||||
KangLin
|
||||
Kishore Kunche
|
||||
Marco Maggi
|
||||
Rhodri James
|
||||
Sebastian Dröge
|
||||
userwithuid
|
||||
Yury Gribov
|
||||
|
||||
Release 2.2.6 Sun August 12 2018
|
||||
Bug fixes:
|
||||
#170 #206 Avoid doing arithmetic with NULL pointers in XML_GetBuffer
|
||||
#204 #205 Fix 2.2.5 regression with suspend-resume while parsing
|
||||
a document like '<root/>'
|
||||
|
||||
Other changes:
|
||||
#165 #168 Autotools: Fix docbook-related configure syntax error
|
||||
#166 Autotools: Avoid grep option `-q` for Solaris
|
||||
#167 Autotools: Support
|
||||
./configure DOCBOOK_TO_MAN="xmlto man --skip-validation"
|
||||
#159 #167 Autotools: Support DOCBOOK_TO_MAN command which produces
|
||||
xmlwf.1 rather than XMLWF.1; also covers case insensitive
|
||||
file systems
|
||||
#181 Autotools: Drop -rpath option passed to libtool
|
||||
#188 Autotools: Detect and deny SGML docbook2man as ours is XML
|
||||
#188 Autotools/CMake: Support command db2x_docbook2man as well
|
||||
#174 CMake: Introduce option WARNINGS_AS_ERRORS, defaults to OFF
|
||||
#184 #185 CMake: Introduce option MSVC_USE_STATIC_CRT, defaults to OFF
|
||||
#207 #208 CMake: Introduce option XML_UNICODE and XML_UNICODE_WCHAR_T,
|
||||
both defaulting to OFF
|
||||
#175 CMake: Prefer check_symbol_exists over check_function_exists
|
||||
#176 CMake: Create the same pkg-config file as with GNU Autotools
|
||||
#178 #179 CMake: Use GNUInstallDirs module to set proper defaults for
|
||||
install directories
|
||||
#208 CMake: Utilize expat_config.h.cmake for XML_DEV_URANDOM
|
||||
#180 Windows: Fix compilation of test suite for Visual Studio 2008
|
||||
#131 #173 #202 Address compiler warnings
|
||||
#187 #190 #200 Fix miscellaneous typos
|
||||
Version info bumped from 7:7:6 to 7:8:6
|
||||
|
||||
Special thanks to:
|
||||
Anton Maklakov
|
||||
Benjamin Peterson
|
||||
Brad King
|
||||
Franek Korta
|
||||
Frank Rast
|
||||
Joe Orton
|
||||
luzpaz
|
||||
Pedro Vicente
|
||||
Rainer Jung
|
||||
Rhodri James
|
||||
Rolf Ade
|
||||
Rolf Eike Beer
|
||||
Thomas Beutlich
|
||||
Tomasz Kłoczko
|
||||
|
||||
Release 2.2.5 Tue October 31 2017
|
||||
Bug fixes:
|
||||
#8 If the parser runs out of memory, make sure its internal
|
||||
state reflects the memory it actually has, not the memory
|
||||
it wanted to have.
|
||||
#11 The default handler wasn't being called when it should for
|
||||
a SYSTEM or PUBLIC doctype if an entity declaration handler
|
||||
was registered.
|
||||
#137 #138 Fix a case of mistakenly reported parsing success where
|
||||
XML_StopParser was called from an element handler
|
||||
#162 Function XML_ErrorString was returning NULL rather than
|
||||
a message for code XML_ERROR_INVALID_ARGUMENT
|
||||
introduced with release 2.2.1
|
||||
|
||||
Other changes:
|
||||
#106 xmlwf: Add argument -N adding notation declarations
|
||||
#75 #106 Test suite: Resolve expected failure cases where xmlwf
|
||||
output was incomplete
|
||||
#127 Windows: Fix test suite compilation
|
||||
#126 #127 Windows: Fix compilation for Visual Studio 2012
|
||||
Windows: Upgrade shipped project files to Visual Studio 2017
|
||||
#33 #132 tests: Mass-fix compilation for XML_UNICODE_WCHAR_T
|
||||
#129 examples: Fix compilation for XML_UNICODE_WCHAR_T
|
||||
#130 benchmark: Fix compilation for XML_UNICODE_WCHAR_T
|
||||
#144 xmlwf: Fix compilation for XML_UNICODE_WCHAR_T; still needs
|
||||
Windows or MinGW for 2-byte wchar_t
|
||||
#9 Address two Clang Static Analyzer false positives
|
||||
#59 Resolve troublesome macros hiding parser struct membership
|
||||
and dereferencing that pointer
|
||||
#6 Resolve superfluous internal malloc/realloc switch
|
||||
#153 #155 Improve docbook2x-man detection
|
||||
#160 Undefine NDEBUG in the test suite (rather than rejecting it)
|
||||
#161 Address compiler warnings
|
||||
Version info bumped from 7:6:6 to 7:7:6
|
||||
|
||||
Special thanks to:
|
||||
Benbuck Nason
|
||||
Hans Wennborg
|
||||
José Gutiérrez de la Concha
|
||||
Pedro Monreal Gonzalez
|
||||
Rhodri James
|
||||
Rolf Ade
|
||||
Stephen Groat
|
||||
and
|
||||
Core Infrastructure Initiative
|
||||
|
||||
Release 2.2.4 Sat August 19 2017
|
||||
Bug fixes:
|
||||
#115 Fix copying of partial characters for UTF-8 input
|
||||
|
||||
Other changes:
|
||||
#109 Fix "make check" for non-x86 architectures that default
|
||||
to unsigned type char (-128..127 rather than 0..255)
|
||||
#109 coverage.sh: Cover -funsigned-char
|
||||
Autotools: Introduce --without-xmlwf argument
|
||||
#65 Autotools: Replace handwritten Makefile with GNU Automake
|
||||
#43 CMake: Auto-detect high quality entropy extractors, add new
|
||||
option USE_libbsd=ON to use arc4random_buf of libbsd
|
||||
#74 CMake: Add -fno-strict-aliasing only where supported
|
||||
#114 CMake: Always honor manually set BUILD_* options
|
||||
#114 CMake: Compile man page if docbook2x-man is available, only
|
||||
#117 Include file tests/xmltest.log.expected in source tarball
|
||||
(required for "make run-xmltest")
|
||||
#117 Include (existing) Visual Studio 2013 files in source tarball
|
||||
Improve test suite error output
|
||||
#111 Fix some typos in documentation
|
||||
Version info bumped from 7:5:6 to 7:6:6
|
||||
|
||||
Special thanks to:
|
||||
Jakub Wilk
|
||||
Joe Orton
|
||||
Lin Tian
|
||||
Rolf Eike Beer
|
||||
|
||||
Release 2.2.3 Wed August 2 2017
|
||||
Security fixes:
|
||||
#82 CVE-2017-11742 -- Windows: Fix DLL hijacking vulnerability
|
||||
using Steve Holme's LoadLibrary wrapper for/of cURL
|
||||
|
||||
Bug fixes:
|
||||
#85 Fix a dangling pointer issue related to realloc
|
||||
|
||||
Other changes:
|
||||
Increase code coverage
|
||||
#91 Linux: Allow getrandom to fail if nonblocking pool has not
|
||||
yet been initialized and read /dev/urandom then, instead.
|
||||
This is in line with what recent Python does.
|
||||
#81 Pre-10.7/Lion macOS: Support entropy from arc4random
|
||||
#86 Check that a UTF-16 encoding in an XML declaration has the
|
||||
right endianness
|
||||
#4 #5 #7 Recover correctly when some reallocations fail
|
||||
Repair "./configure && make" for systems without any
|
||||
provider of high quality entropy
|
||||
and try reading /dev/urandom on those
|
||||
Ensure that user-defined character encodings have converter
|
||||
functions when they are needed
|
||||
Fix mis-leading description of argument -c in xmlwf.1
|
||||
Rely on macro HAVE_ARC4RANDOM_BUF (rather than __CloudABI__)
|
||||
for CloudABI
|
||||
#100 Fix use of SIPHASH_MAIN in siphash.h
|
||||
#23 Test suite: Fix memory leaks
|
||||
Version info bumped from 7:4:6 to 7:5:6
|
||||
|
||||
Special thanks to:
|
||||
Chanho Park
|
||||
Joe Orton
|
||||
Pascal Cuoq
|
||||
Rhodri James
|
||||
Simon McVittie
|
||||
Vadim Zeitlin
|
||||
Viktor Szakats
|
||||
and
|
||||
Core Infrastructure Initiative
|
||||
|
||||
Release 2.2.2 Wed July 12 2017
|
||||
Security fixes:
|
||||
#43 Protect against compilation without any source of high
|
||||
quality entropy enabled, e.g. with CMake build system;
|
||||
commit ff0207e6076e9828e536b8d9cd45c9c92069b895
|
||||
#60 Windows with _UNICODE:
|
||||
Unintended use of LoadLibraryW with a non-wide string
|
||||
resulted in failure to load advapi32.dll and degradation
|
||||
in quality of used entropy when compiled with _UNICODE for
|
||||
Windows; you can launch existing binaries with
|
||||
EXPAT_ENTROPY_DEBUG=1 in the environment to inspect the
|
||||
quality of entropy used during runtime; commits
|
||||
* 95b95032f907ef1cd17ee7a9a1768010a825d61d
|
||||
* 73a5a2e9c081f49f2d775cf7ced864158b68dc80
|
||||
[MOX-006] Fix non-NULL parser parameter validation in XML_Parse;
|
||||
resulted in NULL dereference, previously;
|
||||
commit ac256dafdffc9622ab0dc2c62fcecb0dfcfa71fe
|
||||
|
||||
Bug fixes:
|
||||
#69 Fix improper use of unsigned long long integer literals
|
||||
|
||||
Other changes:
|
||||
#73 Start requiring a C99 compiler
|
||||
#49 Fix "==" Bashism in configure script
|
||||
#50 Fix too eager getrandom detection for Debian GNU/kFreeBSD
|
||||
#52 and macOS
|
||||
#51 Address lack of stdint.h in Visual Studio 2003 to 2008
|
||||
#58 Address compile warnings
|
||||
#68 Fix "./buildconf.sh && ./configure" for some versions
|
||||
of Dash for /bin/sh
|
||||
#72 CMake: Ease use of Expat in context of a parent project
|
||||
with multiple CMakeLists.txt files
|
||||
#72 CMake: Resolve mistaken executable permissions
|
||||
#76 Address compile warning with -DNDEBUG (not recommended!)
|
||||
#77 Address compile warning about macro redefinition
|
||||
|
||||
Special thanks to:
|
||||
Alexander Bluhm
|
||||
Ben Boeckel
|
||||
Cătălin Răceanu
|
||||
Kerin Millar
|
||||
László Böszörményi
|
||||
S. P. Zeidler
|
||||
Segev Finer
|
||||
Václav Slavík
|
||||
Victor Stinner
|
||||
Viktor Szakats
|
||||
and
|
||||
Radically Open Security
|
||||
|
||||
Release 2.2.1 Sat June 17 2017
|
||||
Security fixes:
|
||||
CVE-2017-9233 -- External entity infinite loop DoS
|
||||
Details: https://libexpat.github.io/doc/cve-2017-9233/
|
||||
Commit c4bf96bb51dd2a1b0e185374362ee136fe2c9d7f
|
||||
[MOX-002] CVE-2016-9063 -- Detect integer overflow; commit
|
||||
d4f735b88d9932bd5039df2335eefdd0723dbe20
|
||||
(Fixed version of existing downstream patches!)
|
||||
(SF.net) #539 Fix regression from fix to CVE-2016-0718 cutting off
|
||||
longer tag names; commits
|
||||
* 896b6c1fd3b842f377d1b62135dccf0a579cf65d
|
||||
* af507cef2c93cb8d40062a0abe43a4f4e9158fb2
|
||||
#16 * 0dbbf43fdb20f593ddf4fa1ff67288000dd4a7fd
|
||||
#25 More integer overflow detection (function poolGrow); commits
|
||||
* 810b74e4703dcfdd8f404e3cb177d44684775143
|
||||
* 44178553f3539ce69d34abee77a05e879a7982ac
|
||||
[MOX-002] Detect overflow from len=INT_MAX call to XML_Parse; commits
|
||||
* 4be2cb5afcc018d996f34bbbce6374b7befad47f
|
||||
* 7e5b71b748491b6e459e5c9a1d090820f94544d8
|
||||
[MOX-005] #30 Use high quality entropy for hash initialization:
|
||||
* arc4random_buf on BSD, systems with libbsd
|
||||
(when configured with --with-libbsd), CloudABI
|
||||
* RtlGenRandom on Windows XP / Server 2003 and later
|
||||
* getrandom on Linux 3.17+
|
||||
In a way, that's still part of CVE-2016-5300.
|
||||
https://github.com/libexpat/libexpat/pull/30/commits
|
||||
[MOX-005] For the low quality entropy extraction fallback code,
|
||||
the parser instance address can no longer leak, commit
|
||||
04ad658bd3079dd15cb60fc67087900f0ff4b083
|
||||
[MOX-003] Prevent use of uninitialised variable; commit
|
||||
[MOX-004] a4dc944f37b664a3ca7199c624a98ee37babdb4b
|
||||
Add missing parameter validation to public API functions
|
||||
and dedicated error code XML_ERROR_INVALID_ARGUMENT:
|
||||
[MOX-006] * NULL checks; commits
|
||||
* d37f74b2b7149a3a95a680c4c4cd2a451a51d60a (merge/many)
|
||||
* 9ed727064b675b7180c98cb3d4f75efba6966681
|
||||
* 6a747c837c50114dfa413994e07c0ba477be4534
|
||||
* Negative length (XML_Parse); commit
|
||||
[MOX-002] 70db8d2538a10f4c022655d6895e4c3e78692e7f
|
||||
[MOX-001] #35 Change hash algorithm to William Ahern's version of SipHash
|
||||
to go further with fixing CVE-2012-0876.
|
||||
https://github.com/libexpat/libexpat/pull/39/commits
|
||||
|
||||
Bug fixes:
|
||||
#32 Fix sharing of hash salt across parsers;
|
||||
relevant where XML_ExternalEntityParserCreate is called
|
||||
prior to XML_Parse, in particular (e.g. FBReader)
|
||||
#28 xmlwf: Auto-disable use of memory-mapping (and parsing
|
||||
as a single chunk) for files larger than ~1 GB (2^30 bytes)
|
||||
rather than failing with error "out of memory"
|
||||
#3 Fix double free after malloc failure in DTD code; commit
|
||||
7ae9c3d3af433cd4defe95234eae7dc8ed15637f
|
||||
#17 Fix memory leak on parser error for unbound XML attribute
|
||||
prefix with new namespaces defined in the same tag;
|
||||
found by Google's OSS-Fuzz; commits
|
||||
* 16f87daae5a16132e479e4f71862128c7a915c73
|
||||
* b47dbc9745932c160893d433220e462bd605f8cd
|
||||
xmlwf on Windows: Add missing calls to CloseHandle
|
||||
|
||||
New features:
|
||||
#30 Introduced environment switch EXPAT_ENTROPY_DEBUG=1
|
||||
for runtime debugging of entropy extraction
|
||||
|
||||
Other changes:
|
||||
Increase code coverage
|
||||
#33 Reject use of XML_UNICODE_WCHAR_T with sizeof(wchar_t) != 2;
|
||||
XML_UNICODE_WCHAR_T was never meant to be used outside
|
||||
of Windows; 4-byte wchar_t is common on Linux
|
||||
(SF.net) #538 Start using -fno-strict-aliasing
|
||||
(SF.net) #540 Support compilation against cloudlibc of CloudABI
|
||||
Allow MinGW cross-compilation
|
||||
(SF.net) #534 CMake: Introduce option "BUILD_doc" (enabled by default)
|
||||
to bypass compilation of the xmlwf.1 man page
|
||||
(SF.net) pr2 CMake: Introduce option "INSTALL" (enabled by default)
|
||||
to bypass installation of expat files
|
||||
CMake: Fix ninja support
|
||||
Autotools: Add parameters --enable-xml-context [COUNT]
|
||||
and --disable-xml-context; default of context of 1024
|
||||
bytes enabled unchanged
|
||||
#14 Drop AmigaOS 4.x code and includes
|
||||
#14 Drop ancient build systems:
|
||||
* Borland C++ Builder
|
||||
* OpenVMS
|
||||
* Open Watcom
|
||||
* Visual Studio 6.0
|
||||
* Pre-X Mac OS (MPW Makefile)
|
||||
If you happen to rely on some of these, please get in
|
||||
touch for joining with maintenance.
|
||||
#10 Move from WIN32 to _WIN32
|
||||
#13 Fix "make run-xmltest" order instability
|
||||
Address compile warnings
|
||||
Bump version info from 7:2:6 to 7:3:6
|
||||
Add AUTHORS file
|
||||
|
||||
Infrastructure:
|
||||
#1 Migrate from SourceForge to GitHub (except downloads):
|
||||
https://github.com/libexpat/
|
||||
#1 Re-create http://libexpat.org/ project website
|
||||
Start utilizing Travis CI
|
||||
|
||||
Special thanks to:
|
||||
Andy Wang
|
||||
Don Lewis
|
||||
Ed Schouten
|
||||
Karl Waclawek
|
||||
Pascal Cuoq
|
||||
Rhodri James
|
||||
Sergei Nikulov
|
||||
Tobias Taschner
|
||||
Viktor Szakats
|
||||
and
|
||||
Core Infrastructure Initiative
|
||||
Mozilla Foundation (MOSS Track 3: Secure Open Source)
|
||||
Radically Open Security
|
||||
|
||||
Release 2.2.0 Tue June 21 2016
|
||||
Security fixes:
|
||||
#537 CVE-2016-0718 -- Fix crash on malformed input
|
||||
CVE-2016-4472 -- Improve insufficient fix to CVE-2015-1283 /
|
||||
CVE-2015-2716 introduced with Expat 2.1.1
|
||||
#499 CVE-2016-5300 -- Use more entropy for hash initialization
|
||||
than the original fix to CVE-2012-0876
|
||||
#519 CVE-2012-6702 -- Resolve troublesome internal call to srand
|
||||
that was introduced with Expat 2.1.0
|
||||
when addressing CVE-2012-0876 (issue #496)
|
||||
|
||||
Bug fixes:
|
||||
Fix uninitialized reads of size 1
|
||||
(e.g. in little2_updatePosition)
|
||||
Fix detection of UTF-8 character boundaries
|
||||
|
||||
Other changes:
|
||||
#532 Fix compilation for Visual Studio 2010 (keyword "C99")
|
||||
Autotools: Resolve use of "$<" to better support bmake
|
||||
Autotools: Add QA script "qa.sh" (and make target "qa")
|
||||
Autotools: Respect CXXFLAGS if given
|
||||
Autotools: Fix "make run-xmltest"
|
||||
Autotools: Have "make run-xmltest" check for expected output
|
||||
p90 CMake: Fix static build (BUILD_shared=OFF) on Windows
|
||||
#536 CMake: Add soversion, support -DNO_SONAME=yes to bypass
|
||||
#323 CMake: Add suffix "d" to differentiate debug from release
|
||||
CMake: Define WIN32 with CMake on Windows
|
||||
Annotate memory allocators for GCC
|
||||
Address all currently known compile warnings
|
||||
Make sure that API symbols remain visible despite
|
||||
-fvisibility=hidden
|
||||
Remove executable flag from source files
|
||||
Resolve COMPILED_FROM_DSP in favor of WIN32
|
||||
|
||||
Special thanks to:
|
||||
Björn Lindahl
|
||||
Christian Heimes
|
||||
Cristian Rodríguez
|
||||
Daniel Krügler
|
||||
Gustavo Grieco
|
||||
Karl Waclawek
|
||||
László Böszörményi
|
||||
Marco Grassi
|
||||
Pascal Cuoq
|
||||
Sergei Nikulov
|
||||
Thomas Beutlich
|
||||
Warren Young
|
||||
Yann Droneaud
|
||||
|
||||
Release 2.1.1 Sat March 12 2016
|
||||
Security fixes:
|
||||
#582: CVE-2015-1283 - Multiple integer overflows in XML_GetBuffer
|
||||
|
||||
Bug fixes:
|
||||
#502: Fix potential null pointer dereference
|
||||
#520: Symbol XML_SetHashSalt was not exported
|
||||
Output of "xmlwf -h" was incomplete
|
||||
|
||||
Other changes:
|
||||
#503: Document behavior of calling XML_SetHashSalt with salt 0
|
||||
Minor improvements to man page xmlwf(1)
|
||||
Improvements to the experimental CMake build system
|
||||
libtool now invoked with --verbose
|
||||
|
||||
Release 2.1.0 Sat March 24 2012
|
||||
- Security fixes:
|
||||
#2958794: CVE-2012-1148 - Memory leak in poolGrow.
|
||||
#2895533: CVE-2012-1147 - Resource leak in readfilemap.c.
|
||||
#3496608: CVE-2012-0876 - Hash DOS attack.
|
||||
#2894085: CVE-2009-3560 - Buffer over-read and crash in big2_toUtf8().
|
||||
#1990430: CVE-2009-3720 - Parser crash with special UTF-8 sequences.
|
||||
- Bug Fixes:
|
||||
#1742315: Harmful XML_ParserCreateNS suggestion.
|
||||
#1785430: Expat build fails on linux-amd64 with gcc version>=4.1 -O3.
|
||||
#1983953, 2517952, 2517962, 2649838:
|
||||
Build modifications using autoreconf instead of buildconf.sh.
|
||||
#2815947, #2884086: OBJEXT and EXEEXT support while building.
|
||||
#2517938: xmlwf should return non-zero exit status if not well-formed.
|
||||
#2517946: Wrong statement about XMLDecl in xmlwf.1 and xmlwf.sgml.
|
||||
#2855609: Dangling positionPtr after error.
|
||||
#2990652: CMake support.
|
||||
#3010819: UNEXPECTED_STATE with a trailing "%" in entity value.
|
||||
#3206497: Uninitialized memory returned from XML_Parse.
|
||||
#3287849: make check fails on mingw-w64.
|
||||
- Patches:
|
||||
#1749198: pkg-config support.
|
||||
#3010222: Fix for bug #3010819.
|
||||
#3312568: CMake support.
|
||||
#3446384: Report byte offsets for attr names and values.
|
||||
- New Features / API changes:
|
||||
Added new API member XML_SetHashSalt() that allows setting an initial
|
||||
value (salt) for hash calculations. This is part of the fix for
|
||||
bug #3496608 to randomize hash parameters.
|
||||
When compiled with XML_ATTR_INFO defined, adds new API member
|
||||
XML_GetAttributeInfo() that allows retrieving the byte
|
||||
offsets for attribute names and values (patch #3446384).
|
||||
Added CMake build system.
|
||||
See bug #2990652 and patch #3312568.
|
||||
Added run-benchmark target to Makefile.in - relies on testdata module
|
||||
present in the same relative location as in the repository.
|
||||
|
||||
Release 2.0.1 Tue June 5 2007
|
||||
- Fixed bugs #1515266, #1515600: The character data handler's calling
|
||||
of XML_StopParser() was not handled properly; if the parser was
|
||||
stopped and the handler set to NULL, the parser would segfault.
|
||||
- Fixed bug #1690883: Expat failed on EBCDIC systems as it assumed
|
||||
some character constants to be ASCII encoded.
|
||||
- Minor cleanups of the test harness.
|
||||
- Fixed xmlwf bug #1513566: "out of memory" error on file size zero.
|
||||
- Fixed outline.c bug #1543233: missing a final XML_ParserFree() call.
|
||||
- Fixes and improvements for Windows platform:
|
||||
bugs #1409451, #1476160, #1548182, #1602769, #1717322.
|
||||
- Build fixes for various platforms:
|
||||
HP-UX, Tru64, Solaris 9: patch #1437840, bug #1196180.
|
||||
All Unix: #1554618 (refreshed config.sub/config.guess).
|
||||
#1490371, #1613457: support both, DESTDIR and INSTALL_ROOT,
|
||||
without relying on GNU-Make specific features.
|
||||
#1647805: Patched configure.in to work better with Intel compiler.
|
||||
- Fixes to Makefile.in to have make check work correctly:
|
||||
bugs #1408143, #1535603, #1536684.
|
||||
- Added Open Watcom support: patch #1523242.
|
||||
|
||||
Release 2.0.0 Wed Jan 11 2006
|
||||
- We no longer use the "check" library for C unit testing; we
|
||||
always use the (partial) internal implementation of the API.
|
||||
- Report XML_NS setting via XML_GetFeatureList().
|
||||
- Fixed headers for use from C++.
|
||||
- XML_GetCurrentLineNumber() and XML_GetCurrentColumnNumber()
|
||||
now return unsigned integers.
|
||||
- Added XML_LARGE_SIZE switch to enable 64-bit integers for
|
||||
byte indexes and line/column numbers.
|
||||
- Updated to use libtool 1.5.22 (the most recent).
|
||||
- Added support for AmigaOS.
|
||||
- Some mostly minor bug fixes. SF issues include: #1006708,
|
||||
#1021776, #1023646, #1114960, #1156398, #1221160, #1271642.
|
||||
|
||||
Release 1.95.8 Fri Jul 23 2004
|
||||
- Major new feature: suspend/resume. Handlers can now request
|
||||
that a parse be suspended for later resumption or aborted
|
||||
altogether. See "Temporarily Stopping Parsing" in the
|
||||
documentation for more details.
|
||||
- Some mostly minor bug fixes, but compilation should no
|
||||
longer generate warnings on most platforms. SF issues
|
||||
include: #827319, #840173, #846309, #888329, #896188, #923913,
|
||||
#928113, #961698, #985192.
|
||||
|
||||
Release 1.95.7 Mon Oct 20 2003
|
||||
- Fixed enum XML_Status issue (reported on SourceForge many
|
||||
times), so compilers that are properly picky will be happy.
|
||||
- Introduced an XMLCALL macro to control the calling
|
||||
convention used by the Expat API; this macro should be used
|
||||
to annotate prototypes and definitions of callback
|
||||
implementations in code compiled with a calling convention
|
||||
other than the default convention for the host platform.
|
||||
- Improved ability to build without the configure-generated
|
||||
expat_config.h header. This is useful for applications
|
||||
which embed Expat rather than linking in the library.
|
||||
- Fixed a variety of bugs: see SF issues #458907, #609603,
|
||||
#676844, #679754, #692878, #692964, #695401, #699323, #699487,
|
||||
#820946.
|
||||
- Improved hash table lookups.
|
||||
- Added more regression tests and improved documentation.
|
||||
|
||||
Release 1.95.6 Tue Jan 28 2003
|
||||
- Added XML_FreeContentModel().
|
||||
- Added XML_MemMalloc(), XML_MemRealloc(), XML_MemFree().
|
||||
- Fixed a variety of bugs: see SF issues #615606, #616863,
|
||||
#618199, #653180, #673791.
|
||||
- Enhanced the regression test suite.
|
||||
- Man page improvements: includes SF issue #632146.
|
||||
|
||||
Release 1.95.5 Fri Sep 6 2002
|
||||
- Added XML_UseForeignDTD() for improved SAX2 support.
|
||||
- Added XML_GetFeatureList().
|
||||
- Defined XML_Bool type and the values XML_TRUE and XML_FALSE.
|
||||
- Use an incomplete struct instead of a void* for the parser
|
||||
(may not retain).
|
||||
- Fixed UTF-8 decoding bug that caused legal UTF-8 to be rejected.
|
||||
- Finally fixed bug where default handler would report DTD
|
||||
events that were already handled by another handler.
|
||||
Initial patch contributed by Darryl Miles.
|
||||
- Removed unnecessary DllMain() function that caused static
|
||||
linking into a DLL to be difficult.
|
||||
- Added VC++ projects for building static libraries.
|
||||
- Reduced line-length for all source code and headers to be
|
||||
no longer than 80 characters, to help with AS/400 support.
|
||||
- Reduced memory copying during parsing (SF patch #600964).
|
||||
- Fixed a variety of bugs: see SF issues #580793, #434664,
|
||||
#483514, #580503, #581069, #584041, #584183, #584832, #585537,
|
||||
#596555, #596678, #598352, #598944, #599715, #600479, #600971.
|
||||
|
||||
Release 1.95.4 Fri Jul 12 2002
|
||||
- Added support for VMS, contributed by Craig Berry. See
|
||||
vms/README.vms for more information.
|
||||
- Added Mac OS (classic) support, with a makefile for MPW,
|
||||
contributed by Thomas Wegner and Daryle Walker.
|
||||
- Added Borland C++ Builder 5 / BCC 5.5 support, contributed
|
||||
by Patrick McConnell (SF patch #538032).
|
||||
- Fixed a variety of bugs: see SF issues #441449, #563184,
|
||||
#564342, #566334, #566901, #569461, #570263, #575168, #579196.
|
||||
- Made skippedEntityHandler conform to SAX2 (see source comment)
|
||||
- Re-implemented WFC: Entity Declared from XML 1.0 spec and
|
||||
added a new error "entity declared in parameter entity":
|
||||
see SF bug report #569461 and SF patch #578161
|
||||
- Re-implemented section 5.1 from XML 1.0 spec:
|
||||
see SF bug report #570263 and SF patch #578161
|
||||
|
||||
Release 1.95.3 Mon Jun 3 2002
|
||||
- Added a project to the MSVC workspace to create a wchar_t
|
||||
version of the library; the DLLs are named libexpatw.dll.
|
||||
- Changed the name of the Windows DLLs from expat.dll to
|
||||
libexpat.dll; this fixes SF bug #432456.
|
||||
- Added the XML_ParserReset() API function.
|
||||
- Fixed XML_SetReturnNSTriplet() to work for element names.
|
||||
- Made the XML_UNICODE builds usable (thanks, Karl!).
|
||||
- Allow xmlwf to read from standard input.
|
||||
- Install a man page for xmlwf on Unix systems.
|
||||
- Fixed many bugs; see SF bug reports #231864, #461380, #464837,
|
||||
#466885, #469226, #477667, #484419, #487840, #494749, #496505,
|
||||
#547350. Other bugs which we can't test as easily may also
|
||||
have been fixed, especially in the area of build support.
|
||||
|
||||
Release 1.95.2 Fri Jul 27 2001
|
||||
- More changes to make MSVC happy with the build; add a single
|
||||
workspace to support both the library and xmlwf application.
|
||||
- Added a Windows installer for Windows users; includes
|
||||
xmlwf.exe.
|
||||
- Added compile-time constants that can be used to determine the
|
||||
Expat version
|
||||
- Removed a lot of GNU-specific dependencies to aide portability
|
||||
among the various Unix flavors.
|
||||
- Fix the UTF-8 BOM bug.
|
||||
- Cleaned up warning messages for several compilers.
|
||||
- Added the -Wall, -Wstrict-prototypes options for GCC.
|
||||
|
||||
Release 1.95.1 Sun Oct 22 15:11:36 EDT 2000
|
||||
- Changes to get expat to build under Microsoft compiler
|
||||
- Removed all aborts and instead return an UNEXPECTED_STATE error.
|
||||
- Fixed a bug where a stray '%' in an entity value would cause an
|
||||
abort.
|
||||
- Defined XML_SetEndNamespaceDeclHandler. Thanks to Darryl Miles for
|
||||
finding this oversight.
|
||||
- Changed default patterns in lib/Makefile.in to fit non-GNU makes
|
||||
Thanks to robin@unrated.net for reporting and providing an
|
||||
account to test on.
|
||||
- The reference had the wrong label for XML_SetStartNamespaceDecl.
|
||||
Reported by an anonymous user.
|
||||
|
||||
Release 1.95.0 Fri Sep 29 2000
|
||||
- XML_ParserCreate_MM
|
||||
Allows you to set a memory management suite to replace the
|
||||
standard malloc,realloc, and free.
|
||||
- XML_SetReturnNSTriplet
|
||||
If you turn this feature on when namespace processing is in
|
||||
effect, then qualified, prefixed element and attribute names
|
||||
are returned as "uri|name|prefix" where '|' is whatever
|
||||
separator character is used in namespace processing.
|
||||
- Merged in features from perl-expat
|
||||
o XML_SetElementDeclHandler
|
||||
o XML_SetAttlistDeclHandler
|
||||
o XML_SetXmlDeclHandler
|
||||
o XML_SetEntityDeclHandler
|
||||
o StartDoctypeDeclHandler takes 3 additional parameters:
|
||||
sysid, pubid, has_internal_subset
|
||||
o Many paired handler setters (like XML_SetElementHandler)
|
||||
now have corresponding individual handler setters
|
||||
o XML_GetInputContext for getting the input context of
|
||||
the current parse position.
|
||||
- Added reference material
|
||||
- Packaged into a distribution that builds a sharable library
|
|
@ -0,0 +1,69 @@
|
|||
include(CheckCCompilerFlag)
|
||||
include(CheckCSourceCompiles)
|
||||
include(CheckIncludeFile)
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckSymbolExists)
|
||||
include(TestBigEndian)
|
||||
|
||||
check_include_file("dlfcn.h" HAVE_DLFCN_H)
|
||||
check_include_file("fcntl.h" HAVE_FCNTL_H)
|
||||
check_include_file("inttypes.h" HAVE_INTTYPES_H)
|
||||
check_include_file("memory.h" HAVE_MEMORY_H)
|
||||
check_include_file("stdint.h" HAVE_STDINT_H)
|
||||
check_include_file("stdlib.h" HAVE_STDLIB_H)
|
||||
check_include_file("strings.h" HAVE_STRINGS_H)
|
||||
check_include_file("string.h" HAVE_STRING_H)
|
||||
check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
|
||||
check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
|
||||
check_include_file("unistd.h" HAVE_UNISTD_H)
|
||||
|
||||
check_symbol_exists("getpagesize" "unistd.h" HAVE_GETPAGESIZE)
|
||||
check_symbol_exists("mmap" "sys/mman.h" HAVE_MMAP)
|
||||
check_symbol_exists("getrandom" "sys/random.h" HAVE_GETRANDOM)
|
||||
|
||||
if(USE_libbsd)
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${LIB_BSD}")
|
||||
set(_bsd "bsd/")
|
||||
else()
|
||||
set(_bsd "")
|
||||
endif()
|
||||
check_symbol_exists("arc4random_buf" "${_bsd}stdlib.h" HAVE_ARC4RANDOM_BUF)
|
||||
if(NOT HAVE_ARC4RANDOM_BUF)
|
||||
check_symbol_exists("arc4random" "${_bsd}stdlib.h" HAVE_ARC4RANDOM)
|
||||
endif()
|
||||
set(CMAKE_REQUIRED_LIBRARIES)
|
||||
|
||||
#/* Define to 1 if you have the ANSI C header files. */
|
||||
check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
|
||||
|
||||
test_big_endian(WORDS_BIGENDIAN)
|
||||
#/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
|
||||
if(WORDS_BIGENDIAN)
|
||||
set(BYTEORDER 4321)
|
||||
else(WORDS_BIGENDIAN)
|
||||
set(BYTEORDER 1234)
|
||||
endif(WORDS_BIGENDIAN)
|
||||
|
||||
if(HAVE_SYS_TYPES_H)
|
||||
check_symbol_exists("off_t" "sys/types.h" OFF_T)
|
||||
check_symbol_exists("size_t" "sys/types.h" SIZE_T)
|
||||
else(HAVE_SYS_TYPES_H)
|
||||
set(OFF_T "long")
|
||||
set(SIZE_T "unsigned")
|
||||
endif(HAVE_SYS_TYPES_H)
|
||||
|
||||
check_c_source_compiles("
|
||||
#include <stdlib.h> /* for NULL */
|
||||
#include <unistd.h> /* for syscall */
|
||||
#include <sys/syscall.h> /* for SYS_getrandom */
|
||||
int main() {
|
||||
syscall(SYS_getrandom, NULL, 0, 0);
|
||||
return 0;
|
||||
}"
|
||||
HAVE_SYSCALL_GETRANDOM)
|
||||
|
||||
configure_file(expat_config.h.cmake "${CMAKE_CURRENT_BINARY_DIR}/expat_config.h")
|
||||
add_definitions(-DHAVE_EXPAT_CONFIG_H)
|
||||
|
||||
check_c_compiler_flag("-fno-strict-aliasing" FLAG_NO_STRICT_ALIASING)
|
||||
check_c_compiler_flag("-fvisibility=hidden" FLAG_VISIBILITY)
|
|
@ -0,0 +1,160 @@
|
|||
#
|
||||
# __ __ _
|
||||
# ___\ \/ /_ __ __ _| |_
|
||||
# / _ \\ /| '_ \ / _` | __|
|
||||
# | __// \| |_) | (_| | |_
|
||||
# \___/_/\_\ .__/ \__,_|\__|
|
||||
# |_| XML parser
|
||||
#
|
||||
# Copyright (c) 2017 Expat development team
|
||||
# Licensed under the MIT license:
|
||||
#
|
||||
# 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.
|
||||
|
||||
AUTOMAKE_OPTIONS = \
|
||||
dist-bzip2 \
|
||||
dist-lzip \
|
||||
dist-xz \
|
||||
foreign \
|
||||
subdir-objects
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
LIBTOOLFLAGS = --verbose
|
||||
|
||||
SUBDIRS = lib # lib goes first to build first
|
||||
if WITH_EXAMPLES
|
||||
SUBDIRS += examples
|
||||
endif
|
||||
if WITH_TESTS
|
||||
SUBDIRS += tests
|
||||
endif
|
||||
if WITH_XMLWF
|
||||
SUBDIRS += xmlwf doc
|
||||
endif
|
||||
|
||||
pkgconfig_DATA = expat.pc
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
|
||||
|
||||
_EXTRA_DIST_CMAKE = \
|
||||
CMakeLists.txt \
|
||||
CMake.README \
|
||||
ConfigureChecks.cmake \
|
||||
expat_config.h.cmake
|
||||
|
||||
_EXTRA_DIST_WINDOWS = \
|
||||
examples/elements.vcxproj \
|
||||
examples/elements.vcxproj.filters \
|
||||
examples/outline.vcxproj \
|
||||
examples/outline.vcxproj.filters \
|
||||
\
|
||||
lib/expat_static.vcxproj \
|
||||
lib/expat_static.vcxproj.filters \
|
||||
lib/expat.vcxproj \
|
||||
lib/expat.vcxproj.filters \
|
||||
lib/expatw_static.vcxproj \
|
||||
lib/expatw_static.vcxproj.filters \
|
||||
lib/expatw.vcxproj \
|
||||
lib/expatw.vcxproj.filters \
|
||||
\
|
||||
tests/benchmark/benchmark.sln \
|
||||
tests/benchmark/benchmark.vcxproj \
|
||||
\
|
||||
tests/runtests.sln \
|
||||
tests/runtests.vcxproj \
|
||||
tests/runtests.vcxproj.filters \
|
||||
\
|
||||
win32/expat.iss \
|
||||
win32/MANIFEST.txt \
|
||||
win32/README.txt \
|
||||
\
|
||||
xmlwf/xmlwf.vcxproj \
|
||||
xmlwf/xmlwf.vcxproj.filters \
|
||||
\
|
||||
expat.sln
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(_EXTRA_DIST_CMAKE) \
|
||||
$(_EXTRA_DIST_WINDOWS) \
|
||||
\
|
||||
conftools/expat.m4 \
|
||||
conftools/get-version.sh \
|
||||
conftools/PrintPath \
|
||||
\
|
||||
Changes \
|
||||
README.md \
|
||||
test-driver-wrapper.sh
|
||||
|
||||
|
||||
.PHONY: buildlib
|
||||
buildlib:
|
||||
@echo 'ERROR: Running "make buildlib LIBRARY=libexpatw.la"' >&2
|
||||
@echo 'ERROR: is no longer supported. INSTEAD please:' >&2
|
||||
@echo 'ERROR:' >&2
|
||||
@echo 'ERROR: * Mass-patch Makefile.am, e.g.' >&2
|
||||
@echo 'ERROR: # find -name Makefile.am -exec sed \' >&2
|
||||
@echo 'ERROR: -e "s,libexpat\.la,libexpatw.la," \' >&2
|
||||
@echo 'ERROR: -e "s,libexpat_la,libexpatw_la," \' >&2
|
||||
@echo 'ERROR: -i {} +' >&2
|
||||
@echo 'ERROR:' >&2
|
||||
@echo 'ERROR: * Run automake to re-generate Makefile.in files' >&2
|
||||
@echo 'ERROR:' >&2
|
||||
@echo 'ERROR: * Use "./configure --without-xmlwf" and/or' >&2
|
||||
@echo 'ERROR: "make -C lib all install" to bypass compilation' >&2
|
||||
@echo 'ERROR: of xmlwf (e.g. with -DXML_UNICODE)' >&2
|
||||
@echo 'ERROR:' >&2
|
||||
@false
|
||||
|
||||
|
||||
.PHONY: run-benchmark
|
||||
run-benchmark:
|
||||
$(MAKE) -C tests/benchmark
|
||||
./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/recset.xml 65535 3
|
||||
|
||||
tests/xmlts.zip:
|
||||
if test "$(XMLTS_ZIP)" = ""; then \
|
||||
wget --output-document=tests/xmlts.zip \
|
||||
https://www.w3.org/XML/Test/xmlts20080827.zip; \
|
||||
else \
|
||||
cp $(XMLTS_ZIP) tests/xmlts.zip; \
|
||||
fi
|
||||
|
||||
tests/xmlconf: tests/xmlts.zip
|
||||
cd tests && unzip -q xmlts.zip
|
||||
|
||||
.PHONY: run-xmltest
|
||||
run-xmltest: tests/xmlconf
|
||||
if WITH_XMLWF
|
||||
$(MAKE) -C xmlwf
|
||||
tests/xmltest.sh "$(PWD)/run.sh $(PWD)/xmlwf/xmlwf@EXEEXT@" 2>&1 | tee tests/xmltest.log
|
||||
dos2unix tests/xmltest.log
|
||||
diff -u tests/xmltest.log.expected tests/xmltest.log
|
||||
else
|
||||
@echo 'ERROR: xmlwf is needed for "make run-xmltest".' >&2
|
||||
@echo 'ERROR: Please re-configure without --without-xmlwf.' >&2
|
||||
@false
|
||||
endif
|
||||
|
||||
.PHONY: qa
|
||||
qa:
|
||||
./qa.sh address
|
||||
./qa.sh memory
|
||||
./qa.sh undefined
|
||||
./qa.sh coverage
|
|
@ -0,0 +1,127 @@
|
|||
[![Travis CI Build Status](https://travis-ci.org/libexpat/libexpat.svg?branch=master)](https://travis-ci.org/libexpat/libexpat)
|
||||
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/libexpat/libexpat?svg=true)](https://ci.appveyor.com/project/libexpat/libexpat)
|
||||
[![Packaging status](https://repology.org/badge/tiny-repos/expat.svg)](https://repology.org/metapackage/expat/versions)
|
||||
|
||||
|
||||
# Expat, Release 2.2.7
|
||||
|
||||
This is Expat, a C library for parsing XML, started by
|
||||
[James Clark](https://en.wikipedia.org/wiki/James_Clark_(programmer)) in 1997.
|
||||
Expat is a stream-oriented XML parser. This means that you register
|
||||
handlers with the parser before starting the parse. These handlers
|
||||
are called when the parser discovers the associated structures in the
|
||||
document being parsed. A start tag is an example of the kind of
|
||||
structures for which you may register handlers.
|
||||
|
||||
Windows users should use the
|
||||
[`expat_win32` package](https://sourceforge.net/projects/expat/files/expat_win32/),
|
||||
which includes both precompiled libraries and executables, and source code for
|
||||
developers.
|
||||
|
||||
Expat is [free software](https://www.gnu.org/philosophy/free-sw.en.html).
|
||||
You may copy, distribute, and modify it under the terms of the License
|
||||
contained in the file
|
||||
[`COPYING`](https://github.com/libexpat/libexpat/blob/master/expat/COPYING)
|
||||
distributed with this package.
|
||||
This license is the same as the MIT/X Consortium license.
|
||||
|
||||
If you are building Expat from a check-out from the
|
||||
[Git repository](https://github.com/libexpat/libexpat/),
|
||||
you need to run a script that generates the configure script using the
|
||||
GNU autoconf and libtool tools. To do this, you need to have
|
||||
autoconf 2.58 or newer. Run the script like this:
|
||||
|
||||
```console
|
||||
./buildconf.sh
|
||||
```
|
||||
|
||||
Once this has been done, follow the same instructions as for building
|
||||
from a source distribution.
|
||||
|
||||
To build Expat from a source distribution, you first run the
|
||||
configuration shell script in the top level distribution directory:
|
||||
|
||||
```console
|
||||
./configure
|
||||
```
|
||||
|
||||
There are many options which you may provide to configure (which you
|
||||
can discover by running configure with the `--help` option). But the
|
||||
one of most interest is the one that sets the installation directory.
|
||||
By default, the configure script will set things up to install
|
||||
libexpat into `/usr/local/lib`, `expat.h` into `/usr/local/include`, and
|
||||
`xmlwf` into `/usr/local/bin`. If, for example, you'd prefer to install
|
||||
into `/home/me/mystuff/lib`, `/home/me/mystuff/include`, and
|
||||
`/home/me/mystuff/bin`, you can tell `configure` about that with:
|
||||
|
||||
```console
|
||||
./configure --prefix=/home/me/mystuff
|
||||
```
|
||||
|
||||
Another interesting option is to enable 64-bit integer support for
|
||||
line and column numbers and the over-all byte index:
|
||||
|
||||
```console
|
||||
./configure CPPFLAGS=-DXML_LARGE_SIZE
|
||||
```
|
||||
|
||||
However, such a modification would be a breaking change to the ABI
|
||||
and is therefore not recommended for general use — e.g. as part of
|
||||
a Linux distribution — but rather for builds with special requirements.
|
||||
|
||||
After running the configure script, the `make` command will build
|
||||
things and `make install` will install things into their proper
|
||||
location. Have a look at the `Makefile` to learn about additional
|
||||
`make` options. Note that you need to have write permission into
|
||||
the directories into which things will be installed.
|
||||
|
||||
If you are interested in building Expat to provide document
|
||||
information in UTF-16 encoding rather than the default UTF-8, follow
|
||||
these instructions (after having run `make distclean`).
|
||||
Please note that we configure with `--without-xmlwf` as xmlwf does not
|
||||
support this mode of compilation (yet):
|
||||
|
||||
1. Mass-patch `Makefile.am` files to use `libexpatw.la` for a library name:
|
||||
<br/>
|
||||
`find -name Makefile.am -exec sed
|
||||
-e 's,libexpat\.la,libexpatw.la,'
|
||||
-e 's,libexpat_la,libexpatw_la,'
|
||||
-i {} +`
|
||||
|
||||
1. Run `automake` to re-write `Makefile.in` files:<br/>
|
||||
`automake`
|
||||
|
||||
1. For UTF-16 output as unsigned short (and version/error strings as char),
|
||||
run:<br/>
|
||||
`./configure CPPFLAGS=-DXML_UNICODE --without-xmlwf`<br/>
|
||||
For UTF-16 output as `wchar_t` (incl. version/error strings), run:<br/>
|
||||
`./configure CFLAGS="-g -O2 -fshort-wchar" CPPFLAGS=-DXML_UNICODE_WCHAR_T
|
||||
--without-xmlwf`
|
||||
<br/>Note: The latter requires libc compiled with `-fshort-wchar`, as well.
|
||||
|
||||
1. Run `make` (which excludes xmlwf).
|
||||
|
||||
1. Run `make install` (again, excludes xmlwf).
|
||||
|
||||
Using `DESTDIR` is supported. It works as follows:
|
||||
|
||||
```console
|
||||
make install DESTDIR=/path/to/image
|
||||
```
|
||||
|
||||
overrides the in-makefile set `DESTDIR`, because variable-setting priority is
|
||||
|
||||
1. commandline
|
||||
1. in-makefile
|
||||
1. environment
|
||||
|
||||
Note: This only applies to the Expat library itself, building UTF-16 versions
|
||||
of xmlwf and the tests is currently not supported.
|
||||
|
||||
When using Expat with a project using autoconf for configuration, you
|
||||
can use the probing macro in `conftools/expat.m4` to determine how to
|
||||
include Expat. See the comments at the top of that file for more
|
||||
information.
|
||||
|
||||
A reference manual is available in the file `doc/reference.html` in this
|
||||
distribution.
|
|
@ -0,0 +1,2 @@
|
|||
#! /bin/sh
|
||||
exec autoreconf --warnings=all --install --verbose "$@"
|
|
@ -0,0 +1,3 @@
|
|||
rm -r build__*
|
||||
rm -r coverage__*
|
||||
rm -r source__*
|
|
@ -0,0 +1,11 @@
|
|||
compile
|
||||
config.guess
|
||||
config.sub
|
||||
depcomp
|
||||
install-sh
|
||||
libtool.m4
|
||||
ltconfig
|
||||
ltmain.sh
|
||||
missing
|
||||
test-driver
|
||||
ar-lib
|
|
@ -0,0 +1,116 @@
|
|||
#!/bin/sh
|
||||
# Look for program[s] somewhere in $PATH.
|
||||
#
|
||||
# Options:
|
||||
# -s
|
||||
# Do not print out full pathname. (silent)
|
||||
# -pPATHNAME
|
||||
# Look in PATHNAME instead of $PATH
|
||||
#
|
||||
# Usage:
|
||||
# PrintPath [-s] [-pPATHNAME] program [program ...]
|
||||
#
|
||||
# Initially written by Jim Jagielski for the Apache configuration mechanism
|
||||
# (with kudos to Kernighan/Pike)
|
||||
#
|
||||
# This script falls under the Apache License.
|
||||
# See http://www.apache.org/licenses/LICENSE
|
||||
|
||||
##
|
||||
# Some "constants"
|
||||
##
|
||||
pathname=$PATH
|
||||
echo="yes"
|
||||
|
||||
##
|
||||
# Find out what OS we are running for later on
|
||||
##
|
||||
os=`(uname) 2>/dev/null`
|
||||
|
||||
##
|
||||
# Parse command line
|
||||
##
|
||||
for args in $*
|
||||
do
|
||||
case $args in
|
||||
-s ) echo="no" ;;
|
||||
-p* ) pathname="`echo $args | sed 's/^..//'`" ;;
|
||||
* ) programs="$programs $args" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
##
|
||||
# Now we make the adjustments required for OS/2 and everyone
|
||||
# else :)
|
||||
#
|
||||
# First of all, all OS/2 programs have the '.exe' extension.
|
||||
# Next, we adjust PATH (or what was given to us as PATH) to
|
||||
# be whitespace separated directories.
|
||||
# Finally, we try to determine the best flag to use for
|
||||
# test/[] to look for an executable file. OS/2 just has '-r'
|
||||
# but with other OSs, we do some funny stuff to check to see
|
||||
# if test/[] knows about -x, which is the preferred flag.
|
||||
##
|
||||
|
||||
if [ "x$os" = "xOS/2" ]
|
||||
then
|
||||
ext=".exe"
|
||||
pathname=`echo -E $pathname |
|
||||
sed 's/^;/.;/
|
||||
s/;;/;.;/g
|
||||
s/;$/;./
|
||||
s/;/ /g
|
||||
s/\\\\/\\//g' `
|
||||
test_exec_flag="-r"
|
||||
else
|
||||
ext="" # No default extensions
|
||||
pathname=`echo $pathname |
|
||||
sed 's/^:/.:/
|
||||
s/::/:.:/g
|
||||
s/:$/:./
|
||||
s/:/ /g' `
|
||||
# Here is how we test to see if test/[] can handle -x
|
||||
testfile="pp.t.$$"
|
||||
|
||||
cat > $testfile <<ENDTEST
|
||||
#!/bin/sh
|
||||
if [ -x / ] || [ -x /bin ] || [ -x /bin/ls ]; then
|
||||
exit 0
|
||||
fi
|
||||
exit 1
|
||||
ENDTEST
|
||||
|
||||
if `/bin/sh $testfile 2>/dev/null`; then
|
||||
test_exec_flag="-x"
|
||||
else
|
||||
test_exec_flag="-r"
|
||||
fi
|
||||
rm -f $testfile
|
||||
fi
|
||||
|
||||
for program in $programs
|
||||
do
|
||||
for path in $pathname
|
||||
do
|
||||
if [ $test_exec_flag $path/${program}${ext} ] && \
|
||||
[ ! -d $path/${program}${ext} ]; then
|
||||
if [ "x$echo" = "xyes" ]; then
|
||||
echo $path/${program}${ext}
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Next try without extension (if one was used above)
|
||||
if [ "x$ext" != "x" ]; then
|
||||
if [ $test_exec_flag $path/${program} ] && \
|
||||
[ ! -d $path/${program} ]; then
|
||||
if [ "x$echo" = "xyes" ]; then
|
||||
echo $path/${program}
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
exit 1
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
# ============================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html
|
||||
# ============================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# For every FLAG1, FLAG2 it is checked whether the compiler works with the
|
||||
# flag. If it does, the flag is added FLAGS-VARIABLE
|
||||
#
|
||||
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
|
||||
# CFLAGS) is used. During the check the flag is always added to the
|
||||
# current language's flags.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the current language's default
|
||||
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
|
||||
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
|
||||
# force the compiler to issue an error when a bad flag is given.
|
||||
#
|
||||
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
|
||||
#
|
||||
# NOTE: This macro depends on the AX_APPEND_FLAG and
|
||||
# AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with
|
||||
# AX_APPEND_LINK_FLAGS.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 7
|
||||
|
||||
AC_DEFUN([AX_APPEND_COMPILE_FLAGS],
|
||||
[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
|
||||
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
|
||||
for flag in $1; do
|
||||
AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4])
|
||||
done
|
||||
])dnl AX_APPEND_COMPILE_FLAGS
|
|
@ -0,0 +1,50 @@
|
|||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_append_flag.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
|
||||
# added in between.
|
||||
#
|
||||
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
|
||||
# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains
|
||||
# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly
|
||||
# FLAG.
|
||||
#
|
||||
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 8
|
||||
|
||||
AC_DEFUN([AX_APPEND_FLAG],
|
||||
[dnl
|
||||
AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
|
||||
AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
|
||||
AS_VAR_SET_IF(FLAGS,[
|
||||
AS_CASE([" AS_VAR_GET(FLAGS) "],
|
||||
[*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
|
||||
[
|
||||
AS_VAR_APPEND(FLAGS,[" $1"])
|
||||
AC_RUN_LOG([: FLAGS="$FLAGS"])
|
||||
])
|
||||
],
|
||||
[
|
||||
AS_VAR_SET(FLAGS,[$1])
|
||||
AC_RUN_LOG([: FLAGS="$FLAGS"])
|
||||
])
|
||||
AS_VAR_POPDEF([FLAGS])dnl
|
||||
])dnl AX_APPEND_FLAG
|
|
@ -0,0 +1,44 @@
|
|||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# For every FLAG1, FLAG2 it is checked whether the linker works with the
|
||||
# flag. If it does, the flag is added FLAGS-VARIABLE
|
||||
#
|
||||
# If FLAGS-VARIABLE is not specified, the linker's flags (LDFLAGS) is
|
||||
# used. During the check the flag is always added to the linker's flags.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the linker's default flags
|
||||
# when the check is done. The check is thus made with the flags: "LDFLAGS
|
||||
# EXTRA-FLAGS FLAG". This can for example be used to force the linker to
|
||||
# issue an error when a bad flag is given.
|
||||
#
|
||||
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
|
||||
#
|
||||
# NOTE: This macro depends on the AX_APPEND_FLAG and AX_CHECK_LINK_FLAG.
|
||||
# Please keep this macro in sync with AX_APPEND_COMPILE_FLAGS.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 7
|
||||
|
||||
AC_DEFUN([AX_APPEND_LINK_FLAGS],
|
||||
[AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
|
||||
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
|
||||
for flag in $1; do
|
||||
AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3], [$4])
|
||||
done
|
||||
])dnl AX_APPEND_LINK_FLAGS
|
|
@ -0,0 +1,74 @@
|
|||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check whether the given FLAG works with the current language's compiler
|
||||
# or gives an error. (Warnings, however, are ignored)
|
||||
#
|
||||
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
|
||||
# success/failure.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the current language's default
|
||||
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
|
||||
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
|
||||
# force the compiler to issue an error when a bad flag is given.
|
||||
#
|
||||
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
|
||||
#
|
||||
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
|
||||
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 4
|
||||
|
||||
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
|
||||
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
|
||||
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
|
||||
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
|
||||
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
|
||||
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
|
||||
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
|
||||
[AS_VAR_SET(CACHEVAR,[yes])],
|
||||
[AS_VAR_SET(CACHEVAR,[no])])
|
||||
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
|
||||
AS_VAR_IF(CACHEVAR,yes,
|
||||
[m4_default([$2], :)],
|
||||
[m4_default([$3], :)])
|
||||
AS_VAR_POPDEF([CACHEVAR])dnl
|
||||
])dnl AX_CHECK_COMPILE_FLAGS
|
|
@ -0,0 +1,53 @@
|
|||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check whether the given FLAG works with the linker or gives an error.
|
||||
# (Warnings, however, are ignored)
|
||||
#
|
||||
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
|
||||
# success/failure.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the linker's default flags
|
||||
# when the check is done. The check is thus made with the flags: "LDFLAGS
|
||||
# EXTRA-FLAGS FLAG". This can for example be used to force the linker to
|
||||
# issue an error when a bad flag is given.
|
||||
#
|
||||
# INPUT gives an alternative input source to AC_LINK_IFELSE.
|
||||
#
|
||||
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
|
||||
# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 6
|
||||
|
||||
AC_DEFUN([AX_CHECK_LINK_FLAG],
|
||||
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
|
||||
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl
|
||||
AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [
|
||||
ax_check_save_flags=$LDFLAGS
|
||||
LDFLAGS="$LDFLAGS $4 $1"
|
||||
AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
|
||||
[AS_VAR_SET(CACHEVAR,[yes])],
|
||||
[AS_VAR_SET(CACHEVAR,[no])])
|
||||
LDFLAGS=$ax_check_save_flags])
|
||||
AS_VAR_IF(CACHEVAR,yes,
|
||||
[m4_default([$2], :)],
|
||||
[m4_default([$3], :)])
|
||||
AS_VAR_POPDEF([CACHEVAR])dnl
|
||||
])dnl AX_CHECK_LINK_FLAGS
|
|
@ -0,0 +1,37 @@
|
|||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_require_defined.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_REQUIRE_DEFINED(MACRO)
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have
|
||||
# been defined and thus are available for use. This avoids random issues
|
||||
# where a macro isn't expanded. Instead the configure script emits a
|
||||
# non-fatal:
|
||||
#
|
||||
# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found
|
||||
#
|
||||
# It's like AC_REQUIRE except it doesn't expand the required macro.
|
||||
#
|
||||
# Here's an example:
|
||||
#
|
||||
# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 2
|
||||
|
||||
AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
|
||||
m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
|
||||
])dnl AX_REQUIRE_DEFINED
|
|
@ -0,0 +1,43 @@
|
|||
dnl Check if --with-expat[=PREFIX] is specified and
|
||||
dnl Expat >= 1.95.0 is installed in the system.
|
||||
dnl If yes, substitute EXPAT_CFLAGS, EXPAT_LIBS with regard to
|
||||
dnl the specified PREFIX and set with_expat to PREFIX, or 'yes' if PREFIX
|
||||
dnl has not been specified. Also HAVE_LIBEXPAT, HAVE_EXPAT_H are defined.
|
||||
dnl If --with-expat has not been specified, set with_expat to 'no'.
|
||||
dnl In addition, an Automake conditional EXPAT_INSTALLED is set accordingly.
|
||||
dnl This is necessary to adapt a whole lot of packages that have expat
|
||||
dnl bundled as a static library.
|
||||
AC_DEFUN([AM_WITH_EXPAT],
|
||||
[ AC_ARG_WITH(expat,
|
||||
[ --with-expat=PREFIX Use system Expat library],
|
||||
, with_expat=no)
|
||||
|
||||
AM_CONDITIONAL(EXPAT_INSTALLED, test $with_expat != no)
|
||||
|
||||
EXPAT_CFLAGS=
|
||||
EXPAT_LIBS=
|
||||
if test $with_expat != no; then
|
||||
if test $with_expat != yes; then
|
||||
EXPAT_CFLAGS="-I$with_expat/include"
|
||||
EXPAT_LIBS="-L$with_expat/lib"
|
||||
fi
|
||||
AC_CHECK_LIB(expat, XML_ParserCreate,
|
||||
[ EXPAT_LIBS="$EXPAT_LIBS -lexpat"
|
||||
expat_found=yes ],
|
||||
[ expat_found=no ],
|
||||
"$EXPAT_LIBS")
|
||||
if test $expat_found = no; then
|
||||
AC_MSG_ERROR([Could not find the Expat library])
|
||||
fi
|
||||
expat_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $EXPAT_CFLAGS"
|
||||
AC_CHECK_HEADERS(expat.h, , expat_found=no)
|
||||
if test $expat_found = no; then
|
||||
AC_MSG_ERROR([Could not find expat.h])
|
||||
fi
|
||||
CFLAGS="$expat_save_CFLAGS"
|
||||
fi
|
||||
|
||||
AC_SUBST(EXPAT_CFLAGS)
|
||||
AC_SUBST(EXPAT_LIBS)
|
||||
])
|
|
@ -0,0 +1,39 @@
|
|||
# expatcfg-compiler-supports-visibility.m4 --
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# EXPATCFG_COMPILER_SUPPORTS_VISIBILITY([ACTION-IF-YES],
|
||||
# [ACTION-IF-NO])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check if the selected compiler supports the "visibility" attribute
|
||||
# and set the variable "expatcfg_cv_compiler_supports_visibility"
|
||||
# accordingly to "yes" or "no".
|
||||
#
|
||||
# In addition, execute ACTION-IF-YES or ACTION-IF-NO.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2018 The Expat Authors.
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification,
|
||||
# are permitted in any medium without royalty provided the copyright
|
||||
# notice and this notice are preserved. This file is offered as-is,
|
||||
# without any warranty.
|
||||
|
||||
AC_DEFUN([EXPATCFG_COMPILER_SUPPORTS_VISIBILITY],
|
||||
[AC_CACHE_CHECK([whether compiler supports visibility],
|
||||
[expatcfg_cv_compiler_supports_visibility],
|
||||
[AS_VAR_SET([expatcfg_cv_compiler_supports_visibility],[no])
|
||||
AS_VAR_COPY([OLDFLAGS],[CFLAGS])
|
||||
AS_VAR_APPEND([CFLAGS],[" -fvisibility=hidden -Wall -Werror -Wno-unknown-warning-option"])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||
void __attribute__((visibility("default"))) foo(void);
|
||||
void foo(void) {}
|
||||
]])],
|
||||
[AS_VAR_SET([expatcfg_cv_compiler_supports_visibility],[yes])])
|
||||
AS_VAR_COPY([CFLAGS],[OLDFLAGS])])
|
||||
AS_IF([test "$expatcfg_cv_compiler_supports_visibility" = yes],[$1],[$2])])
|
||||
|
||||
# end of file
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# USAGE: get-version.sh path/to/expat.h
|
||||
#
|
||||
# This script will print Expat's version number on stdout. For example:
|
||||
#
|
||||
# $ ./conftools/get-version.sh ./lib/expat.h
|
||||
# 1.95.3
|
||||
# $
|
||||
#
|
||||
|
||||
if test $# = 0; then
|
||||
echo "ERROR: pathname for expat.h was not provided."
|
||||
echo ""
|
||||
echo "USAGE: $0 path/to/expat.h"
|
||||
exit 1
|
||||
fi
|
||||
if test $# != 1; then
|
||||
echo "ERROR: too many arguments were provided."
|
||||
echo ""
|
||||
echo "USAGE: $0 path/to/expat.h"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
hdr="$1"
|
||||
if test ! -r "$hdr"; then
|
||||
echo "ERROR: '$hdr' does not exist, or is not readable."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MAJOR_VERSION=$(sed -n -e '/MAJOR_VERSION/s/[^0-9]*//gp' "$hdr")
|
||||
MINOR_VERSION=$(sed -n -e '/MINOR_VERSION/s/[^0-9]*//gp' "$hdr")
|
||||
MICRO_VERSION=$(sed -n -e '/MICRO_VERSION/s/[^0-9]*//gp' "$hdr")
|
||||
|
||||
printf '%s.%s.%s' "$MAJOR_VERSION" "$MINOR_VERSION" "$MICRO_VERSION"
|
|
@ -0,0 +1,237 @@
|
|||
#! /usr/bin/env bash
|
||||
# Copyright (C) Sebastian Pipping <sebastian@pipping.org>
|
||||
# Licensed under the MIT license
|
||||
|
||||
export PS4='# '
|
||||
|
||||
|
||||
_get_source_dir() {
|
||||
echo "source__${version}"
|
||||
}
|
||||
|
||||
|
||||
_get_build_dir() {
|
||||
local libbsd_part=
|
||||
if ${with_libbsd}; then
|
||||
libbsd_part=__libbsd
|
||||
fi
|
||||
|
||||
local mingw_part=
|
||||
if ${with_mingw}; then
|
||||
mingw_part=__windows
|
||||
fi
|
||||
|
||||
local char_part=
|
||||
if ${with_unsigned_char}; then
|
||||
char_part=__unsigned_char
|
||||
fi
|
||||
|
||||
echo "build__${version}__unicode_${unicode_enabled}__xml_context_${xml_context}${libbsd_part}${mingw_part}${char_part}"
|
||||
}
|
||||
|
||||
|
||||
_get_coverage_dir() {
|
||||
echo "coverage__${version}"
|
||||
}
|
||||
|
||||
|
||||
_configure() {
|
||||
local configure_args=()
|
||||
|
||||
${unicode_enabled} \
|
||||
&& configure_args+=( CPPFLAGS='-DXML_UNICODE -DXML_UNICODE_WCHAR_T' )
|
||||
|
||||
if [[ ${xml_context} -eq 0 ]]; then
|
||||
configure_args+=( --disable-xml-context )
|
||||
else
|
||||
configure_args+=( --enable-xml-context=${xml_context} )
|
||||
fi
|
||||
|
||||
${with_libbsd} && configure_args+=( --with-libbsd )
|
||||
${with_mingw} && configure_args+=( --host=i686-w64-mingw32 )
|
||||
|
||||
(
|
||||
set -x
|
||||
./buildconf.sh &> configure.log
|
||||
./configure "${configure_args[@]}" "$@" &>> configure.log
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
_copy_to() {
|
||||
local target_dir="$1"
|
||||
[[ -d "${target_dir}" ]] && return 0
|
||||
|
||||
mkdir "${target_dir}"
|
||||
git archive --format=tar "${version}" | ( cd "${target_dir}" && tar x )
|
||||
}
|
||||
|
||||
|
||||
_copy_missing_mingw_libaries() {
|
||||
# These extra files are copied because
|
||||
# * coverage GCC flags make them needed
|
||||
# * With WINEDLLPATH Wine looks for .dll.so in these folders, not .dll
|
||||
local target="$1"
|
||||
local mingw_gcc_dll_dir="$(dirname "$(ls -1 /usr/lib*/gcc/i686-w64-mingw32/*/libgcc_s_sjlj-1.dll | head -n1)")"
|
||||
for dll in libgcc_s_sjlj-1.dll libstdc++-6.dll; do
|
||||
(
|
||||
set -x
|
||||
ln -s "${mingw_gcc_dll_dir}"/${dll} "${target}"/${dll}
|
||||
)
|
||||
done
|
||||
|
||||
local mingw_pthread_dll_dir="$(dirname "$(ls -1 /usr/i686-w64-mingw32/lib*/libwinpthread-1.dll | head -n1)")"
|
||||
for dll in libwinpthread-1.dll; do
|
||||
source="${mingw_pthread_dll_dir}"/${dll}
|
||||
[[ -e "${source}" ]] || continue
|
||||
(
|
||||
set -x
|
||||
ln -s "${source}" "${target}"/${dll}
|
||||
)
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
_run() {
|
||||
local source_dir="$1"
|
||||
local build_dir="$2"
|
||||
local capture_dir=lib
|
||||
|
||||
local BASE_FLAGS='-pipe -Wall -Wextra -pedantic -Wno-overlength-strings'
|
||||
BASE_FLAGS+=' --coverage --no-inline'
|
||||
|
||||
${with_unsigned_char} && BASE_FLAGS="${BASE_FLAGS} -funsigned-char"
|
||||
|
||||
local CFLAGS="-std=c99 ${BASE_FLAGS}"
|
||||
local CXXFLAGS="-std=c++98 ${BASE_FLAGS}"
|
||||
|
||||
(
|
||||
set -e
|
||||
cd "${build_dir}"
|
||||
|
||||
_configure \
|
||||
CFLAGS="${BASE_FLAGS}" \
|
||||
CXXFLAGS="${BASE_FLAGS}"
|
||||
|
||||
(
|
||||
set -x
|
||||
make -C lib &> build.log
|
||||
|
||||
lcov -c -d "${capture_dir}" -i -o "${coverage_info}-zero" &> run.log
|
||||
)
|
||||
|
||||
if ${with_mingw}; then
|
||||
for d in {tests,xmlwf}/.libs ; do
|
||||
mkdir -p "${d}"
|
||||
_copy_missing_mingw_libaries "${d}"
|
||||
done
|
||||
fi
|
||||
|
||||
set -x
|
||||
make all check run-xmltest
|
||||
|
||||
lcov -c -d "${capture_dir}" -o "${coverage_info}-test" &>> run.log
|
||||
lcov \
|
||||
-a "${coverage_info}-zero" \
|
||||
-a "${coverage_info}-test" \
|
||||
-o "${coverage_info}-all" \
|
||||
&>> run.log
|
||||
|
||||
# Make sure that files overlap in report despite different build folders
|
||||
sed "/SF:/ s,${build_dir}/,${source_dir}/," "${coverage_info}-all" > "${coverage_info}"
|
||||
) |& sed 's,^, ,'
|
||||
res=${PIPESTATUS[0]}
|
||||
|
||||
if [[ ${res} -eq 0 ]]; then
|
||||
echo PASSED
|
||||
else
|
||||
echo FAILED >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
_merge_coverage_info() {
|
||||
local coverage_dir="$1"
|
||||
shift
|
||||
local build_dirs=( "$@" )
|
||||
|
||||
mkdir -p "${coverage_dir}"
|
||||
(
|
||||
local lcov_merge_args=()
|
||||
for build_dir in "${build_dirs[@]}"; do
|
||||
lcov_merge_args+=( -a "${build_dir}/${coverage_info}" )
|
||||
done
|
||||
lcov_merge_args+=( -o "${coverage_dir}/${coverage_info}" )
|
||||
|
||||
set -x
|
||||
lcov "${lcov_merge_args[@]}"
|
||||
) &> "${coverage_dir}/merge.log"
|
||||
}
|
||||
|
||||
|
||||
_render_html_report() {
|
||||
local coverage_dir="$1"
|
||||
genhtml -o "${coverage_dir}" "${coverage_dir}/${coverage_info}" &> "${coverage_dir}/render.log"
|
||||
}
|
||||
|
||||
|
||||
_show_summary() {
|
||||
local coverage_dir="$1"
|
||||
lcov -q -l "${coverage_dir}/${coverage_info}" | grep -v '^\['
|
||||
}
|
||||
|
||||
|
||||
_main() {
|
||||
version="$(git describe --tags)"
|
||||
coverage_info=coverage.info
|
||||
|
||||
local build_dirs=()
|
||||
local source_dir="$(_get_source_dir)"
|
||||
local coverage_dir="$(_get_coverage_dir)"
|
||||
|
||||
_copy_to "${source_dir}"
|
||||
|
||||
_build_case() {
|
||||
local build_dir="$(_get_build_dir)"
|
||||
|
||||
echo "[${build_dir}]"
|
||||
_copy_to "${build_dir}"
|
||||
_run "${source_dir}" "${build_dir}"
|
||||
|
||||
build_dirs+=( "${build_dir}" )
|
||||
}
|
||||
|
||||
# All combinations:
|
||||
with_unsigned_char=false
|
||||
with_libbsd=false
|
||||
for with_mingw in true false ; do
|
||||
for unicode_enabled in true false ; do
|
||||
if ${unicode_enabled} && ! ${with_mingw} ; then
|
||||
continue
|
||||
fi
|
||||
|
||||
for xml_context in 0 1024 ; do
|
||||
_build_case
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
# Single cases:
|
||||
with_libbsd=true _build_case
|
||||
with_unsigned_char=true _build_case
|
||||
|
||||
echo
|
||||
echo 'Merging coverage files...'
|
||||
_merge_coverage_info "${coverage_dir}" "${build_dirs[@]}"
|
||||
|
||||
echo 'Rendering HTML report...'
|
||||
_render_html_report "${coverage_dir}"
|
||||
echo "--> ${coverage_dir}/index.html"
|
||||
|
||||
echo
|
||||
_show_summary "${coverage_dir}"
|
||||
}
|
||||
|
||||
|
||||
_main
|
|
@ -0,0 +1,29 @@
|
|||
#! /usr/bin/env bash
|
||||
# Copyright (C) 2018 Sebastian Pipping <sebastian@pipping.org>
|
||||
# Licensed under the MIT license
|
||||
#
|
||||
# Creates release tarball and detached GPG signature file for upload
|
||||
|
||||
set -e
|
||||
|
||||
PS4='# '
|
||||
set -x
|
||||
|
||||
version="$(./conftools/get-version.sh lib/expat.h)"
|
||||
|
||||
./buildconf.sh
|
||||
./configure
|
||||
make distcheck
|
||||
|
||||
extensions=(
|
||||
gz
|
||||
bz2
|
||||
lz
|
||||
xz
|
||||
)
|
||||
|
||||
for ext in ${extensions[@]} ; do
|
||||
archive=expat-${version}.tar.${ext}
|
||||
gpg --armor --output ${archive}.asc --detach-sign ${archive}
|
||||
gpg --verify ${archive}.asc ${archive}
|
||||
done
|
|
@ -0,0 +1,2 @@
|
|||
/XMLWF.1
|
||||
/xmlwf.1
|
|
@ -0,0 +1,59 @@
|
|||
#
|
||||
# __ __ _
|
||||
# ___\ \/ /_ __ __ _| |_
|
||||
# / _ \\ /| '_ \ / _` | __|
|
||||
# | __// \| |_) | (_| | |_
|
||||
# \___/_/\_\ .__/ \__,_|\__|
|
||||
# |_| XML parser
|
||||
#
|
||||
# Copyright (c) 2017 Expat development team
|
||||
# Licensed under the MIT license:
|
||||
#
|
||||
# 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.
|
||||
|
||||
.PHONY: dist-hook # not inside conditional to avoid automake warning
|
||||
|
||||
if WITH_DOCBOOK
|
||||
dist_man_MANS = xmlwf.1
|
||||
|
||||
xmlwf.1: xmlwf.xml
|
||||
-rm -f $@
|
||||
$(DOCBOOK_TO_MAN) $<
|
||||
test -f $@ || mv XMLWF.1 $@
|
||||
else
|
||||
dist-hook:
|
||||
@echo 'ERROR: Configure with --with-docbook for "make dist".' 1>&2
|
||||
@false
|
||||
endif
|
||||
|
||||
# https://www.gnu.org/software/automake/manual/automake.html#What-Gets-Cleaned
|
||||
.PHONY: clean-local
|
||||
clean-local: clean-local-check
|
||||
|
||||
.PHONY: clean-local-check
|
||||
clean-local-check:
|
||||
$(RM) xmlwf.1
|
||||
|
||||
EXTRA_DIST = \
|
||||
expat.png \
|
||||
reference.html \
|
||||
style.css \
|
||||
valid-xhtml10.png \
|
||||
xmlwf.xml
|
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,101 @@
|
|||
body {
|
||||
background-color: white;
|
||||
border: 0px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.corner {
|
||||
width: 200px;
|
||||
height: 80px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.banner {
|
||||
background-color: rgb(110,139,61);
|
||||
color: rgb(255,236,176);
|
||||
padding-left: 2em;
|
||||
}
|
||||
|
||||
.banner h1 {
|
||||
font-size: 200%;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 0em 2em 1em 2em;
|
||||
}
|
||||
|
||||
.releaseno {
|
||||
background-color: rgb(110,139,61);
|
||||
color: rgb(255,236,176);
|
||||
padding-bottom: 0.3em;
|
||||
padding-top: 0.5em;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.noborder {
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.eg {
|
||||
padding-left: 1em;
|
||||
padding-top: .5em;
|
||||
padding-bottom: .5em;
|
||||
border: solid thin;
|
||||
margin: 1em 0;
|
||||
background-color: tan;
|
||||
margin-left: 2em;
|
||||
margin-right: 10%;
|
||||
}
|
||||
|
||||
.pseudocode {
|
||||
padding-left: 1em;
|
||||
padding-top: .5em;
|
||||
padding-bottom: .5em;
|
||||
border: solid thin;
|
||||
margin: 1em 0;
|
||||
background-color: rgb(250,220,180);
|
||||
margin-left: 2em;
|
||||
margin-right: 10%;
|
||||
}
|
||||
|
||||
.handler {
|
||||
width: 100%;
|
||||
border-top-width: thin;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.handler p {
|
||||
margin-left: 2em;
|
||||
}
|
||||
|
||||
.setter {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.signature {
|
||||
color: navy;
|
||||
}
|
||||
|
||||
.fcndec {
|
||||
width: 100%;
|
||||
border-top-width: thin;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.fcndef {
|
||||
margin-left: 2em;
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
.cpp-symbols dt {
|
||||
font-family: monospace;
|
||||
}
|
||||
.cpp-symbols dd {
|
||||
margin-bottom: 1em;
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
|
@ -0,0 +1,452 @@
|
|||
<!DOCTYPE refentry [
|
||||
<!-- Fill in your name for FIRSTNAME and SURNAME. -->
|
||||
<!ENTITY dhfirstname "<firstname>Scott</firstname>">
|
||||
<!ENTITY dhsurname "<surname>Bronson</surname>">
|
||||
<!-- Please adjust the date whenever revising the manpage. -->
|
||||
<!ENTITY dhdate "<date>March 11, 2016</date>">
|
||||
<!-- SECTION should be 1-8, maybe w/ subsection other parameters are
|
||||
allowed: see man(7), man(1). -->
|
||||
<!ENTITY dhsection "<manvolnum>1</manvolnum>">
|
||||
<!ENTITY dhemail "<email>bronson@rinspin.com</email>">
|
||||
<!ENTITY dhusername "Scott Bronson">
|
||||
<!ENTITY dhucpackage "<refentrytitle>XMLWF</refentrytitle>">
|
||||
<!ENTITY dhpackage "xmlwf">
|
||||
|
||||
<!ENTITY debian "<productname>Debian GNU/Linux</productname>">
|
||||
<!ENTITY gnu "<acronym>GNU</acronym>">
|
||||
]>
|
||||
|
||||
<refentry>
|
||||
<refentryinfo>
|
||||
<address>
|
||||
&dhemail;
|
||||
</address>
|
||||
<author>
|
||||
&dhfirstname;
|
||||
&dhsurname;
|
||||
</author>
|
||||
<copyright>
|
||||
<year>2001</year>
|
||||
<holder>&dhusername;</holder>
|
||||
</copyright>
|
||||
&dhdate;
|
||||
</refentryinfo>
|
||||
<refmeta>
|
||||
&dhucpackage;
|
||||
|
||||
&dhsection;
|
||||
</refmeta>
|
||||
<refnamediv>
|
||||
<refname>&dhpackage;</refname>
|
||||
|
||||
<refpurpose>Determines if an XML document is well-formed</refpurpose>
|
||||
</refnamediv>
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>&dhpackage;</command>
|
||||
<arg><option>-s</option></arg>
|
||||
<arg><option>-n</option></arg>
|
||||
<arg><option>-p</option></arg>
|
||||
<arg><option>-x</option></arg>
|
||||
|
||||
<arg><option>-e <replaceable>encoding</replaceable></option></arg>
|
||||
<arg><option>-w</option></arg>
|
||||
|
||||
<arg><option>-d <replaceable>output-dir</replaceable></option></arg>
|
||||
<arg><option>-c</option></arg>
|
||||
<arg><option>-m</option></arg>
|
||||
|
||||
<arg><option>-r</option></arg>
|
||||
<arg><option>-t</option></arg>
|
||||
<arg><option>-N</option></arg>
|
||||
|
||||
<arg><option>-v</option></arg>
|
||||
|
||||
<arg>file ...</arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>DESCRIPTION</title>
|
||||
|
||||
<para>
|
||||
<command>&dhpackage;</command> uses the Expat library to
|
||||
determine if an XML document is well-formed. It is
|
||||
non-validating.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If you do not specify any files on the command-line, and you
|
||||
have a recent version of <command>&dhpackage;</command>, the
|
||||
input file will be read from standard input.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>WELL-FORMED DOCUMENTS</title>
|
||||
|
||||
<para>
|
||||
A well-formed document must adhere to the
|
||||
following rules:
|
||||
</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
The file begins with an XML declaration. For instance,
|
||||
<literal><?xml version="1.0" standalone="yes"?></literal>.
|
||||
<emphasis>NOTE:</emphasis>
|
||||
<command>&dhpackage;</command> does not currently
|
||||
check for a valid XML declaration.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Every start tag is either empty (<tag/>)
|
||||
or has a corresponding end tag.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
There is exactly one root element. This element must contain
|
||||
all other elements in the document. Only comments, white
|
||||
space, and processing instructions may come after the close
|
||||
of the root element.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
All elements nest properly.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
All attribute values are enclosed in quotes (either single
|
||||
or double).
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<para>
|
||||
If the document has a DTD, and it strictly complies with that
|
||||
DTD, then the document is also considered <emphasis>valid</emphasis>.
|
||||
<command>&dhpackage;</command> is a non-validating parser --
|
||||
it does not check the DTD. However, it does support
|
||||
external entities (see the <option>-x</option> option).
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>OPTIONS</title>
|
||||
|
||||
<para>
|
||||
When an option includes an argument, you may specify the argument either
|
||||
separately ("<option>-d</option> output") or concatenated with the
|
||||
option ("<option>-d</option>output"). <command>&dhpackage;</command>
|
||||
supports both.
|
||||
</para>
|
||||
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-c</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
If the input file is well-formed and <command>&dhpackage;</command>
|
||||
doesn't encounter any errors, the input file is simply copied to
|
||||
the output directory unchanged.
|
||||
This implies no namespaces (turns off <option>-n</option>) and
|
||||
requires <option>-d</option> to specify an output directory.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-d output-dir</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies a directory to contain transformed
|
||||
representations of the input files.
|
||||
By default, <option>-d</option> outputs a canonical representation
|
||||
(described below).
|
||||
You can select different output formats using <option>-c</option>,
|
||||
<option>-m</option> and <option>-N</option>.
|
||||
</para>
|
||||
<para>
|
||||
The output filenames will
|
||||
be exactly the same as the input filenames or "STDIN" if the input is
|
||||
coming from standard input. Therefore, you must be careful that the
|
||||
output file does not go into the same directory as the input
|
||||
file. Otherwise, <command>&dhpackage;</command> will delete the
|
||||
input file before it generates the output file (just like running
|
||||
<literal>cat < file > file</literal> in most shells).
|
||||
</para>
|
||||
<para>
|
||||
Two structurally equivalent XML documents have a byte-for-byte
|
||||
identical canonical XML representation.
|
||||
Note that ignorable white space is considered significant and
|
||||
is treated equivalently to data.
|
||||
More on canonical XML can be found at
|
||||
http://www.jclark.com/xml/canonxml.html .
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-e encoding</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies the character encoding for the document, overriding
|
||||
any document encoding declaration. <command>&dhpackage;</command>
|
||||
supports four built-in encodings:
|
||||
<literal>US-ASCII</literal>,
|
||||
<literal>UTF-8</literal>,
|
||||
<literal>UTF-16</literal>, and
|
||||
<literal>ISO-8859-1</literal>.
|
||||
Also see the <option>-w</option> option.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-m</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Outputs some strange sort of XML file that completely
|
||||
describes the input file, including character positions.
|
||||
Requires <option>-d</option> to specify an output file.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-n</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Turns on namespace processing. (describe namespaces)
|
||||
<option>-c</option> disables namespaces.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-N</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Adds a doctype and notation declarations to canonical XML output.
|
||||
This matches the example output used by the formal XML test cases.
|
||||
Requires <option>-d</option> to specify an output file.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-p</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Tells xmlwf to process external DTDs and parameter
|
||||
entities.
|
||||
</para>
|
||||
<para>
|
||||
Normally <command>&dhpackage;</command> never parses parameter
|
||||
entities. <option>-p</option> tells it to always parse them.
|
||||
<option>-p</option> implies <option>-x</option>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-r</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Normally <command>&dhpackage;</command> memory-maps the XML file
|
||||
before parsing; this can result in faster parsing on many
|
||||
platforms.
|
||||
<option>-r</option> turns off memory-mapping and uses normal file
|
||||
IO calls instead.
|
||||
Of course, memory-mapping is automatically turned off
|
||||
when reading from standard input.
|
||||
</para>
|
||||
<para>
|
||||
Use of memory-mapping can cause some platforms to report
|
||||
substantially higher memory usage for
|
||||
<command>&dhpackage;</command>, but this appears to be a matter of
|
||||
the operating system reporting memory in a strange way; there is
|
||||
not a leak in <command>&dhpackage;</command>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-s</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Prints an error if the document is not standalone.
|
||||
A document is standalone if it has no external subset and no
|
||||
references to parameter entities.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-t</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Turns on timings. This tells Expat to parse the entire file,
|
||||
but not perform any processing.
|
||||
This gives a fairly accurate idea of the raw speed of Expat itself
|
||||
without client overhead.
|
||||
<option>-t</option> turns off most of the output options
|
||||
(<option>-d</option>, <option>-m</option>, <option>-c</option>, ...).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-v</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Prints the version of the Expat library being used, including some
|
||||
information on the compile-time configuration of the library, and
|
||||
then exits.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-w</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Enables support for Windows code pages.
|
||||
Normally, <command>&dhpackage;</command> will throw an error if it
|
||||
runs across an encoding that it is not equipped to handle itself. With
|
||||
<option>-w</option>, &dhpackage; will try to use a Windows code
|
||||
page. See also <option>-e</option>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-x</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Turns on parsing external entities.
|
||||
</para>
|
||||
<para>
|
||||
Non-validating parsers are not required to resolve external
|
||||
entities, or even expand entities at all.
|
||||
Expat always expands internal entities (?),
|
||||
but external entity parsing must be enabled explicitly.
|
||||
</para>
|
||||
<para>
|
||||
External entities are simply entities that obtain their
|
||||
data from outside the XML file currently being parsed.
|
||||
</para>
|
||||
<para>
|
||||
This is an example of an internal entity:
|
||||
<literallayout>
|
||||
<!ENTITY vers '1.0.2'>
|
||||
</literallayout>
|
||||
</para>
|
||||
<para>
|
||||
And here are some examples of external entities:
|
||||
|
||||
<literallayout>
|
||||
<!ENTITY header SYSTEM "header-&vers;.xml"> (parsed)
|
||||
<!ENTITY logo SYSTEM "logo.png" PNG> (unparsed)
|
||||
</literallayout>
|
||||
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
(Two hyphens.)
|
||||
Terminates the list of options. This is only needed if a filename
|
||||
starts with a hyphen. For example:
|
||||
</para>
|
||||
<literallayout>
|
||||
&dhpackage; -- -myfile.xml
|
||||
</literallayout>
|
||||
<para>
|
||||
will run <command>&dhpackage;</command> on the file
|
||||
<filename>-myfile.xml</filename>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
<para>
|
||||
Older versions of <command>&dhpackage;</command> do not support
|
||||
reading from standard input.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>OUTPUT</title>
|
||||
<para>
|
||||
If an input file is not well-formed,
|
||||
<command>&dhpackage;</command> prints a single line describing
|
||||
the problem to standard output. If a file is well formed,
|
||||
<command>&dhpackage;</command> outputs nothing.
|
||||
Note that the result code is <emphasis>not</emphasis> set.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>BUGS</title>
|
||||
<para>
|
||||
<command>&dhpackage;</command> returns a 0 - noerr result,
|
||||
even if the file is not well-formed. There is no good way for
|
||||
a program to use <command>&dhpackage;</command> to quickly
|
||||
check a file -- it must parse <command>&dhpackage;</command>'s
|
||||
standard output.
|
||||
</para>
|
||||
<para>
|
||||
The errors should go to standard error, not standard output.
|
||||
</para>
|
||||
<para>
|
||||
There should be a way to get <option>-d</option> to send its
|
||||
output to standard output rather than forcing the user to send
|
||||
it to a file.
|
||||
</para>
|
||||
<para>
|
||||
I have no idea why anyone would want to use the
|
||||
<option>-d</option>, <option>-c</option>, and
|
||||
<option>-m</option> options. If someone could explain it to
|
||||
me, I'd like to add this information to this manpage.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>ALTERNATIVES</title>
|
||||
<para>
|
||||
Here are some XML validators on the web:
|
||||
|
||||
<literallayout>
|
||||
http://www.hcrc.ed.ac.uk/~richard/xml-check.html
|
||||
http://www.stg.brown.edu/service/xmlvalid/
|
||||
http://www.scripting.com/frontier5/xml/code/xmlValidator.html
|
||||
http://www.xml.com/pub/a/tools/ruwf/check.html
|
||||
</literallayout>
|
||||
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>SEE ALSO</title>
|
||||
<para>
|
||||
|
||||
<literallayout>
|
||||
The Expat home page: http://www.libexpat.org/
|
||||
The W3 XML specification: http://www.w3.org/TR/REC-xml
|
||||
</literallayout>
|
||||
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>AUTHOR</title>
|
||||
<para>
|
||||
This manual page was written by &dhusername; &dhemail; for
|
||||
the &debian; system (but may be used by others). Permission is
|
||||
granted to copy, distribute and/or modify this document under
|
||||
the terms of the <acronym>GNU</acronym> Free Documentation
|
||||
License, Version 1.1.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
|
@ -0,0 +1,8 @@
|
|||
Makefile
|
||||
elements
|
||||
elements.plg
|
||||
outline
|
||||
outline.plg
|
||||
Debug
|
||||
Release
|
||||
.libs
|
|
@ -0,0 +1,39 @@
|
|||
#
|
||||
# __ __ _
|
||||
# ___\ \/ /_ __ __ _| |_
|
||||
# / _ \\ /| '_ \ / _` | __|
|
||||
# | __// \| |_) | (_| | |_
|
||||
# \___/_/\_\ .__/ \__,_|\__|
|
||||
# |_| XML parser
|
||||
#
|
||||
# Copyright (c) 2017 Expat development team
|
||||
# Licensed under the MIT license:
|
||||
#
|
||||
# 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.
|
||||
|
||||
AM_CPPFLAGS = -I$(srcdir)/../lib
|
||||
|
||||
noinst_PROGRAMS = elements outline
|
||||
|
||||
elements_SOURCES = elements.c
|
||||
elements_LDADD = ../lib/libexpat.la
|
||||
|
||||
outline_SOURCES = outline.c
|
||||
outline_LDADD = ../lib/libexpat.la
|
|
@ -0,0 +1,104 @@
|
|||
/* This is simple demonstration of how to use expat. This program
|
||||
reads an XML document from standard input and writes a line with
|
||||
the name of each element to standard output indenting child
|
||||
elements by one tab stop more than their parent element.
|
||||
It must be used with Expat compiled for UTF-8 output.
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
||||
Copyright (c) 2000-2017 Expat development team
|
||||
Licensed under the MIT license:
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <expat.h>
|
||||
|
||||
#ifdef XML_LARGE_SIZE
|
||||
# if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
|
||||
# define XML_FMT_INT_MOD "I64"
|
||||
# else
|
||||
# define XML_FMT_INT_MOD "ll"
|
||||
# endif
|
||||
#else
|
||||
# define XML_FMT_INT_MOD "l"
|
||||
#endif
|
||||
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
# include <wchar.h>
|
||||
# define XML_FMT_STR "ls"
|
||||
#else
|
||||
# define XML_FMT_STR "s"
|
||||
#endif
|
||||
|
||||
static void XMLCALL
|
||||
startElement(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
int i;
|
||||
int *depthPtr = (int *)userData;
|
||||
(void)atts;
|
||||
|
||||
for (i = 0; i < *depthPtr; i++)
|
||||
putchar('\t');
|
||||
printf("%" XML_FMT_STR "\n", name);
|
||||
*depthPtr += 1;
|
||||
}
|
||||
|
||||
static void XMLCALL
|
||||
endElement(void *userData, const XML_Char *name)
|
||||
{
|
||||
int *depthPtr = (int *)userData;
|
||||
(void)name;
|
||||
|
||||
*depthPtr -= 1;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
XML_Parser parser = XML_ParserCreate(NULL);
|
||||
int done;
|
||||
int depth = 0;
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
XML_SetUserData(parser, &depth);
|
||||
XML_SetElementHandler(parser, startElement, endElement);
|
||||
do {
|
||||
size_t len = fread(buf, 1, sizeof(buf), stdin);
|
||||
done = len < sizeof(buf);
|
||||
if (XML_Parse(parser, buf, (int)len, done) == XML_STATUS_ERROR) {
|
||||
fprintf(stderr,
|
||||
"%" XML_FMT_STR " at line %" XML_FMT_INT_MOD "u\n",
|
||||
XML_ErrorString(XML_GetErrorCode(parser)),
|
||||
XML_GetCurrentLineNumber(parser));
|
||||
return 1;
|
||||
}
|
||||
} while (!done);
|
||||
XML_ParserFree(parser);
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<SccProjectName />
|
||||
<SccLocalPath />
|
||||
<ProjectGuid>{35262250-C85F-463A-9F6D-670088BFA17E}</ProjectGuid>
|
||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>.\..\win32\bin\Release\</OutDir>
|
||||
<IntDir>.\..\win32\tmp\Release-elements\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>.\..\win32\bin\Debug\</OutDir>
|
||||
<IntDir>.\..\win32\tmp\Debug-elements\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<StringPooling>true</StringPooling>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<IgnoreStandardIncludePath>false</IgnoreStandardIncludePath>
|
||||
<AdditionalIncludeDirectories>..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;XML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>.\..\win32\tmp\Release-elements\</AssemblerListingLocation>
|
||||
<PrecompiledHeaderOutputFile>.\..\win32\tmp\Release-elements\elements.pch</PrecompiledHeaderOutputFile>
|
||||
<ObjectFileName>.\..\win32\tmp\Release-elements\</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\..\win32\tmp\Release-elements\</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Midl>
|
||||
<TypeLibraryName>.\..\win32\bin\Release\elements.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\..\win32\bin\Release\elements.bsc</OutputFile>
|
||||
</Bscmake>
|
||||
<Link>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OutputFile>..\win32\bin\Release\elements.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\win32\bin\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>libexpatMT.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;XML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>.\..\win32\tmp\Debug-elements\</AssemblerListingLocation>
|
||||
<BrowseInformation>true</BrowseInformation>
|
||||
<PrecompiledHeaderOutputFile>.\..\win32\tmp\Debug-elements\elements.pch</PrecompiledHeaderOutputFile>
|
||||
<ObjectFileName>.\..\win32\tmp\Debug-elements\</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\..\win32\tmp\Debug-elements\</ProgramDataBaseFileName>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
</ClCompile>
|
||||
<Midl>
|
||||
<TypeLibraryName>.\..\win32\bin\Debug\elements.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\..\win32\bin\Debug\elements.bsc</OutputFile>
|
||||
</Bscmake>
|
||||
<Link>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OutputFile>..\win32\bin\Debug\elements.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\win32\bin\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>libexpatMT.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="elements.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\lib\expat_static.vcxproj">
|
||||
<Project>{58a821bc-e4af-4df4-9a54-2baa22b92615}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{95d10a62-f554-4b10-a08b-cc74ba9fe102}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{21ef9308-545b-4d8d-8bde-012f925efa3a}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{ddac4f51-12d6-4e8f-817c-12c85eb1ffd2}</UniqueIdentifier>
|
||||
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="elements.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,126 @@
|
|||
/* Read an XML document from standard input and print an element
|
||||
outline on standard output.
|
||||
Must be used with Expat compiled for UTF-8 output.
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
||||
Copyright (c) 2000-2017 Expat development team
|
||||
Licensed under the MIT license:
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <expat.h>
|
||||
|
||||
#ifdef XML_LARGE_SIZE
|
||||
# if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
|
||||
# define XML_FMT_INT_MOD "I64"
|
||||
# else
|
||||
# define XML_FMT_INT_MOD "ll"
|
||||
# endif
|
||||
#else
|
||||
# define XML_FMT_INT_MOD "l"
|
||||
#endif
|
||||
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
# define XML_FMT_STR "ls"
|
||||
#else
|
||||
# define XML_FMT_STR "s"
|
||||
#endif
|
||||
|
||||
#define BUFFSIZE 8192
|
||||
|
||||
char Buff[BUFFSIZE];
|
||||
|
||||
int Depth;
|
||||
|
||||
static void XMLCALL
|
||||
start(void *data, const XML_Char *el, const XML_Char **attr)
|
||||
{
|
||||
int i;
|
||||
(void)data;
|
||||
|
||||
for (i = 0; i < Depth; i++)
|
||||
printf(" ");
|
||||
|
||||
printf("%" XML_FMT_STR, el);
|
||||
|
||||
for (i = 0; attr[i]; i += 2) {
|
||||
printf(" %" XML_FMT_STR "='%" XML_FMT_STR "'", attr[i], attr[i + 1]);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
Depth++;
|
||||
}
|
||||
|
||||
static void XMLCALL
|
||||
end(void *data, const XML_Char *el)
|
||||
{
|
||||
(void)data;
|
||||
(void)el;
|
||||
|
||||
Depth--;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
XML_Parser p = XML_ParserCreate(NULL);
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
if (! p) {
|
||||
fprintf(stderr, "Couldn't allocate memory for parser\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
XML_SetElementHandler(p, start, end);
|
||||
|
||||
for (;;) {
|
||||
int done;
|
||||
int len;
|
||||
|
||||
len = (int)fread(Buff, 1, BUFFSIZE, stdin);
|
||||
if (ferror(stdin)) {
|
||||
fprintf(stderr, "Read error\n");
|
||||
exit(-1);
|
||||
}
|
||||
done = feof(stdin);
|
||||
|
||||
if (XML_Parse(p, Buff, len, done) == XML_STATUS_ERROR) {
|
||||
fprintf(stderr,
|
||||
"Parse error at line %" XML_FMT_INT_MOD "u:\n%" XML_FMT_STR "\n",
|
||||
XML_GetCurrentLineNumber(p),
|
||||
XML_ErrorString(XML_GetErrorCode(p)));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (done)
|
||||
break;
|
||||
}
|
||||
XML_ParserFree(p);
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,151 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Template|Win32">
|
||||
<Configuration>Template</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<SccProjectName />
|
||||
<SccLocalPath />
|
||||
<ProjectGuid>{DE74E6FD-E107-4326-B1B0-A0CFEEB64F25}</ProjectGuid>
|
||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Template|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>.\..\win32\bin\Debug\</OutDir>
|
||||
<IntDir>.\..\win32\tmp\Debug-outline\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>.\..\win32\bin\Release\</OutDir>
|
||||
<IntDir>.\..\win32\tmp\Release-outline\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>.\..\win32\tmp\Debug-outline\</AssemblerListingLocation>
|
||||
<PrecompiledHeaderOutputFile>.\..\win32\tmp\Debug-outline\outline.pch</PrecompiledHeaderOutputFile>
|
||||
<ObjectFileName>.\..\win32\tmp\Debug-outline\</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\..\win32\tmp\Debug-outline\</ProgramDataBaseFileName>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
</ClCompile>
|
||||
<Midl>
|
||||
<TypeLibraryName>.\..\win32\bin\Debug\outline.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\..\win32\bin\Debug\outline.bsc</OutputFile>
|
||||
</Bscmake>
|
||||
<Link>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OutputFile>..\win32\bin\Debug\outline.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\win32\bin\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>libexpat.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<StringPooling>true</StringPooling>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<IgnoreStandardIncludePath>false</IgnoreStandardIncludePath>
|
||||
<AdditionalIncludeDirectories>..\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>.\..\win32\tmp\Release-outline\</AssemblerListingLocation>
|
||||
<PrecompiledHeaderOutputFile>.\..\win32\tmp\Release-outline\outline.pch</PrecompiledHeaderOutputFile>
|
||||
<ObjectFileName>.\..\win32\tmp\Release-outline\</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\..\win32\tmp\Release-outline\</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Midl>
|
||||
<TypeLibraryName>.\..\win32\bin\Release\outline.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\..\win32\bin\Release\outline.bsc</OutputFile>
|
||||
</Bscmake>
|
||||
<Link>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OutputFile>..\win32\bin\Release\outline.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\win32\bin\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>libexpat.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="outline.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\lib\expat.vcxproj">
|
||||
<Project>{45a5074d-66e8-44a4-a03f-018027b528d6}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{48092a1f-486d-4bd8-a9ea-d087423ab371}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{d9494f7e-987c-467b-a3e0-ea577aea229d}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{7e3cfca9-158f-4e78-be6c-02d599fd9254}</UniqueIdentifier>
|
||||
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="outline.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,11 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: expat
|
||||
Version: @PACKAGE_VERSION@
|
||||
Description: expat XML parser
|
||||
URL: http://www.libexpat.org
|
||||
Libs: -L${libdir} -lexpat
|
||||
Cflags: -I${includedir}
|
|
@ -0,0 +1,73 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.40629.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "elements", "examples\elements.vcxproj", "{35262250-C85F-463A-9F6D-670088BFA17E}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "expat", "lib\expat.vcxproj", "{45A5074D-66E8-44A4-A03F-018027B528D6}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "expat_static", "lib\expat_static.vcxproj", "{58A821BC-E4AF-4DF4-9A54-2BAA22B92615}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "expatw", "lib\expatw.vcxproj", "{C04F1C11-7079-48AD-A90B-6F59B7A55BEF}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "expatw_static", "lib\expatw_static.vcxproj", "{9220B0F2-C895-4CB2-91D1-1C16C4ECB759}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "outline", "examples\outline.vcxproj", "{DE74E6FD-E107-4326-B1B0-A0CFEEB64F25}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xmlwf", "xmlwf\xmlwf.vcxproj", "{E3C5991F-5238-4168-A179-275D1AC98D7E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
Template|Win32 = Template|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{35262250-C85F-463A-9F6D-670088BFA17E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{35262250-C85F-463A-9F6D-670088BFA17E}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{35262250-C85F-463A-9F6D-670088BFA17E}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{35262250-C85F-463A-9F6D-670088BFA17E}.Release|Win32.Build.0 = Release|Win32
|
||||
{35262250-C85F-463A-9F6D-670088BFA17E}.Template|Win32.ActiveCfg = Release|Win32
|
||||
{35262250-C85F-463A-9F6D-670088BFA17E}.Template|Win32.Build.0 = Release|Win32
|
||||
{45A5074D-66E8-44A4-A03F-018027B528D6}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{45A5074D-66E8-44A4-A03F-018027B528D6}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{45A5074D-66E8-44A4-A03F-018027B528D6}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{45A5074D-66E8-44A4-A03F-018027B528D6}.Release|Win32.Build.0 = Release|Win32
|
||||
{45A5074D-66E8-44A4-A03F-018027B528D6}.Template|Win32.ActiveCfg = Template|Win32
|
||||
{45A5074D-66E8-44A4-A03F-018027B528D6}.Template|Win32.Build.0 = Template|Win32
|
||||
{58A821BC-E4AF-4DF4-9A54-2BAA22B92615}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{58A821BC-E4AF-4DF4-9A54-2BAA22B92615}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{58A821BC-E4AF-4DF4-9A54-2BAA22B92615}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{58A821BC-E4AF-4DF4-9A54-2BAA22B92615}.Release|Win32.Build.0 = Release|Win32
|
||||
{58A821BC-E4AF-4DF4-9A54-2BAA22B92615}.Template|Win32.ActiveCfg = Template|Win32
|
||||
{58A821BC-E4AF-4DF4-9A54-2BAA22B92615}.Template|Win32.Build.0 = Template|Win32
|
||||
{C04F1C11-7079-48AD-A90B-6F59B7A55BEF}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C04F1C11-7079-48AD-A90B-6F59B7A55BEF}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C04F1C11-7079-48AD-A90B-6F59B7A55BEF}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C04F1C11-7079-48AD-A90B-6F59B7A55BEF}.Release|Win32.Build.0 = Release|Win32
|
||||
{C04F1C11-7079-48AD-A90B-6F59B7A55BEF}.Template|Win32.ActiveCfg = Template|Win32
|
||||
{C04F1C11-7079-48AD-A90B-6F59B7A55BEF}.Template|Win32.Build.0 = Template|Win32
|
||||
{9220B0F2-C895-4CB2-91D1-1C16C4ECB759}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{9220B0F2-C895-4CB2-91D1-1C16C4ECB759}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{9220B0F2-C895-4CB2-91D1-1C16C4ECB759}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{9220B0F2-C895-4CB2-91D1-1C16C4ECB759}.Release|Win32.Build.0 = Release|Win32
|
||||
{9220B0F2-C895-4CB2-91D1-1C16C4ECB759}.Template|Win32.ActiveCfg = Template|Win32
|
||||
{9220B0F2-C895-4CB2-91D1-1C16C4ECB759}.Template|Win32.Build.0 = Template|Win32
|
||||
{DE74E6FD-E107-4326-B1B0-A0CFEEB64F25}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{DE74E6FD-E107-4326-B1B0-A0CFEEB64F25}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{DE74E6FD-E107-4326-B1B0-A0CFEEB64F25}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{DE74E6FD-E107-4326-B1B0-A0CFEEB64F25}.Release|Win32.Build.0 = Release|Win32
|
||||
{DE74E6FD-E107-4326-B1B0-A0CFEEB64F25}.Template|Win32.ActiveCfg = Template|Win32
|
||||
{DE74E6FD-E107-4326-B1B0-A0CFEEB64F25}.Template|Win32.Build.0 = Template|Win32
|
||||
{E3C5991F-5238-4168-A179-275D1AC98D7E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E3C5991F-5238-4168-A179-275D1AC98D7E}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E3C5991F-5238-4168-A179-275D1AC98D7E}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E3C5991F-5238-4168-A179-275D1AC98D7E}.Release|Win32.Build.0 = Release|Win32
|
||||
{E3C5991F-5238-4168-A179-275D1AC98D7E}.Template|Win32.ActiveCfg = Template|Win32
|
||||
{E3C5991F-5238-4168-A179-275D1AC98D7E}.Template|Win32.Build.0 = Template|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,139 @@
|
|||
%define version 2.2.7
|
||||
%define release 1
|
||||
|
||||
Summary: Expat is an XML 1.0 parser written in C.
|
||||
Name: expat
|
||||
Version: %{version}
|
||||
Release: %{release}
|
||||
License: MIT/X
|
||||
Group: Utilities/parsers
|
||||
URL: http://www.libexpat.org/
|
||||
Source: https://downloads.sourceforge.net/project/expat/expat/%{version}/expat-%{version}.tar.bz2
|
||||
BuildRoot: /var/tmp/%{name}-buildroot
|
||||
|
||||
%description
|
||||
Expat is an XML 1.0 parser written in C by James Clark. It aims to be
|
||||
fully conforming. It is not a validating XML parser.
|
||||
|
||||
%prep
|
||||
%setup
|
||||
|
||||
%build
|
||||
./configure
|
||||
make lib xmlwf
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/bin
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/lib
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/include
|
||||
make install DESTDIR=$RPM_BUILD_ROOT prefix=/usr
|
||||
install -D xmlwf/xmlwf $RPM_BUILD_ROOT/usr/bin/xmlwf
|
||||
|
||||
%files
|
||||
%doc COPYING README.md doc/reference.html doc/style.css doc/*.png
|
||||
/usr/bin/xmlwf
|
||||
/usr/lib
|
||||
/usr/include/expat.h
|
||||
/usr/include/expat_config.h
|
||||
/usr/include/expat_external.h
|
||||
/usr/share/doc/expat/AUTHORS
|
||||
/usr/share/doc/expat/changelog
|
||||
/usr/share/man/man1/xmlwf.1.gz
|
||||
|
||||
%changelog
|
||||
* Wed Jun 19 2019 Sebastian Pipping <sebastian@pipping.org>
|
||||
[Release 2.2.7-1]
|
||||
- Update for the 2.2.7 release.
|
||||
|
||||
* Sun Aug 12 2018 Sebastian Pipping <sebastian@pipping.org>
|
||||
[Release 2.2.6-1]
|
||||
- Update for the 2.2.6 release.
|
||||
|
||||
* Tue Oct 31 2017 Sebastian Pipping <sebastian@pipping.org>
|
||||
[Release 2.2.5-1]
|
||||
- Update for the 2.2.5 release.
|
||||
|
||||
* Sat Aug 19 2017 Sebastian Pipping <sebastian@pipping.org>
|
||||
[Release 2.2.4-1]
|
||||
- Update for the 2.2.4 release.
|
||||
|
||||
* Wed Aug 2 2017 Sebastian Pipping <sebastian@pipping.org>
|
||||
[Release 2.2.3-1]
|
||||
- Update for the 2.2.3 release.
|
||||
|
||||
* Wed Jul 12 2017 Sebastian Pipping <sebastian@pipping.org>
|
||||
[Release 2.2.2-1]
|
||||
- Update for the 2.2.2 release.
|
||||
|
||||
* Sat Jun 17 2017 Sebastian Pipping <sebastian@pipping.org>
|
||||
[Release 2.2.1-1]
|
||||
- Update for the 2.2.1 release.
|
||||
|
||||
* Tue Jun 21 2016 Sebastian Pipping <sebastian@pipping.org>
|
||||
[Release 2.2.0-1]
|
||||
- Update for the 2.2.0 release.
|
||||
|
||||
* Wed Mar 2 2016 Sebastian Pipping <sebastian@pipping.org>
|
||||
[Release 2.1.1-1]
|
||||
- Update for the 2.1.1 release.
|
||||
|
||||
* Sat Mar 3 2012 Karl Waclawek <karl@waclawek.net>
|
||||
[Release 2.1.0-1]
|
||||
- Update for the 2.1.0 release.
|
||||
|
||||
* Sun Nov 26 2006 Karl Waclawek <karl@waclawek.net>
|
||||
[Release 2.0.1-1]
|
||||
- Update for the 2.0.1 release.
|
||||
|
||||
* Fri Jul 16 2004 Fred L. Drake, Jr. <fdrake@acm.org>
|
||||
[Release 1.95.8-1]
|
||||
- Update for the 1.95.8 release.
|
||||
- Add the expat_external.h header to the installed files.
|
||||
|
||||
* Tue Oct 21 2003 Fred L. Drake, Jr. <fdrake@acm.org>
|
||||
- Update list of documentation files; we missed a .png file in the
|
||||
previous release.
|
||||
|
||||
* Mon Oct 20 2003 Fred L. Drake, Jr. <fdrake@acm.org>
|
||||
[Release 1.95.7-1]
|
||||
- Updated for the 1.95.7 release.
|
||||
|
||||
* Sat Jan 25 2003 Fred L. Drake, Jr. <fdrake@acm.org>
|
||||
[Release 1.95.6-1]
|
||||
- Updated for the 1.95.6 release.
|
||||
|
||||
* Wed Sep 4 2002 Fred L. Drake, Jr. <fdrake@acm.org>
|
||||
[Release 1.95.5-1]
|
||||
- Updated for the 1.95.5 release.
|
||||
- Updated URL for Expat home page to point to www.libexpat.org.
|
||||
- Added "Valid XHTML 1.0" icon to the installed documentation.
|
||||
|
||||
* Sat Jun 29 2002 Fred L. Drake, Jr. <fdrake@acm.org>
|
||||
[Release 1.95.4-1]
|
||||
- Updated for the 1.95.4 release.
|
||||
|
||||
* Fri May 17 2002 Fred L. Drake, Jr. <fdrake@acm.org>
|
||||
[Release 1.95.3-1]
|
||||
- Updated for the 1.95.3 release.
|
||||
- Added xmlwf man page to the list of files.
|
||||
|
||||
* Wed Jul 25 2001 Fred L. Drake, Jr. <fdrake@acm.org>
|
||||
[Release 1.95.2-1]
|
||||
- Updated for the 1.95.2 release.
|
||||
|
||||
* Sun Feb 18 2001 Sean Reifschneider <jafo-rpms@tummy.com>
|
||||
[Release 1.95.1-1tummy]
|
||||
- Updated to 1.95.1 release.
|
||||
- Removed the "/usr/include/expat" directory for headers, as it now uses
|
||||
"expat.h" instead of "xmlparser.h".
|
||||
|
||||
* Thu Jan 25 2001 Sean Reifschneider <jafo-rpms@tummy.com>
|
||||
[Release 1.1-3tummy]
|
||||
- Moved xmlparse.h into "/usr/include/expat" directory to prevent conflict
|
||||
with w3c-libwww-devel package.
|
||||
|
||||
* Wed Sep 6 2000 Sean Reifschneider <jafo-rpms@tummy.com>
|
||||
- Modified to install into /usr.
|
||||
- Modified to use RPM_BUILD_ROOT instead of writing directly to install
|
||||
location.
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue