mirror of
https://github.com/php-win-ext/php-sdk-binary-tools.git
synced 2026-03-24 09:02:12 +01:00
Compare commits
33 Commits
php-sdk-2.
...
php-sdk-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e28c5e9b96 | ||
|
|
b359404509 | ||
|
|
912853c55f | ||
|
|
806f743f3c | ||
|
|
d13ff857f0 | ||
|
|
217ab7b4ca | ||
|
|
f740aface6 | ||
|
|
f160e68fbc | ||
|
|
9e3fcfdd77 | ||
|
|
51d2eaa463 | ||
|
|
15cc20920a | ||
|
|
df2eb74fee | ||
|
|
f59fd45ee5 | ||
|
|
43107058f8 | ||
|
|
b53316585a | ||
|
|
8b957129bd | ||
|
|
76ede8f900 | ||
|
|
60cfe587d5 | ||
|
|
e6b4a0d34d | ||
|
|
dac0e43fec | ||
|
|
1d69f089ca | ||
|
|
99112657d2 | ||
|
|
7eaeba9e73 | ||
|
|
ad95ee0c7b | ||
|
|
55cdd86d3a | ||
|
|
1045633875 | ||
|
|
c6a2644a57 | ||
|
|
9ffa736cbc | ||
|
|
79fbcfee08 | ||
|
|
f84b056d1c | ||
|
|
0ab9b8ddc6 | ||
|
|
794ef96470 | ||
|
|
cecf3df7f3 |
@@ -12,15 +12,13 @@ The PHP SDK 2.0+ is compatible with PHP 7.0 and above. The compatibility with [o
|
||||
|
||||
# Requirements
|
||||
|
||||
- `Visual C++ 2015` or `Visual C++ 2017` must be installed prior SDK usage (be sure to install both the C++ and the Windows SDK components)
|
||||
- A 64-bit build host
|
||||
- `Visual C++ 2015` or `Visual C++ 2017` must be installed prior SDK usage (be sure to install the C++ dev, .NET dev and the Windows SDK components)
|
||||
- if `Cygwin`, `MingW` or any other cross solution is installed, please read notes in the pitfalls section
|
||||
- if a 64-bit build is intended, a 64-bit system is required. Cross compilation of 64-bit on 32-bit system is not supported at the moment
|
||||
- The PHP SDK was successfully tested on Windows 7 or later, earlier versions might work but are not recommended
|
||||
|
||||
# Tools
|
||||
|
||||
All the tools included are either scripts or 32-bit binaries. They are therefore runable on any of x86 or x64 supported Windows system.
|
||||
|
||||
## SDK
|
||||
|
||||
- starter scripts, named phpsdk-<crt>-<arch>.bat
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/php/php.exe
BIN
bin/php/php.exe
Binary file not shown.
BIN
bin/php/php7.dll
BIN
bin/php/php7.dll
Binary file not shown.
@@ -10,11 +10,11 @@ rem otherwise - retain the old behavior, create structs for all the known build
|
||||
cmd /c "exit /b 0"
|
||||
|
||||
if "%PHP_SDK_ARCH%" NEQ "" (
|
||||
if "%PHP_SDK_VC%" NEQ "" (
|
||||
MD %_%\%PHP_SDK_VC%\%PHP_SDK_ARCH%\deps\bin
|
||||
MD %_%\%PHP_SDK_VC%\%PHP_SDK_ARCH%\deps\lib
|
||||
MD %_%\%PHP_SDK_VC%\%PHP_SDK_ARCH%\deps\include
|
||||
cd %_%\%PHP_SDK_VC%\%PHP_SDK_ARCH%
|
||||
if "%PHP_SDK_VS%" NEQ "" (
|
||||
MD %_%\%PHP_SDK_VS%\%PHP_SDK_ARCH%\deps\bin
|
||||
MD %_%\%PHP_SDK_VS%\%PHP_SDK_ARCH%\deps\lib
|
||||
MD %_%\%PHP_SDK_VS%\%PHP_SDK_ARCH%\deps\include
|
||||
cd %_%\%PHP_SDK_VS%\%PHP_SDK_ARCH%
|
||||
goto exit
|
||||
)
|
||||
goto create_all
|
||||
|
||||
@@ -126,19 +126,11 @@ try {
|
||||
usage(3);
|
||||
}
|
||||
/* The current CRT needs to match the config one. */
|
||||
$active_crt = getenv("PHP_SDK_VC");
|
||||
$active_crt = getenv("PHP_SDK_VS");
|
||||
if (Config::getCurrentCrtName() != $active_crt && !$force) {
|
||||
throw new Exception("Active CRT '$active_crt' differs from the branch CRT '" . Config::getCurrentCrtName() . "'.");
|
||||
}
|
||||
|
||||
if (NULL === Config::getCurrentStabilityName()) {
|
||||
if ("master" == Config::getCurrentBranchName()) {
|
||||
Config::setCurrentStabilityName("staging");
|
||||
} else {
|
||||
Config::setCurrentStabilityName("stable");
|
||||
}
|
||||
}
|
||||
|
||||
$branch_data = Config::getCurrentBranchData();
|
||||
echo "\nConfiguration: " . Config::getCurrentBranchName() . "-$branch_data[crt]-$branch_data[arch]-$branch_data[stability]\n\n";
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ if "%PHP_SDK_ARCH%"=="x64" (
|
||||
echo Build architecture: 32-bit
|
||||
)
|
||||
|
||||
echo Visual C++: %PHP_SDK_VC_NUM%
|
||||
echo Visual C++: %PHP_SDK_VC_TOOLSET_VER%
|
||||
echo PHP-SDK path: %PHP_SDK_ROOT_PATH%
|
||||
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
@echo off
|
||||
|
||||
if "%PHP_SDK_PHP_CMD%"=="" (
|
||||
call %~dp0phpsdk_setvars.bat
|
||||
if "!PHP_SDK_PHP_CMD!"=="" (
|
||||
echo PHP SDK is not setup
|
||||
exit /b 3
|
||||
)
|
||||
)
|
||||
|
||||
cmd /c %PHP_SDK_PHP_CMD% %PHP_SDK_BIN_PATH%\phpsdk_pgo.php %*
|
||||
|
||||
exit /b %errorlevel%
|
||||
|
||||
@echo off
|
||||
|
||||
if "%PHP_SDK_PHP_CMD%"=="" (
|
||||
call %~dp0phpsdk_setvars.bat
|
||||
if "!PHP_SDK_PHP_CMD!"=="" (
|
||||
echo PHP SDK is not setup
|
||||
exit /b 3
|
||||
)
|
||||
)
|
||||
|
||||
cmd /c %PHP_SDK_PHP_CMD% %PHP_SDK_BIN_PATH%\phpsdk_pgo.php %*
|
||||
|
||||
exit /b %errorlevel%
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
setlocal enableextensions enabledelayedexpansion
|
||||
|
||||
set PHPSDK_MSYS2_BASE_ADDR=0x70000000
|
||||
set PHPSDK_MSYS2_BASE_ADDR=0x100400000
|
||||
set PHPSDK_MSYS2_BASE_DYNAMIC=0
|
||||
|
||||
:getopt
|
||||
@@ -33,7 +33,7 @@ GOTO EXIT
|
||||
|
||||
:help
|
||||
echo phpsdk_rebase_msys2 ^<address^>
|
||||
echo Rebase MSYS2 DLLs to the given address. If ommited, default is 0x70000000.
|
||||
echo Rebase MSYS2 DLLs to the given address. If ommited, default is 0x100400000.
|
||||
|
||||
:EXIT
|
||||
exit /b %errorlevel%
|
||||
|
||||
@@ -15,31 +15,33 @@ if "%2"=="" goto :help
|
||||
|
||||
cmd /c "exit /b 0"
|
||||
|
||||
set PHP_SDK_VC=%1
|
||||
if /i not "%PHP_SDK_VC:~0,2%"=="vc" (
|
||||
set PHP_SDK_VS=%1
|
||||
if /i not "%PHP_SDK_VS:~0,2%"=="vc" (
|
||||
if /i not "%PHP_SDK_VS:~0,2%"=="vs" (
|
||||
:malformed_vc_string
|
||||
echo Malformed CRT string "%1"
|
||||
set PHP_SDK_VC=
|
||||
goto out_error
|
||||
echo Malformed CRT string "%1"
|
||||
set PHP_SDK_VS=
|
||||
goto out_error
|
||||
)
|
||||
)
|
||||
if ""=="%PHP_SDK_VC:~2%" (
|
||||
if ""=="%PHP_SDK_VS:~2%" (
|
||||
goto malformed_vc_string
|
||||
)
|
||||
set /a TMP_CHK=%PHP_SDK_VC:~2%
|
||||
set /a TMP_CHK=%PHP_SDK_VS:~2%
|
||||
if 14 gtr %TMP_CHK% (
|
||||
if "0"=="%TMP_CHK%" (
|
||||
if not "0"=="%PHP_SDK_VC:~2%" (
|
||||
if not "0"=="%PHP_SDK_VS:~2%" (
|
||||
set TMP_CHK=
|
||||
goto malformed_vc_string
|
||||
)
|
||||
)
|
||||
|
||||
echo At least vc14 is required
|
||||
set PHP_SDK_VC=
|
||||
set PHP_SDK_VS=
|
||||
set TMP_CHK=
|
||||
goto out_error
|
||||
)
|
||||
set PHP_SDK_VC_NUM=%TMP_CHK%
|
||||
set PHP_SDK_VS_NUM=%TMP_CHK%
|
||||
set TMP_CHK=
|
||||
|
||||
if /i not "%2"=="x64" (
|
||||
@@ -66,28 +68,37 @@ if not errorlevel 1 (
|
||||
set TMPKEY=
|
||||
|
||||
rem get vc base dir
|
||||
if 15 gtr %PHP_SDK_VC_NUM% (
|
||||
if 15 gtr %PHP_SDK_VS_NUM% (
|
||||
if /i "%PHP_SDK_OS_ARCH%"=="x64" (
|
||||
set TMPKEY=HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\%PHP_SDK_VC:~2%.0\Setup\VC
|
||||
set TMPKEY=HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\%PHP_SDK_VS:~2%.0\Setup\VC
|
||||
) else (
|
||||
set TMPKEY=HKLM\SOFTWARE\Microsoft\VisualStudio\%PHP_SDK_VC:~2%.0\Setup\VC
|
||||
set TMPKEY=HKLM\SOFTWARE\Microsoft\VisualStudio\%PHP_SDK_VS:~2%.0\Setup\VC
|
||||
)
|
||||
reg query !TMPKEY! /v ProductDir >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo Couldn't determine VC%PHP_SDK_VC:~2% directory
|
||||
echo Couldn't determine VC%PHP_SDK_VS:~2% directory
|
||||
goto out_error;
|
||||
)
|
||||
for /f "tokens=2*" %%a in ('reg query !TMPKEY! /v ProductDir') do set PHP_SDK_VC_DIR=%%b
|
||||
) else (
|
||||
rem vc15 support only for now, could parse out and pass on later
|
||||
for /f "tokens=1* delims=: " %%a in ('%~dp0\vswhere -nologo -version %PHP_SDK_VC_NUM% -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -format text') do set PHP_SDK_VC_DIR=%%b\VC
|
||||
rem build the version range, e.g. "[15,16)"
|
||||
set /a PHP_SDK_VS_RANGE=PHP_SDK_VS_NUM + 1
|
||||
set PHP_SDK_VS_RANGE="[%PHP_SDK_VS_NUM%,!PHP_SDK_VS_RANGE%!)"
|
||||
|
||||
for /f "tokens=1* delims=: " %%a in ('%~dp0\vswhere -nologo -version !PHP_SDK_VS_RANGE! -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -format text') do (
|
||||
set PHP_SDK_VC_DIR=%%b\VC
|
||||
)
|
||||
if not exist "!PHP_SDK_VC_DIR!" (
|
||||
for /f "tokens=1* delims=: " %%a in ('%~dp0\vswhere -nologo -version %PHP_SDK_VC_NUM% -products Microsoft.VisualStudio.Product.BuildTools -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -format text') do set PHP_SDK_VC_DIR=%%b\VC
|
||||
for /f "tokens=1* delims=: " %%a in ('%~dp0\vswhere -nologo -version !PHP_SDK_VS_RANGE! -products Microsoft.VisualStudio.Product.BuildTools -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -format text') do (
|
||||
set PHP_SDK_VC_DIR=%%b\VC
|
||||
)
|
||||
if not exist "!PHP_SDK_VC_DIR!" (
|
||||
rem check for a preview release
|
||||
for /f "tokens=1* delims=: " %%a in ('%~dp0\vswhere -nologo -version %PHP_SDK_VC_NUM% -prerelease -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -format text') do set PHP_SDK_VC_DIR=%%b\VC
|
||||
for /f "tokens=1* delims=: " %%a in ('%~dp0\vswhere -nologo -version !PHP_SDK_VS_RANGE! -prerelease -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -format text') do (
|
||||
set PHP_SDK_VC_DIR=%%b\VC
|
||||
)
|
||||
if not exist "!PHP_SDK_VC_DIR!" (
|
||||
echo Could not determine '%PHP_SDK_VC%' directory
|
||||
echo Could not determine '%PHP_SDK_VS%' directory
|
||||
goto out_error;
|
||||
)
|
||||
)
|
||||
@@ -95,8 +106,9 @@ if 15 gtr %PHP_SDK_VC_NUM% (
|
||||
set VSCMD_ARG_no_logo=nologo
|
||||
)
|
||||
set TMPKEY=
|
||||
set PHP_SDK_VS_RANGE=
|
||||
|
||||
if 15 gtr %PHP_SDK_VC_NUM% (
|
||||
if 15 gtr %PHP_SDK_VS_NUM% (
|
||||
rem get sdk dir
|
||||
rem if 10.0 is available, it's ok
|
||||
if /i "%PHP_SDK_OS_ARCH%"=="x64" (
|
||||
@@ -131,20 +143,20 @@ if 15 gtr %PHP_SDK_VC_NUM% (
|
||||
)
|
||||
|
||||
if /i "%PHP_SDK_ARCH%"=="x64" (
|
||||
if 15 gtr %PHP_SDK_VC_NUM% (
|
||||
set PHP_SDK_VC_SHELL_CMD="!PHP_SDK_VC_DIR!\vcvarsall.bat" amd64
|
||||
if 15 gtr %PHP_SDK_VS_NUM% (
|
||||
set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\vcvarsall.bat" amd64
|
||||
) else (
|
||||
set PHP_SDK_VC_SHELL_CMD="!PHP_SDK_VC_DIR!\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
)
|
||||
) else (
|
||||
if 15 gtr %PHP_SDK_VC_NUM% (
|
||||
set PHP_SDK_VC_SHELL_CMD="!PHP_SDK_VC_DIR!\vcvarsall.bat" x86
|
||||
if 15 gtr %PHP_SDK_VS_NUM% (
|
||||
set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\vcvarsall.bat" x86
|
||||
) else (
|
||||
set PHP_SDK_VC_SHELL_CMD="!PHP_SDK_VC_DIR!\Auxiliary\Build\vcvarsall.bat" x86
|
||||
set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\Auxiliary\Build\vcvarsall.bat" x86
|
||||
)
|
||||
)
|
||||
|
||||
rem echo Visual Studio path %PHP_SDK_VC_DIR%
|
||||
rem echo Visual Studio VC path %PHP_SDK_VC_DIR%
|
||||
rem echo Windows SDK path %PHP_SDK_WIN_SDK_DIR%
|
||||
|
||||
|
||||
|
||||
@@ -17,5 +17,12 @@ set PHP_SDK_PHP_CMD=%PHP_SDK_BIN_PATH%\php\do_php.bat
|
||||
|
||||
set PATH=%PHP_SDK_BIN_PATH%;%PHP_SDK_MSYS2_PATH%;%PATH%
|
||||
|
||||
for /f "tokens=1* delims=: " %%a in ('link /?') do (
|
||||
set PHP_SDK_VC_TOOLSET_VER=%%b
|
||||
goto break0
|
||||
)
|
||||
:break0
|
||||
set PHP_SDK_VC_TOOLSET_VER=%PHP_SDK_VC_TOOLSET_VER:~-13%
|
||||
|
||||
exit /b %errorlevel%
|
||||
|
||||
|
||||
BIN
bin/vswhere.exe
BIN
bin/vswhere.exe
Binary file not shown.
@@ -41,7 +41,7 @@ class PGO
|
||||
$dll = array_merge($dll, glob($this->php->getExtRootDir() . DIRECTORY_SEPARATOR . "php*.dll"));
|
||||
|
||||
/* find out next index */
|
||||
$tpl = glob($this->php->getRootDir() . DIRECTORY_SEPARATOR . "php7{ts,}.dll", GLOB_BRACE)[0];
|
||||
$tpl = glob($this->php->getRootDir() . DIRECTORY_SEPARATOR . "php{7,8,}{ts,}.dll", GLOB_BRACE)[0];
|
||||
if (!$tpl) {
|
||||
throw new Exception("Couldn't find php7[ts].dll in the PHP root dir.");
|
||||
}
|
||||
|
||||
@@ -138,7 +138,8 @@ class Config
|
||||
$tmp = $fetcher->getByUri(self::$depsBaseUri . "/series/");
|
||||
if (false !== $tmp) {
|
||||
$data = array();
|
||||
if (preg_match_all(",/packages-(.+)-(vc\d+)-(x86|x64)-(stable|staging)\.txt,U", $tmp, $m, PREG_SET_ORDER)) {
|
||||
if (preg_match_all(",/packages-(.+)-(vc\d+)-(x86|x64)-(stable|staging)\.txt,U", $tmp, $m, PREG_SET_ORDER)
|
||||
|| preg_match_all(",/packages-(.+)-(vs\d+)-(x86|x64)-(stable|staging)\.txt,U", $tmp, $m, PREG_SET_ORDER)) {
|
||||
foreach ($m as $b) {
|
||||
if (!isset($data[$b[1]])) {
|
||||
$data[$b[1]] = array();
|
||||
@@ -293,10 +294,13 @@ class Config
|
||||
}
|
||||
}
|
||||
|
||||
if (!@$ret["stability"]) {
|
||||
if (!isset($ret["arch"]) || !$ret["arch"]) {
|
||||
throw new Exception("Failed to find config with arch '" . self::getCurrentArchName() . "'");
|
||||
}
|
||||
if (!isset($ret["stability"]) || !$ret["stability"]) {
|
||||
throw new Exception("Failed to find config with stability '" . self::getCurrentStabilityName() . "'");
|
||||
}
|
||||
if (!@$ret["crt"]) {
|
||||
if (!isset($ret["crt"]) || !$ret["crt"]) {
|
||||
throw new Exception("Failed to find config with arch '" . self::getCurrentArchName() . "'");
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,9 @@ class Lock
|
||||
} else {
|
||||
$this->fd = fopen($this->fn, "wb");
|
||||
}
|
||||
if (false === $this->fd) {
|
||||
throw new Exception("Failed to open lock under '$this->fn'");
|
||||
}
|
||||
$this->locked = flock($this->fd, $flags, $this->wouldBlock);
|
||||
return $this->locked;
|
||||
}/*}}}*/
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
msys2/usr/bin/msys-gcc_s-seh-1.dll
Executable file
BIN
msys2/usr/bin/msys-gcc_s-seh-1.dll
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
# bison-i18n.m4 serial 2
|
||||
|
||||
dnl Copyright (C) 2005-2006, 2009-2015, 2018 Free Software Foundation,
|
||||
dnl Inc.
|
||||
dnl Copyright (C) 2005-2006, 2009-2015, 2018-2019 Free Software
|
||||
dnl Foundation, Inc.
|
||||
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# bits2str --- turn a byte into readable ones and zeros
|
||||
# bits2str --- turn an integer into readable ones and zeros
|
||||
|
||||
function bits2str(bits, data, mask)
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ function _gr_init( oldfs, oldrs, olddol0, grcat,
|
||||
n = split($4, a, "[ \t]*,[ \t]*")
|
||||
for (i = 1; i <= n; i++)
|
||||
if (a[i] in _gr_groupsbyuser)
|
||||
_gr_groupsbyuser[a[i]] = gr_groupsbyuser[a[i]] " " $1
|
||||
_gr_groupsbyuser[a[i]] = _gr_groupsbyuser[a[i]] " " $1
|
||||
else
|
||||
_gr_groupsbyuser[a[i]] = $1
|
||||
|
||||
|
||||
@@ -1,4 +1,26 @@
|
||||
# inplace --- load and invoke the inplace extension.
|
||||
#
|
||||
# Copyright (C) 2013, 2017 the Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GAWK, the GNU implementation of the
|
||||
# AWK Programming Language.
|
||||
#
|
||||
# GAWK 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.
|
||||
#
|
||||
# GAWK is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
#
|
||||
# Andrew J. Schorr, aschorr@telemetry-investments.com
|
||||
# January 2013
|
||||
|
||||
@load "inplace"
|
||||
|
||||
@@ -15,7 +37,7 @@
|
||||
# actions in an ENDFILE rule will be redirected as expected.
|
||||
|
||||
BEGIN {
|
||||
inplace = 1 # enabled by default
|
||||
inplace = 1 # enabled by default
|
||||
}
|
||||
|
||||
BEGINFILE {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
This directory contains data needed by Bison.
|
||||
|
||||
* Skeletons
|
||||
Bison skeletons: the general shapes of the different parser kinds,
|
||||
that are specialized for specific grammars by the bison program.
|
||||
# Directory content
|
||||
## Skeletons
|
||||
Bison skeletons: the general shapes of the different parser kinds, that are
|
||||
specialized for specific grammars by the bison program.
|
||||
|
||||
Currently, the supported skeletons are:
|
||||
|
||||
@@ -22,19 +23,18 @@ Currently, the supported skeletons are:
|
||||
- glr.cc
|
||||
A Generalized LR C++ parser. Actually a C++ wrapper around glr.c.
|
||||
|
||||
These skeletons are the only ones supported by the Bison team.
|
||||
Because the interface between skeletons and the bison program is not
|
||||
finished, *we are not bound to it*. In particular, Bison is not
|
||||
mature enough for us to consider that "foreign skeletons" are
|
||||
supported.
|
||||
These skeletons are the only ones supported by the Bison team. Because the
|
||||
interface between skeletons and the bison program is not finished, *we are
|
||||
not bound to it*. In particular, Bison is not mature enough for us to
|
||||
consider that "foreign skeletons" are supported.
|
||||
|
||||
* m4sugar
|
||||
This directory contains M4sugar, sort of an extended library for M4,
|
||||
which is used by Bison to instantiate the skeletons.
|
||||
## m4sugar
|
||||
This directory contains M4sugar, sort of an extended library for M4, which
|
||||
is used by Bison to instantiate the skeletons.
|
||||
|
||||
* xslt
|
||||
This directory contains XSLT programs that transform Bison's XML output
|
||||
into various formats.
|
||||
## xslt
|
||||
This directory contains XSLT programs that transform Bison's XML output into
|
||||
various formats.
|
||||
|
||||
- bison.xsl
|
||||
A library of routines used by the other XSLT programs.
|
||||
@@ -48,13 +48,132 @@ into various formats.
|
||||
- xml2xhtml.xsl
|
||||
Conversion into XHTML.
|
||||
|
||||
# Implementation note about the skeletons
|
||||
|
||||
"Skeleton" in Bison parlance means "backend": a skeleton is fed by the bison
|
||||
executable with LR tables, facts about the symbols, etc. and they generate
|
||||
the output (say parser.cc, parser.hh, location.hh, etc.). They are only in
|
||||
charge of generating the parser and its auxiliary files, they do not
|
||||
generate the XML output, the parser.output reports, nor the graphical
|
||||
rendering.
|
||||
|
||||
The bits of information passing from bison to the backend is named
|
||||
"muscles". Muscles are passed to M4 via its standard input: it's a set of
|
||||
m4 definitions. To see them, use `--trace=muscles`.
|
||||
|
||||
Except for muscles, whose names are generated by bison, the skeletons have
|
||||
no constraint at all on the macro names: there is no technical/theoretical
|
||||
limitation, as long as you generate the output, you can do what you want.
|
||||
However, of course, that would be a bad idea if, say, the C and C++
|
||||
skeletons used different approaches and had completely different
|
||||
implementations. That would be a maintenance nightmare.
|
||||
|
||||
Below, we document some of the macros that we use in several of the
|
||||
skeletons. If you are to write a new skeleton, please, implement them for
|
||||
your language. Overall, be sure to follow the same patterns as the existing
|
||||
skeletons.
|
||||
|
||||
## Symbols
|
||||
|
||||
### `b4_symbol(NUM, FIELD)`
|
||||
In order to unify the handling of the various aspects of symbols (tag, type
|
||||
name, whether terminal, etc.), bison.exe defines one macro per (token,
|
||||
field), where field can `has_id`, `id`, etc.: see
|
||||
`prepare_symbols_definitions()` in `src/output.c`.
|
||||
|
||||
The macro `b4_symbol(NUM, FIELD)` gives access to the following FIELDS:
|
||||
|
||||
- `has_id`: 0 or 1.
|
||||
|
||||
Whether the symbol has an id.
|
||||
|
||||
- `id`: string
|
||||
If has_id, the id (prefixed by api.token.prefix if defined), otherwise
|
||||
defined as empty. Guaranteed to be usable as a C identifier.
|
||||
|
||||
- `tag`: string.
|
||||
A representation of the symbol. Can be 'foo', 'foo.id', '"foo"' etc.
|
||||
|
||||
- `user_number`: integer
|
||||
The external number as used by yylex. Can be ASCII code when a character,
|
||||
some number chosen by bison, or some user number in the case of
|
||||
%token FOO <NUM>. Corresponds to yychar in yacc.c.
|
||||
|
||||
- `is_token`: 0 or 1
|
||||
Whether this is a terminal symbol.
|
||||
|
||||
- `number`: integer
|
||||
The internal number (computed from the external number by yytranslate).
|
||||
Corresponds to yytoken in yacc.c. This is the same number that serves as
|
||||
key in b4_symbol(NUM, FIELD).
|
||||
|
||||
In bison, symbols are first assigned increasing numbers in order of
|
||||
appearance (but tokens first, then nterms). After grammar reduction,
|
||||
unused nterms are then renumbered to appear last (i.e., first tokens, then
|
||||
used nterms and finally unused nterms). This final number NUM is the one
|
||||
contained in this field, and it is the one used as key in `b4_symbol(NUM,
|
||||
FIELD)`.
|
||||
|
||||
The code of the rule actions, however, is emitted before we know what
|
||||
symbols are unused, so they use the original numbers. To avoid confusion,
|
||||
they actually use "orig NUM" instead of just "NUM". bison also emits
|
||||
definitions for `b4_symbol(orig NUM, number)` that map from original
|
||||
numbers to the new ones. `b4_symbol` actually resolves `orig NUM` in the
|
||||
other case, i.e., `b4_symbol(orig 42, tag)` would return the tag of the
|
||||
symbols whose original number was 42.
|
||||
|
||||
- `has_type`: 0, 1
|
||||
Whether has a semantic value.
|
||||
|
||||
- `type_tag`: string
|
||||
When api.value.type=union, the generated name for the union member.
|
||||
yytype_INT etc. for symbols that has_id, otherwise yytype_1 etc.
|
||||
|
||||
- `type`
|
||||
If it has a semantic value, its type tag, or, if variant are used,
|
||||
its type.
|
||||
In the case of api.value.type=union, type is the real type (e.g. int).
|
||||
|
||||
- `has_printer`: 0, 1
|
||||
- `printer`: string
|
||||
- `printer_file`: string
|
||||
- `printer_line`: integer
|
||||
If the symbol has a printer, everything about it.
|
||||
|
||||
- `has_destructor`, `destructor`, `destructor_file`, `destructor_line`
|
||||
Likewise.
|
||||
|
||||
### `b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])`
|
||||
Expansion of $$, $1, $<TYPE-TAG>3, etc.
|
||||
|
||||
The semantic value from a given VAL.
|
||||
- `VAL`: some semantic value storage (typically a union). e.g., `yylval`
|
||||
- `SYMBOL-NUM`: the symbol number from which we extract the type tag.
|
||||
- `TYPE-TAG`, the user forced the `<TYPE-TAG>`.
|
||||
|
||||
The result can be used safely, it is put in parens to avoid nasty precedence
|
||||
issues.
|
||||
|
||||
### `b4_lhs_value(SYMBOL-NUM, [TYPE])`
|
||||
Expansion of `$$` or `$<TYPE>$`, for symbol `SYMBOL-NUM`.
|
||||
|
||||
### `b4_rhs_data(RULE-LENGTH, POS)`
|
||||
The data corresponding to the symbol `#POS`, where the current rule has
|
||||
`RULE-LENGTH` symbols on RHS.
|
||||
|
||||
### `b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])`
|
||||
Expansion of `$<TYPE>POS`, where the current rule has `RULE-LENGTH` symbols
|
||||
on RHS.
|
||||
|
||||
-----
|
||||
|
||||
Local Variables:
|
||||
mode: outline
|
||||
mode: markdown
|
||||
fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 2002, 2008-2015, 2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2008-2015, 2018-2019 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bison.
|
||||
|
||||
|
||||
60
msys2/usr/share/bison/skeletons/README-D.txt
Normal file
60
msys2/usr/share/bison/skeletons/README-D.txt
Normal file
@@ -0,0 +1,60 @@
|
||||
Some usage notes for the D Parser:
|
||||
|
||||
- it is a port of the Java parser, so interface is very similar.
|
||||
|
||||
- the lexer class needs to implement the interface 'Lexer' (similar to
|
||||
java). It typically (depending on options) looks like this:
|
||||
|
||||
public interface Lexer
|
||||
{
|
||||
/**
|
||||
* Method to retrieve the beginning position of the last scanned token.
|
||||
* @return the position at which the last scanned token starts. */
|
||||
@property YYPosition startPos ();
|
||||
|
||||
/**
|
||||
* Method to retrieve the ending position of the last scanned token.
|
||||
* @return the first position beyond the last scanned token. */
|
||||
@property YYPosition endPos ();
|
||||
|
||||
/**
|
||||
* Method to retrieve the semantic value of the last scanned token.
|
||||
* @return the semantic value of the last scanned token. */
|
||||
@property YYSemanticType semanticVal ();
|
||||
|
||||
/**
|
||||
* Entry point for the scanner. Returns the token identifier corresponding
|
||||
* to the next token and prepares to return the semantic value
|
||||
* and beginning/ending positions of the token.
|
||||
* @return the token identifier corresponding to the next token. */
|
||||
YYTokenType yylex ();
|
||||
|
||||
/**
|
||||
* Entry point for error reporting. Emits an error
|
||||
* referring to the given location in a user-defined way.
|
||||
*
|
||||
* @param loc The location of the element to which the
|
||||
* error message is related
|
||||
* @param s The string for the error message. */
|
||||
void yyerror (YYLocation loc, string s);
|
||||
}
|
||||
|
||||
- semantic types are handled by D usions (same as for C/C++ parsers)
|
||||
|
||||
- the following (non-standard) %defines are supported:
|
||||
|
||||
%define package "<package_name>"
|
||||
%define api.parser.class "my_class_name>"
|
||||
%define position_type "my_position_type"
|
||||
%define location_type "my_location_type"
|
||||
|
||||
- the following declarations basically work like in C/C++:
|
||||
|
||||
%locations
|
||||
%error-verbose
|
||||
%parse-param
|
||||
%initial-action
|
||||
%code
|
||||
%union
|
||||
|
||||
- %destructor is not yet supported
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
# Language-independent M4 Macros for Bison.
|
||||
|
||||
# Copyright (C) 2002, 2004-2015, 2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002, 2004-2015, 2018-2019 Free Software Foundation,
|
||||
# Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -263,8 +264,8 @@ m4_define([b4_subtract],
|
||||
# -------------------
|
||||
# Join with comma, skipping empty arguments.
|
||||
# b4_join calls itself recursively until it sees the first non-empty
|
||||
# argument, then calls _b4_join which prepends each non-empty argument
|
||||
# with a comma.
|
||||
# argument, then calls _b4_join (i.e., `_$0`) which prepends each
|
||||
# non-empty argument with a comma.
|
||||
m4_define([b4_join],
|
||||
[m4_if([$#$1],
|
||||
[1], [],
|
||||
@@ -374,60 +375,42 @@ b4_define_flag_if([token_table]) # Whether yytoken_table is demanded.
|
||||
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
||||
|
||||
|
||||
# b4_glr_cc_if([IF-TRUE], [IF-FALSE])
|
||||
# -----------------------------------
|
||||
m4_define([b4_glr_cc_if],
|
||||
[m4_if(b4_skeleton, ["glr.cc"], $@)])
|
||||
|
||||
|
||||
## --------- ##
|
||||
## Symbols. ##
|
||||
## --------- ##
|
||||
|
||||
# In order to unify the handling of the various aspects of symbols
|
||||
# (tag, type_name, whether terminal, etc.), bison.exe defines one
|
||||
# macro per (token, field), where field can has_id, id, etc.: see
|
||||
# src/output.c:prepare_symbols_definitions().
|
||||
# For a description of the Symbol handling, see README.
|
||||
#
|
||||
# The various FIELDS are:
|
||||
#
|
||||
# - has_id: 0 or 1.
|
||||
# Whether the symbol has an id.
|
||||
# - id: string
|
||||
# If has_id, the id. Guaranteed to be usable as a C identifier.
|
||||
# Prefixed by api.token.prefix if defined.
|
||||
# - tag: string.
|
||||
# A representat of the symbol. Can be 'foo', 'foo.id', '"foo"' etc.
|
||||
# - user_number: integer
|
||||
# The assigned (external) number as used by yylex.
|
||||
# - is_token: 0 or 1
|
||||
# Whether this is a terminal symbol.
|
||||
# - number: integer
|
||||
# The internalized number (used after yytranslate).
|
||||
# - has_type: 0, 1
|
||||
# Whether has a semantic value.
|
||||
# - type_tag: string
|
||||
# When api.value.type=union, the generated name for the union member.
|
||||
# yytype_INT etc. for symbols that has_id, otherwise yytype_1 etc.
|
||||
# - type
|
||||
# If it has a semantic value, its type tag, or, if variant are used,
|
||||
# its type.
|
||||
# In the case of api.value.type=union, type is the real type (e.g. int).
|
||||
# - has_printer: 0, 1
|
||||
# - printer: string
|
||||
# - printer_file: string
|
||||
# - printer_line: integer
|
||||
# If the symbol has a printer, everything about it.
|
||||
# - has_destructor, destructor, destructor_file, destructor_line
|
||||
# Likewise.
|
||||
#
|
||||
# The following macros provide access to these values.
|
||||
# The following macros provide access to symbol related values.
|
||||
|
||||
# __b4_symbol(NUM, FIELD)
|
||||
# -----------------------
|
||||
# Recover a FIELD about symbol #NUM. Thanks to m4_indir, fails if
|
||||
# undefined.
|
||||
m4_define([__b4_symbol],
|
||||
[m4_indir([b4_symbol($1, $2)])])
|
||||
|
||||
|
||||
# _b4_symbol(NUM, FIELD)
|
||||
# ----------------------
|
||||
# Recover a FIELD about symbol #NUM. Thanks to m4_indir, fails if
|
||||
# Recover a FIELD about symbol #NUM (or "orig NUM"). Fails if
|
||||
# undefined.
|
||||
m4_define([_b4_symbol],
|
||||
[m4_indir([b4_symbol($1, $2)])])
|
||||
[m4_ifdef([b4_symbol($1, number)],
|
||||
[__b4_symbol(m4_indir([b4_symbol($1, number)]), $2)],
|
||||
[__b4_symbol([$1], [$2])])])
|
||||
|
||||
|
||||
|
||||
# b4_symbol(NUM, FIELD)
|
||||
# ---------------------
|
||||
# Recover a FIELD about symbol #NUM. Thanks to m4_indir, fails if
|
||||
# Recover a FIELD about symbol #NUM (or "orig NUM"). Fails if
|
||||
# undefined. If FIELD = id, prepend the token prefix.
|
||||
m4_define([b4_symbol],
|
||||
[m4_case([$2],
|
||||
@@ -468,8 +451,8 @@ m4_define([b4_symbol_action_location],
|
||||
m4_define([b4_symbol_action],
|
||||
[b4_symbol_if([$1], [has_$2],
|
||||
[b4_dollar_pushdef([(*yyvaluep)],
|
||||
b4_symbol_if([$1], [has_type],
|
||||
[m4_dquote(b4_symbol([$1], [type]))]),
|
||||
[$1],
|
||||
[],
|
||||
[(*yylocationp)])dnl
|
||||
_b4_symbol_case([$1])[]dnl
|
||||
b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])
|
||||
@@ -497,7 +480,7 @@ m4_define([b4_symbol_actions],
|
||||
m4_ifval(m4_defn([b4_actions_]),
|
||||
[switch (m4_default([$2], [yytype]))
|
||||
{
|
||||
m4_defn([b4_actions_])
|
||||
m4_defn([b4_actions_])[]dnl
|
||||
default:
|
||||
break;
|
||||
}dnl
|
||||
@@ -508,7 +491,9 @@ m4_popdef([b4_actions_])dnl
|
||||
|
||||
# _b4_symbol_case(SYMBOL-NUM)
|
||||
# ---------------------------
|
||||
# Issue a "case NUM" for SYMBOL-NUM.
|
||||
# Issue a "case NUM" for SYMBOL-NUM. Ends with its EOL to make it
|
||||
# easier to use with m4_map, but then, use []dnl to suppress the last
|
||||
# one.
|
||||
m4_define([_b4_symbol_case],
|
||||
[case b4_symbol([$1], [number]): b4_symbol_tag_comment([$1])])
|
||||
])
|
||||
@@ -569,7 +554,7 @@ m4_define([b4_token_format],
|
||||
# Run actions for the symbol NUMS that all have the same type-name.
|
||||
# Skip NUMS that have no type-name.
|
||||
#
|
||||
# To specify the action to run, define b4_dollar_dollar(NUMBER,
|
||||
# To specify the action to run, define b4_dollar_dollar(SYMBOL-NUM,
|
||||
# TAG, TYPE).
|
||||
m4_define([_b4_type_action],
|
||||
[b4_symbol_if([$1], [has_type],
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user