Init Repo

This commit is contained in:
root
2019-09-06 23:53:10 +08:00
commit f0ef89dfbb
7905 changed files with 914138 additions and 0 deletions

19
vendor/swoole/tools/arginfo_check.php vendored Executable file
View File

@ -0,0 +1,19 @@
<?php
// if no output, it means there is no mistake.
$list = array_filter(scandir(__DIR__.'/../'), function (string $name) {
return substr($name, -2, 2) === '.c';
});
array_walk($list, function (string $filename) {
$content = file_get_contents(__DIR__."/../{$filename}");
preg_match_all(
'/ZEND_BEGIN_ARG_INFO_EX\(.+, (\d+?)\)\n([\s\S]*?)ZEND_END_ARG_INFO\(\)/',
$content, $arg_info_matches, PREG_SET_ORDER
);
array_walk($arg_info_matches, function (array $arg_info) {
[$_, $arg_num, $arg_lines] = $arg_info;
$total_num = substr_count($arg_lines, "ZEND_ARG_");
if ((int)$arg_num > $total_num) {
var_dump($_);
}
});
});

77
vendor/swoole/tools/check-package.php vendored Executable file
View File

@ -0,0 +1,77 @@
#!/usr/bin/env php
<?php
define('BASE_DIR', dirname(__DIR__));
if (empty($argv[1]))
{
$DIR = BASE_DIR . '/tests';
}
else
{
$DIR = BASE_DIR . '/' . $argv[1];
}
$role = empty($argv[2]) ? 'test' : 'src';
$cmd = empty($argv[3]) ? 'list' : 'check';
$_files = [];
search($DIR, $_files);
foreach ($_files as $f)
{
$filename = str_replace($DIR . '/', '', $f);
if ($cmd == 'list')
{
echo '<file name="' . $filename . '" role="' . $role . '" />' . "\n";
}
elseif ($cmd == 'check')
{
if (!inPackage($filename))
{
echo "$filename\n";
}
}
}
function search($path, &$_files)
{
$dirs = _scandir($path);
foreach ($dirs as $d)
{
$_path = $path . '/' . $d;
if (!is_dir($_path))
{
$_files[] = $_path;
continue;
}
else
{
search($_path, $_files);
}
}
}
function _scandir($dir)
{
$list = scandir($dir);
return array_filter($list, function ($f)
{
return $f[0] !== '.';
});
}
function inPackage($file)
{
static $content = null;
if (!$content)
{
$content = file_get_contents(BASE_DIR . '/package.xml');
}
if (strpos($content, $file) === false)
{
return false;
}
else
{
return true;
}
}

5
vendor/swoole/tools/export.php vendored Executable file
View File

@ -0,0 +1,5 @@
<?php
if ($argc == 1) {
die("Usage: php export.php [class_name]\n");
}
ReflectionClass::export($argv[1]);

6
vendor/swoole/tools/gen-data.php vendored Executable file
View File

@ -0,0 +1,6 @@
<?php
$fp = fopen(__DIR__ . "/a.txt", "w");
ftruncate($fp, filesize(__DIR__ . "/a.txt"));
fwrite($fp, str_repeat('A', 1024));
fwrite($fp, str_repeat('B', 1024));
fwrite($fp, str_repeat('C', 256)."\n");

10
vendor/swoole/tools/ip.php vendored Executable file
View File

@ -0,0 +1,10 @@
<?php
if (empty($argv[1])) {
die("php ip.php sin_addr\n");
}
$v = $argv[1];
$n = unpack('Nip', $v);
$ip = long2ip($n['ip']);
$results = `curl http://freeapi.ipip.net/$ip`;
echo "IP: $ip, LOCATION: $results\n";