~ubuntu-branches/ubuntu/raring/sunpinyin/raring

« back to all changes in this revision

Viewing changes to wrapper/xim/IMdkit/FrameMgr.h

  • Committer: Package Import Robot
  • Author(s): YunQiang Su
  • Date: 2012-03-30 15:31:55 UTC
  • mfrom: (1.1.3) (1.2.7 sid)
  • Revision ID: package-import@ubuntu.com-20120330153155-qgls77sogzgtg9zp
Tags: 2.0.3+git20120222-1
* Team upload: git snapshot 20120222.
   - fix breaks if LDFLAGS in environment contains
       multiple words (Closese #646001).
   - rm patches merged to upstream:
       append-os-environ-toenv.patch
       fix-ftbfs-on-sh.patch
       remove-10-candidate-words-limitation.patch
   - refresh disable-lm-dict-compile.patch.
* Bump stardard version to 3.9.3: no modify needed.
* add libsunpinyin3-dbg and python-sunpinyin packages.
* debian/compat to 9, multiarch it.
* rewrite debian/rules with dh 7 format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************************
 
2
Copyright 1993, 1994 by Digital Equipment Corporation, Maynard, Massachusetts,
 
3
 
 
4
                        All Rights Reserved
 
5
 
 
6
Permission to use, copy, modify, and distribute this software and its 
 
7
documentation for any purpose and without fee is hereby granted, 
 
8
provided that the above copyright notice appear in all copies and that
 
9
both that copyright notice and this permission notice appear in 
 
10
supporting documentation, and that the names of Digital or MIT not be
 
11
used in advertising or publicity pertaining to distribution of the
 
12
software without specific, written prior permission.  
 
13
 
 
14
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 
15
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
 
16
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
 
17
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
 
18
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 
19
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 
20
SOFTWARE.
 
21
 
 
22
  Author: Hiroyuki Miyamoto  Digital Equipment Corporation
 
23
                             miyamoto@jrd.dec.com
 
24
 
 
25
    This version tidied and debugged by Steve Underwood May 1999
 
26
 
 
27
******************************************************************/
 
28
 
 
29
#ifndef FRAMEMGR_H
 
30
#define FRAMEMGR_H
 
31
 
 
32
#include <X11/Xmd.h>
 
33
#include <X11/Xlib.h>
 
34
#include <stdio.h>
 
35
 
 
36
#if defined(VAXC) && !defined(__DECC)
 
37
#define xim_externalref globalref
 
38
#define xim_externaldef globaldef
 
39
#else
 
40
#define xim_externalref extern
 
41
#define xim_externaldef
 
42
#endif
 
43
 
 
44
/* Definitions for FrameMgr */
 
45
 
 
46
#define COUNTER_MASK 0x10
 
47
 
 
48
typedef enum
 
49
{
 
50
    BIT8     = 0x1,       /* {CARD8* | INT8*}   */
 
51
    BIT16    = 0x2,       /* {CARD16* | INT16*} */
 
52
    BIT32    = 0x3,       /* {CARD32* | INT32*} */
 
53
    BIT64    = 0x4,       /* {CARD64* | INT64*} */
 
54
    BARRAY   = 0x5,       /* int*, void*        */
 
55
    ITER     = 0x6,       /* int*               */
 
56
    POINTER  = 0x7,       /* specifies next item is a PTR_ITEM */
 
57
    PTR_ITEM = 0x8,       /* specifies the item has a pointer */
 
58
    /* BOGUS - POINTER and PTR_ITEM
 
59
     *   In the current implementation, PTR_ITEM should be lead by
 
60
     *   POINTER.  But actually, it's just redundant logically.  Someone 
 
61
     *   may remove this redundancy and POINTER from the enum member but he
 
62
     *   should also modify the logic in FrameMgr program.
 
63
     */
 
64
    PADDING  = 0x9,       /* specifies that a padding is needed.
 
65
                           * This requires extra data in data field.
 
66
                           */
 
67
    EOL      = 0xA,       /* specifies the end of list */
 
68
 
 
69
    COUNTER_BIT8  = COUNTER_MASK | 0x1,
 
70
    COUNTER_BIT16 = COUNTER_MASK | 0x2,
 
71
    COUNTER_BIT32 = COUNTER_MASK | 0x3,
 
72
    COUNTER_BIT64 = COUNTER_MASK | 0x4
 
73
} XimFrameType;
 
74
 
 
75
/* Convenient macro */
 
76
#define _FRAME(a) {a, NULL}
 
77
#define _PTR(p)   {PTR_ITEM, (void *)p}
 
78
/* PADDING's usage of data field
 
79
 * B15-B8  : Shows the number of effective items.
 
80
 * B7-B0   : Shows padding unit.  ex) 04 shows 4 unit padding.
 
81
 */
 
82
#define _PAD2(n)   {PADDING, (void*)((n)<<8|2)}
 
83
#define _PAD4(n)   {PADDING, (void*)((n)<<8|4)}
 
84
 
 
85
#define FmCounterByte 0
 
86
#define FmCounterNumber 1
 
87
    
 
88
#define _BYTE_COUNTER(type, offset) \
 
89
               {(COUNTER_MASK|type), (void*)((offset)<<8|FmCounterByte)}
 
90
 
 
91
#define _NUMBER_COUNTER(type, offset) \
 
92
               {(COUNTER_MASK|type), (void*)((offset)<<8|FmCounterNumber)}
 
93
 
 
94
typedef struct _XimFrame
 
95
{
 
96
    XimFrameType type;
 
97
    void* data;       /* For PTR_ITEM and PADDING */
 
98
} XimFrameRec, *XimFrame;
 
99
 
 
100
typedef enum
 
101
{
 
102
    FmSuccess, 
 
103
    FmEOD,
 
104
    FmInvalidCall,
 
105
    FmBufExist,
 
106
    FmCannotCalc,
 
107
    FmNoMoreData
 
108
} FmStatus;
 
109
 
 
110
typedef struct _FrameMgr *FrameMgr;
 
111
 
 
112
FrameMgr FrameMgrInit(XimFrame frame, char* area, Bool byte_swap);
 
113
void FrameMgrInitWithData(FrameMgr fm, XimFrame frame, void* area,
 
114
                          Bool byte_swap);
 
115
void FrameMgrFree(FrameMgr fm);
 
116
FmStatus FrameMgrSetBuffer(FrameMgr, void*);
 
117
FmStatus _FrameMgrPutToken(FrameMgr, void*, int);
 
118
FmStatus _FrameMgrGetToken(FrameMgr, void*, int);
 
119
FmStatus FrameMgrSetSize(FrameMgr, int);
 
120
FmStatus FrameMgrSetIterCount(FrameMgr, int);
 
121
FmStatus FrameMgrSetTotalSize(FrameMgr, int);
 
122
int FrameMgrGetTotalSize(FrameMgr);
 
123
int FrameMgrGetSize(FrameMgr);
 
124
FmStatus FrameMgrSkipToken(FrameMgr, int);
 
125
void FrameMgrReset(FrameMgr);
 
126
Bool FrameMgrIsIterLoopEnd(FrameMgr, FmStatus*);
 
127
 
 
128
#define FrameMgrPutToken(fm, obj) _FrameMgrPutToken((fm), &(obj), sizeof(obj))
 
129
#define FrameMgrGetToken(fm, obj) _FrameMgrGetToken((fm), &(obj), sizeof(obj))
 
130
 
 
131
#endif /* FRAMEMGR_H */