Opened 20 years ago

Closed 20 years ago

#847 closed defect (fixed)

mapscript.i are using C# keywords (string, in, out) as parameter causing SWIG compilation to fail.

Reported by: ykchoo@… Owned by: sgillies@…
Priority: high Milestone:
Component: MapScript-SWIG Version: 4.2
Severity: normal Keywords:
Cc:

Description

Three problems identified when compiling mapscript.i using SWIG (1.3.21)

1) C# (csharp) keywords are being used as parameters: string, in, and out. The 
files generated using SWIG (1.3.21) will not compile because of the keywords. 
For example "char *string" parameter is generated as "string string". 
Solution: renaming parameters with the keywords or use "#ifdef SWIGCSHAR" ...

2) The latest SWIG(1.3.21) has a bug in handling methods returning a pointer. 
For example "int *foo()" will be converted to "href int foo()". This will not 
work because href can only be used when defining parameter. 
Solution: Add a #ifdef, i.e. 
   #ifndef SWIGCSHARP
   %include typemaps.i
   #endif

3) labelCacheMemberObj structure contain a member named string.
Solution: edit the generated labelCacheMember.cs file "string string" to 
something like "string strings". I'm not sure what's the impact if it is 
possible to rename the "string" member.

Attachments (2)

mapscript.i (53.4 KB ) - added by ykchoo@… 20 years ago.
Example of a patch
mapscript.i-4.2.3-1.tar.gz (11.6 KB ) - added by sgillies@… 20 years ago.
patched mapscript.i 4.2.3-1

Download all attachments as: .zip

Change History (9)

comment:1 by sgillies@…, 20 years ago

It is good to see some action on the C# front.  I do not use the language
and do not have a .NET platform.  This means that I will require patches to
fix this bug.  I can merge the patches and make sure that they don't break
the other language interfaces.  

Would you be able to provide patches?  Are you familiar with using CVS?

1) These parameter names are bad for many reasons.  I'll make a sweep through
the files and fix the obvious ones.  Then you could try again and give me
some patches.

2) I think I just read about this bug on the swig list.  Isn't using 1.3.19
the best solution for now?

3) There are a *lot* of poorly named structure members in mapserver.  I'll
look and see how much work is involved in changing the string member.

Some questions for you, since I am unfamiliar with C#.  Is "text" a reserved
word?

comment:2 by sgillies@…, 20 years ago

Status: newassigned
OK, I just addressed part 1) in CVS HEAD and branch-4-2.  All my unit tests
pass.  Will await confirmation or a patch.

on 3 -- changing 'string' to 'labelstring' or such would involve edits to
5 or 6 files.  Not too bad, but I won't start on it until I get confirmation
on part 1.

by ykchoo@…, 20 years ago

Attachment: mapscript.i added

Example of a patch

comment:3 by sgillies@…, 20 years ago

dependson: 852
yk, since I already finished the renaming before you submitted the file, I'm
going to reject your file.  The inclusion of typemaps.i is now conditional,
as in your file.  As a workaround for the labelCacheMemberObj, I am going to
hide this class from C# until bug 852 is fixed.  It is not an essential part
of mapscript.

I am attaching a new mapscript.i file as a .tar.gz.  Please test it and
confirm if it works.


by sgillies@…, 20 years ago

Attachment: mapscript.i-4.2.3-1.tar.gz added

patched mapscript.i 4.2.3-1

comment:4 by sgillies@…, 20 years ago

attachments.description: patched mapscript.ipatched mapscript.i 4.2.3-1

comment:5 by ykchoo@…, 20 years ago

Resolution: fixed
Status: assignedclosed
Please note that patched mapscript.i 4.2.3-2 in BUG 848 fixes both C# and Java 
compilation errors. Thanks again for the quick response.

comment:6 by sgillies@…, 20 years ago

Resolution: fixed
Status: closedreopened
Y.K. -- don't close the bug prematurely, you should leave that up to the
engineer working on the bug (me).  

comment:7 by sgillies@…, 20 years ago

Resolution: fixed
Status: reopenedclosed
closed.

Note: See TracTickets for help on using tickets.