implement newOrNil, changes to stdlib

- newOrNil works like new, but sets the variable to nil
  if the heap allocation failed
- change stdlib to use newOrNil in openfile and openvolumeid
- changes to programs that use openvolumeid
This commit is contained in:
slederer 2025-08-31 23:30:40 +02:00
parent 165517a9c8
commit 14d6de059d
10 changed files with 68 additions and 48 deletions

View file

@ -193,7 +193,8 @@ Possible error codes from _IOResult_ are:
| 8 | IOReadOnly | file is readonly | |
| 9 | IOInvalidOp | invalid operation | |
| 10 | IOInvalidFormat | invalid format | when parsing numbers with _read_ |
| 11 | IOUserIntr | interrupted by user | program terminated by ^C, not visible from _IOResult_ |
| 11 | IONoMem | not enough memory | heap allocation failed inside the standard library, e.g. open() |
| 12 | IOUserIntr | interrupted by user | program terminated by ^C, not visible from _IOResult_ |
### Read, Readln and Line Input
In Turbo Pascal, using _read_ (and _readln_) from the console always waits until a complete line has been entered.