-- Overture STANDARD LIBRARY: INPUT/OUTPUT -- -------------------------------------------- -- Version 1.0.0 -- -- Standard library for the Overture Interpreter. When the interpreter -- evaluates the preliminary functions/operations in this file, -- corresponding internal functions is called instead of issuing a run -- time error. Signatures should not be changed, as well as name of -- module (VDM-SL) or class (VDM++). Pre/post conditions is -- fully user customizable. -- Don't care's may NOT be used in the parameter lists. -- -- The in/out functions will return false if an error occurs. In this -- case an internal error string will be set (see 'ferror'). -- -- File path: -- * An absolute path is accepted and used as specified. -- * A relative path is relative to the debugger or if running in the -- Overture IDE relative to the project root. --
types
/** *Thefiledirectiveusedinin/outfunctions.
*/ public filedirective = <start>|<append>
functions
/** *WriteVDMvalueinASCIIformattotheconsole. * *@paramvaltheVDMvaluetobewritten *@returntrueifsuccessfulelsefalse
*/ publicstatic writeval[@p]: @p -> bool
writeval(val)== is not yetspecified;
/** *ReadVDMvalueinASCIIformatfromfile.Thetypewhichshouldbereadmustbe *specifiedasfreadval[seqofchar](...)whencallingthefunction. * *@paramfilenamethenameofthefile *@returnmk_(success,@p)ifsuccessfulsuccesswillbe *settotrueelsefalse.@pwillholdnilifunsuccessfulorthevalueread.
*/ publicstatic freadval[@p]:seq1ofchar -> bool * [@p]
freadval(filename) == is not yetspecified postlet mk_(b,t) = RESULT in not b => t = nil;
/** *Writetexttofilelike<code>echo</code>. * *@paramfilenamethenameofthefile *@paramtextthetexttowritetobewritten. *@paramfdirifnilor<start>thenitwilloverwriteanexistingfile, *else<append>willappendoutputtotheexistingfile. *@returntrueifsuccessfulelsefalse
*/ public fecho: seqofchar * seqofchar * [filedirective] ==> bool
fecho (filename,text,fdir) == is not yetspecified pre filename = "" <=> fdir = nil;
/** *Returnsthelasterrorwhichmayhaveoccurredbyanyoftheio/outfunctions * *@returnthelasterrormessage
*/ public ferror:() ==> seqofchar
ferror () == is not yetspecified;
-- New simplified format printing operations
/** *PrintsanyVDMvaluetotheconsole * *@paramargaVDMvalueofanytype
*/ publicstatic print: ? ==> ()
print(arg) == is not yetspecified;
/** *PrintsanyVDMvaluetotheconsoleasanewline * *@paramargaVDMvalueofanytype
*/ publicstatic println: ? ==> ()
println(arg) == is not yetspecified;