doc2lib.sh 349 B

12345678910111213141516171819202122
  1. dir_name="$(dirname $1)"
  2. cat $1 | \
  3. sed 's/```X.*$//' | \
  4. awk -v dir_name=$dir_name '
  5. BEGIN {file_name = ""}
  6. /comment/ && /\.h/ {
  7. gsub (" ", "", $0);
  8. if(split($0,a,"[()]")==3) file_name=a[2]
  9. }
  10. /comment/ && ! /docautocomplete/ , /```/ {
  11. if ((! ($0 ~ /```/ )) && (! ($0 ~ /comment/ ) ))
  12. print $0 >> dir_name"/"file_name
  13. }
  14. '