polserver/pol-core/support/scripts/file.em
Kevin Eady 3ccf701ce9
Format testsuite scripts, pol-core support modules (#713)
* Format escript testsuite

* Manual formatting for escript testsuite
- Add format-off to places where formatter does what it should, but we don't like the results
- Manually change places where formatter outputs weird things _without_ format-off, so next format-all would show changes if not fixed

* Update .err files; add update_err.py helper script

Use the format `:line:col: message` for all .err file checks. This
allows us to change the file names without needing to edit the .err
contents.

Note that `in/inc0{1,2}.err` need have error messages between POSIX and
Windows, so their messages are a bit more "generic" than the other errs.

* Format pol testsuite

* Manual formatting for pol testsuite

* Format pol-core modules

* Manual formatting for pol-core modules

* Additional format pol-core modules

Use FormatterLineWidth=10000 since module functions must be on one line
because of the parse_modules target

* Address Discord comments

- Support multi-line module function declarations in parse_modules

* Format on df07831
2024-10-04 10:29:55 +02:00

50 lines
1.7 KiB
Text

////////////////////////////////////////////////////////////////
//
// CONSTANTS
//
////////////////////////////////////////////////////////////////
// format-off
// LogToFile constants
const LOG_DATETIME := 1; // log Core-Style DateTimeStr in front of log entry
// BinaryFile constants
const OPENMODE_IN := 0x01; // (input) Allow input operations on the stream
const OPENMODE_OUT := 0x02; // (output) Allow output operations on the stream
const OPENMODE_ATE := 0x04; // (at end) Set the stream's position indicator to the end of the stream on opening
const OPENMODE_APP := 0x08; // (append) Set the stream's position indicator to the end of the stream before each output operation
const OPENMODE_TRUNC := 0x10; // (truncate) Any current content is discarded, assuming a length of zero on opening
const SEEKDIR_BEG := 0x00; // beginning of sequence
const SEEKDIR_CUR := 0x01; // current position within sequence
const SEEKDIR_END := 0x02; // end of sequence
const LITTLE_ENDIAN := 0x00;
const BIG_ENDIAN := 0x01;
// ListDirectory constants
const LISTDIR_LIST_DIRS := 0x1;
const LISTDIR_DONT_LIST_DIRS := 0x0;
const LISTDIR_NO_FILES := "";
const LISTDIR_ALL_FILES := "*";
// format-on
////////////////////////////////////////////////////////////////
//
// FUNCTIONS
//
////////////////////////////////////////////////////////////////
FileExists( filename );
ReadFile( filename );
WriteFile( filename, textcontents );
AppendToFile( filename, textlines );
LogToFile( filename, line, flags := 0 );
OpenBinaryFile( filename, mode := OPENMODE_IN, endian := LITTLE_ENDIAN );
CreateDirectory( dirname );
ListDirectory( dirname, extension := LISTDIR_ALL_FILES, listdirs := LISTDIR_DONT_LIST_DIRS );
OpenXMLFile( filename );
CreateXMLFile();