#[unsafe(no_mangle)]pub unsafe extern "C" fn patch_seq_file_for_each_line_plus(
stack: Stack,
) -> StackExpand description
Process each line of a file with a quotation
Stack effect: ( String Quotation – String Int )
Opens the file, calls the quotation with each line (including newline), then closes the file.
Returns:
- Success: ( “” 1 )
- Error: ( “error message” 0 )
The quotation should have effect ( String – ), receiving each line and consuming it. Empty files return success without calling the quotation.
§Line Ending Normalization
Line endings are normalized to \n regardless of platform. Windows-style
\r\n endings are converted to \n. This ensures consistent behavior
when processing files across different operating systems.
§Example
"data.txt" [ string-chomp process-line ] file-for-each-line+
if
"Done processing" write_line
else
"Error: " swap string-concat write_line
then§Safety
stackmust be a valid, non-null stack pointer- Top of stack must be a Quotation or Closure
- Second on stack must be a String (file path)