752shrd0gb PDF
752shrd0gb PDF
Valid for:
Esa/Gv s.r.l.
15 via Zamboni, CP 43
41011 Campogalliano Modena Italy
tel. +39 059 851414 - fax +39 059 851313
http://www.esagv.it - E-mail: info@esagv.it
Restrictions Duplication, transmission and use of this document or its contents shall be considered
prohitibed unless prior authorization has been received from Esa/Gv. All rights are
reserved.
Even when authorized, modification of this document (either by computer or on paper)
voids the guarantees specified below.
Guarantees The product may offer performances that are not described in these manuals. Esa/Gv
shall neither be obliged to maintain these functions in new versions of the product nor
to guarantee the relative assistance.
Checks have been carried out in order to ensure that the contents of these manuals
correspond to the documented product. Despite this fact, there may be discrepancies.
Esa/Gv therefore offers no guarantees as to the full compliance and completeness of the
texts.
The information in this document is periodically revised and new editions are issued
when necessary.
This manual has been compiled in partial compliance with ANSI/IEEE std 1063-1987
“IEEE Standard for software User Documentation”.
Editions This document is liable to be modified without prior notice. These modifications may
involve further editions or revisions of the document.
Further editions imply complete substitution of the document.
Revision involves replacement/addition/elimination of pages of the document.
Each page is identified by the code of the document at the bottom.
Notes
MS-DOS® Trademark registered by Microsoft Corporation.
ii 91752.SHRD.0.GB Esa/Gv
The chronological list of editions of this document is given in the following table:
Modifications
Release Chapters - Pages Description
Technical Reference
Esa/Gv 91752.SHRD.0.GB i
Technical Reference SHRD
END OF SUMMARY
ii 91752.SHRD.0.GB Esa/Gv
SHRD Notes for the reader
General information The information in this manual only applies to the software versions indicated on the
frontispiece.
Not all the available functions may be described in this manual. In these cases, Esa/Gv
shall be obliged to neither guarantee these functions nor include them in future
versions.
Purpose The purpose of this document is to facilitate the use or modification of parts of the
software that use numeric control data.
Use of the document The document is divided into chapters that describe how parts of the software that uses
numeric control data can be created or modified.
Notification of Please contact Esa/Gv if any difficulties should arise when this manual is used.
difficulties
Esa/Gv 91752.SHRD.0.GB i
Notes for the reader SHRD
Graphic symbols may appear beside the text. These are used to emphasize information
of particular importance.
Attention
This symbol is used when failure to take the appropriate precautions could cause
slight damage to persons and property.
Danger
This symbol appears when failure to take the appropriate precautions or
accomplishment of incorrect manoeuvres could cause serious damage to persons
and/or property.
Important
This symbol appears in the manual to indicate information of particular importance. It
is essential to read these sections in order to fully understand the manual.
Option
This symbol indicates sections of the manual that describe optional functions or parts.
Use of optional performances must be established with the machine manufacturer.
Manufacturer
This symbol indicates those sections of the manual reserved to the machine
manufacturer.
Password
This symbol indicates sections of the manual that describe functions access to which is
safeguarded by software passwords.
CN
This symbol indicates sections of the manual that describe functions only available in
CN and not in the PC.
PC
This symbol indicates sections of the manual that describe functions only available in
the PC and not in CN.
ii 91752.SHRD.0.GB Esa/Gv
SHRD Notes for the reader
Printer’s conventions
Particular printer’s conventions are used to make it easier to identify the information in
this manual. These conventions are illustrated below.
Glossary
END OF PREFACE
iv 91752.SHRD.0.GB Esa/Gv
SHRD The Shared Library: Introduction
1.1 Introduction
This library provides services for accessing the system’s information stored in the
shared memory; it is supported by the communications library, and its use is
simplified, masking the connection to the registers and the knowledge of the symbolic
name of the registers which it accesses.
Access to the information contained in the Shared Memory requires a preliminary
connection phase, necessary for subsequent accesses for reading from or writing to the
register.
The library has the task of pre-connecting all the system registers, to enable them
subsequently to be accessed more rapidly. Use of the library also guarantees
compatibility relative to any re-organization to the data structure that hosts the
information.
The library incorporates functions such as request packing and the management of a
virtual instance of the database – functions that enable access times to be optimized.
To be able to use the DLL it is necessary to link the VShared.lib library (release
version) or VsharedD.dll (debug version) to the project under development, which is
located in the C:\Kvara\Lib directory; the latter exports the functions of the DLL.
The static libraries are created using Microsoft® development environments, which
use the COFF format. If you wish to use different development environments you must
check whether or not these are compatible; if they are not, you cannot perform the
library link, but the DLL must be loaded implicitly (LoadLibrary method or
equivalent) and the services linked by symbol (GetProcAddress method or
equivalent).
All the functions are exported using the extern "C" format to prevent their
decoration.
You must also include the Shared.h file in each file that accesses the library services.
Using the functions provided by the communication, you can create a SharedMemory
instance that is so-called Virtual, i.e. that does not access the memory that resides on
the CNC, but references a copy local to the process that effects the accesses.
Having a shared virtual instance allows you to obtain much faster access times.
However, the synchronization of the two instances – the “real” one and the “virtual”
one – is not automatic, but must be explicitly achieved by whoever intends to make use
of it.
The DLL handles access to one instance rather than another in implicit mode. It is
sufficient at the time of initialization of the resources to specify whether the thread uses
the “real” shared instance rather than the “virtual” one. In one case the accesses to the
system registers in shared memory use the “real” addresses (TS_REG):, in the other
the “virtual” addresses (TS_REG).
Accessing real or By default, each thread accesses the real shared instance; to access the virtual shared
shared instances instance it must explicitly call up the InitShared that initializes the base TS_REG for
accessing the respective structures in SharedMemory. A parameter of the InitShared
establishes whether or not the TS_REG relative to the real Shared instance must be
initialized, or whether those relative to the virtual instance. The InitShared must be
called up for each process that intends to make use of the services made available by
the VSharedDLL.
Selecting the shared Subsequently, you should use the SelectShared function for selecting the shared
or real instance instance to be accessed (real or virtual).
The SelectShared may be called up several times by the same thread, to modify the
shared instance you wish to access; this ensures that the TS_REGs relative to the
selected instance are initialized. By default, a thread accesses the real Shared instance.
De-installing the Use the ExitShared on exiting the process for de-installing the VSharedDLL.
VSharedDLL
Checking the Call up the SHRInstance to obtain the instance currently selected.
instance currently The value returned by SHRInstance must be supplied as a parameter to the
selected get_reg_by_name_ex in order to connect a register that is not a system one, to the
virtually shared instance. Provided you know the virtual TS_REG, you can use the
normal Communications functions (Read_Reg ... Write_Reg... ) and thus access any
register of the Virtually Shared instance.
Example
//creates a VIRTUAL INSTANCE of SharedMemory
//and initialises the ShareDLL on the Virtual instance
HandleVirtual = CreateVirtualShared();
InitShared(HandleVirtual);
ExitShared();
You can compress the requests to the communications server to reduce the
communication protocol overhead. This operation allows you to reduce the access
times to the Shared Memory considerably.
This solution is very useful when GUI and CNC use communications channels that
are not very fast.
The functions of the SharedDLL provide a set of services that are useful for achieving
multiple accesses also to non-system registers.
Function name
_EndSharedReport
_SetCallStackReport
_SetStatusReport
_StartSharedReport
AppendRequest
BeginPackedOperation
EndPacketOperation
ExitShared
FlushPackedOperation
GetOffParam
GetRegVa
GetRegVg
GetRegVl
InitShared
PgmClearerr
PgmClose
PgmEnd
PgmErr
PgmFeof
PgmGetc
PgmGets
PgmOpen
PgmRewind
PgmSeek
PgmTell
ReadIOOutputWord
ReadIOWord
SelectShared
SHRInstance
ShrRaedCNStatus
ShrReadAxes
ShrReadAxNBit
ShrReadAxNVel
Function name
ShrReadChan
ShrReadCnfChan
ShrReadGeoChan
ShrReadHeader
ShrReadOrigin
ShrReadParAxes
ShrReadUiPlc
ShrReadVarR
SrhReadParConf
StartPackedOperation
WriteAxes
WriteAxNBit
WriteAxNVel
WriteCnfChan
WriteGeoChan
WriteIOWord
WriteOrigin
WriteParAxes
WriteParChan
WriteParConf
WriteUiPlc
WriteVarR
END OF CHAPTER
The functions of this group are used for initializing the use of the DLL and for closing
the work session.
The services of the DLL are not available if the initialization function has not first
been called up; similarly, it is essential to call up the closing function before closing
the communication with the NC.
Syntax
(int) InitShared(LONG Location)
This function must be called up at the start of every process that involves using the
functions provided by SharedDLL.
Parameters
Reply codes
Example
if( KENVInitGlobalTable() ) {
if( iErr = _EstablishResourceLocation() ) {
return(RET_KO);
}
}
iErr = InitShared(0);
if( iErr ) {
KENVFreeGlobalTable()
return(RET_KO);
}
//for packed requests
iErr = BeginPackedOperation();
Syntax
(int) ExitShared()
Description De-installs the DLL; after having called it up, you will no longer be able to access the
services of the DLL until a new initialization has been performed.
Reply codes
Example
EndPackedOperation();
ExitShared();
KenvFreeGlobalTable();
2.2.1 SelectShared
Syntax
(int) SelectShared(LONG Location)
Parameters
2.2.2 SHRInstance
Syntax
(LONG)SHRInstance()
Reply codes
These functions perform read and write operations on the vectors that contain the
configuration data of the machine contained by the cg[] vector.
Syntax
(int) WriteParConf( long value,
int field)
Parameters
Field field values The field field may assume one of the following values:
Reply codes
Example
long lTmp;
iErr = ShrReadParConf( CN_NUMCHAN, &lTmp );
if( iErr != RET_OK ) {
return( iErr );
//the read terminated incorrectly
}
iErr = WriteParConf(10,CN_NUMAX);
if( iErr != RET_OK ) {
return( iErr );
// the write terminated incorrectly
}
Syntax
(int) ShrReadParConf( int field,
long *pVal);
Description Reads the specified register; the value returned is only significant if the function
terminates correctly.
Parameters
pVal Address of the variable to which the value read from the
SharedMemory is returned.
Field field values The field field may assume one of the following values:
Reply codes
Example
long lTmp;
iErr = ShrReadParConf( CN_NUMCHAN, &lTmp );
if( iErr != RET_OK ) {
return( iErr );
//the read terminated incorrectly
}
iErr = WriteParConf(10,CN_NUMAX);
if( iErr != RET_OK ) {
return( iErr );
// the write terminated incorrectly }
The channel registers reference a cn[] Table whose index selects the channel in
question; this, in turn, contains Sub-Tables, corresponding to each of the categories
described below.
Syntax
(int) WriteCnfChan( long value,
int nch,
int field)
Description
ShrReadCnfChan Reads the cn[nch].cc[field] register; the value returned is significant only if the
function terminates correctly.
Parameters
field Register selection index. May assume the values described in the Table
below.
pVal Address of the variable on which the value read from the SharedMemory is
returned.
Field field values The field field may assume one of the following values:
Reply codes
Example
iErr = ShrReadCnfChan( iCh, CC_MASKAXES, &Mask );
if( iErr != RET_OK )
return( iErr );
Syntax
(int) WriteParChan( long value,
int nch,
int field )
Description
ShrReadParChan Reads the cn[nch].pc[field] register; the value returned is only significant if the
function terminates correctly.
Parameters
field .pc[] register selection index. May assume the values indicated in the Table
below.
pVal Address of the variable to which the value read from the SharedMemory is
returned.
Field field values The field field may assume one of the following values:
Reply codes
Example
iErr = ShrReadParChan(iCh, CP_ACCTIME, &TimeAcc);
if( iErr != RET_OK )
return( iErr );
iErr = WriteParChan(50,iCh, CP_CMDA);
if( iErr != RET_OK )
return( iErr );
STATUS Registers The status registers provide information on what the channel is doing; a write to these
registers is not significant as the channel continually updates the value of the
registers.
COMMAND registers The command registers allow you to select the channel’s operating mode, which only
executes read operations on these registers. Modifying the contents of these registers
results in the execution of commands by the channel.
Generally, the PLC has the task of commanding the channel; this does not, however,
prevent a GUI application from commanding one or more channels by means of these
registers, provided that this does not cause conflicts in writing between the PLC and
GUI.
Syntax
(int) WriteChan( long value,
int nch,
int field )
Description
ShrReadChan Reads the cn[nch].rc[field] register; the value returned is significant only if the
function terminates correctly.
Parameters
field .rc[] register selection index. May assume the values indicated in the
Tables relative to the Status or Command registers.
pVal Address of the variable to which the value read from the SharedMemory
is returned.
Reply codes
COMMAND Registers: The following list shows the values allowed for the field field to gain access to the
field field values COMMAND registers.
STATUS Registers: The following list shows the values allowed for the field field for accessing the
field field values STATUS registers.
Example
iErr = WriteChan( (DWORD)ulPgm, iCh, CI_NUMPPGM );
if( iErr != RET_OK )
return( iErr );
iErr = ShrReadChan( iCh, CO_STATREG, &dwreg);
if( iErr != RET_OK )
return( iErr );
Syntax
(int) WriteGeoChan( long value,
int nch,
int field)
Description
ShrReadGeoChan Reads the cn[nch].gc[field] register; the value returned is significant only if the
function terminates correctly.
Parameters
field .gc[] register selection index. It may assume the values described in the Table
below.
pVal Address of the variable to which the value read from the SharedMemory is
returned.
Field field values The field field may assume the following values:
Reply codes
Example
iErr = WriteGeoChan( gType, iCh, GC_GEOTYPE);
if( iErr != RET_OK )
return( iErr );
iErr = ShrReadGeoChan( iCh, GC_X_ANG, &Beta);
if( iErr != RET_OK )
return( iErr );
The axes registers reference an ax[] Table, the index of which selects the axis in
question; this, in turn, contains Sub-Tables corresponding to each of the categories
described below.
Syntax
(int) WriteParAxes( long value,
int nax,
int field)
Description
ShrReadParAxes Reads the ax[nax].pa[field] register; the value returned is significant only if the
function terminates correctly.
GetOffParam Although the parameters have the same meaning, they may reside on different
registers, if the type of axis is different. The GetOffParam, starting from the specified
parameter, returns the correct index referenced to the type of axis in question.
Parameters
pVal Address of the variable to which the value read from the SharedMemory is
returned.
ShrReadParAxes and
WriteParAxes:
field field value
Proportional axes
The following is a list of the values allowed for the field field, for accessing the
parameters of a Proportional. Axis.
Spindle Axes
The following list show the values allowed for the field field for accessing the Spindle
parameters.
NVEL axes The following list show the values allowed for the field field for accessing the
parameters of an NVEL Axis.
Ram axes
The following list show the values allowed for the field field for accessing the
parameters of a Ram axis.
GetOffParam values,
field field
The following list show the values allowed for the field field for accessing the
parameters of a GetOffParam function.
Reply codes
Example
if( ShrReadParAxes(Ax,GetOffParam(Ax,QTARECG),&Qrg) )
Qrg=0;
iErr = WriteParAxes(Qta,Ax,GetOffParam(Ax, PARKQTA));
if( iErr != RET_OK )
return( iErr );
STATUS Registers The status registers provide information on what the axis is doing; a write operation to
these registers is not significant, because the axis continually updates the values of the
status registers.
The command registers make it possible to select a number of operating modes for the
axis, which performs only read operations on these registers.
COMMAND Registers
Generally, the PLC has the task of interacting with the axes on their command
registers; this, however, does not prevent a GUI application from controlling one or
more axes through these registers, provided that this does not create conflicts in
writing between the PLC and GUI.
Syntax
(int) WriteAxes( long value,
int nax,
int field)
Description
ShrReadAxes Reads the ax[nax].ra[field] register; the value returned is only significant if the
function terminates correctly.
Parameters
pVal Address of the variable to which the value read from the SharedMemory is
returned.
Command Registers, The following list shows the values allowed for the field field for accessing the
field field values Command registers.
Status Registers The following list shows the values allowed for the field field for accessing the Status
field field values registers.
Reply codes
Example
iErr = WriteAxes(ISO_NULLO, iAx, AO_ISOAXSTATUS);
if( iErr != RET_OK )
return( iErr );
iErr = ShrReadAxes(iAx, AO_MEASURE,&Measure);
if( iErr != RET_OK )
return( iErr );
These parameters are accessed using BaseMenu and activating the [Parameters] >
[System] > [Configure Axes] path from the shared editor; both the nvel[ ] and nbit[ ]
Tables are located on the same editing page.
Syntax
(int) WriteAxNVel( long value,
int nax,
int field)
Description
ShrReadAxNVel Reads the ax[nax].nvel[field] register; the value returned to pVal is significant only if
the function terminates correctly.
ShrReadAxNBit Reads the ax[nax].nbit[field] register; the value returned is significant only if the
function terminates correctly.
Parameters
field Register selection number. It may assume the values described in the Tables
relative to the axes.
pVal Address of the variable to which the value read from the SharedMemory is
returned.
Proportional axis and The following list shows the values allowed for accessing the axis configuration
Spindle field field registers, both for a Proportional axis and for a Spindle.
values
nvel[ ] Registers
nbit[ ] Registers
NVEL axis
field field value
The following list shows the values allowed for accessing the configuration registers of
an NVEL axis.
nvel[ ] registers
nbit[ ] Registers
*Ram axis The following list shows the values allowed for accessing the field field for configuring
field field value a Ram axis.
nvel[ ] Registers
Reply codes
Example
iErr = WriteAxNVel(Numregister,Ax,AP_REGONM);
if( iErr != RET_OK )
return( iErr );
if(ShrReadAxNVel(Ax, AP_REGFCHWIND, &NOut)== RET_OK){
iErr = ShrReadAxNBit(Ax,AP_BITFCHWAV,& NBitPHAv);
if ( iErr!= RET_OK ) {
return( iErr );
}
}
These functions perform read and write operations in the vector set-up for interfacing
between the ui[] GUI and PLC; it is necessary, therefore, to identify the register
address.
Access to these registers is not visible from BaseMenu, but the Basemenu itself
accesses these registers in read and write mode to provide certain information to the
PLC, for example, the mode selected, current channel number, or for reading the axis
number selected.
Syntax
(int) WriteUiPlc( long value,
int field )
Description
ShrReadUiPlc Reads the ui[field] register; the value returned is significant only if the function
terminates correctly.
Parameters
field ui[ ] register selection index. It may assume the values described in the
Table below.
pVal Address of the variable to which the value read from the SharedMemory
is returned.
Field field values The field field may assume one of the following values:
Reply codes
Example
iErr = WriteUiPlc( ChSel, PU_CHSEL);
if( iErr != RET_OK )
ChSel = 0;
iErr = ShrReadUiPlc( PU_CHSEL,&Tmp);
if( iErr == RET_OK )
ChSel = Tmp;
These functions distinguish the access to the different types of variables on the basis of
the value specified for a parameter; the meaning of the parameters depends on the type
of variable to which access is made.
Syntax
(int) WriteVarR( double dValue,
int iCh,
int iR,
int iNest,
unsigned char iType)
Description
WriteVarR Writes the value in the variable defined by the iCh, iNest and iR parameters.
ShrReadVarR Reads the variable defined by the iCh, iNest and iR parameters; the value returned is
significant only if the function terminates correctly
Parameters
iType Indicates the type of variable you wish to access and what its significant
parameters are. It may assume the values indicated in the Table shown
below.
PVal Address of the variable to which the value read from the SharedMemory is to
be returned.
The Table that follows indicates the possible values that a field of the iType may
assume, and which parameters are significant for each access. The non-significant
parameters cannot be omitted from the prototype of the function; their value, however,
is ignored.
Reply codes
Example
iErr = ShrReadVarR(
iCh, idxVar, Lev,
SHARED_T_VL_SELECT,
&dVal
);
if( iErr!= RET_OK)
Error(ERR2);
iErr = WriteVarR(
dval, iCh,
idxVar,Lev,
SHARED_T_VG_SELECT
);
if( iErr!= RET_OK)
Error(ERR21);
Syntax
(long) GetRegVg()
(long) GetRegVa()
(long) GetRegVl()
Description These functions return the dimensions of the relative arrays defined in SharedMemory
through the defcn file.
Example
if( idxVar < GetRegVl() ){
iErr = ShrReadVarR( iCh, idxVar, Lev,
SHARED_T_VL_SELECT, &dVal);
}
else
Error(ERR52);
These functions perform read and write operations on the Table containing the origins
of each channel, i.e. origins selected using the instructions G5 – G57; the data are
contained in the cn[].sr[].do[] vectors; it is necessary, therefore, to index the channel
number, the Table of origins (Table0 for G54, 1 for G55..) and the actual origin (0=X,
1=Y..).
These parameters are accessed using BaseMenu and activating the [Parameters] >
[Channel Origins ] path from the shared editor.
Syntax
(int) WriteOrigin( long value,
int nch,
int norig,
int field )
Description
ShrReadOrigin Reads the cn[ich].sr[norig].do[field] register; the value returned is significant only if
the function terminates correctly.
Parameters
norig sr[] array index of the origins [0-3] (associated with the settings of the
instructions from G54 to G57).
field Origin register selection index. It may assume the values described in the
Table that follows.
pVal Address of the variable to which the value read from the SharedMemory is
returned.
Field field values The field field may assume one of the following values:
Reply codes
Example
if( ShrReadOrigin(iCh, iCoord, OG_X, &offX )!=RET_OK)
offX= 0;
if( ShrReadOrigin(iCh, iCoord, OG_Y, &offY )!=RET_OK)
offY= 0;
if( ShrReadOrigin(iCh, iCoord, OG_Z, &offZ )!=RET_OK)
offZ= 0;
iErr = WriteOrigin(0,iCh, iCoord, OG_Z);
if( iErr != RET_OK )
return( iErr );
These functions allow you to access (for reading) the images of the input and output
cards, and to access only the output cards (for writing). Writing to an output board is
not performed directly on the hardware component, but on an image; firmware then
updates the board on which the writing was performed.
Syntax
(int) WriteIOWord( unsigned short Value,
int iR)
Description
ReadIOWord Reads the IW input register specified by the iR offset. The value returned is
significant only if the function terminates correctly.
ReadIOOutputWord Reads the QW output register specified by the iR offset. The value returned is
significant only if the function returns correctly.
Parameters
pVal Address of the variable to which the value read by the ReadIOWord
and ReadIOOutputWord functions is returned.
Reply codes
Example
if( WriteIOWord( IdxOut, Value) ){
return( iErr );
}
if( ReadIOWord( IdxInput, &dwValue) != RET_OK )
dwValue = 0;
if( ReadIOOutputWord( IdxOut, &dwValue) != RET_OK )
dwValue = 0;
Syntax
(int) ShrReadCNStatus( long *pVal)
Description
ShrReadCNStatus Returns the value of the CNSTATUS register. The value returned is only valid if the
function returns correctly.
ShrReadHeader Returns the value of the SHCHK register. The value returned is only valid if the
function returns correctly.
Parameters
pVal Address of the variable to which the value read from the function is
returned.
Reply codes
Example
iErr = ShrReadCNStatus(&Status);
if( iErr != RET_OK )
return( iErr );
iErr = ShrReadPLCStatus(&TestPLC);
if( iErr != RET_OK )
return( iErr );
iErr = ShrReadHeader(SHARED_CHEK,&CheckSum);
if( iErr != RET_OK )
return( iErr );
The functions of this group implement access to packets of the shared memory, that is,
they allow you to bufferize the requests that are either performed for completing the
buffer, or by explicit request. This technique makes it possible to optimize the accesses
to the physical communication channel, making the latter more efficient; however, the
data are consistent only on filling the buffer or executing a forced flush.
The Shared DLL handles the multiple access to the system registers in implicit mode,
and provides a number of functions that facilitate multiple access also to the non-
system registers.
Description This function allocates a buffer for multiple requests. The buffer is set-up to hold a
maximum of 30 requests.
This call is to be performed for each thread that intends to use multiple accesses.
Syntax
(int) BeginPackedOperation()
Reply codes
Syntax
(int) StartPackedOperation()
Description All the read and write functions of the Shared DLL that follow this call will be packed.
This means that such functions will be placed in the request buffer, and only following
a FlushPackedOperation will they be sent to the communication server.
Reply codes
Syntax
(int) FlushPackedOperation()
Description This function forces performance of the requests to access the shared memory
accumulated starting from the last StartPackedOperation.
An implicit flush is performed in any case when the number of homogeneous accesses
reaches 30. Multiple requests must be of the same type, and for this reason it is
necessary to carry out a read and write operation in SharedMemory (or vice-versa); a
forced flush is always performed between the two requests.
Reply codes
Syntax
(int)AppendRequest( SHR_OP OpType,
LPTS_REG field,
DWORD Offset,
LPVOID pVal,
int size)
Description For non-system registers it is necessary to call up this function for storing the relative
information for accessing the request buffer.
If more than 30 AppendRequests are called up, or there are two successive
AppendRequests with non-homogeneous operations types, a FlushPackedOperation
is performed automatically; for this reason, ERR_MULTIREAD and
ERR_MULTIWRITE are found between the error codes.
Parameters
Offset Offset (if any) relative to the TS_REG (if an array is concerned).
pVal Return buffer of the variable read, if the operation required is a READ.
Value to be set, if the operation required is a WRITE.
Reply codes
Syntax
(int) EndPackedOperation()
Description This function frees the buffer reserved for multiple requests.
This call is to be performed for each thread that invoked the BeginPackedOperation.
Reply codes
Example
BeginPackedOperation(); buffer allocation
// at this point, the data structure to be used
// for multiple read and write operations is available
...
StartPackedOperation();
// from this moment on, homogeneous requests are queued in
//the buffer
Err =ShrRead...(..,&ReadReg[0]);
Err =ShrRead...(..,&ReadReg[1]);
... ... ...
Err =ShrRead...(..,&ReadReg[n]);
Err = FlushPackedOperation();
// forces access to shared; only now are the
//ReadReg registers passed to the respective
// ShrRead...() containing the value awaited
StartPackedOperation();
// from this moment on, homogeneous requests are queued in
//the buffer
Err =ShrWrite...();
Err =ShrWrite...();
... ... ...
Err =AppendRequest(WR, ...);
Err =ShrWrite...();
Err = FlushPackedOperation();
//forces access to shared; only now are the registers in
//shared updated
....
EndPackedOperation(); frees the buffer
// This function is necessary for de-allocating the
reserved memory
//(it is very large)
The functions described below allow you to generate a report for each call for a Shared
DLL function. This information allows you to check the number of accesses
to the Shared, and to check if the requests are actually packed.
N.B. To enable the user interface to use this information, you will have to modify the
FAKLOG library so that it generates a Report File.
Syntax
(int) _StartSharedReport()
(int) _EndSharedReport()
Description
Parameters
END OF CHAPTER
Syntax
(int) PgmOpen(int iCh,
struct s_hprog *pPgm,
char *type,
char *name,
char *opt);
Description PgmOpen opens the file specified in name, making a search starting from the paths
specified in KVARA.INI.
If the file is opened correctly, the file handle is returned to pPgm to be used as input
to the functions that follow.
Parameters
Type Type of file to be opened - “PGM”, “CFS” or other key containing the
search path in KVARA.INI under the section [CHA.PATH]. A number of
alternative keys can be specified using OR, for example “CFS|CFU”.
Name String containing the name of the file to be opened. The extension may
be omitted if the key that specifies the extension is present in KVARA.INI
under the section [CHA.EXT].
Reply codes
Syntax
(int) PgmClose(struct s_hprog *pPgm);
Parameters
Reply codes
Syntax
(int) PgmSeek(struct s_hprog *pPgm,
long offs,
int whence);
Description This function moves the file pointer to the position determined by the starting point
plus the offset value.
N.B. This function only allows PGM_SE to be used, i.e. the offset is always relative to
the start of the file.
Parameters
Reply codes
Syntax
(void) PgmRewind(struct s_hprog *pPgm);
Description Positions the file pointer at the start of file and resets the error and EOF indicator.
Parameters
Syntax
(long) PgmTell(struct s_hprog *pPgm);
Description This function returns the current value of the file pointer, specified by pPgm.
Parameters
Reply codes
Syntax
(char*) PgmGets( char *s,
int n,
struct s_hprog *pPgm);
Description This function returns the characters read in s. PgmGets; it reads up to n-1 characters,
or stops if it encounters a newline character. It terminates s with the ‘\0’ character.
Parameters
s Reception buffer.
n Buffer size.
Reply codes
Example
if( !PgmGets(pszBuffer, _BUFLEN, phPP, &iErr) ) {
if( !PgmFeof(pIntData->phPP) )
;//Read Error
}
Syntax
(int) PgmGetc(struct s_hprog *pPgm);
Description Reads just one character starting from the current position of the file.
Parameters
Reply codes
Syntax
(int) PgmEnd( struct s_hprog *pPgm);
Description These functions check if the file pointer is positioned at the EOF.
Parameters
Reply codes
This function returns the error value set by the file management functions, if they have
terminated incorrectly.
Syntax
(int) PgmErr(struct s_hprog *pPgm);
Parameters
Reply codes
Syntax
(void) PgmClearerr(struct s_hprog *pPgm);
Description Clears the error and EOF indicators associated with the file. The indicators are
automatically reset, calling up the Seek and Rewind functions.
Parameters
END OF CHAPTER
Completeness
Accuracy
Readability
Page layout
Number of illustrations
Please give us an evaluation of the overall quality of each chapter in the manual you have just consulted:
Chapter Excellent Good Sufficient Insufficient Very bad
number
Comments:_______________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
Write your address in the following space if you consider it necessary:
Name:_________________________________________________________________________________________________
Company: _____________________________________________________________________________________________
Address: ______________________________________________________________________________________________
Tel: ____________________________ Fax: ________________________________________________________________