File handlling utilities

I’ve been tidying up the ADC import code. Couple of points I need cleared up.

I have a number of methods that are used for file handling. I’m not aware of any Java API method for reading null-terminated strings. Where should this go in the VASSAL code? Likewise, I had to develop a number of methods to handle absolute paths in a more platform independent manner (e.g., case invariant filename matching, etc.) Methods that are clearly ADC2-specific should be protected, but when Joel starts on the Cyberboard import, he might need some of this stuff.

Is there a Utilities class anywhere?

P.S.: If I have to look at another hex editor, I’m going to barf.

Thus spake “mkiefte”:

Do you mean a method which reads bytes from a stream until a null is
found, and then returns that as a String? You might check whether
java.io.StreamTokenizer is what you’re looking for.

Depends. There might already be a home for this sort of thing in
VASSAL.tools.IOUtils.

vassalengine.svn.sourceforge.net … iew=markup

Have you committed your coded to the repo? If so, I’d be happy to take
a look and make a suggestion.

Did you look at java.io.File for that?

In VASSAL.tools (on uckelman-caching) there are IOUtils and ImageUtils.
The former has a bunch of stream-handling methods, and the later has
a some common image-manipulation code.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thanks, Joel. I’ll take a look.

A tokenizer might be overkill if you’re just reading until you hit \0,
but I’ll take a look.

And the last time I checked, IOUtils didn’t have what I was looking
for, but I’ll check again.

  • M.

On 20/01/2008, Joel Uckelman uckelman@nomic.net wrote:


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Michael Kiefte”:

It might make sense to add these things to IOUtils.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

P.S.: I haven’t committed anything yet.

Of those that are using Eclipse, what are you using for subversion?
Does someone have a cheat sheet out there for someone who already
knows CVS? Or is there a half-decent plug-in for Eclipse?

  • Michael.

Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Michael Kiefte”:

Subversive is the plugin which Brent likes.

Here’s a CVS-to-SVN translator:

svn.collab.net/repos/svn/trunk/d … guide.html


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

I may throw together a short document on how to get Vassal up and running by installing Eclipse with Subversive. Installing Subversive wasn’t entirely intuitive to me, it seems to have a few dependencies.

Your feeling is that it’s better than subclipse (which cannot actually
do all the things you need it to do)?

  • M.

On 20/01/2008, bsmith messages@forums.vassalengine.org wrote:


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

In my opinion, Subversive is far superior to Subclipse. The main distinguishing feature is that Subversive use the File Synchronize feature that the CVS explorer uses. Subclipse is missing this.

Whenever you merge in changes, you get to see the source and target side by side and manually fix discrepancies. I find it essential. I managed to mash my source several times when using Subclipse before discovering Subversive.

I may throw together a short document on how to get Vassal up and running by installing Eclipse with Subversive. Installing Subversive wasn’t entirely intuitive to me, it seems to have a few dependencies.

Ben,

Feel free to update my existing how-to at vassalengine.org/wiki/doku.p … ipse_setup

Cheers,
Brent.

OK, so there’s no need for me to write a document then haha!

Something weird I noticed was that I did not need to install the JDK when I tried to build Vassal under Vista. Could it be that Java JDK is now distributed with Eclipse?

Michael, I’m looking at your ADC conversion code now. Well done!

I was thinking about writing a ZunTzu gamebox importer (partly
because it will be really, really easy), and partly because it
will give us another converter so we can figure out which bits
and pieces should go where.

My initial thought is that we should start an import hierarchy
under VASSAL.tools, something like:

VASSAL
|-tools
|-import
|-adc2
|-cyberboard
|-zuntzu

(If you can’t see these in the forum, the structure is VASSAL.tools.import,
with adc2, cyberboard, and zuntzu as children of it.)

The advantage of that would be that we could keep things which
are common to the importers in VASSAL.tools.import, and also that
complex importers with multiple classes (like yours) would then
not have to live in a single file. (4355 lines of code is a lot
to digest in one file—I think that makes your ADC2 converter
the longest file in the repo by something like a factor of two.)

On 21/01/2008, uckelman messages@forums.vassalengine.org wrote:

Thanks. However, I programmed it linearly and it shows. I started at
the beginning of each file and as I decoded each chunk, I made a new
method. At one point I tried going back to reorganizing it, but the
formats are just too crazy to find a more coherent structure.

As for utilities, some are very ADC specific: 16-bit words are encoded
as big-endian base-250 bytes (look at the method ReadBase250Word and
how often it gets called!). Much of the format consists of such
insanity, unfortunately. Others are potentially very useful to other
modules – obviously no one ever intended for someone to load an ADC2
module in Linux and I suspect Cyberboard contains other nightmares.

I figured we would need to generalize this and changing that aspect is trivial.

That’s an excellent idea. I’ll get back on it. I got the subversion
documentation. I couldn’t get subversive to work at all. I did,
however, find new ways to get Eclipse to crash.

I programmed it linearly going sets → maps → modules. I did it as
fast as possible in the hopes of cleaning it up later and the modules
is not even complete – just the useful bits (or the bits I considered
useful). I’ve attempted to document all of the format I’ve gotten so
far whether it was relevant or not, so if I burn out, there’s enough
there to keep going. Splitting it out into non-nested classes will
obviously help a lot.

With respect to how modules get imported, I imagined a new button on
the splash-screen called “Import Module” (which I did). It then calls
the appropriate class method based on the extension of the file
selected. This works to the advantage of ADC2 files in particular, as
there are three different types of files that can be imported: sets,
maps, and modules which have different file extensions. Presumably,
when you get to Cyberboard, it should recognise the appropriate
extension (is there more than one file in a Cyberboard module?).

I took a break from looking at this, but I’ll get back on it.

  • M.

Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Michael Kiefte”:

Is this something we want to try to ship in 3.1.0, or should we aim
for 3.2?


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Is 3.2 intended to be a stable release?

The upside to including it in 3.1 would be that more people will test
it with more modules and I’ll receive a flood of bug reports which
will mean it will get better faster.

The downside to including it in 3.1 would be that more people will
test it with more modules and I’ll receive a flood of bug reports
which mean it will get better faster.

On 23/01/2008, Joel Uckelman uckelman@nomic.net wrote:


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Michael Kiefte”:

Every x.y.0 is intended to be a stable release.

What I’m expecting we’ll do (very soon) is put out 3.1.0-beta1, and
make it available in a way which is much more visible than my svn
builds have been. (I think I’ll put the beta up on SourceForge,
and maybe bug Rodney again to let me clean up the downloads page on
the web site. We’ll announce that the beta exists, with a note of
encouragement for people who want to help us find bugs to try it
and report back.)

While we’re receiving reports of (new) bugs, I’ll periodically release
a beta(n+1) containing fixes until we’re satisfied. At that point,
if we feel it’s necessary, we could put out a release candiate, or
release 3.1.0. The amount of time this takes depends mostly on how much
stuff we broke since 3.0.17 and how quickly testers find it.

I doubt that it will get better faster if it’s included in 3.1 instead
of 3.2. I agree that it will get better sooner. :slight_smile:

My two reasons for suggesting that it be in 3.2 are:

  1. I don’t want to hold up 3.1 unnecesarily.

  2. I just began work on re-jiggering the initial screen, which I’d
    like to see in 3.2 (if people like it). The relevance of this for
    converters in general is that their location in the GUI will change,
    most likely to appear under File → Import or somesuch. I’d like to
    avoid introducing a feature in 3.1 and then moving it someplace else
    in 3.2.

It might be the case that adding the converter now wouldn’t hold up
3.1 at all, since the changes it makes are very local and unlikely
to cause bugs anywhere else.

It might also be the case that #2 isn’t a good reason to wait. I’m
unsure.

I guess it depends on whether you think it’s ready.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

I’m leaning towards earlier rather than later. Your concern about the
splash-screen GUI are noted, but the modification so far has been
trivial. That and I’m kind of curious about what will happen with the
importer once it’s in the wild.

I’m going to do a commit again later this week to clear up one more
bug. Once it can load all of the modules I own cleanly (almost all of
them right now), let’s get it out there. Give me until the weekend,
and I’ll be fine.

Couple more matters: there is no documentation for the importer. On
another note, there is nothing in the importer that actually mentions
ADC2. I did this to avoid the copyright pitfalls that might occur.
What this means is that it’s not clear what the importer does. Any
suggestions?

  • M.

On 24/01/2008, Joel Uckelman uckelman@nomic.net wrote:


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Michael Kiefte”:

Ok. Anyway, becuase your changes are so local, I don’t see a big problem
with adding them after the first beta, if by chance we do release it
before you’re ready.

I think you’re the only person presently qualified to write any docs
for it. How complex is it to use?

I’m not aware of any copyright issues with converting a module from one
format to another for personal use, so I don’t see any reason for being
obscure about what the importer does.

There might be copyright issues with putting a module converted from
an ADC2 module on the Internet, but that would depend on the copyright
status of the ADC2 module from which it was converted. This situation
is no different from using scans in a module constructed from scratch,
so far as I can see.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Alright then.

Not at all. However, there’s no documentation to say what the button
labeled “Import Module” does. It does become somewhat obvious when
you click it however as it will only load three different types of
files based on their extension and these files are described in the
filter drop-down.

There’s no issue there. The only issue is perhaps writing the acronym
ADC2 anywhere in the documentation or in the program itself. The term
ADC2 belongs to someone else. Now that I think about it though,
OpenOffice.org does explicitly say “Microsoft Word 97/2000/XP” in the
file-filter dialog, so it’s probably not an issue. Shall I go ahead
and make this explicit in the program?

That’s correct. However, if two people who own an ADC2 module both
convert it and then play, there’s still no issue. There would be an
issue if a converted ADC2 module were widely distributed on the
Internet without permission, but I think that’s been addressed
already.

That being said, I’m aware of one company who’s ready to go with
VASSAL after converting all their current modules from ADC2 so I’m
hoping for wider adoption anyway. In addition, I think GMT are giving
their ADC2 modules away for free, so it’s probably not a stretch to
convince them to have conversions made if they’re a direct
translation.

  • M.

Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Michael Kiefte”:

Maybe you could write two sentences about what it is, and then mention
any limitations it has?

W/r/t trademark law in the USA:

“U.S. trademark law, however, does permit the use of another’s mark
(whether registered or unregistered) without their consent if the use
of the mark is made in good faith for the purpose of merely describing
the goods or services to which the mark relates or to accurately indicate
compatibility with another’s goods or services.”

inta.org/index.php?option=co … nt=1#FAQ71

That’s precisely what you’re doing—it’s a description, intended to
indicate compatibility.

True, but that would be an issue for whomever put it on the net, not
for us. We are but humble makers of tools.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Apparently import cannot be the name of a directory because import is
a reserved word. I’ve called it foreign for now.

  • M.

Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)