Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add _no_safe_exit to compiler options #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/div/divc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,7 @@ int comprueba_id;
int comprueba_null;
int hacer_strfix;
int optimizar;
int safe_exit;

//�����������������������������������������������������������������������������

Expand Down Expand Up @@ -1067,6 +1068,12 @@ void compilar(void) {
mem[0]+=1024;
#endif

// A�adimos el flag que permite al int�rprete
// ignorarr alt_x y ctrl_esc
if (!safe_exit) {
mem[0]+=256;
}

if (program_type==1) if ((f=fopen("install\\setup.ovl","wb"))!=NULL) {
fwrite(div_stub,1,602,f);
// fwrite(mem,4,imem,f); fwrite(loc,4,iloc,f);
Expand Down Expand Up @@ -3155,6 +3162,7 @@ void sintactico (void) {
comprueba_null=1;
hacer_strfix=1;
optimizar=1;
safe_exit=1;

if (pieza==p_compiler_options) {
lexico();
Expand Down Expand Up @@ -3218,6 +3226,10 @@ void sintactico (void) {
lexico();
comprueba_null=0;
break;
case 12: // _no_safe_exit
lexico();
safe_exit=0;
break;
default:
c_error(0,138);
break;
Expand Down
8 changes: 7 additions & 1 deletion src/div32run/i.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ int dll_loaded=0;

int trace_program=0;
int ignore_errors=0;
int safe_exit=1;

int old_dump_type;
int old_restore_type;
Expand Down Expand Up @@ -481,7 +482,11 @@ extern int alt_x;
void interprete (void)
{
inicializacion();
while (procesos && !(kbdFLAGS[_ESC] && kbdFLAGS[_L_CTRL]) && !alt_x) {
while (procesos) {
if (safe_exit && ((kbdFLAGS[_ESC] && kbdFLAGS[_L_CTRL]) || alt_x))
{
break;
}
error_vpe=0;
frame_start();
#ifdef DEBUG
Expand Down Expand Up @@ -1349,6 +1354,7 @@ void main(int argc,char * argv[]) {
free(ptr);

if ((mem[0]&128)==128) { trace_program=1; mem[0]-=128; }
if ((mem[0]&256)==256) { safe_exit=0; mem[0]-=256; }
if ((mem[0]&512)==512) { ignore_errors=1; mem[0]-=512; }
demo=0;
if ((mem[0]&1024)==1024) {
Expand Down
1 change: 1 addition & 0 deletions system/ltobj.def
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const _no_optimization=8
const _no_range_check=9
const _no_id_check=10
const _no_null_check=11
const _no_safe_exit=12

const seek_set=0
const seek_cur=1
Expand Down