summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2013-01-27 23:51:56 +0000
committerIgor Pashev <pashev.igor@gmail.com>2013-01-27 23:51:56 +0000
commit6ab0c0f5bf14ed9c15370407b9ee7e0b4b089ae1 (patch)
tree926065cf45450116098db664e3c61dced9e1f21a /config
downloadicon-6ab0c0f5bf14ed9c15370407b9ee7e0b4b089ae1.tar.gz
Initial upstream version 9.4.3upstream/9.4.3
Diffstat (limited to 'config')
-rw-r--r--config/Makefile12
-rw-r--r--config/aix/Makedefs19
-rw-r--r--config/aix/define.h6
-rw-r--r--config/aix/rswitch.s52
-rw-r--r--config/aix/status33
-rw-r--r--config/bsd/Makedefs19
-rw-r--r--config/bsd/alpha.s46
-rw-r--r--config/bsd/define.h10
-rw-r--r--config/bsd/i386.c23
-rw-r--r--config/bsd/m68k.c25
-rw-r--r--config/bsd/powerpc.s78
-rw-r--r--config/bsd/sparc.c33
-rw-r--r--config/bsd/status34
-rw-r--r--config/bsd/vax.c38
-rw-r--r--config/cygwin/Makedefs22
-rw-r--r--config/cygwin/define.h16
-rw-r--r--config/cygwin/status39
-rw-r--r--config/hpux/Makedefs19
-rw-r--r--config/hpux/define.h7
-rw-r--r--config/hpux/status33
-rw-r--r--config/hurd/Makedefs19
-rw-r--r--config/hurd/define.h9
-rw-r--r--config/hurd/rswitch.c27
-rw-r--r--config/hurd/status28
-rw-r--r--config/irix/Makedefs19
-rw-r--r--config/irix/define.h13
-rw-r--r--config/irix/rswitch.s76
-rw-r--r--config/irix/status31
-rw-r--r--config/linux/Makedefs19
-rw-r--r--config/linux/alpha.s46
-rw-r--r--config/linux/define.h9
-rw-r--r--config/linux/i686.s44
-rw-r--r--config/linux/parisc.s68
-rw-r--r--config/linux/sparc.c36
-rw-r--r--config/linux/status41
-rw-r--r--config/macintosh/Makedefs21
-rw-r--r--config/macintosh/define.h8
-rw-r--r--config/macintosh/powerpc.s52
-rw-r--r--config/macintosh/status43
-rw-r--r--config/posix/Makedefs19
-rw-r--r--config/posix/define.h7
-rw-r--r--config/posix/status29
-rw-r--r--config/pthreads.c143
-rwxr-xr-xconfig/setup.sh95
-rw-r--r--config/solaris/Makedefs19
-rw-r--r--config/solaris/define.h10
-rw-r--r--config/solaris/i386.c71
-rw-r--r--config/solaris/sparc.c39
-rw-r--r--config/solaris/status32
-rw-r--r--config/solaris_sunc/Makedefs19
-rw-r--r--config/solaris_sunc/define.h9
-rw-r--r--config/solaris_sunc/sparc.c37
-rw-r--r--config/solaris_sunc/status32
-rw-r--r--config/tru64/Makedefs19
-rw-r--r--config/tru64/define.h10
-rw-r--r--config/tru64/rswitch.s46
-rw-r--r--config/tru64/status28
57 files changed, 1837 insertions, 0 deletions
diff --git a/config/Makefile b/config/Makefile
new file mode 100644
index 0000000..2b17cbd
--- /dev/null
+++ b/config/Makefile
@@ -0,0 +1,12 @@
+# Makefile for cleaning up after setup.sh
+
+TOP = ..
+SRC = $(TOP)/src
+
+
+Clean:
+
+Pure:
+ rm -f $(TOP)/Makedefs
+ rm -f $(SRC)/h/define.h
+ rm -f $(SRC)/common/rswitch.[csS]
diff --git a/config/aix/Makedefs b/config/aix/Makedefs
new file mode 100644
index 0000000..573c5f3
--- /dev/null
+++ b/config/aix/Makedefs
@@ -0,0 +1,19 @@
+# CC C compiler
+# CFLAGS flags for building C files
+# CFDYN additional flags for dynamic functions
+# RLINK flags for linking run-time system
+# RLIBS libraries to link with run-time system
+# TLIBS libraries to link for POSIX threads
+# XLIBS libraries to link for graphics
+# XPMDEFS definitions for building XPM library
+# GDIR directory of graphics helper library
+
+CC = cc
+CFLAGS = -O -qMAXMEM=9999
+CFDYN =
+RLINK =
+RLIBS = -lm
+TLIBS =
+XLIBS = -lX11
+XPMDEFS = -DZPIPE
+GDIR = xpm
diff --git a/config/aix/define.h b/config/aix/define.h
new file mode 100644
index 0000000..c4e3ddd
--- /dev/null
+++ b/config/aix/define.h
@@ -0,0 +1,6 @@
+/*
+ * Icon configuration file for IBM RS/6000 running AIX 4.2 or newer
+ */
+
+#define UNIX 1
+#define LoadFunc /* requires 4.2 or newer */
diff --git a/config/aix/rswitch.s b/config/aix/rswitch.s
new file mode 100644
index 0000000..45a1341
--- /dev/null
+++ b/config/aix/rswitch.s
@@ -0,0 +1,52 @@
+# coswitch(old, new, first)
+# GPR3 GPR4 GPR5
+
+ .file "rswitch.s"
+ .extern .new_context{PR}
+ .extern .syserr{PR}
+ .globl .coswitch[PR]
+ .csect .coswitch[PR]
+
+ .set r0, 0
+ .set SP, 1
+ .set TOC, 2
+ .set OLD, 3
+ .set NEW, 4
+ .set FIRST, 5
+ .set RSIZE, 80 # room for regs 13-31, rounded up mod16
+
+.coswitch:
+ stu SP, -RSIZE(SP) # allocate stack frame
+
+ # Save Old Context:
+ st SP, 0(OLD) # SP
+ st TOC, 4(OLD) # TOC
+ mflr r0
+ st r0, 8(OLD) # LR (return address)
+ mfcr r0
+ st r0, 12(OLD) # CR
+ stm 13, -RSIZE(SP) # GPRs 13-31 (save on stack)
+
+ cmpi 0, FIRST, 0
+ beq first # if first time
+
+ # Restore new context:
+ l SP, 0(NEW) # SP
+ l TOC, 4(NEW) # TOC
+ l r0, 8(NEW) # LR
+ mtlr r0
+ l r0, 12(NEW) # CR
+ mtcr r0
+ lm 13, -RSIZE(SP) # GPRs 13-31 (from stack)
+
+ ai SP, SP, RSIZE # deallocate stack frame
+ brl # return into new context
+
+first: # First-time call:
+ l SP, 0(NEW) # SP as figured by Icon
+ ai SP, SP, -64(SP) # save area for callee
+ cal OLD, 0(r0) # arg1
+ cal NEW, 0(r0) # arg2
+ bl .new_context{PR} # new_context(0,0)
+ cal OLD, 0(r0)
+ bl .syserr{PR}
diff --git a/config/aix/status b/config/aix/status
new file mode 100644
index 0000000..40f9880
--- /dev/null
+++ b/config/aix/status
@@ -0,0 +1,33 @@
+System configuration:
+
+ IBM RS/6000 running AIX v4.2 or newer
+
+Latest Icon version:
+
+ Version 9.4.1
+
+Installer:
+
+ Gregg Townsend
+ Icon Project
+ The University of Arizona
+
+Missing features:
+
+ None
+
+Known bugs:
+
+ None
+
+Comments:
+
+ Tested on an RS/6000 running AIX 4.3.
+
+ AIX Version 4.2 or newer is needed for loadfunc().
+ Although loadfunc() is enabled, I've never succeeded in
+ building a loadable library that it finds acceptable.
+
+Date:
+
+ February 15, 2002
diff --git a/config/bsd/Makedefs b/config/bsd/Makedefs
new file mode 100644
index 0000000..10f9eed
--- /dev/null
+++ b/config/bsd/Makedefs
@@ -0,0 +1,19 @@
+# CC C compiler
+# CFLAGS flags for building C files
+# CFDYN additional flags for dynamic functions
+# RLINK flags for linking run-time system
+# RLIBS libraries to link with run-time system
+# TLIBS libraries to link for POSIX threads
+# XLIBS libraries to link for graphics
+# XPMDEFS definitions for building XPM library
+# GDIR directory of graphics helper library
+
+CC = cc
+CFLAGS = -O -I/usr/X11R6/include
+CFDYN = -fPIC
+RLINK = -Wl,-E
+RLIBS = -lm
+TLIBS = -lpthread
+XLIBS = -Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib -lX11
+XPMDEFS = -DZPIPE -I/usr/X11R6/include
+GDIR = xpm
diff --git a/config/bsd/alpha.s b/config/bsd/alpha.s
new file mode 100644
index 0000000..6c9ba72
--- /dev/null
+++ b/config/bsd/alpha.s
@@ -0,0 +1,46 @@
+/*
+ * coswitch(old_cs, new_cs, first) for DEC Alpha architecture
+ * $16 $17 $18
+ */
+ .data
+errmsg: .ascii "new_context() returned in coswitch\X00"
+
+ .text
+ .globl coswitch
+ .ent coswitch
+coswitch:
+ lda $sp, -72($sp) /* make room on stack */
+ stq $sp, 0($16) /* save stack pointer */
+ stq $9, 0($sp) /* save registers on stack */
+ stq $10, 8($sp)
+ stq $11, 16($sp)
+ stq $12, 24($sp)
+ stq $13, 32($sp)
+ stq $14, 40($sp)
+ stq $15, 48($sp)
+ stq $27, 56($sp)
+ stq $26, 64($sp) /* return address */
+ beq $18, first /* if first time */
+
+ ldq $sp, 0($17) /* load new stack pointer */
+ ldq $9, 0($sp) /* load registers from stack */
+ ldq $10, 8($sp)
+ ldq $11, 16($sp)
+ ldq $12, 24($sp)
+ ldq $13, 32($sp)
+ ldq $14, 40($sp)
+ ldq $15, 48($sp)
+ ldq $27, 56($sp)
+ ldq $26, 64($sp) /* return address */
+ lda $sp, 72($sp) /* reset sp */
+ jsr_coroutine $31, ($26), 0 /* jump into new_context */
+
+first:
+ ldq $sp, 0($17) /* load stack pointer only */
+ bis $31, $31, $16 /* r16 = 0 */
+ bis $31, $31, $17 /* r17 = 0 */
+ jsr $26, new_context /* new_context(0,0) */
+ lda $16, errmsg
+ jsr $26, syserr /* shouldn't get here */
+
+ .end coswitch
diff --git a/config/bsd/define.h b/config/bsd/define.h
new file mode 100644
index 0000000..1859df0
--- /dev/null
+++ b/config/bsd/define.h
@@ -0,0 +1,10 @@
+/*
+ * Icon configuration file for BSD
+ */
+
+#define UNIX 1
+#define LoadFunc
+
+#define CComp "gcc"
+#define COpts "-O -I/usr/X11R6/include"
+#define ICONC_XLIB "-Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib -lX11"
diff --git a/config/bsd/i386.c b/config/bsd/i386.c
new file mode 100644
index 0000000..1eecd7c
--- /dev/null
+++ b/config/bsd/i386.c
@@ -0,0 +1,23 @@
+/*
+ * coswitch for the i386 architecture
+ */
+
+int
+coswitch (int *old_cs, int *new_cs, int first)
+{
+ asm ("movl 8(%ebp),%eax");
+ asm ("movl %esp,0(%eax)");
+ asm ("movl %ebp,4(%eax)");
+ asm ("movl 12(%ebp),%eax");
+
+ if (first == 0) { /* this is the first activation */
+ asm ("movl 0(%eax),%esp");
+ asm ("movl $0,%ebp");
+ new_context (0, 0);
+ syserr ("new_context() returned in coswitch");
+ }
+ else {
+ asm ("movl 0(%eax),%esp");
+ asm ("movl 4(%eax),%ebp");
+ }
+}
diff --git a/config/bsd/m68k.c b/config/bsd/m68k.c
new file mode 100644
index 0000000..077922b
--- /dev/null
+++ b/config/bsd/m68k.c
@@ -0,0 +1,25 @@
+/*
+ * coswitch for the m68k architecture
+ */
+
+int
+coswitch (int *old_cs, int *new_cs, int first)
+{
+ asm ("movl %a6@(8),%a0"); /* a0 = old */
+ asm ("movl %a6@(12),%a1"); /* a1 = new */
+ asm ("movl %a7,%a0@"); /* save sp in cstate[0] */
+ asm ("movl %a6,%a0@(4)"); /* save a6 (fp) in cstate[0] */
+ asm ("moveml #0x3cfc,%a0@(8)"); /* store d2-d7, a2-a6 in old->cstate */
+
+ if (first == 0) { /* this is first activation */
+ asm ("movl %a1@,%a7");
+ asm ("movl #0,%a6");
+ new_context (0, 0);
+ syserr ("new_context() returned in coswitch");
+ }
+ else {
+ asm ("movl %a1@,%a7"); /* restore sp */
+ asm ("movl %a1@(4),%a6"); /* restore fp */
+ asm ("moveml %a1@(8),#0x3cfc"); /* restore d2-d7, a2-a6 */
+ }
+}
diff --git a/config/bsd/powerpc.s b/config/bsd/powerpc.s
new file mode 100644
index 0000000..8044959
--- /dev/null
+++ b/config/bsd/powerpc.s
@@ -0,0 +1,78 @@
+#
+# coswitch for the PowerPC architecture
+#
+
+ .file "rswitch.s"
+
+ .data
+errmsg: .string "new_context() returned in coswitch\n"
+
+ .text
+ .align 2
+ .globl coswitch
+ .type coswitch,@function
+
+coswitch:
+ stwu 1, -80(1) # allocate stack frame
+
+ # Save Old Context:
+ stw 1, 0(3) # SP
+ mflr 0
+ stw 0, 4(3) # LR (return address)
+ stw 14, 0(1) # GPRs 14-31 (save on stack)
+ stw 15, 4(1)
+ stw 16, 8(1)
+ stw 17, 12(1)
+ stw 18, 16(1)
+ stw 19, 20(1)
+ stw 20, 24(1)
+ stw 21, 28(1)
+ stw 22, 32(1)
+ stw 23, 36(1)
+ stw 24, 40(1)
+ stw 25, 44(1)
+ stw 26, 48(1)
+ stw 27, 52(1)
+ stw 28, 56(1)
+ stw 29, 60(1)
+ stw 30, 64(1)
+ stw 31, 68(1)
+
+ cmpi 0, 5, 0
+ beq first # if first time
+
+ # Restore new context:
+ lwz 1, 0(4) # SP
+ lwz 0, 4(4) # LR
+ mtlr 0
+ lwz 14, 0(1) # GPRs 14-31 (from stack)
+ lwz 15, 4(1)
+ lwz 16, 8(1)
+ lwz 17, 12(1)
+ lwz 18, 16(1)
+ lwz 19, 20(1)
+ lwz 20, 24(1)
+ lwz 21, 28(1)
+ lwz 22, 32(1)
+ lwz 23, 36(1)
+ lwz 24, 40(1)
+ lwz 25, 44(1)
+ lwz 26, 48(1)
+ lwz 27, 52(1)
+ lwz 28, 56(1)
+ lwz 29, 60(1)
+ lwz 30, 64(1)
+ lwz 31, 68(1)
+
+ addic 1, 1, 80 # deallocate stack frame
+ blr # return into new context
+
+first: # First-time call:
+ lwz 1, 0(4) # SP as figured by Icon
+ addic 1, 1, -64 # save area for callee
+ addi 3, 0, 0 # arg1
+ addi 4, 0, 0 # arg2
+ bl new_context # new_context(0,0)
+ lis 3, errmsg@ha
+ la 3, errmsg@l(3)
+ bl syserr
diff --git a/config/bsd/sparc.c b/config/bsd/sparc.c
new file mode 100644
index 0000000..4f2215c
--- /dev/null
+++ b/config/bsd/sparc.c
@@ -0,0 +1,33 @@
+/*
+ * coswitch for the SPARC architecture
+ */
+
+int
+coswitch (int *old_cs, int *new_cs, int first)
+{
+ asm("ta 0x03"); /* ST_FLUSH_WINDOWS in trap.h */
+ asm("ld [%fp+0x44], %o0"); /* load old_cs into %o0 */
+ asm("st %sp,[%o0]"); /* Save user stack pointer */
+ asm("st %fp,[%o0+0x4]"); /* Save frame pointer */
+ asm("st %i7,[%o0+0x8]"); /* Save return address */
+
+ if (first == 0) { /* this is the first activation */
+ asm("ld [%fp+0x48], %o0"); /* load new_cs into %o0 */
+ asm("ld [%o0], %o1"); /* load %o1 from cstate[0] */
+
+ /* Decrement new stack pointer value before loading it into sp. */
+ /* The top 64 bytes of the stack are reserved for the kernel, to */
+ /* save the 8 local and 8 in registers into, on context switches, */
+ /* interrupts, traps, etc. */
+
+ asm("save %o1,-96, %sp"); /* load %sp from %o1 */
+ new_context(0,0);
+ syserr("new_context() returned in coswitch");
+
+ } else {
+ asm("ld [%fp+0x48], %o0"); /* load new_cs into %o0 */
+ asm("ld [%o0+0x4],%fp"); /* Load frame pointer */
+ asm("ld [%o0+0x8],%i7"); /* Load return address */
+ asm("ld [%o0],%sp"); /* Load user stack pointer */
+ }
+}
diff --git a/config/bsd/status b/config/bsd/status
new file mode 100644
index 0000000..e0fba53
--- /dev/null
+++ b/config/bsd/status
@@ -0,0 +1,34 @@
+System configuration:
+
+ All BSD variants (FreeBSD, NetBSD, OpenBSD) except Macintosh
+
+Latest Icon version:
+
+ Version 9.4.3
+
+Installer:
+
+ Gregg Townsend
+ Icon Project
+ The University of Arizona
+
+Missing features:
+
+ None
+
+Known bugs:
+
+ None
+
+Comments:
+
+ This configuration is for FreeBSD, NetBSD, and OpenBSD.
+ For Darwin (Apple Macintosh), use the "macintosh" configuration.
+
+ This configuration can use pthreads for context switching.
+
+ Tested on FreeBSD 6.0-beta5 (i386 and amd64).
+
+Date:
+
+ November 10, 2005
diff --git a/config/bsd/vax.c b/config/bsd/vax.c
new file mode 100644
index 0000000..52d30f9
--- /dev/null
+++ b/config/bsd/vax.c
@@ -0,0 +1,38 @@
+/*
+ * coswitch for the VAX architecture
+ */
+
+int
+coswitch (int *old_cs, int *new_cs, int first)
+{
+ asm ("movl 4(%ap),%r0");
+ asm ("movl 8(%ap),%r1");
+ asm ("movl %sp,0(%r0)");
+ asm ("movl %fp,4(%r0)");
+ asm ("movl %ap,8(%r0)");
+ asm ("movl %r11,16(%r0)");
+ asm ("movl %r10,20(%r0)");
+ asm ("movl %r9,24(%r0)");
+ asm ("movl %r8,28(%r0)");
+ asm ("movl %r7,32(%r0)");
+ asm ("movl %r6,36(%r0)");
+
+ if (first == 0) { /* this is the first activation */
+ asm ("movl 0(%r1),%sp");
+ asm ("clrl %fp");
+ asm ("clrl %ap");
+ new_context (0,0);
+ syserr ("new_context() returned in coswitch");
+ }
+ else {
+ asm ("movl 0(%r1),%sp");
+ asm ("movl 4(%r1),%fp");
+ asm ("movl 8(%r1),%ap");
+ asm ("movl 16(%r1),%r11");
+ asm ("movl 20(%r1),%r10");
+ asm ("movl 24(%r1),%r9");
+ asm ("movl 28(%r1),%r8");
+ asm ("movl 32(%r1),%r7");
+ asm ("movl 36(%r1),%r6");
+ }
+}
diff --git a/config/cygwin/Makedefs b/config/cygwin/Makedefs
new file mode 100644
index 0000000..2ddf6fb
--- /dev/null
+++ b/config/cygwin/Makedefs
@@ -0,0 +1,22 @@
+# CC C compiler
+# CFLAGS flags for building C files
+# CFDYN additional flags for dynamic functions
+# RLINK flags for linking run-time system
+# RLIBS libraries to link with run-time system
+# TLIBS libraries to link for POSIX threads
+# XLIBS libraries to link for graphics
+# XPMDEFS definitions for building XPM library
+# GDIR directory of graphics helper library
+
+CC = gcc
+CFLAGS = -O
+CFDYN = -fpic
+RLINK = -Wl,-E
+RLIBS = -lm
+TLIBS =
+XLIBS = -luser32 -lgdi32 -lcomdlg32 -lwinmm
+XPMDEFS =
+GDIR = wincap
+
+# EXE extension for executable files
+EXE = .exe
diff --git a/config/cygwin/define.h b/config/cygwin/define.h
new file mode 100644
index 0000000..d2925a0
--- /dev/null
+++ b/config/cygwin/define.h
@@ -0,0 +1,16 @@
+/*
+ * Icon configuration file for Cygwin environment on Microsoft Windows
+ */
+#define MSWIN 1 /* this configuration is for Microsoft Windows */
+#define CYGWIN 1 /* this configuration uses Cygwin API */
+
+#define FAttrib /* enable fattrib() extension */
+#define WinExtns /* enable native Windows functions */
+
+#define CComp "gcc"
+
+#define ExecSuffix ".exe"
+#define IcodeSuffix ".exe"
+
+#define BinaryHeader
+#define MaxHdr 16384
diff --git a/config/cygwin/status b/config/cygwin/status
new file mode 100644
index 0000000..ad06c71
--- /dev/null
+++ b/config/cygwin/status
@@ -0,0 +1,39 @@
+System configuration:
+
+ The Cygwin Unix environment running on Microsoft Windows NT
+
+Latest Icon version:
+
+ Version 9.4.3
+
+Installer:
+
+ Gregg Townsend
+ Icon Project
+ The University of Arizona
+ (with thanks to Frank J. Lhota)
+
+Missing features:
+
+ Dynamic loading (loadfunc)
+
+Known bugs:
+
+ Some tests (typically io, tpp, and opts) fail due to Unix
+ dependencies.
+
+ There are many rough edges in the graphics area, which has
+ not been well tested.
+
+Comments:
+
+ See the special Cygwin page in the documentation directory.
+
+ This configuration now uses POSIX threads for context switching;
+ the former "rswitch.c" code failed in the latest test environment.
+
+ Tested with GCC 3.4.4 on Cygwin 1.5.18.
+
+Date:
+
+ November 4, 2005
diff --git a/config/hpux/Makedefs b/config/hpux/Makedefs
new file mode 100644
index 0000000..4d95660
--- /dev/null
+++ b/config/hpux/Makedefs
@@ -0,0 +1,19 @@
+# CC C compiler
+# CFLAGS flags for building C files
+# CFDYN additional flags for dynamic functions
+# RLINK flags for linking run-time system
+# RLIBS libraries to link with run-time system
+# TLIBS libraries to link for POSIX threads
+# XLIBS libraries to link for graphics
+# XPMDEFS definitions for building XPM library
+# GDIR directory of graphics helper library
+
+CC = cc
+CFLAGS = -O -I/usr/X11R6/include
+CFDYN = +z
+RLINK =
+RLIBS = -lm
+TLIBS = -lrt -lpthread
+XLIBS = -lX11
+XPMDEFS = -DZPIPE -DSYSV
+GDIR = xpm
diff --git a/config/hpux/define.h b/config/hpux/define.h
new file mode 100644
index 0000000..d6fa049
--- /dev/null
+++ b/config/hpux/define.h
@@ -0,0 +1,7 @@
+/*
+ * Icon configuration file for HP-UX
+ */
+#define UNIX 1
+
+#define CStateSize 20
+#define StackSize 10000
diff --git a/config/hpux/status b/config/hpux/status
new file mode 100644
index 0000000..a72a400
--- /dev/null
+++ b/config/hpux/status
@@ -0,0 +1,33 @@
+System configuration:
+
+ Hewlett-Packard HP-UX operating system.
+
+Latest Icon version:
+
+ Version 9.4.2
+
+Installer:
+
+ Icon Project
+ The University of Arizona
+ (with thanks to Chris Tenaglia)
+
+Missing features:
+
+ Dynamic loading (loadfunc)
+
+Known bugs:
+
+ None
+
+Comments:
+
+ Tested on an RX2600 server (Itanium architecture) running
+ HP-UX version B.11.23. Will probably also work on PA-RISC.
+
+ HP/UX uses the LPATH environment variable as a path to the linker.
+ This conflicts with Icon's use of LPATH to search for $include files.
+
+Date:
+
+ December 20, 2003
diff --git a/config/hurd/Makedefs b/config/hurd/Makedefs
new file mode 100644
index 0000000..97e63e3
--- /dev/null
+++ b/config/hurd/Makedefs
@@ -0,0 +1,19 @@
+# CC C compiler
+# CFLAGS flags for building C files
+# CFDYN additional flags for dynamic functions
+# RLINK flags for linking run-time system
+# RLIBS libraries to link with run-time system
+# TLIBS libraries to link for POSIX threads
+# XLIBS libraries to link for graphics
+# XPMDEFS definitions for building XPM library
+# GDIR directory of graphics helper library
+
+CC = gcc
+CFLAGS = -O
+CFDYN = -fPIC
+RLINK = -Wl,-E
+RLIBS = -lm -ldl
+TLIBS =
+XLIBS = -L/usr/X11R6/lib -lX11
+XPMDEFS = -DZPIPE
+GDIR = xpm
diff --git a/config/hurd/define.h b/config/hurd/define.h
new file mode 100644
index 0000000..5bbb3e0
--- /dev/null
+++ b/config/hurd/define.h
@@ -0,0 +1,9 @@
+/*
+ * Icon configuration file for the GNU Hurd system
+ */
+
+#define UNIX 1
+#define LoadFunc
+
+#define CComp "gcc"
+#define COpts "-O -fomit-frame-pointer"
diff --git a/config/hurd/rswitch.c b/config/hurd/rswitch.c
new file mode 100644
index 0000000..4a9def0
--- /dev/null
+++ b/config/hurd/rswitch.c
@@ -0,0 +1,27 @@
+/*
+ * This is the co-expression context switch for the GNU system.
+ */
+
+/*
+ * coswitch
+ */
+
+coswitch(old_cs, new_cs, first)
+int *old_cs, *new_cs;
+int first;
+ {
+ asm(" movl 8(%ebp),%eax");
+ asm(" movl %esp,0(%eax)");
+ asm(" movl %ebp,4(%eax)");
+ asm(" movl 12(%ebp),%eax");
+ if (first == 0) { /* this is the first activation */
+ asm(" movl 0(%eax),%esp");
+ asm(" movl $0,%ebp");
+ new_context(0, 0);
+ syserr("interp() returned in coswitch");
+ }
+ else {
+ asm(" movl 0(%eax),%esp");
+ asm(" movl 4(%eax),%ebp");
+ }
+ }
diff --git a/config/hurd/status b/config/hurd/status
new file mode 100644
index 0000000..91eaeb5
--- /dev/null
+++ b/config/hurd/status
@@ -0,0 +1,28 @@
+System configuration:
+
+ Intel architecture running the GNU system
+
+Latest Icon version:
+
+ Version 9.4.0
+
+Installer:
+
+ Marcus Brinkmann
+ The Debian project
+
+Missing features:
+
+ None
+
+Known bugs:
+
+ None
+
+Comments:
+
+ Tested under Debian GNU/Hurd.
+
+Date:
+
+ August 9, 2001
diff --git a/config/irix/Makedefs b/config/irix/Makedefs
new file mode 100644
index 0000000..b6020a2
--- /dev/null
+++ b/config/irix/Makedefs
@@ -0,0 +1,19 @@
+# CC C compiler
+# CFLAGS flags for building C files
+# CFDYN additional flags for dynamic functions
+# RLINK flags for linking run-time system
+# RLIBS libraries to link with run-time system
+# TLIBS libraries to link for POSIX threads
+# XLIBS libraries to link for graphics
+# XPMDEFS definitions for building XPM library
+# GDIR directory of graphics helper library
+
+CC = c89
+CFLAGS = -O -OPT:Olimit=5000 -woff 1048,1116,1188,1209,1548
+CFDYN =
+RLINK =
+RLIBS = -lm
+TLIBS = -lpthread
+XLIBS = -lX11
+XPMDEFS = -DZPIPE
+GDIR = xpm
diff --git a/config/irix/define.h b/config/irix/define.h
new file mode 100644
index 0000000..9704a1f
--- /dev/null
+++ b/config/irix/define.h
@@ -0,0 +1,13 @@
+/*
+ * Icon configuration file for Silicon Graphics Irix
+ */
+
+#define UNIX 1
+#define LoadFunc
+
+#define CStateSize 32 /* anything >= 26 should actually do */
+
+#define CComp "c89"
+#define COpts "-Wf,-XNd10000"
+
+#define GammaCorrection 1.0 /* for old X11R5 systems */
diff --git a/config/irix/rswitch.s b/config/irix/rswitch.s
new file mode 100644
index 0000000..e820e3d
--- /dev/null
+++ b/config/irix/rswitch.s
@@ -0,0 +1,76 @@
+ .data
+ .align 0
+$$8:
+ .ascii "new_context() returned in coswitch\X00"
+ .text
+ .align 2
+ .globl coswitch
+ # coswitch(old_cs,new_cs,first)
+ # int *old_cs,*new_cs;
+ # int first;
+ # {
+ .ent coswitch
+coswitch:
+ # standard entry code, including decrement of sp
+ subu $sp, 32
+ sw $31, 20($sp)
+ .mask 0x80000000, -4
+ .frame $sp, 32, $31
+ # save (decremented) sp and other registers in old_cs
+ sw $sp, 0($4)
+ sw $31, 4($4)
+ sd $16, 8($4)
+ sd $18, 16($4)
+ sd $20, 24($4)
+ sd $22, 32($4)
+ s.d $f20,40($4)
+ s.d $f22,48($4)
+ s.d $f24,56($4)
+ s.d $f26,64($4)
+ s.d $f28,72($4)
+ s.d $f30,80($4)
+ sw $gp,88($4)
+ sw $fp,96($4)
+ # if first = 0, this is first activation
+ bne $6, 0, $33
+ # load sp from new_cs[0] (ignore other registers)
+ lw $sp, 0($5)
+ # Decrement sp by the size of the stackframe.
+ # Store decremented sp in new_cs. Then call new_context().
+ subu $sp, 32
+ sw $sp, 0($5)
+ # new_context(0,0);
+ move $4, $0
+ move $5, $0
+ jal new_context
+ # syserr("new_context() returned in coswitch");
+ la $4, $$8
+ jal syserr
+ # if we're in control now, something is really wrong, so go into
+ # a tight loop until someone notices...
+$32:
+ b $32
+$33:
+ # here for not first activation
+ # load sp and other registers from new_cs
+ lw $sp, 0($5)
+ lw $31, 4($5)
+ # (could compare $31 with 20($sp) as a consistency check now)
+ ld $16, 8($5)
+ ld $18, 16($5)
+ ld $20, 24($5)
+ ld $22, 32($5)
+ l.d $f20,40($5)
+ l.d $f22,48($5)
+ l.d $f24,56($5)
+ l.d $f26,64($5)
+ l.d $f28,72($5)
+ l.d $f30,80($5)
+ lw $gp,88($5)
+ lw $fp,96($5)
+ # increment sp as for normal return
+ addu $sp, 32
+ # return
+ j $31
+ # }
+ .end coswitch
diff --git a/config/irix/status b/config/irix/status
new file mode 100644
index 0000000..58fc639
--- /dev/null
+++ b/config/irix/status
@@ -0,0 +1,31 @@
+System configuration:
+
+ Silicon Graphics MIPS architecture running Irix v6.4 or newer
+
+Latest Icon version:
+
+ Version 9.4.2
+
+Installer:
+
+ Gregg Townsend
+ Icon Project
+ The University of Arizona
+
+Missing features:
+
+ None
+
+Known bugs:
+
+ None
+
+Comments:
+
+ Tested on Silicon Graphics Indigo2 IMPACT running IRIX 6.5.7f.
+
+ This configuration can use pthreads for context switching.
+
+Date:
+
+ March 26, 2003
diff --git a/config/linux/Makedefs b/config/linux/Makedefs
new file mode 100644
index 0000000..da053aa
--- /dev/null
+++ b/config/linux/Makedefs
@@ -0,0 +1,19 @@
+# CC C compiler
+# CFLAGS flags for building C files
+# CFDYN additional flags for dynamic functions
+# RLINK flags for linking run-time system
+# RLIBS libraries to link with run-time system
+# TLIBS libraries to link for POSIX threads
+# XLIBS libraries to link for graphics
+# XPMDEFS definitions for building XPM library
+# GDIR directory of graphics helper library
+
+CC = gcc
+CFLAGS = -O
+CFDYN = -fPIC
+RLINK = -Wl,-E
+RLIBS = -lm -ldl
+TLIBS = -lpthread
+XLIBS = -L/usr/X11R6/lib64 -L/usr/X11R6/lib -lX11
+XPMDEFS = -DZPIPE
+GDIR = xpm
diff --git a/config/linux/alpha.s b/config/linux/alpha.s
new file mode 100644
index 0000000..a4589d4
--- /dev/null
+++ b/config/linux/alpha.s
@@ -0,0 +1,46 @@
+/*
+ * coswitch(old_cs, new_cs, first) for Dec Alpha architecture
+ * $16 $17 $18
+ */
+ .data
+errmsg: .ascii "new_context() returned in coswitch\X00"
+
+ .text
+ .globl coswitch
+ .ent coswitch
+coswitch:
+ lda $sp, -72($sp) /* make room on stack */
+ stq $sp, 0($16) /* save stack pointer */
+ stq $9, 0($sp) /* save registers on stack */
+ stq $10, 8($sp)
+ stq $11, 16($sp)
+ stq $12, 24($sp)
+ stq $13, 32($sp)
+ stq $14, 40($sp)
+ stq $15, 48($sp)
+ stq $27, 56($sp)
+ stq $26, 64($sp) /* return address */
+ beq $18, first /* if first time */
+
+ ldq $sp, 0($17) /* load new stack pointer */
+ ldq $9, 0($sp) /* load registers from stack */
+ ldq $10, 8($sp)
+ ldq $11, 16($sp)
+ ldq $12, 24($sp)
+ ldq $13, 32($sp)
+ ldq $14, 40($sp)
+ ldq $15, 48($sp)
+ ldq $27, 56($sp)
+ ldq $26, 64($sp) /* return address */
+ lda $sp, 72($sp) /* reset sp */
+ jsr_coroutine $31, ($26), 0 /* jump into new_context */
+
+first:
+ ldq $sp, 0($17) /* load stack pointer only */
+ bis $31, $31, $16 /* r16 = 0 */
+ bis $31, $31, $17 /* r17 = 0 */
+ jsr $26, new_context /* new_context(0,0) */
+ lda $16, errmsg
+ jsr $26, syserr /* shouldn't get here */
+
+ .end coswitch
diff --git a/config/linux/define.h b/config/linux/define.h
new file mode 100644
index 0000000..834bb2b
--- /dev/null
+++ b/config/linux/define.h
@@ -0,0 +1,9 @@
+/*
+ * Icon configuration file for Linux
+ */
+
+#define UNIX 1
+#define LoadFunc
+
+#define CComp "gcc"
+#define COpts "-O -fomit-frame-pointer"
diff --git a/config/linux/i686.s b/config/linux/i686.s
new file mode 100644
index 0000000..2e7117e
--- /dev/null
+++ b/config/linux/i686.s
@@ -0,0 +1,44 @@
+#
+# Assembler source for context switch using gas 1.38.1 + gcc 1.40 on
+# Xenix/386, revamped slightly for use with Linux by me (Richard Goer-
+# witz) on 7/25/94.
+#
+
+.file "rswitch.s"
+.data 1
+.LC0:
+ .byte 0x6e,0x65,0x77,0x5f,0x63,0x6f,0x6e,0x74,0x65,0x78
+ .byte 0x74,0x28,0x29,0x20,0x72,0x65,0x74,0x75,0x72,0x6e
+ .byte 0x65,0x64,0x20,0x69,0x6e,0x20,0x63,0x6f,0x73,0x77
+ .byte 0x69,0x74,0x63,0x68,0x0
+.text
+ .align 4
+.globl coswitch
+
+
+coswitch:
+ pushl %ebp
+ movl %esp,%ebp
+ movl 8(%ebp),%eax
+ movl %esp,0(%eax)
+ movl %ebp,4(%eax)
+ movl 12(%ebp),%eax
+ cmpl $0,16(%ebp)
+ movl 0(%eax),%esp
+ je .L2
+
+ movl 4(%eax),%ebp
+ jmp .L1
+
+.L2:
+ movl $0,%ebp
+ pushl $0
+ pushl $0
+ call new_context
+ pushl $.LC0
+ call syserr
+ addl $12,%esp
+
+.L1:
+ leave
+ ret
diff --git a/config/linux/parisc.s b/config/linux/parisc.s
new file mode 100644
index 0000000..88d9366
--- /dev/null
+++ b/config/linux/parisc.s
@@ -0,0 +1,68 @@
+; coexpression code for HP PA-RISC architecture for Icon 8.10
+;
+; n.b. two of the three coexpression tests work, but coexpression
+; *transmission*, a rarely used feature, does not
+
+ .CODE
+ .IMPORT syserr
+ .EXPORT coswitch
+coswitch
+ .PROC
+ .CALLINFO
+ .ENTRY
+ ; store old registers
+ STW %sp,0(%arg0)
+ ; not used: 4(%arg0)
+ STW %rp,8(%arg0)
+ STW %r3,12(%arg0)
+ STW %r4,16(%arg0)
+ STW %r5,20(%arg0)
+ STW %r6,24(%arg0)
+ STW %r7,28(%arg0)
+ STW %r8,32(%arg0)
+ STW %r9,36(%arg0)
+ STW %r10,40(%arg0)
+ STW %r11,44(%arg0)
+ STW %r12,48(%arg0)
+ STW %r13,52(%arg0)
+ STW %r14,56(%arg0)
+ STW %r15,60(%arg0)
+ STW %r16,64(%arg0)
+ STW %r17,68(%arg0)
+ STW %r18,72(%arg0)
+
+ COMIB,=,N 0,%arg2,L$isfirst
+
+ ; this is not a first-time call; reload old context
+ LDW 0(%arg1),%sp
+ LDW 8(%arg1),%rp
+ LDW 12(%arg1),%r3
+ LDW 16(%arg1),%r4
+ LDW 20(%arg1),%r5
+ LDW 24(%arg1),%r6
+ LDW 28(%arg1),%r7
+ LDW 32(%arg1),%r8
+ LDW 36(%arg1),%r9
+ LDW 40(%arg1),%r10
+ LDW 44(%arg1),%r11
+ LDW 48(%arg1),%r12
+ LDW 52(%arg1),%r13
+ LDW 56(%arg1),%r14
+ LDW 60(%arg1),%r15
+ LDW 64(%arg1),%r16
+ LDW 68(%arg1),%r17
+ LDW 72(%arg1),%r18
+ BV,N (%rp) ; return
+
+L$isfirst
+ LDW 0(%arg1),%sp
+ LDI 0,%arg0
+ LDI 0,%arg1
+ .CALL ARGW0=GR,ARGW1=GR
+ BL,N new_context,%rp ; call new_context(0,0)
+ SUBI 1,%r0,%rp
+ BV,N (%rp) ; abort w/ illegal jump
+ .EXIT
+ .PROCEND
+ .IMPORT new_context,CODE
+ .END
diff --git a/config/linux/sparc.c b/config/linux/sparc.c
new file mode 100644
index 0000000..743bb02
--- /dev/null
+++ b/config/linux/sparc.c
@@ -0,0 +1,36 @@
+/*
+ * coswitch for Sun-4 Sparc.
+ *
+ * Compile this with 'gcc -c rswitch.c'. Do not use gcc -O.
+ */
+
+int coswitch(old_cs, new_cs, first)
+int *old_cs, *new_cs;
+int first;
+{
+ asm("ta 0x03"); /* ST_FLUSH_WINDOWS in trap.h */
+ asm("ld [%fp+0x44], %o0"); /* load old_cs into %o0 */
+ asm("st %sp,[%o0]"); /* Save user stack pointer */
+ asm("st %fp,[%o0+0x4]"); /* Save frame pointer */
+ asm("st %i7,[%o0+0x8]"); /* Save return address */
+
+ if (first == 0) { /* this is the first activation */
+ asm("ld [%fp+0x48], %o0"); /* load new_cs into %o0 */
+ asm("ld [%o0], %o1"); /* load %o1 from cstate[0] */
+
+ /* Decrement new stack pointer value before loading it into sp. */
+ /* The top 64 bytes of the stack are reserved for the kernel, to */
+ /* save the 8 local and 8 in registers into, on context switches, */
+ /* interrupts, traps, etc. */
+
+ asm("save %o1,-96, %sp"); /* load %sp from %o1 */
+ new_context(0,0);
+ syserr("new_context() returned in coswitch");
+
+ } else {
+ asm("ld [%fp+0x48], %o0"); /* load new_cs into %o0 */
+ asm("ld [%o0+0x4],%fp"); /* Load frame pointer */
+ asm("ld [%o0+0x8],%i7"); /* Load return address */
+ asm("ld [%o0],%sp"); /* Load user stack pointer */
+ }
+}
diff --git a/config/linux/status b/config/linux/status
new file mode 100644
index 0000000..499c0fa
--- /dev/null
+++ b/config/linux/status
@@ -0,0 +1,41 @@
+System configuration:
+
+ Linux (on all hardware platforms)
+
+Latest Icon version:
+
+ Version 9.4.3
+
+Installer:
+
+ Gregg Townsend
+ Icon Project
+ The University of Arizona
+
+ with special thanks to Christian Hudon for additional testing
+
+Missing features:
+
+ None
+
+Known bugs:
+
+ None on x86, amd64, Alpha, SPARC, ARM, s390, or m68k.
+
+ On PowerPC: Large integers don't work; the cause is unknown.
+
+ On HP PA-RISC architecture: Icon is not functional. For
+ reasons that are not understood, real (floating-point)
+ values do not work.
+
+Comments:
+
+ Tested on x86 and amd64 architectures under Red Hat 9,
+ Fedora 3, and Fedora 4.
+
+ This configuration can use pthreads for context switching.
+ On some architectures that is the only option.
+
+Date:
+
+ November 8, 2005
diff --git a/config/macintosh/Makedefs b/config/macintosh/Makedefs
new file mode 100644
index 0000000..381b077
--- /dev/null
+++ b/config/macintosh/Makedefs
@@ -0,0 +1,21 @@
+# CC C compiler
+# CFLAGS flags for building C files
+# CFDYN additional flags for dynamic functions
+# RLINK flags for linking run-time system
+# RLIBS libraries to link with run-time system
+# TLIBS libraries to link for POSIX threads
+# XLIBS libraries to link for graphics
+# XPMDEFS definitions for building XPM library
+# GDIR directory of graphics helper library
+# SFLAGS flags for stripping iconx
+
+CC = cc
+CFLAGS = -I/usr/X11R6/include
+CFDYN =
+RLINK = -dynamic
+RLIBS = -lm
+TLIBS =
+XLIBS = -L/usr/X11R6/lib -lX11
+XPMDEFS = -DZPIPE -I/usr/X11R6/include
+GDIR = xpm
+SFLAGS = -Sx
diff --git a/config/macintosh/define.h b/config/macintosh/define.h
new file mode 100644
index 0000000..e1857dd
--- /dev/null
+++ b/config/macintosh/define.h
@@ -0,0 +1,8 @@
+/*
+ * Icon configuration file for Macintosh
+ */
+
+#define UNIX 1
+#define LoadFunc
+
+#define NamedSemaphores /* unnamed sempahores not implemented by OS 10.4 */
diff --git a/config/macintosh/powerpc.s b/config/macintosh/powerpc.s
new file mode 100644
index 0000000..71724a6
--- /dev/null
+++ b/config/macintosh/powerpc.s
@@ -0,0 +1,52 @@
+# coswitch(old, new, first)
+# GPR3 GPR4 GPR5
+
+# This code is modeled after the ppc_aix context switch
+# it was compared to the Darwin context switch routine to
+# get the syntax correct for the Apple gcc compiler.
+.macro ENTRY
+ .text
+ .align 2
+ .globl $0
+$0:
+.endmacro
+
+ .file "rswitch.s"
+ .set RSIZE, 80 ; room for regs 13-31, rounded up mod16
+
+ ENTRY _coswitch
+
+ stwu r1, -RSIZE(r1) ; allocate stack frame
+
+ ; Save Old Context:
+ stw r1, 0(r3) ; SP
+ stw r2, 4(r3) ; TOC
+ mflr r0
+ stw r0, 8(r3) ; LR (return address)
+ mfcr r0
+ stw r0, 12(r3) ; CR
+ stmw r13, -RSIZE(r1) ; GPRs 13-31 (save on stack)
+
+ cmpi 0, r5, 0
+ beq first ; if first time
+
+ ; Restore new context:
+ lwz r1, 0(r4) ; SP
+ lwz r2, 4(r4) ; TOC
+ lwz r0, 8(r4) ; LR
+ mtlr r0
+ lwz r0, 12(r4) ; CR
+ mtcr r0
+ lmw r13, -RSIZE(r1) ; GPRs 13-31 (from stack)
+
+ addic r1, r1, RSIZE ; deallocate stack frame
+ blr ; return into new context
+
+first: ; First-time call:
+ lwz r1, 0(r4) ; SP as figured by Icon
+ addic r1, r1, -64 ; save area for callee
+ addi r3, 0, 0 ; arg1
+ addi r4, 0, 0 ; arg2
+ bl _new_context ; new_context(0,0)
+ addi r3, 0, 0
+ bl _syserr
diff --git a/config/macintosh/status b/config/macintosh/status
new file mode 100644
index 0000000..43dffac
--- /dev/null
+++ b/config/macintosh/status
@@ -0,0 +1,43 @@
+System configuration:
+
+ Apple Macintosh running OS X (10.1 or newer)
+
+Latest Icon version:
+
+ Version 9.4.3
+
+Installer:
+
+ Gregg Townsend
+ Icon Project
+ The University of Arizona
+
+Missing features:
+
+ None
+
+Known bugs:
+
+ None
+
+Comments:
+
+ See the special Macintosh page in the documentation directory.
+
+ Icon runs on Darwin, which is (loosely speaking) the
+ command-line-based Unix substructure of MacOS X. The
+ Xcode Developer Tools must be installed. (These come
+ with MacOS on a CD that is not always installed.)
+
+ An Icon installation with graphics requires the X11 window
+ system, available from Apple but not always installed.
+ To install Icon without graphics, use "make Configure"
+ instead of "make X-Configure" when building.
+
+ This configuration can use pthreads for context switching.
+
+ Tested with MacOS 10.4.3 (Tiger).
+
+Date:
+
+ November 10, 2005
diff --git a/config/posix/Makedefs b/config/posix/Makedefs
new file mode 100644
index 0000000..9959341
--- /dev/null
+++ b/config/posix/Makedefs
@@ -0,0 +1,19 @@
+# CC C compiler
+# CFLAGS flags for building C files
+# CFDYN additional flags for dynamic functions
+# RLINK flags for linking run-time system
+# RLIBS libraries to link with run-time system
+# TLIBS libraries to link for POSIX threads
+# XLIBS libraries to link for graphics
+# XPMDEFS definitions for building XPM library
+# GDIR directory of graphics helper library
+
+CC = cc
+CFLAGS = -O -I/usr/X11R6/include
+CFDYN =
+RLINK =
+RLIBS = -lm
+TLIBS = -lpthread
+XLIBS = -L/usr/X11R6/lib -lX11
+XPMDEFS = -DZPIPE -I/usr/X11R6/include
+GDIR = xpm
diff --git a/config/posix/define.h b/config/posix/define.h
new file mode 100644
index 0000000..e2d54c5
--- /dev/null
+++ b/config/posix/define.h
@@ -0,0 +1,7 @@
+/*
+ * Icon configuration file for generic POSIX system with X windows
+ */
+
+#define UNIX 1
+/* LoadFunc not implemented */
+
diff --git a/config/posix/status b/config/posix/status
new file mode 100644
index 0000000..66ee6b3
--- /dev/null
+++ b/config/posix/status
@@ -0,0 +1,29 @@
+System configuration:
+
+ Generic POSIX (Unix-like) system with X windows.
+
+Latest Icon version:
+
+ Version 9.4.3
+
+Installer:
+
+ Gregg Townsend
+ Icon Project
+ The University of Arizona
+
+Missing features:
+
+ Dynamic loading (loadfunc)
+
+Known bugs:
+
+ May need some tweaking of Makedefs for any particular system.
+
+Comments:
+
+ This configuration can be used as a starting point for new ports.
+
+Date:
+
+ November 8, 2005
diff --git a/config/pthreads.c b/config/pthreads.c
new file mode 100644
index 0000000..1ebf7c7
--- /dev/null
+++ b/config/pthreads.c
@@ -0,0 +1,143 @@
+/*
+ * pthreads.c -- Icon context switch code using POSIX threads and semaphores
+ *
+ * This code implements co-expression context switching on any system that
+ * provides POSIX threads and semaphores. It requires Icon 9.4.1 or later
+ * built with "#define CoClean" in order to free threads and semaphores when
+ * co-expressions are collected. It is typically much slower when called
+ * than platform-specific custom code, but of course it is much more portable,
+ * and it is typically used infrequently.
+ *
+ * Unnamed semaphores are used unless NamedSemaphores is defined.
+ * (This is for Mac OS 10.3 which does not have unnamed semaphores.)
+ */
+
+#include <fcntl.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+#include "../h/define.h"
+
+extern void new_context(int, void *);
+extern void syserr(char *msg);
+extern void *alloc(unsigned int n);
+
+static int inited = 0; /* has first-time initialization been done? */
+
+/*
+ * Define a "context" struct to hold the thread information we need.
+ */
+typedef struct {
+ pthread_t thread; /* thread ID (thread handle) */
+ sem_t sema; /* synchronization semaphore (if unnamed) */
+ sem_t *semp; /* pointer to semaphore */
+ int alive; /* set zero when thread is to die */
+ } context;
+
+static void makesem(context *ctx);
+static void *nctramp(void *arg);
+
+/*
+ * Treat an Icon "cstate" array as an array of context pointers.
+ * cstate[0] is used by Icon code that thinks it's setting a stack pointer.
+ * We use cstate[1] to point to the actual context struct.
+ * (Both of these are initialized to NULL by Icon 9.4.1 or later.)
+ */
+typedef context **cstate;
+
+/*
+ * coswitch(old, new, first) -- switch contexts.
+ */
+int coswitch(void *o, void *n, int first) {
+
+ cstate ocs = o; /* old cstate pointer */
+ cstate ncs = n; /* new cstate pointer */
+ context *old, *new; /* old and new context pointers */
+
+ if (inited) /* if not first call */
+ old = ocs[1]; /* load current context pointer */
+ else {
+ /*
+ * This is the first coswitch() call.
+ * Allocate and initialize the context struct for &main.
+ */
+ old = ocs[1] = alloc(sizeof(context));
+ makesem(old);
+ old->thread = pthread_self();
+ old->alive = 1;
+ inited = 1;
+ }
+
+ if (first != 0) /* if not first call for this cstate */
+ new = ncs[1]; /* load new context pointer */
+ else {
+ /*
+ * This is a newly allocated cstate array.
+ * Allocate and initialize a context struct.
+ */
+ new = ncs[1] = alloc(sizeof(context));
+ makesem(new);
+ if (pthread_create(&new->thread, NULL, nctramp, new) != 0)
+ syserr("cannot create thread");
+ new->alive = 1;
+ }
+
+ sem_post(new->semp); /* unblock the new thread */
+ sem_wait(old->semp); /* block this thread */
+
+ if (!old->alive)
+ pthread_exit(NULL); /* if unblocked because unwanted */
+ return 0; /* else return to continue running */
+ }
+
+/*
+ * coclean(old) -- clean up co-expression state before freeing.
+ */
+void coclean(void *o) {
+ cstate ocs = o; /* old cstate pointer */
+ context *old = ocs[1]; /* old context pointer */
+ if (old == NULL) /* if never initialized, do nothing */
+ return;
+ old->alive = 0; /* signal thread to exit */
+ sem_post(old->semp); /* unblock it */
+ pthread_join(old->thread, NULL); /* wait for thread to exit */
+ #ifdef NamedSemaphores
+ sem_close(old->semp); /* close associated semaphore */
+ #else
+ sem_destroy(old->semp); /* destroy associated semaphore */
+ #endif
+ free(old); /* free context block */
+ }
+
+/*
+ * makesem(ctx) -- initialize semaphore in context struct.
+ */
+static void makesem(context *ctx) {
+ #ifdef NamedSemaphores /* if cannot use unnamed semaphores */
+ char name[50];
+ sprintf(name, "i%ld.sem", (long)getpid());
+ ctx->semp = sem_open(name, O_CREAT, S_IRUSR | S_IWUSR, 0);
+ if (ctx->semp == (sem_t *)SEM_FAILED)
+ syserr("cannot create semaphore");
+ sem_unlink(name);
+ #else /* NamedSemaphores */
+ if (sem_init(&ctx->sema, 0, 0) == -1)
+ syserr("cannot init semaphore");
+ ctx->semp = &ctx->sema;
+ #endif /* NamedSemaphores */
+ }
+
+/*
+ * nctramp() -- trampoline for calling new_context(0,0).
+ */
+static void *nctramp(void *arg) {
+ context *new = arg; /* new context pointer */
+ sem_wait(new->semp); /* wait for signal */
+ new_context(0, 0); /* call new_context; will not return */
+ syserr("new_context returned to nctramp");
+ return NULL;
+ }
diff --git a/config/setup.sh b/config/setup.sh
new file mode 100755
index 0000000..90c735d
--- /dev/null
+++ b/config/setup.sh
@@ -0,0 +1,95 @@
+#!/bin/sh
+#
+# setup.sh -- invoked by top-level Makefile
+
+USAGE="usage: setup.sh configname [No]Graphics [pthreads]"
+
+NAME=$1
+GPX=$2
+CSW=$3
+TOP=..
+SRC=$TOP/src
+
+# check parameters
+case "$GPX" in
+ Graphics) XL='-L../../bin -lIgpx $(XLIBS)';;
+ NoGraphics) XL= ;;
+ *) echo "$USAGE" 1>&2; exit 1;;
+esac
+case "$CSW" in
+ custom | "") ;;
+ pthreads) ;;
+ *) echo "$USAGE" 1>&2; exit 1;;
+esac
+
+# check that configuration exists
+if [ ! -d "$NAME" ]; then
+ echo "no configuration directory for $NAME" 1>&2
+ exit 1
+fi
+
+# find and copy the context switch code.
+# use pthreads version if specified, or as a last resort.
+# first try `uname -p`.[cs] or `uname -m`.[cs] and then rswitch.[cs].
+ARCH=`uname -p 2>/dev/null || echo unknown`
+if [ "$ARCH" = "unknown" ]; then
+ ARCH=`uname -m`
+fi
+if [ "$CSW" = "pthreads" ]; then
+ RSW=pthreads.c
+ COCLEAN="#define CoClean"
+elif [ -f "$NAME/$ARCH.c" ]; then
+ RSW="$NAME/$ARCH.c"
+ COCLEAN=
+elif [ -f "$NAME/$ARCH.s" ]; then
+ RSW="$NAME/$ARCH.s"
+ COCLEAN=
+elif [ -f $NAME/rswitch.[cs] ]; then
+ RSW=`echo $NAME/rswitch.[cs]`
+ COCLEAN=
+else
+ RSW=pthreads.c
+ COCLEAN="#define CoClean"
+fi
+case $RSW in
+ *.c) DRSW=rswitch.c;;
+ *.s) DRSW=rswitch.s;;
+esac
+cp $RSW $SRC/common/$DRSW
+
+if [ "$RSW" = "pthreads.c" ]; then
+ TL='$(TLIBS)'
+else
+ TL=
+fi
+
+RSN=`echo $RSW | sed 's=.*/=='`
+
+# build the "define.h" file
+echo "#define Config \"$NAME, $RSN\"" > $SRC/h/define.h
+echo "#define $GPX 1" >> $SRC/h/define.h
+echo "$COCLEAN" >> $SRC/h/define.h
+echo "" >> $SRC/h/define.h
+cat $NAME/define.h >> $SRC/h/define.h
+
+# build the "Makedefs" file
+echo "# from config/$NAME" > $TOP/Makedefs
+echo "" >> $TOP/Makedefs
+cat $NAME/Makedefs >> $TOP/Makedefs
+echo "" >> $TOP/Makedefs
+echo "RSW = $DRSW" >> $TOP/Makedefs
+echo "TL = $TL" >> $TOP/Makedefs
+echo "" >> $TOP/Makedefs
+echo "# $GPX" >> $TOP/Makedefs
+echo "XL = $XL" >> $TOP/Makedefs
+
+# report actions
+echo " configured $NAME"
+echo " with $GPX"
+echo " using $RSW"
+
+# run customization script, if one exists
+if [ -f $NAME/custom.sh ]; then
+ cd $NAME
+ sh custom.sh
+fi
diff --git a/config/solaris/Makedefs b/config/solaris/Makedefs
new file mode 100644
index 0000000..3f6bd24
--- /dev/null
+++ b/config/solaris/Makedefs
@@ -0,0 +1,19 @@
+# CC C compiler
+# CFLAGS flags for building C files
+# CFDYN additional flags for dynamic functions
+# RLINK flags for linking run-time system
+# RLIBS libraries to link with run-time system
+# TLIBS libraries to link for POSIX threads
+# XLIBS libraries to link for graphics
+# XPMDEFS definitions for building XPM library
+# GDIR directory of graphics helper library
+
+CC = gcc
+CFLAGS = -I/usr/openwin/include
+CFDYN = -fPIC
+RLINK =
+RLIBS = -lm -ldl
+TLIBS = -lposix4 -lpthread
+XLIBS = -L /usr/openwin/lib -Xlinker -R/usr/openwin/lib -lX11
+XPMDEFS = -DZPIPE -DSYSV
+GDIR = xpm
diff --git a/config/solaris/define.h b/config/solaris/define.h
new file mode 100644
index 0000000..12b5119
--- /dev/null
+++ b/config/solaris/define.h
@@ -0,0 +1,10 @@
+/*
+ * Icon configuration file for Sun Solaris using Gnu C compiler
+ */
+
+#define UNIX 1
+#define LoadFunc
+
+/* use gcc to compile generated code */
+#define CComp "gcc"
+#define COpts "-I/usr/openwin/include -ldl"
diff --git a/config/solaris/i386.c b/config/solaris/i386.c
new file mode 100644
index 0000000..fa88c93
--- /dev/null
+++ b/config/solaris/i386.c
@@ -0,0 +1,71 @@
+/*
+ * Coswitch for Windows using Visual C++.
+ *
+ * Written by Frank J. Lhota, based on an assembly version
+ * authored by Robert Goldberg and modified for OS/2 2.0 by Mark
+ * Emmer.
+ */
+
+#include <sys/asm_linkage.h>
+#include <sys/trap.h>
+
+/*
+ * The Windows co-expression context consists of 5 words. The
+ * following constants define the byte offsets for each of the
+ * registers stored in the context.
+ */
+
+#define SP_OFF "0"
+#define BP_OFF "4"
+#define SI_OFF "8"
+#define DI_OFF "12"
+#define BX_OFF "16"
+
+int coswitch(old, new, first)
+int *old;
+int *new;
+int first;
+{
+
+ /* Save current context to *old */
+ __asm__ __volatile__ (
+ "movl %%esp," SP_OFF "(%0)\n\t"
+ "movl %%ebp," BP_OFF "(%0)\n\t"
+ "movl %%esi," SI_OFF "(%0)\n\t"
+ "movl %%edi," DI_OFF "(%0)\n\t"
+ "movl %%ebx," BX_OFF "(%0)"
+ : : "a"( old )
+ );
+
+ if ( first )
+ {
+ /* first != 0 => restore context in *new. */
+ __asm__ __volatile__ (
+ "movl " SP_OFF "(%0),%%esp\n\t"
+ "movl " BP_OFF "(%0),%%ebp\n\t"
+ "movl " SI_OFF "(%0),%%esi\n\t"
+ "movl " DI_OFF "(%0),%%edi\n\t"
+ "movl " BX_OFF "(%0),%%ebx"
+ : : "a"( new )
+ );
+ }
+ else
+ {
+ /*
+ * first == 0 => Set things up for first activation of this
+ * coexpression. Load stack pointer from first
+ * word of *new and call new_context, which
+ * should never return.
+ */
+ __asm__ __volatile__ (
+ "movl " SP_OFF "(%0),%%esp\n\t"
+ "movl %%esp,%%ebp"
+ : : "a"( new )
+ );
+ new_context( 0, NULL );
+ syserr( "interp() returned in coswitch" );
+ }
+
+ return 0;
+}
+
diff --git a/config/solaris/sparc.c b/config/solaris/sparc.c
new file mode 100644
index 0000000..6c57a94
--- /dev/null
+++ b/config/solaris/sparc.c
@@ -0,0 +1,39 @@
+/*
+ * coswitch for Sun-4 Sparc.
+ *
+ * Compile this with 'gcc -c rswitch.c'. Do not use gcc -O.
+ */
+
+#include <sys/asm_linkage.h>
+#include <sys/trap.h>
+
+int coswitch(old_cs, new_cs, first)
+int *old_cs, *new_cs;
+int first;
+{
+ asm("ta 0x03"); /* ST_FLUSH_WINDOWS in trap.h */
+ asm("ld [%fp+0x44], %o0"); /* load old_cs into %o0 */
+ asm("st %sp,[%o0]"); /* Save user stack pointer */
+ asm("st %fp,[%o0+0x4]"); /* Save frame pointer */
+ asm("st %i7,[%o0+0x8]"); /* Save return address */
+
+ if (first == 0) { /* this is the first activation */
+ asm("ld [%fp+0x48], %o0"); /* load new_cs into %o0 */
+ asm("ld [%o0], %o1"); /* load %o1 from cstate[0] */
+
+ /* Decrement new stack pointer value before loading it into sp. */
+ /* The top 64 bytes of the stack are reserved for the kernel, to */
+ /* save the 8 local and 8 in registers into, on context switches, */
+ /* interrupts, traps, etc. */
+
+ asm("save %o1,-96, %sp"); /* load %sp from %o1 */
+ new_context(0,0);
+ syserr("new_context() returned in coswitch");
+
+ } else {
+ asm("ld [%fp+0x48], %o0"); /* load new_cs into %o0 */
+ asm("ld [%o0+0x4],%fp"); /* Load frame pointer */
+ asm("ld [%o0+0x8],%i7"); /* Load return address */
+ asm("ld [%o0],%sp"); /* Load user stack pointer */
+ }
+}
diff --git a/config/solaris/status b/config/solaris/status
new file mode 100644
index 0000000..a2a7a35
--- /dev/null
+++ b/config/solaris/status
@@ -0,0 +1,32 @@
+System configuration:
+
+ Sun Solaris using GNU C compiler
+
+Latest Icon version:
+
+ Version 9.4.3
+
+Installer:
+
+ Gregg Townsend
+ Icon Project
+ The University of Arizona
+ (with thanks to Andreas Almroth)
+
+Missing features:
+
+ None
+
+Known bugs:
+
+ None
+
+Comments:
+
+ Tested on SPARC Solaris 2.6 (SunOS 5.6) with gcc version 2.95.3.
+ Tested on SPARC Solaris 9 (SunOS 5.9) with gcc version 3.4.1.
+ Tested on x86 Schillix 0.2.1 with gcc version 3.4.3.
+
+Date:
+
+ November 10, 2005
diff --git a/config/solaris_sunc/Makedefs b/config/solaris_sunc/Makedefs
new file mode 100644
index 0000000..e5bb495
--- /dev/null
+++ b/config/solaris_sunc/Makedefs
@@ -0,0 +1,19 @@
+# CC C compiler
+# CFLAGS flags for building C files
+# CFDYN additional flags for dynamic functions
+# RLINK flags for linking run-time system
+# RLIBS libraries to link with run-time system
+# TLIBS libraries to link for POSIX threads
+# XLIBS libraries to link for graphics
+# XPMDEFS definitions for building XPM library
+# GDIR directory of graphics helper library
+
+CC = cc
+CFLAGS = -O -w -I/usr/openwin/include
+CFDYN = -KPIC
+RLINK =
+RLIBS = -lm -ldl
+TLIBS = -lposix4 -lpthread
+XLIBS = -L /usr/openwin/lib -R/usr/openwin/lib -lX11
+XPMDEFS = -DZPIPE -DSYSV
+GDIR = xpm
diff --git a/config/solaris_sunc/define.h b/config/solaris_sunc/define.h
new file mode 100644
index 0000000..d4789bb
--- /dev/null
+++ b/config/solaris_sunc/define.h
@@ -0,0 +1,9 @@
+/*
+ * Icon configuration file for Solaris 2.x with SunPro C compiler
+ */
+
+#define UNIX 1
+#define LoadFunc
+
+#define CComp "cc"
+#define COpts "-I/usr/openwin/include -ldl"
diff --git a/config/solaris_sunc/sparc.c b/config/solaris_sunc/sparc.c
new file mode 100644
index 0000000..b712211
--- /dev/null
+++ b/config/solaris_sunc/sparc.c
@@ -0,0 +1,37 @@
+/*
+ * coswitch for Sun-4 Sparc.
+ */
+
+#include <sys/asm_linkage.h>
+#include <sys/trap.h>
+
+int coswitch(old_cs, new_cs, first)
+int *old_cs, *new_cs;
+int first;
+{
+ asm("ta 0x03"); /* ST_FLUSH_WINDOWS in trap.h */
+ asm("ld [%fp+0x44], %o0"); /* load old_cs into %o0 */
+ asm("st %sp,[%o0]"); /* Save user stack pointer */
+ asm("st %fp,[%o0+0x4]"); /* Save frame pointer */
+ asm("st %i7,[%o0+0x8]"); /* Save return address */
+
+ if (first == 0) { /* this is the first activation */
+ asm("ld [%fp+0x48], %o0"); /* load new_cs into %o0 */
+ asm("ld [%o0], %o1"); /* load %o1 from cstate[0] */
+
+ /* Decrement new stack pointer value before loading it into sp. */
+ /* The top 64 bytes of the stack are reserved for the kernel, to */
+ /* save the 8 local and 8 in registers into, on context switches, */
+ /* interrupts, traps, etc. */
+
+ asm("save %o1,-96, %sp"); /* load %sp from %o1 */
+ new_context(0,0);
+ syserr("new_context() returned in coswitch");
+
+ } else {
+ asm("ld [%fp+0x48], %o0"); /* load new_cs into %o0 */
+ asm("ld [%o0+0x4],%fp"); /* Load frame pointer */
+ asm("ld [%o0+0x8],%i7"); /* Load return address */
+ asm("ld [%o0],%sp"); /* Load user stack pointer */
+ }
+}
diff --git a/config/solaris_sunc/status b/config/solaris_sunc/status
new file mode 100644
index 0000000..54d26dc
--- /dev/null
+++ b/config/solaris_sunc/status
@@ -0,0 +1,32 @@
+System configuration:
+
+ Sun Solaris 2.x with the Sun WorkShop compiler
+
+Latest Icon version:
+
+ Version 9.4.3
+
+Installer:
+
+ Gregg Townsend
+ Icon Project
+ The University of Arizona
+
+Missing features:
+
+ None
+
+Known bugs:
+
+ None
+
+Comments:
+
+ Tested on Sun SPARC systems running Solaris 2.6 (WorkShop C 4.2)
+ and Solaris 9 (WorkShop C 5.0).
+
+ This configuration can use pthreads for context switching.
+
+Date:
+
+ November 8, 2005
diff --git a/config/tru64/Makedefs b/config/tru64/Makedefs
new file mode 100644
index 0000000..051dbf5
--- /dev/null
+++ b/config/tru64/Makedefs
@@ -0,0 +1,19 @@
+# CC C compiler
+# CFLAGS flags for building C files
+# CFDYN additional flags for dynamic functions
+# RLINK flags for linking run-time system
+# RLIBS libraries to link with run-time system
+# TLIBS libraries to link for POSIX threads
+# XLIBS libraries to link for graphics
+# XPMDEFS definitions for building XPM library
+# GDIR directory of graphics helper library
+
+CC = c89
+CFLAGS = -O
+CFDYN =
+RLINK = -oldstyle_liblookup
+RLIBS = -lm
+TLIBS = -lrt -lpthread
+XLIBS = -lX11
+XPMDEFS = -DZPIPE -DSYSV
+GDIR = xpm
diff --git a/config/tru64/define.h b/config/tru64/define.h
new file mode 100644
index 0000000..78cee03
--- /dev/null
+++ b/config/tru64/define.h
@@ -0,0 +1,10 @@
+/*
+ * Icon configuration file for Dec Alpha running OSF (Digital Unix)
+ */
+
+/* standard Unix and C */
+#define UNIX 1
+#define LoadFunc
+
+/* c89 is ANSI C compiler */
+#define CComp "c89"
diff --git a/config/tru64/rswitch.s b/config/tru64/rswitch.s
new file mode 100644
index 0000000..a4589d4
--- /dev/null
+++ b/config/tru64/rswitch.s
@@ -0,0 +1,46 @@
+/*
+ * coswitch(old_cs, new_cs, first) for Dec Alpha architecture
+ * $16 $17 $18
+ */
+ .data
+errmsg: .ascii "new_context() returned in coswitch\X00"
+
+ .text
+ .globl coswitch
+ .ent coswitch
+coswitch:
+ lda $sp, -72($sp) /* make room on stack */
+ stq $sp, 0($16) /* save stack pointer */
+ stq $9, 0($sp) /* save registers on stack */
+ stq $10, 8($sp)
+ stq $11, 16($sp)
+ stq $12, 24($sp)
+ stq $13, 32($sp)
+ stq $14, 40($sp)
+ stq $15, 48($sp)
+ stq $27, 56($sp)
+ stq $26, 64($sp) /* return address */
+ beq $18, first /* if first time */
+
+ ldq $sp, 0($17) /* load new stack pointer */
+ ldq $9, 0($sp) /* load registers from stack */
+ ldq $10, 8($sp)
+ ldq $11, 16($sp)
+ ldq $12, 24($sp)
+ ldq $13, 32($sp)
+ ldq $14, 40($sp)
+ ldq $15, 48($sp)
+ ldq $27, 56($sp)
+ ldq $26, 64($sp) /* return address */
+ lda $sp, 72($sp) /* reset sp */
+ jsr_coroutine $31, ($26), 0 /* jump into new_context */
+
+first:
+ ldq $sp, 0($17) /* load stack pointer only */
+ bis $31, $31, $16 /* r16 = 0 */
+ bis $31, $31, $17 /* r17 = 0 */
+ jsr $26, new_context /* new_context(0,0) */
+ lda $16, errmsg
+ jsr $26, syserr /* shouldn't get here */
+
+ .end coswitch
diff --git a/config/tru64/status b/config/tru64/status
new file mode 100644
index 0000000..15851f0
--- /dev/null
+++ b/config/tru64/status
@@ -0,0 +1,28 @@
+System configuration:
+
+ Compaq/Digital Alpha running Tru64, formerly Digital Unix or OSF/1
+
+Latest Icon version:
+
+ Version 9.4.3
+
+Installer:
+
+ Gregg Townsend
+ Icon Project
+ The University of Arizona
+
+Missing features:
+
+ None
+
+Comments:
+
+ Tested on: NekoTech "Jaguar" running Digital Unix 4.0B rev 564
+ and Compaq AlphaStation 600 running Digital Unix 4.0F rev 1229.
+
+ This configuration can use pthreads for context switching.
+
+Date:
+
+ October 5, 2005