Compare commits

...

36 Commits

Author SHA1 Message Date
mainzelm 55088b980a Version 1.1 2006-04-18 13:27:52 +00:00
mainzelm e69a69c2b2 Remove refresh-all from care-for-return
reimplement fill-up and cat
2006-04-07 09:43:29 +00:00
mainzelm 406aeafd2e Set nodelay mode once and for all during window creation 2006-04-07 09:41:08 +00:00
chetz 40eed873a2 cosmetic changes in input-fields 2006-04-06 21:40:59 +00:00
chetz df47362d05 removed input-buffers -- not needed any more 2006-03-28 09:50:24 +00:00
chetz 303cf30059 changed input-fields by needs of command-buffer from commander-s 2006-03-28 09:37:38 +00:00
eknauel 82a6492c97 Add packages for Christoph Hetz's input fields 2005-11-11 08:02:16 +00:00
eknauel 445317ca90 Add Christoph Hetz's all new, all singing, and all dancing input fields 2005-11-11 08:01:07 +00:00
mainzelm 54e9e1cee4 Towards an initial release. 2005-10-04 13:29:43 +00:00
eknauel 349d20e923 Fix SAVETTY and RESETTY 2005-06-14 11:10:46 +00:00
mainzelm 743ca2bc0a curs_set may return either the old visibility or ERR 2005-06-01 16:06:13 +00:00
eknauel c48ea3b152 I think I fixed the command history 2005-05-31 12:39:57 +00:00
eknauel ccd32b461f added bindings to ioctl() with TIOCGWINSZ and TIOCSWINSZ 2005-05-27 07:04:24 +00:00
eknauel 1ccfa8dccc add function buffer-text-append-new-line! 2005-05-22 09:18:07 +00:00
eknauel fefb4b002d fix cursor positioning if cursor is located on the last line 2005-05-20 08:02:05 +00:00
mainzelm 0aeb6b35ff zap superfluous, evil set! 2005-05-19 16:24:44 +00:00
eknauel 2f57202cfe More fixes for the cursor positioning code, fix history 2005-05-19 15:16:33 +00:00
eknauel 0fc804b345 revamp code for positioning the cursor, code cleanup 2005-05-19 13:58:27 +00:00
eknauel 0c44395f9b added debug-output (using tty-debug), code cleanup, shift window
refreshing to application code
2005-05-18 18:54:08 +00:00
eknauel d76ca37524 Use `(values)' to return no return values instead of `values'... 2005-05-17 15:29:33 +00:00
eknauel 0cda756391 Make key-bindings for INPUT more shell like: CursorUp/CursorDown
cycles through the command history.  Use Ctrl-p/-n to move cursor to
the previous/next line in the input.
2005-05-17 13:32:23 +00:00
eknauel d5a033368a Remove NUIT code. The NUIT code lives in CVS module scsh-nuit 2005-05-17 08:17:58 +00:00
eknauel 326ecf1950 bump version number 2005-05-11 13:28:34 +00:00
eknauel 41ac53c7e8 Add mutators to BUFFER records 2005-05-11 13:27:59 +00:00
demattia cfec39d156 changed some shortcuts in input-buffer 2004-10-14 11:55:42 +00:00
demattia 5a249d54d4 fixed some minor bugs 2004-10-10 13:19:55 +00:00
demattia 9e9294231e added some functions of input-buffer.scm to module-exports 2004-10-06 12:59:10 +00:00
demattia b11e743db7 added input-buffer 2004-10-06 09:40:35 +00:00
demattia 124c614bb8 *** empty log message *** 2004-09-13 08:25:53 +00:00
demattia 0256371291 *** empty log message *** 2004-09-13 08:24:42 +00:00
demattia 3fe17ca2c7 *** empty log message *** 2004-09-13 07:58:51 +00:00
mainzelm ff62750308 - Remove non-ncurses related stuff
- Add an interface declaration
2004-09-07 14:43:22 +00:00
mainzelm 714a116d7b Make scsh-ncurses a proper scsh package 2004-09-07 14:34:15 +00:00
mainzelm 8903036a5a Renamed init function 2004-09-07 14:30:27 +00:00
mainzelm d05da1f2e4 Renamed package file to a more standard name 2004-09-07 14:29:37 +00:00
demattia 6e1a33f071 first commit 2004-09-07 09:13:21 +00:00
17 changed files with 6870 additions and 4 deletions

3
AUTHORS Normal file
View File

@ -0,0 +1,3 @@
Christoph de Mattia
Eric Knauel
Martin Gasbichler

28
COPYING Normal file
View File

@ -0,0 +1,28 @@
Copyright (c) 2004 Christoph de Mattia
Copyright (c) 2004-2005 Eric Knauel
Copyright (c) 2004-2005 Martin Gasbichler
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the authors may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

43
INSTALL Normal file
View File

@ -0,0 +1,43 @@
These are generic installation instructions for scsh packages.
Prerequisites
=============
The scsh installation library is required to install this package.
This library *must* be present on your system before the current
package can be installed. It can be obtained from the following Web
page:
http://lamp.epfl.ch/~schinz/scsh_packages/
The installation library comes with its own documentation which
explains in detail how to install and use scsh packages. It is
recommended that you read it before installing your first scsh
package. What follows is a very brief summary of this documentation,
intended to get you started quickly.
Installation
============
Installation of a scsh package is performed by launching the
"scsh-install-pkg" script, which is part of the scsh installation
library. This script must be launched from within the directory which
resulted from the expansion of the current package's archive, i.e. the
one containing the file you are reading now.
A list of all the arguments accepted by the "scsh-install-pkg" script
can be obtained by launching it with the "--help" option. One of these
arguments, "--prefix", is mandatory and specifies the location where
installation should be performed. Ideally, you should use the same
prefix to install all scsh packages, as this makes them easier to
manage and use.
For example, to install the current package in
"/usr/local/share/scsh-modules", you should type the following:
scsh-install-pkg --prefix=/usr/local/share/scsh-modules
Provided that no errors are encountered during installation, a
message will be printed at the end explaining how to use the newly
installed package.

View File

@ -1,7 +1,8 @@
SUBDIRS = c
EXTRA_DIST = c/ncurses.c \
scheme/ncurses-interfaces.scm \
scheme/ncurses-packages.scm \
scheme/ncurses.scm \
EXTRA_DIST = \
scheme/ncurses-packages.scm \
scheme/ncurses.scm \
scheme/ncurses-constants.scm \
scheme/input-fields.scm \
pkg-def.scm

4
NEWS Normal file
View File

@ -0,0 +1,4 @@
* Version 1.0 (released 2005-10-31)
First public release.

51
README Normal file
View File

@ -0,0 +1,51 @@
scsh-ncurses 1.1 README -*-outline -*-
scsh ncurses bindings
=====================
This library adds bindings for the ncurses library to scsh, the Scheme
shell.
* Installation
==============
scsh-ncurses conforms to the packaging proposal for
scsh by Michel Schinz. Please see:
<http://lamp.epfl.ch/~schinz/scsh_packages/>
In short, this means that you can install scsh-ncurses by unpacking
the scsh-ncurses tarball and issuing the following command in the
created directory:
scsh-install-pkg --prefix /path/to/your/package/root
See the file INSTALL for the generic installation instructions for
scsh packages.
* Documentation
===============
There is currently no documentation specific to scsh-ncurses. However,
this library maps most of the C functions directly to Scheme
procedures, hence the man pages for ncurses are sufficient in most
cases.
* Loading the code
==================
Start scsh like this:
scsh -lel scsh-ncurses/load.scm
* Support
=========
Please direct questions, comments, answers about scsh-ncurses to the regular
scsh mailing list at
scsh-users@scsh.net

8
c/Makefile.am Normal file
View File

@ -0,0 +1,8 @@
INCLUDES = -I@top_srcdir@/c -I@scsh_includes@
libsys_LTLIBRARIES = libscshncurses.la
libscshncurses_la_SOURCES = ncurses.c
libscshncurses_la_LIBADD = -lncurses
libscshncurses_la_LDFLAGS = -version-info 1:1:0 -module

2319
c/ncurses.c Executable file

File diff suppressed because it is too large Load Diff

30
configure.in Normal file
View File

@ -0,0 +1,30 @@
AC_INIT(scsh-ncurses, 1.0)
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR(configure.in)
AC_LANG(C)
define([PREPEND], [[$2]="$[$2] [$1]"])
AC_PROG_LIBTOOL
AC_PROG_CC
AC_ARG_WITH(scsh-includes,
AC_HELP_STRING([--with-scsh-includes=DIR],
[scsh include files are in DIR [/usr/local/include]]),
scsh_includes=$withval,
scsh_includes=/usr/local/include)
AC_SUBST(scsh_includes)
missing_yp_funs=""
schemedir='${prefix}'"/scheme"
libdir='${prefix}'"/lib"
libsysdir='${prefix}'
AC_SUBST(libdir)
AC_SUBST(libsysdir)
AC_SUBST(schemedir)
AC_SUBST(LIBS)
AC_SUBST(CC)
AC_OUTPUT([Makefile c/Makefile])

171
doc/input-fiels-de.txt Normal file
View File

@ -0,0 +1,171 @@
Input-fields
============
1. Erstellen und installieren
-----------------------------
(make-input-field x-dim y-dim) -> <input-field>
erstellt ein Input-field mit x-dim Spalten und y-dim Zeilen.
Make-input-field können weitere optinale Parameter übergeben
werden:
(make-input-field x-dim y-dim
[default-text
[behavior
[insert-active
[x-scroll-enabled
[y-scroll-enabled]]]]])
default-text: ist ein String, der am Anfang und nach einem Reset (s.u.)
der Inhalt des Input-fields ist.
(Default: "")
behavior: ist eine Liste von Paaren. Der car eines solchen Paares
ist die Nummer eines Zeichens oder einer Tastenkombination,
wie sie von wgetch (aus ncurses) zurückgegeben werden.
Der cdr des Paares ist ein Symbol, das eine Nachricht an ein
Input-field darstellt, so würde ein Input-field, das mit dem
Behvior
(list (cons 27
'clear))
erzeugt worden ist beim drücken der ESC-Taste seinen Inhalt
löschen.Es stehen zwei Standardlisten zu Verfügung:
standard-behavior und standard-behavior-pro (s.u.).
(Default: standard-behavior)
insert-active: ist ein Boolean und gibt an ob das sich das Input-field am
Anfang im Insert- oder im Overwrite-Modus befindet.
(Default: #t)
x-scroll-enabled: ist ein Boolean und gibt an ob horizontales Scrollen
erlaubt ist.
(Default #f)
y-scroll-enabled: ist ein Boolean und gibt an, ob vertikales Scrollen erlaubt ist.
(Default #f)
(install-input-field input-field
window
x-loc y-loc)
Ordnet das Input-field input-field dem (ncurses-)Fenter window zu und
platziert es mit der linken oberen Ecke in der Spalte x-loc und der
Zeile y-loc.
Will man das Input-field später nicht direkt verwenden, sondern nur
über cursor-over-input-field? (s.u.) so kann man es auch mittels
make&install-input-field auf einmal erzeugen und installieren:
(make&install-input-field window
x-loc y-loc
x-dim y-dim
[...])
2. Typpredikat und Feldselektoren
----------------------------------
Input-fields exportirt außerdem ein Typpredikat:
input-field?
und die folgenden Selektoren
input-field-default-text: default-text
input-field-text: der aktuelle Inhalt des Input-fields
als String
input-field-x-location: x-loc
input-field-y-location: y-loc
input-field-x-size: x-dim
input-field-y-size: y-dim
input-field-x-scroll: x-scroll-enabled
input-field-y-scroll: y-scroll-enabled
input-field-line: die Zeile, in der der Cursor steht
input-field-column: die Spalte, in der der Cursor steht
input-field-insert: insert-active
3. Bahaviors
----------------------
standard-behavior führt die folgenden Bindungen ein:
Pfeil-Hoch : Cursor um eine Zeile nach oben bewegen.
Pfeil-Runter: Cursor um eine Zeile nach unten bewegen.
Pfeil-links: Cursor nach links bewegen.
Pfeil-Rechts: Cursor nach rechts bewegen.
Home: An den Anfang der Zeile springen.
End: Ans Ende der Zeile springen.
Backspace: Zeichen vor dem Cursor löschen.
Delete: Zeichen unter dem Cursor löschen
standard-behavior-pro erweitert standard-behavior um die
folgenden Bindungen:
C-p: Cursor um eine Zeile nach oben bewegen.
C-n: Cursor um eine Zeile nach unten bewegen.
C-b: Cursor nach links bewegen.
C-f: Cursor nach rechts bewegen.
C-a: An den Anfang der Zeile springen.
C-e: Ans Ende der Zeile springen.
C-d: Zeichen unter dem Cursor löschen.
C-k: alles rechts vom Cursor löschen.
die folgenden (hoffentlich) selbsterklärenden Symbole stehen
zum Erstellen von Behaviors zu verfügung:
'move-prev-line
'move-next-line
'move-left
'move-right
'move-forawrd - wie move-right, springt aber nach Ende der Zeile
auf den Anfang der Nächsten.
'move-backward - equivalent zu 'move-forward
'goto-begin-of-line
'goto-end-of-line
'goto-begin-of-first-line
'goto-begin-of-last-line
'goto-begin-of-word-forward
'goto-begin-of-word-backward
'delete-left
'delete-right
'delete-all-left
'delete-all-right
'delete-line
'restore: Synchronisiert inrterne Daten mit externer Darstellung
und Zeichent das Input-field neu.
(war bisher nicht nötig, aber sobald Sonderzeichen erlaubt
sind.... ;-)
Außerdem zeichnet die Funktion
(input-field-refresh input-field)
das Input-field neu.
4. Cursor-over-inputfield? und send-input-field
-----------------------------------------------
(cursor-over-input-field? window) -> #f | input-field
liefert, wenn der Cursor im Fenster window über einem zuvor installiertem
Input-field steht, dieses Input-field zurück, ansonsten #f.
(send-input-field input-field integer) -> (values boolean boolean)
übergibt dem Input-field input-field die Zahl integer. Das Input-field
schaut zuerst, ob es sich um eine im Behavior gebundene Zahl handelt und
führt, falls dies der Fall ist die entsprechende Aktion aus. Falls integer
nicht im Behavior gebunden ist überprüft das Input-field ob es sich um einen
gültigen zum Einfügen gültigen Ascii-code (32-126) handelt und fügt das
entsprechende Zeichen gegebenenfalls an der aktuellen Cursorposition ein.
5. Position, Größe, Scrolleigenschaften nachträglich verändern
--------------------------------------------------------------
;; TODOOO
hierzu stehen folgende Funktionen zur Verfügung:
(input-field-reset input-field) - stellt den default-text wieder her
(input-field-clear input-field) - löscht den Inhalt
(input-field-move input-field x-loc y-loc) - setzt die linke, obere Ecke auf (x-loc y-loc)
(input-field-resize input-field x-dim y-dim) - setzt ...
(input-field-toggle-x-scroll input-field)
(input-field-toggle-y-scroll input-field)

88
pkg-def.scm Normal file
View File

@ -0,0 +1,88 @@
(define-package "scsh-ncurses" (1 1)
((install-lib-version (1 1 2)))
(display "configuring, compiling and installing c-stubs")
(newline)
(let* ((scsh-includes (include-dir))
(build-host (get-option-value 'build))
(prefix (string-append (get-directory 'lib #f) "/" build-host))
(configure `("./configure"
,(string-append "--prefix=" prefix)
,(string-append "--with-scsh-includes=" scsh-includes)
,(string-append "--enable-static=no")
,(string-append "--build=" build-host)))
(make `(make install
,(string-append "DESTDIR=" (get-option-value 'dest-dir)))))
(if (get-option-value 'dry-run)
(begin
(display configure)
(newline)
(display make)
(newline))
(if (not (and (zero? (run ,configure))
(zero? (run ,make))))
(exit))))
(display "creating load.scm")
(newline)
(let ((schemedir (get-directory 'scheme #f))
(libdir (get-directory 'lib #f)))
(write-to-load-script
`((new-package)
(structure 'load-scsh-ncurses '(export))
(open 'scheme-with-scsh)
(open 'srfi-13)
(load-package 'dynamic-externals)
(open 'dynamic-externals)
(open 'external-calls)
(open 'configure)
(open 'signals)
(open 'define-record-types)
(open 'records)
(open 'i/o)
(run '(define (scsh-ncurses-init)
,@tmpl-libtool-la-reader
(let* ((lib-dir (string-append ,libdir "/" (host)))
(la-file-name (string-append lib-dir "/libscshncurses.la"))
(initializer-name "s48_init_ncurses"))
(let ((la-alist (read-libtool-la la-file-name)))
(cond
((assoc 'dlname la-alist)
=> (lambda (p)
(let ((module-file (string-append lib-dir "/" (cdr p))))
(dynamic-load module-file)
(lookup-all-externals) ;;; important when resuming images
(call-external (get-external initializer-name)))))
(else
(error "Could not figure out libscshncurses' name" )))))))
(run '(scsh-ncurses-init))
;; TODO: This is also in sunterlib/heap-images/reinitializer.scm
(run '(define-record-type reinitializer :reinitializer
(make-reinitializer thunk)
reinitializer?
(thunk reinitializer-thunk)))
(run '(define-record-resumer :reinitializer
(lambda (r)
((reinitializer-thunk r)))))
(run '(define scsh-ncurses-reinitializer
(make-reinitializer scsh-ncurses-init)))
(config)
(load ,(string-append schemedir "/ncurses-packages.scm"))
(user))))
(display "installing")
(newline)
(install-directory-contents "scheme" 'scheme)
(install-file '("COPYING" . "LICENSE") 'doc)
)

217
scheme/demo.scm Normal file
View File

@ -0,0 +1,217 @@
(define NULL (ascii->char 0))
(define demo
(lambda ()
(let ((win (init-screen)))
(keypad win #t)
(noecho)
(make&install-input-field win
20 10
42 23
"
+----------------------------------+
| f1 : move left input-field |
| f2 : move right input-field |
| f3 : move up input-field |
| f4 : move down input-field |
| |
| f5 : make bigger in x direction |
| f6 : make smaler in x direction |
| f7 : make bigger in y direction |
| f8 : make smaler in y direction |
| |
| f9 : toggle x-scroll |
| f10 : toggle y-scroll |
| |
| f11 : clear |
| f12 : reset |
| |
| tab : toggle insert |
| |
| ESC : quit |
+----------------------------------+
0-0 0-1 0-2 0-3 0-4 0-5
1-0 1-1 1-2 1-3 1-4 1-5 1-6
2-0 2-1 2-2 2-3 2-4 2-5 2-6 2-7
3-0 3-1 3-2 3-3 3-4 3-5 3-6 3-7 3-8
4-0 4-1 4-2 4-3 4-4 4-5 4-6 4-7 4-8 4-9
5-0 5-1 5-2 5-3 5-4 5-5 5-6 5-7 5-8 4-9
6-0 6-1 6-2 6-3 6-4 6-5 6-6 6-7 6-8
7-0 7-1 7-2 7-3 7-4 7-5 7-6 7-7
8-0 8-1 8-2 8-3 8-4 8-5 8-6
9-0 9-1 9-2 9-3 9-4 9-5\n"
(append
(list (cons 9 ;; tab
'toggle-insert)
(cons key-ppage
'move-backward)
(cons key-npage
'move-forward))
standard-behavior-pro)
#t #t #t)
(wmove win 10 20)
(screen-refresh win)
(letrec ((else-loop (lambda (asc)
(let ((infl (cursor-over-input-field? win)))
(cond ((= asc 27)
(wclear win)
(clear)
(echo)
(endwin))
((= asc key-f1)
(input-field-move infl
(- (input-field-x-location infl)
1)
(input-field-y-location infl))
(screen-refresh win)
(loop (wgetch win)))
((= asc key-f2)
(input-field-move infl
(+ (input-field-x-location infl)
1)
(input-field-y-location infl))
(screen-refresh win)
(loop (wgetch win)))
((= asc key-f3)
(input-field-move infl
(input-field-x-location infl)
(- (input-field-y-location infl)
1))
(screen-refresh win)
(loop (wgetch win)))
((= asc key-f4)
(input-field-move infl
(input-field-x-location infl)
(+ (input-field-y-location infl)
1))
(screen-refresh win)
(loop (wgetch win)))
((= asc key-f5)
(input-field-resize infl
(+ (input-field-x-size infl)
1)
(input-field-y-size infl))
(screen-refresh win)
(loop (wgetch win)))
((= asc key-f6)
(input-field-resize infl
(- (input-field-x-size infl)
1)
(input-field-y-size infl))
(screen-refresh win)
(loop (wgetch win)))
((= asc key-f7)
(input-field-resize infl
(input-field-x-size infl)
(+ (input-field-y-size infl)
1))
(screen-refresh win)
(loop (wgetch win)))
((= asc key-f8)
(input-field-resize infl
(input-field-x-size infl)
(- (input-field-y-size infl)
1))
(screen-refresh win)
(loop (wgetch win)))
((= asc key-f9)
(input-field-toggle-x-scroll infl)
(wrefresh win)
(loop (wgetch win)))
((= asc key-f10)
(input-field-toggle-y-scroll infl)
(wrefresh win)
(loop (wgetch win)))
((= asc key-f11)
(input-field-clear infl)
(wrefresh win)
(loop (wgetch win)))
((= asc key-f12)
(input-field-reset infl)
(wrefresh win)
(loop (wgetch win)))
(else (loop (wgetch win)))))))
(loop (lambda (asc)
(cond ((cursor-over-input-field? win)
=> (lambda (infl)
(call-with-values
(lambda ()
(send-input-field infl asc))
(lambda (was-known is-changed)
(if is-changed
(begin
(wrefresh win)
(loop (wgetch win)))
(if was-known
(loop (wgetch win))
(else-loop asc)))))))))))
(loop (wgetch win))))))
(define screen-refresh
(lambda (screen)
(let ((infl (cursor-over-input-field? screen))
(x (getx screen))
(y (gety screen)))
(wclear screen)
(input-field-refresh infl)
(wdraw-box screen
(- (input-field-x-location infl) 1)
(- (input-field-y-location infl) 1)
(+ (input-field-x-size infl) 2)
(+ (input-field-y-size infl) 2))
(wmove screen y x)
(wrefresh screen))))
(define wdraw-box
(lambda (win x y dimx dimy)
(mvwaddstr win
y
x "+")
(mvwaddstr win
y
(+ dimx
(- x
1)) "+")
(mvwaddstr win
(+ dimy
(- y
1))
x "+")
(mvwaddstr win
(+ dimy
(- y
1))
(+ dimx
(- x
1)) "+")
(let loop-x ((dx (+ x 1)))
(if (= dx (+ x (- dimx 2)))
(begin
(mvwaddstr win y dx "-")
(mvwaddstr win (+ dimy
(- y
1)) dx "-"))
(begin
(mvwaddstr win y dx "-")
(mvwaddstr win (+ dimy
(- y
1)) dx "-")
(loop-x (+ dx 1)))))
(let loop-y ((dy (+ y 1)))
(if (= dy (+ y (- dimy 2)))
(begin
(mvwaddstr win dy x "|")
(mvwaddstr win dy (+ dimx
(- x
1)) "|"))
(begin
(mvwaddstr win dy x "|")
(mvwaddstr win dy (+ dimx
(- x
1)) "|")
(loop-y (+ dy 1)))))))

1598
scheme/input-fields.scm Normal file

File diff suppressed because it is too large Load Diff

160
scheme/ncurses-constants Normal file
View File

@ -0,0 +1,160 @@
;;Konstanten.
//diese werden beim make durch die Konstanten aus curses.h expandiert.
//Dazu erfolgt der Aufruf des C-Pre-Prozessors folgendermaßen:
//cpp -P -imacros /usr/include/ncurses.h ncurses-constants.scm |
// sed -e '/^ *$/d'
// -e 's/refresh1/refresh/' -e 's/move1/move/' -e 's/clear1/clear/'
// > ncurses-constants.scm
//-P:
//keine linemarker erzeugen.
//-imacros file:
//es wird zuerst file eingelesen. Die Ausgabe wird weggeworfen. Es sind jetzt
//die Macros von dort verfügbar.
//sed:
//-e: Befehl ausführen (in diesem Fall reguläre Ausdrücke ersetzen)
//-^:Zeilenanfang
//- *:beliebig viele Leerzeichen
//$:Zeilenende
//d: löscht die Zeile
//s: reguläre Ausdrücke ersetzen
;Funktion um die Oktal-Zahlen aus der Headerdatei in scheme-integer
;zu konvertieren
(define make-oct-int
(lambda (i)
(string->number (string-append "#o"
(number->string i)))))
;
;
;;Farben
;
(define color-black COLOR_BLACK)
(define color-red COLOR_RED)
(define color-green COLOR_GREEN)
(define color-yellow COLOR_YELLOW)
(define color-blue COLOR_BLUE)
(define color-magenta COLOR_MAGENTA)
(define color-cyan COLOR_CYAN)
(define color-white COLOR_WHITE)
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//M-x replace-regexp
//#define KEY_\(.*\).*0[0-9][0-9][0-9].**/
//(define key-\1 KEY_\1)
;
;
;;Sondertasten
;
(define key-code-yes (make-oct-int KEY_CODE_YES))
(define key-min (make-oct-int KEY_MIN))
(define key-break (make-oct-int KEY_BREAK))
(define key-sreset (make-oct-int KEY_SRESET))
(define key-reset (make-oct-int KEY_RESET))
;
(define key-down (make-oct-int KEY_DOWN))
(define key-up (make-oct-int KEY_UP))
(define key-left (make-oct-int KEY_LEFT))
(define key-right (make-oct-int KEY_RIGHT))
(define key-home (make-oct-int KEY_HOME))
(define key-backspace (make-oct-int KEY_BACKSPACE))
(define key-f0 (make-oct-int KEY_F0))
;
(define key-f1 (+ (make-oct-int KEY_F0) 1))
(define key-f2 (+ (make-oct-int KEY_F0) 2))
(define key-f3 (+ (make-oct-int KEY_F0) 3))
(define key-f4 (+ (make-oct-int KEY_F0) 4))
(define key-f5 (+ (make-oct-int KEY_F0) 5))
(define key-f6 (+ (make-oct-int KEY_F0) 6))
(define key-f7 (+ (make-oct-int KEY_F0) 7))
(define key-f8 (+ (make-oct-int KEY_F0) 8))
(define key-f9 (+ (make-oct-int KEY_F0) 9))
(define key-f10 (+ (make-oct-int KEY_F0) 10))
(define key-f11 (+ (make-oct-int KEY_F0) 11))
(define key-f12 (+ (make-oct-int KEY_F0) 12))
;
(define key-dl (make-oct-int KEY_DL))
(define key-il (make-oct-int KEY_IL))
(define key-dc (make-oct-int KEY_DC))
(define key-ic (make-oct-int KEY_IC))
(define key-eic (make-oct-int KEY_EIC))
(define key-clear1 (make-oct-int KEY_CLEAR))
(define key-eos (make-oct-int KEY_EOS))
(define key-eol (make-oct-int KEY_EOL))
(define key-sf (make-oct-int KEY_SF))
(define key-sr (make-oct-int KEY_SR))
(define key-npage (make-oct-int KEY_NPAGE))
(define key-ppage (make-oct-int KEY_PPAGE))
(define key-stab (make-oct-int KEY_STAB))
(define key-ctab (make-oct-int KEY_CTAB))
(define key-catab (make-oct-int KEY_CATAB))
(define key-enter (make-oct-int KEY_ENTER))
(define key-print (make-oct-int KEY_PRINT))
(define key-ll (make-oct-int KEY_LL))
(define key-a1 (make-oct-int KEY_A1))
(define key-a3 (make-oct-int KEY_A3))
(define key-b2 (make-oct-int KEY_B2))
(define key-c1 (make-oct-int KEY_C1))
(define key-c3 (make-oct-int KEY_C3))
(define key-btab (make-oct-int KEY_BTAB))
(define key-beg (make-oct-int KEY_BEG))
(define key-cancel (make-oct-int KEY_CANCEL))
(define key-close (make-oct-int KEY_CLOSE))
(define key-command (make-oct-int KEY_COMMAND))
(define key-copy (make-oct-int KEY_COPY))
(define key-create (make-oct-int KEY_CREATE))
(define key-end (make-oct-int KEY_END))
(define key-exit (make-oct-int KEY_EXIT))
(define key-find (make-oct-int KEY_FIND))
(define key-help (make-oct-int KEY_HELP))
(define key-mark (make-oct-int KEY_MARK))
(define key-message (make-oct-int KEY_MESSAGE))
(define key-move1 (make-oct-int KEY_MOVE))
(define key-next (make-oct-int KEY_NEXT))
(define key-open (make-oct-int KEY_OPEN))
(define key-options (make-oct-int KEY_OPTIONS))
(define key-previous (make-oct-int KEY_PREVIOUS))
(define key-redo (make-oct-int KEY_REDO))
(define key-reference (make-oct-int KEY_REFERENCE))
(define key-refresh1 (make-oct-int KEY_REFRESH))
(define key-replace (make-oct-int KEY_REPLACE))
(define key-restart (make-oct-int KEY_RESTART))
(define key-resume (make-oct-int KEY_RESUME))
(define key-save (make-oct-int KEY_SAVE))
(define key-sbeg (make-oct-int KEY_SBEG))
(define key-scancel (make-oct-int KEY_SCANCEL))
(define key-scommand (make-oct-int KEY_SCOMMAND))
(define key-scopy (make-oct-int KEY_SCOPY))
(define key-screate (make-oct-int KEY_SCREATE))
(define key-sdc (make-oct-int KEY_SDC))
(define key-sdl (make-oct-int KEY_SDL))
(define key-select (make-oct-int KEY_SELECT))
(define key-send (make-oct-int KEY_SEND))
(define key-seol (make-oct-int KEY_SEOL))
(define key-sexit (make-oct-int KEY_SEXIT))
(define key-sfind (make-oct-int KEY_SFIND))
(define key-shelp (make-oct-int KEY_SHELP))
(define key-shome (make-oct-int KEY_SHOME))
(define key-sic (make-oct-int KEY_SIC))
(define key-sleft (make-oct-int KEY_SLEFT))
(define key-smessage (make-oct-int KEY_SMESSAGE))
(define key-smove (make-oct-int KEY_SMOVE))
(define key-snext (make-oct-int KEY_SNEXT))
(define key-soptions (make-oct-int KEY_SOPTIONS))
(define key-sprevious (make-oct-int KEY_SPREVIOUS))
(define key-sprint (make-oct-int KEY_SPRINT))
(define key-sredo (make-oct-int KEY_SREDO))
(define key-sreplace (make-oct-int KEY_SREPLACE))
(define key-sright (make-oct-int KEY_SRIGHT))
(define key-srsume (make-oct-int KEY_SRSUME))
(define key-ssave (make-oct-int KEY_SSAVE))
(define key-ssuspend (make-oct-int KEY_SSUSPEND))
(define key-sundo (make-oct-int KEY_SUNDO))
(define key-suspend (make-oct-int KEY_SUSPEND))
(define key-undo (make-oct-int KEY_UNDO))
(define key-mouse (make-oct-int KEY_MOUSE))
(define key-resize (make-oct-int KEY_RESIZE))
(define key-event (make-oct-int KEY_EVENT))

View File

@ -0,0 +1,132 @@
;;Konstanten.
;Funktion um die Oktal-Zahlen aus der Headerdatei in scheme-integer
;zu konvertieren
(define make-oct-int
(lambda (i)
(string->number (string-append "#o"
(number->string i)))))
;
;
;;Farben
;
(define color-black 0)
(define color-red 1)
(define color-green 2)
(define color-yellow 3)
(define color-blue 4)
(define color-magenta 5)
(define color-cyan 6)
(define color-white 7)
;
;
;;Sondertasten
;
(define key-code-yes (make-oct-int 0400))
(define key-min (make-oct-int 0401))
(define key-break (make-oct-int 0401))
(define key-sreset (make-oct-int 0530))
(define key-reset (make-oct-int 0531))
;
(define key-down (make-oct-int 0402))
(define key-up (make-oct-int 0403))
(define key-left (make-oct-int 0404))
(define key-right (make-oct-int 0405))
(define key-home (make-oct-int 0406))
(define key-backspace (make-oct-int 0407))
(define key-f0 (make-oct-int 0410))
;
(define key-f1 (+ (make-oct-int 0410) 1))
(define key-f2 (+ (make-oct-int 0410) 2))
(define key-f3 (+ (make-oct-int 0410) 3))
(define key-f4 (+ (make-oct-int 0410) 4))
(define key-f5 (+ (make-oct-int 0410) 5))
(define key-f6 (+ (make-oct-int 0410) 6))
(define key-f7 (+ (make-oct-int 0410) 7))
(define key-f8 (+ (make-oct-int 0410) 8))
(define key-f9 (+ (make-oct-int 0410) 9))
(define key-f10 (+ (make-oct-int 0410) 10))
(define key-f11 (+ (make-oct-int 0410) 11))
(define key-f12 (+ (make-oct-int 0410) 12))
;
(define key-dl (make-oct-int 0510))
(define key-il (make-oct-int 0511))
(define key-dc (make-oct-int 0512))
(define key-ic (make-oct-int 0513))
(define key-eic (make-oct-int 0514))
(define key-clear (make-oct-int 0515))
(define key-eos (make-oct-int 0516))
(define key-eol (make-oct-int 0517))
(define key-sf (make-oct-int 0520))
(define key-sr (make-oct-int 0521))
(define key-npage (make-oct-int 0522))
(define key-ppage (make-oct-int 0523))
(define key-stab (make-oct-int 0524))
(define key-ctab (make-oct-int 0525))
(define key-catab (make-oct-int 0526))
(define key-enter (make-oct-int 0527))
(define key-print (make-oct-int 0532))
(define key-ll (make-oct-int 0533))
(define key-a1 (make-oct-int 0534))
(define key-a3 (make-oct-int 0535))
(define key-b2 (make-oct-int 0536))
(define key-c1 (make-oct-int 0537))
(define key-c3 (make-oct-int 0540))
(define key-btab (make-oct-int 0541))
(define key-beg (make-oct-int 0542))
(define key-cancel (make-oct-int 0543))
(define key-close (make-oct-int 0544))
(define key-command (make-oct-int 0545))
(define key-copy (make-oct-int 0546))
(define key-create (make-oct-int 0547))
(define key-end (make-oct-int 0550))
(define key-exit (make-oct-int 0551))
(define key-find (make-oct-int 0552))
(define key-help (make-oct-int 0553))
(define key-mark (make-oct-int 0554))
(define key-message (make-oct-int 0555))
(define key-move (make-oct-int 0556))
(define key-next (make-oct-int 0557))
(define key-open (make-oct-int 0560))
(define key-options (make-oct-int 0561))
(define key-previous (make-oct-int 0562))
(define key-redo (make-oct-int 0563))
(define key-reference (make-oct-int 0564))
(define key-refresh (make-oct-int 0565))
(define key-replace (make-oct-int 0566))
(define key-restart (make-oct-int 0567))
(define key-resume (make-oct-int 0570))
(define key-save (make-oct-int 0571))
(define key-sbeg (make-oct-int 0572))
(define key-scancel (make-oct-int 0573))
(define key-scommand (make-oct-int 0574))
(define key-scopy (make-oct-int 0575))
(define key-screate (make-oct-int 0576))
(define key-sdc (make-oct-int 0577))
(define key-sdl (make-oct-int 0600))
(define key-select (make-oct-int 0601))
(define key-send (make-oct-int 0602))
(define key-seol (make-oct-int 0603))
(define key-sexit (make-oct-int 0604))
(define key-sfind (make-oct-int 0605))
(define key-shelp (make-oct-int 0606))
(define key-shome (make-oct-int 0607))
(define key-sic (make-oct-int 0610))
(define key-sleft (make-oct-int 0611))
(define key-smessage (make-oct-int 0612))
(define key-smove (make-oct-int 0613))
(define key-snext (make-oct-int 0614))
(define key-soptions (make-oct-int 0615))
(define key-sprevious (make-oct-int 0616))
(define key-sprint (make-oct-int 0617))
(define key-sredo (make-oct-int 0620))
(define key-sreplace (make-oct-int 0621))
(define key-sright (make-oct-int 0622))
(define key-srsume (make-oct-int 0623))
(define key-ssave (make-oct-int 0624))
(define key-ssuspend (make-oct-int 0625))
(define key-sundo (make-oct-int 0626))
(define key-suspend (make-oct-int 0627))
(define key-undo (make-oct-int 0630))
(define key-mouse (make-oct-int 0631))
(define key-resize (make-oct-int 0632))
(define key-event (make-oct-int 0633))

402
scheme/ncurses-packages.scm Normal file
View File

@ -0,0 +1,402 @@
(define-interface ncurses-interface
(export init-screen
newterm
endwin
isendwin
delscreen
unctrl
keyname
filter
use_env
putwin
getwin
delay-output
start-color
init-pair
flushinp
curses-version
use-default-colors
assume-default-colors
define-key
baudrate
erasechar
has_ic
has_il
killchar
longname
termname
has-key
start-color
init-pair
init-color
has-colors
can-change-colors
color-pair
cbreak
nocbreak
echo
noecho
halfdelay
intrflush
keypad
meta
nodelay
raw
noraw
qiflush
noqiflush
beep
flash
def-prog-mode
def-shell-mode
reset-prog-mode
reset-shell-mode
resetty
savetty
curs-set
napms
mcprint
is-term-resized
resize-term
resizeterm
scr-dump
scr-restore
scr-init
scr-set
set-term
newwin
delwin
mvwin
subwin
derwin
mvderwin
dupwin
wsyncup
wcursyncup
wsyncdown
syncok
wrefresh
wnoutrefresh
redrawwin
doupdate
wredrawln
;;getyx
;;getparyx
;;getbegyx
;;getmaxyx
gety
getx
getmaxy
getmaxx
wresize
idlok
leaveok
scrollok
idcok
immedok
wsetscrreg
nl
nonl
waddch
waddstr
waddnstr
winsch
winsstr
winsnstr
wechochar
wattroff
wattron
wattrset
wstandend
wstandout
wbkgdset
wbkgd
getbkgd
wborder
box
whline
wvline
scroll
wscrl
wmove
wgetch
wgetstr
wgetnstr
winch
winstr
winnstr
werase
wclear
wclrtobot
wclrtoeol
clearok
wdelch
wdeleteln
winsertln
winsdelln
overlay
overwrite
copywin
touchline
touchwin
untouchwin
wtouchln
is-linetouched
is-wintouched
wprintw
newpad
subpad
prefresh
pnoutrefresh
pechochar
standard-screen
COLS
LINES
A-NORMAL
A-STANDOUT
A-UNDERLINE
A-REVERSE
A-BLINK
A-DIM
A-BOLD
A-PROTECT
A-INVIS
A-ALTCHARSET
COLOR-BLACK
COLOR-RED
COLOR-GREEN
COLOR-YELLOW
COLOR-BLUE
COLOR-MAGENTA
COLOR-CYAN
COLOR-WHITE
refresh
move
setscrreg
scrl
printw
clear
addch
echochar
addstr
addnstr
insch
insstr
insnstr
printw
attroff
attron
attrset
standend
standout
bkgdset
bkgd
border
hline
vline
getch
getstr
getnstr
erase
clear
clrtobot
clrtoeol
delch
deleteln
insdelln
insertln
mvwaddch
mvwaddstr
mvwaddnstr
mvwinsch
mvwinsstr
mvwinsnstr
mvwprintw
mvwhline
mvwvline
mvwgetch
mvwgetstr
mvwgetnstr
mvwdelch
set-stdscr-internal
set-standard-screen
make-window
window-c-pointer
color-black
color-red
color-green
color-yellow
color-blue
color-magenta
color-cyan
color-white
key-code-yes
key-min
key-break
key-sreset
key-reset
key-down
key-up
key-left
key-right
key-home
key-backspace
key-f0
key-f1
key-f2
key-f3
key-f4
key-f5
key-f6
key-f7
key-f8
key-f9
key-f10
key-f11
key-f12
key-dl
key-il
key-dc
key-ic
key-eic
key-clear
key-eos
key-eol
key-sf
key-sr
key-npage
key-ppage
key-stab
key-ctab
key-catab
key-enter
key-print
key-ll
key-a1
key-a3
key-b2
key-c1
key-c3
key-btab
key-beg
key-cancel
key-close
key-command
key-copy
key-create
key-end
key-exit
key-find
key-help
key-mark
key-message
key-move
key-next
key-open
key-options
key-previous
key-redo
key-reference
key-refresh
key-replace
key-restart
key-resume
key-save
key-sbeg
key-scancel
key-scommand
key-scopy
key-screate
key-sdc
key-sdl
key-select
key-send
key-seol
key-sexit
key-sfind
key-shelp
key-shome
key-sic
key-sleft
key-smessage
key-smove
key-snext
key-soptions
key-sprevious
key-sprint
key-sredo
key-sreplace
key-sright
key-srsume
key-ssave
key-ssuspend
key-sundo
key-suspend
key-undo
key-mouse
key-resize
key-event
get-terminal-window-size
set-terminal-window-size!
;; input-fields
buffer-full?
make-input-field
install-input-field
make&install-input-field
remove-input-field
input-field-refresh
input-field-reset
input-field-clear
input-field-move
input-field-resize
input-field-toggle-x-scroll
input-field-toggle-y-scroll
input-field?
input-field-default-text
input-field-text
set-input-field-text!
input-field-prompt
set-input-field-prompt!
input-field-x-edit-pos
input-field-x-location
input-field-y-location
input-field-x-size
input-field-y-size
input-field-x-scroll
input-field-y-scroll
input-field-line
input-field-column
input-field-insert
cursor-over-input-field?
send-input-field
standard-behavior
standard-behavior-pro))
(define-structure ncurses ncurses-interface
(open scheme-with-scsh
srfi-1
external-calls
define-record-types
conditions
signals
; tty-debug
handle
ascii
(with-prefix (subset util (filter)) util-)
weak)
(files ncurses
ncurses-constants
input-fields))

1611
scheme/ncurses.scm Executable file

File diff suppressed because it is too large Load Diff