void Transform::pre_body_part(Body_part* in, Body_part_list* out) { switch(in->classid()) { case C_CODE::ID: { Body_part_list* local_out = new Body_part_list; Body_part_list::const_iterator i; pre_c_code(dynamic_cast<C_CODE*>(in), local_out); for(i = local_out->begin(); i != local_out->end(); i++) out->push_back(*i); } return; case Lookup::ID: out->push_back(pre_lookup(dynamic_cast<Lookup*>(in))); return; case PARAM_NAME::ID: out->push_back(pre_param_name(dynamic_cast<PARAM_NAME*>(in))); return; case Macro_call::ID: out->push_back(pre_macro_call(dynamic_cast<Macro_call*>(in))); return; case Callback::ID: out->push_back(pre_callback(dynamic_cast<Callback*>(in))); return; } assert(0); }
Expr* Transform::pre_expr(Expr* in) { switch(in->classid()) { case Param::ID: return pre_param(dynamic_cast<Param*>(in)); case STRING::ID: return pre_string(dynamic_cast<STRING*>(in)); case Lookup::ID: return pre_lookup(dynamic_cast<Lookup*>(in)); case Macro_call::ID: return pre_macro_call(dynamic_cast<Macro_call*>(in)); case Callback::ID: return pre_callback(dynamic_cast<Callback*>(in)); } assert(0); }
bool sendevent(wxEvent *event, ErlDrvPort port) { int send_res ; char * evClass = NULL; wxMBConvUTF32 UTFconverter; wxeEtype *Etype = etmap[event->GetEventType()]; wxeCallbackData *cb = (wxeCallbackData *)event->m_callbackUserData; WxeApp * app = (WxeApp *) wxTheApp; wxeMemEnv *memenv = app->getMemEnv(port); if(!memenv) return 0; wxeReturn rt = wxeReturn(port, cb->listener); rt.addAtom((char*)"wx"); rt.addInt((int) event->GetId()); rt.addRef(getRef((void *)(cb->obj), memenv), cb->class_name); rt.addExt2Term(cb->user_data); switch(Etype->cID) { case 163: {// wxCommandEvent wxCommandEvent * ev = (wxCommandEvent *) event; evClass = (char*)"wxCommandEvent"; rt.addAtom((char*)"wxCommand"); rt.addAtom(Etype->eName); rt.add(ev->GetString()); rt.addInt(ev->GetInt()); rt.addInt(ev->GetExtraLong()); rt.addTupleCount(5); break; } case 164: {// wxScrollEvent or wxSpinEvent if(event->IsKindOf(CLASSINFO(wxScrollEvent))) { wxScrollEvent * ev = (wxScrollEvent *) event; evClass = (char*)"wxScrollEvent"; rt.addAtom((char*)"wxScroll"); rt.addAtom(Etype->eName); rt.addInt(ev->GetInt()); rt.addInt(ev->GetExtraLong()); rt.addTupleCount(4); } else { Etype = etmap[event->GetEventType() + wxEVT_USER_FIRST]; wxSpinEvent * ev = (wxSpinEvent *) event; evClass = (char*)"wxSpinEvent"; rt.addAtom((char*)"wxSpin"); rt.addAtom(Etype->eName); rt.addInt(ev->GetInt()); rt.addTupleCount(3); } break; } case 165: {// wxScrollWinEvent evClass = (char*)"wxScrollWinEvent"; rt.addAtom((char*)"wxScrollWin"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 166: {// wxMouseEvent wxMouseEvent * ev = (wxMouseEvent *) event; evClass = (char*)"wxMouseEvent"; rt.addAtom((char*)"wxMouse"); rt.addAtom(Etype->eName); rt.addInt(ev->m_x); rt.addInt(ev->m_y); rt.addBool(ev->m_leftDown); rt.addBool(ev->m_middleDown); rt.addBool(ev->m_rightDown); rt.addBool(ev->m_controlDown); rt.addBool(ev->m_shiftDown); rt.addBool(ev->m_altDown); rt.addBool(ev->m_metaDown); rt.addInt(ev->m_wheelRotation); rt.addInt(ev->m_wheelDelta); rt.addInt(ev->m_linesPerAction); rt.addTupleCount(14); break; } case 167: {// wxSetCursorEvent evClass = (char*)"wxSetCursorEvent"; rt.addAtom((char*)"wxSetCursor"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 168: {// wxKeyEvent wxKeyEvent * ev = (wxKeyEvent *) event; evClass = (char*)"wxKeyEvent"; rt.addAtom((char*)"wxKey"); rt.addAtom(Etype->eName); rt.addInt(ev->m_x); rt.addInt(ev->m_y); rt.addInt(ev->m_keyCode); rt.addBool(ev->m_controlDown); rt.addBool(ev->m_shiftDown); rt.addBool(ev->m_altDown); rt.addBool(ev->m_metaDown); rt.addBool(ev->m_scanCode); rt.addInt(ev->m_uniChar); rt.addUint(ev->m_rawCode); rt.addUint(ev->m_rawFlags); rt.addTupleCount(13); break; } case 169: {// wxSizeEvent wxSizeEvent * ev = (wxSizeEvent *) event; evClass = (char*)"wxSizeEvent"; rt.addAtom((char*)"wxSize"); rt.addAtom(Etype->eName); rt.add(ev->m_size); rt.add(ev->m_rect); rt.addTupleCount(4); break; } case 170: {// wxMoveEvent evClass = (char*)"wxMoveEvent"; rt.addAtom((char*)"wxMove"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 171: {// wxPaintEvent evClass = (char*)"wxPaintEvent"; rt.addAtom((char*)"wxPaint"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 172: {// wxNcPaintEvent evClass = (char*)"wxNcPaintEvent"; rt.addAtom((char*)"wxNcPaint"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 173: {// wxEraseEvent wxEraseEvent * ev = (wxEraseEvent *) event; wxDC * GetDC = ev->GetDC(); evClass = (char*)"wxEraseEvent"; rt.addAtom((char*)"wxErase"); rt.addAtom(Etype->eName); rt.addRef(getRef((void *)GetDC,memenv), "wxDC"); rt.addTupleCount(3); break; } case 174: {// wxFocusEvent evClass = (char*)"wxFocusEvent"; rt.addAtom((char*)"wxFocus"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 175: {// wxChildFocusEvent evClass = (char*)"wxChildFocusEvent"; rt.addAtom((char*)"wxChildFocus"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 176: {// wxMenuEvent evClass = (char*)"wxMenuEvent"; rt.addAtom((char*)"wxMenu"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 177: {// wxCloseEvent evClass = (char*)"wxCloseEvent"; rt.addAtom((char*)"wxClose"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 178: {// wxShowEvent evClass = (char*)"wxShowEvent"; rt.addAtom((char*)"wxShow"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 179: {// wxIconizeEvent evClass = (char*)"wxIconizeEvent"; rt.addAtom((char*)"wxIconize"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 180: {// wxMaximizeEvent evClass = (char*)"wxMaximizeEvent"; rt.addAtom((char*)"wxMaximize"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 181: {// wxJoystickEvent evClass = (char*)"wxJoystickEvent"; rt.addAtom((char*)"wxJoystick"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 182: {// wxUpdateUIEvent evClass = (char*)"wxUpdateUIEvent"; rt.addAtom((char*)"wxUpdateUI"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 183: {// wxSysColourChangedEvent evClass = (char*)"wxSysColourChangedEvent"; rt.addAtom((char*)"wxSysColourChanged"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 184: {// wxMouseCaptureChangedEvent evClass = (char*)"wxMouseCaptureChangedEvent"; rt.addAtom((char*)"wxMouseCaptureChanged"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 185: {// wxDisplayChangedEvent evClass = (char*)"wxDisplayChangedEvent"; rt.addAtom((char*)"wxDisplayChanged"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 186: {// wxPaletteChangedEvent evClass = (char*)"wxPaletteChangedEvent"; rt.addAtom((char*)"wxPaletteChanged"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 187: {// wxQueryNewPaletteEvent evClass = (char*)"wxQueryNewPaletteEvent"; rt.addAtom((char*)"wxQueryNewPalette"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 188: {// wxNavigationKeyEvent wxNavigationKeyEvent * ev = (wxNavigationKeyEvent *) event; evClass = (char*)"wxNavigationKeyEvent"; rt.addAtom((char*)"wxNavigationKey"); rt.addAtom(Etype->eName); rt.addInt(ev->m_flags); rt.addRef(getRef((void *)ev->m_focus,memenv), "wxWindow"); rt.addTupleCount(4); break; } case 189: {// wxWindowCreateEvent evClass = (char*)"wxWindowCreateEvent"; rt.addAtom((char*)"wxWindowCreate"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 190: {// wxWindowDestroyEvent evClass = (char*)"wxWindowDestroyEvent"; rt.addAtom((char*)"wxWindowDestroy"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 191: {// wxHelpEvent evClass = (char*)"wxHelpEvent"; rt.addAtom((char*)"wxHelp"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 192: {// wxContextMenuEvent evClass = (char*)"wxContextMenuEvent"; rt.addAtom((char*)"wxContextMenu"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 193: {// wxIdleEvent evClass = (char*)"wxIdleEvent"; rt.addAtom((char*)"wxIdle"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 194: {// wxGridEvent wxGridEvent * ev = (wxGridEvent *) event; evClass = (char*)"wxGridEvent"; rt.addAtom((char*)"wxGrid"); rt.addAtom(Etype->eName); rt.addInt(ev->GetRow()); rt.addInt(ev->GetCol()); rt.addInt(ev->GetPosition().x); rt.addInt(ev->GetPosition().y); rt.addBool(ev->Selecting()); rt.addBool(ev->ControlDown()); rt.addBool(ev->MetaDown()); rt.addBool(ev->ShiftDown()); rt.addBool(ev->AltDown()); rt.addTupleCount(11); break; } case 196: {// wxSashEvent wxSashEvent * ev = (wxSashEvent *) event; evClass = (char*)"wxSashEvent"; rt.addAtom((char*)"wxSash"); rt.addAtom(Etype->eName); rt.addInt(ev->GetEdge()); rt.add(ev->GetDragRect()); rt.addInt(ev->GetDragStatus()); rt.addTupleCount(5); break; } case 197: {// wxListEvent wxListEvent * ev = (wxListEvent *) event; evClass = (char*)"wxListEvent"; rt.addAtom((char*)"wxList"); rt.addAtom(Etype->eName); rt.addInt(ev->GetKeyCode()); rt.addInt(ev->m_oldItemIndex); rt.addInt(ev->GetIndex()); rt.addInt(ev->m_col); rt.add(ev->GetPoint()); rt.addTupleCount(7); break; } case 198: {// wxDateEvent wxDateEvent * ev = (wxDateEvent *) event; evClass = (char*)"wxDateEvent"; rt.addAtom((char*)"wxDate"); rt.addAtom(Etype->eName); rt.add(ev->GetDate()); rt.addTupleCount(3); break; } case 199: {// wxCalendarEvent evClass = (char*)"wxCalendarEvent"; rt.addAtom((char*)"wxCalendar"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 200: {// wxFileDirPickerEvent wxFileDirPickerEvent * ev = (wxFileDirPickerEvent *) event; evClass = (char*)"wxFileDirPickerEvent"; rt.addAtom((char*)"wxFileDirPicker"); rt.addAtom(Etype->eName); rt.add(ev->GetPath()); rt.addTupleCount(3); break; } case 201: {// wxColourPickerEvent wxColourPickerEvent * ev = (wxColourPickerEvent *) event; evClass = (char*)"wxColourPickerEvent"; rt.addAtom((char*)"wxColourPicker"); rt.addAtom(Etype->eName); rt.add(ev->GetColour()); rt.addTupleCount(3); break; } case 202: {// wxFontPickerEvent wxFontPickerEvent * ev = (wxFontPickerEvent *) event; wxFont * GetFont = new wxFont(ev->GetFont()); app->newPtr((void *) GetFont,3, memenv); evClass = (char*)"wxFontPickerEvent"; rt.addAtom((char*)"wxFontPicker"); rt.addAtom(Etype->eName); rt.addRef(getRef((void *)GetFont,memenv), "wxFont"); rt.addTupleCount(3); break; } case 203: {// wxStyledTextEvent wxStyledTextEvent * ev = (wxStyledTextEvent *) event; evClass = (char*)"wxStyledTextEvent"; rt.addAtom((char*)"wxStyledText"); rt.addAtom(Etype->eName); rt.addInt(ev->GetPosition()); rt.addInt(ev->GetKey()); rt.addInt(ev->GetModifiers()); rt.addInt(ev->GetModificationType()); rt.add(ev->GetText()); rt.addInt(ev->GetLength()); rt.addInt(ev->GetLinesAdded()); rt.addInt(ev->GetLine()); rt.addInt(ev->GetFoldLevelNow()); rt.addInt(ev->GetFoldLevelPrev()); rt.addInt(ev->GetMargin()); rt.addInt(ev->GetMessage()); rt.addInt(ev->GetWParam()); rt.addInt(ev->GetLParam()); rt.addInt(ev->GetListType()); rt.addInt(ev->GetX()); rt.addInt(ev->GetY()); rt.add(ev->GetDragText()); rt.addBool(ev->GetDragAllowMove()); rt.addInt(ev->GetDragResult()); rt.addTupleCount(22); break; } case 208: {// wxTreeEvent wxTreeEvent * ev = (wxTreeEvent *) event; evClass = (char*)"wxTreeEvent"; rt.addAtom((char*)"wxTree"); rt.addAtom(Etype->eName); rt.addRef(getRef((void *)ev->GetItem().m_pItem,memenv), "wxTreeItemId"); rt.addRef(getRef((void *)ev->GetOldItem().m_pItem,memenv), "wxTreeItemId"); rt.add(ev->GetPoint()); rt.addTupleCount(5); break; } case 209: {// wxNotebookEvent evClass = (char*)"wxNotebookEvent"; rt.addAtom((char*)"wxNotebook"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 215: {// wxSpinEvent wxSpinEvent * ev = (wxSpinEvent *) event; evClass = (char*)"wxSpinEvent"; rt.addAtom((char*)"wxSpin"); rt.addAtom(Etype->eName); rt.addInt(ev->GetInt()); rt.addTupleCount(3); break; } case 217: {// wxSplitterEvent evClass = (char*)"wxSplitterEvent"; rt.addAtom((char*)"wxSplitter"); rt.addAtom(Etype->eName); rt.addTupleCount(2); break; } case 219: {// wxHtmlLinkEvent wxHtmlLinkEvent * ev = (wxHtmlLinkEvent *) event; evClass = (char*)"wxHtmlLinkEvent"; rt.addAtom((char*)"wxHtmlLink"); rt.addAtom(Etype->eName); rt.add(ev->GetLinkInfo()); rt.addTupleCount(3); break; } case 220: {// wxAuiNotebookEvent wxAuiNotebookEvent * ev = (wxAuiNotebookEvent *) event; wxAuiNotebook * GetDragSource = ev->GetDragSource(); evClass = (char*)"wxAuiNotebookEvent"; rt.addAtom((char*)"wxAuiNotebook"); rt.addAtom(Etype->eName); rt.addInt(ev->GetOldSelection()); rt.addInt(ev->GetSelection()); rt.addRef(getRef((void *)GetDragSource,memenv), "wxAuiNotebook"); rt.addTupleCount(5); break; } case 221: {// wxAuiManagerEvent wxAuiManagerEvent * ev = (wxAuiManagerEvent *) event; wxAuiManager * GetManager = ev->GetManager(); wxAuiPaneInfo * GetPane = ev->GetPane(); wxDC * GetDC = ev->GetDC(); evClass = (char*)"wxAuiManagerEvent"; rt.addAtom((char*)"wxAuiManager"); rt.addAtom(Etype->eName); rt.addRef(getRef((void *)GetManager,memenv), "wxAuiManager"); rt.addRef(getRef((void *)GetPane,memenv), "wxAuiPaneInfo"); rt.addInt(ev->GetButton()); rt.addBool(ev->veto_flag); rt.addBool(ev->canveto_flag); rt.addRef(getRef((void *)GetDC,memenv), "wxDC"); rt.addTupleCount(8); break; } } rt.addTupleCount(5); if(cb->fun_id) { rt.addRef(getRef((void *)event,memenv), evClass); rt.addTupleCount(2); rt.addInt(cb->fun_id); rt.addAtom("_wx_invoke_cb_"); rt.addTupleCount(3); pre_callback(); send_res = rt.send(); if(send_res) handle_event_callback(port, cb->listener); app->clearPtr((void *) event); } else { send_res = rt.send(); if(cb->skip) event->Skip(); }; return send_res; }