op_prg_odb_print_major()
Abstract
Prints a sequence of strings to the standard output device, in the format of ODB trace statements starting at the major indentation level.
Syntax
op_prg_odb_print_major (string0, string1, …, OPC_NIL)
| Argument | Type | Description |
|---|---|---|
string0 |
const char* |
first string to print |
string1 |
const char* |
second string to print |
… |
const char* |
additional strings to print |
OPC_NIL |
string sequence terminator. [The arguments to this KP form a variable-length sequence of strings that are printed to the standard output device. The sequence is terminated by the symbolic constant OPC_NIL.] |
Return Type
void
No return value.
Example
Excerpt from: example model (std/tcp); process model (tcp); function block; function (tcp_state_info()).
sprintf (str0, "rcv requests pending : (%d)", num_rcvs_allowed);
sprintf (str1, "local receive window : (%d)", receive_window);
sprintf (str2, "remote receive window : (%d)", remote_window);
op_prg_odb_print_major ("Window-Related Variables", str0, str1, str2, OPC_NIL);
sprintf (str0, "send unacked : (%d)", send_unacked);
sprintf (str1, "send_next : (%d)", send_next);
sprintf (str2, "receive next : (%d)", receive_next);
op_prg_odb_print_minor (str0, str1, str2, OPC_NIL);
Example output as it appears on the standard output device:
| Window-Related Variables
| rcv requests pending : (3)
| local receive window : (6400)
| remote receive window : (10788)
| send unacked : (4525)
| send_next : (5000)
| receive_next : (1200)
Details
The alignment strategy of ODB trace statements is:
- Column 17: asterisks indicating KP invocations and vertical bars indicating user diagnostic statements printed by
op_prg_odb_print_major()or op_prg_odb_print_minor() - Column 25: arguments and return values of KP invocations, and the first string printed by
op_prg_odb_print_major()(i.e., the major level of indentation) - Column 33: the second through last strings printed by
op_prg_odb_print_major(), and all strings printed by op_prg_odb_print_minor() (i.e., the minor level of indentation)
Note: Only the first string passed to this KP appears at the major indentation level; all other string arguments appear at the minor indentation level.
This KP does nothing when used with an optimized simulation kernel.
Purpose
Provides a mechanism to print diagnostic messages in the standard format used by ODB trace statements. The major indentation level highlights a single summary or banner message which explains the diagnostic messages that follow. Note that this KP does not internally restrict its output when a simulation is not running under ODB, so invocations of this KP are usually embedded within conditional blocks that depend on traces being active in ODB (for example, as determined by op_prg_odb_trace_active(), op_prg_odb_ltrace_active(), or op_prg_odb_pktrace_active()).
Errors
- Program Abort: Segmentation violation due to one or more of the following conditions: (1) a string pointer is invalid; (2) a string is not null-terminated; (3) the sequence of strings is not terminated by the symbolic constant
OPC_NIL.
Reference
- Use the KP op_prg_odb_print_minor() to print trace information at the minor level of indentation
- Use the function
printf()to print to the standard device - Use the KP op_prg_odb_trace_active() to determine if a full or module trace is active
- Use the KP op_prg_odb_ltrace_active() to determine if a labeled trace is active
- Use the KP op_prg_odb_pktrace_active() to determine if a packet trace is active