Skip to content

Commit

Permalink
Added C support
Browse files Browse the repository at this point in the history
  • Loading branch information
Pherring04 committed Jan 14, 2025
1 parent 04c0fea commit 74c7512
Show file tree
Hide file tree
Showing 16 changed files with 79 additions and 81 deletions.
13 changes: 10 additions & 3 deletions bin/trick-ify
Original file line number Diff line number Diff line change
Expand Up @@ -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" ;
Expand Down
3 changes: 1 addition & 2 deletions test/SIM_trickified_archive/S_define
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#include "sim_objects/default_trick_sys.sm"
##include "Foo.hh"
##include "Bar.hh"
##include "Bar.h"
##include "Baz.hh"

class Sandbox : public Trick::SimObject {

public:

Foo foo;
Bar bar;
Baz baz;

Sandbox() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "Bar.h"

int process(long long x) {return 0;}
void add() {}
void remove_Bar() {}
void restart() {}

This file was deleted.

16 changes: 16 additions & 0 deletions test/SIM_trickified_archive/trickified_project/include_bar/Bar.h
Original file line number Diff line number Diff line change
@@ -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
17 changes: 0 additions & 17 deletions test/SIM_trickified_archive/trickified_project/include_bar/Bar.hh

This file was deleted.

3 changes: 1 addition & 2 deletions test/SIM_trickified_object/S_define
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#include "sim_objects/default_trick_sys.sm"
##include "Foo.hh"
##include "Bar.hh"
##include "Bar.h"
##include "Baz.hh"

class Sandbox : public Trick::SimObject {

public:

Foo foo;
Bar bar;
Baz baz;

Sandbox() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "Bar.h"

int process(long long x) {return 0;}
void add() {}
void remove_Bar() {}
void restart() {}

This file was deleted.

16 changes: 16 additions & 0 deletions test/SIM_trickified_object/trickified_project/include_bar/Bar.h
Original file line number Diff line number Diff line change
@@ -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
17 changes: 0 additions & 17 deletions test/SIM_trickified_object/trickified_project/include_bar/Bar.hh

This file was deleted.

3 changes: 1 addition & 2 deletions test/SIM_trickified_shared/S_define
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#include "sim_objects/default_trick_sys.sm"
##include "Foo.hh"
##include "Bar.hh"
##include "Bar.h"
##include "Baz.hh"

class Sandbox : public Trick::SimObject {

public:

Foo foo;
Bar bar;
Baz baz;

Sandbox() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "Bar.h"

int process(long long x) {return 0;}
void add() {}
void remove_Bar() {}
void restart() {}

This file was deleted.

16 changes: 16 additions & 0 deletions test/SIM_trickified_shared/trickified_project/include_bar/Bar.h
Original file line number Diff line number Diff line change
@@ -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
17 changes: 0 additions & 17 deletions test/SIM_trickified_shared/trickified_project/include_bar/Bar.hh

This file was deleted.

0 comments on commit 74c7512

Please sign in to comment.