📄 hpmods.c
字号:
/* "p2c", a Pascal to C translator. Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation. Author's address: daveg@synaptics.com.This program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation (any version).This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; see the file COPYING. If not, write tothe Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */#define PROTO_HPMODS_C#include "trans.h"/* FS functions */Static Stmt *proc_freadbytes(){ Expr *ex, *ex2, *vex, *fex; Type *type; if (!skipopenparen()) return NULL; fex = p_expr(tp_text); if (!skipcomma()) return NULL; vex = p_expr(NULL); if (!skipcomma()) return NULL; ex2 = p_expr(tp_integer); skipcloseparen(); type = vex->val.type; ex = makeexpr_bicall_4("fread", tp_integer, makeexpr_addr(vex), convert_size(type, ex2, "FREADBYTES"), makeexpr_long(1), filebasename(copyexpr(fex))); if (checkeof(fex)) { ex = makeexpr_bicall_2(name_SETIO, tp_void, makeexpr_rel(EK_EQ, ex, makeexpr_long(1)), makeexpr_long(30)); } return wrapopencheck(makestmt_call(ex), fex);}Static Stmt *proc_fwritebytes(){ Expr *ex, *ex2, *vex, *fex; Type *type; if (!skipopenparen()) return NULL; fex = p_expr(tp_text); if (!skipcomma()) return NULL; vex = p_expr(NULL); if (!skipcomma()) return NULL; ex2 = p_expr(tp_integer); skipcloseparen(); type = vex->val.type; ex = makeexpr_bicall_4("fwrite", tp_integer, makeexpr_addr(vex), convert_size(type, ex2, "FWRITEBYTES"), makeexpr_long(1), filebasename(copyexpr(fex))); if (checkfilewrite) { ex = makeexpr_bicall_2(name_SETIO, tp_void, makeexpr_rel(EK_EQ, ex, makeexpr_long(1)), makeexpr_long(3)); } return wrapopencheck(makestmt_call(ex), fex);}/* SYSGLOBALS */Static void setup_sysglobals(){ Symbol *sym; sym = findsymbol("SYSESCAPECODE"); if (sym->mbase) strchange(&sym->mbase->name, name_ESCAPECODE); sym = findsymbol("SYSIORESULT"); if (sym->mbase) strchange(&sym->mbase->name, name_IORESULT);}void hpmods(name, defn)char *name;int defn;{ if (!strcmp(name, "FS")) { makespecialproc("freadbytes", proc_freadbytes); makespecialproc("fwritebytes", proc_fwritebytes); } else if (!strcmp(name, "SYSGLOBALS")) { setup_sysglobals(); }}/* End. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -