Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
120
cde/programs/dtappbuilder/src/libABil/Imakefile
Normal file
120
cde/programs/dtappbuilder/src/libABil/Imakefile
Normal file
@@ -0,0 +1,120 @@
|
||||
XCOMM $XConsortium: Imakefile /main/8 1996/10/09 14:03:24 drk $
|
||||
XCOMM
|
||||
XCOMM RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
XCOMM
|
||||
XCOMM The information in this document is subject to special
|
||||
XCOMM restrictions in a confidential disclosure agreement between
|
||||
XCOMM HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
XCOMM document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
XCOMM Sun's specific written approval. This document and all copies
|
||||
XCOMM and derivative works thereof must be returned or destroyed at
|
||||
XCOMM Sun's request.
|
||||
XCOMM
|
||||
XCOMM (c) Copyright 1996 Digital Equipment Corporation.
|
||||
XCOMM (c) Copyright 1996 Hewlett-Packard Company.
|
||||
XCOMM (c) Copyright 1996 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993,1996 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1996 Novell, Inc.
|
||||
XCOMM (c) Copyright 1996 FUJITSU LIMITED.
|
||||
XCOMM (c) Copyright 1996 Hitachi.
|
||||
|
||||
#define DoNormalLib YES
|
||||
#define DoSharedLib NO
|
||||
#define DoDebugLib NO
|
||||
#define DoProfileLib NO
|
||||
#define LibName ABil
|
||||
#define LibHeaders NO
|
||||
#define LibInstall NO
|
||||
|
||||
#include "../ab.tmpl"
|
||||
#include "../ab.rules"
|
||||
|
||||
INCLUDES = -I. -I$(ABINCLUDES)
|
||||
DEFINES =
|
||||
|
||||
SOURCES.h.shipped=
|
||||
|
||||
SOURCES.h.shared= \
|
||||
abuil_load.h \
|
||||
abuil_print.h \
|
||||
bil.h \
|
||||
bil_parse.h \
|
||||
gil.h
|
||||
|
||||
SOURCES.h.unshared= \
|
||||
abuil_loadP.h \
|
||||
bilP.h \
|
||||
bil_loadattP.h \
|
||||
gilP.h \
|
||||
gil_loadattP.h \
|
||||
loadP.h
|
||||
|
||||
SOURCES.l =
|
||||
|
||||
SOURCES.y = \
|
||||
bil_parse.y
|
||||
|
||||
SRCS = abuil_load.c abuil_print.c \
|
||||
abuil_resource_attr_map.c abuil_trav.c \
|
||||
abuil_widget_obj_map.c bil.c \
|
||||
bil_lexer.c bil_loadact.c \
|
||||
bil_loadatt.c bil_loadfile.c \
|
||||
bil_loadobj.c bil_parse.c \
|
||||
bil_store.c gil.c \
|
||||
gil_loadact.c gil_loadatt.c \
|
||||
gil_loadfile.c gil_loadobj.c \
|
||||
load.c
|
||||
|
||||
OBJS = abuil_load.o abuil_print.o \
|
||||
abuil_resource_attr_map.o abuil_trav.o \
|
||||
abuil_widget_obj_map.o bil.o \
|
||||
bil_lexer.o bil_loadact.o \
|
||||
bil_loadatt.o bil_loadfile.o \
|
||||
bil_loadobj.o bil_parse.o \
|
||||
bil_store.o gil.o \
|
||||
gil_loadact.o gil_loadatt.o \
|
||||
gil_loadfile.o gil_loadobj.o \
|
||||
load.o
|
||||
|
||||
SYS_LIBRARIES = -lm $(ICONVSYSLIB) $(DYNLIBSYSLIB) $(REGEXSYSLIB)
|
||||
|
||||
#ifdef SunArchitecture
|
||||
WAITTARGET = .WAIT
|
||||
#endif /* SunArchitecture */
|
||||
|
||||
LINTLIBS = $(XINPUTLIB) $(DTHELPLIB) $(DTSVCLIB) $(TTLIB) $(XMLIB) $(XTOOLLIB) $(XLIB)
|
||||
LOCAL_LIBRARIES = $(XINPUTLIB) $(DTHELPLIB) $(DTSVCLIB) $(TTLIB) $(XMLIB) $(XTOOLLIB) $(XLIB)
|
||||
|
||||
#include <Library.tmpl>
|
||||
|
||||
includes:: bil_parse.h
|
||||
|
||||
bil_parse.h + bil_parse.c: bil_parse.y
|
||||
$(YACC) -d $(YACCFLAGS) bil_parse.y
|
||||
${RM} bil_parse.h bil_parse.c
|
||||
sed -e "s/\([^A-Za-z]\)yy/\1AByy/g" -e "s/^yy/AByy/" < y.tab.h > bil_parse.h
|
||||
sed -e "s/\([^A-Za-z]\)yy/\1AByy/g" -e "s/^yy/AByy/" < y.tab.c > bil_parse.c
|
||||
${RM} y.tab.h y.tab.c
|
||||
|
||||
bil_lex.c: bil_lex.l
|
||||
$(LEX) bil_lex.l
|
||||
${RM} bil_lex.c
|
||||
sed -e "s/\([^A-Za-z]\)yy/\1AByy/g" -e "s/^yy/AByy/" < lex.yy.c > bil_lex.c
|
||||
${RM} lex.yy.c
|
||||
|
||||
DependTarget()
|
||||
|
||||
LOCAL_LIBRARIES= \
|
||||
./libABil.a \
|
||||
../libABobjXm/libABobjXm.a \
|
||||
../libABobj/libABobj.a \
|
||||
../libAButil/libAButil.a
|
||||
|
||||
bil_test: bil_test.o $(LOCAL_LIBRARIES)
|
||||
$(CC) $(CFLAGS) -o bil_test bil_test.o $(LOCAL_LIBRARIES)
|
||||
|
||||
LinkFileList(shared_includes,$(SOURCES.h.shared),../include/ab_private,../../libABil)
|
||||
|
||||
includes:: shared_includes $(WAITTARGET)
|
||||
sdtgilcvt: libABil.a
|
||||
dtcodegen: libABil.a
|
||||
15
cde/programs/dtappbuilder/src/libABil/README.src
Normal file
15
cde/programs/dtappbuilder/src/libABil/README.src
Normal file
@@ -0,0 +1,15 @@
|
||||
XCOMM $XConsortium: README.src /main/3 1996/04/23 20:03:48 drk $
|
||||
|
||||
Library: libABil
|
||||
|
||||
Description:
|
||||
|
||||
-------------------------------------------------------
|
||||
-------------------------------------------------------
|
||||
|
||||
Module Prefix Description
|
||||
------ ------ -----------------------
|
||||
AB I/O abil_
|
||||
BIL I/O bil_
|
||||
UIL I/O abuil_ Named abuil and not uil
|
||||
avoid clashes with libUil
|
||||
1503
cde/programs/dtappbuilder/src/libABil/abuil_load.c
Normal file
1503
cde/programs/dtappbuilder/src/libABil/abuil_load.c
Normal file
File diff suppressed because it is too large
Load Diff
36
cde/programs/dtappbuilder/src/libABil/abuil_load.h
Normal file
36
cde/programs/dtappbuilder/src/libABil/abuil_load.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* $XConsortium: abuil_load.h /main/3 1995/11/06 18:20:24 rswiston $
|
||||
*
|
||||
* %W% %G% cose/unity1/cde_app_builder/src/libABil
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
#ifndef _ABIL_LOAD_UIL_H
|
||||
#define _ABIL_LOAD_UIL_H
|
||||
|
||||
/*
|
||||
* This file declares the API of the uil load component
|
||||
*/
|
||||
#include <ab_private/obj.h>
|
||||
|
||||
extern ABObjPtr abuil_get_uil_file(
|
||||
STRING uil_file_path,
|
||||
ABObjPtr ab_project
|
||||
);
|
||||
|
||||
extern void abuil_trav_uil_tree(
|
||||
void *uil_root
|
||||
);
|
||||
|
||||
#endif /* _ABIL_LOAD_UIL_H */
|
||||
80
cde/programs/dtappbuilder/src/libABil/abuil_loadP.h
Normal file
80
cde/programs/dtappbuilder/src/libABil/abuil_loadP.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* $XConsortium: abuil_loadP.h /main/4 1995/11/06 18:20:38 rswiston $
|
||||
*
|
||||
* @(#)abuil_loadP.h 1.13 21 Feb 1994 cose/unity1/cde_app_builder/src/libABil
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
#ifndef _ABIL_LOAD_UIL_P_H
|
||||
#define _ABIL_LOAD_UIL_P_H
|
||||
|
||||
/*
|
||||
* This file defines private macros and datatypes used by the
|
||||
* uil file load component.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <Xm/Xm.h>
|
||||
|
||||
#include <ab_private/UilDef.h>
|
||||
#include <uil/UilDBDef.h>
|
||||
#include <uil/UilSymGl.h> /* For databases */
|
||||
|
||||
#include <ab_private/abuil_load.h>
|
||||
|
||||
#include <ab_private/trav.h>
|
||||
|
||||
#define MAX_LEN 255
|
||||
#define CLASS_SUFFIX "WidgetClass"
|
||||
#define APP_SHELL_CLASS "applicationShellWidgetClass"
|
||||
|
||||
#define BMASK(TYPE) (1L << ((unsigned int) (TYPE)))
|
||||
|
||||
|
||||
typedef ABObj (*ObjModifyProc)(char *classname, ABObj, ABObj);
|
||||
|
||||
typedef struct _WidgetABObjMapRec
|
||||
{
|
||||
char *widget_name;
|
||||
AB_OBJECT_TYPE obj_type;
|
||||
unsigned int sub_type;
|
||||
ObjModifyProc object_proc;
|
||||
ObjModifyProc child_proc;
|
||||
} WidgetABObjMap;
|
||||
|
||||
typedef struct _RefResolveRec
|
||||
{
|
||||
ABObj obj;
|
||||
AB_COMPASS_POINT dir;
|
||||
} RefResolve;
|
||||
|
||||
extern WidgetABObjMap *abuilP_entry_for_uil_widget(
|
||||
sym_widget_entry_type *uil_widget
|
||||
);
|
||||
extern BOOL abuilP_store_attr_in_abobj(
|
||||
ABObj obj,
|
||||
STRING res_name,
|
||||
AB_ARG_TYPE res_type,
|
||||
XtPointer res_value
|
||||
);
|
||||
extern void abuil_add_unresolved_ref(
|
||||
void *entry
|
||||
);
|
||||
extern void abuilP_init_context_attrs(
|
||||
void
|
||||
);
|
||||
extern void abuilP_store_context_attrs(
|
||||
ABObj ab_widget
|
||||
);
|
||||
|
||||
#endif /* _ABIL_LOAD_UIL_P_H */
|
||||
872
cde/programs/dtappbuilder/src/libABil/abuil_print.c
Normal file
872
cde/programs/dtappbuilder/src/libABil/abuil_print.c
Normal file
@@ -0,0 +1,872 @@
|
||||
/*
|
||||
* $XConsortium: abuil_print.c /main/4 1996/10/02 11:38:09 drk $
|
||||
*
|
||||
* @(#)abuil_print.c 1.30 19 Oct 1994 cose/unity1/cde_app_builder/src/libABil
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains the implementation of the uil print
|
||||
* component
|
||||
*/
|
||||
#include <ctype.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <ab_private/obj.h>
|
||||
#include <ab_private/trav.h>
|
||||
#include <ab_private/abio.h>
|
||||
#include <ab_private/objxm.h>
|
||||
#include <ab_private/istr.h>
|
||||
#include "abuil_print.h"
|
||||
#include "../libABobj/obj_utils.h"
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <Xm/XmStrDefs.h>
|
||||
#include <Xm/CascadeB.h>
|
||||
#include <Xm/ToggleB.h>
|
||||
#include <Xm/ScrolledW.h>
|
||||
#include <Dt/Term.h>
|
||||
#include <Dt/SpinBox.h>
|
||||
#include <Dt/ComboBox.h>
|
||||
|
||||
/*----------------------------------------*
|
||||
* Private macro definitions
|
||||
*----------------------------------------*/
|
||||
#define CLASS_SUFFIX "WidgetClass"
|
||||
#define GROUP_CLASS "groupWidgetClass"
|
||||
#define GROUP_SUBSTITUTE "XmBulletinBoard"
|
||||
#define INSTANCE_SUFFIX ""
|
||||
#define TABSP 4
|
||||
#define DBLSP (TABSP+TABSP)
|
||||
|
||||
/*----------------------------------------*
|
||||
* Private function prototypes
|
||||
*----------------------------------------*/
|
||||
|
||||
static int indent(
|
||||
FILE *fp,
|
||||
int spaces
|
||||
);
|
||||
static int print(
|
||||
ABObjPtr obj
|
||||
);
|
||||
static int print_indented(
|
||||
FILE *fp,
|
||||
ABObjPtr obj
|
||||
);
|
||||
static int print_tree(
|
||||
FILE *fp,
|
||||
ABObjPtr obj
|
||||
);
|
||||
static int print_tree_indented(
|
||||
FILE *fp,
|
||||
ABObjPtr obj
|
||||
);
|
||||
static int verify_tree(
|
||||
ABObjPtr root
|
||||
);
|
||||
|
||||
static int output_ui_arg(
|
||||
FILE *fp,
|
||||
ABObj obj,
|
||||
Arg *arg
|
||||
);
|
||||
|
||||
static int handle_dtterm(
|
||||
FILE *fp,
|
||||
ABObj obj
|
||||
);
|
||||
|
||||
static int handle_combo_box(
|
||||
FILE *fp,
|
||||
ABObj obj
|
||||
);
|
||||
|
||||
static int handle_spin_box(
|
||||
FILE *fp,
|
||||
ABObj obj
|
||||
);
|
||||
|
||||
static int handle_menu_button(
|
||||
FILE *fp,
|
||||
ABObj obj
|
||||
);
|
||||
|
||||
/*----------------------------------------
|
||||
* Write UIL for the project containing one AppBuilder interface.
|
||||
*
|
||||
* Not supported in the 1.0 Release:
|
||||
* Major things:
|
||||
* - Handle callbacks
|
||||
* Minor things:
|
||||
* - Convert names > 31 characters to something unique and < 31 chars
|
||||
* - Do something with messages other than ignoring them
|
||||
*/
|
||||
extern void
|
||||
abuil_obj_print_uil(
|
||||
FILE *fp,
|
||||
ABObjPtr ab_proj
|
||||
)
|
||||
{
|
||||
/*
|
||||
** The module we are about to export as UIL may have already been
|
||||
** configured and have build-mode UI args. We need to remove those
|
||||
** and set the UI args to be in CODEGEN mode.
|
||||
*/
|
||||
objxm_tree_remove_ui_args(ab_proj,OBJXM_CONFIG_BUILD);
|
||||
objxm_tree_set_ui_args(ab_proj,OBJXM_CONFIG_CODEGEN,TRUE);
|
||||
|
||||
/* Print the tree as UIL */
|
||||
print_tree(fp,ab_proj);
|
||||
|
||||
/* Now remove all the UI args we set */
|
||||
objxm_tree_remove_ui_args(ab_proj,OBJXM_CONFIG_CODEGEN);
|
||||
}
|
||||
|
||||
static int
|
||||
indent(
|
||||
FILE *fp,
|
||||
int spaces
|
||||
)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < spaces; ++i)
|
||||
putc(' ',fp);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static STRING
|
||||
fix_prefix_suffix(
|
||||
STRING widget_class_name
|
||||
)
|
||||
{
|
||||
static char s[1024];
|
||||
STRING m;
|
||||
STRING p;
|
||||
int n;
|
||||
int cl_len = strlen(CLASS_SUFFIX);
|
||||
|
||||
if (widget_class_name == NULL)
|
||||
return(util_strsafe(widget_class_name));
|
||||
|
||||
if (!strcmp(widget_class_name, GROUP_CLASS))
|
||||
return(GROUP_SUBSTITUTE);
|
||||
|
||||
/* Search for class suffix */
|
||||
p = NULL;
|
||||
m = strstr(widget_class_name, CLASS_SUFFIX);
|
||||
while (m != NULL)
|
||||
{
|
||||
p = m;
|
||||
m = strstr(m+cl_len, CLASS_SUFFIX);
|
||||
}
|
||||
if (p != NULL && *(p+cl_len) == '\0')
|
||||
n = p - widget_class_name;
|
||||
else
|
||||
n = strlen(widget_class_name);
|
||||
|
||||
/* Strip the class suffix */
|
||||
strncpy(s, widget_class_name, n);
|
||||
s[n] = 0;
|
||||
|
||||
/* Capitalize first char */
|
||||
s[0] = toupper(s[0]);
|
||||
return(s);
|
||||
}
|
||||
|
||||
static STRING
|
||||
suffixed(
|
||||
STRING widget_instance_name
|
||||
)
|
||||
{
|
||||
static char buf[1024];
|
||||
|
||||
if (widget_instance_name == NULL)
|
||||
return(util_strsafe(widget_instance_name));
|
||||
|
||||
strcpy(buf, widget_instance_name);
|
||||
strcat(buf, INSTANCE_SUFFIX);
|
||||
return(buf);
|
||||
}
|
||||
|
||||
static int
|
||||
print_indented(
|
||||
FILE *fp,
|
||||
ABObjPtr obj
|
||||
)
|
||||
{
|
||||
AB_TRAVERSAL trav;
|
||||
ABObjPtr child_obj = NULL;
|
||||
ArgList argList;
|
||||
Arg *arg = NULL;
|
||||
ABObj menu_ref, obj_obj, root_obj;
|
||||
char *child_class;
|
||||
|
||||
if (obj == NULL)
|
||||
{
|
||||
fprintf(fp,"! NULL Object");
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Skip over non-ui objects (e.g. connections) */
|
||||
if( !obj_is_ui(obj) ) return(0);
|
||||
|
||||
/* Skip over AB objects we don't map to UIL, namely:
|
||||
** - message objects
|
||||
** - menus (but we shouldn't skip menu-ref objects!)
|
||||
** - items for a combo box, list or spin box
|
||||
** - ApplicationShell objects
|
||||
** - Objects with the NoCodeGenFlag set
|
||||
*/
|
||||
if( obj_is_message(obj) ||
|
||||
(obj_is_menu(obj) && !obj_is_ref(obj)) ||
|
||||
obj_is_combo_box_item(obj) ||
|
||||
obj_is_list_item(obj) ||
|
||||
obj_is_spin_box_item(obj) ||
|
||||
(util_streq(obj_get_class_name(obj),_applicationShell) ||
|
||||
obj_has_flag(obj,NoCodeGenFlag) )
|
||||
) return(0);
|
||||
|
||||
/* Intercept non-UIL objects and call special-case handlers for them */
|
||||
if(obj_is_term_pane(obj)) {
|
||||
handle_dtterm(fp,obj);
|
||||
return(0);
|
||||
}
|
||||
if(util_streq(obj_get_class_name(obj),_dtSpinBox)) {
|
||||
handle_spin_box(fp,obj);
|
||||
return(0);
|
||||
}
|
||||
if(util_streq(obj_get_class_name(obj),_dtComboBox)) {
|
||||
handle_combo_box(fp,obj);
|
||||
return(0);
|
||||
}
|
||||
if(obj_is_menu_button(obj)) {
|
||||
handle_menu_button(fp,obj);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Write object instance declaration
|
||||
*/
|
||||
fprintf(fp,"\nobject\n");
|
||||
fprintf(fp,"%s:%s {\n",
|
||||
suffixed(obj_get_name(obj)),
|
||||
fix_prefix_suffix(obj_get_class_name(obj)));
|
||||
|
||||
/*
|
||||
** Special case handling for menus. App Builder support sharable menus
|
||||
** by creating just one instance of the menu itself and then attaching
|
||||
** special menu-reference objects as children of each object that uses the
|
||||
** sharable menu. (The menu-reference objects each point to the real menu
|
||||
** object.) Motif doesn't support this, so each time we find a menu-ref
|
||||
** object we have to write out in UIL a copy of the menu to which the
|
||||
** menu-ref points as a unique, separate menu with the same name (and
|
||||
** class) as the menu-ref object.
|
||||
*/
|
||||
if(obj_is_menu_ref(obj)) {
|
||||
menu_ref = obj; /* save the menu_ref obj */
|
||||
obj = obj_get_actual_obj(menu_ref); /* substitute the actual menu */
|
||||
}
|
||||
|
||||
argList = objxm_obj_get_ui_args(obj);
|
||||
|
||||
indent(fp,TABSP); fprintf(fp,"arguments {\n");
|
||||
for(arg=(Arg *)argList; (arg != NULL) && (arg->name != NULL); arg++) {
|
||||
output_ui_arg(fp,obj,arg);
|
||||
}
|
||||
|
||||
/*
|
||||
** Special case handling for Option Menus. The actual OptionMenu subobject
|
||||
** in the composite option menu ABObj must have its XmNsubMenuId resource
|
||||
** set to point to the PulldownMenu subobject.
|
||||
*/
|
||||
root_obj = obj_get_root(obj);
|
||||
if(obj_is_option_menu(root_obj)) {
|
||||
obj_obj = objxm_comp_get_subobj(root_obj,AB_CFG_OBJECT_OBJ);
|
||||
if(obj_obj == obj) {
|
||||
child_obj=objxm_comp_get_subobj(root_obj,AB_CFG_PARENT_OBJ);
|
||||
if(child_obj != (ABObj)NULL) {
|
||||
indent(fp,DBLSP);
|
||||
fprintf(fp,"XmNsubMenuId = %s ; \n",obj_get_name(child_obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* End of Arguments section */
|
||||
indent(fp,DBLSP); fprintf(fp,"};\n");
|
||||
|
||||
|
||||
trav_open(&trav, obj, AB_TRAV_CHILDREN);
|
||||
if ((child_obj = trav_next(&trav)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Write out controls section
|
||||
*/
|
||||
indent(fp,TABSP); fprintf(fp,"controls {\n");
|
||||
|
||||
do
|
||||
{
|
||||
/* Transform Dt type child to UIL-supported Xm type */
|
||||
if(obj_is_term_pane(child_obj)) {
|
||||
child_class = "XmText";
|
||||
}
|
||||
else if(util_streq(obj_get_class_name(child_obj),_dtSpinBox)) {
|
||||
child_class = "XmTextField";
|
||||
}
|
||||
else if(util_streq(obj_get_class_name(child_obj),_dtComboBox)) {
|
||||
child_class = "XmOptionMenu";
|
||||
}
|
||||
else if(obj_is_menu_button(child_obj)) {
|
||||
child_class = "XmPushButton";
|
||||
}
|
||||
else child_class = fix_prefix_suffix(obj_get_class_name(child_obj));
|
||||
|
||||
/* Now output the child reference */
|
||||
indent(fp,DBLSP);
|
||||
fprintf(fp,"%s %s;\n", child_class,
|
||||
suffixed(obj_get_name(child_obj)));
|
||||
}
|
||||
while ((child_obj = trav_next(&trav)) != NULL);
|
||||
|
||||
indent(fp,DBLSP); fprintf(fp,"};\n");
|
||||
}
|
||||
trav_close(&trav);
|
||||
|
||||
/*
|
||||
* Write out callbacks section
|
||||
*/
|
||||
indent(fp,TABSP); fprintf(fp,"callbacks {\n");
|
||||
indent(fp,DBLSP); fprintf(fp,"/* unimplemented */\n");
|
||||
indent(fp,DBLSP); fprintf(fp,"};\n");
|
||||
|
||||
fprintf(fp,"};\n");
|
||||
return(0);
|
||||
} /* print_indented */
|
||||
|
||||
|
||||
static int
|
||||
print_tree(
|
||||
FILE *fp,
|
||||
ABObjPtr obj
|
||||
)
|
||||
{
|
||||
int iRet = 0;
|
||||
|
||||
fprintf(fp,"! ***** Object tree *****\n");
|
||||
iRet = print_tree_indented(fp,obj);
|
||||
iRet = verify_tree(obj);
|
||||
if (iRet < 0)
|
||||
{
|
||||
fprintf(fp,"\n! ***\n! *** TREE IS CORRUPT!\n***");
|
||||
}
|
||||
fprintf(fp,"! ******* Tree End ******\n");
|
||||
return(iRet);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
print_tree_indented(
|
||||
FILE *fp,
|
||||
ABObjPtr obj
|
||||
)
|
||||
{
|
||||
AB_TRAVERSAL trav;
|
||||
ABObjPtr child_obj = NULL;
|
||||
|
||||
if (obj == NULL)
|
||||
{
|
||||
fprintf(fp,"! NULL Tree\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
switch (obj->type)
|
||||
{
|
||||
case AB_TYPE_PROJECT:
|
||||
for (trav_open(&trav, obj, AB_TRAV_CHILDREN);
|
||||
(child_obj = trav_next(&trav)) != NULL; )
|
||||
{
|
||||
print_tree_indented(fp,child_obj);
|
||||
}
|
||||
break;
|
||||
case AB_TYPE_MODULE:
|
||||
fprintf(fp,"module %s\n", nullstr(obj_get_name(obj)));
|
||||
fprintf(fp,"names = case_sensitive\n");
|
||||
|
||||
for (trav_open(&trav, obj, AB_TRAV_CHILDREN);
|
||||
(child_obj = trav_next(&trav)) != NULL; )
|
||||
{
|
||||
print_tree_indented(fp,child_obj);
|
||||
}
|
||||
fprintf(fp,"end module;\n");
|
||||
break;
|
||||
default:
|
||||
print_indented(fp,obj);
|
||||
for (trav_open(&trav, obj, AB_TRAV_CHILDREN);
|
||||
(child_obj = trav_next(&trav)) != NULL; )
|
||||
{
|
||||
print_tree_indented(fp,child_obj);
|
||||
}
|
||||
break;
|
||||
}
|
||||
trav_close(&trav);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int
|
||||
verify_tree(
|
||||
ABObjPtr root
|
||||
)
|
||||
{
|
||||
int ret_val = 0;
|
||||
AB_TRAVERSAL trav;
|
||||
ABObjPtr obj = NULL;
|
||||
ABObjPtr next_sibling = NULL;
|
||||
ABObjPtr prev_sibling = NULL;
|
||||
ABObjPtr parent = NULL;
|
||||
|
||||
if (root == NULL)
|
||||
{
|
||||
/* empty tree is valid (I guess) */
|
||||
return(0);
|
||||
}
|
||||
|
||||
for (trav_open(&trav, root, AB_TRAV_ALL);
|
||||
(obj = trav_next(&trav)) != NULL; )
|
||||
{
|
||||
next_sibling = obj->next_sibling;
|
||||
prev_sibling = obj->prev_sibling;
|
||||
parent = obj->parent;
|
||||
|
||||
if (next_sibling != NULL)
|
||||
{
|
||||
if (next_sibling->prev_sibling != obj)
|
||||
{
|
||||
ret_val = -1;
|
||||
fprintf(stderr, "Bad prev_sibling 0x%p %s\n",
|
||||
obj, nullstr(obj_get_name(obj)));
|
||||
}
|
||||
}
|
||||
|
||||
if (prev_sibling != NULL)
|
||||
{
|
||||
if (prev_sibling->next_sibling != obj)
|
||||
{
|
||||
ret_val = -1;
|
||||
fprintf(stderr, "Bad next_sibling 0x%p %s\n",
|
||||
obj, nullstr(obj_get_name(obj)));
|
||||
}
|
||||
}
|
||||
|
||||
if (parent != NULL)
|
||||
{
|
||||
AB_TRAVERSAL trav;
|
||||
ABObjPtr child;
|
||||
BOOL found = FALSE;
|
||||
|
||||
for (trav_open(&trav, parent, AB_TRAV_CHILDREN);
|
||||
(child = trav_next(&trav)) != NULL; )
|
||||
{
|
||||
if (child == obj)
|
||||
{
|
||||
found = TRUE;
|
||||
}
|
||||
}
|
||||
trav_close(&trav);
|
||||
if (!found)
|
||||
{
|
||||
ret_val = -1;
|
||||
fprintf(stderr,"Bad parent 0x%p %s\n",
|
||||
obj, nullstr(obj_get_name(obj)));
|
||||
}
|
||||
}
|
||||
}
|
||||
trav_close(&trav);
|
||||
|
||||
return(ret_val);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Generalized routine to output an object's UI argument. This is used to
|
||||
** fill in the 'arguments' section in the UIL definition for the object.
|
||||
*/
|
||||
static int
|
||||
output_ui_arg(FILE *fp, ABObj obj, Arg *arg)
|
||||
{
|
||||
ABObj module, attachObj;
|
||||
STRING attachObjName;
|
||||
|
||||
switch(objxm_get_res_type(arg->name)) {
|
||||
case AB_ARG_INT:
|
||||
indent(fp,DBLSP);
|
||||
fprintf(fp,"XmN%s = %d ;\n",arg->name,(int)(arg->value));
|
||||
break;
|
||||
case AB_ARG_STRING:
|
||||
indent(fp,DBLSP);
|
||||
fprintf(fp,"XmN%s = \"%s\" ;\n",arg->name,arg->value);
|
||||
break;
|
||||
case AB_ARG_BOOLEAN:
|
||||
/* REMIND: handle item obj's XmNset resource for an array */
|
||||
indent(fp,DBLSP);
|
||||
fprintf(fp,"XmN%s = %s ;\n",arg->name,
|
||||
((arg->value)?"true":"false") );
|
||||
break;
|
||||
case AB_ARG_PIXEL: /* istring */
|
||||
indent(fp,DBLSP);
|
||||
fprintf(fp,"XmN%s = color('%s') ;\n",arg->name,
|
||||
(arg->value != 0 ? (char *) istr_string((ISTRING)arg->value):"?")
|
||||
);
|
||||
break;
|
||||
case AB_ARG_PIXMAP: /* istring */
|
||||
indent(fp,DBLSP);
|
||||
fprintf(fp,"XmN%s = \"%s\" ;\n",arg->name,
|
||||
(char *) istr_string((ISTRING)arg->value));
|
||||
break;
|
||||
case AB_ARG_FONT:
|
||||
indent(fp,DBLSP);
|
||||
fprintf(fp,"XmN%s = \"%s\" ;\n",arg->name,arg->value);
|
||||
break;
|
||||
case AB_ARG_LITERAL: /* istring, but not quoted in output */
|
||||
indent(fp,DBLSP);
|
||||
fprintf(fp,"XmN%s = %s ;\n",arg->name,
|
||||
(char *) istr_string((ISTRING)arg->value));
|
||||
break;
|
||||
case AB_ARG_WIDGET: /* istring (object name, not widget) */
|
||||
if( (module = obj_get_module(obj)) == (ABObj)NULL) {
|
||||
fprintf(fp,"!Couldn't get module for arg %s\n",arg->name);
|
||||
break;
|
||||
}
|
||||
if((attachObjName = istr_string((ISTRING)arg->value)) == NULL) {
|
||||
fprintf(fp,"!Couldn't get attach obj name for %s\n",
|
||||
arg->name);
|
||||
break;
|
||||
}
|
||||
if( (attachObj=obj_scoped_find_by_name(module,attachObjName)) ==
|
||||
NULL) {
|
||||
fprintf(fp,"!Couldn't get attach obj for %s\n", arg->name);
|
||||
break;
|
||||
}
|
||||
if(attachObj != (ABObj)NULL) {
|
||||
indent(fp,DBLSP);
|
||||
fprintf(fp,"XmN%s = %s ;\n",arg->name,
|
||||
suffixed(obj_get_name(attachObj)));
|
||||
}
|
||||
break;
|
||||
case AB_ARG_XMSTRING: /* istring */
|
||||
indent(fp,DBLSP);
|
||||
fprintf(fp,"XmN%s = \"%s\" ;\n",arg->name,
|
||||
(char *) istr_string((ISTRING)arg->value));
|
||||
break;
|
||||
case AB_ARG_VOID_PTR:
|
||||
/* Only meaningful for rowcolumn's XmNentryClass resource */
|
||||
if(! util_streq(arg->name, XmNentryClass)) break;
|
||||
|
||||
indent(fp,DBLSP);
|
||||
fprintf(fp,"XmN%s = ",arg->name);
|
||||
if((WidgetClass)arg->value == xmCascadeButtonWidgetClass) {
|
||||
fprintf(fp,"\"xmCascadeButtonWidgetClass\" ;\n");
|
||||
}
|
||||
else if((WidgetClass)arg->value == xmScrolledWindowWidgetClass){
|
||||
fprintf(fp,"\"xmScrolledWindowWidgetClass\" ;\n");
|
||||
}
|
||||
else if((WidgetClass)arg->value == xmToggleButtonWidgetClass) {
|
||||
fprintf(fp,"\"xmToggleButtonWidgetClass\" ;\n");
|
||||
}
|
||||
else {
|
||||
fprintf(fp,"!! unrecognized XmNentryClass !!;\n");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf(fp,"! XmN%s = currently unsupported\n",arg->name);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
handle_dtterm(FILE *fp, ABObj obj)
|
||||
{
|
||||
ABObjPtr child_obj = NULL;
|
||||
ArgList argList;
|
||||
Arg *arg = NULL;
|
||||
|
||||
/*
|
||||
* Write object instance declaration, substituting XmText
|
||||
*/
|
||||
fprintf(fp,"\n! DtTerm object transformed into XmText\n");
|
||||
fprintf(fp,"object\n");
|
||||
fprintf(fp,"%s:XmText {\n", suffixed(obj_get_name(obj)));
|
||||
|
||||
argList = objxm_obj_get_ui_args(obj);
|
||||
|
||||
/*
|
||||
** Output DtTerm object arguments, mapping to XmText as we go.
|
||||
** There are two cases to be dealt with:
|
||||
** 1) DtTerm with a vertical scroll bar - This will yield an
|
||||
** XmScrolledWindow with a DtTerm child that has its
|
||||
** XmNverticalScrollBar resource set. XmText doesn't support
|
||||
** XmNverticalScrollBar, so we shouldn't output it. Also, we need to
|
||||
** make sure XmText is multi-line instead of the default single line.
|
||||
** 2) DtTerm with no vertical scrolling - Here we just get the DtTerm
|
||||
** and don't have to worry about scrollbars.
|
||||
** In both cases we also want to make sure we don't print the DtTerm's
|
||||
** DtNsubprocessCmd resource.
|
||||
*/
|
||||
|
||||
/* Process/filter the DtTerm ui_arg list */
|
||||
indent(fp,TABSP); fprintf(fp,"arguments {\n");
|
||||
for(arg=(Arg *)argList; (arg != NULL) && (arg->name != NULL); arg++) {
|
||||
/* Skip DtNsubprocessCmd resource */
|
||||
if(util_streq(arg->name, DtNsubprocessCmd)) continue;
|
||||
|
||||
/* Skip XmNverticalScrollBar resource */
|
||||
if(util_streq(arg->name, XmNverticalScrollBar)) continue;
|
||||
|
||||
output_ui_arg(fp,obj,arg);
|
||||
}
|
||||
|
||||
/* Add extra resources needed when you transform DtTerm into XmText */
|
||||
if(obj_has_vscrollbar(obj)) {
|
||||
fprintf(fp,"XmNedit_mode = XmMULTI_LINE_EDIT ;\n");
|
||||
}
|
||||
|
||||
indent(fp,DBLSP); fprintf(fp,"};\n");
|
||||
|
||||
/*
|
||||
** A DtTerm widget can't have children, so don't bother with a
|
||||
** 'controls' section
|
||||
*/
|
||||
|
||||
/*
|
||||
* Write out callbacks section
|
||||
*/
|
||||
indent(fp,TABSP); fprintf(fp,"callbacks {\n");
|
||||
indent(fp,DBLSP); fprintf(fp,"/* unimplemented */\n");
|
||||
indent(fp,DBLSP); fprintf(fp,"};\n");
|
||||
|
||||
fprintf(fp,"};\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int
|
||||
handle_combo_box(FILE *fp, ABObj obj)
|
||||
{
|
||||
ABObjPtr child_obj = NULL;
|
||||
ArgList argList;
|
||||
Arg *arg = NULL;
|
||||
AB_TRAVERSAL trav;
|
||||
char child_base_name[64], child_name_buf[64], *child_name;
|
||||
|
||||
/*
|
||||
* Write object instance declaration, substituting OptionMenu
|
||||
*/
|
||||
fprintf(fp,"\n! DtComboBox object transformed into XmOptionMenu\n");
|
||||
fprintf(fp,"object\n");
|
||||
fprintf(fp,"%s:XmOptionMenu {\n", suffixed(obj_get_name(obj)));
|
||||
|
||||
/* We need to create a XmPulldownMenu child for the OptionMenu */
|
||||
sprintf(child_base_name,"%s_pmenu",obj_get_name(obj));
|
||||
child_name = obj_get_unique_name(obj,child_base_name,64,child_name_buf);
|
||||
|
||||
argList = objxm_obj_get_ui_args(obj);
|
||||
|
||||
/* Process/filter the ui_arg list */
|
||||
indent(fp,TABSP); fprintf(fp,"arguments {\n");
|
||||
for(arg=(Arg *)argList; (arg != NULL) && (arg->name != NULL); arg++) {
|
||||
if(util_streq(arg->name, DtNcomboBoxType)) continue;
|
||||
|
||||
output_ui_arg(fp,obj,arg);
|
||||
}
|
||||
indent(fp,DBLSP); fprintf(fp,"XmNsubMenuId = %s ;\n",child_name);
|
||||
indent(fp,DBLSP); fprintf(fp,"};\n");
|
||||
|
||||
/* ComboBox is now an OptionMenu, which has one child - the PulldownMenu */
|
||||
indent(fp,TABSP); fprintf(fp,"controls {\n");
|
||||
indent(fp,DBLSP); fprintf(fp,"XmPulldownMenu %s ;\n",child_name);
|
||||
indent(fp,DBLSP); fprintf(fp,"};\n");
|
||||
|
||||
/*
|
||||
* Write out callbacks section
|
||||
*/
|
||||
indent(fp,TABSP); fprintf(fp,"callbacks {\n");
|
||||
indent(fp,DBLSP); fprintf(fp,"/* unimplemented */\n");
|
||||
indent(fp,DBLSP); fprintf(fp,"};\n");
|
||||
|
||||
/* End of OptionMenu object */
|
||||
fprintf(fp,"};\n");
|
||||
|
||||
|
||||
/* O.K., now we generate the PulldownMenu child */
|
||||
fprintf(fp,"\n! PulldownMenu synthesized as part of faux-DtComboBox\n");
|
||||
fprintf(fp,"object\n");
|
||||
fprintf(fp,"%s:XmPulldownMenu {\n", child_name);
|
||||
|
||||
/* No need for any arguments */
|
||||
indent(fp,TABSP); fprintf(fp,"arguments {\n");
|
||||
indent(fp,DBLSP); fprintf(fp,"};\n");
|
||||
|
||||
/*
|
||||
** Now we transform the combo box's children into items for the
|
||||
** PulldownMenu
|
||||
*/
|
||||
indent(fp,TABSP); fprintf(fp,"controls {\n");
|
||||
trav_open(&trav, obj, AB_TRAV_CHILDREN);
|
||||
if ((child_obj = trav_next(&trav)) != NULL)
|
||||
{
|
||||
do {
|
||||
indent(fp,DBLSP); fprintf(fp,"XmPushButton %s ;\n",
|
||||
suffixed(obj_get_name(child_obj)));
|
||||
}
|
||||
while ((child_obj = trav_next(&trav)) != NULL);
|
||||
}
|
||||
trav_close(&trav);
|
||||
indent(fp,DBLSP); fprintf(fp,"};\n");
|
||||
|
||||
/*
|
||||
* Write out callbacks section
|
||||
*/
|
||||
indent(fp,TABSP); fprintf(fp,"callbacks {\n");
|
||||
indent(fp,DBLSP); fprintf(fp,"/* unimplemented */\n");
|
||||
indent(fp,DBLSP); fprintf(fp,"};\n");
|
||||
|
||||
fprintf(fp,"};\n");
|
||||
|
||||
|
||||
/* Now generate the menu items themselves */
|
||||
trav_open(&trav, obj, AB_TRAV_CHILDREN);
|
||||
if ((child_obj = trav_next(&trav)) != NULL)
|
||||
{
|
||||
do {
|
||||
fprintf(fp,"\n! DtComboBox list item transformed into menu item\n");
|
||||
fprintf(fp,"object\n");
|
||||
fprintf(fp,"%s:XmPushButton {\n",suffixed(obj_get_name(child_obj)));
|
||||
|
||||
indent(fp,TABSP); fprintf(fp,"arguments {\n");
|
||||
indent(fp,DBLSP); fprintf(fp,"XmNlabelString = \"%s\" ;\n",
|
||||
obj_get_label(child_obj));
|
||||
indent(fp,DBLSP); fprintf(fp,"XmNlabelType = XmSTRING ;\n");
|
||||
indent(fp,DBLSP); fprintf(fp,"};\n");
|
||||
|
||||
/*Write out callbacks section */
|
||||
indent(fp,TABSP); fprintf(fp,"callbacks {\n");
|
||||
indent(fp,DBLSP); fprintf(fp,"/* unimplemented */\n");
|
||||
indent(fp,DBLSP); fprintf(fp,"};\n");
|
||||
|
||||
fprintf(fp,"};\n");
|
||||
}
|
||||
while ((child_obj = trav_next(&trav)) != NULL);
|
||||
}
|
||||
trav_close(&trav);
|
||||
|
||||
/* We're done... */
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
** Transform a DtSpinBox into a text field
|
||||
*/
|
||||
static int
|
||||
handle_spin_box(FILE *fp, ABObj obj)
|
||||
{
|
||||
ABObjPtr child_obj = NULL;
|
||||
ArgList argList;
|
||||
Arg *arg = NULL;
|
||||
|
||||
/*
|
||||
* Write object instance declaration, substituting TextField
|
||||
*/
|
||||
fprintf(fp,"\n! DtSpinBox object transformed into XmTextField\n");
|
||||
fprintf(fp,"object\n");
|
||||
fprintf(fp,"%s:XmTextField {\n", suffixed(obj_get_name(obj)));
|
||||
|
||||
argList = objxm_obj_get_ui_args(obj);
|
||||
|
||||
/* Process/filter the ui_arg list */
|
||||
indent(fp,TABSP); fprintf(fp,"arguments {\n");
|
||||
for(arg=(Arg *)argList; (arg != NULL) && (arg->name != NULL); arg++) {
|
||||
if(util_streq(arg->name, DtNspinBoxChildType)) continue;
|
||||
if(util_streq(arg->name, DtNminimumValue)) continue;
|
||||
if(util_streq(arg->name, DtNmaximumValue)) continue;
|
||||
if(util_streq(arg->name, DtNposition)) continue;
|
||||
if(util_streq(arg->name, DtNincrementValue)) continue;
|
||||
if(util_streq(arg->name, DtNarrowLayout)) continue;
|
||||
if(util_streq(arg->name, XmNdecimalPoints)) continue;
|
||||
|
||||
output_ui_arg(fp,obj,arg);
|
||||
}
|
||||
|
||||
indent(fp,DBLSP); fprintf(fp,"};\n");
|
||||
|
||||
/*
|
||||
** While a SpinBox has children, the XmTextField we map it to can't,
|
||||
** so just ignore the 'controls' section
|
||||
*/
|
||||
|
||||
/*
|
||||
* Write out callbacks section
|
||||
*/
|
||||
indent(fp,TABSP); fprintf(fp,"callbacks {\n");
|
||||
indent(fp,DBLSP); fprintf(fp,"/* unimplemented */\n");
|
||||
indent(fp,DBLSP); fprintf(fp,"};\n");
|
||||
fprintf(fp,"};\n");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int
|
||||
handle_menu_button(FILE *fp, ABObj obj)
|
||||
{
|
||||
ABObjPtr child_obj = NULL;
|
||||
ArgList argList;
|
||||
Arg *arg = NULL;
|
||||
|
||||
/*
|
||||
* Write object instance declaration, substituting OptionMenu
|
||||
*/
|
||||
fprintf(fp,"\n! DtMenuButton object transformed into XmPushButton\n");
|
||||
fprintf(fp,"object\n");
|
||||
fprintf(fp,"%s:XmPushButton {\n", suffixed(obj_get_name(obj)));
|
||||
|
||||
argList = objxm_obj_get_ui_args(obj);
|
||||
|
||||
/* Process/filter the ui_arg list */
|
||||
indent(fp,TABSP); fprintf(fp,"arguments {\n");
|
||||
for(arg=(Arg *)argList; (arg != NULL) && (arg->name != NULL); arg++) {
|
||||
|
||||
output_ui_arg(fp,obj,arg);
|
||||
}
|
||||
|
||||
indent(fp,DBLSP); fprintf(fp,"};\n");
|
||||
|
||||
/*
|
||||
* Write out callbacks section
|
||||
*/
|
||||
indent(fp,TABSP); fprintf(fp,"callbacks {\n");
|
||||
indent(fp,DBLSP); fprintf(fp,"/* unimplemented */\n");
|
||||
indent(fp,DBLSP); fprintf(fp,"};\n");
|
||||
|
||||
fprintf(fp,"};\n");
|
||||
return(0);
|
||||
}
|
||||
32
cde/programs/dtappbuilder/src/libABil/abuil_print.h
Normal file
32
cde/programs/dtappbuilder/src/libABil/abuil_print.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* $XConsortium: abuil_print.h /main/3 1995/11/06 18:21:09 rswiston $
|
||||
*
|
||||
* @(#)abuil_print.h 1.9 25 Aug 1994 cose/unity1/cde_app_builder/src/libABil
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
#ifndef _ABIL_PRINT_UIL_H
|
||||
#define _ABIL_PRINT_UIL_H
|
||||
|
||||
/*
|
||||
* This file declares the API for the print uil component
|
||||
*/
|
||||
#include <ab_private/obj.h>
|
||||
|
||||
extern void abuil_obj_print_uil(
|
||||
FILE *fp,
|
||||
ABObjPtr ab_project
|
||||
);
|
||||
|
||||
#endif /* _ABIL_PRINT_UIL_H */
|
||||
3955
cde/programs/dtappbuilder/src/libABil/abuil_resource_attr_map.c
Normal file
3955
cde/programs/dtappbuilder/src/libABil/abuil_resource_attr_map.c
Normal file
File diff suppressed because it is too large
Load Diff
1206
cde/programs/dtappbuilder/src/libABil/abuil_trav.c
Normal file
1206
cde/programs/dtappbuilder/src/libABil/abuil_trav.c
Normal file
File diff suppressed because it is too large
Load Diff
750
cde/programs/dtappbuilder/src/libABil/abuil_widget_obj_map.c
Normal file
750
cde/programs/dtappbuilder/src/libABil/abuil_widget_obj_map.c
Normal file
@@ -0,0 +1,750 @@
|
||||
/*
|
||||
* $XConsortium: abuil_widget_obj_map.c /main/3 1995/11/06 18:22:10 rswiston $
|
||||
*
|
||||
* @(#)abuil_widget_obj_map.c 1.24 31 Jan 1995
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* This file contains the mapping between uil widgets and ABObj's
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "abuil_loadP.h"
|
||||
|
||||
/*
|
||||
* Function prototypes
|
||||
*/
|
||||
static ABObj objp_type_button(char *, ABObj, ABObj);
|
||||
static ABObj childp_type_button(char *, ABObj, ABObj);
|
||||
static ABObj objp_type_choice(char *, ABObj, ABObj);
|
||||
static ABObj childp_type_choice(char *, ABObj, ABObj);
|
||||
static ABObj objp_type_compound(char *, ABObj, ABObj);
|
||||
static ABObj childp_type_compound(char *, ABObj, ABObj);
|
||||
static ABObj objp_type_container(char *, ABObj, ABObj);
|
||||
static ABObj childp_type_container(char *, ABObj, ABObj);
|
||||
static ABObj objp_type_dialog(char *, ABObj, ABObj);
|
||||
static ABObj childp_type_dialog(char *, ABObj, ABObj);
|
||||
static ABObj objp_type_drawing_area(char *, ABObj, ABObj);
|
||||
static ABObj childp_type_drawing_area(char *, ABObj, ABObj);
|
||||
static ABObj objp_type_label(char *, ABObj, ABObj);
|
||||
static ABObj childp_type_label(char *, ABObj, ABObj);
|
||||
static ABObj objp_type_list(char *, ABObj, ABObj);
|
||||
static ABObj childp_type_list(char *, ABObj, ABObj);
|
||||
static ABObj objp_type_menu(char *, ABObj, ABObj);
|
||||
static ABObj childp_type_menu(char *, ABObj, ABObj);
|
||||
static ABObj objp_type_separator(char *, ABObj, ABObj);
|
||||
static ABObj childp_type_separator(char *, ABObj, ABObj);
|
||||
static ABObj objp_type_scale(char *, ABObj, ABObj);
|
||||
static ABObj childp_type_scale(char *, ABObj, ABObj);
|
||||
static ABObj objp_type_text_field(char *, ABObj, ABObj);
|
||||
static ABObj childp_type_text_field(char *, ABObj, ABObj);
|
||||
static ABObj objp_type_text_pane(char *, ABObj, ABObj);
|
||||
static ABObj childp_type_text_pane(char *, ABObj, ABObj);
|
||||
static ABObj objp_type_unknown(char *, ABObj, ABObj);
|
||||
static ABObj childp_type_unknown(char *, ABObj, ABObj);
|
||||
|
||||
|
||||
static WidgetABObjMap
|
||||
widget_abobj_map[] =
|
||||
{
|
||||
{ "XmArrowButton",
|
||||
AB_TYPE_BUTTON, (unsigned int)AB_BUT_PUSH,
|
||||
objp_type_button, childp_type_button },
|
||||
{ "XmArrowButtonGadget",
|
||||
AB_TYPE_BUTTON, (unsigned int)AB_BUT_PUSH,
|
||||
objp_type_button, childp_type_button },
|
||||
{ "XmBulletinBoard",
|
||||
AB_TYPE_CONTAINER, (unsigned int)AB_CONT_ABSOLUTE,
|
||||
objp_type_container, childp_type_container },
|
||||
{ "XmBulletinBoardDialog",
|
||||
AB_TYPE_DIALOG, (unsigned int)AB_DLG_CUSTOM,
|
||||
objp_type_dialog, childp_type_dialog },
|
||||
{ "XmCascadeButton",
|
||||
AB_TYPE_BUTTON, (unsigned int)AB_BUT_PUSH,
|
||||
objp_type_button, childp_type_button },
|
||||
{ "XmCascadeButtonGadget",
|
||||
AB_TYPE_BUTTON, (unsigned int)AB_BUT_PUSH,
|
||||
objp_type_button, childp_type_button },
|
||||
{ "XmCommand",
|
||||
AB_TYPE_UNKNOWN, (unsigned int)0,
|
||||
objp_type_compound, childp_type_compound },
|
||||
{ "XmDialogShell",
|
||||
AB_TYPE_DIALOG, (unsigned int)AB_DLG_CUSTOM,
|
||||
objp_type_dialog, childp_type_dialog },
|
||||
{ "XmDrawingArea",
|
||||
AB_TYPE_DRAWING_AREA, (unsigned int)0,
|
||||
objp_type_drawing_area, childp_type_drawing_area },
|
||||
{ "XmDrawnButton",
|
||||
AB_TYPE_BUTTON, (unsigned int)AB_BUT_PUSH,
|
||||
objp_type_button, childp_type_button },
|
||||
{ "XmErrorDialog",
|
||||
AB_TYPE_DIALOG, (unsigned int)AB_DLG_BUILTIN,
|
||||
objp_type_dialog, childp_type_dialog },
|
||||
{ "XmFileSelectionBox",
|
||||
AB_TYPE_FILE_CHOOSER, (unsigned int) 0,
|
||||
objp_type_compound, childp_type_compound },
|
||||
{ "XmFileSelectionDialog",
|
||||
AB_TYPE_DIALOG, (unsigned int)AB_DLG_BUILTIN,
|
||||
objp_type_dialog, childp_type_dialog },
|
||||
{ "XmForm",
|
||||
AB_TYPE_CONTAINER, (unsigned int)AB_CONT_RELATIVE,
|
||||
objp_type_container, childp_type_container },
|
||||
{ "XmFormDialog",
|
||||
AB_TYPE_DIALOG, (unsigned int)AB_DLG_CUSTOM,
|
||||
objp_type_dialog, childp_type_dialog },
|
||||
{ "XmFrame",
|
||||
AB_TYPE_UNKNOWN, (unsigned int)AB_TYPE_UNKNOWN,
|
||||
objp_type_unknown, childp_type_unknown },
|
||||
{ "XmInformationDialog",
|
||||
AB_TYPE_DIALOG, (unsigned int)AB_DLG_BUILTIN,
|
||||
objp_type_dialog, childp_type_dialog },
|
||||
{ "XmLabel",
|
||||
AB_TYPE_LABEL, (unsigned int)0,
|
||||
objp_type_label, childp_type_label },
|
||||
{ "XmLabelGadget",
|
||||
AB_TYPE_LABEL, (unsigned int)0,
|
||||
objp_type_label, childp_type_label },
|
||||
{ "XmList",
|
||||
AB_TYPE_LIST, (unsigned int)0,
|
||||
objp_type_list, childp_type_list },
|
||||
{ "XmMainWindow",
|
||||
AB_TYPE_CONTAINER, (unsigned int)AB_CONT_MAIN_WINDOW,
|
||||
objp_type_container, childp_type_container },
|
||||
{ "XmMenuBar",
|
||||
AB_TYPE_CONTAINER, (unsigned int)AB_CONT_MENU_BAR,
|
||||
objp_type_container, childp_type_container },
|
||||
{ "XmMenuShell",
|
||||
AB_TYPE_UNKNOWN, (unsigned int)0,
|
||||
objp_type_unknown, childp_type_unknown },
|
||||
{ "XmMessageBox",
|
||||
AB_TYPE_MESSAGE, (unsigned int)0,
|
||||
objp_type_compound, childp_type_compound },
|
||||
{ "XmMessageDialog",
|
||||
AB_TYPE_DIALOG, (unsigned int)AB_DLG_BUILTIN,
|
||||
objp_type_dialog, childp_type_dialog },
|
||||
{ "XmOptionMenu",
|
||||
AB_TYPE_CHOICE, (unsigned int)AB_CHOICE_OPTION_MENU,
|
||||
objp_type_choice, childp_type_choice },
|
||||
{ "XmPanedWindow",
|
||||
AB_TYPE_CONTAINER, (unsigned int)AB_CONT_PANED,
|
||||
objp_type_container, childp_type_container },
|
||||
{ "XmPopupMenu",
|
||||
AB_TYPE_MENU, (unsigned int)AB_MENU_POPUP,
|
||||
objp_type_menu, childp_type_menu },
|
||||
{ "XmPromptDialog",
|
||||
AB_TYPE_DIALOG, (unsigned int)AB_DLG_BUILTIN,
|
||||
objp_type_dialog, childp_type_dialog },
|
||||
{ "XmPulldownMenu",
|
||||
AB_TYPE_MENU, (unsigned int)AB_MENU_PULLDOWN,
|
||||
objp_type_menu, childp_type_menu },
|
||||
{ "XmPushButton",
|
||||
AB_TYPE_BUTTON, (unsigned int)AB_BUT_PUSH,
|
||||
objp_type_button, childp_type_button },
|
||||
{ "XmPushButtonGadget",
|
||||
AB_TYPE_BUTTON, (unsigned int)AB_BUT_PUSH,
|
||||
objp_type_button, childp_type_button },
|
||||
{ "XmQuestionDialog",
|
||||
AB_TYPE_DIALOG, (unsigned int)AB_DLG_BUILTIN,
|
||||
objp_type_dialog, childp_type_dialog },
|
||||
{ "XmRadioBox",
|
||||
AB_TYPE_CHOICE, (unsigned int)AB_CHOICE_EXCLUSIVE,
|
||||
objp_type_choice, childp_type_choice },
|
||||
{ "XmRowColumn",
|
||||
AB_TYPE_CONTAINER, (unsigned int)AB_CONT_ROW_COLUMN,
|
||||
objp_type_container, childp_type_container },
|
||||
{ "XmScale",
|
||||
AB_TYPE_SCALE, (unsigned int)0,
|
||||
objp_type_scale, childp_type_scale },
|
||||
{ "XmScrollBar",
|
||||
AB_TYPE_UNKNOWN, (unsigned int)AB_TYPE_UNKNOWN,
|
||||
objp_type_unknown, childp_type_unknown },
|
||||
{ "XmScrolledList",
|
||||
AB_TYPE_LIST, (unsigned int)0,
|
||||
objp_type_list, childp_type_list },
|
||||
{ "XmScrolledText",
|
||||
AB_TYPE_TEXT_PANE, (unsigned int)AB_TEXT_ALPHANUMERIC,
|
||||
objp_type_text_pane, childp_type_text_pane },
|
||||
{ "XmScrolledWindow",
|
||||
AB_TYPE_UNKNOWN, (unsigned int)AB_TYPE_UNKNOWN,
|
||||
objp_type_unknown, childp_type_unknown },
|
||||
{ "XmSelectionBox",
|
||||
AB_TYPE_UNKNOWN, (unsigned int)0,
|
||||
objp_type_compound, childp_type_compound },
|
||||
{ "XmSelectionDialog",
|
||||
AB_TYPE_DIALOG, (unsigned int)AB_DLG_BUILTIN,
|
||||
objp_type_dialog, childp_type_dialog },
|
||||
{ "XmSeparator",
|
||||
AB_TYPE_SEPARATOR, (unsigned int)0,
|
||||
objp_type_separator, childp_type_separator },
|
||||
{ "XmSeparatorGadget",
|
||||
AB_TYPE_SEPARATOR, (unsigned int)0,
|
||||
objp_type_separator, childp_type_separator },
|
||||
{ "XmTearOffButton",
|
||||
AB_TYPE_BUTTON, (unsigned int)0,
|
||||
objp_type_button, childp_type_button },
|
||||
{ "XmTemplateDialog",
|
||||
AB_TYPE_DIALOG, (unsigned int)AB_DLG_BUILTIN,
|
||||
objp_type_dialog, childp_type_dialog },
|
||||
{ "XmText",
|
||||
AB_TYPE_TEXT_PANE, (unsigned int)AB_TEXT_ALPHANUMERIC,
|
||||
objp_type_text_pane, childp_type_text_pane },
|
||||
{ "XmTextField",
|
||||
AB_TYPE_TEXT_FIELD, (unsigned int)AB_TEXT_ALPHANUMERIC,
|
||||
objp_type_text_field, childp_type_text_field },
|
||||
{ "XmToggleButton",
|
||||
AB_TYPE_BUTTON, (unsigned int)AB_BUT_PUSH,
|
||||
objp_type_button, childp_type_button },
|
||||
{ "XmToggleButtonGadget",
|
||||
AB_TYPE_BUTTON, (unsigned int)AB_BUT_PUSH,
|
||||
objp_type_button, childp_type_button },
|
||||
{ "XmWarningDialog",
|
||||
AB_TYPE_DIALOG, (unsigned int)AB_DLG_BUILTIN,
|
||||
objp_type_dialog, childp_type_dialog },
|
||||
{ "XmWorkArea",
|
||||
AB_TYPE_CONTAINER, (unsigned int)AB_CONT_ROW_COLUMN,
|
||||
objp_type_container, childp_type_container },
|
||||
{ "XmWorkingDialog",
|
||||
AB_TYPE_DIALOG, (unsigned int)AB_DLG_BUILTIN,
|
||||
objp_type_dialog, childp_type_dialog },
|
||||
};
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
main(
|
||||
int argc,
|
||||
char **argv
|
||||
)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < XtNumber(widget_abobj_map); i++)
|
||||
{
|
||||
int j;
|
||||
WidgetABObjMap *this_map = &(widget_abobj_map[i]);
|
||||
|
||||
printf("%s %d %d\n", this_map->widget_name,
|
||||
this_map->obj_type, this_map->sub_type);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* TEST */
|
||||
|
||||
|
||||
extern WidgetABObjMap *
|
||||
abuilP_entry_for_uil_widget(
|
||||
sym_widget_entry_type *uil_widget
|
||||
)
|
||||
{
|
||||
int b_type = uil_widget->header.b_type;
|
||||
|
||||
if (b_type > sym_k_error_object)
|
||||
{
|
||||
register int i;
|
||||
STRING widget_class_name = uil_widget_names[b_type];
|
||||
|
||||
for (i = 0; i < XtNumber(widget_abobj_map); i++)
|
||||
if (!strcmp(widget_abobj_map[i].widget_name, widget_class_name))
|
||||
return(&(widget_abobj_map[i]));
|
||||
}
|
||||
return((WidgetABObjMap *)NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* objp_type_button:
|
||||
*/
|
||||
static ABObj
|
||||
objp_type_button(
|
||||
char * class_name,
|
||||
ABObj parent,
|
||||
ABObj object
|
||||
)
|
||||
{
|
||||
ABObj ret_val = (ABObj)NULL;
|
||||
|
||||
if (obj_is_container(parent) || obj_is_menu(parent))
|
||||
{
|
||||
obj_set_is_initially_active(object, TRUE);
|
||||
ret_val = object;
|
||||
}
|
||||
return(ret_val);
|
||||
}
|
||||
|
||||
/*
|
||||
* childp_type_button:
|
||||
*/
|
||||
static ABObj
|
||||
childp_type_button(
|
||||
char * class_name,
|
||||
ABObj object,
|
||||
ABObj child
|
||||
)
|
||||
{
|
||||
return(child);
|
||||
}
|
||||
|
||||
/*
|
||||
* objp_type_choice:
|
||||
*/
|
||||
static ABObj
|
||||
objp_type_choice(
|
||||
char * class_name,
|
||||
ABObj parent,
|
||||
ABObj object
|
||||
)
|
||||
{
|
||||
ABObj ret_val = (ABObj)NULL;
|
||||
|
||||
if (obj_is_container(parent))
|
||||
{
|
||||
obj_set_class_name(object, "xmRowColumnWidgetClass");
|
||||
obj_set_num_columns(object, 1);
|
||||
ret_val = object;
|
||||
}
|
||||
return(ret_val);
|
||||
}
|
||||
|
||||
/*
|
||||
* childp_type_choice:
|
||||
*/
|
||||
static ABObj
|
||||
childp_type_choice(
|
||||
char * class_name,
|
||||
ABObj object,
|
||||
ABObj child
|
||||
)
|
||||
{
|
||||
/*
|
||||
* Skip menu child of option menu
|
||||
*/
|
||||
if (obj_get_subtype(object) == AB_CHOICE_OPTION_MENU &&
|
||||
obj_is_menu(child))
|
||||
return(NULL);
|
||||
|
||||
obj_set_type(child, AB_TYPE_ITEM);
|
||||
obj_set_subtype(child, AB_ITEM_FOR_CHOICE);
|
||||
return(child);
|
||||
}
|
||||
|
||||
/*
|
||||
* objp_type_compound:
|
||||
*/
|
||||
static ABObj
|
||||
objp_type_compound(
|
||||
char * class_name,
|
||||
ABObj parent,
|
||||
ABObj object
|
||||
)
|
||||
{
|
||||
return(object);
|
||||
}
|
||||
|
||||
/*
|
||||
* childp_type_compound:
|
||||
*/
|
||||
static ABObj
|
||||
childp_type_compound(
|
||||
char * class_name,
|
||||
ABObj object,
|
||||
ABObj child
|
||||
)
|
||||
{
|
||||
return(child);
|
||||
}
|
||||
|
||||
/*
|
||||
* objp_type_container:
|
||||
*/
|
||||
static ABObj
|
||||
objp_type_container(
|
||||
char * class_name,
|
||||
ABObj parent,
|
||||
ABObj object
|
||||
)
|
||||
{
|
||||
if (obj_get_subtype(object) != (int)AB_CONT_MENU_BAR)
|
||||
{
|
||||
if (obj_is_module(parent))
|
||||
obj_set_type(object, AB_TYPE_BASE_WINDOW);
|
||||
else if (!obj_is_module(obj_get_parent(parent)))
|
||||
{
|
||||
/* Only time we have control panels is when
|
||||
* it is a child of the main window or dialog
|
||||
* which is always rooted at the module
|
||||
*/
|
||||
obj_set_subtype(object, AB_CONT_GROUP);
|
||||
obj_set_group_type(object, AB_GROUP_ROWSCOLUMNS);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* REMIND: jit
|
||||
* Temporary until we support all types of containers
|
||||
obj_set_class_name(object, "xmBulletinBoardWidgetClass");
|
||||
*/
|
||||
|
||||
return(object);
|
||||
}
|
||||
|
||||
/*
|
||||
* childp_type_container:
|
||||
*/
|
||||
static ABObj
|
||||
childp_type_container(
|
||||
char * class_name,
|
||||
ABObj object,
|
||||
ABObj child
|
||||
)
|
||||
{
|
||||
if (obj_get_subtype(object) == (int)AB_CONT_MENU_BAR)
|
||||
{
|
||||
obj_set_type(child, AB_TYPE_ITEM);
|
||||
obj_set_subtype(child, (int)AB_ITEM_FOR_MENUBAR);
|
||||
if (obj_get_label(child) == (STRING)NULL)
|
||||
obj_set_label(child, obj_get_name(child));
|
||||
}
|
||||
return(child);
|
||||
}
|
||||
|
||||
/*
|
||||
* objp_type_dialog:
|
||||
*/
|
||||
static ABObj
|
||||
objp_type_dialog(
|
||||
char * class_name,
|
||||
ABObj parent,
|
||||
ABObj object
|
||||
)
|
||||
{
|
||||
/*
|
||||
* REMIND: jit
|
||||
* Temporary until we support all types of containers
|
||||
*/
|
||||
obj_set_class_name(object, "xmDialogShellWidgetClass");
|
||||
|
||||
return(object);
|
||||
}
|
||||
|
||||
/*
|
||||
* childp_type_dialog:
|
||||
*/
|
||||
static ABObj
|
||||
childp_type_dialog(
|
||||
char * class_name,
|
||||
ABObj object,
|
||||
ABObj child
|
||||
)
|
||||
{
|
||||
return(child);
|
||||
}
|
||||
|
||||
/*
|
||||
* objp_type_drawing_area:
|
||||
*/
|
||||
static ABObj
|
||||
objp_type_drawing_area(
|
||||
char * class_name,
|
||||
ABObj parent,
|
||||
ABObj object
|
||||
)
|
||||
{
|
||||
return(object);
|
||||
}
|
||||
|
||||
/*
|
||||
* childp_type_drawing_area:
|
||||
*/
|
||||
static ABObj
|
||||
childp_type_drawing_area(
|
||||
char * class_name,
|
||||
ABObj object,
|
||||
ABObj child
|
||||
)
|
||||
{
|
||||
return(child);
|
||||
}
|
||||
|
||||
/*
|
||||
* objp_type_label:
|
||||
*/
|
||||
static ABObj
|
||||
objp_type_label(
|
||||
char * class_name,
|
||||
ABObj parent,
|
||||
ABObj object
|
||||
)
|
||||
{
|
||||
ABObj ret_val = (ABObj)NULL;
|
||||
|
||||
if (obj_is_container(parent))
|
||||
{
|
||||
ret_val = object;
|
||||
}
|
||||
return(ret_val);
|
||||
}
|
||||
|
||||
/*
|
||||
* childp_type_label:
|
||||
*/
|
||||
static ABObj
|
||||
childp_type_label(
|
||||
char * class_name,
|
||||
ABObj object,
|
||||
ABObj child
|
||||
)
|
||||
{
|
||||
return(child);
|
||||
}
|
||||
|
||||
/*
|
||||
* objp_type_list:
|
||||
*/
|
||||
static ABObj
|
||||
objp_type_list(
|
||||
char * class_name,
|
||||
ABObj parent,
|
||||
ABObj object
|
||||
)
|
||||
{
|
||||
ABObj ret_val = (ABObj)NULL;
|
||||
|
||||
if (obj_is_container(parent))
|
||||
{
|
||||
ret_val = object;
|
||||
}
|
||||
return(ret_val);
|
||||
}
|
||||
|
||||
/*
|
||||
* childp_type_list:
|
||||
*/
|
||||
static ABObj
|
||||
childp_type_list(
|
||||
char * class_name,
|
||||
ABObj object,
|
||||
ABObj child
|
||||
)
|
||||
{
|
||||
return(child);
|
||||
}
|
||||
|
||||
/*
|
||||
* objp_type_menu:
|
||||
*/
|
||||
static ABObj
|
||||
objp_type_menu(
|
||||
char * class_name,
|
||||
ABObj parent,
|
||||
ABObj object
|
||||
)
|
||||
{
|
||||
obj_set_menu_name(parent, obj_get_name(object));
|
||||
obj_reparent(object, obj_get_module(object));
|
||||
return(object);
|
||||
}
|
||||
|
||||
/*
|
||||
* childp_type_menu:
|
||||
*/
|
||||
static ABObj
|
||||
childp_type_menu(
|
||||
char * class_name,
|
||||
ABObj object,
|
||||
ABObj child
|
||||
)
|
||||
{
|
||||
obj_set_type(child, AB_TYPE_ITEM);
|
||||
obj_set_subtype(child, AB_ITEM_FOR_MENU);
|
||||
if (obj_get_label(child) == (STRING)NULL)
|
||||
obj_set_label(child, obj_get_name(child));
|
||||
return(child);
|
||||
}
|
||||
|
||||
/*
|
||||
* objp_type_separator:
|
||||
*/
|
||||
static ABObj
|
||||
objp_type_separator(
|
||||
char * class_name,
|
||||
ABObj parent,
|
||||
ABObj object
|
||||
)
|
||||
{
|
||||
ABObj ret_val = (ABObj)NULL;
|
||||
|
||||
if (obj_is_container(parent))
|
||||
{
|
||||
obj_set_line_style(object, AB_LINE_ETCHED_IN);
|
||||
ret_val = object;
|
||||
}
|
||||
return(ret_val);
|
||||
}
|
||||
|
||||
/*
|
||||
* childp_type_separator:
|
||||
*/
|
||||
static ABObj
|
||||
childp_type_separator(
|
||||
char * class_name,
|
||||
ABObj object,
|
||||
ABObj child
|
||||
)
|
||||
{
|
||||
return(child);
|
||||
}
|
||||
|
||||
/*
|
||||
* objp_type_scale:
|
||||
*/
|
||||
static ABObj
|
||||
objp_type_scale(
|
||||
char * class_name,
|
||||
ABObj parent,
|
||||
ABObj object
|
||||
)
|
||||
{
|
||||
ABObj ret_val = (ABObj)NULL;
|
||||
|
||||
if (obj_is_container(parent))
|
||||
{
|
||||
ret_val = object;
|
||||
}
|
||||
return(ret_val);
|
||||
}
|
||||
|
||||
/*
|
||||
* childp_type_scale:
|
||||
*/
|
||||
static ABObj
|
||||
childp_type_scale(
|
||||
char * class_name,
|
||||
ABObj object,
|
||||
ABObj child
|
||||
)
|
||||
{
|
||||
return(child);
|
||||
}
|
||||
|
||||
/*
|
||||
* objp_type_text_field:
|
||||
*/
|
||||
static ABObj
|
||||
objp_type_text_field(
|
||||
char * class_name,
|
||||
ABObj parent,
|
||||
ABObj object
|
||||
)
|
||||
{
|
||||
ABObj ret_val = (ABObj)NULL;
|
||||
|
||||
if (obj_is_container(parent))
|
||||
{
|
||||
ret_val = object;
|
||||
}
|
||||
return(ret_val);
|
||||
}
|
||||
|
||||
/*
|
||||
* childp_type_text_field:
|
||||
*/
|
||||
static ABObj
|
||||
childp_type_text_field(
|
||||
char * class_name,
|
||||
ABObj object,
|
||||
ABObj child
|
||||
)
|
||||
{
|
||||
return(child);
|
||||
}
|
||||
|
||||
/*
|
||||
* objp_type_text_pane:
|
||||
*/
|
||||
static ABObj
|
||||
objp_type_text_pane(
|
||||
char * class_name,
|
||||
ABObj parent,
|
||||
ABObj object
|
||||
)
|
||||
{
|
||||
return(object);
|
||||
}
|
||||
|
||||
/*
|
||||
* childp_type_text_pane:
|
||||
*/
|
||||
static ABObj
|
||||
childp_type_text_pane(
|
||||
char * class_name,
|
||||
ABObj object,
|
||||
ABObj child
|
||||
)
|
||||
{
|
||||
return(child);
|
||||
}
|
||||
|
||||
/*
|
||||
* objp_type_unknown:
|
||||
*/
|
||||
static ABObj
|
||||
objp_type_unknown(
|
||||
char * class_name,
|
||||
ABObj parent,
|
||||
ABObj object
|
||||
)
|
||||
{
|
||||
return(object);
|
||||
}
|
||||
|
||||
/*
|
||||
* childp_type_unknown:
|
||||
*/
|
||||
static ABObj
|
||||
childp_type_unknown(
|
||||
char * class_name,
|
||||
ABObj object,
|
||||
ABObj child
|
||||
)
|
||||
{
|
||||
if (strcmp(class_name, "XmFrame") == 0)
|
||||
{
|
||||
if (obj_is_container(child))
|
||||
child->info.container.has_border = TRUE;
|
||||
}
|
||||
else if (strcmp(class_name, "XmMenuShell") == 0)
|
||||
{
|
||||
if (obj_is_container(child))
|
||||
obj_set_type(object, AB_TYPE_MENU);
|
||||
}
|
||||
else if (strcmp(class_name, "XmScrolledWindow") == 0)
|
||||
{
|
||||
if ( (obj_set_hscrollbar_policy(child, AB_SCROLLBAR_NEVER) < 0)
|
||||
|| (obj_set_vscrollbar_policy(child, AB_SCROLLBAR_WHEN_NEEDED) < 0)
|
||||
)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Non (drawing area, list) below scrolled window.\n");
|
||||
}
|
||||
}
|
||||
return(child);
|
||||
}
|
||||
|
||||
706
cde/programs/dtappbuilder/src/libABil/bil.4
Normal file
706
cde/programs/dtappbuilder/src/libABil/bil.4
Normal file
@@ -0,0 +1,706 @@
|
||||
.\" $XConsortium: bil.4 /main/2 1995/07/17 14:27:01 drk $
|
||||
.\" *************************************************************************
|
||||
.\" ** (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
.\" ** (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
.\" ** (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
.\" ** (c) Copyright 1993, 1994 Novell, Inc.
|
||||
.\" *************************************************************************
|
||||
.\"--- The above copyrights must appear at the top of each man page.
|
||||
.\"---
|
||||
.\"--- @(#)bil.4 1.1 14 Sep 1994
|
||||
.\"---
|
||||
.\"--- ******** THIS IS THE SECTION 4 MAN PAGE TEMPLATE/STYLE GUIDE *******
|
||||
.\"---
|
||||
.\"--- Substitute the appropriate text for items beginning and ending with `_'
|
||||
.\"--- (for example, _Title_ and _Name_).
|
||||
.\"--- Be sure to use upper or lower case indicated for each item.
|
||||
.\"---
|
||||
.\"--- general style items:
|
||||
.\"---
|
||||
.\"--- Use \s-1CDE\s+1 whenever you want CDE. The scripts will then pick up the
|
||||
.\"--- correct trademark name for the X/Open version and use CDE for the man
|
||||
.\"--- page.
|
||||
.\"---
|
||||
.\"--- Always spell out standard input, output, and error.
|
||||
.\"---
|
||||
.\"--- Never use "print" unless you are describing literal printing
|
||||
.\"--- operations; use "write to standard output [error]."
|
||||
.\"---
|
||||
.\"--- Be careful not to say "character" when you mean "byte."
|
||||
.\"---
|
||||
.\"--- Never change the case of a symbol such as a function name. If it
|
||||
.\"--- starts lowercase, you cannot start a sentence with it.
|
||||
.\"---
|
||||
.\"--- Do not use the second person form of address or imperatives when
|
||||
.\"--- referring to the reader or application.
|
||||
.\"---
|
||||
.\"--- Avoid passive voice.
|
||||
.\"---
|
||||
.\"--- Call utilities utilities, not commands. Utilities appear in italics.
|
||||
.\"--- Use the following macro with a second argument for the section number.
|
||||
.\"--- For example: .Cm tt_session 1
|
||||
.\"--- There is no section number for same page usage.
|
||||
.\"---
|
||||
.\"--- If no information is appropriate under a heading, say None or Not used.
|
||||
.\"---
|
||||
.\"--- Variable list example:
|
||||
.\"--- .VL 12
|
||||
.\"--- .LI foo
|
||||
.\"--- text text text
|
||||
.\"--- .LI averylongtagneedsabreak
|
||||
.\"--- .br
|
||||
.\"--- text text text
|
||||
.\"--- .Lc R_OK
|
||||
.\"--- text text text
|
||||
.\"--- .LE
|
||||
.\"---
|
||||
.\"--- Bulleted list example:
|
||||
.\"--- .VL 3
|
||||
.\"--- .LI \(bu
|
||||
.\"--- text text text
|
||||
.\"--- .LI \(bu
|
||||
.\"--- text text text
|
||||
.\"--- .LE
|
||||
.\"---
|
||||
.\"--- Environment variables example:
|
||||
.\"--- Use italics and all uppercase. Do not prefix with a $ in regular text,
|
||||
.\"--- (only shell script examples)
|
||||
.\"--- .I SHELL
|
||||
.\"--- .IR LC_MESSAGES
|
||||
.\"--- .LI \f2LANG\fP [.VL list version]
|
||||
.\"---
|
||||
.\"--- Pathnames example:
|
||||
.\"--- Use bold font
|
||||
.\"--- .B /etc/passwd
|
||||
.\"--- .BR \&.profile [note the \& to protect leading dot]
|
||||
.\"--- .LI \f3/tmp\fP
|
||||
.\"---
|
||||
.\"--- Functions in SYNOPSIS example:
|
||||
.\"--- .SH SYNOPSIS
|
||||
.\"--- .yS
|
||||
.\"--- #include <Dt/Wsm.h>
|
||||
.\"--- .sp 0.5v
|
||||
.\"--- .ta \w'DtWsmCBContext DtWsmAddCurrentWorkspaceCallback('u
|
||||
.\"--- DtWsmCBContext DtWsmAddCurrentWorkspaceCallback(Widget \f2widget\fP,
|
||||
.\"--- DtWsmWsChangeProc \f2ws_change\fP,
|
||||
.\"--- Pointer \f2client_data\fP)
|
||||
.\"--- .sp 0.5v
|
||||
.\"--- .ta \w'typedef void (*DtWsmWsChangeProc)('u
|
||||
.\"--- typedef void (*DtWsmWsChangeProc)(Widget \f2widget\fP,
|
||||
.\"--- Atom \f2aWs\fP,
|
||||
.\"--- Pointer \f2client_data\fP)
|
||||
.\"--- .yE
|
||||
.\"---
|
||||
.\"--- Functions in TEXT example (bold for X/Open; use \(mi for minus):
|
||||
.\"--- .B \(mix
|
||||
.\"--- .BR \(miy ;
|
||||
.\"--- .BI \(mif " makefile" [note space]
|
||||
.\"--- \f3\(mif\ \fPmakefile\fP [version of previous if you're breaking
|
||||
.\"--- across two lines]
|
||||
.\"--- .LI \f3\(mia\0\f2level\f1 [.VL version; note usage of \0 as an internal
|
||||
.\"--- space and the return to font 1]
|
||||
.\"---
|
||||
.\"--- Typographical Conventions
|
||||
.\"---
|
||||
.\"--- Use the following to denote font changes: italic = \f2, bold = \f3
|
||||
.\"--- regular font = \f1. These are used in the common source and are
|
||||
.\"--- translated by the sed scripts into the appropriate font needed for X/Open
|
||||
.\"--- or the SI.
|
||||
.\"---
|
||||
.\"--- Bold font is used for options and commands, filenames, keywords and
|
||||
.\"--- typenames. It is also used to identify brackets surrounding optional
|
||||
.\"--- items in syntax, [].
|
||||
.\"---
|
||||
.\"--- Italic strings are used for emphasis or to identify the first instance
|
||||
.\"--- of a word requiring definition. Italic also denotes: variable names,
|
||||
.\"--- which are also shown in capitals; commands or utilities; external
|
||||
.\"--- variables; X Window System widgets; functions - these are shown as
|
||||
.\"--- follows: \f2name\fP(), name without parentheses are either external
|
||||
.\"--- variables or function family names.
|
||||
.\"---
|
||||
.\"--- Regular font is used for the names of constants and literals.
|
||||
.\"---
|
||||
.\"--- The notation <file.h> indicates a header file.
|
||||
.\"---
|
||||
.\"--- Names surrounded by braces, for example, {ARG_MAX}, represent symbolic
|
||||
.\"--- limits or configuration values that may be declared in appropriate
|
||||
.\"--- headers by means of the C #define construct.
|
||||
.\"---
|
||||
.\"--- Ellipses, . . . , are used to show that additional arguments are
|
||||
.\"--- optional.
|
||||
.\"---
|
||||
.\"--- Syntax and code examples are shown in fixed-width font. Brackets
|
||||
.\"--- shown in this font, [ ], are part of the syntax and do not indicate
|
||||
.\"--- optional items.
|
||||
.\"---
|
||||
.\"--- Variables within syntax statements are shown in italic fixed-width font.
|
||||
.\"---
|
||||
.\"---
|
||||
.\"--- Use the headings in the list below for Section 4 man pages in the order
|
||||
.\"--- listed. Use only these listed main headings.
|
||||
.\"--- Headings use uppercase and are marked with the .SH macro.
|
||||
.\"--- If the heading is more than one word, you must put the entire heading
|
||||
.\"--- between quotes.
|
||||
.\"--- You may use headings other than those in the list when
|
||||
.\"--- they help you organize the page; headings other than those in the list
|
||||
.\"--- are subordinate to the listed main headings. Place subordinate
|
||||
.\"--- headings under the appropriate main heading.
|
||||
.\"--- Examples of subordinate headings are described under the
|
||||
.\"--- main headings in this template/style guide.
|
||||
.\"--- There should be only one function per man page.
|
||||
.\"---
|
||||
.\"--- REQUIRED Headings for Section 4 man pages:
|
||||
.\"--- NAME, SYNOPSIS, DESCRIPTION, "RETURN VALUE", EXAMPLES,
|
||||
.\"--- "APPLICATION USAGE", "SEE ALSO"
|
||||
.na
|
||||
.\"---
|
||||
.\"----------------------------------------------------------------------------
|
||||
.\"--- .TH Macro
|
||||
.\"--- The .TH macro specifies information that applies to the man page as
|
||||
.\"--- a whole.
|
||||
.\"--- _Title_ is the name of the man page. This should correspond to the
|
||||
.\"--- first word under the NAME heading. _#_ specifies the manual section in
|
||||
.\"--- which the page appears, where # is the number of the section.
|
||||
.\"---
|
||||
.\"--- .TH _Title _#_
|
||||
.TH BIL 4
|
||||
.TH BIL 4
|
||||
.\"---
|
||||
.\"----------------------------------------------------------------------------
|
||||
.\"--- NAME
|
||||
.\"--- Give the name of the entry and briefly state its purpose.
|
||||
.\"--- This section is used by cross-referencing programs. Hence, do not
|
||||
.\"--- use any font changes or troff escape sequences in this section.
|
||||
.\"--- After the name, use one space, an em dash \(em, and then another space
|
||||
.\"-- before the summary.
|
||||
.\"--- Do not start the summary sentence with a capital letter or use
|
||||
.\"--- any punctuation at the end.
|
||||
.\"--- The summary line must be on one line (it can wrap). The reason for this
|
||||
.\"--- is that some man page implementations build an index of man page values
|
||||
.\"--- by reading through and getting the single line that follows the .SH NAME
|
||||
.\"--- line. The line doesn't have to fit on a terminal screen, but there
|
||||
.\"--- can be only one physical new line on the line.
|
||||
.\"--- Make the summary a simple declarative sentence.
|
||||
.\"--- For example:
|
||||
.\"---
|
||||
.\"--- DtInitialize \(em initialize the Desktop Services library
|
||||
.\"---
|
||||
.SH Name
|
||||
BIL \(em Builder Interface Language for the \s-1CDE\s+1 Application Builder
|
||||
.\"---
|
||||
.\"----------------------------------------------------------------------------
|
||||
.\"--- SYNOPSIS
|
||||
.\"--- This section summarizes the use of the entry being described
|
||||
.\"--- If it is necessary to include a header to use this interface,
|
||||
.\"--- the names of such headers are shown, for example:
|
||||
.\"---
|
||||
.\"--- #include <Dt.h>
|
||||
.\"---
|
||||
.\"--- Begin the synopsis with the .yS macro and end the synopsis with the
|
||||
.\"--- .yE macro.
|
||||
.\"--- Use the .sp 0.5v request where a blank line would appear in a program.
|
||||
.\"--- Use font 2 \f2 for substitutables.
|
||||
.\"--- Use .ta for tabs.
|
||||
.\"--- Do not use any spaces before or after parentheses.
|
||||
.\"--- If the function is too long to fit on a single output line, break it
|
||||
.\"--- as in the example below.
|
||||
.\"--- Synopsis example:
|
||||
.\"---
|
||||
.\"--- .SH SYNOPSIS
|
||||
.\"--- .yS
|
||||
.\"--- #include <Dt.h>
|
||||
.\"--- need example
|
||||
.\"--- .yE
|
||||
.\"---
|
||||
.SH SYNOPSIS
|
||||
.ft 3
|
||||
.fi
|
||||
.na
|
||||
.nf
|
||||
\f3:bil-version\fP \f2major minor\fP
|
||||
\f3:project\fP \f2project_name\fP
|
||||
\f3(\fP
|
||||
\f2project_attributes\fP
|
||||
[\f3:connection\fP
|
||||
\f3(\fP
|
||||
\f2connection_attributes\fP
|
||||
\f3)\fP]
|
||||
\f3)\fP
|
||||
.sp
|
||||
\f3:module\fP \f2module_name\fP
|
||||
\f3(\fP
|
||||
\f3:element\fP \f2element_name\fP
|
||||
\f3(\fP
|
||||
\f2element_attributes\fP
|
||||
[\f2children\fP]
|
||||
\f3)\fP
|
||||
[\f3:connection\fP
|
||||
\f3(\fP
|
||||
\f2connection_attributes\fP
|
||||
\f3)\fP]
|
||||
\f3)\fP
|
||||
.fi
|
||||
.PP
|
||||
.fi
|
||||
.\"---
|
||||
.\"----------------------------------------------------------------------------
|
||||
.\"--- DESCRIPTION
|
||||
.\"--- This section describes the functionality of the interface or header.
|
||||
.\"--- Begin the DESCRIPTION heading with a brief description of the
|
||||
.\"--- component's default behavior.
|
||||
.\"--- When writing, use active voice and make it clear who or what the
|
||||
.\"--- requirements are placed on. For example:
|
||||
.\"---
|
||||
.\"--- Do not say: When you are done with this implementation object, it should
|
||||
.\"--- be freed. (Who frees it, the programmer or the implementation?)
|
||||
.\"---
|
||||
.\"--- Make the component the grammatical subject
|
||||
.\"--- of the first sentence; use the following wording; note that whenever
|
||||
.\"--- you use the function name, use the .Fn request and put it on
|
||||
.\"--- a single line. .Fn gets the correct font and puts in the trailing
|
||||
.\"--- "( )" with the correct spacing.
|
||||
.\"--- The
|
||||
.\"--- .Fn function_name
|
||||
.\"--- function . . . then use a present tense verb
|
||||
.\"--- describing what the function does. The first sentence is often a
|
||||
.\"--- restatement of the NAME heading, possibly with more detail.
|
||||
.\"---
|
||||
.\"--- For example:
|
||||
.\"---
|
||||
.\"--- The
|
||||
.\"--- .Fn DtInitialize
|
||||
.\"--- function preforms the one-time initialization in the Desktop
|
||||
.\"--- Services library.
|
||||
.\"--- Applications must call
|
||||
.\"--- .Fn DtInitialize
|
||||
.\"--- before calling any other Desktop Services library routine.
|
||||
.\"---
|
||||
.\"--- If you have arguments information, place it under this DESCRIPTION
|
||||
.\"--- section as running text (not tables).
|
||||
.\"---
|
||||
.\"--- Use the .I request for arguments. For example:
|
||||
.\"---
|
||||
.\"--- The difference between
|
||||
.\"--- .Fn DtInitialize
|
||||
.\"--- and
|
||||
.\"--- .Fn DtAppInitialize
|
||||
.\"--- is whether
|
||||
.\"--- .I appContext
|
||||
.\"--- is specified
|
||||
.\"--- .Fn DtInitialize
|
||||
.\"--- uses the default Intrinsic
|
||||
.\"--- .IR XtAppContext.
|
||||
.\"---
|
||||
.\"--- Code example:
|
||||
.\"---
|
||||
.\"--- .Cs I
|
||||
.\"--- if (ferror(stdin)) {
|
||||
.\"--- fprintf(stderr, "Read error on input file\n");
|
||||
.\"--- exit(1);
|
||||
.\"--- }
|
||||
.\"--- exit(0);
|
||||
.\"--- .Ce
|
||||
.\"---
|
||||
.SH DESCRIPTION
|
||||
BIL, the Builder Interface Language, is a specialized representation syntax
|
||||
designed to meet the intermediate storage requirements of the \s-1CDE\s+1
|
||||
Application Builder.
|
||||
It describes the overall attributes of the application (also known as a
|
||||
"project"), the modules that it contains, the elements that
|
||||
comprise modules, and the behavioral relationships between objects
|
||||
("connections").
|
||||
.PP
|
||||
BIL is not a compiled language.
|
||||
It is read and written as data by the \s-1CDE\s+1 Application Builder and its
|
||||
associated code generator.
|
||||
Even so, the format of BIL is printable ASCII characters with a
|
||||
"human readable" nature, making it possible for users to examine
|
||||
the contents of a BIL-formatted file and to process a BIL file
|
||||
using simple ASCII string-oriented tools and techniques.
|
||||
.PP
|
||||
Two distinct types of BIL files are recognized by the \s-1CDE\s+1 Application
|
||||
Builder.
|
||||
One type is known as a
|
||||
.IR "project file" ,
|
||||
and is used to describe overall attributes of the project (application)
|
||||
as well as identify the modules that comprise it.
|
||||
It will also contain any cross-module information, such as connections
|
||||
that bind together objects in different modules.
|
||||
.PP
|
||||
A second type of BIL file exists for each module and is known as a
|
||||
.IR "module file" .
|
||||
It contains all module-specific information, including definition of
|
||||
the elements that comprise the module and connections that exist within
|
||||
it.
|
||||
.PP
|
||||
BIL is structured in an object-oriented fashion.
|
||||
Objects are defined and named, and sets of parenthesis are used to
|
||||
enclose declarations of all the object's attributes.
|
||||
Object types recognized by BIL include project, module, element
|
||||
and connection.
|
||||
.TP
|
||||
\f3:bil-version\fP \f2major minor\fP
|
||||
Version information is useful to the \s-1CDE\s+1 Application Builder and
|
||||
code generators in determining how to handle BIL files that may
|
||||
date from earlier releases.
|
||||
.TP
|
||||
\f3:project\fP \f2project_name\fP
|
||||
The
|
||||
.B :project
|
||||
directive names the project (application).
|
||||
It encloses a declaration of \f2project_attributes\fP
|
||||
as well as a list of any cross-module \f2connections\fP
|
||||
that may exist within the project.
|
||||
.TP
|
||||
\f3:module\fP \f2module_name\fP
|
||||
The
|
||||
.B :module
|
||||
directive names a module.
|
||||
It encloses a declaration of all \f2elements\fP that comprise the
|
||||
module as well as a list of any \f2connections\fP
|
||||
that may exist within the module.
|
||||
.TP
|
||||
\f3:element\fP \f2element_name\fP
|
||||
The
|
||||
.B :element
|
||||
directive names an element.
|
||||
It encloses a declaration of all \f2element_attributes\fP,
|
||||
including a list of any \f2children\fP that may be part of the
|
||||
element.
|
||||
.TP
|
||||
\f3:connection\fP
|
||||
The
|
||||
.B :connection
|
||||
directive names a connection and
|
||||
specifies its attributes.
|
||||
It can occur as part of a
|
||||
.I project
|
||||
or a
|
||||
.IR module .
|
||||
.TP
|
||||
\f3:children\fP
|
||||
The
|
||||
.B :children
|
||||
directive appears as an attribute of any
|
||||
element which contains ("parents") other
|
||||
elements.
|
||||
It encloses a list of all child elements,
|
||||
referencing each by its element name.
|
||||
.PP
|
||||
Project, element and connection attributes take the form:
|
||||
.sp .5
|
||||
\f3:\fP\f2attribute_name\fP \f2attribute_value\fP
|
||||
.sp .5
|
||||
Where \f2attribute_name\fP is an attribute appropriate for the project,
|
||||
element or connection, and \f2attribute_value\fP is typed according to the
|
||||
attribute.
|
||||
Attribute types include integer, string, object name, and keyword, where
|
||||
the keyword is one of a fixed list used by BIL to identify specific
|
||||
data values (e.g. :true, :none).
|
||||
Some attribute values are ordered N-tuples, in which case the
|
||||
complete set is enclosed in parentheses.
|
||||
.PP
|
||||
Comments may be placed in a BIL file by starting a line with two slashes (//).
|
||||
Any comments that occur in a BIL file prior to the
|
||||
.B :bil-version
|
||||
line will be preserved by the
|
||||
\s-1CDE\s+1 Application Builder
|
||||
across successive updates to the file.
|
||||
Comments that occur after the
|
||||
.B :bil-version
|
||||
line will not be retained.
|
||||
.\"---
|
||||
.\"----------------------------------------------------------------------------
|
||||
.\"--- "RETURN VALUE"
|
||||
.\"--- This section indicates the possible return values, if any.
|
||||
.\"--- If the implementation can detect errors, "Successful completion" means
|
||||
.\"--- that no error has been detected during execution of the function. If
|
||||
.\"--- the implementation does detect an error, the error indicated.
|
||||
.\"--- For functions where no errors are defined, "Successful completion"
|
||||
.\"--- means that if the implementation checks for errors, no error has been
|
||||
.\"--- detected. If the implementation can detect errors, and an error is
|
||||
.\"--- detected, the indicated return value is returned and errno may be set.
|
||||
.\"--- Use .Cn on a single line to produce a constant font. For example:
|
||||
.\"---
|
||||
.\"--- .SH "RETURN VALUE"
|
||||
.\"--- Upon successful completion,
|
||||
.\"--- .Fn data or file_ format_name
|
||||
.\"--- returns
|
||||
.\"--- .Cn TRUE
|
||||
.\"--- if such and such has been correctly initialized;
|
||||
.\"--- otherwise, it returns
|
||||
.\"--- .Cn FALSE
|
||||
.\"---
|
||||
.\"--- When writing, use active voice. For example:
|
||||
.\"---
|
||||
.\"--- Do not say: When such and such happens, minus one is returned.
|
||||
.\"--- Do say: When such and such happens, the foo function returns minus one.
|
||||
.\"---
|
||||
.SH "RETURN VALUE"
|
||||
None.
|
||||
.BR
|
||||
.\"----------------------------------------------------------------------------
|
||||
.\"--- ERRORS
|
||||
.\"--- Errors are shown under the RETURN VALUES heading.
|
||||
.\"---
|
||||
.\"----------------------------------------------------------------------------
|
||||
.\"--- EXAMPLES
|
||||
.\"--- This section gives examples of usage, where appropriate.
|
||||
.\"---
|
||||
.SH EXAMPLES
|
||||
.nf
|
||||
.ta 2i
|
||||
.PP
|
||||
The following is an example of a project file:
|
||||
.sp
|
||||
.in +.5i
|
||||
:bil-version 1 0
|
||||
:project todotool
|
||||
(
|
||||
:files (main_window.bil task_dialog.bil)
|
||||
|
||||
:connection
|
||||
(
|
||||
:from main_window.add_item_btn
|
||||
:to task_dialog.task_dialog
|
||||
:when :activate
|
||||
:action-type :builtin
|
||||
:action :show
|
||||
:arg-type :void
|
||||
)
|
||||
)
|
||||
.in -.5i
|
||||
.PP
|
||||
A typical module file would contain:
|
||||
.sp
|
||||
.in +.5i
|
||||
:bil-version 1 0
|
||||
:module task_dialog
|
||||
(
|
||||
|
||||
:element task_dialog
|
||||
(
|
||||
:type :dialog
|
||||
:x 649
|
||||
:y 499
|
||||
:width 354
|
||||
:height 57
|
||||
:bg-color "white"
|
||||
:label "Adding a New Task"
|
||||
:resizable :true
|
||||
:has-footer :false
|
||||
:visible :false
|
||||
:children (
|
||||
ctrl_panel
|
||||
activate_panel
|
||||
)
|
||||
)
|
||||
:element ctrl_panel
|
||||
(
|
||||
:type :container
|
||||
:container-type :relative
|
||||
:x 0
|
||||
:y 0
|
||||
:width 354
|
||||
:height 57
|
||||
:visible :true
|
||||
:border-frame :none
|
||||
:north-attachment (:obj task_dialog 0)
|
||||
:south-attachment (:obj task_dialog 0)
|
||||
:east-attachment (:obj task_dialog 0)
|
||||
:west-attachment (:point 0 0)
|
||||
:children (
|
||||
task
|
||||
)
|
||||
)
|
||||
:element task
|
||||
(
|
||||
:type :text-field
|
||||
:text-type :alphanumeric
|
||||
:x 28
|
||||
:y 6
|
||||
:width -1
|
||||
:height -1
|
||||
:border-frame :none
|
||||
:label-type :string
|
||||
:label "Task:"
|
||||
:label-position :west
|
||||
:num-columns 32
|
||||
:max-length 80
|
||||
:read-only :false
|
||||
:active :true
|
||||
:visible :true
|
||||
:north-attachment (:point 0 6)
|
||||
:south-attachment (:none 0 0)
|
||||
:east-attachment (:none 0 0)
|
||||
:west-attachment (:point 0 28)
|
||||
)
|
||||
:element activate_panel
|
||||
(
|
||||
:type :container
|
||||
:container-type :activate
|
||||
:x -1
|
||||
:y -1
|
||||
:width -1
|
||||
:height -1
|
||||
:visible :true
|
||||
:border-frame :etched-in
|
||||
:children (
|
||||
ok_button
|
||||
cancel_button
|
||||
help_button
|
||||
)
|
||||
)
|
||||
:element ok_button
|
||||
(
|
||||
:type :button
|
||||
:button-type :push-button
|
||||
:x -1
|
||||
:y -1
|
||||
:width -1
|
||||
:height -1
|
||||
:border-frame :none
|
||||
:label-type :string
|
||||
:label-alignment :center
|
||||
:label "OK"
|
||||
:active :true
|
||||
:visible :true
|
||||
:north-attachment (:grid-line 5 0)
|
||||
:south-attachment (:grid-line 95 0)
|
||||
:east-attachment (:grid-line 30 0)
|
||||
:west-attachment (:grid-line 10 0)
|
||||
)
|
||||
:element cancel_button
|
||||
(
|
||||
:type :button
|
||||
:button-type :push-button
|
||||
:x -1
|
||||
:y -1
|
||||
:width -1
|
||||
:height -1
|
||||
:border-frame :none
|
||||
:label-type :string
|
||||
:label-alignment :center
|
||||
:label "Cancel"
|
||||
:active :true
|
||||
:visible :true
|
||||
:north-attachment (:grid-line 5 0)
|
||||
:south-attachment (:grid-line 95 0)
|
||||
:east-attachment (:grid-line 60 0)
|
||||
:west-attachment (:grid-line 40 0)
|
||||
)
|
||||
:element help_button
|
||||
(
|
||||
:type :button
|
||||
:button-type :push-button
|
||||
:x -1
|
||||
:y -1
|
||||
:width -1
|
||||
:height -1
|
||||
:border-frame :none
|
||||
:label-type :string
|
||||
:label-alignment :center
|
||||
:label "Help"
|
||||
:active :true
|
||||
:visible :true
|
||||
:north-attachment (:grid-line 5 0)
|
||||
:south-attachment (:grid-line 95 0)
|
||||
:east-attachment (:grid-line 90 0)
|
||||
:west-attachment (:grid-line 70 0)
|
||||
)
|
||||
:connection
|
||||
(
|
||||
:from ok_button
|
||||
:to task_dialog
|
||||
:when :activate
|
||||
:action-type :builtin
|
||||
:action :hide
|
||||
:arg-type :void
|
||||
)
|
||||
:connection
|
||||
(
|
||||
:from cancel_button
|
||||
:to task_dialog
|
||||
:when :activate
|
||||
:action-type :builtin
|
||||
:action :hide
|
||||
:arg-type :void
|
||||
)
|
||||
:connection
|
||||
(
|
||||
:from ok_button
|
||||
:when :create
|
||||
:action-type :call-function
|
||||
:action confirm_taskCB
|
||||
:arg-type :void
|
||||
)
|
||||
:connection
|
||||
(
|
||||
:from cancel_button
|
||||
:when :create
|
||||
:action-type :call-function
|
||||
:action cancel_taskCB
|
||||
:arg-type :void
|
||||
)
|
||||
)
|
||||
.in -.5i
|
||||
.fi
|
||||
.\"---need something here
|
||||
.\"----------------------------------------------------------------------------
|
||||
.\"--- Internationalization (I18n)
|
||||
.\"--- If you are talking about a specific feature of the API, describe this
|
||||
.\"--- topic under the DESCRIPTION heading. If you are trying to give guidance
|
||||
.\"--- to programmers on things to look out for in I18n purposes, describe this
|
||||
.\"--- topic under the APPLICATION USAGE heading.
|
||||
.\"---
|
||||
.\"----------------------------------------------------------------------------
|
||||
.\"--- "APPLICATION USAGE"
|
||||
.\"--- This section gives warnings and advice to application writers
|
||||
.\"--- about the entry.
|
||||
.\"---
|
||||
.SH "APPLICATION USAGE"
|
||||
Applications and application developers typically do not work
|
||||
directly with BIL files, instead using them indirectly through
|
||||
the \s-1CDE\s+1 Application Builder.
|
||||
It may, however, be useful for them to understand the layout and
|
||||
scope of BIL to satisfy particular application development needs
|
||||
(e.g. to add specialized comments to BIL files or to examine them
|
||||
to examine useful information (such as help text built-into a
|
||||
application)).
|
||||
.\"---
|
||||
.\"----------------------------------------------------------------------------
|
||||
.\"--- "SEE ALSO"
|
||||
.na
|
||||
.\"--- This section gives references to related information.
|
||||
.\"--- For example:
|
||||
.\"---
|
||||
.\"--- .SH "SEE ALSO"
|
||||
.na
|
||||
.\"--- .Hd <header_file.h> 5, if needed
|
||||
.\"--- .Fn file_name include section number,
|
||||
.\"--- .Fn file_name include section number,
|
||||
.\"--- .Fn file_name include section number.
|
||||
.\"---
|
||||
.SH "SEE ALSO"
|
||||
.na
|
||||
.BR dtbuilder (1)
|
||||
.BR dtcodegen (1)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2598
cde/programs/dtappbuilder/src/libABil/bil.c
Normal file
2598
cde/programs/dtappbuilder/src/libABil/bil.c
Normal file
File diff suppressed because it is too large
Load Diff
58
cde/programs/dtappbuilder/src/libABil/bil.h
Normal file
58
cde/programs/dtappbuilder/src/libABil/bil.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* $XConsortium: bil.h /main/3 1995/11/06 18:23:13 rswiston $
|
||||
*
|
||||
* @(#)bil.h 1.11 14 Feb 1994 cde_app_builder/src/libABil
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ABIL_BIL_H_
|
||||
#define _ABIL_BIL_H_
|
||||
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <ab_private/bil_parse.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BIL_SAVE_UNDEF = 0,
|
||||
BIL_SAVE_DUMP, /* just dump the whole thing */
|
||||
BIL_SAVE_FILE_PER_MODULE, /* assume 1 project file, 1 for each module */
|
||||
BIL_SAVE_ENCAPSULATED, /* assume everything goes in one file */
|
||||
BIL_SAVE_TYPE_NUM_VALUES
|
||||
} BIL_SAVE_TYPE;
|
||||
|
||||
|
||||
extern ABObj bil_load_file(
|
||||
STRING path,
|
||||
FILE *inFile,
|
||||
ABObj proj,
|
||||
ABObjList *compObjsOut /* composite objs loaded */
|
||||
);
|
||||
extern int bil_load_file_and_resolve_all(
|
||||
STRING fileName,
|
||||
FILE *inFile,
|
||||
ABObj *newProjectPtr
|
||||
);
|
||||
extern int bil_save_tree(
|
||||
ABObj root,
|
||||
STRING filename,
|
||||
STRING old_proj_dir,
|
||||
BIL_SAVE_TYPE type
|
||||
);
|
||||
extern STRING bil_get_filename(
|
||||
ABObj proj,
|
||||
ABObj module
|
||||
);
|
||||
|
||||
#endif /* _ABIL_BIL_H_ */
|
||||
696
cde/programs/dtappbuilder/src/libABil/bil.man
Normal file
696
cde/programs/dtappbuilder/src/libABil/bil.man
Normal file
@@ -0,0 +1,696 @@
|
||||
.\" $XConsortium: bil.man /main/2 1995/07/17 10:50:18 drk $
|
||||
.\" *************************************************************************
|
||||
.\" ** (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
.\" ** (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
.\" ** (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
.\" ** (c) Copyright 1993, 1994 Novell, Inc.
|
||||
.\" *************************************************************************
|
||||
.\"--- The above copyrights must appear at the top of each man page.
|
||||
.\"---
|
||||
.\"--- ******** THIS IS THE SECTION 4 MAN PAGE TEMPLATE/STYLE GUIDE *******
|
||||
.\"---
|
||||
.\"--- Substitute the appropriate text for items beginning and ending with `_'
|
||||
.\"--- (for example, _Title_ and _Name_).
|
||||
.\"--- Be sure to use upper or lower case indicated for each item.
|
||||
.\"---
|
||||
.\"--- general style items:
|
||||
.\"---
|
||||
.\"--- Use Cde whenever you want CDE. The scripts will then pick up the
|
||||
.\"--- correct trademark name for the X/Open version and use CDE for the man
|
||||
.\"--- page.
|
||||
.\"---
|
||||
.\"--- Always spell out standard input, output, and error.
|
||||
.\"---
|
||||
.\"--- Never use "print" unless you are describing literal printing
|
||||
.\"--- operations; use "write to standard output [error]."
|
||||
.\"---
|
||||
.\"--- Be careful not to say "character" when you mean "byte."
|
||||
.\"---
|
||||
.\"--- Never change the case of a symbol such as a function name. If it
|
||||
.\"--- starts lowercase, you cannot start a sentence with it.
|
||||
.\"---
|
||||
.\"--- Do not use the second person form of address or imperatives when
|
||||
.\"--- referring to the reader or application.
|
||||
.\"---
|
||||
.\"--- Avoid passive voice.
|
||||
.\"---
|
||||
.\"--- Call utilities utilities, not commands. Utilities appear in italics.
|
||||
.\"--- Use the following macro with a second argument for the section number.
|
||||
.\"--- For example: .Cm tt_session 1
|
||||
.\"--- There is no section number for same page usage.
|
||||
.\"---
|
||||
.\"--- If no information is appropriate under a heading, say None or Not used.
|
||||
.\"---
|
||||
.\"--- Variable list example:
|
||||
.\"--- .VL 12
|
||||
.\"--- .LI foo
|
||||
.\"--- text text text
|
||||
.\"--- .LI averylongtagneedsabreak
|
||||
.\"--- .br
|
||||
.\"--- text text text
|
||||
.\"--- .Lc R_OK
|
||||
.\"--- text text text
|
||||
.\"--- .LE
|
||||
.\"---
|
||||
.\"--- Bulleted list example:
|
||||
.\"--- .VL 3
|
||||
.\"--- .LI \(bu
|
||||
.\"--- text text text
|
||||
.\"--- .LI \(bu
|
||||
.\"--- text text text
|
||||
.\"--- .LE
|
||||
.\"---
|
||||
.\"--- Environment variables example:
|
||||
.\"--- Use italics and all uppercase. Do not prefix with a $ in regular text,
|
||||
.\"--- (only shell script examples)
|
||||
.\"--- .I SHELL
|
||||
.\"--- .IR LC_MESSAGES
|
||||
.\"--- .LI \f2LANG\fP [.VL list version]
|
||||
.\"---
|
||||
.\"--- Pathnames example:
|
||||
.\"--- Use bold font
|
||||
.\"--- .B /etc/passwd
|
||||
.\"--- .BR \&.profile [note the \& to protect leading dot]
|
||||
.\"--- .LI \f3/tmp\fP
|
||||
.\"---
|
||||
.\"--- Functions in SYNOPSIS example:
|
||||
.\"--- .SH SYNOPSIS
|
||||
.\"--- .yS
|
||||
.\"--- #include <Dt/Wsm.h>
|
||||
.\"--- .sp 0.5v
|
||||
.\"--- .ta \w'DtWsmCBContext DtWsmAddCurrentWorkspaceCallback('u
|
||||
.\"--- DtWsmCBContext DtWsmAddCurrentWorkspaceCallback(Widget \f2widget\fP,
|
||||
.\"--- DtWsmWsChangeProc \f2ws_change\fP,
|
||||
.\"--- Pointer \f2client_data\fP)
|
||||
.\"--- .sp 0.5v
|
||||
.\"--- .ta \w'typedef void (*DtWsmWsChangeProc)('u
|
||||
.\"--- typedef void (*DtWsmWsChangeProc)(Widget \f2widget\fP,
|
||||
.\"--- Atom \f2aWs\fP,
|
||||
.\"--- Pointer \f2client_data\fP)
|
||||
.\"--- .yE
|
||||
.\"---
|
||||
.\"--- Functions in TEXT example (bold for X/Open; use \- for minus):
|
||||
.\"--- .B \-x
|
||||
.\"--- .BR \-y ;
|
||||
.\"--- .BI \-f " makefile" [note space]
|
||||
.\"--- \f3\(mif\ \fPmakefile\fP [version of previous if you're breaking
|
||||
.\"--- across two lines]
|
||||
.\"--- .LI \f3\-a\0\f2level\f1 [.VL version; note usage of \0 as an internal
|
||||
.\"--- space and the return to font 1]
|
||||
.\"---
|
||||
.\"--- Typographical Conventions
|
||||
.\"---
|
||||
.\"--- Use the following to denote font changes: italic = \f2, bold = \f3
|
||||
.\"--- regular font = \f1. These are used in the common source and are
|
||||
.\"--- translated by the sed scripts into the appropriate font needed for X/Open
|
||||
.\"--- or the SI.
|
||||
.\"---
|
||||
.\"--- Bold font is used for options and commands, filenames, keywords and
|
||||
.\"--- typenames. It is also used to identify brackets surrounding optional
|
||||
.\"--- items in syntax, [].
|
||||
.\"---
|
||||
.\"--- Italic strings are used for emphasis or to identify the first instance
|
||||
.\"--- of a word requiring definition. Italic also denotes: variable names,
|
||||
.\"--- which are also shown in capitals; commands or utilities; external
|
||||
.\"--- variables; X Window System widgets; functions - these are shown as
|
||||
.\"--- follows: \f2name\fP(), name without parentheses are either external
|
||||
.\"--- variables or function family names.
|
||||
.\"---
|
||||
.\"--- Regular font is used for the names of constants and literals.
|
||||
.\"---
|
||||
.\"--- The notation <file.h> indicates a header file.
|
||||
.\"---
|
||||
.\"--- Names surrounded by braces, for example, {ARG_MAX}, represent symbolic
|
||||
.\"--- limits or configuration values that may be declared in appropriate
|
||||
.\"--- headers by means of the C #define construct.
|
||||
.\"---
|
||||
.\"--- Ellipses, . . . , are used to show that additional arguments are
|
||||
.\"--- optional.
|
||||
.\"---
|
||||
.\"--- Syntax and code examples are shown in fixed-width font. Brackets
|
||||
.\"--- shown in this font, [ ], are part of the syntax and do not indicate
|
||||
.\"--- optional items.
|
||||
.\"---
|
||||
.\"--- Variables within syntax statements are shown in italic fixed-width font.
|
||||
.\"---
|
||||
.\"---
|
||||
.\"--- Use the headings in the list below for Section 4 man pages in the order
|
||||
.\"--- listed. Use only these listed main headings.
|
||||
.\"--- Headings use uppercase and are marked with the .SH macro.
|
||||
.\"--- If the heading is more than one word, you must put the entire heading
|
||||
.\"--- between quotes.
|
||||
.\"--- You may use headings other than those in the list when
|
||||
.\"--- they help you organize the page; headings other than those in the list
|
||||
.\"--- are subordinate to the listed main headings. Place subordinate
|
||||
.\"--- headings under the appropriate main heading.
|
||||
.\"--- Examples of subordinate headings are described under the
|
||||
.\"--- main headings in this template/style guide.
|
||||
.\"--- There should be only one function per man page.
|
||||
.\"---
|
||||
.\"--- REQUIRED Headings for Section 4 man pages:
|
||||
.\"--- NAME, SYNOPSIS, DESCRIPTION, "RETURN VALUE", EXAMPLES,
|
||||
.\"--- "APPLICATION USAGE", "SEE ALSO"
|
||||
.\"---
|
||||
.\"----------------------------------------------------------------------------
|
||||
.\"--- .TH Macro
|
||||
.\"--- The .TH macro specifies information that applies to the man page as
|
||||
.\"--- a whole.
|
||||
.\"--- _Title_ is the name of the man page. This should correspond to the
|
||||
.\"--- first word under the NAME heading. _#_ specifies the manual section in
|
||||
.\"--- which the page appears, where # is the number of the section.
|
||||
.\"---
|
||||
.\"--- .TH _Title _#_
|
||||
.TH BIL 4
|
||||
.\"---
|
||||
.\"----------------------------------------------------------------------------
|
||||
.\"--- NAME
|
||||
.\"--- Give the name of the entry and briefly state its purpose.
|
||||
.\"--- This section is used by cross-referencing programs. Hence, do not
|
||||
.\"--- use any font changes or troff escape sequences in this section.
|
||||
.\"--- After the name, use one space, an em dash \(em, and then another space
|
||||
.\"-- before the summary.
|
||||
.\"--- Do not start the summary sentence with a capital letter or use
|
||||
.\"--- any punctuation at the end.
|
||||
.\"--- The summary line must be on one line (it can wrap). The reason for this
|
||||
.\"--- is that some man page implementations build an index of man page values
|
||||
.\"--- by reading through and getting the single line that follows the .SH NAME
|
||||
.\"--- line. The line doesn't have to fit on a terminal screen, but there
|
||||
.\"--- can be only one physical new line on the line.
|
||||
.\"--- Make the summary a simple declarative sentence.
|
||||
.\"--- For example:
|
||||
.\"---
|
||||
.\"--- DtInitialize \(em initialize the Desktop Services library
|
||||
.\"---
|
||||
.SH Name
|
||||
BIL \(em Builder Interface Language for the Cde Application Builder
|
||||
.\"---
|
||||
.\"----------------------------------------------------------------------------
|
||||
.\"--- SYNOPSIS
|
||||
.\"--- This section summarizes the use of the entry being described
|
||||
.\"--- If it is necessary to include a header to use this interface,
|
||||
.\"--- the names of such headers are shown, for example:
|
||||
.\"---
|
||||
.\"--- #include <Dt.h>
|
||||
.\"---
|
||||
.\"--- Begin the synopsis with the .yS macro and end the synopsis with the
|
||||
.\"--- .yE macro.
|
||||
.\"--- Use the .sp 0.5v request where a blank line would appear in a program.
|
||||
.\"--- Use font 2 \f2 for substitutables.
|
||||
.\"--- Use .ta for tabs.
|
||||
.\"--- Do not use any spaces before or after parentheses.
|
||||
.\"--- If the function is too long to fit on a single output line, break it
|
||||
.\"--- as in the example below.
|
||||
.\"--- Synopsis example:
|
||||
.\"---
|
||||
.\"--- .SH SYNOPSIS
|
||||
.\"--- .yS
|
||||
.\"--- #include <Dt.h>
|
||||
.\"--- need example
|
||||
.\"--- .yE
|
||||
.\"---
|
||||
.SH SYNOPSIS
|
||||
.yS
|
||||
.nf
|
||||
\f3:bil-version\fP \f2major minor\fP
|
||||
\f3:project\fP \f2project_name\fP
|
||||
\f3(\fP
|
||||
\f2project_attributes\fP
|
||||
[\f3:connection\fP
|
||||
\f3(\fP
|
||||
\f2connection_attributes\fP
|
||||
\f3)\fP]
|
||||
\f3)\fP
|
||||
.sp
|
||||
\f3:module\fP \f2module_name\fP
|
||||
\f3(\fP
|
||||
\f3:element\fP \f2element_name\fP
|
||||
\f3(\fP
|
||||
\f2element_attributes\fP
|
||||
[\f2children\fP]
|
||||
\f3)\fP
|
||||
[\f3:connection\fP
|
||||
\f3(\fP
|
||||
\f2connection_attributes\fP
|
||||
\f3)\fP]
|
||||
\f3)\fP
|
||||
.fi
|
||||
.yE
|
||||
.\"---
|
||||
.\"----------------------------------------------------------------------------
|
||||
.\"--- DESCRIPTION
|
||||
.\"--- This section describes the functionality of the interface or header.
|
||||
.\"--- Begin the DESCRIPTION heading with a brief description of the
|
||||
.\"--- component's default behavior.
|
||||
.\"--- When writing, use active voice and make it clear who or what the
|
||||
.\"--- requirements are placed on. For example:
|
||||
.\"---
|
||||
.\"--- Do not say: When you are done with this implementation object, it should
|
||||
.\"--- be freed. (Who frees it, the programmer or the implementation?)
|
||||
.\"---
|
||||
.\"--- Make the component the grammatical subject
|
||||
.\"--- of the first sentence; use the following wording; note that whenever
|
||||
.\"--- you use the function name, use the .Fn request and put it on
|
||||
.\"--- a single line. .Fn gets the correct font and puts in the trailing
|
||||
.\"--- "( )" with the correct spacing.
|
||||
.\"--- The
|
||||
.\"--- .Fn function_name
|
||||
.\"--- function . . . then use a present tense verb
|
||||
.\"--- describing what the function does. The first sentence is often a
|
||||
.\"--- restatement of the NAME heading, possibly with more detail.
|
||||
.\"---
|
||||
.\"--- For example:
|
||||
.\"---
|
||||
.\"--- The
|
||||
.\"--- .Fn DtInitialize
|
||||
.\"--- function preforms the one-time initialization in the Desktop
|
||||
.\"--- Services library.
|
||||
.\"--- Applications must call
|
||||
.\"--- .Fn DtInitialize
|
||||
.\"--- before calling any other Desktop Services library routine.
|
||||
.\"---
|
||||
.\"--- If you have arguments information, place it under this DESCRIPTION
|
||||
.\"--- section as running text (not tables).
|
||||
.\"---
|
||||
.\"--- Use the .I request for arguments. For example:
|
||||
.\"---
|
||||
.\"--- The difference between
|
||||
.\"--- .Fn DtInitialize
|
||||
.\"--- and
|
||||
.\"--- .Fn DtAppInitialize
|
||||
.\"--- is whether
|
||||
.\"--- .I appContext
|
||||
.\"--- is specified
|
||||
.\"--- .Fn DtInitialize
|
||||
.\"--- uses the default Intrinsic
|
||||
.\"--- .IR XtAppContext.
|
||||
.\"---
|
||||
.\"--- Code example:
|
||||
.\"---
|
||||
.\"--- .Cs I
|
||||
.\"--- if (ferror(stdin)) {
|
||||
.\"--- fprintf(stderr, "Read error on input file\n");
|
||||
.\"--- exit(1);
|
||||
.\"--- }
|
||||
.\"--- exit(0);
|
||||
.\"--- .Ce
|
||||
.\"---
|
||||
.SH DESCRIPTION
|
||||
BIL, the Builder Interface Language, is a specialized representation syntax
|
||||
designed to meet the intermediate storage requirements of the Cde
|
||||
Application Builder.
|
||||
It describes the overall attributes of the application (also known as a
|
||||
"project"), the modules that it contains, the elements that
|
||||
comprise modules, and the behavioral relationships between objects
|
||||
("connections").
|
||||
.P
|
||||
BIL is not a compiled language.
|
||||
It is read and written as data by the Cde Application Builder and its
|
||||
associated code generator.
|
||||
Even so, the format of BIL is printable ASCII characters with a
|
||||
"human readable" nature, making it possible for users to examine
|
||||
the contents of a BIL-formatted file and to process a BIL file
|
||||
using simple ASCII string-oriented tools and techniques.
|
||||
.P
|
||||
Two distinct types of BIL files are recognized by the Cde Application
|
||||
Builder.
|
||||
One type is known as a
|
||||
.IR "project file" ,
|
||||
and is used to describe overall attributes of the project (application)
|
||||
as well as identify the modules that comprise it.
|
||||
It will also contain any cross-module information, such as connections
|
||||
that bind together objects in different modules.
|
||||
.P
|
||||
A second type of BIL file exists for each module and is known as a
|
||||
.IR "module file" .
|
||||
It contains all module-specific information, including definition of
|
||||
the elements that comprise the module and connections that exist within
|
||||
it.
|
||||
.P
|
||||
BIL is structured in an object-oriented fashion.
|
||||
Objects are defined and named, and sets of parenthesis are used to
|
||||
enclose declarations of all the object's attributes.
|
||||
Object types recognized by BIL include project, module, element
|
||||
and connection.
|
||||
.TP
|
||||
\f3:bil-version\fP \f2major minor\fP
|
||||
Version information is useful to the Cde Application Builder and
|
||||
code generators in determining how to handle BIL files that may
|
||||
date from earlier releases.
|
||||
.TP
|
||||
\f3:project\fP \f2project_name\fP
|
||||
The
|
||||
.B :project
|
||||
directive names the project (application).
|
||||
It encloses a declaration of \f2project_attributes\fP
|
||||
as well as a list of any cross-module \f2connections\fP
|
||||
that may exist within the project.
|
||||
.TP
|
||||
\f3:module\fP \f2module_name\fP
|
||||
The
|
||||
.B :module
|
||||
directive names a module.
|
||||
It encloses a declaration of all \f2elements\fP that comprise the
|
||||
module as well as a list of any \f2connections\fP
|
||||
that may exist within the module.
|
||||
.TP
|
||||
\f3:element\fP \f2element_name\fP
|
||||
The
|
||||
.B :element
|
||||
directive names an element.
|
||||
It encloses a declaration of all \f2element_attributes\fP,
|
||||
including a list of any \f2children\fP that may be part of the
|
||||
element.
|
||||
.TP
|
||||
\f3:connection\fP
|
||||
The
|
||||
.B :connection
|
||||
directive names a connection and
|
||||
specifies its attributes.
|
||||
It can occur as part of a
|
||||
.I project
|
||||
or a
|
||||
.IR module .
|
||||
.TP
|
||||
\f3:children\fP
|
||||
The
|
||||
.B :children
|
||||
directive appears as an attribute of any
|
||||
element which contains ("parents") other
|
||||
elements.
|
||||
It encloses a list of all child elements,
|
||||
referencing each by its element name.
|
||||
.P
|
||||
Project, element and connection attributes take the form:
|
||||
.sp .5
|
||||
\f3:\fP\f2attribute_name\fP \f2attribute_value\fP
|
||||
.sp .5
|
||||
Where \f2attribute_name\fP is an attribute appropriate for the project,
|
||||
element or connection, and \f2attribute_value\fP is typed according to the
|
||||
attribute.
|
||||
Attribute types include integer, string, object name, and keyword, where
|
||||
the keyword is one of a fixed list used by BIL to identify specific
|
||||
data values (e.g. :true, :none).
|
||||
Some attribute values are ordered N-tuples, in which case the
|
||||
complete set is enclosed in parentheses.
|
||||
.P
|
||||
Comments may be placed in a BIL file by starting a line with two slashes (//).
|
||||
Any comments that occur in a BIL file prior to the
|
||||
.B :bil-version
|
||||
line will be preserved by the
|
||||
Cde Application Builder
|
||||
across successive updates to the file.
|
||||
Comments that occur after the
|
||||
.B :bil-version
|
||||
line will not be retained.
|
||||
.\"---
|
||||
.\"----------------------------------------------------------------------------
|
||||
.\"--- "RETURN VALUE"
|
||||
.\"--- This section indicates the possible return values, if any.
|
||||
.\"--- If the implementation can detect errors, "Successful completion" means
|
||||
.\"--- that no error has been detected during execution of the function. If
|
||||
.\"--- the implementation does detect an error, the error indicated.
|
||||
.\"--- For functions where no errors are defined, "Successful completion"
|
||||
.\"--- means that if the implementation checks for errors, no error has been
|
||||
.\"--- detected. If the implementation can detect errors, and an error is
|
||||
.\"--- detected, the indicated return value is returned and errno may be set.
|
||||
.\"--- Use .Cn on a single line to produce a constant font. For example:
|
||||
.\"---
|
||||
.\"--- .SH "RETURN VALUE"
|
||||
.\"--- Upon successful completion,
|
||||
.\"--- .Fn data or file_ format_name
|
||||
.\"--- returns
|
||||
.\"--- .Cn TRUE
|
||||
.\"--- if such and such has been correctly initialized;
|
||||
.\"--- otherwise, it returns
|
||||
.\"--- .Cn FALSE
|
||||
.\"---
|
||||
.\"--- When writing, use active voice. For example:
|
||||
.\"---
|
||||
.\"--- Do not say: When such and such happens, minus one is returned.
|
||||
.\"--- Do say: When such and such happens, the foo function returns minus one.
|
||||
.\"---
|
||||
.SH "RETURN VALUE"
|
||||
None.
|
||||
.Cn
|
||||
.\"----------------------------------------------------------------------------
|
||||
.\"--- ERRORS
|
||||
.\"--- Errors are shown under the RETURN VALUES heading.
|
||||
.\"---
|
||||
.\"----------------------------------------------------------------------------
|
||||
.\"--- EXAMPLES
|
||||
.\"--- This section gives examples of usage, where appropriate.
|
||||
.\"---
|
||||
.SH EXAMPLES
|
||||
.nf
|
||||
.ta 2i
|
||||
.P
|
||||
The following is an example of a project file:
|
||||
.sp
|
||||
.in +.5i
|
||||
:bil-version 1 0
|
||||
:project todotool
|
||||
(
|
||||
:files (main_window.bil task_dialog.bil)
|
||||
|
||||
:connection
|
||||
(
|
||||
:from main_window.add_item_btn
|
||||
:to task_dialog.task_dialog
|
||||
:when :activate
|
||||
:action-type :builtin
|
||||
:action :show
|
||||
:arg-type :void
|
||||
)
|
||||
)
|
||||
.in -.5i
|
||||
.P
|
||||
A typical module file would contain:
|
||||
.sp
|
||||
.in +.5i
|
||||
:bil-version 1 0
|
||||
:module task_dialog
|
||||
(
|
||||
|
||||
:element task_dialog
|
||||
(
|
||||
:type :dialog
|
||||
:x 649
|
||||
:y 499
|
||||
:width 354
|
||||
:height 57
|
||||
:bg-color "white"
|
||||
:label "Adding a New Task"
|
||||
:resizable :true
|
||||
:has-footer :false
|
||||
:visible :false
|
||||
:children (
|
||||
ctrl_panel
|
||||
activate_panel
|
||||
)
|
||||
)
|
||||
:element ctrl_panel
|
||||
(
|
||||
:type :container
|
||||
:container-type :relative
|
||||
:x 0
|
||||
:y 0
|
||||
:width 354
|
||||
:height 57
|
||||
:visible :true
|
||||
:border-frame :none
|
||||
:north-attachment (:obj task_dialog 0)
|
||||
:south-attachment (:obj task_dialog 0)
|
||||
:east-attachment (:obj task_dialog 0)
|
||||
:west-attachment (:point 0 0)
|
||||
:children (
|
||||
task
|
||||
)
|
||||
)
|
||||
:element task
|
||||
(
|
||||
:type :text-field
|
||||
:text-type :alphanumeric
|
||||
:x 28
|
||||
:y 6
|
||||
:width -1
|
||||
:height -1
|
||||
:border-frame :none
|
||||
:label-type :string
|
||||
:label "Task:"
|
||||
:label-position :west
|
||||
:num-columns 32
|
||||
:max-length 80
|
||||
:read-only :false
|
||||
:active :true
|
||||
:visible :true
|
||||
:north-attachment (:point 0 6)
|
||||
:south-attachment (:none 0 0)
|
||||
:east-attachment (:none 0 0)
|
||||
:west-attachment (:point 0 28)
|
||||
)
|
||||
:element activate_panel
|
||||
(
|
||||
:type :container
|
||||
:container-type :activate
|
||||
:x -1
|
||||
:y -1
|
||||
:width -1
|
||||
:height -1
|
||||
:visible :true
|
||||
:border-frame :etched-in
|
||||
:children (
|
||||
ok_button
|
||||
cancel_button
|
||||
help_button
|
||||
)
|
||||
)
|
||||
:element ok_button
|
||||
(
|
||||
:type :button
|
||||
:button-type :push-button
|
||||
:x -1
|
||||
:y -1
|
||||
:width -1
|
||||
:height -1
|
||||
:border-frame :none
|
||||
:label-type :string
|
||||
:label-alignment :center
|
||||
:label "OK"
|
||||
:active :true
|
||||
:visible :true
|
||||
:north-attachment (:grid-line 5 0)
|
||||
:south-attachment (:grid-line 95 0)
|
||||
:east-attachment (:grid-line 30 0)
|
||||
:west-attachment (:grid-line 10 0)
|
||||
)
|
||||
:element cancel_button
|
||||
(
|
||||
:type :button
|
||||
:button-type :push-button
|
||||
:x -1
|
||||
:y -1
|
||||
:width -1
|
||||
:height -1
|
||||
:border-frame :none
|
||||
:label-type :string
|
||||
:label-alignment :center
|
||||
:label "Cancel"
|
||||
:active :true
|
||||
:visible :true
|
||||
:north-attachment (:grid-line 5 0)
|
||||
:south-attachment (:grid-line 95 0)
|
||||
:east-attachment (:grid-line 60 0)
|
||||
:west-attachment (:grid-line 40 0)
|
||||
)
|
||||
:element help_button
|
||||
(
|
||||
:type :button
|
||||
:button-type :push-button
|
||||
:x -1
|
||||
:y -1
|
||||
:width -1
|
||||
:height -1
|
||||
:border-frame :none
|
||||
:label-type :string
|
||||
:label-alignment :center
|
||||
:label "Help"
|
||||
:active :true
|
||||
:visible :true
|
||||
:north-attachment (:grid-line 5 0)
|
||||
:south-attachment (:grid-line 95 0)
|
||||
:east-attachment (:grid-line 90 0)
|
||||
:west-attachment (:grid-line 70 0)
|
||||
)
|
||||
:connection
|
||||
(
|
||||
:from ok_button
|
||||
:to task_dialog
|
||||
:when :activate
|
||||
:action-type :builtin
|
||||
:action :hide
|
||||
:arg-type :void
|
||||
)
|
||||
:connection
|
||||
(
|
||||
:from cancel_button
|
||||
:to task_dialog
|
||||
:when :activate
|
||||
:action-type :builtin
|
||||
:action :hide
|
||||
:arg-type :void
|
||||
)
|
||||
:connection
|
||||
(
|
||||
:from ok_button
|
||||
:when :create
|
||||
:action-type :call-function
|
||||
:action confirm_taskCB
|
||||
:arg-type :void
|
||||
)
|
||||
:connection
|
||||
(
|
||||
:from cancel_button
|
||||
:when :create
|
||||
:action-type :call-function
|
||||
:action cancel_taskCB
|
||||
:arg-type :void
|
||||
)
|
||||
)
|
||||
.in -.5i
|
||||
.fi
|
||||
.\"---need something here
|
||||
.\"----------------------------------------------------------------------------
|
||||
.\"--- Internationalization (I18n)
|
||||
.\"--- If you are talking about a specific feature of the API, describe this
|
||||
.\"--- topic under the DESCRIPTION heading. If you are trying to give guidance
|
||||
.\"--- to programmers on things to look out for in I18n purposes, describe this
|
||||
.\"--- topic under the APPLICATION USAGE heading.
|
||||
.\"---
|
||||
.\"----------------------------------------------------------------------------
|
||||
.\"--- "APPLICATION USAGE"
|
||||
.\"--- This section gives warnings and advice to application writers
|
||||
.\"--- about the entry.
|
||||
.\"---
|
||||
.SH "APPLICATION USAGE"
|
||||
Applications and application developers typically do not work
|
||||
directly with BIL files, instead using them indirectly through
|
||||
the Cde Application Builder.
|
||||
It may, however, be useful for them to understand the layout and
|
||||
scope of BIL to satisfy particular application development needs
|
||||
(e.g. to add specialized comments to BIL files or to examine them
|
||||
to examine useful information (such as help text built-into a
|
||||
application)).
|
||||
.\"---
|
||||
.\"----------------------------------------------------------------------------
|
||||
.\"--- "SEE ALSO"
|
||||
.\"--- This section gives references to related information.
|
||||
.\"--- For example:
|
||||
.\"---
|
||||
.\"--- .SH "SEE ALSO"
|
||||
.\"--- .Hd <header_file.h> 5, if needed
|
||||
.\"--- .Fn file_name include section number,
|
||||
.\"--- .Fn file_name include section number,
|
||||
.\"--- .Fn file_name include section number.
|
||||
.\"---
|
||||
.SH "SEE ALSO"
|
||||
.Cm dtbuilder 1
|
||||
.Cm dtcodegen 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
226
cde/programs/dtappbuilder/src/libABil/bilP.h
Normal file
226
cde/programs/dtappbuilder/src/libABil/bilP.h
Normal file
@@ -0,0 +1,226 @@
|
||||
/*
|
||||
* $XConsortium: bilP.h /main/3 1995/11/06 18:23:28 rswiston $
|
||||
*
|
||||
* @(#)bilP.h 1.49 02 Apr 1995 cde_app_builder/src/libABil
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* bilP.h - bil interface language "stuff"
|
||||
*/
|
||||
#ifndef _ABIL_BIL_P_H_
|
||||
#define _ABIL_BIL_P_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <nl_types.h>
|
||||
#include <ab_private/bil_parse.h>
|
||||
#include <ab/util_types.h>
|
||||
#include <ab_private/obj.h>
|
||||
#include "loadP.h"
|
||||
|
||||
typedef int BIL_TOKEN;
|
||||
#define BIL_TOKEN_MIN_VALUE ((int)AB_BIL_MARKER_FIRST)
|
||||
#define BIL_TOKEN_MAX_VALUE ((int)AB_BIL_MARKER_LAST)
|
||||
#define BIL_TOKEN_NUM_VALUES (BIL_TOKEN_MAX_VALUE \
|
||||
- BIL_TOKEN_MIN_VALUE + 1)
|
||||
/*
|
||||
** I18N defines: Which message set are our messages in? This must be in sync
|
||||
** with the 'set N' definition in the libABil.msg message source text file.
|
||||
**
|
||||
** And what global variable are we expecting as our opened catalog descriptor?
|
||||
*/
|
||||
#define ABIL_MESSAGE_CATD Dtb_project_catd
|
||||
#define ABIL_MESSAGE_SET 204
|
||||
extern nl_catd ABIL_MESSAGE_CATD;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ISTRING fileName;
|
||||
ABObj project;
|
||||
ABObj module;
|
||||
ABObjList compObjsRead;
|
||||
ABObj obj;
|
||||
AB_OBJECT_TYPE objType;
|
||||
BIL_TOKEN att;
|
||||
} BIL_LOAD_INFO;
|
||||
|
||||
/*
|
||||
* Symbols generated by lex/yacc
|
||||
*/
|
||||
extern int AByyparse(void);
|
||||
extern FILE *AByyin;
|
||||
|
||||
/*
|
||||
* module global vars
|
||||
*/
|
||||
extern BIL_LOAD_INFO bilP_load;
|
||||
|
||||
/*
|
||||
* Functions
|
||||
*/
|
||||
extern int bilP_load_set_current_att(BIL_TOKEN att);
|
||||
extern STRING bilP_token_to_string(BIL_TOKEN);
|
||||
extern BIL_TOKEN bilP_string_to_token(STRING);
|
||||
extern BOOL bilP_token_is_bool(BIL_TOKEN);
|
||||
extern BOOL bilP_token_is_string(BIL_TOKEN);
|
||||
|
||||
/*
|
||||
* AppBuilder Symbols
|
||||
*/
|
||||
extern AB_ALIGNMENT bilP_token_to_alignment(BIL_TOKEN);
|
||||
extern BIL_TOKEN bilP_alignment_to_token(AB_ALIGNMENT);
|
||||
extern AB_ARG_CLASS bilP_token_to_arg_class(BIL_TOKEN);
|
||||
extern BIL_TOKEN bilP_arg_class_to_token(AB_ARG_CLASS);
|
||||
extern AB_ARG_TYPE bilP_token_to_arg_type(BIL_TOKEN);
|
||||
extern STRING bilP_arg_class_to_string(AB_ARG_CLASS);
|
||||
extern BIL_TOKEN bilP_arg_type_to_token(AB_ARG_TYPE);
|
||||
extern BOOL bilP_token_to_bool(BIL_TOKEN);
|
||||
extern BIL_TOKEN bilP_bool_to_token(BOOL);
|
||||
extern AB_BUILTIN_ACTION bilP_token_to_builtin_action(BIL_TOKEN);
|
||||
extern BIL_TOKEN bilP_builtin_action_to_token(AB_BUILTIN_ACTION);
|
||||
extern AB_BUTTON_TYPE bilP_token_to_button_type(BIL_TOKEN);
|
||||
extern BIL_TOKEN bilP_button_type_to_token(AB_BUTTON_TYPE);
|
||||
extern AB_CHOICE_TYPE bilP_token_to_choice_type(BIL_TOKEN);
|
||||
extern BIL_TOKEN bilP_choice_type_to_token(AB_CHOICE_TYPE);
|
||||
extern AB_COMPASS_POINT bilP_token_to_compass_point(BIL_TOKEN);
|
||||
extern BIL_TOKEN bilP_compass_point_to_token(AB_COMPASS_POINT);
|
||||
extern ABDndOpFlags bilP_token_to_dnd_op_flag(BIL_TOKEN);
|
||||
extern BIL_TOKEN bilP_dnd_op_flag_to_token(BYTE);
|
||||
extern ABDndTypeFlags bilP_token_to_dnd_type_flag(BIL_TOKEN);
|
||||
extern BIL_TOKEN bilP_dnd_type_flag_to_token(BYTE);
|
||||
extern AB_FUNC_TYPE bilP_token_to_func_type(BIL_TOKEN);
|
||||
extern BIL_TOKEN bilP_func_type_to_token(AB_FUNC_TYPE);
|
||||
extern AB_DIRECTION bilP_token_to_direction(BIL_TOKEN);
|
||||
extern BIL_TOKEN bilP_direction_to_token(AB_DIRECTION);
|
||||
extern AB_LABEL_TYPE bilP_token_to_label_type(BIL_TOKEN);
|
||||
extern BIL_TOKEN bilP_label_type_to_token(AB_LABEL_TYPE);
|
||||
extern AB_GROUP_TYPE bilP_token_to_group_type(BIL_TOKEN);
|
||||
extern BIL_TOKEN bilP_group_type_to_token(AB_GROUP_TYPE);
|
||||
extern STRING bilP_group_type_to_string(AB_GROUP_TYPE);
|
||||
extern AB_OBJECT_TYPE bilP_token_to_object_type(BIL_TOKEN);
|
||||
extern BIL_TOKEN bilP_object_type_to_token(AB_OBJECT_TYPE);
|
||||
extern AB_ORIENTATION bilP_token_to_orientation(BIL_TOKEN);
|
||||
extern BIL_TOKEN bilP_orientation_to_token(AB_ORIENTATION);
|
||||
extern AB_TEXT_TYPE bilP_token_to_text_type(BIL_TOKEN);
|
||||
extern BIL_TOKEN bilP_text_type_to_token(AB_TEXT_TYPE);
|
||||
extern AB_WHEN bilP_token_to_when(BIL_TOKEN);
|
||||
extern BIL_TOKEN bilP_when_to_token(AB_WHEN);
|
||||
extern STRING bilP_compass_point_to_string(AB_COMPASS_POINT);
|
||||
extern STRING bilP_text_type_to_string(AB_TEXT_TYPE);
|
||||
extern AB_CONTAINER_TYPE bilP_token_to_container_type(int);
|
||||
extern BIL_TOKEN bilP_container_type_to_token(AB_CONTAINER_TYPE);
|
||||
extern STRING bilP_container_type_to_string(AB_CONTAINER_TYPE);
|
||||
extern AB_ITEM_TYPE bilP_token_to_item_type(int);
|
||||
extern BIL_TOKEN bilP_item_type_to_token(AB_ITEM_TYPE);
|
||||
extern STRING bilP_item_type_to_string(AB_ITEM_TYPE);
|
||||
extern AB_PACKING bilP_token_to_packing(int);
|
||||
extern BIL_TOKEN bilP_packing_to_token(AB_PACKING);
|
||||
extern STRING bilP_packing_to_string(AB_PACKING);
|
||||
extern STRING bilP_menu_type_to_string(AB_MENU_TYPE);
|
||||
extern AB_LABEL_STYLE bilP_token_to_label_style(BIL_TOKEN);
|
||||
extern BIL_TOKEN bilP_label_style_to_token(AB_LABEL_STYLE);
|
||||
extern STRING bilP_label_style_to_string(AB_LABEL_STYLE);
|
||||
extern STRING bilP_func_type_to_string(AB_FUNC_TYPE);
|
||||
extern STRING bilP_builtin_action_to_string(AB_BUILTIN_ACTION);
|
||||
extern STRING bilP_when_to_string(AB_WHEN);
|
||||
extern BIL_TOKEN bilP_attachment_to_token(AB_ATTACH_TYPE);
|
||||
extern AB_ATTACH_TYPE bilP_token_to_attachment(int);
|
||||
extern STRING bilP_attachment_to_string(AB_ATTACH_TYPE);
|
||||
extern STRING bilP_alignment_to_string(AB_ALIGNMENT);
|
||||
extern STRING bilP_label_type_to_string(AB_LABEL_TYPE);
|
||||
extern STRING bilP_button_type_to_string(AB_BUTTON_TYPE);
|
||||
extern STRING bilP_orientation_to_string(AB_ORIENTATION);
|
||||
extern STRING bilP_direction_to_string(AB_DIRECTION);
|
||||
extern STRING bilP_choice_type_to_string(AB_CHOICE_TYPE);
|
||||
extern STRING bilP_arg_type_to_string(AB_ARG_TYPE);
|
||||
extern BIL_TOKEN bilP_initial_state_to_token(AB_OBJECT_STATE);
|
||||
extern AB_OBJECT_STATE bilP_token_to_initial_state(int);
|
||||
extern STRING bilP_initial_state_to_string(AB_OBJECT_STATE);
|
||||
extern AB_LINE_TYPE bilP_token_to_border_frame(int);
|
||||
extern BIL_TOKEN bilP_border_frame_to_token(AB_LINE_TYPE);
|
||||
extern STRING bilP_border_frame_to_string(AB_LINE_TYPE);
|
||||
extern AB_LINE_TYPE bilP_token_to_line_style(int);
|
||||
extern BIL_TOKEN bilP_line_style_to_token(AB_LINE_TYPE);
|
||||
extern STRING bilP_line_style_to_string(AB_LINE_TYPE);
|
||||
extern BIL_TOKEN bilP_selection_mode_to_token(AB_SELECT_TYPE);
|
||||
extern STRING bilP_selection_mode_to_string(AB_SELECT_TYPE);
|
||||
extern AB_SELECT_TYPE bilP_token_to_selection_mode(int);
|
||||
extern AB_ARROW_STYLE bilP_token_to_arrow_style(int);
|
||||
extern BIL_TOKEN bilP_arrow_style_to_token(AB_ARROW_STYLE);
|
||||
extern STRING bilP_arrow_style_to_string(AB_ARROW_STYLE);
|
||||
extern BIL_TOKEN bilP_scrollbar_policy_to_token(AB_SCROLLBAR_POLICY);
|
||||
extern AB_SCROLLBAR_POLICY bilP_token_to_scrollbar_policy(BIL_TOKEN);
|
||||
extern STRING bilP_scrollbar_policy_to_string(AB_SCROLLBAR_POLICY);
|
||||
extern BIL_TOKEN bilP_msg_type_to_token(AB_MESSAGE_TYPE);
|
||||
extern AB_MESSAGE_TYPE bilP_token_to_msg_type(BIL_TOKEN);
|
||||
extern STRING bilP_msg_type_to_string(AB_MESSAGE_TYPE);
|
||||
extern BIL_TOKEN bilP_file_type_mask_to_token(AB_FILE_TYPE_MASK);
|
||||
extern AB_FILE_TYPE_MASK bilP_token_to_file_type_mask(BIL_TOKEN);
|
||||
extern STRING bilP_file_type_mask_to_string(AB_FILE_TYPE_MASK);
|
||||
extern BIL_TOKEN bilP_sessioning_method_to_token(AB_SESSIONING_METHOD);
|
||||
extern AB_SESSIONING_METHOD bilP_token_to_sessioning_method(BIL_TOKEN);
|
||||
extern STRING bilP_sessioning_method_to_string(AB_SESSIONING_METHOD);
|
||||
extern BIL_TOKEN bilP_tt_desktop_level_to_token(AB_TOOLTALK_LEVEL);
|
||||
extern AB_TOOLTALK_LEVEL bilP_token_to_tt_desktop_level(BIL_TOKEN);
|
||||
extern STRING bilP_tt_desktop_level_to_string(AB_TOOLTALK_LEVEL);
|
||||
extern BIL_TOKEN bilP_default_button_to_token(AB_DEFAULT_BUTTON);
|
||||
extern AB_DEFAULT_BUTTON bilP_token_to_default_button(BIL_TOKEN);
|
||||
extern STRING bilP_default_button_to_string(AB_DEFAULT_BUTTON);
|
||||
|
||||
/*
|
||||
* Call bil_load_reset() before calling AByyparse
|
||||
*/
|
||||
extern int bilP_load_reset(void);
|
||||
extern int bilP_load_get_token(void);
|
||||
extern int bilP_load_get_length(void);
|
||||
extern int bilP_load_get_line_number(void);
|
||||
extern int bilP_load_set_line_number(int lineNumber);
|
||||
extern int bilP_load_get_value_type(void);
|
||||
extern char * bilP_load_get_value(void);
|
||||
|
||||
/*
|
||||
* load actions from BIL file
|
||||
*/
|
||||
extern STRING bilP_load_att_from(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_to(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_when(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_action_type(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_action(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_arg_type(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_arg_value(BIL_TOKEN);
|
||||
|
||||
/*
|
||||
* load object from BIL file
|
||||
*/
|
||||
extern STRING bilP_load_end_of_obj(BIL_TOKEN objClass);
|
||||
extern int bilP_load_end_of_file(void);
|
||||
extern int bilP_load_end_of_data(void);
|
||||
|
||||
extern void bilP_reset_token_text(void);
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
** **
|
||||
** Inline implementation **
|
||||
** **
|
||||
******************************************************************/
|
||||
|
||||
#define bilP_token_is_bool(t) \
|
||||
( ((t) == AB_BIL_TRUE) || ((t) == AB_BIL_FALSE) )
|
||||
|
||||
#define bilP_token_is_string(t) \
|
||||
( ((t) == AB_BIL_VALUE_STRING) || ((t) == AB_BIL_NIL) )
|
||||
|
||||
#endif /* _ABIL_BIL_P_H_ */
|
||||
447
cde/programs/dtappbuilder/src/libABil/bil_lexer.c
Normal file
447
cde/programs/dtappbuilder/src/libABil/bil_lexer.c
Normal file
@@ -0,0 +1,447 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: bil_lexer.c /main/3 1995/11/06 18:23:43 rswiston $
|
||||
*
|
||||
* @(#)bil_lexer.c 1.9 02 Apr 1995 cde_app_builder/src/libABil
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* bil_lexer.c
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <ab_private/abio.h>
|
||||
#include <ab_private/util.h>
|
||||
#include "load.h"
|
||||
#include "bil_parse.h"
|
||||
#include "bilP.h"
|
||||
#undef DEBUG
|
||||
/* #define DEBUG */
|
||||
|
||||
|
||||
/*
|
||||
* Public symbols
|
||||
*/
|
||||
FILE *AByyin = NULL;
|
||||
|
||||
#define MAX_TOKEN_LEN 1023
|
||||
#define MAX_TOKEN_SIZE (MAX_TOKEN_LEN + 1) /* len+1 for NULL */
|
||||
|
||||
static int line_number= 1;
|
||||
static int last_token= AB_BIL_UNDEF;
|
||||
static char* last_token_value= NULL;
|
||||
static int last_value_type= AB_BIL_UNDEF;
|
||||
static char tokenText[MAX_TOKEN_SIZE] = "";
|
||||
static int tokenTextLen = 0;
|
||||
|
||||
#define save_token(x) (last_token = (x))
|
||||
#define save_type(x) (save_token(last_value_type = (x)))
|
||||
|
||||
#ifdef DEBUG
|
||||
#define retkey(x) { int keyword = (x); \
|
||||
printf("lex-k:/%s/%d/%s/\n", \
|
||||
tokenText, \
|
||||
keyword, \
|
||||
util_strsafe(bilP_token_to_string(keyword))); \
|
||||
return save_token(keyword);}
|
||||
|
||||
#define retval(x) { int value = (x); \
|
||||
printf("lex-v:/%s/%d/%s/\n", \
|
||||
tokenText, \
|
||||
value, \
|
||||
util_strsafe(bilP_token_to_string(value))); \
|
||||
return save_type(value);}
|
||||
|
||||
#define retchar(x) { int value = (x); \
|
||||
printf("lex:'%c'\n", (value)); \
|
||||
return (value);}
|
||||
|
||||
#else
|
||||
#define retkey(x) return save_token(x)
|
||||
#define retval(x) return save_type(x)
|
||||
#define retchar(x) return (x)
|
||||
#endif /* DEBUG */
|
||||
|
||||
static int get_token(FILE *file);
|
||||
static int get_keyword(FILE *file, int lastChar);
|
||||
static int get_comment(FILE *file, int lastChar);
|
||||
static int get_string(FILE *file, int lastChar);
|
||||
static int get_ident(FILE *file, int lastChar);
|
||||
static int get_number(FILE *file, int lastChar);
|
||||
static int get_(FILE *file, int lastChar);
|
||||
|
||||
|
||||
int
|
||||
AByylex(void)
|
||||
{
|
||||
return get_token(AByyin);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns the token
|
||||
*/
|
||||
static int
|
||||
get_token(FILE *file)
|
||||
{
|
||||
register int c; /* static for speed */
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
c = fgetc(file);
|
||||
switch (c)
|
||||
{
|
||||
case EOF:
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case ':':
|
||||
retkey(get_keyword(file, c));
|
||||
break;
|
||||
|
||||
case 'a': case 'b': case 'c': case 'd': case 'e':
|
||||
case 'f': case 'g': case 'h': case 'i': case 'j':
|
||||
case 'k': case 'l': case 'm': case 'n': case 'o':
|
||||
case 'p': case 'q': case 'r': case 's': case 't':
|
||||
case 'u': case 'v': case 'w': case 'x': case 'y':
|
||||
case 'z':
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E':
|
||||
case 'F': case 'G': case 'H': case 'I': case 'J':
|
||||
case 'K': case 'L': case 'M': case 'N': case 'O':
|
||||
case 'P': case 'Q': case 'R': case 'S': case 'T':
|
||||
case 'U': case 'V': case 'W': case 'X': case 'Y':
|
||||
case 'Z':
|
||||
retval(get_ident(file, c));
|
||||
break;
|
||||
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
case '-':
|
||||
retval(get_number(file, c));
|
||||
break;
|
||||
|
||||
case '\"':
|
||||
retval(get_string(file, c));
|
||||
break;
|
||||
|
||||
case '/':
|
||||
if ((c = fgetc(file)) == '/')
|
||||
{
|
||||
get_comment(file, c);
|
||||
}
|
||||
else
|
||||
{
|
||||
ungetc(c, file);
|
||||
retval(get_ident(file, '/'));
|
||||
}
|
||||
break;
|
||||
|
||||
case '(': case ')':
|
||||
retchar(c);
|
||||
break;
|
||||
|
||||
case '\n':
|
||||
++line_number;
|
||||
break;
|
||||
|
||||
case '.':
|
||||
c = fgetc(file);
|
||||
if (isdigit(c))
|
||||
{
|
||||
ungetc(c,file);
|
||||
retval(get_number(file, '.'));
|
||||
}
|
||||
else
|
||||
{
|
||||
ungetc(c, file);
|
||||
retval(get_ident(file, '.'));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
get_ident(FILE *file, int lastChar)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
tokenTextLen = 0;
|
||||
tokenText[tokenTextLen++] = lastChar;
|
||||
|
||||
while ( ((c = fgetc(file)) != EOF) && ( isalnum(c)
|
||||
|| (c == '_') || (c == '.') || (c == '/')) )
|
||||
{
|
||||
tokenText[tokenTextLen++] = c;
|
||||
}
|
||||
tokenText[tokenTextLen] = 0;
|
||||
if (c != EOF)
|
||||
{
|
||||
ungetc(c, file);
|
||||
}
|
||||
|
||||
return AB_BIL_VALUE_IDENT;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Gets a keyword and returns its BIL_TOKEN
|
||||
*/
|
||||
static int
|
||||
get_keyword(FILE *file, int lastChar)
|
||||
{
|
||||
int iChar= 0;
|
||||
BIL_TOKEN keywordToken= AB_BIL_UNDEF;
|
||||
|
||||
tokenTextLen = 0;
|
||||
tokenText[tokenTextLen++] = lastChar;
|
||||
while ( ((iChar= fgetc(file)) != EOF)
|
||||
&& (((!isspace(iChar)) && (iChar != ')') && (iChar != '(')))
|
||||
)
|
||||
{
|
||||
tokenText[tokenTextLen++]= iChar;
|
||||
}
|
||||
tokenText[tokenTextLen]= 0;
|
||||
if (iChar != EOF)
|
||||
{
|
||||
ungetc(iChar, file);
|
||||
}
|
||||
|
||||
keywordToken= bilP_string_to_token(tokenText);
|
||||
|
||||
if (keywordToken == AB_BIL_UNDEF)
|
||||
{
|
||||
/*
|
||||
* This will not be executed if the actual :undef keyword is seen
|
||||
* in the BIL file. :undef is AB_BIL_UNDEF_KEYWORD, and is a
|
||||
* valid keyword.
|
||||
*
|
||||
* The token AB_BIL_UNDEF signifies that the keyword in the BIL
|
||||
* file was invalid and could not be converted to a token.
|
||||
*/
|
||||
char msg[256];
|
||||
sprintf(msg,
|
||||
catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET, 35,
|
||||
"unknown keyword - %s"),
|
||||
tokenText);
|
||||
abil_print_custom_load_err(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (keywordToken)
|
||||
{
|
||||
/*
|
||||
* If it's a type, save it
|
||||
*/
|
||||
case AB_BIL_FALSE:
|
||||
case AB_BIL_NIL:
|
||||
case AB_BIL_TRUE:
|
||||
save_type(keywordToken);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return keywordToken;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
get_number(FILE *file, int lastChar)
|
||||
{
|
||||
int c = -1;
|
||||
BOOL dotSeen = FALSE;
|
||||
|
||||
tokenTextLen = 0;
|
||||
tokenText[tokenTextLen++] = lastChar;
|
||||
|
||||
while ( ((c = fgetc(file)) != EOF)
|
||||
&& (isalnum(c) || (c == '.')) )
|
||||
{
|
||||
if (c == '.')
|
||||
{
|
||||
/* only allow 1 decimal in number */
|
||||
if (dotSeen)
|
||||
{
|
||||
break;
|
||||
}
|
||||
dotSeen = TRUE;
|
||||
}
|
||||
tokenText[tokenTextLen++] = c;
|
||||
}
|
||||
tokenText[tokenTextLen] = 0;
|
||||
if (c != EOF)
|
||||
{
|
||||
ungetc(c, file);
|
||||
}
|
||||
|
||||
return dotSeen? AB_BIL_VALUE_FLOAT:AB_BIL_VALUE_INT;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Reads in and discards a comment
|
||||
*/
|
||||
static int
|
||||
get_comment(FILE *file, int lastChar)
|
||||
{
|
||||
int c;
|
||||
while (((c= fgetc(file)) != EOF) && (c != '\n'))
|
||||
{
|
||||
/* fprintf(yyout, "%c", c); fflush(yyout); */
|
||||
}
|
||||
++line_number;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reads in and saves a string value.
|
||||
*/
|
||||
static int
|
||||
get_string(FILE *file, int lastChar)
|
||||
{
|
||||
ISTRING istring = NULL;
|
||||
char *string= NULL;
|
||||
|
||||
ungetc(lastChar, file);
|
||||
abio_get_string(file, &istring);
|
||||
|
||||
tokenText[0]= 0; tokenTextLen= 0;
|
||||
string = istr_string(istring);
|
||||
if (string != NULL)
|
||||
{
|
||||
int i;
|
||||
int len = strlen(string);
|
||||
for (i= 0; i < len; ++i)
|
||||
{
|
||||
if (string[i] == '\n')
|
||||
{
|
||||
++line_number;
|
||||
}
|
||||
}
|
||||
util_strncpy(tokenText, string, MAX_TOKEN_LEN);
|
||||
tokenTextLen= strlen(tokenText);
|
||||
}
|
||||
istr_destroy(istring);
|
||||
|
||||
return AB_BIL_VALUE_STRING;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Called by the lexical analyzer or parser whenever an error occurs.
|
||||
*/
|
||||
void
|
||||
AByyerror(const char *message)
|
||||
{
|
||||
char tokenMsg[1024] = "";
|
||||
char errMsg[1024] = "";
|
||||
|
||||
if (strlen(tokenText) > 0)
|
||||
{
|
||||
sprintf(tokenMsg,
|
||||
catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET, 37, ", near '%s'"),
|
||||
tokenText);
|
||||
}
|
||||
sprintf(errMsg, "%s%s\n", message, tokenMsg);
|
||||
abil_print_custom_load_err(errMsg);
|
||||
}
|
||||
|
||||
#ifdef BOGUS
|
||||
/*
|
||||
* Called by lexical analyzer at EOF. Returning 1 ends parsing.
|
||||
*/
|
||||
int
|
||||
yywrap()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif /* BOGUS */
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Public functions **
|
||||
** **
|
||||
*************************************************************************/
|
||||
|
||||
int
|
||||
bilP_load_reset()
|
||||
{
|
||||
line_number= 1;
|
||||
last_token= AB_BIL_UNDEF;
|
||||
last_value_type= AB_BIL_UNDEF;
|
||||
last_token_value= NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bilP_load_get_token()
|
||||
{
|
||||
return last_token;
|
||||
}
|
||||
|
||||
int
|
||||
bilP_load_get_value_type(void)
|
||||
{
|
||||
return last_value_type;
|
||||
}
|
||||
|
||||
STRING
|
||||
bilP_load_get_value(void)
|
||||
{
|
||||
return tokenText;
|
||||
}
|
||||
|
||||
int
|
||||
bilP_load_get_length()
|
||||
{
|
||||
return tokenTextLen;
|
||||
}
|
||||
|
||||
int
|
||||
bilP_load_get_line_number()
|
||||
{
|
||||
return line_number;
|
||||
}
|
||||
|
||||
int
|
||||
bilP_load_set_line_number(int lineNumber)
|
||||
{
|
||||
line_number= lineNumber;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
allprint(char c)
|
||||
{
|
||||
printf("'%c'", c);
|
||||
}
|
||||
|
||||
void
|
||||
sprint(char *s)
|
||||
{
|
||||
printf("\"%s\"", s);
|
||||
}
|
||||
|
||||
void
|
||||
bilP_reset_token_text(void)
|
||||
{
|
||||
sprintf(tokenText, "");
|
||||
}
|
||||
442
cde/programs/dtappbuilder/src/libABil/bil_loadact.c
Normal file
442
cde/programs/dtappbuilder/src/libABil/bil_loadact.c
Normal file
@@ -0,0 +1,442 @@
|
||||
/*
|
||||
* $XConsortium: bil_loadact.c /main/3 1995/11/06 18:24:00 rswiston $
|
||||
*
|
||||
* @(#)bil_loadact.c 1.47 02 Feb 1995
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* billdact.c - load action and handler attributes
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ab_private/trav.h>
|
||||
#include <ab_private/util.h>
|
||||
#include <ab/util_types.h>
|
||||
#include "../libABobj/obj_utils.h"
|
||||
#include "load.h"
|
||||
#include "bil_loadattP.h"
|
||||
#include "bilP.h"
|
||||
|
||||
/*static int add_user_handler(ABObj obj, ABObj module,
|
||||
ISTRING handler, AB_WHEN when);
|
||||
static int install_action(ABObj obj, ABObj module, ABObj action);*/
|
||||
|
||||
static int install_action(ABObj obj, ABObj module, ABObj action);
|
||||
#ifdef BOGUS
|
||||
static ABObj find_or_create_target(ABObj obj, ABObj module,
|
||||
ISTRING parent_name, ISTRING name);
|
||||
#endif /* BOGUS */
|
||||
|
||||
#define nset_att(a) (bilP_load_set_current_att(a))
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** **
|
||||
** General actions **
|
||||
** **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* Get the source object.
|
||||
*/
|
||||
STRING
|
||||
bilP_load_att_from(BIL_TOKEN valueToken)
|
||||
{
|
||||
ABObj newObj = NULL;
|
||||
ABObj src_module = NULL;
|
||||
STRING stringValue = bilP_load_get_value();
|
||||
|
||||
#ifdef DEBUG
|
||||
util_dprintf(4, "bilP_load_att_from: %d/%s\n",
|
||||
valueToken,
|
||||
str_safe(bilP_token_to_string(valueToken)));
|
||||
#endif
|
||||
|
||||
nset_att(AB_BIL_FROM);
|
||||
if (valueToken == AB_BIL_APPLICATION)
|
||||
{
|
||||
bilP_load.obj->info.action.from = bilP_load.project;
|
||||
}
|
||||
else if (valueToken == AB_BIL_VALUE_IDENT)
|
||||
{
|
||||
/* This will either find the correct ABObj for the connection
|
||||
* source or it will create a proxy object for it. If the
|
||||
* connection is a cross-module one, this will create both
|
||||
* the source module and the source object if they have not
|
||||
* yet been loaded into the tree. In this case, the dummy
|
||||
* module and object will be handled when the bil file is
|
||||
* read in and the name of the module is encountered. See
|
||||
* bilP_load_att_name() in bil_loadatt.c.
|
||||
*/
|
||||
newObj = obj_scoped_find_or_create_undef(bilP_load.module,
|
||||
stringValue, AB_TYPE_UNKNOWN);
|
||||
src_module = obj_get_module(newObj);
|
||||
|
||||
/* bilP_load.obj is the action created in bilP_load_att_class().
|
||||
* If the connection is a cross-module one, it is stored off of
|
||||
* the project object, otherwise it is stored off of the module.
|
||||
*/
|
||||
bilP_load.obj->info.action.from = newObj;
|
||||
}
|
||||
else if (valueToken == AB_BIL_NIL)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
abil_print_load_err(ERR_WANT_NAME);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the destination object.
|
||||
*/
|
||||
STRING
|
||||
bilP_load_att_to(BIL_TOKEN valueToken)
|
||||
{
|
||||
ABObj toObj= NULL;
|
||||
STRING stringValue= bilP_load_get_value();
|
||||
|
||||
#ifdef DEBUG
|
||||
util_dprintf(3, "bilP_load_att_to: %d/%s\n",
|
||||
valueToken,
|
||||
str_safe(bilP_token_to_string(valueToken)));
|
||||
#endif
|
||||
|
||||
nset_att(AB_BIL_TO);
|
||||
|
||||
if (valueToken == AB_BIL_VALUE_IDENT)
|
||||
{
|
||||
/* This will either find the correct ABObj for the connection
|
||||
* source or it will create a proxy object for it. If the
|
||||
* connection is a cross-module one, this will create both
|
||||
* the source module and the source object if they have not
|
||||
* yet been loaded into the tree. In this case, the dummy
|
||||
* module and object will be handled when the bil file is
|
||||
* read in and the name of the module is encountered. See
|
||||
* bilP_load_att_name() in bil_loadatt.c.
|
||||
*/
|
||||
toObj = obj_scoped_find_or_create_undef(bilP_load.module,
|
||||
stringValue, AB_TYPE_UNKNOWN);
|
||||
bilP_load.obj->info.action.to = toObj;
|
||||
}
|
||||
else if (valueToken == AB_BIL_NIL)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
abil_print_load_err(ERR_WANT_NAME);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the when part of a connection.
|
||||
*/
|
||||
STRING
|
||||
bilP_load_att_when(BIL_TOKEN valueToken)
|
||||
{
|
||||
AB_WHEN when= AB_WHEN_UNDEF;
|
||||
|
||||
#ifdef DEBUG
|
||||
util_dprintf(3, "bilP_load_att_when: %d/%s\n",
|
||||
valueToken,
|
||||
str_safe(bilP_token_to_string(valueToken)));
|
||||
#endif
|
||||
|
||||
/*
|
||||
abil_loadmsg_set_att(":when");
|
||||
*/
|
||||
nset_att(AB_BIL_WHEN);
|
||||
|
||||
when = bilP_token_to_when(valueToken);
|
||||
if (when == AB_WHEN_UNDEF)
|
||||
{
|
||||
abil_print_load_err(ERR_WANT_NAME);
|
||||
}
|
||||
|
||||
/* If the source object is a radiobox or
|
||||
* checkbox item and the when is :activate,
|
||||
* convert it to be :toggle. This is done
|
||||
* to maintain backwards compatibility.
|
||||
*/
|
||||
if (obj_is_choice_item(bilP_load.obj->info.action.from) &&
|
||||
!obj_is_option_menu(obj_get_root(
|
||||
obj_get_parent(bilP_load.obj->info.action.from))))
|
||||
{
|
||||
if (when == AB_WHEN_ACTIVATED)
|
||||
when = AB_WHEN_TOGGLED;
|
||||
}
|
||||
bilP_load.obj->info.action.when = when;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the action_type for an action holder
|
||||
*/
|
||||
STRING
|
||||
bilP_load_att_action_type(BIL_TOKEN valueToken)
|
||||
{
|
||||
AB_FUNC_TYPE func_type = bilP_token_to_func_type(valueToken);
|
||||
|
||||
util_dprintf(3, "bilP_load_att_action: %d/%s\n",
|
||||
valueToken,
|
||||
str_safe(bilP_token_to_string(valueToken)));
|
||||
|
||||
nset_att(AB_BIL_ACTION_TYPE);
|
||||
if (func_type == AB_FUNC_UNDEF)
|
||||
{
|
||||
abil_print_load_err(ERR_UNKNOWN_OBJ);
|
||||
return NULL;
|
||||
}
|
||||
obj_set_func_type(bilP_load.obj, func_type);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
STRING
|
||||
bilP_load_att_action(BIL_TOKEN valueToken)
|
||||
{
|
||||
STRING stringValue = bilP_load_get_value();
|
||||
|
||||
#ifdef DEBUG
|
||||
util_dprintf(3, "bilP_load_att_action: %d/%s\n",
|
||||
valueToken,
|
||||
str_safe(bilP_token_to_string(valueToken)));
|
||||
#endif
|
||||
|
||||
nset_att(AB_BIL_ACTION);
|
||||
|
||||
/* Check if this is user defined */
|
||||
if (valueToken == AB_BIL_VALUE_IDENT)
|
||||
{
|
||||
obj_set_func_name(bilP_load.obj, stringValue);
|
||||
}
|
||||
/* Check if this is execute code */
|
||||
else
|
||||
if (valueToken == AB_BIL_VALUE_STRING)
|
||||
{
|
||||
obj_set_func_code(bilP_load.obj, stringValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
AB_BUILTIN_ACTION action = AB_STDACT_UNDEF;
|
||||
action = bilP_token_to_builtin_action(valueToken);
|
||||
obj_set_func_builtin(bilP_load.obj, action);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the arg_type of an action_holder
|
||||
*/
|
||||
STRING
|
||||
bilP_load_att_arg_type(BIL_TOKEN valueToken)
|
||||
{
|
||||
AB_ARG_TYPE arg_type = bilP_token_to_arg_type(valueToken);
|
||||
|
||||
#ifdef DEBUG
|
||||
util_dprintf(3, "bilP_load_att_arg_type: %d/%s\n",
|
||||
valueToken,
|
||||
str_safe(bilP_token_to_string(valueToken)));
|
||||
#endif
|
||||
|
||||
nset_att(AB_BIL_ARG_TYPE);
|
||||
|
||||
if (arg_type == AB_ARG_UNDEF)
|
||||
{
|
||||
abil_print_load_err(ERR_UNKNOWN_OBJ);
|
||||
return NULL;
|
||||
}
|
||||
obj_set_arg_type(bilP_load.obj, arg_type);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
install_action(ABObj obj, ABObj module, ABObj action)
|
||||
{
|
||||
ABObj oldaction= NULL;
|
||||
ABObj project= obj_get_project(module);
|
||||
|
||||
/*
|
||||
* For efficiency, we check this module first to avoid searching
|
||||
* the entire project unless necessary.
|
||||
*/
|
||||
|
||||
oldaction= obj_find_action(module, action);
|
||||
if (oldaction == NULL)
|
||||
{
|
||||
oldaction= obj_find_action(project, action);
|
||||
}
|
||||
|
||||
if (oldaction != NULL)
|
||||
{
|
||||
/* we've seen this action, before */
|
||||
obj_destroy(action);
|
||||
action= oldaction;
|
||||
if (obj_get_module(action) != module)
|
||||
{
|
||||
/*
|
||||
* The action is in another module. Move
|
||||
* it to the project
|
||||
*/
|
||||
if (!obj_is_project(action->parent))
|
||||
{
|
||||
obj_unparent(action);
|
||||
obj_add_action(project, action);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* insert it into the current module */
|
||||
obj_add_action(module, action);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef BOGUS
|
||||
/*
|
||||
* Finds the target matching the given description, creating it if necessary.
|
||||
*
|
||||
* Assumes: strings are pointers to allocated space. Sets strings to NULL,
|
||||
* if the values are used.
|
||||
*
|
||||
* Assumes that obj may not be in the object tree yet, and may return
|
||||
* it as the target.
|
||||
*/
|
||||
static ABObj
|
||||
find_or_create_target(ABObj obj, ABObj module,
|
||||
ISTRING parent_name,
|
||||
ISTRING obj_name )
|
||||
{
|
||||
STRING target_parent_name[256];
|
||||
STRING target_name[256];
|
||||
ABObj target_parent= NULL;
|
||||
ABObj target= NULL;
|
||||
|
||||
/* util_dprintf(3, "find_or_create_target('%s' '%s' '%s')\n",
|
||||
nullstr(parent_name),
|
||||
nullstr(obj_name), nullstr(item_label)); */
|
||||
|
||||
*target_parent_name= 0;
|
||||
*target_name= 0;
|
||||
if (obj_name == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if (parent_name != NULL)
|
||||
{
|
||||
/* we have parent name and object name */
|
||||
strcpy((STRING)target_parent_name, istr_string(parent_name));
|
||||
strcpy((STRING)target_name, istr_string(obj_name));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* object name only (what a concept!) */
|
||||
strcpy((STRING)target_name, istr_string(obj_name));
|
||||
}
|
||||
|
||||
/*
|
||||
* Find target parent
|
||||
*/
|
||||
if (*target_parent_name == 0)
|
||||
{
|
||||
target_parent= module;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (istr_equalstr(obj->name, (STRING)target_parent_name))
|
||||
{
|
||||
target_parent= obj;
|
||||
}
|
||||
else
|
||||
{
|
||||
target_parent= obj_scoped_find_or_create_undef(module,
|
||||
(STRING)target_parent_name,
|
||||
AB_TYPE_UNKNOWN);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Find target
|
||||
*/
|
||||
if (istr_equalstr(obj->name, (STRING)target_name))
|
||||
{
|
||||
target= obj;
|
||||
}
|
||||
else
|
||||
{
|
||||
target= obj_scoped_find_or_create_undef(target_parent,
|
||||
(STRING)target_name, AB_TYPE_UNKNOWN);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
#endif /* BOGUS */
|
||||
|
||||
STRING
|
||||
bilP_load_att_arg_value(BIL_TOKEN valueToken)
|
||||
{
|
||||
STRING stringValue = bilP_load_get_value();
|
||||
|
||||
#ifdef DEBUG
|
||||
util_dprintf(3, "bilP_load_att_arg_value: %d/%s\n",
|
||||
valueToken,
|
||||
str_safe(bilP_token_to_string(valueToken)));
|
||||
#endif
|
||||
|
||||
nset_att(AB_BIL_ARG_VALUE);
|
||||
|
||||
/* Check if arg is an integer */
|
||||
if (valueToken == AB_BIL_VALUE_INT)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
util_dprintf(0, "\targ is an int = %d\n", atoi(stringValue));
|
||||
#endif
|
||||
obj_set_arg_int(bilP_load.obj, atoi(stringValue));
|
||||
}
|
||||
/* Check if arg is a float */
|
||||
else
|
||||
if (valueToken == AB_BIL_VALUE_FLOAT)
|
||||
{
|
||||
float fval;
|
||||
fval = (float) atof(stringValue);
|
||||
#ifdef DEBUG
|
||||
util_dprintf(3, "\targ is a float = %f\n", fval);
|
||||
#endif
|
||||
obj_set_arg_float(bilP_load.obj, fval);
|
||||
}
|
||||
else
|
||||
if (valueToken == AB_BIL_VALUE_STRING)
|
||||
{
|
||||
ISTRING istringValue = bilP_get_string();
|
||||
#ifdef DEBUG
|
||||
util_dprintf(3, "\targ is an istring = %s\n", istr_string(istringValue));
|
||||
#endif
|
||||
obj_set_arg_string(bilP_load.obj, stringValue);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
3123
cde/programs/dtappbuilder/src/libABil/bil_loadatt.c
Normal file
3123
cde/programs/dtappbuilder/src/libABil/bil_loadatt.c
Normal file
File diff suppressed because it is too large
Load Diff
180
cde/programs/dtappbuilder/src/libABil/bil_loadattP.h
Normal file
180
cde/programs/dtappbuilder/src/libABil/bil_loadattP.h
Normal file
@@ -0,0 +1,180 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: bil_loadattP.h /main/3 1995/11/06 18:24:55 rswiston $
|
||||
*
|
||||
* @(#)bil_loadattP.h 1.47 22 Nov 1994
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* billdatt.h - load attribute (BIL) header file
|
||||
*/
|
||||
#ifndef _ABIL_BILLDATT_H_
|
||||
#define _ABIL_BILLDATT_H_
|
||||
|
||||
#include "bilP.h"
|
||||
|
||||
extern ISTRING bilP_get_string();
|
||||
extern STRING bilP_load_att_class(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_class_name(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_children_begin(void);
|
||||
extern STRING bilP_load_att_children_end(void);
|
||||
extern STRING bilP_load_att_container_type(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_decimal_points(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_default(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_drag_cursor(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_drag_cursor_mask(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_drag_enabled(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_drag_ops_begin(void);
|
||||
extern STRING bilP_load_att_drag_ops_end(void);
|
||||
extern STRING bilP_load_att_drag_to_root_allowed(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_drag_types_begin(void);
|
||||
extern STRING bilP_load_att_drag_types_end(void);
|
||||
extern STRING bilP_load_att_drawarea_width(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_drawarea_height(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_drop_enabled(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_drop_ops_begin(void);
|
||||
extern STRING bilP_load_att_drop_ops_end(void);
|
||||
extern STRING bilP_load_att_drop_site_child_allowed(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_drop_types_begin(void);
|
||||
extern STRING bilP_load_att_drop_types_end(void);
|
||||
extern STRING bilP_load_att_files_begin(void);
|
||||
extern STRING bilP_load_att_files_end(void);
|
||||
extern STRING bilP_load_att_icon_label(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_increment(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_initial_state(BIL_TOKEN valueToken);
|
||||
extern STRING bilP_load_att_item_type(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_accelerator(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_alignment(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_col_alignment(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_res_file_types_begin(void);
|
||||
extern STRING bilP_load_att_res_file_types_end(void);
|
||||
extern STRING bilP_load_att_row_alignment(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_bg_color(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_button_type(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_fg_color(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_file_chooser_type(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_group_type(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_hattach_type(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_vattach_type(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_height(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_height_max(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_height_resizable(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_help_text(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_hscrollbar(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_hspacing(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_hoffset(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_icon(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_icon_mask(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_label(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_label_emphasis(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_label_type(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_max_label(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_max_value(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_menu(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_menu_title(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_menu_type(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_min_label(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_min_value(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_mnemonic(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_multiple_selections(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_name(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_num_columns(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_orientation(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_win_parent(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_reference_point(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_resource(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_read_only(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_root_window(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_selection_mode(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_selection_required(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_choice_type(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_has_footer(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_max_length(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_tear_off(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_text_type(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_initial_value(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_vendor(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_version(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_visible(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_voffset(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_vscrollbar(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_vspacing(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_num_rows(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_selected(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_type(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_user_data(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_width(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_width_max(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_width_resizable(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_x(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_y(BIL_TOKEN);
|
||||
extern STRING bilP_load_list_value(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_is_help_item(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_border_frame(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_resizable(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_sb_always_visible(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_label_position(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_process_string(BIL_TOKEN valueToken);
|
||||
extern STRING bilP_load_att_east_attachment_begin(void);
|
||||
extern STRING bilP_load_att_east_attachment_end(void);
|
||||
extern STRING bilP_load_att_west_attachment_begin(void);
|
||||
extern STRING bilP_load_att_west_attachment_end(void);
|
||||
extern STRING bilP_load_att_north_attachment_begin(void);
|
||||
extern STRING bilP_load_att_north_attachment_end(void);
|
||||
extern STRING bilP_load_att_south_attachment_begin(void);
|
||||
extern STRING bilP_load_att_south_attachment_end(void);
|
||||
extern STRING bilP_load_attachment_type(BIL_TOKEN);
|
||||
extern STRING bilP_load_attachment_value(BIL_TOKEN);
|
||||
extern STRING bilP_load_attachment_offset(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_label_position(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_help_volume( BIL_TOKEN);
|
||||
extern STRING bilP_load_att_help_location( BIL_TOKEN);
|
||||
extern STRING bilP_load_att_word_wrap(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_line_style(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_arrow_style(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_active(BIL_TOKEN );
|
||||
extern STRING bilP_load_att_iconic(BIL_TOKEN );
|
||||
extern STRING bilP_load_att_combo_box_style(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_show_value(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_slider_type( BIL_TOKEN);
|
||||
extern STRING bilP_load_selection_mode(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_ok_label(BIL_TOKEN );
|
||||
extern STRING bilP_load_att_auto_dismiss(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_directory(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_direction(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_filter_pattern(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_file_type_mask(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_message(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_msg_type(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_sessioning_method(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_tt_desktop_level(BIL_TOKEN);
|
||||
extern STRING bilP_load_att_action1_button(BIL_TOKEN valueToken);
|
||||
extern STRING bilP_load_att_action1_label(BIL_TOKEN valueToken);
|
||||
extern STRING bilP_load_att_action2_button(BIL_TOKEN valueToken);
|
||||
extern STRING bilP_load_att_action2_label(BIL_TOKEN valueToken);
|
||||
extern STRING bilP_load_att_action3_label(BIL_TOKEN valueToken);
|
||||
extern STRING bilP_load_att_cancel_button(BIL_TOKEN valueToken);
|
||||
extern STRING bilP_load_att_help_button(BIL_TOKEN valueToken);
|
||||
extern STRING bilP_load_att_default_button(BIL_TOKEN valueToken);
|
||||
extern STRING bilP_load_att_decimal_points(BIL_TOKEN valueToken);
|
||||
extern STRING bilP_load_att_increment(BIL_TOKEN valueToken);
|
||||
extern STRING bilP_load_att_pane_max_height(BIL_TOKEN valueToken);
|
||||
extern STRING bilP_load_att_pane_min_height(BIL_TOKEN valueToken);
|
||||
extern STRING bilP_load_att_i18n_enabled(BIL_TOKEN valueToken);
|
||||
extern STRING bilP_load_att_win_children_begin(void);
|
||||
extern STRING bilP_load_att_win_children_end(void);
|
||||
|
||||
#endif /* _ABIL_BILLDATT_H_ */
|
||||
389
cde/programs/dtappbuilder/src/libABil/bil_loadfile.c
Normal file
389
cde/programs/dtappbuilder/src/libABil/bil_loadfile.c
Normal file
@@ -0,0 +1,389 @@
|
||||
|
||||
/*
|
||||
* $TOG: bil_loadfile.c /main/4 1998/04/06 13:12:27 mgreess $
|
||||
*
|
||||
* @(#)bil_loadfile.c 1.53 02 Apr 1995
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special restrictions in a
|
||||
* confidential disclosure agreement between HP, IBM, Sun, USL, SCO and
|
||||
* Univel. Do not distribute this document outside HP, IBM, Sun, USL, SCO,
|
||||
* or Univel without Sun's specific written approval. This document and all
|
||||
* copies and derivative works thereof must be returned or destroyed at Sun's
|
||||
* request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Routines to load in GUIDE intermediate language (BIL) files.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <ab_private/util.h>
|
||||
#include <ab_private/abio.h>
|
||||
#include <ab_private/trav.h>
|
||||
#include <ab_private/bil.h>
|
||||
#include "../libABobj/obj_utils.h"
|
||||
#include "load.h"
|
||||
#include "bilP.h"
|
||||
|
||||
BIL_LOAD_INFO bilP_load;
|
||||
char Buf[MAXPATHLEN];
|
||||
#if !defined(linux)
|
||||
extern char *sys_errlist[];
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Read a BIL file into memory. Returns a project node.
|
||||
*
|
||||
* Any modules found in the BIL file are put into the project that is passed in.
|
||||
* Any project objects in the BIL file are ignored. This allows modules to be
|
||||
* imported from an encapsulated bil file. The project passed in will be the
|
||||
* one returned.
|
||||
*
|
||||
* If the project passed in is NULL, then it is assumed that the first object
|
||||
* encountered will be a project. This project will be used to store modules
|
||||
* (if any) that are also found in the file.
|
||||
*
|
||||
*
|
||||
* File name extensions ===================== All BIL files are identical in
|
||||
* format. No file name extensions are enforced, but the standard extensions
|
||||
* are as follows:
|
||||
*
|
||||
* .bil = bil module file, contains one module
|
||||
*
|
||||
* .bip = bil project file. contains one project definition and references to
|
||||
* constituent .bil files
|
||||
*
|
||||
* .bix = encapsulated bil file. contains all project and module definitions
|
||||
* for one project.
|
||||
*
|
||||
*/
|
||||
ABObj
|
||||
bil_load_file(
|
||||
char *bil_file,
|
||||
FILE *inFile,
|
||||
ABObj project,
|
||||
ABObjList *compObjsOutPtr
|
||||
)
|
||||
{
|
||||
#define compObjsOut (*compObjsOutPtr)
|
||||
ABObj obj = NULL;
|
||||
STRING errmsg = NULL;
|
||||
AB_FILE_TYPE file_type = AB_FILE_UNDEF;
|
||||
int success = OK;
|
||||
int i;
|
||||
int lineNumber = 0;
|
||||
BOOL unknownObjects = FALSE;
|
||||
BOOL LoadErr = FALSE;
|
||||
float ver = 0.0;
|
||||
|
||||
if (util_strempty(bil_file) && inFile == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (util_be_verbose() && (!util_strempty(bil_file)))
|
||||
{
|
||||
util_printf("reading %s\n", bil_file);
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset everything
|
||||
*/
|
||||
bilP_load.project = NULL;
|
||||
bilP_load.module = NULL;
|
||||
bilP_load.compObjsRead = NULL;
|
||||
bilP_load.obj = NULL;
|
||||
bilP_load.objType = AB_TYPE_UNDEF;
|
||||
bilP_load.fileName = NULL;
|
||||
abil_loadmsg_clear();
|
||||
abil_loadmsg_set_line_number_callback(bilP_load_get_line_number);
|
||||
|
||||
/*
|
||||
* set up for load
|
||||
*/
|
||||
bilP_load.fileName = istr_create(bil_file);
|
||||
bilP_load.project = project;
|
||||
bilP_load.compObjsRead = objlist_create();
|
||||
abil_loadmsg_set_file(istr_string(bilP_load.fileName));
|
||||
|
||||
/* If the FILE * is NULL, then call abio_open_bil_input().
|
||||
* inFile will be NULL if this routine is being called
|
||||
* by dtcodegen (abmf.c) to load a project or module file.
|
||||
*/
|
||||
if (inFile == NULL)
|
||||
{
|
||||
/* Open the input file. */
|
||||
errmsg = abio_open_bil_input(bil_file, &lineNumber, &AByyin);
|
||||
if (errmsg != NULL)
|
||||
{
|
||||
LoadErr = TRUE;
|
||||
goto epilogue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Read in header information */
|
||||
ver = abio_get_bil_version(inFile, &lineNumber);
|
||||
errmsg = abio_check_bil_version(ver, bil_file);
|
||||
if (errmsg != NULL)
|
||||
{
|
||||
LoadErr = TRUE;
|
||||
goto epilogue;
|
||||
}
|
||||
else
|
||||
AByyin = inFile;
|
||||
}
|
||||
++lineNumber;
|
||||
|
||||
/*
|
||||
* Parse the file.
|
||||
*/
|
||||
bilP_load_reset();
|
||||
bilP_load_set_line_number(lineNumber);
|
||||
if ((success = AByyparse()) != 0)
|
||||
{
|
||||
abio_close_input(inFile);
|
||||
LoadErr = TRUE;
|
||||
goto epilogue;
|
||||
}
|
||||
|
||||
#ifdef BOGUS /* the commented out util_error() below makes this loop
|
||||
unnecessary -dunn */
|
||||
/*
|
||||
* make sure there are no unknown object types in the tree.
|
||||
*/
|
||||
unknownObjects = FALSE;
|
||||
{
|
||||
AB_TRAVERSAL trav;
|
||||
for (trav_open(&trav, bilP_load.project, AB_TRAV_ALL), i = 0;
|
||||
(obj = trav_next(&trav)) != NULL; ++i)
|
||||
{
|
||||
if (obj->type == AB_TYPE_UNKNOWN)
|
||||
{
|
||||
unknownObjects = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
trav_close(&trav);
|
||||
if (unknownObjects)
|
||||
{
|
||||
/* util_error("unknown type objects after load."); */
|
||||
}
|
||||
}
|
||||
#endif /* BOGUS */
|
||||
|
||||
/* Close the input file. */
|
||||
abio_close_input(AByyin);
|
||||
|
||||
if (bilP_load.project == NULL)
|
||||
{
|
||||
LoadErr = TRUE;
|
||||
sprintf(Buf, catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET, 39,
|
||||
"Unable to load project."));
|
||||
errmsg = Buf;
|
||||
goto epilogue;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Update the returned list of composite objects
|
||||
*/
|
||||
if (compObjsOutPtr != NULL)
|
||||
{
|
||||
int numObjs = objlist_get_num_objs(bilP_load.compObjsRead);
|
||||
int i;
|
||||
|
||||
if (compObjsOut == NULL)
|
||||
{
|
||||
compObjsOut = objlist_create();
|
||||
}
|
||||
|
||||
for (i = 0; i < numObjs; ++i)
|
||||
{
|
||||
objlist_add_obj(compObjsOut,
|
||||
objlist_get_obj(bilP_load.compObjsRead, i, NULL), NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
epilogue:
|
||||
objlist_destroy(bilP_load.compObjsRead);
|
||||
if (LoadErr)
|
||||
{
|
||||
if (errmsg != NULL)
|
||||
{
|
||||
util_printf_err("%s\n", errmsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* It was a yacc generated error, thus it gets
|
||||
* printed out via yyerror() (see bil_lex.l),
|
||||
* so reset the printed boolean (see load.c).
|
||||
*/
|
||||
abil_loadmsg_set_err_printed(FALSE);
|
||||
}
|
||||
|
||||
/* There was an error reading in the project/module
|
||||
* file. If this routine was called to read in a
|
||||
* module file, then bilP_load.module will not be NULL,
|
||||
* and it will be destroyed here. If this routine was
|
||||
* called to read in a project file, then it will
|
||||
* simply return an error value, and the project will
|
||||
* be destroyed in bil_load_file_and_resolve_all().
|
||||
* Therefore, if a corrupt bip file is read in, the
|
||||
* project will NOT be loaded into dtbuilder. If a
|
||||
* corrupt bil file is imported, only the module created
|
||||
* for the corrupt bil file will be destroyed. If the
|
||||
* corrupt bil file was part of an existing project, then
|
||||
* the project referencing it will be destroyed in
|
||||
* bil_load_file_and_resolve_all().
|
||||
*
|
||||
* Note: It is possible that bilP_load.module will not
|
||||
* be NULL when reading in a bip file and that is
|
||||
* if the ending ')' for ":project" is not in the
|
||||
* bip file for some reason. So, we should check
|
||||
* for that case, otherwise we'll be destroying
|
||||
* the same object, the project, twice - not good.
|
||||
*/
|
||||
if ((bilP_load.module != NULL) && (bilP_load.module != bilP_load.project))
|
||||
{
|
||||
obj_destroy(bilP_load.module);
|
||||
bilP_load.module = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
return bilP_load.project;
|
||||
}
|
||||
#undef compObjsOut
|
||||
} /* bil_load_file */
|
||||
|
||||
/*
|
||||
* Loads in a new project, and returns a pointer to it. Chdirs to the
|
||||
* directory where the project is. Loads in all files referenced by the
|
||||
* project
|
||||
*/
|
||||
int
|
||||
bil_load_file_and_resolve_all(
|
||||
STRING path,
|
||||
FILE *inFile,
|
||||
ABObj *newProjectPtr
|
||||
)
|
||||
{
|
||||
#define newProject (*newProjectPtr)
|
||||
int return_value = 0;
|
||||
AB_TRAVERSAL trav;
|
||||
ABObj file = NULL;
|
||||
ABObj ret = NULL;
|
||||
char dirName[MAXPATHLEN];
|
||||
char fileName[MAXPATHLEN];
|
||||
STRING modfile = NULL;
|
||||
*dirName = 0;
|
||||
*fileName = 0;
|
||||
newProject = NULL;
|
||||
|
||||
/* If the path is NULL then that means that a
|
||||
* data buffer was dropped (i.e. dtmail attachment)
|
||||
* on dtbuilder and therefore, there is no file.
|
||||
*/
|
||||
if (!util_strempty(path))
|
||||
{
|
||||
util_get_dir_name_from_path(path, dirName, MAXPATHLEN);
|
||||
util_get_file_name_from_path(path, fileName, MAXPATHLEN);
|
||||
if (chdir(dirName) != 0)
|
||||
{
|
||||
util_printf_err("%s: %s\n", dirName, sys_errlist[errno]);
|
||||
return ERR;
|
||||
}
|
||||
}
|
||||
|
||||
newProject = bil_load_file(fileName, inFile, NULL, NULL);
|
||||
/* If bil_load_file returns NULL, then something went wrong
|
||||
* with reading in the bip file, so destroy the project.
|
||||
*/
|
||||
if (newProject == NULL)
|
||||
{
|
||||
obj_destroy(bilP_load.project);
|
||||
bilP_load.project = NULL;
|
||||
return_value = ERR;
|
||||
goto epilogue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find any references to other files in the project and load them
|
||||
*/
|
||||
for (trav_open(&trav, newProject, AB_TRAV_FILES);
|
||||
(file = trav_next(&trav)) != NULL;)
|
||||
{
|
||||
modfile = obj_get_file(file);
|
||||
|
||||
/* Pass in NULL for the FILE * argument, because we
|
||||
* haven't opened (util_fopen_locked) the module files yet.
|
||||
*/
|
||||
ret = bil_load_file(modfile, NULL, newProject, NULL);
|
||||
|
||||
/* If the return value from bil_load_file is NULL,
|
||||
* then something went wrong with reading in the
|
||||
* bil file (i.e. it was a corrupt bil file). In this
|
||||
* case, don't load the project, destroy it.
|
||||
*/
|
||||
if (ret == NULL)
|
||||
{
|
||||
return_value = -1;
|
||||
obj_destroy(bilP_load.project);
|
||||
bilP_load.project = NULL;
|
||||
newProject = NULL;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj_set_flag(file, BeingDestroyedFlag);
|
||||
}
|
||||
}
|
||||
trav_close(&trav);
|
||||
|
||||
epilogue:
|
||||
if (ret)
|
||||
{
|
||||
/* Destroy filename holders */
|
||||
obj_tree_destroy_flagged(newProject);
|
||||
}
|
||||
|
||||
return return_value;
|
||||
|
||||
#undef newProject
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
*
|
||||
* Callbacks for parser
|
||||
*/
|
||||
|
||||
int
|
||||
bilP_load_end_of_file()
|
||||
{
|
||||
bilP_reset_token_text();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
bilP_load_end_of_data()
|
||||
{
|
||||
fseek(AByyin, 0, SEEK_END); /* move to end of file */
|
||||
return 0;
|
||||
}
|
||||
|
||||
120
cde/programs/dtappbuilder/src/libABil/bil_loadobj.c
Normal file
120
cde/programs/dtappbuilder/src/libABil/bil_loadobj.c
Normal file
@@ -0,0 +1,120 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: bil_loadobj.c /main/3 1995/11/06 18:25:28 rswiston $
|
||||
*
|
||||
* @(#)bil_loadobj.c 1.23 02 Feb 1995
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* bil_loadobj.c - Load object from BIL file
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "bilP.h"
|
||||
#include "loadP.h"
|
||||
|
||||
STRING
|
||||
bilP_load_end_of_obj(BIL_TOKEN objClass)
|
||||
{
|
||||
switch (objClass)
|
||||
{
|
||||
case AB_BIL_PROJECT:
|
||||
obj_set_file(bilP_load.project, istr_string(bilP_load.fileName));
|
||||
|
||||
/* I'm not sure why this check is here, but I'm afraid to
|
||||
* delete it. -jjd
|
||||
*/
|
||||
if ( (bilP_load.module != NULL)
|
||||
&& (obj_is_module(bilP_load.module)) )
|
||||
{
|
||||
obj_tree_set_flag(bilP_load.module, BeingDestroyedFlag);
|
||||
}
|
||||
|
||||
bilP_load.module = NULL; /* may have been project */
|
||||
bilP_load.obj = NULL; /* was project */
|
||||
bilP_load.objType = AB_TYPE_UNDEF;
|
||||
break;
|
||||
|
||||
case AB_BIL_MODULE:
|
||||
obj_set_file(bilP_load.module, istr_string(bilP_load.fileName));
|
||||
/*
|
||||
bilP_load.module= NULL;
|
||||
*/
|
||||
bilP_load.obj = NULL;
|
||||
bilP_load.objType = AB_TYPE_UNDEF;
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
if (bilP_load.obj->parent != NULL)
|
||||
{
|
||||
/*
|
||||
* parent is valid, object is complete.
|
||||
*/
|
||||
bilP_load.obj = NULL;
|
||||
bilP_load.objType = AB_TYPE_UNDEF;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Who is its parent?
|
||||
*/
|
||||
ABObj parent= bilP_load.module;
|
||||
if (parent == NULL)
|
||||
{
|
||||
parent= bilP_load.project;
|
||||
}
|
||||
if (parent != NULL)
|
||||
{
|
||||
obj_append_child(bilP_load.module, bilP_load.obj);
|
||||
bilP_load.obj = NULL;
|
||||
bilP_load.objType = AB_TYPE_UNDEF;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* If bilP_load.obj is found to be complete, it is moved to
|
||||
* its proper place, and the pointer to it is set to NULL.
|
||||
*
|
||||
* We set destroy flags above, in case obj is child of something
|
||||
* (we won't try to delete it twice!)
|
||||
*/
|
||||
if (bilP_load.obj != NULL)
|
||||
{
|
||||
obj_destroy(bilP_load.obj); bilP_load.obj = NULL;
|
||||
bilP_load.objType = AB_TYPE_UNDEF;
|
||||
}
|
||||
if ( (bilP_load.module != NULL)
|
||||
&& obj_has_flag(bilP_load.module, BeingDestroyedFlag) )
|
||||
{
|
||||
obj_destroy(bilP_load.module); bilP_load.module= NULL;
|
||||
}
|
||||
bilP_load.att= AB_BIL_UNDEF;
|
||||
|
||||
/*
|
||||
* Clear load msg
|
||||
*/
|
||||
abil_loadmsg_set_object(NULL);
|
||||
abil_loadmsg_set_att(NULL);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
1065
cde/programs/dtappbuilder/src/libABil/bil_parse.y
Normal file
1065
cde/programs/dtappbuilder/src/libABil/bil_parse.y
Normal file
File diff suppressed because it is too large
Load Diff
3702
cde/programs/dtappbuilder/src/libABil/bil_store.c
Normal file
3702
cde/programs/dtappbuilder/src/libABil/bil_store.c
Normal file
File diff suppressed because it is too large
Load Diff
266
cde/programs/dtappbuilder/src/libABil/bil_test.c
Normal file
266
cde/programs/dtappbuilder/src/libABil/bil_test.c
Normal file
@@ -0,0 +1,266 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: bil_test.c /main/3 1995/11/06 18:26:50 rswiston $
|
||||
*
|
||||
* @(#)bil_test.c 1.16 11 Feb 1994 cde_app_builder/src/libABil
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/****************************************************************
|
||||
* *
|
||||
* test_bil.c - BIL test driver *
|
||||
* *
|
||||
*****************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <nl_types.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <ab_private/util.h>
|
||||
#include <ab_private/obj.h>
|
||||
#include <ab_private/trav.h>
|
||||
#include <ab_private/bil.h>
|
||||
#include "loadP.h"
|
||||
|
||||
nl_catd Dtb_project_catd = (nl_catd)NULL; /* normally, defined in dtcodegen */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int verbosity;
|
||||
BOOL dump_tree;
|
||||
char *fileName;
|
||||
BOOL import;
|
||||
BOOL save;
|
||||
BOOL save_encapsulated;
|
||||
} PARAMETERS;
|
||||
|
||||
static int parse_args(int argc, char *argv[], PARAMETERS *params);
|
||||
static int usage(STRING msg);
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
PARAMETERS params;
|
||||
ABObj newProject= NULL;
|
||||
AB_TRAVERSAL trav;
|
||||
ABObj file= NULL;
|
||||
int iRC = 0; /* return code */
|
||||
STRING errmsg = NULL;
|
||||
ABObj module = NULL;
|
||||
AB_TRAVERSAL moduleTrav;
|
||||
ABObjList fileObjList = NULL;
|
||||
|
||||
util_init(&argc, &argv);
|
||||
parse_args(argc, argv, ¶ms);
|
||||
|
||||
util_set_verbosity(params.verbosity);
|
||||
if (params.import)
|
||||
{
|
||||
newProject= obj_create(AB_TYPE_PROJECT, NULL);
|
||||
obj_set_name(newProject, "untitled");
|
||||
bil_load_file(params.fileName, NULL, newProject, &fileObjList);
|
||||
}
|
||||
else
|
||||
{
|
||||
newProject= bil_load_file(params.fileName, NULL, NULL, &fileObjList);
|
||||
if (newProject != NULL)
|
||||
{
|
||||
for (trav_open(&trav, newProject, AB_TRAV_FILES);
|
||||
(file= trav_next(&trav)) != NULL; )
|
||||
{
|
||||
bil_load_file(
|
||||
obj_get_name(file), (FILE*)NULL, newProject, &fileObjList);
|
||||
obj_set_flag(file, BeingDestroyedFlag);
|
||||
}
|
||||
trav_close(&trav);
|
||||
obj_tree_destroy_flagged(newProject);
|
||||
}
|
||||
}
|
||||
|
||||
iRC = obj_tree_verify(newProject);
|
||||
util_printf("verify: %d\n", iRC);
|
||||
if (iRC < 0)
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (params.dump_tree)
|
||||
{
|
||||
obj_tree_print(newProject);
|
||||
}
|
||||
|
||||
if (params.save)
|
||||
{
|
||||
mkdir("tmp", S_IRWXU| S_IRGRP|S_IXGRP | S_IROTH|S_IXOTH);
|
||||
if (chdir("tmp") != 0)
|
||||
{
|
||||
util_printf_err("Could not create and cd to ./tmp\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (params.save_encapsulated)
|
||||
{
|
||||
/* encapsulated save */
|
||||
STRING outFileName = "test.bix";
|
||||
util_printf("Saving project [ENCAPSULATED] to ./tmp\n");
|
||||
unlink(outFileName);
|
||||
iRC = bil_save_tree(newProject, outFileName,
|
||||
BIL_SAVE_ENCAPSULATED);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* "ordinary" save */
|
||||
util_printf("Saving project to ./tmp\n");
|
||||
if (obj_get_file(newProject))
|
||||
{
|
||||
unlink(obj_get_file(newProject));
|
||||
}
|
||||
iRC = bil_save_tree(newProject, obj_get_file(newProject),
|
||||
BIL_SAVE_FILE_PER_MODULE);
|
||||
if (iRC >= 0)
|
||||
{
|
||||
for (trav_open(&moduleTrav, newProject, AB_TRAV_MODULES);
|
||||
(module = trav_next(&moduleTrav)) != NULL; )
|
||||
{
|
||||
if (obj_get_file(module))
|
||||
{
|
||||
unlink(obj_get_file(module));
|
||||
}
|
||||
iRC = bil_save_tree(module, NULL, BIL_SAVE_FILE_PER_MODULE);
|
||||
}
|
||||
}
|
||||
trav_close(&moduleTrav);
|
||||
}
|
||||
|
||||
chdir("..");
|
||||
}
|
||||
|
||||
|
||||
objlist_destroy(fileObjList);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
usage(STRING msg)
|
||||
{
|
||||
fprintf(stderr, "%s",
|
||||
"-d = dump\n"
|
||||
"-v[vvv...] = verbosity\n"
|
||||
"-h = help\n"
|
||||
"-i = import\n"
|
||||
"-s = save\n"
|
||||
"-x = save encapsulated\n"
|
||||
);
|
||||
|
||||
if (msg != NULL)
|
||||
{
|
||||
fprintf(stderr, "\n%s\n", msg);
|
||||
}
|
||||
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
parse_args(int argc, char *argv[], PARAMETERS *params)
|
||||
{
|
||||
int iArg;
|
||||
BOOL verbosity_seen= FALSE;
|
||||
BOOL dump_tree_seen = FALSE;
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
usage("No filename specified");
|
||||
}
|
||||
|
||||
params->fileName= NULL;
|
||||
params->verbosity= 3;
|
||||
params->dump_tree = FALSE;
|
||||
params->import= FALSE;
|
||||
params->save = FALSE;
|
||||
params->save_encapsulated = FALSE;
|
||||
|
||||
for (iArg= 1; iArg < argc; ++iArg)
|
||||
{
|
||||
char *szArg= argv[iArg];
|
||||
int iArgLen= strlen(szArg);
|
||||
|
||||
if (szArg[0] == '-')
|
||||
{
|
||||
int iFlag;
|
||||
for (iFlag= 0; iFlag < iArgLen; ++iFlag)
|
||||
{
|
||||
char cFlag= szArg[iFlag];
|
||||
switch (cFlag)
|
||||
{
|
||||
case 'd':
|
||||
params->dump_tree = TRUE;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
if (!verbosity_seen)
|
||||
{
|
||||
params->verbosity= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
++(params->verbosity);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
usage(NULL);
|
||||
break;
|
||||
|
||||
case 'i': /* import */
|
||||
params->import= TRUE;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
params->save = TRUE;
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
params->save = TRUE;
|
||||
params->save_encapsulated = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* not a flag arg
|
||||
*/
|
||||
params->fileName= szArg;
|
||||
}
|
||||
}
|
||||
|
||||
if (! ( params->import
|
||||
|| params->dump_tree
|
||||
|| params->save)
|
||||
)
|
||||
{
|
||||
/* no action specified - default to dump */
|
||||
params->dump_tree = TRUE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
764
cde/programs/dtappbuilder/src/libABil/gil.c
Normal file
764
cde/programs/dtappbuilder/src/libABil/gil.c
Normal file
@@ -0,0 +1,764 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: gil.c /main/3 1995/11/06 18:27:05 rswiston $
|
||||
*/
|
||||
|
||||
/************************************************************
|
||||
* *
|
||||
* gil.c - GIL conversion routines *
|
||||
* *
|
||||
************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ab/util_types.h>
|
||||
#include <ab_private/istr.h>
|
||||
#include "gilP.h"
|
||||
|
||||
#define ARRAY_NENTS(array) (sizeof(array)/sizeof(array[0]))
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Type/String Conversion **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
static int
|
||||
convert_string_to_int(STRING s_value,
|
||||
ISTRING * table, int num_values, int default_value)
|
||||
{
|
||||
int i;
|
||||
int int_value = default_value;
|
||||
ISTRING is_value = istr_create(s_value);
|
||||
if (s_value == NULL)
|
||||
{
|
||||
istr_destroy(is_value);
|
||||
return int_value;
|
||||
}
|
||||
for (i = 0; i < num_values; ++i)
|
||||
{
|
||||
if (istr_equal(table[i], is_value))
|
||||
{
|
||||
int_value = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
istr_destroy(is_value);
|
||||
return int_value;
|
||||
}
|
||||
|
||||
static int
|
||||
convert_fill_table(ISTRING * table, int num_values, ISTRING value)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < num_values; ++i)
|
||||
{
|
||||
table[i] = value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************* AB_ALIGNMENT **************************************/
|
||||
|
||||
static ISTRING align_tab[AB_ALIGNMENT_NUM_VALUES];
|
||||
static BOOL align_tab_inited = FALSE;
|
||||
#define align_tab_check_init() (align_tab_inited? 0:align_tab_init())
|
||||
|
||||
static int
|
||||
align_tab_init()
|
||||
{
|
||||
#define at align_tab
|
||||
align_tab_inited = TRUE;
|
||||
convert_fill_table(at, ARRAY_NENTS(at), istr_const(NULL));
|
||||
|
||||
/* sorted on string values */
|
||||
at[AB_ALIGN_BOTTOM] = istr_const(":bottom-edges");
|
||||
at[AB_ALIGN_CENTER] = istr_const(":centers");
|
||||
at[AB_ALIGN_HCENTER] = istr_const(":horizontal-centers");
|
||||
at[AB_ALIGN_LABELS] = istr_const(":labels");
|
||||
at[AB_ALIGN_LEFT] = istr_const(":left-edges");
|
||||
at[AB_ALIGN_RIGHT] = istr_const(":right-edges");
|
||||
at[AB_ALIGN_TOP] = istr_const(":top-edges");
|
||||
at[AB_ALIGN_VCENTER] = istr_const(":vertical-centers");
|
||||
|
||||
return 0;
|
||||
#undef at
|
||||
}
|
||||
|
||||
AB_ALIGNMENT
|
||||
gilP_string_to_alignment(STRING align_string)
|
||||
{
|
||||
return (AB_ALIGNMENT) convert_string_to_int(align_string,
|
||||
align_tab, ARRAY_NENTS(align_tab), -1);
|
||||
}
|
||||
|
||||
/******************* AB_ARG_TYPE **************************************/
|
||||
static ISTRING arg_type_tab[AB_ARG_TYPE_NUM_VALUES];
|
||||
static BOOL arg_type_tab_inited = FALSE;
|
||||
#define arg_type_tab_check_init() (arg_type_tab_inited? 0:arg_type_tab_init())
|
||||
|
||||
static int
|
||||
arg_type_tab_init()
|
||||
{
|
||||
#define att arg_type_tab
|
||||
arg_type_tab_inited = TRUE;
|
||||
|
||||
att[AB_ARG_BOOLEAN] = istr_const(":boolean");
|
||||
att[AB_ARG_CALLBACK] = istr_const(":callback");
|
||||
att[AB_ARG_FLOAT] = istr_const(":float");
|
||||
att[AB_ARG_INT] = istr_const(":integer");
|
||||
att[AB_ARG_LITERAL] = istr_const(":literal");
|
||||
att[AB_ARG_NONE] = istr_const(":void");
|
||||
att[AB_ARG_STRING] = istr_const(":string");
|
||||
|
||||
return 0;
|
||||
#undef att
|
||||
}
|
||||
|
||||
AB_ARG_TYPE
|
||||
gilP_string_to_arg_type(STRING arg_type_string)
|
||||
{
|
||||
return (AB_ARG_TYPE) convert_string_to_int(arg_type_string,
|
||||
arg_type_tab, ARRAY_NENTS(arg_type_tab), -1);
|
||||
}
|
||||
|
||||
/******************* AB_GIL_ATTRIBUTE **************************************/
|
||||
static ISTRING gat[AB_GIL_ATTRIBUTE_NUM_VALUES]; /* gil attribute table */
|
||||
static BOOL gat_inited = FALSE;
|
||||
#define gat_check_init() (gat_inited? 0:gat_init())
|
||||
|
||||
static int
|
||||
gat_init()
|
||||
{
|
||||
convert_fill_table(gat, AB_GIL_ATTRIBUTE_NUM_VALUES, istr_const(NULL));
|
||||
|
||||
gat[AB_GIL_ABBREVIATED] = istr_const(":abbreviated");
|
||||
gat[AB_GIL_ACTION] = istr_const(":action");
|
||||
gat[AB_GIL_ACTIONS] = istr_const(":actions");
|
||||
gat[AB_GIL_ANCHOR_OBJECT] = istr_const(":anchor-object");
|
||||
gat[AB_GIL_ANCHOR_POINT] = istr_const(":anchor-point");
|
||||
gat[AB_GIL_ARG_TYPE] = istr_const(":arg_type");
|
||||
gat[AB_GIL_BACKGROUND_COLOR] = istr_const(":background-color");
|
||||
gat[AB_GIL_BUSY_DROP_GLYPH] = istr_const(":busy-drop-glyph");
|
||||
gat[AB_GIL_BUTTON_TYPE] = istr_const(":button-type");
|
||||
gat[AB_GIL_CHOICES] = istr_const(":choices");
|
||||
gat[AB_GIL_CHOICE_DEFAULTS] = istr_const(":choice-defaults");
|
||||
gat[AB_GIL_CHOICE_LABEL_TYPES] = istr_const(":choice-label-types");
|
||||
gat[AB_GIL_CHOICE_COLORS] = istr_const(":choice-colors");
|
||||
gat[AB_GIL_COLUMNS] = istr_const(":columns");
|
||||
gat[AB_GIL_COL_ALIGNMENT] = istr_const(":column-alignment");
|
||||
gat[AB_GIL_CONNECTIONS] = istr_const(":connections");
|
||||
gat[AB_GIL_CONSTANT_WIDTH] = istr_const(":constant-width");
|
||||
gat[AB_GIL_DEFAULT_DROP_SITE] = istr_const(":default-drop-site");
|
||||
gat[AB_GIL_DND_ACCEPT_CURSOR] = istr_const(":dnd-accept-cursor");
|
||||
gat[AB_GIL_DND_ACCEPT_CURSOR_XHOT] = istr_const(":dnd-accept-cursor-xhot");
|
||||
gat[AB_GIL_DND_ACCEPT_CURSOR_YHOT] = istr_const(":dnd-accept-cursor-yhot");
|
||||
gat[AB_GIL_DND_CURSOR] = istr_const(":dnd-cursor");
|
||||
gat[AB_GIL_DND_CURSOR_XHOT] = istr_const(":dnd-cursor-xhot");
|
||||
gat[AB_GIL_DND_CURSOR_YHOT] = istr_const(":dnd-cursor-yhot");
|
||||
gat[AB_GIL_DRAGGABLE] = istr_const(":draggable");
|
||||
gat[AB_GIL_DONE_HANDLER] = istr_const(":done-handler");
|
||||
gat[AB_GIL_DROPPABLE] = istr_const(":droppable");
|
||||
gat[AB_GIL_DROP_TARGET_WIDTH] = istr_const(":drop-target_width");
|
||||
gat[AB_GIL_DRAWING_MODEL] = istr_const(":drawing-model");
|
||||
gat[AB_GIL_EVENTS] = istr_const(":events");
|
||||
gat[AB_GIL_EVENT_HANDLER] = istr_const(":event-handler");
|
||||
gat[AB_GIL_FILE_CHOOSER_FILTER_PATTERN] =
|
||||
istr_const(":file-chooser-filter-pattern");
|
||||
gat[AB_GIL_FILE_CHOOSER_MATCH_GLYPH] =
|
||||
istr_const(":file-chooser-match-glyph");
|
||||
gat[AB_GIL_FILE_CHOOSER_MATCH_GLYPH_MASK] =
|
||||
istr_const(":file-chooser-match-glyph-mask");
|
||||
gat[AB_GIL_FILE_CHOOSER_TYPE] = istr_const(":file-chooser-type");
|
||||
gat[AB_GIL_FOREGROUND_COLOR] = istr_const(":foreground-color");
|
||||
gat[AB_GIL_FROM] = istr_const(":from");
|
||||
gat[AB_GIL_FUNCTION_TYPE] = istr_const(":function_type");
|
||||
gat[AB_GIL_GROUP_TYPE] = istr_const(":group-type");
|
||||
gat[AB_GIL_HEIGHT] = istr_const(":height");
|
||||
gat[AB_GIL_HELP] = istr_const(":help");
|
||||
gat[AB_GIL_HOFFSET] = istr_const(":horizontal-offset");
|
||||
gat[AB_GIL_HSCROLL] = istr_const(":horizontal-scrollbar");
|
||||
gat[AB_GIL_HSPACING] = istr_const(":horizontal-spacing");
|
||||
gat[AB_GIL_ICON_FILE] = istr_const(":icon-file");
|
||||
gat[AB_GIL_ICON_LABEL] = istr_const(":icon-label");
|
||||
gat[AB_GIL_ICON_MASK_FILE] = istr_const(":icon-mask-file");
|
||||
gat[AB_GIL_INITIAL_LIST_GLYPHS] = istr_const(":initial-list-glyphs");
|
||||
gat[AB_GIL_INITIAL_LIST_VALUES] = istr_const(":initial-list-values");
|
||||
gat[AB_GIL_INITIAL_SELECTIONS] = istr_const(":initial-selections");
|
||||
gat[AB_GIL_INITIAL_STATE] = istr_const(":initial-state");
|
||||
gat[AB_GIL_INITIAL_VALUE] = istr_const(":initial-value");
|
||||
gat[AB_GIL_INTERFACES] = istr_const(":interfaces");
|
||||
gat[AB_GIL_INTERNATIONAL_DB_BEGIN] = istr_const(":international-db-begin");
|
||||
gat[AB_GIL_INTERNATIONAL_DB_END] = istr_const(":international-db-end");
|
||||
gat[AB_GIL_LABEL] = istr_const(":label");
|
||||
gat[AB_GIL_LABEL_TYPE] = istr_const(":label-type");
|
||||
gat[AB_GIL_LABEL_BOLD] = istr_const(":label-bold");
|
||||
gat[AB_GIL_LAYOUT_TYPE] = istr_const(":layout-type");
|
||||
gat[AB_GIL_MAPPED] = istr_const(":mapped");
|
||||
gat[AB_GIL_MAX_TICK_STRING] = istr_const(":max-tick-string");
|
||||
gat[AB_GIL_MAX_VALUE] = istr_const(":max-value");
|
||||
gat[AB_GIL_MAX_VALUE_STRING] = istr_const(":max-value-string");
|
||||
gat[AB_GIL_MEMBERS] = istr_const(":members");
|
||||
gat[AB_GIL_MENU] = istr_const(":menu");
|
||||
gat[AB_GIL_MENU_HANDLER] = istr_const(":menu-handler");
|
||||
gat[AB_GIL_MENU_ITEM_ACCELERATORS] = istr_const(":menu-item-accelerators");
|
||||
gat[AB_GIL_MENU_ITEM_COLORS] = istr_const(":menu-item-colors");
|
||||
gat[AB_GIL_MENU_ITEM_DEFAULTS] = istr_const(":menu-item-defaults");
|
||||
gat[AB_GIL_MENU_ITEM_HANDLERS] = istr_const(":menu-item-handlers");
|
||||
gat[AB_GIL_MENU_ITEM_LABELS] = istr_const(":menu-item-labels");
|
||||
gat[AB_GIL_MENU_ITEM_LABEL_TYPES] = istr_const(":menu-item-label-types");
|
||||
gat[AB_GIL_MENU_ITEM_MENUS] = istr_const(":menu-item-menus");
|
||||
gat[AB_GIL_MENU_ITEM_STATES] = istr_const(":menu-item-states");
|
||||
gat[AB_GIL_MENU_TITLE] = istr_const(":menu-title");
|
||||
gat[AB_GIL_MENU_TYPE] = istr_const(":menu-type");
|
||||
gat[AB_GIL_MIN_TICK_STRING] = istr_const(":min-tick-string");
|
||||
gat[AB_GIL_MIN_VALUE] = istr_const(":min-value");
|
||||
gat[AB_GIL_MIN_VALUE_STRING] = istr_const(":min-value-string");
|
||||
gat[AB_GIL_MULTIPLE_SELECTIONS] = istr_const(":multiple-selections");
|
||||
gat[AB_GIL_NAME] = istr_const(":name");
|
||||
gat[AB_GIL_NORMAL] = istr_const(":normal");
|
||||
gat[AB_GIL_NORMAL_DROP_GLYPH] = istr_const(":normal-drop-glyph");
|
||||
gat[AB_GIL_ACTIVATE_HANDLER] = istr_const(":notify-handler");
|
||||
gat[AB_GIL_ORIENTATION] = istr_const(":orientation");
|
||||
gat[AB_GIL_OWNER] = istr_const(":owner");
|
||||
gat[AB_GIL_PINNABLE] = istr_const(":pinnable");
|
||||
gat[AB_GIL_PINNED] = istr_const(":pinned");
|
||||
gat[AB_GIL_READ_ONLY] = istr_const(":read-only");
|
||||
gat[AB_GIL_REFERENCE_POINT] = istr_const(":reference-point");
|
||||
gat[AB_GIL_REPAINT_PROC] = istr_const(":repaint-proc");
|
||||
gat[AB_GIL_RESIZABLE] = istr_const(":resizable");
|
||||
gat[AB_GIL_ATT_ROOT_WINDOW] = istr_const(":root_window");
|
||||
gat[AB_GIL_ROWS] = istr_const(":rows");
|
||||
gat[AB_GIL_ROW_ALIGNMENT] = istr_const(":row-alignment");
|
||||
gat[AB_GIL_SCROLLABLE_HEIGHT] = istr_const(":scrollable-height");
|
||||
gat[AB_GIL_SCROLLABLE_WIDTH] = istr_const(":scrollable-width");
|
||||
gat[AB_GIL_SELECTION_REQUIRED] = istr_const(":selection-required");
|
||||
gat[AB_GIL_SETTING_TYPE] = istr_const(":setting-type");
|
||||
gat[AB_GIL_SHOW_BORDER] = istr_const(":show-border");
|
||||
gat[AB_GIL_SHOW_ENDBOXES] = istr_const(":show-endboxes");
|
||||
gat[AB_GIL_SHOW_FOOTER] = istr_const(":show-footer");
|
||||
gat[AB_GIL_SHOW_RANGE] = istr_const(":show-range");
|
||||
gat[AB_GIL_SHOW_VALUE] = istr_const(":show-value");
|
||||
gat[AB_GIL_SCALE_WIDTH] = istr_const(":slider-width");
|
||||
gat[AB_GIL_STORED_LENGTH] = istr_const(":stored-length");
|
||||
gat[AB_GIL_MAX_LENGTH] = istr_const(":max-length");
|
||||
gat[AB_GIL_TEXT_TYPE] = istr_const(":text-type");
|
||||
gat[AB_GIL_TICKS] = istr_const(":ticks");
|
||||
gat[AB_GIL_TITLE] = istr_const(":title");
|
||||
gat[AB_GIL_TO] = istr_const(":to");
|
||||
gat[AB_GIL_TYPE] = istr_const(":type");
|
||||
gat[AB_GIL_USER_DATA] = istr_const(":user-data");
|
||||
gat[AB_GIL_VALUE_LENGTH] = istr_const(":value-length");
|
||||
gat[AB_GIL_VALUE_UNDERLINED] = istr_const(":value-underlined");
|
||||
gat[AB_GIL_VALUE_X] = istr_const(":value-x");
|
||||
gat[AB_GIL_VALUE_Y] = istr_const(":value-y");
|
||||
gat[AB_GIL_VOFFSET] = istr_const(":vertical-offset");
|
||||
gat[AB_GIL_VSCROLL] = istr_const(":vertical-scrollbar");
|
||||
gat[AB_GIL_VSPACING] = istr_const(":vertical-spacing");
|
||||
gat[AB_GIL_WHEN] = istr_const(":when");
|
||||
gat[AB_GIL_WIDTH] = istr_const(":width");
|
||||
gat[AB_GIL_X] = istr_const(":x");
|
||||
gat[AB_GIL_Y] = istr_const(":y");
|
||||
|
||||
gat_inited = TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
AB_GIL_ATTRIBUTE
|
||||
gilP_string_to_att(STRING s_att)
|
||||
{
|
||||
AB_GIL_ATTRIBUTE att = AB_GIL_UNDEF;
|
||||
ISTRING istr_att = istr_create(s_att);
|
||||
|
||||
|
||||
att = (AB_GIL_ATTRIBUTE) convert_string_to_int(
|
||||
istr_string(istr_att),
|
||||
gat, AB_GIL_ATTRIBUTE_NUM_VALUES, AB_GIL_UNDEF);
|
||||
|
||||
istr_destroy(istr_att);
|
||||
return att;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** AB_BUILTIN_ACTION **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
static BOOL builtin_action_table_inited = FALSE;
|
||||
static ISTRING builtin_action_table[AB_BUILTIN_ACTION_NUM_VALUES] = {NULL};
|
||||
|
||||
#define check_builtin_action_table_init() \
|
||||
(builtin_action_table_inited? 0:builtin_action_table_init())
|
||||
|
||||
static int
|
||||
builtin_action_table_init()
|
||||
{
|
||||
#define bat builtin_action_table
|
||||
builtin_action_table_inited = TRUE;
|
||||
convert_fill_table(builtin_action_table,
|
||||
AB_BUILTIN_ACTION_NUM_VALUES,
|
||||
istr_const("?when?"));
|
||||
|
||||
bat[AB_STDACT_UNDEF] = istr_const("Undef");
|
||||
bat[AB_STDACT_DISABLE] = istr_const("Disable");
|
||||
bat[AB_STDACT_ENABLE] = istr_const("Enable");
|
||||
/* bat[AB_STDACT_GET_LABEL]= istr_const("GetLabel"); */
|
||||
/* bat[AB_STDACT_GET_LEFT_FOOTER]= istr_const("GetLeftFooter"); */
|
||||
|
||||
/*
|
||||
* bat[AB_STDACT_GET_RIGHT_FOOTER]= istr_const("GetRightFooter");*?
|
||||
* bat[AB_STDACT_GET_VALUE_NUMBER]= istr_const("GetValueNumber");
|
||||
*/
|
||||
/* bat[AB_STDACT_GET_VALUE_STRING]= istr_const("GetValueString"); */
|
||||
bat[AB_STDACT_HIDE] = istr_const("Hide");
|
||||
/* bat[AB_STDACT_LOAD_TEXT_FILE]= istr_const("LoadTextFile"); */
|
||||
bat[AB_STDACT_SET_LABEL] = istr_const("SetLabel");
|
||||
bat[AB_STDACT_SHOW] = istr_const("Show");
|
||||
/* bat[AB_STDACT_SET_LEFT_FOOTER]= istr_const("SetLeftFooter"); */
|
||||
/* bat[AB_STDACT_SET_RIGHT_FOOTER]= istr_const("SetRightFooter"); */
|
||||
/* bat[AB_STDACT_SET_SELECTED]= istr_const("SetSelected"); */
|
||||
bat[AB_STDACT_SET_VALUE] = istr_const("SetValueNumber");
|
||||
|
||||
/*
|
||||
* Must handle this another way - can't have dup. entries
|
||||
*/
|
||||
/* bat[AB_STDACT_SET_VALUE]= istr_const("SetValueString"); */
|
||||
|
||||
return 0;
|
||||
#undef bat
|
||||
}
|
||||
|
||||
|
||||
AB_BUILTIN_ACTION
|
||||
gilP_string_to_builtin_action(STRING action)
|
||||
{
|
||||
AB_BUILTIN_ACTION act = AB_STDACT_UNDEF;
|
||||
|
||||
act = (AB_BUILTIN_ACTION)
|
||||
convert_string_to_int(action,
|
||||
builtin_action_table, AB_BUILTIN_ACTION_NUM_VALUES,
|
||||
AB_STDACT_UNDEF);
|
||||
if ((act == AB_STDACT_UNDEF) && util_streq(action, "SetValueString"))
|
||||
{
|
||||
act = AB_STDACT_SET_VALUE;
|
||||
}
|
||||
|
||||
return act;
|
||||
}
|
||||
|
||||
|
||||
/******************* AB_BUTTON_TYPE **************************************/
|
||||
static ISTRING button_type_tab[AB_BUTTON_TYPE_NUM_VALUES];
|
||||
static BOOL button_type_tab_inited = FALSE;
|
||||
#define button_type_tab_check_init() \
|
||||
(button_type_tab_inited? 0:button_type_tab_init())
|
||||
|
||||
static int
|
||||
button_type_tab_init()
|
||||
{
|
||||
#define btt button_type_tab
|
||||
button_type_tab_inited = TRUE;
|
||||
|
||||
btt[AB_BUT_PUSH] = istr_const(":normal");
|
||||
|
||||
return 0;
|
||||
#undef btt
|
||||
}
|
||||
|
||||
AB_BUTTON_TYPE
|
||||
gilP_string_to_button_type(STRING type_string)
|
||||
{
|
||||
return (AB_BUTTON_TYPE) convert_string_to_int(type_string,
|
||||
button_type_tab, ARRAY_NENTS(button_type_tab), -1);
|
||||
}
|
||||
|
||||
/******************* AB_CHOICE_TYPE **************************************/
|
||||
AB_CHOICE_TYPE
|
||||
gilP_string_to_choice_type(STRING s_choice_type)
|
||||
{
|
||||
return AB_CHOICE_EXCLUSIVE;
|
||||
}
|
||||
|
||||
|
||||
/******************* AB_COMPASS_POINT *********************************/
|
||||
static ISTRING compass_tab[AB_COMPASS_POINT_NUM_VALUES];
|
||||
static BOOL compass_tab_inited = FALSE;
|
||||
#define cp_tab_check_init() (compass_tab_inited? 0:compass_tab_init())
|
||||
|
||||
static int
|
||||
compass_tab_init()
|
||||
{
|
||||
#define cpt compass_tab
|
||||
compass_tab_inited = TRUE;
|
||||
convert_fill_table(cpt, ARRAY_NENTS(cpt), istr_const(NULL));
|
||||
|
||||
/* sorted in clockwise order */
|
||||
cpt[AB_CP_NORTH] = istr_const(":north");
|
||||
cpt[AB_CP_NORTHEAST] = istr_const(":north-east");
|
||||
cpt[AB_CP_EAST] = istr_const(":east");
|
||||
cpt[AB_CP_SOUTHEAST] = istr_const(":south-east");
|
||||
cpt[AB_CP_SOUTH] = istr_const(":south");
|
||||
cpt[AB_CP_SOUTHWEST] = istr_const(":south-west");
|
||||
cpt[AB_CP_WEST] = istr_const(":west");
|
||||
cpt[AB_CP_NORTHWEST] = istr_const(":north-west");
|
||||
cpt[AB_CP_CENTER] = istr_const(":center");
|
||||
|
||||
return 0;
|
||||
#undef at
|
||||
}
|
||||
|
||||
AB_COMPASS_POINT
|
||||
gilP_string_to_compass_point(STRING compass_str)
|
||||
{
|
||||
return (AB_COMPASS_POINT) convert_string_to_int(compass_str,
|
||||
compass_tab, ARRAY_NENTS(compass_tab), -1);
|
||||
}
|
||||
|
||||
|
||||
/******************* AB_FILE_CHOOSER_TYPE *********************************/
|
||||
|
||||
/*
|
||||
* CDE app builder doesn't really distinguish the file chooser types
|
||||
*/
|
||||
|
||||
int
|
||||
gilP_string_to_file_chooser_type(STRING s_type)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/******************* AB_GROUP_TYPE **************************************/
|
||||
AB_GROUP_TYPE
|
||||
gilP_string_to_group_type(STRING s_group)
|
||||
{
|
||||
AB_GROUP_TYPE groupType = AB_GROUP_UNDEF;
|
||||
|
||||
|
||||
if (util_streq(s_group, ":column"))
|
||||
{
|
||||
groupType = AB_GROUP_COLUMNS;
|
||||
}
|
||||
else if (util_streq(s_group, ":row"))
|
||||
{
|
||||
groupType = AB_GROUP_ROWS;
|
||||
}
|
||||
else if (util_streq(s_group, ":row-column"))
|
||||
{
|
||||
groupType = AB_GROUP_ROWSCOLUMNS;
|
||||
}
|
||||
else if (util_streq(s_group, "nil"))
|
||||
{
|
||||
groupType = AB_GROUP_IGNORE;
|
||||
}
|
||||
|
||||
return groupType;
|
||||
}
|
||||
|
||||
|
||||
/******************* AB_LABEL_TYPE **************************************/
|
||||
static ISTRING label_type_tab[AB_LABEL_TYPE_NUM_VALUES];
|
||||
static BOOL label_type_tab_inited = FALSE;
|
||||
#define label_type_tab_check_init() \
|
||||
(label_type_tab_inited? 0:label_type_tab_init())
|
||||
|
||||
static int
|
||||
label_type_tab_init()
|
||||
{
|
||||
#define ltt label_type_tab
|
||||
label_type_tab_inited = TRUE;
|
||||
|
||||
ltt[AB_LABEL_ARROW_DOWN] = istr_const(":arrow-down");
|
||||
ltt[AB_LABEL_ARROW_LEFT] = istr_const(":arrow-left");
|
||||
ltt[AB_LABEL_ARROW_RIGHT] = istr_const(":arrow-right");
|
||||
ltt[AB_LABEL_ARROW_UP] = istr_const(":arrow_up");
|
||||
ltt[AB_LABEL_DRAWN] = istr_const(":drawn");
|
||||
ltt[AB_LABEL_GLYPH] = istr_const(":glyph");
|
||||
ltt[AB_LABEL_STRING] = istr_const(":string");
|
||||
|
||||
return 0;
|
||||
#undef ltt
|
||||
}
|
||||
|
||||
AB_LABEL_TYPE
|
||||
gilP_string_to_label_type(STRING type_string)
|
||||
{
|
||||
return (AB_LABEL_TYPE) convert_string_to_int(type_string,
|
||||
label_type_tab, ARRAY_NENTS(label_type_tab), -1);
|
||||
}
|
||||
|
||||
/******************* AB_MENU_TYPE **************************************/
|
||||
AB_MENU_TYPE
|
||||
gilP_string_to_menu_type(STRING s_menu_type)
|
||||
{
|
||||
AB_MENU_TYPE menuType = AB_MENU_UNDEF;
|
||||
|
||||
if (util_streq(s_menu_type, ":command"))
|
||||
{
|
||||
menuType = AB_MENU_PULLDOWN;
|
||||
}
|
||||
else if (util_streq(s_menu_type, ":exclusive"))
|
||||
{
|
||||
menuType = AB_MENU_OPTION;
|
||||
}
|
||||
|
||||
return menuType;
|
||||
}
|
||||
|
||||
|
||||
/******************* AB_OBJECT_STATE **************************************/
|
||||
|
||||
AB_OBJECT_STATE
|
||||
gilP_string_to_object_state(STRING s_state)
|
||||
{
|
||||
AB_OBJECT_STATE state = AB_STATE_UNDEF;
|
||||
|
||||
if (util_streq(s_state, ":active"))
|
||||
{
|
||||
state = AB_STATE_ACTIVE;
|
||||
}
|
||||
else if (util_streq(s_state, ":iconic"))
|
||||
{
|
||||
state = AB_STATE_ICONIC;
|
||||
}
|
||||
else if (util_streq(s_state, ":inactive"))
|
||||
{
|
||||
state = AB_STATE_INACTIVE;
|
||||
}
|
||||
else if (util_streq(s_state, ":invisible"))
|
||||
{
|
||||
state = AB_STATE_INVISIBLE;
|
||||
}
|
||||
else if (util_streq(s_state, ":notselected"))
|
||||
{
|
||||
state = AB_STATE_NOTSELECTED;
|
||||
}
|
||||
else if (util_streq(s_state, ":open"))
|
||||
{
|
||||
state = AB_STATE_OPEN;
|
||||
}
|
||||
else if (util_streq(s_state, ":selected"))
|
||||
{
|
||||
state = AB_STATE_SELECTED;
|
||||
}
|
||||
else if (util_streq(s_state, ":visible"))
|
||||
{
|
||||
state = AB_STATE_VISIBLE;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** AB_OBJECT_TYPE **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* REMIND: move type conversion stuff to guide
|
||||
*/
|
||||
static BOOL obj_type_table_inited = FALSE;
|
||||
static ISTRING obj_type_table[AB_OBJECT_TYPE_NUM_VALUES + 1] = {NULL};
|
||||
|
||||
#define check_obj_type_table_init() \
|
||||
(obj_type_table_inited? 0:obj_type_table_init())
|
||||
|
||||
static int
|
||||
obj_type_table_init()
|
||||
{
|
||||
#define ott obj_type_table
|
||||
obj_type_table_inited = TRUE;
|
||||
convert_fill_table(obj_type_table,
|
||||
AB_OBJECT_TYPE_NUM_VALUES, istr_const("?type?"));
|
||||
|
||||
/*
|
||||
* REMIND: what is type :stack? Is it a setting stack or layers?
|
||||
* REMIND: what about file chooser?
|
||||
*/
|
||||
/* sorted by enum name */
|
||||
ott[AB_TYPE_BASE_WINDOW] = istr_const(":base-window");
|
||||
ott[AB_TYPE_BUTTON] = istr_const(":button");
|
||||
ott[AB_TYPE_CHOICE] = istr_const(":setting");
|
||||
/* ott[AB_TYPE_CHOICE]= istr_const(":stack"); duplicate */
|
||||
ott[AB_TYPE_CONTAINER] = istr_const(":control-area");
|
||||
/*ott[AB_TYPE_CONTAINER] = istr_const(":group");*/
|
||||
ott[AB_TYPE_DIALOG] = istr_const(":popup-window");
|
||||
ott[AB_TYPE_DRAWING_AREA] = istr_const(":canvas-pane");
|
||||
ott[AB_TYPE_FILE_CHOOSER] = istr_const(":file-chooser");
|
||||
ott[AB_TYPE_LABEL] = istr_const(":drop-target");
|
||||
ott[AB_TYPE_LIST] = istr_const(":scrolling-list");
|
||||
ott[AB_TYPE_MENU] = istr_const(":menu");
|
||||
ott[AB_TYPE_SCALE] = istr_const(":gauge");
|
||||
/* ott[AB_TYPE_SCALE]= istr_const(":slider"); duplicate */
|
||||
ott[AB_TYPE_TERM_PANE] = istr_const(":term-pane");
|
||||
ott[AB_TYPE_TEXT_FIELD] = istr_const(":text-field");
|
||||
/*ott[AB_TYPE_TEXT_FIELD] = istr_const(":message");*/
|
||||
ott[AB_TYPE_TEXT_PANE] = istr_const(":text-pane");
|
||||
|
||||
return 0;
|
||||
#undef ott
|
||||
}
|
||||
|
||||
AB_OBJECT_TYPE
|
||||
gilP_string_to_object_type(STRING string_type)
|
||||
{
|
||||
AB_OBJECT_TYPE objType = AB_TYPE_UNDEF;
|
||||
|
||||
objType = (AB_OBJECT_TYPE) convert_string_to_int(
|
||||
string_type,
|
||||
obj_type_table, AB_OBJECT_TYPE_NUM_VALUES, AB_TYPE_UNDEF);
|
||||
|
||||
if (objType == AB_TYPE_UNDEF)
|
||||
{
|
||||
if (util_streq(string_type, ":stack"))
|
||||
{
|
||||
objType = AB_TYPE_CHOICE;
|
||||
}
|
||||
else if (util_streq(string_type, ":group"))
|
||||
{
|
||||
objType = AB_TYPE_CONTAINER;
|
||||
}
|
||||
else if (util_streq(string_type, ":message"))
|
||||
{
|
||||
objType = AB_TYPE_TEXT_FIELD;
|
||||
}
|
||||
else if (util_streq(string_type, ":slider"))
|
||||
{
|
||||
objType = AB_TYPE_SCALE;
|
||||
}
|
||||
}
|
||||
|
||||
return objType;
|
||||
}
|
||||
|
||||
|
||||
/******************* AB_ORIENTATION **************************************/
|
||||
AB_ORIENTATION
|
||||
gilP_string_to_orientation(STRING s_orient)
|
||||
{
|
||||
AB_ORIENTATION orient = AB_ORIENT_UNDEF;
|
||||
|
||||
if (util_streq(s_orient, ":horizontal"))
|
||||
{
|
||||
orient = AB_ORIENT_HORIZONTAL;
|
||||
}
|
||||
else if (util_streq(s_orient, ":vertical"))
|
||||
{
|
||||
orient = AB_ORIENT_VERTICAL;
|
||||
}
|
||||
|
||||
return orient;
|
||||
}
|
||||
|
||||
|
||||
/******************* AB_TEXT_TYPE **************************************/
|
||||
AB_TEXT_TYPE
|
||||
gilP_string_to_text_type(STRING s_text_type)
|
||||
{
|
||||
AB_TEXT_TYPE textType = AB_TEXT_UNDEF;
|
||||
|
||||
if (util_streq(s_text_type, ":alphanumeric"))
|
||||
{
|
||||
textType = AB_TEXT_ALPHANUMERIC;
|
||||
}
|
||||
else if (util_streq(s_text_type, ":multiline"))
|
||||
{
|
||||
textType = AB_TEXT_ALPHANUMERIC;
|
||||
}
|
||||
else if (util_streq(s_text_type, ":numeric"))
|
||||
{
|
||||
textType = AB_TEXT_NUMERIC;
|
||||
}
|
||||
|
||||
return textType;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** AB_WHEN **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* REMIND: move when stuff to libguide
|
||||
*/
|
||||
static ISTRING when_table[AB_WHEN_NUM_VALUES];
|
||||
static BOOL when_table_inited = FALSE;
|
||||
#define check_when_table_init() \
|
||||
if (!when_table_inited) {when_table_init();}
|
||||
|
||||
static int
|
||||
when_table_init()
|
||||
{
|
||||
#define wt when_table
|
||||
int i = 0;
|
||||
|
||||
when_table_inited = TRUE;
|
||||
convert_fill_table(when_table, AB_WHEN_NUM_VALUES,
|
||||
istr_const("?when?"));
|
||||
|
||||
/* wt[AB_WHEN_ANY_EVENT]= istr_const("AnyEvent"); */
|
||||
/* wt[AB_WHEN_BUTTON1_PRESS]= istr_const("Button1Press"); */
|
||||
/* wt[AB_WHEN_BUTTON2_PRESS]= istr_const("Button2Press"); */
|
||||
/* wt[AB_WHEN_BUTTON3_PRESS]= istr_const("Button3Press"); */
|
||||
wt[AB_WHEN_AFTER_CREATED] = istr_const("Create");
|
||||
wt[AB_WHEN_DESTROYED] = istr_const("Destroy");
|
||||
/* wt[AB_WHEN_DONE]= istr_const("Done"); */
|
||||
wt[AB_WHEN_DROPPED_ON] = istr_const("DroppedUpon");
|
||||
/* wt[AB_WHEN_DOUBLE_CLICK]= istr_const("DoubleClick"); */
|
||||
/* wt[AB_WHEN_PTR_ENTER]= istr_const("PointerEnter"); */
|
||||
/* wt[AB_WHEN_PTR_EXIT]= istr_const("PointerExit"); */
|
||||
/* wt[AB_WHEN_KEY_DOWN]= istr_const("KeyPress"); */
|
||||
wt[AB_WHEN_ACTIVATED] = istr_const("Notify");
|
||||
wt[AB_WHEN_HIDDEN] = istr_const("Popdown");
|
||||
wt[AB_WHEN_SHOWN] = istr_const("Popup");
|
||||
wt[AB_WHEN_REPAINT_NEEDED] = istr_const("Repaint");
|
||||
wt[AB_WHEN_AFTER_RESIZED] = istr_const("Resize");
|
||||
/* wt[AB_WHEN_SELECT]= istr_const("Select"); */
|
||||
wt[AB_WHEN_UNDEF] = istr_const("Undef");
|
||||
/* wt[AB_WHEN_UNSELECT]= istr_const("Unselect"); */
|
||||
|
||||
return 0;
|
||||
#undef wt
|
||||
}
|
||||
|
||||
|
||||
|
||||
AB_WHEN
|
||||
gilP_string_to_when(STRING when_string)
|
||||
{
|
||||
return (AB_WHEN) convert_string_to_int(
|
||||
when_string,
|
||||
when_table, AB_WHEN_NUM_VALUES, AB_WHEN_UNDEF);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
gil_init(void)
|
||||
{
|
||||
static BOOL gil_inited = FALSE;
|
||||
|
||||
if (gil_inited)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
align_tab_check_init();
|
||||
arg_type_tab_check_init();
|
||||
gat_check_init();
|
||||
check_builtin_action_table_init();
|
||||
button_type_tab_check_init();
|
||||
cp_tab_check_init();
|
||||
label_type_tab_check_init();
|
||||
check_obj_type_table_init();
|
||||
check_when_table_init();
|
||||
|
||||
gil_inited = TRUE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
50
cde/programs/dtappbuilder/src/libABil/gil.h
Normal file
50
cde/programs/dtappbuilder/src/libABil/gil.h
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: gil.h /main/3 1995/11/06 18:27:23 rswiston $
|
||||
*
|
||||
* @(#)gil.h 1.8 02 Feb 1995 cde_app_builder/src/libABobj
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* gil.h - gil file defines, et cetera.
|
||||
*/
|
||||
#ifndef _ABIL_GIL_H_
|
||||
#define _ABIL_GIL_H_
|
||||
|
||||
#include <ab_private/obj.h>
|
||||
|
||||
#define GIL_MAX_NAME_LENGTH 1023
|
||||
#define GIL_MAX_NAME_SIZE (GIL_MAX_NAME_LENGTH + 1)/*size includes NULL*/
|
||||
|
||||
int gil_init(void); /* CALL THIS FIRST! */
|
||||
|
||||
extern ABObj gil_load_file(
|
||||
STRING interfaceFilePath,
|
||||
FILE *inFile,
|
||||
ABObj project
|
||||
);
|
||||
extern int gil_load_project_file(
|
||||
STRING projectFilePath,
|
||||
FILE *inFile,
|
||||
ABObj *projectOut
|
||||
);
|
||||
extern int gil_load_project_file_and_resolve_all(
|
||||
STRING projectFilePath,
|
||||
FILE *inFile,
|
||||
ABObj *projectOut
|
||||
);
|
||||
|
||||
#endif /* _ABIL_GIL_H_ */
|
||||
194
cde/programs/dtappbuilder/src/libABil/gilP.h
Normal file
194
cde/programs/dtappbuilder/src/libABil/gilP.h
Normal file
@@ -0,0 +1,194 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: gilP.h /main/3 1995/11/06 18:27:37 rswiston $
|
||||
*
|
||||
* @(#)gilP.h 1.14 30 Jan 1995 cde_app_builder/src/libABil
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* gil.h - gil file defines, et cetera.
|
||||
*/
|
||||
#ifndef _ABIL_GIL_P_H_
|
||||
#define _ABIL_GIL_P_H_
|
||||
|
||||
#include <ab_private/obj.h>
|
||||
|
||||
/*
|
||||
* GIL file attributes
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
AB_GIL_UNDEF,
|
||||
AB_GIL_ABBREVIATED,
|
||||
AB_GIL_ACTION, /* actions - one action "type"*/
|
||||
AB_GIL_ACTIONS, /* actions - list of actions */
|
||||
AB_GIL_ANCHOR_OBJECT,
|
||||
AB_GIL_ANCHOR_POINT,
|
||||
AB_GIL_ARG_TYPE, /* actions */
|
||||
AB_GIL_BACKGROUND_COLOR,
|
||||
AB_GIL_BUSY_DROP_GLYPH,
|
||||
AB_GIL_BUTTON_TYPE,
|
||||
AB_GIL_CHOICES,
|
||||
AB_GIL_CHOICE_DEFAULTS,
|
||||
AB_GIL_CHOICE_LABEL_TYPES,
|
||||
AB_GIL_CHOICE_COLORS,
|
||||
AB_GIL_COLUMNS,
|
||||
AB_GIL_COL_ALIGNMENT,
|
||||
AB_GIL_CONNECTIONS,
|
||||
AB_GIL_CONSTANT_WIDTH,
|
||||
AB_GIL_DEFAULT_DROP_SITE,
|
||||
AB_GIL_DND_ACCEPT_CURSOR,
|
||||
AB_GIL_DND_ACCEPT_CURSOR_XHOT,
|
||||
AB_GIL_DND_ACCEPT_CURSOR_YHOT,
|
||||
AB_GIL_DND_CURSOR,
|
||||
AB_GIL_DND_CURSOR_XHOT,
|
||||
AB_GIL_DND_CURSOR_YHOT,
|
||||
AB_GIL_DRAGGABLE,
|
||||
AB_GIL_DONE_HANDLER,
|
||||
AB_GIL_DROPPABLE,
|
||||
AB_GIL_DROP_TARGET_WIDTH,
|
||||
AB_GIL_DRAWING_MODEL,
|
||||
AB_GIL_EVENTS,
|
||||
AB_GIL_EVENT_HANDLER,
|
||||
AB_GIL_FILE_CHOOSER_FILTER_PATTERN,
|
||||
AB_GIL_FILE_CHOOSER_MATCH_GLYPH,
|
||||
AB_GIL_FILE_CHOOSER_MATCH_GLYPH_MASK,
|
||||
AB_GIL_FILE_CHOOSER_TYPE,
|
||||
AB_GIL_FOREGROUND_COLOR,
|
||||
AB_GIL_FROM, /* actions */
|
||||
AB_GIL_FUNCTION_TYPE, /* actions */
|
||||
AB_GIL_GROUP_TYPE,
|
||||
AB_GIL_HEIGHT,
|
||||
AB_GIL_HELP,
|
||||
AB_GIL_HOFFSET,
|
||||
AB_GIL_HSCROLL,
|
||||
AB_GIL_HSPACING,
|
||||
AB_GIL_ICON_FILE,
|
||||
AB_GIL_ICON_LABEL,
|
||||
AB_GIL_ICON_MASK_FILE,
|
||||
AB_GIL_INITIAL_LIST_GLYPHS,
|
||||
AB_GIL_INITIAL_LIST_VALUES,
|
||||
AB_GIL_INITIAL_SELECTIONS,
|
||||
AB_GIL_INITIAL_STATE,
|
||||
AB_GIL_INITIAL_VALUE,
|
||||
AB_GIL_INTERFACES,
|
||||
AB_GIL_INTERNATIONAL_DB_BEGIN,
|
||||
AB_GIL_INTERNATIONAL_DB_END,
|
||||
AB_GIL_LABEL,
|
||||
AB_GIL_LABEL_TYPE,
|
||||
AB_GIL_LABEL_BOLD,
|
||||
AB_GIL_LAYOUT_TYPE,
|
||||
AB_GIL_MAPPED,
|
||||
AB_GIL_MAX_TICK_STRING,
|
||||
AB_GIL_MAX_VALUE,
|
||||
AB_GIL_MAX_VALUE_STRING,
|
||||
AB_GIL_MEMBERS,
|
||||
AB_GIL_MENU,
|
||||
AB_GIL_MENU_HANDLER,
|
||||
AB_GIL_MENU_ITEM_ACCELERATORS,
|
||||
AB_GIL_MENU_ITEM_COLORS,
|
||||
AB_GIL_MENU_ITEM_DEFAULTS,
|
||||
AB_GIL_MENU_ITEM_HANDLERS,
|
||||
AB_GIL_MENU_ITEM_LABELS,
|
||||
AB_GIL_MENU_ITEM_LABEL_TYPES,
|
||||
AB_GIL_MENU_ITEM_MENUS,
|
||||
AB_GIL_MENU_ITEM_STATES,
|
||||
AB_GIL_MENU_TITLE,
|
||||
AB_GIL_MENU_TYPE,
|
||||
AB_GIL_MIN_TICK_STRING,
|
||||
AB_GIL_MIN_VALUE,
|
||||
AB_GIL_MIN_VALUE_STRING,
|
||||
AB_GIL_MULTIPLE_SELECTIONS,
|
||||
AB_GIL_NAME,
|
||||
AB_GIL_NORMAL,
|
||||
AB_GIL_NORMAL_DROP_GLYPH,
|
||||
AB_GIL_ACTIVATE_HANDLER,
|
||||
AB_GIL_ORIENTATION,
|
||||
AB_GIL_OWNER,
|
||||
AB_GIL_PINNABLE,
|
||||
AB_GIL_PINNED,
|
||||
AB_GIL_READ_ONLY,
|
||||
AB_GIL_REFERENCE_POINT,
|
||||
AB_GIL_REPAINT_PROC,
|
||||
AB_GIL_RESIZABLE,
|
||||
AB_GIL_ATT_ROOT_WINDOW,
|
||||
AB_GIL_ROWS,
|
||||
AB_GIL_ROW_ALIGNMENT,
|
||||
AB_GIL_SCROLLABLE_HEIGHT,
|
||||
AB_GIL_SCROLLABLE_WIDTH,
|
||||
AB_GIL_SELECTION_REQUIRED,
|
||||
AB_GIL_SETTING_TYPE,
|
||||
AB_GIL_SHOW_BORDER,
|
||||
AB_GIL_SHOW_ENDBOXES,
|
||||
AB_GIL_SHOW_FOOTER,
|
||||
AB_GIL_SHOW_RANGE,
|
||||
AB_GIL_SHOW_VALUE,
|
||||
AB_GIL_SCALE_WIDTH,
|
||||
AB_GIL_STORED_LENGTH,
|
||||
AB_GIL_MAX_LENGTH,
|
||||
AB_GIL_TEXT_TYPE,
|
||||
AB_GIL_TICKS,
|
||||
AB_GIL_TITLE,
|
||||
AB_GIL_TO, /* actions */
|
||||
AB_GIL_TYPE,
|
||||
AB_GIL_USER_DATA,
|
||||
AB_GIL_VALUE_LENGTH,
|
||||
AB_GIL_VALUE_UNDERLINED,
|
||||
AB_GIL_VALUE_X,
|
||||
AB_GIL_VALUE_Y,
|
||||
AB_GIL_VOFFSET,
|
||||
AB_GIL_VSCROLL,
|
||||
AB_GIL_VSPACING,
|
||||
AB_GIL_WHEN, /* actions */
|
||||
AB_GIL_WIDTH,
|
||||
AB_GIL_X,
|
||||
AB_GIL_Y,
|
||||
AB_GIL_ATTRIBUTE_NUM_VALUES /* must be last */
|
||||
} AB_GIL_ATTRIBUTE;
|
||||
|
||||
/* gil.c */
|
||||
AB_ALIGNMENT gilP_string_to_alignment(STRING string);
|
||||
AB_ARG_TYPE gilP_string_to_arg_type(STRING string);
|
||||
AB_GIL_ATTRIBUTE gilP_string_to_att(STRING att);
|
||||
AB_BUILTIN_ACTION gilP_string_to_builtin_action(STRING string);
|
||||
AB_BUTTON_TYPE gilP_string_to_button_type(STRING string);
|
||||
AB_CHOICE_TYPE gilP_string_to_choice_type(STRING string);
|
||||
AB_COMPASS_POINT gilP_string_to_compass_point(STRING string);
|
||||
int gilP_string_to_file_chooser_type(STRING string);
|
||||
AB_GROUP_TYPE gilP_string_to_group_type(STRING string);
|
||||
AB_LABEL_TYPE gilP_string_to_label_type(STRING string);
|
||||
AB_MENU_TYPE gilP_string_to_menu_type(STRING string);
|
||||
AB_OBJECT_STATE gilP_string_to_object_state(STRING string);
|
||||
AB_OBJECT_TYPE gilP_string_to_object_type(STRING string);
|
||||
AB_ORIENTATION gilP_string_to_orientation(STRING string);
|
||||
AB_TEXT_TYPE gilP_string_to_text_type(STRING string);
|
||||
AB_WHEN gilP_string_to_when(STRING string);
|
||||
|
||||
|
||||
/* gil_loadact.c */
|
||||
int gilP_load_att_done_handler(FILE *inFile, ABObj obj, ABObj interface);
|
||||
int gilP_load_att_event_handler(FILE *inFile, ABObj obj, ABObj interface);
|
||||
int gilP_load_att_menu_handler(FILE *inFile, ABObj obj, ABObj interface);
|
||||
int gilP_load_att_menu_item_handlers(FILE *inFile, ABObj obj, ABObj interface);
|
||||
int gilP_load_att_notify_handler(FILE *inFile, ABObj obj, ABObj interface);
|
||||
int gilP_load_att_repaint_proc(FILE *inFile, ABObj obj, ABObj interface);
|
||||
int gilP_load_att_actions(FILE *inFile, ABObj obj, ABObj interface);
|
||||
|
||||
/* gil_loadobj */
|
||||
int gilP_load_object(FILE *inFile, ABObj parent);
|
||||
int gilP_load_object2(FILE *inFile, ABObj obj, ABObj parent);
|
||||
|
||||
#endif /* _ABIL_GIL_P_H_ */
|
||||
961
cde/programs/dtappbuilder/src/libABil/gil_loadact.c
Normal file
961
cde/programs/dtappbuilder/src/libABil/gil_loadact.c
Normal file
@@ -0,0 +1,961 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: gil_loadact.c /main/3 1995/11/06 18:27:51 rswiston $
|
||||
*
|
||||
* @(#)gil_loadact.c 1.20 13 Feb 1994 cde_app_builder/src/libABil
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special restrictions in a
|
||||
* confidential disclosure agreement between HP, IBM, Sun, USL, SCO and
|
||||
* Univel. Do not distribute this document outside HP, IBM, Sun, USL, SCO,
|
||||
* or Univel without Sun's specific written approval. This document and all
|
||||
* copies and derivative works thereof must be returned or destroyed at Sun's
|
||||
* request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* loadact.c - load action and handler attributes
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/param.h>
|
||||
#include <assert.h>
|
||||
#include <ab_private/obj.h>
|
||||
#include <ab_private/abio.h>
|
||||
#include <ab_private/trav.h>
|
||||
#include <ab_private/util.h>
|
||||
#include <ab_private/istr.h>
|
||||
#include "../libABobj/obj_utils.h"
|
||||
#include "gil.h"
|
||||
#include "gilP.h"
|
||||
#include "load.h"
|
||||
#include "loadP.h"
|
||||
#include "gil_loadattP.h"
|
||||
|
||||
static int get_action(
|
||||
FILE * inFile,
|
||||
ABObj obj,
|
||||
ABObj module,
|
||||
ABObj action
|
||||
);
|
||||
static int get_action_attribute(
|
||||
FILE * inFile,
|
||||
ABObj obj,
|
||||
ABObj module,
|
||||
ABObj action,
|
||||
AB_GIL_ATTRIBUTE attr
|
||||
);
|
||||
static int get_when(
|
||||
FILE * inFile,
|
||||
ABObj obj,
|
||||
ABObj action
|
||||
);
|
||||
static int get_from(
|
||||
FILE * inFile,
|
||||
ABObj obj,
|
||||
ABObj module,
|
||||
ABObj action
|
||||
);
|
||||
static int get_to(
|
||||
FILE * inFile,
|
||||
ABObj obj,
|
||||
ABObj module,
|
||||
ABObj action
|
||||
);
|
||||
static int get_operation(FILE * inFile, ABObj action);
|
||||
static int get_function_type(FILE * inFile, ABObj action);
|
||||
static int get_arg_type(FILE * inFile, ABObj action);
|
||||
static int add_user_handler(ABObj obj, ABObj module,
|
||||
ISTRING handler, AB_WHEN when);
|
||||
static int install_action(
|
||||
ABObj obj,
|
||||
ABObj module,
|
||||
ABObj action
|
||||
);
|
||||
static ABObj find_or_create_target(
|
||||
ABObj obj,
|
||||
ABObj module,
|
||||
ISTRING interface_name,
|
||||
ISTRING parent_name,
|
||||
ISTRING obj_name,
|
||||
ISTRING item_label
|
||||
);
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Specific handlers **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* */
|
||||
int
|
||||
gilP_load_att_done_handler(FILE * inFile, ABObj obj, ABObj module)
|
||||
{
|
||||
int return_value = 0;
|
||||
int rc = 0; /* r turn code */
|
||||
ISTRING handler = NULL;
|
||||
ABObj action = NULL;
|
||||
|
||||
if ((rc = gilP_load_handler(inFile, &handler)) < 0)
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* I don't know what this a DONE when signifies. It doesn't exist in BIL
|
||||
* add_user_handler(obj, module, handler, AB_WHEN_DONE);
|
||||
*/
|
||||
abil_print_load_err(ERR_NOT_IMPL);
|
||||
|
||||
istr_destroy(handler);
|
||||
return return_value;
|
||||
}
|
||||
|
||||
int
|
||||
gilP_load_att_event_handler(FILE * inFile, ABObj obj, ABObj module)
|
||||
{
|
||||
int return_value = 0;
|
||||
int rc = 0; /* r turn code */
|
||||
ISTRING event_handler = NULL;
|
||||
|
||||
if ((rc = gilP_load_handler(inFile, &event_handler)) < 0)
|
||||
{
|
||||
istr_destroy(event_handler);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* Doesn't exist in BIL add_user_handler(obj, module, event_handler,
|
||||
* AB_WHEN_ANY_EVENT);
|
||||
*/
|
||||
abil_print_load_err(ERR_NOT_IMPL);
|
||||
istr_destroy(event_handler);
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/*
|
||||
* */
|
||||
int
|
||||
gilP_load_att_menu_handler(FILE * inFile, ABObj obj, ABObj module)
|
||||
{
|
||||
int return_value = 0;
|
||||
int rc = 0; /* r turn code */
|
||||
ISTRING handler = NULL;
|
||||
|
||||
if ((rc = gilP_load_handler(inFile, &handler)) < 0)
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
add_user_handler(obj, module, handler, AB_WHEN_ACTIVATED);
|
||||
istr_destroy(handler);
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/*
|
||||
* */
|
||||
int
|
||||
gilP_load_att_menu_item_handlers(FILE * inFile, ABObj obj, ABObj module)
|
||||
{
|
||||
int return_value = 0;
|
||||
int rc = 0; /* r turn code */
|
||||
ISTRING_ARRAY handlers;
|
||||
AB_TRAVERSAL trav;
|
||||
ABObj item = NULL;
|
||||
int i = 0;
|
||||
|
||||
istr_array_init(&handlers);
|
||||
if ((rc = gilP_load_handlers(inFile, &handlers)) < 0)
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
obj_ensure_num_children(obj, handlers.count);
|
||||
for (trav_open(&trav, obj, AB_TRAV_ITEMS_FOR_OBJ), i = 0;
|
||||
(item = trav_next(&trav)) != NULL; ++i)
|
||||
{
|
||||
add_user_handler(item, module,
|
||||
handlers.strings[i], AB_WHEN_ACTIVATED);
|
||||
handlers.strings[i] = NULL;
|
||||
}
|
||||
trav_close(&trav);
|
||||
istr_array_uninit(&handlers);
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/*
|
||||
* */
|
||||
int
|
||||
gilP_load_att_notify_handler(FILE * inFile, ABObj obj, ABObj module)
|
||||
{
|
||||
int return_value = 0;
|
||||
int rc = 0; /* r turn code */
|
||||
ISTRING handler = NULL;
|
||||
|
||||
if ((rc = gilP_load_handler(inFile, &handler)) < 0)
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
add_user_handler(obj, module, handler, AB_WHEN_ACTIVATED);
|
||||
|
||||
istr_destroy(handler);
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/*
|
||||
* */
|
||||
int
|
||||
gilP_load_att_repaint_proc(FILE * inFile, ABObj obj, ABObj module)
|
||||
{
|
||||
int return_value = 0;
|
||||
int rc = 0; /* r turn code */
|
||||
ISTRING repaint = NULL;
|
||||
|
||||
if ((rc = gilP_load_handler(inFile, &repaint)) < 0)
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
add_user_handler(obj, module, repaint, AB_WHEN_REPAINT_NEEDED);
|
||||
|
||||
istr_destroy(repaint);
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** **
|
||||
** General actions **
|
||||
** **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* Load the actions attributes
|
||||
*/
|
||||
int
|
||||
gilP_load_att_actions(FILE * inFile, ABObj obj, ABObj module)
|
||||
{
|
||||
int return_value = 0;
|
||||
int rc = 0; /* r turn code */
|
||||
ABObj action = NULL;
|
||||
|
||||
if (!abio_get_list_begin(inFile))
|
||||
return (abil_print_load_err(ERR_WANT_LIST), -1);
|
||||
|
||||
while (!abio_get_list_end(inFile))
|
||||
{
|
||||
action = obj_create(AB_TYPE_ACTION, NULL);
|
||||
|
||||
if ((rc = get_action(inFile, obj, module, action)) < 0)
|
||||
{
|
||||
obj_destroy(action);
|
||||
return rc;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (obj_get_when(action) == AB_WHEN_UNDEF)
|
||||
{
|
||||
/* unsupported :when value - ignore it and continue */
|
||||
obj_destroy(action);
|
||||
}
|
||||
else
|
||||
{
|
||||
install_action(obj, module, action);
|
||||
}
|
||||
}
|
||||
}
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Load an action.
|
||||
*/
|
||||
static int
|
||||
get_action(
|
||||
FILE * inFile,
|
||||
ABObj obj,
|
||||
ABObj module,
|
||||
ABObj action
|
||||
)
|
||||
{
|
||||
int return_value = 0;
|
||||
int rc = 0; /* r turn code */
|
||||
ISTRING keyword;
|
||||
AB_GIL_ATTRIBUTE action_attr;
|
||||
|
||||
if (!abio_get_list_begin(inFile))
|
||||
return (abil_print_load_err(ERR_WANT_LIST), -1);
|
||||
|
||||
while (!abio_get_list_end(inFile))
|
||||
{
|
||||
if (abio_get_eof(inFile))
|
||||
{
|
||||
abil_print_load_err(ERR_EOF);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!abio_get_keyword(inFile, &keyword))
|
||||
{
|
||||
abil_print_load_err(ERR_WANT_KEYWORD);
|
||||
return -1;
|
||||
}
|
||||
|
||||
action_attr = gilP_string_to_att(istr_string(keyword));
|
||||
if ((rc = get_action_attribute(inFile, obj, module,
|
||||
action, action_attr))
|
||||
< 0)
|
||||
{
|
||||
return_value = rc;
|
||||
break;
|
||||
}
|
||||
abil_loadmsg_set_action_att(NULL);
|
||||
}
|
||||
abil_loadmsg_set_action_att(NULL);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Load one action attribute.
|
||||
*/
|
||||
static int
|
||||
get_action_attribute(
|
||||
FILE * inFile,
|
||||
ABObj obj,
|
||||
ABObj module,
|
||||
ABObj action,
|
||||
AB_GIL_ATTRIBUTE attr
|
||||
)
|
||||
{
|
||||
int return_value = 0;
|
||||
int rc = 0; /* r turn code */
|
||||
|
||||
if (abio_get_eof(inFile))
|
||||
{
|
||||
return (abil_print_load_err(ERR_EOF), -1);
|
||||
}
|
||||
|
||||
switch (attr)
|
||||
{
|
||||
case AB_GIL_FROM:
|
||||
rc = get_from(inFile, obj, module, action);
|
||||
break;
|
||||
case AB_GIL_ACTION:
|
||||
rc = get_operation(inFile, action);
|
||||
break;
|
||||
case AB_GIL_TO:
|
||||
rc = get_to(inFile, obj, module, action);
|
||||
break;
|
||||
case AB_GIL_WHEN:
|
||||
rc = get_when(inFile, obj, action);
|
||||
break;
|
||||
case AB_GIL_FUNCTION_TYPE:
|
||||
rc = get_function_type(inFile, action);
|
||||
break;
|
||||
case AB_GIL_ARG_TYPE:
|
||||
rc = get_arg_type(inFile, action);
|
||||
break;
|
||||
default:
|
||||
abil_print_load_err(ERR_UNKNOWN);
|
||||
}
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the source object.
|
||||
*/
|
||||
static int
|
||||
get_from(FILE * inFile, ABObj obj, ABObj module, ABObj action)
|
||||
{
|
||||
int return_value = 0;
|
||||
int rc = 0; /* r turn code */
|
||||
ISTRING interface_name = NULL;
|
||||
ISTRING parent_name = NULL;
|
||||
ISTRING name = NULL;
|
||||
ISTRING item_name = NULL;
|
||||
ABObj from = NULL;
|
||||
|
||||
if ( (abio_gil_get_full_name(inFile,
|
||||
&interface_name, &parent_name, &name, &item_name) < 0)
|
||||
|| (name == NULL) )
|
||||
{
|
||||
abil_print_load_err(ERR_WANT_FULL_NAME);
|
||||
return_value = -1;
|
||||
goto abort;
|
||||
}
|
||||
|
||||
from = find_or_create_target(obj, module,
|
||||
interface_name, parent_name, name, item_name);
|
||||
|
||||
if (from == NULL)
|
||||
{
|
||||
rc = abil_print_load_err(ERR_UNKNOWN_OBJECT);
|
||||
goto abort;
|
||||
}
|
||||
|
||||
obj_set_from(action, from);
|
||||
|
||||
abort:
|
||||
istr_destroy(parent_name);
|
||||
istr_destroy(name);
|
||||
istr_destroy(item_name);
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the destination object.
|
||||
*/
|
||||
static int
|
||||
get_to(FILE * inFile, ABObj obj, ABObj module, ABObj action)
|
||||
{
|
||||
int return_value = 0;
|
||||
int rc = 0; /* r turn code */
|
||||
ISTRING interface_name = NULL;
|
||||
ISTRING parent_name = NULL;
|
||||
ISTRING name = NULL;
|
||||
ISTRING item_name = NULL;
|
||||
ABObj to = NULL;
|
||||
|
||||
if ( (abio_gil_get_full_name(inFile,
|
||||
&interface_name, &parent_name, &name, &item_name) < 0)
|
||||
|| (name == NULL) )
|
||||
{
|
||||
abil_print_load_err(ERR_WANT_FULL_NAME);
|
||||
return_value = -1;
|
||||
goto abort;
|
||||
}
|
||||
|
||||
to = find_or_create_target(obj, module,
|
||||
interface_name, parent_name, name, item_name);
|
||||
|
||||
if (to == NULL)
|
||||
{
|
||||
rc = abil_print_load_err(ERR_UNKNOWN_OBJECT);
|
||||
goto abort;
|
||||
}
|
||||
|
||||
action->info.action.to = to;
|
||||
|
||||
abort:
|
||||
istr_destroy(parent_name);
|
||||
istr_destroy(name);
|
||||
istr_destroy(item_name);
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the operation.
|
||||
*/
|
||||
static int
|
||||
get_operation(FILE * inFile, ABObj action)
|
||||
{
|
||||
int return_value = 0;
|
||||
int rc = 0; /* r turn code */
|
||||
ISTRING string = NULL;
|
||||
ISTRING name = NULL;
|
||||
int intval;
|
||||
|
||||
if (!abio_get_list_begin(inFile))
|
||||
{
|
||||
return (abil_print_load_err(ERR_WANT_LIST), -1);
|
||||
}
|
||||
|
||||
switch (obj_get_func_type(action))
|
||||
{
|
||||
case AB_FUNC_CODE_FRAG: /* code fragment */
|
||||
if (!abio_get_string(inFile, &string))
|
||||
{
|
||||
rc = abil_print_load_err(ERR_WANT_STRING);
|
||||
goto abort;
|
||||
}
|
||||
obj_set_func_code(action, istr_string(string));
|
||||
break;
|
||||
|
||||
case AB_FUNC_USER_DEF: /* function name (user defined) */
|
||||
if (!abio_gil_get_name(inFile, &name))
|
||||
{
|
||||
rc = abil_print_load_err(ERR_WANT_NAME);
|
||||
goto abort;
|
||||
}
|
||||
obj_set_func_name(action, istr_string(name));
|
||||
break;
|
||||
|
||||
case AB_FUNC_BUILTIN: /* predefined function */
|
||||
if (!abio_gil_get_name(inFile, &name))
|
||||
{
|
||||
return (abil_print_load_err(ERR_WANT_NAME), -1);
|
||||
}
|
||||
obj_set_func_builtin(action,
|
||||
gilP_string_to_builtin_action(istr_string(name)));
|
||||
|
||||
if (obj_get_func_builtin(action) != AB_STDACT_UNDEF)
|
||||
{
|
||||
if (abio_get_list_end(inFile))
|
||||
return return_value;
|
||||
|
||||
switch (obj_get_arg_type(action))
|
||||
{
|
||||
case AB_ARG_STRING:
|
||||
if (!abio_get_string(inFile, &string))
|
||||
return (abil_print_load_err(ERR_WANT_STRING), -1);
|
||||
obj_set_arg_string(action, istr_string(string));
|
||||
break;
|
||||
case AB_ARG_INT:
|
||||
if (!abio_get_integer(inFile, &intval))
|
||||
return (abil_print_load_err(ERR_WANT_INTEGER), -1);
|
||||
obj_set_arg_int(action, intval);
|
||||
break;
|
||||
case AB_ARG_FLOAT:
|
||||
rc = abil_print_load_err(ERR_UNKNOWN);
|
||||
break;
|
||||
default:
|
||||
rc = abil_print_load_err(ERR_WANT_ARG);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (rc < 0)
|
||||
{
|
||||
return_value = rc;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!abio_get_list_end(inFile))
|
||||
{
|
||||
return (abil_print_load_err(ERR_WANT_LIST), -1);
|
||||
}
|
||||
}
|
||||
|
||||
abort:
|
||||
istr_destroy(string);
|
||||
istr_destroy(name);
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the when part of a connection.
|
||||
*/
|
||||
static int
|
||||
get_when(FILE * inFile, ABObj obj, ABObj action)
|
||||
{
|
||||
int return_value = 0;
|
||||
ISTRING string = NULL;
|
||||
AB_WHEN when = AB_WHEN_UNDEF;
|
||||
int numWhens = 0;
|
||||
|
||||
if (!abio_get_list_begin(inFile))
|
||||
return (abil_print_load_err(ERR_WANT_LIST), -1);
|
||||
|
||||
while (!abio_get_list_end(inFile))
|
||||
{
|
||||
if (!abio_gil_get_name(inFile, &string))
|
||||
return (abil_print_load_err(ERR_WANT_NAME), -1);
|
||||
|
||||
when = gilP_string_to_when(istr_string(string));
|
||||
if (when == AB_WHEN_UNDEF)
|
||||
{
|
||||
if (util_be_verbose())
|
||||
{
|
||||
util_printf("WARNING: ignoring unsupported when: %s\n",
|
||||
istr_string(string));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
obj_set_when(action, when);
|
||||
istr_destroy(string);
|
||||
++numWhens;
|
||||
if (numWhens > 1)
|
||||
{
|
||||
util_printf_err(
|
||||
"WARNING: multiple :when values not supported. "
|
||||
"Using first value\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the function_type for an action holder
|
||||
*/
|
||||
static int
|
||||
get_function_type(FILE * inFile, ABObj action)
|
||||
{
|
||||
int return_value = 0;
|
||||
ISTRING type_name = NULL;
|
||||
|
||||
if (!abio_gil_get_name(inFile, &type_name))
|
||||
{
|
||||
return (abil_print_load_err(ERR_WANT_KEYWORD), -1);
|
||||
}
|
||||
|
||||
if (istr_equalstr(type_name, "ExecuteCode"))
|
||||
{
|
||||
obj_set_func_type(action, AB_FUNC_CODE_FRAG);
|
||||
}
|
||||
else if (istr_equalstr(type_name, ":user_defined"))
|
||||
{
|
||||
/* yes, :user_defined in GIL means a builtin action */
|
||||
obj_set_func_type(action, AB_FUNC_BUILTIN);
|
||||
}
|
||||
else if (istr_equalstr(type_name, "CallFunction"))
|
||||
{
|
||||
obj_set_func_type(action, AB_FUNC_USER_DEF);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (abil_print_load_err(ERR_WANT_KEYWORD), -1);
|
||||
}
|
||||
|
||||
istr_destroy(type_name);
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the arg_type of an action_holder
|
||||
*/
|
||||
static int
|
||||
get_arg_type(FILE * inFile, ABObj action)
|
||||
{
|
||||
int return_value = 0;
|
||||
ISTRING type_name = NULL;
|
||||
|
||||
obj_set_arg_type(action, AB_ARG_VOID_PTR);
|
||||
|
||||
if (!abio_get_list_begin(inFile))
|
||||
return (abil_print_load_err(ERR_WANT_LIST), -1);
|
||||
|
||||
if (abio_get_list_end(inFile))
|
||||
{
|
||||
return return_value;
|
||||
}
|
||||
|
||||
while (!abio_get_list_end(inFile))
|
||||
{
|
||||
if (!abio_gil_get_name(inFile, &type_name))
|
||||
return (abil_print_load_err(ERR_WANT_NAME), -1);
|
||||
|
||||
obj_set_arg_type(action,
|
||||
gilP_string_to_arg_type(istr_string(type_name)));
|
||||
}
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
add_user_handler(ABObj obj, ABObj module,
|
||||
ISTRING handler, AB_WHEN when)
|
||||
{
|
||||
int retval = 0;
|
||||
ABObj project = NULL;
|
||||
ABObj action = NULL;
|
||||
|
||||
if (handler == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
project = obj_get_project(module);
|
||||
|
||||
/*
|
||||
* With "callbacks," the to field is irrelevant. The target is generally
|
||||
* whatever widget calls the callback, so we set the "to" field to NULL,
|
||||
* so that this action may be used by multiple widgets. I.e., if the
|
||||
* function type, name and to fields match, an action will be shared.
|
||||
*/
|
||||
action = obj_create(AB_TYPE_ACTION, NULL);
|
||||
obj_set_func_type(action, AB_FUNC_USER_DEF);
|
||||
obj_set_func_name(action, istr_string(handler));
|
||||
obj_set_arg_type(action, AB_ARG_VOID_PTR);
|
||||
action->info.action.to = NULL;
|
||||
|
||||
obj_set_from(action, obj);
|
||||
obj_set_when(action, when);
|
||||
|
||||
install_action(obj, module, action);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
install_action(ABObj obj, ABObj module, ABObj action)
|
||||
{
|
||||
int return_value = 0;
|
||||
|
||||
/*
|
||||
* Cross-module connections sit under the project
|
||||
* intra-module connectoins sit under the module
|
||||
*/
|
||||
return_value = obj_add_action(module, action);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Finds the target matching the given description, creating it if necessary.
|
||||
*
|
||||
* Assumes: strings are pointers to allocated space. Sets strings to NULL, if
|
||||
* the values are used.
|
||||
*
|
||||
* Assumes that obj may not be in the object tree yet, and may return it as the
|
||||
* target.
|
||||
*/
|
||||
static ABObj
|
||||
find_or_create_target(
|
||||
ABObj obj,
|
||||
ABObj module,
|
||||
ISTRING interface_name,
|
||||
ISTRING parent_name,
|
||||
ISTRING obj_name,
|
||||
ISTRING item_label
|
||||
)
|
||||
{
|
||||
ABObj target = NULL; /* the real thing, baby! */
|
||||
ABObj target_project = NULL;
|
||||
char target_interface_file[MAXPATHLEN+1];
|
||||
char target_interface_name[GIL_MAX_NAME_SIZE];
|
||||
ABObj target_module = NULL;
|
||||
char target_parent_name[GIL_MAX_NAME_SIZE];
|
||||
ABObj target_parent = NULL;
|
||||
char target_obj_name[GIL_MAX_NAME_SIZE];
|
||||
ABObj target_obj = NULL;
|
||||
char target_item_label[GIL_MAX_NAME_SIZE];
|
||||
ABObj target_item = NULL;
|
||||
AB_TRAVERSAL trav;
|
||||
*target_interface_file = 0;
|
||||
*target_interface_name = 0;
|
||||
*target_parent_name = 0;
|
||||
*target_obj_name = 0;
|
||||
*target_item_label = 0;
|
||||
|
||||
/* must have object name */
|
||||
if (debugging())
|
||||
{
|
||||
assert( (obj_name != NULL)
|
||||
&& (obj_is_project(module) || obj_is_module(module)));
|
||||
}
|
||||
|
||||
if (obj_is_project(module))
|
||||
{
|
||||
/* The first string must be an interface file name */
|
||||
if (interface_name != NULL)
|
||||
{
|
||||
util_strncpy(target_interface_file, istr_string(interface_name),
|
||||
GIL_MAX_NAME_SIZE);
|
||||
if (parent_name != NULL)
|
||||
{
|
||||
util_strncpy(target_parent_name, istr_string(parent_name),
|
||||
GIL_MAX_NAME_SIZE);
|
||||
}
|
||||
}
|
||||
else if (parent_name != NULL)
|
||||
{
|
||||
util_strncpy(target_interface_file, istr_string(parent_name),
|
||||
GIL_MAX_NAME_SIZE);
|
||||
}
|
||||
else
|
||||
{
|
||||
abil_print_load_err(ERR_WANT_FULL_NAME);
|
||||
goto epilogue;
|
||||
}
|
||||
|
||||
/* derive the name from the file name */
|
||||
strcpy(target_interface_name, target_interface_file);
|
||||
{
|
||||
int len = strlen(target_interface_name);
|
||||
if ( (len >= 2)
|
||||
&& ( util_streq(&(target_interface_name[len-2]), ".G")
|
||||
|| util_streq(&(target_interface_name[len-2]), ".P")))
|
||||
{
|
||||
target_interface_name[len-2] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
util_strncpy(target_obj_name, istr_string(obj_name),
|
||||
GIL_MAX_NAME_SIZE);
|
||||
if (item_label != NULL)
|
||||
{
|
||||
util_strncpy(target_item_label, istr_string(item_label),
|
||||
GIL_MAX_NAME_SIZE);
|
||||
}
|
||||
}
|
||||
else /* ! obj_is_project() */
|
||||
{
|
||||
if (parent_name != NULL)
|
||||
{
|
||||
/* we have parent name and object name */
|
||||
util_strncpy(target_parent_name, istr_string(parent_name),
|
||||
GIL_MAX_NAME_SIZE);
|
||||
}
|
||||
|
||||
util_strncpy(target_obj_name, istr_string(obj_name),
|
||||
GIL_MAX_NAME_SIZE);
|
||||
if (item_label != NULL)
|
||||
{
|
||||
/* we have object name and item_label */
|
||||
util_strncpy(target_item_label, istr_string(item_label),
|
||||
GIL_MAX_NAME_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We've got the name broken down into the appropriate pieces.
|
||||
* Now find the actual target.
|
||||
*/
|
||||
/*util_dprintf(3, "finding: module:'%s' parent:'%s' obj:'%s' item:'%s'\n",
|
||||
target_interface_name, target_parent_name,
|
||||
target_obj_name, target_item_label);*/
|
||||
|
||||
|
||||
/*
|
||||
* Find target project
|
||||
*/
|
||||
target_project = obj_get_project(module);
|
||||
|
||||
/*
|
||||
* Find target module
|
||||
*/
|
||||
if (util_strempty(target_interface_name))
|
||||
{
|
||||
target_module = module;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* find specified intefarce (module) */
|
||||
for (trav_open(&trav, target_project, AB_TRAV_MODULES);
|
||||
(target_module = trav_next(&trav)) != NULL; )
|
||||
{
|
||||
if ( (target_module != target_project)
|
||||
&& (util_streq(
|
||||
obj_get_file(target_module), target_interface_file)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
trav_close(&trav);
|
||||
if (target_module == NULL)
|
||||
{
|
||||
target_module = obj_create(AB_TYPE_MODULE, target_project);
|
||||
obj_set_is_defined(target_module, FALSE);
|
||||
obj_set_file(target_module, target_interface_file);
|
||||
obj_set_name(target_module, target_interface_name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Find target parent
|
||||
*/
|
||||
if (util_strempty(target_parent_name))
|
||||
{
|
||||
target_parent = target_module;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (trav_open(&trav, target_module,
|
||||
AB_TRAV_ALL | AB_TRAV_MOD_PARENTS_FIRST);
|
||||
(target_parent = trav_next(&trav)) != NULL; )
|
||||
{
|
||||
if ( (target_parent != target_module)
|
||||
&& (util_streq(
|
||||
obj_get_name(target_parent), target_parent_name)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
trav_close(&trav);
|
||||
if (target_parent == NULL)
|
||||
{
|
||||
target_parent = obj_create(AB_TYPE_UNDEF, target_module);
|
||||
obj_set_is_defined(target_parent, FALSE);
|
||||
obj_set_file(target_parent, target_interface_file);
|
||||
obj_set_name(target_parent, target_parent_name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Find target obj
|
||||
*/
|
||||
for (trav_open(&trav, target_parent,
|
||||
AB_TRAV_ALL | AB_TRAV_MOD_PARENTS_FIRST);
|
||||
(target_obj = trav_next(&trav)) != NULL; )
|
||||
{
|
||||
if ( (target_obj != target_parent)
|
||||
&& util_streq(target_obj_name, obj_get_name(target_obj)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
trav_close(&trav);
|
||||
if (target_obj == NULL)
|
||||
{
|
||||
target_obj = obj_create(AB_TYPE_UNDEF, target_parent);
|
||||
obj_set_is_defined(target_obj, FALSE);
|
||||
obj_set_file(target_obj, target_interface_file);
|
||||
obj_set_name(target_obj, target_obj_name);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find item
|
||||
*/
|
||||
if (util_strempty(target_item_label))
|
||||
{
|
||||
target_item = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (trav_open(&trav, target_obj, AB_TRAV_ITEMS);
|
||||
(target_item = trav_next(&trav)) != NULL; )
|
||||
{
|
||||
if ( (target_item != target_obj)
|
||||
&& util_streq(obj_get_label(target_item), target_item_label))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
trav_close(&trav);
|
||||
if (target_item == NULL)
|
||||
{
|
||||
target_item = obj_create(AB_TYPE_ITEM, target_obj);
|
||||
obj_set_is_defined(target_item, FALSE);
|
||||
obj_set_file(target_item, target_interface_file);
|
||||
obj_set_label(target_item, target_item_label);
|
||||
obj_set_name_from_label(target_item,
|
||||
obj_get_name(obj_get_parent(target_item)));
|
||||
}
|
||||
}
|
||||
|
||||
if (target_item != NULL)
|
||||
{
|
||||
target = target_item;
|
||||
}
|
||||
else
|
||||
{
|
||||
target = target_obj;
|
||||
}
|
||||
|
||||
epilogue:
|
||||
return target;
|
||||
}
|
||||
|
||||
2933
cde/programs/dtappbuilder/src/libABil/gil_loadatt.c
Normal file
2933
cde/programs/dtappbuilder/src/libABil/gil_loadatt.c
Normal file
File diff suppressed because it is too large
Load Diff
74
cde/programs/dtappbuilder/src/libABil/gil_loadattP.h
Normal file
74
cde/programs/dtappbuilder/src/libABil/gil_loadattP.h
Normal file
@@ -0,0 +1,74 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: gil_loadattP.h /main/3 1995/11/06 18:29:01 rswiston $
|
||||
*
|
||||
* @(#)gil_loadattP.h 1.9 20 Jan 1995 cde_app_builder/src/libABil
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* loadatt.h - load attribute (GIL) header file
|
||||
*/
|
||||
#ifndef _ABIL_LOADATT_H_
|
||||
#define _ABIL_LOADATT_H_
|
||||
|
||||
#include <ab_private/obj.h>
|
||||
#include "gilP.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
BOOL bools[AB_OBJ_MAX_CHILDREN];
|
||||
int count;
|
||||
} BOOL_ARRAY;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
AB_OBJECT_STATE states[AB_OBJ_MAX_CHILDREN];
|
||||
int count;
|
||||
} INITIAL_STATE_ARRAY;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ISTRING strings[AB_OBJ_MAX_CHILDREN];
|
||||
int count;
|
||||
} ISTRING_ARRAY;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
AB_LABEL_TYPE label_types[AB_OBJ_MAX_CHILDREN];
|
||||
int count;
|
||||
} LABEL_TYPE_ARRAY;
|
||||
|
||||
int istr_array_init(ISTRING_ARRAY *array);
|
||||
int istr_array_uninit(ISTRING_ARRAY *array);
|
||||
|
||||
int gilP_load_attribute_value(FILE *inFile,
|
||||
ABObj obj, AB_GIL_ATTRIBUTE attr, ABObj root);
|
||||
int gilP_load_bools(FILE *inFile, BOOL_ARRAY *bools);
|
||||
int gilP_load_label_types(FILE *inFile,
|
||||
LABEL_TYPE_ARRAY *label_types);
|
||||
int gilP_load_initial_states(FILE *inFile,
|
||||
INITIAL_STATE_ARRAY *states);
|
||||
int gilP_load_string(FILE *inFile, ISTRING *string);
|
||||
int gilP_load_strings(FILE *inFile, ISTRING_ARRAY *strings);
|
||||
int gilP_load_name(FILE *inFile, ISTRING *name);
|
||||
int gilP_load_names(FILE *inFile, ISTRING_ARRAY *names);
|
||||
int gilP_load_handler(FILE *inFile, ISTRING *handler);
|
||||
int gilP_load_handlers(FILE *inFile, ISTRING_ARRAY *handlers);
|
||||
int gilP_load_file_names(FILE *inFile, ISTRING_ARRAY *names);
|
||||
int gilP_load_file_name(FILE *inFile, ISTRING *name);
|
||||
|
||||
#endif /* _ABIL_LOADATT_H_ */
|
||||
|
||||
294
cde/programs/dtappbuilder/src/libABil/gil_loadfile.c
Normal file
294
cde/programs/dtappbuilder/src/libABil/gil_loadfile.c
Normal file
@@ -0,0 +1,294 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: gil_loadfile.c /main/3 1995/11/06 18:29:14 rswiston $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Routines to load in GUIDE intermediate language (GIL) files.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ab_private/util.h>
|
||||
#include <ab_private/abio.h>
|
||||
#include <ab_private/trav.h>
|
||||
#include <ab_private/gil.h>
|
||||
#include "loadP.h"
|
||||
#include "load.h"
|
||||
#include "../libABobj/obj_utils.h"
|
||||
#include "gilP.h"
|
||||
|
||||
/*
|
||||
* Read a GIL file into memory.
|
||||
*/
|
||||
ABObj
|
||||
gil_load_file(
|
||||
STRING gil_file,
|
||||
FILE * inFile,
|
||||
ABObj project
|
||||
)
|
||||
{
|
||||
int return_value = 0;
|
||||
int rc = 0; /* r turn code */
|
||||
STRING errmsg = NULL;
|
||||
ABObj obj = NULL;
|
||||
ABObj interface = NULL;
|
||||
AB_FILE_TYPE file_type = AB_FILE_UNDEF;
|
||||
FILE *gilInFile = NULL;
|
||||
|
||||
/* printf("gil_load_file(%s)\n", gil_file); */
|
||||
|
||||
if (gil_file == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
abil_loadmsg_clear();
|
||||
abil_loadmsg_set_line_number_callback(NULL); /*don't report line#*/
|
||||
abil_loadmsg_set_file(gil_file);
|
||||
|
||||
/*
|
||||
* Create the root node for this beastie.
|
||||
*/
|
||||
interface = obj_scoped_find_or_create_undef(project,
|
||||
ab_ident_from_file_name(gil_file), AB_TYPE_MODULE);
|
||||
if (interface == NULL)
|
||||
{
|
||||
abil_print_load_err(ERR_NO_MEMORY);
|
||||
goto epilogue;
|
||||
}
|
||||
|
||||
obj_set_file(interface, gil_file);
|
||||
obj_set_is_defined(interface, TRUE);
|
||||
|
||||
/*
|
||||
* Open the input file.
|
||||
*/
|
||||
if (inFile != NULL)
|
||||
{
|
||||
gilInFile = inFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((errmsg = abio_open_gil_input(gil_file, &gilInFile)) != NULL)
|
||||
{
|
||||
util_error(errmsg);
|
||||
return_value = -1;
|
||||
goto epilogue;
|
||||
}
|
||||
if (!util_be_silent())
|
||||
fprintf(stderr, "%s: reading %s\n",
|
||||
util_get_program_name(), gil_file);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find start of first object (should be interface)
|
||||
*/
|
||||
if (abio_get_eof(gilInFile))
|
||||
{
|
||||
abil_print_load_err(ERR_EOF);
|
||||
return_value = -1;
|
||||
goto epilogue;
|
||||
}
|
||||
if (!abio_gil_get_object_begin(gilInFile))
|
||||
{
|
||||
abil_print_load_err(ERR_WANT_OBJECT);
|
||||
return_value = -1;
|
||||
goto epilogue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop reading the input file until there are no more objects.
|
||||
*/
|
||||
while (!abio_get_file_end(gilInFile))
|
||||
{
|
||||
if (abio_get_eof(gilInFile))
|
||||
{
|
||||
abil_print_load_err(ERR_EOF);
|
||||
goto epilogue;
|
||||
}
|
||||
|
||||
if (!abio_gil_get_object_begin(gilInFile))
|
||||
{
|
||||
abil_print_load_err(ERR_WANT_OBJECT);
|
||||
goto epilogue;
|
||||
}
|
||||
|
||||
if ((rc = gilP_load_object(gilInFile, interface)) < 0)
|
||||
{
|
||||
return_value = rc;
|
||||
goto epilogue;
|
||||
}
|
||||
}
|
||||
|
||||
if (inFile == NULL) /* don't close passed-in stream */
|
||||
{
|
||||
abio_close_input(gilInFile);
|
||||
}
|
||||
|
||||
epilogue:
|
||||
if (return_value < 0)
|
||||
{
|
||||
if (interface != NULL)
|
||||
{
|
||||
obj_destroy(interface);
|
||||
interface = NULL;
|
||||
}
|
||||
}
|
||||
if (interface != NULL)
|
||||
{
|
||||
obj_set_is_defined(interface, TRUE);
|
||||
}
|
||||
return interface;
|
||||
} /* gil_load_file */
|
||||
|
||||
|
||||
/*
|
||||
* Loads in a GIL project file - DOES NOT LOAD IN THE INTERFACES IN
|
||||
* THE PROJECT FILE.
|
||||
*/
|
||||
int
|
||||
gil_load_project_file(
|
||||
STRING project_file,
|
||||
FILE * inFile,
|
||||
ABObj *projectOutPtr
|
||||
)
|
||||
{
|
||||
int return_value = 0;
|
||||
int rc = 0; /* r turn code */
|
||||
STRING errmsg = NULL;
|
||||
ABObj project = obj_create(AB_TYPE_PROJECT, NULL);
|
||||
FILE *gilInFile = NULL;
|
||||
|
||||
util_dprintf(1,
|
||||
"gil_load_project_file(%s)\n", util_strsafe(project_file));
|
||||
|
||||
abil_loadmsg_clear();
|
||||
abil_loadmsg_set_line_number_callback(NULL); /*don't report line#*/
|
||||
abil_loadmsg_set_file(project_file);
|
||||
|
||||
if (project == NULL)
|
||||
{
|
||||
abil_print_load_err(ERR_NO_MEMORY);
|
||||
goto epilogue;
|
||||
}
|
||||
|
||||
project->info.project.is_default = FALSE; /* spec'd by user */
|
||||
obj_set_file(project, strdup(project_file));
|
||||
obj_set_name(project, ab_ident_from_file_name(project_file));
|
||||
|
||||
/*
|
||||
* Some bonehead decided that a project file should consist of only one
|
||||
* object and not have the surrounding parens like a GIL file. So, we
|
||||
* can't use load_interface.
|
||||
*/
|
||||
if (inFile != NULL)
|
||||
{
|
||||
gilInFile = inFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((errmsg = abio_open_gil_input(project_file, &gilInFile)) != NULL)
|
||||
{
|
||||
util_error(errmsg);
|
||||
return_value = -1;
|
||||
goto epilogue;
|
||||
}
|
||||
if (!util_be_silent())
|
||||
{
|
||||
fprintf(stderr, "%s: reading %s\n",
|
||||
util_get_program_name(), project_file);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Find start of project object
|
||||
*/
|
||||
if (abio_get_eof(gilInFile))
|
||||
{
|
||||
abil_print_load_err(ERR_EOF);
|
||||
return_value = -1;
|
||||
goto epilogue;
|
||||
}
|
||||
if (!abio_gil_get_object_begin(gilInFile))
|
||||
{
|
||||
abil_print_load_err(ERR_WANT_OBJECT);
|
||||
return_value = -1;
|
||||
goto epilogue;
|
||||
}
|
||||
|
||||
/*
|
||||
* The project is it's own parent...
|
||||
*/
|
||||
if ((rc = gilP_load_object2(gilInFile, project, project)) < 0)
|
||||
{
|
||||
return_value = rc;
|
||||
goto epilogue;
|
||||
}
|
||||
if (inFile == NULL)
|
||||
{
|
||||
abio_close_input(gilInFile);
|
||||
}
|
||||
|
||||
epilogue:
|
||||
if (return_value < 0)
|
||||
{
|
||||
obj_destroy(project);
|
||||
project = NULL;
|
||||
}
|
||||
|
||||
*projectOutPtr = project;
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
gil_load_project_file_and_resolve_all(
|
||||
STRING project_file,
|
||||
FILE * inFile,
|
||||
ABObj *projectOutPtr
|
||||
)
|
||||
{
|
||||
int return_value = 0;
|
||||
int rc = 0;
|
||||
ABObj project = NULL;
|
||||
int i = 0;
|
||||
ABObj interface = NULL;
|
||||
AB_TRAVERSAL trav;
|
||||
|
||||
if ((rc = gil_load_project_file(project_file, inFile, &project)) < 0)
|
||||
{
|
||||
return_value = rc;
|
||||
goto epilogue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Load in the interfaces referenced in the project file
|
||||
*/
|
||||
for (trav_open(&trav, project, AB_TRAV_MODULES | AB_TRAV_MOD_SAFE);
|
||||
(interface = trav_next(&trav)) != NULL; )
|
||||
{
|
||||
if (!obj_is_defined(interface))
|
||||
{
|
||||
if (gil_load_file(obj_get_file(interface), NULL, project) == NULL)
|
||||
{
|
||||
return_value = -1;
|
||||
goto epilogue;
|
||||
}
|
||||
}
|
||||
}
|
||||
trav_close(&trav);
|
||||
|
||||
epilogue:
|
||||
if (return_value < 0)
|
||||
{
|
||||
obj_destroy(project);
|
||||
}
|
||||
(*projectOutPtr) = project;
|
||||
return return_value;
|
||||
}
|
||||
|
||||
107
cde/programs/dtappbuilder/src/libABil/gil_loadobj.c
Normal file
107
cde/programs/dtappbuilder/src/libABil/gil_loadobj.c
Normal file
@@ -0,0 +1,107 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: gil_loadobj.c /main/3 1995/11/06 18:29:29 rswiston $
|
||||
*/
|
||||
|
||||
#include <ab_private/util.h>
|
||||
#include <ab_private/abio.h>
|
||||
#include "gilP.h"
|
||||
#include "gil_loadattP.h"
|
||||
#include "load.h"
|
||||
#include "loadP.h"
|
||||
|
||||
|
||||
/*
|
||||
* Loads one gil object into a parent. The object is created by this
|
||||
* routine.
|
||||
*/
|
||||
int
|
||||
gilP_load_object(FILE * inFile, ABObj parent)
|
||||
{
|
||||
ABObj obj = obj_create(AB_TYPE_UNDEF, parent);
|
||||
abil_loadmsg_set_object(NULL);
|
||||
abil_loadmsg_set_att(NULL);
|
||||
abil_loadmsg_set_action_att(NULL);
|
||||
if (obj == NULL)
|
||||
{
|
||||
abil_print_load_err(ERR_NO_MEMORY);
|
||||
}
|
||||
return gilP_load_object2(inFile, obj, parent);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Loads one gil object, using the object passed in to start with. This way,
|
||||
* arbitrary attributes may be set on an object before the load process
|
||||
* begins.
|
||||
*
|
||||
* This is necessary because some incredible bonehead neglegted to put :type and
|
||||
* :name keys into the parent object. Since the normal load won't set the
|
||||
* type properly, we have to do it up front.
|
||||
*/
|
||||
int
|
||||
gilP_load_object2(FILE * inFile, ABObj obj, ABObj parent)
|
||||
{
|
||||
int return_value = 0;
|
||||
int rc = 0; /* r turn code */
|
||||
AB_GIL_ATTRIBUTE attr;
|
||||
ISTRING keyword;
|
||||
BOOL object_read = FALSE;
|
||||
|
||||
while (!object_read)
|
||||
{
|
||||
if (abio_get_eof(inFile))
|
||||
{
|
||||
abil_print_load_err(ERR_EOF);
|
||||
goto epilogue;
|
||||
}
|
||||
if (abio_gil_get_object_end(inFile))
|
||||
{
|
||||
/*** The whole object has been read! ***/
|
||||
object_read = TRUE;
|
||||
if (obj->type == AB_TYPE_LAYERS)
|
||||
{
|
||||
if (obj_get_num_children(obj) == 0)
|
||||
{
|
||||
obj_destroy(obj);
|
||||
obj = NULL;
|
||||
goto epilogue;
|
||||
}
|
||||
}
|
||||
if (obj != NULL)
|
||||
{
|
||||
|
||||
/*
|
||||
* The root node may have itself as it's parent
|
||||
*/
|
||||
if ((!obj_has_parent(obj))
|
||||
&& (obj != parent))
|
||||
{
|
||||
obj_append_child(parent, obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*** More attributes to go... ***/
|
||||
abil_loadmsg_set_err_printed(FALSE);
|
||||
if (!abio_get_keyword(inFile, &keyword))
|
||||
{
|
||||
abil_print_load_err(ERR_WANT_KEYWORD);
|
||||
goto epilogue;
|
||||
}
|
||||
abil_loadmsg_set_att(istr_string(keyword));
|
||||
|
||||
attr = gilP_string_to_att(istr_string(keyword));
|
||||
if ((rc = gilP_load_attribute_value(
|
||||
inFile, obj, attr, parent)) != NULL)
|
||||
{
|
||||
return_value = rc;
|
||||
goto epilogue;
|
||||
}
|
||||
}
|
||||
} /* while TRUE */
|
||||
|
||||
epilogue:
|
||||
return return_value;
|
||||
}
|
||||
58
cde/programs/dtappbuilder/src/libABil/libABil.msg
Normal file
58
cde/programs/dtappbuilder/src/libABil/libABil.msg
Normal file
@@ -0,0 +1,58 @@
|
||||
$ $XConsortium: libABil.msg /main/3 1995/11/06 18:29:43 rswiston $
|
||||
$ ========================================================================
|
||||
$ = Message source text file for App Builder's libABil BIL I/O library.
|
||||
$ = @(#)libABil.msg 1.4 15 Aug 1995 dtappbuilder/src/libABil
|
||||
$ ========================================================================
|
||||
|
||||
$quote "
|
||||
|
||||
$ The set number set below must be syncronized with the #define in bilP.h
|
||||
$set 204
|
||||
1 "cannot find anchor object\n"
|
||||
2 "no such attribute for this object\n"
|
||||
3 "not a valid C identifier\n"
|
||||
4 "unexpected end-of-file\n"
|
||||
5 "unknown file format\n"
|
||||
6 "currently not implemented\n"
|
||||
7 "currently not implemented - ignoring object and its attributes\n"
|
||||
8 "out of memory\n"
|
||||
9 "unknown value\n"
|
||||
10 "unknown attribute\n"
|
||||
11 "unknown menu type - defaulting to Command Menu\n"
|
||||
12 "cannot find object\n"
|
||||
13 "unknown object\n"
|
||||
14 "bad value - ignoring this 'Connection'\n"
|
||||
15 "cannot find function argument\n"
|
||||
16 "cannot find boolean\n"
|
||||
17 "incorrect name syntax\n"
|
||||
18 "cannot find integer\n"
|
||||
19 "cannot find keyword\n"
|
||||
20 "cannot find start of list\n"
|
||||
21 "cannot find menu for button\n"
|
||||
22 "cannot find start of name\n"
|
||||
23 "cannot find start of object\n"
|
||||
24 "cannot find string\n"
|
||||
25 "WARNING not a C identifier, ignored\n"
|
||||
26 "WARNING: empty group, skipping...\n"
|
||||
27 "file: %s"
|
||||
28 ", line: %d"
|
||||
29 ", object: %s"
|
||||
30 ", attribute: %s"
|
||||
31 ", action-attribute: %s"
|
||||
32 ", "
|
||||
33 "syntax error"
|
||||
34 "\n"
|
||||
35 "unknown keyword - %s"
|
||||
36 "Duplicate name. Changed to %s.\n\t(This may be a conflict with the interface or project name)\n"
|
||||
37 ", near '%s'"
|
||||
38 "%s.\nUnable to load project.\n"
|
||||
39 "Unable to load project\n."
|
||||
40 "The following MODULES are read-only.\nIf you edit these modules, you\nwill not be able to save your edits."
|
||||
41 "packing is undefined\n"
|
||||
42 "menu type is undefined\n"
|
||||
43 "reference point is undefined\n"
|
||||
44 "No file name specified"
|
||||
45 "Cannot save project; Either nothing to store or NULL filename."
|
||||
46 "not a project file"
|
||||
47 "not a module file"
|
||||
48 "only 1 drag-type allowed - discarding additional drag-type"
|
||||
321
cde/programs/dtappbuilder/src/libABil/load.c
Normal file
321
cde/programs/dtappbuilder/src/libABil/load.c
Normal file
@@ -0,0 +1,321 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: load.c /main/3 1995/11/06 18:29:57 rswiston $
|
||||
*
|
||||
* @(#)load.c 1.18 03 Apr 1995 cde_app_builder/src/libABil
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* load.c - load c file.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "loadP.h"
|
||||
#include "bilP.h"
|
||||
|
||||
#define MAX_NAME_LEN 256
|
||||
|
||||
static char Current_Object[MAX_NAME_LEN]= "";
|
||||
static char Attribute[MAX_NAME_LEN]= "";
|
||||
static char Action_Attr[MAX_NAME_LEN]= "";
|
||||
static char File[MAX_NAME_LEN]= "";
|
||||
static AbilErrorMessage Errormsg[BIL_ERRMSG_COUNT];
|
||||
static AbilGetLineNumberCallback getLineNumberCB = NULL;
|
||||
|
||||
int abilP_err_line_number = -1;
|
||||
|
||||
static int abil_load_errmsg_table();
|
||||
|
||||
/*
|
||||
* Build a status message including the current object, the current
|
||||
* attribute, and the specified message.
|
||||
*
|
||||
* The userMessage argument passed is is an index into the internal
|
||||
* error message table.
|
||||
*/
|
||||
STRING
|
||||
abil_loadmsg(STRING userMessage)
|
||||
{
|
||||
static char msg[256];
|
||||
char tmpMsg[256];
|
||||
int lineNumber = abil_loadmsg_get_line_number();
|
||||
*msg= 0;
|
||||
*tmpMsg= 0;
|
||||
|
||||
if (*File != 0)
|
||||
{
|
||||
sprintf(tmpMsg,
|
||||
catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET, 27, "file: %s"),
|
||||
File);
|
||||
strcat(msg, tmpMsg);
|
||||
}
|
||||
if (lineNumber > 0)
|
||||
{
|
||||
sprintf(tmpMsg,
|
||||
catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET, 28, ", line: %d"),
|
||||
lineNumber);
|
||||
strcat(msg, tmpMsg);
|
||||
}
|
||||
if (*Current_Object != 0)
|
||||
{
|
||||
sprintf(tmpMsg,
|
||||
catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET,29, ", object: %s"),
|
||||
Current_Object);
|
||||
strcat(msg, tmpMsg);
|
||||
}
|
||||
if (*Attribute != 0)
|
||||
{
|
||||
sprintf(tmpMsg,
|
||||
catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET, 30,
|
||||
", attribute: %s"),
|
||||
Attribute);
|
||||
strcat(msg, tmpMsg);
|
||||
}
|
||||
if (*Action_Attr != 0)
|
||||
{
|
||||
sprintf(tmpMsg,
|
||||
catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET, 31,
|
||||
", action-attribute: %s"),
|
||||
Action_Attr);
|
||||
strcat(msg, tmpMsg);
|
||||
}
|
||||
|
||||
strcat(msg, catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET, 32, ", "));
|
||||
if ( (userMessage == 0) || (*userMessage == 0) )
|
||||
{
|
||||
strcat(msg, catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET, 33,
|
||||
"syntax error"));
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat(msg, userMessage);
|
||||
}
|
||||
strcat(msg, catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET, 34, "\n"));
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
static int
|
||||
move_string(STRING to, STRING from)
|
||||
{
|
||||
if (from == NULL)
|
||||
{
|
||||
*to= 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(to, from);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
abil_loadmsg_clear(void)
|
||||
{
|
||||
move_string(Current_Object, NULL);
|
||||
move_string(Attribute, NULL);
|
||||
move_string(Action_Attr, NULL);
|
||||
move_string(File, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
abil_loadmsg_set_object(STRING objname)
|
||||
{
|
||||
return move_string(Current_Object, objname);
|
||||
}
|
||||
|
||||
int
|
||||
abil_loadmsg_set_att(STRING attname)
|
||||
{
|
||||
return move_string(Attribute, attname);
|
||||
}
|
||||
|
||||
int
|
||||
abil_loadmsg_set_action_att(STRING actattname)
|
||||
{
|
||||
return move_string(Action_Attr, actattname);
|
||||
}
|
||||
|
||||
int
|
||||
abil_loadmsg_set_file(STRING filename)
|
||||
{
|
||||
return move_string(File, filename);
|
||||
}
|
||||
|
||||
BOOL
|
||||
abil_loadmsg_err_printed(void)
|
||||
{
|
||||
int cur_err_line = bilP_load_get_line_number();
|
||||
|
||||
if ((abilP_err_line_number == cur_err_line) ||
|
||||
(cur_err_line == -1))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
abil_loadmsg_set_err_printed(BOOL printed)
|
||||
{
|
||||
/* If the yacc error has been printed out, then
|
||||
* set the global error line number to the current
|
||||
* line number in the bil file, else reset it.
|
||||
*/
|
||||
if (printed)
|
||||
abilP_err_line_number = bilP_load_get_line_number();
|
||||
else
|
||||
abilP_err_line_number = -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** This routine prints one of the standard BIL load error messages by
|
||||
** looking it up in the error message table, fetching the right string
|
||||
** from the message catalog, and passing it to abil_loadmsg() to be output.
|
||||
**
|
||||
** All the I18N has to happen here (before abil_loadmsg() is called)...
|
||||
*/
|
||||
int
|
||||
abil_print_load_err(int errmsg)
|
||||
{
|
||||
static BOOL errmsg_tbl_init = FALSE;
|
||||
char msg[1024];
|
||||
int msgLen = 0;
|
||||
*msg = 0;
|
||||
|
||||
*msg = 0;
|
||||
/*
|
||||
** Load up the error message table if this is the first time we've
|
||||
** needed to output an error message.
|
||||
*/
|
||||
if(errmsg_tbl_init == FALSE) {
|
||||
abil_load_errmsg_table();
|
||||
errmsg_tbl_init = TRUE;
|
||||
}
|
||||
|
||||
if ((errmsg == ERR_NOT_IMPL) && (!util_be_verbose()))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!abil_loadmsg_err_printed())
|
||||
{
|
||||
if(Errormsg[errmsg].msg_id < 0) {
|
||||
strcat(msg, catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET, 33,
|
||||
"syntax error"));
|
||||
}
|
||||
else {
|
||||
strcat(msg,
|
||||
catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET,
|
||||
Errormsg[errmsg].msg_id,
|
||||
Errormsg[errmsg].def_str));
|
||||
}
|
||||
|
||||
if ((msgLen = strlen(msg)) > 0)
|
||||
{
|
||||
if (msg[msgLen-1] == '\n')
|
||||
{
|
||||
msg[msgLen-1] = 0;
|
||||
}
|
||||
}
|
||||
util_error(abil_loadmsg(msg));
|
||||
abil_loadmsg_set_err_printed(TRUE);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** This routine prints a custom error message rather than one of the standard
|
||||
** ones from the BIL error message table. It takes the message string as
|
||||
** an argument and then passes it off to abil_loadmsg() to be output.
|
||||
**
|
||||
** This routine assumes the custom error message has been I18Nized beforehand.
|
||||
*/
|
||||
int
|
||||
abil_print_custom_load_err(STRING errmsgstr)
|
||||
{
|
||||
if (!abil_loadmsg_err_printed())
|
||||
{
|
||||
util_error(abil_loadmsg(errmsgstr));
|
||||
abil_loadmsg_set_err_printed(TRUE);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Macro to make it easier to do error message table initialization */
|
||||
#define blet(i,m,s) \
|
||||
Errormsg[i].msg_id = m; \
|
||||
Errormsg[i].def_str = s
|
||||
|
||||
/* Load the BIL error message table with message set and default text */
|
||||
static int
|
||||
abil_load_errmsg_table()
|
||||
{
|
||||
int i;
|
||||
|
||||
/* "Clear" out the error message table by setting message id to -1 */
|
||||
for(i=0;i<BIL_ERRMSG_COUNT;i++) Errormsg[i].msg_id = -1;
|
||||
|
||||
blet(ERR_BAD_ANCHOR , 1, "cannot find anchor object");
|
||||
blet(ERR_BAD_ATT_FOR_OBJ , 2, "no such attribute for this object");
|
||||
blet(ERR_BAD_IDENTIFIER , 3, "not a valid C identifier");
|
||||
blet(ERR_EOF , 4, "unexpected end-of-file");
|
||||
blet(ERR_FILE_FORMAT , 5, "unknown file format");
|
||||
blet(ERR_NOT_IMPL , 6, "currently not implemented");
|
||||
blet(ERR_NOT_IMPL_IGNOR , 7, "currently not implemented - ignoring object and its attributes");
|
||||
blet(ERR_NO_MEMORY , 8, "out of memory");
|
||||
blet(ERR_UNKNOWN , 9, "unknown value");
|
||||
blet(ERR_UNKNOWN_ATTR ,10, "unknown attribute");
|
||||
blet(ERR_UNKNOWN_MENU_TYPE ,11, "unknown menu type - defaulting to Command Menu");
|
||||
blet(ERR_UNKNOWN_OBJ ,12, "cannot find object");
|
||||
blet(ERR_UNKNOWN_OBJECT ,13, "unknown object");
|
||||
blet(ERR_UNKNOWN_WHEN ,14, "bad value - ignoring this 'Connection'");
|
||||
blet(ERR_WANT_ARG ,15, "cannot find function argument");
|
||||
blet(ERR_WANT_BOOLEAN ,16, "cannot find boolean");
|
||||
blet(ERR_WANT_FULL_NAME ,17, "incorrect name syntax");
|
||||
blet(ERR_WANT_INTEGER ,18, "cannot find integer");
|
||||
blet(ERR_WANT_KEYWORD ,19, "cannot find keyword");
|
||||
blet(ERR_WANT_LIST ,20, "cannot find start of list");
|
||||
blet(ERR_WANT_MENU_NAME ,21, "cannot find menu for button");
|
||||
blet(ERR_WANT_NAME ,22, "cannot find start of name");
|
||||
blet(ERR_WANT_OBJECT ,23, "cannot find start of object");
|
||||
blet(ERR_WANT_STRING ,24, "cannot find string");
|
||||
blet(WARN_BAD_HANDLER ,25, "WARNING not a C identifier, ignored");
|
||||
blet(WARN_NO_MEMBERS ,26, "WARNING: empty group, skipping...");
|
||||
blet(ERR_NOT_PROJECT ,46, "not a project file");
|
||||
blet(ERR_NOT_MODULE ,47, "not a module file");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
abil_loadmsg_get_line_number(void)
|
||||
{
|
||||
return ((getLineNumberCB == NULL)? -1:getLineNumberCB());
|
||||
}
|
||||
|
||||
int
|
||||
abil_loadmsg_set_line_number_callback(AbilGetLineNumberCallback cb)
|
||||
{
|
||||
getLineNumberCB = cb;
|
||||
return 0;
|
||||
}
|
||||
|
||||
44
cde/programs/dtappbuilder/src/libABil/load.h
Normal file
44
cde/programs/dtappbuilder/src/libABil/load.h
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: load.h /main/3 1995/11/06 18:30:12 rswiston $
|
||||
*
|
||||
* @(#)load.h 1.13 09 Sep 1994 cde_app_builder/src/libABil
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* load.h - public functions to load a file.
|
||||
*/
|
||||
#ifndef _ABIL_BIL_LOADFILE_H_
|
||||
#define _ABIL_BIL_LOADFILE_H_
|
||||
|
||||
#include <ab_private/istr.h>
|
||||
|
||||
/*
|
||||
* Functions
|
||||
*/
|
||||
extern STRING abil_loadmsg(STRING); /* output error message */
|
||||
extern int abil_loadmsg_clear(void);
|
||||
extern int abil_loadmsg_set_object(STRING objname);
|
||||
extern int abil_loadmsg_set_att(STRING attname);
|
||||
extern int abil_loadmsg_set_action_att(STRING actattname);
|
||||
extern int abil_loadmsg_set_file(STRING bilfile);
|
||||
extern int abil_print_load_err(int error_num);
|
||||
extern int abil_print_custom_load_err(STRING error_msg);
|
||||
extern int abil_loadmsg_set_err_printed(BOOL);
|
||||
extern BOOL abil_loadmsg_err_printed(void);
|
||||
|
||||
#endif /* _ABIL_BIL_LOADFILE_H_ */
|
||||
|
||||
102
cde/programs/dtappbuilder/src/libABil/loadP.h
Normal file
102
cde/programs/dtappbuilder/src/libABil/loadP.h
Normal file
@@ -0,0 +1,102 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: loadP.h /main/3 1995/11/06 18:30:26 rswiston $
|
||||
*
|
||||
* @(#)loadP.h 1.8 03 Apr 1995 cde_app_builder/src/libABil
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* loadP.h - private load utilities
|
||||
*/
|
||||
#ifndef _ABIL_BIL_LOADP_H_
|
||||
#define _ABIL_BIL_LOADP_H_
|
||||
|
||||
#include <ab_private/istr.h>
|
||||
|
||||
/*
|
||||
* Undef a few standard error codes (yes, this is a hack and should be fixed)
|
||||
*/
|
||||
#undef ERR_EOF
|
||||
#undef ERR_NO_MEMORY
|
||||
|
||||
/*
|
||||
* Error messages.
|
||||
*/
|
||||
#define ERR_BAD_ANCHOR 1
|
||||
#define ERR_BAD_ATT_FOR_OBJ 2
|
||||
#define ERR_BAD_IDENTIFIER 3
|
||||
#define ERR_EOF 4
|
||||
#define ERR_FILE_FORMAT 5
|
||||
#define ERR_NOT_IMPL 6
|
||||
#define ERR_NOT_IMPL_IGNOR 7
|
||||
#define ERR_NO_MEMORY 8
|
||||
#define ERR_UNKNOWN 9
|
||||
#define ERR_UNKNOWN_ATTR 10
|
||||
#define ERR_UNKNOWN_MENU_TYPE 11
|
||||
#define ERR_UNKNOWN_OBJ 12
|
||||
#define ERR_UNKNOWN_OBJECT 13
|
||||
#define ERR_UNKNOWN_WHEN 14
|
||||
#define ERR_WANT_ARG 15
|
||||
#define ERR_WANT_BOOLEAN 16
|
||||
#define ERR_WANT_FULL_NAME 17
|
||||
#define ERR_WANT_INTEGER 18
|
||||
#define ERR_WANT_KEYWORD 19
|
||||
#define ERR_WANT_LIST 20
|
||||
#define ERR_WANT_MENU_NAME 21
|
||||
#define ERR_WANT_NAME 22
|
||||
#define ERR_WANT_OBJECT 23
|
||||
#define ERR_WANT_STRING 24
|
||||
#define ERR_NOT_PROJECT 27
|
||||
#define ERR_NOT_MODULE 28
|
||||
|
||||
/*
|
||||
* Warnings.
|
||||
*/
|
||||
#define WARN_BAD_HANDLER 25
|
||||
#define WARN_NO_MEMBERS 26
|
||||
|
||||
/* NOTE: BIL_ERRMSG_COUNT must be greater than last #define'd ERR/WARN token */
|
||||
#define BIL_ERRMSG_COUNT 30
|
||||
|
||||
/* Structure used to build BIL error message table */
|
||||
typedef struct _AbilErrorMessageRec {
|
||||
short msg_id; /* message ID in libABil's message set */
|
||||
char *def_str; /* default message text */
|
||||
} AbilErrorMessage;
|
||||
|
||||
typedef int (AbilGetLineNumberCallbackRec)(void);
|
||||
typedef AbilGetLineNumberCallbackRec *AbilGetLineNumberCallback;
|
||||
|
||||
/*
|
||||
* Functions
|
||||
*/
|
||||
STRING abil_loadmsg(STRING); /* output error message */
|
||||
int abil_loadmsg_clear(void);
|
||||
int abil_loadmsg_set_object(STRING objname);
|
||||
int abil_loadmsg_set_att(STRING attname);
|
||||
int abil_loadmsg_set_action_att(STRING actattname);
|
||||
int abil_loadmsg_set_file(STRING bilfile);
|
||||
int abil_loadmsg_set_line_number_callback(AbilGetLineNumberCallback cb);
|
||||
|
||||
int abil_loadmsg_get_line_number(void);
|
||||
|
||||
/*
|
||||
* Module-wide variables
|
||||
*/
|
||||
extern int abilP_err_line_number;
|
||||
|
||||
#endif /* _ABIL_BIL_LOADP_H_ */
|
||||
|
||||
74
cde/programs/dtappbuilder/src/libABil/template.c
Normal file
74
cde/programs/dtappbuilder/src/libABil/template.c
Normal file
@@ -0,0 +1,74 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: template.c /main/3 1995/11/06 18:30:40 rswiston $
|
||||
*
|
||||
* %W% %G% cde_app_builder/src/libABil
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* template .c file
|
||||
*
|
||||
*/
|
||||
#include "template.h"
|
||||
|
||||
#define FOO_DEFINES "here"
|
||||
|
||||
const char *foo_consts = "also here";
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Private Function Declarations **
|
||||
** **
|
||||
**************************************************************************/
|
||||
static int foo(
|
||||
int foo_int,
|
||||
char *foo_char,
|
||||
);
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Data **
|
||||
** **
|
||||
**************************************************************************/
|
||||
extern int extern_foo;
|
||||
|
||||
static int private_foo;
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
** **
|
||||
** Function Definitions **
|
||||
** **
|
||||
**************************************************************************/
|
||||
|
||||
int
|
||||
ab_foo(
|
||||
char *foo_char
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static int
|
||||
foo(
|
||||
int foo_int,
|
||||
char *foo_char
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
28
cde/programs/dtappbuilder/src/libABil/template.h
Normal file
28
cde/programs/dtappbuilder/src/libABil/template.h
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: template.h /main/3 1995/11/06 18:30:53 rswiston $
|
||||
*
|
||||
* %W% %G% cde_app_builder/src/libABil
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* template.h - template header file
|
||||
*/
|
||||
#ifndef _ABIL_TEMPLATE_H_
|
||||
#define _ABIL_TEMPLATE_H_
|
||||
|
||||
|
||||
#endif /* _ABIL_TEMPLATE_H_ */
|
||||
64
cde/programs/dtappbuilder/src/libABil/test_loaduil.c
Normal file
64
cde/programs/dtappbuilder/src/libABil/test_loaduil.c
Normal file
@@ -0,0 +1,64 @@
|
||||
|
||||
/*
|
||||
* $XConsortium: test_loaduil.c /main/3 1995/11/06 18:31:06 rswiston $
|
||||
*
|
||||
* %W% %G%
|
||||
*
|
||||
* RESTRICTED CONFIDENTIAL INFORMATION:
|
||||
*
|
||||
* The information in this document is subject to special
|
||||
* restrictions in a confidential disclosure agreement between
|
||||
* HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
|
||||
* document outside HP, IBM, Sun, USL, SCO, or Univel without
|
||||
* Sun's specific written approval. This document and all copies
|
||||
* and derivative works thereof must be returned or destroyed at
|
||||
* Sun's request.
|
||||
*
|
||||
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* This file contains the unit test program for the uil load
|
||||
* component
|
||||
*/
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ab_private/abuil_load.h>
|
||||
#include "abuil_print.h"
|
||||
|
||||
/*
|
||||
* Main program
|
||||
*/
|
||||
int
|
||||
main(
|
||||
int argc,
|
||||
char **argv
|
||||
)
|
||||
{
|
||||
ABObjPtr ab_project;
|
||||
ABObjPtr ab_interface;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
fprintf(stderr, "Usage: test_loaduil <uil_file>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ab_project = obj_create(AB_TYPE_PROJECT, NULL);
|
||||
if ((ab_interface = abuil_get_uil_file(argv[1], ab_project))
|
||||
== (ABObjPtr) NULL)
|
||||
{
|
||||
fprintf(stderr, "test_loaduil: loaduil %s failed.\n", argv[1]);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
/* util_set_verbosity(3); obj_print_tree(ab_project); */
|
||||
|
||||
abuil_obj_print_uil(ab_project);
|
||||
|
||||
obj_destroy(ab_project);
|
||||
}
|
||||
Reference in New Issue
Block a user