[ 
https://issues.apache.org/jira/browse/AXIS2C-1506?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Lazarski resolved AXIS2C-1506.
-------------------------------------
    Resolution: Implemented

 The three bugs from AXIS2C-1506 are already handled by the native     
  generator:                                                            
                                                                        
  1. Invalid characters in C tokens (Bug #1):                           
    - Function wsdl2c_sanitize_c_identifier() in stub_generator.c:81-149
    - Replaces -, ., :, /, spaces with _                                
    - Adds prefix _ for names starting with digits                      
    - Appends _value for C reserved keywords                            
  2. Cyclic #include directives (Bug #2):                               
    - Headers use forward declarations (typedef struct adb_X adb_X_t;)  
    - No cross-type includes between ADB headers                        
    - Complex type references treated as strings                        
  3. Uppercase-lowercase enum collision (Bug #3):                       
    - simpleType enumerations treated as axis2_char_t* (strings)        
    - No C enums generated, avoiding case collisions                    
                                                                        
  Files Added/Modified                                                  
  File: test/wsdl/axis2c_1506_c_identifier_test.wsdl                    
  Change: New test WSDL                                                 
  ────────────────────────────────────────                              
  File: test/src/test_axis2c_1506_ehealth_schema.c                      
  Change: New test file with 4 tests                                    
  ────────────────────────────────────────                              
  File: test/include/adb_test_framework.h                               
  Change: Added test declarations                                       
  ────────────────────────────────────────                              
  File: test/src/adb_test_framework.c                                   
  Change: Added test suite execution                                    
  ────────────────────────────────────────                              
  File: test/Makefile.am                                                
  Change: Added new source file                                         
  Test Results                                                          
                                                                        
  - 87 tests passed (including 4 new AXIS2C-1506 tests)                 
  - All tests verify identifier sanitization, cyclic include prevention,
   and case-sensitive enum handling    

> 3 bugs in C code generation (invalid characters in c tokens, cyclic inclusion 
> and uppercase-lowercase mismatch)
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2C-1506
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-1506
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: code generation
>         Environment: Tested on Linux, but shall be present on all platforms
>            Reporter: Brice André
>            Priority: Major
>              Labels: patch
>         Attachments: ehealthxsd-hubservices-1-0-1.zip, patch.diff
>
>
> I have encountered 3 bugs when trying to generate soap c-client code with the 
> wsdl2c tool.
> I create a single issue because I have only one patch for all bugs.
> The first bug encountered is the presence of invalid characters in c tokens 
> (in my case, the '-' character) when a type name containing an enumeration 
> contains such invalid character. An example of schema that generates this bug 
> is the following:
>       <s:simpleType name="Temperature-Unit">
>         <s:restriction base="s:string">
>           <s:enumeration value="C"/>
>           <s:enumeration value="F"/>
>           <s:enumeration value="R"/>
>           <s:enumeration value="r"/>
>           <s:enumeration value="k"/>
>         </s:restriction>
>       </s:simpleType>
> I think that the solution to this problem is to change the C xml template 
> filess in order to insert the property for which all invalid characters were 
> replaced by '_'.
> The second problem arrises when generating code with one file per data type 
> on very large projects : I did not identified which part of the schema was 
> causing the trouble, but the #include directives are cyclic, which prevents 
> the compilation of the code.
> I think that the solution to this problem is to change the C xml header 
> template in order to declare the structure of each data type before 
> performing inclusions.
> The third problem encountered arises when an enumeration type contains two 
> different values that differ only by upper or lowercase characters. The 
> generated C enum has all fields written in upper-case and so, both elements 
> have the same name. The sample of wsdl schema written above contains such an 
> error.
> In this case, the solution of the problem is not so trivial. A simple way to 
> remove it is to keep the case (upper or lower) of the wsdl enumeration in the 
> C structure. But this change would implies that new generated code will not 
> be compatible with the previously one. I chose this way for solving the 
> problem and so, I created a new property, called nu_id (nu stands for 
> non-uppercase), which contains the original id (with removed invalid 
> characters for c tokens) and I changed the C xml templates so that this new 
> property is used for code generation.
> I don't see any way of joining files during the creation of an issue, but, 
> when I will find a way to do so, I will join an example of wsdl file that 
> generates the three problems as well as a patch that seems to correct all of 
> them. If you don't find the attached files, fell free to contact me. I will 
> send both files.
> I used the following command to generate the code :
> WSDL2C.sh -uri ../WSDL/ehealth-hubservices/WSDL/InterHubWebService-1_0.wsdl 
> -u -o Generated/.
> I used the following command to compile the generated elements : 
> gcc -c -combine -o ${OBJ_DIR}/axis2_stub_InterHubService.o 
> -I${AXIS2C_HOME}/include src/*.c
> Best Regards,
> Brice André



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to