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

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

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