File:  [LON-CAPA] / loncom / homework / CAPA-converter / convert.c
Revision 1.1: download - view: text, annotated - select for diffs
Wed Apr 12 20:08:39 2000 UTC (24 years ago) by albertel
Branches: MAIN
CVS tags: HEAD
- added last part of capa converter

/* ======================================================================== */
/*       Feb. 10 1997   Isaac Tsai                                          */
/* ======================================================================== */

#ifdef NeXT
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>  
#include <bsd/curses.h>
#else
#include <curses.h>
#include <malloc.h>
double atof();
#endif

#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>  
#include <signal.h>
#include <time.h>
#include <math.h>
#include <string.h>


#define   YES    1

#include "capaCommon.h"

char    *progname;


void
print_answer(FILE *o_fp,int ans_cnt,char *ans,char *lower,char *upper,char *unit)
{
  if (unit && (strlen(unit)>0)) 
    if(ans_cnt==2)  fprintf(o_fp,"ANS:%s %s %s %s\n",ans,lower,upper,unit); 
    else  fprintf(o_fp,"ANS:%s %s\n",lower,unit);
  else 
    if(ans_cnt==2)  fprintf(o_fp,"ANS:%s %s %s\n",ans,lower,upper); 
    else  fprintf(o_fp,"ANS:%s\n",lower);
}

void print_question (FILE *o_fp,char *question)
{
  fprintf(o_fp,"BQES:\n%s\nEQES:\n",question);
}

int main (int argc, char  **argv) 
{
  extern  int        Parsemode_f;
  extern  int        managermode;

  Problem_t  *first_prob,*p;
  int         q_cnt, num_answers, result, setIdx = 1, q_idx;
  char        lower[ANSWER_STRING_LENG], upper[ANSWER_STRING_LENG];
  int         StartSet = 1, EndSet = 1;
  char        tmp_str[ANSWER_STRING_LENG];
  double      tmp_ans;
  T_student   a_student;

  Parsemode_f=ASCII_MODE;
  if ( argc > 3 || argc < 2 ) {
    printf("USAGE: %s filename\n",
	   argv[0]);
    exit(-1);
  }
  
  result = capa_parse(setIdx, &first_prob, argv[1] ,&q_cnt,NULL);

  return (0);
}



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