| The section needing the example is the description of the
Operating System interface routines using absolute element
addresses.
/*
* Given an robot_info_t initialized with mrd_startup(3mrd)
* or mrd_show(3mrd), an element type and a relative element
* address, convert it to an absolute address.
*/
convert_relative(robot_info_t *robot_info, int type, int element)
{
switch( type )
case SLOT:
return element + robot_info->slot_start ;
case TRANSPORT:
return element + robot_info->transport_start ;
case DRIVE:
return element + robot_info->device_start ;
case PORT:
return element + robot_info->port_start ;
default:
return -1 ;
}
}
|