ORIGIN 'betaenv'; LIB_DEF 'textUtils' '../lib'; INCLUDE 'numberio' (* * COPYRIGHT * Copyright (C) Mjolner Informatics, 1996 * All rights reserved. *) --- streamLib: attributes --- getBoolean: (# trueValue:< (# value: ^text do 'true'->value[]; INNER exit value[] #); falseValue:< (# value: ^text do 'false'->value[]; INNER exit value[] #); syntaxError:< streamException (# do 'getBoolean: Syntax Error - looking at: "'->msg.append; t[]->msg.puttext; '"'->msg.putline; INNER #); value: @boolean; t: ^(* private *)text do getAtom->t[]; (if true // t[]->(trueValue).equalNCS then true->value // t[]->(falseValue).equalNCS then false->value else syntaxError if); INNER getBoolean exit value #); putBoolean: (# trueValue:< (# value: ^text do 'true'->value[]; INNER exit value[] #); falseValue:< (# value: ^text do 'false'->value[]; INNER exit value[] #); value: @boolean enter value do (if value then trueValue->puttext else falseValue->puttext if); INNER putBoolean #); --- lib: attributes --- getBoolean: keyboard.getBoolean (# do INNER getBoolean #); putBoolean: screen.putBoolean (# do INNER putBoolean #); --- textLib: attributes --- set: (* makes THIS( stream) contain only the character: ch *) (# ch: @char enter ch do INNER set; clear; ch->put #); setText: (* makes THIS( stream) contain only the text contained in 't' *) (# t: ^text enter t[] do INNER setText; clear; t[]->puttext #); setInt: (* makes THIS( stream) contain only the textual representation of * the integer 'i' *) (# i: @integer enter i do INNER setInt; clear; i->putint #); setBased: (* makes THIS( stream) contain only the textual representation of * the number 'value' in base 'base' *) (# base, value: @integer enter (base, value) do INNER setBased; clear; (base,value)->putBased #); setReal: (* makes THIS( stream) contain only the textual representation of * the real number 'r' *) (# r: @real enter r do INNER setReal; clear; r->putreal #); setBoolean: (* makes THIS( stream) contain only the textual representation of * the boolean 'value' (i.e. either 'true' og 'false') *) (# value: @boolean enter value do INNER setBoolean; clear; value->putBoolean #)
13.18 TextUtils Interface | © 1990-2002 Mjølner Informatics |
[Modified: Saturday January 22nd 2000 at 0:18]
|