Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
饶先宏
Lcom
提交
0c258724
L
Lcom
项目概览
饶先宏
/
Lcom
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
Lcom
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
0c258724
编写于
5月 21, 2021
作者:
饶先宏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
202105212120
上级
52dfe16c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
50 addition
and
9 deletion
+50
-9
CMakeLists.txt
CMakeLists.txt
+8
-2
include/dlist.h
include/dlist.h
+1
-1
include/eiid.h
include/eiid.h
+1
-1
include/guid.h
include/guid.h
+4
-4
include/object.h
include/object.h
+9
-1
src/object.c
src/object.c
+27
-0
未找到文件。
CMakeLists.txt
浏览文件 @
0c258724
cmake_minimum_required
(
VERSION 3.8
)
add_library
(
lcom STATIC
"include/dlist.h"
"include/eiid.h"
"include/guid.h"
"include/object.h"
"src/dlist.c"
"src/object.c"
)
add_library
(
lcom STATIC
"include/dlist.h"
"include/eiid.h"
"include/guid.h"
"include/object.h"
"src/dlist.c"
"src/object.c"
)
include/dlist.h
浏览文件 @
0c258724
/*
/*
** LCOM: 轻量级组件对象模型
** Copyright (C) 2021-2021, raoxianhong<raoxianhong@163.net>
** All rights reserved.
...
...
include/eiid.h
浏览文件 @
0c258724
/*
/*
** LCOM: 轻量级组件对象模型
** Copyright (C) 2021-2021, raoxianhong<raoxianhong@163.net>
** All rights reserved.
...
...
include/guid.h
浏览文件 @
0c258724
/*
/*
** LCOM: 轻量级组件对象模型
** Copyright (C) 2021-2021, raoxianhong<raoxianhong@163.net>
** All rights reserved.
...
...
@@ -45,14 +45,14 @@
#ifdef IMPLEMENT_GUID
#if _BYTE_ORDER == _BIG_ENDIAN
#define DEFINE_GUID(name, L, s1, s2, b1, b2, b3, b4, b5, b6, b7, b8) \
const
Ouint32_t name[4] = {L, \
Ouint32_t name[4] = {L, \
((s2) << 0) | (s1 << 16), \
((b1) << 0) | ((b2) << 8) | ((b3) << 16) | ((b4) << 24), \
((b5) << 0) | ((b6) << 8) | ((b7) << 16) | ((b8) << 24), \
};
#else
#define DEFINE_GUID(name, L, s1, s2, b1, b2, b3, b4, b5, b6, b7, b8) \
const
Ouint32_t name[4] = {L, \
Ouint32_t name[4] = {L, \
((s1) << 0) | (s2 << 16), \
((b4) << 0) | ((b3) << 8) | ((b2) << 16) | ((b1) << 24), \
((b8) << 0) | ((b7) << 8) | ((b6) << 16) | ((b5) << 24), \
...
...
@@ -61,7 +61,7 @@ const Ouint32_t name[4] = {L, \
#else
#define DEFINE_GUID(name, L, s1, s2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern
const
Ouint32_t name[4];
extern Ouint32_t name[4];
#endif
include/object.h
浏览文件 @
0c258724
...
...
@@ -68,7 +68,7 @@ typedef void (*OVOIDFUNCPTR)();
#ifndef _ASMLANGUAGE
typedef
const
Ouint32_t
*
IIDTYPE
;
typedef
Ouint32_t
*
IIDTYPE
;
/* 判断GUID相等时,应比较它们的16字节是否一致 */
...
...
@@ -335,6 +335,14 @@ int objectCreateEx(IIDTYPE clsid, const PARAMITEM * pParams, int paramcount, IID
*/
int
objectQueryCreator
(
IIDTYPE
clsid
,
FObjectCreate
*
pObjectCreator
);
/*
把一个"7691029B-DAE3-4AC9-9A81-411C1B529039"格式的IID转换成一个IIDTYPE
返回值:
0 -- 成功
否则 -- 格式不对
*/
int
str2iid
(
const
char
*
str
,
IIDTYPE
iid
);
/*
以下代码辅助实现一个Object
*/
...
...
src/object.c
浏览文件 @
0c258724
...
...
@@ -324,3 +324,30 @@ void _Assert(const char * pszExpr, const char *pszFileName, unsigned int nLine)
logMsg
(
"Assertion Failed:
\"
%s
\"\n
File=%s, Line=%d
\n
"
,
pszExpr
,
pszFileName
,
nLine
);
}
#endif
/*
把一个"7691029B-DAE3-4AC9-9A81-411C1B529039"格式的IID转换成一个IIDTYPE
返回值:
0 -- 成功
否则 -- 格式不对
*/
int
str2iid
(
const
char
*
str
,
IIDTYPE
iid
)
{
unsigned
int
L
;
unsigned
int
s
[
2
];
unsigned
int
b
[
8
];
if
(
sscanf_s
(
str
,
"%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X"
,
&
L
,
&
s
[
0
],
&
s
[
1
],
&
b
[
0
],
&
b
[
1
],
&
b
[
2
],
&
b
[
3
],
&
b
[
4
],
&
b
[
5
],
&
b
[
6
],
&
b
[
7
])
!=
11
)
return
-
1
;
#define IMPLEMENT_GUID
#include "../include/guid.h"
{
DEFINE_GUID
(
temp
,
L
,
s
[
0
],
s
[
1
],
b
[
0
],
b
[
1
],
b
[
2
],
b
[
3
],
b
[
4
],
b
[
5
],
b
[
6
],
b
[
7
]);
iid
[
0
]
=
temp
[
0
];
iid
[
1
]
=
temp
[
1
];
iid
[
2
]
=
temp
[
2
];
iid
[
3
]
=
temp
[
3
];
}
#undef IMPLEMENT_GUID
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录