Input channels file.
--output-dir
Destination directory for generated files.
EOD;
}
$input_file = "";
$output_dir = "";
for ($i = 1; $i < $argc;) {
$arg = $argv[$i++];
switch ($arg) {
case "--input-file":
$input_file = $argv[$i++];
break;
case "--output-dir":
$output_dir = $argv[$i++];
break;
case "--help":
print_help($argv[0]);
exit(0);
default:
fatal_error("Unknown option: {$arg}");
}
}
if ($input_file == "") {
fatal_error("--input-file missing");
}
if ($output_dir == "") {
fatal_error("--output-dir missing");
}
if (($data = file_get_contents($input_file)) === FALSE) {
fatal_error("Failed to read input file");
}
if (!tokenize($data, $tokens)) {
fatal_error("Failed to tokenize");
}
$i = 0;
$channels_defines = "";
$channels_list = "";
reset($tokens);
while (1) {
if (($ch_name = current($tokens)) === FALSE) {
break;
}
next($tokens);
if (($ch_priority = current($tokens)) === FALSE) {
fatal_error("missing priority");
}
next($tokens);
if ($ch_name[0] != "name") {
fatal_error("name is not a name");
}
if ($ch_priority[0] != "number") {
fatal_error("priority is not a number");
}
$channel_file = <<