Lines Matching refs:api

67 void printArgList(FILE *f, const ApiEntry * api, int assumePrevious) {  in printArgList()  argument
69 for (ct=0; ct < api->paramCount; ct++) { in printArgList()
73 printVarTypeAndName(f, &api->params[ct]); in printArgList()
87 const ApiEntry * api = &apis[ct]; in printStructures() local
88 fprintf(f, "#define RS_CMD_ID_%s %i\n", api->name, ct+1); in printStructures()
89 fprintf(f, "struct __attribute__((packed)) RS_CMD_%s_rec {\n", api->name); in printStructures()
92 for (ct2=0; ct2 < api->paramCount; ct2++) { in printStructures()
94 printVarTypeAndName(f, &api->params[ct2]); in printStructures()
101 void printFuncDecl(FILE *f, const ApiEntry *api, const char *prefix, int addContext, int isFnPtr) { in printFuncDecl() argument
102 printVarTypeAndName(f, &api->ret); in printFuncDecl()
105 strcpy(t, api->name); in printFuncDecl()
111 fprintf(f, " (* %s%s) (", prefix, api->name); in printFuncDecl()
113 fprintf(f, " %s%s (", prefix, api->name); in printFuncDecl()
115 if (!api->nocontext) { in printFuncDecl()
122 printArgList(f, api, !api->nocontext); in printFuncDecl()
161 static int hasInlineDataPointers(const ApiEntry * api) { in hasInlineDataPointers() argument
164 if (api->sync || api->ret.typeName[0]) { in hasInlineDataPointers()
167 for (ct=0; ct < api->paramCount; ct++) { in hasInlineDataPointers()
168 const VarType *vt = &api->params[ct]; in hasInlineDataPointers()
207 const ApiEntry * api = &apis[ct]; in printApiCpp() local
210 printFuncDecl(f, api, "LF_", 0, 0); in printApiCpp()
212 if (api->direct) { in printApiCpp()
214 if (api->ret.typeName[0]) { in printApiCpp()
217 fprintf(f, "rsi_%s(", api->name); in printApiCpp()
218 if (!api->nocontext) { in printApiCpp()
221 for (ct2=0; ct2 < api->paramCount; ct2++) { in printApiCpp()
222 const VarType *vt = &api->params[ct2]; in printApiCpp()
223 if (ct2 > 0 || !api->nocontext) { in printApiCpp()
229 } else if (api->handcodeApi) { in printApiCpp()
231 fprintf(f, " LF_%s_handcode(", api->name); in printApiCpp()
232 if (!api->nocontext) { in printApiCpp()
235 for (ct2=0; ct2 < api->paramCount; ct2++) { in printApiCpp()
236 const VarType *vt = &api->params[ct2]; in printApiCpp()
237 if (ct2 > 0 || !api->nocontext) { in printApiCpp()
248 if (api->ret.typeName[0]) { in printApiCpp()
251 fprintf(f, "rsi_%s(", api->name); in printApiCpp()
252 if (!api->nocontext) { in printApiCpp()
255 for (ct2=0; ct2 < api->paramCount; ct2++) { in printApiCpp()
256 const VarType *vt = &api->params[ct2]; in printApiCpp()
257 if (ct2 > 0 || !api->nocontext) { in printApiCpp()
263 if (!api->ret.typeName[0]) { in printApiCpp()
269 fprintf(f, " const size_t size = sizeof(RS_CMD_%s);\n", api->name); in printApiCpp()
270 if (hasInlineDataPointers(api)) { in printApiCpp()
272 for (ct2=0; ct2 < api->paramCount; ct2++) { in printApiCpp()
273 const VarType *vt = &api->params[ct2]; in printApiCpp()
281 if (hasInlineDataPointers(api)) { in printApiCpp()
282 fprintf(f, " RS_CMD_%s *cmd = NULL;\n", api->name); in printApiCpp()
284 …static_cast<RS_CMD_%s *>(io->coreHeader(RS_CMD_ID_%s, dataSize + size));\n", api->name, api->name); in printApiCpp()
286 … cmd = static_cast<RS_CMD_%s *>(io->coreHeader(RS_CMD_ID_%s, size));\n", api->name, api->name); in printApiCpp()
290 …static_cast<RS_CMD_%s *>(io->coreHeader(RS_CMD_ID_%s, size));\n", api->name, api->name, api->name); in printApiCpp()
293 for (ct2=0; ct2 < api->paramCount; ct2++) { in printApiCpp()
294 const VarType *vt = &api->params[ct2]; in printApiCpp()
296 if (vt->ptrLevel && hasInlineDataPointers(api)) { in printApiCpp()
311 if (api->ret.typeName[0] || api->sync) { in printApiCpp()
316 if (hasInlineDataPointers(api)) { in printApiCpp()
320 } else if (api->ret.typeName[0]) { in printApiCpp()
322 printVarType(f, &api->ret); in printApiCpp()
335 if (api->direct) { in printApiCpp()
340 printFuncDecl(f, api, "RF_", 0, 0); in printApiCpp()
343 fprintf(f, " const uint32_t cmdID = RS_CMD_ID_%s;\n", api->name); in printApiCpp()
346 for (ct2=0; ct2 < api->paramCount; ct2++) { in printApiCpp()
347 const VarType *vt = &api->params[ct2]; in printApiCpp()
354 for (ct2=0; ct2 < api->paramCount; ct2++) { in printApiCpp()
355 const VarType *vt = &api->params[ct2]; in printApiCpp()
362 for (ct2=0; ct2 < api->paramCount; ct2++) { in printApiCpp()
363 const VarType *vt = &api->params[ct2]; in printApiCpp()
372 for (ct2=0; ct2 < api->paramCount; ct2++) { in printApiCpp()
373 const VarType *vt = &api->params[ct2]; in printApiCpp()
380 for (ct2=0; ct2 < api->paramCount; ct2++) { in printApiCpp()
381 const VarType *vt = &api->params[ct2]; in printApiCpp()
390 if (api->ret.typeName[0]) { in printApiCpp()
392 printVarType(f, &api->ret); in printApiCpp()
419 const ApiEntry * api = &apis[ct]; in printApiCpp() local
423 printFuncDecl(f, api, "rs", 0, 0); in printApiCpp()
426 if (api->ret.typeName[0]) { in printApiCpp()
429 fprintf(f, "s_CurrentTable->%s(", api->name); in printApiCpp()
431 if (!api->nocontext) { in printApiCpp()
435 for (ct2=0; ct2 < api->paramCount; ct2++) { in printApiCpp()
436 const VarType *vt = &api->params[ct2]; in printApiCpp()
437 if (ct2 > 0 || !api->nocontext) { in printApiCpp()
463 const ApiEntry * api = &apis[ct]; in printPlaybackCpp() local
466 if (api->direct) { in printPlaybackCpp()
470 fprintf(f, "void rsp_%s(Context *con, const void *vp, size_t cmdSizeBytes) {\n", api->name); in printPlaybackCpp()
471 …rintf(f, " const RS_CMD_%s *cmd = static_cast<const RS_CMD_%s *>(vp);\n", api->name, api->name); in printPlaybackCpp()
473 if (hasInlineDataPointers(api)) { in printPlaybackCpp()
475 fprintf(f, " if (cmdSizeBytes != sizeof(RS_CMD_%s)) {\n", api->name); in printPlaybackCpp()
481 if (api->ret.typeName[0]) { in printPlaybackCpp()
483 printVarType(f, &api->ret); in printPlaybackCpp()
486 fprintf(f, "rsi_%s(con", api->name); in printPlaybackCpp()
487 for (ct2=0; ct2 < api->paramCount; ct2++) { in printPlaybackCpp()
488 const VarType *vt = &api->params[ct2]; in printPlaybackCpp()
491 if (hasInlineDataPointers(api) && vt->ptrLevel) { in printPlaybackCpp()
499 if (hasInlineDataPointers(api)) { in printPlaybackCpp()
501 for (ct2=0; ct2 < api->paramCount; ct2++) { in printPlaybackCpp()
502 if (api->params[ct2].ptrLevel) { in printPlaybackCpp()
503 fprintf(f, " totalSize += cmd->%s_length;\n", api->params[ct2].name); in printPlaybackCpp()
507 … fprintf(f, " if ((totalSize != 0) && (cmdSizeBytes == sizeof(RS_CMD_%s))) {\n", api->name); in printPlaybackCpp()
510 } else if (api->ret.typeName[0]) { in printPlaybackCpp()
512 } else if (api->sync || needFlush) { in printPlaybackCpp()
520 const ApiEntry * api = &apis[ct]; in printPlaybackCpp() local
523 fprintf(f, "void rspr_%s(Context *con, ThreadIO *io) {\n", api->name); in printPlaybackCpp()
524 fprintf(f, " RS_CMD_%s cmd;\n", api->name); in printPlaybackCpp()
526 for (ct2=0; ct2 < api->paramCount; ct2++) { in printPlaybackCpp()
527 const VarType *vt = &api->params[ct2]; in printPlaybackCpp()
534 for (ct2=0; ct2 < api->paramCount; ct2++) { in printPlaybackCpp()
535 const VarType *vt = &api->params[ct2]; in printPlaybackCpp()
548 for (ct2=0; ct2 < api->paramCount; ct2++) { in printPlaybackCpp()
549 const VarType *vt = &api->params[ct2]; in printPlaybackCpp()
561 if (api->ret.typeName[0]) { in printPlaybackCpp()
563 printVarType(f, &api->ret); in printPlaybackCpp()
567 fprintf(f, " rsi_%s(", api->name); in printPlaybackCpp()
568 if (!api->nocontext) { in printPlaybackCpp()
571 for (ct2=0; ct2 < api->paramCount; ct2++) { in printPlaybackCpp()
572 const VarType *vt = &api->params[ct2]; in printPlaybackCpp()
573 if (ct2 > 0 || !api->nocontext) { in printPlaybackCpp()
580 for (ct2=0; ct2 < api->paramCount; ct2++) { in printPlaybackCpp()
581 const VarType *vt = &api->params[ct2]; in printPlaybackCpp()
587 for (ct2=0; ct2 < api->paramCount; ct2++) { in printPlaybackCpp()
588 const VarType *vt = &api->params[ct2]; in printPlaybackCpp()
597 if (api->ret.typeName[0]) { in printPlaybackCpp()
603 for (ct2=0; ct2 < api->paramCount; ct2++) { in printPlaybackCpp()
604 const VarType *vt = &api->params[ct2]; in printPlaybackCpp()
609 for (ct2=0; ct2 < api->paramCount; ct2++) { in printPlaybackCpp()
610 const VarType *vt = &api->params[ct2]; in printPlaybackCpp()