1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-10 14:46:24 +01:00

Update Nyquist to v3.09.

This commit is contained in:
Leland Lucius
2015-04-07 22:10:17 -05:00
parent f88b27e6d8
commit 9fb0ce5b82
358 changed files with 26327 additions and 7043 deletions

View File

@@ -0,0 +1,191 @@
README.txt -- Nyquist information for Windows
Installation
------------
The Win32 version of Nyquist is packaged as a compiled (runtime)
system in an executable installer. For most users, the runtime version
contain everything you need to run Nyquist, including the executable,
examples, and documentation, packaged as an executable installer
program. After executing the installer, just find Nyquist in your
Start menu to run it. You may begin typing expressions such as the
ones in the following "Examples" section of the Nyquist manual (in
doc/nyquistman.pdf or doc/home.html).
(See "The 'java is not recognized' Error" below if you get this error
message.)
A source version is also available (the same source download is for
Win32, Mac OS X, and Linux). The source version is intended for
developers who want to recompile Nyquist. The contents of the source
archive are extracted to the C:\nyquist directory, but you can put it
anywhere you like. You can then open the workspace file, nyquist.sln,
using Microsoft Visual C++. You can build and run the command line
version of Nyquist from within Visual C++. There is a batch file,
comp-ide.bat, for bulding the Nyquist IDE. This requires the Java SDK
from Sun Microsystems.
64-bit Windows
--------------
Nyquist runs on 64-bit Windows. Although you can compile a 64-bit
native version, Nyquist is currently released for 32-bit Windows.
When running on 64-bit Windows, note that the Registry entries will
be under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\CMU\Nyquist. The
"Wow6432Node" creates a special namespace for 32-bit programs.
Optional
--------
Nyquist needs to know where to find the standard runtime files. The
location of runtime files must be stored in the Registry. The
installers create a registry entry, but if you move Nyquist or deal
with different versions, you can edit the Registry manually as
follows:
Run the Registry editor (e.g. type regedit into the Start Search
box of the Start menu and type the Enter key).
Find and highlight the SOFTWARE key under HKEY_LOCAL_MACHINE.
If you are on 64-bit Windows using 32-bit Nyquist, open the
Wow6432Node key under SOFTWARE.
Open the CMU key (if it is not there, use the Edit:New:Key menu
item to create a CMU key. CMU is case sensitive.)
Highlight the new CMU key.
Open the Nyquist key (if it is not there, use the Edit:New:Key menu
item to create a Nyquist key. Nyquist is case sensitive.)
Highlight the new Nyquist key.
Find the XLISPPATH string (if it is not there, use the
Edit:New:String menu item to create a new string and change the
name by typing XLISPPATH).
Select XLISPPATH and choose the Edit:Modify... menu item.
In the String Edit box, type a list of paths you want Nyquist to
search for lisp files. For example, if you installed Nyquist as
C:\nyquist, then type:
C:\nyquist\runtime,C:\nyquist\lib
The paths should be separated by a comma or semicolon and no
space. The runtime path is essential, and the lib path may become
essential in a future release. You can also add paths to personal
libraries of Lisp and Nyquist code.
Click the OK button of the string box and exit from the Registry
Editor application.
What if Nyquist functions are undefined?
----------------------------------------
If you do not have administrative privileges for your machine, the
installer may fail to set up the Registry entry that Nyquist uses to
find initialization files. In this case, Nyquist will run a lisp
interpreter, but many Nyquist functions will not be defined. If you
can log in as administrator, do it and reinstall Nyquist. If you do
not have permission, you can still run Nyquist as follows:
Create a file named init.lsp in the same directory as Nyquist.exe
(the default location is C:\Program Files\Nyquist, but you may
have installed it in some other location.) Put the following text
in init.lsp:
(setf *search-path*
"C:/Program Files/Nyquist/runtime,C:/Program Files/Nyquist/lib")
(load "C:/Program Files/Nyquist/runtime/init.lsp")
Note: in the three places where you see C:/Program Files/Nyquist,
insert the full path where Nyquist is actually installed. Use forward
slashes (/) rather than back slashes (\) to separate directories. For
example, if Nyquist is installed at D:\rbd\nyquist, then init.lsp
should contain:
(setf *search-path* "D:/rbd/nyquist/runtime,D:/rbd/nyquist/lib")
(load "d:/rbd/nyquist/runtime/init.lsp")
The variable *search-path*, if defined, is used in place of the
registry to determine search paths for files.
SystemRoot
----------
(Ignore this paragraph if you are not planning to use Open Sound
Control under Windows.)
If Nyquist prints an error message and quits when you enable Open
Sound Control (using osc-enable), check to see if you have an
environment variable SystemRoot, e.g. type set to a command prompt and
look for the value of SystemRoot. The normal value is C:\windows. If
the value is something else, you should put the environment entry, for
example:
SystemRoot="D:\windows"
into a file named systemroot (no extension). Put this file in your
nyquist directory. When you run jNyqIDE, it will look for this file
and pass the contents as an environment variable to Nyquist. The
Nyquist process needs this to open a UDP socket, which is needed for
Open Sound Control.
The window vanishes, "java is not recognized", and other errors
---------------------------------------------------------------
Sometimes Nyquist pops up a window that closes instantly. This
indicates that Java was not found.
Sometimes, Nyquist will run directly from the installer, but then it
will not start from the Windows Start menu. You can try running the
nyquist/jnyqide.bat program from a Windows command prompt (cmd).
If that fails, and you see an error similar to "java is not recognized
as in internal or external command error", the problem may be that
paths are not set up properly to allow the Windows shell to find java.
Right click on "My Computer" on the Windows desktop and select
"Properties." Under the "Advanced" tap, press the "Environment
Variables" button, and look for PATH under "System Variables." Make
sure the Java bin directory is on the path. If it is not, you will
have to find your installation of Java and add the appropriate
directory to the PATH variable, e.g. "C:\Program
Files\Java\jdk1.7.0\bin."
Another possible problem is that your Java version is not compatible
with Nyquist. In that case, you should see an error message
complaining about "Unsupported major.minor version...". The current
major.minor version is 51 and you need to have Java version 1.7
installed. (Use the command: java -version to find out your java
version number.)
You might have to reboot for these changes to take effect.
Compile Nyquist for using Visual Studio
---------------------------------------
Nyquist can be compiled using Visual Studio 2010 or 2012. You can
download Visual C++ Express 2010 and Visual Studio 2012 Express for
free from Mircosoft website.
If you use Visual C++ 2010 Express, you MUST install SP1 (service pack
1).
Open nyquist-vc2010.sln; If you are using Visual Studio 2012 or later
versions, open nyquist.sln instead.
In Visual Studio,
Set solution configuration to "Release" and solution platforms
to "Win32".
Click Debug->Build Solution (or press F7)
Click Debug->Start Debugging (or press F5)
To build jnyqide,
Check if you have installed JDK and have the directory to
javac.exe added to your system PATH.
Run comp-ide.bat under the project root. It will compile .java
files under jnyqide.
For debugging, you can run the IDE immediately.
First copy nyquist\WinRel\nyquist.exe to nyquist\ (only do
this each time you recompile nyquist.)
Then, run jnyqide.bat.
To generate a release:
Run releasenyqide.bat under the project root. It will copy
all the necessary files to .\nyqrelide\. You can run
jnyqide.bat from there.

View File

@@ -0,0 +1,299 @@
/*
* Copyright (c) 2000,2001 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* The contents of this file constitute Original Code as defined in and
* are subject to the Apple Public Source License Version 1.1 (the
* "License"). You may not use this file except in compliance with the
* License. Please obtain a copy of the License at
* http://www.apple.com/publicsource and read it before using this file.
*
* This Original Code and all software distributed under the License are
* distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
* License for the specific language governing rights and limitations
* under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/*
* <inttypes.h> -- Standard C header, defined in ISO/IEC 9899:1999
* (aka "C99"), section 7.8. This defines format string conversion
* specifiers suitable for use within arguments to fprintf and fscanf
* and their ilk.
*/
#if !defined(_INTTYPES_H_)
#define _INTTYPES_H_
#include <stdint.h>
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
/* Translator is not ISO/IEC 9899:1999-compliant. */
#if !defined(restrict)
#define restrict
#define __RESTRICT_KEYWORD_DEFINED__
#endif
#endif
/* "C++ implementations should define these macros only when
* __STDC_FORMAT_MACROS is defined before <inttypes.h> is included."
*/
#if (! defined(__cplusplus)) || defined(__STDC_FORMAT_MACROS)
#undef __PRI_8_LENGTH_MODIFIER__
#undef __PRI_64_LENGTH_MODIFIER__
#undef __SCN_8_LENGTH_MODIFIER__
#undef __SCN_64_LENGTH_MODIFIER__
#if defined(__STDC_LIBRARY_SUPPORTED__)
#define __PRI_8_LENGTH_MODIFIER__ "%hh"
#define __PRI_64_LENGTH_MODIFIER__ "%ll"
#define __SCN_8_LENGTH_MODIFIER__ "%hh"
#define __SCN_64_LENGTH_MODIFIER__ "%ll"
#else
#define __PRI_8_LENGTH_MODIFIER__ "%" /* none */
#define __PRI_64_LENGTH_MODIFIER__ "%q"
#endif
#define PRId8 __PRI_8_LENGTH_MODIFIER__ "d"
#define PRIi8 __PRI_8_LENGTH_MODIFIER__ "i"
#define PRIo8 __PRI_8_LENGTH_MODIFIER__ "o"
#define PRIu8 __PRI_8_LENGTH_MODIFIER__ "u"
#define PRIx8 __PRI_8_LENGTH_MODIFIER__ "x"
#define PRIX8 __PRI_8_LENGTH_MODIFIER__ "X"
#define PRId16 "%hd"
#define PRIi16 "%hi"
#define PRIo16 "%ho"
#define PRIu16 "%hu"
#define PRIx16 "%hx"
#define PRIX16 "%hX"
#define PRId32 "%ld"
#define PRIi32 "%li"
#define PRIo32 "%lo"
#define PRIu32 "%lu"
#define PRIx32 "%lx"
#define PRIX32 "%lX"
#define PRId64 __PRI_64_LENGTH_MODIFIER__ "d"
#define PRIi64 __PRI_64_LENGTH_MODIFIER__ "i"
#define PRIo64 __PRI_64_LENGTH_MODIFIER__ "o"
#define PRIu64 __PRI_64_LENGTH_MODIFIER__ "u"
#define PRIx64 __PRI_64_LENGTH_MODIFIER__ "x"
#define PRIX64 __PRI_64_LENGTH_MODIFIER__ "X"
#define PRIdLEAST8 PRId8
#define PRIiLEAST8 PRIi8
#define PRIoLEAST8 PRIo8
#define PRIuLEAST8 PRIu8
#define PRIxLEAST8 PRIx8
#define PRIXLEAST8 PRIX8
#define PRIdLEAST16 PRId16
#define PRIiLEAST16 PRIi16
#define PRIoLEAST16 PRIo16
#define PRIuLEAST16 PRIu16
#define PRIxLEAST16 PRIx16
#define PRIXLEAST16 PRIX16
#define PRIdLEAST32 PRId32
#define PRIiLEAST32 PRIi32
#define PRIoLEAST32 PRIo32
#define PRIuLEAST32 PRIu32
#define PRIxLEAST32 PRIx32
#define PRIXLEAST32 PRIX32
#define PRIdLEAST64 PRId64
#define PRIiLEAST64 PRIi64
#define PRIoLEAST64 PRIo64
#define PRIuLEAST64 PRIu64
#define PRIxLEAST64 PRIx64
#define PRIXLEAST64 PRIX64
#define PRIdFAST8 PRId32
#define PRIiFAST8 PRIi32
#define PRIoFAST8 PRIo32
#define PRIuFAST8 PRIu32
#define PRIxFAST8 PRIx32
#define PRIXFAST8 PRIX32
#define PRIdFAST16 PRId32
#define PRIiFAST16 PRIi32
#define PRIoFAST16 PRIo32
#define PRIuFAST16 PRIu32
#define PRIxFAST16 PRIx32
#define PRIXFAST16 PRIX32
#define PRIdFAST32 PRId32
#define PRIiFAST32 PRIi32
#define PRIoFAST32 PRIo32
#define PRIuFAST32 PRIu32
#define PRIxFAST32 PRIx32
#define PRIXFAST32 PRIX32
#define PRIdFAST64 PRId64
#define PRIiFAST64 PRIi64
#define PRIoFAST64 PRIo64
#define PRIuFAST64 PRIu64
#define PRIxFAST64 PRIx64
#define PRIXFAST64 PRIX64
#define PRIdPTR PRId32
#define PRIiPTR PRIi32
#define PRIoPTR PRIo32
#define PRIuPTR PRIu32
#define PRIxPTR PRIx32
#define PRIXPTR PRIX32
#define PRIdMAX PRId64
#define PRIiMAX PRIi64
#define PRIoMAX PRIo64
#define PRIuMAX PRIu64
#define PRIxMAX PRIx64
#define PRIXMAX PRIX64
#if defined(__SCN_8_LENGTH_MODIFIER__)
#define SCNd8 __SCN_8_LENGTH_MODIFIER__ "d"
#define SCNi8 __SCN_8_LENGTH_MODIFIER__ "i"
#define SCNo8 __SCN_8_LENGTH_MODIFIER__ "o"
#define SCNu8 __SCN_8_LENGTH_MODIFIER__ "u"
#define SCNx8 __SCN_8_LENGTH_MODIFIER__ "x"
#endif
#define SCNd16 "%hd"
#define SCNi16 "%hi"
#define SCNo16 "%ho"
#define SCNu16 "%hu"
#define SCNx16 "%hx"
#define SCNd32 "%ld"
#define SCNi32 "%li"
#define SCNo32 "%lo"
#define SCNu32 "%lu"
#define SCNx32 "%lx"
#if defined(__SCN_64_LENGTH_MODIFIER__)
#define SCNd64 __SCN_64_LENGTH_MODIFIER__ "d"
#define SCNi64 __SCN_64_LENGTH_MODIFIER__ "i"
#define SCNo64 __SCN_64_LENGTH_MODIFIER__ "o"
#define SCNu64 __SCN_64_LENGTH_MODIFIER__ "u"
#define SCNx64 __SCN_64_LENGTH_MODIFIER__ "x"
#endif
#if defined(__SCN_8_LENGTH_MODIFIER__)
#define SCNdLEAST8 SCNd8
#define SCNiLEAST8 SCNi8
#define SCNoLEAST8 SCNo8
#define SCNuLEAST8 SCNu8
#define SCNxLEAST8 SCNx8
#endif
#define SCNdLEAST16 SCNd16
#define SCNiLEAST16 SCNi16
#define SCNoLEAST16 SCNo16
#define SCNuLEAST16 SCNu16
#define SCNxLEAST16 SCNx16
#define SCNdLEAST32 SCNd32
#define SCNiLEAST32 SCNi32
#define SCNoLEAST32 SCNo32
#define SCNuLEAST32 SCNu32
#define SCNxLEAST32 SCNx32
#if defined(__SCN_64_LENGTH_MODIFIER__)
#define SCNdLEAST64 SCNd64
#define SCNiLEAST64 SCNi64
#define SCNoLEAST64 SCNo64
#define SCNuLEAST64 SCNu64
#define SCNxLEAST64 SCNx64
#endif
#define SCNdFAST8 SCNd32
#define SCNiFAST8 SCNi32
#define SCNoFAST8 SCNo32
#define SCNuFAST8 SCNu32
#define SCNxFAST8 SCNx32
#define SCNdFAST16 SCNd32
#define SCNiFAST16 SCNi32
#define SCNoFAST16 SCNo32
#define SCNuFAST16 SCNu32
#define SCNxFAST16 SCNx32
#define SCNdFAST32 SCNd32
#define SCNiFAST32 SCNi32
#define SCNoFAST32 SCNo32
#define SCNuFAST32 SCNu32
#define SCNxFAST32 SCNx32
#if defined(__SCN_64_LENGTH_MODIFIER__)
#define SCNdFAST64 SCNd64
#define SCNiFAST64 SCNi64
#define SCNoFAST64 SCNo64
#define SCNuFAST64 SCNu64
#define SCNxFAST64 SCNx64
#endif
#define SCNdPTR SCNd32
#define SCNiPTR SCNi32
#define SCNoPTR SCNo32
#define SCNuPTR SCNu32
#define SCNxPTR SCNx32
#if defined(__SCN_64_LENGTH_MODIFIER__)
#define SCNdMAX SCNd64
#define SCNiMAX SCNi64
#define SCNoMAX SCNo64
#define SCNuMAX SCNu64
#define SCNxMAX SCNx64
#endif
#endif /* if C++, then __STDC_FORMAT_MACROS enables the above macros */
#if defined(__STDC_LIBRARY_SUPPORTED__)
/* 7.8.2.1 */
extern intmax_t imaxabs(intmax_t j);
/* 7.8.2.2 */
typedef struct {
intmax_t quot;
intmax_t rem;
} imaxdiv_t;
extern imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
/* 7.8.2.3 */
extern intmax_t strtoimax(const char * restrict nptr, char ** restrict endptr, int base);
extern uintmax_t strtoumax(const char * restrict nptr, char ** restrict endptr, int base);
/* 7.8.2.4 */
extern intmax_t wcstoimax(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);
extern uintmax_t wcstoumax(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);
#endif
/*
No need to #undef the __*_{8,64}_LENGTH_MODIFIER__ macros;
in fact, you can't #undef them, because later uses of any of
their dependents will *not* then do the intended substitution.
Expansion of a #define like this one:
#define x IDENT y
uses the cpp value of IDENT at the location where x is *expanded*,
not where it is #defined.
*/
#if defined(__RESTRICT_KEYWORD_DEFINED__)
#undef restrict
#undef __RESTRICT_KEYWORD_DEFINED__
#endif
#endif /* !_INTTYPES_H_ */

View File

@@ -0,0 +1,213 @@
/*
* M A P I N L S . H
*
* Internationalization Support Utilities
*
* Copyright 1986-1996 Microsoft Corporation. All Rights Reserved.
*/
#ifndef _MAPINLS_H_
#define _MAPINLS_H_
#pragma option -b
#if defined (WIN32) && !defined (_WIN32)
#define _WIN32
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* We don't want to include windows.h in case that conflicts with an */
/* earlier inclusion of compobj.h */
#if !defined(WINAPI)
#if defined(_WIN32) && (_MSC_VER >= 800)
#define WINAPI __stdcall
#elif defined(WIN16)
#define WINAPI _far _pascal
#else
#define WINAPI _far _pascal
#endif
#endif
#if defined(DOS) || defined(_MAC)
#pragma option -b.
#include <string.h>
#pragma option -b
#endif
#ifndef FAR
#define FAR
#endif
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef unsigned int UINT;
typedef int BOOL;
#ifndef __CHAR_DEFINED__
typedef char CHAR;
#endif
#ifdef UNICODE
typedef WCHAR TCHAR;
#else
typedef char TCHAR;
#endif
// typedef unsigned short WCHAR;
typedef WCHAR FAR * LPWSTR;
typedef const WCHAR FAR * LPCWSTR;
typedef CHAR FAR * LPSTR;
typedef const CHAR FAR * LPCSTR;
typedef TCHAR FAR * LPTSTR;
typedef const TCHAR FAR * LPCTSTR;
typedef DWORD LCID;
typedef const void FAR * LPCVOID;
#ifndef _MAC
#ifndef LPOLESTR
#if !defined (_WIN32)
#define LPOLESTR LPSTR
#define LPCOLESTR LPCSTR
#define OLECHAR char
#define OLESTR(str) str
#else /* Win32 */
#define LPOLESTR LPWSTR
#define LPCOLESTR LPCWSTR
#define OLECHAR WCHAR
#define OLESTR(str) L##str
#endif /* !_WIN32 */
#endif /* LPOLESTR */
#endif /* _MAC */
#define NORM_IGNORECASE 0x00000001 /* ignore case */
#define NORM_IGNORENONSPACE 0x00000002 /* ignore diacritics */
#define NORM_IGNORESYMBOLS 0x00000004 /* ignore symbols */
#if defined (_WIN32) /* from winnls.h */
#define NORM_IGNOREKANATYPE 0x00010000 /* ignore kanatype */
#define NORM_IGNOREWIDTH 0x00020000 /* ignore width */
#elif defined (WIN16) /* from olenls.h */
#define NORM_IGNOREWIDTH 0x00000008 /* ignore width */
#define NORM_IGNOREKANATYPE 0x00000040 /* ignore kanatype */
#endif
#if defined(WIN16)
#define lstrcpyA lstrcpy
#define lstrlenA lstrlen
#define lstrcmpA lstrcmp
#define lstrcmpiA lstrcmpi
#define LoadStringA LoadString
#define IsBadStringPtrA(a1, a2) IsBadStringPtr(a1, a2)
#define wvsprintfA wvsprintf
#define MessageBoxA MessageBox
#define GetModuleHandleA GetModuleHandle
#define CreateWindowA CreateWindow
#define RegisterClassA RegisterClass
#define CharToOemBuff AnsiToOemBuff
#define CharToOem AnsiToOem
#define CharUpperBuff AnsiUpperBuff
#define CharUpper AnsiUpper
#elif defined(DOS) || defined(_MAC)
#define IsBadReadPtr(lp, cb) (FALSE)
#define IsBadWritePtr(lp, cb) (FALSE)
#define IsBadHugeReadPtr(lp, cb) (FALSE)
#define IsBadHugeWritePtr(lp, cb) (FALSE)
#define IsBadCodePtr(lpfn) (FALSE)
#ifdef _MAC
#undef IsBadStringPtr
#endif
#define IsBadStringPtr(lpsz, cchMax) (FALSE)
#define IsBadStringPtrA(lpsz, cchMax) (FALSE)
#if defined(DOS)
#define lstrcpyA strcpy
#define lstrlenA strlen
#define lstrcmpA strcmp
#define lstrcmp strcmp
#define lstrcmpi strcmpi
#define lstrcpy strcpy
#define lstrcat strcat
#define lstrlen strlen
#define wsprintf sprintf
#endif
#endif
#if defined(DOS) || defined(WIN16)
/* Simulate effect of afx header */
#define __T(x) x
#define _T(x) __T(x)
#define TEXT _T
#endif
#define CP_ACP 0 /* default to ANSI code page */
#define CP_OEMCP 1 /* default to OEM code page */
LCID WINAPI MNLS_GetUserDefaultLCID(void);
UINT WINAPI MNLS_GetACP(void);
int WINAPI MNLS_CompareStringA(LCID Locale, DWORD dwCmpFlags,
LPCSTR lpString1, int cchCount1, LPCSTR lpString2,
int cchCount2);
int WINAPI MNLS_CompareStringW(LCID Locale, DWORD dwCmpFlags,
LPCWSTR lpString1, int cchCount1, LPCWSTR lpString2,
int cchCount2);
int WINAPI MNLS_MultiByteToWideChar(UINT uCodePage, DWORD dwFlags,
LPCSTR lpMultiByteStr, int cchMultiByte,
LPWSTR lpWideCharStr, int cchWideChar);
int WINAPI MNLS_WideCharToMultiByte(UINT uCodePage, DWORD dwFlags,
LPCWSTR lpWideCharStr, int cchWideChar,
LPSTR lpMultiByteStr, int cchMultiByte,
LPCSTR lpDefaultChar, BOOL FAR *lpfUsedDefaultChar);
int WINAPI MNLS_lstrlenW(LPCWSTR lpString);
int WINAPI MNLS_lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2);
LPWSTR WINAPI MNLS_lstrcpyW(LPWSTR lpString1, LPCWSTR lpString2);
BOOL WINAPI MNLS_IsBadStringPtrW(LPCWSTR lpsz, UINT ucchMax);
#if defined(_WIN32) && !defined(_WINNT) && !defined(_WIN95) && !defined(_MAC)
#define _WINNT
#endif
#if !defined(_WINNT) && !defined(_WIN95)
#define GetUserDefaultLCID MNLS_GetUserDefaultLCID
#define GetACP MNLS_GetACP
#define MultiByteToWideChar MNLS_MultiByteToWideChar
#define WideCharToMultiByte MNLS_WideCharToMultiByte
#define CompareStringA MNLS_CompareStringA
#endif
#if !defined(MAPI_NOWIDECHAR)
#define lstrlenW MNLS_lstrlenW
#define lstrcmpW MNLS_lstrcmpW
#define lstrcpyW MNLS_lstrcpyW
#define CompareStringW MNLS_CompareStringW
#if defined(WIN16) || defined(_WINNT) || defined(_WIN95)
#define IsBadStringPtrW MNLS_IsBadStringPtrW
#elif defined(_MAC)
#define IsBadStringPtrW(lpsz, cchMax) (FALSE)
#else
#define IsBadStringPtrW (FALSE)
#endif
#endif /* ! MAPI_NOWIDECHAR */
#ifdef __cplusplus
}
#endif
#pragma option -b.
#endif /* _MAPINLS_H_ */

View File

@@ -0,0 +1,274 @@
/*
* M A P I W I N . H
*
* Definitions used by the MAPI Development Team to aid in
* developing single-source service providers that run on
* both WIN32 and WIN16 platforms.
* There are three sections.
*
* The first section defines how to call something that
* is available by different methods in WIN16 vs. WIN32.
* As such, they are totally new mechanisms.
*
* The second section establishes things that are available
* AS-IS in one environment but we have to define for the
* other environment.
*
* The third section simply defines a few conventions
* (simplifications) for common operations.
*
* Copyright (c) 2009 Microsoft Corporation. All Rights Reserved.
*/
/*
* Routines are included in the first section to manage per-instance
* global variables for DLLs. They assume that all of the DLL's
* per-instance global variables live in a single block of memory.
* Functions are provided to install and retrieve the correct block of
* memory for the current instance.
*
* There are only two functions:
*
* PvGetInstanceGlobals Call this to get the address of the
* per-instance globals structure.
* ScSetinstanceGlobals Call this to install the
* per-instance globals structure. It
* may fail if the number of instances
* exceeds a certain limit.
*
* The caller is free to choose the name, size, and allocation
* method of the per-instance global variables structure.
*
* The WIN32 implementation uses a pointer in the DLL's data
* segment. This assumes that the DLL gets a separate instance
* of the default data segment per calling process.
*
* The WIN16 implementation uses a fixed array of pointers and a
* matching fixed array of keys unique to the calling process.
*/
/*
* The second section consists largely of Win32 file I/O functions
* that are not supported under Win16. These functions are
* implemented in mapiwin.c, using DOS calls. Most have limitations
* relative to their Win32 counterparts, which are spelled out in
* the comments to the source code.
*/
#ifndef __MAPIWIN_H__
#define __MAPIWIN_H__
#if _MSC_VER > 1000
#pragma once
#endif
#if defined (WIN32) && !defined (_WIN32)
#define _WIN32
#endif
#include "mapinls.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_MAC)
#define MULDIV(x,y,z) MulDiv(x,y,z)
LPVOID FAR PASCAL PvGetInstanceGlobals(WORD wDataSet);
LONG FAR PASCAL ScSetInstanceGlobals(LPVOID pv, WORD wDataSet);
LONG FAR PASCAL ScSetVerifyInstanceGlobals(LPVOID pv, DWORD dwPid,
WORD wDataSet);
LPVOID FAR PASCAL PvGetVerifyInstanceGlobals(DWORD dwPid, DWORD wDataSet);
LPVOID FAR PASCAL PvSlowGetInstanceGlobals(DWORD dwPid, DWORD wDataSet);
BOOL FAR PASCAL FCleanupInstanceGlobals(WORD, DWORD);
#elif defined(_WIN64) || defined(_WIN32)
#define MULDIV(x,y,z) MulDiv(x,y,z)
extern LPVOID pinstX;
#define PvGetInstanceGlobals() pinstX
#define ScSetInstanceGlobals(_pv) (pinstX = _pv, 0)
#define PvGetVerifyInstanceGlobals(_pid) pinstX
#define ScSetVerifyInstanceGlobals(_pv,_pid) (pinstX = _pv, 0)
#define PvSlowGetInstanceGlobals(_pid) pinstX
#else
#error "Unknown Platform: MAPI is currently supported on Win32 and Win64"
#endif
#if (defined(_WIN64) || defined(_WIN32)) && !defined(_MAC)
#define szMAPIDLLSuffix "32"
#elif defined(DOS)
#define szMAPIDLLSuffix ""
#elif defined(_MAC)
#define szMAPIDLLSuffix "M"
#else
#error "Don't know the suffix for DLLs on this platform"
#endif
/********************************/
/* Things missing from one */
/* system-provided environment */
/* or the other. */
/********************************/
#if !defined(_WIN64) && !defined(_WIN32)
#define ZeroMemory(pb,cb) memset((pb),0,(cb))
#define FillMemory(pb,cb,b) memset((pb),(b),(cb))
#define CopyMemory(pbDst,pbSrc,cb) do \
{ \
size_t _cb = (size_t)(cb); \
if (_cb) \
memcpy(pbDst,pbSrc,_cb);\
} while (FALSE)
#define MoveMemory(pbDst,pbSrc,cb) memmove((pbDst),(pbSrc),(cb))
#define UNALIGNED
#endif
#if defined(_MAC)
typedef int INT;
typedef unsigned long ULONG;
typedef short SHORT;
typedef unsigned short USHORT;
typedef double LONGLONG;
typedef double DWORDLONG;
typedef unsigned char UCHAR;
typedef unsigned char FAR* PUCHAR;
typedef int BOOL;
/* Synchronization */
#define InterlockedIncrement(plong) (++(*(plong)))
#define InterlockedDecrement(plong) (--(*(plong)))
#ifndef CreateMutex
#define CreateMutexA CreateMutex
#define CreateMutexW CreateMutex
#define CreateMutex(pv, bool, sz) (INVALID_HANDLE_VALUE)
#endif
#define WaitForSingleObject(hObj, dw) ((void)0)
#define ReleaseMutex(hObj) ((BOOL)1)
#define CloseMutexHandle(hObj) TRUE
#define CRITICAL_SECTION ULONG
#define InitializeCriticalSection(_pcs) ((void)0)
#define DeleteCriticalSection(_pcs) ((void)0)
#define EnterCriticalSection(_pcs) ((void)0)
#define LeaveCriticalSection(_pcs) ((void)0)
#define MAX_PATH 260
#define FILE_FLAG_SEQUENTIAL_SCAN 0x08000000
#define CREATE_NEW 1
#define CREATE_ALWAYS 2
#define OPEN_EXISTING 3
#define OPEN_ALWAYS 4
#define TRUNCATE_EXISTING 5
#define FILE_ATTRIBUTE_READONLY 0x00000001
#define FILE_ATTRIBUTE_HIDDEN 0x00000002
#define FILE_ATTRIBUTE_SYSTEM 0x00000004
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
#define FILE_ATTRIBUTE_NORMAL 0x00000080
#define FILE_ATTRIBUTE_TEMPORARY 0x00000100
#define FILE_FLAG_WRITE_THROUGH 0x80000000
#define FILE_FLAG_RANDOM_ACCESS 0x10000000
#define TIME_ZONE_ID_UNKNOWN 0
#define TIME_ZONE_ID_STANDARD 1
#define TIME_ZONE_ID_DAYLIGHT 2
DWORD WINAPI GetLastError(void);
DWORD WINAPI GetFileAttributes(LPCSTR lpFileName);
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh);
BOOL WINAPI GetFileTime(HANDLE hFile, FILETIME FAR *lpftCreation,
FILETIME FAR *lpftLastAccess, FILETIME FAR *lpftLastWrite);
BOOL WINAPI SetFileTime(HANDLE hFile, const FILETIME FAR *lpftCreation,
const FILETIME FAR *lpftLastAccess,
const FILETIME FAR *lpftLastWrite);
DWORD WINAPI SetFilePointer(HANDLE hFile, LONG lDistanceToMove,
LONG FAR *lpDistanceToMoveHigh, DWORD dwMoveMethod);
BOOL WINAPI SetEndOfFile(HANDLE hFile);
BOOL WINAPI CloseHandle(HANDLE hObject);
DWORD WINAPI GetTempPath(DWORD nBufferLength, LPSTR lpBuffer);
UINT WINAPI GetTempFileName32 (LPCSTR lpPathName, LPCSTR lpPrefixString,
UINT uUnique, LPSTR lpTempFileName);
BOOL WINAPI DeleteFile(LPCSTR lpFileName);
BOOL WINAPI RemoveDirectory(LPCSTR lpPathName);
BOOL WINAPI CopyFile(LPCSTR szSrc, LPCSTR szDst, BOOL fFailIfExists);
BOOL WINAPI MoveFile(LPCSTR lpExistingFileName, LPCSTR lpNewFileName);
HANDLE WINAPI FindFirstFile(LPCSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData);
BOOL WINAPI FindNextFile(HANDLE hFindFile, LPWIN32_FIND_DATA lpFindFileData);
BOOL WINAPI FindClose(HANDLE hFindFile);
DWORD WINAPI GetFullPathName(LPCSTR lpFileName, DWORD nBufferLength,
LPSTR lpBuffer, LPSTR *lpFilePart);
void WINAPI Sleep(DWORD dwMilliseconds);
LONG WINAPI CompareFileTime(const FILETIME FAR *, const FILETIME FAR *);
BOOL WINAPI LocalFileTimeToFileTime(const FILETIME FAR *, FILETIME FAR *);
BOOL WINAPI FileTimeToLocalFileTime(const FILETIME FAR *, FILETIME FAR *);
BOOL WINAPI FileTimeToSystemTime(const FILETIME FAR *, SYSTEMTIME FAR *);
BOOL WINAPI SystemTimeToFileTime(const SYSTEMTIME FAR *, FILETIME FAR *);
void WINAPI GetSystemTime(SYSTEMTIME FAR *);
void WINAPI GetLocalTime(SYSTEMTIME FAR *);
BOOL WINAPI FileTimeToDosDateTime(const FILETIME FAR * lpFileTime,
WORD FAR *lpFatDate, WORD FAR *lpFatTime);
BOOL WINAPI DosDateTimeToFileTime(WORD wFatDate, WORD wFatTime,
FILETIME FAR * lpFileTime);
DWORD WINAPI GetTimeZoneInformation(
LPTIME_ZONE_INFORMATION lpTimeZoneInformation);
BOOL WINAPI SetTimeZoneInformation(
const TIME_ZONE_INFORMATION FAR *lpTimeZoneInformation);
DWORD WINAPI GetCurrentProcessId(void);
long WINAPI MulDiv32(long, long, long);
#else /* _MAC */
/* Remaps GetTempFileName32() to the real 32bit version */
#define GetTempFileName32(_szPath,_szPfx,_n,_lpbuf) GetTempFileName(_szPath,_szPfx,_n,_lpbuf)
#define CloseMutexHandle CloseHandle
#endif /* _MAC */
#ifdef _MAC
#define CRITICAL_SECTION ULONG
#define InitializeCriticalSection(_pcs) ((void)0)
#define DeleteCriticalSection(_pcs) ((void)0)
#define EnterCriticalSection(_pcs) ((void)0)
#define LeaveCriticalSection(_pcs) ((void)0)
#endif
/********************************/
/* Our private conventions */
/* (common to WIN32/WIN64) */
/********************************/
#define Cbtszsize(_a) ((lstrlen(_a)+1)*sizeof(TCHAR))
#define CbtszsizeA(_a) ((lstrlenA(_a) + 1))
#define CbtszsizeW(_a) ((lstrlenW(_a) + 1) * sizeof(WCHAR))
#define HexCchOf(_s) (sizeof(_s)*2+1)
#define HexSizeOf(_s) (HexCchOf(_s)*sizeof(TCHAR))
BOOL WINAPI IsBadBoundedStringPtr(const void FAR* lpsz, UINT cchMax);
#ifdef __cplusplus
}
#endif
#endif /* __MAPIWIN_H__ */

View File

@@ -0,0 +1,55 @@
/* stdint.h -- missing from Microsoft compilers, so this is a
* version constructed solely for libsndfile. It does not
* have a complete set of definitions.
*
* This file should be in a directory of include files used only
* by Microsoft compilers
*
* Roger Dannenberg, Aug 2012
*/
#ifndef _MSC_VER
#error "This Microsoft-specific file was included by a non-Microsoft compiler"
#endif
#ifndef STDINT_H
#define STDINT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <wchar.h>
#ifdef __cplusplus
}
#endif
// Define _W64 macros to mark types changing their size, like intptr_t.
#ifndef _W64
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
#define _W64 __w64
#else
#define _W64
#endif
#endif
#if (_MSC_VER < 1300)
//typedef signed char int8_t;
typedef signed short int16_t;
typedef signed int int32_t;
//typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#else
//typedef signed __int8 int8_t;
typedef signed __int16 int16_t;
typedef signed __int32 int32_t;
//typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
#endif
//typedef signed __int64 int64_t;
//typedef unsigned __int64 uint64_t;
#endif // STDINT_H

View File

@@ -95,7 +95,7 @@ void nyquist_printf(char *format, ...);
#define HAVE_SSIZE_T 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 0
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1

View File

@@ -14,49 +14,69 @@
xsetdir - set current directory of the process */
LVAL xsetdir() {
TCHAR ssCurDir[MAX_PATH], szCurDir[MAX_PATH];
int verbose = TRUE;
strcpy(ssCurDir, getstring(xlgastring()));
if (moreargs()) {
verbose = (xlgetarg() != NIL);
}
xllastarg();
if (SetCurrentDirectory(ssCurDir)) {
if (GetCurrentDirectory(
sizeof(szCurDir)/sizeof(TCHAR), szCurDir)) {
return cvstring(szCurDir);
/* create the result string
stdputstr("Current Directory: ");
stdputstr(szCurDir);
stdputstr("\n"); */
if (ok_to_open(ssCurDir, "r"))
if (SetCurrentDirectory(ssCurDir)) {
if (GetCurrentDirectory(
sizeof(szCurDir)/sizeof(TCHAR), szCurDir)) {
return cvstring(szCurDir);
/* create the result string
stdputstr("Current Directory: ");
stdputstr(szCurDir);
stdputstr("\n"); */
}
}
}
stdputstr("Directory Setting Error\n");
if (verbose) stdputstr("Directory Setting Error\n");
/* return nil on error*/
return NIL;
}
// test if source matches "c:\\windows" (case insensitive)
//
static int is_windows_dir(char *source)
{
char *windows_dir = "c:\\windows";
while (*source) {
if (!*windows_dir || tolower(*source++) != *windows_dir++) {
return FALSE;
}
}
return !*windows_dir;
}
/* xget_temp_path -- get a path to create temp files */
LVAL xget_temp_path()
{
char *p;
char szDir[MAX_PATH];
char szDirLC[MAX_PATH];
int rslt = GetTempPath(MAX_PATH, szDir);
if (rslt > MAX_PATH || rslt <= 0) {
return cvstring("");
} else {
/* Vista apparently treats c:\windows with
if (!(rslt > MAX_PATH || rslt <= 0)) {
/* Vista apparently treats c:\windows with
* special semantics, so just don't allow
* GetTempPath to put us in c:\windows...
*/
strcpy(szDirLC, szDir); /* convert to lower case */
for (p = szDirLC; *p; p++) {
*p = tolower(*p);
}
if (strstr(szDirLC, "c:\\windows")) {
/* c:\windows is bad. */
return cvstring("");
if (!is_windows_dir(szDir)) {
return cvstring(szDir);
}
}
// if not defined or "c:\\windows", which is bad
p = getenv("TEMP");
if (p && strlen(p) < MAX_PATH) strcpy(szDir, p);
else *szDir = 0;
if (!is_windows_dir(szDir)) {
return cvstring(szDir);
}
return cvstring("");
}
//Updated End

View File

@@ -59,8 +59,9 @@ const char os_sepchar = ',';
#include "xlisp.h"
#include "cext.h"
#include "userio.h"
#include "sliders.h"
#include "sliderdata.h"
#include "sound.h" /* define nosc_enabled */
#include "falloc.h" /* define table_memory */
/* externals */
extern FILE *tfp; /* transcript file pointer */
@@ -196,7 +197,7 @@ void start_input_thread()
void osinit (char *banner)
{
printf(banner);
printf("%s\n", banner);
if (_isatty( _fileno( stdin ) ) ){
redirect_flag = 0;
#ifdef DEBUG
@@ -217,13 +218,23 @@ void osinit (char *banner)
}
FILE *osaopen (char *name, char *mode) {
return fopen (name, mode);
FILE *fp = NULL;
#ifdef SAFE_NYQUIST
if (ok_to_open(name, mode))
#endif
fp = fopen (name, mode);
return fp;
}
FILE *osbopen (char *name, char *mode) {
FILE *fp = NULL;
char nmode[4];
strcpy (nmode, mode); strcat (nmode, "b");
return (fopen (name, nmode));
#ifdef SAFE_NYQUIST
if (ok_to_open(name, mode))
#endif
fp = fopen (name, mode);
return fp;
}
int osclose (FILE *fp) { return (fclose (fp)); }
@@ -285,7 +296,7 @@ void osflush (void) {
}
void oscheck (void) {
void oscheck (void) {
MSG lpMsg;
#if OSC
@@ -317,6 +328,19 @@ void oscheck (void) {
osflush();
xlbreak("BREAK", s_unbound);
}
run_time++;
if (run_time % 30 == 0) {
// maybe we should call fflush here like in Unix; I'm not sure if this is
// a bug or it is not necessary for Windows - RBD
if (run_time_limit > 0 && run_time > run_time_limit) {
xlfatal("Run time limit exceeded");
}
if (memory_limit > 0 &&
npools * MAXPOOLSIZE + table_memory + total >
memory_limit * 1000000) {
xlfatal("Memory limit exceeded");
}
}
}
//Update end
@@ -351,6 +375,7 @@ static char osdir_path[OSDIR_MAX_PATH];
// osdir_list_start -- prepare to list a directory
int osdir_list_start(char *path)
{
if (!ok_to_open(path, "r")) return FALSE;
if (strlen(path) >= OSDIR_MAX_PATH - 2) {
xlcerror("LISTDIR path too big", "return nil", NULL);
return FALSE;
@@ -368,7 +393,7 @@ int osdir_list_start(char *path)
}
char *osdir_list_next()
const char *osdir_list_next()
{
if (FindNextFile(hFind, &FindFileData) == 0) {
osdir_list_status = OSDIR_LIST_DONE;

View File

@@ -0,0 +1,45 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{3E29123D-0726-441C-8A38-42836B05F74C}
AppName=NyquistIDE
AppVerName=NyquistIDE 3.08
AppPublisher=Roger B. Dannenberg
AppPublisherURL=http://www.cs.cmu.edu/~music/nyquist
AppSupportURL=http://www.cs.cmu.edu/~music/nyquist
AppUpdatesURL=http://www.cs.cmu.edu/~music/nyquist
DefaultDirName={pf}\Nyquist
DefaultGroupName=Nyquist
LicenseFile=nyqrelide\license.txt
InfoAfterFile=nyqrelide\Readme.txt
OutputDir=setup
OutputBaseFilename=setupnyqiderun
SetupIconFile=sys\win\wingui\nycon.ico
SourceDir=c:\Users\Roger\research\nyquist2013
Compression=lzma
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "nyqrelide\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Registry]
Root: HKLM32; Subkey: "Software\CMU\Nyquist"; ValueType: string; ValueName: "XLISPPATH"; ValueData: "{app}\runtime,{app}\lib"
[Icons]
Name: "{group}\NyquistIDE"; Filename: "{app}\jnyqide.bat"; WorkingDir: "{app}"
Name: "{commondesktop}\NyquistIDE"; Filename: "{app}\jnyqide.bat"; WorkingDir: "{app}"; Tasks: desktopicon
[Run]
Filename: "{app}\jnyqide.bat"; WorkingDir: "{app}"; Description: "{cm:LaunchProgram,NyquistIDE}"; Flags: shellexec postinstall skipifsilent

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

View File

@@ -0,0 +1,2 @@
// button.h -- simple slider input

View File

@@ -0,0 +1,39 @@
#pragma warning( disable: 4237 ) // eub: temporary kludge
// RBD -- this will define true, false, bool
#include "yvals.h"
//these preprocessor checks seem to get rid of compiler
// error (redecl boolean)
// typedef int bool;
//#ifndef TRUE
#define TRUE 1
#define FALSE 0
//#endif
#define EOS '\000'
// now defined by yvals.h:
//#define true 1
//#define false 0
#define MALLOC ::malloc // note -- these macros are not consistently used
#define FREE ::free
void *MEMGET(long n);
void *MEMFREE(void *data, long n);
#define STREQ(a, b) (strcmp((a), (b)) == 0)
typedef unsigned long uint32;
typedef long int32;
typedef unsigned short uint16;
typedef short int16;
typedef unsigned char uint8;
//istvan 082197
// RBD commented out the following, instead, we're including yvals.h,
// a microsoft-dependent file
// #ifndef bool
// typedef unsigned char bool;
// #endif

View File

@@ -0,0 +1,34 @@
#include "stddef.h"
#include "cppext.h"
#include "longque.h"
#include "stdlib.h"
void longque::init(int size)
{
head = 0;
tail = 0;
count = 0;
max = size;
buff = (long *) malloc(sizeof(long) * size);
}
void longque::finish()
{
free(buff);
}
//1 producer-consumer safe
long longque::remove()
{
long l;
if (count <= 0) return 0;
count--;
l = buff[head++];
if (head == max) head = 0;
return l;
}

View File

@@ -0,0 +1,28 @@
class longque {
public:
void init(int size);
void finish();
//1 producer-consumer safe
void insert(long l) {
buff[tail] = l;
count++;
tail++;
if (tail == max) tail = 0;
}
long remove();
bool fullp() {
return count >= max;
}
bool emptyp() {
return count <= 0;
}
protected:
int max;
long *buff;
int head;
int tail;
int count;
};

View File

@@ -0,0 +1,21 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by winmain.rc
//
#define IDM_ABOUT 100
#define IDI_NYCON 101
#define ID_FILE_LOAD 101
#define ID_FILE_RELOAD 102
#define ID_FILE_EXIT 103
#define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 104
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -0,0 +1,6 @@
// slider.h -- simple slider input
#define NUMSLIDERS 9
extern HWND sliders[NUMSLIDERS];
void set_slider_pos(HWND hwnd, int ival);

View File

@@ -0,0 +1,248 @@
// textio.cpp -- handles text input and output to edit control
/*
Overview of character input:
ostgetc is called to get characters from stdin for XLisp
ostgetc gets characters using ggetchar() and performs line editing
ggetchar gets characters using wait_ascii()
wait_ascii() get characters from typein:queue; it calls
process_win_events if there are no characters, and it returns
ABORT_CHAR or BREAK_CHAR if abort_flag is set
characters get into typein::queue when the key handler is called
get_ascii is similar to wait_ascii, but it doesn't wait: it just
checks for input with process_win_events and returns a character
if there is one, otherwise, it returns false
*/
#include <stddef.h>
#include <stdarg.h>
#include <stdio.h>
#include <windows.h>
#include "cppext.h"
#include "longque.h"
#include "textio.h"
#include "typein.h"
#include "button.h"
#include "slider.h"
#include "winmain.h"
#include "assert.h"
extern "C" {
#include "xlisp.h"
}
#define GPRINTF_MESSAGE_LEN 500
//istvanmerge
//int abort_flag = 0;
longque typein::queue;
void typein::init()
{
queue.init(100);
}
void typein::finish()
{
queue.finish();
}
void typein::handler(char *inp)
{
if (!queue.fullp()) {
if (*inp == ABORT_CHAR) {
abort_flag = ABORT_LEVEL;
free(inp);
} else if (!abort_flag && *inp == BREAK_CHAR) {
abort_flag = BREAK_LEVEL;
free(inp);
} else if (!abort_flag && *inp == INFO_CHAR) {
xinfo();
free(inp);
} else queue.insert((long) inp);
}
}
extern char *next_ascii;
extern "C"
int get_ascii(char *c)
{
check_aborted(); /* input buffer check */
if (!next_ascii && typein::queue.emptyp()) return false;
*c = wait_ascii();
return true; // recurse with new string
}
/* check_aborted -- see if any characters are available, check for ctrl C */
extern "C"
int check_aborted()
{
process_win_events(USE_PEEK);
/* handle input messages, if ^C, handler will set abort flag */
return abort_flag;
}
/* define with va_alist and use vsprintf to get temp */
extern "C"
void gprintf(long where, char *format, ...)
{
char temp[GPRINTF_MESSAGE_LEN];
va_list pvar;
va_start(pvar, format);
_vsnprintf(temp, GPRINTF_MESSAGE_LEN, format, pvar);
va_end(pvar);
switch((long) where) {
case GTRANS:
break;
case GERROR:
break;
case GFATAL:
edit_append("FATAL: ");
edit_append(temp);
break;
case GDEBUG:
edit_append("DEBUG: ");
edit_append(temp);
break;
default:
edit_append("UNKNOWN: ");
edit_append(temp);
break;
}
edit_append(temp);
}
#if defined(nyquist_printf)
#error "nyquist_printf should not be defined yet"
#endif
extern "C"
void nyquist_printf(const char *format, ...)
{
char temp[GPRINTF_MESSAGE_LEN];
va_list pvar;
va_start(pvar, format);
_vsnprintf(temp, GPRINTF_MESSAGE_LEN, format, pvar);
va_end(pvar);
edit_append(temp);
}
/**************************************************************************
* gputchar
* General putchar
**************************************************************************/
extern "C"
void gputchar(int c)
{
char tmp[4];
tmp[0] = c;
tmp[1] = 0;
edit_append(tmp);
}
/**************************************************************************
* ggetchar
* General getchar
**************************************************************************/
extern "C"
int ggetchar()
{
return wait_ascii();
}
/**************************************************************************
* ggets
* General gets
**************************************************************************/
extern "C"
char *ggets(char *str)
{
char *s = str;
int c;
do {
c = ggetchar();
if (c == '\b' /* backspace */) {
if (s != str) {
gputchar('\b');
gputchar((int)' ');
gputchar('\b');
s--;
} else {
gputchar((int)0x07);
}
} else *s++ = (char) c;
} while (c != (int) '\n' && !abort_flag);
*(s-1) = EOS;
if (abort_flag) *str = EOS;
return str;
}
/****************************************************************************
* askbool
* Inputs:
* char *prompt: string to prompt for user input
* int deflt: true or false default
* Returns:
* boolean: true or false as entered by user
* Effect:
* prompts user for yes or no input, returns result
****************************************************************************/
extern "C"
int askbool(char *prompt, int deflt)
{
#define undefined -1
char defchar; /* the default answer */
char c; /* user input */
char in_string[100];
int result = -1; /* the result: -1 = undefined, 0 = false, 1 = true */
if (deflt) defchar = 'y';
else defchar = 'n';
while (result == undefined) {
gprintf(GTRANS, "%s? [%c]: ", prompt, defchar);
ggets(in_string);
c = in_string[0];
if (islower(c)) c = toupper(c);
if (c == 'Y') result = true;
else if (c == 'N') result = false;
else if (c == EOS) result = deflt;
else if (abort_flag) result = deflt;
/* space before Please to separate from user's type-in: */
else gprintf(GTRANS, " Please type Y or N.\n");
}
if (abort_flag == BREAK_LEVEL) {
abort_flag = 0;
result = deflt;
gprintf(GTRANS, "\n");
}
return result;
}
extern "C"
void io_init()
{
}

View File

@@ -0,0 +1,36 @@
#define CR '\n'
#define ABORT_CHAR 0x03
#define BREAK_CHAR 0x02
#define CLEANUP_CHAR 0x07
#define INFO_CHAR '\024'
#define BREAK_LEVEL 1
#define ABORT_LEVEL 2
#ifdef __cplusplus
extern "C" {
#endif
int ggetchar(void);
void gprintf(long where, char *format, ...);
void gputchar(int c);
int get_ascii(char *c);
char *ggets(char *str);
int check_aborted();
int askbool(char *prompt, int deflt);
char wait_ascii();
void io_init();
/* this is not entirely kosher: nyquist_printf is also declared in sound.h
so that all C programs will see it. Perhaps it should go into cext.h, but
I'm not sure I want to drag all that into here.
*/
void nyquist_printf(const char *format, ...);
#ifdef __cplusplus
}
#endif
#define GTRANS 0
#define GERROR 1
#define GFATAL 2
#define GDEBUG 3

View File

@@ -0,0 +1,8 @@
class typein {
public:
static longque queue;
static void init(void);
static void finish(void);
static void handler(char *inp);
};

View File

@@ -0,0 +1,366 @@
/* winstuff.c - windows interface routines for xlisp */
/* Written by Chris Tchou. */
/* This file contains the stuff that the other xlisp files call directly. */
#include "windows.h"
#include <stdio.h>
//#include <QuickDraw.h> /* for Random */
#include <memory.h> /* for DisposPtr */
#include <string.h>
//#include <SegLoad.h> /* for ExitToShell */
#include "xlisp.h"
#include "textio.h"
#if OSC
#include "sliders.h" /* define sliders */
#include "sound.h" /* define nosc_enabled */
#endif
#include "falloc.h" /* define table_memory */
const char os_pathchar = '\\';
const char os_sepchar = ',';
/* externals */
extern FILE *tfp; /* transcript file pointer */
extern int cursorPos;
extern char *macgets (void);
#define LBSIZE 200
/* local variables */
static char lbuf[LBSIZE];
static int lpos[LBSIZE];
static int lindex;
static int lcount = 0;
static int lposition;
static int line_edit = TRUE;
//int isascii (char c) { return 1; } /* every char is an ascii char, isn't it? */
void osinit(const char *banner) {
// int i;
char version[] = "\nWindows console interface by Roger Dannenberg.\n";
// InitMac (); /* initialize the mac interface routines */
// lposition = 0; /* initialize the line editor */
// for (i = 0; banner[i] != '\0'; i++) macputc (banner[i]);
// for (i = 0; version[i] != '\0'; i++) macputc (version[i]);
nyquist_printf(banner);
nyquist_printf(version);
}
FILE *osaopen (const char *name, const char *mode) {
FILE *fp = NULL;
if (ok_to_open(name, mode))
fp = fopen (name, mode);
return fp;
}
FILE *osbopen (const char *name, const char *mode) {
FILE *fp = NULL;
char nmode[4];
strcpy (nmode, mode); strcat (nmode, "b");
if (ok_to_open(name, mode))
fp = fopen (name, mode);
return fp;
}
int osclose (FILE *fp) { return (fclose (fp)); }
int osaputc (int ch, FILE *fp) { return (putc (ch, fp)); }
int osbputc (int ch, FILE *fp) { return (putc (ch, fp)); }
void osoutflush(FILE *fp) { fflush(fp); }
/* osagetc - get a character from an ascii file */
int osagetc(fp)
FILE *fp;
{
return (getc(fp));
}
extern int abort_flag;
#define OLDGETC
#ifdef OLDGETC
int ostgetc (void) {
/* int i;
if (numChars <= 0) { /* get some more */
/* if (linebuf) DisposPtr (linebuf);
linebuf = macgets ();
i = 0;
while (linebuf[i] != '\0') i++;
numChars = i;
if (tfp) for (i = 0; i < numChars; i++) osaputc (linebuf[i], tfp);
lineptr = linebuf;
}
numChars--;
if (*lineptr == '\r') {
lineptr++;
return '\n';
} else return (*lineptr++);*/
int ch = ggetchar();
oscheck(); /* in case user typed ^C */
if (ch == BREAK_CHAR && abort_flag == BREAK_LEVEL) {
abort_flag = 0;
}
return ch;
}
#else
void end_of_line_edit()
{
line_edit = FALSE;
if (tfp) {
for (lindex = 0; lindex < lcount; ++lindex)
osaputc(lbuf[lindex], tfp);
}
lindex = 0;
}
int ostgetc()
{
/*
* NOTE: lbuf[] accumulates characters as they are typed
* lpos[] is the column position of the characters
* lcount is the number of characters in lbuf
* lposition is current position
* lindex is index of next char to output
* line_edit is true iff we're inputing characters
*
*/
int ch;
while (line_edit) {
ch = ggetchar();
oscheck(); /* in case user typed ^C */
if (ch == BREAK_CHAR && abort_flag == BREAK_LEVEL) {
abort_flag = 0;
}
/* assume for now we should add the character */
lbuf[lcount] = ch;
lpos[lcount] = lposition;
lcount++;
lposition++;
/* now do all the special character processing */
switch (ch) {
case '\n':
lposition = 0;
end_of_line_edit();
gputchar('\r');
gputchar(ch);
break;
/* delete key generates: 1b, 5b, 33, 7E
which is: ESC, [, 3, ~ */
case '\010': /* backspace */
case '\177': /* delete */
lcount--; /* take out backspace or delete char */
lposition--;
if (lcount) {
lcount--;
while (lposition > lpos[lcount]) {
gputchar('\010');
gputchar(' ');
gputchar('\010');
lposition--;
}
}
break;
case '\025': /* control-u */
lcount--;
lposition--;
if (lcount) {
while (lposition > lpos[0]) {
gputchar('\010');
gputchar(' ');
gputchar('\010');
lposition--;
}
lcount = 0;
}
break;
/* note that control-z never reaches here */
case '\003': /* control-c */
xltoplevel();
lcount = 0;
break;
case '\007': /* control-g */
xlcleanup();
lcount = 0;
break;
case '\020': /* control-p */
xlcontinue();
lcount = 0;
break;
case '\002':
ostputc('\n'); /* control-b */
xlbreak("BREAK",s_unbound);
break;
case '\024': /* control-t */
xinfo();
lcount = 0;
break;
case '\t': /* TAB */
lposition--; /* undo the increment above */
do {
lposition++;
gputchar(' ');
} while (lposition & 7);
break;
default:
gputchar(ch);
break;
}
}
if (lindex + 1 >= lcount) {
lcount = 0;
line_edit = TRUE;
}
ch = lbuf[lindex++];
/* printf("[%c]", ch); */
fflush(stdout);
return ch;
}
#endif
void ostputc (int ch) {
// macputc (ch);
gputchar(ch); // console
if (tfp) osaputc (ch, tfp);
}
void ostoutflush()
{
if (tfp) fflush(tfp);
/* since ostputc calls gputchar which just calls putchar,
I'm going to flush stdout rather than extending the
"g" abstraction with a gflush() call. -RBD
*/
fflush(stdout);
}
void osflush (void) {
lindex = lcount = lposition = 0;
line_edit = TRUE;
}
extern int abort_flag;
void oscheck (void)
{
#if OSC
if (nosc_enabled) nosc_poll();
#endif
check_aborted();
if (abort_flag == ABORT_LEVEL) {
abort_flag = 0;
osflush();
xltoplevel();
} else if (abort_flag == BREAK_LEVEL) {
abort_flag = 0;
osflush();
xlbreak("BREAK",s_unbound);
}
run_time++;
if (run_time % 30 == 0) {
// maybe we should call fflush here like in Unix; I'm not sure if this is
// a bug or it is not necessary for Windows - RBD
if (run_time_limit > 0 && run_time > run_time_limit) {
xlfatal("Run time limit exceeded");
}
if (memory_limit > 0 &&
npools * MAXPOOLSIZE + table_memory + total >
memory_limit * 1000000) {
xlfatal("Memory limit exceeded");
}
}
}
void oserror(const char *msg) {
char line[100], *p;
sprintf (line,"error: %s\n",msg);
for (p = line; *p != '\0'; ++p) ostputc (*p);
}
void osfinish(void) {
portaudio_exit();
/* dispose of everything... */
// if (linebuf) DisposPtr (linebuf);
// MacWrapUp ();
// ExitToShell ();
}
int renamebackup (char *filename) { return 0; }
static WIN32_FIND_DATA FindFileData;
static HANDLE hFind = INVALID_HANDLE_VALUE;
#define OSDIR_LIST_READY 0
#define OSDIR_LIST_STARTED 1
#define OSDIR_LIST_DONE 2
static osdir_list_status = OSDIR_LIST_READY;
#define OSDIR_MAX_PATH 256
static char osdir_path[OSDIR_MAX_PATH];
// osdir_list_start -- prepare to list a directory
int osdir_list_start(const char *path)
{
if (strlen(path) >= OSDIR_MAX_PATH - 2) {
xlcerror("LISTDIR path too big", "return nil", NULL);
return FALSE;
}
if (!ok_to_open(path, "r")) return FALSE;
strcpy(osdir_path, path);
strcat(osdir_path, "/*"); // make a pattern to match all files
if (osdir_list_status != OSDIR_LIST_READY) {
osdir_list_finish(); // close previously interrupted listing
}
hFind = FindFirstFile(osdir_path, &FindFileData); // get the "."
if (hFind == INVALID_HANDLE_VALUE) return FALSE;
if (FindNextFile(hFind, &FindFileData) == 0) return FALSE; // get the ".."
osdir_list_status = OSDIR_LIST_STARTED;
return TRUE;
}
const char *osdir_list_next()
{
if (FindNextFile(hFind, &FindFileData) == 0) {
osdir_list_status = OSDIR_LIST_DONE;
return NULL;
}
return FindFileData.cFileName;
}
void osdir_list_finish()
{
if (osdir_list_status != OSDIR_LIST_READY) {
FindClose(hFind);
}
osdir_list_status = OSDIR_LIST_READY;
}
/* xechoenabled -- set/clear echo_enabled flag (unix only) */
LVAL xechoenabled()
{
int flag = (xlgetarg() != NULL);
xllastarg();
// echo_enabled = flag; -- do nothing in Windows
return NULL;
}

View File

@@ -0,0 +1,657 @@
#include "windows.h" /* required for all Windows applications */
#include "cppext.h"
#include "longque.h"
#include "button.h"
#include "slider.h"
#include "winmain.h" /* specific to this program */
#include "stdlib.h"
#include "string.h"
#include "stdio.h"
#include "textio.h"
#include "mmsystem.h"
#include <crtdbg.h>
#include <mapiwin.h> // for Sleep()
#include "stdio.h"
#include "resource.h"
#include "typein.h"
#include "xlispfns.h"
#include "winfun.h"
//#define THUMBTRACK // tries to get continuous scrollbars with SB_THUMBTRACK messages.
// doesn't work -- zone 1 doesn't seem to wake up until the button-up.
//#include "saudio.h"
//#define D if(0)
HWND buttons[NUMBUTTONS];
HWND sliders[NUMSLIDERS];
HWND textinput;
HWND textoutput;
HFONT hfont;
HWND alt_win;
WNDPROC alt_proc;
extern "C" {
HINSTANCE hInst; /* current instance */
HWND hMainWindow; /* main window handle */
}
/* HINSTANCE hInst; /* current instance */
/* HWND hMainWindow; /* main window handle */
int quit_value; // return value from WinMain
int abort_flag = 0;
// there's some state here:
// when we get a message from the input queue, it is an entire
// string. We save the string and a pointer to the next char
//
char *get_ascii_string = NULL;
char *next_ascii = NULL;
//asciiwait -- wait for ascii input
char wait_ascii()
{
if (next_ascii && *next_ascii) {
char c = *next_ascii++;
if (c == '\r') c = '\n';
_RPT1(_CRT_WARN, "|%c|", c);
return c;
}
if (get_ascii_string) {
_RPT2(_CRT_WARN, "free get_ascii_string %x %s\n",
get_ascii_string, get_ascii_string);
free(get_ascii_string);
get_ascii_string = NULL;
next_ascii = NULL;
}
// no input, so look for Windows messages
while (typein::queue.emptyp() && !abort_flag) {
process_win_events(USE_GET);
}
if (abort_flag == ABORT_LEVEL) return ABORT_CHAR;
if (abort_flag == BREAK_LEVEL) return BREAK_CHAR;
get_ascii_string = (char *) typein::queue.remove();
_RPT2(_CRT_WARN, "removed %x: %s\n", get_ascii_string, get_ascii_string);
edit_append(get_ascii_string);
next_ascii = get_ascii_string;
return wait_ascii();
}
//process_win_events -- receive and handle windows by either:
// USE_PEEK: non-blocking
// USE_GET: blocks
void process_win_events(int method)
{
MSG msg;
edit_append(""); // flush the output
if (method == USE_GET) {
//blocks until at least a message arrives
if (GetMessage(&msg, //msg stored here
NULL, //receive ALL application messages
NULL,NULL)) //no msg filtering
{
//standard windows loop
TranslateMessage(&msg); //posts another msg if there is a virtual to WM_CHAR mapping
DispatchMessage(&msg); //calls object's receive function
} else {
//is this ever entered???
quit_value = msg.wParam;
abort_flag = ABORT_CHAR;
exit(0);
}
} else {
//default: process all messges that already exist (non-blocking)
while (PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE | PM_NOYIELD))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
//STUFF TO PROVIDE CONSOLE-------------------------------------------------
//terminate strings and strip out LF
int lf2crlf(char *dest, char *src)
{
char *d = dest;
while (*src) {
if (*src == '\n') {
*dest++ = '\r';
}
*dest++ = *src++;
}
*dest = EOS;
return dest - d; /* string length */
}
#define EDIT_HIGH_WATER 10000
#define EDIT_LOW_WATER 9000
#define EABUFFMAX 110
static char eabuff[EABUFFMAX]; /* edit_append buffer */
static char eabuffx = 0;
static void edit_append2(char *txt2);
/* edit_append -- optimizes output by buffering
*
* call with empty string to flush buffer
*/
void edit_append(char *txt)
{
/* new algorithm to deal with long strings on input:
* if input is longer than 50, insert a zero and
* call recursively; then undo the zero and continue.
*/
char txt2[100];
while (strlen(txt) > 50) {
char temp = txt[50];
txt[50] = 0;
edit_append(txt); /* strlen(txt) == 50 */
txt = txt + 50;
txt[0] = temp;
}
int len = lf2crlf(txt2, txt);
if ((eabuffx + len + 1 > EABUFFMAX) || ((len == 0) && eabuffx)) {
edit_append2(eabuff);
eabuffx = 0;
}
strcpy(eabuff + eabuffx, txt2);
eabuffx += len;
}
static void edit_append2(char *txt2)
{
int len;
int lines;
if (*txt2 == '\b') { // special case: erase last character
long len = SendMessage(textoutput, WM_GETTEXTLENGTH, (WPARAM) 0, (LPARAM) 0);
if (len > 0) {
// select the last character:
SendMessage(textoutput, EM_SETSEL, (WPARAM) len - 1, (LPARAM) -1);
// delete the last character:
SendMessage(textoutput, EM_REPLACESEL, (WPARAM) 0, (LPARAM) ((LPSTR) ""));
}
return;
}
// to put insertion point at the end, first select
// everything ...
//wparam is UINT ; lparam is LONG
SendMessage(textoutput, EM_SETSEL, (WPARAM) 0, (LPARAM) -1);
// then remove selection, leaving cursor at the end:
SendMessage(textoutput, EM_SETSEL, (WPARAM) -1, (LPARAM) -1);
// now, replacement actually appends to the buffer:
SendMessage(textoutput, EM_REPLACESEL, (WPARAM) 0, (LPARAM) ((LPSTR) txt2));
// if the number of characters exceeds EDIT_HIGH_WATER, then
// trim the number of characters to EDIT_LOW_WATER by deleting
// all lines up to the one containing total-EDIT_LOW_WATER
lines = (int) SendMessage(textoutput, EM_GETLINECOUNT, (WPARAM) 0, (LPARAM) 0);
len = (int) SendMessage(textoutput, EM_LINEINDEX, (WPARAM)(lines - 1), (LPARAM) 0);
len += (int) SendMessage(textoutput, EM_LINELENGTH, (WPARAM)(lines - 1), (LPARAM) 0);
if (len > EDIT_HIGH_WATER) {
//these SendMessages operate to completion
lines = (int) SendMessage(textoutput, EM_LINEFROMCHAR,
(WPARAM)(len - EDIT_LOW_WATER), (LPARAM) 0);
len = (int) SendMessage(textoutput, EM_LINEINDEX, (WPARAM)(lines), (LPARAM) 0);
SendMessage(textoutput, EM_SETSEL, (WPARAM) 0, (LPARAM)(len));
SendMessage(textoutput, EM_REPLACESEL, (WPARAM) 0, (LPARAM) ((LPSTR) ""));
}
}
//THE STUFF REQUIRED BY WINDOWS APPLICATIONS----------------------------------
// we will subclass the textinput window with a window procedure that detects
// the Enter key (hex 0x0d) and sets a flag. Then in the main window proc,
// when an EN_CHANGE message is received, we will know the user typed Enter,
// so we can transfer the text to XLISP.
//
// This would be a good place also to add editing characters to scroll through
// previous entries.
//
WNDPROC DefaultEditWndProc = NULL;
#define ENTER_KEY 0x0d
bool enter_flag = false;
long CALLBACK EditWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if (message == WM_CHAR) {
if (wParam == ENTER_KEY) enter_flag = true;
_RPT1(_CRT_WARN, "wm_char is %x\n", wParam);
}
return CallWindowProc(DefaultEditWndProc, hWnd, message, wParam, lParam);
}
//All applications need to register
BOOL InitApplication(HINSTANCE hInstance /* current instance */)
{
WNDCLASS wc;
/* Fill in window class structure with parameters that describe the */
/* main window. */
wc.style = NULL; /* Class style(s). */
wc.lpfnWndProc = MainWndProc; /* Function to retrieve messages for */
/* windows of this class. */
wc.cbClsExtra = 0; /* No per-class extra data. */
wc.cbWndExtra = 0; /* No per-window extra data. */
wc.hInstance = hInstance; /* Application that owns the class. */
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_NYCON));
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = "MAINMENU"; /* Name of menu resource in .RC file. */
wc.lpszClassName = "CMTWClass"; /* Name used in call to CreateWindow. */
/* Register the window class and return success/failure code. */
return (RegisterClass(&wc));
}
static char *button_names[NUMBUTTONS] = { "Load File", "Reload File",
"Replay Sound", "Break", "Top", "Up", "Info", "F1", "F2", "F3", "F4" };
//each time this application is run, the following program must be run
BOOL InitInstance(
HINSTANCE hInstance, /* Current instance identifier. */
int nCmdShow) /* Param for first ShowWindow() call. */
{
int i;
RECT rect;
LRESULT rslt;
/* Save the instance handle in static variable, which will be used in */
/* many subsequent calls from this application to Windows. */
hInst = hInstance;
/* Create a main window for this application instance. */
hMainWindow = CreateWindow(
"CMTWClass", /* See RegisterClass() call. */
"Nyquist", /* Text for window title bar. */
WS_OVERLAPPEDWINDOW, /* Window style. */
CW_USEDEFAULT, /* Default horizontal position. */
CW_USEDEFAULT, /* Default vertical position. */
CW_USEDEFAULT, /* Default width. */
CW_USEDEFAULT, /* Default height. */
NULL, /* Overlapped windows have no parent. */
NULL, /* Use the window class menu. */
hInstance, /* This instance owns this window. */
NULL /* Pointer not needed. */
);
/* If window could not be created, return "failure" */
if (!hMainWindow)
return (FALSE);
GetClientRect(hMainWindow, (LPRECT) &rect);
/* Make the window visible; update its client area; and return "success" */
const int button_y = 25; // size in pixels
const int slider_x = 20;
const int slider_gap = 1;
const int input_height = 48; // how high is input type-in edit control
int slider_xsum = slider_x * NUMSLIDERS;
int button_ysum = button_y * NUMBUTTONS_VERT;
ShowWindow(hMainWindow, nCmdShow); /* Show the window */
UpdateWindow(hMainWindow); /* Sends WM_PAINT message */
for (i = 0; i < NUMBUTTONS; i++) {
int x = 0;
int y = i * button_y;
int width = slider_xsum;
if (i > 2) {
y = (3 + (i - 3) / 2) * button_y;
width = width / 2;
if ((i & 1) == 0) x = width;
}
buttons[i] = CreateWindow("Button", //lpszClassName
button_names[i],//windowName
BS_PUSHBUTTON | //Style: 1) PB
WS_CHILD | // 2) must reside w/in parent
WS_VISIBLE, // 3) initially visible
x, y, width, button_y,
hMainWindow, //owner window
(HMENU)(IDC_BUTTON+i),
//&buttonsH[i], //child window Id
hInstance, //application instance
NULL); //WM_CREATE argument
//activate current window & display w/current size and position
ShowWindow(buttons[i], SW_SHOW);
//update (nonempty) client area via WM_PAINT
UpdateWindow(buttons[i]);
}
for (i=0; i<NUMSLIDERS; ++i) {
char name[5];
sprintf(name, "%d", i);
sliders[i] = CreateWindow("Scrollbar", name, WS_CHILD | WS_VISIBLE | SBS_VERT /*| WS_BORDER */,
slider_x * i + slider_gap, button_ysum, slider_x - slider_gap, (rect.bottom - rect.top) - button_ysum,
hMainWindow, (HMENU)(IDC_SLIDER+i), hInstance, NULL); // (was IDC_BUTTON)
SetScrollRange(sliders[i], SB_CTL, 0, 127, 1);
ShowWindow(sliders[i], SW_SHOW);
UpdateWindow(sliders[i]);
}
textinput = CreateWindow("Edit", NULL,
WS_CHILD | WS_VISIBLE | ES_MULTILINE |
WS_VSCROLL | ES_AUTOVSCROLL | WS_BORDER,
slider_xsum, 0,
(rect.right - rect.left) - slider_xsum,
input_height,
hMainWindow, (HMENU)(IDC_EDIT_INPUT), hInstance, NULL);
// subclass the input window so we can catch the Enter key
DefaultEditWndProc = (WNDPROC) SetWindowLong(textinput, GWL_WNDPROC, (long) EditWndProc);
textoutput = CreateWindow("Edit", NULL,
WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_READONLY |
WS_VSCROLL | ES_AUTOVSCROLL | WS_BORDER,
slider_xsum, input_height - 1,
(rect.right - rect.left) - slider_xsum,
(rect.bottom - rect.top) - input_height,
hMainWindow, (HMENU)(IDC_EDIT), hInstance, NULL);
hfont = CreateFont(0, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
ANSI_CHARSET, OUT_RASTER_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, FIXED_PITCH | FF_DONTCARE,
"Courier");
rslt = SendMessage(textoutput, WM_SETFONT, (WPARAM) hfont,
MAKELPARAM(TRUE, 0));
ShowWindow(textoutput, SW_SHOW);
UpdateWindow(textoutput);
rslt = SendMessage(textinput, WM_SETFONT, (WPARAM) hfont,
MAKELPARAM(TRUE, 0));
ShowWindow(textinput, SW_SHOW);
UpdateWindow(textinput);
return (TRUE); /* Returns the value from PostQuitMessage */
}
//this is the hook called where any windows application starts up
extern "C" int WINAPI WinMain(
HINSTANCE hInstance, /* current instance */
HINSTANCE hPrevInstance, /* previous instance */
LPSTR lpCmdLine, /* command line */
int nCmdShow) /* show-window type (open/icon) */
{
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG);
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_WNDW); // EUB
#if defined(_DEBUG) && 0
int flags = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
flags |= _CRTDBG_CHECK_ALWAYS_DF; // do expensive memory checking -eub
flags |= _CRTDBG_LEAK_CHECK_DF; // check for leaks at termination
_CrtSetDbgFlag(flags);
_CrtCheckMemory();
#endif
typein::init();
if (!hPrevInstance) /* Other instances of app running? */
if (!InitApplication(hInstance)) /* Initialize shared things */
return (FALSE); /* Exits if unable to initialize */
/* Perform initializations that apply to a specific instance */
if (!InitInstance(hInstance, nCmdShow)) return (FALSE);
run_xlisp();
return quit_value;
}
char *button_msgs[] = {
"(ny:load-file)\n",
"(ny:reload-file)\n",
"(r)\n",
"\002",
"\003",
"\007",
"\024",
"(F1)\n",
"(F2)\n",
"(F3)\n",
"(F4)\n" };
static void type_this(char *ptr)
{
char *s = (char *) malloc(strlen(ptr) + 1);
_RPT1(_CRT_WARN, "type_this mallocs %x\n", s);
strcpy(s, ptr);
typein::handler(s);
}
//This is the Main Window Receive Function
long CALLBACK MainWndProc(
HWND hWnd, /* window handle */
UINT message, /* type of message */
WPARAM wParam, /* additional information */
LPARAM lParam) /* additional information */
{
switch (message) {
case WM_CHAR: {
//message: character code is posted via Translate Message
TCHAR c = (TCHAR) wParam;
//lKeyData = lParam; extended, ctrl, etc keys are ignored!!!
// typein::handler(c);
break;
}
case WM_COMMAND: {
//message: command from application menu
short int code = HIWORD(wParam);
int wid = LOWORD(wParam);
HWND hwndCtrl = (HWND) lParam;
if (code == 0 && wid == IDM_ABOUT) {
DialogBox(hInst, /*current inst*/ "ABOUTBOX", /*resource to use*/
hWnd, /* parent*/ (DLGPROC) About /*About() instance address*/);
} else if (code == 0 && wid == ID_FILE_LOAD) {
type_this(button_msgs[0]);
} else if (code == 0 && wid == ID_FILE_RELOAD) {
type_this(button_msgs[1]);
} else if (code == 0 && wid == ID_FILE_EXIT) {
type_this("(exit)\n");
} else if (wid >= IDC_BUTTON && wid < IDC_BUTTON + NUMBUTTONS) {
SetFocus(textinput); /* get focus back */
type_this(button_msgs[wid - IDC_BUTTON]);
} else if (wid == IDC_EDIT_INPUT) {
if (code == EN_CHANGE) {
if (enter_flag) {
enter_flag = false;
long len = SendMessage(hwndCtrl, WM_GETTEXTLENGTH, 0, 0);
len++; // allow for terminating null character
char *buffer = (char *) malloc(len);
SendMessage(hwndCtrl, WM_GETTEXT, (WPARAM) len, (LPARAM) buffer);
_RPT2(_CRT_WARN, "inserting %x: %s\n", buffer, buffer);
typein::handler(buffer);
SendMessage(hwndCtrl, WM_SETTEXT, (WPARAM) 0, (LPARAM) "");
}
}
} else if (wid == IDC_EDIT) {
if (code == EN_CHANGE) {
} else {
}
} else {
/*Let Windows process it*/
printf("unhandled: message %d\n", message);
return (DefWindowProc(hWnd, message, wParam, lParam));
}
break;
}
case WM_DESTROY:
//message: window being destroyed
PostQuitMessage(0);
break;
#ifdef MOUSEBUTTON_INPUT
case WM_LBUTTONDOWN: {
//message: left mouse button pressed while cursor in client area
//never used, need SetCaputure???
int /*???*/ xPos LOWORD(lParam);
int /*???*/ yPos HIWORD(lParam);
//int /*???*/ fwKeys; virtual keys not used!!!
buffer[0] = '<';
_itoa(xPos,buffer+1,10/*radix*/);
i = strlen(buffer);
buffer[i++] = ',';
_itoa(yPos,buffer+i,10/*radix*/);
i = strlen(buffer);
buffer[i++] = '>';
buffer[i] = 0;
edit_append(buffer);
break;
#endif
#ifdef DEBUGINPUT
//WM_USER msg codes are from the callbacks-------------------------
case WM_USER_TIMEOUT: {
//dummy message just unblocks GetMessage
break;
}
//remaining wMsg codes generated elsewhere------------------------------------
case WM_KILLFOCUS: {
//message: this window's loosing focus, focus must be set to new window
HWND newFocus = (HWND) wParam;
if (newFocus == textoutput) {
//why not also set buttons, sliders...???
SetFocus(hWnd);
}
break;
}
case WM_VSCROLL: {
//message: control bar scroll I/O
//where is window scroll bar handled???
//why is this not also a WM_COMMAND???
HWND hwndCtrl = (HWND) lParam;
short int nPos = HIWORD(wParam);
int code = LOWORD(wParam);
int i;
for (i = 0; i < NUMSLIDERS; i++) {
if (sliders[i] == hwndCtrl) {
int pos = GetScrollPos(hwndCtrl /*parent*/, SB_CTL /*control*/);
switch (code) {
case SB_LINEUP: pos--; break;
case SB_LINEDOWN: pos++; break;
case SB_PAGEUP: pos -= 10; break;
case SB_PAGEDOWN: pos += 10; break;
case SB_ENDSCROLL:
break; //why not continue???
case SB_THUMBTRACK:
#ifdef THUMBTRACK
pos = nPos;
break;
#else
continue; // no silly multiple messages
#endif
//break;
case SB_THUMBPOSITION:
#ifndef THUMBTRACK
pos = nPos;
#endif
break;
case SB_TOP: pos = 0; break;
case SB_BOTTOM: pos = 127; break;
default: continue; //avoid SetScrollPos
}
// SetScrollRange() set the range to 0-127, but clip just to make sure:
if (pos < 0) pos = 0;
if (pos > 127) pos = 127;
if (code != SB_ENDSCROLL
#ifdef THUMBTRACK
&& code != SB_THUMBTRACK
#endif
) {
//ctrlevents.insert(CTRLEVENT(IDC_SLIDER + i, 127 - pos));
}
SetScrollPos(hwndCtrl /*parent*/, SB_CTL /*control sb*/, pos /*new position*/, TRUE /*redraw*/);
break;
}
}
break;
}
#endif
default:
//Pass on all unproccessed messages
return (DefWindowProc(hWnd, message, wParam, lParam));
}
return (NULL); //all messages currently return this...
}
/****************************************************************************
FUNCTION: About(HWND, unsigned, WORD, LONG)
PURPOSE: Processes messages for "About" dialog box
MESSAGES:
WM_INITDIALOG - initialize dialog box
WM_COMMAND - Input received
COMMENTS:
No initialization is needed for this particular dialog box, but TRUE
must be returned to Windows.
Wait for user to click on "Ok" button, then close the dialog box.
****************************************************************************/
extern "C" BOOL CALLBACK About(
HWND hDlg, /* window handle of the dialog box */
unsigned message, /* type of message */
WORD wParam, /* message-specific information */
LONG lParam)
{
switch (message)
{
case WM_INITDIALOG: /* message: initialize dialog box */
return (TRUE);
case WM_COMMAND: /* message: received a command */
if (wParam == IDOK /* "OK" box selected? */
|| wParam == IDCANCEL) /* System menu close command? */
{
EndDialog(hDlg, TRUE); /* Exits the dialog box */
return TRUE;
}
break;
}
return FALSE; /* Didn't process a message */
}
/* Load File support */
extern "C"
void RegisterWindow(HWND w, WNDPROC p) {
alt_win = w;
alt_proc = p;
}

View File

@@ -0,0 +1,28 @@
#include "resource.h"
#ifdef __cplusplus
extern "C" {
#endif
BOOL InitApplication(HANDLE);
BOOL InitInstance(HANDLE, int);
long CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK About(HWND, unsigned, WORD, LONG);
void RegisterWindow(HWND, WNDPROC);
#define IDC_EDIT 300
#define IDC_EDIT_INPUT 301
#define IDC_BUTTON 400
#define IDC_SLIDER 500
#define NUMBUTTONS 11
// 7 buttons high:
#define NUMBUTTONS_VERT 7
extern int abort_flag;
#ifdef __cplusplus
}
#endif
#include "winmain2.h"

View File

@@ -0,0 +1,120 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
MAINMENU MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Load...", ID_FILE_LOAD
MENUITEM "&Reload", ID_FILE_RELOAD
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_FILE_EXIT
END
POPUP "&Help"
BEGIN
MENUITEM "&About Nyquist...", IDM_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
ABOUTBOX DIALOG DISCARDABLE 22, 17, 177, 98
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "About Nyquist"
FONT 8, "MS Sans Serif"
BEGIN
CTEXT "Nyquist, a language for music composition",IDC_STATIC,0,
5,177,8
CTEXT " and sound synthesis.",IDC_STATIC,0,14,177,8
CTEXT "Version 2.16",IDC_STATIC,0,76,177,8
DEFPUSHBUTTON "OK",IDOK,145,84,32,14,WS_GROUP
CTEXT "Copyright (c) 2001, by Roger B. Dannenberg",IDC_STATIC,
0,66,177,8
CTEXT "http://www.cs.cmu.edu/~rbd/nyquist",IDC_STATIC,0,26,177,
8
ICON IDI_NYCON,IDC_STATIC,79,38,21,20
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_NYCON ICON DISCARDABLE "nycon.ico"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,41 @@
extern int quit_flag;
extern int waiting_flag;
extern long start_time; // initial system time in ms
extern long the_time; // current time - updated by periodic interrupt
extern HWND hMainWindow; /* main window handle */
void edit_append(char *txt);
void debugeventwait();
bool get_mouse(int &x, int &y);
void wait_mouse(int &x, int &y);
void pause(long ms);
// parameters to process_win_events()
#define USE_GET 0
#define USE_PEEK 1
void process_win_events(int method);
#define CTRLEVENT(a, b) (((long) (a))<<16 | (b))
#define WM_USER_TIMEOUT (WM_USER + 0)
#define WM_USER_TIMESHOW (WM_USER + 1)
#define WM_USER_TIMESHOW1 (WM_USER + 2)
#define WM_USER_MIDI_INPUT (WM_USER + 10)
#define WM_USER_MIDISHOW (WM_USER + 11)
#define WM_USER_MIDISHOW1 (WM_USER + 12)
#define WM_USER_MIDI_IN_ERROR (WM_USER + 20)
#define WM_USER_MIDI_OUT_ERROR (WM_USER + 21)
#define TIMERCB 1
#define MIDIINCB 2
#define FROMTIMERCB(x) ((x) == TIMERCB)
#define FROMMIDIINCB(x) ((x) == MIDIINCB)
#define TEXT_WIN_HT 200

View File

@@ -0,0 +1 @@
/* nothing to do */

View File

@@ -0,0 +1,11 @@
#include "xlisp.h"
#include "xlispfns.h"
void run_xlisp()
{
xlisp_main_init(0,NULL);
xlisp_main();
/* clean up */
xlisp_wrapup();
}

View File

@@ -0,0 +1,9 @@
#ifdef __cplusplus
extern "C" {
#endif
void run_xlisp();
#ifdef __cplusplus
}
#endif