|
Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.atnf.csiro.au/computing/software/gipsy/srvreq/example.html
Дата изменения: Unknown Дата индексирования: Fri Jan 16 23:07:43 2009 Кодировка: Поисковые слова: http astrokuban.info astrokuban |
Sample GIPSY task source
To compile and run this program, save the text of this page to the file example.shl; using a text editor remove the text that precedes and follows the program, and then compile the program using:
p example.shl
Then start GIPSY and run the task ``example''.
PROGRAM EXAMPLE1
CHARACTER*80 MESSAGE
INTEGER ARRAY(10)
INTEGER I
INTEGER DEFAULT
INTEGER USERINT, USERTEXT, USERREAL
REAL H0
N Get in touch with HERMES
CALL INIT
CALL ANYOUT( 1, ' This message is for the screen only ' )
CALL ANYOUT( 2, ' This message is for the log file only ' )
CALL ANYOUT( 1+2, ' This message to screen AND log file ' )
CALL ANYOUT( 8, ' This message is not displayed in expert mode ' )
CALL ANYOUT( 16, ' This message is only displayed in test mode ' )
N Set default level to no default
DEFAULT = 0
N Get an integer from the user
NEL = USERINT( ARRAY, 10, DEFAULT, 'INT=', 'Type some integers' )
N Thanx
CALL ANYOUT( 1, ' Thank you very much for this input ' )
N Prepare message
WRITE(MESSAGE,'('' Values are:'',10(I4,1X:))') (ARRAY(I),I=1,NEL)
N Send message to HERMES
CALL ANYOUT( 3, MESSAGE )
N Display what we are doing
CALL STATUS( 'Now I will count from 1 to 1000000 ' )
I = 0
WHILE (I .LT. 1000000)
I = I + 1
CWHILE
N Prepare default
MESSAGE = 'JURJEN'
N Allow default
DEFAULT = 1
N Now ask user his name
NEL = USERTEXT( MESSAGE, DEFAULT, 'NAME=', 'Enter your name ['//
# MESSAGE(1:6)//']' )
N Was default used ?
IF (NEL .EQ. 0)
THEN
N Number of characters in default name
NEL = 6
CIF
N Demonstrate use of error messages
IF (MESSAGE(:4) .EQ. 'MR.X')
THEN
CALL ERROR( 4, ' I do NOT work for Mr. X. ' )
CIF
N Show user his name
CALL ANYOUT( 0, MESSAGE(:NEL)//', I will now demonstrate WKEY' )
N Now write keyword to HERMES' keyword list
CALL WKEY( 'HUBBLE=42' )
N Now ask keyword HUBBLE
NEL = USERREAL( H0, 1, 0, 'HUBBLE=', 'First time we ask' )
N You didn't have a chance to specify H0
WRITE( MESSAGE, '(F12.4)') H0
CALL ANYOUT( 0, ' H0 = '//MESSAGE(1:12) )
N Now I will cancel keyword 'HUBBLE='
CALL CANCEL( 'HUBBLE=' )
N Now ask keyword HUBBLE
NEL = USERREAL( H0, 1, 0, 'HUBBLE=', 'Second time we ask' )
N Now you had your chance to specify H0
WRITE( MESSAGE, '(F12.4)') H0
CALL ANYOUT( 0, ' H0 = '//MESSAGE(1:12) )
N Tell HERMES we're finished
CALL FINIS
STOP
END