[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

2490.0. "SYS$LIBRARY log is redefined with XtInit" by CADSE::LOUREIRO (Dr. Spot) Wed Mar 21 1990 16:46

Hi,
    
    	Over at DECview3D land we have run into a problem with
    XtInitialize.  Apparently, when running from VMS V5.3 and DECwindows
    V2.0, the call to XtInitialize redefines the logical SYS$LIBRARY to
    be SYS$LIBRARY_en_US ?!?!?!?!  Is this a known problem.  It is breaking
    DECview3D.  If you look at the follow matrix, you'll see that it only
    occurs when both the client and server are running VMS V5.3:
    
    
    		Server 5.1    Server 5.3
    		------------+------------
    	Client  |SYS$LIBRARY|SYS$LIBRARY|
    	5.1     |  ok       |  ok       |
    		+-----------+-----------+
    	Client  |SYS$LIBRARY|SYS$LIBRARY|
    	5.3     |  ok       |  changed  |
    		-------------------------
    
    The following is the DECburger program with the only change being
    a call before and after XtInitialize to SHOW LOGICAL SYS$LIBRARY.
    You will see that in a V5.3 Environment, the second SHOW LOGICAL
    will return SYS$LIBRARY_en_US.
    
    Thanks for you assistance.
    							- Rob
    						DECview3D Team Member
    
    
/*
** COPYRIGHT (c) 1988, 1989 BY
** DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS.
** ALL RIGHTS RESERVED.
**
** THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
** ONLY  IN  ACCORDANCE  OF  THE  TERMS  OF  SUCH  LICENSE  AND WITH THE
** INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR  ANY  OTHER
** COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
** OTHER PERSON.  NO TITLE TO AND  OWNERSHIP OF THE  SOFTWARE IS  HEREBY
** TRANSFERRED.
**
** THE INFORMATION IN THIS SOFTWARE IS  SUBJECT TO CHANGE WITHOUT NOTICE
** AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
** CORPORATION.
**
** DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE  OR  RELIABILITY OF ITS
** SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
*/

/*
 * A sample program which uses UIL and DRM to create the interface.
 */

#include <stdio.h>                              /* For printf and so on. */

#ifdef VMS
#include <decw$include/DwtAppl.h>       /* DECwindows Toolkit */
#else
#include <X11/DwtAppl.h>                /* DECwindows Toolkit */
#endif

/*
 * These numbers are matched with corresponding numbers in the DECburger
 * UIL module.
 */

#define k_create_order           1
#define k_order_pdme             2
#define k_file_pdme              3
#define k_edit_pdme              4
#define k_nyi                    5
#define k_apply                  6
#define k_dismiss                7
#define k_noapply                8
#define k_cancel_order           9
#define k_submit_order           10
#define k_order_box              11
#define k_burger_min           12
#define k_burger_rare            12
#define k_burger_medium          13
#define k_burger_well            14
#define k_burger_ketchup         15
#define k_burger_mustard         16
#define k_burger_onion           17
#define k_burger_mayo            18
#define k_burger_pickle          19
#define k_burger_max           19
#define k_burger_quantity        20
#define k_fries_tiny             21
#define k_fries_small            22
#define k_fries_medium           23
#define k_fries_large            24
#define k_fries_huge             25
#define k_fries_quantity         26
#define k_drink_list             27
#define k_drink_add              28
#define k_drink_sub              29
#define k_drink_quantity         30
#define k_total_order            31
#define k_burger_label           32
#define k_fries_label            33
#define k_drink_label            34
#define k_menu_bar               35
#define k_file_menu              36
#define k_edit_menu              37
#define k_order_menu             38

#define k_max_widget             38

#define MAX_WIDGETS (k_max_widget + 1)

#define NUM_BOOLEAN (k_burger_max - k_burger_min + 1)

#define k_burger_index   0
#define k_fries_index    1
#define k_drinks_index   2
#define k_index_count    3

/*
 * Global data
 */

static Widget toplevel_widget,          /* Root widget ID of our */
                                        /* application. */
  main_window_widget,                   /* Root widget ID of main */
                                        /* DRM fetch */
  widget_array[MAX_WIDGETS];            /* Place to keep all other */
                                        /* widget IDs */

static char toggle_array[NUM_BOOLEAN];  /* Our TRUTH about the state */
                                        /* of user interface toggles. */

static DwtCompString current_drink,     /* Last selected drink name. */
  current_fries,                        /* Last selected fries size. */
  name_vector[k_index_count];           /* Miscellaneous names gotten from */
                                        /* various widgets. */

static int quantity_vector[k_index_count];      /* Current quantities of */
                                                /* burger, fries, drinks. */

static DwtCompString latin_create;      /* Variables for */
static DwtCompString latin_dismiss;     /* compound strings. */
static DwtCompString latin_space;
static DwtCompString latin_zero;
static DRMHierarchy s_DRMHierarchy;     /* DRM database hierarchy ID */
static DRMType *dummy_class;            /* and class variable. */
static char *db_filename_vec[] =        /* DRM heirachy file list. */
  {"decw$examples:decburger.uid"        /* There is only one UID file for */
  };                                    /* this application. */
static int db_filename_num =
                (sizeof db_filename_vec / sizeof db_filename_vec [0]);

/*
 * Forward declarations
 */

static void s_error();
static void get_something();
static void set_something();

static void activate_proc();
static void create_proc();
static void list_proc();
static void quit_proc();
static void pull_proc();
static void scale_proc();
static void show_hide_proc();
static void toggle_proc();

/* The names and addresses of things that DRM has to bind.  The names do
 * not have to be in alphabetical order.  */

static DRMRegisterArg reglist[] = {
    {"activate_proc", (caddr_t) activate_proc}, 
    {"create_proc", (caddr_t) create_proc}, 
    {"list_proc", (caddr_t) list_proc}, 
    {"pull_proc", (caddr_t) pull_proc}, 
    {"quit_proc", (caddr_t) quit_proc}, 
    {"scale_proc", (caddr_t) scale_proc}, 
    {"show_hide_proc", (caddr_t) show_hide_proc}, 
    {"toggle_proc", (caddr_t) toggle_proc}
};

static int reglist_num = (sizeof reglist / sizeof reglist [0]);

/*
 * OS transfer point.  The main routine does all the one-time setup and
 * then calls XtMainLoop.
 */

unsigned int main(argc, argv)
    unsigned int argc;                  /* Command line argument count. */
    char *argv[];                       /* Pointers to command line args. */
{
    DwtInitializeDRM();                 /* Initialize DRM before initializing
                                        /* the X Toolkit. */

    /* If we had user-defined widgets, we would register them with DRM here. */

    {
    char str1[80];
    char str2[80];
    int str1_len, str2_len=79, str2_len_ret;

    strcpy ( str1, "SYS$LIBRARY" );
    str1_len = strlen(str1);

    view$get_env_log( str1, str1_len, str2, str2_len, &str2_len_ret );
    
    str2[str2_len_ret] = '\0';

    printf("SYS$LIBRARY definition before XtInitialize: %s\n", str2);
    }

    /* Initialize the X Toolkit. We get back a top level shell widget. */

    toplevel_widget = XtInitialize("Welcome to DECburger", 
                                        /* Main window banner text. */
      "example",                        /* Root class name. */
      NULL,                             /* No option list. */
      0,                                /* Number of options. */
      &argc,                            /* Address of argc */
      argv);                            /* argv */


    {
    char str1[80];
    char str2[80];
    int str1_len, str2_len=79, str2_len_ret;

    strcpy ( str1, "SYS$LIBRARY" );
    str1_len = strlen(str1);

    view$get_env_log( str1, str1_len, str2, str2_len, &str2_len_ret );
    
    str2[str2_len_ret] = '\0';

    printf("SYS$LIBRARY definition after XtInitialize: %s\n", str2);
    }


    /* Open the UID files (the output of the UIL compiler) in the hierarchy*/

    if (DwtOpenHierarchy(db_filename_num, /* Number of files. */
      db_filename_vec,                    /* Array of file names.  */
      NULL,                               /* Default OS extenstion. */
      &s_DRMHierarchy)                    /* Pointer to returned DRM ID */
      !=DRMSuccess)
        s_error("can't open hierarchy");

    init_application();

    /* Register the items DRM needs to bind for us. */

    DwtRegisterDRMNames(reglist, reglist_num);

    /* Go get the main part of the application. */
    if (DwtFetchWidget(s_DRMHierarchy, "S_MAIN_WINDOW", toplevel_widget,
      &main_window_widget, &dummy_class) != DRMSuccess)
        s_error("can't fetch main window");

    /* Manage the main part and realize everything.  The interface comes up
     * on the display now. */

    XtManageChild(main_window_widget);
    XtRealizeWidget(toplevel_widget);

    /* Sit around forever waiting to process X-events.  We never leave
     * XtMainLoop. From here on, we only execute our callback routines. */
    XtMainLoop();
}




/*
 * One-time initialization of application data structures.
 */

static int init_application()
{
    int k;

    /* Initialize the application data structures. */
    for (k = 0; k < MAX_WIDGETS; k++)
        widget_array[k] = NULL;
    for (k = 0; k < NUM_BOOLEAN; k++)
        toggle_array[k] = FALSE;

    /*  Set the medium 'hamburger doneness' toggle button so that the 
     *  radio box has one toggle button ON at startup. */

    toggle_array[k_burger_medium - k_burger_min] = TRUE;

    /* Initialize current values of various items to match their initial values
     * in the DECburger UIL module. */
    current_drink = DwtLatin1String("Apple Juice");
    current_fries = DwtLatin1String("Medium");

    /* Set up the compound strings that we need. */
    latin_create = DwtLatin1String("Create order box...");
    latin_dismiss = DwtLatin1String("Dismiss order box...");
    latin_space = DwtLatin1String(" ");
    latin_zero = DwtLatin1String(" 0 ");
}

/***************************************************************************
 *
 * These are some little utilities used by the callback routines.
 */


/*
 * All errors are fatal.
 */

static void s_error(problem_string)
    char *problem_string;
{
    printf("%s\n", problem_string);
    exit(0);
}

/*
 * Simplified SET VALUE routine to use only when changing a single attribute.
 * If we need to change more than one, all new values should be put 
 * into one arglist and we should make one XtSetValues call (which is MUCH 
 * more efficient).
 */

static void set_something(w, resource, value)
    Widget w;
    char *resource, *value;
{
    Arg al[1];

    XtSetArg(al[0], resource, value);
    XtSetValues(w, al, 1);
}


/*
 * Simplified GET VALUE routine to use only when retrieving a single attribute.
 * If we need to retrieve more than one, all values should be put 
 * into one arglist and we should make one XtGetValues call (which is MUCH 
 * more efficient).
 */

static void get_something(w, resource, value)
    Widget w;
    char *resource, *value;
{
    Arg al[1];

    XtSetArg(al[0], resource, value);
    XtGetValues(w, al, 1);
}


/*
 * Keep our boolean array current with the user interface toggle buttons.
 */

static void set_boolean(i, state)
    int i;                              /* Widget ID index. */
    int state;
{
    toggle_array[i - k_burger_min] = state;

    DwtToggleButtonSetState(widget_array[i], 
                                        /* Which widget */
      state,                            /* state it should have. */
      FALSE);                           /* Do not call me back now. */
}



/*
 * Format and update the drink quantity widget.
 */

static void update_drink_display()
{
    char drink_txt[50];
    DwtCompString drink_cstring;

    sprintf(drink_txt, " %d ", quantity_vector[k_drinks_index]);
    drink_cstring = DwtLatin1String(drink_txt);
    set_something(widget_array[k_drink_quantity], DwtNlabel,
      drink_cstring);
    XtFree(drink_cstring);
}








/***************************************************************************
 *
 * This section contains callback routines.
 */



/*
 * Reset the user interface and the application to a known state.
 */

static void reset_values()
{
    int i;

    /*  Reset the toggle buttons and our boolean array. */
    for (i = k_burger_min; i <= k_burger_max; i++) {

        /* The radio box requires that one button be set; we choose medium. */

        set_boolean(i, (i == k_burger_medium));
    }

    /* Reset the burger quantity scale widget and global value. */
    set_something(widget_array[k_burger_quantity], DwtNvalue, 0);
    quantity_vector[k_burger_index] = 0;

    /* Reset the fries quantity text widget.  We do not have a global for this.
     * We read the widget whenever we need to know the quantity. */

    DwtSTextSetString(widget_array[k_fries_quantity], " 0 ");

    /* Reset the drinks quantity text widget and global value. */
    set_something(widget_array[k_drink_quantity], DwtNlabel, latin_zero);
    quantity_vector[k_drinks_index] = 0;
}




/*
 * Clear the order display area in the main window.
 */

static void clear_order()
{
    Arg arglist[5];
    int ac = 0;

    XtSetArg(arglist[ac], DwtNitemsCount, 0);
    ac++;
    XtSetArg(arglist[ac], DwtNitems, NULL);
    ac++;
    XtSetArg(arglist[ac], DwtNselectedItemsCount, 0);
    ac++;
    XtSetValues(widget_array[k_total_order], arglist, ac);
}





/*
 * All push buttons in this application call back to this routine.  We
 * use the tag to tell us what widget it is, then react accordingly.
 */

static void activate_proc(w, tag, reason)
    Widget w;
    int *tag;
    unsigned long *reason;
{
    int widget_num = *tag;              /* Convert tag to widget number. */
    int i, value, fries_num;
    char *txt, *fries_text, *list_txt, list_buffer[20];
    DwtCompString cstemp;

    switch (widget_num) {
        case k_nyi: 

            /* The user activated a 'not yet implemented' push button.  Send
             * the user a message. */
            if (widget_array[k_nyi] == NULL)
                                        /* The first time, fetch from */
              {                         /* the data base. */
                if (DwtFetchWidget(s_DRMHierarchy, "nyi", toplevel_widget,
                  &widget_array[k_nyi], &dummy_class) != DRMSuccess) {
                    s_error("can't fetch nyi widget");
                }
            }

            /*  Put up the message box saying 'not yet implemented'. */
            XtManageChild(widget_array[k_nyi]);                      
            break;

        case k_submit_order: 

            /*  This would send the order off to the kitchen. In this case,
             *  we just pretend the order was submitted. */
            clear_order();
            break;

        case k_cancel_order: 

            /*  Clear out the order display. */
            clear_order();
            break;

        case k_dismiss: 

            /*  Bring down the control box and reset the values to the default.
             */
            XtUnmanageChild(widget_array[k_order_box]);

        /* no break */

        case k_noapply: 
            reset_values();
            break;

        case k_apply: 

            /*  Take the current settings and write them into the list box.  */
            if (quantity_vector[k_burger_index] > 0) {

                /* Put burger quantity in the display string. */
                sprintf(list_buffer, "%d ", quantity_vector[k_burger_index]);
                list_txt = DwtLatin1String(list_buffer);

                /* Collect hambuger attributes that are ON. */
                for (i = k_burger_min; i <= k_burger_max; i++)
                    if (toggle_array[i - k_burger_min]) {

                        /*  Get the name of the qualifier from the widget and
                         *  add to the display string. */
                        get_something(widget_array[i], DwtNlabel, &txt);
			cstemp = list_txt;
                        list_txt = DwtCStrcat(list_txt, txt);
			XtFree(cstemp);
			XtFree(txt);
			cstemp = list_txt;
                        list_txt = DwtCStrcat(list_txt, latin_space);
			XtFree(cstemp);
                    }

                /* Add hamburger name and add to the display string. */
		cstemp = list_txt;
                list_txt = DwtCStrcat(list_txt, name_vector[k_burger_index]);
		XtFree(cstemp);

                DwtListBoxAddItem(widget_array[k_total_order], list_txt, 0);
		XtFree(list_txt);
            }

            /*  Text widget does not have a callback.  So we query the widget
             *  now to determine what its value is.  Convert to an integer. */
            fries_text = DwtSTextGetString(widget_array[k_fries_quantity]);
            fries_num = 0;
            sscanf(fries_text, "%d", &fries_num);

            if (fries_num != 0) {

                /* Put the fries quantity in the display string. */
                sprintf(list_buffer, "%d ", fries_num);
                list_txt = DwtLatin1String(list_buffer);

                /*  Get all the qualifiers for the fries. */
		cstemp = list_txt;
                list_txt = DwtCStrcat(list_txt, current_fries);
		XtFree(cstemp);
		cstemp = list_txt;
                list_txt = DwtCStrcat(list_txt, latin_space);
		XtFree(cstemp);

                /* Add fries name and display. */
		cstemp = list_txt;
                list_txt = DwtCStrcat(list_txt, name_vector[k_fries_index]);
		XtFree(cstemp);

                DwtListBoxAddItem(widget_array[k_total_order], list_txt, 0);
		XtFree(list_txt);
            }

            if (quantity_vector[k_drinks_index] > 0) {

                /* Put drinks quantity into the display string. */
                sprintf(list_buffer, "%d ", quantity_vector[k_drinks_index]);
                list_txt = DwtLatin1String(list_buffer);

                /*  Now get the qualifiers for the drinks. */
		cstemp = list_txt;
                list_txt = DwtCStrcat(list_txt, current_drink);
		XtFree(cstemp);
		cstemp = list_txt;
                list_txt = DwtCStrcat(list_txt, latin_space);
		XtFree(cstemp);

                /* Add the drink name to the display string. */

		cstemp = list_txt;
                list_txt = DwtCStrcat(list_txt, name_vector[k_drinks_index]);
		XtFree(cstemp);

                DwtListBoxAddItem(widget_array[k_total_order], list_txt, 0);
		XtFree(list_txt);
            }
            break;

        case k_fries_tiny: 
        case k_fries_small: 
        case k_fries_medium: 
        case k_fries_large: 
        case k_fries_huge: 

            /*  Some fries size push button was activated, so get the string 
             *  from the interface.  Helps with internationalization. */
	    XtFree(current_fries);
            get_something(w, DwtNlabel, &current_fries);
            break;

        case k_drink_add: 

            /*  Increment the drink quantity and update the display. */
            quantity_vector[k_drinks_index]++;
            update_drink_display();
            break;

        case k_drink_sub: 

            /*  Decrement drink quantity, but do not let it go below zero. */
            if (quantity_vector[k_drinks_index] > 0)
                quantity_vector[k_drinks_index]--;
            update_drink_display();
            break;

        default: 
            break;
    }
}




/*
 * The toggle buttons which control the 'hamburger doneness' and toppings
 * call back to this procedure when they change state.  Use the
 * tag to index into the boolean array.  Just keep the booleans current
 * with the user interface.
 */

static void toggle_proc(w, tag, toggle)
    Widget w;
    int *tag;
    DwtTogglebuttonCallbackStruct *toggle;
{
    toggle_array[*tag - k_burger_min] = toggle->value;
}




/*
 * The drink selection list box calls back to this procedure whenever the
 * user selects a drink.  Just keep the global current drink up to date.
 */

static void list_proc(w, tag, list)
    Widget w;
    int *tag;
    DwtListBoxCallbackStruct *list;
{
    XtFree (current_drink);
    current_drink = DwtCStrcpy (list->item);
}



/*
 * The hamburger quantity scale widget will call back to this procedure whenever
 * the user changes it.  Just keep the global hamburger quantity up to date.
 */

static void scale_proc(w, tag, scale)
    Widget w;
    int *tag;
    DwtScaleCallbackStruct *scale;
{
    quantity_vector[k_burger_index] = scale->value;
}





/*
 * The next two procedures put up and take down the order box and change
 * the label in the pulldown menu from Create to Dismiss.
 */


/*
 * The user selected the Order push button in the control pulldown menu.
 * We just change the state of the order box.  If the order box is 
 * currently displayed (managed), then remove (unmanage) it.  Otherwise,
 * we manage the order box.
 */

static void show_hide_proc(w, tag, reason)
    Widget w;
    int *tag;
    unsigned long *reason;
{
    if (XtIsManaged(widget_array[k_order_box]))

        XtUnmanageChild(widget_array[k_order_box]);
    else
        XtManageChild(widget_array[k_order_box]);
}



/*
 * All widgets that are created call back to this procedure. We just log the 
 * ID in the global array.
 */

static void create_proc(w, tag, reason)
    Widget w;
    int *tag;
    unsigned long *reason;
{
    int widget_num = *tag;

    widget_array[widget_num] = w;

    /*  For internationalization ease, we capture a few strings from the
     *  widgets themselves.  We could go out and fetch them as needed but
     *  since we use these all the time, this method if more efficient.
     */
    switch (widget_num) {
        case k_burger_label: 
            get_something(w, DwtNlabel, &name_vector[k_burger_index]);
            break;

        case k_fries_label: 
            get_something(w, DwtNlabel, &name_vector[k_fries_index]);
            break;

        case k_drink_label: 
            get_something(w, DwtNlabel, &name_vector[k_drinks_index]);
            break;

        default: 
            break;
    }
}




/*
 * The user pushed the quit button, so the application exits.
 */
static void quit_proc(w, tag, reason)
    Widget w;
    int *tag;
    unsigned long *reason;
{
    if (tag != NULL)
        printf("Quitting - %s", tag);
    exit(1);
}


/*
 * This callback runs just as a pulldown menu is about to be pulled down.
 * It fetches the menu if it is currently empty, and does other
 * special processing as required.
 * We use this opportunity to fetch the order box (if not done already)
 * and to make sure the push button displays the correct label.
 */

static void pull_proc(w, tag, reason)
    Widget w;
    int *tag;
    unsigned long *reason;
{
    int widget_num = *tag;

    switch (widget_num) {
        case k_file_pdme: 
            if (widget_array[k_file_menu] == NULL) {
                if (DwtFetchWidget(s_DRMHierarchy, "file_menu", widget_array[
                  k_menu_bar], &widget_array[k_file_menu], &dummy_class) !=
                  DRMSuccess)
                    s_error("can't fetch file pulldown menu widget");
		set_something(widget_array[k_file_pdme], DwtNsubMenuId,
		  widget_array[k_file_menu]);
            }
            break;

        case k_edit_pdme: 
            if (widget_array[k_edit_menu] == NULL) {
                if (DwtFetchWidget(s_DRMHierarchy, "edit_menu", widget_array[
                  k_menu_bar], &widget_array[k_edit_menu], &dummy_class) !=
                  DRMSuccess)
                    s_error("can't fetch edit pulldown menu widget");
                set_something(widget_array[k_edit_pdme], DwtNsubMenuId,
                  widget_array[k_edit_menu]);
            }
            break;

        case k_order_pdme: 
            if (widget_array[k_order_menu] == NULL) {
                if (DwtFetchWidget(s_DRMHierarchy, "order_menu", widget_array[
                  k_menu_bar], &widget_array[k_order_menu], &dummy_class) !=
                  DRMSuccess)
                    s_error("can't fetch order pulldown menu widget");
                set_something(widget_array[k_order_pdme], DwtNsubMenuId,
                  widget_array[k_order_menu]);
	    }

	    if (widget_array[k_order_box] == NULL) {
                if (DwtFetchWidget(s_DRMHierarchy, "control_box",
                  toplevel_widget, &widget_array[k_order_box], &dummy_class) !=
                  DRMSuccess)
                    s_error("can't fetch order box widget");
            }

            /* Figure out what the label of the push button in the pulldown
             * menu should be. */

            if (XtIsManaged(widget_array[k_order_box]))
                set_something(widget_array[k_create_order], DwtNlabel,
                  latin_dismiss);
            else
                set_something(widget_array[k_create_order], DwtNlabel,
                  latin_create);
            break;

    }

}


/******************************************************************************/
/* routine to translate a logical */


#include "sys$library:lnmdef.h"
#include "sys$library:descrip.h"
#include "sys$library:ssdef.h"
#define VMS 1

int view$get_env_log( str1, str1_len, str2, str2_len, p_str2_len_ret )
char *str1, *str2;
int  str1_len, str2_len, *p_str2_len_ret;
{

	{
#ifdef VMS
	$DESCRIPTOR( tabnam,"LNM$FILE_DEV" );
	struct item_list {
		short int buflen;
		short int itmcod;
		long int bufadr;
		long int retadr; } mylist[2] = {{0,0,0,0},{0,0,0,0}};

#endif
	char log_buffer[256];
	struct dsc$descriptor_s log_desc;

	log_desc.dsc$w_length  = 0;
	log_desc.dsc$b_dtype   = DSC$K_DTYPE_T;
	log_desc.dsc$b_class   = DSC$K_CLASS_S;
	log_desc.dsc$a_pointer = 0;

#ifdef VMS
	    
	*p_str2_len_ret = 0;
	mylist[0].buflen = str2_len;
	mylist[0].itmcod = LNM$_STRING;
	mylist[0].bufadr = str2;
	mylist[0].retadr = p_str2_len_ret;

	log_desc.dsc$a_pointer = str1;
	log_desc.dsc$w_length = str1_len;

	if ( SYS$TRNLNM( 0, &tabnam, &log_desc, 0, &mylist ) == SS$_NORMAL )
	    return(1);
	else
	    return(0);
#endif
#ifdef ultrix
	if ( getenv( str1 ) )	
	    return(1);
	else
	    return(0);
#endif
	}
    
}
T.RTitleUserPersonal
Name
DateLines
2490.1see 1621.* This is used for lang. switchingHANDVC::SAMMYKAMSammy Kam ABSS/FERWed Mar 21 1990 22:061
    
2490.2Knowing why is good, knowing what to do is better ...ALLVAX::APPELPanic now ... avoid the rush ...Thu Mar 22 1990 07:346
    Ah ... but what do we need to DO about it?  There IS no
    SYS$LIBRARY_en_US defined, so how does an application access files in
    SYS$LIBRARY?  In fact, since there is not SYS$LIBRARY_en_US on the
    system, what does DECwindows do with this logical?
    
    Neal
2490.3STAR::ORGOVANVince OrgovanThu Mar 22 1990 14:1214
    XtInitialize redefines SYS$LIBRARY to be a search list in VMS V5.3
    as part of the DECwindows internationalization support for language
    switching. Actually, if you looked more closely, you'd see that 
    SYS$LIBRARY is being redefined to be a search list with 
    SYS$LIBRARY_en_US as the first value and the old value as the second
    value.  
    
    I don't know what DECview3D is doing, but it is obviously not seeing
    the rest of the search list.
    
    I think that this could be a DECview3D bug. SYS$LIBRARY normally is
    already a search list through the SYS$SPECIFIC:[SYSLIB] and then
    through SYS$COMMON:[SYSLIB]. This implies that DECview3D should 
    already be prepared to handle search lists for SYS$LIBRARY.
2490.4$PARSE with syntax checking onlyALLVAX::JROTHIt&#039;s a bush recording...Mon Mar 26 1990 09:058
    I looked at the code in question and for some brain damaged reason
    it is calling SYS$PARSE with syntax checking only.  That is why
    redifining sys$library to a bogus symbol causes it to fail.

    Thanks for the info on the internationalization - it wasn't clear
    why that logical name was appearing...

    - Jim
2490.5Xt should be fixedDECWIN::KLEINMon Mar 26 1990 12:1913
>    I looked at the code in question and for some brain damaged reason
>    it is calling SYS$PARSE with syntax checking only.  That is why
>    redifining sys$library to a bogus symbol causes it to fail.

Code that uses SYNCHK is not always brain damaged.  Sometimes it is useful
to be able to refer to a directory that does not exist yet, etc.

I think that the brain damaged code is in Xt, where /TRAN=CONCEALED should
have been used when the logical names were redefined.

[Author of another "stung" application.]

-steve-
2490.6What about FILEVIEW??COMICS::FISCHERI&#039;ve got a match...Tue Jun 19 1990 07:3024
>    XtInitialize redefines SYS$LIBRARY to be a search list in VMS V5.3
>    as part of the DECwindows internationalization support for language
>    switching. Actually, if you looked more closely, you'd see that 
>    SYS$LIBRARY is being redefined to be a search list with 
>    SYS$LIBRARY_en_US as the first value and the old value as the second
>    
If you type SYS$LIBRARY in FILEVIEW'S directory field, the following error 
appears...

	Error in device name or inappropriate device type for operation.

the directory field now contains SYS$LIBRARY_EN_US:[xxxxxx], and no files are 
listed.

If the above is true, then surely the files in SYS$SYSROOT:[SYSLIB] would appear
as this is the next item in the search list.

Is this a bug with FILEVIEW?, how can I get round it?


Thanks for any info!


Ian