From c22f7b0127763b0bf76f9d19e401b5b7795325c1 Mon Sep 17 00:00:00 2001 From: amontano Date: Wed, 9 Oct 2002 00:13:27 +0000 Subject: [PATCH] now can process acip dictionaries with -acip "secret" option --- .../thdl/tib/scanner/BinaryFileGenerator.java | 318 +++++++++++++++--- 1 file changed, 262 insertions(+), 56 deletions(-) diff --git a/source/org/thdl/tib/scanner/BinaryFileGenerator.java b/source/org/thdl/tib/scanner/BinaryFileGenerator.java index 74224ac..777d97e 100644 --- a/source/org/thdl/tib/scanner/BinaryFileGenerator.java +++ b/source/org/thdl/tib/scanner/BinaryFileGenerator.java @@ -99,57 +99,254 @@ public class BinaryFileGenerator extends LinkedList public void addFile(String archivo, int defNum) throws Exception { - int marker, linea, len; + final short newDefiniendum=1, halfDefiniendum=2, definition=3; + short status=newDefiniendum; + int marker, len, marker2, n=0, total=0, currentPage=0, currentLine=0; + char ch; BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(archivo))); - String entrada, s1, s2, previous=""; + String entrada="", s1, s2, previous="", currentLetter="", temp=""; + boolean markerNotFound; - linea=1; + currentLine=1; - /* used for acip dict + // used for acip dict if (delimiter==' ') { - while ((entrada = br.readLine())!=null) - { - entrada = entrada.trim(); - if (!entrada.equals("")) - { - // skip page numbers - if (entrada.charAt(0)=='@') - { - len = entrada.length(); - marker = 1; - while(marker0 && (entrada.charAt(0)=='(' || entrada.charAt(0)=='{' || entrada.charAt(0)=='?') && previous.trim().equals("")) - continue; - - // get definiendum - marker = entrada.indexOf('/'); - if (marker<0) - { - System.out.println("Error loading line " + linea + ", in file " + archivo + ":"); - System.out.println(entrada); - } - else - { - s1 = entrada.substring(0,marker).trim(); - // first part of def - s2 = entrada.substring(marker+1).trim(); - } - entrada = entrada.substring(marker+1).trim(); - if ( - add(s1, s2 , defNum); - } - previous = entrada; - linea++; - } + s1=""; + s2=""; + outAHere: + while (true) + { + entrada=br.readLine(); + if (entrada==null) break; + currentLine++; + + entrada = entrada.trim(); + len = entrada.length(); + if (len<=0) continue; + + // get page number + if (entrada.charAt(0)=='@') + { + marker = 1; + while(marker0) + currentPage=Integer.parseInt(temp); + if (marker2) @@ -359,6 +563,8 @@ public class BinaryFileGenerator extends LinkedList { if (args[i].equals("-tab")) delimiter='\t'; + else if (args[1].equals("-acip")) + delimiter=' '; else delimiter=args[i].charAt(1); i++;