1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-22 22:43:01 +02: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,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;