|
|
@ -30,28 +30,36 @@ CHECK_FMT='if (!%s) {
|
|
|
|
}'
|
|
|
|
}'
|
|
|
|
|
|
|
|
|
|
|
|
while read -r COMMAND; do
|
|
|
|
while read -r COMMAND; do
|
|
|
|
[ ${COMMAND::1} = "-" ]
|
|
|
|
OPTIONAL=0
|
|
|
|
OPTIONAL=$?
|
|
|
|
FUNC_PTR_FMT='PFN%sPROC'
|
|
|
|
|
|
|
|
|
|
|
|
COMMAND=${COMMAND#-}
|
|
|
|
case $COMMAND in
|
|
|
|
if [ ${COMMAND: -2} = "WL" ]; then
|
|
|
|
-*)
|
|
|
|
|
|
|
|
OPTIONAL=1
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case $COMMAND in
|
|
|
|
|
|
|
|
*WL)
|
|
|
|
FUNC_PTR_FMT='PFN%s'
|
|
|
|
FUNC_PTR_FMT='PFN%s'
|
|
|
|
else
|
|
|
|
;;
|
|
|
|
FUNC_PTR_FMT='PFN%sPROC'
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
COMMAND=${COMMAND#-}
|
|
|
|
FUNC_PTR=$(printf "$FUNC_PTR_FMT" "$COMMAND" | tr [:lower:] [:upper:])
|
|
|
|
FUNC_PTR=$(printf "$FUNC_PTR_FMT" "$COMMAND" | tr [:lower:] [:upper:])
|
|
|
|
|
|
|
|
|
|
|
|
DECL="$DECL$(printf "\n$DECL_FMT" "$FUNC_PTR" "$COMMAND")"
|
|
|
|
DECL="$DECL$(printf "\n$DECL_FMT" "$FUNC_PTR" "$COMMAND")"
|
|
|
|
DEFN="$DEFN$(printf "\n$DEFN_FMT" "$FUNC_PTR" "$COMMAND")"
|
|
|
|
DEFN="$DEFN$(printf "\n$DEFN_FMT" "$FUNC_PTR" "$COMMAND")"
|
|
|
|
LOADER="$LOADER$(printf "\n$LOADER_FMT" "$COMMAND" "$FUNC_PTR" "$COMMAND")"
|
|
|
|
LOADER="$LOADER$(printf "\n$LOADER_FMT" "$COMMAND" "$FUNC_PTR" "$COMMAND")"
|
|
|
|
|
|
|
|
|
|
|
|
if [ $OPTIONAL -ne 0 ]; then
|
|
|
|
if [ $OPTIONAL -eq 0 ]; then
|
|
|
|
LOADER="$LOADER$(printf "\n$CHECK_FMT" "$COMMAND" "$COMMAND")"
|
|
|
|
LOADER="$LOADER$(printf "\n$CHECK_FMT" "$COMMAND" "$COMMAND")"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done < $SPEC
|
|
|
|
done < $SPEC
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${OUT: -2} = '.h' ]; then
|
|
|
|
|
|
|
|
|
|
|
|
case $OUT in
|
|
|
|
|
|
|
|
*.h)
|
|
|
|
cat > $OUT << EOF
|
|
|
|
cat > $OUT << EOF
|
|
|
|
#ifndef $INCLUDE_GUARD
|
|
|
|
#ifndef $INCLUDE_GUARD
|
|
|
|
#define $INCLUDE_GUARD
|
|
|
|
#define $INCLUDE_GUARD
|
|
|
@ -69,7 +77,8 @@ if [ ${OUT: -2} = '.h' ]; then
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
EOF
|
|
|
|
EOF
|
|
|
|
elif [ ${OUT: -2} = '.c' ]; then
|
|
|
|
;;
|
|
|
|
|
|
|
|
*.c)
|
|
|
|
cat > $OUT << EOF
|
|
|
|
cat > $OUT << EOF
|
|
|
|
#include <wlr/util/log.h>
|
|
|
|
#include <wlr/util/log.h>
|
|
|
|
#include "$BASE.h"
|
|
|
|
#include "$BASE.h"
|
|
|
@ -86,6 +95,8 @@ elif [ ${OUT: -2} = '.c' ]; then
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
EOF
|
|
|
|
else
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
exit 1
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|