Annotation of capa/capa51/pProj/capaCGI.h, revision 1.8

1.5       albertel    1: /* define neccsary constants/contructs for CGI scripts
                      2:    Copyright (C) 1992-2000 Michigan State University
                      3: 
                      4:    The CAPA system is free software; you can redistribute it and/or
1.7       albertel    5:    modify it under the terms of the GNU General Public License as
1.5       albertel    6:    published by the Free Software Foundation; either version 2 of the
                      7:    License, or (at your option) any later version.
                      8: 
                      9:    The CAPA system is distributed in the hope that it will be useful,
                     10:    but WITHOUT ANY WARRANTY; without even the implied warranty of
                     11:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1.7       albertel   12:    General Public License for more details.
1.5       albertel   13: 
1.7       albertel   14:    You should have received a copy of the GNU General Public
1.5       albertel   15:    License along with the CAPA system; see the file COPYING.  If not,
                     16:    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1.6       albertel   17:    Boston, MA 02111-1307, USA.
                     18: 
                     19:    As a special exception, you have permission to link this program
                     20:    with the TtH/TtM library and distribute executables, as long as you
                     21:    follow the requirements of the GNU GPL in regard to all of the
                     22:    software in the executable aside from TtH/TtM.
                     23: */
1.1       albertel   24: 
                     25: /* ==================================================================== */
                     26: 
                     27: 
                     28: #ifndef   CAPA_CGI_H
                     29: #define   CAPA_CGI_H
                     30: 
                     31: #ifdef CAPA_ARG
                     32: #undef CAPA_ARG
                     33: #define CAPA_ARG(x)  x
                     34: #endif
                     35: 
                     36: /*
                     37:  #ifdef __STDC__
                     38:  #define CAPA_ARG(x)  x
                     39:  #else
                     40:  #define CAPA_ARG(x)  ()
                     41:  #endif
                     42: */
                     43: 
1.8     ! albertel   44: #if   defined(_MAIN_PROGRAM_) || defined(LONCAPA)
1.1       albertel   45: 
                     46: #define  GLOBAL_VAR(xx)   xx
                     47: #else 
                     48: #define  GLOBAL_VAR(xx)   extern  xx
                     49: #endif
                     50: 
                     51: 
                     52: #define   MAX_ENTRIES                 10000    /* maximal number of entries in a web page form */
                     53: #define   DEFAULT_STATUS_LINE_LENGTH  50
                     54: #define   MAX_PROBLEM_CNT             1024
                     55: #define   MAX_ANSWER_CHAR             32
                     56: #define   MAX_CLASS_CHAR              16       /* officially, it is 8, since the account name won't allow */
                     57:                                       /* more than 8 characters. */
                     58: 
                     59:                                      /* ----------------------------- various mode used in print_quizz() */
                     60: #define   TRY_SET_MODE        1
                     61: #define   CHECK_ANSWER_MODE   2
                     62: #define   VIEW_PREVIOUS_MODE  3
                     63: 
                     64: 
                     65: #define   TEXT_BUF_SIZE      1
                     66: /*(128*1024)*/
1.4       albertel   67: #define   STATUS_BUF_SIZE    1
1.1       albertel   68: /*(32*1024)*/
                     69: 
                     70: typedef struct _form_entry {
                     71:     char *name;
                     72:     char *val;
                     73: } FormEntry_t;
                     74: 
                     75: typedef struct _student_answer {
                     76:     int                       a_idx;
                     77:     char                     *a_str;
                     78:     struct _student_answer   *a_next;
                     79: } StudentAnswer_t;
                     80: 
                     81: #define     M_CHECKIN         1
                     82: #define     M_TRYSET          2
                     83: #define     M_CHECKANS        3
                     84: #define     M_VIEWPREV        4
                     85: #define     M_VIEWSUMM        5
                     86: #define     M_EXAMSUMM        6
                     87: #define     M_QUIZSUMM        7
                     88: #define     M_TERMSCORE       8
                     89: #define     LF                10
                     90: #define     CR                13
                     91: 
                     92: 
                     93: /* --------- default parameter values when something mis-specified in capa.config -------- */
                     94: 
                     95: #define     DEFAULT_HW_W          0.3
                     96: #define     DEFAULT_QZ_W          0.07
                     97: #define     DEFAULT_EX_W          0.3
                     98: #define     DEFAULT_FE_W          0.35
                     99: #define     DEFAULT_PC_W          0.3
                    100: #define     DEFAULT_HW_COUNT      12
                    101: #define     DEFAULT_QZ_COUNT      24
                    102: #define     DEFAULT_FE_NUMBER     4
1.2       albertel  103: #define     DEFAULT_WIDTH        600 /* for score extrapolation applet*/
                    104: #define     DEFAULT_HEIGHT       750 /* for score extrapolation applet*/
1.1       albertel  105: /* ============ function prototype in capaCgiUtils.c ===================== */
                    106: 
                    107: void        getword            CAPA_ARG((char *word, char *line, char stop));
                    108: char       *makeword           CAPA_ARG((char *line, char stop));
                    109: char       *fmakeword          CAPA_ARG((FILE *f, char stop, int *cl));
                    110: char        x2c                CAPA_ARG((char *what));
                    111: void        unescape_url       CAPA_ARG((char *url));
                    112: void        plustospace        CAPA_ARG((char *str));
                    113: int         rind               CAPA_ARG((char *s, char c));
                    114: int         getline            CAPA_ARG((char *s, int n, FILE *f));
                    115: void        send_fd            CAPA_ARG((FILE *f, FILE *fd));
                    116: int         ind                CAPA_ARG((char *s, char c));
                    117: void        escape_shell_cmd   CAPA_ARG((char *cmd));
                    118: 
                    119: int         web_log            CAPA_ARG((char *log_str));
                    120: /*
                    121: void        file_log           CAPA_ARG((char *filename, char *log_str));
                    122: */
                    123: int         w_log_timing       CAPA_ARG((char *student_number,int set,int section,char *log_string));
                    124: int         w_log_attempt      CAPA_ARG((char *student_number,int set,char *log_string));
                    125: int         w_log_submissions  CAPA_ARG((char *student_number,int set,char *log_string));
                    126: int         w_get_input        CAPA_ARG(());
                    127: void        print_mainmenu     CAPA_ARG((char *class,char *sn, int pin));
                    128: void        print_page_header  CAPA_ARG((int mode,int num_quest));
                    129: void        print_quizz        CAPA_ARG((char *class_dir, char *c_owner,char *class,char *sn,int pin,int set,int mode));
                    130: void        print_response     CAPA_ARG((char pcr,char u_db,int q_idx,Problem_t *p));
                    131: void        print_inhibited_response CAPA_ARG((char pcr,char u_db,int q_idx,Problem_t *p));
                    132: void        check_user_ans     CAPA_ARG((int q_idx,Problem_t *p));
                    133: void        check_inhibited_user_ans     CAPA_ARG((int q_idx,Problem_t *p));
                    134: void        get_response       CAPA_ARG((char pcr,char u_db,int q_idx,Problem_t *p));
                    135: void        log_user_ans       CAPA_ARG((int q_idx,Problem_t *p));
                    136: int         check_class_get_maxset CAPA_ARG((char  *dir_path));
                    137: int         check_exam_quiz_path CAPA_ARG(());
                    138: void        print_summary  CAPA_ARG((char *class_dir,char *class, char *student_number,int pin,int set)); 
                    139: void        print_termscore_page  CAPA_ARG((char *class_dir,char *class, char *student_number,int pin,int set,FILE *out)); 
1.3       albertel  140: void        get_tscore_width_height CAPA_ARG((int *width,int *height));
1.1       albertel  141: int         get_termscore_params CAPA_ARG((float *hw,float *qw,float *ew,float *fw,float *pw,int *hc,int *qc,int *fs));
                    142: int         web_getclassdir  CAPA_ARG((char **cpath_p, char **cown_p, char *class));
                    143: char       *c_getpath        CAPA_ARG((FILE *f));
                    144: void        append_qtext     CAPA_ARG((char *new_str));
                    145: void        append_stext     CAPA_ARG((char *new_str));
                    146: void        process_mode     CAPA_ARG((int  mode));
                    147: void        process_summary  CAPA_ARG((int mode));
                    148: void        web_printheader  CAPA_ARG((FILE*));
                    149: void        web_printfooter  CAPA_ARG((FILE*));
                    150: void        preserve_last_answer CAPA_ARG((int q_idx,int print));
                    151: /* ======================================================================= */
                    152: GLOBAL_VAR(char           *g_question_txt);
                    153: GLOBAL_VAR(int             g_qchar_cnt);
                    154: GLOBAL_VAR(int             g_qsize);
                    155: GLOBAL_VAR(char           *g_status_txt);
                    156: GLOBAL_VAR(int             g_schar_cnt);
                    157: GLOBAL_VAR(int             g_ssize);
                    158: GLOBAL_VAR(int             g_run_mode);
                    159: GLOBAL_VAR(int             g_start_question);
                    160: #define ALL_QUESTIONS -1
                    161: GLOBAL_VAR(int             g_num_questions_per_page);
                    162: GLOBAL_VAR(int             g_inhibit_response);
                    163: GLOBAL_VAR(char            g_prog_name[FILE_NAME_LENGTH]);
                    164: GLOBAL_VAR(char            g_class_fullpath[FILE_NAME_LENGTH]);
                    165: GLOBAL_VAR(FormEntry_t     g_entries[MAX_ENTRIES] );
                    166: GLOBAL_VAR(char            g_student_number[MAX_STUDENT_NUMBER+4]);
                    167: GLOBAL_VAR(char            g_student_name[MAX_NAME_CHAR+1]);
                    168: GLOBAL_VAR(T_student       g_student_data);
                    169: GLOBAL_VAR(char            g_class_name[MAX_CLASS_CHAR]);
                    170: GLOBAL_VAR(char            g_class_fullpath[FILE_NAME_LENGTH]);
                    171: GLOBAL_VAR(char           *g_cpath);
                    172: GLOBAL_VAR(char           *g_cowner);
                    173: GLOBAL_VAR(int             g_entered_pin);
                    174: GLOBAL_VAR(int             g_login_set);
                    175: GLOBAL_VAR(int             g_set);
                    176: GLOBAL_VAR(int             g_vset);
                    177: GLOBAL_VAR(StudentAnswer_t *g_stu_ans_pp[MAX_PROBLEM_CNT]);
                    178: GLOBAL_VAR(StudentAnswer_t *g_last_ans_pp[MAX_PROBLEM_CNT]);
                    179: /*GLOBAL_VAR(char           *g_student_answer[MAX_PROBLEM_CNT]);
                    180:   GLOBAL_VAR(char           *g_last_answer[MAX_PROBLEM_CNT]);*/
                    181: GLOBAL_VAR(char            g_new_answerdb[MAX_PROBLEM_CNT]);
                    182: GLOBAL_VAR(char            g_log_string[MAX_PROBLEM_CNT]);
                    183: GLOBAL_VAR(int             g_modified[MAX_PROBLEM_CNT]);
                    184: GLOBAL_VAR(int             g_passdue);
                    185: GLOBAL_VAR(int             g_tried[MAX_PROBLEM_CNT]);
                    186: GLOBAL_VAR(int             g_smode);
                    187: GLOBAL_VAR(int             g_skind);
                    188: GLOBAL_VAR(char            g_cwd[FILE_NAME_LENGTH]);
                    189: #ifdef __alpha 
                    190: GLOBAL_VAR(struct timespec g_ats);
                    191: GLOBAL_VAR(struct timespec g_bts);
                    192: #endif
                    193: GLOBAL_VAR(FILE           *g_cgi);
                    194: GLOBAL_VAR(int             g_exam_set);
                    195: GLOBAL_VAR(int             g_quiz_set);
                    196: GLOBAL_VAR(char            g_exam_path[FILE_NAME_LENGTH]);
                    197: GLOBAL_VAR(char            g_quiz_path[FILE_NAME_LENGTH]);
                    198: GLOBAL_VAR(char           *g_cgibin_path);
                    199: /* ======================================================================= */
                    200: 
                    201: 
                    202: #endif   /* CAPA_CGI_H */
                    203: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>