--NOT PART OF DEFAULT BUILD--
XMLterm changes only. Major restructuring of the xmlterm build process. Split lineterm from xmlterm. IDLified all interfaces (bug 69002). Eliminated printing to console in opt builds (bug 78641) git-svn-id: svn://10.0.0.236/trunk@102548 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -64,13 +64,13 @@ DEBUG = 1
|
||||
|
||||
ifdef STAND_ALONE
|
||||
|
||||
DIRS = base tests linetest
|
||||
DIRS = lineterm tests linetest
|
||||
|
||||
else # not STAND_ALONE
|
||||
|
||||
# XMLterm currently works on Linux and SunOS only (testing on BSD family)
|
||||
ifneq (,$(filter Linux SunOS FreeBSD HP-UX,$(OS_ARCH)))
|
||||
DIRS = base ui scripts doc tests
|
||||
DIRS = lineterm base ui build scripts doc tests
|
||||
else # XMLterm not yet been ported to this platform; do nothing
|
||||
DIRS =
|
||||
endif
|
||||
|
||||
@@ -23,9 +23,9 @@ mozIXMLTermStream IID "0eb82b40-43a2-11d3-8e76-006008948af5"
|
||||
mozXMLTermStream CID "0eb82b41-43a2-11d3-8e76-006008948af5"
|
||||
mozIXMLTermSuspend IID "0eb82b50-43a2-11d3-8e76-006008948af5"
|
||||
|
||||
CLINE_SERVICE CID "0eb82bE0-43a2-11d3-8e76-006008948af5"
|
||||
TELNETCNT_HANDLER CID "0eb82bE1-43a2-11d3-8e76-006008948af5"
|
||||
TELNETPROT_HANDLER CID "0eb82bE2-43a2-11d3-8e76-006008948af5"
|
||||
XMLTERMCLINE_SERVICE CID "0eb82bE0-43a2-11d3-8e76-006008948af5"
|
||||
XMLTERMCNT_HANDLER CID "0eb82bE1-43a2-11d3-8e76-006008948af5"
|
||||
XMLTERMPROT_HANDLER CID "0eb82bE2-43a2-11d3-8e76-006008948af5"
|
||||
|
||||
mozISimpleContainer IID "0eb82bF0-43a2-11d3-8e76-006008948af5"
|
||||
mozSimpleContainer CID "0eb82bF1-43a2-11d3-8e76-006008948af5"
|
||||
|
||||
@@ -33,51 +33,25 @@
|
||||
|
||||
# makefile for xmlterm/base directory
|
||||
|
||||
ifdef STAND_ALONE
|
||||
DEPTH = ..
|
||||
topsrcdir = ..
|
||||
srcdir = .
|
||||
include $(topsrcdir)/config/autoconf.mk
|
||||
else
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
endif
|
||||
|
||||
|
||||
ifdef DEBUG
|
||||
# Debug option
|
||||
DEBUG = 1
|
||||
|
||||
# Library name
|
||||
LIBRARY_NAME = xmlterm
|
||||
|
||||
# C Sources
|
||||
ifdef NO_PTY
|
||||
CSRCS = ltermManager.c ltermIO.c ltermInput.c ltermOutput.c ltermEscape.c \
|
||||
tracelog.c unistring.c
|
||||
else
|
||||
CSRCS = ltermManager.c ltermIO.c ltermInput.c ltermOutput.c ltermEscape.c \
|
||||
tracelog.c unistring.c ptystream.c
|
||||
DEBUG_LTERM = 1
|
||||
endif
|
||||
|
||||
ifdef STAND_ALONE
|
||||
# Defines
|
||||
DEFINES +=
|
||||
|
||||
# Exported header files
|
||||
EXPORTS = lineterm.h tracelog.h unistring.h ptystream.h
|
||||
|
||||
# C++ Sources
|
||||
CPPSRCS =
|
||||
|
||||
else # not STAND_ALONE
|
||||
# Defines
|
||||
DEFINES += $(TK_CFLAGS)
|
||||
ifdef DEBUG_LTERM
|
||||
DEFINES += -DDEBUG_LTERM
|
||||
endif
|
||||
|
||||
# Exported header files (excluding XPCONNECT interfaces)
|
||||
EXPORTS = lineterm.h tracelog.h unistring.h ptystream.h mozXMLT.h mozXMLTermUtils.h mozIXMLTerminal.h mozIXMLTermStream.h
|
||||
EXPORTS = mozXMLT.h mozXMLTermUtils.h
|
||||
|
||||
# C++ Sources
|
||||
CPPSRCS = \
|
||||
@@ -88,29 +62,25 @@ CPPSRCS = \
|
||||
mozXMLTermListeners.cpp \
|
||||
mozXMLTermShell.cpp \
|
||||
mozXMLTermStream.cpp \
|
||||
mozXMLTermFactory.cpp \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xmlterm
|
||||
IS_COMPONENT = 1
|
||||
EXPORT_LIBRARY = 1
|
||||
REQUIRES = xpcom string pref dom docshell view locale caps layout uriloader necko widget webshell appshell
|
||||
LIBRARY_NAME = xmlterm_s
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
-L$(DIST)/bin \
|
||||
-L$(DIST)/lib \
|
||||
-lgkgfx \
|
||||
$(TK_LIBS) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(NULL)
|
||||
REQUIRES = xpcom string
|
||||
|
||||
XPIDLSRCS = \
|
||||
mozILineTerm.idl \
|
||||
mozIXMLTermShell.idl \
|
||||
mozILineTerm.idl \
|
||||
mozIXMLTermShell.idl \
|
||||
mozIXMLTerminal.idl \
|
||||
mozIXMLTermStream.idl \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../lineterm \
|
||||
$(NULL)
|
||||
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(srcdir)/../config/xmlterm_config.mk
|
||||
|
||||
|
||||
@@ -22,10 +22,20 @@
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIObserver.idl"
|
||||
#include "domstubs.idl"
|
||||
|
||||
%{C++
|
||||
#include "nsString.h"
|
||||
class nsIDOMDocument;
|
||||
|
||||
#define MOZLINETERM_CLASSNAME "LineTerm Component"
|
||||
#define MOZLINETERM_CONTRACTID "@mozilla.org/xmlterm/lineterm;1"
|
||||
|
||||
#define MOZLINETERM_CID \
|
||||
{ /* 0eb82b01-43a2-11d3-8e76-006008948af5 */ \
|
||||
0x0eb82b01, 0x43a2, 0x11d3, \
|
||||
{0x8e, 0x76, 0x00, 0x60, 0x08, 0x94, 0x8a, 0xf5} }
|
||||
%}
|
||||
|
||||
[scriptable, uuid(0eb82b00-43a2-11d3-8e76-006008948af5)]
|
||||
@@ -75,13 +85,80 @@ interface mozILineTerm : nsISupports
|
||||
out PRInt32 buf_row, out PRInt32 buf_col, in wstring aCookie);
|
||||
};
|
||||
|
||||
[ref] native nsNativeStringRef(nsString);
|
||||
|
||||
%{ C++
|
||||
#define MOZLINETERM_CID \
|
||||
{ /* 0eb82b01-43a2-11d3-8e76-006008948af5 */ \
|
||||
0x0eb82b01, 0x43a2, 0x11d3, \
|
||||
{0x8e, 0x76, 0x00, 0x60, 0x08, 0x94, 0x8a, 0xf5} }
|
||||
/* NOT SCRIPTABLE */
|
||||
[uuid(0eb82b10-43a2-11d3-8e76-006008948af5)]
|
||||
|
||||
interface mozILineTermAux : mozILineTerm
|
||||
{
|
||||
|
||||
/** Opens LineTerm, a line-oriented terminal interface (without graphics)
|
||||
* @param command name of command to be executed; usually a shell,
|
||||
* e.g., "/bin/sh"; if set to null string, the command name is
|
||||
* determined from the environment variable SHELL
|
||||
* @param promptRegexp command prompt regular expression (for future use);
|
||||
* at the moment, any string terminated by one of the characters
|
||||
* "#$%>?", followed by a space, is assumed to be a prompt
|
||||
* @param options LineTerm option bits (usually 0; see lineterm.h)
|
||||
* @param processType command shell type; if set to -1, type is determined
|
||||
* from the command name
|
||||
* @param nRows no. of screen rows
|
||||
* @param nCols no. of screen columns
|
||||
* @param xPixels screen width in pixels (or 0 if unknown)
|
||||
* @param yPixels screen height in pixels (or 0 if unknown)
|
||||
* @param domDoc DOM document object associated with the LineTerm
|
||||
* (document.cookie will be defined for this document on return)
|
||||
* @param aCookie (output) cookie associated with LineTerm
|
||||
*/
|
||||
|
||||
void openAux(in wstring command,
|
||||
in wstring initInput,
|
||||
in wstring promptRegexp,
|
||||
in PRInt32 options, in PRInt32 processType,
|
||||
in PRInt32 nRows, in PRInt32 nCols,
|
||||
in PRInt32 xPixels, in PRInt32 yPixels,
|
||||
in nsIDOMDocument domDoc,
|
||||
in nsIObserver anObserver,
|
||||
in nsNativeStringRef aCookie);
|
||||
|
||||
/** Suspend/restores LineTerm operation
|
||||
* @param aSuspend suspension state flag
|
||||
*/
|
||||
void suspendAux(in boolean suspend);
|
||||
|
||||
/** Closes LineTerm
|
||||
*/
|
||||
void closeAux();
|
||||
|
||||
/** Close all LineTerms, not just this one
|
||||
*/
|
||||
void closeAllAux();
|
||||
|
||||
/** Resizes XMLterm to match a resized window.
|
||||
* @param nRows number of rows
|
||||
* @param nCols number of columns
|
||||
*/
|
||||
void resizeAux(in long nRows, in long nCols);
|
||||
|
||||
/** Read output data and style strings and parameters from LineTerm
|
||||
* @param opcodes (output) output data descriptor bits (see lineterm.h)
|
||||
* @param opvals (output) output data value(s)
|
||||
* @param buf_row (output) row number (>=-1)
|
||||
* (-1 denotes line mode and 0 represents bottom row)
|
||||
* @param buf_col (output) column number (>=0)
|
||||
* @param _retval (output) success code
|
||||
* @param retstyle (output) output style string
|
||||
* @return output data string from LineTerm
|
||||
*/
|
||||
void readAux(out long opcodes, out long opvals,
|
||||
out long buf_row, out long buf_col,
|
||||
out wstring retval, out wstring retstyle);
|
||||
|
||||
void getCookie(in nsNativeStringRef aCookie);
|
||||
|
||||
attribute long cursorRow;
|
||||
attribute long cursorColumn;
|
||||
attribute boolean echoFlag;
|
||||
};
|
||||
|
||||
extern nsresult
|
||||
NS_NewLineTerm(mozILineTerm** aLineTerm);
|
||||
%}
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "MPL"); you may not use this file
|
||||
* except in compliance with the MPL. You may obtain a copy of
|
||||
* the MPL at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the MPL is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the MPL for the specific language governing
|
||||
* rights and limitations under the MPL.
|
||||
*
|
||||
* The Original Code is XMLterm.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ramalingam Saravanan.
|
||||
* Portions created by Ramalingam Saravanan <svn@xmlterm.org> are
|
||||
* Copyright (C) 1999 Ramalingam Saravanan. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
// mozILineTermAux.h: auxiliary interface for LineTerm (not XPCONNECTed)
|
||||
// This adds some XPCOM-only methods to the XPCOM/XPCONNECT interface
|
||||
// mozILineTerm (unregistered)
|
||||
|
||||
#ifndef mozILineTermAux_h___
|
||||
#define mozILineTermAux_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
#include "nscore.h"
|
||||
|
||||
#include "nsIObserver.h"
|
||||
#include "mozILineTerm.h"
|
||||
|
||||
/* {0eb82b10-43a2-11d3-8e76-006008948af5} */
|
||||
#define MOZILINETERMAUX_IID_STR "0eb82b10-43a2-11d3-8e76-006008948af5"
|
||||
#define MOZILINETERMAUX_IID \
|
||||
{0x0eb82b10, 0x43a2, 0x11d3, \
|
||||
{ 0x8e, 0x76, 0x00, 0x60, 0x08, 0x94, 0x8a, 0xf5 }}
|
||||
|
||||
class mozILineTermAux : public mozILineTerm {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(MOZILINETERMAUX_IID)
|
||||
|
||||
// mozILineTerm interface
|
||||
NS_IMETHOD Open(const PRUnichar *command,
|
||||
const PRUnichar *initInput,
|
||||
const PRUnichar *promptRegexp,
|
||||
PRInt32 options, PRInt32 processType,
|
||||
nsIDOMDocument *domDoc) = 0;
|
||||
|
||||
NS_IMETHOD Close(const PRUnichar* aCookie) = 0;
|
||||
|
||||
NS_IMETHOD Write(const PRUnichar *buf, const PRUnichar* aCookie) = 0;
|
||||
|
||||
NS_IMETHOD Read(PRInt32 *opcodes, PRInt32 *opvals,
|
||||
PRInt32 *buf_row, PRInt32 *buf_col,
|
||||
const PRUnichar* aCookie,
|
||||
PRUnichar **_retval) = 0;
|
||||
|
||||
// mozILineTermAux interface add ons
|
||||
// (not scriptable, no authentication cookie required)
|
||||
|
||||
/** Opens LineTerm, a line-oriented terminal interface (without graphics)
|
||||
* @param command name of command to be executed; usually a shell,
|
||||
* e.g., "/bin/sh"; if set to null string, the command name is
|
||||
* determined from the environment variable SHELL
|
||||
* @param promptRegexp command prompt regular expression (for future use);
|
||||
* at the moment, any string terminated by one of the characters
|
||||
* "#$%>?", followed by a space, is assumed to be a prompt
|
||||
* @param options LineTerm option bits (usually 0; see lineterm.h)
|
||||
* @param processType command shell type; if set to -1, type is determined
|
||||
* from the command name
|
||||
* @param nRows no. of screen rows
|
||||
* @param nCols no. of screen columns
|
||||
* @param xPixels screen width in pixels (or 0 if unknown)
|
||||
* @param yPixels screen height in pixels (or 0 if unknown)
|
||||
* @param domDoc DOM document object associated with the LineTerm
|
||||
* (document.cookie will be defined for this document on return)
|
||||
* @param aCookie (output) cookie associated with LineTerm
|
||||
*/
|
||||
NS_IMETHOD OpenAux(const PRUnichar *command,
|
||||
const PRUnichar *initInput,
|
||||
const PRUnichar *promptRegexp,
|
||||
PRInt32 options, PRInt32 processType,
|
||||
PRInt32 nRows, PRInt32 nCols,
|
||||
PRInt32 xPixels, PRInt32 yPixels,
|
||||
nsIDOMDocument *domDoc,
|
||||
nsIObserver* anObserver,
|
||||
nsString& aCookie) = 0;
|
||||
|
||||
/** Suspend/restores LineTerm operation
|
||||
* @param aSuspend suspension state flag
|
||||
*/
|
||||
NS_IMETHOD SuspendAux(PRBool aSuspend) = 0;
|
||||
|
||||
/** Closes LineTerm
|
||||
*/
|
||||
NS_IMETHOD CloseAux(void) = 0;
|
||||
|
||||
/** Close all LineTerms, not just this one
|
||||
*/
|
||||
NS_IMETHOD CloseAllAux(void) = 0;
|
||||
|
||||
/** Resizes XMLterm to match a resized window.
|
||||
* @param nRows number of rows
|
||||
* @param nCols number of columns
|
||||
*/
|
||||
NS_IMETHOD ResizeAux(PRInt32 nRows, PRInt32 nCols) = 0;
|
||||
|
||||
/** Read output data and style strings and parameters from LineTerm
|
||||
* @param opcodes (output) output data descriptor bits (see lineterm.h)
|
||||
* @param opvals (output) output data value(s)
|
||||
* @param buf_row (output) row number (>=-1)
|
||||
* (-1 denotes line mode and 0 represents bottom row)
|
||||
* @param buf_col (output) column number (>=0)
|
||||
* @param _retval (output) success code
|
||||
* @param retstyle (output) output style string
|
||||
* @return output data string from LineTerm
|
||||
*/
|
||||
NS_IMETHOD ReadAux(PRInt32 *opcodes, PRInt32 *opvals,
|
||||
PRInt32 *buf_row, PRInt32 *buf_col,
|
||||
PRUnichar **_retval, PRUnichar **retstyle) = 0;
|
||||
|
||||
NS_IMETHOD GetCookie(nsString& aCookie) = 0;
|
||||
|
||||
NS_IMETHOD GetCursorRow(PRInt32 *aCursorRow) = 0;
|
||||
NS_IMETHOD SetCursorRow(PRInt32 aCursorRow) = 0;
|
||||
|
||||
NS_IMETHOD GetCursorColumn(PRInt32 *aCursorColumn) = 0;
|
||||
NS_IMETHOD SetCursorColumn(PRInt32 aCursorColumn) = 0;
|
||||
|
||||
NS_IMETHOD GetEchoFlag(PRBool *aEchoFlag) = 0;
|
||||
NS_IMETHOD SetEchoFlag(PRBool aEchoFlag) = 0;
|
||||
};
|
||||
|
||||
// Factory for mozILineTermAux
|
||||
|
||||
extern nsresult
|
||||
NS_NewLineTermAux(mozILineTermAux** aLineTermAux);
|
||||
|
||||
#endif /* mozILineTermAux_h___ */
|
||||
@@ -27,6 +27,17 @@
|
||||
interface nsIDOMWindowInternal;
|
||||
|
||||
|
||||
|
||||
%{C++
|
||||
#define MOZXMLTERMSHELL_CLASSNAME "XMLTerm Shell Component"
|
||||
#define MOZXMLTERMSHELL_CONTRACTID "@mozilla.org/xmlterm/xmltermshell;1"
|
||||
|
||||
#define MOZXMLTERMSHELL_CID \
|
||||
{ /* 0eb82b31-43a2-11d3-8e76-006008948af5 */ \
|
||||
0x0eb82b31, 0x43a2, 0x11d3, \
|
||||
{0x8e, 0x76, 0x00, 0x60, 0x08, 0x94, 0x8a, 0xf5} }
|
||||
%}
|
||||
|
||||
[scriptable, uuid(0eb82b30-43a2-11d3-8e76-006008948af5)]
|
||||
|
||||
interface mozIXMLTermShell : nsISupports
|
||||
@@ -85,15 +96,3 @@ interface mozIXMLTermShell : nsISupports
|
||||
void Exit();
|
||||
};
|
||||
|
||||
|
||||
%{C++
|
||||
|
||||
#define MOZXMLTERMSHELL_CID \
|
||||
{ /* 0eb82b31-43a2-11d3-8e76-006008948af5 */ \
|
||||
0x0eb82b31, 0x43a2, 0x11d3, \
|
||||
{0x8e, 0x76, 0x00, 0x60, 0x08, 0x94, 0x8a, 0xf5} }
|
||||
|
||||
extern nsresult
|
||||
NS_NewXMLTermShell(mozIXMLTermShell** aXMLTermShell);
|
||||
%}
|
||||
|
||||
|
||||
@@ -18,34 +18,28 @@
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
// mozIXMLTermStream.h: interface to display HTML/XML streams as documents
|
||||
// (unregistered)
|
||||
/* mozIXMLTermStream: interface to display HTML/XML streams as documents (unscriptable)
|
||||
*/
|
||||
|
||||
#ifndef mozIXMLTermStream_h___
|
||||
#define mozIXMLTermStream_h___
|
||||
#include "nsIInputStream.idl"
|
||||
|
||||
#include "nscore.h"
|
||||
interface nsIDOMWindowInternal;
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIInputStream.h"
|
||||
%{C++
|
||||
#define MOZXMLTERMSTREAM_CLASSNAME "XMLTermStream Component"
|
||||
#define MOZXMLTERMSTREAM_CONTRACTID "@mozilla.org/xmlterm/xmlterm-stream;1"
|
||||
|
||||
/* {0eb82b40-43a2-11d3-8e76-006008948af5} */
|
||||
#define MOZIXMLTERMSTREAM_IID_STR "0eb82b40-43a2-11d3-8e76-006008948af5"
|
||||
#define MOZIXMLTERMSTREAM_IID \
|
||||
{0x0eb82b40, 0x43a2, 0x11d3, \
|
||||
{ 0x8e, 0x76, 0x00, 0x60, 0x08, 0x94, 0x8a, 0xf5 }}
|
||||
#define MOZXMLTERMSTREAM_CID \
|
||||
{ /* 0eb82b41-43a2-11d3-8e76-006008948af5 */ \
|
||||
0x0eb82b41, 0x43a2, 0x11d3, \
|
||||
{0x8e, 0x76, 0x00, 0x60, 0x08, 0x94, 0x8a, 0xf5} }
|
||||
%}
|
||||
|
||||
class mozIXMLTermStream : public nsIInputStream
|
||||
/* NOT SCRIPTABLE */
|
||||
[uuid(0eb82b40-43a2-11d3-8e76-006008948af5)]
|
||||
|
||||
interface mozIXMLTermStream : nsIInputStream
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(MOZIXMLTERMSTREAM_IID);
|
||||
|
||||
// mozIXMLTermStream interface
|
||||
|
||||
/** Open stream in specified frame, or in current frame if frameName is null
|
||||
* @param aDOMWindow parent window
|
||||
* @param frameName name of child frame in which to display stream, or null
|
||||
@@ -53,26 +47,15 @@ class mozIXMLTermStream : public nsIInputStream
|
||||
* @param contentURL URL of stream content
|
||||
* @param contentType MIME type of stream content
|
||||
* @param maxResizeHeight maximum resize height (0=> do not resize)
|
||||
* @return NS_OK on success
|
||||
*/
|
||||
NS_IMETHOD Open(nsIDOMWindowInternal* aDOMWindow,
|
||||
const char* frameName,
|
||||
const char* contentURL,
|
||||
const char* contentType,
|
||||
PRInt32 maxResizeHeight) = 0;
|
||||
void open(in nsIDOMWindowInternal aDOMWindow,
|
||||
in string frameName,
|
||||
in string contentURL,
|
||||
in string contentType,
|
||||
in long maxResizeHeight);
|
||||
|
||||
/** Write Unicode string to stream (blocks until write is completed)
|
||||
* @param buf string to write
|
||||
* @return NS_OK on success
|
||||
*/
|
||||
NS_IMETHOD Write(const PRUnichar* buf) = 0;
|
||||
void write(in wstring buf);
|
||||
};
|
||||
|
||||
#define MOZXMLTERMSTREAM_CID \
|
||||
{ /* 0eb82b41-43a2-11d3-8e76-006008948af5 */ \
|
||||
0x0eb82b41, 0x43a2, 0x11d3, \
|
||||
{0x8e, 0x76, 0x00, 0x60, 0x08, 0x94, 0x8a, 0xf5} }
|
||||
extern nsresult
|
||||
NS_NewXMLTermStream(mozIXMLTermStream** aXMLTermStream);
|
||||
|
||||
#endif /* mozIXMLTermStream_h___ */
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "MPL"); you may not use this file
|
||||
* except in compliance with the MPL. You may obtain a copy of
|
||||
* the MPL at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the MPL is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the MPL for the specific language governing
|
||||
* rights and limitations under the MPL.
|
||||
*
|
||||
* The Original Code is XMLterm.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ramalingam Saravanan.
|
||||
* Portions created by Ramalingam Saravanan <svn@xmlterm.org> are
|
||||
* Copyright (C) 1999 Ramalingam Saravanan. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
// mozIXMLTermSuspend.h: interface to suspend/resume select XMLterm operations
|
||||
//
|
||||
|
||||
#ifndef mozIXMLTermSuspend_h___
|
||||
#define mozIXMLTermSuspend_h___
|
||||
|
||||
#include "nscore.h"
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
/* {0eb82b50-43a2-11d3-8e76-006008948af5} */
|
||||
#define MOZIXMLTERMSUSPEND_IID_STR "0eb82b50-43a2-11d3-8e76-006008948af5"
|
||||
#define MOZIXMLTERMSUSPEND_IID \
|
||||
{0x0eb82b50, 0x43a2, 0x11d3, \
|
||||
{ 0x8e, 0x76, 0x00, 0x60, 0x08, 0x94, 0x8a, 0xf5 }}
|
||||
|
||||
class mozIXMLTermSuspend : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(MOZIXMLTERMSUSPEND_IID);
|
||||
|
||||
// mozIXMLTermSuspend interface
|
||||
NS_IMETHOD GetSuspend(PRBool* aSuspend) = 0;
|
||||
NS_IMETHOD SetSuspend(const PRBool aSuspend) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* mozIXMLTermSuspend_h___ */
|
||||
@@ -1,182 +0,0 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "MPL"); you may not use this file
|
||||
* except in compliance with the MPL. You may obtain a copy of
|
||||
* the MPL at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the MPL is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the MPL for the specific language governing
|
||||
* rights and limitations under the MPL.
|
||||
*
|
||||
* The Original Code is XMLterm.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ramalingam Saravanan.
|
||||
* Portions created by Ramalingam Saravanan <svn@xmlterm.org> are
|
||||
* Copyright (C) 1999 Ramalingam Saravanan. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
// mozIXMLTerminal.h: primary interface for XMLterm operations
|
||||
// (unregistered)
|
||||
|
||||
#ifndef mozIXMLTerminal_h___
|
||||
#define mozIXMLTerminal_h___
|
||||
|
||||
#include "nscore.h"
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
#include "mozIXMLTermShell.h"
|
||||
|
||||
class nsISelectionController;
|
||||
|
||||
/* {0eb82b20-43a2-11d3-8e76-006008948af5} */
|
||||
#define MOZIXMLTERMINAL_IID_STR "0eb82b20-43a2-11d3-8e76-006008948af5"
|
||||
#define MOZIXMLTERMINAL_IID \
|
||||
{0x0eb82b20, 0x43a2, 0x11d3, \
|
||||
{ 0x8e, 0x76, 0x00, 0x60, 0x08, 0x94, 0x8a, 0xf5 }}
|
||||
|
||||
class mozIXMLTerminal : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(MOZIXMLTERMINAL_IID)
|
||||
|
||||
/** Initializes XMLterm in specified web shell
|
||||
* @param aDocShell web shell in which to embed XMLterm
|
||||
* @param aXMLTermShell scriptable wrapper shell for XMLterm
|
||||
* @param URL URL of document to be loaded in the window
|
||||
* (set to null string if document is already loaded in window)
|
||||
* @param args argument string to be passed to XMLterm
|
||||
* (at the moment this just contains any initial input data)
|
||||
*/
|
||||
NS_IMETHOD Init(nsIDocShell* aDocShell,
|
||||
mozIXMLTermShell* aXMLTermShell,
|
||||
const PRUnichar* aURL,
|
||||
const PRUnichar* args) = 0;
|
||||
|
||||
/** Finalizes (closes) XMLterm
|
||||
*/
|
||||
NS_IMETHOD Finalize(void) = 0;
|
||||
|
||||
/** Polls for readable data from XMLterm
|
||||
*/
|
||||
NS_IMETHOD Poll(void) = 0;
|
||||
|
||||
/** Gets current entry (command) number
|
||||
* @param aNumber (output) current entry number
|
||||
*/
|
||||
NS_IMETHOD GetCurrentEntryNumber(PRInt32 *aNumber) = 0;
|
||||
|
||||
/** Gets command history buffer count
|
||||
* @param aHistory (output) history buffer count
|
||||
*/
|
||||
NS_IMETHOD GetHistory(PRInt32 *aHistory) = 0;
|
||||
|
||||
/** Sets command history buffer count
|
||||
* @param aHistory history buffer count
|
||||
*/
|
||||
NS_IMETHOD SetHistory(PRInt32 aHistory) = 0;
|
||||
|
||||
/** Gets prompt string
|
||||
* @param aPrompt (output) prompt string
|
||||
*/
|
||||
NS_IMETHOD GetPrompt(PRUnichar **aPrompt) = 0;
|
||||
|
||||
/** Sets prompt string
|
||||
* @param aPrompt prompt string
|
||||
*/
|
||||
NS_IMETHOD SetPrompt(const PRUnichar* aPrompt) = 0;
|
||||
|
||||
/** Gets ignore key press flag
|
||||
* @param aIgnore ignore key press flag
|
||||
*/
|
||||
NS_IMETHOD GetKeyIgnore(PRBool* aIgnore) = 0;
|
||||
|
||||
/** Sets ignore key press flag
|
||||
* @param aIgnore ignore key press flag
|
||||
*/
|
||||
NS_IMETHOD SetKeyIgnore(const PRBool aIgnore) = 0;
|
||||
|
||||
/** Writes string to terminal as if the user had typed it (without authenitcation)
|
||||
* @param aString string to be transmitted to terminal
|
||||
*/
|
||||
NS_IMETHOD SendTextAux(const nsString& aString) = 0;
|
||||
|
||||
/** Writes string to terminal as if the user had typed it (command input)
|
||||
* @param aString string to be transmitted to terminal
|
||||
* @param aCookie document.cookie string for authentication
|
||||
*/
|
||||
NS_IMETHOD SendText(const nsString& aString, const PRUnichar* aCookie) = 0;
|
||||
|
||||
/** Paste data from clipboard into XMLterm at current input line cursor location
|
||||
*/
|
||||
NS_IMETHOD Paste() = 0;
|
||||
|
||||
/** Gets document associated with XMLterm
|
||||
* @param aDoc (output) DOM document
|
||||
*/
|
||||
NS_IMETHOD GetDocument(nsIDOMDocument** aDoc) = 0;
|
||||
|
||||
/** Gets web shell associated with XMLterm
|
||||
* @param aDocShell (output) web shell
|
||||
*/
|
||||
NS_IMETHOD GetDocShell(nsIDocShell** aDocShell) = 0;
|
||||
|
||||
/** Gets presentation shell associated with XMLterm
|
||||
* @param aPresShell (output) presentation shell
|
||||
*/
|
||||
NS_IMETHOD GetPresShell(nsIPresShell** aPresShell) = 0;
|
||||
|
||||
/** Gets DOM document associated with XMLterm
|
||||
* @param aDOMDocumentl (output) DOM document
|
||||
*/
|
||||
NS_IMETHOD GetDOMDocument(nsIDOMDocument** aDOMDocument) = 0;
|
||||
|
||||
/** Gets selection controller associated with XMLterm
|
||||
* @param aSelectionControllerl (output) DOM document
|
||||
*/
|
||||
NS_IMETHOD GetSelectionController(nsISelectionController** aSelectionController) = 0;
|
||||
|
||||
/** Gets flag denoting whether terminal is in full screen mode
|
||||
* @param aFlag (output) screen mode flag
|
||||
*/
|
||||
NS_IMETHOD GetScreenMode(PRBool* aFlag) = 0;
|
||||
|
||||
/** Checks if supplied cookie is valid for XMLTerm
|
||||
* @param aCookie supplied cookie string
|
||||
* @param _retval PR_TRUE if supplied cookie matches XMLTerm cookie
|
||||
*/
|
||||
NS_IMETHOD MatchesCookie(const PRUnichar* aCookie, PRBool *_retval) = 0;
|
||||
|
||||
/** Resizes XMLterm to match a resized window.
|
||||
*/
|
||||
NS_IMETHOD Resize(void) = 0;
|
||||
|
||||
/** Shows the caret and make it editable.
|
||||
*/
|
||||
NS_IMETHOD ShowCaret(void) = 0;
|
||||
|
||||
/** Returns current screen size in rows/cols and in pixels
|
||||
* @param (output) rows
|
||||
* @param (output) cols
|
||||
* @param (output) xPixels
|
||||
* @param (output) yPixels
|
||||
*/
|
||||
NS_IMETHOD ScreenSize(PRInt32& rows, PRInt32& cols,
|
||||
PRInt32& xPixels, PRInt32& yPixels) = 0;
|
||||
};
|
||||
|
||||
#define MOZXMLTERMINAL_CID \
|
||||
{ /* 0eb82b21-43a2-11d3-8e76-006008948af5 */ \
|
||||
0x0eb82b21, 0x43a2, 0x11d3, \
|
||||
{0x8e, 0x76, 0x00, 0x60, 0x08, 0x94, 0x8a, 0xf5} }
|
||||
extern nsresult
|
||||
NS_NewXMLTerminal(mozIXMLTerminal** aXMLTerminal);
|
||||
|
||||
#endif /* mozIXMLTerminal_h___ */
|
||||
157
mozilla/extensions/xmlterm/base/mozIXMLTerminal.idl
Normal file
157
mozilla/extensions/xmlterm/base/mozIXMLTerminal.idl
Normal file
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "MPL"); you may not use this file
|
||||
* except in compliance with the MPL. You may obtain a copy of
|
||||
* the MPL at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the MPL is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the MPL for the specific language governing
|
||||
* rights and limitations under the MPL.
|
||||
*
|
||||
* The Original Code is XMLterm.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ramalingam Saravanan.
|
||||
* Portions created by Ramalingam Saravanan <svn@xmlterm.org> are
|
||||
* Copyright (C) 1999 Ramalingam Saravanan. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/* mozIXMLTerminal.idl: primary interface for XMLterm operations (unscriptable)
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "mozILineTerm.idl"
|
||||
#include "mozIXMLTermShell.idl"
|
||||
|
||||
interface nsISelectionController;
|
||||
interface nsIDocShell;
|
||||
interface nsIPresShell;
|
||||
|
||||
%{C++
|
||||
#define MOZXMLTERMINAL_CLASSNAME "XMLTerminal Component"
|
||||
#define MOZXMLTERMINAL_CONTRACTID "@mozilla.org/xmlterm/xmlterminal;1"
|
||||
|
||||
#define MOZXMLTERMINAL_CID \
|
||||
{ /* 0eb82b21-43a2-11d3-8e76-006008948af5 */ \
|
||||
0x0eb82b21, 0x43a2, 0x11d3, \
|
||||
{0x8e, 0x76, 0x00, 0x60, 0x08, 0x94, 0x8a, 0xf5} }
|
||||
%}
|
||||
|
||||
/* NOT SCRIPTABLE */
|
||||
[uuid(0eb82b20-43a2-11d3-8e76-006008948af5)]
|
||||
|
||||
interface mozIXMLTerminal : nsISupports
|
||||
{
|
||||
/** Initializes XMLterm in specified web shell
|
||||
* @param aDocShell web shell in which to embed XMLterm
|
||||
* @param aXMLTermShell scriptable wrapper shell for XMLterm
|
||||
* @param URL URL of document to be loaded in the window
|
||||
* (set to null string if document is already loaded in window)
|
||||
* @param args argument string to be passed to XMLterm
|
||||
* (at the moment this just contains any initial input data)
|
||||
*/
|
||||
void init(in nsIDocShell aDocShell,
|
||||
in mozIXMLTermShell aXMLTermShell,
|
||||
in wstring aURL,
|
||||
in wstring args);
|
||||
|
||||
/** Finalizes (closes) XMLterm
|
||||
*/
|
||||
void finalize();
|
||||
|
||||
/** Polls for readable data from XMLterm
|
||||
*/
|
||||
void poll();
|
||||
|
||||
/** Current entry (command) number
|
||||
*/
|
||||
readonly attribute long currentEntryNumber;
|
||||
|
||||
/** History buffer count
|
||||
*/
|
||||
attribute long history;
|
||||
|
||||
/** Prompt string
|
||||
*/
|
||||
attribute wstring prompt;
|
||||
|
||||
/** Ignore key press flag
|
||||
*/
|
||||
attribute boolean keyIgnore;
|
||||
|
||||
/** Writes string to terminal as if the user had typed it (without authenitcation)
|
||||
* @param aString string to be transmitted to terminal
|
||||
*/
|
||||
void sendTextAux(in wstring aString);
|
||||
|
||||
/** Writes string to terminal as if the user had typed it (command input)
|
||||
* @param aString string to be transmitted to terminal
|
||||
* @param aCookie document.cookie string for authentication
|
||||
*/
|
||||
void sendText(in wstring aString, in wstring aCookie);
|
||||
|
||||
/** Paste data from clipboard into XMLterm at current input line cursor location
|
||||
*/
|
||||
void paste();
|
||||
|
||||
/** Document associated with XMLterm
|
||||
*/
|
||||
readonly attribute nsIDOMDocument document;
|
||||
|
||||
/** Web shell associated with XMLterm
|
||||
*/
|
||||
readonly attribute nsIDocShell docShell;
|
||||
|
||||
/** Presentation shell associated with XMLterm
|
||||
*/
|
||||
readonly attribute nsIPresShell presShell;
|
||||
|
||||
/** DOM document associated with XMLterm
|
||||
*/
|
||||
readonly attribute nsIDOMDocument DOMDocument;
|
||||
|
||||
/** Selection controller associated with XMLterm
|
||||
*/
|
||||
readonly attribute nsISelectionController selectionController;
|
||||
|
||||
/** Flag denoting whether terminal is in full screen mode
|
||||
* @param aFlag (output) screen mode flag
|
||||
*/
|
||||
readonly attribute boolean screenMode;
|
||||
|
||||
/** Checks if supplied cookie is valid for XMLTerm
|
||||
* @param aCookie supplied cookie string
|
||||
* @return PR_TRUE if supplied cookie matches XMLTerm cookie
|
||||
*/
|
||||
boolean matchesCookie(in wstring aCookie);
|
||||
|
||||
/** Resizes XMLterm to match a resized window.
|
||||
*/
|
||||
void resize();
|
||||
|
||||
/** Shows the caret and make it editable.
|
||||
*/
|
||||
void showCaret();
|
||||
|
||||
/** Returns current screen size in rows/cols and in pixels
|
||||
* @param (output) rows
|
||||
* @param (output) cols
|
||||
* @param (output) xPixels
|
||||
* @param (output) yPixels
|
||||
*/
|
||||
void screenSize(out long rows, out long cols,
|
||||
out long xPixels, out long yPixels);
|
||||
};
|
||||
|
||||
/* mozIXMLTermSuspend: interface to suspend/resume select XMLterm operations
|
||||
*/
|
||||
|
||||
/* NOT SCRIPTABLE */
|
||||
[uuid(0eb82b50-43a2-11d3-8e76-006008948af5)]
|
||||
|
||||
interface mozIXMLTermSuspend : nsISupports
|
||||
{
|
||||
attribute boolean suspend;
|
||||
};
|
||||
@@ -41,7 +41,6 @@
|
||||
#include "mozXMLT.h"
|
||||
#include "mozXMLTermUtils.h"
|
||||
#include "mozLineTerm.h"
|
||||
#include "lineterm.h"
|
||||
|
||||
#define MAXCOL 4096 // Maximum columns in line buffer
|
||||
|
||||
@@ -53,45 +52,57 @@ static NS_DEFINE_IID(kILineTermAuxIID, MOZILINETERMAUX_IID);
|
||||
|
||||
static NS_DEFINE_IID(kLineTermCID, MOZLINETERM_CID);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// mozLineTerm, mozLineTermAux factories
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
NS_NewLineTerm(mozILineTerm** aLineTerm)
|
||||
{
|
||||
NS_PRECONDITION(aLineTerm != nsnull, "null ptr");
|
||||
if (! aLineTerm)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aLineTerm = new mozLineTerm();
|
||||
if (! *aLineTerm)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*aLineTerm);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewLineTermAux(mozILineTermAux** aLineTermAux)
|
||||
{
|
||||
NS_PRECONDITION(aLineTermAux != nsnull, "null ptr");
|
||||
if (! aLineTermAux)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aLineTermAux = new mozLineTerm();
|
||||
if (! *aLineTermAux)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*aLineTermAux);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// mozLineTerm implementaion
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(mozLineTerm)
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS2(mozLineTerm,
|
||||
mozILineTerm,
|
||||
mozILineTermAux);
|
||||
|
||||
|
||||
PRBool mozLineTerm::mLoggingEnabled = PR_FALSE;
|
||||
|
||||
PRBool mozLineTerm::mLoggingInitialized = PR_FALSE;
|
||||
|
||||
NS_METHOD
|
||||
mozLineTerm::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (!mLoggingInitialized) {
|
||||
// Initialize all LINETERM operations
|
||||
// (This initialization needs to be done at factory creation time;
|
||||
// trying to do it earlier, i.e., at registration time,
|
||||
// does not work ... something to do with loading of static global
|
||||
// variables.)
|
||||
|
||||
int messageLevel = 0;
|
||||
char* debugStr = (char*) PR_GetEnv("LTERM_DEBUG");
|
||||
|
||||
if (debugStr && (strlen(debugStr) == 1)) {
|
||||
messageLevel = 98;
|
||||
debugStr = nsnull;
|
||||
}
|
||||
|
||||
int result = lterm_init(0);
|
||||
if (result == 0) {
|
||||
tlog_set_level(LTERM_TLOG_MODULE, messageLevel, debugStr);
|
||||
}
|
||||
mLoggingInitialized = PR_TRUE;
|
||||
|
||||
char* logStr = (char*) PR_GetEnv("LTERM_LOG");
|
||||
if (logStr && (strlen(logStr) > 0)) {
|
||||
// Enable LineTerm logging
|
||||
mozLineTerm::mLoggingEnabled = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return mozLineTermConstructor( aOuter,
|
||||
aIID,
|
||||
aResult );
|
||||
}
|
||||
|
||||
mozLineTerm::mozLineTerm() :
|
||||
mCursorRow(0),
|
||||
mCursorColumn(0),
|
||||
@@ -113,44 +124,6 @@ mozLineTerm::~mozLineTerm()
|
||||
}
|
||||
|
||||
|
||||
// Implement AddRef and Release
|
||||
NS_IMPL_ADDREF(mozLineTerm)
|
||||
NS_IMPL_RELEASE(mozLineTerm)
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
mozLineTerm::QueryInterface(REFNSIID aIID,void** aInstancePtr)
|
||||
{
|
||||
if (aInstancePtr == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
//XMLT_LOG(mozLineTerm::QueryInterface,30,("0x%x\n",aIID));
|
||||
|
||||
if ( aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsISupports*,
|
||||
NS_STATIC_CAST(mozILineTermAux*,this));
|
||||
|
||||
} else if ( aIID.Equals(NS_GET_IID(mozILineTerm)) ) {
|
||||
*aInstancePtr = NS_STATIC_CAST(mozILineTerm*,
|
||||
NS_STATIC_CAST(mozILineTermAux*,this));
|
||||
|
||||
} else if ( aIID.Equals(NS_GET_IID(mozILineTermAux)) ) {
|
||||
*aInstancePtr = NS_STATIC_CAST(mozILineTermAux*,this);
|
||||
|
||||
} else {
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
NS_ADDREF_THIS();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/** Checks if preference settings are secure for LineTerm creation and use
|
||||
*/
|
||||
NS_IMETHODIMP mozLineTerm::ArePrefsSecure(PRBool *_retval)
|
||||
@@ -412,7 +385,7 @@ NS_IMETHODIMP mozLineTerm::OpenAux(const PRUnichar *command,
|
||||
result = mozXMLTermUtils::TimeStamp(0, mLastTime, timeStamp);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
char* temStr = timeStamp.ToNewCString();
|
||||
fprintf(stderr, "<TS %s> LineTerm %d opened by principal %s\n",
|
||||
PR_LogPrint("<TS %s> LineTerm %d opened by principal %s\n",
|
||||
temStr, mLTerm, securePrincipal);
|
||||
nsMemory::Free(temStr);
|
||||
}
|
||||
@@ -576,11 +549,11 @@ NS_IMETHODIMP mozLineTerm::Write(const PRUnichar *buf,
|
||||
|
||||
if (NS_SUCCEEDED(result) && (timeStamp.Length() > 0)) {
|
||||
char* temStr = timeStamp.ToNewCString();
|
||||
fprintf(stderr, "<TS %s>\n", temStr);
|
||||
PR_LogPrint("<TS %s>\n", temStr);
|
||||
nsMemory::Free(temStr);
|
||||
|
||||
} else if (newline) {
|
||||
fprintf(stderr, "\n");
|
||||
PR_LogPrint("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,13 +25,15 @@
|
||||
#include "nspr.h"
|
||||
#include "nscore.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
|
||||
#include "mozILineTermAux.h"
|
||||
#include "mozILineTerm.h"
|
||||
#include "lineterm.h"
|
||||
|
||||
#define MAXCOL 4096 // Maximum columns in line buffer
|
||||
|
||||
@@ -43,58 +45,12 @@ public:
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_MOZILINETERM
|
||||
NS_DECL_MOZILINETERMAUX
|
||||
|
||||
// mozILineTerm interface
|
||||
NS_IMETHOD Open(const PRUnichar *command,
|
||||
const PRUnichar *initInput,
|
||||
const PRUnichar *promptRegexp,
|
||||
PRInt32 options, PRInt32 processType,
|
||||
nsIDOMDocument *domDoc);
|
||||
|
||||
NS_IMETHOD Close(const PRUnichar* aCookie);
|
||||
|
||||
NS_IMETHOD Write(const PRUnichar *buf, const PRUnichar* aCookie);
|
||||
|
||||
NS_IMETHOD Read(PRInt32 *opcodes, PRInt32 *opvals,
|
||||
PRInt32 *buf_row, PRInt32 *buf_col,
|
||||
const PRUnichar* aCookie,
|
||||
PRUnichar **_retval);
|
||||
|
||||
// mozILineTermAux interface add ons
|
||||
// (not scriptable, no authentication cookie required)
|
||||
|
||||
NS_IMETHOD OpenAux(const PRUnichar *command,
|
||||
const PRUnichar *initInput,
|
||||
const PRUnichar *promptRegexp,
|
||||
PRInt32 options, PRInt32 processType,
|
||||
PRInt32 nRows, PRInt32 nCols,
|
||||
PRInt32 xPixels, PRInt32 yPixels,
|
||||
nsIDOMDocument *domDoc,
|
||||
nsIObserver* anObserver,
|
||||
nsString& aCookie);
|
||||
|
||||
NS_IMETHOD SuspendAux(PRBool aSuspend);
|
||||
|
||||
NS_IMETHOD CloseAux(void);
|
||||
|
||||
NS_IMETHOD CloseAllAux(void);
|
||||
|
||||
NS_IMETHOD ResizeAux(PRInt32 nRows, PRInt32 nCols);
|
||||
|
||||
NS_IMETHOD ReadAux(PRInt32 *opcodes, PRInt32 *opvals,
|
||||
PRInt32 *buf_row, PRInt32 *buf_col,
|
||||
PRUnichar **_retval, PRUnichar **retstyle);
|
||||
|
||||
NS_IMETHOD GetCookie(nsString& aCookie);
|
||||
|
||||
NS_IMETHOD GetCursorRow(PRInt32 *aCursorRow);
|
||||
NS_IMETHOD SetCursorRow(PRInt32 aCursorRow);
|
||||
|
||||
NS_IMETHOD GetCursorColumn(PRInt32 *aCursorColumn);
|
||||
NS_IMETHOD SetCursorColumn(PRInt32 aCursorColumn);
|
||||
|
||||
NS_IMETHOD GetEchoFlag(PRBool *aEchoFlag);
|
||||
NS_IMETHOD SetEchoFlag(PRBool aEchoFlag);
|
||||
// Define a Create method to be used with a factory:
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
// others
|
||||
|
||||
@@ -104,9 +60,6 @@ public:
|
||||
gint source,
|
||||
GdkInputCondition condition);
|
||||
|
||||
/** Flag controlling logging of user input to STDERR */
|
||||
static PRBool mLoggingEnabled;
|
||||
|
||||
protected:
|
||||
/** Checks if Mozilla preference settings are secure
|
||||
* @param _retval (output) PR_TRUE if settings are secure
|
||||
@@ -146,4 +99,9 @@ protected:
|
||||
/** record of last time when timestamp was displayed in user input log */
|
||||
PRTime mLastTime;
|
||||
|
||||
/** Flag controlling logging of user input to STDERR */
|
||||
static PRBool mLoggingEnabled;
|
||||
|
||||
static PRBool mLoggingInitialized;
|
||||
|
||||
};
|
||||
|
||||
@@ -1,300 +0,0 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "MPL"); you may not use this file
|
||||
* except in compliance with the MPL. You may obtain a copy of
|
||||
* the MPL at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the MPL is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the MPL for the specific language governing
|
||||
* rights and limitations under the MPL.
|
||||
*
|
||||
* The Original Code is XMLterm.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ramalingam Saravanan.
|
||||
* Portions created by Ramalingam Saravanan <svn@xmlterm.org> are
|
||||
* Copyright (C) 1999 Ramalingam Saravanan. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
// mozXMLTermFactory.cpp: XPCOM factory for mozIXMLTermShell, mozILineTerm
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nscore.h"
|
||||
#include "nspr.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsXPComFactory.h"
|
||||
|
||||
#include "mozXMLT.h"
|
||||
#include "mozLineTerm.h"
|
||||
#include "mozIXMLTermShell.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
static NS_DEFINE_CID(kXMLTermShellCID, MOZXMLTERMSHELL_CID);
|
||||
static NS_DEFINE_CID(kLineTermCID, MOZLINETERM_CID);
|
||||
|
||||
class XMLTermFactory : public nsIFactory
|
||||
{
|
||||
public:
|
||||
XMLTermFactory(const nsCID &aClass, const char* className, const char* contractID);
|
||||
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIFactory methods
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
protected:
|
||||
virtual ~XMLTermFactory();
|
||||
|
||||
protected:
|
||||
nsCID mClassID;
|
||||
const char* mClassName;
|
||||
const char* mContractID;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// mozXMLTermFactory implementation
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Globals, useful to check if safe to unload module
|
||||
static PRInt32 gLockCnt = 0;
|
||||
static PRInt32 gInstanceCnt = 0;
|
||||
|
||||
XMLTermFactory::XMLTermFactory(const nsCID &aClass,
|
||||
const char* className,
|
||||
const char* contractID):
|
||||
mClassID(aClass),
|
||||
mClassName(className),
|
||||
mContractID(contractID)
|
||||
{
|
||||
// Zero reference counter
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&gInstanceCnt);
|
||||
}
|
||||
|
||||
|
||||
XMLTermFactory::~XMLTermFactory()
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
|
||||
PR_AtomicDecrement(&gInstanceCnt);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
XMLTermFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
||||
{
|
||||
if (!aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aResult = nsnull;
|
||||
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsISupports*, this);
|
||||
|
||||
} else if (aIID.Equals(kIFactoryIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsIFactory*, this);
|
||||
|
||||
} else {
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
NS_ADDREF_THIS();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_ADDREF(XMLTermFactory);
|
||||
NS_IMPL_RELEASE(XMLTermFactory);
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
XMLTermFactory::CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (!aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
*aResult = nsnull;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsISupports *inst = nsnull;
|
||||
if (mClassID.Equals(kXMLTermShellCID)) {
|
||||
if (NS_FAILED(rv = NS_NewXMLTermShell((mozIXMLTermShell**) &inst)))
|
||||
return rv;
|
||||
|
||||
} else if (mClassID.Equals(kLineTermCID)) {
|
||||
if (NS_FAILED(rv = NS_NewLineTerm((mozILineTerm**) &inst)))
|
||||
return rv;
|
||||
|
||||
} else {
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
if (! inst)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(rv = inst->QueryInterface(aIID, aResult))) {
|
||||
// We didn't get the right interface.
|
||||
NS_ERROR("didn't support the interface you wanted");
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(inst);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
XMLTermFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
if (aLock) {
|
||||
PR_AtomicIncrement(&gLockCnt);
|
||||
} else {
|
||||
PR_AtomicDecrement(&gLockCnt);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Exported functions for loading, registering, unregistering, and unloading
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Return approptiate factory to the caller
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(nsISupports* aServMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aContractID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
static PRBool ltermInitialized = PR_FALSE;
|
||||
static PRBool xmltermInitialized = PR_FALSE;
|
||||
|
||||
if (!ltermInitialized) {
|
||||
// Initialize all LINETERM operations
|
||||
// (This initialization needs to be done at factory creation time;
|
||||
// trying to do it earlier, i.e., at registration time,
|
||||
// does not work ... something to do with loading of static global
|
||||
// variables.)
|
||||
|
||||
int messageLevel = 8;
|
||||
char* debugStr = (char*) PR_GetEnv("LTERM_DEBUG");
|
||||
|
||||
if (debugStr && (strlen(debugStr) == 1)) {
|
||||
messageLevel = 98;
|
||||
debugStr = nsnull;
|
||||
}
|
||||
|
||||
int result = lterm_init(0);
|
||||
if (result == 0) {
|
||||
tlog_set_level(LTERM_TLOG_MODULE, messageLevel, debugStr);
|
||||
}
|
||||
ltermInitialized = PR_TRUE;
|
||||
|
||||
char* logStr = (char*) PR_GetEnv("LTERM_LOG");
|
||||
if (logStr && (strlen(logStr) > 0)) {
|
||||
// Enable LineTerm logging
|
||||
mozLineTerm::mLoggingEnabled = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (aClass.Equals(kXMLTermShellCID) && !xmltermInitialized) {
|
||||
// Set initial debugging message level for XMLterm
|
||||
int messageLevel = 8;
|
||||
char* debugStr = (char*) PR_GetEnv("XMLT_DEBUG");
|
||||
|
||||
if (debugStr && (strlen(debugStr) == 1)) {
|
||||
messageLevel = 98;
|
||||
debugStr = nsnull;
|
||||
}
|
||||
|
||||
tlog_set_level(XMLT_TLOG_MODULE, messageLevel, debugStr);
|
||||
xmltermInitialized = PR_TRUE;
|
||||
}
|
||||
|
||||
if (!aFactory)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aFactory = nsnull;
|
||||
|
||||
XMLTermFactory* factory = new XMLTermFactory(aClass, aClassName,
|
||||
aContractID);
|
||||
if (factory == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(factory);
|
||||
*aFactory = factory;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSRegisterSelf(nsISupports* aServMgr , const char* aPath)
|
||||
{
|
||||
nsresult result;
|
||||
|
||||
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &result));
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
||||
nsCOMPtr<nsIComponentManager> compMgr =
|
||||
do_GetService(kComponentManagerCID, &result);
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
||||
printf("Registering lineterm interface\n");
|
||||
|
||||
result = compMgr->RegisterComponent(kLineTermCID,
|
||||
"LineTerm Component",
|
||||
"@mozilla.org/xmlterm/lineterm;1",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
||||
printf("Registering xmlterm shell interface\n");
|
||||
|
||||
result = compMgr->RegisterComponent(kXMLTermShellCID,
|
||||
"XMLTerm Shell Component",
|
||||
"@mozilla.org/xmlterm/xmltermshell;1",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSUnregisterSelf(nsISupports* aServMgr, const char* aPath)
|
||||
{
|
||||
nsresult result;
|
||||
|
||||
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &result));
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
||||
nsCOMPtr<nsIComponentManager> compMgr =
|
||||
do_GetService(kComponentManagerCID, &result);
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
||||
result = compMgr->UnregisterComponent(kLineTermCID, aPath);
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
||||
result = compMgr->UnregisterComponent(kXMLTermShellCID, aPath);
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIDOMNSUIEvent.h"
|
||||
#include "nsIPrivateTextEvent.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsISelectionController.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
@@ -419,7 +420,7 @@ mozXMLTermKeyListener::KeyPress(nsIDOMEvent* aKeyEvent)
|
||||
|
||||
keyString.Append((PRUnichar) keyChar);
|
||||
|
||||
result = mXMLTerminal->SendTextAux(keyString);
|
||||
result = mXMLTerminal->SendTextAux(keyString.get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -500,7 +501,7 @@ mozXMLTermTextListener::HandleText(nsIDOMEvent* aTextEvent)
|
||||
textEvent->GetText(textStr);
|
||||
|
||||
// Transmit text to terminal
|
||||
mXMLTerminal->SendTextAux(textStr);
|
||||
mXMLTerminal->SendTextAux(textStr.get());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "mozIXMLTerminal.h"
|
||||
#include "mozIXMLTermSuspend.h"
|
||||
|
||||
/* XMLTerm Key Listener */
|
||||
class mozXMLTermKeyListener : public nsIDOMKeyListener,
|
||||
|
||||
@@ -23,8 +23,10 @@
|
||||
#include "nscore.h"
|
||||
#include "prlog.h"
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
#include "nsMemory.h"
|
||||
|
||||
@@ -51,8 +53,8 @@
|
||||
#include "nsIHTMLContent.h"
|
||||
|
||||
#include "mozXMLT.h"
|
||||
#include "mozILineTermAux.h"
|
||||
#include "mozIXMLTerminal.h"
|
||||
#include "mozIXMLTermStream.h"
|
||||
#include "mozXMLTermUtils.h"
|
||||
#include "mozXMLTermSession.h"
|
||||
#include "nsISelectionController.h"
|
||||
@@ -303,7 +305,7 @@ NS_IMETHODIMP mozXMLTermSession::Resize(mozILineTermAux* lineTermAux)
|
||||
|
||||
// Determine current screen dimensions
|
||||
PRInt32 nRows, nCols, xPixels, yPixels;
|
||||
result = mXMLTerminal->ScreenSize(nRows, nCols, xPixels, yPixels);
|
||||
result = mXMLTerminal->ScreenSize(&nRows, &nCols, &xPixels, &yPixels);
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
@@ -898,8 +900,8 @@ NS_IMETHODIMP mozXMLTermSession::ReadAll(mozILineTermAux* lineTermAux,
|
||||
CopyUCS2toASCII(metaCommandOutput, cstrout);
|
||||
else
|
||||
cstrout = "Error in displaying URL\n";
|
||||
printf("mozXMLTermSession::ReadAll, DEFAULT_META output=%s\n",
|
||||
cstrout.get());
|
||||
XMLT_LOG(mozXMLTermSession::ReadAll,63,
|
||||
("DEFAULT_META output=%s\n", cstrout.get()));
|
||||
|
||||
}
|
||||
break;
|
||||
@@ -933,8 +935,8 @@ NS_IMETHODIMP mozXMLTermSession::ReadAll(mozILineTermAux* lineTermAux,
|
||||
CopyUCS2toASCII(metaCommandOutput, cstrout);
|
||||
else
|
||||
cstrout = "Error in executing JavaScript command\n";
|
||||
printf("mozXMLTermSession::ReadAll, JS output=%s\n",
|
||||
cstrout.get());
|
||||
XMLT_LOG(mozXMLTermSession::ReadAll,63,
|
||||
("JS output=%s\n", cstrout.get()));
|
||||
|
||||
}
|
||||
break;
|
||||
@@ -1369,7 +1371,8 @@ NS_IMETHODIMP mozXMLTermSession::InitStream(const nsString& streamURL,
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
result = NS_NewXMLTermStream(getter_AddRefs(mXMLTermStream));
|
||||
mXMLTermStream = do_CreateInstance( MOZXMLTERMSTREAM_CONTRACTID,
|
||||
&result);
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
@@ -1384,8 +1387,7 @@ NS_IMETHODIMP mozXMLTermSession::InitStream(const nsString& streamURL,
|
||||
getter_AddRefs(outerDOMWindow));
|
||||
|
||||
if (NS_FAILED(result) || !outerDOMWindow) {
|
||||
fprintf(stderr,
|
||||
"mozXMLTermSession::InitStream: Failed to convert webshell\n");
|
||||
XMLT_ERROR("mozXMLTermSession::InitStream: Failed to convert webshell\n");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@@ -1418,8 +1420,7 @@ NS_IMETHODIMP mozXMLTermSession::InitStream(const nsString& streamURL,
|
||||
url.get(),
|
||||
contentType.get(), 800);
|
||||
if (NS_FAILED(result)) {
|
||||
fprintf(stderr,
|
||||
"mozXMLTermSession::InitStream: Failed to open stream\n");
|
||||
XMLT_ERROR("mozXMLTermSession::InitStream: Failed to open stream\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1532,7 +1533,7 @@ NS_IMETHODIMP mozXMLTermSession::BreakOutput(PRBool positionCursorBelow)
|
||||
// Close HTML/XML document
|
||||
result = mXMLTermStream->Close();
|
||||
if (NS_FAILED(result)) {
|
||||
fprintf(stderr, "mozXMLTermSession::BreakOutput: Failed to close stream\n");
|
||||
XMLT_ERROR("mozXMLTermSession::BreakOutput: Failed to close stream\n");
|
||||
return result;
|
||||
}
|
||||
mXMLTermStream = nsnull;
|
||||
@@ -1635,7 +1636,7 @@ NS_IMETHODIMP mozXMLTermSession::ProcessOutput(const nsString& aString,
|
||||
|
||||
result = mXMLTermStream->Write(str.get());
|
||||
if (NS_FAILED(result)) {
|
||||
fprintf(stderr, "mozXMLTermSession::ProcessOutput: Failed to write to stream\n");
|
||||
XMLT_ERROR("mozXMLTermSession::ProcessOutput: Failed to write to stream\n");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
@@ -36,7 +37,7 @@
|
||||
#include "nsIContent.h"
|
||||
|
||||
#include "mozXMLT.h"
|
||||
#include "mozILineTermAux.h"
|
||||
#include "mozILineTerm.h"
|
||||
#include "mozIXMLTerminal.h"
|
||||
#include "mozIXMLTermStream.h"
|
||||
|
||||
|
||||
@@ -49,39 +49,71 @@
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
|
||||
#include "mozXMLT.h"
|
||||
#include "mozLineTerm.h"
|
||||
#include "mozXMLTermUtils.h"
|
||||
#include "mozXMLTermShell.h"
|
||||
|
||||
// Define Interface IDs
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
// Define Class IDs
|
||||
static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// mozXMLTermShell factory
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
NS_NewXMLTermShell(mozIXMLTermShell** aXMLTermShell)
|
||||
{
|
||||
NS_PRECONDITION(aXMLTermShell != nsnull, "null ptr");
|
||||
if (! aXMLTermShell)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aXMLTermShell = new mozXMLTermShell();
|
||||
if (! *aXMLTermShell)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*aXMLTermShell);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// mozXMLTermShell implementation
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(mozXMLTermShell)
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(mozXMLTermShell,
|
||||
mozIXMLTermShell);
|
||||
|
||||
PRBool mozXMLTermShell::mLoggingInitialized = PR_FALSE;
|
||||
|
||||
NS_METHOD
|
||||
mozXMLTermShell::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
|
||||
if (!mLoggingInitialized) {
|
||||
// Set initial debugging message level for XMLterm
|
||||
int messageLevel = 0;
|
||||
char* debugStr = (char*) PR_GetEnv("XMLT_DEBUG");
|
||||
|
||||
if (debugStr && (strlen(debugStr) == 1)) {
|
||||
messageLevel = 98;
|
||||
debugStr = nsnull;
|
||||
}
|
||||
|
||||
tlog_set_level(XMLT_TLOG_MODULE, messageLevel, debugStr);
|
||||
mLoggingInitialized = PR_TRUE;
|
||||
}
|
||||
|
||||
return mozXMLTermShellConstructor( aOuter,
|
||||
aIID,
|
||||
aResult );
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
mozXMLTermShell::RegisterProc(nsIComponentManager *aCompMgr,
|
||||
nsIFile *aPath,
|
||||
const char *registryLocation,
|
||||
const char *componentType,
|
||||
const nsModuleComponentInfo *info)
|
||||
{
|
||||
// Component specific actions at registration time
|
||||
PR_LogPrint("mozXMLTermShell::RegisterProc: registered mozXMLTermShell\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
mozXMLTermShell::UnregisterProc(nsIComponentManager *aCompMgr,
|
||||
nsIFile *aPath,
|
||||
const char *registryLocation,
|
||||
const nsModuleComponentInfo *info)
|
||||
{
|
||||
// Component specific actions at unregistration time
|
||||
return NS_OK; // Return value is not used
|
||||
}
|
||||
|
||||
|
||||
mozXMLTermShell::mozXMLTermShell() :
|
||||
mInitialized(PR_FALSE),
|
||||
mContentWindow(nsnull),
|
||||
@@ -97,37 +129,6 @@ mozXMLTermShell::~mozXMLTermShell()
|
||||
}
|
||||
|
||||
|
||||
// Implement AddRef and Release
|
||||
NS_IMPL_ADDREF(mozXMLTermShell)
|
||||
NS_IMPL_RELEASE(mozXMLTermShell)
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
mozXMLTermShell::QueryInterface(REFNSIID aIID,void** aInstancePtr)
|
||||
{
|
||||
if (aInstancePtr == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
if ( aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsISupports*,
|
||||
NS_STATIC_CAST(mozIXMLTermShell*,this));
|
||||
|
||||
} else if ( aIID.Equals(NS_GET_IID(mozIXMLTermShell)) ) {
|
||||
*aInstancePtr = NS_STATIC_CAST(mozIXMLTermShell*,this);
|
||||
|
||||
} else {
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
NS_ADDREF_THIS();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP mozXMLTermShell::GetCurrentEntryNumber(PRInt32 *aNumber)
|
||||
{
|
||||
@@ -239,22 +240,20 @@ mozXMLTermShell::Init(nsIDOMWindowInternal* aContentWin,
|
||||
mContentAreaDocShell = docShell; // SVN: does this assignment addref?
|
||||
|
||||
// Create XMLTerminal
|
||||
nsCOMPtr<mozIXMLTerminal> newXMLTerminal;
|
||||
result = NS_NewXMLTerminal(getter_AddRefs(newXMLTerminal));
|
||||
nsCOMPtr<mozIXMLTerminal> newXMLTerminal = do_CreateInstance(
|
||||
MOZXMLTERMINAL_CONTRACTID,
|
||||
&result);
|
||||
if(NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
if(!newXMLTerminal)
|
||||
result = NS_ERROR_OUT_OF_MEMORY;
|
||||
// Initialize XMLTerminal with non-owning reference to us
|
||||
result = newXMLTerminal->Init(mContentAreaDocShell, this, URL, args);
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// Initialize XMLTerminal with non-owning reference to us
|
||||
result = newXMLTerminal->Init(mContentAreaDocShell, this, URL, args);
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
mXMLTerminal = newXMLTerminal;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
mXMLTerminal = newXMLTerminal;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -334,11 +333,9 @@ NS_IMETHODIMP mozXMLTermShell::SendText(const PRUnichar* aString,
|
||||
if (!mXMLTerminal)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString sendStr (aString);
|
||||
XMLT_LOG(mozXMLTermShell::SendText,10,("\n"));
|
||||
|
||||
XMLT_LOG(mozXMLTermShell::SendText,10,("length=%d\n", sendStr.Length()));
|
||||
|
||||
return mXMLTerminal->SendText(sendStr, aCookie);
|
||||
return mXMLTerminal->SendText(aString, aCookie);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "nspr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
|
||||
#include "mozXMLT.h"
|
||||
#include "mozIXMLTerminal.h"
|
||||
@@ -43,31 +44,24 @@ class mozXMLTermShell : public mozIXMLTermShell
|
||||
virtual ~mozXMLTermShell();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_MOZIXMLTERMSHELL
|
||||
|
||||
// mozIXMLTermShell interface
|
||||
|
||||
NS_IMETHOD GetCurrentEntryNumber(PRInt32 *aNumber);
|
||||
// Define a Create method to be used with a factory:
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
NS_IMETHOD SetHistory(PRInt32 aHistory, const PRUnichar* aCookie);
|
||||
static NS_METHOD
|
||||
RegisterProc(nsIComponentManager *aCompMgr,
|
||||
nsIFile *aPath,
|
||||
const char *registryLocation,
|
||||
const char *componentType,
|
||||
const nsModuleComponentInfo *info);
|
||||
|
||||
NS_IMETHOD SetPrompt(const PRUnichar* aPrompt, const PRUnichar* aCookie);
|
||||
|
||||
NS_IMETHOD IgnoreKeyPress(PRBool aIgnore,
|
||||
const PRUnichar* aCookie);
|
||||
|
||||
NS_IMETHOD Init(nsIDOMWindowInternal* aContentWin,
|
||||
const PRUnichar* URL,
|
||||
const PRUnichar* args);
|
||||
|
||||
NS_IMETHOD Close(const PRUnichar* aCookie);
|
||||
|
||||
NS_IMETHOD Poll(void);
|
||||
|
||||
NS_IMETHOD Resize(void);
|
||||
|
||||
NS_IMETHOD SendText(const PRUnichar* aString, const PRUnichar* aCookie);
|
||||
|
||||
NS_IMETHOD Exit(void);
|
||||
static NS_METHOD
|
||||
UnregisterProc(nsIComponentManager *aCompMgr,
|
||||
nsIFile *aPath,
|
||||
const char *registryLocation,
|
||||
const nsModuleComponentInfo *info);
|
||||
|
||||
NS_IMETHOD Finalize(void);
|
||||
|
||||
@@ -84,4 +78,6 @@ protected:
|
||||
|
||||
/** owning reference to XMLTerminal object created by us */
|
||||
nsCOMPtr<mozIXMLTerminal> mXMLTerminal;
|
||||
|
||||
static PRBool mLoggingInitialized;
|
||||
};
|
||||
|
||||
@@ -30,13 +30,10 @@
|
||||
#include "nsMemory.h"
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIDocumentLoader.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDocumentLoaderFactory.h"
|
||||
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsIScrollableView.h"
|
||||
@@ -46,49 +43,20 @@
|
||||
#include "nsIScriptContextOwner.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIDOMWindowCollection.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
#include "nsIURL.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
#include "mozXMLT.h"
|
||||
#include "mozXMLTermUtils.h"
|
||||
#include "mozXMLTermStream.h"
|
||||
|
||||
static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// mozXMLTermStream factory
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
NS_NewXMLTermStream(mozIXMLTermStream** aXMLTermStream)
|
||||
{
|
||||
NS_PRECONDITION(aXMLTermStream != nsnull, "null ptr");
|
||||
if (!aXMLTermStream)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aXMLTermStream = new mozXMLTermStream();
|
||||
if (! *aXMLTermStream)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*aXMLTermStream);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// mozXMLTermStream implementation
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS2(mozXMLTermStream,
|
||||
mozIXMLTermStream,
|
||||
nsIInputStream);
|
||||
|
||||
mozXMLTermStream::mozXMLTermStream() :
|
||||
mUTF8Buffer(""),
|
||||
@@ -113,42 +81,6 @@ mozXMLTermStream::~mozXMLTermStream()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Implement AddRef and Release
|
||||
NS_IMPL_ADDREF(mozXMLTermStream)
|
||||
NS_IMPL_RELEASE(mozXMLTermStream)
|
||||
|
||||
NS_IMETHODIMP
|
||||
mozXMLTermStream::QueryInterface(REFNSIID aIID,void** aInstancePtr)
|
||||
{
|
||||
if (aInstancePtr == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
if ( aIID.Equals(NS_GET_IID(nsISupports))) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsISupports*,
|
||||
NS_STATIC_CAST(mozIXMLTermStream*,this));
|
||||
} else if(aIID.Equals(NS_GET_IID(nsIInputStream))) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIInputStream*,this);
|
||||
|
||||
} else if(aIID.Equals(NS_GET_IID(mozIXMLTermStream))) {
|
||||
*aInstancePtr = NS_STATIC_CAST(mozIXMLTermStream*,this);
|
||||
|
||||
} else {
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
NS_ADDREF_THIS();
|
||||
|
||||
XMLT_LOG(mozXMLTermStream::QueryInterface,20,("mRefCnt = %d\n", mRefCnt));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// mozIXMLTermStream interface
|
||||
|
||||
/** Open stream in specified frame, or in current frame if frameName is null
|
||||
@@ -251,7 +183,7 @@ NS_IMETHODIMP mozXMLTermStream::Open(nsIDOMWindowInternal* aDOMWindow,
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef NO_WORKAROUND
|
||||
printf("mozXMLTermStream::Open, NO_WORKAROUND, url=%s\n", contentURL);
|
||||
XMLT_WARNING("mozXMLTermStream::Open, NO_WORKAROUND, url=%s\n", contentURL);
|
||||
|
||||
nsCOMPtr<nsIInputStream> inputStream = this;
|
||||
|
||||
@@ -326,22 +258,22 @@ NS_IMETHODIMP mozXMLTermStream::Open(nsIDOMWindowInternal* aDOMWindow,
|
||||
return result;
|
||||
|
||||
#else // !NO_WORKAROUND
|
||||
printf("mozXMLTermStream::Open, WORKAROUND\n");
|
||||
XMLT_WARNING("mozXMLTermStream::Open, WORKAROUND\n");
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> innerDOMDoc;
|
||||
result = mDOMWindow->GetDocument(getter_AddRefs(innerDOMDoc));
|
||||
printf("mozXMLTermStream::Open,check1, 0x%x, 0x%x\n",
|
||||
XMLT_WARNING("mozXMLTermStream::Open,check1, 0x%x, 0x%x\n",
|
||||
result, (int) innerDOMDoc.get());
|
||||
if (NS_FAILED(result) || !innerDOMDoc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mDOMHTMLDocument = do_QueryInterface(innerDOMDoc);
|
||||
printf("mozXMLTermStream::Open,check2, 0x%x\n", result);
|
||||
XMLT_WARNING("mozXMLTermStream::Open,check2, 0x%x\n", result);
|
||||
if (!mDOMHTMLDocument)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
result = mDOMHTMLDocument->Open();
|
||||
printf("mozXMLTermStream::Open,check3, 0x%x\n", result);
|
||||
XMLT_WARNING("mozXMLTermStream::Open,check3, 0x%x\n", result);
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
#endif // !NO_WORKAROUND
|
||||
@@ -463,13 +395,13 @@ NS_IMETHODIMP mozXMLTermStream::SizeToContentHeight(PRInt32 maxHeight)
|
||||
pageWidth = PRInt32((float)contX*pixelScale);
|
||||
pageHeight = PRInt32((float)contY*pixelScale);
|
||||
|
||||
printf("mozXMLTermStream::SizeToContentHeight: scrollbar %d, %d\n",
|
||||
XMLT_WARNING("mozXMLTermStream::SizeToContentHeight: scrollbar %d, %d\n",
|
||||
scrollBarWidth, scrollBarHeight);
|
||||
|
||||
printf("mozXMLTermStream::SizeToContentHeight: presShell %d, %d\n",
|
||||
XMLT_WARNING("mozXMLTermStream::SizeToContentHeight: presShell %d, %d\n",
|
||||
shellWidth, shellHeight);
|
||||
|
||||
printf("mozXMLTermStream::SizeToContentHeight: page %d, %d, %e\n",
|
||||
XMLT_WARNING("mozXMLTermStream::SizeToContentHeight: page %d, %d, %e\n",
|
||||
pageWidth, pageHeight, pixelScale);
|
||||
|
||||
if ((pageHeight > shellHeight) || (pageWidth > shellWidth)) {
|
||||
@@ -481,7 +413,7 @@ NS_IMETHODIMP mozXMLTermStream::SizeToContentHeight(PRInt32 maxHeight)
|
||||
PRInt32 newPageHeight = pageHeight;
|
||||
PRInt32 excessWidth = (pageWidth+scrollBarWidth - shellWidth);
|
||||
|
||||
printf("mozXMLTermStream::SizeToContentHeight: excessWidth %d\n",
|
||||
XMLT_WARNING("mozXMLTermStream::SizeToContentHeight: excessWidth %d\n",
|
||||
excessWidth);
|
||||
|
||||
if (excessWidth > 0) {
|
||||
@@ -499,7 +431,7 @@ NS_IMETHODIMP mozXMLTermStream::SizeToContentHeight(PRInt32 maxHeight)
|
||||
if (excessWidth > scrollBarWidth)
|
||||
newPageHeight += scrollBarHeight;
|
||||
|
||||
printf("mozXMLTermStream::SizeToContentHeight: page2 %d, %d, %d\n",
|
||||
XMLT_WARNING("mozXMLTermStream::SizeToContentHeight: page2 %d, %d, %d\n",
|
||||
pageWidth, pageHeight, newPageHeight);
|
||||
|
||||
// Reset IFRAME width
|
||||
@@ -610,7 +542,7 @@ NS_IMETHODIMP mozXMLTermStream::Write(const PRUnichar* buf)
|
||||
return result;
|
||||
#endif // !NO_WORKAROUND
|
||||
|
||||
printf("mozXMLTermStream::Write: str=%s\n", mUTF8Buffer.get());
|
||||
XMLT_WARNING("mozXMLTermStream::Write: str=%s\n", mUTF8Buffer.get());
|
||||
|
||||
XMLT_LOG(mozXMLTermStream::Write,51,("returning mUTF8Offset=%d\n",
|
||||
mUTF8Offset));
|
||||
|
||||
@@ -26,6 +26,27 @@
|
||||
#include "nspr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIDOMWindowCollection.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
#include "nsIDocumentLoader.h"
|
||||
#include "nsIDocumentLoaderFactory.h"
|
||||
|
||||
#include "nsIURL.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIIOService.h"
|
||||
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
#include "mozXMLT.h"
|
||||
#include "mozIXMLTermStream.h"
|
||||
@@ -39,23 +60,9 @@ class mozXMLTermStream : public mozIXMLTermStream
|
||||
mozXMLTermStream();
|
||||
virtual ~mozXMLTermStream();
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIInputStream interface
|
||||
NS_DECL_NSIINPUTSTREAM
|
||||
|
||||
// mozIXMLTermStream interface
|
||||
|
||||
// Open stream in specified frame, or in current frame if frameName is null
|
||||
NS_IMETHOD Open(nsIDOMWindowInternal* aDOMWindow,
|
||||
const char* frameName,
|
||||
const char* contentURL,
|
||||
const char* contentType,
|
||||
PRInt32 maxResizeHeight);
|
||||
|
||||
// Write Unicode string to stream
|
||||
NS_IMETHOD Write(const PRUnichar* buf);
|
||||
NS_DECL_MOZIXMLTERMSTREAM
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -59,7 +59,6 @@
|
||||
#include "mozXMLT.h"
|
||||
#include "mozXMLTermUtils.h"
|
||||
#include "mozXMLTerminal.h"
|
||||
#include "mozIXMLTermSuspend.h"
|
||||
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
@@ -68,38 +67,20 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
static NS_DEFINE_IID(kIXMLTerminalIID, MOZIXMLTERMINAL_IID);
|
||||
static NS_DEFINE_IID(kXMLTerminalCID, MOZXMLTERMINAL_CID);
|
||||
|
||||
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
|
||||
static NS_DEFINE_CID(kCTransferableCID, NS_TRANSFERABLE_CID);
|
||||
static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// mozXMLTerminal factory
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
NS_NewXMLTerminal(mozIXMLTerminal** aXMLTerminal)
|
||||
{
|
||||
NS_PRECONDITION(aXMLTerminal != nsnull, "null ptr");
|
||||
if (!aXMLTerminal)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aXMLTerminal = new mozXMLTerminal();
|
||||
if (! *aXMLTerminal)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*aXMLTerminal);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// mozXMLTerminal implementation
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS4(mozXMLTerminal,
|
||||
mozIXMLTerminal,
|
||||
nsIWebProgressListener,
|
||||
nsIObserver,
|
||||
nsISupportsWeakReference);
|
||||
|
||||
mozXMLTerminal::mozXMLTerminal() :
|
||||
mInitialized(PR_FALSE),
|
||||
|
||||
@@ -135,25 +116,6 @@ mozXMLTerminal::~mozXMLTerminal()
|
||||
}
|
||||
|
||||
|
||||
// Implement AddRef and Release
|
||||
NS_IMPL_ADDREF(mozXMLTerminal)
|
||||
NS_IMPL_RELEASE(mozXMLTerminal)
|
||||
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(mozXMLTerminal)
|
||||
/*
|
||||
I maintained the order from the original, however,
|
||||
the original called |XMLT_LOG| and in the interface-map form
|
||||
it no longer does. Is this an issue?
|
||||
*/
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, mozIXMLTerminal)
|
||||
NS_INTERFACE_MAP_ENTRY(mozIXMLTerminal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIObserver)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
|
||||
NS_IMETHODIMP mozXMLTerminal::GetCurrentEntryNumber(PRInt32 *aNumber)
|
||||
{
|
||||
if (!mXMLTermSession)
|
||||
@@ -384,7 +346,7 @@ NS_IMETHODIMP mozXMLTerminal::Activate(void)
|
||||
nsCOMPtr<mozIXMLTermStream> stream;
|
||||
result = NS_NewXMLTermStream(getter_AddRefs(stream));
|
||||
if (NS_FAILED(result)) {
|
||||
fprintf(stderr, "mozXMLTerminal::Activate: Failed to create stream\n");
|
||||
XMLT_ERROR("mozXMLTerminal::Activate: Failed to create stream\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -397,26 +359,26 @@ NS_IMETHODIMP mozXMLTerminal::Activate(void)
|
||||
getter_AddRefs(outerDOMWindow));
|
||||
|
||||
if (NS_FAILED(result) || !outerDOMWindow) {
|
||||
fprintf(stderr, "mozXMLTerminal::Activate: Failed to convert docshell\n");
|
||||
XMLT_ERROR("mozXMLTerminal::Activate: Failed to convert docshell\n");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
result = stream->Open(outerDOMWindow, "iframet", "chrome://dummy",
|
||||
"text/html", 800);
|
||||
if (NS_FAILED(result)) {
|
||||
fprintf(stderr, "mozXMLTerminal::Activate: Failed to open stream\n");
|
||||
XMLT_ERROR("mozXMLTerminal::Activate: Failed to open stream\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
result = stream->Write(streamData.get());
|
||||
if (NS_FAILED(result)) {
|
||||
fprintf(stderr, "mozXMLTerminal::Activate: Failed to write to stream\n");
|
||||
XMLT_ERROR("mozXMLTerminal::Activate: Failed to write to stream\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
result = stream->Close();
|
||||
if (NS_FAILED(result)) {
|
||||
fprintf(stderr, "mozXMLTerminal::Activate: Failed to close stream\n");
|
||||
XMLT_ERROR("mozXMLTerminal::Activate: Failed to close stream\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -467,7 +429,7 @@ NS_IMETHODIMP mozXMLTerminal::Activate(void)
|
||||
|
||||
// Determine current screen dimensions
|
||||
PRInt32 nRows, nCols, xPixels, yPixels;
|
||||
result = ScreenSize(nRows, nCols, xPixels, yPixels);
|
||||
result = ScreenSize(&nRows, &nCols, &xPixels, &yPixels);
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
@@ -495,7 +457,7 @@ NS_IMETHODIMP mozXMLTerminal::Activate(void)
|
||||
// Instantiate LineTerm
|
||||
XMLT_LOG(mozXMLTerminal::Activate,22,
|
||||
("instantiating lineterm, nRows=%d, nCols=%d\n", nRows, nCols));
|
||||
result = NS_NewLineTermAux(getter_AddRefs(mLineTermAux));
|
||||
mLineTermAux = do_CreateInstance(MOZLINETERM_CONTRACTID, &result);
|
||||
if (NS_FAILED(result)) {
|
||||
XMLT_WARNING("mozXMLTerminal::Activate: Warning - Failed to instantiate LineTermAux\n");
|
||||
return result;
|
||||
@@ -607,8 +569,8 @@ NS_IMETHODIMP mozXMLTerminal::Activate(void)
|
||||
* @param (output) xPixels
|
||||
* @param (output) yPixels
|
||||
*/
|
||||
NS_IMETHODIMP mozXMLTerminal::ScreenSize(PRInt32& rows, PRInt32& cols,
|
||||
PRInt32& xPixels, PRInt32& yPixels)
|
||||
NS_IMETHODIMP mozXMLTerminal::ScreenSize(PRInt32* rows, PRInt32* cols,
|
||||
PRInt32* xPixels, PRInt32* yPixels)
|
||||
{
|
||||
nsresult result;
|
||||
|
||||
@@ -661,33 +623,33 @@ NS_IMETHODIMP mozXMLTerminal::ScreenSize(PRInt32& rows, PRInt32& cols,
|
||||
xdel = pixelScale * fontWidth;
|
||||
ydel = pixelScale * fontHeight + 2;
|
||||
|
||||
xPixels = (int) (pixelScale * shellArea.width);
|
||||
yPixels = (int) (pixelScale * shellArea.height);
|
||||
*xPixels = (int) (pixelScale * shellArea.width);
|
||||
*yPixels = (int) (pixelScale * shellArea.height);
|
||||
|
||||
// Determine number of rows/columns
|
||||
rows = (int) ((yPixels-16) / ydel);
|
||||
cols = (int) ((xPixels-20) / xdel);
|
||||
*rows = (int) ((*yPixels-16) / ydel);
|
||||
*cols = (int) ((*xPixels-20) / xdel);
|
||||
|
||||
if (rows < 1) rows = 1;
|
||||
if (cols < 1) cols = 1;
|
||||
if (*rows < 1) *rows = 1;
|
||||
if (*cols < 1) *cols = 1;
|
||||
|
||||
XMLT_LOG(mozXMLTerminal::ScreenSize,72,
|
||||
("rows=%d, cols=%d, xPixels=%d, yPixels=%d\n",
|
||||
rows, cols, xPixels, yPixels));
|
||||
*rows, *cols, *xPixels, *yPixels));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// Transmit string to LineTerm (use saved cookie)
|
||||
NS_IMETHODIMP mozXMLTerminal::SendTextAux(const nsString& aString)
|
||||
NS_IMETHODIMP mozXMLTerminal::SendTextAux(const PRUnichar* aString)
|
||||
{
|
||||
return SendText(aString, mCookie.get());
|
||||
}
|
||||
|
||||
|
||||
// Transmit string to LineTerm
|
||||
NS_IMETHODIMP mozXMLTerminal::SendText(const nsString& aString,
|
||||
NS_IMETHODIMP mozXMLTerminal::SendText(const PRUnichar* aString,
|
||||
const PRUnichar* aCookie)
|
||||
{
|
||||
nsresult result;
|
||||
@@ -835,7 +797,7 @@ NS_IMETHODIMP mozXMLTerminal::Paste()
|
||||
PRUnichar* text = nsnull;
|
||||
textDataObj->ToString ( &text );
|
||||
pasteString.Assign( text, objLen / 2 );
|
||||
result = SendTextAux(pasteString);
|
||||
result = SendTextAux(pasteString.get());
|
||||
}
|
||||
}
|
||||
nsMemory::Free(bestFlavor);
|
||||
|
||||
@@ -28,11 +28,12 @@
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
|
||||
#include "mozXMLT.h"
|
||||
|
||||
#include "mozILineTermAux.h"
|
||||
#include "mozILineTerm.h"
|
||||
#include "mozIXMLTerminal.h"
|
||||
#include "mozXMLTermSession.h"
|
||||
#include "mozXMLTermListeners.h"
|
||||
@@ -56,49 +57,7 @@ class mozXMLTerminal : public mozIXMLTerminal,
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
|
||||
// mozIXMLTerminal interface
|
||||
|
||||
NS_IMETHOD Init(nsIDocShell* aDocShell,
|
||||
mozIXMLTermShell* aXMLTermShell,
|
||||
const PRUnichar* aURL,
|
||||
const PRUnichar* args);
|
||||
|
||||
NS_IMETHOD Finalize(void);
|
||||
NS_IMETHOD Poll(void);
|
||||
|
||||
NS_IMETHOD GetCurrentEntryNumber(PRInt32 *aNumber);
|
||||
NS_IMETHOD GetHistory(PRInt32 *aHistory);
|
||||
NS_IMETHOD SetHistory(PRInt32 aHistory);
|
||||
NS_IMETHOD GetPrompt(PRUnichar **aPrompt);
|
||||
NS_IMETHOD SetPrompt(const PRUnichar* aPrompt);
|
||||
NS_IMETHOD GetKeyIgnore(PRBool* aIgnore);
|
||||
NS_IMETHOD SetKeyIgnore(const PRBool aIgnore);
|
||||
|
||||
NS_IMETHOD SendTextAux(const nsString& aString);
|
||||
NS_IMETHOD SendText(const nsString& aString, const PRUnichar* aCookie);
|
||||
|
||||
NS_IMETHOD Paste();
|
||||
|
||||
NS_IMETHOD GetDocument(nsIDOMDocument** aDoc);
|
||||
|
||||
NS_IMETHOD GetDocShell(nsIDocShell** aDocShell);
|
||||
|
||||
NS_IMETHOD GetPresShell(nsIPresShell** aPresShell);
|
||||
|
||||
NS_IMETHOD GetDOMDocument(nsIDOMDocument** aDOMDocument);
|
||||
|
||||
NS_IMETHOD GetSelectionController(nsISelectionController** aSelectionController);
|
||||
|
||||
NS_IMETHOD GetScreenMode(PRBool* aFlag);
|
||||
|
||||
NS_IMETHOD MatchesCookie(const PRUnichar* aCookie, PRBool *_retval);
|
||||
|
||||
NS_IMETHOD Resize(void);
|
||||
|
||||
NS_IMETHOD ShowCaret(void);
|
||||
|
||||
NS_IMETHOD ScreenSize(PRInt32& rows, PRInt32& cols,
|
||||
PRInt32& xPixels, PRInt32& yPixels);
|
||||
|
||||
NS_DECL_MOZIXMLTERMINAL
|
||||
|
||||
// nsIObserver interface
|
||||
NS_IMETHOD Observe(nsISupports *aSubject, const PRUnichar *aTopic,
|
||||
|
||||
104
mozilla/extensions/xmlterm/build/Makefile.in
Normal file
104
mozilla/extensions/xmlterm/build/Makefile.in
Normal file
@@ -0,0 +1,104 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "MPL"); you may not use this file
|
||||
# except in compliance with the MPL. You may obtain a copy of
|
||||
# the MPL at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the MPL is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the MPL for the specific language governing
|
||||
# rights and limitations under the MPL.
|
||||
#
|
||||
# The Original Code is XMLterm.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ramalingam Saravanan.
|
||||
# Portions created by Ramalingam Saravanan <svn@xmlterm.org> are
|
||||
# Copyright (C) 1999,2001 Ramalingam Saravanan. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the
|
||||
# terms of the GNU General Public License (the "GPL"), in which case
|
||||
# the provisions of the GPL are applicable instead of
|
||||
# those above. If you wish to allow use of your version of this
|
||||
# file only under the terms of the GPL and not to allow
|
||||
# others to use your version of this file under the MPL, indicate
|
||||
# your decision by deleting the provisions above and replace them
|
||||
# with the notice and other provisions required by the GPL.
|
||||
# If you do not delete the provisions above, a recipient
|
||||
# may use your version of this file under either the MPL or the
|
||||
# GPL.
|
||||
#
|
||||
|
||||
# Makefile for xmlterm/build directory
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
# Debug option
|
||||
DEBUG = 1
|
||||
|
||||
XPI_MODULE = xmlterm
|
||||
XPI_MODULE_VERS = 0.53
|
||||
|
||||
MODULE = xmlterm
|
||||
LIBRARY_NAME = xmlterm
|
||||
EXPORT_LIBRARY = 1
|
||||
SHORT_LIBNAME = xmlterm
|
||||
IS_COMPONENT = 1
|
||||
|
||||
REQUIRES = xpcom string
|
||||
|
||||
MODULE_NAME = XMLTermModule
|
||||
|
||||
DEFINES += $(TK_CFLAGS)
|
||||
|
||||
CPPSRCS = mozXMLTermModule.cpp
|
||||
|
||||
SHARED_LIBRARY_LIBS = \
|
||||
$(DIST)/lib/liblineterm_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/libxmlterm_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../base \
|
||||
-I$(srcdir)/../lineterm \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
-lgkgfx \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
include $(srcdir)/../config/xmlterm_config.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
PLATFORM_STR = unknown
|
||||
|
||||
# Edit the lines below as needed, depending upon your platform(s)
|
||||
ifeq ($(OS_ARCH),Linux)
|
||||
PLATFORM_STR = linux2-ix86
|
||||
endif
|
||||
|
||||
ifeq ($(OS_CONFIG),SunOS5)
|
||||
PLATFORM_STR = sunos5-sparc
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),FreeBSD)
|
||||
PLATFORM_STR = freebsd-ix86
|
||||
endif
|
||||
|
||||
XPIFILE = $(XPI_MODULE)-$(XPI_MODULE_VERS)-$(PLATFORM_STR).xpi
|
||||
|
||||
xpi::
|
||||
zip -r $(DIST)/bin/$(XPIFILE) install.js
|
||||
cd $(DIST)/bin; zip -g $(XPIFILE) \
|
||||
components/$(XPI_MODULE).xpt \
|
||||
components/lib$(XPI_MODULE).so
|
||||
echo Created $(DIST)/bin/$(XPIFILE)
|
||||
74
mozilla/extensions/xmlterm/build/mozXMLTermModule.cpp
Normal file
74
mozilla/extensions/xmlterm/build/mozXMLTermModule.cpp
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "MPL"); you may not use this file
|
||||
* except in compliance with the MPL. You may obtain a copy of
|
||||
* the MPL at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the MPL is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the MPL for the specific language governing
|
||||
* rights and limitations under the MPL.
|
||||
*
|
||||
* The Original Code is XMLterm.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ramalingam Saravanan.
|
||||
* Portions created by Ramalingam Saravanan <svn@xmlterm.org> are
|
||||
* Copyright (C) 2000 Ramalingam Saravanan. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* terms of the GNU General Public License (the "GPL"), in which case
|
||||
* the provisions of the GPL are applicable instead of
|
||||
* those above. If you wish to allow use of your version of this
|
||||
* file only under the terms of the GPL and not to allow
|
||||
* others to use your version of this file under the MPL, indicate
|
||||
* your decision by deleting the provisions above and replace them
|
||||
* with the notice and other provisions required by the GPL.
|
||||
* If you do not delete the provisions above, a recipient
|
||||
* may use your version of this file under either the MPL or the
|
||||
* GPL.
|
||||
*/
|
||||
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "mozLineTerm.h"
|
||||
#include "mozXMLTermShell.h"
|
||||
#include "mozXMLTerminal.h"
|
||||
#include "mozXMLTermStream.h"
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(mozXMLTerminal)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(mozXMLTermStream)
|
||||
|
||||
// CIDs implemented by module
|
||||
static nsModuleComponentInfo components[] =
|
||||
{
|
||||
{ MOZLINETERM_CLASSNAME,
|
||||
MOZLINETERM_CID,
|
||||
MOZLINETERM_CONTRACTID,
|
||||
mozLineTerm::Create,
|
||||
},
|
||||
|
||||
{ MOZXMLTERMSHELL_CLASSNAME,
|
||||
MOZXMLTERMSHELL_CID,
|
||||
MOZXMLTERMSHELL_CONTRACTID,
|
||||
mozXMLTermShell::Create,
|
||||
mozXMLTermShell::RegisterProc,
|
||||
mozXMLTermShell::UnregisterProc
|
||||
},
|
||||
|
||||
{ MOZXMLTERMINAL_CLASSNAME,
|
||||
MOZXMLTERMINAL_CID,
|
||||
MOZXMLTERMINAL_CONTRACTID,
|
||||
mozXMLTerminalConstructor,
|
||||
},
|
||||
|
||||
{ MOZXMLTERMSTREAM_CLASSNAME,
|
||||
MOZXMLTERMSTREAM_CID,
|
||||
MOZXMLTERMSTREAM_CONTRACTID,
|
||||
mozXMLTermStreamConstructor,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
// Module entry point
|
||||
NS_IMPL_NSGETMODULE("mozXMLTermModule", components)
|
||||
@@ -82,7 +82,7 @@ PROGOBJS = $(OBJS)
|
||||
endif
|
||||
|
||||
# Targets
|
||||
all: export libs progs
|
||||
all: export install progs
|
||||
|
||||
export: $(EXPORTS)
|
||||
ifneq (,$(EXPORTS))
|
||||
@@ -95,7 +95,7 @@ ifneq (,$(EXPORTS))
|
||||
endif
|
||||
+$(LOOP_OVER_DIRS)
|
||||
|
||||
libs: $(LIBRARY)
|
||||
install: $(LIBRARY)
|
||||
mkdir -p $(topsrcdir)/distrib/lib $(topsrcdir)/base/lib
|
||||
+$(LOOP_OVER_DIRS)
|
||||
|
||||
@@ -152,7 +152,7 @@ $(OBJDIR)/%.o: %.cpp $(wildcard *.h) $(wildcard $(topsrcdir)/distrib/include/*.h
|
||||
.SUFFIXES: .a .o .c .cpp .h .pl .class .java .html .mk .in
|
||||
|
||||
# Always recognized targets
|
||||
.PHONY: all clean clobber clobber_all export install libs
|
||||
.PHONY: all clean clobber clobber_all export install
|
||||
|
||||
# OS configuration
|
||||
os_config:
|
||||
|
||||
95
mozilla/extensions/xmlterm/lineterm/Makefile.in
Normal file
95
mozilla/extensions/xmlterm/lineterm/Makefile.in
Normal file
@@ -0,0 +1,95 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "MPL"); you may not use this file
|
||||
# except in compliance with the MPL. You may obtain a copy of
|
||||
# the MPL at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the MPL is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the MPL for the specific language governing
|
||||
# rights and limitations under the MPL.
|
||||
#
|
||||
# The Original Code is lineterm.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ramalingam Saravanan.
|
||||
# Portions created by Ramalingam Saravanan <svn@xmlterm.org> are
|
||||
# Copyright (C) 1999 Ramalingam Saravanan. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the
|
||||
# terms of the GNU General Public License (the "GPL"), in which case
|
||||
# the provisions of the GPL are applicable instead of
|
||||
# those above. If you wish to allow use of your version of this
|
||||
# file only under the terms of the GPL and not to allow
|
||||
# others to use your version of this file under the MPL, indicate
|
||||
# your decision by deleting the provisions above and replace them
|
||||
# with the notice and other provisions required by the GPL.
|
||||
# If you do not delete the provisions above, a recipient
|
||||
# may use your version of this file under either the MPL or the
|
||||
# GPL.
|
||||
#
|
||||
|
||||
# makefile for xmlterm/base directory
|
||||
|
||||
ifdef STAND_ALONE
|
||||
DEPTH = ..
|
||||
topsrcdir = ..
|
||||
srcdir = .
|
||||
include $(topsrcdir)/config/autoconf.mk
|
||||
else
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
endif
|
||||
|
||||
ifdef DEBUG
|
||||
# Debug option
|
||||
DEBUG_LTERM = 1
|
||||
endif
|
||||
|
||||
# C Sources
|
||||
ifdef NO_PTY
|
||||
CSRCS = ltermManager.c ltermIO.c ltermInput.c ltermOutput.c ltermEscape.c \
|
||||
tracelog.c unistring.c
|
||||
else
|
||||
CSRCS = ltermManager.c ltermIO.c ltermInput.c ltermOutput.c ltermEscape.c \
|
||||
tracelog.c unistring.c ptystream.c
|
||||
endif
|
||||
|
||||
# Defines
|
||||
ifdef STAND_ALONE
|
||||
else
|
||||
DEFINES += $(TK_CFLAGS)
|
||||
endif
|
||||
|
||||
ifdef DEBUG_LTERM
|
||||
DEFINES += -DDEBUG_LTERM
|
||||
endif
|
||||
|
||||
# Exported header files
|
||||
EXPORTS = lineterm.h tracelog.h unistring.h ptystream.h
|
||||
|
||||
MODULE = xmlterm
|
||||
LIBRARY_NAME = lineterm_s
|
||||
|
||||
REQUIRES =
|
||||
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
ifdef STAND_ALONE
|
||||
include $(topsrcdir)/config/config.mk
|
||||
endif
|
||||
|
||||
include $(srcdir)/../config/xmlterm_config.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifndef STAND_ALONE
|
||||
ifeq ($(OS_ARCH),Linux)
|
||||
OS_CFLAGS += -ansi
|
||||
endif
|
||||
endif
|
||||
@@ -551,7 +551,7 @@ int ltermRead(struct lterms *lts, struct LtermRead *ltr, int timeout)
|
||||
pollCode = POLL(lto->pollFD, (SIZE_T) lto->nfds, waitTime);
|
||||
|
||||
if (pollCode == -1) {
|
||||
#if defined(DEBUG) && !defined(USE_NSPR_IO)
|
||||
#if defined(DEBUG_LTERM) && !defined(USE_NSPR_IO)
|
||||
int errcode = errno;
|
||||
perror("ltermRead");
|
||||
#else
|
||||
@@ -807,7 +807,7 @@ int ltermSendData(struct lterms *lts, const UNICHAR *buf, int count)
|
||||
success = (WRITE(lts->ltermProcess.processIN, &ch, 1) == 1);
|
||||
|
||||
if (!success) {
|
||||
#if defined(DEBUG) && !defined(USE_NSPR_IO)
|
||||
#if defined(DEBUG_LTERM) && !defined(USE_NSPR_IO)
|
||||
int errcode = errno;
|
||||
perror("ltermSendData");
|
||||
#else
|
||||
@@ -863,7 +863,7 @@ int ltermSendChar(struct lterms *lts, const char *buf, int count)
|
||||
(SIZE_T) count) == count);
|
||||
|
||||
if (!success) {
|
||||
#if defined(DEBUG) && !defined(USE_NSPR_IO)
|
||||
#if defined(DEBUG_LTERM) && !defined(USE_NSPR_IO)
|
||||
int errcode = errno;
|
||||
perror("ltermSendChar");
|
||||
#else
|
||||
@@ -649,7 +649,7 @@ int ltermReceiveData(struct lterms *lts, int readERR)
|
||||
temERRBuf + lto->rawERRBytes, (SIZE_T) readERRMax);
|
||||
|
||||
if (nReadERR < 0) {
|
||||
#if defined(DEBUG) && !defined(USE_NSPR_IO)
|
||||
#if defined(DEBUG_LTERM) && !defined(USE_NSPR_IO)
|
||||
int errcode = errno;
|
||||
/* perror("ltermReceiveData"); */
|
||||
#else
|
||||
@@ -701,7 +701,7 @@ int ltermReceiveData(struct lterms *lts, int readERR)
|
||||
temOUTBuf + lto->rawOUTBytes, (SIZE_T) readOUTMax);
|
||||
|
||||
if (nReadOUT < 0) {
|
||||
#if defined(DEBUG) && !defined(USE_NSPR_IO)
|
||||
#if defined(DEBUG_LTERM) && !defined(USE_NSPR_IO)
|
||||
int errcode = errno;
|
||||
/* perror("ltermReceiveData"); */
|
||||
#else
|
||||
@@ -37,7 +37,7 @@
|
||||
* LINUX: for Linux2.0/glibc
|
||||
* SOLARIS: for Solaris2.6
|
||||
* BSDFAMILY: for FreeBSD, ...
|
||||
* DEBUG: to enable some debugging output
|
||||
* DEBUG_LTERM: to enable some debugging output
|
||||
* NO_PTY: force use of pipes rather than PTY for process
|
||||
* communication
|
||||
* MOZILLA_CLIENT: set if embedded in Mozilla
|
||||
@@ -32,11 +32,12 @@
|
||||
|
||||
/* ptystream.c: pseudo-TTY stream implementation
|
||||
* CPP options:
|
||||
* LINUX: for Linux2.0/glibc
|
||||
* SOLARIS: for Solaris2.6
|
||||
* BSDFAMILY: for FreeBSD, ...
|
||||
* NOERRMSG: for suppressing all error messages
|
||||
* DEBUG: for printing some debugging output to STDERR
|
||||
* LINUX: for Linux2.0/glibc
|
||||
* SOLARIS: for Solaris2.6
|
||||
* BSDFAMILY: for FreeBSD, ...
|
||||
* NOERRMSG: for suppressing all error messages
|
||||
* USE_NSPR_BASE: use NSPR to log error messages (defines NOERRMSG as well)
|
||||
* DEBUG_LTERM: for printing some debugging output to STDERR
|
||||
*/
|
||||
|
||||
/* system header files */
|
||||
@@ -63,6 +64,10 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef USE_NSPR_BASE
|
||||
#include "prlog.h"
|
||||
#define NOERRMSG 1
|
||||
#endif
|
||||
|
||||
/* public declarations */
|
||||
#include "ptystream.h"
|
||||
@@ -115,7 +120,7 @@ int pty_create(struct ptys *ptyp, char *const argv[],
|
||||
/* Set debug flag */
|
||||
ptyp->debug = debug;
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG_LTERM
|
||||
if (ptyp->debug)
|
||||
fprintf(stderr, "00-pty_create: errfd=%d, noblock=%d, noecho=%d, noexport=%d\n",
|
||||
errfd, noblock, noecho, noexport);
|
||||
@@ -158,7 +163,7 @@ int pty_create(struct ptys *ptyp, char *const argv[],
|
||||
|
||||
ptyp->pid = child_pid;
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG_LTERM
|
||||
if (ptyp->debug)
|
||||
fprintf(stderr, "00-pty_create: Fork child pid = %d, initially attached to %s\n",
|
||||
child_pid, ttyname(0));
|
||||
@@ -325,7 +330,7 @@ static int openPTY(struct ptys *ptyp, int noblock)
|
||||
|
||||
ptyp->ptyFD = ptyFD;
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG_LTERM
|
||||
if (ptyp->debug)
|
||||
fprintf(stderr, "00-openPTY: Opened pty %s on fd %d\n", ptyName, ptyFD);
|
||||
#endif
|
||||
@@ -347,7 +352,7 @@ static int attachToTTY(struct ptys *ptyp, int errfd, int noecho)
|
||||
/* Create new session */
|
||||
sid = setsid();
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG_LTERM
|
||||
if (ptyp->debug)
|
||||
fprintf(stderr, "00-attachToTTY: Returned %d from setsid\n", sid);
|
||||
#endif
|
||||
@@ -364,7 +369,7 @@ static int attachToTTY(struct ptys *ptyp, int errfd, int noecho)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG_LTERM
|
||||
if (ptyp->debug)
|
||||
fprintf(stderr,"00-attachToTTY: Attaching process %d to TTY %s on fd %d\n",
|
||||
getpid(), ptyp->ttydev, ttyFD);
|
||||
@@ -529,6 +534,16 @@ static void pty_error(const char *errmsg, const char *errmsg2) {
|
||||
fprintf(stderr, "%s\n", errmsg);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#ifdef USE_NSPR_BASE
|
||||
if (errmsg != NULL) {
|
||||
if (errmsg2 != NULL) {
|
||||
PR_LogPrint("%s%s\n", errmsg, errmsg2);
|
||||
} else {
|
||||
PR_LogPrint("%s\n", errmsg);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -72,7 +72,7 @@ struct ptys { /* PTY structure */
|
||||
* If NOECHO is true, tty echoing is turned off.
|
||||
* If NOEXPORT is true, then the current environment is not exported
|
||||
* to the new process.
|
||||
* If DEBUG is true, debugging messages are printed to STDERR.
|
||||
* If DEBUG_LTERM is true, debugging messages are printed to STDERR.
|
||||
* Returns 0 on success and -1 on error.
|
||||
*/
|
||||
int pty_create(struct ptys *ptyp, char *const argv[],
|
||||
@@ -40,6 +40,10 @@
|
||||
#include "unistring.h"
|
||||
#include "tracelog.h"
|
||||
|
||||
#ifdef USE_NSPR_BASE
|
||||
#include "prlog.h"
|
||||
#endif
|
||||
|
||||
/* private declarations */
|
||||
|
||||
/* TRACELOG global variable structure */
|
||||
@@ -53,7 +57,9 @@ void tlog_init(FILE* fileStream)
|
||||
{
|
||||
int imodule;
|
||||
|
||||
#ifdef DEBUG_LTERM
|
||||
fprintf(stderr, "tlog_init:\n");
|
||||
#endif
|
||||
|
||||
/* Error output stream */
|
||||
tlogGlobal.errorStream = fileStream;
|
||||
@@ -76,7 +82,9 @@ int tlog_set_level(int imodule, int messageLevel, const char *functionList)
|
||||
{
|
||||
int j;
|
||||
|
||||
#ifdef DEBUG_LTERM
|
||||
fprintf(stderr, "tlog_set_level:%d, %d\n", imodule, messageLevel);
|
||||
#endif
|
||||
|
||||
if ((imodule < 0) || (imodule >= TLOG_MAXMODULES))
|
||||
return -1;
|
||||
@@ -149,7 +157,11 @@ int tlog_test(int imodule, char *procstr, int level)
|
||||
( (strstr(tlogGlobal.functionList[imodule],procstr) != NULL) ||
|
||||
(strstr(procstr,tlogGlobal.functionList[imodule]) != NULL)) ) )) {
|
||||
/* Display message */
|
||||
#if defined(USE_NSPR_BASE) && !defined(DEBUG_LTERM)
|
||||
PR_LogPrint("%s%2d: ", procstr, level);
|
||||
#else
|
||||
fprintf(tlogGlobal.errorStream, "%s%2d: ", procstr, level);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -196,10 +208,13 @@ void tlog_unichar(const UNICHAR *buf, int count)
|
||||
if (tlogGlobal.errorStream == NULL)
|
||||
return;
|
||||
|
||||
#if defined(USE_NSPR_BASE) && !defined(DEBUG_LTERM)
|
||||
PR_LogPrint("U(%d):\n", count);
|
||||
#else
|
||||
fprintf(tlogGlobal.errorStream, "U(%d): ", count);
|
||||
|
||||
ucsprint(tlogGlobal.errorStream, buf, count);
|
||||
|
||||
fprintf(tlogGlobal.errorStream, "\n");
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
/* tracelog.h: Tracing/logging module header
|
||||
* CPP options:
|
||||
* DEBUG: to enable debugging output
|
||||
* DEBUG_LTERM: to enable debugging output
|
||||
* _UNISTRING_H: for unicode messages compatible with "unistring.h"
|
||||
*/
|
||||
|
||||
@@ -129,14 +129,21 @@ extern TlogGlobal tlogGlobal;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define TLOG_ERROR tlog_message
|
||||
#if defined(USE_NSPR_BASE) && !defined(DEBUG_LTERM)
|
||||
#include "prlog.h"
|
||||
#define TLOG_MESSAGE PR_LogPrint
|
||||
#else
|
||||
#define TLOG_MESSAGE tlog_message
|
||||
#endif
|
||||
|
||||
#define TLOG_WARNING tlog_warning
|
||||
#define TLOG_ERROR TLOG_MESSAGE
|
||||
|
||||
#define TLOG_WARNING if (tlogGlobal.debugOn) TLOG_MESSAGE
|
||||
|
||||
#define TLOG_PRINT(imodule,procname,level,args) \
|
||||
do { \
|
||||
if (tlogGlobal.debugOn && tlog_test(imodule,":" #procname ":",level)) { \
|
||||
tlog_message args; \
|
||||
TLOG_MESSAGE args; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
@@ -63,9 +63,9 @@ PTHREADLIBOPT = -lpthread
|
||||
endif
|
||||
|
||||
ifdef USE_NCURSES
|
||||
LIBS = -lncurses -lxmlterm $(PTHREADLIBOPT)
|
||||
LIBS = -lncurses -llineterm_s $(PTHREADLIBOPT)
|
||||
else
|
||||
LIBS = -lxmlterm $(PTHREADLIBOPT)
|
||||
LIBS = -llineterm_s $(PTHREADLIBOPT)
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
@@ -66,7 +66,6 @@
|
||||
#ifdef LINUX
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/poll.h>
|
||||
typedef unsigned int nfds_t;
|
||||
#endif
|
||||
|
||||
#include "lineterm.h"
|
||||
|
||||
@@ -53,7 +53,6 @@
|
||||
#if defined(LINUX) || defined(BSDFAMILY)
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/poll.h>
|
||||
typedef unsigned int nfds_t;
|
||||
#endif
|
||||
|
||||
#include "ptystream.h"
|
||||
|
||||
Reference in New Issue
Block a user