/******************************************************************
Copyright 1993, 1994 by Digital Equipment Corporation, Maynard, Massachusetts,
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
Author: Hiroyuki Miyamoto Digital Equipment Corporation
miyamoto@jrd.dec.com
This version tidied and debugged by Steve Underwood May 1999
******************************************************************/
#include <X11/Xlibint.h>
#include <stdlib.h>
#include "FrameMgr.h"
/* Convenient macro */
#define _UNIT(n) ((int)(n) & 0xFF)
#define _NUMBER(n) (((int)(n) >> 8) & 0xFF)
/* For byte swapping */
#define Swap16(p, n) ((p)->byte_swap ? \
(((n) << 8 & 0xFF00) | \
((n) >> 8 & 0xFF) \
) : n)
#define Swap32(p, n) ((p)->byte_swap ? \
(((n) << 24 & 0xFF000000) | \
((n) << 8 & 0xFF0000) | \
((n) >> 8 & 0xFF00) | \
((n) >> 24 & 0xFF) \
) : n)
#define Swap64(p, n) ((p)->byte_swap ? \
(((n) << 56 & 0xFF00000000000000) | \
((n) << 40 & 0xFF000000000000) | \
((n) << 24 & 0xFF0000000000) | \
((n) << 8 & 0xFF00000000) | \
((n) >> 8 & 0xFF000000) | \
((n) >> 24 & 0xFF0000) | \
((n) >> 40 & 0xFF00) | \
((n) >> 56 & 0xFF) \
) : n)
/* Type definition */
typedef struct _Iter *Iter;
typedef struct _FrameInst *FrameInst;
typedef union
{
int num; /* For BARRAY */
FrameInst fi; /* For POINTER */
Iter iter; /* For ITER */
} ExtraDataRec, *ExtraData;
typedef struct _Chain
{
ExtraDataRec d;
int frame_no;
struct _Chain *next;
} ChainRec, *Chain;
typedef struct _ChainMgr
{
Chain top;
Chain tail;
} ChainMgrRec, *ChainMgr;
typedef struct _ChainIter
{
Chain cur;
} ChainIterRec, *ChainIter;
typedef struct _FrameIter
{
Iter iter;
Bool counting;
unsigned int counter;
int end;
struct _FrameIter* next;
} FrameIterRec, *FrameIter;
typedef struct _FrameInst
{
XimFrame template;
ChainMgrRec cm;
int cur_no;
} FrameInstRec;
typedef void (*IterStartWatchProc) (Iter it, void *client_data);
typedef struct _Iter
{
XimFrame template;
int max_count;
Bool allow_expansion;
ChainMgrRec cm;
int cur_no;
IterStartWatchProc start_watch_proc;
void *client_data;
Bool start_counter;
} IterRec;
typedef struct _FrameMgr
{
XimFrame frame;
FrameInst fi;
char *area;
int idx;
Bool byte_swap;
int total_size;
FrameIter iters;
} FrameMgrRec;
typedef union
{
int num; /* For BARRAY and PAD */
struct
{ /* For COUNTER_* */
Iter iter;
Bool is_byte_len;
} counter;
} XimFrameTypeInfoRec, *XimFrameTypeInfo;
/* Special values */
#define NO_VALUE -1
#define NO_VALID_FIELD -2
static FrameInst FrameInstInit(XimFrame frame);
static void FrameInstFree(FrameInst fi);
static XimFrameType FrameInstGetNextType(FrameInst fi, XimFrameTypeInfo info);
static XimFrameType FrameInstPeekNextType(FrameInst fi, XimFrameTypeInfo info);
static FmStatus FrameInstSetSize(FrameInst fi, int num);
static FmStatus FrameInstSetIterCount(FrameInst fi, int num);
static int FrameInstGetTotalSize(FrameInst fi);
static void FrameInstReset(FrameInst fi);
static Iter IterInit(XimFrame frame, int count);
static void IterFree(Iter it);
static int FrameInstGetSize(FrameInst fi);
static int IterGetSize(Iter it);
static XimFrameType IterGetNextType(Iter it, XimFrameTypeInfo info);
static XimFrameType IterPeekNextType(Iter it, XimFrameTypeInfo info);
static FmStatus IterSetSize(Iter it, int num);
static FmStatus IterSetIterCount(Iter it, int num);
static int IterGetTotalSize(Iter it);
static void IterReset(Iter it);
static Bool IterIsLoopEnd(Iter it, Bool* myself);
static void IterSetStartWatch(Iter it, IterStartWatchProc proc, void* client_data);
static void _IterStartWatch(Iter it, void* client_data);
static ExtraData ChainMgrGetExtraData(ChainMgr cm, int frame_no);
static ExtraData ChainMgrSetData(ChainMgr cm, int frame_no,
ExtraDataRec data);
static Bool ChainIterGetNext(ChainIter ci, int* frame_no, ExtraData d);
static int _FrameInstIncrement(XimFrame frame, int count);
static int _FrameInstDecrement(XimFrame frame, int count);
static int _FrameInstGetItemSize(FrameInst fi, int cur_no);
static Bool FrameInstIsIterLoopEnd(FrameInst fi);
static FrameIter _FrameMgrAppendIter(FrameMgr fm, Iter it, int end);
static FrameIter _FrameIterCounterIncr(FrameIter fitr, int i);
static void _FrameMgrRemoveIter(FrameMgr fm, FrameIter it);
static Bool _FrameMgrIsIterLoopEnd(FrameMgr fm);
static Bool _FrameMgrProcessPadding(FrameMgr fm, FmStatus* status);
#define IterGetIterCount(it) ((it)->allow_expansion ? \
NO_VALUE : (it)->max_count)
#define IterFixIteration(it) ((it)->allow_expansion = False)
#define IterSetStarter(it) ((it)->start_counter = True)
#define ChainMgrInit(cm) (cm)->top = (cm)->tail = NULL
#define ChainMgrFree(cm) \
{ \
Chain tmp; \
Chain cur = (cm)->top; \
\
while (cur) \
{ \
tmp = cur->next; \
Xfree (cur); \
cur = tmp; \
} \
}
#define ChainIterInit(ci, cm) \
{ \
(ci)->cur = (cm)->top; \
}
/* ChainIterFree has nothing to do. */
#define ChainIterFree(ci)
#define FrameInstIsEnd(fi) ((fi)->template[(fi)->cur_no].type == EOL)
FrameMgr FrameMgrInit (XimFrame frame, char* area, Bool byte_swap)
{
FrameMgr fm;
fm = (FrameMgr) Xmalloc (sizeof (FrameMgrRec));
fm->frame = frame;
fm->fi = FrameInstInit (frame);
fm->area = (char *) area;
fm->idx = 0;
fm->byte_swap = byte_swap;
fm->total_size = NO_VALUE;
fm->iters = NULL;
return fm;
}
void FrameMgrInitWithData (FrameMgr fm,
XimFrame frame,
void * area,
Bool byte_swap)
{
fm->frame = frame;
fm->fi = FrameInstInit (frame);
fm->area = (char *) area;
fm->idx = 0;
fm->byte_swap = byte_swap;
fm->total_size = NO_VALUE;
}
void FrameMgrFree (FrameMgr fm)
{
FrameIter p, cur;
p = fm->iters;
cur = p;
while (p)
{
p = p->next;
Xfree (cur);
cur = p;
}
/*endwhile*/
FrameInstFree (fm->fi);
Xfree (fm);
}
FmStatus FrameMgrSetBuffer (FrameMgr fm, void* area)
{
if (fm->area)
return FmBufExist;
fm->area = (char *) area;
return FmSuccess;
}
FmStatus _FrameMgrPutToken (FrameMgr fm, void *data, int data_size)
{
XimFrameType type;
XimFrameTypeInfoRec info;
if (fm->total_size != NO_VALUE && fm->idx >= fm->total_size)
return FmNoMoreData;
/*endif*/
type = Fram
没有合适的资源?快使用搜索试试~ 我知道了~
自由拼音输入法源代码---确实很好
4星 · 超过85%的资源 需积分: 43 59 下载量 183 浏览量
2008-12-14
09:58:04
上传
评论 2
收藏 665KB GZ 举报
温馨提示
共208个文件
py:58个
in:32个
c:22个
自由拼音输入法源代码,教你如何编写输入法基本程序
资源推荐
资源详情
资源评论
收起资源包目录
自由拼音输入法源代码---确实很好 (208个子文件)
ABOUT-NLS 78KB
configure.ac 6KB
Makefile.am 2KB
Makefile.am 2KB
Makefile.am 2KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1002B
Makefile.am 884B
Makefile.am 880B
Makefile.am 877B
Makefile.am 866B
Makefile.am 865B
AUTHORS 155B
FrameMgr.c 60KB
i18nPtHdr.c 53KB
ibusimclient.c 45KB
i18nMethod.c 36KB
i18nIc.c 33KB
main.c 28KB
ibusimcontext.c 27KB
i18nIMProto.c 20KB
i18nX.c 17KB
i18nClbk.c 16KB
i18nUtil.c 8KB
ibusattribute.c 8KB
ibusmarshalers.c 7KB
i18nAttr.c 6KB
IMConn.c 4KB
gconf-types.c 4KB
gdk-private.c 3KB
IMValues.c 3KB
IMMethod.c 2KB
gconf-fixes.c 2KB
ibusim.c 2KB
gconfmodule.c 741B
ChangeLog 0B
compile 4KB
configure 858KB
COPYING 26KB
ibus-client.cpp 15KB
ibus-input-context.cpp 6KB
im-ibus-qt.cpp 3KB
gconf.defs 39KB
depcomp 17KB
setup.glade 25KB
zh_CN.gmo 3KB
ja.gmo 3KB
config.guess 44KB
Xi18n.h 11KB
Xtrans.h 10KB
XimProto.h 6KB
ibusimclient.h 5KB
FrameMgr.h 4KB
IMdkit.h 4KB
ibusattribute.h 4KB
XimFunc.h 3KB
ibusimcontext.h 3KB
ibus-client.h 3KB
ibusmarshalers.h 2KB
ibus-input-context.h 2KB
Xi18nX.h 2KB
gconf-types.h 1KB
gdk-private.h 992B
gconf-fixes.h 502B
en@boldquot.header 1KB
en@quot.header 1KB
Makefile.in 23KB
Makefile.in 22KB
Makefile.in 22KB
Makefile.in 21KB
Makefile.in 20KB
Makefile.in 19KB
Makefile.in 17KB
Makefile.in 17KB
Makefile.in 17KB
Makefile.in 17KB
Makefile.in 17KB
Makefile.in 16KB
Makefile.in 15KB
Makefile.in 14KB
Makefile.in 14KB
Makefile.in 14KB
Makefile.in 14KB
Makefile.in.in 14KB
Makefile.in 13KB
Makefile.in 13KB
Makefile.in 11KB
ibus.in 5KB
ibus.spec.in 4KB
config.h.in 3KB
共 208 条
- 1
- 2
- 3
资源评论
- 虚谷若谷2014-05-09我想找vs2005+的版本,毕竟vc6现在都过时了
- songwei08172012-08-22vc6的工程配置,有点老
- luoyouhui2011-10-25很不错 可惜用不着,工程不合适
- chengen0824122011-11-02有代码 , 正在努力的看 !! 不知道怎么运行
qwbug
- 粉丝: 6
- 资源: 58
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功