Source (C):

typedef int(*fp)(int i );

int foo(int i){}

int bar( int i) {}

void foobar() {

     fp pf;

     pf=foo;

     pf=bar;

     *pf(1);

     }

 

<?xml version="1.0" encoding="UTF-8"?>
<kdm:Segment xmi:version="2.1"

xmlns:xmi="http://www.omg.org/XMI"

xmlns:action="http://kdm.omg.org/action"

xmlns:code="http://kdm.omg.org/code"

xmlns:kdm="http://kdm.omg.org/kdm"

name="Dispatch Example">
 
<model xmi:id="id.0" xmi:type="code:CodeModel">
    <codeElement xmi:id="id.1" xmi:type="code:CompilationUnit" name="Dispatch.c">
     
<codeElement xmi:id="id.2" xmi:type="code:CallableUnit" name="foo" type="id.15" kind="regular">
        <codeRelation xmi:id="id.3" xmi:type="code:HasType" to="id.14" from="id.2"/>
        <codeElement xmi:id="id.4" xmi:type="code:Signature" name="foo">
          <parameterUnit xmi:id="id.5" name="a" type="id.13" pos="1"/>
          <parameterUnit xmi:id="id.6" type="id.13" kind="return"/>
        </codeElement>
      </codeElement>
      <codeElement xmi:id="id.7" xmi:type="code:CallableUnit" name="bar" type="id.15" kind="regular">
        <codeRelation xmi:id="id.8" xmi:type="code:HasType" to="id.14" from="id.7"/>
        <codeElement xmi:id="id.9" xmi:type="code:Signature" name="bar">
          <parameterUnit xmi:id="id.10" name="a" type="id.13"/>
          <parameterUnit xmi:id="id.11" type="id.13" kind="return"/>
       
</codeElement>
      </codeElement>
      <codeElement xmi:id="id.12" xmi:type="code:StorableUnit" name="pf" type="id.14"/>
      <codeElement xmi:id="id.13" xmi:type="code:IntegerType" name="int"/>
      <codeElement xmi:id="id.14" xmi:type="code:TypeUnit" name="fp" type="id.15">
        <codeElement xmi:id="id.15" xmi:type="code:Signature" name="f">
         
<parameterUnit xmi:id="id.16" name="a" type="id.13"/>
          <parameterUnit xmi:id="id.17" type="id.13" kind="return"/>
        </codeElement>
      </codeElement>
      <codeElement xmi:id="id.18" xmi:type="code:CallableUnit" name="foobar" type="id.33">
        <entryFlow xmi:id="id.19" to="id.20" from="id.18"/>
        <codeElement xmi:id="id.20" xmi:type="action:ActionElement" name="a1" kind="Assign">
          <actionRelation xmi:id="id.21" xmi:type="action:Addresses" to="id.2" from="id.20"/>
          <actionRelation xmi:id="id.22" xmi:type="action:Writes" to="id.12" from="id.20"/>
          <actionRelation xmi:id="id.23" xmi:type="action:Flow" to="id.24" from="id.20"/>
        </codeElement>
        <codeElement xmi:id="id.24" xmi:type="action:ActionElement" name="a2" kind="Assign">
          <actionRelation xmi:id="id.25" xmi:type="action:Addresses" to="id.2" from="id.24"/>
          <actionRelation xmi:id="id.26" xmi:type="action:Writes" to="id.12" from="id.24"/>
          <actionRelation xmi:id="id.27" xmi:type="action:Flow" to="id.28" from="id.24"/>
        </codeElement>
        <codeElement xmi:id="id.28" xmi:type="action:ActionElement" name="a3" kind="PtrCall">
          <codeElement xmi:id="id.29" xmi:type="code:Value" name="1" type="id.13"/>
          <actionRelation xmi:id="id.30" xmi:type="action:Reads" to="id.12" from="id.28"/>
          <actionRelation xmi:id="id.31" xmi:type="action:Reads" to="id.29" from="id.28"/>
          <actionRelation xmi:id="id.32" xmi:type="action:Dispatches" to="id.12" from="id.28"/>
       
</codeElement>
        <codeElement xmi:id="id.33" xmi:type="code:Signature" name="foobar"/>
      </codeElement>
    </codeElement>
 
</model>
</kdm:Segment>