Skip to content
Browse files

Internals subdir.

  • Loading branch information...
1 parent fde2214 commit 23ee17178bae9d18340b3033fb5a159e4958ee14 @quarnster committed Feb 1, 2013
Showing with 59 additions and 60 deletions.
  1. +2 −2 .gitmodules
  2. +3 −2 errormarkers.py
  3. +2 −0 internals/__init__.py
  4. 0 { → internals}/clang/__init__.py
  5. +1 −4 { → internals}/clang/cindex.py
  6. 0 { → internals}/clang/include/altivec.h
  7. 0 { → internals}/clang/include/arm_neon.h
  8. 0 { → internals}/clang/include/avxintrin.h
  9. 0 { → internals}/clang/include/emmintrin.h
  10. 0 { → internals}/clang/include/float.h
  11. 0 { → internals}/clang/include/immintrin.h
  12. 0 { → internals}/clang/include/iso646.h
  13. 0 { → internals}/clang/include/limits.h
  14. 0 { → internals}/clang/include/mm3dnow.h
  15. 0 { → internals}/clang/include/mm_malloc.h
  16. 0 { → internals}/clang/include/mmintrin.h
  17. 0 { → internals}/clang/include/nmmintrin.h
  18. 0 { → internals}/clang/include/pmmintrin.h
  19. 0 { → internals}/clang/include/smmintrin.h
  20. 0 { → internals}/clang/include/stdalign.h
  21. 0 { → internals}/clang/include/stdarg.h
  22. 0 { → internals}/clang/include/stdbool.h
  23. 0 { → internals}/clang/include/stddef.h
  24. 0 { → internals}/clang/include/stdint.h
  25. 0 { → internals}/clang/include/tgmath.h
  26. 0 { → internals}/clang/include/tmmintrin.h
  27. 0 { → internals}/clang/include/varargs.h
  28. 0 { → internals}/clang/include/wmmintrin.h
  29. 0 { → internals}/clang/include/x86intrin.h
  30. 0 { → internals}/clang/include/xmmintrin.h
  31. +13 −5 { → internals}/common.py
  32. 0 { → internals}/parsehelp
  33. +6 −14 { → internals}/translationunitcache.py
  34. +13 −14 src/CMakeLists.txt
  35. +2 −2 staticanalyzer.py
  36. +15 −15 sublimeclang.py
  37. BIN unittests/gold.txt.gz
  38. +2 −2 unittests/unittest.py
View
4 .gitmodules
@@ -1,3 +1,3 @@
-[submodule "parsehelp"]
- path = parsehelp
+[submodule "internals/parsehelp"]
+ path = internals/parsehelp
url = git://github.com/quarnster/parsehelp.git
View
5 errormarkers.py
@@ -2,9 +2,10 @@
import sublime_plugin
from collections import defaultdict
try:
- from common import get_setting, sdecode
+ from .internals.common import get_setting, sdecode
except:
- from SublimeClang.common import get_setting, sdecode
+ from internals.common import get_setting, sdecode
+
ERRORS = {}
WARNINGS = {}
View
2 internals/__init__.py
@@ -0,0 +1,2 @@
+__all__ = ['parsehelp', 'common', 'translationunitcache', 'clang']
+
View
0 clang/__init__.py → internals/clang/__init__.py
File renamed without changes.
View
5 clang/cindex.py → internals/clang/cindex.py
@@ -63,10 +63,7 @@
# o implement additional SourceLocation, SourceRange, and File methods.
from ctypes import *
-try:
- from common import error_message, bencode, bdecode
-except:
- from SublimeClang.common import error_message, bencode, bdecode
+from ..common import error_message, bencode, bdecode
import platform
import sys
View
0 clang/include/altivec.h → internals/clang/include/altivec.h
File renamed without changes.
View
0 clang/include/arm_neon.h → internals/clang/include/arm_neon.h
File renamed without changes.
View
0 clang/include/avxintrin.h → internals/clang/include/avxintrin.h
File renamed without changes.
View
0 clang/include/emmintrin.h → internals/clang/include/emmintrin.h
File renamed without changes.
View
0 clang/include/float.h → internals/clang/include/float.h
File renamed without changes.
View
0 clang/include/immintrin.h → internals/clang/include/immintrin.h
File renamed without changes.
View
0 clang/include/iso646.h → internals/clang/include/iso646.h
File renamed without changes.
View
0 clang/include/limits.h → internals/clang/include/limits.h
File renamed without changes.
View
0 clang/include/mm3dnow.h → internals/clang/include/mm3dnow.h
File renamed without changes.
View
0 clang/include/mm_malloc.h → internals/clang/include/mm_malloc.h
File renamed without changes.
View
0 clang/include/mmintrin.h → internals/clang/include/mmintrin.h
File renamed without changes.
View
0 clang/include/nmmintrin.h → internals/clang/include/nmmintrin.h
File renamed without changes.
View
0 clang/include/pmmintrin.h → internals/clang/include/pmmintrin.h
File renamed without changes.
View
0 clang/include/smmintrin.h → internals/clang/include/smmintrin.h
File renamed without changes.
View
0 clang/include/stdalign.h → internals/clang/include/stdalign.h
File renamed without changes.
View
0 clang/include/stdarg.h → internals/clang/include/stdarg.h
File renamed without changes.
View
0 clang/include/stdbool.h → internals/clang/include/stdbool.h
File renamed without changes.
View
0 clang/include/stddef.h → internals/clang/include/stddef.h
File renamed without changes.
View
0 clang/include/stdint.h → internals/clang/include/stdint.h
File renamed without changes.
View
0 clang/include/tgmath.h → internals/clang/include/tgmath.h
File renamed without changes.
View
0 clang/include/tmmintrin.h → internals/clang/include/tmmintrin.h
File renamed without changes.
View
0 clang/include/varargs.h → internals/clang/include/varargs.h
File renamed without changes.
View
0 clang/include/wmmintrin.h → internals/clang/include/wmmintrin.h
File renamed without changes.
View
0 clang/include/x86intrin.h → internals/clang/include/x86intrin.h
File renamed without changes.
View
0 clang/include/xmmintrin.h → internals/clang/include/xmmintrin.h
File renamed without changes.
View
18 common.py → internals/common.py
@@ -55,16 +55,24 @@ def bencode(s):
def bdecode(s):
return s.decode("utf-8")
+loaded = False
+loaded_callbacks = []
+def plugin_loaded():
+ global loaded
+ global loaded_callbacks
+ loaded = True
+ for c in loaded_callbacks:
+ c()
+ loaded_callbacks = []
try:
import sublime
def are_we_there_yet(x):
- w = sublime.active_window()
- if not w or not w.active_view():
- sublime.set_timeout(lambda: are_we_there_yet(x), 500)
- else:
+ global loaded_callbacks
+ if loaded:
x()
-
+ else:
+ loaded_callbacks.append(x)
def run_in_main_thread(func):
sublime.set_timeout(func, 0)
View
0 parsehelp → internals/parsehelp
File renamed without changes.
View
20 translationunitcache.py → internals/translationunitcache.py
@@ -24,19 +24,11 @@
import os
import sys
-try:
- from common import Worker, complete_path, expand_path, get_setting, get_path_setting,\
- get_language, LockedVariable, run_in_main_thread, error_message,\
- display_user_selection, get_cpu_count, status_message, bencode, bdecode, are_we_there_yet
- from clang import cindex
- from parsehelp.parsehelp import *
-except:
- from SublimeClang.common import Worker, complete_path, expand_path, get_setting, get_path_setting,\
- get_language, LockedVariable, run_in_main_thread, error_message,\
- display_user_selection, get_cpu_count, status_message, bencode, bdecode, are_we_there_yet
- from SublimeClang.clang import cindex
- from SublimeClang.parsehelp import parsehelp
- from parsehelp import *
+from .common import Worker, complete_path, expand_path, get_setting, get_path_setting,\
+ get_language, LockedVariable, run_in_main_thread, error_message,\
+ display_user_selection, get_cpu_count, status_message, bencode, bdecode, are_we_there_yet
+from .clang import cindex
+from .parsehelp.parsehelp import *
try:
import Queue
@@ -121,7 +113,7 @@ def __del__(self):
import json
_getVersion = cachelib.getVersion
_getVersion.restype = c_char_p
- f = open("%s/package.json" % scriptpath)
+ f = open("%s/../package.json" % scriptpath)
data = json.load(f)
f.close()
json = data["packages"][0]["platforms"]["*"][0]["version"]
View
27 src/CMakeLists.txt
@@ -78,8 +78,8 @@ if(NOT DEFINED WIN_RELEASE)
set(SUBLIMECLANG_VERSION ${CMAKE_MATCH_2})
add_definitions(-DSUBLIMECLANG_VERSION="${CMAKE_MATCH_2}" ${CX11FLAGS})
set(TARGETLIB ${LIBPREFIX}cache${LIBSUFFIX})
- set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/..)
- link_directories(${PROJECT_SOURCE_DIR}/.. /usr/local/lib /usr/lib /usr/lib64/llvm)
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../internals)
+ link_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY} /usr/local/lib /usr/lib /usr/lib64/llvm)
add_library(${TARGETLIB} SHARED main.cpp )
target_link_libraries(
${TARGETLIB}
@@ -196,7 +196,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
POST_BUILD
COMMAND install_name_tool -change "${PROJECT_BINARY_DIR}/llvm/build/lib/${LIBCLANG_NAME}" libclang.dylib $<TARGET_FILE:cache>
COMMAND install_name_tool -change "/tmp/llvm-3.1.src/build/lib/liblibclang.3.1.dylib" libclang.dylib $<TARGET_FILE:cache>
- WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/../../)
+ WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/../../internals/)
add_custom_command(OUTPUT release
COMMAND mkdir release
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
@@ -208,8 +208,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
)
add_custom_target(prepare
COMMAND find ../../.. -maxdepth 1 -type f -iregex \".*/[^.].*\" -exec cp {} . "\;"
- COMMAND cp -r ../../../parsehelp parsehelp
- COMMAND cp -r ../../../clang clang
+ COMMAND cp -r ../../../internals internals
COMMAND mkdir src
COMMAND find ../../../src -maxdepth 1 -type f -exec cp {} src "\;"
COMMAND find ../../../src -maxdepth 1 -type d -not -regex \".*/build.*\" -not -regex \".*/src\" -exec cp -r {} src "\;"
@@ -220,8 +219,8 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
COMMAND find . -name \"*,cover\" -exec rm -rf {} +
COMMAND find . -name \".coverage\" -exec rm -rf {} +
DEPENDS ${TARGETLIB} ${PROJECT_BINARY_DIR}/release clean_release
- DEPENDS ${PROJECT_SOURCE_DIR}/../libclang.dll ${PROJECT_SOURCE_DIR}/../libcache.dll
- DEPENDS ${PROJECT_SOURCE_DIR}/../libclang_x64.dll ${PROJECT_SOURCE_DIR}/../libcache_x64.dll
+ DEPENDS ${PROJECT_SOURCE_DIR}/../internals/libclang.dll ${PROJECT_SOURCE_DIR}/../internals/libcache.dll
+ DEPENDS ${PROJECT_SOURCE_DIR}/../internals/libclang_x64.dll ${PROJECT_SOURCE_DIR}/../internals/libcache_x64.dll
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/release
)
@@ -240,7 +239,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
COMMAND strings libcache.dll | python -c "${VERSION_SCRIPT}"
COMMAND strings libcache.dylib | python -c "${VERSION_SCRIPT}"
DEPENDS prepare
- WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/release
+ WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/release/internals
)
add_custom_target(sublime-package
@@ -301,8 +300,8 @@ if(DEFINED WIN_RELEASE)
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/source
COMMAND ${CMAKE_COMMAND} -E make_directory source
COMMAND ${CMAKE_COMMAND} -E chdir source ${CMAKE_COMMAND} -E tar xf ${PROJECT_BINARY_DIR}/${CMAKE_MATCH_2}
- COMMAND ${CMAKE_COMMAND} -E copy_if_different source/libclang.dll ${PROJECT_SOURCE_DIR}/../libclang.dll
- COMMAND ${CMAKE_COMMAND} -E copy_if_different source/libclang_x64.dll ${PROJECT_SOURCE_DIR}/../libclang_x64.dll
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different source/libclang.dll ${PROJECT_SOURCE_DIR}/../internals/libclang.dll
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different source/libclang_x64.dll ${PROJECT_SOURCE_DIR}/../internals/libclang_x64.dll
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
macro(win_build DIR TARGET LIB)
@@ -313,8 +312,8 @@ if(DEFINED WIN_RELEASE)
set(CLANGLIB libclang_x64.dll)
set(PYTHON c:\\Python27_x64\\python)
endif()
- add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/../${CLANGLIB}
- COMMAND ${CMAKE_COMMAND} -E copy_if_different source/${CLANGLIB} ${PROJECT_SOURCE_DIR}/../${CLANGLIB}
+ add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/../internals/${CLANGLIB}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different source/${CLANGLIB} ${PROJECT_SOURCE_DIR}/../internals/${CLANGLIB}
DEPENDS ${PROJECT_BINARY_DIR}/source
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
@@ -337,10 +336,10 @@ if(DEFINED WIN_RELEASE)
)
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/${DIR}/CMakeCache.txt
COMMAND cmds.bat
- DEPENDS ${PROJECT_BINARY_DIR}/${DIR}/cmds.bat ${PROJECT_BINARY_DIR}/../${CLANGLIB}
+ DEPENDS ${PROJECT_BINARY_DIR}/${DIR}/cmds.bat ${PROJECT_BINARY_DIR}/../internals/${CLANGLIB}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${DIR}
)
- add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/../${LIB}
+ add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/../internals/${LIB}
COMMAND build.bat
DEPENDS ${PROJECT_BINARY_DIR}/${DIR}/CMakeCache.txt ${PROJECT_BINARY_DIR}/${DIR}/build.bat
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${DIR}
View
4 staticanalyzer.py
@@ -30,10 +30,10 @@
import traceback
try:
import Queue
- from common import get_setting, get_cpu_count, Worker
+ from internals.common import get_setting, get_cpu_count, Worker
except:
import queue as Queue
- from SublimeClang.common import get_setting, get_cpu_count, Worker
+ from .internals.common import get_setting, get_cpu_count, Worker
def parse(l):
View
30 sublimeclang.py
@@ -33,26 +33,26 @@
import sys
try:
- from clang import cindex
+ import Queue
+ from internals.clang import cindex
from errormarkers import clear_error_marks, add_error_mark, show_error_marks, \
update_statusbar, erase_error_marks, clang_error_panel
- from common import get_setting, get_settings, is_supported_language, \
- get_language, get_cpu_count, run_in_main_thread, \
- status_message, sencode, are_we_there_yet
- import translationunitcache
- import parsehelp
- import Queue
+ from internals.common import get_setting, get_settings, is_supported_language, \
+ get_language,get_cpu_count, run_in_main_thread, \
+ status_message, sencode, are_we_there_yet, plugin_loaded
+ from internals import translationunitcache
+ from internals.parsehelp import parsehelp
+ plugin_loaded()
except:
- from SublimeClang.clang import cindex
- from SublimeClang.errormarkers import clear_error_marks, add_error_mark, show_error_marks, \
+ import queue as Queue
+ from .internals.clang import cindex
+ from .errormarkers import clear_error_marks, add_error_mark, show_error_marks, \
update_statusbar, erase_error_marks, clang_error_panel
- from SublimeClang.common import get_setting, get_settings, is_supported_language, \
+ from .internals.common import get_setting, get_settings, is_supported_language, \
get_language,get_cpu_count, run_in_main_thread, \
- status_message, sencode, are_we_there_yet
- import SublimeClang.translationunitcache as translationunitcache
- import SublimeClang.parsehelp as parsehelp
- import queue as Queue
-
+ status_message, sencode, are_we_there_yet, plugin_loaded
+ from .internals import translationunitcache
+ from .internals.parsehelp import parsehelp
import sublime_plugin
from sublime import Region
View
BIN unittests/gold.txt.gz
Binary file not shown.
View
4 unittests/unittest.py
@@ -1,6 +1,6 @@
import sys
sys.path.append(".")
-import translationunitcache
+from internals import translationunitcache
import os
import os.path
import pickle
@@ -14,7 +14,7 @@
import queue as Queue
import time
import imp
-parsehelp = imp.load_source("parsehelp", os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../"), "parsehelp/parsehelp.py"))
+from internals.parsehelp import parsehelp
import datetime
import json

0 comments on commit 23ee171

Please sign in to comment.
Something went wrong with that request. Please try again.