xabacus-8.1.6/0000755000175000017500000000000013237625422013274 5ustar demarchidemarchixabacus-8.1.6/AbacusE.c0000644000175000017500000004003013167010344014731 0ustar demarchidemarchi/* * @(#)AbacusE.c * * Copyright 2017 David A. Bagley, bagleyd AT verizon.net * * Abacus examples * All rights reserved. * * Permission to use, copy, modify, and distribute this software and * its documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear in * supporting documentation, and that the name of the author not be * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. * * This program 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. */ /* Method to handle the examples for Abacus */ /** * Much help from: Dodji Seketeli * http://www.xmlsoft.org/examples/tree1.c */ #include "AbacusP.h" static Boolean debug = False; unsigned int codeMaxCount = 0; /*4*/ unsigned int moveMaxCount = 0; /*41*/ unsigned int lessonMaxCount = 0; /*7*/ unsigned int chapterMaxCount = 0; /*7*/ unsigned int editionMaxCount = 0; /*4*/ unsigned int bookMaxCount = 0; /*3*/ static void freeMove(struct moveType *moveAbacus) { unsigned int i; if (moveAbacus == NULL) return; if (moveAbacus->code != NULL) { free(moveAbacus->code); moveAbacus->code = NULL; } if (moveAbacus->lineText != NULL) { for (i = 0; i < codeMaxCount; i++) { if (moveAbacus->lineText[i] != NULL) free(moveAbacus->lineText[i]); } free(moveAbacus->lineText); moveAbacus->lineText = NULL; } } static void freeLesson(struct lessonType *lessonAbacus) { unsigned int move; if (lessonAbacus == NULL) return; if (lessonAbacus->move != NULL) { for (move = 0; move < moveMaxCount; move++) { freeMove(&lessonAbacus->move[move]); } free(lessonAbacus->move); lessonAbacus->move = NULL; } if (lessonAbacus->name != NULL) { free(lessonAbacus->name); lessonAbacus->name = NULL; } if (debug) { (void) printf("\t\t\t\tlesson free %d/%d moves\n", lessonAbacus->moves, moveMaxCount); } lessonAbacus->moves = 0; } static void freeChapter(struct chapterType *chapterAbacus) { unsigned int lesson; if (chapterAbacus == NULL) return; if (chapterAbacus->lesson != NULL) { for (lesson = 0; lesson < lessonMaxCount; lesson++) { freeLesson(&chapterAbacus->lesson[lesson]); } free(chapterAbacus->lesson); chapterAbacus->lesson = NULL; } if (chapterAbacus->name != NULL) { free(chapterAbacus->name); chapterAbacus->name = NULL; } if (debug) { (void) printf("\t\t\tchapter free %d/%d lessons\n", chapterAbacus->lessons, lessonMaxCount); } chapterAbacus->lessons = 0; } static void freeEdition(struct editionType *editionAbacus) { unsigned int chapter; if (editionAbacus == NULL) return; if (editionAbacus->chapter != NULL) { for (chapter = 0; chapter < chapterMaxCount; chapter++) { freeChapter(&editionAbacus->chapter[chapter]); } free(editionAbacus->chapter); editionAbacus->chapter = NULL; } if (editionAbacus->version != NULL) { free(editionAbacus->version); editionAbacus->version = NULL; } if (debug) { (void) printf("\t\tedition free %d/%d chapters\n", editionAbacus->chapters, chapterMaxCount); } editionAbacus->chapters = 0; } static void freeBook(struct bookType *bookAbacus) { unsigned int edition; if (bookAbacus == NULL) return; if (bookAbacus->edition != NULL) { for (edition = 0; edition < editionMaxCount; edition++) { freeEdition(&bookAbacus->edition[edition]); } free(bookAbacus->edition); bookAbacus->edition = NULL; } if (bookAbacus->name != NULL) { free(bookAbacus->name); bookAbacus->name = NULL; } if (bookAbacus->author != NULL) { free(bookAbacus->author); bookAbacus->author = NULL; } if (debug) { (void) printf("\tbook free %d/%d editions\n", bookAbacus->editions, editionMaxCount); } bookAbacus->editions = 0; } void freeAbacus(struct bookType *bookAbacus, int books) { int book; if (bookAbacus == NULL) return; for (book = 0; book < books; book++) { freeBook(&bookAbacus[book]); } free(bookAbacus); bookAbacus = NULL; if (debug) { (void) printf("abacus free %d/%d books\n", books, bookMaxCount); } } /* This can probably be fixed to use libxml2 Windows port */ /* https://www.zlatkovic.com/libxml.en.html */ #ifdef HAVE_LIBXML2 #include #include #endif #ifdef LIBXML_TREE_ENABLED xmlDoc *doc = NULL; /* From AndiDog https://stackoverflow.com/questions/2450704/writing-string-trim-in-c */ static void trim(char *str) { char *ptr = str; while (*ptr == ' ' || *ptr == '\t' || *ptr == '\r' || *ptr == '\n') ++ptr; char *end = ptr; while (*end) ++end; if (end > ptr) { for (--end; end >= ptr && (*end == ' ' || *end == '\t' || *end == '\r' || *end == '\n'); --end); } memmove(str, ptr, (size_t) (end - ptr + 1)); if (((unsigned int) (end - ptr + 1)) < strlen(str)) str[end - ptr + 1] = '\0'; } /* Alexey Frunze https://stackoverflow.com/questions/8512958/is-there-a-windows-variant-of-strsep */ static char * str_sep(char **stringp, const char *delim) { char* start = *stringp; char* p; p = (start != NULL) ? strpbrk(start, delim) : NULL; if (p == NULL) { *stringp = NULL; } else { *p = '\0'; *stringp = p + 1; } return start; } /* From Costya Perepelitsa https://www.quora.com/How-do-you-write-a-C-program-to-split-a-string-by-a-delimiter */ static char ** strsplit(const char* str, const char* delim, size_t* numtokens) { char *s = strdup(str); size_t tokens_alloc = 1; size_t tokens_used = 0; char **tokens = calloc(tokens_alloc, sizeof(char*)); char *token, *rest = s; while ((token = str_sep(&rest, delim)) != NULL) { if (tokens_used == tokens_alloc) { tokens_alloc *= 2; tokens = realloc(tokens, tokens_alloc * sizeof(char*)); } tokens[tokens_used++] = strdup(token); } if (tokens_used == 0) { free(tokens); tokens = NULL; } else { tokens = realloc(tokens, tokens_used * sizeof(char*)); } *numtokens = tokens_used; free(s); return tokens; } static void codeCount(xmlNode *topNode) { xmlNode *node = NULL; int term = 0; for (node = topNode->children; node; node = node->next) { if (node->type == XML_ELEMENT_NODE) { if (term == 1) { xmlChar *value = xmlNodeListGetString(doc, node->xmlChildrenNode, 1); char *tmp = (char *) malloc(sizeof(char) * strlen((char *) value) + 1); (void) strcpy(tmp, (char *) value); xmlFree(value); trim(tmp); char *tmp2 = tmp; int i; for (i = 0; tmp[i]; (tmp[i] == '\n') ? i++ : *tmp++); free(tmp2); if (codeMaxCount < (unsigned int) i) { codeMaxCount = (unsigned int) i + 1; } if (debug && codeMaxCount != 4) (void) printf("codeCount: max %d\n", codeMaxCount); } term++; } } } static void moveCount(xmlNode *topNode) { xmlNode *node; unsigned int move = 0; for (node = topNode->children; node; node = node->next) { if (node->type == XML_ELEMENT_NODE) { codeCount(node); move++; } } if (moveMaxCount < move) { moveMaxCount = move; } } static void lessonCount(xmlNode *topNode) { xmlNode *node; unsigned int lesson = 0; for (node = topNode->children; node; node = node->next) { if (node->type == XML_ELEMENT_NODE) { moveCount(node); lesson++; } } if (lessonMaxCount < lesson) { lessonMaxCount = lesson; } } static void chapterCount(xmlNode *topNode) { xmlNode *node; unsigned int chapter = 0; for (node = topNode->children; node; node = node->next) { if (node->type == XML_ELEMENT_NODE) { lessonCount(node); chapter++; } } if (chapterMaxCount < chapter) { chapterMaxCount = chapter; } } static void editionCount(xmlNode *topNode) { xmlNode *node; unsigned int edition = 0; for (node = topNode->children; node; node = node->next) { if (node->type == XML_ELEMENT_NODE) { chapterCount(node); edition++; } } if (editionMaxCount < edition) { editionMaxCount = edition; } } static void bookCount(xmlNode *topNode) { xmlNode *node; unsigned int book = 0; for (node = topNode->children; node; node = node->next) { if (node->type == XML_ELEMENT_NODE) { editionCount(node); book++; } } if (bookMaxCount < book) { bookMaxCount = book; } } static void readMove(xmlNode *topNode, struct moveType *moveAbacus) { xmlNode *node; char *tmp; if (debug) { (void) printf("\t\t\t\t\t%s\n", topNode->name); } moveAbacus->code = NULL; moveAbacus->lineText = NULL; moveAbacus->lines = 0; node = topNode->children; for (node = topNode->children; node && moveAbacus->lineText == NULL; node = node->next) { if (node->type == XML_ELEMENT_NODE) { xmlChar *value = xmlNodeListGetString(doc, node->xmlChildrenNode, 1); tmp = (char *) malloc(sizeof(char) * strlen((char *) value) + 1); (void) strcpy(tmp, (char *) value); xmlFree(value); if (debug) { (void) printf("\t\t\t\t\t%s\n", node->name); (void) printf("value: %s\n", tmp); } if (moveAbacus->code == NULL) { moveAbacus->code = tmp; } else { unsigned int i; size_t lines; trim(tmp); char **text = strsplit(tmp, "\n", &lines); if (lines > codeMaxCount) { codeMaxCount = lines; } if (debug && codeMaxCount != 4) (void) printf("readMove: max %d\n", codeMaxCount); moveAbacus->lineText = (char **) calloc(lines, sizeof(char *)); for (i = 0; i < lines; i++) { trim(text[i]); moveAbacus->lineText[i] = (char *) malloc(sizeof(char) * strlen((char *) text[i]) + 1); (void) strcpy(moveAbacus->lineText[i], text[i]); free(text[i]); } free(tmp); free(text); moveAbacus->lines = lines; } } } if (moveAbacus->lineText == NULL && moveAbacus->code != NULL) { free(moveAbacus->code); moveAbacus->code = NULL; } } static void readLesson(xmlNode *topNode, struct lessonType *lessonAbacus) { xmlNode *node; unsigned int move = 0; xmlChar *name = xmlGetProp(topNode, (const xmlChar *) "name"); if (debug) { (void) printf("\t\t\t\t%s\n", topNode->name); (void) printf("\t\t\t\t name: %s\n", name); } lessonAbacus->name = (char *) malloc(sizeof(char) * strlen((char *) name) + 1); (void) strcpy(lessonAbacus->name, (char *) name); xmlFree(name); if (moveMaxCount > 0) { lessonAbacus->move = (struct moveType *) calloc(moveMaxCount, sizeof(struct moveType)); } else { lessonAbacus->move = NULL; } for (node = topNode->children; node && move < moveMaxCount; node = node->next) { if (node->type == XML_ELEMENT_NODE) { if (debug) { (void) printf("\t\t\t\t\t%d\n", move); } readMove(node, &lessonAbacus->move[move]); move++; } } lessonAbacus->moves = move; } static void readChapter(xmlNode *topNode, struct chapterType *chapterAbacus) { xmlNode *node; unsigned int lesson = 0; xmlChar *name = xmlGetProp(topNode, (const xmlChar *) "name"); if (debug) { (void) printf("\t\t\t%s\n", topNode->name); (void) printf("\t\t\t name: %s\n", name); } chapterAbacus->name = (char *) malloc(sizeof(char) * strlen((char *) name) + 1); (void) strcpy(chapterAbacus->name, (char *) name); xmlFree(name); if (lessonMaxCount > 0) { chapterAbacus->lesson = (struct lessonType *) calloc(lessonMaxCount, sizeof(struct lessonType)); } else { chapterAbacus->lesson = NULL; } for (node = topNode->children; node && lesson < lessonMaxCount; node = node->next) { if (node->type == XML_ELEMENT_NODE) { if (debug) { (void) printf("\t\t\t\t%d\n", lesson); } readLesson(node, &chapterAbacus->lesson[lesson]); lesson++; } } chapterAbacus->lessons = lesson; } static void readEdition(xmlNode *topNode, struct editionType *editionAbacus) { xmlNode *node; unsigned int chapter = 0; xmlChar *version = xmlGetProp(topNode, (const xmlChar *) "version"); if (debug) { (void) printf("\t\t%s\n", topNode->name); (void) printf("\t\t version: %s\n", version); } editionAbacus->version = (char *) malloc(sizeof(char) * strlen((char *) version) + 1); (void) strcpy(editionAbacus->version, (char *) version); xmlFree(version); if (chapterMaxCount > 0) { editionAbacus->chapter = (struct chapterType *) calloc(chapterMaxCount, sizeof(struct chapterType)); } else { editionAbacus->chapter = NULL; } for (node = topNode->children; node && chapter < chapterMaxCount; node = node->next) { if (node->type == XML_ELEMENT_NODE) { if (debug) { (void) printf("\t\t\t%d\n", chapter); } readChapter(node, &editionAbacus->chapter[chapter]); chapter++; } } editionAbacus->chapters = chapter; } static void readBook(xmlNode *topNode, struct bookType *bookAbacus) { xmlNode *node; unsigned int edition = 0; xmlChar *name = xmlGetProp(topNode, (const xmlChar *) "name"); xmlChar *author = xmlGetProp(topNode, (const xmlChar *) "author"); if (debug) { (void) printf("\t%s\n", topNode->name); (void) printf("\t name: %s\n", name); (void) printf("\t author: %s\n", author); } bookAbacus->name = (char *) malloc(sizeof(char) * strlen((char *) name) + 1); (void) strcpy(bookAbacus->name, (char *) name); bookAbacus->author = (char *) malloc(sizeof(char) * strlen((char *) author) + 1); (void) strcpy(bookAbacus->author, (char *) author); xmlFree(name); xmlFree(author); if (editionMaxCount > 0) { bookAbacus->edition = (struct editionType *) calloc(editionMaxCount, sizeof(struct editionType)); } else { bookAbacus->edition = NULL; } for (node = topNode->children; node && edition < editionMaxCount; node = node->next) { if (node->type == XML_ELEMENT_NODE) { if (debug) { (void) printf("\t\t%d\n", edition); } readEdition(node, &bookAbacus->edition[edition]); edition++; } } bookAbacus->editions = edition; } static void readAbacus(xmlNode *topNode, struct libraryType *libraryAbacus) { xmlNode *node; unsigned int book = 0; if (bookMaxCount > 0) { libraryAbacus->book = (struct bookType *) calloc(bookMaxCount, sizeof(struct bookType)); } else { libraryAbacus->book = NULL; } for (node = topNode->children; node && book < bookMaxCount; node = node->next) { if (node->type == XML_ELEMENT_NODE) { if (debug) { (void) printf("\t%d\n", book); } readBook(node, &libraryAbacus->book[book]); book++; } } libraryAbacus->books = book; } static void setLibrary(xmlDoc *document) { /* Get the root element node */ xmlNode *topNode = xmlDocGetRootElement(document); xmlNode *node; for (node = topNode; node; node = node->next) { if (node->type == XML_ELEMENT_NODE) { bookCount(node); } } if (debug) { (void) printf("%d %d %d %d %d %d\n", codeMaxCount, moveMaxCount, lessonMaxCount, chapterMaxCount, editionMaxCount, bookMaxCount); } for (node = topNode; node; node = node->next) { if (node->type == XML_ELEMENT_NODE) { if (debug) { printf("%s\n", node->name); } readAbacus(node, &abacusLibrary); } } /* Free the document */ xmlFreeDoc(document); /* * Free the global variables that may * have been allocated by the parser. */ xmlCleanupParser(); } static xmlDoc * getDoc(const char *fileName) { doc = xmlReadFile(fileName, NULL, 0); if (doc == NULL) { (void) fprintf(stderr, "Could not parse file %s\n", fileName); } return doc; } void readParseFile(const char *fileName) { /* treating as a singleton */ if (abacusLibrary.book != NULL) return; doc = getDoc(fileName); if (doc != NULL) setLibrary(doc); } /** * Simple example to parse a file called "file.xml", * walk down the DOM, and print the name of the * xml elements nodes. */ #if 0 char * xmlFile = XML_FILE; int emain(int argc, char **argv) { if (argc >= 2) { xmlFile = argv[1]; } /* * This initialize the library and check potential ABI mismatches * between the version it was compiled for and the actual shared * library used. */ LIBXML_TEST_VERSION readParseFile(XML_FILE); return 0; } #endif #else #ifndef WINVER static int displayedError = 0; #endif void readParseFile(const char * fileName) { #ifndef WINVER if (displayedError == 0) { (void) fprintf(stderr, "XML tree support not compiled in.\n"); displayedError = 1; } #endif } #if 0 int emain(void) { (void) fprintf(stderr, "XML tree support not compiled in.\n"); exit(1); } #endif #endif xabacus-8.1.6/timer.h0000644000175000017500000000271213162206453014563 0ustar demarchidemarchi/* * @(#)timer.h * * Copyright 2005 - 2017 David A. Bagley, bagleyd AT verizon.net * * All rights reserved. * * Permission to use, copy, modify, and distribute this software and * its documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear in * supporting documentation, and that the name of the author not be * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. * * This program 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. */ /* Header file for timer */ #ifndef _timer_h #define _timer_h #ifdef WINVER #include #include #if ((WINVER > 0x030a) && !defined(GCL_HBRBACKGROUND) && !defined(GCLP_HBRBACKGROUND)) #undef WINVER #define WINVER 0x030a #endif #if (WINVER <= 0x030a) /* if WINDOWS 3.1 or less */ extern void Sleep(unsigned long cMilliseconds); #endif #define TimeVal long #define initTimer(v) v = (long) GetTickCount() #else #include #ifndef TimeVal #define TimeVal struct timeval #endif #define initTimer(v) (void) X_GETTIMEOFDAY(&(v)); extern void Sleep(unsigned int cMilliseconds); #endif extern void useTimer(TimeVal * oldTime, int delay); #endif /* _timer_h */ xabacus-8.1.6/xabacus.c0000644000175000017500000045034213203671640015072 0ustar demarchidemarchi/* * @(#)xabacus.c * * Copyright 1993 - 2017 David A. Bagley, bagleyd AT verizon.net * * Abacus demo and neat pointers from * Copyright 1991 - 1998 Luis Fernandes, elf AT ee.ryerson.ca * * All rights reserved. * * Permission to use, copy, modify, and distribute this software and * its documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear in * supporting documentation, and that the name of the author not be * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. * * This program 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. */ /* Driver file for Abacus */ #ifndef WINVER #include "version.h" static const char * aboutHelp = { "Abacus Version " VERSION "\n" "Send bugs (reports or fixes) to the author: " "David Bagley \n" "The latest version is at: " "http://www.sillycycle.com/abacus.html\n" "Some coding was also done by Luis Fernandes \n" "and Sarat Chandran " }; static const char * synopsisHelp = { "[-geometry [{width}][x{height}] [{+-}{xoff}[{+-}{yoff}]]]\n" "[-display [{host}]:[{vs}]] [-[no]mono] [-[no]{reverse|rv}]\n" "[-{foreground|fg} {color}] [-{background|bg} {color}]\n" "[-{border|bd} {color}] [-frame {color}]\n" "[-primaryBeadColor {color}] [-leftAuxBeadColor {color}]\n" "[-rightAuxBeadColor {color}] [-secondaryBeadColor {color}]\n" "[-highlightBeadColor {color}]\n" "[-primaryRailColor {color}] [-secondaryRailColor {color}]\n" "[-highlightRailColor {color}] [-lineRailColor {color}]\n" "[-bumpSound {filename}] [-moveSound {filename}]\n" "[-[no]sound] [-delay msecs] [-[no]script] [-[no]demo]\n" "[-demopath {path}] [-{demofont|demofn} {fontname}]\n" "[-{demoforeground|demofg} {color}]\n" "[-[no]teach] [-[no]rightToLeftAdd] [-[no]rightToLeftMult]\n" "[-[no]lee] [-rails {int}] [-leftAuxRails {int}]\n" "[-rightAuxRails {int}] [-[no]vertical]\n" "[-colorScheme {int}] [-[no]slot] [-[no]diamond]\n" "[-railIndex {int}] [-[no]topOrient] [-[no]bottomOrient]\n" "[-topNumber {int}] [-bottomNumber {int}] [-topFactor {int}]\n" "[-bottomFactor {int}] [-topSpaces {int}] [-bottomSpaces {int}]\n" "[-topPiece {int}] [-bottomPiece {int}] [-topPiecePercent {int}]\n" "[-bottomPiecePercent {int}] [-shiftPercent {int}]\n" "[-subdeck {int}] [-subbead {int}] [-[no]sign]\n" "[-decimalPosition {int}] [-[no]group] [-groupSize {int}]\n" "[-[no]decimalComma] [-base {int}] [-[no]eighth]\n" "[-anomaly {int}] [-shiftAnomaly {int}] [-anomalySq {int}]\n" "[-shiftAnomalySq {int}] [-displayBase {int}]\n" "[-[no]pressOffset] [-[no]romanNumerals]\n" "[-[no]latin] [-[no]ancientRoman] [-[no]modernRoman]\n" "[-{chinese|japanese|korean|russian|danish|roman|medieval|generic}]\n" "[-{it|uk|fr}] [-version]" }; #endif #ifdef HAVE_MOTIF static const char options1Help[] = { "-geometry {+|-}X{+|-}Y " "This option sets the initial position of the abacus " "window (resource name \"geometry\").\n" "-display host:dpy " "This option specifies the X server to contact.\n" "-[no]mono " "This option allows you to display the abacus window " "on a color screen as if it were monochrome\n" " (resource name \"mono\").\n" "-[no]{reverse|rv} " "This option allows you to see the abacus window in " "reverse video (resource name\n" " \"reverseVideo\").\n" "-{foreground|fg} color " "This option specifies the foreground of the abacus " "window (resource name \"foreground\").\n" "-{background|bg} color " "This option specifies the background of the abacus " "window (resource name \"background\").\n" "-{border|bd} color " "This option specifies the foreground of the border " "of the beads (resource name \"borderColor\").\n" "-frame color " "This option specifies the foreground of the frame " "(resource name \"frameColor\").\n" "-primaryBeadColor color " "This option specifies the foreground of the beads " "(resource name \"primaryBeadColor\").\n" "-leftAuxBeadColor color " "This option specifies the foreground of the beads " "for the left auxiliary abacus in\n" " Lee's Abacus (resource name \"leftAuxBeadColor\").\n" "-rightAuxBeadColor color " "This option specifies the foreground of the beads " "for the right auxiliary abacus in\n" " Lee's Abacus (resource name \"rightAuxBeadColor\").\n" "-secondaryBeadColor color " "This option specifies the secondary color of the beads " "(resource name\n" " \"secondaryBeadColor\").\n" "-highlightBeadColor color " "This option specifies the highlight color of the beads " "(resource name\n" " \"highlightBeadColor\").\n" "-primaryRailColor color " "This option specifies the foreground of the rails " "(resource name \"primaryRailColor\").\n" "-secondaryRailColor color " "This option specifies the secondary color of the rails " "(resource name\n" " \"secondaryRailColor\").\n" "-highlightRailColor color " "This option specifies the highlight color of the rails " "(resource name \"highlightRailColor\").\n" "-lineRailColor color " "This option specifies the color of the lines when using " "checkers (resource name \"lineRailColor\").\n" "-bumpSound filename " "This option specifies the file for the bump sound " "for the movement of the beads.\n" "-moveSound filename " "This option specifies the file for the move sound " "for the sliding of the decimal point marker.\n" "-[no]sound " "This option specifies if a sliding bead should " "make a sound or not (resource name \"sound\").\n" "-delay msecs " "This option specifies the number of milliseconds it " "takes to move a bead or a group of beads\n" " one space (resource name \"delay\").\n" "-[no]script " "This option specifies to log application to stdout, " "every time the user clicks to move the\n" " beads (resource name \"script\"). The output is a set " "of deck, rail, beads added or subtracted, and\n" " the number of text lines (4). This can be edited to add " "text to the lesson and used as a new demo keeping\n" " the generated numbers and the number of lines constant." " (Windows version writes to abacus.xml).\n" "-[no]demo " "This option specifies to run in demo mode. In this " "mode, the abacus is controlled by the current\n" " lesson (resource name \"demo\"). When started with " "the demo option, a window contains descriptive text,\n" " and user prompts are displayed in this window. Pressing " "'q' during the demo will quit it. Clicking the\n" " left mouse-button with the pointer in the window " "will restart the demo (beginning of current lesson).\n" " The demo uses abacusDemo.xml and currently there are " "4 editions possible ((Chinese, Japanese (and\n" " Roman), Korean, and Russian (and Danish))." }; static const char options2Help[] = { "-demopath path " "This option specifies the path for the demo, possibly " "/usr/local/share/games/xabacus (resource\n" " name \"demoPath\"), with the file name of " "abacusDemo.xml.\n" "-{demofont|demofn} fontstring " "This option specifies the font for the " "explanatory text that appears in the\n" " secondary window, during the demo. The default font is " "18 point Times-Roman (-*-times-*-r-*-*-*-180-*).\n" " The alternate font is 8x13 (resource name \"demoFont\").\n" "-{demoforeground|demofg} color " "This option specifies the foreground of the abacus " "demo window (resource name\n" " \"demoForeground\").\n" "-{demobackground|demobg} color " "This option specifies the background of the abacus " "demo window (resource\n" " name \"demoBackground\").\n" "-[no]teach " "This option specifies to run in teach mode. In " "this mode, the abacus is controlled by 2 numbers\n" " separated by an operator: \"+\" for addition, " "\"-\" for subtraction, \"*\" for multiplication, and \"/\" for\n" " division. The square root operation is represented " "by the number to be operated on followed by the\n" " character \"v\" (this leaves you with an answer " "from which you must divide by 2). Similarly, the cube root\n" " operation is represented by the number to be operated " "on followed by the character \"u\" (this leaves you with\n" " an answer which from which you must divide by 3). " "Press return key to progress through the steps\n" " (resource name \"teach\").\n" "-[no]rightToLeftAdd " "This option specifies the order for teach starting " "side for addition and subtraction. The\n" " default is the traditional left to right. " "Right to left seems easier though (resource name \"rightToLeftAdd\").\n" "-[no]rightToLeftMult " "This option specifies the order for teach starting " "side for multiplication. The default is\n" " the traditional left to right. Right to left " "seems more straight forward (resource name \"rightToLeftMult\").\n" "-[no]lee " "This option allows you to turn on and off the two extra " "auxiliary abaci (resource name \"lee\").\n" "-rails int " "This option specifies the number of rails (resource " "name \"rails\").\n" "-leftAuxRails int " "This option allows you to set the number of the " "rails for the left auxiliary abacus in Lee's Abacus\n" " (resource name \"leftAuxRails\").\n" "-rightAuxRails int " "This option allows you to set the number of the " "rails for the right auxiliary abacus in Lee's\n" " Abacus (resource name \"rightAuxRails\").\n" "-[no]vertical " "This option allows you to have vertical rails " "(resource name \"vertical\").\n" "-colorScheme int " "This option specifies the color scheme for the " "abacus (resource name \"colorScheme\") where\n" " 0-> none, 1-> color middle (2 beads beads but if odd " "color 1 bead), 2-> color first of group, 3-> both 1 and\n" " 2, 4-> color first half (but if odd color middle " "bead).\n" "-[no]slot " "This option allows you to have either slots or rails " "(resource name \"slot\").\n" "-[no]diamond " "This option allows you to have diamond or round beads " "(resource name \"diamond\").\n" "-railIndex int " "This option specifies the index of color for the " "rails of the abacus (resource name \"railIndex\")\n" " where a value is 0 or 1." }; static const char options3Help[] = { "-[no]topOrient " "This option specifies the orientation of the beads " "on top (resource name \"topOrient\").\n" "-[no]bottomOrient " "This option specifies the orientation of the beads " "on bottom (resource name \"bottomOrient\").\n" "-topNumber int " "This option specifies the number of beads on top " "(resource name \"topNumber\").\n" "-bottomNumber int " "This option specifies the number of beads on bottom " "(resource name \"bottomNumber\").\n" "-topFactor int " "This option specifies the multiply factor for the " "beads on top (resource name \"topFactor\").\n" "-bottomFactor int " "This option specifies the multiply factor for the " "beads on bottom (resource name\n" " \"bottomFactor\").\n" "-topSpaces int " "This option specifies the number of spaces on top " "(resource name \"topSpaces\").\n" "-bottomSpaces int " "This option specifies the number of spaces on bottom " "(resource name \"bottomSpaces\").\n" "-topPiece int " "This option specifies the number of pieces on top " "(resource name \"topPiece\").\n" "-bottomPiece int " "This option specifies the number of pieces on bottom " "(resource name \"bottomPiece\").\n" "-topPiecePercent int " "This option specifies the number of piece percents on top " "(resource name\n" " \"topPiecePercent\").\n" "-bottomPiecePercent int " "This option specifies the number of piece percents on bottom " "(resource name\n" " \"bottomPiecePercent\").\n" "-shiftPercent int " "This option specifies the shift of rails for piece percents " "and also may influence the\n" " precision of the calculation (resource name " "\"shiftPercent\").\n" "-subdeck int " "This option specifies the special subdecks column " "(resource name " "\"subdeck\").\n" "-subbead int " "This option specifies the special subbeads column " "(resource name " "\"subbead\").\n" "-[no]sign " "This option allows you to set the abacus to allow " "negatives (resource name \"sign\").\n" "-decimalPosition int " "This option specifies the number of rails to the " "right of the decimal point\n" " (normally 2) (resource name \"decimalPosition\").\n" "-[no]group " "This option allows you to group the displayed " "digits for readability (resource name \"group\").\n" "-groupSize int " "This option specifies the group size to the left of the " "decimal point (normally 3) (resource\n" " name \"groupSize\").\n" "-[no]decimalComma " "This option allows you to swap \".\" for \",\" " "to allow for different display format (resource\n" " name \"decimalComma\").\n" "-base int " "This option specifies the base used (default is base " "10) (resource name \"base\").\n" "-[no]eighth " "This option specifies the base for the Roman subdeck, " "(if set, the resource is set to 8, else\n" " it is set to 12) (resource " "name \"subbase\").\n" "-anomaly int " "This option specifies the offset from base for a " "multiplicative factor of the rail with the\n" " anomaly (if none, this is set to 0) " "(resource name \"anomalySq\").\n" "-shiftAnomaly int " "This option specifies the offset from decimal point " "for the anomaly (usually 2) (resource name\n" " \"shiftAnomaly\").\n" "-anomalySq int " "This option specifies the offset from base for the " "second anomaly (if none, this is set to 0)\n" " (resource name \"anomalySq\").\n" "-shiftAnomalySq int " "This option specifies the offset in rails from the " "first anomaly (usually 2) (resource\n" " name \"shiftAnomalySq\")." }; static const char options4Help[] = { "-displayBase int " "This option specifies the base displayed (default is " "base 10) (resource name \"displayBase\").\n" " If this is different then \"base\" then it is " "implemented using \"long long\" and the calculation is\n" " limited by its bounds. Also the fractional " "part does not scale with the \"displayBase\" so if the\n" " \"displayBase\" is greater than the \"base\" it " "looses some precision. Also no rounding is done.\n" "-[no]pressOffset " "This option allows you to put a pixel space between all the " "beads so there is room for the bead\n" " to move when pressed (resource name \"pressOffset\").\n" "-[no]romanNumerals " "This option allows you to set the abacus to " "allow Roman Numerals (resource name\n" " \"romanNumerals\"). Roman Numerals above 3999 are " "normally represented with bars on top, due to ASCII\n" " constraints this is represented instead in lower case " "(historically case was ignored). Roman Numerals above\n" " 3,999,999 were not represented historically. " "Roman numerals change with displayBase in an\n" " \"experimental\" way. When used with twelfths and " "subdecks, named fraction symbols are used. Due to\n" " ASCII constraints the sigma is represented as E, the " "backwards C is represented as a Q, the mu as a u, and\n" " the Z with a - through the center as a z. If " "available, decimal input is ignored.\n" "-[no]latin " "This option allows you to set the abacus to " "allow latin fractions instead of a symbolic notation in the\n" " Roman numeral output (resource name " "\"latin\").\n" "-[no]ancientRoman " "This option allows you to set the abacus to " "allow ancient Roman numerals instead of the\n" " modern in the Roman numeral output (resource name " "\"ancientRoman\").\n" "-[no]modernRoman " "This option allows you to set the abacus to " "allow modern Roman numerals instead of the\n" " ancient on the Roman Hand abacus (resource name " "\"modernRoman\").\n" "-chinese " "This option specifies the format of the abacus " "(resource name \"format\") to \"Chinese\" for the Chinese\n" " Suanpan.\n" "-japanese " "This option specifies the format of the abacus " "(resource name \"format\") to \"Japanese\" for the\n" " Japanese post-WWII Soroban. " "This is also similar to the Roman Hand Abacus.\n" "-korean " "This option specifies the format of the abacus " "(resource name \"format\") to \"Korean\" for the Korean\n" " Jupan or Japanese pre-WWII Soroban.\n" "-russian " "This option specifies the format of the abacus " "(resource name \"format\") to \"Russian\" for the Russian\n" " Schety. To complete, specify \"piece\" resource to be 4.\n" "-danish " "This option specifies the format of the abacus " "(resource name \"format\") to \"Danish\" for the Danish\n" " Elementary School Abacus teaching aid.\n" "-roman " "This option specifies the format of the abacus " "(resource name \"format\") to \"Roman\" for the Roman\n" " Hand Abacus, note beads will move in slots. " "To complete, specify \"romanNumerals\".\n" "-medieval " "This option specifies the format of the abacus " "(resource name \"format\") to \"Medieval\" for the Medieval\n" " Counter, with counters instead of beads.\n" "-generic " "This option specifies the format of the abacus " "(resource name \"format\") to \"Generic\". This option\n" " specifies a format that is more configurable by using " "using resources, since there are few rules to govern its\n" " behavior.\n" "-it " "This option specifies the country code of the museum of the " "abacus in Museum of the Thermae, Rome.\n" "-uk " "This option specifies the country code of the museum of the " "abacus in British Museum in London.\n" "-fr " "This option specifies the country code of the museum of the " "abacus in Cabinet de medailles, Bibliotheque\n" " nationale, Paris.\n" "-version " "This option tells you what version of xabacus you have." }; #endif #if defined(HAVE_MOTIF) || defined(WINVER) static const char description1Help[] = { "This is an implementation of the classic Chinese Abacus " "(Suanpan) which has its origins in the 12th century.\n" "\n" "The device has two decks. Each deck, separated by a " "partition, normally has 13 rails on which are mounted beads.\n" "Each rail on the top deck contains 1 or 2 beads, and each " "rod on the bottom deck contains 4 or 5 beads. Each bead on\n" "the upper deck has a value of five, while each bead on the " "lower deck has value of one. Beads are considered counted,\n" "when moved towards the partition separating the decks, i.e. " "to add a value of one, a bead in the bottom deck is moved\n" "up, and to add a value of 5, a bead in the top deck is moved " "down.\n" "\n" "The basic operations of the abacus are addition and subtraction. " " Multiplication can be done by mentally multiplying\n" "the digits and adding up the intermediate results on the abacus. " " Division would be similar where the intermediate\n" "results are subtracted. There are techniques like using your " "thumb with forefinger which does not apply with mouse\n" "entry. Also with multiplication, one can carry out " "calculations on different parts of the abacus for scratch work,\n" "here it is nice to have a long abacus.\n" "\n" "The pre-WWII Japanese Abacus (Soroban) (or Korean Jupan) " "is similar to the Chinese Abacus but has only one bead\n" "per rail on the top deck. The later Japanese Abacus was" "further simplified to have only 4 beads per rail on the\n" "bottom deck.\n" "\n" "The Russian Abacus was invented in the 17th century, here " "the beads are moved from right to left. It has colored\n" "beads in the middle for ease of use. Quarters represent " "1/4 Rubles and are only present historically on the Russian\n" "Abacus (Schety). Some of the older Schety have a extra place " "for the 1/4 Kopek (quarter percent) as well as the 1/4\n" "Ruble (quarter)." }; static const char description2Help[] = { "\n" "The Danish Abacus was used in the early 20th century in " "elementary schools as a teaching aid.\n" "\n" "The Roman Hand-Abacus predates the Chinese Abacus and is " "very similar to the later Japanese Abacus, but seems to\n" "have fallen out of use with the Fall of the Roman Empire " "(at least 3 are in existence). The Roman Abaci are brass\n" "plates where the beads move in slots. In addition to the " "normal 7 columns of beads, they generally have 2 special\n" "columns on the right side. In two examples: the first " "special column was for 12ths (12 uncia (ounces) = 1 as) and\n" "had one extra bead in the bottom deck. Also the last column " "was a combination of halves, quarters, and twelfths of an\n" "ounce and had no beads in the top deck and 4 beads at the " "bottom (beads did not have to come to the top to be\n" "counted but at one of 3 marked points, where the top bead " "was for halves, the next bead for quarters, and the last two\n" "beads for twelfths). In another surviving example: the 2 " "special columns were switched and the combination column\n" "was broken into 3 separate slots. If available, decimal " "input is ignored.\n" "\n" "The Medieval Counter is a primitive form of the abacus and " "was used in Europe as late as the 1600s. It was useful\n" "considering they were using it with Roman Numerals. This " "is similar to the Salamis Greek Tablet from 4th or 5th\n" "Century BCE.\n" "\n" "The Mesoamerican Nepohualtzintzin is a Japanese Abacus " "base 20. The Mesoamericans had base 20 with the\n" "exception of the 3rd decimal place where instead of " "20 * 20 = 400 the third place marked 360 and the 4th place was\n" "20 * 360, etc. They independently created their own zero " "(only Babylon (base 60) and India (base 10) have done this)\n" "but the anomaly took away its true power.\n" "\n" "An easy way of figuring out time in seconds given hours, " "minutes, and seconds, can be done on the abacus with\n" "special anomaly \"watch\" settings.\n" "\n" "The Chinese Solid-and-Broken-Bar System is a base 12 " "numbering system and not really an abacus. When the\n" "abacus is setup in this way though (topFactor 3, topNumber 3, " "bottomNumber 2, base 12, displayBase 12), it is easy to\n" "relate the two.\n" "\n" "The signed bead is an invention of the author and is not " "present on any historical abacus (to his knowledge) and is\n" "used to represent negatives. \"New & Improved\" abacus " "models have two auxiliary decks stacked above the principal\n" "deck that enable multiplication, division, square-root, and " "cube-root computations to be performed with equal ease as\n" "addition and subtraction (well, so I have read)." }; static const char featuresHelp[] = { "Click \"mouse-left\" button on a bead you want to move. The " "beads will shift themselves to vacate the area of the\n" "column that was clicked.\n" "\n" "Click \"mouse-right\" button, or press \"C\" or \"c\" keys, " "to clear the abacus.\n" "\n" "Press \"O\" or \"o\" keys to toggle the demo mode. " "\n" "Press \"$\" key to toggle the teach mode.\n" "\n" "In teach mode, \"+\" key toggles starting side to sum, " "\"*\" key toggles for starting side for multiplicand.\n" "\n" "Press \"~\" or \"`\" keys to complement the beads on the rails.\n" "\n" "Press \"I\" or \"i\" keys to increment the number of rails. " "Press \"D\" or \"d\" keys to decrement the number of rails.\n" "\n" "Press \"F\" or \"f\" keys to switch between Chinese, " "Japanese, Korean, Russian, Danish, Roman, and Medieval formats.\n" "There is an extra \"Generic\" format, this allows one to " "break some rules binding the other formats (for example,\n" "if one wanted more beads on top deck than on bottom deck you " "would use this, in addition to resource option changes).\n" "\n" "Press \"M\" or \"m\" keys to switch between it, uk, and fr " "museum formats.\n" "\n" "Press \"V\" or \"v\" keys to toggle Roman Nvmerals. " "(Pardon humor/typo but ran out of letters).\n" "\n" "Press \"S\" or \"s\" keys to toggle the sign bead.\n" "\n" "Press \"U\" or \"u\" keys to toggle the availability of " "quarter beads. (Mutually exclusive to twelfth beads).\n" "Intended for the Russian Abacus.\n" "\n" "Press \"T\" or \"t\" keys to toggle the availability of " "twelfth beads. (Mutually exclusive to quarter beads).\n" "Intended for the Roman Abacus.\n" "\n" "Press \"P\" or \"p\" keys to toggle the availability of " "quarter percent beads. (Dependent on quarter beads (or\n" "twelfth beads)). Intended for the older Russian Abacus.\n" "\n" "Press \"B\" or \"b\" keys to toggle the availability of " "subdecks. (Dependent on twelfth beads (or quarter beads)\n" "and Roman format). Intended for the Roman Abacus, where " "the lowest value of the two at bottom of the rightmost\n" "column of beads are a twelfth of the column, second from " "right.\n" "\n" "Press \"E\" or \"e\" keys to toggle the availability of " "subdecks. (Dependent on twelfth beads (or quarter beads)\n" "and Roman format). Intended for the Roman Abacus, where " "the lowest value of the three at bottom of the rightmost\n" "column of beads are an eighth of the column, second from " "right.\n" "\n" "Press \"L\" or \"l\" keys to toggle the availability of " "anomaly bars. Intended to used with Japanese Abacus and\n" "base 20 for the Mesoamerican Abacus. (Mutually exclusive " "to watch bars).\n" "\n" "Press \"W\" or \"w\" keys to toggle the availability of " "watch bars. Intended to represent seconds where hours\n" "and minutes can be set. (Mutually exclusive to anomaly " "bars).\n" "\n" "Press \">\" or \".\" keys to speed up the movement of beads. " "Press \"<\" or \",\" keys to slow down the movement of beads.\n" "\n" "Press \"@\" key to toggle the sound. " "Press \"Esc\" key to hide program.\n" "\n" "Press \"Q\", \"q\", or \"CTRL-C\" keys to kill program.\n" "\n" "The abacus may be resized. Beads will reshape depending " "on the room they have.\n" "\n" "Demo Mode: in this mode, the abacus is controlled by the " "program. When started with the demo option, a second\n" "window is presented that should be placed directly below the " "abacus-window. Descriptive text, and user prompts are\n" "displayed in this window. Pressing 'q' during the demo " "will quit it. Clicking the left mouse-button with the\n" "pointer in the window will restart the demo (beginning " "of current lesson)." }; static const char referencesHelp[] = { "Luis Fernandes http://www.ee.ryerson.ca/~elf/abacus/\n" "Lee Kai-chen, How to Learn Lee's Abacus, 1958, 58 pages.\n" "Abacus Guide Book, 57 pages.\n" "Georges Ifrah, The Universal history of Numbers, Wiley Press " "2000, pp 209-211, 288-294.\n" "Review of above: http://www.ams.org/notices/200201/rev-dauben.pdf\n" "David Eugene Smith, History of Mathematics Volume II, " "Dover Publications, Inc 1958, pp 156-195." }; #define DESCRIPTION_SIZE (sizeof (description1Help) + sizeof (description2Help) + 4) char descriptionHelp[DESCRIPTION_SIZE]; #endif static const char *formatChoices[] = { "Chinese Suanpan", "Japanese Soroban", "Korean Jupan", "Russian Schety", "Danish School Abacus", "Roman Hand-abacus", "Medieval Counter", "Generic Abacus" }; #define ENABLE_ANCIENT_ROMAN(romanNumerals) romanNumerals #define ENABLE_LATIN(romanNumerals, bottomPiece) (romanNumerals && bottomPiece != 0) #define ENABLE_QUARTER(bottomPiece) (bottomPiece != 6) #define ENABLE_TWELFTH(bottomPiece) (bottomPiece != 4) #ifdef PRECENT_DEPEND #define ENABLE_QUARTER_PERCENT(bottomPiece, bottomPiecePercent, decimalPosition) \ (bottomPiece != 0 && (((bottomPiecePercent != 0) ? 1 : 0) + decimalPosition >= 3)) #else #define ENABLE_QUARTER_PERCENT(bottomPiece, bottomPiecePercent, decimalPosition) \ (((bottomPiecePercent != 0) ? 1 : 0) + decimalPosition >= 2 + (bottomPiece != 0) ? 1 : 0) #endif #define ENABLE_SECONDARY(bottomPiece, bottomPiecePercent, decimalPosition, slot) \ ((bottomPiece != 0) && (bottomPiecePercent == 0) && (decimalPosition == 3) && slot) #define ENABLE_SUBDECK(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, subbase, slot) \ (bottomPiece != 0 && bottomPiecePercent == 0 && decimalPosition == 3 && (subdeck == 0 || subbase != 8) && slot) #define ENABLE_EIGHTH(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, subbase, slot) \ (bottomPiece != 0 && bottomPiecePercent == 0 && decimalPosition == 3 && (subdeck == 0 || subbase != 12) && slot) #define ENABLE_MUSEUM(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, slot) \ ((bottomPiece != 0) && (bottomPiecePercent == 0) && (decimalPosition == 3) && (subdeck > 0) && slot) #define ENABLE_MODERN_ROMAN(slot, anomaly, anomalySq) \ (slot && anomaly == 0 && anomalySq == 0) #define ENABLE_ANOMALY(anomaly, anomalySq) ((anomaly != 4) || (anomalySq != 4)) #define ENABLE_WATCH(anomaly, anomalySq) ((anomaly != 2) || (anomalySq != 0)) #define SET_QUARTER(bottomPiece, topPiece) \ (bottomPiece == 4 && topPiece == 0) #define SET_TWELFTH(bottomPiece, topPiece) \ (bottomPiece == 6 && topPiece == 2) #ifdef PRECENT_NODEPEND #define SET_QUARTER_PERCENT(bottomPiece, bottomPiecePercent, topPiecePercent) \ (bottomPiece != 0 && bottomPiecePercent == 4 && topPiecePercent == 0) #else #define SET_QUARTER_PERCENT(bottomPiece, bottomPiecePercent, topPiecePercent) \ (bottomPiecePercent == 4 && topPiecePercent == 0) #endif #define SET_SUBDECK(bottomPiece, bottomPiecePercent, subdeck, subbase, slot) \ (bottomPiece != 0 && bottomPiecePercent == 0 && subdeck == 3 && subbase == 12 && slot) #define SET_EIGHTH(bottomPiece, bottomPiecePercent, subdeck, subbase, slot) \ (bottomPiece != 0 && bottomPiecePercent == 0 && subdeck == 3 && subbase == 8 && slot) #define SET_ANOMALY(anomaly, anomalySq) ((anomaly == 2) && (anomalySq == 0)) #define SET_WATCH(anomaly, anomalySq) ((anomaly == 4) && (anomalySq == 4)) #ifdef WINVER #include "AbacusP.h" #define TITLE "wabacus" static AbacusRec widget; char calc[120] = ""; #define MAX_DIGITS 256 /* This limits the number of rails */ static void forceNormalParams(AbacusWidget w) { int base = DEFAULT_BASE; int displayBase = DEFAULT_BASE; w->abacus.base = base; w->abacus.displayBase = displayBase; } static void forceDemoParams(AbacusWidget w) { int min; unsigned int mode; int bottomPiece, bottomPiecePercent; Boolean demo, sign; forceNormalParams(w); mode = w->abacus.mode; sign = w->abacus.sign; bottomPiece = w->abacus.decks[BOTTOM].piece; bottomPiecePercent = w->abacus.decks[BOTTOM].piecePercent; demo = w->abacus.demo; if (mode == GENERIC) { changeFormatAbacus(w); } min = ((sign) ? 1: 0) + ((bottomPiece) ? 1 : 0) + ((bottomPiecePercent) ? 1 + w->abacus.shiftPercent : 0) + ((demo) ? MIN_DEMO_RAILS : MIN_RAILS); while (w->abacus.rails < min) { incrementAbacus(w); } } static void forceTeachParams(AbacusWidget w) { w->abacus.displayBase = w->abacus.base; w->abacus.sign = False; w->abacus.anomaly = 0; w->abacus.anomalySq = 0; if (w->abacus.mode == GENERIC) { changeFormatAbacus(w); } (void) InvalidateRect(w->core.hWnd, NULL, TRUE); } void setAbacus(AbacusWidget w, int reason) { switch (reason) { case ACTION_SCRIPT: #if 0 { int deck, rail, number; deck = w->abacus.deck; rail = w->abacus.rail; number = w->abacus.number; (void) printf("%d %d %d %d\n", PRIMARY, deck, rail, number); } #endif break; case ACTION_BASE_DEFAULT: forceNormalParams(w); break; case ACTION_DEMO_DEFAULT: clearAbacus(w); forceDemoParams(w); break; case ACTION_CLEAR: clearAbacus(w); if (w->abacus.demo) { clearAbacusDemo(w); } break; case ACTION_DECIMAL_CLEAR: clearDecimalAbacus(w); break; case ACTION_COMPLEMENT: complementAbacus(w); break; case ACTION_CLEAR_NODEMO: clearAbacus(w); break; case ACTION_HIDE: ShowWindow(w->core.hWnd, SW_SHOWMINIMIZED); break; case ACTION_CLEAR_QUERY: break; case ACTION_DEMO: toggleDemoAbacusDemo(w); break; case ACTION_NEXT: showNextAbacusDemo(w); break; case ACTION_REPEAT: showRepeatAbacusDemo(w); break; case ACTION_JUMP: showJumpAbacusDemo(w); break; case ACTION_MORE: showMoreAbacusDemo(w); break; case ACTION_INCREMENT: case ACTION_DECREMENT: case ACTION_FORMAT: case ACTION_ROMAN_NUMERALS: case ACTION_ANCIENT_ROMAN: case ACTION_LATIN: case ACTION_GROUP: case ACTION_SIGN: case ACTION_QUARTER: case ACTION_TWELFTH: case ACTION_QUARTER_PERCENT: case ACTION_SUBDECK: case ACTION_MUSEUM: case ACTION_MODERN_ROMAN: case ACTION_ANOMALY: case ACTION_WATCH: break; } } /* input dialog box handle */ HWND hCalcDlg = NULL; HWND hDemoDlg = NULL; HWND hTeachDlg = NULL; void setAbacusString(AbacusWidget w, int reason, char *string) { (void) strncpy(calc, string, 120); if (reason == ACTION_SCRIPT || reason == ACTION_IGNORE) { char szBuf[MAX_DIGITS + 67]; unsigned int mode = w->abacus.mode; (void) sprintf(szBuf, "%s %s", string, (mode >= MAX_FORMATS) ? "Abacus" : formatChoices[mode]); SetWindowText(w->core.hWnd, (LPSTR) szBuf); } SetDlgItemText(hCalcDlg, ACTION_CALC, calc); } static LRESULT CALLBACK about(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { if (message == WM_COMMAND && (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)) { (void) EndDialog(hDlg, TRUE); return TRUE; } return FALSE; } static LRESULT CALLBACK teach(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { if (message == WM_COMMAND) { if (LOWORD(wParam) == IDOK) { char str[120]; GetDlgItemText(hDlg, ACTION_TEACH, str, 120); widget.core.hDC = GetDC(widget.core.hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); widget.abacus.teach = True; (void) teachStep(&widget, str, 0); if (strcmp(str, "q") == 0) { destroyAbacus(&widget, NULL); } /*setAbacusString(&widget, ACTION_IGNORE, str);*/ (void) ReleaseDC(widget.core.hWnd, widget.core.hDC); /*SetDlgItemText(hDlg, ACTION_TEACH, calc);*/ return TRUE; } else if (LOWORD(wParam) == IDCANCEL) { widget.abacus.teach = False; (void) EndDialog(hDlg, TRUE); hTeachDlg = NULL; return TRUE; } } return FALSE; } static LRESULT CALLBACK calculation(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { if (message == WM_COMMAND) { if (LOWORD(wParam) == IDOK) { int i, j = 0; char mathBuff[120]; GetDlgItemText(hDlg, ACTION_CALC, mathBuff, 120); widget.core.hWnd = GetParent(hDlg); widget.core.hDC = GetDC(widget.core.hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); /* strip out blanks */ for (i = 0; i < (int) strlen(mathBuff); i++) { if (mathBuff[i] == '[' || mathBuff[i] == ']') { mathBuff[j] = '\0'; break; } else if (mathBuff[i] != ' ' && mathBuff[i] != '\t') { mathBuff[j] = mathBuff[i]; j++; } } calculate(&widget, mathBuff, 0); (void) ReleaseDC(widget.core.hWnd, widget.core.hDC); SetDlgItemText(hDlg, ACTION_CALC, calc); return TRUE; } else if (LOWORD(wParam) == IDCANCEL) { (void) DestroyWindow(hDlg); hCalcDlg = NULL; return TRUE; } } return FALSE; } static LRESULT CALLBACK demo(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { if (message == WM_COMMAND) { if (LOWORD(wParam) == IDOK) { char str[120]; GetDlgItemText(hDlg, ACTION_DEMO1, str, 120); widget.core.hWnd = GetParent(hDlg); widget.core.hDC = GetDC(widget.core.hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); //demo(&widget, str, 0); (void) ReleaseDC(widget.core.hWnd, widget.core.hDC); SetDlgItemText(hDlg, ACTION_DEMO4, "fix me"); return TRUE; } else if (LOWORD(wParam) == IDCANCEL) { widget.abacus.demo = False; (void) EndDialog(hDlg, TRUE); hDemoDlg = NULL; return TRUE; } } return FALSE; } static LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { HBRUSH brush = (HBRUSH) NULL; PAINTSTRUCT paint; widget.core.hWnd = hWnd; if (GetFocus()) { if (!widget.abacus.focus) { widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_BRUSH)); enterAbacus(&widget); (void) EndPaint(hWnd, &paint); } } else { if (widget.abacus.focus) { widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_BRUSH)); leaveAbacus(&widget); (void) EndPaint(hWnd, &paint); } } switch (message) { case WM_CREATE: initializeAbacus(&widget, brush); widget.core.hMenu = GetMenu(widget.core.hWnd); EnableMenuItem(widget.core.hMenu, ACTION_ANCIENT_ROMAN, (unsigned) (ENABLE_ANCIENT_ROMAN(widget.abacus.romanNumerals) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_LATIN, (unsigned) (ENABLE_LATIN(widget.abacus.romanNumerals, widget.abacus.decks[BOTTOM].piece) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_QUARTER, (unsigned) (ENABLE_QUARTER(widget.abacus.decks[BOTTOM].piece) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_TWELFTH, (unsigned) (ENABLE_TWELFTH(widget.abacus.decks[BOTTOM].piece) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_QUARTER_PERCENT, (unsigned) (ENABLE_QUARTER_PERCENT(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_SUBDECK, (unsigned) (ENABLE_SUBDECK(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, widget.abacus.subdeck, widget.abacus.subbase, widget.abacus.slot) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_EIGHTH, (unsigned) (ENABLE_EIGHTH(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, widget.abacus.subdeck, widget.abacus.subbase, widget.abacus.slot) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_MUSEUM, (unsigned) (ENABLE_MUSEUM(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, widget.abacus.subdeck, widget.abacus.slot) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_MODERN_ROMAN, (unsigned) (ENABLE_MODERN_ROMAN(widget.abacus.slot, widget.abacus.anomaly, widget.abacus.anomalySq) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_ANOMALY, (unsigned) (ENABLE_ANOMALY(widget.abacus.anomaly, widget.abacus.anomalySq) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_WATCH, (unsigned) (ENABLE_WATCH(widget.abacus.anomaly, widget.abacus.anomalySq) ? MF_ENABLED : MF_GRAYED)); initializeAbacusDemo(&widget); break; case WM_DESTROY: destroyAbacus(&widget, brush); #if 0 if (widget.abacus.demo) destroyAbacusDemo(); #endif break; case WM_SIZE: resizeAbacus(&widget); (void) InvalidateRect(hWnd, NULL, TRUE); break; case WM_PAINT: widget.core.hDC = BeginPaint(hWnd, &paint); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); exposeAbacus(&widget); if (widget.abacus.demo) { exposeAbacusDemo(&widget); } (void) EndPaint(hWnd, &paint); break; case WM_LBUTTONDOWN: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); #if 0 if (widget.abacus.demo) { clearAbacus(&widget); clearAbacusDemo(&widget); } else #endif { selectAbacus(&widget, LOWORD(lParam), HIWORD(lParam)); } (void) ReleaseDC(hWnd, widget.core.hDC); break; case WM_LBUTTONUP: case WM_NCMOUSEMOVE: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); releaseAbacus(&widget, LOWORD(lParam), HIWORD(lParam)); (void) ReleaseDC(hWnd, widget.core.hDC); break; #if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) case WM_MOUSEWHEEL: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); { int zDelta = ((short) HIWORD(wParam)); POINT cursor, origin; origin.x = 0, origin.y = 0; ClientToScreen(hWnd, &origin); (void) GetCursorPos(&cursor); if (zDelta > (WHEEL_DELTA >> 1)) { moveAbacusInput(&widget, cursor.x - origin.x, cursor.y - origin.y, '8', (GetKeyState(VK_CONTROL) >> 1) ? 1 : 0); if (GetKeyState(VK_CONTROL) >> 1) { resizeAbacus(&widget); (void) InvalidateRect(hWnd, NULL, TRUE); } } else if (zDelta < -(WHEEL_DELTA >> 1)) { moveAbacusInput(&widget, cursor.x - origin.x, cursor.y - origin.y, '2', (GetKeyState(VK_CONTROL) >> 1) ? 1 : 0); if (GetKeyState(VK_CONTROL) >> 1) { resizeAbacus(&widget); (void) InvalidateRect(hWnd, NULL, TRUE); } } } (void) ReleaseDC(hWnd, widget.core.hDC); break; #endif case WM_COMMAND: switch (LOWORD(wParam)) { case ACTION_EXIT: if (hDemoDlg != NULL) { (void) EndDialog(hDemoDlg, TRUE); hDemoDlg = NULL; } if (widget.abacus.demo) toggleDemoAbacusDemo(&widget); else destroyAbacus(&widget, brush); break; case ACTION_HIDE: hideAbacus(&widget); break; case ACTION_CLEAR: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); clearAbacus(&widget); if (widget.abacus.demo) { clearAbacusDemo(&widget); } (void) ReleaseDC(hWnd, widget.core.hDC); break; case ACTION_RIGHT: case ACTION_LEFT: case ACTION_UP: case ACTION_DOWN: { int action = LOWORD(wParam); POINT cursor, origin; char letter; if (action == ACTION_RIGHT || action == ACTION_LEFT) letter = ((action == ACTION_RIGHT) ? '6' : '4'); else letter = ((action == ACTION_UP) ? '8' : '2'); widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); origin.x = 0, origin.y = 0; ClientToScreen(hWnd, &origin); (void) GetCursorPos(&cursor); (void) moveAbacusInput(&widget, cursor.x - origin.x, cursor.y - origin.y, letter, FALSE); (void) ReleaseDC(hWnd, widget.core.hDC); } break; case ACTION_INCX: case ACTION_DECX: case ACTION_INCY: case ACTION_DECY: { int action = LOWORD(wParam); POINT cursor, origin; char letter; if (action == ACTION_INCX || action == ACTION_DECX) letter = ((action == ACTION_INCX) ? '6' : '4'); else letter = ((action == ACTION_INCY) ? '8' : '2'); widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); origin.x = 0, origin.y = 0; ClientToScreen(hWnd, &origin); (void) GetCursorPos(&cursor); (void) moveAbacusInput(&widget, cursor.x - origin.x, cursor.y - origin.y, letter, TRUE); (void) ReleaseDC(hWnd, widget.core.hDC); } break; case ACTION_COMPLEMENT: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); complementAbacus(&widget); (void) ReleaseDC(hWnd, widget.core.hDC); break; case ACTION_INCREMENT: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); incrementAbacus(&widget); (void) ReleaseDC(hWnd, widget.core.hDC); break; case ACTION_DECREMENT: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); decrementAbacus(&widget); (void) ReleaseDC(hWnd, widget.core.hDC); break; case ACTION_FORMAT: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); if (ENABLE_MUSEUM(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, widget.abacus.subdeck, !widget.abacus.slot)) { clearDecimalAbacus(&widget); } changeFormatAbacus(&widget); EnableMenuItem(widget.core.hMenu, ACTION_SUBDECK, (unsigned) (ENABLE_SUBDECK(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, widget.abacus.subdeck, widget.abacus.subbase, widget.abacus.slot) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_EIGHTH, (unsigned) (ENABLE_EIGHTH(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, widget.abacus.subdeck, widget.abacus.subbase, widget.abacus.slot) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_MUSEUM, (unsigned) (ENABLE_MUSEUM(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, widget.abacus.subdeck, widget.abacus.slot) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_MODERN_ROMAN, (unsigned) (ENABLE_MODERN_ROMAN(widget.abacus.slot, widget.abacus.anomaly, widget.abacus.anomalySq) ? MF_ENABLED : MF_GRAYED)); if (widget.abacus.demo) { clearAbacusDemo(&widget); clearAbacus(&widget); } break; case ACTION_ROMAN_NUMERALS: toggleRomanNumeralsAbacus(&widget); EnableMenuItem(widget.core.hMenu, ACTION_ANCIENT_ROMAN, (unsigned) (ENABLE_ANCIENT_ROMAN(widget.abacus.romanNumerals) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_LATIN, (unsigned) (ENABLE_LATIN(widget.abacus.romanNumerals, widget.abacus.decks[BOTTOM].piece) ? MF_ENABLED : MF_GRAYED)); break; case ACTION_ANCIENT_ROMAN: toggleAncientRomanAbacus(&widget); break; case ACTION_LATIN: toggleLatinAbacus(&widget); break; case ACTION_GROUP: toggleGroupingAbacus(&widget); break; case ACTION_SIGN: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); toggleNegativeSignAbacus(&widget); (void) ReleaseDC(hWnd, widget.core.hDC); break; case ACTION_QUARTER: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); if (ENABLE_MUSEUM(((widget.abacus.decks[BOTTOM].piece != 4) ? 4 : 0), widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, widget.abacus.subdeck, widget.abacus.slot)) { clearDecimalAbacus(&widget); } toggleQuartersAbacus(&widget); EnableMenuItem(widget.core.hMenu, ACTION_LATIN, (unsigned) (ENABLE_LATIN(widget.abacus.romanNumerals, widget.abacus.decks[BOTTOM].piece) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_TWELFTH, (unsigned) (ENABLE_TWELFTH(widget.abacus.decks[BOTTOM].piece) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_QUARTER_PERCENT, (unsigned) (ENABLE_QUARTER_PERCENT(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_SUBDECK, (unsigned) (ENABLE_SUBDECK(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, widget.abacus.subdeck, widget.abacus.subbase, widget.abacus.slot) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_EIGHTH, (unsigned) (ENABLE_EIGHTH(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, widget.abacus.subdeck, widget.abacus.subbase, widget.abacus.slot) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_MUSEUM, (unsigned) (ENABLE_MUSEUM(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, widget.abacus.subdeck, widget.abacus.slot) ? MF_ENABLED : MF_GRAYED)); (void) ReleaseDC(hWnd, widget.core.hDC); break; case ACTION_TWELFTH: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); if (ENABLE_MUSEUM(((widget.abacus.decks[BOTTOM].piece != 6) ? 6 : 0), widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, widget.abacus.subdeck, widget.abacus.slot)) { clearDecimalAbacus(&widget); } toggleTwelfthsAbacus(&widget); EnableMenuItem(widget.core.hMenu, ACTION_LATIN, (unsigned) (ENABLE_LATIN(widget.abacus.romanNumerals, widget.abacus.decks[BOTTOM].piece) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_QUARTER, (unsigned) (ENABLE_QUARTER(widget.abacus.decks[BOTTOM].piece) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_QUARTER_PERCENT, (unsigned) (ENABLE_QUARTER_PERCENT(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_SUBDECK, (unsigned) (ENABLE_SUBDECK(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, widget.abacus.subdeck, widget.abacus.subbase, widget.abacus.slot) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_EIGHTH, (unsigned) (ENABLE_EIGHTH(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, widget.abacus.subdeck, widget.abacus.subbase, widget.abacus.slot) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_MUSEUM, (unsigned) (ENABLE_MUSEUM(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, widget.abacus.subdeck, widget.abacus.slot) ? MF_ENABLED : MF_GRAYED)); (void) ReleaseDC(hWnd, widget.core.hDC); break; case ACTION_QUARTER_PERCENT: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); if (ENABLE_MUSEUM(widget.abacus.decks[BOTTOM].piece, ((widget.abacus.decks[BOTTOM].piecePercent != 4) ? 4 : 0), widget.abacus.decimalPosition, widget.abacus.subdeck, widget.abacus.slot)) { clearDecimalAbacus(&widget); } toggleQuarterPercentsAbacus(&widget); EnableMenuItem(widget.core.hMenu, ACTION_SUBDECK, (unsigned) (ENABLE_SUBDECK(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, widget.abacus.subdeck, widget.abacus.subbase, widget.abacus.slot) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_EIGHTH, (unsigned) (ENABLE_EIGHTH(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, widget.abacus.subdeck, widget.abacus.subbase, widget.abacus.slot) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_MUSEUM, (unsigned) (ENABLE_MUSEUM(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, widget.abacus.subdeck, widget.abacus.slot) ? MF_ENABLED : MF_GRAYED)); (void) ReleaseDC(hWnd, widget.core.hDC); break; case ACTION_SUBDECK: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); if (ENABLE_MUSEUM(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, ((widget.abacus.subdeck != 3) ? 3 : 0), widget.abacus.slot)) { clearDecimalAbacus(&widget); } toggleSubdecksAbacus(&widget); EnableMenuItem(widget.core.hMenu, ACTION_EIGHTH, (unsigned) (ENABLE_EIGHTH(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, widget.abacus.subdeck, widget.abacus.subbase, widget.abacus.slot) ? MF_ENABLED : MF_GRAYED)); (void) ReleaseDC(hWnd, widget.core.hDC); break; case ACTION_EIGHTH: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); if (ENABLE_MUSEUM(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, ((widget.abacus.subdeck != 3) ? 3 : 0), widget.abacus.slot)) { clearDecimalAbacus(&widget); } toggleEighthsAbacus(&widget); EnableMenuItem(widget.core.hMenu, ACTION_SUBDECK, (unsigned) (ENABLE_SUBDECK(widget.abacus.decks[BOTTOM].piece, widget.abacus.decks[BOTTOM].piecePercent, widget.abacus.decimalPosition, widget.abacus.subdeck, widget.abacus.subbase, widget.abacus.slot) ? MF_ENABLED : MF_GRAYED)); (void) ReleaseDC(hWnd, widget.core.hDC); break; case ACTION_MUSEUM: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); changeMuseumAbacus(&widget); (void) ReleaseDC(hWnd, widget.core.hDC); break; case ACTION_MODERN_ROMAN: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); toggleModernRomanAbacus(&widget); (void) ReleaseDC(hWnd, widget.core.hDC); break; case ACTION_ANOMALY: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); toggleAnomalyAbacus(&widget); EnableMenuItem(widget.core.hMenu, ACTION_MODERN_ROMAN, (unsigned) (ENABLE_MODERN_ROMAN(widget.abacus.slot, widget.abacus.anomaly, widget.abacus.anomalySq) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_WATCH, (unsigned) (ENABLE_WATCH(widget.abacus.anomaly, widget.abacus.anomalySq) ? MF_ENABLED : MF_GRAYED)); (void) ReleaseDC(hWnd, widget.core.hDC); break; case ACTION_WATCH: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); toggleWatchAbacus(&widget); EnableMenuItem(widget.core.hMenu, ACTION_MODERN_ROMAN, (unsigned) (ENABLE_MODERN_ROMAN(widget.abacus.slot, widget.abacus.anomaly, widget.abacus.anomalySq) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(widget.core.hMenu, ACTION_ANOMALY, (unsigned) (ENABLE_ANOMALY(widget.abacus.anomaly, widget.abacus.anomalySq) ? MF_ENABLED : MF_GRAYED)); (void) ReleaseDC(hWnd, widget.core.hDC); break; case ACTION_RIGHT_TO_LEFT_ADD: toggleRightToLeftAddAbacus(&widget); break; case ACTION_RIGHT_TO_LEFT_MULT: toggleRightToLeftMultAbacus(&widget); break; #if 0 case ACTION_VERTICAL: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); VerticalAbacus(&widget); (void) ReleaseDC(hWnd, widget.core.hDC); break; #endif case ACTION_DEMO: #define DEMO_DIALOG #ifdef DEMO_DIALOG if (hDemoDlg != NULL) { (void) DestroyWindow(hDemoDlg); hDemoDlg = NULL; widget.abacus.demo = False; } hDemoDlg = CreateDialog(widget.core.hInstance, "Demo", hWnd, (DLGPROC) demo); #endif if (!widget.abacus.demo) toggleDemoAbacusDemo(&widget); resizeAbacus(&widget); (void) InvalidateRect(hWnd, NULL, TRUE); break; case ACTION_NEXT: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); /* showNextAbacus(&widget); */ if (widget.abacus.demo) showNextAbacusDemo(&widget); (void) ReleaseDC(hWnd, widget.core.hDC); break; case ACTION_REPEAT: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); /* showRepeatAbacus(&widget); */ if (widget.abacus.demo) showRepeatAbacusDemo(&widget); (void) ReleaseDC(hWnd, widget.core.hDC); break; case ACTION_JUMP: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); /* showJumpAbacus(&widget); */ if (widget.abacus.demo) showJumpAbacusDemo(&widget); (void) ReleaseDC(hWnd, widget.core.hDC); break; case ACTION_CHAPTER1: case ACTION_CHAPTER2: case ACTION_CHAPTER3: case ACTION_CHAPTER4: case ACTION_CHAPTER5: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); /* showChapterAbacus(&widget); */ if (widget.abacus.demo) showChapterAbacusDemo(&widget, (unsigned int) (LOWORD(wParam) - ACTION_CHAPTER1)); (void) ReleaseDC(hWnd, widget.core.hDC); break; case ACTION_MORE: widget.core.hDC = GetDC(hWnd); (void) SelectObject(widget.core.hDC, GetStockObject(NULL_PEN)); /* showMoreAbacus(&widget); */ if (widget.abacus.demo) showMoreAbacusDemo(&widget); (void) ReleaseDC(hWnd, widget.core.hDC); break; case ACTION_SOUND: toggleSoundAbacus(&widget); break; case ACTION_SPEED_UP: speedUpAbacus(&widget); break; case ACTION_SLOW_DOWN: slowDownAbacus(&widget); break; case ACTION_CALC: if (hCalcDlg != NULL) { (void) DestroyWindow(hCalcDlg); hCalcDlg = NULL; } hCalcDlg = CreateDialog(widget.core.hInstance, "Calculate", hWnd, (DLGPROC) calculation); break; case ACTION_TEACH: /*(void) DialogBox(widget.core.hInstance, "Teach", hWnd, (DLGPROC) teach);*/ forceTeachParams(&widget); if (hTeachDlg != NULL) { (void) DestroyWindow(hTeachDlg); hTeachDlg = NULL; widget.abacus.teach = False; } hTeachDlg = CreateDialog(widget.core.hInstance, "Teach", hWnd, (DLGPROC) teach); break; case ACTION_DESCRIPTION: strcpy(descriptionHelp, description1Help); strcat(descriptionHelp, "\n"); strcat(descriptionHelp, description2Help); (void) MessageBox(hWnd, descriptionHelp, "Description", MB_OK | MB_ICONQUESTION); break; case ACTION_FEATURES: (void) MessageBox(hWnd, featuresHelp, "Features", MB_OK | MB_ICONEXCLAMATION); break; case ACTION_REFERENCES: (void) MessageBox(hWnd, referencesHelp, "References", MB_OK | MB_ICONINFORMATION); break; case ACTION_ABOUT: (void) DialogBox(widget.core.hInstance, "About", hWnd, (DLGPROC) about); break; } break; default: return (DefWindowProc(hWnd, message, wParam, lParam)); } return FALSE; } void drawDemoText(const char* line, int i) { if (hDemoDlg == NULL || line == NULL) return; SetDlgItemText(hDemoDlg, ACTION_DEMO1 + i, line); } void drawTeachText(const char* line, int i) { if (hTeachDlg == NULL || line == NULL) return; SetDlgItemText(hTeachDlg, ACTION_TEACH1 + i, line); } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int numCmdShow) { HWND hWnd; MSG msg; WNDCLASS wc; HACCEL hAccel; if (!hPrevInstance) { wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = WindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(hInstance, TITLE); wc.hCursor = LoadCursor((HINSTANCE) NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH) GetStockObject(GRAY_BRUSH); wc.lpszMenuName = TITLE; wc.lpszClassName = TITLE; if (!RegisterClass(&wc)) return FALSE; } widget.core.hInstance = hInstance; hWnd = CreateWindow(TITLE, TITLE, WS_OVERLAPPEDWINDOW, (signed) CW_USEDEFAULT, (signed) CW_USEDEFAULT, (signed) CW_USEDEFAULT, (signed) CW_USEDEFAULT, HWND_DESKTOP, (HMENU) NULL, hInstance, (XtPointer) NULL); if (!hWnd) return FALSE; hAccel = (HACCEL) LoadAccelerators(hInstance, TITLE); (void) ShowWindow(hWnd, numCmdShow); (void) UpdateWindow(hWnd); while (GetMessage(&msg, (HWND) NULL, 0, 0)) { if (!IsDialogMessage(hCalcDlg, &msg) && !IsDialogMessage(hTeachDlg, &msg)) { if (!TranslateAccelerator(hWnd, hAccel, &msg)) { (void) TranslateMessage(&msg); (void) DispatchMessage(&msg); } } } return (int) msg.wParam; } #else #include "xwin.h" #include #include #ifdef HAVE_MOTIF #include #include #include #include #include #include #include #include #include #include #include #ifdef MOUSEBITMAPS #include "pixmaps/mouse-l.xbm" #include "pixmaps/mouse-r.xbm" #endif #endif #include "Abacus.h" #ifdef HAVE_XPM #include #ifdef CONSTPIXMAPS #include "16x16/abacus.xpm" #include "22x22/abacus.xpm" #include "24x24/abacus.xpm" #include "32x32/abacus.xpm" #include "48x48/abacus.xpm" #include "64x64/abacus.xpm" #else #include "pixmaps/16x16/abacus.xpm" #include "pixmaps/22x22/abacus.xpm" #include "pixmaps/24x24/abacus.xpm" #include "pixmaps/32x32/abacus.xpm" #include "pixmaps/48x48/abacus.xpm" #include "pixmaps/64x64/abacus.xpm" #endif #define RESIZE_XPM(s) ((char **) (((s)<=32)?\ (((s)<=22)?(((s)<=16)?abacus_16x16:abacus_22x22):\ (((s)<=24)?abacus_24x24:abacus_32x32)):\ (((s)<=48)?abacus_48x48:abacus_64x64))) #endif #include "pixmaps/64x64/abacus.xbm" #define DEFINE_XBM (char *) abacus_64x64_bits, abacus_64x64_width, abacus_64x64_height #define FILE_NAME_LENGTH 1024 #ifdef HAVE_MOTIF #define MAX_RAILS 24 /* Totally arbitrary */ #define SCROLL_SIZE 30 /* A page */ static const char *museumChoices[] = { "it", "uk", "fr" }; #else /* Needs Motif */ #ifdef LEE_ABACUS #undef LEE_ABACUS #endif #define MAX_DIGITS 256 /* This limits the number of rails */ #define TITLE_LENGTH (MAX_DIGITS+FILE_NAME_LENGTH+3) #endif #ifdef HAVE_MOTIF static Widget mainPanel, teachRowCol; static Widget sizeSlider, abacusBaseSlider, displayBaseSlider; static Widget delaySlider; static Widget formatMenu, formatSubMenu; static Widget formatOptions[MAX_MODES]; #ifdef LEE_ABACUS static Widget leftAuxAbacus = NULL, rightAuxAbacus = NULL; static Widget leftAuxTracker = NULL, rightAuxTracker = NULL; #endif static Widget romanNumeralsMenuItem = NULL, ancientRomanMenuItem = NULL; static Widget latinMenuItem = NULL, groupMenuItem = NULL, signMenuItem = NULL; static Widget quarterMenuItem = NULL, twelfthMenuItem = NULL; static Widget quarterPercentMenuItem = NULL; static Widget secondaryRailsMenu = NULL; static Widget subdeckMenuItem = NULL, eighthMenuItem = NULL; static Widget museumMenu = NULL; static Widget modernRomanMenuItem = NULL; static Widget anomalyMenuItem = NULL, watchMenuItem = NULL; static Widget rightToLeftAddMenuItem = NULL, rightToLeftMultMenuItem = NULL; static Widget soundMenuItem = NULL; static Widget tracker, teachTracker = NULL, teachLine[3]; static Widget baseDialog = NULL, delayDialog = NULL; static Widget descriptionDialog, featuresDialog; static Widget synopsisDialog, optionsDialog; static Widget referencesDialog, aboutDialog; static Widget clearDialog; static char *mathBuffer = NULL; static Boolean baseSet = False; static Arg args[10]; #else static Widget shell = NULL; static char titleDsp[TITLE_LENGTH]; #endif static Pixmap pixmap = None; static char titleDspDemo[FILE_NAME_LENGTH + 6]; static Widget topLevel, abacus, abacusDemo = NULL; static char *progDsp; static void usage(char *programName) { unsigned int i; (void) fprintf(stderr, "usage: %s\n", programName); for (i = 0; i < strlen(synopsisHelp); i++) { if (i == 0 || synopsisHelp[i - 1] == '\n') (void) fprintf(stderr, "\t"); (void) fprintf(stderr, "%c", (synopsisHelp[i])); } (void) fprintf(stderr, "\n"); exit(1); } static XrmOptionDescRec options[] = { {(char *) "-mono", (char *) "*abacus.mono", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-nomono", (char *) "*abacus.mono", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-rv", (char *) "*abacus.reverseVideo", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-reverse", (char *) "*abacus.reverseVideo", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-norv", (char *) "*abacus.reverseVideo", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-noreverse", (char *) "*abacus.reverseVideo", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-foreground", (char *) "*abacus.Foreground", XrmoptionSepArg, NULL}, {(char *) "-fg", (char *) "*abacus.Foreground", XrmoptionSepArg, NULL}, {(char *) "-background", (char *) "*Background", XrmoptionSepArg, NULL}, {(char *) "-bg", (char *) "*Background", XrmoptionSepArg, NULL}, {(char *) "-border", (char *) "*abacus.borderColor", XrmoptionSepArg, NULL}, {(char *) "-bd", (char *) "*abacus.borderColor", XrmoptionSepArg, NULL}, {(char *) "-frame", (char *) "*abacus.frameColor", XrmoptionSepArg, NULL}, {(char *) "-primaryBeadColor", (char *) "*abacus.primaryBeadColor", XrmoptionSepArg, NULL}, {(char *) "-leftAuxBeadColor", (char *) "*abacus.leftAuxBeadColor", XrmoptionSepArg, NULL}, {(char *) "-rightAuxBeadColor", (char *) "*abacus.rightAuxBeadColor", XrmoptionSepArg, NULL}, {(char *) "-secondaryBeadColor", (char *) "*abacus.secondaryBeadColor", XrmoptionSepArg, NULL}, {(char *) "-highlightBeadColor", (char *) "*abacus.highlightBeadColor", XrmoptionSepArg, NULL}, {(char *) "-primaryRailColor", (char *) "*abacus.primaryRailColor", XrmoptionSepArg, NULL}, {(char *) "-secondaryRailColor", (char *) "*abacus.secondaryRailColor", XrmoptionSepArg, NULL}, {(char *) "-highlightRailColor", (char *) "*abacus.highlightRailColor", XrmoptionSepArg, NULL}, {(char *) "-lineRailColor", (char *) "*abacus.lineRailColor", XrmoptionSepArg, NULL}, {(char *) "-bumpSound", (char *) "*abacus.bumpSound", XrmoptionSepArg, NULL}, {(char *) "-moveSound", (char *) "*abacus.moveSound", XrmoptionSepArg, NULL}, {(char *) "-sound", (char *) "*abacus.sound", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-nosound", (char *) "*abacus.sound", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-delay", (char *) "*abacus.delay", XrmoptionSepArg, NULL}, {(char *) "-demo", (char *) "*abacus.demo", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-nodemo", (char *) "*abacus.demo", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-script", (char *) "*abacus.script", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-noscript", (char *) "*abacus.script", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-demopath", (char *) "*abacus.demoPath", XrmoptionSepArg, NULL}, {(char *) "-demofont", (char *) "*abacus.demoFont", XrmoptionSepArg, NULL}, {(char *) "-demofn", (char *) "*abacus.demoFont", XrmoptionSepArg, NULL}, {(char *) "-demoforeground", (char *) "*abacus.demoForeground", XrmoptionSepArg, NULL}, {(char *) "-demofg", (char *) "*abacus.demoForeground", XrmoptionSepArg, NULL}, {(char *) "-demobackground", (char *) "*abacus.demoBackground", XrmoptionSepArg, NULL}, {(char *) "-demobg", (char *) "*abacus.demoBackground", XrmoptionSepArg, NULL}, {(char *) "-teach", (char *) "*abacus.teach", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-noteach", (char *) "*abacus.teach", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-rightToLeftAdd", (char *) "*abacus.rightToLeftAdd", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-norightToLeftAdd", (char *) "*abacus.rightToLeftAdd", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-rightToLeftMult", (char *) "*abacus.rightToLeftMult", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-norightToLeftMult", (char *) "*abacus.rightToLeftMult", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-lee", (char *) "*abacus.lee", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-nolee", (char *) "*abacus.lee", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-rails", (char *) "*abacus.rails", XrmoptionSepArg, NULL}, {(char *) "-rightAuxRails", (char *) "*abacus.rightAuxRails", XrmoptionSepArg, NULL}, {(char *) "-leftAuxRails", (char *) "*abacus.leftAuxRails", XrmoptionSepArg, NULL}, {(char *) "-vertical", (char *) "*abacus.vertical", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-novertical", (char *) "*abacus.vertical", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-colorScheme", (char *) "*abacus.colorScheme", XrmoptionSepArg, NULL}, {(char *) "-slot", (char *) "*abacus.slot", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-noslot", (char *) "*abacus.slot", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-diamond", (char *) "*abacus.diamond", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-nodiamond", (char *) "*abacus.diamond", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-railIndex", (char *) "*abacus.railIndex", XrmoptionSepArg, NULL}, {(char *) "-topOrient", (char *) "*abacus.topOrient", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-notopOrient", (char *) "*abacus.topOrient", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-bottomOrient", (char *) "*abacus.bottomOrient", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-nobottomOrient", (char *) "*abacus.bottomOrient", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-topNumber", (char *) "*abacus.topNumber", XrmoptionSepArg, NULL}, {(char *) "-bottomNumber", (char *) "*abacus.bottomNumber", XrmoptionSepArg, NULL}, {(char *) "-topFactor", (char *) "*abacus.topFactor", XrmoptionSepArg, NULL}, {(char *) "-bottomFactor", (char *) "*abacus.bottomFactor", XrmoptionSepArg, NULL}, {(char *) "-topSpaces", (char *) "*abacus.topSpaces", XrmoptionSepArg, NULL}, {(char *) "-bottomSpaces", (char *) "*abacus.bottomSpaces", XrmoptionSepArg, NULL}, {(char *) "-topPiece", (char *) "*abacus.topPiece", XrmoptionSepArg, NULL}, {(char *) "-bottomPiece", (char *) "*abacus.bottomPiece", XrmoptionSepArg, NULL}, {(char *) "-topPiecePercent", (char *) "*abacus.topPiecePercent", XrmoptionSepArg, NULL}, {(char *) "-bottomPiecePercent", (char *) "*abacus.bottomPiecePercent", XrmoptionSepArg, NULL}, {(char *) "-shiftPercent", (char *) "*abacus.shiftPercent", XrmoptionSepArg, NULL}, {(char *) "-subdeck", (char *) "*abacus.subdeck", XrmoptionSepArg, NULL}, {(char *) "-subbead", (char *) "*abacus.subbead", XrmoptionSepArg, NULL}, {(char *) "-sign", (char *) "*abacus.sign", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-nosign", (char *) "*abacus.sign", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-decimalPosition", (char *) "*abacus.decimalPosition", XrmoptionSepArg, NULL}, {(char *) "-group", (char *) "*abacus.group", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-nogroup", (char *) "*abacus.group", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-groupSize", (char *) "*abacus.groupSize", XrmoptionSepArg, NULL}, {(char *) "-decimalComma", (char *) "*abacus.decimalComma", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-nodecimalComma", (char *) "*abacus.decimalComma", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-base", (char *) "*abacus.base", XrmoptionSepArg, NULL}, {(char *) "-eighth", (char *) "*abacus.subbase", XrmoptionNoArg, (char *) "8"}, {(char *) "-noeighth", (char *) "*abacus.subbase", XrmoptionNoArg, (char *) "12"}, {(char *) "-anomaly", (char *) "*abacus.anomaly", XrmoptionSepArg, NULL}, {(char *) "-shiftAnomaly", (char *) "*abacus.shiftAnomaly", XrmoptionSepArg, NULL}, {(char *) "-anomalySq", (char *) "*abacus.anomalySq", XrmoptionSepArg, NULL}, {(char *) "-shiftAnomalySq", (char *) "*abacus.shiftAnomalySq", XrmoptionSepArg, NULL}, {(char *) "-displayBase", (char *) "*abacus.displayBase", XrmoptionSepArg, NULL}, {(char *) "-pressOffset", (char *) "*abacus.pressOffset", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-nopressOffset", (char *) "*abacus.pressOffset", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-romanNumerals", (char *) "*abacus.romanNumerals", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-noromanNumerals", (char *) "*abacus.romanNumerals", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-latin", (char *) "*abacus.latin", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-nolatin", (char *) "*abacus.latin", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-ancientRoman", (char *) "*abacus.ancientRoman", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-noancientRoman", (char *) "*abacus.ancientRoman", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-modernRoman", (char *) "*abacus.modernRoman", XrmoptionNoArg, (char *) "TRUE"}, {(char *) "-nomodernRoman", (char *) "*abacus.modernRoman", XrmoptionNoArg, (char *) "FALSE"}, {(char *) "-chinese", (char *) "*abacus.format", XrmoptionNoArg, (char *) "chinese"}, {(char *) "-japanese", (char *) "*abacus.format", XrmoptionNoArg, (char *) "japanese"}, {(char *) "-korean", (char *) "*abacus.format", XrmoptionNoArg, (char *) "korean"}, {(char *) "-roman", (char *) "*abacus.format", XrmoptionNoArg, (char *) "roman"}, {(char *) "-russian", (char *) "*abacus.format", XrmoptionNoArg, (char *) "russian"}, {(char *) "-danish", (char *) "*abacus.format", XrmoptionNoArg, (char *) "danish"}, {(char *) "-medieval", (char *) "*abacus.format", XrmoptionNoArg, (char *) "medieval"}, {(char *) "-generic", (char *) "*abacus.format", XrmoptionNoArg, (char *) "generic"}, {(char *) "-it", (char *) "*abacus.museum", XrmoptionNoArg, (char *) "it"}, {(char *) "-uk", (char *) "*abacus.museum", XrmoptionNoArg, (char *) "uk"}, {(char *) "-fr", (char *) "*abacus.museum", XrmoptionNoArg, (char *) "fr"}, {(char *) "-version", (char *) "*abacus.versionOnly", XrmoptionNoArg, (char *) "TRUE"} }; static void printState(Widget w, char *msg #ifndef HAVE_MOTIF , int mode #endif ) { #ifdef HAVE_MOTIF XtVaSetValues(w, XmNvalue, msg, NULL); /* label widget and draw the strings on it. use the (void) XmStringDrawImage(XtDisplay(topLevel), XtWindow(topLevel), fontlist, "Primary", gc, x, y, width, XmALIGNMENT_BEGINNING, XmSTRING_DIRECTION_L_TO_R, NULL); */ #else (void) sprintf(titleDsp, "%s %s", msg, (mode < 0 || mode >= MAX_FORMATS) ? "Abacus" : formatChoices[mode]); XtVaSetValues(w, XtNtitle, titleDsp, NULL); #endif } #ifdef LEE_ABACUS #define AUXWIN(n) (n == LEFT_AUX) ? ((leftAuxAbacus) ? leftAuxAbacus : abacus) : ((n == RIGHT_AUX ) ? ((rightAuxAbacus) ? rightAuxAbacus : abacus) : abacus) #else #define AUXWIN(n) abacus #endif /* There's probably a better way to assure that they are the same but I do * not know it off hand. */ static void initializeDemo(void) { int mode; Boolean mono, reverse; Pixel demoForeground, demoBackground; String demoPath, demoFont; XtVaGetValues(abacus, XtNmono, &mono, XtNreverseVideo, &reverse, XtNmode, &mode, XtNdemoForeground, &demoForeground, XtNdemoBackground, &demoBackground, XtNdemoPath, &demoPath, XtNdemoFont, &demoFont, NULL); XtVaSetValues(abacusDemo, XtNmono, mono, XtNreverseVideo, reverse, XtNmode, mode, XtNdemoForeground, demoForeground, XtNdemoBackground, demoBackground, XtNdemoPath, demoPath, XtNdemoFont, demoFont, XtNframed, True, NULL); } #ifdef LEE_ABACUS static void initializeAux(void) { Boolean mono, reverse, script; Pixel frameColor; XtVaGetValues(abacus, XtNmono, &mono, XtNreverseVideo, &reverse, XtNscript, &script, XtNframeColor, &frameColor, NULL); if (leftAuxAbacus) { XtVaSetValues(leftAuxAbacus, XtNmono, mono, XtNreverseVideo, reverse, XtNscript, script, XtNframeColor, frameColor, NULL); XtVaSetValues(abacus, XtNleftAuxAbacus, leftAuxAbacus, NULL); } if (rightAuxAbacus) { XtVaSetValues(rightAuxAbacus, XtNmono, mono, XtNreverseVideo, reverse, XtNscript, script, XtNframeColor, frameColor, NULL); XtVaSetValues(abacus, XtNrightAuxAbacus, rightAuxAbacus, NULL); } } #endif static void callbackAbacusDemo(Widget w, caddr_t clientData, abacusCallbackStruct *callData) { #ifndef HAVE_MOTIF int mode; XtVaGetValues(w, XtNmode, &mode, NULL); #endif switch (callData->reason) { case ACTION_BASE_DEFAULT: #ifdef HAVE_MOTIF XmScaleSetValue(abacusBaseSlider, DEFAULT_BASE); #endif break; case ACTION_HIDE: (void) XIconifyWindow(XtDisplay(topLevel), XtWindow(topLevel), XScreenNumberOfScreen(XtScreen(topLevel))); #ifndef HAVE_MOTIF (void) XIconifyWindow(XtDisplay(shell), XtWindow(shell), XScreenNumberOfScreen(XtScreen(shell))); #endif break; case ACTION_MOVE: #ifndef LEE_ABACUS if (callData->aux == PRIMARY) #endif { XtVaSetValues(AUXWIN(callData->aux), XtNdeck, callData->deck, XtNrail, callData->rail, XtNnumber, callData->number, NULL); } break; case ACTION_HIGHLIGHT_RAIL: #ifndef LEE_ABACUS if (callData->aux == PRIMARY) #endif { XtVaSetValues(AUXWIN(callData->aux), XtNdeck, HIGHLIGHT_DECK, XtNrail, callData->rail, NULL); } break; case ACTION_UNHIGHLIGHT_RAIL: #ifndef LEE_ABACUS if (callData->aux == PRIMARY) #endif { XtVaSetValues(AUXWIN(callData->aux), XtNdeck, UNHIGHLIGHT_DECK, XtNrail, callData->rail, NULL); } break; case ACTION_HIGHLIGHT_RAILS: #ifndef LEE_ABACUS if (callData->aux == PRIMARY) #endif { XtVaSetValues(AUXWIN(callData->aux), XtNdeck, HIGHLIGHTS_DECK, NULL); } break; case ACTION_CLEAR_NODEMO: case ACTION_CLEAR: XtVaSetValues(abacus, XtNdeck, CLEAR_DECK, NULL); #ifdef LEE_ABACUS /* Abacus demo clear is more complete */ if (leftAuxAbacus) XtVaSetValues(leftAuxAbacus, XtNdeck, CLEAR_DECK, NULL); if (rightAuxAbacus) XtVaSetValues(rightAuxAbacus, XtNdeck, CLEAR_DECK, NULL); #endif break; case ACTION_DECIMAL_CLEAR: XtVaSetValues(abacus, XtNdeck, CLEAR_DECIMAL_DECK, NULL); break; case ACTION_DEMO: XtDestroyWidget(abacusDemo); #ifdef HAVE_MOTIF /*XtVaSetValues(choiceMenu, XmNmenuHistory, choiceOptions[NORMAL], NULL);*/ #else /* Destroying shell is causing trouble, so lets not do that */ /* Warning: XtRemoveGrab asked to remove a widget not on the list */ /* http://www.mail-archive.com/lesstif@hungry.com/msg00535.html */ /*XtDestroyWidget(shell); shell = NULL;*/ XtUnrealizeWidget(shell); #endif XtVaSetValues(abacus, XtNdemo, False, NULL); #ifdef LEE_ABACUS if (leftAuxAbacus) XtVaSetValues(leftAuxAbacus, XtNdemo, False, NULL); if (rightAuxAbacus) XtVaSetValues(rightAuxAbacus, XtNdemo, False, NULL); #endif break; } if (callData->reason == ACTION_SCRIPT || callData->reason == ACTION_IGNORE) { #ifdef HAVE_MOTIF #ifdef LEE_ABACUS if (leftAuxTracker && leftAuxAbacus && w == leftAuxAbacus) printState(leftAuxTracker, callData->buffer); else if (rightAuxTracker && rightAuxAbacus && w == rightAuxAbacus) printState(rightAuxTracker, callData->buffer); else #endif printState(tracker, callData->buffer); #else printState(XtParent(w), callData->buffer, mode); #endif } } static void forceNormalParams(Widget w) { int base = DEFAULT_BASE; int displayBase = DEFAULT_BASE; #ifdef HAVE_MOTIF if (baseSet) { XmScaleSetValue(abacusBaseSlider, base); XmScaleSetValue(displayBaseSlider, displayBase); } #endif XtVaSetValues(abacus, XtNbase, base, XtNdisplayBase, displayBase, NULL); #ifdef LEE_ABACUS if (leftAuxAbacus) XtVaSetValues(leftAuxAbacus, XtNbase, base, XtNdisplayBase, displayBase, NULL); if (rightAuxAbacus) XtVaSetValues(rightAuxAbacus, XtNbase, base, XtNdisplayBase, displayBase, NULL); #endif } static void forceDemoParams(Widget w) { int rails, min, mode; int bottomPiece, bottomPiecePercent, shiftPercent; Boolean demo, teach, sign; forceNormalParams(w); XtVaGetValues(abacus, XtNmode, &mode, XtNrails, &rails, XtNsign, &sign, XtNbottomPiece, &bottomPiece, XtNbottomPiecePercent, &bottomPiecePercent, XtNshiftPercent, &shiftPercent, XtNdemo, &demo, XtNteach, &teach, NULL); if (mode == GENERIC) { mode = CHINESE; XtVaSetValues(abacus, XtNmode, mode, NULL); #ifdef HAVE_MOTIF XtVaSetValues(formatMenu, XmNmenuHistory, formatOptions[mode], NULL); #endif } min = ((sign) ? 1: 0) + ((bottomPiece != 0) ? 1 : 0) + ((bottomPiecePercent != 0) ? 1 + shiftPercent : 0) + ((demo || teach) ? MIN_DEMO_RAILS : MIN_RAILS); if (rails < min) { #ifdef HAVE_MOTIF XmScaleSetValue(sizeSlider, min); #endif XtVaSetValues(abacus, XtNrails, min, NULL); } } #ifdef HAVE_MOTIF static void forceTeachAbacus(Widget abacus, int base) { int anomaly, anomalySq, displayBase, mode; Boolean sign; XtVaGetValues(abacus, XtNsign, &sign, XtNanomaly, &anomaly, XtNanomalySq, &anomalySq, XtNmode, &mode, XtNdisplayBase, &displayBase, NULL); if (sign) XtVaSetValues(abacus, XtNsign, False, NULL); if (anomaly != 0) XtVaSetValues(abacus, XtNanomaly, 0, NULL); if (anomalySq != 0) XtVaSetValues(abacus, XtNanomalySq, 0, NULL); if (displayBase != base) XtVaSetValues(abacus, XtNdisplayBase, base, NULL); if (mode == GENERIC) { mode = CHINESE; XtVaSetValues(abacus, XtNmode, mode, NULL); XtVaSetValues(formatMenu, XmNmenuHistory, formatOptions[mode], NULL); } } static void forceTeachParams(Widget w) { int base; XtVaGetValues(abacus, XtNbase, &base, NULL); forceTeachAbacus(abacus, base); if (baseSet) { XmScaleSetValue(displayBaseSlider, base); } #ifdef LEE_ABACUS if (leftAuxAbacus) forceTeachAbacus(leftAuxAbacus, base); if (rightAuxAbacus) forceTeachAbacus(rightAuxAbacus, base); #endif } #endif static void initialize(Widget w) { Boolean versionOnly; XtVaGetValues(w, XtNversionOnly, &versionOnly, NULL); if (versionOnly) { (void) printf("%s\n", aboutHelp); exit(0); } #ifdef LEE_ABACUS initializeAux(); #endif } static void createDemo(void) { #ifdef HAVE_MOTIF /* This is to work around bug in LessTif # 2801540 */ /* Can not really use LESSTIF_VERSION as one may swap out lib */ int height, subheight = 134, newHeight = 0; if (XtIsRealized(topLevel)) XtVaGetValues(topLevel, XtNheight, &height, NULL); (void) sprintf(titleDspDemo, "%s-demo", progDsp); abacusDemo = XtCreateManagedWidget(titleDspDemo, abacusDemoWidgetClass, mainPanel, NULL, 0); if (XtIsRealized(topLevel)) { XtVaGetValues(abacusDemo, XtNheight, &newHeight, NULL); if (newHeight <= 1) XtVaSetValues(topLevel, XtNheight, height + subheight, NULL); } XtAddCallback(abacusDemo, XtNselectCallback, (XtCallbackProc) callbackAbacusDemo, (XtPointer) NULL); #else if (shell == NULL) shell = XtCreateApplicationShell(titleDsp, topLevelShellWidgetClass, NULL, 0); (void) sprintf(titleDspDemo, "%s-demo", progDsp); XtVaSetValues(shell, XtNiconPixmap, pixmap, XtNinput, True, XtNtitle, titleDspDemo, NULL); abacusDemo = XtCreateManagedWidget("abacusDemo", abacusDemoWidgetClass, shell, NULL, 0); XtAddCallback(abacusDemo, XtNselectCallback, (XtCallbackProc) callbackAbacusDemo, (XtPointer) NULL); #endif initializeDemo(); } static void realizeDemo(void) { #ifndef HAVE_MOTIF XtRealizeWidget(shell); #endif VOID XGrabButton(XtDisplay(abacusDemo), (unsigned int) AnyButton, AnyModifier, XtWindow(abacusDemo), TRUE, (unsigned int) (ButtonPressMask | ButtonMotionMask | ButtonReleaseMask), GrabModeAsync, GrabModeAsync, XtWindow(abacusDemo), XCreateFontCursor(XtDisplay(abacusDemo), XC_hand2)); } #ifdef HAVE_MOTIF static void abacusTeachListener(Widget w, caddr_t clientData, abacusCallbackStruct *callData) { Boolean demo; char * str = XmTextGetString(w); XtVaGetValues(abacus, XtNdemo, &demo, NULL); if (demo) return; if (str != NULL && strlen((char *) str) > 0) XtVaSetValues(abacus, XtNdeck, TEACH_DECK, XtNteachBuffer, str, NULL); free(str); } static void createTeach(void) { int columns = 120, subheight = 100; /* This is to work around bug in LessTif # 2801540 */ /* Can not really use LESSTIF_VERSION as one may swap out lib */ int height = 1, newHeight = 1; if (XtIsRealized(topLevel)) XtVaGetValues(topLevel, XtNheight, &height, NULL); teachRowCol = XtVaCreateManagedWidget("teachRowCol", xmRowColumnWidgetClass, mainPanel, XmNborderWidth, 1, XmNheight, subheight, NULL); if (XtIsRealized(topLevel)) { XtVaGetValues(teachRowCol, XtNheight, &newHeight, NULL); if (newHeight <= 1) XtVaSetValues(topLevel, XtNheight, height + subheight, NULL); } teachTracker = XtCreateManagedWidget("0", xmTextWidgetClass, teachRowCol, NULL, 0); teachLine[0] = XtVaCreateManagedWidget("teachText1", xmLabelGadgetClass, teachRowCol, XtVaTypedArg, XmNlabelString, XmRString, TEACH_STRING0, columns, NULL); teachLine[1] = XtVaCreateManagedWidget("teachText2", xmLabelGadgetClass, teachRowCol, XtVaTypedArg, XmNlabelString, XmRString, TEACH_STRING1, columns, NULL); teachLine[2] = XtVaCreateManagedWidget("teachText3", xmLabelGadgetClass, teachRowCol, XtVaTypedArg, XmNlabelString, XmRString, " ", columns, NULL); XtAddCallback(teachTracker, XmNactivateCallback, (XtCallbackProc) abacusTeachListener, (XtPointer) NULL); } static void destroyTeach(void) { XtDestroyWidget(teachTracker); XtDestroyWidget(teachLine[0]); XtDestroyWidget(teachLine[1]); XtDestroyWidget(teachLine[2]); XtDestroyWidget(teachRowCol); teachTracker = NULL; } #endif extern Pixel darker(Widget w, Pixel pixel); static void callbackAbacus(Widget w, caddr_t clientData, abacusCallbackStruct *callData) { int rails, decimalPosition, mode; Boolean slot, romanNumerals, ancientRoman, latin, modernRoman; Boolean group, sign, demo, teach; int bottomPiece, topPiece, bottomPiecePercent, topPiecePercent; int subdeck, subbase, museum, anomaly, anomalySq; Boolean rightToLeftAdd, rightToLeftMult; XtVaGetValues(w, XtNdemo, &demo, XtNteach, &teach, XtNmode, &mode, NULL); switch (callData->reason) { case ACTION_HIDE: (void) XIconifyWindow(XtDisplay(topLevel), XtWindow(topLevel), XScreenNumberOfScreen(XtScreen(topLevel))); #ifndef HAVE_MOTIF if (demo) (void) XIconifyWindow(XtDisplay(shell), XtWindow(shell), XScreenNumberOfScreen(XtScreen(shell))); #endif break; case ACTION_CLEAR_QUERY: #ifdef HAVE_MOTIF XtManageChild(clearDialog); #else XtVaSetValues(w, XtNmenu, ACTION_CLEAR, NULL); #endif break; case ACTION_SCRIPT: if (callData->deck != 0 || callData->number != 0) { (void) printf(" \n"); (void) printf(" %d %d %d %d 4\n", callData->aux, callData->deck, callData->rail, callData->number); (void) printf(" \n"); (void) printf(" Lesson\n\n\n"); (void) printf(" Press Space-bar to Continue\n"); (void) printf(" \n"); (void) printf(" \n"); } break; case ACTION_MOVE: #ifndef LEE_ABACUS if (callData->aux == PRIMARY) #endif { XtVaSetValues(AUXWIN(callData->aux), XtNdeck, callData->deck, XtNrail, callData->rail, XtNnumber, callData->number, NULL); } break; case ACTION_CLEAR: if (callData->aux == PRIMARY) XtVaSetValues(abacusDemo, XtNdeck, CLEAR_DECK, NULL); else XtVaSetValues(AUXWIN(callData->aux), XtNdeck, CLEAR_DECK, NULL); break; case ACTION_DEMO: demo = !demo; if (demo) { #ifdef HAVE_MOTIF if (baseSet) { forceNormalParams(abacus); baseSet = False; } #endif forceDemoParams(abacus); createDemo(); realizeDemo(); } else { XtDestroyWidget(abacusDemo); #ifndef HAVE_MOTIF /* Destroying shell is causing trouble, so lets not do that */ /* Warning: XtRemoveGrab asked to remove a widget not on the list */ /* http://www.mail-archive.com/lesstif@hungry.com/msg00535.html */ /*XtDestroyWidget(shell); shell = NULL;*/ XtUnrealizeWidget(shell); #endif } XtVaSetValues(abacus, XtNdemo, demo, NULL); #ifdef LEE_ABACUS if (leftAuxAbacus) XtVaSetValues(leftAuxAbacus, XtNdemo, demo, NULL); if (rightAuxAbacus) XtVaSetValues(rightAuxAbacus, XtNdemo, demo, NULL); #endif #ifdef HAVE_MOTIF /*XtVaSetValues(choiceMenu, XmNmenuHistory, choiceOptions[(demo) ? DEMO : NORMAL], NULL);*/ #endif break; #ifdef HAVE_MOTIF case ACTION_TEACH: if (teachTracker == NULL) { forceTeachParams(abacus); createTeach(); } else { destroyTeach(); } XtVaSetValues(abacus, XtNteach, (teachTracker == NULL) ? False : True, NULL); /*XtVaSetValues(choiceMenu, XmNmenuHistory, choiceOptions[(demo) ? TEACH : NORMAL], NULL);*/ break; case ACTION_TEACH_LINE: if (callData->line >= 0 && callData->line <= 2) { /*static XmStringCharSet charSet = (XmStringCharSet) XmSTRING_DEFAULT_CHARSET;*/ /*static XmStringCharSet charSet = "UTF-8";*/ XmString teachBuffer = NULL; if (teachTracker == NULL) createTeach(); /*teachBuffer = XmStringCreate(callData->teachBuffer, charSet);*/ /*teachBuffer = XmStringCreateLtoR(callData->teachBuffer, charSet);*/ teachBuffer = XmStringCreateLocalized(callData->teachBuffer); /*teachBuffer = XmStringGenerate(callData->teachBuffer, NULL, XmWIDECHAR_TEXT, NULL);*/ XtVaSetValues(teachLine[callData->line], XmNlabelString, teachBuffer, NULL); XmStringFree(teachBuffer); } break; #endif case ACTION_NEXT: XtVaSetValues(abacusDemo, XtNdeck, NEXT_DECK, NULL); break; case ACTION_REPEAT: XtVaSetValues(abacusDemo, XtNdeck, REPEAT_DECK, NULL); break; case ACTION_JUMP: XtVaSetValues(abacusDemo, XtNdeck, JUMP_DECK, NULL); break; case ACTION_MORE: XtVaSetValues(abacusDemo, XtNdeck, MORE_DECK, NULL); break; case ACTION_PLACE: XtVaGetValues(w, XtNslot, &slot, XtNdecimalPosition, &decimalPosition, XtNbottomPiece, &bottomPiece, XtNbottomPiecePercent, &bottomPiecePercent, XtNsubdeck, &subdeck, XtNsubbase, &subbase, XtNmuseum, &museum, NULL); #ifdef HAVE_MOTIF if (w == abacus) { XtVaSetValues(museumMenu, XmNmenuHistory, museum, NULL); XtSetSensitive(quarterPercentMenuItem, ENABLE_QUARTER_PERCENT(bottomPiece, bottomPiecePercent, decimalPosition)); XtSetSensitive(secondaryRailsMenu, ENABLE_SECONDARY(bottomPiece, bottomPiecePercent, decimalPosition, slot)); XtSetSensitive(subdeckMenuItem, ENABLE_SUBDECK(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, subbase, slot)); XtSetSensitive(eighthMenuItem, ENABLE_EIGHTH(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, subbase, slot)); XtSetSensitive(museumMenu, ENABLE_MUSEUM(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, slot)); } #endif break; case ACTION_INCREMENT: if (w == abacus) { XtVaGetValues(w, XtNrails, &rails, NULL); #ifdef HAVE_MOTIF if (rails > MAX_RAILS) XtVaSetValues(sizeSlider, XmNmaximum, rails, NULL); XmScaleSetValue(sizeSlider, rails); #endif } break; case ACTION_DECREMENT: if (w == abacus) { XtVaGetValues(w, XtNrails, &rails, NULL); #ifdef HAVE_MOTIF XmScaleSetValue(sizeSlider, rails); if (rails >= MAX_RAILS) XtVaSetValues(sizeSlider, XmNmaximum, rails, NULL); #endif } break; case ACTION_FORMAT: if (w == abacus) { #ifdef HAVE_MOTIF XtVaGetValues(w, XtNslot, &slot, XtNdecimalPosition, &decimalPosition, XtNbottomPiece, &bottomPiece, XtNbottomPiecePercent, &bottomPiecePercent, XtNsubdeck, &subdeck, XtNsubbase, &subbase, XtNmuseum, &museum, XtNanomaly, &anomaly, XtNanomalySq, &anomalySq, NULL); XtVaSetValues(formatMenu, XmNmenuHistory, formatOptions[mode], NULL); XtVaSetValues(museumMenu, XmNmenuHistory, museum, NULL); if (demo) { XtVaSetValues(abacusDemo, XtNdeck, CLEAR_DECK, XtNmode, mode, NULL); } XtSetSensitive(secondaryRailsMenu, ENABLE_SECONDARY(bottomPiece, bottomPiecePercent, decimalPosition, slot)); XtSetSensitive(subdeckMenuItem, ENABLE_SUBDECK(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, subbase, slot)); XtSetSensitive(eighthMenuItem, ENABLE_EIGHTH(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, subbase, slot)); XtSetSensitive(museumMenu, ENABLE_MUSEUM(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, slot)); XtSetSensitive(modernRomanMenuItem, ENABLE_MODERN_ROMAN(slot, anomaly, anomalySq)); #endif } break; case ACTION_ROMAN_NUMERALS: XtVaGetValues(w, XtNromanNumerals, &romanNumerals, XtNbottomPiece, &bottomPiece, NULL); #ifdef HAVE_MOTIF if (w == abacus) { XmToggleButtonSetState(romanNumeralsMenuItem, romanNumerals, False); XtSetSensitive(ancientRomanMenuItem, ENABLE_ANCIENT_ROMAN(romanNumerals)); XtSetSensitive(latinMenuItem, ENABLE_LATIN(romanNumerals, bottomPiece)); } #endif break; case ACTION_ANCIENT_ROMAN: XtVaGetValues(w, XtNancientRoman, &ancientRoman, NULL); #ifdef HAVE_MOTIF if (w == abacus) { XmToggleButtonSetState(ancientRomanMenuItem, ancientRoman, False); } #endif break; case ACTION_LATIN: XtVaGetValues(w, XtNlatin, &latin, NULL); #ifdef HAVE_MOTIF if (w == abacus) { XmToggleButtonSetState(latinMenuItem, latin, False); } #endif break; case ACTION_GROUP: XtVaGetValues(w, XtNgroup, &group, NULL); #ifdef HAVE_MOTIF if (w == abacus) { XmToggleButtonSetState(groupMenuItem, group, False); } #endif break; case ACTION_SIGN: XtVaGetValues(w, XtNsign, &sign, NULL); #ifdef HAVE_MOTIF if (w == abacus) { XmToggleButtonSetState(signMenuItem, sign, False); } #endif break; case ACTION_QUARTER: XtVaGetValues(w, XtNromanNumerals, &romanNumerals, XtNdecimalPosition, &decimalPosition, XtNslot, &slot, XtNbottomPiece, &bottomPiece, XtNtopPiece, &topPiece, XtNbottomPiecePercent, &bottomPiecePercent, XtNtopPiecePercent, &topPiecePercent, XtNsubdeck, &subdeck, XtNsubbase, &subbase, XtNmuseum, &museum, NULL); #ifdef HAVE_MOTIF if (w == abacus) { XmToggleButtonSetState(quarterMenuItem, SET_QUARTER(bottomPiece, topPiece), False); XtVaSetValues(museumMenu, XmNmenuHistory, museum, NULL); XtSetSensitive(latinMenuItem, ENABLE_LATIN(romanNumerals, bottomPiece)); XtSetSensitive(twelfthMenuItem, ENABLE_TWELFTH(bottomPiece)); XtSetSensitive(secondaryRailsMenu, ENABLE_SECONDARY(bottomPiece, bottomPiecePercent, decimalPosition, slot)); XtSetSensitive(quarterPercentMenuItem, ENABLE_QUARTER_PERCENT(bottomPiece, bottomPiecePercent, decimalPosition)); XtSetSensitive(subdeckMenuItem, ENABLE_SUBDECK(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, subbase, slot)); XtSetSensitive(eighthMenuItem, ENABLE_EIGHTH(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, subbase, slot)); XtSetSensitive(museumMenu, ENABLE_MUSEUM(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, slot)); } #endif break; case ACTION_TWELFTH: XtVaGetValues(w, XtNromanNumerals, &romanNumerals, XtNdecimalPosition, &decimalPosition, XtNslot, &slot, XtNbottomPiece, &bottomPiece, XtNtopPiece, &topPiece, XtNbottomPiecePercent, &bottomPiecePercent, XtNsubdeck, &subdeck, XtNsubbase, &subbase, XtNmuseum, &museum, NULL); #ifdef HAVE_MOTIF if (w == abacus) { XmToggleButtonSetState(twelfthMenuItem, SET_TWELFTH(bottomPiece, topPiece), False); XtVaSetValues(museumMenu, XmNmenuHistory, museum, NULL); XtSetSensitive(latinMenuItem, ENABLE_LATIN(romanNumerals, bottomPiece)); XtSetSensitive(quarterMenuItem, ENABLE_QUARTER(bottomPiece)); XtSetSensitive(quarterPercentMenuItem, ENABLE_QUARTER_PERCENT(bottomPiece, bottomPiecePercent, decimalPosition)); XtSetSensitive(secondaryRailsMenu, ENABLE_SECONDARY(bottomPiece, bottomPiecePercent, decimalPosition, slot)); XtSetSensitive(subdeckMenuItem, ENABLE_SUBDECK(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, subbase, slot)); XtSetSensitive(eighthMenuItem, ENABLE_EIGHTH(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, subbase, slot)); XtSetSensitive(museumMenu, ENABLE_MUSEUM(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, slot)); } #endif break; case ACTION_QUARTER_PERCENT: XtVaGetValues(w, XtNdecimalPosition, &decimalPosition, XtNbottomPiece, &bottomPiece, XtNbottomPiecePercent, &bottomPiecePercent, XtNtopPiecePercent, &topPiecePercent, XtNsubdeck, &subdeck, XtNsubbase, &subbase, XtNmuseum, &museum, NULL); #ifdef HAVE_MOTIF if (w == abacus) { XmToggleButtonSetState(quarterPercentMenuItem, SET_QUARTER_PERCENT(bottomPiece, bottomPiecePercent, topPiecePercent), False); XtVaSetValues(museumMenu, XmNmenuHistory, museum, NULL); XtSetSensitive(secondaryRailsMenu, ENABLE_SECONDARY(bottomPiece, bottomPiecePercent, decimalPosition, slot)); XtSetSensitive(subdeckMenuItem, ENABLE_SUBDECK(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, subbase, slot)); XtSetSensitive(eighthMenuItem, ENABLE_EIGHTH(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, subbase, slot)); XtSetSensitive(museumMenu, ENABLE_MUSEUM(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, slot)); } #endif break; case ACTION_SUBDECK: XtVaGetValues(w, XtNslot, &slot, XtNdecimalPosition, &decimalPosition, XtNbottomPiece, &bottomPiece, XtNbottomPiecePercent, &bottomPiecePercent, XtNsubdeck, &subdeck, XtNsubbase, &subbase, XtNmuseum, &museum, NULL); #ifdef HAVE_MOTIF if (w == abacus) { XtVaSetValues(museumMenu, XmNmenuHistory, museum, NULL); XtSetSensitive(quarterPercentMenuItem, ENABLE_QUARTER_PERCENT(bottomPiece, bottomPiecePercent, decimalPosition)); XtSetSensitive(eighthMenuItem, ENABLE_EIGHTH(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, subbase, slot)); XtSetSensitive(museumMenu, ENABLE_MUSEUM(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, slot)); } #endif break; case ACTION_EIGHTH: XtVaGetValues(w, XtNslot, &slot, XtNdecimalPosition, &decimalPosition, XtNbottomPiece, &bottomPiece, XtNbottomPiecePercent, &bottomPiecePercent, XtNsubdeck, &subdeck, XtNsubbase, &subbase, XtNmuseum, &museum, NULL); #ifdef HAVE_MOTIF if (w == abacus) { XtVaSetValues(museumMenu, XmNmenuHistory, museum, NULL); XtSetSensitive(quarterPercentMenuItem, ENABLE_QUARTER_PERCENT(bottomPiece, bottomPiecePercent, decimalPosition)); XtSetSensitive(subdeckMenuItem, ENABLE_SUBDECK(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, subbase, slot)); XtSetSensitive(museumMenu, ENABLE_MUSEUM(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, slot)); } #endif break; case ACTION_MUSEUM: XtVaGetValues(w, XtNmuseum, &museum, NULL); break; case ACTION_MODERN_ROMAN: XtVaGetValues(w, XtNmodernRoman, &modernRoman, NULL); #ifdef HAVE_MOTIF if (w == abacus) { XmToggleButtonSetState(modernRomanMenuItem, modernRoman, False); } #endif break; case ACTION_ANOMALY: XtVaGetValues(w, XtNslot, &slot, XtNanomaly, &anomaly, XtNanomalySq, &anomalySq, NULL); #ifdef HAVE_MOTIF if (w == abacus) { XmToggleButtonSetState(anomalyMenuItem, SET_ANOMALY(anomaly, anomalySq), False); XtSetSensitive(modernRomanMenuItem, ENABLE_MODERN_ROMAN(slot, anomaly, anomalySq)); XtSetSensitive(watchMenuItem, ENABLE_WATCH(anomaly, anomalySq)); } #endif break; case ACTION_WATCH: XtVaGetValues(w, XtNmodernRoman, &modernRoman, XtNanomaly, &anomaly, XtNanomalySq, &anomalySq, NULL); #ifdef HAVE_MOTIF if (w == abacus) { XmToggleButtonSetState(watchMenuItem, SET_WATCH(anomaly, anomalySq), False); XtSetSensitive(modernRomanMenuItem, ENABLE_MODERN_ROMAN(slot, anomaly, anomalySq)); XtSetSensitive(anomalyMenuItem, ENABLE_ANOMALY(anomaly, anomalySq)); } #endif break; #if 0 case ACTION_VERTICAL: XtVaGetValues(w, XtNvertical, &vertical, NULL); #ifdef HAVE_MOTIF if (w == abacus) { XmToggleButtonSetState(verticalMenuItem, vertical, False); } #endif break; #endif case ACTION_RIGHT_TO_LEFT_ADD : XtVaGetValues(w, XtNrightToLeftAdd, &rightToLeftAdd, NULL); #ifdef HAVE_MOTIF if (w == abacus) { XmToggleButtonSetState(rightToLeftAddMenuItem, rightToLeftAdd, False); } #endif break; case ACTION_RIGHT_TO_LEFT_MULT: XtVaGetValues(w, XtNrightToLeftMult, &rightToLeftMult, NULL); #ifdef HAVE_MOTIF if (w == abacus) { XmToggleButtonSetState(rightToLeftMultMenuItem, rightToLeftMult, False); } #endif break; } if (/*callData->reason == ACTION_SCRIPT || */callData->reason == ACTION_IGNORE) { #ifdef HAVE_MOTIF #ifdef LEE_ABACUS int initialValue = False; if (strcmp(callData->buffer, "0.0") == 0 || strcmp(callData->buffer, "0") == 0) { initialValue = True; } if (leftAuxTracker && leftAuxAbacus && w == leftAuxAbacus) { static Pixel leftAuxOrigColor; static Pixel leftAuxBeadColor; static int leftAuxFirstTime = True; static int leftAuxInitialColor = True; if (leftAuxFirstTime) { XtVaGetValues(w, XtNforeground, &leftAuxOrigColor, XtNleftAuxBeadColor, &leftAuxBeadColor, NULL); leftAuxBeadColor = darker(leftAuxAbacus, darker(leftAuxAbacus, leftAuxBeadColor)); leftAuxFirstTime = False; } if (initialValue && leftAuxInitialColor) { XtVaSetValues(leftAuxTracker, XtNforeground, leftAuxBeadColor, NULL); printState(leftAuxTracker, "Left Auxiliary"); } else { XtVaSetValues(leftAuxTracker, XtNforeground, leftAuxOrigColor, NULL); printState(leftAuxTracker, callData->buffer); leftAuxInitialColor = False; } } else if (rightAuxTracker && rightAuxAbacus && w == rightAuxAbacus) { static Pixel rightAuxOrigColor; static Pixel rightAuxBeadColor; static int rightAuxFirstTime = True; static int rightAuxInitialColor = True; if (rightAuxFirstTime) { XtVaGetValues(w, XtNforeground, &rightAuxOrigColor, XtNrightAuxBeadColor, &rightAuxBeadColor, NULL); rightAuxBeadColor = darker(rightAuxAbacus, darker(rightAuxAbacus, rightAuxBeadColor)); rightAuxFirstTime = False; } if (initialValue && rightAuxInitialColor) { XtVaSetValues(rightAuxTracker, XtNforeground, rightAuxBeadColor, NULL); printState(rightAuxTracker, "Right Auxiliary"); } else { XtVaSetValues(rightAuxTracker, XtNforeground, rightAuxOrigColor, NULL); printState(rightAuxTracker, callData->buffer); rightAuxInitialColor = False; } } else if (rightAuxAbacus) { /* just have to check one widget to make sure its lee */ static Pixel primaryOrigColor; static Pixel primaryBeadColor; static int primaryFirstTime = True; static int primaryInitialColor = True; if (primaryFirstTime) { XtVaGetValues(w, XtNforeground, &primaryOrigColor, XtNprimaryBeadColor, &primaryBeadColor, NULL); primaryBeadColor = darker(abacus, darker(abacus, primaryBeadColor)); primaryFirstTime = False; } if (initialValue && primaryInitialColor) { XtVaSetValues(tracker, XtNforeground, primaryBeadColor, NULL); printState(tracker, "Primary"); } else { XtVaSetValues(tracker, XtNforeground, primaryOrigColor, NULL); printState(tracker, callData->buffer); primaryInitialColor = False; } } else { printState(tracker, callData->buffer); } #else printState(tracker, callData->buffer); #endif #else printState(XtParent(w), callData->buffer, mode); #endif } } #ifdef HAVE_MOTIF static void abacusMathListener(Widget w, caddr_t clientData, abacusCallbackStruct *callData) { Boolean demo, teach; unsigned int i, j = 0; int aux; XtVaGetValues(abacus, XtNdemo, &demo, XtNteach, &teach, NULL); if (demo || teach) return; #ifdef LEE_ABACUS if (leftAuxTracker && leftAuxAbacus && w == leftAuxTracker) { aux = LEFT_AUX; } else if (rightAuxTracker && rightAuxAbacus && w == rightAuxTracker) { aux = RIGHT_AUX; } else #endif { aux = PRIMARY; } if (mathBuffer) free(mathBuffer); mathBuffer = XmTextGetString(w); /* strip out blanks */ for (i = 0; i < strlen(mathBuffer); i++) { if (mathBuffer[i] == '[' || mathBuffer[i] == ']') { mathBuffer[j] = '\0'; break; } else if (mathBuffer[i] != ' ' && mathBuffer[i] != '\t') { mathBuffer[j] = mathBuffer[i]; j++; } } /* check for math ops */ XtVaSetValues(abacus, XtNaux, aux, XtNdeck, CALC_DECK, XtNmathBuffer, mathBuffer, NULL); } static void abacusClearListener(Widget w, XtPointer clientData, XmAnyCallbackStruct *cbs) { if (cbs->reason == XmCR_OK) { XtVaSetValues(abacus, XtNmenu, ACTION_CLEAR, NULL); } } static void railChangeListener(Widget w, XtPointer clientData, XmScaleCallbackStruct *cbs) { int rails = cbs->value, old, min; int bottomPiece, bottomPiecePercent, shiftPercent; Boolean sign, demo; XtVaGetValues(abacus, XtNrails, &old, XtNsign, &sign, XtNbottomPiece, &bottomPiece, XtNbottomPiecePercent, &bottomPiecePercent, XtNshiftPercent, &shiftPercent, XtNdemo, &demo, NULL); min = ((sign) ? 1 : 0) + ((bottomPiece == 0) ? 0 : 1) + ((bottomPiecePercent == 0) ? 0 : 1 + shiftPercent) + ((demo) ? MIN_DEMO_RAILS : MIN_RAILS); if (rails < min) { XmScaleSetValue(sizeSlider, old); } else if (old != rails) XtVaSetValues(abacus, XtNrails, rails, NULL); } static void abacusBaseChangeListener(Widget w, XtPointer clientData, XmScaleCallbackStruct *cbs) { int base = cbs->value, old, bottomSpaces, mode; int bottomPiece, bottomPiecePercent; Boolean demo, teach; XtVaGetValues(abacus, XtNbase, &old, XtNbottomPiece, &bottomPiece, XtNbottomPiecePercent, &bottomPiecePercent, XtNbottomSpaces, &bottomSpaces, XtNmode, &mode, XtNdemo, &demo, XtNteach, &teach, NULL); if (demo) { base = DEFAULT_BASE; XmScaleSetValue(abacusBaseSlider, base); /* Odd bases produce round-off errors but OK */ /* When base divisible by 4, kind of silly but OK */ /* Well some of these have enough room in Russian but not others */ } else if ((base == 2 || base == 4) && bottomSpaces < 3) { XtVaSetValues(abacus, XtNbottomSpaces, 3, XtNbase, base, NULL); } else if ((base == 3 || base == 6 || base == 9) && bottomSpaces < 2) { XtVaSetValues(abacus, XtNbottomSpaces, 2, XtNbase, base, NULL); } else { XtVaSetValues(abacus, XtNbase, base, NULL); } if (demo || teach) { XmScaleSetValue(displayBaseSlider, base); XtVaSetValues(abacus, XtNdisplayBase, base, NULL); #ifdef LEE_ABACUS if (leftAuxAbacus) XtVaSetValues(leftAuxAbacus, XtNbase, base, XtNdisplayBase, base, NULL); if (rightAuxAbacus) XtVaSetValues(rightAuxAbacus, XtNbase, base, XtNdisplayBase, base, NULL); #endif #ifdef LEE_ABACUS } else { if (leftAuxAbacus) XtVaSetValues(leftAuxAbacus, XtNbase, base, NULL); if (rightAuxAbacus) XtVaSetValues(rightAuxAbacus, XtNbase, base, NULL); #endif } } static void displayBaseChangeListener(Widget w, XtPointer clientData, XmScaleCallbackStruct *cbs) { int displayBase = cbs->value, old, base; Boolean demo, teach; XtVaGetValues(abacus, XtNbase, &base, XtNdisplayBase, &old, XtNdemo, &demo, XtNteach, &teach, NULL); if (demo) base = DEFAULT_BASE; if (demo || teach) { XmScaleSetValue(displayBaseSlider, base); #ifdef LEE_ABACUS if (leftAuxAbacus) XtVaSetValues(leftAuxAbacus, XtNbase, base, XtNdisplayBase, displayBase, NULL); if (rightAuxAbacus) XtVaSetValues(rightAuxAbacus, XtNbase, base, XtNdisplayBase, displayBase, NULL); #endif } else { XtVaSetValues(abacus, XtNdisplayBase, displayBase, NULL); #ifdef LEE_ABACUS if (leftAuxAbacus) XtVaSetValues(leftAuxAbacus, XtNdisplayBase, displayBase, NULL); if (rightAuxAbacus) XtVaSetValues(rightAuxAbacus, XtNdisplayBase, displayBase, NULL); #endif } } static void delayChangeListener(Widget w, XtPointer clientData, XmScaleCallbackStruct *cbs) { int delay = cbs->value, old; /* min? */ XtVaGetValues(abacus, XtNdelay, &old, NULL); if (old != delay) XtVaSetValues(abacus, XtNdelay, delay, NULL); } #if 0 static void verticalToggle(Widget w, XtPointer clientData, XmToggleButtonCallbackStruct *cbs) { Boolean value = cbs->set; XtVaSetValues(abacus, XtNvertical, value, NULL); } #endif static void romanNumeralsToggle(Widget w, XtPointer clientData, XmToggleButtonCallbackStruct *cbs) { Boolean value = cbs->set; XtVaSetValues(abacus, XtNancientRoman, False, XtNromanNumerals, value, NULL); } static void ancientRomanToggle(Widget w, XtPointer clientData, XmToggleButtonCallbackStruct *cbs) { Boolean value = cbs->set; XtVaSetValues(abacus, XtNancientRoman, value, NULL); } static void latinToggle(Widget w, XtPointer clientData, XmToggleButtonCallbackStruct *cbs) { Boolean value = cbs->set; XtVaSetValues(abacus, XtNlatin, value, NULL); } static void groupToggle(Widget w, XtPointer clientData, XmToggleButtonCallbackStruct *cbs) { Boolean value = cbs->set; XtVaSetValues(abacus, XtNgroup, value, NULL); } static void signToggle(Widget w, XtPointer clientData, XmToggleButtonCallbackStruct *cbs) { Boolean value = cbs->set; XtVaSetValues(abacus, XtNsign, value, NULL); } static void quarterToggle(Widget w, XtPointer clientData, XmToggleButtonCallbackStruct *cbs) { Boolean value = cbs->set; XtVaSetValues(abacus, XtNtopPiece, 0, XtNbottomPiece, (value) ? 4 : 0, NULL); } static void quarterPercentToggle(Widget w, XtPointer clientData, XmToggleButtonCallbackStruct *cbs) { Boolean value = cbs->set; XtVaSetValues(abacus, XtNtopPiecePercent, 0, XtNbottomPiecePercent, (value) ? 4 : 0, NULL); } static void twelfthToggle(Widget w, XtPointer clientData, XmToggleButtonCallbackStruct *cbs) { Boolean value = cbs->set; XtVaSetValues(abacus, XtNtopPiece, 2, XtNbottomPiece, (value) ? 6 : 0, NULL); } static void subdeckToggle(Widget w, XtPointer clientData, XmToggleButtonCallbackStruct *cbs) { Boolean value = cbs->set; XtVaSetValues(abacus, XtNsubbase, 12, XtNsubdeck, (value) ? DEFAULT_SUBDECKS : 0, XtNsubbead, DEFAULT_SUBBEADS, NULL); } static void eighthToggle(Widget w, XtPointer clientData, XmToggleButtonCallbackStruct *cbs) { Boolean value = cbs->set; XtVaSetValues(abacus, XtNsubbase, 8, XtNsubdeck, (value) ? DEFAULT_SUBDECKS : 0, XtNsubbead, DEFAULT_SUBBEADS, NULL); } static void museumChoice(Widget w, XtPointer clientData, XtPointer callData) { int value = (int) ((size_t) value); XtVaSetValues(abacus, XtNmuseum, museumChoices[value], NULL); } static void modernRomanToggle(Widget w, XtPointer clientData, XmToggleButtonCallbackStruct *cbs) { Boolean value = cbs->set; XtVaSetValues(abacus, XtNmodernRoman, value, NULL); } static void anomalyToggle(Widget w, XtPointer clientData, XmToggleButtonCallbackStruct *cbs) { Boolean value = cbs->set; XtVaSetValues(abacus, XtNanomaly, (value) ? 2 : 0, XtNanomalySq, 0, NULL); } static void watchToggle(Widget w, XtPointer clientData, XmToggleButtonCallbackStruct *cbs) { Boolean value = cbs->set; XtVaSetValues(abacus, XtNanomaly, (value) ? 4 : 0, XtNanomalySq, (value) ? 4 : 0, NULL); } static void rightToLeftAddToggle(Widget w, XtPointer clientData, XmToggleButtonCallbackStruct *cbs) { Boolean value = cbs->set; XtVaSetValues(abacus, XtNrightToLeftAdd, value, NULL); } static void rightToLeftMultToggle(Widget w, XtPointer clientData, XmToggleButtonCallbackStruct *cbs) { Boolean value = cbs->set; XtVaSetValues(abacus, XtNrightToLeftMult, value, NULL); } static void soundToggle(Widget w, XtPointer clientData, XmToggleButtonCallbackStruct *cbs) { Boolean value = cbs->set; XtVaSetValues(abacus, XtNsound, value, NULL); } static void formatListener(Widget w, XtPointer value, XtPointer clientData) { Boolean demo, slot; int mode = (int) ((size_t) value), oldMode; int decimalPosition, bottomPiece, bottomPiecePercent; int subdeck, subbase, museum, anomaly, anomalySq; XtVaGetValues(abacus, XtNdecimalPosition, &decimalPosition, XtNbottomPiece, &bottomPiece, XtNbottomPiecePercent, &bottomPiecePercent, XtNsubdeck, &subdeck, XtNsubbase, &subbase, XtNmuseum, &museum, XtNslot, &slot, XtNanomaly, &anomaly, XtNanomalySq, &anomalySq, XtNmode, &oldMode, XtNdemo, &demo, NULL); if (mode < 0 || mode > MAX_FORMATS) mode = GENERIC; if (demo && mode == GENERIC) { XtVaSetValues(formatMenu, XmNmenuHistory, formatOptions[oldMode], NULL); return; } if (oldMode == ROMAN && mode != ROMAN && subdeck) { XtVaSetValues(abacus, XtNdeck, CLEAR_DECIMAL_DECK, NULL); } if (mode != GENERIC) slot = (mode == ROMAN); /* since just changed */ XtVaSetValues(abacus, XtNmode, mode, NULL); XtVaSetValues(museumMenu, XmNmenuHistory, museum, NULL); if (demo) { XtVaSetValues(abacusDemo, XtNdeck, CLEAR_DECK, XtNmode, mode, NULL); } XtSetSensitive(secondaryRailsMenu, ENABLE_SECONDARY(bottomPiece, bottomPiecePercent, decimalPosition, slot)); XtSetSensitive(subdeckMenuItem, ENABLE_SUBDECK(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, subbase, slot)); XtSetSensitive(eighthMenuItem, ENABLE_EIGHTH(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, subbase, slot)); XtSetSensitive(modernRomanMenuItem, ENABLE_MODERN_ROMAN(slot, anomaly, anomalySq)); XtSetSensitive(museumMenu, ENABLE_MUSEUM(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, slot)); } static void fileMenuListener(Widget w, XtPointer value, XtPointer clientData) { int val = (int) ((size_t) value); if (val == 0) exit(0); } static Widget createBaseSliders(Widget w, char *title) { Widget button, dialog, pane; Widget sliderRowCol; int base, displayBase; char titleDsp[FILE_NAME_LENGTH + 8]; XmString titleString = NULL; (void) sprintf(titleDsp, "%s: %s\n", progDsp, title); titleString = XmStringCreateSimple((char *) titleDsp); XtSetArg(args[0], XmNdialogTitle, titleString); dialog = XmCreateMessageDialog(w, title, args, 1); XmStringFree(titleString); pane = XtVaCreateWidget("pane", xmPanedWindowWidgetClass, dialog, XmNsashWidth, 1, XmNsashHeight, 1, NULL); sliderRowCol = XtVaCreateManagedWidget("sliderRowCol", xmRowColumnWidgetClass, pane, XmNnumColumns, 2, XmNorientation, XmHORIZONTAL, XmNpacking, XmPACK_COLUMN, NULL); XtVaGetValues(abacus, XtNdisplayBase, &displayBase, XtNbase, &base, NULL); displayBaseSlider = XtVaCreateManagedWidget("displayBase", xmScaleWidgetClass, sliderRowCol, XtVaTypedArg, XmNtitleString, XmRString, " Display Base", 18, XmNminimum, MIN_BASE, XmNmaximum, MAX_BASE, XmNscaleWidth, (MAX_BASE - MIN_BASE + 1) * 4, XmNvalue, displayBase, XmNshowValue, True, XmNorientation, XmHORIZONTAL, NULL); XtAddCallback(displayBaseSlider, XmNvalueChangedCallback, (XtCallbackProc) displayBaseChangeListener, (XtPointer) NULL); abacusBaseSlider = XtVaCreateManagedWidget("abacusBase", xmScaleWidgetClass, sliderRowCol, XtVaTypedArg, XmNtitleString, XmRString, " Abacus Base", 18, XmNminimum, MIN_BASE, XmNmaximum, MAX_BASE, XmNscaleWidth, (MAX_BASE - MIN_BASE + 1) * 4, XmNvalue, base, XmNshowValue, True, XmNorientation, XmHORIZONTAL, NULL); XtAddCallback(abacusBaseSlider, XmNvalueChangedCallback, (XtCallbackProc) abacusBaseChangeListener, (XtPointer) NULL); XtManageChild(pane); button = XmMessageBoxGetChild(dialog, XmDIALOG_CANCEL_BUTTON); XtUnmanageChild(button); button = XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON); XtUnmanageChild(button); return dialog; } static void controlMenuListener(Widget w, XtPointer value, XtPointer clientData) { int val = (int) ((size_t) value); if (val != 1) return; if (baseDialog != NULL) XtManageChild(baseDialog); } static void beadControlMenuListener(Widget w, XtPointer value, XtPointer clientData) { int val = (int) ((size_t) value); XtVaSetValues(abacus, XtNmenu, val + ACTION_CLEAR, NULL); } #ifdef EXTRA static void basicFormatMenuListener(Widget w, XtPointer value, XtPointer clientData) { int val = (int) ((size_t) value); XtVaSetValues(abacus, XtNmenu, val + ACTION_FORMAT, NULL); } #endif static void displayFormatMenuListener(Widget w, XtPointer value, XtPointer clientData) { int val = (int) ((size_t) value); XtVaSetValues(abacus, XtNmenu, val + ACTION_ROMAN_NUMERALS, NULL); } static void specialRailsMenuListener(Widget w, XtPointer value, XtPointer clientData) { int val = (int) ((size_t) value); XtVaSetValues(abacus, XtNmenu, val + ACTION_SIGN, NULL); } static void secondaryRailsMenuListener(Widget w, XtPointer value, XtPointer clientData) { int val = (int) ((size_t) value); XtVaSetValues(abacus, XtNmenu, val + ACTION_SUBDECK, NULL); } static void museumMenuListener(Widget w, XtPointer value, XtPointer clientData) { int val = (int) ((size_t) value); XtVaSetValues(abacus, XtNmuseum, museumChoices[val], NULL); } static void teachOptionsMenuListener(Widget w, XtPointer value, XtPointer clientData) { int val = (int) ((size_t) value); XtVaSetValues(abacus, XtNmenu, val + ACTION_RIGHT_TO_LEFT_ADD, NULL); } static Widget createQuery(Widget w, char *text, char *title, XtCallbackProc callback) { Widget button, messageBox; char titleDsp[FILE_NAME_LENGTH + 8]; XmString titleString = NULL, messageString = NULL; static XmStringCharSet charSet = (XmStringCharSet) XmSTRING_DEFAULT_CHARSET; messageString = XmStringCreateLtoR(text, charSet); (void) sprintf(titleDsp, "%s: %s", progDsp, title); titleString = XmStringCreateSimple((char *) titleDsp); XtSetArg(args[0], XmNdialogTitle, titleString); XtSetArg(args[1], XmNmessageString, messageString); messageBox = XmCreateWarningDialog(w, (char *) "queryBox", args, 2); button = XmMessageBoxGetChild(messageBox, XmDIALOG_HELP_BUTTON); XtUnmanageChild(button); XmStringFree(titleString); XmStringFree(messageString); XtAddCallback(messageBox, XmNokCallback, (XtCallbackProc) abacusClearListener, (XtPointer) NULL); XtAddCallback(messageBox, XmNcancelCallback, (XtCallbackProc) abacusClearListener, (XtPointer) NULL); return messageBox; } static Widget createDelaySlider(Widget w, char *title) { Widget dialog, pane, button; Widget sliderRowCol; int delay; char titleDsp[FILE_NAME_LENGTH + 8]; XmString titleString = NULL; (void) sprintf(titleDsp, "%s: %s\n", progDsp, title); titleString = XmStringCreateSimple((char *) titleDsp); dialog = XmCreateMessageDialog(w, title, NULL, 0); XmStringFree(titleString); pane = XtVaCreateWidget("pane", xmPanedWindowWidgetClass, dialog, XmNsashWidth, 1, XmNsashHeight, 1, NULL); sliderRowCol = XtVaCreateManagedWidget("sliderRowCol", xmRowColumnWidgetClass, pane, XmNnumColumns, 1, XmNorientation, XmHORIZONTAL, XmNpacking, XmPACK_COLUMN, NULL); XtVaGetValues(abacus, XtNdelay, &delay, NULL); delaySlider = XtVaCreateManagedWidget("delaySlider", xmScaleWidgetClass, sliderRowCol, XtVaTypedArg, XmNtitleString, XmRString, "msec Delay", 11, XmNminimum, 0, XmNmaximum, 500, XmNscaleWidth, 128, XmNvalue, delay, XmNshowValue, True, XmNorientation, XmHORIZONTAL, NULL); XtAddCallback(delaySlider, XmNvalueChangedCallback, (XtCallbackProc) delayChangeListener, (XtPointer) NULL); XtManageChild(pane); button = XmMessageBoxGetChild(dialog, XmDIALOG_CANCEL_BUTTON); XtUnmanageChild(button); button = XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON); XtUnmanageChild(button); return dialog; } static void effectsMenuListener(Widget w, XtPointer value, XtPointer clientData) { int val = (int) ((size_t) value); if (val == 0) { XtVaSetValues(abacus, XtNmenu, val + ACTION_SOUND, NULL); } else if (val == 1) { if (delayDialog != NULL) XtManageChild(delayDialog); } } static void learnMenuListener(Widget w, XtPointer value, XtPointer clientData) { Boolean wasDemo, wasTeach; int val = (int) ((size_t) value); XtVaGetValues(abacus, XtNdemo, &wasDemo, NULL); XtVaGetValues(abacus, XtNteach, &wasTeach, NULL); if (wasDemo) { XtVaSetValues(abacus, XtNdemo, !wasDemo, NULL); XtDestroyWidget(abacusDemo); return; } if (wasTeach) { XtVaSetValues(abacus, XtNteach, !wasTeach, NULL); destroyTeach(); return; } if (val == 0) { if (baseSet) { forceNormalParams(abacus); baseSet = False; } forceDemoParams(abacus); XtVaSetValues(abacus, XtNdemo, !wasDemo, NULL); createDemo(); realizeDemo(); } else if (val == 1) { forceTeachParams(abacus); XtVaSetValues(abacus, XtNteach, !wasTeach, NULL); createTeach(); } } static Widget createHelp(Widget w, char *text, char *title) { Widget button, messageBox; char titleDsp[FILE_NAME_LENGTH + 8]; XmString titleString = NULL, messageString = NULL, buttonString = NULL; static XmStringCharSet charSet = (XmStringCharSet) XmSTRING_DEFAULT_CHARSET; messageString = XmStringCreateLtoR(text, charSet); (void) sprintf(titleDsp, "%s: %s", progDsp, title); titleString = XmStringCreateSimple((char *) titleDsp); buttonString = XmStringCreateSimple((char *) "OK"); XtSetArg(args[0], XmNdialogTitle, titleString); XtSetArg(args[1], XmNokLabelString, buttonString); XtSetArg(args[2], XmNmessageString, messageString); messageBox = XmCreateInformationDialog(w, (char *) "helpBox", args, 3); button = XmMessageBoxGetChild(messageBox, XmDIALOG_CANCEL_BUTTON); XtUnmanageChild(button); button = XmMessageBoxGetChild(messageBox, XmDIALOG_HELP_BUTTON); XtUnmanageChild(button); XmStringFree(titleString); XmStringFree(buttonString); XmStringFree(messageString); return messageBox; } /*http://www.ist.co.uk/motif/books/vol6A/ch-5.fm.html*/ static Widget createScrollHelp(Widget w, const char *text, char *title) { Widget dialog, pane, scrolledText, form, label, button; int n = 0; char titleDsp[FILE_NAME_LENGTH + 8]; XmString titleString = NULL; (void) sprintf(titleDsp, "%s: %s", progDsp, title); dialog = XmCreateMessageDialog(w, titleDsp, NULL, 0); titleString = XmStringCreateSimple((char *) titleDsp); pane = XtVaCreateWidget("pane", xmPanedWindowWidgetClass, dialog, XmNsashWidth, 1, XmNsashHeight, 1, NULL); form = XtVaCreateWidget("form", xmFormWidgetClass, pane, NULL); label = XtVaCreateManagedWidget("label", xmLabelGadgetClass, form, XmNlabelType, XmPIXMAP, XmNlabelPixmap, pixmap, XmNleftAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); XtSetArg(args[n], XmNdialogTitle, titleString); n++; XtSetArg(args[n], XmNscrollVertical, True); n++; XtSetArg(args[n], XmNscrollHorizontal, False); n++; XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++; XtSetArg(args[n], XmNeditable, False); n++; XtSetArg(args[n], XmNcursorPositionVisible, False); n++; XtSetArg(args[n], XmNwordWrap, False); n++; XtSetArg(args[n], XmNresizeWidth, True); n++; XtSetArg(args[n], XmNvalue, text); n++; XtSetArg(args[n], XmNrows, SCROLL_SIZE); n++; scrolledText = XmCreateScrolledText(form, "helpText", args, n); XtVaSetValues(XtParent(scrolledText), XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, label, XmNtopAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); XmStringFree(titleString); XtManageChild(scrolledText); XtManageChild(form); XtManageChild(pane); button = XmMessageBoxGetChild(dialog, XmDIALOG_CANCEL_BUTTON); XtUnmanageChild(button); button = XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON); XtUnmanageChild(button); return dialog; } static void helpMenuListener(Widget w, XtPointer value, XtPointer clientData) { int val = (int) ((size_t) value); switch (val) { case 0: XtManageChild(descriptionDialog); break; case 1: XtManageChild(featuresDialog); break; case 2: XtManageChild(synopsisDialog); break; case 3: XtManageChild(optionsDialog); break; case 4: XtManageChild(referencesDialog); break; case 5: XtManageChild(aboutDialog); break; default: { char *buf; intCat(&buf, "helpMenuListener: %d", val); XtWarning(buf); free(buf); } } } #endif int main(int argc, char **argv) { Boolean demo; int pixmapSize; #ifdef HAVE_MOTIF Boolean teach, slot; int base = DEFAULT_BASE, displayBase = DEFAULT_BASE; int decimalPosition = DEFAULT_DECIMAL_POSITION; Widget menuBar, pullDownMenu, popupMenu, widget; Widget specialRailsMenu, museumMenuItem; Widget menuBarPanel, controlPanel; Widget controlRowCol, trackerRowCol; Widget auxForm; Widget displayFormatMenu; Widget teachMenu, effectsMenu; #ifdef LEE_ABACUS Widget auxTrackerForm; Boolean lee; Pixel leftAuxColor, rightAuxColor; int leftAuxRails, rightAuxRails; #endif Boolean rightToLeftAdd, rightToLeftMult; Boolean sound; XmString fileString, controlsString, learnString; XmString quitString, clearString, complementString; /*XmString modeString, incrementString, decrementString;*/ XmString romanNumeralsString, ancientRomanString; XmString latinString, groupString, signString; XmString quarterString, quarterPercentString; XmString twelfthString, subdeckString, eighthString; XmString modernRomanString; XmString anomalyString, watchString; XmString rightToLeftAddString, rightToLeftMultString; XmString soundString, delayString; XmString format, formatStrings[MAX_MODES], museumString; XmString itString, ukString, frString; XmString beadControlString/*, basicFormatString*/; XmString baseSettingsString, displayFormatString; XmString specialRailsString, secondaryRailsString; XmString demoString, teachString; XmString teachOptionsString, effectsString; #define OPTIONS_SIZE (sizeof (options1Help) + sizeof (options2Help) + sizeof (options3Help) + sizeof (options4Help) + 4) char optionsHelp[OPTIONS_SIZE]; int rails, mode; int bottomPiece, topPiece, bottomPiecePercent, topPiecePercent; int subdeck, subbase, museum, anomaly, anomalySq; Boolean romanNumerals, ancientRoman, latin, modernRoman; Boolean group, sign; unsigned int i; #endif progDsp = argv[0]; topLevel = XtInitialize(argv[0], "Abacus", options, XtNumber(options), &argc, argv); if (argc != 1) usage(argv[0]); #ifdef HAVE_MOTIF menuBarPanel = XtVaCreateManagedWidget("menuBarPanel", xmPanedWindowWidgetClass, topLevel, XmNseparatorOn, False, XmNsashWidth, 1, XmNsashHeight, 1, NULL); fileString = XmStringCreateSimple((char *) "File"); controlsString = XmStringCreateSimple((char *) "Controls"); learnString = XmStringCreateSimple((char *) "Learn"); menuBar = XmVaCreateSimpleMenuBar(menuBarPanel, (char *) "menuBar", XmVaCASCADEBUTTON, fileString, 'F', XmVaCASCADEBUTTON, controlsString, 'C', XmVaCASCADEBUTTON, learnString, 'L', NULL); XmStringFree(fileString); XmStringFree(controlsString); quitString = XmStringCreateSimple((char *) "Exit"); (void) XmVaCreateSimplePulldownMenu(menuBar, (char *) "fileMenu", 0, fileMenuListener, XmVaSEPARATOR, XmVaPUSHBUTTON, quitString, 'x', NULL, NULL, NULL); XmStringFree(quitString); beadControlString = XmStringCreateSimple((char *) "Bead Control"); baseSettingsString = XmStringCreateSimple((char *) "Base Settings"); #ifdef EXTRA basicFormatString = XmStringCreateSimple((char *) "Basic Format"); #endif displayFormatString = XmStringCreateSimple((char *) "Display Format"); specialRailsString = XmStringCreateSimple((char *) "Special Rails"); teachOptionsString = XmStringCreateSimple((char *) "Teach Options"); effectsString = XmStringCreateSimple((char *) "Effects"); clearString = XmStringCreateSimple((char *) "Clear"); complementString = XmStringCreateSimple((char *) "Complement ~"); /*modeString = XmStringCreateSimple((char *) "Format"); incrementString = XmStringCreateSimple((char *) "Increment"); decrementString = XmStringCreateSimple((char *) "Decrement");*/ romanNumeralsString = XmStringCreateSimple((char *) "Roman Nvmerals"); ancientRomanString = XmStringCreateSimple((char *) "Ancient Roman ("); latinString = XmStringCreateSimple((char *) "Latin ~"); groupString = XmStringCreateSimple((char *) "Group"); signString = XmStringCreateSimple((char *) "Sign"); quarterString = XmStringCreateSimple((char *) "Quarter"); twelfthString = XmStringCreateSimple((char *) "Twelfth"); secondaryRailsString = XmStringCreateSimple((char *) "Secondary Rails"); quarterPercentString = XmStringCreateSimple((char *) "Quarter Percent"); subdeckString = XmStringCreateSimple((char *) "Subdeck"); eighthString = XmStringCreateSimple((char *) "Eighth"); museumString = XmStringCreateSimple((char *) "Museum"); itString = XmStringCreateSimple((char *) "Italian"); ukString = XmStringCreateSimple((char *) "British"); frString = XmStringCreateSimple((char *) "French"); modernRomanString = XmStringCreateSimple((char *) "Modern Roman )"); anomalyString = XmStringCreateSimple((char *) "Anomaly"); watchString = XmStringCreateSimple((char *) "Watch"); rightToLeftAddString = XmStringCreateSimple((char *) "Right To Left Add +"); rightToLeftMultString = XmStringCreateSimple((char *) "Right To Left Multiplicand *"); soundString = XmStringCreateSimple((char *) "Sound @"); delayString = XmStringCreateSimple((char *) "Delay"); demoString = XmStringCreateSimple((char *) "Demo"); teachString = XmStringCreateSimple((char *) "Teach $"); popupMenu = XmVaCreateSimplePulldownMenu(menuBar, (char *) "controlsMenu", 1, controlMenuListener, XmVaCASCADEBUTTON, beadControlString, 'B', #ifdef EXTRA XmVaCASCADEBUTTON, basicFormatString, 'F', #endif XmVaPUSHBUTTON, baseSettingsString, 'S', NULL, NULL, XmVaCASCADEBUTTON, displayFormatString, 'D', XmVaCASCADEBUTTON, specialRailsString, 'R', XmVaCASCADEBUTTON, teachOptionsString, 'T', XmVaCASCADEBUTTON, effectsString, 'E', NULL); XmStringFree(beadControlString); #ifdef EXTRA XmStringFree(basicFormatString); #endif XmStringFree(baseSettingsString); XmStringFree(displayFormatString); XmStringFree(specialRailsString); XmStringFree(teachOptionsString); XmStringFree(effectsString); (void) XmVaCreateSimplePulldownMenu(popupMenu, (char *) "BeadControlMenu", 0, beadControlMenuListener, XmVaPUSHBUTTON, clearString, 'C', NULL, NULL, XmVaPUSHBUTTON, complementString, '~', NULL, NULL, NULL); XmStringFree(clearString); XmStringFree(complementString); #ifdef EXTRA (void) XmVaCreateSimplePulldownMenu(popupMenu, (char *) "BasicFormatMenu", 1, basicFormatMenuListener, XmVaPUSHBUTTON, modeString, 'F', NULL, NULL, XmVaPUSHBUTTON, incrementString, 'I', NULL, NULL, XmVaPUSHBUTTON, decrementString, 'D', NULL, NULL, NULL); XmStringFree(modeString); XmStringFree(incrementString); XmStringFree(decrementString); #endif displayFormatMenu = XmVaCreateSimplePulldownMenu(popupMenu, (char *) "DisplayFormatMenu", 2, displayFormatMenuListener, XmVaTOGGLEBUTTON, romanNumeralsString, 'v', NULL, NULL, XmVaTOGGLEBUTTON, ancientRomanString, '(', NULL, NULL, XmVaTOGGLEBUTTON, latinString, '~', NULL, NULL, XmVaTOGGLEBUTTON, groupString, 'G', NULL, NULL, NULL); XmStringFree(romanNumeralsString); XmStringFree(ancientRomanString); XmStringFree(latinString); XmStringFree(groupString); specialRailsMenu = XmVaCreateSimplePulldownMenu(popupMenu, (char *) "SpecialRailsMenu", 3, specialRailsMenuListener, XmVaTOGGLEBUTTON, signString, 'S', NULL, NULL, XmVaTOGGLEBUTTON, quarterString, 'u', NULL, NULL, XmVaTOGGLEBUTTON, quarterPercentString, 'P', NULL, NULL, XmVaTOGGLEBUTTON, twelfthString, 'T', NULL, NULL, XmVaCASCADEBUTTON, secondaryRailsString, 'R', XmVaTOGGLEBUTTON, modernRomanString, ')', NULL, NULL, XmVaTOGGLEBUTTON, anomalyString, 'l', NULL, NULL, XmVaTOGGLEBUTTON, watchString, 'W', NULL, NULL, NULL); XmStringFree(signString); XmStringFree(quarterString); XmStringFree(twelfthString); XmStringFree(secondaryRailsString); XmStringFree(modernRomanString); XmStringFree(anomalyString); XmStringFree(watchString); secondaryRailsMenu = XmVaCreateSimplePulldownMenu(specialRailsMenu, (char *) "SecondaryRailsMenu", 4, secondaryRailsMenuListener, XmVaTOGGLEBUTTON, subdeckString, 'b', NULL, NULL, XmVaTOGGLEBUTTON, eighthString, 'E', NULL, NULL, XmVaCASCADEBUTTON, museumString, 'M', NULL); XmStringFree(quarterPercentString); XmStringFree(subdeckString); XmStringFree(eighthString); XmStringFree(museumString); museumMenu = XmVaCreateSimplePulldownMenu(secondaryRailsMenu, (char *) "MuseumMenu", 2, museumMenuListener, XmVaRADIOBUTTON, itString, 'I', NULL, NULL, XmVaRADIOBUTTON, ukString, 'B', NULL, NULL, XmVaRADIOBUTTON, frString, 'F', NULL, NULL, XmNradioBehavior, True, XmNradioAlwaysOne, True, NULL); XmStringFree(itString); XmStringFree(ukString); XmStringFree(frString); teachMenu = XmVaCreateSimplePulldownMenu(popupMenu, (char *) "TeachMenu", 4, teachOptionsMenuListener, XmVaTOGGLEBUTTON, rightToLeftAddString, '+', NULL, NULL, XmVaTOGGLEBUTTON, rightToLeftMultString, '*', NULL, NULL, NULL); XmStringFree(rightToLeftAddString); XmStringFree(rightToLeftMultString); effectsMenu = XmVaCreateSimplePulldownMenu(popupMenu, (char *) "EffectsMenu", 5, effectsMenuListener, XmVaTOGGLEBUTTON, soundString, '@', NULL, NULL, XmVaPUSHBUTTON, delayString, 'D', NULL, NULL, NULL); XmStringFree(soundString); XmStringFree(delayString); learnString = XmStringCreateSimple((char *) "Learn"); (void) XmVaCreateSimplePulldownMenu(menuBar, (char *) "LearnMenu", 2, learnMenuListener, XmVaPUSHBUTTON, demoString, 'o', NULL, NULL, XmVaPUSHBUTTON, teachString, '$', NULL, NULL, NULL); XmStringFree(demoString); XmStringFree(teachString); XmStringFree(learnString); pullDownMenu = XmCreatePulldownMenu(menuBar, (char *) "helpPullDown", NULL, 0); widget = XtVaCreateManagedWidget("Help", xmCascadeButtonWidgetClass, menuBar, XmNsubMenuId, pullDownMenu, XmNmnemonic, 'H', NULL); /* mnemonic error on Cygwin */ XtVaSetValues(menuBar, XmNmenuHelpWidget, widget, NULL); widget = XtVaCreateManagedWidget("Description", xmPushButtonGadgetClass, pullDownMenu, XmNmnemonic, 'D', NULL); XtAddCallback(widget, XmNactivateCallback, helpMenuListener, (char *) 0); widget = XtVaCreateManagedWidget("Features", xmPushButtonGadgetClass, pullDownMenu, XmNmnemonic, 'F', NULL); XtAddCallback(widget, XmNactivateCallback, helpMenuListener, (char *) 1); widget = XtVaCreateManagedWidget("Synopsis", xmPushButtonGadgetClass, pullDownMenu, XmNmnemonic, 'S', NULL); XtAddCallback(widget, XmNactivateCallback, helpMenuListener, (char *) 2); widget = XtVaCreateManagedWidget("Options", xmPushButtonGadgetClass, pullDownMenu, XmNmnemonic, 'O', NULL); XtAddCallback(widget, XmNactivateCallback, helpMenuListener, (char *) 3); widget = XtVaCreateManagedWidget("References", xmPushButtonGadgetClass, pullDownMenu, XmNmnemonic, 'R', NULL); XtAddCallback(widget, XmNactivateCallback, helpMenuListener, (char *) 4); widget = XtVaCreateManagedWidget("About", xmPushButtonGadgetClass, pullDownMenu, XmNmnemonic, 'A', NULL); XtAddCallback(widget, XmNactivateCallback, helpMenuListener, (char *) 5); XtManageChild(menuBar); clearDialog = createQuery(topLevel, (char *) "Are you sure you want to destroy the calculation?", (char *) "Clear Query", (XtCallbackProc) abacusClearListener); mainPanel = XtCreateManagedWidget("mainPanel", xmPanedWindowWidgetClass, menuBarPanel, NULL, 0); controlPanel = XtVaCreateManagedWidget("controlPanel", xmPanedWindowWidgetClass, mainPanel, XmNseparatorOn, False, XmNsashWidth, 1, XmNsashHeight, 1, NULL); #ifdef MOUSEBITMAPS { /* Takes up valuable real estate. */ Widget bitmapRowCol; Pixmap mouseLeftCursor, mouseRightCursor; Pixel fg, bg; bitmapRowCol = XtVaCreateManagedWidget("bitmapRowCol", xmRowColumnWidgetClass, controlPanel, XmNnumColumns, 4, XmNpacking, XmPACK_COLUMN, NULL); (void) XtVaGetValues(bitmapRowCol, XmNforeground, &fg, XmNbackground, &bg, NULL); mouseLeftCursor = XCreatePixmapFromBitmapData( XtDisplay(bitmapRowCol), RootWindowOfScreen(XtScreen(bitmapRowCol)), (char *) mouse_left_bits, mouse_left_width, mouse_left_height, fg, bg, DefaultDepthOfScreen(XtScreen(bitmapRowCol))); mouseRightCursor = XCreatePixmapFromBitmapData( XtDisplay(bitmapRowCol), RootWindowOfScreen(XtScreen(bitmapRowCol)), (char *) mouse_right_bits, mouse_right_width, mouse_right_height, fg, bg, DefaultDepthOfScreen(XtScreen(bitmapRowCol))); (void) XtVaCreateManagedWidget("mouseLeftText", xmLabelGadgetClass, bitmapRowCol, XtVaTypedArg, XmNlabelString, XmRString, "Move bead", 10, NULL); (void) XtVaCreateManagedWidget("mouseLeft", xmLabelGadgetClass, bitmapRowCol, XmNlabelType, XmPIXMAP, XmNlabelPixmap, mouseLeftCursor, NULL); (void) XtVaCreateManagedWidget("mouseRightText", xmLabelGadgetClass, bitmapRowCol, XtVaTypedArg, XmNlabelString, XmRString, " Clear", 10, NULL); (void) XtVaCreateManagedWidget("mouseRight", xmLabelGadgetClass, bitmapRowCol, XmNlabelType, XmPIXMAP, XmNlabelPixmap, mouseRightCursor, NULL); } #endif controlRowCol = XtVaCreateManagedWidget("controlRowCol", xmRowColumnWidgetClass, controlPanel, XmNnumColumns, 1, XmNorientation, XmHORIZONTAL, XmNpacking, XmPACK_COLUMN, NULL); auxForm = XtVaCreateManagedWidget("auxForm", xmFormWidgetClass, mainPanel, NULL); abacus = XtVaCreateManagedWidget("abacus", #ifdef LEE_KO XtNformat, "Korean", #endif abacusWidgetClass, auxForm, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_POSITION, NULL); trackerRowCol = XtVaCreateManagedWidget("trackerRowCol", xmRowColumnWidgetClass, controlPanel, NULL); #ifdef LEE_ABACUS XtVaGetValues(abacus, XtNlee, &lee, XtNleftAuxBeadColor, &leftAuxColor, XtNrightAuxBeadColor, &rightAuxColor, XtNleftAuxRails, &leftAuxRails, XtNrightAuxRails, &rightAuxRails, XtNdecimalPosition, &decimalPosition, XtNbase, &base, XtNdisplayBase, &displayBase, NULL); if (lee) { XtVaSetValues(auxForm, XmNfractionBase, leftAuxRails + rightAuxRails, NULL); auxTrackerForm = XtVaCreateManagedWidget("auxTrackerRowCol", xmFormWidgetClass, trackerRowCol, XmNfractionBase, leftAuxRails + rightAuxRails, NULL); leftAuxTracker = XtVaCreateManagedWidget("0.0", xmTextWidgetClass, auxTrackerForm, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_POSITION, XmNbottomAttachment, XmATTACH_FORM, XmNrightPosition, leftAuxRails, NULL); XtAddCallback(leftAuxTracker, XmNactivateCallback, (XtCallbackProc) abacusMathListener, (XtPointer) NULL); rightAuxTracker = XtVaCreateManagedWidget("0.0", xmTextWidgetClass, auxTrackerForm, XmNtopAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, XmNbottomAttachment, XmATTACH_FORM, XmNleftWidget, leftAuxTracker, NULL); XtAddCallback(rightAuxTracker, XmNactivateCallback, (XtCallbackProc) abacusMathListener, (XtPointer) NULL); } #endif tracker = XtCreateManagedWidget("0.0", xmTextWidgetClass, trackerRowCol, NULL, 0); XtAddCallback(tracker, XmNactivateCallback, (XtCallbackProc) abacusMathListener, (XtPointer) NULL); #ifdef LEE_ABACUS if (lee) { XtVaSetValues(abacus, XmNtopPosition, 5, NULL); } if (lee) { leftAuxAbacus = XtVaCreateManagedWidget("leftAuxAbacus", abacusWidgetClass, auxForm, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_WIDGET, XmNrightAttachment, XmATTACH_POSITION, XmNbottomWidget, abacus, XtNformat, "Japanese", XtNaux, LEFT_AUX, XtNprimaryBeadColor, leftAuxColor, XmNrightPosition, leftAuxRails, XtNrails, leftAuxRails, XtNdecimalPosition, decimalPosition, XtNbase, base, XtNdisplayBase, displayBase, NULL); XtAddCallback(leftAuxAbacus, XtNselectCallback, (XtCallbackProc) callbackAbacus, (XtPointer) NULL); rightAuxAbacus = XtVaCreateManagedWidget("rightAuxAbacus", abacusWidgetClass, auxForm, XmNtopAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, abacus, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, leftAuxAbacus, XtNformat, "Japanese", XtNaux, RIGHT_AUX, XtNprimaryBeadColor, rightAuxColor, XtNrails, rightAuxRails, XtNdecimalPosition, decimalPosition, XtNbase, base, XtNdisplayBase, displayBase, NULL); XtAddCallback(rightAuxAbacus, XtNselectCallback, (XtCallbackProc) callbackAbacus, (XtPointer) NULL); } #endif #else abacus = XtCreateManagedWidget("abacus", abacusWidgetClass, topLevel, NULL, 0); #endif XtVaGetValues(abacus, #ifdef HAVE_MOTIF XtNrails, &rails, XtNromanNumerals, &romanNumerals, XtNancientRoman, &ancientRoman, XtNlatin, &latin, XtNgroup, &group, XtNsign, &sign, XtNbottomPiece, &bottomPiece, XtNtopPiece, &topPiece, XtNbottomPiecePercent, &bottomPiecePercent, XtNtopPiecePercent, &topPiecePercent, XtNsubdeck, &subdeck, XtNmuseum, &museum, XtNmodernRoman, &modernRoman, XtNanomaly, &anomaly, XtNanomalySq, &anomalySq, XtNrightToLeftAdd, &rightToLeftAdd, XtNrightToLeftMult, &rightToLeftMult, XtNslot, &slot, XtNsubbase, &subbase, XtNbase, &base, XtNdisplayBase, &displayBase, XtNmode, &mode, XtNteach, &teach, XtNsound, &sound, #endif XtNdemo, &demo, XtNpixmapSize, &pixmapSize, NULL); #ifdef HAVE_XPM { XpmAttributes xpmAttributes; XpmColorSymbol transparentColor[1] = {{NULL, (char *) "none", 0 }}; Pixel bg; xpmAttributes.valuemask = XpmColorSymbols | XpmCloseness; xpmAttributes.colorsymbols = transparentColor; xpmAttributes.numsymbols = 1; xpmAttributes.closeness = 40000; XtVaGetValues(topLevel, XtNbackground, &bg, NULL); transparentColor[0].pixel = bg; (void) XpmCreatePixmapFromData(XtDisplay(topLevel), RootWindowOfScreen(XtScreen(topLevel)), RESIZE_XPM(pixmapSize), &pixmap, NULL, &xpmAttributes); } if (pixmap == (Pixmap) NULL) #endif pixmap = XCreateBitmapFromData(XtDisplay(topLevel), RootWindowOfScreen(XtScreen(topLevel)), (char *) abacus_64x64_bits, abacus_64x64_width, abacus_64x64_height); XtVaSetValues(topLevel, #ifdef HAVE_MOTIF XmNkeyboardFocusPolicy, XmPOINTER, /* not XmEXPLICIT */ #else XtNinput, True, #endif XtNiconPixmap, pixmap, NULL); XtAddCallback(abacus, XtNselectCallback, (XtCallbackProc) callbackAbacus, (XtPointer) NULL); #ifdef HAVE_MOTIF strcpy(descriptionHelp, description1Help); strcat(descriptionHelp, "\n"); strcat(descriptionHelp, description2Help); descriptionDialog = createScrollHelp(menuBar, (char *) descriptionHelp, (char *) "Description"); featuresDialog = createScrollHelp(menuBar, (char *) featuresHelp, (char *) "Features"); synopsisDialog = createHelp(menuBar, (char *) synopsisHelp, (char *) "Synopsis"); strcpy(optionsHelp, options1Help); strcat(optionsHelp, "\n"); strcat(optionsHelp, options2Help); strcat(optionsHelp, "\n"); strcat(optionsHelp, options3Help); strcat(optionsHelp, "\n"); strcat(optionsHelp, options4Help); optionsDialog = createScrollHelp(menuBar, (char *) optionsHelp, (char *) "Options"); referencesDialog = createHelp(menuBar, (char *) referencesHelp, (char *) "References"); aboutDialog = createHelp(menuBar, (char *) aboutHelp, (char *) "About"); baseDialog = createBaseSliders(topLevel, (char *) "Base"); delayDialog = createDelaySlider(topLevel, (char *) "Slider"); sizeSlider = XtVaCreateManagedWidget("rails", xmScaleWidgetClass, controlRowCol, XtVaTypedArg, XmNtitleString, XmRString, " Abacus Size", 18, XmNminimum, MIN_RAILS, XmNmaximum, MAX_RAILS, XmNscaleWidth, (MAX_RAILS - MIN_RAILS + 1) * 6, XmNvalue, rails, XmNshowValue, True, XmNorientation, XmHORIZONTAL, NULL); XtAddCallback(sizeSlider, XmNvalueChangedCallback, (XtCallbackProc) railChangeListener, (XtPointer) NULL); baseSet = ((base != DEFAULT_BASE || displayBase != DEFAULT_BASE) && !demo); if (mode < 0 || mode > MAX_FORMATS) mode = GENERIC; if (demo && mode == GENERIC) mode = CHINESE; format = XmStringCreateSimple((char *) "Format:"); formatSubMenu = XmCreatePulldownMenu(controlRowCol, (char *) "formatSubMenu", NULL, 0); for (i = 0; i < MAX_MODES; i++) { formatStrings[i] = XmStringCreateSimple((char *) formatChoices[i]); XtSetArg(args[0], XmNlabelString, formatStrings[i]); if (i == ROMAN) { XtSetArg(args[1], XmNmnemonic, 'H'); /* Hand */ } else { XtSetArg(args[1], XmNmnemonic, formatChoices[i][0]); } formatOptions[i] = XmCreatePushButtonGadget(formatSubMenu, (char *) formatChoices[i], args, 2); if (i == GENERIC) XtSetSensitive(formatOptions[i], False); XtAddCallback(formatOptions[i], XmNactivateCallback, formatListener, (char *) ((size_t) i)); } XtManageChildren(formatOptions, MAX_MODES); XtSetArg(args[0], XmNlabelString, format); XtSetArg(args[1], XmNmnemonic, 'F'); XtSetArg(args[2], XmNsubMenuId, formatSubMenu); XtSetArg(args[3], XmNmenuHistory, formatOptions[mode]); formatMenu = XmCreateOptionMenu(controlRowCol, (char *) "FormatMenu", args, 4); for (i = 0; i < MAX_MODES; i++) XmStringFree(formatStrings[i]); XmStringFree(format); XtManageChild(formatMenu); if (!baseSet) { forceNormalParams(abacus); } if ((romanNumeralsMenuItem = XtNameToWidget(displayFormatMenu, "button_0")) != (Widget) 0) { if (romanNumerals) XtVaSetValues(romanNumeralsMenuItem, XmNset, romanNumerals, NULL); XtAddCallback(romanNumeralsMenuItem, XmNvalueChangedCallback, (XtCallbackProc) romanNumeralsToggle, (XtPointer) NULL); } if ((ancientRomanMenuItem = XtNameToWidget(displayFormatMenu, "button_1")) != (Widget) 0) { if (ancientRoman) XtVaSetValues(ancientRomanMenuItem, XmNset, ancientRoman, NULL); XtAddCallback(ancientRomanMenuItem, XmNvalueChangedCallback, (XtCallbackProc) ancientRomanToggle, (XtPointer) NULL); } if ((latinMenuItem = XtNameToWidget(displayFormatMenu, "button_2")) != (Widget) 0) { if (latin) XtVaSetValues(latinMenuItem, XmNset, latin, NULL); XtAddCallback(latinMenuItem, XmNvalueChangedCallback, (XtCallbackProc) latinToggle, (XtPointer) NULL); } if ((groupMenuItem = XtNameToWidget(displayFormatMenu, "button_3")) != (Widget) 0) { if (group) XtVaSetValues(groupMenuItem, XmNset, group, NULL); XtAddCallback(groupMenuItem, XmNvalueChangedCallback, (XtCallbackProc) groupToggle, (XtPointer) NULL); } if ((signMenuItem = XtNameToWidget(specialRailsMenu, "button_0")) != (Widget) 0) { if (sign) XtVaSetValues(signMenuItem, XmNset, sign, NULL); XtAddCallback(signMenuItem, XmNvalueChangedCallback, (XtCallbackProc) signToggle, (XtPointer) NULL); } if ((quarterMenuItem = XtNameToWidget(specialRailsMenu, "button_1")) != (Widget) 0) { if (SET_QUARTER(bottomPiece, topPiece)) XtVaSetValues(quarterMenuItem, XmNset, True, NULL); XtAddCallback(quarterMenuItem, XmNvalueChangedCallback, (XtCallbackProc) quarterToggle, (XtPointer) NULL); } if ((quarterPercentMenuItem = XtNameToWidget(specialRailsMenu, "button_2")) != (Widget) 0) { if (SET_QUARTER_PERCENT(bottomPiece, bottomPiecePercent, topPiecePercent)) XtVaSetValues(quarterPercentMenuItem, XmNset, True, NULL); XtAddCallback(quarterPercentMenuItem, XmNvalueChangedCallback, (XtCallbackProc) quarterPercentToggle, (XtPointer) NULL); } if ((twelfthMenuItem = XtNameToWidget(specialRailsMenu, "button_3")) != (Widget) 0) { if (SET_TWELFTH(bottomPiece, topPiece)) XtVaSetValues(twelfthMenuItem, XmNset, True, NULL); XtAddCallback(twelfthMenuItem, XmNvalueChangedCallback, (XtCallbackProc) twelfthToggle, (XtPointer) NULL); } if ((subdeckMenuItem = XtNameToWidget(secondaryRailsMenu, "button_0")) != (Widget) 0) { if (SET_SUBDECK(bottomPiece, bottomPiecePercent, subdeck, subbase, slot)) XtVaSetValues(subdeckMenuItem, XmNset, True, NULL); XtAddCallback(subdeckMenuItem, XmNvalueChangedCallback, (XtCallbackProc) subdeckToggle, (XtPointer) NULL); } if ((eighthMenuItem = XtNameToWidget(secondaryRailsMenu, "button_1")) != (Widget) 0) { if (SET_EIGHTH(bottomPiece, bottomPiecePercent, subdeck, subbase, slot)) XtVaSetValues(eighthMenuItem, XmNset, True, NULL); XtAddCallback(eighthMenuItem, XmNvalueChangedCallback, (XtCallbackProc) eighthToggle, (XtPointer) NULL); } if ((museumMenuItem = XtNameToWidget(museumMenu, "button_0")) != (Widget) 0) { XtVaSetValues(museumMenuItem, XmNset, museum, NULL); XtAddCallback(museumMenuItem, XmNvalueChangedCallback, (XtCallbackProc) museumChoice, (XtPointer) NULL); } if ((modernRomanMenuItem = XtNameToWidget(specialRailsMenu, "button_5")) != (Widget) 0) { if (modernRoman) XtVaSetValues(modernRomanMenuItem, XmNset, modernRoman, NULL); XtAddCallback(modernRomanMenuItem, XmNvalueChangedCallback, (XtCallbackProc) modernRomanToggle, (XtPointer) NULL); } if ((anomalyMenuItem = XtNameToWidget(specialRailsMenu, "button_6")) != (Widget) 0) { if (SET_ANOMALY(anomaly, anomalySq)) XtVaSetValues(anomalyMenuItem, XmNset, True, NULL); XtAddCallback(anomalyMenuItem, XmNvalueChangedCallback, (XtCallbackProc) anomalyToggle, (XtPointer) NULL); } if ((watchMenuItem = XtNameToWidget(specialRailsMenu, "button_7")) != (Widget) 0) { if (SET_WATCH(anomaly, anomalySq)) XtVaSetValues(watchMenuItem, XmNset, True, NULL); XtAddCallback(watchMenuItem, XmNvalueChangedCallback, (XtCallbackProc) watchToggle, (XtPointer) NULL); } if ((rightToLeftAddMenuItem = XtNameToWidget(teachMenu, "button_0")) != (Widget) 0) { if (rightToLeftAdd) XtVaSetValues(rightToLeftAddMenuItem, XmNset, rightToLeftAdd, NULL); XtAddCallback(rightToLeftAddMenuItem, XmNvalueChangedCallback, (XtCallbackProc) rightToLeftAddToggle, (XtPointer) NULL); } if ((rightToLeftMultMenuItem = XtNameToWidget(teachMenu, "button_1")) != (Widget) 0) { if (rightToLeftMult) XtVaSetValues(rightToLeftMultMenuItem, XmNset, rightToLeftMult, NULL); XtAddCallback(rightToLeftMultMenuItem, XmNvalueChangedCallback, (XtCallbackProc) rightToLeftMultToggle, (XtPointer) NULL); } if ((soundMenuItem = XtNameToWidget(effectsMenu, "button_0")) != (Widget) 0) { if (sound) XtVaSetValues(soundMenuItem, XmNset, sound, NULL); XtAddCallback(soundMenuItem, XmNvalueChangedCallback, (XtCallbackProc) soundToggle, (XtPointer) NULL); } #if 0 if ((verticalMenuItem = XtNameToWidget(effectsMenu, "button_0")) != (Widget) 0) { if (vertical) XtVaSetValues(verticalMenuItem, XmNset, vertical, NULL); XtAddCallback(verticalMenuItem, XmNvalueChangedCallback, (XtCallbackProc) verticalToggle, (XtPointer) NULL); } #endif XmToggleButtonSetState(subdeckMenuItem, SET_SUBDECK(bottomPiece, bottomPiecePercent, subdeck, subbase, slot), False); XmToggleButtonSetState(eighthMenuItem, SET_EIGHTH(bottomPiece, bottomPiecePercent, subdeck, subbase, slot), False); XmToggleButtonSetState(anomalyMenuItem, SET_ANOMALY(anomaly, anomalySq), False); XmToggleButtonSetState(watchMenuItem, SET_WATCH(anomaly, anomalySq), False); XtVaSetValues(museumMenu, XmNmenuHistory, museum, NULL); XtSetSensitive(ancientRomanMenuItem, ENABLE_ANCIENT_ROMAN(romanNumerals)); XtSetSensitive(latinMenuItem, ENABLE_LATIN(romanNumerals, bottomPiece)); XtSetSensitive(quarterMenuItem, ENABLE_QUARTER(bottomPiece)); XtSetSensitive(quarterPercentMenuItem, ENABLE_QUARTER_PERCENT(bottomPiece, bottomPiecePercent, decimalPosition)); XtSetSensitive(twelfthMenuItem, ENABLE_TWELFTH(bottomPiece)); XtSetSensitive(secondaryRailsMenu, ENABLE_SECONDARY(bottomPiece, bottomPiecePercent, decimalPosition, slot)); XtSetSensitive(subdeckMenuItem, ENABLE_SUBDECK(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, subbase, slot)); XtSetSensitive(eighthMenuItem, ENABLE_EIGHTH(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, subbase, slot)); XtSetSensitive(museumMenu, ENABLE_MUSEUM(bottomPiece, bottomPiecePercent, decimalPosition, subdeck, slot)); XtSetSensitive(modernRomanMenuItem, ENABLE_MODERN_ROMAN(slot, anomaly, anomalySq)); XtSetSensitive(anomalyMenuItem, ENABLE_ANOMALY(anomaly, anomalySq)); XtSetSensitive(watchMenuItem, ENABLE_WATCH(anomaly, anomalySq)); #endif initialize(abacus); if (demo) forceDemoParams(abacus); #ifdef HAVE_MOTIF else if (teach) forceTeachParams(abacus); #endif if (demo) { createDemo(); #ifdef HAVE_MOTIF } else if (teach) { createTeach(); #endif } XtRealizeWidget(topLevel); VOID XGrabButton(XtDisplay(abacus), (unsigned int) AnyButton, AnyModifier, XtWindow(abacus), TRUE, (unsigned int) (ButtonPressMask | ButtonMotionMask | ButtonReleaseMask), GrabModeAsync, GrabModeAsync, XtWindow(abacus), XCreateFontCursor(XtDisplay(abacus), XC_hand2)); if (demo) { realizeDemo(); } XtMainLoop(); #ifdef VMS return 1; #else return 0; #endif } #endif xabacus-8.1.6/Abacus.h0000644000175000017500000003121113160741014014630 0ustar demarchidemarchi/* * @(#)Abacus.h * * Copyright 1994 - 2017 David A. Bagley, bagleyd AT verizon.net * * Abacus demo and neat pointers from * Copyright 1991 - 1998 Luis Fernandes, elf AT ee.ryerson.ca * * All rights reserved. * * Permission to use, copy, modify, and distribute this software and * its documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear in * supporting documentation, and that the name of the author not be * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. * * This program 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. */ /* Public header file for Abacus */ #ifndef _XtAbacus_h #define _XtAbacus_h /*********************************************************************** * * Abacus Widget * ***********************************************************************/ #if 0 #define DEBUG 1 #endif #ifndef WINVER #define XtNmono ((char *) "mono") #define XtNframeColor ((char *) "frameColor") #define XtNprimaryBeadColor ((char *) "primaryBeadColor") #define XtNleftAuxBeadColor ((char *) "leftAuxBeadColor") #define XtNrightAuxBeadColor ((char *) "rightAuxBeadColor") #define XtNsecondaryBeadColor ((char *) "secondaryBeadColor") #define XtNhighlightBeadColor ((char *) "highlightBeadColor") #define XtNcheckerBeadColor ((char *) "checkerBeadColor") #define XtNprimaryRailColor ((char *) "primaryRailColor") #define XtNsecondaryRailColor ((char *) "secondaryRailColor") #define XtNhighlightRailColor ((char *) "highlightRailColor") #define XtNlineRailColor ((char *) "lineRailColor") #define XtNbumpSound ((char *) "bumpSound") #define XtNmoveSound ((char *) "moveSound") #define XtNdripSound ((char *) "dripSound") #define XtNsound ((char *) "sound") #define XtNdelay ((char *) "delay") #define XtNscript ((char *) "script") #define XtNbuffer ((char *) "buffer") #define XtNdemo ((char *) "demo") #define XtNdemoPath ((char *) "demoPath") #define XtNdemoFont ((char *) "demoFont") #define XtNdemoForeground ((char *) "demoForeground") #define XtNdemoBackground ((char *) "demoBackground") #define XtNteach ((char *) "teach") #define XtNteachBuffer ((char *) "teachBuffer") #define XtNrightToLeftAdd ((char *) "rightToLeftAdd") #define XtNrightToLeftMult ((char *) "rightToLeftMult") #define XtNlee ((char *) "lee") #define XtNrails ((char *) "rails") #define XtNleftAuxRails ((char *) "leftAuxRails") #define XtNrightAuxRails ((char *) "rightAuxRails") #define XtNvertical ((char *) "vertical") #define XtNcolorScheme ((char *) "colorScheme") #define XtNslot ((char *) "slot") #define XtNdiamond ((char *) "diamond") #define XtNrailIndex ((char *) "railIndex") #define XtNtopOrient ((char *) "topOrient") #define XtNbottomOrient ((char *) "bottomOrient") #define XtNtopNumber ((char *) "topNumber") #define XtNbottomNumber ((char *) "bottomNumber") #define XtNtopFactor ((char *) "topFactor") #define XtNbottomFactor ((char *) "bottomFactor") #define XtNtopSpaces ((char *) "topSpaces") #define XtNbottomSpaces ((char *) "bottomSpaces") #define XtNtopPiece ((char *) "topPiece") #define XtNbottomPiece ((char *) "bottomPiece") #define XtNtopPiecePercent ((char *) "topPiecePercent") #define XtNbottomPiecePercent ((char *) "bottomPiecePercent") #define XtNshiftPercent ((char *) "shiftPercent") #define XtNsubdeck ((char *) "subdeck") #define XtNsubbead ((char *) "subbead") #define XtNsign ((char *) "sign") #define XtNdecimalPosition ((char *) "decimalPosition") #define XtNgroup ((char *) "group") #define XtNgroupSize ((char *) "groupSize") #define XtNdecimalComma ((char *) "decimalComma") #define XtNbase ((char *) "base") #define XtNsubbase ((char *) "subbase") #define XtNanomaly ((char *) "anomaly") #define XtNshiftAnomaly ((char *) "shiftAnomaly") #define XtNanomalySq ((char *) "anomalySq") #define XtNshiftAnomalySq ((char *) "shiftAnomalySq") #define XtNdisplayBase ((char *) "displayBase") #define XtNpressOffset ((char *) "pressOffset") #define XtNromanNumerals ((char *) "romanNumerals") #define XtNlatin ((char *) "latin") #define XtNancientRoman ((char *) "ancientRoman") #define XtNmodernRoman ((char *) "modernRoman") #define XtNmode ((char *) "mode") #define XtNformat ((char *) "format") #define XtNsubmode ((char *) "submode") #define XtNmuseum ((char *) "museum") #define XtNversionOnly ((char *) "versionOnly") #define XtNmenu ((char *) "menu") #define XtNdeck ((char *) "deck") #define XtNrail ((char *) "rail") #define XtNnumber ((char *) "number") #define XtNframed ((char *) "framed") #define XtNaux ((char *) "aux") #define XtNmathBuffer ((char *) "mathBuffer") #define XtNpixmapSize ((char *) "pixmapSize") #define XtNselectCallback ((char *) "selectCallback") #define XtNleftAuxAbacus ((char *) "leftAuxAbacus") #define XtNrightAuxAbacus ((char *) "rightAuxAbacus") #define XtCMono ((char *) "Mono") #define XtCFrameColor ((char *) "FrameColor") #define XtCPrimaryBeadColor ((char *) "PrimaryBeadColor") #define XtCLeftAuxBeadColor ((char *) "LeftAuxBeadColor") #define XtCRightAuxBeadColor ((char *) "RightAuxBeadColor") #define XtCSecondaryBeadColor ((char *) "SecondaryBeadColor") #define XtCHighlightBeadColor ((char *) "HighlightBeadColor") #define XtCPrimaryRailColor ((char *) "PrimaryRailColor") #define XtCSecondaryRailColor ((char *) "SecondaryRailColor") #define XtCHighlightRailColor ((char *) "HighlightRailColor") #define XtCBumpSound ((char *) "BumpSound") #define XtCMoveSound ((char *) "MoveSound") #define XtCDripSound ((char *) "DripSound") #define XtCSound ((char *) "Sound") #define XtCDelay ((char *) "Delay") #define XtCScript ((char *) "Script") #define XtCBuffer ((char *) "Buffer") #define XtCDemo ((char *) "Demo") #define XtCDemoPath ((char *) "DemoPath") #define XtCDemoFont ((char *) "DemoFont") #define XtCDemoForeground ((char *) "DemoForeground") #define XtCDemoBackground ((char *) "DemoBackground") #define XtCTeach ((char *) "Teach") #define XtCTeachBuffer ((char *) "TeachBuffer") #define XtCRightToLeftAdd ((char *) "RightToLeftAdd") #define XtCRightToLeftMult ((char *) "RightToLeftMult") #define XtCLee ((char *) "Lee") #define XtCRails ((char *) "Rails") #define XtCLeftAuxRails ((char *) "LeftAuxRails") #define XtCRightAuxRails ((char *) "RightAuxRails") #define XtCVertical ((char *) "Vertical") #define XtCColorScheme ((char *) "ColorScheme") #define XtCSlot ((char *) "Slot") #define XtCDiamond ((char *) "Diamond") #define XtCRailIndex ((char *) "RailIndex") #define XtCTopOrient ((char *) "TopOrient") #define XtCBottomOrient ((char *) "BottomOrient") #define XtCTopNumber ((char *) "TopNumber") #define XtCBottomNumber ((char *) "BottomNumber") #define XtCTopFactor ((char *) "TopFactor") #define XtCBottomFactor ((char *) "BottomFactor") #define XtCTopSpaces ((char *) "TopSpaces") #define XtCBottomSpaces ((char *) "BottomSpaces") #define XtCTopPiece ((char *) "TopPiece") #define XtCBottomPiece ((char *) "BottomPiece") #define XtCTopPiecePercent ((char *) "TopPiecePercent") #define XtCBottomPiecePercent ((char *) "BottomPiecePercent") #define XtCShiftPercent ((char *) "ShiftPercent") #define XtCSubdeck ((char *) "Subdeck") #define XtCSubbead ((char *) "Subbead") #define XtCSign ((char *) "Sign") #define XtCDecimalPosition ((char *) "DecimalPosition") #define XtCGroup ((char *) "Group") #define XtCGroupSize ((char *) "GroupSize") #define XtCDecimalComma ((char *) "DecimalComma") #define XtCBase ((char *) "Base") #define XtCSubbase ((char *) "Subbase") #define XtCAnomaly ((char *) "Anomaly") #define XtCShiftAnomaly ((char *) "ShiftAnomaly") #define XtCAnomalySq ((char *) "AnomalySq") #define XtCShiftAnomalySq ((char *) "ShiftAnomalySq") #define XtCDisplayBase ((char *) "DisplayBase") #define XtCPressOffset ((char *) "PressOffset") #define XtCRomanNumerals ((char *) "RomanNumerals") #define XtCLatin ((char *) "Latin") #define XtCAncientRoman ((char *) "AncientRoman") #define XtCModernRoman ((char *) "ModernRoman") #define XtCMode ((char *) "Mode") #define XtCFormat ((char *) "Format") #define XtCSubmode ((char *) "Submode") #define XtCMuseum ((char *) "Museum") #define XtCMenu ((char *) "Menu") #define XtCDeck ((char *) "Deck") #define XtCRail ((char *) "Rail") #define XtCNumber ((char *) "Number") #define XtCFramed ((char *) "Framed") #define XtCAux ((char *) "Aux") #define XtCMathBuffer ((char *) "MathBuffer") #define XtCPixmapSize ((char *) "PixmapSize") #define XtCLeftAuxAbacus ((char *) "LeftAuxAbacus") #define XtCRightAuxAbacus ((char *) "RightAuxAbacus") typedef struct _AbacusClassRec *AbacusWidgetClass; extern WidgetClass abacusWidgetClass; extern WidgetClass abacusDemoWidgetClass; typedef struct { XEvent *event; int reason; char *buffer, *mathBuffer; char *teachBuffer; int aux, deck, rail, number; int line; } abacusCallbackStruct; #endif #define ACTION_EXIT 100 #define ACTION_HIDE 101 #define ACTION_BASE_DEFAULT 102 #define ACTION_DEMO_DEFAULT 103 #define ACTION_CLEAR_QUERY 104 #define ACTION_CALC 105 #define ACTION_SCRIPT 106 #define ACTION_MOVE 107 #define ACTION_PLACE 108 #define ACTION_HIGHLIGHT_RAIL 109 #define ACTION_UNHIGHLIGHT_RAIL 110 #define ACTION_HIGHLIGHT_RAILS 111 #define ACTION_CLEAR 200 #define ACTION_DECIMAL_CLEAR 201 #define ACTION_COMPLEMENT 202 #define ACTION_INCREMENT 210 #define ACTION_DECREMENT 211 #define ACTION_FORMAT 220 #define ACTION_ROMAN_NUMERALS 230 #define ACTION_ANCIENT_ROMAN 231 #define ACTION_LATIN 232 #define ACTION_GROUP 233 #define ACTION_SIGN 240 #define ACTION_QUARTER 241 #define ACTION_QUARTER_PERCENT 242 #define ACTION_TWELFTH 243 #define ACTION_SUBDECK 250 #define ACTION_EIGHTH 251 #define ACTION_MUSEUM 252 #define ACTION_MODERN_ROMAN 260 #define ACTION_ANOMALY 261 #define ACTION_WATCH 262 #define ACTION_VERTICAL 263 #define ACTION_TEACH 264 #define ACTION_RIGHT_TO_LEFT_ADD 270 #define ACTION_RIGHT_TO_LEFT_MULT 271 #define ACTION_SOUND 272 #define ACTION_SPEED_UP 273 #define ACTION_SLOW_DOWN 274 #define ACTION_CLEAR_NODEMO 275 #define ACTION_TEACH_LINE 276 #define ACTION_DEMO 300 #define ACTION_NEXT 301 #define ACTION_REPEAT 302 #define ACTION_JUMP 303 #define ACTION_MORE 304 #define ACTION_CHAPTER1 311 #define ACTION_CHAPTER2 312 #define ACTION_CHAPTER3 313 #define ACTION_CHAPTER4 314 #define ACTION_CHAPTER5 315 #define ACTION_CHAPTER6 316 #define ACTION_CHAPTER7 317 #define ACTION_CHAPTER8 318 #define ACTION_DEMO1 331 #define ACTION_DEMO2 332 #define ACTION_DEMO3 333 #define ACTION_DEMO4 334 #define ACTION_TEACH1 351 #define ACTION_TEACH2 352 #define ACTION_TEACH3 353 #define ACTION_RIGHT 401 #define ACTION_LEFT 403 #define ACTION_UP 400 #define ACTION_DOWN 402 #define ACTION_INCX 501 #define ACTION_DECX 503 #define ACTION_INCY 500 #define ACTION_DECY 502 #define ACTION_DESCRIPTION 900 #define ACTION_FEATURES 901 #define ACTION_REFERENCES 902 #define ACTION_ABOUT 903 #define ACTION_IGNORE 999 #define HIGHLIGHTS_DECK (-12) #define UNHIGHLIGHT_DECK (-11) #define HIGHLIGHT_DECK (-10) #define TEACH_DECK (-9) #define CALC_DECK (-8) #define MORE_DECK (-7) #define JUMP_DECK (-6) #define REPEAT_DECK (-5) #define NEXT_DECK (-4) #define CLEAR_DECIMAL_DECK (-3) #define CLEAR_DECK (-2) #define IGNORE_DECK (-1) #define MIN_RAILS 1 #define MIN_DEMO_RAILS 3 #define DEFAULT_RAILS 13 #define DEFAULT_TOP_SPACES 2 #define DEFAULT_BOTTOM_SPACES 2 #define DEFAULT_TOP_NUMBER 2 #define DEFAULT_BOTTOM_NUMBER 5 #define DEFAULT_TOP_FACTOR 5 #define DEFAULT_BOTTOM_FACTOR 1 #define DEFAULT_TOP_ORIENT TRUE #define DEFAULT_BOTTOM_ORIENT FALSE #define MIN_BASE 2 /* Base 1 is rediculous :) */ #define MAX_BASE 36 /* 10 numbers + 26 letters (ASCII) */ #define DEFAULT_BASE 10 #define DEFAULT_SUBDECKS 3 #define DEFAULT_SUBBEADS 4 #define DEFAULT_DECIMAL_POSITION 2 #define DEFAULT_SHIFT_PERCENT 2 #define DEFAULT_SHIFT_ANOMALY 2 #define DEFAULT_GROUP_SIZE 3 #define SUBDECK_SPACE 1 #define MAX_MUSEUMS 3 #define IT 0 #define UK 1 #define FR 2 #define COLOR_MIDDLE 1 #define COLOR_FIRST 2 #define COLOR_HALF 4 #define PRIMARY 0 #define LEFT_AUX 1 #define RIGHT_AUX 2 #ifdef MONOTEST #define DEFAULT_MONO TRUE #else #define DEFAULT_MONO FALSE #endif #define DEFAULT_REVERSE FALSE #define CHINESE 0 #define JAPANESE 1 #define KOREAN 2 #define RUSSIAN 3 #define DANISH 4 #define ROMAN 5 #define MEDIEVAL 6 #define GENERIC 7 #define MAX_FORMATS 7 #define MAX_MODES 8 #define TEACH_STRING0 "Enter calculation X+Y, X-Y, X*Y, X/Y, Xv, or Xu where X and result nonnegative." #define TEACH_STRING1 "Press enter to go through calculation steps." #define ZERO_STRING "0.0" typedef struct _AbacusRec *AbacusWidget; typedef struct _AbacusRec *AbacusDemoWidget; #endif /* _XtAbacus_h */ /* DON'T ADD STUFF AFTER THIS #endif */ xabacus-8.1.6/Makefile.in0000644000175000017500000004217613203671553015352 0ustar demarchidemarchi# @(#)Makefile.in # # Copyright 1997 - 2017 David A. Bagley, bagleyd AT verizon.net # # All Rights Reserved # # Permission to use, copy, modify, and distribute this software and # its documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and # that both that copyright notice and this permission notice appear in # supporting documentation, and that the name of the author not be # used in advertising or publicity pertaining to distribution of the # software without specific, written prior permission. # # This program 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. # xabacus Makefile.in for configure (UNIX X11 support) wIDGET = abacus WIDGET = Abacus GROUP = xabacus P=x R=$(P) V= PROG = $(R)$(wIDGET) VER = $(V)$(wIDGET) # this tells GNU make not to export variables into the environment # But other makes do not understand its significance, so it must # not be the first target in the file. So it is here, before # any variables are created, but after the default target .NOEXPORT : SHELL = /bin/sh # Its not a game, so you may not want this. Man page itself is hard coded. MANNUM = 6 #MANNUM = 1 srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ mandir = @mandir@/man$(MANNUM) xapploaddir = @APPDEFAULTS@ #xapploaddir = @libdir@/X11/app-defaults #xapploaddir = @libdir@/app-defaults datarootdir = @datarootdir@ datadir = @datadir@ readdir = $(datadir)/games/$(GROUP) INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ M = @XM_PREFIX@ DESTDIR = #CC = cc -g #CC = acc -g #CC = gcc -g -Wall -ansi -pedantic #CC = gcc -g -Wall -W -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Waggregate-return -Wmissing-prototypes -Wstrict-prototypes -pedantic -Wno-long-long #CC = gcc -g -Wall #CC = g++ -g -Wall #CC = CC -g CC = @CC@ LINT = lint #LINT = alint INDENT = indent MORE = more #MORE = less PRINT = lpr #PRINT = enscript -2r LN_S = @LN_S@ RM = rm -f RM_S = $(RM) ECHO = echo #BLN_S = set file/enter=[] #RM = delete/noconfirm/nolog #RM_S = set file/remove/nolog #ECHO = write sys$output # wav files in win32 may sound better W = @SOUNDEXT@ # Assumes a directory of /usr/local/share/games/$(GROUP) if -DDEMOPATH not set. DEFINES = \ -DSOUNDPATH=\"$(readdir)\" -DSOUNDEXT=\"$(W)\" \ -DBUMPSOUND=\"bump\" -DMOVESOUND=\"move\" -DDRIPSOUND=\"drip\" \ -DDEMOPATH=\"$(readdir)\" DEFS = @DEFS@ $(DEFINES) # -DDEBUG # -DSRAND=srand48 -DLRAND=lrand48 -DMAXRAND=2147483648.0 # -DSRAND=srandom -DLRAND=random -DMAXRAND=2147483648.0 # -DSRAND=srand -DLRAND=rand -DMAXRAND=32768.0 # -DHAVE_USLEEP # -DHAVE_NANOSLEEP # -DCONSTPIXMAPS XWIDGETINC = @XWIDGETINC@ -I$(top_srcdir) -I. CFLAGS = @CFLAGS@ #CFLAGS = -O #CFLAGS = -g XWIDGETLDFLAGS = @XWIDGETLDFLAGS@ XLIBS = @XLIBS@ XWIDGETLIBS = @XWIDGETLIBS@ -lm N= C=.c #C++ #C=.cc #C=.cpp O=.o #O=.@OBJEXT@ S=$(N) $(N) E=@EXEEXT@ A= #VMS #O=.obj #S=, #E=.exe #A=;* # please define # C as the C source code extension # O as the object extension # S as the separator for object code # E as the executable extension HDRS = $(WIDGET)P.h $(WIDGET).h \ xwin.h file.h timer.h rngs.h \ sound.h version.h pixmaps/64x64/$(wIDGET).xbm \ pixmaps/16x16/$(wIDGET).xpm pixmaps/22x22/$(wIDGET).xpm \ pixmaps/24x24/$(wIDGET).xpm pixmaps/32x32/$(wIDGET).xpm \ pixmaps/48x48/$(wIDGET).xpm pixmaps/64x64/$(wIDGET).xpm COREOBJS = $(WIDGET)$(O)$(S)$(WIDGET)D$(O)$(S)$(WIDGET)C$(O)$(S)\ $(WIDGET)M$(O)$(S)$(WIDGET)T$(O)$(S)$(WIDGET)E$(O)$(S)$(WIDGET)F$(O) OBJS = xwin$(O)$(S)file$(O)$(S)timer$(O)$(S)rngs$(O)$(S)\ sound$(O)$(S)\ $(COREOBJS)$(S)$(P)$(wIDGET)$(O) CORESRCS = $(WIDGET)$(C) $(WIDGET)D$(C) $(WIDGET)C$(C) \ $(WIDGET)M$(C) $(WIDGET)T$(C) $(WIDGET)E$(C) $(WIDGET)F$(C) SRCS = xwin$(C) file$(C) timer$(C) rngs$(C) \ sound$(C) \ $(CORESRCS) $(P)$(wIDGET)$(C) all : $(PROG) constpixmaps : @ $(ECHO) "USE with -DCONSTPIXMAPS" for pix in pixmaps/*/*.xpm; do\ base=`basename $$pix`;\ sed 's/static char/static const char/' $$pix > $$base;\ done $(PROG) : $(OBJS) $(CC) -o $@ $(OBJS) $(XWIDGETLDFLAGS) $(XWIDGETLIBS) @ $(ECHO) "$@ BUILD COMPLETE" @ $(ECHO) "" @ $(ECHO) "To install: \"make install\" is safer but" @ $(ECHO) "\"make install-games\" may work better, see INSTALL." $(WIDGET)$(O) : $(WIDGET)$(C) $(HDRS) $(WIDGET)M$(O) : $(WIDGET)M$(C) $(WIDGET)P.h $(WIDGET).h $(WIDGET)D$(O) : $(WIDGET)D$(C) $(WIDGET)P.h $(WIDGET).h file.h $(WIDGET)C$(O) : $(WIDGET)C$(C) $(WIDGET)P.h $(WIDGET).h $(WIDGET)T$(O) : $(WIDGET)T$(C) $(WIDGET)P.h $(WIDGET).h $(WIDGET)E$(O) : $(WIDGET)E$(C) $(WIDGET)P.h $(WIDGET)F$(O) : $(WIDGET)F$(C) $(WIDGET)P.h xwin$(O) : xwin$(C) xwin.h file$(O) : file$(C) file.h timer$(O) : timer$(C) timer.h rngs$(O) : rngs$(C) rngs.h sound$(O) : sound$(C) sound.h file.h $(P)$(wIDGET)$(O) : $(P)$(wIDGET)$(C) $(WIDGET).h xwin.h file.h version.h install : $(PROG)$(E) @NOPLAY@play.sh $(srcdir)/mkinstalldirs $(DESTDIR)$(bindir) $(INSTALL_PROGRAM) $(PROG)$(E) $(DESTDIR)$(bindir)/$(R)$(M)$(wIDGET)$(E) @NOPLAY@$(INSTALL_PROGRAM) play.sh $(DESTDIR)$(bindir)/play.sh $(srcdir)/mkinstalldirs $(DESTDIR)$(mandir) $(INSTALL_DATA) $(srcdir)/$(PROG).man $(DESTDIR)$(mandir)/$(PROG).$(MANNUM) $(srcdir)/mkinstalldirs $(DESTDIR)$(xapploaddir) sed 's;^$(WIDGET)\*\(.*\): /usr/local/share/games/$(GROUP);$(WIDGET)*\1: $(DESTDIR)$(readdir);g' $(srcdir)/$(WIDGET).ad > $(WIDGET).ad.tmp $(INSTALL_DATA) $(WIDGET).ad.tmp $(DESTDIR)$(xapploaddir)/$(WIDGET) rm -f $(WIDGET).ad.tmp $(srcdir)/mkinstalldirs $(DESTDIR)$(readdir) $(INSTALL_DATA) $(srcdir)/$(WIDGET).ps $(DESTDIR)$(readdir)/$(WIDGET).ps $(INSTALL_DATA) $(srcdir)/abacusDemo.xml $(DESTDIR)$(readdir)/abacusDemo.xml $(INSTALL_DATA) $(srcdir)@WAVDIR@/bump$(W) $(DESTDIR)$(readdir)/bump$(W) $(INSTALL_DATA) $(srcdir)@WAVDIR@/move$(W) $(DESTDIR)$(readdir)/move$(W) $(INSTALL_DATA) $(srcdir)@WAVDIR@/drip$(W) $(DESTDIR)$(readdir)/drip$(W) @ $(ECHO) "$@ COMPLETE" @ $(ECHO) "" @ $(ECHO) "To use $(R)$(M)$(wIDGET) from a menu, you may want to install the" @ $(ECHO) "images. Do a \"make install-png\" for Gnome and KDE, or do a" @ $(ECHO) "\"make install-xpm\" or a \"make install-xpm-home\" for CDE." uninstall : $(RM) $(DESTDIR)$(bindir)/$(R)$(M)$(wIDGET)$(E) @NOPLAY@$(RM) $(DESTDIR)$(bindir)/play.sh $(RM) $(DESTDIR)$(mandir)/$(PROG).$(MANNUM) $(RM) $(DESTDIR)$(xapploaddir)/$(WIDGET) $(RM) $(DESTDIR)$(readdir)/$(WIDGET).ps $(RM) $(DESTDIR)$(readdir)/abacusDemo.xml $(RM) $(DESTDIR)$(readdir)/bump$(W) $(RM) $(DESTDIR)$(readdir)/move$(W) $(RM) $(DESTDIR)$(readdir)/drip$(W) install-games : $(PROG)$(E) @NOPLAY@play.sh $(srcdir)/mkinstalldirs /usr/games $(INSTALL_PROGRAM) $(PROG)$(E) /usr/games/$(R)$(M)$(wIDGET)$(E) @NOPLAY@$(INSTALL_PROGRAM) play.sh $(DESTDIR)$(bindir)/play.sh chmod 2755 /usr/games/$(R)$(M)$(wIDGET)$(E) chown games:games /usr/games/$(R)$(M)$(wIDGET)$(E) $(srcdir)/mkinstalldirs $(DESTDIR)$(mandir) $(INSTALL_DATA) $(srcdir)/$(PROG).man $(DESTDIR)$(mandir)/$(PROG).$(MANNUM) $(srcdir)/mkinstalldirs $(DESTDIR)$(xapploaddir) sed 's;^$(WIDGET)\*\(.*\): /usr/local/share/games/$(GROUP);$(WIDGET)*\1: $(DESTDIR)$(readdir);g' $(srcdir)/$(WIDGET).ad > $(WIDGET).ad.tmp $(INSTALL_DATA) $(WIDGET).ad.tmp $(DESTDIR)$(xapploaddir)/$(WIDGET) rm -f $(WIDGET).ad.tmp $(srcdir)/mkinstalldirs $(DESTDIR)$(readdir) $(INSTALL_DATA) $(srcdir)/$(WIDGET).ps $(DESTDIR)$(readdir)/$(WIDGET).ps $(INSTALL_DATA) $(srcdir)/abacusDemo.xml $(DESTDIR)$(readdir)/abacusDemo.xml $(INSTALL_DATA) $(srcdir)@WAVDIR@/bump$(W) $(DESTDIR)$(readdir)/bump$(W) $(INSTALL_DATA) $(srcdir)@WAVDIR@/move$(W) $(DESTDIR)$(readdir)/move$(W) $(INSTALL_DATA) $(srcdir)@WAVDIR@/drip$(W) $(DESTDIR)$(readdir)/drip$(W) @ $(ECHO) "$@ COMPLETE" @ $(ECHO) "" @ $(ECHO) "To use $(R)$(M)$(wIDGET) from a menu, you may want to install the " @ $(ECHO) "images. Do a \"make install-png\" for Gnome and KDE, or do a" @ $(ECHO) "\"make install-xpm\" or a \"make install-xpm-home\" for CDE." uninstall-games : $(RM) /usr/games/$(R)$(M)$(wIDGET)$(E) @NOPLAY@$(RM) $(DESTDIR)$(bindir)/play.sh $(RM) $(DESTDIR)$(mandir)/$(PROG).$(MANNUM) $(RM) $(DESTDIR)$(xapploaddir)/$(WIDGET) $(RM) $(DESTDIR)$(readdir)/$(WIDGET).ps $(RM) $(DESTDIR)$(readdir)/abacusDemo.xml $(RM) $(DESTDIR)$(readdir)/bump$(W) $(RM) $(DESTDIR)$(readdir)/move$(W) $(RM) $(DESTDIR)$(readdir)/drip$(W) # Gnome and KDE install-png : for i in 16x16 22x22 32x32 48x48; do\ $(srcdir)/mkinstalldirs $(DESTDIR)$(datadir)/pixmaps/png/hicolor/$$i/apps;\ $(INSTALL_DATA) pixmaps/$$i/$(wIDGET).png $(DESTDIR)$(datadir)/pixmaps/png/hicolor/$$i/apps/$(wIDGET).png;\ done $(srcdir)/mkinstalldirs $(DESTDIR)$(datadir)/pixmaps/png/hicolor/all/apps $(LN_S) $(DESTDIR)$(datadir)/pixmaps/png/hicolor/16x16/apps/$(wIDGET).png $(DESTDIR)$(datadir)/pixmaps/png/hicolor/all/apps/mini.$(wIDGET).png $(LN_S) $(DESTDIR)$(datadir)/pixmaps/png/hicolor/22x22/apps/$(wIDGET).png $(DESTDIR)$(datadir)/pixmaps/png/hicolor/all/apps/small.$(wIDGET).png $(LN_S) $(DESTDIR)$(datadir)/pixmaps/png/hicolor/32x32/apps/$(wIDGET).png $(DESTDIR)$(datadir)/pixmaps/png/hicolor/all/apps/normal.$(wIDGET).png $(LN_S) $(DESTDIR)$(datadir)/pixmaps/png/hicolor/48x48/apps/$(wIDGET).png $(DESTDIR)$(datadir)/pixmaps/png/hicolor/all/apps/big.$(wIDGET).png uninstall-png : for i in mini small normal big; do\ $(RM) $(DESTDIR)$(datadir)/pixmaps/png/hicolor/all/apps/$$i.$(wIDGET).png;\ done for i in 16x16 22x22 32x32 48x48; do\ $(RM) $(DESTDIR)$(datadir)/pixmaps/png/hicolor/$$i/apps/$(wIDGET).png;\ done #CDE install-xpm : $(srcdir)/mkinstalldirs $(DESTDIR)$(datadir)/dt/pixmaps $(INSTALL_DATA) pixmaps/16x16/$(wIDGET).xpm $(DESTDIR)$(datadir)/dt/pixmaps/$(wIDGET).t.pm $(INSTALL_DATA) pixmaps/24x24/$(wIDGET).xpm $(DESTDIR)$(datadir)/dt/pixmaps/$(wIDGET).s.pm $(INSTALL_DATA) pixmaps/32x32/$(wIDGET).xpm $(DESTDIR)$(datadir)/dt/pixmaps/$(wIDGET).m.pm $(INSTALL_DATA) pixmaps/48x48/$(wIDGET).xpm $(DESTDIR)$(datadir)/dt/pixmaps/$(wIDGET).l.pm uninstall-xpm : for i in t s m l; do\ $(RM) $(DESTDIR)$(datadir)/dt/pixmaps/$(wIDGET).$$i.pm;\ done #CDE HOME directory install-xpm-home : $(srcdir)/mkinstalldirs $(HOME)/.dt/pixmaps $(INSTALL_DATA) pixmaps/16x16/$(wIDGET).xpm $(HOME)/.dt/pixmaps/$(wIDGET).t.pm $(INSTALL_DATA) pixmaps/24x24/$(wIDGET).xpm $(HOME)/.dt/pixmaps/$(wIDGET).s.pm $(INSTALL_DATA) pixmaps/32x32/$(wIDGET).xpm $(HOME)/.dt/pixmaps/$(wIDGET).m.pm $(INSTALL_DATA) pixmaps/64x64/$(wIDGET).xpm $(HOME)/.dt/pixmaps/$(wIDGET).l.pm uninstall-xpm-home : for i in t s m l; do\ $(RM) $(HOME)/.dt/pixmaps/$(wIDGET).$$i.pm;\ done SUFFIXES : $(C) $(O) $(E) $(C)$(O) : $(CC) -c $(CPPFLAGS) $(DEFS) $(XWIDGETINC) $(CFLAGS) $< Makefile : Makefile.in config.status $(SHELL) config.status config.status : configure $(SHELL) config.status --recheck #configure : configure.ac # enable this rule if you want autoconf to be executed automatically when # configure.ac is changed. This is commented out, since patching might give # configure.ac a newer timestamp than configure and not everybody has autoconf # cd $(srcdir); autoconf run : ./$(PROG) run.scores : run.version : ./$(PROG) -version lee : ./$(PROG) -lee -leftAuxRails 9 -rightAuxRails 9 nolee : ./$(PROG) -nolee -rails 15 #Roman Hand Abacus (right most column twelfths and ancient Roman Numerals in display) roman : ./$(PROG) -nolee -roman -topPiece 2 -bottomPiece 6 -subdeck 3 -rails 10 -decimalPosition 2 -romanNumerals -ancientRoman -nomodernRoman -nolatin #Alt Roman Hand Abacus (right most column eighths and modern Roman Numerals on abacus) roman8 : ./$(PROG) -nolee -roman -subdeck 3 -topPiece 2 -bottomPiece 6 -rails 10 -decimalPosition 2 -romanNumerals -noancientRoman -modernRoman -eighth -nolatin #Russian Schety russian : ./$(PROG) -nolee -russian -bottomPiece 4 -rails 11 #Old Russian Schety russianold : ./$(PROG) -nolee -russian -bottomPiece 4 -bottomPiecePercent 4 -rails 11 #Georgian Schety (not to be taken seriously) georgian : ./$(PROG) -nolee -russian -bottomPiece 4 -bottomPiecePercent 4 -rails 11 -base 20 #Danish School Abacus danish : ./$(PROG) -nolee -danish -rails 10 -decimalPosition 0 -decimalComma -group #Medieval Counter medieval : ./$(PROG) -medieval -rails 5 -decimalPosition 0 -romanNumerals #Mesoamerican Nepohualtzintzin (similar to Japanese Soroban base 20) mesoamerican : ./$(PROG) -nolee -generic -diamond -topNumber 3 -bottomNumber 4 -topSpaces 1 -bottomSpaces 1 -decimalPosition 0 -base 20 -anomaly 2 -vertical #Babylonian Watch (proposed by author) watch : ./$(PROG) -nolee -generic -slot -topNumber 1 -bottomNumber 1 -topSpaces 1 -bottomSpaces 1 -anomaly 4 -anomalySq 4 #Chinese solid-and-broken-bar system bar : ./$(PROG) -nolee -generic -topFactor 3 -topNumber 3 -bottomNumber 2 -decimalPosition 0 -base 12 -displayBase 12 #Base 16 Abacus base16 : ./$(PROG) -nolee -japanese -base 16 -displayBase 10 percent : ./$(PROG) -bottomPiecePercent 4 gdb : gdb ./$(PROG) dbx : dbx ./$(PROG) valgrind : valgrind --track-origins=yes --leak-check=full --show-leak-kinds=all \ ./$(PROG) clean : $(RM) *.o *.exe* core *~ *% *.bak make.log MakeOut Makefile.dep \ $(PROG) $(PROG).errs $(PROG).1.html $(PROG)._man test -d win32 && (cd win32 ; make -f Makefile clean) ; true distclean : clean $(RM) config.cache config.log $(RM)r autom4te.cache test -d win32 && (cd win32 ; make -f Makefile distclean) ; true clean.all : distclean $(RM) Makefile config.status* autoconf : autoconf $(RM)r autom4te.cache PACKAGE=$(VER)/$(WIDGET).h $(VER)/$(WIDGET)P.h \ $(VER)/xwin.h $(VER)/file.h $(VER)/timer.h $(VER)/rngs.h \ $(VER)/sound.h $(VER)/version.h \ $(VER)/pixmaps/mouse-l.xbm $(VER)/pixmaps/mouse-r.xbm \ $(VER)/pixmaps/*x*/$(wIDGET).* $(VER)/pixmaps/doc/Abacus0*.png \ $(VER)/bump.au $(VER)/move.au $(VER)/drip.au $(VER)/play.sh \ $(VER)/$(WIDGET)$(C) $(VER)/$(WIDGET)D$(C) $(VER)/$(WIDGET)C$(C) \ $(VER)/$(WIDGET)M$(C) $(VER)/$(WIDGET)T$(C) $(VER)/$(WIDGET)E$(C) \ $(VER)/$(WIDGET)F$(C) $(VER)/$(P)$(wIDGET)$(C) \ $(VER)/xwin$(C) $(VER)/file$(C) $(VER)/timer$(C) $(VER)/rngs$(C) \ $(VER)/sound$(C) \ $(VER)/Imakefile $(VER)/$(PROG).man $(VER)/$(PROG).html \ $(VER)/$(WIDGET).ad $(VER)/$(WIDGET).ps $(VER)/*.xml \ $(VER)/configure $(VER)/Makefile.in $(VER)/configure.ac \ $(VER)/config.guess $(VER)/config.sub $(VER)/config.cygport \ $(VER)/install-sh $(VER)/mkinstalldirs \ $(VER)/AUTHORS $(VER)/ChangeLog $(VER)/COPYING $(VER)/NEWS \ $(VER)/INSTALL $(VER)/README $(VER)/TODO \ $(VER)/vms/README.vms $(VER)/vms/$(PROG).hlp \ $(VER)/vms/make.com $(VER)/vms/mmov.com \ $(VER)/vms/vms_amd.c $(VER)/vms/vms_amd.h $(VER)/vms/vms_mmov.c \ $(VER)/win32/Makefile $(VER)/win32/w$(wIDGET).rc \ $(VER)/win32/bump.wav $(VER)/win32/move.wav $(VER)/win32/drip.wav \ $(VER)/win32/w$(wIDGET).ini $(VER)/win32/$(wIDGET).ico\ $(VER)/po/AbacusT.pot $(VER)/po/de/AbacusT.po $(VER)/po/fr/AbacusT.po zip : cd .. ; zip $(VER) $(PACKAGE) pkzip : cd .. ; pkzip $(VER) $(PACKAGE) tar : cd .. ; tar cvf $(VER).tar $(PACKAGE) compress : cd .. ; tar cvf - $(PACKAGE) | compress > $(VER).tar.Z gzip : cd .. ; tar cvf - $(PACKAGE) | gzip > $(VER).tar.gz bzip2 : cd .. ; tar cvf - $(PACKAGE) | bzip2 > $(VER).tar.bz2 xz : cd .. ; tar cvf - $(PACKAGE) | xz > $(VER).tar.xz dist : xz dist.man : $(PROG).html vms/$(PROG).hlp # man2html 3.0.1, changed psgz 1666 and txsz 1552 $(PROG).html : $(PROG).man if nroff -c -man -Tascii < $< | man2html -title $(PROG) > $(PROG).tmp; then\ mv $(PROG).tmp $@;\ else\ rm -f $(PROG).tmp;\ fi # found man2hlp.sh in lynx source vms/$(PROG).hlp : $(PROG).man man2hlp.sh $< > $(PROG).tmp 2> $(PROG)2.tmp if grep error $(PROG)2.tmp > /dev/null; then\ cat $(PROG)2.tmp;\ rm -f $(PROG).tmp $(PROG)2.tmp;\ else\ rm -f $(PROG)2.tmp;\ mv $(PROG).tmp $@;\ fi html : $(PROG).html hlp : vms/$(PROG).hlp man : nroff -c -man $(PROG).man | $(MORE) print: $(PRINT) $(HDRS) $(SRCS) read : $(MORE) README AUTOMAKE=/usr/share/automake-1.15 automake : cp -p ${AUTOMAKE}/config.guess .;\ cp -p ${AUTOMAKE}/config.sub .;\ cp -p ${AUTOMAKE}/install-sh .;\ cp -p ${AUTOMAKE}/mkinstalldirs . antic : antic *.h *.c */*/*.xpm */*/*.xbm */*.xbm */*.c */*.h cppcheck : cppcheck -f -q *.c */*.c lint : $(LINT) -ax -DLINT $(DEFS) $(XWIDGETINC) $(SRCS) $(XWIDGETLIBS) indent : $(INDENT) $(HDRS) $(SRCS) ICONS=\ 16x16/$(wIDGET).png\ 22x22/$(wIDGET).png\ 32x32/$(wIDGET).png\ 48x48/$(wIDGET).png PNGS=$(ICONS:%.png=pixmaps/%.png) pixmaps/%.png : pixmaps/%.xpm if grep None $< > /dev/null; then\ sed -e 's/None/White/' $< | xpmtoppm |\ pnmtopng -transparent 1,1,1 > $@;\ else\ xpmtoppm $< | pnmtopng > $@;\ fi pixmap : $(PNGS) DOC=\ pixmaps/doc/Abacus001.png pixmaps/doc/Abacus002.png\ pixmaps/doc/Abacus003.png pixmaps/doc/Abacus004.png\ pixmaps/doc/Abacus005.png pixmaps/doc/Abacus006.png\ pixmaps/doc/Abacus007.png pixmaps/doc/Abacus008.png\ pixmaps/doc/Abacus009.png pixmaps/doc/Abacus010.png\ pixmaps/doc/Abacus011.png pixmaps/doc/Abacus012.png pixmaps/doc/Abacus001.png : Abacus.ps pstopnm Abacus.ps mkdir -p pixmaps/doc for i in Abacus*.ppm; do\ j=`basename $$i .ppm`;\ pnmtopng $$i > pixmaps/doc/$$j.png;\ rm -f $$i;\ done doc : $(DOC) # LC_ALL=fr_FR.UTF-8; export LC_ALL msgfmt : msgfmt --output-file=po/de/AbacusT.mo po/de/AbacusT.po msgfmt --output-file=po/fr/AbacusT.mo po/fr/AbacusT.po xabacus-8.1.6/Abacus.ps0000644000175000017500000027403210710765074015047 0ustar demarchidemarchi%! %%BoundingBox: (atend) %%Pages: (atend) %%DocumentFonts: (atend) %%EndComments % % FrameMaker PostScript Prolog 3.0, for use with FrameMaker 3.0 % Copyright (c) 1986,87,89,90,91 by Frame Technology Corporation. % All rights reserved. % % Known Problems: % Due to bugs in Transcript, the 'PS-Adobe-' is omitted from line 1 /FMversion (3.0) def % Set up Color vs. Black-and-White /FMPrintInColor systemdict /colorimage known systemdict /currentcolortransfer known or def % Uncomment this line to force b&w on color printer % /FMPrintInColor false def /FrameDict 195 dict def systemdict /errordict known not {/errordict 10 dict def errordict /rangecheck {stop} put} if % The readline in 23.0 doesn't recognize cr's as nl's on AppleTalk FrameDict /tmprangecheck errordict /rangecheck get put errordict /rangecheck {FrameDict /bug true put} put FrameDict /bug false put mark % Some PS machines read past the CR, so keep the following 3 lines together! currentfile 5 string readline 00 0000000000 cleartomark errordict /rangecheck FrameDict /tmprangecheck get put FrameDict /bug get { /readline { /gstring exch def /gfile exch def /gindex 0 def { gfile read pop dup 10 eq {exit} if dup 13 eq {exit} if gstring exch gindex exch put /gindex gindex 1 add def } loop pop gstring 0 gindex getinterval true } def } if /FMVERSION { FMversion ne { /Times-Roman findfont 18 scalefont setfont 100 100 moveto (FrameMaker version does not match postscript_prolog!) dup = show showpage } if } def /FMLOCAL { FrameDict begin 0 def end } def /gstring FMLOCAL /gfile FMLOCAL /gindex FMLOCAL /orgxfer FMLOCAL /orgproc FMLOCAL /organgle FMLOCAL /orgfreq FMLOCAL /yscale FMLOCAL /xscale FMLOCAL /manualfeed FMLOCAL /paperheight FMLOCAL /paperwidth FMLOCAL /FMDOCUMENT { array /FMfonts exch def /#copies exch def FrameDict begin 0 ne dup {setmanualfeed} if /manualfeed exch def /paperheight exch def /paperwidth exch def /yscale exch def /xscale exch def currenttransfer cvlit /orgxfer exch def currentscreen cvlit /orgproc exch def /organgle exch def /orgfreq exch def setpapername manualfeed {true} {papersize} ifelse {manualpapersize} {false} ifelse {desperatepapersize} if end } def /pagesave FMLOCAL /orgmatrix FMLOCAL /landscape FMLOCAL /FMBEGINPAGE { FrameDict begin /pagesave save def 3.86 setmiterlimit /landscape exch 0 ne def landscape { 90 rotate 0 exch neg translate pop } {pop pop} ifelse xscale yscale scale /orgmatrix matrix def gsave } def /FMENDPAGE { grestore pagesave restore end showpage } def /FMFONTDEFINE { FrameDict begin findfont ReEncode 1 index exch definefont FMfonts 3 1 roll put end } def /FMFILLS { FrameDict begin array /fillvals exch def end } def /FMFILL { FrameDict begin fillvals 3 1 roll put end } def /FMNORMALIZEGRAPHICS { newpath 0.0 0.0 moveto 1 setlinewidth 0 setlinecap 0 0 0 sethsbcolor 0 setgray } bind def /fx FMLOCAL /fy FMLOCAL /fh FMLOCAL /fw FMLOCAL /llx FMLOCAL /lly FMLOCAL /urx FMLOCAL /ury FMLOCAL /FMBEGINEPSF { end /FMEPSF save def /showpage {} def FMNORMALIZEGRAPHICS [/fy /fx /fh /fw /ury /urx /lly /llx] {exch def} forall fx fy translate rotate fw urx llx sub div fh ury lly sub div scale llx neg lly neg translate } bind def /FMENDEPSF { FMEPSF restore FrameDict begin } bind def FrameDict begin /setmanualfeed { %%BeginFeature *ManualFeed True statusdict /manualfeed true put %%EndFeature } def /max {2 copy lt {exch} if pop} bind def /min {2 copy gt {exch} if pop} bind def /inch {72 mul} def /pagedimen { paperheight sub abs 16 lt exch paperwidth sub abs 16 lt and {/papername exch def} {pop} ifelse } def /papersizedict FMLOCAL /setpapername { /papersizedict 14 dict def papersizedict begin /papername /unknown def /Letter 8.5 inch 11.0 inch pagedimen /LetterSmall 7.68 inch 10.16 inch pagedimen /Tabloid 11.0 inch 17.0 inch pagedimen /Ledger 17.0 inch 11.0 inch pagedimen /Legal 8.5 inch 14.0 inch pagedimen /Statement 5.5 inch 8.5 inch pagedimen /Executive 7.5 inch 10.0 inch pagedimen /A3 11.69 inch 16.5 inch pagedimen /A4 8.26 inch 11.69 inch pagedimen /A4Small 7.47 inch 10.85 inch pagedimen /B4 10.125 inch 14.33 inch pagedimen /B5 7.16 inch 10.125 inch pagedimen end } def /papersize { papersizedict begin /Letter {lettertray letter} def /LetterSmall {lettertray lettersmall} def /Tabloid {11x17tray 11x17} def /Ledger {ledgertray ledger} def /Legal {legaltray legal} def /Statement {statementtray statement} def /Executive {executivetray executive} def /A3 {a3tray a3} def /A4 {a4tray a4} def /A4Small {a4tray a4small} def /B4 {b4tray b4} def /B5 {b5tray b5} def /unknown {unknown} def papersizedict dup papername known {papername} {/unknown} ifelse get end /FMdicttop countdictstack 1 add def statusdict begin stopped end countdictstack -1 FMdicttop {pop end} for } def /manualpapersize { papersizedict begin /Letter {letter} def /LetterSmall {lettersmall} def /Tabloid {11x17} def /Ledger {ledger} def /Legal {legal} def /Statement {statement} def /Executive {executive} def /A3 {a3} def /A4 {a4} def /A4Small {a4small} def /B4 {b4} def /B5 {b5} def /unknown {unknown} def papersizedict dup papername known {papername} {/unknown} ifelse get end stopped } def /desperatepapersize { statusdict /setpageparams known { paperwidth paperheight 0 1 statusdict begin {setpageparams} stopped pop end } if } def /savematrix { orgmatrix currentmatrix pop } bind def /restorematrix { orgmatrix setmatrix } bind def /dmatrix matrix def /dpi 72 0 dmatrix defaultmatrix dtransform dup mul exch dup mul add sqrt def /freq dpi 18.75 div 8 div round dup 0 eq {pop 1} if 8 mul dpi exch div def /sangle 1 0 dmatrix defaultmatrix dtransform exch atan def /DiacriticEncoding [ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quotesingle /parenleft /parenright /asterisk /plus /comma /hyphen /period /slash /zero /one /two /three /four /five /six /seven /eight /nine /colon /semicolon /less /equal /greater /question /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N /O /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore /grave /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o /p /q /r /s /t /u /v /w /x /y /z /braceleft /bar /braceright /asciitilde /.notdef /Adieresis /Aring /Ccedilla /Eacute /Ntilde /Odieresis /Udieresis /aacute /agrave /acircumflex /adieresis /atilde /aring /ccedilla /eacute /egrave /ecircumflex /edieresis /iacute /igrave /icircumflex /idieresis /ntilde /oacute /ograve /ocircumflex /odieresis /otilde /uacute /ugrave /ucircumflex /udieresis /dagger /.notdef /cent /sterling /section /bullet /paragraph /germandbls /registered /copyright /trademark /acute /dieresis /.notdef /AE /Oslash /.notdef /.notdef /.notdef /.notdef /yen /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /ordfeminine /ordmasculine /.notdef /ae /oslash /questiondown /exclamdown /logicalnot /.notdef /florin /.notdef /.notdef /guillemotleft /guillemotright /ellipsis /.notdef /Agrave /Atilde /Otilde /OE /oe /endash /emdash /quotedblleft /quotedblright /quoteleft /quoteright /.notdef /.notdef /ydieresis /Ydieresis /fraction /currency /guilsinglleft /guilsinglright /fi /fl /daggerdbl /periodcentered /quotesinglbase /quotedblbase /perthousand /Acircumflex /Ecircumflex /Aacute /Edieresis /Egrave /Iacute /Icircumflex /Idieresis /Igrave /Oacute /Ocircumflex /.notdef /Ograve /Uacute /Ucircumflex /Ugrave /dotlessi /circumflex /tilde /macron /breve /dotaccent /ring /cedilla /hungarumlaut /ogonek /caron ] def /ReEncode { dup length dict begin { 1 index /FID ne {def} {pop pop} ifelse } forall 0 eq {/Encoding DiacriticEncoding def} if currentdict end } bind def /graymode true def /bwidth FMLOCAL /bpside FMLOCAL /bstring FMLOCAL /onbits FMLOCAL /offbits FMLOCAL /xindex FMLOCAL /yindex FMLOCAL /x FMLOCAL /y FMLOCAL /setpattern { /bwidth exch def /bpside exch def /bstring exch def /onbits 0 def /offbits 0 def freq sangle landscape {90 add} if {/y exch def /x exch def /xindex x 1 add 2 div bpside mul cvi def /yindex y 1 add 2 div bpside mul cvi def bstring yindex bwidth mul xindex 8 idiv add get 1 7 xindex 8 mod sub bitshift and 0 ne {/onbits onbits 1 add def 1} {/offbits offbits 1 add def 0} ifelse } setscreen {} settransfer offbits offbits onbits add div FMsetgray /graymode false def } bind def /grayness { FMsetgray graymode not { /graymode true def orgxfer cvx settransfer orgfreq organgle orgproc cvx setscreen } if } bind def /HUE FMLOCAL /SAT FMLOCAL /BRIGHT FMLOCAL /Colors FMLOCAL FMPrintInColor { /HUE 0 def /SAT 0 def /BRIGHT 0 def % array of arrays Hue and Sat values for the separations [HUE BRIGHT] /Colors [[0 0 ] % black [0 0 ] % white [0.00 1.0] % red [0.37 1.0] % green [0.60 1.0] % blue [0.50 1.0] % cyan [0.83 1.0] % magenta [0.16 1.0] % comment / yellow ] def /BEGINBITMAPCOLOR { BITMAPCOLOR} def /BEGINBITMAPCOLORc { BITMAPCOLORc} def /BEGINBITMAPTRUECOLOR { BITMAPTRUECOLOR } def /BEGINBITMAPCOLORc { BITMAPTRUECOLORc } def /K { Colors exch get dup 0 get /HUE exch store 1 get /BRIGHT exch store HUE 0 eq BRIGHT 0 eq and {1.0 SAT sub setgray} {HUE SAT BRIGHT sethsbcolor} ifelse } def /FMsetgray { /SAT exch 1.0 exch sub store HUE 0 eq BRIGHT 0 eq and {1.0 SAT sub setgray} {HUE SAT BRIGHT sethsbcolor} ifelse } bind def } { /BEGINBITMAPCOLOR { BITMAPGRAY} def /BEGINBITMAPCOLORc { BITMAPGRAYc} def /BEGINBITMAPTRUECOLOR { BITMAPTRUEGRAY } def /BEGINBITMAPTRUECOLORc { BITMAPTRUEGRAYc } def /FMsetgray {setgray} bind def /K { pop } def } ifelse /normalize { transform round exch round exch itransform } bind def /dnormalize { dtransform round exch round exch idtransform } bind def /lnormalize { 0 dtransform exch cvi 2 idiv 2 mul 1 add exch idtransform pop } bind def /H { lnormalize setlinewidth } bind def /Z { setlinecap } bind def /fillvals FMLOCAL /X { fillvals exch get dup type /stringtype eq {8 1 setpattern} {grayness} ifelse } bind def /V { gsave eofill grestore } bind def /N { stroke } bind def /M {newpath moveto} bind def /E {lineto} bind def /D {curveto} bind def /O {closepath} bind def /n FMLOCAL /L { /n exch def newpath normalize moveto 2 1 n {pop normalize lineto} for } bind def /Y { L closepath } bind def /x1 FMLOCAL /x2 FMLOCAL /y1 FMLOCAL /y2 FMLOCAL /rad FMLOCAL /R { /y2 exch def /x2 exch def /y1 exch def /x1 exch def x1 y1 x2 y1 x2 y2 x1 y2 4 Y } bind def /RR { /rad exch def normalize /y2 exch def /x2 exch def normalize /y1 exch def /x1 exch def newpath x1 y1 rad add moveto x1 y2 x2 y2 rad arcto x2 y2 x2 y1 rad arcto x2 y1 x1 y1 rad arcto x1 y1 x1 y2 rad arcto closepath 16 {pop} repeat } bind def /C { grestore gsave R clip } bind def /FMpointsize FMLOCAL /F { FMfonts exch get FMpointsize scalefont setfont } bind def /Q { /FMpointsize exch def F } bind def /T { moveto show } bind def /RF { rotate 0 ne {-1 1 scale} if } bind def /TF { gsave moveto RF show grestore } bind def /P { moveto 0 32 3 2 roll widthshow } bind def /PF { gsave moveto RF 0 32 3 2 roll widthshow grestore } bind def /S { moveto 0 exch ashow } bind def /SF { gsave moveto RF 0 exch ashow grestore } bind def /B { moveto 0 32 4 2 roll 0 exch awidthshow } bind def /BF { gsave moveto RF 0 32 4 2 roll 0 exch awidthshow grestore } bind def /G { gsave newpath normalize translate 0.0 0.0 moveto dnormalize scale 0.0 0.0 1.0 5 3 roll arc closepath fill grestore } bind def /A { gsave savematrix newpath 2 index 2 div add exch 3 index 2 div sub exch normalize 2 index 2 div sub exch 3 index 2 div add exch translate scale 0.0 0.0 1.0 5 3 roll arc restorematrix stroke grestore } bind def /x FMLOCAL /y FMLOCAL /w FMLOCAL /h FMLOCAL /xx FMLOCAL /yy FMLOCAL /ww FMLOCAL /hh FMLOCAL /FMsaveobject FMLOCAL /FMoptop FMLOCAL /FMdicttop FMLOCAL /BEGINPRINTCODE { /FMdicttop countdictstack 1 add def /FMoptop count 4 sub def /FMsaveobject save def userdict begin /showpage {} def FMNORMALIZEGRAPHICS 3 index neg 3 index neg translate } bind def /ENDPRINTCODE { count -1 FMoptop {pop pop} for countdictstack -1 FMdicttop {pop end} for FMsaveobject restore } bind def /gn { 0 { 46 mul cf read pop 32 sub dup 46 lt {exit} if 46 sub add } loop add } bind def /str FMLOCAL /cfs { /str sl string def 0 1 sl 1 sub {str exch val put} for str def } bind def /ic [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0223 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0223 0 {0 hx} {1 hx} {2 hx} {3 hx} {4 hx} {5 hx} {6 hx} {7 hx} {8 hx} {9 hx} {10 hx} {11 hx} {12 hx} {13 hx} {14 hx} {15 hx} {16 hx} {17 hx} {18 hx} {19 hx} {gn hx} {0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12} {13} {14} {15} {16} {17} {18} {19} {gn} {0 wh} {1 wh} {2 wh} {3 wh} {4 wh} {5 wh} {6 wh} {7 wh} {8 wh} {9 wh} {10 wh} {11 wh} {12 wh} {13 wh} {14 wh} {gn wh} {0 bl} {1 bl} {2 bl} {3 bl} {4 bl} {5 bl} {6 bl} {7 bl} {8 bl} {9 bl} {10 bl} {11 bl} {12 bl} {13 bl} {14 bl} {gn bl} {0 fl} {1 fl} {2 fl} {3 fl} {4 fl} {5 fl} {6 fl} {7 fl} {8 fl} {9 fl} {10 fl} {11 fl} {12 fl} {13 fl} {14 fl} {gn fl} ] def /sl FMLOCAL /val FMLOCAL /ws FMLOCAL /im FMLOCAL /bs FMLOCAL /cs FMLOCAL /len FMLOCAL /pos FMLOCAL /ms { /sl exch def /val 255 def /ws cfs /im cfs /val 0 def /bs cfs /cs cfs } bind def 400 ms /ip { is 0 cf cs readline pop { ic exch get exec add } forall pop } bind def /wh { /len exch def /pos exch def ws 0 len getinterval im pos len getinterval copy pop pos len } bind def /bl { /len exch def /pos exch def bs 0 len getinterval im pos len getinterval copy pop pos len } bind def /s1 1 string def /fl { /len exch def /pos exch def /val cf s1 readhexstring pop 0 get def pos 1 pos len add 1 sub {im exch val put} for pos len } bind def /hx { 3 copy getinterval cf exch readhexstring pop pop } bind def /h FMLOCAL /w FMLOCAL /d FMLOCAL /lb FMLOCAL /bitmapsave FMLOCAL /is FMLOCAL /cf FMLOCAL /wbytes { dup 8 eq {pop} {1 eq {7 add 8 idiv} {3 add 4 idiv} ifelse} ifelse } bind def /BEGINBITMAPBWc { 1 {} COMMONBITMAPc } bind def /BEGINBITMAPGRAYc { 8 {} COMMONBITMAPc } bind def /BEGINBITMAP2BITc { 2 {} COMMONBITMAPc } bind def /COMMONBITMAPc { /r exch def /d exch def gsave translate rotate scale /h exch def /w exch def /lb w d wbytes def sl lb lt {lb ms} if /bitmapsave save def r /is im 0 lb getinterval def ws 0 lb getinterval is copy pop /cf currentfile def w h d [w 0 0 h neg 0 h] {ip} image bitmapsave restore grestore } bind def /BEGINBITMAPBW { 1 {} COMMONBITMAP } bind def /BEGINBITMAPGRAY { 8 {} COMMONBITMAP } bind def /BEGINBITMAP2BIT { 2 {} COMMONBITMAP } bind def /COMMONBITMAP { /r exch def /d exch def gsave translate rotate scale /h exch def /w exch def /bitmapsave save def r /is w d wbytes string def /cf currentfile def w h d [w 0 0 h neg 0 h] {cf is readhexstring pop} image bitmapsave restore grestore } bind def /proc1 FMLOCAL /proc2 FMLOCAL /newproc FMLOCAL /Fmcc { /proc2 exch cvlit def /proc1 exch cvlit def /newproc proc1 length proc2 length add array def newproc 0 proc1 putinterval newproc proc1 length proc2 putinterval newproc cvx } bind def /ngrayt 256 array def /nredt 256 array def /nbluet 256 array def /ngreent 256 array def /gryt FMLOCAL /blut FMLOCAL /grnt FMLOCAL /redt FMLOCAL /indx FMLOCAL /cynu FMLOCAL /magu FMLOCAL /yelu FMLOCAL /k FMLOCAL /u FMLOCAL /colorsetup { currentcolortransfer /gryt exch def /blut exch def /grnt exch def /redt exch def 0 1 255 { /indx exch def /cynu 1 red indx get 255 div sub def /magu 1 green indx get 255 div sub def /yelu 1 blue indx get 255 div sub def /k cynu magu min yelu min def /u k currentundercolorremoval exec def nredt indx 1 0 cynu u sub max sub redt exec put ngreent indx 1 0 magu u sub max sub grnt exec put nbluet indx 1 0 yelu u sub max sub blut exec put ngrayt indx 1 k currentblackgeneration exec sub gryt exec put } for {255 mul cvi nredt exch get} {255 mul cvi ngreent exch get} {255 mul cvi nbluet exch get} {255 mul cvi ngrayt exch get} setcolortransfer {pop 0} setundercolorremoval {} setblackgeneration } bind def /tran FMLOCAL /fakecolorsetup { /tran 256 string def 0 1 255 {/indx exch def tran indx red indx get 77 mul green indx get 151 mul blue indx get 28 mul add add 256 idiv put} for currenttransfer {255 mul cvi tran exch get 255.0 div} exch Fmcc settransfer } bind def /BITMAPCOLOR { /d 8 def gsave translate rotate scale /h exch def /w exch def /bitmapsave save def colorsetup /is w d wbytes string def /cf currentfile def w h d [w 0 0 h neg 0 h] {cf is readhexstring pop} {is} {is} true 3 colorimage bitmapsave restore grestore } bind def /BITMAPCOLORc { /d 8 def gsave translate rotate scale /h exch def /w exch def /lb w d wbytes def sl lb lt {lb ms} if /bitmapsave save def colorsetup /is im 0 lb getinterval def ws 0 lb getinterval is copy pop /cf currentfile def w h d [w 0 0 h neg 0 h] {ip} {is} {is} true 3 colorimage bitmapsave restore grestore } bind def /BITMAPTRUECOLORc { gsave translate rotate scale /h exch def /w exch def /bitmapsave save def /is w string def ws 0 w getinterval is copy pop /cf currentfile def w h 8 [w 0 0 h neg 0 h] {ip} {gip} {bip} true 3 colorimage bitmapsave restore grestore } bind def /BITMAPTRUECOLOR { gsave translate rotate scale /h exch def /w exch def /bitmapsave save def /is w string def /gis w string def /bis w string def /cf currentfile def w h 8 [w 0 0 h neg 0 h] { cf is readhexstring pop } { cf gis readhexstring pop } { cf bis readhexstring pop } true 3 colorimage bitmapsave restore grestore } bind def /BITMAPTRUEGRAYc { gsave translate rotate scale /h exch def /w exch def /bitmapsave save def /is w string def ws 0 w getinterval is copy pop /cf currentfile def w h 8 [w 0 0 h neg 0 h] {ip gip bip w gray} image bitmapsave restore grestore } bind def /ww FMLOCAL /r FMLOCAL /g FMLOCAL /b FMLOCAL /i FMLOCAL /gray { /ww exch def /b exch def /g exch def /r exch def 0 1 ww 1 sub { /i exch def r i get .299 mul g i get .587 mul b i get .114 mul add add r i 3 -1 roll floor cvi put } for r } bind def /BITMAPTRUEGRAY { gsave translate rotate scale /h exch def /w exch def /bitmapsave save def /is w string def /gis w string def /bis w string def /cf currentfile def w h 8 [w 0 0 h neg 0 h] { cf is readhexstring pop cf gis readhexstring pop cf bis readhexstring pop w gray} image bitmapsave restore grestore } bind def /BITMAPGRAY { 8 {fakecolorsetup} COMMONBITMAP } bind def /BITMAPGRAYc { 8 {fakecolorsetup} COMMONBITMAPc } bind def /ENDBITMAP { } bind def end /ALDsave FMLOCAL /ALDmatrix matrix def ALDmatrix currentmatrix pop /StartALD { /ALDsave save def savematrix ALDmatrix setmatrix } bind def /InALD { restorematrix } bind def /DoneALD { ALDsave restore } bind def %%EndProlog %%BeginSetup (3.0) FMVERSION 1 1 612 792 0 1 16 FMDOCUMENT 0 0 /Helvetica FMFONTDEFINE 1 0 /Helvetica-Bold FMFONTDEFINE 2 0 /Times-Roman FMFONTDEFINE 3 0 /Times-Italic FMFONTDEFINE 4 0 /Times-Bold FMFONTDEFINE 32 FMFILLS 0 0 FMFILL 1 .1 FMFILL 2 .3 FMFILL 3 .5 FMFILL 4 .7 FMFILL 5 .9 FMFILL 6 .97 FMFILL 7 1 FMFILL 8 <0f1e3c78f0e1c387> FMFILL 9 <0f87c3e1f0783c1e> FMFILL 10 FMFILL 11 FMFILL 12 <8142241818244281> FMFILL 13 <03060c183060c081> FMFILL 14 <8040201008040201> FMFILL 16 1 FMFILL 17 .9 FMFILL 18 .7 FMFILL 19 .5 FMFILL 20 .3 FMFILL 21 .1 FMFILL 22 0.03 FMFILL 23 0 FMFILL 24 FMFILL 25 FMFILL 26 <3333333333333333> FMFILL 27 <0000ffff0000ffff> FMFILL 28 <7ebddbe7e7dbbd7e> FMFILL 29 FMFILL 30 <7fbfdfeff7fbfdfe> FMFILL %%EndSetup %%Page: "1" 1 %%BeginPaperSize: Letter %%EndPaperSize 612 792 0 FMBEGINPAGE 72 746 540 756 R 7 X 0 K V 72 32.67 540 42.67 R V 161 394 437 537 R 3 X V 0.5 H 2 Z 0 X N 0 24 Q (The) 233 641 T 258.78 350.14 269.26 350.14 2 L 1 H N 264.02 349.85 264.02 334.13 2 L N 258.78 334.42 269.26 334.42 2 L N 258.78 342.86 269.26 342.86 2 L N 284.98 358 284.98 323.95 2 L N 278.28 348.98 291.67 348.98 2 L N 275.37 339.95 294 339.95 2 L N 279.74 334.42 274.5 326.57 2 L N 289.34 333.55 292.83 326.57 2 L N 274.96 352.47 M 275.7 350.46 275.7 350.46 275.88 349.73 D 276.06 348.99 276.06 348.99 276.15 348.26 D 276.24 347.53 276.24 347.53 274.96 345.15 D N 313.19 329.9 326.85 348.01 R N 303.44 325.44 338 325.44 2 L N 313.19 337.42 326.85 337.42 2 L N 313.19 342.44 326.85 342.44 2 L N 311.8 359.72 312.91 357.77 313.19 354.98 311.8 349.97 4 L N 314.31 358.05 317.37 358.33 2 L N 314.03 353.31 317.09 350.24 2 L N 323.51 360 324.62 358.05 324.9 355.26 323.51 350.24 4 L N 326.01 358.33 329.08 358.61 2 L N 325.73 353.59 328.8 350.52 2 L N 314.86 327.39 317.09 325.16 317.65 322.93 316.82 320.98 314.86 319.02 5 L N 326.01 327.39 326.57 323.21 325.46 319.86 3 L N 301.1 278.63 339 278.63 2 L N 306.62 278.63 304.78 286.36 331.64 286.36 329.07 278.63 4 L N 315.08 286.36 314.72 279 2 L N 322.08 285.62 321.71 278.63 2 L N 300 303.28 317.66 304.39 2 L N 308.46 309.91 312.51 305.49 2 L N 311.04 301.81 313.61 297.4 2 L N 303.68 291.88 305.52 294.45 306.26 299.6 305.52 312.11 314.35 314.32 313.98 292.25 6 L N 305.89 313.58 308.83 318 2 L N 321.71 302.55 324.65 304.76 324.28 312.11 327.59 312.85 331.27 312.48 331.64 306.23 331.27 303.28 334.58 302.18 336.79 304.39 9 L N 320.24 289.67 325.76 291.88 330.91 295.92 332.38 299.6 321.71 299.6 326.49 293.35 329.8 290.41 336.79 290.41 8 L N 268.19 283.9 281.85 302.01 R N 258.44 279.44 293 279.44 2 L N 268.19 291.42 281.85 291.42 2 L N 268.19 296.44 281.85 296.44 2 L N 266.8 313.72 267.91 311.77 268.19 308.98 266.8 303.97 4 L N 269.31 312.05 272.37 312.33 2 L N 269.03 307.31 272.09 304.24 2 L N 278.51 314 279.62 312.05 279.9 309.26 278.51 304.24 4 L N 281.01 312.33 284.08 312.61 2 L N 280.73 307.59 283.8 304.52 2 L N 269.86 281.39 272.09 279.16 272.65 276.93 271.82 274.98 269.86 273.03 5 L N 281.01 281.39 281.57 277.21 280.46 273.86 3 L N 1 9 Q (November 1991) 273 226 T 0 24 Q (Abacus:) 279.7 640.51 T 0 18 Q (The Art of Calculation using Beads) 165 607.94 T 166 493 432 530.57 R 7 X V 0.5 H 0 X N 167 402.62 431 484 R 7 X V 0 X N 90 450 8.5 5.5 179.21 522.07 G 90 450 8.5 5.5 179.21 522.07 A 90 450 8.5 5.5 179.21 509.07 G 90 450 8.5 5.5 179.21 509.07 A 90 450 8.5 5.5 179.21 449.21 G 90 450 8.5 5.5 179.21 449.21 A 90 450 8.5 5.5 179.21 463.21 G 90 450 8.5 5.5 179.21 463.21 A 90 450 8.5 5.5 179.21 435.5 G 90 450 8.5 5.5 179.21 435.5 A 90 450 8.5 5.5 179.21 422.21 G 90 450 8.5 5.5 179.21 422.21 A 90 450 8.5 5.5 179.93 409.21 G 90 450 8.5 5.5 179.93 409.21 A 179.43 531.29 179.43 402.29 2 L V N 90 450 8.5 5.5 360.79 521.93 G 90 450 8.5 5.5 360.79 521.93 A 90 450 8.5 5.5 360.79 508.93 G 90 450 8.5 5.5 360.79 508.93 A 90 450 8.5 5.5 360.79 449.07 G 90 450 8.5 5.5 360.79 449.07 A 90 450 8.5 5.5 360.79 463.07 G 90 450 8.5 5.5 360.79 463.07 A 90 450 8.5 5.5 360.79 435.36 G 90 450 8.5 5.5 360.79 435.36 A 90 450 8.5 5.5 360.79 422.07 G 90 450 8.5 5.5 360.79 422.07 A 90 450 8.5 5.5 361.5 409.07 G 90 450 8.5 5.5 361.5 409.07 A 361 531.14 361 402.14 2 L V N 90 450 8.5 5.5 380.22 521.79 G 90 450 8.5 5.5 380.22 521.79 A 90 450 8.5 5.5 380.22 508.79 G 90 450 8.5 5.5 380.22 508.79 A 90 450 8.5 5.5 380.22 448.93 G 90 450 8.5 5.5 380.22 448.93 A 90 450 8.5 5.5 380.22 462.93 G 90 450 8.5 5.5 380.22 462.93 A 90 450 8.5 5.5 380.22 435.21 G 90 450 8.5 5.5 380.22 435.21 A 90 450 8.5 5.5 380.22 421.93 G 90 450 8.5 5.5 380.22 421.93 A 90 450 8.5 5.5 380.93 408.93 G 90 450 8.5 5.5 380.93 408.93 A 380.43 531 380.43 402 2 L V N 90 450 8.5 5.5 399.36 521.93 G 90 450 8.5 5.5 399.36 521.93 A 90 450 8.5 5.5 399.36 508.93 G 90 450 8.5 5.5 399.36 508.93 A 90 450 8.5 5.5 399.36 449.07 G 90 450 8.5 5.5 399.36 449.07 A 90 450 8.5 5.5 399.36 463.07 G 90 450 8.5 5.5 399.36 463.07 A 90 450 8.5 5.5 399.36 435.36 G 90 450 8.5 5.5 399.36 435.36 A 90 450 8.5 5.5 399.36 422.07 G 90 450 8.5 5.5 399.36 422.07 A 90 450 8.5 5.5 400.07 409.07 G 90 450 8.5 5.5 400.07 409.07 A 399.57 531.14 399.57 402.14 2 L V N 90 450 8.5 5.5 419.5 521.79 G 90 450 8.5 5.5 419.5 521.79 A 90 450 8.5 5.5 419.5 508.79 G 90 450 8.5 5.5 419.5 508.79 A 90 450 8.5 5.5 419.5 448.93 G 90 450 8.5 5.5 419.5 448.93 A 90 450 8.5 5.5 419.5 462.93 G 90 450 8.5 5.5 419.5 462.93 A 90 450 8.5 5.5 419.5 435.22 G 90 450 8.5 5.5 419.5 435.22 A 90 450 8.5 5.5 419.5 421.93 G 90 450 8.5 5.5 419.5 421.93 A 90 450 8.5 5.5 420.21 408.93 G 90 450 8.5 5.5 420.21 408.93 A 419.71 531 419.71 402 2 L V N 90 450 8.5 5.5 280.93 521.79 G 90 450 8.5 5.5 280.93 521.79 A 90 450 8.5 5.5 280.93 508.79 G 90 450 8.5 5.5 280.93 508.79 A 90 450 8.5 5.5 280.93 448.93 G 90 450 8.5 5.5 280.93 448.93 A 90 450 8.5 5.5 280.93 462.93 G 90 450 8.5 5.5 280.93 462.93 A 90 450 8.5 5.5 280.93 435.21 G 90 450 8.5 5.5 280.93 435.21 A 90 450 8.5 5.5 280.93 421.93 G 90 450 8.5 5.5 280.93 421.93 A 90 450 8.5 5.5 281.64 408.93 G 90 450 8.5 5.5 281.64 408.93 A 281.14 531 281.14 402 2 L V N 90 450 8.5 5.5 300.36 521.64 G 90 450 8.5 5.5 300.36 521.64 A 90 450 8.5 5.5 300.36 508.64 G 90 450 8.5 5.5 300.36 508.64 A 90 450 8.5 5.5 300.36 448.79 G 90 450 8.5 5.5 300.36 448.79 A 90 450 8.5 5.5 300.36 462.79 G 90 450 8.5 5.5 300.36 462.79 A 90 450 8.5 5.5 300.36 435.07 G 90 450 8.5 5.5 300.36 435.07 A 90 450 8.5 5.5 300.36 421.79 G 90 450 8.5 5.5 300.36 421.79 A 90 450 8.5 5.5 301.07 408.79 G 90 450 8.5 5.5 301.07 408.79 A 300.57 530.86 300.57 401.86 2 L V N 90 450 8.5 5.5 319.5 521.79 G 90 450 8.5 5.5 319.5 521.79 A 90 450 8.5 5.5 319.5 508.79 G 90 450 8.5 5.5 319.5 508.79 A 90 450 8.5 5.5 319.5 448.93 G 90 450 8.5 5.5 319.5 448.93 A 90 450 8.5 5.5 319.5 462.93 G 90 450 8.5 5.5 319.5 462.93 A 90 450 8.5 5.5 319.5 435.22 G 90 450 8.5 5.5 319.5 435.22 A 90 450 8.5 5.5 319.5 421.93 G 90 450 8.5 5.5 319.5 421.93 A 90 450 8.5 5.5 320.21 408.93 G 90 450 8.5 5.5 320.21 408.93 A 319.71 531 319.71 402 2 L V N 90 450 8.5 5.5 339.64 521.64 G 90 450 8.5 5.5 339.64 521.64 A 90 450 8.5 5.5 339.64 508.64 G 90 450 8.5 5.5 339.64 508.64 A 90 450 8.5 5.5 339.64 448.79 G 90 450 8.5 5.5 339.64 448.79 A 90 450 8.5 5.5 339.64 462.79 G 90 450 8.5 5.5 339.64 462.79 A 90 450 8.5 5.5 339.64 435.07 G 90 450 8.5 5.5 339.64 435.07 A 90 450 8.5 5.5 339.64 421.79 G 90 450 8.5 5.5 339.64 421.79 A 90 450 8.5 5.5 340.36 408.79 G 90 450 8.5 5.5 340.36 408.79 A 339.86 530.86 339.86 401.86 2 L V N 90 450 8.5 5.5 200.36 522.36 G 90 450 8.5 5.5 200.36 522.36 A 90 450 8.5 5.5 200.36 509.36 G 90 450 8.5 5.5 200.36 509.36 A 90 450 8.5 5.5 200.36 449.5 G 90 450 8.5 5.5 200.36 449.5 A 90 450 8.5 5.5 200.36 463.5 G 90 450 8.5 5.5 200.36 463.5 A 90 450 8.5 5.5 200.36 435.79 G 90 450 8.5 5.5 200.36 435.79 A 90 450 8.5 5.5 200.36 422.5 G 90 450 8.5 5.5 200.36 422.5 A 90 450 8.5 5.5 201.07 409.5 G 90 450 8.5 5.5 201.07 409.5 A 200.57 531.57 200.57 402.57 2 L V N 90 450 8.5 5.5 219.79 522.21 G 90 450 8.5 5.5 219.79 522.21 A 90 450 8.5 5.5 219.79 509.21 G 90 450 8.5 5.5 219.79 509.21 A 90 450 8.5 5.5 219.79 449.36 G 90 450 8.5 5.5 219.79 449.36 A 90 450 8.5 5.5 219.79 463.36 G 90 450 8.5 5.5 219.79 463.36 A 90 450 8.5 5.5 219.79 435.64 G 90 450 8.5 5.5 219.79 435.64 A 90 450 8.5 5.5 219.79 422.36 G 90 450 8.5 5.5 219.79 422.36 A 90 450 8.5 5.5 220.5 409.36 G 90 450 8.5 5.5 220.5 409.36 A 220 531.43 220 402.43 2 L V N 90 450 8.5 5.5 238.93 522.36 G 90 450 8.5 5.5 238.93 522.36 A 90 450 8.5 5.5 238.93 509.36 G 90 450 8.5 5.5 238.93 509.36 A 90 450 8.5 5.5 238.93 449.5 G 90 450 8.5 5.5 238.93 449.5 A 90 450 8.5 5.5 238.93 463.5 G 90 450 8.5 5.5 238.93 463.5 A 90 450 8.5 5.5 238.93 435.79 G 90 450 8.5 5.5 238.93 435.79 A 90 450 8.5 5.5 238.93 422.5 G 90 450 8.5 5.5 238.93 422.5 A 90 450 8.5 5.5 239.64 409.5 G 90 450 8.5 5.5 239.64 409.5 A 239.14 531.57 239.14 402.57 2 L V N 90 450 8.5 5.5 259.07 522.22 G 90 450 8.5 5.5 259.07 522.22 A 90 450 8.5 5.5 259.07 509.22 G 90 450 8.5 5.5 259.07 509.22 A 90 450 8.5 5.5 259.07 449.36 G 90 450 8.5 5.5 259.07 449.36 A 90 450 8.5 5.5 259.07 463.36 G 90 450 8.5 5.5 259.07 463.36 A 90 450 8.5 5.5 259.07 435.64 G 90 450 8.5 5.5 259.07 435.64 A 90 450 8.5 5.5 259.07 422.36 G 90 450 8.5 5.5 259.07 422.36 A 90 450 8.5 5.5 259.79 409.36 G 90 450 8.5 5.5 259.79 409.36 A 259.29 531.43 259.29 402.43 2 L V N 177.5 484.5 422.5 492.62 R 3 X V FMENDPAGE %%EndPage: "1" 2 %%Page: "2" 2 612 792 0 FMBEGINPAGE 72 750.02 558 750.02 2 L 7 X 0 K V 2 H 0 Z 0 X N 72 730.01 558 745.2 R 7 X V 72 726.98 558 726.98 2 L V 0.25 H 0 X N 72 74.02 558 74.02 2 L 7 X V 2 Z 0 X N 72 55.01 558 66.96 R 7 X V 1 10 Q 0 X (2) 533.41 60.96 T 1 9 Q ( of) 538.96 60.96 T 1 10 Q (3) 552.44 60.96 T 498.25 742.67 502.85 742.67 2 L 1 H N 500.55 742.55 500.55 735.65 2 L N 498.25 735.78 502.85 735.78 2 L N 498.25 739.48 502.85 739.48 2 L N 509.74 746.12 509.74 731.18 2 L N 506.8 742.16 512.68 742.16 2 L N 505.53 738.21 513.7 738.21 2 L N 507.44 735.78 505.14 732.33 2 L N 511.65 735.4 513.19 732.33 2 L N 505.35 743.7 M 505.67 742.81 505.67 742.81 505.75 742.49 D 505.83 742.17 505.83 742.17 505.87 741.85 D 505.91 741.53 505.91 741.53 505.35 740.49 D N 522.12 733.79 528.11 741.74 R N 517.84 731.84 533 731.84 2 L N 522.12 737.1 528.11 737.1 2 L N 522.12 739.3 528.11 739.3 2 L N 521.51 746.88 521.99 746.02 522.12 744.8 521.51 742.6 4 L N 522.61 746.14 523.95 746.27 2 L N 522.48 744.07 523.83 742.72 2 L N 526.64 747 527.13 746.14 527.25 744.92 526.64 742.72 4 L N 527.74 746.27 529.09 746.39 2 L N 527.62 744.19 528.96 742.84 2 L N 522.85 732.69 523.83 731.72 524.07 730.74 523.71 729.88 522.85 729.03 5 L N 527.74 732.69 527.98 730.86 527.5 729.39 3 L N 517.15 710.58 532 710.58 2 L N 519.31 710.58 518.59 713.6 529.12 713.6 528.11 710.58 4 L N 522.63 713.6 522.49 710.72 2 L N 525.37 713.32 525.22 710.58 2 L N 516.72 720.23 523.64 720.67 2 L N 520.03 722.83 521.62 721.1 2 L N 521.04 719.66 522.05 717.93 2 L N 518.16 715.77 518.88 716.78 519.17 718.79 518.88 723.69 522.34 724.56 522.2 715.91 6 L N 519.03 724.27 520.18 726 2 L N 525.22 719.95 526.38 720.81 526.23 723.69 527.53 723.98 528.97 723.84 529.12 721.39 528.97 720.23 530.27 719.8 531.13 720.67 9 L N 524.65 714.9 526.81 715.77 528.83 717.35 529.4 718.79 525.22 718.79 527.1 716.34 528.4 715.19 531.13 715.19 8 L N 504.26 712.64 509.61 719.74 R N 500.44 710.89 513.98 710.89 2 L N 504.26 715.59 509.61 715.59 2 L N 504.26 717.55 509.61 717.55 2 L N 503.71 724.32 504.15 723.56 504.26 722.47 503.71 720.5 4 L N 504.7 723.67 505.9 723.78 2 L N 504.59 721.81 505.79 720.61 2 L N 508.3 724.43 508.74 723.67 508.85 722.58 508.3 720.61 4 L N 509.28 723.78 510.48 723.89 2 L N 509.17 721.92 510.37 720.72 2 L N 504.91 711.66 505.79 710.78 506.01 709.91 505.68 709.15 504.91 708.38 5 L N 509.28 711.66 509.5 710.02 509.06 708.71 3 L N 72 87.98 558 686.02 R 7 X V 1 14 Q 0 X (Contents) 171 676.68 T 2 F (1.0) 180.51 654.68 T (Introduction) 207 654.68 T (6) 290.17 654.68 T (2.0) 180.51 632.68 T (Addition) 207 632.68 T (7) 270.75 632.68 T 2 12 Q (2.1) 207 618.02 T (Simple Addition) 230.4 618.02 T (7) 322.03 618.02 T (2.2) 207 604.02 T (Combined Adding-up And T) 230.4 604.02 T (aking Of) 368.48 604.02 T (f) 410.57 604.02 T (8) 426.55 604.02 T (2.3) 207 590.02 T (Combined T) 230.4 590.02 T (aking-of) 289.86 590.02 T (f And Place Advancement) 330.28 590.02 T (8) 468.51 590.02 T (2.4) 207 576.02 T (Combined Adding-up, T) 230.4 576.02 T (aking-of) 347.83 576.02 T (f And Place Advancement) 388.24 576.02 T (9) 526.47 576.02 T 2 14 Q (3.0) 180.51 554.68 T ( Subtraction) 207 554.68 T (9) 289.01 554.68 T 2 12 Q (3.1) 207 540.02 T (Simple T) 230.4 540.02 T (aking-of) 273.88 540.02 T (f) 314.29 540.02 T (9) 330.28 540.02 T (3.2) 207 526.02 T (Combined Adding-up And T) 230.4 526.02 T (aking Of) 368.48 526.02 T (f) 410.57 526.02 T (10) 426.55 526.02 T (3.3) 207 512.02 T (T) 230.4 512.02 T (aking-of) 236.89 512.02 T (f From A Rod Of Higher Order And Adding-up) 277.31 512.02 T (10) 518.47 512.02 T (3.4) 207 498.02 T 0.82 (Combined T) 230.4 498.02 P 0.82 (aking-of) 290.68 498.02 P 0.82 (f From A Rod Of Higher Order) 331.1 498.02 P 0.82 (, Adding-up in) 486.07 498.02 P (the Upper) 230.4 484.02 T (-deck and T) 277.79 484.02 T (aking-of) 334.23 484.02 T (f in the Lower) 374.64 484.02 T (-Deck) 442.68 484.02 T (1) 483.98 484.02 T (1) 489.53 484.02 T 2 14 Q (4.0) 180.51 462.68 T (Acknowledgments) 207 462.68 T (1) 325.92 462.68 T (1) 332.4 462.68 T (5.0) 180.51 440.68 T (Do those Chinese characters really mean anything?) 207 440.68 T (12) 507.77 440.68 T FMENDPAGE %%EndPage: "2" 3 %%Page: "3" 3 612 792 0 FMBEGINPAGE 54 750.02 540 750.02 2 L 7 X 0 K V 2 H 0 Z 0 X N 54 730.01 540 745.2 R 7 X V 54 726.98 540 726.98 2 L V 0.25 H 0 X N 54 74.02 540 74.02 2 L 7 X V 2 Z 0 X N 54 55.01 540 66.96 R 7 X V 1 10 Q 0 X (3) 54 60.96 T 1 9 Q ( of) 59.56 60.96 T 1 10 Q ( 3) 70.54 60.96 T 498.25 742.67 502.85 742.67 2 L 1 H N 500.55 742.55 500.55 735.65 2 L N 498.25 735.78 502.85 735.78 2 L N 498.25 739.48 502.85 739.48 2 L N 509.74 746.12 509.74 731.18 2 L N 506.8 742.16 512.68 742.16 2 L N 505.53 738.21 513.7 738.21 2 L N 507.44 735.78 505.14 732.33 2 L N 511.65 735.4 513.19 732.33 2 L N 505.35 743.7 M 505.67 742.81 505.67 742.81 505.75 742.49 D 505.83 742.17 505.83 742.17 505.87 741.85 D 505.91 741.53 505.91 741.53 505.35 740.49 D N 522.12 733.79 528.11 741.74 R N 517.84 731.84 533 731.84 2 L N 522.12 737.1 528.11 737.1 2 L N 522.12 739.3 528.11 739.3 2 L N 521.51 746.88 521.99 746.02 522.12 744.8 521.51 742.6 4 L N 522.61 746.14 523.95 746.27 2 L N 522.48 744.07 523.83 742.72 2 L N 526.64 747 527.13 746.14 527.25 744.92 526.64 742.72 4 L N 527.74 746.27 529.09 746.39 2 L N 527.62 744.19 528.96 742.84 2 L N 522.85 732.69 523.83 731.72 524.07 730.74 523.71 729.88 522.85 729.03 5 L N 527.74 732.69 527.98 730.86 527.5 729.39 3 L N 517.15 710.58 532 710.58 2 L N 519.31 710.58 518.59 713.6 529.12 713.6 528.11 710.58 4 L N 522.63 713.6 522.49 710.72 2 L N 525.37 713.32 525.22 710.58 2 L N 516.72 720.23 523.64 720.67 2 L N 520.03 722.83 521.62 721.1 2 L N 521.04 719.66 522.05 717.93 2 L N 518.16 715.77 518.88 716.78 519.17 718.79 518.88 723.69 522.34 724.56 522.2 715.91 6 L N 519.03 724.27 520.18 726 2 L N 525.22 719.95 526.38 720.81 526.23 723.69 527.53 723.98 528.97 723.84 529.12 721.39 528.97 720.23 530.27 719.8 531.13 720.67 9 L N 524.65 714.9 526.81 715.77 528.83 717.35 529.4 718.79 525.22 718.79 527.1 716.34 528.4 715.19 531.13 715.19 8 L N 504.26 712.64 509.61 719.74 R N 500.44 710.89 513.98 710.89 2 L N 504.26 715.59 509.61 715.59 2 L N 504.26 717.55 509.61 717.55 2 L N 503.71 724.32 504.15 723.56 504.26 722.47 503.71 720.5 4 L N 504.7 723.67 505.9 723.78 2 L N 504.59 721.81 505.79 720.61 2 L N 508.3 724.43 508.74 723.67 508.85 722.58 508.3 720.61 4 L N 509.28 723.78 510.48 723.89 2 L N 509.17 721.92 510.37 720.72 2 L N 504.91 711.66 505.79 710.78 506.01 709.91 505.68 709.15 504.91 708.38 5 L N 509.28 711.66 509.5 710.02 509.06 708.71 3 L N 54 87.98 540 686.02 R 7 X V FMENDPAGE %%EndPage: "3" 4 %%Page: "4" 4 612 792 0 FMBEGINPAGE 72 750.02 558 750.02 2 L 7 X 0 K V 2 H 0 Z 0 X N 72 730.01 558 745.2 R 7 X V 72 726.98 558 726.98 2 L V 0.25 H 0 X N 72 74.02 558 74.02 2 L 7 X V 2 Z 0 X N 72 55.01 558 66.96 R 7 X V 1 10 Q 0 X (4) 533.41 60.96 T 1 9 Q ( of) 538.96 60.96 T 1 10 Q (5) 552.44 60.96 T 498.25 742.67 502.85 742.67 2 L 1 H N 500.55 742.55 500.55 735.65 2 L N 498.25 735.78 502.85 735.78 2 L N 498.25 739.48 502.85 739.48 2 L N 509.74 746.12 509.74 731.18 2 L N 506.8 742.16 512.68 742.16 2 L N 505.53 738.21 513.7 738.21 2 L N 507.44 735.78 505.14 732.33 2 L N 511.65 735.4 513.19 732.33 2 L N 505.35 743.7 M 505.67 742.81 505.67 742.81 505.75 742.49 D 505.83 742.17 505.83 742.17 505.87 741.85 D 505.91 741.53 505.91 741.53 505.35 740.49 D N 522.12 733.79 528.11 741.74 R N 517.84 731.84 533 731.84 2 L N 522.12 737.1 528.11 737.1 2 L N 522.12 739.3 528.11 739.3 2 L N 521.51 746.88 521.99 746.02 522.12 744.8 521.51 742.6 4 L N 522.61 746.14 523.95 746.27 2 L N 522.48 744.07 523.83 742.72 2 L N 526.64 747 527.13 746.14 527.25 744.92 526.64 742.72 4 L N 527.74 746.27 529.09 746.39 2 L N 527.62 744.19 528.96 742.84 2 L N 522.85 732.69 523.83 731.72 524.07 730.74 523.71 729.88 522.85 729.03 5 L N 527.74 732.69 527.98 730.86 527.5 729.39 3 L N 517.15 710.58 532 710.58 2 L N 519.31 710.58 518.59 713.6 529.12 713.6 528.11 710.58 4 L N 522.63 713.6 522.49 710.72 2 L N 525.37 713.32 525.22 710.58 2 L N 516.72 720.23 523.64 720.67 2 L N 520.03 722.83 521.62 721.1 2 L N 521.04 719.66 522.05 717.93 2 L N 518.16 715.77 518.88 716.78 519.17 718.79 518.88 723.69 522.34 724.56 522.2 715.91 6 L N 519.03 724.27 520.18 726 2 L N 525.22 719.95 526.38 720.81 526.23 723.69 527.53 723.98 528.97 723.84 529.12 721.39 528.97 720.23 530.27 719.8 531.13 720.67 9 L N 524.65 714.9 526.81 715.77 528.83 717.35 529.4 718.79 525.22 718.79 527.1 716.34 528.4 715.19 531.13 715.19 8 L N 504.26 712.64 509.61 719.74 R N 500.44 710.89 513.98 710.89 2 L N 504.26 715.59 509.61 715.59 2 L N 504.26 717.55 509.61 717.55 2 L N 503.71 724.32 504.15 723.56 504.26 722.47 503.71 720.5 4 L N 504.7 723.67 505.9 723.78 2 L N 504.59 721.81 505.79 720.61 2 L N 508.3 724.43 508.74 723.67 508.85 722.58 508.3 720.61 4 L N 509.28 723.78 510.48 723.89 2 L N 509.17 721.92 510.37 720.72 2 L N 504.91 711.66 505.79 710.78 506.01 709.91 505.68 709.15 504.91 708.38 5 L N 509.28 711.66 509.5 710.02 509.06 708.71 3 L N 72 87.98 558 686.02 R 7 X V 1 14 Q 0 X (List of T) 171 676.68 T (ables) 224.38 676.68 T 2 10 Q (T) 171 651.35 T (ABLE 1) 176.31 651.35 T (Simple Addition) 234 651.35 T (6) 310.36 651.35 T (T) 171 639.35 T (ABLE 2) 176.31 639.35 T (Combined Adding-up And T) 234 639.35 T (aking Of) 349.07 639.35 T (f) 384.14 639.35 T (7) 397.46 639.35 T (T) 171 627.35 T (ABLE 3) 176.31 627.35 T (Combined Adding-up And Place Advancement) 234 627.35 T (7) 433.31 627.35 T (T) 171 615.35 T (ABLE 4) 176.31 615.35 T (Combined Adding-up And T) 234 615.35 T (aking Of) 349.07 615.35 T (f and Place Advancement) 384.14 615.35 T (8) 496.55 615.35 T (T) 171 603.35 T (ABLE 5) 176.31 603.35 T (Simple T) 234 603.35 T (aking-of) 270.23 603.35 T (f) 303.91 603.35 T (8) 317.23 603.35 T (T) 171 591.35 T (ABLE 6) 176.31 591.35 T (Combined Adding-up And T) 234 591.35 T (aking Of) 349.07 591.35 T (f) 384.14 591.35 T (9) 397.46 591.35 T (T) 171 579.35 T (ABLE 7) 176.31 579.35 T (T) 234 579.35 T (aking-of) 239.41 579.35 T (f From A Rod Of Higher Order And Adding-up) 273.09 579.35 T (9) 474.06 579.35 T (T) 171 567.35 T (ABLE 8) 176.31 567.35 T (Combined T) 234 567.35 T (aking-of) 283.55 567.35 T (f...) 317.23 567.35 T (10) 338.05 567.35 T FMENDPAGE %%EndPage: "4" 5 %%Page: "5" 5 612 792 0 FMBEGINPAGE 54 750.02 540 750.02 2 L 7 X 0 K V 2 H 0 Z 0 X N 54 730.01 540 745.2 R 7 X V 54 726.98 540 726.98 2 L V 0.25 H 0 X N 54 74.02 540 74.02 2 L 7 X V 2 Z 0 X N 54 55.01 540 66.96 R 7 X V 1 10 Q 0 X (5) 54 60.96 T 1 9 Q ( of) 59.56 60.96 T 1 10 Q ( 5) 70.54 60.96 T 498.25 742.67 502.85 742.67 2 L 1 H N 500.55 742.55 500.55 735.65 2 L N 498.25 735.78 502.85 735.78 2 L N 498.25 739.48 502.85 739.48 2 L N 509.74 746.12 509.74 731.18 2 L N 506.8 742.16 512.68 742.16 2 L N 505.53 738.21 513.7 738.21 2 L N 507.44 735.78 505.14 732.33 2 L N 511.65 735.4 513.19 732.33 2 L N 505.35 743.7 M 505.67 742.81 505.67 742.81 505.75 742.49 D 505.83 742.17 505.83 742.17 505.87 741.85 D 505.91 741.53 505.91 741.53 505.35 740.49 D N 522.12 733.79 528.11 741.74 R N 517.84 731.84 533 731.84 2 L N 522.12 737.1 528.11 737.1 2 L N 522.12 739.3 528.11 739.3 2 L N 521.51 746.88 521.99 746.02 522.12 744.8 521.51 742.6 4 L N 522.61 746.14 523.95 746.27 2 L N 522.48 744.07 523.83 742.72 2 L N 526.64 747 527.13 746.14 527.25 744.92 526.64 742.72 4 L N 527.74 746.27 529.09 746.39 2 L N 527.62 744.19 528.96 742.84 2 L N 522.85 732.69 523.83 731.72 524.07 730.74 523.71 729.88 522.85 729.03 5 L N 527.74 732.69 527.98 730.86 527.5 729.39 3 L N 517.15 710.58 532 710.58 2 L N 519.31 710.58 518.59 713.6 529.12 713.6 528.11 710.58 4 L N 522.63 713.6 522.49 710.72 2 L N 525.37 713.32 525.22 710.58 2 L N 516.72 720.23 523.64 720.67 2 L N 520.03 722.83 521.62 721.1 2 L N 521.04 719.66 522.05 717.93 2 L N 518.16 715.77 518.88 716.78 519.17 718.79 518.88 723.69 522.34 724.56 522.2 715.91 6 L N 519.03 724.27 520.18 726 2 L N 525.22 719.95 526.38 720.81 526.23 723.69 527.53 723.98 528.97 723.84 529.12 721.39 528.97 720.23 530.27 719.8 531.13 720.67 9 L N 524.65 714.9 526.81 715.77 528.83 717.35 529.4 718.79 525.22 718.79 527.1 716.34 528.4 715.19 531.13 715.19 8 L N 504.26 712.64 509.61 719.74 R N 500.44 710.89 513.98 710.89 2 L N 504.26 715.59 509.61 715.59 2 L N 504.26 717.55 509.61 717.55 2 L N 503.71 724.32 504.15 723.56 504.26 722.47 503.71 720.5 4 L N 504.7 723.67 505.9 723.78 2 L N 504.59 721.81 505.79 720.61 2 L N 508.3 724.43 508.74 723.67 508.85 722.58 508.3 720.61 4 L N 509.28 723.78 510.48 723.89 2 L N 509.17 721.92 510.37 720.72 2 L N 504.91 711.66 505.79 710.78 506.01 709.91 505.68 709.15 504.91 708.38 5 L N 509.28 711.66 509.5 710.02 509.06 708.71 3 L N 54 87.98 540 686.02 R 7 X V FMENDPAGE %%EndPage: "5" 6 %%Page: "6" 6 612 792 0 FMBEGINPAGE 72 750.02 558 750.02 2 L 7 X 0 K V 2 H 0 Z 0 X N 72 725.98 198 743.98 R 7 X V 1 9 Q 0 X (December 2, 1991) 72 737.98 T 72 444.02 558 444.02 2 L 7 X V 2 Z 0 X N 72 74.02 558 74.02 2 L 7 X V 0.25 H 0 X N 72 55.01 558 66.96 R 7 X V 1 10 Q 0 X (6) 527.85 60.96 T 1 9 Q ( of) 533.41 60.96 T 1 10 Q (12) 546.89 60.96 T 207 468 558 693 R 7 X V 207 658.99 558 669 C 207 660 459 660 2 L 0.25 H 0 Z 0 X 0 K N 0 0 612 792 C 2 24 Q 0 X 0 K -0.48 (The Abacus) 207 677 S 1 9 Q (The Art of Calculation using) 207 600.99 T (Beads) 207 588.99 T 72 87.98 558 432 R 7 X V 72 410.98 558 420 C 207 418.49 558 418.49 2 L 0.25 H 2 Z 0 X 0 K N 72 418.49 198 418.49 2 L 0 Z N 0 0 612 792 C 1 12 Q 0 X 0 K (1.0) 181.33 424 T (Introduction) 207 424 T 72 200.94 558 213.98 C 207 208 558 208 2 L 0.25 H 2 Z 0 X 0 K N 72 208 198 208 2 L 0 Z N 0 0 612 792 C 1 9 Q 0 X 0 K (FIGURE 1) 72 194.94 T 0 F (The Anatomy of an Abacus) 207 194.94 T 2 10 Q (The classic abacus has two decks. Each deck, separated by a beam, has several \050nor-) 207 173.28 T -0.14 (mally 13\051 rods on which are mounted beads. Each rod on the top deck contains 2 beads,) 207 161.28 P (and each rod on the bottom deck contains 5 beads. Each bead on the upper deck has a) 207 149.28 T (value of \336ve, while each bead on the lower deck has value of one.) 207 137.28 T (Beads are considered counted, when moved) 207 113.28 T 3 F (towar) 384.91 113.28 T (ds) 407.87 113.28 T 2 F ( the beam separating the decks.) 416.76 113.28 T 72 87.98 558 432 C 78.75 227.98 551.25 410.98 C 78.75 227.98 551.25 410.98 R 7 X 0 K V 206 250 416 359 R 3 X V 0.5 H 2 Z 0 X N 209.8 325.46 412.19 354.1 R 7 X V 0 X N 210.57 256.57 411.43 318.6 R 7 X V 0 X N 90 450 6.47 4.19 219.86 347.62 G 90 450 6.47 4.19 219.86 347.62 A 90 450 6.47 4.19 219.86 337.71 G 90 450 6.47 4.19 219.86 337.71 A 90 450 6.47 4.19 219.86 292.09 G 90 450 6.47 4.19 219.86 292.09 A 90 450 6.47 4.19 219.86 302.76 G 90 450 6.47 4.19 219.86 302.76 A 90 450 6.47 4.19 219.86 281.63 G 90 450 6.47 4.19 219.86 281.63 A 90 450 6.47 4.19 219.86 271.51 G 90 450 6.47 4.19 219.86 271.51 A 90 450 6.47 4.19 220.4 261.6 G 90 450 6.47 4.19 220.4 261.6 A 220.02 354.64 220.02 256.32 2 L V N 90 450 6.47 4.19 358.01 347.51 G 90 450 6.47 4.19 358.01 347.51 A 90 450 6.47 4.19 358.01 337.6 G 90 450 6.47 4.19 358.01 337.6 A 90 450 6.47 4.19 358.01 291.98 G 90 450 6.47 4.19 358.01 291.98 A 90 450 6.47 4.19 358.01 302.65 G 90 450 6.47 4.19 358.01 302.65 A 90 450 6.47 4.19 358.01 281.52 G 90 450 6.47 4.19 358.01 281.52 A 90 450 6.47 4.19 358.01 271.4 G 90 450 6.47 4.19 358.01 271.4 A 90 450 6.47 4.19 358.55 261.49 G 90 450 6.47 4.19 358.55 261.49 A 358.17 354.54 358.17 256.21 2 L V N 90 450 6.47 4.19 372.79 347.4 G 90 450 6.47 4.19 372.79 347.4 A 90 450 6.47 4.19 372.79 337.49 G 90 450 6.47 4.19 372.79 337.49 A 90 450 6.47 4.19 372.79 291.87 G 90 450 6.47 4.19 372.79 291.87 A 90 450 6.47 4.19 372.79 302.54 G 90 450 6.47 4.19 372.79 302.54 A 90 450 6.47 4.19 372.79 281.42 G 90 450 6.47 4.19 372.79 281.42 A 90 450 6.47 4.19 372.79 271.29 G 90 450 6.47 4.19 372.79 271.29 A 90 450 6.47 4.19 373.34 261.38 G 90 450 6.47 4.19 373.34 261.38 A 372.96 354.43 372.96 256.1 2 L V N 90 450 6.47 4.19 387.36 347.51 G 90 450 6.47 4.19 387.36 347.51 A 90 450 6.47 4.19 387.36 337.6 G 90 450 6.47 4.19 387.36 337.6 A 90 450 6.47 4.19 387.36 291.98 G 90 450 6.47 4.19 387.36 291.98 A 90 450 6.47 4.19 387.36 302.65 G 90 450 6.47 4.19 387.36 302.65 A 90 450 6.47 4.19 387.36 281.52 G 90 450 6.47 4.19 387.36 281.52 A 90 450 6.47 4.19 387.36 271.4 G 90 450 6.47 4.19 387.36 271.4 A 90 450 6.47 4.19 387.9 261.49 G 90 450 6.47 4.19 387.9 261.49 A 387.52 354.54 387.52 256.21 2 L V N 90 450 6.47 4.19 402.68 347.4 G 90 450 6.47 4.19 402.68 347.4 A 90 450 6.47 4.19 402.68 337.49 G 90 450 6.47 4.19 402.68 337.49 A 90 450 6.47 4.19 402.68 291.87 G 90 450 6.47 4.19 402.68 291.87 A 90 450 6.47 4.19 402.68 302.54 G 90 450 6.47 4.19 402.68 302.54 A 90 450 6.47 4.19 402.68 281.42 G 90 450 6.47 4.19 402.68 281.42 A 90 450 6.47 4.19 402.68 271.29 G 90 450 6.47 4.19 402.68 271.29 A 90 450 6.47 4.19 403.23 261.38 G 90 450 6.47 4.19 403.23 261.38 A 402.85 354.43 402.85 256.1 2 L V N 90 450 6.47 4.19 297.25 347.4 G 90 450 6.47 4.19 297.25 347.4 A 90 450 6.47 4.19 297.25 337.49 G 90 450 6.47 4.19 297.25 337.49 A 90 450 6.47 4.19 297.25 291.87 G 90 450 6.47 4.19 297.25 291.87 A 90 450 6.47 4.19 297.25 302.54 G 90 450 6.47 4.19 297.25 302.54 A 90 450 6.47 4.19 297.25 281.42 G 90 450 6.47 4.19 297.25 281.42 A 90 450 6.47 4.19 297.25 271.29 G 90 450 6.47 4.19 297.25 271.29 A 90 450 6.47 4.19 297.79 261.38 G 90 450 6.47 4.19 297.79 261.38 A 297.41 354.43 297.41 256.1 2 L V N 90 450 6.47 4.19 312.03 347.29 G 90 450 6.47 4.19 312.03 347.29 A 90 450 6.47 4.19 312.03 337.39 G 90 450 6.47 4.19 312.03 337.39 A 90 450 6.47 4.19 312.03 291.76 G 90 450 6.47 4.19 312.03 291.76 A 90 450 6.47 4.19 312.03 302.43 G 90 450 6.47 4.19 312.03 302.43 A 90 450 6.47 4.19 312.03 281.31 G 90 450 6.47 4.19 312.03 281.31 A 90 450 6.47 4.19 312.03 271.18 G 90 450 6.47 4.19 312.03 271.18 A 90 450 6.47 4.19 312.58 261.27 G 90 450 6.47 4.19 312.58 261.27 A 312.2 354.32 312.2 255.99 2 L V N 90 450 6.47 4.19 326.6 347.4 G 90 450 6.47 4.19 326.6 347.4 A 90 450 6.47 4.19 326.6 337.49 G 90 450 6.47 4.19 326.6 337.49 A 90 450 6.47 4.19 326.6 291.87 G 90 450 6.47 4.19 326.6 291.87 A 90 450 6.47 4.19 326.6 302.54 G 90 450 6.47 4.19 326.6 302.54 A 90 450 6.47 4.19 326.6 281.42 G 90 450 6.47 4.19 326.6 281.42 A 90 450 6.47 4.19 326.6 271.29 G 90 450 6.47 4.19 326.6 271.29 A 90 450 6.47 4.19 327.14 261.38 G 90 450 6.47 4.19 327.14 261.38 A 326.76 354.43 326.76 256.1 2 L V N 90 450 6.47 4.19 341.92 347.3 G 90 450 6.47 4.19 341.92 347.3 A 90 450 6.47 4.19 341.92 337.39 G 90 450 6.47 4.19 341.92 337.39 A 90 450 6.47 4.19 341.92 291.76 G 90 450 6.47 4.19 341.92 291.76 A 90 450 6.47 4.19 341.92 302.43 G 90 450 6.47 4.19 341.92 302.43 A 90 450 6.47 4.19 341.92 281.31 G 90 450 6.47 4.19 341.92 281.31 A 90 450 6.47 4.19 341.92 271.18 G 90 450 6.47 4.19 341.92 271.18 A 90 450 6.47 4.19 342.47 261.27 G 90 450 6.47 4.19 342.47 261.27 A 342.09 354.32 342.09 255.99 2 L V N 90 450 6.47 4.19 235.95 347.84 G 90 450 6.47 4.19 235.95 347.84 A 90 450 6.47 4.19 235.95 337.93 G 90 450 6.47 4.19 235.95 337.93 A 90 450 6.47 4.19 235.95 292.3 G 90 450 6.47 4.19 235.95 292.3 A 90 450 6.47 4.19 235.95 302.98 G 90 450 6.47 4.19 235.95 302.98 A 90 450 6.47 4.19 235.95 281.85 G 90 450 6.47 4.19 235.95 281.85 A 90 450 6.47 4.19 235.95 271.72 G 90 450 6.47 4.19 235.95 271.72 A 90 450 6.47 4.19 236.49 261.82 G 90 450 6.47 4.19 236.49 261.82 A 236.11 354.86 236.11 256.53 2 L V N 90 450 6.47 4.19 250.73 347.73 G 90 450 6.47 4.19 250.73 347.73 A 90 450 6.47 4.19 250.73 337.82 G 90 450 6.47 4.19 250.73 337.82 A 90 450 6.47 4.19 250.73 292.2 G 90 450 6.47 4.19 250.73 292.2 A 90 450 6.47 4.19 250.73 302.87 G 90 450 6.47 4.19 250.73 302.87 A 90 450 6.47 4.19 250.73 281.74 G 90 450 6.47 4.19 250.73 281.74 A 90 450 6.47 4.19 250.73 271.62 G 90 450 6.47 4.19 250.73 271.62 A 90 450 6.47 4.19 251.27 261.71 G 90 450 6.47 4.19 251.27 261.71 A 250.89 354.75 250.89 256.42 2 L V N 90 450 6.47 4.19 265.29 347.84 G 90 450 6.47 4.19 265.29 347.84 A 90 450 6.47 4.19 265.29 337.93 G 90 450 6.47 4.19 265.29 337.93 A 90 450 6.47 4.19 265.29 292.31 G 90 450 6.47 4.19 265.29 292.31 A 90 450 6.47 4.19 265.29 302.98 G 90 450 6.47 4.19 265.29 302.98 A 90 450 6.47 4.19 265.29 281.85 G 90 450 6.47 4.19 265.29 281.85 A 90 450 6.47 4.19 265.29 271.72 G 90 450 6.47 4.19 265.29 271.72 A 90 450 6.47 4.19 265.84 261.82 G 90 450 6.47 4.19 265.84 261.82 A 265.46 354.86 265.46 256.53 2 L V N 90 450 6.47 4.19 280.62 347.73 G 90 450 6.47 4.19 280.62 347.73 A 90 450 6.47 4.19 280.62 337.82 G 90 450 6.47 4.19 280.62 337.82 A 90 450 6.47 4.19 280.62 292.2 G 90 450 6.47 4.19 280.62 292.2 A 90 450 6.47 4.19 280.62 302.87 G 90 450 6.47 4.19 280.62 302.87 A 90 450 6.47 4.19 280.62 281.74 G 90 450 6.47 4.19 280.62 281.74 A 90 450 6.47 4.19 280.62 271.62 G 90 450 6.47 4.19 280.62 271.62 A 90 450 6.47 4.19 281.16 261.71 G 90 450 6.47 4.19 281.16 261.71 A 280.78 354.75 280.78 256.43 2 L V N 218.55 318.98 404.97 325.17 R 3 X V 2 10 Q 0 X (upper) 451.62 337.14 T (-deck) 474.18 337.14 T (lower) 451.38 284.39 T (-deck) 473.93 284.39 T (frame) 341.94 388.04 T (rail) 153.75 326.04 T (bead) 148.5 279.02 T 434.01 350.29 422.47 353.6 434.01 356.91 434.01 353.6 4 Y V 433.41 321.04 421.88 324.35 433.41 327.66 433.41 324.35 4 Y V 434.01 353.6 434.35 353.6 445.63 353.6 445.63 324.35 433.41 324.35 5 L 0 Z N 433.29 312.29 421.75 315.6 433.29 318.91 433.29 315.6 4 Y V 432.66 251.66 421.13 254.97 432.66 258.28 432.66 254.97 4 Y V 433.29 315.6 434.25 315.6 446.13 315.6 446.13 254.97 432.66 254.97 5 L N 217.66 313.51 228.75 318.1 221.78 308.33 219.72 310.92 4 Y V 171.25 303.1 209.76 303.1 219.72 310.92 3 L 2 Z N (beam) 146.25 302.47 T 204.72 284.41 216.25 281.1 204.72 277.79 204.72 281.1 4 Y V 171.25 281.1 204.72 281.1 2 L N 281.05 361.84 269.12 360.73 278.65 367.99 279.85 364.92 4 Y V 339.13 390.1 M 306 383.85 306 383.85 316.63 383.54 D 326.55 383.24 327.21 383.23 279.88 364.89 D 0 Z N 210.34 332.03 221.88 328.72 210.34 325.42 210.34 328.72 4 Y V 170 328.72 210.34 328.72 2 L 2 Z N 72 87.98 558 432 C 0 0 612 792 C FMENDPAGE %%EndPage: "6" 7 %%Page: "7" 7 612 792 0 FMBEGINPAGE 54 750.02 540 750.02 2 L 7 X 0 K V 2 H 0 Z 0 X N 54 730.01 540 745.2 R 7 X V 1 9 Q 0 X (Addition) 189 739.2 T 54 726.98 540 726.98 2 L 7 X V 0.25 H 0 X N 54 74.02 540 74.02 2 L 7 X V 2 Z 0 X N 54 55.01 540 66.96 R 7 X V 1 10 Q 0 X (7) 54 60.96 T 1 9 Q ( of) 59.56 60.96 T 1 10 Q ( 12) 70.54 60.96 T 1 9 Q (The Abacus) 189 60.96 T 498.25 742.67 502.85 742.67 2 L 1 H N 500.55 742.55 500.55 735.65 2 L N 498.25 735.78 502.85 735.78 2 L N 498.25 739.48 502.85 739.48 2 L N 509.74 746.12 509.74 731.18 2 L N 506.8 742.16 512.68 742.16 2 L N 505.53 738.21 513.7 738.21 2 L N 507.44 735.78 505.14 732.33 2 L N 511.65 735.4 513.19 732.33 2 L N 505.35 743.7 M 505.67 742.81 505.67 742.81 505.75 742.49 D 505.83 742.17 505.83 742.17 505.87 741.85 D 505.91 741.53 505.91 741.53 505.35 740.49 D N 522.12 733.79 528.11 741.74 R N 517.84 731.84 533 731.84 2 L N 522.12 737.1 528.11 737.1 2 L N 522.12 739.3 528.11 739.3 2 L N 521.51 746.88 521.99 746.02 522.12 744.8 521.51 742.6 4 L N 522.61 746.14 523.95 746.27 2 L N 522.48 744.07 523.83 742.72 2 L N 526.64 747 527.13 746.14 527.25 744.92 526.64 742.72 4 L N 527.74 746.27 529.09 746.39 2 L N 527.62 744.19 528.96 742.84 2 L N 522.85 732.69 523.83 731.72 524.07 730.74 523.71 729.88 522.85 729.03 5 L N 527.74 732.69 527.98 730.86 527.5 729.39 3 L N 517.15 710.58 532 710.58 2 L N 519.31 710.58 518.59 713.6 529.12 713.6 528.11 710.58 4 L N 522.63 713.6 522.49 710.72 2 L N 525.37 713.32 525.22 710.58 2 L N 516.72 720.23 523.64 720.67 2 L N 520.03 722.83 521.62 721.1 2 L N 521.04 719.66 522.05 717.93 2 L N 518.16 715.77 518.88 716.78 519.17 718.79 518.88 723.69 522.34 724.56 522.2 715.91 6 L N 519.03 724.27 520.18 726 2 L N 525.22 719.95 526.38 720.81 526.23 723.69 527.53 723.98 528.97 723.84 529.12 721.39 528.97 720.23 530.27 719.8 531.13 720.67 9 L N 524.65 714.9 526.81 715.77 528.83 717.35 529.4 718.79 525.22 718.79 527.1 716.34 528.4 715.19 531.13 715.19 8 L N 504.26 712.64 509.61 719.74 R N 500.44 710.89 513.98 710.89 2 L N 504.26 715.59 509.61 715.59 2 L N 504.26 717.55 509.61 717.55 2 L N 503.71 724.32 504.15 723.56 504.26 722.47 503.71 720.5 4 L N 504.7 723.67 505.9 723.78 2 L N 504.59 721.81 505.79 720.61 2 L N 508.3 724.43 508.74 723.67 508.85 722.58 508.3 720.61 4 L N 509.28 723.78 510.48 723.89 2 L N 509.17 721.92 510.37 720.72 2 L N 504.91 711.66 505.79 710.78 506.01 709.91 505.68 709.15 504.91 708.38 5 L N 509.28 711.66 509.5 710.02 509.06 708.71 3 L N 54 87.5 540 686.02 R 7 X V 54 672.98 540 686.02 C 189 680.04 540 680.04 2 L 0.25 H 2 Z 0 X 0 K N 54 680.04 180 680.04 2 L 0 Z N 0 0 612 792 C 1 9 Q 0 X 0 K (FIGURE 2) 54 666.98 T 0 F (Numeric Representation of Number 87,654,321 on the Abacus) 189 666.98 T 54 503.97 540 512.99 C 189 511.48 540 511.48 2 L 0.25 H 2 Z 0 X 0 K N 54 511.48 180 511.48 2 L 0 Z N 0 0 612 792 C 1 12 Q 0 X 0 K (2.0) 163.33 516.99 T (Addition) 189 516.99 T 2 10 Q -0.22 (Addition on the abacus involves registering the numbers on the beads in the straight-for-) 189 483.3 P (ward left-to-right sequence they are written down in. As long as the digits are placed) 189 471.3 T (correctly) 189 459.3 T (, and the carry\325) 223.87 459.3 T (s noted properly) 283.82 459.3 T (, the answer to the operation immediately pre-) 348.12 459.3 T (sents itself right on the abacus. There are 4 approaches to performing additions \050or sub-) 189 447.3 T -0.1 (tractions\051, each applied to particular situations. Each of these techniques is explained in) 189 435.3 P (tabular form in the sections that follow) 189 423.3 T 2 8 Q (1) 344.45 427.3 T 2 10 Q (.) 348.45 423.3 T 1 F (2.1) 166.11 393.3 T (Simple Addition) 189 393.3 T 2 F (When performing the addition 6+2, one would move 1 bead from the upper deck down) 189 369.3 T (\050value = 5\051 and one bead from the lower deck up \050value = 1\051; this represents 6. Moving) 189 357.3 T (2 beads from the lower deck \050in the same column\051 up \050value = 1 * 2 beads = 2\051 would) 189 345.3 T -0.17 (complete the operation. The answer is then obtained by reading resultant bead positions.) 189 333.3 P 54 302.94 540 315.97 C 189 309.99 540 309.99 2 L 0.25 H 2 Z 0 X 0 K N 54 309.99 180 309.99 2 L 0 Z N 0 0 612 792 C 54 279.97 540 293.94 C 189 285.94 540 285.94 2 L 0.25 H 2 Z 0 X 0 K N 0 0 612 792 C 1 9 Q 0 X 0 K (T) 54 296.94 T (ABLE 1) 58.83 296.94 T 0 F (Simple Addition) 189 296.94 T 0 8 Q (Original Number) 202.8 274.64 T (Formula) 312.68 274.64 T (Bead-Operations Involved) 396 274.64 T (lower-deck) 411.35 264.64 T ( upper-deck) 488.78 264.64 T (0,1,2,3,4,5,6,7,8) 198 254.64 T (plus 1) 313.33 254.64 T (+1) 427.44 254.64 T (0,1,2,5,6 or 7) 198 244.64 T (plus 2) 313.33 244.64 T (+2) 427.44 244.64 T (0,1,5 or 6) 198 234.64 T (plus 3) 313.33 234.64 T (+3) 427.44 234.64 T (0 or 3) 198 224.64 T (plus 4) 313.33 224.64 T (+4) 427.44 224.64 T (0,1,2,3 or 4) 198 214.64 T (plus 5) 313.33 214.64 T (+1) 508.44 214.64 T (0,1,2, or 3) 198 204.64 T (plus 6) 313.33 204.64 T (+1) 427.44 204.64 T (+1) 508.44 204.64 T (0,1 or 2) 198 194.64 T (plus 7) 313.33 194.64 T (+2) 427.44 194.64 T (+1) 508.44 194.64 T (0 or 1) 198 184.64 T (plus 8) 313.33 184.64 T (+3) 427.44 184.64 T (+1) 508.44 184.64 T (0) 198 174.64 T (plus 9) 313.33 174.64 T (+4) 427.44 174.64 T (+1) 508.44 174.64 T 54 153.5 540 169.56 C 189 161.49 333 161.49 2 L 0.25 H 2 Z 0 X 0 K N 0 0 612 792 C 2 8 Q 0 X 0 K -0.28 (1. The tables are used as follows: given) 189 148.17 P 3 F -0.28 (Original Number) 316.57 148.17 P 2 F -0.28 (, to add/subtract) 371.6 148.17 P 3 F -0.28 (Formula) 424.04 148.17 P 2 F -0.28 (, perform) 452.03 148.17 P 3 F -0.28 (Bead-Operations) 483.21 148.17 P (Involved) 189 139.17 T 2 F (.) 216.53 139.17 T -0.03 ( For example, to add 2 and 7, move down) 189 130.17 P 3 F -0.03 (Original Number) 323.76 130.17 P 2 F -0.03 ( column to a row containing 2 and down) 379.03 130.17 P 3 F -0.03 (Formula) 510.04 130.17 P 2 F -0.13 (to a row containing 7 \050the 7th row\051 then move across to read the) 189 121.17 P 3 F -0.13 (Operation Involved) 394.13 121.17 P 2 F -0.13 (: move 2 bead counters in) 456.4 121.17 P (the lower-deck and 1 bead counter in the upper-deck to represent the sum; the answer then presents itself on) 189 112.17 T (the abacus. The \322+\323 symbol, in the) 189 103.17 T 3 F (Operations Involved) 302.1 103.17 T 2 F ( column represents moving the bead in question,) 367.61 103.17 T 3 F (towards) 189 94.17 T 2 F ( the rail; the \322-\323 symbol represents moving the bead in question) 214.77 94.17 T 3 F (away) 419.52 94.17 T 2 F ( from the rail.) 436.4 94.17 T 54 87.5 540 686.02 C 273 547.99 540 663.98 C 273 547.99 540 663.98 R 7 X 0 K V 4 14 Q 0 X (8 7 6 5 4 3 2 1) 297 552.98 T 278.88 565.88 424.88 654.88 R 3 X V 0.5 H 2 Z 0 X N 281.52 627.49 422.23 650.87 R 7 X V 0 X N 282.05 571.24 421.7 621.89 R 7 X V 0 X N 90 450 4.5 3.42 288.51 645.58 G 90 450 4.5 3.42 288.51 645.58 A 90 450 4.5 3.42 288.51 637.49 G 90 450 4.5 3.42 288.51 637.49 A 90 450 4.5 3.42 288.51 600.24 G 90 450 4.5 3.42 288.51 600.24 A 90 450 4.5 3.42 288.51 608.95 G 90 450 4.5 3.42 288.51 608.95 A 90 450 4.5 3.42 288.51 591.7 G 90 450 4.5 3.42 288.51 591.7 A 90 450 4.5 3.42 288.51 583.44 G 90 450 4.5 3.42 288.51 583.44 A 90 450 4.5 3.42 288.89 575.34 G 90 450 4.5 3.42 288.89 575.34 A 288.62 651.32 288.62 571.03 2 L V N 90 450 4.5 3.42 384.56 645.5 G 90 450 4.5 3.42 384.56 645.5 A 90 450 4.5 3.42 384.56 637.41 G 90 450 4.5 3.42 384.56 637.41 A 90 450 4.5 3.42 384.56 600.15 G 90 450 4.5 3.42 384.56 600.15 A 90 450 4.5 3.42 384.56 608.86 G 90 450 4.5 3.42 384.56 608.86 A 90 450 4.5 3.42 384.56 591.62 G 90 450 4.5 3.42 384.56 591.62 A 90 450 4.5 3.42 384.56 583.35 G 90 450 4.5 3.42 384.56 583.35 A 90 450 4.5 3.42 384.94 575.26 G 90 450 4.5 3.42 384.94 575.26 A 384.67 651.23 384.67 570.94 2 L V N 90 450 4.5 3.42 394.84 645.41 G 90 450 4.5 3.42 394.84 645.41 A 90 450 4.5 3.42 394.84 637.32 G 90 450 4.5 3.42 394.84 637.32 A 90 450 4.5 3.42 394.84 600.06 G 90 450 4.5 3.42 394.84 600.06 A 90 450 4.5 3.42 394.84 608.78 G 90 450 4.5 3.42 394.84 608.78 A 90 450 4.5 3.42 394.84 591.53 G 90 450 4.5 3.42 394.84 591.53 A 90 450 4.5 3.42 394.84 583.26 G 90 450 4.5 3.42 394.84 583.26 A 90 450 4.5 3.42 395.21 575.17 G 90 450 4.5 3.42 395.21 575.17 A 394.95 651.14 394.95 570.85 2 L V N 90 450 4.5 3.42 404.96 645.5 G 90 450 4.5 3.42 404.96 645.5 A 90 450 4.5 3.42 404.96 637.41 G 90 450 4.5 3.42 404.96 637.41 A 90 450 4.5 3.42 404.96 600.15 G 90 450 4.5 3.42 404.96 600.15 A 90 450 4.5 3.42 404.96 608.86 G 90 450 4.5 3.42 404.96 608.86 A 90 450 4.5 3.42 404.96 591.62 G 90 450 4.5 3.42 404.96 591.62 A 90 450 4.5 3.42 404.96 583.35 G 90 450 4.5 3.42 404.96 583.35 A 90 450 4.5 3.42 405.34 575.26 G 90 450 4.5 3.42 405.34 575.26 A 405.08 651.23 405.08 570.94 2 L V N 90 450 4.5 3.42 415.62 645.41 G 90 450 4.5 3.42 415.62 645.41 A 90 450 4.5 3.42 415.62 637.32 G 90 450 4.5 3.42 415.62 637.32 A 90 450 4.5 3.42 415.62 600.06 G 90 450 4.5 3.42 415.62 600.06 A 90 450 4.5 3.42 415.62 608.78 G 90 450 4.5 3.42 415.62 608.78 A 90 450 4.5 3.42 415.62 591.53 G 90 450 4.5 3.42 415.62 591.53 A 90 450 4.5 3.42 415.62 583.26 G 90 450 4.5 3.42 415.62 583.26 A 90 450 4.5 3.42 415.99 575.17 G 90 450 4.5 3.42 415.99 575.17 A 415.73 651.14 415.73 570.85 2 L V N 90 450 4.5 3.42 373.37 645.32 G 90 450 4.5 3.42 373.37 645.32 A 90 450 4.5 3.42 373.37 637.23 G 90 450 4.5 3.42 373.37 637.23 A 373.49 651.05 373.49 570.77 2 L V N 299.81 651.5 299.81 571.21 2 L V N 310.08 649.5 310.08 571.12 2 L V N 320.21 651.5 320.21 571.21 2 L V N 90 450 4.5 3.42 330.75 645.67 G 90 450 4.5 3.42 330.75 645.67 A 90 450 4.5 3.42 330.75 631.58 G 90 450 4.5 3.42 330.75 631.58 A 90 450 4.5 3.42 330.75 600.33 G 90 450 4.5 3.42 330.75 600.33 A 90 450 4.5 3.42 330.75 609.04 G 90 450 4.5 3.42 330.75 609.04 A 90 450 4.5 3.42 330.75 591.79 G 90 450 4.5 3.42 330.75 591.79 A 90 450 4.5 3.42 330.75 583.53 G 90 450 4.5 3.42 330.75 583.53 A 90 450 4.5 3.42 331.13 575.43 G 90 450 4.5 3.42 331.13 575.43 A 330.87 651.41 330.87 571.12 2 L V N 287.6 622.2 417.21 627.26 R 3 X V 0 X 90 450 4.5 3.42 373.37 600.47 G 90 450 4.5 3.42 373.37 600.47 A 90 450 4.5 3.42 373.37 617.69 G 90 450 4.5 3.42 373.37 617.69 A 90 450 4.5 3.42 373.37 591.94 G 90 450 4.5 3.42 373.37 591.94 A 90 450 4.5 3.42 373.37 583.67 G 90 450 4.5 3.42 373.37 583.67 A 90 450 4.5 3.42 373.75 575.58 G 90 450 4.5 3.42 373.75 575.58 A 90 450 4.5 3.42 363.1 575.17 G 90 450 4.5 3.42 363.1 575.17 A 90 450 4.5 3.42 342.32 645.41 G 90 450 4.5 3.42 342.32 645.41 A 90 450 4.5 3.42 342.32 637.32 G 90 450 4.5 3.42 342.32 637.32 A 90 450 4.5 3.42 341.82 609.06 G 90 450 4.5 3.42 341.82 609.06 A 90 450 4.5 3.42 341.82 617.78 G 90 450 4.5 3.42 341.82 617.78 A 90 450 4.5 3.42 341.82 600.53 G 90 450 4.5 3.42 341.82 600.53 A 90 450 4.5 3.42 341.82 592.26 G 90 450 4.5 3.42 341.82 592.26 A 90 450 4.5 3.42 342.69 575.17 G 90 450 4.5 3.42 342.69 575.17 A 342.43 651.14 342.43 570.85 2 L V N 90 450 4.5 3.42 352.59 645.32 G 90 450 4.5 3.42 352.59 645.32 A 90 450 4.5 3.42 352.59 637.23 G 90 450 4.5 3.42 352.59 637.23 A 90 450 4.5 3.42 352.59 608.97 G 90 450 4.5 3.42 352.59 608.97 A 90 450 4.5 3.42 352.59 617.69 G 90 450 4.5 3.42 352.59 617.69 A 90 450 4.5 3.42 352.59 600.44 G 90 450 4.5 3.42 352.59 600.44 A 90 450 4.5 3.42 352.59 583.17 G 90 450 4.5 3.42 352.59 583.17 A 90 450 4.5 3.42 352.97 575.08 G 90 450 4.5 3.42 352.97 575.08 A 352.71 651.05 352.71 570.77 2 L V N 90 450 4.5 3.42 362.72 645.41 G 90 450 4.5 3.42 362.72 645.41 A 90 450 4.5 3.42 362.72 637.32 G 90 450 4.5 3.42 362.72 637.32 A 90 450 4.5 3.42 363.22 609.06 G 90 450 4.5 3.42 363.22 609.06 A 90 450 4.5 3.42 363.22 617.78 G 90 450 4.5 3.42 363.22 617.78 A 90 450 4.5 3.42 362.72 591.53 G 90 450 4.5 3.42 362.72 591.53 A 90 450 4.5 3.42 362.72 583.26 G 90 450 4.5 3.42 362.72 583.26 A 362.83 651.14 362.83 570.85 2 L V N 90 450 4.5 3.42 319.75 645.67 G 90 450 4.5 3.42 319.75 645.67 A 90 450 4.5 3.42 319.75 631.58 G 90 450 4.5 3.42 319.75 631.58 A 90 450 4.5 3.42 309.75 645.67 G 90 450 4.5 3.42 309.75 645.67 A 90 450 4.5 3.42 309.75 631.58 G 90 450 4.5 3.42 309.75 631.58 A 90 450 4.5 3.42 299.75 645.67 G 90 450 4.5 3.42 299.75 645.67 A 90 450 4.5 3.42 299.75 631.58 G 90 450 4.5 3.42 299.75 631.58 A 90 450 4.5 3.42 310.6 575.17 G 90 450 4.5 3.42 310.6 575.17 A 90 450 4.5 3.42 300.09 608.97 G 90 450 4.5 3.42 300.09 608.97 A 90 450 4.5 3.42 300.09 617.69 G 90 450 4.5 3.42 300.09 617.69 A 90 450 4.5 3.42 300.09 600.44 G 90 450 4.5 3.42 300.09 600.44 A 90 450 4.5 3.42 300.09 583.17 G 90 450 4.5 3.42 300.09 583.17 A 90 450 4.5 3.42 300.47 575.08 G 90 450 4.5 3.42 300.47 575.08 A 90 450 4.5 3.42 310.72 609.06 G 90 450 4.5 3.42 310.72 609.06 A 90 450 4.5 3.42 310.72 617.78 G 90 450 4.5 3.42 310.72 617.78 A 90 450 4.5 3.42 310.22 591.53 G 90 450 4.5 3.42 310.22 591.53 A 90 450 4.5 3.42 310.22 583.26 G 90 450 4.5 3.42 310.22 583.26 A 90 450 4.5 3.42 320.37 599.97 G 90 450 4.5 3.42 320.37 599.97 A 90 450 4.5 3.42 320.37 617.19 G 90 450 4.5 3.42 320.37 617.19 A 90 450 4.5 3.42 320.37 591.44 G 90 450 4.5 3.42 320.37 591.44 A 90 450 4.5 3.42 320.37 583.17 G 90 450 4.5 3.42 320.37 583.17 A 90 450 4.5 3.42 320.75 575.08 G 90 450 4.5 3.42 320.75 575.08 A 2 10 Q (1) 442.57 614.47 T 380.84 616.85 441.27 616.85 2 L 4 X N 335.98 586.86 346.84 622 R 3 X N 370.27 609.57 451.99 609.57 2 L 4 X N 337.41 629.57 434.13 629.57 2 L N 0 X (5) 436.29 627.18 T (2) 454.29 607.76 T 357.56 603.14 369.13 621.14 R 3 X N 347.55 595.14 462.7 595.14 2 L 4 X N 0 X (4) 467.29 593.33 T 54 87.5 540 686.02 C 0 0 612 792 C FMENDPAGE %%EndPage: "7" 8 %%Page: "8" 8 612 792 0 FMBEGINPAGE 72 750.02 558 750.02 2 L 7 X 0 K V 2 H 0 Z 0 X N 72 730.01 558 745.2 R 7 X V 1 9 Q 0 X (Addition) 207 739.2 T 72 726.98 558 726.98 2 L 7 X V 0.25 H 0 X N 72 74.02 558 74.02 2 L 7 X V 2 Z 0 X N 72 55.01 558 66.96 R 7 X V 0 X (The Abacus) 207 60.96 T 1 10 Q (8) 527.85 60.96 T 1 9 Q ( of) 533.41 60.96 T 1 10 Q (12) 546.89 60.96 T 498.25 742.67 502.85 742.67 2 L 1 H N 500.55 742.55 500.55 735.65 2 L N 498.25 735.78 502.85 735.78 2 L N 498.25 739.48 502.85 739.48 2 L N 509.74 746.12 509.74 731.18 2 L N 506.8 742.16 512.68 742.16 2 L N 505.53 738.21 513.7 738.21 2 L N 507.44 735.78 505.14 732.33 2 L N 511.65 735.4 513.19 732.33 2 L N 505.35 743.7 M 505.67 742.81 505.67 742.81 505.75 742.49 D 505.83 742.17 505.83 742.17 505.87 741.85 D 505.91 741.53 505.91 741.53 505.35 740.49 D N 522.12 733.79 528.11 741.74 R N 517.84 731.84 533 731.84 2 L N 522.12 737.1 528.11 737.1 2 L N 522.12 739.3 528.11 739.3 2 L N 521.51 746.88 521.99 746.02 522.12 744.8 521.51 742.6 4 L N 522.61 746.14 523.95 746.27 2 L N 522.48 744.07 523.83 742.72 2 L N 526.64 747 527.13 746.14 527.25 744.92 526.64 742.72 4 L N 527.74 746.27 529.09 746.39 2 L N 527.62 744.19 528.96 742.84 2 L N 522.85 732.69 523.83 731.72 524.07 730.74 523.71 729.88 522.85 729.03 5 L N 527.74 732.69 527.98 730.86 527.5 729.39 3 L N 517.15 710.58 532 710.58 2 L N 519.31 710.58 518.59 713.6 529.12 713.6 528.11 710.58 4 L N 522.63 713.6 522.49 710.72 2 L N 525.37 713.32 525.22 710.58 2 L N 516.72 720.23 523.64 720.67 2 L N 520.03 722.83 521.62 721.1 2 L N 521.04 719.66 522.05 717.93 2 L N 518.16 715.77 518.88 716.78 519.17 718.79 518.88 723.69 522.34 724.56 522.2 715.91 6 L N 519.03 724.27 520.18 726 2 L N 525.22 719.95 526.38 720.81 526.23 723.69 527.53 723.98 528.97 723.84 529.12 721.39 528.97 720.23 530.27 719.8 531.13 720.67 9 L N 524.65 714.9 526.81 715.77 528.83 717.35 529.4 718.79 525.22 718.79 527.1 716.34 528.4 715.19 531.13 715.19 8 L N 504.26 712.64 509.61 719.74 R N 500.44 710.89 513.98 710.89 2 L N 504.26 715.59 509.61 715.59 2 L N 504.26 717.55 509.61 717.55 2 L N 503.71 724.32 504.15 723.56 504.26 722.47 503.71 720.5 4 L N 504.7 723.67 505.9 723.78 2 L N 504.59 721.81 505.79 720.61 2 L N 508.3 724.43 508.74 723.67 508.85 722.58 508.3 720.61 4 L N 509.28 723.78 510.48 723.89 2 L N 509.17 721.92 510.37 720.72 2 L N 504.91 711.66 505.79 710.78 506.01 709.91 505.68 709.15 504.91 708.38 5 L N 509.28 711.66 509.5 710.02 509.06 708.71 3 L N 72 228.98 558 686.02 R 7 X V 0 X (2.2) 184.11 679.35 T (Combined Adding-up And T) 207 679.35 T (aking Off) 338.96 679.35 T 2 F -0.11 (When the original number registered on a rod is smaller than 5, but will become greater) 207 655.35 P -0.14 (than 5 after the addition, one bead from the upper) 207 643.35 P -0.14 (-deck is moved down \050added on to the) 403.7 643.35 P (beam\051 and one or more beads from the lower deck removed from the beam.) 207 631.35 T 72 600.98 558 614.02 C 207 608.04 558 608.04 2 L 0.25 H 2 Z 0 X 0 K N 72 608.04 198 608.04 2 L 0 Z N 0 0 612 792 C 72 578.02 558 591.98 C 207 583.99 558 583.99 2 L 0.25 H 2 Z 0 X 0 K N 0 0 612 792 C 1 9 Q 0 X 0 K (T) 72 594.98 T (ABLE 2) 76.83 594.98 T 0 F (Combined Adding-up And T) 207 594.98 T (aking Of) 316.9 594.98 T (f) 350.21 594.98 T 0 8 Q (Original Number) 220.8 572.68 T (Formula) 330.68 572.68 T (Bead-Operations Involved) 414 572.68 T (lower-deck) 429.35 562.68 T ( upper-deck) 506.78 562.68 T (4) 207 552.68 T (plus 5 \050+5 - 4\051) 317.23 552.68 T (- 4) 445.33 552.68 T (+1) 526.44 552.68 T (4 or 3) 207 542.68 T (plus 6 \050+5 - 3\051) 317.23 542.68 T (- 3) 445.33 542.68 T (+1) 526.44 542.68 T (4,3, or 2) 207 532.68 T (plus 7 \050+5 - 2\051) 317.23 532.68 T (- 2) 445.33 532.68 T (+1) 526.44 532.68 T (4,3,2 or 1) 207 522.68 T (plus 8 \050+5 -1\051) 318.34 522.68 T (- 1) 445.33 522.68 T (+1) 526.44 522.68 T 1 10 Q (2.3) 184.11 493.35 T (Combined T) 207 493.35 T (aking-off And Place Advancement) 264.01 493.35 T 2 F (When a sum greater than 10 occurs on a certain rod, beads are removed from either or) 207 469.35 T -0.1 (both the upper and lower decks and 1 bead is added to the rod directly to the left. Exam-) 207 457.35 P (ple: When adding 9 \05010-1\051 to 8, one bead from the lower deck is removed \050-1\051 and one) 207 445.35 T (bead from the lower deck on the row directly to the left is added \050+10\051.) 207 433.35 T 72 402.98 558 416.02 C 207 410.04 558 410.04 2 L 0.25 H 2 Z 0 X 0 K N 72 410.04 198 410.04 2 L 0 Z N 0 0 612 792 C 72 380.02 558 393.98 C 207 385.99 558 385.99 2 L 0.25 H 2 Z 0 X 0 K N 0 0 612 792 C 1 9 Q 0 X 0 K (T) 72 396.98 T (ABLE 3) 76.83 396.98 T 0 F (Combined Adding-up And Place Advancement) 207 396.98 T 0 8 Q (Original Number) 220.8 374.68 T (Formula) 301.39 374.68 T (Bead-Operations Involved) 386.86 374.68 T (lower-deck) 361.65 364.68 T ( upper-deck) 409.21 364.68 T (lower-deck, previous rod) 460.77 364.68 T (9) 216 354.68 T (plus 1 \050-9 +10\051) 289.11 354.68 T (- 4) 373.33 354.68 T (-1) 428.45 354.68 T (+1) 481.44 354.68 T (8 or 9) 216 344.68 T (plus 2 \050-8 +10\051) 289.11 344.68 T (- 3) 373.33 344.68 T (- 1) 427.33 344.68 T (+1) 481.44 344.68 T (7,8 or 6) 216 334.68 T (plus 3 \050-7 +10\051) 289.11 334.68 T (- 2) 373.33 334.68 T (- 1) 427.33 334.68 T (+1) 481.44 334.68 T (6,7,8 or 9) 216 324.68 T (plus 4 \050-6 +10\051) 289.11 324.68 T (- 1) 373.33 324.68 T (- 1) 427.33 324.68 T (+1) 481.44 324.68 T (5,6,7,8 or 9) 216 314.68 T (plus 5 \050-5 +10\051) 289.11 314.68 T (- 1) 427.33 314.68 T (+1) 481.44 314.68 T (4or 9) 216 304.68 T (plus 6 \050-4 +10\051) 289.11 304.68 T (- 4) 373.33 304.68 T (+1) 481.44 304.68 T (3,4,8 or 9) 216 294.68 T (plus 7 \050-3 +10\051) 289.11 294.68 T (- 3) 373.33 294.68 T (+1) 481.44 294.68 T (2,3,4,7,8 or 9) 216 284.68 T (plus 8 \050-2 +10\051) 289.11 284.68 T (- 2) 373.33 284.68 T (+1) 481.44 284.68 T (1,2,3,4,6,7,8,9) 216 274.68 T (plus 9 \050-1 +10\051) 289.11 274.68 T (- 1) 373.33 274.68 T (+1) 481.44 274.68 T FMENDPAGE %%EndPage: "8" 9 %%Page: "9" 9 612 792 0 FMBEGINPAGE 54 750.02 540 750.02 2 L 7 X 0 K V 2 H 0 Z 0 X N 54 730.01 540 745.2 R 7 X V 1 9 Q 0 X (Subtraction) 189 739.2 T 54 726.98 540 726.98 2 L 7 X V 0.25 H 0 X N 54 74.02 540 74.02 2 L 7 X V 2 Z 0 X N 54 55.01 540 66.96 R 7 X V 1 10 Q 0 X (9) 54 60.96 T 1 9 Q ( of) 59.56 60.96 T 1 10 Q ( 12) 70.54 60.96 T 1 9 Q (The Abacus) 189 60.96 T 498.25 742.67 502.85 742.67 2 L 1 H N 500.55 742.55 500.55 735.65 2 L N 498.25 735.78 502.85 735.78 2 L N 498.25 739.48 502.85 739.48 2 L N 509.74 746.12 509.74 731.18 2 L N 506.8 742.16 512.68 742.16 2 L N 505.53 738.21 513.7 738.21 2 L N 507.44 735.78 505.14 732.33 2 L N 511.65 735.4 513.19 732.33 2 L N 505.35 743.7 M 505.67 742.81 505.67 742.81 505.75 742.49 D 505.83 742.17 505.83 742.17 505.87 741.85 D 505.91 741.53 505.91 741.53 505.35 740.49 D N 522.12 733.79 528.11 741.74 R N 517.84 731.84 533 731.84 2 L N 522.12 737.1 528.11 737.1 2 L N 522.12 739.3 528.11 739.3 2 L N 521.51 746.88 521.99 746.02 522.12 744.8 521.51 742.6 4 L N 522.61 746.14 523.95 746.27 2 L N 522.48 744.07 523.83 742.72 2 L N 526.64 747 527.13 746.14 527.25 744.92 526.64 742.72 4 L N 527.74 746.27 529.09 746.39 2 L N 527.62 744.19 528.96 742.84 2 L N 522.85 732.69 523.83 731.72 524.07 730.74 523.71 729.88 522.85 729.03 5 L N 527.74 732.69 527.98 730.86 527.5 729.39 3 L N 517.15 710.58 532 710.58 2 L N 519.31 710.58 518.59 713.6 529.12 713.6 528.11 710.58 4 L N 522.63 713.6 522.49 710.72 2 L N 525.37 713.32 525.22 710.58 2 L N 516.72 720.23 523.64 720.67 2 L N 520.03 722.83 521.62 721.1 2 L N 521.04 719.66 522.05 717.93 2 L N 518.16 715.77 518.88 716.78 519.17 718.79 518.88 723.69 522.34 724.56 522.2 715.91 6 L N 519.03 724.27 520.18 726 2 L N 525.22 719.95 526.38 720.81 526.23 723.69 527.53 723.98 528.97 723.84 529.12 721.39 528.97 720.23 530.27 719.8 531.13 720.67 9 L N 524.65 714.9 526.81 715.77 528.83 717.35 529.4 718.79 525.22 718.79 527.1 716.34 528.4 715.19 531.13 715.19 8 L N 504.26 712.64 509.61 719.74 R N 500.44 710.89 513.98 710.89 2 L N 504.26 715.59 509.61 715.59 2 L N 504.26 717.55 509.61 717.55 2 L N 503.71 724.32 504.15 723.56 504.26 722.47 503.71 720.5 4 L N 504.7 723.67 505.9 723.78 2 L N 504.59 721.81 505.79 720.61 2 L N 508.3 724.43 508.74 723.67 508.85 722.58 508.3 720.61 4 L N 509.28 723.78 510.48 723.89 2 L N 509.17 721.92 510.37 720.72 2 L N 504.91 711.66 505.79 710.78 506.01 709.91 505.68 709.15 504.91 708.38 5 L N 509.28 711.66 509.5 710.02 509.06 708.71 3 L N 54 90.98 540 686.02 R 7 X V 1 10 Q 0 X (2.4) 166.11 679.35 T (Combined Adding-up, T) 189 679.35 T (aking-off And Place Advancement) 301.53 679.35 T 2 F (There are 4 cases when beads are added to the lower) 189 655.35 T (-deck, removed from the upper) 398.61 655.35 T (-) 522.47 655.35 T (deck and one bead added to the adjacent rod.) 189 643.35 T -0.27 (Example: When adding 7 to 6 \050+1-5+10\051, one bead is added to the lower) 189 619.35 P -0.27 (-deck, one bead) 475.3 619.35 P (removed from the upper) 189 607.35 T (-deck and one bead is added to the left rod \050lower) 285.67 607.35 T (-deck\051.) 483.64 607.35 T 54 576.98 540 590.02 C 189 584.04 540 584.04 2 L 0.25 H 2 Z 0 X 0 K N 54 584.04 180 584.04 2 L 0 Z N 0 0 612 792 C 54 554.02 540 567.98 C 189 559.99 540 559.99 2 L 0.25 H 2 Z 0 X 0 K N 0 0 612 792 C 1 9 Q 0 X 0 K (T) 54 570.98 T (ABLE 4) 58.83 570.98 T 0 F (Combined Adding-up And T) 189 570.98 T (aking Of) 298.9 570.98 T (f and Place Advancement) 332.21 570.98 T 0 8 Q (Original Number) 202.8 548.68 T (Formula) 283.39 548.68 T (Bead-Operations Involved) 368.86 548.68 T (lower-deck) 343.65 538.68 T ( upper-deck) 391.21 538.68 T (lower-deck, previous rod) 442.77 538.68 T (5,6,7 or 8) 198 528.68 T (plus 6 \050+1-5+10\051) 267.67 528.68 T (+1) 355.44 528.68 T (-1) 410.45 528.68 T (+1) 463.44 528.68 T (5,6 or 7) 198 518.68 T (plus 2 \050+2-5+10\051) 267.67 518.68 T (+2) 355.44 518.68 T (- 1) 409.33 518.68 T (+1) 463.44 518.68 T (5 or 6) 198 508.68 T (plus 3 \050+3-5+10\051) 267.67 508.68 T (+3) 355.44 508.68 T (- 1) 409.33 508.68 T (+1) 463.44 508.68 T (5) 198 498.68 T (plus 4 \050+4-5+10\051) 267.67 498.68 T (+4) 355.44 498.68 T (- 1) 409.33 498.68 T (+1) 463.44 498.68 T 54 425.99 540 435.02 C 189 433.5 540 433.5 2 L 0.25 H 2 Z 0 X 0 K N 54 433.5 180 433.5 2 L 0 Z N 0 0 612 792 C 1 12 Q 0 X 0 K (3.0) 163.33 439.02 T ( Subtraction) 189 439.02 T 2 10 Q (Subtraction is performed by \336rst registering the minuend and then subtracting, starting) 189 405.33 T -0.17 (from the left, by removing beads form either or both the lower or upper decks. The \336nal) 189 393.33 P (bead-positions represent the answer) 189 381.33 T (.) 331.39 381.33 T 1 F (3.1) 166.11 351.33 T (Simple T) 189 351.33 T (aking-off) 229.92 351.33 T 2 F (This is achieved by simply taking of) 189 327.33 T (f one or more beads from the lower deck, or some-) 334.29 327.33 T (times both. Example: When subtracting 7 \050represented by -5-2= -7\051 from 9, remove 1) 189 315.33 T (bead from the upper) 189 303.33 T (-deck \050-5\051 and 2 beads from the lower deck \050-2\051. The remaining 2) 269.57 303.33 T (beads represent the result.) 189 291.33 T 54 260.96 540 273.99 C 189 268.02 540 268.02 2 L 0.25 H 2 Z 0 X 0 K N 54 268.02 180 268.02 2 L 0 Z N 0 0 612 792 C 54 237.99 540 251.96 C 189 243.97 540 243.97 2 L 0.25 H 2 Z 0 X 0 K N 0 0 612 792 C 1 9 Q 0 X 0 K (T) 54 254.96 T (ABLE 5) 58.83 254.96 T 0 F (Simple T) 189 254.96 T (aking-of) 223.46 254.96 T (f) 255.26 254.96 T 0 8 Q (Original Number) 202.8 232.66 T (Formula) 312.68 232.66 T (Bead-Operations Involved) 396 232.66 T (lower-deck) 411.35 222.66 T ( upper-deck) 488.78 222.66 T (1,2,3,4,5,6,7,8) 198 212.66 T (minus 1) 310 212.66 T (-1) 428.45 212.66 T (2,3,4,7,8 or 9) 198 202.66 T (minus 2) 310 202.66 T (-2) 428.45 202.66 T (3,4,8 or 9) 198 192.66 T (minus 3) 310 192.66 T (-3) 428.45 192.66 T (4 or 9) 198 182.66 T (minus 4) 310 182.66 T (-4) 428.45 182.66 T (5,6,7,8 or 9) 198 172.66 T (minus 5) 310 172.66 T (-1) 509.45 172.66 T (6,7,8 or 9) 198 162.66 T (minus 6) 310 162.66 T (-1) 428.45 162.66 T (-1) 509.45 162.66 T (7,8 or 9) 198 152.66 T (minus 7) 310 152.66 T (-2) 428.45 152.66 T (-1) 509.45 152.66 T (8 or 9) 198 142.66 T (minus 8) 310 142.66 T (-3) 428.45 142.66 T (-1) 509.45 142.66 T (9) 198 132.66 T (minus 9) 310 132.66 T (-4) 428.45 132.66 T (-1) 509.45 132.66 T FMENDPAGE %%EndPage: "9" 10 %%Page: "10" 10 612 792 0 FMBEGINPAGE 72 750.02 558 750.02 2 L 7 X 0 K V 2 H 0 Z 0 X N 72 730.01 558 745.2 R 7 X V 1 9 Q 0 X (Subtraction) 207 739.2 T 72 726.98 558 726.98 2 L 7 X V 0.25 H 0 X N 72 74.02 558 74.02 2 L 7 X V 2 Z 0 X N 72 55.01 558 66.96 R 7 X V 0 X (The Abacus) 207 60.96 T 1 10 Q (10) 522.29 60.96 T 1 9 Q ( of) 533.41 60.96 T 1 10 Q (12) 546.89 60.96 T 498.25 742.67 502.85 742.67 2 L 1 H N 500.55 742.55 500.55 735.65 2 L N 498.25 735.78 502.85 735.78 2 L N 498.25 739.48 502.85 739.48 2 L N 509.74 746.12 509.74 731.18 2 L N 506.8 742.16 512.68 742.16 2 L N 505.53 738.21 513.7 738.21 2 L N 507.44 735.78 505.14 732.33 2 L N 511.65 735.4 513.19 732.33 2 L N 505.35 743.7 M 505.67 742.81 505.67 742.81 505.75 742.49 D 505.83 742.17 505.83 742.17 505.87 741.85 D 505.91 741.53 505.91 741.53 505.35 740.49 D N 522.12 733.79 528.11 741.74 R N 517.84 731.84 533 731.84 2 L N 522.12 737.1 528.11 737.1 2 L N 522.12 739.3 528.11 739.3 2 L N 521.51 746.88 521.99 746.02 522.12 744.8 521.51 742.6 4 L N 522.61 746.14 523.95 746.27 2 L N 522.48 744.07 523.83 742.72 2 L N 526.64 747 527.13 746.14 527.25 744.92 526.64 742.72 4 L N 527.74 746.27 529.09 746.39 2 L N 527.62 744.19 528.96 742.84 2 L N 522.85 732.69 523.83 731.72 524.07 730.74 523.71 729.88 522.85 729.03 5 L N 527.74 732.69 527.98 730.86 527.5 729.39 3 L N 517.15 710.58 532 710.58 2 L N 519.31 710.58 518.59 713.6 529.12 713.6 528.11 710.58 4 L N 522.63 713.6 522.49 710.72 2 L N 525.37 713.32 525.22 710.58 2 L N 516.72 720.23 523.64 720.67 2 L N 520.03 722.83 521.62 721.1 2 L N 521.04 719.66 522.05 717.93 2 L N 518.16 715.77 518.88 716.78 519.17 718.79 518.88 723.69 522.34 724.56 522.2 715.91 6 L N 519.03 724.27 520.18 726 2 L N 525.22 719.95 526.38 720.81 526.23 723.69 527.53 723.98 528.97 723.84 529.12 721.39 528.97 720.23 530.27 719.8 531.13 720.67 9 L N 524.65 714.9 526.81 715.77 528.83 717.35 529.4 718.79 525.22 718.79 527.1 716.34 528.4 715.19 531.13 715.19 8 L N 504.26 712.64 509.61 719.74 R N 500.44 710.89 513.98 710.89 2 L N 504.26 715.59 509.61 715.59 2 L N 504.26 717.55 509.61 717.55 2 L N 503.71 724.32 504.15 723.56 504.26 722.47 503.71 720.5 4 L N 504.7 723.67 505.9 723.78 2 L N 504.59 721.81 505.79 720.61 2 L N 508.3 724.43 508.74 723.67 508.85 722.58 508.3 720.61 4 L N 509.28 723.78 510.48 723.89 2 L N 509.17 721.92 510.37 720.72 2 L N 504.91 711.66 505.79 710.78 506.01 709.91 505.68 709.15 504.91 708.38 5 L N 509.28 711.66 509.5 710.02 509.06 708.71 3 L N 72 164.98 558 686.02 R 7 X V 0 X (3.2) 184.11 679.35 T (Combined Adding-up And T) 207 679.35 T (aking Off) 338.96 679.35 T 2 F (When the number of beads in the lower deck is less than the subtracter \050the number) 207 655.35 T -0.25 (being subtracted\051, one or more beads are added in the lower deck and 1 bead is removed) 207 643.35 P (from the upper) 207 631.35 T (-deck.) 266.2 631.35 T (Example: When subtracting 4 \050+1-5 = -4\051 from 7 \050represented by 1 bead in the upper) 207 607.35 T (-) 545.87 607.35 T -0.18 (deck and 2 beads in the lower deck \050less than 4, the subtracter\051, one bead is added to the) 207 595.35 P -0.02 (lower deck \050+1\051 and 1 bead is removed from the upper) 207 583.35 P -0.02 (-deck \050-5\051 leaving 3 beads, repre-) 424.88 583.35 P (senting the result.) 207 571.35 T 72 540.98 558 554.02 C 207 548.04 558 548.04 2 L 0.25 H 2 Z 0 X 0 K N 72 548.04 198 548.04 2 L 0 Z N 0 0 612 792 C 72 518.02 558 531.98 C 207 523.99 558 523.99 2 L 0.25 H 2 Z 0 X 0 K N 0 0 612 792 C 1 9 Q 0 X 0 K (T) 72 534.98 T (ABLE 6) 76.83 534.98 T 0 F (Combined Adding-up And T) 207 534.98 T (aking Of) 316.9 534.98 T (f) 350.21 534.98 T 0 8 Q (Original Number) 220.8 512.68 T (Formula) 330.68 512.68 T (Bead-Operations Involved) 414 512.68 T (lower-deck) 429.35 502.68 T ( upper-deck) 506.78 502.68 T (5) 207 492.68 T (minus1 \050-5 + 4\051) 315.01 492.68 T (+ 4) 444.33 492.68 T (-1) 527.45 492.68 T (5 or 6) 207 482.68 T (minus 2 \050-5 + 3\051) 313.89 482.68 T (+ 3) 444.33 482.68 T (-1) 527.45 482.68 T (5,6 or 7) 207 472.68 T (minus 3 \050-5 + 2\051) 313.89 472.68 T (+ 2) 444.33 472.68 T (-1) 527.45 472.68 T (5,6,7 or 8) 207 462.68 T (minus 4 \050-5 + 1\051) 313.89 462.68 T (+ 1) 444.33 462.68 T (-1) 527.45 462.68 T 1 10 Q (3.3) 184.11 409.35 T (T) 207 409.35 T (aking-off From A Rod Of Higher Order And Adding-up) 212.37 409.35 T 2 F (When a number on a speci\336c rod is smaller than the subtrahend \0504 is the subtrahend) 207 393.35 T (when performing 13 - 4; note that in the ones column, the 3 is less than the 4\051 one bead) 207 381.35 T -0.16 (for the order of tens and one bead from the lower) 207 369.35 P -0.16 (-deck has to be) 401.75 369.35 P 3 F -0.16 (taken off,) 463.85 369.35 P 2 F -0.16 (and one bead) 503.24 369.35 P (from the upper) 207 357.35 T (-deck is counted.) 266.2 357.35 T 72 326.98 558 340.02 C 207 334.04 558 334.04 2 L 0.25 H 2 Z 0 X 0 K N 72 334.04 198 334.04 2 L 0 Z N 0 0 612 792 C 72 304.02 558 317.98 C 207 309.99 558 309.99 2 L 0.25 H 2 Z 0 X 0 K N 0 0 612 792 C 1 9 Q 0 X 0 K (T) 72 320.98 T (ABLE 7) 76.83 320.98 T 0 F (T) 207 320.98 T (aking-of) 211.49 320.98 T (f From A Rod Of Higher Order And Adding-up) 243.3 320.98 T 0 8 Q (Original Number) 220.8 298.68 T (Formula) 301.39 298.68 T (Bead-Operations Involved) 386.86 298.68 T (lower-deck, right 1 rod) 361.65 288.68 T ( lower-deck) 442.97 288.68 T (upper-deck) 507.86 288.68 T (0) 216 278.68 T (minus 1 \050+9 -10\051) 285.78 278.68 T (-1) 392.45 278.68 T (+ 4) 462.33 278.68 T (+ 1) 516.33 278.68 T (0 or 1) 216 268.68 T (minus 2 \050+8 -10\051) 285.78 268.68 T (- 1) 391.33 268.68 T (+ 3) 462.33 268.68 T (+ 1) 516.33 268.68 T (0,1 or 2) 216 258.68 T (minus 3 \050+7 -10\051) 285.78 258.68 T (- 1) 391.33 258.68 T (+ 2) 462.33 258.68 T (+ 1) 516.33 258.68 T (0,1,2 or 9) 216 248.68 T (minus 4 \050+6 -10\051) 285.78 248.68 T (- 1) 391.33 248.68 T (+ 1) 462.33 248.68 T (+ 1) 516.33 248.68 T (0,1,2,3 or 4) 216 238.68 T (minus 5 \050+5 -10\051) 285.78 238.68 T (- 1) 391.33 238.68 T (+ 1) 516.33 238.68 T (0 or 5) 216 228.68 T (minus 6 \050+4 -10\051) 285.78 228.68 T (- 1) 391.33 228.68 T (+ 4) 462.33 228.68 T (0,5 or 6) 216 218.68 T (minus 7 \050+3 -10\051) 285.78 218.68 T (- 1) 391.33 218.68 T (+ 3) 462.33 218.68 T (0,1,2,5,6 or 7) 216 208.68 T (minus 8 \050+2 -10\051) 285.78 208.68 T (- 1) 391.33 208.68 T (+ 2) 462.33 208.68 T (0,1,2,3,5,6,7,8) 216 198.68 T (minus 9 \050+1 -10\051) 285.78 198.68 T (- 1) 391.33 198.68 T (+ 1) 462.33 198.68 T FMENDPAGE %%EndPage: "10" 11 %%Page: "11" 11 612 792 0 FMBEGINPAGE 54 750.02 540 750.02 2 L 7 X 0 K V 2 H 0 Z 0 X N 54 730.01 540 745.2 R 7 X V 1 9 Q 0 X (Acknowledgments) 189 739.2 T 54 726.98 540 726.98 2 L 7 X V 0.25 H 0 X N 54 74.02 540 74.02 2 L 7 X V 2 Z 0 X N 54 55.01 540 66.96 R 7 X V 1 10 Q 0 X (11) 54 60.96 T 1 9 Q ( of) 65.11 60.96 T 1 10 Q ( 12) 76.1 60.96 T 1 9 Q (The Abacus) 189 60.96 T 498.25 742.67 502.85 742.67 2 L 1 H N 500.55 742.55 500.55 735.65 2 L N 498.25 735.78 502.85 735.78 2 L N 498.25 739.48 502.85 739.48 2 L N 509.74 746.12 509.74 731.18 2 L N 506.8 742.16 512.68 742.16 2 L N 505.53 738.21 513.7 738.21 2 L N 507.44 735.78 505.14 732.33 2 L N 511.65 735.4 513.19 732.33 2 L N 505.35 743.7 M 505.67 742.81 505.67 742.81 505.75 742.49 D 505.83 742.17 505.83 742.17 505.87 741.85 D 505.91 741.53 505.91 741.53 505.35 740.49 D N 522.12 733.79 528.11 741.74 R N 517.84 731.84 533 731.84 2 L N 522.12 737.1 528.11 737.1 2 L N 522.12 739.3 528.11 739.3 2 L N 521.51 746.88 521.99 746.02 522.12 744.8 521.51 742.6 4 L N 522.61 746.14 523.95 746.27 2 L N 522.48 744.07 523.83 742.72 2 L N 526.64 747 527.13 746.14 527.25 744.92 526.64 742.72 4 L N 527.74 746.27 529.09 746.39 2 L N 527.62 744.19 528.96 742.84 2 L N 522.85 732.69 523.83 731.72 524.07 730.74 523.71 729.88 522.85 729.03 5 L N 527.74 732.69 527.98 730.86 527.5 729.39 3 L N 517.15 710.58 532 710.58 2 L N 519.31 710.58 518.59 713.6 529.12 713.6 528.11 710.58 4 L N 522.63 713.6 522.49 710.72 2 L N 525.37 713.32 525.22 710.58 2 L N 516.72 720.23 523.64 720.67 2 L N 520.03 722.83 521.62 721.1 2 L N 521.04 719.66 522.05 717.93 2 L N 518.16 715.77 518.88 716.78 519.17 718.79 518.88 723.69 522.34 724.56 522.2 715.91 6 L N 519.03 724.27 520.18 726 2 L N 525.22 719.95 526.38 720.81 526.23 723.69 527.53 723.98 528.97 723.84 529.12 721.39 528.97 720.23 530.27 719.8 531.13 720.67 9 L N 524.65 714.9 526.81 715.77 528.83 717.35 529.4 718.79 525.22 718.79 527.1 716.34 528.4 715.19 531.13 715.19 8 L N 504.26 712.64 509.61 719.74 R N 500.44 710.89 513.98 710.89 2 L N 504.26 715.59 509.61 715.59 2 L N 504.26 717.55 509.61 717.55 2 L N 503.71 724.32 504.15 723.56 504.26 722.47 503.71 720.5 4 L N 504.7 723.67 505.9 723.78 2 L N 504.59 721.81 505.79 720.61 2 L N 508.3 724.43 508.74 723.67 508.85 722.58 508.3 720.61 4 L N 509.28 723.78 510.48 723.89 2 L N 509.17 721.92 510.37 720.72 2 L N 504.91 711.66 505.79 710.78 506.01 709.91 505.68 709.15 504.91 708.38 5 L N 509.28 711.66 509.5 710.02 509.06 708.71 3 L N 54 87.98 540 686.02 R 7 X V 1 10 Q 0 X (3.4) 166.11 679.35 T (Combined T) 189 679.35 T (aking-off From A Rod Of Higher Order) 246.01 679.35 T (, Adding-up in the) 425.93 679.35 T (Upper-deck and T) 189 667.35 T (aking-off in the Lower-Deck) 272.67 667.35 T 2 F (This technique is called for when a number on a speci\336c rod is smaller than the sup-) 189 651.35 T (posed subtrahend \050I have no idea what this means\051, but only in such cases as exempli-) 189 639.35 T (\336ed by 12 - 6.) 189 627.35 T 54 596.98 540 610.02 C 189 604.04 540 604.04 2 L 0.25 H 2 Z 0 X 0 K N 54 604.04 180 604.04 2 L 0 Z N 0 0 612 792 C 54 574.02 540 587.98 C 189 579.99 540 579.99 2 L 0.25 H 2 Z 0 X 0 K N 0 0 612 792 C 1 9 Q 0 X 0 K (T) 54 590.98 T (ABLE 8) 58.83 590.98 T 0 F (Combined T) 189 590.98 T (aking-of) 236.95 590.98 T (f...) 268.75 590.98 T 0 8 Q (Original Number) 202.8 568.68 T (Formula) 283.39 568.68 T (Bead-Operations Involved) 368.86 568.68 T (lower-deck, 1 rod right) 343.65 558.68 T ( lower-deck) 436.55 558.68 T (upper-deck) 490.53 558.68 T (1,2,3 or 4) 198 548.68 T (minus 6 \050-1+5-10\051) 265.34 548.68 T (-1) 374.45 548.68 T (-1) 446.45 548.68 T (+1) 499.44 548.68 T (2,3 or 4) 198 538.68 T (minus 7 \050-2+5-10\051) 265.34 538.68 T (-1) 374.45 538.68 T (- 2) 445.33 538.68 T (+1) 499.44 538.68 T (3 or 4) 198 528.68 T (minus 8 \050-3+5-10\051) 265.34 528.68 T (-1) 374.45 528.68 T (- 3) 445.33 528.68 T (+1) 499.44 528.68 T (4) 198 518.68 T (minus9 \050-4+5-10\051) 266.45 518.68 T (-1) 374.45 518.68 T (- 4) 445.33 518.68 T (+1) 499.44 518.68 T 2 10 Q (If you\325ve actually read this user) 189 495.35 T (\325) 316.21 495.35 T (s guide up to this point, hoping to learn how to use the) 318.99 495.35 T (abacus to its maximum potential, I should tell you that you\325d be better of) 189 483.35 T (f using a hand-) 480.31 483.35 T (held \050or pop-up\051 digital calculator) 189 471.35 T (. \050I hear you asking: Why did I bother going through) 323.91 471.35 T -0.11 (all this if I was going to expound this heresy at the conclusion? Essentially) 189 459.35 P -0.11 (, the exercise) 485.37 459.35 P (was designed to be didactic; from my programming stand-point, it was an interesting) 189 447.35 T (program to attempt and hopefully) 189 435.35 T (, the user would learn a thing or two. Unquestionably) 322.71 435.35 T (,) 534.97 435.35 T (though, it was unmitigated fun!\051. T) 189 423.35 T (echnically) 328.49 423.35 T (, the abacus) 368.92 423.35 T 3 F (is) 418.32 423.35 T 2 F ( a hand-held digital calcula-) 424.99 423.35 T (tor) 189 411.35 T (, but that the user must perform some sort of manipulations before the solution is) 199.7 411.35 T (arrived at.) 189 399.35 T 54 349.99 540 359.02 C 189 357.5 540 357.5 2 L 0.25 H 2 Z 0 X 0 K N 54 357.5 180 357.5 2 L 0 Z N 0 0 612 792 C 1 12 Q 0 X 0 K (4.0) 163.33 363.02 T (Acknowledgments) 189 363.02 T 2 10 Q -0.22 (A great debt of gratitude goes to Agustine Lee, instructor at the R) 189 329.33 P -0.22 (yerson Electrical Engi-) 448.29 329.33 P -0.14 (neering Department, who supplied a real, live abacus without which) 189 317.33 P 3 F -0.14 (xabacus) 462.41 317.33 P 2 F -0.14 ( would not) 495.16 317.33 P (be possible, for supplying invaluable documentation, that was shamelessly plagiarized) 189 305.33 T (into the documentation you are now reading, for the Chinese characters, and for testing) 189 293.33 T 3 F (xabacus) 189 281.33 T 2 F ( and providing helpful comments on improving it....) 221.75 281.33 T (...thanks also to Nick Colonello, systems administrator and all-round technical-support) 189 257.33 T (person for beta testing....) 189 245.33 T (...and to Eva Dudova, who has expertise in unmercifully crashing applications \050has a) 189 221.33 T (future as a beta-tester\051, and is cute too...) 189 209.33 T -0.17 (... and \336nally) 189 185.33 P -0.17 (, thanks to those who have written X-applications, from whose code I have) 240.48 185.33 P (learned the art of X.) 189 173.33 T (This document was typeset using FrameMaker 2.1 \050and then we got version 3.0 which) 189 149.33 T (would have really come-in handy for making all those tables\051 running on a) 189 137.33 T (SP) 189 125.33 T (ARCstation 1.) 199.19 125.33 T FMENDPAGE %%EndPage: "11" 12 %%Page: "12" 12 612 792 0 FMBEGINPAGE 72 750.02 558 750.02 2 L 7 X 0 K V 2 H 0 Z 0 X N 72 730.01 558 745.2 R 7 X V 1 9 Q 0 X (Do those Chinese characters really mean anything?) 207 739.2 T 72 726.98 558 726.98 2 L 7 X V 0.25 H 0 X N 72 74.02 558 74.02 2 L 7 X V 2 Z 0 X N 72 55.01 558 66.96 R 7 X V 0 X (The Abacus) 207 60.96 T 1 10 Q (12) 522.29 60.96 T 1 9 Q ( of) 533.41 60.96 T 1 10 Q (12) 546.89 60.96 T 498.25 742.67 502.85 742.67 2 L 1 H N 500.55 742.55 500.55 735.65 2 L N 498.25 735.78 502.85 735.78 2 L N 498.25 739.48 502.85 739.48 2 L N 509.74 746.12 509.74 731.18 2 L N 506.8 742.16 512.68 742.16 2 L N 505.53 738.21 513.7 738.21 2 L N 507.44 735.78 505.14 732.33 2 L N 511.65 735.4 513.19 732.33 2 L N 505.35 743.7 M 505.67 742.81 505.67 742.81 505.75 742.49 D 505.83 742.17 505.83 742.17 505.87 741.85 D 505.91 741.53 505.91 741.53 505.35 740.49 D N 522.12 733.79 528.11 741.74 R N 517.84 731.84 533 731.84 2 L N 522.12 737.1 528.11 737.1 2 L N 522.12 739.3 528.11 739.3 2 L N 521.51 746.88 521.99 746.02 522.12 744.8 521.51 742.6 4 L N 522.61 746.14 523.95 746.27 2 L N 522.48 744.07 523.83 742.72 2 L N 526.64 747 527.13 746.14 527.25 744.92 526.64 742.72 4 L N 527.74 746.27 529.09 746.39 2 L N 527.62 744.19 528.96 742.84 2 L N 522.85 732.69 523.83 731.72 524.07 730.74 523.71 729.88 522.85 729.03 5 L N 527.74 732.69 527.98 730.86 527.5 729.39 3 L N 517.15 710.58 532 710.58 2 L N 519.31 710.58 518.59 713.6 529.12 713.6 528.11 710.58 4 L N 522.63 713.6 522.49 710.72 2 L N 525.37 713.32 525.22 710.58 2 L N 516.72 720.23 523.64 720.67 2 L N 520.03 722.83 521.62 721.1 2 L N 521.04 719.66 522.05 717.93 2 L N 518.16 715.77 518.88 716.78 519.17 718.79 518.88 723.69 522.34 724.56 522.2 715.91 6 L N 519.03 724.27 520.18 726 2 L N 525.22 719.95 526.38 720.81 526.23 723.69 527.53 723.98 528.97 723.84 529.12 721.39 528.97 720.23 530.27 719.8 531.13 720.67 9 L N 524.65 714.9 526.81 715.77 528.83 717.35 529.4 718.79 525.22 718.79 527.1 716.34 528.4 715.19 531.13 715.19 8 L N 504.26 712.64 509.61 719.74 R N 500.44 710.89 513.98 710.89 2 L N 504.26 715.59 509.61 715.59 2 L N 504.26 717.55 509.61 717.55 2 L N 503.71 724.32 504.15 723.56 504.26 722.47 503.71 720.5 4 L N 504.7 723.67 505.9 723.78 2 L N 504.59 721.81 505.79 720.61 2 L N 508.3 724.43 508.74 723.67 508.85 722.58 508.3 720.61 4 L N 509.28 723.78 510.48 723.89 2 L N 509.17 721.92 510.37 720.72 2 L N 504.91 711.66 505.79 710.78 506.01 709.91 505.68 709.15 504.91 708.38 5 L N 509.28 711.66 509.5 710.02 509.06 708.71 3 L N 72 87.98 558 686.02 R 7 X V 1 12 Q 0 X (5.0) 181.33 678.02 T (Do those Chinese characters really mean) 207 678.02 T 72 650.99 558 660.02 C 207 658.5 558 658.5 2 L 0.25 H 2 Z 0 X 0 K N 72 658.5 198 658.5 2 L 0 Z N 0 0 612 792 C 1 12 Q 0 X 0 K (anything?) 207 664.02 T 2 10 Q (A few) 207 634.33 T 2 8 Q (1) 231.7 638.33 T 2 10 Q ( people have asked me this, so here\325) 235.69 634.33 T (s the translation:) 379.48 634.33 T 72 99.98 558 116.04 C 207 107.98 351 107.98 2 L 0.25 H 2 Z 0 X 0 K N 0 0 612 792 C 2 8 Q 0 X 0 K (1. A grand total of 1, actually.) 207 94.65 T 72 87.98 558 686.02 C 206.82 438.97 558 630.99 C 215.82 526.6 224.46 526.6 2 L 1 H 2 Z 0 X 0 K N 220.14 526.36 220.14 513.4 2 L N 215.82 513.64 224.46 513.64 2 L N 215.82 520.6 224.46 520.6 2 L N 237.43 533.08 237.43 504.99 2 L N 231.9 525.64 242.95 525.64 2 L N 229.5 518.2 244.87 518.2 2 L N 233.1 513.64 228.78 507.15 2 L N 241.03 512.92 243.91 507.15 2 L N 229.17 528.52 M 229.77 526.86 229.77 526.86 229.92 526.26 D 230.07 525.65 230.07 525.65 230.15 525.05 D 230.23 524.45 230.23 524.45 229.17 522.48 D N 268.87 510.49 280.13 525.44 R N 260.82 506.82 289.33 506.82 2 L N 268.87 516.7 280.13 516.7 2 L N 268.87 520.84 280.13 520.84 2 L N 267.72 535.09 268.64 533.49 268.87 531.19 267.72 527.05 4 L N 269.79 533.72 272.32 533.95 2 L N 269.56 529.81 272.09 527.28 2 L N 277.37 535.33 278.29 533.72 278.52 531.42 277.37 527.28 4 L N 279.44 533.95 281.97 534.18 2 L N 279.21 530.04 281.74 527.51 2 L N 270.25 508.43 272.09 506.59 272.55 504.75 271.86 503.14 270.25 501.53 5 L N 279.44 508.43 279.9 504.98 278.98 502.22 3 L N 310.73 507.83 338.65 507.83 2 L N 314.8 507.83 313.45 513.52 333.23 513.52 331.33 507.83 4 L N 321.03 513.52 320.76 508.1 2 L N 326.18 512.97 325.91 507.83 2 L N 309.92 525.98 322.93 526.8 2 L N 316.15 530.86 319.14 527.61 2 L N 318.05 524.9 319.95 521.65 2 L N 312.63 517.58 313.99 519.48 314.53 523.27 313.99 532.49 320.49 534.11 320.22 517.85 6 L N 314.26 533.57 316.43 536.83 2 L N 325.91 525.44 328.08 527.07 327.81 532.49 330.25 533.03 332.96 532.76 333.23 528.15 332.96 525.98 335.4 525.17 337.02 526.8 9 L N 324.83 515.96 328.89 517.58 332.69 520.56 333.77 523.27 325.91 523.27 329.44 518.67 331.88 516.5 337.02 516.5 8 L N 3 10 Q (The Calculation with) 215.82 579.05 T (The Abacus) 276.91 606.16 T 2 F (W) 216.67 475.33 T (ith respect to the arrangement in the top-left corner of every page, the characters) 225.7 475.33 T 3 F (Bead) 215.82 543.05 T (Calculate) 257.95 543.05 T (Plate) 311.72 543.05 T (the Abacus) 234.68 570.16 T 249.32 558.99 249.32 495.99 2 L 0.5 H 3 X N 302.49 585.99 302.49 496.83 2 L N 251.15 621.99 251.15 594.99 2 L N 350.82 621.99 350.82 495.99 2 L N 2 F 0 X (may be read left-to-right or top-to-bottom.) 219.37 462.18 T 72 87.98 558 686.02 C 0 0 612 792 C FMENDPAGE %%EndPage: "12" 13 %%Trailer %%BoundingBox: 0 0 612 792 %%Pages: 12 1 %%DocumentFonts: Helvetica %%+ Helvetica-Bold %%+ Times-Roman %%+ Times-Italic %%+ Times-Bold xabacus-8.1.6/sound.c0000644000175000017500000002441413171520731014567 0ustar demarchidemarchi/* * @(#)sound.c * * Taken from xlock, many authors... * * All rights reserved. * * Permission to use, copy, modify, and distribute this software and * its documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear in * supporting documentation, and that the name of the author not be * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. * * This program 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. */ #if defined(USE_RPLAY) || defined(USE_NAS) || defined(USE_VMSPLAY) || defined(USE_ESOUND) || defined (WINVER) || defined(DEF_PLAY) #include #include #include #include "file.h" #include "sound.h" #ifdef WINVER #define STRICT #include #include static void play_sound(const char *fileName) { (void) PlaySound(fileName, NULL, SND_ASYNC | SND_FILENAME); } #endif #ifdef DEF_PLAY static void play_sound(const char *fileName) { char *progrun = '\0'; if ((progrun = (char *) malloc(strlen(DEF_PLAY) + strlen(fileName) + 11)) != NULL) { (void) sprintf(progrun, "( %s %s ) 2>&1", DEF_PLAY, fileName); #if 0 (void) printf("%s\n", progrun); #endif if (system(progrun)) (void) printf("audio error\n"); free(progrun); } } #endif #ifdef USE_RPLAY #include static void play_sound(const char *fileName) { int rplay_fd = rplay_open_default(); if (rplay_fd >= 0) { rplay_sound(rplay_fd, (char *) fileName); rplay_close(rplay_fd); } } #endif #ifdef USE_NAS /* Gives me lots of errors when I compile nas-1.2p5 -- xlock maintainer */ /*- * Connect each time, because it might be that the server was not running * when xlock first started, but is when next nas_play is called */ #include