Commit e2eb099a authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

vbscript: Implement script persistence.

Persistent code has to be re-executed if the script is uninitialized and then reinitialized and restarted. Signed-off-by: 's avatarGabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 71ce8530
...@@ -1997,8 +1997,11 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli ...@@ -1997,8 +1997,11 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli
class->next = script->classes; class->next = script->classes;
script->classes = ctx.classes; script->classes = ctx.classes;
code->last_class = class;
} }
code->is_persistent = (flags & SCRIPTTEXT_ISPERSISTENT) != 0;
if(TRACE_ON(vbscript_disas)) if(TRACE_ON(vbscript_disas))
dump_code(&ctx); dump_code(&ctx);
...@@ -2016,7 +2019,7 @@ HRESULT compile_procedure(script_ctx_t *script, const WCHAR *src, const WCHAR *d ...@@ -2016,7 +2019,7 @@ HRESULT compile_procedure(script_ctx_t *script, const WCHAR *src, const WCHAR *d
vbscode_t *code; vbscode_t *code;
HRESULT hres; HRESULT hres;
hres = compile_script(script, src, delimiter, flags, &code); hres = compile_script(script, src, delimiter, flags & ~SCRIPTTEXT_ISPERSISTENT, &code);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
......
...@@ -130,6 +130,7 @@ IDispatch *lookup_named_item(script_ctx_t *ctx, const WCHAR *name, unsigned flag ...@@ -130,6 +130,7 @@ IDispatch *lookup_named_item(script_ctx_t *ctx, const WCHAR *name, unsigned flag
static void release_script(script_ctx_t *ctx) static void release_script(script_ctx_t *ctx)
{ {
vbscode_t *code, *code_next;
class_desc_t *class_desc; class_desc_t *class_desc;
unsigned i; unsigned i;
...@@ -148,6 +149,17 @@ static void release_script(script_ctx_t *ctx) ...@@ -148,6 +149,17 @@ static void release_script(script_ctx_t *ctx)
ctx->global_funcs_cnt = 0; ctx->global_funcs_cnt = 0;
ctx->global_funcs_size = 0; ctx->global_funcs_size = 0;
LIST_FOR_EACH_ENTRY_SAFE(code, code_next, &ctx->code_list, vbscode_t, entry)
{
if(code->is_persistent)
{
code->pending_exec = TRUE;
if(code->last_class) code->last_class->next = NULL;
}
else
release_vbscode(code);
}
while(!list_empty(&ctx->named_items)) { while(!list_empty(&ctx->named_items)) {
named_item_t *iter = LIST_ENTRY(list_head(&ctx->named_items), named_item_t, entry); named_item_t *iter = LIST_ENTRY(list_head(&ctx->named_items), named_item_t, entry);
......
...@@ -341,6 +341,7 @@ struct _vbscode_t { ...@@ -341,6 +341,7 @@ struct _vbscode_t {
BOOL option_explicit; BOOL option_explicit;
BOOL pending_exec; BOOL pending_exec;
BOOL is_persistent;
function_t main_code; function_t main_code;
IDispatch *context; IDispatch *context;
...@@ -349,6 +350,8 @@ struct _vbscode_t { ...@@ -349,6 +350,8 @@ struct _vbscode_t {
unsigned bstr_cnt; unsigned bstr_cnt;
heap_pool_t heap; heap_pool_t heap;
class_desc_t *last_class;
struct list entry; struct list entry;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment