latex2hyp/000755 001017 000764 00000000000 05645625737 014212 5ustar00rnelsonfaculty000000 000000 latex2hyp/rlib/000755 001017 000764 00000000000 05645340536 015131 5ustar00rnelsonfaculty000000 000000 latex2hyp/rlib/language.c000644 001017 000764 00000065551 05645345041 017070 0ustar00rnelsonfaculty000000 000000 /* language.cpp Written by Roger Nelson Biological Systems Engr. Dept. Washington State University Pullman, WA 99164-6120 rnelson@wsuaix.csc.wsu.edu See header file for additional documentation */ #define LANGUAGE_THE_TRANSLATIONS #include #undef LANGUAGE_THE_TRANSLATIONS #include #include #include #if defined(_DCC) || defined(__SASC) #include #else #include #endif #ifdef __MSDOS__ #include /* <- MS-DOS */ #endif #if defined(_DCC) || defined(__SASC) || defined(UNIX) #define MAXPATH 255 #define MAXFILE 32 #endif char language_full_phrase_filename[MAXPATH]; int language_curr_number = 0; struct language_available *languages_available=0; /* List of available langs */ char *language_current_code=0; /* active language */ /* #define USEFSCANF */ /* ISO standard language codes ISO639 The list was extracted from an Internet draft, "Characters and character sets for various languages" by Harald.Alvestrand@delab.sintef.no. */ /* ?? Gaelic ?? Rhaetian ?? Sami/ ?? Sorbian lowercase letters must be used because thats the standard */ #define NUM_ISO2_CODES 135 struct ISO2coding ISO2codes[NUM_ISO2_CODES] = { {"aa","Afar" /*,"Somalia, Ethiopia, Djibouti" Latin*/}, {"ab","Abkhazian" /*,"Georgia" Cyrillic*/}, {"af","Afrikaans" /*,"South Africa"*/}, {"am","Amharic" /*,"Ethiopia" Ethiopic*/}, {"ar","Arabic" /*,"Arabia" ISO-8859-6*/}, {"as","Assamese" /*,"India, Nepal" Bengali*/}, {"ay","Aymara" /*,"Bolivia, Peru, Chile" Latin*/}, {"az","Azerbaijani" /*,"SNC, Iran, Iraq, Turkey" Cyrillic, Arabic*/}, {"ba","Bashkir" /*,"SNC" Cyrillic*/}, {"be","Byelorussian" /*,"?" ISO-8859-5*/}, {"bg","Bulgarian" /*,"Bulgaria" ISO-8859-5*/}, {"bh","Bihari" /*,"India" Gujarati (or Kaithi)*/}, {"bi","Bislama" /*,"Vanuatu, New Caledonia" Latin*/}, {"bn","Bengali" /*,"India" Bengali*/}, {"bo","Tibetan" /*,"Tibet" */}, {"br","Breton" /*,"Britania"*/}, {"ca","Catalan" /*,"Spain"*/}, {"co","Corsican" /*,"France" Latin*/}, {"cs","Czech" /*,"Czech republic"*/}, {"cy","Welsh" /*,"Wales"*/}, {"da","Danish" /*,"Denmark"*/}, {"de","German" /*,"Germany"*/}, {"dz","Bhutani" /*,"Bhutan?"*/}, {"el","Greek" /*,"Greece" ISO-8859-7*/}, {"en","English" /*,"various" USASCII*/}, {"eo","Esperanto" /*,"artificial"*/}, {"es","Spanish" /*,"various"*/}, {"et","Estonian" /*,"Estonia"*/}, {"eu","Basque" /*,"?"*/}, {"fa","Persian" /*,"Persian countries" ISO-8859-6*/}, {"fi","Finnish" /*,"Finland"*/}, {"fj","Fiji" /*,"Fiji" Latin*/}, {"fo","Faeroese" /*,"Faeroe Islands"*/}, {"fr","French" /*,"various"*/}, {"fy","Frisian" /*,"?"*/}, {"ga","Irish" /*," 'Ireland"*/}, {"gd","Scots" /*,"UK" Latin*/}, {"gl","Galician" /*,"?"*/}, {"gn","Guarani" /*,"Paraguay" Latin*/}, {"gu","Gujarati" /*,"India" Gujarati*/}, {"ha","Hausa" /*,"Nigeria, Niger,Chad,Sudan,..." Latin*/}, {"hi","Hindi" /*,"India" Devanagari*/}, {"hr","Croatian" /*,"Croatia"*/}, {"hu","Hungarian" /*,"Hungary"*/}, {"hy","Armenian" /*,"Armenia" Armenian*/}, {"ia","Interlingua" /*,"artificial" Latin*/}, {"ie","Interlingue" /*,"artificial" Latin*/}, {"ik","Inupiak" /*,"USA, Cannada" Latin, Cree*/}, {"in","Indonesian" /*,"Indonesia" Latin*/}, {"is","Icelandic" /*,"Iceland"*/}, {"it","Italian" /*,"Italy"*/}, {"iw","Hebrew" /*,"Israel" ISO-8859-8*/}, {"ja","Japanese" /*,"Japan" ISO-IR-87 (Japanese JIS C6226-1983)*/}, {"ji","Yiddish" /*,"Germany, USA, SNC, Israel" Hebrew*/}, {"jw","Javanese" /*,"Indonesia, Malaysia" Latin, Javanese*/}, {"ka","Georgian" /*,"Georgia" Georgian*/}, {"kk","Kazakh" /*,"SNC, Afghanistan" Cyrillic, Arabic*/}, {"kl","Greenlandic" /*,"Greenland"*/}, {"km","Cambodian" /*,"Cambodia" Khmer*/}, {"kn","Kannada" /*,"India" Kannada*/}, {"ko","Korean" /*,"Korea" ISO-IR-149 (Korean KS C 5601-1989)*/}, {"ks","Kashmiri" /*,"India, Pakistan" Arabic*/}, {"ku","Kurdish" /*,"SNC, Turkey, Iraq, Iran" Cyrillic, Arabic*/}, {"ky","Kirghiz" /*,"SNC, China, Afghanistan" Cyrillic, Arabic*/}, {"la","Latin" /*,"none" USASCII*/}, {"ln","Lingala" /*,"CAR, Congo, Zaire" Latin*/}, {"lo","Laotian" /*,"Laos" ISO-IR-166*/}, {"lt","Lithuanian" /*,"Lithuania"*/}, {"lv","Latvian, Lettish"/*,"Latvia"*/}, {"mg","Malagasy" /*,"Madagascar, Comoro Islands" Latin, Arabic*/}, {"mi","Maori" /*,"New Zealand" Latin*/}, {"mk","Macedonian" /*,"Greece, Yugoslavia" Greek, Cyrillic*/}, {"ml","Malayalam" /*,"India" Malayalam*/}, {"mn","Mongolian" /*,"Mongolia" Cyrillic, Mongolian*/}, {"mo","Moldavian" /*,"Romania" Latin*/}, {"mr","Marathi" /*,"India" Devanagari*/}, {"ms","Malay" /*,"Malaysia, Thailand" Latin*/}, {"mt","Maltese" /*,"Malta"*/}, {"my","Burmese" /*,"Myanmar" Burmese*/}, {"na","Nauru" /*,"Nauru" Latin*/}, {"ne","Nepali" /*,"Nepal" Devanagari*/}, {"nl","Dutch" /*,"Holland"*/}, {"no","Norwegian" /*,"Norway"*/}, {"oc","Occitan" /*,"France" Latin*/}, {"or","Oriya" /*,"India" Oriya*/}, {"pa","Punjabi" /*,"India" Gurmukhi*/}, {"pl","Polish" /*,"Poland" */}, {"ps","Pashto (W.)" /*,"Afghanistan, Iran" Arabic*/}, {"pt","Portuguese" /*,"Portugal"*/}, {"qu","Quechua" /*,"Peru" Latin*/}, {"rm","Rhaeto" /*,"Swizerland" Latin*/}, {"rn","Kirundi" /*,"Burundi, Uganda" Latin*/}, {"ro","Romanian" /*,"Romania"*/}, {"ru","Russian" /*,"Russia" ISO-8859-5*/}, {"rw","Kinyarwanda" /*,"Rwanda, Uganda, Zaire" Latin*/}, {"sa","Sanskrit" /*,"India" Devanagari*/}, {"sd","Sindhi" /*,"Pakistan,India,Afghanistan" Arabic, Gurmukhi*/}, {"sg","Sangro" /*,"Central African Republic" Latin*/}, {"sh","Serbo-Croatian" /*,"Serbia,Croatia"*/}, {"si","Singhalese" /*,"Sri Lanka" Sinhalese*/}, {"sk","Slovak" /*,"Slovakia"*/}, {"sl","Slovenian" /*,"Slovenia"*/}, {"sm","Samoan" /*,"Samoa, USA, New Zealand" Latin*/}, {"sn","Shona" /*,"Zimbabwe,Zambia,Mozambique" Latin*/}, {"so","Somali" /*,"Somalia, Ethiopia, Djibouti" Latin*/}, {"sq","Albanian" /*,"Albania"*/}, {"sr","Serbian" /*,"former Yugoslavia" Cyrillic*/}, {"ss","Siswati" /*,"S. Africa, Swaziland" Latin*/}, {"st","Sesotho" /*,"S. Africa, Lesotho" Latin*/}, {"su","Sudanese" /*,"Sudan" Latin*/}, {"sv","Swedish" /*,"Sweden"*/}, {"sw","Swahili" /*,"Africa" USASCII*/}, {"ta","Tamil" /*,"India, Malaysia" Tamil*/}, {"te","Tegulu" /*,"India" Telugu*/}, {"tg","Tajik" /*,"Tajikistan" Arabic*/}, {"th","Thai" /*,"Thailand" ISO-IR-166*/}, {"ti","Tigrinya" /*,"Ethiopia" Latin, Ethiopic*/}, {"tk","Turkmen" /*,"SNC, Iran, Afghanistan" Cyrillic, Arabic*/}, {"tl","Tagalog" /*,"Phillipines" Latin*/}, {"tn","Setswana" /*,"S.Africa, Botswana, Namibia" Latin*/}, {"to","Tonga (3)" /*,"Mozambique" Latin*/}, {"tr","Turkish" /*,"Turkey"*/}, {"ts","Tsonga" /*,"Mozambique, Swaziland" Latin*/}, {"tt","Tatar" /*,"SNC" Cyrillic*/}, {"tw","Twi (Ewe)" /*,"Ghana" Latin*/}, {"uk","Ukrainian" /*,"Ukrain" ISO-8859-5*/}, {"ur","Urdu" /*,"Pakistan" ISO-8859-6*/}, {"uz","Uzbek (S.)" /*,"Afghanistan, Turkey" Arabic*/}, {"vi","Vietnamese" /*,"Vietnam, Cambodia, China" Latin*/}, {"vo","Volapuk" /*,"?" ISO-8859-1*/}, {"wo","Wolof" /*,"Senegal, Mauritania" Latin*/}, {"xh","Xhosa" /*,"S. Africa" Latin*/}, {"yo","Yoruba" /*,"Nigeria, Togo, Benin" Latin*/}, {"zh","Chinese" /*,"China" ISO-IR-58 (Chinese GB 2312-80)*/}, {"zu","Zulu" /*,"S. Africa, Lesotho, Malawi" Latin*/}, }; struct language_node { long phrase_ID; char *phrase; struct language_node *right; }; struct language_node *language_list = 0; /* This function takes the fully qualified program name Ie C:\PATHA\MYAPP.EXE it returns the path: C:\PATHA and the program name without the extension: MYAPP This function is used internally, but may be useful to the programmer. */ #ifdef HARDCODE_PHRASES #if defined(__STDC__) || defined(__cplusplus) int language_set(char *language_name) #else int language_set(language_name) char *language_name; #endif { int i; for (i = 0; i < language_num_languages;i++) if (strcmp(language_codes[i], language_name) == 0) { language_curr_number = i; return(1); }; return(0); } #if defined(__STDC__) || defined(__cplusplus) char *translate_to(long phrase_ID,int language_number) #else char *translate_to(phrase_ID,language_number) long phrase_ID; int language_number; #endif { /* With this, we now support recursive dialect definitions! */ /* Case where there is no translation for the language, return the first translation (usually english). */ if (language_translations[phrase_ID][language_number] == 0) return(language_translations[phrase_ID][0]); /* Case where the translation is the same as a base language this case will only occur in languages which are dialects The entry in the table is actually the number of the base language. */ if ((long)(language_translations[phrase_ID][language_number]) <= language_num_languages) return(translate_to(phrase_ID,(int)(long)(language_translations[phrase_ID][language_number]))); /* Case where the translation is the character string */ return(language_translations[phrase_ID][language_number]); } #else /* #if defined (__BCPLUSPLUS__) || defined(__BORLANDC) # define strupper(x) strupr(x) #else */ # if defined(__STDC__) || defined(__cplusplus) char_8bit *strupper(char_8bit *str) # else char_8bit *strupper(str); char_8bit *str; # endif { int i; for (i = 0 ; i < strlen(str);i++) str[i] = toupper(str[i]); return(str); } /*#endif */ /* This function deallocates the linked list of phrases This function should not be called externally. */ #if defined(__STDC__) || defined(__cplusplus) void clear_language_list(struct language_node *langlist) #else void clear_language_list(langlist) struct language_node *langlist; #endif { struct language_available *lang; struct language_available *next_lang = 0; struct language_node *node; struct language_node *nextnode = 0; for (node = langlist; node; node = nextnode) { if (node->phrase) free(node->phrase); nextnode = node->right; free(node); }; for (lang = languages_available; lang; lang = next_lang) { next_lang = lang->next; free(lang->name); free(lang->desc); free(lang); }; languages_available = 0; } /* This function reads a phrase entry from the phrases file. It is used internally and is probably of no use to the programmer. */ #if defined(__STDC__) || defined(__cplusplus) int language_read_phrase (FILE *phrase_file, char *phrase, /* Where to put the read phrase. */ char *language_name_code, /* The language to read. */ char *base_language_name_code, char *used_by /* This list of programs using this phrase */ ) #else int language_read_phrase(phrase_file,phrase,language_name_code,base_language_name_code,used_by) FILE *phrase_file; char *phrase; /* Where to put the read phrase. */ char *language_name_code; /* The language to read. */ char *base_language_name_code; char *used_by; /* This list of programs using this phrase */ #endif /* Returns true is the next phrase was read successfully. */ { char phrase_ID_str[255]; char language_name_code_to_read[255]; char language_name_code_in[255]; int read_complete; char line_in[255]; char phrase_in[255]; if (feof(phrase_file)) /* If at eof then phrase not read */ return(0); fgets(phrase_ID_str,255,phrase_file); /* get the phrase ID (not used) */ #ifdef DEBUG printf("%s\n",phrase_ID_str); #endif if ((phrase_ID_str[0] == 0) || (feof(phrase_file))) return(0); #ifdef USEFSCANF fscanf(phrase_file,"%[^\n]\n",used_by); #else fgets(used_by,255,phrase_file); #endif read_complete = 0; phrase[0] = 0; /* Clear the phrase */ do { strcpy(language_name_code_to_read,language_name_code); #ifdef USEFSCANF fscanf(phrase_file,"%[^\n]\n",line_in); #else fgets(line_in,255,phrase_file); #endif if (line_in[0] == '*') read_complete = 1; else { #ifdef USEFSCANF sscanf(line_in,"%s %[^\n]\n",language_name_code_in,phrase_in); #else { int i; int j =0; int k =0; int incode = 1; for (i = 0; i < strlen(line_in); i++) if (incode) if (line_in[i] == ' ') incode = 0; else language_name_code_in[j++] = line_in[i]; else if (line_in[i] != '\n') phrase_in[k++] = line_in[i]; language_name_code_in[j] = 0; phrase_in[k] = 0; }; #endif if (phrase_in[0] == '=') strcpy(language_name_code_to_read,&(phrase_in[1])); if (strcmp(language_name_code_in,language_name_code_to_read) == 0) strcpy(phrase,phrase_in); else if ((strcmp(language_name_code_in,base_language_name_code) == 0) && (phrase[0] == 0)) strcpy(phrase,phrase_in); /* Use english if translation not provided if ((strcmp(language_name_code_in,"en") == 0) && (phrase[0] == 0)) strcpy(phrase,phrase_in); */ }; } while (!read_complete); return(1); } /* Some UNIXes may not have strstr defined in string.h */ #ifdef SYSV char *strstr(str1,str2) char *str1; char *str2; { int i,j; j = 0; for (i = 0; i < strlen(str1); i++) if (str1[i] == str2[i+j]) { j += 1; if (j == strlen(str2)) return (&(str1[i-j])); } else { j = 0; i = i - j + 1; }; } #endif #if defined(__STDC__) || defined(__cplusplus) void language_get_available(FILE *phrases_file) #else void language_get_available(phrases_file) FILE *phrases_file; #endif { struct language_available *lang =0; char nameline[255]; char name[255]; char desc[255]; do fgets(nameline,255,phrases_file); while (strncmp(nameline,"LINGVO,",7) != 0); fgets(nameline,255,phrases_file); /* ignore the program line */ fgets(nameline,255,phrases_file); /* ignore the program line */ while (nameline[0] != '*') /* first char of comment token */ { if ((lang = (struct language_available *)malloc(sizeof(struct language_available))) != 0) { sscanf(nameline,"%s %[^\n]",name,desc); /* the first language line */ lang->name = (char *)malloc(strlen(name)+1); strcpy(lang->name,name); lang->desc = (char *)malloc(strlen(desc)+1); strcpy(lang->desc,desc); lang->next = languages_available; languages_available = lang; }; fgets(nameline,255,phrases_file); /* ignore the program line */ }; } #if defined(__STDC__) || defined(__cplusplus) void language_load_dialects(FILE *phrases_file,char *language_name_code,char *base_language_name_code) #else void language_load_dialects(phrases_file,language_name_code,base_language_name_code) FILE *phrases_file; char *language_name_code; char *base_language_name_code; #endif { char dialects[256]; #ifdef USEFSCANF fscanf(phrases_file,"%[^\n]\n",dialects); /* Read the DIALEKTOJ */ fscanf(phrases_file,"%[^\n]\n",dialects); #else fgets(dialects,255,phrases_file); fgets(dialects,255,phrases_file); #endif while (dialects[0] != '*') { if (strstr(dialects,language_name_code) != NULL) sscanf(dialects,"%s ",base_language_name_code); #ifdef USEFSCANF fscanf(phrases_file,"%[^\n]\n",dialects); #else fgets(dialects,255,phrases_file); #endif }; } /* This function is usually used internally by language_init(), but may be used by the programmer to allow the user to change the language on the fly. language_load returns 1 if the translations loaded successfully 0 if the file is not found or corrupt. */ #if defined(__STDC__) || defined(__cplusplus) int language_load(char *language_name_code,char *program_name,char *program_dir, char *phrases_filename) #else int language_load(language_name_code,program_name,program_dir,phrases_filename) char *language_name_code; char *program_name; char *program_dir; char *phrases_filename; #endif { FILE *phrase_file; /* char phrase_directory[MAXPATH]; */ struct language_node *node = 0; long phrase_ID; /* long may be int depending on implementation of enum */ struct language_node *last_node = 0; char phrase[256]; char used_by[256]; char base_language_name_code[256]; if (language_list) clear_language_list(language_list); language_list = 0; if (strcmp(language_name_code,"") == 0) strcpy(language_name_code,"en"); if (language_current_code) free(language_current_code); language_current_code = (char *)malloc(strlen(language_name_code) +1); strcpy(language_current_code,language_name_code); phrase_ID = LINGVO; sprintf(language_full_phrase_filename,"%s%s",program_dir,phrases_filename); if ((phrase_file = fopen(language_full_phrase_filename,"rt")) == NULL) return(0); /* Unable to open phrases file. */ language_get_available(phrase_file); rewind(phrase_file); language_load_dialects(phrase_file,language_name_code,base_language_name_code); for (phrase_ID = LINGVO ; phrase_ID < LANGUAGE_END_PHRASES; phrase_ID++) { if (!language_read_phrase(phrase_file,phrase, language_name_code,base_language_name_code,used_by)) { fclose(phrase_file); return(0); /* language read failed. */ }; if (strstr((char_8bit *)strupper((char_8bit *)used_by), (char_8bit *)strupper((char_8bit *)program_name))) { node = (struct language_node *)malloc(sizeof(struct language_node)); language_list = language_list ? language_list : node; node->phrase_ID = phrase_ID; node->phrase = (char *)malloc(strlen(phrase)+1); strcpy(node->phrase,phrase); node->right = 0; if (last_node) last_node->right = node; last_node = node; } }; fclose(phrase_file); return(1); } /* This function should be called near the beginning of the program. None of the other functions must be called before this function. */ #if defined(__STDC__) || defined(__cplusplus) int language_init(char *language_name_code,char *program_name,char *program_dir, char *phrases_filename) #else int language_init(language_name_code,program_name,program_dir,phrases_filename) char *language_name_code; char *program_name; char *program_dir; char *phrases_filename; #endif { int langloadresult; language_list = 0; langloadresult = language_load( language_name_code, program_name,program_dir,phrases_filename); return(langloadresult); } /* This function should be called near the end of the program. It deallocates the memory used by the translation list. */ #if defined(__STDC__) || defined(__cplusplus) void language_end(void) #else void language_end() #endif { clear_language_list(language_list); } #endif static char L_unable_to_translate_str[] = "???"; static char L_blank_str[] = " "; /* translate() is used in place of literal strings. The programmer should not modify the returned string; if the string must be modified, strcpy the string into a separate buffer. */ #if defined(__STDC__) || defined(__cplusplus) char *translate(long phrase_ID) #else char *translate(phrase_ID) long phrase_ID; #endif { #ifdef HARDCODE_PHRASES return(translate_to(phrase_ID,language_curr_number)); #else struct language_node *curr; static char *translation; for (curr = language_list; curr && (curr->phrase_ID != phrase_ID); curr = curr->right) ; /* <- Yes semicolon here! */ if (curr) translation = curr->phrase; else translation = L_unable_to_translate_str; if (translation[0] == '_') translation = L_blank_str; return(translation); #endif } /*Remove_tilde removes tilde characters from the phrase string. and places the result in newphrase. A pointer to newphrase is returned. The program must provide a sufficiently sized buffer to store newphrase. Tilde characters are used in TurboVision to highlight text in gadgets. */ #if defined(__STDC__) || defined(__cplusplus) char *remove_tilde(char *phrase, char *newphrase) #else char *remove_tilde(phrase, newphrase) char *phrase; char *newphrase; #endif { int i; int j = 0; for (i = 0; i < strlen(phrase);i++) if (phrase[i] != '~') newphrase[j++] = phrase[i]; newphrase[j] = 0; return(newphrase); } #if defined(__STDC__) || defined(__cplusplus) void language_list_available(FILE *dest) #else void language_list_available(dest) FILE *dest; #endif { #ifdef HARDCODE_PHRASES int i; for (i = 0; i < language_num_languages; i++) fprintf(dest,"%s %s\n",language_codes[i],language_translations[0][i]); #else char in_line[255]; FILE *phrase_file; if ((phrase_file = fopen(language_full_phrase_filename,"r")) != NULL) { do { fgets(in_line,254,phrase_file); } while ((!feof(phrase_file)) || (strncmp(in_line,"LINGVO",6) != 0)); do { fgets(in_line,254,phrase_file); if (strncmp(in_line,"*/",2) != 0) fprintf(dest,"%s\n",in_line); } while ((!feof(phrase_file)) || (strncmp(in_line,"*/",2) != 0)); }; #endif } /* Given an ISO standard 2 letter language code, return the English name of the language */ #if defined(__STDC__) || defined(__cplusplus) char *language_name(char *language_name_code) #else char *language_name(language_name_code) char *language_name_code; #endif { int i; for (i = 0; i < NUM_ISO2_CODES; i++) if (strcmp(ISO2codes[i].code,language_name_code) == 0) return(ISO2codes[i].language); return(0); } #ifdef _Windows char MSW2ISO2[][3] = { "??","ar","bg","ca","zh","cs","da","de","el","en", "es","fi","fr","iw","hu","is","it","ja","ko","nl", "no","pl","pt","rm","ro","ru","sh","hr","sq","sv", "th","tu","ur","??","zh","de","en","es","fe","it", "nl","no","pt","sk","fr","fr" }; /* Given an MS Window language code, return the two digit ISO language code. */ #if defined(__STDC__) || defined(__cplusplus) char *language_MSWindows2ISO2(unsigned int windowscode) #else char *language_MSWindows2ISO2(windowscode) unsigned int windowscode; #endif { int ndx; switch (windowscode) { case 0x0401 : ndx = 1; break; /*arabic*/ case 0x0402 : ndx = 2; break; /*bulgarian*/ case 0x0403 : ndx = 3; break; /*catalan*/ case 0x0404 : ndx = 4; break; /*chinese (traditional)*/ case 0x0405 : ndx = 5; break; /*czech*/ case 0x0406 : ndx = 6; break; /*danish*/ case 0x0407 : ndx = 7; break; /*german*/ case 0x0408 : ndx = 8; break; /*greek*/ case 0x0409 : ndx = 9; break; /*english (US)*/ case 0x040A : ndx = 10; break; /*spanish (Castilian)*/ case 0x040B : ndx = 11; break; /*finnish*/ case 0x040C : ndx = 12; break; /*french*/ case 0x040D : ndx = 13; break; /*hebrew*/ case 0x040E : ndx = 14; break; /*hungarian*/ case 0x040F : ndx = 15; break; /*icelandic*/ case 0x0410 : ndx = 16; break; /*italian*/ case 0x0411 : ndx = 17; break; /*japanese*/ case 0x0412 : ndx = 18; break; /*korean*/ case 0x0413 : ndx = 19; break; /*dutch*/ case 0x0414 : ndx = 20; break; /*norwegian (bokmal)*/ case 0x0415 : ndx = 22; break; /*portuguese(brazil)*/ case 0x0417 : ndx = 23; break; /*rhaeto*/ case 0x0418 : ndx = 24; break; /*romanian*/ case 0x0419 : ndx = 25; break; /*russian*/ case 0x041A : ndx = 26; break; /*croato-serbian*/ case 0x041B : ndx = 27; break; /*slovak*/ case 0x041C : ndx = 28; break; /*albanian*/ case 0x041D : ndx = 29; break; /*swedish*/ case 0x041E : ndx = 30; break; /*thai*/ case 0x041F : ndx = 31; break; /*turkish*/ case 0x0420 : ndx = 32; break; /*urdu*/ case 0x0421 : ndx = 33; break; /*bahasa*/ case 0x0804 : ndx = 34; break; /*chinese (simplified)*/ case 0x0807 : ndx = 35; break; /*german (swiss)*/ case 0x0809 : ndx = 36; break; /*english (UK)*/ case 0x080A : ndx = 37; break; /*spanish (mexican)*/ case 0x080C : ndx = 38; break; /*french (belgian)*/ case 0x0810 : ndx = 39; break; /*italian (swiss)*/ case 0x0813 : ndx = 40; break; /*dutch (belgian)*/ case 0x0814 : ndx = 41; break; /*norwegian (Nynorsk)*/ case 0x0816 : ndx = 42; break; /*portuguese*/ case 0x081A : ndx = 43; break; /*serbo-croatian*/ case 0x0C0C : ndx = 44; break; /*french (canadian)*/ case 0x100C : ndx =45; break; /*french (swiss)*/ default : ndx = 0; break; }; return(MSW2ISO2[ndx]); } #endif age_list_available(dest) FILE *dest; #endif { #ifdef HARDCODE_PHRASES int i; for (i = 0; i < language_num_languages; i++) fprintf(dlatex2hyp/rlib/language.h000644 001017 000764 00000043000 05645340502 017053 0ustar00rnelsonfaculty000000 000000 #ifndef LANGUAGE_H #define LANGUAGE_H /* To hard code phrases in the executable: #define HARDCODE_PHRASES in your program before the #include You should use HARDCODE_PHRASES when your application consists of a single executable file in which the phrases will be used. If your application consists of several separate programs which share many of the same phrases, you should use the load phrases option. */ /* language.h This C/C++ module will help provide translation of text strings to different human languages. UNIX, AMIGADOS, and Borland C++, Both ANSI standard C or K&R function declarations are supported. Written by Roger Nelson Biological Systems Engr. Dept. Washington State University Pullman, WA 99164-6120 Comments, suggestions, questions and bug reports can be sent to: rnelson@wsuaix.csc.wsu.edu Phone: (509)335-1100 or 335-1578 (main office) Home: (509)332-8387 FAX : (509)335-2722 An equivelent module for the programming language Pascal is also available. ------- 1.00 Jan. 1993 1.01 Apr. 1993 Added support for Window PChar strings (Use Win_translate) Added remove_tilde function. 1.02 May. 1993 Just added some additional documentation. Added dialect optimization feature. Added language equivalence feature. 1.03 Spt.9 1993 Procedure declarations now support non-standard C. Fixed bug in language_load() which sometimes caused Parsing of the phrases file to be confused. 1.04 Spt.25 1993 Use of ISO standard language codes improves efficiency. New function language_name(); New function language_windows2ISO(); 1.05 Oct.19 1993 Phrases can now be hardcoded in the program for faster operations, and simpler UNIX support. In this mode language_set() replaces language_load(), language_init() and language_end(). 1.06 Feb. 1 1994 The C language library now includes the Universal character set conversion utility library. 1.07 May. 4 1994 Added include sentinel. 1.08 Oct. 6 1994 A few compiler corrections. Removed list of contries the language is used in because this is seldom used and just takes memory. Thanks to: Andreas Scherer Dipl.-Math., Stud. O.R. an der RWTH Aachen Roland-Straße 16 52070 Aachen, Deutschland (Germany) For several corrections for ANSI C++ and Amiga SAS/C++ Future plans 1. When loading the phrases file, I would like to allow the programmer to specify the name of the phrases file, so that an application could use several phrases files. This may make the phrases files easier to maintain and remove the need for the program list for each phrase. ------- OVERVIEW: This unit is a facility to provide multiple human language support. This unit differs from other similar units in the following ways. 1. All phrases for all languages are stored in a single file. This is advantageous because it is easier to maintain the phrases; when you make a change to a phrase you can easily see that you need to make the change for the other languages. Problems with this approach is that the language name tag becomes redundent. One could leave the tag off, but this could be too confusing with many languages. To resolve this problem I am using the ISO standard 2 character language code (I will replace this with the standard 3 character language codes when I get a hold of them. Another approach would be to store the phrases in seperate files and or directorys by language. That approach is advantageous in that it requires less space, but it is more difficult to maintain. Future versions of this language unit will probably offer both options. The latter approach makes it easier to exclude languages from the application software distribution 2. The phrases file itself is loaded into the program at compile time for generating the phrases ID enumeration. This makes it harder to inadvertently leave out a phrase from the phrases file and also reduces the chances of duplication. 3. When the program is compiled with HARDCODE_PHRASES #defined. The phrases are hardcoded in the executable. When this is not defined, the he phrases file may be modified by the end user for corrections and or additional localizations. This may not be desirable since the user may accidently corrupt the phrases file. 4. The format of the phrases file is very simple, making it easier to add localizations or corrections. 5. This unit is intended for 7/8-bit European like character sets. (Right to left or top to bottom orientation). However this is a simple message catalog and should work for any 7/8-bit character set language. 6. This unit allows multiple programs to share a phrases file, this cuts down on duplicatation. 7. This unit provides optimization features for dialects. Phrases are stored in the phrases file. When the program is compiled with HARDCODE_PHRASES defined to hard code the phrases in the executable, the program hcphrases must be first run to generate the file phrases.h. phrases.h must be placed in the same directory as your source code. (You don't need to put it in the directory where the language.c file resides, language.h will read phrases.h from the current working directory.) When the program is compiled to load the phrases file, the phrases file must be placed in in the same directory as the application program executables. (The phrases file must also be available to the compiler when compiling the program.) The phrases file entries each have the following format which allows for the compiler to double check the existance of a phrase so you can't inadvertantly leave out a phrase from your translations!!!! phraseID, / * programlist en English phrase es Spanish phrase it Italian phrase fr French phrase : : * / NextphrasesID, : : Note / * and * / are actually the C comment characters! The phraseID must be a unique valid Identifier and must be followed by a comma. The phraseID and comma must be on their own line. After the first comment (on the same line) is a list of all programs in which the phrase is used, only those phrases used by the program will be loaded. This is useful if your application consists of several programs, but where not all phrases are used in all the programs. Each translation must be on its own line, the name of the language must be uppercase with consistent spelling and one word. There must be only one space or one tab character seperating the language name code from the phrase. There must not be any blank lines between the * / and the next phrase ID. If the phrase is to be a null string, then use an underscore character _, Ie: EN _ LANGUAGE DIALECTS At the top of the file is a dialect equivalences list. For example: / * DIALEKTOJ es ES_CASTILLIAN ES_MEXICAN ES_COLOMBIAN fr FR_CANADIAN FR_MOROCCAN * / ^- C comment characters. This says if the language to load is ES_CASTILLIAN, read and use the Spanish phrase unless a Castilian phrases is specifically provided. The first label on the line is the base language the remaining labels are the dialects of that language. The dialects line must not exceed 256 characters a dialect can be continued on the next line with the first label repeating the base language name. For the dialect names, I would recommend composing the dialect name from the base language code and the ISO standard country code or the dialect name itself (as I have done here). some dialects already have an ISO standard language code. At this time it is not possible to make a hierachical dialect dependency. I.e. the following is NOT valid: / * DIALEKTOJ es ES_CASTILIAN ES_MEXICIAN ES_MEXICIAN ES_YUKATAN * / ^- C comment characters. ES_YUKATAN should be es If no dialects are provided, the following should appear at the top of the file: / * DIALECTOJ * / LANGUAGE EQUIVALENCES This optimization feature can be used to handle special cases of dialect variations. For example, one may have several dialects of ES (Spanish) where most phrases will be the same for most dialects, but there may be a regional variation which is the same as another regional variation, but not the same as the base language. I.e. L_a_phrase, / * MYAPP en aaaa bbbb ccc ES_COLOMBIAN=ES_MEXICIAN ES_MEXICIAN XXXXX wwww zzzz es xxxx yyyy zzzz * / ^- C comment characters so remove the space! In this case, Castialian and Peruvian will simply use the SPANISH phrase, but Mexican will have a separate phrase which will also be used by COLOMBIAN. The equivalence is used to avoid having the MEXICIAN phrase duplicated in the COLOMBIAN phrases. This may also be useful for similar languages such as Scandinavian languages or for phrases or terms which are the same no matter what the language is. THE LINGVO ENTRY The very first phrase in PHRASES.LNG must be the translation for the name of the language: LINGVO, / * PROGRAM1 PROGRAM2 en English fr Francais es Espanol it Italiano * / ^- C comment characters so remove the space! The LINGVOJ entry immediately follows the DIALEKTOJ. Footnote: 1. "dialektoj" and "lingvo" are the Esperanto words for "dialects" and "language" respectively. 2. The language name tag can be anything, but it must be uppercase. Preferably the programmer will use the ISO language codes. Tips for restarting a TurboVision application with a new application. You may want to allow the user to change the language within the application. The following example shows how to load another language when the HARDCODE_PHRASES options is NOT used. The easiest thing to do is shutdown and restart TurboVision. 1. Create a boolean variable that will be used to test for the actual exit of the application. 2. Put a while loop using this variable as the test around the application init, run and done procedures. 3. Call the language_init function near the beginning of the program. Call the language_end function near the end of the program. 4. Usually object registration for TurboVision is done in the application.init procedure. Move these registrations to a point before the exit_application loop otherwise TurboVision will complain about stream registration when init gets call more than once. 5. Provide menu options for changing the language. This may be a user preferences dialog box or submenus etc... 6. Provide an application event handler point for each language: I.e. case cmLanguageDefault : language_load(getenv("LANGUAGE"),argv_0); message(this,evCommand,cmQUIT,0); break; case cmLanguageEnglish : language_load("en",argvr_0); message(this,evCommand,cmQUIT,0); break; case cmLanguageFrench : language_load("fr",argv_0); message(this,evCommand,cmQUIT,0); break; case cmLanguageSpanish : language_load("es",argv_0); message(this,evCommand,cmQUIT,0; break; case cmLanguageItalian : language_load("it",argv_0); message(this,evCommand,cmQUIT,0); break; Where argv_0 is a char * set to argv_0 at the beginning of main. 7. When you actually want to exit the program with cmQUIT, set exit_application to TRUE: case cmExit_MyApp : exit_application = 1; message(this,evCommand,cmQUIT,0); break; 8. To use a phrase translation simply call tranlate() with the phrase_Id Ie. printf("%s (%s)",translate(L_mouse),translate(L_Not_available)); I.e. The main module of the program MYAPP would look something like this: main(int argc; char *argv[0]); { argv_0 = argv[0]; // Get the default language from the DOS environment variable LANGUAGE, // set before running the program. If the environment variable doesn't // exist, then language_init will use ENGLISH. if (!language_init(getenv("LANGUAGE"),program_dir(argv[0])),"MYAPP") { printf("Unable to open language translation file: PHRASES.LNG\n" "This file should be placed in the same directory as %s\n",argv[0]); exit(1); }; RegisterObjects; RegisterViews; RegisterMenus; RegisterDialogs; RegisterApp; RegisterHelpFile; exit_application = 0; // <- global variable while (!exit_application) { theapplication.Init; theapplication.Run; theapplication.Done; }; language_end(); }; */ #include #ifndef char_8bit #ifdef __BCPLUSPLUS__ #define char_8bit char #else #define char_8bit unsigned char #endif #endif struct ISO2coding { char *code; char *language; /* In English */ /*char *places; Countries/regions where language is used */ }; #ifdef HARDCODE_PHRASES #include "phrases.h" #else enum phrases { #include "phrases.lng" LANGUAGE_END_PHRASES }; #endif struct language_available { char *name; char *desc; struct language_available *next; }; extern struct language_available *languages_available; /* List of available languages*/ extern char *language_current_code; /* active language */ /* program_name is a fully qualified filename: i.e. C:\APPDIR\MYAPP.EXE Usually just use argv[0]. */ #if defined(__STDC__) || defined(__cplusplus) /* When using the HARDCODE_PHRASES option the function sets the language to translate to and can be called anytime as often as needed to */ #ifdef HARDCODE_PHRASES /* language_set set the current language to translate to. It is used in HARDCODE_PHRASES mode in lieu of language_init() and language_load(). language_set may be called as many times as desired any where in the program, You will want to use it at the beginning of the program. If no language is set, the first language in the LINGVO entry is used. Therefore, if you want the default language to be English, English should be the first entry in the LINGVO entry. */ extern int language_set(char *language_name); #else /* language_init should be called near the beginning of the program. None of the other functions must be called before this function. This function must only be called once. */ extern int language_init (char *language_name, char *program_name, char *program_dir, char *phrases_filename); /* language_load is usually used internally by language_init(), but may be used by the programmer to allow the user to change the language on the fly. language_load returns 1 if the translations loaded successfully 0 if the file is not found or corrupt. */ extern int language_load (char *language_name, char *program_name, char *program_dir, char *phrases_filename); /* language_end should be called near the end of the program. It deallocates the memory used by the translation list. This function must only be called once. */ extern void language_end(void); #endif /* translate() is used in place of literal strings. The programmer should not modify the returned string; if the string must be modified, strcpy the string into a seperate buffer. */ extern char *translate(long phrase_ID); /*Remove_tilde removes tilde characters from the phrase string. and places the result in newphrase. A pointer to newphrase is returned. The program must provide a sufficiently sized buffer to store newphrase. Tilde characters are used in TurboVision to highlight text in gadgets. */ extern char *remove_tilde(char *phrase, char *newphrase); /* language_list_available lists the codes/names for the languages and dialects available in the file to the provided output file. Normally this function can be called on stdout or stderr to display the languages to choose from, and the program may then prompt the user to enter the code for the language to use. When using HARDCODE_PHRASES, the language_init must be called first! */ void language_list_available(FILE *dest); /* Given an ISO standard 2 letter language code, return the English name of the language */ extern char *language_name(char *language_name_code); #ifdef _Windows /* Given an MS Window language code, return the two digit ISO language code. */ extern char *language_MSWindows2ISO2(unsigned int windowscode); #endif #else extern int language_init(); #ifndef HARDCODE_PHRASES extern int language_load(); extern void language_end(); #endif extern char *translate(); extern char *remove_tilde(); extern char *language_name(); extern void language_list_available(); #ifdef _Windows /* Given an MS Window language code, return the two digit ISO language code.*/ extern char *language_MSWindows2ISO2(); #endif #endif #endif latex2hyp/rlib/rlib.c000644 001017 000764 00000002477 05645346143 016237 0ustar00rnelsonfaculty000000 000000 #ifndef RLIB_H #define RLIB_H #include #include #include #ifdef __MSDOS__ char RLIB_program_drive[MAXDRIVE]; char RLIB_program_directory[MAXDIR]; char RLIB_program_name[MAXFILE]; #endif char RLIB_program_path[MAXPATH]; #if defined(__STDC__) || defined(__cplusplus) void RLIB_start(char *program_full_path_file) #else void RLIB_start(program_full_path_file) char *program_full_path_file; #endif { #ifdef __MSDOS__ char fname[MAXFILE]; char fext[MAXEXT]; fnsplit(program_full_path_file,RLIB_program_drive,RLIB_program_directory,fname,fext); strcpy(RLIB_program_name,fname); strcat(RLIB_program_name,fext); strcpy(RLIB_program_path,RLIB_program_drive); strcat(RLIB_program_path,RLIB_program_directory); #else /* UNIX and AmigaDos */ int i; int lastslash=0; RLIB_program_path[0] = 0; for (i = 0; i < strlen(program_full_path_file); i++) lastslash = (program_full_path_file[i] == 47) #ifdef amiga || (program_full_path_file[i] == ':') #endif ? i : lastslash; for (i = 0; i <= lastslash; i++) RLIB_program_path[i] = program_full_path_file[i]; #endif }; char *float2str(float value, int decimals) { static char valuestr[30]; sprintf(valuestr,"%.*f",decimals,value); return(valuestr); }; #endif d RLIB_start(char *program_full_path_file) #else void RLIB_start(program_full_path_file) char *program_full_path_file; #endif { #ifdef __MSDOS__ char fname[MAXFILE]; char fext[MAXEXT]latex2hyp/rlib/rlib.h000644 001017 000764 00000001206 05645346132 016227 0ustar00rnelsonfaculty000000 000000 #include #ifdef __MSDOS__ /* Avoid using these two for UNIX and AMIGADOS compatibility */ extern char RLIB_program_drive[MAXDRIVE]; /* drive designator */ extern char RLIB_program_directory[MAXDIR]; /* W/O drive designator */ extern char RLIB_program_name[MAXFILE]; #else #define MAXPATH 255 #endif extern char RLIB_program_path[MAXPATH]; /* With drive designator */ /* Includes final slash (and or : in AmigaDOS) */ extern void RLIB_start(char *program_full_path_file); extern char *float2str(float value, int decimals); Rawisuda Senavatin/u2/wsuaix/i9804179/usr/bin/csh)¿mcgrew*GôTimothy McGrew/u2/wsuaix/mcgrew/usr/bin/cshmcgrewi9494799*(0'Chih Chao Yeh/u/wsuaix/i9494799/bin/cshi9494799rnelson*ôroger nelson/u/wsuaix/rnelson/bin/cshjpan*àÐjianping pan/u/wsuaix/jpan/bin/cshjpanjpeterse*õôJames Petersen - faculatex2hyp/rlib/ucscu.c000644 001017 000764 00000272454 05645340530 016427 0ustar00rnelsonfaculty000000 000000 /* Universal character set conversion utility ucscu.c To compile on most systems: #define UCSCU_STANDALONE cc -o ucscu ucscu.c When compiled as a standalone program, it reads a text file and converts characters from one character set to another. When compiled as a library (STANDALONE not defined) the following functions are available: UCSCU_file() Converts file just like standalone. UCSCU_string() Converts the character string. UCSCU_char() Given a UCSCU symbol code, returns the character string to draw the symbol. UCSCU_prompt_input_options() Prompts the user for input options. UCSCU_prompt_output_options() Prompts the user for output options. UCSCU_prompt_options() Prompts user for both I/O options. UCSCU_init() Must be called once before using UCSCU_string, UCSCU_char, or UCSCU_file if UCSCU_prompt_options. If prompting user for just input or just output options, then UCSCU_init must be called before calling the UCSCU_prompt_xxx_options(). This program is freely distributable, but not in the Public Domain. Do not distribute MODIFIED versions of this program; however, feel free to incorporate portions of this program in your own software. I reserve all rights in the distribution of the program. Please send me your modifications for incorporation in future versions. The file should be UUENCODE or transfered in BINARY mode, because it contains 8-bit characters (only in comments)! Written by Roger Nelson Biological Systems Engr. Dept. Washington State University Pullman, WA 99164-6120 rnelson@wsuaix.csc.wsu.edu Phone: (509)335-1100 or 335-1578 (main office) Home: (509)332-8387 FAX : (509)335-2722 Version 0.0 Jul 25 '93 1.0 Aug 30 '93 -INPUT/-OUTPUT in docs should read INPUT/OUTPUT. End of file character was inserted into text. Significantly faster operation. 1.01 Oct 3 '94 Some corrections for strict C/C++ compilers Thanks to: Hermann Hueni Seidenweg 40, CH-3012 Bern, +41 31 234 607 GLUE Software Engineering, Seidenweg 5, CH-3012 Bern, +41 33 457 888 e-mail: hueni@iam.unibe.ch +41 31 248 362 For suggestions and bug fixes Andreas Scherer Dipl.-Math., Stud. O.R. an der RWTH Aachen Roland-Straße 16 52070 Aachen, Deutschland (Germany) For German translation and several corrections for ANSI C++ and Amiga SAS/C++ */ #include #include /* may be on some systems */ #include #include #ifdef UCSCU_STANDALONE #include "ucscu.h" #else #include #endif #define UCSCU_FAILED 1 #define UCSCU_SUCCEEDED 0 /* VMS users should #define VMS */ /* #define VMS */ /* MSDOS (and probably OS2 users should already have __MSDOS__ defined by the compiler otherwise it needs to be defined*/ /* #define __MSDOS__ */ #ifdef __cplusplus #ifndef __STDC__ #define __STDC__ #endif #endif #ifdef __MSDOS__ #define WRITEMODE "wt" #define READMODE "rt" #else #define WRITEMODE "w" #define READMODE "r" #endif /* 7Bit ASCII/ISO character sets: */ #define CS_NONE -1 #define CS_ENGLISH7 0 #define CS_GERMAN7 1 /* Also Austrian */ #define CS_DUTCH7 2 #define CS_FRENCH7 3 #define CS_SWEDISH7 4 #define CS_NORDIC7 5 /* Norwegian and Danish */ #define CS_ITALIAN7 6 #define CS_SPANISH7 7 #define CS_PORTUGUESE7 8 #define CS_FINNISH7 9 #define CS_BELGIAN7 10 /* Belgian french and flemmish */ #define CS_SWISS7 11 #define CS_TeX 100 /* To output TeX symbols */ /* Do the following character sets exists? others? #define CS_GREEK7 #define CS_CHECH7 #define CS_SLOVAK7 #define CS_HUNGARIAN7 #define CS_POLISH7 #define CS_YUGOSLAVIAN7 */ /* 8bit character sets */ #define CS_PC8 0 /* English IBM-PC also known as */ #define CS_MNCS 1 /* Multinational caracter set */ #define CS_DEC8 1 /* Identical to MNCS except 215 is OE and 247 is oe and DEC doesn't define several*/ #define CS_ECMA94 1 /* Identical to MNCS */ #define CS_AMIGA 1 /* Identical to MNCS */ #define CS_ROMAN8 2 /* Most English HP */ #define CS_EPSON8 3 /* Most Epson compatible printers */ #define CS_PC850 4 /* MS-DOS PC Multilingual (Latin 1) */ #define CS_PC852 5 /* IBM-PC-852 Slavic (Latin I) */ #define CS_PC860 6 /* IBM-PC-860 Portuguese */ #define CS_PC863 7 /* IBM-PC-863 Canadian-French */ #define CS_PC865 8 /* IBM-PC-865 Nordic */ #define CS_PC8DN 9 /* Denmark/Norway IBM-PC8*/ #define CS_QUME 10 #define CS_TOSHIBA_1340 10 #define CS_QUME_SPRINT_11 10 #define CS_DIABLO_630 10 /* Backspacing options in generating ASCII representation:*/ #define BS_NORMAL 0 /* output entire string */ #define BS_NEVER 1 /* Only print first character */ #define BS_NOT_CAP 2 /* Backspace only on lower case characters */ #define BS_OMIT 3 /* Add diacritical marks, but leave out BS */ #define GR_NORMAL 0 /* output entire string */ #define GR_MARK 1 /* use maker character underscore */ #define GR_NONE 2 /* use space */ #define UNKNOWN_MARKER '?' struct UCSCU_options { char *filename; FILE *file; int bit7_CS; int bit8_CS; }; struct UCSCU_modes { int quiet; /* 0 */ int prefer_7bit; /* 0 */ int backspacing; /* BS_NORMAL*/ int graphics; /* GR_NORMAL*/ }; struct UCSCU_options UCSCU_input_option; struct UCSCU_options UCSCU_output_option; struct UCSCU_modes UCSCU_output_mode; int UCSCU_line_count = 0; int UCSCU_do_direct_conversion = 1; /* If you wish to provide me with a character set to add to this utility, Please provide me with the following information: The name of the character set. The countries / situation where the character set is used. If it is specified to a certian model of computer/terminal/printer etc.. Send me a copy of the following enumeration where the character code is append to the respective line. Delete lines where there is no code for the named character in the character set. If there are new characters and/or symbols or diacritical marks that need to be added. Highlight any lines you add with an * and give a brief description of the character/symbol. */ /* The leading \ is not included in the TeX string */ struct UCSCU_TeX_layout UCSCU_TeX_table[] = { {"b{a}", a_underlined}, {"b{o}", o_underlined}, {"`{A}", A_grave}, {"'{A}", A_acute}, {"^{A}", A_circumflex}, {"~{A}", A_tilde}, {"\"{A}", A_diaeresis}, {"o{A}", A_circle}, {"t{AE}", A_E}, {"c{C}", C_cedilla}, {"`{E}", E_grave}, {"'{E}", E_acute}, {"^{E}", E_circumflex}, {"\"{E}", E_diaeresis}, {"`{I}", I_grave}, {"'{I}", I_acute}, {"^{I}", I_circumflex}, {"\"{I}", I_diaeresis}, {"~{N}", N_tilde}, {"`{O}", O_grave}, {"'{O}", O_acute}, {"^{O}", O_circumflex}, {"~{O}", O_tilde}, {"\"{O}", O_diaeresis}, {"t{OE}", O_E}, {"`{U}", U_grave}, {"'{U}", U_acute}, {"^{U}", U_circumflex}, {"\"{U}", U_diaeresis}, {"\"{Y}", Y_diaeresis}, {"`{a}", a_grave}, {"'{a}", a_acute}, {"^{a}", a_circumflex}, {"~{a}", a_tilde}, {"\"{a}", a_diaeresis}, {"o{a}", a_circle}, {"t{a}", a_e}, {"t{ae}", a_e}, {"c{c}", c_cedilla}, {"`{e}", e_grave}, {"'{e}", e_acute}, {"^{e}", e_circumflex}, {"\"{e}", e_diaeresis}, {"`{i}", i_grave}, {"'{i}", i_acute}, {"^{i}", i_circumflex}, {"\"{i}", i_diaeresis}, {"~{n}", n_tilde}, {"`{o}", o_grave}, {"'{o}", o_acute}, {"^{o}", o_circumflex}, {"~{o}", o_tilde}, {"\"{o}", o_diaeresis}, {"t{oe}", o_e}, {"`{u}", u_grave}, {"'{u}", u_acute}, {"^{u}", u_circumflex}, {"\"{u}", u_diaeresis}, {"\"{y}", y_diaeresis}, /* Abbreviated tex forms.*/ {"ba", a_underlined}, {"bo", o_underlined}, {"`A", A_grave}, {"'A", A_acute}, {"^A", A_circumflex}, {"~A", A_tilde}, {"\"A", A_diaeresis}, {"oA", A_circle}, {"tA", A_E}, {"cC", C_cedilla}, {"`E", E_grave}, {"'E", E_acute}, {"^E", E_circumflex}, {"\"E", E_diaeresis}, {"`I", I_grave}, {"'I", I_acute}, {"^I", I_circumflex}, {"\"I", I_diaeresis}, {"~N", N_tilde}, {"`O", O_grave}, {"'O", O_acute}, {"^O", O_circumflex}, {"~O", O_tilde}, {"\"O", O_diaeresis}, {"tO", O_E}, {"`U", U_grave}, {"'U", U_acute}, {"^U", U_circumflex}, {"\"U", U_diaeresis}, {"\"Y", Y_diaeresis}, {"`a", a_grave}, {"'a", a_acute}, {"^a", a_circumflex}, {"~a", a_tilde}, {"\"a", a_diaeresis}, {"oa", a_circle}, {"ta", a_e}, {"cc", c_cedilla}, {"`e", e_grave}, {"'e", e_acute}, {"^e", e_circumflex}, {"\"e", e_diaeresis}, {"`i", i_grave}, {"'i", i_acute}, {"^i", i_circumflex}, {"\"i", i_diaeresis}, {"~n", n_tilde}, {"`o", o_grave}, {"'o", o_acute}, {"^o", o_circumflex}, {"~o", o_tilde}, {"\"o", o_diaeresis}, {"to", o_e}, {"`u", u_grave}, {"'u", u_acute}, {"^u", u_circumflex}, {"\"u", u_diaeresis}, {"\"y", y_diaeresis}, {"dag", SYM_daggar}, {"ddag", SYM_double_daggar}, {"paragraph", SYM_paragraph}, {"copyright", SYM_copyright}, {"pounds", SYM_pounds}, {"section", SYM_section}, {"", UCSCU_END_TABLE}, }; /* The leading \ is not included in the TeX string */ struct UCSCU_HTML_layout UCSCU_HTML_table[] = { /* {"b{a}", a_underlined}, */ /* {"b{o}", o_underlined}, */ {"À", A_grave}, {"Á", A_acute}, {"Â", A_circumflex}, {"Ã", A_tilde}, {"Ä", A_diaeresis}, {"Å", A_circle}, {"Æ", A_E}, {"Ç", C_cedilla}, {"È", E_grave}, {"&Eecute;", E_acute}, {"Ê", E_circumflex}, {"Ë", E_diaeresis}, {"Ì", I_grave}, {"Í", I_acute}, {"Î", I_circumflex}, {"Ï", I_diaeresis}, {"Ñ", N_tilde}, {"Ò", O_grave}, {"Ó", O_acute}, {"Ô", O_circumflex}, {"Õ", O_tilde}, {"Ö", O_diaeresis}, {"Œ", O_E}, {"Ù", U_grave}, {"Ú", U_acute}, {"Û", U_circumflex}, {"Ü", U_diaeresis}, {"Ÿ", Y_diaeresis}, {"à", a_grave}, {"á", a_acute}, {"â", a_circumflex}, {"ã", a_tilde}, {"ä", a_diaeresis}, {"&oring;", a_circle}, {"æ", a_e}, {"ç", c_cedilla}, {"è", e_grave}, {"é", e_acute}, {"ê", e_circumflex}, {"ë", e_diaeresis}, {"ì", i_grave}, {"í", i_acute}, {"î", i_circumflex}, {"ï", i_diaeresis}, {"ñ", n_tilde}, {"ò", o_grave}, {"ó", o_acute}, {"ô", o_circumflex}, {"õ", o_tilde}, {"ö", o_diaeresis}, {"œ", o_e}, {"Ø", O_slash}, {"ø", o_slash}, {"ù", u_grave}, {"ú", u_acute}, {"û", u_circumflex}, {"ü", u_diaeresis}, {"ÿ", y_diaeresis}, {"ß", B_german_S}, {"dag", SYM_daggar}, {"ddag", SYM_double_daggar}, {"paragraph", SYM_paragraph}, {"copyright", SYM_copyright}, {"pounds", SYM_pounds}, {"section", SYM_section}, {"", UCSCU_END_TABLE}, }; /* In the ASCII representations, the following characters will be replaced by the respective diacritical marks in the target character set ' acute ` grave ~ tilde - - ^ cicumflex @ circle / virgule = macron _ _ " diaeresis u breve v chz ( I don't know what this is called (upsidedown circumflex) * acuteacute , cedilla . tail (backwards cedilla or ognok) */ #define UCSCU_END_TABLE 0 struct bit8_layout { int symbol; char *ASCII; char_8bit codes[11]; }; struct bit8_layout bit8_table[] = { /* / IBM-PC CSs \ */ /* ASCII IBM-PC8 DEC-MNCS Roman-8 Epson-8 850 852 860 863 865 DN QUME*/ {A_acute ,"A\b'" ,{ 0 ,192/*À*/,224/*¡*/,192/*À*/,181,181,134, 0 , 0 , 0 , 0 },}, {a_acute ,"a\b'" ,{160/* */,225/*á*/,196/*Ä*/,196/*Ä*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {A_breve ,"A\bu" ,{ 0 , 0 , 0 , 0 , 0 ,198, 0 , 0 , 0 , 0 , 0 },}, {a_breve ,"a\bu" ,{ 0 , 0 , 0 , 0 , 0 ,199, 0 , 0 , 0 , 0 , 0 },}, {A_tail ,"A\b." ,{ 0 , 0 , 0 , 0 , 0 ,164, 0 , 0 , 0 , 0 , 0 },}, {a_tail ,"a\b." ,{ 0 , 0 , 0 , 0 , 0 ,165, 0 , 0 , 0 , 0 , 0 },}, {A_circle ,"A\b@" ,{143/**/,197/*Å*/,208/*Ð*/,177/*±*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {a_circle ,"a\b@" ,{134/*†*/,229/*å*/,212/*Ô*/, 0 /*a*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {A_circumflex ,"A\b^" ,{ 0 ,194/*Â*/,162/*¢*/,192/*À*/,182,182,143,132, 0 , 0 , 0 },}, {a_circumflex ,"a\b^" ,{131/*ƒ*/,226/*â*/,192/*À*/,196/*Ä*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {A_diaeresis ,"A\b\"" ,{142/*Ž*/,196/*Ä*/,216/*Ø*/,209/*Ñ*/, 0 , 0 , 0 , 0 , 0 , 0 ,177},}, {a_diaeresis ,"a\b\"" ,{132/*„*/,228/*ä*/,204/*Ì*/,214/*Ö*/, 0 , 0 , 0 , 0 , 0 , 0 ,182},}, {A_E ,"AE" ,{146/*’*/,198/*Æ*/,211/*Ó*/, 0 /*A*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {a_e ,"ae" ,{145/*‘*/,230/*æ*/,215/*×*/, 0 /*a*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {A_grave ,"A\b`" ,{ 0 ,193/*Á*/,161/*¡*/,192/*À*/,183,183,145,142, 0 , 0 , 0 },}, {a_grave ,"a\b`" ,{133/*…*/,224/*à*/,200/*È*/,193/*Á*/, 0 , 0 , 0 , 0 , 0 , 0 ,161},}, {A_macron ,"A\b=" ,{ 0 , 0 , 0 ,192/*À*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {a_macron ,"a\b=" ,{ 0 , 0 , 0 ,196/*À*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {A_tilde ,"A\b~" ,{ 0 ,195/*Ã*/,225/*á*/,192/*À*/, 0 , 0 ,142, 0 , 0 ,170, 0 },}, {a_tilde ,"a\b~" ,{ 0 ,227/*ã*/,226/*â*/,196/*Ä*/, 0 , 0 ,132, 0 , 0 ,169, 0 },}, {a_underlined ,"a\b_" ,{166/*¦*/,170/*ª*/,249/*ù*/, 0 /*a*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {B_german_S ,"B" ,{225/*á*/,223 , 0 ,217 ,225,225, 0 , 0 , 0 , 0 ,185},}, {C_acute ,"C\b'" ,{ 0 , 0 , 0 , 0 , 0 ,143, 0 , 0 , 0 , 0 , 0 },}, {c_acute ,"c\b'" ,{ 0 , 0 , 0 , 0 , 0 ,134, 0 , 0 , 0 , 0 , 0 },}, {C_backwards ," " ,{ 0 , 0 , 0 ,189 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {C_chz ,"C\b^" ,{ 0 , 0 , 0 , 0 , 0 ,172, 0 , 0 , 0 , 0 , 0 },}, {c_chz ,"c\b^" ,{ 0 , 0 , 0 , 0 , 0 ,159, 0 , 0 , 0 , 0 , 0 },}, {C_cedilla ,"C\b," ,{128/*€*/,199/*Ç*/,180/*´*/,194/*Â*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {c_cedilla ,"c\b," ,{135/*‡*/,231/*ç*/,181/*µ*/, 0 /*c*/, 0 , 0 , 0 , 0 , 0 , 0 ,162},}, {D_bar ,"D\b-" ,{ 0 ,240 ,227/*ã*/, 0 ,209,209, 0 , 0 , 0 , 0 , 0 },}, {d_bar ,"d\b-" ,{ 0 , 0 ,228/*ä*/, 0 ,208,208, 0 , 0 , 0 , 0 , 0 },}, {D_chz ,"D\b^" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {d_chz ,"d\b^" ,{ 0 , 0 , 0 , 0 , 0 ,212, 0 , 0 , 0 , 0 , 0 },}, {E_acute ,"E\b'" ,{144/**/,201/*É*/,220/*Ü*/,202/*Ê*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {e_acute ,"e\b'" ,{130/*‚*/,233/*é*/,197/*Å*/,219/*Û*/, 0 , 0 , 0 , 0 , 0 , 0 ,187},}, {E_breve ,"E\bu" ,{ 0 ,202/*Ê*/,164/*¤*/,202/*Ê*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {e_breve ,"e\bu" ,{ 0 ,234 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {E_chz ,"E\b^" ,{ 0 ,202/*Ê*/,164/*¤*/,202/*Ê*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {e_chz ,"e\b^" ,{ 0 ,234 , 0 , 0 , 0 ,216, 0 , 0 , 0 , 0 , 0 },}, {E_tail ,"E\b." ,{ 0 , 0 , 0 , 0 , 0 ,168, 0 , 0 , 0 , 0 , 0 },}, {e_tail ,"e\b." ,{ 0 , 0 , 0 , 0 , 0 ,169, 0 , 0 , 0 , 0 , 0 },}, {E_circumflex ,"E\b^" ,{ 0 ,202/*Ê*/,164/*¤*/,202/*Ê*/,210, 0 ,138,146, 0 , 0 , 0 },}, {e_circumflex ,"e\b^" ,{136/*ˆ*/,234/*ô*/,193/*Á*/,218/*Ú*/, 0 , 0 ,137, 0 , 0 , 0 , 0 },}, {E_diaeresis ,"E\b\"" ,{ 0 ,203/*Ë*/,165/*¥*/,202/*Ê*/,211,211, 0 ,148, 0 , 0 , 0 },}, {e_diaeresis ,"e\b\"" ,{137/*‰*/,235/*ë*/,205/*Í*/, 0 /*e*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {E_grave ,"E\b`" ,{ 0 ,200/*È*/,163/*£*/,202/*Ê*/,212, 0 ,146,145, 0 , 0 , 0 },}, {e_grave ,"e\b`" ,{138/*Š*/,232/*è*/,201/*É*/,221/*Ý*/, 0 , 0 , 0 , 0 , 0 , 0 ,189},}, {E_macron ,"E\b=" ,{ 0 , 0 , 0 ,202 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {e_macron ,"E\b=" ,{ 0 , 0 , 0 ,218 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {I_acute ,"I\b'" ,{ 0 ,205/*Í*/,229/*å*/, 0 /*I*/,214,214, 0 , 0 , 0 , 0 , 0 },}, {i_acute ,"i\b'" ,{161/*¡*/,237/*í*/,213/*Õ*/, 0 /*i*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {I_circumflex ,"I\b^" ,{ 0 ,206/*Î*/,166/*¦*/, 0 /*I*/,215,215, 0 ,168, 0 , 0 , 0 },}, {i_circumflex ,"i\b^" ,{140/*Œ*/,238/*î*/,209/*Û*/, 0 /*i*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {I_diaeresis ,"I\b\"" ,{ 0 ,207/*Ï*/,167/*§*/, 0 /*I*/,216, 0 , 0 ,149, 0 , 0 , 0 },}, {i_diaeresis ,"i\b\"" ,{139/*‹*/,239/*ï*/,221/*Ý*/, 0 /*i*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {I_grave ,"I\b`" ,{ 0 ,204/*Ì*/,230/*æ*/, 0 /*I*/,222, 0 ,152, 0 , 0 , 0 , 0 },}, {i_grave ,"i\b`" ,{141/**/,236/*ì*/,217/*Ù*/, 0 /*i*/, 0 , 0 ,139, 0 , 0 , 0 , 0 },}, {I_P ,"I\bP" ,{ 0 ,222 , 0 ,217 ,231, 0 , 0 , 0 , 0 , 0 , 0 },}, {I_p ,"I\bp" ,{ 0 ,254 , 0 ,217 ,232, 0 , 0 , 0 , 0 , 0 , 0 },}, {i_j ,"ij" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {J_circumflex ,"J\b^" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {j_circumflex ,"j\b^" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {H_circumflex ,"H\b^" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {h_circumflex ,"h\b^" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {L_acute ,"L\b'" ,{ 0 , 0 , 0 , 0 , 0 ,145, 0 , 0 , 0 , 0 , 0 },}, {l_acute ,"l\b'" ,{ 0 , 0 , 0 , 0 , 0 ,146, 0 , 0 , 0 , 0 , 0 },}, {L_chz ,"L\bv" ,{ 0 , 0 , 0 , 0 , 0 ,149, 0 , 0 , 0 , 0 , 0 },}, {l_chz ,"l\bv" ,{ 0 , 0 , 0 , 0 , 0 ,150, 0 , 0 , 0 , 0 , 0 },}, {L_slash ,"L\b/" ,{ 0 , 0 , 0 , 0 , 0 ,157, 0 , 0 , 0 , 0 , 0 },}, {l_slash ,"l\b/" ,{ 0 , 0 , 0 , 0 , 0 ,136, 0 , 0 , 0 , 0 , 0 },}, {L_dot ,"L" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,158, 0 },}, {l_dot ,"l" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,159, 0 },}, {N_acute ,"N\b'" ,{ 0 , 0 , 0 , 0 , 0 ,227, 0 , 0 , 0 , 0 , 0 },}, {n_acute ,"n\b'" ,{ 0 , 0 , 0 , 0 , 0 ,228, 0 , 0 , 0 , 0 , 0 },}, {N_chz ,"N\bv" ,{ 0 , 0 , 0 , 0 , 0 ,213, 0 , 0 , 0 , 0 , 0 },}, {n_chz ,"n\bv" ,{ 0 , 0 , 0 , 0 , 0 ,229, 0 , 0 , 0 , 0 , 0 },}, {N_tilde ,"N\b~" ,{165/*¥*/,209/*Ñ*/,182/*¶*/,213/*Õ*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {n_tilde ,"n\b~" ,{164/*¤*/,241/*ñ*/,183/*·*/,222/*Þ*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {O_acuteacute ,"O\b*" ,{ 0 , 0 , 0 , 0 , 0 ,138, 0 , 0 , 0 , 0 , 0 },}, {o_acuteacute ,"o\b*" ,{ 0 , 0 , 0 , 0 , 0 ,139, 0 , 0 , 0 , 0 , 0 },}, {O_acute ,"O\b'" ,{ 0 ,211/*Ó*/,231/*ç*/, 0 /*O*/,224,224,157, 0 , 0 , 0 , 0 },}, {o_acute ,"o\b'" ,{162/*¢*/,243/*ó*/,198/*Æ*/, 0 /*o*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {O_circumflex ,"O\b^" ,{ 0 ,212/*Ô*/,223/*ß*/, 0 /*O*/,226,226,140,153, 0 , 0 , 0 },}, {o_circumflex ,"o\b^" ,{147/*“*/,244/*ô*/,194/*Â*/, 0 /*o*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {O_diaeresis ,"O\b\"" ,{153/*™*/,214/*Ö*/,218/*Ú*/,210/*Ò*/, 0 , 0 , 0 , 0 , 0 , 0 ,178},}, {o_diaeresis ,"o\b\"" ,{148/*”*/,246/*ö*/,206/*Î*/,215/*×*/, 0 , 0 , 0 , 0 , 0 , 0 ,183},}, {O_E ,"OE" ,{ 0 ,215 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {o_e ,"oe" ,{ 0 ,247 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {O_grave ,"O\b`" ,{ 0 ,210/*Ò*/,223/*ß*/, 0 /*O*/,227, 0 ,169, 0 , 0 , 0 , 0 },}, {o_grave ,"o\b`" ,{149/*•*/,242/*ò*/,202/*Ê*/, 0 /*o*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {O_slash ,"O\b/" ,{237/*í*/,215/*×*/,210/*Ò*/, 0 /*O*/,157, 0 , 0 , 0 ,157,157, 0 },}, {o_slash ,"o\b/" ,{ 0 ,247/*÷*/,214/*Ö*/,178/*²*/,155, 0 , 0 , 0 ,155,155, 0 },}, {O_tilde ,"O\b~" ,{ 0 ,213/*Õ*/,233/*é*/, 0 /*O*/,229, 0 ,153, 0 , 0 ,166, 0 },}, {o_tilde ,"o\b~" ,{ 0 ,245/*õ*/,234/*ê*/, 0 /*o*/,228, 0 ,148, 0 , 0 ,167, 0 },}, {o_underlined ,"o\b_" ,{167/*§*/,186/*º*/,250/*ú*/, 0 /*o*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {R_acute ,"R\b'" ,{ 0 , 0 , 0 , 0 , 0 ,232, 0 , 0 , 0 , 0 , 0 },}, {r_acute ,"r\b'" ,{ 0 , 0 , 0 , 0 , 0 ,234, 0 , 0 , 0 , 0 , 0 },}, {R_chz ,"R\bv" ,{ 0 , 0 , 0 , 0 , 0 ,252, 0 , 0 , 0 , 0 , 0 },}, {r_chz ,"r\bv" ,{ 0 , 0 , 0 , 0 , 0 ,253, 0 , 0 , 0 , 0 , 0 },}, {S_acute ,"S\b'" ,{ 0 , 0 , 0 , 0 , 0 ,151, 0 , 0 , 0 , 0 , 0 },}, {s_acute ,"s\b'" ,{ 0 , 0 , 0 , 0 , 0 ,152, 0 , 0 , 0 , 0 , 0 },}, {S_cedilla ,"S\b," ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {s_cedilla ,"s\b," ,{ 0 , 0 , 0 , 0 , 0 ,173, 0 , 0 , 0 , 0 , 0 },}, {S_tail ,"S\b." ,{ 0 , 0 , 0 , 0 , 0 ,184, 0 , 0 , 0 , 0 , 0 },}, {s_tail ,"s\b." ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {S_circumflex ,"S\b^" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {s_circumflex ,"s\b^" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {S_breve ,"S\bu" ,{ 0 , 0 ,235/*ë*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {s_breve ,"s\bu" ,{ 0 , 0 ,236/*ì*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {S_chz ,"S\bv" ,{ 0 , 0 , 0 , 0 , 0 ,230, 0 , 0 , 0 , 0 , 0 },}, {s_chz ,"s\bv" ,{ 0 , 0 , 0 , 0 , 0 ,231, 0 , 0 , 0 , 0 , 0 },}, {T_cedilla ,"T\b," ,{ 0 , 0 , 0 , 0 , 0 ,221, 0 , 0 , 0 , 0 , 0 },}, {t_cedilla ,"t\b," ,{ 0 , 0 , 0 , 0 , 0 ,238, 0 , 0 , 0 , 0 , 0 },}, {T_chz ,"T\bv" ,{ 0 , 0 , 0 , 0 , 0 ,155, 0 , 0 , 0 , 0 , 0 },}, {t_chz ,"t\bv" ,{ 0 , 0 , 0 , 0 , 0 ,156, 0 , 0 , 0 , 0 , 0 },}, {U_acute ,"U\b'" ,{ 0 ,218/*Ú*/,237/*í*/, 0 /*U*/,233,223,150,151, 0 , 0 , 0 },}, {u_acute ,"u\b'" ,{163/*£*/,250/*ú*/,199/*Ç*/,220/*Ü*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {U_acuteacute ,"U\b*" ,{ 0 , 0 , 0 , 0 , 0 ,235, 0 , 0 , 0 , 0 , 0 },}, {u_acuteacute ,"u\b*" ,{ 0 , 0 , 0 , 0 , 0 ,251, 0 , 0 , 0 , 0 , 0 },}, {U_breve ,"U\bu" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {u_breve ,"u\bu" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {U_circle ,"U\b@" ,{ 0 , 0 , 0 , 0 , 0 ,222, 0 , 0 , 0 , 0 , 0 },}, {u_circle ,"u\b@" ,{ 0 , 0 , 0 , 0 , 0 ,133, 0 , 0 , 0 , 0 , 0 },}, {U_circumflex ,"U\b^" ,{ 0 ,219/*Û*/,174/*®*/, 0 /*U*/,234, 0 , 0 ,158, 0 , 0 , 0 },}, {u_circumflex ,"u\b^" ,{150/*–*/,251/*û*/,195/*Ã*/, 0 /*u*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {U_diaeresis ,"U\b\"" ,{154/*š*/,220/*Ü*/,219/*Û*/,211/*Ó*/, 0 , 0 , 0 , 0 , 0 , 0 ,179},}, {u_diaeresis ,"u\b\"" ,{129/**/,252/*ü*/,207/*Ï*/,216/*Ø*/, 0 , 0 , 0 , 0 , 0 , 0 ,184},}, {U_grave ,"U\b`" ,{ 0 ,217/*Ù*/,173/*­*/, 0 /*U*/,235, 0 ,157,157, 0 , 0 , 0 },}, {u_grave ,"u\b`" ,{151/*—*/,249/*ù*/,203/*Ë*/, 0 /*u*/, 0 , 0 , 0 , 0 , 0 , 0 ,188},}, {Y_acute ,"Y\b'" ,{ 0 , 0 ,177 , 0 ,237,237, 0 , 0 , 0 , 0 , 0 },}, {y_acute ,"y\b'" ,{ 0 , 0 ,178 , 0 ,236,236, 0 , 0 , 0 , 0 , 0 },}, {Y_diaeresis ,"Y\b\"" ,{ 0 ,221/*Ý*/,238/*î*/, 0 /*Y*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {y_diaeresis ,"y\b\"" ,{152/*˜*/,253/*ý*/,239/*ï*/, 0 /*y*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {Z_acute ,"Z\b'" ,{ 0 , 0 , 0 , 0 , 0 ,141, 0 , 0 , 0 , 0 , 0 },}, {z_acute ,"z\b'" ,{ 0 , 0 , 0 , 0 , 0 ,171, 0 , 0 , 0 , 0 , 0 },}, {Z_chz ,"Z\bv" ,{ 0 , 0 , 0 , 0 , 0 ,166, 0 , 0 , 0 , 0 , 0 },}, {z_chz ,"z\bv" ,{ 0 , 0 , 0 , 0 , 0 ,167, 0 , 0 , 0 , 0 , 0 },}, {Z_plus ,"Z\b+" ,{ 0 , 0 , 0 , 0 , 0 ,189, 0 , 0 , 0 , 0 , 0 },}, {z_plus ,"z\b+" ,{ 0 , 0 , 0 , 0 , 0 ,190, 0 , 0 , 0 , 0 , 0 },}, /* Diacritical marks */ {DM_macron ," " ,{ 0 ,175 ,175 , 0 ,238, 0 , 0 ,167, 0 , 0 , 0 },}, {DM_center_bar ,"-" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {DM_under_bar ,"_" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {DM_circumflex ,"^" ,{'^' , 0 ,170 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {DM_breve ," " ,{ 0 , 0 , 0 , 0 , 0 ,244, 0 , 0 , 0 , 0 , 0 },}, {DM_chz ," " ,{ 0 , 0 , 0 , 0 , 0 ,243, 0 , 0 , 0 , 0 , 0 },}, {DM_tilde ,"~" ,{'~' , 0 ,172 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,181},}, {DM_diaeresis ,"\"" ,{ 0 , 0 ,171 , 0 ,247,249, 0 ,164, 0 , 0 ,190},}, {DM_cedilla ,"," ,{ 0 ,184 , 0 , 0 ,247,247, 0 ,165, 0 , 0 , 0 },}, {DM_tail ,"." ,{ 0 , 0 , 0 , 0 , 0 ,242, 0 , 0 , 0 , 0 , 0 },}, {DM_acute ,"'" ,{ 0 ,180 ,168 ,199 ,239, 0 , 0 ,161, 0 , 0 ,160},}, {DM_grave ,"`" ,{ 0 , 0 ,169 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,164},}, {DM_virgule ,"/" ,{'/' , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {DM_parallels ," " ,{186/*º*/, 0 , 0 ,207 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {DM_circle ," " ,{248/*ø*/, 0 ,179 , 0 , 0 ,248, 0 , 0 , 0 , 0 ,166},}, {DM_plus ," " ,{ 0 , 0 , 0 , 0 , 0 ,250, 0 , 0 , 0 , 0 , 0 },}, {DM_acuteacute ,"\"" ,{ 0 , 0 , 0 , 0 , 0 ,235, 0 , 0 , 0 , 0 , 0 },}, /* Text symbols */ {SYM_daggar ,"+" ,{ 0 , 0 , 0 ,200 , 0 , 0 , 0 , 0 , 0 , 0 ,168},}, {SYM_double_daggar ,"++" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_paragraph ,"]P" ,{ 0 ,182/*¶*/,224 , 0 ,244, 0 , 0 ,134, 0 , 0 ,175},}, {SYM_section ,"S\bo" ,{ 21 ,167 ,189 ,201 ,245,245, 0 ,143, 0 , 0 ,169},}, {SYM_big_asterisk ,"*" ,{ 15 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_house ,"^\b_" ,{127/**/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, /* Buisness */ {SYM_copyright ,"(c)" ,{ 0 ,169/*©*/, 0 ,203 ,184, 0 , 0 , 0 , 0 , 0 ,171},}, {SYM_registered ,"(R)" ,{ 0 ,174/*®*/, 0 , 0 ,169, 0 , 0 , 0 , 0 , 0 ,170},}, {SYM_pounds ,"#" ,{156/*œ*/,163 ,187 ,195 , 0 , 0 , 0 , 0 , 0 , 0 ,163},}, {SYM_yen ,"Y\b-" ,{157/**/,165 ,188 ,208 ,190, 0 , 0 , 0 , 0 , 0 ,176},}, {SYM_cents ,"c\b|" ,{155/*›*/,162 ,191 ,212 ,169, 0 , 0 , 0 , 0 , 0 ,180},}, {SYM_trade_mark ,"(TM)" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,186},}, {SYM_francs ,"f" ,{159/*Ÿ*/, 0 ,190 ,223 , 0 , 0 , 0 , 0 , 0 , 0 ,191},}, {SYM_Tx ,"Tx" ,{ 0 , 0 , 0 ,176 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_Pt ,"Pt" ,{158/*ž*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_degrees_C ,"C" ,{ 0 , 0 , 0 ,180 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_degrees_F ,"F" ,{ 0 , 0 , 0 ,181 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_degrees ,"'\b`" ,{248/*ø*/,176 ,179 ,198 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_X_circle ,"X\bO" ,{ 0 ,168 ,186 , 0 ,207,207, 0 ,152,175,175, 0 },}, /* Punctuation */ {SYM_UD_question ,"?" ,{168/*¨*/,191 ,185 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_UD_exclamation ,"!" ,{ 0 ,161 ,184 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_double_exclamation ,"!!" ,{ 19 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_french_begin_quote ,"<<" ,{174/*®*/,171 ,251 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_french_end_quote ,">>" ,{175/*¯*/,187 ,253 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_bar_left ,"-" ,{169/*©*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_bar_right ,"-" ,{170/*ª*/,172 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_split_vert_bar ,"|" ,{ 0 ,166 , 0 , 0 ,221, 0 , 0 ,160, 0 , 0 , 0 },}, {SYM_vert_bar ,"|" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, /* directional */ {SYM_arrow_left ,"<-" ,{ 27 , 0 , 0 ,166 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_arrow_right ,"->" ,{ 26 , 0 , 0 ,167 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_arrow_leftright ,"<->" ,{ 29 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_arrow_down ,"|\bv" ,{ 25 , 0 , 0 ,165 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_arrow_up ,"|\b^" ,{ 24 , 0 , 0 ,164 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_arrow_updown ,"^\b|\bv" ,{ 18 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_arrow_updown_under ,"^\b|\bv\b_" ,{ 23 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_triangle_left ,"<|" ,{ 0 , 0 , 0 ,172 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_triangle_right ,"|>" ,{ 0 , 0 , 0 ,171 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_triangle_up ,"^\b_" ,{ 0 , 0 , 0 ,169 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_triangle_down ,"v\b-" ,{ 0 , 0 , 0 ,170 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_triangle_left_solid ,"<\b+|" ,{ 17 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_triangle_right_solid,"|+\b>" ,{ 16 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_triangle_up_solid ,"^\b_\b+" ,{ 30 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_triangle_down_solid ,"v\b-\b+" ,{ 31 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {TRIANGLE_ULC ," " ,{ 0 , 0 , 0 ,251 , 0 , 0 , 0 , 0 , 0 , 0 ,251},}, {TRIANGLE_LLC ," " ,{ 0 , 0 , 0 ,254 , 0 , 0 , 0 , 0 , 0 , 0 ,254},}, {TRIANGLE_URC ," " ,{ 0 , 0 , 0 ,253 , 0 , 0 , 0 , 0 , 0 , 0 ,253},}, {TRIANGLE_LRC ," " ,{ 0 , 0 , 0 ,252 , 0 , 0 , 0 , 0 , 0 , 0 ,252},}, /* Graphics */ {SYM_bar ,"-" ,{ 0 ,173/*­*/,246/*ö*/, 0 ,240,240, 0 , 0 , 0 , 0 , 0 },}, {SYM_diamond_open ,"^\bv" ,{ 0 , 0 , 0 ,173 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_square ,"#" ,{ 0 , 0 , 0 ,175 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_filled_square ,"#\b+" ,{254/*þ*/, 0 ,252 , 0 , 0 ,254, 0 , 0 , 0 , 0 , 0 },}, {SYM_small_circle ,"o" ,{ 9 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_small_circle_rvrsd ,"o" ,{ 8 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_circle ,"O" ,{ 0 , 0 , 0 ,168 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_filled_circle ,"O\b+" ,{ 7 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_largedot_rvrsd ,"." ,{ 8 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_largedot ,"." ,{ 7 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_cdot ,"." ,{249/*ù*/,183 ,242 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_cpoint ,"." ,{250/*ú*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_smiley_white ,"O" ,{ 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_smiley_black ,"O" ,{ 2 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_heart ," " ,{ 3 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_diamond ,"^\bv\b+" ,{ 4 , 0 , 0 ,174 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_club ," " ,{ 5 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_spade ," " ,{ 6 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_male ,"o\b'" ,{ 11 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_female ,"o\b+" ,{ 12 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, /* 12 Quarter Block graphics 34 */ {QBG_1, " " ,{ 0 , 0 , 0 ,225 , 0 , 0 , 0 , 0 , 0 , 0 ,225},}, {QBG_2, " " ,{ 0 , 0 , 0 ,227 , 0 , 0 , 0 , 0 , 0 , 0 ,227},}, {QBG_3, " " ,{ 0 , 0 , 0 ,226 , 0 , 0 , 0 , 0 , 0 , 0 ,226},}, {QBG_4, " " ,{ 0 , 0 , 0 ,228 , 0 , 0 , 0 , 0 , 0 , 0 ,228},}, {QBG_12, " " ,{223/*ß*/, 0 , 0 ,231 , 0 , 0 , 0 , 0 , 0 , 0 ,231},}, {QBG_13, " " ,{221/*Ý*/, 0 , 0 ,233 , 0 , 0 , 0 , 0 , 0 , 0 ,233},}, {QBG_14, " " ,{ 0 , 0 , 0 ,229 , 0 , 0 , 0 , 0 , 0 , 0 ,229},}, {QBG_23, " " ,{ 0 , 0 , 0 ,230 , 0 , 0 , 0 , 0 , 0 , 0 ,230},}, {QBG_24, " " ,{222/*Þ*/, 0 , 0 ,234 , 0 , 0 , 0 , 0 , 0 , 0 ,234},}, {QBG_34, " " ,{220/*Ü*/, 0 , 0 ,232 , 0 , 0 , 0 , 0 , 0 , 0 ,232},}, {QBG_123, " " ,{ 0 , 0 , 0 ,235 , 0 , 0 , 0 , 0 , 0 , 0 ,235},}, {QBG_134, " " ,{ 0 , 0 , 0 ,237 , 0 , 0 , 0 , 0 , 0 , 0 ,237},}, {QBG_124, " " ,{ 0 , 0 , 0 ,236 , 0 , 0 , 0 , 0 , 0 , 0 ,236},}, {QBG_234, " " ,{ 0 , 0 , 0 ,238 , 0 , 0 , 0 , 0 , 0 , 0 ,238},}, {QBG_1234, " " ,{219/*Û*/, 0 , 0 ,239 , 0 , 0 , 0 , 0 , 0 , 0 ,239},}, /* circle quarters */ {CQ_1, " " ,{ 0 , 0 , 0 ,163/*£*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {CQ_2, " " ,{ 0 , 0 , 0 ,161/*¡*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {CQ_3, " " ,{ 0 , 0 , 0 ,162/*¢*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {CQ_4, " " ,{ 0 , 0 , 0 ,160/* */, 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, /* checker board */ {CB_low, " " ,{176/*°*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {CB_med, " " ,{177/*±*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {CB_high, " " ,{178/*²*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, /* Line graphics */ /* V vertical H Horizontal T Tee B Bar C Corner I Intersection L Left R Right U Up D Down s single d double */ {LG_sVB, "|" ,{179/*³*/, 0 , 0 ,245 , 0 , 0 , 0 , 0 , 0 , 0 ,245},}, {LG_sLT, "+" ,{180/*´*/, 0 , 0 ,249 , 0 , 0 , 0 , 0 , 0 , 0 ,249},}, {LG_dLsT, "+" ,{181/*µ*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_sLdT, "+" ,{182/*¶*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_sLdDC, "+" ,{183/*·*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_dLsDC, "+" ,{184/*¸*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_dLT, "+" ,{185/*¹*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_dVB, "|" ,{186/*º*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_dLDC, "+" ,{187/*»*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_dLUC, "+" ,{188/*¼*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_sLdUC, "+" ,{189/*½*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_dLsUC, "+" ,{190/*¾*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_sLDC, "+" ,{191/*¿*/, 0 , 0 ,242 , 0 , 0 , 0 , 0 , 0 , 0 ,242},}, {LG_sUsRC, "+" ,{192/*À*/, 0 , 0 ,246 , 0 , 0 , 0 , 0 , 0 , 0 ,246},}, {LG_sUT, "+" ,{193/*Á*/, 0 , 0 ,248 , 0 , 0 , 0 , 0 , 0 , 0 ,248},}, {LG_sDT, "+" ,{194/*Â*/, 0 , 0 ,243 , 0 , 0 , 0 , 0 , 0 , 0 ,243},}, {LG_sRT, "+" ,{195/*Ã*/, 0 , 0 ,244 , 0 , 0 , 0 , 0 , 0 , 0 ,244},}, {LG_sHB, "-" ,{196/*Ä*/, 0 , 0 ,241 , 0 , 0 , 0 , 0 , 0 , 0 ,241},}, {LG_sUDLRI, "+" ,{197/*Å*/, 0 , 0 ,250 , 0 , 0 , 0 , 0 , 0 , 0 ,250},}, {LG_dRsT, "+" ,{198/*Æ*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_sRdT, "+" ,{199/*Ç*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_dURC, "+" ,{200/*È*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_dDRC, "+" ,{201/*É*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_dUT, "+" ,{202/*Ê*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_dDT, "+" ,{203/*Ë*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_dRT, "+" ,{204/*Ì*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_dHB, "-" ,{205/*Í*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_dUDLRI, "+" ,{206/*Î*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_sUdT, "+" ,{207/*Ï*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_dUsT, "+" ,{208/*Ð*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_sDdT, "+" ,{209/*Ñ*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_dDsT, "+" ,{210/*Ò*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_dUsRC, "+" ,{211/*Ó*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_sUdRC, "+" ,{212/*Ô*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_sDdRC, "+" ,{213/*Õ*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_dDsRC, "+" ,{214/*Ö*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_dUDsLRI, "+" ,{215/*×*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_sUDdLRI, "+" ,{216/*Ø*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {LG_sULC, "+" ,{217/*Ù*/, 0 , 0 ,247 , 0 , 0 , 0 , 0 , 0 , 0 ,247},}, {LG_sDRC, "+" ,{218/*Ú*/, 0 , 0 ,240 , 0 , 0 , 0 , 0 , 0 , 0 ,240},}, /* Math */ {SYM_one_half ,"1/2" ,{171/*«*/,189 ,248 ,206 , 0 , 0 , 0 , 0 , 0 , 0 ,174},}, {SYM_one_quarter ,"1/4" ,{172/*¬*/,188 ,247 ,204 , 0 , 0 , 0 , 0 , 0 , 0 ,172},}, {SYM_three_quarters ,"3/4" ,{ 0 ,190 ,245 , 0 ,243, 0 , 0 ,173, 0 , 0 ,173},}, {SYM_exponent_1 ,"1" ,{ 0 ,185 , 0 , 0 ,251, 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_exponent_2 ,"2" ,{253/*ý*/,178 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_exponent_3 ,"3" ,{ 0 ,179 , 0 , 0 ,252, 0 , 0 ,166, 0 ,174, 0 },}, {SYM_exponent_n ,"n" ,{252/*ü*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_GTE ,">\b_" ,{242/*ò*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_LTE ,"<\b_" ,{243/*ó*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_plus_minus ,"+\b_" ,{241/*ñ*/,177 ,254 ,188 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_infinity ,"infinity",{236/*ì*/, 0 , 0 ,186 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_equivelence ,"=\b_" ,{240/*ð*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_intersection ," " ,{239/*ï*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_union ,"U" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_approximate ,"~\b=" ,{247/*÷*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_root ,"^/" ,{251/*û*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_times ,"x" ,{ 0 , 0 , 0 ,190 ,158,158, 0 , 0 , 0 , 0 , 0 },}, {SYM_overline_x ,"x\b-" ,{ 0 , 0 , 0 ,205 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_division ,"-\b:" ,{246/*ö*/, 0 , 0 ,191 , 0 ,246, 0 , 0 , 0 , 0 , 0 },}, /* Music */ {SYM_quaver ,".\b|\b`" ,{ 13 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {SYM_quaverquaver ,".\b|=.\b:",{ 14/**/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, /* Greek */ {GRK_alpha ," " ,{224/*à*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_beta ,"b" ,{225/*á*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_gamma ," " ,{231/*ç*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_delta ,"d" ,{235/*ë*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_epsilon ," " ,{238/*î*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_zeta ," " ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_eta ," " ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_theta ,"o\b-" ,{233/*é*/, 0 , 0 ,179 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_iota ,"i" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_kappa ,"k" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_lambda ,"l" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_mu ," " ,{230/*æ*/,181 ,243 ,197 , 0 , 0 , 0 , 0 , 0 , 0 ,165},}, {GRK_nu ,"v" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_xi ," " ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_pi ," " ,{210/*Ò*/, 0 , 0 ,187 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_omicron ,"o" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_rho ," " ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_sigma ,"o\b'" ,{229/*å*/, 0 , 0 ,186 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_tau ," " ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_upsilon ,"u" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_phi ,"o\b/" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_chi ,"x" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_psi ,"v\b/" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_omega ,"w" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Alpha ,"A" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Beta ,"B" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Gamma ," " ,{226/*â*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Delta ," " ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Epsilon ,"E" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Zeta ,"Z" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Eta ,"H" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Theta ,"O\b-" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Iota ,"I" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Kappa ,"K" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Lambda ," " ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Mu ,"M" ,{ 0 , 0 , 0 , 0 ,230, 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Nu ,"N" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Xi ," " ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Pi ," " ,{227/*ã*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Omicron ,"O" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Rho ,"P\b-" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Sigma ,">\b_\b~" ,{228/*ä*/, 0 , 0 ,184 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Tau ,"T" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Upsilon ,"I\b~" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Phi ,"0\bI" ,{232/*è*/, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Chi ,"X" ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Psi ," " ,{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_Omega ,"O\b_" ,{234/*ê*/, 0 , 0 ,182 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {GRK_UDOmega ,"O\b~" ,{234/*ê*/, 0 , 0 ,183 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },}, {UCSCU_END_TABLE ,"" ,{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 },} }; #if defined(__STDC__) || defined(__cplusplus) int code_used_in(int code,int CS) #else int code_used_in(code,CS) int code; int CS; #endif { int i; int used = 0; for (i = 0; bit8_table[i].symbol; i++) used = (bit8_table[i].codes[CS] == code) ? 1 : used; return(used); }; #if defined(__STDC__) || defined(__cplusplus) void copy_CS(int source,int target) #else void copy_CS(source,target) int source; int target; #endif { int i; for (i = 0; bit8_table[i].symbol; i++) if (bit8_table[i].codes[target] == 0) if (!code_used_in(bit8_table[i].codes[source],target)) bit8_table[i].codes[target] = bit8_table[i].codes[source]; }; /* A null string indicates the character is not available in the character set */ /* see if the character can be drawn with a multiple character sequence. */ struct bit7_layout { int symbol; char_8bit codes[13]; }; struct bit7_layout bit7_table[] = { /* USA UK GRM DUT FRN SWD NRW ITL SPN PRT FIN BEL SWS*/ {A_diaeresis ,{0 ,0 ,'[',0 ,0 ,0 ,'[',0 ,0 ,0 ,'[',0 ,0 },}, {a_diaeresis ,{0 ,0 ,'{',0 ,0 ,'{',0 ,0 ,0 ,0 ,'{',0 ,'{'},}, {A_circle ,{0 ,0 ,0 ,']',0 ,0 ,']',0 ,']',0 ,']',0 ,0 },}, {a_circle ,{0 ,0 ,0 ,'}',0 ,'}','}',0 ,0 ,0 ,'}',0 ,0 },}, {A_E ,{0 ,0 ,0 ,'[',0 ,0 ,0 ,'[',0 ,0 ,0 ,0 ,0 },}, {a_e ,{0 ,0 ,0 ,'{',0 ,0 ,'{',0 ,0 ,0 ,0 ,0 ,0 },}, {a_grave ,{0 ,0 ,0 ,0 ,'@',0 ,0 ,'{',0 ,0 ,0 ,'@','@'},}, {A_tilde ,{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,'[',0 ,0 ,0 },}, {a_tilde ,{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,'{',0 ,0 ,0 },}, {B_german_S ,{0 ,0 ,'~',0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 },}, {C_cedilla ,{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,92 ,0 ,0 ,92 },}, {c_cedilla ,{0 ,0 ,0 ,0 ,92 ,0 ,0 ,92 ,'}','|',0 ,92 ,0 },}, {E_acute ,{0 ,0 ,0 ,0 ,0 ,'@',0 ,0 ,0 ,0 ,0 ,0 ,0 },}, {e_acute ,{0 ,0 ,0 ,0 ,'{','`',0 ,']',0 ,0 ,'`','{','['},}, {e_circumflex ,{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,']'},}, {e_grave ,{0 ,0 ,0 ,0 ,'}',0 ,0 ,'}',0 ,0 ,0 ,'}','_'},}, {i_circumflex ,{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,'^'},}, {i_grave ,{0 ,0 ,0 ,0 ,0 ,0 ,0 ,'~',0 ,0 ,0 ,0 ,0 },}, {N_tilde ,{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,92 ,0 ,0 ,0 ,0 },}, {n_tilde ,{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,'|',0 ,0 ,0 ,0 },}, {o_circumflex ,{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,'`'},}, {O_diaeresis ,{0 ,0 ,92 ,0 ,0 ,92 ,0 ,0 ,0 ,0 ,92 ,0 ,0 },}, {o_diaeresis ,{0 ,0 ,'|',0 ,0 ,'|',0 ,0 ,0 ,0 ,'|',0 ,'|'},}, {o_grave ,{0 ,0 ,0 ,0 ,0 ,0 ,0 ,'|',0 ,0 ,0 ,0 ,0 },}, {O_slash ,{0 ,0 ,0 ,92 ,0 ,92 ,92 ,0 ,0 ,0 ,0 ,0 ,0 },}, {o_slash ,{0 ,0 ,0 ,92 ,0 ,'|','|',0 ,0 ,0 ,0 ,0 ,0 },}, {O_tilde ,{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,']',0 ,0 ,0 },}, {o_tilde ,{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,'}',0 ,0 ,0 },}, {i_circumflex ,{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,'~'},}, {U_diaeresis ,{0 ,0 ,']',0 ,0 ,'^',0 ,0 ,0 ,0 ,'^',0 ,0 },}, {u_diaeresis ,{0 ,0 ,'}',0 ,0 ,'~',0 ,0 ,0 ,0 ,'~',0 ,'}'},}, {u_grave ,{0 ,0 ,0 ,0 ,'|',0 ,0 ,'`',0 ,0 ,0 ,'|','#'},}, /* Symbols which differ from ASCII representation */ /* USA UK GRM DUT FRN SWD NRW ITL SPN PRT FIN BEL SWS */ {SYM_pounds ,{0 ,'#',0 ,'#',0 ,0 ,0 ,'#','#',0 ,0 ,'#',0 },}, {SYM_X_circle ,{0 ,0 ,0 ,0 ,0 ,'$',0 ,0 ,0 ,0 ,0 ,0 ,0 },}, {SYM_section ,{0 ,0 ,'@',0 ,0 ,0 ,0 ,'@','@',0 ,0 ,'}',0 },}, {SYM_cdot ,{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 },}, {SYM_vert_bar ,{0 ,0 ,0 ,']',0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 },}, {SYM_one_half ,{0 ,0 ,0 ,92 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 },}, {SYM_three_quarters,{0 ,0 ,0 ,'@',0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 },}, {i_j ,{0 ,0 ,0 ,'[',0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 },}, {SYM_francs ,{0 ,0 ,0 ,'|',0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 },}, {SYM_one_quarter ,{0 ,0 ,0 ,'}',0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 },}, {SYM_UD_question ,{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,']',0 ,0 ,0 ,0 },}, {SYM_UD_exclamation,{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,'[',0 ,0 ,0 ,0 },}, /* Diacritical marks that differ from ASCII representation */ /* USA UK GRM DUT FRN SWD NRW ITL SPN PRT FIN BEL SWS */ {DM_circumflex ,{0 ,0 ,0 ,'^',0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 },}, {DM_tilde ,{0 ,0 ,0 ,'~',0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 },}, {DM_diaeresis ,{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,'~',0 },}, {DM_acute ,{0 ,0 ,0 ,'~',0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 },}, {DM_circle ,{0 ,0 ,0 ,0 ,0 ,0 ,0 ,'[','{',0 ,0 ,'[',0 },}, {UCSCU_END_TABLE ,{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 },} }; #if defined(__STDC__) || defined(__cplusplus) int lookup_char_8bit(char_8bit code,int cs_8bit) #else int lookup_char_8bit(code,cs_8bit) char_8bit code; int cs_8bit; #endif { int i; for (i = 0; bit8_table[i].symbol ;i++) { if (bit8_table[i].codes[cs_8bit] == code) return(bit8_table[i].symbol); }; return(0); }; #if defined(__STDC__) || defined(__cplusplus) int lookup_char_7bit(char_8bit code,int cs_7bit) #else int lookup_char_7bit(code,cs_7bit) char_8bit code; int cs_7bit; #endif { int i; for (i = 0; bit7_table[i].symbol ;i++) if (bit7_table[i].codes[cs_7bit] == code) return(bit7_table[i].symbol); return(0); }; #if defined(__STDC__) || defined(__cplusplus) char *lookup_code_ASCII(int symbol) #else char *lookup_code_ASCII(symbol) int symbol; #endif { int i; for (i = 0; bit8_table[i].symbol; i++) if (bit8_table[i].symbol == symbol) return(bit8_table[i].ASCII); return(0); }; #if defined(__STDC__) || defined(__cplusplus) char *lookup_code_TeX(int symbol) #else char *lookup_code_TeX(symbol) int symbol; #endif { int i; for (i = 0; UCSCU_TeX_table[i].symbol; i++) if (bit8_table[i].symbol == symbol) return(UCSCU_TeX_table[i].TeX); return(0); }; #if defined(__STDC__) || defined(__cplusplus) char *UCSCU_lookup_code_HTML(int symbol) #else char *UCSCU_lookup_code_HTML(symbol) int symbol; #endif { int i; for (i = 0; UCSCU_HTML_table[i].symbol; i++) if (bit8_table[i].symbol == symbol) return(UCSCU_HTML_table[i].HTML); return(0); }; #if defined(__STDC__) || defined(__cplusplus) char_8bit lookup_code_7bit(int symbol,int CS) #else char_8bit lookup_code_7bit(symbol,CS) int symbol; int CS; #endif { int i; for (i = 0;bit7_table[i].symbol != UCSCU_END_TABLE;i++) if (bit7_table[i].symbol == symbol) return(bit7_table[i].codes[CS]); return(0); }; #if defined(__STDC__) || defined(__cplusplus) char_8bit lookup_code_8bit(int symbol,int CS) #else char_8bit lookup_code_8bit(symbol,CS) int symbol; int CS; #endif { int i; if (CS == CS_NONE) return(0); if (symbol < UCSCU_END_TABLE) return(0); for (i = 0;bit8_table[i].symbol;i++) if (bit8_table[i].symbol == symbol) return(bit8_table[i].codes[CS]); return(0); }; #if defined(__STDC__) || defined(__cplusplus) int lookup_diacritical_mark(char_8bit ch,int bit7_cs,int bit8_cs) #else int lookup_diacritical_mark(ch,bit7_cs,bit8_cs) char_8bit ch; int bit7_cs; int bit8_cs; #endif { int DC_mark = 0; switch (ch) { case 39 : DC_mark = DM_acute ; break; case '`' : DC_mark = DM_grave ; break; case '~' : DC_mark = DM_tilde ; break; case '^' : DC_mark = DM_circumflex ; break; case '@' : DC_mark = DM_circle ; break; case '/' : DC_mark = DM_virgule ; break; case '=' : DC_mark = DM_macron ; break; case '-' : DC_mark = DM_center_bar ; break; case '_' : DC_mark = DM_under_bar ; break; case '"' : DC_mark = DM_diaeresis ; break; case 'u' : DC_mark = DM_breve ; break; case 'v' : DC_mark = DM_chz ; break; case '*' : DC_mark = DM_parallels ; break; case ',' : DC_mark = DM_cedilla ; break; case '.' : DC_mark = DM_tail ; break; case '+' : DC_mark = DM_plus ; break; }; if (DC_mark) if (UCSCU_output_mode.prefer_7bit) /* Then look up 7-bit code first */ { if ((ch = lookup_code_7bit(DC_mark,bit7_cs)) == 0) /* if no 7bit representation */ ch = lookup_code_8bit(DC_mark,bit8_cs); /* if no 8bit representation */ } else /* otherwise lookup 8-bit code first */ if ((ch = lookup_code_8bit(DC_mark,bit8_cs)) == 0) ch = lookup_code_7bit(DC_mark,bit7_cs); if (ch) return(ch); else { char *ASCII_rep = lookup_code_ASCII(DC_mark); if (ASCII_rep) return(ASCII_rep[0]); else return(' '); /* If no ASCII representation of the diacritical mark, then print nothing, but since BS already entered*/ }; }; #if defined(__STDC__) || defined(__cplusplus) char_8bit *get_string_representation(int code, char *str,int backspacing,int graphics,int is_graphic,char_8bit *buffer) #else char_8bit *get_string_representation(code,str,backspacing,graphics,is_graphic,buffer) int code; char *str; int backspacing; int graphics; int is_graphic; char_8bit *buffer; #endif { int i; int buf_pos = 0; buffer[0] = 0; if (is_graphic) if (graphics) buffer[0] = ((graphics==GR_MARK) ? UNKNOWN_MARKER : ' '); else strcpy((char *)buffer,(const_char *)str); else if (((code <= z_plus) && (backspacing == BS_NOT_CAP)) || (backspacing == BS_NEVER)) buffer[0] = str[0]; else for (i = 0; i < strlen(str);i++) if ((str[i] == 8) && (backspacing == BS_OMIT)) { /* do nothing: Omit the backspacing */} else buffer[buf_pos++] = ((i>0)? lookup_diacritical_mark(str[i],UCSCU_output_option.bit7_CS,UCSCU_output_option.bit8_CS) : str[i]); return(buffer); }; #if defined(__STDC__) || defined(__cplusplus) char_8bit *get_simple_line_graphic(int code,char_8bit *buffer) #else char_8bit *get_simple_line_graphic(code,buffer) int code; char_8bit *buffer; #endif { int i; switch (code) { case LG_dVB : code = LG_sVB; break; case LG_dLsT : case LG_sLdT : case LG_dLT : code = LG_sLT; break; case LG_sLdDC : case LG_dLsDC : case LG_dLDC : code = LG_sLDC; break; case LG_dURC : case LG_dUsRC : case LG_sUdRC : code = LG_sUsRC; break; case LG_dUT : case LG_sUdT : case LG_dUsT : code = LG_sUT; break; case LG_dDT : case LG_sDdT : case LG_dDsT : code = LG_sDT; break; case LG_dRsT : case LG_sRdT : case LG_dRT : code = LG_sRT; break; case LG_dHB : code = LG_sHB; break; case LG_dUDLRI: case LG_dUDsLRI :case LG_sUDdLRI : code = LG_sUDLRI; break; case LG_dLUC : case LG_sLdUC : case LG_dLsUC : code = LG_sULC; break; case LG_dDRC : case LG_sDdRC : case LG_dDsRC : code = LG_sDRC; break; }; for (i = 0; bit8_table[i].symbol != UCSCU_END_TABLE; i++) if (bit8_table[i].symbol == code) { if ((UCSCU_output_option.bit8_CS >= 0) && (bit8_table[i].codes[UCSCU_output_option.bit8_CS])) buffer[0] = (bit8_table[i].codes[UCSCU_output_option.bit8_CS]); else strcpy((char *)buffer,(const_char *)bit8_table[i].ASCII); return(buffer); }; return(NULL); }; /* Currently we aren't handling multi character representations of accented characters on input. For example e' could be taken to mean e_acute, but so could 'e this could cause problems with words such as: re'elle or ree'lle or quoted text 'This is a quote' Also, many scandinavians use double lettering for ASCII representations of accented characters, Ie aa for a_circle. This requires more context parsing than I care to deal with at this time, since I don't know all possible situations. #if defined(__STDC__) || defined(__cplusplus) int check_diacritical_mark(char letter,int mark) #else int check_diacritical_mark(letter,mark) char letter; int mark; #endif { return(0); }; */ #define is_8bit(x) (x & 0x80) #define is_diacritical_mark(x) ((x >= DM_macron) && (x <= DM_acuteacute)) #define is_line_graphics(x) ((x >= LG_sVB) && (x <= LG_sDRC)) #if defined(__STDC__) || defined(__cplusplus) int in_char(void) #else int in_char() #endif { int in; in = fgetc(UCSCU_input_option.file); return(feof(UCSCU_input_option.file) ? 0 : in); }; #if defined(__STDC__) || defined(__cplusplus) int in_symbol(void) #else int in_symbol() #endif { static int at_eof = 0; static char_8bit lookahead = 0; char_8bit curr = 0; int curr_code = 0; /* Currently not handling ASCII representations of diacritical markings int diacritical_code; int potential_diacritical_marking = 0; */ if (lookahead) curr = lookahead; if (at_eof) return(0); else if (!curr) { curr = fgetc(UCSCU_input_option.file); if (feof(UCSCU_input_option.file)) { /* fgetc may have returned EOF (-1) */ at_eof = 1; lookahead = 0; }; }; if (feof(UCSCU_input_option.file)) { at_eof = 1; lookahead = 0; } else { lookahead = fgetc(UCSCU_input_option.file); if (feof(UCSCU_input_option.file)) { /* fgetc may have returned EOF (-1) */ at_eof = 1; lookahead = 0; } }; if (lookahead == 8) /* gobble up backspaces */ { lookahead = fgetc(UCSCU_input_option.file); if (feof(UCSCU_input_option.file)) { /* fgetc may have returned EOF (-1) */ at_eof = 1; lookahead = 0; } /*potential_diacritical_marking = 1; */ }; /* space will cause problems with symbols that have no ASCII representation*/ if (curr == ' ') return(' '); if (is_8bit(curr)) curr_code = lookup_char_8bit(curr,UCSCU_input_option.bit8_CS); else /* { */ curr_code = lookup_char_7bit(curr,UCSCU_input_option.bit7_CS); /* Could do input of ASCII diacritical representations if (curr_code) if (is_diacritical_mark(curr_code)) { if ((diacritical_code = check_diacritical_mark(lookahead,curr_code)) != 0) { curr_code = diacritical_code; lookahead = fgetc(UCSCU_input_option.file); } } else if ((diacritical_code = check_diacritical_mark(curr,lookup_7bit(lookahead,UCSCU_input_option.cs_7bit))) != 0) { curr_code = diacritical_code; lookahead = fgetc(input.file); }; }; */ return(curr_code ? curr_code : curr); }; #ifndef UCSCU_STANDALONE #if defined(__STDC__) || defined(__cplusplus) int str_in_symbol(char *inbuffer, int *buff_pos) #else int str_in_symbol(inbuffer,buff_pos) char *inbuffer; int *buff_pos; #endif { char curr; int curr_code = 0; if (inbuffer[*buff_pos] == '0') return(0); curr = inbuffer[*buff_pos]; *buff_pos += 1; if (curr == ' ') return(' '); if (is_8bit(curr)) curr_code = lookup_char_8bit(curr,UCSCU_input_option.bit8_CS); else curr_code = lookup_char_7bit(curr,UCSCU_input_option.bit7_CS); return(curr_code ? curr_code : curr); }; #endif #if defined(__STDC__) || defined(__cplusplus) char_8bit *UCSCU_char(int cs_code) #else char_8bit *UCSCU_char(cs_code) int cs_code; #endif { static char_8bit buffer[20]; char *outstr = 0; char_8bit outchar = 0; buffer[0] = 0; buffer[1] = 0; if (UCSCU_output_option.bit7_CS == CS_TeX) /* If generating TeX then we only want 7 bit ASCII */ { /* (note that can't do graphics in TeX) */ if ((outstr = (char_8bit *)lookup_code_TeX(cs_code)) != 0) /* If TeX symbol or Accented character */ sprintf((char *)buffer,"\\%s",outstr); /* Output TeX representation */ else /* (note that TeX strings are stored without \ */ if ((outstr = (char_8bit *)lookup_code_ASCII(cs_code)) == 0) /* If code as ASCII representation */ buffer[0] = cs_code; /* output ASCII representation (Shouldn't have to do this, but I don't know all the TeX symbols and accents */ else strcpy((char *)buffer,(const_char *)outstr); /* Otherwise it's a 7-bit ascii character */ } else { if (UCSCU_output_mode.prefer_7bit) /* Then look up 7-bit code first */ { if ((outchar = lookup_code_7bit(cs_code,UCSCU_output_option.bit7_CS)) == 0) /* if no 7bit representation */ outchar = lookup_code_8bit(cs_code,UCSCU_output_option.bit8_CS); /* if no 8bit representation */ } else /* otherwise lookup 8-bit code first */ if ((outchar = lookup_code_8bit(cs_code,UCSCU_output_option.bit8_CS)) == 0) outchar = lookup_code_7bit(cs_code,UCSCU_output_option.bit7_CS); if (outchar) /* If a single char representation is found */ buffer[0] = outchar; /* output character */ else if (is_line_graphics(cs_code) && /* if it is a line graphic */ !lookup_code_8bit(cs_code,UCSCU_output_option.bit8_CS)) /* but there is no character */ strcpy((char *)buffer, /* try to output single line character or +-| */ (const_char *)get_simple_line_graphic(cs_code,buffer)); else if ((outstr = (char_8bit *)lookup_code_ASCII(cs_code)) == 0) /* if no ascii representation (symbol not in table*/ buffer[0] = cs_code; /* then this must be a printable 7-bit ascii code */ else /* otherwise output the string representation */ strcpy((char *)buffer, (const_char *)get_string_representation(cs_code,outstr,UCSCU_output_mode.backspacing, UCSCU_output_mode.graphics,is_line_graphics(cs_code),buffer)); }; return(buffer); }; char_8bit direct_conversion[256][10]; /* Currently we are only accepting character (7 or 8 bit) input, so we can always do direct conversion. Eventually we will want to be able to input character sequences which are ascii/text representations of accented characters and symbols (such as the ASCII representation we currenly output or TeX representation. In this case we could not do direct_conversion. */ #if defined(__STDC__) || defined(__cplusplus) int setup_direct_conversion(void) #else int setup_direct_conversion() #endif { char_8bit curr = 0; int curr_code = 0; char_8bit *outstr; char_8bit outchar = 0; { int i; for (i = 0; i < 255; i++) { direct_conversion[i][0] = i; direct_conversion[i][1] = 0; }; } for (curr = 1; curr < 255; curr++) { if (is_8bit(curr)) curr_code = lookup_char_8bit(curr,UCSCU_input_option.bit8_CS); else curr_code = lookup_char_7bit(curr,UCSCU_input_option.bit7_CS); curr_code = (curr_code ? curr_code : curr); if (UCSCU_output_option.bit7_CS == CS_TeX) /* If generating TeX then we only want 7 bit ASCII */ { /* (note that can't do graphics in TeX) */ if ((outstr = lookup_code_TeX(curr_code)) != 0) /* If TeX symbol or Accented character */ sprintf(direct_conversion[curr],"\\%s",outstr); /* Output TeX representation */ else /* (note that TeX strings are stored without \ */ if ((outstr = (char_8bit *)lookup_code_ASCII(curr_code)) == 0) /* If code as ASCII representation */ direct_conversion[curr][0] = curr_code; else sprintf(direct_conversion[curr],"%s",outstr); /* Otherwise it's a 7-bit ascii character */ } else { if (UCSCU_output_mode.prefer_7bit) /* Then look up 7-bit code first */ { if ((outchar = lookup_code_7bit(curr_code,UCSCU_output_option.bit7_CS)) == 0) /* if no 7bit representation */ outchar = lookup_code_8bit(curr_code,UCSCU_output_option.bit8_CS); /* if no 8bit representation */ } else /* otherwise lookup 8-bit code first */ if ((outchar = lookup_code_8bit(curr_code,UCSCU_output_option.bit8_CS)) == 0) outchar = lookup_code_7bit(curr_code,UCSCU_output_option.bit7_CS); if (outchar) /* If a single char representation is found */ direct_conversion[curr][0] = outchar; else if (is_line_graphics(curr_code) && /* if it is a line graphic */ !lookup_code_8bit(curr_code,UCSCU_output_option.bit8_CS)) /* but there is no character */ get_simple_line_graphic(curr_code,direct_conversion[curr]); /* try to output single line character or +-| */ else if ((outstr = (char_8bit *)lookup_code_ASCII(curr_code)) == 0) /* if no ascii representation (symbol not in table*/ direct_conversion[curr][0] = curr_code; /* then this must be a printable 7-bit ascii code */ else /* otherwise output the string representation */ get_string_representation(curr_code,outstr,UCSCU_output_mode.backspacing,UCSCU_output_mode.graphics,is_line_graphics(curr_code),direct_conversion[curr]); }; }; return(1); }; /* Converts the character string.*/ #ifndef UCSCU_STANDALONE #if defined(__STDC__) || defined(__cplusplus) char *UCSCU_string(char *instr,char *outstr) #else char *UCSCU_string(instr,outstr) char *instr; char *outstr; #endif { int i; int curr_char; outstr[0] = 0; for (i = 0; i < strlen(instr); i++) { curr_char = UCSCU_do_direct_conversion ? instr[i] : str_in_symbol(instr,&i); strcat(outstr,(const_char *)UCSCU_do_direct_conversion ? direct_conversion[curr_char]: UCSCU_char(curr_char)); }; return(outstr); }; #endif #if defined(__STDC__) || defined(__cplusplus) void show_7bit_options(void) #else void show_7bit_options() #endif { printf(" 1. English\n"); printf(" 2. German\n"); printf(" 3. Dutch\n"); printf(" 4. French\n"); printf(" 5. Swedish\n"); printf(" 6. Norwegian/Danish\n"); printf(" 7. Italian\n"); printf(" 8. Spanish\n"); printf(" 9. Portuguese\n"); printf("10. Finnish\n"); printf("11. Belgian (French/Flemish)\n"); printf("12. Swiss\n"); printf("13. TeX/LaTeX (output only)\n\n"); }; #if defined(__STDC__) || defined(__cplusplus) void show_8bit_options(void) #else void show_8bit_options() #endif { printf(" 0. No 8 bit characters.\n"); printf(" 1. PC8 For IBM-PC and most IBM-PC printers.\n"); printf(" 2. MNCS For multi-national character set on most DEC machines.\n"); printf(" AMIGA or the Amiga default character set.\n"); printf(" ECMA-94 or the ECMA-94 (Latin 1) character set.\n"); printf(" 3. ROMAN8 For most new printers, including the HP series and compatibles.\n"); printf(" 4. EPSON8 For most older printers and the Epson series.\n"); printf(" 5. PC850 MS-DOS PC Multilingual (Latin 1).\n"); printf(" 6. PC852 MS-DOS PC Slavic (Latin 2).\n"); printf(" 7. PC860 Portugal MS-DOS code page.\n"); printf(" 8. PC863 Canadian-French MS-DOS code page.\n"); printf(" 9. PC865 Nordic (Norway/Denmark) MS-DOS code page.\n"); printf("10. PCDN Denmark/Norway HP laser printers.\n"); printf("11. PRINTER Most other printers with limited 8-bit characters:\n"); printf(" Toshiba-1340, Qume-Sprint-11, Diablo-630.\n\n"); }; static char input_filename[256]; static char output_filename[256]; void UCSCU_prompt_input_options() { UCSCU_input_option.bit7_CS = -1; while ((UCSCU_input_option.bit7_CS <0) || (UCSCU_input_option.bit7_CS > 11)) { printf("\nSelect the 7-Bit ASCII/ISO character set of input file.\n"); show_7bit_options(); scanf("%d",&UCSCU_input_option.bit7_CS); UCSCU_input_option.bit7_CS -= 1; /* Because the program ranges 0-8 not 1-9 */ }; UCSCU_input_option.bit8_CS = -2; while ((UCSCU_input_option.bit8_CS < -1) || (UCSCU_input_option.bit8_CS > 10)) { printf("\nSelect the 8-bit character set of the input file.\n"); show_8bit_options(); scanf("%d",&UCSCU_input_option.bit8_CS); UCSCU_input_option.bit8_CS -= 1; }; }; void UCSCU_prompt_output_options() { UCSCU_output_option.bit7_CS = -1; while ((UCSCU_output_option.bit7_CS <0) || (UCSCU_output_option.bit7_CS > 12)) { printf("\nSelect the 7-Bit ASCII/ISO character set of output file.\n"); show_7bit_options(); scanf("%d",&UCSCU_output_option.bit7_CS); UCSCU_output_option.bit7_CS -= 1; /* Because the program ranges 0-8 not 1-9 */ }; UCSCU_output_option.bit8_CS = -2; while ((UCSCU_output_option.bit8_CS < -1) || (UCSCU_output_option.bit8_CS > 10)) { printf("\nSelect the 8-bit character set of the output file.\n"); show_8bit_options(); scanf("%d",&UCSCU_output_option.bit8_CS); UCSCU_output_option.bit8_CS -= 1; }; UCSCU_output_mode.prefer_7bit = -1; while ((UCSCU_output_mode.prefer_7bit < 0) || (UCSCU_output_mode.prefer_7bit > 1)) { printf("\nWhen outputing an accented letter or symbol, or using diacritical marks:\n"); printf("If the character appears both in the 7-bit and the 8-bit character set,\n"); printf("should the character from the 7-bit set be used instead of the 8-bit character?\n\n"); printf("Usually Yes when the output is intended for a printer or line terminal.\n"); printf("Usually No when the output is intended for a PC or workstation.\n"); printf("\nEnter 1 for yes, 0 for no.\n\n"); scanf("%d",&UCSCU_output_mode.prefer_7bit); }; UCSCU_output_mode.backspacing = -1; while ((UCSCU_output_mode.backspacing < 0) || (UCSCU_output_mode.backspacing > 3)) { printf("\nWhen an appropriate 7 or 8 bit accented letter is not available the\n"); printf("respective unaccented letter will be used, additional diacritical marks\n"); printf("can also be optionally added:\n"); printf(" 1. Add backspace character and diacritical mark (accent) I.e. A bs '\n"); printf(" Choose this option for output intended for a printer\n"); printf(" 2. Only print the unaccented letter.\n"); printf(" Choose this option for output line terminals or where adding\n"); printf(" additional characters would mess up formatted output.\n"); printf(" 3. Backspace only on lower case characters.\n"); printf(" Choose this option for older 9 pin printers where there is no\n"); printf(" space above capital characters to place the diacritical mark.\n"); printf(" 4. Add the diacritical mark, but not the backspace: I.e. A'\n"); printf(" Choose this option for output intended for text display where formatting\n"); printf(" and character positioning is not important.\n\n"); scanf("%d",&UCSCU_output_mode.backspacing); UCSCU_output_mode.backspacing -= 1; }; UCSCU_output_mode.graphics = -1; while ((UCSCU_output_mode.graphics < 0) || (UCSCU_output_mode.graphics > 2)) { printf("\nWhen a graphics character or special symbol is not available in the\n"); printf("target character set, the converter can attempt to draw the character\n"); printf("by using characters that are available by backspacing and typing over\n"); printf("characters. The quality of the results will vary depending on the device:\n\n"); printf(" 1. Try to draw the character using multiple characters.\n"); printf(" This option should only be used for output intended for printers.\n"); printf(" 2. Mark the graphic using a single question mark.\n"); printf(" Use this option where it would be helpful to see where graphics characters\n"); printf(" would be positioned. Note that line drawing characters will be replaced\n"); printf(" with plus for intersections, tees and corners, minus and bar for lines.\n"); printf(" 3. No graphics - use space.\n"); printf(" Use this option if drawing replacement graphics is unacceptable.\n"); scanf("%d",&UCSCU_output_mode.graphics); UCSCU_output_mode.graphics -=1; }; }; void UCSCU_prompt_options() { printf("\nEnter the name of the input text file\n"); gets(input_filename); UCSCU_input_option.filename = input_filename; UCSCU_prompt_input_options(); printf("\nEnter the name of the output text file\n"); scanf("%s",output_filename); UCSCU_output_option.filename = output_filename; UCSCU_prompt_output_options(); }; #if defined(__STDC__) || defined(__cplusplus) void UCSCU_show_usage(void) #else void UCSCU_show_usage() #endif { #ifdef UCSCU_STANDALONE printf("\nNon-interactive usage:\n"); printf(" ucscu option INPUT inname 7bit 8bit OUTPUT outname 7bit 8bit\n"); printf("\n inname and outname are the input and output text files.\n"); printf("inname and or outname may be a - hypen to indicate stdin or stdout.\n"); printf("\nA 7-bit and an 8-bit character set must be choosen for both files:\n"); #endif printf("The 7-Bit ASCII/ISO character set may be one of:\n"); printf(" ENGLISH FINNISH SWISS FRENCH PORTUGUESE\n"); printf(" ITALIAN SPANISH DUTCH SWEDISH\n"); printf(" NORDIC (Norwegian and Danish\n"); printf(" BELGIAN (French and Flemish)\n"); printf(" GERMAN (Also Austrian)\n"); printf(" TEX (Output TeX accent format)\n"); printf("The 8-bit international character set may be one of:\n"); printf(" DEC ECMA94 AMIGA ROMAN EPSON QUME TOSHIBA DIABLO\n"); printf(" PC8 PC850 PC852 PC860 PC863 PC865 PC8DN\n"); printf(" or NONE to for 7-bit ISO or ASCII representations.\n"); printf("Back spacing options: BS_NORMAL BS_NEVER BS_NOT_CAP BS_OMIT\n"); printf("Graphics draw options: GR_NORMAL GR_MARK GR_NONE\n"); printf("7-Bit selection preference : PREFER7BIT\n"); #ifdef UCSCU_STANDALONE printf("\nInteractive usage: ucscu\n\n"); printf("Try running the interactive mode for additional documentation\n"); #endif }; #if defined(__STDC__) || defined(__cplusplus) void UCSCU_parse_command_line(int argc,char *argv[]) #else void UCSCU_parse_command_line(argc,argv) int argc; char *argv[]; #endif { int arg; int IO_option = 0; for (arg = 1; arg < argc; arg++) { if (strcmp(argv[arg],"ENGLISH") == 0) {if (IO_option)UCSCU_input_option.bit7_CS = CS_ENGLISH7; else UCSCU_output_option.bit7_CS = CS_ENGLISH7; } else if (strcmp(argv[arg],"GERMAN") == 0) {if (IO_option)UCSCU_input_option.bit7_CS = CS_GERMAN7; else UCSCU_output_option.bit7_CS = CS_GERMAN7; } else if (strcmp(argv[arg],"DUTCH") == 0) {if (IO_option)UCSCU_input_option.bit7_CS = CS_DUTCH7; else UCSCU_output_option.bit7_CS = CS_DUTCH7; } else if (strcmp(argv[arg],"FRENCH") == 0) {if (IO_option)UCSCU_input_option.bit7_CS = CS_FRENCH7; else UCSCU_output_option.bit7_CS = CS_FRENCH7; } else if (strcmp(argv[arg],"SWEDISH") == 0) {if (IO_option)UCSCU_input_option.bit7_CS = CS_SWEDISH7; else UCSCU_output_option.bit7_CS = CS_SWEDISH7; } else if (strcmp(argv[arg],"NORDIC") == 0) {if (IO_option)UCSCU_input_option.bit7_CS = CS_NORDIC7; else UCSCU_output_option.bit7_CS = CS_NORDIC7; } else if (strcmp(argv[arg],"ITALIAN") == 0) {if (IO_option)UCSCU_input_option.bit7_CS = CS_ITALIAN7; else UCSCU_output_option.bit7_CS = CS_ITALIAN7; } else if (strcmp(argv[arg],"SPANISH") == 0) {if (IO_option)UCSCU_input_option.bit7_CS = CS_SPANISH7; else UCSCU_output_option.bit7_CS = CS_SPANISH7; } else if (strcmp(argv[arg],"PORTUGUESE")== 0) {if (IO_option)UCSCU_input_option.bit7_CS = CS_PORTUGUESE7; else UCSCU_output_option.bit7_CS = CS_PORTUGUESE7; } else if (strcmp(argv[arg],"FINNISH") == 0) {if (IO_option)UCSCU_input_option.bit7_CS = CS_FINNISH7; else UCSCU_output_option.bit7_CS = CS_FINNISH7; } else if (strcmp(argv[arg],"BELGIAN") == 0) {if (IO_option)UCSCU_input_option.bit7_CS = CS_BELGIAN7; else UCSCU_output_option.bit7_CS = CS_BELGIAN7; } else if (strcmp(argv[arg],"SWISS") == 0) {if (IO_option)UCSCU_input_option.bit7_CS = CS_SWISS7; else UCSCU_output_option.bit7_CS = CS_SWISS7; } else if (strcmp(argv[arg],"TEX") == 0) {if (IO_option)UCSCU_input_option.bit7_CS = CS_TeX; else UCSCU_output_option.bit7_CS = CS_TeX; } else if (strcmp(argv[arg],"NONE") == 0) {if (IO_option)UCSCU_input_option.bit8_CS = CS_NONE; else UCSCU_output_option.bit8_CS = CS_NONE; } else if (strcmp(argv[arg],"DEC") == 0) {if (IO_option)UCSCU_input_option.bit8_CS = CS_DEC8; else UCSCU_output_option.bit8_CS = CS_DEC8; } else if (strcmp(argv[arg],"ECMA94") == 0) {if (IO_option)UCSCU_input_option.bit8_CS = CS_ECMA94; else UCSCU_output_option.bit8_CS = CS_ECMA94; } else if (strcmp(argv[arg],"AMIGA") == 0) {if (IO_option)UCSCU_input_option.bit8_CS = CS_AMIGA; else UCSCU_output_option.bit8_CS = CS_AMIGA; } else if (strcmp(argv[arg],"ROMAN") == 0) {if (IO_option)UCSCU_input_option.bit8_CS = CS_ROMAN8; else UCSCU_output_option.bit8_CS = CS_ROMAN8; } else if (strcmp(argv[arg],"EPSON") == 0) {if (IO_option)UCSCU_input_option.bit8_CS = CS_EPSON8; else UCSCU_output_option.bit8_CS = CS_EPSON8; } else if (strcmp(argv[arg],"QUME") == 0) {if (IO_option)UCSCU_input_option.bit8_CS = CS_QUME_SPRINT_11; else UCSCU_output_option.bit8_CS = CS_QUME_SPRINT_11; } else if (strcmp(argv[arg],"TOSHIBA") == 0) {if (IO_option)UCSCU_input_option.bit8_CS = CS_TOSHIBA_1340; else UCSCU_output_option.bit8_CS = CS_TOSHIBA_1340; } else if (strcmp(argv[arg],"DIABLO") == 0) {if (IO_option)UCSCU_input_option.bit8_CS = CS_DIABLO_630; else UCSCU_output_option.bit8_CS = CS_DIABLO_630; } else if (strcmp(argv[arg],"PC8") == 0) {if (IO_option)UCSCU_input_option.bit8_CS = CS_PC8; else UCSCU_output_option.bit8_CS = CS_PC8; } else if (strcmp(argv[arg],"PC850") == 0) {if (IO_option)UCSCU_input_option.bit8_CS = CS_PC850; else UCSCU_output_option.bit8_CS = CS_PC850; } else if (strcmp(argv[arg],"PC852") == 0) {if (IO_option)UCSCU_input_option.bit8_CS = CS_PC852; else UCSCU_output_option.bit8_CS = CS_PC852; } else if (strcmp(argv[arg],"PC860") == 0) {if (IO_option)UCSCU_input_option.bit8_CS = CS_PC860; else UCSCU_output_option.bit8_CS = CS_PC860; } else if (strcmp(argv[arg],"PC863") == 0) {if (IO_option)UCSCU_input_option.bit8_CS = CS_PC863; else UCSCU_output_option.bit8_CS = CS_PC863; } else if (strcmp(argv[arg],"PC865") == 0) {if (IO_option)UCSCU_input_option.bit8_CS = CS_PC865; else UCSCU_output_option.bit8_CS = CS_PC865; } else if (strcmp(argv[arg],"PC8DN") == 0) {if (IO_option)UCSCU_input_option.bit8_CS = CS_PC8DN; else UCSCU_output_option.bit8_CS = CS_PC8DN; } else if (strcmp(argv[arg],"BS_NORMAL") == 0) UCSCU_output_mode.backspacing = BS_NORMAL; else if (strcmp(argv[arg],"BS_NEVER") == 0) UCSCU_output_mode.backspacing = BS_NEVER; else if (strcmp(argv[arg],"BS_NOT_CAP")== 0) UCSCU_output_mode.backspacing = BS_NOT_CAP; else if (strcmp(argv[arg],"BS_OMIT") == 0) UCSCU_output_mode.backspacing = BS_OMIT; else if (strcmp(argv[arg],"GR_NORMAL") == 0) UCSCU_output_mode.graphics = GR_NORMAL; else if (strcmp(argv[arg],"GR_MARK") == 0) UCSCU_output_mode.graphics = GR_MARK; else if (strcmp(argv[arg],"GR_NONE") == 0) UCSCU_output_mode.graphics = GR_NONE; else if (strcmp(argv[arg],"PREFER7BIT")== 0) UCSCU_output_mode.prefer_7bit = 1; else if (strcmp(argv[arg],"OUTPUT") == 0) IO_option = 0; else if (strcmp(argv[arg],"INPUT") == 0) IO_option = 1; #ifdef UCSCU_STANDALONE else if (IO_option) UCSCU_input_option.filename=argv[arg]; else UCSCU_output_option.filename=argv[arg]; #endif }; }; #ifdef UCSCU_STANDALONE #if defined(__STDC__) || defined(__cplusplus) void UCSCU_init(void) #else void UCSCU_init() #endif #else #if defined(__STDC__) || defined(__cplusplus) void UCSCU_init(int input_bit7_CS, int input_bit8_CS, int output_bit7_CS, int output_bit8_CS, int outmode_quiet, int outmode_prefer7_bit, int outmode_backspacing, int outmode_graphics) #else void UCSCU_init (input_bit7_CS,input_bit8_CS,output_bit7_CS,output_bit8_CS, outmode_quiet,outmode_prefer7_bit,outmode_backspacing,outmode_graphics) int input_bit7_CS; int input_bit8_CS; int output_bit7_CS; int output_bit8_CS; int outmode_quiet; int outmode_prefer7_bit; int outmode_backspacing; int outmode_graphics; #endif #endif { #ifndef UCSCU_STANDALONE UCSCU_input_option.bit7_CS = input_bit7_CS; UCSCU_input_option.bit8_CS = input_bit8_CS; UCSCU_output_option.bit7_CS = output_bit7_CS; UCSCU_output_option.bit8_CS = output_bit8_CS; UCSCU_output_mode.quiet = outmode_quiet; UCSCU_output_mode.prefer_7bit = outmode_prefer7_bit; UCSCU_output_mode.backspacing = outmode_backspacing; UCSCU_output_mode.graphics = outmode_graphics; #endif if ((UCSCU_input_option.bit8_CS == CS_PC850) || (UCSCU_output_option.bit8_CS == CS_PC850)) copy_CS(CS_PC8,CS_PC850); if ((UCSCU_input_option.bit8_CS == CS_PC852) || (UCSCU_output_option.bit8_CS == CS_PC852)) copy_CS(CS_PC8,CS_PC852); if ((UCSCU_input_option.bit8_CS == CS_PC860) || (UCSCU_output_option.bit8_CS == CS_PC860)) copy_CS(CS_PC8,CS_PC860); if ((UCSCU_input_option.bit8_CS == CS_PC863) || (UCSCU_output_option.bit8_CS == CS_PC863)) copy_CS(CS_PC8,CS_PC863); if ((UCSCU_input_option.bit8_CS == CS_PC865) || (UCSCU_output_option.bit8_CS == CS_PC865)) copy_CS(CS_PC8,CS_PC865); if ((UCSCU_input_option.bit8_CS == CS_PC8DN) || (UCSCU_output_option.bit8_CS == CS_PC8DN)) copy_CS(CS_PC8,CS_PC8DN); UCSCU_do_direct_conversion = setup_direct_conversion(); #ifdef UCSCU_STANDALONE if (!UCSCU_output_mode.quiet) printf("Processing file\n"); #endif }; #ifdef UCSCU_STANDALONE #ifdef VMS #if defined(__STDC__) || defined(__cplusplus) main(int argc, char *argv[]) #else main(argc,argv) int argc; char *argv[]; #endif #else #if defined(__STDC__) || defined(__cplusplus) int main(int argc, char *argv[]) #else void main(argc,argv) int argc; char *argv[]; #endif #endif #else #if defined(__STDC__) || defined(__cplusplus) /* Returns 0 if successfull 1 if failed */ int UCSCU_file(char *input_filename, char *output_filename) #else int UCSCU_file(input_filename,output_filename) char *input_filename; char *output_filename; #endif #endif { int curr_char; #ifdef UCSCU_STANDALONE if (argc == 1) UCSCU_prompt_options(); else if (argc < 3) { UCSCU_show_usage(); exit(UCSCU_FAILED); } else { UCSCU_output_mode.quiet = 1; UCSCU_parse_command_line(argc,argv); }; #else strcpy(UCSCU_input_option.filename,input_filename); strcpy(UCSCU_output_option.filename,output_filename); #endif if (strcmp(UCSCU_input_option.filename,UCSCU_output_option.filename) == 0) #ifdef UCSCU_STANDALONE if (strcmp(UCSCU_input_option.filename,"-") != 0) { printf("Cannot use same name for input and output file\n"); exit(UCSCU_FAILED); }; #else return(UCSCU_FAILED); #endif UCSCU_input_option.file = #ifdef UCSCU_STANDALONE (strcmp(UCSCU_input_option.filename,"-") == 0) ? stdin : #endif fopen(UCSCU_input_option.filename,READMODE); if (UCSCU_input_option.file == 0) #ifdef UCSCU_STANDALONE { printf("Unable to open input file %s\n",UCSCU_input_option.filename); exit(UCSCU_FAILED); }; #else return(UCSCU_FAILED); #endif UCSCU_output_option.file = #ifdef UCSCU_STANDALONE (strcmp(UCSCU_output_option.filename,"-") == 0) ? stdout : #endif fopen(UCSCU_output_option.filename,WRITEMODE); if (UCSCU_output_option.file == 0) #ifdef UCSCU_STANDALONE { printf("Unable to open output file %s\n",UCSCU_output_option.filename); exit(UCSCU_FAILED); }; if (UCSCU_output_option.file == stdout) UCSCU_output_mode.quiet = 1; if (!UCSCU_output_mode.quiet) printf("Setting up PC character sets\n"); UCSCU_init(); #else return(UCSCU_FAILED); #endif curr_char = UCSCU_do_direct_conversion ? in_char() : in_symbol(); while (curr_char) { fprintf(UCSCU_output_option.file,"%s",UCSCU_do_direct_conversion ? direct_conversion[curr_char] : UCSCU_char(curr_char)); #ifdef UCSCU_STANDALONE if (!UCSCU_output_mode.quiet && (curr_char == '\n')) { printf("\r%d ",UCSCU_line_count++); fflush(stdout); }; curr_char = UCSCU_do_direct_conversion ? in_char() : in_symbol(); #else UCSCU_line_count += 1; #endif }; if (UCSCU_input_option.file != stdin) fclose(UCSCU_input_option.file); if (UCSCU_output_option.file != stdout) fclose(UCSCU_output_option.file); #ifdef UCSCU_STANDALONE #if defined(__STDC__) || defined(__cplusplus) return(UCSCU_SUCCEEDED); #else exit(UCSCU_SUCCEEDED); #endif #else return(UCSCU_SUCCEEDED); #endif }; ) || (UCSCU_output_option.bit8_CS == CS_PC850)) copy_CS(CS_PC8,CS_PC850); if ((UCSCU_input_option.bit8_CS == CS_PC852) || (UCSCU_output_option.bit8_CS == CS_PC852)) copy_CS(CS_PC8,CS_PC852); if latex2hyp/rlib/ucscu.h000644 001017 000764 00000014640 05645340537 016432 0ustar00rnelsonfaculty000000 000000 /* This version of UCSCU is becoming obsolute. If you wish to use UCSCU in the development of new applications, try my new version. The new version offers the following features: Hundreds of new characters. Better support for TeX representations. You can process a whole file, or a given string. */ #ifndef char_8bit #ifdef __BCPLUSPLUS__ #define char_8bit char #else #define char_8bit unsigned char #endif #endif #ifdef __cplusplus #define const_char const char #else #define const_char char #endif #define UCSCU_END_TABLE 0 enum symbols{ A_acute = 257, a_acute, A_breve, a_breve, A_tail, a_tail, A_circle, a_circle, A_circumflex, a_circumflex, A_diaeresis, a_diaeresis, A_E, a_e, A_grave, a_grave, A_macron, a_macron, A_tilde, a_tilde, a_underlined, B_german_S, C_acute, c_acute, C_backwards, C_chz, c_chz, C_cedilla, c_cedilla, D_bar, d_bar, D_chz, d_chz, E_acute, e_acute, E_breve, e_breve, E_chz, e_chz, E_tail, e_tail, E_circumflex, e_circumflex, E_diaeresis, e_diaeresis, E_grave, e_grave, E_macron, e_macron, I_acute, i_acute, I_circumflex, i_circumflex, I_diaeresis, i_diaeresis, I_grave, i_grave, I_P, I_p, i_j, J_circumflex, j_circumflex, H_circumflex, h_circumflex, L_acute, l_acute, L_chz, l_chz, L_slash, l_slash, L_dot, l_dot, N_acute, n_acute, N_chz, n_chz, N_tilde, n_tilde, O_acuteacute, o_acuteacute, O_acute, o_acute, O_circumflex, o_circumflex, O_diaeresis, o_diaeresis, O_E, o_e, O_grave, o_grave, O_slash, o_slash, O_tilde, o_tilde, o_underlined, R_acute, r_acute, R_chz, r_chz, S_acute, s_acute, S_cedilla, s_cedilla, S_tail, s_tail, S_circumflex, s_circumflex, S_breve, s_breve, S_chz, s_chz, T_cedilla, t_cedilla, T_chz, t_chz, U_acute, u_acute, U_acuteacute, u_acuteacute, U_breve, u_breve, U_circle, u_circle, U_circumflex, u_circumflex, U_diaeresis, u_diaeresis, U_grave, u_grave, Y_acute, y_acute, Y_diaeresis, y_diaeresis, Z_acute, z_acute, Z_chz, z_chz, Z_plus, z_plus, /* Diacritical marks */ DM_macron, DM_center_bar, DM_under_bar, DM_circumflex, DM_breve, DM_chz, DM_tilde, DM_diaeresis, DM_cedilla, DM_tail, DM_acute, DM_grave, DM_virgule, DM_parallels, DM_circle, DM_plus, DM_acuteacute, /* Text symbols */ SYM_daggar, SYM_double_daggar, SYM_paragraph, SYM_section, SYM_big_asterisk, SYM_house, /* Buisness */ SYM_copyright, SYM_registered, SYM_pounds, SYM_yen, SYM_cents, SYM_trade_mark, SYM_francs, SYM_Tx, SYM_Pt, SYM_degrees_C, SYM_degrees_F, SYM_degrees, SYM_X_circle, /* Punctuation */ SYM_UD_question, SYM_UD_exclamation, SYM_double_exclamation, SYM_french_begin_quote, SYM_french_end_quote, SYM_bar_left, SYM_bar_right, SYM_split_vert_bar, SYM_vert_bar, /* directional */ SYM_arrow_left, SYM_arrow_right, SYM_arrow_leftright, SYM_arrow_down, SYM_arrow_up, SYM_arrow_updown, SYM_arrow_updown_under, SYM_triangle_left, SYM_triangle_right, SYM_triangle_up, SYM_triangle_down, SYM_triangle_left_solid, SYM_triangle_right_solid, SYM_triangle_up_solid, SYM_triangle_down_solid, TRIANGLE_ULC, TRIANGLE_LLC, TRIANGLE_URC, TRIANGLE_LRC, /* Graphics */ SYM_bar, SYM_diamond_open, SYM_square, SYM_filled_square, SYM_small_circle, SYM_small_circle_rvrsd, SYM_circle, SYM_filled_circle, SYM_largedot_rvrsd, SYM_largedot, SYM_cdot, SYM_cpoint, SYM_smiley_white, SYM_smiley_black, SYM_heart, SYM_diamond, SYM_club, SYM_spade, SYM_male, SYM_female, /* 12 Quarter Block graphics, 34 */ QBG_1, QBG_2, QBG_3, QBG_4, QBG_12, QBG_13, QBG_14, QBG_23, QBG_24, QBG_34, QBG_123, QBG_134, QBG_124, QBG_234, QBG_1234, /* circle quarters */ CQ_1, CQ_2, CQ_3, CQ_4, /* checker board */ CB_low, CB_med, CB_high, /* Line graphics */ /* V vertical, H Horizontal, T Tee, B Bar, C Corner, I Intersection, L Left, R Right, U Up, D Down, s single, d double, */ LG_sVB, LG_sLT, LG_dLsT, LG_sLdT, LG_sLdDC, LG_dLsDC, LG_dLT, LG_dVB, LG_dLDC, LG_dLUC, LG_sLdUC, LG_dLsUC, LG_sLDC, LG_sUsRC, LG_sUT, LG_sDT, LG_sRT, LG_sHB, LG_sUDLRI, LG_dRsT, LG_sRdT, LG_dURC, LG_dDRC, LG_dUT, LG_dDT, LG_dRT, LG_dHB, LG_dUDLRI, LG_sUdT, LG_dUsT, LG_sDdT, LG_dDsT, LG_dUsRC, LG_sUdRC, LG_sDdRC, LG_dDsRC, LG_dUDsLRI, LG_sUDdLRI, LG_sULC, LG_sDRC, /* Math */ SYM_one_half, SYM_one_quarter, SYM_three_quarters, SYM_exponent_1, SYM_exponent_2, SYM_exponent_3, SYM_exponent_n, SYM_GTE, SYM_LTE, SYM_plus_minus, SYM_infinity, SYM_equivelence, SYM_intersection, SYM_union, SYM_approximate, SYM_root, SYM_times, SYM_overline_x, SYM_division, /* Music */ SYM_quaver, SYM_quaverquaver, /* Greek */ GRK_alpha, GRK_beta, GRK_gamma, GRK_delta, GRK_epsilon, GRK_zeta, GRK_eta, GRK_theta, GRK_iota, GRK_kappa, GRK_lambda, GRK_mu, GRK_nu, GRK_xi, GRK_pi, GRK_omicron, GRK_rho, GRK_sigma, GRK_tau, GRK_upsilon, GRK_phi, GRK_chi, GRK_psi, GRK_omega, GRK_Alpha, GRK_Beta, GRK_Gamma, GRK_Delta, GRK_Epsilon, GRK_Zeta, GRK_Eta, GRK_Theta, GRK_Iota, GRK_Kappa, GRK_Lambda, GRK_Mu, GRK_Nu, GRK_Xi, GRK_Pi, GRK_Omicron, GRK_Rho, GRK_Sigma, GRK_Tau, GRK_Upsilon, GRK_Phi, GRK_Chi, GRK_Psi, GRK_Omega, GRK_UDOmega }; struct UCSCU_TeX_layout { char *TeX; int symbol; }; extern struct UCSCU_TeX_layout UCSCU_TeX_table[]; struct UCSCU_HTML_layout { char *HTML; int symbol; }; extern struct UCSCU_HTML_layout UCSCU_HTML_table[]; #ifndef UCSCU_STANDALONE #if defined(__STDC__) || defined(__cplusplus) char *UCSCU_string(char *instr,char *outstr); char_8bit *UCSCU_char(int cs_code); int UCSCU_file(char *input_filename, char *output_filename); void UCSCU_prompt_input_options(void); void UCSCU_prompt_output_options(void); void UCSCU_prompt_options(void); void UCSCU_parse_command_line(int argc,char *argv[]); void UCSCU_show_usage(void); char *UCSCU_lookup_code_HTML(int symbol); #else extern char *UCSCU_string(); extern char_8bit *UCSCU_char(); extern void UCSCU_prompt_input_options(); extern void UCSCU_prompt_output_options(); extern void UCSCU_prompt_options(); extern int UCSCU_file(); extern void UCSCU_parse_command_line(); extern void UCSCU_show_usage(); char *UCSCU_lookup_code_HTML(); #endif #endif YM_arrow_down, SYM_arrow_up, SYM_arrow_updown, SYM_arrow_updown_under, SYM_triangle_left, Slatex2hyp/ltx2hyp1.c000644 001017 000764 00000261162 05645340237 016046 0ustar00rnelsonfaculty000000 000000 /* Uncomment the following line for hardcoded phrases #define HARDCODE_PHRASES */ /* VMS users should #define VMS */ /* #define VMS */ /* MSDOS users should already have __MSDOS__ defined by the compiler otherwise it needs to be defined*/ /* #define __MSDOS__ */ /* This program uses my universal character set conversion and language cataloging libraries. You may need to add the current directory to the include path. For most UNIX compilers, the cc command option is -I. (<-with the period) */ #ifndef HARDCODE_PHRASES #include #endif #include #include /* When VERBOSE is defined, The sections of the document are displayed as they are processed, and cleanup progress indicators are shown. */ #define VERBOSE /* #include not implemented yet int print_device = TRIBUTE_ES; */ /* This file contains 8-Bit characters and should be transmitted UUENCODED. TeX2hyp.c This program converts LaTeX documents to TEXT documents. Labels and cross references produce hypertext links compatible with Borlands TurboVision help compilers. Refer to the file TeX2hyp.DOC This program is freely distributable, but not in the Public Domain. Do not distribute MODIFIED versions of this program. I reserve all rights in the distribution of the program. Written by Roger Nelson Biological Systems Engr. Dept. Washington State University Pullman, WA 99164-6120 rnelson@wsuaix.csc.wsu.edu Phone: (509)335-1578 FAX : (509)335-2722 Version history: 1.0 Jun 25 '93 1.01 Jul 2 '93 Added Previous topic links. 1.02 Jul 7 '93 Added more robust command line parsing. Added interactive file and option prompter. Added VMS compile options. Added 7BIT ISO character set selection. Added 8BIT multinational character set support. Now compiles under old C. Now look for fixup's in the LaTeX documents using the new %fixup command. Added label enumerations (section numbering of labels). Fixed bibliography label cross reference label positioning. 1.03 Jul 12 '93 Cleaned up some 8bit stuff. Added Amiga Topaz (Same as DEC MNCS. 1.04 Jul 14 '93 Cleaned up some bibliography stuff. Bibliography tabulation is now honoured. Part numbers were incorrectly being added to cross reference enumeration. Some valid special characters were not being allowed in label. Now accepts accent characters of the form: \"{u} as well as \"u. Ligatures such as: \t{ae} should also be processed ok. \newcommand of the form: \newcommand{\cmd}{replacement} should work, but not of the form: \newcommand{\cmd}[args]{replacement}. `` and '' now converted to ". ~ now converted to space. 1.05 Spt 30 '93 Added \bibliography. Added table of contents. More comprehensive character set conversion using universal character set conversion. Added pagination. Cleaned up line spacing. Added line breaking. 1.06 Oct 18 '93 Added index (\begin/\end{theindex} \indexspace. \item \subitem \subsubitem \subsubsubitem) Add foreign language translation. 1.07 Oct 22 '93 Fixed some compilation problems. Fixed line counting of verbatims 1.08 Spt 17 '94 Text attributes (\em \rm etc..) were putting spaces after left parens as in:({\em emphasised}) -> ( emphasised) Corrected section numbering when chapters not used. Renamed fixup file FIXUP.$$ for FIXUP.SS. For hypertext output, bibliography entries are no longer put on separate "pages". Preliminary HTML support, don't try to use it. 1.09 Oct 6 '94 Added Swedish Danish and French translations Under developement: 2.00 Read config.l2h configuration file. .l2h configuration file may be specified on command line. Add table commands. Printer device control. document styles: article report book document options twocolumn \pagenumbering */ /* One of the following hypertext readers may be defined: */ #define TR_STRAIGHTTEXT 0 #define TR_TURBOVISION 1 #define TR_HTML 2 #define TR_HTMLPLUS 3 #define TR_AGUIDE 4 #define TR_HYPRTEXT 5 #define TR_SMGL 6 #define HTML() (textreader == TR_HTML) || (textreader == TR_HTMLPLUS) /* HTML Tags used when doing TR_HTML HTML /HTML HTMLPLUS Tags used when doing TR_HTMLPLUS HTMLPLUS /HTMLPLUS Tags used for either HTML or HTMLPLUS HEAD /HEAD BODY /BODY H1-H6 /H1-/H6 b em i code u /b /em /i /code /u listing /listing p /p */ int textreader = TR_STRAIGHTTEXT; #ifdef __MSDOS__ #define WRITEMODE "wt" #define READMODE "rt" #else #define WRITEMODE "w" #define READMODE "r" #endif #include #include #include #include /* This may need to be replaced with malloc.h in UNIX */ #define normal_FONT 0 #define rm_FONT 1 #define sl_FONT 2 #define bf_FONT 3 #define em_FONT 4 #define it_FONT 5 #define tt_FONT 6 #define sf_FONT 7 #define sc_FONT 8 #define underline_FONT 10 #define INDENTATION 2 #define START_REF_MARKER 1 #define END_REF_MARKER 2 #define TOC_MARKER 3 #define BEGIN_DOC_MARKER 4 #define EXT_TEX ".tex" #define EXT_BBL ".bbl" #define HARD_NEWLINE 30 #define HARD_SPACE 31 #define NO_PREV_NEXT 0 #define GEN_PREV_NEXT 1 #define ENV_FLAG_HORIZ 1 /* If horizontal constraint */ #define ENV_FLAG_VERT 2 /* If vertical constraint */ #define ENV_FLAG_CENTER 4 /* If text is to be centered */ #define ENV_FLAG_RESOLVED 8 /* If cross references resolved */ #define ENV_FLAG_FIXEDUP 16 /* If fixups completed */ #define ENV_TYPE_FOOTNOTE 1 /* Footnote text */ #define ENV_TYPE_TABULAR 2 /* Tabular environment */ #define ENV_TYPE_EQUATION 3 /* Equation or subequation */ struct environment_layout { /* When adding slots, make sure to add to new_environment() */ int font; unsigned int type; /* One of environment types */ unsigned int flags; /* Flag bits */ int indent; /* # chars from left most print char pos 0 */ int pref_width; /* # chars to limit width to (usually for right margin) 0 if no constraint */ int pref_length; /* # lines to limit length to 0 if no constraint */ int act_width; /* The longest line length */ int num_lines; /* Number of lines if some sort of list. 0 if just a text string */ }; #define MAX_enumeration 40 struct label_layout { char_8bit name[30]; /* The label ID */ char_8bit enumeration[MAX_enumeration]; /* The section number */ /* char_8bit desc[255]; The description of the section */ struct label_layout *next; }; struct fixup_layout { char_8bit mathmode[80]; char_8bit replacement[80]; struct fixup_layout *next; }; struct newcommand_layout { char_8bit newcommand[80]; char_8bit replacement[80]; struct newcommand_layout *next; }; FILE *fixup; FILE *tocfile; FILE *idxfile; struct fixup_layout *fixups = 0; struct label_layout *labels = 0; struct newcommand_layout *newcommands = 0; struct environment_layout *environ_stack[100]; int environ_SP=0; int AT_END = 0; int started = 0; char_8bit input_filename[256]; char_8bit output_filename[256]; FILE *output_file=0; int inc_indentlevel_after_line = 0; int footnote_index = 0; int HTlinenum = 0; int indentlevel = 0; int bibliography_indentlevel = 0; int indentplus = 0; int rightmargin = 76; int partnum = 0; int chapternum = 0; int sectionnum = 0; int subsectionnum = 0; int subsubsectionnum = 0; int in_appendix = 0; int in_table = 0; int in_equation = 0; int in_bibliography = 0; int equationnum = 0; int tablenum = 0; int build_label = 0; char_8bit label[256]; int label_pos = 0; int list_level=0; int list_count[20]; int list_kind[20]; int in_center; int in_brackets; int makeindex = 0; /* 1 = enable index generation */ int tableofcontents = 0; /* 1 = enable table of contents */ char language_name_code[30]; /* Page layout: */ int page_width = 96; /* The number of characters that will fit on a page at Elite */ int page_length = 60; /* The number of lines that can be printed by printer (usually before the perforation skip may take effect).*/ int left_margin = 0; /* Number of spaces to indent the entire doc. */ int right_margin = 0; /* Number of spaces to indent right side of page for entire doc. */ int top_margin = 0; /* Number of lines to move down page on formfeed */ int bottom_margin = 0; /* Number of space to leave at bottom of page */ int line_width = 80; /* Number of characters to print on line computed as page_width - (leftM -rightM)*/ int lines_per_page = 60; /* Number of lines to print on page computed and page_length - (topM-botM) */ int page_num = 1; int line_num = 1; int break_lines = 0; /* Do automatic line breaking */ int break_pages = 0; char tocline[255]; int tocline_pos = 0; int bullets[6] = { SYM_filled_square, SYM_cdot, SYM_cpoint, '+','-'}; /* "Oo.+-", "þùú+-", */ #define ITEMIZE_LIST 1 #define ENUMERATE_LIST 2 #define DESCRIPTION_LIST 3 #define BIBLIOGRAPHY_LIST 4 #define INDEX_LIST 5 #if defined(__STDC__) || defined(__cplusplus) struct environment_layout *new_environment ( int font, unsigned int type, unsigned int flags, int indent, int pref_width, int pref_length, int act_width, int num_lines ) #else struct environment_layout *new_environment (font,type,flags,indent,pref_width,pref_length,act_width,num_lines) int font; unsigned int type; unsigned int flags; int indent; int pref_width; int pref_length; int act_width; int num_lines; #endif { struct environment_layout *env; if ((env = (struct environment_layout *)malloc(sizeof(struct environment_layout))) != 0) { env->font = font; env->type = type; env->flags = flags; env->indent = indent; env->pref_width = pref_width; env->pref_length = pref_length; env->act_width = act_width; env->num_lines = num_lines; }; return(env); }; #if defined(__STDC__) || defined(__cplusplus) void process_text(FILE *infile); void process_text_str(char *textstr); void process_input(FILE *infile, char *extension); void process_minienvironment(FILE *infile,struct environment_layout *curr_environ); #else extern void process_text(); extern void process_text_str(); extern void process_input(); extern void process_minienvironment(); #endif static char_8bit out_line[256]; static int outlinepos = 0; static int startlastwordpos = 0; #if defined(__STDC__) || defined(__cplusplus) void print_page_num(FILE *outfile) #else void print_page_num(outfile) FILE *outfile; #endif { int c; char numstr[10]; if (line_num < lines_per_page) while (line_num++ < lines_per_page) fprintf(outfile,"\n"); sprintf(numstr,"%d",page_num); for (c = 0; c < left_margin; c++) fputc(' ',outfile); for (c = 0; (c < line_width) && (c < (line_width - strlen(numstr))/2); c++) fputc(' ',outfile); fprintf(outfile,"%s",numstr); fprintf(outfile,"\f\n"); page_num += 1; line_num = 1; }; #if defined(__STDC__) || defined(__cplusplus) void check_page_break(FILE *outfile) #else void check_page_break(outfile) FILE *outfile; #endif { if (line_num > lines_per_page) print_page_num(outfile); }; #if defined(__STDC__) || defined(__cplusplus) void dumpline(void) #else void dumpline() #endif { int i,j; for (i = 1; i<= indentlevel; i++) for (j = 0; j <= INDENTATION; j++) fputc(' ',output_file); for (i = 0; i < (startlastwordpos ? (startlastwordpos) : outlinepos) ;i++) fputc(out_line[i],output_file); fputc('\n',output_file); line_num += 1; check_page_break(output_file); if (inc_indentlevel_after_line) switch (list_kind[list_level]) { case BIBLIOGRAPHY_LIST : indentlevel = bibliography_indentlevel; break; case INDEX_LIST : indentlevel = 0; break; default : indentlevel += 1; break; }; inc_indentlevel_after_line = 0; if (startlastwordpos) { for (i = startlastwordpos; i <= outlinepos; i++) { out_line[i-startlastwordpos] = out_line[i]; out_line[i-startlastwordpos+1] = 0; }; outlinepos = i -startlastwordpos -1; startlastwordpos = 0; } else { outlinepos = 0; out_line[0] = 0; }; }; #if defined(__STDC__) || defined(__cplusplus) void process_newpage(void) #else void process_newpage() #endif { dumpline(); print_page_num(output_file); }; int add_char_buffer_mode = 0; char_8bit add_char_buffer[1024]; int add_char_bufferpos = 0; #if defined(__STDC__) || defined(__cplusplus) void add_char(char_8bit outchar) #else void add_char(outchar) char_8bit outchar; #endif { static char_8bit lastoutchar; if ((build_label) && (label_pos < 255)) { label[label_pos++] = outchar; label[label_pos] = 0; }; if (add_char_buffer_mode) { add_char_buffer[add_char_bufferpos++] = outchar; add_char_buffer[add_char_bufferpos] = 0; } else { switch (outchar) { case HARD_NEWLINE : startlastwordpos =0; dumpline(); check_page_break(output_file); break; case HARD_SPACE : out_line[outlinepos++] = ' '; if (tocline_pos && (tocline_pos < 255)) tocline[tocline_pos++] = outchar; break; case ' ' : case 9 : outchar = ' '; if (outlinepos && (lastoutchar != ' ')) { out_line[outlinepos++] = outchar; if (tocline_pos && (tocline_pos < 255)) tocline[tocline_pos++] = outchar; } startlastwordpos = outlinepos; break; default : if (((outlinepos + indentlevel * INDENTATION) > rightmargin) && break_lines) dumpline(); out_line[outlinepos++] = outchar; if (tocline_pos && (tocline_pos < 255)) tocline[tocline_pos++] = outchar; break; }; out_line[outlinepos] = 0; } lastoutchar = outchar; }; #if defined(__STDC__) || defined(__cplusplus) void add_chars(char_8bit *chars) #else void add_chars(chars) char_8bit *chars; #endif { int i; for (i = 0; i < strlen(chars); i++) add_char(chars[i]); }; #if defined(__STDC__) || defined(__cplusplus) int nextchar(FILE *infile) #else int nextchar(infile) FILE *infile; #endif { int ch; ch = fgetc(infile); ungetc(ch,infile); return(ch); }; int newline_just_printed = 0; #if defined(__STDC__) || defined(__cplusplus) void process_newline(void) #else void process_newline() #endif { if (HTML()) add_chars(" "); add_char(HARD_NEWLINE); newline_just_printed = 1; }; #define SPACE_CHAR 1 #define PUNCT_CHAR 2 #define ALPHANUM_CHAR 3 #if defined(__STDC__) || defined(__cplusplus) struct label_layout *lookup_label(char_8bit *label_name) #else struct label_layout *lookup_label(label_name) char_8bit *label_name; #endif { struct label_layout *curr; for (curr = labels; curr; curr = curr->next) if (strcmp(curr->name,label_name) == 0) return(curr); return(0); }; #if defined(__STDC__) || defined(__cplusplus) void add_label(char_8bit *label_name) #else void add_label(label_name) char_8bit *label_name; #endif { struct label_layout *label; label = lookup_label(label_name); if (!label) { label = (struct label_layout *)malloc(sizeof(struct label_layout)); if (label) { label->next = labels; labels = label; } else { printf("%s (add_label)",translate(L_Not_enough_memory)); getchar(); }; }; if (label) { char_8bit enumeration[MAX_enumeration]; if (in_table) sprintf(enumeration,"%s.%s",chapternum,tablenum); else if (in_equation) sprintf(enumeration,"%s.%s",chapternum,equationnum); else if (in_bibliography) strncpy(enumeration,add_char_buffer,MAX_enumeration-1); else { char tempnum[10]; enumeration[0] = 0; /* Don't put part numbers in cross reference if ((partnum) && (!in_appendix)) { sprintf(tempnum,"%d.",partnum); strcat(enumeration,tempnum); }; */ if (chapternum) { if (in_appendix) sprintf(tempnum,"%c.",chapternum-1+'A'); else sprintf(tempnum,"%d.",chapternum); strncat(enumeration,tempnum,MAX_enumeration); }; if (sectionnum) { sprintf(tempnum,"%d.",sectionnum); strncat(enumeration,tempnum,MAX_enumeration); }; if (subsectionnum) { sprintf(tempnum,"%d.",subsectionnum); strncat(enumeration,tempnum,MAX_enumeration); }; if (subsubsectionnum) { sprintf(tempnum,"%d.",subsectionnum); strncat(enumeration,tempnum,MAX_enumeration); }; }; strcpy(label->name,label_name); if (enumeration[strlen(enumeration)-1] == '.') enumeration[strlen(enumeration)-1] = 0; strcpy(label->enumeration,enumeration); }; }; #if defined(__STDC__) || defined(__cplusplus) void add_fixup(char_8bit *SmathS,char_8bit *replacement) #else void add_fixup(SmathS,replacement) char_8bit *SmathS; char_8bit *replacement; #endif { struct fixup_layout *fixup; fixup = (struct fixup_layout *)malloc(sizeof(struct fixup_layout)); if (fixup) { strcpy(fixup->mathmode,SmathS); strcpy(fixup->replacement,replacement); fixup->next = fixups; fixups = fixup; } else { printf("%s (add_fixup)",translate(L_Not_enough_memory)); getchar(); }; }; #if defined(__STDC__) || defined(__cplusplus) void add_newcommand(char_8bit *cmnd,char_8bit *replacement) #else void add_newcommand(cmnd,replacement) char_8bit *cmnd; char_8bit *replacement; #endif { struct newcommand_layout *newcmnd; newcmnd = (struct newcommand_layout *)malloc(sizeof(struct newcommand_layout)); if (newcmnd) { strcpy(newcmnd->newcommand,cmnd); strcpy(newcmnd->replacement,replacement); newcmnd->next = newcommands; newcommands= newcmnd; } else { printf("%s (newcommand)",translate(L_Not_enough_memory)); getchar(); }; }; #if defined(__STDC__) || defined(__cplusplus) char_8bit *lookup_fixup(char_8bit *SmathS) #else char_8bit *lookup_fixup(SmathS) char_8bit *SmathS; #endif { struct fixup_layout *curr; for (curr = fixups; curr ;curr = curr->next) if (strcmp(curr->mathmode,SmathS) == 0) return(curr->replacement); return(0); }; #if defined(__STDC__) || defined(__cplusplus) char_8bit *lookup_newcommand(char_8bit *cmnd) #else char_8bit *lookup_newcommand(cmnd) char_8bit *cmnd; #endif { struct newcommand_layout *curr; for (curr = newcommands; curr ;curr = curr->next) if (strcmp(curr->newcommand,cmnd) == 0) return(curr->replacement); return(0); }; #if defined(__STDC__) || defined(__cplusplus) char_8bit *readword(FILE *infile) #else char_8bit *readword(infile) FILE *infile; #endif { static char_8bit wordread[265]; int wordpos=0; static int charclass; static int nextcharclass; int charin; int nchar; int at_eof = 0; wordread[0] = 0; do { charin = fgetc(infile); if ((charin == EOF) || feof(infile)) { charin = 0; at_eof = 1; }; if (ispunct(charin)) charclass = PUNCT_CHAR; else if (isspace(charin)) charclass = SPACE_CHAR; else charclass = ALPHANUM_CHAR; wordread[wordpos++] = charin; wordread[wordpos] = 0; nchar = nextchar(infile); if (ispunct(nchar)) nextcharclass = PUNCT_CHAR; else if (isspace(nchar)) nextcharclass = SPACE_CHAR; else nextcharclass = ALPHANUM_CHAR; } while ((nextcharclass == charclass) && (!at_eof) && (nchar != EOF)); return(wordread); }; #if defined(__STDC__) || defined(__cplusplus) void process_appendix(FILE *infile) #else void process_appendix(infile) FILE *infile; #endif { in_appendix = 1; chapternum = 0; }; /* CPI table 10Pt If not avail \tiny 17 12 \scriptsize 17 12 \footnotesize 17 12 \small 12 17 \normalsize 12 10 or 17 \large 10 8 or 12 \Large 8.5 10 or 12 \LARGE 8.5 10 or 12 \huge 6 8 or 10 \Huge 5 6 or 8 */ #define pitch_tiny_on(outfile) #define pitch_tiny_off(outfile) #define pitch_small_on(outfile) #define pitch_small_off(outfile) #define pitch_normalsize_on(outfile) #define pitch_normalsize_off(outfile) #define pitch_large_on(outfile) #define pitch_large_off(outfile) #define pitch_Large_on(outfile) #define pitch_Large_off(outfile) #define pitch_LARGE_on(outfile) #define pitch_LARGE_off(outfile) #define pitch_huge_on(outfile) #define pitch_huge_off(outfile) #define pitch_Huge_on(outfile) #define pitch_Huge_off(outfile) /* Printer control not yet implemented #if defined(__STDC__) || defined(__cplusplus) void pitch_tiny_on(FILE *outfile) #else void pitch_tiny_on(outfile) #endif { if (ES_attribute(ES_17CPION,print_device)) ES_print_attribute(outfile,ES_17CPION,print_device); else if (ES_attribute(ES_12CPION,print_device)) ES_print_attribute(outfile,ES_12CPION,print_device); }; #if defined(__STDC__) || defined(__cplusplus) void pitch_tiny_off(FILE *outfile) #else void pitch_tiny_off(outfile) #endif { char *attr; if (ES_attribute(ES_17CPIOFF,print_device)) ES_print_attribute(outfile,ES_17CPIOFF,print_device); else if (ES_attribute(ES_12CPIOFF,print_device)) ES_print_attribute(outfile,ES_12CPIOFF,print_device); }; #define pitch_scriptsize_on(x) pitch_tiny_on(x) #define pitch_scriptsize_off(x) pitch_tiny_off(x) #define pitch_footnotesize_on(x) pitch_tiny_on(x) #define pitch_footnotesize_off(x) pitch_tiny_off(x) #if defined(__STDC__) || defined(__cplusplus) void pitch_small_on(FILE *outfile) #else void pitch_small_on(outfile) #endif { if (ES_attribute(ES_12CPION,print_device)) ES_print_attribute(outfile,ES_12CPION,print_device); else if (ES_attribute(ES_17CPION,print_device)) ES_print_attribute(outfile,ES_17CPION,print_device); }; #if defined(__STDC__) || defined(__cplusplus) void pitch_small_off(FILE *outfile) #else void pitch_small_off(outfile) #endif { if (ES_attribute(ES_12CPIOFF,print_device)) ES_print_attribute(outfile,ES_12CPIOFF,print_device); else if (ES_attribute(ES_17CPIOFF,print_device)) ES_print_attribute(outfile,ES_17CPIOFF,print_device); }; #if defined(__STDC__) || defined(__cplusplus) void pitch_normalsize_on(FILE *outfile) #else void pitch_normalsize_on(outfile) #endif { if (ES_attribute(ES_12CPION,print_device)) ES_print_attribute(outfile,ES_12CPION,print_device); else if (ES_attribute(ES_10CPION,print_device)) ES_print_attribute(outfile,ES_10CPION,print_device); else if (ES_attribute(ES_17CPION,print_device)) ES_print_attribute(outfile,ES_17CPION,print_device); }; #if defined(__STDC__) || defined(__cplusplus) void pitch_normalsize_off(FILE *outfile) #else void pitch_normalsize_off(outfile) #endif { if (ES_attribute(ES_12CPIOFF,print_device)) ES_print_attribute(outfile,ES_12CPIOFF,print_device); else if (ES_attribute(ES_10CPIOFF,print_device)) ES_print_attribute(outfile,ES_10CPIOFF,print_device); else if (ES_attribute(ES_17CPIOFF,print_device)) ES_print_attribute(outfile,ES_17CPIOFF,print_device); }; #if defined(__STDC__) || defined(__cplusplus) void pitch_large_on(FILE *outfile) #else void pitch_large_on(outfile) #endif { if (ES_attribute(ES_10CPION,print_device)) ES_print_attribute(outfile,ES_10CPION,print_device); else if (ES_attribute(ES_8CPION,print_device)) ES_print_attribute(outfile,ES_8CPION,print_device); else if (ES_attribute(ES_12CPION,print_device)) ES_print_attribute(outfile,ES_12CPION,print_device); }; #if defined(__STDC__) || defined(__cplusplus) void pitch_large_off(FILE *outfile) #else void pitch_large_off(outfile) #endif { if (ES_attribute(ES_10CPIOFF,print_device)) ES_print_attribute(outfile,ES_10CPIOFF,print_device); else if (ES_attribute(ES_8CPIOFF,print_device)) ES_print_attribute(outfile,ES_8CPIOFF,print_device); else if (ES_attribute(ES_12CPIOFF,print_device)) ES_print_attribute(outfile,ES_12CPIOFF,print_device); }; #if defined(__STDC__) || defined(__cplusplus) void pitch_Large_on(FILE *outfile) #else void pitch_Large_on(outfile) #endif { if (ES_attribute(ES_8CPION,print_device)) ES_print_attribute(outfile,ES_8CPION,print_device); else if (ES_attribute(ES_10CPION,print_device)) ES_print_attribute(outfile,ES_10CPION,print_device); else if (ES_attribute(ES_12CPION,print_device)) ES_print_attribute(outfile,ES_12CPION,print_device); }; #if defined(__STDC__) || defined(__cplusplus) void pitch_Large_off(FILE *outfile) #else void pitch_Large_off(outfile) #endif { if (ES_attribute(ES_8CPIOFF,print_device)) ES_print_attribute(outfile,ES_8CPIOFF,print_device); else if (ES_attribute(ES_10CPIOFF,print_device)) ES_print_attribute(outfile,ES_10CPIOFF,print_device); else if (ES_attribute(ES_12CPIOFF,print_device)) ES_print_attribute(outfile,ES_12CPIOFF,print_device); }; #if defined(__STDC__) || defined(__cplusplus) void pitch_LARGE_on(FILE *outfile) #else void pitch_LARGE_on(outfile) #endif { if (ES_attribute(ES_8CPION,print_device)) ES_print_attribute(outfile,ES_8CPION,print_device); else if (ES_attribute(ES_10CPION,print_device)) ES_print_attribute(outfile,ES_10CPION,print_device); else if (ES_attribute(ES_12CPION,print_device)) ES_print_attribute(outfile,ES_12CPION,print_device); }; #if defined(__STDC__) || defined(__cplusplus) void pitch_LARGE_off(FILE *outfile) #else void pitch_LARGE_off(outfile) #endif { if (ES_attribute(ES_8CPIOFF,print_device)) ES_print_attribute(outfile,ES_8CPIOFF,print_device); else if (ES_attribute(ES_10CPIOFF,print_device)) ES_print_attribute(outfile,ES_10CPIOFF,print_device); else if (ES_attribute(ES_12CPIOFF,print_device)) ES_print_attribute(outfile,ES_12CPIOFF,print_device); }; #if defined(__STDC__) || defined(__cplusplus) void pitch_huge_on(FILE *outfile) #else void pitch_huge_on(outfile) #endif { if (ES_attribute(ES_6CPION,print_device)) ES_print_attribute(outfile,ES_6CPION,print_device); else if (ES_attribute(ES_8CPION,print_device)) ES_print_attribute(outfile,ES_8CPION,print_device); else if (ES_attribute(ES_10CPION,print_device)) ES_print_attribute(outfile,ES_10CPION,print_device); }; #if defined(__STDC__) || defined(__cplusplus) void pitch_huge_off(FILE *outfile) #else void pitch_huge_off(outfile) #endif { if (ES_attribute(ES_6CPIOFF,print_device)) ES_print_attribute(outfile,ES_6CPIOFF,print_device); else if (ES_attribute(ES_8CPIOFF,print_device)) ES_print_attribute(outfile,ES_8CPIOFF,print_device); else if (ES_attribute(ES_10CPIOFF,print_device)) ES_print_attribute(outfile,ES_10CPIOFF,print_device); }; #if defined(__STDC__) || defined(__cplusplus) void pitch_Huge_on(FILE *outfile) #else void pitch_Huge_on(outfile) #endif { if (ES_attribute(ES_5CPION,print_device)) ES_print_attribute(outfile,ES_5CPION,print_device); else if (ES_attribute(ES_6CPION,print_device)) ES_print_attribute(outfile,ES_6CPION,print_device); else if (ES_attribute(ES_8CPION,print_device)) ES_print_attribute(outfile,ES_8CPION,print_device); }; #if defined(__STDC__) || defined(__cplusplus) void pitch_Huge_off(FILE *outfile) #else void pitch_Huge_off(outfile) #endif { if (ES_attribute(ES_5CPIOFF,print_device)) ES_print_attribute(outfile,ES_5CPIOFF,print_device); else if (ES_attribute(ES_6CPIOFF,print_device)) ES_print_attribute(outfile,ES_6CPIOFF,print_device); else if (ES_attribute(ES_8CPIOFF,print_device)) ES_print_attribute(outfile,ES_8CPIOFF,print_device); }; */ #if defined(__STDC__) || defined(__cplusplus) void toc_page_line(int page_num) #else void toc_page_line(page_num) int page_num; #endif { int c; char numstr[10]; tocline[tocline_pos] = 0; sprintf(numstr,"%d",page_num); for (c = 0; c < left_margin; c++) fputc(' ',tocfile); fprintf(tocfile,"%s",tocline); for (c = 0; (c < line_width) && (c < (line_width - (strlen(tocline) + strlen(numstr)))); c++) fputc('.',tocfile); fprintf(tocfile,"%s\n",numstr); tocline_pos = 0; #ifdef VERBOSE printf("%s\n",tocline); #endif }; #if defined(__STDC__) || defined(__cplusplus) void paragraph_begin(void) #else void paragraph_begin() #endif { if (HTML()) add_chars("

"); else { process_newline(); process_newline(); }; } #if defined(__STDC__) || defined(__cplusplus) void paragraph_end(void) #else void paragraph_end() #endif { if (HTML()) add_chars("

"); else { process_newline(); process_newline(); }; } #if defined(__STDC__) || defined(__cplusplus) void process_part(FILE *infile) #else void process_part(infile) FILE *infile; #endif { char_8bit outline[256]; partnum += 1; /* ES_print_attribute(tocfile,ES_boldON,print_device); */ paragraph_end(); print_page_num(output_file); if (nextchar(infile) == '*') { sprintf(outline,"%s",translate(L_Part)); sprintf(tocline,"\n"); } else { sprintf(outline,"%s %d",translate(L_Part),partnum); sprintf(tocline,"\n%d ",partnum); }; if (HTML()) add_chars("

"); else pitch_Huge_on(output_file); add_chars(outline); if (HTML()) add_chars("

"); else pitch_Huge_off(output_file); process_newline(); process_newline(); indentlevel = 0; sectionnum = 0; subsectionnum = 0; subsubsectionnum = 0; fscanf(infile,"{"); tocline_pos = strlen(tocline); if (HTML()) add_chars("

"); else pitch_Huge_on(output_file); process_minienvironment(infile,environ_stack[environ_SP]); if (HTML()) add_chars("

"); else pitch_Huge_off(output_file); toc_page_line(page_num); paragraph_begin(); /* ES_print_attribute(tocfile,ES_boldOFF,print_device); */ } #if defined(__STDC__) || defined(__cplusplus) void process_chapter(FILE *infile) #else void process_chapter(infile) FILE *infile; #endif { char_8bit outline[256]; chapternum += 1; paragraph_end(); print_page_num(output_file); if (in_appendix) if (nextchar(infile) == '*') { sprintf(outline,"%s",translate(L_Appendix)); sprintf(tocline,"\n%s ",translate(L_Appendix)); } else { sprintf(outline,"%s %c",translate(L_Appendix),chapternum+'A'-1); sprintf(tocline,"\n%s %c ",translate(L_Appendix),chapternum+'A'-1); } else if (nextchar(infile) == '*') { sprintf(outline,"%s",translate(L_Chapter)); sprintf(tocline,"\n"); } else { sprintf(outline,"%s %d",translate(L_Chapter),chapternum); sprintf(tocline,"\n%-3d ",chapternum); }; if (HTML()) add_chars("

"); else pitch_Huge_on(output_file); add_chars(outline); if (HTML()) add_chars("

"); else pitch_Huge_off(output_file); process_newline(); process_newline(); indentlevel = 0; sectionnum = 0; subsectionnum = 0; subsubsectionnum = 0; equationnum = 0; tablenum = 0; fscanf(infile,"{"); tocline_pos = strlen(tocline); if (HTML()) add_chars("

"); else pitch_Huge_on(output_file); process_minienvironment(infile,environ_stack[environ_SP]); if (HTML()) add_chars("

"); else pitch_Huge_off(output_file); toc_page_line(page_num); paragraph_begin(); /* Moved to pb process_newline(); process_newline(); */ }; #if defined(__STDC__) || defined(__cplusplus) void process_section(FILE *infile) #else void process_section(infile) FILE *infile; #endif { char_8bit outline[256]; sectionnum += 1; paragraph_end(); /* moved to paragraph end process_newline(); process_newline(); */ if (HTML()) add_chars("

"); else pitch_Large_on(output_file); if (nextchar(infile) != '*') { if (chapternum) { sprintf(outline,"%d.%d ",chapternum,sectionnum); sprintf(tocline," %d.%-3d ",chapternum,sectionnum); } else { sprintf(outline,"%d ",sectionnum); sprintf(tocline," %-3d ",sectionnum); } add_chars(outline); } indentlevel = 0; subsectionnum = 0; subsubsectionnum = 0; fscanf(infile,"{"); tocline_pos = strlen(tocline); process_minienvironment(infile,environ_stack[environ_SP]); if (HTML()) add_chars("

"); else pitch_Large_off(output_file); toc_page_line(page_num); paragraph_begin(); } #if defined(__STDC__) || defined(__cplusplus) void process_subsection(FILE *infile) #else void process_subsection(infile) FILE *infile; #endif { char_8bit outline[256]; subsectionnum += 1; paragraph_end(); if (HTML()) add_chars("

"); else pitch_large_on(output_file); if (nextchar(infile) != '*') { if (chapternum) { sprintf(outline,"%d.%d.%d ",chapternum,sectionnum,subsectionnum); sprintf(tocline," %d.%d.%-3d ",chapternum,sectionnum,subsectionnum); } else { sprintf(outline,"%d.%d ",sectionnum,subsectionnum); sprintf(tocline," %d.%-3d ",sectionnum,subsectionnum); } add_chars(outline); }; indentlevel = 0; subsubsectionnum = 0; fscanf(infile,"{"); tocline_pos = strlen(tocline); process_minienvironment(infile,environ_stack[environ_SP]); toc_page_line(page_num); if (HTML()) add_chars("

"); else pitch_large_off(output_file); paragraph_begin(); /* Moved to pb process_newline(); process_newline(); */ } #if defined(__STDC__) || defined(__cplusplus) void process_subsubsection(FILE *infile) #else void process_subsubsection(infile) FILE *infile; #endif { char_8bit outline[256]; subsubsectionnum += 1; paragraph_end(); /* moved to paragraph end process_newline(); process_newline(); */ if (HTML()) add_chars("
"); else pitch_large_on(output_file); if (nextchar(infile) != '*') { sprintf(outline,"%d.%d.%d.%d ",chapternum,sectionnum,subsectionnum,subsubsectionnum); sprintf(tocline," %d.%d.%d.%-3d ",chapternum,sectionnum,subsectionnum,subsubsectionnum); add_chars(outline); }; indentlevel = 0; fscanf(infile,"{"); tocline_pos = strlen(tocline); process_minienvironment(infile,environ_stack[environ_SP]); toc_page_line(page_num); if (HTML()) add_chars("
"); else pitch_large_off(output_file); paragraph_begin(); /* Moved to paragraph_begin process_newline(); process_newline(); */ } #if defined(__STDC__) || defined(__cplusplus) void process_paragraph(FILE *infile) #else void process_paragraph(infile) FILE *infile; #endif { fscanf(infile,"{"); paragraph_begin(); if (HTML()) add_chars("
"); process_minienvironment(infile,environ_stack[environ_SP]); if (HTML()) add_chars("
"); paragraph_end(); }; #if defined(__STDC__) || defined(__cplusplus) void process_subparagraph(FILE *infile) #else void process_subparagraph(infile) FILE *infile; #endif { fscanf(infile,"{"); paragraph_begin(); process_minienvironment(infile,environ_stack[environ_SP]); paragraph_end(); }; /* If the following commands are encountered, the remainder of the line is ignored. */ char_8bit *ignore_line_commands[]= { "addtocounter", "addtolength", "documentstyle", "includeonly", "hfill", "hspace", "kill", "linebreak", "maketitle", "newenvironment", "newlength", "newtheorem", "nolinebreak", "nopagebreak", "pagebreak", "pagenumbering", "pagestyle", "parbox", "parindent", "parskip", "newsavebox", "samepage", "setcounter", "setlength", "settowidth", "sloppy", "usebox", "vspace", "=", ">", "-", NULL }; /* If the following commands are encountered, the text between the following { and the matching } is ignored */ char_8bit *ignore_environment_commands[]= { "title", "author", "bibliographystyle", /* We ignore this because we use the bbl file which should have already incorporated the bibliographystyle */ NULL }; /* If the following commands are encountered, the text between the { and the matching } is printed, enclosed in (). */ char_8bit *ignore_command_commands[]= { "mbox", "makebox", "fbox", "framebox", NULL }; /* If the following begin blocks are encountered, The text to the matching \end{...} is ignored. */ char_8bit *ignore_blocks[]= { "eqnarray", "equation", "array", "tabular", "figure", "table", "picture", NULL }; /* If the following begin blocks are encountered, the command is ignored. The remainder of the line is also ignored. */ char_8bit *ignore_block_commands[]= { "minipage", "sloppypar", NULL }; #if defined(__STDC__) || defined(__cplusplus) void process_begin_quote(FILE *infile) #else void process_begin_quote(infile) FILE *infile; #endif { }; #if defined(__STDC__) || defined(__cplusplus) void process_end_quote(FILE *infile) #else void process_end_quote(infile) FILE *infile; #endif { }; #if defined(__STDC__) || defined(__cplusplus) void process_begin_document(FILE *infile) #else void process_begin_document(infile) FILE *infile; #endif { add_char(TOC_MARKER); add_char(BEGIN_DOC_MARKER); }; #if defined(__STDC__) || defined(__cplusplus) void process_end_document(FILE *infile) #else void process_end_document(infile) FILE *infile; #endif { AT_END = 1; }; #if defined(__STDC__) || defined(__cplusplus) int ignore(char_8bit *wordstr,char_8bit *wordlist[]) #else int ignore(wordstr,wordlist) char_8bit *wordstr; char_8bit *wordlist[]; #endif { int i; for (i = 0; wordlist[i] != NULL; i++) if (strcmp(wordstr,wordlist[i]) == 0) return(1); return(0); }; #if defined(__STDC__) || defined(__cplusplus) void ignore_block(FILE *infile,char_8bit *block_kind) #else void ignore_block(infile,block_kind) FILE *infile; char_8bit *block_kind; #endif { char_8bit linein[256]; char_8bit matchend[50]; char_8bit matchbegin[50]; int stackcount=1; int atend = 0; int old_in_table; int old_in_equation; old_in_table = in_table; old_in_equation = in_equation; sprintf(matchend,"\\end{%s}",block_kind); sprintf(matchbegin,"\\begin{%s}",block_kind); if (strcmp(block_kind,"table") == 0) in_table = 1; if (strcmp(block_kind,"equation") == 0) in_equation = 1; while (!atend) { fgets(linein,255,infile); if (linein[0] != '%') { if (strstr((char *)linein,(char *)matchbegin)) stackcount += 1; if (strstr((char *)linein,(char *)matchend)) { stackcount -= 1; if (stackcount == 0) atend = 1; }; if (strstr((char *)linein,"\\label")) { char *linechar; char_8bit name[80]; int namepos=0; /* sscanf(linein,"\\label{%s}",name); add_label(name); if (in_equation) equationnum += 1; if (in_table) tablenum += 1; */ linechar = strstr((char *)linein,"\\label") + 7; if (strstr((char *)linein,"%") > linechar) { while (*linechar != '}') { name[namepos++] = *linechar; linechar += 1; }; name[namepos] = 0; add_label(name); if (in_equation) equationnum += 1; if (in_table) tablenum += 1; }; }; }; }; in_table = old_in_table; in_equation = old_in_equation; }; #if defined(__STDC__) || defined(__cplusplus) void process_begin_quotation(FILE *infile) #else void process_begin_quotation(infile) FILE *infile; #endif { indentlevel += 1; rightmargin -= INDENTATION; if (HTML()) fprintf(output_file,"
\n"); }; #if defined(__STDC__) || defined(__cplusplus) void process_end_quotation(FILE *infile) #else void process_end_quotation(infile) FILE *infile; #endif { indentlevel -= 1; rightmargin += INDENTATION; if (HTML()) fprintf(output_file,"
\n"); }; #if defined(__STDC__) || defined(__cplusplus) void process_begin_center(FILE *infile) #else void process_begin_center(infile) FILE *infile; #endif { in_center = 1; }; #if defined(__STDC__) || defined(__cplusplus) void process_end_center(FILE *infile) #else void process_end_center(infile) FILE *infile; #endif { in_center = 0; }; #if defined(__STDC__) || defined(__cplusplus) void process_begin_abstract(FILE *infile) #else void process_begin_abstract(infile) FILE *infile; #endif { process_newpage(); process_newline(); /* There should be no paragraphs before this */ if (HTML()) add_chars("

"); else pitch_Large_on(output_file); add_chars(translate(L_Abstract)); if (HTML()) add_chars("

"); else pitch_Large_off(output_file); paragraph_begin(); }; #if defined(__STDC__) || defined(__cplusplus) void process_end_abstract(FILE *infile) #else void process_end_abstract(infile) FILE *infile; #endif { paragraph_end(); }; #if defined(__STDC__) || defined(__cplusplus) void process_begin_verbatim(FILE *infile) #else void process_begin_verbatim(infile) FILE *infile; #endif { char_8bit outline[256]; int atend = 0; if (HTML()) fprintf(output_file," \n"); while (!atend) { fgets(outline,255,infile); atend = feof(infile); if (strstr((char *)outline,"\\end{verbatim}")) atend=1; else { outline[strlen(outline)-1] = 0; fprintf(output_file,"%s\n",outline); line_num += 1; check_page_break(output_file); }; }; }; #if defined(__STDC__) || defined(__cplusplus) void process_end_verbatim(FILE *infile) #else void process_end_verbatim(infile) FILE *infile; #endif { if (HTML()) fprintf(output_file," \n"); /* should already be taken care of by process_begin_verbatim */ }; #if defined(__STDC__) || defined(__cplusplus) void process_begin_itemize(FILE *infile) #else void process_begin_itemize(infile) FILE *infile; #endif { dumpline(); list_level += 1; indentlevel += 2; list_kind[list_level] = ITEMIZE_LIST; if (HTML()) add_chars("
    "); }; #if defined(__STDC__) || defined(__cplusplus) void process_end_list(FILE *infile) #else void process_end_list(infile) FILE *infile; #endif { dumpline(); list_level -= 1; indentlevel -= 2; }; #if defined(__STDC__) || defined(__cplusplus) void process_end_itemize(FILE *infile) #else void process_end_itemize(infile) FILE *infile; #endif { process_end_list(infile); if (HTML()) add_chars("
"); }; #if defined(__STDC__) || defined(__cplusplus) void process_begin_enumerate(FILE *infile) #else void process_begin_enumerate(infile) FILE *infile; #endif { dumpline(); list_level += 1; indentlevel += 2; list_count[list_level] = 0; list_kind[list_level] = ENUMERATE_LIST; if (HTML()) add_chars("
    "); }; #if defined(__STDC__) || defined(__cplusplus) void process_end_enumerate(FILE *infile) #else void process_end_enumerate(infile) FILE *infile; #endif { process_end_list(infile); if (HTML()) add_chars("
"); }; #if defined(__STDC__) || defined(__cplusplus) void process_begin_description(FILE *infile) #else void process_begin_description(infile) FILE *infile; #endif { dumpline(); list_level += 1; indentlevel += 2; list_kind[list_level] = DESCRIPTION_LIST; if (HTML()) add_chars("
"); }; #if defined(__STDC__) || defined(__cplusplus) void process_end_description(FILE *infile) #else void process_end_description(infile) FILE *infile; #endif { process_end_list(infile); if (HTML()) add_chars("
"); }; #if defined(__STDC__) || defined(__cplusplus) void process_begin_thebibliography(FILE *infile) #else void process_begin_thebibliography(infile) FILE *infile; #endif { char tabulation[256]; fscanf(infile,"{%s}",tabulation); bibliography_indentlevel = strlen(tabulation)/INDENTATION; paragraph_end(); if (HTML()) add_chars("

"); else pitch_Huge_on(output_file); add_chars(translate(L_Bibliography)); if (HTML()) add_chars("

"); else pitch_Huge_off(output_file); if (HTML()) add_chars("
"); else process_newline(); indentlevel = 0; list_kind[list_level] = BIBLIOGRAPHY_LIST; in_bibliography = 1; }; #if defined(__STDC__) || defined(__cplusplus) void process_begin_theindex(FILE *infile) #else void process_begin_theindex(infile) FILE *infile; #endif { process_newpage(); process_newline(); if (HTML()) add_chars("

"); else pitch_Huge_on(output_file); add_chars(translate(L_Index)); if (HTML()) add_chars("

"); else pitch_Huge_off(output_file); if (HTML()) add_chars("
"); else process_newline(); indentlevel = 0; list_kind[list_level] = INDEX_LIST; }; #if defined(__STDC__) || defined(__cplusplus) void process_end_thebibliography(FILE *infile) #else void process_end_thebibliography(infile) FILE *infile; #endif { process_end_list(infile); if (HTML()) add_chars("
"); in_bibliography = 0; indentlevel = 0; }; #if defined(__STDC__) || defined(__cplusplus) void process_end_theindex(FILE *infile) #else void process_end_theindex(infile) FILE *infile; #endif { process_end_list(infile); if (HTML()) add_chars("
"); indentlevel = 0; }; #if defined(__STDC__) || defined(__cplusplus) void process_bibliography(FILE *infile) #else void process_bibliography(infile) FILE *infile; #endif { process_input(infile,EXT_BBL); }; static char_8bit last_topic[256] = ""; #if defined(__STDC__) || defined(__cplusplus) void process_link_label(FILE *infile,int prev_next) #else void process_link_label(infile,prev_next) FILE *infile; int prev_next; #endif { char_8bit wordread[256]; if (fscanf(infile,"{%[^}]}",wordread)) { add_label(wordread); dumpline(); switch (textreader) { case TR_TURBOVISION : {if (prev_next) fprintf(output_file,"\n\n{>>>%s<<<:%s}",translate(L_Next_topic),wordread); fprintf(output_file,"\n\n.topic %s\n",wordread); if ((strcmp(last_topic,"") != 0) && prev_next) fprintf(output_file,"{>>>%s<<<:%s}\n\n",translate(L_Prev_topic),last_topic); } break; case TR_HTML : case TR_HTMLPLUS : { /* HTML already has Prev and next builtin */ fprintf(output_file," \n",wordread /* Here we could also put the label of the section name */); } break; }; strcpy(last_topic,wordread); }; }; /* Not implemented yet #if defined(__STDC__) || defined(__cplusplus) void process_documentstyle(FILE *infile) #else void process_documentstyle(infile) FILE *infile; #endif { } */ #if defined(__STDC__) || defined(__cplusplus) void process_number_label(FILE *infile) #else void process_number_label(infile) FILE *infile; #endif { char_8bit wordread[256]; int wordpos=0; int inchar; while ((inchar = fgetc(infile)) != '{'); while ((inchar = fgetc(infile)) != '}') wordread[wordpos++] = inchar; wordread[wordpos] = 0; add_label(wordread); }; #if defined(__STDC__) || defined(__cplusplus) void process_item(FILE *infile) #else void process_item(infile) FILE *infile; #endif { int first_bracket_found = 0; int charin; dumpline(); if ((list_kind[list_level] == BIBLIOGRAPHY_LIST) || (list_kind[list_level] == INDEX_LIST)) { indentlevel = 0; inc_indentlevel_after_line = 1; } else { indentlevel -= 1; inc_indentlevel_after_line = 1; }; switch (list_kind[list_level]) { case DESCRIPTION_LIST : if (HTML()) add_chars("
"); while (!first_bracket_found && ((charin = fgetc(infile)) != EOF)) first_bracket_found= charin == '['; in_brackets = 1; process_text(infile); break; case BIBLIOGRAPHY_LIST : { add_char_buffer_mode = 1; add_char_bufferpos = 0; indentlevel = 0; if (HTML()) add_chars("
"); while (!first_bracket_found && ((charin = fgetc(infile)) != EOF)) first_bracket_found= charin == '['; in_brackets = 1; process_text(infile); add_char_buffer_mode = 0; process_link_label(infile,NO_PREV_NEXT); add_chars("["); add_chars(add_char_buffer); add_chars("] "); }; break; case INDEX_LIST : if (HTML()) add_chars("
  • "); break; case ENUMERATE_LIST : { char_8bit countstr[5]; list_count[list_level] += 1; if (HTML()) add_chars("
  • "); else {sprintf(countstr,"%d. ",list_count[list_level]); add_chars(countstr); }; }; break; case ITEMIZE_LIST : if (HTML()) add_chars("
  • "); else { add_chars(UCSCU_char(bullets[list_level])); add_char(' '); }; break; }; }; #if defined(__STDC__) || defined(__cplusplus) void process_subitem(int level) #else void process_subitem(level) int level; #endif { int i,j; process_newline(); for (j = 0; j < level; j++) for (i = 0; i < INDENTATION; i++) add_char(HARD_SPACE); }; #if defined(__STDC__) || defined(__cplusplus) void process_begin(FILE *infile) #else void process_begin(infile) FILE *infile; #endif { int charin; char_8bit *wordread; charin = fgetc(infile); wordread = readword(infile); charin = fgetc(infile); if (ignore(wordread,ignore_blocks)) {ignore_block(infile,wordread); return;}; if (strcmp(wordread,"quote") == 0) {process_begin_quote(infile); return;}; if (strcmp(wordread,"quotation") == 0) {process_begin_quotation(infile); return;}; if (strcmp(wordread,"center") == 0) {process_begin_center(infile); return;}; if (strcmp(wordread,"abstract") == 0) {process_begin_abstract(infile); return;}; if (strcmp(wordread,"verbatim") == 0) {process_begin_verbatim(infile); return;}; if (strcmp(wordread,"itemize") == 0) {process_begin_itemize(infile); return;}; if (strcmp(wordread,"enumerate") == 0) {process_begin_enumerate(infile); return;}; if (strcmp(wordread,"description") == 0){process_begin_description(infile); return;}; if (strcmp(wordread,"thebibliography") == 0){process_begin_thebibliography(infile); return;}; if (strcmp(wordread,"document") == 0) {process_begin_document(infile); return;}; if (strcmp(wordread,"theindex") == 0) {process_begin_theindex(infile); return;}; }; #if defined(__STDC__) || defined(__cplusplus) void process_end(FILE *infile) #else void process_end(infile) FILE *infile; #endif { char_8bit *wordread; fgetc(infile); /* throw away left paren */ wordread = readword(infile); fgetc(infile); /* throw away right paren */ if (strcmp(wordread,"quote") == 0) {process_end_quote(infile); return;}; if (strcmp(wordread,"quotation") == 0) {process_end_quotation(infile); return;}; if (strcmp(wordread,"center") == 0) {process_end_center(infile); return;}; if (strcmp(wordread,"verbatim") == 0) {process_end_verbatim(infile); return;;}; if (strcmp(wordread,"abstract") == 0) {process_end_abstract(infile); return;;}; if (strcmp(wordread,"itemize") == 0) {process_end_itemize(infile); return;}; if (strcmp(wordread,"enumerate") == 0) {process_end_enumerate(infile); return;}; if (strcmp(wordread,"description") == 0){process_end_description(infile); return;}; if (strcmp(wordread,"thebibliography") == 0){process_end_thebibliography(infile); return;}; if (strcmp(wordread,"document") == 0) {process_end_document(infile); return;}; if (strcmp(wordread,"theindex") == 0) {process_end_theindex(infile); return;}; }; #if defined(__STDC__) || defined(__cplusplus) void ignore_line(FILE *infile) #else void ignore_line(infile) FILE *infile; #endif { char_8bit junk[256]; fgets(junk,255,infile); }; #if defined(__STDC__) || defined(__cplusplus) char *read_environment(FILE *infile) #else char *read_environment(infile) FILE *infile; #endif { int bracecount = 0; int first_brace_found =0; int charin; int at_eof = 0; static char envstr[256]; int envpos = 0; while (!first_brace_found && ((charin = fgetc(infile)) != EOF)) first_brace_found = charin == '{'; if ((charin == EOF) || feof(infile)) { at_eof = 1; return(0); }; bracecount = 1; while (bracecount && !at_eof) { charin = fgetc(infile); if (feof(infile)) at_eof = 1; switch (charin) { case '%' : fscanf(infile,"\n"); break; /* skip over comments */ case '\\' : charin = fgetc(infile); break; /* skip over \} */ case '{' : bracecount += 1; break; case '}' : bracecount -= 1; break; case EOF : at_eof = 1; return(envstr); /*break;*/ }; if ((charin != '%') && (envpos < 255)) { envstr[envpos++] = charin; envstr[envpos] = 0; }; }; return(envstr); }; #if defined(__STDC__) || defined(__cplusplus) void ignore_command(FILE *infile) #else void ignore_command(infile) FILE *infile; #endif { fscanf(infile,"{"); add_char('('); process_text(infile); add_char(')'); }; #if defined(__STDC__) || defined(__cplusplus) void add_accent_character(FILE *infile,char_8bit accent) #else void add_accent_character(infile,accent) FILE *infile; char_8bit accent; #endif { char accent_coding[10]; int accent_pos = 1; int i; char_8bit char_to_accent; accent_coding[0] = accent; char_to_accent = fgetc(infile); accent_coding[accent_pos++] = char_to_accent; if (char_to_accent == '{') { while ((char_to_accent = fgetc(infile)) != '}') { accent_coding[accent_pos++] = char_to_accent; }; accent_coding[accent_pos++] = '}'; }; accent_coding[accent_pos] = 0; for (i = 0; UCSCU_TeX_table[i].symbol != UCSCU_END_TABLE;i++) if (strcmp(UCSCU_TeX_table[i].TeX, accent_coding) == 0) if (HTML()) add_chars(UCSCU_lookup_code_HTML(UCSCU_TeX_table[i].symbol)); else add_chars(UCSCU_char(UCSCU_TeX_table[i].symbol)); }; #if defined(__STDC__) || defined(__cplusplus) void process_footnote(FILE *infile) #else void process_footnote(infile) FILE *infile; #endif { footnote_index += 1; }; #define REFERENCE 1 #define CITATION 2 #if defined(__STDC__) || defined(__cplusplus) void process_ref(FILE *infile,int linkkind) #else void process_ref(infile,linkkind) FILE *infile; int linkkind; #endif { char_8bit linkstr[256]; char_8bit linklabel[256]; int linklabelpos = 0; struct label_layout *label; int inchar; while ((inchar = fgetc(infile)) != '{'); while ((inchar = fgetc(infile)) != '}') { linklabel[linklabelpos++] = inchar; linklabel[linklabelpos] = 0; }; label = lookup_label(linklabel); if (label) add_chars(label->enumeration); else { add_char(START_REF_MARKER); add_chars(linklabel); add_char(END_REF_MARKER); }; if (build_label) switch (textreader) { case TR_TURBOVISION : { sprintf(linkstr," {>>>%s<<<:%s}", linkkind == REFERENCE ? translate(L_Read_topic) : translate(L_Read_biblio),linklabel); add_chars(linkstr); }; break; case TR_HTML : case TR_HTMLPLUS : { sprintf(linkstr," %s %s",linklabel, label->enumeration,"" /* eventually label description here*/ ); add_chars(linkstr); } break; }; build_label = 0; }; #if defined(__STDC__) || defined(__cplusplus) void process_makeindex(void) #else void process_makeindex() #endif { makeindex = 1; }; #if defined(__STDC__) || defined(__cplusplus) void process_tableofcontents(void) #else void process_tableofcontents() #endif { tableofcontents = 1; if (HTML()) add_chars("

    "); else pitch_Huge_on(output_file); fprintf(tocfile,"%s\n\n",translate(L_Contents)); if (HTML()) add_chars("

    "); else pitch_Huge_off(output_file); }; #if defined(__STDC__) || defined(__cplusplus) void process_index(FILE *infile) #else void process_index(infile) FILE *infile; #endif { char_8bit wordread[256]; if (fscanf(infile,"{%[^}]}",wordread)) { fprintf(idxfile,"%d %s\n",page_num,wordread); }; }; #if defined(__STDC__) || defined(__cplusplus) void process_newcommand(FILE *infile) #else void process_newcommand(infile) FILE *infile; #endif { char_8bit newcmnd[256]; int bracelevel = 0; int newcmndpos= 0; char_8bit replacement[256]; int replacementpos =0; int inchar; while ((inchar = fgetc(infile)) != '{'); while ((inchar = fgetc(infile)) != 92); /* Backslash */ while (((inchar = fgetc(infile)) != '}') || bracelevel) { if (inchar == '{') bracelevel += 1; if (inchar == '}') bracelevel -= 1; newcmnd[newcmndpos++] = inchar; }; newcmnd[newcmndpos] = 0; bracelevel = 0; while ((inchar = fgetc(infile)) != '{'); while (((inchar = fgetc(infile)) != '}') || bracelevel) { if (inchar == '{') bracelevel += 1; if (inchar == '}') bracelevel -= 1; replacement[replacementpos++] = inchar; }; replacement[replacementpos] = 0; add_newcommand(newcmnd,replacement); }; #if defined(__STDC__) || defined(__cplusplus) void process_font(FILE *infile,int font) #else void process_font(infile,font) FILE *infile; int font; #endif { int charin; if (HTML()) switch (font) { case bf_FONT : add_chars(" "); break; case em_FONT : add_chars(" "); break; case it_FONT : add_chars(" "); break; case sl_FONT : add_chars(" "); break; case tt_FONT : add_chars(" "); break; case underline_FONT : add_chars(" ");break; /*case rm_FONT : add_chars(" <> "); break; */ /*case sf_FONT : add_chars(" <> "); break; /*case sc_FONT : add_chars(" <> "); break; */ }; if (nextchar(infile) == '{') { struct environment_layout *temp_environ; temp_environ = new_environment( environ_stack[environ_SP]->font, environ_stack[environ_SP]->type, environ_stack[environ_SP]->flags, environ_stack[environ_SP]->indent, environ_stack[environ_SP]->pref_width, environ_stack[environ_SP]->pref_length, environ_stack[environ_SP]->act_width, environ_stack[environ_SP]->num_lines ); environ_stack[++environ_SP] = temp_environ; temp_environ->font = font; charin = fgetc(infile); /* read the { */ if (!((charin == EOF) || feof(infile))) process_minienvironment(infile,temp_environ); free(environ_stack[environ_SP--]); } else { charin = fgetc(infile); /* read the space after the font tag */ environ_stack[environ_SP]->font = font; } }; #if defined(__STDC__) || defined(__cplusplus) void process_tex(FILE *infile) #else void process_tex(infile) FILE *infile; #endif { char_8bit *wordread; char_8bit *newcmnd_replacement; wordread = readword(infile); if (ignore(wordread,ignore_line_commands)) {ignore_line(infile); return;}; if (ignore(wordread,ignore_environment_commands)) {read_environment(infile); return;}; if (ignore(wordread,ignore_command_commands)) {ignore_command(infile); return;}; /* ACCENTS */ if (wordread[0]=='"') {add_accent_character(infile,'"'); return;}; if (wordread[0]=='`') {add_accent_character(infile,'`'); return;}; if (wordread[0]==39) {add_accent_character(infile,39); return;}; if (wordread[0]=='^') {add_accent_character(infile,'^'); return;}; if (wordread[0]=='~') {add_accent_character(infile,'~'); return;}; if (wordread[0]=='=') {add_accent_character(infile,'='); return;}; if (wordread[0]=='.') {add_accent_character(infile,'.'); return;}; if (strcmp(wordread,"u") == 0) {add_accent_character(infile,'u'); return;}; if (strcmp(wordread,"v") == 0) {add_accent_character(infile,'v'); return;}; if (strcmp(wordread,"H") == 0) {add_accent_character(infile,'H'); return;}; if (strcmp(wordread,"t") == 0) {add_accent_character(infile,'t'); return;}; if (strcmp(wordread,"c") == 0) {add_accent_character(infile,'c'); return;}; if (strcmp(wordread,"d") == 0) {add_accent_character(infile,'d'); return;}; if (strcmp(wordread,"b") == 0) {add_accent_character(infile,'b'); return;}; /* Symbols */ if (strcmp(wordread,"dag") == 0) {add_chars(UCSCU_char(SYM_daggar)); return;}; if (strcmp(wordread,"ddag") == 0) {add_chars(UCSCU_char(SYM_double_daggar)); return;}; if (strcmp(wordread,"P") == 0) {add_chars(UCSCU_char(SYM_paragraph)); return;}; if (strcmp(wordread,"copyright") == 0) {add_chars(UCSCU_char(SYM_copyright)); return;}; if (strcmp(wordread,"pounds") == 0) {add_chars(UCSCU_char(SYM_pounds)); return;}; if (strcmp(wordread,"S") == 0) {add_chars(UCSCU_char(SYM_section)); return;}; if (strcmp(wordread,"$") == 0) {add_char('$'); return;}; if (strcmp(wordread,"&") == 0) { if (HTML()) add_chars("&"); else add_char('&'); return; }; if (strcmp(wordread,"<") == 0) { if (HTML()) add_chars("<"); else add_char('<'); return; }; if (strcmp(wordread,">") == 0) { if (HTML()) add_chars(">"); else add_char('>'); return; }; if (strcmp(wordread,"%") == 0) {add_char('%'); return;}; if (strcmp(wordread,"#") == 0) {add_char('#'); return;}; if (strcmp(wordread,"{") == 0) {add_char('{'); return;}; if (strcmp(wordread,"}") == 0) {add_char('}'); return;}; if (strcmp(wordread,"_") == 0) {add_char('_'); return;}; if (strcmp(wordread,"/") == 0) {add_char('/'); return;}; if (strcmp(wordread,"\\") == 0) {process_newline();return;}; if (strcmp(wordread,"indexspace") == 0){process_newline();return;}; if (strcmp(wordread,"newpage") == 0) {process_newpage();return;}; if (strcmp(wordread,"SLiTeX") == 0) {add_chars("SLiTeX"); return;}; if (strcmp(wordread,"LaTeXe") == 0) {add_chars("LaTeXe"); return;}; if (strcmp(wordread,"LaTeX") == 0) {add_chars("LaTeX"); return;}; if (strcmp(wordread,"TeX") == 0) {add_chars("TeX"); return;}; /* Spacing */ if (strcmp(wordread,",") == 0) {add_char(' '); return;}; if (strcmp(wordread,"begin") == 0) {process_begin(infile); return;}; if (strcmp(wordread,"end") == 0) {process_end(infile); return;}; /* Not implemented yet if (strcmp(wordread,"documentstyle") == 0) {process_documentstyle(infile); return;}; */ if (strcmp(wordread,"label") == 0) {process_number_label(infile); return;}; if (strcmp(wordread,"ref") == 0) {process_ref(infile,REFERENCE); return;}; if (strcmp(wordread,"input") == 0) {process_input(infile,EXT_TEX); return;}; if (strcmp(wordread,"bibliography") == 0) {process_bibliography(infile); return;}; if (strcmp(wordread,"include") == 0) {process_input(infile,EXT_TEX); return;}; if (strcmp(wordread,"appendix") == 0) {process_appendix(infile); return;}; if (strcmp(wordread,"part") == 0) {process_part(infile); return;}; if (strcmp(wordread,"chapter") == 0) {process_chapter(infile); return;}; if (strcmp(wordread,"section") == 0) {process_section(infile); return;}; if (strcmp(wordread,"subsection") == 0) {process_subsection(infile); return;}; if (strcmp(wordread,"subsubsection") == 0) {process_subsubsection(infile); return;}; if (strcmp(wordread,"paragraph") == 0) {process_paragraph(infile); return;}; if (strcmp(wordread,"subparagraph") == 0) {process_subparagraph(infile);return;}; if (strcmp(wordread,"newcommand") == 0) {process_newcommand(infile);return;}; if (strcmp(wordread,"tableofcontents") == 0) {process_tableofcontents(); return;}; if (strcmp(wordread,"makeindex") == 0) {process_makeindex(); return;}; if (strcmp(wordread,"index") == 0) {process_index(infile); return;}; if (strcmp(wordread,"item") == 0) {process_item(infile); return;}; if (strcmp(wordread,"subitem") == 0) {process_subitem(1); return;}; if (strcmp(wordread,"subsubitem") == 0) {process_subitem(2); return;}; if (strcmp(wordread,"subsubsubitem") == 0) {process_subitem(3); return;}; if (strcmp(wordread,"cite") == 0) {process_ref(infile,CITATION); return;}; if (strcmp(wordread,"bibitem") == 0) {process_item(infile); return;}; if (strcmp(wordread,"footnote") == 0) {process_footnote(infile); return; }; if ((strcmp(wordread,"rm")) == 0) { process_font(infile,rm_FONT); return;}; if ((strcmp(wordread,"sl")) == 0) { process_font(infile,sl_FONT); return;}; if ((strcmp(wordread,"bf")) == 0) { process_font(infile,bf_FONT); return;}; if ((strcmp(wordread,"em")) == 0) { process_font(infile,em_FONT); return;}; if ((strcmp(wordread,"it")) == 0) { process_font(infile,it_FONT); return;}; if ((strcmp(wordread,"tt")) == 0) { process_font(infile,tt_FONT); return;}; if ((strcmp(wordread,"sf")) == 0) { process_font(infile,sf_FONT); return;}; if ((strcmp(wordread,"sc")) == 0) { process_font(infile,sc_FONT); return;}; if ((strcmp(wordread,"underline")) == 0) { process_font(infile,underline_FONT); return;}; if ((newcmnd_replacement = lookup_newcommand(wordread)) != 0) process_text_str(newcmnd_replacement); /* ignore_line(infile);*/ }; #if defined(__STDC__) || defined(__cplusplus) void add_hypertext_command(FILE *infile) #else void add_hypertext_command(infile) FILE *infile; #endif { char_8bit HTline[256]; add_char('\\'); fgets(HTline,255,infile); add_chars(HTline); }; #if defined(__STDC__) || defined(__cplusplus) void process_minienvironment(FILE *infile,struct environment_layout *curr_environ) #else void process_minienvironment(infile,curr_environ) FILE *infile; struct environment_layout *curr_environ; #endif { environ_SP += 1; memcpy((void *)&environ_stack[environ_SP], (void *)curr_environ, sizeof(struct environment_layout)); build_label = 1; label_pos = 0; process_text(infile); /* At the end of the minienvironment, disable any special font that may have been enabled. We don't need to turn of the normal font */ if (HTML()) switch (environ_stack[environ_SP]->font) { case bf_FONT : add_chars(" "); break; case em_FONT : add_chars(" "); break; case it_FONT : add_chars(" "); break; case sl_FONT : add_chars(" "); break; case tt_FONT : add_chars(" "); break; case underline_FONT : add_chars(" ");break; /*case rm_FONT : add_chars("<> "); break; */ /*case sf_FONT : add_chars("<> "); break; /*case sc_FONT : add_chars("<> "); break; */ }; environ_SP -= 1; }; #if defined(__STDC__) || defined(__cplusplus) void add_verbatim(FILE *infile) #else void add_verbatim(infile) FILE *infile; #endif { char_8bit outline[256]; int atend = 0; paragraph_end(); if (HTML()) fprintf(output_file," \n"); fgets(outline,255,infile); /* read the remainder of the line */ while (!atend) { fgets(outline,255,infile); if (outline[0] != '%') atend = 1; else { outline[strlen(outline)-1] = 0; fprintf(output_file,"%s\n",&outline[1]); line_num += 1; check_page_break(output_file); } if (feof(infile)) atend = 1; }; if (HTML()) fprintf(output_file," \n"); }; #if defined(__STDC__) || defined(__cplusplus) void add_fixups(FILE *infile) #else void add_fixups(infile) FILE *infile; #endif { char_8bit fixup_line[160]; char_8bit SmathS[80]; char_8bit replacement[80]; int atend = 0; process_newline(); fgets(fixup_line,160,infile); /* read the remainder of the line */ while (!atend) { fgets(fixup_line,160,infile); if (fixup_line[0] != '%') atend = 1; else { sscanf(fixup_line,"%%%[^|]|%[^\n]",SmathS,replacement); add_fixup(SmathS,replacement); } if (feof(infile)) atend = 1; }; }; #if defined(__STDC__) || defined(__cplusplus) void process_comment(FILE *infile) #else void process_comment(infile) FILE *infile; #endif { char_8bit *wordread; wordread = readword(infile); if (strcmp(wordread,"\\") == 0) add_hypertext_command(infile); else if (strcmp(wordread,"verbatim") == 0) add_verbatim(infile); else if (strcmp(wordread,"fixup") == 0) add_fixups(infile); else if (strcmp(wordread,"label") == 0) process_link_label(infile,GEN_PREV_NEXT); else if (strcmp(wordread,"checkpoint") == 0) { char cplabel[255]; fscanf(infile,"%[^\n]\n",cplabel); fprintf(stderr,"%s\n",cplabel); } else { char throwaway; while (((throwaway = fgetc(infile)) != '\n') && (throwaway != EOF)); }; }; #if defined(__STDC__) || defined(__cplusplus) void process_formula(FILE *infile) #else void process_formula(infile) FILE *infile; #endif { int inchar; char_8bit math[80]; char_8bit SmathS[80]; char_8bit *replacement; int mathpos = 0; while (((inchar = fgetc(infile)) != '$') && !feof(infile)) math[mathpos++] = inchar; math[mathpos] = 0; sprintf(SmathS,"$%s$",math); replacement = lookup_fixup(SmathS); if (replacement) add_chars(replacement); else { fprintf(fixup,"%%%s|%s\n",SmathS,math); add_fixup(SmathS,math); add_chars(math); }; }; #if defined(__STDC__) || defined(__cplusplus) void process_text(FILE *infile) #else void process_text(infile) FILE *infile; #endif { int charin; int collect_white_space = 0; int next_newline_is_hard = 0; while (((charin = fgetc(infile)) != EOF) && (!feof(infile))) { if (isspace(charin)) { if (!collect_white_space) { add_char(' '); collect_white_space = 1; }; if (charin == '\n') { if (next_newline_is_hard && !newline_just_printed) { add_char(HARD_NEWLINE); newline_just_printed = 0; }; next_newline_is_hard = 1; } } else { next_newline_is_hard = 0; newline_just_printed = 0; collect_white_space = 0; switch (charin) { case '%' : process_comment(infile); break; case '$' : process_formula(infile); break; case '\\' : process_tex(infile); break; case '{' : process_minienvironment(infile,environ_stack[environ_SP]); break; case '}' : return; /*break; exit minienvironment */ case ']' : if (in_brackets) {in_brackets = 0; /* Special case for description list items */ if (HTML()) add_chars("
    "); return; } else add_char(charin); break; case '`' : if (nextchar(infile) == '`') { charin = fgetc(infile) ; add_char(34); }; break; case 39 : if (nextchar(infile) == 39) { charin = fgetc(infile); add_char(34); }; break; case '~' : add_char(' '); break; default : if (HTML()) switch (charin) { case '&' : add_chars("&"); break; case '<' : add_chars("<"); break; case '>' : add_chars(">"); break; case '"' : add_chars("""); break; default : add_char(charin); break; } else add_char(charin); break; }; }; }; }; #if defined(__STDC__) || defined(__cplusplus) void process_text_str(char *textstr) #else void process_text_str(textstr) char *textstr; #endif { FILE *textstrfile; int strpos = 0; if ((textstrfile = fopen("DELETEME.TSF",WRITEMODE)) != NULL) { for (strpos = 0 ; strpos < strlen(textstr); strpos++) fputc(textstr[strpos],textstrfile); fclose(textstrfile); if ((textstrfile = fopen("DELETEME.TSF",READMODE)) != NULL) { process_text(textstrfile); fclose(textstrfile); }; }; }; #if defined(__STDC__) || defined(__cplusplus) void process_text_file(char_8bit *fname,char *extension) #else void process_text_file(fname,extension) char_8bit *fname; char *extension; #endif { FILE *infile = 0; char_8bit ffname[256]; #ifdef VERBOSE printf("Processing file %s%s\n",fname,extension); #endif if (strcmp(fname,"-") == 0) infile = stdin; else { strcpy(ffname,fname); strncat(ffname,extension,255); infile =fopen(ffname,READMODE); } if (infile) { process_text(infile); if (infile != stdin) fclose(infile); }; }; #if defined(__STDC__) || defined(__cplusplus) void process_input(FILE *infile,char *extension) #else void process_input(infile,extension) FILE *infile; char *extension; #endif { char_8bit *wordread; fscanf(infile,"{"); wordread = readword(infile); fscanf(infile,"}"); process_text_file(wordread,extension); }; #if defined(__STDC__) || defined(__cplusplus) void prompt_options(void) #else void prompt_options() #endif { do { language_list_available(stdout); printf("\n%s\n",translate(L_Enter_language_code)); gets(language_name_code); } while #ifdef HARDCODE_PHRASES (!language_set(language_name_code)); #else (!language_init(language_name_code,"L2H",RLIB_program_path,"phrases.lng")); #endif printf("\n%s\n",translate(L_Enter_LaTeX_fname)); gets(input_filename); printf("\n%s\n",translate(L_Enter_output_fname)); gets(output_filename); UCSCU_prompt_output_options(); textreader = -1; while ((textreader < 0) || (textreader > 2)) { printf("\nGenerate cross reference syntax for what kind of text reader\n"); printf("0. TEXT (no special hypertext commands.)\n"); printf("1. TVISION Borland's TurboVision help compiler.\n"); /* Not yet implemented printf("2. HTML Hypertext Meta Language.\n"); printf("3. HTML+ (currently the same as HTML.\n"); -AGUIDE Amigaguide (Not implement, but I have documentation on this) -HYPRTEXT Roger Nelsons hypertext reader for MS-DOS (not implement yet) -SMGL SMGL (not implemented, I have no documentation on this) */ scanf("%d",&textreader); }; }; #if defined(__STDC__) || defined(__cplusplus) void show_usage(void) #else void show_usage() #endif { printf("\nNon-interactive usage: latex2hy infilename outfilename options\n"); printf("\ninfilename is the LaTeX file, outfilename is the text file to be generated.\n"); printf("infilename and or outfilename may be a - hypen to indicate stdin or stdout.\n"); UCSCU_show_usage(); printf("\nOne of the following text readers may be selected:\n"); printf(" TEXT TVISION HTML HTMLPLUS\n"); printf("\nISO language code may be specified for foreign language translation.\n"); printf("\nInteractive usage: latex2hy\n"); }; #if defined(__STDC__) || defined(__cplusplus) void parse_command_line(int argc,char *argv[]) #else void parse_command_line(argc,argv) int argc; char *argv[]; #endif { int arg; strcpy(input_filename,argv[1]); strcpy(output_filename,argv[2]); UCSCU_parse_command_line(argc,argv); for (arg = 3; arg < argc; arg++) { if (strcmp(argv[arg],"TEXT") == 0) textreader = TR_STRAIGHTTEXT; if (strcmp(argv[arg],"TVISION") == 0) textreader = TR_TURBOVISION; if (strcmp(argv[arg],"HTML") == 0) textreader = TR_HTML; }; }; #if defined(__STDC__) || defined(__cplusplus) void generate_contents(FILE *outfile) #else void generate_contents(outfile) FILE *outfile; #endif { FILE *tocfile; int inchr; int hold_page_num; #ifdef VERBOSE printf("Generating table of contents\n"); #endif hold_page_num = page_num; /* We need to be able to restore the page numbering for the index paging */ page_num = 1; /* Reset page numbering for TOC */ fputc('\f',outfile); /* Plain formfeed because don't want number on title*/ tocfile = fopen("DELETEME.TOC",READMODE); if (tocfile) { while ((inchr = fgetc(tocfile)) != EOF) { fputc(inchr,outfile); if (inchr == '\n') { line_num += 1; check_page_break(outfile); }; if (inchr == '\f') { print_page_num(outfile); page_num += 1; line_num = 1; }; }; /* print_page_num(outfile); don't page break because abstract, part or chapter will do it*/ } else fprintf(stderr,"%s: DELETEME.TOC (%s)\n", translate(L_Unable_to_open_file),translate(L_Contents)); page_num = hold_page_num; }; #if defined(__STDC__) || defined(__cplusplus) void generate_index(char *docfilename) #else void generate_index(docfilename) char *docfilename; #endif { FILE *DMidxfile; /* DeleteMeindxfile */ FILE *docidxfile; FILE *indextexfile; FILE *newindextexfile; char docfilenameext[255]; int pagerenumber[10000]; int i; char DMindexstr[255]; char docindexstr[255]; int DMpage; int docpage; int inchar; int lastinchar = 0; strcpy(docfilenameext,docfilename); strcat(docfilenameext,".idx"); if ((DMidxfile = fopen("DELETEME.IDX",READMODE)) == 0) { fprintf(stderr,"%s: DELETEME.IDX (%s)\n", translate(L_Unable_to_open_file),translate(L_Index)); return; }; if ((docidxfile = fopen(docfilenameext,READMODE)) == 0) { fprintf(stderr,"%s: %s (%s)\n", translate(L_Unable_to_open_file),docfilenameext,translate(L_Index)); fclose(DMidxfile); return; }; for (i = 0; i < 10000;i++) pagerenumber[i] = 0; while(!feof(DMidxfile) && !feof(docidxfile)) { fscanf(DMidxfile,"%d %[^\n]\n",&DMpage,DMindexstr); fscanf(docidxfile,"\\indexentry"); strcpy(docindexstr,read_environment(docidxfile)); fscanf(docidxfile,"{%d}\n",&docpage); pagerenumber[docpage] = DMpage; }; fclose(DMidxfile); fclose(docidxfile); if ((indextexfile = fopen("index.tex",READMODE)) == 0) { fprintf(stderr,"%s: index.tex (%s)\n", translate(L_Unable_to_open_file),translate(L_Index)); return; }; if ((newindextexfile = fopen("DELETEME.ITX",WRITEMODE)) == 0) { fprintf(stderr,"%s: DELETEME.ITX (%s)\n", translate(L_Unable_to_open_file),translate(L_Index)); fclose(indextexfile); return; }; /* Now convert all page numbers in DVI file to the text document page numbers A page number can be identified because it will either be preceeded by a space or a '-', and will always be followed with a '-' ',' or newline. */ { int num = 0; int reading_number = 0; while (!feof(indextexfile)) { inchar = fgetc(indextexfile); if (reading_number) switch (inchar) { case ',' : case '-' : case '\n' : /* Normal termination of a page number. */ /* It is possible that some page renumberings were not identified in the index pagination scan, so we will have to guess the page number. */ if (!pagerenumber[num]) pagerenumber[num] = (num == 1) ? 1 : pagerenumber[num-1]+1; fprintf(newindextexfile,"%d%c",pagerenumber[num],inchar); reading_number = 0; num = 0; break; default : if ((inchar >= '0') && (inchar <= '9')) num = num * 10 + (inchar - '0'); else /* Unexpected character encountered in number, the number is probably part of the index key, so just dump it. */ { if (isdigit(lastinchar)) fprintf(newindextexfile,"%d%c",num,inchar); else fputc(inchar,newindextexfile); reading_number = 0; num = 0; }; break; } else { fputc(inchar,newindextexfile); switch (inchar) { case ' ' : case '-' : reading_number = 1; num = 0; break; }; }; lastinchar = inchar; }; }; fclose(indextexfile); fclose(newindextexfile); process_text_file("DELETEME",".ITX"); }; #if defined(__STDC__) || defined(__cplusplus) void resolve_refs(char *documentname) #else void resolve_refs(documentname) char *documentname; #endif { FILE *tempfile; FILE *outfile; if (strcmp(output_filename,"-") == 0) outfile = stdout; else outfile = fopen(output_filename,WRITEMODE); tempfile = fopen("DELETEME.TXT",READMODE); /* HTML needs to define the document, head and body */ switch (textreader) { case TR_HTML: fprintf(outfile,"\n\n\n"); break; case TR_HTMLPLUS: fprintf(outfile,"\n\n\n"); break; }; if (tempfile && outfile) { int inchar; while (!feof(tempfile)) { inchar = fgetc(tempfile); switch (inchar) { case TOC_MARKER : if (tableofcontents) generate_contents(outfile); break; case BEGIN_DOC_MARKER : switch (textreader) { case TR_HTML: case TR_HTMLPLUS : fprintf(outfile,"\n\n\n"); break; }; break; case START_REF_MARKER : { char_8bit labelstr[80]; int labelpos = 0; struct label_layout *label = 0; while ((inchar = fgetc(tempfile)) != END_REF_MARKER) labelstr[labelpos++] = inchar; labelstr[labelpos] = 0; label = lookup_label(labelstr); if (label) fprintf(outfile,"%s",label->enumeration); else fprintf(outfile,"???"); } break; default : fputc(inchar,outfile); } }; #ifdef VERBOSE fprintf(stderr,"Generating index\n"); #endif if (makeindex) generate_index(documentname); switch (textreader) { case TR_HTML: process_newline(); fprintf(outfile," \n"); break; case TR_HTMLPLUS : process_newline(); fprintf(outfile," \n"); break; }; fclose(outfile); fclose(tempfile); }; }; #if defined(__STDC__) || defined(__cplusplus) void cleanup_fixups(void) #else void cleanup_fixups() #endif { struct fixup_layout *next; struct fixup_layout *delete_fixup; for (delete_fixup= fixups; delete_fixup; delete_fixup= next) { next = delete_fixup->next; free(delete_fixup); }; }; #if defined(__STDC__) || defined(__cplusplus) void cleanup_labels(void) #else void cleanup_labels() #endif { struct label_layout *next; struct label_layout *delete_label; for (delete_label= labels; delete_label; delete_label= next) { next = delete_label->next; free(delete_label); }; }; /* Not implemented yet Page layout options Enable line breaks? Some hypertext readers perform their own paragraph justification. Enable page breaks? Newpage always forces form feed Use device control codes? For printer control. If page layout disabled: Line width: 80 Lines per page: 60 If page layout enabled: Paper Width: 8.5 inches Paper Length: 11.0 inches Left Margin: 0 Ms Right Margin: 0 Ms Top Margin: 0 Ms Bottom Margin: 0 Ms Use proportional spacing? Part title (\Huge) Part number (\Huge) Chapter title (\Huge) Appendix (\Huge) Bibliography (\Huge) x Index (\Huge) Table of contents (\Huge) x Chapter number (\huge) Section (\Large) Abstract (\Large) Subsection (\large) Subsubsection (\large) Paragraph (\normal \bf) Footnote (\footnote size) Print Styles: \rm Normal (Prestige if available) \em Italics \bf Normal bold \it Italics \sl Italics \sf Normal (prefer sanserif if available) \sc Normal (convert to capitals) \tt Normal (courier if available) \underline Underline text */ #ifdef VMS #if defined(__STDC__) || defined(__cplusplus) main(int argc, char *argv[]) #else main(argc,argv) int argc; char *argv[]; #endif #else #if defined(__STDC__) || defined(__cplusplus) int main(int argc, char *argv[]) #else void main(argc,argv) int argc; char *argv[]; #endif #endif { char *tex_pos = 0; char_8bit start_filename[256]; #ifdef HARDCODE_PHRASES language_set("en"); #else #ifdef amiga strcpy(RLIB_program_path,"latex2hyp:"); #else RLIB_start(argv[0]); #endif if (!language_init("en","L2H",RLIB_program_path,"phrases.lng")) { fprintf(stderr,"Unable to open language translation file: phrases.lng\n" "This file should be placed in the same directory as %s\n", RLIB_program_path); exit(1); }; #endif fixup = fopen("FIXUP.SS",WRITEMODE); if (argc == 1) prompt_options(); else if (argc < 3) { show_usage(); exit(1); } else parse_command_line(argc,argv); switch (textreader) { case TR_TURBOVISION : break_lines = 0; break_pages = 0; break; case TR_HTML : break_lines = 0; break_pages = 0; break; default : break_lines = 1; break_pages = 1; break; }; strcpy(start_filename,input_filename); tex_pos = strstr((char *)start_filename,EXT_TEX); if (!tex_pos) tex_pos = strstr((char *)start_filename,EXT_TEX); if (tex_pos) *tex_pos = 0; output_file = fopen("DELETEME.TXT",WRITEMODE); tocfile = fopen("DELETEME.TOC",WRITEMODE); idxfile = fopen("DELETEME.IDX",WRITEMODE); environ_stack[environ_SP]->font = normal_FONT; process_text_file(start_filename,EXT_TEX); fclose(output_file); fclose(tocfile); fclose(idxfile); #ifdef VERBOSE fprintf(stderr,"Resolving cross references\n"); #endif resolve_refs(start_filename); fclose(fixup); #ifndef HARDCODE_PHRASES language_end(); #endif }; reak; case TR_HTMLPLUS : process_newline(); fprintf(outfile," \n"); break; }; fclose(outfile); fclose(tempfile); }; }; #if defined(__STDC__) || defined(__cplusplus) void cleanup_fixups(void) #else void cleanup_fixups() #endif { struct fixup_layout *next; struct fixup_layout *delete_fixup; for (delete_fixlatex2hyp/phrases.h000644 001017 000764 00000005565 05645340420 016022 0ustar00rnelsonfaculty000000 000000 #ifndef PHRASES_H #define PHRASES_H enum language_phrases { LINGVO, L_Abstract, L_Appendix, L_Bibliography, L_Chapter, L_Contents, L_Copy_to, L_Enclosure, L_Enter_language_code, L_Enter_LaTeX_fname, L_Enter_output_fname, L_Figure, L_Figures, L_Index, L_Next_topic, L_Prev_topic, L_Preface, L_Part, L_Page, L_Read_topic, L_Read_biblio, L_Reference, L_See, L_See_also, L_Table, L_Tabels, L_To, L_Not_enough_memory, L_Unable_to_open_file, LANGUAGE_END_PHRASES }; #define language_num_phrases 29 #define language_num_languages 4 #ifdef LANGUAGE_THE_TRANSLATIONS char *language_codes[language_num_languages] = { "en", "da", "fr", "sv" }; char *language_translations[language_num_phrases][language_num_languages] = { {"English", "Dansk", "Francais", "Svensk"}, {"Abstract", "Resumé", "Resumé", "Resumé"}, {"Appendix", "Bilag", "Appendice", "Bilaga"}, {"Bibliography", "Bibliografi", "Bibliographie", "Bibliografi"}, {"Chapter", "Kapitel", "Chapitre", "Kapital"}, {"Contents", "Indhold", "Table de matière", "Innehåll"}, {"Copy to", "Kopi til", "Copie à", "Kopia til"}, {"Enclosure", "Vedlagt", "Enclos", "Bilaga"}, {"Enter one of the language codes listed above.", "Vældig en sprog kode fra ovenover.", "Choisir code de language cité-dessus.", "Väljar en språkkod frå ovanför."}, {"Entre el nombre de archivo LaTeX.", "Skrive in navn af LaTeX arkiven.", "Choisir le nom de fichier LaTeX.", "Skriva in namn av LaTeX arkiven."}, {"Entre el nombre de archivo output.", "Skrive in navn af output arkiven.", "Choisir le nom de fichier d'output.", "Skriva in namn av output arkiven."}, {"Figure", "Figur", "Figure", "Figur"}, {"Figures", "Figurer", "Figures", "Figurer"}, {"Index", "Indeks", "Indice", "Förteckning"}, {"Siguiente", "Næste emne", "Sujet suivant", "Nästa samtalsämme"}, {"Anterior", "Forudgående emne", "Sujet pr‚ced‚", "Föregående samtalsämme"}, {"Preface", "Forord", "Préface", "Förord"}, {"Part", "Del", "Part", "Del"}, {"Page", "Side", "Page", "Sida"}, {"Read_topic", "Læser emne", "Voir_sujet", "Läsar samtalsämme"}, {"Read_biblio", "Læser_biblio", "Voir_biblio", "Läsar_biblio"}, {"Reference", "Litteratur", "Référence", "Litteratur"}, {"See", "Se", "Voir", "Se"}, {"See also", "Se ogsä", "Voir aussie", "Se också"}, {"Table", "Tabel", "Table", "Tabel"}, {"Tables", "Tabeller", "Tables", "Tabeller"}, {"To", "Till", "A", "Til"}, {"No hay suficiente memoria para completar la operación.", "Memori er ikke disponibel for operationen.", "Mémorie non disponible. Opèration non complet.", "Memori ar inte disponibel för operationen."}, {"No se puede abrir el archivo", "Kan ikke åben arkiven", "Lecture de fichier non possible", "Kan inte öppnar arkiven"}}; #endif #endif latex2hyp/phrases.lng000644 001017 000764 00000006146 05645340424 016353 0ustar00rnelsonfaculty000000 000000 /* DIALEKTOJ */ LINGVO, /* L2H en English da Dansk fr Francais sv Svensk */ L_Abstract, /* L2H en Abstract da Resumé fr Resumé sv Resumé */ L_Appendix, /* L2H en Appendix da Bilag fr Appendice sv Bilaga */ L_Bibliography, /* L2H en Bibliography da Bibliografi fr Bibliographie sv Bibliografi */ L_Chapter, /* L2H en Chapter da Kapitel fr Chapitre sv Kapital */ L_Contents, /* L2H en Contents da Indhold fr Table de matière sv Innehåll */ L_Copy_to, /* L2H en Copy to da Kopi til fr Copie à sv Kopia til */ L_Enclosure, /* L2H en Enclosure da Vedlagt fr Enclos sv Bilaga */ L_Enter_language_code, /* L2H en Enter one of the language codes listed above. da Vældig en sprog kode fra ovenover. fr Choisir code de language cité-dessus. sv Väljar en språkkod frå ovanför. */ L_Enter_LaTeX_fname, /* L2H en Enter the name of the input LaTeX file. da Skrive in navn af LaTeX arkiven. fr Choisir le nom de fichier LaTeX. it Introdurre il nome del file LaTeX. es Entre el nombre de archivo LaTeX. sv Skriva in namn av LaTeX arkiven. */ L_Enter_output_fname, /* L2H en Enter the name of the output text file. da Skrive in navn af output arkiven. fr Choisir le nom de fichier d'output. it Introdurre il nome del file per l'output. es Entre el nombre de archivo output. sv Skriva in namn av output arkiven. */ L_Figure, /* L2H en Figure da Figur fr Figure sv Figur */ L_Figures, /* L2H en Figures da Figurer fr Figures sv Figurer */ L_Index, /* L2H en Index da Indeks fr Indice sv Förteckning */ L_Next_topic, /* L2H en Next topic da Næste emne fr Sujet suivant it Prossima es Siguiente sv Nästa samtalsämme */ L_Prev_topic, /* L2H en Previous topic da Forudgående emne fr Sujet pr‚ced‚ es Anterior sv Föregående samtalsämme */ L_Preface, /* L2H en Preface da Forord fr Préface sv Förord */ L_Part, /* L2H en Part da Del fr Part sv Del */ L_Page, /* L2H en Page da Side fr Page sv Sida */ L_Read_topic, /* L2H en Read_topic da Læser emne fr Voir_sujet sv Läsar samtalsämme */ L_Read_biblio, /* L2H en Read_biblio da Læser_biblio fr Voir_biblio sv Läsar_biblio */ L_Reference, /* L2H en Reference da Litteratur fr Référence sv Litteratur */ L_See, /* L2H en See da Se fr Voir sv Se */ L_See_also, /* L2H en See also da Se ogsä fr Voir aussie sv Se också */ L_Table, /* L2H en Table da Tabel fr Table sv Tabel */ L_Tabels, /* L2H en Tables da Tabeller fr Tables sv Tabeller */ L_To, /* L2H en To da Till fr A sv Til */ L_Not_enough_memory, /* L2H en Not enough memory available to complete operation. da Memori er ikke disponibel for operationen. fr Mémorie non disponible. Opèration non complet. it Memoria disponibile insufficiente per completare l'operazione. es No hay suficiente memoria para completar la operación. sv Memori ar inte disponibel för operationen. */ L_Unable_to_open_file, /* L2H en Unable to open file da Kan ikke åben arkiven fr Lecture de fichier non possible it Incapace di aprire il file es No se puede abrir el archivo sv Kan inte öppnar arkiven */latex2hyp/press.txt000644 001017 000764 00000005151 05645340433 016074 0ustar00rnelsonfaculty000000 000000 Subject: LaTeX to ASCII (and hypertext) Conversion update. LaTeX2hyp is a program which converts LaTeX to ASCII text file documents. (Although this program is intended for LaTeX, I have been informed that it often satisfactorily converts TeX documents as well.) Version 1.09 (Oct 6, 94) is now available. LaTeX2hyp is not just a deTeX program, but actually formats the text, performs character set substitutions, and generates cross references etc... It can also be used to generate hypertext cross references compatible with the Borland TurboVision help compiler. This allows you to maintain a single doclument for a printed manual and Online context sensitive help, and WorldWideWeb documents! LaTeX2hyp currently supports: Part,Chapter,Section, Appendix, etc. numbering. Enumeration, descriptions, itemizations. Accents and symbols. Bibliography. Table of contents. Index. Cross referencing of labels/refs and cites/bibitems. It currently doesn't do : Titlepage (Title page can be produced with %verbatim) Table of figures (because we are generating text files) newcommand (simple \newcommand replacements work, but complex syntax commands are beyond the scope of this program) This stuff is just ignored. Currently only a book/report/article like style is generated, however, styles generated by certain preprocessing programs are preserved (BibTeX bibliography, and index styles, for example). It has facilities for providing ASCII representations for mathmode equations, inline $$ mathmode, and tables and figures. Version 1.08/1.09 adds the following features (since 1.05): Index. Foreign language support. Corrects some problems with verbatims. Fixes section number when chapters are not used. Bibliography entries in output hypertext files are no longer put on separate pages. Corrects some compilation problems. I hope to have in the next version (2.0): Better LaTeX2e support. Tables. Let me know if you are interested in receiving the program by email or FTP. (I can provide the C source (UNIX/MS-DOS) and/or executable for MS-DOS). Roger _____________________________________________________________________ ______________ Roger Nelson rnelson@wsuaix.csc.wsu.edu ____ | Washington | Biological Systems Engineering Department \ | | State | You may reply in English, French, Esperanto, Swedish | // University | Danish, Norwegian or Spanish | ' Pullman, WA+| Work: (509)335-4714 \_ _________| Home: (509)332-8387 `-----'99164-6120 FAX: (509)335-2722 latex2hyp/latex2hy.doc000644 001017 000764 00000074205 05645625737 016451 0ustar00rnelsonfaculty000000 000000 [ The file should be UUENCODE or transfered in BINARY mode, because it contains 8-bit characters! ] LaTeX2hyp Written by Roger Nelson Biological Systems Engr. Dept. Washington State University Pullman, WA 99164-6120 rnelson@wsuaix.csc.wsu.edu Phone: (509)335-1578 FAX : (509)335-2722 This utility takes LaTeX documents and generates ASCII documents. It will also generate hypertext links which are compatible with the Borland TurboVision help compiler. I am using a very intuitive parsing method, but LaTeX is a very complicated macro package, so some strange command situations might not be handled correctly. (See LaTeX file restrictions below.) Let me know if you have problems. I have tested this program on a couple of large (~200 page) documents. Version 1 will probably also process basic TeX documents Ok, Version 2 is rather dependent of LaTeX syntax and document structure. Don't hesitate to send me Email if you have any questions. This document is the user manual for LaTeX2hyp for both version 1 and version 2. Lines beginning with: | indicates recent changes. 1 indicates the feature is available only in version 1. 2 indicates the feature is available only in version 2. W indicates the feature is available only in the MS-Windows version. Version 1 is written in C and will compile with any C compiler (ANSI, K&R or C++). Version 2 is written in C++ (currently only Borland C++ 4.0 because I am using its string class, Borland claims it is standard, but I know it is not compatible with the G++ string class) and will offer more features. - HTML support: Index X-ref Content X-ref \quote \quotation -> HTML quote - HTML+ support inaddition to HTML: \footnote -> HTML+ footnotes \author -> HTML+ Bylines \abstract -> HTML+ Abstract - Better font support and mini-environments. - Printer control sequences. - Table environments. Usage: For installation see "Compilation and Installation" below. Non-interactive mode: latex2hyp infilename outfilename options infilename is the name of the latex document. outfilename is the name of the ASCII file to be generated a - hypen may be specified for the input and output filename to use stdin and stdout respectively. The extension must be specified (unlike previous versions). The input and output filenames must be different. Any existing filename matching the output filename WILL BE OVERWRITTEN. Any input files specified with \include{} will be included. Output that is written to stdout can be captured in a file with redirection or piping i.e.: latex2hyp filename.tex > filename.txt Both the input and output file names are required for non-interactive mode, and any options specified must follow the output file name. Options: You may select BOTH 7-bit and 8-bit character sets. 2 Version 2 recognizes almost every character set in the know universe. 2 Run LaTeX2hyp with out any command line arguments to get a list of all the 2 supported character sets. 1 Version 1 is limited to translating the following character sets. 1 1 The 7-Bit options may be one of the following ASCII/ISO character sets 1 currently supported (case is significant): 1 1 ENGLISH 1 FINNISH 1 SWISS 1 FRENCH 1 PORTUGUESE 1 ITALIAN 1 SPANISH 1 DUTCH 1 SWEDISH 1 NORDIC (Norwegian and Danish 1 BELGIAN (French and Flemish) 1 GERMAN (Also Austrian) 1 1 The 8-bit options may be one of the following international character sets 1 currently supported (case is significant): 1 1 NONE For no 8 bit characters only 7-bit ISO or ASCII representations. 1 PC8 For IBM-PC and most IBM-PC printers. 1 MNCS For multi-national character set on most DEC machines. 1 AMIGA For the Amiga default character set. 1 ECMA94 For the ECMA-94 (Latin 1) character set. 1 ROMAN8 For most new printers, including the HP series and compatibles. 1 EPSON8 For most older printers and the Epson series. 1 PC850 MS-DOS PC Multilingual (Latin 1). 1 PC852 MS-DOS PC Slavic (Latin 2). 1 PC860 MS-DOS Portugal code page. 1 PC863 MS-DOS Canadian-French code page. 1 PC865 MS-DOS Nordic (Norway/Denmark) code page. 1 PCDN Denmark/Norway (HP laser printers). 1 PRINTER Most other printers with limited 8-bit characters: 1 Toshiba-1340, Qume-Sprint-11, Diablo-630.\n\n"); Back spacing options (case is significant): BS_NORMAL BS_NEVER BS_NOT_CAP BS_OMIT; When an appropriate 7 or 8 bit accented letter is not available the respective unaccented letter will be used, additional diacritical marks can also be optionally added: BS_NORMAL Add backspace character and diacritical mark (accent) I.e. A bs ' Choose this option for output intended for a printer BS_NEVER Only print the unaccented letter. Choose this option for output line terminals or where adding additional characters would mess up formatted output. BS_NOT_CAP Backspace only on lower case characters. Choose this option for older 9 pin printers where there is no space above capital characters to place the diacritical mark. BS_OMIT Add the diacritical mark, but not the backspace: I.e. A' Choose this option for output intended for text display where formatting and character positioning is not important. Graphics symbol draw options (case is significant): GR_NORMAL GR_MARK GR_NONE When a graphics character or special symbol is not available in the target character set, the converter can attempt to draw the character by using characters that are available by backspacing and typing over characters. The quality of the results will vary depending on the device: GR_NORMAL Try to draw the character using multiple characters. This option should only be used for output intended for printers. GR_MARK Mark the graphic using a single question mark. Use this option where it would be helpful to see where graphics characters would be positioned. Note that line drawing characters will be replaced with plus for intersections, tees and corners, minus and bar for lines. GR_NONE No graphics - use space. Use this option if drawing replacement graphics is unacceptable. 7-Bit selection preference (case is significant): PREFER7BIT When outputting an accented letter or symbol, or using diacritical marks: If the character appears both in the 7-bit and the 8-bit character set, should the from the 7-bit set be used instead of the 8-bit character? Usually use PREFER7BIT when the output is intended for a printer or line terminal, but not when the output is intended for a PC or workstation. Text file reader options (case is significant): TEXT No special hypertext commands. TVISION Turbovision help compiler. 2 HTML Hypertext Meta Language. 2 HTML+ Hypertext Meta Language Plus. 2 See the section (LaTeX2hyp vs. LaTeX2html). 2 AMIGAGUIDE Amiga Guide. I would like to add support for the following hypertext readers: SMGL SMGL (not implemented, I have no documentation on this) 2 Printer control codes 2 2 ANSI This will generate ANSI standard escape sequences for generating 2 printer control for font selection, text attributes etc. 2 I believe only the Amiga supports this, but there may exist 2 utilities which translate these escape sequences to other printer 2 native control codes. 2 When ANSI option is given Escape sequences will only be generated 2 in the TEXT and AMIGAGUIDE hypertext readers. 2 TurboVision help does not support any text attributes and 2 HTML has its own text highlighting commands. Interactive mode: When no parameters are specified on the command line: latex2hyp The program will prompt for filenames and options. LaTeX2hyp LaTeX document preparation. The following special commands may be imbedded in the LaTeX document. The commands are case sensitive. They appear as TeX comments: %verbatim This is used to enter lines of text. The successive lines to be entered verbatim must each begin with a % (the % is not printed). The verbatim ends with a blank line. Because any \begin{equation}...\end{equation} blocks in the LaTeX document will be skipped over, the verbatim command can be used to enter text drawings, and equations using ASCII characters. In version 1 of LaTeX2hyp an equation would be entered like this : 1 %label{quadratic} 1 %verbatim 1 % __________ 1 % / 2 1 % -b - \/ -b - 4ac 1 % Q = ------------------- 1 % i 2a 1 1 \begin{equation} \label{quadratic} 1 Q_i = \frac{-b - \sqrt{-b^2 - 4ac}}{2a} 1 \end{equation} 2 Version 2 of LaTeX2hyp now tries to generate table and equation environments 2 however, it might not be able to do a very good and it might be best to give 2 a verbatim representation of your table equation or figure. When LaTeX2hyp 2 encounters a %verbatim within an equation, table, or figure, it will use 2 the %verbatim block and any other TeX code following the %verbatim block 2 upto the \end{} command for the table/equation/figure will be ignored. 2 2 If %HTML, and/or %HTML+ and/or %AMIGAGUIDE lines immediately follow the 2 %verbatim line, LaTeX2hyp will assume the command lines will 2 give a representation of the equation/table/figure that the respective 2 hypertext reader can process (I.e. a graphic image of the equation or figure) 2 or perhaps an HTML+ table environment. 2 2 Thus in version 2, the previous example would look like this: 2 2 \begin{equation} \label{quadratic} 2 %verbatim 2 %HTML 2 %AMIGAGUIDE @icon "quadratic.iff" 2 % __________ 2 % / 2 2 % -b - \/ -b - 4ac 2 % Q = ------------------- 2 % i 2a 2 2 Q_i = \frac{-b - \sqrt{-b^2 - 4ac}}{2a} 2 \end{equation} 2 2 Any 8bit characters encountered in the verbatim block will automatically 2 be converted from the specified input character set to the specified output 2 character set. For generating tables with PC-8 box drawing characters, you may want to try my program 'boxer' which takes boxes drawings such as: +-----+---+---+ +------+ |Name | A | B | | +------+ +-----+---+---+ +------+ | |Bob |789|123| +------+ |Jill |123|456| +-----+---+---+ And replaces adjacent +-| characters with appropriate lines, angles, tees. 1 %label{labelID} 1 1 This works just like the \label{labelID} LaTeX command. 1 It is used to label tables and equations in %verbatim environments. 1 The labels should be put just above the %verbatim command so that 1 the %label line doesn't become part of the verbatim text. 1 1 Notice that in LaTeX, labels are often put after sections: 1 1 \section{My section} \label{mysection} 1 1 LaTeX2hyp processes text as quickly as possible with limited buffering. 1 Since \ref{} references text within a part/chapter/section etc., it 1 doesn't make sense to place the label after the /section command in 1 LaTeX2hyp because you want to have your hypertext link point to the 1 beginning of the section. Therefore, LaTeX2hyp uses the \label{} command 1 to generate the cross reference enumerations, and uses the %label{} 1 commands for placement of hypertext topic links. The %label{} command 1 should be placed before the \section{} command: 1 1 %\label{mysection} 1 \section{My section} \label{mysection} 2 The %label command is obsolete in version 2. 2 LaTeX2hyp now uses the normal LaTeX \label{} command. 2 The label reference is linked to the last part/chapter/section/subsection 2 subsubsection/paragraph/subparagraph or text enclosed in braces { }. 2 \index{} command 2 2 LaTeX2hyp now honours indexing. The entry in the index is linked to the 2 last part/chapter/section/subsectionsubsubsection/paragraph/subparagraph 2 or text enclosed in braces { }. Making hypertext links: When using one of the hypertext modes, hypertext links within the document will automatically be generated where ever \ref \label (%label) commands are. If using BibTeX, bibliography citations are also cross referenced. 2 Version 2 also generates a hypertext index! For hypertext documents intended to access remote sites on the World Wide Web you can embed hypertext markup commands as follows. Embedding hypertext reader commands 1 %\hypertextcommand 1 %@hypertextcommand 1 % For now, use %verbatim 1 \author / \begin{titlepage...\end{titlepage} \frontmatter \ \mainmatter > seem like superfluous command to me \backmatter / \setcounter \addtocounter \newenvironment \hspace \vspace \hfill \bibliographystyle (bibliography should already be processed with BibTeX.) \includeonly (use include) All math mode stuff (use the %verbatim command), including LaTeX2e mathmode font selection (Why did they have to go and make separate commnds for this?!?!). Inline \[ and \] should be moved out of a continuous text paragraph and entered as one would normally enter and equation: Some text here \[The equation\] some more text. should be written as: Some text here %verbatim % The equation \begin{equation} The equation \end{equation} some more text. or use $$ inline equations if possible. Inline equations using $$ do not have to be changed, just provide %fixup commands as described below. All tabbing environment stuff. including the stupid \kill. 1 All array, figure and table stuff (use the %verbatim command). 2 Some array, figure and table stuff All picture stuff. (we are dealing with ASCII text aren't we...) 1 All units, lengths and widths. 2 Version 2 will use lengths ans widths in some places. All command dealing with hypenation (LaTeX2hyp doesn't hypenate). LaTeX2e pagination \enlargethispage \enlargethispage* does nothing. \pagebreak[n] and \clearpage works like \newpage. \nopagebreak and \samepage are not implemented. \suppressfloats[placement] All pagination is ignored when generating hypertext documents. 1 All spacing command (hspace vspace) 2 Version 2 tries to do spacing by assuming the text reader shows normal 2 characters at 10,11,or 12 point (specified by documentstyle) 2 and converting the specified units for the current font and adding 2 the required number of hard spaces or new lines. 2 In most instances the spacing is not necessary especially with 2 hypertext output. The following LaTeX2e commands are ignored because they do nothing to the final output file: \listfiles \setcounter{errorcontextlines} \begin{filecontents}[filename] \end{filecontents} \nocorr don't know what this does The following LaTeX commands are incompletely implemented. The commands are ignored, but the text argument is still inserted: 1 \footnote (entered at current position in the text in parenthesis) 2 In version 2 are presented as hypertext links to the footnote text. in text file output, footnotes are given a footnote page before the bibliography. \newtheorem 1 All boxes and minipage stuff. 2 Version 2 will try to make boxes Font changes should have the text enclosed in braces: Fonts are, of course, ignored in straight text output. 1 Version 1 honours font/emphasize commands in the form: 1 \tt{text} This only changes the font of the enclosed text 2 Version 2 does honour the LaTeX font commands of this form: however, it 2 does honour the new LaTeX2e emphasis commands that have this form 2 (I.e. \emph{text}, \textrm{text}). The prefered form to use is: {\tt text} This changes the default font for the current environment. \tt text This is more consistent with the new LaTeX2e font selection. 2 LaTeX2hyp treats the LaTeX font selection commands as if they were the 2 respective LaTeX2e family, shape and series font commands. {\rm text} {\sl text} {\bf text} {\em text} {\it text} {\tt text} {\sf text} {\sc text} | In LaTeX, the commands listed above allow only a single font attribute to | be applied, I.e. {\bf this is {\it some} text} | The words "this" "is" and "text" are bold faced, and "some" is italicized, | where as one would expect "some" to be both italic and bold. | This seems to be more an oversite in the design of LaTeX than a desired | behaviour; indeed, LaTeX2e does away with these commands altogether. | In order to simplify things LaTeX2hyp will make "some" italic and bold, | we're all using LaTeX2e anyways right?!?!?!?! Fixups After processing a file, the generated file may require the following fixup operations: The $..$ mathmodes cannot be converted. For example, one may want to change symbols to PC8 or some other character set ASCII equivalents: ^{\circ} ø (248) \rightarrow -> (196) (26) \leftarrow <- (27) (196) \sum ä (228) ^2 ý (253) ^n ü (252) \underline{<} ó (243) \underline{>} ò (242) \frac{1}{2} « (171) \frac{1}{4} ¬ (172) all greek characters \alpha à (224) \Beta á (225) \Gamma â (226) \pi ã (227) \Sigma ä (228) \sigma å (229) \mu æ (230) \tau ç (231) \Phi è (232) \Theta é (233) \Omega ê (234) \delta ë (235) \infinity ì (236) \null í (237) \epsilon î (238) \cdot ú (250) check for ^ eponentiation. check for \frac{x}{y} and replace with (x/y). 2 LaTeX2hyp version 2 now uses the new UCSCU library so 8bit characters 2 used in fixup replacement string will automatically be converted from the 2 specified input file character set to the specified output character set. To help in the cleanup operations, %fixup command entries can be provided in the LaTeX document. %$LaTeXexpression$|ASCIIexpression This way you should only have to do the cleanups once. Any $...$ math mode expressions matching the LaTeX expression in the document will be replaced with the respective ASCII expression. To help make %fixup entries, a file FIXUP.SS is generated each time the input file is processed. | (The FIXUP.SS file was named FIXUP.$$ in previous versions, but $ is an | invalid character for filenames in some file system. This file contains records of the form: %$LaTeXexpression$|LaTeXexpression for any $$ mathmode text that doesn't have a fixup replacement. This file can be included in the LaTeX documents and the LaTeXexpression field following the '|' character needs to be replaced with the ASCII text representation. Here is an example of a fixup entry: %fixup %$1mm$|1mm %$ daylength \underline{<} \ daylength_{if}$| daylength ó daylength_if %$ f(W,T) = min[f(W), f(T)] $| f(W,T) = min[f(W), f(T)] %$(-1,500 \frac{J}{kg})$|(-1,500 J/kg) %$(-30 \frac{J}{kg})$|(-30 J/kg) %$(0.1 \frac{g}{cm^3})$|(0.1 g/cm3) %$(3.0-9.0 \frac{\frac{kg}{m^2} \cdot kPa}{m})$|(3.0-9.0 ((kg/mý) ú kPa)/m) %$(30^{\circ}C)$|(30øC) Here I am using the PC-8 character set, you may use whatever font/character set is appropriate on your system. Compilation and Installation: A Makefile is include for UNIX and Amiga compilation. You may need to add CFLAGS for your compiler. A the file latex2hy.mak is available for Borland C/C++ compilers. Simply move the latex2hyp executable to a pathed directory. or add the latex2hyp directory to your path: Amiga: Use the AmigaDOS command assign to the latex2hyp directory I.e.: ASSIGN latex2hyp: dh0:latex2hyp PATH latex2hyp ADD You may want to add this to your S:CLI-startup sequence. MS-DOS: Add the latex2hy directory to your path. UNIX: Simply place latex2hyp in a pathed directory (I.e. /usr/bin or /usr/local/bin). LaTeX2hyp now offers foreign language support! The file phrases.lng contains the translations for words and phrases that will appear in the output document or error messages. You can easily add your own phrases for localization. (Refer to the file latex2hy.h for instructions on modifying the file phrases.lng.) Please send me your modified phrases.lng file, and I will add them to the distribution. Also, I would also appreciate translations for the option prompts, since I intend to add these to the phrases file. DELETEME.* files LaTeX2hyp generates a number of temporary files which contain buffers of text used in assembling the documents. All these files which have the filename DELETEME with some extension may be deleted. |HTML conversion notes | | If you intend to include HTML commands in your file, any commands that | go in the HTML HEAD section should be placed in the LaTeX preable section | of the source documents (Before \begin{document}). | | LaTeX2hyp automatically generates local document anchors of the: | text | text | | You can always add external URL hrefs of the form: | % the document title | % the document title | | The preceding % will embed the hypertext command in the final document. | See the section on "Embedding hypertext commands". |LaTeX2hyp vs. LaTeX2html | | Although I have not used LaTeX2html, I have read over the documentation | and here is a list of the more significant differences between LaTeX2hyp | and LaTeX2html. | | LaTeX2hyp does not require any special style file, LaTeX can processes | a file with LaTeX2hyp markups which appear as comments to LaTeX. | LaTeX2html requires a special style file inorder to support LaTeX2html | markups. | | LaTeX2hyp can generate a hypertext document without adding any additional | LaTeX2hyp mark ups to the document (But you will usually want to add %label, | %fixup and %verbatim commands. | | LaTeX2hyp can generate not only HTML documents, but formatted plain ASCII | and, AmigaGuide and Borland TurboVision help files. | | LaTeX2hyp doesn't yet do figures, tables, equations. LaTeX2html supports | these features. LaTeX2html requires several additional utilities | (GhostScript, psdvi, etc.) to provide the figures, tables and equations as | inline graphics images in the document. Although LaTeX2hyp doesn't | automatically generate the inline .GIF images, you can always generate them | yourself by clipping out the figure from your DVI display of the document | and inserting the %HTML in the LaTeX document. | | So how do I decide when to use LaTeX2html and when to use LaTeX2hyp? | - LaTeX2hyp is well suited to converting existing LaTeX. | - LaTeX2html requires additional markups. | - Use LaTeX2hyp when you don't have versions of the postscript utilities | required by LaTeX2html for your computer. Additional notes: LaTeX2hyp version 1 should compile under any C compiler. It was developed under Borland C++. Send me a note if you would like me to email you the IBM-PC or Amiga executable. Things I hope to eventually add: Included with LaTeX2hyp distribution is UCSCU which can be compiled as a standalone Universal Character Set Conversion Utility. See the file ucscu.doc Hypertext readers: I would be interested in adding command line switchs for additional hypertext reader links. I will have support for my hypertext reader. My hypertext reader supports the following features: - MS-DOS text and or graphics modes EGA/VGA. - Multiple fonts in graphics modes. - Active icons or highlighted text can serve as hypertext links. The TurboVision help compiler has a buffer size of 1024 bytes. You may want to expand the size of this buffer to 3 or 4K and recompile TVHC if long text blocks with leading white spaces on each line are being truncated. nd phrases that will appear in the output document or error messages. You can easily add your own phrases for localization. (Refer to the file latex2hy.h for instructions on modifying the file phrases.lng.) Please send me your modified phrases.lng file, and I will add them to the distribution. Also, I would also appreciate translations for the option latex2hyp/makefile000644 001017 000764 00000001152 05645346240 015676 0ustar00rnelsonfaculty000000 000000 OBJS = \ ltx2hyp1.o \ language.o \ ucscu.o \ rlib.o SRCS = \ ltx2hyp1.c \ rlib/language.c \ rlib/ucscu.c \ rlib/rlib.c # CFLAGS you may like to add: # -O is for compiler optimization. # -DUNIX for UNIX. # -Damiga for amiga (may already be defined by compiler). # -I. is so the compiler can find the rlib directory. # -Hpcc For AIX Relaxes strict ANSI-C complience # something similar may need to be defined on other compilers # -w FOR AIX relaxes warning messages CFLAGS = -DUNIX -DHARDCODE_PHRASES -I. -w -Hpcc latex2hyp: $(OBJS) cc $(CFLAGS) -o latex2hyp $(OBJS) 49709i9804179*)¿'Rawisuda Senavatin/u2/wsuaix/i9804179/usr/bin/csh)¿mcgrew*GôTimothy McGrew/u2/wsuaix/mcgrew/usr/bin/cshmcgrewi9494799*(0'Chih Chao Yeh/u/wsuaix/i9494799/bin/cshi9494799rnelson*ôroger nelson/u/wsuaix/rnelson/bin/cshjpan*àÐjianping pan/u/wsuaix/jpan/bin/cshjpanjpeterse*õôJames Petersen - facu versions of the postscript utilities | required by LaTeX2html for your computer. Additional notes: LaTeX2hyp version 1 should compile under any C compiler. It was developed under Borland C++. Send me a note if you would like me to email you the IBM-PC or Amiga executable. Things I hope to eventually add: Included with LaTeX2hyp distribution is UCSCU which can be compiled as a standalone Universal Character Set Conversion Utility. See the file ucscu.doc Hypertext readers: I would be interested in adding command line switchs for additional hypertext reader links. I will have support for my hypertext reader. My hypertext reader supports the following features: - MS-DOS text and or graphics modes EGA/VGA. - Multiple fonts in graphics modes. - Active icons or highlighted text can serve as hypertext links. The TurboVision help compiler has a buffer size of 1024 bytes. You may want to expand the size of this buffer to 3 or 4K and recompile TVHC if long text blocks with leading white spaces on each line are being truncated. nd phrases that will appear in the output document or error messages. You can easily add your own phrases for localization. (Refer to the file latex2hy.h for instructions on modifying the file phrases.lng.) Please send me your modified phrases.lng file, and I will add them to the distribution. Also, I would also appreciate translations for the option latex2hyp/makefile000644 001017 000764 00000001152 05645346240 015676 0ustar00rnelsonfaculty000000 000000 OBJS = \ ltx2hyp1.o \ language.o \ ucscu.o \ rlib.o SRCS = \ ltx2hyp1.c \ rlib/language.c \ rlib/ucscu.c \ rlib/rlib.c # CFLAGS you may like to add: # -O is for compiler optimization. # -DUNIX for UNIX. # -Damiga for amiga (may already be defined by compiler). # -I. is so the compiler can find the rlib directory. # -Hpcc For AIX Relaxes strict ANSI-C complience # something similar may need to be defined on other compilers # -w FOR AIX relaxes warning messages CFLAGS = -DUNIX -DHARDCODE_PHRASES -I. -w -Hpcc latex2hyp: $(OBJS) cc $(CFLAGS) -o latex2hyp $(OBJS) 49709i9804179*)¿'Rawisuda Senavatin/u2/wsuaix/i9804179/usr/bin/csh)¿mcgrew*GôTimothy McGrew/u2/wsuaix/mcgrew/usr/bin/cshmcgrewi9494799*(0'Chih Chao Yeh/u/wsuaix/i9494799/bin/cshi9494799rnelson*ôroger nelson/u/wsuaix/rnelson/bin/cshjpan*àÐjianping pan/u/wsuaix/jpan/bin/cshjpanjpeterse*õôJames Petersen - facu