Changeset 217
- Timestamp:
- 06/30/2010 06:00:43 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
SHX/trunk/src/SeismicHandler/commands/echo.py
r194 r217 21 21 class echo(BaseCommand): 22 22 """ 23 command ECHO <text1>[;<text2>[;...;<textN>]] 23 A command for printing text on several output channels. Valid only for 24 script parsing, since python offers this function out-of-the-box. 25 26 Basic usage in scripting language 27 --------------------------------- 28 29 ECHO <text1>[;<text2>[;...;<textN>]] 24 30 25 31 Writes text to echo channel (set by ECHO_CH command). Default output … … 27 33 displayed, separated by blanks. 28 34 29 parameters: 35 Parameters 36 ---------- 30 37 31 <text1>, <text2>, ..., <textN> --- parameter type: string32 Text to be written to echo channel, parameters are separated by38 text1, text2 : string 39 Text(s) to be written to echo channel, parameters are separated by 33 40 blanks. 34 41 35 qualifiers: 42 Qualifiers 43 ---------- 36 44 37 /NO_LF45 NO_LF 38 46 Writes no line feed at the of the line. Next ECHO command 39 47 overwrites this one. 40 48 41 /NO_CRLF49 NO_CRLF 42 50 Writes no line feed and no carriage return at the end of the 43 51 line. Next ECHO text is appended to this one. 44 52 45 Examples: 53 Examples 54 -------- 46 55 47 ECHO THIS IS A TEST ! writes string "THIS IS A TEST" to48 ! the currently selected ECHO-file56 ``ECHO THIS IS A TEST`` : 57 Writes string "THIS IS A TEST" to the currently selected echo channel. 49 58 50 ECHO DISTANCE ^DISTANCE(2) ! writes string "DISTANCE " and value 51 ! of distance information of second trace 52 ! on display to the currently selected 53 ! ECHO-file 59 ``ECHO DISTANCE ^DISTANCE(2)`` : 60 Writes string "DISTANCE " and value of distance information of second 61 trace on display to the currently selected echo channel. 62 63 >>> import sys # In order to have some test routine, 64 >>> from StringIO import StringIO # we need to fetch the output channel. 65 >>> newout = StringIO() 66 >>> oldout, Settings.echo_channel = Settings.echo_channel, newout 67 >>> _ = echo("foo", "bar", NO_CRLF=True) # no line feed 68 >>> newout.getvalue() 69 'foo bar' 70 >>> _ = echo("qux") 71 >>> newout.getvalue()[:-1] # skip the line break 72 'foo bar qux' 73 >>> Settings.echo_channel = oldout # restore output channel 54 74 """ 55 75 … … 71 91 72 92 if __name__ == "__main__": 73 echo("test 2", "laal", NO_CRLF=True) 93 import doctest 94 doctest.testmod(exclude_empty=True)
Note: See TracChangeset
for help on using the changeset viewer.