Commit 157e4213 authored by Pekka Pessi's avatar Pekka Pessi

msg_parser.awk: not extending header structure unless needed.

Removed gawk-ish /* comments */.

darcs-hash:20071005172604-88462-534f27ddb24a0863406057e7f64cdab96830003b.gz
parent 528bf0db
......@@ -407,17 +407,19 @@ in_header_list && /^ (sip|rtsp|http|msg|mp)_[a-z_0-9]+_t/ {
function print_parser_table(struct, scope, name, N, N_EXPERIMENTAL)
{
if (PT) {
printf("/* Ordinary %u, extra %u, experimental %u */\n",
ordinary, N - ordinary, N_EXPERIMENTAL - N) > PT;
printf("struct %s {\n", struct) > PT;
printf(" %s_t base;\n", module) > PT;
printf(" msg_header_t *extra[%u];\n", N - ordinary) > PT;
if (N != N_EXPERIMENTAL) {
print "#if SU_HAVE_EXPERIMENTAL" > PT;
printf(" msg_header_t *extra[%u];\n", N_EXPERIMENTAL - N) > PT;
print "#endif" > PT;
if (N > ordinary) {
printf("/* Ordinary %u, extra %u, experimental %u */\n",
ordinary, N - ordinary, N_EXPERIMENTAL - N) > PT;
printf("struct %s {\n", struct) > PT;
printf(" %s_t base;\n", module) > PT;
printf(" msg_header_t *extra[%u];\n", N - ordinary) > PT;
if (N != N_EXPERIMENTAL) {
print "#if SU_HAVE_EXPERIMENTAL" > PT;
printf(" msg_header_t *extra[%u];\n", N_EXPERIMENTAL - N) > PT;
print "#endif" > PT;
}
printf("};\n\n") > PT;
}
printf("};\n\n") > PT;
printf("%s\n", scope) > PT;
printf("msg_mclass_t const %s[1] = \n{{\n", name) > PT;
......@@ -433,7 +435,12 @@ function print_parser_table(struct, scope, name, N, N_EXPERIMENTAL)
printf("#else\n") > PT;
printf(" 0,\n") > PT;
printf("#endif\n") > PT;
printf(" sizeof (struct %s),\n", struct) > PT;
if (N > ordinary) {
printf(" sizeof (struct %s),\n", struct) > PT;
}
else {
printf(" sizeof (%s_t),\n", module) > PT;
}
printf(" %s_extract_body,\n", module) > PT;
len = split("request status separator payload unknown error", unnamed, " ");
......@@ -592,7 +599,7 @@ END {
m = module "_mclass";
s = "_d_" module "_t";
/* Add basic headers */
# Add basic headers
if (ordinary == basic) {
print_parser_table(s, "", m, basic, basic);
}
......@@ -605,7 +612,7 @@ END {
if (0) {
/* Hash extra headers */
# Hash extra headers
for (i = basic; i < total; i++) {
n = headers[i];
h = hashed[n];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment