XView Developer's Notes
  Procure somente este livro
Fazer download desta apostila em PDF

Changes to Internationalized XView Version 2.x

B

Prior to the release of XView 3.2, XView was available in domestic and internationalized versions. This appendix explains the changes that have been made since XView 2.x. It is intended for developers who are migrating their internationalized XView 2.x applications to the current XView release. Topics include compatibility, changes to packages, and a list of current attributes and functions.

Compatibility with the Current XView Release

Programs written under the internationalized XView 2.x environment are neither source nor binary compatible with the current XView release. Programs written under the internationalized XView Version 2.x environment may require source modification to become compatible with XView. Table B-1 shows compatibility between toolkit versions.
Table B-1

Operating Environment

Written/Compiledcurrent XView releaseXView 3.0.1 and 3.1Intl. XView 2.0.1
current XView releasen/aNot compatibleNot compatible
XView 3.0.1 and 3.1Source/binary compatiblen/aNot compatible
Intl. XView 2.0.1Not compatibleNot compatiblen/a

Package Changes

This section describes changes to four packages: frames, panels, text subwindows, and windows.

Frames

Frame attributes have not changed since internationalized XView 2.x. In the internationalized XView 2.x releases, the frame package sent input method status information to the window manager, olwm, and then the window manager rendered the status region. In the current XView release, the frame package maintains the input method status information and renders the status region.

Panels

Three attributes in panels have changed meaning since internationalized XView 2.x:
  • PANEL_VALUE_DISPLAY_LENGTH
  • PANEL_VALUE_STORED_LENGTH
  • PANEL_NOTIFY_PROC_WCS.
In internationalized XView 2.x and (domestic) XView 3.x, PANEL_VALUE_DISPLAY_LENGTH measured the display length in characters. However, the meanings of characters, bytes, and columns are not the same in the Asian locales; therefore, the meaning of PANEL_VALUE_DISPLAY_LENGTH also had to change to reflect the difference. In the current XView release, PANEL_VALUE_DISPLAY_LENGTH is measured in columns. The default value for PANEL_VALUE_DISPLAY_LENGTH is 80 columns.
PANEL_VALUE_STORED_LENGTH was also measured in characters in internationalized XView 2.x. Setting PANEL_VALUE_STORED_LENGTH to 10 meant 10 bytes of storage space in XView 2.x, and possibly 20 bytes of storage in internationalized XView 2.x (depending on the definition of a wide character). To make things more consistent in all environments, the value associated with PANEL_VALUE_STORED_LENGTH now means the number of bytes to be stored. All incoming wide characters are converted to multibyte first to check against the storage limit, then stored in wide character form. All incoming multibyte characters are also checked against the storage limit first, then converted to wide characters for storage.
PANEL_NOTIFY_PROC_WCS accepted five parameters for a panel list item in internationalized XView 2.x. In the XView release, PANEL_NOTIFY_PROC_WCS accepts six parameters for a panel list item:
  • Panel list item
  • Wide character string
  • Client data
  • Operation
  • Event
  • Row number.

Text Subwindows

The following sections describe changes to Text subwindows.

Search Path for Textsw Extras Menu File

The search path for the Textsw Extras Menu file has been changed since XView 2.x. Refer to "Text Subwindows" on page 63 for further information.

Character- and Byte-Based Index Support

In internationalized XView 2.x there was no API for a byte-based index. Indices were handled in characters, even for the multibyte API. In the current XView release, Text subwindows support both character- and byte-based APIs for index. The multibyte API handles the index in bytes, and the wide character API handles it in characters. There are two reasons for this change:
  • To provide portability between Asian and non-Asian locales.
  • To enhance the ease of programming with the multibyte API.
The attributes and functions in Table B-2 use an index as an argument or the returned value, or return the number of deleted/inserted characters.
  • Column A lists functions and attributes that existed in the internationalized XView 2.x. Indices and deleted or inserted length were handled in characters, not bytes. In the current XView release, these functions and attributes are handled in bytes.
  • Column B lists functions and attributes that existed in the internationalized XView 2.x as wide character API, where indices and deleted lengths were handled in characters. In the current XView release, these API handle indices and lengths in bytes similar to the multibyte API.
  • Column C lists the new wide character API. This API supports wide characters as the counterpart of the multibyte API in column B. Indices and deleted length are handled in characters.
Table B-2 Changed or Added Text Subwindow Attributes and Functions

Imported image(503x221)

If an internationalized XView 2.x application does not use any wide character API for the multibyte API in column A, or TEXTSW_LENGTH_WC (listed in Table B-3), the application will not need to change except for the changes according to the bug fixes mentioned in the next section. However, the wide character API is recommended for improved performance. Refer to "Text Subwindows" on page 63 for further information.
Table B-3 Wide Character Text Subwindow API
Wide Character Attributes...Wide Character Functions
TEXTSW_CONTENTS_WCS                 textsw_find_wcs()
TEXTSW_LENGTH_WC                    textsw_insert_wcs()
                                    textsw_match_wcs()
                                    textsw_replace_wcs()

If an internationalized XView 2.x application uses the wide character API listed in Table B-3 and any API listed in column B of Table B-2 together, the application needs to use the wide character API listed in column C instead of column B of Table B-2. For example, the internationalized XView 2.x code below searches a string, erases it, and moves the insertion caret to the front of the erased character.

Imported image(414x94)

The XView code below has been changed to call textsw_erase_wcs() instead of textsw_erase(), and it uses TEXTSW_INSERTION_POINT_WC instead of TEXTSW_INSERTION_POINT. Textsw_find_wcs() returns the index parameters in wide characters. Further processing of the indices should also be character-based by using textsw_erase_wcs() and TEXTSW_INSERTION_POINT_WC.

Imported image(414x69)

If an internationalized XView 2.x application uses the multibyte API in column A of Table B-2 and wide character API in Table B-3 together, some combinations will require source code changes. For example, the following internationalized XView 2.x code searches a string with a multibyte string and replaces it with a wide character string.

Imported image(414x87)

In the current XView release, textsw_find_bytes() should be replaced with textsw_find_wcs(), and the multibyte string buf should be converted to wide character. Similarly, textsw_replace_wcs() can be replaced with textsw_replace_bytes(), but the wide character API is recommended for better performance. These changes are necessary because the index is handled in different ways between multibyte and wide character APIs.

Bug Fixes to Text Subwindows

Because of these bug fixes, your internationalized XView Version 2.x application may need to change.
textsw_insert()
Textsw_index
textsw_insert (textsw, buf, buf_len)
  char            *buf;
  int             buf_len;

Internationalized XView Version 2.x environment: buf_len and the return value of the number of characters actually inserted were counted in characters. This was a bug. If buf_len is specified over the actual buffer length, only the contents of the buffer would be inserted.
Current XView release: buf_len and the return value are counted in bytes.
textsw_replace_bytes()
Textsw_index
textsw_replace_bytes(textsw, first, last_plus_one,
                   buf, buf_len)
  Textsw_index first, last_plus_one;
  char            *buf;
  unsigned         buf_len;

Internationalized XView Version 2.x environment: buf_len, the return value of the number of characters inserted or deleted, first, and last_plus_one were measured in characters. Measuring buf_len in characters was a bug.
Current XView release: buf_len, return value, first, and last_plus_one are counted in bytes.
textsw_find_bytes(), textsw_match_bytes()
textsw_find_bytes (textsw, first, last_plus_one, buf,
  buf_len, flags)

textsw_match_bytes(textsw,first,last_plus_one, start_sym,
  start_sym_len, end_sym, end_sym_len, field_flag)

Internationalized XView Version 2.x environment: these functions ignore the specified buffer length and processes the entire string in buffer (this is a bug). The index is character based.
Current XView release: processes string in buffer specified by buffer length. Index and buffer length are byte based.
TEXTSW_CONTENTS
TEXTSW_CONTENTS is used by xv_get().

next_pos = xv_get (textsw, TEXTSW_CONTENTS, start_pos, buf, buf_len)
Textsw_index start_pos, next_pos;
char         *buf;
int          buf_len;

Internationalized XView Version 2.x environment: next_pos and start_pos are character based. buf_len is byte based.
Current XView release: start_pos, next_pos and buf_len are byte based.

Windows

As shown in Table B-4, the WIN_IM_* attributes in internationalized XView 2.x have undergone a name change to WIN_IC_* in the current XView release. The API usage is still the same, although the Xlib data structures have been updated to reflect the latest X11 Release 5 specification.
Table B-4 WIN_IM_* Attribute Changes
Internationalized XView 2.x..Current XView Release
WIN_IM_PREEDIT_START                WIN_IC_PREEDIT_START
WIN_IM_PREEDIT_DRAW                 WIN_IC_PREEDIT_DRAW
WIN_IM_PREEDIT_DONE                 WIN_IC_PREEDIT_DONE

WIN_IM_LUC_START                    No longer supported
WIN_IM_LUC_DRAW                     No longer supported
WIN_IM_LUC_PROCESS                  No longer supported
WIN_IM_LUC_DONE                     No longer supported

WIN_IM_STATUS_START                 WIN_IC_STATUS_START
WIN_IM_STATUS_DRAW                  WIN_IC_STATUS_DRAW
WIN_IM_STATUS_DONE                  WIN_IC_STATUS_DONE

XView Attributes and Functions

In Table B-5, current XView attributes and functions are listed alphabetically, and the status is designated as:
New:New since internationalized XView 2.x
Modified:Existed in internationalized XView 2.x but is modified in the current XView release
Unchanged:Existed in internationalized XView 2.x and remains unchanged in the current XView release
Obsolete:Existed in internationalized XView 2.x but is no longer used in the current XView release
Table B-5 XView Attributes and Functions--Current Release
Attributes and Functions.............New..Modified..Unchanged Obsolete
CANVAS_IM_PREEDIT_FRAME                                 x

CURSOR_STRING_WCS                                       x

defaults_get_locale()                                   x
defaults_set_locale()                                   x

Table B-5 XView Attributes and Functions--Current Release (continued)
Attributes and Functions.............New..Modified..Unchanged Obsolete
FILE_CHOOSER_APP_DIR_WCS                                x
FILE_CHOOSER_CUSTOMIZE_OPEN_WCS                         x
FILE_CHOOSER_DIRECTORY_WCS                              x
FILE_CHOOSER_DOC_NAME_WCS                               x
FILE_CHOOSER_FILTER_WCS                                 x
FILE_CHOOSER_NOTIFY_FUNC_WCS                            x
FILE_CHOOSER_WCHAR_NOTIFY                               x

FILE_LIST_DIRECTORY                                     x
FILE_LIST_DOTDOT_STRING_WCS                             x
FILE_LIST_FILTER_STRING_WCS                             x
FILE_LIST_WCHAR_NOTIFY                                  x

FONT_CHAR_WIDTH_WC                                                                  x
FONT_CHAR_HEIGHT_WC                                                                 x
FONT_COLUMN_WIDTH                                       x
FONT_LOCALE                                             x
FONT_NAMES                                              x
FONT_SET_ID                                             x
FONT_SET_SPECIFIER                                      x
FONT_STRING_DIMS_WCS                                    x

FRAME_LABEL_WCS                                                                     x
FRAME_LEFT_FOOTER_WCS                                                               x
FRAME_RIGHT_FOOTER_WCS                                                              x

HISTORY_ADD_FIXED_ENTRY_WCS                             x
HISTORY_ADD_ROLLING_ENTRY_WCS                           x
HISTORY_LABEL_WCS                                       x
HISTORY_NOTIFY_PROC_WCS                                 x
HISTORY_VALUE_WCS                                       x

ICON_LABEL_WCS                                                                      x
ICON_TRANSPARENT_LABEL_WCS                                                          x

Table B-5 XView Attributes and Functions--Current Release (continued)
Attributes and Functions.............New..Modified..Unchanged Obsolete
MENU_ACCELERATOR_WCS                                    x
MENU_ACTION_ACCELERATOR_WCS                             x
MENU_ACTION_ITEM_WCS                                                                x
MENU_GEN_PIN_WINDOW_WCS                                                             x

MENU_GEN_PROC_ITEM_WCS                                                              x
MENU_GEN_PULLRIGHT_ITEM_WCS                                                         x
MENU_PULLRIGHT_ITEM_WCS                                                             x
MENU_STRING_WCS                                                                     x
MENU_STRING_ITEM_WCS                                                                x
MENU_STRINGS_WCS                                                                    x
MENU_STRINGS_AND_ACCELERATORS_WCS                       x
MENU_TITLE_ITEM_WCS                                                                 x

NOTICE_BUTTON_WCS                                                                   x
NOTICE_BUTTON_NO_WCS                                                                x
NOTICE_BUTTON_YES_WCS                                                               x
NOTICE_MESSAGE_STRING_WCS                                                           x
NOTICE_MESSAGE_STRINGS_WCS                                                          x
NOTICE_MESSAGE_STRINGS_ARRAY_PTR_WCS                                                x

PANEL_CHOICE_STRING_WCS                                                             x
PANEL_CHOICE_STRINGS_WCS                                                            x
PANEL_ITEM_IC_ACTIVE                                    x
PANEL_LABEL_STRING_WCS                                                              x
PANEL_LIST_INSERT_STRINGS_WCS                           x
PANEL_LIST_ROW_VALUES_WCS                               x
PANEL_LIST_STRING_WCS                                                               x
PANEL_LIST_STRINGS_WCS                                                              x
PANEL_LIST_TITLE_WCS                                    x
PANEL_MASK_CHAR_WC                                      x
PANEL_MAX_TICK_STRING_WCS                               x
PANEL_MAX_VALUE_STRING_WCS                              x
PANEL_MIN_TICK_STRING_WCS                               x
PANEL_MIN_VALUE_STRING_WCS                              x

Table B-5 XView Attributes and Functions--Current Release (continued)
Attributes and Functions.............New..Modified..Unchanged Obsolete
PANEL_NOTIFY_PROC_WCS                                               x
PANEL_NOTIFY_STRING_WCS                                                             x
PANEL_VALUE_WCS                                                                     x
PANEL_VALUE_DISPLAY_LENGTH                                          x
PANEL_VALUE_STORED_LENGTH                                           x
PANEL_VALUE_STORED_LENGTH_WCS                           x

panel_get_value_wcs()                                                               x
panel_set_value_wcs()                                                               x

PATH_LAST_VALIDATED_WCS                                 x
PATH_RELATIVE_TO_WCS                                    x

SELN_REQ_CHARSIZE                                                                   x
SELN_REQ_CONTENTS_WCS                                                               x
SELN_REQ_FIRST_WC                                       x
SELN_REQ_LAST_WC                                        x

SERVER_IMAGE_BITMAP_FILE_WCS                                                        x

TEXTSW_ACTION_CHANGED_DIRECTORY_WCS                                                 x
TEXTSW_ACTION_EDITED_FILE_WCS                                                       x
TEXTSW_ACTION_LOADED_FILE_WCS                                                       x
TEXTSW_CONTENTS                                                     x
TEXTSW_CONTENTS_WCS                                                                 x
TEXTSW_FILE_WCS                                                                     x
TEXTSW_FILE_CONTENTS_WCS                                                            x
TEXTSW_FIRST                                                        x
TEXTSW_FIRST_WC                                         x
TEXTSW_INSERT_FROM_FILE_WCS                                                         x
TEXTSW_INSERTION_POINT                                              x
TEXTSW_INSERTION_POINT_WC                               x
TEXTSW_LENGTH_WC                                                                    x
textsw_add_mark()                                                   x
textsw_add_mark_wc()                                    x
textsw_append_file_name_wcs()                                                       x
textsw_delete()                                                     x
textsw_delete_wcs()                                     x

Table B-5 XView Attributes and Functions--Current Release (continued)
Attributes and Functions.............New..Modified..Unchanged Obsolete
textsw_edit()                                                       x
textsw_edit_wcs()                                       x
textsw_erase()                                                      x
textsw_erase_wcs()                                      x
textsw_find_bytes()                                                 x
textsw_find_wcs()                                                                   x
textsw_find_mark()                                                  x
textsw_find_mark_wc()                                   x
textsw_index_for_file_line()                                        x
textsw_index_for_file_line_wc()                         x
textsw_insert()                                                     x
textsw_insert_wcs()                                                                 x
textsw_match_bytes()                                                x
textsw_match_wcs()                                                                  x
textsw_normalize_view()                                             x
textsw_normalize_view_wc()                              x
textsw_possibly_normalize()                                         x
textsw_possibly_normalize_wc()                          x
textsw_replace_bytes()                                              x
textsw_replace_wcs()                                                                x
textsw_set_selection()                                              x
textsw_set_selection_wcs()                              x
textsw_store_file_wcs()                                                             x

ttysw_input_wcs()                                       x
ttysw_output_wcs()                                      x

WIN_ERROR_MSG_WCS                                       x
WIN_IC                                                                              x
WIN_IC_ACTIVE                                           x
WIN_IC_COMMMIT_STRING                                   x
WIN_IC_COMMIT_STRING_WCS                                x
WIN_IC_CONVERSION                                       x
WIN_IC_PREEDIT_CARET                                    x
WIN_IC_PREEDIT_DONE                                                                 x
WIN_IC_PREEDIT_DRAW                                                                 x
WIN_IC_PREEDIT_START                                                                x

Table B-5 XView Attributes and Functions--Current Release (continued)
Attributes and Functions.............New..Modified..Unchanged Obsolete
WIN_IC_RESET                                            x
WIN_IC_STATUS_DONE                                                                  x
WIN_IC_STATUS_DRAW                                                                  x
WIN_IC_STATUS_START                                                                 x
WIN_IM_LUC_START                                                                                    x
WIN_IM_LUC_DRAW                                                                                     x
WIN_IM_LUC_PROCESS                                                                                  x
WIN_IM_LUC_DONE                                                                                     x
WIN_USE_IM                                                                          x
WIN_X_IM_STYLE_MASK                                     x

XV_IM                                                                               x
XV_IM_STYLES                                            x
XV_LABEL_WCS                                                                        x