--- parser3/src/classes/op.C 2026/10/22 20:45:14 1.287 +++ parser3/src/classes/op.C 2026/10/31 17:03:23 1.291 @@ -23,7 +23,7 @@ #include "syslog.h" #endif -volatile const char * IDENT_OP_C="$Id: op.C,v 1.287 2026/10/22 20:45:14 moko Exp $"; +volatile const char * IDENT_OP_C="$Id: op.C,v 1.291 2026/10/31 17:03:23 moko Exp $"; // defines @@ -172,7 +172,16 @@ static void _process(Request& r, MethodP Temp_class_replace class_replace(r, allow_class_replace); - r.use_buf(*target_class, source.untaint_cstr(String::L_PARSER_CODE, r.connection(false)), main_alias, processe_file_no, line_no_alias_offset); + const char* code=source.untaint_cstr(String::L_PARSER_CODE, r.connection(false)); + // compiler knows only \n (files are normalized on load) + if(strchr(code, '\r')) { + size_t length=strlen(code); + char* normalized=pa_strdup(code, length); + fix_line_breaks(normalized, length); + code=normalized; + } + + r.use_buf(*target_class, code, main_alias, processe_file_no, line_no_alias_offset); // main_method main_method=target_class->get_method(main_method_name); @@ -487,7 +496,8 @@ public: arequest.set_skip(Request::SKIP_NOTHING); } ~Temp_skip() { - if(frequest.get_skip() == Request::SKIP_NOTHING) + // the interruption is not restored: if it is not set now, it is already thrown + if(frequest.get_skip() == Request::SKIP_NOTHING && saved_skip != Request::SKIP_INTERRUPTED) frequest.set_skip(saved_skip); } }; @@ -509,7 +519,7 @@ static Try_catch_result try_catch(Reques try { result.processed_code=body_code(r, info); - } catch(const Recursion_limit_exception&) { + } catch(const Uncatchable_exception&) { rethrow; } catch(const Exception& e) { size_t trace_bottom=r.exception_trace.bottom_index(); @@ -806,7 +816,7 @@ static void _try_operator(Request& r, Me try{ // process try and catch code result=try_catch(r, process_try_body_code, &body_code, &catch_code); - } catch(const Recursion_limit_exception&) { + } catch(const Uncatchable_exception&) { rethrow; } catch(...){ // process finally code but ignore the result @@ -863,8 +873,11 @@ static void _throw_operator(Request&, Me static void _sleep_operator(Request& r, MethodParams& params) { double seconds=params.as_double(0, "seconds must be double", r); - if(seconds>0) - pa_sleep((int)trunc(seconds), (int)trunc((seconds-trunc(seconds))*1000000)); + // sleeping by ticks to notice the interruption + for(double tick; seconds>0 && !r.get_skip(); seconds-=tick){ + tick=seconds<0.1 ? seconds : 0.1; + pa_sleep(0, (unsigned long)(tick*1000000)); + } } static void _a_operator(Request& r, MethodParams& params) {