sw-battle-test-c

Interesting test task in C instead of C++
git clone git://bsandro.tech/sw-battle-test-c
Log | Files | Refs | README

populate.sh (486B)


      1 #!/usr/bin/env bash
      2 
      3 cd $(dirname "$0")
      4 
      5 rm -f _registry.inc
      6 rm -f _types.inc
      7 rm -f _include.h
      8 
      9 echo '#pragma once' > _include.h
     10 
     11 for f in *.h; do
     12     if [[ "$f" == _* ]]; then continue; fi
     13     echo "Components: populating $f..."
     14     struct=`sed -n 's/^typedef struct \([A-Za-z_]*\).*/\1/p' $f`
     15     str="$(basename $f .h)";
     16     comp="COMPONENT_${str^^}";
     17     echo "$struct $str;" >> _registry.inc
     18     echo "$comp," >> _types.inc
     19     echo "#include \"components/$f\"" >> _include.h
     20 done