Preparing for internationalization as well as responding to the tighter

Eclipse 3.0 code checks.
This commit is contained in:
Robert Greene 2004-07-04 03:34:35 +00:00
parent e016b966b5
commit ad51365d17
11 changed files with 401 additions and 157 deletions

View File

@ -19,7 +19,6 @@
*/
package com.webcodepro.applecommander.ui;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@ -39,12 +38,12 @@ import java.lang.reflect.Method;
* @author Rob Greene
*/
public class AppleCommander {
public static final String VERSION = "1.3.4pre";
public static final String COPYRIGHT = "Copyright (c) 2002-2004";
public static final String VERSION = "1.3.4pre"; //$NON-NLS-1$
private static TextBundle textBundle = TextBundle.getInstance();
/**
* Launch AppleCommander.
*/
public static void main(String[] args) throws IOException {
public static void main(String[] args) {
if (args.length == 0) {
if (isSwtAvailable()) {
launchSwtAppleCommander(args);
@ -54,13 +53,14 @@ public class AppleCommander {
} else {
String[] extraArgs = new String[args.length - 1];
System.arraycopy(args, 1, extraArgs, 0, extraArgs.length);
if ("-swt".equalsIgnoreCase(args[0])) {
if ("-swt".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
launchSwtAppleCommander(args);
} else if ("-swing".equalsIgnoreCase(args[0])) {
System.err.println("Sorry, the Swing GUI is not available (yet).");
} else if ("-command".equalsIgnoreCase(args[0])) {
System.err.println("Sorry, the command line user interface is not available (yet).");
} else if ("-help".equalsIgnoreCase(args[0]) || "-?".equalsIgnoreCase(args[0])) {
} else if ("-swing".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
System.err.println(textBundle.get("SwingVersionNotAvailable")); //$NON-NLS-1$
} else if ("-command".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
System.err.println(textBundle.get("CommandLineNotAvailable")); //$NON-NLS-1$
} else if ("-help".equalsIgnoreCase(args[0]) //$NON-NLS-1$
|| "-?".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
showHelp();
} else {
ac.main(args);
@ -77,10 +77,10 @@ public class AppleCommander {
Class swtAppleCommander;
try {
swtAppleCommander = Class.forName(
"com.webcodepro.applecommander.ui.swt.SwtAppleCommander");
"com.webcodepro.applecommander.ui.swt.SwtAppleCommander"); //$NON-NLS-1$
Object object = swtAppleCommander.newInstance();
Method launchMethod = swtAppleCommander.
getMethod("launch", null);
getMethod("launch", null); //$NON-NLS-1$
launchMethod.invoke(object, null);
} catch (ClassNotFoundException e) {
e.printStackTrace();
@ -103,8 +103,8 @@ public class AppleCommander {
*/
protected static boolean isSwtAvailable() {
try {
Class.forName("org.eclipse.swt.SWT");
Class.forName("com.webcodepro.applecommander.ui.swt.SwtAppleCommander");
Class.forName("org.eclipse.swt.SWT"); //$NON-NLS-1$
Class.forName("com.webcodepro.applecommander.ui.swt.SwtAppleCommander"); //$NON-NLS-1$
return true;
} catch (ClassNotFoundException ex) {
return false;
@ -114,14 +114,7 @@ public class AppleCommander {
* Display help message(s) for AppleCommander.
*/
protected static void showHelp() {
System.err.println("AppleCommander general options:");
System.err.println("-swt will launch the SWT version of AppleCommander.");
System.err.println(" This requires the SWT jar and dll files to be present.");
System.err.println("-swing will launch the Swing version of AppleCommander.");
System.err.println(" (This is not implemented yet.)");
System.err.println("-command will enter command interpreter mode. (This is also");
System.err.println(" not implemented yet.)");
System.err.println("-help will show this help text.");
System.err.println(textBundle.get("AppleCommanderHelp")); //$NON-NLS-1$
System.err.println();
ac.help();
}

View File

@ -0,0 +1,77 @@
/*
* AppleCommander - An Apple ][ image utility.
* Copyright (C) 2002-2003 by Robert Greene
* robgreene at users.sourceforge.net
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.webcodepro.applecommander.ui;
import java.text.MessageFormat;
import java.util.ResourceBundle;
/**
* Manage the user-interface specific ResourceBundle. Initally, this is to actually clean up the
* text. Utilmately, it should allow AppleCommander to be translated into other languages.
*
* @author Rob Greene
*/
public class TextBundle {
private ResourceBundle resourceBundle;
private static TextBundle instance;
/**
* Get the singleton instance of the TextBundle.
*/
public static TextBundle getInstance() {
if (instance == null) {
instance = new TextBundle();
instance.initialize();
}
return instance;
}
/**
* Initialize the TextBundle.
*/
private void initialize() {
if (resourceBundle == null) {
resourceBundle = ResourceBundle.getBundle(getClass().getName());
}
}
/**
* Retrieve a value for the given resource name.
*/
public String get(String name) {
return resourceBundle.getString(name);
}
/**
* Format the given resource name with a single String value.
*/
public String format(String name, String value) {
return format(name, new Object[] { value });
}
/**
* Format the given resource name with multiple values.
*/
public String format(String name, Object[] values) {
String resourceValue = get(name);
MessageFormat messageFormat = new MessageFormat(resourceValue);
return messageFormat.format(values);
}
}

View File

@ -0,0 +1,138 @@
# DiskExplorerTab
FileExistsTitle = File already exists!
FileExistsMessage = The file "{0}" already exists. Do you want to over-write it?
ExportErrorTitle = Unable to export file data!
ExportAsMenuItem=Export As...
ExportErrorMessage = Unable to export "{0}".\n\nAppleCommander was unable to save the disk\ndata. The system error given was "{1}"\n\nSorry!\n\nPress OK to continue export or CANCEL to cancel export.
ExpandAllMenuItem=Expand All\tCtrl +
ExportWizardMenuItem=&Export Wizard...\tCtrl+E
ExportAsBinaryMenuItem=Binary...
ExportWizardToolItem=Export...
ExportWizardHoverText=Export a file (CTRL+E)
UnableToCompileTitle = Unable to compile file!
UnableToCompileMessage = Unable to compile "(0)".\n\nAppleCommander was unable to compile the file.\nThe system error given was "{1}"\n\nSorry!\n\nPress OK to continue compiles or CANCEL to cancel compiles.
DeletePromptTitle = Are you sure?
DeleteMenuItem=&Delete...\tCtrl+D
DeletePromptMultipleFiles = Are you sure you want to delete these files?
DeletePromptSingleFile = Are you sure you want to delete this file?
DeleteFileErrorMessage=Sorry, you cannot view a deleted file.
DeletePromptTrailer = \n\nChoose YES to proceed or NO to cancel.
DetailViewHoverText=Displays files in with full details (F4)
DeleteFileToolItem=Delete
DeleteFileHoverText=Delete a file (CTRL+D)
DeleteFileErrorTitle=Unable to view a deleted file!
ResizeDiskTitle = Resize disk?
ResizeDiskMessage = This disk needs to be resized to match the formatted capacity. This should be an ApplePC HDV disk iamge - they typically start at 0 bytes and grow to the maximum capacity (32MB). Resize the disk?
ImportFileTitle = Unable to import file(s)!
ImportMenuItem=Import...\tCTRL+I
ImportFileMessage = An error occured during import!\n\nException was "{0}".
FilesTab=Files
ExpandMenuItem=Expand\t+
CollapseMenuItem=Collapse\t-
CollapseAllMenuItem=Collapse All\tCtrl -
ViewWizardMenuItem=&View Wizard\tCtrl+V
ViewAsMenuItem=View As
CompileMenuItem=&Compile...\tCtrl+C
ViewAsTextMenuItem=Text
VeiwAsGraphicsMenuItem=Graphics
ExportAsRawDiskDataMenuItem=Raw disk data...
ExportAsApplesoftBasicMenuItem=Applesoft Basic...
ExportAsIntegerBasicMenuItem=Integer Basic...
ExportAsAsciiTextMenuItem=ASCII Text...
ExportAsFormattedAssemblyMenuItem=Formatted Assembly...
ExportAsPascalTextMenuItem=Pascal Text...
ExportAsAppleWorksSpreadsheetFileMenuItem=AppleWorks Spreadsheet File...
ExportAsAppleWorksDatabaseFileMenuItem=AppleWorks Database File...
ExportAsAppleWorksWordProcessorFileMenuItem=AppleWorks WordProcessor File...
WordProcessorRenderingMenuItem=Rendering
WordProcessorRenderAsTextMenuItem=Text
WordProcessorRenderAsHtmlMenuItem=HTML
WordProcessorRenderAsRtfMenuItem=RTF
ExportAsGraphicsMenuItem=Graphics...
ExportGraphicsModeMenuItem=Mode
ExportGraphicsAsHiresBlackAndWhiteMenuItem=Hi-Res B&W
ExportGraphicsAsHiresColorMenuItem=Hi-Res Color
ExportGraphicsAsDoubleHiresBlackAndWhiteMenuItem=Double Hi-Res B&W
ExportGraphicsAsDoubleHiresColorMenuItem=Double Hi-Res COLOR
ExportGraphicsAsSuperHiresMenuItem=Super Hires
ExportGraphicsAsSuperHires3200ColorMenuItem=Super Hires 3200 color
ExportGraphicsAsQuickDraw2IconMenuItem=QuickDraw II Icon file (ICN)
ExportGraphicsFormatMenuItem=Format
WidestCharacter=W
ImportingFilesTitle=Importing files...
ImportingFilesProcessingLabel=Processing:
ImportingFilesFilenameLabel=Filename:
StandardViewToolItem=Standard
StandardViewHoverText=Displays files in standard format (F2)
NativeViewToolItem=Native
NativeViewHoverText=Displays files in native format for the operating system (F3)
DetailViewToolItem=Detail
ShowDeletedFilesToolItem=Deleted
ShowDeletedFilesHoverText=Show deleted files (F5)
ImportWizardToolItem=Import...
ImportWizardHoverText=Import a file (CTRL+I)
CompileWizardToolItem=Compile
CompileWizardHoverText=Compile a BASIC program (CTRL+C)
ViewFileToolItem=View
ViewFileHoverText=View file (CTRL+V)
PrintDirectoryToolItem=Print
PrintDirectoryHoverText=Print directory listing...
ChangeDiskOrderToolItem=Re-order...
ChangeDiskOrderHoverText=Change image order (CTRL+O)
SaveDiskImageToolItem=Save
SaveDiskImageHoverText=Save disk image (CTRL+S)
SaveDiskImageAsToolItem=Save As
SaveDiskImageAsHoverText=Save disk image as... (CTRL+SHIFT+S)
SaveDiskImageAsPrompt=Please choose a location and name for your disk image:
SaveDiskImageErrorTitle=Unable to save disk image\!
SaveDiskImageErrorMessage=Unable to save "{0}".\n\nAppleCommander was unable to save the disk\r\nimage. The system error given was "{1}".\n\nSorry!
SystemErrorTitle=A system error occurred\!
SystemErrorMessage=A system error occurred. The message given was '%MESSAGE%'.
PageNumberText=Page {0}
ChangeImageOrderErrorTitle=Unable to change image order\!
ChangeImageOrderErrorMessage=Unable to reorder disk image.\n\nAppleCommander was unable to change the disk order.\nThe system error given was "{0}"\n\nSorry!\n\nPress OK to continue.
ChangeToNibbleOrderMenuItem=Nibble Order (*.nib)
ChangeToDosOrderMenuItem=DOS Order (*.dsk)
ChangeToProdosOrderMenuItem=ProDOS Order (*.po)
FileNofM=File {0} of {1}
# ac
CommandLineErrorMessage = Error: {0}
CommandLineNoMatchMessage = {0}: No match.
CommandLineStatus = {0} format; {1} bytes free; {2} bytes used.
CommandLineHelp = AppleCommander command line options:\n-l <imagename> list directory of image.\n-e <filename> <imagename> export file from image to stdout.\n-g <filename> <imagename> get raw file from image to stdout.\n-p <destname> <type> <addr> <imagename> put stdin\n in destname on image, using file type and address.\n-d <filename> <imagename> delete file from image.\n-p140 <imagename> <volname> create a 140K ProDOS image.\n-p800 <imagename> <volname> create a 800K ProDOS image.
# UserPreferences
UserPreferencesComment = AppleCommander user preferences
# AppleCommander
Copyright = Copyright (c) 2002-2004
SwingVersionNotAvailable = Sorry, the Swing GUI is not available.
CommandLineNotAvailable = Sorry, the command line user interface is not available.
AppleCommanderHelp = AppleCommander general options:\n-swt will launch the SWT version of AppleCommander.\n This requires the SWT jar and dll files to be present.\n-swing will launch the Swing version of AppleCommander.\n (This is not implemented yet.)\n-command will enter command interpreter mode. (This is also\n not implemented yet.)\n-help will show this help text.
# AppleUtil
HexDumpLine1 = Offset Hex Data Characters
HexDumpLine2 = ======= ================================================ =================
HexDumpEndMessage = ** END **
CannotChangeImageOrder=Cannot change ImageOrder unless the source and target are the same size!
CannotCompareDisks=Cannot compare disks unless the source and target are the same size!
# ImportWizard
ImportWizardTitle = Import Wizard
# ImportSelectFilesWizardPane
ImportWizardPrompt = Please choose the files to be imported:
SourceColumnHeader = Source
TargetColumnHeader = Target
FilenameLabel=Filename:
FiletypeLabel=Filetype:
TypeColumnHeader = Type
ChooseButton = Choose...
RemoveButton = Remove
EditButton=Edit...
FileImportSettingsTitle=File Import Settings
AddressLabel=Address:
RawBinaryCheckbox=RAW binary?
CancelButton=Cancel
OkButton=OK

View File

@ -31,18 +31,19 @@ import java.util.Properties;
* @author Rob Greene
*/
public class UserPreferences {
private static final String FILENAME = "AppleCommander.preferences";
private static final String IMAGE_DIRECTORY = "imageDirectory";
private static final String EXPORT_DIRECTORY = "exportDirectory";
private static final String COMPILE_DIRECTORY = "compileDirectory";
private static final String SAVE_DIRECTORY = "saveDirectory";
private static final String IMPORT_DIRECTORY = "importDirectory";
private static final String FILENAME = "AppleCommander.preferences"; //$NON-NLS-1$
private static final String IMAGE_DIRECTORY = "imageDirectory"; //$NON-NLS-1$
private static final String EXPORT_DIRECTORY = "exportDirectory"; //$NON-NLS-1$
private static final String COMPILE_DIRECTORY = "compileDirectory"; //$NON-NLS-1$
private static final String SAVE_DIRECTORY = "saveDirectory"; //$NON-NLS-1$
private static final String IMPORT_DIRECTORY = "importDirectory"; //$NON-NLS-1$
private static UserPreferences instance;
private Properties properties = new Properties();
/**
* Hide constructor from other classes.
*/
private UserPreferences() {
// empty
}
/**
* Get the singleton UserPreferences.
@ -63,6 +64,7 @@ public class UserPreferences {
properties.load(inputStream);
inputStream.close();
} catch (Exception ignored) {
// Ignored
}
}
/**
@ -71,9 +73,11 @@ public class UserPreferences {
public void save() {
try {
FileOutputStream outputStream = new FileOutputStream(FILENAME);
properties.store(outputStream, "AppleCommander user preferences");
properties.store(outputStream, TextBundle.getInstance().
get("UserPreferencesComment")); //$NON-NLS-1$
outputStream.close();
} catch (Exception ignored) {
// Ignored
}
}
/**

View File

@ -36,30 +36,32 @@ import com.webcodepro.applecommander.storage.physical.ImageOrder;
import com.webcodepro.applecommander.storage.physical.ProdosOrder;
public class ac {
private static TextBundle textBundle = TextBundle.getInstance();
public static void main(String[] args) throws IOException {
public static void main(String[] args) {
try {
if (args.length == 0) {
help();
} else if ("-l".equalsIgnoreCase(args[0])) {
} else if ("-l".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
showDirectory(args[1]);
} else if ("-e".equalsIgnoreCase(args[0])) {
} else if ("-e".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
getFile(args[1], args[2], true);
} else if ("-g".equalsIgnoreCase(args[0])) {
} else if ("-g".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
getFile(args[1], args[2], false);
} else if ("-p".equalsIgnoreCase(args[0])) {
} else if ("-p".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
putFile(args[1], args[2], args[3], args[4]);
} else if ("-d".equalsIgnoreCase(args[0])) {
} else if ("-d".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
deleteFile(args[1], args[2]);
} else if ("-p140".equalsIgnoreCase(args[0])) {
createPDisk(args[1], args[2], ProdosFormatDisk.APPLE_140KB_DISK);
} else if ("-p800".equalsIgnoreCase(args[0])) {
createPDisk(args[1], args[2], ProdosFormatDisk.APPLE_800KB_DISK);
} else if ("-p140".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
createPDisk(args[1], args[2], Disk.APPLE_140KB_DISK);
} else if ("-p800".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
createPDisk(args[1], args[2], Disk.APPLE_800KB_DISK);
} else {
help();
}
} catch (Exception ex) {
System.err.println("Error: " + ex);
System.err.println(textBundle.format("CommandLineErrorMessage", //$NON-NLS-1$
ex.getLocalizedMessage()));
ex.printStackTrace();
help();
}
@ -93,8 +95,7 @@ public class ac {
/**
* Delete the file named fileName from the disk named imageName.
*/
static void deleteFile(String fileName, String imageName)
throws IOException {
static void deleteFile(String fileName, String imageName) throws IOException {
Disk disk = new Disk(imageName);
FormattedDisk[] formattedDisks = disk.getFormattedDisks();
for (int i=0; i<formattedDisks.length; i++) {
@ -105,7 +106,8 @@ public class ac {
entry.delete();
disk.save();
} else {
System.err.println(fileName + ": No match.");
System.err.println(textBundle.format(
"CommandLineNoMatchMessage", fileName)); //$NON-NLS-1$
}
}
}
@ -114,8 +116,7 @@ public class ac {
* Get the file named filename from the disk named imageName;
* the file is filtered according to its type and sent to <stdout>.
*/
static void getFile(String fileName, String imageName, boolean filter)
throws IOException {
static void getFile(String fileName, String imageName, boolean filter) throws IOException {
Disk disk = new Disk(imageName);
FormattedDisk[] formattedDisks = disk.getFormattedDisks();
for (int i=0; i<formattedDisks.length; i++) {
@ -132,7 +133,8 @@ public class ac {
System.out.write(buf, 0, buf.length);
}
} else {
System.err.println(fileName + ": No match.");
System.err.println(textBundle.format(
"CommandLineNoMatchMessage", fileName)); //$NON-NLS-1$
}
}
}
@ -174,11 +176,15 @@ public class ac {
System.out.println(formattedDisk.getDiskName());
List files = formattedDisk.getFiles();
if (files != null) {
showFiles(files, "");
showFiles(files, ""); //$NON-NLS-1$
}
System.out.print(formattedDisk.getFormat() + " format; ");
System.out.print(formattedDisk.getFreeSpace() + " bytes free; ");
System.out.println(formattedDisk.getUsedSpace() + " bytes used.");
System.out.println(textBundle.format(
"CommandLineStatus", //$NON-NLS-1$
new Object[] {
formattedDisk.getFormat(),
new Integer(formattedDisk.getFreeSpace()),
new Integer(formattedDisk.getUsedSpace())
}));
System.out.println();
}
}
@ -197,13 +203,13 @@ public class ac {
System.out.print(indent);
for (int d=0; d<data.size(); d++) {
System.out.print(data.get(d));
System.out.print(" ");
System.out.print(" "); //$NON-NLS-1$
}
System.out.println();
}
if (entry.isDirectory()) {
showFiles(((DirectoryEntry)entry).getFiles(),
indent + " ");
indent + " "); //$NON-NLS-1$
}
}
}
@ -224,21 +230,14 @@ public class ac {
int i = 0;
try {
i = Integer.parseInt(s.trim());
} catch (NumberFormatException e) {
} catch (NumberFormatException ignored) {
// ignored
}
return i;
}
static void help() {
System.err.println("AppleCommander command line options:");
System.err.println("-l <imagename> list directory of image.");
System.err.println("-e <filename> <imagename> export file from image to stdout.");
System.err.println("-g <filename> <imagename> get raw file from image to stdout.");
System.err.println("-p <destname> <type> <addr> <imagename> put stdin");
System.err.println(" in destname on image, using file type and address.");
System.err.println("-d <filename> <imagename> delete file from image.");
System.err.println("-p140 <imagename> <volname> create a 140K ProDOS image.");
System.err.println("-p800 <imagename> <volname> create a 800K ProDOS image.");
System.err.println(textBundle.get("CommandLineHelp")); //$NON-NLS-1$
}
}

View File

@ -40,6 +40,7 @@ import com.webcodepro.applecommander.storage.Disk;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.storage.Disk.FilenameFilter;
import com.webcodepro.applecommander.ui.AppleCommander;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UserPreferences;
import com.webcodepro.applecommander.ui.swt.util.ImageCanvas;
import com.webcodepro.applecommander.ui.swt.util.ImageManager;
@ -57,6 +58,7 @@ public class SwtAppleCommander implements Listener {
private Shell shell;
private ToolBar toolBar;
private UserPreferences userPreferences = UserPreferences.getInstance();
private TextBundle textBundle = TextBundle.getInstance();
private ImageCanvas imageCanvas;
private static ImageManager imageManager;
@ -272,7 +274,7 @@ public class SwtAppleCommander implements Listener {
box.setMessage(
"AppleCommander\n"
+ "Version " + AppleCommander.VERSION + "\n"
+ AppleCommander.COPYRIGHT + "\n\n"
+ textBundle.get("Copyright") + "\n\n"
+ "AppleCommander was created for the express\n"
+ "purpose of assisting those-who-remember.\n\n"
+ "I wish you many hours of vintage pleasure!\n"

View File

@ -23,6 +23,7 @@ import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
import com.webcodepro.applecommander.ui.ImportSpecification;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UserPreferences;
import com.webcodepro.applecommander.ui.swt.util.SwtUtil;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
@ -35,6 +36,7 @@ import com.webcodepro.applecommander.util.AppleUtil;
* @author Rob Greene
*/
public class ImportSelectFilesWizardPane extends WizardPane {
private TextBundle textBundle = TextBundle.getInstance();
private ImportWizard wizard;
private Composite control;
private Composite parent;
@ -53,14 +55,14 @@ public class ImportSelectFilesWizardPane extends WizardPane {
}
/**
* Get the next visible pane.
* @see com.webcodepro.applecommander.ui.swt.WizardPane#getNextPane()
* @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#getNextPane()
*/
public WizardPane getNextPane() {
return null;
}
/**
* Create the wizard pane.
* @see com.webcodepro.applecommander.ui.swt.WizardPane#open()
* @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#open()
*/
public void open() {
control = new Composite(parent, SWT.NULL);
@ -75,7 +77,7 @@ public class ImportSelectFilesWizardPane extends WizardPane {
layout.spacing = 3;
control.setLayout(layout);
Label label = new Label(control, SWT.WRAP);
label.setText("Please choose the files to be imported:");
label.setText(textBundle.get("ImportWizardPrompt")); //$NON-NLS-1$
fileTable = new Table(control, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION
| SWT.V_SCROLL | SWT.H_SCROLL);
@ -86,8 +88,8 @@ public class ImportSelectFilesWizardPane extends WizardPane {
* Single click.
*/
public void widgetSelected(SelectionEvent event) {
removeButton.setEnabled(true);
editButton.setEnabled(true);
getRemoveButton().setEnabled(true);
getEditButton().setEnabled(true);
}
/**
* Double-click.
@ -98,27 +100,27 @@ public class ImportSelectFilesWizardPane extends WizardPane {
});
TableColumn column = new TableColumn(fileTable, SWT.LEFT);
column.setText("Source");
column.setText(textBundle.get("SourceColumnHeader")); //$NON-NLS-1$
column.setWidth(130);
column = new TableColumn(fileTable, SWT.LEFT);
column.setText("Target");
column.setText(textBundle.get("TargetColumnHeader")); //$NON-NLS-1$
column.setWidth(130);
column = new TableColumn(fileTable, SWT.LEFT);
column.setText("Type");
column.setText(textBundle.get("TypeColumnHeader")); //$NON-NLS-1$
column.setWidth(70);
Composite buttonPanel = new Composite(control, SWT.NULL);
buttonPanel.setLayout(new FillLayout());
Button chooseButton = new Button(buttonPanel, SWT.PUSH);
chooseButton.setText("Choose...");
chooseButton.setText(textBundle.get("ChooseButton")); //$NON-NLS-1$
chooseButton.setFocus();
chooseButton.addSelectionListener(new SelectionAdapter() {
/**
* Single click.
*/
public void widgetSelected(SelectionEvent event) {
FileDialog dialog = new FileDialog(parent.getShell(),
FileDialog dialog = new FileDialog(getParent().getShell(),
SWT.OPEN | SWT.MULTI);
dialog.setFilterPath(
UserPreferences.getInstance().getImportDirectory());
@ -132,26 +134,26 @@ public class ImportSelectFilesWizardPane extends WizardPane {
});
removeButton = new Button(buttonPanel, SWT.PUSH);
removeButton.setText("Remove");
removeButton.setText(textBundle.get("RemoveButton")); //$NON-NLS-1$
removeButton.setEnabled(false);
removeButton.addSelectionListener(new SelectionAdapter() {
/**
* Single click.
*/
public void widgetSelected(SelectionEvent event) {
TableItem[] items = fileTable.getSelection();
TableItem[] items = getFileTable().getSelection();
for (int i=0; i<items.length; i++) {
ImportSpecification spec = (ImportSpecification)
items[i].getData();
wizard.removeImportSpecification(spec);
getWizard().removeImportSpecification(spec);
}
removeButton.setEnabled(false);
getRemoveButton().setEnabled(false);
refreshTable();
}
});
editButton = new Button(buttonPanel, SWT.PUSH);
editButton.setText("Edit...");
editButton.setText(textBundle.get("EditButton")); //$NON-NLS-1$
editButton.setEnabled(false);
editButton.addSelectionListener(new SelectionAdapter() {
/**
@ -198,7 +200,7 @@ public class ImportSelectFilesWizardPane extends WizardPane {
}
/**
* Dispose of all resources.
* @see com.webcodepro.applecommander.ui.swt.WizardPane#dispose()
* @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#dispose()
*/
public void dispose() {
fileTable.dispose();
@ -212,7 +214,7 @@ public class ImportSelectFilesWizardPane extends WizardPane {
fileTable.getSelection()[0].getData();
final Shell dialog = new Shell(wizard.getDialog(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
dialog.setText("File Import Settings");
dialog.setText(textBundle.get("FileImportSettingsTitle")); //$NON-NLS-1$
GridLayout layout = new GridLayout();
layout.horizontalSpacing = 5;
layout.makeColumnsEqualWidth = false;
@ -224,7 +226,7 @@ public class ImportSelectFilesWizardPane extends WizardPane {
// Filename prompt:
Label label = new Label(dialog, SWT.NONE);
label.setText("Filename:");
label.setText(textBundle.get("FilenameLabel")); //$NON-NLS-1$
final Text filenameText = new Text(dialog, SWT.BORDER);
filenameText.setText(spec.getTargetFilename());
filenameText.setTextLimit(30);
@ -234,7 +236,7 @@ public class ImportSelectFilesWizardPane extends WizardPane {
// Filetype prompt:
label = new Label(dialog, SWT.NONE);
label.setText("Filetype:");
label.setText(textBundle.get("FiletypeLabel")); //$NON-NLS-1$
final Combo filetypes = new Combo(dialog, SWT.BORDER | SWT.READ_ONLY);
filetypes.setItems(wizard.getDisk().getFiletypes());
if (spec.hasFiletype()) {
@ -243,7 +245,7 @@ public class ImportSelectFilesWizardPane extends WizardPane {
// Address component: (only used for some filetypes)
label = new Label(dialog, SWT.NONE);
label.setText("Address:");
label.setText(textBundle.get("AddressLabel")); //$NON-NLS-1$
addressText = new Text(dialog, SWT.BORDER);
addressText.setTextLimit(5);
addressText.setText(AppleUtil.getFormattedWord(spec.getAddress()));
@ -257,7 +259,7 @@ public class ImportSelectFilesWizardPane extends WizardPane {
// RAW file image: (probably only used for DOS 3.3)
label = new Label(dialog, SWT.NONE);
label.setText("RAW binary?");
label.setText(textBundle.get("RawBinaryCheckbox")); //$NON-NLS-1$
rawCheckbox = new Button(dialog, SWT.CHECK);
rawCheckbox.setSelection(spec.isRawFileImport());
@ -266,8 +268,8 @@ public class ImportSelectFilesWizardPane extends WizardPane {
public void widgetSelected(SelectionEvent event) {
String filetype = filetypes.getItem(
filetypes.getSelectionIndex());
addressText.setEnabled(
wizard.getDisk().needsAddress(filetype));
getAddressText().setEnabled(
getWizard().getDisk().needsAddress(filetype));
}
});
@ -280,32 +282,32 @@ public class ImportSelectFilesWizardPane extends WizardPane {
composite.setLayoutData(layoutData);
composite.setLayout(new FillLayout(SWT.HORIZONTAL));
Button button = new Button(composite, SWT.PUSH);
button.setText("Cancel");
button.setText(textBundle.get("CancelButton")); //$NON-NLS-1$
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
filenameText.dispose();
filetypes.dispose();
addressText.dispose();
rawCheckbox.dispose();
getAddressText().dispose();
getRawCheckBox().dispose();
dialog.close();
}
});
button = new Button(composite, SWT.PUSH);
button.setText("OK");
button.setText(textBundle.get("OkButton")); //$NON-NLS-1$
dialog.setDefaultButton(button);
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
spec.setTargetFilename(wizard.getDisk().
spec.setTargetFilename(getWizard().getDisk().
getSuggestedFilename(filenameText.getText()));
spec.setFiletype(filetypes.getItem(
filetypes.getSelectionIndex()));
spec.setAddress(AppleUtil.convertFormattedWord(
addressText.getText()));
spec.setRawFileImport(rawCheckbox.getSelection());
getAddressText().getText()));
spec.setRawFileImport(getRawCheckBox().getSelection());
filenameText.dispose();
filetypes.dispose();
addressText.dispose();
rawCheckbox.dispose();
getAddressText().dispose();
getRawCheckBox().dispose();
dialog.close();
refreshTable();
}
@ -314,4 +316,32 @@ public class ImportSelectFilesWizardPane extends WizardPane {
SwtUtil.center(wizard.getDialog(), dialog);
dialog.open();
}
protected Button getRemoveButton() {
return removeButton;
}
protected Button getEditButton() {
return editButton;
}
protected Composite getParent() {
return parent;
}
protected Table getFileTable() {
return fileTable;
}
protected ImportWizard getWizard() {
return wizard;
}
protected Text getAddressText() {
return addressText;
}
protected Button getRawCheckBox() {
return rawCheckbox;
}
}

View File

@ -26,6 +26,7 @@ import org.eclipse.swt.widgets.Shell;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.ui.ImportSpecification;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.swt.util.ImageManager;
import com.webcodepro.applecommander.ui.swt.wizard.Wizard;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
@ -43,12 +44,13 @@ public class ImportWizard extends Wizard {
* Constructor for ImportWizard.
*/
public ImportWizard(Shell parent, ImageManager imageManager, FormattedDisk disk) {
super(parent, imageManager.get(ImageManager.LOGO_IMPORT_WIZARD), "Import Wizard");
super(parent, imageManager.get(ImageManager.LOGO_IMPORT_WIZARD),
TextBundle.getInstance().get("ImportWizardTitle")); //$NON-NLS-1$
this.disk = disk;
}
/**
* Create the initial display used in the wizard.
* @see com.webcodepro.applecommander.ui.swt.Wizard#createInitialWizardPane()
* @see com.webcodepro.applecommander.ui.swt.wizard.Wizard#createInitialWizardPane()
*/
public WizardPane createInitialWizardPane() {
return new ImportSelectFilesWizardPane(getContentPane(), this);

View File

@ -23,11 +23,13 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.storage.physical.ImageOrder;
import com.webcodepro.applecommander.ui.TextBundle;
/**
* This class contains helper methods for dealing with Apple2 data.
@ -36,6 +38,7 @@ import com.webcodepro.applecommander.storage.physical.ImageOrder;
* @author Rob Greene
*/
public class AppleUtil {
private static TextBundle textBundle = TextBundle.getInstance();
/**
* This is the number of bytes to display per line.
*/
@ -54,11 +57,11 @@ public class AppleUtil {
(byte)0x01, (byte)0x02, (byte)0x04, (byte)0x08,
(byte)0x10, (byte)0x20, (byte)0x40, (byte)0x80 };
/**
* Valid hex digits used when encuding or decoding hex.
* Valid hex digits used when encoding or decoding hex.
*/
private static String[] hexDigits = {
"0", "1", "2", "3", "4", "5", "6", "7",
"8", "9", "A", "B", "C", "D", "E", "F" };
private static char[] hexDigits = {
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
/**
* Compute the value of a word.
@ -123,7 +126,7 @@ public class AppleUtil {
* and remove the sign.
*/
public static int getUnsignedByte(byte value) {
return (int) value & 0xff;
return value & 0xff;
}
/**
@ -241,9 +244,9 @@ public class AppleUtil {
public static void setPascalDate(byte[] buffer, int offset, Date date) {
GregorianCalendar gc = new GregorianCalendar();
gc.setTime(date);
int month = gc.get(GregorianCalendar.MONTH) + 1;
int day = gc.get(GregorianCalendar.DAY_OF_MONTH);
int year = gc.get(GregorianCalendar.YEAR) % 100;
int month = gc.get(Calendar.MONTH) + 1;
int day = gc.get(Calendar.DAY_OF_MONTH);
int year = gc.get(Calendar.YEAR) % 100;
int pascalDate = (month & 0x000f)
| ((day << 4) & 0x01f0)
| ((year << 9) & 0xfe00);
@ -273,7 +276,10 @@ public class AppleUtil {
public static String getFormattedByte(int byt) {
int byt1 = byt & 0x0f;
int byt2 = (byt & 0xf0) >> 4;
return hexDigits[byt2] + hexDigits[byt1];
StringBuffer buf = new StringBuffer(2);
buf.append(hexDigits[byt2]);
buf.append(hexDigits[byt1]);
return buf.toString();
}
/**
@ -303,7 +309,7 @@ public class AppleUtil {
for (int i=0; i<word.length(); i++) {
char ch = word.charAt(i);
for (int nybble = 0; nybble < hexDigits.length; nybble++) {
if (ch == hexDigits[nybble].charAt(0)) {
if (ch == hexDigits[nybble]) {
value <<= 4;
value += nybble;
break;
@ -346,11 +352,11 @@ public class AppleUtil {
if (date != null) {
GregorianCalendar gc = new GregorianCalendar();
gc.setTime(date);
day = gc.get(GregorianCalendar.DAY_OF_MONTH);
month = gc.get(GregorianCalendar.MONTH) + 1;
year = gc.get(GregorianCalendar.YEAR);
minute = gc.get(GregorianCalendar.MINUTE);
hour = gc.get(GregorianCalendar.HOUR_OF_DAY);
day = gc.get(Calendar.DAY_OF_MONTH);
month = gc.get(Calendar.MONTH) + 1;
year = gc.get(Calendar.YEAR);
minute = gc.get(Calendar.MINUTE);
hour = gc.get(Calendar.HOUR_OF_DAY);
if (year >= 2000) {
year -= 2000;
} else {
@ -424,6 +430,7 @@ public class AppleUtil {
try {
decompressedStream.write(dataArray);
} catch (IOException ignored) {
// Ignored
}
}
break;
@ -436,6 +443,7 @@ public class AppleUtil {
try {
decompressedStream.write(dataArray);
} catch (IOException ignored) {
// Ignored
}
}
break;
@ -532,21 +540,17 @@ public class AppleUtil {
public static String getHexDump(byte[] bytes) {
ByteArrayOutputStream output = new ByteArrayOutputStream();
PrintWriter printer = new PrintWriter(output);
printer.print(" Offset ");
printer.print("Hex Data ");
printer.println("Characters");
printer.print("======= ");
printer.print("================================================ ");
printer.println("=================");
printer.println(textBundle.get("HexDumpLine1")); //$NON-NLS-1$
printer.println(textBundle.get("HexDumpLine2")); //$NON-NLS-1$
for (int offset=0; offset<bytes.length; offset+= BYTES_PER_LINE) {
printer.print("$");
printer.print("$"); //$NON-NLS-1$
printer.print(AppleUtil.getFormatted3ByteAddress(offset));
printer.print(" ");
printer.print(" "); //$NON-NLS-1$
for (int b=0; b<BYTES_PER_LINE; b++) {
if (b == BYTES_PER_LINE / 2) printer.print(' ');
int index = offset+b;
printer.print( (index < bytes.length) ?
AppleUtil.getFormattedByte(bytes[index]) : "..");
AppleUtil.getFormattedByte(bytes[index]) : ".."); //$NON-NLS-1$
printer.print(' ');
}
printer.print(' ');
@ -566,7 +570,7 @@ public class AppleUtil {
}
printer.println();
}
printer.println("** END **");
printer.println(textBundle.get("HexDumpEndMessage")); //$NON-NLS-1$
printer.flush();
printer.close();
return output.toString();
@ -577,8 +581,7 @@ public class AppleUtil {
*/
public static void changeImageOrderByTrackAndSector(ImageOrder sourceOrder, ImageOrder targetOrder) {
if (!sameSectorsPerDisk(sourceOrder, targetOrder)) {
throw new IllegalArgumentException("Cannot change ImageOrder unless the " +
"source and target are the same size!");
throw new IllegalArgumentException(textBundle.get("CannotChangeImageOrder")); //$NON-NLS-1$
}
for (int track = 0; track < sourceOrder.getTracksPerDisk(); track++) {
for (int sector = 0; sector < sourceOrder.getSectorsPerTrack(); sector++) {
@ -602,8 +605,7 @@ public class AppleUtil {
ImageOrder sourceOrder = sourceDisk.getImageOrder();
ImageOrder targetOrder = targetDisk.getImageOrder();
if (!sameSectorsPerDisk(sourceOrder, targetOrder)) {
throw new IllegalArgumentException("Cannot compare disks unless the " +
"source and target are the same size!");
throw new IllegalArgumentException(textBundle.get("CannotCompareDisks")); //$NON-NLS-1$
}
for (int track = 0; track < sourceOrder.getTracksPerDisk(); track++) {
for (int sector = 0; sector < sourceOrder.getSectorsPerTrack(); sector++) {
@ -622,8 +624,7 @@ public class AppleUtil {
*/
public static void changeImageOrderByBlock(ImageOrder sourceOrder, ImageOrder targetOrder) {
if (!sameBlocksPerDisk(sourceOrder, targetOrder)) {
throw new IllegalArgumentException("Cannot change ImageOrder unless the " +
"source and target are the same size!");
throw new IllegalArgumentException(textBundle.get("CannotChangeImageOrder")); //$NON-NLS-1$
}
for (int block = 0; block < sourceOrder.getBlocksOnDevice(); block++) {
byte[] blockData = sourceOrder.readBlock(block);
@ -645,8 +646,7 @@ public class AppleUtil {
ImageOrder sourceOrder = sourceDisk.getImageOrder();
ImageOrder targetOrder = targetDisk.getImageOrder();
if (!sameBlocksPerDisk(sourceOrder, targetOrder)) {
throw new IllegalArgumentException("Cannot compare disks unless the " +
"source and target are the same size!");
throw new IllegalArgumentException(textBundle.get("CannotCompareDisks")); //$NON-NLS-1$
}
for (int block = 0; block < sourceOrder.getBlocksOnDevice(); block++) {
byte[] sourceData = sourceOrder.readBlock(block);

View File

@ -25,7 +25,7 @@ public class ApplesoftToken {
}
public boolean isCommandSeparator() {
return ":".equals(stringValue);
return ":".equals(stringValue); //$NON-NLS-1$
}
public boolean isLineNumber() {
@ -46,8 +46,8 @@ public class ApplesoftToken {
public boolean isExpressionSeparator() {
return isCommandSeparator()
|| ",".equals(stringValue)
|| ";".equals(stringValue);
|| ",".equals(stringValue) //$NON-NLS-1$
|| ";".equals(stringValue); //$NON-NLS-1$
}
/**
@ -85,7 +85,7 @@ public class ApplesoftToken {
if (isLineNumber()) {
return Integer.toString(getLineNumber());
} else if (isToken()) {
return getTokenString() + " " + Integer.toHexString(getTokenValue());
return getTokenString() + " " + Integer.toHexString(getTokenValue()); //$NON-NLS-1$
} else {
return getStringValue();
}

View File

@ -40,24 +40,24 @@ import com.webcodepro.applecommander.storage.FileEntry;
*/
public class ApplesoftTokenizer {
private static String tokens[] = { // starts at $80
" END ", " FOR ", " NEXT ", " DATA ", " INPUT ", " DEL ",
" DIM ", " READ ", " GR ", " TEXT ", " PR# ", " IN# ",
" CALL ", " PLOT ", " HLIN ", " VLIN ", " HGR2 ", " HGR ",
" HCOLOR= ", " HPLOT ", " DRAW ", " XDRAW ", " HTAB ", " HOME ",
" ROT= ", " SCALE= ", " SHLOAD ", " TRACE ", " NOTRACE ", " NORMAL ",
" INVERSE ", " FLASH ", " COLOR= ", " POP ", " VTAB ", " HIMEM: ",
" LOMEM: ", " ONERR ", " RESUME ", " RECALL ", " STORE ", " SPEED= ",
" LET ", " GOTO ", " RUN ", " IF ", " RESTORE ", " & ",
" GOSUB ", " RETURN ", " REM ", " STOP ", " ON ", " WAIT ",
" LOAD ", " SAVE ", " DEF ", " POKE ", " PRINT ", " CONT ",
" LIST ", " CLEAR ", " GET ", " NEW ", " TAB( ", " TO ",
" FN ", " SPC( ", " THEN ", " AT ", " NOT ", " STEP ",
" +", " -", " *", "/", " ^", " AND ",
" OR ", " >", " = ", " <", " SGN", " INT",
" ABS", " USR", " FRE", " SCRN( ", " PDL", " POS",
" SQR", " RND", " LOG", " EXP", " COS", " SIN",
" TAN", " ATN", " PEEK", " LEN", " STR$", " VAL",
" ASC", " CHR$", " LEFT$", " RIGHT$", " MID$ " };
" END ", " FOR ", " NEXT ", " DATA ", " INPUT ", " DEL ", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
" DIM ", " READ ", " GR ", " TEXT ", " PR# ", " IN# ", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
" CALL ", " PLOT ", " HLIN ", " VLIN ", " HGR2 ", " HGR ", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
" HCOLOR= ", " HPLOT ", " DRAW ", " XDRAW ", " HTAB ", " HOME ", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
" ROT= ", " SCALE= ", " SHLOAD ", " TRACE ", " NOTRACE ", " NORMAL ", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
" INVERSE ", " FLASH ", " COLOR= ", " POP ", " VTAB ", " HIMEM: ", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
" LOMEM: ", " ONERR ", " RESUME ", " RECALL ", " STORE ", " SPEED= ", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
" LET ", " GOTO ", " RUN ", " IF ", " RESTORE ", " & ", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
" GOSUB ", " RETURN ", " REM ", " STOP ", " ON ", " WAIT ", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
" LOAD ", " SAVE ", " DEF ", " POKE ", " PRINT ", " CONT ", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
" LIST ", " CLEAR ", " GET ", " NEW ", " TAB( ", " TO ", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
" FN ", " SPC( ", " THEN ", " AT ", " NOT ", " STEP ", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
" +", " -", " *", "/", " ^", " AND ", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
" OR ", " >", " = ", " <", " SGN", " INT", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
" ABS", " USR", " FRE", " SCRN( ", " PDL", " POS", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
" SQR", " RND", " LOG", " EXP", " COS", " SIN", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
" TAN", " ATN", " PEEK", " LEN", " STR$", " VAL", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
" ASC", " CHR$", " LEFT$", " RIGHT$", " MID$ " }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
private byte[] fileData;
private int offset;
@ -109,10 +109,9 @@ public class ApplesoftTokenizer {
} else if ((byt & 0x80) != 0) {
int token = AppleUtil.getUnsignedByte(byt) - 0x80;
if (token >= tokens.length) {
return new ApplesoftToken(byt, "<UNKNOWN TOKEN>");
} else {
return new ApplesoftToken(byt, tokens[token]);
return new ApplesoftToken(byt, "<UNKNOWN TOKEN>"); //$NON-NLS-1$
}
return new ApplesoftToken(byt, tokens[token]);
} else if (byt == ':' || byt == ';' || byt == ',' || byt == '^'
|| byt == '+' || byt == '-' || byt == '*' || byt == '/') {
return new ApplesoftToken(new String(new byte[] { byt }));
@ -121,9 +120,9 @@ public class ApplesoftTokenizer {
while (true) {
char ch = (char)byt;
if (ch < 0x20) {
string.append("<CTRL-");
string.append("<CTRL-"); //$NON-NLS-1$
string.append((char)('@' + ch));
string.append(">");
string.append('>');
} else {
string.append(ch);
}