~ubuntu-branches/debian/experimental/cuneiform/experimental

« back to all changes in this revision

Viewing changes to cuneiform_src/Kern/rpic/sources/dll.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-07-10 17:58:10 UTC
  • Revision ID: james.westby@ubuntu.com-20090710175810-rqc89d2i3tki9m89
Tags: upstream-0.7.0+dfsg
Import upstream version 0.7.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright (c) 1993-2008, Cognitive Technologies
 
3
All rights reserved.
 
4
 
 
5
����������� ��������� ��������������� � ������������� ��� � ���� ��������� ����,
 
6
��� � � �������� �����, � ����������� ��� ���, ��� ���������� ��������� �������:
 
7
 
 
8
      * ��� ��������� ��������������� ��������� ���� ������ ���������� ���������
 
9
        ���� ����������� �� ��������� �����, ���� ������ ������� � �����������
 
10
        ����� �� ��������.
 
11
      * ��� ��������� ��������������� ��������� ���� � ������������ �/��� �
 
12
        ������ ����������, ������������ ��� ���������������, ������ �����������
 
13
        ��������� ���� ���������� �� ��������� �����, ���� ������ ������� �
 
14
        ����������� ����� �� ��������.
 
15
      * �� �������� Cognitive Technologies, �� ����� �� ����������� �� �����
 
16
        ���� ������������ � �������� �������� ��������� �/��� �����������
 
17
        ���������, ���������� �� ���� ��, ��� ���������������� �����������
 
18
        ����������.
 
19
 
 
20
��� ��������� ������������� ����������� ��������� ���� �/��� ������� ������ "���
 
21
��� ����" ��� ������-���� ���� ��������, ���������� ���� ��� ���������������,
 
22
������� �������� ������������ �������� � ����������� ��� ���������� ����, �� ��
 
23
������������� ���. �� �������� ��������� ���� � �� ���� ������ ����, �������
 
24
����� �������� �/��� �������� �������������� ���������, �� � ���� ������ ��
 
25
��Ѩ� ���������������, ������� ����� �����, ���������, ����������� ���
 
26
������������� ������, ��������� � �������������� ��� ���������� ����������
 
27
������������� ������������� ��������� (������� ������ ������, ��� ������,
 
28
������� ���������, ��� ������ �/��� ������ �������, ���������� ��-�� ��������
 
29
������� ��� �/��� ������ ��������� �������� ��������� � ������� �����������,
 
30
�� �� ������������� ����� ��������), �� �� ������������� ���, ���� ���� �����
 
31
�������� ��� ������ ���� ���� �������� � ����������� ����� ������� � ������.
 
32
 
 
33
Redistribution and use in source and binary forms, with or without modification,
 
34
are permitted provided that the following conditions are met:
 
35
 
 
36
    * Redistributions of source code must retain the above copyright notice,
 
37
      this list of conditions and the following disclaimer.
 
38
    * Redistributions in binary form must reproduce the above copyright notice,
 
39
      this list of conditions and the following disclaimer in the documentation
 
40
      and/or other materials provided with the distribution.
 
41
    * Neither the name of the Cognitive Technologies nor the names of its
 
42
      contributors may be used to endorse or promote products derived from this
 
43
      software without specific prior written permission.
 
44
 
 
45
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 
46
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 
47
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 
48
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
 
49
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 
50
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 
51
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
52
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 
53
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 
54
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
55
*/
 
56
 
 
57
// ============================================================================
 
58
//
 
59
// ============================================================================
 
60
 
 
61
/*# include <windows.h>*/
 
62
#include "compat_defs.h"
 
63
 
 
64
# include "mainpic.h"
 
65
 
 
66
///////////////////////////////////GLOBAL VARIABLES///////////////////////////////
 
67
static Word16            gwHeightRC = 0;
 
68
static Word16            gwLowRC = 0;
 
69
static HANDLE            ghStorage = NULL;
 
70
static HINSTANCE         ghInst =  NULL;
 
71
//////////////////////////////////////////////////////////////////////////////////
 
72
 
 
73
BOOL APIENTRY DllMain( HINSTANCE hModule,
 
74
                        DWORD ul_reason_for_call,
 
75
                        LPVOID lpReserved )
 
76
{
 
77
    switch( ul_reason_for_call )
 
78
        {
 
79
    case DLL_PROCESS_ATTACH:
 
80
                ghInst = hModule;
 
81
                break;
 
82
    case DLL_THREAD_ATTACH:
 
83
                break;
 
84
    case DLL_THREAD_DETACH:
 
85
                break;
 
86
    case DLL_PROCESS_DETACH:
 
87
                break;
 
88
    }
 
89
    return TRUE;
 
90
}
 
91
 
 
92
/////////////////////////////////////////////////////////////////////////////////
 
93
RPIC_FUNC(Bool32) RPIC_Init(Word16 wHeightCode,HANDLE hStorage)
 
94
{
 
95
        gwHeightRC = wHeightCode;
 
96
        LDPUMA_Init(0,NULL);
 
97
        InitDebug();
 
98
 
 
99
        ClearLogRes();
 
100
 
 
101
        return TRUE;
 
102
}
 
103
////////////////////////////////////////////////////////////////////////////////
 
104
RPIC_FUNC(Bool32) RPIC_Done()
 
105
{
 
106
 
 
107
        CloseLogRes();
 
108
        LDPUMA_Done();
 
109
        DoneDebug();
 
110
        return TRUE;
 
111
}
 
112
//////////////////////////////////////////////////////////////////////////////////
 
113
RPIC_FUNC(Word32) RPIC_GetReturnCode()
 
114
{
 
115
        Word32 rc = 0;
 
116
        if(gwLowRC && (gwLowRC - IDS_ERR_NO)> 0 )
 
117
                rc = (Word32)(gwHeightRC<<16)|(gwLowRC - IDS_ERR_NO);
 
118
        return rc;
 
119
}
 
120
//////////////////////////////////////////////////////////////////////////////////
 
121
RPIC_FUNC(Int8 *) RPIC_GetReturnString(Word32 dwError)
 
122
{
 
123
        Word16 rc = (Word16)(dwError & 0xFFFF) + IDS_ERR_NO;
 
124
        static Int8 szBuffer[512];
 
125
 
 
126
        if( dwError >> 16 != gwHeightRC)
 
127
                gwLowRC = IDS_ERR_NOTIMPLEMENT;
 
128
 
 
129
        if( rc >= IDS_ERR_NO )
 
130
                LoadString(ghInst,rc,(char *)szBuffer,sizeof(szBuffer));
 
131
        else
 
132
                return NULL;
 
133
 
 
134
        return szBuffer;
 
135
}
 
136
//////////////////////////////////////////////////////////////////////////////////
 
137
RPIC_FUNC(Bool32) RPIC_GetExportData(Word32 dwType, void * pData)
 
138
{
 
139
        Bool32 rc = TRUE;
 
140
 
 
141
        gwLowRC = 0;
 
142
 
 
143
#define CASE_FUNCTION(a)        case RPIC_FN##a:        *(FN##a *)pData = a; break
 
144
#define CASE_DATA(a,b,c)        case a: *(b *)pData = c; break
 
145
 
 
146
        switch(dwType)
 
147
        {
 
148
        CASE_FUNCTION(RPIC_SearchPictures);
 
149
        /* reserv
 
150
        CASE_FUNCTION();
 
151
        CASE_FUNCTION();
 
152
        CASE_FUNCTION();
 
153
        */
 
154
         default:
 
155
                *(char **)pData = NULL;
 
156
                gwLowRC = IDS_ERR_NOTIMPLEMENT;
 
157
                rc = FALSE;
 
158
        }
 
159
 
 
160
#undef CASE_DATA
 
161
#undef CASE_FUNCTION
 
162
return rc;
 
163
}
 
164
//////////////////////////////////////////////////////////////////////////////////
 
165
RPIC_FUNC(Bool32) RPIC_SetImportData(Word32 dwType, void * pData)
 
166
{
 
167
        Bool32 rc = TRUE;
 
168
 
 
169
        gwLowRC = 0;
 
170
 
 
171
#define CASE_DATA(a,b,c)        case a: c = *(b *)pData; break
 
172
///     switch(dwType)
 
173
///     {
 
174
//      CASE_DATA(RLINE_Bool32_NOFILLGAP3,Bool32,gbNOFILLGAP3);
 
175
///     default:
 
176
                rc = FALSE;
 
177
                gwLowRC = IDS_ERR_NOTIMPLEMENT;
 
178
///     }
 
179
#undef CASE_DATA
 
180
 
 
181
return rc;
 
182
}
 
183
//////////////////////////////////////////////////////////////////////////////////
 
184
 
 
185
void SetReturnCode_rpic(Word32 rc)
 
186
{
 
187
Word16 low = (Word16)(rc &  0xFFFF);
 
188
Word16 hei = (Word16)(rc >> 16);
 
189
 
 
190
        if(hei)
 
191
                gwLowRC = (Word16)rc;
 
192
        else
 
193
        {
 
194
                if(low - IDS_ERR_NO)
 
195
                        gwLowRC = (Word16)((Word32)(gwHeightRC<<16)|(low - IDS_ERR_NO));
 
196
                else
 
197
                        gwLowRC = 0;
 
198
        }
 
199
}
 
200
 
 
201
Word32 GetReturnCode_rpic()
 
202
{
 
203
Word32 rc = gwLowRC;
 
204
Word16 low = (Word16)(gwLowRC &  0xFFFF);
 
205
Word16 hei = (Word16)(gwLowRC >> 16);
 
206
 
 
207
        if(hei == gwHeightRC || hei == 0)
 
208
                rc = low + IDS_ERR_NO;
 
209
 
 
210
return rc;
 
211
}
 
212
//////////////////////////////////////////////////////////////////////////////////
 
213
//end of file
 
214
//////////////////////////////////////////////////////////////////////////////////