[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [smokegen/smokev4] /: build the smokev4 additions
From: Arno Rehn <arno () arnorehn ! de>
Date: 2012-10-12 14:03:19
Message-ID: 20121012140319.1D15EA60EB () git ! kde ! org
[Download RAW message or body]
Git commit 3da849ae57b879171d418ef43eaf5cd5d96d1974 by Arno Rehn.
Committed on 12/10/2012 at 15:22.
Pushed by arnorehn into branch 'smokev4'.
build the smokev4 additions
M +1 -7 CMakeLists.txt
A +53 -0 smoke/CMakeLists.txt
R +7 -7 smoke/marshall.h [from: marshall.h - 085% similarity]
R +1 -1 smoke/pointermap.h [from: pointermap.h - 099% similarity]
R +4 -4 smoke/quickmarshall.h [from: quickmarshall.h - 088% similarity]
R +0 -3 smoke/smoke.h [from: smoke.h - 099% similarity]
A +3 -0 smoke/smokebase.cpp [License: UNKNOWN] *
R +7 -7 smoke/smokemanager.cpp [from: smokemanager.cpp - 098% similarity]
R +3 -2 smoke/smokemanager.h [from: smokemanager.h - 098% similarity]
R +0 -0 smoke/smokeutils.cpp [from: smokeutils.cpp - 100% similarity]
R +18 -11 smoke/smokeutils.h [from: smokeutils.h - 096% similarity]
D +0 -31 smokebase/CMakeLists.txt
D +0 -5 smokebase/smokebase.cpp
The files marked with a * at the end have a non valid license. Please read: \
http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are \
listed at that page.
http://commits.kde.org/smokegen/3da849ae57b879171d418ef43eaf5cd5d96d1974
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 40499b6..75dec51 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,11 +4,6 @@ cmake_minimum_required(VERSION 2.6)
find_package(Qt4 REQUIRED)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
-set(SMOKE_VERSION_MAJOR 3)
-set(SMOKE_VERSION_MINOR 0)
-set(SMOKE_VERSION_PATCH 0)
-set(SMOKE_VERSION ${SMOKE_VERSION_MAJOR}.${SMOKE_VERSION_MINOR}.${SMOKE_VERSION_PATCH})
-
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
@@ -53,11 +48,10 @@ if (WIN32)
set_target_properties(smokegen PROPERTIES PREFIX "" IMPORT_PREFIX "")
endif (WIN32)
install(FILES generatorenvironment.h generator_export.h generatorpreprocessor.h \
generatorvisitor.h name_compiler.h options.h type_compiler.h type.h DESTINATION \
${CMAKE_INSTALL_PREFIX}/include/smokegen)
-install( FILES smoke.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include )
install( FILES smokegen_string.h DESTINATION ${CMAKE_INSTALL_PREFIX}/share/smokegen \
RENAME string.h )
add_subdirectory(cmake)
add_subdirectory(generators)
+add_subdirectory(smoke)
# add_subdirectory(smokeapi)
-add_subdirectory(smokebase)
# add_subdirectory(deptool)
diff --git a/smoke/CMakeLists.txt b/smoke/CMakeLists.txt
new file mode 100644
index 0000000..405a0e2
--- /dev/null
+++ b/smoke/CMakeLists.txt
@@ -0,0 +1,53 @@
+IF(CMAKE_CXX_FLAGS MATCHES "-fvisibility")
+ ADD_DEFINITIONS(-DGCC_VISIBILITY)
+ENDIF(CMAKE_CXX_FLAGS MATCHES "-fvisibility")
+
+set(SMOKE_VERSION_MAJOR 3)
+set(SMOKE_VERSION_MINOR 0)
+set(SMOKE_VERSION_PATCH 0)
+set(SMOKE_VERSION ${SMOKE_VERSION_MAJOR}.${SMOKE_VERSION_MINOR}.${SMOKE_VERSION_PATCH})
+
+add_definitions(-DBASE_SMOKE_BUILDING)
+
+include_directories (${CMAKE_CURRENT_SOURCE_DIR}/..)
+
+set (SMOKEBASE_SRC smokebase.cpp
+ smokemanager.cpp
+ smokeutils.cpp)
+
+set (SMOKE_HEADERS marshall.h
+ pointermap.h
+ quickmarshall.h
+ smoke.h
+ smokemanager.h
+ smokeutils.h)
+
+add_library(smokebase SHARED ${SMOKEBASE_SRC})
+target_link_libraries(smokebase)
+set_target_properties(smokebase PROPERTIES
+ VERSION ${SMOKE_VERSION}
+ SOVERSION ${SMOKE_VERSION_MAJOR})
+
+include(MacroWriteBasicCMakeVersionFile)
+macro_write_basic_cmake_version_file(
+ ${CMAKE_CURRENT_BINARY_DIR}/SmokeVersionConfig.cmake
+ ${SMOKE_VERSION_MAJOR}
+ ${SMOKE_VERSION_MINOR}
+ ${SMOKE_VERSION_PATCH}
+)
+
+install(TARGETS smokebase
+ LIBRARY DESTINATION ${LIB_INSTALL_DIR}
+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
+ RUNTIME DESTINATION bin)
+
+if (WIN32)
+ # Realign the stack, for compatibility with an older ABI.
+ set_target_properties (smokebase PROPERTIES COMPILE_FLAGS -mstackrealign)
+
+ # Get rid of the "lib" prefix on archives/DLLs in Windows.
+ set_target_properties(smokebase PROPERTIES PREFIX "" IMPORT_PREFIX "")
+endif (WIN32)
+
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/SmokeVersionConfig.cmake DESTINATION \
${CMAKE_INSTALL_PREFIX}/share/smoke/cmake) +install(FILES ${SMOKE_HEADERS} \
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/smoke )
diff --git a/marshall.h b/smoke/marshall.h
similarity index 85%
rename from marshall.h
rename to smoke/marshall.h
index 8bfc745..d2054b2 100644
--- a/marshall.h
+++ b/smoke/marshall.h
@@ -22,11 +22,11 @@
#ifndef MARSHALL_H
#define MARSHALL_H
-#include <smoke.h>
+#include "smoke.h"
class SmokeType;
-class Marshall {
+class BASE_SMOKE_EXPORT Marshall {
public:
typedef void (*HandlerFn)(Marshall *);
@@ -39,13 +39,13 @@ public:
static HandlerFn getMarshallFn(const SmokeType& type);
/**
- * FromCrack is used for virtual function return values and regular
+ * FromBinding is used for virtual function return values and regular
* method arguments.
*
- * ToCrack is used for method return-values and virtual function
+ * ToBinding is used for method return-values and virtual function
* arguments.
*/
- enum Action { FromCrack, ToCrack };
+ enum Action { FromBinding, ToBinding };
virtual SmokeType type() = 0;
virtual Action action() = 0;
@@ -58,8 +58,8 @@ public:
virtual Smoke *smoke() = 0;
/**
* For return-values, next() does nothing.
- * For FromCrack, next() calls the method and returns.
- * For ToCrack, next() calls the virtual function and returns.
+ * For FromBinding, next() calls the method and returns.
+ * For ToBinding, next() calls the virtual function and returns.
*
* Required to reset Marshall object to the state it was
* before being called when it returns.
diff --git a/pointermap.h b/smoke/pointermap.h
similarity index 99%
rename from pointermap.h
rename to smoke/pointermap.h
index a25e807..004ba43 100644
--- a/pointermap.h
+++ b/smoke/pointermap.h
@@ -38,7 +38,7 @@ inline void *pointermap_get_smokeobject_helper(X *obj) {
}
template <class MappedType>
-class PointerMap
+class BASE_SMOKE_EXPORT PointerMap
{
public:
static PointerMap *self() {
diff --git a/quickmarshall.h b/smoke/quickmarshall.h
similarity index 88%
rename from quickmarshall.h
rename to smoke/quickmarshall.h
index f188398..8022d6d 100644
--- a/quickmarshall.h
+++ b/smoke/quickmarshall.h
@@ -20,13 +20,13 @@
#ifndef QUICKMARSHALL_H
#define QUICKMARSHALL_H
-#include <smoke.h>
#include <iostream>
+#include "smoke.h"
#include "marshall.h"
#include "smokeutils.h"
-class QuickMarshall : public Marshall {
+class BASE_SMOKE_EXPORT QuickMarshall : public Marshall {
private:
SmokeType _type;
Smoke::StackItem _input;
@@ -40,8 +40,8 @@ public:
inline SmokeType type() { return _type; }
inline Marshall::Action action() { return _action; }
- inline Smoke::StackItem &item() { return _action == FromCrack ? _output : \
_input; }
- inline Smoke::StackItem &var() { return _action == FromCrack ? _input : _output; \
} + inline Smoke::StackItem &item() { return _action == FromBinding ? _output : \
_input; } + inline Smoke::StackItem &var() { return _action == FromBinding ? \
_input : _output; } inline Smoke *smoke() { return _type.smoke(); }
inline bool smokeDeletesStackObjects() { return _smokeDeletesStackObjects; }
diff --git a/smoke.h b/smoke/smoke.h
similarity index 99%
rename from smoke.h
rename to smoke/smoke.h
index ccb91ee..b0b47c4 100644
--- a/smoke.h
+++ b/smoke/smoke.h
@@ -1,10 +1,7 @@
#ifndef SMOKE_H
#define SMOKE_H
-#include <cstddef>
#include <cstring>
-#include <string>
-#include <map>
/*
Copyright (C) 2002, Ashley Winters <qaqortog@nwlink.com>
diff --git a/smoke/smokebase.cpp b/smoke/smokebase.cpp
new file mode 100644
index 0000000..549234e
--- /dev/null
+++ b/smoke/smokebase.cpp
@@ -0,0 +1,3 @@
+#include "smoke.h"
+
+Smoke::ModuleIndex Smoke::NullModuleIndex;
diff --git a/smokemanager.cpp b/smoke/smokemanager.cpp
similarity index 98%
rename from smokemanager.cpp
rename to smoke/smokemanager.cpp
index 9af7b15..563abec 100644
--- a/smokemanager.cpp
+++ b/smoke/smokemanager.cpp
@@ -25,7 +25,7 @@
#include <sstream>
#include <vector>
-#ifndef WIN32
+#ifndef _WIN32
#include <dlfcn.h>
#else
#include <windows.h>
@@ -35,7 +35,7 @@ static const int SMOKE_VERSION = 3;
typedef std::map<std::string, Smoke*> StringSmokeMap;
-#ifndef WIN32
+#ifndef _WIN32
typedef std::vector<void*> HandleList;
#else
typedef std::vector<HMODULE> HandleList;
@@ -68,7 +68,7 @@ SmokeManager::~SmokeManager()
iter != d->libraryHandles.end();
++iter)
{
-#ifndef WIN32
+#ifndef _WIN32
dlclose(*iter);
#else
FreeLibrary(*iter);
@@ -104,14 +104,14 @@ Smoke* SmokeManager::get(const std::string& moduleName, \
SmokeManager::LoadOption Smoke* SmokeManager::load(const std::string& moduleName)
{
std::ostringstream libName;
-#ifndef WIN32
+#ifndef _WIN32
libName << "lib";
#endif
libName << "smoke" << moduleName;
#ifdef __APPLE__
libName << '.' << SMOKE_VERSION << ".dylib";
-#elif WIN32
+#elif _WIN32
libName << ".dll";
#else
libName << ".so." << SMOKE_VERSION;
@@ -119,7 +119,7 @@ Smoke* SmokeManager::load(const std::string& moduleName)
std::string libNameString = libName.str();
-#ifndef WIN32
+#ifndef _WIN32
void *smokeLib = dlopen(libNameString.c_str(), RTLD_LAZY);
#else
HMODULE smokeLib = LoadLibrary(libNameString.c_str());
@@ -140,7 +140,7 @@ Smoke* SmokeManager::load(const std::string& moduleName)
SmokeInitFn initFn;
-#ifndef WIN32
+#ifndef _WIN32
initFn = (SmokeInitFn) dlsym(smokeLib, initSymbolName.c_str());
#else
initFn = (SmokeInitFn) GetProcAddress(smokeLib, initSymbolName.c_str());
diff --git a/smokemanager.h b/smoke/smokemanager.h
similarity index 98%
rename from smokemanager.h
rename to smoke/smokemanager.h
index c1ecf87..ba483ee 100644
--- a/smokemanager.h
+++ b/smoke/smokemanager.h
@@ -19,13 +19,14 @@
#ifndef SMOKEMANAGER_H
#define SMOKEMANAGER_H
+#include "smoke.h"
+
#include <string>
#include <vector>
-#include <smoke.h>
class Smoke;
-class SmokeManager
+class BASE_SMOKE_EXPORT SmokeManager
{
public:
enum LoadOptions {
diff --git a/smokeutils.cpp b/smoke/smokeutils.cpp
similarity index 100%
rename from smokeutils.cpp
rename to smoke/smokeutils.cpp
diff --git a/smokeutils.h b/smoke/smokeutils.h
similarity index 96%
rename from smokeutils.h
rename to smoke/smokeutils.h
index 96f4617..b510ed7 100644
--- a/smokeutils.h
+++ b/smoke/smokeutils.h
@@ -32,7 +32,7 @@
#define __USE_XOPEN
#endif
-#include <smoke.h>
+#include "smoke.h"
#include <cassert>
@@ -53,9 +53,10 @@ std::size_t static_strlen(const CharType (&) [N]) {
return N - 1;
}
+BASE_SMOKE_EXPORT
void copyStackItem(Smoke::StackItem &dest, const Smoke::StackItem& src, unsigned \
short typeId);
-class SmokeType {
+class BASE_SMOKE_EXPORT SmokeType {
protected:
Smoke::Type *_t; // derived from _mi, but cached
Smoke::ModuleIndex _mi;
@@ -130,7 +131,7 @@ public:
};
-class SmokeClass {
+class BASE_SMOKE_EXPORT SmokeClass {
Smoke::Class *_c;
Smoke::ModuleIndex _mi;
public:
@@ -228,14 +229,20 @@ public:
{ iterateAncestorsImpl }
#undef iterateAncestorsImpl
+
+private:
+ // Can only be declared in parents() when using C++11, but I don't want to
+ // depend on that yet.
+ struct Collector {
+ std::vector<SmokeClass> val;
+ bool operator()(const SmokeClass& klass) {
+ val.push_back(klass);
+ return false;
+ }
+ };
+
+public:
std::vector<SmokeClass> parents() const {
- struct Collector {
- std::vector<SmokeClass> val;
- bool operator()(const SmokeClass& klass) {
- val.push_back(klass);
- return false;
- }
- };
Collector c; iterateAncestors(c, ParentsOnly);
return c.val;
}
@@ -247,7 +254,7 @@ public:
bool isExternal() const { return flags() & Smoke::cf_undefined; }
};
-class SmokeMethod {
+class BASE_SMOKE_EXPORT SmokeMethod {
Smoke::Method *_m;
Smoke::ModuleIndex _mi;
public:
diff --git a/smokebase/CMakeLists.txt b/smokebase/CMakeLists.txt
deleted file mode 100644
index f1643fd..0000000
--- a/smokebase/CMakeLists.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-IF(CMAKE_CXX_FLAGS MATCHES "-fvisibility")
- ADD_DEFINITIONS(-DGCC_VISIBILITY)
-ENDIF(CMAKE_CXX_FLAGS MATCHES "-fvisibility")
-
-include_directories (${CMAKE_CURRENT_SOURCE_DIR}/..)
-
-add_library(smokebase SHARED smokebase.cpp)
-target_link_libraries(smokebase)
-set_target_properties(smokebase PROPERTIES
- VERSION ${SMOKE_VERSION}
- SOVERSION 3)
-
-include(MacroWriteBasicCMakeVersionFile)
-macro_write_basic_cmake_version_file(
- ${CMAKE_CURRENT_BINARY_DIR}/SmokeVersionConfig.cmake
- ${SMOKE_VERSION_MAJOR}
- ${SMOKE_VERSION_MINOR}
- ${SMOKE_VERSION_PATCH}
-)
-
-install(TARGETS smokebase LIBRARY DESTINATION ${LIB_INSTALL_DIR}
- ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
- RUNTIME DESTINATION bin)
-if (WIN32)
- # Realign the stack, for compatibility with an older ABI.
- set_target_properties (smokebase PROPERTIES COMPILE_FLAGS -mstackrealign)
-
- # Get rid of the "lib" prefix on archives/DLLs in Windows.
- set_target_properties(smokebase PROPERTIES PREFIX "" IMPORT_PREFIX "")
-endif (WIN32)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/SmokeVersionConfig.cmake DESTINATION \
${CMAKE_INSTALL_PREFIX}/share/smoke/cmake)
diff --git a/smokebase/smokebase.cpp b/smokebase/smokebase.cpp
deleted file mode 100644
index f39bfec..0000000
--- a/smokebase/smokebase.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-#define BASE_SMOKE_BUILDING
-
-#include <smoke.h>
-
-Smoke::ModuleIndex Smoke::NullModuleIndex;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic