diff options
Diffstat (limited to 'Master/texmf-dist/source/fonts/malayalam/preproc')
40 files changed, 5500 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/ack2mm.pat b/Master/texmf-dist/source/fonts/malayalam/preproc/ack2mm.pat new file mode 100644 index 00000000000..e170b646389 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/ack2mm.pat @@ -0,0 +1,93 @@ +% ack2mm.pat --- patterns to convert transcription used in A.C.K +% (designed by Mathai Chundat) to my transcription +% (c) 1993 Jeroen Hellingman +% last edit: 22-JAN-1993 + +% I use a different transcription, that is more regular than the +% A.C.K. one, and in line with the transcriptions I use for other +% Indian languages. The things I prefer in MC's transscription +% is the use of nG, nnG, nJ, and nnJ. but I didn't use G, since I +% use it in transcription of Hindi for something else. I may change +% my transcription to accept both in Malayalam -- there are some +% differences anyway, for example, in Hindi I use e for ee. +% +% KNOWN PROBLEMS: +% colon may stand for itself or for visargam; this file assumes the visargam. + + +@patterns 0 +"<malayalam>" 1 "$" +"$" 1 "$" + +@patterns 1 +"</malayalam>" 0 "$" +"$" 0 "$" +% vowels +"a" p "a" +"aa" p "aa" +"A" p "aa" +"i" p "i" +"ee" p "ii" +"u" p "u" +"oo" p "uu" +"R~" p ".r" +"e" p "e" +"E" p "ee" +"o" p "o" +"O" p "oo" +"ai" p "ai" +"ou" p "au" +"am" p "am" +":" p "H" +"wa" p "ua" % u + a = wa (?) +% ka +"k" p "k" +"kh" p "kh" +"g" p "g" +"gh" p "gh" +"nG" p "n\"" +"nnG" p "n\"n\"" +% ca +"ch" p "c" +"Ch" p "ch" +"j" p "j" +"jh" p "jh" +"nJ" p "n~" +"cch" p "cc" +"nnJ" p "n~n~" +% Ta +"t" p "T" +"T" p "Th" +"D" p "D" +"Dh" p "Dh" +"N" p "N" +% ta +"th" p "t" +"Th" p "th" +"d" p "d" +"dh" p "dh" +"n" p "n" +"tth" p "tt" +"tTh" p "tth" +"tdh" p "tdh" +"tbh" p "tbh" +% pa +"p" p "p" +"ph" p "ph" +"b" p "b" +"bh" p "bh" +"m" p "m" +% yaraladikaaL +"y" p "y" +"r" p "r" +"l" p "l" +"v" p "v" +"S" p "sh" +"sh" p "S" +"s" p "s" +"h" p "h" +"R" p "R" +"zh" p "zh" +"L" p "L" +"TT" p "RR" +@end diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/avltree.c b/Master/texmf-dist/source/fonts/malayalam/preproc/avltree.c new file mode 100644 index 00000000000..909898a01ab --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/avltree.c @@ -0,0 +1,699 @@ +/*+ + +TITLE: AVLtree.c general purpose balanced trees. + +DESCRIPTION: + General purpose binairy-tree functions. This package uses AVL-trees + to ensure proper balancing. (The heigth of the tree will never exceed + ceil(1.44 * lg(n)), where lg is the logarithm base 2 and n the number + of elements.) This package can be used to store any kind of data in a + binairy tree. The only thing you have to do is to include AVLtree.h, + link AVLtree.lib and call the appropriate functions. You should also + provide a function to compare elements, and to free the memory used + by elements. + +USAGE: + To use the AVLtree package, include the file AVLtree.h in your + program. A root of a binairy tree can then be declared as follows: + + AVLtree *a_binairy_tree; + + The following operations are defined for Binairy trees: + + -- Insert an element in the tree + -- Delete an element in the tree + -- Find an element in the tree + -- Traverse the tree + + These operations are described below. You should always change the + AVLtree structure by these functions. Don't go jamming in its + structure yourself: it's delicate. + +FUNCTIONS: + Inserting an element: + Use the function AVLinsert() to insert an element. Its + prototype is: + + int AVLinsert(const void *element, + AVLtree **root, + int (*cmp)(void*, void*)); + + element is a pointer to the element you want to insert in the + tree. Since it is this pointer that is actually stored in the + AVL-tree, you should not touch the space it is pointing at + after its insertion in the tree. + root is a pointer to a pointer to the root node of the tree. + A double reference is needed, since the root can change. + cmp() is a user defined function. It should compare two + elements and return 0 if the elements are equal, 1 if the first + element is 'bigger' than the second, and -1 if the first + element is 'smaller' than the second. + + The function will return one of the following codes: + + -- AVL_OK everything is alright. + -- AVL_DUP attempt to insert element already present. + -- AVL_NO_MEM no memory could be allocated. + -- AVL_ERROR called with incorrect parameters. + + Deleting an element: + Use the function AVLdelete() to delete an element from the + tree. Its prototype is: + + int AVLdelete(const void *element, + AVLtree **root, + int (*cmp)(void*, void*), + void (*del)(void*)); + + element is the element to be deleted from the tree. + root and cmp() are the same as in AVLinsert(). del() is a user + defined function that should free the memory occupied by the + element in the tree. It is passed a pointer to the element to + be deleted. + + The function will return one of the following codes: + + -- AVL_OK everything is alright. + -- AVL_NO_DEL attemp to delete non-existant element. + -- AVL_ERROR called with incorrect parameters. + + Finding an element: + To find an element, the function AVLfind() should be used. Its + prototype is: + + void *AVLfind(const void *element, + AVLtree *root, + int (*cmp)(void*, void*)); + + element is the element to be found, root is a pointer the the + root node of the tree. cmp() is the same as in AVLinsert(). + + The function will return a pointer to the found element, or + NULL if the element could not be found. + + Traversing the tree: + The tree can be traversed in three ways: + + -- preorder AVLpreorder() + -- inorder AVLinorder() + -- postorder AVLpostorder() + + Inorder traversal will yield all elements in their correct + order. + + The prototypes are: + + void AVLpreorder(AVLtree *root, void (*func)(void*)); + void AVLinorder(AVLtree *root,void (*func)(void*)); + void AVLpostorder(AVLtree *root,void (*func)(void*)); + + root is a pointer to the tree to be traversed, and + func() is a user defined function that will be called at + every node. This could do something with that element, like + printing it. + + These functions return nothing. + +DOCUMENTATION: + Robert L. Kruse, "Data Structures and Program Design" (2nd Ed.) + pp. 344-356. + +AUTHOR: + Jeroen Hellingman, 't Zand 2, 4133TB Vianen, the Netherlands. + +COPYRIGHT: + Copyright (c) Jeroen Hellingman 1990. + License is granted for any non-commercially and non-millitary use + of this package, provided that this notice is kept intact. Use of + this software in any product that is sold for profit or usage by + (semi-)militairy organisations is forbidden. (contact me for + commercial usage) Donations are always appreciated (postbank + giro 5025409). + +CAVEAT: + I can take no responseability whatsoever if this software + is malfunctioning. If you find any bug in it, please fix it and + notice me. If you can't fix it, you can also notice me, I might + try to fix it. + +HISTORY + 18-DEC-1992 last edit + 04-NOV-1992 declared static functions static in prototype too. + gcc seems to complain about this (JH) + 01-DEC-1989 creation (Jeroen Hellingman) + +-*/ + +/* #define TEST */ + +#include "avltree.h" +#include <stdlib.h> +#include <stddef.h> +#include <stdio.h> + +#define TRUE 1 +#define FALSE 0 + +#define EQUAL 0 +#define LEFT 1 +#define RIGHT 2 + +/* ANSI C prototypes */ + +static int insert(const void *element, AVLtree **root, + int (*cmp)(void*, void*), int *taller); +static int delete(const void *element, AVLtree **root, + int (*cmp)(void*, void*), void (*del)(void*), int *shorter); +static void left_balance(AVLtree **root); +static void right_balance(AVLtree **root); +static void left_rebalance(AVLtree **root, int *shorter); +static void right_rebalance(AVLtree **root, int *shorter); +static void left_rotate(AVLtree **root); +static void right_rotate(AVLtree **root); +static void error(int errno); + +/* add element to AVL-tree */ + +int AVLinsert(const void *element,AVLtree **root,int (*cmp)(void*, void*)) +{ int taller = FALSE; + + if(element == NULL) return AVL_ERROR; + return insert(element, root, cmp, &taller); +} + +int AVLdelete(const void *element,AVLtree **root,int (*cmp)(void*, void*), + void (*del)(void *)) +{ int shorter = FALSE; + + if(element == NULL) return AVL_ERROR; + return delete(element, root, cmp, del, &shorter); +} + +static int insert(const void *element, AVLtree **root, + int (*cmp)(void*, void*), int *taller) +{ int result; + int tallersubtree = FALSE; + AVLtree *subtree; /* needed since you can't do & on a struct member */ + + if(*root == NULL) /* then adding is really easy */ + { *root = (AVLtree *) malloc(sizeof(AVLtree)); + if(*root == NULL) return AVL_NO_MEM; + (*root)->element = element; + (*root)->balance = EQUAL; + (*root)->left = NULL; + (*root)->right = NULL; + *taller = TRUE; + result = AVL_OK; + } + else /* recursively insert in appropriate subtree */ + { int compare = (*cmp)(element,(*root)->element); + + if(compare == 0) return AVL_DUP; + else if(compare < 0) + { subtree = (*root)->left; + result = insert(element,&subtree,cmp,&tallersubtree); + (*root)->left = subtree; + if(tallersubtree) + switch((*root)->balance) + { case LEFT: left_balance(root); + *taller = FALSE; + break; + case EQUAL: (*root)->balance = LEFT; + *taller = TRUE; + break; + case RIGHT: (*root)->balance = EQUAL; + *taller = FALSE; + } + else *taller = FALSE; + } + else + { subtree = (*root)->right; + result = insert(element,&subtree,cmp,&tallersubtree); + (*root)->right = subtree; + if(tallersubtree) + switch((*root)->balance) + { case RIGHT: right_balance(root); + *taller = FALSE; + break; + case EQUAL: (*root)->balance = RIGHT; + *taller = TRUE; + break; + case LEFT: (*root)->balance = EQUAL; + *taller = FALSE; + } + else *taller = FALSE; + } + } + return result; +} /* end of insert() */ + +static int delete(const void *element, AVLtree **root, + int (*cmp)(void*, void*), void (*del)(void*), int *shorter) +{ int result; + int compare; + int shortersubtree = FALSE; + AVLtree *subtree; + + if(root == NULL) return AVL_ERROR; + if((*root) == NULL) return AVL_NO_DEL; + if((*root)->element == NULL) error(6); /* DEBUG */ + compare = (*cmp)(element,(*root)->element); + + if(compare == 0) + { + /* check: two children? */ + if((*root)->left != NULL && (*root)->right != NULL) + { AVLtree *pred; + void *tmp; + + /* find immediate predecessor */ + pred = (*root)->left; + while(pred->right != NULL) pred = pred->right; + + /* swap element to be deleted with its immediate predecessor */ + tmp = (*root)->element; + (*root)->element = pred->element; + pred->element = tmp; + + /* delete predecessor from left subtree */ + subtree = (*root)->left; + result = delete(element,&subtree,cmp,del,&shortersubtree); + (*root)->left = subtree; + + /* rebalance tree */ + if(shortersubtree) + switch((*root)->balance) + { case RIGHT: right_rebalance(root,shorter); + break; + case EQUAL: (*root)->balance = RIGHT; + *shorter = FALSE; + break; + case LEFT: (*root)->balance = EQUAL; + *shorter = TRUE; + } + + } + else + { /* user must delete his element */ + + (*del)((*root)->element); + /* delete node */ + subtree = ((*root)->left == NULL) ? (*root)->right : (*root)->left; + free(*root); + *root = subtree; + *shorter = TRUE; + result = AVL_OK; + } + } + else if(compare < 0) /* delete from left subtree */ + { subtree = (*root)->left; + result = delete(element, &subtree, cmp, del, &shortersubtree); + (*root)->left = subtree; + + /* rebalance tree */ + if(shortersubtree) + switch((*root)->balance) + { case RIGHT: right_rebalance(root,shorter); + break; + case EQUAL: (*root)->balance = RIGHT; + *shorter = FALSE; + break; + case LEFT: (*root)->balance = EQUAL; + *shorter = TRUE; + } + } + else /* delete from right subtree */ + { subtree = (*root)->right; + result = delete(element, &subtree, cmp, del, &shortersubtree); + (*root)->right = subtree; + + /* rebalance tree */ + if(shortersubtree) + switch((*root)->balance) + { case LEFT: left_rebalance(root,shorter); + break; + case EQUAL: (*root)->balance = LEFT; + *shorter = FALSE; + break; + case RIGHT: (*root)->balance = EQUAL; + *shorter = TRUE; + } + } + return result; +} /* end of delete() */ + +static void right_rebalance(AVLtree **root, int *shorter) +{ AVLtree *rightsub, *leftsubsub; + + if(root == NULL) error(7); + if(*root == NULL) error(8); + if((*root)->right == NULL) error(9); /* DEBUG */ + + rightsub = (*root)->right; + switch(rightsub->balance) + { case EQUAL: (*root)->balance = RIGHT; + rightsub->balance = LEFT; + left_rotate(root); + *shorter = FALSE; + break; + case RIGHT: (*root)->balance = EQUAL; + rightsub->balance = EQUAL; + left_rotate(root); + *shorter = TRUE; + break; + case LEFT: leftsubsub = rightsub->left; + switch(leftsubsub->balance) + { case EQUAL: (*root)->balance = EQUAL; + rightsub->balance = EQUAL; + break; + case LEFT: (*root)->balance = EQUAL; + rightsub->balance = RIGHT; + break; + case RIGHT: (*root)->balance = LEFT; + rightsub->balance = EQUAL; + } + leftsubsub->balance = EQUAL; + right_rotate(&rightsub); + (*root)->right = rightsub; + left_rotate(root); + *shorter = TRUE; + } +} /* end of right_rebalance() */ + +static void left_rebalance(AVLtree **root, int *shorter) +{ AVLtree *leftsub, *rightsubsub; + + if(root == NULL) error(10); + if(*root == NULL) error(11); + if((*root)->left == NULL) error(12); /* DEBUG */ + + leftsub = (*root)->left; + switch(leftsub->balance) + { case EQUAL: (*root)->balance = LEFT; + leftsub->balance = RIGHT; + right_rotate(root); + *shorter = FALSE; + break; + case LEFT: (*root)->balance = EQUAL; + leftsub->balance = EQUAL; + right_rotate(root); + *shorter = TRUE; + break; + case RIGHT: rightsubsub = leftsub->right; + switch(rightsubsub->balance) + { case EQUAL: (*root)->balance = EQUAL; + leftsub->balance = EQUAL; + break; + case RIGHT: (*root)->balance = EQUAL; + leftsub->balance = LEFT; + break; + case LEFT: (*root)->balance = RIGHT; + leftsub->balance = EQUAL; + } + rightsubsub->balance = EQUAL; + left_rotate(&leftsub); + (*root)->left = leftsub; + right_rotate(root); + *shorter = TRUE; + } +} /* end of left_rebalance() */ + +void *AVLfind(const void *element,AVLtree *root,int (*cmp)(void*, void*)) +{ int compare; + + if(root == NULL) return NULL; + compare = (*cmp)(element,root->element); + if(compare == 0) return root->element; + else if(compare < 0) + return AVLfind(element,root->left,cmp); + else + return AVLfind(element,root->right,cmp); +} + +static void left_balance(AVLtree **root) +{ AVLtree *leftsub, *rightsubsub; + + leftsub = (*root)->left; + switch(leftsub->balance) + { case LEFT: (*root)->balance = EQUAL; + leftsub->balance = EQUAL; + right_rotate(root); + break; + case RIGHT: rightsubsub = leftsub->right; + switch(rightsubsub->balance) + { case EQUAL: (*root)->balance = EQUAL; + leftsub->balance = EQUAL; + break; + case RIGHT: (*root)->balance = EQUAL; + leftsub->balance = LEFT; + break; + case LEFT: (*root)->balance = RIGHT; + leftsub->balance = EQUAL; + } + rightsubsub->balance = EQUAL; + left_rotate(&leftsub); + (*root)->left = leftsub; + right_rotate(root); + } +} /* end of left_balance() */ + +static void right_balance(AVLtree **root) +{ AVLtree *rightsub, *leftsubsub; + + rightsub = (*root)->right; + switch(rightsub->balance) + { case RIGHT: (*root)->balance = EQUAL; + rightsub->balance = EQUAL; + left_rotate(root); + break; + case LEFT: leftsubsub = rightsub->left; + switch(leftsubsub->balance) + { case EQUAL: (*root)->balance = EQUAL; + rightsub->balance = EQUAL; + break; + case LEFT: (*root)->balance = EQUAL; + rightsub->balance = RIGHT; + break; + case RIGHT: (*root)->balance = LEFT; + rightsub->balance = EQUAL; + } + leftsubsub->balance = EQUAL; + right_rotate(&rightsub); + (*root)->right = rightsub; + left_rotate(root); + } +} /* end of right_balance() */ + +static void left_rotate(AVLtree **root) +{ + if(*root == NULL) error(1); + else if((*root)->right == NULL) error(2); + else + { AVLtree *temp; + + temp = (*root)->right; + (*root)->right = temp->left; + temp->left = *root; + *root = temp; + } +} + +static void right_rotate(AVLtree **root) +{ + if(*root == NULL) error(3); + else if((*root)->left == NULL) error(5); + else + { AVLtree *temp; + + temp = (*root)->left; + (*root)->left = temp->right; + temp->right = *root; + *root = temp; + } +} + +void AVLinorder(AVLtree *root, void (*func)(void*)) +{ + if(root == NULL) return; + + AVLinorder(root->left, func); + (*func)(root->element); + AVLinorder(root->right, func); +} + +void AVLpreorder(AVLtree *root, void (*func)(void*)) +{ + if(root == NULL) return; + + AVLpreorder(root->left, func); + AVLpreorder(root->right, func); + (*func)(root->element); +} + +void AVLpostorder(AVLtree *root, void (*func)(void*)) +{ + if(root == NULL) return; + + (*func)(root->element); + AVLpostorder(root->left, func); + AVLpostorder(root->right, func); +} + + +static void error(int errno) +{ fprintf(stderr,"AVLtree package error # %d\n",errno); + exit(1); +} + + +#ifdef TEST + +#include <string.h> + +#define MAXN 1000 +#define BUFSIZE 512 + +int fgetline(char *buf, FILE *input); +int cmp(void*, void*); +void del(void *p1); +void show_element(void *element); +int AVLcheck(AVLtree *root); +void AVLshowtree(AVLtree *root, void (*func)(void*), int depth); + +void AVLshowtree(AVLtree *root, void (*func)(void*), int depth) +{ + if(root == NULL) return; + + printf(" [%d](%d) ",root->balance, depth); + (*func)(root->element); + AVLshowtree(root->left, func, depth+1); + AVLshowtree(root->right, func, depth+1); +} + +/* naive compare using strcmp() (ASCII order) */ + +int cmp(void *p1, void *p2) +{ return strcmp(p1, p2); +} + +/* routine to delete an element */ + +void del(void *p1) +{ free(p1); +} + +/* simple routine to show a node */ + +void show_element(void *element) +{ printf("%s\n",element); +} + +void main() +{ AVLtree *root = NULL; + char buf[BUFSIZE]; + int n = 0, length; + char *p; + + + fprintf(stdout,"testing routine for B-tree package\n"); + fprintf(stdout,"just read lines from input, put them in the\n"); + fprintf(stdout,"tree, then traverse the tree in order to\n"); + fprintf(stdout,"show the lines sorted (stop with '-') \n"); + + while(TRUE) + { length = fgetline(buf, stdin); + if(buf[0] == '-') break; + if(length != 0) + { if(n == MAXN) + { fprintf(stderr, "Too many strings\n"); + exit(1); + } + p = malloc(length+1); + if(p == NULL) + { fprintf(stderr, "Out of memory\n"); + exit(2); + } + strcpy(p, buf); + if(AVLinsert(p,&root,cmp) != AVL_OK) + { fprintf(stderr, "Insertion error\n"); + } + AVLcheck(root); + ++n; + } + if(feof(stdin)) break; + } + + /* check tree */ + AVLcheck(root); + /* now try to delete some elements */ + + while(TRUE) + { length = fgetline(buf, stdin); + if(length != 0) + { if(n == MAXN) + { fprintf(stderr, "Too many strings\n"); + exit(1); + } + p = malloc(length+1); + if(p == NULL) + { fprintf(stderr, "Out of memory\n"); + exit(2); + } + strcpy(p, buf); + if(AVLdelete(p,&root,cmp,del) != AVL_OK) + { fprintf(stderr, "Deletion error\n"); + } + AVLcheck(root); + ++n; + } + if(feof(stdin)) break; + } + + AVLshowtree(root,show_element, 1); + + exit(0); +} + +int fgetline(char *buf, FILE *input) +{ int i = 0, tmp; + + while((tmp = getc(input)) != EOF) + { buf[i] = (char)tmp; + if(buf[i] == '\n') + { buf[i] = '\0'; + return i; + } + else + { i++; + if(i >= BUFSIZE) + { fprintf(stderr, "line too long\n"); + exit(4); + } + } + } + buf[i] = '\0'; + return i; +} + +int AVLcheck(AVLtree *root) +{ int lh, rh; + + if(root == NULL) return 0; + + lh = AVLcheck(root->left); + rh = AVLcheck(root->right); + + if(lh == rh && root->balance != EQUAL) + printf("improper balance EQUAL\n"); + if(lh - rh == 1 && root->balance != LEFT) + printf("improper balance LEFT\n"); + if(lh - rh == -1 && root->balance != RIGHT) + printf("improper balance RIGHT\n"); + if(lh - rh > 1 || lh - rh < -1) printf("Not an AVL-tree\n"); + + return (lh < rh ? rh : lh) + 1; +} + +#endif /* TESTing part */ + +/* end of AVLtree.c */
\ No newline at end of file diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/avltree.h b/Master/texmf-dist/source/fonts/malayalam/preproc/avltree.h new file mode 100644 index 00000000000..fc4cee88bc9 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/avltree.h @@ -0,0 +1,44 @@ +/*+ + AVLtree.h header file for generic binairy-tree package + + (c) Jeroen Hellingman, 1 dec 1989. + +-*/ + +#ifndef AVLTREE_HEADER_READ +#define AVLTREE_HEADER_READ + +/* return values */ + +#define AVL_OK 0 +#define AVL_ERROR 1 +#define AVL_NO_MEM 2 +#define AVL_DUP 3 +#define AVL_NO_DEL 4 + +/* AVLtree structure */ + +typedef struct AVLtree AVLtree; + +struct AVLtree +{ void *element; + char balance; + AVLtree *left; + AVLtree *right; +}; + +/* ANSI C prototypes */ + +int AVLinsert(const void *element,AVLtree **root,int (*cmp)(void*, void*)); +int AVLdelete(const void *element,AVLtree **root,int (*cmp)(void*, void*),void (*del)(void*)); + +void *AVLfind(const void *element,AVLtree *root,int (*cmp)(void*, void*)); + +/* traversal routines */ + +void AVLpreorder(AVLtree *root, void (*func)(void*)); +void AVLinorder(AVLtree *root,void (*func)(void*)); +void AVLpostorder(AVLtree *root,void (*func)(void*)); + +#endif +/* end of AVLtree.h */ diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/makefile b/Master/texmf-dist/source/fonts/malayalam/preproc/makefile new file mode 100644 index 00000000000..762f65196f7 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/makefile @@ -0,0 +1,18 @@ +# compiler
+CC = c:/emx/bin/gcc
+# include directory
+INCLUDE =-Ic:/emx/include
+
+objects = mm.o readfile.o trs.o scr.o pstree.o avltree.o
+
+mm.exe: $(objects)
+ $(CC) -o mm.exe $(objects)
+
+# file dependencies:
+mm.o : mm.h trs.h scr.h readfile.h
+readfile.o : readfile.h
+trs.o : trs.h readfile.h mm.h
+scr.o : scr.h readfile.h mm.h
+pstree.o : pstree.h
+avltree.o : avltree.h
+# end
diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/ml.bat b/Master/texmf-dist/source/fonts/malayalam/preproc/ml.bat new file mode 100644 index 00000000000..03e0537efc4 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/ml.bat @@ -0,0 +1,4 @@ +echo process TeX file for Malayalam traditional script
+patc -v -p c:\malyalam\mmfont\preproc\mm.pat $1 mm.tmp
+mm -v -t c:\malyalam\mmfont\preproc\mm.trs -s c:\malyalam\mmfont\preproc\mm.scr mm.tmp $2
+del mm.tmp
diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/ml.g b/Master/texmf-dist/source/fonts/malayalam/preproc/ml.g new file mode 100644 index 00000000000..7e60fbea579 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/ml.g @@ -0,0 +1,4 @@ +echo process TeX file for Malayalam traditional script +patc -v -p d:\doc\malyalam\mmfont\preproc\mm.pat $1 mm.tmp +mm -v -t mm -s mm mm.tmp $2 +rm mm.tmp diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/mlr.bat b/Master/texmf-dist/source/fonts/malayalam/preproc/mlr.bat new file mode 100644 index 00000000000..19618c01188 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/mlr.bat @@ -0,0 +1,4 @@ +echo process TeX file for Malayalam reformed script
+patc -v -p c:\malyalam\mmfont\preproc\mm.pat $1 mm.tmp
+mm -v -t c:\malyalam\mmfont\preproc\mmr.trs -s c:\malyalam\mmfont\preproc\mmr.scr mm.tmp $2
+del mm.tmp
diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/mlr.g b/Master/texmf-dist/source/fonts/malayalam/preproc/mlr.g new file mode 100644 index 00000000000..65ca4b51902 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/mlr.g @@ -0,0 +1,4 @@ +echo process TeX file for Malayalam reformed script +patc -v -p d:\doc\malyalam\mmfont\preproc\mm.pat $1 mm.tmp +mm -v -t mmr.trs -s mmr.scr mm.tmp $2 +rm mm.tmp diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/mltr.g b/Master/texmf-dist/source/fonts/malayalam/preproc/mltr.g new file mode 100644 index 00000000000..84605cfea44 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/mltr.g @@ -0,0 +1,6 @@ +echo process TeX file for Malayalam reformed and traditional script +patc -v -p d:\doc\malyalam\mmfont\preproc\mm.pat $1 mm.tmp +mm -v -t mmr.trs -s mmr.scr mm.tmp mm2.tmp +rm mm.tmp +mm -v -t mm -s mm mm2.tmp $2 +rm mm2.tmp diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/mltrth.g b/Master/texmf-dist/source/fonts/malayalam/preproc/mltrth.g new file mode 100644 index 00000000000..e8eee14080a --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/mltrth.g @@ -0,0 +1,14 @@ +echo process TeX file for Malayalam/Tamil/Devanagari +patc -v -p d:\doc\malyalam\mmfont\preproc\mm.pat $1 mm1.tmp +mm -v -t mm -s mm mm1.tmp mm2.tmp +rm mm1.tmp +mm -v -t mmr.trs -s mmr.scr mm2.tmp mm3.tmp +rm mm2.tmp +patc -v -p d:\doc\malyalam\mmfont\tamil\tamil.pat mm3.tmp mm4.tmp +rm mm3.tmp +patc -v -p d:\doc\malyalam\mmfont\dng\dng.pat mm4.tmp mm5.tmp +rm mm4.tmp +echo devnag mm5.tmp $2 +devnag mm5.tmp $2 +rm mm5.tmp +echo well, that's done... diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/mm.c b/Master/texmf-dist/source/fonts/malayalam/preproc/mm.c new file mode 100644 index 00000000000..5e8fb4a06cf --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/mm.c @@ -0,0 +1,819 @@ +#define VERSION "mm v1.0 (c) Jeroen Hellingman 26-APR-1993\n" + +/* + mm -- convert malayalam text in transcription into input for TeX + +USAGE: + mm {-q|-v|-V|-h} [-t transfile][-s scriptfile] infile [outfile] + -q quiet mode (default) + -v verbose mode + -V very verbose mode + -h print help + -t read transcription from transfile (default mm.trs) + -s read script information from scriptfile (default mm.scr) + +HISTORY: + 26-APR-1993 changed directory structure of source files (JH) + 25-DEC-1992 Move to version 1.0 + removed coded that placed reepham when Ra occurs + initially (JH). + 24-DEC-1992 added support for environment variable. (JH) + added -h option to print help. (JH) + program will now add default file-suffixes if not given + on command line. (JH) + program will only `pun out' if very verbose option is given. (JH) + 08-OCT-1992 added support for at{end|begin}syllabe (JH) + 22-JUL-1992 removed bug causing endless loop outputting virama (JH) + 21-JUL-1992 added support for reepham (JH) + 28-JUN-1992 Genesis (Jeroen Hellingman) + +*/ + +/* + + functional organisation + + main: + command line arguments + read tables + + start in normal mode + switch mode when begin malayalam text is encountered + + convert mode: + read letters from file + build syllabes + convert syllabes + output result + +*/ + +/***********************************************************************/ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <ctype.h> +#include <assert.h> + +#include "mm.h" +#include "trs.h" +#include "scr.h" +#include "readfile.h" + +#define ATARI_ST /* machine type, can be ATARI_ST, MS_DOS, UNIX */ + +#define TRUE (1==1) +#define FALSE (1==0) + +#if defined(ATARI_ST) || defined(MS_DOS) +#define DIRSEPARATOR_CHAR '\\' +#define DIRSEPARATOR_STRING "\\" +#define MMDIR "D:\\doc\\malyalam\\mmfont\\preproc\\" /* place where .trs and .scr are (overruled by env. var. MMDIR) */ +#else /* UNIX */ +#define DIRSEPARATOR_CHAR '/' +#define DIRSEPARATOR_STRING "/" +#define MMDIR "/bin" /* place where .trs and .scr are (overruled by env. var. MMDIR) */ +#endif + +#define NUMPATS 10 /* number of pattern trees */ +#define PATLEN 50 /* maximum length of pattern */ +/* #define BUFSIZE 512 pushback buffer size (BUFSIZE >= PATLEN) */ +#define SYLLABESIZE 20 /* maximum size of syllabe */ + +/* data types */ + +/***********************************************************************/ + +/* prototypes */ + +void defaultloop(void); +void malayalamloop(void); + +void put_malayalam_letter(char); +void put_malayalam_syllabe(void); +void put_syllabe(char *s); +prebuild_char *find_cluster(char *s); +glyph_pair *find_ra(char **t); +glyph_pair *find_sec_cons(char *s, int r); +glyph_pair *find_vowel(char *s); +void use_virama(char *s, glyph_pair **primary_ra); + +void processflags(int argc, char** argv); +static char *name_suffix(char* name, char *suffix); +static char *force_suffix(char* name, char *suffix); +void usage(void); +void help(void); +void copytexcommand(void); +void skiptexcommand(void); +void copycomment(void); +void skipcomment(void); +int readchar(void); +void unreadchar(int); +int what_escape(const char *s, char *result); +void inittables(void); + +/***********************************************************************/ + +/* globals */ + +FILE *infile; +FILE *outfile; +char *progname = "mm"; +char *insuffix = "mm"; +char *outsuffix = "tex"; +char *trssuffix = "trs"; +char *scrsuffix = "scr"; +char *trsfilename = "mmr.trs"; /* file containing transcription information */ +char *scrfilename = "mmr.scr"; /* file containing script information */ +char *infilename = NULL; +char *outfilename = NULL; +char *home = MMDIR; /* home directory (defined above) */ +char *mmdir = "MMDIR"; /* name of env. var. for home directory */ +int quiet = FALSE; /* don't be quiet */ +int very_verbose = FALSE; +int verbose = FALSE; /* don't be verbose */ +static int debug = FALSE; /* don't debug */ +static int linenumber = 1; /* current line in infile */ + +PSTree *normal=NULL; /* default patterns */ +trs_table *trs=NULL; /* patterns for transcription */ +scr_table *scr = NULL; /* script definition */ + +/* some extra globals */ + +typedef enum { ACCEPT, FLUSH } state; + +char syllabe[SYLLABESIZE]; +int syl_len = 0; +state syllabe_state = ACCEPT; + +typedef enum +{ UNDEF, VOWEL, CONS, VSIGN, DIGIT, OTHER, VIRAM, + BLANK, JOIN, NJOIN +} char_type_enum; + +char_type_enum char_type[128] = +{ UNDEF, UNDEF, OTHER, OTHER, UNDEF, VOWEL, VOWEL, VOWEL, + VOWEL, VOWEL, VOWEL, VOWEL, VOWEL, UNDEF, VOWEL, VOWEL, + VOWEL, UNDEF, VOWEL, VOWEL, VOWEL, CONS, CONS, CONS, + CONS, CONS, CONS, CONS, CONS, CONS, CONS, CONS, + CONS, CONS, CONS, CONS, CONS, CONS, CONS, CONS, + CONS, UNDEF, CONS, CONS, CONS, CONS, CONS, CONS, + CONS, CONS, CONS, CONS, CONS, CONS, CONS, CONS, + CONS, CONS, UNDEF, UNDEF, UNDEF, UNDEF, VSIGN, VSIGN, + VSIGN, VSIGN, VSIGN, VSIGN, VSIGN, UNDEF, VSIGN, VSIGN, + VSIGN, UNDEF, VSIGN, VSIGN, VSIGN, VIRAM, UNDEF, UNDEF, + UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, OTHER, + UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, + VOWEL, VOWEL, UNDEF, UNDEF, UNDEF, UNDEF, DIGIT, DIGIT, + DIGIT, DIGIT, DIGIT, DIGIT, DIGIT, DIGIT, DIGIT, DIGIT, + UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, + UNDEF, UNDEF, UNDEF, UNDEF, BLANK, OTHER, NJOIN, JOIN, +}; + +/***********************************************************************/ + +void PUSHBACK(char *c) +/* push the characters in string c back into the inputstream, works + * with the pair of functions readchar() and unreadchar() + */ +{ int i = (int)strlen(c)-1; + for( ;i >= 0; i--) unreadchar((int)c[i]); +} + +/***********************************************************************/ + +void main(int argc, char** argv) +/* check arguments, intialize tables, open files + */ +{ char *tmp; + tmp = getenv(mmdir); + if(tmp != NULL) home = tmp; + + processflags(argc, argv); + if(verbose) fputs(VERSION, stderr); + + inittables(); + + if(verbose) printf("reading from %s\n", infilename); + infile = fopen(infilename, "r"); + if(infile==NULL) + { fprintf(stderr, "%s: can't open %s\n", progname, infilename); + exit(2); + } + if(verbose) printf("writing to %s\n", outfilename); + outfile = fopen(outfilename, "w"); + if(outfile==NULL) + { fprintf(stderr, "%s: can't create %s\n", progname, outfilename); + exit(2); + } + + defaultloop(); + fclose(infile); + fclose(outfile); + if(verbose) printf("done\n"); + exit(0); +} + +void processflags(int argc, char** argv) +{ int nextoption = FALSE; + int i = 1; + + if(argc < i+1) usage(); + if(argv[i][0] == '-') nextoption = TRUE; + + while(nextoption) + { switch(argv[i][1]) + { case 'V': very_verbose = TRUE; + case 'v': verbose = TRUE; break; + case 'q': quiet = TRUE; break; + case 'h': help(); + case 'D': debug = TRUE; break; + case 't': trsfilename = name_suffix(argv[i+1], trssuffix); i++; break; + case 's': scrfilename = name_suffix(argv[i+1], scrsuffix); i++; break; + default: usage(); + } + i++; + if(argc < i+1) usage(); + if(argv[i][0] != '-') nextoption = FALSE; + } + infilename = name_suffix(argv[i], insuffix); + if(argc < i+2) + { outfilename = force_suffix(argv[i], outsuffix); + } + else + outfilename = name_suffix(argv[i+1], outsuffix); +} + +/* add suffix to name if none given */ + +static char *name_suffix(char* name, char *suffix) +{ long i, len = strlen(name); + char *result; + + /* seek for dot, if found return name */ + for(i=0; i<len; i++) if(name[i] == '.') return name; + /* otherwise add suffix */ + + result = malloc(len+5); + assert(result != NULL); + strcpy(result, name); + result[len] = '.'; + result[++len] = suffix[0]; + result[++len] = suffix[1]; + result[++len] = suffix[2]; + result[++len] = '\0'; + return result; +} + +/* add suffix, remove orginal suffix if given */ + +static char *force_suffix(char* name, char *suffix) +{ long i, len = strlen(name); + char *result; + + /* seek for dot, if found break */ + for(i=0; i<len; i++) if(name[i] == '.') break; + + result = malloc(len+5); + assert(result != NULL); + strcpy(result, name); + result[i] = '.'; + result[++i] = suffix[0]; + result[++i] = suffix[1]; + result[++i] = suffix[2]; + result[++i] = '\0'; + return result; +} + +/* place the home directory name in front of the file name */ + +char *prepend_home(char *filename) +{ long len1, len2; + char *result; + if(home == NULL) return filename; + len1 = strlen(home); + len2 = strlen(filename); + result = malloc(len1+len2+2); + assert(result != NULL); + strcpy(result, home); + if(home[len1-1] != DIRSEPARATOR_CHAR) /* add backslash if not already there */ + strcat(result, DIRSEPARATOR_STRING); + strcat(result, filename); + return result; +} + +void usage() +{ fprintf(stderr, "usage: %s {-q|-v|-V|-h} [-t transfile][-s scriptfile] infile [outfile]\n", progname); + fprintf(stderr, "(%s -h will print a help message)\n", progname); + exit(1); +} + +void help() +{ char *s; + puts(VERSION); + printf("usage: %s {-q|-v|-V|-h} [-t transfile][-s scriptfile] infile [outfile]\n", progname); + printf("\noptions:\n"); + printf(" -q quiet mode (default)\n"); + printf(" -v verbose mode\n"); + printf(" -V very verbose mode\n"); + printf(" -h print help\n"); + printf(" -t read transcription from transfile (default mmr.trs)\n"); + printf(" -s read script information from scriptfile (default mmr.scr)\n"); + printf("\ndefault file extensions:\n"); + printf(" transfile: .trs\n"); + printf(" scriptfile: .scr\n"); + printf(" infile: .mm\n"); + printf(" outfile: .tex\n"); + printf("\nthe environment variable %s tells %s where to look for transfile\nand scriptfile.\n", mmdir, progname); + printf(" %s is currently ", mmdir); + if((s=getenv(mmdir)) == NULL) + printf("not set\n\n"); + else + printf("set to %s\n\n", s); + exit(0); +} + +/***********************************************************************/ + +void inittables() +{ long len; + char *act; + string_list *next; + + trs = read_trs(trsfilename); + scr = read_scr(scrfilename); + + /* insert trs->atend with action scr->atend in trs->p patterntree */ + len = strlen(scr->atend) + 1; act = malloc(len); + if(act==NULL){fprintf(stderr, "can't allocate\n");exit(0);} + act[0] = 'M'; /* action: switch to Malayalam script */ + act[1] = '\0'; + act = strcat(act, scr->atend); + + next = trs->atend; + while(next != NULL && (next->s)!=NULL && next->s[0] != '\0') + { PSTinsert(&(trs->p), next->s, act); + next = next->n; + } + + /* insert trs->atbegin in default patterntree */ + len = strlen(scr->atbegin) + 1; act = malloc(len); + if(act==NULL){fprintf(stderr, "can't allocate\n");exit(0);} + act[0] = 'M'; /* action: switch to default script */ + act[1] = '\0'; + act = strcat(act, scr->atbegin); + + next = trs->atbegin; + while(next != NULL && (next->s)!=NULL && next->s[0] != '\0') + { PSTinsert(&normal, next->s, act); + next = next->n; + } + /* also skip comment in default mode (HACK) */ + PSTinsert(&normal, "%", "s"); + PSTinsert(&normal, "\\%", "\\%"); + PSTinsert(&normal, "$$", "p$$"); + /* code will change to add normal patterns from scr file */ +} + +/***********************************************************************/ + +void defaultloop() /* almost same as normal patc */ +{ char ps[PATLEN+1]; /* pattern to be search for */ + char *action; /* action with pattern */ + int len = PATLEN; /* length of found pattern; part of ps to be read */ + int i, j; /* counters */ + + while(TRUE) + { + /* fill pattern */ + for(i = 0, j = len; j < PATLEN; i++, j++) ps[i] = ps[j]; + for(i = PATLEN - len; i < PATLEN; i++) + { int c = readchar(); + ps[i] = (c == EOF) ? '\0' : (char)c; + } + ps[PATLEN] = '\0'; /* NULL-terminate */ + if(ps[0] == '\0') break; + + /* find action */ + + action = PSTmatch(normal, ps, &len); + + if(len == 0) /* no match, copy first letter silently */ + { fputc(ps[0], outfile); + len = 1; + } + else /* do action */ + { switch(action[0]) + { case 'p': fputs(&action[1], outfile); break; + case 'c': PUSHBACK(ps); len = PATLEN; copycomment(); break; + case 't': PUSHBACK(ps); len = PATLEN; copytexcommand(); break; + case 'T': PUSHBACK(ps); len = PATLEN; skiptexcommand(); break; + case 's': PUSHBACK(ps); len = PATLEN; skipcomment(); break; + case 'f': /* forget */ break; + case 'e': fprintf(stderr, "Error: %s near line %d\n", &action[1], linenumber); + break; + case 'M': fputs(&action[1], outfile); /* output @atbegin text */ + PUSHBACK(&ps[len]); len = PATLEN; /* pushback rest */ + malayalamloop(); + break; + default: fprintf(stderr, "Internal error: unknown action\n"); + exit(10); + } /* switch */ + } /* else */ + } /* while */ +} /* defaultloop() */ + +/***********************************************************************/ + +void malayalamloop() /* build syllabes loop */ +{ char ps[PATLEN+1]; /* pattern to be search for */ + char *action; /* action with pattern */ + int len = PATLEN; /* length of found pattern; part of ps to be read */ + int i, j; /* counters */ + + while(TRUE) + { + /* fill pattern */ + for(i = 0, j = len; j < PATLEN; i++, j++) ps[i] = ps[j]; + for(i = PATLEN - len; i < PATLEN; i++) + { int c = readchar(); + ps[i] = (c == EOF) ? '\0' : (char)c; + } + ps[PATLEN] = '\0'; /* NULL-terminate */ + if(ps[0] == '\0') break; + + /* find action */ + + action = PSTmatch(trs->p, ps, &len); + + if(len == 0) /* no match, complain */ + { fprintf(stderr, "Error: illegal character '%c' near line %d\n", ps[0], linenumber); + len = 1; + } + else /* do action */ + { switch(action[0]) + { case 'p': put_malayalam_syllabe(); + fputs(&action[1], outfile); break; + case 'c': put_malayalam_syllabe(); + PUSHBACK(ps); len = PATLEN; copycomment(); break; + case 't': put_malayalam_syllabe(); + PUSHBACK(ps); len = PATLEN; copytexcommand(); break; + case 'T': put_malayalam_syllabe(); + PUSHBACK(ps); len = PATLEN; skiptexcommand(); break; + case 's': put_malayalam_syllabe(); + PUSHBACK(ps); len = PATLEN; skipcomment(); break; + case 'f': /* forget */ break; + case 'e': put_malayalam_syllabe(); + fprintf(stderr, "Error: %s near line %d\n", &action[1], linenumber); + break; + case 'M': put_malayalam_syllabe(); /* output last syllabe */ + fputs(&action[1], outfile); /* output @atend text */ + PUSHBACK(&ps[len]); len = PATLEN; /* pushback rest */ + return; /* go back to main loop */ + case '=': /* we have a letter, now we have to decide what to do with it + we have reached the end of a syllabe or not */ + put_malayalam_letter(action[1]); /* add letter to current syllabe */ + break; + default: fprintf(stderr, "Internal error: unknown action\n"); + exit(10); + } /* switch */ + } /* else */ + } /* while */ +} + +/***********************************************************************/ + +void put_malayalam_letter(char c) /* accept a letter, and output a syllabe if neccessary */ +{ + if(debug)fprintf(stdout, "put malayalam letter %X\n", (int)c); + + if(char_type[c] == UNDEF) + { fprintf(stderr, "%s: undefined Malayalam char %X near line %i\n", progname, (int)c, linenumber); + return; + } + + switch(syllabe_state) + { case ACCEPT: + switch(char_type[c]) + { case CONS: + case JOIN: + syllabe[syl_len++] = c; + break; + case BLANK: + put_malayalam_syllabe(); + /* fall through */ + default: + syllabe[syl_len++] = c; + syllabe_state = FLUSH; + } + break; + case FLUSH: + switch(char_type[c]) + { case JOIN: + syllabe[syl_len++] = c; + syllabe_state = ACCEPT; + break; + case CONS: + put_malayalam_syllabe(); + syllabe[syl_len++] = c; + syllabe_state = ACCEPT; + break; + default: + put_malayalam_syllabe(); + syllabe[syl_len++] = c; + break; + } + } + syllabe[syl_len] = '\0'; + if(syl_len >= SYLLABESIZE-2) + put_malayalam_syllabe(); +} + +static int cmp_glyph_pair(void *a, void *b) +{ return strcmp(((glyph_pair*)a)->c, ((glyph_pair*)b)->c); +} + +static int cmp_prebuild_char(void *a, void *b) +{ return strcmp(((prebuild_char*)a)->c, ((prebuild_char*)b)->c); +} + +void put_malayalam_syllabe() /* output a syllabe */ +{ int is_syllabe = FALSE; + + if(debug)fprintf(stdout, "syllabe\n"); + if(syl_len == 0) return; + + /* add VIRAMA if last sign is consonant */ + if(char_type[syllabe[syl_len-1]] == CONS) + { syllabe[syl_len++] = VIRAMA; + syllabe[syl_len] = '\0'; + } + + if(char_type[syllabe[0]] == CONS || + char_type[syllabe[0]] == VOWEL) is_syllabe = TRUE; + + if(is_syllabe) fputs(scr->atbeginsyllabe, outfile); + + put_syllabe(syllabe); + + if(is_syllabe) fputs(scr->atendsyllabe, outfile); + + syllabe[0]='\0'; syl_len=0; + return; +} + +prebuild_char *is_prebuild(char *s) +{ prebuild_char tmp; tmp.c = s; + return AVLfind(&tmp, scr->prebuild, cmp_prebuild_char); +} + +glyph_pair *is_primary(char *s) +{ glyph_pair tmp; tmp.c = s; + return AVLfind(&tmp, scr->primary, cmp_glyph_pair); +} + +glyph_pair *is_secondary(char *s) +{ glyph_pair tmp; tmp.c = s; + return AVLfind(&tmp, scr->secondary, cmp_glyph_pair); +} + +void pun_out(char c) +{ static column = 0; + column++; + if(column == 78) { putchar('\n'); column = 1; } + putchar(c); +} + +void put_syllabe(char *s) +{ + glyph_pair *primary_ra = NULL; + glyph_pair *vowel = NULL; /* also used for virama */ + glyph_pair *sec_cons = NULL; + prebuild_char *cluster = NULL; + + if(very_verbose) pun_out('.'); /* signal it */ + + if((cluster = is_prebuild(s)) == NULL) + { primary_ra = find_ra(&s); + if((cluster = is_prebuild(s)) == NULL) + { if((sec_cons = find_sec_cons(s, 1)) == NULL) + { vowel = find_vowel(s); + if((cluster = is_prebuild(s)) != NULL) + s[0] = '\0'; + else + sec_cons = find_sec_cons(s, 0); + } + if(cluster == NULL) + cluster = find_cluster(s); + if(strlen(s) > 0) use_virama(s, &primary_ra); + } + } + /* output the syllabe */ + + if(!scr->reepham && primary_ra != NULL) fputs(primary_ra->b, outfile); + if(vowel != NULL) fputs(vowel->b, outfile); + if(sec_cons != NULL) fputs(sec_cons->b, outfile); + if(scr->reepham && primary_ra != NULL) fputs(primary_ra->b, outfile); + if(cluster != NULL) fputs(cluster->g, outfile); + if(scr->reepham && primary_ra != NULL) fputs(primary_ra->a, outfile); + if(sec_cons != NULL) fputs(sec_cons->a, outfile); + if(vowel != NULL) fputs(vowel->a, outfile); + if(!scr->reepham && primary_ra != NULL) fputs(primary_ra->a, outfile); +} + + +glyph_pair *find_ra(char **t) +{ char *s = *t; + char ra_string[] = { LETTER_RA, '\0' }; + glyph_pair *result = NULL; + + /* do we have primary ra? */ + if(s[0] == LETTER_RA && char_type[s[1]] == CONS) + { if((result = is_primary(ra_string)) == NULL) + fprintf(stderr, "need glyph(s) for primary ra\n"); + s = &s[1]; + } + *t = s; + return result; +} + +glyph_pair *find_sec_cons(char *s, int r) +{ glyph_pair *result = NULL; + long i; + long len=strlen(s)-r; + + for(i=1;i<len;i++) + { if((result = is_secondary(&s[i])) != NULL) + { s[i] = '\0'; + break; + } + } + return result; +} + +glyph_pair *find_vowel(char *s) +{ long i = strlen(s)-1; + glyph_pair *result; + + if((result = is_secondary(&s[i])) == NULL) + fprintf(stderr, "need glyph(s) for secondary vowel/virama %X\n",(int)s[i]); + s[i] = '\0'; + return result; +} + +prebuild_char *find_cluster(char *s) +{ long i, len = strlen(s); + prebuild_char *result; + for(i = 0;i<len;i++) + { if((result = is_prebuild(&s[i])) != NULL) + { s[i] = '\0'; /* that is done now */ + break; + } + } + if(result == NULL) + { fprintf(stderr, "need glyph(s) for single character %X\n",(int)s[len-1]); + s[len-1] = '\0'; + } + return result; +} + +void use_virama(char *s, glyph_pair **primary_ra) +{ + long i; + long len = strlen(s); + prebuild_char *cluster = NULL; + glyph_pair *virama = NULL; + char virama_string[] = { VIRAMA, '\0' }; + + if(very_verbose) pun_out('+'); + + for(i=0;i<len;i++) + { s[len] = VIRAMA; s[len+1] = '\0'; + if((cluster = is_prebuild(&s[i])) != NULL) + { s[i] = '\0'; + break; + } + else + { s[len] = '\0'; + if((cluster = is_prebuild(&s[i])) != NULL) + { s[i] = '\0'; + if((virama = is_secondary(virama_string)) == NULL) + fprintf(stderr, "need glyph(s) for secondary virama\n"); + break; + } + } + } + if(strlen(s) > 0) use_virama(s, primary_ra); + + /* output what we have now */ + if(*primary_ra != NULL) fputs((*primary_ra)->b, outfile); + if(virama != NULL) fputs(virama->b, outfile); + if(cluster != NULL) fputs(cluster->g, outfile); + if(virama != NULL) fputs(virama->a, outfile); + if(*primary_ra != NULL) + { fputs((*primary_ra)->a, outfile); + *primary_ra = NULL; + } +} + +/***********************************************************************/ + +void copytexcommand() +/* copy TeX commmand, including preceding \ + * this will work in plain TeX and LaTeX + */ +{ int c = readchar(); + if(c=='\\') + { fputc(c, outfile); + c = readchar(); + if(isalpha(c)) + { while(isalpha(c)) + { fputc(c, outfile); + c = readchar(); + } + unreadchar(c); + } + else + fputc(c, outfile); + } + else + unreadchar(c); +} + +void skiptexcommand() +/* skip TeX commmand, including preceding \ + * this will work in plain TeX and LaTeX + */ +{ int c = readchar(); + if(c=='\\') + { c = readchar(); + if(isalpha(c)) + { while(isalpha(c)) + { c = readchar(); + } + unreadchar(c); + } + } + else + unreadchar(c); +} + + +void copycomment() +{ int c = readchar(); + if(c=='%') + { while(c != '\n' && c != EOF) + { fputc(c, outfile); + c = readchar(); + } + fputc('\n', outfile); + } + else + unreadchar(c); +} + +void skipcomment() +{ int c = readchar(); + if(c=='%') + { while(c != '\n' && c != EOF) + c = readchar(); + } + else + unreadchar(c); +} + +/***********************************************************************/ +/* file access with buffer */ + +static int fbuffer[BUFSIZE]; /* buffer for file operations */ +static int last = 0; /* last + 1 used in fbuffer */ + +int readchar() +{ int result; + + if(last==0) /* nothing in buffer */ + result = fgetc(infile); + else /* get first from buffer */ + { last--; + result = fbuffer[last]; + } + if(result == '\n') linenumber++; + return result; +} + +void unreadchar(int c) +{ + if(last == BUFSIZE) + { fprintf(stderr, "%s: push-back file buffer full\n", progname); + exit(1); + } + else /* voeg na last in buffer */ + { fbuffer[last] = c; + last++; + if(c == '\n') linenumber--; + } +} + +/***********************************************************************/ diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/mm.exe b/Master/texmf-dist/source/fonts/malayalam/preproc/mm.exe Binary files differnew file mode 100644 index 00000000000..9077c13826b --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/mm.exe diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/mm.h b/Master/texmf-dist/source/fonts/malayalam/preproc/mm.h new file mode 100644 index 00000000000..3db74a846a0 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/mm.h @@ -0,0 +1,110 @@ + +#define TRUE (1==1) +#define FALSE (1==0) + +char *prepend_home(char *filename); + +/* table of malayalam letters */ + +#define SIGN_ANUSVARA 2 +#define SIGN_VISARGA 3 + +#define LETTER_A 5 +#define LETTER_AA 6 +#define LETTER_I 7 +#define LETTER_II 8 +#define LETTER_U 9 +#define LETTER_UU 10 +#define LETTER_VOCALIC_R 11 +#define LETTER_VOCALIC_L 12 + +#define LETTER_E 14 +#define LETTER_EE 15 +#define LETTER_AI 16 + +#define LETTER_O 18 +#define LETTER_OO 19 +#define LETTER_AU 20 + +#define LETTER_KA 21 +#define LETTER_KHA 22 +#define LETTER_GA 23 +#define LETTER_GHA 24 +#define LETTER_NGA 25 +#define LETTER_CA 26 +#define LETTER_CHA 27 +#define LETTER_JA 28 +#define LETTER_JHA 29 +#define LETTER_NYA 30 +#define LETTER_TTA 31 +#define LETTER_TTHA 32 +#define LETTER_DDA 33 +#define LETTER_DDHA 34 +#define LETTER_NNA 35 +#define LETTER_TA 36 +#define LETTER_THA 37 +#define LETTER_DA 38 +#define LETTER_DHA 39 +#define LETTER_NA 40 + +#define LETTER_PA 42 +#define LETTER_PHA 43 +#define LETTER_BA 44 +#define LETTER_BHA 45 +#define LETTER_MA 46 +#define LETTER_YA 47 +#define LETTER_RA 48 +#define LETTER_RRA 49 +#define LETTER_LA 50 +#define LETTER_LLA 51 +#define LETTER_LLLA 52 +#define LETTER_VA 53 +#define LETTER_SHA 54 +#define LETTER_SSA 55 +#define LETTER_SA 56 +#define LETTER_HA 57 + +#define VOWEL_SIGN_AA 62 +#define VOWEL_SIGN_I 63 +#define VOWEL_SIGN_II 64 +#define VOWEL_SIGN_U 65 +#define VOWEL_SIGN_UU 66 +#define VOWEL_SIGN_VOCALIC_R 67 +#define VOWEL_SIGN_VOCALIC_RR 68 + +#define VOWEL_SIGN_E 70 +#define VOWEL_SIGN_EE 71 +#define VOWEL_SIGN_AI 72 + +#define VOWEL_SIGN_O 74 +#define VOWEL_SIGN_OO 75 +#define VOWEL_SIGN_AU 76 + +#define VIRAMA 77 + +#define AU_LENGTH_MARK 87 + +#define LETTER_VOCALIC_RR 96 +#define LETTER_VOCALIC_LL 97 + +#define DIGIT_ZERO 102 +#define DIGIT_ONE 103 +#define DIGIT_TWO 104 +#define DIGIT_THREE 105 +#define DIGIT_FOUR 106 +#define DIGIT_FIVE 107 +#define DIGIT_SIX 108 +#define DIGIT_SEVEN 109 +#define DIGIT_EIGHT 110 +#define DIGIT_NINE 111 + +/* extra's not on this place in unicode */ + +#define JOINER 127 +#define NON_JOIN 126 +#define DOTTED_CIRCLE 125 +#define SPACE 124 + +/* eof */ + + diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/mm.pat b/Master/texmf-dist/source/fonts/malayalam/preproc/mm.pat new file mode 100644 index 00000000000..4d36412e553 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/mm.pat @@ -0,0 +1,387 @@ +% mm.pat --- Malayalam transcription definition for TeX pre-processor +% (c) 1993 Jeroen Hellingman +% last edit: 14-JAN-1993 + +@patterns 0 % default patterns +"$$" 1 "{\\mmtr " % begin Malayalam in transcription +"%" c % skip comments +"\\" t % copy TeX-commands +"\t" p " " % tab -> space + +@rpatterns 1 patterns ASCII transcription -> scientific transcription in TeX. + +"$$" 0 "}" % switch back to default mode +"$" e "$ in $$-mode" +">" f % eliminate ambiguities +"\\" t % copy TeX command +"%" s % skip comment +"^" e "^ in front of non letter" +"^^" 2 "" % switch to capital mode + +"{" p "{" +"}" p "}" +"\n" p "\n" +" " p " " +"\t" p " " + +"a" p "a" % a +"aa" p "\\=a" % aa +"A" p "\\=a" +"i" p "i" % i +"ii" p "{\\=\\i}" % ii +"I" p "{\\=\\i}" +"u" p "u" % u +"uu" p "\\=u" % uu +"U" p "\\=u" +".r" p "\\d r" % vocalic r +".r.r" p "{\\rii}" % vocalic rr +".R" p "{\\rii}" +".l" p "\\d l" % vocalic l +".l.l" p "{\\lii}" % vocalic ll +".L" p "{\\lii}" +"e" p "e" +"ee" p "\\=e" +"E" p "\\=e" +"ai" p "ai" +"o" p "o" +"oo" p "\\=o" +"O" p "\\=o" +"au" p "au" +"au\"" p "au" % au length mark + +% modifiers + +"M" p "\\d m" % anusvara +"H" p "\\d h" % visarga + +% consonants + +"k" p "k" +"kh" p "kh" +"g" p "g" +"gh" p "gh" +"n\"" p "\\.n" % nga + +"c" p "c" +"ch" p "ch" +"j" p "j" +"jh" p "jh" +"n~" p "\\~n" % nya + +"T" p "\\d t" +"Th" p "\\d th" +"D" p "\\d d" +"Dh" p "\\d dh" +"N" p "\\d n" + +"t" p "t" +"t_" p "\\b t" % dental ta +"th" p "th" +"d" p "d" +"dh" p "dh" +"n" p "n" +"n_" p "\\b n" % dental na + +"p" p "p" +"ph" p "ph" +"f" p "f" +"b" p "b" +"bh" p "bh" +"m" p "m" + +"y" p "y" +"r" p "r" +"R" p "\\b r" +"RR" p "\\b t" % double Ra is dental t +"t_t_" p "\\b t" % double Ra is dental t +"l" p "l" +"L" p "\\d l" +"zh" p "\\b z" +"v" p "v" +"sh" p "\\'s" +"S" p "\\d s" +"s" p "s" +"h" p "h" + +"+" f % virama +"u+" p "\\u u" % half u + +% digits + +% special + +"<>" f % join +"@" f % non join +"[]" p "\\dotcircle" % dotted circle + +% interpunction + +"." p "." +"`" p "`" +"'" p "'" +"," p "," +":" p ":" +";" p ";" +"-" p "-" +"--" p "--" +"---" p "---" +"(" p "(" +")" p ")" +"?" p "?" +"!" p "!" +"\\%" p "\\%" + +% repeat partial table for correct transcription of anusvar + +"Mk" p "\\.nk" +"Mkh" p "\\.nkh" +"Mg" p "\\.ng" +"Mgh" p "\\.ngh" + +"Mc" p "\\~nc" +"Mch" p "\\~nch" +"Mj" p "\\~nj" +"Mjh" p "\\~njh" + +"MT" p "\\d n\\d t" +"MTh" p "\\d n\\d th" +"MD" p "\\d n\\d d" +"MDh" p "\\d n\\d dh" + +"Mt" p "nt" +"Mth" p "nth" +"Md" p "nd" +"Mdh" p "ndh" + +"Mp" p "mp" +"Mph" p "mph" +"Mb" p "mb" +"Mbh" p "mbh" +"Mf" p "mf" + +% repeat table for capital letters + +"^a" p "A" % a +"^aa" p "\\=A" % aa +"^A" p "\\=A" +"^i" p "I" % i +"^ii" p "\\=I" % ii +"^I" p "\\=I" +"^u" p "U" +"^uu" p "\\=U" +"^U" p "\\=U" +"^.r" p "\\d R" % vocalic r +"^.r.r" p "{\\Rii}" % vocalic rr +"^.R" p "{\\Rii}" +"^.l" p "\\d L" % vocalic l +"^.l.l" p "{\\Lii}" % vocalic ll +"^.L" p "{\\Lii}" +"^e" p "E" +"^ee" p "\\=E" +"^E" p "\\=E" +"^ai" p "Ai" +"^o" p "O" +"^oo" p "\\=O" +"^O" p "\\=O" +"^au" p "Au" +"^au\"" p "Au" % au length mark + +% consonants + +"^k" p "K" +"^kh" p "Kh" +"^g" p "G" +"^gh" p "Gh" +"^n\"" p "\\.N" % nga + +"^c" p "C" +"^ch" p "Ch" +"^j" p "J" +"^jh" p "Jh" +"^n~" p "\\~N" % nya + +"^T" p "\\d T" +"^Th" p "\\d Th" +"^D" p "\\d D" +"^Dh" p "\\d Dh" +"^N" p "\\d N" + +"^t" p "T" +"^t_" p "\\b T" % dental ta +"^th" p "Th" +"^d" p "D" +"^dh" p "Dh" +"^n" p "N" +"^n_" p "\\b N" + +"^p" p "P" +"^ph" p "Ph" +"^f" p "F" +"^b" p "B" +"^bh" p "Bh" +"^m" p "M" + +"^y" p "Y" +"^r" p "R" +"^R" p "\\b R" +"^RR" p "\\b T" % double Ra is dental t +"^t_t_" p "\\b T" % double Ra is dental t +"^l" p "L" +"^L" p "\\d L" +"^zh" p "\\b Z" +"^v" p "V" +"^sh" p "\\'S" +"^S" p "\\d S" +"^s" p "S" +"^h" p "H" + +@rpatterns 2 patterns ASCII transcription -> scientific transcription in TeX in Caps. + +"$$" 0 "}" % switch back to default mode +"$" e "$ in $$-mode" +">" f % eliminate ambiguities +"\\" t % copy TeX command +"%" s % skip comment +"^" s % no capitals in caps-mode +"^^" 1 "" % switch to normal mode + +"{" p "{" +"}" p "}" +"\n" p "\n" +" " p " " +"\t" p " " + +"a" p "A" % a +"aa" p "\\=A" % aa +"A" p "\\=A" +"i" p "I" % i +"ii" p "\\=I" % ii +"I" p "\\=I" +"u" p "U" +"uu" p "\\=U" +"U" p "\\=U" +".r" p "\\d R" % vocalic r +".r.r" p "{\\RII}" % vocalic rr +".R" p "{\\RII}" +".l" p "\\d L" % vocalic l +".l.l" p "{\\LII}" % vocalic ll +".L" p "{\\LII}" +"e" p "E" +"ee" p "\\=E" +"E" p "\\=E" +"ai" p "AI" +"o" p "O" +"oo" p "\\=O" +"O" p "\\=O" +"au" p "AU" +"au\"" p "AU" % au length mark + +% modifiers + +"M" p "\\d M" % anusvara +"H" p "\\d H" % visarga + +% consonants + +"k" p "K" +"kh" p "KH" +"g" p "G" +"gh" p "GH" +"n\"" p "\\.N" % nga + +"c" p "C" +"ch" p "CH" +"j" p "J" +"jh" p "JH" +"n~" p "\\~N" % nya + +"T" p "\\d T" +"Th" p "\\d TH" +"D" p "\\d D" +"Dh" p "\\d DH" +"N" p "\\d N" + +"t" p "T" +"t_" p "\\b T" % dental ta +"th" p "TH" +"d" p "D" +"dh" p "DH" +"n" p "N" +"n_" p "\\b N" + +"p" p "P" +"ph" p "PH" +"f" p "F" +"b" p "B" +"bh" p "BH" +"m" p "M" + +"y" p "Y" +"r" p "R" +"R" p "\\b R" +"RR" p "\\b T" % double Ra is dental t +"t_t_" p "\\b T" % double Ra is dental t +"l" p "L" +"L" p "\\d L" +"zh" p "\\b Z" +"v" p "V" +"sh" p "\\'S" +"S" p "\\d S" +"s" p "S" +"h" p "H" + +"+" f % virama +"u+" p "\\u U" % half u + +% digits + +% special + +"<>" f % join +"@" f % non join +"[]" p "\\dotcircle" % dotted circle + +% interpunction + +"." p "." +"`" p "`" +"'" p "'" +"," p "," +":" p ":" +";" p ";" +"-" p "-" +"--" p "--" +"---" p "---" +"(" p "(" +")" p ")" +"\\%" p "\\%" + +% repeat partial table for correct transcription of anusvar + +"Mk" p "\\.NK" +"Mkh" p "\\.NKH" +"Mg" p "\\.NG" +"Mgh" p "\\.NGH" + +"Mc" p "\\~NC" +"Mch" p "\\~NCH" +"Mj" p "\\~NJ" +"Mjh" p "\\~NJH" + +"MT" p "\\d N\\d T" +"MTh" p "\\d N\\d TH" +"MD" p "\\d N\\d D" +"MDh" p "\\d N\\d DH" + +"Mt" p "NT" +"Mth" p "NTH" +"Md" p "ND" +"Mdh" p "NDH" + +"Mp" p "MP" +"Mph" p "MPH" +"Mb" p "MB" +"Mbh" p "MBH" +"Mf" p "MF" + +@end diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/mm.prj b/Master/texmf-dist/source/fonts/malayalam/preproc/mm.prj new file mode 100644 index 00000000000..bd2035baa90 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/mm.prj @@ -0,0 +1,13 @@ +mm.ttp
+.C [-A -K -G] ; [ -Y -A -K -G -T ]
+.L [-S=32000] ; [ -Y -L -G -S=32000 ]
+=
+PCSTART.O
+mm.c (mm.h, trs.h, scr.h, readfile.h)
+readfile.c (readfile.h)
+trs.c (trs.h, readfile.h, mm.h)
+scr.c (scr.h, readfile.h, mm.h)
+pstree.c (pstree.h)
+avltree.c (avltree.h)
+
+PCSTDLIB.LIB
diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/mm.scr b/Master/texmf-dist/source/fonts/malayalam/preproc/mm.scr new file mode 100644 index 00000000000..b9112aedebf --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/mm.scr @@ -0,0 +1,410 @@ +% mm.scr --- Malayalam script file for TeX pre-processor +% (c) 1993 Jeroen Hellingman +% +% History: +% 22-JAN-1994 changes in macro for virama (JH) +% 02-APR-1993 changed macro for virama (JH) +% 28-JAN-1993 version 1.0 (Jeroen Hellingman) +% +% summary of used TeX commands +% \<#1> typeset glyph #1 +% \B#1#2 put #2 centered below #1 +% \M#1#2 put #2 right below of #1 +% \T#1#2 put #1 centered on top of #2 +% \Z switch to sub-font +% \K#1 kern in #1 em's ( \def\K#1{\kern#1em} ) +% \X \def\X{\hbox} +% \mmV#1 place virama over #1 + +@malayalam +% script type + +@atbegin "{\\mm " +@atend "}" +% to be placed at the begin respectively end of malayalam text + +@atbeginsyllabe "\\X{" +@atendsyllabe "}" +% to be placed at the begin repectively end of every syllabe + +@prebuild +% prebuild characters: <codes, glyphs>. +% We start with a list mapping all single characters to glyphs (i.e. TeX +% codes to typeset them), they need to be here! + +"\d02" "\\<2>" % anusvara +"\d03" "\\<3>" % visarga + +% vowels + +"\d05" "\\<5>" % a +"\d06" "\\<6>" % aa +"\d07" "\\<7>" % i +"\d08" "\\<7>\\<87>" % ii +"\d09" "\\<9>" % u +"\d10" "\\<9>\\<87>" % uu +"\d11" "\\<11>" % vocalic r +"\d96" "\\<96>" % vocalic rr +"\d12" "\\<12>" % vocalic l +"\d97" "\\<97>" % vocalic ll +"\d14" "\\<14>" % e +"\d15" "\\<15>" % ee +"\d16" "\\<70>\\<14>" % ai +"\d18" "\\<18>" % o +"\d19" "\\<18>\\<62>" % oo +"\d20" "\\<18>\\<87>" % au +"\d87" "\\<87>" % au length mark + +% consonants + +"\d21" "\\<21>" % ka +"\d22" "\\<22>" % kha +"\d23" "\\<23>" % ga +"\d24" "\\<24>" % gha +"\d25" "\\<25>" % nga + +"\d26" "\\<26>" % ca +"\d27" "\\<27>" % cha +"\d28" "\\<28>" % ja +"\d29" "\\<29>" % jha +"\d30" "\\<30>" % nya + +"\d31" "\\<31>" % Ta +"\d32" "\\<32>" % Tha +"\d33" "\\<33>" % Da +"\d34" "\\<34>" % Dha +"\d35" "\\<35>" % Na + +"\d36" "\\<36>" % ta +"\d37" "\\<37>" % tha +"\d38" "\\<38>" % da +"\d39" "\\<39>" % dha +"\d40" "\\<40>" % na + +"\d42" "\\<42>" % pa +"\d43" "\\<43>" % pha, fa +"\d44" "\\<44>" % ba +"\d45" "\\<45>" % bha +"\d46" "\\<46>" % ma + +"\d47" "\\<47>" % ya +"\d48" "\\<48>" % ra +"\d49" "\\<49>" % Ra +"\d50" "\\<50>" % la +"\d51" "\\<51>" % La +"\d52" "\\<52>" % zha +"\d53" "\\<53>" % va +"\d54" "\\<54>" % sha +"\d55" "\\<55>" % Sa +"\d56" "\\<56>" % sa +"\d57" "\\<57>" % ha + +% digits + +"\d102" "{\\mmzero}" % 0 +"\d103" "{\\mmone}" % 1 +"\d104" "{\\mmtwo}" % 2 +"\d105" "{\\mmthree}" % 3 +"\d106" "{\\mmfour}" % 4 +"\d107" "{\\mmfive}" % 5 +"\d108" "{\\mmsix}" % 6 +"\d109" "{\\mmseven}" % 7 +"\d110" "{\\mmeight}" % 8 +"\d111" "{\\mmnine}" % 9 + +% specials + +"\d77" "\\<77>" % virama + +"\d127" "\\hbox{}" % join (dissapears) +"\d126" "\\hbox{}" % non-join (dissapears) +"\d125" "\\<00>" % dotted circle +"\d125\d127" "\\<00>" % dotted circle + join +"\d124" " " % space +"\d124\d127" "\\hbox{}" % space + join (dissapears) + +"\d48\d127\d125" "\\T{\\<76>}{\\R{3.5ex}{\\<00>}}" % reepham on dotted circle + +% then we have a list of all conjuncts and consonant vowel combinations +% that cannot be build by the standard algorithm, i.e. we need a ligature. + +"\d21\d09" "\\<128>" % ku +"\d21\d10" "\\<139>" % kuu +"\d21\d11" "\\<150>" % kr +"\d21\d21" "\\<160>" % k+ka +"\d21\d21\d09" "\\<168>" % k+ku +"\d21\d21\d10" "\\<169>" % k+kuu +"\d21\d21\d48" "\\<213>" % k+k+ra +"\d21\d21\d49" "\\<213>" % k+k+Ra +"\d21\d22" "\\M{\\<21>}{\\Z\\<22>}" % k+kha +"\d21\d26" "\\M{\\<21>}{\\Z\\<26>}" % k+ca +"\d21\d36" "\\<176>" % k+ta +"\d21\d48" "\\<200>" % k+ra +"\d21\d55" "\\<251>" % k+Sa +"\d21\d55\d46" "\\M{\\<251>}{\\Z\\<46>}" % k+S+ma +"\d21\d55\d35" "\\M{\\<251>}{\\Z\\<35>}" % k+S+Na + +"\d23\d09" "\\<129>" % gu +"\d23\d10" "\\<140>" % guu +"\d23\d11" "\\<151>" % gr +"\d23\d23" "\\<240>" % g+ga +% "\d23\d23\d47" "\\<240>\\<122>" % g+g+ya +"\d23\d24" "\\<218>" % g+gha +"\d23\d28" "\\M{\\<23>}{\\Z\\<28>}" % g+ja +"\d23\d38" "\\<177>" % g+da +"\d23\d38\d39" "\\<178>" % g+d+dha +"\d23\d40" "\\<179>" % g+na +"\d23\d46" "\\<180>" % g+ma +"\d23\d48" "\\<201>" % g+ra + +"\d24\d48" "\\M{\\<24>}{\\<127>}" % gh+ra + +"\d25\d25" "\\<161>" % ng+nga +"\d25\d21" "\\<181>" % ng+ka +"\d25\d21\d09" "\\<182>" % ng+ku +"\d25\d21\d10" "\\<183>" % ng+kuu + +"\d26\d26" "\\<247>" % c+ca +% "\d26\d26\d47" "\\<247>\\<121>" % c+c+ya +"\d26\d27" "\\M{\\<26>}{\\Z\\<27>}" % c+cha +"\d26\d54" "\\M{\\<26>}{\\Z\\<54>}" % c+sha +"\d26\d48" "\\M{\\<26>}{\\<124>}" % c+ra + +"\d27\d09" "\\<130>" % chu +"\d27\d10" "\\<141>" % chuu +"\d27\d48" "\\<202>" % ch+ra + +"\d28\d09" "\\<131>" % ju +"\d28\d10" "\\<142>" % juu +"\d28\d28" "\\<162>" % j+ja +"\d28\d28\d09" "\\<170>" % j+ju +"\d28\d28\d10" "\\<171>" % j+juu +"\d28\d30" "\\<184>" % j+nya +% "\d28\d47" "\\<28>\\<120>" % j+ya +"\d28\d48" "\\<203>" % j+ra + +"\d30\d26" "\\<185>" % ny+ca +"\d30\d28" "\\<186>" % ny+ja +"\d30\d30" "\\<163>" % ny+nya +"\d30\d48" "\\M{\\<30>}{\\<126>}" % ny+ra + +% "\d31\d09" "\\B{\\<31>}{\\<65>}" % Tu +% "\d31\d10" "\\B{\\<31>}{\\<66>}" % Tuu +"\d31\d31" "\\<164>" % T+Ta +% "\d31\d31\d09" "\\B{\\<164>}{\\<65>}" % T+Tu +% "\d31\d31\d10" "\\B{\\<164>}{\\<66>}" % T+Tuu +"\d31\d32" "\\B{\\<31>}{\\Z\\<32>}" % T+Tha +"\d31\d48" "\\<204>" % T+ra + +"\d32\d48" "\\M{\\<32>}{\\<123>}" % Th+ra + +"\d33\d33" "\\M{\\<33>}{\\<89>}" % D+Da +"\d33\d23" "\\M{\\<33>}{\\Z\\<23>}" % D+ga +"\d33\d48" "\\M{\\<33>}{\\<126>}" % D+ra + +"\d34\d34" "\\M{\\<34>}{\\<89>}" % Dh+Dha +"\d34\d48" "\\M{\\<34>}{\\<126>}" % Dh+ra + +"\d35\d09" "\\<132>" % Nu +"\d35\d10" "\\<143>" % Nuu +"\d35\d31" "\\<187>" % N+Ta +"\d35\d32" "\\M{\\<35>}{\\Z\\<32>}" % N+Tha +"\d35\d33" "\\<188>" % N+Da +"\d35\d35" "\\<241>" % N+Na +"\d35\d48" "\\M{\\<35>}{\\<127>}" % N+ra +"\d35\d77" "\\<78>" % N+virama + +"\d36\d09" "\\<133>" % tu +"\d36\d10" "\\<144>" % tuu +"\d36\d11" "\\<152>" % tr +"\d36\d36" "\\<165>" % t+ta +"\d36\d36\d09" "\\<172>" % t+tu +"\d36\d36\d10" "\\<173>" % t+tuu +"\d36\d37" "\\<36>\\K{-.5}\\<88>" % t+tha +"\d36\d40" "\\<191>" % t+na +"\d36\d42" "\\M{\\<36>}{\\Z\\<42>}" % t+pa +"\d36\d46" "\\<190>" % t+ma +"\d36\d48" "\\<205>" % t+ra +"\d36\d56" "\\<221>" % t+sa +"\d36\d77" "\\<81>" % t+virama + +"\d37\d48" "\\M{\\<37>}{\\<84>}" % th+ra + +"\d38\d11" "\\<153>" % dr +"\d38\d38" "\\<166>" % d+da +"\d38\d39" "\\<192>" % d+dha +"\d38\d48" "\\<206>" % d+ra + +"\d39\d48" "\\<207>" % dh+ra + +"\d40\d09" "\\<134>" % nu +"\d40\d10" "\\<145>" % nuu +"\d40\d11" "\\<155>" % nr +"\d40\d36" "\\<194>" % n+ta +"\d40\d36\d09" "\\<222>" % n+tu +"\d40\d36\d10" "\\<223>" % n+tuu +"\d40\d36\d48" "\\<215>" % n+t+ra +"\d40\d36\d49" "\\<215>" % n+t+Ra +"\d40\d38" "\\<195>" % n+da +"\d40\d38\d48" "\\<216>" % n+d+ra +"\d40\d39" "\\<219>" % n+dha +"\d40\d40" "\\<167>" % n+na +"\d40\d40\d09" "\\<174>" % n+nu +"\d40\d40\d10" "\\<175>" % n+nuu +"\d40\d42" "\\<220>" % n+pa +"\d40\d46" "\\<193>" % n+ma +"\d40\d48" "\\<208>" % n+ra +"\d40\d49" "\\<79>\\<49>" % n+Ra +"\d40\d53" "\\<40>\\K{-1.5}\\<93>" % n+va +"\d40\d77" "\\<79>" % n+virama + +"\d42\d36" "\\M{\\<42>}{\\Z\\<36>}" % p+ta +"\d42\d40" "\\M{\\<42>}{\\Z\\<40>}" % p+na +"\d42\d42" "\\<242>" % p+pa +% "\d42\d42\d47" "\\<242>\\<122>" % p+p+ya +"\d42\d48" "\\M{\\<42>}{\\<124>}" % p+ra + +"\d43\d48" "\\M{\\<43>}{\\<125>}" % ph+ra + +"\d44\d38" "\\M{\\<44>}{\\Z\\<38>}" % b+da +"\d44\d39" "\\M{\\<44>}{\\Z\\<39>}" % b+dha +"\d44\d44" "\\<248>" % b+ba +"\d44\d48" "\\M{\\<44>}{\\<126>}" % b+ra + +"\d45\d09" "\\<135>" % bhu +"\d45\d10" "\\<146>" % bhuu +"\d45\d11" "\\<156>" % bhr +"\d45\d33" "\\<196>" % bh+Da +"\d45\d48" "\\<209>" % bh+ra + +"\d46\d40" "\\M{\\<46>}{\\Z\\<40>}" % m+na +"\d46\d42" "\\<220>" % m+pa +"\d46\d46" "\\<46>\\K{-.27}\\<46>" % m+ma +"\d46\d48" "\\M{\\<46>}{\\<123>}" % m+ra +"\d46\d77" "\\<2>" % m+virama (=anusvara) + +"\d47\d36" "\\M{\\<47>}{\\Z\\<36>}" % y+ta +"\d47\d36\d09" "\\M{\\<47>}{\\Z\\<133>}" % y+tu +"\d47\d47" "\\<249>" % y+ya +"\d47\d48" "\\M{\\<47>}{\\<84>}" % y+ra + +"\d48\d09" "\\<136>" % ru +"\d48\d10" "\\<147>" % ruu +"\d48\d77" "\\<80>" % r+virama + +"\d49\d49" "\\<243>" % R+Ra +"\d49\d77" "\\<80>" % R+virama + +"\d50\d77" "\\<81>" % l+virama +"\d50\d36\d36" "\\B{\\<50>}{\\Z\\<165>}" % l+t+ta +"\d50\d48" "\\M{\\<50>}{\\<84>}" % l+ra + +"\d51\d51" "\\<51>\\K{-.2}\\<51>" % L+La +"\d51\d21\d21" "\\<82>\\<160>" % L+k+ka +"\d51\d21\d21\d09" "\\<82>\\<168>" % L+k+ku +"\d51\d77" "\\<82>" % L+virama + +"\d52\d09" "\\B{\\<52>}{\\<65>}" % zhu +"\d52\d10" "\\B{\\<52>}{\\<66>}" % zhuu +"\d52\d21\d21" "\\B{\\<52>}{\\<115>}" % zh+k+ka + +"\d53\d53" "\\<250>" % v+va + +"\d54\d09" "\\<137>" % shu +"\d54\d10" "\\<148>" % shuu +"\d54\d11" "\\<157>" % shr +"\d54\d26" "\\<197>" % sh+ca +"\d54\d48" "\\<210>" % sh+ra +"\d54\d54" "\\<244>" % sh+sha + +"\d55\d31" "\\M{\\<55>}{\\Z\\<31>}" % S+Ta +"\d55\d31\d48" "\\M{\\<55>}{\\Z\\<204>}" % S+T+ra +"\d55\d35" "\\M{\\<55>}{\\Z\\<35>}" % S+Na +"\d55\d46" "\\M{\\<55>}{\\Z\\<46>}" % S+Ma +"\d55\d48" "\\M{\\<55>}{\\<125>}" % S+ra + +"\d56\d21" "\\M{\\<56>}{\\<112>}" % s+ka +"\d56\d36" "\\M{\\<56>}{\\Z\\<36>}" % s+ta +"\d56\d36\d09" "\\M{\\<56>}{\\Z\\<133>}" % s+tu +"\d56\d36\d48" "\\M{\\<56>}{\\Z\\<205>}" % s+t+ra +"\d56\d46" "\\M{\\<56>}{\\Z\\<46>}" % s+ma +"\d56\d48" "\\<211>" % s+ra +"\d56\d56" "\\<245>" % s+sa + +"\d57\d09" "\\<138>" % hu +"\d57\d10" "\\<149>" % huu +"\d57\d11" "\\<159>" % hr +"\d57\d40" "\\<199>" % h+na +"\d57\d46" "\\<198>" % h+ma +"\d57\d48" "\\<212>" % h+ra +"\d57\d53" "\\<57>\\K{-1.5}\\<93>" % h+va + +% cillu/non-cillu variants of $k$ $y$ $n$, $N$, $m$, $t$ $l$ $L$ + +"\d21\d127\d77" "\\<94>" % $k<<+$ cillu-form of ka +"\d47\d127\d77" "\\<95>" % $k<<+$ cillu-form of ya + +"\d35\d127\d77" "\\mmV{\\<35>}" % $N<<+$ Na with viraama +"\d36\d127\d77" "\\mmV{\\<36>}" % $t<<+$ ta +"\d40\d127\d77" "\\mmV{\\<40>}" % na +"\d46\d127\d77" "\\mmV{\\<46>}" % ma +"\d48\d127\d77" "\\mmV{\\<48>}" % ra +"\d49\d127\d77" "\\mmV{\\<49>}" % Ra +"\d50\d127\d77" "\\mmV{\\<50>}" % la +"\d51\d127\d77" "\\mmV{\\<51>}" % La + +@secondary +% secondary shapes of characters: <codes, glyphs, glyphs> the first set of +% glyphs (TeX commands) comes in front of the cluster that is being build, +% the second set comes after it. + +% vowels + +"\d05" "" "" % a +"\d06" "" "\\<62>" % aa +"\d07" "" "\\<63>" % i +"\d08" "" "\\<64>" % ii +"\d09" "\\M{" "}{\\<65>}" % u +"\d10" "\\M{" "}{\\<66>}" % uu +"\d11" "\\M{" "}{\\<67>}" % vocalic r +"\d96" "\\M{" "}{\\<68>}" % vocalic rr +"\d12" "" "\\<12>" % vocalic l +"\d97" "" "\\<97>" % vocalic ll +"\d14" "\\<70>" "" % e +"\d15" "\\<71>" "" % ee +"\d16" "\\<70>\\<70>" "" % ai +"\d18" "\\<70>" "\\<62>" % o +"\d19" "\\<71>" "\\<62>" % oo +"\d20" "\\<70>" "\\<87>" % au +"\d87" "" "\\<87>" % au length mark +"\d77" "\\mmV{" "}" % virama + +% secondary shapes of the consonants + +"\d47" "" "\\<83>" % secondary ya +% "\d47" "" "\\<92>" % secondary ya +"\d48" "\\M{" "}{\\<84>}" % secondary ra +"\d50" "\\M{" "}{\\<85>}" % secondary la +"\d53" "" "\\K{-.5}\\<86>" % secondary va + +"\d21" "\\M{" "}{\\<112>}" % secondary ka +"\d37" "" "\\K{-.5}\\<88>" % secondary tha +"\d38" "\\M{" "}{\\Z\\<38>}" % secondary da + +"\d21\d09" "\\M{" "}{\\<113>}" % secondary ku +"\d21\d10" "\\M{" "}{\\<114>}" % secondary kuu +"\d21\d21" "\\M{" "}{\\<115>}" % secondary k+ka +"\d21\d21\d09" "\\M{" "}{\\<116>}" % secondary k+ku +"\d21\d21\d10" "\\M{" "}{\\<117>}" % secondary k+kuu + +@reepham % we use reepham + +@primary +% primary shapes of characters, occurs only with "ra" (reepham) + +"\d48" "\\T{\\<76>}{\\R{.8ex}{" "}}" % ra + +% "\d48" "\\<80>" "" % ra + +@end +% end of file diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/mm.trs b/Master/texmf-dist/source/fonts/malayalam/preproc/mm.trs new file mode 100644 index 00000000000..e5a43efe0b5 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/mm.trs @@ -0,0 +1,159 @@ +% mm.trs --- Malayalam transcription definition for TeX pre-processor +% copyright 1992 Jeroen Hellingman +% last edit: 19-DEC-1992 + +% This .TRS file defines the transcription used in the input text. +% It translates (sequences of) ASCII-characters (patterns) +% into the internal codes of the pre-processor. +% You should never change the (UNICODE based) codes of the letters, +% but you can redefine the transcription if you take care that the +% table does not define a pattern twice, or that it is ambigious +% otherwise. + +@atbegin "<malayalam>" "<ml>" "$" % this starts Malayalam text in ASCII +@atend "</malayalam>" "</ml>" "$" % this ends Malayalam text in ASCII + +% @table format: +% <pattern> <space> <command> <space> [ <parameter> ][ <comment> ] + +@table + +% vowels + +"a" = "\d05" % a +"aa" = "\d06" % aa +"A" = "\d06" +"i" = "\d07" % i +"ii" = "\d08" % ii +"I" = "\d08" +"u" = "\d09" +"uu" = "\d10" +"U" = "\d10" +".r" = "\d11" % vocalic r +".r.r" = "\d96" % vocalic rr +".R" = "\d96" +".l" = "\d12" % vocalic l +".l.l" = "\d97" % vocalic ll +".L" = "\d97" +"e" = "\d14" +"ee" = "\d15" +"E" = "\d15" +"ai" = "\d16" +"o" = "\d18" +"oo" = "\d19" +"O" = "\d19" +"au" = "\d20" +"au\"" = "\d87" % au length mark + +% modifiers + +"M" = "\d02" % anusvara +"H" = "\d03" % visarga + +% consonants will be print in cillu form if no vowel follows + +"k" = "\d21" +"kh" = "\d22" +"g" = "\d23" +"gh" = "\d24" +"n\"" = "\d25" % nga + +"c" = "\d26" +"ch" = "\d27" +"j" = "\d28" +"jh" = "\d29" +"n~" = "\d30" % nya + +"T" = "\d31" +"Th" = "\d32" +"D" = "\d33" +"Dh" = "\d34" +"N" = "\d35" + +"t" = "\d36" +"th" = "\d37" +"d" = "\d38" +"dh" = "\d39" +"n" = "\d40" +"n_" = "\d40" + +"p" = "\d42" +"ph" = "\d43" +"f" = "\d43" +"b" = "\d44" +"bh" = "\d45" +"m" = "\d46" + +"y" = "\d47" +"r" = "\d48" +"R" = "\d49" +"t_" = "\d49" +"l" = "\d50" +"L" = "\d51" +"zh" = "\d52" +"v" = "\d53" +"sh" = "\d54" +"S" = "\d55" +"s" = "\d56" +"h" = "\d57" + +"+" = "\d77" % virama +%"u+" = "\d77" % half u + +% digits + +"0" = "\d102" +"1" = "\d103" +"2" = "\d104" +"3" = "\d105" +"4" = "\d106" +"5" = "\d107" +"6" = "\d108" +"7" = "\d109" +"8" = "\d110" +"9" = "\d111" + +% special (arbitrary code positions) + +"<<" = "\d127" % join +">>" = "\d126" % non join +"[]" = "\d125" % dotted circle +" " = "\d124" % space +"\t" = "\d124" % tab = space + +% interpunction + +% non malayalam things + +">" f % eliminate ambiguities +"\\" t % copy TeX command +"^" f % forget about capital letters +"\\$" p "\\$" +"%" s % skip comment +"{" p "{" +"}" p "}" +"\n" p "\n" % newline + +% things borrowed from roman + +"." p "{\\RMF.}" +"," p "{\\RMF,}" +":" p "{\\RMF:}" +";" p "{\\RMF;}" +"`" p "{\\RMF`}" +"``" p "{\\RMF``}" +"'" p "{\\RMF'}" +"''" p "{\\RMF''}" +"-" p "{\\RMF-}" +"--" p "{\\RMF--}" +"---" p "{\\RMF---}" +"?" p "{\\RMF?}" +"!" p "{\\RMF!}" +"(" p "{\\RMF(}" +")" p "{\\RMF)}" +"[" p "{\\RMF[}" +"]" p "{\\RMF]}" +"/" p "{\\RMF/}" +"\\%" p "{\\RMF\\%}" + +@end diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/mm.ttp b/Master/texmf-dist/source/fonts/malayalam/preproc/mm.ttp Binary files differnew file mode 100644 index 00000000000..f81f8b26a6e --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/mm.ttp diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/mm2ack.pat b/Master/texmf-dist/source/fonts/malayalam/preproc/mm2ack.pat new file mode 100644 index 00000000000..a6b8d3922ce --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/mm2ack.pat @@ -0,0 +1,85 @@ +% mm2ack.pat --- patterns to convert my transcription to +% transcription used in A.C.K (designed by Mathai Chundat) +% (c) 1993 Jeroen Hellingman +% last edit: 22-JAN-1993 + +@patterns 0 +"<malayalam>" 1 "<malayalam>" +"$" 1 "<malayalam>" + +@patterns 1 +"</malayalam>" 0 "</malayalam>" +"$" 0 "</malayalam>" +% vowels +"a" p "a" +"aa" p "aa" +"A" p "aa" +"i" p "i" +"ii" p "ee" +"I" p "ee" +"u" p "u" +"uu" p "oo" +"U" p "oo" +".r" p "R~" +"e" p "e" +"ee" p "E" +"E" p "E" +"o" p "o" +"oo" p "O" +"O" p "O" +"ai" p "ai" +"au" p "ou" +"am" p "am" +"H" p ":" +"ua" p "wa" % u + a = wa (?) +% ka +"k" p "k" +"kh" p "kh" +"g" p "g" +"gh" p "gh" +"n\"" p "nG" +"n\"n\"" p "nnG" +% ca +"c" p "ch" +"ch" p "Ch" +"j" p "j" +"jh" p "jh" +"n~" p "nJ" +"cc" p "cch" +"n~n~" p "nnJ" +% Ta +"T" p "t" +"Th" p "T" +"D" p "D" +"Dh" p "Dh" +"N" p "N" +% ta +"t" p "th" +"th" p "Th" +"d" p "d" +"dh" p "dh" +"n" p "n" +"tt" p "tth" +"tth" p "tTh" +"tdh" p "tdh" +"tbh" p "tbh" +% pa +"p" p "p" +"ph" p "ph" +"b" p "b" +"bh" p "bh" +"m" p "m" +% yaraladikaaL +"y" p "y" +"r" p "r" +"l" p "l" +"v" p "v" +"sh" p "S" +"S" p "sh" +"s" p "s" +"h" p "h" +"R" p "R" +"zh" p "zh" +"L" p "L" +"RR" p "TT" +@end diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/mmr.scr b/Master/texmf-dist/source/fonts/malayalam/preproc/mmr.scr new file mode 100644 index 00000000000..b9a8a223619 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/mmr.scr @@ -0,0 +1,261 @@ +% mmr.scr --- Malayalam reformed script file for TeX pre-processor +% (c) 1993 Jeroen Hellingman +% +% History: +% 22-JAN-1994 changes for virama (JH) +% 02-APR-1993 changed macro for virama (JH) +% 28-JAN-1993 version 1.0 (Jeroen Hellingman) +% +% summary of used TeX commands +% \<#1> typeset glyph #1 +% \B#1#2 put #2 centered below #1 +% \M#1#2 put #2 right below of #1 +% \T#1#2 put #1 centered on top of #2 +% \Z switch to sub-font (not used for reformed script) +% \K kern in em's ( \def\K#1{\kern#1em} ) +% \X \def\X{\hbox} + +@malayalam +% script type + +@atbegin "{\\mm " +@atend "}" +% to be placed at the begin respectively end of malayalam text + +@atbeginsyllabe "\\X{" +@atendsyllabe "}" +% to be placed at the begin repectively end of every syllabe + +@prebuild +% prebuild characters: <codes, glyphs>. +% We start with a list mapping all single characters to glyphs (i.e. TeX +% codes to typeset them), they need to be here! + +"\d02" "\\<2>" % anusvara +"\d03" "\\<3>" % visarga + +% vowels + +"\d05" "\\<5>" % a +"\d06" "\\<6>" % aa +"\d07" "\\<7>" % i +"\d08" "\\<7>\\<87>" % ii +"\d09" "\\<9>" % u +"\d10" "\\<9>\\<87>" % uu +"\d11" "\\<11>" % vocalic r +"\d96" "\\<96>" % vocalic rr +"\d12" "\\<12>" % vocalic l +"\d97" "\\<97>" % vocalic ll +"\d14" "\\<14>" % e +"\d15" "\\<15>" % ee +"\d16" "\\<70>\\<14>" % ai +"\d18" "\\<18>" % o +"\d19" "\\<18>\\<62>" % oo +"\d20" "\\<18>\\<87>" % au +"\d87" "\\<87>" % au length mark + +% consonants + +"\d21" "\\<21>" % ka +"\d22" "\\<22>" % kha +"\d23" "\\<23>" % ga +"\d24" "\\<24>" % gha +"\d25" "\\<25>" % nga + +"\d26" "\\<26>" % ca +"\d27" "\\<27>" % cha +"\d28" "\\<28>" % ja +"\d29" "\\<29>" % jha +"\d30" "\\<30>" % nya + +"\d31" "\\<31>" % Ta +"\d32" "\\<32>" % Tha +"\d33" "\\<33>" % Da +"\d34" "\\<34>" % Dha +"\d35" "\\<35>" % Na + +"\d36" "\\<36>" % ta +"\d37" "\\<37>" % tha +"\d38" "\\<38>" % da +"\d39" "\\<39>" % dha +"\d40" "\\<40>" % na + +"\d42" "\\<42>" % pa +"\d43" "\\<43>" % pha, fa +"\d44" "\\<44>" % ba +"\d45" "\\<45>" % bha +"\d46" "\\<46>" % ma + +"\d47" "\\<47>" % ya +"\d48" "\\<48>" % ra +"\d49" "\\<49>" % Ra +"\d50" "\\<50>" % la +"\d51" "\\<51>" % La +"\d52" "\\<52>" % zha +"\d53" "\\<53>" % va +"\d54" "\\<54>" % sha +"\d55" "\\<55>" % Sa +"\d56" "\\<56>" % sa +"\d57" "\\<57>" % ha + +% digits + +"\d102" "{\\mmzero}" % 0 +"\d103" "{\\mmone}" % 1 +"\d104" "{\\mmtwo}" % 2 +"\d105" "{\\mmthree}" % 3 +"\d106" "{\\mmfour}" % 4 +"\d107" "{\\mmfive}" % 5 +"\d108" "{\\mmsix}" % 6 +"\d109" "{\\mmseven}" % 7 +"\d110" "{\\mmeight}" % 8 +"\d111" "{\\mmnine}" % 9 + +% specials + +"\d77" "\\<77>" % virama + +"\d127" "\\hbox{}" % join (dissapears) +"\d126" "\\hbox{}" % non-join (dissapears) +"\d125" "\\<00>" % dotted circle +"\d125\d127" "\\<00>" % dotted circle + join +"\d124" " " % space +"\d124\d127" "\\hbox{}" % space + join (dissapears) + +% then we have a list of all conjuncts and consonant vowel combinations +% that cannot be build by the standard algorithm, i.e. we need a ligature. + +"\d21\d21" "\\<160>" % k+ka +"\d21\d55" "\\<251>" % k+Sa +"\d21\d77" "\\<94>" % k+virama + +"\d23\d23" "\\<240>" % g+ga +"\d23\d24" "\\<218>" % g+gha +"\d23\d38" "\\<177>" % g+da +"\d23\d38\d39" "\\<178>" % g+d+dha +"\d23\d40" "\\<179>" % g+na +"\d23\d46" "\\<180>" % g+ma + +"\d25\d25" "\\<161>" % ng+nga +"\d25\d21" "\\<181>" % ng+ka + +"\d26\d26" "\\<247>" % c+ca + +"\d28\d28" "\\<162>" % j+ja +"\d28\d30" "\\<184>" % j+nya + +"\d30\d26" "\\<185>" % ny+ca +"\d30\d28" "\\<186>" % ny+ja +"\d30\d30" "\\<163>" % ny+nya + +"\d31\d31" "\\<164>" % T+Ta + +"\d33\d33" "\\M{\\<33>}{\\<89>}" % D+Da + +"\d34\d34" "\\M{\\<34>}{\\<89>}" % Dh+Dha + +"\d35\d31" "\\<187>" % N+Ta +"\d35\d33" "\\<188>" % N+Da +"\d35\d35" "\\<241>" % N+Na +"\d35\d77" "\\<78>" % N+virama + +"\d36\d36" "\\<165>" % t+ta +"\d36\d37" "\\<36>\\K{-.5}\\<88>" % t+tha +"\d36\d40" "\\<191>" % t+na +"\d36\d46" "\\<190>" % t+ma +"\d36\d56" "\\<221>" % t+sa +"\d36\d77" "\\<81>" % t+virama + +"\d38\d38" "\\<166>" % d+da +"\d38\d39" "\\<192>" % d+dha + +"\d40\d36" "\\<194>" % n+ta +"\d40\d38" "\\<195>" % n+da +"\d40\d40" "\\<167>" % n+na +"\d40\d46" "\\<193>" % n+ma +"\d40\d77" "\\<79>" % n+virama + +"\d42\d42" "\\<242>" % p+pa + +"\d44\d44" "\\<248>" % b+ba + +"\d46\d46" "\\<46>\\K{-.27}\\<46>" % m+ma +"\d46\d77" "\\<2>" % m+virama (=anusvara) + +"\d47\d47" "\\<249>" % y+ya + +"\d48\d77" "\\<80>" % r+virama + +"\d49\d49" "\\<243>" % R+Ra +"\d49\d77" "\\<80>" % R+virama + +"\d50\d77" "\\<81>" % l+virama + +"\d51\d51" "\\<51>\\K{-.2}\\<51>" % L+La +"\d51\d77" "\\<82>" % L+virama + +"\d53\d53" "\\<250>" % v+va + +"\d54\d54" "\\<244>" % sh+sha + +"\d56\d56" "\\<245>" % s+sa + +% cillu/non-cillu variants of $k$ $y$ $n$, $N$, $m$, $t$ $l$ $L$ + +"\d21\d127\d77" "\\mmV{\\<21>}" % $k<<+$ cillu-form of ka +"\d47\d127\d77" "\\<95>" % $k<<+$ cillu-form of ya + +"\d35\d127\d77" "\\mmV{\\<35>}" % Na +"\d36\d127\d77" "\\mmV{\\<36>}" % ta +"\d40\d127\d77" "\\mmV{\\<40>}" % na +"\d46\d127\d77" "\\mmV{\\<46>}" % ma +"\d48\d127\d77" "\\mmV{\\<48>}" % ra +"\d49\d127\d77" "\\mmV{\\<49>}" % Ra +"\d50\d127\d77" "\\mmV{\\<50>}" % la +"\d51\d127\d77" "\\mmV{\\<51>}" % La + +@secondary +% secondary shapes of characters: <codes, glyphs, glyphs> the first set of +% glyphs (TeX commands) comes in front of the cluster that is being build, +% the second set comes after it. + +% vowels + +"\d05" "" "" % a +"\d06" "" "\\<62>" % aa +"\d07" "" "\\<63>" % i +"\d08" "" "\\<64>" % ii +"\d09" "" "\\<72>" % u +"\d10" "" "\\<73>" % uu +"\d11" "" "\\<75>" % vocalic r +"\d96" "\\M{" "}{\\<68>}" % vocalic rr +"\d12" "" "\\<12>" % vocalic l +"\d97" "" "\\<97>" % vocalic ll +"\d14" "\\<70>" "" % e +"\d15" "\\<71>" "" % ee +"\d16" "\\<70>\\<70>" "" % ai +"\d18" "\\<70>" "\\<62>" % o +"\d19" "\\<71>" "\\<62>" % oo +"\d20" "" "\\<87>" % au +"\d87" "\\<70>" "\\<87>" % au length mark +"\d77" "\\mmV{" "}" % virama + + +% secondary shapes of the consonants + +"\d47" "" "\\<83>" % secondary ya +"\d48" "\\<74>" "" % secondary ra +"\d50" "\\M{" "}{\\<85>}" % secondary la +"\d53" "" "\\K{-.5}\\<86>" % secondary va + +@primary +% primary shapes of characters, occurs only with "ra" +% +% @reepham "\\T{\\<76>}{" "}" +% +% "\d48" "\\T{\\<76>}{" "}" % ra + +"\d48" "\\<80>" "" % ra + +@end +% end of file diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/mmr.trs b/Master/texmf-dist/source/fonts/malayalam/preproc/mmr.trs new file mode 100644 index 00000000000..047fb206921 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/mmr.trs @@ -0,0 +1,159 @@ +% mmr.trs --- Malayalam transcription definition for TeX pre-processor +% copyright 1992 Jeroen Hellingman +% last edit: 20-DEC-1992 + +% This .TRS file defines the transcription used in the input text. +% It translates (sequences of) ASCII-characters (patterns) +% into the internal codes of the pre-processor. +% You should never change the (UNICODE based) codes of the letters, +% but you can redefine the transcription if you take care that the +% table does not define a pattern twice, or that it is ambigious +% otherwise. + +@atbegin "<malayalam>" "<mlr>" "$" % this starts Malayalam text in ASCII +@atend "</malayalam>" "</mlr>" "$" % this ends Malayalam text in ASCII + +% @table format: +% <pattern> <space> <command> <space> [ <parameter> ][ <comment> ] + +@table + +% vowels + +"a" = "\d05" % a +"aa" = "\d06" % aa +"A" = "\d06" +"i" = "\d07" % i +"ii" = "\d08" % ii +"I" = "\d08" +"u" = "\d09" +"uu" = "\d10" +"U" = "\d10" +".r" = "\d11" % vocalic r +".r.r" = "\d96" % vocalic rr +".R" = "\d96" +".l" = "\d12" % vocalic l +".l.l" = "\d97" % vocalic ll +".L" = "\d97" +"e" = "\d14" +"ee" = "\d15" +"E" = "\d15" +"ai" = "\d16" +"o" = "\d18" +"oo" = "\d19" +"O" = "\d19" +"au" = "\d20" +"au\"" = "\d87" % au length mark + +% modifiers + +"M" = "\d02" % anusvara +"H" = "\d03" % visarga + +% consonants will be print in cillu form if no vowel follows + +"k" = "\d21" +"kh" = "\d22" +"g" = "\d23" +"gh" = "\d24" +"n\"" = "\d25" % nga + +"c" = "\d26" +"ch" = "\d27" +"j" = "\d28" +"jh" = "\d29" +"n~" = "\d30" % nya + +"T" = "\d31" +"Th" = "\d32" +"D" = "\d33" +"Dh" = "\d34" +"N" = "\d35" + +"t" = "\d36" +"th" = "\d37" +"d" = "\d38" +"dh" = "\d39" +"n" = "\d40" +"n_" = "\d40" + +"p" = "\d42" +"ph" = "\d43" +"f" = "\d43" +"b" = "\d44" +"bh" = "\d45" +"m" = "\d46" + +"y" = "\d47" +"r" = "\d48" +"R" = "\d49" +"t_" = "\d49" +"l" = "\d50" +"L" = "\d51" +"zh" = "\d52" +"v" = "\d53" +"sh" = "\d54" +"S" = "\d55" +"s" = "\d56" +"h" = "\d57" + +"+" = "\d77" % virama +"u+" = "\d77" % half u + +% digits + +"0" = "\d102" +"1" = "\d103" +"2" = "\d104" +"3" = "\d105" +"4" = "\d106" +"5" = "\d107" +"6" = "\d108" +"7" = "\d109" +"8" = "\d110" +"9" = "\d111" + +% special (arbitrary code positions) + +"<<" = "\d127" % join +">>" = "\d126" % non join +"[]" = "\d125" % dotted circle +" " = "\d124" % space +"\t" = "\d124" % tab = space + +% interpunction + +% non malayalam things + +">" f % eliminate ambiguities +"\\" t % copy TeX command +"^" f % forget about capital letters +"\\$" p "\\$" +"%" s % skip comment +"{" p "{" +"}" p "}" +"\n" p "\n" % newline + +% things borrowed from roman + +"." p "{\\RMF.}" +"," p "{\\RMF,}" +":" p "{\\RMF:}" +";" p "{\\RMF;}" +"`" p "{\\RMF`}" +"``" p "{\\RMF``}" +"'" p "{\\RMF'}" +"''" p "{\\RMF''}" +"-" p "{\\RMF-}" +"--" p "{\\RMF--}" +"---" p "{\\RMF---}" +"?" p "{\\RMF?}" +"!" p "{\\RMF!}" +"(" p "{\\RMF(}" +")" p "{\\RMF)}" +"[" p "{\\RMF[}" +"]" p "{\\RMF]}" +"/" p "{\\RMF/}" +"\\%" p "{\\RMF\\%}" + +@end diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/mmrfull.trs b/Master/texmf-dist/source/fonts/malayalam/preproc/mmrfull.trs new file mode 100644 index 00000000000..4893aa56704 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/mmrfull.trs @@ -0,0 +1,160 @@ +% mmrfull.trs --- Malayalam transcription definition for +% TeX pre-processor using Malayalam font punctuation +% copyright 1992 Jeroen Hellingman +% last edit: 31-DEC-1992 + +% This .TRS file defines the transcription used in the input text. +% It translates (sequences of) ASCII-characters (patterns) +% into the internal codes of the pre-processor. +% You should never change the (UNICODE based) codes of the letters, +% but you can redefine the transcription if you take care that the +% table does not define a pattern twice, or that it is ambigious +% otherwise. + +@atbegin "<malayalam>" "<mlr>" "$" % this starts Malayalam text in ASCII +@atend "</malayalam>" "</mlr>" "$" % this ends Malayalam text in ASCII + +% @table format: +% <pattern> <space> <command> <space> [ <parameter> ][ <comment> ] + +@table + +% vowels + +"a" = "\d05" % a +"aa" = "\d06" % aa +"A" = "\d06" +"i" = "\d07" % i +"ii" = "\d08" % ii +"I" = "\d08" +"u" = "\d09" +"uu" = "\d10" +"U" = "\d10" +".r" = "\d11" % vocalic r +".r.r" = "\d96" % vocalic rr +".R" = "\d96" +".l" = "\d12" % vocalic l +".l.l" = "\d97" % vocalic ll +".L" = "\d97" +"e" = "\d14" +"ee" = "\d15" +"E" = "\d15" +"ai" = "\d16" +"o" = "\d18" +"oo" = "\d19" +"O" = "\d19" +"au" = "\d20" +"au\"" = "\d87" % au length mark + +% modifiers + +"M" = "\d02" % anusvara +"H" = "\d03" % visarga + +% consonants will be print in cillu form if no vowel follows + +"k" = "\d21" +"kh" = "\d22" +"g" = "\d23" +"gh" = "\d24" +"n\"" = "\d25" % nga + +"c" = "\d26" +"ch" = "\d27" +"j" = "\d28" +"jh" = "\d29" +"n~" = "\d30" % nya + +"T" = "\d31" +"Th" = "\d32" +"D" = "\d33" +"Dh" = "\d34" +"N" = "\d35" + +"t" = "\d36" +"th" = "\d37" +"d" = "\d38" +"dh" = "\d39" +"n" = "\d40" +"n_" = "\d40" + +"p" = "\d42" +"ph" = "\d43" +"f" = "\d43" +"b" = "\d44" +"bh" = "\d45" +"m" = "\d46" + +"y" = "\d47" +"r" = "\d48" +"R" = "\d49" +"t_" = "\d49" +"l" = "\d50" +"L" = "\d51" +"zh" = "\d52" +"v" = "\d53" +"sh" = "\d54" +"S" = "\d55" +"s" = "\d56" +"h" = "\d57" + +"+" = "\d77" % virama +"u+" = "\d77" % half u + +% digits + +"0" = "\d102" +"1" = "\d103" +"2" = "\d104" +"3" = "\d105" +"4" = "\d106" +"5" = "\d107" +"6" = "\d108" +"7" = "\d109" +"8" = "\d110" +"9" = "\d111" + +% special (arbitrary code positions) + +"<<" = "\d127" % join +">>" = "\d126" % non join +"[]" = "\d125" % dotted circle +" " = "\d124" % space +"\t" = "\d124" % tab = space + +% interpunction + +% non malayalam things + +">" f % eliminate ambiguities +"\\" t % copy TeX command +"^" f % forget about capital letters +"\\$" p "\\$" +"%" s % skip comment +"{" p "{" +"}" p "}" +"\n" p "\n" % newline + +% things borrowed from roman + +"." p "\\<59>" +"," p "\\<58>" +":" p "\\<61>" +";" p "\\<60>" +"`" p "\\<19>" +"``" p "\\<19>\\<19>" +"'" p "\\<20>" +"''" p "\\<20>\\<20>" +"-" p "\\<69>" +"--" p "\\<98>" +"---" p "\\<99>" +"?" p "\\<41>" +"!" p "\\<13>" +"(" p "\\<16>" +")" p "\\<17>" +"[" p "\\<8>" +"]" p "\\<10>" +"/" p "\\<4>" +"\\%" p "{\\RMF\\%}" + +@end diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/patc/detex.g b/Master/texmf-dist/source/fonts/malayalam/preproc/patc/detex.g new file mode 100644 index 00000000000..c4936a04d5d --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/patc/detex.g @@ -0,0 +1,3 @@ +echo verwijder TeX opdrachten uit een bestand: +echo patc '-v -p d:\src\patc\detex.pat' $1 $2 +patc '-v -p d:\src\patc\detex.pat' $1 $2 diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/patc/detex.pat b/Master/texmf-dist/source/fonts/malayalam/preproc/patc/detex.pat new file mode 100644 index 00000000000..e5a02f9091e --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/patc/detex.pat @@ -0,0 +1,133 @@ +% detex.patc -- maak van een TeX-bestand (bijna) kale PC/ST-ASCII +% (c) Jeroen Hellingman 1993 +% laatste wijziging: 01-MAY-1993 + +@patterns 0 + +"%" s skip commentaar +"\\" T verwijder TeX commando's +"{" f +"}" f +"#" f +"&" f + +% math-mode proberen we niet eens (skippen) + +"$" 1 "$" +"$$" 1 "$$" + +% index commando's \`a la The TeXbook slopen we er ook uit + +"^{" f +"^^{" B skip till closing brace + +"<" S ">" skip till closing bracket + +% wat speciale dingen + +"\\footnote" e "\\footnote in text" +"\\halign" e "\\halign in text" +"\\item" e "\\item in text" + +"\\dots" p "..." +"\\ " p " " +"\\par" p "\n\n" +"\\paragraaf" f +"\\paragraph" f +"\\i " p "i" +"{\\i}" p "i" +"\\i}" p "i" + +"\\#" p "#" +"\\$" p "$" +"\\&" p "&" +"\\%" p "%" +"~" p " " non-breaking space + +% letters met accenten, voorzover aanwezig in de Atari-ST character set. + +"\\c C" p "€" +"\\c{C}" p "€" +"\\\"u" p "" +"\\'e" p "‚" +"\\^a" p "ƒ" +"\\\"a" p "„" +"\\`a" p "…" +"\\aa " p "†" +"{\\aa}" p "†" +"\\c c" p "‡" +"\\c{c}" p "‡" +"\\^e" p "ˆ" +"\\\"e" p "‰" +"\\`e" p "Š" +"\\\"\\i " p "‹" +"{\\\"\\i}" p "‹" +"\\\"{\\i}" p "‹" +"\\^\\i " p "Œ" +"{\\^\\i}" p "Œ" +"\\^{\\i}" p "Œ" +"\\^\\i\\ " p "Œ " +"\\`\\i " p "" +"{\\`\\i}" p "" +"\\`{\\i}" p "" +"\\`\\i\\ " p " " +"\\\"A" p "Ž" +"\\AA " p "" +"{\\AA}" p "" +"\\'E" p "" +"\\ae " p "‘" +"{\\ae}" p "‘" +"\\AE " p "’" +"{\\AE}" p "’" +"\\^o" p "“" +"\\\"o" p "”" +"\\`o" p "•" +"\\^u" p "–" +"\\`u" p "—" +"\\\"O" p "™" +"\\\"U" p "š" +"\\ss " p "ž" +"\\ss\\ " p "ž " +"{\\ss}" p "ž" +"\\'a" p " " +"\\'\\i " p "¡" +"{\\'\\i}" p "¡" +"\\'{\\i}" p "¡" +"\\'\\i\\ " p "¡ " +"\\'o" p "¢" +"\\'u" p "£" +"\\~n" p "¤" +"\\~N" p "¥" +"`?" p "¨" +"`!" p "" +"\\~a" p "°" +"\\~o" p "±" +"\\O " p "²" +"{\\O}" p "²" +"\\O\\ " p "² " +"\\o " p "³" +"{\\o}" p "³" +"\\o\\ " p "³ " +"\\oe " p "´" +"{\\oe}" p "´" +"\\OE " p "µ" +"{\\OE}" p "µ" +"\\`A" p "¶" +"\\~A" p "·" +"\\~O" p "¸" + +% letters met accenten, niet aanwezig in ST character-set + +"\\l " p "l" Poolse l-streep +"{\\l}" p "l" +"\\L " p "L" Poolse L-streep +"{\\L}" p "L" + +"\\d " f dot under +"{\\d}" f dot under + +@patterns 1 (voor math-mode) +"$" 0 "$" +"$$" 0 "$$" + +@end diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.c b/Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.c new file mode 100644 index 00000000000..c3c641851b1 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.c @@ -0,0 +1,474 @@ +#define version "patc v1.1c (c) Jeroen Hellingman 01-MAY-1993\n" + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <ctype.h> +#include "PSTree.h" + +#define TRUE (1==1) +#define FALSE (1==0) + +#define NUMPATS 10 /* number of pattern trees */ +#define PATLEN 50 /* maximum length of pattern */ +#define BUFSIZE 512 /* pushback buffer size (BUFSIZE >= PATLEN) */ + +/* datatypen */ + +typedef struct patterntree +{ PSTree *t; /* pattern tree for this node */ + int r; /* restrictive or not? */ +} patterntree; + +/* globals */ + +FILE *infile; +FILE *outfile; +patterntree pat[NUMPATS]; +char *progname = "patc"; +char *patfilename = "patc.pat"; +char *infilename; +char *outfilename; +static int quiet = TRUE; /* be quiet */ +static int linenumber = 1; /* current line in infile */ + +/* prototypes */ + +void parsetables(FILE *patfile); +void patc(void); +void processflags(int argc, char** argv); +void usage(void); +void copytexcommand(void); +void skiptexcommand(void); +void skiptillmatchingbrace(void); +void skiptillchar(char c1); +void copycomment(void); +void skipcomment(void); +int readchar(void); +void unreadchar(int); +int what_escape(const char *s, char *result); + +/***********************************************************************/ + +void PUSHBACK(char *c) +/* push the characters in string c back into the inputstream, works + * with the pair of functions readchar() and unreadchar() + */ +{ int i = (int)strlen(c)-1; + for( ;i >= 0; i--) unreadchar((int)c[i]); +} + +void main(int argc, char** argv) +/* check arguments, intialize tables, open files + */ +{ FILE *patfile; + + processflags(argc, argv); + if(!quiet) fputs(version, stderr); + + patfile = fopen(patfilename, "r"); + if(patfile==NULL) + { fprintf(stderr, "%s: can't open %s\n", progname, patfilename); + exit(2); + } + parsetables(patfile); + fclose(patfile); + + infile = fopen(infilename, "r"); + if(infile==NULL) + { fprintf(stderr, "%s: can't open %s\n", progname, infilename); + exit(2); + } + outfile = fopen(outfilename, "w"); + if(outfile==NULL) + { fprintf(stderr, "%s: can't create %s\n", progname, outfilename); + exit(2); + } + patc(); + fclose(infile); + fclose(outfile); + exit(0); +} + +void processflags(int argc, char** argv) +{ int nextoption = FALSE; + int i = 1; + + if(argc < i+2) usage(); + if(argv[i][0] == '-') nextoption = TRUE; + + while(nextoption) + { switch(argv[i][1]) + { case 'v': quiet = FALSE; break; + case 'p': patfilename = argv[i+1]; i++; break; + default: usage(); + } + i++; + if(argc < i+2) usage(); + if(argv[i][0] != '-') nextoption = FALSE; + } + + infilename = argv[i]; + outfilename = argv[i+1]; +} + +void usage() +{ fprintf(stderr, "usage: %s [-v] [-p patfile] infile outfile\n", progname); + exit(1); +} + +/***********************************************************************/ + +int readline(char *l, FILE* infile) +{ int i = 0; + int c = fgetc(infile); + while(isspace(c) && c != '\n' && c != EOF) c = fgetc(infile); /* skip whitespace */ + if(c == '%') while(c != '\n' && c != EOF) c = fgetc(infile); /* skip comments */ + while(c != '\n' && c != EOF && i < BUFSIZE) + { l[i] = (c == EOF) ? '\0' : (int) c; + i++; + c = getc(infile); + } + l[i] = '\0'; /* NULL-terminate */ + return (c!=EOF); +} + +int getword(char *s, char *d) +{ int i = 0, j = 0; + while(isspace(s[i]) && s[i] != '\0') i++; + while(isalnum(s[i])) { d[j] = s[i]; j++; i++; } + d[j] = '\0'; + return i; +} + +int getquotedstring(const char *s, char *d) +{ int i = 0; /* no of chars read in source */ + int j = 0; /* no of chars inserted in destination */ + while(isspace(s[i]) && s[i] != '\0') i++; + + if(s[i] == '"') + { i++; + while(s[i] != '"') + { if(s[i] == '\\') /* escape char */ + i += what_escape(&s[i], &d[j]); + else + { d[j] = s[i]; + } + j++; i++; + } + } + d[j] = '\0'; /* NULL-terminate */ + i++; /* skip final " */ + return i; +} + +/* Find out what escape sequence is used. If non can be found, we just + forget about the backslash. Interprete numbers up to 255/177/FF +*/ + +#define UNSIGNED(t) (char)(((t) < 0) ? (t) + 256 : (t)) + +int what_escape(const char *s, char *result) +{ int i = 1; /* length of escape sequence read */ + int ok = TRUE; + int t = 0; /* temporary result */ + + switch(s[1]) + { case '"': *result = '"'; break; + case '\\': *result = '\\'; break; + case 't': *result = '\t'; break; + case 'n': *result = '\n'; break; + case 'b': *result = '\b'; break; + case 'h': /* hexadecimal */ + while(i < 3 && ok) + { i++; + if(s[i]>='0' && s[i]<='9') t = t * 16 + (s[i] - '0'); + else if(s[i]>='A' && s[i]<='F') t = t * 16 + (s[i] - 'A') + 10; + else if(s[i]>='a' && s[i]<='f') t = t * 16 + (s[i] - 'a') + 10; + else + { if(i==2) /* no number after \h */ + *result = 'h'; + else /* short number after \h */ + *result = UNSIGNED(t); + i--; + ok = FALSE; + } + } + if(ok) *result = UNSIGNED(t); + break; + case 'd': /* decimal */ + while(i < 4 && ok) + { i++; + if(s[i]>='0' && s[i]<='9') t = t * 10 + (s[i] - '0'); + else + { if(i==2) /* no number after \d */ + *result = 'd'; + else /* short number after \d */ + *result = UNSIGNED(t); + i--; + ok = FALSE; + } + } + if(ok) *result = UNSIGNED(t); + break; + default: /* try octal interpretation */ + i--; + while(i < 3 && ok) + { i++; + if(s[i]>='0' && s[i]<='7') t = t * 8 + (s[i] - '0'); + else + { if(i==1) /* no number after \ */ + *result = s[i]; + else /* short number after \ */ + { *result = UNSIGNED(t); + i--; + } + ok = FALSE; + } + } + if(ok) *result = UNSIGNED(t); + } + return i; +} + +void parsetables(FILE *patfile) +{ char line[BUFSIZE]; + char command[BUFSIZE]; + char pattern[BUFSIZE]; + char action[BUFSIZE]; + char *tmp; + int pos = 1; + char notEOF = TRUE; + int currentpat = 0; /* current patterntree under construction */ + + while(notEOF) + { notEOF = readline(line, patfile); + pos = 0; + switch(line[0]) + { case '\0': /* empty line */ break; + case '@': /* command */ + pos++; + pos += tolower(getword(&line[1], command)); + if(strcmp(command, "patterns") == 0) + { pos += getword(&line[pos], command); + currentpat = atoi(command); + pat[currentpat].r = FALSE; + } + else if(strcmp(command, "rpatterns") == 0) + { pos += getword(&line[pos], command); + currentpat = atoi(command); + pat[currentpat].r = TRUE; + } + else if(strcmp(command, "end") == 0) return; + else + { fprintf(stderr, "Error: unknown command %s\n", command); + exit(1); + } + break; + case '"': /* action */ + pos += getquotedstring(line, pattern); + pos += getword(&line[pos], command); + pos += getquotedstring(&line[pos], &action[1]); + action[0] = command[0]; + tmp = malloc(strlen(action) + 1); + if(tmp == NULL) + { fprintf(stderr, "Error: cannot allocate\n"); + exit(3); + } + strcpy(tmp, action); + PSTinsert(&pat[currentpat].t, pattern, tmp); + break; + default: fprintf(stderr, "Error: illegal line '%s' in %s\n", + line, patfilename); + fprintf(stderr, "I will forget it\n"); + } + } +} + +/***********************************************************************/ + +void patc() +{ char ps[PATLEN+1]; /* pattern to be search for */ + char *action; /* action with pattern */ + int len = PATLEN; /* length of found pattern; part of ps to be read */ + int current = 0; /* current active patterntree */ + int i, j; /* counters */ + + while(TRUE) + { + /* fill pattern */ + for(i = 0, j = len; j < PATLEN; i++, j++) ps[i] = ps[j]; + for(i = PATLEN - len; i < PATLEN; i++) + { int c = readchar(); + ps[i] = (c == EOF) ? '\0' : c; + } + ps[PATLEN] = '\0'; /* NULL-terminate */ + if(ps[0] == '\0') break; + + /* find action */ + + action = PSTmatch(pat[current].t, ps, &len); + + if(len == 0) + { if(pat[current].r) /* complain */ + fprintf(stderr, "Error: illegal character '%c' near line %d\n", ps[0], linenumber); + else /* copy silently */ + fputc(ps[0], outfile); + len = 1; + } + else /* do action */ + { switch(action[0]) + { case 'p': fputs(&action[1], outfile); break; + case 'c': PUSHBACK(ps); len = PATLEN; copycomment(); break; + case 't': PUSHBACK(ps); len = PATLEN; copytexcommand(); break; + case 'T': PUSHBACK(ps); len = PATLEN; skiptexcommand(); break; + case 's': PUSHBACK(ps); len = PATLEN; skipcomment(); break; + case 'f': /* forget */ break; + case 'e': fprintf(stderr, "Error: %s near line %d\n", &action[1], linenumber); + break; + case 'S': PUSHBACK(ps); len = PATLEN; skiptillchar(action[1]); break; + case 'B': PUSHBACK(ps); len = PATLEN; skiptillmatchingbrace(); break; + case '0': current = 0; fputs(&action[1], outfile); break; + case '1': current = 1; fputs(&action[1], outfile); break; + case '2': current = 2; fputs(&action[1], outfile); break; + case '3': current = 3; fputs(&action[1], outfile); break; + case '4': current = 4; fputs(&action[1], outfile); break; + case '5': current = 5; fputs(&action[1], outfile); break; + case '6': current = 6; fputs(&action[1], outfile); break; + case '7': current = 7; fputs(&action[1], outfile); break; + case '8': current = 8; fputs(&action[1], outfile); break; + case '9': current = 9; fputs(&action[1], outfile); break; + default: fprintf(stderr, "Internal error: unknown action\n"); + exit(10); + } /* switch */ + } /* else */ + } /* while */ + if(current != 0) + fprintf(stderr, "Warning: mode = %d at end of file\n", current); +} /* patc() */ + +/***********************************************************************/ + +void skiptillchar(char c1) +{ char c2; + do + { c2 = readchar(); + if(c2 == EOF) return; + } while(c2 != c1); +} + +void skiptillmatchingbrace() +/* skip a TeX group enclosed in braces. + * next brace on input opens the group to skip + */ +{ int i = 1; + int c; + do + { c = readchar(); + if(c == EOF) return; + } while(c != '{'); + while(i>0) + { c = readchar(); + if(c == '{') i++; + if(c == '}') i--; + if(c == EOF) return; + } +} + +void copytexcommand() +/* copy TeX commmand, including preceding \ + * this will work in plain TeX and LaTeX + */ +{ int c = readchar(); + if(c=='\\') + { fputc(c, outfile); + c = readchar(); + if(isalpha(c)) + { while(isalpha(c)) + { fputc(c, outfile); + c = readchar(); + } + unreadchar(c); + } + else + fputc(c, outfile); + } + else + unreadchar(c); +} + +void skiptexcommand() +/* skip TeX commmand, including preceding \ + * this will work in plain TeX and LaTeX + */ +{ int c = readchar(); + if(c=='\\') + { c = readchar(); + if(isalpha(c)) + { while(isalpha(c)) + { c = readchar(); + } + unreadchar(c); + } + } + else + unreadchar(c); +} + + +void copycomment() +{ int c = readchar(); + if(c=='%') + { while(c != '\n' && c != EOF) + { fputc(c, outfile); + c = readchar(); + } + fputc('\n', outfile); + } + else + unreadchar(c); +} + +void skipcomment() +{ int c = readchar(); + if(c=='%') + { while(c != '\n' && c != EOF) + c = readchar(); + } + else + unreadchar(c); +} + +/***********************************************************************/ +/* file access with buffer */ + +static int fbuffer[BUFSIZE]; /* buffer for file operations */ +static int last = 0; /* last + 1 used in fbuffer */ + +int readchar() +{ int result; + + if(last==0) /* niets in buffer */ + result = fgetc(infile); + else /* pak first uit buffer */ + { last--; + result = fbuffer[last]; + } + if(result == '\n') linenumber++; + return result; +} + +void unreadchar(int c) +{ + if(last == BUFSIZE) + { fprintf(stderr, "%s: push-back file buffer full\n", progname); + exit(1); + } + else /* voeg na last in buffer */ + { fbuffer[last] = c; + last++; + if(c == '\n') linenumber--; + } +} + +/***********************************************************************/ diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.exe b/Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.exe Binary files differnew file mode 100644 index 00000000000..13d56541b6d --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.exe diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.prj b/Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.prj new file mode 100644 index 00000000000..330c52f4071 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.prj @@ -0,0 +1,7 @@ +patc.ttp
+= ; list of modules follows...
+PCSTART.O ; startup code
+patc.c (pstree.h)
+pstree.c (pstree.h)
+PCSTDLIB.LIB ; standard library
+PCTOSLIB.LIB ; TOS library
diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.ttp b/Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.ttp Binary files differnew file mode 100644 index 00000000000..9f2834ac536 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.ttp diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.txt b/Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.txt new file mode 100644 index 00000000000..53e7dea25e8 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.txt @@ -0,0 +1,97 @@ + +patc v1.1b -- a little tool to convert patterns + +Introduction +------------ +patc uses a patfile, in which a set of patterns is specified, +to chance patterns in the input to other patterns in the output, especially +usefull if you want to chance from different transcriptions. + +Usage +----- + + patc [-v] [-p patfile] infile outfile + -v verbose mode + + default patfile: "patc.pat" + +patc is a pattern conversion tool, that changes patterns in the input +into other patterns in the output. It is specificly made for entering +foreign scripts in transcriptions. patc can handle several sets of patterns +in a file at the same time. + +patc scans the text from begin to end for patterns, starting with the first +not yet used character. Whenever patc finds a pattern, it executes the +corresponding action. This can be outputting a string, give an message, +or switch to another set of patterns. When no pattern can be found, +will output the first letter unchanged, and start searching again with the +next letter, or if you want that, it will complain about it. + +The patterns patc can recognize are given in a patfile. A patfile consists +of lines, that can be empty (white space or comment), contain a command, or +a pattern with its corresponding action. + +Comment lines start with %, command lines with an @ and a pattern line +with a ". Every line can end with comment. + +Commands: + @patterns # definition of patterns in set # follows + @rpatterns # definition of patterns in set # follows. + if a pattern cannot be found in the input, this + will generate an error message. + @end end of patfile + +A pattern line consists of the pattern inbetween double quotes, an +action opcode, and optionally a string in between codes as an argument. + +Actions: + p string output string + # string output string, use pattern set # from now on. + e string give error message string, forget this pattern. + f forget this pattern (silently) + s skip until end of line (including this patten) + S string skip till first char of string + B skip till closing brace, matching braces) + c copy until end of line (including this patten) + t copy a TeX command + T skip a TeX command + +In strings and patterns the following escape codes can be used: + + \t tab + \n newline + \" double quote + \\ backslash + \b backspace + \xxx character xxx octal + \dxxx character xxx decimal + \hxx character xx hexadecimal + +Do _not_ use character \000 ! + +Warning +------- +Don't give patterns in alfabetic order. The algorithm used will show its +worse case performance then. + +Wishes for future versions +-------------------------- +* Include meta-characters, as to decrease the number of patterns. + Proposed syntax: + @META \C "b" "c" "d" "f" ... consonants + @META \V "a" "e" "i" "o" ... vowels + This is quite difficult, and requires a rethink of the underlying + data structures, so it will take some time. Any volunteer? +* Make it count. (easy too) +* More actions. + +Author +------ +Jeroen Hellingman. <jhelling@cs.ruu.nl> +'t Zand 2, 4133 TB Vianen, The Netherlands + +Copyright & disclaimer +---------------------- +This program may be used, copied, and distributed by anyone who feels the +need, but it is copyrighted by me. This is offered free as it is, I do not +accept any responseability when it does not do what you want it to do. diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/patc/pstree.c b/Master/texmf-dist/source/fonts/malayalam/preproc/patc/pstree.c new file mode 100644 index 00000000000..fa7cb8c21d0 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/patc/pstree.c @@ -0,0 +1,223 @@ +/*+ + +NAME: PSTree.c --- Pattern Search Tree + +AUTHOR: Jeroen Hellingman + + PSTree is een verzameling routines om snel patronen in een + multi-branch tree op te slaan en terug te vinden, zoals gebruikt + worden voor bijvoorbeeld spellingscheckers. Bij elk patroon + kunnen we een string opslaan. + + De worden worden letter voor letter opgeslagen in de nodes + van de boom, waarbij de eerste node alle eerste letters, + bevat, en de tweede node voor elk van die letters, de tweede + letters van woorden die met die letter beginnen. Elke node + opzich is ook weer opgebouwd als een boom. + + Per letter gebruikt deze structuur vier pointers en een + character geheugen ruimte (op een 68000 17 bytes), maar + als het woord 'automatisch' al is opgeslagen, hoeven we + maar een extra letter te bewaren om 'automatische' op te + slaan. + + Op deze structuur hebben we de volgende operaties: + + int PSTinsert(PSTree **tree, char *pattern, char *action); + voeg pattern met action toe aan tree, *tree kan NULL zijn, + en zal dan veranderen, resultaat: TRUE als succes, FALSE + anders + + int PSTretract(PSTree **tree, char *pattern); + Nog niet geimplementeerd + + char *PSTmatch(PSTree *tree, const char *pattern, int *length); + vind de langste match beginnend bij de pattern[0] van pattern + met een patroon in tree, resultaat: de actie bij dat patroon, + NULL als geen actie gevonden, length bevat na afloop de lengte + van het gematchte patroon, of 0 als geen patroon is gevonden. + +HISTORY: + 05-FEB-1992 Creation + +-*/ + +#define TEST (0) + +#include <stddef.h> +#include <stdlib.h> +#include <stdio.h> + +#include "PSTree.h" + +#define TRUE (1) +#define FALSE (0) + +/* private operations */ + +PSTree *PSTfindelement(PSTree *t, char c); +PSTree *PSTfindinsertelement(PSTree **t, char c); +void PSTpmatch(PSTree *tree, const char *pattern, char **action, int *length, int depth); + +/* insert: insert p into the pattern tree: + TRUE: success + FALSE: failure (already available pattern, failure to allocate cell); +*/ + +int PSTinsert(PSTree **t, char *p, char *a) +{ PSTree *first = NULL; + + if(t == NULL || p == NULL || p[0] == '\0') /* sanity check */ + return FALSE; + + first = PSTfindinsertelement(t, p[0]); + if(first == NULL) /* element could not be added/inserted in PSTree? */ + return FALSE; + + if(p[1] == '\0') /* p[0] last element of pattern? */ + { if(first->a == NULL) /* no action assigned yet */ + { first->a = a; + return TRUE; + } + else /* i.e. pattern already in tree */ + { return FALSE; + } + } + else /* not last element in pattern: insert rest of pattern */ + return PSTinsert(&(first->n), &p[1], a); +} + + +/* PSTfindinsertelement: search for element c, return its node + if it can be found, create a new node with element c and all + pointers at NULL otherwise, and return it. + return NULL at failure. +*/ + +static PSTree *PSTfindinsertelement(PSTree **t, char c) +{ + if(t == NULL) /* sanity check */ + return NULL; + + if(*t == NULL) /* empty tree: create new node */ + { *t = malloc(sizeof(PSTree)); + if(*t == NULL) /* malloc failed */ + return FALSE; + (*t)->e = c; + (*t)->l = NULL; + (*t)->r = NULL; + (*t)->n = NULL; + (*t)->a = NULL; + return *t; + } + else + { if((*t)->e == c) /* we found it */ + return *t; + else if((*t)->e < c) /* then go left */ + return PSTfindinsertelement(&((*t)->l), c); + else /* go right */ + return PSTfindinsertelement(&((*t)->r), c); + } +} + +/* PSTfindelement: search for element c, return its node + if it can be found return NULL at otherwise. +*/ + +static PSTree *PSTfindelement(PSTree *t, char c) +{ + if(t == NULL) /* empty tree */ + return NULL; + else + { if(t->e == c) /* we found it */ + return t; + else if(t->e < c) /* then go left */ + return PSTfindelement(t->l, c); + else /* go right */ + return PSTfindelement(t->r, c); + } +} + +char *PSTmatch(PSTree *t, const char *p, int *length) +{ char *action = NULL; + *length = 0; + PSTpmatch(t, p, &action, length, 1); + return action; +} + +/* remember recursion depth to determine length of match */ + +static void PSTpmatch(PSTree *t, const char *p, char **action, int *length, int depth) +{ PSTree *first = NULL; + + if(t == NULL || p == NULL || p[0] == '\0') /* sanity check */ + return; + + first = PSTfindelement(t, p[0]); + if(first == NULL) /* element not found in PSTree? */ + return; + + if(first->a != NULL) /* action for pattern so-far? */ + { *length = depth; + *action = first->a; + } + + PSTpmatch(first->n, &p[1], action, length, depth + 1); +} + + +#if TEST + +void PSTshow(PSTree *t) +{ + if(t == NULL) + printf("(null)\n"); + else + { putchar(t->e); + if(t->a != NULL) + { putchar('['); + printf("%s", t->a); + putchar(']'); + } + PSTshow(t->n); + putchar('L'); PSTshow(t->l); + putchar('R'); PSTshow(t->r); + } +} + + +void main() +{ + + char *actie = NULL; + int len = 0; + + PSTree *t = NULL; + PSTinsert(&t, "aap", "1"); + PSTinsert(&t, "appel", "2"); + PSTinsert(&t, "aapjes", "3"); + PSTinsert(&t, "koe", "4"); + PSTinsert(&t, "kokosnoot", "5"); + PSTinsert(&t, "akker", "6"); + PSTshow(t); puts("------------"); getchar(); + + actie = PSTmatch(t, "aapjesverhaal", &len); + if(actie != NULL) { printf("actie: (%s) lengte: %d\n", actie, len); } + + actie = PSTmatch(t, "aapjelief", &len); + if(actie != NULL) { printf("actie: (%s) lengte: %d\n", actie, len); } + + actie = PSTmatch(t, "appelboom", &len); + if(actie != NULL) { printf("actie: (%s) lengte: %d\n", actie, len); } + + actie = PSTmatch(t, "aster", &len); + if(actie != NULL) { printf("actie: (%s) lengte: %d\n", actie, len); } + else { printf("actie: NULL lengte: %d\n", actie, len); } + + exit(0); + +} + +#endif /* TEST */ + +/* end of PSTree.c */ diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/patc/pstree.h b/Master/texmf-dist/source/fonts/malayalam/preproc/patc/pstree.h new file mode 100644 index 00000000000..f5c4fc4ec95 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/patc/pstree.h @@ -0,0 +1,13 @@ +typedef struct PSTree +{ char e; /* element in this node */ + struct PSTree *l; /* left branch of PSTree */ + struct PSTree *r; /* right branch of PSTree */ + struct PSTree *n; /* PSTree for next element in pattern */ + char *a; /* Action with pattern that ends here */ +} PSTree; + +/* public operations */ + +int PSTinsert(PSTree **tree, char *pattern, char *action); +int PSTretract(PSTree **tree, char *pattern); +char *PSTmatch(PSTree *tree, const char *pattern, int *length); diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/pstree.c b/Master/texmf-dist/source/fonts/malayalam/preproc/pstree.c new file mode 100644 index 00000000000..31bc0690f3e --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/pstree.c @@ -0,0 +1,225 @@ +/*+ + +NAME: PSTree.c --- Pattern Search Tree + +AUTHOR: Jeroen Hellingman + + PSTree is een verzameling routines om snel patronen in een + multi-branch tree op te slaan en terug te vinden, zoals gebruikt + worden voor bijvoorbeeld spellingscheckers. Bij elk patroon + kunnen we een string opslaan. + + De worden worden letter voor letter opgeslagen in de nodes + van de boom, waarbij de eerste node alle eerste letters, + bevat, en de tweede node voor elk van die letters, de tweede + letters van woorden die met die letter beginnen. Elke node + opzich is ook weer opgebouwd als een boom. + + Per letter gebruikt deze structuur vier pointers en een + character geheugen ruimte (op een 68000 17 bytes), maar + als het woord 'automatisch' al is opgeslagen, hoeven we + maar een extra letter te bewaren om 'automatische' op te + slaan. + + Op deze structuur hebben we de volgende operaties: + + int PSTinsert(PSTree **tree, char *pattern, char *action); + voeg pattern met action toe aan tree, *tree kan NULL zijn, + en zal dan veranderen, resultaat: TRUE als succes, FALSE + anders + + int PSTretract(PSTree **tree, char *pattern); + Nog niet geimplementeerd + + char *PSTmatch(PSTree *tree, const char *pattern, int *length); + vind de langste match beginnend bij de pattern[0] van pattern + met een patroon in tree, resultaat: de actie bij dat patroon, + NULL als geen actie gevonden, length bevat na afloop de lengte + van het gematchte patroon, of 0 als geen patroon is gevonden. + +HISTORY: + 18-DEC-1992 Last edit (JH) + 05-NOV-1992 declared static functions static in prototype (JH) + 05-FEB-1992 Creation (Jeroen Hellingman) + +-*/ + +#define TEST (0) + +#include <stddef.h> +#include <stdlib.h> +#include <stdio.h> + +#include "pstree.h" + +#define TRUE (1) +#define FALSE (0) + +/* private operations */ + +static PSTree *PSTfindelement(PSTree *t, char c); +static PSTree *PSTfindinsertelement(PSTree **t, char c); +static void PSTpmatch(PSTree *tree, const char *pattern, char **action, int *length, int depth); + +/* insert: insert p into the pattern tree: + TRUE: success + FALSE: failure (already available pattern, failure to allocate cell); +*/ + +int PSTinsert(PSTree **t, char *p, char *a) +{ PSTree *first = NULL; + + if(t == NULL || p == NULL || p[0] == '\0') /* sanity check */ + return FALSE; + + first = PSTfindinsertelement(t, p[0]); + if(first == NULL) /* element could not be added/inserted in PSTree? */ + return FALSE; + + if(p[1] == '\0') /* p[0] last element of pattern? */ + { if(first->a == NULL) /* no action assigned yet */ + { first->a = a; + return TRUE; + } + else /* i.e. pattern already in tree */ + { return FALSE; + } + } + else /* not last element in pattern: insert rest of pattern */ + return PSTinsert(&(first->n), &p[1], a); +} + + +/* PSTfindinsertelement: search for element c, return its node + if it can be found, create a new node with element c and all + pointers at NULL otherwise, and return it. + return NULL at failure. +*/ + +static PSTree *PSTfindinsertelement(PSTree **t, char c) +{ + if(t == NULL) /* sanity check */ + return NULL; + + if(*t == NULL) /* empty tree: create new node */ + { *t = malloc(sizeof(PSTree)); + if(*t == NULL) /* malloc failed */ + return FALSE; + (*t)->e = c; + (*t)->l = NULL; + (*t)->r = NULL; + (*t)->n = NULL; + (*t)->a = NULL; + return *t; + } + else + { if((*t)->e == c) /* we found it */ + return *t; + else if((*t)->e < c) /* then go left */ + return PSTfindinsertelement(&((*t)->l), c); + else /* go right */ + return PSTfindinsertelement(&((*t)->r), c); + } +} + +/* PSTfindelement: search for element c, return its node + if it can be found return NULL at otherwise. +*/ + +static PSTree *PSTfindelement(PSTree *t, char c) +{ + if(t == NULL) /* empty tree */ + return NULL; + else + { if(t->e == c) /* we found it */ + return t; + else if(t->e < c) /* then go left */ + return PSTfindelement(t->l, c); + else /* go right */ + return PSTfindelement(t->r, c); + } +} + +char *PSTmatch(PSTree *t, const char *p, int *length) +{ char *action = NULL; + *length = 0; + PSTpmatch(t, p, &action, length, 1); + return action; +} + +/* remember recursion depth to determine length of match */ + +static void PSTpmatch(PSTree *t, const char *p, char **action, int *length, int depth) +{ PSTree *first = NULL; + + if(t == NULL || p == NULL || p[0] == '\0') /* sanity check */ + return; + + first = PSTfindelement(t, p[0]); + if(first == NULL) /* element not found in PSTree? */ + return; + + if(first->a != NULL) /* action for pattern so-far? */ + { *length = depth; + *action = first->a; + } + + PSTpmatch(first->n, &p[1], action, length, depth + 1); +} + + +#if TEST + +void PSTshow(PSTree *t) +{ + if(t == NULL) + printf("(null)\n"); + else + { putchar(t->e); + if(t->a != NULL) + { putchar('['); + printf("%s", t->a); + putchar(']'); + } + PSTshow(t->n); + putchar('L'); PSTshow(t->l); + putchar('R'); PSTshow(t->r); + } +} + + +void main() +{ + + char *actie = NULL; + int len = 0; + + PSTree *t = NULL; + PSTinsert(&t, "aap", "1"); + PSTinsert(&t, "appel", "2"); + PSTinsert(&t, "aapjes", "3"); + PSTinsert(&t, "koe", "4"); + PSTinsert(&t, "kokosnoot", "5"); + PSTinsert(&t, "akker", "6"); + PSTshow(t); puts("------------"); getchar(); + + actie = PSTmatch(t, "aapjesverhaal", &len); + if(actie != NULL) { printf("actie: (%s) lengte: %d\n", actie, len); } + + actie = PSTmatch(t, "aapjelief", &len); + if(actie != NULL) { printf("actie: (%s) lengte: %d\n", actie, len); } + + actie = PSTmatch(t, "appelboom", &len); + if(actie != NULL) { printf("actie: (%s) lengte: %d\n", actie, len); } + + actie = PSTmatch(t, "aster", &len); + if(actie != NULL) { printf("actie: (%s) lengte: %d\n", actie, len); } + else { printf("actie: NULL lengte: %d\n", actie, len); } + + exit(0); + +} + +#endif /* TEST */ + +/* end of PSTree.c */ diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/pstree.h b/Master/texmf-dist/source/fonts/malayalam/preproc/pstree.h new file mode 100644 index 00000000000..8b2677c06b1 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/pstree.h @@ -0,0 +1,19 @@ +#ifndef PSTREE_HEADER_READ +#define PSTREE_HEADER_READ + +typedef struct PSTree +{ char e; /* element in this node */ + struct PSTree *l; /* left branch of PSTree */ + struct PSTree *r; /* right branch of PSTree */ + struct PSTree *n; /* PSTree for next element in pattern */ + char *a; /* Action with pattern that ends here */ +} PSTree; + +/* public operations */ + +int PSTinsert(PSTree **tree, char *pattern, char *action); +int PSTretract(PSTree **tree, char *pattern); +char *PSTmatch(PSTree *tree, const char *pattern, int *length); + +#endif +/* eof */
\ No newline at end of file diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/readfile.c b/Master/texmf-dist/source/fonts/malayalam/preproc/readfile.c new file mode 100644 index 00000000000..5bcb01b32c5 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/readfile.c @@ -0,0 +1,281 @@ +/* + +readfile.c -- read a command file + +get lines from a file, split up into "words", separated by spaces +skip whitespace and comments, treats strings as a unit, interpretes +C-like escape codes + +@ starts command +% starts comment +\ starts escape code +" starts and ends string + +everything before the first command is considered comment, +everything after @end also + +HISTORY: + 19-NOV-1992 restructuring of program (JH) + 22-JUL-1992 removed bug causing COMMENTCHAR in string to be interpreted (JH) + +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + +#include "readfile.h" + +static char *read_line(FILE *f, char *s, int n); +static char *read_cline(FILE *f, char *s, int n); +static char *strlow(char *s); +static string_list *make_string_list(char *s); +static void skip_spaces(FILE *f); +static void skip_line(FILE *f); +static int getword(char *s, char *d); +static int getquotedstring(const char *s, char *d); +static int what_escape(const char *s, char *result); +static string_list *get_cline(FILE *f); + +/********/ + +char *get_command(FILE *f, char *command, string_list **rest) +{ + string_list *l; + /* get first line starting with "@" */ + do + { l = get_cline(f); + if(l == NULL) + { return NULL; + } + } + while(l->s[0] != COMMANDCHAR); + + strcpy(command, &(l->s)[1]); + strlow(command); + *rest = l->n; + free(l); + return command; +} + +static char *strlow(char *s) +{ char *t = s; + while(*t!='\0') { *t = tolower(*t); t++; } + return s; +} + +static string_list *get_cline(FILE *f) +{ char buffer[BUFSIZE], *s = buffer; + s = read_cline(f, s, BUFSIZE); + return make_string_list(s); +} + +string_list *get_line(FILE *f) +{ char buffer[BUFSIZE], *s = buffer; + s = read_line(f, s, BUFSIZE); + return make_string_list(s); +} + +static string_list *make_string_list(char *s) +{ + char d[BUFSIZE]; + int i = 0; + string_list *result = NULL; + string_list **previous = &result; + string_list *current = NULL; + int empty_quoted_string; + + /* break line up into words */ + do + { empty_quoted_string = FALSE; + while(isspace(s[i]) && s[i] != '\0' && s[i] != COMMENTCHAR) i++; + if(s[i] == COMMENTCHAR) break; + if(s[i] == '"') + { i += getquotedstring(&s[i], d); + if(d[0]=='\0') empty_quoted_string = TRUE; + } + else i += getword(&s[i], d); + if(d[0] != '\0' || empty_quoted_string) + { /* insert at end in string list */ + long len; + *previous = current = (string_list*)malloc(sizeof(string_list)); + if(current==NULL){fprintf(stderr,"can't allocate");exit(1);} + current->n = NULL; + len = strlen(d); + len = (len==0) ? 1 : len; + current->s = (char*)malloc(len); + if(current->s==NULL){fprintf(stderr,"can't allocate");exit(1);} + strcpy(current->s, d); + previous = &(current->n); + } + } + while(s[i] != '\0' && i < BUFSIZE); + return result; +} + + +static char *read_cline(FILE *f, char *s, int n) +/* read until <EOF> or <NL> */ +{ + int c; + int i = 0; + + skip_spaces(f); + do + { c=getc(f); + s[i++] = (char)c; + if(i>=n) + { fprintf(stderr, "buffer full, skipping rest of line\n"); + skip_line(f); + break; + } + } + while (c != EOF && c!= '\n'); + s[--i]='\0'; + + return s; +} + +static char *read_line(FILE *f, char *s, int n) +/* read until <EOF>, COMMANDCHAR or <NL> */ +{ + int c; + int i = 0; + + skip_spaces(f); + do + { c=getc(f); + s[i++] = (char)c; + if(i>=n) + { fprintf(stderr, "buffer full, skipping rest of line\n"); + skip_line(f); + break; + } + if(i == 1 && c==COMMANDCHAR) + { ungetc(c, f); + s[0] = '\0'; + return s; + } + } + while (c != EOF && c!= '\n'); + s[--i]='\0'; + + return s; +} + +static void skip_spaces(FILE *f) +/* skip white space and comment */ +{ int c; + do + { c=getc(f); + while(c==COMMENTCHAR) { skip_line(f); c = getc(f); } + } + while(isspace(c) || c == '\n'); + ungetc(c, f); +} + +static void skip_line(FILE *f) +/* skip until <NL> */ +{ int c; + do { c=getc(f); } while(c != EOF && c != '\n'); +} + +static int getword(char *s, char *d) +{ int i = 0, j = 0; + while(isspace(s[i]) && s[i] != '\0') i++; + while(!isspace(s[i]) && s[i] != '\0') { d[j] = s[i]; j++; i++; } + d[j] = '\0'; + return i; +} + +static int getquotedstring(const char *s, char *d) +{ int i = 0; /* no of chars read in source */ + int j = 0; /* no of chars inserted in destination */ + while(isspace(s[i]) && s[i] != '\0') i++; + + if(s[i] == '"') + { i++; + while(s[i] != '"') + { if(s[i] == '\\') /* escape char */ + i += what_escape(&s[i], &d[j]); + else + { d[j] = s[i]; + } + j++; i++; + } + } + d[j] = '\0'; /* NULL-terminate */ + i++; /* skip final " */ + return i; +} + +/* Find out what escape sequence is used. If non can be found, we just + forget about the backslash. Interprete numbers up to 255/177/FF +*/ + +#define UNSIGNED(t) (char)(((t) < 0) ? (t) + 256 : (t)) + +static int what_escape(const char *s, char *result) +{ int i = 1; /* length of escape sequence read */ + int ok = TRUE; + int t = 0; /* temporary result */ + + switch(s[1]) + { case '"': *result = '"'; break; + case '\\': *result = '\\'; break; + case 't': *result = '\t'; break; + case 'n': *result = '\n'; break; + case 'b': *result = '\b'; break; + case 'h': /* hexadecimal */ + while(i < 3 && ok) + { i++; + if(s[i]>='0' && s[i]<='9') t = t * 16 + (s[i] - '0'); + else if(s[i]>='A' && s[i]<='F') t = t * 16 + (s[i] - 'A') + 10; + else if(s[i]>='a' && s[i]<='f') t = t * 16 + (s[i] - 'a') + 10; + else + { if(i==2) /* no number after \h */ + *result = 'h'; + else /* short number after \h */ + *result = UNSIGNED(t); + i--; + ok = FALSE; + } + } + if(ok) *result = UNSIGNED(t); + break; + case 'd': /* decimal */ + while(i < 4 && ok) + { i++; + if(s[i]>='0' && s[i]<='9') t = t * 10 + (s[i] - '0'); + else + { if(i==2) /* no number after \d */ + *result = 'd'; + else /* short number after \d */ + *result = UNSIGNED(t); + i--; + ok = FALSE; + } + } + if(ok) *result = UNSIGNED(t); + break; + default: /* try octal interpretation */ + i--; + while(i < 3 && ok) + { i++; + if(s[i]>='0' && s[i]<='7') t = t * 8 + (s[i] - '0'); + else + { if(i==1) /* no number after \ */ + *result = s[i]; + else /* short number after \ */ + { *result = UNSIGNED(t); + i--; + } + ok = FALSE; + } + } + if(ok) *result = UNSIGNED(t); + } + return i; +} + diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/readfile.h b/Master/texmf-dist/source/fonts/malayalam/preproc/readfile.h new file mode 100644 index 00000000000..605d6fa3c9a --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/readfile.h @@ -0,0 +1,21 @@ +#ifndef READFILE_HEADER_READ +#define READFILE_HEADER_READ + +#define TRUE (1==1) +#define FALSE (1==0) +#define BUFSIZE 1024 +#define COMMANDCHAR '@' +#define COMMENTCHAR '%' + +typedef struct string_list +{ char *s; + struct string_list *n; +} string_list; + +/* public operations */ + +string_list *get_line(FILE *f); +char *get_command(FILE *f, char *command, string_list **rest); + +#endif +/* eof */ diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/scr.c b/Master/texmf-dist/source/fonts/malayalam/preproc/scr.c new file mode 100644 index 00000000000..7a323e9e372 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/scr.c @@ -0,0 +1,185 @@ +/* + +scr.c -- read script table from file + +History: + 26-APR-1993 changed directory structure of source files (JH) + 24-DEC-1992 added ability to look in directory given by home + 08-OCT-1992 added support for at{end|begin}syllabe (JH) + 21-JUL-1992 added support for reepham (JH) + 06-JUL-1992 Genesis (Jeroen Hellingman) + +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "scr.h" +#include "mm.h" + +extern char *progname; +extern int verbose; + +static AVLtree *read_prebuild(FILE *f); +static AVLtree *read_table(FILE *f); + + +scr_table *read_scr(char *filename) +{ int stop = FALSE; + char b[BUFSIZE]; + char *command=b; + string_list *rest=NULL; + scr_table *result = NULL; + FILE *f; + + f = fopen(filename, "r"); + if(f==NULL) + { filename = prepend_home(filename); + f = fopen(filename, "r"); + if(f==NULL) + { fprintf(stderr, "%s: can't open %s\n", progname, filename); + exit(1); + } + } + if(verbose) printf("reading script definition from %s\n", filename); + + result=malloc(sizeof(scr_table)); + if(result==NULL){fprintf(stderr,"can't allocate\n");exit(0);} + + result->prebuild = NULL; + result->primary = NULL; + result->secondary = NULL; + result->atbegin = NULL; + result->atend = NULL; + result->atbeginsyllabe = ""; + result->atendsyllabe = ""; + result->reepham = FALSE; + + get_command(f, command, &rest); + if(strcmp(command, "malayalam")!=0) + { fprintf(stderr, "%s: script type is not malayalam\n", progname); + exit(0); + } + result->script_type = MALAYALAM_SCRIPT; + + while(!stop) + { get_command(f, command, &rest); + if(command == NULL || strcmp(command, "end")==0) + { if(result->prebuild == NULL || + result->atbegin == NULL || + result->atend == NULL) + { fprintf(stderr, "%s: invalid script file &s:\n", progname, filename); + if(result->prebuild == NULL) + fprintf(stderr, "no @prebuild given\n"); + if(result->atbegin == NULL) + fprintf(stderr, "no @atbegin given\n"); + if(result->atend == NULL) + fprintf(stderr, "no @atend given\n"); + exit(1); + } + stop = TRUE; + } + else /* handle commmands */ + { if(strcmp(command, "atbegin")==0) + result->atbegin = rest->s; + else + { if(strcmp(command, "atend")==0) + result->atend = rest->s; + else + { if(strcmp(command, "prebuild")==0) + result->prebuild = read_prebuild(f); + else + { if(strcmp(command, "primary")==0) + result->primary = read_table(f); + else + { if(strcmp(command, "secondary")==0) + result->secondary = read_table(f); + else + { if(strcmp(command, "reepham")==0) + result->reepham = TRUE; + else + { if(strcmp(command, "atbeginsyllabe")==0) + result->atbeginsyllabe = rest->s; + else + { if(strcmp(command, "atendsyllabe")==0) + result->atendsyllabe = rest->s; + else + { fprintf(stderr, "unknown command @%s ignored\n", command); + } + }}}}}}}} + } + return result; +} + +prebuild_char *new_prebuild_char(char *c, char *g) +{ prebuild_char *result = NULL; + + result = malloc(sizeof(prebuild_char)); + if(result==NULL){fprintf(stderr,"can't allocate\n");exit(0);} + + result->c = c; + result->g = g; + + return result; +} + +int cmp_prebuild_char(void *a, void *b) +{ return strcmp(((prebuild_char*)a)->c, ((prebuild_char*)b)->c); +} + +static AVLtree *read_prebuild(FILE *f) +{ AVLtree *result = NULL; + string_list *l; + + while((l = get_line(f)) != NULL) + { + if(l->n==NULL) + { fprintf(stderr, "incomplete line\n"); + } + else + { prebuild_char *p = new_prebuild_char(l->s, l->n->s); + AVLinsert(p, &result, cmp_prebuild_char); + } + } + return result; +} + +glyph_pair *new_glyph_pair(char *c, char *b, char *a) +{ glyph_pair *result = NULL; + + result = malloc(sizeof(glyph_pair)); + if(result==NULL){fprintf(stderr,"can't allocate\n");exit(0);} + + result->c = c; + result->b = b; + result->a = a; + + return result; +} + +int cmp_glyph_pair(void *a, void *b) +{ return strcmp(((glyph_pair*)a)->c, ((glyph_pair*)b)->c); +} + +static AVLtree *read_table(FILE *f) +{ AVLtree *result = NULL; + string_list *l; + + while((l = get_line(f)) != NULL) + { + if(l->n==NULL || l->n->n == NULL) + { fprintf(stderr, "incomplete line\n"); + } + else + { glyph_pair *p = new_glyph_pair(l->s, l->n->s, l->n->n->s); + AVLinsert(p, &result, cmp_glyph_pair); + } + } + return result; +} + + + + + diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/scr.h b/Master/texmf-dist/source/fonts/malayalam/preproc/scr.h new file mode 100644 index 00000000000..416240d3067 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/scr.h @@ -0,0 +1,39 @@ + +#ifndef SCR_HEADER_READ +#define SCR_HEADER_READ + +#include "avltree.h" +#include "readfile.h" + +#define MALAYALAM_SCRIPT 13 + +typedef struct +{ int script_type; + AVLtree *prebuild; /* AVLtree of prebuild_chars, defining pre-build syllabes */ + AVLtree *primary; /* AVLtree of glyph_pairs, defining front and final part of primary variants */ + AVLtree *secondary; /* AVLtree of glyph_pairs, defining front and final part of secondary variants */ + char *atbegin; + char *atend; + char *atbeginsyllabe; + char *atendsyllabe; + int reepham; /* boolean: do we use the reepham? */ +} scr_table; + +typedef struct +{ char *c; /* char codes */ + char *g; /* glyphs */ +} prebuild_char; + +typedef struct +{ char *c; /* char codes */ + char *b; /* glyphs to place before syllabe in construction */ + char *a; /* glyphs to place after syllabe in construction */ +} glyph_pair; + +/* public functions */ + +scr_table *read_scr(char *filename); + +#endif + +/* eof */ diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/trs.c b/Master/texmf-dist/source/fonts/malayalam/preproc/trs.c new file mode 100644 index 00000000000..4805c35079a --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/trs.c @@ -0,0 +1,148 @@ +/* + +trs.c -- read transcription table from file + +History: + 24-DEC-1992 added ability to look in directory given by home + 06-JUL-1992 Genesis (Jeroen Hellingman) + +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "readfile.h" +#include "trs.h" +#include "mm.h" + +extern char *progname; +extern int verbose; + +static PSTree *read_table(FILE *f); + +trs_table *read_trs(char *filename) +{ int stop = FALSE; + char b[BUFSIZE]; + char *command=b; + string_list *rest=NULL; + trs_table *result = NULL; + FILE *f; + + f = fopen(filename, "r"); + if(f==NULL) + { filename = prepend_home(filename); + f = fopen(filename, "r"); + if(f==NULL) + { fprintf(stderr, "%s: can't open %s\n", progname, filename); + exit(1); + } + } + if(verbose) printf("reading transcription from %s\n", filename); + + result=malloc(sizeof(trs_table)); + if(result==NULL){fprintf(stderr,"can't allocate\n");exit(0);} + + while(!stop) + { get_command(f, command, &rest); + if(command == NULL || strcmp(command, "end")==0) + { if(result->p == NULL || + result->atbegin == NULL || + result->atend == NULL) + { fprintf(stderr, "%s: invalid transcription file &s:\n", progname, filename); + if(result->p == NULL) + fprintf(stderr, "no @table given\n"); + if(result->atbegin == NULL) + fprintf(stderr, "no @atbegin given\n"); + if(result->atend == NULL) + fprintf(stderr, "no @atend given\n"); + exit(1); + } + stop = TRUE; + } + else + { if(strcmp(command, "atbegin")==0) + result->atbegin = rest; + else + { if(strcmp(command, "atend")==0) + result->atend = rest; + else + { if(strcmp(command, "table")==0) + result->p = read_table(f); + } + } + } + } + return result; +} + +static PSTree *read_table(FILE *f) +{ PSTree *result = NULL; + string_list *l, *n; + char *pattern; + char b[BUFSIZE]; + char *action = b; + char *tmp = NULL; + int i = 1; /* length of action string */ + int no_parameters; + + while(TRUE) + { int ignore = FALSE; + l = get_line(f); + if(l==NULL) + return result; + else + { + /* pattern at position 1 */ + pattern = l->s; + n = l->n; + free(l); + if(n==NULL) + { fprintf(stderr, "incomplete line\n"); + ignore = TRUE; + } + else + { /* command pattern at position 2 */ + action[0] = (n->s)[0]; /* single letter commands */ + action[1] = '\0'; /* NULL terminate */ + switch(action[0]) + { case 'f': + case 't': + case 's': no_parameters = 0; break; + default : no_parameters = 1; + } + /* parameters pattern at position 3 */ + while(no_parameters > 0) + { no_parameters--; + l = n->n; + free(n); + n = l; + if(l==NULL) + { fprintf(stderr, "incomplete line\n"); + ignore = TRUE; + break; + } + else + { if (++i >= BUFSIZE) + { fprintf(stderr, "line too long\n"); + ignore = TRUE; + break; + } + if ((i+=(int)strlen(l->s)) >= BUFSIZE) + { fprintf(stderr, "line too long\n"); + ignore = TRUE; + break; + } + action = strcat(action, l->s); + } + } + } + } + if(!ignore) + { tmp = malloc(strlen(action)); + if(tmp==NULL){fprintf(stderr,"can't allocate\n");exit(1);} + strcpy(tmp, action); + PSTinsert(&result, pattern, tmp); + } + } +} diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/trs.h b/Master/texmf-dist/source/fonts/malayalam/preproc/trs.h new file mode 100644 index 00000000000..ce5b29932f9 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/trs.h @@ -0,0 +1,18 @@ + +#ifndef TRS_HEADER_READ +#define TRS_HEADER_READ + +#include "pstree.h" +#include "readfile.h" + +typedef struct +{ PSTree *p; + string_list *atbegin; + string_list *atend; +} trs_table; + +/* public operations */ + +trs_table *read_trs(char *filename); + +#endif diff --git a/Master/texmf-dist/source/fonts/malayalam/preproc/unicode/UNICODE.TXT b/Master/texmf-dist/source/fonts/malayalam/preproc/unicode/UNICODE.TXT new file mode 100644 index 00000000000..a86da65dd77 --- /dev/null +++ b/Master/texmf-dist/source/fonts/malayalam/preproc/unicode/UNICODE.TXT @@ -0,0 +1,161 @@ + +Subject: UNICODE-tools/SGML for language tagging in UNICODE + + +Since I am trying to process several languages in TeX at the same +time, and getting a bit fed up of several preprocessors, etc. +I want to make one universal, table driven pre-processor in awaitance of +a TeX that really handles things correctly. I also want to have +it produce Unicode files so that I have a good standard for storage, file +exchange, editing, and so on. + +I think (dream?) of some tools to help me in this work. + +transcribe + translate to/from transcription in ASCII to Unicode + given some transcription tables for the languages/scripts + used in the document. It should do much more than placing 00 in front + of every byte, also in English. It should replace quotes, dashes + etc for the correct signs, interprete TeX commands for accented + letters, and so on. +pretex + pre-process a unicode file for TeX, given some script tables + that describe the scripts used as it is encoded in a TeX-font +sorttext + sort a unicode file according to the rules of a given language, + on a line by line or paragraph by paragraph base. +atou + create `unicode' files by placing 00 in front of every byte. +utoa + create `ascii' files by stripping MS-byte. + + +In the original files I create (in ASCII), I want to tag the text with +SGML-style tags indicating the languages used. Transcribe reads +this and translates my transcription to appropriate Unicode characters. +(Including replacing TeX commands for accented letters for appropriate +accents/accented characters in Unicode.) Given a transcript file for +that language. +A transcript file includes a list of letters and their UNICODE-values +It knows how to handle the syllabic nature of the script, although it is +transcribed in an alphabetic script. +The default language is english (but not english.american). + +Need to decide on file formats and contents of transcript files + +I can sort the resulting files with sorttext, given a sort-key for a +certain language. + +Need to decide on file formats and contents of sort-key files + +I can pre-process the files for TeX with pretex, which will turn the files +into ASCII again, but places codes for glyphs and font changes as +neccessary for non-latin scripts, as indicated in the script file. +For latin languages it could take care of all kinds of conventions, like the +use of ligatures, hypenation, spacing after sentencesm etc. The tags could be +used by spell checkers. + +Need to decide on file formats and contents of script files (defining +context dependent behaviour of characters, locations of glyphs in fonts, +etc.) + +---- + +SGML-style Language tags in UNICODE + +how to? (are the indicators floating marks or block formers?) + +<malayalam>Malayalam text</malayalam> +<block language=malayalam>Malayalam text</block> + +it will keep those language-markers in the UNICODE file. + +known languages: (languages are sometimes known in several dialects or +otherwish variations, I suggest some kind of standard here) + +dutch +english +english.american +english.phonetic +french +german +german.fractur +hindi +hindi.transcription +bahasa-indonesia +malay +malay.arabic +malayalam +malayalam.traditional +malayalam.transcription +marathi +sanskrit +sanskrit.transcription +urdu + +unknown +unknown.transcribed + +---- + +UNICODE representation of Malayalam + +U+0D00 -- U+0D7F + +structure assumed in parsing: + +vowel +consonant +vowel-sign +virama +diacritic +joiner +non-joiner +other + +syntax: + +primary ::== ( <consonant> | <vowel> ) [diacritic] +secondary ::== ( <vowel-sign> | <virama> ) [diacritic] +consonant-cluster ::== <primary> { [<join>|<non-join>] <virama> <primary> } | <other> +modifiers ::== { [<join>] <secondary> } +syllabe ::== <consonant-cluster> [<modifiers>] +text ::== { <syllabe> } + +semantics: + +The algorithm reads a syllabe from the string. + +build-syllabe syllabe = + if prebuild syllabe + glyphs = prebuild syllabe + else + cluster-glyphs, rest-modifiers = build-cluster cluster with modifiers + glyphs = apply rest-modifiers to cluster-glyphs + endif + +build-cluster cluster with modifiers = + if prebuild cluster + glyphs = prebuild syllabe + else + split-off final ya, ra, la, try again + else + split-off front ra (for repham), try again + else + split first letter from + build-syllabe first-part with virama + build-syllabe second-part with modifiers + rest-modifiers = nil + endif + +apply modifiers to glyphs = + apply first-modifier to glyphs + apply rest-of-modifiers to glyphs + + + + +The algorithm ignores joins, non-join will cause virama's to be +used + +<eof> |