Re: [BLACKBOX] output with GP-CP

From: [at]} <Chris>
Date: Fri, 22 Oct 2010 23:06:43 +1030

----boundary-LibPST-iamunique-2111234890_-_-
Content-type: text/plain

> -----Original Message-----
> From: BlackBox [mailto:BLACKBOX{([at]})nowhere.xy
> gunnar bernhardt (VDI)
> Sent: Friday, 22 October 2010 8:21 PM
> To: BLACKBOX{([at]})nowhere.xy
> Subject: [BLACKBOX] output with GP-CP
>
> (* ---- BEGIN the ugly bit ---- *)
> Console.WriteString( "- ->" );
> IF args.get_Severity() = System_Xml_Schema.XmlSeverityType.Error
> THEN
> Console.WriteString( "Error" )
> ELSE
> Console.WriteString( "Warning" )
> END;
> Console.WriteString( " at " + excErr.get_SourceUri() + " (" );
> Console.WriteInt( excErr.get_LineNumber(), -1 );
> Console.WriteString( "," );
> Console.WriteInt( excErr.get_LinePosition(), -1 );
> Console.WriteString( ")" ); Console.WriteLn();
> (* ---- END the ugly bit ---- *)
>
> Apart from the additional space (which I would not mind) the output
> format "- ->{0} at {1} ({2},{3})" has here been split into several
> lines of code, which makes it a lot harder to read in my opinion.
>
> Did I miss something obvious?
> Can you perhaps think of a solution more elegant?
>

For an initial attack I'd convert everything to strings before outputting
the message e.g.

(* untested!!! *)
PROCEDURE HandleError( sender: Sys.Object; args:
System_Xml_Schema.ValidationEventArgs );
VAR
  excErr: System_Xml_Schema.XmlSchemaException;
  lineNo, linePos, uri, msg: Sys.String;
BEGIN
  excErr := args.get_Exception();
  uri := excErr.get_SourceUri();
  lineNo := Sys.Convert.ToString(excErr.get_LineNumber());
  linePos := Sys.Convert.ToString(excErr.get_LinePosition());
  IF args.get_Severity() = System_Xml_Schema.XmlSeverityType.Error
  THEN
    msg := "- -> Error"
  ELSE
    msg := "- -> Warning"
  END;
  msg := msg + " at " + uri + " (" + lineNo + "," + linePos + ")";
  Console.WriteString(msg);
  Console.WriteLn();

Regards,
Chris Burrows
CFB Software
http://www.cfbsoftware.com


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-2111234890_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwID4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS1c
cGFyDQo+IEZyb206IEJsYWNrQm94IFttYWlsdG86QkxBQ0tCT1hATElTVFMuT0JFUk9OLkNIXSBP
biBCZWhhbGYgT2YgXHBhcg0KPiBndW5uYXIgYmVybmhhcmR0IChWREkpXHBhcg0KPiBTZW50OiBG
cmlkYXksIDIyIE9jdG9iZXIgMjAxMCA4OjIxIFBNXHBhcg0KPiBUbzogQkxBQ0tCT1hATElTVFMu
T0JFUk9OLkNIXHBhcg0KPiBTdWJqZWN0OiBbQkxBQ0tCT1hdIG91dHB1dCB3aXRoIEdQLUNQXHBh
cg0KPiBccGFyDQo+ICAgKCogLS0tLSBCRUdJTiB0aGUgdWdseSBiaXQgLS0tLSAqKVxwYXINCj4g
ICBDb25zb2xlLldyaXRlU3RyaW5nKCAiLSAtPiIgKTtccGFyDQo+ICAgSUYgYXJncy5nZXRfU2V2
ZXJpdHkoKSA9IFN5c3RlbV9YbWxfU2NoZW1hLlhtbFNldmVyaXR5VHlwZS5FcnJvclxwYXINCj4g
IFRIRU4gXHBhcg0KPiAgICAgQ29uc29sZS5Xcml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5Xcml0ZVN0cmluZyhtc2cpO1xwYXINCiAgQ29uc29sZS5X
cml0ZUxuKCk7XHBhcg0KXHBhcg0KUmVnYXJkcyxccGFyDQpDaHJpcyBCdXJyb3dzXHBhcg0KQ0ZC
IFNvZnR3YXJlXHBhcg0KaHR0cDovL3d3dy5jZmJzb2Z0d2FyZS5jb21ccGFyDQpccGFyDQpccGFy
DQotLS0tXHBhcg0KVG8gdW5zdWJzY3JpYmUsIHNlbmQgYSBtZXNzYWdlIHdpdGggYm9keSAiU0lH
Tk9GRiBCTEFDS0JPWCIgdG8gTElTVFNFUlZATElTVFMuT0JFUk9OLkNIXH19AEJMQQ==
----boundary-LibPST-iamunique-2111234890_-_---
Received on Fri Oct 22 2010 - 14:36:43 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:29 UTC