Skip to content

Commit d350c7b

Browse files
author
Food Tiny
authored
Merge pull request #227 from foodtiny/development
Merge to master
2 parents bb6a786 + a81a300 commit d350c7b

181 files changed

Lines changed: 22290 additions & 20170 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,8 @@ script:
2020
- make native_test -j8
2121
- ./misc/memory_check
2222
- make native && sudo make install && sudo ldconfig
23-
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cd examples && ./build; fi
23+
- cd examples && ./build
2424
after_success:
25-
- cd ${TRAVIS_BUILD_DIR}
26-
- lcov --directory . --capture --output-file coverage.info
27-
- lcov --remove coverage.info '/usr/*' --output-file coverage.info
28-
- lcov --list coverage.info
29-
- bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
25+
- ./misc/codecov.sh
3026
notifications:
3127
slack: foodtiny:hzkLBCLrqjtgi9ctqwdQ034S

CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ add_executable(${PROJECT_NAME}_test_c ${TESTS_C} ${SOURCES_C} misc/unit-test.c)
133133
add_executable(${PROJECT_NAME}_test ${TESTS_C} ${SOURCES_C} ${TESTS_CPP} ${SOURCES_CPP} misc/unit-test.c)
134134

135135
# Create native library for static linking
136-
add_library(${PROJECT_NAME}_static ${SOURCES_C} ${SOURCES_CPP})
137136
add_library(${PROJECT_NAME} SHARED ${SOURCES_C} ${SOURCES_CPP})
138137

139138
# Add make test
@@ -171,7 +170,6 @@ include(CTest)
171170
enable_testing()
172171

173172
# Add make installation - install to Unix system
174-
install(TARGETS ${PROJECT_NAME}_static DESTINATION lib)
175173
install(TARGETS ${PROJECT_NAME} DESTINATION lib)
176174
install(FILES library.hpp DESTINATION include/native)
177175
install(DIRECTORY java DESTINATION include/native FILES_MATCHING PATTERN "*.hpp")
@@ -189,17 +187,14 @@ add_custom_target(
189187
# Darwin platform no need to link realtime library (-lrt)
190188
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
191189
target_link_libraries(${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT} -lm)
192-
target_link_libraries(${PROJECT_NAME}_static ${CMAKE_THREAD_LIBS_INIT} -lm)
193190
target_link_libraries(${PROJECT_NAME}_test ${CMAKE_THREAD_LIBS_INIT} -lm)
194191
target_link_libraries(${PROJECT_NAME}_test_c ${CMAKE_THREAD_LIBS_INIT} -lm)
195192
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
196193
target_link_libraries(${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT} -lm -lrt)
197-
target_link_libraries(${PROJECT_NAME}_static ${CMAKE_THREAD_LIBS_INIT} -lm -lrt)
198194
target_link_libraries(${PROJECT_NAME}_test ${CMAKE_THREAD_LIBS_INIT} -lm -lrt)
199195
target_link_libraries(${PROJECT_NAME}_test_c ${CMAKE_THREAD_LIBS_INIT} -lm -lrt)
200196
else ()
201197
target_link_libraries(${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT} -lm)
202-
target_link_libraries(${PROJECT_NAME}_static ${CMAKE_THREAD_LIBS_INIT}-lm)
203198
target_link_libraries(${PROJECT_NAME}_test ${CMAKE_THREAD_LIBS_INIT} -lm)
204199
target_link_libraries(${PROJECT_NAME}_test_c ${CMAKE_THREAD_LIBS_INIT} -lm)
205200
endif ()

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
- Blazing fast performance, small footprint, low-level access with GAS & C
99
- Provide rich Java core packages for productivity & maintainability
1010
- Zero memory leak with automatic storage
11-
- Prevents segfaults and no null pointer anymore
11+
- Prevents segfaults and null pointer exception
1212

1313

1414
This project is also useful for new developers in practical programming.
@@ -36,6 +36,13 @@ public:
3636
hashMap.put("argument " + String::valueOf(counter), argument);
3737
counter++;
3838
}
39+
// Collect key value pairs
40+
String pairs = "Pairs: \n";
41+
for (Map<String, String>::Entry entry : hashMap.entrySet()) {
42+
pairs += entry.getKey() + String(" - ") + entry.getValue() + String("\n");
43+
}
44+
System::out::println(pairs);
45+
// Serialize to json data
3946
ArrayList<HashMap<String, String>> arrayList;
4047
arrayList.add(hashMap);
4148
System::out::println(arrayList.toString());
@@ -51,12 +58,18 @@ int main(int argc, char **argv) {
5158
Compile your source and link with native library
5259
```bash
5360
$ g++ -c -o main.o HelloWorld.cpp
54-
$ gcc -o main main.o -lnative -lstdc++
61+
$ g++ -o main main.o -lnative
5562
$ ./main one two three
5663
```
5764

5865
Output:
5966
```javascript
67+
We have 4 pairs:
68+
argument 3 is three
69+
argument 2 is two
70+
argument 1 is one
71+
argument 0 is ./main
72+
6073
[{"argument 0": "./main", "argument 1": "one", "argument 2": "two", "argument 3": "three"}]
6174
```
6275

codecov.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ parsers:
2222
loop: yes
2323
method: no
2424
macro: no
25+
ignore:
26+
- "kernel/test.h"
2527

2628
comment:
2729
layout: "reach, diff, flags, files, footer"

examples/Application/Main/MainApplication.cpp

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,24 @@
22

33
class MainApplication {
44
public:
5-
static void main(Array<String> arguments) {
6-
HashMap<String, String> hashMap;
7-
int counter = 0;
8-
for (String argument : arguments) {
9-
hashMap.put("argument " + String::valueOf(counter), argument);
10-
counter++;
5+
static void main(Array<String> arguments) {
6+
HashMap<String, String> hashMap;
7+
int counter = 0;
8+
for (String argument : arguments) {
9+
hashMap.put("argument " + String::valueOf(counter), argument);
10+
counter++;
11+
}
12+
// Collect key value pairs
13+
String pairs = String("We have ") + String::valueOf(hashMap.size()) + String(" pairs: \n");
14+
for (Map<String, String>::Entry entry : hashMap.entrySet()) {
15+
pairs += entry.getKey() + String(" is ") + entry.getValue() + String("\n");
16+
}
17+
System::out::println(pairs);
18+
// Serialize to json data
19+
ArrayList<HashMap<String, String>> arrayList;
20+
arrayList.add(hashMap);
21+
System::out::println(arrayList.toString());
1122
}
12-
ArrayList<HashMap<String, String>> arrayList;
13-
arrayList.add(hashMap);
14-
System::out::println(arrayList.toString());
15-
}
1623
};
1724

1825
int main(int argc, char **argv) {

examples/Application/Main/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
all:
22
g++ -c -std=c++11 -o main.o MainApplication.cpp
3-
gcc -o main main.o -lnative -lstdc++
3+
g++ -o main main.o -lnative
44
./main one two three

java/io/BufferedReader/BufferedReader.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
using namespace Java::Lang;
3434

3535
namespace Java {
36-
namespace IO {
37-
class BufferedWriter : public virtual Reader {
38-
39-
};
40-
}
36+
namespace IO {
37+
class BufferedWriter : public virtual Reader {
38+
39+
};
40+
}
4141
}
4242

4343
#endif // JAVA_IO_BUFFERED_READER_HPP_

java/io/BufferedWriter/BufferedWriter.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
using namespace Java::Lang;
3434

3535
namespace Java {
36-
namespace IO {
37-
class BufferedReader : public virtual Reader {
38-
39-
};
40-
}
36+
namespace IO {
37+
class BufferedReader : public virtual Reader {
38+
39+
};
40+
}
4141
}
4242

4343
#endif // JAVA_IO_BUFFERED_READER_HPP_

java/io/FileWriter/FileWriter.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
using namespace Java::Lang;
3434

3535
namespace Java {
36-
namespace IO {
37-
class FileWriter : public virtual OutputStreamWriter {
38-
39-
};
40-
}
36+
namespace IO {
37+
class FileWriter : public virtual OutputStreamWriter {
38+
39+
};
40+
}
4141
}
4242

4343
#endif // JAVA_IO_FILE_HPP_

java/io/OutputStreamWriter/OutputStreamWriter.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
using namespace Java::Lang;
3333

3434
namespace Java {
35-
namespace IO {
36-
class OutputStreamWriter : public virtual Writer {
37-
38-
};
39-
}
35+
namespace IO {
36+
class OutputStreamWriter : public virtual Writer {
37+
38+
};
39+
}
4040
}
4141

4242
#endif // JAVA_IO_OUTPUT_SREAM_WRITER_HPP_

0 commit comments

Comments
 (0)