1 /*
2     str_ops.h:
3 
4     Copyright (C) 2005, 2006 Istvan Varga
5               (C) 2005       Matt J. Ingalls, John ffitch
6 
7     This file is part of Csound.
8 
9     The Csound Library is free software; you can redistribute it
10     and/or modify it under the terms of the GNU Lesser General Public
11     License as published by the Free Software Foundation; either
12     version 2.1 of the License, or (at your option) any later version.
13 
14     Csound is distributed in the hope that it will be useful,
15     but WITHOUT ANY WARRANTY; without even the implied warranty of
16     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17     GNU Lesser General Public License for more details.
18 
19     You should have received a copy of the GNU Lesser General Public
20     License along with Csound; if not, write to the Free Software
21     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22     02110-1301 USA
23 */
24 
25 #ifndef CSOUND_STR_OPS_H
26 #define CSOUND_STR_OPS_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 typedef struct {
33     OPDS    h;
34     MYFLT   *indx;
35     STRINGDAT  *str;
36 } STRSET_OP;
37 
38 typedef struct {
39     OPDS    h;
40     MYFLT   *r;
41     STRINGDAT  *str;
42     char *mem;
43 } STRCHGD;
44 
45 typedef struct {
46     OPDS    h;
47     MYFLT   *indx;
48     MYFLT *str;
49 } STRTOD_OP;
50 
51 typedef struct {
52     OPDS    h;
53     STRINGDAT   *r;
54     MYFLT   *indx;
55 } STRGET_OP;
56 
57 typedef struct {
58     OPDS    h;
59     STRINGDAT  *r;
60     STRINGDAT   *str;
61 } STRCPY_OP;
62 
63 typedef struct {
64     OPDS    h;
65     STRINGDAT   *r;
66     STRINGDAT   *str1;
67     STRINGDAT   *str2;
68 } STRCAT_OP;
69 
70 typedef struct {
71     OPDS    h;
72     MYFLT   *r;
73     STRINGDAT   *str1;
74     STRINGDAT   *str2;
75 } STRCMP_OP;
76 
77 typedef struct {
78     OPDS    h;
79     STRINGDAT   *r;
80     STRINGDAT   *sfmt;
81     MYFLT   *args[64];
82 } SPRINTF_OP;
83 
84 typedef struct {
85     OPDS    h;
86     STRINGDAT   *sfmt;
87     MYFLT   *ktrig;
88     MYFLT   *args[64];
89     MYFLT   prv_ktrig;
90 } PRINTF_OP;
91 
92 typedef struct {
93     OPDS    h;
94     STRINGDAT   *str;
95     MYFLT   *ktrig;
96     MYFLT   *no_newline;
97     MYFLT   prv_ktrig;
98     int     noNewLine;
99 } PUTS_OP;
100 
101 typedef struct {
102     OPDS    h;
103     STRINGDAT   *Sdst;
104     STRINGDAT   *Ssrc;
105     MYFLT   *istart;
106     MYFLT   *iend;
107 } STRSUB_OP;
108 
109 typedef struct {
110     OPDS    h;
111     MYFLT   *ichr;
112     STRINGDAT   *Ssrc;
113     MYFLT   *ipos;
114 } STRCHAR_OP;
115 
116 typedef struct {
117     OPDS    h;
118     MYFLT   *ilen;
119     STRINGDAT   *Ssrc;
120 } STRLEN_OP;
121 
122 typedef struct {
123     OPDS    h;
124     STRINGDAT   *Sdst;
125     STRINGDAT   *Ssrc;
126 } STRUPPER_OP;
127 
128 typedef struct {
129     OPDS    h;
130     STRINGDAT   *Sdst;
131     MYFLT   *iopt;
132 } GETCFG_OP;
133 
134 typedef struct {
135     OPDS    h;
136     MYFLT   *ipos;
137     STRINGDAT   *Ssrc1;
138     STRINGDAT   *Ssrc2;
139 } STRINDEX_OP;
140 
141 typedef struct {
142     OPDS    h;
143     MYFLT   *inVar;
144 } PRINT_TYPE_OP;
145 
146 #ifndef CSOUND_STR_OPS_C
147 
148 int     strset_init(CSOUND *, void *);
149 int     strget_init(CSOUND *, void *);
150 int     strcpy_opcode_p(CSOUND *, void *);
151 int     strcpy_opcode_S(CSOUND *, void *);
152 int     strassign_opcode_S(CSOUND *, void *);
153 int     strassign_opcode_Sk(CSOUND *, void *);
154 int     strcat_opcode(CSOUND *, void *);
155 int     strcmp_opcode(CSOUND *, void *);
156 int     sprintf_opcode(CSOUND *, void *);
157 int     printf_opcode_init(CSOUND *, void *);
158 int     printf_opcode_set(CSOUND *, void *);
159 int     printf_opcode_perf(CSOUND *, void *);
160 int     puts_opcode_init(CSOUND *, void *);
161 int     puts_opcode_perf(CSOUND *, void *);
162 int     strtod_opcode_p(CSOUND *, void *);
163 int     strtod_opcode_S(CSOUND *, void *);
164 int     strtol_opcode_p(CSOUND *, void *);
165 int     strtol_opcode_S(CSOUND *, void *);
166 int     strsub_opcode(CSOUND *, void *);
167 int     strchar_opcode(CSOUND *, void *);
168 int     strlen_opcode(CSOUND *, void *);
169 int     strupper_opcode(CSOUND *, void *);
170 int     strlower_opcode(CSOUND *, void *);
171 int     getcfg_opcode(CSOUND *, void *);
172 int     strindex_opcode(CSOUND *, void *);
173 int     strrindex_opcode(CSOUND *, void *);
174 int     str_changed(CSOUND *csound, STRCHGD *p);
175 int     str_changed_k(CSOUND *csound, STRCHGD *p);
176 int     str_from_url(CSOUND *csound, STRCPY_OP *p);
177 int     print_type_opcode(CSOUND*, void*);
178   int     s_opcode(CSOUND *csound, void *p);
179   int     s_opcode_k(CSOUND *csound, void *p);
180 #endif      /* CSOUND_STR_OPS_C */
181 
182 #ifdef __cplusplus
183 }
184 #endif
185 
186 #endif      /* CSOUND_STR_OPS_H */
187