| 1 |
/* |
| 2 |
smain.c |
| 3 |
|
| 4 |
Copyright (C) 1991 Barry Vercoe, John ffitch |
| 5 |
|
| 6 |
This file is part of Csound. |
| 7 |
|
| 8 |
The Csound Library is free software; you can redistribute it |
| 9 |
and/or modify it under the terms of the GNU Lesser General Public |
| 10 |
License as published by the Free Software Foundation; either |
| 11 |
version 2.1 of the License, or (at your option) any later version. |
| 12 |
|
| 13 |
Csound is distributed in the hope that it will be useful, |
| 14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
GNU Lesser General Public License for more details. |
| 17 |
|
| 18 |
You should have received a copy of the GNU Lesser General Public |
| 19 |
License along with Csound; if not, write to the Free Software |
| 20 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 21 |
02110-1301 USA |
| 22 |
*/ |
| 23 |
|
| 24 |
#include "csound.h" /* SMAIN.C */ |
| 25 |
|
| 26 |
#if defined(LINUX) || defined(SGI) || defined(sol) || \ |
| 27 |
defined(__MACH__) || defined(__EMX__) |
| 28 |
#include <signal.h> |
| 29 |
#endif |
| 30 |
|
| 31 |
static void msg_callback(CSOUND *csound, |
| 32 |
int attr, const char *fmt, va_list args) |
| 33 |
{ |
| 34 |
(void) csound; |
| 35 |
if (attr & CSOUNDMSG_TYPE_MASK) { |
| 36 |
vfprintf(stderr, fmt, args); |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
int main(void) /* stdio stub for standalone scsort */ |
| 41 |
{ |
| 42 |
CSOUND *csound; |
| 43 |
int err; |
| 44 |
|
| 45 |
csound = csoundCreate(NULL); |
| 46 |
#if defined(LINUX) || defined(SGI) || defined(sol) || \ |
| 47 |
defined(__MACH__) || defined(__EMX__) |
| 48 |
signal(SIGPIPE, SIG_DFL); |
| 49 |
#endif |
| 50 |
csoundSetMessageCallback(csound, msg_callback); |
| 51 |
err = csoundScoreSort(csound, stdin, stdout); |
| 52 |
csoundDestroy(csound); |
| 53 |
|
| 54 |
return err; |
| 55 |
} |
| 56 |
|