⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asm_inst.c

📁 prolog 人工智能语言的解释期
💻 C
字号:
#define OBJ_INIT initializer_fct#include "engine_pl.h"#include "mach.h"#define YY(k) Y(E,k)extern unsigned var;extern void *label;long v1[100];static long v2[100];extern long v3[100];void foo();void foo1();void pl_call1();int x, y;extern long foreign_long[];extern double foreign_double[];/* to define Asm_Start() *//* to define Code_Start() (global/not global) and Code_Stop() */voidTRANS_code_start_global(){}static voidTRANS_code_start_non_global(){}/* to define Pl_Jump() */voidTRANS_pl_jump(){  M_Direct_Goto(foo1);_foo1:;}/* to define Pl_Call() */voidTRANS_pl_call(){  CP = (CodePtr) pl_call1;  M_Direct_Goto(foo);#ifdef M_ix86_win32_foo:;#else  asm("pl_call1:");#endif}/* to define Pl_Fail() */voidTRANS_pl_fail(){  M_Indirect_Goto(ALTB(B));}/* to define Pl_Ret() */voidTRANS_pl_ret(){  M_Indirect_Goto(CP);}/* to define Jump() */voidTRANS_jump(){  if (x < 3)    {      bar(x);      goto a;    }  x++;a:;}/* to define Move_From/To_Reg_X/Y() */voidTRANS_move_x_to_x(){  X(3) = X(5);}voidTRANS_move_x_to_y(){  YY(10) = X(2);}voidTRANS_move_y_to_x(){  X(0) = YY(3);}voidTRANS_move_y_to_y(){  YY(2) = YY(4);}/* to define Call_C_Start() + Call_C_Arg()... + Call_C_Stop() */voidTRANS_call_c(void){/*  &label,var,int, double,         string */  bar(foo, var, 12, 4098, -4095, (double) 1.20e-10, "this is a string",      "a\14b");  /* v(index) */  bar1(v1[2], v1[0], &v1[12], v2[2], v2[0], &v2[4]);  bar1(v3[4], &v3[2], v3[0]);  /* regs / &regs */  bar2(X(0), &X(4), YY(0), &YY(12));}voidTRANS_call_c_lot_of_args(void){/*  &label,var,int, double,         string */  bar(3, 4, 5, 6, 7, 8, 9, 10, foo, var, 12, 4098, -4095, (double) 1.20e-10,      "this is a string", "a\14b");  /* regs / &regs */  bar1(0, 0, 0, 0, 0, 0, X(2), &X(4), YY(0), &YY(12));}voidTRANS_call_c_foreign(void){  bar(foreign_long[0], foreign_long[4], &foreign_long[0], &foreign_long[8]);  bar(foreign_double[0], foreign_double[4], &foreign_double[0],      &foreign_double[8]);}/* to define Jump_Ret() */voidTRANS_jump_ret(){#if defined(M_ix86_win32)  register long adr = (long) bar(12, "toto");  _asm  {  jmp adr}#else  goto *bar(12, "toto");#endif}/* to define Fail_Ret() */voidTRANS_fail_ret(){  if (test(1, 2, 3) == 0)    goto a;  x++;a:;}/* to define Move_Ret_To_Mem() */voidTRANS_move_ret_to_mem(){  var = bar(3);  v1[4096] = bar(15);}/* to define Move_Ret_To_Reg_X() */voidTRANS_move_ret_to_reg_x(){  X(4) = bar(3);}/* to define Move_Ret_To_Reg_Y() */voidTRANS_move_ret_to_reg_y(){  YY(2) = bar(3);}/* to define Move_Ret_To_Foreign_L() */voidTRANS_move_ret_to_foreign_l(){  foreign_long[123] = bar(3);}/* to define Move_Ret_To_Foreign_D() */voidTRANS_move_ret_to_foreign_d(){  double bard(void);  foreign_double[123] = bard();}/* to define Cmp_Ret_And_Int() */voidTRANS_cmp_ret_and_int(){  if (bar(foo) == 0)		/* case ret = 0 */    goto a;  if (bar(foo) == 12345678)	/* case ret !- 0 */    goto a;  x++;a:;}/* to define Jump_If_Equal() */voidTRANS_jump_if_equal(){  if (x == y)    goto a;  x++;a:;}/* to define Jump_If_Greater() *//* maybe the C compiler does not generate a jg but a jl, reverse if needed */voidTRANS_jump_if_greater(){  if (x > 12)    goto a;  if (y > x)    goto a;  x++;a:  foo(1);}/* to define C_Ret() */voidTRANS_c_ret(){}/* to define Dico_String_Start() + Dico_String() + Dico_String_Stop() *//* see definitions of strings in the asm file produced                */voidTRANS_dico_string(){  bar("str1", "str2", "str3", "str\r\tend\n", "str\019toto");}/* to define Dico_Long_Start() + Dico_Long() + Dico_Long_Stop()         *//* see definitions of longs in the asm file produced (global/not global)*/static long long1;static long long1b = 0;static long long2 = 100;long long3;long long4 = 128;static long local_array[128];long global_array[128];/* to define Data_Start() + Data_Stop *//* between obj_chain_start and obj_chain_stop */static voidinitializer_fct(){}# if 0/* this should not be useful */intsee_switch(){  int y;  int x = bar();  if (x == 10)    y += 11;  if (x > 10)    y += 12;  if (x < 10)    y += 13;  if (x == 0)    y += 1;  if (x > 0)    y += 2;  if (x < 0)    y += 3;  return y;}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -