1    /* 
     2     *  Copyright (c) 2008 Texas Instruments. All rights reserved. 
     3     *  This program and the accompanying materials are made available under the 
     4     *  terms of the Eclipse Public License v1.0 and Eclipse Distribution License
     5     *  v. 1.0 which accompanies this distribution. The Eclipse Public License is
     6     *  available at http://www.eclipse.org/legal/epl-v10.html and the Eclipse
     7     *  Distribution License is available at 
     8     *  http://www.eclipse.org/org/documents/edl-v10.php.
     9     *
    10     *  Contributors:
    11     *      Texas Instruments - initial implementation
    12     * */
    13    /*
    14     *  ======== Log.xdc ========
    15     */
    16    
    17    /*!
    18     *  ======== Log ========
    19     *  Event logging manager
    20     *
    21     *  RTSC modules and the application code generate `{@link #Event Log_Event}`
    22     *  events by calling the `Log` module's functions. The `Log` module then
    23     *  passes those events to an `{@link ILogger}` instance assigned to the event
    24     *  originating module, specified by that module's configuration parameter
    25     *  `common$.logger`. `ILogger` instances handle events, usually converting
    26     *  events to `{@link #EventRec Log_EventRec}` records prior to recording,
    27     *  transmitting, or displaying them.
    28     *
    29     *  All events generated by a target module are stored and displayed by an
    30     *  `ILogger`, examples of which are instances of
    31     *  `{@link LoggerBuf xdc.runtime.LoggerBuf}` or
    32     *  `{@link LoggerSys xdc.runtime.LoggerSys}`. At runtime, modules
    33     *  generate events through this module, rather than invoking directly their
    34     *  `ILogger`s. By doing so,  modules can be configured to use different
    35     *  `ILogger` implementations without any changes to their source code.
    36     *  
    37     *  A logger instance can accept `Log` events from any module, but a module
    38     *  can put `Log` events to only one logger instance. There can be one or
    39     *  more logger instances in a system. All `Log` calls that are not in a
    40     *  module are controlled by the module `{@link Main xdc.runtime.Main}`.
    41     *  For example, top-level application code or any existing sources that
    42     *  simply call the `Log` or `Assert` methods implicitly use the logger
    43     *  associated with the `Main` module.
    44     *
    45     *  The generation of a `Log` event is controlled by a module's diagnostics
    46     *  mask, which is described in details in `{@link Diags}`. Each `Log` event
    47     *  is associated with a mask. `Log` events are generated only when a
    48     *  particular bit is set in both the `Log` event mask
    49     *  and the module's diagnostics mask. For example, a `Log` event mask with
    50     *  the `{@link Diags#USER1 USER1}` bit set is generated only when the `USER1`
    51     *  bit is also set in the module's diagnostics mask.
    52     *
    53     *  There are two ways to generate `Log` events:
    54     *
    55     *  @p(blist)
    56     *  - `{@link #write8 LOG_write()}`, which is tailored for module writers
    57     *  and takes full advantage of the XDC configuration model. For example,
    58     *  the message string associated with the `Log` event need not be a part of
    59     *  the final application, significantly reducing the "footprint overhead"
    60     *  of embedding diagnostics in deployed systems. The `Log_write[0-8]()`
    61     *  functions allow up to 8 values to be passed to the logger. They expect
    62     *  the logger to handle any formatting. A `Log` event type allows you to
    63     *  specify the type of event.
    64     *  - `{@link #print6 LOG_print()}`, which is designed for arbitrary C code.
    65     *  The `Log_print[0-6]()` functions allow up to 6 values to be passed along
    66     *  with a printf-like format string to the logger. They handle printf-style
    67     *  formatting.
    68     *  @p
    69     *
    70     *  Both functions are controlled by the module's diagnostics mask. Their
    71     *  storage or output is defined by the logger that is assigned to the
    72     *  module that calls the `Log` methods or to the 
    73     *  `{@link Main xdc.runtime.Main}` module if the caller is not part of a
    74     *  module.
    75     *
    76     *  The `Log` function call sites are implemented in such a way that an
    77     *  optimizer can completely eliminate `Log` code from the program if the
    78     *  `Log` functions have been permanently disabled at configuration time. If
    79     *  the `Log` functions are permanently turned on at configuration time,
    80     *  then the optimizer can eliminate all runtime conditional checking and
    81     *  simply invoke the `Log` functions directly. Runtime checking is performed
    82     *  only when the `Log` functions are configured to be runtime modifiable.
    83     *
    84     *  The Log calls can also be completely removed by defining the symbol 
    85     *  `xdc_runtime_Log_DISABLE_ALL`. This can be done on the compile line, e.g.
    86     *  `-Dxdc_runtime_Log_DISABLE_ALL`. This will completely remove the `Log` 
    87     *  statements from any code compiled with this flag, regardless of the   
    88     *  application's logging configuration or your compiler's optimization
    89     *  settings.
    90     *
    91     *  It is also possible to remove all logging except for
    92     *  `{@link #error Log_error}`, `{@link #warning Log_warning}`, or
    93     *  `{@link #info Log_info}` statements. This is done by first defining
    94     *  `xdc_runtime_Log_DISABLE_ALL`, followed by defining one or more of the
    95     *  symbols below to leave that type of logging enabled:
    96     *  @p(blist)
    97     *  - `xdc_runtime_Log_ENABLE_ERROR`
    98     *  - `xdc_runtime_Log_ENABLE_WARNING`
    99     *  - `xdc_runtime_Log_ENABLE_INFO`
   100     *  @p
   101     *  For example, to disable all `Log` statements except for `Log_error`, add
   102     *  the following to the compile line:
   103     *  @p(code)
   104     *      -Dxdc_runtime_Log_DISABLE_ALL -Dxdc_runtime_Log_ENABLE_ERROR
   105     *  @p
   106     *
   107     *  @a(Examples)
   108     *  Example 1: The following example defines a `Log` event, uses that `Log`
   109     *  event in a module, and configures the program to generate the `Log`
   110     *  event. In this example, both `USER1` and `USER2` bits are set in the
   111     *  event mask. This means that if either bit is set in the module's
   112     *  diagnostics mask, then the `Log` event will be generated.
   113     *
   114     *  This is a part of the XDC specification file for the `Mod` module
   115     *  (Mod.xdc):
   116     *
   117     *  @p(code)
   118     *  import xdc.runtime.Diags;
   119     *  import xdc.runtime.Log;
   120     *
   121     *  config Log.Event L_someEvent = {
   122     *      mask: Diags.USER1 | Diags.USER2,
   123     *      level: Diags.LEVEL1,
   124     *      msg: "my log event message, arg1: 0x%x, arg2: 0x%x"
   125     *  };
   126     *  @p
   127     *
   128     *  This is a part of the C code implementation of the Mod module:
   129     *
   130     *  @p(code)
   131     *  #include <xdc/runtime/Log.h>
   132     *  UInt x, y;
   133     *
   134     *  Log_write2(Mod_L_someEvent, (IArg)x, (IArg)y);
   135     *  @p
   136     *
   137     *  The following configuration script demonstrates how the application might
   138     *  control the `Log` statements embedded in the `Mod` module at configuration
   139     *  time. In this case, the configuration script arranges for the `Log`
   140     *  statements within the `Mod` module (shown above) to always generate events.
   141     *  Without these configuration statements, no `Log` events would be generated
   142     *  by this module.
   143     *
   144     *  This is part of the XDC configuration file for the application:
   145     *
   146     *  @p(code)
   147     *  var Diags = xdc.useModule('xdc.runtime.Diags');
   148     *  var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
   149     *  var Mod = xdc.useModule('my.pkg.Mod');
   150     *  Mod.common$.diags_USER1 = Diags.ALWAYS_ON;
   151     *  Mod.common$.logger = LoggerSys.create();
   152     *  @p
   153     *
   154     *  @p(html)
   155     *  <hr />
   156     *  @p
   157     *
   158     *  Example 2: The following XDC configuration statements turn on enter
   159     *  and exit logging at configuration time for a module. Without any other
   160     *  changes in the runtime code, every time a module `Mod`'s function is 
   161     *  being called or exits, an event will be logged.
   162     *
   163     *  @p(code)
   164     *  var Diags = xdc.useModule('xdc.runtime.Diags');
   165     *  var Mod = xdc.useModule('my.pkg.Mod');
   166     *
   167     *  Mod.common$.diags_ENTER = Diags.ALWAYS_ON;
   168     *  Mod.common$.diags_EXIT = Diags.ALWAYS_ON;
   169     *  @p
   170     *
   171     *  @p(html)
   172     *  <hr />
   173     *  @p
   174     *
   175     *  Example 3: The following example configures a module to support enter and
   176     *  exit logging, but defers the actual activation and deactivation of the
   177     *  logging until runtime. See the `{@link Diags#setMask Diags_setMask()}`
   178     *  function for details on specifying the control string.
   179     *
   180     *  This is a part of the XDC configuration file for the application:
   181     *
   182     *  @p(code)
   183     *  var Diags = xdc.useModule('xdc.runtime.Diags');
   184     *  var Mod = xdc.useModule('my.pkg.Mod');
   185     *
   186     *  Mod.common$.diags_ENTER = Diags.RUNTIME_OFF;
   187     *  Mod.common$.diags_EXIT = Diags.RUNTIME_OFF;
   188     *  @p
   189     *
   190     *  This is a part of the C code for the application:
   191     *
   192     *  @p(code)
   193     *  // turn on enter and exit logging in the module
   194     *  Diags_setMask("my.pkg.Mod+EX");
   195     *
   196     *  // turn off enter and exit logging in the module
   197     *  Diags_setMask("my.pkg.Mod-EX");
   198     *  @p
   199     */
   200    
   201    @CustomHeader
   202    
   203    module Log {
   204    
   205        /*!
   206         *  ======== NUMARGS ========
   207         *  Maximum number of arguments supported in `Log` events.
   208         */
   209        const Int NUMARGS = 8;
   210    
   211        /*!
   212         *  ======== PRINTFID ========
   213         *  The `EventId` for `Log_print()` events
   214         */
   215        const EventId PRINTFID = 0;
   216        
   217        /*! 
   218         *  ======== EventDesc ========
   219         *  `Log` event descriptor
   220         *
   221         *  Each `Log` event is defined by a `Log` event descriptor.
   222         *
   223         *  The `mask` defines which bits in the module's diagnostics mask
   224         *  enable this `Log` event.  Events "posted" via `Log_write` are only
   225         *  written to the underlying logger if one of the mask's bits matches 
   226         *  the caller's module diagnostics settings (see
   227         *  `{@link xdc.runtime.Types#common$}`).
   228         *
   229         *  The 'level' defines the event level of the event. While the diags
   230         *  bits selected in the 'mask' signify the "category" of the event (e.g. 
   231         *  Entry/Exit, Analysis, Info), the 'level' field allows you to assign
   232         *  a "priority" or "detail level" to the event relative to other events in
   233         *  that category. There are four event levels defined by 
   234         *  '{@link xdc.runtime.Diags#EventLevel}'.
   235         *
   236         *  Filtering of events by level is handled by the ILogger implementation.
   237         *  ILogger implementations which also implement the {@link IFilterLogger} 
   238         *  interface support filtering of events based on priority level.
   239         *
   240         *  Specifying an event level is optional. Events that don't specify a
   241         *  level will receive Diags.LEVEL1 by default, making them the highest
   242         *  priority and ensuring that they will not inadvertently be filtered out 
   243         *  by level-based filtering. 
   244         *
   245         *  The `msg` defines a printf style format string that defines how to
   246         *  render the arguments passed along the event in a `Log_write` call.
   247         *  For a description of the allowable format strings see
   248         *  `{@link #print6}`.
   249         *
   250         *  @see #write8
   251         *  @see #print6
   252         */
   253        metaonly struct EventDesc {
   254            Diags.Mask          mask;   /*! event enable mask */
   255            Diags.EventLevel    level;  /*! event level relative to other events */
   256            String              msg;    /*! event "printf" message format string */
   257        };
   258    
   259        /*!
   260         *  ======== EventRec ========
   261         *  The target representation of a recorded event
   262         *
   263         *  This structure defines how events are recorded on the target.
   264         */
   265        struct EventRec {
   266            Types.Timestamp64 tstamp;   /*! time event was written */
   267            Bits32 serial;              /*! serial number of event */
   268            Types.Event evt;            /*! target encoding of an Event */
   269            IArg arg[NUMARGS];          /*! arguments passed via Log_write/print */
   270        }
   271    
   272        /*! 
   273         *  ======== Event ========
   274         *  `Log` event type
   275         *
   276         *  An `Event` is represented on the target as a 32-bit value that can
   277         *  be decoded offline to recover the `Event` information defined in
   278         *  a corresponding metaonly `EventDesc`.  In addition, `Event`s may be
   279         *  decoded at runtime via methods provided in this module; see
   280         *  `{@link #getMask}` and `{@link #getEventId}`.
   281         *
   282         *  When an event is "raised" a `{@link Types#Event Types_Event}` is
   283         *  created which has the same event ID as the `Log_Event` but also
   284         *  encodes the module ID of the caller.  This new event is passed to
   285         *  the underlying `{@link ILogger}` module along with any arguments
   286         *  associated with the event.
   287         *
   288         *  @see #getMask
   289         *  @see #getEventId
   290         */
   291        @Encoded typedef EventDesc Event;
   292    
   293        /*!
   294         *  ======== EventId ========
   295         *  Unique ID embedded in each `{@link #Event}`
   296         *
   297         *  This ID must be used to compare two `Event`s for equality.  Event
   298         *  ids are not guaranteed to remain constant between different
   299         *  configurations of an application.  For example, adding a module
   300         *  may cause the event ids of another module to change.
   301         *
   302         *  However, event ids declared by a module are guaranteed to be
   303         *  consecutive values starting from the first declared
   304         *  `{@link #Event Log_Event}` and increasing to the last declared
   305         *  event.  As a result, clients of a module can efficiently test ranges
   306         *  of events and modules can add new events, such as internal trace
   307         *  events, without breaking clients; simply be careful to add new events
   308         *  after any existing events in you module's `.xdc` specification.
   309         *
   310         *  @see #getEventId
   311         *  @see #Event
   312         */
   313        typedef Types.RopeId EventId;
   314        
   315        /*! 
   316         *  ======== L_construct ========
   317         *  Lifecycle event posted when an instance is constructed
   318         */
   319        config Log.Event L_construct = {
   320            mask: Diags.LIFECYCLE, 
   321            msg: "<-- construct: %p('%s')"
   322        };
   323    
   324        /*!
   325         *  ======== L_create ========
   326         *  Lifecycle event posted when an instance is created
   327         */
   328        config Log.Event L_create = {
   329            mask: Diags.LIFECYCLE, 
   330            msg: "<-- create: %p('%s')"
   331        };
   332    
   333        /*!
   334         *  ======== L_destruct ========
   335         *  Lifecycle event posted when an instance is destructed
   336         */
   337        config Log.Event L_destruct = {
   338            mask: Diags.LIFECYCLE, 
   339            msg: "--> destruct: (%p)"
   340        };
   341    
   342        /*!
   343         *  ======== L_delete ========
   344         *  Lifecycle event posted when an instance is deleted
   345         */
   346        config Log.Event L_delete = {
   347            mask: Diags.LIFECYCLE, 
   348            msg: "--> delete: (%p)"
   349        };
   350    
   351        /*! 
   352         *  ======== L_error ========
   353         *  Error event posted by Log_errorX API
   354         *
   355         *  This event is marked as a STATUS event and given the priority level
   356         *  of ERROR.
   357         *
   358         *  This event prints the Log call site (%$F) and a format string (%$S)
   359         *  which is recursively formatted with any addition arguments.
   360         */
   361        config Log.Event L_error = {
   362            mask: Diags.STATUS,   
   363            level: Diags.ERROR,
   364            msg: "ERROR: %$F%$S"
   365        };
   366        
   367        /*! 
   368         *  ======== L_warning ========
   369         *  Warning event posted by Log_warningX API
   370         *
   371         *  This event is marked as a STATUS event and given the priority level of 
   372         *  WARNING.
   373         *
   374         *  This event prints the Log call site (%$F) and a format string (%$S)
   375         *  which is recursively formatted with any addition arguments.
   376         */
   377        config xdc.runtime.Log.Event L_warning = {
   378            mask: Diags.STATUS,
   379            level: Diags.WARNING,
   380            msg: "WARNING: %$F%$S"
   381        };
   382    
   383        /*! 
   384         *  ======== L_info ========
   385         *  Info event posted by Log_infoX API
   386         *
   387         *  This event is marked as an INFO event. The event priority is not
   388         *  specified in the event definition. Rather, it is specified as an 
   389         *  argument to the Log_infoX APIs.
   390         *
   391         *  This event prints the Log call site (%$F) and a format string (%$S)
   392         *  which is recursively formatted with any addition arguments.
   393         */
   394        config xdc.runtime.Log.Event L_info = {
   395            mask: Diags.INFO,    
   396            msg: "%$F%$S"
   397        };
   398    
   399        /*!
   400         *  ======== getMask ========
   401         *  Get the `Diags` mask for the specified (encoded) event
   402         *
   403         *  @param(evt)     the `Log` event encoding a mask and event ID
   404         *
   405         *  @a(returns)     `Diags` mask for the specified event
   406         */
   407        @Macro Diags.Mask getMask(Event evt);
   408    
   409        /*!
   410         *  ======== getRope ========
   411         *  Get RopeId of the Event.msg for the specified (encoded) event
   412         *  @_nodoc
   413         */
   414        @Macro Text.RopeId getRope(Event evt);
   415    
   416        /*!
   417         *  ======== getEventId ========
   418         *  Get event ID of the specified (encoded) event
   419         *
   420         *  This method is used to compare "known" `Log` events with
   421         *  "raised" `{@link Types#Event Types_Event}`.
   422         *
   423         *  @param(evt)     the `Log` event encoding a mask and event ID
   424         *
   425         *  @a(returns)     event ID of the specified event
   426         *
   427         *  @see Types#getEventId
   428         */
   429        @Macro EventId getEventId(Event evt);
   430    
   431        /*!
   432         *  ======== print0 ========
   433         *  Generate a `Log` "print event" with 0 arguments
   434         *
   435         *  @see #print6
   436         */
   437        @Macro Void print0(Diags.Mask mask, String fmt);
   438    
   439        /*!
   440         *  ======== print1 ========
   441         *  Generate a `Log` "print event" with 1 argument
   442         *
   443         *  @see #print6
   444         */
   445        @Macro Void print1(Diags.Mask mask, String fmt, IArg a1);
   446    
   447        /*!
   448         *  ======== print2 ========
   449         *  Generate a `Log` "print event" with 2 arguments
   450         *
   451         *  @see #print6
   452         */
   453        @Macro Void print2(Diags.Mask mask, String fmt, IArg a1, IArg a2);
   454    
   455        /*!
   456         *  ======== print3 ========
   457         *  Generate a `Log` "print event" with 3 arguments
   458         *
   459         *  @see #print6
   460         */
   461        @Macro Void print3(Diags.Mask mask, String fmt, IArg a1, IArg a2, IArg a3);
   462    
   463        /*!
   464         *  ======== print4 ========
   465         *  Generate a `Log` "print event" with 4 arguments
   466         *
   467         *  @see #print6
   468         */
   469        @Macro Void print4(Diags.Mask mask, String fmt, IArg a1, IArg a2, IArg a3,
   470            IArg a4);
   471    
   472        /*!
   473         *  ======== print5 ========
   474         *  Generate a `Log` "print event" with 5 arguments
   475         *
   476         *  @see #print6
   477         */
   478        @Macro Void print5(Diags.Mask mask, String fmt, IArg a1, IArg a2, IArg a3,
   479            IArg a4, IArg a5);
   480    
   481        /*!
   482         *  ======== print6 ========
   483         *  Generate a `Log` "print event" with 6 arguments
   484         *
   485         *  As a convenience to C (as well as assembly language) programmers,
   486         *  the `Log` module provides a variation of the ever-popular `printf`
   487         *  function.
   488         *  The `print[0-6]` functions generate a `Log` "print event" and route
   489         *  it to the current module's logger.
   490         *
   491         *  The arguments passed to `print[0-6]` may be characters, integers,
   492         *  strings, or pointers.  However, because the declared type of the
   493         *  arguments is `{@link xdc IArg}`, all pointer arguments must be cast
   494         *  to an `IArg` type.  `IArg` is an integral type large enough to hold
   495         *  any pointer or an `int`.  So, casting a pointer to an `IArg` does
   496         *  not cause any loss of information and C's normal integer conversions
   497         *  make the cast unnecessary for integral arguments.
   498         *
   499         *  The format string can use the following conversion characters.
   500         *  However, it is important to recall that all arguments referenced by
   501         *  these conversion characters have been converted to an `IArg`
   502         *  prior to conversion; so, the use of "length modifiers" should be
   503         *  avoided.
   504         *
   505         *  @p(code)
   506         *  Conversion Character    Description
   507         *  ------------------------------------------------
   508         *  %c                      Character
   509         *  %d                      Signed integer
   510         *  %u                      Unsigned integer
   511         *  %x                      Unsigned hexadecimal integer
   512         *  %o                      Unsigned octal integer
   513         *  %s                      Character string
   514         *  %p                      Pointer
   515         *  %f                      Single precision floating point (float)
   516         *  @p
   517         *
   518         *  Format strings, while very convenient, are a well known source of
   519         *  portability problems: each format specification must precisely match
   520         *  the types of the arguments passed. Underlying "printf" functions use
   521         *  the format string to determine how far to advance through their
   522         *  argument list. For targets where pointer types and integers are the
   523         *  same size there are no problems.  However, suppose a target's pointer
   524         *  type is larger than its integer type. In this case, because integer
   525         *  arguments are widened to be of type `IArg`, a format specification of
   526         *  "%d" causes an underlying `printf()` implementation to read the
   527         *  extended part of the integer argument as part of the next argument(!).
   528         *
   529         *  To get around this problem and still allow the use of "natural" 
   530         *  format specifications (e.g., `%d` and `%x` with optional width
   531         *  specifications), `{@link System#aprintf()}` is used which assumes
   532         *  that all arguments have been widened to be of type `IArg`.
   533         *
   534         *  See `{@link System#printf}` for complete details.
   535         *
   536         *  The `%f` format specifier is used to print a single precision float
   537         *  value. Note that `%f` assumes that sizeof(Float) <= sizeof(IArg).
   538         *  Most clients that interpret float values except that they are
   539         *  represented in IEEE 754 floating point format. Therefore, it is
   540         *  recommended that the float values are converted into that format prior
   541         *  to supplying the values to `Log` functions in cases where targets do
   542         *  not generate the float values in IEEE 754 floating point format by
   543         *  default.
   544         *
   545         *  The first argument to a Log_print call is the diags category to be
   546         *  associated with the event.
   547         *
   548         *  It is also possible to associate an event level with the event to 
   549         *  enable filtering of events based on event level. Conceptually, it is
   550         *  best to regard the event level as completely separate from the event's
   551         *  diags category; however, the priority value actually occupies a part
   552         *  of the diags mask. For this reason, it is possible to specify an event
   553         *  level by ORing the level with the diags mask. For example, to print
   554         *  an INFO event of LEVEL2, you'd simply write:
   555         *  (Diags.INFO | Diags.LEVEL2)
   556         *
   557         *  Specifying an event level is optional. Log_print calls which do not 
   558         *  specify a level will receive the highest priority by default.
   559         * 
   560         *  @param(mask)    enable bits and optional detail level for this event
   561         *  @param(fmt)     a `printf` style format string
   562         *  @param(a1)      value for first format conversion character
   563         *  @param(a2)      value for second format conversion character
   564         *  @param(a3)      value for third format conversion character
   565         *  @param(a4)      value for fourth format conversion character
   566         *  @param(a5)      value for fifth format conversion character
   567         *  @param(a6)      value for sixth format conversion character
   568         *
   569         *  @a(Examples)
   570         *  The following example demonstrates a typical usage.
   571         *  @p(code)
   572         *  String  list[];
   573         *  UInt    i;
   574         *
   575         *  Log_print2(Diags_USER2, "list[%u] = %s\n", i, (IArg)list[i]);
   576         *  @p
   577         *  Note that the `IArg` cast above is only necessary for pointer
   578         *  arguments; C's normal parameter conversions implicitly convert
   579         *  integral arguments.
   580         */
   581        @Macro Void print6(Diags.Mask mask, String fmt, IArg a1, IArg a2, IArg a3,
   582            IArg a4, IArg a5, IArg a6);
   583    
   584        /*!
   585         *  ======== error0 ========
   586         *  Generate a `Log` "error event" with 0 arguments
   587         *
   588         *  @see #error5
   589         */
   590        @Macro Void error0(String fmt);
   591    
   592        /*!
   593         *  ======== error1 ========
   594         *  Generate a `Log` "error event" with 1 argument
   595         *
   596         *  @see #error5
   597         */
   598        @Macro Void error1(String fmt, IArg a1);
   599    
   600        /*!
   601         *  ======== error2 ========
   602         *  Generate a `Log` "error event" with 2 arguments
   603         *
   604         *  @see #error5
   605         */
   606        @Macro Void error2(String fmt, IArg a1, IArg a2);
   607    
   608        /*!
   609         *  ======== error3 ========
   610         *  Generate a `Log` "error event" with 3 arguments
   611         *
   612         *  @see #error5
   613         */
   614        @Macro Void error3(String fmt, IArg a1, IArg a2, IArg a3);
   615    
   616        /*!
   617         *  ======== error4 ========
   618         *  Generate a `Log` "error event" with 4 arguments
   619         *
   620         *  @see #error5
   621         */
   622        @Macro Void error4(String fmt, IArg a1, IArg a2, IArg a3,
   623            IArg a4);
   624    
   625        /*!
   626         *  ======== error5 ========
   627         *  Generate a `Log` "error event" with 5 arguments
   628         *
   629         *  The Log_error APIs are intended to allow users to easily log error
   630         *  events in their code. Similar to the Log_print APIs, Log_error does not
   631         *  require that you define an event. You simply pass an informative error
   632         *  string which can optionally be formatted with additional arguments. The
   633         *  error is logged with the predefined event {@link #L_error}. 
   634         *  
   635         *  Log_error prepends a string to the message which identifies it as an 
   636         *  ERROR and specifies the filename and line number of the Log_error call 
   637         *  site. A simple example:
   638         *
   639         *  @p(code)
   640         *  Log_error0("Invalid argument");
   641         *  @p
   642         *  This event will be formatted as (assuming that the above call was line
   643         *  35 of "MyCode.c")
   644         *  @p(code)
   645         *  ERROR at "MyCode.c", line 35: Invalid argument
   646         *  @p
   647         *
   648         *  Users may provide additional information in the error event, such as
   649         *  a predefined error code or details of the error. These additional
   650         *  values will be used to format the string passed to Log_error. 
   651         *  @see #print6 for information about format strings.
   652         *
   653         *  Log_error does not use a variable length argument list--you must call
   654         *  the appropriate Log_errorX API based on the number of arguments.
   655         *
   656         *  @param(fmt)      a reference to a constant error string / fmt string
   657         *  @param(a1)       value for an additional parameter (e.g. an error code)
   658         *  @param(a2)       value for an additional parameter
   659         *  @param(a3)       value for an additional parameter
   660         *  @param(a4)       value for an additional parameter
   661         *  @param(a5)       value for an additional parameter
   662         *
   663         *  @a(Examples)
   664         *  The following example demonstrates a typical usage.
   665         *  @p(code)
   666         *  Int myArg;
   667         *
   668         *  Log_error1("Invalid argument: %d", myArg);
   669         *  @p
   670         *  The above event is formatted as, for example:
   671         *  @p(code)
   672         *  ERROR: "MyCode.c", line 35: Invalid argument: -1
   673         *  @p
   674         */
   675        @Macro Void error5(String fmt, IArg a1, IArg a2, IArg a3,
   676            IArg a4, IArg a5);
   677         
   678        /*!
   679         *  ======== warning0 ========
   680         *  Generate a `Log` "warning event" with 0 arguments
   681         *
   682         *  @see #warning5
   683         */
   684        @Macro Void warning0(String fmt);
   685    
   686        /*!
   687         *  ======== warning1 ========
   688         *  Generate a `Log` "warning event" with 1 argument
   689         *
   690         *  @see #warning5
   691         */
   692        @Macro Void warning1(String fmt, IArg a1);
   693    
   694        /*!
   695         *  ======== warning2 ========
   696         *  Generate a `Log` "warning event" with 2 arguments
   697         *
   698         *  @see #warning5
   699         */
   700        @Macro Void warning2(String fmt, IArg a1, IArg a2);
   701    
   702        /*!
   703         *  ======== warning3 ========
   704         *  Generate a `Log` "warning event" with 3 arguments
   705         *
   706         *  @see #warning5
   707         */
   708        @Macro Void warning3(String fmt, IArg a1, IArg a2, IArg a3);
   709    
   710        /*!
   711         *  ======== warning4 ========
   712         *  Generate a `Log` "warning event" with 4 arguments
   713         *
   714         *  @see #warning5
   715         */
   716        @Macro Void warning4(String fmt, IArg a1, IArg a2, IArg a3,
   717            IArg a4);
   718    
   719        /*!
   720         *  ======== warning5 ========
   721         *  Generate a `Log` "warning event" with 5 arguments
   722         *
   723         *  The Log_warning APIs provide the same features as the Log_error APIs,
   724         *  but are used to specifically log "warning" events. 
   725         *  @see #error5
   726         *
   727         *  The Log_warning APIs are equivalent to the Log_error APIs except that
   728         *  they use the predefined {@link #L_warning} event. Log_warning prepends  
   729         *  a string to the message which identifies it as a WARNING and specifies 
   730         *  the filename and line number of the Log_warning call site.
   731         *
   732         *  @param(fmt)     reference to a constant warning string / fmt string
   733         *  @param(a1)      value for an additional parameter (e.g. a warning code)
   734         *  @param(a2)      value for an additional parameter
   735         *  @param(a3)      value for an additional parameter
   736         *  @param(a4)      value for an additional parameter
   737         *  @param(a5)      value for an additional parameter
   738         *
   739         *  @a(Examples)
   740         *  The following example demonstrates a typical usage.
   741         *  @p(code)
   742         *  Int myArg;
   743         *
   744         *  Log_warning1("Value may be too high: %d", myArg);
   745         *  @p
   746         *  The above event is formatted as:
   747         *  @p(code)
   748         *  WARNING: "MyCode.c", line 50: Value may be too high: 4096
   749         *  @p
   750         */
   751        @Macro Void warning5(String fmt, IArg a1, IArg a2, IArg a3,
   752            IArg a4, IArg a5);      
   753            
   754        /*!
   755         *  ======== info0 ========
   756         *  Generate a `Log` "info event" with 0 arguments
   757         *
   758         *  @see #info5
   759         */
   760        @Macro Void info0(String fmt);
   761    
   762        /*!
   763         *  ======== info1 ========
   764         *  Generate a `Log` "info event" with 1 argument
   765         *
   766         *  @see #info5
   767         */
   768        @Macro Void info1(String fmt, IArg a1);
   769    
   770        /*!
   771         *  ======== info2 ========
   772         *  Generate a `Log` "info event" with 2 arguments
   773         *
   774         *  @see #info5
   775         */
   776        @Macro Void info2(String fmt, IArg a1, IArg a2);
   777    
   778        /*!
   779         *  ======== info3 ========
   780         *  Generate a `Log` "info event" with 3 arguments
   781         *
   782         *  @see #info5
   783         */
   784        @Macro Void info3(String fmt, IArg a1, IArg a2, IArg a3);
   785    
   786        /*!
   787         *  ======== info4 ========
   788         *  Generate a `Log` "info event" with 4 arguments
   789         *
   790         *  @see #info5
   791         */
   792        @Macro Void info4(String fmt, IArg a1, IArg a2, IArg a3, IArg a4);
   793    
   794        /*!
   795         *  ======== info5 ========
   796         *  Generate a `Log` "info event" with 5 arguments
   797         *
   798         *  The Log_info APIs are provided for easily logging generic 
   799         *  "informational" events with call site information. They are similar to
   800         *  the Log_print APIs in that they do not require you to define an event--
   801         *  you simply pass an informative printf-style string which can optionally 
   802         *  be formatted with additional arguments. The info record is logged with
   803         *  the predefined event '{@link #L_info}'.
   804         *
   805         *  The Log_info APIs log the {@link #L_info} event which uses the 'INFO' 
   806         *  diags category. They do not allow you to specify an event priority. 
   807         *  
   808         *  Log_info prepends the filename and line number of the call site to the
   809         *  message. 
   810         *
   811         *  @param(fmt)     reference to a constant event string / fmt string
   812         *  @param(a1)      value for an additional parameter (e.g. an event code)
   813         *  @param(a2)      value for an additional parameter
   814         *  @param(a3)      value for an additional parameter
   815         *  @param(a4)      value for an additional parameter
   816         *  @param(a5)      value for an additional parameter
   817         *
   818         *  @a(Examples)
   819         *  The following example demonstrates a typical usage.
   820         *  @p(code)
   821         *  Int load;
   822         *
   823         *  Log_info1("Current load: %d", load);
   824         *  @p
   825         *  The above event is formatted as, for example: 
   826         *  @p(code)
   827         *  "MyCode.c", line 15: Current load: 25
   828         *  @p
   829         */
   830        @Macro Void info5(String fmt, IArg a1, IArg a2, IArg a3, IArg a4, IArg a5);    
   831                      
   832         /*!
   833         *  ======== put0 ========
   834         *  Unconditionally put the specified Log event with 0 arguments
   835         *
   836         *  @see #put4
   837         */
   838        @Macro Void put0(Log.Event evt, Types.ModuleId mid);
   839          
   840        /*!
   841         *  ======== put1 ========
   842         *  Unconditionally put the specified Log event and 1 argument
   843         *  
   844         *  @see #put4
   845         */
   846        @Macro Void put1(Log.Event evt, Types.ModuleId mid, IArg a1);
   847    
   848        /*!
   849         *  ======== put2 ========
   850         *  Unconditionally put the specified Log event and 2 arguments
   851         *  
   852         *  @see #put4
   853         */
   854         @Macro Void put2(Log.Event evt, Types.ModuleId mid, IArg a1, IArg a2);  
   855           
   856        /*!
   857         *  ======== put4 ========
   858         *  Unconditionally put the specified Log event
   859         *
   860         *  This method unconditionally puts the specified `{@link Event}`
   861         *  `evt` into the log. The `{@link Types#ModuleId}` `mid` should be the 
   862         *  module ID of the module which is putting the event.
   863         *
   864         *  @param(evt)     the Log event to put into the log
   865         *  @param(mid)     module ID of the module putting the event
   866         *  @param(a1)      value for first format conversion character
   867         *  @param(a2)      value for second format conversion character
   868         *  @param(a3)      value for third format conversion character
   869         *  @param(a4)      value for fourth format conversion character
   870         *
   871         *  @see #put8
   872         */
   873        @Macro Void put4(Log.Event evt, Types.ModuleId mid, IArg a1, IArg a2,
   874                         IArg a3, IArg a4);
   875    
   876        /*!
   877         *  ======== put8 ========
   878         *  Unconditionally put the specified Log event and 8 arguments
   879         *  
   880         *  @see #put4
   881         */
   882        @Macro Void put8(Log.Event evt, Types.ModuleId mid, IArg a1, IArg a2,
   883                         IArg a3, IArg a4, IArg a5, IArg a6, IArg a7, IArg a8);
   884    
   885        /*! 
   886         *  ======== write0 ========
   887         *  Generate a `Log` event with 0 arguments
   888         *
   889         *  @see #write8
   890         */
   891        @Macro Void write0(Event evt);
   892    
   893        /*! 
   894         *  ======== write1 ========
   895         *  Generate a `Log` event with 1 argument
   896         *
   897         *  @see #write8
   898         */
   899        @Macro Void write1(Event evt, IArg a1);
   900    
   901        /*!
   902         *  ======== write2 ========
   903         *  Generate a `Log` event with 2 arguments
   904         *
   905         *  @see #write8
   906         */
   907        @Macro Void write2(Event evt, IArg a1, IArg a2);
   908    
   909        /*!
   910         *  ======== write3 ========
   911         *  Generate a `Log` event with 3 arguments
   912         *
   913         *  @see #write8
   914         */
   915        @Macro Void write3(Event evt, IArg a1, IArg a2, IArg a3);
   916    
   917        /*!
   918         *  ======== write4 ========
   919         *  Generate a `Log` event with 4 arguments
   920         *
   921         *  @see #write8
   922         */
   923        @Macro Void write4(Event evt, IArg a1, IArg a2, IArg a3, IArg a4);
   924    
   925        /*!
   926         *  ======== write5 ========
   927         *  Generate a `Log` event with 5 arguments
   928         *
   929         *  @see #write8
   930         */
   931        @Macro Void write5(Event evt, IArg a1, IArg a2, IArg a3, IArg a4, IArg a5);
   932    
   933        /*!
   934         *  ======== write6 ========
   935         *  Generate a `Log` event with 6 arguments
   936         *
   937         *  @see #write8
   938         */
   939        @Macro Void write6(Event evt, IArg a1, IArg a2, IArg a3, IArg a4,
   940                            IArg a5, IArg a6);
   941    
   942        /*!
   943         *  ======== write7 ========
   944         *  Generate a `Log` event with 7 arguments
   945         *
   946         *  @see #write8
   947         */
   948        @Macro Void write7(Event evt, IArg a1, IArg a2, IArg a3, IArg a4,
   949                            IArg a5, IArg a6, IArg a7);
   950    
   951        /*!
   952         *  ======== write8 ========
   953         *  Generate a `Log` event with 8 arguments
   954         *
   955         *  If the mask in the specified `Log` event has any bit set which is
   956         *  also set in the current module's diagnostics mask, then this call to
   957         *  write will "raise" the given `Log` event.
   958         *
   959         *  @param(evt)     the `Log` event to write
   960         *  @param(a1)      value for first format conversion character
   961         *  @param(a2)      value for second format conversion character
   962         *  @param(a3)      value for third format conversion character
   963         *  @param(a4)      value for fourth format conversion character
   964         *  @param(a5)      value for fifth format conversion character
   965         *  @param(a6)      value for sixth format conversion character
   966         *  @param(a7)      value for seventh format conversion character
   967         *  @param(a8)      value for eighth format conversion character
   968         */
   969        @Macro Void write8(Event evt, IArg a1, IArg a2, IArg a3, IArg a4,
   970                            IArg a5, IArg a6, IArg a7, IArg a8);
   971    
   972        /*!
   973         *  ======== doPrint ========
   974         *  Render an event as text via `{@link System#printf System_printf}`
   975         *
   976         *  This method is not gated and may make more than one call to
   977         *  `System_printf`.  This utility method is typically used within the
   978         *  implementation of a logger which initializes
   979         *  `{@link #EventRec Log_EventRec}` structures based on `Log` events
   980         *  produced by the application.
   981         *
   982         *  @param(evRec)   a non`NULL` pointer to an initialized `Log_EventRec`
   983         *                  structure to be formated via
   984         *                  `{@link System#printf System_printf}`.
   985         */
   986        Void doPrint(EventRec *evRec);
   987    
   988        /*!
   989         *  @_nodoc
   990         *  ======== lookupEventMessage ========
   991         *  Returns the format string for the event with the given id.
   992         */
   993        function lookupEventMessage(eventId);
   994    
   995        /*!
   996         *  @_nodoc
   997         *  ======== getTargetArgSize ========
   998         *  Returns the target size of a record argument in bytes (not MAUs).
   999         */
  1000        function getTargetArgSize();
  1001    
  1002        /*!
  1003         *  @_nodoc
  1004         *  ======== lookupEventName ========
  1005         */
  1006        function lookupEventName(eventId);
  1007    
  1008        /*!
  1009         *  @_nodoc
  1010         *  ======== lookupModuleName ========
  1011         */
  1012        function lookupModuleName(modId);
  1013    
  1014        /*!
  1015         *  @_nodoc
  1016         *  ======== getTargetEventRecSize ========
  1017         *  Returns the record size in bytes (not MAUs).
  1018         */
  1019        function getTargetEventRecSize();
  1020    
  1021    internal:
  1022    
  1023        /*
  1024         *  ======== idToInfo ========
  1025         *  Map event ID strings into a string of the form <eventName>::<eventMsg>
  1026         */
  1027        metaonly config String idToInfo[string] = [];
  1028        
  1029    }
  1030    /*
  1031     *  @(#) xdc.runtime; 2, 1, 0,298; 1-12-2011 10:12:28; /db/ztree/library/trees/xdc/xdc-v55x/src/packages/
  1032     */
  1033