diff options
Diffstat (limited to 'userspace')
| -rw-r--r-- | userspace/cpp/Makefile | 13 | ||||
| -rw-r--r-- | userspace/cpp/prep.cpp | 8 | ||||
| -rw-r--r-- | userspace/cpp/testcpp.cpp | 48 | ||||
| -rw-r--r-- | userspace/fsh.c | 2 | ||||
| -rw-r--r-- | userspace/init.c | 3 |
5 files changed, 38 insertions, 36 deletions
diff --git a/userspace/cpp/Makefile b/userspace/cpp/Makefile index 9f4b314..e61438a 100644 --- a/userspace/cpp/Makefile +++ b/userspace/cpp/Makefile @@ -1,15 +1,10 @@ CXX=i686-foolos-g++ -CFLAGS= -CFLAGS+=-O0 -CFLAGS+=-gstabs +CXXFLAGS= +CXXFLAGS+=-O0 +CXXFLAGS+=-gstabs -LDLIBS+=-lgcc - -ASFLAGS= -ASFLAGS+=-gstabs - -testcpp: prep.cpp +testcpp: clean: rm -f testcpp diff --git a/userspace/cpp/prep.cpp b/userspace/cpp/prep.cpp deleted file mode 100644 index a09adbe..0000000 --- a/userspace/cpp/prep.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include <reent.h> -#include <cstring> - -void prep() -{ -_REENT_INIT_PTR(_impure_ptr); -} - diff --git a/userspace/cpp/testcpp.cpp b/userspace/cpp/testcpp.cpp index 53e3a3b..8ed7d55 100644 --- a/userspace/cpp/testcpp.cpp +++ b/userspace/cpp/testcpp.cpp @@ -3,31 +3,51 @@ #include <cstdio> #include <iostream> -void prep(); -void myinit(); +struct test +{ + int i; + test(int ii):i(ii) { printf("test:ctor %i\n",i); } + ~test() { printf("test:dtor %i\n",i ); } +}; + +test t1(1); // global constructor should get called and desctructed on exit from our crt0 + +int somefunc() +{ + test t2(2); +} int main() { - prep(); - myinit(); - int myints[] = {32,71,12,45,26,80,53,33}; - std::vector<int> myvector (myints, myints+8); // 32 71 12 45 26 80 53 33 + printf(" --- testing ctors & dtors ---\n"); - // using default comparison (operator <): - std::sort (myvector.begin(), myvector.begin()+4); //(12 32 45 71)26 80 53 33 + somefunc(); + test t3(3); - for (std::vector<int>::iterator it=myvector.begin(); it!=myvector.end(); ++it) - printf("%i\n",*it); - printf("hello\n"); -// printf("reent struct size: %d bytes\n",sizeof(struct _reent)); - // printf("reent pointer : 0x%08x\n",_impure_ptr); - //printf("reent pointer : 0x%08x\n",_impure_ptr); std::cout << "bye bye" << std::endl; + + /* + + int myints[] = {32,71,12,45,26,80,53,33}; + + std::vector<int> myvector (myints, myints+8); // 32 71 12 45 26 80 53 33 + std::sort (myvector.begin(), myvector.begin()+4); //(12 32 45 71)26 80 53 33 + + for (std::vector<int>::iterator it=myvector.begin(); it!=myvector.end(); ++it) + printf("%i\n",*it); + + printf("hello\n"); printf("hello\n"); + */ + printf("-- fin -- \n"); + } +// printf("reent struct size: %d bytes\n",sizeof(struct _reent)); + // printf("reent pointer : 0x%08x\n",_impure_ptr); + //printf("reent pointer : 0x%08x\n",_impure_ptr); // constructing vectors /* #include <iostream> diff --git a/userspace/fsh.c b/userspace/fsh.c index 86184e9..0b3acfd 100644 --- a/userspace/fsh.c +++ b/userspace/fsh.c @@ -19,7 +19,6 @@ #include <string.h> #include <errno.h> #include <string.h> -#include <reent.h> #include "interface/fs.h" #include "newcalls.h" @@ -60,7 +59,6 @@ void prompt() int main(int argc, char **argv) { - _REENT_INIT_PTR(_impure_ptr); for(int i=0;i<argc;i++) { diff --git a/userspace/init.c b/userspace/init.c index 84c47a5..57809a6 100644 --- a/userspace/init.c +++ b/userspace/init.c @@ -2,12 +2,9 @@ #include <time.h> #include "put_pixel.h" #include "newcalls.h" -#include <reent.h> - int main(int argc, char **argv) { - _REENT_INIT_PTR(_impure_ptr); char *argv1[]={"xterm","/bin/fsh",0}; char *env1[]={"HOME=/home/miguel","PS1=\033[34m$\033[37m","PWD=/home/miguel","PATH=/bin","TERM=fool-term",0}; |
