CN105005496B - A kind of processing system and method for across language conversion network data package definition file - Google Patents
A kind of processing system and method for across language conversion network data package definition file Download PDFInfo
- Publication number
- CN105005496B CN105005496B CN201510359949.5A CN201510359949A CN105005496B CN 105005496 B CN105005496 B CN 105005496B CN 201510359949 A CN201510359949 A CN 201510359949A CN 105005496 B CN105005496 B CN 105005496B
- Authority
- CN
- China
- Prior art keywords
- code analysis
- network data
- data package
- code
- different types
- 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.)
- Active
Links
Landscapes
- Stored Programmes (AREA)
- Computer And Data Communications (AREA)
Abstract
The present invention relates to a kind of processing system of across language conversion network data package definition file, including the language conversion module for defining file by the acquisition module of the defined parameters in the parsing module of each different types of code analysis of network data package definition document analysis generation, acquisition code analysis and string formatization progress code conversion generation object language;The invention further relates to a kind of processing method of across language conversion network data package definition file;The problem of present invention need to be converted to the definition file of object language by hand for structure network data package definition file with manpower, provide a kind of processing system that can automatically complete this transfer process, so that object language and old network packet structure (the network data package definition file based on C/C++) are changed, the processing system speed is fast, conversion is accurate, it is not required to manually participate in, save the time of developer, the development cost of such internet works software client is reduced, improves development efficiency.
Description
Technical field
The present invention relates to computer programming language and field of computer network communication, more particularly to one kind is across language conversion
The processing system and method for network data package definition file.
Background technology
Computer software industry has a variety of network communication protocols across computer programming language, cross-platform at present, but still
There is the old computer server software in many operations, using traditional direct by network transmission C/C++ structures
The method of deposit data.This method speed is fast, efficient, between same platform, identical compiling configure generated C/C++ programs
It is very easy to use, therefore be once widely used in the period of PC game is prevailing.
At present, China has come into the mobile Internet epoch, and a large amount of mobile Internet Games Software clients are no longer
Writing for game service directly is carried out using C/C++, but use has played more convenient, more easy-to-use script, such as Lua languages
Speech, JavaScript language etc..But during old server software is still runed on line, new mobile Internet software client
Need to communicate with the server software that these are old;These old server softwares use directly transmission C/C++ structures
The means of communication of internal storage data, the definition of network packet is described by C/C++ structures, and other programming languages can not be straight
Connect and defined using these structures.Will be in the scripts such as new Lua, JavaScript of mobile Internet software client
Receive and dispatch C/C++ structure internal storage data network bags, it is necessary to by C/C++ structures and its under specific structure member's alignment thereof
The data such as the memory offset of each member variable, length are converted to corresponding script definition, so that script uses.And
This transfer process is had been manually done by manpower before this, is not only taken time and effort, but also is easily malfunctioned.
The content of the invention
The technical problems to be solved by the invention are to provide a kind of processing of across language conversion network data package definition file
System and method, need to be converted to the definition file of object language by hand for structure network data package definition file with manpower
A kind of problem, there is provided processing system and method that can automatically complete this transfer process.
The technical solution that the present invention solves above-mentioned technical problem is as follows:A kind of across language conversion network data package definition file
Processing system, including parsing module, acquisition module and language conversion module,
The parsing module, for network data package definition document analysis to be generated each different types of code analysis;
The acquisition module, for being compiled generation executable file to each different types of code analysis, then holds
The executable file go to obtain the defined parameters in code analysis;
The language conversion module, it is raw for the defined parameters of acquisition to be carried out code conversion by string formatization
Into the definition file of object language.
String format refers to the element such as character string (i.e. text), digital (integer, floating number etc.), according to certain
Form (i.e. integer exports, takes the forms such as N decimals outputs, hexadecimals output), is combined into a complete code conversion lattice
Formula, the speed of service is quick when making system processes data.
The beneficial effects of the invention are as follows:For structure network data package definition file target need to be converted to by hand with manpower
The problem of definition file of language, there is provided a kind of processing system that can automatically complete this transfer process, for target
Language is changed, the processing system with old network packet structure (the network data package definition file based on C/C++)
Speed of uniting is fast, and conversion is accurate, is not required to manually participate in, saves the time of developer, reduces such internet works software client
The development cost at end, improves development efficiency.
Based on the above technical solutions, the present invention can also be improved as follows.
Further, the network data package definition file includes macrodefinition content, enumeration type definition content and structure body
Define content.
Further, each different types of code analysis includes macrodefinition code analysis, enumeration type code analysis
With structure code analysis.
Further, the acquisition module to each different types of code analysis by operator typeid and sizeof into
Row compiling generation executable file, then the executable file is performed so as to obtain the defined parameters in code analysis, it is described fixed
Adopted parameter includes title, type, value and the length of each member variable..
Further, the defined parameters are further included is deviated by the memory for taking address subtractive method to obtain each member variable
The data of amount.
It is using the above-mentioned further beneficial effect of scheme:Obtain the information such as corresponding title, type, value, offset
Afterwards, these information may not necessarily be so write again just by the definition that string format code conversion is object language at once
Store code, processing speed are fast and efficient.
Another technical solution that the present invention solves above-mentioned technical problem is as follows:A kind of across language conversion network data package definition
The processing method of file, includes the following steps:
Step S1:Network data package definition document analysis is generated into each different types of code analysis;
Step S2:Generation executable file is compiled to each different types of code analysis, then performs and described can hold
Part compose a piece of writing to obtain the defined parameters in code analysis;
Step S3:The defined parameters of acquisition are subjected to code conversion by string formatization, generate determining for object language
Adopted file.
String format refers to the element such as character string (i.e. text), digital (integer, floating number etc.), according to certain
Form (i.e. integer exports, takes the forms such as N decimals outputs, hexadecimals output), is combined into a complete code conversion lattice
Formula, the speed of service is quick when making system processes data.
Based on the above technical solutions, the present invention can also be improved as follows.
Further, the network data package definition file includes macrodefinition content, enumeration type definition content and structure body
Define content.
Further, each different types of code analysis includes macrodefinition code analysis, enumeration type code analysis
With structure code analysis.
Further, in step S2, each different types of code analysis is carried out by operator typeid and sizeof
Compiling generation executable file, then the executable file is performed so as to which the defined parameters obtained in code analysis include each member
Title, type, value and the length of variable.
Further, the defined parameters are further included is deviated by the memory for taking address subtractive method to obtain each member variable
The data of amount.
It is using the above-mentioned further beneficial effect of scheme:Obtain the information such as corresponding title, type, value, offset
Afterwards, these information may not necessarily be so write again just by the definition that string format code conversion is object language at once
Store code, processing speed are fast and efficient.
The present invention need to be converted to the definition text of object language by hand for structure network data package definition file with manpower
The problem of part, there is provided a kind of processing method that can automatically complete this transfer process, for object language with it is old
Network packet structure (the network data package definition file such as based on C/C++) is changed, and the processing method speed is fast, is turned
It is accurate to change, and is not required to manually participate in, saves the time of developer, reduce the exploitation of such internet works software client into
This, improves development efficiency.
Brief description of the drawings
Fig. 1 is the module frame chart of the processing system of across the language conversion network data package definition file of the present invention;
Fig. 2 is the method flow diagram of the processing method of across the language conversion network data package definition file of the present invention.
In attached drawing, the representative component names of each mark are as follows:
1st, parsing module, 2, acquisition module 3, language conversion module.
Embodiment
The principle and features of the present invention will be described below with reference to the accompanying drawings, and the given examples are served only to explain the present invention, and
It is non-to be used to limit the scope of the present invention.
As shown in Figure 1, a kind of processing system of across language conversion network data package definition file, including parsing module 1, obtain
Modulus block 2 and language conversion module 3,
The parsing module 1, for network data package definition document analysis to be generated each different types of code analysis;
The acquisition module 2, for being compiled generation executable file to each different types of code analysis, then holds
The executable file go to obtain the defined parameters in code analysis;
The language conversion module 3, for the defined parameters string formatization of acquisition to be carried out code conversion, generates mesh
The definition file of poster speech.
In the network data package definition file includes macrodefinition content, enumeration type definition content and structure body defines
Hold.
Each different types of code analysis includes macrodefinition code analysis, enumeration type code analysis and structure
Code analysis.
The acquisition module is compiled each different types of code analysis by operator typeid and sizeof
Executable file is generated, then performs the executable file so as to obtain the defined parameters in code analysis, the defined parameters
Title, type, value and length including each member variable.
The defined parameters further include the number of the memory offset by taking address subtractive method to obtain each member variable
According to.
As shown in Fig. 2, a kind of processing method of across language conversion network data package definition file, includes the following steps:
Step S1:Network data package definition document analysis is generated into each different types of code analysis;
Step S2:Generation executable file is compiled to each different types of code analysis, then performs and described can hold
Part compose a piece of writing to obtain the defined parameters in code analysis;
Step S3:The defined parameters of acquisition are subjected to code conversion by string formatization, generate determining for object language
Adopted file.
String format refers to the element such as character string (i.e. text), digital (integer, floating number etc.), according to certain
Form (i.e. integer exports, takes the forms such as N decimals outputs, hexadecimals output), is combined into a complete code conversion lattice
Formula, the speed of service is quick when making system processes data.
In step S2, generation is compiled by operator typeid and sizeof to each different types of code analysis
Executable file, then the executable file is performed so as to which the defined parameters obtained in code analysis include the name of each member variable
Title, type, value and length.
The defined parameters further include the number of the memory offset by taking address subtractive method to obtain each member variable
According to.
In the network data package definition file includes macrodefinition content, enumeration type definition content and structure body defines
Hold.
Each different types of code analysis includes macrodefinition code analysis, enumeration type code analysis and structure
Code analysis.
Specific embodiment:
By taking the network data package definition file based on C/C++ is converted to the definition file of Lua language as an example,
Step 1:The network data package definition file of C/C++ is included into macrodefinition content, enumeration type definition content and knot
Structure body defines content, is corresponded to parsing generation macrodefinition code analysis, enumeration type code analysis and structure code analysis;
For the macrodefinition content of simple numerical value and character string type, corresponding conversion is macrodefinition code analysis, such as table 1
It is shown:
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
Content is defined for structure, corresponding conversion is structure code analysis, as shown in table 3:
Table 3
Step 2:Generation executable file is compiled to each different types of code analysis, then is performed described executable
File obtains the defined parameters in code analysis;
For the macrodefinition code analysis of simple numerical value and character string type, code analysis is obtained using typeid ()
In corresponding type, 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 of realization is as follows:
For enumeration type code analysis, the acquisition in code analysis its length is obtained by sizeof (), such as the institute of table 5
Show:
Table 5
For structure code analysis, the length in code analysis is obtained by sizeof (), typeid () obtains institute
Corresponding type, it is also necessary to obtain memory offset of the member variable relative to structure starting point, specific implementation is to pass through C++
In take location operator " & " to take address and subtract each other to realize, and by taking address subtractive method to obtain each member variable
The data of memory offset, as shown in table 6:
Table 6
Step 3:The defined parameters of acquisition by " string format " code be converted into the definition of object language
File;
Macrodefinition Parameter Switch to simple numerical value and character string type is the definition file of Lua language, such as the institute of table 7
Show:
Table 7
The definition data of gained | Lua code definitions |
Definition:Title=MDM_CHAT_USER, type=int, value=1 | MDM_CHAT_USER=1; |
Of stream in C++ can specifically be used::operator<<To complete this transfer process, the part of realization
Code is as follows:
std::of stream&strm;// required the file being output to
std::string name;// title
std::string type;// type
std::string value;// value
If (type==" cstring ")
strm<<name<<"=" "<<value<<“\”;”;
}else{
strm<<name<<"="<<value<<”\;”;
}
Definition file by enumeration type definition Parameter Switch for Lua language, as shown in table 8:
Table 8
Structure defined parameters are converted to the definition file of Lua language, as shown in table 9:
Table 9
Treatment method and system speed are fast, and conversion is accurate, is not required to manually participate in, saves the time of developer, drop
The low development cost of such internet works software client, improves development efficiency.
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all the present invention spirit and
Within principle, any modification, equivalent replacement, improvement and so on, should all be included in the protection scope of the present invention.
Claims (2)
- A kind of 1. processing system of across language conversion network data package definition file, it is characterised in that including parsing module (1), Acquisition module (2) and language conversion module (3),The parsing module (1), for network data package definition document analysis to be generated each different types of code analysis;Institute State network data package definition file and define content including macrodefinition content, enumeration type definition content and structure body, it is described each Different types of code analysis includes macrodefinition code analysis, enumeration type code analysis and structure code analysis;The acquisition module (2), for being compiled generation executable file to each different types of code analysis, then performs The executable file obtains the defined parameters in code analysis:Operator is passed through to each different types of code analysis Typeid and sizeof is compiled generation executable file, then performs the executable file so as to obtain in code analysis Defined parameters, the defined parameters include title, type, value and the length of each member variable, further include by taking address to subtract each other Method obtains the data of the memory offset of each member variable;The language conversion module (3), for the defined parameters of acquisition to be carried out code conversion, generation by string formatization The definition file of object language.
- 2. a kind of processing method of across language conversion network data package definition file, it is characterised in that include the following steps:Step S1:Network data package definition document analysis is generated into each different types of code analysis;The network packet Definition file includes macrodefinition content, enumeration type definition content and structure body defines content, described each different types of point Analysis code includes macrodefinition code analysis, enumeration type code analysis and structure code analysis;Step S2:Generation executable file is compiled to each different types of code analysis, then performs the executable text Part obtains the defined parameters in code analysis:Operator typeid and sizeof are passed through to each different types of code analysis Generation executable file is compiled, then performs the executable file so as to obtain the defined parameters in code analysis, it is described Defined parameters include title, type, value and the length of each member variable, further include by take address subtractive method obtain it is described respectively into The data of the memory offset of member's variable;Step S3:The defined parameters of acquisition are subjected to code conversion by string formatization, generate the definition text of object language Part.
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 CN105005496A (en) | 2015-10-28 |
CN105005496B true 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) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107172013B (en) * | 2017-04-18 | 2020-08-04 | 北京思特奇信息技术股份有限公司 | Data transmission method and system |
CN109739512B (en) * | 2018-12-28 | 2022-04-12 | 江苏极光网络技术有限公司 | Analytic language text type analysis and conversion method |
CN113238491B (en) * | 2021-04-12 | 2023-05-05 | 湖南三一智能控制设备有限公司 | Simulation test method and device of execution mechanism, intelligent arm support and engineering vehicle |
CN114741076B (en) * | 2022-04-20 | 2024-05-31 | 重庆长安汽车股份有限公司 | SOA service parameter rapid 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 |
Also Published As
Publication number | Publication date |
---|---|
CN105005496A (en) | 2015-10-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105005496B (en) | A kind of processing system and method for across language conversion network data package definition file | |
US20210303588A1 (en) | Dynamic Field Data Translation to Support High Performance Stream Data Processing | |
CN106970820A (en) | Code storage method and code storage | |
US8898651B2 (en) | Automatic generation of instruction-set documentation | |
CN110347708A (en) | A kind of data processing method and relevant device | |
CN106713357A (en) | Universal network protocol analysis method | |
CN113778449B (en) | Avionic interface data adaptation conversion system | |
CN112052010B (en) | ICD byte order automatic conversion method | |
CN109460220A (en) | The predefined code generating method of message, device, electronic equipment and storage medium | |
CN107357785A (en) | Theme feature word abstracting method and system, feeling polarities determination methods and system | |
CN109242253A (en) | Bill of materials extracting method, device and storage medium | |
CN103780624A (en) | General application layer network communication protocol application method for complicated system | |
CN101201833A (en) | System and method for filling PDF document data | |
CN107330009A (en) | Descriptor disaggregated model creation method, creating device and storage medium | |
CN106230889A (en) | Mobile solution Service Component method for managing resource and system | |
CN104572102A (en) | Method for solving Chinese messy codes in JAVA | |
CN106779582A (en) | A kind of TWS flows collocation method and device | |
CN105793842B (en) | Conversion method and device between serialized message | |
CN105786529B (en) | One type Managed Code calls the Parameters design of the labyrinth of C/C++ style function | |
CN110008446A (en) | The method and electronic equipment that a kind of language based on programming converts form document | |
CN112947944B (en) | Business work order processing method and device | |
CN103605496A (en) | Method for fast analyzing communication instruction based on SCPI protocol | |
CN109582932A (en) | Wechat small routine rich text conversion method and electronic equipment based on educational system | |
CN107832046A (en) | Data creation method and device | |
JP2010049439A (en) | System construction method using software model and modeling device |
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 | ||
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 |