Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3adadc7

Browse files
move wrappers for pure-C into separate file
1 parent4d8423c commit3adadc7

File tree

4 files changed

+7
-92
lines changed

4 files changed

+7
-92
lines changed

‎Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ all: test cpp_test
1414
test:$(LIB_OBJS) test.o
1515
$(CC)$(LDFLAGS)$^ -o$@$(LDLIBS)
1616

17-
cpp_test:$(LIB_OBJS) cpp_test.o libblobstamper.o
17+
cpp_test:$(LIB_OBJS) cpp_test.o libblobstamper.o pg_op_wrappers.o
1818
$(CXX)$(LDFLAGS)$^ -o$@$(LDLIBS)
1919

2020
%.o:%.cpp$(DEPS)

‎cpp_test.cpp‎renamed to ‎cpp_test.c‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,16 @@
22
#include<stdio.h>
33
#include<stdlib.h>
44

5-
#include<string>
6-
7-
#include"libblobstamper.h"
8-
5+
#include"pg_op_wrappers.h"
96

107
charblob_data[]="aaalkjdhfs89345yu3ifhjew;lkhf4;lt;o34ithp;eriuwtgp;etup568p34tuewritwe;rtgj;ewoty;4w85tyeihwritgzzz";
118

129
intmain()
1310
{
14-
15-
Blobbl(blob_data,strlen(blob_data));
16-
1711
char*res1,*res2;
1812

19-
poly_contain_prepare(blob_data,strlen(blob_data),&res1, &res2);
13+
poly_contain_prepare(blob_data,strlen(blob_data),&res1,&res2);
2014

21-
2215
printf("---- %s\n",res1);
2316
printf("==== %s\n",res2);
2417

‎libblobstamper.cpp‎

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -131,62 +131,3 @@ wflShiftPgPath(Blob &blob)
131131
res ="(" + res +")";
132132
return res;
133133
}
134-
135-
extern"C" {
136-
int
137-
poly_contain_prepare(char* in,int in_size,char ** res1,char ** res2)
138-
{
139-
*res1 =NULL;
140-
*res2 =NULL;
141-
142-
std::string r1, r2;
143-
Blobblob(in, in_size);
144-
145-
r1 =wflShiftPgPoint(blob);
146-
147-
if (r1.empty())
148-
{
149-
fprintf(stderr,"Problema1\n");
150-
return1;
151-
}
152-
153-
r2 =wflShiftPgPath(blob);
154-
155-
if (r2.empty())
156-
{
157-
fprintf(stderr,"Problema2\n");
158-
return1;
159-
}
160-
161-
*res1 = (char *)malloc(strlen(r1.c_str()) +1);
162-
memcpy(*res1, r1.c_str(),strlen(r1.c_str()) +1);
163-
164-
*res2 = (char *)malloc(strlen(r2.c_str())+1);
165-
memcpy(*res2, r2.c_str(),strlen(r2.c_str()) +1);
166-
167-
return0;
168-
}
169-
170-
int
171-
poly_center_prepare(char* in,int in_size,char ** res2)
172-
{
173-
*res2 =NULL;
174-
175-
std::string r2;
176-
Blobblob(in, in_size);
177-
178-
r2 =wflShiftPgPath(blob);
179-
180-
if (r2.empty())
181-
{
182-
fprintf(stderr,"Problema2\n");
183-
return1;
184-
}
185-
186-
*res2 = (char *)malloc(strlen(r2.c_str())+1);
187-
memcpy(*res2, r2.c_str(),strlen(r2.c_str()) +1);
188-
189-
return0;
190-
}
191-
192-
}

‎libblobstamper.h‎

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,6 @@ class Blob
1414

1515
};
1616

17-
18-
typedefstructwflMemCtx
19-
{
20-
//Nothing for now;
21-
}wflMemCtx ;
22-
23-
extern wflMemCtx static_ctx;
24-
25-
wflMemCtx *wflCreateMemCtx();
26-
voidwflDestroyMemCtx(wflMemCtx * mctx);
27-
28-
2917
typedefstructwflBlobDsc
3018
{
3119
structwflMemCtx * mctx;
@@ -36,18 +24,11 @@ typedef struct wflBlobDsc
3624

3725

3826
voidwflBlobDump(wflBlobDsc* blob);
39-
void*wflMalloc(wflMemCtx * mctx,size_t size);
40-
voidwflFree(wflMemCtx * mctx,void* ptr);
41-
42-
//wflBlobDsc* wflShiftN(wflBlobDsc* blob, size_t n);
43-
//std::string wflShiftDouble(wflBlobDsc* blob);
44-
//std::string wflShiftPgPoint(wflBlobDsc* blob);
45-
//std::string wflShiftPgPath(wflBlobDsc* blob);
46-
4727

28+
BlobwflShiftN(Blob &blob,size_t n);
29+
std::stringwflShiftDouble(Blob &blob);
30+
std::stringwflShiftPgPoint(Blob &blob);
31+
std::stringwflShiftPgPath(Blob &blob);
4832

49-
extern"C" {
5033

51-
intpoly_contain_prepare(char* in,int in_size,char ** res1,char ** res2);
5234

53-
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp