3. General operation#
We use an example to show how message printing utilities work:
3.1. example#
Printed message
! ----------------------------------------!
! <A><CHATON_2>!
! !
! The little kitten is pink in color.!
! !
! This is an alarm. If you don't understand the meaning!
! From this alarm, you can get results!
! unexpected!
! ----------------------------------------!
This user message The little kitten is pink in color. consists of two parts:
A: the fixed text The little kitten is colored.
B: the pink variable text that represents the content of a character-type variable.
To implement the printing of this message in Fortran or Python, you must:
describe in a Python catalog the fixed part (A) of the message, with the format of the variables to be printed
instrument the Fortran subroutine or the Python function to cause the message to be printed.
Call FORTRAN
SUBROUTINE CHATON (...,...)
...
...
IF (I.EQ.1) THEN
VALK = 'ROSE'
CALL U2 MESK ('A', 'CHATON_2 ',1, VALK)
ENDIF
...
...
END
The U2 MESK subroutine arguments:
“A”: specify that an alarm-type message is being printed
“CHATON_2”: is the message identifier: CHATON is the name of the chaton.py message catalog and the number 2 indicates that message No. 2 will be taken from this catalog.
1: we print a single character variable
VALK: character variable to be printed.
Message catalog: chaton.py
cata_msg = {
1: _ (u" ""
The little cat is indeed green Phew!
"""),
2: _ (u" ""
The little cat is colored% (k1) s.
"""),
3: _ (u" ""
The little cat has% (i1) of legs and% (i2) of eyes.
"""),
4: _ (u" ""
The little cat weighs% (r1) f kilograms.
"""),
5: _ (u" ""
ATTENTION: Your cat is weird, he:
- has more than 4 legs, he has% (i1) d
- is of color% (k1) s and% (k2) s,
- is too big, it weighs (% (r1) f kilograms.
We stop the fees, it's not a cat!!
"""),
}