C Library Functions  - alert (3)

!>

NAME

alert(3f) - [M_attr] print messages using a standard format including time and program name (LICENSE:MIT)

CONTENTS

Synopsis
Description
Options
Example
Author
License

SYNOPSIS

subroutine alert(message,& g0,g1,g2,g3,g4,g5,g6,g7,g8,g9,ga,gb,gc,gd,ge,gf,gg,gh,gi,gj)

       character(len=*),intent(in),optional :: type
       character(len=*),intent(in),optional :: message
       class(*),intent(in),optional :: g0,g1,g2,g3,g4,g5,g6,g7,g8,g9, &
                                     & ga,gb,gc,gd,ge,gf,gg,gh,gi,gj

DESCRIPTION

Display a message prefixed with a timestamp and the name of the calling program when the TYPE is specified as any of ’error’,’warn’, or ’info’.

It also allows the keywords <ARG0>,<TZ>,<YE>,<MO>,<DA>,<HR>,<MI>,<SE>,<MS> to be used in the message (which is passed to ATTR(3f)).

Note that time stamp keywords will only be updated when using ALERT(3f) and will only be displayed in color mode!

OPTIONS

TYPE if present and one of ’warn’,’message’,’info’, or ’debug’ a predefined message is written to stderr of the form
             : <HR>:<MI>:<SE>.<MS> : (<ARG0>) : TYPE -> message

MESSAGE
  the user-supplied message to display via a call to ATTR(3f)
g[0-9a-j]
  optional values to print after the message. May be of type INTEGER, LOGICAL, REAL, DOUBLEPRECISION, COMPLEX, or CHARACTER.
if no parameters are supplied the macros are updated but no output is generated.

EXAMPLE

Sample program

    program demo_alert
    use M_attr, only : alert, attr, attr_mode
    implicit none
    real X
     call attr_mode(manner=’plain’)
     call attr_mode(manner=’color’)
     call alert("error",&
               "Say you didn’t!")
     call alert("warn", &
               "I wouldn’t if I were you, Will Robinson.")
     call alert("info", &
               "I fixed that for you, but it was a bad idea.")
     call alert("debug", &
               "Who knows what is happening now?.")
     call alert("???    ",  "not today you don’t")
     ! call to just update the macros
     call alert()
     ! conventional call to ATTR(3f) using the ALERT(3f)-defined macros
     write(*,*)attr(&
             ’<bo>The year was <g><YE></g>, the month was <g><MO></g>’)
     ! optional arguments
     X=211.3
     call alert(’error’,&
             ’allowed range of X is 0 <lt> X <lt> 100, X=<r>’,X)
     ! up to twenty values are allowed of intrinsic type
     call alert(’info’,’values are<g>’,10,234.567,&
             cmplx(11.0,22.0),123.456d0,’</g>today’)
    end program demo_alert

Results:

    00:38:30: (prg) : error    -> Say you didn’t!
    00:38:30: (prg) : warning  -> I wouldn’t if I were you, ...
                                  Will Robinson.
    00:38:30: (prg) : info     -> I fixed that for you,  ...
                                  but it was a bad idea.
    00:38:30: (prg) : debug    -> Who knows what is happening now?. ...
    00:38:30: (prg) : ???      -> not today you don’t
    00:38:30: (prg) : error    -> allowed range of X is 0  X  100, ...
                                  X= 211.300003
    00:38:30: (prg) : info     -> values are 10 234.567001 ...
                                  (11.0000000,22.0000000) ...
                                  123.45600000000000 today

AUTHOR

John S. Urban, 2021

LICENSE

    MIT


Nemo Release 3.1 alert (3) July 22, 2023
Generated by manServer 1.08 from f047e91e-2e36-46e7-a2a3-7853780e1238 using man macros.