/* COPYRIGHT (c) 1991 BY */ /* DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS. */ /* ALL RIGHTS RESERVED. */ /* */ /* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED*/ /* ONLY IN ACCORDANCE OF THE TERMS OF SUCH LICENSE AND WITH THE*/ /* INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER*/ /* COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY*/ /* OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY*/ /* TRANSFERRED. */ /* */ /* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE*/ /* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT*/ /* CORPORATION. */ /* */ /* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS*/ /* SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL. */ /* **++ ** FACILITY: SCA Example ** ** MODULE DESCRIPTION: ** ** This module contains code that touches the types defined in ** type_example.h which are used in examples of SCA's data structure ** display. It also contains a simple example of recursive routine ** calls used to demonstrate SCA's handling of recursion. ** ** AUTHORS: ** ** Walter ** ** CREATION DATE: 7-Aug-1991 ** ** DESIGN ISSUES: ** ** None ** **-- */ /* ** ** INCLUDE FILES ** */ #include "type_example.h" void type_example() { struct string_desc mystring ; struct ui_shell_info *shell_info ; struct query_context prev_query_ctx, next_query_ctx ; ui_user_data *user_data ; Widget window; int postition; char *string = "this is my string" ; int str_len = strlen (string) ; /* initialize a string */ mystring.desc_type = TYPE_D ; mystring.desc_class = CLASS_F ; mystring.desc_length = str_len ; mystring.ptr = string ; /* reference a field in each of the other structures */ user_data->parent_widget = window ; shell_info->x_position = 10 ; prev_query_ctx.query_ctx = &next_query_ctx ; return ; } /* A couple of quick routines to demonstrate recursion */ static void routine1 () ; static void routine2 () ; void routine1( x ) int x; { routine2 ( x-1 ) ; return ; } void routine2( y ) int y; { if (y > 100) { routine1( y/2 ) ; } if (y) { routine2( y-1 ) ; } return ; }