mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-06-19 14:29:39 +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)
|
||||
return HexFormatter.format (buffer, 0, buffer.length);
|
||||
|
||||
System.out.println ("**** truncating hex dump");
|
||||
return HexFormatter.format (buffer, 0, 999999);
|
||||
}
|
||||
|
||||
|
@ -66,7 +67,7 @@ public abstract class AbstractFile implements DataSource
|
|||
@Override
|
||||
public JComponent getComponent ()
|
||||
{
|
||||
System.out.println ("In AbstractFile.getComponent()");
|
||||
// System.out.println ("In AbstractFile.getComponent()");
|
||||
JPanel panel = new JPanel ();
|
||||
return panel;
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ public abstract class HiResImage extends AbstractFile
|
|||
break;
|
||||
|
||||
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";
|
||||
else if (auxType == 1)
|
||||
auxText = "Packed Super Hi-Res Image";
|
||||
|
|
|
@ -118,6 +118,7 @@ public class TextFile extends AbstractFile
|
|||
int size = buffer.length;
|
||||
int lastVal = 0;
|
||||
boolean newFormat = true;
|
||||
boolean showAllOffsets = false;
|
||||
|
||||
if (newFormat)
|
||||
{
|
||||
|
@ -133,10 +134,10 @@ public class TextFile extends AbstractFile
|
|||
|
||||
while (ptr < size)
|
||||
{
|
||||
int val = buffer[ptr++] & 0x7F; // strip hi-order bit
|
||||
int val = buffer[ptr++] & 0x7F; // strip hi-order bit
|
||||
if (val == 0)
|
||||
++nulls;
|
||||
else if (val == 0x0D) // carriage return
|
||||
else if (val == 0x0D) // carriage return
|
||||
text.append ("\n");
|
||||
else
|
||||
{
|
||||
|
@ -149,7 +150,10 @@ public class TextFile extends AbstractFile
|
|||
nulls = 0;
|
||||
}
|
||||
else if (lastVal == 0x0D && newFormat)
|
||||
text.append (" ");
|
||||
if (showAllOffsets)
|
||||
text.append (String.format ("%6d ", ptr - 1));
|
||||
else
|
||||
text.append (" ");
|
||||
|
||||
text.append ((char) val);
|
||||
}
|
||||
|
|
|
@ -182,6 +182,8 @@ class Cell extends AbstractValue implements Comparable<Cell>
|
|||
return " " + Format.justify (value.getText (), colWidth - 1, fmtChar);
|
||||
}
|
||||
|
||||
if (colWidth == 1)
|
||||
return ".";
|
||||
return " " + Format.format (value, fmtChar, colWidth - 1);
|
||||
|
||||
default:
|
||||
|
|
|
@ -29,12 +29,14 @@ class Condition extends AbstractValue implements Iterable<Value>
|
|||
if (pos > 0)
|
||||
{
|
||||
conditionText = text.substring (0, pos);
|
||||
valueText = text.substring (pos + comp.length ());
|
||||
conditionExpression = new Expression (parent, cell, conditionText);
|
||||
valueExpression = new Expression (parent, cell, valueText);
|
||||
values.add (conditionExpression);
|
||||
values.add (valueExpression);
|
||||
|
||||
comparator = comp;
|
||||
|
||||
valueText = text.substring (pos + comp.length ());
|
||||
valueExpression = new Expression (parent, cell, valueText);
|
||||
values.add (valueExpression);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -44,8 +46,14 @@ class Condition extends AbstractValue implements Iterable<Value>
|
|||
if (text.startsWith ("@"))
|
||||
{
|
||||
conditionText = text;
|
||||
valueText = "1";
|
||||
conditionExpression = new Expression (parent, cell, text);
|
||||
values.add (conditionExpression);
|
||||
|
||||
comparator = "=";
|
||||
|
||||
valueText = "1";
|
||||
valueExpression = new Expression (parent, cell, valueText);
|
||||
values.add (valueExpression);
|
||||
}
|
||||
else
|
||||
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
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
int ptr = 0;
|
||||
|
|
|
@ -26,7 +26,18 @@ class If extends Function
|
|||
|
||||
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);
|
||||
expTrue = new Expression (parent, cell, textTrue);
|
||||
pos2 = functionText.indexOf (',', pos1 + textTrue.length () + 1);
|
||||
|
|
Loading…
Reference in New Issue
Block a user