6 $pattern =
'/static const mbfl_encoding \*mbfl_encoding_ptr_list\[\][\s\S]*?\{([^}]*)\};/';
11 return trim($item,
"&\n\t ");
20 $pattern =
'/const mbfl_encoding\s+(' .
implode(
'|', $struct_names) .
')\s* = {([^}]*)}/';
22 foreach ($matches as $match) {
23 $current_struct_name = $match[1];
24 $struct_definition = $match[2];
34 foreach (
glob(__DIR__ .
"/../**/*.c") as
$file) {
45 'mbfl_encoding_cp1251' =>
'Windows-1251',
46 'mbfl_encoding_cp1252' =>
'Windows-1252',
47 'mbfl_encoding_cp1254' =>
'Windows-1254',
48 'mbfl_encoding_8859_1' =>
'ISO-8859-1',
49 'mbfl_encoding_8859_2' =>
'ISO-8859-2',
50 'mbfl_encoding_8859_3' =>
'ISO-8859-3',
51 'mbfl_encoding_8859_4' =>
'ISO-8859-4',
52 'mbfl_encoding_8859_5' =>
'ISO-8859-5',
53 'mbfl_encoding_8859_6' =>
'ISO-8859-6',
54 'mbfl_encoding_8859_7' =>
'ISO-8859-7',
55 'mbfl_encoding_8859_8' =>
'ISO-8859-8',
56 'mbfl_encoding_8859_9' =>
'ISO-8859-9',
57 'mbfl_encoding_8859_10' =>
'ISO-8859-10',
58 'mbfl_encoding_8859_13' =>
'ISO-8859-13',
59 'mbfl_encoding_8859_14' =>
'ISO-8859-14',
60 'mbfl_encoding_8859_15' =>
'ISO-8859-15',
61 'mbfl_encoding_8859_16' =>
'ISO-8859-16',
62 'mbfl_encoding_cp866' =>
'CP866',
63 'mbfl_encoding_cp850' =>
'CP850',
64 'mbfl_encoding_koi8r' =>
'KOI8-R',
65 'mbfl_encoding_koi8u' =>
'KOI8-U',
66 'mbfl_encoding_armscii8' =>
'ArmSCII-8',
67 'mbfl_encoding_ascii' =>
'ASCII',
87passthru(
'gperf ' .
escapeshellarg(__DIR__ .
'/encodings.txt') .
' --readonly-tables --null-strings --ignore-case -m 1000');
89@
unlink(__DIR__ .
'/encodings.txt');
92$pattern =
'/static const unsigned char asso_values\[\] =([^}]*)\};/';
96echo
"===--- Copy and paste the following values in the asso_values array in mbfl_encoding.c ---===\n";
100$pattern =
'/static const char \* const wordlist\[\] =([^}]*)\};/';
102assert(isset($matches[1]));
111echo
"===--- Copy and paste the following values in the mbfl_encoding_ptr_list_after_hashing array in mbfl_encoding.c ---===\n";
unlink(string $filename, $context=null)
implode(string|array $separator, ?array $array=null)
trim(string $string, string $characters=" \n\r\t\v\0")
file_get_contents(string $filename, bool $use_include_path=false, $context=null, int $offset=0, ?int $length=null)
explode(string $separator, string $string, int $limit=PHP_INT_MAX)
str_replace(array|string $search, array|string $replace, string|array $subject, &$count=null)
passthru(string $command, &$result_code=null)
file_put_contents(string $filename, mixed $data, int $flags=0, $context=null)
array_map(?callable $callback, array $array, array ... $arrays)
array_search(mixed $needle, array $haystack, bool $strict=false)
glob(string $pattern, int $flags=0)
assert(mixed $assertion, Throwable|string|null $description=null)
ob_start($callback=null, int $chunk_size=0, int $flags=PHP_OUTPUT_HANDLER_STDFLAGS)
escapeshellarg(string $arg)
foreach(explode("\n", $input) as $line) $result
read_encoding_pointer_array()
$encoding_pointer_array_name_mapping
foreach( $fixed_encodings as $encoding_pointer=> $encoding_name) foreach($encoding_pointer_array as $encoding_pointer) $ordered_name_list
search_struct_in_dir($struct_names)
search_struct_in_file(array &$result, $struct_names, $file_path)
preg_match_all(string $pattern, string $subject, &$matches=null, int $flags=0, int $offset=0)
preg_match(string $pattern, string $subject, &$matches=null, int $flags=0, int $offset=0)