| 1 |
/* |
| 2 |
xmain.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" /* XMAIN.C */ |
| 25 |
|
| 26 |
#if defined(LINUX) || defined(SGI) || defined(sol) || \ |
| 27 |
defined(__MACH__) || defined(__EMX__) |
| 28 |
#include <signal.h> |
| 29 |
#endif |
| 30 |
|
| 31 |
int main(int ac, char **av) /* stdio stub for standalone extract */ |
| 32 |
{ /* first opens the control xfile */ |
| 33 |
CSOUND *csound; |
| 34 |
FILE *xfp; |
| 35 |
int err = 1; |
| 36 |
|
| 37 |
csound = csoundCreate(NULL); |
| 38 |
#if defined(LINUX) || defined(SGI) || defined(sol) || \ |
| 39 |
defined(__MACH__) || defined(__EMX__) |
| 40 |
signal(SIGPIPE, SIG_DFL); |
| 41 |
#endif |
| 42 |
if (ac != 2) { |
| 43 |
fprintf(stderr, "usage: %s xfile <in >out\n", av[0]); |
| 44 |
goto err_return; |
| 45 |
} |
| 46 |
if ((xfp = fopen(av[1], "r")) == NULL) { |
| 47 |
fprintf(stderr, "%s: can not open %s\n", av[0], av[1]); |
| 48 |
goto err_return; |
| 49 |
} |
| 50 |
err = csoundScoreExtract(csound, stdin, stdout, xfp); |
| 51 |
fclose(xfp); |
| 52 |
err_return: |
| 53 |
csoundDestroy(csound); |
| 54 |
|
| 55 |
return err; |
| 56 |
} |
| 57 |
|