From a5326ef274ad0037548ea7682ff38cebfdfa9486 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sun, 26 Aug 2012 00:46:14 +0200 Subject: [PATCH] sclang: remove obsolete cruft Signed-off-by: Tim Blechmann --- include/lang/PyrFileUtils.h | 50 --------------- include/lang/SFHeaders.h | 64 ------------------- lang/CMakeLists.txt | 1 - lang/LangPrimSource/PyrFilePrim.cpp | 19 +++++- lang/LangSource/PyrFileUtils.cpp | 120 ------------------------------------ platform/mac/CMakeLists.txt | 1 - 6 files changed, 16 insertions(+), 239 deletions(-) delete mode 100644 include/lang/PyrFileUtils.h delete mode 100644 include/lang/SFHeaders.h delete mode 100644 lang/LangSource/PyrFileUtils.cpp diff --git a/include/lang/PyrFileUtils.h b/include/lang/PyrFileUtils.h deleted file mode 100644 index 7148512c2..000000000 --- a/include/lang/PyrFileUtils.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - SuperCollider real time audio synthesis system - Copyright (c) 2002 James McCartney. All rights reserved. - http://www.audiosynth.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ -/* - -Some utils for file i/o. - -*/ - -#ifndef _PYRFILEUTIL_H_ -#define _PYRFILEUTIL_H_ - -int headerFormatFromSymbol(struct PyrSymbol *inSymbol); -int sampleFormatFromSymbol(struct PyrSymbol *inSymbol, int inHeaderFormat); - -#ifdef __MAC__ - -#include - -long setTypeCreator(unsigned char *filename, long type, long creator); -bool filelen(FILE *file, size_t *length); - -int allocasync(int fildes, int count, IOParam *pb, IOCompletionUPP completionFunc); -int createasync(unsigned char *path, int oflag, HParamBlockRec *hpb, IOCompletionUPP completionFunc); -int openasync(unsigned char *path, int oflag, HParamBlockRec *hpb, IOCompletionUPP completionFunc); -int closeasync(int fildes, HParamBlockRec *hpb, IOCompletionUPP completionFunc); -int writeasync(int fildes, const char *buf, int count, IOParam *pb, IOCompletionUPP completionFunc); -int readasync(int fildes, char *buf, int count, IOParam *pb, IOCompletionUPP completionFunc); -int seekwriteasync(int fildes, const char *buf, int count, int pos, IOParam *pb, IOCompletionUPP completionFunc); -int seekreadasync(int fildes, char *buf, int count, int pos, IOParam *pb, IOCompletionUPP completionFunc); - - -#endif -#endif diff --git a/include/lang/SFHeaders.h b/include/lang/SFHeaders.h deleted file mode 100644 index a39e39bca..000000000 --- a/include/lang/SFHeaders.h +++ /dev/null @@ -1,64 +0,0 @@ -// SuperCollider real time audio synthesis system -// Copyright (c) 2002 James McCartney. All rights reserved. -// http://www.audiosynth.com - -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -#ifndef _SFHeaders_ -#define _SFHeaders_ - -// #include "SCBase.h" -// #include "ReadWriteMacros.h" - -enum { - unsupported_sound_file = -1, - AIFF_sound_file, - AIFC_sound_file, - RIFF_sound_file, - NeXT_sound_file, - IRCAM_sound_file, - SD2_sound_file, - raw_sound_file, - flac_sound_file, - vorbis_sound_file -}; - -enum { - snd_unsupported = -1, - snd_no_snd, - snd_16_linear, - snd_8_mulaw, - snd_8_linear, - snd_32_float, - snd_32_linear, - snd_8_alaw, - snd_8_unsigned, - snd_24_linear, - snd_64_double, - snd_16_linear_little_endian, - snd_32_linear_little_endian, - snd_32_float_little_endian, - snd_64_double_little_endian, - snd_16_unsigned, - snd_16_unsigned_little_endian, - snd_24_linear_little_endian, - snd_32_vax_float, - snd_12_linear, - snd_12_linear_little_endian, - snd_12_unsigned, - snd_12_unsigned_little_endian -}; - -#endif diff --git a/lang/CMakeLists.txt b/lang/CMakeLists.txt index ab2d3f0e0..1d8c8725e 100644 --- a/lang/CMakeLists.txt +++ b/lang/CMakeLists.txt @@ -51,7 +51,6 @@ set(sclang_sources LangSource/DumpParseNode.cpp LangSource/GC.cpp LangSource/InitAlloc.cpp - LangSource/PyrFileUtils.cpp LangSource/PyrInterpreter3.cpp LangSource/PyrLexer.cpp LangSource/PyrMathOps.cpp diff --git a/lang/LangPrimSource/PyrFilePrim.cpp b/lang/LangPrimSource/PyrFilePrim.cpp index ef8abb17e..76282f445 100644 --- a/lang/LangPrimSource/PyrFilePrim.cpp +++ b/lang/LangPrimSource/PyrFilePrim.cpp @@ -29,7 +29,6 @@ Primitives for File i/o. #include "PyrPrimitive.h" #include "PyrSymbol.h" #include "PyrFilePrim.h" -#include "PyrFileUtils.h" #include "ReadWriteMacros.h" #include "SCBase.h" #include "SC_DirUtils.h" @@ -78,8 +77,6 @@ Primitives for File i/o. #define DELIMITOR ':' -bool filelen(FILE *file, size_t *length); - int prFileDelete(struct VMGlobals *g, int numArgsPushed) { PyrSlot *a = g->sp - 1, *b = g->sp; @@ -346,6 +343,22 @@ int prFilePos(struct VMGlobals *g, int numArgsPushed) return errNone; } +static bool filelen(FILE *file, size_t *length) +{ // does not preserve file pointer + fpos_t pos; + if (fseek(file, 0, SEEK_END)) return true; + if (fgetpos(file, &pos)) return true; + +#ifdef SC_LINUX + // sk: hack alert! + *length = pos.__pos; +#else + *length = pos; +#endif + + return false; +} + int prFileLength(struct VMGlobals *g, int numArgsPushed) { PyrSlot *a; diff --git a/lang/LangSource/PyrFileUtils.cpp b/lang/LangSource/PyrFileUtils.cpp deleted file mode 100644 index 6be911aa6..000000000 --- a/lang/LangSource/PyrFileUtils.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// SuperCollider real time audio synthesis system -// Copyright (c) 2002 James McCartney. All rights reserved. -// http://www.audiosynth.com - -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -#include "SCBase.h" -#include "PyrFileUtils.h" - -# include "PyrSymbol.h" -# include "SFHeaders.h" - -#include -#include - -bool filelen(FILE *file, size_t *length); -bool filelen(FILE *file, size_t *length) -{ // does not preserve file pointer - fpos_t pos; - if (fseek(file, 0, SEEK_END)) return true; - if (fgetpos(file, &pos)) return true; - -#ifdef SC_LINUX - // sk: hack alert! - *length = pos.__pos; -#else - *length = pos; -#endif - - return false; -} - -extern short gHomeVol; -extern long gHomeDir; - -#ifdef NOCLASSIC -long setTypeCreator(unsigned char *filename, long type, long creator) -{ - FSSpec fsspec; - short saveVol; - long saveDir; - long err, bytespersamp; - int sampleSize, numchannels; - FInfo finfo; - - - HGetVol(NULL, &saveVol, &saveDir); - HSetVol(NULL, gHomeVol, gHomeDir); - err = FSMakeFSSpec(gHomeVol, 0L, filename, &fsspec); - if (err) { - postfl("IOError: %d\n", err); - HSetVol(NULL, saveVol, saveDir); - return errFailed; - } - FSpGetFInfo(&fsspec, &finfo); - finfo.fdType = type; - finfo.fdCreator = creator; - FSpSetFInfo(&fsspec, &finfo); - HSetVol(NULL, saveVol, saveDir); - return errNone; -} -#endif - - - -int sampleFormatFromSymbol(PyrSymbol *inSymbol, int inHeaderFormat) -{ - bool isRIFF = inHeaderFormat == RIFF_sound_file; - - char *name = inSymbol->name; - if (name[0] == 'i') { - if (name[3] == '8') return isRIFF ? snd_8_unsigned : snd_8_linear; - if (name[3] == '1') return isRIFF ? snd_16_linear_little_endian : snd_16_linear; - if (name[3] == '2') return isRIFF ? snd_24_linear_little_endian : snd_24_linear; - if (name[3] == '3') return isRIFF ? snd_32_linear_little_endian : snd_32_linear; - } - if (name[0] == 'f') return isRIFF ? snd_32_float_little_endian : snd_32_float; - if (name[0] == 'd') return isRIFF ? snd_64_double_little_endian : snd_64_double; - if (name[0] == 'm') return snd_8_mulaw; - if (name[0] == 'a') return snd_8_alaw; - return snd_unsupported; -} - -int headerFormatFromSymbol(PyrSymbol *inSymbol) -{ - char *name = inSymbol->name; - if (strcmp(name, "AIFF")==0) return AIFF_sound_file; - if (strcmp(name, "AIFC")==0) return AIFC_sound_file; - if (strcmp(name, "RIFF")==0) return RIFF_sound_file; - if (strcmp(name, "WAVE")==0) return RIFF_sound_file; - if (strcmp(name, "WAV" )==0) return RIFF_sound_file; - if (strcmp(name, "Sun" )==0) return NeXT_sound_file; - if (strcmp(name, "SD2" )==0) return SD2_sound_file; - if (strcmp(name, "IRCAM")==0) return IRCAM_sound_file; - if (strcmp(name, "NeXT")==0) return NeXT_sound_file; - if (strcmp(name, "Next")==0) return NeXT_sound_file; - if (strcmp(name, "NEXT")==0) return NeXT_sound_file; - if (strcmp(name, "Raw")==0) return raw_sound_file; - if (strcmp(name, "raw")==0) return raw_sound_file; - if (strcmp(name, "RAW")==0) return raw_sound_file; - if (strcmp(name, "vorbis")==0) return vorbis_sound_file; - if (strcmp(name, "FLAC")==0) return flac_sound_file; - //if (strcmp(name, "BICSF")==0) return BICSF_sound_file; - return unsupported_sound_file; -} - - - diff --git a/platform/mac/CMakeLists.txt b/platform/mac/CMakeLists.txt index 2396d4116..8f5fd9861 100644 --- a/platform/mac/CMakeLists.txt +++ b/platform/mac/CMakeLists.txt @@ -64,7 +64,6 @@ set(scapp_sources ${CMAKE_SOURCE_DIR}/lang/LangSource/DumpParseNode.cpp ${CMAKE_SOURCE_DIR}/lang/LangSource/GC.cpp ${CMAKE_SOURCE_DIR}/lang/LangSource/InitAlloc.cpp - ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrFileUtils.cpp ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrInterpreter3.cpp ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrLexer.cpp ${CMAKE_SOURCE_DIR}/lang/LangSource/PyrMathOps.cpp -- 2.11.4.GIT