Lines Matching refs:out
555 static void render(FILE *out, FILE *hdr);
564 FILE *out, *hdr; in main() local
642 out = fopen(outputname, "w"); in main()
643 if (!out) { in main()
654 render(out, hdr); in main()
656 if (fclose(out) < 0) { in main()
1256 static void render_element(FILE *out, struct element *e, struct element *tag);
1257 static void render_out_of_line_list(FILE *out);
1264 static void render_opcode(FILE *out, const char *fmt, ...) in render_opcode() argument
1268 if (out) { in render_opcode()
1269 fprintf(out, "\t[%4d] =%*s", nr_entries, render_depth, ""); in render_opcode()
1271 vfprintf(out, fmt, va); in render_opcode()
1278 static void render_more(FILE *out, const char *fmt, ...) in render_more() argument
1282 if (out) { in render_more()
1284 vfprintf(out, fmt, va); in render_more()
1292 static void render(FILE *out, FILE *hdr) in render() argument
1312 fprintf(out, "/*\n"); in render()
1313 fprintf(out, " * Automatically generated by asn1_compiler. Do not edit\n"); in render()
1314 fprintf(out, " *\n"); in render()
1315 fprintf(out, " * ASN.1 parser for %s\n", grammar_name); in render()
1316 fprintf(out, " */\n"); in render()
1317 fprintf(out, "#include <linux/asn1_ber_bytecode.h>\n"); in render()
1318 fprintf(out, "#include \"%s.asn1.h\"\n", grammar_name); in render()
1319 fprintf(out, "\n"); in render()
1320 if (ferror(out)) { in render()
1337 fprintf(out, "enum %s_actions {\n", grammar_name); in render()
1339 fprintf(out, "\tACT_%s = %u,\n", in render()
1341 fprintf(out, "\tNR__%s_actions = %u\n", grammar_name, nr_actions); in render()
1342 fprintf(out, "};\n"); in render()
1344 fprintf(out, "\n"); in render()
1345 fprintf(out, "static const asn1_action_t %s_action_table[NR__%s_actions] = {\n", in render()
1348 fprintf(out, "\t[%4u] = %s,\n", action->index, action->name); in render()
1349 fprintf(out, "};\n"); in render()
1351 if (ferror(out)) { in render()
1369 fprintf(out, "\n"); in render()
1370 fprintf(out, "static const unsigned char %s_machine[] = {\n", in render()
1375 render_element(out, root->element, NULL); in render()
1376 render_opcode(out, "ASN1_OP_COMPLETE,\n"); in render()
1377 render_out_of_line_list(out); in render()
1379 fprintf(out, "};\n"); in render()
1381 fprintf(out, "\n"); in render()
1382 fprintf(out, "const struct asn1_decoder %s_decoder = {\n", grammar_name); in render()
1383 fprintf(out, "\t.machine = %s_machine,\n", grammar_name); in render()
1384 fprintf(out, "\t.machlen = sizeof(%s_machine),\n", grammar_name); in render()
1385 fprintf(out, "\t.actions = %s_action_table,\n", grammar_name); in render()
1386 fprintf(out, "};\n"); in render()
1392 static void render_out_of_line_list(FILE *out) in render_out_of_line_list() argument
1403 render_more(out, "\n"); in render_out_of_line_list()
1407 render_element(out, ce, NULL); in render_out_of_line_list()
1413 render_opcode(out, "ASN1_OP_END_SEQ%s,\n", act); in render_out_of_line_list()
1416 render_opcode(out, "ASN1_OP_END_SEQ_OF%s,\n", act); in render_out_of_line_list()
1417 render_opcode(out, "_jump_target(%u),\n", entry); in render_out_of_line_list()
1420 render_opcode(out, "ASN1_OP_END_SET%s,\n", act); in render_out_of_line_list()
1423 render_opcode(out, "ASN1_OP_END_SET_OF%s,\n", act); in render_out_of_line_list()
1424 render_opcode(out, "_jump_target(%u),\n", entry); in render_out_of_line_list()
1430 render_opcode(out, "_action(ACT_%s),\n", in render_out_of_line_list()
1432 render_opcode(out, "ASN1_OP_RETURN,\n"); in render_out_of_line_list()
1439 static void render_element(FILE *out, struct element *e, struct element *tag) in render_element() argument
1453 if (e->type_def && out) { in render_element()
1454 render_more(out, "\t// %s\n", e->type_def->name->content); in render_element()
1463 render_opcode(out, "ASN1_OP_%sMATCH_ANY%s%s,", in render_element()
1466 render_more(out, "\t\t// %s", e->name->content); in render_element()
1467 render_more(out, "\n"); in render_element()
1471 render_element(out, e->children, e); in render_element()
1478 render_opcode(out, "ASN1_OP_%sMATCH%s%s,", in render_element()
1491 render_opcode(out, "ASN1_OP_%sMATCH%s%s,", in render_element()
1499 render_more(out, "\t\t// %s", x->name->content); in render_element()
1500 render_more(out, "\n"); in render_element()
1510 render_opcode(out, "_tag(%s, %s, %s),\n", in render_element()
1515 render_opcode(out, "_tagn(%s, %s, %2u),\n", in render_element()
1525 render_element(out, e->type->type->element, tag); in render_element()
1527 render_opcode(out, "ASN1_OP_%sACT,\n", in render_element()
1535 render_opcode(out, "_jump_target(%u),", e->entry_index); in render_element()
1537 render_more(out, "\t\t// --> %s", in render_element()
1539 render_more(out, "\n"); in render_element()
1550 render_element(out, ec, NULL); in render_element()
1552 render_opcode(out, "ASN1_OP_END_SEQ%s,\n", act); in render_element()
1561 render_opcode(out, "_jump_target(%u),", e->entry_index); in render_element()
1563 render_more(out, "\t\t// --> %s", in render_element()
1565 render_more(out, "\n"); in render_element()
1576 render_element(out, e->children, NULL); in render_element()
1579 render_opcode(out, "ASN1_OP_END_SEQ_OF%s,\n", act); in render_element()
1581 render_opcode(out, "ASN1_OP_END_SET_OF%s,\n", act); in render_element()
1582 render_opcode(out, "_jump_target(%u),\n", entry); in render_element()
1598 render_element(out, ec, ec); in render_element()
1600 render_opcode(out, "ASN1_OP_COND_FAIL,\n"); in render_element()
1602 render_opcode(out, "ASN1_OP_ACT,\n"); in render_element()
1610 render_opcode(out, "_action(ACT_%s),\n", e->action->name); in render_element()