/programs/develop/libraries/menuetlibc/src/libcpp/Makefile |
---|
0,0 → 1,38 |
include $(MENUETDEV)/osrules.mak |
ifdef ON_MINGW |
THIS_SRCS = new.cpp delete.cpp net\ip_addr.cpp net\udp_socket.cpp |
else |
THIS_SRCS = new.cpp delete.cpp net/ip_addr.cpp net/udp_socket.cpp |
endif |
include $(MENUET_LIBC_TOPDIR)/Make.rules |
mk_lib: gen_tmp all |
make -f Makefile-link OUTFILE="libcpp.a" |
ifdef ON_MINGW |
copy libcpp.a $(MENUETDEV)\lib |
del libcpp.a |
else |
mv -f libcpp.a $(MENUETDEV)/lib |
endif |
dll: _gen_tmp all |
make -f Makefile-link-dll OUTFILE="cpp-glue.so" |
ifdef ON_MINGW |
copy cpp-glue.so $(MENUETDEV)\lib |
del cpp-glue.so |
else |
mv cpp-glue.so $(MENUETDEV)/lib |
endif |
_gen_tmp: |
@$(D_ECHO) > ../tmp_make |
gen_tmp: |
ifdef ON_MINGW |
@echo foo = bar> ..\tmp_make |
@..\m_echo ..\tmp_make B_MENUET_LIBC_OBJS = |
else |
@echo "foo = bar" > ../tmp_make |
@../m_echo ../tmp_make B_MENUET_LIBC_OBJS = |
endif |
/programs/develop/libraries/menuetlibc/src/libcpp/Makefile-link |
---|
0,0 → 1,4 |
include ../tmp_make |
all: |
ar rcs $(OUTFILE) $(B_MENUET_LIBC_OBJS) |
/programs/develop/libraries/menuetlibc/src/libcpp/Makefile-link-dll |
---|
0,0 → 1,2 |
all: |
ld -r -d -Bdynamic -o $(OUTFILE) @../tmp_make |
/programs/develop/libraries/menuetlibc/src/libcpp/delete.cpp |
---|
0,0 → 1,37 |
extern "C" { |
#include<assert.h> |
} |
extern "C" void free(void *); |
extern "C" void __menuet__sys_exit(void); |
void operator delete(void * ptr) |
{ |
free(ptr); |
} |
void operator delete[](void * ptr) |
{ |
free(ptr); |
} |
static bool pure_virtual_call=false; |
extern "C" { |
extern "C" void __menuet__sys_exit(); |
void __cxa_pure_virtual(void) |
{ |
assert(!pure_virtual_call); |
__menuet__sys_exit(); |
} |
void _pure_virtual(void) |
{ |
assert(!pure_virtual_call); |
__menuet__sys_exit(); |
} |
void __pure_virtual(void) |
{ |
assert(!pure_virtual_call); |
__menuet__sys_exit(); |
} |
} |
/programs/develop/libraries/menuetlibc/src/libcpp/net/ip_addr.cpp |
---|
0,0 → 1,32 |
#include<menuet/network.hpp> |
IP_Address::IP_Address(unsigned long addr) |
{ |
this_ip_inet_fmt=addr; |
} |
IP_Address::IP_Address(__u8 p1,__u8 p2,__u8 p3,__u8 p4) |
{ |
this_ip_inet_fmt=p4; |
this_ip_inet_fmt<<=8; |
this_ip_inet_fmt|=p3; |
this_ip_inet_fmt<<=8; |
this_ip_inet_fmt|=p2; |
this_ip_inet_fmt<<=8; |
this_ip_inet_fmt|=p1; |
} |
IP_Address::~IP_Address() |
{ |
} |
unsigned long IP_Address::operator = (IP_Address& a) |
{ |
return a.this_ip_inet_fmt; |
} |
IP_Address& IP_Address::operator = (unsigned long a) |
{ |
this->this_ip_inet_fmt=a; |
return *this; |
} |
/programs/develop/libraries/menuetlibc/src/libcpp/net/udp_socket.cpp |
---|
0,0 → 1,39 |
#include<menuet/network.hpp> |
UDP_Socket::UDP_Socket(__u32 local_port,__u32 remote_port,__u32 remote_ip,bool close_on_delete) |
{ |
this->p[0]=local_port; |
this->p[1]=remote_port; |
this->p[2]=remote_ip; |
this->f=close_on_delete; |
} |
UDP_Socket::~UDP_Socket() |
{ |
if(this->f) this->Close(); |
} |
int UDP_Socket::Open() |
{ |
return (sock=__menuet__open_UDP_socket(p[0],p[1],p[2])); |
} |
int UDP_Socket::Close() |
{ |
return __menuet__close_UDP_socket(sock); |
} |
int UDP_Socket::Read(__u8 * data) |
{ |
return __menuet__read_socket(sock,data); |
} |
int UDP_Socket::Write(int count,void * data) |
{ |
return __menuet__write_UDP_socket(sock,count,data); |
} |
int UDP_Socket::Poll() |
{ |
return __menuet__poll_socket(sock); |
} |
/programs/develop/libraries/menuetlibc/src/libcpp/new.cpp |
---|
0,0 → 1,13 |
#include<sys/types.h> |
extern "C" void * malloc(unsigned int); |
void * operator new(unsigned int n) |
{ |
return malloc(n); |
} |
void * operator new[](unsigned int n) |
{ |
return malloc(n); |
} |