/*
 * 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):
 */

/* mozILineTerm.idl: Javascript-accessible interface to LineTerm
 */

#include "nsISupports.idl"
#include "domstubs.idl"

%{C++
class nsIDOMDocument;
%}

[scriptable, uuid(0eb82b00-43a2-11d3-8e76-006008948af5)]

interface mozILineTerm : nsISupports
{
  /** 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 (ASCII only)
   * @param initInput initial input string to be transmitted to terminal;
   *        set to null string, if none. (ASCII only)
   * @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 domDoc DOM document object associated with the LineTerm
   *        (document.cookie will be defined for this document on return)
   */
  void Open(in wstring command, in wstring initInput, in wstring promptRegexp,
            in PRInt32 options, in PRInt32 processType,
            in nsIDOMDocument domDoc);

  /** Closes LineTerm
   * @param aCookie document.cookie string for authentication
   */
  void Close(in wstring aCookie);

  /** Writes string to LineTerm as if the user had typed it (command input)
   * @param buf string to be transmitted to LineTerm
   * @param aCookie document.cookie string for authentication
   */
  void Write(in wstring buf, in wstring aCookie);

  /** Read output data string and parameters from LineTerm (command output)
   * @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 aCookie document.cookie string for authentication
   * @return output data string from LineTerm
   */
  wstring Read(out PRInt32 opcodes, out PRInt32 opvals,
               out PRInt32 buf_row, out PRInt32 buf_col, in wstring aCookie);
};


%{ C++
#define MOZLINETERM_CID                      \
{ /* 0eb82b01-43a2-11d3-8e76-006008948af5 */ \
   0x0eb82b01, 0x43a2, 0x11d3,               \
{0x8e, 0x76, 0x00, 0x60, 0x08, 0x94, 0x8a, 0xf5} }

extern nsresult
NS_NewLineTerm(mozILineTerm** aLineTerm);
%}
