MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / PrintCode

Function PrintCode

lib/lua/src/luac.c:334–662  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332#define ISK (isk ? "k" : "")
333
334static void PrintCode(const Proto* f)
335{
336 const Instruction* code=f->code;
337 int pc,n=f->sizecode;
338 for (pc=0; pc<n; pc++)
339 {
340 Instruction i=code[pc];
341 OpCode o=GET_OPCODE(i);
342 int a=GETARG_A(i);
343 int b=GETARG_B(i);
344 int c=GETARG_C(i);
345 int ax=GETARG_Ax(i);
346 int bx=GETARG_Bx(i);
347 int sb=GETARG_sB(i);
348 int sc=GETARG_sC(i);
349 int sbx=GETARG_sBx(i);
350 int isk=GETARG_k(i);
351 int line=luaG_getfuncline(f,pc);
352 printf("\t%d\t",pc+1);
353 if (line>0) printf("[%d]\t",line); else printf("[-]\t");
354 printf("%-9s\t",opnames[o]);
355 switch (o)
356 {
357 case OP_MOVE:
358 printf("%d %d",a,b);
359 break;
360 case OP_LOADI:
361 printf("%d %d",a,sbx);
362 break;
363 case OP_LOADF:
364 printf("%d %d",a,sbx);
365 break;
366 case OP_LOADK:
367 printf("%d %d",a,bx);
368 printf(COMMENT); PrintConstant(f,bx);
369 break;
370 case OP_LOADKX:
371 printf("%d",a);
372 printf(COMMENT); PrintConstant(f,EXTRAARG);
373 break;
374 case OP_LOADFALSE:
375 printf("%d",a);
376 break;
377 case OP_LFALSESKIP:
378 printf("%d",a);
379 break;
380 case OP_LOADTRUE:
381 printf("%d",a);
382 break;
383 case OP_LOADNIL:
384 printf("%d %d",a,b);
385 printf(COMMENT "%d out",b+1);
386 break;
387 case OP_GETUPVAL:
388 printf("%d %d",a,b);
389 printf(COMMENT "%s",UPVALNAME(b));
390 break;
391 case OP_SETUPVAL:

Callers 1

PrintFunctionFunction · 0.85

Calls 2

luaG_getfunclineFunction · 0.85
PrintConstantFunction · 0.85

Tested by

no test coverage detected