summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to 'misc')
-rw-r--r--misc/Makefile67
-rw-r--r--misc/args.h65
-rw-r--r--misc/cext.h7
-rw-r--r--misc/cmdline.c406
-rw-r--r--misc/cmdline.h6
-rw-r--r--misc/cmu/Projects.zipbin0 -> 5881 bytes
-rw-r--r--misc/cmu/cleanup.bat53
-rw-r--r--misc/cmu/cmu-linux-install.lsp68
-rw-r--r--misc/cmu/cmuinstall.bat7
-rw-r--r--misc/cmu/cmuinstall.sh8
-rw-r--r--misc/cmu/cmuinstall2.bat10
-rw-r--r--misc/cmu/cmuinstallmac.sh40
-rw-r--r--misc/cmu/init.lsp190
-rw-r--r--misc/cmu/install-plight.sh10
-rw-r--r--misc/cmu/music.software.html189
-rw-r--r--misc/cmu/new.html189
-rw-r--r--misc/cmu/nyqide_setup.sgpbin0 -> 812 bytes
-rw-r--r--misc/cmu/nyquist_setup.sgpbin0 -> 801 bytes
-rw-r--r--misc/cmu/nyqwin_setup.sgpbin0 -> 816 bytes
-rw-r--r--misc/cmu/restore.bat17
-rw-r--r--misc/convert.c59
-rw-r--r--misc/convert.h7
-rw-r--r--misc/filelist.c222
-rw-r--r--misc/filelist.dsp109
-rw-r--r--misc/filelist.vcproj264
-rw-r--r--misc/intgen.c911
-rw-r--r--misc/intgen2.c910
-rw-r--r--misc/intgen_win32/intgen.dsp113
-rw-r--r--misc/intgen_win32/intgen.vcproj253
-rw-r--r--misc/mac-to-win.lsp41
-rw-r--r--misc/makefile.lsp679
-rw-r--r--misc/packer.c311
-rw-r--r--misc/packer.dsp109
-rw-r--r--misc/packer.vcproj268
-rw-r--r--misc/play.c90
-rw-r--r--misc/plot.c249
-rw-r--r--misc/sampleprint.c39
-rw-r--r--misc/sine.c73
-rw-r--r--misc/stdefs2.h50
-rw-r--r--misc/transfiles.lsp73
-rw-r--r--misc/unpacker.c328
-rw-r--r--misc/unpacker.dsp105
-rw-r--r--misc/unpacker.vcproj263
43 files changed, 6858 insertions, 0 deletions
diff --git a/misc/Makefile b/misc/Makefile
new file mode 100644
index 0000000..ea17c3a
--- /dev/null
+++ b/misc/Makefile
@@ -0,0 +1,67 @@
+#
+# FILE: Makefile
+# BY: Christopher Lee Fraley
+# and Roger B. Dannenberg.
+# DESC: This file builds various utilities for Nyquist
+#
+
+CC = gcc $(CFLAGS)
+
+# the unix path gets us switches.h:
+# the cmt path gets us swlogic.h:
+CFLAGS = -g -I../sys/unix -I../cmt
+
+# Directory info:
+BINPATH = .
+
+# Intgen stuff:
+intgen: cmdline.o intgen.o
+ $(CC) cmdline.o intgen.o -o $(BINPATH)/intgen
+
+cmdline.o: cext.h cmdline.h
+intgen.o: cext.h cmdline.h
+
+#sampleprint - dumb but useful
+sampleprint: sampleprint.o
+ $(CC) sampleprint.o -o $(BINPATH)/sampleprint
+
+sampleprint.o: sampleprint.c
+
+#sine
+sne: sne.o
+ $(CC) sne.o -o $(BINPATH)/sne
+
+sne.o: sne.c
+
+#play
+play: play.o
+ $(CC) play.o -o $(BINPATH)/play
+
+play.o: play.c
+
+#plot
+plot: plot.o
+ $(CC) plot.o -o $(BINPATH)/plot
+
+plot.o: plot.c
+
+#unpacker
+unpacker_o = unpacker.o convert.o
+
+unpacker: $(unpacker_o)
+ $(CC) $(unpacker_o) -o unpacker
+
+#packer
+packer_o = packer.o convert.o
+
+packer: $(packer_o)
+ $(CC) $(packer_o) -o packer
+
+clean:
+ rm -f *.o
+
+cleaner: clean
+ rm -f intgen play sine plot packer unpacker
+ rm -f *.BAK
+ rm -f *~
+
diff --git a/misc/args.h b/misc/args.h
new file mode 100644
index 0000000..dc51ef2
--- /dev/null
+++ b/misc/args.h
@@ -0,0 +1,65 @@
+/*
+ * Argument processing macros
+ * I got tired of rethinking this everytime,
+ * and 4xbsd doesn't have getopt()
+ *
+ * The following is an example of the use of this stuff
+ *
+
+#include "args.h"
+#include <stdio.h>
+
+main(argc, argv)
+char **argv;
+{
+ char *a = "a", *b = "b", *c = "c";
+ int x = 0, y = 0, z = 0;
+ ARGLOOP
+ STRINGARG(a) a = p; ENDSTRINGARG
+ STRINGARG(b) b = p; ENDSTRINGARG
+ STRINGARG(c) c = p; ENDSTRINGARG
+ FLAGARG(x) x++; ENDFLAGARG
+ FLAGARG(y) y++; ENDFLAGARG
+ FLAGARG(z) z++; ENDFLAGARG
+
+ BADARG
+ fprintf(stderr, "unknown option %c\n", *p);
+ fprintf(stderr, "Usage: usage\n");
+ exit(1);
+ ENDBADARG
+ ENDARGLOOP
+
+ Here, the remaining args are argv[0] to argv[argc - 1]
+
+ printf("a=%s b=%s c=%s x=%d y=%d z=%d\nargs:", a, b, c, x, y, z);
+ { int i; for(i = 0; i < argc; i++)
+ printf(" %s", argv[i]);
+ }
+ printf("\n");
+}
+
+ *
+ */
+
+
+#define ARGLOOP \
+ while(--argc > 0 && **++argv == '-') { \
+ register char *p; \
+ for(p = *argv + 1; *p != '\0'; p++) { \
+ switch(*p) { \
+
+#define ENDARGLOOP \
+ } \
+ } \
+nextarg:; \
+ } \
+
+#define FLAGARG(c) case c:
+#define ENDFLAGARG break;
+
+#define STRINGARG(c) case c: if(!*++p) p = *++argv, argc--;
+#define ENDSTRINGARG goto nextarg;
+
+#define BADARG default:
+#define ENDBADARG break;
+
diff --git a/misc/cext.h b/misc/cext.h
new file mode 100644
index 0000000..1d03def
--- /dev/null
+++ b/misc/cext.h
@@ -0,0 +1,7 @@
+/* cext.h -- extensions to c */
+
+#define true 1
+#define false 0
+#define private static
+#define boolean int
+#define byte unsigned char
diff --git a/misc/cmdline.c b/misc/cmdline.c
new file mode 100644
index 0000000..5302353
--- /dev/null
+++ b/misc/cmdline.c
@@ -0,0 +1,406 @@
+/* cmdline.c -- command line parsing routines */
+/*
+ * This module is designed to allow various modules to scan (and rescan)
+ * the command line for applicable arguments. The goal is to hide as
+ * much information about switches and their names as possible so that
+ * switches become more consistent across applications and so that the
+ * author of an application need not do a lot of work to provide numerous
+ * options. Instead, each module scans the command line for its own
+ * arguments.
+ *
+ * Command lines are of the following form:
+ * command -s1 -s2 opt2 -s3 arg1 arg2 -s4 opt4 arg3
+ * command @filename
+ * The @filename form reads commands of the first form from filename
+ * Note that there are three kinds of command line parameters:
+ * (1) A Switch is a "-" followed by a name, e.g. "-s1"
+ * (2) An Option is a Switch followed by a space and name, e.g. "-s2 opt2"
+ * (3) An Argument is a name by itself, e.g. "arg1"
+ * Note also that a switch followed by an argument looks just like an
+ * option, so a list of valid option names is necessary to disambiguate.
+ *
+ * A main program that uses cmdline.c should do the following:
+ * (1) create an array of pointers to strings (char *names[]) that
+ * contains every possible option name
+ * (2) create another array of pointers to strings that contains
+ * every possible switch name
+ * (2) call cl_init(switches, nsw, options, nopt, argv, argc)
+ * cl_init will report an error (to stderr) if it finds any illegal
+ * switch or option names.
+ *
+ * Afterward, switches, options, and arguments can be accessed by
+ * calling cl_switch, cl_option, and cl_arg. If cl_switch or cl_option
+ * is called with a switch name that was not mentioned in the call to
+ * cl_init, an error will result. This indicates that the application
+ * author omitted a valid switch or option name when calling cl_init.
+ * This is an error because the full set of names is needed for error
+ * checking and to distinguish arguments from options.
+ *
+ * cl_nswitch and cl_noption are similar to cl_switch and cl_option,
+ * except they each take a list of equivalent switch or option names.
+ * This makes it simple to allow both verbose (-debug) and terse (-d) names.
+ */
+
+/*****************************************************************************
+* Change Log
+* Date | Change
+*-----------+-----------------------------------------------------------------
+* 13-Jun-86 | Created Change Log
+* 6-Aug-86 | Modified for Lattice 3.0 -- use "void" to type some routines
+* 27-Dec-93 | "@file" as first arg reads command line args from file
+*****************************************************************************/
+
+#include "stdlib.h"
+#include "cext.h"
+#include "stdio.h"
+#include "ctype.h"
+#include "cmdline.h"
+#include "string.h"
+
+private char **voptions; /* valid options */
+private int noptions; /* number of options */
+private char **vswitches; /* valid switches */
+private int nswitches; /* number of switches */
+private char **argv; /* command line argument vector */
+private int argc; /* length of argv */
+
+private int cl_rdy = false; /* set to true when initialized */
+
+/*****************************************************************************
+* Routines local to this module
+*****************************************************************************/
+private void check_names();
+private int find_match();
+private int find_string();
+private void ready_check();
+void indirect_command(char *filename, char ***argvp, int *argcp, char *oldarg0);
+
+
+/****************************************************************
+* check_names
+* Inputs:
+* char *names[]: array of alternative switch or option names
+* int nnames: number of alternative switch or option names
+* char *valid[]: array of valid names
+* int nvalid: number of valid names
+* Effect:
+* Checks that all names are in validnames. If not, print
+* an error message.
+*****************************************************************/
+
+private void check_names(names, nnames, valid, nvalid)
+ char *names[];
+ int nnames;
+ char *valid[];
+ int nvalid;
+{
+ int i; /* loop counters */
+ for (i = 0; i < nnames; i++) {
+ if (find_string(names[i], valid, nvalid) >= nvalid) {
+ fprintf(stderr, "internal error detected by cmdline module:\n");
+ fprintf(stderr, "\t'%s' should be in valid lists\n", names[i]);
+ }
+ }
+}
+
+/****************************************************************
+* cl_arg
+* Inputs:
+* n: the index of the arg needed
+* Results:
+* pointer to the nth arg, or NULL if none exists
+* arg 0 is the command name
+*****************************************************************/
+
+char *cl_arg(n)
+ int n;
+{
+ int i = 1;
+ if (n <= 0) return argv[0];
+ while (i < argc) {
+ if (*argv[i] == '-') {
+ if (find_string(argv[i], voptions, noptions) < noptions)
+ i += 2; /* skip name and option */
+ else i += 1; /* skip over switch name */
+ } else if (n == 1) {
+ return argv[i];
+ } else { /* skip over argument */
+ n--;
+ i++;
+ }
+ }
+ return NULL;
+}
+
+/*****************************************************************************
+* cl_init
+* Inputs:
+* char *switches[]: array of switch names
+* int nsw: number of switch names
+* char *options[]: array of option names
+* int nopt: number of option names
+* char *av: array of command line fields (argv)
+* int ac: number of command line fields (argc)
+* Effect:
+* Checks that all command line entries are valid.
+* Saves info for use by other routines.
+* Returns:
+* True if syntax checks OK, otherwise false
+*****************************************************************************/
+
+boolean cl_init(switches, nsw, options, nopt, av, ac)
+ char *switches[];
+ int nsw;
+ char *options[];
+ int nopt;
+ char *av[];
+ int ac;
+{
+ int i; /* index into argv */
+ boolean result = true;
+
+ vswitches = switches; nswitches = nsw;
+ voptions = options; noptions = nopt;
+ argv = av; argc = ac;
+
+ if (ac == 2 && *(av[1]) == '@') {
+ /* read new args from file */
+ indirect_command(av[1] + 1, &argv, &argc, av[0]);
+ }
+
+ for (i = 1; i < argc; i++) { /* case fold lower */
+ size_t j;
+ for (j = 0; j < strlen(argv[i]); j++)
+ if (isupper(argv[i][j]))
+ argv[i][j] = tolower(argv[i][j]);
+ }
+
+ /* check command line syntax: */
+ i = 1;
+ while (i < argc) {
+ if (*argv[i] == '-') {
+ if (find_string(argv[i], voptions, noptions) < noptions) {
+ i += 1; /* skip name and option */
+ if (i < argc && *argv[i] == '-') {
+ fprintf(stderr, "missing argument after %s\n", argv[i-1]);
+ result = false;
+ i += 1;
+ }
+ } else if (find_string(argv[i], vswitches, nswitches) <
+ nswitches) {
+ i += 1; /* skip over switch name */
+ } else {
+ fprintf(stderr, "invalid switch: %s\n", argv[i]);
+ i += 1;
+ result = false;
+ }
+ } else i++; /* skip over argument */
+ }
+ cl_rdy = true;
+ return result;
+}
+
+/****************************************************************
+* cl_noption
+* Inputs:
+* char *names[]: array of alternative switch names
+* int nnames: number of alternative switch names
+* Result:
+* returns pointer to if one exists, otherwise null
+* Effect:
+* looks for pattern in command line of the form "-n s",
+* where n is a member of names. Returns pointer to s.
+* Implementation:
+* find the option name, then
+* see if the switch is followed by a string that does
+* not start with "-"
+*****************************************************************/
+
+char *cl_noption(names, nnames)
+ char *names[];
+ int nnames;
+{
+ int i; /* index of switch */
+
+ ready_check();
+ check_names(names, nnames, voptions, noptions);
+ i = find_match(names, nnames) + 1; /* point at the option */
+ if (i < argc) { /* make sure option exists */
+ if (*(argv[i]) != '-') return argv[i];
+ }
+ return NULL;
+}
+
+/*****************************************************************
+* cl_nswitch
+* Inputs:
+* char *names[]: array of alternative switch names
+* int nnames: number of alternative switch names
+* Effect:
+* Checks that names is valid.
+* Finds a pattern in command line of the form "-n", where
+* n is a member of names.
+* Result:
+* returns pointer to command line switch if one exists,
+* otherwise null
+*****************************************************************/
+
+char *cl_nswitch(names, nnames)
+ char *names[];
+ int nnames;
+{
+ int i; /* index of switch */
+
+ ready_check();
+ check_names(names, nnames, vswitches, nswitches);
+ i = find_match(names, nnames);
+ if (i < argc) return argv[i];
+ /* else */ return NULL;
+}
+
+/****************************************************************
+* cl_option
+* Inputs:
+* char *name: option name
+* Outputs:
+* returns char *: the option string if found, otherwise null
+****************************************************************/
+
+char *cl_option(name)
+ char *name;
+{
+ char *names[1]; /* array to hold name */
+
+ names[0] = name;
+ return cl_noption(names, 1);
+}
+
+/****************************************************************
+* cl_switch
+* Inputs:
+* char *name: switch name
+* Outputs:
+* boolean: true if switch found
+****************************************************************/
+
+boolean cl_switch(name)
+ char *name;
+{
+ char *names[1]; /* array to hold name */
+
+ names[0] = name;
+ return cl_nswitch(names, 1) != NULL;
+}
+
+/****************************************************************
+* find_match
+* Inputs:
+* char *names[]: array of alternative switch or option names
+* int nnames: number of alternative switch or option names
+* Effect:
+* Looks for command line switch that matches one of names.
+* Returns:
+* Index of switch if found, argc if not found.
+*****************************************************************/
+
+private int find_match(names, nnames)
+ char *names[];
+ int nnames;
+{
+ int j; /* loop counter */
+ for (j = 0; j < argc; j++) {
+ if (find_string(argv[j], names, nnames) < nnames) return j;
+ }
+ return argc;
+}
+
+/****************************************************************
+* find_string
+* Inputs:
+* char *s: string to find
+* char *names[]: array of strings
+* int nnames: number of strings
+* Effect:
+* Looks for s in names
+* Returns:
+* Index of s in names if found, nnames if not found
+*****************************************************************/
+
+private int find_string(s, names, nnames)
+ char *s;
+ char *names[];
+ int nnames;
+{
+ int i; /* loop counter */
+ for (i = 0; i < nnames; i++) {
+ if (strcmp(s, names[i]) == 0) {
+ return i;
+ }
+ }
+ return nnames;
+}
+
+boolean is_whitespace(int c)
+{
+ return c == ' ' || c == '\t' || c == '\n' || c == '\r';
+}
+
+boolean get_arg(file, arg)
+ FILE *file;
+ char *arg;
+{
+ int c;
+ while ((c = getc(file)) != EOF && is_whitespace(c)) ;
+ if (c == EOF) return false;
+ ungetc(c, file);
+ while ((c = getc(file)) != EOF && !is_whitespace(c)) {
+ *arg++ = c;
+ }
+ *arg = 0;
+ return true;
+}
+
+
+void indirect_command(filename, argvp, argcp, oldarg0)
+ char *filename;
+ char ***argvp;
+ int *argcp;
+ char *oldarg0;
+{
+ FILE *argfile = fopen(filename, "r");
+ if (!argfile) {
+ *argvp = (char **) malloc(sizeof(char *));
+ (*argvp)[0] = oldarg0;
+ *argcp = 1;
+ } else {
+ int i = 1;
+ char arg[100];
+ while (get_arg(argfile, arg)) i++;
+ fclose(argfile);
+ argfile = fopen(filename, "r");
+ *argvp = (char **) malloc(sizeof(char *) * i);
+ (*argvp)[0] = oldarg0;
+ *argcp = i;
+ i = 1;
+ while (get_arg(argfile, arg)) {
+ (*argvp)[i] = (char *) malloc(strlen(arg) + 1);
+ strcpy((*argvp)[i], arg);
+ i++;
+ }
+ }
+}
+
+
+/****************************************************************
+* ready_check
+* Effect:
+* Halt program if cl_rdy is not true.
+*****************************************************************/
+private void ready_check()
+{
+ if (!cl_rdy) {
+ fprintf(stderr,
+ "Internal error: cl_init was not called, see cmdline.c\n");
+ exit(1);
+ }
+}
diff --git a/misc/cmdline.h b/misc/cmdline.h
new file mode 100644
index 0000000..fe72b28
--- /dev/null
+++ b/misc/cmdline.h
@@ -0,0 +1,6 @@
+boolean cl_init();
+char *cl_option();
+char *cl_noption();
+boolean cl_switch();
+char *cl_nswitch();
+char *cl_arg();
diff --git a/misc/cmu/Projects.zip b/misc/cmu/Projects.zip
new file mode 100644
index 0000000..cbb4c4a
--- /dev/null
+++ b/misc/cmu/Projects.zip
Binary files differ
diff --git a/misc/cmu/cleanup.bat b/misc/cmu/cleanup.bat
new file mode 100644
index 0000000..e596d88
--- /dev/null
+++ b/misc/cmu/cleanup.bat
@@ -0,0 +1,53 @@
+rem erase everything but source so we can save sources to web
+
+cd ..\..
+
+rmdir /s /q nyqrel
+rmdir /s /q nyqrelide
+rmdir /s /q nyqrelwin
+rmdir /s /q misc\filelist_Release
+rmdir /s /q misc\packer_Release
+rmdir /s /q misc\intgen_win32
+rmdir /s /q misc\unpacker_Release
+
+del *.pac
+del *.ncb
+del unpacker.exe
+del packer.exe
+del mt.dep
+del jnyqide\*.class
+del nyquist.exe
+del jnyqide\*.jar
+del *.jar
+
+rmdir /s /q ..\nyquist-backup
+mkdir ..\nyquist-backup
+move idesetup ..\nyquist-backup
+move winsetup ..\nyquist-backup
+move setup ..\nyquist-backup
+
+move NyqWinDebug ..\nyquist-backup
+move NyqWinRel ..\nyquist-backup
+move WinDebug ..\nyquist-backup
+move WinRel ..\nyquist-backup
+move portaudio_test ..\nyquist-backup
+move jones ..\nyquist-backup
+move sjlib_103_DOS.tgz ..\nyquist-backup
+move sjlib_DOS_104.tgz ..\nyquist-backup
+move demos\plight ..\nyquist-backup
+move nyqide ..\nyquist-backup
+
+del nyqide\nyquist.exe
+del nyquist.opt
+
+rmdir /s /q misc\filelist_Debug
+rmdir /s /q misc\intgen_Win32\WinDebug
+rmdir /s /q misc\packer_Debug
+rmdir /s /q misc\unpacker_Debug
+rmdir /s /q liblo\ser-to-osc\Debug
+rmdir /s /q liblo\ser-to-osc\Release
+rmdir /s /q liblo\test-client\Debug
+rmdir /s /q liblo\test-client\Release
+
+cd misc\cmu
+
diff --git a/misc/cmu/cmu-linux-install.lsp b/misc/cmu/cmu-linux-install.lsp
new file mode 100644
index 0000000..eb00f13
--- /dev/null
+++ b/misc/cmu/cmu-linux-install.lsp
@@ -0,0 +1,68 @@
+;; edit music.software.html and copy zip file to web
+
+;; where is the html page for nyquist downloads?:
+(setf ny-web-path "/afs/cs/project/music/web/")
+;; where are the actual nyquist download files:
+(setf ny-web-bin-path "/afs/cs/project/music/web/nyquist/")
+
+(defun ny-web (file) (strcat ny-web-path file))
+
+;; verbose version of SYSTEM
+;;
+(defun vsystem (cmd)
+ (format t "system command: ~A~%" cmd)
+ (system cmd))
+
+(defun linux-edit-music-software-html ()
+ (let (inf outf input i prefix postfix postfix1 postfix2)
+ (setf inf (open (ny-web "music.software.html")))
+ (setf outf (open (ny-web "new.html") :direction :output))
+ (format t "Major version number (e.g. 2): ")
+ (setf *maj* (read))
+ (format t "Minor version number (e.g. 27): ")
+ (setf *min* (read))
+
+ ;; find "source code for Linux"
+ (print "source code for Linux")
+ (setf input (read-line inf))
+ (while (not (setf i (string-search "source code for Linux" input)))
+ (format outf "~A~%" input)
+ (setf input (read-line inf)))
+ ;; now we have the line with the reference to the zip file and
+ ;; also the text description, but we have to find the text to change
+ ;; (ignore the variable i, it's the wrong location to change)
+ (setf i (string-search "nyquist/nyquist" input))
+ (setf prefix (subseq input 0 (+ i 15)))
+ (setf postfix (subseq input (+ i 15)))
+ (setf i (string-search ".zip" postfix))
+ (setf postfix (subseq postfix i))
+ (setf i (string-search "(v" postfix))
+ (setf postfix1 (subseq postfix 0 (+ i 2)))
+ (setf postfix2 (subseq postfix (+ i 2)))
+ (setf i (string-search ")" postfix2))
+ (setf postfix2 (subseq postfix2 i))
+ (format outf "~A~A~A~A~A.~A~A~%" prefix *maj* *min*
+ postfix1 *maj* *min* postfix2)
+
+ (setf input (read-line inf))
+ (while input
+ (format outf "~A~%" input)
+ (setf input (read-line inf)))
+
+ (close inf)
+ (close outf)
+
+ (vsystem (strcat "rm " (ny-web "music.software.html")))
+ (vsystem (strcat "mv " (ny-web "new.html") " "
+ (ny-web "music.software.html")))
+ (vsystem (format nil "cp ../nyquist.zip ~Anyquist~A~A.zip"
+ ny-web-bin-path *maj* *min*))
+ (vsystem (format nil "mv ../release.pac nyquist~A~A.pac" *maj* *min*))
+
+ ))
+
+(linux-edit-music-software-html)
+
+
+(exit)
+
diff --git a/misc/cmu/cmuinstall.bat b/misc/cmu/cmuinstall.bat
new file mode 100644
index 0000000..f6306f6
--- /dev/null
+++ b/misc/cmu/cmuinstall.bat
@@ -0,0 +1,7 @@
+rem run this to update the nyquist website
+
+copy q:\web\music.software.html music.software.html
+rem edit music.software.html and build install.bat
+del /q cmuinstall2.bat
+..\..\winrel\nyquist.exe
+cmuinstall2.bat
diff --git a/misc/cmu/cmuinstall.sh b/misc/cmu/cmuinstall.sh
new file mode 100644
index 0000000..3a527ca
--- /dev/null
+++ b/misc/cmu/cmuinstall.sh
@@ -0,0 +1,8 @@
+
+# source this to update the nyquist website
+
+scp rbd@linux.gp.cs.cmu.edu:music/web/music.software.html music.software.html
+# edit music.software.html and build install.bat
+rm -f cmuinstall2.sh
+../../ny
+s cmuinstall2.sh
diff --git a/misc/cmu/cmuinstall2.bat b/misc/cmu/cmuinstall2.bat
new file mode 100644
index 0000000..93f7fa6
--- /dev/null
+++ b/misc/cmu/cmuinstall2.bat
@@ -0,0 +1,10 @@
+copy ..\..\setup\setupnyqrun.exe q:\web\nyquist\setupnyqrun231.exe
+copy ..\..\setup\setupnyqwinrun.exe q:\web\nyquist\setupnyqwinrun231.exe
+copy ..\..\setup\setupnyqiderun.exe q:\web\nyquist\setupnyqiderun231.exe
+copy new.html q:\web\music.software.html
+call cleanup.bat
+echo "In d:\rbd, make nyquist.zip from nyquist now...then type return to the pause..."
+pause
+move ..\..\..\nyquist.zip ..\..\..\nyquist231.zip
+copy ..\..\..\nyquist231.zip q:\web\nyquist\nyqsrc231.zip
+call restore.bat
diff --git a/misc/cmu/cmuinstallmac.sh b/misc/cmu/cmuinstallmac.sh
new file mode 100644
index 0000000..3f6ae1d
--- /dev/null
+++ b/misc/cmu/cmuinstallmac.sh
@@ -0,0 +1,40 @@
+# cmuinstallmac.sh -- to update website with Mac OS X version of Nyquist
+# run this like this: source cmuinstallmac.sh
+
+ls ~/nyquist/*/*~
+echo "build jNyqIDE deployment project with Xcode and type return"
+read
+mkdir -p ~/tmp/Applications
+cd ~/tmp/Applications
+## can't remove and replace plight -- if you do, it won't work.
+## I don't know why. Also, the following fails without sudo...
+# rm -rf NyquistIDE.app/Contents/Resources/Java/demos/plight
+rm -rf nyquist
+mkdir nyquist
+mkdir nyquist/doc
+cp ~/nyquist/doc/* nyquist/doc
+echo "type the version string, e.g. \"232\" : "
+read versionstring
+tar cvfz "nyqosx"$versionstring".tgz" ~/nyquist/macosxproject/build/Deployment/NyquistIDE.app nyquist
+mv nyqosx*.tgz ~/nyquist
+# Make source release
+cd ~/nyquist
+rm -rf nyquist
+svn export -r BASE . nyquist
+rm -rf nyquist/demos/plight
+zip -r "nyqsrc"$versionstring".zip" nyquist
+# THE FOLLOWING PUTS THE VERSION AT CMU, BUT NOW RELEASES GO TO SOURCEFORGE
+#scp "nyqosx"$versionstring".tgz" rbd@linux.gp.cs.cmu.edu:music/web/nyquist/
+# HERE IS THE LINE FOR SOURCEFORGE
+#echo "when sftp connects..."
+#echo "> put nyqosx"$versionstring".tgz"
+#echo "> put nyqsrc"$versionstring".zip"
+#echo "> exit"
+#sftp rbd@frs.sourceforge.net
+#echo "after sftp'ing mac, windows, and source release files, go to"
+#echo "Admin : File Releases : Add Release to make a new release"
+
+echo go to sourceforge.net/projects/nyquist, Files, open nyquist
+echo Add Folder for current version, click the folder to open it
+echo Add File and browse to ~/nyquist/nyqsrcNNN.zip
+echo Add File and browse to ~/nyquist/nyqosxNNN.zip
diff --git a/misc/cmu/init.lsp b/misc/cmu/init.lsp
new file mode 100644
index 0000000..191614f
--- /dev/null
+++ b/misc/cmu/init.lsp
@@ -0,0 +1,190 @@
+;; edit music.software.html and make install.bat
+
+(load "nyinit.lsp")
+
+;; see if we are running on Windows
+(setf *windowsp* (not (null (listdir "WinRel"))))
+
+(setf *remote* (if *windowsp* "q:\\web" "rbd@linux.gp.cs.cmu.edu:music/web"))
+
+(defun edit-music-software-html ()
+ (let (inf outf input i prefix postfix postfix1 postfix2)
+ (setf inf (open "music.software.html"))
+ (if (null inf) (error "could not open music.software.html"))
+ (setf outf (open "new.html" :direction :output))
+ (if (null outf) (error "could not open new.html for output"))
+ (format t "Major version number (e.g. 2): ")
+ (setf *maj* (read))
+ (format t "Minor version number (e.g. 27): ")
+ (setf *min* (read))
+
+ ;; find version in heading
+ (print "find Executables")
+ (setf input (read-line inf))
+ (while (not (setf i (string-search "Executables (v" input)))
+ (format outf "~A~%" input)
+ (setf input (read-line inf)))
+ (setf prefix (subseq input 0 (+ i 14)))
+ (setf postfix (subseq input (+ i 14)))
+ (setf i (string-search ")" postfix))
+ (setf postfix (subseq postfix i))
+ (format outf "~A~A.~A~A~%" prefix *maj* *min* postfix)
+
+ ;; find nyquist/setupnyqrun
+ (print "find nyquist/setupnyqrun")
+ (setf input (read-line inf))
+ (while (not (setf i (string-search "nyquist/setupnyqrun" input)))
+ (format outf "~A~%" input)
+ (setf input (read-line inf))
+ ;(display "finding nyquist/setupnyqrun" input)
+ )
+ (setf prefix (subseq input 0 (+ i 19)))
+ (setf postfix (subseq input (+ i 19)))
+ (setf i (string-search "\">" postfix))
+ (setf postfix (subseq postfix i))
+ (format outf "~A~A~A.exe~A~%" prefix *maj* *min* postfix)
+
+ ;; find nyquist/setupnyqwinrun
+; (print "find nyquist/setupnyqwinrun")
+; (setf input (read-line inf))
+; (while (not (setf i (string-search "nyquist/setupnyqwinrun" input)))
+; (format outf "~A~%" input)
+; (setf input (read-line inf)))
+; (setf prefix (subseq input 0 (+ i 22)))
+; (setf postfix (subseq input (+ i 22)))
+; (setf i (string-search "\">" postfix))
+; (setf postfix (subseq postfix i))
+; (format outf "~A~A~A.exe~A~%" prefix *maj* *min* postfix)
+
+ ;; find nyquist/setupnyqiderun
+ (print "find nyquist/setupnyqiderun")
+ (setf input (read-line inf))
+ (while (not (setf i (string-search "nyquist/setupnyqiderun" input)))
+ (format outf "~A~%" input)
+ (setf input (read-line inf)))
+ (setf prefix (subseq input 0 (+ i 22)))
+ (setf postfix (subseq input (+ i 22)))
+ (setf i (string-search "\">" postfix))
+ (setf postfix (subseq postfix i))
+ (format outf "~A~A~A.exe~A~%" prefix *maj* *min* postfix)
+
+ ;; find nyquist/nyqosx
+ (print "find nyquist/nyqosx")
+ (setf input (read-line inf))
+ (while (not (setf i (string-search "nyquist/nyqosx" input)))
+ (format outf "~A~%" input)
+ (setf input (read-line inf)))
+ (setf prefix (subseq input 0 (+ i 14)))
+ (setf postfix (subseq input (+ i 14)))
+ (setf i (string-search ".tgz" postfix))
+ (setf postfix (subseq postfix i))
+ (setf i (string-search "(v" postfix))
+ (setf postfix1 (subseq postfix 0 (+ i 2)))
+ (setf postfix2 (subseq postfix (+ i 2)))
+ (setf i (string-search ")" postfix2))
+ (setf postfix2 (subseq postfix2 i))
+ (format outf "~A~A~A~A~A.~A~A~%" prefix *maj* *min*
+ postfix1 *maj* *min* postfix2)
+
+ ;; find <tt>nyqosx
+ (print "find <tt>nyqosx")
+ (setf input (read-line inf))
+ (while (not (setf i (string-search "<tt>nyqosx" input)))
+ (format outf "~A~%" input)
+ (setf input (read-line inf)))
+ (setf prefix (subseq input 0 (+ i 10)))
+ (setf postfix (subseq input (+ i 10)))
+ (setf i (string-search "</tt>" postfix))
+ (setf postfix (subseq postfix i))
+ (format outf "~A~A~A~A~%" prefix *maj* *min* postfix)
+
+ ;; find nyquist/nyqsrc
+ (print "find nyquist/nyqsrc")
+ (setf input (read-line inf))
+ (while (not (setf i (string-search "nyquist/nyqsrc" input)))
+ (format outf "~A~%" input)
+ (setf input (read-line inf)))
+ (setf prefix (subseq input 0 (+ i 14)))
+ (setf postfix (subseq input (+ i 14)))
+ (setf i (string-search ".zip" postfix))
+ (setf postfix (subseq postfix i))
+ (setf i (string-search "(v" postfix))
+ (setf postfix1 (subseq postfix 0 (+ i 2)))
+ (setf postfix2 (subseq postfix (+ i 2)))
+ (setf i (string-search ")" postfix2))
+ (setf postfix2 (subseq postfix2 i))
+ (format outf "~A~A~A~A~A.~A~A~%" prefix *maj* *min*
+ postfix1 *maj* *min* postfix2)
+
+ (setf input (read-line inf))
+ (while input
+ (format outf "~A~%" input)
+ (setf input (read-line inf)))
+
+ (close inf)
+ (close outf)
+ ))
+
+; "
+
+(defun make-install-bat ()
+ (let (outf)
+ (setf outf (open "cmuinstall2.bat" :direction :output))
+ (format outf "copy ..\\..\\setup\\setupnyqrun.exe ~A\\nyquist\\setupnyqrun~A~A.exe~%"
+ *remote* *maj* *min*)
+; (format outf "copy ..\\..\\setup\\setupnyqwinrun.exe ~A\\nyquist\\setupnyqwinrun~A~A.exe~%"
+; *remote* *maj* *min*)
+ (format outf "copy ..\\..\\setup\\setupnyqiderun.exe ~A\\nyquist\\setupnyqiderun~A~A.exe~%"
+ *remote* *maj* *min*)
+ (format outf "copy new.html ~A\\music.software.html~%" *remote*)
+ (format outf "call cleanup.bat~%")
+ (format outf "echo \"In d:\\rbd, make nyquist.zip from nyquist now...then type return to the pause...\"~%")
+ (format outf "pause~%")
+ (format outf "move ..\\..\\..\\nyquist.zip ..\\..\\..\\nyquist~A~A.zip~%" *maj* *min*)
+ (format outf "copy ..\\..\\..\\nyquist~A~A.zip ~A\\nyquist\\nyqsrc~A~A.zip~%"
+ *maj* *min* *remote* *maj* *min*)
+ (format outf "call restore.bat~%")
+ (close outf)))
+
+(defun make-install-sh ()
+ (let (outf)
+ (setf outf (open "cmuinstall2.sh" :direction :output))
+ (format outf "echo \"Make sure /Volumes/rbd is mounted...then type return\"~%")
+ (format outf "read~%");
+ (format outf "scp /Volumes/rbd/nyquist/setup/setupnyqrun.exe ~A/nyquist/setupnyqrun~A~A.exe~%"
+ *remote* *maj* *min*)
+; (format outf "scp /Volumes/rbd/nyquist/setup/setupnyqwinrun.exe ~A/nyquist/setupnyqwinrun~A~A.exe~%"
+; *remote* *maj* *min*)
+ (format outf "scp /Volumes/rbd/nyquist/setup/setupnyqiderun.exe ~A/nyquist/setupnyqiderun~A~A.exe~%"
+ *remote* *maj* *min*)
+ (format outf "scp new.html ~A/music.software.html~%" *remote*)
+#|
+ ;; this is the old way to make a source zip file
+ (format outf "echo \"In e:\\rbd\\nyquist\\misc\\cmu, run cleanup.bat now...then type return to the pause...\"~%")
+ (format outf "read~%")
+ (format outf "echo \"In e:\\rbd, make nyquist.zip from nyquist now...then type return to the pause...\"~%")
+ (format outf "read~%")
+ (format outf "mv /Volumes/rbd/nyquist.zip /Volumes/rbd/nyquist~A~A.zip~%" *maj* *min*)
+ (format outf "scp /Volumes/rbd/nyquist~A~A.zip ~A/nyquist/nyqsrc~A~A.zip~%"
+ *maj* *min* *remote* *maj* *min*)
+ (format outf "echo \"In e:\\rbd\\nyquist\\misc\\cmu, run restore.bat now...then type return to the pause...\"~%")
+|#
+ ;; this is the new way to make a source zip file
+ (format outf "echo making source zip file...\n")
+ (format outf "cd ../..\n")
+ (format outf "cvs export -DNOW nyquist\n")
+ (format outf "rm -rf nyquist/demos/plight\n")
+ (format outf "zip -r nyquist.zip nyquist\n")
+ (format outf "scp nyquist.zip ~A/nyquist/nyqsrc~A~A.zip~%"
+ *remote* *maj* *min*)
+ (format outf "rm -rf nyquist.zip nyquist\n")
+ (format outf "cd misc/cmu\n")
+ (format outf "read~%")
+ (close outf)))
+
+(edit-music-software-html)
+(if *windowsp* (make-install-bat) (make-install-sh))
+
+
+(exit)
+
diff --git a/misc/cmu/install-plight.sh b/misc/cmu/install-plight.sh
new file mode 100644
index 0000000..c71830e
--- /dev/null
+++ b/misc/cmu/install-plight.sh
@@ -0,0 +1,10 @@
+#
+# this is a script to post the plight drum machine to the web
+#
+# usage: on the Mac, source install-plight.sh
+#
+cd ../../demos
+zip -r plight.zip plight
+scp plight.zip rbd@linux.gp.cs.cmu.edu:music/web/nyquist/plight-1.zip
+rm plight.zip
+cd ../misc/cmu
diff --git a/misc/cmu/music.software.html b/misc/cmu/music.software.html
new file mode 100644
index 0000000..c8b1314
--- /dev/null
+++ b/misc/cmu/music.software.html
@@ -0,0 +1,189 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]">
+ <title>The Computer Music Project Software</title>
+</head>
+<body>
+
+<h1>
+The Computer Music Project Software</h1>
+
+<h2>
+<img SRC="portmusic-icon.gif" align=TOP> PortMusic</h2>
+<a href="portmusic">Information about PortMusic</a>
+<h2>
+Aura</h2>
+Aura is not available for general distribution, but you can <a href="http://www.cs.cmu.edu/~music/aura/">read
+about Aura here. Send mail to </a><a href="email:roger.dannenberg@cs.cmu.edu">Roger
+Dannenberg</a> to get a copy of work in progress.
+<h2>
+<img SRC="nyquist-icon.gif" align=TOP> Nyquist</h2>
+Nyquist is a sound synthesis and composition language based on a Lisp syntax.
+Nyquist is an elegant and powerful system based on functional programming.
+<h3>
+Documentation</h3>
+
+<ul>
+<li>
+<a href="http://www.cs.cmu.edu/~rbd/nyquist.html#faq">Frequently Asked
+Questions</a></li>
+
+<li>
+<b><a href="http://www.cs.cmu.edu/~rbd/doc/nyquist/root.html">Nyquist Manual
+in HTML (view pages at CMU)</a></b></li>
+
+<li>
+<a href="nyquist/nyqman.pdf">Get Nyquist documentation in Adobe Acrobat
+format now.</a></li>
+
+<li>
+Note that the manual is also included in the Executable and Source releases
+(below).</li>
+
+<li>
+<a href="nyquist/nyqman.txt">Nyquist Manual in plain ASCII</a></li>
+</ul>
+
+<h3>
+Executables (v2.27)</h3>
+
+<ul>
+<li>
+GOOD: <a href="nyquist/setupnyrun227.exe">Get Nyquist installer for Win32
+systems now.</a> Just run the installer. No registry edits required.</li>
+
+<li>
+BETTER: <a href="nyquist/setupnywinrun227.exe">Nyqwin.exe -- a more windows-like
+interface for Nyquist. Just run the installer.</a> No registry edits required.</li>
+
+<li>
+BEST: <a href="nyquist/setupnyiderun227.exe">NyqIDE.exe -- an even nicer
+windows-like interface for Nyquist. Just run the installer.</a> No registry
+edits required.</li>
+
+<li>
+BACKUP: <a href="nyquist/setupnyiderun222.exe">NyqIDE.exe (v2.22) not the
+latest, but heavily used</a></li>
+
+<li>
+MAC: <a href="nyquist/nyquist228exe.sea">Get Nyquist (v2.28) executable
+for Macintosh.</a> (If this link does not work, you can try <a href="http://www.hiss999.co.uk/dl/nyquist_2.28.sea.bin">this
+link</a>.)</li>
+
+<li>
+LINUX: Please get the source version below and compile your own.</li>
+</ul>
+
+<h3>
+Source</h3>
+
+<ul>
+<li>
+<a href="nyquist/nyqsrc227.zip">Get Nyquist (v2.27) source code for Win32.</a></li>
+
+<li>
+<a href="nyquist/nyquist228.zip">Get Nyquist (v2.28) source code for Linux.</a></li>
+
+<li>
+<a href="nyquist/nyquist228src.sea">Get Nyquist (v2.28) source code for
+Macintosh.</a>&nbsp; (If this link does not work, you can try <a href="http://www.hiss999.co.uk/dl/nyquist_2.28_src.sea.bin">this
+link</a>.)</li>
+</ul>
+
+<h3>
+Version 2.14 (older, but more tested than the latest release)</h3>
+
+<ul>
+<li>
+<a href="nyquist/nyrun214.sea">Get Nyquist runtime (v2.14) for Power Mac
+systems now.</a> This is a self-extracting archive file. (However, it may
+not have the proper file type to execute after you download it. You can
+also extract the archive using Stuffit Expander.</li>
+
+<li>
+<a href="nyquist/nyrun214.exe">Get Nyquist runtime for Win32 systems now.</a>
+This is a self-extracting file, see manual for installation instructions.</li>
+
+<li>
+<a href="nyquist/nyall214.exe">Get Nyquist (v2.14) runtime plus source
+code for Win32 systems now.</a> This is a self-extracting file.</li>
+
+<li>
+<a href="nyquist/setupnyrun214.exe">Get Nyquist installer for Win32 systems
+now.</a> Not in the manual yet, but just run the installer. No registry
+edits required.</li>
+</ul>
+If you have problems getting Nyquist, please contact Roger Dannenberg (<a href="mailto:rbd@cs.cmu.edu">rbd@cs.cmu.edu</a>).&nbsp;<! comment
+<p close-bracket <a href="http://cec.wustl.edu/~bjl1/nyquist-linux.html" close-bracket Brad Lindseth's
+Nyquist for Linux page, including examples and other good stuff.</a close-bracket (Note:
+Brad's changes have been incorporated into Nyquist along with a number
+of bug fixes. I plan to be working extensively with Nyquist on Linux in
+fall 2000, so let me know if you are a Linux user and we'll arrange to
+get you the latest stuff. -RBD)
+
+end comment>
+<h2>
+CMU MIDI Toolkit</h2>
+The CMU Midi Toolkit (CMT) is a collection of software for writing interactive
+MIDI software in C. CMT includes a number of handy utilities allong with
+an application "shell" that provides timing, scheduling, and MIDI interfaces
+that are portable across DOS, Mac, SGI, and Amiga platforms.
+<p>CMT is distributed by the CMU School of Computer Science. For $30 to
+cover our costs, we will send you 3.5" DS/DD disks (including executables
+and source code) and an 100 page manual. Please indicate your machine type.
+Checks should be payable to Carnegie Mellon University, and correspondence
+should be addressed to Roger Dannenberg, School of Computer Science, Carnegie
+Mellon University, Pittsburgh, PA 15213 USA.
+<p>CMT runs on the following systems:
+<ul>Macintosh (requires Apple MIDI Manager),
+<p>DOS (requires MPU-401 compatible MIDI interface), and
+<p>Amiga (requires Commodore CAMD drivers),</ul>
+using the following compilers: Think C v5, Borland C++ v3, Turbo C++ for
+DOS v3, Microsoft C v7, Quick C v2.5, Lattice C v5 (Amiga), and Aztec C
+v5 (Amiga). (Amiga code is retained in the release but is no longer supported.)
+<h3>
+Documentation</h3>
+
+<ul>
+<li>
+<a href="http://www.cs.cmu.edu/afs/cs.cmu.edu/project/music/web/cmt/cmtman.ps">Get
+CMT documentation in postscript format now.</a></li>
+</ul>
+
+<h3>
+Executables</h3>
+
+<ul>
+<li>
+<a href="http://www.cs.cmu.edu/afs/cs.cmu.edu/project/music/web/cmt/dos/CMT321EX.ZIP">Get
+CMT executables (as DOS ZIP file) now.</a></li>
+
+<li>
+<a href="http://www.cs.cmu.edu/afs/cs.cmu.edu/project/music/web/cmt/mac/CMTv3.19exe.sea.hqx">Get
+CMT executables (as MAC self-extracting archive) now.</a></li>
+</ul>
+
+<h3>
+Source</h3>
+
+<ul>
+<li>
+<a href="http://www.cs.cmu.edu/afs/cs.cmu.edu/project/music/web/cmt/dos/CMT321.ZIP">Get
+CMT source (as DOS ZIP file) now.</a></li>
+
+<li>
+<a href="http://www.cs.cmu.edu/afs/cs.cmu.edu/project/music/web/cmt/unix/cmt.tar.Z">Get
+CMT source (as UNIX compressed tar file) now.</a></li>
+
+<li>
+<a href="http://www.cs.cmu.edu/afs/cs.cmu.edu/project/music/web/cmt/mac/CMTv3.19.sea.hqx">Get
+CMT source (as MAC self-extracting archive) now.</a></li>
+</ul>
+Maintained by:
+<address>
+rbd@cs.cmu.edu</address>
+
+</body>
+</html>
diff --git a/misc/cmu/new.html b/misc/cmu/new.html
new file mode 100644
index 0000000..0f45795
--- /dev/null
+++ b/misc/cmu/new.html
@@ -0,0 +1,189 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]">
+ <title>The Computer Music Project Software</title>
+</head>
+<body>
+
+<h1>
+The Computer Music Project Software</h1>
+
+<h2>
+<img SRC="portmusic-icon.gif" align=TOP> PortMusic</h2>
+<a href="portmusic">Information about PortMusic</a>
+<h2>
+Aura</h2>
+Aura is not available for general distribution, but you can <a href="http://www.cs.cmu.edu/~music/aura/">read
+about Aura here. Send mail to </a><a href="email:roger.dannenberg@cs.cmu.edu">Roger
+Dannenberg</a> to get a copy of work in progress.
+<h2>
+<img SRC="nyquist-icon.gif" align=TOP> Nyquist</h2>
+Nyquist is a sound synthesis and composition language based on a Lisp syntax.
+Nyquist is an elegant and powerful system based on functional programming.
+<h3>
+Documentation</h3>
+
+<ul>
+<li>
+<a href="http://www.cs.cmu.edu/~rbd/nyquist.html#faq">Frequently Asked
+Questions</a></li>
+
+<li>
+<b><a href="http://www.cs.cmu.edu/~rbd/doc/nyquist/root.html">Nyquist Manual
+in HTML (view pages at CMU)</a></b></li>
+
+<li>
+<a href="nyquist/nyqman.pdf">Get Nyquist documentation in Adobe Acrobat
+format now.</a></li>
+
+<li>
+Note that the manual is also included in the Executable and Source releases
+(below).</li>
+
+<li>
+<a href="nyquist/nyqman.txt">Nyquist Manual in plain ASCII</a></li>
+</ul>
+
+<h3>
+Executables (v2.29)</h3>
+
+<ul>
+<li>
+GOOD: <a href="nyquist/setupnyrun229.exe">Get Nyquist installer for Win32
+systems now.</a> Just run the installer. No registry edits required.</li>
+
+<li>
+BETTER: <a href="nyquist/setupnywinrun229.exe">Nyqwin.exe -- a more windows-like
+interface for Nyquist. Just run the installer.</a> No registry edits required.</li>
+
+<li>
+BEST: <a href="nyquist/setupnyiderun229.exe">NyqIDE.exe -- an even nicer
+windows-like interface for Nyquist. Just run the installer.</a> No registry
+edits required.</li>
+
+<li>
+BACKUP: <a href="nyquist/setupnyiderun222.exe">NyqIDE.exe (v2.22) not the
+latest, but heavily used</a></li>
+
+<li>
+MAC: <a href="nyquist/nyquist228exe.sea">Get Nyquist (v2.28) executable
+for Macintosh.</a> (If this link does not work, you can try <a href="http://www.hiss999.co.uk/dl/nyquist_2.28.sea.bin">this
+link</a>.)</li>
+
+<li>
+LINUX: Please get the source version below and compile your own.</li>
+</ul>
+
+<h3>
+Source</h3>
+
+<ul>
+<li>
+<a href="nyquist/nyqsrc229.zip">Get Nyquist (v2.29) source code for Win32.</a></li>
+
+<li>
+<a href="nyquist/nyquist228.zip">Get Nyquist (v2.28) source code for Linux.</a></li>
+
+<li>
+<a href="nyquist/nyquist228src.sea">Get Nyquist (v2.28) source code for
+Macintosh.</a>&nbsp; (If this link does not work, you can try <a href="http://www.hiss999.co.uk/dl/nyquist_2.28_src.sea.bin">this
+link</a>.)</li>
+</ul>
+
+<h3>
+Version 2.14 (older, but more tested than the latest release)</h3>
+
+<ul>
+<li>
+<a href="nyquist/nyrun214.sea">Get Nyquist runtime (v2.14) for Power Mac
+systems now.</a> This is a self-extracting archive file. (However, it may
+not have the proper file type to execute after you download it. You can
+also extract the archive using Stuffit Expander.</li>
+
+<li>
+<a href="nyquist/nyrun214.exe">Get Nyquist runtime for Win32 systems now.</a>
+This is a self-extracting file, see manual for installation instructions.</li>
+
+<li>
+<a href="nyquist/nyall214.exe">Get Nyquist (v2.14) runtime plus source
+code for Win32 systems now.</a> This is a self-extracting file.</li>
+
+<li>
+<a href="nyquist/setupnyrun214.exe">Get Nyquist installer for Win32 systems
+now.</a> Not in the manual yet, but just run the installer. No registry
+edits required.</li>
+</ul>
+If you have problems getting Nyquist, please contact Roger Dannenberg (<a href="mailto:rbd@cs.cmu.edu">rbd@cs.cmu.edu</a>).&nbsp;<! comment
+<p close-bracket <a href="http://cec.wustl.edu/~bjl1/nyquist-linux.html" close-bracket Brad Lindseth's
+Nyquist for Linux page, including examples and other good stuff.</a close-bracket (Note:
+Brad's changes have been incorporated into Nyquist along with a number
+of bug fixes. I plan to be working extensively with Nyquist on Linux in
+fall 2000, so let me know if you are a Linux user and we'll arrange to
+get you the latest stuff. -RBD)
+
+end comment>
+<h2>
+CMU MIDI Toolkit</h2>
+The CMU Midi Toolkit (CMT) is a collection of software for writing interactive
+MIDI software in C. CMT includes a number of handy utilities allong with
+an application "shell" that provides timing, scheduling, and MIDI interfaces
+that are portable across DOS, Mac, SGI, and Amiga platforms.
+<p>CMT is distributed by the CMU School of Computer Science. For $30 to
+cover our costs, we will send you 3.5" DS/DD disks (including executables
+and source code) and an 100 page manual. Please indicate your machine type.
+Checks should be payable to Carnegie Mellon University, and correspondence
+should be addressed to Roger Dannenberg, School of Computer Science, Carnegie
+Mellon University, Pittsburgh, PA 15213 USA.
+<p>CMT runs on the following systems:
+<ul>Macintosh (requires Apple MIDI Manager),
+<p>DOS (requires MPU-401 compatible MIDI interface), and
+<p>Amiga (requires Commodore CAMD drivers),</ul>
+using the following compilers: Think C v5, Borland C++ v3, Turbo C++ for
+DOS v3, Microsoft C v7, Quick C v2.5, Lattice C v5 (Amiga), and Aztec C
+v5 (Amiga). (Amiga code is retained in the release but is no longer supported.)
+<h3>
+Documentation</h3>
+
+<ul>
+<li>
+<a href="http://www.cs.cmu.edu/afs/cs.cmu.edu/project/music/web/cmt/cmtman.ps">Get
+CMT documentation in postscript format now.</a></li>
+</ul>
+
+<h3>
+Executables</h3>
+
+<ul>
+<li>
+<a href="http://www.cs.cmu.edu/afs/cs.cmu.edu/project/music/web/cmt/dos/CMT321EX.ZIP">Get
+CMT executables (as DOS ZIP file) now.</a></li>
+
+<li>
+<a href="http://www.cs.cmu.edu/afs/cs.cmu.edu/project/music/web/cmt/mac/CMTv3.19exe.sea.hqx">Get
+CMT executables (as MAC self-extracting archive) now.</a></li>
+</ul>
+
+<h3>
+Source</h3>
+
+<ul>
+<li>
+<a href="http://www.cs.cmu.edu/afs/cs.cmu.edu/project/music/web/cmt/dos/CMT321.ZIP">Get
+CMT source (as DOS ZIP file) now.</a></li>
+
+<li>
+<a href="http://www.cs.cmu.edu/afs/cs.cmu.edu/project/music/web/cmt/unix/cmt.tar.Z">Get
+CMT source (as UNIX compressed tar file) now.</a></li>
+
+<li>
+<a href="http://www.cs.cmu.edu/afs/cs.cmu.edu/project/music/web/cmt/mac/CMTv3.19.sea.hqx">Get
+CMT source (as MAC self-extracting archive) now.</a></li>
+</ul>
+Maintained by:
+<address>
+rbd@cs.cmu.edu</address>
+
+</body>
+</html>
diff --git a/misc/cmu/nyqide_setup.sgp b/misc/cmu/nyqide_setup.sgp
new file mode 100644
index 0000000..7070fa0
--- /dev/null
+++ b/misc/cmu/nyqide_setup.sgp
Binary files differ
diff --git a/misc/cmu/nyquist_setup.sgp b/misc/cmu/nyquist_setup.sgp
new file mode 100644
index 0000000..d72c3ec
--- /dev/null
+++ b/misc/cmu/nyquist_setup.sgp
Binary files differ
diff --git a/misc/cmu/nyqwin_setup.sgp b/misc/cmu/nyqwin_setup.sgp
new file mode 100644
index 0000000..f61c971
--- /dev/null
+++ b/misc/cmu/nyqwin_setup.sgp
Binary files differ
diff --git a/misc/cmu/restore.bat b/misc/cmu/restore.bat
new file mode 100644
index 0000000..41bbc24
--- /dev/null
+++ b/misc/cmu/restore.bat
@@ -0,0 +1,17 @@
+rem restore what cleanup.bat did
+
+cd ..\..
+move ..\nyquist-backup\idesetup idesetup
+move ..\nyquist-backup\winsetup winsetup
+move ..\nyquist-backup\setup setup
+move ..\nyquist-backup\NyqWinDebug NyqWinDebug
+move ..\nyquist-backup\NyqWinRel NyqWinRel
+move ..\nyquist-backup\WinDebug WinDebug
+move ..\nyquist-backup\WinRel WinRel
+move ..\nyquist-backup\portaudio_test portaudio_test
+move ..\nyquist-backup\jones jones
+move ..\nyquist-backup\sjlib_103_DOS.tgz sjlib_103_DOS.tgz
+move ..\nyquist-backup\sjlib_DOS_104.tgz sjlib_DOS_104.tgz
+move ..\nyquist-backup\plight demos\plight
+move ..\nyquist-backup\nyqide nyqide
+cd misc\cmu
diff --git a/misc/convert.c b/misc/convert.c
new file mode 100644
index 0000000..a242acd
--- /dev/null
+++ b/misc/convert.c
@@ -0,0 +1,59 @@
+/* convert.c -- convert between file name notations */
+
+
+#include "switches.h"
+#include "stdio.h"
+#include "string.h"
+#include "convert.h"
+
+char dir_separator =
+#ifdef MACINTOSH
+':';
+#endif
+#ifdef DOS
+'\\';
+#endif
+#ifdef UNIX
+'/';
+#endif
+#ifdef AMIGA
+'/';
+#endif
+/* Note: syntax error if not one and only one is defined (this is a feature) */
+
+
+int pauseflag;
+
+
+/* convert -- convert filename to local naming conventions */
+/**/
+void convert(char *filename)
+{
+ int i;
+ /* first test for problem characters */
+ for (i = strlen(filename); i >= 0; i--) {
+ if (filename[i] == ':' || filename[i] == '\\') {
+ fprintf(stderr, "WARNING: %s has one of \":\\\" and may not port.\n",
+ filename);
+ fprintf(stderr, " '/' should be used as directory separator.\n");
+ if (PAUSE) getchar();
+ }
+ }
+#ifdef MACINTOSH
+ /* prepend a ":" */
+ for (i = strlen(filename); i >= 0; i--) {
+ filename[i + 1] = filename[i];
+ }
+ filename[0] = ':';
+#endif
+#ifndef UNIX
+#ifndef AMIGA
+ /* replace '/' with local separator */
+ for (i = strlen(filename); i >= 0; i--) {
+ if (filename[i] == '/') filename[i] = dir_separator;
+ }
+#endif
+#endif
+}
+
+
diff --git a/misc/convert.h b/misc/convert.h
new file mode 100644
index 0000000..3c74cdc
--- /dev/null
+++ b/misc/convert.h
@@ -0,0 +1,7 @@
+/* convert.h -- convert from packer internal filenames to local OS */
+
+void convert(char *filename);
+
+extern int pauseflag;
+#define PAUSE pauseflag
+
diff --git a/misc/filelist.c b/misc/filelist.c
new file mode 100644
index 0000000..677fbe4
--- /dev/null
+++ b/misc/filelist.c
@@ -0,0 +1,222 @@
+/* filelist.c -- program to convert a DOS DIR listing into an input
+ * file for the packer program
+ *
+ * To use the program, first run DIR *.* /s > ..\xxx
+ * Then run filelist.exe ..\xxx files
+ * to create "files"
+ * Then you can run packer.exe files myproject.pac
+ * to create the pac file.
+ */
+
+/* usage: filelist <dir filename> <packer filename> */
+
+#include "stdio.h"
+#include "stdlib.h"
+#include "string.h"
+#include "cext.h"
+#include "cmdline.h"
+
+#define EOS '\0'
+
+FILE *inf;
+FILE *out;
+
+#ifdef MAYBE_THIS_IS_FOR_WIN95_DIRECTORY_LISTINGS
+/* findfilename -- look for pattern "*-*-*:* " in string */
+/**/
+int findfilename(char *line, char *rslt)
+{
+ char *ptr;
+ if (ptr = strchr(line, '-')) {
+ if (ptr = strchr(ptr, '-')) {
+ if (ptr = strchr(ptr, ':')) {
+ if (ptr = strchr(ptr, ' ')) {
+ strcpy(rslt, ptr + 1);
+ if (strcmp(rslt, ".") == 0 ||
+ strcmp(rslt, "..") == 0 ||
+ strstr(line, "<DIR>")) return 0;
+ return 1;
+ }
+ }
+ }
+ }
+ return 0;
+}
+#endif
+
+/* findfilename -- look for pattern "*<slash>*<slash>*:* " in string */
+/*
+ * NOTE: the <slash> is "/", part of the file date; ":" is in the file time
+ * lines without these characters are not lines that contain filenames
+ */
+int findfilename(char *line, char *rslt)
+{
+ char *ptr;
+ if (ptr = strchr(line, '/')) {
+ if (ptr = strchr(ptr + 1, '/')) {
+ if (ptr = strchr(ptr + 1, ':')) {
+ if (ptr = strrchr(line, ' ')) {
+ // now ptr points to space before filename
+ strcpy(rslt, ptr + 1);
+ // make sure this is not directory
+ if (strstr(line, "<DIR>")) return 0;
+ return 1;
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+
+int directory_filter(char *directory)
+{
+ int skip = false;;
+ if (strstr(directory, "WinDebug") != NULL) skip = true;
+ if (strstr(directory, "trash") != NULL) skip = true;
+ return skip;
+}
+
+/* fixup -- convert \ to / */
+/**/
+void fixup(char *s)
+{
+ while (*s) {
+ if (*s == '\\') *s = '/';
+ s++;
+ }
+}
+
+
+/* giveup -- quit the program */
+/**/
+void giveup()
+{
+ printf("Type return.");
+ exit(1);
+}
+
+
+/*
+/* main -- */
+/**/
+int main(int argc, char **argv)
+{
+#define stringmax 128
+ char in_file[stringmax];
+ char out_file[stringmax];
+ char inline[stringmax];
+ char basedir[stringmax];
+ char filename[stringmax];
+ char directory[stringmax];
+ char wholename[stringmax];
+ char *s;
+ int skip_directory = false;
+
+ basedir[0] = 0; /* empty string */
+
+ cl_init(NULL, 0, NULL, 0, argv, argc);
+ if ((s = cl_arg(1)) != NULL) {
+ strcpy(in_file, s);
+ inf = fopen(in_file, "r");
+ if (inf == NULL) {
+ fprintf(stdout, "Error: couldn't open %s\n", in_file);
+ exit(1);
+ }
+ }
+ if ((s = cl_arg(2)) != NULL) {
+ strcpy(out_file, s);
+ out = fopen(out_file, "w");
+ if (out == NULL) {
+ fprintf(stdout, "Error: couldn't open %s\n", out_file);
+ exit(1);
+ }
+ } else {
+ fprintf(stdout, "Error: no output file specified\n");
+ exit(1);
+ }
+
+ printf("writing %s ...\n", out_file);
+
+ /* read a line at a time.
+ * if the line has "Directory of", then
+ * if you don't have base directory, grab it
+ * otherwise search for base directory and grab remainder
+ * if the line matches "*-*-*:* " then
+ * grab remainder as filename
+ * prepend directory and type ("a") and output
+ */
+ while (fgets(inline, stringmax, inf)) {
+ inline[strlen(inline) - 1] = EOS; /* remove newline at end */
+ if (inline[0] == EOS) continue; /* skip blank lines */
+ /* search for Directory */
+ s = strstr(inline, "Directory of ");
+ if (s) {
+ s += strlen("Directory of ");
+ if (!basedir[0]) {
+ strcpy(basedir, s);
+ strcat(basedir, "\\"); /* append a slash to complete directory name */
+ strcpy(directory, "");
+ } else {
+ s = strstr(s, basedir);
+ if (!s) {
+ printf("Expected %s at beginning of directory.\n");
+ printf("Input line: %s\n");
+ giveup();
+ } else {
+ strcpy(directory, s + strlen(basedir));
+ fixup(directory);
+ strcat(directory, "/");
+ }
+ skip_directory = directory_filter(directory);
+ }
+ } else if (!skip_directory && findfilename(inline, filename)) {
+ char type_of_file = 'a';
+ sprintf(wholename, "%s%s", directory, filename);
+ /* strlwr(wholename); */
+ s = strchr(wholename, '.');
+ if (s) s++;
+ else s = "";
+ if (strcmp(s, "nh") == 0 ||
+ strcmp(s, "rsrc") == 0 ||
+ strcmp(s, "dsp") == 0 ||
+ strcmp(s, "dsw") == 0 ||
+ strcmp(s, "cod") == 0 ||
+ strcmp(s, "tab") == 0 ||
+ strcmp(s, "pcm") == 0 ||
+ strcmp(s, "mp3") == 0 ||
+ strcmp(s, "mid") == 0 ||
+ strcmp(s, "aiff") == 0 ||
+ false)
+ type_of_file = 'b';
+ if (strcmp(s, "pac") == 0 ||
+ strcmp(s, "ncb") == 0 ||
+ strcmp(s, "opt") == 0 ||
+ strcmp(s, "plg") == 0 ||
+ strcmp(s, "tar") == 0 ||
+ strcmp(s, "obj") == 0 ||
+ strcmp(s, "vcp") == 0 ||
+ strcmp(s, "exe") == 0 ||
+ strcmp(s, "vcp") == 0 ||
+ strcmp(s, "pdb") == 0 ||
+ strcmp(s, "sbr") == 0 ||
+ strcmp(s, "ilk") == 0 ||
+ strcmp(s, "bsc") == 0 ||
+ /* this last one says "only .lsp files in runtime directory
+ (strcmp(directory, "runtime/") == 0 && strcmp(s, "lsp") != 0) || */
+ strstr(directory, "CVS/") ||
+ false
+ ) {
+ /* do nothing */
+ } else {
+ fprintf(out, "%c %s\n", type_of_file, wholename);
+ }
+ }
+ }
+
+ fclose(inf);
+ fclose(out);
+ return 0;
+}
+
+
diff --git a/misc/filelist.dsp b/misc/filelist.dsp
new file mode 100644
index 0000000..566e052
--- /dev/null
+++ b/misc/filelist.dsp
@@ -0,0 +1,109 @@
+# Microsoft Developer Studio Project File - Name="filelist" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=filelist - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "filelist.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "filelist.mak" CFG="filelist - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "filelist - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "filelist - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "filelist - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "filelist_Release"
+# PROP Intermediate_Dir "filelist_Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "filelist - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "filelist_Debug"
+# PROP Intermediate_Dir "filelist_Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../cmt" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /D "_DEBUG" /D "DEBUG_INPUT" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib winmm.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "filelist - Win32 Release"
+# Name "filelist - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\cmdline.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\filelist.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\tran\delaycc.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/misc/filelist.vcproj b/misc/filelist.vcproj
new file mode 100644
index 0000000..c3172af
--- /dev/null
+++ b/misc/filelist.vcproj
@@ -0,0 +1,264 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="filelist"
+ ProjectGUID="{DA1A1539-671B-4E70-BF6E-10EC6887FAF4}"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\filelist_Release"
+ IntermediateDirectory=".\filelist_Release"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\filelist_Release/filelist.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\filelist_Release/filelist.pch"
+ AssemblerListingLocation=".\filelist_Release/"
+ ObjectFile=".\filelist_Release/"
+ ProgramDataBaseFileName=".\filelist_Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile=".\filelist_Release/filelist.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ProgramDatabaseFile=".\filelist_Release/filelist.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\filelist_Release/filelist.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\filelist_Debug"
+ IntermediateDirectory=".\filelist_Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\filelist_Debug/filelist.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../cmt"
+ PreprocessorDefinitions="_CONSOLE;WIN32;_DEBUG;DEBUG_INPUT"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ PrecompiledHeaderFile=".\filelist_Debug/filelist.pch"
+ AssemblerListingLocation=".\filelist_Debug/"
+ ObjectFile=".\filelist_Debug/"
+ ProgramDataBaseFileName=".\filelist_Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib winmm.lib"
+ OutputFile=".\filelist_Debug/filelist.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\filelist_Debug/filelist.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\filelist_Debug/filelist.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="cmdline.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="filelist.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="..\tran\delaycc.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/misc/intgen.c b/misc/intgen.c
new file mode 100644
index 0000000..d9228a7
--- /dev/null
+++ b/misc/intgen.c
@@ -0,0 +1,911 @@
+/* intgen.c -- an interface generator for xlisp */
+
+/* (c) Copyright Carnegie Mellon University 1991
+ * For a statement of limited permission to use, see Permission.doc
+ *
+ * HISTORY
+ *
+ * 5-Jul-95 Roger Dannenberg
+ * strip directory prefixes from files before writing include statements
+ * 24-Oct-88 Roger Dannenberg at CMU
+ * Changed so that if C routine returns void and has result parameters,
+ * then result parameters are returned by the lisp subr as well as
+ * assigned to *RSLT*.
+ *
+ * 13-Apr-88 Roger Dannenberg at CMU
+ * Modified for xlisp version 2.0
+ *
+ * 22-Dec-87 Roger Dannenberg at NeXT
+ * Added FILE type.
+ *
+ * 21-May-87 Dale Amon at CMU CSD
+ * Included use of NODE *s_true under SCORE_EDITOR conditional. Standard
+ * xlisp code use NODE *true instead.
+ *
+ * 13-May-87 Dale Amon at CMU CSD
+ * Added conditional compilation switch SCORE_EDITOR so that this
+ * program will work with both standard XLISP sources and with Roger's
+ * (ahem) modified version. Also put in error checking for case where
+ * user does not specifiy an output file so program will exit instead
+ * of coredump.
+ */
+
+
+/* Summary and Design: (NOTE THAT AN INTGEN MANUAL IS AVAILABLE)
+ * The first command line argument gives the name of
+ * the .c file to generate. All following arguments are
+ * .h files to read and use as interface specifications.
+ *
+ * The main program opens the output file, calls
+ * write_prelude, and then process_file for each input
+ * file. Then call write_postlude and close the file.
+ *
+ * process_file opens an input file and reads each line
+ * into current_line.
+ * if the first characters of the file are "ih", then
+ * the rest of the file is processed as normal, except the
+ * .h extension of the file is replaced by .ih before the
+ * filename is written into an include statement in the
+ * output file. This is done to handle ".ih" files generated
+ * by the Andrew Toolkit Class processor.
+ * In any case, the first line of EVERY .h file is discarded.
+ * If #define is found, save the following identifier as
+ * macro_name.
+ * If "LISP:" is found, then see if it is preceded by one
+ * or two identifiers and an open paren.
+ * If yes, call routine_call,
+ * else call macro_call.
+ *
+ * routine_call gets the first one or two identifiers off the
+ * line into type_name and routine_name. If there is just one id,
+ * assign it to routine_name and make type_name = "void".
+ * If the routine_name starts with *, remove the * from
+ * routine_name and append "*" to type_name.
+ * Call write_interface with type_name, routine_name, and location
+ * of parameter type description after "LISP:".
+ *
+ * macro_call gets a type_name from the input line after
+ * "LISP:".
+ * Then call write_interface with type_name, macro_name, and
+ * location of parameter type description.
+ *
+ * lisp function names are saved in a table, and an
+ * initialization routine is written to install the new
+ * SUBRs into the xlisp symbol table, as well as to lookup
+ * RSLT_sym, the atom on which results are placed
+ *
+ *
+ */
+
+/* Turn on special handling for Roger's Score Editor if the following #define
+ * is uncommented:
+ */
+/* #define SCORE_EDITOR */
+
+/* Turn on special handling for Chris's Sound Editor if the following #define
+ * is uncommented:
+ */
+/* #define SOUND_EDITOR */
+
+/* Turn on special handling for Nyquist if the following #define
+ * is uncommented:
+ */
+#define NYQUIST
+
+/* atom 't is named s_true if this is defined, o.w. named true: */
+#define S_TRUE 1
+
+/* Turn on special handling for CMU MIDI Toolkit seq_type:
+ */
+#define SEQ_TYPE
+
+#define errfile stdout
+
+#define ident_max 100
+#define line_max 200
+#define subr_max 500
+
+/* prefix for include files not to be included in interface module */
+#define no_include_prefix '~'
+
+#define false 0
+#define true 1
+
+#include "switches.h"
+#include "stdlib.h"
+#include "cext.h"
+#include <string.h>
+#ifndef boolean
+typedef int boolean;
+#endif
+#include "stdio.h"
+#include "ctype.h"
+#include "cmdline.h"
+#ifdef MACINTOSH
+#include "console.h"
+#endif
+
+#ifdef MACINTOSH
+#define FILESEP ':'
+#else
+#ifdef WINDOWS
+#define FILESEP '\\'
+#else
+#define FILESEP '/'
+#endif
+#endif
+
+static char *sindex();
+
+#define whitep(c) ((c) == ' ' || (c) == '\t')
+#define symbolp(c) (isalpha(c) || (c) == '*' || (c) == '_' || (c) == '-' ||\
+ (c) == ':' || isdigit(c) || (c) == '^' || (c) == '*')
+
+/* c and Lisp parameters are encoded in the same table.
+ * Field type_id is the string name of the type.
+ * For c types (return types of C routines), code is 'C',
+ * convert gives the routine for making a lisp node from
+ * the c datum.
+ * listtype_or_special is "v" for types that should be
+ * returned as LISP NIL (e.g. "void"), "s" for types
+ * that when NULL should be returned as NIL, "r"
+ * for normal types, and "" to raise an error.
+ * ctype is not used and should be NULL.
+ * For Lisp types (from parameter specs), code is 'L'.
+ * convert gives the routine that extracts a C value
+ * from a lisp node whose type is given by the field
+ * getarg_or_special.
+ * c_type is the type of the local C variable which is
+ * passed as a parameter to the C routine.
+ * initializer is the initial value for result only parameters
+ *
+ * End of table is marked by a NULL type_id.
+ *
+ * Location 0 is reserved to indicate errors.
+ * Location 1 MUST BE type ANY
+ *
+ */
+
+#define any_index 1
+struct {
+ char *type_id;
+ char code;
+ char *convert;
+ char *getarg_or_special;
+ char *ctype;
+ char *makenode;
+ char *initializer;
+} type_table[] = {
+ {" ", ' ', NULL, NULL, NULL, NULL, NULL},
+ {"ANY", 'L', "", "", "LVAL", "", "NIL"},
+ {"ATOM", 'L', "", "xlgasymbol", "LVAL", "", "NIL"},
+ {"FILE", 'L', "getfile", "xlgastream", "FILE *", "cvfile", "NULL"},
+ {"FIXNUM", 'L', "getfixnum", "xlgafixnum", "long", "cvfixnum", "0"},
+ {"FIXNUM", 'L', "getfixnum", "xlgafixnum", "int", "cvfixnum", "0"},
+ {"FLOAT", 'L', "getflonum", "xlgaflonum", "float", "cvflonum", "0.0"},
+ {"FLONUM", 'L', "getflonum", "xlgaflonum", "double", "cvflonum", "0.0"},
+ {"ANYNUM", 'L', "testarg2", "xlgaanynum", "double", "cvflonum", "0.0"},
+ {"STRING", 'L', "getstring", "xlgastring", "unsigned char *", "cvstring", "NULL"},
+ {"BOOLEAN", 'L', "getboolean", "xlgetarg", "int", "cvboolean", "0"},
+ {"atom_type", 'C', "", "r", NULL, NULL, NULL},
+ {"LVAL", 'C', "", "r", NULL, NULL, "NIL"},
+
+#ifdef SOUND_EDITOR
+ /* Extensions for Sound Type: */
+ {"SOUND", 'L', "getsound", "xlgasound", "SoundPtr", "cvsound", "NULL"},
+ {"SoundPtr", 'C', "cvsound", "r", NULL, NULL, NULL},
+#endif
+
+#ifdef NYQUIST
+ {"SOUND", 'L', "getsound", "xlgasound", "sound_type", "cvsound", "NULL"},
+ {"sound_type", 'C', "cvsound", "r", NULL, NULL, NULL},
+#endif
+#ifdef SEQ_TYPE
+ {"SEQ", 'L', "getseq", "xlgaseq", "seq_type", "cvseq", "NULL"},
+ {"seq_type", 'C', "cvseq", "r", NULL, NULL, NULL},
+/* look out! event_type is treated as void to eliminate
+ * warning messages ... */
+ {"event_type", 'C', "", "v", NULL, NULL, NULL},
+#endif
+#ifdef SCORE_EDITOR
+ {"VALUE", 'L', "getval", "xlgaval", "value_type", "cvval", "NULL"},
+ {"value_type", 'C', "cvval", "r", NULL, NULL, NULL},
+ {"EVENT", 'L', "getevent", "xlgaevent", "event_type", "cvevent", "NULL"},
+ {"event_type", 'C', "cvevent", "r", NULL, NULL, NULL},
+ {"score_type", 'C', "cvevent", "r", NULL, NULL, NULL},
+#endif
+#ifdef DMA_EXTENSIONS
+ /* begin DMA entries */
+ {"DEXT", 'L', "getdext", "xlgadext", "ext_type", "cvdext", "NULL"},
+ {"DEXT", 'C', "cvdext", "r", NULL, NULL, NULL},
+ {"SEXT", 'L', "getsext", "xlgasext", "ext_type", "cvsext", "NULL"},
+ {"SEXT", 'C', "cvsext", "r", NULL, NULL, NULL},
+ /* end DMA entries */
+#endif
+ {"int", 'C', "cvfixnum", "r", NULL, NULL, NULL},
+ {"long", 'C', "cvfixnum", "r", NULL, NULL, NULL},
+ {"boolean", 'C', "cvboolean", "r", NULL, NULL, NULL},
+ {"float", 'C', "cvflonum", "r", NULL, NULL, NULL},
+ {"double", 'C', "cvflonum", "r", NULL, NULL, NULL},
+ {"string", 'C', "cvstring", "s", NULL, NULL, NULL},
+ {"char*", 'C', "cvstring", "s", NULL, NULL, NULL},
+ {"char", 'C', "cvfixnum", "r", NULL, NULL, NULL},
+ {"string_type", 'C', "cvstring", "s", NULL, NULL, NULL},
+ {"FILE*", 'C', "cvfile", "s", NULL, NULL, NULL},
+ {"void", 'C', "", "v", NULL, NULL, NULL},
+/*eot*/ {NULL, ' ', NULL, NULL, NULL, NULL, NULL}};
+
+/* subr names get saved here: */
+char *subr_table[subr_max];
+int subr_table_x;
+
+#define get_c_special(i) type_table[(i)].getarg_or_special[0]
+#define get_c_conversion(i) type_table[(i)].convert
+#define get_lisp_extract(i) type_table[(i)].convert
+#define get_lisp_getarg(i) type_table[(i)].getarg_or_special
+#define get_lisp_ctype(i) type_table[(i)].ctype
+#define get_lisp_makenode(i) type_table[(i)].makenode
+#define get_lisp_initializer(i) type_table[(i)].initializer
+
+static void lisp_code();
+static int lookup();
+static void process_file();
+static void routine_call();
+static void write_interface();
+static void write_postlude();
+static void write_prelude();
+static void write_ptrfile();
+
+char source_file[ident_max]; /* source file */
+char current_line[4 * line_max]; /* current line in source file */
+char out_file[ident_max]; /* output file name */
+char ptr_file[ident_max]; /* ptr.h file name */
+char def_file[ident_max]; /* def.h file name */
+
+FILE *lispout = NULL; /* output for lisp source code (if any) */
+
+#define EOS '\000'
+
+/* getarg -- get an identifier from a string */
+/**/
+int getarg(start, result, pos)
+ char *start; /* where to start scanning */
+ char *result; /* where to put the identifier */
+ char **pos; /* ptr to char after identifier in source */
+{
+ *result = EOS;
+ while (whitep(*start) && *start != EOS) start++;
+ if (*start == EOS) return false;
+ if (!symbolp(*start)) return false;
+ while (symbolp(*start) && *start != EOS) {
+ *result = *start;
+ result++;
+ start++;
+ }
+ *result = EOS;
+ *pos = start;
+ return true;
+}
+
+
+/* error() -- print source file and line */
+/**/
+void error()
+{
+ fprintf(errfile, "\n%s: |%s|\n", source_file, current_line);
+}
+
+
+/* lisp_code -- write lisp code to file */
+/*
+ * read from inp if necessary until close comment found
+ */
+static void lisp_code(inp, s)
+ FILE *inp;
+ char *s;
+{
+ char lisp[line_max];
+ char *endcomment;
+ char *inputline; /* for end of file detection */
+
+ if (lispout == NULL) {
+ char lisp_file_name[ident_max];
+ char *extension;
+ strcpy(lisp_file_name, out_file);
+ extension = sindex(lisp_file_name, ".c");
+ strcpy(extension, ".lsp"); /* overwrite .c with .lsp */
+ lispout = fopen(lisp_file_name, "w");
+ if (lispout == NULL) {
+ fprintf(stdout, "Error: couldn't open %s\n", lisp_file_name);
+ exit(1);
+ }
+ printf("writing %s ...\n", lisp_file_name);
+ }
+
+ strcpy(lisp, s); /* don't modify s */
+ inputline = lisp;
+ while (inputline != NULL &&
+ (endcomment = sindex(lisp, "*/")) == NULL) {
+ fputs(lisp, lispout);
+ inputline = fgets(lisp, line_max, inp);
+ }
+ strcpy(endcomment, "\n\n");
+ fputs(lisp, lispout);
+}
+
+
+/* lookup -- find type data */
+/**/
+static int lookup(s, t)
+ char *s;
+ char t;
+{
+ int i = 1;
+ while (type_table[i].type_id != NULL) {
+ if (type_table[i].code == t &&
+ strcmp(type_table[i].type_id, s) == 0)
+ return i;
+ i++;
+ }
+ return 0;
+}
+
+/* macro_call -- generate xlisp interface for C routine */
+/**/
+void macro_call(in, out, curline, macro_name, arg_loc)
+ FILE *in; /* input file */
+ FILE *out; /* output file */
+ char *curline; /* input line */
+ char *macro_name; /* name of the macro to call */
+ char *arg_loc; /* location after "LISP:" */
+{
+ char type_name[ident_max];
+ if (!getarg(arg_loc, type_name, &arg_loc)) {
+ error();
+ fprintf(errfile, "no type given for macro.\n");
+ } else {
+ write_interface(in, out, type_name, macro_name, arg_loc, true);
+ }
+}
+
+
+
+/* main -- generate an xlisp to c interface file */
+/**/
+int main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ char *s;
+ FILE *out;
+ FILE *ptrfile;
+ FILE *deffile;
+ int n;
+
+#ifdef MACINTOSH
+ argc = ccommand(&argv);
+#endif
+
+ for (n = 0; n < subr_max; n++)
+ {
+ subr_table[n] = (char *) malloc(ident_max);
+ subr_table[n][0] = EOS;
+ }
+ subr_table_x = 0;
+
+ cl_init(NULL, 0, NULL, 0, argv, argc);
+ if ((s = cl_arg(1)) != NULL) {
+ strcpy(out_file, s);
+ if (sindex(out_file, ".") == 0)
+ strcat(out_file, ".c");
+ else fprintf(stderr,
+ "1st command line argument should be a legal c identifier\n");
+ out = fopen(out_file, "w");
+ if (out == NULL) {
+ fprintf(stdout, "Error: couldn't open %s\n", out_file);
+ exit(1);
+ }
+ strcpy(ptr_file, s);
+ strcat(ptr_file, "ptrs.h");
+ ptrfile = fopen(ptr_file, "w");
+ if (ptrfile == NULL) {
+ fprintf(stdout, "Error: couldn't open %s\n", ptr_file);
+ exit(1);
+ }
+ strcpy(def_file, s);
+ strcat(def_file, "defs.h");
+ deffile = fopen(def_file, "w");
+ if (deffile == NULL) {
+ fprintf(stdout, "Error: couldn't open %s\n", def_file);
+ exit(1);
+ }
+ } else {
+ fprintf(stdout, "Error: no output file specified\n");
+ exit(1);
+ }
+
+ printf("writing %s ...\n", out_file);
+
+ write_prelude(out, out_file);
+ n = 2;
+ while ((s = cl_arg(n)) != NULL) {
+ printf(" %s\n", s);
+ process_file(s, out);
+ n++;
+ }
+ write_postlude(out);
+ fclose(out);
+ write_ptrfile(ptrfile, deffile);
+ fclose(ptrfile);
+ fclose(deffile);
+ if (lispout != NULL) fclose(lispout);
+ return 0;
+}
+
+
+static void process_file(fname, out)
+ char *fname;
+ FILE *out;
+{
+ FILE *in;
+ char *cp;
+ char *pos;
+ char incl_file[ident_max]; /* name of file to include */
+ char type_name[ident_max]; /* the type of the routine */
+ char routine_name[ident_max]; /* the name of the routine or macro */
+ char flag = fname[0];
+ boolean reading_parameters = false; /* says we've got a routine, and
+ we're skipping over parameter declarations */
+
+ if (flag == no_include_prefix) fname++;
+
+ strcpy(source_file, fname); /* for error reporting */
+ in = fopen(fname, "r");
+ if (in == NULL) {
+ fprintf(errfile, "couldn't open %s\n", fname);
+ /* however, we still write the file as an #include ... */
+ fprintf(out, "#include \"%s\"\n\n", fname);
+ return;
+ }
+
+ /* first check out the first line: if the first two characters are
+ "ih", then replace fname with file.ih so that the CLASS ".ih"
+ file will be included instead of this ".h" file. This is a
+ hack to allow calls into Andrew Tool Kit objects.
+ */
+
+ strcpy(incl_file, fname);
+ if (fgets(current_line, line_max, in) != NULL) {
+ if (current_line[0] == 'i' && current_line[1] == 'h') {
+ cp = sindex(incl_file, ".h");
+ if (cp != NULL) {
+ strcpy(cp, ".ih");
+ }
+ }
+ }
+
+ /* strip off leading directory prefix, if any */
+ cp = strrchr(incl_file, FILESEP); /* find the last slash */
+ if (cp) {
+ strcpy(incl_file, cp + 1 /* skip the slash */);
+ }
+
+ if (flag != no_include_prefix) fprintf(out, "#include \"%s\"\n\n", incl_file);
+
+ while (fgets(current_line, line_max, in) != NULL) {
+ cp = sindex(current_line, "#define");
+ if (cp != NULL) {
+ cp += strlen("#define");
+ if (!getarg(cp, routine_name, &cp)) {
+ error();
+ fprintf(errfile, "#define not followed by identifier\n");
+ }
+ /* watch out for multi-line macros: */
+ while (sindex(current_line, "\\\n")) {
+ if (fgets(current_line, line_max, in) == NULL) return;
+ }
+ } else if ((cp = sindex(current_line, "LISP:")) != NULL) {
+ char type_str[ident_max];
+ char routine_str[ident_max];
+ if (!reading_parameters &&
+ getarg(current_line, type_str, &pos) &&
+ getarg(pos, routine_str, &pos) &&
+ pos < cp) {
+ routine_call(in, out, current_line, type_str, routine_str,
+ cp + strlen("LISP:"));
+ } else if (getarg(cp + strlen("LISP:"), type_str, &pos)) {
+ macro_call(in, out, current_line, routine_name,
+ cp + strlen("LISP:"));
+ } else routine_call(in, out, current_line, type_name, routine_name,
+ cp + strlen("LISP:"));
+ } else if ((cp = sindex(current_line, "LISP-SRC:")) != NULL) {
+ lisp_code(in, cp + strlen("LISP-SRC:"));
+ } else if (reading_parameters && sindex(current_line, ")")) {
+ reading_parameters = false;
+ } else if (reading_parameters) { /* skip */ ;
+ } else if (getarg(current_line, type_name, &pos) &&
+ getarg(pos, routine_name, &pos)) {
+ /* we grabbed the type and routine name. Check to see if the
+ * parameter list is open but not closed on this line: */
+ if (sindex(current_line, "(") && !sindex(current_line, ")")) {
+ reading_parameters = true;
+ }
+ /* printf("saw %s %s\n", type_name, routine_name);*/
+ } else { /* wipe out names for safety: */
+ type_name[0] = EOS;
+ routine_name[0] = EOS;
+ }
+ }
+
+ fclose(in);
+}
+
+
+/* routine_call -- generate xlisp interface for C routine */
+/**/
+static void routine_call(in, out, curline, type_name, routine_name, arg_loc)
+ FILE *in; /* input file */
+ FILE *out; /* output file */
+ char *curline; /* input line */
+ char *type_name; /* type id */
+ char *routine_name; /* routine id */
+ char *arg_loc; /* location after "LISP:" */
+{
+
+ if (*routine_name == EOS) {
+ routine_name = type_name;
+ type_name = "void";
+ }
+ if (*routine_name == '*') {
+ char *r = routine_name;
+ while (*r != EOS) { /* shift left */
+ *r = *(r+1);
+ r++;
+ }
+ strcat(type_name, "*");
+ }
+ write_interface(in, out, type_name, routine_name, arg_loc, false);
+}
+
+
+/* sindex -- find substring */
+/**/
+static char *sindex(sup, sub)
+ char *sup; /* the containing string */
+ char *sub; /* the substring */
+{
+ int i;
+ for ( ; *sup != EOS; sup++) {
+ for (i = 0; true; i++) {
+ if (*(sub+i) == EOS) return sup;
+ if (*(sup+i) != *(sub+i)) break;
+ }
+ }
+ return EOS;
+}
+
+
+/* write_interface -- write SUBR for xlisp */
+/*
+ * NOTE: if is_macro and there are no arguments, then
+ * do not write parens: e.g. "foo" instead of "foo()"
+ */
+static void write_interface(in, out, type_name, fn_name, arg_loc, is_macro)
+ FILE *in; /* input file */
+ FILE *out; /* output file */
+ char *type_name; /* c type for return value */
+ char *fn_name; /* c function to be called */
+ char *arg_loc; /* LISP arg type are described here */
+ int is_macro; /* true if this is a macro */
+{
+ char lispfn[ident_max]; /* lisp fn name */
+ char *cp; /* a temporary */
+ int len; /* a string length */
+#define args_max 20
+ struct {
+ int index; /* table location for this type */
+ int res_flag; /* is a result returned? */
+ } args[args_max];
+ char arg_type[ident_max]; /* the original type spec */
+ char *c_type; /* c type for an argument */
+ char *c_str; /* temp for a c code line */
+ int argcnt = 0; /* counts arguments */
+ int i; /* argument index */
+ int result_flag = false; /* true if there are result parameters */
+ int result_x; /* index of result type */
+ char newline[line_max]; /* place to read continuation lines */
+
+
+/* printf("write_interface: %s %s %s", type_name, fn_name, arg_loc);*/
+ if (*type_name == EOS || *fn_name == EOS) {
+ error();
+ fprintf(errfile, "Error: bad syntax, maybe missing type\n");
+ return;
+ }
+
+ while (*arg_loc != '(' && *arg_loc != EOS) arg_loc++;
+ if (*arg_loc == EOS) {
+ error();
+ fprintf(errfile, "Error: '(' expected after 'LISP:'\n");
+ return;
+ } else arg_loc++;
+ if (!getarg(arg_loc, lispfn, &arg_loc)) {
+ error();
+ fprintf(stdout, "Error: lisp function name expected\n");
+ return;
+ }
+ /* make it upper case: */
+ for (cp = lispfn; *cp != EOS; cp++) {
+ if (islower(*cp)) *cp = toupper(*cp);
+ }
+
+ /* save SUBR name */
+ strcpy(subr_table[subr_table_x], lispfn);
+ subr_table_x++;
+
+ /* make lispfn lower case, dash, colon -> underscore: */
+ for (cp = lispfn; *cp != EOS; cp++) {
+ if (isupper(*cp)) *cp = tolower(*cp);
+ if (*cp == '-' || *cp == ':') *cp = '_';
+ }
+
+ /* append continuation lines to arg_loc to handle multi-line specs */
+ while (sindex(arg_loc, "*/") == NULL) {
+ /* remove newline */
+ if (strlen(arg_loc) > 0)
+ arg_loc[strlen(arg_loc) - 1] = EOS;
+ if (fgets(newline, line_max, in) == NULL) {
+ error();
+ fprintf(stdout, "Error: end of file unexpected\n");
+ exit(1);
+ }
+ if ((strlen(arg_loc) + strlen(newline)) > (3 * line_max)) {
+ error();
+ fprintf(stdout,
+ "Error: specification too long or missing end of comment.\n");
+ exit(1);
+ }
+ strcat(arg_loc, newline);
+ }
+
+ fprintf(out, "/%c xlc_%s -- interface to C routine %s */\n/**/\n",
+ '*', lispfn, fn_name);
+
+ fprintf(out, "LVAL xlc_%s(void)\n{\n", lispfn);
+ while (getarg(arg_loc, arg_type, &arg_loc)) {
+ int result_only_flag = false;
+
+ if (argcnt >= args_max) {
+ error();
+ fprintf(errfile,
+ "Internal error: too many args, increase args_max\n");
+ }
+ len = strlen(arg_type);
+ if (arg_type[len-1] == '*') {
+ arg_type[len-1] = EOS;
+ args[argcnt].res_flag = true;
+ result_flag = true;
+ } else if (arg_type[len-1] == '^') {
+ arg_type[len-1] = EOS;
+ args[argcnt].res_flag = true;
+ result_flag = true;
+ result_only_flag = true;
+ } else args[argcnt].res_flag = false;
+
+ args[argcnt].index = lookup(arg_type, 'L');
+ c_type = get_lisp_ctype(args[argcnt].index);
+
+ if (c_type == NULL) {
+ error();
+ fprintf(errfile, "Error: %s undefined, using int.\n",
+ arg_type);
+ c_type = "int";
+ args[argcnt].index = lookup("FIXNUM", 'L');
+ }
+ fprintf(out, " %s arg%d = ", c_type, argcnt+1);
+ if (result_only_flag) {
+ fprintf(out, "%s;\n",
+ get_lisp_initializer(args[argcnt].index));
+ } else if (args[argcnt].index == any_index) {
+ fprintf(out, "xlgetarg();\n");
+ } else {
+ c_str = "%s(%s());\n";
+ fprintf(out,c_str,
+ get_lisp_extract(args[argcnt].index),
+ get_lisp_getarg(args[argcnt].index));
+ }
+ argcnt++;
+ }
+
+ if (*arg_loc != ')') {
+ fprintf(errfile,
+ "Warning: paren expected immediately after last arg of %s\n",
+ lispfn);
+ }
+
+ /* check for close paren and close comment: */
+ cp = sindex(arg_loc, ")");
+ if (cp == NULL || sindex(cp+1, "*/") == NULL) {
+ error();
+ fprintf(errfile, "Warning: close paren and close comment expected\n");
+ }
+
+ /* lookup result type */
+ result_x = lookup(type_name, 'C');
+ if (result_x == 0) {
+ fprintf(errfile, "(Warning) unknown type: %s, assuming void\n",
+ type_name);
+ result_x = lookup("void", 'C');
+ }
+
+ /* if there are result parameters then return them rather than NIL
+ * when the type is void
+ */
+ if (get_c_special(result_x) == 'v' && result_flag) {
+ fprintf(out, " LVAL result;\n");
+ }
+
+ if (get_c_special(result_x) != 'v') {
+ /* declare result: */
+ fprintf(out, " %s result;\n", type_name);
+ }
+
+ /* check for end of argument list: */
+ fprintf(out, "\n xllastarg();\n");
+
+ /* if there are results, we'll call cons, so
+ * protect the result from garbage collection
+ * if necessary
+ */
+ if (result_flag && strcmp(type_name, "LVAL") == 0) {
+ fprintf(out, " xlprot1(result);\n");
+ }
+
+ /* call the c routine */
+ if (get_c_special(result_x) != 'v') {
+ fprintf(out, " result = ");
+ } else fprintf(out, " ");
+ fprintf(out, "%s", fn_name);
+ if (!is_macro || argcnt > 0) fprintf(out, "(");
+
+ /* pass arguments: */
+ for (i = 0; i < argcnt; i++) {
+ if (i > 0) fprintf(out, ", ");
+ if (args[i].res_flag) fprintf(out, "&");
+ fprintf(out, "arg%d", i+1);
+ }
+ if (!is_macro || argcnt > 0) fprintf(out, ")");
+ fprintf(out, ";\n");
+
+ /* put results (if any) on *RSLT* */
+ if (result_flag) {
+ int wrote_one_flag = false;
+ fprintf(out, " {\tLVAL *next = &getvalue(RSLT_sym);\n");
+ for (i = 0; i < argcnt; i++) {
+ if (args[i].res_flag) {
+ if (wrote_one_flag)
+ fprintf(out, "\tnext = &cdr(*next);\n");
+ wrote_one_flag = true;
+ fprintf(out, "\t*next = cons(NIL, NIL);\n");
+ fprintf(out, "\tcar(*next) = %s(arg%d);",
+ get_lisp_makenode(args[i].index), i+1);
+ }
+ }
+ fprintf(out, "\n }\n");
+
+ /* copy *RSLT* to result if appropriate */
+ if (get_c_special(result_x) == 'v') {
+ fprintf(out, " result = getvalue(RSLT_sym);\n");
+ }
+ }
+
+
+ /* generate xlpop() if there was an xlprot1() */
+ if (result_flag && strcmp(type_name, "LVAL") == 0) {
+ fprintf(out, " xlpop();\n");
+ }
+
+
+ /* now return actual return value */
+ if (get_c_special(result_x) == EOS) {
+ error();
+ fprintf(errfile, "Warning: unknown type from C, coercing to int.\n");
+ fprintf(out, " return cvfixnum((int) result);\n");
+ } else if (get_c_special(result_x) == 'v' && !result_flag) {
+ fprintf(out, " return NIL;\n");
+ } else if (get_c_special(result_x) == 'v' && result_flag) {
+ fprintf(out, " return result;\n");
+ } else if (get_c_special(result_x) == 's') {
+ fprintf(out, " if (result == NULL) return NIL;\n");
+ fprintf(out, " else return %s(result);\n",
+ get_c_conversion(result_x));
+ } else {
+ fprintf(out, " return %s(result);\n",
+ get_c_conversion(result_x));
+ }
+ fprintf(out, "}\n\n\n");
+}
+
+
+/* write_postlude -- write stuff at end of file */
+/**/
+static void write_postlude(out)
+ FILE *out;
+{
+ /* nothing to do for version 2 */
+}
+
+
+/* write_ptrfile -- write function definition table */
+/**/
+static void write_ptrfile(pf, df)
+ FILE *pf;
+ FILE *df;
+{
+ int n;
+ char *cp;
+ char cname[ident_max];
+
+ for (n = 0; n < subr_table_x; n++) {
+ strcpy(cname, subr_table[n]);
+ /* make cname lower case, dash,colon -> underscore: */
+ for (cp = cname; *cp != EOS; cp++) {
+ if (isupper(*cp)) *cp = tolower(*cp);
+ if (*cp == '-' || *cp == ':') *cp = '_';
+ }
+ fprintf(df, "extern LVAL xlc_%s(void);\n", cname);
+ fprintf(pf, " { \"%s\", S, xlc_%s}, \n", subr_table[n], cname);
+ }
+ printf(" Add %s to localdefs.h and add %s to localptrs.h\n",
+ def_file, ptr_file);
+}
+
+
+/* write_prelude -- write stuff at head of file */
+/**/
+static void write_prelude(out, out_file)
+ FILE *out;
+ char *out_file;
+{
+ int i = 2;
+ int col = strlen(out_file) + 21;
+ char *s;
+ fprintf(out, "/%c %s -- interface to ",
+ '*', out_file);
+ while ((s = cl_arg(i)) != NULL) {
+ if (i > 2) {
+ fprintf(out, ", ");
+ col += 2;
+ }
+ col += strlen(s) + 2;
+ if (col > 65) {
+ fprintf(out, "\n * ");
+ col = 4 + strlen(s) + 2;
+ }
+ fprintf(out, "%s", s);
+ i++;
+ }
+ fprintf(out, " */\n\n%cifndef mips\n%cinclude \"stdlib.h\"\n", '#', '#');
+ fprintf(out, "%cendif\n%cinclude \"xlisp.h\"\n\n", '#', '#');
+#ifdef S_TRUE
+ fprintf(out, "extern LVAL s_true;\n");
+ fprintf(out, "%cdefine cvboolean(i) ((i) ? s_true : NIL)\n", '#');
+#else
+ fprintf(out, "extern LVAL true;\n");
+ fprintf(out, "%cdefine cvboolean(i) ((i) ? true : NIL)\n", '#');
+#endif
+
+ fprintf(out, "%c%s\n",
+ '#',
+ "define testarg2(e) (moreargs() ? (e) : (getflonum(xltoofew())))");
+
+ fprintf(out, "%c%s\n%s\n%s\n",
+ '#',
+ "define xlgaanynum() (floatp(*xlargv) ? getflonum(nextarg()) : \\",
+ " (fixp(*xlargv) ? (double) getfixnum(nextarg()) : \\",
+/* note: getflonum never gets called here, but this makes typechecking happy */
+ " getflonum(xlbadtype(*xlargv))))");
+
+ fprintf(out, "%cdefine getboolean(lval) ((lval) != NIL)\n\n", '#');
+ fprintf(out, "extern LVAL RSLT_sym;\n\n\n");
+}
diff --git a/misc/intgen2.c b/misc/intgen2.c
new file mode 100644
index 0000000..f462815
--- /dev/null
+++ b/misc/intgen2.c
@@ -0,0 +1,910 @@
+/* intgen.c -- an interface generator for xlisp */
+
+/* (c) Copyright Carnegie Mellon University 1991
+ * For a statement of limited permission to use, see Permission.doc
+ *
+ * HISTORY
+ *
+ * 5-Jul-95 Roger Dannenberg
+ * strip directory prefixes from files before writing include statements
+ * 24-Oct-88 Roger Dannenberg at CMU
+ * Changed so that if C routine returns void and has result parameters,
+ * then result parameters are returned by the lisp subr as well as
+ * assigned to *RSLT*.
+ *
+ * 13-Apr-88 Roger Dannenberg at CMU
+ * Modified for xlisp version 2.0
+ *
+ * 22-Dec-87 Roger Dannenberg at NeXT
+ * Added FILE type.
+ *
+ * 21-May-87 Dale Amon at CMU CSD
+ * Included use of NODE *s_true under SCORE_EDITOR conditional. Standard
+ * xlisp code use NODE *true instead.
+ *
+ * 13-May-87 Dale Amon at CMU CSD
+ * Added conditional compilation switch SCORE_EDITOR so that this
+ * program will work with both standard XLISP sources and with Roger's
+ * (ahem) modified version. Also put in error checking for case where
+ * user does not specifiy an output file so program will exit instead
+ * of coredump.
+ */
+
+
+/* Summary and Design: (NOTE THAT AN INTGEN MANUAL IS AVAILABLE)
+ * The first command line argument gives the name of
+ * the .c file to generate. All following arguments are
+ * .h files to read and use as interface specifications.
+ *
+ * The main program opens the output file, calls
+ * write_prelude, and then process_file for each input
+ * file. Then call write_postlude and close the file.
+ *
+ * process_file opens an input file and reads each line
+ * into current_line.
+ * if the first characters of the file are "ih", then
+ * the rest of the file is processed as normal, except the
+ * .h extension of the file is replaced by .ih before the
+ * filename is written into an include statement in the
+ * output file. This is done to handle ".ih" files generated
+ * by the Andrew Toolkit Class processor.
+ * In any case, the first line of EVERY .h file is discarded.
+ * If #define is found, save the following identifier as
+ * macro_name.
+ * If "LISP:" is found, then see if it is preceded by one
+ * or two identifiers and an open paren.
+ * If yes, call routine_call,
+ * else call macro_call.
+ *
+ * routine_call gets the first one or two identifiers off the
+ * line into type_name and routine_name. If there is just one id,
+ * assign it to routine_name and make type_name = "void".
+ * If the routine_name starts with *, remove the * from
+ * routine_name and append "*" to type_name.
+ * Call write_interface with type_name, routine_name, and location
+ * of parameter type description after "LISP:".
+ *
+ * macro_call gets a type_name from the input line after
+ * "LISP:".
+ * Then call write_interface with type_name, macro_name, and
+ * location of parameter type description.
+ *
+ * lisp function names are saved in a table, and an
+ * initialization routine is written to install the new
+ * SUBRs into the xlisp symbol table, as well as to lookup
+ * RSLT_sym, the atom on which results are placed
+ *
+ *
+ */
+
+/* Turn on special handling for Roger's Score Editor if the following #define
+ * is uncommented:
+ */
+/* #define SCORE_EDITOR */
+
+/* Turn on special handling for Chris's Sound Editor if the following #define
+ * is uncommented:
+ */
+/* #define SOUND_EDITOR */
+
+/* Turn on special handling for Nyquist if the following #define
+ * is uncommented:
+ */
+#define NYQUIST
+
+/* atom 't is named s_true if this is defined, o.w. named true: */
+#define S_TRUE 1
+
+/* Turn on special handling for CMU MIDI Toolkit seq_type:
+ */
+#define SEQ_TYPE
+
+#define errfile stdout
+
+#define ident_max 100
+#define line_max 200
+#define subr_max 500
+
+/* prefix for include files not to be included in interface module */
+#define no_include_prefix '~'
+
+#define false 0
+#define true 1
+
+#include "stdlib.h"
+#include "switches.h"
+#include "cext.h"
+#include <string.h>
+#ifndef boolean
+typedef int boolean;
+#endif
+#include "stdio.h"
+#include "ctype.h"
+#include "cmdline.h"
+#ifdef MACINTOSH
+#include "console.h"
+#endif
+
+#ifdef MACINTOSH
+#define FILESEP ':'
+#else
+#ifdef WINDOWS
+#define FILESEP '\\'
+#else
+#define FILESEP '/'
+#endif
+#endif
+
+static char *sindex();
+
+#define whitep(c) ((c) == ' ' || (c) == '\t')
+#define symbolp(c) (isalpha(c) || (c) == '*' || (c) == '_' || (c) == '-' ||\
+ (c) == ':' || isdigit(c) || (c) == '^' || (c) == '*')
+
+/* c and Lisp parameters are encoded in the same table.
+ * Field type_id is the string name of the type.
+ * For c types (return types of C routines), code is 'C',
+ * convert gives the routine for making a lisp node from
+ * the c datum.
+ * listtype_or_special is "v" for types that should be
+ * returned as LISP NIL (e.g. "void"), "s" for types
+ * that when NULL should be returned as NIL, "r"
+ * for normal types, and "" to raise an error.
+ * ctype is not used and should be NULL.
+ * For Lisp types (from parameter specs), code is 'L'.
+ * convert gives the routine that extracts a C value
+ * from a lisp node whose type is given by the field
+ * getarg_or_special.
+ * c_type is the type of the local C variable which is
+ * passed as a parameter to the C routine.
+ * initializer is the initial value for result only parameters
+ *
+ * End of table is marked by a NULL type_id.
+ *
+ * Location 0 is reserved to indicate errors.
+ * Location 1 MUST BE type ANY
+ *
+ */
+
+#define any_index 1
+struct {
+ char *type_id;
+ char code;
+ char *convert;
+ char *getarg_or_special;
+ char *ctype;
+ char *makenode;
+ char *initializer;
+} type_table[] = {
+ {" ", ' ', NULL, NULL, NULL, NULL, NULL},
+ {"ANY", 'L', "", "", "LVAL", "", "NIL"},
+ {"ATOM", 'L', "", "xlgasymbol", "LVAL", "", "NIL"},
+ {"FILE", 'L', "getfile", "xlgastream", "FILE *", "cvfile", "NULL"},
+ {"FIXNUM", 'L', "getfixnum", "xlgafixnum", "long", "cvfixnum", "0"},
+ {"FIXNUM", 'L', "getfixnum", "xlgafixnum", "int", "cvfixnum", "0"},
+ {"FLOAT", 'L', "getflonum", "xlgaflonum", "float", "cvflonum", "0.0"},
+ {"FLONUM", 'L', "getflonum", "xlgaflonum", "double", "cvflonum", "0.0"},
+ {"ANYNUM", 'L', "testarg2", "xlgaanynum", "double", "cvflonum", "0.0"},
+ {"STRING", 'L', "getstring", "xlgastring", "unsigned char *", "cvstring", "NULL"},
+ {"BOOLEAN", 'L', "getboolean", "xlgetarg", "int", "cvboolean", "0"},
+ {"atom_type", 'C', "", "r", NULL, NULL, NULL},
+ {"LVAL", 'C', "", "r", NULL, NULL, "NIL"},
+
+#ifdef SOUND_EDITOR
+ /* Extensions for Sound Type: */
+ {"SOUND", 'L', "getsound", "xlgasound", "SoundPtr", "cvsound", "NULL"},
+ {"SoundPtr", 'C', "cvsound", "r", NULL, NULL, NULL},
+#endif
+
+#ifdef NYQUIST
+ {"SOUND", 'L', "getsound", "xlgasound", "sound_type", "cvsound", "NULL"},
+ {"sound_type", 'C', "cvsound", "r", NULL, NULL, NULL},
+#endif
+#ifdef SEQ_TYPE
+ {"SEQ", 'L', "getseq", "xlgaseq", "seq_type", "cvseq", "NULL"},
+ {"seq_type", 'C', "cvseq", "r", NULL, NULL, NULL},
+#endif
+#ifdef SCORE_EDITOR
+ {"VALUE", 'L', "getval", "xlgaval", "value_type", "cvval", "NULL"},
+ {"value_type", 'C', "cvval", "r", NULL, NULL, NULL},
+ {"EVENT", 'L', "getevent", "xlgaevent", "event_type", "cvevent", "NULL"},
+ {"event_type", 'C', "cvevent", "r", NULL, NULL, NULL},
+ {"score_type", 'C', "cvevent", "r", NULL, NULL, NULL},
+#endif
+#ifdef DMA_EXTENSIONS
+ /* begin DMA entries */
+ {"DEXT", 'L', "getdext", "xlgadext", "ext_type", "cvdext", "NULL"},
+ {"DEXT", 'C', "cvdext", "r", NULL, NULL, NULL},
+ {"SEXT", 'L', "getsext", "xlgasext", "ext_type", "cvsext", "NULL"},
+ {"SEXT", 'C', "cvsext", "r", NULL, NULL, NULL},
+ /* end DMA entries */
+#endif
+ {"int", 'C', "cvfixnum", "r", NULL, NULL, NULL},
+ {"long", 'C', "cvfixnum", "r", NULL, NULL, NULL},
+ {"boolean", 'C', "cvboolean", "r", NULL, NULL, NULL},
+ {"float", 'C', "cvflonum", "r", NULL, NULL, NULL},
+ {"double", 'C', "cvflonum", "r", NULL, NULL, NULL},
+ {"string", 'C', "cvstring", "s", NULL, NULL, NULL},
+ {"char*", 'C', "cvstring", "s", NULL, NULL, NULL},
+ {"char", 'C', "cvfixnum", "r", NULL, NULL, NULL},
+ {"string_type", 'C', "cvstring", "s", NULL, NULL, NULL},
+ {"FILE*", 'C', "cvfile", "s", NULL, NULL, NULL},
+ {"void", 'C', "", "v", NULL, NULL, NULL},
+/*eot*/ {NULL, ' ', NULL, NULL, NULL, NULL, NULL}};
+
+/* subr names get saved here: */
+char *subr_table[subr_max];
+int subr_table_x;
+
+#define get_c_special(i) type_table[(i)].getarg_or_special[0]
+#define get_c_conversion(i) type_table[(i)].convert
+#define get_lisp_extract(i) type_table[(i)].convert
+#define get_lisp_getarg(i) type_table[(i)].getarg_or_special
+#define get_lisp_ctype(i) type_table[(i)].ctype
+#define get_lisp_makenode(i) type_table[(i)].makenode
+#define get_lisp_initializer(i) type_table[(i)].initializer
+
+static void lisp_code();
+static int lookup();
+static void process_file();
+static void routine_call();
+static void write_interface();
+static void write_postlude();
+static void write_prelude();
+static void write_ptrfile();
+
+char source_file[ident_max]; /* source file */
+char current_line[4 * line_max]; /* current line in source file */
+char out_file[ident_max]; /* output file name */
+char ptr_file[ident_max]; /* ptr.h file name */
+char def_file[ident_max]; /* def.h file name */
+
+FILE *lispout = NULL; /* output for lisp source code (if any) */
+
+#define EOS '\000'
+
+/* getarg -- get an identifier from a string */
+/**/
+int getarg(start, result, pos)
+ char *start; /* where to start scanning */
+ char *result; /* where to put the identifier */
+ char **pos; /* ptr to char after identifier in source */
+{
+ char *save = result;
+ *result = EOS;
+ while (whitep(*start) && *start != EOS) start++;
+ if (*start == EOS) return false;
+ if (!symbolp(*start)) return false;
+
+ while (symbolp(*start) && *start != EOS) {
+ *result = *start;
+ result++;
+ start++;
+ }
+ *result = EOS;
+ *pos = start;
+ printf("getarg got %s\n", save);
+ return true;
+}
+
+
+/* error() -- print source file and line */
+/**/
+error()
+{
+ fprintf(errfile, "\n%s: |%s|\n", source_file, current_line);
+}
+
+
+/* lisp_code -- write lisp code to file */
+/*
+ * read from inp if necessary until close comment found
+ */
+static void lisp_code(inp, s)
+ FILE *inp;
+ char *s;
+{
+ char lisp[line_max];
+ char *endcomment;
+ char *inputline; /* for end of file detection */
+
+ if (lispout == NULL) {
+ char lisp_file_name[ident_max];
+ char *extension;
+ strcpy(lisp_file_name, out_file);
+ extension = sindex(lisp_file_name, ".c");
+ strcpy(extension, ".lsp"); /* overwrite .c with .lsp */
+ lispout = fopen(lisp_file_name, "w");
+ if (lispout == NULL) {
+ fprintf(stdout, "Error: couldn't open %s\n", lisp_file_name);
+ exit(1);
+ }
+ printf("writing %s ...\n", lisp_file_name);
+ }
+
+ strcpy(lisp, s); /* don't modify s */
+ inputline = lisp;
+ while (inputline != NULL &&
+ (endcomment = sindex(lisp, "*/")) == NULL) {
+ fputs(lisp, lispout);
+ inputline = fgets(lisp, line_max, inp);
+ }
+ strcpy(endcomment, "\n\n");
+ fputs(lisp, lispout);
+}
+
+
+/* lookup -- find type data */
+/**/
+static int lookup(s, t)
+ char *s;
+ char t;
+{
+ int i = 1;
+ while (type_table[i].type_id != NULL) {
+ if (type_table[i].code == t &&
+ strcmp(type_table[i].type_id, s) == 0)
+ return i;
+ i++;
+ }
+ return 0;
+}
+
+/* macro_call -- generate xlisp interface for C routine */
+/**/
+void macro_call(in, out, curline, macro_name, arg_loc)
+ FILE *in; /* input file */
+ FILE *out; /* output file */
+ char *curline; /* input line */
+ char *macro_name; /* name of the macro to call */
+ char *arg_loc; /* location after "LISP:" */
+{
+ char type_name[ident_max];
+ if (!getarg(arg_loc, type_name, &arg_loc)) {
+ error();
+ fprintf(errfile, "no type given for macro.\n");
+ } else {
+ write_interface(in, out, type_name, macro_name, arg_loc, true);
+ }
+}
+
+
+
+/* main -- generate an xlisp to c interface file */
+/**/
+int main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ char *s;
+ FILE *out;
+ FILE *ptrfile;
+ FILE *deffile;
+ int n;
+
+#ifdef MACINTOSH
+ argc = ccommand(&argv);
+#endif
+
+ for (n = 0; n < subr_max; n++)
+ {
+ subr_table[n] = (char *) malloc(ident_max);
+ subr_table[n][0] = EOS;
+ }
+ subr_table_x = 0;
+
+ cl_init(NULL, 0, NULL, 0, argv, argc);
+ if ((s = cl_arg(1)) != NULL) {
+ strcpy(out_file, s);
+ if (sindex(out_file, ".") == 0)
+ strcat(out_file, ".c");
+ else fprintf(stderr,
+ "1st command line argument should be a legal c identifier\n");
+ out = fopen(out_file, "w");
+ if (out == NULL) {
+ fprintf(stdout, "Error: couldn't open %s\n", out_file);
+ exit(1);
+ }
+ strcpy(ptr_file, s);
+ strcat(ptr_file, "ptrs.h");
+ ptrfile = fopen(ptr_file, "w");
+ if (ptrfile == NULL) {
+ fprintf(stdout, "Error: couldn't open %s\n", ptr_file);
+ exit(1);
+ }
+ strcpy(def_file, s);
+ strcat(def_file, "defs.h");
+ deffile = fopen(def_file, "w");
+ if (deffile == NULL) {
+ fprintf(stdout, "Error: couldn't open %s\n", def_file);
+ exit(1);
+ }
+ } else {
+ fprintf(stdout, "Error: no output file specified\n");
+ exit(1);
+ }
+
+ printf("writing %s ...\n", out_file);
+
+ write_prelude(out, out_file);
+ n = 2;
+ while ((s = cl_arg(n)) != NULL) {
+ printf(" %s\n", s);
+ process_file(s, out);
+ n++;
+ }
+ write_postlude(out);
+ fclose(out);
+ write_ptrfile(ptrfile, deffile);
+ fclose(ptrfile);
+ fclose(deffile);
+ if (lispout != NULL) fclose(lispout);
+ exit(0);
+}
+
+
+static void process_file(fname, out)
+ char *fname;
+ FILE *out;
+{
+ FILE *in;
+ char *cp;
+ char *pos;
+ char incl_file[ident_max]; /* name of file to include */
+ char type_name[ident_max]; /* the type of the routine */
+ char routine_name[ident_max]; /* the name of the routine or macro */
+ char flag = fname[0];
+ boolean reading_parameters = false; /* says we've got a routine, and
+ we're skipping over parameter declarations */
+
+ if (flag == no_include_prefix) fname++;
+
+ strcpy(source_file, fname); /* for error reporting */
+ in = fopen(fname, "r");
+ if (in == NULL) {
+ fprintf(errfile, "couldn't open %s\n", fname);
+ return;
+ }
+
+ /* first check out the first line: if the first two characters are
+ "ih", then replace fname with file.ih so that the CLASS ".ih"
+ file will be included instead of this ".h" file. This is a
+ hack to allow calls into Andrew Tool Kit objects.
+ */
+
+ strcpy(incl_file, fname);
+ if (fgets(current_line, line_max, in) != NULL) {
+ if (current_line[0] == 'i' && current_line[1] == 'h') {
+ cp = sindex(incl_file, ".h");
+ if (cp != NULL) {
+ strcpy(cp, ".ih");
+ }
+ }
+ }
+
+ /* strip off leading directory prefix, if any */
+ cp = strrchr(incl_file, FILESEP); /* find the last slash */
+ if (cp) {
+ strcpy(incl_file, cp + 1 /* skip the slash */);
+ }
+
+ if (flag != no_include_prefix) fprintf(out, "#include \"%s\"\n\n", incl_file);
+
+ while (fgets(current_line, line_max, in) != NULL) {
+ cp = sindex(current_line, "#define");
+ if (cp != NULL) {
+ cp += strlen("#define");
+ if (!getarg(cp, routine_name, &cp)) {
+ error();
+ fprintf(errfile, "#define not followed by identifier\n");
+ }
+ /* watch out for multi-line macros: */
+ while (sindex(current_line, "\\\n")) {
+ if (fgets(current_line, line_max, in) == NULL) return;
+ }
+ } else if ((cp = sindex(current_line, "LISP:")) != NULL) {
+ char type_str[ident_max];
+ char routine_str[ident_max];
+ if (!reading_parameters &&
+ getarg(current_line, type_str, &pos) &&
+ getarg(pos, routine_str, &pos) &&
+ pos < cp) {
+ routine_call(in, out, current_line, type_str, routine_str,
+ cp + strlen("LISP:"));
+ } else if (getarg(cp + strlen("LISP:"), type_str, &pos)) {
+ macro_call(in, out, current_line, routine_name,
+ cp + strlen("LISP:"));
+ } else routine_call(in, out, current_line, type_name, routine_name,
+ cp + strlen("LISP:"));
+ } else if ((cp = sindex(current_line, "LISP-SRC:")) != NULL) {
+ lisp_code(in, cp + strlen("LISP-SRC:"));
+ } else if (reading_parameters && sindex(current_line, ")")) {
+ reading_parameters = false;
+ } else if (reading_parameters) { /* skip */ ;
+ } else if (getarg(current_line, type_name, &pos) &&
+ getarg(pos, routine_name, &pos)) {
+ /* we grabbed the type and routine name. Check to see if the
+ * parameter list is open but not closed on this line: */
+ printf("type_name %s, routine_name %s\n", type_name, routine_name);
+ if (sindex(current_line, "(") && !sindex(current_line, ")")) {
+ reading_parameters = true;
+ }
+ /* printf("saw %s %s\n", type_name, routine_name);*/
+ } else { /* wipe out names for safety: */
+ type_name[0] = EOS;
+ routine_name[0] = EOS;
+ }
+ }
+
+ fclose(in);
+}
+
+
+/* routine_call -- generate xlisp interface for C routine */
+/**/
+static void routine_call(in, out, curline, type_name, routine_name, arg_loc)
+ FILE *in; /* input file */
+ FILE *out; /* output file */
+ char *curline; /* input line */
+ char *type_name; /* type id */
+ char *routine_name; /* routine id */
+ char *arg_loc; /* location after "LISP:" */
+{
+
+ if (*routine_name == EOS) {
+ routine_name = type_name;
+ type_name = "void";
+ }
+ if (*routine_name == '*') {
+ char *r = routine_name;
+ while (*r != EOS) { /* shift left */
+ *r = *(r+1);
+ r++;
+ }
+ strcat(type_name, "*");
+ }
+ write_interface(in, out, type_name, routine_name, arg_loc, false);
+}
+
+
+/* sindex -- find substring */
+/**/
+static char *sindex(sup, sub)
+ char *sup; /* the containing string */
+ char *sub; /* the substring */
+{
+ int i;
+ for ( ; *sup != EOS; sup++) {
+ for (i = 0; true; i++) {
+ if (*(sub+i) == EOS) return sup;
+ if (*(sup+i) != *(sub+i)) break;
+ }
+ }
+ return EOS;
+}
+
+
+/* write_interface -- write SUBR for xlisp */
+/*
+ * NOTE: if is_macro and there are no arguments, then
+ * do not write parens: e.g. "foo" instead of "foo()"
+ */
+static void write_interface(in, out, type_name, fn_name, arg_loc, is_macro)
+ FILE *in; /* input file */
+ FILE *out; /* output file */
+ char *type_name; /* c type for return value */
+ char *fn_name; /* c function to be called */
+ char *arg_loc; /* LISP arg type are described here */
+ int is_macro; /* true if this is a macro */
+{
+ char lispfn[ident_max]; /* lisp fn name */
+ char *cp; /* a temporary */
+ int len; /* a string length */
+#define args_max 20
+ struct {
+ int index; /* table location for this type */
+ int res_flag; /* is a result returned? */
+ } args[args_max];
+ char arg_type[ident_max]; /* the original type spec */
+ char *c_type; /* c type for an argument */
+ char *c_str; /* temp for a c code line */
+ int argcnt = 0; /* counts arguments */
+ int i; /* argument index */
+ int result_flag = false; /* true if there are result parameters */
+ int result_x; /* index of result type */
+ char newline[line_max]; /* place to read continuation lines */
+
+
+/* printf("write_interface: %s %s %s", type_name, fn_name, arg_loc);*/
+ if (*type_name == EOS || *fn_name == EOS) {
+ error();
+ fprintf(errfile, "Error: bad syntax, maybe missing type\n");
+ return;
+ }
+
+ while (*arg_loc != '(' && *arg_loc != EOS) arg_loc++;
+ if (*arg_loc == EOS) {
+ error();
+ fprintf(errfile, "Error: '(' expected after 'LISP:'\n");
+ return;
+ } else arg_loc++;
+ if (!getarg(arg_loc, lispfn, &arg_loc)) {
+ error();
+ fprintf(stdout, "Error: lisp function name expected\n");
+ return;
+ }
+ /* make it upper case: */
+ for (cp = lispfn; *cp != EOS; cp++) {
+ if (islower(*cp)) *cp = toupper(*cp);
+ }
+
+ /* save SUBR name */
+ strcpy(subr_table[subr_table_x], lispfn);
+ subr_table_x++;
+
+ /* make lispfn lower case, dash, colon -> underscore: */
+ for (cp = lispfn; *cp != EOS; cp++) {
+ if (isupper(*cp)) *cp = tolower(*cp);
+ if (*cp == '-' || *cp == ':') *cp = '_';
+ }
+
+ /* append continuation lines to arg_loc to handle multi-line specs */
+ while (sindex(arg_loc, "*/") == NULL) {
+ /* remove newline */
+ if (strlen(arg_loc) > 0)
+ arg_loc[strlen(arg_loc) - 1] = EOS;
+ if (fgets(newline, line_max, in) == NULL) {
+ error();
+ fprintf(stdout, "Error: end of file unexpected\n");
+ exit(1);
+ }
+ if ((strlen(arg_loc) + strlen(newline)) > (3 * line_max)) {
+ error();
+ fprintf(stdout,
+ "Error: specification too long or missing end of comment.\n");
+ exit(1);
+ }
+ strcat(arg_loc, newline);
+ }
+
+ fprintf(out, "/%c xlc_%s -- interface to C routine %s */\n/**/\n",
+ '*', lispfn, fn_name);
+
+ fprintf(out, "LVAL xlc_%s(void)\n{\n", lispfn);
+ while (getarg(arg_loc, arg_type, &arg_loc)) {
+ int result_only_flag = false;
+
+ if (argcnt >= args_max) {
+ error();
+ fprintf(errfile,
+ "Internal error: too many args, increase args_max\n");
+ }
+ len = strlen(arg_type);
+ if (arg_type[len-1] == '*') {
+ arg_type[len-1] = EOS;
+ args[argcnt].res_flag = true;
+ result_flag = true;
+ } else if (arg_type[len-1] == '^') {
+ arg_type[len-1] = EOS;
+ args[argcnt].res_flag = true;
+ result_flag = true;
+ result_only_flag = true;
+ } else args[argcnt].res_flag = false;
+
+ args[argcnt].index = lookup(arg_type, 'L');
+ c_type = get_lisp_ctype(args[argcnt].index);
+
+ if (c_type == NULL) {
+ error();
+ fprintf(errfile, "Error: %s undefined, using int.\n",
+ arg_type);
+ c_type = "int";
+ args[argcnt].index = lookup("FIXNUM", 'L');
+ }
+ fprintf(out, " %s arg%d = ", c_type, argcnt+1);
+ if (result_only_flag) {
+ fprintf(out, "%s;\n",
+ get_lisp_initializer(args[argcnt].index));
+ } else if (args[argcnt].index == any_index) {
+ fprintf(out, "xlgetarg();\n");
+ } else {
+ c_str = "%s(%s());\n";
+ fprintf(out,c_str,
+ get_lisp_extract(args[argcnt].index),
+ get_lisp_getarg(args[argcnt].index));
+ }
+ argcnt++;
+ }
+
+ if (*arg_loc != ')') {
+ fprintf(errfile,
+ "Warning: paren expected immediately after last arg of %s\n",
+ lispfn);
+ }
+
+ /* check for close paren and close comment: */
+ cp = sindex(arg_loc, ")");
+ if (cp == NULL || sindex(cp+1, "*/") == NULL) {
+ error();
+ fprintf(errfile, "Warning: close paren and close comment expected\n");
+ }
+
+ /* lookup result type */
+ result_x = lookup(type_name, 'C');
+ if (result_x == 0) {
+ fprintf(errfile, "Error: unknown type: %s, assuming void\n",
+ type_name);
+ result_x = lookup("void", 'C');
+ }
+
+ /* if there are result parameters then return them rather than NIL
+ * when the type is void
+ */
+ if (get_c_special(result_x) == 'v' && result_flag) {
+ fprintf(out, " LVAL result;\n");
+ }
+
+ if (get_c_special(result_x) != 'v') {
+ /* declare result: */
+ fprintf(out, " %s result;\n", type_name);
+ }
+
+ /* check for end of argument list: */
+ fprintf(out, "\n xllastarg();\n");
+
+ /* if there are results, we'll call cons, so
+ * protect the result from garbage collection
+ * if necessary
+ */
+ if (result_flag && strcmp(type_name, "LVAL") == 0) {
+ fprintf(out, " xlprot1(result);\n");
+ }
+
+ /* call the c routine */
+ if (get_c_special(result_x) != 'v') {
+ fprintf(out, " result = ");
+ } else fprintf(out, " ");
+ fprintf(out, "%s", fn_name);
+ if (!is_macro || argcnt > 0) fprintf(out, "(");
+
+ /* pass arguments: */
+ for (i = 0; i < argcnt; i++) {
+ if (i > 0) fprintf(out, ", ");
+ if (args[i].res_flag) fprintf(out, "&");
+ fprintf(out, "arg%d", i+1);
+ }
+ if (!is_macro || argcnt > 0) fprintf(out, ")");
+ fprintf(out, ";\n");
+
+ /* put results (if any) on *RSLT* */
+ if (result_flag) {
+ int wrote_one_flag = false;
+ fprintf(out, " {\tLVAL *next = &getvalue(RSLT_sym);\n");
+ for (i = 0; i < argcnt; i++) {
+ if (args[i].res_flag) {
+ if (wrote_one_flag)
+ fprintf(out, "\tnext = &cdr(*next);\n");
+ wrote_one_flag = true;
+ fprintf(out, "\t*next = cons(NIL, NIL);\n");
+ fprintf(out, "\tcar(*next) = %s(arg%d);",
+ get_lisp_makenode(args[i].index), i+1);
+ }
+ }
+ fprintf(out, "\n }\n");
+
+ /* copy *RSLT* to result if appropriate */
+ if (get_c_special(result_x) == 'v') {
+ fprintf(out, " result = getvalue(RSLT_sym);\n");
+ }
+ }
+
+
+ /* generate xlpop() if there was an xlprot1() */
+ if (result_flag && strcmp(type_name, "LVAL") == 0) {
+ fprintf(out, " xlpop();\n");
+ }
+
+
+ /* now return actual return value */
+ if (get_c_special(result_x) == EOS) {
+ error();
+ fprintf(errfile, "Warning: unknown type from C, coercing to int.\n");
+ fprintf(out, " return cvfixnum((int) result);\n");
+ } else if (get_c_special(result_x) == 'v' && !result_flag) {
+ fprintf(out, " return NIL;\n");
+ } else if (get_c_special(result_x) == 'v' && result_flag) {
+ fprintf(out, " return result;\n");
+ } else if (get_c_special(result_x) == 's') {
+ fprintf(out, " if (result == NULL) return NIL;\n");
+ fprintf(out, " else return %s(result);\n",
+ get_c_conversion(result_x));
+ } else {
+ fprintf(out, " return %s(result);\n",
+ get_c_conversion(result_x));
+ }
+ fprintf(out, "}\n\n\n");
+}
+
+
+/* write_postlude -- write stuff at end of file */
+/**/
+static void write_postlude(out)
+ FILE *out;
+{
+ /* nothing to do for version 2 */
+}
+
+
+/* write_ptrfile -- write function definition table */
+/**/
+static void write_ptrfile(pf, df)
+ FILE *pf;
+ FILE *df;
+{
+ int n;
+ char *cp;
+ char cname[ident_max];
+
+ for (n = 0; n < subr_table_x; n++) {
+ strcpy(cname, subr_table[n]);
+ /* make cname lower case, dash,colon -> underscore: */
+ for (cp = cname; *cp != EOS; cp++) {
+ if (isupper(*cp)) *cp = tolower(*cp);
+ if (*cp == '-' || *cp == ':') *cp = '_';
+ }
+ fprintf(df, "extern LVAL xlc_%s(void);\n", cname);
+ fprintf(pf, " { \"%s\", S, xlc_%s}, \n", subr_table[n], cname);
+ }
+ printf(" Add %s to localdefs.h and add %s to localptrs.h\n",
+ def_file, ptr_file);
+}
+
+
+/* write_prelude -- write stuff at head of file */
+/**/
+static void write_prelude(out, out_file)
+ FILE *out;
+ char *out_file;
+{
+ int i = 2;
+ int col = strlen(out_file) + 21;
+ char *s;
+ fprintf(out, "/%c %s -- interface to ",
+ '*', out_file);
+ while ((s = cl_arg(i)) != NULL) {
+ if (i > 2) {
+ fprintf(out, ", ");
+ col += 2;
+ }
+ col += strlen(s) + 2;
+ if (col > 65) {
+ fprintf(out, "\n * ");
+ col = 4 + strlen(s) + 2;
+ }
+ fprintf(out, "%s", s);
+ i++;
+ }
+ fprintf(out, " */\n\n%cifndef mips\n%cinclude \"stdlib.h\"\n", '#', '#');
+ fprintf(out, "%cendif\n%cinclude \"xlisp.h\"\n\n", '#', '#');
+#ifdef S_TRUE
+ fprintf(out, "extern LVAL s_true;\n");
+ fprintf(out, "%cdefine cvboolean(i) ((i) ? s_true : NIL)\n", '#');
+#else
+ fprintf(out, "extern LVAL true;\n");
+ fprintf(out, "%cdefine cvboolean(i) ((i) ? true : NIL)\n", '#');
+#endif
+
+ fprintf(out, "%c%s\n",
+ '#',
+ "define testarg2(e) (moreargs() ? (e) : (getflonum(xltoofew())))");
+
+ fprintf(out, "%c%s\n%s\n%s\n",
+ '#',
+ "define xlgaanynum() (floatp(*xlargv) ? getflonum(nextarg()) : \\",
+ " (fixp(*xlargv) ? (double) getfixnum(nextarg()) : \\",
+/* note: getflonum never gets called here, but this makes typechecking happy */
+ " getflonum(xlbadtype(*xlargv))))");
+
+ fprintf(out, "%cdefine getboolean(lval) ((lval) != NIL)\n\n", '#');
+ fprintf(out, "extern LVAL RSLT_sym;\n\n\n");
+}
diff --git a/misc/intgen_win32/intgen.dsp b/misc/intgen_win32/intgen.dsp
new file mode 100644
index 0000000..f019567
--- /dev/null
+++ b/misc/intgen_win32/intgen.dsp
@@ -0,0 +1,113 @@
+# Microsoft Developer Studio Project File - Name="intgen" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=intgen - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "intgen.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "intgen.mak" CFG="intgen - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "intgen - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "intgen - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "intgen - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "WinRel"
+# PROP Intermediate_Dir "WinRel"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\..\sys\win\msvc" /I "..\..\cmt" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "intgen - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "WinDebug"
+# PROP Intermediate_Dir "WinDebug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\sys\win\msvc" /I "..\..\cmt" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /D "_DEBUG" /D "DEBUG_INPUT" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib winmm.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "intgen - Win32 Release"
+# Name "intgen - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\cmdline.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\intgen2.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\cmdline.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\sys\win\msvc\switches.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/misc/intgen_win32/intgen.vcproj b/misc/intgen_win32/intgen.vcproj
new file mode 100644
index 0000000..072a813
--- /dev/null
+++ b/misc/intgen_win32/intgen.vcproj
@@ -0,0 +1,253 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="intgen"
+ ProjectGUID="{378FBAED-0CA5-4CFB-ACF4-CCEDF8A4596E}"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\WinDebug"
+ IntermediateDirectory=".\WinDebug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\WinDebug/intgen.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\sys\win\msvc,..\..\cmt"
+ PreprocessorDefinitions="_CONSOLE;WIN32;_DEBUG;DEBUG_INPUT"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ PrecompiledHeaderFile=".\WinDebug/intgen.pch"
+ AssemblerListingLocation=".\WinDebug/"
+ ObjectFile=".\WinDebug/"
+ ProgramDataBaseFileName=".\WinDebug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib winmm.lib"
+ OutputFile=".\WinDebug/intgen.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\WinDebug/intgen.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\WinDebug/intgen.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\WinRel"
+ IntermediateDirectory=".\WinRel"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\WinRel/intgen.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\sys\win\msvc,..\..\cmt"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\WinRel/intgen.pch"
+ AssemblerListingLocation=".\WinRel/"
+ ObjectFile=".\WinRel/"
+ ProgramDataBaseFileName=".\WinRel/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile=".\WinRel/intgen.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ProgramDatabaseFile=".\WinRel/intgen.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\WinRel/intgen.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\cmdline.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\intgen.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="..\cmdline.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\sys\win\msvc\switches.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/misc/mac-to-win.lsp b/misc/mac-to-win.lsp
new file mode 100644
index 0000000..1819ed8
--- /dev/null
+++ b/misc/mac-to-win.lsp
@@ -0,0 +1,41 @@
+;; mac-to-win -- convert text files in nyquist project
+
+;; NOTE: this might work to convert any source tree to the local newline
+;; convention, but it was written to run under windows and convert mac
+;; sources to windows so that I could run windiff on the files. -RBD
+
+;; files.txt is a listing of all the component files
+
+(defun mac-to-win (output-path)
+ (let (files filename)
+ (setf files (open "files.txt" :direction :input))
+ (while (setf filename (read-line files))
+ (process-file filename output-path))
+ (close files)))
+
+
+(defun process-file (filename output-path)
+ (let ((filetype (char filename 0)))
+ (cond ((eq filetype #\a)
+ (setf filename (subseq filename 2))
+ (convert-file filename output-path)))))
+
+(defun convert-file (filename output-path)
+ (let (infile outfile outfilename line)
+ (setf outfilename (strcat output-path filename))
+ (setf infile (open filename :direction :input))
+ (setf outfile (open outfilename :direction :output))
+ (cond ((null infile)
+ (format t "Could not open ~A~%" filename))
+ ((null outfile)
+ (format t "Could not open ~A~%" outfilename))
+ (t (format t "~A~%" filename)
+ (while (setf line (read-line infile))
+ (format outfile "~A~%" line))
+ (close infile)
+ (close outfile)))))
+
+(defun convert-mac-to-win ()
+ (setdir "d:/rbd/icm_nyquist")
+ (mac-to-win "d:/rbd/icm_nyquist_win/"))
+
diff --git a/misc/makefile.lsp b/misc/makefile.lsp
new file mode 100644
index 0000000..29d6990
--- /dev/null
+++ b/misc/makefile.lsp
@@ -0,0 +1,679 @@
+;; makefile.lsp -- builds makefiles for various machine types
+
+(setf old-system-types '(rs6k next pmax sparc sgi))
+(setf system-types '(alsa nonalsa))
+
+(if (not (boundp 'system-type)) (setf system-type nil))
+(if (not (boundp 'target-file)) (setf target-file "ny"))
+
+(format t "System types: ~A~%" system-types)
+(format t
+ "The following types are not maintained but might get close: ~A~%"
+ old-system-types)
+(format t "Current type: ~A~%" system-type)
+(format t "Current target: ~A~%" target-file)
+(format t "~%Instructions: (run from top nyquist directory)~%")
+(format t "Choose a system from the list above by typing:~%")
+(format t "\t(setf system-type '<a system type>)~%")
+(format t "Override the executable name or location by:~%")
+(format t "\t(setf target-file \"unix-path-name/ny\")~%")
+(format t "To build the Makefile, type:~%")
+(format t "\t(makefile)~%")
+(format t "To make Makefiles for all system types, type:~%")
+(format t "\t(makeall)~%")
+(format t "To make sndfn.wcl and sndfn.cl, type:~%")
+(format t "\t(commandline)~%")
+
+;(format t "To build the Makesrc file, type:~%")
+;(format t "\t(makesrc)~%")
+;(format t
+;"Note: Makesrc is used to update sources from other directories.
+; It isn't necessary if you got the sources from the normal
+; .tar file release of Nyquist
+;")
+
+
+(setf xlfiles '("extern" "xldmem"
+ "xlbfun" "xlcont" "xldbug" "xleval"
+ "xlfio" "xlftab" "xlglob" "xlimage" "xlinit" "xlio" "xlisp"
+ "xljump" "xllist" "xlmath" "xlobj" "xlpp" "xlprin" "xlread"
+ "xlstr" "xlsubr" "xlsym" "xlsys" "path"))
+
+(setf xlfiles-h '("osdefs" "osptrs" "xldmem" "xlisp" "extern"))
+
+(setf xlfiles-lsp '("xlinit" "misc" "evalenv" "printrec"))
+
+; ************************************
+; CHANGED stksrcfiles. PJM July 2007
+; ************************************
+
+(setf stksrcfiles '("Generator" "SineWave" "Function" "FileRead" "FileWvIn" "Effect"
+ "Clarinet" "Delay" "DelayL" "Envelope" "Filter"
+ "Instrmnt" "Noise" "OneZero" "ReedTable" "Saxofony" "Stk"
+ "WaveLoop" "WvIn"
+ "NRev" "JCRev" "PRCRev" "PitShift" "Chorus"
+ "Bowed" "BowTable" "ADSR" "OnePole" "BiQuad"
+ "BandedWG" "DelayA"
+ "Mandolin" "PluckTwo"
+ "Sitar" "ModalBar" "Modal"
+ "Flute" "JetTable" "PoleZero"
+))
+
+; ***************************************************
+; CHANGED stkfiles. PJM July 2007
+; Added stkint, An interface for new stk instruments
+; ***************************************************
+
+(setf stkfiles '("stkinit" "instr" "stkint"))
+
+(setf fftfiles '("fftext" "fftlib" "matlib"))
+
+; note: audio<sys> and snd<sys> will be prepended to this list, e.g.
+; the strings "audiooss" and "sndlinux" will be added for linux systems
+;
+(defun init-sndfiles ()
+ (setf sndfiles '("ieeecvt" "snd" "sndcvt" "sndio" "sndheader"))
+ (setf sndfiles-lsp '("snd")))
+
+(init-sndfiles)
+
+(setf depends-exceptions '(
+ ("nyqsrc/handlers" "")
+ ;("nyqsrc/sndfail" "")
+ ("nyqsrc/local" "xlisp/xlisp.h nyqsrc/sound.h")
+ ("nyqsrc/stats" "nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h")
+ ("snd/sndcvt" "snd/snd.h")
+ ("snd/sndio" "snd/snd.h")
+ ("snd/audiors6k" "snd/snd.h")
+ ("snd/audionext" "snd/snd.h")
+ ("snd/audiosgi" "snd/snd.h")
+ ("snd/audiopmax" "snd/snd.h")
+ ("snd/audiosparc" "snd/snd.h")
+ ("snd/audiolinux" "snd/snd.h")
+ ("snd/audiooss" "snd/snd.h")
+ ("nyqsrc/sndwritepa" "nyqsrc/sndwrite.h")
+ ("nyqsrc/sndfnint" "") ; sparc needs explicit rule for sndfnint.o
+ ("nyqsrc/seqfnint" "") ; ditto for seqfnint.o
+))
+
+(setf nyqfiles-lsp '("init" "nyquist" "seqmidi" "seq" "makefile" "update" "transfiles" "examples" "nyinit"))
+
+(setf system-types-as-strings (mapcar #'string-downcase
+ (mapcar #'symbol-name system-types)))
+(setf nyqfiles-lsp (append nyqfiles-lsp system-types-as-strings))
+
+(setf nyqfiles-h '("localdefs" "localptrs" "seqdecls" "cque" "switches"))
+
+(setf intfiles '("sndfnint" "seqfnint"))
+
+(setf extrafiles nil)
+;(dolist (m system-types)
+; (push (strcat "Makefile."
+; (string-downcase (symbol-name m)))
+; extrafiles))
+(push "export" extrafiles)
+(push "README" extrafiles)
+(push "howtorelease.doc" extrafiles)
+
+(setf cmtfiles '("cext" "cleanup" "cmdline" "cmtcmd"
+ "moxc" "mem" "midifile" "midifns" "record"
+ "seq" "seqmread" "seqmwrite" "seqread" "seqwrite" "tempomap"
+ "timebase" "userio")) ; "midimgr" - removed by RBD
+
+(setf cmtfiles-h '("mfmidi" "midicode" "midierr" "musiprog"
+ "pitch" "swlogic" "hash" "hashrout" "io" "midibuff"))
+
+
+(setf nylsffiles '("aiff" "alaw" "au" "avr" "broadcast"
+ "caf" "command" "common" "dither"
+ "double64" "dwd" "dwvw" "file_io"
+ "flac" "float32" "gsm610" "htk"
+ "ima_adpcm" "interleave" "ircam" "macbinary3"
+ "macos" "mat4" "mat5" "ms_adpcm"
+ "nist" "ogg" "paf"
+ "pcm" "pvf" "raw" "rx2" "sd2"
+ "sds" "sndfile" "strings" "svx"
+ "txw" "ulaw" "voc" "vox_adpcm"
+ "w64" "wav" "wav_w64" "wve"
+ "xi" "g72x"
+ "GSM610/add" "GSM610/code" "GSM610/decode"
+ "GSM610/gsm_create" "GSM610/gsm_decode"
+ "GSM610/gsm_destroy" "GSM610/gsm_encode"
+ "GSM610/gsm_option" "GSM610/long_term"
+ "GSM610/lpc" "GSM610/preprocess"
+ "GSM610/rpe" "GSM610/short_term"
+ "GSM610/table"
+ "G72x/g721" "G72x/g723_16" "G72x/g723_24"
+ "G72x/g723_40" "G72x/g72x"))
+
+(setf nylsffiles-h '("common" "config" "float_cast" "sfconfig"
+ "endian" "sf_unistd" "sndfile" "wav_w64"
+ "GSM610/gsm610_priv.h" "GSM610/gsm.h"
+ "G72x/g72x.h" "G72x/g72x_priv.h"))
+
+(defun insert-separator (pre sep lis)
+ (mapcar #'(lambda (pair)
+ (cond ((= (length pair) 2)
+ (strcat pre (car pair) sep (cadr pair) ".h"))
+ (t
+ (strcat (car pair) pre (cadr pair) sep (caddr pair) ".h"))))
+ lis))
+
+;; COMMAND-PREFIX -- insert prefix before each file
+;;
+(defun command-prefix (prefix lis)
+ (mapcar #'(lambda (item) (list prefix item))
+ lis))
+
+(defun fix-sndwritepa (lis)
+ ;; exception: sndwritepa.h -> sndwrite.h
+ (mapcar #'(lambda (f)
+ (cond ((equal f "sndwritepa") "sndwrite")
+ (t f)))
+ lis))
+
+;; COMMAND-FILELIST -- build files for command line
+;;
+(defun command-filelist (prefix separator)
+ (let ()
+ (setf filelist '(("snd" "snd")))
+ (setf filelist (append filelist
+ (command-prefix "nyqsrc"
+ (fix-sndwritepa nyqsrcfiles))))
+ (display "after nyqsrc" filelist nyqsrcfiles)
+ (setf filelist (append filelist '(("~" "nyqsrc" "sndheader"))))
+ (setf filelist (append filelist (command-prefix "tran" transfiles)))
+ (cons (strcat prefix "nyqsrc" separator "sndfnint")
+ (insert-separator prefix separator filelist))))
+
+
+;; COMMANDLINE -- build sndfn.cl and sndfn.wcl for mac and windows
+;; versions of intgen; the files will be written to current directory
+;;
+(defun commandline ()
+ (princ "Your current directory should be nyquist, and you should have\n")
+ (princ "just evaluated (load \"misc/makefile\") and (commandline).\n")
+ (load "misc/transfiles") ;; get current versions of transfiles and nyqsrcfiles
+ (let (filelist outf)
+ (setf filelist (command-filelist "" "\\"))
+ (setf outf (open "sndfn.wcl" :direction :output))
+ (write-file-list outf filelist #\ )
+ (close outf)
+ ; now do the mac
+ (setf filelist (command-filelist "" "/"))
+ (setf outf (open "sndfn.cl" :direction :output))
+ (write-file-list outf filelist #\ )
+ (close outf)
+ (princ "On Mac OS-X, you should now (exit) nyquist, and at the commandline\n")
+ (princ "run macosxproject/build/Development/intgen @sndfn.cl\n")
+ (princ "updates to sndfn.cl and sndfn.wcl should be moved to nyqsrc\n")
+ ))
+
+;; MAKEALL - makes all makefiles and copies them to nyqsrc
+;;
+;; run this in nyquist/src
+;;
+(defun makeall ()
+; (makesrc)
+; (system "cp -p Makesrc nyqsrc")
+ (dolist (m system-types)
+ (setf system-type m)
+ (setf m (string-downcase (symbol-name m)))
+ (init-sndfiles)
+ (makefile)))
+
+;; MAKE-AUDIO-NAME -- (strcat "audio" system-name)
+;; jlh1 is audiooss something I need to track down and consider changing?
+(defun make-audio-name (system-name)
+ (cond ((eq system-type 'linux)
+ "audiooss")
+ (t (strcat "audio" system-name))))
+
+;; MAKE-SND-NAME -- (strcat "audio" system-name)
+(defun make-snd-name (system-name)
+ (strcat "snd" system-name))
+
+
+;; MAKEFILE - creates a Makefile from a list of sources
+;;
+;; reads sources from transfiles.lsp
+
+;; *********************************************************
+;; CHANGED. PJM July 2007
+;; JAVASRC separators must be double bar \\
+;; Added onlyny: to compile only Nyquist. javac not needed
+;; *********************************************************
+
+(defun makefile ()
+ (let (system-name outf outf-name)
+ (load "misc/transfiles.lsp") ; just to make sure we're current
+ (while (null system-type)
+ (format t "Write Makefile for what system? One of:~A~%" system-types)
+ (setf system-type (read))
+ (cond ((not (member system-type system-types))
+ (format t "Unknown system type.~%")
+ (setf system-type nil))))
+ (setf system-name (string-downcase
+ (symbol-name system-type)))
+ (setf outf-name (strcat "sys/unix/" system-name "/Makefile"))
+ (format t "Opening for output: ~A\n" outf-name)
+ (setf outf (open outf-name :direction :output))
+ (cond ((null outf)
+ (error "could not open output file" outf-name)))
+ (setf sndfiles (cons (make-audio-name system-name)
+ (cons (make-snd-name system-name) sndfiles)))
+ (format outf
+ "#
+# Makefile for Nyquist, SYSTEM-TYPE is ~A
+# run make in the top-level Nyquist directory to compile Nyquist
+#
+# NOTE: this file is machine-generated. DO NOT EDIT!
+# Instead, modify makefile.lsp and regenerate the makefile.
+# Ports and bug fixes are welcome - please mail them to
+# dannenberg@cs.cmu.edu. Thanks.
+#
+
+# This is the resulting executable (normally \"ny\"):
+NY = ~A
+
+OPT = -O2 -m32
+# OPT = -g -m32
+
+EVERYTHING = $(NY) runtime/system.lsp jnyqide/jNyqIDE.jar \\
+ bin/ser-to-osc bin/test-client
+
+CURRENT = $(EVERYTHING)
+
+current: $(CURRENT)
+
+onlyny: $(NY) runtime/system.lsp
+
+JAVASRC = jnyqide/browser.java jnyqide/NyquistThread.java \\
+ jnyqide/Pair.java jnyqide/BareBonesBrowserLaunch.java \\
+ jnyqide/EnvelopeFrame.java jnyqide/Piano_Roll.java \\
+ jnyqide/FindDialog.java jnyqide/PlotFrame.java \\
+ jnyqide/InstrumentCharacteristics.java \\
+ jnyqide/PlotMouseAdapter.java \\
+ jnyqide/Jslide.java jnyqide/PopupListener.java \\
+ jnyqide/LispFileFilter.java jnyqide/PreferencesDialog.java \\
+ jnyqide/MainFrame_AboutBox.java jnyqide/ReplaceDialog.java \\
+ jnyqide/MainFrame.java jnyqide/SpringUtilities.java \\
+ jnyqide/Main.java \\
+ jnyqide/NotFoundDialog.java jnyqide/TextColor.java \\
+ jnyqide/NyqPlot.java jnyqide/Trie.java \\
+ jnyqide/NyquistFile.java jnyqide/WordList.java
+
+
+jnyqide/jNyqIDE.jar: $(JAVASRC)
+ if [ -r jnyqide/SpecialMacHandler.java ] ; then \\
+ mv jnyqide/SpecialMacHandler.java jnyqide/SpecialMacHandler.hidden ;\\
+ fi
+ cd jnyqide; javac *.java
+ mv jnyqide/SpecialMacHandler.hidden jnyqide/SpecialMacHandler.java
+ rm -rf jnyqide/jNyqIDE.jar
+ jar -cfm jnyqide/jNyqIDE.jar jnyqide/manifest.txt jnyqide/*.class
+
+# Standard list of includes (common to all unix versions)
+# Keeping portaudio and libsndfile sources local to nyquist
+INCL = -Inyqsrc -Itran -Ixlisp -Isys/unix -Icmt -Iffts/src \\
+ -Inyqstk/include -Inyqstk -Iportaudio/include -Iportaudio/src/common \\
+ -Iportaudio/src/os/unix \\
+ -Iliblo -Inylsf
+
+# system dependent stuff for ~A:
+~A
+
+INTGEN = misc/intgen
+
+# Object files for Nyquist:
+" system-type target-file system-name (system-defs))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+ (object-files outf)
+ (format outf "# Sound functions to add to xlisp~%")
+ (nyqheaders outf)
+ (cmtheaders outf)
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+ (format outf "
+
+bin:
+\tmkdir bin
+
+liblo/Makefile:
+\tcd liblo; ./configure CFLAGS=-m32 LDFLAGS=-m32 CXXFLAGS=-m32 --enable-static --disable-shared
+\t# sometimes, residual files cause problems
+\tcd liblo; make clean
+
+$(LIBLO_PATH)/liblo.a: liblo/Makefile
+\tcd liblo; make
+
+bin/ser-to-osc: bin $(LIBLO_PATH)/liblo.a
+\t$(CC) -c $(CFLAGS) liblo/ser-to-osc/ser-to-osc.cpp \\
+\t -o liblo/ser-to-osc/ser-to-osc.o
+\t$(LN) liblo/ser-to-osc/ser-to-osc.o -o bin/ser-to-osc $(LFLAGS)
+
+bin/test-client: bin $(LIBLO_PATH)/liblo.a
+\t$(CC) -c $(CFLAGS) liblo/test-client/test-client.c \\
+\t -o liblo/test-client/test-client.o
+\t$(LN) liblo/test-client/test-client.o -o bin/test-client $(LFLAGS)
+
+portaudio/Makefile:
+\t# note: without-jack avoids 32/64-bit link error on Debian
+\tcd portaudio; ./configure CFLAGS=-m32 LDFLAGS=-m32 CXXFLAGS=-m32 --enable-static --disable-shared --without-jack
+\t# sometimes, residual files cause problems
+\tcd portaudio; make clean
+
+$(LIBPA_PATH)/libportaudio.a: portaudio/Makefile
+\tcd portaudio; make
+
+$(NY): $(OBJECTS) $(LIBPA_PATH)/libportaudio.a $(LIBLO_PATH)/liblo.a
+\t$(LN) $(OBJECTS) $(LFLAGS) -o $(NY)
+
+# copy appropriate system.lsp and make it read-only;
+# changes should be made to sys/unix/<system>/system.lsp
+runtime/system.lsp: sys/unix/~A/system.lsp
+\t# make sure it's there before you make it writeable
+\ttouch runtime/system.lsp
+\tchmod +w runtime/system.lsp
+\tcp -p sys/unix/~A/system.lsp runtime/system.lsp
+\tchmod -w runtime/system.lsp
+
+" system-name system-name)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+ (dependencies outf system-name)
+ (format outf (system-rules))
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+ (format outf
+ "misc/intgen: misc/intgen.c
+\tcd misc; make intgen
+
+misc/unpacker: misc/unpacker.c misc/convert.c
+\tcd misc; make unpacker
+
+misc/packer: misc/packer.c misc/convert.c
+\tcd misc; make packer
+
+nyqsrc/sndfnintptrs.h: $(NYQHDRS) misc/intgen
+\t$(INTGEN) nyqsrc/sndfnint $(NYQHDRS)
+
+nyqsrc/seqfnintptrs.h: $(CMTHDRS) misc/intgen
+\t$(INTGEN) nyqsrc/seqfnint $(CMTHDRS)
+
+clean:
+\tcd misc; make clean
+\tcd liblo; test -f Makefile && make clean || true
+\tcd portaudio; test -f Makefile && make clean || true
+\trm -f $(OBJECTS)
+# These could be deleted, but they're part of the release, so we won't
+# Note that these files are machine-generated:
+# \trm -f nyqsrc/sndfnintptrs.h nyqsrc/sndfnint.c nyqsrc/sndfnintdefs.h
+# \trm -f nyqsrc/seqfnintptrs.h nyqsrc/seqfnint.c nyqsrc/seqfnintdefs.h
+
+cleaner: clean
+\tcd misc; make cleaner
+\trm -f *.backup */*.backup
+\trm -f *~~ */*.*~~
+\trm -f #*# */#*#
+\trm -f *.save */*.save
+\trm -f *.CKP */*.CKP
+\trm -f *.BAK */*.BAK
+\trm -f *.old */*.old
+\trm -f *.gold */*.gold
+\trm -f playparms
+\trm -f points.dat
+\trm -f core.* core
+\trm -f $(NY)
+
+release: cleaner
+\tcd misc; make packer
+\tmisc/packer files.txt release.pac
+\trm -f *.wav
+\tmv ny ..
+\tmv -f *.pac ..
+\trm -f unpacker
+\trm -f packer
+\tcd ..; zip -r nyquist.zip nyquist
+\t../ny misc/cmu/cmu-linux-install.lsp
+\tmv ../ny ./ny
+")
+
+ (cond ((eq system-type 'rs6k)
+ (format outf "
+tar: cleaner
+\tsh -v sys/unix/cmu/tar.script
+
+backup: cleaner
+\tsh -v sys/unix/cmu/backup.script
+")))
+ (close outf)
+ ))
+
+;; system-defs looks for a string of system-dependent defs for the makefile
+;;
+(defun system-defs () (system-var "-DEFS"))
+
+
+;; system-rules looks for a string of system-dependent rules for the makefile
+;;
+(defun system-rules () (system-var "-RULES"))
+
+
+;; system-var returns a string stored in the variable (if any):
+;; <system-type>-<suffix>
+;;
+(defun system-var (suffix)
+ (let ((v (intern (strcat (symbol-name system-type) suffix))))
+ (cond ((boundp v) (symbol-value v))
+ (t ""))))
+
+
+(defun fix-sndsliders (lis)
+ (remove "sndsliders" lis :test #'string=))
+
+;; object-files - writes names of all object files for linking
+;;
+(defun object-files (outf)
+ (let ((flist (append (add-prefix "xlisp/" xlfiles)
+ (add-prefix "tran/" transfiles)
+ (add-prefix "cmt/" cmtfiles)
+ (add-prefix "nylsf/" nylsffiles)
+ (add-prefix "nyqsrc/" nyqfiles)
+ (add-prefix "nyqsrc/" (fix-sndsliders nyqsrcfiles)) ; pjm January 2008
+ (add-prefix "nyqstk/src/" stksrcfiles)
+ (add-prefix "nyqstk/" stkfiles)
+ (add-prefix "ffts/src/" fftfiles)
+ (add-prefix "nyqsrc/" intfiles)
+ ;(add-prefix "snd/" sndfiles)
+ '("sys/unix/osstuff" "sys/unix/term"))))
+ (setf flist (add-suffix flist ".o"))
+ (format outf "OBJECTS = ")
+ (write-file-list outf flist #\\)))
+
+
+;; add-prefix - place string at beginning of each string in list
+;;
+(defun add-prefix (prefix lis)
+ (mapcar #'(lambda (str) (strcat prefix str)) lis))
+
+
+;; add-suffix - place string at end of each string in list
+;;
+(defun add-suffix (lis suffix)
+ (mapcar #'(lambda (str) (strcat str suffix)) lis))
+
+
+;; write-file-list - write file names to Make macro
+;;
+(defun write-file-list (outf flist continuation-char)
+ (while flist
+ (dotimes (i 2)
+ (format outf "~A " (car flist))
+ (setf flist (cdr flist))
+ (if (null flist) (return)))
+ (if flist (format outf " ~A~%\t" continuation-char)))
+ (format outf "~%~%"))
+
+
+(defun nyqheaders (outf)
+ (let ((flist (append
+ (list "nyqsrc/sndfmt" "nylsf/sndfile")
+ (add-prefix "nyqsrc/" (fix-sndwritepa nyqsrcfiles))
+ (add-prefix "tran/" transfiles))))
+ (setf flist (mapcar #'(lambda (f) (strcat f ".h"))
+ flist))
+ (format outf "NYQHDRS = ")
+ (write-file-list outf flist #\\)))
+
+
+(defun cmtheaders (outf)
+ (let ((flist
+ (append '("cmt/seqdecls" "nyqsrc/seqext" "cmt/seq"
+ "nyqsrc/seqinterf") ; order is important here!
+ (add-prefix "cmt/"
+ '("seqread" "seqmread" "seqwrite" "seqmwrite")))))
+ (setf flist (add-suffix flist ".h"))
+ (format outf "CMTHDRS = ")
+ (write-file-list outf flist #\\)))
+
+
+(defun dependencies (outf system-name)
+ ;; this forces generation of sndfnintdefs.h, seqfnintdefs.h:
+ (dolist (f (append (add-prefix "nyqsrc/" nyqsrcfiles)
+ (add-prefix "nyqsrc/" nyqfiles)
+ ;(add-prefix "snd/" sndfiles)
+ (add-prefix "ffts/src/" fftfiles)
+ (add-prefix "tran/" transfiles)
+ (add-prefix "nyqsrc/" intfiles)))
+ (let ((ex (assoc f depends-exceptions :test #'equal)))
+ (cond ((and ex (cdr ex))
+ (format outf "~A.o: ~A.c ~A~%" f f (cadr ex))
+ (format outf "\t$(CC) -c ~A.c -o ~A.o $(CFLAGS)~%~%" f f))
+ (t
+ (format outf "~A.o: ~A.c ~A.h nyqsrc/sound.h nyqsrc/falloc.h nyqsrc/cque.h~%"
+ f f f)
+ (format outf "\t$(CC) -c ~A.c -o ~A.o $(CFLAGS)~%~%" f f)))))
+ (dolist (f stkfiles)
+ (format outf "nyqstk/~A.o: nyqstk/~A.cpp nyqstk/~A.h~%"
+ f f f)
+ (format outf "\tg++ -c nyqstk/~A.cpp -o nyqstk/~A.o $(CFLAGS)~%~%"
+ f f))
+
+ (dolist (f stksrcfiles)
+ (format outf "nyqstk/src/~A.o: nyqstk/src/~A.cpp nyqstk/include/~A.h~%"
+ f f f)
+ (format outf "\tg++ -c nyqstk/src/~A.cpp -o nyqstk/src/~A.o $(CFLAGS)~%~%"
+ f f))
+
+ (format outf "xlisp/xlftab.o: nyqsrc/sndfnintptrs.h nyqsrc/sndfnintdefs.h")
+ (format outf " nyqsrc/seqfnintptrs.h nyqsrc/seqfnintdefs.h~%")
+ (format outf "\t$(CC) -c xlisp/xlftab.c -o xlisp/xlftab.o $(CFLAGS)~%~%")
+ (dolist (f (append (add-prefix "xlisp/" xlfiles)
+ (add-prefix "cmt/" cmtfiles)
+ (add-prefix "nylsf/" nylsffiles)
+ '("sys/unix/osstuff")))
+ (cond ((and (not (equal f "xlisp/xlftab")) ; special case handled above
+ (not (and (equal f "xlisp/xljump") ; case handled below
+ (equal system-name "next"))))
+ (format outf "~A.o: ~A.c~%\t$(CC) -c ~A.c -o ~A.o $(CFLAGS)~%~%"
+ f f f f)))))
+
+
+;;===================================================
+;; SYSTEM DEPENDENCIES
+;;===================================================
+
+(setf rs6k-defs "
+MIDI = /afs/cs/project/music/rs6k/midilib
+CC = cc
+# change -g to -O for optimization
+# to enable command line editing, add -DREADLINE
+CFLAGS = -DCMTSTUFF -g $(INCL) -I$(MIDI)
+XFLAGS = $(CFLAGS) -qlanglvl=extended
+LN = xlc -qattr -qlist
+# to enable command line editing, add -lreadline -lcurses
+LFLAGS = -lm -lpthread -L$(MIDI) -lmidi -lbsd -lg
+")
+
+
+(setf next-defs "
+CC = cc
+# to enable command line editing, insert -DREADLINE
+CFLAGS = -DCMTSTUFF -O $(INCL)
+LN = cc
+# to enable command line editing, insert -lreadline -lcurses
+LFLAGS = -lm -lpthread
+")
+
+(setf next-rules "
+# this doesn't compile with the -O switch (a NeXT compiler bug?)
+xlisp/xljump.o : xlisp/xljump.c xlisp/xlisp.h
+\t$(CC) -DCMTSTUFF -c xlisp/xljump.c -o xlisp/xljump.o
+")
+
+(setf pmax-defs "
+CC = cc
+# to enable command line editing, insert -DREADLINE
+CFLAGS = -DCMTSTUFF -g $(INCL)
+LN = cc
+# to enable command line editing, insert -lreadline -lcurses
+LFLAGS = -lm
+")
+
+
+(setf sgi-defs "
+CC = cc
+# to enable command line editing, insert -DREADLINE
+CFLAGS = -DCMTSTUFF -g $(INCL)
+LN = cc
+# to enable command line editing, insert -lreadline -lcurses
+LFLAGS = -lm -lpthread
+# you would need -lmd if UNIX_IRIX_MIDIFNS were defined in midifns.c
+")
+
+
+(setf sparc-defs "
+CC = gcc
+# to enable command line editing, insert -DREADLINE
+CFLAGS = -DCMTSTUFF -g $(INCL)
+LN = g++
+# to enable command line editing, insert -lreadline -lcurses
+LFLAGS = -lm -lpthread
+")
+
+;; this is the general plan for linux, but Debian cannot link with -lasound,
+;; so to this string you need to prepend a definition for AUDIOLIBS which
+;; has extra link directives for audio libraries, e.g. -lasound (see below)
+(setf linux-defs "
+CC = gcc
+
+LIBPA_PATH = portaudio/lib/.libs
+
+LIBLO_PATH = liblo/src/.libs
+
+# to enable command line editing, use -DREADLINE. WARNING: THIS WILL
+# DISABLE THE ABILITY TO INTERRUPT LISP AND USE SOME OTHER HANDY
+# CONTROL CHARACTERS (You will also need the readline and curses libraries)
+CFLAGS = -DOSC -DCMTSTUFF $(OPT) $(INCL) \\
+ -DHAVE_LIBPTHREAD=1 -D_FILE_OFFSET_BITS=64 \\
+ -DSTK_NYQUIST -DUSE_VSPRINTF \\
+ -DHAVE_CONFIG_H
+LN = g++ -m32
+AR = ar
+# to enable command line editing, insert -lreadline -lcurses
+LFLAGS = $(LIBPA_PATH)/libportaudio.a $(LIBLO_PATH)/liblo.a $(AUDIOLIBS) -lm -lpthread -lrt
+
+TAGS:
+ find . \( -name "*.c" -o -name "*.h" \) -print | etags -
+
+tags: TAGS
+")
+
+(setf alsa-defs (strcat "
+AUDIOLIBS = -lasound
+" linux-defs))
+
+(setf nonalsa-defs (strcat "
+AUDIOLIBS =
+" linux-defs))
diff --git a/misc/packer.c b/misc/packer.c
new file mode 100644
index 0000000..ffd89fa
--- /dev/null
+++ b/misc/packer.c
@@ -0,0 +1,311 @@
+/* packer -- a program to pack a list of files into one */
+
+/* The input is a file with one line per file to be packed.
+ Each line starts with either 'a' or 'b' for ascii or binary.
+ The second character is a space or tab (it's ignored).
+ The third character to the end of the line is the file to be packed.
+
+ The encoding is as follows:
+ A file starts with '!' for ascii or '#' for binary in column one.
+ The remainder of the line is a file name/path.
+ Ascii files have a special character in column 1:
+ 'A'-'~' indicates 0 to n blanks. Leading Tabs are converted to blanks
+ and included in this count.
+ '0'-'9' indicates 0 to 9 blank lines (always followed by an additional newline).
+ Otherwise, all characters are just copied to output except:
+ '$' is an escape character:
+ $$ indicates $,
+ $@ through $_ indicate 0x00 through 0x1F,
+ $\n indicates an empty string (useful for avoiding long lines on output)
+ After $\n, the following character is not treated specially even though
+ it is in column 1.
+
+ Should we be doing more to compress files? It looks like the special
+ handling of leading blanks compresses files about 4%. This is not much,
+ but the encoding allows us to put markers (! and #) in column 1 to
+ separate files. Originally, leading blank handling also converted between
+ 8 and 4 character tab stops, but you can no longer assume tab stops under,
+ say, Windows, are 8 characters wide. Source files should not have
+ tabs.
+
+ Further simple encoding such as run-length encoding and word
+ substitution doesn't buy too much and was deemed not worth the effort.
+ Run-length encoding seems to buy another couple of percent.
+ Substitution for common words like int, print, return, the, register,
+ etc. buys maybe .5% per word, but it seems unlikely this will buy
+ more than a total of 10%, so we're looking at a max of 15% to 20%
+ compression without starting to huffman encode at the bit level.
+
+ For binary files, every 3 bytes are used to form a 24-bit number which is
+ split into 4 fields of 6 bits. Each field is encoded by adding ascii '0'.
+ If only one or two bytes are left at the end of the file, the encoding is
+ as if zeros were appended to the file, but only 2 or 3 ascii characters
+ (instead of the usual 4) are output. The ascii file encoding is terminated
+ with a period ('.'). Newlines are inserted to keep line lengths down but
+ should be ignored by the reader.
+ */
+
+
+#include "switches.h"
+#include "stdlib.h"
+#include "string.h"
+#include "cext.h"
+#include "convert.h"
+/* since we aren't using the cleanup package, expose exit(): */
+#undef exit
+
+#include "stdio.h"
+#ifdef MACINTOSH
+#include "console.h"
+#endif
+
+#define EOS 0
+
+#define string_max 500
+
+void pack_newline();
+void pack_ascii();
+void pack_binary();
+void put_binary();
+
+/* main -- pack a list of files */
+/**/
+int main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ FILE *inf; /* input file: a list of file names to pack */
+ FILE *outf; /* the packed output */
+ char filename[string_max]; /* holds names of input files */
+ char convname[string_max]; /* filename converted to local syntax */
+ int base = 1;
+#ifdef MACINTOSH
+ argc = ccommand(&argv);
+#endif
+ if (argc != 3 && argc != 4) {
+ fprintf(stderr, "Usage: packer [-p] input-list-file output-file\n");
+ exit(1);
+ }
+ if (argc == 4) {
+ base = 2;
+ if (strcmp(argv[1], "-p") == 0) {
+ pauseflag = 1;
+ } else {
+ fprintf(stderr, "Expected \"-p\" as 1st argument.\n");
+ exit(1);
+ }
+ }
+ inf = fopen(argv[base], "r");
+ if (!inf) {
+ fprintf(stderr, "Couldn't open |%s|\n", argv[base]);
+ exit(1);
+ }
+ outf = fopen(argv[base+1], "w");
+ if (!outf) {
+ fclose(inf);
+ fprintf(stderr, "Couldn't open |%s|\n", argv[base + 1]);
+ exit(1);
+ }
+ printf("Using tab width of %d\n", TAB_WIDTH);
+ while (fgets(filename, string_max, inf)) {
+ filename[strlen(filename) - 1] = EOS; /* remove newline at end */
+ if (filename[0] == EOS) continue; /* skip blank lines */
+ puts(filename);
+ strcpy(convname, filename + 2);
+ convert(convname);
+ if (filename[0] == 'a') pack_ascii(filename + 2, convname, outf);
+ else if (filename[0] == 'b') pack_binary(filename + 2, convname, outf);
+ else {
+ fprintf(stderr, "Bad file spec (expecting a or b in col 1): %s\n",
+ filename);
+ if (PAUSE) getchar();
+ }
+
+ }
+ fclose(outf);
+ fclose(inf);
+ return 0;
+}
+
+
+/* pack_ascii -- open filename and append its encoding to outf */
+/**/
+void pack_ascii(filename, convname, outf)
+ char *filename;
+ char *convname;
+ FILE *outf;
+{
+ int line_len = 0;
+ int c;
+ FILE *inf;
+
+ inf = fopen(convname, "r");
+ /* printf("opened %lx\n", inf); */
+ if (!inf) {
+ fprintf(stderr, "Couldn't open |%s| - skipped\n", convname);
+ if (PAUSE) getchar();
+ return;
+ }
+ fprintf(outf, "!%s\n", filename);
+
+ pack_newline(inf, outf, &line_len);
+ while ((c = getc(inf)) != EOF) {
+ if (c > 127) {
+ fprintf(stderr, "non-ascii char 0x%x in %s.\n", c, convname);
+ exit(1);
+ } else if (c == '\n') {
+ putc(c, outf);
+ line_len = 0;
+ pack_newline(inf, outf, &line_len);
+ } else if (c == '$') {
+ putc('$', outf);
+ putc('$', outf);
+ line_len += 2;
+ } else if (c < 32) {
+ putc('$', outf);
+ putc('@' + c, outf);
+ line_len += 2;
+ } else {
+ putc(c, outf);
+ line_len++;
+ }
+ if (line_len > 70) {
+ putc('$', outf);
+ putc('\n', outf);
+ line_len = 0;
+ }
+ }
+ if (line_len) {
+ fprintf(stderr, "missing newline added to the end of %s\n", convname);
+ putc('\n', outf);
+ if (PAUSE) getchar();
+ }
+ /* printf("closing %lx\n", inf); */
+ fclose(inf);
+}
+
+
+/* pack_binary -- open binary filename and append its encoding to outf */
+/**/
+void pack_binary(filename, convname, outf)
+ char *filename;
+ char *convname;
+ FILE *outf;
+{
+ int line_len = 0;
+ int c;
+ long data;
+ int n;
+ FILE *inf;
+ boolean isbinary = false;
+
+ inf = fopen(convname, "rb");
+ /* printf("opened %lx\n", inf); */
+ if (!inf) {
+ fprintf(stderr, "Couldn't open |%s| - skipped\n", convname);
+ if (PAUSE) getchar();
+ return;
+ }
+ fprintf(outf, "#%s\n", filename);
+
+ n = 0;
+ data = 0;
+ while ((c = getc(inf)) != EOF) {
+ if (c > 127) isbinary = true;
+ data = (data << 8) | c;
+ n++;
+ if (n == 3) {
+ put_binary(data, outf);
+ n = 0;
+ data = 0;
+ line_len += 4;
+ if (line_len >= 70) {
+ putc('\n', outf);
+ line_len = 0;
+ }
+ }
+ }
+ if (n == 1) {
+ data = data << 16;
+ putc('0' + ((data >> 18) & 0x3F), outf);
+ putc('0' + ((data >> 12) & 0x3F), outf);
+ }
+ if (n == 2) {
+ data = data << 8;
+ putc('0' + ((data >> 18) & 0x3F), outf);
+ putc('0' + ((data >> 12) & 0x3F), outf);
+ putc('0' + ((data >> 6) & 0x3F), outf);
+ }
+ putc('.', outf);
+ putc('\n', outf);
+ if (!isbinary) {
+ fprintf(stderr, "%s seems to be an ascii file.\n", convname);
+ if (PAUSE) getchar();
+ }
+ /* printf("closing %lx\n", inf); */
+ fclose(inf);
+}
+
+
+/* pack_newline -- newline sequence encoding to outf */
+/**/
+void pack_newline(inf, outf, line_len)
+ FILE *inf; /* input file */
+ FILE *outf; /* where to write output */
+ int *line_len;
+{
+ int c;
+ int count = 0;
+ int outc;
+
+ while (((c = getc(inf)) != EOF) && (c == '\n')) {
+ count++;
+ }
+ while (count >= 10) {
+ fprintf(outf, "9\n");
+ *line_len = 0;
+ count -= 10;
+ }
+ if (count > 0) {
+ fprintf(outf, "%c\n", '0' + count - 1);
+ *line_len = 0;
+ }
+
+ /* now run-length encode leading blanks... */
+ count = 0;
+ while (c != EOF) {
+ if (c == ' ') count++;
+ /* we no longer convert tabs to spaces...
+ else if (c == '\t') count += TAB_WIDTH;
+ */
+ else break;
+ c = getc(inf);
+ }
+ if (c != EOF || count) {
+ outc = 'A' + count;
+ if (outc > '~') outc = '~';
+ putc(outc, outf);
+ (*line_len) += 1;
+ count -= (outc - 'A');
+ while (count > 0) {
+ putc(' ', outf);
+ (*line_len) += 1;
+ count--;
+ }
+ }
+ /* now do the rest of the line */
+ if (c != EOF) ungetc(c, inf);
+}
+
+
+/* put_binary -- write 3 binary bytes as 4 ascii bytes */
+/**/
+void put_binary(data, outf)
+ long data;
+ FILE *outf;
+{
+ putc('0' + ((data >> 18) & 0x3F), outf);
+ putc('0' + ((data >> 12) & 0x3F), outf);
+ putc('0' + ((data >> 6) & 0x3F), outf);
+ putc('0' + (data & 0x3F), outf);
+}
diff --git a/misc/packer.dsp b/misc/packer.dsp
new file mode 100644
index 0000000..3a5086b
--- /dev/null
+++ b/misc/packer.dsp
@@ -0,0 +1,109 @@
+# Microsoft Developer Studio Project File - Name="packer" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=packer - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "packer.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "packer.mak" CFG="packer - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "packer - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "packer - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "packer - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "packer_Release"
+# PROP Intermediate_Dir "packer_Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\cmt" /I "..\sys\win\msvc" /I "../cmt" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "packer - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "packer___Win32_Debug"
+# PROP BASE Intermediate_Dir "packer___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "packer_Debug"
+# PROP Intermediate_Dir "packer_Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\cmt" /I "..\sys\win\msvc" /I "../cmt" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /D "_DEBUG" /D "DEBUG_INPUT" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib winmm.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "packer - Win32 Release"
+# Name "packer - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\convert.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\packer.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\..\nyquist21\misc\convert.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/misc/packer.vcproj b/misc/packer.vcproj
new file mode 100644
index 0000000..a50b912
--- /dev/null
+++ b/misc/packer.vcproj
@@ -0,0 +1,268 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="packer"
+ ProjectGUID="{F40BCDEF-F66F-4FEB-9513-F7EFF29BFC93}"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\packer_Release"
+ IntermediateDirectory=".\packer_Release"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\packer_Release/packer.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\cmt,..\sys\win\msvc,../cmt"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\packer_Release/packer.pch"
+ AssemblerListingLocation=".\packer_Release/"
+ ObjectFile=".\packer_Release/"
+ ProgramDataBaseFileName=".\packer_Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib winmm.lib"
+ OutputFile=".\packer_Release/packer.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ProgramDatabaseFile=".\packer_Release/packer.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\packer_Release/packer.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\packer_Debug"
+ IntermediateDirectory=".\packer_Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\packer_Debug/packer.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\cmt,..\sys\win\msvc,../cmt"
+ PreprocessorDefinitions="_CONSOLE;WIN32;_DEBUG;DEBUG_INPUT"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ PrecompiledHeaderFile=".\packer_Debug/packer.pch"
+ AssemblerListingLocation=".\packer_Debug/"
+ ObjectFile=".\packer_Debug/"
+ ProgramDataBaseFileName=".\packer_Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib winmm.lib"
+ OutputFile=".\packer_Debug/packer.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\packer_Debug/packer.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\packer_Debug/packer.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="convert.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="packer.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="..\..\nyquist21\misc\convert.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/misc/play.c b/misc/play.c
new file mode 100644
index 0000000..19bfac6
--- /dev/null
+++ b/misc/play.c
@@ -0,0 +1,90 @@
+/*
+
+ A cheap command to play sample files to the D/A's.
+ The sample files should have no headers. They can be
+ eight or sixteen bits, with one or two channels.
+ Sample rate is eigher 44.1 or 22.05.
+
+ NOTE: samples brought from the VAX may have byte order
+ reversed. Use "dd conv=swab" to fix this.
+
+ William Walker, University of Illinois, 27 January 1989
+ (walker@m.cs.uiuc.edu)
+*/
+
+#include <stdio.h>
+#include <sound/sound.h>
+#define THESIZE 3000000
+
+
+#include "args.h"
+
+#define TAG 9839283
+
+main(argc, argv)
+char **argv;
+{
+ int srate = SND_RATE_LOW;
+ int nchannels = 1;
+ int again = 1;
+ int i;
+ SNDSoundStruct *cow;
+ FILE *data;
+
+ ARGLOOP
+ FLAGARG('h') srate = SND_RATE_HIGH; ENDFLAGARG
+ FLAGARG('s') nchannels = 2; ENDFLAGARG
+ STRINGARG('r') srate = atoi(p); ENDSTRINGARG
+ FLAGARG('o') again = 0; ENDFLAGARG
+
+ BADARG
+ fprintf(stderr, "unknown option %c\n", *p);
+ goto error;
+ ENDBADARG
+ ENDARGLOOP
+
+ if (argc != 1) goto error;
+
+ cow = (SNDSoundStruct *) malloc(THESIZE);
+
+ /* these fields should probably be invariant: */
+ cow->magic = SND_MAGIC;
+ cow->dataLocation = sizeof(SNDSoundStruct);
+ cow->dataSize = 0;
+ cow->dataFormat = SND_FORMAT_LINEAR_16;
+ cow->samplingRate = srate;
+ cow->channelCount = nchannels;
+
+ printf("%d Hz sample rate, %d channels\n",
+ cow->samplingRate,
+ nchannels);
+
+
+ do {
+ data = fopen(argv[0],"r");
+ if (data == NULL) { printf("play: fopen error\n"); exit(1); }
+ printf("Read %d bytes\n",cow->dataSize = fread((char *)cow+sizeof(SNDSoundStruct),1,THESIZE-sizeof(SNDSoundStruct),data));
+ fclose(data);
+
+ /* printf("Reserve sound for playing (%d)\n",SNDReserve()); */
+ printf("Play (%d)\n", SNDStartPlaying(cow,TAG,0,0,(SNDNotificationFun)NULL,(SNDNotificationFun)NULL));
+ printf("Wait for played sound (%d)\n",SNDWait(TAG));
+ /* printf("Query played sound (%d)\n",SNDQueryPlayedSound()); */
+ /* printf("Unreserve sound for playing (%d)\n",SNDUnreserveSoundForPlaying()); */
+ if(again) {
+ char line[100];
+ printf("Again? [y] ");
+ gets(line);
+ if(line[0] != 'y' && line[0] != 'Y' && line[0] != '\0')
+ again = 0;
+ }
+ } while( again );
+ exit(0);
+error:
+ fprintf(stderr, "\nUsage: play [ -h ] [ -s ] [ -o ] file\n\n");
+ fprintf(stderr, " -h 44.1KHz sample rate (default 22.1KHz)\n");
+ fprintf(stderr, " -s stereo (default mono)\n");
+ fprintf(stderr, " -o play only once (default asks to play again)\n");
+ fprintf(stderr, "\n");
+ exit(1);
+}
diff --git a/misc/plot.c b/misc/plot.c
new file mode 100644
index 0000000..e540592
--- /dev/null
+++ b/misc/plot.c
@@ -0,0 +1,249 @@
+/*
+ * FILE: plot.c
+ * BY: Christopher Lee Fraley (cf0v@spice.cs.cmu.edu)
+ * DESC: graphs file of numbers on terminal
+ *
+ * 1.1 ( 1-JUN-88) - added lines from 0 to data points (cf0v)
+ * 1.2 ( 3-JUN-88) - added skip parameter (cf0v)
+ * 1.3 (23-JUN-88) - added -x and -y options (cf0v)
+ * 1.4 (30-JUN-88) - clean-up. (cf0v)
+ * 2.0 ( 5-JUL-88) - added binary sound file format option. Changed scaling
+ * for "-n" option to only consider those values being
+ * plotted, instead of whole file.
+ */
+
+char plotVERSION[] = "2.0 (5-JUL-88, 11:40am)";
+
+/*
+ * plot [<file> [-nxyab]]
+ * Accepts input stream of numbers from <file> (or stdin, if no <file>
+ * argument is present), drawing a graph to sdout. File is prescanned for
+ * min and max values, and the graph is scaled accordingly. If making the
+ * file's min non-zero delta equal to one char allows the entire graph to
+ * fit on the screen, then this scalar is used. If the -n<num> option is
+ * used, then only every <num>th number from the input stream is plotted.
+ * The -x option enables printing the line number in the file on the screen
+ * every 10 lines. The -y option enables printing the y value on the screen
+ * every line. Note -x and -y are NOT mutually exclusive. The -a option
+ * indicates the input file is in ascii format, while the -b option indicates
+ * the input file is in the binary sound file format. When neither of these
+ * is present, binary is assumed unless input is from stdin.
+ */
+
+#include <stdio.h>
+#include "stdefs.h"
+
+#define MAXNUMINPUT 16*1024
+#define BINARY 0
+#define ASCII 1
+
+
+fail(s, arg)
+char *s, *arg;
+{
+ fprintf(stderr,"\nplot: ");
+ fprintf(stderr, s, arg);
+ fprintf(stderr,"\n\n");
+ exit(1);
+}
+
+
+
+FILE *fain; /* Pointer to input file for ascii format */
+int fbin; /* Input file for binary format */
+int ftype; /* Type of input file */
+
+
+prescan(X, Num, Max, Min, Delta)
+HWORD X[];
+int *Num, *Max, *Min, *Delta;
+{
+ int last, i, len;
+
+ *Min = *Delta = 32767;
+ *Max = -32768;
+ *Num = last = 0;
+ if (ftype == ASCII)
+ while (fscanf(fain,"%d",&i) != EOF)
+ {
+ *Min = MIN(i, *Min);
+ *Max = MAX(i, *Max);
+ if (i != last)
+ *Delta = MIN(ABS(i-last), *Delta);
+ *Num += 1;
+ last = i;
+ *X++ = i;
+ }
+ else
+ {
+ printf("| binary prescan, fbin:%d\n", fbin);
+ len = read(fbin, (char *)X, MAXNUMINPUT*sizeof(HWORD)) / sizeof(HWORD);
+ if (len >= MAXNUMINPUT)
+ fprintf(stderr, "plot: input truncated to %d samples\n",
+ MAXNUMINPUT);
+ for (i=0; i<len; i++)
+ {
+ *Min = MIN(*X, *Min);
+ *Max = MAX(*X, *Max);
+ if (*X != last)
+ *Delta = MIN(ABS(*X-last), *Delta);
+ last = *X++;
+ }
+ *Num = len;
+ }
+}
+
+
+
+getargs(argc, argv, skip, xPrint, yPrint, start)
+int argc, *skip, *yPrint, *xPrint, *start;
+char *argv[];
+{
+ char *file;
+
+ file = NULL;
+ fain = stdin;
+ ftype = BINARY;
+ *start = 0;
+ *skip = 1;
+ *xPrint = FALSE;
+ *yPrint = FALSE;
+ while (--argc)
+ {
+ ++argv;
+ if ((*argv)[0] != '-')
+ {
+ if (file || (*argv)[0]=='?')
+ fail("syntax error argument '%s'.\
+ \n format: 'plot [<file>] [-n/s<num>] [-x/y/a/b]',\
+ \n where: <file> to plot (stdin is default),\
+ \n -n<num> plot every <num>th value in file,\
+ \n -s<num> start at the <num>th sample,\
+ \n -x print line # in file every 10 lines,\
+ \n -y print y coordinate every line,\
+ \n -a indicates input file is in ascii format,\
+ \n -b indicates input is in binary sound file format.\
+ \n -x and -y are NOT mutually exclusive; -a and -b ARE.\
+ \n -b is assumed unless input is stdin.", *argv);
+ file = *argv;
+ printf("| file:%s\n", file);
+ }
+ else if ((*argv)[1]=='x' || (*argv)[1]=='X')
+ *xPrint = TRUE;
+ else if ((*argv)[1]=='y' || (*argv)[1]=='Y')
+ *yPrint = TRUE;
+ else if ((*argv)[1]=='a' || (*argv)[1]=='A')
+ ftype = ASCII;
+ else if ((*argv)[1]=='b' || (*argv)[1]=='B')
+ ftype = BINARY;
+ else if ((*argv)[1]=='n' || (*argv)[1]=='N')
+ {
+ if (1 != sscanf(*argv+2, "%d", skip))
+ fail("illegal -n parameter '%s'", *argv);
+ }
+ else if ((*argv)[1]=='s' || (*argv)[1]=='S')
+ {
+ if (1 != sscanf(*argv+2, "%d", start))
+ fail("illegal -s parameter '%s'", *argv);
+ }
+ }
+ if (!file)
+ ftype = ASCII;
+ else if (ftype == ASCII)
+ {
+ if (NULL == (fain = fopen(file, "r")))
+ fail("could not open ascii input file '%s'\n", file);
+ }
+ else
+ {
+ if (NULL > (fbin = open(file, 0)))
+ fail("could not open binary input file '%s'\n", file);
+ }
+}
+
+
+
+main (argc,argv)
+int argc;
+char *argv[];
+{
+ int Num, Max, Min, Delta, i;
+ HWORD X[MAXNUMINPUT];
+ double factor;
+ int target, skip, start;
+ int xCount, xPrint, yPrint;
+ char *Star[41], *Space[41];
+
+ printf("\nData Plotting Program\n");
+ printf("by: Christopher Lee Fraley\n");
+ printf("Version: %s\n", plotVERSION);
+
+ Star[40] = "****************************************";
+ Space[40] = " ";
+ for (i=39; i>=0; i--)
+ {
+ Star[i] = Star[i+1] + 1;
+ Space[i] = Space[i+1] + 1;
+ }
+
+ getargs(argc, argv, &skip, &xPrint, &yPrint, &start);
+ prescan(X, &Num, &Max, &Min, &Delta);
+
+ factor = 1.0/Delta;
+ if (factor*Max>39)
+ factor = 39.0/Max;
+ if (factor*Min<-40)
+ factor = 40.0/-Min;
+
+ printf("\n Number of Data Points:%d \t [%d:%d]\n",Num,Min,Max);
+ printf(" Scale: %g/char",1.0/factor);
+ if (skip > 1)
+ printf(" \t\t Plotting every %dth sample", skip);
+ if (start)
+ printf(" Starting plot at sample %d", start);
+ printf("\n\n=========3=========2=========1=========0=========1=========2\
+=========3=========\n");
+
+ if (xPrint)
+ xCount = 11;
+ else
+ xCount = -1;
+ for (i=start; i<Num; i+=skip)
+ {
+ target = X[i]*factor+40;
+ --xCount;
+ if (target < 40)
+ {
+ printf(Space[target-1]);
+ printf(Star[41-target]);
+ if (!xCount)
+ printf("\t\t %6d",i);
+ else
+ printf("\t\t\t ");
+ if (yPrint)
+ printf(" %6d\n",X[i]);
+ else
+ printf("\n");
+ }
+ else
+ {
+ if (yPrint)
+ printf(" %6d ",X[i]);
+ else
+ printf("\t ");
+ if (!xCount)
+ printf("%6d ",i);
+ else
+ printf(" ");
+ printf(Star[target-39]);
+ printf("\n");
+ }
+ if (!xCount)
+ xCount = 10;
+ }
+
+ if (ftype == BINARY)
+ (void) close(fbin);
+ else if (fain != stdin)
+ (void) fclose(fain);
+}
diff --git a/misc/sampleprint.c b/misc/sampleprint.c
new file mode 100644
index 0000000..8862671
--- /dev/null
+++ b/misc/sampleprint.c
@@ -0,0 +1,39 @@
+#include <stdio.h>
+
+#define NPERLINE 10
+
+main()
+{
+ short line[2][NPERLINE];
+ register int n, i, j;
+ register int curline = 0;
+ int currently_printing = 1;
+
+ for(i = 0;
+ (n = fread(line[curline], sizeof(short), NPERLINE, stdin)) > 0;
+ i += n, curline = 1-curline) {
+ if(i != 0 && n == NPERLINE && sameline(line[0], line[1])) {
+ if(currently_printing) {
+ printf("*\n");
+ currently_printing = 0;
+ }
+ continue;
+ }
+ currently_printing = 1;
+ printf("%7d ", i);
+ for(j = 0; j < n; j++)
+ printf("%6d ", line[curline][j]);
+ printf("\n");
+ }
+ printf("%4d\n", i);
+}
+
+sameline(l1, l2)
+register short *l1, *l2;
+{
+ register n = NPERLINE;
+ while(--n >= 0)
+ if(*l1++ != *l2++)
+ return 0;
+ return 1;
+}
diff --git a/misc/sine.c b/misc/sine.c
new file mode 100644
index 0000000..e691b59
--- /dev/null
+++ b/misc/sine.c
@@ -0,0 +1,73 @@
+/*
+ * FILE: sine.c
+ * BY: Christopher Lee Fraley (cf0v@spice.cs.cmu.edu)
+ * DESC: Creates sine waves of given period, amplitude, and length.
+ *
+ * 1.0 ( 1-JUN-88) - created. (cf0v)
+ * 2.0 ( 5-JUL-88) - converted to binary sound file format. (cf0v)
+ */
+
+/*
+ * sine <amplitude> <period> <length> [-outfile]
+ * Outputs integer sine wave of maximum <amplitude>, with <period>
+ * samples per period, and <length> number of periods to stdout. Illegal
+ * arguments cause the defaults 32767, 20, and 3 to be used, respectively.
+ * If the flag "-outfile" is present, the output is in binary format to the
+ * named file. If the flag is ommitted, the output is to stdout, and is in
+ * ascii format, one number per line.
+ */
+
+#include <stdio.h>
+#include <math.h>
+#include "stdefs.h"
+
+#define PERMS 0644 /* -rw-r--r-- */
+
+fails(s, s2)
+char *s, *s2;
+{
+ fprintf(stderr, s, s2);
+ exit(1);
+}
+
+
+main (argc,argv)
+int argc;
+char *argv[];
+{
+ double Amp, Samps, Perds;
+ int i;
+
+ if (argc!=4 && argc!=5)
+ fails("format is 'sine %s'\n",
+ "<amplitude> <samples-per-period> <#-of-periods> [-outfile]");
+ if (!sscanf(*++argv, "%lf", &Amp))
+ Amp = 32767.0;
+ if (!sscanf(*++argv, "%lf", &Samps))
+ Samps = 20.0;
+ if (!sscanf(*++argv, "%lf", &Perds))
+ Perds = 3.0;
+ if (argc==5)
+ {
+ int fout;
+ HWORD *Data, *ptr;
+ unsigned int outLen, len;
+
+ if (NULL > (fout = creat(*++argv+1, PERMS)))
+ fails("could not create <outfile> '%s'\n", *argv+1);
+ outLen = Samps*Perds*sizeof(HWORD);
+ ptr = Data = (HWORD *)malloc(outLen);
+ if (NULL == Data)
+ fails("could not allocate enough memory for output", "");
+ for (i=0; i<(Samps*Perds); i++)
+ *ptr++ = (HWORD) (sin(2*PI*i/Samps) * Amp);
+ len = write(fout, (char *)Data, outLen);
+ if (len != outLen)
+ fails("incorrect number of bytes written", "");
+ }
+ else
+ {
+ for (i=0; i<(Samps*Perds); i++)
+ printf("%d\n", (int)(sin(2*PI*i/Samps)*Amp));
+ }
+}
diff --git a/misc/stdefs2.h b/misc/stdefs2.h
new file mode 100644
index 0000000..3254d02
--- /dev/null
+++ b/misc/stdefs2.h
@@ -0,0 +1,50 @@
+/*
+ * FILE: stdefs.h
+ * BY: Christopher Lee Fraley (cf0v@spice.cs.cmu.edu)
+ * DESC: Defines standard stuff for inclusion in C programs.
+ *
+ * 1.0 ( 6-JUN-88) - created. (cf0v)
+ * 1.1 (30-JUN-88) - moved GetUHWORD def here. (cf0v)
+ * 1.2 (11-JUL-88) - added ffail() defs. (cf0v)
+ * 1.3 (25-JUL-88) - added dB() and undB() defs. (cf0v)
+ * 1.4 ( 8-AUG-88) - added stuff used by apple & new NULL def. (cf0v)
+ */
+
+/* General purpose constants: */
+/* #define TRUE 1
+ #define FALSE 0
+ */
+
+#define FATAL 1
+#define WARN 0
+
+#define PI (3.14159265358979232846)
+#define PI2 (6.28318530717958465692)
+#define D2R (0.01745329348) /* (2*pi)/360 */
+#define R2D (57.29577951) /* 360/(2*pi) */
+
+
+/* General purpose typedefs: */
+typedef int bool;
+typedef char BOOL;
+typedef short HWORD;
+typedef unsigned short UHWORD;
+typedef int WORD;
+typedef unsigned int UWORD;
+
+
+/* General purpose macros: */
+#define GetUHWORD(x,y,z) GetUShort(x,y,z)
+#define ffail(x,y) fail(sprintf(ERROR,x,y))
+#define ffail2(x,y,z) fail(sprintf(ERROR,x,y,z))
+#define MAX(x,y) ((x)>(y) ?(x):(y))
+#define MIN(x,y) ((x)<(y) ?(x):(y))
+#define ABS(x) ((x)<0 ?(-(x)):(x))
+#define SGN(x) ((x)<0 ?(-1):((x)==0?(0):(1)))
+#define round(x) ((int)((x) + 0.5))
+
+/* Convert amplitudes to and from dB scale: */
+#define MINLIN undB(-100)
+#define undB(x) (((double)(REF)) * pow(10.0, ((double)(x))/20.0))
+#define dB(x) (((x)<MINLIN) ? (20.0 * log10(MINLIN/((double)(REF))))\
+ : (20.0 * log10((x)/((double)(REF)))))
diff --git a/misc/transfiles.lsp b/misc/transfiles.lsp
new file mode 100644
index 0000000..1d4cba4
--- /dev/null
+++ b/misc/transfiles.lsp
@@ -0,0 +1,73 @@
+;; these are files in /tran that implement nyquist primitives
+;; they become arguments to intgen, which builds the stubs from lisp to C
+;;
+
+;*******************************************************************
+; CHANGED. PJM July 2007
+; Added new ALG files related to new STK instruments
+;*******************************************************************
+
+(setf transfiles '("abs" "allpoles" "alpass" "alpasscv" "alpassvv" "amosc"
+ "areson" "aresonvc" "aresoncv" "aresonvv"
+ "atone" "atonev"
+ "biquadfilt" "buzz"
+ "chase" "clip" "congen" "const" "coterm"
+ "delaycc" "delaycv"
+ "eqbandvvv" "exp"
+ "follow" "fmosc" "fromobject" "fromarraystream"
+ "gate" "ifft"
+ "instrclar" "instrclarall" "instrclarfreq"
+ "instrsax" "instrsaxall" "instrsaxfreq"
+ "integrate" "log" "lpreson"
+ "maxv" "offset" "oneshot" "osc"
+ "partial" "pluck" "prod" "pwl" "quantize"
+ "recip"
+ "reson" "resonvc" "resoncv" "resonvv"
+ "sampler" "scale" "shape" "sine" "siosc" "slope" "sqrt"
+ "tapf" "tapv" "tone" "tonev" "upsample" "white"
+ "stkrev" "stkpitshift" "stkchorus"
+ "instrbow" "instrbowedfreq"
+ "instrbanded" "instrmandolin"
+ "instrsitar" "instrmodalbar"
+ "instrflute" "instrflutefreq" "instrfluteall"
+ "fmfb" "fmfbv"
+ ))
+
+; deleted comb
+
+;******************************************************************
+; CHANGES. PJM July 2007
+; nyqsrcfiles: DELETED "sndsliders" -> January 2008: now ADDED
+; and fixed in makefile.lsp
+; RENAMED "sndwrite" -> "sndwritepa"
+; ADDED "lpanal"
+;******************************************************************
+
+
+;; these are files in /nyqsrc that implement nyquist primitives
+;; they become arguments to intgen, which builds the stubs from lisp to C
+;;
+(setf nyqsrcfiles '("sound" "add" "avg" "compose" "convolve" "downsample"
+ "fft" "inverse" "multiseq" "resamp" "resampv"
+ "samples" "sndmax" "sndread" "sndseq" "sndsliders"
+ "sndwritepa" "yin" "nyq-osc-server"
+ "trigger" "lpanal" "phasevocoder" "pvshell"
+ ))
+
+;; these are additional files in /nyqsrc that need to be compiled
+;; and linked to make nyquist
+
+
+;********************************************************************
+; CHANGES. PJM July 2007
+; nyqfiles: DELETED "lpanal"
+; DELETED "trigger"
+;********************************************************************
+
+(setf nyqfiles '("debug" "falloc" "local"
+ "handlers" "multiread"
+ "seqext" "seqinterf" "stats"
+ "ffilterkit"
+ "sliders"
+))
+
diff --git a/misc/unpacker.c b/misc/unpacker.c
new file mode 100644
index 0000000..e38cd47
--- /dev/null
+++ b/misc/unpacker.c
@@ -0,0 +1,328 @@
+/* unpacker -- a program to unpack a set of files */
+/* See packer.c for a description of the input file format. */
+
+#include "switches.h"
+#ifdef MACINTOSH
+#include <Files.h>
+#include <Script.h>
+#endif
+
+#include "cext.h"
+#include "convert.h"
+#include "string.h"
+
+/* since we aren't using the cleanup package, expose exit(): */
+#undef exit
+
+#include "stdio.h"
+#ifdef THINK_C
+#include "console.h"
+#endif
+
+#define string_max 500
+#ifndef EOS
+#define EOS 0
+#endif
+
+void escape();
+void unpack_ascii();
+void unpack_binary();
+void put_run();
+
+#ifdef UNIX
+#define FILESEP '/'
+#include <sys/types.h>
+#include <dirent.h>
+
+int dir_isvaliddir(char *path)
+{
+ DIR *dir = opendir(path);
+ if (!dir) return false;
+ closedir(dir);
+ return true;
+}
+
+
+#include <sys/stat.h>
+int _mkdir(char *p)
+{
+ int rslt = mkdir(p, S_IRUSR | S_IWUSR | S_IXUSR |
+ S_IXGRP | S_IWGRP | S_IROTH | S_IXOTH);
+ printf("_mkdir: %s, rslt %d\n", p, rslt);
+ if (rslt == -1) {
+ printf("mkdir error\n");
+ perror("unpacker mkdir");
+ }
+ return rslt;
+}
+
+#endif
+
+#ifdef WINDOWS
+#define FILESEP '\\'
+
+// deal with some incompatible definitions
+#undef byte
+#undef boolean
+#include "windows.h"
+#include <direct.h>
+/*
+ * Function: dir_isvaliddir
+ *
+ * Purpose:
+ *
+ * Is this a valid directory ?
+ */
+BOOL dir_isvaliddir(LPSTR path)
+{
+ DWORD dwAttrib;
+ dwAttrib = GetFileAttributes(path);
+ if (dwAttrib == -1) {
+ return(FALSE); }
+ if (dwAttrib & FILE_ATTRIBUTE_DIRECTORY) {
+ return(TRUE);
+ }
+ return(FALSE);
+} /* dir_isvaliddir */
+#endif
+
+/* early_eof -- print error message and exit */
+void early_eof()
+{
+ fprintf(stderr, "Unexpected end of file while unpacking\n");
+ exit(1);
+}
+#ifdef MACINTOSH
+
+#define FILESEP ':'
+
+int dir_isvaliddir(char *path)
+{
+ char filename[256];
+ OSErr err;
+ FSSpec spec;
+ strcpy(filename, path);
+ c2pstr(filename);
+ err = FSMakeFSSpec(0, 0, (unsigned char *) filename, &spec);
+ if (err == noErr) {
+ /* if we can open this as a file, it's not a directory */
+ SInt16 refnum;
+ err = FSpOpenDF(&spec, fsCurPerm, &refnum);
+ if (err == noErr) {
+ FSClose(refnum);
+ return false;
+ }
+ return true;
+ }
+ return false;
+}
+
+
+int _mkdir(char *p)
+{
+ OSErr err;
+ FSSpec spec;
+ SInt32 dirid;
+ spec.vRefNum = 0;
+ spec.parID = 0;
+ strcpy((char *) spec.name, p);
+ c2pstr(spec.name);
+ err = FSpDirCreate(&spec, smSystemScript, &dirid);
+ if (err == noErr) {
+ return 0;
+ }
+
+ if (err != noErr) {
+ printf("mkdir error %d\n", err);
+ }
+ return -1;
+}
+#endif
+
+
+void make_path(char *full_name)
+// make directories as needed
+{
+ char directory[256];
+ char *ptr = full_name;
+ while (ptr = strchr(ptr, FILESEP)) {
+ strcpy(directory, full_name);
+ directory[ptr - full_name] = 0;
+ if (!dir_isvaliddir(directory)) {
+ if (_mkdir(directory) != 0) {
+ printf("Could not create %s\n", directory);
+ return;
+ } else {
+ printf("Created directory %s\n", directory);
+ }
+ }
+ // now directory is valid, so move to next one
+ ptr++;
+ }
+}
+
+
+/* main -- unpack a set of files */
+/**/
+int main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ FILE *inf; /* input file: a packed set of files */
+ FILE *outf; /* a file to unpack */
+ char filename[string_max]; /* holds names of inptu files */
+#ifdef MACINTOSH
+ argc = ccommand(&argv);
+#endif
+ if (argc != 2) {
+ fprintf(stderr, "Usage: unpack input-file\n");
+ exit(1);
+ }
+ inf = fopen(argv[1], "r");
+ if (!inf) {
+ fprintf(stderr, "Couldn't open |%s|\n", argv[1]);
+ exit(1);
+ }
+ while (fgets(filename, string_max, inf)) {
+ char *filetype = "w";
+ filename[strlen(filename) - 1] = EOS; /* remove newline at end */
+ puts(filename + 1); /* don't print the leading ! or # */
+ convert(filename + 1); /* convert to local filename conventions */
+ if (filename[0] == '#') filetype = "wb";
+ outf = fopen(filename + 1, filetype);
+ if (!outf) {
+ make_path(filename + 1);
+ outf = fopen(filename + 1, filetype);
+ if (!outf) {
+ fprintf(stderr, "Couldn't open |%s|\n", filename + 1);
+ exit(1);
+ }
+ }
+ if (filename[0] == '!') {
+ unpack_ascii(inf, outf, filename + 1);
+ } else if (filename[0] == '#') {
+ unpack_binary(inf, outf);
+ }
+ if (outf) fclose(outf);
+ }
+ fclose(inf);
+ return 0;
+}
+
+
+/* put_run -- output a run of characters */
+/**/
+void put_run(f, c, n)
+ FILE *f;
+ int c;
+ int n;
+{
+ while (n--) putc(c, f);
+}
+
+
+/* unpack_ascii -- from inf to outf */
+/**/
+void unpack_ascii(inf, outf, filename)
+ FILE *inf;
+ FILE *outf;
+ char *filename;
+{
+ for (;;) {
+ int c = getc(inf);
+ if (c == EOF) return;
+ else if (c > 127) {
+ fprintf(stderr, "Non-ascii char 0x%x found while unpacking %s.\n", c, filename);
+ return;
+ } else if (c >= 'A' && c <= '~') {
+ int n = (c - 'A');
+ //DO NOT OUTPUT LEADING TABS -- USE SPACES INSTEAD
+ // int tabs = (n / TAB_WIDTH);
+ // n -= tabs * TAB_WIDTH;
+ // put_run(outf, '\t', tabs);
+ put_run(outf, ' ', n);
+ } else if (c >= '0' && c <= '9') {
+ put_run(outf, '\n', c - '0');
+ } else if (c == '!' || c == '#') {
+ ungetc(c, inf);
+ return;
+ } else {
+ fprintf(stderr, "Unexpected char in col 1 (%c) while unpacking %s.\n",
+ c, filename);
+ return;
+ }
+
+ /* now get rest of the line */
+ while ((c = getc(inf)) != EOF) {
+ if (c == '$') {
+ c = getc(inf);
+ if (c == EOF) {
+ early_eof();
+ } else if (c == '$') {
+ putc('$', outf);
+ } else if (c >= '@' && c <= '_') {
+ putc(c - '@', outf);
+ } else if (c == '\n') {
+ ; /* do nothing */
+ } else {
+ fprintf(stderr, "Bad char (%c) after '$' while unpacking %s.\n",
+ c, filename);
+ }
+ } else {
+ putc(c, outf);
+ if (c == '\n') break; /* go up and process col. 1 char */
+ }
+ }
+ }
+}
+
+
+/* unpack_binary -- from inf to outf */
+/**/
+void unpack_binary(inf, outf)
+ FILE *inf;
+ FILE *outf;
+{
+ for (;;) {
+ long l;
+ int c = getc(inf);
+ if (c == EOF) {
+ early_eof();
+ } else if (c == '.') {
+ break;
+ } else if (c == '\n') {
+ ; /* do nothing */
+ } else {
+ l = c - '0';
+ c = getc(inf);
+ if (c == EOF) {
+ early_eof();
+ } else {
+ l = (l << 6) + (c - '0');
+ c = getc(inf);
+ if (c == EOF) {
+ early_eof();
+ } else if (c == '.') {
+ putc(l >> 4, outf);
+ break;
+ } else {
+ l = (l << 6) + (c - '0');
+ c = getc(inf);
+ if (c == EOF) {
+ early_eof();
+ } else if (c == '.') {
+ putc((l >> 10) & 0xFF, outf);
+ putc((l >> 2) & 0xFF, outf);
+ break;
+ } else {
+ l = (l << 6) + (c - '0');
+ putc((l >> 16) & 0xFF, outf);
+ putc((l >> 8) & 0xFF, outf);
+ putc(l & 0xFF, outf);
+ }
+ }
+ }
+ }
+ }
+ getc(inf); /* read the final newline */
+}
diff --git a/misc/unpacker.dsp b/misc/unpacker.dsp
new file mode 100644
index 0000000..74f05a7
--- /dev/null
+++ b/misc/unpacker.dsp
@@ -0,0 +1,105 @@
+# Microsoft Developer Studio Project File - Name="unpacker" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=unpacker - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "unpacker.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "unpacker.mak" CFG="unpacker - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "unpacker - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "unpacker - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "unpacker - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "unpacker_Release"
+# PROP Intermediate_Dir "unpacker_Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\cmt" /I "..\sys\win\msvc" /I "../cmt" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "unpacker - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "unpacker___Win32_Debug"
+# PROP BASE Intermediate_Dir "unpacker___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "unpacker_Debug"
+# PROP Intermediate_Dir "unpacker_Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\cmt" /I "..\sys\win\msvc" /I "../cmt" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /D "_DEBUG" /D "DEBUG_INPUT" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib winmm.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "unpacker - Win32 Release"
+# Name "unpacker - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\convert.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\unpacker.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/misc/unpacker.vcproj b/misc/unpacker.vcproj
new file mode 100644
index 0000000..5273869
--- /dev/null
+++ b/misc/unpacker.vcproj
@@ -0,0 +1,263 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="unpacker"
+ ProjectGUID="{E09240DC-CFBD-46BE-A6EA-2379C7502230}"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\unpacker_Release"
+ IntermediateDirectory=".\unpacker_Release"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\unpacker_Release/unpacker.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\cmt,..\sys\win\msvc,../cmt"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\unpacker_Release/unpacker.pch"
+ AssemblerListingLocation=".\unpacker_Release/"
+ ObjectFile=".\unpacker_Release/"
+ ProgramDataBaseFileName=".\unpacker_Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile=".\unpacker_Release/unpacker.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ProgramDatabaseFile=".\unpacker_Release/unpacker.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\unpacker_Release/unpacker.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\unpacker_Debug"
+ IntermediateDirectory=".\unpacker_Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\unpacker_Debug/unpacker.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\cmt,..\sys\win\msvc,../cmt"
+ PreprocessorDefinitions="_CONSOLE;WIN32;_DEBUG;DEBUG_INPUT"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ PrecompiledHeaderFile=".\unpacker_Debug/unpacker.pch"
+ AssemblerListingLocation=".\unpacker_Debug/"
+ ObjectFile=".\unpacker_Debug/"
+ ProgramDataBaseFileName=".\unpacker_Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib winmm.lib"
+ OutputFile=".\unpacker_Debug/unpacker.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\unpacker_Debug/unpacker.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\unpacker_Debug/unpacker.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="convert.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="unpacker.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>