#define TTHREE #define BOOLEAN int #include "iteach3.h" void main(argc,argv) int argc; char **argv; /* The main program contains the error messages, compatible with the Mac version, and the tick value. Opens the specified file and displays the startup and copyright messages. Displays the ladder and begins the teach subroutine. Shuffling is disabled in this program, which teaches sentences in a specified order*/ { mess[0] = "Reading or writing file"; mess[1] = "Cannot allocate request"; mess[3] = "Cannot open the requested file"; mess[5] = "File corrupted or not a Macteach 1 data file "; mess[4] = "Close the open file first"; mess[8] = "Empty the error box first"; mess[9] = "Allot more message variables"; factor = 100; init(); /* Set up variables and time */ if (argc == 2) { /* If a file was specified, open it */ opendo(argc,argv); } screenclr(); gotoxy(6,14); puts ("MacTeach 1, Version 1.02: Forming Loglan Utterances"); gotoxy(8,12); puts ("Copyright(C) 1988,1989,1990 by the Loglan Institute, Inc."); gotoxy(9,30); puts ("All Rights Reserved"); gotoxy(11,19); puts ("Implemented in Aztec C by Robert A. McIvor"); gotoxy(12,23); puts ("from a design by James Cooke Brown"); gotoxy(14,31); puts ("Input prepared by:"); gotoxy(15,31); puts ("Evelyn R. Anderson"); gotoxy(16,31); puts ("James Cooke Brown"); gotoxy(17,31); puts ("Robert A. McIvor"); gotoxy(19,26); puts ("Press any key to continue."); scr_getc(); shufflag = 0; if (inpfile) display(); do_teach(argc,argv); /* Begin the teaching session */ } int ansmes() /* Erases the alternative lines and prints the answer message, and returns cursor to original location. Returns the character entered.*/ { int row,col; scr_loc(&row,&col); gotoxy(9,5); scr_eos(); gotoxy(18,5); puts("Press RETURN to see answer. "); gotoxy(row,col); screenchr(); } void blank(string,n) char *string; int n; /* On entry, contains a flag n, and a sentence 'string'. Each word is replaced by a blank, whose length depends on flag n. In the distribution version, n is always 1. At one time little words were distinguished from predicates, and 2 was used for this mode. Words joined by '-' are considered as separate words*/ { char *sptr; sptr = string; (n==1) ? printf ("%s ","_____") : printf ("%s ","__"); if (rrflag == '2') while (*sptr++) if (*sptr=='-') (n==1) ? printf ("%s ","_____") : printf ("%s ","__"); } void cleareol() /*clears screen to end of line. Was here in case we wanted to provide different functions for different terminals*/ { scr_eol(); } int promote(n,count) int n,count; /* On entry, n is the card number, and count is the number of elements in a test sentence. On a correct response, tell the user, advance the rung and count of right responses. If in error box, check for return to the ladder */ { int level; gotoxy (16,10); puts ("Correct!"); right += 1; curflag = rrflag - '1'+2; level = flasharray[n].flag[curflag]-'0'; if ( count != 1 && level < count && (curflag != 3 || level !=3 || styleflg !='3')) ++flasharray[n].flag[curflag]; else { curflag -= 2; if (flasharray[n].flag[curflag] != '4') flasharray[n].flag[curflag] += 1; if (flasharray[n].flag[curflag] == '5' + drillflg) flasharray[n].flag[curflag] = '1'; } } int showans(n,ID) int n,ID; /* Display the filled in sentence. On entry n is the card number, and ID is used to distinguish tests from review, as the message differs, and also whether correction is permitted. */ { int row; if (rrflag=='1') { row = 7; showeng(n,1); gotoxy(7,5); } else { row = 5; showlog(n,1); gotoxy(5,5); } gotoxy(18,5); printf("Press return to continue, X or Q to end %s.\n", ID ? "review" : "test"); if (!ID) puts(" Press C to cancel error-boxing from an inadvertent typing error."); gotoxy(row,5); return screenchr(); } void showcom(num) int num; /* MT1 has a set of grammatical comments inserted at various places among the test sentences. This routine displays comment num */ { int ch; screenclr(); fseek (cmt,compos[num],0); /* Locate the comment*/ while (getc(cmt) != '}'); while ((ch=getc(cmt)) > 0 && ch != '{') putchar(ch); } void showeng(n,m) int n,m; /* Show the English sentence. On entry n is the card number to display and m is a flag indicating whether the English alternatives, if present, should be displayed (1) or not (0)*/ { char *start; gotoxy(7,5); cleareol(); /*Display test sentence without punctuation flags*/ mainsent(instring,flasharray[n].engsent); mywrite(instring); if (!m) return; /*Finished if no alternatives present*/ /*cflag is one if alternatives are present. Prepare the complete sentence with alternatives*/ if (cflag==1) { gotoxy(9,5); mywrite(flasharray[n].engsent); } /*cflag is 2 if no alternatives are present, but a comment is present. Prepare the comment only for display. */ else if (cflag==2) { gotoxy(9,5); start = flasharray[n].engsent; while (*start && *start != '|') ++start; mywrite(start); } } int showline(count,level,ll) int count,level,ll; /* Show a test line. On entry count is the number of words in the test sentence, level is the current test word index and ll is a back to front presentation index. The value level is returned. */ { int i,k,l,m; char mystr[150]; l = 0; for (k=0; k\n"); gotoxy (14,10); if (dotime() < 0) { SysBeep(); ++tmouts; demote(n); statdo(ticks); } else gets(instring); if (ticks < threshld) { statdo(ticks); /*update the statistics*/ marktest(n,count,level,ll); } return showans(n,ID); } else { for (level=0; level2) break; } return NEXTF; } } #include "t3common.c" #include "ticommon.c" #include "tcommon.c"