Расширение PHP с C. Создание первой среды У меня возникла синтаксическая ошибка awk с помощью ext_skel
Ошибка выше:
enter code here
awk: syntax error at source line 256 source file /Users/Princelo/Downloads/php-5.5.14/ext/skeleton/create_stubs
context is
if (!stubs) print "" > extname >>> "/function_warning" <<<
awk: illegal statement at source line 257 source file /Users/Princelo/Downloads/php-5.5.14/ext/skeleton/create_stubs
awk: syntax error at source line 267 source file /Users/Princelo/Downloads/php-5.5.14/ext/skeleton/create_stubs
rm: function_entries: No such file or directory
rm: function_declarations: No such file or directory
rm: function_stubs: No such file or directory
enter code here
Он сгенерировал myextension.c, который не имеет функции "PHP_FUNCTION (myextension)". Как решить проблему? Моя ОС - Yosemite, PHP версия 5.5.14. Благодарю!
источник create_stubs из строки 251 в конец:
enter code here
print proto > stubfile
if (funcvals) print funcvals > stubfile
if (fetchargs) print fetchargs > stubfile
if (resources) {
print resources > stubfile
if (!stubs) print "" > extname "/function_warning"
}
if (!i_know_what_to_do_shut_up_i_dont_need_your_help_mode) {
print "\tphp_error(E_WARNING, \"" funcs[i] ": not yet implemented\");" > stubfile
}
print "}\n/* }}} */\n" > stubfile
if (stubs) {
h_stubs = h_stubs "PHP_FUNCTION(" funcs[i] ");\n"
c_stubs = c_stubs "\tPHP_FE(" funcs[i] ",\tNULL)\n"
} else {
print "PHP_FUNCTION(" funcs[i] ");" > extname "/function_declarations"
print "\tPHP_FE(" funcs[i] ",\tNULL)" > extname "/function_entries"
}
if (xml) print xmlstr > xmldoc
}
if (stubs) {
print "\n/* ----------------------------------------------------------- */\n" > stubfile
print c_stubs > stubfile
print "\n/* ----------------------------------------------------------- */\n" > stubfile
print h_stubs > stubfile
}
if (xml) print xmlfoot > xmldoc
}
#
# Local variables:
# tab-width: 2
# c-basic-offset: 2
# End:
enter code here
Строка 256 -
if (!stubs) print "" > extname "/function_warning"
Выражения на правой стороне >
должны быть в круглых скобках:
if (!stubs) print "" > ( extname "/function_warning" )
так как порядок оценки зависит от реализации. То же самое для других печатных линий.