[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnetlib/DotGNU.Terminal .cvsignore, NONE, 1.1 Cons
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnetlib/DotGNU.Terminal .cvsignore, NONE, 1.1 ConsoleExtensions.cs, NONE, 1.1 DotGNU.Terminal.build, NONE, 1.1 History.cs, NONE, 1.1 Makefile.am, NONE, 1.1 Readline.cs, NONE, 1.1 TabCompleteEventArgs.cs, NONE, 1.1 TabCompleteEventHandler.cs, NONE, 1.1 |
Date: |
Sat, 08 Nov 2003 01:54:51 +0000 |
Update of /cvsroot/dotgnu-pnet/pnetlib/DotGNU.Terminal
In directory subversions:/tmp/cvs-serv15344/DotGNU.Terminal
Added Files:
.cvsignore ConsoleExtensions.cs DotGNU.Terminal.build
History.cs Makefile.am Readline.cs TabCompleteEventArgs.cs
TabCompleteEventHandler.cs
Log Message:
Add the new assembly "DotGNU.Terminal" to the system, which implements a
readline-like line input mechanism using the extended console.
--- NEW FILE: ConsoleExtensions.cs ---
/*
* ConsoleExtensions.cs - Implementation of the
* "DotGNU.Terminal.ConsoleExtensions" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace DotGNU.Terminal
{
#if CONFIG_EXTENDED_CONSOLE
using System;
// This class contains some extensions for console input on Unix systems.
public sealed class ConsoleExtensions
{
// Cannot instantiate this class.
private ConsoleExtensions() {}
// Read a key while processing window resizes and process resumption.
public static ConsoleKeyInfo ReadKey()
{
return ReadKey(false);
}
public static ConsoleKeyInfo ReadKey(bool intercept)
{
ConsoleKeyInfo key = Console.ReadKey(intercept);
if(key.Key == (ConsoleKey)0x1200)
{
// "SizeChanged" key indication.
if(SizeChanged != null)
{
SizeChanged(null,
EventArgs.Empty);
}
}
else if(key.Key == (ConsoleKey)0x1201)
{
// "Resumed" key indication.
if(Resumed != null)
{
Resumed(null, EventArgs.Empty);
}
}
return key;
}
// Event that is emitted when the console window size changes.
public static event EventHandler SizeChanged;
// Event that is emitted when the program is resumed after a suspend.
public static event EventHandler Resumed;
}; // class ConsoleExtensions
#endif // CONFIG_EXTENDED_CONSOLE
}; // namespace DotGNU.Terminal
--- NEW FILE: History.cs ---
/*
* History.cs - Implementation of the "DotGNU.Terminal.History" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace DotGNU.Terminal
{
using System;
using System.Collections;
public sealed class History
{
// Internal state.
private static int maxHistorySize = 0;
private static ArrayList history = new ArrayList();
// Cannot instantiate this class.
private History() {}
// Add a line of input to the scroll-back history.
public static void AddHistory(String line)
{
if(line == null)
{
line = String.Empty;
}
if(maxHistorySize != 0 && history.Count ==
maxHistorySize)
{
// Remove the oldest entry, to preserve
the maximum size.
history.RemoveAt(0);
}
history.Add(line);
}
// Add a line of input to the scroll-back history, if it is
// different from the most recent line that is present.
public static void AddHistoryUnique(String line)
{
if(line == null)
{
line = String.Empty;
}
if(history.Count == 0 ||
((String)(history[history.Count - 1])) !=
line)
{
AddHistory(line);
}
}
// Clear the scroll-back history.
public static void ClearHistory()
{
history.Clear();
}
// Get or set the maximum history list size. Zero if unlimited.
public static int MaximumHistorySize
{
get
{
return maxHistorySize;
}
set
{
if(value < 0)
{
throw new
ArgumentOutOfRangeException();
}
maxHistorySize = value;
}
}
// Get the number of items currently in the history.
public static int Count
{
get
{
return history.Count;
}
}
// Get a particular history item. Zero is the most recent.
public static String GetHistory(int index)
{
if(index >= 0 && index < history.Count)
{
return (String)(history[history.Count -
index - 1]);
}
else
{
return String.Empty;
}
}
// Set a particular history item. Zero is the most recent.
public static void SetHistory(int index, String line)
{
if(line == null)
{
line = String.Empty;
}
if(index >= 0 && index < history.Count)
{
history[history.Count - index - 1] =
line;
}
}
}; // class History
}; // namespace DotGNU.Terminal
--- NEW FILE: Readline.cs ---
/*
* Readline.cs - Implementation of the "DotGNU.Terminal.Readline" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
[...1022 lines suppressed...]
// The default is true on Windows system, false otherwise.
public static bool ControlZIsEOF
{
get
{
return controlZIsEOF;
}
set
{
controlZIsEOF = value;
}
}
// Event that is emitted to allow for tab completion. If there are
// no attached handlers, then the Tab key will do normal tabbing.
public static event TabCompleteEventHandler TabComplete;
}; // class Readline
}; // namespace DotGNU.Terminal
--- NEW FILE: DotGNU.Terminal.build ---
<?xml version="1.0"?>
<project name="pnetlib DotGNU.Terminal" default="all">
<target name="all">
<!-- Build the primary DotGNU.Terminal.dll library -->
<compile output="DotGNU.Terminal.dll"
target="library"
unsafe="true"
nostdlib="true"
debug="${CONFIG_DEBUG_LINES}"
optimize="true">
<sources>
<includes name="**/*.cs"/>
</sources>
<references>
<file name="../runtime/mscorlib.dll"/>
</references>
<arg compiler="cscc" value="-Wno-empty-input"/>
<arg compiler="cscc" value="-flatin1-charset"/>
<arg compiler="csc" value="/nowarn:626"/>
<arg compiler="csc" value="/nowarn:649"/>
<arg compiler="csc" value="/nowarn:168"/>
<arg compiler="csc" value="/nowarn:67"/>
<arg compiler="csc" value="/nowarn:169"/>
<arg compiler="csc" value="/nowarn:679"/>
</compile>
</target>
</project>
--- NEW FILE: TabCompleteEventHandler.cs ---
/*
* TabCompleteEventHandler.cs - Implementation of the
* "DotGNU.Terminal.TabCompleteEventHandler" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace DotGNU.Terminal
{
using System;
public delegate void TabCompleteEventHandler
(Object sender, TabCompleteEventArgs e);
}; // namespace DotGNU.Terminal
--- NEW FILE: TabCompleteEventArgs.cs ---
/*
* TabCompleteEventArgs.cs - Implementation of the
* "DotGNU.Terminal.TabCompleteEventArgs" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace DotGNU.Terminal
{
using System;
public class TabCompleteEventArgs : EventArgs
{
// Internal state.
private String prefix;
private String suffix;
private String insert;
private String[] alternatives;
// Constructor.
public TabCompleteEventArgs(String prefix, String suffix)
{
this.prefix = prefix;
this.suffix = suffix;
this.insert = null;
this.alternatives = null;
}
// Get the line prefix (i.e. all characters before the current
position).
public String Prefix
{
get
{
return prefix;
}
}
// Get the line suffix (i.e. all characters after the current position).
public String Suffix
{
get
{
return suffix;
}
}
// Get or set the extra string to be inserted into the line.
public String Insert
{
get
{
return insert;
}
set
{
insert = value;
}
}
// Get or set the list of strings to be displayed as alternatives.
public String[] Alternatives
{
get
{
return alternatives;
}
set
{
alternatives = value;
}
}
}; // class TabCompleteEventArgs
}; // namespace DotGNU.Terminal
--- NEW FILE: Makefile.am ---
.PHONY: DotGNU.Terminal.dll
all-local: DotGNU.Terminal.dll
DotGNU.Terminal.dll:
"$(CSANT)" $(CSANT_FLAGS) -f DotGNU.Terminal.build all
CLEANFILES = DotGNU.Terminal.dll
pnetassembliesdir = $(libdir)/cscc/lib
pnetassemblies_DATA = DotGNU.Terminal.dll
--- NEW FILE: .cvsignore ---
Makefile
Makefile.in
.deps
*.dll
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnetlib/DotGNU.Terminal .cvsignore, NONE, 1.1 ConsoleExtensions.cs, NONE, 1.1 DotGNU.Terminal.build, NONE, 1.1 History.cs, NONE, 1.1 Makefile.am, NONE, 1.1 Readline.cs, NONE, 1.1 TabCompleteEventArgs.cs, NONE, 1.1 TabCompleteEventHandler.cs, NONE, 1.1,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] pnetlib ChangeLog, 1.1444, 1.1445 Makefile.am, 1.29, 1.30 configure.in, 1.103, 1.104
- Next by Date:
[Dotgnu-pnet-commits] pnetlib/DotGNU.Terminal - New directory
- Previous by thread:
[Dotgnu-pnet-commits] pnetlib ChangeLog, 1.1444, 1.1445 Makefile.am, 1.29, 1.30 configure.in, 1.103, 1.104
- Next by thread:
[Dotgnu-pnet-commits] pnetlib/DotGNU.Terminal - New directory
- Index(es):