summaryrefslogtreecommitdiff
path: root/userspace
diff options
context:
space:
mode:
Diffstat (limited to 'userspace')
-rw-r--r--userspace/cpp/Makefile11
-rw-r--r--userspace/cpp/prep.cpp8
-rw-r--r--userspace/cpp/testcpp.cpp33
-rw-r--r--userspace/fsh.c2
-rw-r--r--userspace/init.c2
-rw-r--r--userspace/reent.c10
6 files changed, 65 insertions, 1 deletions
diff --git a/userspace/cpp/Makefile b/userspace/cpp/Makefile
index 7623325..9f4b314 100644
--- a/userspace/cpp/Makefile
+++ b/userspace/cpp/Makefile
@@ -1,6 +1,15 @@
CXX=i686-foolos-g++
-testcpp:
+CFLAGS=
+CFLAGS+=-O0
+CFLAGS+=-gstabs
+
+LDLIBS+=-lgcc
+
+ASFLAGS=
+ASFLAGS+=-gstabs
+
+testcpp: prep.cpp
clean:
rm -f testcpp
diff --git a/userspace/cpp/prep.cpp b/userspace/cpp/prep.cpp
new file mode 100644
index 0000000..a09adbe
--- /dev/null
+++ b/userspace/cpp/prep.cpp
@@ -0,0 +1,8 @@
+#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 0e89276..53e3a3b 100644
--- a/userspace/cpp/testcpp.cpp
+++ b/userspace/cpp/testcpp.cpp
@@ -1,4 +1,35 @@
+#include <algorithm>
+#include <vector>
+#include <cstdio>
+#include <iostream>
+
+void prep();
+void myinit();
+
+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
+
+ // using default comparison (operator <):
+ 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("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;
+ printf("hello\n");
+}
+
// constructing vectors
+/*
#include <iostream>
#include <vector>
#include <cstring>
@@ -8,6 +39,7 @@
int main()
{
+ std::cout << "hi" << std::endl;
_REENT_INIT_PTR(_impure_ptr);
@@ -32,3 +64,4 @@ int main()
return 0;
}
+*/
diff --git a/userspace/fsh.c b/userspace/fsh.c
index 0b3acfd..86184e9 100644
--- a/userspace/fsh.c
+++ b/userspace/fsh.c
@@ -19,6 +19,7 @@
#include <string.h>
#include <errno.h>
#include <string.h>
+#include <reent.h>
#include "interface/fs.h"
#include "newcalls.h"
@@ -59,6 +60,7 @@ 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 1592d39..84c47a5 100644
--- a/userspace/init.c
+++ b/userspace/init.c
@@ -2,10 +2,12 @@
#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};
diff --git a/userspace/reent.c b/userspace/reent.c
new file mode 100644
index 0000000..9011b1e
--- /dev/null
+++ b/userspace/reent.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+#include <reent.h>
+
+int main()
+{
+ _REENT_INIT_PTR(_impure_ptr);
+ 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);
+}