From 23ccff2ccd84d1c602e39a8425445c9578a9b17f Mon Sep 17 00:00:00 2001 From: DrZiplok Date: Sun, 17 Oct 2010 04:02:06 +0000 Subject: [PATCH] Add support for 'new' and 'delete', so we can cons things on the fly. git-svn-id: https://arducopter.googlecode.com/svn/trunk@668 f9c3cf11-9bcb-44bc-f272-b75c42450872 --- libraries/AP_Common/c++.cpp | 21 +++++++++++++++++++++ libraries/AP_Common/keywords.txt | 4 ++++ 2 files changed, 25 insertions(+) create mode 100644 libraries/AP_Common/c++.cpp create mode 100644 libraries/AP_Common/keywords.txt diff --git a/libraries/AP_Common/c++.cpp b/libraries/AP_Common/c++.cpp new file mode 100644 index 0000000000..107d7fb045 --- /dev/null +++ b/libraries/AP_Common/c++.cpp @@ -0,0 +1,21 @@ +// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*- + +// +// C++ runtime support not provided by Arduino +// +// Note: use new/delete with caution. The heap is small and +// easily fragmented. +// + +#include + +void * operator new(size_t size) +{ + return(calloc(size, 1)); +} + +void operator delete(void *p) +{ + if (p) + free(p); +} diff --git a/libraries/AP_Common/keywords.txt b/libraries/AP_Common/keywords.txt new file mode 100644 index 0000000000..470e71f7a8 --- /dev/null +++ b/libraries/AP_Common/keywords.txt @@ -0,0 +1,4 @@ +Menu KEYWORD1 +run KEYWORD2 +Location KEYWORD2 +