CN105005496A - Processing system and method for cross-language transformation of network data packet definition file - Google Patents
Processing system and method for cross-language transformation of network data packet definition file Download PDFInfo
- Publication number
- CN105005496A CN105005496A CN201510359949.5A CN201510359949A CN105005496A CN 105005496 A CN105005496 A CN 105005496A CN 201510359949 A CN201510359949 A CN 201510359949A CN 105005496 A CN105005496 A CN 105005496A
- Authority
- CN
- China
- Prior art keywords
- network data
- code analysis
- definition file
- data package
- file
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Landscapes
- Computer And Data Communications (AREA)
- Stored Programmes (AREA)
Abstract
The invention relates to a processing system for cross-language transformation of a network data packet definition file. The system comprises an analysis module for analyzing the network data packet definition file to generate different types of analysis codes, an acquisition module for acquiring definition parameters in the analysis codes and a language transformation module for performing code transformation by character string formatting to generate a definition file of a target language. The invention further relates to a processing method for the cross-language transformation network data packet definition file. For the problem that the structural body network data packet definition file needs to be manually transformed into the definition file of the target language, the invention provides the processing system capable of automatically finishing the transformation process, so that the target language and an old network data packet structure body (a C/C++ based network data packet definition file) can be transformed; and the processing system is high in speed, accurate in transformation and free of manual operation, saves the time of developers, reduces the development cost of internet software clients, and improves the development efficiency.
Description
Technical field
The present invention relates to computer programming language and field of computer network communication, particularly relate to a kind of disposal system across language conversion network data package definition file and method.
Background technology
Current computer software industry has multiple across computer programming language, cross-platform network communication protocol, but still has the old computer server software in many operations, is using traditional method directly passing through Internet Transmission C/C++ structure internal storage data.This method speed is fast, efficiency is high, configures between the C/C++ program generated very easy to use, therefore play at PC and be once widely used period prevailing in same platform, identical compiling.
At present, China has entered the mobile Internet epoch, a large amount of mobile Internet Games Software client no longer directly uses C/C++ to carry out writing of game service, but use plays more convenient, more easy-to-use script, as Lua language, JavaScript language etc.But during old server software is still runed on line, new mobile Internet software client needs to communicate with these old server softwares; These old server softwares use the means of communication directly transmitting C/C++ structure internal storage data, described the definition of network packet, and other programming language directly cannot use these structures to define by C/C++ structure.C/C++ structure internal storage data network packet to be received and dispatched in the scripts such as Lua, JavaScript of new mobile Internet software client, just need by C/C++ structure and under ad hoc structure member alignment thereof the data such as internal memory side-play amount, length of each member variable be converted to corresponding script definition, use for script.And this transfer process completes by manpower is manual before this, not only take time and effort, and easily make mistakes.
Summary of the invention
Technical matters to be solved by this invention is to provide a kind of disposal system across language conversion network data package definition file and method, by the manual problem being converted to the defined file of target language of manpower, a kind of disposal system and the method that automatically can complete this transfer process need be provided for structure network data package definition file.
The technical scheme that the present invention solves the problems of the technologies described above is as follows: a kind of disposal system across language conversion network data package definition file, comprises parsing module, acquisition module and language conversion module,
Described parsing module, generates each dissimilar code analysis for being resolved by network data package definition file;
Described acquisition module, generates executable file for carrying out compiling to each dissimilar code analysis, then performs described executable file to obtain the defined parameters in code analysis;
Described language conversion module, for the defined parameters of acquisition is carried out code conversion by string format, generates the defined file of target language.
String format refers to the element such as a character string (i.e. text), numeral (integer, floating number etc.), according to certain form (namely integer exports, gets the forms such as the decimal output of N position, sexadecimal output), be combined into a complete transcoding formats, when making system processes data, travelling speed is quick.
The invention has the beneficial effects as follows: the problem that need be converted to the defined file of target language for structure network data package definition file with manpower by hand, provide a kind of disposal system that automatically can complete this transfer process, change for target language and old network packet structure (the network data package definition file based on C/C++), this disposal system speed is fast, conversion accurately, do not need artificial participation, save the time of developer, reduce the cost of development of this type of internet works software client, improve development efficiency.
On the basis of technique scheme, the present invention can also do following improvement.
Further, described network data package definition file comprises macro definition content, enumeration type definition content and structure body definition content.
Further, each dissimilar code analysis described comprises macro definition code analysis, enumeration type code analysis and structure code analysis.
Further, described acquisition module carries out compiling to each dissimilar code analysis by operational character typeid and sizeof and generates executable file, perform described executable file again thus obtain the defined parameters in code analysis, described defined parameters comprises the title of each member variable, type, value and length.。
Further, described defined parameters also comprises the data obtaining the internal memory side-play amount of described each member variable by getting address subtractive method.
The beneficial effect of above-mentioned further scheme is adopted to be: after obtaining the information such as corresponding title, type, value, side-play amount, be just at once the definition of target language by string format code conversion, can write the storage code of these information so again, processing speed is fast and efficiency is high.
Another technical scheme that the present invention solves the problems of the technologies described above is as follows: a kind of disposal route across language conversion network data package definition file, comprises the steps:
Step S1: network data package definition file is resolved and generates each dissimilar code analysis;
Step S2: compiling is carried out to each dissimilar code analysis and generates executable file, then perform described executable file to obtain the defined parameters in code analysis;
Step S3: the defined parameters of acquisition is carried out code conversion by string format, generates the defined file of target language.
String format refers to the element such as a character string (i.e. text), numeral (integer, floating number etc.), according to certain form (namely integer exports, gets the forms such as the decimal output of N position, sexadecimal output), be combined into a complete transcoding formats, when making system processes data, travelling speed is quick.
On the basis of technique scheme, the present invention can also do following improvement.
Further, described network data package definition file comprises macro definition content, enumeration type definition content and structure body definition content.
Further, each dissimilar code analysis described comprises macro definition code analysis, enumeration type code analysis and structure code analysis.
Further, in step S2, by operational character typeid and sizeof, compiling is carried out to each dissimilar code analysis and generates executable file, then perform described executable file thus the defined parameters obtained in code analysis comprises the title of each member variable, type, value and length.
Further, described defined parameters also comprises the data obtaining the internal memory side-play amount of described each member variable by getting address subtractive method.
The beneficial effect of above-mentioned further scheme is adopted to be: after obtaining the information such as corresponding title, type, value, side-play amount, be just at once the definition of target language by string format code conversion, can write the storage code of these information so again, processing speed is fast and efficiency is high.
The present invention is directed to structure network data package definition file need be converted to the defined file of target language by hand problem with manpower, provide a kind of disposal route that automatically can complete this transfer process, change for target language and old network packet structure (the network data package definition file as based on C/C++), this disposal route speed is fast, conversion accurately, do not need artificial participation, save the time of developer, reduce the cost of development of this type of internet works software client, improve development efficiency.
Accompanying drawing explanation
Fig. 1 is the module frame chart of the present invention across the disposal system of language conversion network data package definition file;
Fig. 2 is the method flow diagram of the present invention across the disposal route of language conversion network data package definition file.
In accompanying drawing, the component names representated by each mark is as follows:
1, parsing module, 2, acquisition module 3, language conversion module.
Embodiment
Be described principle of the present invention and feature below in conjunction with accompanying drawing, example, only for explaining the present invention, is not intended to limit scope of the present invention.
As shown in Figure 1, a kind of disposal system across language conversion network data package definition file, comprises parsing module 1, acquisition module 2 and language conversion module 3,
Described parsing module 1, generates each dissimilar code analysis for being resolved by network data package definition file;
Described acquisition module 2, generates executable file for carrying out compiling to each dissimilar code analysis, then performs described executable file to obtain the defined parameters in code analysis;
Described language conversion module 3, for the defined parameters string format of acquisition is carried out code conversion, generates the defined file of target language.
Described network data package definition file comprises macro definition content, enumeration type definition content and structure body definition content.
Each dissimilar code analysis described comprises macro definition code analysis, enumeration type code analysis and structure code analysis.
Described acquisition module carries out compiling to each dissimilar code analysis by operational character typeid and sizeof and generates executable file, perform described executable file again thus obtain the defined parameters in code analysis, described defined parameters comprises the title of each member variable, type, value and length.
Described defined parameters also comprises the data obtaining the internal memory side-play amount of described each member variable by getting address subtractive method.
As shown in Figure 2, a kind of disposal route across language conversion network data package definition file, comprises the steps:
Step S1: network data package definition file is resolved and generates each dissimilar code analysis;
Step S2: compiling is carried out to each dissimilar code analysis and generates executable file, then perform described executable file to obtain the defined parameters in code analysis;
Step S3: the defined parameters of acquisition is carried out code conversion by string format, generates the defined file of target language.
String format refers to the element such as a character string (i.e. text), numeral (integer, floating number etc.), according to certain form (namely integer exports, gets the forms such as the decimal output of N position, sexadecimal output), be combined into a complete transcoding formats, when making system processes data, travelling speed is quick.
In step S2, by operational character typeid and sizeof, compiling is carried out to each dissimilar code analysis and generates executable file, then perform described executable file thus the defined parameters obtained in code analysis comprises the title of each member variable, type, value and length.
Described defined parameters also comprises the data obtaining the internal memory side-play amount of described each member variable by getting address subtractive method.
Described network data package definition file comprises macro definition content, enumeration type definition content and structure body definition content.
Each dissimilar code analysis described comprises macro definition code analysis, enumeration type code analysis and structure code analysis.
Specific embodiment:
To be converted to the defined file of Lua language based on the network data package definition file of C/C++,
Step 1: the network data package definition file of C/C++ is comprised macro definition content, enumeration type definition content and structure body definition content, its corresponding parsing is generated macro definition code analysis, enumeration type code analysis and structure code analysis;
For the macro definition content of simple numerical value and character string type, corresponding conversion is macro definition code analysis, as shown in table 1:
Table 1
Original definition | Code analysis |
#define MDM_CHAT_USER 1 | EXPORT_DEFINE(MDM_CHAT_USER); |
For enumeration type definition content, corresponding conversion is enumeration type code analysis, as shown in table 2:
Table 2
For structure definition content, corresponding conversion is structure code analysis, as shown in table 3:
Table 3
Step 2: compiling is carried out to each dissimilar code analysis and generates executable file, then perform described executable file to obtain the defined parameters in code analysis;
For the macro definition code analysis of simple numerical value and character string type, typeid () is used to obtain type corresponding in code analysis, as shown in table 4:
Table 4
Code analysis | The defined parameters of gained |
EXPORT_DEFINE(MDM_CHAT_USER); | Definition: title=MDM_CHAT_USER, type=int, value=1 |
The partial code realized is as follows:
For enumeration type code analysis, obtained its length of acquisition in code analysis by sizeof (), as shown in table 5:
Table 5
For structure code analysis, the length in code analysis is obtained by sizeof (), type corresponding to typeid () obtains, also need to obtain the internal memory side-play amount of this member variable relative to structure starting point, specific implementation is got address and subtract each other realized by the location operational character " & " of getting in C++, and the data of the internal memory side-play amount of described each member variable are obtained by getting address subtractive method, as shown in table 6:
Table 6
Step 3: the defined parameters obtained is carried out by " string format " code the defined file converting target language to;
Be the defined file of Lua language to the macro definition Parameter Switch of simple numerical value and character string type, as shown in table 7:
Table 7
The definition data of gained | Lua code definition |
Definition: title=MDM_CHAT_USER, type=int, value=1 | MDM_CHAT_USER=1; |
Of stream::operator<< in C++ specifically can be used to complete this transfer process, and the partial code of realization is as follows:
Std::of stream & strm; // needed for the file that outputs to
Std::string name; // title
Std::string type; // type
Std::string value; // value
if(type==”cstring”){
strm<<name<<“=\””<<value<<“\”;”;
}else{
strm<<name<<“=“<<value<<”\;”;
}
By the defined file that enumeration type definition Parameter Switch is Lua language, as shown in table 8:
Table 8
Structure defined parameters is converted to the defined file of Lua language, as shown in table 9:
Table 9
Soon, conversion accurately, does not need artificial participation, saves the time of developer, reduce the cost of development of this type of internet works software client, improve development efficiency for treatment method and system speed.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.
Claims (10)
1. across a disposal system for language conversion network data package definition file, it is characterized in that, comprise parsing module (1), acquisition module (2) and language conversion module (3),
Described parsing module (1), generates each dissimilar code analysis for being resolved by network data package definition file;
Described acquisition module (2), generates executable file for carrying out compiling to each dissimilar code analysis, then performs described executable file to obtain the defined parameters in code analysis;
Described language conversion module (3), for the defined parameters of acquisition is carried out code conversion by string format, generates the defined file of target language.
2. the disposal system across language conversion network data package definition file according to claim 1, is characterized in that, described network data package definition file comprises macro definition content, enumeration type definition content and structure body definition content.
3. the disposal system across language conversion network data package definition file according to claim 1, is characterized in that, each dissimilar code analysis described comprises macro definition code analysis, enumeration type code analysis and structure code analysis.
4. the disposal system across language conversion network data package definition file according to claim 1, it is characterized in that, described acquisition module (2) carries out compiling to each dissimilar code analysis by operational character typeid and sizeof and generates executable file, perform described executable file again thus obtain the defined parameters in code analysis, described defined parameters comprises the title of each member variable, type, value and length.
5. the disposal system across language conversion network data package definition file according to claim 4, is characterized in that, described defined parameters also comprises the data obtaining the internal memory side-play amount of described each member variable by getting address subtractive method.
6. across a disposal route for language conversion network data package definition file, it is characterized in that, comprise the steps:
Step S1: network data package definition file is resolved and generates each dissimilar code analysis;
Step S2: compiling is carried out to each dissimilar code analysis and generates executable file, then perform described executable file to obtain the defined parameters in code analysis;
Step S3: the defined parameters of acquisition is carried out code conversion by string format, generates the defined file of target language.
7. the disposal route across language conversion network data package definition file according to claim 6, is characterized in that, described network data package definition file comprises macro definition content, enumeration type definition content and structure body definition content.
8. the disposal route across language conversion network data package definition file according to claim 6, is characterized in that, each dissimilar code analysis described comprises macro definition code analysis, enumeration type code analysis and structure code analysis.
9. the disposal route across language conversion network data package definition file according to claim 6, it is characterized in that, in step S2, by operational character typeid and sizeof, compiling is carried out to each dissimilar code analysis and generates executable file, perform described executable file again thus obtain the defined parameters in code analysis, described defined parameters comprises the title of each member variable, type, value and length.
10. the disposal route across language conversion network data package definition file according to claim 9, is characterized in that, described defined parameters also comprises the data obtaining the internal memory side-play amount of described each member variable by getting address subtractive method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510359949.5A CN105005496B (en) | 2015-06-25 | 2015-06-25 | A kind of processing system and method for across language conversion network data package definition file |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510359949.5A CN105005496B (en) | 2015-06-25 | 2015-06-25 | A kind of processing system and method for across language conversion network data package definition file |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105005496A true CN105005496A (en) | 2015-10-28 |
CN105005496B CN105005496B (en) | 2018-05-08 |
Family
ID=54378176
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510359949.5A Active CN105005496B (en) | 2015-06-25 | 2015-06-25 | A kind of processing system and method for across language conversion network data package definition file |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105005496B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107172013A (en) * | 2017-04-18 | 2017-09-15 | 北京思特奇信息技术股份有限公司 | A kind of data transmission method and system |
CN109739512A (en) * | 2018-12-28 | 2019-05-10 | 江苏极光网络技术有限公司 | A kind of analytical type language text formula analysis conversion method |
CN113238491A (en) * | 2021-04-12 | 2021-08-10 | 湖南三一智能控制设备有限公司 | Simulation test method and device for actuating mechanism, intelligent arm support and engineering vehicle |
CN114741076A (en) * | 2022-04-20 | 2022-07-12 | 重庆长安汽车股份有限公司 | SOA service parameter fast definition method |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101261579A (en) * | 2007-03-08 | 2008-09-10 | 青牛(北京)技术有限公司 | Method for accomplishing VBScript language trans-platform uses |
CN102141991A (en) * | 2010-02-02 | 2011-08-03 | 钟巨航 | Method and system for web server |
CN102222004A (en) * | 2011-07-01 | 2011-10-19 | 福建富士通信息软件有限公司 | Method for transforming switch special language into C language |
CN103049300A (en) * | 2012-12-17 | 2013-04-17 | 福建天晴数码有限公司 | Method for supporting running of FLASH on WEB platform by C and C++ codes |
CN103092980A (en) * | 2013-01-31 | 2013-05-08 | 中国科学院自动化研究所 | Method and system of data automatic conversion and storage |
CN104636174A (en) * | 2015-02-02 | 2015-05-20 | 惠州Tcl移动通信有限公司 | Characteristic value defining and using method and system based on Android system |
-
2015
- 2015-06-25 CN CN201510359949.5A patent/CN105005496B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101261579A (en) * | 2007-03-08 | 2008-09-10 | 青牛(北京)技术有限公司 | Method for accomplishing VBScript language trans-platform uses |
CN102141991A (en) * | 2010-02-02 | 2011-08-03 | 钟巨航 | Method and system for web server |
CN102222004A (en) * | 2011-07-01 | 2011-10-19 | 福建富士通信息软件有限公司 | Method for transforming switch special language into C language |
CN103049300A (en) * | 2012-12-17 | 2013-04-17 | 福建天晴数码有限公司 | Method for supporting running of FLASH on WEB platform by C and C++ codes |
CN103092980A (en) * | 2013-01-31 | 2013-05-08 | 中国科学院自动化研究所 | Method and system of data automatic conversion and storage |
CN104636174A (en) * | 2015-02-02 | 2015-05-20 | 惠州Tcl移动通信有限公司 | Characteristic value defining and using method and system based on Android system |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107172013A (en) * | 2017-04-18 | 2017-09-15 | 北京思特奇信息技术股份有限公司 | A kind of data transmission method and system |
CN107172013B (en) * | 2017-04-18 | 2020-08-04 | 北京思特奇信息技术股份有限公司 | Data transmission method and system |
CN109739512A (en) * | 2018-12-28 | 2019-05-10 | 江苏极光网络技术有限公司 | A kind of analytical type language text formula analysis conversion method |
CN113238491A (en) * | 2021-04-12 | 2021-08-10 | 湖南三一智能控制设备有限公司 | Simulation test method and device for actuating mechanism, intelligent arm support and engineering vehicle |
CN114741076A (en) * | 2022-04-20 | 2022-07-12 | 重庆长安汽车股份有限公司 | SOA service parameter fast definition method |
CN114741076B (en) * | 2022-04-20 | 2024-05-31 | 重庆长安汽车股份有限公司 | SOA service parameter rapid definition method |
Also Published As
Publication number | Publication date |
---|---|
CN105005496B (en) | 2018-05-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109460219B (en) | Method for quickly serializing interface control file | |
CN105005496A (en) | Processing system and method for cross-language transformation of network data packet definition file | |
CN101841515B (en) | Target variable protocol data unit codec code automatic generation implementation method | |
CN101788992A (en) | Method and system for converting query sentence of database | |
US9122540B2 (en) | Transformation of computer programs and eliminating errors | |
CN115293751B (en) | Method, system and equipment for processing BIM model data of rail transit | |
CN106970820A (en) | Code storage method and code storage | |
CN113778449B (en) | Avionic interface data adaptation conversion system | |
CN106713357A (en) | Universal network protocol analysis method | |
CN105072130A (en) | Method for automatically generating code of ASN.1 decoder | |
CN106055450A (en) | Binary log analysis method and apparatus | |
CN101201833A (en) | System and method for filling PDF document data | |
CN103780624A (en) | General application layer network communication protocol application method for complicated system | |
CN112882844A (en) | Network front-end and back-end based joint debugging method and device and storage medium | |
CN116227505A (en) | Internationalization file translation method, device, equipment and medium | |
CN104750468B (en) | A kind of server-side topological data conversion method and conversion equipment | |
CN102270223B (en) | The generation method in source codec storehouse, device and source codec method, device | |
CN108153896B (en) | Processing method and device for input data and output data | |
CN113887182A (en) | Table generation method, device, equipment and storage medium | |
CN101261643A (en) | Website page information statistical method and apparatus | |
CN102937910B (en) | System and method for cross-platform conversion of control algorithms | |
CN105793842B (en) | Conversion method and device between serialized message | |
CN116775599A (en) | Data migration method, device, electronic equipment and storage medium | |
CN104021121A (en) | Method, device and server for compressing text data | |
Jeong et al. | WATT: A novel web-based toolkit to generate WebAssembly-based libraries and applications |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CP01 | Change in the name or title of a patent holder |
Address after: 541000 Xifeng Road, Xiufeng District, Guilin, the Guangxi Zhuang Autonomous Region, 2 Patentee after: Guilin harbour network Polytron Technologies Inc Address before: 541000 Xifeng Road, Xiufeng District, Guilin, the Guangxi Zhuang Autonomous Region, 2 Patentee before: Guilin Li Gang network technology company limited |
|
CP01 | Change in the name or title of a patent holder |