--- loncom/homework/CAPA-converter/capaCommon.h 2001/11/15 21:42:42 1.5 +++ loncom/homework/CAPA-converter/capaCommon.h 2001/12/04 15:17:57 1.7 @@ -1,3 +1,29 @@ +/* The LearningOnline Network with CAPA + * Definitons of the convertor API + * $Id: capaCommon.h,v 1.7 2001/12/04 15:17:57 albertel Exp $ + * + * Copyright Michigan State University Board of Trustees + * + * This file is part of the LearningOnline Network with CAPA (LON-CAPA). + * + * LON-CAPA is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * LON-CAPA is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with LON-CAPA; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * /home/httpd/html/adm/gpl.txt + * + * http://www.lon-capa.org/ + */ /**********************************************************/ /* This header defines Application Interface to the */ @@ -139,15 +165,6 @@ typedef struct { #define leap_years_since_year_1(yr) ((yr) / 4 - centuries_since_1700(yr) + quad_centuries_since_1700(yr)) -int mode; -#define MODE_NONE 0 -#define MODE_COMMENT 1 -#define MODE_BLOCK 2 -#define MODE_SCRIPT 3 -#define MODE_OUTTEXT 4 -#define MODE_ANSWER 5 -#define MODE_HINT 6 - struct dyn_string { int len; int max; @@ -156,21 +173,57 @@ struct dyn_string { struct dyn_string dyn_out; struct dyn_string dyn_delayed; extern int dyn_maxlen; +extern char *import_prefix; + +#define MAX_CACHE 100 +#define CACHE_ERROR 100 +extern struct dyn_string cached_data[MAX_CACHE]; +extern int current_cache; +extern int do_cache[MAX_CACHE]; + +#define MAX_STREAMS 100 +#define ALL_STREAMS -1 +extern struct dyn_string streams[MAX_STREAMS]; +extern int num_streams; + +int mode[MAX_STREAMS]; +#define MODE_NONE 0 +#define MODE_COMMENT 1 +#define MODE_BLOCK 2 +#define MODE_SCRIPT 3 +#define MODE_OUTTEXT 4 +#define MODE_ANSWER 5 +#define MODE_HINT 6 +#define MODE_IMPORT 7 +/* end_mode always sets this to 0, if you want to check if any other + mode has been entered. Set this to 1 and check again if it has been + set back to zero. +*/ +extern int watch_mode[MAX_STREAMS]; /*=============================================================================*/ /* CAPA PROTOTYPES FOR FUNCTIONS IN COMMON.C */ /*=============================================================================*/ /*-----------------------------------------------------------------------------*/ -int capa_parse CAPA_ARG((int set,Problem_t **problem,char *filename,int *num_questions,void (*func_ptr)())); -void send CAPA_ARG((char* text,...)); -void end_mode CAPA_ARG((void)); -void start_mode CAPA_ARG((int newmode,char* args)); -void dyn_init(); -void dyn_free(); +int capa_parse(int set,Problem_t **problem,char *filename,int *num_questions,void (*func_ptr)()); +void send(char* text,...); +void end_mode(void); +void end_mode_stream(int which); +void start_mode(int newmode,char* args); +void start_mode_stream(int which,int newmode,char* args); +void dyn_init(struct dyn_string *dyn); +void dyn_free(struct dyn_string *dyn); int append_message(struct dyn_string *dyn_msg,char *format,va_list ap); void add_delayed(char *format, ...); void flush_delayed(); void start_delayed(); void end_delayed(); +void send_stream(int which,char* text,...); +void start_streams(int num); +void end_streams(int which); +void new_cache(); +void delete_cache(); +void start_cache(); +void stop_cache(); /*============================================================================*/ #endif /* CAPA_COMMON_H */