programlistingco — A program listing with associated areas used in callouts.


programlistingco ::=


Common attributes and common linking attributes.

No additional attributes.

Additional Constraints

  • If this element is the root element, it must have a version attribute.


Callouts, such as numbered bullets, are an annotation mechanism. In an online system, these bullets are frequently hot, and clicking on them sends you to the corresponding annotation.

A programlistingco is a wrapper around an areaspec and a programlisting. An areaspec identifies the locations (coordinates) in the programlisting where the callouts occur. The programlistingco may also contain the list of annotations in a calloutlist, although the calloutlist may also occur outside the wrapper, elsewhere in the document.

It is also possible to embed co elements directly in the verbatim text, in order to avoid having to calculate the correct coordinates. If you decided to go this route, use a programlisting and a calloutlist without the programlistingco wrapper. A programlistingco must specify at least one coordinate.

For a complete description of callouts, see callout.

Processing expectations

Formatted as a displayed block. This element is displayed “verbatim”; whitespace and line breaks within this element are significant.

The mandatory processing expectations of a programlistingco are minimal: a system is expected to render the program listing and the callout list, if present.

If explicit co elements are embedded in a programlisting, they must generate appropriate callout marks.

In online environments, the processing system may be able to instantiate the linking relationships between the callout marks in the program listing and the annotations. Some systems may even be able to go a step further and generate the callout marks automatically from the coordinate information, but this level of sophistication is not mandatory.


Common attributes and common linking attributes.

any attribute

Any attribute in any other explicit namespace


These elements contain programlistingco: abstract, acknowledgements, annotation, answer, appendix, article, bibliodiv, bibliography, bibliolist, blockquote, callout, calloutlist, caption (db.caption), caution, chapter, colophon, constraintdef, cover, danger, dedication, entry, example, figure, footnote, glossary, glossdef, glossdiv, glosslist, important, index, indexdiv, informalexample, informalfigure, itemizedlist, legalnotice, listitem, meta (db.meta.content), msgexplan, msgtext, note, orderedlist, para, partintro, preface, procedure, qandadiv, qandaset, question, refsect1, refsect2, refsect3, refsection, refsynopsisdiv, result, revdescription, sect1, sect2, sect3, sect4, sect5, section, setindex, sidebar, simplesect, step, taskprerequisites, taskrelated, tasksummary, td, textobject, th, tip, toc, tocdiv, topic, variablelist, warning.


The following elements occur in programlistingco: areaspec, calloutlist, info (, programlisting.

See Also

Related elements: areaspec, calloutlist, co, coref, imageobjectco, screenco.


 1 |<article xmlns=''>
   |<title>Example programlistingco</title>
 5 |<areaspec>
   |<areaset xml:id="ex.plco.const">
   |  <area xml:id="ex.plco.c1" coords='4'/>
   |  <area xml:id="ex.plco.c2" coords='8'/>
10 |<area xml:id="ex.plco.ret" coords='12'/>
   |<area xml:id="ex.plco.dest" coords='12'/>
   |sub do_nothing_useful {
15 |    my($a, $b, $c);
   |    $a = new A;
   |    $a->does_nothing_either();
   |    $b = new B; 
20 |    $c = "frog";
   |    return ($a, $c);
25 |<calloutlist>
   |  <callout arearefs="ex.plco.const">
   |    <para>These are calls to the constructor
   |      <function>new</function> in the object classes.
   |    </para>
30 |  </callout>
   |  <callout arearefs="ex.plco.ret">
   |    <para>This function returns a two-element list.
   |    </para>
   |  </callout>
35 |  <callout arearefs="ex.plco.dest">
   |    <para>The <emphasis>destructor</emphasis>
   |      (<function>DESTROY</function>) for the object
   |      <literal>$b</literal> will be called automatically
   |      for this object since there can be no other references
40 |      to it outside this function.
   |    </para>
   |  </callout>
45 | 
 1 | 
   |sub do_nothing_useful {
   |    my($a, $b, $c);
 5 |    $a = new A;
   |    $a->does_nothing_either();
   |    $b = new B; 
   |    $c = "frog";                                           
10 |    return ($a, $c);

These are calls to the constructor new in the object classes.

This function returns a two-element list.

The destructor (DESTROY) for the object $b will be called automatically for this object since there can be no other references to it outside this function.