home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
zfamily.zip
/
zfamily
/
ZCVFUNCS
/
HELP
/
ZCVFUNCS.INF
(
.txt
)
next >
Wrap
OS/2 Help File
|
1993-11-19
|
58KB
|
1,563 lines
ΓòÉΓòÉΓòÉ 1. Document Content ΓòÉΓòÉΓòÉ
This document is made up of five parts:
Library Card
General information card for this library.
Installation Guide
How to install the Z Family/2 reusable library and how to use the installed
files.
User's Guide
How to integrate the library with your application and how to call the
corresponding functions and macros.
Reference Manual
Reference information for the functions, macros and structures provided by
this library.
Sample Program
How to call and use the sample program.
ΓòÉΓòÉΓòÉ 2. Library card ΓòÉΓòÉΓòÉ
ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
Package: ZCVFUNCS
Library: FMZCVFUN.DLL
Version: 2.20
Requirements:
OS/2 2.x, C Set/2 or IBM C/C++ Tools 2.0, Toolkit 2.x, ACSSVC.DLL (an APPC
Dynamic Link Library).
Trademarks
ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
Contact: Dr. Dario de Judicibus
IBMMAIL: ITIBM98W
Internet: ddj@vnet.ibm.com
ΓòÉΓòÉΓòÉ 3. Installation Guide ΓòÉΓòÉΓòÉ
Select one:
Library installation
The expanded tree
ΓòÉΓòÉΓòÉ 3.1. Library installation ΓòÉΓòÉΓòÉ
Select one:
Γûá Package content
Γûá How to install the library
ΓòÉΓòÉΓòÉ 3.1.1. Package content ΓòÉΓòÉΓòÉ
FMZCVFUN.DLL is distributed as a package containing the following files:
ZCVFUNCS.ZIP A compressed file which contains the library
modules.
ZCVFUNCS.INF The on-line documentation for this reusable library.
ΓòÉΓòÉΓòÉ 3.1.2. How to install the library ΓòÉΓòÉΓòÉ
To install the libraries, you have to perform the following steps:
1. Locate the directory of the CD-ROM, remote partition, or diskette where
ZCVFUNCS.ZIP is placed. Let's say, for example, P:\ZFAMILY.
2. Move to the directory on your system where you want to install the
reusable library. For example, move to D:\REUSE.
3. Unpack the ZIP file by using option -d. Note that the option must be lower
case. In our case, issue the following command:
[D:\REUSE] PKUNZIP2 -d P:\ZFAMILY\ZCVFUNCS.ZIP
4. When the command finishes, a new directory is available on your system. In
our example, P:\ZFAMILY\ZCV. This directory contains several
sub-directories which contains all the files needed to use the reusable
library. The directory tree is described in Library Tree. The content of
each sub-directory is described in detail in Content of directories.
5. To use the library, you must now move the unpacked files to the
appropriate directories in your development environment. In particular
move
o the headers from .\ZCV\H to any directory listed in your INCLUDE
environment variable.
o the import and/or object libraries from .\ZCV\LIB and .\ZCV\DEVEL to any
directory listed in your LIB environment variable.
o the dynamic link libraries from .\ZCV\DLL to any directory listed in your
LIBPATH environment variable.
You may also want to move this file from .\ZCV\HELP to any directory
listed in your BOOKSHELF environment variable.
Now you are ready to work with the ZCV reusable library.
ΓòÉΓòÉΓòÉ 3.2. The expanded tree ΓòÉΓòÉΓòÉ
Select one:
Γûá Library tree
Γûá Content of directories
ΓòÉΓòÉΓòÉ 3.2.1. Library tree ΓòÉΓòÉΓòÉ
When you unpack ZCVFUNCS.ZIP, a new sub-directory is created on your system:
ZCV. It has the following structure:
current dir
Γöé
Γöé ZCV
Γö£ΓöÇΓöÉ
Γöé Γö£ΓöÇΓöÇΓöÇΓöÇ H
. Γö£ΓöÇΓöÇΓöÇΓöÇ DLL
. Γö£ΓöÇΓöÇΓöÇΓöÇ LIB
. Γö£ΓöÇΓöÇΓöÇΓöÇ MRI
. Γö£ΓöÇΓöÇΓöÇΓöÇ HELP
. Γö£ΓöÇΓöÇΓöÇΓöÇ DEVEL
. ΓööΓöÇΓöÇΓöÇΓöÇ SAMPLE
ΓòÉΓòÉΓòÉ 3.2.2. Content of directories ΓòÉΓòÉΓòÉ
Here is the list of the directories that are created when ZCVFUNCS.ZIP is
unpacked as described in How to install the library. The content of each
directory is described in detail.
The H sub-directory contains all the header files (H and RCH) to be added to
the INCLUDE path of the application development environment. Move all the files
from this directory to the appropriate path in your environment.
Important If you use other Z Family/2 reusable libraries in your development
environment, ensure that you are using the latest version of the zgeneral.h
header file, which is available in all the library packages. You may do
that by comparing the update dates in the prologue of the header file.
/*
** Module : ZGENERAL.H
** Authors : Dario de Judicibus (DEJUDICI at ROMEPPC)
** Alessandro Cavallini (CAVALLI at ROMEPPC)
** Giacomo Lenoci
** Created : 10 Jan 1992
** Updated : 01 Feb 1993
** Version : 2.30
** Content : General includes for all Z Family/2 DLLs
** Product : Z Family/2 Project (5641-504) FMZ
**
*/
The DLL sub-directory contains all the dynamic link library or libraries (DLL)
to be added to the LIBPATH path of the application development environment and
of the run environment. Move all the files from this directory to the
appropriate path in your environment.
The LIB sub-directory contains all the import library or libraries (LIB) to be
added to the LIB path of the application development environment. Move all the
files from this directory to the appropriate path in your environment.
The MRI sub-directory contains all the text that might be translated to other
languages (see Machine Readable Information for additional information).
The HELP sub-directory contains the library documentation and a news file
(ZCVNEWS.DOC) containing modifications applied at the last minute and not
available in the on-line manuals, along with the history of changes.
The DEVEL sub-directory contains the object library or libraries (LIB) and the
sample DEF and MAK files that can be used to generate your own DLL(s) (see
Create your own library for details).
The SAMPLE sub-directory contains the source code and the executable code of
the sample program. It doesn't contain the DLL file(s) so to run the sample,
you must ensure that all the required DLL files have been copied to a
directory in your LIBPATH. The DLL files for this library as well as those
belonging on any pre-requisite Z Family/2 Reusable Library need to be in a
directory in your LIBPATH.
Important If the library depends on other Z Family/2 reusable libraries, all
the files belonging to the pre-requisite libraries will be part of the
dependent library only in the beta versions of the package.
The final version won't contain any pre-requisite file. That is true for
the SAMPLE sub-directory too. So, you won't be able to recompile the sample
program unless you install the pre-requisite packages too.
ΓòÉΓòÉΓòÉ 4. User's Guide ΓòÉΓòÉΓòÉ
Select one:
General information
Basic topics
Advanced topics
ΓòÉΓòÉΓòÉ 4.1. General information ΓòÉΓòÉΓòÉ
Select one:
Γûá Library overview
Γûá Include files
Γûá Requirements
Γûá Development rules
Γûá Trademarks
ΓòÉΓòÉΓòÉ 4.1.1. Library overview ΓòÉΓòÉΓòÉ
This library contains a set of functions to convert texts from a single-byte
coded character set to another. These function allow the programmer to
o create translation tables
o convert character streams and null-terminated strings
o convert text files
FMZCVFUN.DLL is not yet DBCS enabled.
Several coded character sets (CCSIDs) are supported. For details refer to
Supported CCSIDs.
ΓòÉΓòÉΓòÉ 4.1.2. Include files ΓòÉΓòÉΓòÉ
The system include files that are required to use this library are:
#define INCL_PM
#define INCL_DOS
#define INCL_DOSNLS
#include <os2.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <signal.h>
#include <string.h>
#include <ctype.h>
The specific include files that are required to use this library are:
zgeneral.h
Definitions and types for all Z Family/2 Reusable Libraries.
zcvdefs.h
Macro and constants for this library.
zcvtypes.h
Type definitions for this library.
zcvproto.h
Function prototypes for this library.
Note: The specific includes must be included in the order as listed above.
ΓòÉΓòÉΓòÉ 4.1.3. Requirements ΓòÉΓòÉΓòÉ
FMZCVFUN.DLL is intended to run under OS/2 2.x. It doesn't run under previous
versions of OS/2.
FMZCVFUN.DLL has been compiled by IBM C/C++ Tools 2.0 and statically linked to
the C run-time libraries. Then you don't need the run-time libraries to use it.
This library needs the APPC Dynamic Link Libraries provided with the
Communications Manager/2.
In particular ACSSVC.DLL must be available.
Notes
FMZCVFUN.DLL functions can be called either from C or from C++. In addition, an
exception handler is registered for each exported function.
A sample program that shows how to use FMZCVFUN.DLL functions is also provided
in the DLL's package. A short description of that sample is available in Sample
program tutorial.
The sample program uses the IMPORTS statement in its .DEF to import the
FMZCVFUN.DLL functions. File FMZCVFUN.LIB is also provided as an alternative
solution.
It is also possible to create a clone of FMZCVFUN.DLL by using the files
available in the DEVEL sub-directory of the tree created by exploding the ZIP
file distributed with the package (see Create your own library).
ΓòÉΓòÉΓòÉ 4.1.4. Development rules ΓòÉΓòÉΓòÉ
To safely integrate any Z Family/2 Reusable Library in your application, you
need to follow a simple set of rules:
1. Do not use names beginning by a lower case "z" for
o functions
o macros
o global structures
o types
o constants
o #define
o global variables
2. Do not use names beginning by a "z" for
o include files (.H)
o dynamic link libraries (.DLL)
Follow these rules and your code can take full advantage of the services
provided by the current and future Z Family/2 Reusable Libraries.
ΓòÉΓòÉΓòÉ 4.1.5. Trademarks ΓòÉΓòÉΓòÉ
IBM Z Family/2 Reusable Libraries is copyrighted by IBM Corporation.
IBM Corporation trademarks
APPC
CUA
Common User Access
Communications Manager/2
IBM
IBM C Set/2
IBM C/C++ Tools
Operating System/2
OS/2
Presentation Manager
SAA
Systems Application Architecture
Workplace Shell
Other trademarks
Intel is a trademark of the Intel Corporation.
Microsoft and Windows are trademarks of the Microsoft Corporation.
PKZIP and PKUNZIP are trademarks of the PKWare Corporation.
80386 is a trademark of the Intel Corporation.
ΓòÉΓòÉΓòÉ 4.2. Basic topics ΓòÉΓòÉΓòÉ
Select one:
Γûá Tables and streams
Γûá Supported CCSIDs
ΓòÉΓòÉΓòÉ 4.2.1. Tables and streams ΓòÉΓòÉΓòÉ
Select one:
Γûá Tables
Γûá Streams
ΓòÉΓòÉΓòÉ 4.2.1.1. Tables ΓòÉΓòÉΓòÉ
A translation table is a memory area of 256 bytes, which contains the values to
be used to translate a text from a single-byte coded character set to another.
There are two kinds of translation tables: generated and user-provided.
A generated translation table is created by zcvMakeTable() providing the source
and target CCSIDs (Coded Character Set Identifiers).
A user-provided translation table is any array of 256 characters where each
element is different from the others. That is a translation table must be a
biunivocal operator.
Since zcvMakeTable() takes advantage of an APPC service to generate the table,
and since such a service requires a 16:16 pointer rather than a 0:32 one, it is
necessary to allocate the table in a certain way. To avoid to bother the
developer with such details, specific allocation and freeing services are
provided: zcvAllocTable() and zcvFreeTable().
Such functions are requested for generated translation table, and highly
recommended for user-provided table too. In the latter case, the developer may
copy the existent table to the allocated area by
(void)memcpy( (char *)trans_table, user_table, 256 ) ;
ΓòÉΓòÉΓòÉ 4.2.1.2. Streams ΓòÉΓòÉΓòÉ
A character stream is a sequence of characters in 0x00 to 0xFF range, NULL
included.
On the other side, a null terminated string is a character stream in 0x01 to
0xFF range, where the NULL is used to terminate the sequence and is not
considered as part of the string.
zcvConvertCharStream() allows to convert either character streams and null
terminated strings according to a provided translation table.
ΓòÉΓòÉΓòÉ 4.2.2. Supported CCSIDs ΓòÉΓòÉΓòÉ
The coded character sets supported by the function that generates the
translation tables, that is zcvMakeTable(), could be obtained by calling
zcvSupportedCCSIDs(). In theory they might be different from a country to
another, depending on the installation options for each single machine. At the
moment, anyway, they are the same for all SBCS systems.
Since there is currently no way to extract the list of CCSIDs supported by
ASCSVC.DLL by using the APPC services, I had to hardcode it in a static
constant array included in FMZCVFUN.DLL.
The only way I know to obtain that list, is to generate a set of ┬╖CPT files
(codepage tables) by moving to your \CMLIB directory, and launching
ACSGCCRT.EXE. You'll obtain a list of files which correspond to the CCSID's
that are supported on your machine.
I decided do not use such a system to get dynamically the CCSIDs' list, to
avoid to create unwanted files in your CMLIB directory.
Hereinafter is the list that I obtained on my PS/2, just for reference:
PC CCSIDs
437 : US and others 850 : Multilingual
852 : ROECE Latin-2 Multilingual 857 : Turkey Latin 5
862 : Hebrew (migration) 864 : Arabic
860 : Portuguese 861 : Iceland
863 : Canadian-French 865 : Denmark/Norway
1011 : ISO-7 Germany 1010 : ISO-7 French
1012 : ISO-7 Italy
Host CCSIDs
037 : US and others 273 : Germany
277 : Denmark/Norway 278 : Finland/Sweden
280 : Italy 284 : Spain/Latin America
285 : UK 297 : France
500 : Belgium/Multilingual 871 : Iceland
310 : APL 2 367 : ?
Other CCSIDs
65072 : ? 65076 : ?
65077 : ? 64437 : ?
64850 : ? 64860 : ?
64861 : ? 64863 : ?
64865 : ? 65000 : ?
65001 : ? 65002 : ?
65003 : ? 65004 : ?
65005 : ? 65006 : ?
65100 : ?
ΓòÉΓòÉΓòÉ 4.3. Advanced topics ΓòÉΓòÉΓòÉ
Select one:
Γûá Machine Readable Information
Γûá Signal handling
Γûá Create your own library
Γûá How to generate the clone
Γûá How to use the object library
ΓòÉΓòÉΓòÉ 4.3.1. Machine Readable Information ΓòÉΓòÉΓòÉ
If the library contains translatable pieces of information, they are contained
in resource files available in the MRI sub-directory of the ZCV directory,
created at installation time (see Installation).
To use these resource files, move all the header files in the H sub-directory
to the appropriate path in your development environment, translate the resource
files to the target language, recompile the file by using the command
rc -r <resource>.RC
to generate the corresponding RES file, and apply the result to the DLL file by
using the command
rc <resource>.RES <name>.DLL
Note that <name> is not FMZCVFUN but the name of the DLL cloned as described in
Create your own library.
ΓòÉΓòÉΓòÉ 4.3.2. Signal handling ΓòÉΓòÉΓòÉ
FMZCVFUN.DLL enables the handling of signals as follows.
First, each exported function is preceeded in code by the corresponding pragma
handler:
Sample
#pragma handler(zcvLibraryVersion)
VOID EXPENTRY zcvLibraryVersion
.
.
.
Second, a standard function, available in any Z Family/2 reusable library, is
provided to register a user's signal handler: zcvRegisterSignal (see
zcvRegisterSignal).
The user's signal handler is a function that accepts as input parameter an
integer, and returns a void. Here is a sample signal handler:
Sample
void UserSignalHandler (int signal)
{
switch (signal)
{
case SIGILL : /* Prepare to handle SIGILL */ break ;
case SIGSEGV : /* Prepare to handle SIGSEGV */ break ;
case SIGFPE : /* Prepare to handle SIGFPE */ break ;
case SIGTERM : /* Prepare to handle SIGTERM */ break ;
case SIGABRT : /* Prepare to handle SIGABRT */ break ;
case SIGINT : /* Prepare to handle SIGINT */ break ;
case SIGUSR1 : /* Prepare to handle SIGUSR1 */ break ;
case SIGUSR2 : /* Prepare to handle SIGUSR2 */ break ;
case SIGUSR3 : /* Prepare to handle SIGUSR3 */ break ;
case SIGBREAK: /* Prepare to handle SIGBREAK */ break ;
default : /* Unknown signal */ break ;
}
/*
** Handle the received signal according to the previous
** preparation. In general, show a message and terminate
** the program.
*/
}
ΓòÉΓòÉΓòÉ 4.3.3. Create your own library ΓòÉΓòÉΓòÉ
It is possible for the reuser to decide to clone a Z Family/2 reusable library
with a different name. Since the source code is not available to reusers, it
is possible to do that by using the files in the DEVEL sub-directory.
Important These files are not intended to be used as they are, but should be
modified as described below.
The DEVEL directory contains at least four files:
ZCVFUNCS.LIB An object library
ZCVFUNCS.DEF A skeleton for the definition file
ZCVCLONE.MAK A skeleton for the make file
ZCVSTUB.C A stub file used to generate the library
In addition, it may also contain one or more resource files, that is
ZCVxxxxx.RES files.
Important
This library may need to load resources from itself, or to get its module
handle. If you clone the library and change its name, it has no way to
automatically know which is its new name. So you need to tell it about. You
can do that by using the zcvSetLibraryName() function.
ΓòÉΓòÉΓòÉ 4.3.4. Create your own library ΓòÉΓòÉΓòÉ
To generate a clone of FMZCVFUN.DLL with a different name, you have to execute
the following steps:
1. Edit ZCVCLONE.MAK (see Skeleton of a makefile to clone a Z Family/2 DLL)
changing USRNAME to the desired name. Let's say, for example, DLLCLONE.
You may add other instructions to this make file, but be careful if you
change the existing ones. In particular, the OPTIONS constant contains
the same options used to compile FMZCVFUN.DLL. If you change them, the new
DLL may not work as expected.
Skeleton of a makefile to clone a Z Family/2 DLL
#
# Module : ZxxCLONE.MAK
# Authors : Luca Miccoli (MICCOLI at ROMEPPC)
# Reviewer : Dario de Judicibus (DEJUDICI at ROMEPPC)
# Created : 06 Apr 1993
# Reviewed : 21 Apr 1993
# Version : 1.00
# Content : Make File for Z Family/2 Clones
#
# ------------------------------------------------------------------------------
#
# NOTE : This is a SAMPLE makefile. You may need to modify it to satisfy your
# specific needs. You may also want to include it in a larger MAKE file
# which is used to generate your application. In any case, read carefully
# the comments below and the "User's Guide", to understand what you can
# change, and what should be used as is.
# ------------------------------------------------------------------------------
#
# User provided name of the .DLL (to be filled)
#
USRNAME = ________
STBNAME = zxxstub
INTNAME = zxxfuncs
RESNAME = zxxrsrcs
#
# Do not change OPTIONS unless really needed. They SHOULD match the original ones.
#
OPTIONS = /Kb /Ge- /Sm /Ss /Gd- /Gm+ /Ms /I-
LINKOPT = /NOI
#
# MAKE file generates a DLL and the corresponding IMPORT library having the
# name specified as USRNAME above.
#
all: $(USRNAME).dll $(USRNAME).lib
#
# STUB should be compiled by using the same options used for Z Family/2 DLL
#
$(STBNAME).obj: $(STBNAME).c
icc /C+ $(OPTIONS) $(STBNAME).c
#
# Use STUB and Z Family/2 OBJECT library to generate the User's Cloned DLL
# Use $(INTNAME).def to make your $(USRNAME).def, changing the name after
# LIBRARY (first instruction of the definition file).
#
$(USRNAME).dll: $(STBNAME).obj $(INTNAME).lib $(USRNAME).def $(RESNAME).res
link386 $(LINKOPT) $(STBNAME).obj,$(USRNAME).dll,,$(INTNAME).lib,$(USRNAME).def ;
rc $(RESNAME).res $(USRNAME).dll
#
# Use the User's Cloned DLL to generate the corresponding IMPORT library
#
$(USRNAME).lib: $(USRNAME).dll $(USRNAME).def
implib $(USRNAME).lib $(USRNAME).def
2. Edit ZCVFUNCS.DEF (see Skeleton of a definition to clone a Z Family/2 DLL)
changing the name after LIBRARY keyword to the desired name, that is,
DLLCLONE.
Skeleton of a definition to clone a Z Family/2 DLL
;
; Module : ZxxFUNCS.DEF
; Authors : Dario de Judicibus (DEJUDICI at ROMEPPC)
; Mario Turaccio (TURACCIO at ROMEPPC)
; Reviewer : Dario de Judicibus (DEJUDICI at ROMEPPC)
; Created : 21 Oct 1991
; Updated : 01 Apr 1993
; Version : 1.00
; Content : Module Definition File for FMZLXFUN.DLL
; Product : Z Family/2 Project (5641-504) FMZ
;
LIBRARY FMZxxFUN INITINSTANCE TERMINSTANCE
DESCRIPTION '... , Z Family/2 5641-504 (C) Copyright IBM Corporation 1993,1994.'
PROTMODE
CODE LOADONCALL
DATA MULTIPLE READWRITE NONSHARED
HEAPSIZE 32768
STACKSIZE 32768
IMPORTS
FMZyyFUN.zgsLibraryVersion
FMZyyFUN.zgsRegisterSignal
...
EXPORTS
zxxLibraryVersion
zxxRegisterSignal
...
3. Generate the new DLL by executing:
NMAKE - af ZCVCLONE.MAK
ΓòÉΓòÉΓòÉ 4.3.5. How to use the object library ΓòÉΓòÉΓòÉ
An object library called ZCVFUNCS.LIB is available in DEVEL sub-directory.
Such a library is provided to allow the user to clone the FMZCVFUN.DLL library,
as explained in Create your own library.
Important
You may also decide to clone only few function rather than the whole
library. However you cannot use this library to statically link some library
function to your program. In fact, those functions which may need to load
resources from the DLL itself, or to get the library handle to perform
specific activities, wouldn't work any more. This use of the object library
is not supported. You may do that, but at your own risk.
ΓòÉΓòÉΓòÉ 5. Reference Manual ΓòÉΓòÉΓòÉ
Select one:
Function sheets
Macro sheets
Data sheets
ΓòÉΓòÉΓòÉ 5.1. Function sheets ΓòÉΓòÉΓòÉ
Select one:
Γûá zcvLibraryVersion
Γûá zcvSetLibraryName
Γûá zcvRegisterSignal
Γûá zcvAllocTable
Γûá zcvClearTable
Γûá zcvConvertCharStream
Γûá zcvConvertTextFile
Γûá zcvCurrentCCSID
Γûá zcvFreeTable
Γûá zcvIsCCSIDSupported
Γûá zcvMakeTable
Γûá zcvQuerySupportedCCSIDs
ΓòÉΓòÉΓòÉ 5.1.1. zcvLibraryVersion ΓòÉΓòÉΓòÉ
Provide information about library version and the date and time of compilation
of the DLL source code.
Prototype
VOID EXPENTRY zcvLibraryVersion
(
zPLIBVERS pLibVers
) ;
Parameters
pLibVers
Pointer to a zLIBVERS structure. That structure should be allocated by
the caller. Its content, if any, will be overwritten.
result
The zLIBVERS structure whose pointer is provided as input parameter is
filled.
Notes
Look at zLIBVERS for the definition of zLIBVERS structure.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.2. zcvSetLibraryName ΓòÉΓòÉΓòÉ
Set the value of the private variable zcvDllName. See also Create your own
library.
Important If called, this function must be called before any other library
function.
Prototype
VOID EXPENTRY zcvSetLibraryName
(
PSZ szNewName
) ;
Parameters
szNewName
Pointer to the string containing the new name of library. If you pass a
NULL pointer or an empty string, the library name is set to its default,
that is zcvDLLNAME.
result
None.
Notes
If you clone FMZCVFUN.DLL, you obtain a new library with a new name. Since
this library may need to know its name to load resources or get its module
handle, you have to tell it which is the new name. You can use this function
to do that. The default name is zcvDLLNAME.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.3. zcvRegisterSignal ΓòÉΓòÉΓòÉ
It registers an application signal handler for exception handling.
Prototype
zSIGNAL EXPENTRY zcvRegisterSignal
(
zSIGHAND SigHandler
)
Parameters
SigHandler
Pointer to the application signal handler to be registered. Type is
zSIGHAND (see Z Family/2 general constants).
result
zREGISTERED if the handler has been successfully registered, otherwise it
returns the signal for which the registration failed. See Signal
handling types for the complete list of signals and their meaning.
Notes
Look at Signal handling for a description of the exception handling feature
provided by FMZCVFUN.DLL.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.4. zcvAllocTable ΓòÉΓòÉΓòÉ
Allocate an empty translation table that can be later filled by using
zcvMakeTable() or directly by the programmer.
Prototype
BOOL EXPENTRY zcvAllocTable
(
zcvTABLE *ptable
)
Parameters
ptable
Pointer to a variable of type zcvTABLE (see zcvTABLE) which will receive
the pointer to the allocated table. In fact, note that zcvTABLE is a
pointer too (see Tables for details).
result
If the empty table is allocated, the referenced variable is filled with
its pointer, and TRUE is returned. If for any reason the function fails,
it returns FALSE.
Notes
None.
Known bugs
Currently the table cannot be accessed by the C/C++ debugger IPMD.
ΓòÉΓòÉΓòÉ 5.1.5. zcvClearTable ΓòÉΓòÉΓòÉ
Clear a translation table, previously allocated by zcvAllocTable(), so that it
can be reused for another coded character set pair.
Prototype
VOID EXPENTRY zcvClearTable
(
zcvTABLE table
)
Parameters
table
The table to be cleared. Its type is zcvTABLE (see zcvTABLE), which is
really a pointer to a memory area (see Tables for details).
result
None.
Notes
None.
Known bugs
Currently the table cannot be accessed by the C/C++ debugger IPMD.
ΓòÉΓòÉΓòÉ 5.1.6. zcvConvertCharStream ΓòÉΓòÉΓòÉ
Convert a character stream according to the provided translation table.
Prototype
BOOL EXPENTRY zcvConvertCharStream
(
zcvSTREAM instream ,
zcvSTREAM outstream ,
ULONG strsize ,
zcvTABLE table
)
Parameters
instream
The character stream to be converted. It may contain any character in
0x00 to 0xFF range, NULL included.
outstream
The character stream to be filled with the result of the translation. It
may contain any character in 0x00 to 0xFF range, NULL included.
strsize
The size in bytes (or characters) of the input stream (the output stream
will have the same size), or zcvNULLTERM if the character stream must be
handled as a null-terminated string.
table
The translation table to be used for converting the input stream.
result
In the above mentioned former case, the function returns TRUE, in the
latter case or if the function failed, it returns FALSE.
Notes
If strsize is zcvNULLTERM anyway, the character streams are handled as null
terminated strings. In such a case the translation terminates at the first
occurrence of a NULL character, and the output stream is null terminated too
(i.e. the termination character is not involved in the translation).
It's a caller's responsibility to allocate the output buffer outstream. Note
that zcvSTREAM is really a pointer to a buffer, which must be explicitely
allocated. See Streams for details.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.7. zcvConvertTextFile ΓòÉΓòÉΓòÉ
Convert a text file according to the provided translation table.
Prototype
BOOL EXPENTRY zcvConvertTextFile
(
PSZ infile ,
PSZ outfile ,
ULONG behaviour ,
zcvTABLE table
)
Parameters
infile
The filename of the file to be converted, provided as in the standard C
function fopen(). It may contain any character in 0x00 to 0xFF range,
NULL, CSI and escape control sequences. included.
outfile
The filename of the output file, provided as in the standard C function
fopen().
behaviour
A flag indicating how the function should behave in relation to the
existence of the output file. The following values are supported:
zcvCREATE Create the output file if it doesn't exist (option A).
zcvFAILIFNEW Fail if the output file doesn't exist (option A).
zcvREPLACE Replace the output file if it already exist (option B).
zcvAPPEND Append to the output file if it already exist (option
B).
zcvFAILIFEXISTS Fail if the output file already exist (option B).
behaviour may consist of one of the two option A, or one of the three
option B, or of the combination of an option A and and option B. In the
first two cases, or if the flag is null, the following defaults apply:
o zcvCREATE
o zcvREPLACE
table
The translation table to be used for converting the input file.
result
If the file is successfully converted, the function returns TRUE,
otherwise it returns FALSE.
Notes
None.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.8. zcvCurrentCCSID ΓòÉΓòÉΓòÉ
Returns the first CCSID out of the list of those prepared for the machine where
the program is running.
Prototype
BOOL EXPENTRY zcvCurrentCCSID
(
zcvCCSID *pccsid
)
Parameters
pccsid
The pointer to a variable of type zcvCCSID to be filled with the
requested codepage, if available, or zcvNOTPREPARED if none was prepared.
result
In the above mentioned former case, the function returns TRUE, in the
latter case or if the function failed, it returns FALSE.
Notes
None.
Known bugs
None.
ΓòÉΓòÉΓòÉ 5.1.9. zcvFreeTable ΓòÉΓòÉΓòÉ
Free a translation table previously allocated by zcvAllocTable(),
Prototype
BOOL EXPENTRY zcvFreeTable
(
zcvTABLE table
)
Parameters
table
The table to be freed. Its type is zcvTABLE (see zcvTABLE), which is
really a pointer to a memory area (see Tables for details).
result
If the empty table is freed, TRUE is returned. If for any reason the
function fails, it returns FALSE.
Notes
None.
Known bugs
Currently the table cannot be accessed by the C/C++ debugger IPMD.
ΓòÉΓòÉΓòÉ 5.1.10. zcvIsCCSIDSupported ΓòÉΓòÉΓòÉ
Check if the specified CCSID is supported by zcvMakeTable().
Prototype
BOOL EXPENTRY zcvIsCCSIDSupported
(
zcvCCSID ccsid
)
Parameters
ccsid
The coded character set identifier to be checked against the list of
those supported by zcvMakeTable().
result
TRUE if the CCSID is supported by zcvMakeTable(), otherwise FALSE .
Notes
None.
Known bugs
Supported CCSIDs are statically hardcoded in function, since there is no way,
at the moment, to obtain them dinamically from the system. This may cause a
bug if and when the list of the CCSIDs supported by ACSSVC.DLL will change in
future (see Supported CCSIDs for additional details).
ΓòÉΓòÉΓòÉ 5.1.11. zcvMakeTable ΓòÉΓòÉΓòÉ
Built a translation table that was previously allocated by using
zcvAllocTable(), from a supported coded character set to another.
Prototype
BOOL EXPENTRY zcvMakeTable
(
zcvTABLE table ,
zcvCCSID sccsid ,
zcvCCSID tccsid
)
Parameters
table
The table to be filled with the translation code points. See zcvTABLE for
details on zcvTABLE type.
sccsid
The coded character set of the source. It must be one of the CCSID
supported by ACSSVC function of ACSSVC.DLL.
tccsid
The coded character set of the target. It must be one of the CCSID
supported by ACSSVC function of ACSSVC.DLL.
result
If the table is filled, the function returns TRUE is returned. If for
any reason the function fails, it returns FALSE .
Notes
None.
Known bugs
Currently the table cannot be accessed by the C/C++ debugger IPMD.
ΓòÉΓòÉΓòÉ 5.1.12. zcvQuerySupportedCCSIDs ΓòÉΓòÉΓòÉ
Return the list of all the CCSID's supported by zcvMakeTable().
Prototype
VOID EXPENTRY zcvQuerySupportedCCSIDs
(
zcvCCSID *pccsid
)
Parameters
pccsid
The pointer to an array of elements of type zcvCCSID. to be filled with
all the CCSID's supported by zcvMakeTable().
result
None.
Notes
The array must be allocated by the caller, and contain at least 64 elements.
The function won't check the array dimension, anyway. The list terminates when
a null CCSID is found (zcvENDOFLIST).
Known bugs
Supported CCSIDs are statically hardcoded in function, since there is no way,
at the moment, to obtain them dinamically from the system. This may cause a
bug if and when the list of the CCSIDs supported by ACSSVC.DLL will change in
future (see Supported CCSIDs for additional details). system.
ΓòÉΓòÉΓòÉ 5.2. Macro sheets ΓòÉΓòÉΓòÉ
This library has no macros.
ΓòÉΓòÉΓòÉ 5.3. Data sheets ΓòÉΓòÉΓòÉ
Select one:
Γûá zLIBVERS
Γûá Signal handling types
Γûá zcvTABLE
Γûá zcvSTREAM
Γûá zcvCCSID
Γûá Library constants
Γûá Z Family/2 general constants
ΓòÉΓòÉΓòÉ 5.3.1. zLIBVERS ΓòÉΓòÉΓòÉ
This structure is used by all Z Family/2 DLL's to maintain information about
the level of the library, and the date and time of compilation of library
source code.
Structure
typedef struct zLibVersion
{
USHORT Version ;
USHORT Release ;
USHORT Modification ;
CHAR String[zLEVELSIZE] ;
CHAR Stamp[zSTAMPSIZE] ;
CHAR Name[zNAMESIZE] ;
}
zLIBVERS, *zPLIBVERS ;
Fields
Version
Library version. Updated only when major functional changes are applied
to the library code.
Release
Library release. Updated only when minor functional changes are applied
to the library code.
Modification
Library modification. Updated when fixes are applied to the library
code.
String
A string containing the library level (version plus release). It must
match the values of version and release.
Stamp
A string containing the compilation time stamp. Usually the C Set/2
predefined constant __TIMESTAMP__ is assigned to this field.
Name
A string containing the library name. If the library was cloned with a
different name, and zcvSetLibraryName() was previously called, this
string contains the name of the clone.
Include file
zgeneral.h
Notes
This structure is the same for all the Z Family/2 DLL's.
ΓòÉΓòÉΓòÉ 5.3.2. Signal handling types ΓòÉΓòÉΓòÉ
Two types are used in the signal handling feature of FMZCVFUN.DLL: zSIGHAND
and zSIGNAL.
zSIGHAND is the pointer to a signal handler function that can be used as
argument when zcvRegisterSignal() is called (see Signal handling for details
about how to write a signal handler).
zSIGNAL is the signal event that may be returned by zcvRegisterSignal() if the
registration of the signal handler fails.
Definition
typedef int zSIGNAL ;
typedef void (*zSIGHAND)(int) ;
Signals
This is the list of the possible values whose type is zSIGNAL.
SIGILL
Illegal instruction (invalid function image)
SIGSEGV
Invalid access to memory
SIGFPE
Floating point exception
SIGTERM
OS/2 SIGTERM (killprocess) signal
SIGABRT
Abort() signal
SIGINT
OS/2 SIGINTR signal
SIGUSR1
User exception in range 0xA0000000-0xBFFFFFFF
SIGUSR2
User exception in range 0xC0000000-0xDFFFFFFF
SIGUSR3
User exception in range 0xE0000000-0xFFFFFFFF
SIGBREAK
OS/2 Ctrl-Break sequence
Include file
zgeneral.h
Notes
These types are the same for all the Z Family/2 DLL's.
ΓòÉΓòÉΓòÉ 5.3.3. zcvTABLE ΓòÉΓòÉΓòÉ
This type is defined as a pointer 16 to a memory area allocated within a 64K
segment and alligned to a short word (2 bytes).
Type
typedef PCHAR16 zcvTABLE ;
Then, defining a variable of type zcvTABLE does not mean that the corresponding
table has been defined. It is necessary to use zcvAllocTable() to properly
allocate the table so that it can be filled by zcvMakeTable().
Include file
zcvtypes.h
Notes
In order to use zcvTABLE type, it is necessary to compile your application by
using the /DES32TO16 option, that is the ES32TO16 constant must be defined.
ΓòÉΓòÉΓòÉ 5.3.4. zcvSTREAM ΓòÉΓòÉΓòÉ
This type is defined as the pointer to a buffer which contains a stream of
characters or a null terminated string.
Type
typedef CHAR *zcvSTREAM ;
Include file
zcvtypes.h
Notes
None
ΓòÉΓòÉΓòÉ 5.3.5. zcvCCSID ΓòÉΓòÉΓòÉ
This type is defined as a long word which contains a coded character set
identifier.
Type
typedef ULONG zcvCCSID ;
Include file
zcvtypes.h
Notes
None
ΓòÉΓòÉΓòÉ 5.3.6. Library constants ΓòÉΓòÉΓòÉ
The following constants can be used by the applications that are dynamically
linked to FMZCVFUN.DLL.
zcvDLLNAME
The default name of this library. Note that, if you clone this library,
the real name must be changed by using the zcvSetLibraryName() function.
In such a case, you cannot use any more this constant.
zcvZPREFIX
The Z Family/2 identifier of this library.
zcvNULLTERM
Used as the size of a character stream when zcvConvertCharStream() to
signal that the stream is really a null terminated string.
zcvNOTPREPARED
Returned by zcvCurrentCCSID() if no codepage has been prepared when the
function is called.
zcvENDOFLIST
Indicates that there are no more CCSID's in the list returned by
zcvQuerySupportedCCSIDs().
zcvCREATE
Flag used to define the behaviour of zcvConvertTextFile() if the file
doesn't exist: create the file (default).
zcvFAILIFNEW
Flag used to define the behaviour of zcvConvertTextFile() if the file
doesn't exist: fail if file doesn't exist.
zcvREPLACE
Flag used to define the behaviour of zcvConvertTextFile() if the file
already exist: replace an existing file (default).
zcvAPPEND
Flag used to define the behaviour of zcvConvertTextFile() if the file
already exist: append to an existing file.
zcvFAILIFEXISTS
Flag used to define the behaviour of zcvConvertTextFile() if the file
already exist: fail if file exists.
Include file
zcvdefs.h
Notes
None.
ΓòÉΓòÉΓòÉ 5.3.7. Z Family/2 general constants ΓòÉΓòÉΓòÉ
The following constants are shared by all Z Family/2 DLL's.
zPRODPREF
Z Family/2 three-character product prefix (ZCV).
zPRODNUMB
Z Family/2 product number (5641-504).
zCOPYRIGHT
Z Family/2 copyright statement.
zNAMESIZE
Maximum size of Name string in zLIBVERS.
zLEVELSIZE
Maximum size of Level string in zLIBVERS.
zSTAMPSIZE
Maximum size of Stamp string in zLIBVERS.
zNULLERRORID
Null error identifier. To be used when the error identifier can be
ignored by the called function.
zEXEMINERRID
Minimum value of error identifiers for user applications.
zEXEMAXERRID
Maximum value of error identifiers for user applications.
zDLLMINERRID
Minimum value of error identifiers for the Z Family/2 DLL's.
zDLLMAXERRID
Maximum value of error identifiers for the Z Family/2 DLL's.
zSIGNAL
Z Family/2 signal type for signal handling.
zSIGHAND
Z Family/2 signal handler type for signal handling.
zBIT
Z Family/2 type used for unsigned bits.
Include file
zgeneral.h
Notes
Error identifiers are used to identify both the error itself, and the message
associated with it.
ΓòÉΓòÉΓòÉ 6. Sample Program ΓòÉΓòÉΓòÉ
Select one:
Running the sample program
Sample program tutorial
ΓòÉΓòÉΓòÉ 6.1. Running the sample program ΓòÉΓòÉΓòÉ
Important
To run the sample program, you must already have installed the library as
described in How to install the library.
Do not double-click on the item below unless
1. you copied the sample program to a directory listed in your PATH, or added
the directory where the sample program is to your PATH.
2. you copied all the needed dynamic libraries to a directory listed in your
LIBPATH, or added the directory where such libraries are to your LIBPATH.
Hit me to run the sample
ΓòÉΓòÉΓòÉ 6.2. Sample program tutorial ΓòÉΓòÉΓòÉ
The FMZCVFUN.DLL package also contains a sample program that shows how to use
the DLL functions.
The program is called CVTEST and can be launched either from an OS/2 window
(or full-screen), or from the OS/2 Desktop, double-clicking on its icon.
When the program is executed, a small windows appear on the screen.
CVTEST window has only a single pull-down menu, called Translate. If you open
that menu you can see four items:
Strings...
A dialog box is displayed. Its title is Translate String. The dialog is
divided in two similar sections.
The left side is used to enter the source string to be converted. It
also contains a read-only entry field for the source coded character
set identifier (CCSID). In fact, you cannot select the CCSID of that
string, since you cannot in any case enter a string by using a CCSID
different from the current one prepared on your machine.
The right side allows you to select the target CCSID by using a drop
down list. As you press the Translate button which is placed in the
lower part of the dialog, just in the middle, the string is converted
and the result is shown in the right side of the dialog.
You may change the target CCSID and test the conversion of the same
input string several times. When you have finished, press the OK button
to close the dialog. Of course, if the conversion fails for any reason,
an appropriate error message is displayed.
Files...
A dialog box is displayed. Its title is Translate File. The dialog is
divided in two similar sections.
The left side is used to enter the name of the source file to be
converted. It also contains a drop down list to select the source
coded character set identifier (CCSID). If you don't remember the name
of the source file, just press the Select source button below the entry
field, to get the File Requester.
The right side allows you to select the target CCSID by using a drop
down list, and specify the name of the output file. You may select an
already existent file by using the Select target button below the entry
field, as for the source file. As you press the Translate button which
is placed in the lower part of the dialog, just in the middle, the file
is converted and a message is displayed.
You may change the target CCSID and test the conversion of the same
input file several times. When you have finished, press the
OK button to close the dialog.
Of course, if the conversion fails for any reason, an appropriate error
message is displayed.
About
A message box containing the name of the library, its version, the
author and some other related information (eg. copyright) is displayed.
The first two fields are obtained by the zcvLibraryVersion() function.
Exit
The user is prompted for the confirmation of the EXIT request.
Program ends.