Cedet Wx Widgets
|
CEDET wxWidgets 자동완성
emacs에서 CEDET(semantic)로 wxWidgets 라이브러리 자동완성하는 방법은 아래 사이트에 나와있지만
http://www.emacswiki.org/emacs/SemanticLibraryParsing#toc2 "/usr/include/wx-2.8/wx" 하위 디렉토리에 있는 클래스,
예를 들어 wxStaticTextBase처럼 뒤에 Base가 붙은 클래스는 자동완성이 안됩니다. 그래서 이리 저리 실험해본 결과를 남겨둡니다.
(이전 wxWidgets 관련 emacs 설정 및 이전 캐시(semanticdb.cache 폴더) 삭제하세요!!!) 일단 wxWidgets 헤더 파일들의 "#if wxUSE_XXXXX ... #endif" 부분을 무력화 시키기 위해 아래 명령어로 파일을 하나 만든 다음
$ find /usr/include/wx-2.8/wx -type f -print0 | xargs -0 -e grep -nH -e wxUSE > wxUSE.orig적당히 가공해서 $ cat wxUSE.orig | sed -e 's/.*\(wxUSE_[[:alpha:]]\+\).*/#define \1/' | grep -e '^#define' | sort -u > wxUSE.h아래 파일을 만듭니다. (귀찮으신 분은 아래 copy&paste해서 만드세요.) wxUSE.h #define wxUSE_ABI #define wxUSE_ABOUTDLG #define wxUSE_ACCEL #define wxUSE_ACCESSIBILITY #define wxUSE_ANIMATIONCTRL #define wxUSE_APPLE #define wxUSE_ARCHIVE #define wxUSE_ARRAY #define wxUSE_AUI #define wxUSE_BASE #define wxUSE_BITMAP #define wxUSE_BITMAPCOMBOBOX #define wxUSE_BMPBUTTON #define wxUSE_BOOKCTRL #define wxUSE_BORDER #define wxUSE_BUILTIN #define wxUSE_BUSYINFO #define wxUSE_BUTTON #define wxUSE_CALENDARCTRL #define wxUSE_CARET #define wxUSE_CHECKBOX #define wxUSE_CHECKLISTBOX #define wxUSE_CHOICE #define wxUSE_CHOICEBOOK #define wxUSE_CHOICEDLG #define wxUSE_CLIPBOARD #define wxUSE_CMDLINE #define wxUSE_COLLPANE #define wxUSE_COLOURDLG #define wxUSE_COLOURPICKERCTRL #define wxUSE_COMBOBOX #define wxUSE_COMBOCTRL #define wxUSE_CONFIG #define wxUSE_CONSTRAINTS #define wxUSE_CONTROLS #define wxUSE_CRASHREPORT #define wxUSE_DATAOBJ #define wxUSE_DATAVIEWCTRL #define wxUSE_DATEPICKCTRL #define wxUSE_DATETIME #define wxUSE_DDE #define wxUSE_DEBUG #define wxUSE_DEPRECATED #define wxUSE_DIALUP #define wxUSE_DIRDLG #define wxUSE_DIRPICKERCTRL #define wxUSE_DISPLAY #define wxUSE_DOC #define wxUSE_DRAG #define wxUSE_DRAGIMAGE #define wxUSE_DYNAMIC #define wxUSE_DYNLIB #define wxUSE_ENH #define wxUSE_EXCEPTIONS #define wxUSE_EXTENDED #define wxUSE_FFILE #define wxUSE_FILE #define wxUSE_FILECONFIG #define wxUSE_FILEDLG #define wxUSE_FILEPICKERCTRL #define wxUSE_FILESYSTEM #define wxUSE_FINDREPLDLG #define wxUSE_FONTDLG #define wxUSE_FONTMAP #define wxUSE_FONTPICKERCTRL #define wxUSE_FS #define wxUSE_FSVOLUME #define wxUSE_FUNC #define wxUSE_GAUGE #define wxUSE_GENERIC #define wxUSE_GENERICDATAVIEWCTRL #define wxUSE_GEOMETRY #define wxUSE_GIF #define wxUSE_GLCANVAS #define wxUSE_GLOBAL #define wxUSE_GRAPHICS #define wxUSE_GRID #define wxUSE_GUI #define wxUSE_HELP #define wxUSE_HOTKEY #define wxUSE_HTML #define wxUSE_HYPERLINKCTRL #define wxUSE_ICO #define wxUSE_IDLEMENUUPDATES #define wxUSE_IFF #define wxUSE_IMAGE #define wxUSE_IMAGLIST #define wxUSE_INTL #define wxUSE_IOSTREAMH #define wxUSE_IPC #define wxUSE_IPV #define wxUSE_JOYSTICK #define wxUSE_LIBGNOMEPRINT #define wxUSE_LIBGNOMEVFS #define wxUSE_LIBJPEG #define wxUSE_LIBMSPACK #define wxUSE_LIBPNG #define wxUSE_LIBTIFF #define wxUSE_LISTBOOK #define wxUSE_LISTBOX #define wxUSE_LISTCTRL #define wxUSE_LOG #define wxUSE_LOGGUI #define wxUSE_LOGWINDOW #define wxUSE_LONGLONG #define wxUSE_MDI #define wxUSE_MEDIACTRL #define wxUSE_MEMBER #define wxUSE_MEMORY #define wxUSE_MENUS #define wxUSE_METAFILE #define wxUSE_MFC #define wxUSE_MIMETYPE #define wxUSE_MINIFRAME #define wxUSE_MOUSEWHEEL #define wxUSE_MS #define wxUSE_MSGDLG #define wxUSE_NATIVE #define wxUSE_NESTED #define wxUSE_NO #define wxUSE_NORLANDER #define wxUSE_NOTEBOOK #define wxUSE_NUMBERDLG #define wxUSE_ODBC #define wxUSE_ODCOMBOBOX #define wxUSE_OLD #define wxUSE_OLE #define wxUSE_ON #define wxUSE_OWNER #define wxUSE_PALETTE #define wxUSE_PANGO #define wxUSE_PCX #define wxUSE_PLUGINS #define wxUSE_PNM #define wxUSE_POPUPWIN #define wxUSE_POSTSCRIPT #define wxUSE_PRINTF #define wxUSE_PRINTING #define wxUSE_PROGRESSDLG #define wxUSE_PROLOGIO #define wxUSE_PROTOCOL #define wxUSE_QUERY #define wxUSE_RADIOBOX #define wxUSE_RADIOBTN #define wxUSE_REGEX #define wxUSE_RESOURCES #define wxUSE_RICHTEXT #define wxUSE_SASH #define wxUSE_SCROLLBAR #define wxUSE_SEARCHCTRL #define wxUSE_SLIDER #define wxUSE_SNGLINST #define wxUSE_SOCKETS #define wxUSE_SOUND #define wxUSE_SPINBTN #define wxUSE_SPINCTRL #define wxUSE_SPLASH #define wxUSE_SPLINES #define wxUSE_SPLITTER #define wxUSE_STACKWALKER #define wxUSE_STARTUP #define wxUSE_STATBMP #define wxUSE_STATBOX #define wxUSE_STATLINE #define wxUSE_STATTEXT #define wxUSE_STATUSBAR #define wxUSE_STD #define wxUSE_STDPATHS #define wxUSE_STL #define wxUSE_STOPWATCH #define wxUSE_STREAM #define wxUSE_STREAMS #define wxUSE_SYSTEM #define wxUSE_TAB #define wxUSE_TARSTREAM #define wxUSE_TEXTBUFFER #define wxUSE_TEXTCTRL #define wxUSE_TEXTDLG #define wxUSE_TEXTFILE #define wxUSE_TGA #define wxUSE_THREADS #define wxUSE_TIMER #define wxUSE_TIPWINDOW #define wxUSE_TOGGLEBTN #define wxUSE_TOOLBAR #define wxUSE_TOOLBOOK #define wxUSE_TOOLTIPS #define wxUSE_TREEBOOK #define wxUSE_TREECTRL #define wxUSE_UNICODE #define wxUSE_URL #define wxUSE_VALIDATORS #define wxUSE_VARIANT #define wxUSE_WCHAR #define wxUSE_WEBKIT #define wxUSE_WIN #define wxUSE_WIZARDDLG #define wxUSE_WX #define wxUSE_WXDIB #define wxUSE_WXHTML #define wxUSE_WXVSNPRINTF #define wxUSE_XML #define wxUSE_XPM #define wxUSE_XRC #define wxUSE_XXX #define wxUSE_ZIPSTREAM #define wxUSE_ZLIB그런 다음 아래처럼 설정해 줍니다. .emacs 파일
(add-to-list 'semantic-lex-c-preprocessor-symbol-map '("WXDLLIMPEXP_CORE" . ""))
(add-to-list 'semantic-lex-c-preprocessor-symbol-map '("WXDLLIMPEXP_FWD_CORE" . ""))
(add-to-list 'semantic-lex-c-preprocessor-symbol-map '("WXDLLIMPEXP_BASE" . ""))
(add-to-list 'semantic-lex-c-preprocessor-symbol-map '("WXDLLIMPEXP_FWD_BASE" . ""))
(add-to-list 'semantic-lex-c-preprocessor-symbol-map '("WXDLLIMPEXP_FWD_XML" . ""))
(add-to-list 'semantic-lex-c-preprocessor-symbol-map '("WXDLLIMPEXP_ADV" . ""))
(require 'hideif)
(setq hif-ifx-regexp (concat hif-cpp-prefix "\\(el\\)?if\\(n?def\\)?[ \t]+"))
(add-to-list 'semantic-lex-c-preprocessor-symbol-file "~/설치/경로/wxUSE.h")
(add-to-list 'semantic-lex-c-preprocessor-symbol-map '("__WXGTK20__" . "__cplusplus"))
(semantic-add-system-include "/usr/include/wx-2.8" 'c++-mode)
참고적으로 hif-ifx-regexp 변수를 고친 것은 "#elif defined( ... )"를 제대로 파싱하기 위한 것이고
(add-to-list 'semantic-lex-c-preprocessor-symbol-map '("__WXGTK20__" . "__cplusplus"))
이 부분이 필요한 이유는, 예를 들어"/usr/include/wx-2.8/wx/stattext.h"를 보면
#if defined(__WXUNIVERSAL__)
#include "wx/univ/stattext.h"
#elif defined(__WXMSW__)
#include "wx/msw/stattext.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/stattext.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/stattext.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/stattext.h"
#elif defined(__WXMAC__)
#include "wx/mac/stattext.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/stattext.h"
#elif defined(__WXPM__)
#include "wx/os2/stattext.h"
#elif defined(__WXPALMOS__)
#include "wx/palmos/stattext.h"
#endif
이런 부분이 있는데 "#elif defined(__WXGTK20__)" 부분을 true로 만들어 주기 위한 것입니다.MS윈도우에서 라면 아래 처럼 변경해야 할듯...(테스트 필요)
(add-to-list 'semantic-lex-c-preprocessor-symbol-map '("__WXMSW__" . "__cplusplus"))
마지막으로 테스트해 봅니다.wxStaticTextBase.cc
#include <wx/wx.h>
int main(int argc, char *argv[])
{
wxStaticTextBase b;
b.Get
return 0;
}
wxStaticTextBase.png
![]() [PNG image (58.04 KB)]
#include <wx/wx.h>
int main(int argc, char *argv[])
{
wxStaticText w;
w.Get
return 0;
}
wxStaticText.png
![]() [PNG image (62.18 KB)] primewizard - 20101125
|












