Lines Matching +full:sub +full:- +full:spaces
1 #!/usr/bin/awk -f
3 #-
4 # SPDX-License-Identifier: BSD-3-Clause
37 # Script to produce kobj front-end sugar.
42 print "usage: makeobjops.awk <srcfile.m> [-d] [-p] [-l <nr>] [-c|-h]";
43 print "where -c produce only .c files";
44 print " -h produce only .h files";
45 print " -p use the path component in the source file for destination dir";
46 print " -l set line width for output files [80]";
47 print " -d switch on debugging";
80 # the specified number of spaces.
83 # by ",\n" plus indent spaces.
94 # If there is none, give up and leave it as-is.
98 rline = rline substr(line, 1, RLENGTH - 1) "\n";
113 _result = separator array[num--] _result;
136 sub(/;$/, "", intname);
137 if (intname !~ /^[a-z_][a-z0-9_]*$/) {
139 warnsrc("Invalid interface name '" intname "', use [a-z_][a-z0-9_]*");
170 # Returns the code as-is.
178 sub(/[^ ].*$/, "", indent); # find the indent used
180 sub("^" indent, ""); # remove the indent
204 sub(/^[^ ]+[ ]+/, "");
206 sub(/[ ]*\{.*$/, "", ret);
208 sub(/^.*[ ]/, "", name); # last element is name of method
209 sub(/[ ]+[^ ]+$/, "", ret); # return type
212 sub(/^[^\{]*\{[ ]*/, "");
221 if (name !~ /^[a-z_][a-z_0-9]*$/) {
222 warnsrc("Invalid method name '" name "', use [a-z_][a-z0-9_]*");
247 if (extra ~ /[ ]*DEFAULT[ ]*[a-zA-Z_][a-zA-Z_0-9]*[ ]*;/) {
249 sub(/.*DEFAULT[ ]*/, "", default_function);
250 sub(/[; ]+.*$/, "", default_function);
256 sub(/\};?.*$/, "", line);
261 sub(/^[ ]+/, "", line); # remove leading ...
262 sub(/[ ]+$/, "", line); # ... and trailing whitespace
263 gsub(/[ ]+/, " ", line); # remove double spaces
265 num_arguments = split(line, arguments, / *; */) - 1;
330 printh("\tKOBJOPLOOKUP(" firstvar "->ops," mname ");");
356 if (ARGV[i] ~ /^-/) {
396 if (opt_l !~ /^[0-9]+$/ || opt_l < 1)
408 sub(/\.m$/, ".c", cfilename);
409 sub(/\.m$/, ".h", hfilename);
411 sub(/^.*\//, "", cfilename);
412 sub(/^.*\//, "", hfilename);
460 sub(/^#[ ]*include[ ]+/, "", incld);
470 sub(/#.*/, ""); # remove comments
471 sub(/^[ ]+/, ""); # remove leading ...
472 sub(/[ ]+$/, ""); # ... and trailing whitespace
517 system_check("rm -f " ctmpfilename " " htmpfilename);
522 system_check("mv -f " ctmpfilename " " cfilename);
524 system_check("mv -f " htmpfilename " " hfilename);