internal
| 261 | |
| 262 | // internal |
| 263 | void asCContext::DetachEngine() |
| 264 | { |
| 265 | if( m_engine == 0 ) return; |
| 266 | |
| 267 | // Clean up all calls, included nested ones |
| 268 | do |
| 269 | { |
| 270 | // Abort any execution |
| 271 | Abort(); |
| 272 | |
| 273 | // Free all resources |
| 274 | Unprepare(); |
| 275 | } |
| 276 | while( IsNested() ); |
| 277 | |
| 278 | // Free the stack blocks |
| 279 | for( asUINT n = 0; n < m_stackBlocks.GetLength(); n++ ) |
| 280 | { |
| 281 | if( m_stackBlocks[n] ) |
| 282 | { |
| 283 | #ifndef WIP_16BYTE_ALIGN |
| 284 | asDELETEARRAY(m_stackBlocks[n]); |
| 285 | #else |
| 286 | asDELETEARRAYALIGNED(m_stackBlocks[n]); |
| 287 | #endif |
| 288 | } |
| 289 | } |
| 290 | m_stackBlocks.SetLength(0); |
| 291 | m_stackBlockSize = 0; |
| 292 | |
| 293 | // Clean the user data |
| 294 | for( asUINT n = 0; n < m_userData.GetLength(); n += 2 ) |
| 295 | { |
| 296 | if( m_userData[n+1] ) |
| 297 | { |
| 298 | for( asUINT c = 0; c < m_engine->cleanContextFuncs.GetLength(); c++ ) |
| 299 | if( m_engine->cleanContextFuncs[c].type == m_userData[n] ) |
| 300 | m_engine->cleanContextFuncs[c].cleanFunc(this); |
| 301 | } |
| 302 | } |
| 303 | m_userData.SetLength(0); |
| 304 | |
| 305 | // Clear engine pointer |
| 306 | if( m_holdEngineRef ) |
| 307 | m_engine->Release(); |
| 308 | m_engine = 0; |
| 309 | } |
| 310 | |
| 311 | // interface |
| 312 | asIScriptEngine *asCContext::GetEngine() const |