Annotation of capa/capa51/pProj/capaCGI.h, revision 1.1
1.1 ! albertel 1:
! 2: /* ==================================================================== */
! 3:
! 4:
! 5: #ifndef CAPA_CGI_H
! 6: #define CAPA_CGI_H
! 7:
! 8: #ifdef CAPA_ARG
! 9: #undef CAPA_ARG
! 10: #define CAPA_ARG(x) x
! 11: #endif
! 12:
! 13: /*
! 14: #ifdef __STDC__
! 15: #define CAPA_ARG(x) x
! 16: #else
! 17: #define CAPA_ARG(x) ()
! 18: #endif
! 19: */
! 20:
! 21: #ifdef _MAIN_PROGRAM_
! 22:
! 23: #define GLOBAL_VAR(xx) xx
! 24: #else
! 25: #define GLOBAL_VAR(xx) extern xx
! 26: #endif
! 27:
! 28:
! 29: #define MAX_ENTRIES 10000 /* maximal number of entries in a web page form */
! 30: #define DEFAULT_STATUS_LINE_LENGTH 50
! 31: #define MAX_PROBLEM_CNT 1024
! 32: #define MAX_ANSWER_CHAR 32
! 33: #define MAX_CLASS_CHAR 16 /* officially, it is 8, since the account name won't allow */
! 34: /* more than 8 characters. */
! 35:
! 36: /* ----------------------------- various mode used in print_quizz() */
! 37: #define TRY_SET_MODE 1
! 38: #define CHECK_ANSWER_MODE 2
! 39: #define VIEW_PREVIOUS_MODE 3
! 40:
! 41:
! 42: #define TEXT_BUF_SIZE 1
! 43: /*(128*1024)*/
! 44: #define STATUS_BUF_SIZE 100
! 45: /*(32*1024)*/
! 46:
! 47: typedef struct _form_entry {
! 48: char *name;
! 49: char *val;
! 50: } FormEntry_t;
! 51:
! 52: typedef struct _student_answer {
! 53: int a_idx;
! 54: char *a_str;
! 55: struct _student_answer *a_next;
! 56: } StudentAnswer_t;
! 57:
! 58: #define M_CHECKIN 1
! 59: #define M_TRYSET 2
! 60: #define M_CHECKANS 3
! 61: #define M_VIEWPREV 4
! 62: #define M_VIEWSUMM 5
! 63: #define M_EXAMSUMM 6
! 64: #define M_QUIZSUMM 7
! 65: #define M_TERMSCORE 8
! 66: #define LF 10
! 67: #define CR 13
! 68:
! 69:
! 70: /* --------- default parameter values when something mis-specified in capa.config -------- */
! 71:
! 72: #define DEFAULT_HW_W 0.3
! 73: #define DEFAULT_QZ_W 0.07
! 74: #define DEFAULT_EX_W 0.3
! 75: #define DEFAULT_FE_W 0.35
! 76: #define DEFAULT_PC_W 0.3
! 77: #define DEFAULT_HW_COUNT 12
! 78: #define DEFAULT_QZ_COUNT 24
! 79: #define DEFAULT_FE_NUMBER 4
! 80:
! 81: /* ============ function prototype in capaCgiUtils.c ===================== */
! 82:
! 83: void getword CAPA_ARG((char *word, char *line, char stop));
! 84: char *makeword CAPA_ARG((char *line, char stop));
! 85: char *fmakeword CAPA_ARG((FILE *f, char stop, int *cl));
! 86: char x2c CAPA_ARG((char *what));
! 87: void unescape_url CAPA_ARG((char *url));
! 88: void plustospace CAPA_ARG((char *str));
! 89: int rind CAPA_ARG((char *s, char c));
! 90: int getline CAPA_ARG((char *s, int n, FILE *f));
! 91: void send_fd CAPA_ARG((FILE *f, FILE *fd));
! 92: int ind CAPA_ARG((char *s, char c));
! 93: void escape_shell_cmd CAPA_ARG((char *cmd));
! 94:
! 95: int web_log CAPA_ARG((char *log_str));
! 96: /*
! 97: void file_log CAPA_ARG((char *filename, char *log_str));
! 98: */
! 99: int w_log_timing CAPA_ARG((char *student_number,int set,int section,char *log_string));
! 100: int w_log_attempt CAPA_ARG((char *student_number,int set,char *log_string));
! 101: int w_log_submissions CAPA_ARG((char *student_number,int set,char *log_string));
! 102: int w_get_input CAPA_ARG(());
! 103: void print_mainmenu CAPA_ARG((char *class,char *sn, int pin));
! 104: void print_page_header CAPA_ARG((int mode,int num_quest));
! 105: void print_quizz CAPA_ARG((char *class_dir, char *c_owner,char *class,char *sn,int pin,int set,int mode));
! 106: void print_response CAPA_ARG((char pcr,char u_db,int q_idx,Problem_t *p));
! 107: void print_inhibited_response CAPA_ARG((char pcr,char u_db,int q_idx,Problem_t *p));
! 108: void check_user_ans CAPA_ARG((int q_idx,Problem_t *p));
! 109: void check_inhibited_user_ans CAPA_ARG((int q_idx,Problem_t *p));
! 110: void get_response CAPA_ARG((char pcr,char u_db,int q_idx,Problem_t *p));
! 111: void log_user_ans CAPA_ARG((int q_idx,Problem_t *p));
! 112: int check_class_get_maxset CAPA_ARG((char *dir_path));
! 113: int check_exam_quiz_path CAPA_ARG(());
! 114: void print_summary CAPA_ARG((char *class_dir,char *class, char *student_number,int pin,int set));
! 115: void print_termscore_page CAPA_ARG((char *class_dir,char *class, char *student_number,int pin,int set,FILE *out));
! 116: int get_termscore_params CAPA_ARG((float *hw,float *qw,float *ew,float *fw,float *pw,int *hc,int *qc,int *fs));
! 117: int web_getclassdir CAPA_ARG((char **cpath_p, char **cown_p, char *class));
! 118: char *c_getpath CAPA_ARG((FILE *f));
! 119: void append_qtext CAPA_ARG((char *new_str));
! 120: void append_stext CAPA_ARG((char *new_str));
! 121: void process_mode CAPA_ARG((int mode));
! 122: void process_summary CAPA_ARG((int mode));
! 123: void web_printheader CAPA_ARG((FILE*));
! 124: void web_printfooter CAPA_ARG((FILE*));
! 125: void preserve_last_answer CAPA_ARG((int q_idx,int print));
! 126: /* ======================================================================= */
! 127: GLOBAL_VAR(char *g_question_txt);
! 128: GLOBAL_VAR(int g_qchar_cnt);
! 129: GLOBAL_VAR(int g_qsize);
! 130: GLOBAL_VAR(char *g_status_txt);
! 131: GLOBAL_VAR(int g_schar_cnt);
! 132: GLOBAL_VAR(int g_ssize);
! 133: GLOBAL_VAR(int g_run_mode);
! 134: GLOBAL_VAR(int g_start_question);
! 135: #define ALL_QUESTIONS -1
! 136: GLOBAL_VAR(int g_num_questions_per_page);
! 137: GLOBAL_VAR(int g_inhibit_response);
! 138: GLOBAL_VAR(char g_prog_name[FILE_NAME_LENGTH]);
! 139: GLOBAL_VAR(char g_class_fullpath[FILE_NAME_LENGTH]);
! 140: GLOBAL_VAR(FormEntry_t g_entries[MAX_ENTRIES] );
! 141: GLOBAL_VAR(char g_student_number[MAX_STUDENT_NUMBER+4]);
! 142: GLOBAL_VAR(char g_student_name[MAX_NAME_CHAR+1]);
! 143: GLOBAL_VAR(T_student g_student_data);
! 144: GLOBAL_VAR(char g_class_name[MAX_CLASS_CHAR]);
! 145: GLOBAL_VAR(char g_class_fullpath[FILE_NAME_LENGTH]);
! 146: GLOBAL_VAR(char *g_cpath);
! 147: GLOBAL_VAR(char *g_cowner);
! 148: GLOBAL_VAR(int g_entered_pin);
! 149: GLOBAL_VAR(int g_login_set);
! 150: GLOBAL_VAR(int g_set);
! 151: GLOBAL_VAR(int g_vset);
! 152: GLOBAL_VAR(StudentAnswer_t *g_stu_ans_pp[MAX_PROBLEM_CNT]);
! 153: GLOBAL_VAR(StudentAnswer_t *g_last_ans_pp[MAX_PROBLEM_CNT]);
! 154: /*GLOBAL_VAR(char *g_student_answer[MAX_PROBLEM_CNT]);
! 155: GLOBAL_VAR(char *g_last_answer[MAX_PROBLEM_CNT]);*/
! 156: GLOBAL_VAR(char g_new_answerdb[MAX_PROBLEM_CNT]);
! 157: GLOBAL_VAR(char g_log_string[MAX_PROBLEM_CNT]);
! 158: GLOBAL_VAR(int g_modified[MAX_PROBLEM_CNT]);
! 159: GLOBAL_VAR(int g_passdue);
! 160: GLOBAL_VAR(int g_tried[MAX_PROBLEM_CNT]);
! 161: GLOBAL_VAR(int g_smode);
! 162: GLOBAL_VAR(int g_skind);
! 163: GLOBAL_VAR(char g_cwd[FILE_NAME_LENGTH]);
! 164: #ifdef __alpha
! 165: GLOBAL_VAR(struct timespec g_ats);
! 166: GLOBAL_VAR(struct timespec g_bts);
! 167: #endif
! 168: GLOBAL_VAR(FILE *g_cgi);
! 169: GLOBAL_VAR(int g_exam_set);
! 170: GLOBAL_VAR(int g_quiz_set);
! 171: GLOBAL_VAR(char g_exam_path[FILE_NAME_LENGTH]);
! 172: GLOBAL_VAR(char g_quiz_path[FILE_NAME_LENGTH]);
! 173: GLOBAL_VAR(char *g_cgibin_path);
! 174: /* ======================================================================= */
! 175:
! 176:
! 177: #endif /* CAPA_CGI_H */
! 178:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>