No real changes, just convert files to Unix EOLs
Some tests and examples files as well as the C manual chapter used DOS EOLs, get rid of them for consistency with all the other text files.
This commit is contained in:
parent
f9a2d81f29
commit
e1a4b02f69
5 changed files with 978 additions and 978 deletions
|
|
@ -1,199 +1,199 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "char_strings/char_strings_wrap.h"
|
||||
|
||||
int main() {
|
||||
char *CPLUSPLUS_MSG = "A message from the deep dark world of C++, where anything is possible.";
|
||||
char *OTHERLAND_MSG = "Little message from the safe world.";
|
||||
|
||||
long count = 10000;
|
||||
long i = 0;
|
||||
|
||||
// get functions
|
||||
for (i=0; i<count; i++) {
|
||||
char *str = GetCharHeapString();
|
||||
if (strcmp(str, CPLUSPLUS_MSG) != 0) {
|
||||
fprintf(stderr, "Test char get 1 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
DeleteCharHeapString();
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
const char *str = GetConstCharProgramCodeString();
|
||||
if (strcmp(str, CPLUSPLUS_MSG) != 0) {
|
||||
fprintf(stderr, "Test char get 2 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
DeleteCharHeapString();
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char *str = GetCharStaticString();
|
||||
if (strcmp(str, CPLUSPLUS_MSG) != 0) {
|
||||
fprintf(stderr, "Test char get 3 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char *str = GetCharStaticStringFixed();
|
||||
if (strcmp(str, CPLUSPLUS_MSG) != 0) {
|
||||
fprintf(stderr, "Test char get 4 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
const char *str = GetConstCharStaticStringFixed();
|
||||
if (strcmp(str, CPLUSPLUS_MSG) != 0) {
|
||||
fprintf(stderr, "Test char get 5 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// set functions
|
||||
for (i=0; i<count; i++) {
|
||||
char str[256];
|
||||
sprintf(str, "%s%d", OTHERLAND_MSG, i);
|
||||
if (!SetCharHeapString(str, i)) {
|
||||
fprintf(stderr, "Test char set 1 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char str[256];
|
||||
sprintf(str, "%s%d", OTHERLAND_MSG, i);
|
||||
if (!SetCharStaticString(str, i)) {
|
||||
fprintf(stderr, "Test char set 2 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char str[256];
|
||||
sprintf(str, "%s%d", OTHERLAND_MSG, i);
|
||||
if (!SetCharArrayStaticString(str, i)) {
|
||||
fprintf(stderr, "Test char set 3 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char str[256];
|
||||
sprintf(str, "%s%d", OTHERLAND_MSG, i);
|
||||
if (!SetConstCharHeapString(str, i)) {
|
||||
fprintf(stderr, "Test char set 4 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char str[256];
|
||||
sprintf(str, "%s%d", OTHERLAND_MSG, i);
|
||||
if (!SetConstCharStaticString(str, i)) {
|
||||
fprintf(stderr, "Test char set 5 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char str[256];
|
||||
sprintf(str, "%s%d", OTHERLAND_MSG, i);
|
||||
if (!SetConstCharArrayStaticString(str, i)) {
|
||||
fprintf(stderr, "Test char set 6 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// get set function
|
||||
for (i=0; i<count; i++) {
|
||||
char ping[256];
|
||||
sprintf(ping, "%s%d", OTHERLAND_MSG, i);
|
||||
char *pong = CharPingPong(ping);
|
||||
if (strcmp(ping, pong) != 0) {
|
||||
fprintf(stderr, "Test PingPong 1 failed.\nExpected:%d\nReceived:%d\n", ping, pong);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// variables
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char str[256];
|
||||
sprintf(str, "%s%d", OTHERLAND_MSG, i);
|
||||
global_char = str;
|
||||
if (strcmp(global_char, str) != 0) {
|
||||
fprintf(stderr, "Test variables 1 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char str[256];
|
||||
sprintf(str, "%s%d", OTHERLAND_MSG, i);
|
||||
sprintf(global_char_array1, "%s%d", OTHERLAND_MSG, i);
|
||||
if (strcmp(global_char_array1, str) != 0) {
|
||||
fprintf(stderr, "Test variables 2 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char str[256];
|
||||
sprintf(str, "%s%d", OTHERLAND_MSG, i);
|
||||
sprintf(global_char_array2, "%s%d", OTHERLAND_MSG, i);
|
||||
if (strcmp(global_char_array2, str) != 0) {
|
||||
fprintf(stderr, "Test variables 3 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
if (strcmp(global_const_char, CPLUSPLUS_MSG) != 0) {
|
||||
fprintf(stderr, "Test variables 3 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
for (i=0; i<count; i++) {
|
||||
if (strcmp(global_const_char_array1, CPLUSPLUS_MSG) != 0) {
|
||||
fprintf(stderr, "Test variables 5 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
if (strcmp(global_const_char_array2, CPLUSPLUS_MSG) != 0) {
|
||||
fprintf(stderr, "Test variables 6 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// char *& tests
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char **str = GetConstCharPointerRef();
|
||||
if (strcmp(*str, CPLUSPLUS_MSG) != 0) {
|
||||
fprintf(stderr, "Test char pointer ref get failed, iteration %d\n",i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char *str = (char*) malloc(sizeof(char) * 256);
|
||||
sprintf(str, "%s%d", OTHERLAND_MSG, i);
|
||||
if (!SetConstCharPointerRef((char **) &str, i)) {
|
||||
fprintf(stderr, "Test char pointer ref set failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
SWIG_exit(0);
|
||||
}
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "char_strings/char_strings_wrap.h"
|
||||
|
||||
int main() {
|
||||
char *CPLUSPLUS_MSG = "A message from the deep dark world of C++, where anything is possible.";
|
||||
char *OTHERLAND_MSG = "Little message from the safe world.";
|
||||
|
||||
long count = 10000;
|
||||
long i = 0;
|
||||
|
||||
// get functions
|
||||
for (i=0; i<count; i++) {
|
||||
char *str = GetCharHeapString();
|
||||
if (strcmp(str, CPLUSPLUS_MSG) != 0) {
|
||||
fprintf(stderr, "Test char get 1 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
DeleteCharHeapString();
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
const char *str = GetConstCharProgramCodeString();
|
||||
if (strcmp(str, CPLUSPLUS_MSG) != 0) {
|
||||
fprintf(stderr, "Test char get 2 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
DeleteCharHeapString();
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char *str = GetCharStaticString();
|
||||
if (strcmp(str, CPLUSPLUS_MSG) != 0) {
|
||||
fprintf(stderr, "Test char get 3 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char *str = GetCharStaticStringFixed();
|
||||
if (strcmp(str, CPLUSPLUS_MSG) != 0) {
|
||||
fprintf(stderr, "Test char get 4 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
const char *str = GetConstCharStaticStringFixed();
|
||||
if (strcmp(str, CPLUSPLUS_MSG) != 0) {
|
||||
fprintf(stderr, "Test char get 5 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// set functions
|
||||
for (i=0; i<count; i++) {
|
||||
char str[256];
|
||||
sprintf(str, "%s%d", OTHERLAND_MSG, i);
|
||||
if (!SetCharHeapString(str, i)) {
|
||||
fprintf(stderr, "Test char set 1 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char str[256];
|
||||
sprintf(str, "%s%d", OTHERLAND_MSG, i);
|
||||
if (!SetCharStaticString(str, i)) {
|
||||
fprintf(stderr, "Test char set 2 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char str[256];
|
||||
sprintf(str, "%s%d", OTHERLAND_MSG, i);
|
||||
if (!SetCharArrayStaticString(str, i)) {
|
||||
fprintf(stderr, "Test char set 3 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char str[256];
|
||||
sprintf(str, "%s%d", OTHERLAND_MSG, i);
|
||||
if (!SetConstCharHeapString(str, i)) {
|
||||
fprintf(stderr, "Test char set 4 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char str[256];
|
||||
sprintf(str, "%s%d", OTHERLAND_MSG, i);
|
||||
if (!SetConstCharStaticString(str, i)) {
|
||||
fprintf(stderr, "Test char set 5 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char str[256];
|
||||
sprintf(str, "%s%d", OTHERLAND_MSG, i);
|
||||
if (!SetConstCharArrayStaticString(str, i)) {
|
||||
fprintf(stderr, "Test char set 6 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// get set function
|
||||
for (i=0; i<count; i++) {
|
||||
char ping[256];
|
||||
sprintf(ping, "%s%d", OTHERLAND_MSG, i);
|
||||
char *pong = CharPingPong(ping);
|
||||
if (strcmp(ping, pong) != 0) {
|
||||
fprintf(stderr, "Test PingPong 1 failed.\nExpected:%d\nReceived:%d\n", ping, pong);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// variables
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char str[256];
|
||||
sprintf(str, "%s%d", OTHERLAND_MSG, i);
|
||||
global_char = str;
|
||||
if (strcmp(global_char, str) != 0) {
|
||||
fprintf(stderr, "Test variables 1 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char str[256];
|
||||
sprintf(str, "%s%d", OTHERLAND_MSG, i);
|
||||
sprintf(global_char_array1, "%s%d", OTHERLAND_MSG, i);
|
||||
if (strcmp(global_char_array1, str) != 0) {
|
||||
fprintf(stderr, "Test variables 2 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char str[256];
|
||||
sprintf(str, "%s%d", OTHERLAND_MSG, i);
|
||||
sprintf(global_char_array2, "%s%d", OTHERLAND_MSG, i);
|
||||
if (strcmp(global_char_array2, str) != 0) {
|
||||
fprintf(stderr, "Test variables 3 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
if (strcmp(global_const_char, CPLUSPLUS_MSG) != 0) {
|
||||
fprintf(stderr, "Test variables 3 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
for (i=0; i<count; i++) {
|
||||
if (strcmp(global_const_char_array1, CPLUSPLUS_MSG) != 0) {
|
||||
fprintf(stderr, "Test variables 5 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
if (strcmp(global_const_char_array2, CPLUSPLUS_MSG) != 0) {
|
||||
fprintf(stderr, "Test variables 6 failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// char *& tests
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char **str = GetConstCharPointerRef();
|
||||
if (strcmp(*str, CPLUSPLUS_MSG) != 0) {
|
||||
fprintf(stderr, "Test char pointer ref get failed, iteration %d\n",i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
char *str = (char*) malloc(sizeof(char) * 256);
|
||||
sprintf(str, "%s%d", OTHERLAND_MSG, i);
|
||||
if (!SetConstCharPointerRef((char **) &str, i)) {
|
||||
fprintf(stderr, "Test char pointer ref set failed, iteration %d\n", i);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
SWIG_exit(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "enums/enums_wrap.h"
|
||||
|
||||
int main() {
|
||||
bar2(1);
|
||||
bar3(1);
|
||||
bar1(1);
|
||||
SWIG_exit(0);
|
||||
}
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "enums/enums_wrap.h"
|
||||
|
||||
int main() {
|
||||
bar2(1);
|
||||
bar3(1);
|
||||
bar1(1);
|
||||
SWIG_exit(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,65 +1,65 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "exception_order/exception_order_wrap.h"
|
||||
|
||||
int main() {
|
||||
A* a = new_A();
|
||||
|
||||
SWIG_try {
|
||||
A_foo(a);
|
||||
}
|
||||
SWIG_catch(E1) {
|
||||
|
||||
}
|
||||
SWIG_catch(SWIG_AnyException) {
|
||||
fprintf(stderr, "foo: bad exception order\n");
|
||||
}
|
||||
SWIG_endtry;
|
||||
|
||||
SWIG_try {
|
||||
A_bar(a);
|
||||
}
|
||||
SWIG_catch(E2) {
|
||||
|
||||
}
|
||||
SWIG_catch(SWIG_AnyException) {
|
||||
fprintf(stderr, "bar: bad exception order\n");
|
||||
}
|
||||
SWIG_endtry;
|
||||
|
||||
SWIG_try {
|
||||
A_foobar(a);
|
||||
}
|
||||
SWIG_catch(SWIG_AnyException) {
|
||||
if (strcmp(SWIG_exc.msg, "postcatch unknown") != 0) {
|
||||
fprintf(stderr, "bad exception order\n");
|
||||
SWIG_throw_msg(SWIG_exc.klass, SWIG_exc.msg);
|
||||
}
|
||||
}
|
||||
SWIG_endtry;
|
||||
|
||||
SWIG_try {
|
||||
A_barfoo(a, 1);
|
||||
}
|
||||
SWIG_catch(E1) {
|
||||
|
||||
}
|
||||
SWIG_catch(SWIG_AnyException) {
|
||||
fprintf(stderr, "barfoo(1): bad exception order\n");
|
||||
}
|
||||
SWIG_endtry;
|
||||
|
||||
SWIG_try {
|
||||
A_barfoo(a, 2);
|
||||
}
|
||||
SWIG_catch(E2) {
|
||||
|
||||
}
|
||||
SWIG_catch(SWIG_AnyException) {
|
||||
fprintf(stderr, "barfoo(2): bad exception order\n");
|
||||
}
|
||||
SWIG_endtry;
|
||||
|
||||
SWIG_exit(0);
|
||||
}
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "exception_order/exception_order_wrap.h"
|
||||
|
||||
int main() {
|
||||
A* a = new_A();
|
||||
|
||||
SWIG_try {
|
||||
A_foo(a);
|
||||
}
|
||||
SWIG_catch(E1) {
|
||||
|
||||
}
|
||||
SWIG_catch(SWIG_AnyException) {
|
||||
fprintf(stderr, "foo: bad exception order\n");
|
||||
}
|
||||
SWIG_endtry;
|
||||
|
||||
SWIG_try {
|
||||
A_bar(a);
|
||||
}
|
||||
SWIG_catch(E2) {
|
||||
|
||||
}
|
||||
SWIG_catch(SWIG_AnyException) {
|
||||
fprintf(stderr, "bar: bad exception order\n");
|
||||
}
|
||||
SWIG_endtry;
|
||||
|
||||
SWIG_try {
|
||||
A_foobar(a);
|
||||
}
|
||||
SWIG_catch(SWIG_AnyException) {
|
||||
if (strcmp(SWIG_exc.msg, "postcatch unknown") != 0) {
|
||||
fprintf(stderr, "bad exception order\n");
|
||||
SWIG_throw_msg(SWIG_exc.klass, SWIG_exc.msg);
|
||||
}
|
||||
}
|
||||
SWIG_endtry;
|
||||
|
||||
SWIG_try {
|
||||
A_barfoo(a, 1);
|
||||
}
|
||||
SWIG_catch(E1) {
|
||||
|
||||
}
|
||||
SWIG_catch(SWIG_AnyException) {
|
||||
fprintf(stderr, "barfoo(1): bad exception order\n");
|
||||
}
|
||||
SWIG_endtry;
|
||||
|
||||
SWIG_try {
|
||||
A_barfoo(a, 2);
|
||||
}
|
||||
SWIG_catch(E2) {
|
||||
|
||||
}
|
||||
SWIG_catch(SWIG_AnyException) {
|
||||
fprintf(stderr, "barfoo(2): bad exception order\n");
|
||||
}
|
||||
SWIG_endtry;
|
||||
|
||||
SWIG_exit(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue