Annotation of capa/capa51/pProj/capaCGI.h, revision 1.4
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)*/
1.4 ! albertel 44: #define STATUS_BUF_SIZE 1
1.1 albertel 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
1.2 albertel 80: #define DEFAULT_WIDTH 600 /* for score extrapolation applet*/
81: #define DEFAULT_HEIGHT 750 /* for score extrapolation applet*/
1.1 albertel 82: /* ============ function prototype in capaCgiUtils.c ===================== */
83:
84: void getword CAPA_ARG((char *word, char *line, char stop));
85: char *makeword CAPA_ARG((char *line, char stop));
86: char *fmakeword CAPA_ARG((FILE *f, char stop, int *cl));
87: char x2c CAPA_ARG((char *what));
88: void unescape_url CAPA_ARG((char *url));
89: void plustospace CAPA_ARG((char *str));
90: int rind CAPA_ARG((char *s, char c));
91: int getline CAPA_ARG((char *s, int n, FILE *f));
92: void send_fd CAPA_ARG((FILE *f, FILE *fd));
93: int ind CAPA_ARG((char *s, char c));
94: void escape_shell_cmd CAPA_ARG((char *cmd));
95:
96: int web_log CAPA_ARG((char *log_str));
97: /*
98: void file_log CAPA_ARG((char *filename, char *log_str));
99: */
100: int w_log_timing CAPA_ARG((char *student_number,int set,int section,char *log_string));
101: int w_log_attempt CAPA_ARG((char *student_number,int set,char *log_string));
102: int w_log_submissions CAPA_ARG((char *student_number,int set,char *log_string));
103: int w_get_input CAPA_ARG(());
104: void print_mainmenu CAPA_ARG((char *class,char *sn, int pin));
105: void print_page_header CAPA_ARG((int mode,int num_quest));
106: void print_quizz CAPA_ARG((char *class_dir, char *c_owner,char *class,char *sn,int pin,int set,int mode));
107: void print_response CAPA_ARG((char pcr,char u_db,int q_idx,Problem_t *p));
108: void print_inhibited_response CAPA_ARG((char pcr,char u_db,int q_idx,Problem_t *p));
109: void check_user_ans CAPA_ARG((int q_idx,Problem_t *p));
110: void check_inhibited_user_ans CAPA_ARG((int q_idx,Problem_t *p));
111: void get_response CAPA_ARG((char pcr,char u_db,int q_idx,Problem_t *p));
112: void log_user_ans CAPA_ARG((int q_idx,Problem_t *p));
113: int check_class_get_maxset CAPA_ARG((char *dir_path));
114: int check_exam_quiz_path CAPA_ARG(());
115: void print_summary CAPA_ARG((char *class_dir,char *class, char *student_number,int pin,int set));
116: void print_termscore_page CAPA_ARG((char *class_dir,char *class, char *student_number,int pin,int set,FILE *out));
1.3 albertel 117: void get_tscore_width_height CAPA_ARG((int *width,int *height));
1.1 albertel 118: int get_termscore_params CAPA_ARG((float *hw,float *qw,float *ew,float *fw,float *pw,int *hc,int *qc,int *fs));
119: int web_getclassdir CAPA_ARG((char **cpath_p, char **cown_p, char *class));
120: char *c_getpath CAPA_ARG((FILE *f));
121: void append_qtext CAPA_ARG((char *new_str));
122: void append_stext CAPA_ARG((char *new_str));
123: void process_mode CAPA_ARG((int mode));
124: void process_summary CAPA_ARG((int mode));
125: void web_printheader CAPA_ARG((FILE*));
126: void web_printfooter CAPA_ARG((FILE*));
127: void preserve_last_answer CAPA_ARG((int q_idx,int print));
128: /* ======================================================================= */
129: GLOBAL_VAR(char *g_question_txt);
130: GLOBAL_VAR(int g_qchar_cnt);
131: GLOBAL_VAR(int g_qsize);
132: GLOBAL_VAR(char *g_status_txt);
133: GLOBAL_VAR(int g_schar_cnt);
134: GLOBAL_VAR(int g_ssize);
135: GLOBAL_VAR(int g_run_mode);
136: GLOBAL_VAR(int g_start_question);
137: #define ALL_QUESTIONS -1
138: GLOBAL_VAR(int g_num_questions_per_page);
139: GLOBAL_VAR(int g_inhibit_response);
140: GLOBAL_VAR(char g_prog_name[FILE_NAME_LENGTH]);
141: GLOBAL_VAR(char g_class_fullpath[FILE_NAME_LENGTH]);
142: GLOBAL_VAR(FormEntry_t g_entries[MAX_ENTRIES] );
143: GLOBAL_VAR(char g_student_number[MAX_STUDENT_NUMBER+4]);
144: GLOBAL_VAR(char g_student_name[MAX_NAME_CHAR+1]);
145: GLOBAL_VAR(T_student g_student_data);
146: GLOBAL_VAR(char g_class_name[MAX_CLASS_CHAR]);
147: GLOBAL_VAR(char g_class_fullpath[FILE_NAME_LENGTH]);
148: GLOBAL_VAR(char *g_cpath);
149: GLOBAL_VAR(char *g_cowner);
150: GLOBAL_VAR(int g_entered_pin);
151: GLOBAL_VAR(int g_login_set);
152: GLOBAL_VAR(int g_set);
153: GLOBAL_VAR(int g_vset);
154: GLOBAL_VAR(StudentAnswer_t *g_stu_ans_pp[MAX_PROBLEM_CNT]);
155: GLOBAL_VAR(StudentAnswer_t *g_last_ans_pp[MAX_PROBLEM_CNT]);
156: /*GLOBAL_VAR(char *g_student_answer[MAX_PROBLEM_CNT]);
157: GLOBAL_VAR(char *g_last_answer[MAX_PROBLEM_CNT]);*/
158: GLOBAL_VAR(char g_new_answerdb[MAX_PROBLEM_CNT]);
159: GLOBAL_VAR(char g_log_string[MAX_PROBLEM_CNT]);
160: GLOBAL_VAR(int g_modified[MAX_PROBLEM_CNT]);
161: GLOBAL_VAR(int g_passdue);
162: GLOBAL_VAR(int g_tried[MAX_PROBLEM_CNT]);
163: GLOBAL_VAR(int g_smode);
164: GLOBAL_VAR(int g_skind);
165: GLOBAL_VAR(char g_cwd[FILE_NAME_LENGTH]);
166: #ifdef __alpha
167: GLOBAL_VAR(struct timespec g_ats);
168: GLOBAL_VAR(struct timespec g_bts);
169: #endif
170: GLOBAL_VAR(FILE *g_cgi);
171: GLOBAL_VAR(int g_exam_set);
172: GLOBAL_VAR(int g_quiz_set);
173: GLOBAL_VAR(char g_exam_path[FILE_NAME_LENGTH]);
174: GLOBAL_VAR(char g_quiz_path[FILE_NAME_LENGTH]);
175: GLOBAL_VAR(char *g_cgibin_path);
176: /* ======================================================================= */
177:
178:
179: #endif /* CAPA_CGI_H */
180:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>