00001 /* 00002 str_ops.h: 00003 00004 Copyright (C) 2005, 2006 Istvan Varga 00005 (C) 2005 Matt J. Ingalls, John ffitch 00006 00007 This file is part of Csound. 00008 00009 The Csound Library is free software; you can redistribute it 00010 and/or modify it under the terms of the GNU Lesser General Public 00011 License as published by the Free Software Foundation; either 00012 version 2.1 of the License, or (at your option) any later version. 00013 00014 Csound is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public 00020 License along with Csound; if not, write to the Free Software 00021 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 00022 02111-1307 USA 00023 */ 00024 00025 #ifndef CSOUND_STR_OPS_H 00026 #define CSOUND_STR_OPS_H 00027 00028 #ifdef __cplusplus 00029 extern "C" { 00030 #endif 00031 00032 typedef struct { 00033 OPDS h; 00034 MYFLT *indx; 00035 MYFLT *str; 00036 } STRSET_OP; 00037 00038 typedef struct { 00039 OPDS h; 00040 MYFLT *r; 00041 MYFLT *indx; 00042 } STRGET_OP; 00043 00044 typedef struct { 00045 OPDS h; 00046 MYFLT *r; 00047 MYFLT *str; 00048 } STRCPY_OP; 00049 00050 typedef struct { 00051 OPDS h; 00052 MYFLT *r; 00053 MYFLT *str1; 00054 MYFLT *str2; 00055 } STRCAT_OP; 00056 00057 typedef struct { 00058 OPDS h; 00059 MYFLT *r; 00060 MYFLT *sfmt; 00061 MYFLT *args[64]; 00062 } SPRINTF_OP; 00063 00064 typedef struct { 00065 OPDS h; 00066 MYFLT *sfmt; 00067 MYFLT *ktrig; 00068 MYFLT *args[64]; 00069 MYFLT prv_ktrig; 00070 } PRINTF_OP; 00071 00072 typedef struct { 00073 OPDS h; 00074 MYFLT *str; 00075 MYFLT *ktrig; 00076 MYFLT *no_newline; 00077 MYFLT prv_ktrig; 00078 int noNewLine; 00079 } PUTS_OP; 00080 00081 typedef struct { 00082 OPDS h; 00083 MYFLT *Sdst; 00084 MYFLT *Ssrc; 00085 MYFLT *istart; 00086 MYFLT *iend; 00087 } STRSUB_OP; 00088 00089 typedef struct { 00090 OPDS h; 00091 MYFLT *ichr; 00092 MYFLT *Ssrc; 00093 MYFLT *ipos; 00094 } STRCHAR_OP; 00095 00096 typedef struct { 00097 OPDS h; 00098 MYFLT *ilen; 00099 MYFLT *Ssrc; 00100 } STRLEN_OP; 00101 00102 typedef struct { 00103 OPDS h; 00104 MYFLT *Sdst; 00105 MYFLT *Ssrc; 00106 } STRUPPER_OP; 00107 00108 typedef struct { 00109 OPDS h; 00110 MYFLT *Sdst; 00111 MYFLT *iopt; 00112 } GETCFG_OP; 00113 00114 typedef struct { 00115 OPDS h; 00116 MYFLT *ipos; 00117 MYFLT *Ssrc1; 00118 MYFLT *Ssrc2; 00119 } STRINDEX_OP; 00120 00121 /* 00122 { "strset", S(STRSET_OP), 1, "", "iS", 00123 (SUBR) strset_init, (SUBR) NULL, (SUBR) NULL }, 00124 { "strget", S(STRGET_OP), 1, "S", "i", 00125 (SUBR) strget_init, (SUBR) NULL, (SUBR) NULL }, 00126 { "strcpy", S(STRCPY_OP), 1, "S", "S", 00127 (SUBR) strcpy_opcode, (SUBR) NULL, (SUBR) NULL }, 00128 { "strcpyk", S(STRCPY_OP), 3, "S", "S", 00129 (SUBR) strcpy_opcode, (SUBR) strcpy_opcode, (SUBR) NULL }, 00130 { "strcat", S(STRCAT_OP), 1, "S", "SS", 00131 (SUBR) strcat_opcode, (SUBR) NULL, (SUBR) NULL }, 00132 { "strcatk", S(STRCAT_OP), 3, "S", "SS", 00133 (SUBR) strcat_opcode, (SUBR) strcat_opcode, (SUBR) NULL }, 00134 { "strcmp", S(STRCAT_OP), 1, "i", "SS", 00135 (SUBR) strcmp_opcode, (SUBR) NULL, (SUBR) NULL }, 00136 { "strcmpk", S(STRCAT_OP), 3, "k", "SS", 00137 (SUBR) strcmp_opcode, (SUBR) strcmp_opcode, (SUBR) NULL }, 00138 { "sprintf", S(SPRINTF_OP), 1, "S", "SN", 00139 (SUBR) sprintf_opcode, (SUBR) NULL, (SUBR) NULL }, 00140 { "sprintfk", S(SPRINTF_OP), 3, "S", "SN", 00141 (SUBR) sprintf_opcode, (SUBR) sprintf_opcode, (SUBR) NULL }, 00142 { "printf_i", S(PRINTF_OP), 1, "", "SiN", 00143 (SUBR) printf_opcode_init, (SUBR) NULL, (SUBR) NULL }, 00144 { "printf", S(PRINTF_OP), 3, "", "SkN", 00145 (SUBR) printf_opcode_set, (SUBR) printf_opcode_perf, (SUBR) NULL }, 00146 { "puts", S(PUTS_OP), 3, "", "Sko", 00147 (SUBR) puts_opcode_init, (SUBR) puts_opcode_perf, (SUBR) NULL }, 00148 { "strtod", S(STRSET_OP), 1, "i", "T", 00149 (SUBR) strtod_opcode, (SUBR) NULL, (SUBR) NULL }, 00150 { "strtodk", S(STRSET_OP), 3, "k", "U", 00151 (SUBR) strtod_opcode, (SUBR) strtod_opcode, (SUBR) NULL }, 00152 { "strtol", S(STRSET_OP), 1, "i", "T", 00153 (SUBR) strtol_opcode, (SUBR) NULL, (SUBR) NULL }, 00154 { "strtolk", S(STRSET_OP), 3, "k", "U", 00155 (SUBR) strtol_opcode, (SUBR) strtol_opcode, (SUBR) NULL }, 00156 { "strsub", S(STRSUB_OP), 1, "S", "Soj", 00157 (SUBR) strsub_opcode, (SUBR) NULL, (SUBR) NULL }, 00158 { "strsubk", S(STRSUB_OP), 3, "S", "Skk", 00159 (SUBR) strsub_opcode, (SUBR) strsub_opcode, (SUBR) NULL }, 00160 { "strchar", S(STRCHAR_OP), 1, "i", "So", 00161 (SUBR) strchar_opcode, (SUBR) NULL, (SUBR) NULL }, 00162 { "strchark", S(STRCHAR_OP), 3, "k", "SO", 00163 (SUBR) strchar_opcode, (SUBR) strchar_opcode, (SUBR) NULL }, 00164 { "strlen", S(STRLEN_OP), 1, "i", "S", 00165 (SUBR) strlen_opcode, (SUBR) NULL, (SUBR) NULL }, 00166 { "strlenk", S(STRLEN_OP), 3, "k", "S", 00167 (SUBR) strlen_opcode, (SUBR) strlen_opcode, (SUBR) NULL }, 00168 { "strupper", S(STRUPPER_OP), 1, "S", "S", 00169 (SUBR) strupper_opcode, (SUBR) NULL, (SUBR) NULL }, 00170 { "strupperk", S(STRUPPER_OP), 3, "S", "S", 00171 (SUBR) strupper_opcode, (SUBR) strupper_opcode, (SUBR) NULL }, 00172 { "strlower", S(STRUPPER_OP), 1, "S", "S", 00173 (SUBR) strlower_opcode, (SUBR) NULL, (SUBR) NULL }, 00174 { "strlowerk", S(STRUPPER_OP), 3, "S", "S", 00175 (SUBR) strlower_opcode, (SUBR) strlower_opcode, (SUBR) NULL }, 00176 { "getcfg", S(GETCFG_OP), 1, "S", "i", 00177 (SUBR) getcfg_opcode, (SUBR) NULL, (SUBR) NULL }, 00178 { "strindex", S(STRINDEX_OP), 1, "i", "SS", 00179 (SUBR) strindex_opcode, (SUBR) NULL, (SUBR) NULL }, 00180 { "strindexk", S(STRINDEX_OP), 3, "k", "SS", 00181 (SUBR) strindex_opcode, (SUBR) strindex_opcode, (SUBR) NULL }, 00182 { "strrindex", S(STRINDEX_OP), 1, "i", "SS", 00183 (SUBR) strrindex_opcode, (SUBR) NULL, (SUBR) NULL }, 00184 { "strrindexk", S(STRINDEX_OP), 3, "k", "SS", 00185 (SUBR) strrindex_opcode, (SUBR) strrindex_opcode, (SUBR) NULL }, 00186 */ 00187 00188 #ifndef CSOUND_STR_OPS_C 00189 00190 int strset_init(CSOUND *, void *); 00191 int strget_init(CSOUND *, void *); 00192 int strcpy_opcode(CSOUND *, void *); 00193 int strcat_opcode(CSOUND *, void *); 00194 int strcmp_opcode(CSOUND *, void *); 00195 int sprintf_opcode(CSOUND *, void *); 00196 int printf_opcode_init(CSOUND *, void *); 00197 int printf_opcode_set(CSOUND *, void *); 00198 int printf_opcode_perf(CSOUND *, void *); 00199 int puts_opcode_init(CSOUND *, void *); 00200 int puts_opcode_perf(CSOUND *, void *); 00201 int strtod_opcode(CSOUND *, void *); 00202 int strtol_opcode(CSOUND *, void *); 00203 int strsub_opcode(CSOUND *, void *); 00204 int strchar_opcode(CSOUND *, void *); 00205 int strlen_opcode(CSOUND *, void *); 00206 int strupper_opcode(CSOUND *, void *); 00207 int strlower_opcode(CSOUND *, void *); 00208 int getcfg_opcode(CSOUND *, void *); 00209 int strindex_opcode(CSOUND *, void *); 00210 int strrindex_opcode(CSOUND *, void *); 00211 00212 #endif /* CSOUND_STR_OPS_C */ 00213 00214 #ifdef __cplusplus 00215 } 00216 #endif 00217 00218 #endif /* CSOUND_STR_OPS_H */ 00219