Skip to content
forked from swig/swig

SWIG-CSV tool generates CSV-parse-tree from C and C++. CSV-parse-tree is used to operate the data part of an class/struct(See also, Plain Old Data). POD is used to generate serialization or other code generation.

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
GPL-3.0
LICENSE-GPL
Unknown
LICENSE-UNIVERSITIES
Notifications You must be signed in to change notification settings

kamanashisroy/swig

 
 

Repository files navigation

SWIG-CSV contains the CSV module for SWIG parser. The CSV module generates the Data information of a class/structure.

Example

Suppose there is a class named Bike.

class Bike {
public:
	int color;		// color of the bike
	int gearCount;		// number of configurable gear
	Bike() {
		// bla bla
	}
	~Bike() {
		// bla bla
	}
	void operate() {
		// bla bla
	}
};

It contains data and functionality. The data are color and number. The operation is the functionality.

member type
color data
gearCount data
operate function/logic

The CSV output of the class above looks like the following,

# This is SWIG generated the CSV metadata of classes/structures. It can be used to generate code using AWK.
# Class or Structure name | member name | member type | member kind

Bike|color|int|variable|public|
Bike|gearCount|int|variable|public|
Bike|operate|void|function|public|f().

The interface-file looks like the following,

%module unused
%insert("csvbanner")
%{
# This is SWIG generated the CSV metadata of classes/structures. It can be used to generate code using AWK.
# Class or Structure name | member name | member type | member kind
%}


%include "bike.h"

Example usage(TODO)

Plain Old Data serialization

Plain Old Data(POD) is the data part of the of the class. The CSV output can be used to generate C/C++ code that serialize the POD. Here is an example AWK script that does that.

[Here] is an example AWK script that converts POD to JSON data.

Get C/C++ variable by name

In C/C++, it is sometimes necessary to know all the variable names and get the value by names. [Here] is an AWK script that generates the get(variablename) method.

About

SWIG-CSV tool generates CSV-parse-tree from C and C++. CSV-parse-tree is used to operate the data part of an class/struct(See also, Plain Old Data). POD is used to generate serialization or other code generation.

Topics

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
GPL-3.0
LICENSE-GPL
Unknown
LICENSE-UNIVERSITIES

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 64.2%
  • C 23.8%
  • Yacc 5.5%
  • M4 3.1%
  • Makefile 1.1%
  • Shell 0.8%
  • Other 1.5%