mirror of
https://github.com/php-win-ext/php-sdk-binary-tools.git
synced 2026-03-24 17:12:12 +01:00
Compare commits
92 Commits
php-sdk-2.
...
php-sdk-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41a63dc0b4 | ||
|
|
99ae3ca016 | ||
|
|
777542838c | ||
|
|
82987940a0 | ||
|
|
45344d7691 | ||
|
|
02a726256a | ||
|
|
0a7732ba09 | ||
|
|
8583bb4f00 | ||
|
|
d6fc46edfd | ||
|
|
75740674e5 | ||
|
|
e81199f9af | ||
|
|
134556d419 | ||
|
|
6121772665 | ||
|
|
61dff2296a | ||
|
|
1b8473489f | ||
|
|
e494a28d4c | ||
|
|
22addaf53e | ||
|
|
bb8e318a4a | ||
|
|
87b60bc9d5 | ||
|
|
4936f1d7ca | ||
|
|
7d56095191 | ||
|
|
27c3431e92 | ||
|
|
e5ef707fa0 | ||
|
|
7df3de21ce | ||
|
|
64b37312f7 | ||
|
|
4a219a0d93 | ||
|
|
5d97e8e483 | ||
|
|
9a0f799055 | ||
|
|
4f5028d87a | ||
|
|
93437db5ae | ||
|
|
0572a3ec52 | ||
|
|
52badef774 | ||
|
|
b01fcd36e7 | ||
|
|
fbc6c40761 | ||
|
|
7501f5e567 | ||
|
|
e51c37a375 | ||
|
|
bd0ab3474c | ||
|
|
056e5643fb | ||
|
|
e039de13c4 | ||
|
|
59926c2903 | ||
|
|
7d2b6cf86f | ||
|
|
29d54c140e | ||
|
|
2ef8899939 | ||
|
|
c259e440b6 | ||
|
|
5470b5ae58 | ||
|
|
795ac45864 | ||
|
|
77408342bc | ||
|
|
f9aff35c14 | ||
|
|
a827b2f18f | ||
|
|
5352b3744a | ||
|
|
d816060d55 | ||
|
|
da1e89d23a | ||
|
|
eb3904741a | ||
|
|
6dc9fd3293 | ||
|
|
1d2dae619e | ||
|
|
2a7f364792 | ||
|
|
36570ced8e | ||
|
|
7f75a93bdd | ||
|
|
44925fe946 | ||
|
|
e8d07f824b | ||
|
|
a5426ba7bb | ||
|
|
871816e56c | ||
|
|
70c3290c08 | ||
|
|
d84784d37a | ||
|
|
8ad74abf3f | ||
|
|
9ad145c154 | ||
|
|
f3001d950e | ||
|
|
01ab6a1bad | ||
|
|
659fb3a71d | ||
|
|
d7dcab4c2f | ||
|
|
15ec0845c4 | ||
|
|
a1bab3dc92 | ||
|
|
08b81a4ffc | ||
|
|
569072060e | ||
|
|
b13a2df162 | ||
|
|
96fa91e16a | ||
|
|
8ad971020a | ||
|
|
386d36c251 | ||
|
|
bd9c9ca4d8 | ||
|
|
1d6561c7d5 | ||
|
|
307c5ed4bc | ||
|
|
c6874e5109 | ||
|
|
c3cf4266ad | ||
|
|
01e4fff84a | ||
|
|
4357adc956 | ||
|
|
0a33374aed | ||
|
|
ff16eebfce | ||
|
|
afc302d27e | ||
|
|
e6c79ecad5 | ||
|
|
80dc35f668 | ||
|
|
bd3e1603a9 | ||
|
|
8505dda9c4 |
@@ -12,7 +12,7 @@ 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
|
||||
- `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)
|
||||
- if `Cygwin` 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
|
||||
@@ -33,7 +33,7 @@ All the tools included are either scripts or 32-bit binaries. They are therefore
|
||||
|
||||
## Other tools
|
||||
|
||||
- `bison` 3.0.4, `re2c` 1.0.2, `lemon`
|
||||
- `bison` 3.0.5, `re2c` 1.0.3, `lemon`
|
||||
- `awk`, `gawk`, `sed`, `grep`
|
||||
- `diff`, `diff3`, `patch`
|
||||
- `md5sum`, `sha1sum`, `sha224sum`, `sha256sum`, `sha384sum`, `sha512sum`
|
||||
@@ -138,6 +138,10 @@ After a training case is implemented and put under `pgo/cases`, the work environ
|
||||
|
||||
To skip a training case, add a file named `inactive` into the case folder.
|
||||
|
||||
# Support
|
||||
|
||||
- Join `#winphp-dev` on Freenode to discuss any ideas or questions
|
||||
- File an issue on GitHub
|
||||
|
||||
# Pitfalls
|
||||
|
||||
|
||||
BIN
bin/7za.dll
BIN
bin/7za.dll
Binary file not shown.
BIN
bin/7za.exe
BIN
bin/7za.exe
Binary file not shown.
BIN
bin/7zxa.dll
BIN
bin/7zxa.dll
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
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.
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
include dirname(__FILE__) . "/../lib/php/autoload.php";
|
||||
include __DIR__ . "/../lib/php/autoload.php";
|
||||
|
||||
use SDK\{Config, Exception};
|
||||
|
||||
@@ -36,7 +36,7 @@ try {
|
||||
switch ($name) {
|
||||
default:
|
||||
throw new Exception("Unknown switch '$name'");
|
||||
break;
|
||||
break;
|
||||
|
||||
case "h":
|
||||
case "help":
|
||||
|
||||
@@ -29,10 +29,10 @@ $flags = 0;
|
||||
$opt = getopt($sopt, $lopt);
|
||||
foreach ($opt as $name => $val) {
|
||||
switch ($name) {
|
||||
case "p":
|
||||
case "pretty":
|
||||
$flags = JSON_PRETTY_PRINT;
|
||||
break;
|
||||
case "p":
|
||||
case "pretty":
|
||||
$flags = JSON_PRETTY_PRINT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,16 +85,16 @@ foreach ($dirs as $path) {
|
||||
|
||||
$dlls = array();
|
||||
|
||||
for( $i = 0; $i < $zip->numFiles; $i++ ){
|
||||
$stat = $zip->statIndex( $i );
|
||||
|
||||
for ($i = 0; $i < $zip->numFiles; $i++) {
|
||||
$stat = $zip->statIndex($i);
|
||||
|
||||
if (substr($stat['name'], -3) != "dll") {
|
||||
continue;
|
||||
}
|
||||
|
||||
$dlls[] = basename($stat['name']);
|
||||
}
|
||||
|
||||
|
||||
$zip->close();
|
||||
unset($zip);
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
include dirname(__FILE__) . "/../lib/php/autoload.php";
|
||||
include __DIR__ . "/../lib/php/autoload.php";
|
||||
|
||||
use SDK\Config;
|
||||
use SDK\Exception;
|
||||
use SDK\Build\PGO\Controller;
|
||||
|
||||
$sopt = "itudhs:fr";
|
||||
$lopt = array("init", "train", "up", "down", "help", "scenario:", "force", "ready");
|
||||
$sopt = "itudhs:frc:";
|
||||
$lopt = array("init", "train", "up", "down", "help", "scenario:", "force", "ready", "cases:");
|
||||
|
||||
$cmd = NULL;
|
||||
/* TODO For now we simply check the current php build, this could be extended to take arbitrary binaries. */
|
||||
@@ -15,42 +15,48 @@ $deps_root = NULL;
|
||||
$php_root = NULL;
|
||||
$scenario = NULL;
|
||||
$force = false;
|
||||
$cases = NULL;
|
||||
|
||||
try {
|
||||
$opt = getopt($sopt, $lopt);
|
||||
foreach ($opt as $name => $val) {
|
||||
switch ($name) {
|
||||
case "i":
|
||||
case "init":
|
||||
$cmd = "init";
|
||||
break;
|
||||
case "ready":
|
||||
$cmd = "check_init";
|
||||
break;
|
||||
case "t":
|
||||
case "train":
|
||||
$cmd = "train";
|
||||
break;
|
||||
case "u":
|
||||
case "up":
|
||||
$cmd = "up";
|
||||
break;
|
||||
case "d":
|
||||
case "down":
|
||||
$cmd = "down";
|
||||
break;
|
||||
case "s":
|
||||
case "scenario":
|
||||
$scenario = $val;
|
||||
break;
|
||||
case "f":
|
||||
case "force":
|
||||
$force = true;
|
||||
break;
|
||||
case "h": case "help":
|
||||
usage(0);
|
||||
break;
|
||||
|
||||
case "i":
|
||||
case "init":
|
||||
$cmd = "init";
|
||||
break;
|
||||
case "ready":
|
||||
$cmd = "check_init";
|
||||
break;
|
||||
case "t":
|
||||
case "train":
|
||||
$cmd = "train";
|
||||
break;
|
||||
case "u":
|
||||
case "up":
|
||||
$cmd = "up";
|
||||
break;
|
||||
case "d":
|
||||
case "down":
|
||||
$cmd = "down";
|
||||
break;
|
||||
case "s":
|
||||
case "scenario":
|
||||
$scenario = $val;
|
||||
break;
|
||||
case "f":
|
||||
case "force":
|
||||
$force = true;
|
||||
break;
|
||||
/* XXX This option is for now only integrated for training. It
|
||||
would make sense to integrate it also with init. */
|
||||
case "c":
|
||||
case "cases":
|
||||
$cases = explode(",", $val);
|
||||
break;
|
||||
case "h": case "help":
|
||||
usage(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +79,7 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
$controller = new Controller($cmd, $scenario);
|
||||
$controller = new Controller($cmd, $scenario, $cases);
|
||||
$controller->handle($force);
|
||||
|
||||
if ("check_init" == $cmd) {
|
||||
@@ -105,6 +111,7 @@ function usage(int $code = -1)
|
||||
echo " -d --down Shutdown training environment.", PHP_EOL;
|
||||
echo " -f --force Force requested operation. Not every option can be forced.", PHP_EOL;
|
||||
echo " -s --scenario Run training with a specified scenario.", PHP_EOL;
|
||||
echo " -c --cases Run training with specified cases only. If omited, all the active cases will be used.", PHP_EOL;
|
||||
|
||||
/*echo " -p --php-root PHP binary to train.", PHP_EOL;*/
|
||||
|
||||
|
||||
BIN
bin/sqlite3.exe
Normal file
BIN
bin/sqlite3.exe
Normal file
Binary file not shown.
BIN
bin/vswhere.exe
BIN
bin/vswhere.exe
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
spl_autoload_register(function($name) {
|
||||
$fl = dirname(__FILE__) . DIRECTORY_SEPARATOR . "libsdk" . DIRECTORY_SEPARATOR . $name . ".php";
|
||||
$fl = __DIR__ . DIRECTORY_SEPARATOR . "libsdk" . DIRECTORY_SEPARATOR . $name . ".php";
|
||||
|
||||
if (file_exists($fl)) {
|
||||
require_once $fl;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace SDK\Build\Dependency;
|
||||
|
||||
use SDK\{Config, Exception, FileOps};
|
||||
use SDK\{Exception, FileOps};
|
||||
|
||||
class Fetcher
|
||||
{
|
||||
@@ -13,6 +13,7 @@ class Fetcher
|
||||
protected $stability;
|
||||
protected $arch;
|
||||
protected $series;
|
||||
protected $scheme;
|
||||
|
||||
|
||||
public function __construct(string $host, int $port, string $scheme = "https", string $arch = NULL, string $stability = NULL, Series $series = NULL)
|
||||
@@ -22,6 +23,7 @@ class Fetcher
|
||||
$this->host = $host;
|
||||
$this->port = $port;
|
||||
$this->scheme = $scheme;
|
||||
$this->series = $series;
|
||||
}/*}}}*/
|
||||
|
||||
public function getSeries() : Series
|
||||
|
||||
@@ -11,6 +11,7 @@ class Manager
|
||||
protected $stability;
|
||||
protected $arch;
|
||||
protected $path;
|
||||
protected $cache;
|
||||
protected $series;
|
||||
protected $fetcher;
|
||||
protected $updatesFlag = NULL;
|
||||
@@ -41,7 +42,7 @@ class Manager
|
||||
|
||||
public function updatesAvailable() : bool
|
||||
{/*{{{*/
|
||||
if (!is_null($this->updatesFlag)) {
|
||||
if (NULL !== $this->updatesFlag) {
|
||||
return $this->updatesFlag;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ class Series
|
||||
|
||||
public function getName() : string
|
||||
{/*{{{*/
|
||||
$base = Config::getDepsBaseUri();
|
||||
$branch_data = Config::getCurrentBranchData();
|
||||
|
||||
$file = "packages-" . Config::getCurrentBranchName() . "-{$branch_data['crt']}-{$this->arch}-{$this->stability}.txt";
|
||||
|
||||
@@ -2,15 +2,17 @@
|
||||
|
||||
namespace SDK\Build\PGO\Abstracts;
|
||||
|
||||
use SDK\Build\PGO\Interfaces\Server;
|
||||
use SDK\Build\PGO\PHP\CLI;
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\{Config as SDKConfig, Exception};
|
||||
|
||||
abstract class PHP
|
||||
{
|
||||
protected $php_root;
|
||||
protected $php_ext_root;
|
||||
protected $opcache_file_cache;
|
||||
protected $id;
|
||||
protected $scenario;
|
||||
protected $conf;
|
||||
|
||||
protected function setupPaths()
|
||||
{
|
||||
@@ -23,6 +25,9 @@ abstract class PHP
|
||||
} else {
|
||||
$this->php_ext_root = $this->php_root;
|
||||
}
|
||||
if ("cache" == $this->scenario) {
|
||||
$this->opcache_file_cache = SDKConfig::getTmpDir() . DIRECTORY_SEPARATOR . $this->id;
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO Might be improved. */
|
||||
@@ -39,12 +44,22 @@ abstract class PHP
|
||||
$deps_root = SDKConfig::getDepsLocalPath();
|
||||
foreach ($env as $k => $v) {
|
||||
if (strtoupper($k) == "PATH") {
|
||||
$env[$k] = "$deps_root" . DIRECTORY_SEPARATOR . "bin;" . $env[$k];
|
||||
$env[$k] = $deps_root . DIRECTORY_SEPARATOR . "bin;" . $env[$k];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$drive = getenv("HOMEDRIVE");
|
||||
$path = getenv("HOMEPATH");
|
||||
if (!$drive || !$path) {
|
||||
$p = SDKConfig::getTmpDir();
|
||||
$drive = substr($p, 0, 2);
|
||||
$path = substr($p, 2);
|
||||
putenv("HOMEDRIVE=$drive");
|
||||
putenv("HOMEPATH=$path");
|
||||
}
|
||||
|
||||
return $env;
|
||||
}
|
||||
|
||||
@@ -95,7 +110,7 @@ abstract class PHP
|
||||
}
|
||||
}
|
||||
|
||||
if (is_null($ret)) {
|
||||
if (NULL === $ret) {
|
||||
throw new Exception("Failed to determine the test PHP version.");
|
||||
}
|
||||
|
||||
@@ -147,6 +162,11 @@ abstract class PHP
|
||||
}
|
||||
}
|
||||
|
||||
/* Special handling, otherwise it'll need functionality to extrapolate ini values. */
|
||||
if ("cache" == $this->scenario) {
|
||||
$tpl_vars[$this->conf->buildTplVarName("php", "opcache", "file_cache")] = $this->opcache_file_cache;
|
||||
}
|
||||
|
||||
$this->conf->processTplFile(
|
||||
$this->getIniTplFilename(),
|
||||
$ret,
|
||||
@@ -174,8 +194,8 @@ abstract class PHP
|
||||
public function exec(string $php_cmd, string $args = NULL, array $extra_env = array()) : int
|
||||
{
|
||||
$env = $this->createEnv();
|
||||
$exe = $this->getExeFilename();
|
||||
$ini = $this->getIniFilename();
|
||||
$exe = $this->getExeFilename();
|
||||
$ini = $this->getIniFilename();
|
||||
|
||||
$cert_path = getenv("PHP_SDK_ROOT_PATH") . "\\msys2\\usr\\ssl\\cert.pem";
|
||||
$ini .= " -d curl.cainfo=$cert_path";
|
||||
@@ -203,7 +223,7 @@ abstract class PHP
|
||||
$env[$k] = $v;
|
||||
}
|
||||
|
||||
$cmd = "$exe -n -c $ini " . ($args ? "$args " : "") . "$php_cmd";
|
||||
$cmd = "$exe -n -c $ini " . ($args ? "$args " : "") . $php_cmd;
|
||||
|
||||
$desc = array(
|
||||
0 => array("file", "php://stdin", "r"),
|
||||
@@ -214,5 +234,13 @@ abstract class PHP
|
||||
|
||||
return proc_close($p);
|
||||
}
|
||||
}
|
||||
|
||||
public function getIdString(): string
|
||||
{
|
||||
return $this->getVersion() . "-"
|
||||
. SDKConfig::getCurrentCrtName() . "-"
|
||||
. ($this->isThreadSafe() ? "ts" : "nts") . "-"
|
||||
. ($this->is64bit() ? "x64" : "x86")
|
||||
. "-" . substr(md5(uniqid()), 0, 8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace SDK\Build\PGO\Abstracts;
|
||||
|
||||
use SDK\Build\PGO\Interfaces;
|
||||
|
||||
class Server
|
||||
abstract class Server
|
||||
{
|
||||
public function getName() : string
|
||||
{
|
||||
@@ -17,6 +17,3 @@ class Server
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
|
||||
namespace SDK\Build\PGO\Abstracts;
|
||||
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\FileOps;
|
||||
use SDK\Build\PGO\Tool;
|
||||
|
||||
class TrainingCase
|
||||
abstract class TrainingCase
|
||||
{
|
||||
use FileOps;
|
||||
|
||||
@@ -14,6 +13,8 @@ class TrainingCase
|
||||
const TYPE_CLI = "cli";
|
||||
|
||||
protected $stat = array();
|
||||
/** @var \SDK\Build\PGO\Config */
|
||||
protected $conf;
|
||||
|
||||
public function getType() : string
|
||||
{
|
||||
@@ -148,4 +149,3 @@ class TrainingCase
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace SDK\Build\PGO;
|
||||
|
||||
use SDK\{Config as SDKConfig, Exception};
|
||||
use SDK\Exception;
|
||||
|
||||
class Config
|
||||
{
|
||||
@@ -18,7 +18,7 @@ class Config
|
||||
protected $tpl_vars = array();
|
||||
protected $srv = array();
|
||||
|
||||
public function __construct(int $mode = MODE_RUN)
|
||||
public function __construct(int $mode = self::MODE_RUN)
|
||||
{
|
||||
if (self::MODE_CHECK_INIT == $mode) {
|
||||
// XXX The check is simple right now, so this is sufficient.
|
||||
@@ -40,7 +40,6 @@ class Config
|
||||
$this->mode = $mode;
|
||||
|
||||
|
||||
$base = getenv("PHP_SDK_ROOT_PATH");
|
||||
if (self::MODE_INIT == $mode) {
|
||||
foreach (array("nginx", "mariadb", "postgresql", "php") as $i) {
|
||||
$this->importSectionFromDir($i, $this->getTplDir() . DIRECTORY_SEPARATOR . $i);
|
||||
@@ -279,7 +278,7 @@ class Config
|
||||
public function processTplFile(string $tpl_fn, string $dst_fn, array $additional_vars = array()) : void
|
||||
{
|
||||
if (!file_exists($tpl_fn)) {
|
||||
throw new Exception("Template file '$fn' doesn't exist.");
|
||||
throw new Exception("Template file '$tpl_fn' doesn't exist.");
|
||||
}
|
||||
|
||||
$s = file_get_contents($tpl_fn);
|
||||
@@ -368,4 +367,3 @@ class Config
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
|
||||
namespace SDK\Build\PGO;
|
||||
|
||||
use SDK\{Config as SDKConfig, Exception, Lock};
|
||||
use SDK\{Exception, Lock};
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
use SDK\Build\PGO\Server\{MariaDB, NGINX, PostgreSQL};
|
||||
use SDK\Build\PGO\PHP;
|
||||
use SDK\Build\PGO\Tool\{PGO, PackageWorkman};
|
||||
use SDK\Build\PGO\Interfaces\TrainingCase;
|
||||
use SDK\Build\PGO\TrainingCaseIterator;
|
||||
|
||||
|
||||
/* TODO add bench action */
|
||||
|
||||
@@ -17,8 +16,9 @@ class Controller
|
||||
protected $cmd;
|
||||
protected $scenario;
|
||||
protected $conf;
|
||||
protected $cases;
|
||||
|
||||
public function __construct(string $cmd, ?string $scenario)
|
||||
public function __construct(string $cmd, ?string $scenario, ?array $cases)
|
||||
{
|
||||
$this->cmd = $cmd;
|
||||
|
||||
@@ -26,6 +26,7 @@ class Controller
|
||||
$scenario = "default";
|
||||
}
|
||||
$this->scenario = $scenario;
|
||||
$this->cases = $cases;
|
||||
}
|
||||
|
||||
protected function vitalizeSrv()
|
||||
@@ -77,38 +78,38 @@ class Controller
|
||||
$this->conf = $this->setupConfig($this->cmd);
|
||||
|
||||
switch ($this->cmd) {
|
||||
default:
|
||||
throw new Exception("Unknown action '{$this->cmd}'.");
|
||||
break;
|
||||
case "init":
|
||||
$lk = new Lock("pgo_init");
|
||||
if (!$lk->locked()) {
|
||||
echo "Another process runs initialization right now, waiting.", PHP_EOL;
|
||||
$lk->exclusive(true);
|
||||
echo "Another process finished running initialization, I quit as well.", PHP_EOL;
|
||||
return;
|
||||
}
|
||||
$this->init($force);
|
||||
break;
|
||||
case "train":
|
||||
$lk = new Lock("pgo_train");
|
||||
if (!$lk->locked()) {
|
||||
echo "Another process runs training right now, I have to wait.", PHP_EOL;
|
||||
$lk->exclusive(true);
|
||||
echo "Another process finished training, I may continue.", PHP_EOL;
|
||||
}
|
||||
$this->train();
|
||||
break;
|
||||
case "up":
|
||||
$this->up();
|
||||
break;
|
||||
default:
|
||||
throw new Exception("Unknown action '{$this->cmd}'.");
|
||||
break;
|
||||
case "init":
|
||||
$lk = new Lock("pgo_init");
|
||||
if (!$lk->locked()) {
|
||||
echo "Another process runs initialization right now, waiting.", PHP_EOL;
|
||||
$lk->exclusive(true);
|
||||
echo "Another process finished running initialization, I quit as well.", PHP_EOL;
|
||||
return;
|
||||
}
|
||||
$this->init($force);
|
||||
break;
|
||||
case "train":
|
||||
$lk = new Lock("pgo_train");
|
||||
if (!$lk->locked()) {
|
||||
echo "Another process runs training right now, I have to wait.", PHP_EOL;
|
||||
$lk->exclusive(true);
|
||||
echo "Another process finished training, I may continue.", PHP_EOL;
|
||||
}
|
||||
$this->train();
|
||||
break;
|
||||
case "up":
|
||||
$this->up();
|
||||
break;
|
||||
|
||||
case "down":
|
||||
$this->down($force);
|
||||
break;
|
||||
case "check_init":
|
||||
// pass
|
||||
break;
|
||||
case "down":
|
||||
$this->down($force);
|
||||
break;
|
||||
case "check_init":
|
||||
// pass
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,6 +140,7 @@ class Controller
|
||||
if (!file_exists($composer) || $force) {
|
||||
/* XXX this needs to go into the config, specifically for composer maybe even separate class. */
|
||||
$url = "https://getcomposer.org/installer";
|
||||
/* XXX remove the explicit version option when symfony demo is fixed. */
|
||||
$tool = $this->conf->getToolsDir() . DIRECTORY_SEPARATOR . "composer-setup.php";
|
||||
$pw->fetch($url, $tool, $force);
|
||||
$php->exec("$tool --install-dir=" . $this->conf->getToolsDir());
|
||||
@@ -204,10 +206,24 @@ class Controller
|
||||
$pgo->clean();
|
||||
unset($pgo);
|
||||
|
||||
$cases = $this->cases;
|
||||
foreach (new TrainingCaseIterator($this->conf) as $handler) {
|
||||
$name = $handler->getName();
|
||||
/* Just a white list handling for now. */
|
||||
if (is_array($cases)) {
|
||||
if (!in_array($name, $cases)) {
|
||||
continue;
|
||||
}
|
||||
$key = array_search($name, $cases);
|
||||
unset($cases[$key]);
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
$handler->run();
|
||||
}
|
||||
if (is_array($cases) && !empty($cases)) {
|
||||
echo "\n\033[31m WARNING: The cases " . implode(",", $cases) . " don't exist and was ignored!\033[0m\n\n";
|
||||
}
|
||||
|
||||
/* All the PGC files are merged, simply clean them out. */
|
||||
$pgo = new PGO($this->conf, $php);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace SDK\Build\PGO\Interfaces;
|
||||
|
||||
use SDK\Build\PGO\Config;
|
||||
use SDK\Build\PGO\Tool\PackageWorkman;
|
||||
|
||||
interface PHP
|
||||
@@ -15,4 +14,3 @@ interface PHP
|
||||
public function getVersion(bool $short = false) : string;
|
||||
public function getExeFilename() : string;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace SDK\Build\PGO\Interfaces;
|
||||
|
||||
use SDK\Build\PGO\Config;
|
||||
use SDK\Build\PGO\Tool\PackageWorkman;
|
||||
|
||||
interface Server
|
||||
@@ -14,4 +13,3 @@ interface Server
|
||||
public function down(bool $force = false) : void;
|
||||
public function getName() : string;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,4 +10,3 @@ interface DB extends Interfaces\Server
|
||||
public function __construct(Config $conf);
|
||||
public function query(string $s, string $db = NULL) : void;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,4 +11,3 @@ interface HTTP extends Interfaces\Server
|
||||
public function getPhp() : Interfaces\PHP;
|
||||
public function addServer(string $part_tpl_fn, array $tpl_vars = array());
|
||||
}
|
||||
|
||||
|
||||
@@ -25,4 +25,3 @@ interface TrainingCase
|
||||
/* Get training type, it's like "web", "cli", etc.*/
|
||||
public function getType() : string;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,17 +5,19 @@ namespace SDK\Build\PGO\PHP;
|
||||
use SDK\Build\PGO\Interfaces;
|
||||
use SDK\Build\PGO\Abstracts;
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\{Exception};
|
||||
use SDK\Build\PGO\Tool\PackageWorkman;
|
||||
|
||||
class CLI extends Abstracts\PHP implements Interfaces\PHP
|
||||
{
|
||||
protected $conf;
|
||||
|
||||
public function __construct(PGOConfig $conf)
|
||||
{
|
||||
$this->conf = $conf;
|
||||
$this->scenario = $conf->getScenario();
|
||||
// Don't do that, it'll be a recursive dependency.
|
||||
// Once we need to train CLI, we'll need to split
|
||||
// a new class, this one is a utility class.
|
||||
//$this->id = $this->getIdString();
|
||||
|
||||
$this->setupPaths();
|
||||
}
|
||||
@@ -50,7 +52,4 @@ class CLI extends Abstracts\PHP implements Interfaces\PHP
|
||||
|
||||
return $exe;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,12 +5,13 @@ namespace SDK\Build\PGO\PHP;
|
||||
use SDK\Build\PGO\Interfaces;
|
||||
use SDK\Build\PGO\Abstracts;
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\{Exception, FileOps};
|
||||
use SDK\Build\PGO\Tool\PackageWorkman;
|
||||
|
||||
class FCGI extends Abstracts\PHP implements Interfaces\PHP
|
||||
{
|
||||
protected $conf;
|
||||
use FileOps;
|
||||
|
||||
protected $is_tcp;
|
||||
|
||||
public function __construct(PGOConfig $conf, bool $is_tcp)
|
||||
@@ -22,6 +23,7 @@ class FCGI extends Abstracts\PHP implements Interfaces\PHP
|
||||
$this->conf = $conf;
|
||||
$this->is_tcp = $is_tcp;
|
||||
$this->scenario = $conf->getScenario();
|
||||
$this->id = $this->getIdString();
|
||||
|
||||
$this->setupPaths();
|
||||
}
|
||||
@@ -64,6 +66,15 @@ echo "PHP FCGI initialization done.\n";*/
|
||||
{
|
||||
echo "Starting PHP FCGI.\n";
|
||||
|
||||
if ("cache" == $this->scenario) {
|
||||
if (file_exists($this->opcache_file_cache)) {
|
||||
$this->rm($this->opcache_file_cache);
|
||||
}
|
||||
if (!mkdir($this->opcache_file_cache)) {
|
||||
throw new Exception("Failed to create '{$this->opcache_file_cache}'");
|
||||
}
|
||||
}
|
||||
|
||||
$exe = $this->getExeFilename();
|
||||
$ini = $this->getIniFilename();
|
||||
$host = $this->conf->getSectionItem("php", "fcgi", "host");
|
||||
@@ -82,6 +93,10 @@ echo "PHP FCGI initialization done.\n";*/
|
||||
/* Give some time, it might be slow on PGI enabled proc. */
|
||||
sleep(3);
|
||||
|
||||
/*while(false !== ($s = fread($pipes[2], 1024))) {
|
||||
echo "$s";
|
||||
}*/
|
||||
|
||||
$c = proc_close($p);
|
||||
|
||||
if ($c) {
|
||||
@@ -99,7 +114,15 @@ echo "PHP FCGI initialization done.\n";*/
|
||||
|
||||
exec("taskkill /f /im php-cgi.exe >nul 2>&1");
|
||||
|
||||
/* XXX Add cleanup interface. */
|
||||
if ("cache" == $this->scenario) {
|
||||
try {
|
||||
$this->rm($this->opcache_file_cache);
|
||||
} catch (\UnexpectedValueException $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "PHP FCGI stopped.\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace SDK\Build\PGO\Server;
|
||||
use SDK\Build\PGO\Interfaces\Server\DB;
|
||||
use SDK\Build\PGO\Abstracts\Server;
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\{Exception, FileOps};
|
||||
use SDK\Build\PGO\Tool\PackageWorkman;
|
||||
|
||||
class MariaDB extends Server implements DB
|
||||
@@ -114,10 +114,30 @@ class MariaDB extends Server implements DB
|
||||
$port = $this->conf->getSectionItem($this->name, "port");
|
||||
|
||||
$pass_arg = $pass ? "-p$pass " : "";
|
||||
$ret = shell_exec(".\\bin\\mysql.exe -u $user $pass_arg -h $host -P $port -e \"$s\"");
|
||||
$db_arg = $db ? "-D $db" : "";
|
||||
shell_exec(".\\bin\\mysql.exe -u $user $pass_arg -h $host -P $port $db_arg -e \"$s\"");
|
||||
//var_dump($this->base, getcwd(), ".\\bin\\mysql.exe -u $user $pass_arg -h $host -P $port -e \"$s\"");
|
||||
|
||||
chdir($cwd);
|
||||
}
|
||||
}
|
||||
|
||||
public function import(string $path, string $db = NULL) : void
|
||||
{
|
||||
$ret = NULL;
|
||||
|
||||
$cwd = getcwd();
|
||||
|
||||
chdir($this->base);
|
||||
|
||||
$user = $this->conf->getSectionItem($this->name, "user");
|
||||
$pass = $this->conf->getSectionItem($this->name, "pass");
|
||||
$host = $this->conf->getSectionItem($this->name, "host");
|
||||
$port = $this->conf->getSectionItem($this->name, "port");
|
||||
|
||||
$pass_arg = $pass ? "-p$pass " : "";
|
||||
$db_arg = $db ? "-D $db" : "";
|
||||
shell_exec(".\\bin\\mysql.exe -u $user $pass_arg -h $host -P $port $db_arg < \"$path\"");
|
||||
|
||||
chdir($cwd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace SDK\Build\PGO\Server;
|
||||
use SDK\Build\PGO\Interfaces;
|
||||
use SDK\Build\PGO\Abstracts;
|
||||
use SDK\Build\PGO\{Config as PGOConfig};
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\{Exception, FileOps};
|
||||
use SDK\Build\PGO\Tool\PackageWorkman;
|
||||
|
||||
class NGINX extends Abstracts\Server implements Interfaces\Server\HTTP
|
||||
@@ -29,7 +29,6 @@ class NGINX extends Abstracts\Server implements Interfaces\Server\HTTP
|
||||
$nginx_conf_in = $this->conf->getTplDir($this->name) . DIRECTORY_SEPARATOR . "nginx.conf";
|
||||
$conf_fn = $this->base . DIRECTORY_SEPARATOR . "conf" . DIRECTORY_SEPARATOR . "nginx.conf";
|
||||
|
||||
$vars = array();
|
||||
$port = $this->conf->getSectionItem($this->name, "port");
|
||||
if (!$port) {
|
||||
$port = $this->conf->getNextPort();
|
||||
@@ -148,4 +147,3 @@ class NGINX extends Abstracts\Server implements Interfaces\Server\HTTP
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace SDK\Build\PGO\Server;
|
||||
use SDK\Build\PGO\Interfaces\Server\DB;
|
||||
use SDK\Build\PGO\Abstracts\Server;
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\{Exception, FileOps};
|
||||
use SDK\Build\PGO\Tool\PackageWorkman;
|
||||
|
||||
class PostgreSQL extends Server implements DB
|
||||
@@ -90,10 +90,6 @@ class PostgreSQL extends Server implements DB
|
||||
echo "Stopping " . $this->name . ".\n";
|
||||
|
||||
|
||||
$user = $this->conf->getSectionItem($this->name, "user");
|
||||
$pass = $this->conf->getSectionItem($this->name, "pass");
|
||||
|
||||
|
||||
$cmd = $this->base . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "pg_ctl.exe stop -D " . $this->data_dir . " -m fast";
|
||||
exec($cmd);
|
||||
|
||||
@@ -108,7 +104,6 @@ class PostgreSQL extends Server implements DB
|
||||
public function createDb(string $db_name) : void
|
||||
{
|
||||
$user = $this->conf->getSectionItem($this->name, "user");
|
||||
$pass = $this->conf->getSectionItem($this->name, "pass");
|
||||
$host = $this->conf->getSectionItem($this->name, "host");
|
||||
$port = $this->conf->getSectionItem($this->name, "port");
|
||||
|
||||
@@ -119,7 +114,6 @@ class PostgreSQL extends Server implements DB
|
||||
public function dropDb(string $db_name) : void
|
||||
{
|
||||
$user = $this->conf->getSectionItem($this->name, "user");
|
||||
//$pass = $this->conf->getSectionItem($this->name, "pass");
|
||||
$host = $this->conf->getSectionItem($this->name, "host");
|
||||
$port = $this->conf->getSectionItem($this->name, "port");
|
||||
|
||||
@@ -132,13 +126,11 @@ class PostgreSQL extends Server implements DB
|
||||
$ret = NULL;
|
||||
|
||||
$user = $this->conf->getSectionItem($this->name, "user");
|
||||
//$pass = $this->conf->getSectionItem($this->name, "pass");
|
||||
$host = $this->conf->getSectionItem($this->name, "host");
|
||||
$port = $this->conf->getSectionItem($this->name, "port");
|
||||
|
||||
$db_arg = $db ? "-d $db" : "";
|
||||
$cmd = $this->base . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "psql.exe -h $host -p $port -U $user $db_arg -c \"$s\"";
|
||||
$ret = shell_exec($cmd);
|
||||
shell_exec($cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace SDK\Build\PGO\Tool;
|
||||
|
||||
use SDK\{Config as SDKConfig, Exception};
|
||||
use SDK\Exception;
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
use SDK\Build\PGO\Interfaces;
|
||||
|
||||
@@ -63,11 +63,11 @@ class PGO
|
||||
$pgc = $this->getPgcName($base);
|
||||
$pgd = $this->getPgdName($base);
|
||||
|
||||
`pgosweep $base $pgc`;
|
||||
shell_exec("pgosweep $base $pgc");
|
||||
//passthru("pgosweep $base $pgc");
|
||||
|
||||
if ($merge) {
|
||||
`pgomgr /merge:1000 $pgc $pgd`;
|
||||
shell_exec("pgomgr /merge:1000 $pgc $pgd");
|
||||
//passthru("pgomgr /merge:1000 $pgc $pgd");
|
||||
/* File is already spent, no need to keep it.
|
||||
If seeing linker warnings about no pgc
|
||||
@@ -98,10 +98,9 @@ class PGO
|
||||
$its = glob($this->php->getRootDir() . DIRECTORY_SEPARATOR . "*.pgd");
|
||||
$its = array_merge($its, glob($this->php->getExtRootDir() . DIRECTORY_SEPARATOR . "*" . DIRECTORY_SEPARATOR . "*.pgd"));
|
||||
foreach (array_unique($its) as $pgd) {
|
||||
`pgomgr /clear $pgd`;
|
||||
shell_exec("pgomgr /clear $pgd");
|
||||
//passthru("pgomgr /clear $pgd");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace SDK\Build\PGO\Tool;
|
||||
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\{Exception, FileOps};
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
|
||||
|
||||
@@ -47,11 +47,10 @@ class PackageWorkman
|
||||
echo "Unpacking '$cache_fn' to '$tgt_name'\n";
|
||||
try {
|
||||
$this->unzip($cache_fn, $zip_tgt_dn, $tgt_bn);
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
$this->rm($cache_fn);
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace SDK\Build\PGO\Tool;
|
||||
|
||||
use SDK\{Config as SDKConfig, Exception};
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
use SDK\Build\PGO\Interfaces\{TrainingCase, Server, Server\DB, PHP};
|
||||
use SDK\Build\PGO\Interfaces\TrainingCase;
|
||||
|
||||
class Training
|
||||
{
|
||||
@@ -15,8 +15,9 @@ class Training
|
||||
{
|
||||
$this->conf = $conf;
|
||||
$this->t_case = $t_case;
|
||||
|
||||
if (!in_array($this->t_case->getType(), array("web", "cli"))) {
|
||||
|
||||
$type = $this->t_case->getType();
|
||||
if (!in_array($type, array("web", "cli"))) {
|
||||
throw new Exception("Unknown training type '$type'.");
|
||||
}
|
||||
}
|
||||
@@ -107,8 +108,7 @@ class Training
|
||||
public function run(int $max_runs = 1, ?array &$stat = array()) : void
|
||||
{
|
||||
$type = $this->t_case->getType();
|
||||
switch ($type)
|
||||
{
|
||||
switch ($type) {
|
||||
case "web":
|
||||
$this->runWeb($max_runs, $stat);
|
||||
break;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace SDK\Build\PGO;
|
||||
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
|
||||
|
||||
@@ -21,7 +20,7 @@ class TrainingCaseIterator implements \Iterator
|
||||
|
||||
$items = glob($this->conf->getCasesTplDir() . DIRECTORY_SEPARATOR . "*");
|
||||
foreach ($items as $it) {
|
||||
if(!is_dir($it)) {
|
||||
if (!is_dir($it)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -53,7 +52,7 @@ class TrainingCaseIterator implements \Iterator
|
||||
|
||||
public function current()
|
||||
{
|
||||
$base = $this->items[$this->idx];
|
||||
$base = $this->items[$this->idx];
|
||||
$ns = basename($base);
|
||||
|
||||
/* Don't overwrite generated config. */
|
||||
@@ -97,6 +96,4 @@ class TrainingCaseIterator implements \Iterator
|
||||
|
||||
return $this->el->getName();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
|
||||
namespace SDK;
|
||||
|
||||
use SDK\Config;
|
||||
use SDK\Cache;
|
||||
use SDK\Exception;
|
||||
|
||||
class Cache
|
||||
{
|
||||
protected $id;
|
||||
@@ -48,7 +44,7 @@ class Cache
|
||||
$old_sum = md5_file($p);
|
||||
$new_sum = md5($content);
|
||||
|
||||
return $old_sum != $new_sum;
|
||||
return $old_sum !== $new_sum;
|
||||
}/*}}}*/
|
||||
|
||||
public function cacheContent(string $path, string $content, bool $relative = false) : void
|
||||
@@ -64,7 +60,7 @@ class Cache
|
||||
|
||||
do {
|
||||
$got = fwrite($fd, substr($content, $wrote));
|
||||
if (false == $got) {
|
||||
if (false === $got) {
|
||||
break;
|
||||
}
|
||||
$wrote += $got;
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
namespace SDK;
|
||||
|
||||
use SDK\Build\Dependency\Fetcher;
|
||||
use SDK\Cache;
|
||||
use SDK\Exception;
|
||||
|
||||
class Config
|
||||
{
|
||||
@@ -130,7 +128,11 @@ class Config
|
||||
{/*{{{*/
|
||||
if (empty(self::$knownBranches)) {
|
||||
$cache_file = "known_branches.txt";
|
||||
$cache = new Cache(self::getDepsLocalPath());
|
||||
$deps_path = self::getDepsLocalPath();
|
||||
if (!$deps_path) {
|
||||
throw new Exception("Couldn't determine dependencies path. Please either switch to the PHP source root or use -d option.");
|
||||
}
|
||||
$cache = new Cache($deps_path);
|
||||
$fetcher = new Fetcher(self::$depsHost, self::$depsPort, self::$depsUriScheme);
|
||||
|
||||
$tmp = $fetcher->getByUri(self::$depsBaseUri . "/series/");
|
||||
@@ -179,6 +181,11 @@ class Config
|
||||
$branch = NULL;
|
||||
$found = false;
|
||||
|
||||
$rmtools_branch = getenv("PHP_RMTOOLS_PHP_BUILD_BRANCH");
|
||||
if ("master" == $rmtools_branch) {
|
||||
return "master";
|
||||
}
|
||||
|
||||
/* Try to figure out the branch. The worky scenarios are
|
||||
- CWD is in php-src
|
||||
- phpize is on the path
|
||||
@@ -209,6 +216,19 @@ class Config
|
||||
if (is_numeric($major) && is_numeric($minor)) {
|
||||
$branch = "$major.$minor";
|
||||
}
|
||||
|
||||
/* Verify that we use an available branch name. Master has some
|
||||
version, but no dedicated series. For master, it rather
|
||||
makes sense to use master as branch name. */
|
||||
$git = trim(shell_exec("where git.exe"));
|
||||
if ($git && is_dir(".git")) {
|
||||
$cmd = "\"$git\" branch";
|
||||
|
||||
$ret = trim(shell_exec($cmd));
|
||||
if (preg_match_all(",\*\s+master,", $ret) > 0) {
|
||||
$branch = "master";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $branch;
|
||||
@@ -273,10 +293,10 @@ class Config
|
||||
}
|
||||
}
|
||||
|
||||
if (!$ret["stability"]) {
|
||||
if (!@$ret["stability"]) {
|
||||
throw new Exception("Failed to find config with stability '" . self::getCurrentStabilityName() . "'");
|
||||
}
|
||||
if (!$ret["crt"]) {
|
||||
if (!@$ret["crt"]) {
|
||||
throw new Exception("Failed to find config with arch '" . self::getCurrentArchName() . "'");
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
namespace SDK;
|
||||
|
||||
use SDK\Config;
|
||||
use SDK\Exception;
|
||||
|
||||
trait FileOps
|
||||
{
|
||||
protected function md(string $name = "", bool $tmp = false) : string
|
||||
@@ -119,6 +116,9 @@ trait FileOps
|
||||
protected function download(string $url, string $dest_fn = NULL) : ?string
|
||||
{/*{{{*/
|
||||
$fd = NULL;
|
||||
$retry = 0;
|
||||
|
||||
retry:
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
@@ -146,6 +146,9 @@ trait FileOps
|
||||
if ($dest_fn) {
|
||||
fclose($fd);
|
||||
}
|
||||
if ($retry++ < 3) {
|
||||
goto retry;
|
||||
}
|
||||
throw new Exception($err);
|
||||
}
|
||||
|
||||
@@ -193,7 +196,7 @@ trait FileOps
|
||||
$name = substr($name, 0, -1);*/
|
||||
|
||||
$name = rtrim($stat["name"], "/");
|
||||
while (strchr($name, '/') !== false) {
|
||||
while (strstr($name, '/') !== false) {
|
||||
$name = dirname($name);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace SDK;
|
||||
|
||||
use SDK\{Config, Exception};
|
||||
|
||||
class Lock
|
||||
{
|
||||
protected $fd;
|
||||
|
||||
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-icuuc60.dll
Normal file
BIN
msys2/usr/bin/msys-icuuc60.dll
Normal file
Binary file not shown.
Binary file not shown.
BIN
msys2/usr/bin/msys-mpfr-6.dll
Normal file
BIN
msys2/usr/bin/msys-mpfr-6.dll
Normal 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.
@@ -1,6 +1,7 @@
|
||||
# bison-i18n.m4 serial 2
|
||||
|
||||
dnl Copyright (C) 2005-2006, 2009-2015 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 2005-2006, 2009-2015, 2018 Free Software Foundation,
|
||||
dnl Inc.
|
||||
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
||||
@@ -52,7 +52,7 @@ into various formats.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002, 2008-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2008-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bison.
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Language-independent M4 Macros for Bison.
|
||||
|
||||
# Copyright (C) 2002, 2004-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002, 2004-2015, 2018 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
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
# C++ skeleton dispatching for Bison.
|
||||
|
||||
# Copyright (C) 2006-2007, 2009-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2007, 2009-2015, 2018 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2018 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
|
||||
@@ -30,6 +30,16 @@ m4_include(b4_pkgdatadir/[c.m4])
|
||||
m4_define([b4_comment],
|
||||
[b4_comment_([$1], [$2// ], [$2// ])])
|
||||
|
||||
# b4_inline(hh|cc)
|
||||
# ----------------
|
||||
# Expand to `inline\n ` if $1 is hh.
|
||||
m4_define([b4_inline],
|
||||
[m4_case([$1],
|
||||
[cc], [],
|
||||
[hh], [[inline
|
||||
]],
|
||||
[m4_fatal([$0: invalid argument: $1])])])
|
||||
|
||||
## -------- ##
|
||||
## Checks. ##
|
||||
## -------- ##
|
||||
@@ -275,25 +285,22 @@ m4_define([b4_public_types_declare],
|
||||
]b4_symbol_constructor_declare])
|
||||
|
||||
|
||||
# b4_public_types_define
|
||||
# ----------------------
|
||||
# b4_public_types_define(hh|cc)
|
||||
# -----------------------------
|
||||
# Provide the implementation needed by the public types.
|
||||
m4_define([b4_public_types_define],
|
||||
[[ inline
|
||||
]b4_parser_class_name[::syntax_error::syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
|
||||
[ b4_inline([$1])b4_parser_class_name[::syntax_error::syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
|
||||
: std::runtime_error (m)]b4_locations_if([
|
||||
, location (l)])[
|
||||
{}
|
||||
|
||||
// basic_symbol.
|
||||
template <typename Base>
|
||||
inline
|
||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol ()
|
||||
: value ()
|
||||
{}
|
||||
|
||||
template <typename Base>
|
||||
inline
|
||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (const basic_symbol& other)
|
||||
: Base (other)
|
||||
, value ()]b4_locations_if([
|
||||
@@ -304,9 +311,7 @@ m4_define([b4_public_types_define],
|
||||
[value = other.value;])[
|
||||
}
|
||||
|
||||
|
||||
template <typename Base>
|
||||
inline
|
||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||
[typename Base::kind_type t],
|
||||
[const semantic_type& v],
|
||||
@@ -323,7 +328,6 @@ m4_define([b4_public_types_define],
|
||||
]b4_type_foreach([b4_basic_symbol_constructor_define])], [[
|
||||
/// Constructor for valueless symbols.
|
||||
template <typename Base>
|
||||
inline
|
||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||
[typename Base::kind_type t],
|
||||
b4_locations_if([const location_type& l]))[)
|
||||
@@ -333,14 +337,12 @@ m4_define([b4_public_types_define],
|
||||
{}]])[
|
||||
|
||||
template <typename Base>
|
||||
inline
|
||||
]b4_parser_class_name[::basic_symbol<Base>::~basic_symbol ()
|
||||
{
|
||||
clear ();
|
||||
}
|
||||
|
||||
template <typename Base>
|
||||
inline
|
||||
void
|
||||
]b4_parser_class_name[::basic_symbol<Base>::clear ()
|
||||
{]b4_variant_if([[
|
||||
@@ -361,7 +363,6 @@ m4_define([b4_public_types_define],
|
||||
}
|
||||
|
||||
template <typename Base>
|
||||
inline
|
||||
bool
|
||||
]b4_parser_class_name[::basic_symbol<Base>::empty () const
|
||||
{
|
||||
@@ -369,11 +370,10 @@ m4_define([b4_public_types_define],
|
||||
}
|
||||
|
||||
template <typename Base>
|
||||
inline
|
||||
void
|
||||
]b4_parser_class_name[::basic_symbol<Base>::move (basic_symbol& s)
|
||||
{
|
||||
super_type::move(s);
|
||||
super_type::move (s);
|
||||
]b4_variant_if([b4_symbol_variant([this->type_get ()], [value], [move],
|
||||
[s.value])],
|
||||
[value = s.value;])[]b4_locations_if([
|
||||
@@ -381,45 +381,38 @@ m4_define([b4_public_types_define],
|
||||
}
|
||||
|
||||
// by_type.
|
||||
inline
|
||||
]b4_parser_class_name[::by_type::by_type ()
|
||||
]b4_inline([$1])b4_parser_class_name[::by_type::by_type ()
|
||||
: type (empty_symbol)
|
||||
{}
|
||||
|
||||
inline
|
||||
]b4_parser_class_name[::by_type::by_type (const by_type& other)
|
||||
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (const by_type& other)
|
||||
: type (other.type)
|
||||
{}
|
||||
|
||||
inline
|
||||
]b4_parser_class_name[::by_type::by_type (token_type t)
|
||||
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (token_type t)
|
||||
: type (yytranslate_ (t))
|
||||
{}
|
||||
|
||||
inline
|
||||
void
|
||||
]b4_inline([$1])[void
|
||||
]b4_parser_class_name[::by_type::clear ()
|
||||
{
|
||||
type = empty_symbol;
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
]b4_inline([$1])[void
|
||||
]b4_parser_class_name[::by_type::move (by_type& that)
|
||||
{
|
||||
type = that.type;
|
||||
that.clear ();
|
||||
}
|
||||
|
||||
inline
|
||||
int
|
||||
]b4_inline([$1])[int
|
||||
]b4_parser_class_name[::by_type::type_get () const
|
||||
{
|
||||
return type;
|
||||
}
|
||||
]b4_token_ctor_if([[
|
||||
inline
|
||||
]b4_parser_class_name[::token_type
|
||||
]b4_inline([$1])b4_parser_class_name[::token_type
|
||||
]b4_parser_class_name[::by_type::token () const
|
||||
{
|
||||
// YYTOKNUM[NUM] -- (External) token number corresponding to the
|
||||
@@ -445,14 +438,13 @@ m4_define([b4_symbol_constructor_declare], [])
|
||||
m4_define([b4_symbol_constructor_define], [])
|
||||
|
||||
|
||||
# b4_yytranslate_define
|
||||
# ---------------------
|
||||
# Define yytranslate_. Sometimes used in the header file,
|
||||
# b4_yytranslate_define(cc|hh)
|
||||
# ----------------------------
|
||||
# Define yytranslate_. Sometimes used in the header file ($1=hh),
|
||||
# sometimes in the cc file.
|
||||
m4_define([b4_yytranslate_define],
|
||||
[[ // Symbol number corresponding to token number t.
|
||||
inline
|
||||
]b4_parser_class_name[::token_number_type
|
||||
]b4_inline([$1])b4_parser_class_name[::token_number_type
|
||||
]b4_parser_class_name[::yytranslate_ (]b4_token_ctor_if([token_type],
|
||||
[int])[ t)
|
||||
{
|
||||
@@ -462,12 +454,12 @@ m4_define([b4_yytranslate_define],
|
||||
{
|
||||
]b4_translate[
|
||||
};
|
||||
const unsigned int user_token_number_max_ = ]b4_user_token_number_max[;
|
||||
const unsigned user_token_number_max_ = ]b4_user_token_number_max[;
|
||||
const token_number_type undef_token_ = ]b4_undef_token_number[;
|
||||
|
||||
if (static_cast<int>(t) <= yyeof_)
|
||||
if (static_cast<int> (t) <= yyeof_)
|
||||
return yyeof_;
|
||||
else if (static_cast<unsigned int> (t) <= user_token_number_max_)
|
||||
else if (static_cast<unsigned> (t) <= user_token_number_max_)
|
||||
return translate_table[t];
|
||||
else
|
||||
return undef_token_;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Common code for C-like languages (C, C++, Java, etc.)
|
||||
|
||||
# Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2012-2015, 2018 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
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
# C skeleton dispatching for Bison.
|
||||
|
||||
# Copyright (C) 2006-2007, 2009-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2007, 2009-2015, 2018 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# C M4 Macros for Bison.
|
||||
|
||||
# Copyright (C) 2002, 2004-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002, 2004-2015, 2018 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# GLR skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2015, 2018 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
|
||||
@@ -198,7 +198,7 @@ m4_if(b4_skeleton, ["glr.c"],
|
||||
[b4_defines_if(
|
||||
[b4_output_begin([b4_spec_defines_file])
|
||||
b4_copyright([Skeleton interface for Bison GLR parsers in C],
|
||||
[2002-2015])[
|
||||
[2002-2015, 2018])[
|
||||
|
||||
]b4_cpp_guard_open([b4_spec_defines_file])[
|
||||
]b4_shared_declarations[
|
||||
@@ -213,7 +213,7 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C],
|
||||
|
||||
b4_output_begin([b4_parser_file_name])
|
||||
b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
||||
[2002-2015])[
|
||||
[2002-2015, 2018])[
|
||||
|
||||
/* C GLR parser skeleton written by Paul Hilfinger. */
|
||||
|
||||
@@ -808,6 +808,7 @@ yyuserAction (yyRuleNum yyn, size_t yyrhslen, yyGLRStackItem* yyvsp,
|
||||
*yyvalp = yyval_default;
|
||||
else
|
||||
*yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval;]b4_locations_if([[
|
||||
/* Default location. */
|
||||
YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen);
|
||||
yystackp->yyerror_range[1].yystate.yyloc = *yylocp;
|
||||
]])[
|
||||
@@ -2085,6 +2086,7 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
||||
case N: \
|
||||
yyformat = S; \
|
||||
break
|
||||
default: /* Avoid compiler warnings. */
|
||||
YYCASE_(0, YY_("syntax error"));
|
||||
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
||||
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
||||
@@ -2305,8 +2307,8 @@ b4_dollar_popdef])[]dnl
|
||||
{
|
||||
yyrule = yydefaultAction (yystate);
|
||||
if (yyrule == 0)
|
||||
{
|
||||
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
||||
{]b4_locations_if([[
|
||||
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
||||
yyreportSyntaxError (&yystack]b4_user_args[);
|
||||
goto yyuser_error;
|
||||
}
|
||||
@@ -2345,8 +2347,8 @@ b4_dollar_popdef])[]dnl
|
||||
yystack.yyerrState -= 1;
|
||||
}
|
||||
else if (yyisErrorAction (yyaction))
|
||||
{
|
||||
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
||||
{]b4_locations_if([[
|
||||
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
||||
yyreportSyntaxError (&yystack]b4_user_args[);
|
||||
goto yyuser_error;
|
||||
}
|
||||
@@ -2391,8 +2393,8 @@ b4_dollar_popdef])[]dnl
|
||||
if (yystack.yytops.yysize == 0)
|
||||
yyFail (&yystack][]b4_lpure_args[, YY_("syntax error"));
|
||||
YYCHK1 (yyresolveStack (&yystack]b4_user_args[));
|
||||
YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));
|
||||
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
||||
YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));]b4_locations_if([[
|
||||
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
||||
yyreportSyntaxError (&yystack]b4_user_args[);
|
||||
goto yyuser_error;
|
||||
}
|
||||
@@ -2473,9 +2475,9 @@ b4_dollar_popdef])[]dnl
|
||||
{
|
||||
while (yystates[yyk])
|
||||
{
|
||||
yyGLRState *yys = yystates[yyk];
|
||||
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]]
|
||||
)[ if (yys->yypred != YY_NULLPTR)
|
||||
yyGLRState *yys = yystates[yyk];]b4_locations_if([[
|
||||
yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
|
||||
if (yys->yypred != YY_NULLPTR)
|
||||
yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[);
|
||||
yystates[yyk] = yys->yypred;
|
||||
yystack.yynextFree -= 1;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# C++ GLR skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2015, 2018 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
|
||||
@@ -177,7 +177,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||
| Print this symbol. |
|
||||
`--------------------*/
|
||||
|
||||
inline void
|
||||
void
|
||||
]b4_parser_class_name[::yy_symbol_value_print_ (int yytype,
|
||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
||||
const location_type* yylocationp]])[)
|
||||
@@ -329,7 +329,7 @@ b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
||||
b4_defines_if(
|
||||
[b4_output_begin([b4_spec_defines_file])
|
||||
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
||||
[2002-2015])[
|
||||
[2002-2015, 2018])[
|
||||
|
||||
// C++ GLR parser skeleton written by Akim Demaille.
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Java skeleton dispatching for Bison.
|
||||
|
||||
# Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2007, 2009-2015, 2018 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Java language support for Bison
|
||||
|
||||
# Copyright (C) 2007-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2007-2015, 2018 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2015, 2018 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
|
||||
@@ -131,7 +131,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))])])
|
||||
|
||||
|
||||
m4_pushdef([b4_copyright_years],
|
||||
[2002-2015])
|
||||
[2002-2015, 2018])
|
||||
|
||||
m4_define([b4_parser_class_name],
|
||||
[b4_percent_define_get([[parser_class_name]])])
|
||||
@@ -142,9 +142,9 @@ b4_bison_locations_if([# Backward compatibility.
|
||||
m4_include(b4_pkgdatadir/[stack.hh])
|
||||
b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])])
|
||||
|
||||
# b4_shared_declarations
|
||||
# ----------------------
|
||||
# Declaration that might either go into the header (if --defines)
|
||||
# b4_shared_declarations(hh|cc)
|
||||
# -----------------------------
|
||||
# Declaration that might either go into the header (if --defines, $1 = hh)
|
||||
# or open coded in the parser body.
|
||||
m4_define([b4_shared_declarations],
|
||||
[b4_percent_code_get([[requires]])[
|
||||
@@ -314,6 +314,8 @@ b4_location_define])])[
|
||||
typedef basic_symbol<by_state> super_type;
|
||||
/// Construct an empty symbol.
|
||||
stack_symbol_type ();
|
||||
/// Copy construct.
|
||||
stack_symbol_type (const stack_symbol_type& that);
|
||||
/// Steal the contents from \a sym to build this.
|
||||
stack_symbol_type (state_type s, symbol_type& sym);
|
||||
/// Assignment, needed by push_back.
|
||||
@@ -342,7 +344,7 @@ b4_location_define])])[
|
||||
void yypush_ (const char* m, state_type s, symbol_type& sym);
|
||||
|
||||
/// Pop \a n symbols the three stacks.
|
||||
void yypop_ (unsigned int n = 1);
|
||||
void yypop_ (unsigned n = 1);
|
||||
|
||||
/// Constants.
|
||||
enum
|
||||
@@ -359,8 +361,8 @@ b4_location_define])])[
|
||||
]b4_parse_param_vars[
|
||||
};
|
||||
|
||||
]b4_token_ctor_if([b4_yytranslate_define
|
||||
b4_public_types_define])[
|
||||
]b4_token_ctor_if([b4_yytranslate_define([$1])[
|
||||
]b4_public_types_define([$1])])[
|
||||
]b4_namespace_close[
|
||||
|
||||
]b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
||||
@@ -386,7 +388,7 @@ b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])
|
||||
// C++ LALR(1) parser skeleton written by Akim Demaille.
|
||||
|
||||
]b4_cpp_guard_open([b4_spec_defines_file])[
|
||||
]b4_shared_declarations[
|
||||
]b4_shared_declarations(hh)[
|
||||
]b4_cpp_guard_close([b4_spec_defines_file])
|
||||
b4_output_end()
|
||||
])
|
||||
@@ -406,7 +408,7 @@ m4_if(b4_prefix, [yy], [],
|
||||
]b4_null_define[
|
||||
|
||||
]b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
|
||||
[b4_shared_declarations])[
|
||||
[b4_shared_declarations([cc])])[
|
||||
|
||||
// User implementation prologue.
|
||||
]b4_user_post_prologue[
|
||||
@@ -443,7 +445,7 @@ m4_if(b4_prefix, [yy], [],
|
||||
{ \
|
||||
*yycdebug_ << Title << ' '; \
|
||||
yy_print_ (*yycdebug_, Symbol); \
|
||||
*yycdebug_ << std::endl; \
|
||||
*yycdebug_ << '\n'; \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
@@ -462,9 +464,9 @@ m4_if(b4_prefix, [yy], [],
|
||||
#else // !]b4_api_PREFIX[DEBUG
|
||||
|
||||
# define YYCDEBUG if (false) std::cerr
|
||||
# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE(Symbol)
|
||||
# define YY_REDUCE_PRINT(Rule) static_cast<void>(0)
|
||||
# define YY_STACK_PRINT() static_cast<void>(0)
|
||||
# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE (Symbol)
|
||||
# define YY_REDUCE_PRINT(Rule) static_cast<void> (0)
|
||||
# define YY_STACK_PRINT() static_cast<void> (0)
|
||||
|
||||
#endif // !]b4_api_PREFIX[DEBUG
|
||||
|
||||
@@ -533,27 +535,23 @@ m4_if(b4_prefix, [yy], [],
|
||||
| Symbol types. |
|
||||
`---------------*/
|
||||
|
||||
]b4_token_ctor_if([], [b4_public_types_define])[
|
||||
]b4_token_ctor_if([], [b4_public_types_define([cc])])[
|
||||
|
||||
// by_state.
|
||||
inline
|
||||
]b4_parser_class_name[::by_state::by_state ()
|
||||
: state (empty_state)
|
||||
{}
|
||||
|
||||
inline
|
||||
]b4_parser_class_name[::by_state::by_state (const by_state& other)
|
||||
: state (other.state)
|
||||
{}
|
||||
|
||||
inline
|
||||
void
|
||||
]b4_parser_class_name[::by_state::clear ()
|
||||
{
|
||||
state = empty_state;
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
]b4_parser_class_name[::by_state::move (by_state& that)
|
||||
{
|
||||
@@ -561,12 +559,10 @@ m4_if(b4_prefix, [yy], [],
|
||||
that.clear ();
|
||||
}
|
||||
|
||||
inline
|
||||
]b4_parser_class_name[::by_state::by_state (state_type s)
|
||||
: state (s)
|
||||
{}
|
||||
|
||||
inline
|
||||
]b4_parser_class_name[::symbol_number_type
|
||||
]b4_parser_class_name[::by_state::type_get () const
|
||||
{
|
||||
@@ -576,12 +572,17 @@ m4_if(b4_prefix, [yy], [],
|
||||
return yystos_[state];
|
||||
}
|
||||
|
||||
inline
|
||||
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type ()
|
||||
{}
|
||||
|
||||
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (const stack_symbol_type& that)
|
||||
: super_type (that.state]b4_locations_if([, that.location])[)
|
||||
{
|
||||
]b4_variant_if([b4_symbol_variant([that.type_get ()],
|
||||
[value], [copy], [that.value])],
|
||||
[[value = that.value;]])[
|
||||
}
|
||||
|
||||
inline
|
||||
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (state_type s, symbol_type& that)
|
||||
: super_type (s]b4_locations_if([, that.location])[)
|
||||
{
|
||||
@@ -592,7 +593,6 @@ m4_if(b4_prefix, [yy], [],
|
||||
that.type = empty_symbol;
|
||||
}
|
||||
|
||||
inline
|
||||
]b4_parser_class_name[::stack_symbol_type&
|
||||
]b4_parser_class_name[::stack_symbol_type::operator= (const stack_symbol_type& that)
|
||||
{
|
||||
@@ -606,7 +606,6 @@ m4_if(b4_prefix, [yy], [],
|
||||
|
||||
|
||||
template <typename Base>
|
||||
inline
|
||||
void
|
||||
]b4_parser_class_name[::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const
|
||||
{
|
||||
@@ -638,7 +637,6 @@ m4_if(b4_prefix, [yy], [],
|
||||
}
|
||||
#endif
|
||||
|
||||
inline
|
||||
void
|
||||
]b4_parser_class_name[::yypush_ (const char* m, state_type s, symbol_type& sym)
|
||||
{
|
||||
@@ -646,7 +644,6 @@ m4_if(b4_prefix, [yy], [],
|
||||
yypush_ (m, t);
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
]b4_parser_class_name[::yypush_ (const char* m, stack_symbol_type& s)
|
||||
{
|
||||
@@ -655,9 +652,8 @@ m4_if(b4_prefix, [yy], [],
|
||||
yystack_.push (s);
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
]b4_parser_class_name[::yypop_ (unsigned int n)
|
||||
]b4_parser_class_name[::yypop_ (unsigned n)
|
||||
{
|
||||
yystack_.pop (n);
|
||||
}
|
||||
@@ -689,7 +685,7 @@ m4_if(b4_prefix, [yy], [],
|
||||
}
|
||||
#endif // ]b4_api_PREFIX[DEBUG
|
||||
|
||||
inline ]b4_parser_class_name[::state_type
|
||||
]b4_parser_class_name[::state_type
|
||||
]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yysym)
|
||||
{
|
||||
int yyr = yypgoto_[yysym - yyntokens_] + yystate;
|
||||
@@ -699,13 +695,13 @@ m4_if(b4_prefix, [yy], [],
|
||||
return yydefgoto_[yysym - yyntokens_];
|
||||
}
|
||||
|
||||
inline bool
|
||||
bool
|
||||
]b4_parser_class_name[::yy_pact_value_is_default_ (int yyvalue)
|
||||
{
|
||||
return yyvalue == yypact_ninf_;
|
||||
}
|
||||
|
||||
inline bool
|
||||
bool
|
||||
]b4_parser_class_name[::yy_table_value_is_error_ (int yyvalue)
|
||||
{
|
||||
return yyvalue == yytable_ninf_;
|
||||
@@ -736,7 +732,7 @@ m4_if(b4_prefix, [yy], [],
|
||||
// avoid gratuitous conflicts when merging into the master branch.
|
||||
try
|
||||
{
|
||||
YYCDEBUG << "Starting parse" << std::endl;
|
||||
YYCDEBUG << "Starting parse\n";
|
||||
|
||||
]m4_ifdef([b4_initial_action], [
|
||||
b4_dollar_pushdef([yyla.value], [], [yyla.location])dnl
|
||||
@@ -753,7 +749,7 @@ b4_dollar_popdef])[]dnl
|
||||
|
||||
// A new symbol was pushed on the stack.
|
||||
yynewstate:
|
||||
YYCDEBUG << "Entering state " << yystack_[0].state << std::endl;
|
||||
YYCDEBUG << "Entering state " << yystack_[0].state << '\n';
|
||||
|
||||
// Accept?
|
||||
if (yystack_[0].state == yyfinal_)
|
||||
@@ -827,7 +823,7 @@ b4_dollar_popdef])[]dnl
|
||||
yylen = yyr2_[yyn];
|
||||
{
|
||||
stack_symbol_type yylhs;
|
||||
yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([
|
||||
yylhs.state = yy_lr_goto_state_ (yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([
|
||||
/* Variants are always initialized to an empty instance of the
|
||||
correct type. The default '$$ = $1' action is NOT applied
|
||||
when using variants. */
|
||||
@@ -844,10 +840,11 @@ b4_dollar_popdef])[]dnl
|
||||
yylhs.value = yystack_@{0@}.value;])[
|
||||
]b4_locations_if([dnl
|
||||
[
|
||||
// Compute the default @@$.
|
||||
// Default location.
|
||||
{
|
||||
slice<stack_symbol_type, stack_type> slice (yystack_, yylen);
|
||||
YYLLOC_DEFAULT (yylhs.location, slice, yylen);
|
||||
yyerror_range[1].location = yylhs.location;
|
||||
}]])[
|
||||
|
||||
// Perform the reduction.
|
||||
@@ -918,8 +915,7 @@ b4_dollar_popdef])[]dnl
|
||||
YYERROR and the label yyerrorlab therefore never appears in user
|
||||
code. */
|
||||
if (false)
|
||||
goto yyerrorlab;]b4_locations_if([[
|
||||
yyerror_range[1].location = yystack_[yylen - 1].location;]])[
|
||||
goto yyerrorlab;
|
||||
/* Do not reclaim the symbols of the rule whose action triggered
|
||||
this YYERROR. */
|
||||
yypop_ (yylen);
|
||||
@@ -993,8 +989,7 @@ b4_dollar_popdef])[]dnl
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
YYCDEBUG << "Exception caught: cleaning lookahead and stack"
|
||||
<< std::endl;
|
||||
YYCDEBUG << "Exception caught: cleaning lookahead and stack\n";
|
||||
// Do not try to display the values of the reclaimed symbols,
|
||||
// as their printer might throw an exception.
|
||||
if (!yyla.empty ())
|
||||
@@ -1013,7 +1008,7 @@ b4_dollar_popdef])[]dnl
|
||||
]b4_parser_class_name[::error (const syntax_error& yyexc)
|
||||
{
|
||||
error (]b4_join(b4_locations_if([yyexc.location]),
|
||||
[[yyexc.what()]])[);
|
||||
[[yyexc.what ()]])[);
|
||||
}
|
||||
|
||||
// Generate an error message.
|
||||
@@ -1091,12 +1086,13 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
||||
case N: \
|
||||
yyformat = S; \
|
||||
break
|
||||
YYCASE_(0, YY_("syntax error"));
|
||||
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
||||
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
||||
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
|
||||
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
|
||||
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
|
||||
default: // Avoid compiler warnings.
|
||||
YYCASE_ (0, YY_("syntax error"));
|
||||
YYCASE_ (1, YY_("syntax error, unexpected %s"));
|
||||
YYCASE_ (2, YY_("syntax error, unexpected %s, expecting %s"));
|
||||
YYCASE_ (3, YY_("syntax error, unexpected %s, expecting %s or %s"));
|
||||
YYCASE_ (4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
|
||||
YYCASE_ (5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
|
||||
#undef YYCASE_
|
||||
}
|
||||
|
||||
@@ -1144,18 +1140,18 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
||||
i_end = yystack_.end ();
|
||||
i != i_end; ++i)
|
||||
*yycdebug_ << ' ' << i->state;
|
||||
*yycdebug_ << std::endl;
|
||||
*yycdebug_ << '\n';
|
||||
}
|
||||
|
||||
// Report on the debug stream that the rule \a yyrule is going to be reduced.
|
||||
void
|
||||
]b4_parser_class_name[::yy_reduce_print_ (int yyrule)
|
||||
{
|
||||
unsigned int yylno = yyrline_[yyrule];
|
||||
unsigned yylno = yyrline_[yyrule];
|
||||
int yynrhs = yyr2_[yyrule];
|
||||
// Print the symbols being reduced, and their result.
|
||||
*yycdebug_ << "Reducing stack by rule " << yyrule - 1
|
||||
<< " (line " << yylno << "):" << std::endl;
|
||||
<< " (line " << yylno << "):\n";
|
||||
// The symbols being reduced.
|
||||
for (int yyi = 0; yyi < yynrhs; yyi++)
|
||||
YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
|
||||
@@ -1163,7 +1159,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
||||
}
|
||||
#endif // ]b4_api_PREFIX[DEBUG
|
||||
|
||||
]b4_token_ctor_if([], [b4_yytranslate_define])[
|
||||
]b4_token_ctor_if([], [b4_yytranslate_define([cc])])[
|
||||
]b4_namespace_close[
|
||||
]b4_epilogue[]dnl
|
||||
b4_output_end()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Java skeleton for Bison -*- autoconf -*-
|
||||
|
||||
# Copyright (C) 2007-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2007-2015, 2018 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
|
||||
@@ -84,7 +84,7 @@ m4_define([b4_define_state],[[
|
||||
|
||||
b4_output_begin([b4_parser_file_name])
|
||||
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
||||
[2007-2015])
|
||||
[2007-2015, 2018])
|
||||
|
||||
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
|
||||
])[/* First part of user declarations. */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2015, 2018 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
|
||||
@@ -16,7 +16,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
m4_pushdef([b4_copyright_years],
|
||||
[2002-2015])
|
||||
[2002-2015, 2018])
|
||||
|
||||
# b4_position_define
|
||||
# ------------------
|
||||
@@ -28,19 +28,18 @@ m4_define([b4_position_define],
|
||||
public:]m4_ifdef([b4_location_constructors], [[
|
||||
/// Construct a position.
|
||||
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
|
||||
unsigned int l = ]b4_location_initial_line[u,
|
||||
unsigned int c = ]b4_location_initial_column[u)
|
||||
unsigned l = ]b4_location_initial_line[u,
|
||||
unsigned c = ]b4_location_initial_column[u)
|
||||
: filename (f)
|
||||
, line (l)
|
||||
, column (c)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
]])[
|
||||
/// Initialization.
|
||||
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULLPTR,
|
||||
unsigned int l = ]b4_location_initial_line[u,
|
||||
unsigned int c = ]b4_location_initial_column[u)
|
||||
unsigned l = ]b4_location_initial_line[u,
|
||||
unsigned c = ]b4_location_initial_column[u)
|
||||
{
|
||||
filename = fn;
|
||||
line = l;
|
||||
@@ -69,15 +68,15 @@ m4_define([b4_position_define],
|
||||
/// File name to which this position refers.
|
||||
]b4_percent_define_get([[filename_type]])[* filename;
|
||||
/// Current line number.
|
||||
unsigned int line;
|
||||
unsigned line;
|
||||
/// Current column number.
|
||||
unsigned int column;
|
||||
unsigned column;
|
||||
|
||||
private:
|
||||
/// Compute max(min, lhs+rhs) (provided min <= lhs).
|
||||
static unsigned int add_ (unsigned int lhs, int rhs, unsigned int min)
|
||||
static unsigned add_ (unsigned lhs, int rhs, unsigned min)
|
||||
{
|
||||
return (0 < rhs || -static_cast<unsigned int>(rhs) < lhs
|
||||
return (0 < rhs || -static_cast<unsigned>(rhs) < lhs
|
||||
? rhs + lhs
|
||||
: min);
|
||||
}
|
||||
@@ -157,30 +156,27 @@ m4_define([b4_location_define],
|
||||
location (const position& b, const position& e)
|
||||
: begin (b)
|
||||
, end (e)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
/// Construct a 0-width location in \a p.
|
||||
explicit location (const position& p = position ())
|
||||
: begin (p)
|
||||
, end (p)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
/// Construct a 0-width location in \a f, \a l, \a c.
|
||||
explicit location (]b4_percent_define_get([[filename_type]])[* f,
|
||||
unsigned int l = ]b4_location_initial_line[u,
|
||||
unsigned int c = ]b4_location_initial_column[u)
|
||||
unsigned l = ]b4_location_initial_line[u,
|
||||
unsigned c = ]b4_location_initial_column[u)
|
||||
: begin (f, l, c)
|
||||
, end (f, l, c)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
])[
|
||||
/// Initialization.
|
||||
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
|
||||
unsigned int l = ]b4_location_initial_line[u,
|
||||
unsigned int c = ]b4_location_initial_column[u)
|
||||
unsigned l = ]b4_location_initial_line[u,
|
||||
unsigned c = ]b4_location_initial_column[u)
|
||||
{
|
||||
begin.initialize (f, l, c);
|
||||
end = begin;
|
||||
@@ -278,7 +274,7 @@ m4_define([b4_location_define],
|
||||
inline std::basic_ostream<YYChar>&
|
||||
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
|
||||
{
|
||||
unsigned int end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
|
||||
unsigned end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
|
||||
ostr << loc.begin;
|
||||
if (loc.end.filename
|
||||
&& (!loc.begin.filename
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Speeds up GNU M4 1.4.x by avoiding quadratic $@ recursion, but penalizes
|
||||
# GNU M4 1.6 by requiring more memory and macro expansions.
|
||||
#
|
||||
# Copyright (C) 2008-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2008-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This file is part of Autoconf. This program is free
|
||||
# software; you can redistribute it and/or modify it under the
|
||||
@@ -24,7 +24,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# and a copy of the Autoconf Configure Script Exception along with
|
||||
# this program; see the files COPYINGv3 and COPYING.EXCEPTION
|
||||
# respectively. If not, see <http://www.gnu.org/licenses/>.
|
||||
# respectively. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Written by Eric Blake.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ divert(-1)# -*- Autoconf -*-
|
||||
# Base M4 layer.
|
||||
# Requires GNU M4.
|
||||
#
|
||||
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This file is part of Autoconf. This program is free
|
||||
# software; you can redistribute it and/or modify it under the
|
||||
@@ -23,7 +23,7 @@ divert(-1)# -*- Autoconf -*-
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# and a copy of the Autoconf Configure Script Exception along with
|
||||
# this program; see the files COPYINGv3 and COPYING.EXCEPTION
|
||||
# respectively. If not, see <http://www.gnu.org/licenses/>.
|
||||
# respectively. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Written by Akim Demaille.
|
||||
|
||||
@@ -2000,7 +2000,7 @@ m4_define([_m4_defun_once],
|
||||
|
||||
# m4_pattern_forbid(ERE, [WHY])
|
||||
# -----------------------------
|
||||
# Declare that no token matching the forbidden extended regular
|
||||
# Declare that no token matching the forbidden perl extended regular
|
||||
# expression ERE should be seen in the output unless...
|
||||
m4_define([m4_pattern_forbid], [])
|
||||
|
||||
@@ -2008,7 +2008,7 @@ m4_define([m4_pattern_forbid], [])
|
||||
# m4_pattern_allow(ERE)
|
||||
# ---------------------
|
||||
# ... that token also matches the allowed extended regular expression ERE.
|
||||
# Both used via traces.
|
||||
# Both used via traces, by autom4te post-processing.
|
||||
m4_define([m4_pattern_allow], [])
|
||||
|
||||
|
||||
@@ -2107,7 +2107,7 @@ m4_define([_m4_require_check],
|
||||
[m4_if(_m4_defn([_m4_diverting]), [$2], [m4_ignore],
|
||||
m4_ifdef([_m4_diverting([$2])], [-]), [-], [m4_warn([syntax],
|
||||
[$3: `$1' was expanded before it was required
|
||||
http://www.gnu.org/software/autoconf/manual/autoconf.html#Expanded-Before-Required])_m4_require_call],
|
||||
https://www.gnu.org/software/autoconf/manual/autoconf.html#Expanded-Before-Required])_m4_require_call],
|
||||
[m4_ignore])])
|
||||
|
||||
|
||||
@@ -3126,7 +3126,8 @@ m4_define([m4_set_empty],
|
||||
# guaranteed. This is faster than the corresponding m4_foreach([VAR],
|
||||
# m4_indir([m4_dquote]m4_set_listc([SET])), [ACTION])
|
||||
m4_define([m4_set_foreach],
|
||||
[m4_pushdef([$2])m4_set_map_sep([$1], [m4_define([$2],], [)$3])])
|
||||
[m4_pushdef([$2])m4_set_map_sep([$1],
|
||||
[m4_define([$2],], [)$3])m4_popdef([$2])])
|
||||
|
||||
# m4_set_intersection(SET1, SET2)
|
||||
# -------------------------------
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2015, 2018 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
|
||||
@@ -16,12 +16,13 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
m4_pushdef([b4_copyright_years],
|
||||
[2002-2015])
|
||||
[2002-2015, 2018])
|
||||
|
||||
# b4_stack_define
|
||||
# ---------------
|
||||
m4_define([b4_stack_define],
|
||||
[[ template <class T, class S = std::vector<T> >
|
||||
[[ /// A stack with random access from its top.
|
||||
template <class T, class S = std::vector<T> >
|
||||
class stack
|
||||
{
|
||||
public:
|
||||
@@ -35,20 +36,24 @@ m4_define([b4_stack_define],
|
||||
seq_.reserve (200);
|
||||
}
|
||||
|
||||
stack (unsigned int n)
|
||||
stack (unsigned n)
|
||||
: seq_ (n)
|
||||
{}
|
||||
|
||||
inline
|
||||
/// Random access.
|
||||
///
|
||||
/// Index 0 returns the topmost element.
|
||||
T&
|
||||
operator[] (unsigned int i)
|
||||
operator[] (unsigned i)
|
||||
{
|
||||
return seq_[seq_.size () - 1 - i];
|
||||
}
|
||||
|
||||
inline
|
||||
/// Random access.
|
||||
///
|
||||
/// Index 0 returns the topmost element.
|
||||
const T&
|
||||
operator[] (unsigned int i) const
|
||||
operator[] (unsigned i) const
|
||||
{
|
||||
return seq_[seq_.size () - 1 - i];
|
||||
}
|
||||
@@ -56,7 +61,6 @@ m4_define([b4_stack_define],
|
||||
/// Steal the contents of \a t.
|
||||
///
|
||||
/// Close to move-semantics.
|
||||
inline
|
||||
void
|
||||
push (T& t)
|
||||
{
|
||||
@@ -64,9 +68,8 @@ m4_define([b4_stack_define],
|
||||
operator[](0).move (t);
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
pop (unsigned int n = 1)
|
||||
pop (unsigned n = 1)
|
||||
{
|
||||
for (; n; --n)
|
||||
seq_.pop_back ();
|
||||
@@ -78,21 +81,18 @@ m4_define([b4_stack_define],
|
||||
seq_.clear ();
|
||||
}
|
||||
|
||||
inline
|
||||
typename S::size_type
|
||||
size () const
|
||||
{
|
||||
return seq_.size ();
|
||||
}
|
||||
|
||||
inline
|
||||
const_iterator
|
||||
begin () const
|
||||
{
|
||||
return seq_.rbegin ();
|
||||
}
|
||||
|
||||
inline
|
||||
const_iterator
|
||||
end () const
|
||||
{
|
||||
@@ -111,21 +111,20 @@ m4_define([b4_stack_define],
|
||||
class slice
|
||||
{
|
||||
public:
|
||||
slice (const S& stack, unsigned int range)
|
||||
slice (const S& stack, unsigned range)
|
||||
: stack_ (stack)
|
||||
, range_ (range)
|
||||
{}
|
||||
|
||||
inline
|
||||
const T&
|
||||
operator [] (unsigned int i) const
|
||||
operator [] (unsigned i) const
|
||||
{
|
||||
return stack_[range_ - i];
|
||||
}
|
||||
|
||||
private:
|
||||
const S& stack_;
|
||||
unsigned int range_;
|
||||
unsigned range_;
|
||||
};
|
||||
]])
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2015, 2018 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
|
||||
@@ -27,7 +27,7 @@
|
||||
m4_define([b4_symbol_variant],
|
||||
[m4_pushdef([b4_dollar_dollar],
|
||||
[$2.$3< $][3 > (m4_shift3($@))])dnl
|
||||
switch ($1)
|
||||
switch ($1)
|
||||
{
|
||||
b4_type_foreach([b4_type_action_])[]dnl
|
||||
default:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!--
|
||||
bison.xsl - common templates for Bison XSLT.
|
||||
|
||||
Copyright (C) 2007-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!--
|
||||
xml2dot.xsl - transform Bison XML Report into DOT.
|
||||
|
||||
Copyright (C) 2007-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!--
|
||||
xml2text.xsl - transform Bison XML Report into plain text.
|
||||
|
||||
Copyright (C) 2007-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!--
|
||||
xml2html.xsl - transform Bison XML Report into XHTML.
|
||||
|
||||
Copyright (C) 2007-2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
-*- C -*-
|
||||
# Yacc compatible skeleton for Bison
|
||||
|
||||
# Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation,
|
||||
# Inc.
|
||||
# Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software
|
||||
# Foundation, Inc.
|
||||
|
||||
m4_pushdef([b4_copyright_years],
|
||||
[1984, 1989-1990, 2000-2015])
|
||||
[1984, 1989-1990, 2000-2015, 2018])
|
||||
|
||||
# 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
|
||||
@@ -1207,6 +1207,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
||||
case N: \
|
||||
yyformat = S; \
|
||||
break
|
||||
default: /* Avoid compiler warnings. */
|
||||
YYCASE_(0, YY_("syntax error"));
|
||||
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
||||
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
||||
@@ -1641,8 +1642,9 @@ yyreduce:
|
||||
yyval = yyvsp[1-yylen];
|
||||
|
||||
]b4_locations_if(
|
||||
[[ /* Default location. */
|
||||
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);]])[
|
||||
[[ /* Default location. */
|
||||
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
|
||||
yyerror_range[1] = yyloc;]])[
|
||||
YY_REDUCE_PRINT (yyn);]b4_lac_if([[
|
||||
{
|
||||
int yychar_backup = yychar;
|
||||
@@ -1782,8 +1784,7 @@ yyerrorlab:
|
||||
if (/*CONSTCOND*/ 0)
|
||||
goto yyerrorlab;
|
||||
|
||||
]b4_locations_if([[ yyerror_range[1] = yylsp[1-yylen];
|
||||
]])[ /* Do not reclaim the symbols of the rule whose action triggered
|
||||
/* Do not reclaim the symbols of the rule whose action triggered
|
||||
this YYERROR. */
|
||||
YYPOPSTACK (yylen);
|
||||
yylen = 0;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
123
pgo/cases/drupal/TrainingCaseHandler.php
Normal file
123
pgo/cases/drupal/TrainingCaseHandler.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
namespace drupal;
|
||||
|
||||
use SDK\Build\PGO\Abstracts;
|
||||
use SDK\Build\PGO\Interfaces;
|
||||
use SDK\Build\PGO\Config;
|
||||
use SDK\Build\PGO\PHP;
|
||||
use SDK\Exception;
|
||||
use SDK\Build\PGO\Tool;
|
||||
|
||||
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
|
||||
{
|
||||
protected $base;
|
||||
protected $nginx;
|
||||
protected $php;
|
||||
protected $max_runs = 8;
|
||||
|
||||
public function __construct(Config $conf, ?Interfaces\Server $nginx, ?Interfaces\Server\DB $maria)
|
||||
{
|
||||
if (!$nginx) {
|
||||
throw new Exception("Invalid NGINX object");
|
||||
}
|
||||
|
||||
$this->conf = $conf;
|
||||
$this->base = $this->conf->getCaseWorkDir($this->getName());
|
||||
$this->nginx = $nginx;
|
||||
$this->php = $nginx->getPhp();
|
||||
}
|
||||
|
||||
public function getName() : string
|
||||
{
|
||||
return __NAMESPACE__;
|
||||
}
|
||||
|
||||
public function getJobFilename() : string
|
||||
{
|
||||
return $this->conf->getJobDir() . DIRECTORY_SEPARATOR . $this->getName() . ".txt";
|
||||
}
|
||||
|
||||
protected function getToolFn() : string
|
||||
{
|
||||
return $this->base . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, array("vendor", "drush", "drush", "drush"));
|
||||
}
|
||||
|
||||
protected function setupDist() : void
|
||||
{
|
||||
$db_path = str_replace("\\", "/", $this->base) . "/drupal.sqlite3";
|
||||
if (!file_exists($db_path)) {
|
||||
echo "Setting up in '{$this->base}'\n";
|
||||
|
||||
$php = new PHP\CLI($this->conf);
|
||||
$cmd = $this->getToolFn() . " site-install demo_umami --db-url=sqlite://$db_path --account-name=admin --account-pass=adminpass --yes";
|
||||
|
||||
$php->exec($cmd);
|
||||
}
|
||||
|
||||
$port = $this->getHttpPort();
|
||||
$host = $this->getHttpHost();
|
||||
|
||||
$vars = array(
|
||||
$this->conf->buildTplVarName($this->getName(), "docroot") => str_replace("\\", "/", $this->base . DIRECTORY_SEPARATOR . "web"),
|
||||
);
|
||||
$tpl_fn = $this->conf->getCasesTplDir($this->getName()) . DIRECTORY_SEPARATOR . "nginx.partial.conf";
|
||||
$this->nginx->addServer($tpl_fn, $vars);
|
||||
}
|
||||
|
||||
public function setupUrls()
|
||||
{
|
||||
$this->nginx->up();
|
||||
|
||||
$url = "http://" . $this->getHttpHost() . ":" . $this->getHttpPort();
|
||||
$s = file_get_contents($url);
|
||||
|
||||
$this->nginx->down(true);
|
||||
|
||||
echo "Generating training urls.\n";
|
||||
|
||||
$lst = array();
|
||||
if (preg_match_all(", href=\"([^\"]+)\",", $s, $m)) {
|
||||
foreach ($m[1] as $u) {
|
||||
$p = parse_url($u, PHP_URL_PATH);
|
||||
if (strlen($p) >= 2 && "/" == $p[0] && "/" != $p[1] && !in_array(substr($p, -3), array("css", "xml", "ico"))) {
|
||||
$ur = "http://" . $this->getHttpHost() . ":" . $this->getHttpPort() . $u;
|
||||
if (!in_array($ur, $lst)) {
|
||||
$lst[] = $ur;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($lst)) {
|
||||
printf("\033[31m WARNING: Training URL list is empty, check the regex and the possible previous error messages!\033[0m\n");
|
||||
}
|
||||
|
||||
$fn = $this->getJobFilename();
|
||||
$s = implode("\n", $lst);
|
||||
if (strlen($s) !== file_put_contents($fn, $s)) {
|
||||
throw new Exception("Couldn't write '$fn'.");
|
||||
}
|
||||
}
|
||||
|
||||
public function prepareInit(Tool\PackageWorkman $pw, bool $force = false) : void
|
||||
{
|
||||
$php = new PHP\CLI($this->conf);
|
||||
|
||||
$composer = $this->conf->getToolsDir() . DIRECTORY_SEPARATOR . "composer.phar";
|
||||
|
||||
$cmd = $composer . " create-project drupal-composer/drupal-project:8.x-dev {$this->base} --stability dev --no-interaction";
|
||||
$php->exec($cmd);
|
||||
}
|
||||
|
||||
public function init() : void
|
||||
{
|
||||
echo "Initializing " . $this->getName() . ".\n";
|
||||
|
||||
$this->setupDist();
|
||||
$this->setupUrls();
|
||||
|
||||
echo $this->getName() . " initialization done.\n";
|
||||
echo $this->getName() . " site configured to run under " . $this->getHttpHost() . ":" . $this->getHttpPort() . "\n";
|
||||
}
|
||||
}
|
||||
19
pgo/cases/drupal/nginx.partial.conf
Normal file
19
pgo/cases/drupal/nginx.partial.conf
Normal file
@@ -0,0 +1,19 @@
|
||||
server {
|
||||
listen PHP_SDK_PGO_DRUPAL_HTTP_PORT;
|
||||
server_name PHP_SDK_PGO_DRUPAL_HTTP_HOST;
|
||||
|
||||
root PHP_SDK_PGO_DRUPAL_DOCROOT;
|
||||
index index.html index.htm index.php;
|
||||
|
||||
location / {
|
||||
try_files $uri /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass PHP_SDK_PGO_PHP_FCGI_HOST:PHP_SDK_PGO_PHP_FCGI_PORT;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
}
|
||||
|
||||
5
pgo/cases/drupal/phpsdk_pgo.json
Normal file
5
pgo/cases/drupal/phpsdk_pgo.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"type": "web",
|
||||
"srv_http": "nginx",
|
||||
"srv_db": null
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user