Changeset View
Changeset View
Standalone View
Standalone View
sys/tools/makeobjops.awk
Show First 20 Lines • Show All 319 Lines • ▼ Show 20 Lines | if (0) { # haven't chosen the format yet | ||||
printh("\t" join(";\n\t", arguments, num_arguments) ";"); | printh("\t" join(";\n\t", arguments, num_arguments) ";"); | ||||
} | } | ||||
else { | else { | ||||
prototype = "static __inline " ret " " umname "("; | prototype = "static __inline " ret " " umname "("; | ||||
printh(format_line(prototype argument_list ")", | printh(format_line(prototype argument_list ")", | ||||
line_width, length(prototype))); | line_width, length(prototype))); | ||||
} | } | ||||
printh("{"); | printh("{"); | ||||
if (singleton) | |||||
printh("\tstatic kobjop_t _m;"); | |||||
else | |||||
printh("\tkobjop_t _m;"); | printh("\tkobjop_t _m;"); | ||||
if (ret != "void") | if (ret != "void") | ||||
printh("\t" ret " rc;"); | printh("\t" ret " rc;"); | ||||
if (!static) | if (!static) | ||||
firstvar = "((kobj_t)" firstvar ")"; | firstvar = "((kobj_t)" firstvar ")"; | ||||
if (prolog != "") | if (prolog != "") | ||||
printh(prolog); | printh(prolog); | ||||
if (singleton) | |||||
printh("\tif (_m == NULL)"); | |||||
printh("\tKOBJOPLOOKUP(" firstvar "->ops," mname ");"); | printh("\tKOBJOPLOOKUP(" firstvar "->ops," mname ");"); | ||||
rceq = (ret != "void") ? "rc = " : ""; | rceq = (ret != "void") ? "rc = " : ""; | ||||
printh("\t" rceq "((" mname "_t *) _m)(" varname_list ");"); | printh("\t" rceq "((" mname "_t *) _m)(" varname_list ");"); | ||||
if (epilog != "") | if (epilog != "") | ||||
printh(epilog); | printh(epilog); | ||||
if (ret != "void") | if (ret != "void") | ||||
printh("\treturn (rc);"); | printh("\treturn (rc);"); | ||||
printh("}\n"); | printh("}\n"); | ||||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | for (file_i = 0; file_i < num_files; file_i++) { | ||||
delete methods; # clear list of methods | delete methods; # clear list of methods | ||||
intname = ""; | intname = ""; | ||||
lineno = 0; | lineno = 0; | ||||
error = 0; # to signal clean up and gerror setting | error = 0; # to signal clean up and gerror setting | ||||
lastdoc = ""; | lastdoc = ""; | ||||
prolog = ""; | prolog = ""; | ||||
epilog = ""; | epilog = ""; | ||||
singleton = 0; | |||||
while (!error && (getline < src) > 0) { | while (!error && (getline < src) > 0) { | ||||
lineno++; | lineno++; | ||||
# | # | ||||
# Take special notice of include directives. | # Take special notice of include directives. | ||||
# | # | ||||
if (/^#[ ]*include[ ]+["<][^">]+[">]/) { | if (/^#[ ]*include[ ]+["<][^">]+[">]/) { | ||||
Show All 28 Lines | else if (/^METHOD/) { | ||||
handle_method(1, lastdoc); | handle_method(1, lastdoc); | ||||
lastdoc = ""; | lastdoc = ""; | ||||
prolog = ""; | prolog = ""; | ||||
epilog = ""; | epilog = ""; | ||||
} else if (/^PROLOG[ ]*{$/) | } else if (/^PROLOG[ ]*{$/) | ||||
prolog = handle_code(); | prolog = handle_code(); | ||||
else if (/^EPILOG[ ]*{$/) | else if (/^EPILOG[ ]*{$/) | ||||
epilog = handle_code(); | epilog = handle_code(); | ||||
else if (/^SINGLETON/) | |||||
singleton = 1; | |||||
else { | else { | ||||
debug($0); | debug($0); | ||||
warnsrc("Invalid line encountered"); | warnsrc("Invalid line encountered"); | ||||
error = 1; | error = 1; | ||||
} | } | ||||
} | } | ||||
# | # | ||||
Show All 23 Lines |