Skip to content

Commit

Permalink
Update includes.
Browse files Browse the repository at this point in the history
These changes to the includes actually were not necessary in order to
eliminate the generated include directory in the project root. However I
changed them anyway because they were a code smell (making assumptions
about the relative locations of files instead of using the include path
properly).
  • Loading branch information
petervdonovan committed Feb 29, 2024
1 parent 5997ca5 commit 103ecb9
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 17 deletions.
8 changes: 1 addition & 7 deletions core/src/main/java/org/lflang/generator/c/CFileConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ public class CFileConfig extends FileConfig {
public CFileConfig(Resource resource, Path srcGenBasePath, boolean useHierarchicalBin)
throws IOException {
super(resource, srcGenBasePath, useHierarchicalBin);
var includeDir = getOutPath().resolve("include");
includePath =
!useHierarchicalBin
? includeDir
: includeDir
.resolve(getOutPath().relativize(srcPath))
.resolve(srcFile.getFileName().toString().split("\\.")[0]);
includePath = getSrcGenPath().resolve("include");
}

public Path getIncludePath() {
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/java/org/lflang/generator/c/CGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -843,8 +843,6 @@ private void generateHeaders() throws IOException {
},
this::generateTopLevelPreambles);
}
FileUtil.copyDirectoryContents(
fileConfig.getIncludePath(), fileConfig.getSrcGenPath().resolve("include"), false);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/C/c/bank_multiport_to_reaction_no_inlining.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../include/BankMultiportToReactionNoInlining/BankMultiportToReactionNoInlining.h"
#include "BankMultiportToReactionNoInlining/BankMultiportToReactionNoInlining.h"

void check(bankmultiporttoreactionnoinlining_self_t* self, doublecount_out_t*** out) {
for (int i = 0; i < 2; i++) {
Expand Down
2 changes: 1 addition & 1 deletion test/C/c/bank_to_reaction_no_inlining.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../include/BankToReactionNoInlining/BankToReactionNoInlining.h"
#include "BankToReactionNoInlining/BankToReactionNoInlining.h"

void check(banktoreactionnoinlining_self_t* self, count_out_t** out) {
for (int i = 0; i < 2; i++) {
Expand Down
2 changes: 1 addition & 1 deletion test/C/c/count.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <stdio.h>
#include "../include/Count/Count.h"
#include "Count/Count.h"

void increment(count_self_t* self) {
printf("in increment, count=%d\n", self->count);
Expand Down
2 changes: 1 addition & 1 deletion test/C/c/count_hierarchy.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <stdio.h>
#include "../include/CountHierarchy/CountHierarchy.h"
#include "CountHierarchy/CountHierarchy.h"

void increment(counthierarchy_self_t* self, timer_out_t* out) {
printf("in increment, count=%d\n", self->count);
Expand Down
2 changes: 1 addition & 1 deletion test/C/c/multiport_to_reaction_no_inlining.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../include/MultiportToReactionNoInlining/MultiportToReactionNoInlining.h"
#include "MultiportToReactionNoInlining/MultiportToReactionNoInlining.h"

void check(multiporttoreactionnoinlining_self_t* self, source_out_t** out) {
int sum = 0;
Expand Down
6 changes: 3 additions & 3 deletions test/C/c/sendreceive.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <stdio.h>

#include "../include/IntPrint/Print.h"
#include "../include/IntPrint/Check.h"
#include "../include/api/reaction_macros.h"
#include "IntPrint/Print.h"
#include "IntPrint/Check.h"
#include "api/reaction_macros.h"

void sender(print_self_t* self, print_out_t* out) {
lf_set(out, 42);
Expand Down

0 comments on commit 103ecb9

Please sign in to comment.