From 85f0f17e61d598fdc488e651fd90402ed1067bcb Mon Sep 17 00:00:00 2001 From: Denis Molony Date: Thu, 14 Jan 2021 08:57:57 +1000 Subject: [PATCH] combine literals and strings under constants --- .../applefile/ApplesoftBasicProgram.java | 2 +- .../diskbrowser/applefile/SubLine.java | 7 ++++--- .../diskbrowser/gui/BasicPreferences.java | 4 ++-- .../bytezone/diskbrowser/gui/MenuHandler.java | 19 +++++++++---------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/com/bytezone/diskbrowser/applefile/ApplesoftBasicProgram.java b/src/com/bytezone/diskbrowser/applefile/ApplesoftBasicProgram.java index bf8c7a9..601358c 100644 --- a/src/com/bytezone/diskbrowser/applefile/ApplesoftBasicProgram.java +++ b/src/com/bytezone/diskbrowser/applefile/ApplesoftBasicProgram.java @@ -446,7 +446,7 @@ public class ApplesoftBasicProgram extends BasicProgram implements ApplesoftCons if (basicPreferences.showConstants && !constantsFloat.isEmpty ()) showSymbolsRightFloat (fullText, constantsFloat, "Float"); - if (basicPreferences.listStrings && stringsLine.size () > 0) + if (basicPreferences.showConstants && stringsLine.size () > 0) { heading (fullText, formatRight, "Line", "String"); for (int i = 0; i < stringsLine.size (); i++) diff --git a/src/com/bytezone/diskbrowser/applefile/SubLine.java b/src/com/bytezone/diskbrowser/applefile/SubLine.java index 821f304..9922496 100644 --- a/src/com/bytezone/diskbrowser/applefile/SubLine.java +++ b/src/com/bytezone/diskbrowser/applefile/SubLine.java @@ -111,9 +111,10 @@ public class SubLine implements ApplesoftConstants continue; } - if (Utility.isPossibleVariable (b) || b == Utility.ASCII_DOT) // A-Z 0-9 $ % . + if (Utility.isPossibleVariable (b) || Utility.isPossibleNumber (b)) { - if (var.isEmpty () && Utility.isDigit (b) && buffer[ptr - 2] == TOKEN_MINUS) + if (var.isEmpty () && Utility.isPossibleNumber (b) + && buffer[ptr - 2] == TOKEN_MINUS) var = "-"; var += (char) b; @@ -163,7 +164,7 @@ public class SubLine implements ApplesoftConstants if (!Utility.isLetter ((byte) var.charAt (0))) { if (is (TOKEN_GOTO) || is (TOKEN_GOSUB) || is (TOKEN_ON) || is (TOKEN_ONERR)) - return; + return; // ignore line numbers addNumber (var); return; } diff --git a/src/com/bytezone/diskbrowser/gui/BasicPreferences.java b/src/com/bytezone/diskbrowser/gui/BasicPreferences.java index c2dea4b..a0550bd 100644 --- a/src/com/bytezone/diskbrowser/gui/BasicPreferences.java +++ b/src/com/bytezone/diskbrowser/gui/BasicPreferences.java @@ -13,7 +13,6 @@ public class BasicPreferences public boolean onlyShowTargetLineNumbers = true; public boolean showCaret = false; public boolean showThen = true; - public boolean listStrings = false; public boolean blankAfterReturn = false; public boolean deleteExtraRemSpace = false; public boolean deleteExtraDataSpace = false; @@ -21,6 +20,7 @@ public class BasicPreferences public boolean showCalls = false; public boolean showSymbols = false; public boolean showConstants = false; + // public boolean listStrings = false; public boolean showFunctions = false; public boolean showDuplicateSymbols = false; public boolean splitDim = false; @@ -51,7 +51,7 @@ public class BasicPreferences text.append (String.format ("Show constants ........... %s%n", showConstants)); text.append (String.format ("Show functions ........... %s%n", showFunctions)); text.append (String.format ("Show duplicate symbols ... %s%n", showDuplicateSymbols)); - text.append (String.format ("List strings ............. %s%n", listStrings)); + // text.append (String.format ("List strings ............. %s%n", listStrings)); text.append (String.format ("Blank after RETURN ....... %s%n", blankAfterReturn)); text.append (String.format ("Delete extra REM space ... %s%n", deleteExtraRemSpace)); text.append (String.format ("Delete extra DATA space .. %s%n", deleteExtraDataSpace)); diff --git a/src/com/bytezone/diskbrowser/gui/MenuHandler.java b/src/com/bytezone/diskbrowser/gui/MenuHandler.java index fe3535d..37ee3b3 100755 --- a/src/com/bytezone/diskbrowser/gui/MenuHandler.java +++ b/src/com/bytezone/diskbrowser/gui/MenuHandler.java @@ -60,7 +60,7 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL private static final String PREFS_SHOW_CONSTANTS = "showConstants"; private static final String PREFS_SHOW_FUNCTIONS = "showFunctions"; private static final String PREFS_SHOW_DUPLICATE_SYMBOLS = "showDuplicateSymbols"; - private static final String PREFS_LIST_STRINGS = "listStrings"; + // private static final String PREFS_LIST_STRINGS = "listStrings"; private static final String PREFS_BLANK_AFTER_RETURN = "blankAfterReturn"; private static final String PREFS_DELETE_EXTRA_REM_SPACE = "deleteExtraRemSpace"; private static final String PREFS_DELETE_EXTRA_DATA_SPACE = "deleteExtraDataSpace"; @@ -164,10 +164,10 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL final JMenuItem showCallsItem = new JCheckBoxMenuItem ("List CALLs"); final JMenuItem showSymbolsItem = new JCheckBoxMenuItem ("List variables"); final JMenuItem showFunctionsItem = new JCheckBoxMenuItem ("List functions"); - final JMenuItem showConstantsItem = new JCheckBoxMenuItem ("List literals"); + final JMenuItem showConstantsItem = new JCheckBoxMenuItem ("List constants"); final JMenuItem showDuplicateSymbolsItem = new JCheckBoxMenuItem ("List duplicate variables"); - final JMenuItem listStringsItem = new JCheckBoxMenuItem ("List strings"); + // final JMenuItem listStringsItem = new JCheckBoxMenuItem ("List strings"); // Assembler menu items final JMenuItem showAssemblerTargetsItem = new JCheckBoxMenuItem ("Show targets"); @@ -276,7 +276,7 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL applesoftMenu.add (showSymbolsItem); applesoftMenu.add (showFunctionsItem); applesoftMenu.add (showConstantsItem); - applesoftMenu.add (listStringsItem); + // applesoftMenu.add (listStringsItem); applesoftMenu.add (showDuplicateSymbolsItem); assemblerMenu.add (showAssemblerHeaderItem); @@ -292,9 +292,8 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL alignAssignItem, showBasicTargetsItem, onlyShowTargetLinesItem, showCaretItem, showThenItem, blankAfterReturn, deleteExtraRemSpace, deleteExtraDataSpace)); - applesoftXrefItems = new ArrayList ( - Arrays.asList (showXrefItem, showCallsItem, showSymbolsItem, showFunctionsItem, - showConstantsItem, listStringsItem, showDuplicateSymbolsItem)); + applesoftXrefItems = new ArrayList (Arrays.asList (showXrefItem, showCallsItem, + showSymbolsItem, showFunctionsItem, showConstantsItem, showDuplicateSymbolsItem)); ActionListener basicPreferencesAction = new ActionListener () { @@ -418,7 +417,7 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL basicPreferences.showSymbols = showSymbolsItem.isSelected (); basicPreferences.showFunctions = showFunctionsItem.isSelected (); basicPreferences.showConstants = showConstantsItem.isSelected (); - basicPreferences.listStrings = listStringsItem.isSelected (); + // basicPreferences.listStrings = listStringsItem.isSelected (); basicPreferences.showDuplicateSymbols = showDuplicateSymbolsItem.isSelected (); BasicProgram.setBasicPreferences (basicPreferences); @@ -586,7 +585,7 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL prefs.putBoolean (PREFS_SHOW_CONSTANTS, showConstantsItem.isSelected ()); prefs.putBoolean (PREFS_SHOW_DUPLICATE_SYMBOLS, showDuplicateSymbolsItem.isSelected ()); - prefs.putBoolean (PREFS_LIST_STRINGS, listStringsItem.isSelected ()); + // prefs.putBoolean (PREFS_LIST_STRINGS, listStringsItem.isSelected ()); prefs.putBoolean (PREFS_SHOW_TARGETS, showBasicTargetsItem.isSelected ()); prefs.putBoolean (PREFS_ONLY_SHOW_TARGETS, onlyShowTargetLinesItem.isSelected ()); prefs.putBoolean (PREFS_BLANK_AFTER_RETURN, blankAfterReturn.isSelected ()); @@ -647,7 +646,7 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL showConstantsItem.setSelected (prefs.getBoolean (PREFS_SHOW_CONSTANTS, false)); showDuplicateSymbolsItem .setSelected (prefs.getBoolean (PREFS_SHOW_DUPLICATE_SYMBOLS, false)); - listStringsItem.setSelected (prefs.getBoolean (PREFS_LIST_STRINGS, false)); + // listStringsItem.setSelected (prefs.getBoolean (PREFS_LIST_STRINGS, false)); showBasicTargetsItem.setSelected (prefs.getBoolean (PREFS_SHOW_TARGETS, false)); onlyShowTargetLinesItem .setSelected (prefs.getBoolean (PREFS_ONLY_SHOW_TARGETS, false));