moved to gitea

This commit is contained in:
2026-04-05 15:09:32 -05:00
parent 2bb4c6fe2c
commit 3745d459a3
42 changed files with 5038 additions and 6 deletions

View File

@@ -0,0 +1,79 @@
#!/bin/sh
# shmake_module.sh - Module creation for shmake
# Author: Emilia Marigold
add_module()
{
check_project_root
if [ $# -lt 1 ]; then
printf "Usage: %s module [name]\n" "$SCRIPT_NAME"
exit 1
fi
MODULE_NAME="$1"
MODULE_DIR="source_code/MODULE_${MODULE_NAME}"
MODULE_NAME_UPPER=$(printf "%s" "$MODULE_NAME" | tr '[:lower:]' '[:upper:]')
printf "Creating module '%s'...\n" "$MODULE_NAME"
mkdir -p "$MODULE_DIR"
mkdir -p "$MODULE_DIR/internal"
mkdir -p "$MODULE_DIR/tests"
cat > "$MODULE_DIR/${MODULE_NAME}.h" << EOF
#ifndef ${MODULE_NAME_UPPER}_H
#define ${MODULE_NAME_UPPER}_H
/* Function declarations */
#endif /* ${MODULE_NAME_UPPER}_H */
EOF
cat > "$MODULE_DIR/${MODULE_NAME}.c" << EOF
#include "${MODULE_NAME}.h"
/* Function implementations */
EOF
cat > "$MODULE_DIR/internal/${MODULE_NAME}_internal.h" << EOF
#ifndef ${MODULE_NAME_UPPER}_INTERNAL_H
#define ${MODULE_NAME_UPPER}_INTERNAL_H
/* Internal function declarations (not exposed in public header) */
#endif /* ${MODULE_NAME_UPPER}_INTERNAL_H */
EOF
cat > "$MODULE_DIR/internal/${MODULE_NAME}_internal.c" << EOF
#include "${MODULE_NAME}_internal.h"
#include "../${MODULE_NAME}.h"
/* Internal function implementations */
EOF
cat > "$MODULE_DIR/tests/${MODULE_NAME}_test.h" << EOF
#ifndef ${MODULE_NAME_UPPER}_TEST_H
#define ${MODULE_NAME_UPPER}_TEST_H
/* Test function declarations */
#endif /* ${MODULE_NAME_UPPER}_TEST_H */
EOF
cat > "$MODULE_DIR/tests/${MODULE_NAME}_test.c" << EOF
#include "${MODULE_NAME}_test.h"
#include "../${MODULE_NAME}.h"
/* Test implementations */
EOF
printf "Module '%s' created successfully!\n" "$MODULE_NAME"
printf " Location: %s\n" "$MODULE_DIR"
printf " Next: Add your implementation to the .c files.\n"
printf " Run 'shmake sync' after adding source files to update Makefile.\n"
}