MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / PrintCode

Function PrintCode

extlibs/lua/src/luac.c:335–663  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

PrintFunctionFunction · 0.85

Calls 3

luaG_getfunclineFunction · 0.85
printfFunction · 0.85
PrintConstantFunction · 0.85

Tested by

no test coverage detected