diff options
Diffstat (limited to '')
| -rw-r--r-- | fstringtest.dev | 59 | ||||
| -rw-r--r-- | libbu++.dev | 209 | ||||
| -rw-r--r-- | src/file.cpp | 10 | ||||
| -rw-r--r-- | src/file.h | 2 | ||||
| -rw-r--r-- | src/tests/fstring.cpp | 10 |
5 files changed, 286 insertions, 4 deletions
diff --git a/fstringtest.dev b/fstringtest.dev new file mode 100644 index 0000000..297242d --- /dev/null +++ b/fstringtest.dev | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | [Project] | ||
| 2 | FileName=fstringtest.dev | ||
| 3 | Name=fstringtest | ||
| 4 | UnitCount=1 | ||
| 5 | Type=1 | ||
| 6 | Ver=1 | ||
| 7 | ObjFiles= | ||
| 8 | Includes=z:\home\neonphog\wine_documents\libbu++\src\bu | ||
| 9 | Libs= | ||
| 10 | PrivateResource= | ||
| 11 | ResourceIncludes= | ||
| 12 | MakeIncludes= | ||
| 13 | Compiler= | ||
| 14 | CppCompiler=_@@_ | ||
| 15 | Linker=libbu++.a_@@_ | ||
| 16 | IsCpp=1 | ||
| 17 | Icon= | ||
| 18 | ExeOutput= | ||
| 19 | ObjectOutput= | ||
| 20 | OverrideOutput=0 | ||
| 21 | OverrideOutputName=fstringtest.exe | ||
| 22 | HostApplication= | ||
| 23 | Folders= | ||
| 24 | CommandLine= | ||
| 25 | UseCustomMakefile=0 | ||
| 26 | CustomMakefile= | ||
| 27 | IncludeVersionInfo=0 | ||
| 28 | SupportXPThemes=0 | ||
| 29 | CompilerSet=0 | ||
| 30 | CompilerSettings=0000000000000000000000 | ||
| 31 | |||
| 32 | [VersionInfo] | ||
| 33 | Major=0 | ||
| 34 | Minor=1 | ||
| 35 | Release=1 | ||
| 36 | Build=1 | ||
| 37 | LanguageID=1033 | ||
| 38 | CharsetID=1252 | ||
| 39 | CompanyName= | ||
| 40 | FileVersion= | ||
| 41 | FileDescription=Developed using the Dev-C++ IDE | ||
| 42 | InternalName= | ||
| 43 | LegalCopyright= | ||
| 44 | LegalTrademarks= | ||
| 45 | OriginalFilename= | ||
| 46 | ProductName= | ||
| 47 | ProductVersion= | ||
| 48 | AutoIncBuildNr=0 | ||
| 49 | |||
| 50 | [Unit1] | ||
| 51 | FileName=src\tests\fstring.cpp | ||
| 52 | CompileCpp=1 | ||
| 53 | Folder=fstringtest | ||
| 54 | Compile=1 | ||
| 55 | Link=1 | ||
| 56 | Priority=1000 | ||
| 57 | OverrideBuildCmd=0 | ||
| 58 | BuildCmd= | ||
| 59 | |||
diff --git a/libbu++.dev b/libbu++.dev new file mode 100644 index 0000000..2fb1ae9 --- /dev/null +++ b/libbu++.dev | |||
| @@ -0,0 +1,209 @@ | |||
| 1 | [Project] | ||
| 2 | FileName=libbu++.dev | ||
| 3 | Name=libbu++ | ||
| 4 | UnitCount=16 | ||
| 5 | Type=2 | ||
| 6 | Ver=1 | ||
| 7 | ObjFiles= | ||
| 8 | Includes=z:\home\neonphog\wine_documents\libbu++\src\bu | ||
| 9 | Libs= | ||
| 10 | PrivateResource= | ||
| 11 | ResourceIncludes= | ||
| 12 | MakeIncludes= | ||
| 13 | Compiler= | ||
| 14 | CppCompiler= | ||
| 15 | Linker= | ||
| 16 | IsCpp=1 | ||
| 17 | Icon= | ||
| 18 | ExeOutput= | ||
| 19 | ObjectOutput= | ||
| 20 | OverrideOutput=0 | ||
| 21 | OverrideOutputName=libbu++.a | ||
| 22 | HostApplication= | ||
| 23 | Folders= | ||
| 24 | CommandLine= | ||
| 25 | UseCustomMakefile=0 | ||
| 26 | CustomMakefile= | ||
| 27 | IncludeVersionInfo=0 | ||
| 28 | SupportXPThemes=0 | ||
| 29 | CompilerSet=0 | ||
| 30 | CompilerSettings=0000000000000000000000 | ||
| 31 | |||
| 32 | [Unit1] | ||
| 33 | FileName=src\stream.cpp | ||
| 34 | CompileCpp=1 | ||
| 35 | Folder=libbu++ | ||
| 36 | Compile=1 | ||
| 37 | Link=1 | ||
| 38 | Priority=1000 | ||
| 39 | OverrideBuildCmd=0 | ||
| 40 | BuildCmd= | ||
| 41 | |||
| 42 | [VersionInfo] | ||
| 43 | Major=0 | ||
| 44 | Minor=1 | ||
| 45 | Release=1 | ||
| 46 | Build=1 | ||
| 47 | LanguageID=1033 | ||
| 48 | CharsetID=1252 | ||
| 49 | CompanyName= | ||
| 50 | FileVersion= | ||
| 51 | FileDescription=Developed using the Dev-C++ IDE | ||
| 52 | InternalName= | ||
| 53 | LegalCopyright= | ||
| 54 | LegalTrademarks= | ||
| 55 | OriginalFilename= | ||
| 56 | ProductName= | ||
| 57 | ProductVersion= | ||
| 58 | AutoIncBuildNr=0 | ||
| 59 | |||
| 60 | [Unit2] | ||
| 61 | FileName=src\stream.h | ||
| 62 | CompileCpp=1 | ||
| 63 | Folder=libbu++ | ||
| 64 | Compile=1 | ||
| 65 | Link=1 | ||
| 66 | Priority=1000 | ||
| 67 | OverrideBuildCmd=0 | ||
| 68 | BuildCmd= | ||
| 69 | |||
| 70 | [Unit3] | ||
| 71 | FileName=src\file.cpp | ||
| 72 | CompileCpp=1 | ||
| 73 | Folder=libbu++ | ||
| 74 | Compile=1 | ||
| 75 | Link=1 | ||
| 76 | Priority=1000 | ||
| 77 | OverrideBuildCmd=0 | ||
| 78 | BuildCmd= | ||
| 79 | |||
| 80 | [Unit4] | ||
| 81 | FileName=src\file.h | ||
| 82 | CompileCpp=1 | ||
| 83 | Folder=libbu++ | ||
| 84 | Compile=1 | ||
| 85 | Link=1 | ||
| 86 | Priority=1000 | ||
| 87 | OverrideBuildCmd=0 | ||
| 88 | BuildCmd= | ||
| 89 | |||
| 90 | [Unit5] | ||
| 91 | FileName=src\fstring.h | ||
| 92 | CompileCpp=1 | ||
| 93 | Folder=libbu++ | ||
| 94 | Compile=1 | ||
| 95 | Link=1 | ||
| 96 | Priority=1000 | ||
| 97 | OverrideBuildCmd=0 | ||
| 98 | BuildCmd= | ||
| 99 | |||
| 100 | [Unit6] | ||
| 101 | FileName=src\fstring.cpp | ||
| 102 | CompileCpp=1 | ||
| 103 | Folder=libbu++ | ||
| 104 | Compile=1 | ||
| 105 | Link=1 | ||
| 106 | Priority=1000 | ||
| 107 | OverrideBuildCmd=0 | ||
| 108 | BuildCmd= | ||
| 109 | |||
| 110 | [Unit7] | ||
| 111 | FileName=src\archival.cpp | ||
| 112 | CompileCpp=1 | ||
| 113 | Folder=libbu++ | ||
| 114 | Compile=1 | ||
| 115 | Link=1 | ||
| 116 | Priority=1000 | ||
| 117 | OverrideBuildCmd=0 | ||
| 118 | BuildCmd= | ||
| 119 | |||
| 120 | [Unit8] | ||
| 121 | FileName=src\archival.h | ||
| 122 | CompileCpp=1 | ||
| 123 | Folder=libbu++ | ||
| 124 | Compile=1 | ||
| 125 | Link=1 | ||
| 126 | Priority=1000 | ||
| 127 | OverrideBuildCmd=0 | ||
| 128 | BuildCmd= | ||
| 129 | |||
| 130 | [Unit9] | ||
| 131 | FileName=src\archive.cpp | ||
| 132 | CompileCpp=1 | ||
| 133 | Folder=libbu++ | ||
| 134 | Compile=1 | ||
| 135 | Link=1 | ||
| 136 | Priority=1000 | ||
| 137 | OverrideBuildCmd=0 | ||
| 138 | BuildCmd= | ||
| 139 | |||
| 140 | [Unit10] | ||
| 141 | FileName=src\archive.h | ||
| 142 | CompileCpp=1 | ||
| 143 | Folder=libbu++ | ||
| 144 | Compile=1 | ||
| 145 | Link=1 | ||
| 146 | Priority=1000 | ||
| 147 | OverrideBuildCmd=0 | ||
| 148 | BuildCmd= | ||
| 149 | |||
| 150 | [Unit11] | ||
| 151 | FileName=src\hash.h | ||
| 152 | CompileCpp=1 | ||
| 153 | Folder=libbu++ | ||
| 154 | Compile=1 | ||
| 155 | Link=1 | ||
| 156 | Priority=1000 | ||
| 157 | OverrideBuildCmd=0 | ||
| 158 | BuildCmd= | ||
| 159 | |||
| 160 | [Unit12] | ||
| 161 | FileName=src\hash.cpp | ||
| 162 | CompileCpp=1 | ||
| 163 | Folder=libbu++ | ||
| 164 | Compile=1 | ||
| 165 | Link=1 | ||
| 166 | Priority=1000 | ||
| 167 | OverrideBuildCmd=0 | ||
| 168 | BuildCmd= | ||
| 169 | |||
| 170 | [Unit13] | ||
| 171 | FileName=src\exceptionbase.cpp | ||
| 172 | CompileCpp=1 | ||
| 173 | Folder=libbu++ | ||
| 174 | Compile=1 | ||
| 175 | Link=1 | ||
| 176 | Priority=1000 | ||
| 177 | OverrideBuildCmd=0 | ||
| 178 | BuildCmd= | ||
| 179 | |||
| 180 | [Unit14] | ||
| 181 | FileName=src\exceptionbase.h | ||
| 182 | CompileCpp=1 | ||
| 183 | Folder=libbu++ | ||
| 184 | Compile=1 | ||
| 185 | Link=1 | ||
| 186 | Priority=1000 | ||
| 187 | OverrideBuildCmd=0 | ||
| 188 | BuildCmd= | ||
| 189 | |||
| 190 | [Unit15] | ||
| 191 | FileName=src\list.cpp | ||
| 192 | CompileCpp=1 | ||
| 193 | Folder=libbu++ | ||
| 194 | Compile=1 | ||
| 195 | Link=1 | ||
| 196 | Priority=1000 | ||
| 197 | OverrideBuildCmd=0 | ||
| 198 | BuildCmd= | ||
| 199 | |||
| 200 | [Unit16] | ||
| 201 | FileName=src\list.h | ||
| 202 | CompileCpp=1 | ||
| 203 | Folder=libbu++ | ||
| 204 | Compile=1 | ||
| 205 | Link=1 | ||
| 206 | Priority=1000 | ||
| 207 | OverrideBuildCmd=0 | ||
| 208 | BuildCmd= | ||
| 209 | |||
diff --git a/src/file.cpp b/src/file.cpp index 368b788..1a8bd08 100644 --- a/src/file.cpp +++ b/src/file.cpp | |||
| @@ -134,19 +134,21 @@ void Bu::File::setBlocking( bool bBlocking ) | |||
| 134 | return; | 134 | return; |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | #ifndef WIN32 | ||
| 137 | void Bu::File::truncate( long nSize ) | 138 | void Bu::File::truncate( long nSize ) |
| 138 | { | 139 | { |
| 139 | ftruncate( fileno( fh ), nSize ); | 140 | ftruncate( fileno( fh ), nSize ); |
| 140 | } | 141 | } |
| 141 | 142 | ||
| 142 | void Bu::File::flush() | 143 | void Bu::File::chmod( mode_t t ) |
| 143 | { | 144 | { |
| 144 | fflush( fh ); | 145 | fchmod( fileno( fh ), t ); |
| 145 | } | 146 | } |
| 147 | #endif | ||
| 146 | 148 | ||
| 147 | void Bu::File::chmod( mode_t t ) | 149 | void Bu::File::flush() |
| 148 | { | 150 | { |
| 149 | fchmod( fileno( fh ), t ); | 151 | fflush( fh ); |
| 150 | } | 152 | } |
| 151 | 153 | ||
| 152 | bool Bu::File::isOpen() | 154 | bool Bu::File::isOpen() |
| @@ -47,6 +47,7 @@ namespace Bu | |||
| 47 | *@param sFlags (const char *) Standard file flags 'rb'... etc.. | 47 | *@param sFlags (const char *) Standard file flags 'rb'... etc.. |
| 48 | *@returns (Bu::File) A file object representing your temp file. | 48 | *@returns (Bu::File) A file object representing your temp file. |
| 49 | */ | 49 | */ |
| 50 | #ifndef WIN32 | ||
| 50 | inline static Bu::File tempFile( Bu::FString &sName, const char *sFlags ) | 51 | inline static Bu::File tempFile( Bu::FString &sName, const char *sFlags ) |
| 51 | { | 52 | { |
| 52 | int afh_d = mkstemp( sName.getStr() ); | 53 | int afh_d = mkstemp( sName.getStr() ); |
| @@ -66,6 +67,7 @@ namespace Bu | |||
| 66 | *@param t (mode_t) The new file access permissions. | 67 | *@param t (mode_t) The new file access permissions. |
| 67 | */ | 68 | */ |
| 68 | void chmod( mode_t t ); | 69 | void chmod( mode_t t ); |
| 70 | #endif | ||
| 69 | 71 | ||
| 70 | private: | 72 | private: |
| 71 | FILE *fh; | 73 | FILE *fh; |
diff --git a/src/tests/fstring.cpp b/src/tests/fstring.cpp index d600be6..48dfc5f 100644 --- a/src/tests/fstring.cpp +++ b/src/tests/fstring.cpp | |||
| @@ -3,12 +3,22 @@ | |||
| 3 | #include <sys/time.h> | 3 | #include <sys/time.h> |
| 4 | #include <string> | 4 | #include <string> |
| 5 | 5 | ||
| 6 | #ifndef WIN32 | ||
| 6 | inline double getTime() | 7 | inline double getTime() |
| 7 | { | 8 | { |
| 8 | struct timeval tv; | 9 | struct timeval tv; |
| 9 | gettimeofday( &tv, NULL ); | 10 | gettimeofday( &tv, NULL ); |
| 10 | return ((double)tv.tv_sec) + ((double)tv.tv_usec/1000000.0); | 11 | return ((double)tv.tv_sec) + ((double)tv.tv_usec/1000000.0); |
| 11 | } | 12 | } |
| 13 | #else | ||
| 14 | #include "windows.h" | ||
| 15 | #include "winbase.h" | ||
| 16 | inline double getTime() | ||
| 17 | { | ||
| 18 | uint32_t t = (uint32_t) GetTickCount(); | ||
| 19 | return (double) t / 1000.0; | ||
| 20 | } | ||
| 21 | #endif | ||
| 12 | 22 | ||
| 13 | Bu::FString genThing() | 23 | Bu::FString genThing() |
| 14 | { | 24 | { |
