Hooks are interfaces between grade and the grading scripts written by its users. Creating a hook involves creating a language-name directory in libexec/grade_hooks and placing an executable run script there. The run script should:
- Provide the functions
problemandextra_credit; their signatures are arbitrary, but it's best to follow the conventions outlined on the man page.problemandextra_creditwill call theadd_gradeexecutable, storing its stdout in the environment variableGRADE_TABLE.add_gradetakes 4 arguments:- "regular" for
problemor "extra_credit" forextra_credit - "success" on correct behavior or "failure" on incorrect behavior
- The number of points, a non-negative real number
- A description of the problem
- "regular" for
source(or the language equivalent) each grading script stored in the colon-delimited environment variableGRADE_SCRIPTS.- Run
print_grade, which will parseGRADE_TABLEand print it in human-readable form.
Using the provided Bash, Julia, and Python hooks as examples, it shouldn't be too hard to create a new one; for example, to create the Python hook, I just asked ChatGPT to translate the Julia hook and made a couple of minor modifications.