Difference between revisions of "CoCoALib:Contribute"

From ApCoCoAWiki
m (remove spam)
Line 16: Line 16:
  
 
== Contibute with a new class ==
 
== Contibute with a new class ==
At the moment there exists no exact procedure how to submit or contribute something to CoCoALib.
+
Let's say you have written a new class "MyClass". Let "MyClass.C" and "MyClass.H" be the files that contain your source code. Additionaly you have written an example program "ex-MyClass.C". To add your code the CoCoALib follow the instructions below:
As soon as somebody wants to contribute something, we will come up with a way to do so.
 
  
 +
# Put your files into the right place:
 +
#* Copy the source file "MyClass.C" into the subdirectory "src".
 +
#* Copy the header file "MyClass.H" into the subdirectory "include/CoCoA".
 +
#* Copy the example program file "ex-MyClass.C" into the subdirectory "examples".
 +
# Edit "include/CoCoA/library.H":
 +
#* Add an include directive for your header file "MyClass.H".
 +
# Edit "src/Makefile":
 +
#* Add "MyClass.C" to the variable definition of "SRC".
 +
# Edit "examples/Makefile":
 +
#* Add "ex-MyClass.C" to the variable definition of "SRC".
 +
 +
Now everything is ready to start a test build. First you have to rebuild the Makefile dependencies:
 +
cd CoCoALib-xxx
 +
rm src/Makefile_dependencies examples/Makefile_dependencies
 +
make dependencies
 +
 +
Next you should trigger a full build to see if everything works:
 +
make all
 +
 +
If the compilation process terminates without an error you should try to run your example program to see if it also works correctly.
 
[[Category:HowTo]][[Category:CoCoALib]]
 
[[Category:HowTo]][[Category:CoCoALib]]

Revision as of 12:12, 12 September 2006

Contribute with an example

The easiest way to help the CoCoALib project is to have a look at the "example" directory, run the examples, play with them, and send a comment about what can be improved.

You could also create a new example to be added to the distibution.

How do I run an example?

Download CoCoALib-xxx and compile it: (you will need GMP)

cd CoCoALib-xxx
./configure
make

to run an example do this:

cd examples
make ex-yyyyy
./ex-yyyy

Contibute with a new class

Let's say you have written a new class "MyClass". Let "MyClass.C" and "MyClass.H" be the files that contain your source code. Additionaly you have written an example program "ex-MyClass.C". To add your code the CoCoALib follow the instructions below:

  1. Put your files into the right place:
    • Copy the source file "MyClass.C" into the subdirectory "src".
    • Copy the header file "MyClass.H" into the subdirectory "include/CoCoA".
    • Copy the example program file "ex-MyClass.C" into the subdirectory "examples".
  2. Edit "include/CoCoA/library.H":
    • Add an include directive for your header file "MyClass.H".
  3. Edit "src/Makefile":
    • Add "MyClass.C" to the variable definition of "SRC".
  4. Edit "examples/Makefile":
    • Add "ex-MyClass.C" to the variable definition of "SRC".

Now everything is ready to start a test build. First you have to rebuild the Makefile dependencies:

cd CoCoALib-xxx
rm src/Makefile_dependencies examples/Makefile_dependencies
make dependencies

Next you should trigger a full build to see if everything works:

make all

If the compilation process terminates without an error you should try to run your example program to see if it also works correctly.