| DocBook: The Definitive Guide 2.0.17 (Alpha)

# programlistingco

$Revision: 1666 $

$Date: 2002-06-12 07:19:37 -0400 (Wed, 12 Jun 2002) $

programlistingco — A program listing with associated areas used in callouts

## Synopsis

### Content Model

    programlistingco ::=
    (areaspec,programlisting,calloutlist*)

### Attributes

Common attributes

## Description

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 of 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 linebreaks 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.

### Parents

These elements contain programlistingco: `answer`, `appendix`, `article`, `bibliodiv`, `bibliography`, `blockquote`, `callout`, `caption`, `caution`, `chapter`, `colophon`, `constraintdef`, `dedication`, `entry`, `example`, `figure`, `footnote`, `glossary`, `glossdef`, `glossdiv`, `important`, `index`, `indexdiv`, `informalexample`, `informalfigure`, `itemizedlist`, `legalnotice`, `listitem`, `msgexplan`, `msgtext`, `note`, `orderedlist`, `para`, `partintro`, `preface`, `procedure`, `qandadiv`, `qandaset`, `question`, `refsect1`, `refsect2`, `refsect3`, `refsection`, `refsynopsisdiv`, `revdescription`, `sect1`, `sect2`, `sect3`, `sect4`, `sect5`, `section`, `setindex`, `sidebar`, `simplesect`, `step`, `taskprerequisites`, `taskrelated`, `tasksummary`, `td`, `textobject`, `th`, `tip`, `variablelist`, `warning`.

### Children

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

## See Also

`areaspec`, `calloutlist`, `co`, `coref`, `graphicco`, `imageobjectco`, `mediaobjectco`, `screenco`.

## Examples

    <!DOCTYPE programlistingco PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
              "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
    <programlistingco>
    <areaspec>
    <areaset id="ex.plco.const" coords="">
      <area id="ex.plco.c1" coords='4'/>
      <area id="ex.plco.c2" coords='8'/>
    </areaset>
    <area id="ex.plco.ret" coords='12'/>
    <area id="ex.plco.dest" coords='12'/>
    </areaspec>
    <programlisting>
    sub do_nothing_useful {
        my($a, $b, $c);

        $a = new A;

        $a->does_nothing_either();

        $b = new B;

        $c = "frog";

        return ($a, $c);
    }
    </programlisting>
    <calloutlist>
    <callout arearefs="ex.plco.const">
    <para>
    These are calls to the constructor <function>new</function> in the object
    classes.
    </para>
    </callout>
    <callout arearefs="ex.plco.ret">
    <para>
    This function returns a two-element list.
    </para>
    </callout>
    <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 to it outside this function.
    </para>
    </callout>
    </calloutlist>
    </programlistingco>

    sub do_nothing_useful {
        my($a, $b, $c);

        $a = new A;

        $a->does_nothing_either();

        $b = new B;

        $c = "frog";

        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.

programlisting |  | prompt

Copyright © 1999, 2000, 2001, 2002, 2003 O'Reilly & Associates, Inc. All rights reserved.