summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/fonts/malayalam/preproc/patc
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/fonts/malayalam/preproc/patc')
-rw-r--r--Master/texmf-dist/source/fonts/malayalam/preproc/patc/detex.g3
-rw-r--r--Master/texmf-dist/source/fonts/malayalam/preproc/patc/detex.pat133
-rw-r--r--Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.c474
-rw-r--r--Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.exebin0 -> 22874 bytes
-rw-r--r--Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.prj7
-rw-r--r--Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.ttpbin0 -> 10680 bytes
-rw-r--r--Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.txt97
-rw-r--r--Master/texmf-dist/source/fonts/malayalam/preproc/patc/pstree.c223
-rw-r--r--Master/texmf-dist/source/fonts/malayalam/preproc/patc/pstree.h13
9 files changed, 950 insertions, 0 deletions
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
new file mode 100644
index 00000000000..13d56541b6d
--- /dev/null
+++ b/Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.exe
Binary files differ
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
new file mode 100644
index 00000000000..9f2834ac536
--- /dev/null
+++ b/Master/texmf-dist/source/fonts/malayalam/preproc/patc/patc.ttp
Binary files differ
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);