(not part of client build) added single makefile controlled switchpoint using awk generated Java source file for ASSERT and DEBUG in ifcui

This commit is contained in:
jband%netscape.com 1998-09-16 19:04:53 +00:00
parent b07df41324
commit 2de73cf99d
39 changed files with 329 additions and 339 deletions

View File

@ -2,7 +2,7 @@
The build system here currently supports only Microsoft nmake (I use the one
from MSDEV 4.2). It assumes that Symantec Visual Cafe is installed (i.e. it uses
sj.exe), and also uses awk. I mostly use the 4NT shell, but I think that
sj.exe), and also uses gawk. I mostly use the 4NT shell, but I think that
everything still works with the default NT shell.
This system can build all the Java code here. It can also do jar packaging (with

16
js/jsdj/build/gen_dbg.awk Normal file
View File

@ -0,0 +1,16 @@
#
# This requires -vpackage_name=name.of.the.package -vvalue=[true|false]
#
BEGIN{
print
print "// generated automatically by gen_dbg.awk"
print
print "package "package_name";"
print
print "public interface AS"
print "{"
print " public static final boolean S = "value";"
print " public static final boolean DEBUG = "value";"
print "}"
}

View File

@ -253,6 +253,18 @@ api_corba_fast :
@echo building com.netscape.jsdebugging.api.corba
@sj $(CORBA_JAVA_FLAGS) $(JSDEBUGGING_DIR)\api\corba\*.java
palomar_assert_on :
@echo generating com.netscape.jsdebugging.ifcui.palomar.util with assert on
@gawk -f $(BUILD_DIR)\gen_dbg.awk -vvalue=true -vpackage_name=com.netscape.jsdebugging.ifcui.palomar.util > $(JSDEBUGGING_DIR)\ifcui\palomar\util\AS.java
@echo building com.netscape.jsdebugging.ifcui.palomar.util
@sj $(JAVAFLAGS) $(JSDEBUGGING_DIR)\ifcui\palomar\util\*.java
palomar_assert_off :
@echo generating com.netscape.jsdebugging.ifcui.palomar.util with assert on
@gawk -f $(BUILD_DIR)\gen_dbg.awk -vvalue=false -vpackage_name=com.netscape.jsdebugging.ifcui.palomar.util > $(JSDEBUGGING_DIR)\ifcui\palomar\util\AS.java
@echo building com.netscape.jsdebugging.ifcui.palomar.util
@sj $(JAVAFLAGS) $(JSDEBUGGING_DIR)\ifcui\palomar\util\*.java
########## packaging #################
JSLOGGER_CLASS_FILES = \

View File

@ -22,7 +22,7 @@
package com.netscape.jsdebugging.ifcui;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.api.*;
@ -48,7 +48,7 @@ public class Breakpoint
{
this();
_loc = loc;
if(ASS)ER.T(null!=loc,"null location in Breakpoint ctor",this);
if(AS.S)ER.T(null!=loc,"null location in Breakpoint ctor",this);
}
public Breakpoint()
@ -69,7 +69,7 @@ public class Breakpoint
public void putHook(Script script, Hook hook)
{
if(ASS)ER.T(null==_hooks.get(script),"putting an existing hook",this);
if(AS.S)ER.T(null==_hooks.get(script),"putting an existing hook",this);
_hooks.put(script, hook);
}
@ -81,7 +81,7 @@ public class Breakpoint
public Hook removeHook(Script script)
{
Hook hook = (Hook) _hooks.remove(script);
if(ASS)ER.T(null!=hook,"removing a non-existant hook",this);
if(AS.S)ER.T(null!=hook,"removing a non-existant hook",this);
return hook;
}
@ -94,8 +94,8 @@ public class Breakpoint
// override Object
public boolean equals(Object obj)
{
if(ASS)ER.T(obj!=null,"null object handed to Breakpoint equals",this);
if(ASS)ER.T(obj instanceof Breakpoint,"non-Breakpoint obect handed to Breakpoint equals",this);
if(AS.S)ER.T(obj!=null,"null object handed to Breakpoint equals",this);
if(AS.S)ER.T(obj instanceof Breakpoint,"non-Breakpoint obect handed to Breakpoint equals",this);
return _loc.equals( ((Breakpoint)obj)._loc );
}
@ -108,8 +108,8 @@ public class Breakpoint
// implement Comparable
public int compareTo(Object obj)
{
if(ASS)ER.T(obj!=null,"null obect handed to Breakpoint compareTo",this);
if(ASS)ER.T(obj instanceof Breakpoint,"non-Breakpoint obect handed to Breakpoint compareTo",this);
if(AS.S)ER.T(obj!=null,"null obect handed to Breakpoint compareTo",this);
if(AS.S)ER.T(obj instanceof Breakpoint,"non-Breakpoint obect handed to Breakpoint compareTo",this);
Breakpoint other = (Breakpoint) obj;
return _loc.compareTo(((Breakpoint)obj)._loc);
@ -139,6 +139,5 @@ public class Breakpoint
private Hashtable _hooks;
private Location _loc;
private String _breakCondition;
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -24,7 +24,7 @@ package com.netscape.jsdebugging.ifcui;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.layout.*;
class BreakpointEditorDialog

View File

@ -26,7 +26,7 @@ import java.util.Observable;
import java.util.Observer;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.api.*;
import netscape.security.PrivilegeManager;
@ -41,7 +41,7 @@ public class BreakpointTyrant
super();
_emperor = emperor;
_controlTyrant = emperor.getControlTyrant();
if(ASS)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_controlTyrant,"emperor init order problem", this);
PrivilegeManager.enablePrivilege("Debugger");
_dc = _emperor.getDebugController();
@ -55,7 +55,7 @@ public class BreakpointTyrant
_controlTyrant.addObserver(this);
if(ASS)
if(AS.DEBUG)
{
_uiThreadForAssertCheck = Thread.currentThread();
}
@ -82,7 +82,7 @@ public class BreakpointTyrant
if( null != (bp = findBreakpoint(loc)) )
{
if(ASS)ER.T(false,"attempted to add existing Breakpoint: "+bp,this);
if(AS.S)ER.T(false,"attempted to add existing Breakpoint: "+bp,this);
return bp;
}
@ -100,7 +100,7 @@ public class BreakpointTyrant
{
if( null == findBreakpoint(bp) )
{
if(ASS)ER.T(false,"attempted to remove non-existant Breakpoint: "+bp,this);
if(AS.S)ER.T(false,"attempted to remove non-existant Breakpoint: "+bp,this);
return;
}
@ -310,7 +310,7 @@ public class BreakpointTyrant
continue;
JSPC pc = script.getClosestPC(bp.getLine());
// if(ASS)ER.T(null==pc,"null returned from script.getClosestPC",this);
// if(AS.S)ER.T(null==pc,"null returned from script.getClosestPC",this);
if( null == pc )
continue;
@ -377,7 +377,7 @@ public class BreakpointTyrant
Breakpoint bp = (Breakpoint) vec.elementAt(i);
JSPC pc = script.getClosestPC(bp.getLine());
// if(ASS)ER.T(null==pc,"null returned from script.getClosestPC",this);
// if(AS.S)ER.T(null==pc,"null returned from script.getClosestPC",this);
if( null == pc )
continue;
@ -436,7 +436,7 @@ public class BreakpointTyrant
// helper
private void _notifyObservers( int type, Breakpoint bp )
{
if(ASS)ER.T(Thread.currentThread()==_uiThreadForAssertCheck,"_notifyObservers called on thread other than UI thread",this);
if(AS.S)ER.T(Thread.currentThread()==_uiThreadForAssertCheck,"_notifyObservers called on thread other than UI thread",this);
setChanged();
notifyObservers( new BreakpointTyrantUpdate(type,bp) );
}
@ -444,7 +444,7 @@ public class BreakpointTyrant
// these are called by our script hook
public void justLoadedScript(Script script)
{
// if(ASS)System.out.println( "loaded script: " + script );
// if(AS.DEBUG)System.out.println( "loaded script: " + script );
if( ! _enabled )
return;
if( ! script.isValid() )
@ -459,7 +459,7 @@ public class BreakpointTyrant
}
public void aboutToUnloadScript(Script script)
{
// if(ASS)System.out.println( "unloaded script: " + script );
// if(AS.DEBUG)System.out.println( "unloaded script: " + script );
if( ! _enabled )
return;
synchronized(this)
@ -501,8 +501,6 @@ public class BreakpointTyrant
private BPTyrantScriptHook _scriptHook;
private boolean _enabled = false;
private Thread _uiThreadForAssertCheck = null;
private static final boolean ASS = true; // enable ASSERT support?
}
// used here only...

View File

@ -26,7 +26,7 @@ import java.util.Observable;
import java.util.Observer;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.layout.*;
public class BreakpointView
@ -49,8 +49,8 @@ public class BreakpointView
_breakpointTyrant = emperor.getBreakpointTyrant();
_commandTyrant = emperor.getCommandTyrant();
if(ASS)ER.T(null!=_breakpointTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_commandTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_breakpointTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_commandTyrant,"emperor init order problem", this);
_breakpointTyrant.addObserver(this);
@ -307,7 +307,7 @@ public class BreakpointView
public boolean editBreakpoint( Breakpoint bp )
{
if(ASS)ER.T(null!=bp,"null Breakpoint", this);
if(AS.S)ER.T(null!=bp,"null Breakpoint", this);
String condition = bp.getBreakCondition();
if( null == condition )
@ -373,8 +373,6 @@ public class BreakpointView
private static final String EDIT_CMD = "EDIT_CMD";
private static final String DEL_CMD = "DEL_CMD";
private static final String DONE_CMD = "DONE_CMD";
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -5,9 +5,9 @@ package com.netscape.jsdebugging.ifcui;
class BuildDate
{
// Tuesday, September 15, 1998 at 12:00 PM
// Wednesday, September 16, 1998 at 11:58 AM
public static final long buildDate = 905886043000L;
public static final long buildDate = 905972322000L;
public static final java.util.Date date()
{

View File

@ -27,7 +27,7 @@ import java.util.Observer;
import netscape.security.PrivilegeManager;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.PopupButton;
import com.netscape.jsdebugging.api.*;
@ -116,10 +116,10 @@ public class CommandTyrant
// ............................................
// check in debugging build only...
if(ASS)
if(AS.DEBUG)
{
for( i = 0; i < CMD_COUNT; i++ )
if(ASS)ER.T(null!=_cmdStatesArray[i].name, "name not set for cmdstate number " + i, this);
if(AS.S)ER.T(null!=_cmdStatesArray[i].name, "name not set for cmdstate number " + i, this);
}
// build the hashtable
@ -289,22 +289,22 @@ public class CommandTyrant
{
Class.forName("java.awt.datatransfer.Clipboard");
Class.forName("netscape.application.jdk11compatibility.JDKClipboard");
// if(ASS)System.out.println( "using native clipboard");
// if(AS.DEBUG)System.out.println( "using native clipboard");
}
catch(Exception e)
{
_usingLocalClipboard = true;
// if(ASS)System.out.println( "using local clipboard");
// if(AS.DEBUG)System.out.println( "using local clipboard");
}
if(ASS)ER.T(null!=_controlTyrant ,"emperor init order problem", this);
if(ASS)ER.T(null!=_breakpointTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_sourceTyrant ,"emperor init order problem", this);
if(ASS)ER.T(null!=_stackTyrant ,"emperor init order problem", this);
if(ASS)ER.T(null!=_watchTyrant ,"emperor init order problem", this);
if(ASS)ER.T(null!=_consoleTyrant ,"emperor init order problem", this);
if(ASS)ER.T(null!=_inspectorTyrant ,"emperor init order problem", this);
if(AS.S)ER.T(null!=_controlTyrant ,"emperor init order problem", this);
if(AS.S)ER.T(null!=_breakpointTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_sourceTyrant ,"emperor init order problem", this);
if(AS.S)ER.T(null!=_stackTyrant ,"emperor init order problem", this);
if(AS.S)ER.T(null!=_watchTyrant ,"emperor init order problem", this);
if(AS.S)ER.T(null!=_consoleTyrant ,"emperor init order problem", this);
if(AS.S)ER.T(null!=_inspectorTyrant ,"emperor init order problem", this);
_controlTyrant.addObserver(this);
_sourceTyrant.addObserver(this);
@ -348,7 +348,7 @@ public class CommandTyrant
CmdState cmdState = findCmdState(cmd);
if( null == cmdState )
{
if(ASS)ER.T( false, "failed to find cmdState named: " + cmd, this);
if(AS.S)ER.T( false, "failed to find cmdState named: " + cmd, this);
return;
}
switch(cmdState.id)
@ -592,7 +592,7 @@ public class CommandTyrant
Test.doTest(_emperor);
break;
default:
if(ASS)ER.T( false, "cmdState id not handled: " + cmdState.id, this);
if(AS.S)ER.T( false, "cmdState id not handled: " + cmdState.id, this);
break;
}
}
@ -610,7 +610,7 @@ public class CommandTyrant
catch(Exception e)
{
_usingLocalClipboard = true;
// if(ASS)System.out.println( "switching to use local clipboard");
// if(AS.DEBUG)System.out.println( "switching to use local clipboard");
}
}
@ -628,7 +628,7 @@ public class CommandTyrant
catch(Exception e)
{
_usingLocalClipboard = true;
// if(ASS)System.out.println( "switching to use local clipboard");
// if(AS.DEBUG)System.out.println( "switching to use local clipboard");
}
}
return _localClipboard;
@ -735,8 +735,6 @@ public class CommandTyrant
private CmdState[] _cmdStatesArray;
private Hashtable _cmdStatesHashtable;
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -26,7 +26,7 @@ import java.util.Observable;
import java.util.Observer;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.layout.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.toolbar.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.toolTip.*;
@ -61,8 +61,8 @@ public class CommandView
_controlTyrant = emperor.getControlTyrant();
_commandTyrant = emperor.getCommandTyrant();
if(ASS)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_commandTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_commandTyrant,"emperor init order problem", this);
_commandTyrant.addObserver(this);
@ -73,7 +73,7 @@ public class CommandView
for( int i = 0; i < count; i++ )
{
CmdState state = _commandTyrant.findCmdState(i);
if(ASS)ER.T(null!=state,"invalid cmd state initing _items",this);
if(AS.S)ER.T(null!=state,"invalid cmd state initing _items",this);
_items[i] = new CmdViewItem(state.enabled,state.checked);
}
@ -201,7 +201,7 @@ public class CommandView
private void addMenuItem( int id, String text, MenuItem menuitem )
{
CmdState state = _commandTyrant.findCmdState(id);
if(ASS)ER.T(null!=state,"invalid cmd state while creating menu item",this);
if(AS.S)ER.T(null!=state,"invalid cmd state while creating menu item",this);
_items[id].menuItem = menuitem.submenu().addItem(text,state.name,_commandTyrant);
}
@ -215,7 +215,7 @@ public class CommandView
private void addButton( int id, String text, String tip, String image, boolean toggle )
{
CmdState state = _commandTyrant.findCmdState(id);
if(ASS)ER.T(null!=state,"invalid cmd state while creating buttons",this);
if(AS.S)ER.T(null!=state,"invalid cmd state while creating buttons",this);
CmdViewItem item = _items[id];
Bitmap bmp = _loadBitmap(image, true);
@ -241,12 +241,12 @@ public class CommandView
ClassLoader loader = getClass().getClassLoader();
if(null != loader)
{
// if(ASS)System.out.println("using loader.getResourceAsStream()");
// if(AS.DEBUG)System.out.println("using loader.getResourceAsStream()");
in = loader.getResourceAsStream(fullname);
}
else
{
// if(ASS)System.out.println("using ClassLoader.getSystemResourceAsStream()");
// if(AS.DEBUG)System.out.println("using ClassLoader.getSystemResourceAsStream()");
in = ClassLoader.getSystemResourceAsStream(fullname);
}
@ -297,7 +297,7 @@ public class CommandView
}
if(null == bitmap)
{
if(ASS)System.err.println("loading bitmap from jar failed, trying Bitmap.bitmapNamed()");
if(AS.DEBUG)System.err.println("loading bitmap from jar failed, trying Bitmap.bitmapNamed()");
bitmap = Bitmap.bitmapNamed(name);
}
@ -307,7 +307,7 @@ public class CommandView
private void refreshSingleItemState(int i, boolean force)
{
CmdState state = _commandTyrant.findCmdState(i);
if(ASS)ER.T(null!=state,"invalid cmd state in refreshAllStates()",this);
if(AS.S)ER.T(null!=state,"invalid cmd state in refreshAllStates()",this);
CmdViewItem item = _items[i];
if( null != item.button )
@ -366,8 +366,5 @@ public class CommandView
private boolean _oldPageListShowing;
private boolean _oldInterruptOn;
private boolean _oldBkeakpointSet;
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -26,7 +26,7 @@ import java.util.Observable;
import java.util.Observer;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import netscape.security.PrivilegeManager;
import netscape.security.ForbiddenTargetException;
import com.netscape.jsdebugging.api.*;
@ -42,8 +42,8 @@ public class ConsoleTyrant
_controlTyrant = emperor.getControlTyrant();
_stackTyrant = emperor.getStackTyrant();
if(ASS)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_stackTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_stackTyrant,"emperor init order problem", this);
// XXX Sim Hack...
@ -232,6 +232,4 @@ public class ConsoleTyrant
private int _accumulatorLine;
private ConsolePrinter _printer;
private String _errorString;
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -26,7 +26,7 @@ import java.util.Observable;
import java.util.Observer;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.layout.*;
import com.netscape.jsdebugging.api.*;
@ -44,9 +44,9 @@ public class ConsoleView
_consoleTyrant = emperor.getConsoleTyrant();
_commandTyrant = emperor.getCommandTyrant();
if(ASS)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_consoleTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_commandTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_consoleTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_commandTyrant,"emperor init order problem", this);
_editKeyTextFilter = new EditKeyTextFilter(_commandTyrant);
@ -154,7 +154,7 @@ public class ConsoleView
// get the text of the last item in the list
int listItemIndex = _listview.count() - 1;
if(ASS)ER.T(listItemIndex>=0,"bad listview item",this);
if(AS.S)ER.T(listItemIndex>=0,"bad listview item",this);
buf = new StringBuffer( _listview.itemAt(listItemIndex).title() );
_listview.removeItemAt(listItemIndex);
@ -334,8 +334,6 @@ public class ConsoleView
private static final String EVAL_CMD = "EVAL_CMD";
private static final String DRAW_CMD = "DRAW_CMD";
private static final boolean ASS = true; // enable ASSERT support?
}
class NoSelectListView extends BackgroundHackListView

View File

@ -26,7 +26,7 @@ import java.util.Observable;
import java.util.Observer;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import netscape.security.PrivilegeManager;
import netscape.security.ForbiddenTargetException;
import com.netscape.jsdebugging.api.*;
@ -66,7 +66,7 @@ public class ControlTyrant
else
_useServerSideStepper = false;
if(ASS)
if(AS.DEBUG)
{
_uiThreadForAssertCheck = Thread.currentThread();
}
@ -89,7 +89,7 @@ public class ControlTyrant
{
if( STOPPED == _state )
return _threadState;
if(ASS)ER.T(false,"getThreadState called when not really stopped",this);
if(AS.S)ER.T(false,"getThreadState called when not really stopped",this);
return null;
}
@ -97,7 +97,7 @@ public class ControlTyrant
{
if( STOPPED == _state )
return _pc;
if(ASS)ER.T(false,"getPC called when not really stopped",this);
if(AS.S)ER.T(false,"getPC called when not really stopped",this);
return null;
}
@ -105,7 +105,7 @@ public class ControlTyrant
{
if( STOPPED == _state )
return _sourceLocation;
if(ASS)ER.T(false,"getSourceLocation called when not really stopped",this);
if(AS.S)ER.T(false,"getSourceLocation called when not really stopped",this);
return null;
}
@ -134,7 +134,7 @@ public class ControlTyrant
{
if( _state != STOPPED || _semaphore.available() || null == _threadState )
{
if(ASS)ER.T(false,"abort called when not really stopped",this);
if(AS.S)ER.T(false,"abort called when not really stopped",this);
return;
}
@ -174,7 +174,7 @@ public class ControlTyrant
{
if( _state != STOPPED || _semaphore.available() )
{
if(ASS)ER.T(false,"_setServerSideStepper called when not really stopped",this);
if(AS.S)ER.T(false,"_setServerSideStepper called when not really stopped",this);
return;
}
_interrupt = false;
@ -192,7 +192,7 @@ public class ControlTyrant
_dc.sendInterruptStepOut(_threadState);
break;
default:
if(ASS)ER.T(false,"invalid type passed to _setServerSideStepper",this);
if(AS.S)ER.T(false,"invalid type passed to _setServerSideStepper",this);
return;
}
_serverSideStepperIsSet = true;
@ -205,7 +205,7 @@ public class ControlTyrant
{
if( _state != STOPPED || _semaphore.available() )
{
if(ASS)ER.T(false,"_setStepHandler called when not really stopped",this);
if(AS.S)ER.T(false,"_setStepHandler called when not really stopped",this);
return;
}
_interrupt = false;
@ -235,11 +235,11 @@ public class ControlTyrant
{
if( _state != STOPPED || _semaphore.available() )
{
if(ASS)ER.T(false,"_continueAndNotify called when not really stopped",this);
if(AS.S)ER.T(false,"_continueAndNotify called when not really stopped",this);
return;
}
// if(ASS){System.out.println( "running again" );}
// if(AS.DEBUG){System.out.println( "running again" );}
// transition state
_state = RUNNING;
@ -250,14 +250,14 @@ public class ControlTyrant
{
_semaphore.release();
_threadState.resume();
// if(ASS){System.out.println( "returning after interrupt" );}
// if(AS.DEBUG){System.out.println( "returning after interrupt" );}
}
}
public synchronized void evaluatingBreakpoint(boolean b)
{
_evaluatingBreakpoint += (b ? 1 : -1);
if(ASS)ER.T(_evaluatingBreakpoint >= 0,"_evaluatingBreakpoint less than zero",this);
if(AS.S)ER.T(_evaluatingBreakpoint >= 0,"_evaluatingBreakpoint less than zero",this);
}
public synchronized void breakpointHookCalledButElectedNotToStop(JSThreadState ts)
@ -282,30 +282,30 @@ public class ControlTyrant
// called by both breakpoints and interrupt hook (on JS thread)
void aboutToExecute(JSThreadState debug, JSPC pc, Hook hook)
{
if(ASS)Log.trace("ControlTyrant.aboutToExecute", "1) entered" );
if(AS.DEBUG)Log.trace("ControlTyrant.aboutToExecute", "1) entered" );
if( ! _enabled )
{
if(ASS)Log.trace("ControlTyrant.aboutToExecute", "2) exit, ! _enabled" );
if(AS.DEBUG)Log.trace("ControlTyrant.aboutToExecute", "2) exit, ! _enabled" );
return;
}
if( _evaluatingBreakpoint > 0 )
{
if(ASS)System.out.println("ignoring break while evaluating breakpoint");
if(AS.DEBUG)System.out.println("ignoring break while evaluating breakpoint");
return;
}
PrivilegeManager.enablePrivilege("Debugger");
// grab the semaphore (return if not available)
if(ASS)Log.trace("ControlTyrant.aboutToExecute", "3) about to call _semaphore.grab()" );
if(AS.DEBUG)Log.trace("ControlTyrant.aboutToExecute", "3) about to call _semaphore.grab()" );
if( ! _semaphore.grab() )
{
if(ASS)System.out.println( "blowing past nested break at: " + pc );
if(ASS)Log.trace("ControlTyrant.aboutToExecute", "4) exit _semaphore.grab() failed" );
if(AS.DEBUG)System.out.println( "blowing past nested break at: " + pc );
if(AS.DEBUG)Log.trace("ControlTyrant.aboutToExecute", "4) exit _semaphore.grab() failed" );
return;
}
if(ASS)Log.trace("ControlTyrant.aboutToExecute", "5) exit _semaphore.grab() succeeded" );
if(AS.DEBUG)Log.trace("ControlTyrant.aboutToExecute", "5) exit _semaphore.grab() succeeded" );
if( hook instanceof CtrlDebugBreakHook )
{
@ -326,9 +326,9 @@ public class ControlTyrant
_threadState = debug;
_pc = pc;
if(ASS)Log.trace("ControlTyrant.aboutToExecute", "6) about to call _pc.getSourceLocation()");
if(AS.DEBUG)Log.trace("ControlTyrant.aboutToExecute", "6) about to call _pc.getSourceLocation()");
_sourceLocation = (JSSourceLocation) _pc.getSourceLocation();
if(ASS)Log.trace("ControlTyrant.aboutToExecute", "7) _pc.getSourceLocation() returned");
if(AS.DEBUG)Log.trace("ControlTyrant.aboutToExecute", "7) _pc.getSourceLocation() returned");
if(false)
{
@ -339,8 +339,8 @@ public class ControlTyrant
(_pc.getScript().getBaseLineNumber()+_pc.getScript().getLineExtent()-1)+"]";
String where = "pc: " + _pc.getPC();
if(ASS){System.out.println(leadin+" "+url+" "+fun+" "+script+" "+where);}
// if(ASS)Thread.dumpStack();
if(AS.DEBUG){System.out.println(leadin+" "+url+" "+fun+" "+script+" "+where);}
// if(AS.DEBUG)Thread.dumpStack();
}
// Hitting any other type of hook clears the interrupt stepper
@ -357,32 +357,32 @@ public class ControlTyrant
{
case StepHandler.STOP:
_stepHandler = null;
if(ASS)Log.trace("ControlTyrant.aboutToExecute", "8) StepHandler.STOP");
if(AS.DEBUG)Log.trace("ControlTyrant.aboutToExecute", "8) StepHandler.STOP");
break;
case StepHandler.CONTINUE_SEND_INTERRUPT:
if(ASS)Log.trace("ControlTyrant.aboutToExecute", "9) StepHandler.CONTINUE_SEND_INTERRUPT about to sendInterrupt");
if(AS.DEBUG)Log.trace("ControlTyrant.aboutToExecute", "9) StepHandler.CONTINUE_SEND_INTERRUPT about to sendInterrupt");
_dc.sendInterrupt();
if(ASS)Log.trace("ControlTyrant.aboutToExecute", "10) sendInterrupt returned");
if(AS.DEBUG)Log.trace("ControlTyrant.aboutToExecute", "10) sendInterrupt returned");
_semaphore.release();
if(ASS)Log.trace("ControlTyrant.aboutToExecute", "10.5) _semaphore.release() returned");
if(AS.DEBUG)Log.trace("ControlTyrant.aboutToExecute", "10.5) _semaphore.release() returned");
return;
case StepHandler.CONTINUE_DONE:
if(ASS)Log.trace("ControlTyrant.aboutToExecute", "11) StepHandler.CONTINUE_DONE");
if(AS.DEBUG)Log.trace("ControlTyrant.aboutToExecute", "11) StepHandler.CONTINUE_DONE");
_stepHandler = null;
_semaphore.release();
return;
}
}
// if(ASS){System.out.println( "about to send HIT_EXEC_HOOK" );}
// if(ASS){System.out.println( "this = " + this );}
// if(ASS){System.out.println( "HIT_EXEC_HOOK = " + HIT_EXEC_HOOK );}
// if(ASS){System.out.println( "hook = " + hook );}
// if(ASS){System.out.println( "Thread = " + Thread.currentThread() );}
// if(AS.DEBUG){System.out.println( "about to send HIT_EXEC_HOOK" );}
// if(AS.DEBUG){System.out.println( "this = " + this );}
// if(AS.DEBUG){System.out.println( "HIT_EXEC_HOOK = " + HIT_EXEC_HOOK );}
// if(AS.DEBUG){System.out.println( "hook = " + hook );}
// if(AS.DEBUG){System.out.println( "Thread = " + Thread.currentThread() );}
if(ASS)Log.trace("ControlTyrant.aboutToExecute", "12) about to call _threadState.leaveSuspended()");
if(AS.DEBUG)Log.trace("ControlTyrant.aboutToExecute", "12) about to call _threadState.leaveSuspended()");
_threadState.leaveSuspended();
if(ASS)Log.trace("ControlTyrant.aboutToExecute", "13) _threadState.leaveSuspended() returned");
if(AS.DEBUG)Log.trace("ControlTyrant.aboutToExecute", "13) _threadState.leaveSuspended() returned");
// post message to UI thread
_app.performCommandLater( this, HIT_EXEC_HOOK, hook );
@ -406,7 +406,7 @@ public class ControlTyrant
null == _sourceLocation.getURL() ||
null == st.findSourceItem(_sourceLocation.getURL()) )
{
if(ASS){System.out.println( "continuing: source text unavailable");}
if(AS.DEBUG){System.out.println( "continuing: source text unavailable");}
_state = STOPPED;
_continueAndNotify(false);
return;
@ -415,7 +415,7 @@ public class ControlTyrant
_emperor.setWaitCursor(true);
_interrupt = false;
// if(ASS){System.out.println( "got stop command, transitioning state" );}
// if(AS.DEBUG){System.out.println( "got stop command, transitioning state" );}
_emperor.bringAppToFront();
@ -442,7 +442,7 @@ public class ControlTyrant
}
else
{
if(ASS)ER.T(false,"unhandled command received in perform command: " + cmd,this);
if(AS.S)ER.T(false,"unhandled command received in perform command: " + cmd,this);
}
}
@ -498,8 +498,8 @@ public class ControlTyrant
}
catch(Exception e)
{
if(ASS){System.out.println("threw during wait for command response");}
if(ASS){System.out.println(e);}
if(AS.DEBUG){System.out.println("threw during wait for command response");}
if(AS.DEBUG){System.out.println(e);}
}
}
if( -1 == _debugBreakResponse )
@ -511,14 +511,14 @@ public class ControlTyrant
private void _notifyOfStateChange()
{
if(ASS)ER.T(Thread.currentThread()==_uiThreadForAssertCheck,"_notifyObservers called on thread other than UI thread",this);
if(AS.S)ER.T(Thread.currentThread()==_uiThreadForAssertCheck,"_notifyObservers called on thread other than UI thread",this);
setChanged();
notifyObservers( new ControlTyrantUpdate( ControlTyrantUpdate.STATE_CHANGED,_state) );
}
private void _notifyOfDebuggerDisabled()
{
if(ASS)ER.T(Thread.currentThread()==_uiThreadForAssertCheck,"_notifyObservers called on thread other than UI thread",this);
if(AS.S)ER.T(Thread.currentThread()==_uiThreadForAssertCheck,"_notifyObservers called on thread other than UI thread",this);
setChanged();
notifyObservers( new ControlTyrantUpdate( ControlTyrantUpdate.DEBUGGER_DISABLED,_state) );
}
@ -553,7 +553,7 @@ public class ControlTyrant
private final String HIT_EXEC_HOOK = "HIT_EXEC_HOOK";
private final String HIT_ERROR_REPORTER = "HIT_ERROR_REPORTER";
private static final boolean ASS = true; // enable ASSERT support?
}
/***************************************************************************/
@ -591,8 +591,8 @@ class CtrlInterruptHook
try {
if( null != _ctrlTyrant )
{
if(ASS)ER.T(debug instanceof JSThreadState,"wrong kind of threadstate",this);
if(ASS)ER.T(pc instanceof JSPC,"wrong kind of pc",this);
if(AS.S)ER.T(debug instanceof JSThreadState,"wrong kind of threadstate",this);
if(AS.S)ER.T(pc instanceof JSPC,"wrong kind of pc",this);
_ctrlTyrant.aboutToExecute( (JSThreadState)debug, (JSPC) pc, this );
}
if( null != _nextHook )
@ -606,7 +606,7 @@ class CtrlInterruptHook
private ControlTyrant _ctrlTyrant;
private InterruptHook _nextHook;
private static final boolean ASS = true; // enable ASSERT support?
}
// used internally only...
@ -625,8 +625,8 @@ class CtrlDebugBreakHook
try {
if( null != _ctrlTyrant )
{
if(ASS)ER.T(debug instanceof JSThreadState,"wrong kind of threadstate",this);
if(ASS)ER.T(pc instanceof JSPC,"wrong kind of pc",this);
if(AS.S)ER.T(debug instanceof JSThreadState,"wrong kind of threadstate",this);
if(AS.S)ER.T(pc instanceof JSPC,"wrong kind of pc",this);
_ctrlTyrant.aboutToExecute( (JSThreadState)debug, (JSPC) pc, this );
}
if( null != _nextHook )
@ -640,6 +640,5 @@ class CtrlDebugBreakHook
private ControlTyrant _ctrlTyrant;
private DebugBreakHook _nextHook;
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -27,7 +27,7 @@ import netscape.security.PrivilegeManager;
import netscape.security.ForbiddenTargetException;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.toolTip.*;
import netscape.javascript.*;
import com.netscape.jsdebugging.api.*;
@ -65,7 +65,7 @@ public class Emperor
_debuggerIsActive = true;
if(ASS)
if(AS.DEBUG)
{
_uiThreadForAssertCheck = Thread.currentThread();
}
@ -575,7 +575,7 @@ public class Emperor
{
try
{
if(ASS)ER.T(Thread.currentThread()==_uiThreadForAssertCheck,"bringAppToFront() called on non-UI thread",this);
if(AS.S)ER.T(Thread.currentThread()==_uiThreadForAssertCheck,"bringAppToFront() called on non-UI thread",this);
RootView mrv = Application.application().mainRootView();
if( null != mrv.mainWindow() )
return;
@ -667,7 +667,5 @@ public class Emperor
private Thread _uiThreadForAssertCheck = null;
private boolean _isApplet;
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -24,7 +24,7 @@ package com.netscape.jsdebugging.ifcui;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.api.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.layout.*;

View File

@ -24,7 +24,7 @@ package com.netscape.jsdebugging.ifcui;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
class HostNameDialog
extends InternalWindow

View File

@ -24,7 +24,7 @@ package com.netscape.jsdebugging.ifcui;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
public class InspectorNodeModel
{

View File

@ -26,7 +26,7 @@ import java.util.Observable;
import java.util.Observer;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import netscape.security.PrivilegeManager;
import netscape.security.ForbiddenTargetException;
import com.netscape.jsdebugging.api.*;
@ -42,8 +42,8 @@ public class InspectorTyrant
_controlTyrant = emperor.getControlTyrant();
_stackTyrant = emperor.getStackTyrant();
if(ASS)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_stackTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_stackTyrant,"emperor init order problem", this);
_controlTyrant.addObserver(this);
_stackTyrant.addObserver(this);
@ -158,7 +158,7 @@ public class InspectorTyrant
}
catch(NumberFormatException e)
{
if(ASS)ER.T(false,"failed to parse property name as number: "+name,this);
if(AS.S)ER.T(false,"failed to parse property name as number: "+name,this);
stringVec.addElement("["+name+"]");
}
}
@ -320,6 +320,4 @@ public class InspectorTyrant
private StackTyrant _stackTyrant;
private String _errorString;
private InspectorNodeModel _rootNode;
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -26,7 +26,7 @@ import java.util.Observable;
import java.util.Observer;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.layout.*;
public class InspectorView
@ -51,9 +51,9 @@ public class InspectorView
_controlTyrant = emperor.getControlTyrant();
_commandTyrant = emperor.getCommandTyrant();
if(ASS)ER.T(null!=_inspectorTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_commandTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_inspectorTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_commandTyrant,"emperor init order problem", this);
_editKeyTextFilter = new EditKeyTextFilter(_commandTyrant);
@ -308,7 +308,7 @@ public class InspectorView
private void _pushItemToTop(int index)
{
Rect rectitem = _listview.rectForItemAt(index);
// if(ASS)System.out.println("rectitem.y "+rectitem.y);
// if(AS.DEBUG)System.out.println("rectitem.y "+rectitem.y);
((ScrollView)(_listview.superview())).scrollBy( 0, -rectitem.y );
}
@ -455,7 +455,7 @@ public class InspectorView
private static final String COPY_VALUE_CMD = "COPY_VALUE_CMD";
private static final String DONE_CMD = "DONE_CMD";
private static final boolean ASS = true; // enable ASSERT support?
}
/***************************************************************************/
@ -474,7 +474,7 @@ final class InspectorListView extends SmartItemListView
private InspectorView _iv;
private InspectorListItem _mousedItem;
private static final boolean ASS = true; // enable ASSERT support?
}
/***************************************************************************/
@ -597,7 +597,7 @@ final class InspectorListItem extends SmartListItem
private InspectorItemDrawer _drawer;
private InspectorNodeModel _model;
private static final boolean ASS = true; // enable ASSERT support?
}
/***************************************************************************/
@ -801,6 +801,4 @@ final class InspectorItemDrawer
private static final int _spacerDY = 3;
private static final int _boxDim = 11;
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -33,7 +33,7 @@ import com.netscape.jsdebugging.ifcui.palomar.widget.layout.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.toolbar.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.toolTip.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.PopupButton;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.AssertFailureHandler;
@ -63,12 +63,12 @@ public class JSDebuggerApp
// -- parsed below --
public void setMode(String s)
{
if(ASS)ER.T(null==_emperor, "attempt to setMode while running", this);
if(AS.S)ER.T(null==_emperor, "attempt to setMode while running", this);
_modeString = s;
}
public void setHost(String s)
{
if(ASS)ER.T(null==_emperor, "attempt to setHost while running", this);
if(AS.S)ER.T(null==_emperor, "attempt to setHost while running", this);
_host = s;
}
@ -109,7 +109,7 @@ public class JSDebuggerApp
return;
}
if(ASS)
if(AS.DEBUG)
{
Thread t = Thread.currentThread();
_uiThreadForAssertCheck = t;
@ -161,7 +161,7 @@ public class JSDebuggerApp
// this needs to be done after our mode is established
_initStartupPrefs();
if(ASS)
if(AS.DEBUG)
{
if( Emperor.LOCAL == _mode )
Log.setFilename("jsdclog.log", true);
@ -365,7 +365,7 @@ public class JSDebuggerApp
statusWindow.hide();
setWaitCursor(false);
if(ASS)Log.log(null, "startup success" );
if(AS.DEBUG)Log.log(null, "startup success" );
_signalInitSuccessToHTMLPage();
// System.out.println("++++ initForReal() end" );
}
@ -410,7 +410,7 @@ public class JSDebuggerApp
// assumes that wait cursor is showing!!!
private boolean userHasAgreedToLicense()
{
if(ASS)ER.T(_waitCount == 1,"hasUserAgreedToLicense() called when _waitCount != 1");
if(AS.S)ER.T(_waitCount == 1,"hasUserAgreedToLicense() called when _waitCount != 1");
String baseDir = Env.getCodebaseDir();
if( null == baseDir )
@ -484,7 +484,7 @@ public class JSDebuggerApp
if( PREVIEW_VERSION != 0 )
msg += " Preview Release "+PREVIEW_VERSION;
msg += "\n\n";
if(ASS || IS_INTERNAL_RELEASE || ALWAYS_SHOW_BUILD_DATE)
if(AS.DEBUG || IS_INTERNAL_RELEASE || ALWAYS_SHOW_BUILD_DATE)
msg += "Built: "+BuildDate.display()+"\n\n";
if( WILL_EXPIRE )
msg += "This software will expire in "+ daysTillDeath() +" days\n\n";
@ -631,7 +631,7 @@ public class JSDebuggerApp
// implement AssertFailureHandler
public int assertFailed( String msgRaw, String msgCooked, Object ob )
{
if(ASS)
if(AS.DEBUG)
{
// All these single use vars are here because the code
// used to allow for internal or external dlgs (and may again)
@ -661,8 +661,8 @@ public class JSDebuggerApp
{
_waitCount += set ? 1 : -1;
if(ASS)ER.T(_waitCount >= 0,"_waitCount went negative", this );
if(ASS)ER.T(Thread.currentThread()==_uiThreadForAssertCheck,"setWaitCursor() called on non-UI thread",this);
if(AS.S)ER.T(_waitCount >= 0,"_waitCount went negative", this );
if(AS.S)ER.T(Thread.currentThread()==_uiThreadForAssertCheck,"setWaitCursor() called on non-UI thread",this);
if( (1 == _waitCount && set) || (0 == _waitCount && !set) )
{
@ -704,6 +704,4 @@ public class JSDebuggerApp
private static final String EXIT_APP_CMD = "EXIT_APP_CMD";
private static final String LOAD_FAILED_CMD = "LOAD_FAILED_CMD";
private static final String SHOW_ABOUT_CMD = "SHOW_ABOUT_CMD";
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -26,7 +26,7 @@ import netscape.application.*;
import netscape.util.*;
import java.io.FileInputStream;
import com.netscape.jsdebugging.ifcui.palomar.widget.layout.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
class LicenseViewer
extends InternalWindow

View File

@ -25,7 +25,7 @@ package com.netscape.jsdebugging.ifcui;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.api.JSSourceLocation;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
// XXX implementation note: we currently maintain a string representaion for
// quick lookups. This will change when the Breakpoint becomes more complex...
@ -39,14 +39,14 @@ public class Location
public Location( JSSourceLocation jssl )
{
this( jssl.getURL(), jssl.getLine() );
if(ASS)ER.T(null!=jssl,"null JSSourceLocation passed to Location ctor",this);
if(AS.S)ER.T(null!=jssl,"null JSSourceLocation passed to Location ctor",this);
}
public Location( String url,
int line )
{
if(ASS)ER.T(null!=url,"null url in Location ctor",this);
if(ASS)ER.T(line >=0,"negative line in Location ctor",this);
if(AS.S)ER.T(null!=url,"null url in Location ctor",this);
if(AS.S)ER.T(line >=0,"negative line in Location ctor",this);
_url = url;
_line = line;
@ -68,8 +68,8 @@ public class Location
// override Object
public boolean equals(Object obj)
{
if(ASS)ER.T(obj!=null,"null obect handed to Location equals",this);
if(ASS)ER.T(obj instanceof Location,"non-Location obect handed to Location equals",this);
if(AS.S)ER.T(obj!=null,"null obect handed to Location equals",this);
if(AS.S)ER.T(obj instanceof Location,"non-Location obect handed to Location equals",this);
Location other = (Location) obj;
if( _stringRep.equals(other._stringRep) )
@ -86,8 +86,8 @@ public class Location
// implement Comparable
public int compareTo(Object obj)
{
if(ASS)ER.T(obj!=null,"null obect handed to Location compareTo",this);
if(ASS)ER.T(obj instanceof Location,"non-Location object handed to Location compareTo",this);
if(AS.S)ER.T(obj!=null,"null obect handed to Location compareTo",this);
if(AS.S)ER.T(obj instanceof Location,"non-Location object handed to Location compareTo",this);
Location other = (Location) obj;
int retval = _url.compareTo( other._url );
@ -120,7 +120,5 @@ public class Location
private String _url;
private int _line;
private String _stringRep;
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -26,7 +26,7 @@ import java.io.*;
import java.util.Date;
import netscape.security.PrivilegeManager;
import netscape.security.ForbiddenTargetException;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
public final class Log
{
@ -125,7 +125,7 @@ public final class Log
}
public static synchronized void setFilename(String filename, boolean useCodebase)
{
if(ASS)ER.T(null==_fullFilename,"tried to set filename after first log entry written");
if(AS.S)ER.T(null==_fullFilename,"tried to set filename after first log entry written");
_baseFilename = filename;
_useCodebase = useCodebase;
_generateFilename();
@ -236,7 +236,5 @@ public final class Log
private static boolean _useCodebase = false;
private static String _fullFilename = null;
private static String _baseFilename = "jsdlog.log";
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -26,7 +26,7 @@ import java.util.Observable;
import java.util.Observer;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.layout.*;
import com.netscape.jsdebugging.api.*;
@ -44,10 +44,10 @@ public class PageListView
_commandTyrant = emperor.getCommandTyrant();
_stackTyrant = emperor.getStackTyrant();
if(ASS)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_sourceTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_commandTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_stackTyrant ,"emperor init order problem", this);
if(AS.S)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_sourceTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_commandTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_stackTyrant ,"emperor init order problem", this);
_listview = new BackgroundHackListView();
@ -240,8 +240,6 @@ public class PageListView
private static final String CLOSE_CMD = "CLOSE_CMD";
private static final String OPEN_CMD = "OPEN_CMD";
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -24,7 +24,7 @@ package com.netscape.jsdebugging.ifcui;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
public class SmartListItem extends ListItem
{
@ -55,10 +55,10 @@ public class SmartListItem extends ListItem
protected final Rect myRect()
{
ListView lv = listView();
if(ASS)ER.T(lv!=null,"ListItem with no parent called myRect()",this);
if(AS.S)ER.T(lv!=null,"ListItem with no parent called myRect()",this);
return lv.rectForItem(this);
}
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -26,7 +26,7 @@ import java.util.Observable;
import java.util.Observer;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import netscape.security.PrivilegeManager;
import netscape.security.ForbiddenTargetException;
import com.netscape.jsdebugging.api.*;
@ -44,8 +44,8 @@ public class SourceTyrant
PrivilegeManager.enablePrivilege("Debugger");
_sourceTextProvider = _emperor.getSourceTextProvider();
if(ASS)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_sourceTextProvider,"no SourceTextProvider found",this);
if(AS.S)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_sourceTextProvider,"no SourceTextProvider found",this);
_controlTyrant.addObserver(this);
}
@ -99,7 +99,7 @@ public class SourceTyrant
if( _selectedSourceTextItem == s )
return;
// if(ASS)System.out.println("sel changed to " + s.getURL() );
// if(AS.DEBUG)System.out.println("sel changed to " + s.getURL() );
_selectedSourceTextItem = s;
_notifyObservers( SourceTyrantUpdate.SELECT_CHANGED, s );
@ -168,8 +168,8 @@ public class SourceTyrant
public synchronized void makeAdjustment( SourceTextItem sti, int line, int offset )
{
if(ASS)ER.T(null!=sti,"bad SourceTextItem in makeAdjustment",this);
if(ASS)ER.T(line >=0,"bad line in makeAdjustment",this);
if(AS.S)ER.T(null!=sti,"bad SourceTextItem in makeAdjustment",this);
if(AS.S)ER.T(line >=0,"bad line in makeAdjustment",this);
if( null == _adjustments )
{
@ -220,8 +220,8 @@ public class SourceTyrant
public int getAdjustment( SourceTextItem sti, int line )
{
if(ASS)ER.T(null!=sti,"bad SourceTextItem in getAdjustment",this);
if(ASS)ER.T(line >=0,"bad line in getAdjustment",this);
if(AS.S)ER.T(null!=sti,"bad SourceTextItem in getAdjustment",this);
if(AS.S)ER.T(line >=0,"bad line in getAdjustment",this);
if( null == _adjustments )
return 0;
@ -243,8 +243,8 @@ public class SourceTyrant
public int userLine2SystemLine( SourceTextItem sti, int line )
{
if(ASS)ER.T(null!=sti,"bad SourceTextItem in userLine2SystemLine",this);
if(ASS)ER.T(line >=0,"bad line in userLine2SystemLine",this);
if(AS.S)ER.T(null!=sti,"bad SourceTextItem in userLine2SystemLine",this);
if(AS.S)ER.T(line >=0,"bad line in userLine2SystemLine",this);
if( null == _adjustments )
return line;
@ -264,8 +264,8 @@ public class SourceTyrant
public int systemLine2UserLine( SourceTextItem sti, int line )
{
if(ASS)ER.T(null!=sti,"bad SourceTextItem in userLine2SystemLine",this);
if(ASS)ER.T(line >=0,"bad line in userLine2SystemLine",this);
if(AS.S)ER.T(null!=sti,"bad SourceTextItem in userLine2SystemLine",this);
if(AS.S)ER.T(line >=0,"bad line in userLine2SystemLine",this);
if( null == _adjustments )
return line;
@ -289,7 +289,7 @@ public class SourceTyrant
public int[] getUserAdjustedLineArray( SourceTextItem sti )
{
if(ASS)ER.T(null!=sti,"bad SourceTextItem in getUserAdjustedLineArray",this);
if(AS.S)ER.T(null!=sti,"bad SourceTextItem in getUserAdjustedLineArray",this);
if( null == _adjustments )
return null;
@ -318,7 +318,7 @@ public class SourceTyrant
for(int i = 0; i < count; i++)
{
AdjustmentItem adj = (AdjustmentItem) v.elementAt(i);
if(ASS)ER.T(adj.offset!=0,"adj.offset == 0",this);
if(AS.S)ER.T(adj.offset!=0,"adj.offset == 0",this);
cummulative_offset += adj.offset;
adj.cummulative_offset = cummulative_offset;
}
@ -339,8 +339,6 @@ public class SourceTyrant
private String _selectedText = null;
private Hashtable _adjustments = null;
private static final boolean ASS = true; // enable ASSERT support?
}
class AdjustmentItem

View File

@ -26,7 +26,7 @@ import java.util.Observable;
import java.util.Observer;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import java.io.StringBufferInputStream;
import java.io.DataInputStream;
import com.netscape.jsdebugging.ifcui.palomar.widget.layout.*;
@ -53,11 +53,11 @@ public class SourceView extends InternalWindow
_sourceViewManager = emperor.getSourceViewManager();
_stackTyrant = emperor.getStackTyrant();
if(ASS)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_sourceTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_breakpointTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_sourceViewManager,"emperor init order problem", this);
if(ASS)ER.T(null!=_stackTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_sourceTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_breakpointTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_sourceViewManager,"emperor init order problem", this);
if(AS.S)ER.T(null!=_stackTyrant,"emperor init order problem", this);
_sourceLineVectorModel =
new SourceLineVectorModel(this, _controlTyrant, _stackTyrant,
@ -294,7 +294,7 @@ public class SourceView extends InternalWindow
private String _selectedText = null;
private int _selectedLineNumber = 0;
private static final boolean ASS = true; // enable ASSERT support?
}
/***************************************************************************/
@ -399,7 +399,7 @@ final class SourceTextListView extends SmartItemListView
public void drawMarks()
{
if(ASS)ER.T(null!=_drawer,"SourceTextListView has null drawer",this);
if(AS.S)ER.T(null!=_drawer,"SourceTextListView has null drawer",this);
if( null == _drawer || null == _drawer.marksRect())
{
draw();
@ -413,7 +413,7 @@ final class SourceTextListView extends SmartItemListView
public void drawMarksOfItemAt(int i)
{
if(ASS)ER.T(null!=_drawer,"SourceTextListView has null drawer",this);
if(AS.S)ER.T(null!=_drawer,"SourceTextListView has null drawer",this);
if( null == _drawer )
{
drawItemAt(i);
@ -459,7 +459,7 @@ final class SourceTextListView extends SmartItemListView
private int _dragOrigin = -1;
private int _dragLast;
private int _dragAdjLineOrigin;
private static final boolean ASS = true; // enable ASSERT support?
}
/***************************************************************************/
@ -637,7 +637,7 @@ final class SourceTextItemDrawer
StringBuffer buf = new StringBuffer();
String s = String.valueOf(number);
int len = s.length();
if(ASS)ER.T(len<=_lineNumberColumnCount,"lineNumberColumnCount screwed up",this);
if(AS.S)ER.T(len<=_lineNumberColumnCount,"lineNumberColumnCount screwed up",this);
for( int i = 0; i < _lineNumberColumnCount-len; i++ )
buf.append('0');
@ -663,7 +663,7 @@ final class SourceTextItemDrawer
private boolean _showLineNumbers;
private int _charWidth;
private static final boolean ASS = true; // enable ASSERT support?
}
final class SourceTextListItem extends SmartListItem
@ -980,7 +980,6 @@ final class SourceTextListItem extends SmartListItem
private int _dragOrigin = -1;
private int _charCount;
private SourceTextItemDrawer _drawer;
private static final boolean ASS = true; // enable ASSERT support?
}
/***************************************************************************/

View File

@ -26,7 +26,7 @@ import java.util.Observable;
import java.util.Observer;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.api.*;
public class SourceViewManager
@ -41,9 +41,9 @@ public class SourceViewManager
_sourceTyrant = emperor.getSourceTyrant();
_stackTyrant = emperor.getStackTyrant();
if(ASS)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_sourceTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_stackTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_sourceTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_stackTyrant,"emperor init order problem", this);
_sourceViews = new Hashtable();
_preferedNewViewRect = new Rect(0,0,100,100);
@ -90,7 +90,7 @@ public class SourceViewManager
SourceTextItem sti =
_sourceTyrant.findSourceItem( loc.getURL() );
if(ASS)ER.T(null!=sti,"could not find SourceTextItem for " + loc.getURL(),this);
if(AS.S)ER.T(null!=sti,"could not find SourceTextItem for " + loc.getURL(),this);
if(null == sti)
return;
@ -145,11 +145,11 @@ public class SourceViewManager
private synchronized SourceView _createViewAtRect( Rect rect, SourceTextItem item )
{
if(ASS)ER.T(null!=rect,"null rect in _createViewAtRect", this);
if(AS.S)ER.T(null!=rect,"null rect in _createViewAtRect", this);
if( null != findView(item.getURL()) )
{
if(ASS)ER.T( false, "tried to create second SourceView for:" + item.getURL(), this);
if(AS.S)ER.T( false, "tried to create second SourceView for:" + item.getURL(), this);
return null;
}
@ -280,8 +280,6 @@ public class SourceViewManager
private String _selectedTextInMainSourceView = null;
private static final String UPDATE_MARKS = "UPDATE_MARKS";
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -26,7 +26,7 @@ import java.util.Observable;
import java.util.Observer;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.api.*;
public class StackTyrant
@ -39,7 +39,7 @@ public class StackTyrant
_emperor = emperor;
_controlTyrant = emperor.getControlTyrant();
if(ASS)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_controlTyrant,"emperor init order problem", this);
_controlTyrant.addObserver(this);
}
@ -62,11 +62,11 @@ public class StackTyrant
}
catch(InvalidInfoException e)
{
if(ASS)ER.T(false,"InvalidInfoException in StackTyrant",this);
if(AS.S)ER.T(false,"InvalidInfoException in StackTyrant",this);
}
if(ASS)ER.T(null!=stack,"stack is null!",this);
if(ASS)ER.T(0!=stack.length,"stack is empty!",this);
if(AS.S)ER.T(null!=stack,"stack is null!",this);
if(AS.S)ER.T(0!=stack.length,"stack is empty!",this);
if( null != stack )
{
@ -96,7 +96,7 @@ public class StackTyrant
{
if( null == _frameArray )
return null;
// if(ASS)ER.T(null!=_frameArray,"getCurrentFrame called when no frameArray!",this);
// if(AS.S)ER.T(null!=_frameArray,"getCurrentFrame called when no frameArray!",this);
return _frameArray[_currentFrameIndex];
}
@ -109,7 +109,7 @@ public class StackTyrant
if( ControlTyrant.STOPPED != _controlTyrant.getState() )
return null;
// if(ASS)ER.T(null!=_frameArray,"getCurrentLocation called when no frameArray!",this);
// if(AS.S)ER.T(null!=_frameArray,"getCurrentLocation called when no frameArray!",this);
StackFrameInfo rawframe = _frameArray[_currentFrameIndex];
if( null == rawframe || ! (rawframe instanceof JSStackFrameInfo) )
@ -122,7 +122,7 @@ public class StackTyrant
}
catch(InvalidInfoException e)
{
if(ASS)ER.T(false,"InvalidInfoException in StackTyrant",this);
if(AS.S)ER.T(false,"InvalidInfoException in StackTyrant",this);
return null;
}
return (JSSourceLocation)pc.getSourceLocation();
@ -130,8 +130,8 @@ public class StackTyrant
public void setCurrentFrame( int i )
{
if(ASS)ER.T(null==_frameArray||i>=0,"setCurrentFrame index out of bounds!",this);
if(ASS)ER.T(null==_frameArray||i<_frameArray.length,"setCurrentFrame index out of bounds!",this);
if(AS.S)ER.T(null==_frameArray||i>=0,"setCurrentFrame index out of bounds!",this);
if(AS.S)ER.T(null==_frameArray||i<_frameArray.length,"setCurrentFrame index out of bounds!",this);
_currentFrameIndex = i;
_notifyCurrentFrameChanged();
}
@ -156,8 +156,6 @@ public class StackTyrant
private int _currentFrameIndex;
private StackFrameInfo[] _frameArray;
private static final boolean ASS = true; // enable ASSERT support?
}
class StackTyrantUpdate

View File

@ -26,7 +26,7 @@ import java.util.Observable;
import java.util.Observer;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.layout.*;
import com.netscape.jsdebugging.api.*;
@ -44,10 +44,10 @@ public class StackView extends InternalWindow
_commandTyrant = emperor.getCommandTyrant();
_sourceTyrant = emperor.getSourceTyrant();
if(ASS)ER.T(null!=_stackTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_commandTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_sourceTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_stackTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_commandTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_sourceTyrant,"emperor init order problem", this);
_listview = new BackgroundHackListView();
@ -126,7 +126,7 @@ public class StackView extends InternalWindow
}
catch(InvalidInfoException e)
{
if(ASS)ER.T(false,"InvalidInfoException in StackViewView",this);
if(AS.S)ER.T(false,"InvalidInfoException in StackViewView",this);
}
if( null != pc )
{
@ -203,7 +203,7 @@ public class StackView extends InternalWindow
private ListView _listview;
private static final boolean ASS = true; // enable ASSERT support?
}
class StackViewListItem extends ListItem
@ -232,7 +232,7 @@ class StackViewListItem extends ListItem
private StackViewItemDrawer _drawer;
private static final boolean ASS = true; // enable ASSERT support?
}
class StackViewItemDrawer
@ -306,6 +306,4 @@ class StackViewItemDrawer
private int _height;
private Polygon _polyExecPoint;
private Point _ptText;
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -24,7 +24,7 @@ package com.netscape.jsdebugging.ifcui;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
class StatusWindow
extends InternalWindow

View File

@ -23,6 +23,7 @@
package com.netscape.jsdebugging.ifcui;
import com.netscape.jsdebugging.api.*;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
class StepInto implements StepHandler
{
@ -64,12 +65,10 @@ class StepInto implements StepHandler
if( sourceLocation.getLine() > _startSourceLocation.getLine() )
return STOP;
if(ASS){System.out.println( "returning from step_into - not our stop" );}
if(AS.DEBUG){System.out.println( "returning from step_into - not our stop" );}
return CONTINUE_SEND_INTERRUPT;
}
private JSSourceLocation _startSourceLocation;
private JSPC _startPC;
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -22,7 +22,7 @@
package com.netscape.jsdebugging.ifcui;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.api.*;
class StepOut implements StepHandler
@ -51,13 +51,11 @@ class StepOut implements StepHandler
case CallChain.DISJOINT:
return STOP;
default:
if(ASS)ER.T(false,"coding error in StepOut (missed case)",this);
if(AS.S)ER.T(false,"coding error in StepOut (missed case)",this);
return STOP;
}
}
private CallChain _callChain;
private JSPC _startPC;
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -22,7 +22,7 @@
package com.netscape.jsdebugging.ifcui;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.api.*;
class StepOver implements StepHandler
@ -53,7 +53,7 @@ class StepOver implements StepHandler
case CallChain.DISJOINT:
return STOP;
default:
if(ASS)ER.T(false,"coding error in StepOut (missed case)",this);
if(AS.S)ER.T(false,"coding error in StepOut (missed case)",this);
break;
}
@ -72,6 +72,4 @@ class StepOver implements StepHandler
private CallChain _callChain;
private JSSourceLocation _startSourceLocation;
private JSPC _startPC;
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -24,7 +24,7 @@ package com.netscape.jsdebugging.ifcui;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.layout.*;
class StringEditorDialog

View File

@ -26,7 +26,7 @@ import java.util.Observable;
import java.util.Observer;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
public class WatchTyrant
extends Observable
@ -40,9 +40,9 @@ public class WatchTyrant
_consoleTyrant = emperor.getConsoleTyrant();
_stackTyrant = emperor.getStackTyrant();
if(ASS)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_consoleTyrant,"emperor init order problem", this);
if(ASS)ER.T(null!=_stackTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_consoleTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_stackTyrant,"emperor init order problem", this);
_evalStrings = new Vector();
@ -115,8 +115,6 @@ public class WatchTyrant
private ConsoleTyrant _consoleTyrant;
private StackTyrant _stackTyrant;
private Vector _evalStrings;
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -26,7 +26,7 @@ import java.util.Observable;
import java.util.Observer;
import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.ER;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.layout.*;
public class WatchView
@ -49,8 +49,8 @@ public class WatchView
_watchTyrant = emperor.getWatchTyrant();
_commandTyrant = emperor.getCommandTyrant();
if(ASS)ER.T(null!=_watchTyrant ,"emperor init order problem", this);
if(ASS)ER.T(null!=_commandTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_watchTyrant ,"emperor init order problem", this);
if(AS.S)ER.T(null!=_commandTyrant,"emperor init order problem", this);
_listview = new BackgroundHackListView();
@ -275,8 +275,6 @@ public class WatchView
private static final String DEL_CMD = "DEL_CMD";
private static final String EVAL_CMD = "EVAL_CMD";
private static final String DONE_CMD = "DONE_CMD";
private static final boolean ASS = true; // enable ASSERT support?
}

View File

@ -0,0 +1,10 @@
// generated automatically by gen_dbg.awk
package com.netscape.jsdebugging.ifcui.palomar.util;
public interface AS
{
public static final boolean S = true;
public static final boolean DEBUG = true;
}

View File

@ -24,23 +24,18 @@ import java.util.Hashtable;
* ASSERT support for Java
* <PRE>
* usage:
* // set flag in your class
* private static final boolean ASS = true; // false to disable ASSERT
* // use in your class
* if(AS.S)ER.T(expr, message, this);
*
* // use in your class
* if(ASS)ER.T( expr, message, this);
*
* // use in your class
* if(ASS)ER.T( i==5, "i is screwed up in foo()", this);
* if(AS.S)ER.T(i==5, "i is screwed up in foo()", this);
* </PRE>
*
* There are various versions of the T() method.
*
* Setting "ASS = false" in this class will globally disable
* ASSERT, but the local expressions will still be evaluated.
*
* Debuggers can be set to catch "com.netscape.jsdebugging.ifcui.palomar.util.DebuggerCaughtException"
* exceptions. The effect of a DebugBreak() is thus available.
* Debuggers can be set to catch the exception:
* <pre>com.netscape.jsdebugging.ifcui.palomar.util.DebuggerCaughtException</pre>
* The effect of a DebugBreak() is thus available.
*
* Handlers can be set on a per thread basis. If present, the handler for
* the given thread will be called on assert failure. This allows the possiblity
@ -49,9 +44,8 @@ import java.util.Hashtable;
*
*/
public class ER
public final class ER
{
/**
* This class is never instantiated
*/
@ -60,66 +54,51 @@ public class ER
/**
* call with only an expression
*/
public static void T( boolean expr )
public static void T(boolean expr)
{
if( ASS )
if( ! expr )
assert_fail( null, null, true );
if(AS.S)
if(! expr)
assert_fail(null, null, true);
}
/**
* call with an expression and an object that is either a msg or 'this'
*/
public static void T( boolean expr, Object ob )
public static void T(boolean expr, Object ob)
{
if( ASS )
if( ! expr )
if( ob instanceof String )
assert_fail( (String)ob, null, true );
if(AS.S)
if(! expr)
if(ob instanceof String)
assert_fail((String)ob, null, true);
else
assert_fail( null, ob, true );
}
/**
* Runs like the normal T method, except that it is intended to
* work when not on the IFC thread, which would otherwise freeze
* the program. This just throws the DebuggerCaughtException.
*
* Should modify this to promt the user on the command line
* but this is not implemented yet.
*/
public static void T_NO_GUI( boolean expr, String message )
{
if( ASS )
if( ! expr )
assert_fail(message, null, false);
assert_fail(null, ob, true);
}
/**
* call with an expression, a msg, and a classname (for use in static methods)
*/
public static void T( boolean expr, String msg, String classname )
public static void T(boolean expr, String msg, String classname)
{
if( ASS )
if( ! expr )
if(AS.S)
if(! expr)
try
{
assert_fail( msg, Class.forName(classname), true );
assert_fail(msg, Class.forName(classname), true);
}
catch( ClassNotFoundException e )
catch(ClassNotFoundException e)
{
assert_fail( msg, null, true );
assert_fail(msg, null, true);
}
}
/**
* call with an expression, a msg, and 'this' (the 'normal' case)
*/
public static void T( boolean expr, String msg, Object ob )
public static void T(boolean expr, String msg, Object ob)
{
if( ASS )
if( ! expr )
assert_fail( msg, ob, true );
if(AS.S)
if(! expr)
assert_fail(msg, ob, true);
}
/**
@ -127,11 +106,11 @@ public class ER
*/
public static void setFailureHandler(Thread t, AssertFailureHandler h)
{
if(ASS)
if(AS.S)
{
if( null == _FailureHandlers )
if(null == _FailureHandlers)
_FailureHandlers = new Hashtable();
if( null != h )
if(null != h)
_FailureHandlers.put(t,h);
else
_FailureHandlers.remove(t);
@ -143,31 +122,53 @@ public class ER
*/
public static AssertFailureHandler getFailureHandler(Thread t)
{
if(ASS)
if(AS.S)
{
if( null != _FailureHandlers )
if(null != _FailureHandlers)
return (AssertFailureHandler) _FailureHandlers.get(t);
}
return null;
}
public static boolean getDumpStackOnFailure()
{
return _dumpStackOnFailure;
}
public static void setDumpStackOnFailure(boolean dump)
{
_dumpStackOnFailure = dump;
}
public static void dumpThreadsAndStack()
{
Thread t = Thread.currentThread();
System.out.println("----------------------------------------------");
t.getThreadGroup().list();
System.out.println("----------------------------------------------");
System.out.println(t);
System.out.println("----------------------------------------------");
t.dumpStack();
}
private static void assert_fail(String msg, Object ob, boolean useHandler)
{
if( ASS )
if(AS.S)
{
String errMsg = buildString( msg, ob );
System.out.println( "===============!!!==============" );
System.out.println( errMsg );
System.out.println( "===============!!!==============" );
String errMsg = buildString(msg, ob);
System.out.println("==============================!!!=============================");
System.out.println(errMsg);
if(_dumpStackOnFailure)
dumpThreadsAndStack();
System.out.println("==============================!!!=============================");
int choice = AssertFailureHandler.DEBUG;
if( useHandler && null != _FailureHandlers )
if(useHandler && null != _FailureHandlers)
{
AssertFailureHandler handler = (AssertFailureHandler)
_FailureHandlers.get(Thread.currentThread());
if( null != handler )
choice = handler.assertFailed( msg, errMsg, ob );
if(null != handler)
choice = handler.assertFailed(msg, errMsg, ob);
}
switch(choice)
@ -184,7 +185,7 @@ public class ER
{
throw new DebuggerCaughtException(errMsg);
}
catch( DebuggerCaughtException e )
catch(DebuggerCaughtException e)
{
// eat exception (but catch in debugger)
}
@ -192,15 +193,15 @@ public class ER
}
}
private static String buildString( String msg, Object ob )
private static String buildString(String msg, Object ob)
{
String str = null;
if( ASS )
if(AS.S)
{
str = "!!!Assertion failed!!!";
if( null != msg )
if(null != msg)
str += "\n " + msg;
if( null != ob )
if(null != ob)
{
str += "\n Classname = " + ob.getClass();
str += "\n Object dump: " + ob;
@ -210,8 +211,7 @@ public class ER
}
private static Hashtable _FailureHandlers = null;
private static final boolean ASS = true; // false to diasable
private static boolean _dumpStackOnFailure = true;
}
/**
@ -222,4 +222,3 @@ class DebuggerCaughtException extends RuntimeException {
super(msg);
}
}