Thread: [complement-svn] SF.net SVN: complement: [1398] trunk/complement/explore/inquiry/shades
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2006-11-13 18:25:35
|
Revision: 1398 http://svn.sourceforge.net/complement/?rev=1398&view=rev Author: complement Date: 2006-11-13 10:25:20 -0800 (Mon, 13 Nov 2006) Log Message: ----------- msg investigations Added Paths: ----------- trunk/complement/explore/inquiry/shades/msgq/ trunk/complement/explore/inquiry/shades/msgq/Makefile trunk/complement/explore/inquiry/shades/msgq/Makefile.inc trunk/complement/explore/inquiry/shades/msgq/test.cc Property changes on: trunk/complement/explore/inquiry/shades/msgq ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/shades/msgq/Makefile =================================================================== --- trunk/complement/explore/inquiry/shades/msgq/Makefile (rev 0) +++ trunk/complement/explore/inquiry/shades/msgq/Makefile 2006-11-13 18:25:20 UTC (rev 1398) @@ -0,0 +1,6 @@ +# -*- Makefile -*- Time-stamp: <04/01/09 16:53:50 ptr> + +SRCROOT := ../../.. + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak Added: trunk/complement/explore/inquiry/shades/msgq/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/shades/msgq/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/shades/msgq/Makefile.inc 2006-11-13 18:25:20 UTC (rev 1398) @@ -0,0 +1,5 @@ +# -*- makefile -*- Time-stamp: <04/01/12 15:37:40 ptr> + +PRGNAME = test +#SRC_C = test.c +SRC_CC = test.cc Added: trunk/complement/explore/inquiry/shades/msgq/test.cc =================================================================== --- trunk/complement/explore/inquiry/shades/msgq/test.cc (rev 0) +++ trunk/complement/explore/inquiry/shades/msgq/test.cc 2006-11-13 18:25:20 UTC (rev 1398) @@ -0,0 +1,53 @@ +#include <sys/ipc.h> +#include <sys/msg.h> + +#include <iostream> +#include <iomanip> + +using namespace std; + +int main( int argc, char **argv ) +{ + // key_t key = 12345; + key_t key = ftok( "/tmp/msg.queue", 276 ); + + int msqid = msgget( key /* IPC_PRIVATE */, 0666 | IPC_CREAT ); + + if ( msqid < 0 ) { + cerr << "Can't create message queue" << endl; + return 1; + } + + + struct msqid_ds buf; + if ( msgctl( msqid, IPC_STAT, &buf ) < 0 ) { + cerr << "Can't stat message queue" << endl; + return 2; + } + + cout << buf.msg_perm.uid << "\n" << buf.msg_perm.gid << "\n" + << oct << buf.msg_perm.mode << dec << "\n" + << buf.msg_qbytes << endl; + + // if ( msgctl( msqid, IPC_RMID, &buf ) ) { + // cerr << "Can't remove message queue" << endl; + // return 4; + // } + + return 0; + + + buf.msg_qbytes = /* 16384; */ 256 * 1024 * 1024; + + if ( msgctl( msqid, IPC_SET, &buf ) < 0 ) { + cerr << "Can't set message queue params" << endl; + return 3; + } + + if ( msgctl( msqid, IPC_STAT, &buf ) < 0 ) { + cerr << "Can't stat message queue" << endl; + return 2; + } + + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-02-21 13:03:19
|
Revision: 1531 http://svn.sourceforge.net/complement/?rev=1531&view=rev Author: complement Date: 2007-02-21 05:03:16 -0800 (Wed, 21 Feb 2007) Log Message: ----------- juniper investigations Added Paths: ----------- trunk/complement/explore/inquiry/shades/juniper/ trunk/complement/explore/inquiry/shades/juniper/Makefile trunk/complement/explore/inquiry/shades/juniper/Makefile.inc trunk/complement/explore/inquiry/shades/juniper/str_interposer.c Property changes on: trunk/complement/explore/inquiry/shades/juniper ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/shades/juniper/Makefile =================================================================== --- trunk/complement/explore/inquiry/shades/juniper/Makefile (rev 0) +++ trunk/complement/explore/inquiry/shades/juniper/Makefile 2007-02-21 13:03:16 UTC (rev 1531) @@ -0,0 +1,13 @@ +# -*- Makefile -*- Time-stamp: <04/01/09 16:53:50 ptr> +# $Id: Makefile 1356 2006-11-01 13:34:19Z complement $ + +SRCROOT := ../../.. +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +DEFS += -D_GNU_SOURCE + +LDFLAGS += -ldl + Added: trunk/complement/explore/inquiry/shades/juniper/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/shades/juniper/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/shades/juniper/Makefile.inc 2007-02-21 13:03:16 UTC (rev 1531) @@ -0,0 +1,7 @@ +# -*- makefile -*- Time-stamp: <04/01/12 15:37:40 ptr> + +LIBNAME = test +MAJOR = 0 +MINOR = 0 +PATCH = 0 +SRC_C = str_interposer.c Added: trunk/complement/explore/inquiry/shades/juniper/str_interposer.c =================================================================== --- trunk/complement/explore/inquiry/shades/juniper/str_interposer.c (rev 0) +++ trunk/complement/explore/inquiry/shades/juniper/str_interposer.c 2007-02-21 13:03:16 UTC (rev 1531) @@ -0,0 +1,78 @@ +/* Example from: http://developers.sun.com/solaris/articles/lib_interposers_code.html + * + */ + +/* Example of a library interposer: interpose on + * malloc(). + * Build and use this interposer as following: + * cc -o malloc_interposer.so -G -Kpic malloc_interposer.c + * setenv LD_PRELOAD $cwd/malloc_interposer.so + * run the app + * unsetenv LD_PRELOAD + */ + +#include <stdio.h> +#include <dlfcn.h> + +#if 0 +void *malloc(size_t size) +{ + static void * (*func)(); + + if(!func) + func = (void *(*)()) dlsym(RTLD_NEXT, "malloc"); + printf("malloc(%d) is called\n", size); + return(func(size)); +} +#endif + +char *strcpy( char *s1, const char *s2 ) +{ + static void * (*func)(); + + if(!func) + func = (void *(*)()) dlsym(RTLD_NEXT, "strcpy"); + + printf( "strcpy: '%s'\n", s2 ); + + return func( s1, s2 ); +} + +char *strdup(const char *s1) +{ + static void * (*func)(); + + if(!func) + func = (void *(*)()) dlsym(RTLD_NEXT, "strdup"); + + printf( "strdup: '%s'\n", s1 ); + + return func( s1 ); +} + +char *strncat(char *s1, const char *s2, size_t n) +{ + static void * (*func)(); + char *r; + + if(!func) + func = (void *(*)()) dlsym(RTLD_NEXT, "strncat"); + + r = func( s1, s2, n ); + printf( "strncat: '%s'\n", r ); + + return r; +} + +char *strtok(char *s1, const char *s2) +{ + static void * (*func)(); + + if(!func) + func = (void *(*)()) dlsym(RTLD_NEXT, "strtok"); + + printf( "strtok: '%s'\n", s1 ); + + return func( s1, s2 ); +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-02-27 10:28:34
|
Revision: 1534 http://svn.sourceforge.net/complement/?rev=1534&view=rev Author: complement Date: 2007-02-27 02:28:33 -0800 (Tue, 27 Feb 2007) Log Message: ----------- autotools sample Added Paths: ----------- trunk/complement/explore/inquiry/shades/autotools/ trunk/complement/explore/inquiry/shades/autotools/Makefile.am trunk/complement/explore/inquiry/shades/autotools/build.sh trunk/complement/explore/inquiry/shades/autotools/configure.ac trunk/complement/explore/inquiry/shades/autotools/main.cc trunk/complement/explore/inquiry/shades/autotools/my.h trunk/complement/explore/inquiry/shades/autotools/other.cc Added: trunk/complement/explore/inquiry/shades/autotools/Makefile.am =================================================================== --- trunk/complement/explore/inquiry/shades/autotools/Makefile.am (rev 0) +++ trunk/complement/explore/inquiry/shades/autotools/Makefile.am 2007-02-27 10:28:33 UTC (rev 1534) @@ -0,0 +1,6 @@ +bin_PROGRAMS = cxxtest + +cxxtest_SOURCES = main.cc +AM_CXXFLAGS = -pthread +AM_CPPFLAGS = -I/usr/include/stlport +cxxtest_LDADD = -lstlport Added: trunk/complement/explore/inquiry/shades/autotools/build.sh =================================================================== --- trunk/complement/explore/inquiry/shades/autotools/build.sh (rev 0) +++ trunk/complement/explore/inquiry/shades/autotools/build.sh 2007-02-27 10:28:33 UTC (rev 1534) @@ -0,0 +1,7 @@ +#!/bin/sh + +c++ -pthread -g -c -I${HOME}/STLport.lab/STLport/stlport -o main.o main.cc +# c++ -pthread -g -c -I${HOME}/STLport.lab/STLport/stlport -o other.o other.cc +gcc -pthread -g -L${HOME}/STLport.lab/STLport/lib -Wl,--rpath=${HOME}/STLport.lab/STLport/lib -o cxxtest main.o -lstlport +# gcc -pthread -g -L${HOME}/STLport.lab/STLport/lib -Wl,--rpath=${HOME}/STLport.lab/STLport/lib -o cxxtest main.o other.o -lstlport +# c++ -pthread -g -I${HOME}/STLport.lab/STLport/stlport -L${HOME}/STLport.lab/STLport/lib -Wl,--rpath=${HOME}/STLport.lab/STLport/lib -o cxxtest main.o other.o -lstlport Property changes on: trunk/complement/explore/inquiry/shades/autotools/build.sh ___________________________________________________________________ Name: svn:executable + * Added: trunk/complement/explore/inquiry/shades/autotools/configure.ac =================================================================== --- trunk/complement/explore/inquiry/shades/autotools/configure.ac (rev 0) +++ trunk/complement/explore/inquiry/shades/autotools/configure.ac 2007-02-27 10:28:33 UTC (rev 1534) @@ -0,0 +1,23 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.59) +AC_INIT(TestCXXProject, 1.0.0) +AM_INIT_AUTOMAKE +AC_CONFIG_SRCDIR([main.cc]) +AC_CONFIG_HEADER([config.h]) +AC_CONFIG_FILES([Makefile]) + +# Checks for programs. +AC_PROG_CXX +AC_PROG_LIBTOOL + +# Checks for libraries. +ACX_PTHREAD + +# Checks for header files. + +# Checks for typedefs, structures, and compiler characteristics. + +# Checks for library functions. +AC_OUTPUT Added: trunk/complement/explore/inquiry/shades/autotools/main.cc =================================================================== --- trunk/complement/explore/inquiry/shades/autotools/main.cc (rev 0) +++ trunk/complement/explore/inquiry/shades/autotools/main.cc 2007-02-27 10:28:33 UTC (rev 1534) @@ -0,0 +1,14 @@ +#include <iostream> +// #include "my.h" + +extern int other(); + +int main(void) +{ + // A<int> a; + // a.use_it() += 1; + // int v1 = a.use_it(); + // int v2 = other(); + std::cout << "Hello, world! " << /* v1 << " " << v2 << */ std::endl; + return 0; +} Added: trunk/complement/explore/inquiry/shades/autotools/my.h =================================================================== --- trunk/complement/explore/inquiry/shades/autotools/my.h (rev 0) +++ trunk/complement/explore/inquiry/shades/autotools/my.h 2007-02-27 10:28:33 UTC (rev 1534) @@ -0,0 +1,27 @@ +#ifndef __MY_H +#define __MY_H + +template <class T> +class A +{ + public: + A(); + + T& use_it(); + + private: + static T val; +}; + +template <class T> +A<T>::A() +{ } + +template <class T> +T& A<T>::use_it() +{ return val; } + +template <class T> +T A<T>::val = 0; + +#endif // __MY_H Added: trunk/complement/explore/inquiry/shades/autotools/other.cc =================================================================== --- trunk/complement/explore/inquiry/shades/autotools/other.cc (rev 0) +++ trunk/complement/explore/inquiry/shades/autotools/other.cc 2007-02-27 10:28:33 UTC (rev 1534) @@ -0,0 +1,10 @@ +#include "my.h" + +int other() +{ + A<int> a; + a.use_it() += 1; + + return a.use_it(); +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-07-12 07:26:46
|
Revision: 1608 http://svn.sourceforge.net/complement/?rev=1608&view=rev Author: complement Date: 2007-07-12 00:26:45 -0700 (Thu, 12 Jul 2007) Log Message: ----------- in-loop declaration influence only position on stack, but not more Added Paths: ----------- trunk/complement/explore/inquiry/shades/in-loop-decl/ trunk/complement/explore/inquiry/shades/in-loop-decl/test.c trunk/complement/explore/inquiry/shades/in-loop-decl/test.s Added: trunk/complement/explore/inquiry/shades/in-loop-decl/test.c =================================================================== --- trunk/complement/explore/inquiry/shades/in-loop-decl/test.c (rev 0) +++ trunk/complement/explore/inquiry/shades/in-loop-decl/test.c 2007-07-12 07:26:45 UTC (rev 1608) @@ -0,0 +1,20 @@ +int q( int b ) +{ + int a; + int i = 0; + while ( i < 10 ) { + a = b; + ++i; + } + return 0; +} + +int qq( int b ) +{ + int i = 0; + while ( i < 10 ) { + int a = b; + ++i; + } + return 0; +} Added: trunk/complement/explore/inquiry/shades/in-loop-decl/test.s =================================================================== --- trunk/complement/explore/inquiry/shades/in-loop-decl/test.s (rev 0) +++ trunk/complement/explore/inquiry/shades/in-loop-decl/test.s 2007-07-12 07:26:45 UTC (rev 1608) @@ -0,0 +1,42 @@ + .file "test.c" + .text +.globl q + .type q, @function +q: + pushl %ebp + movl %esp, %ebp + subl $16, %esp + movl $0, -4(%ebp) + jmp .L2 +.L3: + movl 8(%ebp), %eax + movl %eax, -8(%ebp) + incl -4(%ebp) +.L2: + cmpl $9, -4(%ebp) + jle .L3 + movl $0, %eax + leave + ret + .size q, .-q +.globl qq + .type qq, @function +qq: + pushl %ebp + movl %esp, %ebp + subl $16, %esp + movl $0, -8(%ebp) + jmp .L7 +.L8: + movl 8(%ebp), %eax + movl %eax, -4(%ebp) + incl -8(%ebp) +.L7: + cmpl $9, -8(%ebp) + jle .L8 + movl $0, %eax + leave + ret + .size qq, .-qq + .ident "GCC: (GNU) 4.1.1" + .section .note.GNU-stack,"",@progbits This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-07-12 07:28:58
|
Revision: 1609 http://svn.sourceforge.net/complement/?rev=1609&view=rev Author: complement Date: 2007-07-12 00:28:57 -0700 (Thu, 12 Jul 2007) Log Message: ----------- importance of _FILE_OFFSET_BITS macro Added Paths: ----------- trunk/complement/explore/inquiry/shades/file64/ trunk/complement/explore/inquiry/shades/file64/Makefile trunk/complement/explore/inquiry/shades/file64/Makefile.inc trunk/complement/explore/inquiry/shades/file64/file64.c Property changes on: trunk/complement/explore/inquiry/shades/file64 ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/shades/file64/Makefile =================================================================== --- trunk/complement/explore/inquiry/shades/file64/Makefile (rev 0) +++ trunk/complement/explore/inquiry/shades/file64/Makefile 2007-07-12 07:28:57 UTC (rev 1609) @@ -0,0 +1,7 @@ +# -*- Makefile -*- Time-stamp: <04/01/09 16:53:50 ptr> + +SRCROOT := ../../.. +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/gmake/top.mak Added: trunk/complement/explore/inquiry/shades/file64/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/shades/file64/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/shades/file64/Makefile.inc 2007-07-12 07:28:57 UTC (rev 1609) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <04/04/16 20:55:38 ptr> + +PRGNAME = file64 +SRC_C = file64.c Added: trunk/complement/explore/inquiry/shades/file64/file64.c =================================================================== --- trunk/complement/explore/inquiry/shades/file64/file64.c (rev 0) +++ trunk/complement/explore/inquiry/shades/file64/file64.c 2007-07-12 07:28:57 UTC (rev 1609) @@ -0,0 +1,10 @@ +#define _FILE_OFFSET_BITS 64 + +#include <stdio.h> + +int main() +{ + FILE *f = fopen( "sample", "r" ); + fclose( f ); + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-07-12 07:30:57
|
Revision: 1610 http://svn.sourceforge.net/complement/?rev=1610&view=rev Author: complement Date: 2007-07-12 00:30:55 -0700 (Thu, 12 Jul 2007) Log Message: ----------- remove_if issue Added Paths: ----------- trunk/complement/explore/inquiry/shades/remove/ trunk/complement/explore/inquiry/shades/remove/Makefile trunk/complement/explore/inquiry/shades/remove/Makefile.inc trunk/complement/explore/inquiry/shades/remove/test.cc Property changes on: trunk/complement/explore/inquiry/shades/remove ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/shades/remove/Makefile =================================================================== --- trunk/complement/explore/inquiry/shades/remove/Makefile (rev 0) +++ trunk/complement/explore/inquiry/shades/remove/Makefile 2007-07-12 07:30:55 UTC (rev 1610) @@ -0,0 +1,9 @@ +# -*- Makefile -*- Time-stamp: <04/01/09 16:53:50 ptr> + +SRCROOT := ../../.. +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/gmake/top.mak + +LDFLAGS += -Wl,--rpath=${STLPORT_LIB_DIR} Added: trunk/complement/explore/inquiry/shades/remove/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/shades/remove/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/shades/remove/Makefile.inc 2007-07-12 07:30:55 UTC (rev 1610) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <04/01/12 15:37:40 ptr> + +PRGNAME = test +SRC_CC = test.cc Added: trunk/complement/explore/inquiry/shades/remove/test.cc =================================================================== --- trunk/complement/explore/inquiry/shades/remove/test.cc (rev 0) +++ trunk/complement/explore/inquiry/shades/remove/test.cc 2007-07-12 07:30:55 UTC (rev 1610) @@ -0,0 +1,63 @@ +#include <vector> +#include <algorithm> +#include <functional> +#include <iostream> + +using namespace std; + +int main() +{ + vector<int> v; + + v.push_back( 1 ); + v.push_back( 2 ); + v.push_back( 3 ); + v.push_back( 4 ); + v.push_back( 1 ); + + for ( vector<int>::iterator i = v.begin(); i != v.end(); ++i ) { + cout << *i << ", "; + } + cout << endl; + + vector<int>::iterator j = remove( v.begin(), v.end(), 1 ); + + for ( vector<int>::iterator i = v.begin(); i != v.end(); ++i ) { + cout << *i << ", "; + } + cout << endl; + + cout << (j - v.begin()) << endl; + + v.clear(); + + v.push_back( 1 ); + v.push_back( 2 ); + v.push_back( 3 ); + v.push_back( 4 ); + v.push_back( 1 ); + + j = remove_copy( v.begin(), v.end(), v.begin(), 1 ); + for ( vector<int>::iterator i = v.begin(); i != v.end(); ++i ) { + cout << *i << ", "; + } + cout << endl; + + v.clear(); + + v.push_back( 1 ); + v.push_back( 2 ); + v.push_back( 3 ); + v.push_back( 4 ); + v.push_back( 1 ); + + j = remove_if( v.begin(), v.end(), bind2nd( not_equal_to<int>(), 1 ) ); + + for ( vector<int>::iterator i = v.begin(); i != v.end(); ++i ) { + cout << *i << ", "; + } + cout << endl; + + + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-07-12 07:33:02
|
Revision: 1611 http://svn.sourceforge.net/complement/?rev=1611&view=rev Author: complement Date: 2007-07-12 00:33:00 -0700 (Thu, 12 Jul 2007) Log Message: ----------- play with ieee754 Added Paths: ----------- trunk/complement/explore/inquiry/shades/double/ trunk/complement/explore/inquiry/shades/double/Makefile trunk/complement/explore/inquiry/shades/double/Makefile.inc trunk/complement/explore/inquiry/shades/double/test.c Property Changed: ---------------- trunk/complement/explore/inquiry/shades/float/ Property changes on: trunk/complement/explore/inquiry/shades/double ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/shades/double/Makefile =================================================================== --- trunk/complement/explore/inquiry/shades/double/Makefile (rev 0) +++ trunk/complement/explore/inquiry/shades/double/Makefile 2007-07-12 07:33:00 UTC (rev 1611) @@ -0,0 +1,11 @@ +# -*- Makefile -*- Time-stamp: <04/01/09 16:53:50 ptr> + +SRCROOT := ../../.. +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/gmake/top.mak + +#release-shared : LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR} +#dbg-shared : LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR} +#stldbg-shared : LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR} Added: trunk/complement/explore/inquiry/shades/double/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/shades/double/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/shades/double/Makefile.inc 2007-07-12 07:33:00 UTC (rev 1611) @@ -0,0 +1,5 @@ +# -*- makefile -*- Time-stamp: <04/01/12 15:37:40 ptr> + +PRGNAME = test +SRC_C = test.c +#SRC_CC = test.cc Added: trunk/complement/explore/inquiry/shades/double/test.c =================================================================== --- trunk/complement/explore/inquiry/shades/double/test.c (rev 0) +++ trunk/complement/explore/inquiry/shades/double/test.c 2007-07-12 07:33:00 UTC (rev 1611) @@ -0,0 +1,49 @@ +#include <stdlib.h> +#include <stdio.h> +#include <ieee754.h> + +union D { + unsigned char c[16]; + double d; +}; + +union U { + unsigned u[2]; + double d; +}; + +int main( int argc, char **argv ) +{ + union D d; + union ieee754_double ieee754; + union U u; + int i; + + for ( i = 0; i < 16; ++i ) { + d.c[i] = 0; + } + + d.d = 1.0; + ieee754.d = 1.0; + u.u[0] = 0; + u.u[1] = 0x3ff << 20; + + for ( i = 0; i < 16; ++i ) { + printf( "%.2x ", d.c[i] ); + } + printf( "\n" ); + + for ( i = 0; i < 8; ++i ) { + printf( "%.2x ", *((unsigned char *)&ieee754.d + i) ); + } + printf( "\n" ); + + printf( "%.1x %.3x %.5x %.8x\n", ieee754.ieee.negative, ieee754.ieee.exponent, ieee754.ieee.mantissa0, ieee754.ieee.mantissa1 ); + + for ( i = 0; i < 8; ++i ) { + printf( "%.2x ", *((unsigned char *)&u.d + i) ); + } + printf( "\n" ); + + return 0; +} Property changes on: trunk/complement/explore/inquiry/shades/float ___________________________________________________________________ Name: svn:ignore + obj This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-07-27 11:51:41
|
Revision: 1651 http://complement.svn.sourceforge.net/complement/?rev=1651&view=rev Author: complement Date: 2007-07-27 04:51:31 -0700 (Fri, 27 Jul 2007) Log Message: ----------- juniper removed, str_interposer.c preserved in ldpreload Added Paths: ----------- trunk/complement/explore/inquiry/shades/ldpreload/str_interposer.c Removed Paths: ------------- trunk/complement/explore/inquiry/shades/juniper/ Added: trunk/complement/explore/inquiry/shades/ldpreload/str_interposer.c =================================================================== --- trunk/complement/explore/inquiry/shades/ldpreload/str_interposer.c (rev 0) +++ trunk/complement/explore/inquiry/shades/ldpreload/str_interposer.c 2007-07-27 11:51:31 UTC (rev 1651) @@ -0,0 +1,126 @@ +/* Example from: http://developers.sun.com/solaris/articles/lib_interposers_code.html + * + */ + +/* library interposer: interpose on + * str...(). + * export LD_PRELOAD=$cwd/libtest.so.0.0 + * run the app + * unset LD_PRELOAD + */ + +#include <stdio.h> +#include <dlfcn.h> +#include <sys/socket.h> +#include <netinet/in.h> + + +#if 0 +void *malloc(size_t size) +{ + static void * (*func)(); + + if(!func) + func = (void *(*)()) dlsym(RTLD_NEXT, "malloc"); + printf("malloc(%d) is called\n", size); + return(func(size)); +} +#endif + +char *strcpy( char *s1, const char *s2 ) +{ + static void * (*func)(); + + if (!func) + func = (void *(*)()) dlsym(RTLD_NEXT, "strcpy"); + + printf( "strcpy: '%s'\n", s2 ); + + return func( s1, s2 ); +} + +char *strdup(const char *s1) +{ + static void * (*func)(); + + if (!func) + func = (void *(*)()) dlsym(RTLD_NEXT, "strdup"); + + printf( "strdup: '%s'\n", s1 ); + + return func( s1 ); +} + +char *strncat(char *s1, const char *s2, size_t n) +{ + static void * (*func)(); + char *r; + + if (!func) + func = (void *(*)()) dlsym(RTLD_NEXT, "strncat"); + + r = func( s1, s2, n ); + printf( "strncat: '%s'\n", r ); + + return r; +} + +char *strtok(char *s1, const char *s2) +{ + static void * (*func)(); + + if (!func) + func = (void *(*)()) dlsym(RTLD_NEXT, "strtok"); + + printf( "strtok: '%s'\n", s1 ); + + return func( s1, s2 ); +} + +ssize_t sendto(int socket, const void *message, size_t length, int flags, const struct sockaddr *dest_addr, socklen_t dest_len) +{ + static ssize_t (*func)(); + int i; + + if (!func) + func = (ssize_t (*)()) dlsym(RTLD_NEXT, "sendto"); + + printf( "sendto: (%d) '", length ); + for ( i = 0; i < length; ++i ) { + printf( "%c", (const char *)message + i ); + } + printf( "'\n" ); + return func( socket, message, length, flags, dest_addr, dest_len ); +} + +ssize_t recvfrom(int socket, void *buffer, size_t length, int flags, struct sockaddr *address, socklen_t *address_len) +{ + static ssize_t (*func)(); + int i; + ssize_t s; + + if (!func) + func = (ssize_t (*)()) dlsym(RTLD_NEXT, "recvfrom"); + + s = func( socket, buffer, length, flags, address, address_len ); + printf( "recvfrom: (%d) '", length ); + for ( i = 0; i < length; ++i ) { + printf( "%c", (const char *)buffer + i ); + } + printf( "'\n" ); + return s; +} + +int connect(int socket, const struct sockaddr *address, socklen_t address_len) +{ + static int (*func)(); + + if (!func) + func = (int (*)()) dlsym(RTLD_NEXT, "connect"); + + printf( "connect: " ); + printf( "%x", *(((unsigned *)&((struct sockaddr_in *)address)->sin_addr)) ); + printf( ":%d\n", ntohs(((struct sockaddr_in *)address)->sin_port) ); + + return func( socket, address, address_len ); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-10-24 16:52:24
|
Revision: 1772 http://complement.svn.sourceforge.net/complement/?rev=1772&view=rev Author: complement Date: 2007-10-24 09:52:22 -0700 (Wed, 24 Oct 2007) Log Message: ----------- fifo with fstream, order of open Added Paths: ----------- trunk/complement/explore/inquiry/shades/fifo/ trunk/complement/explore/inquiry/shades/fifo/Makefile trunk/complement/explore/inquiry/shades/fifo/Makefile.inc trunk/complement/explore/inquiry/shades/fifo/test.cc Property changes on: trunk/complement/explore/inquiry/shades/fifo ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/shades/fifo/Makefile =================================================================== --- trunk/complement/explore/inquiry/shades/fifo/Makefile (rev 0) +++ trunk/complement/explore/inquiry/shades/fifo/Makefile 2007-10-24 16:52:22 UTC (rev 1772) @@ -0,0 +1,9 @@ +# -*- Makefile -*- Time-stamp: <04/01/09 16:53:50 ptr> + +SRCROOT := ../../.. +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/gmake/top.mak + +LDFLAGS += -Wl,--rpath=${STLPORT_LIB_DIR} Added: trunk/complement/explore/inquiry/shades/fifo/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/shades/fifo/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/shades/fifo/Makefile.inc 2007-10-24 16:52:22 UTC (rev 1772) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <04/01/12 15:37:40 ptr> + +PRGNAME = test +SRC_CC = test.cc Added: trunk/complement/explore/inquiry/shades/fifo/test.cc =================================================================== --- trunk/complement/explore/inquiry/shades/fifo/test.cc (rev 0) +++ trunk/complement/explore/inquiry/shades/fifo/test.cc 2007-10-24 16:52:22 UTC (rev 1772) @@ -0,0 +1,18 @@ +#include <fstream> +#include <iostream> +#include <sys/types.h> +#include <sys/stat.h> + +using namespace std; + +int main() +{ + mkfifo( "./file", 0666 ); + { + ofstream f( "./file" ); + + f << "Hello" << endl; + } + + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-10-24 16:56:47
|
Revision: 1776 http://complement.svn.sourceforge.net/complement/?rev=1776&view=rev Author: complement Date: 2007-10-24 09:56:45 -0700 (Wed, 24 Oct 2007) Log Message: ----------- sizeof static array Added Paths: ----------- trunk/complement/explore/inquiry/shades/sz/ trunk/complement/explore/inquiry/shades/sz/Makefile trunk/complement/explore/inquiry/shades/sz/Makefile.inc trunk/complement/explore/inquiry/shades/sz/test.cc Property changes on: trunk/complement/explore/inquiry/shades/sz ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/shades/sz/Makefile =================================================================== --- trunk/complement/explore/inquiry/shades/sz/Makefile (rev 0) +++ trunk/complement/explore/inquiry/shades/sz/Makefile 2007-10-24 16:56:45 UTC (rev 1776) @@ -0,0 +1,9 @@ +# -*- Makefile -*- Time-stamp: <04/01/09 16:53:50 ptr> + +SRCROOT := ../../.. +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/gmake/top.mak + +LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR} Added: trunk/complement/explore/inquiry/shades/sz/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/shades/sz/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/shades/sz/Makefile.inc 2007-10-24 16:56:45 UTC (rev 1776) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <04/04/16 20:55:38 ptr> + +PRGNAME = test +SRC_CC = test.cc Added: trunk/complement/explore/inquiry/shades/sz/test.cc =================================================================== --- trunk/complement/explore/inquiry/shades/sz/test.cc (rev 0) +++ trunk/complement/explore/inquiry/shades/sz/test.cc 2007-10-24 16:56:45 UTC (rev 1776) @@ -0,0 +1,29 @@ +#include <iostream> +// #include <string> + +char *arr[][2] = { + { "1", "1.2" }, + { "2", "2.2" }, + { "2", "2.2" } +}; + +using namespace std; + +int main() +{ + cerr << sizeof(arr) << " " << sizeof(arr[0]) << " " << sizeof(arr)/sizeof(arr[0]) << endl; + +#if 0 + string s( "01234567Tabc" ); + + string::size_type p = s.find( 'T', 6 ); + if ( p != string::npos ) { + cerr << s.substr( 0, p ) << endl; + } + + s.erase( p ); + cerr << s << endl; +#endif + return 0; +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-11-21 11:53:52
|
Revision: 1790 http://complement.svn.sourceforge.net/complement/?rev=1790&view=rev Author: complement Date: 2007-11-21 03:53:50 -0800 (Wed, 21 Nov 2007) Log Message: ----------- how to use paramertized member function Added Paths: ----------- trunk/complement/explore/inquiry/shades/Tmethod/ trunk/complement/explore/inquiry/shades/Tmethod/Makefile trunk/complement/explore/inquiry/shades/Tmethod/Makefile.inc trunk/complement/explore/inquiry/shades/Tmethod/test.cc Property changes on: trunk/complement/explore/inquiry/shades/Tmethod ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/shades/Tmethod/Makefile =================================================================== --- trunk/complement/explore/inquiry/shades/Tmethod/Makefile (rev 0) +++ trunk/complement/explore/inquiry/shades/Tmethod/Makefile 2007-11-21 11:53:50 UTC (rev 1790) @@ -0,0 +1,9 @@ +# -*- Makefile -*- Time-stamp: <04/01/09 16:53:50 ptr> + +SRCROOT := ../../.. +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/gmake/top.mak + +LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR} Added: trunk/complement/explore/inquiry/shades/Tmethod/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/shades/Tmethod/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/shades/Tmethod/Makefile.inc 2007-11-21 11:53:50 UTC (rev 1790) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <04/04/16 20:55:38 ptr> + +PRGNAME = test +SRC_CC = test.cc Added: trunk/complement/explore/inquiry/shades/Tmethod/test.cc =================================================================== --- trunk/complement/explore/inquiry/shades/Tmethod/test.cc (rev 0) +++ trunk/complement/explore/inquiry/shades/Tmethod/test.cc 2007-11-21 11:53:50 UTC (rev 1790) @@ -0,0 +1,53 @@ +#include <iostream> + +using namespace std; + +template <class T> +class A +{ + public: + void f() + { T *v = new T(); v->f(); } +}; + +template <class T, void (T::*M)() = &T::f > +class C +{ + public: + void f() + { T *v = new T(); (v->*M)(); } +}; + +class B +{ + public: + typedef void (B::*mf)(); + + void f() + { cerr << "B::f\n"; } + + void g() + { cerr << "B::g\n"; } +}; + +int main() +{ + A<B> a; + + a.f(); + + C<B,&B::f> c; + + c.f(); + + C<B> c1; + + c1.f(); + + C<B,&B::g> c2; + + c2.f(); + + return 0; +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-11-21 11:54:12
|
Revision: 1789 http://complement.svn.sourceforge.net/complement/?rev=1789&view=rev Author: complement Date: 2007-11-21 03:50:48 -0800 (Wed, 21 Nov 2007) Log Message: ----------- index of array via reverse iterator Added Paths: ----------- trunk/complement/explore/inquiry/shades/reverse_iterator/ trunk/complement/explore/inquiry/shades/reverse_iterator/Makefile trunk/complement/explore/inquiry/shades/reverse_iterator/Makefile.inc trunk/complement/explore/inquiry/shades/reverse_iterator/test.cc Property changes on: trunk/complement/explore/inquiry/shades/reverse_iterator ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/shades/reverse_iterator/Makefile =================================================================== --- trunk/complement/explore/inquiry/shades/reverse_iterator/Makefile (rev 0) +++ trunk/complement/explore/inquiry/shades/reverse_iterator/Makefile 2007-11-21 11:50:48 UTC (rev 1789) @@ -0,0 +1,8 @@ +# -*- Makefile -*- Time-stamp: <03/07/09 18:08:47 ptr> + +SRCROOT := ../../.. + +include Makefile.inc +include ${SRCROOT}/Makefiles/gmake/top.mak + +LDFLAGS += -Wl,-rpath=$(STLPORT_LIB_DIR) Added: trunk/complement/explore/inquiry/shades/reverse_iterator/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/shades/reverse_iterator/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/shades/reverse_iterator/Makefile.inc 2007-11-21 11:50:48 UTC (rev 1789) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <02/07/14 14:03:13 ptr> + +PRGNAME = test +SRC_CC = test.cc Added: trunk/complement/explore/inquiry/shades/reverse_iterator/test.cc =================================================================== --- trunk/complement/explore/inquiry/shades/reverse_iterator/test.cc (rev 0) +++ trunk/complement/explore/inquiry/shades/reverse_iterator/test.cc 2007-11-21 11:50:48 UTC (rev 1789) @@ -0,0 +1,28 @@ +// -*- C++ -*- Time-stamp: <04/02/18 19:42:59 ptr> + +#include <iostream> +#include <vector> + +using namespace std; + +int main( int argc, char * const *argv ) +{ + typedef vector<char *> container_type; + + container_type cnt( 3 ); + + cerr << cnt.size() << endl; + + cnt[0] = "Hello"; + + int j = 0; + for ( container_type::reverse_iterator i = cnt.rbegin(); i != cnt.rend(); ++i ) { + cerr << j << ": " << (*i != 0 ? *i : "" ) << endl; + if ( *i != 0 ) { + cerr << " last_value " << (cnt.rend() - i) << endl; + } + ++j; + } + + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |