mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-06-26 17:29:50 +00:00
allow @IF(cond,@NA,
This commit is contained in:
parent
4b1bc7bd64
commit
4f62914924
|
@ -54,6 +54,7 @@ public abstract class AbstractFile implements DataSource
|
||||||
if (buffer.length <= 999999)
|
if (buffer.length <= 999999)
|
||||||
return HexFormatter.format (buffer, 0, buffer.length);
|
return HexFormatter.format (buffer, 0, buffer.length);
|
||||||
|
|
||||||
|
System.out.println ("**** truncating hex dump");
|
||||||
return HexFormatter.format (buffer, 0, 999999);
|
return HexFormatter.format (buffer, 0, 999999);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +67,7 @@ public abstract class AbstractFile implements DataSource
|
||||||
@Override
|
@Override
|
||||||
public JComponent getComponent ()
|
public JComponent getComponent ()
|
||||||
{
|
{
|
||||||
System.out.println ("In AbstractFile.getComponent()");
|
// System.out.println ("In AbstractFile.getComponent()");
|
||||||
JPanel panel = new JPanel ();
|
JPanel panel = new JPanel ();
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,7 +148,7 @@ public abstract class HiResImage extends AbstractFile
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ProdosConstants.FILE_TYPE_PNT: // 0xC0
|
case ProdosConstants.FILE_TYPE_PNT: // 0xC0
|
||||||
if (auxType == 0)
|
if (auxType == 0) // see Asimov disks/images/gs/programming/fta_code/GIFT5.SDK
|
||||||
auxText = "Paintworks Packed SHR Image";
|
auxText = "Paintworks Packed SHR Image";
|
||||||
else if (auxType == 1)
|
else if (auxType == 1)
|
||||||
auxText = "Packed Super Hi-Res Image";
|
auxText = "Packed Super Hi-Res Image";
|
||||||
|
|
|
@ -118,6 +118,7 @@ public class TextFile extends AbstractFile
|
||||||
int size = buffer.length;
|
int size = buffer.length;
|
||||||
int lastVal = 0;
|
int lastVal = 0;
|
||||||
boolean newFormat = true;
|
boolean newFormat = true;
|
||||||
|
boolean showAllOffsets = false;
|
||||||
|
|
||||||
if (newFormat)
|
if (newFormat)
|
||||||
{
|
{
|
||||||
|
@ -133,10 +134,10 @@ public class TextFile extends AbstractFile
|
||||||
|
|
||||||
while (ptr < size)
|
while (ptr < size)
|
||||||
{
|
{
|
||||||
int val = buffer[ptr++] & 0x7F; // strip hi-order bit
|
int val = buffer[ptr++] & 0x7F; // strip hi-order bit
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
++nulls;
|
++nulls;
|
||||||
else if (val == 0x0D) // carriage return
|
else if (val == 0x0D) // carriage return
|
||||||
text.append ("\n");
|
text.append ("\n");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -149,7 +150,10 @@ public class TextFile extends AbstractFile
|
||||||
nulls = 0;
|
nulls = 0;
|
||||||
}
|
}
|
||||||
else if (lastVal == 0x0D && newFormat)
|
else if (lastVal == 0x0D && newFormat)
|
||||||
text.append (" ");
|
if (showAllOffsets)
|
||||||
|
text.append (String.format ("%6d ", ptr - 1));
|
||||||
|
else
|
||||||
|
text.append (" ");
|
||||||
|
|
||||||
text.append ((char) val);
|
text.append ((char) val);
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,6 +182,8 @@ class Cell extends AbstractValue implements Comparable<Cell>
|
||||||
return " " + Format.justify (value.getText (), colWidth - 1, fmtChar);
|
return " " + Format.justify (value.getText (), colWidth - 1, fmtChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (colWidth == 1)
|
||||||
|
return ".";
|
||||||
return " " + Format.format (value, fmtChar, colWidth - 1);
|
return " " + Format.format (value, fmtChar, colWidth - 1);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -29,12 +29,14 @@ class Condition extends AbstractValue implements Iterable<Value>
|
||||||
if (pos > 0)
|
if (pos > 0)
|
||||||
{
|
{
|
||||||
conditionText = text.substring (0, pos);
|
conditionText = text.substring (0, pos);
|
||||||
valueText = text.substring (pos + comp.length ());
|
|
||||||
conditionExpression = new Expression (parent, cell, conditionText);
|
conditionExpression = new Expression (parent, cell, conditionText);
|
||||||
valueExpression = new Expression (parent, cell, valueText);
|
|
||||||
values.add (conditionExpression);
|
values.add (conditionExpression);
|
||||||
values.add (valueExpression);
|
|
||||||
comparator = comp;
|
comparator = comp;
|
||||||
|
|
||||||
|
valueText = text.substring (pos + comp.length ());
|
||||||
|
valueExpression = new Expression (parent, cell, valueText);
|
||||||
|
values.add (valueExpression);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,8 +46,14 @@ class Condition extends AbstractValue implements Iterable<Value>
|
||||||
if (text.startsWith ("@"))
|
if (text.startsWith ("@"))
|
||||||
{
|
{
|
||||||
conditionText = text;
|
conditionText = text;
|
||||||
valueText = "1";
|
conditionExpression = new Expression (parent, cell, text);
|
||||||
|
values.add (conditionExpression);
|
||||||
|
|
||||||
comparator = "=";
|
comparator = "=";
|
||||||
|
|
||||||
|
valueText = "1";
|
||||||
|
valueExpression = new Expression (parent, cell, valueText);
|
||||||
|
values.add (valueExpression);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
System.out.println ("No comparator and not a function");
|
System.out.println ("No comparator and not a function");
|
||||||
|
|
|
@ -310,6 +310,16 @@ class Expression extends AbstractValue implements Iterable<Value>
|
||||||
return text.substring (0, ptr + 1); // include closing parenthesis
|
return text.substring (0, ptr + 1); // include closing parenthesis
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static String getFunctionName (String text, int offset)
|
||||||
|
{
|
||||||
|
int pos1 = text.indexOf ('(', offset);
|
||||||
|
int pos2 = text.indexOf (',', offset);
|
||||||
|
|
||||||
|
if (pos1 > offset && pos1 < pos2)
|
||||||
|
return text.substring (offset, pos1);
|
||||||
|
return text.substring (offset, pos2);
|
||||||
|
}
|
||||||
|
|
||||||
private String getNumberText (String text)
|
private String getNumberText (String text)
|
||||||
{
|
{
|
||||||
int ptr = 0;
|
int ptr = 0;
|
||||||
|
|
|
@ -26,7 +26,18 @@ class If extends Function
|
||||||
|
|
||||||
if (functionText.charAt (pos1 + 1) == '@')
|
if (functionText.charAt (pos1 + 1) == '@')
|
||||||
{
|
{
|
||||||
textTrue = Expression.getBalancedText (functionText.substring (pos1 + 1));
|
String functionName = Expression.getFunctionName (functionText, pos1 + 1);
|
||||||
|
int nameLength = functionName.length ();
|
||||||
|
if (functionText.charAt (pos1 + nameLength + 1) == ',') // no brackets or parameters
|
||||||
|
{
|
||||||
|
// System.out.printf ("no parameters [%s]%n", functionName);
|
||||||
|
textTrue = functionName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
textTrue = Expression.getBalancedText (functionText.substring (pos1 + 1));
|
||||||
|
// System.out.printf ("parameters [%s]%n", textTrue);
|
||||||
|
}
|
||||||
// System.out.printf ("True : %s%n", textTrue);
|
// System.out.printf ("True : %s%n", textTrue);
|
||||||
expTrue = new Expression (parent, cell, textTrue);
|
expTrue = new Expression (parent, cell, textTrue);
|
||||||
pos2 = functionText.indexOf (',', pos1 + textTrue.length () + 1);
|
pos2 = functionText.indexOf (',', pos1 + textTrue.length () + 1);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user