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()
313 if (api->ret.typeName[0] || api->sync) { in printApiCpp()
318 if (hasInlineDataPointers(api)) { in printApiCpp()
322 } else if (api->ret.typeName[0]) { in printApiCpp()
324 printVarType(f, &api->ret); in printApiCpp()
337 if (api->direct) { in printApiCpp()
342 printFuncDecl(f, api, "RF_", 0, 0); in printApiCpp()
345 fprintf(f, " const uint32_t cmdID = RS_CMD_ID_%s;\n", api->name); in printApiCpp()
348 for (ct2=0; ct2 < api->paramCount; ct2++) { in printApiCpp()
349 const VarType *vt = &api->params[ct2]; in printApiCpp()
356 for (ct2=0; ct2 < api->paramCount; ct2++) { in printApiCpp()
357 const VarType *vt = &api->params[ct2]; in printApiCpp()
364 for (ct2=0; ct2 < api->paramCount; ct2++) { in printApiCpp()
365 const VarType *vt = &api->params[ct2]; in printApiCpp()
374 for (ct2=0; ct2 < api->paramCount; ct2++) { in printApiCpp()
375 const VarType *vt = &api->params[ct2]; in printApiCpp()
382 for (ct2=0; ct2 < api->paramCount; ct2++) { in printApiCpp()
383 const VarType *vt = &api->params[ct2]; in printApiCpp()
392 if (api->ret.typeName[0]) { in printApiCpp()
394 printVarType(f, &api->ret); in printApiCpp()
421 const ApiEntry * api = &apis[ct]; in printApiCpp() local
425 printFuncDecl(f, api, "rs", 0, 0); in printApiCpp()
428 if (api->ret.typeName[0]) { in printApiCpp()
431 fprintf(f, "s_CurrentTable->%s(", api->name); in printApiCpp()
433 if (!api->nocontext) { in printApiCpp()
437 for (ct2=0; ct2 < api->paramCount; ct2++) { in printApiCpp()
438 const VarType *vt = &api->params[ct2]; in printApiCpp()
439 if (ct2 > 0 || !api->nocontext) { in printApiCpp()
465 const ApiEntry * api = &apis[ct]; in printPlaybackCpp() local
468 if (api->direct) { in printPlaybackCpp()
472 fprintf(f, "void rsp_%s(Context *con, const void *vp, size_t cmdSizeBytes) {\n", api->name); in printPlaybackCpp()
473 …rintf(f, " const RS_CMD_%s *cmd = static_cast<const RS_CMD_%s *>(vp);\n", api->name, api->name); in printPlaybackCpp()
475 if (hasInlineDataPointers(api)) { in printPlaybackCpp()
477 fprintf(f, " if (cmdSizeBytes != sizeof(RS_CMD_%s)) {\n", api->name); in printPlaybackCpp()
483 if (api->ret.typeName[0]) { in printPlaybackCpp()
485 printVarType(f, &api->ret); in printPlaybackCpp()
488 fprintf(f, "rsi_%s(con", api->name); in printPlaybackCpp()
489 for (ct2=0; ct2 < api->paramCount; ct2++) { in printPlaybackCpp()
490 const VarType *vt = &api->params[ct2]; in printPlaybackCpp()
493 if (hasInlineDataPointers(api) && vt->ptrLevel) { in printPlaybackCpp()
502 if (hasInlineDataPointers(api)) { in printPlaybackCpp()
504 for (ct2=0; ct2 < api->paramCount; ct2++) { in printPlaybackCpp()
505 if (api->params[ct2].ptrLevel) { in printPlaybackCpp()
506 fprintf(f, " totalSize += cmd->%s_length;\n", api->params[ct2].name); in printPlaybackCpp()
510 … fprintf(f, " if ((totalSize != 0) && (cmdSizeBytes == sizeof(RS_CMD_%s))) {\n", api->name); in printPlaybackCpp()
513 } else if (api->ret.typeName[0]) { in printPlaybackCpp()
515 } else if (api->sync || needFlush) { in printPlaybackCpp()
523 const ApiEntry * api = &apis[ct]; in printPlaybackCpp() local
526 fprintf(f, "void rspr_%s(Context *con, ThreadIO *io) {\n", api->name); in printPlaybackCpp()
527 fprintf(f, " RS_CMD_%s cmd;\n", api->name); in printPlaybackCpp()
529 for (ct2=0; ct2 < api->paramCount; ct2++) { in printPlaybackCpp()
530 const VarType *vt = &api->params[ct2]; in printPlaybackCpp()
537 for (ct2=0; ct2 < api->paramCount; ct2++) { in printPlaybackCpp()
538 const VarType *vt = &api->params[ct2]; in printPlaybackCpp()
551 for (ct2=0; ct2 < api->paramCount; ct2++) { in printPlaybackCpp()
552 const VarType *vt = &api->params[ct2]; in printPlaybackCpp()
564 if (api->ret.typeName[0]) { in printPlaybackCpp()
566 printVarType(f, &api->ret); in printPlaybackCpp()
570 fprintf(f, " rsi_%s(", api->name); in printPlaybackCpp()
571 if (!api->nocontext) { in printPlaybackCpp()
574 for (ct2=0; ct2 < api->paramCount; ct2++) { in printPlaybackCpp()
575 const VarType *vt = &api->params[ct2]; in printPlaybackCpp()
576 if (ct2 > 0 || !api->nocontext) { in printPlaybackCpp()
583 for (ct2=0; ct2 < api->paramCount; ct2++) { in printPlaybackCpp()
584 const VarType *vt = &api->params[ct2]; in printPlaybackCpp()
590 for (ct2=0; ct2 < api->paramCount; ct2++) { in printPlaybackCpp()
591 const VarType *vt = &api->params[ct2]; in printPlaybackCpp()
600 if (api->ret.typeName[0]) { in printPlaybackCpp()
606 for (ct2=0; ct2 < api->paramCount; ct2++) { in printPlaybackCpp()
607 const VarType *vt = &api->params[ct2]; in printPlaybackCpp()
612 for (ct2=0; ct2 < api->paramCount; ct2++) { in printPlaybackCpp()
613 const VarType *vt = &api->params[ct2]; in printPlaybackCpp()