OSF DCE Application Development Guide--Core Components

OSF DCE Application Development Guide—Core Components
The STRING_TREE.IDL Example
[uuid(0144d600-2d28-11c9-a812-08002b0ecef1), version(0)]
interface string_tree
{
/*
* Maximum length of a string in the tree
*/
const long int st_c_name_len = 32;
/*
* Definition of a node in the tree.
*/
typedef struct node
{
[string] char name[0..st_c_name_len];
[ptr] struct node *left;
[ptr] struct node *right;
} st_node_t;
/*
* Operation that prunes the left subtree of the specified
* tree and returns it as the value.
*/
st_node_t *st_prune_left (
[in, out] st_node_t *tree /* root of tree by ref */
);
}
The CLIENT.C Example
#include <stdio.h>
#include "string_tree.h"
#include <stdlib.h>
/*
** Routine to print a depiction of the tree
*/
void st_print_tree (tree, indent)
st_node_t *tree;
int indent;
{
int i;
if (tree == NULL) return;
for (i = 0; i < indent; i++) printf(" ");
printf("%s\n",tree->name);
st_print_tree(tree->left, indent + 1);
st_print_tree(tree->right, indent + 1);
}
17 54 Tandem Computers Incorporated 124245