summaryrefslogtreecommitdiff
path: root/sim/ucsim/gui.src
diff options
context:
space:
mode:
authorXavier ASUS <xavi92psx@gmail.com>2019-10-18 00:31:54 +0200
committerXavier ASUS <xavi92psx@gmail.com>2019-10-18 00:31:54 +0200
commit268a53de823a6750d6256ee1fb1e7707b4b45740 (patch)
tree42c1799a9a82b2f7d9790ee9fe181d72a7274751 /sim/ucsim/gui.src
downloadsdcc-gas-268a53de823a6750d6256ee1fb1e7707b4b45740.tar.gz
sdcc-3.9.0 fork implementing GNU assembler syntax
This fork aims to provide better support for stm8-binutils
Diffstat (limited to 'sim/ucsim/gui.src')
-rw-r--r--sim/ucsim/gui.src/(c).125
-rw-r--r--sim/ucsim/gui.src/Makefile199
-rw-r--r--sim/ucsim/gui.src/Makefile.dep13
-rw-r--r--sim/ucsim/gui.src/Makefile.in199
-rw-r--r--sim/ucsim/gui.src/clean.mk45
-rw-r--r--sim/ucsim/gui.src/conf.mk12
-rw-r--r--sim/ucsim/gui.src/gui.cc59
-rw-r--r--sim/ucsim/gui.src/gui.obin0 -> 21800 bytes
-rw-r--r--sim/ucsim/gui.src/guicl.h58
-rw-r--r--sim/ucsim/gui.src/if.cc38
-rw-r--r--sim/ucsim/gui.src/if.obin0 -> 13584 bytes
-rw-r--r--sim/ucsim/gui.src/ifcl.h51
-rw-r--r--sim/ucsim/gui.src/obsolete/a.cc87
-rw-r--r--sim/ucsim/gui.src/obsolete/app.cc171
-rw-r--r--sim/ucsim/gui.src/obsolete/appcl.h54
-rw-r--r--sim/ucsim/gui.src/obsolete/bg.cc63
-rw-r--r--sim/ucsim/gui.src/obsolete/bgcl.h47
-rw-r--r--sim/ucsim/gui.src/obsolete/desk.cc58
-rw-r--r--sim/ucsim/gui.src/obsolete/deskcl.h42
-rw-r--r--sim/ucsim/gui.src/obsolete/event.cc126
-rw-r--r--sim/ucsim/gui.src/obsolete/eventcl.h96
-rw-r--r--sim/ucsim/gui.src/obsolete/frame.cc76
-rw-r--r--sim/ucsim/gui.src/obsolete/framecl.h48
-rw-r--r--sim/ucsim/gui.src/obsolete/group.cc393
-rw-r--r--sim/ucsim/gui.src/obsolete/groupcl.h70
-rw-r--r--sim/ucsim/gui.src/obsolete/label.cc74
-rw-r--r--sim/ucsim/gui.src/obsolete/labelcl.h50
-rw-r--r--sim/ucsim/gui.src/obsolete/palette.h44
-rw-r--r--sim/ucsim/gui.src/obsolete/portmon.src/(c).125
-rw-r--r--sim/ucsim/gui.src/obsolete/portmon.src/Makefile.in131
-rw-r--r--sim/ucsim/gui.src/obsolete/portmon.src/clean.mk28
-rw-r--r--sim/ucsim/gui.src/obsolete/portmon.src/conf.mk12
-rw-r--r--sim/ucsim/gui.src/obsolete/portmon.src/pmapp.cc113
-rw-r--r--sim/ucsim/gui.src/obsolete/portmon.src/pmappcl.h48
-rw-r--r--sim/ucsim/gui.src/obsolete/portmon.src/port.cc143
-rw-r--r--sim/ucsim/gui.src/obsolete/portmon.src/portcl.h64
-rw-r--r--sim/ucsim/gui.src/obsolete/portmon.src/portmon.cc68
-rw-r--r--sim/ucsim/gui.src/obsolete/view.cc356
-rw-r--r--sim/ucsim/gui.src/obsolete/viewcl.h118
-rw-r--r--sim/ucsim/gui.src/obsolete/win.cc111
-rw-r--r--sim/ucsim/gui.src/obsolete/wincl.h55
-rw-r--r--sim/ucsim/gui.src/rec.cc31
-rw-r--r--sim/ucsim/gui.src/rec.obin0 -> 2024 bytes
-rw-r--r--sim/ucsim/gui.src/reccl.h38
-rw-r--r--sim/ucsim/gui.src/serio.src/Makefile114
-rw-r--r--sim/ucsim/gui.src/serio.src/Makefile.in114
-rw-r--r--sim/ucsim/gui.src/serio.src/USAGE9
-rw-r--r--sim/ucsim/gui.src/serio.src/clean.mk28
-rw-r--r--sim/ucsim/gui.src/serio.src/conf.mk12
-rw-r--r--sim/ucsim/gui.src/serio.src/config.h20
-rw-r--r--sim/ucsim/gui.src/serio.src/fileio.cc143
-rw-r--r--sim/ucsim/gui.src/serio.src/fileio.hh29
-rw-r--r--sim/ucsim/gui.src/serio.src/frontend.cc292
-rw-r--r--sim/ucsim/gui.src/serio.src/frontend.hh64
-rw-r--r--sim/ucsim/gui.src/serio.src/main.cc439
-rw-r--r--sim/ucsim/gui.src/serio.src/posix_signal.cc106
-rw-r--r--sim/ucsim/gui.src/serio.src/posix_signal.hh22
57 files changed, 4931 insertions, 0 deletions
diff --git a/sim/ucsim/gui.src/(c).1 b/sim/ucsim/gui.src/(c).1
new file mode 100644
index 0000000..d673f9f
--- /dev/null
+++ b/sim/ucsim/gui.src/(c).1
@@ -0,0 +1,25 @@
+/*
+ * Simulator of microcontrollers (@@F@@)
+ *
+ * Copyright (C) @@S@@,@@Y@@ Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
diff --git a/sim/ucsim/gui.src/Makefile b/sim/ucsim/gui.src/Makefile
new file mode 100644
index 0000000..d4ed2e5
--- /dev/null
+++ b/sim/ucsim/gui.src/Makefile
@@ -0,0 +1,199 @@
+#
+# uCsim gui.src/Makefile
+#
+# (c) Drotos Daniel, Talker Bt. 1999
+#
+
+SHELL = /bin/sh
+CXX = g++
+CPP = gcc -E
+CXXCPP = g++ -E
+RANLIB = ranlib
+INSTALL = /usr/bin/install -c
+MAKEDEP = g++ -MM
+AR = ar
+
+top_builddir = ..
+top_srcdir = ..
+
+DEFS = $(subs -DHAVE_CONFIG_H,,-DHAVE_CONFIG_H)
+CPPFLAGS = -I$(srcdir) -I$(top_builddir) -I$(top_srcdir) \
+ -I$(top_srcdir)/sim.src -I$(top_srcdir)/cmd.src
+CFLAGS = -g -O2 -Wall
+CXXFLAGS = -g -O2 -g -Wall
+
+LIBS = -lrt -lnsl -lpanel -lcurses -L$(top_builddir)
+
+curses_ok = yes
+
+prefix = /usr/local
+exec_prefix = ${prefix}
+bindir = ${exec_prefix}/bin
+libdir = ${exec_prefix}/lib
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+includedir = ${prefix}/include
+mandir = ${datarootdir}/man
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+infodir = ${datarootdir}/info
+srcdir = .
+
+
+enable_serio = no
+PKGS =
+ifeq ($(enable_serio),yes)
+SERIO_PKG = serio.src
+else
+SERIO_PKG =
+endif
+CURSES_PKGS = $(SERIO_PKG)
+
+# Common code
+OBJECTS = rec.o
+SOURCES = $(patsubst %.o,%.cc,$(OBJECTS))
+
+# uCsim only
+UCSIM_OBJECTS = gui.o if.o
+UCSIM_SOURCES = $(patsubst %.o,%.cc,$(UCSIM_OBJECTS))
+
+# Tool only
+TOOL_OBJECTS =
+TOOL_SOURCES = $(patsubst %.o,%.cc,$(TOOL_OBJECTS))
+
+ALL_SOURCES = $(SOURCES) $(UCSIM_SOURCES) $(TOOL_SOURCES)
+
+
+# Compiling entire program or any subproject
+# ------------------------------------------
+all: gui.src
+
+gui.src: checkconf gui_api
+ifeq ($(curses_ok),yes)
+ifneq ($(CURSES_PKGS),)
+ @for pkg in $(CURSES_PKGS); do\
+ $(MAKE) -C $$pkg $$pkg;\
+ done
+endif
+endif
+# @for pkg in $(PKGS); do\
+# $(MAKE) -C $$pkg $$pkg ;\
+# done
+
+gui_api: ucsim_lib tool_lib
+
+
+# Compiling and installing everything and runing test
+# ---------------------------------------------------
+install: install_gui_api
+ifeq ($(curses_ok),yes)
+ifneq ($(CURSES_PKGS),)
+ @for pkg in $(CURSES_PKGS); do\
+ $(MAKE) -C $$pkg install ; cd ..;\
+ done
+endif
+endif
+
+install_gui_api:
+
+
+# Deleting all the installed files
+# --------------------------------
+uninstall: uninstall_gui_api
+ifeq ($(curses_ok),yes)
+ifneq ($(CURSES_PKGS),)
+ @for pkg in $(CURSES_PKGS); do\
+ $(MAKE) -C $$pkg uninstall ; cd ..;\
+ done
+endif
+endif
+
+uninstall_gui_api:
+
+
+# Performing self-test
+# --------------------
+check: check_local
+ifneq ($(CURSES_PKGS),)
+ @for pkg in $(CURSES_PKGS); do\
+ $(MAKE) -C $$pkg check;\
+ done
+endif
+
+check_local:
+
+test: test_local
+ifneq ($(CURSES_PKGS),)
+ @for pkg in $(CURSES_PKGS); do\
+ $(MAKE) -C $$pkg test;\
+ done
+endif
+
+test_local:
+
+
+# Performing installation test
+# ----------------------------
+installcheck: installcheck_gui_api
+ifneq ($(CURSES_PKGS),)
+ @for pkg in $(CURSES_PKGS); do\
+ $(MAKE) -C $$pkg installcheck;\
+ done
+endif
+
+installcheck_gui_api:
+
+
+# Creating installation directories
+# ---------------------------------
+installdirs:
+ifneq ($(CURSES_PKGS),)
+ @for pkg in $(CURSES_PKGS); do\
+ $(MAKE) -C $$pkg installdirs;\
+ done
+endif
+
+# Creating dependencies
+# ---------------------
+dep: Makefile.dep
+
+Makefile.dep: $(ALL_SOURCES) $(srcdir)/*.h
+ $(MAKEDEP) $(CPPFLAGS) $(filter %.cc,$^) >Makefile.dep
+
+# don't include Makefile.dep for the listed targets:
+ifeq "$(findstring $(MAKECMDGOALS),uninstall uninstall_gui_api \
+ check check_local test test_local \
+ checkconf \
+ clean_local clean distclean_local \
+ distclean mostlyclean realclean)" ""
+ -include Makefile.dep
+endif
+include $(srcdir)/clean.mk
+
+
+# My rules
+# --------
+ucsim_lib: $(top_builddir)/libguiucsim.a
+
+$(top_builddir)/libguiucsim.a: $(OBJECTS) $(UCSIM_OBJECTS)
+ $(AR) -rc $@ $(OBJECTS) $(UCSIM_OBJECTS)
+ $(RANLIB) $@
+
+tool_lib: $(top_builddir)/libguitool.a
+
+$(top_builddir)/libguitool.a: $(OBJECTS) $(TOOL_OBJECTS)
+ $(AR) -rc $@ $(OBJECTS) $(TOOL_OBJECTS)
+ $(RANLIB) $@
+
+.cc.o:
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
+
+
+# Remaking configuration
+# ----------------------
+checkconf:
+ @if [ -f $(top_builddir)/devel ]; then\
+ $(MAKE) -C $(top_builddir) -f conf.mk srcdir="$(srcdir)" top_builddir="$(top_builddir)" freshconf;\
+ fi
+
+# End of gui.src/Makefile
diff --git a/sim/ucsim/gui.src/Makefile.dep b/sim/ucsim/gui.src/Makefile.dep
new file mode 100644
index 0000000..8906912
--- /dev/null
+++ b/sim/ucsim/gui.src/Makefile.dep
@@ -0,0 +1,13 @@
+rec.o: rec.cc reccl.h ../ddconfig.h ../pobjcl.h ../ddconfig.h ../pobjt.h \
+ ../eventcl.h ../charscl.h
+gui.o: gui.cc guicl.h ../ddconfig.h ../pobjcl.h ../ddconfig.h ../pobjt.h \
+ ../eventcl.h ../charscl.h ../sim.src/simcl.h ../cmd.src/newcmdcl.h \
+ ../optioncl.h ../pobjcl.h ../stypes.h ../cmd.src/commandcl.h \
+ ../cmd.src/newcmdcl.h guicl.h ../sim.src/uccl.h ../stypes.h ../pobjt.h \
+ ../sim.src/hwcl.h ../sim.src/guiobjcl.h ../cmd.src/newcmdposixcl.h \
+ ../fiocl.h ../cmd.src/cmdutil.h ../sim.src/memcl.h ../eventcl.h \
+ ../errorcl.h ../sim.src/brkcl.h ../sim.src/stackcl.h ../sim.src/varcl.h \
+ ../sim.src/uccl_instructions.h ../sim.src/argcl.h ifcl.h \
+ ../sim.src/guiobjcl.h
+if.o: if.cc ifcl.h ../ddconfig.h ../pobjcl.h ../ddconfig.h ../pobjt.h \
+ ../eventcl.h ../charscl.h ../sim.src/guiobjcl.h
diff --git a/sim/ucsim/gui.src/Makefile.in b/sim/ucsim/gui.src/Makefile.in
new file mode 100644
index 0000000..ff2d2c3
--- /dev/null
+++ b/sim/ucsim/gui.src/Makefile.in
@@ -0,0 +1,199 @@
+#
+# uCsim gui.src/Makefile
+#
+# (c) Drotos Daniel, Talker Bt. 1999
+#
+
+SHELL = /bin/sh
+CXX = @CXX@
+CPP = @CPP@
+CXXCPP = @CXXCPP@
+RANLIB = @RANLIB@
+INSTALL = @INSTALL@
+MAKEDEP = @MAKEDEP@
+AR = @AR@
+
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+DEFS = $(subs -DHAVE_CONFIG_H,,@DEFS@)
+CPPFLAGS = @CPPFLAGS@ -I$(srcdir) -I$(top_builddir) -I$(top_srcdir) \
+ -I$(top_srcdir)/sim.src -I$(top_srcdir)/cmd.src
+CFLAGS = @CFLAGS@ @WALL_FLAG@
+CXXFLAGS = @CXXFLAGS@ @WALL_FLAG@
+
+LIBS = @LIBS@ @CURSES_LIBS@ -L$(top_builddir)
+
+curses_ok = @curses_ok@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+libdir = @libdir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+includedir = @includedir@
+mandir = @mandir@
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+infodir = @infodir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+enable_serio = @enable_serio@
+PKGS =
+ifeq ($(enable_serio),yes)
+SERIO_PKG = serio.src
+else
+SERIO_PKG =
+endif
+CURSES_PKGS = $(SERIO_PKG)
+
+# Common code
+OBJECTS = rec.o
+SOURCES = $(patsubst %.o,%.cc,$(OBJECTS))
+
+# uCsim only
+UCSIM_OBJECTS = gui.o if.o
+UCSIM_SOURCES = $(patsubst %.o,%.cc,$(UCSIM_OBJECTS))
+
+# Tool only
+TOOL_OBJECTS =
+TOOL_SOURCES = $(patsubst %.o,%.cc,$(TOOL_OBJECTS))
+
+ALL_SOURCES = $(SOURCES) $(UCSIM_SOURCES) $(TOOL_SOURCES)
+
+
+# Compiling entire program or any subproject
+# ------------------------------------------
+all: gui.src
+
+gui.src: checkconf gui_api
+ifeq ($(curses_ok),yes)
+ifneq ($(CURSES_PKGS),)
+ @for pkg in $(CURSES_PKGS); do\
+ $(MAKE) -C $$pkg $$pkg;\
+ done
+endif
+endif
+# @for pkg in $(PKGS); do\
+# $(MAKE) -C $$pkg $$pkg ;\
+# done
+
+gui_api: ucsim_lib tool_lib
+
+
+# Compiling and installing everything and runing test
+# ---------------------------------------------------
+install: install_gui_api
+ifeq ($(curses_ok),yes)
+ifneq ($(CURSES_PKGS),)
+ @for pkg in $(CURSES_PKGS); do\
+ $(MAKE) -C $$pkg install ; cd ..;\
+ done
+endif
+endif
+
+install_gui_api:
+
+
+# Deleting all the installed files
+# --------------------------------
+uninstall: uninstall_gui_api
+ifeq ($(curses_ok),yes)
+ifneq ($(CURSES_PKGS),)
+ @for pkg in $(CURSES_PKGS); do\
+ $(MAKE) -C $$pkg uninstall ; cd ..;\
+ done
+endif
+endif
+
+uninstall_gui_api:
+
+
+# Performing self-test
+# --------------------
+check: check_local
+ifneq ($(CURSES_PKGS),)
+ @for pkg in $(CURSES_PKGS); do\
+ $(MAKE) -C $$pkg check;\
+ done
+endif
+
+check_local:
+
+test: test_local
+ifneq ($(CURSES_PKGS),)
+ @for pkg in $(CURSES_PKGS); do\
+ $(MAKE) -C $$pkg test;\
+ done
+endif
+
+test_local:
+
+
+# Performing installation test
+# ----------------------------
+installcheck: installcheck_gui_api
+ifneq ($(CURSES_PKGS),)
+ @for pkg in $(CURSES_PKGS); do\
+ $(MAKE) -C $$pkg installcheck;\
+ done
+endif
+
+installcheck_gui_api:
+
+
+# Creating installation directories
+# ---------------------------------
+installdirs:
+ifneq ($(CURSES_PKGS),)
+ @for pkg in $(CURSES_PKGS); do\
+ $(MAKE) -C $$pkg installdirs;\
+ done
+endif
+
+# Creating dependencies
+# ---------------------
+dep: Makefile.dep
+
+Makefile.dep: $(ALL_SOURCES) $(srcdir)/*.h
+ $(MAKEDEP) $(CPPFLAGS) $(filter %.cc,$^) >Makefile.dep
+
+# don't include Makefile.dep for the listed targets:
+ifeq "$(findstring $(MAKECMDGOALS),uninstall uninstall_gui_api \
+ check check_local test test_local \
+ checkconf \
+ clean_local clean distclean_local \
+ distclean mostlyclean realclean)" ""
+ -include Makefile.dep
+endif
+include $(srcdir)/clean.mk
+
+
+# My rules
+# --------
+ucsim_lib: $(top_builddir)/libguiucsim.a
+
+$(top_builddir)/libguiucsim.a: $(OBJECTS) $(UCSIM_OBJECTS)
+ $(AR) -rc $@ $(OBJECTS) $(UCSIM_OBJECTS)
+ $(RANLIB) $@
+
+tool_lib: $(top_builddir)/libguitool.a
+
+$(top_builddir)/libguitool.a: $(OBJECTS) $(TOOL_OBJECTS)
+ $(AR) -rc $@ $(OBJECTS) $(TOOL_OBJECTS)
+ $(RANLIB) $@
+
+.cc.o:
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
+
+
+# Remaking configuration
+# ----------------------
+checkconf:
+ @if [ -f $(top_builddir)/devel ]; then\
+ $(MAKE) -C $(top_builddir) -f conf.mk srcdir="$(srcdir)" top_builddir="$(top_builddir)" freshconf;\
+ fi
+
+# End of gui.src/Makefile
diff --git a/sim/ucsim/gui.src/clean.mk b/sim/ucsim/gui.src/clean.mk
new file mode 100644
index 0000000..826170c
--- /dev/null
+++ b/sim/ucsim/gui.src/clean.mk
@@ -0,0 +1,45 @@
+# uCsim gui.src/clean.mk
+
+PKGS = serio.src
+
+# Deleting all files created by building the program
+# --------------------------------------------------
+clean_local:
+ rm -f *core *[%~] *.[oa] a
+ rm -f .[a-z]*~
+
+clean: clean_local
+ @for pkg in $(PKGS); do\
+ $(MAKE) -C $$pkg clean;\
+ done
+
+
+# Deleting all files created by configuring or building the program
+# -----------------------------------------------------------------
+distclean_local: clean_local
+ rm -f config.cache config.log config.status
+ rm -f Makefile *.dep
+
+distclean: distclean_local
+ @for pkg in $(PKGS); do\
+ $(MAKE) -C $$pkg distclean;\
+ done
+
+
+# Like clean but some files may still exist
+# -----------------------------------------
+mostlyclean: clean_local
+ @for pkg in $(PKGS); do\
+ $(MAKE) -C $$pkg mostlyclean;\
+ done
+
+
+# Deleting everything that can reconstructed by this Makefile. It deletes
+# everything deleted by distclean plus files created by bison, etc.
+# -----------------------------------------------------------------------
+realclean: distclean_local
+ @for pkg in $(PKGS); do\
+ $(MAKE) $$pkg realclean;\
+ done
+
+# End of gui.src/clean.mk
diff --git a/sim/ucsim/gui.src/conf.mk b/sim/ucsim/gui.src/conf.mk
new file mode 100644
index 0000000..3337ba5
--- /dev/null
+++ b/sim/ucsim/gui.src/conf.mk
@@ -0,0 +1,12 @@
+# uCsim gui.src/conf.mk
+
+#
+# Makefile targets to remake configuration
+#
+
+freshconf: Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_srcdir)/configure.ac
+ cd $(top_builddir) && $(SHELL) ./config.status
+
+# End of gui.src/conf.mk
diff --git a/sim/ucsim/gui.src/gui.cc b/sim/ucsim/gui.src/gui.cc
new file mode 100644
index 0000000..8565ca1
--- /dev/null
+++ b/sim/ucsim/gui.src/gui.cc
@@ -0,0 +1,59 @@
+/*
+ * Simulator of microcontrollers (gui.cc)
+ *
+ * Copyright (C) 2001,01 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#include "guicl.h"
+
+
+cl_gui::cl_gui(class cl_sim *asim):
+ cl_base()
+{
+ sim= asim;
+ ifs= new cl_list(2, 2, "ifs of a gui");
+}
+
+cl_gui::~cl_gui(void)
+{
+ delete ifs;
+}
+
+class cl_gui_if *
+cl_gui::if_by_obj(class cl_guiobj *o)
+{
+ int i;
+
+ for (i= 0; i < ifs->count; i++)
+ {
+ class cl_gui_if *gi= (class cl_gui_if *)(ifs->at(i));
+ if (gi->obj &&
+ gi->obj == o)
+ return(gi);
+ }
+ return(0);
+}
+
+
+/* End of gui.src/gui.cc */
diff --git a/sim/ucsim/gui.src/gui.o b/sim/ucsim/gui.src/gui.o
new file mode 100644
index 0000000..570f9f1
--- /dev/null
+++ b/sim/ucsim/gui.src/gui.o
Binary files differ
diff --git a/sim/ucsim/gui.src/guicl.h b/sim/ucsim/gui.src/guicl.h
new file mode 100644
index 0000000..3fd3702
--- /dev/null
+++ b/sim/ucsim/gui.src/guicl.h
@@ -0,0 +1,58 @@
+/*
+ * Simulator of microcontrollers (guicl.h)
+ *
+ * Copyright (C) 2001,01 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#ifndef GUISRC_GUICL_HEADER
+#define GUISRC_GUICL_HEADER
+
+#include "ddconfig.h"
+
+// prj
+#include "pobjcl.h"
+
+// sim
+#include "simcl.h"
+
+// local
+#include "ifcl.h"
+
+
+class cl_gui: public cl_base
+{
+public:
+ class cl_sim *sim;
+ class cl_list *ifs;
+public:
+ cl_gui(class cl_sim *asim);
+ virtual ~cl_gui(void);
+
+ virtual class cl_gui_if *if_by_obj(class cl_guiobj *o);
+};
+
+
+#endif
+
+/* End of gui.src/guicl.h */
diff --git a/sim/ucsim/gui.src/if.cc b/sim/ucsim/gui.src/if.cc
new file mode 100644
index 0000000..b93c2ce
--- /dev/null
+++ b/sim/ucsim/gui.src/if.cc
@@ -0,0 +1,38 @@
+/*
+ * Simulator of microcontrollers (if.cc)
+ *
+ * Copyright (C) 2001,01 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#include "ifcl.h"
+
+
+cl_gui_if::cl_gui_if(class cl_guiobj *o):
+ cl_base()
+{
+ obj= o;
+}
+
+
+/* End of gui.src/if.cc */
diff --git a/sim/ucsim/gui.src/if.o b/sim/ucsim/gui.src/if.o
new file mode 100644
index 0000000..1688899
--- /dev/null
+++ b/sim/ucsim/gui.src/if.o
Binary files differ
diff --git a/sim/ucsim/gui.src/ifcl.h b/sim/ucsim/gui.src/ifcl.h
new file mode 100644
index 0000000..aec1025
--- /dev/null
+++ b/sim/ucsim/gui.src/ifcl.h
@@ -0,0 +1,51 @@
+/*
+ * Simulator of microcontrollers (guiifcl.h)
+ *
+ * Copyright (C) 2001,01 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#ifndef GUISRC_IFCL_HEADER
+#define GUISRC_IFCL_HEADER
+
+#include "ddconfig.h"
+
+// prj
+#include "pobjcl.h"
+
+// sim
+#include "guiobjcl.h"
+
+
+class cl_gui_if: public cl_base
+{
+public:
+ class cl_guiobj *obj; // Object inspected by the GUI tool
+public:
+ cl_gui_if(class cl_guiobj *o);
+};
+
+
+#endif
+
+/* End of gui.src/ifcl.h */
diff --git a/sim/ucsim/gui.src/obsolete/a.cc b/sim/ucsim/gui.src/obsolete/a.cc
new file mode 100644
index 0000000..81d62c3
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/a.cc
@@ -0,0 +1,87 @@
+#include <curses.h>
+#include <panel.h>
+
+int sfr[4];
+int port[4];
+
+void
+init_panel(PANEL *p)
+{
+ int mask, x, y;
+ int na, ha;
+ int cursor= 2;
+ WINDOW *w= panel_window(p);
+
+ if (has_colors())
+ {
+ na= COLOR_PAIR(1);
+ ha= COLOR_PAIR(2);
+ }
+ else
+ {
+ na= A_NORMAL;
+ ha= A_STANDOUT;
+ }
+ //wattron(w, COLOR_PAIR);
+ x= 0;
+ for (mask= 1, y= 0; mask < 0x100; mask<<= 1,y++)
+ {
+ wattrset(w, (y==cursor)?ha:na);
+ mvwprintw(w, y,x, "%s", (sfr[0]&mask)?"High":" Low");
+ }
+}
+
+wchar_t
+wait_input(PANEL *p)
+{
+ WINDOW *w= panel_window(p);
+ wchar_t c;
+
+ c= wgetch(w);
+ printw("%d 0x%x\n",c,c);
+ return(c);
+}
+
+int
+main(int argc, char *argv[])
+{
+ wchar_t c;
+
+ initscr(); /* initialize the curses library */
+ keypad(stdscr, TRUE); /* enable keyboard mapping */
+ nonl(); /* tell curses not to do NL->CR/NL on output */
+ cbreak(); /* take input chars one at a time, no wait for \n */
+ noecho(); /* don't echo input */
+ if (has_colors())
+ {
+ start_color();
+ printw("has %d colors and %d pairs\n", COLORS, COLOR_PAIRS);
+ init_pair(1, COLOR_WHITE, COLOR_BLUE);
+ init_pair(2, COLOR_WHITE, COLOR_RED);
+ }
+ if (has_key(KEY_UP))
+ printw("has UP KEY_UP=0x%x\n",KEY_UP);
+ else
+ printf("has no UP\n");
+ c= getch();
+ printw("got %d %x\n",c,c);
+
+ WINDOW *w= newwin(10,10, 3,3);
+ keypad(w, TRUE);
+ PANEL *p= new_panel(w);
+
+ sfr[0]= 0x5a;
+ init_panel(p);
+ update_panels();
+ doupdate();
+ c= wait_input(p);
+ //c= getch();
+
+ endwin();
+ if (c==KEY_UP)
+ printf("got UP\n");
+ else if (c==KEY_DOWN)
+ printf("got DOWN\n");
+ else
+ printf("got \"%d\"\n", c);
+}
diff --git a/sim/ucsim/gui.src/obsolete/app.cc b/sim/ucsim/gui.src/obsolete/app.cc
new file mode 100644
index 0000000..309497b
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/app.cc
@@ -0,0 +1,171 @@
+/*
+ * Simulator of microcontrollers (app.cc)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#include <stdlib.h>
+
+#include "appcl.h"
+#include "deskcl.h"
+
+
+cl_app::cl_app(char *iname):
+ cl_group(iname, this)
+{
+ drawn= 0;
+}
+
+cl_app::~cl_app(void)
+{
+ endwin();
+}
+
+int
+cl_app::init(void)
+{
+ initscr();
+ keypad(stdscr, TRUE);
+ nonl();
+ cbreak();
+ noecho();
+
+ pos= new cl_box(0,0, COLS, LINES);
+ cl_view::init();
+ state|= SF_SELECTED;//select();
+ class cl_box b(*pos);
+ //b.move_rel(0,1);
+ //b.grow(0,-2);
+ if ((desk= mk_desk(&b)))
+ insert(desk);
+ desk->select();
+ mk_views(desk);
+
+ //update();
+ update_panels();
+ doupdate();
+ return(0);
+}
+
+class cl_gin *
+cl_app::mk_input(void)
+{
+ class cl_gin *i= new cl_gin();
+ i->init();
+ i->add_input(stdin, 0);
+ return(i);
+}
+
+int *
+cl_app::mk_palette(void)
+{
+ int *p, i;
+ int colors;
+
+ colors= 64;
+ p= (int*)malloc(colors * sizeof(int));
+ if (has_colors())
+ {
+ start_color();
+
+ init_pair(i= C_WIN+C_WIN_NORMAL, COLOR_YELLOW, COLOR_BLUE);
+ p[i]= COLOR_PAIR(i)|A_BOLD;
+ for (i= 1; i < colors; i++)
+ p[i]= p[C_WIN+C_WIN_NORMAL];
+ // desktop
+ init_pair(i= C_DSK_BG, COLOR_BLACK, COLOR_WHITE);
+ p[i]= COLOR_PAIR(i);
+ // menus and status bar
+ init_pair(i= C_DSK_NORMAL, COLOR_WHITE, COLOR_BLUE);
+ p[i]= COLOR_PAIR(i)|A_BOLD;
+ init_pair(i= C_DSK_DISABLED, COLOR_WHITE, COLOR_BLUE);
+ p[i]= COLOR_PAIR(i);
+ // window
+ init_pair(i= C_WIN+C_WIN_FPASSIVE, COLOR_WHITE, COLOR_BLUE);
+ p[i]= COLOR_PAIR(i);
+ init_pair(i= C_WIN+C_WIN_FACTIVE, COLOR_WHITE, COLOR_BLUE);
+ p[i]= COLOR_PAIR(i)|A_BOLD;
+ init_pair(i= C_WIN+C_WIN_SELECTED, COLOR_YELLOW, COLOR_RED);
+ p[i]= COLOR_PAIR(i)|A_BOLD;
+ }
+ else
+ {
+ for (i= 0; i < colors; i++)
+ p[i]= A_NORMAL;
+ p[C_WIN+C_WIN_FACTIVE]|= A_BOLD;
+ p[C_WIN+C_WIN_SELECTED]|= A_REVERSE;
+ }
+ return(p);
+}
+
+class cl_group *
+cl_app::mk_desk(class cl_box *ipos)
+{
+ class cl_group *d= new cl_desk(ipos, "desktop", this);
+ d->init();
+ return(d);
+}
+
+
+int
+cl_app::handle_event(struct t_event *event)
+{
+ if (!cl_group::handle_event(event))
+ {
+ if (event->what == EV_KEY)
+ switch (event->event.key)
+ {
+ case KEY_BREAK: case KEY_EXIT:
+ event->what= EV_COMMAND;
+ event->event.msg.cmd= CMD_QUIT;
+ break;
+ }
+ }
+ return(0);
+}
+
+int
+cl_app::run(void)
+{
+ struct t_event event;
+
+ drawn= 0;
+ while (get_event(&event))
+ {
+ if (!handle_event(&event))
+ {
+ if (event.what == EV_COMMAND &&
+ event.event.msg.cmd == CMD_QUIT)
+ return(0);
+ unhandled(&event);
+ }
+ if (drawn)
+ update();
+ drawn= 0;
+ }
+ return(0);
+}
+
+
+/* End of gui.src/app.cc */
diff --git a/sim/ucsim/gui.src/obsolete/appcl.h b/sim/ucsim/gui.src/obsolete/appcl.h
new file mode 100644
index 0000000..92a80c9
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/appcl.h
@@ -0,0 +1,54 @@
+/*
+ * Simulator of microcontrollers (appcl.h)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#ifndef APPCL_HEADER
+#define APPCL_HEADER
+
+#include "groupcl.h"
+
+
+class cl_app: public cl_group
+{
+public:
+ class cl_group *desk;
+ int drawn;
+public:
+ cl_app(char *iname);
+ ~cl_app(void);
+ virtual int init(void);
+ virtual class cl_gin *mk_input(void);
+ virtual int *mk_palette(void);
+ virtual class cl_group *mk_desk(class cl_box *ipos);
+
+ virtual int handle_event(struct t_event *event);
+ virtual int run(void);
+};
+
+
+#endif
+
+/* End of gui.src/appcl.h */
diff --git a/sim/ucsim/gui.src/obsolete/bg.cc b/sim/ucsim/gui.src/obsolete/bg.cc
new file mode 100644
index 0000000..d854d30
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/bg.cc
@@ -0,0 +1,63 @@
+/*
+ * Simulator of microcontrollers (bg.cc)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#include <stdlib.h>
+
+#include "bgcl.h"
+
+
+cl_bg::cl_bg(class cl_box *ipos, char *iname, class cl_app *iapp):
+ cl_view(ipos, iname, iapp)
+{
+ options&= ~OF_SELECTABLE;
+}
+
+int *
+cl_bg::mk_palette(void)
+{
+ int *p;
+
+ p= (int*)malloc(1*sizeof(int));
+ p[0]= C_DSK_BG;
+ return(p);
+}
+
+int
+cl_bg::draw(void)
+{
+ int x, y, color= get_color(0);
+
+ wmove(window, 0, 0);
+ wattrset(window, color);
+ for (y= 0; y < pos->h; y++)
+ for (x= 0; x < pos->w; x++)
+ waddch(window, ACS_CKBOARD);
+ return(0);
+}
+
+
+/* End of gui.src/bg.cc */
diff --git a/sim/ucsim/gui.src/obsolete/bgcl.h b/sim/ucsim/gui.src/obsolete/bgcl.h
new file mode 100644
index 0000000..968ed81
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/bgcl.h
@@ -0,0 +1,47 @@
+/*
+ * Simulator of microcontrollers (bgcl.h)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#ifndef BGCL_HEADER
+#define BGCL_HEADER
+
+
+#include "viewcl.h"
+#include "appcl.h"
+
+
+class cl_bg: public cl_view
+{
+public:
+ cl_bg(class cl_box *ipos, char *iname, class cl_app *iapp);
+ virtual int *mk_palette(void);
+ virtual int draw(void);
+};
+
+
+#endif
+
+/* End of gui.src/bgcl.h */
diff --git a/sim/ucsim/gui.src/obsolete/desk.cc b/sim/ucsim/gui.src/obsolete/desk.cc
new file mode 100644
index 0000000..6808cd7
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/desk.cc
@@ -0,0 +1,58 @@
+/*
+ * Simulator of microcontrollers (desk.cc)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#include "deskcl.h"
+#include "bgcl.h"
+
+
+int
+cl_desk::handle_event(struct t_event *event)
+{
+ if (cl_group::handle_event(event))
+ return(1);
+ if (event->what == EV_KEY &&
+ event->event.key == KEY_F(6))
+ {
+ select_next();
+ return(1);
+ }
+ return(0);
+}
+
+int
+cl_desk::mk_views(class cl_group *ins_to)
+{
+ class cl_box b(*pos);
+
+ b.move_rel(0,1);
+ b.grow(0,-2);
+ insert(new cl_bg(&b, "background", app));
+ return(0);
+}
+
+
+/* End of gui.src/desk.cc */
diff --git a/sim/ucsim/gui.src/obsolete/deskcl.h b/sim/ucsim/gui.src/obsolete/deskcl.h
new file mode 100644
index 0000000..b3346b7
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/deskcl.h
@@ -0,0 +1,42 @@
+/*
+ * Simulator of microcontrollers (deskcl.h)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#include "groupcl.h"
+
+
+class cl_desk: public cl_group
+{
+public:
+ cl_desk(class cl_box *ipos, char *iname, class cl_app *iapp):
+ cl_group(ipos, iname, iapp) {}
+ virtual int mk_views(class cl_group *ins_to);
+
+ virtual int handle_event(struct t_event *event);
+};
+
+
+/* End of gui.src/deskcl.h */
diff --git a/sim/ucsim/gui.src/obsolete/event.cc b/sim/ucsim/gui.src/obsolete/event.cc
new file mode 100644
index 0000000..3207589
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/event.cc
@@ -0,0 +1,126 @@
+/*
+ * Simulator of microcontrollers (event.cc)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#include "ddconfig.h"
+
+#include <curses.h>
+
+//#include <stdio.h>
+
+#include "eventcl.h"
+
+
+cl_input_src::cl_input_src(FILE *ifile, class cl_view *iview)
+{
+ file= ifile;
+ view= iview;
+}
+
+
+cl_gin::cl_gin(void)
+{
+ FD_ZERO(&in_set);
+ max_fdes= 0;
+ inputs= new cl_list(1, 1);
+}
+
+cl_gin::~cl_gin(void)
+{
+ delete inputs;
+}
+
+
+int
+cl_gin::add_input(FILE *ifile, class cl_view *iview)
+{
+ int d= fileno(ifile);
+
+ inputs->add(new cl_input_src(ifile, iview));
+ if (d > max_fdes)
+ max_fdes= d;
+ FD_SET(d, &in_set);
+ return(0);
+}
+
+class cl_input_src *
+cl_gin::get_input_src(int fdes)
+{
+ int i;
+
+ for (i= 0; i < inputs->count; i++)
+ {
+ class cl_input_src *s= (class cl_input_src *)(inputs->at(i));
+ if (fileno(s->file) == fdes)
+ return(s);
+ }
+ return(0);
+}
+
+int
+cl_gin::get_event(struct t_event *event)
+{
+ fd_set set;
+ //static struct timeval timeout= {0,0};
+ wchar_t c;
+
+ //FD_ZERO(&set);
+ set= in_set;
+ //FD_SET(fileno(stdin), &set);
+ if(::select(/*fileno(stdin)*/max_fdes+1,
+ &set, NULL, NULL,
+ NULL/*&timeout*/) > 0)
+ {
+ int i;
+ for (i= 0; i < inputs->count; i++)
+ {
+ class cl_input_src *s= (class cl_input_src *)(inputs->at(i));
+ if (!s->file ||
+ !(FD_ISSET(fileno(s->file), &set)))
+ continue;
+ if (s->view)
+ {
+ if (s->file)
+ {
+ c= fgetc(s->file);
+ return(s->view->mk_event(event, s->file, c));
+ }
+ }
+ else
+ if ((c= getch()) > 0)
+ {
+ event->what= EV_KEY;
+ event->event.key= c;
+ return(1);
+ }
+ }
+ }
+
+ return(0);
+}
+
+
+/* End of gui.src/event.cc */
diff --git a/sim/ucsim/gui.src/obsolete/eventcl.h b/sim/ucsim/gui.src/obsolete/eventcl.h
new file mode 100644
index 0000000..4077a72
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/eventcl.h
@@ -0,0 +1,96 @@
+/*
+ * Simulator of microcontrollers (eventcl.h)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#ifndef EVENTCL_HEADER
+#define EVENTCL_HEADER
+
+#include "ddconfig.h"
+
+#if FD_HEADER_OK
+# include HEADER_FD
+#endif
+
+#include "pobjcl.h"
+
+#include "viewcl.h"
+
+
+#define EV_NOTHING 0x0000
+#define EV_MOUSE_DOWN 0x0001
+#define EV_MOUSE_UP 0x0002
+#define EV_MOUSE_MOVE 0x0004
+#define EV_MOUSE_AUTO 0x0008
+#define EV_KEY 0x0010
+#define EV_COMMAND 0x0100
+#define EV_BROADCAST 0x0200
+
+// cathegories
+#define EV_MOUSE (EV_MOUSE_DOWN|EV_MOUSE_UP|EV_MOUSE_MOVE|EV_MOUSE_AUTO)
+#define EV_KEYBOARD EV_KEY
+#define EV_MESSAGE 0xff00
+
+#define CMD_QUIT 0
+
+struct t_event {
+ int what;
+ union {
+ wchar_t key;
+ struct {
+ int cmd;
+ long param;
+ } msg;
+ } event;
+};
+
+
+class cl_input_src: public cl_base
+{
+public:
+ FILE *file;
+ class cl_view *view;
+ cl_input_src(FILE *ifile, class cl_view *iview);
+};
+
+class cl_gin: public cl_base
+{
+public:
+ fd_set in_set;
+ int max_fdes;
+ cl_list *inputs;
+public:
+ cl_gin(void);
+ ~cl_gin(void);
+
+ virtual int add_input(FILE *ifile, class cl_view *iview);
+ virtual class cl_input_src *get_input_src(int fdes);
+ virtual int get_event(struct t_event *event);
+};
+
+
+#endif
+
+/* End of gui.src/eventcl.h */
diff --git a/sim/ucsim/gui.src/obsolete/frame.cc b/sim/ucsim/gui.src/obsolete/frame.cc
new file mode 100644
index 0000000..b6b00e8
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/frame.cc
@@ -0,0 +1,76 @@
+/*
+ * Simulator of microcontrollers (frame.cc)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#include "ddconfig.h"
+
+#include <stdlib.h>
+#include "i_string.h"
+
+#include "framecl.h"
+#include "wincl.h"
+
+
+cl_frame::cl_frame(class cl_box *ipos, class cl_view *iwindow, char *iname,
+ class cl_app *iapp):
+ cl_view(ipos, iname, iapp)
+{
+ win= iwindow;
+ options&= ~OF_SELECTABLE;
+}
+
+int *
+cl_frame::mk_palette(void)
+{
+ int *p;
+
+ p= (int*)malloc(2*sizeof(int));
+ p[0]= C_WIN_FPASSIVE;
+ p[1]= C_WIN_FACTIVE;
+ return(p);
+}
+
+int
+cl_frame::draw(void)
+{
+ char *t;
+ int color;
+
+ color= get_color((win && (win->state&SF_SELECTED))?1:0);
+ wattrset(window, color);
+ box(window, ACS_VLINE, ACS_HLINE);
+ if (!(t= strdup(((class cl_win *)win)->get_title())))
+ return(0);
+ if ((signed)strlen(t) > (pos->w)-4)
+ t[(pos->w)-4]= '\0';
+ mvwprintw(window, 0,((pos->w)-strlen(t))/2, "[%s]", t);
+ free(t);
+ app->drawn++;
+ return(0);
+}
+
+
+/* End of gui.src/frame.cc */
diff --git a/sim/ucsim/gui.src/obsolete/framecl.h b/sim/ucsim/gui.src/obsolete/framecl.h
new file mode 100644
index 0000000..6a3c06a
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/framecl.h
@@ -0,0 +1,48 @@
+/*
+ * Simulator of microcontrollers (framecl.h)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#ifndef FRAMELCL_HEADER
+#define FRAMELCL_HEADER
+
+#include "viewcl.h"
+#include "appcl.h"
+
+
+class cl_frame: public cl_view
+{
+ class cl_view *win;
+public:
+ cl_frame(class cl_box *ipos, class cl_view *iwindow, char *iname,
+ class cl_app *iapp);
+ virtual int *mk_palette(void);
+ virtual int draw(void);
+};
+
+
+#endif
+
+/* End of gui.src/framecl.h */
diff --git a/sim/ucsim/gui.src/obsolete/group.cc b/sim/ucsim/gui.src/obsolete/group.cc
new file mode 100644
index 0000000..45bb0e4
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/group.cc
@@ -0,0 +1,393 @@
+/*
+ * Simulator of microcontrollers (group.cc)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#include "groupcl.h"
+#include "appcl.h"
+
+
+cl_group::cl_group(class cl_box *ipos, char *iname, class cl_app *iapp):
+ cl_view(ipos, iname, iapp)
+{
+ current= 0;
+}
+
+cl_group::cl_group(char *iname, class cl_app *iapp):
+ cl_view(iname, iapp)
+{
+ current= 0;
+}
+
+cl_group::~cl_group(void)
+{}
+
+int
+cl_group::init(void)
+{
+ cl_view::init();
+ mk_views(this);
+ return(0);
+}
+
+int
+cl_group::mk_views(class cl_group *ins_to)
+{
+ return(0);
+}
+
+
+/*
+ * Make output by drawing all subviews
+ */
+
+static void do_draw_view(class cl_view *view)
+{
+ view->draw();
+}
+
+int
+cl_group::draw(void)
+{
+ /*int i;
+
+ for (i= 0; i < views->count; i++)
+ {
+ class cl_view *v= (class cl_view *)(views->at(i));
+ v->draw();
+ app->drawn++;
+ }*/
+ for_each(do_draw_view);
+ return(0);
+}
+
+/*int
+cl_group::update(void)
+{
+ draw();
+ update_panels();
+ doupdate();
+}*/
+
+
+int
+cl_group::handle_event(struct t_event *event)
+{
+ int handled= 0;
+
+ if (event->what & (EV_KEY|EV_COMMAND))
+ {
+ if (current)
+ handled= current->handle_event(event);
+ }
+ else if (event->what & EV_MESSAGE)
+ {
+ class cl_view *v= last;
+ do
+ {
+ handled= v->handle_event(event);
+ v= v->next;
+ }
+ while (! handled &&
+ v != last);
+ }
+ return(handled);
+}
+
+
+/*
+ * Managing views
+ */
+
+//class cl_view *
+void
+cl_group::insert(class cl_view *view)
+{
+ /*if (view &&
+ view->ok())
+ {
+ views->add_at(0, view);
+ view->parent= this;
+ view->select();
+ //view->draw();
+ return(view);
+ }
+ return(0);*/
+ insert_before(view, first());
+ if (view->options & OF_SELECTABLE)
+ view->select();
+ draw();
+}
+
+void
+cl_group::insert_before(class cl_view *view, class cl_view *target)
+{
+ unsigned int ss;
+
+ if (view &&
+ !(view->parent) &&
+ (!target ||
+ target->parent == this))
+ {
+ ss= view->state;
+ //view->hide();
+ insert_view(view, target);
+ /*if (ss & SF_VISIBLE)
+ view->show();*/
+ if (state & SF_ACTIVE)
+ view->change_state(SF_ACTIVE, 1);
+ }
+}
+
+void
+cl_group::insert_view(class cl_view *view, class cl_view *target)
+{
+ view->parent= this;
+ if (target)
+ {
+ target= target->prev();
+ view->next= target->next;
+ target->next= view;
+ }
+ else
+ {
+ if (!last)
+ view->next= view;
+ else
+ {
+ view->next= last->next;
+ last->next= view;
+ }
+ last= view;
+ }
+}
+
+class cl_view *
+cl_group::first(void)
+{
+ if (!last)
+ return(0);
+ return(last->next);
+}
+
+
+/*class cl_view *
+cl_group::get_by_state(unsigned int what, int enabled)
+{
+ int i;
+
+ for (i= 0; i < views->count; i++)
+ {
+ class cl_view *v= (class cl_view *)(views->at(i));
+ if ((enabled &&
+ (state&what))
+ ||
+ (!enabled &&
+ ((~state)&what))
+ )
+ return(v);
+ }
+ return(0);
+}*/
+
+/*int
+cl_group::select(void)
+{
+}*/
+
+/*int
+cl_group::unselect(void)
+{
+}*/
+
+int
+cl_group::select_next()
+{
+ /* int start, i;
+ class cl_view *v;
+
+ if (views->count <= 1)
+ return(1);
+ if (current)
+ start= views->index_of(current);
+ else
+ if ((v= get_by_state(SF_SELECTED, 1)))
+ start= views->index_of(v);
+ else
+ if ((v= get_by_state(SF_FOCUSED, 1)))
+ start= views->index_of(v);
+ else
+ start= 0;
+ i= (start+1)%(views->count);
+ while (i != start)
+ {
+ v= (class cl_view *)(views->at(i));
+ if ((v->options & OF_SELECTABLE) &&
+ v->select())
+ {
+ //update();
+ return(1);
+ }
+ i= (i+1)%(views->count);
+ }*/
+ return(0);
+}
+
+int
+cl_group::select_prev()
+{
+ /* int start, i;
+ class cl_view *v;
+
+ if (views->count <= 1)
+ return(1);
+ if (current)
+ start= views->index_of(current);
+ else
+ if ((v= get_by_state(SF_SELECTED, 1)))
+ start= views->index_of(v);
+ else
+ if ((v= get_by_state(SF_FOCUSED, 1)))
+ start= views->index_of(v);
+ else
+ start= 0;
+ i= start-1; if (i < 0) i= views->count-1;
+ while (i != start)
+ {
+ v= (class cl_view *)(views->at(i));
+ if ((v->options & OF_SELECTABLE) &&
+ v->select())
+ {
+ //update();
+ return(1);
+ }
+ i= start-1; if (i < 0) i= views->count-1;
+ }*/
+ return(0);
+}
+
+class cl_view *
+cl_group::current_sub_view(void)
+{
+ return(current);
+}
+
+void
+cl_group::for_each(void (*func)(class cl_view *view))
+{
+ class cl_view *v;
+
+ if (!last)
+ return;
+ v= last->next;
+ do
+ {
+ func(v);
+ v= v->next;
+ }
+ while (v != last);
+}
+
+void
+cl_group::set_current(class cl_view *view)
+{
+ //current= view;
+ if (current == view)
+ return;
+ //lock();
+ /*focus_view(view, 0);*/
+ if ((state & SF_FOCUSED) &&
+ (current != 0))
+ current->change_state(SF_FOCUSED, 0);
+ //if (mode!=ENTER_SELECT) select_view(current, 0);
+ if (current)
+ current->change_state(SF_SELECTED, 0);
+ //if (mode!=LEAVE_SELECT) select_view(view, 1);
+ if (view)
+ view->change_state(SF_SELECTED, 1);
+ //focuse_view(view, 1);
+ if ((state & SF_FOCUSED) &&
+ (view != 0))
+ view->change_state(SF_SELECTED, 1);
+ current= view;
+ //unlock();
+}
+
+/*int
+cl_group::terminal_view(void)
+{
+ return(views->count == 0);
+}*/
+
+static unsigned int grp_what, grp_en;
+
+static void
+do_set_state(class cl_view *v)
+{
+ v->change_state(grp_what, grp_en);
+}
+
+void
+cl_group::change_state(unsigned int what, int enable)
+{
+ cl_view::change_state(what, enable);
+ /*if (enable &&
+ (what & SF_SELECTED))
+ {
+ class cl_view *v= get_by_state(SF_SELECTED, 1);
+ if (v)
+ {
+ current= v;
+ current->change_state(SF_FOCUSED, 1);
+ current->change_state(SF_SELECTED, 1);
+ }
+ else
+ {
+ if ((v= get_by_state(SF_FOCUSED, 1)))
+ {
+ current= v;
+ current->change_state(SF_SELECTED, 1);
+ }
+ }
+ }*/
+ switch (what)
+ {
+ case SF_ACTIVE:
+ //lock();
+ grp_what= what;
+ grp_en= enable;
+ for_each(do_set_state);
+ //unlock();
+ break;
+ case SF_FOCUSED:
+ if (current)
+ current->change_state(SF_FOCUSED, enable);
+ break;
+ }
+ draw();
+}
+
+
+/* End of gui.src/group.cc */
diff --git a/sim/ucsim/gui.src/obsolete/groupcl.h b/sim/ucsim/gui.src/obsolete/groupcl.h
new file mode 100644
index 0000000..87f0ba8
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/groupcl.h
@@ -0,0 +1,70 @@
+/*
+ * Simulator of microcontrollers (groupcl.h)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#ifndef GROUPCL_HEADER
+#define GROUPCL_HEADER
+
+#include "viewcl.h"
+
+class cl_group: public cl_view
+{
+public:
+ class cl_view *current;
+
+public:
+ cl_group(class cl_box *ipos, char *iname, class cl_app *iapp);
+ cl_group(char *iname, class cl_app *iapp);
+ ~cl_group(void);
+ virtual int init(void);
+ virtual int mk_views(class cl_group *ins_to);
+ virtual int is_group(void) {return(1);}
+
+ virtual int draw(void);
+ //virtual int update(void);
+
+ virtual int handle_event(struct t_event *event);
+
+ virtual /*class cl_view **/void insert(class cl_view *view);
+ virtual void insert_before(class cl_view *view, class cl_view *target);
+ virtual void insert_view(class cl_view *view, class cl_view *target);
+ virtual class cl_view *first(void);
+ virtual void for_each(void (*func)(class cl_view *view));
+ //virtual class cl_view *get_by_state(unsigned int what, int enabled);
+ //virtual int select(void);
+ //virtual int unselect(void);
+ virtual int select_next();
+ virtual int select_prev();
+ virtual class cl_view *current_sub_view(void);
+ virtual void set_current(class cl_view *view);
+ //virtual int terminal_view(void);
+ virtual void change_state(unsigned int what, int enable);
+};
+
+
+#endif
+
+/* End of gui.src/groupcl.h */
diff --git a/sim/ucsim/gui.src/obsolete/label.cc b/sim/ucsim/gui.src/obsolete/label.cc
new file mode 100644
index 0000000..90c54a3
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/label.cc
@@ -0,0 +1,74 @@
+/*
+ * Simulator of microcontrollers (label.cc)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#include "ddconfig.h"
+
+#include <stdlib.h>
+#include "i_string.h"
+
+#include "labelcl.h"
+
+
+cl_label::cl_label(class cl_box *ipos, class cl_app *iapp, char *ilabel):
+ cl_view(ipos, "label", iapp)
+{
+ options&= ~OF_SELECTABLE;
+ if (!ilabel ||
+ !(*ilabel))
+ label= strdup("");
+ else
+ label= strdup(ilabel);
+}
+
+cl_label::~cl_label(void)
+{
+ free(label);
+}
+
+int *
+cl_label::mk_palette(void)
+{
+ int *p;
+
+ p= (int*)malloc(1*sizeof(int));
+ p[0]= C_WIN_NORMAL;
+ return(p);
+}
+
+int
+cl_label::draw(void)
+{
+ int color= get_color(0);
+
+ cl_view::draw();
+ wattrset(window, color);
+ mvwprintw(window, 0,0, "%s", label);
+ return(0);
+}
+
+
+/* End of gui.src/label.cc */
diff --git a/sim/ucsim/gui.src/obsolete/labelcl.h b/sim/ucsim/gui.src/obsolete/labelcl.h
new file mode 100644
index 0000000..79d6288
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/labelcl.h
@@ -0,0 +1,50 @@
+/*
+ * Simulator of microcontrollers (labelcl.h)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#ifndef LABELCL_HEADER
+#define LABELCL_HEADER
+
+
+#include "viewcl.h"
+#include "appcl.h"
+
+
+class cl_label: public cl_view
+{
+public:
+ char *label;
+public:
+ cl_label(class cl_box *ipos, class cl_app *iapp, char *ilabel);
+ ~cl_label(void);
+ virtual int *mk_palette(void);
+ virtual int draw(void);
+};
+
+
+#endif
+
+/* End of gui.src/labelcl.h */
diff --git a/sim/ucsim/gui.src/obsolete/palette.h b/sim/ucsim/gui.src/obsolete/palette.h
new file mode 100644
index 0000000..6f9d383
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/palette.h
@@ -0,0 +1,44 @@
+/*
+ * Simulator of microcontrollers (palette.h)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#ifndef PALETTE_HEADER
+#define PALETTE_HEADER
+
+
+#define C_DSK_BG 1
+#define C_DSK_NORMAL 2
+#define C_DSK_DISABLED 3
+
+#define C_WIN 8
+#define C_WIN_FPASSIVE 0
+#define C_WIN_FACTIVE 1
+#define C_WIN_NORMAL 5
+#define C_WIN_SELECTED 6
+
+#endif
+
+/* End of gui.src/palette.h */
diff --git a/sim/ucsim/gui.src/obsolete/portmon.src/(c).1 b/sim/ucsim/gui.src/obsolete/portmon.src/(c).1
new file mode 100644
index 0000000..d673f9f
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/portmon.src/(c).1
@@ -0,0 +1,25 @@
+/*
+ * Simulator of microcontrollers (@@F@@)
+ *
+ * Copyright (C) @@S@@,@@Y@@ Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
diff --git a/sim/ucsim/gui.src/obsolete/portmon.src/Makefile.in b/sim/ucsim/gui.src/obsolete/portmon.src/Makefile.in
new file mode 100644
index 0000000..0169421
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/portmon.src/Makefile.in
@@ -0,0 +1,131 @@
+#
+# uCsim gui.src/portmon.src/Makefile
+#
+# (c) Drotos Daniel, Talker Bt. 1999
+#
+
+SHELL = /bin/sh
+CXX = @CXX@
+CPP = @CPP@
+CXXCPP = @CXXCPP@
+RANLIB = @RANLIB@
+INSTALL = @INSTALL@
+MAKEDEP = @MAKEDEP
+
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+PKGDIR = ../
+
+DEFS = $(subs -DHAVE_CONFIG_H,,@DEFS@)
+CPPFLAGS = @CPPFLAGS@ -I. -I$(top_builddir) -I$(PKGDIR)
+CFLAGS = @CFLAGS@ @WALL_FLAG@
+CXXFLAGS = @CXXFLAGS@ @WALL_FLAG@
+
+LIBS = -L$(top_builddir) -L$(PKGDIR) -lgui @CURSES_LIBS@ -lutil @LIBS@
+
+curses_ok = @curses_ok@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+libdir = @libdir@
+datadir = @datadir@
+includedir = @includedir@
+mandir = @mandir@
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+infodir = @infodir@
+srcdir = @srcdir@
+
+OBJECTS = portmon.o \
+ pmapp.o port.o
+
+
+# Compiling entire program or any subproject
+# ------------------------------------------
+all: checkconf otherlibs portmon.src
+
+
+# Compiling and installing everything and runing test
+# ---------------------------------------------------
+install: all installdirs
+ $(INSTALL) -s portmon $(bindir)
+
+
+# Deleting all the installed files
+# --------------------------------
+uninstall:
+ rm -f $(bindir)/portmon
+
+
+# Performing self-test
+# --------------------
+check:
+
+
+# Performing installation test
+# ----------------------------
+installcheck:
+
+
+# Creating installation directories
+# ---------------------------------
+installdirs:
+ test -d $(bindir) || $(INSTALL) -d $(bindir)
+
+
+# Creating dependencies
+# ---------------------
+dep: Makefile.dep
+
+Makefile.dep: $(srcdir)/*.cc $(top_builddir)/*.h $(PKGDIR)/*.h
+ $(MAKEDEP) $(CPPFLAGS) $(filter %.cc,$^) >Makefile.dep
+
+-include Makefile.dep
+include clean.mk
+
+#parser.cc: parser.y
+
+#plex.cc: plex.l
+
+# My rules
+# --------
+ifeq ($(curses_ok),yes)
+portmon.src: portmon
+else
+portmon.src:
+endif
+
+portmon: $(OBJECTS) $(top_builddir)/*.a $(PKGDIR)/*.a
+ $(CXX) $(CXXFLAGS) -o portmon $(OBJECTS) $(LIBS)
+
+ifeq ($(curses_ok),yes)
+otherlibs:
+ $(MAKE) -C $(top_builddir) libs
+ $(MAKE) -C $(PKGDIR) libs
+else
+otherlibs:
+endif
+
+.cc.o:
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
+
+.y.cc:
+ rm -f $*.cc $*.h
+ $(YACC) -d $<
+ mv y.tab.c $*.cc
+ mv y.tab.h $*.h
+
+.l.cc:
+ rm -f $*.cc
+ $(LEX) -t $< >$*.cc
+
+
+# Remaking configuration
+# ----------------------
+checkconf:
+ @if [ -f $(top_builddir)/devel ]; then\
+ $(MAKE) -f conf.mk srcdir="$(srcdir)" top_builddir="$(top_builddir)" freshconf;\
+ fi
+
+# End of gui.src/portmon.src/Makefile.in
diff --git a/sim/ucsim/gui.src/obsolete/portmon.src/clean.mk b/sim/ucsim/gui.src/obsolete/portmon.src/clean.mk
new file mode 100644
index 0000000..02760e9
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/portmon.src/clean.mk
@@ -0,0 +1,28 @@
+# uCsim gui.src/portmon.src/clean.mk
+
+# Deleting all files created by building the program
+# --------------------------------------------------
+clean:
+ rm -f *core *[%~] *.[oa]
+ rm -f .[a-z]*~
+ rm -f portmon
+
+
+# Deleting all files created by configuring or building the program
+# -----------------------------------------------------------------
+distclean: clean
+ rm -f config.cache config.log config.status
+ rm -f Makefile *.dep
+
+
+# Like clean but some files may still exist
+# -----------------------------------------
+mostlyclean: clean
+
+
+# Deleting everything that can reconstructed by this Makefile. It deletes
+# everything deleted by distclean plus files created by bison, etc.
+# -----------------------------------------------------------------------
+realclean: distclean
+
+# End of gui.src/portmon.src/clean.mk
diff --git a/sim/ucsim/gui.src/obsolete/portmon.src/conf.mk b/sim/ucsim/gui.src/obsolete/portmon.src/conf.mk
new file mode 100644
index 0000000..fe3dcfe
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/portmon.src/conf.mk
@@ -0,0 +1,12 @@
+# uCsim gui.src/portmon.src/conf.mk
+
+#
+# Makefile targets to remake configuration
+#
+
+freshconf: Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_srcdir)/configure.ac
+ cd $(top_builddir) && $(SHELL) ./config.status
+
+# End of gui.src/portmon.src/conf.mk
diff --git a/sim/ucsim/gui.src/obsolete/portmon.src/pmapp.cc b/sim/ucsim/gui.src/obsolete/portmon.src/pmapp.cc
new file mode 100644
index 0000000..2605a22
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/portmon.src/pmapp.cc
@@ -0,0 +1,113 @@
+/*
+ * Simulator of microcontrollers (pmapp.cc)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#include "wincl.h"
+#include "labelcl.h"
+
+#include "pmappcl.h"
+#include "portcl.h"
+
+
+int
+cl_pmapp::mk_views(class cl_group *ins_to)
+{
+ class cl_view *v;
+ //class cl_win *w;
+ class cl_box *b;
+
+ b= new cl_box(0,0,0,0);
+
+ if (!ins_to)
+ return(0);
+
+ b->set(43,2,14,13);
+ v= new cl_portw(b, 3, "Port #3", this);
+ v->init();
+ ins_to->insert(v);
+
+ b->set(29,2,14,13);
+ v= new cl_portw(b, 2, "Port #2", this);
+ v->init();
+ ins_to->insert(v);
+ /*
+ b->set(15,2,14,13);
+ ins_to->insert(v= new cl_portw(b, 1, "Port #1", this));
+ v->init();
+
+ b->set(1,2,14,13);
+ ins_to->insert(v= new cl_portw(b, 0, "Port #0", this));
+ v->init();
+
+ b->set(59,3,19,11);
+ v= new cl_label(b, this,
+"Next win: n,TAB\nPrev win: p\nCursor : u,d,l,r,\n arrows\nToggle : space,CR\nQuit : q");
+ v->init();
+ b->move_rel(-1,-1);
+ b->grow(2,2);
+
+ b->set(58,2,21,13);
+ w= new cl_win(b, "Help", this);
+ w->options&= ~OF_SELECTABLE;
+ w->init();
+ w->insert(v);
+ ins_to->insert(w);
+ w->draw();
+ */
+ delete b;
+
+ return(0);
+}
+
+int *
+cl_pmapp::mk_palette(void)
+{
+ return(cl_app::mk_palette());
+}
+
+int
+cl_pmapp::handle_event(struct t_event *event)
+{
+ if (event->what == EV_KEY)
+ switch (event->event.key)
+ {
+ case 'q':
+ event->what= EV_COMMAND;
+ event->event.msg.cmd= CMD_QUIT;
+ return(0);
+ case 'p':
+ desk->select_prev();
+ return(1);
+ case 'n': case '\t':
+ desk->select_next();
+ return(1);
+
+ }
+ return(cl_app::handle_event(event));
+}
+
+
+/* End of gui.src/portmon.src/pmapp.cc */
diff --git a/sim/ucsim/gui.src/obsolete/portmon.src/pmappcl.h b/sim/ucsim/gui.src/obsolete/portmon.src/pmappcl.h
new file mode 100644
index 0000000..d9f3011
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/portmon.src/pmappcl.h
@@ -0,0 +1,48 @@
+/*
+ * Simulator of microcontrollers (pmappcl.h)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#ifndef PMAPPCL_HEADER
+#define PMAPPCL_HEADER
+
+#include "appcl.h"
+
+
+class cl_pmapp: public cl_app
+{
+public:
+ cl_pmapp(char *iname): cl_app(iname) {}
+
+ virtual int mk_views(class cl_group *ins_to);
+ virtual int *mk_palette(void);
+
+ virtual int handle_event(struct t_event *event);
+};
+
+
+#endif
+
+/* End of gui.src/portmon.src/pmappcl.h */
diff --git a/sim/ucsim/gui.src/obsolete/portmon.src/port.cc b/sim/ucsim/gui.src/obsolete/portmon.src/port.cc
new file mode 100644
index 0000000..010ec3e
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/portmon.src/port.cc
@@ -0,0 +1,143 @@
+/*@1@*/
+
+#include "portcl.h"
+
+
+/*
+ * Viewer of the port
+ */
+
+cl_port::cl_port(class cl_box *ipos, int iid, char *iname, class cl_app *iapp):
+ cl_view(ipos, iname, iapp)
+{
+ id= iid;
+ sfr= 0;
+ pin= 0;
+ curs_x= curs_y= 0;
+}
+
+int
+cl_port::draw(void)
+{
+ int x, y, mask, hc, nc;
+
+ cl_view::draw();
+
+ nc= hc= get_color(C_WIN_NORMAL);
+ if (state & SF_SELECTED)
+ hc= get_color(C_WIN_SELECTED);
+ mvwprintw(window, 0,0, "SFR PORT PIN");
+ for (x= 0, mask= 0x80, y= 1; mask; mask>>= 1,y++)
+ {
+ wattrset(window, (curs_x)?nc:(curs_y==y-1?hc:nc));
+ mvwprintw(window, y,x, " %c", (sfr&mask)?'1':'0');
+ }
+ wattrset(window, nc);
+ for (x= 5, mask= 0x80, y= 1; mask; mask>>= 1,y++)
+ mvwprintw(window, y,x, "%c", (sfr&pin&mask)?'1':'0');
+ for (x=9, mask= 0x80, y= 1; mask; mask>>= 1,y++)
+ {
+ wattrset(window, curs_x?(curs_y==y-1?hc:nc):nc);
+ mvwprintw(window, y,x, "%c ", (pin&mask)?'1':'0');
+ }
+ wattrset(window, nc);
+ mvwprintw(window, 9,0, "0x%02x 0x%02x", sfr, pin);
+ mvwprintw(window, 10,4, "0x%02x", sfr&pin);
+ app->drawn++;
+ return(0);
+}
+
+int
+cl_port::handle_event(struct t_event *event)
+{
+ if (event->what == EV_KEY)
+ switch (event->event.key)
+ {
+ case KEY_HOME:
+ curs_y= 0; draw(); return(1);
+ case KEY_A1:
+ curs_x= curs_y= 0; draw(); return(1);
+ case KEY_A3:
+ curs_y= 0; curs_x= 1; draw(); return(1);
+ case KEY_C1:
+ curs_x= 0; curs_y= 7; draw(); return(1);
+ case KEY_C3:
+ curs_x= 1; curs_y= 7; draw(); return(1);
+ case KEY_LEFT: case KEY_RIGHT: case 'j': case 'k': case 'l': case 'r':
+ if (curs_x)
+ curs_x= 0;
+ else
+ curs_x= 1;
+ draw();
+ return(1);
+ case KEY_UP: case 'u':
+ curs_y--;
+ if (curs_y < 0)
+ curs_y= 7;
+ draw();
+ return(1);
+ case KEY_DOWN: case 'd':
+ curs_y++;
+ if (curs_y > 7)
+ curs_y= 0;
+ draw();
+ return(1);
+ case ' ': case '\n': case '\r':
+ if (curs_x)
+ toggle_pin(7-curs_y);
+ else
+ toggle_sfr(7-curs_y);
+ return(1);
+ }
+ return(cl_view::handle_event(event));
+}
+
+int
+cl_port::toggle_sfr(int bitnr)
+{
+ int mask= 1<<bitnr;
+ sfr^= mask;
+ draw();
+ return(0);
+}
+
+int
+cl_port::toggle_pin(int bitnr)
+{
+ int mask= 1<<bitnr;
+ pin^= mask;
+ draw();
+ return(0);
+}
+
+/*
+ * Window to show port viewer
+ ******************************************************************************
+ */
+
+cl_portw::cl_portw(class cl_box *ipos, int iid, char *ititle,
+ class cl_app *iapp):
+ cl_win(ipos, ititle, iapp)
+{
+ id= iid;
+}
+
+class cl_view *
+cl_portw::mk_intern(class cl_box *ipos)
+{
+ char n[100]= "";
+
+ sprintf(n, "port%dviewer", id);
+ class cl_view *v= new cl_port(ipos, id, n, app);
+ v->init();
+ return(v);
+}
+
+int
+cl_portw::handle_event(struct t_event *event)
+{
+ return(cl_win::handle_event(event));
+}
+
+
+/* End of gui.src/portmap.src/port.cc */
diff --git a/sim/ucsim/gui.src/obsolete/portmon.src/portcl.h b/sim/ucsim/gui.src/obsolete/portmon.src/portcl.h
new file mode 100644
index 0000000..760f0ad
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/portmon.src/portcl.h
@@ -0,0 +1,64 @@
+/*
+ * Simulator of microcontrollers (portcl.h)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#ifndef PORTCL_HEADER
+#define PORTCL_HEADER
+
+#include "viewcl.h"
+#include "wincl.h"
+
+
+class cl_port: public cl_view
+{
+public:
+ int id;
+ int sfr, pin;
+ int curs_x, curs_y;
+public:
+ cl_port(class cl_box *ipos, int iid, char *iname, class cl_app *iapp);
+
+ virtual int draw(void);
+ virtual int handle_event(struct t_event *event);
+ int toggle_sfr(int bitnr);
+ int toggle_pin(int bitnr);
+};
+
+class cl_portw: public cl_win
+{
+public:
+ int id;
+public:
+ cl_portw(class cl_box *ipos, int iid, char *ititle, class cl_app *iapp);
+ virtual class cl_view *mk_intern(class cl_box *ipos);
+
+ virtual int handle_event(struct t_event *event);
+};
+
+
+#endif
+
+/* End of gui.src/portmon.src/portcl.h */
diff --git a/sim/ucsim/gui.src/obsolete/portmon.src/portmon.cc b/sim/ucsim/gui.src/obsolete/portmon.src/portmon.cc
new file mode 100644
index 0000000..50d3b3a
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/portmon.src/portmon.cc
@@ -0,0 +1,68 @@
+/*
+ * Simulator of microcontrollers (portmon.cc)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#include <curses.h>
+
+#include "pmappcl.h"
+
+
+class cl_pmapp *app;
+
+void xx(class cl_view *v)
+{
+ fprintf(stderr,"%s 0x%x ", v->name, v->state);
+}
+
+int
+main(int argc, char *argv)
+{
+ app= new cl_pmapp("portmon");
+ app->init();
+ {
+ class cl_view *v= app;
+ while (v)
+ {
+ if (v->is_group())
+ {
+ class cl_group *g= (class cl_group *)v;
+ fprintf(stderr, "%s->%s\n", g->name,(g->current)?(g->current->name):"none");
+ g->for_each(xx);
+ fprintf(stderr, "\n");
+ v= g->current;
+ }
+ else
+ v= 0;
+ }
+ }
+ app->run();
+ //getch();
+ delete app;
+ return(0);
+}
+
+
+/* End of gui.src/portmon.src/portmon.cc */
diff --git a/sim/ucsim/gui.src/obsolete/view.cc b/sim/ucsim/gui.src/obsolete/view.cc
new file mode 100644
index 0000000..9ead6f4
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/view.cc
@@ -0,0 +1,356 @@
+/*
+ * Simulator of microcontrollers (view.cc)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#include "ddconfig.h"
+
+#include <stdlib.h>
+#include "i_string.h"
+
+#include "appcl.h"
+
+
+/*
+ * Box
+ */
+
+cl_box::cl_box(int ix, int iy, int iw, int ih):
+ cl_base()
+{
+ x= ix;
+ y= iy;
+ w= iw;
+ h= ih;
+}
+
+void
+cl_box::set(int ix, int iy, int iw, int ih)
+{
+ x= ix;
+ y= iy;
+ w= iw;
+ h= ih;
+}
+
+void
+cl_box::move_rel(int dx, int dy)
+{
+ x+= dx;
+ y+= dy;
+}
+
+void
+cl_box::grow(int dw, int dh)
+{
+ w+= dw;
+ h+= dh;
+}
+
+
+/*
+ * Astbract of a viewer
+ ******************************************************************************
+ */
+
+cl_view::cl_view(class cl_box *ipos, char *iname, class cl_app *iapp):
+ cl_base()
+{
+ pos= new cl_box(ipos->x,ipos->y, ipos->w,ipos->h);
+ if ((window= newwin(pos->h,pos->w, pos->y,pos->x)))
+ {
+ leaveok(window, TRUE);
+ panel= new_panel(window);
+ }
+ else
+ {
+ panel= 0;
+ delwin(window);
+ window= 0;
+ }
+ parent= 0;
+ next= last= 0;
+ app= iapp;
+ state= SF_NOTHING;
+ options= OF_SELECTABLE;
+ if (!iname ||
+ !(*iname))
+ {
+ name= (char*)malloc(100);
+ sprintf(name, "view%p", this);
+ }
+ else
+ name= strdup(iname);
+}
+
+cl_view::cl_view(char *iname, class cl_app *iapp):
+ cl_base()
+{
+ window= 0;
+ panel= 0;
+ parent= 0;
+ next= last= 0;
+ app= iapp;
+ state= SF_NOTHING;
+ options= OF_SELECTABLE;
+ if (!iname ||
+ !(*iname))
+ {
+ name= (char*)malloc(100);
+ sprintf(name, "view%p", this);
+ }
+ else
+ name= strdup(iname);
+}
+
+cl_view::~cl_view(void)
+{
+ if (panel)
+ del_panel(panel);
+ if (window)
+ delwin(window);
+ if (palette)
+ free(palette);
+ if (name)
+ free(name);
+}
+
+int
+cl_view::init(void)
+{
+ input= mk_input();
+ palette= mk_palette();
+ //draw();
+ return(0);
+}
+
+class cl_gin *
+cl_view::mk_input(void)
+{
+ return(0);
+}
+
+int *
+cl_view::mk_palette(void)
+{
+ return(0);
+}
+
+int
+cl_view::ok(void)
+{
+ return(window && panel);
+}
+
+
+/*
+ * Make output into the view
+ */
+
+int
+cl_view::draw(void)
+{
+ int color, x, y;
+
+ color= get_color(palette?0:C_WIN_NORMAL);
+
+ wattrset(window, color);
+ for (y= 0; y < pos->h; y++)
+ for (x= 0; x < pos->w; x++)
+ mvwaddch(window, y,x, ' ');
+ app->drawn++;
+
+ return(0);
+}
+
+int
+cl_view::update(void)
+{
+ draw();
+ update_panels();
+ doupdate();
+ return(0);
+}
+
+int
+cl_view::get_color(int color)
+{
+ int *p;
+ class cl_view *v;
+
+ v= this;
+ while (v)
+ {
+ p= v->get_palette();
+ if (p)
+ color= p[color];
+ v= v->parent;
+ }
+ return(color);
+}
+
+int *
+cl_view::get_palette(void)
+{
+ return(palette);
+}
+
+
+/*
+ * Event handling
+ */
+
+int
+cl_view::get_event(struct t_event *event)
+{
+ if (parent)
+ return(parent->get_event(event));
+ if (input)
+ return(input->get_event(event));
+ return(0);
+}
+
+int
+cl_view::handle_event(struct t_event *event)
+{
+ return(0);
+}
+
+int
+cl_view::unhandled(struct t_event *event)
+{
+ return(0);
+}
+
+int
+cl_view::mk_event(struct t_event *event, FILE *f, int key)
+{
+ event->what= EV_KEY;
+ event->event.key= key;
+ return(1);
+}
+
+
+class cl_view *
+cl_view::prev(void)
+{
+ class cl_view *v;
+
+ v= next;
+ while (v != this)
+ v= v->next;
+ return(v);
+}
+
+class cl_view *
+cl_view::prev_view(void)
+{
+ if (parent &&
+ parent->first() == this)
+ return(0);
+ else
+ return(prev());
+}
+
+
+int
+cl_view::select(void)
+{
+ /* class cl_view *v;
+
+ if (!(options & OF_SELECTABLE))
+ return(0);
+ if (state & SF_SELECTED)
+ return(1);
+ if (parent &&
+ !(parent->select()))
+ return(0);
+ if (parent)
+ {
+ v= parent->current_sub_view();
+ if (v &&
+ v != this)
+ v->unselect();
+ parent->set_current(this);
+ }
+ change_state(SF_FOCUSED, 1);
+ change_state(SF_SELECTED, 1);
+ draw();
+ return(1);*/
+ if (options & OF_SELECTABLE)
+ if (parent)
+ parent->set_current(this);
+ return(1);
+}
+
+int
+cl_view::unselect(void)
+{
+ class cl_view *csv= current_sub_view();
+ if (csv &&
+ !(csv->unselect()))
+ return(0);
+ if (!terminal_view())
+ change_state(SF_FOCUSED, 0);
+ change_state(SF_SELECTED, 0);
+ draw();
+ return(1);
+}
+
+class cl_view *
+cl_view::current_sub_view(void)
+{
+ return(0);
+}
+
+int
+cl_view::terminal_view(void)
+{
+ return(1);
+}
+
+void
+cl_view::change_state(unsigned int what, int enable)
+{
+ if (enable)
+ state|= what;
+ else
+ state&= ~what;
+ if (parent)
+ {
+ switch (what)
+ {
+ case SF_FOCUSED:
+ //reset_cursor();
+ /*message(parent, EV_BROADCAST,
+ (enable)?CM_RECEIVED_FOCUS:CM_RELEASED_FOCUS, this);*/
+ break;
+ }
+ }
+ draw();
+}
+
+
+/* End of gui.src/view.cc */
diff --git a/sim/ucsim/gui.src/obsolete/viewcl.h b/sim/ucsim/gui.src/obsolete/viewcl.h
new file mode 100644
index 0000000..668fee1
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/viewcl.h
@@ -0,0 +1,118 @@
+/*
+ * Simulator of microcontrollers (viewcl.h)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#ifndef VIEWCL_HEADER
+#define VIEWCL_HEADER
+
+#include <curses.h>
+#include <panel.h>
+
+#include "pobjcl.h"
+
+#include "palette.h"
+#include "eventcl.h"
+
+
+// Status flags
+#define SF_NOTHING 0x0000
+#define SF_SELECTED 0x0001
+#define SF_FOCUSED 0x0002
+#define SF_ACTIVE 0x0004
+
+// Option flags
+#define OF_NOTHING 0x0000
+#define OF_SELECTABLE 0x0001
+
+
+class cl_box: public cl_base
+{
+public:
+ int x, y;
+ int w, h;
+public:
+ cl_box(int ix, int iy, int iw, int ih);
+ void set(int ix, int iy, int iw, int ih);
+ void move_rel(int dx, int dy);
+ void grow(int dw, int dh);
+};
+
+
+class cl_app;
+class cl_group;
+
+class cl_view: public cl_base
+{
+public:
+ char *name;
+ WINDOW *window;
+ PANEL *panel;
+ class cl_group *parent;
+ class cl_view *next, *last;
+ class cl_app *app;
+ class cl_gin *input;
+ class cl_box *pos;
+ int *palette;
+ unsigned int state; // See SF_XXXX
+ unsigned int options; // See OF_XXXX
+public:
+ cl_view(class cl_box *ipos, char *iname, class cl_app *iapp);
+ cl_view(char *name, class cl_app *iapp);
+ ~cl_view(void);
+ virtual int init(void);
+ virtual class cl_gin *mk_input(void);
+ virtual int *mk_palette(void);
+ virtual int is_group(void) {return(0);}
+
+ virtual int ok(void);
+ virtual int draw(void);
+ virtual int update(void);
+ virtual int get_color(int color);
+ virtual int *get_palette(void);
+
+ virtual int get_event(struct t_event *event);
+ virtual int handle_event(struct t_event *event);
+ virtual int unhandled(struct t_event *event);
+ virtual int mk_event(struct t_event *event, FILE *f, int key);
+
+ virtual class cl_view *prev(void);
+ virtual class cl_view *prev_view(void);
+
+ virtual int select(void);
+ virtual int unselect(void);
+ virtual class cl_view *get_by_state(unsigned int what, int enabled)
+ {return(0);}
+ virtual int select_next() {return(0);}
+ virtual class cl_view *current_sub_view(void);
+ virtual void set_current(class cl_view *view) {}
+ virtual int terminal_view(void);
+ virtual void change_state(unsigned int what, int enable);
+};
+
+
+#endif
+
+/* End of gui.src/viewcl.h */
diff --git a/sim/ucsim/gui.src/obsolete/win.cc b/sim/ucsim/gui.src/obsolete/win.cc
new file mode 100644
index 0000000..b5a9a92
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/win.cc
@@ -0,0 +1,111 @@
+/*
+ * Simulator of microcontrollers (win.cc)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#include "ddconfig.h"
+
+#include <stdlib.h>
+#include "i_string.h"
+
+#include "wincl.h"
+
+
+cl_win::cl_win(class cl_box *ipos, char *ititle, class cl_app *iapp):
+ cl_group(ipos, 0, iapp)
+{
+ title= strdup(ititle);
+ free(name);
+ if (!ititle ||
+ !(*ititle))
+ {
+ name= (char*)malloc(100);
+ sprintf(name, "win%p", this);
+ }
+ else
+ name= strdup(ititle);
+}
+
+cl_win::~cl_win(void)
+{
+ if (frame)
+ delete frame;
+ if (title)
+ free(title);
+}
+
+int
+cl_win::init(void)
+{
+ cl_group::init();
+ if ((frame= mk_frame(pos)))
+ insert(frame);
+ class cl_box *b= new cl_box(pos->x,pos->y, pos->w,pos->h);
+ b->move_rel(1,1);
+ b->grow(-2,-2);
+ if ((intern= mk_intern(b)))
+ insert(intern);
+ //draw();
+ delete b;
+ return(0);
+}
+
+int *
+cl_win::mk_palette(void)
+{
+ int *p= (int*)malloc(8*sizeof(int)), i;
+ for (i= 0; i < 8; i++)
+ p[i]= i+C_WIN;
+ return(p);
+}
+
+class cl_frame *
+cl_win::mk_frame(class cl_box *ipos)
+{
+ char n[100]= "";
+
+ sprintf(n, "frameof_\"%s\"", name);
+ class cl_frame *f= new cl_frame(ipos, this, n, app);
+ f->init();
+ return(f);
+}
+
+class cl_view *
+cl_win::mk_intern(class cl_box *ipos)
+{
+ class cl_view *v= new cl_view(ipos, 0, app);
+ v->init();
+ v->options&= ~OF_SELECTABLE;
+ return(v);
+}
+
+char *
+cl_win::get_title(void)
+{
+ return(title);
+}
+
+
+/* End of gui.src/win.cc */
diff --git a/sim/ucsim/gui.src/obsolete/wincl.h b/sim/ucsim/gui.src/obsolete/wincl.h
new file mode 100644
index 0000000..ddbd0a9
--- /dev/null
+++ b/sim/ucsim/gui.src/obsolete/wincl.h
@@ -0,0 +1,55 @@
+/*
+ * Simulator of microcontrollers (wincl.h)
+ *
+ * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#ifndef WINCL_HEADER
+#define WINCL_HEADER
+
+#include "groupcl.h"
+#include "framecl.h"
+
+
+class cl_win: public cl_group
+{
+public:
+ class cl_view *frame;
+ class cl_view *intern;
+ char *title;
+public:
+ cl_win(class cl_box *ipos, char *ititle, class cl_app *iapp);
+ ~cl_win(void);
+ virtual int init(void);
+ virtual int *mk_palette(void);
+ virtual class cl_frame *mk_frame(class cl_box *ipos);
+ virtual class cl_view *mk_intern(class cl_box *ipos);
+
+ virtual char *get_title(void);
+};
+
+
+#endif
+
+/* End of gui.src/wincl.h */
diff --git a/sim/ucsim/gui.src/rec.cc b/sim/ucsim/gui.src/rec.cc
new file mode 100644
index 0000000..dce2efa
--- /dev/null
+++ b/sim/ucsim/gui.src/rec.cc
@@ -0,0 +1,31 @@
+/*
+ * Simulator of microcontrollers (rec.cc)
+ *
+ * Copyright (C) 2001,01 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#include "reccl.h"
+
+
+/* End of gui.src/rec.cc */
diff --git a/sim/ucsim/gui.src/rec.o b/sim/ucsim/gui.src/rec.o
new file mode 100644
index 0000000..913271f
--- /dev/null
+++ b/sim/ucsim/gui.src/rec.o
Binary files differ
diff --git a/sim/ucsim/gui.src/reccl.h b/sim/ucsim/gui.src/reccl.h
new file mode 100644
index 0000000..4ead68b
--- /dev/null
+++ b/sim/ucsim/gui.src/reccl.h
@@ -0,0 +1,38 @@
+/*
+ * Simulator of microcontrollers (reccl.h)
+ *
+ * Copyright (C) 2001,01 Drotos Daniel, Talker Bt.
+ *
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM 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.
+
+UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#ifndef GUISRC_RECCL_HEADER
+#define GUISRC_RECCL_HEADER
+
+#include "ddconfig.h"
+
+#include "pobjcl.h"
+
+
+#endif
+
+/* End of gui.src/reccl.h */
diff --git a/sim/ucsim/gui.src/serio.src/Makefile b/sim/ucsim/gui.src/serio.src/Makefile
new file mode 100644
index 0000000..f92f471
--- /dev/null
+++ b/sim/ucsim/gui.src/serio.src/Makefile
@@ -0,0 +1,114 @@
+# Makefile for kano-networks talker
+
+SHELL = /bin/sh
+CXX = g++
+CXXCPP = g++ -E
+INSTALL = /usr/bin/install -c
+STRIP = strip
+CP = /bin/cp
+MAKEDEP = g++ -MM
+
+top_builddir = ../..
+top_srcdir = ../..
+
+DEFS = $(subs -DHAVE_CONFIG_H,,-DHAVE_CONFIG_H)
+CPPFLAGS = -I. -I$(top_builddir)
+# -I$(top_builddir)/cmd.src -I$(top_builddir)/sim.src
+CFLAGS = -g -O2 -Wall
+CXXFLAGS = -g -O2 -g -Wall
+
+LIBS = -lpanel -lcurses -lrt -lnsl
+
+EXEEXT =
+
+curses_ok = yes
+
+prefix = /usr/local
+exec_prefix = ${prefix}
+bindir = ${exec_prefix}/bin
+libdir = ${exec_prefix}/lib
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+includedir = ${prefix}/include
+mandir = ${datarootdir}/man
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+infodir = ${datarootdir}/info
+srcdir = .
+
+
+OBJECTS = main.o fileio.o frontend.o posix_signal.o
+
+
+# Compiling entire program or any subproject
+# ------------------------------------------
+all: serio.src
+
+ifeq ($(curses_ok),yes)
+serio.src: checkconf serialview$(EXEEXT)
+else
+serio.src: checkconf
+endif
+
+
+# Compiling and installing everything and runing test
+# ---------------------------------------------------
+install: all installdirs
+ $(INSTALL) serialview$(EXEEXT) $(DESTDIR)$(bindir)/serialview$(EXEEXT)
+ $(STRIP) $(DESTDIR)$(bindir)/serialview$(EXEEXT)
+
+
+# Deleting all the installed files
+# --------------------------------
+uninstall:
+ rm -f $(DESTDIR)$(bindir)/serialview$(EXEEXT)
+
+
+# Performing self-test
+# --------------------
+check:
+
+test:
+
+
+# Performing installation test
+# ----------------------------
+installcheck:
+
+
+# Creating installation directories
+# ---------------------------------
+installdirs:
+ test -d $(DESTDIR)$(bindir) || $(INSTALL) -d $(DESTDIR)$(bindir)
+
+
+# Creating dependencies
+# ---------------------
+dep: Makefile.dep
+
+Makefile.dep: $(srcdir)/*.cc $(srcdir)/*.h $(srcdir)/*.hh
+ $(MAKEDEP) $(CPPFLAGS) $(filter %.cc,$^) >Makefile.dep
+
+ifeq "$(findstring $(MAKECMDGOALS),uninstall installcheck installdirs checkconf \
+ clean distclean mostlyclean realclean)" ""
+ -include Makefile.dep
+endif
+include $(srcdir)/clean.mk
+
+
+# My rules
+# --------
+serialview$(EXEEXT): $(OBJECTS)
+ $(CXX) -o $@ $(LDFLAGS) $(OBJECTS) $(LIBS)
+
+.cc.o:
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
+
+# Remaking configuration
+# ----------------------
+checkconf:
+ @if [ -f $(top_builddir)/devel ]; then\
+ $(MAKE) -f conf.mk srcdir="$(srcdir)" top_builddir="$(top_builddir)" top_srcdir=$(top_srcdir) freshconf;\
+ fi
+
+# End of gui.src/serio.src/Makefile.in
diff --git a/sim/ucsim/gui.src/serio.src/Makefile.in b/sim/ucsim/gui.src/serio.src/Makefile.in
new file mode 100644
index 0000000..78a7790
--- /dev/null
+++ b/sim/ucsim/gui.src/serio.src/Makefile.in
@@ -0,0 +1,114 @@
+# Makefile for kano-networks talker
+
+SHELL = /bin/sh
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+INSTALL = @INSTALL@
+STRIP = @STRIP@
+CP = /bin/cp
+MAKEDEP = @MAKEDEP@
+
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+DEFS = $(subs -DHAVE_CONFIG_H,,@DEFS@)
+CPPFLAGS = @CPPFLAGS@ -I. -I$(top_builddir)
+# -I$(top_builddir)/cmd.src -I$(top_builddir)/sim.src
+CFLAGS = @CFLAGS@ @WALL_FLAG@
+CXXFLAGS = @CXXFLAGS@ @WALL_FLAG@
+
+LIBS = @CURSES_LIBS@ @LIBS@
+
+EXEEXT = @EXEEXT@
+
+curses_ok = @curses_ok@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+libdir = @libdir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+includedir = @includedir@
+mandir = @mandir@
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+infodir = @infodir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+OBJECTS = main.o fileio.o frontend.o posix_signal.o
+
+
+# Compiling entire program or any subproject
+# ------------------------------------------
+all: serio.src
+
+ifeq ($(curses_ok),yes)
+serio.src: checkconf serialview$(EXEEXT)
+else
+serio.src: checkconf
+endif
+
+
+# Compiling and installing everything and runing test
+# ---------------------------------------------------
+install: all installdirs
+ $(INSTALL) serialview$(EXEEXT) $(DESTDIR)$(bindir)/serialview$(EXEEXT)
+ $(STRIP) $(DESTDIR)$(bindir)/serialview$(EXEEXT)
+
+
+# Deleting all the installed files
+# --------------------------------
+uninstall:
+ rm -f $(DESTDIR)$(bindir)/serialview$(EXEEXT)
+
+
+# Performing self-test
+# --------------------
+check:
+
+test:
+
+
+# Performing installation test
+# ----------------------------
+installcheck:
+
+
+# Creating installation directories
+# ---------------------------------
+installdirs:
+ test -d $(DESTDIR)$(bindir) || $(INSTALL) -d $(DESTDIR)$(bindir)
+
+
+# Creating dependencies
+# ---------------------
+dep: Makefile.dep
+
+Makefile.dep: $(srcdir)/*.cc $(srcdir)/*.h $(srcdir)/*.hh
+ $(MAKEDEP) $(CPPFLAGS) $(filter %.cc,$^) >Makefile.dep
+
+ifeq "$(findstring $(MAKECMDGOALS),uninstall installcheck installdirs checkconf \
+ clean distclean mostlyclean realclean)" ""
+ -include Makefile.dep
+endif
+include $(srcdir)/clean.mk
+
+
+# My rules
+# --------
+serialview$(EXEEXT): $(OBJECTS)
+ $(CXX) -o $@ $(LDFLAGS) $(OBJECTS) $(LIBS)
+
+.cc.o:
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
+
+# Remaking configuration
+# ----------------------
+checkconf:
+ @if [ -f $(top_builddir)/devel ]; then\
+ $(MAKE) -f conf.mk srcdir="$(srcdir)" top_builddir="$(top_builddir)" top_srcdir=$(top_srcdir) freshconf;\
+ fi
+
+# End of gui.src/serio.src/Makefile.in
diff --git a/sim/ucsim/gui.src/serio.src/USAGE b/sim/ucsim/gui.src/serio.src/USAGE
new file mode 100644
index 0000000..a76e65e
--- /dev/null
+++ b/sim/ucsim/gui.src/serio.src/USAGE
@@ -0,0 +1,9 @@
+*note: tested on:
+Solaris 7 using gcc version 2.95.1 19990816 (release)
+with ncurses
+should work with curses although not guranteed
+
+Start serialview
+Start the s51 simulator with the following command line options:
+-S out=/tmp/out,in=/tmp/in
+or whatever pipes you wish to use
diff --git a/sim/ucsim/gui.src/serio.src/clean.mk b/sim/ucsim/gui.src/serio.src/clean.mk
new file mode 100644
index 0000000..f50d8c6
--- /dev/null
+++ b/sim/ucsim/gui.src/serio.src/clean.mk
@@ -0,0 +1,28 @@
+# uCsim gui.src/serio.src/clean.mk
+
+# Deleting all files created by building the program
+# --------------------------------------------------
+clean:
+ rm -f *core *[%~] *.[oa]
+ rm -f .[a-z]*~
+ rm -f serialview$(EXEEXT)
+
+
+# Deleting all files created by configuring or building the program
+# -----------------------------------------------------------------
+distclean: clean
+ rm -f config.cache config.log config.status
+ rm -f Makefile *.dep
+
+
+# Like clean but some files may still exist
+# -----------------------------------------
+mostlyclean: clean
+
+
+# Deleting everything that can reconstructed by this Makefile. It deletes
+# everything deleted by distclean plus files created by bison, etc.
+# -----------------------------------------------------------------------
+realclean: distclean
+
+# End of gui.src/serio.src/clean.mk
diff --git a/sim/ucsim/gui.src/serio.src/conf.mk b/sim/ucsim/gui.src/serio.src/conf.mk
new file mode 100644
index 0000000..25e3b04
--- /dev/null
+++ b/sim/ucsim/gui.src/serio.src/conf.mk
@@ -0,0 +1,12 @@
+# uCsim gui.src/serio.src/conf.mk
+
+#
+# Makefile targets to remake configuration
+#
+
+freshconf: Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_srcdir)/configure.ac
+ cd $(top_builddir) && $(SHELL) ./config.status
+
+# End of gui.src/serio.src/conf.mk
diff --git a/sim/ucsim/gui.src/serio.src/config.h b/sim/ucsim/gui.src/serio.src/config.h
new file mode 100644
index 0000000..3fef045
--- /dev/null
+++ b/sim/ucsim/gui.src/serio.src/config.h
@@ -0,0 +1,20 @@
+/******************************************************************************
+ * to emulate the serial input and output of an 8051 controller *
+ * config.h - general defintions *
+ ******************************************************************************/
+#ifndef CONFIG_HEADER
+#define CONFIG_HEADER
+
+#ifndef DEF_INFILE
+// the processors serial output
+#define DEF_INFILE "/tmp/out"
+#endif
+
+#ifndef DEF_OUTFILE
+// the processors serial input
+#define DEF_OUTFILE "/tmp/in"
+#endif
+
+#define MAX_SIZ 1024
+
+#endif
diff --git a/sim/ucsim/gui.src/serio.src/fileio.cc b/sim/ucsim/gui.src/serio.src/fileio.cc
new file mode 100644
index 0000000..5f7e6fa
--- /dev/null
+++ b/sim/ucsim/gui.src/serio.src/fileio.cc
@@ -0,0 +1,143 @@
+/******************************************************************************
+ * to emulate the serial input and output of an 8051 controller *
+ * fileio.cc - file input and output *
+ ******************************************************************************/
+#include <sys/types.h>
+#include <iostream>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include "fileio.hh"
+
+FileIO::FileIO()
+{
+
+ // make the input fifo
+ if(mkfifo(DEF_INFILE, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) == -1) {
+ if(errno != EEXIST) {
+ std::cerr << "mkfifo(): Error number " << errno << " occourred: " << strerror(errno) << "\n";
+ exit(-1);
+ }
+ }
+
+ // the input fifo - non blocking
+ if ((fdin = open(DEF_INFILE, O_RDONLY|O_NONBLOCK)) == -1) {
+ std::cerr << "open(): Error number " << errno << " occourred: " << strerror(errno) << "\n";
+ exit(-1);
+ }
+
+ // make the output fifo
+ if(mkfifo(DEF_OUTFILE, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) == -1) {
+ if(errno != EEXIST) {
+ std::cerr << "mkfifo(): Error number " << errno << " occourred: " << strerror(errno) << "\n";
+ exit(-1);
+ }
+ }
+
+ // the output fifo
+ if ((fdout = open(DEF_OUTFILE, O_RDWR|O_NONBLOCK)) == -1) {
+ std::cerr << "open(): Error number " << errno << " occourred: " << strerror(errno) << "\n";
+ exit(-1);
+ }
+}
+
+FileIO::FileIO(const char *infile, const char *outfile)
+{
+ // make the input fifo
+ if(mkfifo(infile, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) == -1) {
+ if(errno != EEXIST) {
+ std::cerr << "mkfifo(): Error number " << errno << " occourred: " << strerror(errno);
+ exit(-1);
+ }
+ }
+
+ // the input fifo - non blocking
+ if ((fdin = open(infile, O_RDONLY|O_NONBLOCK)) == -1) {
+ std::cerr << "open(): Error number " << errno << " occourred: " << strerror(errno);
+ exit(-1);
+ }
+
+ // make the output fifo
+ if(mkfifo(outfile, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) == -1) {
+ if(errno != EEXIST) {
+ std::cerr << "mkfifo(): Error number " << errno << " occourred: " << strerror(errno);
+ exit(-1);
+ }
+ }
+
+ // the output fifo
+ if ((fdout = open(outfile, O_RDWR|O_NONBLOCK)) == -1) {
+ std::cerr << "open(): Error number " << errno << " occourred: " << strerror(errno);
+ exit(-1);
+ }
+}
+
+
+FileIO::~FileIO()
+{
+ close(fdin);
+ close(fdout);
+}
+
+int FileIO::SendByte(char b)
+{
+ int ret;
+
+ if((ret = write(fdout, &b, 1)) != 1)
+ {
+ std::cerr << "write(): Error number " << errno << " occourred: " << strerror(errno);
+ exit(-1);
+ }
+
+ return(ret);
+}
+
+
+int FileIO::RecvByte(char *b)
+{
+ int ret;
+
+ ret = read(fdin, b, 1);
+
+ if((ret == -1) && (errno != EAGAIN))
+ {
+ std::cerr << "read(): Error number " << errno << " occourred: " << strerror(errno);
+ exit(-1);
+ }
+
+ return(ret);
+}
+
+// send a string
+int FileIO::SendStr(char *str)
+{
+ int ret;
+
+ if((ret = write(fdout, str, strlen(str))) != (int)strlen(str))
+ {
+ std::cerr << "write(): Error number " << errno << " occourred: " << strerror(errno);
+ exit(-1);
+ }
+
+ return(ret);
+}
+
+
+int FileIO::RecvStr(char *str)
+{
+ int ret;
+
+ ret = read(fdin, str, MAX_SIZ-1);
+ str[MAX_SIZ] = 0;
+
+ if((ret == -1) && (errno != EAGAIN))
+ {
+ std::cerr << "read(): Error number " << errno << " occourred: " << strerror(errno);
+ exit(-1);
+ }
+
+ return(ret);
+}
diff --git a/sim/ucsim/gui.src/serio.src/fileio.hh b/sim/ucsim/gui.src/serio.src/fileio.hh
new file mode 100644
index 0000000..0e986ff
--- /dev/null
+++ b/sim/ucsim/gui.src/serio.src/fileio.hh
@@ -0,0 +1,29 @@
+/******************************************************************************
+ * to emulate the serial input and output of an 8051 controller *
+ * fileio.hh - file input and output *
+ ******************************************************************************/
+#ifndef FILEIO_HEADER
+#define FILEIO_HEADER
+
+#include "config.h"
+
+class FileIO
+{
+public:
+ FileIO();
+ FileIO(const char *infile, const char *outfile);
+ virtual ~FileIO();
+
+ virtual int SendByte(char b);
+ virtual int RecvByte(char *b);
+ virtual int SendStr(char *str);
+ virtual int RecvStr(char *str);
+
+ virtual int infile_id() { return fdin; }
+
+private:
+ int fdin;
+ int fdout;
+};
+
+#endif
diff --git a/sim/ucsim/gui.src/serio.src/frontend.cc b/sim/ucsim/gui.src/serio.src/frontend.cc
new file mode 100644
index 0000000..98472a2
--- /dev/null
+++ b/sim/ucsim/gui.src/serio.src/frontend.cc
@@ -0,0 +1,292 @@
+/******************************************************************************
+ * to emulate the serial input and output of an 8051 controller *
+ * frontend.cc - the ncurses frontend *
+ ******************************************************************************/
+#include <sys/types.h>
+#include <iostream>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <curses.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include "frontend.hh"
+
+char *
+flt_name(enum filter_t f)
+{
+ switch (f)
+ {
+ case flt_none : return (char*)"none";
+ case flt_hex : return (char*)"hex";
+ }
+ return (char*)"unknown";
+}
+
+Viewer::Viewer()
+{
+ /* initalise the output screen */
+ initscr();
+ cbreak();
+ noecho();
+ nl();
+ intrflush(stdscr,FALSE);
+ keypad(stdscr, TRUE);
+
+ flt_in= flt_none;
+ flt_out= flt_none;
+ ohex_ptr= 0;
+ ocnt= icnt= 0;
+ line_length= 8;
+
+ /* clear the screen and off you go */
+ refresh();
+
+ // get the coordinates for the box
+ /* create the subwindow */
+ win_c.min_x = win_c.min_y = 0;
+ getmaxyx(stdscr, win_c.max_y, win_c.max_x);
+
+ /* define the boxed size */
+ topleft.x = win_c.min_x + 1;
+ bottomright.x = win_c.max_x - 2;
+ topleft.y = win_c.min_y + 1;
+ bottomright.y = win_c.max_y - 2;
+ middle_y = (int)((bottomright.y-topleft.y)/2)+1;
+ middle_x = (int)((bottomright.x-topleft.x)/2)+1;
+
+ // draw the two subwindows
+ inp_c.min_x = outp_c.min_x = topleft.x;
+ inp_c.max_x = outp_c.max_x = bottomright.x;
+ inp_c.min_y = topleft.y;
+ inp_c.max_y = middle_y-topleft.y;
+ outp_c.min_y = middle_y+1;
+ outp_c.max_y = bottomright.y-middle_y;
+ inp = subwin(stdscr, inp_c.max_y, inp_c.max_x, inp_c.min_y, inp_c.min_x);
+ outp = subwin(stdscr, outp_c.max_y, outp_c.max_x, outp_c.min_y,outp_c.min_x);
+
+ // initalise the windows
+ touchwin(inp);
+ werase(inp);
+ wrefresh(inp);
+ scrollok(inp, TRUE);
+
+ touchwin(outp);
+ werase(outp);
+ wrefresh(outp);
+ scrollok(outp, TRUE);
+ refresh();
+
+ nodelay(inp, TRUE);
+
+ // flush the input buffers
+ flushinp();
+
+ move(topleft.x,topleft.y);
+ DrawBox();
+}
+
+Viewer::~Viewer()
+{
+ delwin(inp);
+ delwin(outp);
+ erase();
+ refresh();
+ endwin();
+}
+
+void
+Viewer::iflt_mode(enum filter_t iflt)
+{
+ char s[100];
+ flt_in= iflt;
+ sprintf(s, "Input filter: %s\n", flt_name(flt_in));
+ waddstr(inp, s);
+ wrefresh(inp);
+ ihex_high= 1;
+ ihex_ptr= 0;
+}
+
+void
+Viewer::oflt_mode(enum filter_t oflt)
+{
+ char s[100];
+ flt_out= oflt;
+ sprintf(s, "Otput filter: %s\n", flt_name(flt_out));
+ waddstr(outp, s);
+ wrefresh(outp);
+ wrefresh(inp);
+ ohex_ptr= 0;
+}
+
+void
+Viewer::set_length(int l)
+{
+ if (l > (bottomright.x-2-7) / 4)
+ l= ((bottomright.x-2-7)/4) - 1;
+ line_length= l;
+}
+
+void Viewer::DrawBox(void)
+{
+ int height, width;
+ COORDINATES current;
+
+ // save the current position
+ getyx(stdscr, current.y, current.x);
+
+ height = (bottomright.y - topleft.y)+1;
+ width = (bottomright.x - topleft.y)+1;
+
+ mvaddch(topleft.y-1, topleft.x-1, ACS_ULCORNER);
+ mvaddch(topleft.y-1, bottomright.x+1, ACS_URCORNER);
+ mvaddch(bottomright.y+1, bottomright.x+1, ACS_LRCORNER);
+ mvaddch(bottomright.y+1, topleft.x-1, ACS_LLCORNER);
+
+ /* wmove (screen, y, x) */
+ /* top */
+ move(topleft.y-1, topleft.x);
+ hline(ACS_HLINE, width);
+ /* bottom */
+ move(bottomright.y+1, topleft.x);
+ hline(ACS_HLINE, width);
+ move(bottomright.y+1, topleft.x);
+ hline(ACS_HLINE, width);
+
+ /* left */
+ move(topleft.y, topleft.x-1);
+ vline(ACS_VLINE, height);
+
+ /* right */
+ move(topleft.y, bottomright.x+1);
+ vline(ACS_VLINE, height);
+
+ /* the divider */
+ mvaddch(middle_y, bottomright.x+1, ACS_RTEE);
+ mvaddch(middle_y, topleft.x-1, ACS_LTEE);
+ hline(ACS_HLINE, width);
+
+ // the window titles
+ mvaddstr(inp_c.min_y-1, middle_x-(strlen("Input")/2), "Input");
+ mvaddstr(middle_y, middle_x-(strlen("Output")/2), "Output");
+ move(current.y, current.x);
+ refresh();
+}
+
+void Viewer::AddStrOutWin(char *string)
+{
+ waddstr(outp, string);
+ wrefresh(outp);
+ wrefresh(inp);
+}
+
+void Viewer::GetStrInWin(char *string)
+{
+ if(wgetstr(inp, string) == ERR) {
+ string[0] = 0;
+ } else {
+ waddstr(inp, string);
+ wrefresh(inp);
+ }
+}
+
+void Viewer::AddChOutWin(char b)
+{
+ switch (flt_out)
+ {
+ case flt_none:
+ waddch(outp, b);
+ break;
+ case flt_hex:
+ {
+ char s[10];
+ unsigned int u= b&0xff;
+ int i;
+ ohex_buf[ohex_ptr++]= b;
+ sprintf(s, "%02x ", u);
+ waddstr(outp, s);
+ if (ohex_ptr >= line_length)
+ {
+ for (i= 0; i < line_length; i++)
+ {
+ u= ohex_buf[i];
+ waddch(outp, isprint(u)?u:'.');
+ }
+ waddch(outp, '\n');
+ ohex_ptr= 0;
+ sprintf(s, "%06x ", ocnt);
+ waddstr(outp, s);
+ }
+ break;
+ }
+ }
+ ocnt++;
+ wrefresh(outp);
+ wrefresh(inp);
+}
+
+int Viewer::GetChInWin(char *res)
+{
+ int b = wgetch(inp);
+ int ret= 1;
+ char c= b;
+
+ if (b==ERR)
+ {
+ return 0;
+ }
+ else
+ {
+ b= b & 0xff;
+ if (b == 4)
+ return -2;
+ switch (flt_in)
+ {
+ case flt_none:
+ {
+ char c= b;
+ if (!isprint(b) &&
+ (b != '\n') &&
+ (b != '\r'))
+ c= ' ';
+ waddch(inp, c);
+ wrefresh(inp);
+ break;
+ }
+ case flt_hex:
+ {
+ char s[10];
+ s[0]= c;
+ s[1]= 0;
+ if (!isxdigit(b))
+ return 0;
+ if (ihex_high)
+ {
+ ihex_val= strtol(s, NULL, 16);
+ ihex_high= 0;
+ waddch(inp, c);
+ wrefresh(inp);
+ return 0;
+ }
+ else
+ {
+ ihex_val*= 16;
+ ihex_val+= strtol(s, NULL, 16);
+ waddch(inp, c);
+ waddch(inp, ' ');
+ wrefresh(inp);
+ ihex_high= 1;
+ b= ihex_val;
+ ret= 1;
+ }
+ break;
+ }
+ }
+ }
+
+ if (res)
+ *res= b;
+
+ return ret;
+}
diff --git a/sim/ucsim/gui.src/serio.src/frontend.hh b/sim/ucsim/gui.src/serio.src/frontend.hh
new file mode 100644
index 0000000..c7330ff
--- /dev/null
+++ b/sim/ucsim/gui.src/serio.src/frontend.hh
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * to emulate the serial input and output of an 8051 controller *
+ * frontend.hh - ncurses frontend *
+ ******************************************************************************/
+#ifndef FRONTEND_HEADER
+#define FRONTEND_HEADER
+
+#include <sys/types.h>
+#include <curses.h>
+#include <stdint.h>
+
+#include "config.h"
+
+struct COORDS_S
+{
+ int min_x;
+ int max_x;
+ int min_y;
+ int max_y;
+};
+typedef struct COORDS_S COORDS;
+
+struct COORDINATES_S
+{
+ int x;
+ int y;
+};
+typedef struct COORDINATES_S COORDINATES;
+
+enum filter_t
+ {
+ flt_none,
+ flt_hex
+ };
+
+class Viewer
+{
+public:
+ Viewer();
+ virtual ~Viewer();
+ virtual void DrawBox(void);
+ virtual void AddStrOutWin(char *string);
+ virtual void GetStrInWin(char *string);
+ virtual void AddChOutWin(char b);
+ virtual int GetChInWin(char *res);
+
+ virtual void iflt_mode(enum filter_t iflt);
+ virtual void oflt_mode(enum filter_t oflt);
+ virtual void set_length(int l);
+
+private:
+ WINDOW *inp, *outp;
+ COORDS win_c, inp_c, outp_c;
+ COORDINATES topleft, bottomright, current;
+ int middle_y, middle_x;
+ enum filter_t flt_in, flt_out;
+ unsigned int ocnt, icnt;
+ int line_length;
+
+ uint8_t ohex_buf[16], ihex_buf[16];
+ int ohex_ptr, ihex_ptr, ihex_high, ihex_val;
+};
+
+#endif
diff --git a/sim/ucsim/gui.src/serio.src/main.cc b/sim/ucsim/gui.src/serio.src/main.cc
new file mode 100644
index 0000000..cd55540
--- /dev/null
+++ b/sim/ucsim/gui.src/serio.src/main.cc
@@ -0,0 +1,439 @@
+/******************************************************************************
+ * to emulate the serial input and output of an 8051 controller *
+ * main.cc - the main stuff *
+ ******************************************************************************/
+#include "ddconfig.h"
+
+#include <sys/types.h>
+#include <iostream>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <signal.h>
+
+#if defined(HAVE_GETOPT_H)
+# include <getopt.h>
+#endif
+
+#include "fileio.hh"
+#include "frontend.hh"
+#include "posix_signal.hh"
+
+Viewer *view;
+FileIO *fobj;
+
+struct auto_answer_t {
+ char *pattern;
+ int p_len;
+ char *answer;
+ int a_len;
+};
+
+enum
+ {
+ aa_len= 100
+ };
+
+
+struct auto_answer_t aa[aa_len];
+int max_pattern_len= 0;
+int aa_p_num= 0;
+int aa_a_num= 0;
+char *aa_queue;
+int aa_q_len= 0;
+
+
+void
+init_aa()
+{
+ int i;
+ for (i= 0; i < aa_len; i++)
+ {
+ aa[i].pattern= 0;
+ aa[i].p_len= 0;
+ aa[i].answer= 0;
+ aa[i].a_len= 0;
+ }
+}
+
+void
+start_aa()
+{
+ if (max_pattern_len > 0)
+ {
+ aa_queue= (char*)malloc(max_pattern_len);
+ aa_queue[0]= 0;
+ }
+ else
+ aa_queue= NULL;
+}
+
+void
+new_aa_pattern(char *s, int len)
+{
+ if (aa_p_num < aa_len)
+ {
+ aa[aa_p_num].pattern= s;
+ aa[aa_p_num].p_len= len;
+ aa_p_num++;
+ if (len > max_pattern_len)
+ max_pattern_len= len;
+ }
+}
+
+void
+new_aa_answer(char *s, int len)
+{
+ if (aa_a_num < aa_len)
+ {
+ aa[aa_a_num].answer= s;
+ aa[aa_a_num].a_len= len;
+ aa_a_num++;
+ }
+}
+
+// 0: no match
+// 1: partial match
+// 2: full match
+int
+check_pattern(char *p, int pl, char *q, int ql)
+{
+ int m= pl, i;
+ if (ql < m)
+ m= ql;
+ if (m == 0)
+ return 0;
+ for (i= 0; i<m; i++)
+ {
+ if (p[i] != q[i])
+ break;
+ }
+ if (i != m)
+ return 0;
+ if (pl == ql)
+ return 2;
+ return 1;
+}
+
+struct auto_answer_t *
+get_aa(int *partial)
+{
+
+ return 0;
+}
+
+void
+shift_queue()
+{
+ int i;
+ if (aa_queue)
+ {
+ for (i= 1; i<aa_q_len; i++)
+ aa_queue[i-1]= aa_queue[i];
+ aa_queue[--aa_q_len]= 0;
+ }
+}
+
+void
+aa_proc(char c)
+{
+ int i, p;
+ // add to queue
+ if (!aa_queue)
+ return;
+ if (aa_q_len >= max_pattern_len)
+ shift_queue();
+ aa_queue[aa_q_len++]= c;
+ // search
+ for (i=p= 0; i < aa_p_num; i++)
+ {
+ int m= check_pattern(aa[i].pattern, aa[i].p_len, aa_queue, aa_q_len);
+ if (m == 2)
+ {
+ // found a full match
+ int j;
+ for (j=0; j < aa[i].a_len; j++)
+ {
+ fobj->SendByte(aa[i].answer[j]);
+ }
+ shift_queue();
+ return;
+ }
+ if (m == 1)
+ p++;
+ }
+ if (!p)
+ shift_queue();
+}
+
+// globals
+int doloop = 1;
+
+// the signal handler
+void HandleSig(int info)
+{
+ doloop = 0;
+}
+
+int
+hex2bin(char h)
+{
+ int cv= 0;
+ if ((h >= '0') && (h <= '9'))
+ cv= h-'0';
+ else if ((h >= 'A') && (h <= 'F'))
+ cv= 10 + h-'A';
+ else if ((h >= 'a') && (h <= 'f'))
+ cv= 10 + h-'a';
+ return cv;
+}
+
+/* Convert C escapes into bin chars */
+
+char *
+unesc_cstr(char *s, int *len)
+{
+ char *d= (char*)malloc(strlen(s));
+ int i, j;
+ d[j= 0]= 0;
+ for (i= 0; s[i]!=0; i++)
+ {
+ if (s[i]=='\\')
+ {
+ if (s[++i]==0)
+ break;
+ switch (s[i])
+ {
+ case 'a': d[j++]= '\a'; d[j]= 0; break;
+ case 'b': d[j++]= '\b'; d[j]= 0; break;
+ case 'e': d[j++]= 27; d[j]= 0; break;
+ case 'f': d[j++]= '\f'; d[j]= 0; break;
+ case 'n': d[j++]= '\n'; d[j]= 0; break;
+ case 'r': d[j++]= '\r'; d[j]= 0; break;
+ case 't': d[j++]= '\t'; d[j]= 0; break;
+ case 'v': d[j++]= '\v'; d[j]= 0; break;
+ case '\\': d[j++]= '\\'; d[j]= 0; break;
+ case '\'': d[j++]= '\''; d[j]= 0; break;
+ case '\"': d[j++]= '\"'; d[j]= 0; break;
+ case '?': d[j++]= '?'; d[j]= 0; break;
+ case 'x':
+ {
+ if (s[++i]==0)
+ break;
+ int n= 0, l= strspn(&s[i], "0123456789abcdefABCDEF"), v= 0, cv;
+ do
+ {
+ cv= hex2bin(s[i]);
+ v= (v*16) + cv;
+ if (s[++i]==0)
+ break;
+ }
+ while (++n < l);
+ d[j++]= v&0xff;
+ d[j]= 0;
+ i--;
+ break;
+ }
+ case 'u':
+ {
+ if (s[++i]==0)
+ break;
+ int n= 0, l= 4, v= 0, cv;
+ do
+ {
+ cv= hex2bin(s[i]);
+ v= (v*16) + cv;
+ if (s[++i]==0)
+ break;
+ }
+ while (++n < l);
+ d[j++]= v&0xff;
+ d[j]= 0;
+ i--;
+ break;
+ }
+ case 'U':
+ {
+ if (s[++i]==0)
+ break;
+ int n= 0, l= 8, v= 0, cv;
+ do
+ {
+ cv= hex2bin(s[i]);
+ v= (v*16) + cv;
+ if (s[++i]==0)
+ break;
+ }
+ while (++n < l);
+ d[j++]= v&0xff;
+ d[j]= 0;
+ i--;
+ break;
+ }
+ case '0': case '1': case '2': case '3':
+ case '4': case '5': case '6': case '7':
+ {
+ int n= 0, l= strspn(&s[i], "01234567"), v= 0;
+ if (l>3)
+ l= 3;
+ do
+ {
+ v= (v*8) + (s[i]-'0');
+ if (s[++i]==0)
+ break;
+ }
+ while (++n < l);
+ d[j++]= v&0xff;
+ d[j]= 0;
+ i--;
+ break;
+ }
+ default:
+ d[j++]= s[i];
+ d[j]= 0;
+ break;
+ }
+ if (s[i]==0)
+ break;
+ }
+ else
+ {
+ d[j++]= s[i];
+ d[j]= 0;
+ }
+ }
+ if (len)
+ *len= j;
+ return d;
+}
+
+// usage
+void PrintUsage(char *progname)
+{
+ std::cout << "Usage: " << progname << " [-i <filename>] [-o <filename>] [-hIO]\n";
+ std::cout << "-i <filename>\t<filename> is the pipe to the controllers' serial input\n";
+ std::cout << "-o <filename>\t<filename> is the pipe to the controllers' serial output\n";
+ std::cout << "-I \t\thexa filter on input\n";
+ std::cout << "-O \t\thexa filter on output\n";
+ std::cout << "-L n\t\tSet line length of hex dump in output panel (def=8)\n";
+ std::cout << "-a string\tPattern for autoanswer\n";
+ std::cout << "-A string\tAnswer for autoanswer\n";
+ std::cout << "-h\t\tshow the help\n";
+ std::cout << "\nTim Hurman - t.hurman@virgin.net\n";
+ exit(0);
+}
+
+
+// the main function
+int main(int argc, char **argv)
+{
+ char *string = new char[MAX_SIZ];
+ extern char *optarg;
+ int errflg=0;
+ int c, l= 8;
+ enum filter_t fi= flt_none, fo= flt_none;
+ const char *infile = DEF_INFILE;
+ const char *outfile = DEF_OUTFILE;
+
+ // sort out any command line params
+ while ((c = getopt(argc, argv, "i:o:hOIL:a:A:")) != EOF)
+ switch(c) {
+ case 'i':
+ infile = optarg;
+ break;
+ case 'o':
+ outfile = optarg;
+ break;
+ case 'I':
+ fi= flt_hex;
+ break;
+ case 'O':
+ fo= flt_hex;
+ break;
+ case 'L':
+ l= strtol(optarg, 0, 0);
+ break;
+ case 'h':
+ errflg++;
+ break;
+ case 'a':
+ {
+ int l;
+ char *s= unesc_cstr(optarg, &l);
+ new_aa_pattern(s, l);
+ break;
+ }
+ case 'A':
+ {
+ int l;
+ char *s= unesc_cstr(optarg, &l);
+ new_aa_answer(s, l);
+ break;
+ }
+ default:
+ std::cerr << "Invalid or unknown switch\n";
+ errflg++;
+ break;
+ }
+
+ // was there a problem
+ if(errflg)
+ PrintUsage(argv[0]);
+
+ // the main objects needed
+ view = new Viewer();
+ fobj = new FileIO(infile, outfile);
+ SigHandler *sig = new SigHandler();
+
+ view->iflt_mode(fi);
+ view->oflt_mode(fo);
+ view->set_length(l);
+
+ // add a signal handler for ^C
+ sig->SetSignal(SIGINT, HandleSig);
+
+ start_aa();
+ // set the timeout for waiting for a char
+ fd_set s;
+ while(doloop)
+ {
+ int ret, i;
+ FD_ZERO(&s);
+ FD_SET(fileno(stdin), &s);
+ FD_SET(fobj->infile_id(), &s);
+
+ i= select(FD_SETSIZE, &s, NULL, NULL, NULL);
+ if (i >= 0)
+ {
+ if (FD_ISSET(fileno(stdin), &s))
+ {
+ ret= view->GetChInWin(&string[0]);
+ if (ret > 0)
+ {
+ fobj->SendByte(string[0]);
+ }
+ else if (ret < 0)
+ break;
+ }
+
+ if (FD_ISSET(fobj->infile_id(), &s))
+ {
+ if (fobj->RecvByte(string) > 0)
+ {
+ aa_proc(string[0]);
+ view->AddChOutWin(string[0]);
+ }
+ }
+ }
+ //usleep(5000);
+ }
+
+ delete fobj;
+ delete view;
+ delete sig;
+ delete string;
+ return(0);
+}
diff --git a/sim/ucsim/gui.src/serio.src/posix_signal.cc b/sim/ucsim/gui.src/serio.src/posix_signal.cc
new file mode 100644
index 0000000..8183f57
--- /dev/null
+++ b/sim/ucsim/gui.src/serio.src/posix_signal.cc
@@ -0,0 +1,106 @@
+/******************************************************************************
+ * posix_signal.cc - A signal handleing class for linux + solaris *
+ * to convert posix into somthing easier to use *
+ * Tim Hurman - t.hurman@virgin.net *
+ * Last edited on 01th Oct 19999 *
+ ******************************************************************************/
+/*
+ * A quick note, fscking linux, none of this would be neccessary if
+ * linux contained support for sighold, sigrelse, sigignore and sigpause.
+ *
+ */
+
+#include <sys/types.h>
+#include <iostream>
+#include <sys/wait.h> /* header for waitpid() and various macros */
+#include <signal.h> /* header for signal functions */
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <strings.h>
+#include <errno.h>
+
+#include "posix_signal.hh"
+
+// constructor
+SigHandler::SigHandler()
+{
+}
+
+// destructor
+SigHandler::~SigHandler()
+{
+}
+
+/* set a signal */
+int SigHandler::SetSignal(int SIGNAL, SIG_PF ACTION)
+{
+ struct sigaction act;
+
+ /* declare what is going to be called when */
+ act.sa_handler = ACTION;
+
+ /* clear the structure's mask */
+ sigemptyset(&act.sa_mask);
+
+ /* set up some flags */
+ if(SIGNAL == SIGCHLD) {
+ act.sa_flags = SA_NOCLDSTOP;
+ }
+
+ /* set the signal handler */
+ if(sigaction(SIGNAL, &act, NULL) < 0)
+ {
+ std::cerr << "sigaction(): " << strerror(errno) << "\n";
+ exit(-1);
+ }
+
+ /* all ok */
+ return(0);
+}
+
+
+/* block a signal */
+int SigHandler::BlockSignal(int SIGNAL)
+{
+ sigset_t set;
+
+ /* initalise */
+ sigemptyset(&set);
+
+ /* add the SIGNAL to the set */
+ sigaddset(&set, SIGNAL);
+
+ /* block it */
+ if(sigprocmask(SIG_BLOCK, &set, NULL) < 0)
+ {
+ std::cerr << "sigprocmask(): " << strerror(errno) << "\n";
+ exit(-1);
+ }
+
+ /* done */
+ return(0);
+}
+
+
+/* unblock a signal */
+int SigHandler::UnBlockSignal(int SIGNAL)
+{
+ sigset_t set;
+
+ /* initalise */
+ sigemptyset(&set);
+
+ /* add the SIGNAL to the set */
+ sigaddset(&set, SIGNAL);
+
+ /* block it */
+ if(sigprocmask(SIG_UNBLOCK, &set, NULL) < 0)
+ {
+ std::cerr << "sigprocmask(): " << strerror(errno) << "\n";
+ exit(-1);
+ }
+
+ /* done */
+ return(0);
+}
diff --git a/sim/ucsim/gui.src/serio.src/posix_signal.hh b/sim/ucsim/gui.src/serio.src/posix_signal.hh
new file mode 100644
index 0000000..50935ad
--- /dev/null
+++ b/sim/ucsim/gui.src/serio.src/posix_signal.hh
@@ -0,0 +1,22 @@
+/******************************************************************************
+ * posix_signal.hh - A signal handleing class for linux + solaris *
+ * to convert posix into somthing easier to use *
+ * Tim Hurman - t.hurman@virgin.net *
+ * Last edited on 01th Oct 1999 *
+ ******************************************************************************/
+#ifndef POSIX_SIGNAL_HEADER
+#define POSIX_SIGNAL_HEADER
+
+typedef void(*SIG_PF)(int);
+class SigHandler
+{
+public:
+ SigHandler();
+ virtual ~SigHandler();
+
+ virtual int SetSignal(int SIGNAL, SIG_PF ACTION);
+ virtual int BlockSignal(int SIGNAL);
+ virtual int UnBlockSignal(int SIGNAL);
+};
+
+#endif