1 /*
2     corfiles.h:
3 
4     Copyright (C) 2011 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 #ifndef __corfil
25 
26 #define __corfil
27 
28 CORFIL *corfile_create_w(CSOUND*);
29 CORFIL *corfile_create_r(CSOUND*,const char *text);
30 void corfile_putc(CSOUND*,int32_t c, CORFIL *f);
31 void corfile_puts(CSOUND*,const char *s, CORFIL *f);
32 void corfile_flush(CSOUND*,CORFIL *f);
33 void corfile_rm(CSOUND*,CORFIL **ff);
34 int32_t corfile_getc(CORFIL *f);
35 void corfile_ungetc(CORFIL *f);
36 char *corfile_fgets(char *b, int32_t len, CORFIL *f);
37 #define corfile_ungetc(f)  (--f->p)
38 MYFLT corfile_get_flt(CORFIL *f);
39 void corfile_reset(CORFIL *f);
40 #define corfile_reset(f) (f->body[f->p=0]='\0')
41 void corfile_rewind(CORFIL *f);
42 #define corfile_rewind(f) (f->p=0)
43 int32_t corfile_tell(CORFIL *f);
44 #define corfile_tell(f) (f->p)
45 char *corfile_body(CORFIL *f);
46 #define corfile_body(f) (f->body)
47 char *corfile_current(CORFIL *f);
48 #define corfile_current(f) (f->body+f->p)
49 CORFIL *copy_to_corefile(CSOUND *, const char *, const char *, int32_t);
50 CORFIL *copy_url_corefile(CSOUND *, const char *, int32_t);
51 int32_t corfile_length(CORFIL *f);
52 #define corfile_length(f) (strlen(f->body))
53 void corfile_set(CORFIL *f, int32_t n);
54 #define corfile_set(f,n) (f->p = n)
55 void corfile_seek(CORFIL *f, int32_t n, int32_t dir);
56 void corfile_preputs(CSOUND *csound, const char *s, CORFIL *f);
57 void add_corfile(CSOUND* csound, CORFIL *smpf, char *filename);
58 #endif
59