MCPcopy Create free account
hub / github.com/csound/csound / csoundStack_CreateArgMap

Function csoundStack_CreateArgMap

Opcodes/deprecated.c:198–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196}
197
198static CS_NOINLINE int32_t csoundStack_CreateArgMap(PUSH_OPCODE *p, int32_t *argMap,
199 int32_t isOutput)
200{
201 CSOUND *csound;
202 int32_t i, argCnt, argCnt_i, argCnt_p, curOffs_i, curOffs_p;
203 MYFLT** args = p->args;
204
205 csound = ((OPDS*) p)->insdshead->csound;
206 if (!isOutput) {
207 argCnt = csound->GetInputArgCnt(p);
208 }
209 else {
210 argCnt = csound->GetOutputArgCnt(p);
211 }
212 if (UNLIKELY(argCnt > 31))
213 return csoundStack_Error(p, "too many arguments");
214 argMap[0] = 0;
215 argCnt_i = 0;
216 argCnt_p = 0;
217 for (i = 0; i < argCnt; i++) {
218 int32_t maskVal = (1 << i);
219 if (ASIG_ARG_P(csound, args[i])) {
220 argMap[0] |= maskVal;
221 argCnt_p++;
222 }
223 else if (STR_ARG_P(csound, args[i])) {
224 argCnt_i++;
225 }
226 else {
227 const char *argName;
228 if (!isOutput)
229 argName = csound->GetInputArgName(p, i);
230 else
231 argName = csound->GetOutputArgName(p, i);
232 if (argName != (char*) 0 &&
233 (argName[0] == (char) 'k' ||
234 (argName[0] == (char) 'g' && argName[1] == (char) 'k') ||
235 (argName[0] == (char) '#' && argName[1] == (char) 'k'))) {
236 argMap[0] |= maskVal;
237 argCnt_p++;
238 }
239 else
240 argCnt_i++;
241 }
242 }
243 curOffs_i = (int32_t) sizeof(void*);
244 curOffs_i = csoundStack_Align(curOffs_i);
245 curOffs_p = curOffs_i;
246 curOffs_i += ((int32_t) sizeof(int32_t) * (argCnt_i + 1));
247 curOffs_i = csoundStack_Align(curOffs_i);
248 curOffs_p += ((int32_t) sizeof(int32_t) * (argCnt_p + 1));
249 curOffs_p = csoundStack_Align(curOffs_p);
250 for (i = 0; i < argCnt; i++) {
251 int32_t maskVal = (1 << i);
252 if (argMap[0] & maskVal) {
253 /* performance time types */
254 if (ASIG_ARG_P(csound, args[i])) {
255 argMap[i + 3] = (curOffs_p | CS_STACK_A);

Callers 2

push_opcode_initFunction · 0.85
pop_opcode_initFunction · 0.85

Calls 4

csoundStack_ErrorFunction · 0.85
ASIG_ARG_PFunction · 0.85
STR_ARG_PFunction · 0.85
csoundStack_AlignFunction · 0.85

Tested by

no test coverage detected