Added C support

This commit is contained in:
Pherring04 2025-01-14 13:19:55 -06:00
parent 04c0fea046
commit 74c75123aa
16 changed files with 79 additions and 81 deletions

View File

@ -134,9 +134,16 @@ if ($full_build)
foreach $src (@src_files)
{
$file = $src ;
$file =~ s/\Q.cpp\E$// ;
$file =~ s/\Q.c$\E$// ;
$cmd = "g++ $source_make_args -I $trick_home" . "/include -c $src -o $file.o" ;
if($file =~ /\S*(\Q.c\E)$/)
{
$file =~ s/\Q.c\E$// ;
$cmd = "gcc $source_make_args -I $trick_home" . "/include -c $src -o $file.o" ;
}
else
{
$file =~ s/\Q.cpp\E$// ;
$cmd = "g++ $source_make_args -I $trick_home" . "/include -c $src -o $file.o" ;
}
if($debug)
{
print "Building obj file: $cmd\n" ;

View File

@ -1,6 +1,6 @@
#include "sim_objects/default_trick_sys.sm"
##include "Foo.hh"
##include "Bar.hh"
##include "Bar.h"
##include "Baz.hh"
class Sandbox : public Trick::SimObject {
@ -8,7 +8,6 @@ class Sandbox : public Trick::SimObject {
public:
Foo foo;
Bar bar;
Baz baz;
Sandbox() {

View File

@ -0,0 +1,6 @@
#include "Bar.h"
int process(long long x) {return 0;}
void add() {}
void remove_Bar() {}
void restart() {}

View File

@ -1,7 +0,0 @@
#include "Bar.hh"
void Bar::add() {}
void Bar::remove() {}
void Bar::restart() {}

View File

@ -0,0 +1,16 @@
// @trick_parse{everything}
#include "trick/exec_proto.h"
#ifdef __cplusplus
extern "C"
{
#endif
void add();
void remove_Bar();
void restart();
#ifdef __cplusplus
}
#endif

View File

@ -1,17 +0,0 @@
// @trick_parse{everything}
#include "trick/Event.hh"
/**
* Induce an `%import sim_services` statement in this class's Python module by inheriting from a
* Trick class. This allows us to test if `sys.path` contains the correct path to `sim_services.py`
* (and other modules generated during a sim build) for Trickified projects.
*/
class Bar : public Trick::Event {
int process(long long) {return 0;}
void add();
void remove();
void restart();
};

View File

@ -1,6 +1,6 @@
#include "sim_objects/default_trick_sys.sm"
##include "Foo.hh"
##include "Bar.hh"
##include "Bar.h"
##include "Baz.hh"
class Sandbox : public Trick::SimObject {
@ -8,7 +8,6 @@ class Sandbox : public Trick::SimObject {
public:
Foo foo;
Bar bar;
Baz baz;
Sandbox() {

View File

@ -0,0 +1,6 @@
#include "Bar.h"
int process(long long x) {return 0;}
void add() {}
void remove_Bar() {}
void restart() {}

View File

@ -1,7 +0,0 @@
#include "Bar.hh"
void Bar::add() {}
void Bar::remove() {}
void Bar::restart() {}

View File

@ -0,0 +1,16 @@
// @trick_parse{everything}
#include "trick/exec_proto.h"
#ifdef __cplusplus
extern "C"
{
#endif
void add();
void remove_Bar();
void restart();
#ifdef __cplusplus
}
#endif

View File

@ -1,17 +0,0 @@
// @trick_parse{everything}
#include "trick/Event.hh"
/**
* Induce an `%import sim_services` statement in this class's Python module by inheriting from a
* Trick class. This allows us to test if `sys.path` contains the correct path to `sim_services.py`
* (and other modules generated during a sim build) for Trickified projects.
*/
class Bar : public Trick::Event {
int process(long long) {return 0;}
void add();
void remove();
void restart();
};

View File

@ -1,6 +1,6 @@
#include "sim_objects/default_trick_sys.sm"
##include "Foo.hh"
##include "Bar.hh"
##include "Bar.h"
##include "Baz.hh"
class Sandbox : public Trick::SimObject {
@ -8,7 +8,6 @@ class Sandbox : public Trick::SimObject {
public:
Foo foo;
Bar bar;
Baz baz;
Sandbox() {

View File

@ -0,0 +1,6 @@
#include "Bar.h"
int process(long long x) {return 0;}
void add() {}
void remove_Bar() {}
void restart() {}

View File

@ -1,7 +0,0 @@
#include "Bar.hh"
void Bar::add() {}
void Bar::remove() {}
void Bar::restart() {}

View File

@ -0,0 +1,16 @@
// @trick_parse{everything}
#include "trick/exec_proto.h"
#ifdef __cplusplus
extern "C"
{
#endif
void add();
void remove_Bar();
void restart();
#ifdef __cplusplus
}
#endif

View File

@ -1,17 +0,0 @@
// @trick_parse{everything}
#include "trick/Event.hh"
/**
* Induce an `%import sim_services` statement in this class's Python module by inheriting from a
* Trick class. This allows us to test if `sys.path` contains the correct path to `sim_services.py`
* (and other modules generated during a sim build) for Trickified projects.
*/
class Bar : public Trick::Event {
int process(long long) {return 0;}
void add();
void remove();
void restart();
};