merge test case pybuf and benchmark pybuf_benchmark into a single test case
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10884 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
25f6cebe46
commit
32b01d9559
4 changed files with 68 additions and 58 deletions
|
|
@ -1,6 +1,7 @@
|
|||
%module pybuf
|
||||
%include<pybuffer.i>
|
||||
|
||||
%include<cstring.i>
|
||||
/*functions for the test case*/
|
||||
%pybuffer_mutable_binary(char *buf1, int len);
|
||||
%pybuffer_mutable_string(char *buf2);
|
||||
%pybuffer_binary(const char *buf3, int len);
|
||||
|
|
@ -32,3 +33,32 @@
|
|||
return strlen(buf4);
|
||||
}
|
||||
%}
|
||||
|
||||
/*functions for the benchmark*/
|
||||
%pybuffer_mutable_string(char *str1);
|
||||
%cstring_mutable(char *str2);
|
||||
|
||||
%inline %{
|
||||
void title(char *str) {
|
||||
int outword = 1;
|
||||
while(*str) {
|
||||
if (isalnum(*str)) {
|
||||
if (outword) {
|
||||
outword = 0;
|
||||
*str = toupper(*str);
|
||||
}
|
||||
}
|
||||
else {
|
||||
outword = 0;
|
||||
}
|
||||
str++;
|
||||
}
|
||||
}
|
||||
|
||||
void title1(char *str1) {
|
||||
title(str1);
|
||||
}
|
||||
void title2(char *str2) {
|
||||
title(str2);
|
||||
}
|
||||
%}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue