Skip to content

Hpp support #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ private function getLibraryExamples($library)

// TODO: Not only .h and .cpp files in Arduino examples
$notInoFilesFinder = new Finder();
$notInoFilesFinder->files()->name('*.h')->name('*.cpp');
$notInoFilesFinder->files()->name('*.h')->name('*.cpp')->name('*.hpp');
$notInoFilesFinder->in($path . "/" . $example->getRelativePath());

foreach ($notInoFilesFinder as $nonInoFile) {
Expand Down Expand Up @@ -448,7 +448,7 @@ private function getExampleFilesFromDir($dir)
{
$filesFinder = new Finder();
$filesFinder->in($dir);
$filesFinder->name('*.cpp')->name('*.h')->name('*.c')->name('*.S')->name('*.pde')->name('*.ino');
$filesFinder->name('*.hpp')->name('*.cpp')->name('*.h')->name('*.c')->name('*.S')->name('*.pde')->name('*.ino');

$files = array();
foreach ($filesFinder as $file) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ class LoadExternalLibraryData extends AbstractFixture implements OrderedFixtureI
*/
public function load(ObjectManager $objectManager)
{
// A fake JSON library with hpp files in examples
$jsonlibr = new ExternalLibrary();
$jsonlibr->setHumanName('JSON Library');
$jsonlibr->setMachineName('jsonlib');
$jsonlibr->setActive(true);
$jsonlibr->setVerified(false);
$jsonlibr->setDescription('A library containing hpp files in examples which should be correctly fetched');
$jsonlibr->setSourceUrl('https://some/source/url.com');

// Reference to jsonlib library
$this->setReference('JsonLib', $jsonlibr);
$objectManager->persist($jsonlibr);


// A fake version of the Adafruit GPS library
$defaultLibrary = new ExternalLibrary();
$defaultLibrary->setHumanName('Default Arduino Library');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ class LoadExternalLibraryExamplesData extends AbstractFixture implements Ordered
*/
public function load(ObjectManager $objectManager)
{
/* @var \Codebender\LibraryBundle\Entity\ExternalLibrary $jsonlibr */

$jsonlibr = $this->getReference('JsonLib');

$jsonexampleb = new Example();
$jsonexampleb->setName('IndentedPrintExample');
$jsonexampleb->setLibrary($jsonlibr);
$jsonexampleb->setPath('jsonlib/examples/IndentedPrintExample/IndentedPrintExample.ino');
$jsonexampleb->setBoards(null);

// Persist the new example
$objectManager->persist($jsonexampleb);


/* @var \Codebender\LibraryBundle\Entity\ExternalLibrary $defaultLibrary */
$defaultLibrary = $this->getReference('defaultLibrary');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ private function getMachineNamesFromChildren($children)
$machineNames = array();

foreach ($children as $child) {
if ($child['type'] == 'blob' && pathinfo($child['path'], PATHINFO_EXTENSION) == 'h') {
if ($child['type'] == 'blob' && (pathinfo($child['path'], PATHINFO_EXTENSION) == 'h' || pathinfo($child['path'], PATHINFO_EXTENSION) == 'hpp')) {
$machineNames[] = pathinfo($child['path'], PATHINFO_FILENAME);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//nothing here
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

#ifdef ARDUINO


#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@


#ifdef ARDUINO

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "PrintExamplehp.hpp"

void setup() {
int x= varde+5;

}

void loop() {
// not used in this example
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define varde 2 ;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

#ifdef ARDUINO


#endif
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,20 @@
$el.append($("<option></option>")
.attr("value", $name).text($name));

}else if(endsWith(entry.filename, ".hpp") && !startsWith(entry.filename, ".") && !startsWith(entry.filename, "_") )
{
var $lastSlash = entry.filename.lastIndexOf("/");
var $header = entry.filename.substr($lastSlash+1);
var $name = $header.substr(0,$header.length -4);
$el.append($("<option></option>")
.attr("value", $name).text($name));

}
});

}


);
$el.prop("selected", false);
update_machineName();
});
Expand Down