| 217 | } |
| 218 | |
| 219 | class CBytecodeStream : public asIBinaryStream |
| 220 | { |
| 221 | public: |
| 222 | CBytecodeStream() {f = 0;} |
| 223 | ~CBytecodeStream() { if( f ) fclose(f); } |
| 224 | |
| 225 | int Open(const char *filename) |
| 226 | { |
| 227 | if( f ) return -1; |
| 228 | #if _MSC_VER >= 1500 |
| 229 | fopen_s(&f, filename, "wb"); |
| 230 | #else |
| 231 | f = fopen(filename, "wb"); |
| 232 | #endif |
| 233 | if( f == 0 ) return -1; |
| 234 | return 0; |
| 235 | } |
| 236 | int Write(const void *ptr, asUINT size) |
| 237 | { |
| 238 | if( size == 0 || f == 0 ) return 0; |
| 239 | fwrite(ptr, size, 1, f); |
| 240 | return 0; |
| 241 | } |
| 242 | int Read(void *, asUINT) { return -1; } |
| 243 | |
| 244 | protected: |
| 245 | FILE *f; |
| 246 | }; |
| 247 | |
| 248 | int SaveBytecode(asIScriptEngine *engine, const char *outputFile) |
| 249 | { |
nothing calls this directly
no outgoing calls
no test coverage detected