You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mkstyle.sh 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/sh
  2. echo "/* This file is machine-generated from the contents of style/ */"
  3. echo "/* by mkstyle.sh. Editing it by hand is an exeedingly bad idea. */"
  4. echo
  5. # set the locale for sorting so that the collate order doesn't depend
  6. # on the users environment.
  7. LC_COLLATE=C
  8. export LC_COLLATE
  9. # require gnu sed even though we aren't using gnu extensions.
  10. # this avoids portability issues with other seds.
  11. if gsed v /dev/null 1>/dev/null 2>&1; then
  12. SED=gsed
  13. elif sed v /dev/null 1>/dev/null 2>&1; then
  14. # sed is gnu sed
  15. SED=sed
  16. elif [ `uname -s` = "FreeBSD" ]; then
  17. # BSD sed is fine
  18. SED=/usr/bin/sed
  19. else
  20. echo "Error: can't find gnu sed" 1>&2
  21. exit 1
  22. fi
  23. echo "#include \"defs.h\""
  24. echo "#if CSVFMTS_ENABLED"
  25. nstyles="0"
  26. for i in `dirname $0`/style/*.style
  27. do
  28. A=`basename $i | sed "s/.style$//"`
  29. [ $A = "README" ] && continue
  30. [ $A = "custom.style" ] && continue
  31. ALIST="{ \"$A\", $A } , $ALIST"
  32. echo "static char $A[] ="
  33. $SED 's/\\/\\\\/;s/"/\\"/g;s/^\(.\)/"\1/g;s/\(.\)$/\1\\n"/g;s/^\(.\)/ \1/' $i
  34. echo " ;"
  35. nstyles=`expr $nstyles + 1`;
  36. done
  37. echo "style_vecs_t style_list[] = {$ALIST {0,0}};"
  38. echo "size_t nstyles = $nstyles;"
  39. echo "#else /* CSVFMTS_ENABLED */"
  40. echo "style_vecs_t style_list[] = {{0,0}};"
  41. echo "size_t nstyles = 0;"
  42. echo "#endif /* CSVFMTS_ENABLED */"