You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Student/instructor code
extern int atoi(const char*);
int main(int argc, char *argv[]) {
int arg = atoi(argv[1]);
if (arg == 1) print_T(FUN(ARGS));
...
}
where T is derived from the return type (print_int, print_double, print_char_pointer, print_bool, print_char, ...). If the return type is something else, the instructor/student code must contain a function print_T.
The text was updated successfully, but these errors were encountered:
We need to capture the type of the C function, not just its name. Right now, Language.java has a functionName method that finds the name. We'd like functionType. But not all functions have types (e.g. in Python, JavaScript, etc.) So the default in Language should return null, but in CLanguage override to produce a type. The type is everything before the name, with spaces and modifiers (const, static, extern) removed, e.g. int, double, bool, char, char*.
Modify Calls.Call to have a String type field. Set it in addCall to the result of calling functionName. It will be null for all languages other than C. That's ok.
In CLanguage.writeTester, ask for the type of the Call object and produce calls to print_int, print_double, print_char_pointer, print_bool, print_char. Those are the only supported ones. Otherwise call print_unsupported.
Define those functions in a file codecheck_c.h that you include like the C++ language does. They just call printf. Or skip the functions and call printf directly.
Make a progfileCodeCheck.c with the contents
where T is derived from the return type (
print_int
,print_double
,print_char_pointer
,print_bool
,print_char
, ...). If the return type is something else, the instructor/student code must contain a function print_T.The text was updated successfully, but these errors were encountered: