Tuesday, May 29, 2007

Awk to split c functions into multiple files.

This, at present, is overly simplistic and makes many stupid assumptions:
  • That the return type is short.
  • That there are no short global variables declared.
  • That everything is well-formatted so that the return type is always first column, and that there is a space between both function name and return type (as in, only spaces--no comments) and function name and open parenthesis of the arg list.


cat $1 | awk '
BEGIN {
functionNameFile="";
}
/^short/ {
/* assumes return type of short */
/* assumes space between return type, function name, and parm list */
functionNameFile=$2.".c";
print $0 > functionNameFile;
}
/^\}/ {
print $0 >> functionNameFile;
functionNameFile="";
next;
}
{
if(functionNameFile != "") {
print $0 >> functionNameFile;
}
}
'

Labels:

Windows Vista problems resticting GNU GCC apps to 32MB

Disturbing to see this come about:
Windows Vista problems resticting GNU GCC apps to 32MB

Buried in the footnotes is a note about a response supposedly coming from a Microsoft representative saying, "now that people are asking for this, we are planning to fix..."