Merge pull request #506 from andrewcsmith/patch-2
[supercollider.git] / lang / LangSource / cmdLineFuncs.cpp
blob7b8c7da51e9d0e974e45ec07b1efcd40fe60de89
1 /*
2 SuperCollider real time audio synthesis system
3 Copyright (c) 2002 James McCartney. All rights reserved.
4 http://www.audiosynth.com
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 // #ifdef SC_DARWIN
22 // # define USE_SC_TERMINAL_CLIENT 0
23 // #else
24 // # define USE_SC_TERMINAL_CLIENT 1
25 // #endif
27 #if USE_SC_TERMINAL_CLIENT
29 #include "SC_TerminalClient.h"
31 #ifdef SC_QT
32 # include "QtCollider.h"
33 #endif
35 #include <stdio.h>
37 int main(int argc, char** argv)
39 #ifdef SC_QT
40 return QtCollider::run(argc, argv);
41 #else
42 SC_TerminalClient app("sclang");
43 return app.run(argc, argv);
44 #endif
47 #else // !USE_SC_TERMINAL_CLIENT
49 #include "PyrSymbol.h"
50 #include "PyrObject.h"
51 #include "InitAlloc.h"
52 #include <stdarg.h>
53 #include "SCBase.h"
56 static FILE *postfile = stdout;
58 void setPostFile(FILE *file) { postfile = file; }
61 void postfl(const char *fmt, ...);
62 void postfl(const char *fmt, ...)
64 va_list vargs;
65 va_start(vargs, fmt);
66 vfprintf(postfile, fmt, vargs);
67 fflush(postfile);
70 extern "C" {
71 int vpost(const char *fmt, va_list vargs);
74 int vpost(const char *fmt, va_list vargs)
76 return vfprintf(postfile, fmt, vargs);
77 fflush(postfile);
80 void post(const char *fmt, ...);
81 void post(const char *fmt, ...)
83 va_list vargs;
84 va_start(vargs, fmt);
85 vfprintf(postfile, fmt, vargs);
86 //fflush(postfile);
89 void error(const char *fmt, ...);
90 void error(const char *fmt, ...)
92 fprintf(postfile, "ERROR: ");
93 va_list vargs;
94 va_start(vargs, fmt);
95 vfprintf(postfile, fmt, vargs);
96 fflush(postfile);
99 void postText(const char *text, long length);
100 void postText(const char *text, long length)
102 fwrite(text, sizeof(char), length, postfile);
105 void postChar(char c);
106 void postChar(char c)
108 fputc(c, postfile);
111 void flushPostBuf();
112 void flushPostBuf()
114 fflush(postfile);
117 long scMIDIout(int port, int len, int statushi, int chan, int data1, int data2);
118 long scMIDIout(int port, int len, int statushi, int chan, int data1, int data2)
120 return 0;
124 void tellPlugInsAboutToCompile();
125 void tellPlugInsAboutToCompile()
129 void tellPlugInsAboutToRun();
130 void tellPlugInsAboutToRun()
135 void closeAllGUIScreens();
136 void closeAllGUIScreens()
140 void initGUI();
141 void initGUI()
145 #ifndef PYSCLANG
146 void initGUIPrimitives();
147 void initGUIPrimitives()
150 #endif
152 void initSCViewPrimitives();
153 void initSCViewPrimitives()
157 void initCocoaFilePrimitives();
158 void initCocoaFilePrimitives()
162 void initCocoaBridgePrimitives();
163 void initCocoaBridgePrimitives()
167 // CR ADDED
168 void initRendezvousPrimitives();
169 void initRendezvousPrimitives()
173 int main();
174 int main()
177 pyr_init_mem_pools(2*1024*1024, 256*1024);
178 init_OSC(57120);
179 schedInit();
181 compileLibrary();
182 runLibrary(s_run); fflush(postfile);
184 cleanup_OSC();
186 return 0;
189 #endif // USE_SC_TERMINAL_CLIENT