// Perform a function call private FuncFrame func_call(WFunction func) { ASSERT_ERR(this.state.func_depth > MAX_RECURSION, CoreErrorType.MAX_RECURSION, "Maxmimum recursion depth achieved!"); this.state.func_depth++; // Set the size of the locals to the args count & locals count this.locals = new WItem[func.args_size + func.locals_size]; // Then define the function arguments passed in that were on the exec stack for (int i = 0; i < func.args_size; i++) { this.locals[i] = exec_stack.pop(); } // First create a new FuncFrame to push to the function stack FuncFrame frame = new FuncFrame(this, func.name, this.pc, this.locals, this.exec_stack, this.bytecode); // Then push the frame to the FuncStack this.func_stack.push(frame); // Check if the function is native if (func.is_native) { // Natively call the func push_exec(this.native_interface.call_native_func(VM.state.current_file, func.name, this.locals)); // Becuase native functions can't implement Opcode.RETURN, we need to manually return & advance func_return(); goto_next(); } else { this.pc = 0; this.exec_stack = new ExecStack(this); this.bytecode = func.bytecode; this.state.opcode_count = this.bytecode.Length; } return(frame); }
public void NavigationItemClick(object sender, ItemClickEventArgs e) { Model.NavigationListItem item = e.ClickedItem as Model.NavigationListItem; if (item != null && item.PageType != null) { MainTitle = item.Title; FuncFrame.Navigate(item.PageType); } else { GalaSoft.MvvmLight.Messaging.Messenger.Default.Send("这只是个饼,而且还没画完O(∩_∩)O", messageToken); } }
public void SelectionChanged(object sender, SelectionChangedEventArgs e) { if (SelectedIndex < 0) { return; } NavigationListItem item = NavigationList[SelectedIndex]; if (item != null && item.PageType != null) { ClearDetailFrame(); FuncFrame.Navigate(item.PageType); } }
private void func_return() { this.state.func_depth--; // First get the return value, by poping it from the exec stack WItem return_value = this.exec_stack.pop(); // Then restore the state of the core FuncFrame previous_frame = this.func_stack.pop(); this.pc = previous_frame.pc; this.locals = previous_frame.locals; this.exec_stack = previous_frame.exec_stack; this.bytecode = previous_frame.bytecode; this.state.opcode_count = this.bytecode.Length; // Then push the returned value to the exec stack this.exec_stack.push(return_value); }
private void btnAbout_Click(object sender, RoutedEventArgs e) { NavigationVM.MainTitle = "关于"; FuncFrame.Navigate(typeof(AboutView)); }
public Trace(FuncFrame frame) { this.frame = frame; }
public void SettingClicked() { ClearDetailFrame(); FuncFrame.Navigate(typeof(Views.SettingView)); }