static Hashtable currtable=new Hashtable();
static String declaration;
+
static void debug(String str) {
System.out.println(str);
}
static public void main(String[] args) {
+ String copy=null;
debug("Opening file:"+args[0]);
BufferedReader br=null;
BufferedWriter bw=null;
String line=br.readLine();
if (line==null)
break;
- String replacewith=line+".elem[";
+ String replacewith=line+".elem";
if (replacewith==null)
break;
- currtable.put(line+"[",replacewith);
+ currtable.put(line,replacewith);
}
/* Built table */
for(Iterator it=currtable.keySet().iterator();it.hasNext();) {
String str=(String)it.next();
String replace=(String)currtable.get(str);
+ if (line.endsWith(str))
+ copy=line+"\n";
line=replace(line,str,replace);
}
- }
+ } else
+ if (copy!=null) {
+ if ((count%4)==1)
+ copy+=replace(line,"[","_array[")+"\n";
+ else
+ copy+=line+"\n";
+ }
bw.write(line);
bw.newLine();
count++;
+ if (copy!=null&&((count%4)==0)) {
+ bw.write(copy);
+ copy=null;
+ }
} else {
bw.write(line);
bw.newLine();
for(Iterator it=currtable.keySet().iterator();it.hasNext();) {
String str=(String)it.next();
String replace=(String)currtable.get(str);
+ if (line.endsWith(str))
+ copy=line+"\n";
line=replace(line,str,replace);
}
- }
+ } else if (copy!=null)
+ copy+=line+"\n";
bw.write(line);
bw.newLine();
count++;
+ if (((count%3)==0)&©!=null) {
+ bw.write(copy);
+ copy=null;
+ }
} else {
bw.write(line);
bw.newLine();