fixes and docs in %rename
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8160 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
7284595912
commit
2a3e528169
7 changed files with 586 additions and 319 deletions
|
|
@ -141,7 +141,7 @@ Swig_search_path_any(int syspath) {
|
|||
String *filename;
|
||||
String *dirname;
|
||||
List *slist, *llist;
|
||||
int i;
|
||||
int i, ilen;
|
||||
|
||||
llist = 0;
|
||||
slist = NewList();
|
||||
|
|
@ -160,8 +160,8 @@ Swig_search_path_any(int syspath) {
|
|||
} else {
|
||||
Append(slist,filename);
|
||||
}
|
||||
|
||||
for (i = 0; i < Len(directories); i++) {
|
||||
ilen = Len(directories);
|
||||
for (i = 0; i < ilen; i++) {
|
||||
dirname = Getitem(directories,i);
|
||||
filename = NewStringEmpty();
|
||||
assert(filename);
|
||||
|
|
@ -174,7 +174,8 @@ Swig_search_path_any(int syspath) {
|
|||
Delete(filename);
|
||||
}
|
||||
if (syspath) {
|
||||
for (i = 0; i < Len(llist); i++) {
|
||||
int ilen = Len(llist);
|
||||
for (i = 0; i < ilen; i++) {
|
||||
Append(slist,Getitem(llist,i));
|
||||
}
|
||||
Delete(llist);
|
||||
|
|
@ -202,7 +203,7 @@ Swig_open_any(const String_or_char *name, int sysfile) {
|
|||
String *filename;
|
||||
List *spath = 0;
|
||||
char *cname;
|
||||
int i;
|
||||
int i, ilen;
|
||||
|
||||
if (!directories) directories = NewList();
|
||||
assert(directories);
|
||||
|
|
@ -213,7 +214,8 @@ Swig_open_any(const String_or_char *name, int sysfile) {
|
|||
f = fopen(Char(filename),"r");
|
||||
if (!f) {
|
||||
spath = Swig_search_path_any(sysfile);
|
||||
for (i = 0; i < Len(spath); i++) {
|
||||
ilen = Len(spath);
|
||||
for (i = 0; i < ilen; i++) {
|
||||
Clear(filename);
|
||||
Printf(filename,"%s%s", Getitem(spath,i), cname);
|
||||
f = fopen(Char(filename),"r");
|
||||
|
|
@ -349,13 +351,14 @@ char *
|
|||
Swig_file_suffix(const String_or_char *filename) {
|
||||
char *d;
|
||||
char *c = Char(filename);
|
||||
int len = Len(filename);
|
||||
if (strlen(c)) {
|
||||
d = c + Len(filename) - 1;
|
||||
d = c + len - 1;
|
||||
while (d != c) {
|
||||
if (*d == '.') return d;
|
||||
d--;
|
||||
}
|
||||
return c+Len(filename);
|
||||
return c+len;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,6 +151,33 @@ String *Swig_string_title(String *s) {
|
|||
return ns;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_string_ctitle()
|
||||
*
|
||||
* Takes a string object and returns a copy that is lowercase with thefirst letter
|
||||
* capitalized and the one following '_', which are removed.
|
||||
*
|
||||
* camel_case -> CamelCase
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
String *Swig_string_ctitle(String *s) {
|
||||
String *ns;
|
||||
int first = 1;
|
||||
int c;
|
||||
ns = NewStringEmpty();
|
||||
|
||||
Seek(s,0,SEEK_SET);
|
||||
while ((c = Getc(s)) != EOF) {
|
||||
if (c == '_') {
|
||||
first = 1;
|
||||
continue;
|
||||
}
|
||||
Putc(first ? toupper(c) : tolower(c),ns);
|
||||
first = 0;
|
||||
}
|
||||
return ns;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_string_typecode()
|
||||
*
|
||||
|
|
@ -642,11 +669,11 @@ String *Swig_string_command(String *s) {
|
|||
}
|
||||
pclose(fp);
|
||||
}
|
||||
if (!fp || (errno) || (StringLen(res) == 0)) {
|
||||
if (!fp || (errno)) {
|
||||
Swig_error("SWIG",Getline(s), "Command encoder fails attempting '%s'.\n", s);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -665,6 +692,7 @@ Swig_init() {
|
|||
DohEncoding("upper", Swig_string_upper);
|
||||
DohEncoding("lower", Swig_string_lower);
|
||||
DohEncoding("title", Swig_string_title);
|
||||
DohEncoding("ctitle", Swig_string_ctitle);
|
||||
DohEncoding("typecode",Swig_string_typecode);
|
||||
DohEncoding("mangle",Swig_string_emangle);
|
||||
#if defined(HAVE_POPEN)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue