static mlval ml_deliver_function(mlval argument) { declare_root(&argument, 1); gc_collect_all(); /* Do a full gc before forking */ retract_root(&argument); return deliverFn(argument); }
static mlval ml_save_image(mlval argument) { mlval global, filename; /* license_edition is a global C enum */ if ((license_edition == PERSONAL) || act_as_free) { display_simple_message_box( "Saving images is not enabled in the Personal edition of MLWorks"); return MLUNIT; } filename = FIELD(argument, 0); image_continuation = FIELD(argument, 1); declare_root(&filename, 1); global = global_pack(0); /* 0 = not delivery */ declare_root(&global, 1); { mlval old_message_level = MLSUB(gc_message_level,0); MLUPDATE(gc_message_level,0,MLINT(-1)); gc_collect_all(); MLUPDATE(gc_message_level,0,old_message_level); } argument = allocate_record(2); FIELD(argument, 0) = filename; FIELD(argument, 1) = global; retract_root(&filename); retract_root(&global); if(image_save(argument) == MLERROR) switch(errno) { case EIMPL: exn_raise_string(perv_exn_ref_save, "Image save not implemented"); case EIMAGEWRITE: exn_raise_string(perv_exn_ref_save, "Error writing opened image file"); case EIMAGEOPEN: exn_raise_string(perv_exn_ref_save, "Unable to open image file"); default: exn_raise_string(perv_exn_ref_save, "Unexpected error from image_save()"); } argument = image_continuation; image_continuation = MLUNIT; return(argument); }
static mlval ml_deliver_function(mlval argument) { if ((license_edition == PERSONAL) || act_as_free) { display_simple_message_box( "Delivering executables is not enabled in the Personal edition of MLWorks"); /* exn_raise_string(perv_exn_ref_save, "Delivery not enabled for this edition"); */ return MLUNIT; } declare_root(&argument, 1); gc_collect_all(); /* Do a full gc before forking */ retract_root(&argument); return deliverFn(argument); }
static mlval ml_save_image(mlval argument) { mlval global, filename; filename = FIELD(argument, 0); image_continuation = FIELD(argument, 1); declare_root(&filename, 1); global = global_pack(0); /* 0 = not delivery */ declare_root(&global, 1); { mlval old_message_level = MLSUB(gc_message_level,0); MLUPDATE(gc_message_level,0,MLINT(-1)); gc_collect_all(); MLUPDATE(gc_message_level,0,old_message_level); } argument = allocate_record(2); FIELD(argument, 0) = filename; FIELD(argument, 1) = global; retract_root(&filename); retract_root(&global); if(image_save(argument) == MLERROR) switch(errno) { case EIMPL: exn_raise_string(perv_exn_ref_save, "Image save not implemented"); case EIMAGEWRITE: exn_raise_string(perv_exn_ref_save, "Error writing opened image file"); case EIMAGEOPEN: exn_raise_string(perv_exn_ref_save, "Unable to open image file"); default: exn_raise_string(perv_exn_ref_save, "Unexpected error from image_save()"); } argument = image_continuation; image_continuation = MLUNIT; return(argument); }
static mlval ml_collect_all(mlval unit) { gc_collect_all(); return MLUNIT; }