Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
palomena committed Dec 27, 2021
0 parents commit 547a17b
Show file tree
Hide file tree
Showing 121 changed files with 14,466 additions and 0 deletions.
18 changes: 18 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Copyright (c) 2020 Niklas Benfer <https://github.com/palomena>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
INCLUDE_PATHS := -I/usr/include/SDL2 -Ilibvterm-0.2/include
LIBRARY_PATHS := -Llibvterm-0.2/.libs
LINK := -lSDL2 -lsdlfox -lvterm -lutil
CFLAGS := ${INCLUDE_PATHS} ${LIBRARY_PATHS} ${LINK}

all:
mkdir -p ./build
cc ./src/*.c -o./build/sdlterm ${CFLAGS}

clean:
rm -rv ./build
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# sdlterm

![SDL logo](data/SDL_logo.png) ![logo](data/terminal_small.png)

### About

SDL2 Terminal Emulator based on [libsdl2](http://www.libsdl.org), [libvterm](http://www.leonerd.org.uk/code/libvterm/) and [SDL_fox](https://github.com/palomena/SDL_fox).
Should be compatible with all POSIX compliant systems and probably also win32.

![Screenshot](data/screenshot.png)

Originally developed as a standalone terminal emulator, meaning all of the
vt100 and xterm behind the scenes management had been implemented from scratch.
Turned out ok-ish, but a few edge cases kept failing. Did not want to
go through 3000+ loc of cryptic csi sequence parsing and vt100 handling.
Heard of libvterm and never looked back since. Don't reimplement the wheel.

Single source file, less than 1000 loc, kept as simple and minimal as possible.

![Screenshot](data/terminal.png)

### Features
- Clipboard handling (Copy+Paste)
- Visual terminal bell
- Blinking cursor
- Colors
- Font zoom on mousewheel/touchpad event
- Runtime selectable renderer backend (software, opengl, etc)
- window resize triggers buffer and child process resize
- Fast, due to SDL_fox prerendered font rendering
- Easily hackable by playing around with the accessible sourcecode
- Probably runs on a posix compliant toaster (if SDL supports it)

### Missing features / Future improvements
- Scrollback buffer
- Performance
- damage triggers full screen redraw, where partial update would be sufficient

### Build

1. Install libsdl2, libsdlfox, make
2. `git clone [REPOSITORY URL]`
3. cd ./sdlterm
4. `make`
5. A *wild* sdlterm application should appear in the ./build directory

### License

```
MIT License
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
```
Binary file added data/SDL_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/terminal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/terminal_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added libvterm-0.2/.libs/libvterm.a
Binary file not shown.
1 change: 1 addition & 0 deletions libvterm-0.2/.libs/libvterm.la
41 changes: 41 additions & 0 deletions libvterm-0.2/.libs/libvterm.lai
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# libvterm.la - a libtool library file
# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-15
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).
dlname='libvterm.so.0'

# Names of this library.
library_names='libvterm.so.0.0.0 libvterm.so.0 libvterm.so'

# The name of the static archive.
old_library='libvterm.a'

# Linker flags that cannot go in dependency_libs.
inherited_linker_flags=''

# Libraries that this one depends upon.
dependency_libs=''

# Names of additional weak libraries provided by this library
weak_library_names=''

# Version information for libvterm.
current=0
age=0
revision=0

# Is this an already installed library?
installed=yes

# Should we warn about portability when linking against -modules?
shouldnotlink=no

# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''

# Directory that this library needs to be installed in:
libdir='/usr/local/lib'
1 change: 1 addition & 0 deletions libvterm-0.2/.libs/libvterm.so
1 change: 1 addition & 0 deletions libvterm-0.2/.libs/libvterm.so.0
Binary file added libvterm-0.2/.libs/libvterm.so.0.0.0
Binary file not shown.
22 changes: 22 additions & 0 deletions libvterm-0.2/CONTRIBUTING
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
How to Contribute
-----------------

The main resources for this library are:

Launchpad
https://launchpad.net/libvterm

Freenode:
##tty or #tickit on irc.freenode.net

Email:
Paul "LeoNerd" Evans <[email protected]>


Bug reports and feature requests can be sent to any of the above resources.

New features, bug patches, etc.. should in the first instance be discussed via
any of the resources listed above, before starting work on the actual code.
There may be future plans or development already in-progress that could be
affected so it is better to discuss the ideas first before starting work
actually writing any code.
23 changes: 23 additions & 0 deletions libvterm-0.2/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@


The MIT License

Copyright (c) 2008 Paul Evans <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
145 changes: 145 additions & 0 deletions libvterm-0.2/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
ifeq ($(shell uname),Darwin)
LIBTOOL ?= glibtool
else
LIBTOOL ?= libtool
endif

ifneq ($(VERBOSE),1)
LIBTOOL +=--quiet
endif

override CFLAGS +=-Wall -Iinclude -std=c99 -Wpedantic

ifeq ($(shell uname),SunOS)
override CFLAGS +=-D__EXTENSIONS__ -D_XPG6 -D__XOPEN_OR_POSIX
endif

ifeq ($(DEBUG),1)
override CFLAGS +=-ggdb -DDEBUG
endif

ifeq ($(PROFILE),1)
override CFLAGS +=-pg
override LDFLAGS+=-pg
endif

CFILES=$(sort $(wildcard src/*.c))
HFILES=$(sort $(wildcard include/*.h))
OBJECTS=$(CFILES:.c=.lo)
LIBRARY=libvterm.la

BINFILES_SRC=$(sort $(wildcard bin/*.c))
BINFILES=$(BINFILES_SRC:.c=)

TBLFILES=$(sort $(wildcard src/encoding/*.tbl))
INCFILES=$(TBLFILES:.tbl=.inc)

HFILES_INT=$(sort $(wildcard src/*.h)) $(HFILES)

VERSION_MAJOR=0
VERSION_MINOR=2

VERSION_CURRENT=0
VERSION_REVISION=0
VERSION_AGE=0

VERSION=$(VERSION_MAJOR).$(VERSION_MINOR)

PREFIX=/usr/local
BINDIR=$(PREFIX)/bin
LIBDIR=$(PREFIX)/lib
INCDIR=$(PREFIX)/include
MANDIR=$(PREFIX)/share/man
MAN3DIR=$(MANDIR)/man3

all: $(LIBRARY) $(BINFILES)

$(LIBRARY): $(OBJECTS)
@echo LINK $@
@$(LIBTOOL) --mode=link --tag=CC $(CC) -rpath $(LIBDIR) -version-info $(VERSION_CURRENT):$(VERSION_REVISION):$(VERSION_AGE) -o $@ $^ $(LDFLAGS)

src/%.lo: src/%.c $(HFILES_INT)
@echo CC $<
@$(LIBTOOL) --mode=compile --tag=CC $(CC) $(CFLAGS) -o $@ -c $<

src/encoding/%.inc: src/encoding/%.tbl
@echo TBL $<
@perl -CSD tbl2inc_c.pl $< >$@

src/fullwidth.inc:
@perl find-wide-chars.pl >$@

src/encoding.lo: $(INCFILES)

bin/%: bin/%.c $(LIBRARY)
@echo CC $<
@$(LIBTOOL) --mode=link --tag=CC $(CC) $(CFLAGS) -o $@ $< -lvterm $(LDFLAGS)

t/harness.lo: t/harness.c $(HFILES)
@echo CC $<
@$(LIBTOOL) --mode=compile --tag=CC $(CC) $(CFLAGS) -o $@ -c $<

t/harness: t/harness.lo $(LIBRARY)
@echo LINK $@
@$(LIBTOOL) --mode=link --tag=CC $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

.PHONY: test
test: $(LIBRARY) t/harness
for T in `ls t/[0-9]*.test`; do echo "** $$T **"; perl t/run-test.pl $$T $(if $(VALGRIND),--valgrind) || exit 1; done

.PHONY: clean
clean:
$(LIBTOOL) --mode=clean rm -f $(OBJECTS) $(INCFILES)
$(LIBTOOL) --mode=clean rm -f t/harness.lo t/harness
$(LIBTOOL) --mode=clean rm -f $(LIBRARY) $(BINFILES)

.PHONY: install
install: install-inc install-lib install-bin

install-inc:
install -d $(DESTDIR)$(INCDIR)
install -m644 $(HFILES) $(DESTDIR)$(INCDIR)
install -d $(DESTDIR)$(LIBDIR)/pkgconfig
sed -e "s,@INCDIR@,$(INCDIR)," -e "s,@LIBDIR@,$(LIBDIR)," -e "s,@VERSION@,$(VERSION)," <vterm.pc.in >$(DESTDIR)$(LIBDIR)/pkgconfig/vterm.pc

install-lib: $(LIBRARY)
install -d $(DESTDIR)$(LIBDIR)
$(LIBTOOL) --mode=install install $(LIBRARY) $(DESTDIR)$(LIBDIR)/$(LIBRARY)
$(LIBTOOL) --mode=finish $(DESTDIR)$(LIBDIR)

install-bin: $(BINFILES)
install -d $(DESTDIR)$(BINDIR)
$(LIBTOOL) --mode=install install $(BINFILES) $(DESTDIR)$(BINDIR)/

# DIST CUT

DISTDIR=libvterm-$(VERSION)

distdir: $(INCFILES)
mkdir __distdir
cp LICENSE CONTRIBUTING __distdir
mkdir __distdir/src
cp src/*.c src/*.h src/*.inc __distdir/src
mkdir __distdir/src/encoding
cp src/encoding/*.inc __distdir/src/encoding
mkdir __distdir/include
cp include/*.h __distdir/include
mkdir __distdir/bin
cp bin/*.c __distdir/bin
mkdir __distdir/t
cp t/*.test t/harness.c t/run-test.pl __distdir/t
sed "s,@VERSION@,$(VERSION)," <vterm.pc.in >__distdir/vterm.pc.in
sed "/^# DIST CUT/Q" <Makefile >__distdir/Makefile
mv __distdir $(DISTDIR)

TARBALL=$(DISTDIR).tar.gz

dist: distdir
tar -czf $(TARBALL) $(DISTDIR)
rm -rf $(DISTDIR)

dist+bzr:
$(MAKE) dist VERSION=$(VERSION)+bzr`bzr revno`

distdir+bzr:
$(MAKE) distdir VERSION=$(VERSION)+bzr`bzr revno`
Binary file added libvterm-0.2/bin/.libs/unterm
Binary file not shown.
Binary file added libvterm-0.2/bin/.libs/vterm-ctrl
Binary file not shown.
Binary file added libvterm-0.2/bin/.libs/vterm-dump
Binary file not shown.
Loading

0 comments on commit 547a17b

Please sign in to comment.