kjc question

Chester Kustarz 2 chester at monkey.org
Sat Feb 12 02:50:52 PST 2000


ok, i included the source file as an attachement. as you can see if
you use vi, the line breaks are all messy. i was able to compile 
with JDK on windows 98, but kjc on OpenBSD gives me:
ImageMapMenu.java:16: expecting '}', found 'public'

It's not that I really expect the lines to be read in correctly --
vi doesn't. But since the JDK javac can cope with it I thought I
would mention it. I had to include the source as an attachement
because the end of line characters are important.

What I do to get around this is use the following Tcl program I
wrote that makes the end-of-lines unixy:

#!/usr/local/bin/tclsh
# go through every file and unix format it
# example: % unixxxy source1.java source2.java ...
foreach arg $argv {
        puts "making $arg unixy; backup is $arg.ununixy"
	# backup original
	exec mv $arg $arg.ununixy
	# take the ununixy file and filter it into the unixy file
	set ununixy_file [open $arg.ununixy r]
	set unixy_file [open $arg w]
	while {[gets $ununixy_file line] >=0} {
		puts $unixy_file "$line"
	}
	close $unixy_file
	close $ununixy_file
}


I found this program useful because the java developers on our
team use all kinds of operating systems (like windows, irix, 
BSD, macs...) and reading the source files can get to be a pain.
I wish I could write it in perl because it is more wide-spread
than Tcl, but I don't know perl as well. And I like Tcl better
anyhow!

Also of note: I did try to use preexisting file format converters
such as the GNU recode but none of them were really written for
files containing DOS, UNIX, & MAC end of lines in the same file.

Thank you guys so much for putting effort into Kaffe. I am 
really happy I found this port for OpenBSD.

On Fri, 11 Feb 2000, Edouard G. Parmelan wrote:
> > one difference is that javac and kjc understand line breaks 
> > differently. javac is like Tcl in that it will take mac, pc, unix,
> > or even a mix in the same file and be ok. kjc barfs on my
> > source files unless i filter them first.
> 
> Humm, I can't reproduce that.  Which version of kjc did you use ?  Could
> you send me sample class ?


--
Chester Kustarz 

-------------- next part --------------
import java.awt.*;
import java.util.*;

import java.net.*;


public class ImageMapMenu {
  Vector subMenu;
  
  ImageMapMenu() {
  }
  
  public boolean paintMenu(Graphics g) {
    boolean state = false;
    // first time drawing this entity and has a submenu,
    // calculate regions
    //
    if (subMenu != null)
      buildSubMenu();
 return state;
  }

    public void buildSubMenu() {}
}








More information about the kaffe mailing list