XTookit v1.0 Released

Discussion of the xtools Toolkit

Moderators: Tom, Kukurykus

Mike Hale

XTookit v1.0 Released

Post by Mike Hale »

While I'm making your changes, can this be rewritten 'perl' style as the byte order test was?

Code: Select allif(fileTags == undefined){throwError('Error reading tif file');};
xbytor

XTookit v1.0 Released

Post by xbytor »

Mike Hale wrote:While I'm making your changes, can this be rewritten 'perl' style as the byte order test was?

Code: Select allif(fileTags == undefined){throwError('Error reading tif file');};

Sure:

fileTags == undefined || throwError('Error reading tif file');

-X
xbytor

XTookit v1.0 Released

Post by xbytor »

Mike Hale wrote:I understand your concerns about putByteData(). You are right that in this case btData.length must = dataLength. The function insertSEMData makes sure that the lengths are the same before calling putByteData.

With tiff and jpeg files, if you do change the length of the data you can't just append the rest of the file. You have to rewrite the file updating the file header. And the data types are mixed. I wrote putByteData as a generic function to write byte data. Do you think it's ok from a generic pov?

As long as you have the length check in there, I don't see a problem. My version may be usable with .atn files with a little work. I've been trying to find a way to replace arbitrary strings in action files for awhile and this may work.

The part of the code that bothers me the most is the createSEMrdf function. Did you think that was ok or is it too far off the wall for comment?

No, it was just a little dense. I've attached a rev of that function that uses a switch statement instead of a if-else cascade. I also added a convenience function that helps to eliminate some redundant text. I put several variants in the case blocks just to give you an idea of what kind of techniques are possible. There is a yet another way of mapping the original tags to the rdf tags: it would make the code yet more concise but less readable, so I left it.

[edit] I'll be adding support for signed integral values and byte order to Stream. Thanks for the idea and code .
-X
Mike Hale

XTookit v1.0 Released

Post by Mike Hale »

X, Thanks for this too. I had thought about using a switch statement but didn't see the advantage until your revision. I also like the toRdf function.

I had a hard time coming up with the signed data functions. I couldn't find any examples using javascipt. I'm glad you think they are worth adding to stream. There are two other data types needed for reading tif and psd files that I haven't coded yet. When I come up with them I will send you a note incase you want to add them as well.

Thanks again,
Mike