Compare commits

..

No commits in common. "develop" and "develop-7" have entirely different histories.

3100 changed files with 257361 additions and 1874403 deletions

View File

@ -21,8 +21,6 @@ elseif(APPLE)
# include(${CMAKE_CURRENT_LIST_DIR}/ios-m1-simulator/CMakeLists.txt) # Uncomment this line and comment next line if using M1 simulator # include(${CMAKE_CURRENT_LIST_DIR}/ios-m1-simulator/CMakeLists.txt) # Uncomment this line and comment next line if using M1 simulator
include(${CMAKE_CURRENT_LIST_DIR}/ios/CMakeLists.txt) include(${CMAKE_CURRENT_LIST_DIR}/ios/CMakeLists.txt)
endif() endif()
elseif(OPENHARMONY)
include(${CMAKE_CURRENT_LIST_DIR}/openharmony/CMakeLists.txt)
elseif(OHOS) elseif(OHOS)
include(${CMAKE_CURRENT_LIST_DIR}/ohos/CMakeLists.txt) include(${CMAKE_CURRENT_LIST_DIR}/ohos/CMakeLists.txt)
elseif(EMSCRIPTEN) elseif(EMSCRIPTEN)

View File

@ -63,6 +63,35 @@ target_include_directories(android_platform PUBLIC
# android log dl # android log dl
# ) # )
if(USE_XR)
include(${CMAKE_CURRENT_LIST_DIR}/xr.cmake)
if(BUILD_XR_NATIVE)
list(APPEND XR_EXTERNAL_SOURCES ${CMAKE_CURRENT_LIST_DIR}/../../cocos/xr/Xr.h)
list(APPEND XR_EXTERNAL_SOURCES ${CMAKE_CURRENT_LIST_DIR}/../../cocos/platform/interfaces/modules/XRCommon.h)
list(APPEND XR_EXTERNAL_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/../../cocos/xr)
list(APPEND XR_EXTERNAL_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/../../cocos/platform/interfaces/modules)
include(${CMAKE_CURRENT_LIST_DIR}/../../../../CCOpenXR/internal/CMakeLists.txt)
else()
add_library(xr STATIC IMPORTED GLOBAL)
set_target_properties(xr PROPERTIES
IMPORTED_LOCATION ${platform_spec_path}/xr/${XR_FOLDER}/libxr.a
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/../../cocos/xr
)
set_property(TARGET xr APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/../../cocos/platform/interfaces/modules
)
target_link_libraries(xr INTERFACE
${XR_EXTERNAL_LIBS}
)
endif()
list(APPEND CC_EXTERNAL_LIBS
xr
)
endif()
set(se_libs_name) set(se_libs_name)
if(USE_SE_V8) if(USE_SE_V8)
@ -84,8 +113,7 @@ if(USE_SE_V8)
IMPORTED_LOCATION ${platform_spec_path}/v8/libinspector.a IMPORTED_LOCATION ${platform_spec_path}/v8/libinspector.a
INTERFACE_INCLUDE_DIRECTORIES ${platform_spec_path}/include/v8 INTERFACE_INCLUDE_DIRECTORIES ${platform_spec_path}/include/v8
) )
set(se_libs_name v8_monolith) set(se_libs_name v8_monolith v8_inspector)
set(se_libs_include ${platform_spec_path}/include/v8)
endif() endif()
if(USE_WEBSOCKET_SERVER) if(USE_WEBSOCKET_SERVER)
@ -161,9 +189,7 @@ endif()
set(ZLIB z) set(ZLIB z)
if(NOT USE_MODULES) if(NOT USE_MODULES)
list(APPEND CC_EXTERNAL_LIBS ${ZLIB} list(APPEND CC_EXTERNAL_LIBS ${ZLIB} ${se_libs_name})
${se_libs_name}
)
endif() endif()

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

117
android/xr.cmake Normal file
View File

@ -0,0 +1,117 @@
################################# options ############################################
# default fallback options
cc_set_if_undefined(BUILD_XR_NATIVE OFF)
cc_set_if_undefined(XR_OEM_META OFF)
cc_set_if_undefined(XR_OEM_HUAWEIVR OFF)
cc_set_if_undefined(XR_OEM_PICO OFF)
cc_set_if_undefined(XR_OEM_ROKID OFF)
cc_set_if_undefined(XR_OEM_SEED OFF)
cc_set_if_undefined(XR_OEM_SNAPDRAGON_SPACES OFF)
cc_set_if_undefined(XR_USE_GRAPHICS_API_OPENGL_ES ON)
cc_set_if_undefined(XR_USE_GRAPHICS_API_VULKAN ON)
cc_set_if_undefined(XR_USE_GRAPHICS_API_OPENGL OFF)
cc_set_if_undefined(XR_USE_GRAPHICS_API_D3D11 OFF)
cc_set_if_undefined(XR_USE_GRAPHICS_API_D3D12 OFF)
# Several files use these compile time platform switches
if(WIN32)
cc_set_if_undefined(XR_USE_PLATFORM_WIN32 ON)
elseif(ANDROID)
cc_set_if_undefined(XR_USE_PLATFORM_ANDROID ON)
elseif(PRESENTATION_BACKEND MATCHES "xlib")
cc_set_if_undefined(XR_USE_PLATFORM_XLIB ON)
elseif(PRESENTATION_BACKEND MATCHES "xcb")
cc_set_if_undefined(XR_USE_PLATFORM_XCB ON)
elseif(PRESENTATION_BACKEND MATCHES "wayland")
cc_set_if_undefined(XR_USE_PLATFORM_WAYLAND ON)
endif()
################################# list all option values ##############################
cc_inspect_values(
BUILD_XR_NATIVE
XR_OEM_META
XR_OEM_HUAWEIVR
XR_OEM_PICO
XR_OEM_ROKID
XR_OEM_SEED
XR_OEM_SNAPDRAGON_SPACES
XR_USE_GRAPHICS_API_OPENGL_ES
XR_USE_GRAPHICS_API_VULKAN
XR_USE_GRAPHICS_API_OPENGL
XR_USE_GRAPHICS_API_D3D11
XR_USE_GRAPHICS_API_D3D12
XR_USE_PLATFORM_WIN32
XR_USE_PLATFORM_ANDROID
XR_USE_PLATFORM_XLIB
XR_USE_PLATFORM_XCB
XR_USE_PLATFORM_WAYLAND
)
################################# cc_xr_apply_definations ###################################
function(cc_xr_apply_definations target)
target_compile_definitions(${target} PUBLIC
$<IF:$<BOOL:${XR_OEM_META}>,XR_OEM_META=1,XR_OEM_META=0>
$<IF:$<BOOL:${XR_OEM_HUAWEIVR}>,XR_OEM_HUAWEIVR=1,XR_OEM_HUAWEIVR=0>
$<IF:$<BOOL:${XR_OEM_PICO}>,XR_OEM_PICO=1,XR_OEM_PICO=0>
$<IF:$<BOOL:${XR_OEM_ROKID}>,XR_OEM_ROKID=1,XR_OEM_ROKID=0>
$<IF:$<BOOL:${XR_OEM_SEED}>,XR_OEM_SEED=1,XR_OEM_SEED=0>
$<IF:$<BOOL:${XR_OEM_SNAPDRAGON_SPACES}>,XR_OEM_SNAPDRAGON_SPACES=1,XR_OEM_SNAPDRAGON_SPACES=0>
$<$<BOOL:${XR_USE_GRAPHICS_API_OPENGL_ES}>:XR_USE_GRAPHICS_API_OPENGL_ES=1>
$<$<BOOL:${XR_USE_GRAPHICS_API_VULKAN}>:XR_USE_GRAPHICS_API_VULKAN=1>
$<$<BOOL:${XR_USE_GRAPHICS_API_OPENGL}>:XR_USE_GRAPHICS_API_OPENGL=1>
$<$<BOOL:${XR_USE_GRAPHICS_API_D3D11}>:XR_USE_GRAPHICS_API_D3D11=1>
$<$<BOOL:${XR_USE_GRAPHICS_API_D3D12}>:XR_USE_GRAPHICS_API_D3D12=1>
$<$<BOOL:${XR_USE_PLATFORM_WIN32}>:XR_USE_PLATFORM_WIN32=1>
$<$<BOOL:${XR_USE_PLATFORM_ANDROID}>:XR_USE_PLATFORM_ANDROID=1>
$<$<BOOL:${XR_USE_PLATFORM_XLIB}>:XR_USE_PLATFORM_XLIB=1>
$<$<BOOL:${XR_USE_PLATFORM_XCB}>:XR_USE_PLATFORM_XCB=1>
$<$<BOOL:${XR_USE_PLATFORM_WAYLAND}>:XR_USE_PLATFORM_WAYLAND=1>
)
endfunction()
set(XR_EXTERNAL_LIBS)
set(XR_EXTERNAL_INCLUDES)
set(XR_EXTERNAL_SOURCES)
list(APPEND XR_EXTERNAL_INCLUDES
${CMAKE_CURRENT_LIST_DIR}
)
set(XR_OEM_LOADER_NAME openxr_loader)
if(XR_OEM_META)
set(XR_OEM_FOLDER meta)
set(XR_FOLDER meta)
elseif(XR_OEM_HUAWEIVR)
set(XR_OEM_FOLDER huaweivr)
set(XR_OEM_LOADER_NAME xr_loader)
set(XR_FOLDER huaweivr)
elseif(XR_OEM_PICO)
set(XR_OEM_FOLDER pico)
set(XR_FOLDER pico)
elseif(XR_OEM_ROKID)
set(XR_OEM_FOLDER rokid)
set(XR_FOLDER rokid)
elseif(XR_OEM_SEED)
set(XR_OEM_FOLDER monado)
set(XR_FOLDER seed)
elseif(XR_OEM_SNAPDRAGON_SPACES)
set(XR_OEM_FOLDER spaces)
set(XR_FOLDER spaces)
else()
set(XR_OEM_FOLDER monado)
set(XR_FOLDER monado)
endif()
add_library(openxr SHARED IMPORTED GLOBAL)
set_target_properties(openxr PROPERTIES
IMPORTED_LOCATION ${platform_spec_path}/xr/${XR_OEM_FOLDER}/lib${XR_OEM_LOADER_NAME}.so
)
list(APPEND XR_EXTERNAL_LIBS
openxr
)

View File

@ -12,9 +12,6 @@ elseif(WINDOWS)
elseif(MACOSX) elseif(MACOSX)
set(platform_name mac) set(platform_name mac)
set(platform_spec_path mac) set(platform_spec_path mac)
elseif(OPENHARMONY)
set(platform_name ohos)
set(platform_spec_path openharmony/${OHOS_ARCH})
elseif(OHOS) elseif(OHOS)
set(platform_name ohos) set(platform_name ohos)
set(platform_spec_path ohos/${OHOS_ARCH}) set(platform_spec_path ohos/${OHOS_ARCH})

View File

@ -1,584 +0,0 @@
declare namespace B2 {
const maxPolygonVertices: number;
interface Vec2 {
x: number, y: number
}
interface Vec2Vector {
push_back(v: Vec2): void;
get(i: number): Vec2;
size(): number;
}
interface Int32Vector {
push_back(v: number): void;
get(i: number): number;
size(): number;
}
interface Transform {
p: Vec2, q: Vec2
}
interface Color {
r: number, g: number, b: number, a: number
}
interface MassData {
mass: number;
center: Vec2;
I: number;
}
class AABB {
constructor();
lowerBound: Vec2;
upperBound: Vec2;
IsValid(): boolean;
GetCenter(): Vec2;
GetExtents(): Vec2;
GetPerimeter(): number;
Combine(aabb: AABB): void;
CombineTwo(aabb1: AABB, aabb2: AABB): void;
Contains(aabb: AABB): boolean;
RayCast(output: RayCastOutput, input: RayCastInput): boolean;
TestOverlap(other: AABB): boolean;
}
class RayCastCallback {
constructor();
ReportFixture(fixture: Fixture, point: Vec2, normal: Vec2, fraction: number): number;
}
class QueryCallback {
constructor();
ReportFixture(fixture: Fixture): boolean;
}
interface RayCastInput {
p1: Vec2;
p2: Vec2;
maxFraction: number;
}
interface RayCastOutput {
normal: Vec2;
fraction: number;
}
interface Filter {
categoryBits: number;
maskBits: number;
groupIndex: number;
}
class ContactListener {
constructor();
BeginContact(contact: number): void;
EndContact(contact: number): void;
PreSolve(contact: number, oldManifold: number): void;
PostSolve(contact: number, impulse: number): void;
registerContactFixture(fixture: number): void;
unregisterContactFixture(fixture: number): void;
isIndexOf(fixture: number): void;
}
class Draw {
constructor();
SetFlags(flags: number): void;
GetFlags(): number;
AppendFlags(flags: number): void;
ClearFlags(flags: number): void;
DrawPolygon(vertices: Vec2[], vertexCount: number, color: Color): void;
DrawSolidPolygon(vertices: Vec2[], vertexCount: number, color: Color): void;
DrawCircle(center: Vec2, radius: number, color: Color): void;
DrawSolidCircle(center: Vec2, radius: number, axis: Vec2, color: Color): void;
}
class World {
constructor(gravity: Vec2);
SetContactListener(listener: ContactListener): void;
SetDebugDraw(debugDraw: Draw): void;
CreateBody(def: BodyDef): Body;
DestroyBody(body: Body): void;
CreateJoint(def: JointDef): Joint;
DestroyJoint(joint: Joint): void;
Step(timeStep: number, velocityIterations: number, positionIterations: number): void;
DebugDraw(): void;
QueryAABB(callback: QueryCallback, aabb: AABB): void;
RayCast(callback: RayCastCallback, point1: Vec2, point2: Vec2): void;
SetAllowSleeping(flag: boolean): void;
GetAllowSleeping(): boolean;
SetGravity(gravity: Vec2): void;
GetGravity(): Vec2;
Dump(): void;
}
class Shape {
m_type: number;
m_radius: number;
GetType(): number;
GetChildCount(): number;
TestPoint(xf: Transform, p: Vec2): boolean;
RayCast(output: RayCastOutput, input: RayCastInput, transform: Transform, childIndex: number): boolean;
ComputeAABB(aabb: AABB, xf: Transform, childIndex: number): void;
ComputeMass(massData: MassData, density: number): void;
SetRadius(radius: number): void;
GetRadius(): number;
}
class CircleShape extends Shape {
constructor();
m_p: Vec2;
Clone(): CircleShape;
GetChildCount(): number;
TestPoint(transform: Transform, p: Vec2): boolean;
RayCast(output: RayCastOutput, input: RayCastInput, transform: Transform, childIndex: number): boolean;
ComputeAABB(aabb: AABB, transform: Transform, childIndex: number): void;
ComputeMass(massData: MassData, density: number): void;
}
class EdgeShape extends Shape {
constructor();
Set(v1: Vec2, v2: Vec2): void;
Clone(): EdgeShape;
GetChildCount(): number;
TestPoint(transform: Transform, p: Vec2): boolean;
RayCast(output: RayCastOutput, input: RayCastInput, transform: Transform, childIndex: number): boolean;
ComputeAABB(aabb: AABB, transform: Transform, childIndex: number): void;
ComputeMass(massData: MassData, density: number): void;
}
class PolygonShape extends Shape {
constructor();
Clone(): PolygonShape;
Set(vertices: any, count: number): void;
SetAsBox(hx: number, hy: number): void;
SetAsBoxWithCenterAndAngle(hx: number, hy: number, center: Vec2, angle: number): void;
GetChildCount(): number;
TestPoint(transform: Transform, p: Vec2): boolean;
RayCast(output: RayCastOutput, input: RayCastInput, transform: Transform, childIndex: number): boolean;
ComputeAABB(aabb: AABB, transform: Transform, childIndex: number): void;
ComputeMass(massData: MassData, density: number): void;
Validate(): boolean;
}
class FixtureDef {
shape: Shape;
userData: any;
friction: number;
restitution: number;
density: number;
isSensor: boolean;
filter: Filter;
SetShape(shape: Shape): void;
GetShape(): Shape;
}
class Fixture {
GetType(): number;
GetShape(): Shape;
SetSensor(sensor: boolean): void;
IsSensor(): boolean;
SetFilterData(filter: Filter): void;
GetFilterData(): Filter;
Refilter(): void;
GetBody(): Body;
GetNext(): Fixture;
TestPoint(p: Vec2): boolean;
RayCast(output: RayCastOutput, input: RayCastInput, childIndex: number): boolean;
GetMassData(massData: MassData): void;
SetDensity(density: number): void;
GetDensity(): number;
GetFriction(): number;
SetFriction(friction: number): void;
GetRestitution(): number;
SetRestitution(restitution: number): void;
GetAABB(childIndex: number): AABB;
Dump(bodyIndex: number): void;
}
enum BodyType{
b2_staticBody = 0,
b2_kinematicBody,
b2_dynamicBody,
cc_animatedBody,
}
class BodyDef {
constructor();
type: BodyType;
position: Vec2;
angle: number;
linearVelocity: Vec2;
angularVelocity: number;
linearDamping: number;
angularDamping: number;
allowSleep: boolean;
awake: boolean;
fixedRotation: boolean;
bullet: boolean;
gravityScale: number;
}
class Body {
CreateFixture (fixtureDef: FixtureDef): Fixture;
CreateFixtureWithShape (shape: Shape, density: number): Fixture;
DestroyFixture(fixture: Fixture): void;
SetTransform(position: Vec2, angle: number): void;
GetTransform(): Transform;
GetPosition(): Vec2;
SetPosition(pos: Vec2): void;
GetAngle(): number;
SetAngle(angle: number): void;
GetWorldCenter(): Vec2;
GetLocalCenter(): Vec2;
SetLinearVelocity(v: Vec2): void;
GetLinearVelocity(): Vec2;
SetAngularVelocity(omega: number): void;
GetAngularVelocity(): number;
ApplyForce(force: Vec2, point: Vec2, wake: boolean): void;
ApplyForceToCenter(force: Vec2, wake: boolean): void;
ApplyTorque(torque: number, wake: boolean): void;
ApplyLinearImpulse(impulse: Vec2, point: Vec2, wake: boolean): void;
ApplyLinearImpulseToCenter(impulse: Vec2, wake: boolean): void;
ApplyAngularImpulse(impulse: number, wake: boolean): void;
GetMass(): number;
GetInertia(): number;
GetMassData(data: MassData): void;
SetMassData(data: MassData): void;
ResetMassData(): void;
GetWorldPoint(localPoint: Vec2): Vec2;
GetWorldVector(localVector: Vec2): Vec2;
GetLocalPoint(worldPoint: Vec2): Vec2;
GetLocalVector(worldVector: Vec2): Vec2;
GetLinearVelocityFromWorldPoint(worldPoint: Vec2): Vec2;
GetLinearVelocityFromLocalPoint(localPoint: Vec2): Vec2;
GetLinearDamping(): number;
SetLinearDamping(linearDamping: number): void;
GetAngularDamping(): number;
SetAngularDamping(angularDamping: number): void;
GetGravityScale(): number;
SetGravityScale(scale: number): void;
SetType(type: BodyType): void;
GetType(): BodyType;
SetBullet(flag: boolean): void;
IsBullet(): boolean;
SetSleepingAllowed(flag: boolean): void;
IsSleepingAllowed(): boolean;
SetAwake(flag: boolean): void;
IsAwake(): boolean;
SetEnabled(flag: boolean): void;
IsEnabled(): boolean;
SetFixedRotation(flag: boolean): void;
IsFixedRotation(): boolean;
GetFixtureList(): Fixture;
GetJointList(): number;
GetWorld(): World;
Dump(): void;
}
enum JointType {
e_unknownJoint,
e_revoluteJoint,
e_prismaticJoint,
e_distanceJoint,
e_pulleyJoint,
e_mouseJoint,
e_gearJoint,
e_wheelJoint,
e_weldJoint,
e_frictionJoint,
e_ropeJoint,
e_motorJoint
}
class JointDef {
constructor(type: JointType);
type: JointType;
collideConnected: boolean;
SetBodyA(bodyA: Body): void;
SetBodyB(bodyB: Body): void;
GetBodyA(): Body;
GetBodyB(): Body;
SetCollideConnected(flag: boolean): void;
}
class Joint {
GetType(): JointType;
GetBodyA(): Body;
GetBodyB(): Body;
GetAnchorA(): Vec2;
GetAnchorB(): Vec2;
GetReactionForce(inv_dt: number): Vec2;
GetReactionTorque(inv_dt: number): number;
IsActive(): boolean;
GetCollideConnected(): boolean;
Dump(): void;
}
class DistanceJointDef extends JointDef {
constructor();
localAnchorA: Vec2;
localAnchorB: Vec2;
length: number;
stiffness: number;
damping: number;
}
class DistanceJoint extends Joint {
GetLocalAnchorA(): Vec2;
GetLocalAnchorB(): Vec2;
SetLength(length: number): void;
GetLength(): number;
SetStiffness(stiffness: number): void;
GetStiffness(): number;
SetDamping(damping: number): void;
GetDamping(): number;
Dump(): void;
}
class MotorJointDef extends JointDef {
constructor();
linearOffset: Vec2;
angularOffset: number;
maxForce: number;
maxTorque: number;
correctionFactor: number;
}
class MotorJoint extends Joint {
SetLinearOffset(linearOffset: Vec2): void;
GetLinearOffset(): Vec2;
SetAngularOffset(angularOffset: number): void;
GetAngularOffset(): number;
SetMaxForce(force: number): void;
GetMaxForce(): number;
SetMaxTorque(torque: number): void;
GetMaxTorque(): number;
SetCorrectionFactor(factor: number): void;
GetCorrectionFactor(): number;
Dump(): void;
}
class MouseJointDef extends JointDef {
constructor();
target: Vec2;
maxForce: number;
frequencyHz: number;
dampingRatio: number;
}
class MouseJoint extends Joint {
SetTarget(target: Vec2): void;
GetTarget(): Vec2;
SetMaxForce(force: number): void;
GetMaxForce(): number;
SetFrequency(hz: number): void;
GetFrequency(): number;
SetDampingRatio(ratio: number): void;
GetDampingRatio(): number;
Dump(): void;
}
class PrismaticJointDef extends JointDef {
constructor();
localAnchorA: Vec2;
localAnchorB: Vec2;
localAxisA: Vec2;
referenceAngle: number;
enableLimit: boolean;
lowerTranslation: number;
upperTranslation: number;
enableMotor: boolean;
maxMotorForce: number;
motorSpeed: number;
}
class PrismaticJoint extends Joint {
GetLocalAnchorA(): Vec2;
GetLocalAnchorB(): Vec2;
GetLocalAxisA(): Vec2;
GetReferenceAngle(): number;
GetJointTranslation(): number;
GetJointSpeed(): number;
IsLimitEnabled(): boolean;
EnableLimit(flag: boolean): void;
GetLowerLimit(): number;
GetUpperLimit(): number;
SetLimits(lower: number, upper: number): void;
IsMotorEnabled(): boolean;
EnableMotor(flag: boolean): void;
SetMotorSpeed(speed: number): void;
GetMotorSpeed(): number;
SetMaxMotorForce(force: number): void;
GetMaxMotorForce(): number;
GetMotorForce(inv_dt: number): number;
Dump(): void;
}
class RevoluteJointDef extends JointDef {
constructor();
localAnchorA: Vec2;
localAnchorB: Vec2;
referenceAngle: number;
enableLimit: boolean;
lowerAngle: number;
upperAngle: number;
enableMotor: boolean;
motorSpeed: number;
maxMotorTorque: number;
}
class RevoluteJoint extends Joint {
GetLocalAnchorA(): Vec2;
GetLocalAnchorB(): Vec2;
GetReferenceAngle(): number;
GetJointAngle(): number;
GetJointSpeed(): number;
IsLimitEnabled(): boolean;
EnableLimit(flag: boolean): void;
GetLowerLimit(): number;
GetUpperLimit(): number;
SetLimits(lower: number, upper: number): void;
IsMotorEnabled(): boolean;
EnableMotor(flag: boolean): void;
SetMotorSpeed(speed: number): void;
GetMotorSpeed(): number;
SetMaxMotorTorque(torque: number): void;
GetMaxMotorTorque(): number;
GetMotorTorque(inv_dt: number): number;
Dump(): void;
}
class RopeJointDef extends JointDef {
constructor();
localAnchorA: Vec2;
localAnchorB: Vec2;
maxLength: number;
}
class RopeJoint extends Joint {
GetLocalAnchorA(): Vec2;
GetLocalAnchorB(): Vec2;
GetReactionForce(inv_dt: number): Vec2;
GetReactionTorque(inv_dt: number): number;
SetMaxLength(length: number): void;
GetMaxLength(): number;
GetLength(): number;
Dump(): void;
}
class WeldJointDef extends JointDef {
constructor();
localAnchorA: Vec2;
localAnchorB: Vec2;
referenceAngle: number;
stiffness: number;
damping: number;
}
class WeldJoint extends Joint {
GetLocalAnchorA(): Vec2;
GetLocalAnchorB(): Vec2;
GetReferenceAngle(): number;
SetStiffness(stiffness: number): void;
GetStiffness(): number;
SetDamping(damping: number): void;
GetDamping(): number;
Dump(): void;
}
class WheelJointDef extends JointDef {
constructor();
localAnchorA: Vec2;
localAnchorB: Vec2;
localAxisA: Vec2;
enableLimit: boolean;
lowerTranslation: number;
upperTranslation: number;
enableMotor: boolean;
maxMotorTorque: number;
motorSpeed: number;
stiffness: number;
damping: number;
}
class WheelJoint extends Joint {
GetLocalAnchorA(): Vec2;
GetLocalAnchorB(): Vec2;
GetLocalAxisA(): Vec2;
GetJointTranslation(): number;
IsMotorEnabled(): boolean;
EnableMotor(flag: boolean): void;
SetMotorSpeed(speed: number): void;
GetMotorSpeed(): number;
SetMaxMotorTorque(torque: number): void;
GetMaxMotorTorque(): number;
GetMotorTorque(inv_dt: number): number;
SetStiffness(stiffness: number): void;
GetStiffness(): number;
SetDamping(damping: number): void;
GetDamping(): number;
Dump(): void;
}
//
// functions
//
function ConvexPartition(verticesIn: Vec2Vector, trianglesIn: Int32Vector, verticesOut: Vec2Vector, trianglesOut: Int32Vector): void;
function GetFloat32(memory: number, offset: number): number;
function SetLinearFrequencyAndDampingRatio(body: Joint, frequencyHertz: number, dampingRatio: number): void;
//Contact
function ContactSetEnabled(contactPtr: number, flag: boolean): void;
function ContactIsTouching(contactPtr: number): boolean;
function ContactSetTangentSpeed(contactPtr: number, speed: number): void;
function ContactGetTangentSpeed(contactPtr: number): number;
function ContactSetFriction(contactPtr: number, friction: number): void;
function ContactGetFriction(contactPtr: number): number;
function ContactResetFriction(contactPtr: number): void;
function ContactSetRestitution(contactPtr: number, restitution: number): void;
function ContactGetRestitution(contactPtr: number): number;
function ContactResetRestitution(contactPtr: number): void;
function ContactGetFixtureA(contactPtr: number): number;
function ContactGetFixtureB(contactPtr: number): number;
function ContactGetWorldManifold(contactPtr: number, worldManifoldPtr: number): number;
function ContactGetManifold(contactPtr: number): number;
//Manifold
function ManifoldGetType(manifoldPtr: number): number;
function ManifoldGetPointCount(manifoldPtr: number): number;
function ManifoldGetManifoldPointPtr(manifoldPtr: number, index: number): number;
function ManifoldGetLocalPointValueX(manifoldPtr: number): number;
function ManifoldGetLocalPointValueY(manifoldPtr: number): number;
function ManifoldGetLocalNormalValueX(manifoldPtr: number): number;
function ManifoldGetLocalNormalValueY(manifoldPtr: number): number;
//ManifoldPoint
function ManifoldPointGetLocalPointX(manifoldPointPtr: number): number;
function ManifoldPointGetLocalPointY(manifoldPointPtr: number): number;
function ManifoldPointGetNormalImpulse(manifoldPointPtr: number): number;
function ManifoldPointGetTangentImpulse(manifoldPointPtr: number): number;
//WorldManifold
function WorldManifoldNew(): number;
function WorldManifoldGetPointValueX(worldManifoldPtr: number, index: number): number;
function WorldManifoldGetPointValueY(worldManifoldPtr: number, index: number): number;
function WorldManifoldGetSeparationValue(worldManifoldPtr: number, index: number): number;
function WorldManifoldGetNormalValueX(worldManifoldPtr: number): number;
function WorldManifoldGetNormalValueY(worldManifoldPtr: number): number;
function WorldManifoldDelete(worldManifoldPtr: number): void;
//ContactImpulse
function ContactImpulseGetNormalImpulse(contactImpulsePtr: number, index: number): number;
function ContactImpulseGetTangentImpulse(contactImpulsePtr: number, index: number): number;
function ContactImpulseGetCount(contactImpulsePtr: number): number;
//JointEdge
function JointEdgeGetOther(jointEdgePtr: number): number;
function JointEdgeGetJoint(jointEdgePtr: number): number;
function JointEdgeGetPrev(jointEdgePtr: number): number;
function JointEdgeGetNext(jointEdgePtr: number): number;
}

View File

@ -1,13 +0,0 @@
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
/// <reference path="./b2.d.ts" />
declare module 'external:emscripten/box2d/box2d.release.asm.js' {
export default BOX2D;
}
declare module 'external:emscripten/box2d/box2d.release.wasm.js' {
export default BOX2D;
}
// tslint:disable
declare function BOX2D (moduleOptions?: any): Promise<void>;

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,285 +0,0 @@
declare module 'external:emscripten/bullet/bullet.asm.js' {
function factory (env: any, wasmMemory: ArrayBuffer): Bullet.instance;
export default factory;
}
declare namespace Bullet {
type ptr = number;
interface instance {
_malloc(bytes: number): ptr;
_free(p: ptr): void;
_read_f32(p: ptr): void;
_write_f32(p: ptr, v: number): void;
_safe_delete(p: ptr, bulletType: number): void;
Vec3_new(x: number, y: number, z: number): ptr;
Vec3_x(p: ptr): number;
Vec3_y(p: ptr): number;
Vec3_z(p: ptr): number;
Vec3_set(p: ptr, x: number, y: number, z: number): void;
Quat_new(x: number, y: number, z: number, w: number): ptr;
Quat_x(p: ptr): number;
Quat_y(p: ptr): number;
Quat_z(p: ptr): number;
Quat_w(p: ptr): number;
Quat_set(p: ptr, x: number, y: number, z: number, w: number): void;
Transform_new(): ptr;
Transform_setIdentity(p: ptr): void;
Transform_getOrigin(p: ptr): ptr;
Transform_setRotation(p: ptr, quate: ptr): void;
Transform_getRotation(p: ptr, quate: ptr): void;
MotionState_getWorldTransform(p: ptr, transform: ptr): void;
MotionState_setWorldTransform(p: ptr, transform: ptr): void;
ccMotionState_new(id: number, initTrans: ptr): ptr;
int_array_size(p: ptr): number;
int_array_at(p: ptr, index: number): number;
Vec3_array_at(p: ptr, index: number): ptr;
// constraints
TypedConstraint_getFixedBody(): ptr;
HingeConstraint_new(ptr0: ptr, ptr1: ptr, ptr2: ptr, ptr3: ptr): ptr;
HingeConstraint_setFrames(ptr0: ptr, ptr1: ptr, ptr2: ptr): void;
HingeConstraint_setLimit(p: ptr, low: number, upper: number, softness: number, biasFactor: number, relaxationFactor: number): void;
HingeConstraint_setAngularOnly(p: ptr, angular: number): void;
HingeConstraint_enableMotor(p: ptr, enable: boolean): void;
HingeConstraint_setMotorVelocity(p: ptr, velocity: number): void;
HingeConstraint_setMaxMotorImpulse(p: ptr, maxImpulse: number): void;
HingeConstraint_setMotorTarget(p: ptr, target: number, dt: number): void;
P2PConstraint_new(ptr0: ptr, ptr1: ptr, ptr2: ptr, ptr3: ptr): ptr;
P2PConstraint_setPivotA(ptr0: ptr, ptr1: ptr): void;
P2PConstraint_setPivotB(ptr0: ptr, ptr1: ptr): void;
TypedConstraint_setMaxImpulseThreshold(ptr0: ptr, maxImpulse: number): void;
FixedConstraint_new(ptr0: ptr, ptr1: ptr, ptr2: ptr, ptr3: ptr): ptr;
FixedConstraint_setFrames(ptr0: ptr, ptr1: ptr, ptr2: ptr): void;
Generic6DofSpring2Constraint_new(ptr0: ptr, ptr1: ptr, ptr2: ptr, ptr3: ptr, rotateOrder: number): ptr;
Generic6DofSpring2Constraint_setFrames(ptr0: ptr, ptr1: ptr, ptr2: ptr): void;
Generic6DofSpring2Constraint_setLimit(ptr0: ptr, index: number, lo: number, hi: number): void;
Generic6DofSpring2Constraint_enableSpring(ptr0: ptr, index: number, onOff: boolean): void;
Generic6DofSpring2Constraint_setStiffness(ptr0: ptr, index: number, stiffness: number): void;
Generic6DofSpring2Constraint_setDamping(ptr0: ptr, index: number, damping: number): void;
Generic6DofSpring2Constraint_setBounce(ptr0: ptr, index: number, bounce: number): void;
Generic6DofSpring2Constraint_setEquilibriumPoint(ptr0: ptr, index: number, val: number): void;
Generic6DofSpring2Constraint_enableMotor(ptr0: ptr, index: number, onOff: boolean): void;
Generic6DofSpring2Constraint_setMaxMotorForce(ptr0: ptr, index: number, force: number): void;
Generic6DofSpring2Constraint_setTargetVelocity(ptr0: ptr, index: number, velocity: number): void;
Generic6DofSpring2Constraint_setServo(ptr0: ptr, index: number, onOff: boolean): number;
Generic6DofSpring2Constraint_setServoTarget(ptr0: ptr, index: number, target: number): number;
// shapes
// CollisionShape_getUserIndex(p: ptr): number;
// CollisionShape_setUserIndex(p: ptr, i: number): void;
CollisionShape_isCompound(p: ptr): boolean;
CollisionShape_setLocalScaling(p: ptr, scale: ptr): void;
CollisionShape_calculateLocalInertia(p: ptr, mass: number, localInertia: ptr): void;
CollisionShape_getAabb(p: ptr, t: ptr, min: ptr, max: ptr): void;
CollisionShape_getLocalBoundingSphere(p: ptr): number;
CollisionShape_setMargin(p: ptr, margin: number): void;
CollisionShape_setMaterial(p: ptr, mat: ptr): void;
CollisionShape_setUserPointer(p: ptr, p0: ptr): void;
EmptyShape_static(): ptr;
ConvexInternalShape_getImplicitShapeDimensions(p: ptr): ptr;
BoxShape_new(p: ptr): ptr;
BoxShape_setUnscaledHalfExtents(p: ptr, halfExtents: ptr): void;
SphereShape_new(radius: number): ptr;
SphereShape_setUnscaledRadius(p: ptr, radius: number): void;
CylinderShape_new(halfExtents: ptr): ptr;
CylinderShape_updateProp(p: ptr, r: number, g: number, d: number): void;
CapsuleShape_new(radius: number, height: number): ptr;
CapsuleShape_updateProp(p: ptr, r: number, g: number, d: number): void;
ConeShape_new(radius: number, height: number): ptr;
ConeShape_setRadius(p: ptr, v: number): void;
ConeShape_setHeight(p: ptr, v: number): void;
ConeShape_setConeUpIndex(p: ptr, v: number): void;
StaticPlaneShape_new(normal: ptr, constant: number): ptr;
StaticPlaneShape_getPlaneNormal(p: ptr): ptr;
StaticPlaneShape_setPlaneConstant(p: ptr, constant: number): void;
TerrainShape_new(i: number, j: number, p: ptr, hs: number, min: number, max: number): ptr;
TriangleMesh_new(): ptr;
TriangleMesh_addTriangle(p: ptr, v0: ptr, v1: ptr, v2: ptr): void;
BvhTriangleMeshShape_new(p: ptr, c: boolean, bvh: boolean): ptr;
BvhTriangleMeshShape_getOptimizedBvh(p: ptr): ptr;
BvhTriangleMeshShape_setOptimizedBvh(p: ptr, p1: ptr, scaleX: number, scaleY: number, scaleZ: number);
ScaledBvhTriangleMeshShape_new(p: ptr, scaleX: number, scaleY: number, scaleZ: number): ptr;
ConvexTriangleMeshShape_new(p: ptr): ptr;
SimplexShape_new(): ptr;
SimplexShape_addVertex(p: ptr, pt: ptr): void;
ccCompoundShape_new(): ptr;
CompoundShape_getNumChildShapes(p: ptr): number;
CompoundShape_getChildShape(p: ptr, i: number): ptr;
CompoundShape_addChildShape(p: ptr, local: ptr, shape: ptr): void;
CompoundShape_removeChildShape(p: ptr, shape: ptr): void;
CompoundShape_updateChildTransform(p: ptr, i: number, trans: ptr, shouldRecalculateLocalAabb: boolean): void;
CompoundShape_setMaterial(p: ptr, i: number, f: number, r: number, rf: number, sf: number): void;
// collision
CollisionObject_new(): number;
CollisionObject_getCollisionShape(p: ptr): ptr;
CollisionObject_setContactProcessingThreshold(p: ptr, contactProcessingThreshold: number): void;
CollisionObject_getActivationState(p: ptr): number;
CollisionObject_setActivationState(p: ptr, newState: number): void;
CollisionObject_forceActivationState(p: ptr, newState: number): void;
CollisionObject_activate(p: ptr, forceActivation?: boolean): void;
CollisionObject_isActive(p: ptr): boolean;
CollisionObject_isKinematicObject(p: ptr): boolean;
CollisionObject_isStaticObject(p: ptr): boolean;
CollisionObject_isStaticOrKinematicObject(p: ptr): boolean;
CollisionObject_getWorldTransform(p: ptr): ptr;
CollisionObject_getCollisionFlags(p: ptr): number;
CollisionObject_setCollisionFlags(p: ptr, flags: number): void;
CollisionObject_setWorldTransform(p: ptr, transform: ptr): void;
CollisionObject_setCollisionShape(p: ptr, shape: ptr): void;
CollisionObject_setCcdMotionThreshold(p: ptr, ccdMotionThreshold: number): void;
CollisionObject_setCcdSweptSphereRadius(p: ptr, radius: number): void;
CollisionObject_getUserIndex(p: ptr): number;
CollisionObject_setUserIndex(p: ptr, index: number): void;
CollisionObject_getUserPointer(p: ptr): number;
CollisionObject_setUserPointer(p: ptr, userPointer: number): void;
CollisionObject_setMaterial(p: ptr, f: number, r: number, rf: number, sf: number): void;
CollisionObject_setIgnoreCollisionCheck(p: ptr, p0: ptr, v: boolean): void;
RigidBody_new(m: number, ms: number): ptr;
RigidBody_getFlags(p: ptr): number;
RigidBody_setFlags(p: ptr, flags: number): void;
RigidBody_setGravity(p: ptr, g: ptr): number;
RigidBody_setDamping(p: ptr, lin: number, ang: number): void;
RigidBody_setMass(p: ptr, m: number);
RigidBody_setMassProps(p: ptr, m: number, localInertia: ptr): void;
RigidBody_setLinearFactor(p: ptr, f: ptr): number;
RigidBody_setAngularFactor(p: ptr, f: ptr): number;
RigidBody_getLinearVelocity(p: ptr): ptr;
RigidBody_getAngularVelocity(p: ptr): ptr;
RigidBody_setLinearVelocity(p: ptr, v: ptr): void;
RigidBody_setAngularVelocity(p: ptr, v: ptr): void;
RigidBody_clearState(p: ptr): void;
RigidBody_clearForces(p: ptr): void;
RigidBody_wantsSleeping(p: ptr): boolean;
RigidBody_setSleepingThresholds(p: ptr, linear: number, angular: number): void;
RigidBody_getLinearSleepingThreshold(p: ptr): number;
RigidBody_getMotionState(p: ptr): ptr;
RigidBody_applyTorque(p: ptr, f: ptr): void;
RigidBody_applyForce(p: ptr, f: ptr, rp: ptr): void;
RigidBody_applyImpulse(p: ptr, f: ptr, rp: ptr): void;
// dynamic
DefaultCollisionConfiguration_static(): ptr;
CollisionDispatcher_new(): ptr;
Dispatcher_getNumManifolds(p: ptr): number;
Dispatcher_getManifoldByIndexInternal(p: ptr, i: number): ptr;
ManifoldPoint_getShape0(p: ptr): ptr;
ManifoldPoint_getShape1(p: ptr): ptr;
ManifoldPoint_get_m_index0(p: ptr): number;
ManifoldPoint_get_m_index1(p: ptr): number;
PersistentManifold_getBody0(p: ptr): ptr;
PersistentManifold_getBody1(p: ptr): ptr;
PersistentManifold_getNumContacts(p: ptr): number;
PersistentManifold_getContactPoint(p: ptr, i: number): ptr;
ManifoldPoint_get_m_localPointA(p: ptr): ptr;
ManifoldPoint_get_m_localPointB(p: ptr): ptr;
ManifoldPoint_get_m_positionWorldOnA(p: ptr): ptr;
ManifoldPoint_get_m_positionWorldOnB(p: ptr): ptr;
ManifoldPoint_get_m_normalWorldOnB(p: ptr): ptr;
ManifoldPoint_get_m_positionWorldOnB(p: ptr): ptr;
DbvtBroadphase_new(): ptr;
SequentialImpulseConstraintSolver_new(): ptr;
CollisionWorld_addCollisionObject(p: ptr, body: ptr, g: number, m: number): void;
CollisionWorld_removeCollisionObject(p: ptr, body: ptr): void;
CollisionWorld_rayTest(p: ptr, p0: ptr, p1: ptr, p2: ptr): void;
CollisionWorld_convexSweepTest(p: ptr, castShape: ptr, from: ptr, to: ptr, resultCallback: ptr, allowedCcdPenetration: ptr): void;
ccDiscreteDynamicsWorld_new(dispatcher: ptr, pairCache: ptr, solver: ptr): ptr;
ccDiscreteDynamicsWorld_setAllowSleep(p: ptr, v: boolean): void;
DynamicsWorld_setGravity(p: ptr, g: ptr): void;
DynamicsWorld_stepSimulation(p: ptr, timeStep: number, maxSubSteps: number, fixedTimeStep: number): ptr;
DynamicsWorld_addRigidBody(p: ptr, body: ptr, g: number, m: number): void;
DynamicsWorld_removeRigidBody(p: ptr, body: ptr): void;
DynamicsWorld_addConstraint(p: ptr, p2: ptr, v: boolean): void;
DynamicsWorld_removeConstraint(p: ptr, p2: ptr): void;
DynamicsWorld_addAction(p: ptr, action: ptr): void;
DynamicsWorld_removeAction(p: ptr, action: ptr): void;
RayCallback_hasHit(p: ptr): boolean;
ConvexCallback_hasHit(p: ptr): boolean;
ccAllRayCallback_static(): ptr;
ccAllRayCallback_setFlags(p: ptr, flag: number): void;
ccAllRayCallback_reset(p: ptr, p0: ptr, p1: ptr, m: number, q: boolean): void;
ccAllRayCallback_getHitPointWorld(p: ptr): ptr;
ccAllRayCallback_getHitNormalWorld(p: ptr): ptr;
ccAllRayCallback_getCollisionShapePtrs(p: ptr): ptr;
ccClosestRayCallback_static(): ptr;
ccClosestRayCallback_setFlags(p: ptr, flag: number): void;
ccClosestRayCallback_reset(p: ptr, p0: ptr, p1: ptr, m: number, q: boolean): void;
ccClosestRayCallback_getHitPointWorld(p: ptr): ptr;
ccClosestRayCallback_getHitNormalWorld(p: ptr): ptr;
ccClosestRayCallback_getCollisionShapePtr(p: ptr): ptr;
ccAllConvexCallback_static(): ptr;
ccAllConvexCallback_reset(p: ptr, p0: ptr, p1: ptr, m: number, q: boolean): void;
ccAllConvexCallback_getHitPointWorld(p: ptr): ptr;
ccAllConvexCallback_getHitNormalWorld(p: ptr): ptr;
ccAllConvexCallback_getCollisionShapePtrs(p: ptr): ptr;
ccClosestConvexCallback_static(): ptr;
ccClosestConvexCallback_reset(p: ptr, p0: ptr, p1: ptr, m: number, q: boolean): void;
ccClosestConvexCallback_getHitPointWorld(p: ptr): ptr;
ccClosestConvexCallback_getHitNormalWorld(p: ptr): ptr;
ccClosestConvexCallback_getCollisionShapePtr(p: ptr): ptr;
ccMaterial_new(): ptr;
ccMaterial_set(p: ptr, r: number, f: number, rf: number, sf: number): void;
// CharacterController
ControllerHitReport_new(): ptr;
CharacterController_getGhostObject(ptrCCT: ptr): ptr;
CharacterController_getCollisionShape(ptrCCT: ptr): ptr;
ControllerHit_getCurrentController(p: ptr): ptr;
ControllerHit_getHitWorldPos(p: ptr): ptr;
ControllerHit_getHitWorldNormal(p: ptr): ptr;
ControllerHit_getHitMotionDir(p: ptr): ptr; //CCT hit Motion direction
ControllerHit_getHitMotionLength(p: ptr): number; //CCT hit Motion length
ControllerShapeHit_getHitShape(p: ptr): ptr;
ControllerShapeHit_getHitCollisionObject(p: ptr): ptr;
CharacterController_move(ptrCCT: ptr, ptrMovement: ptr, minDist: number, deltaTime: number):number;
CharacterController_getPosition(ptrCCT: ptr);
CharacterController_setContactOffset(ptrCCT: ptr, v: number);
CharacterController_setStepOffset(ptrCCT: ptr, v: number);
CharacterController_setSlopeLimit(ptrCCT: ptr, v: number);
CharacterController_setCollision(ptrCCT: ptr, collision: boolean);
CharacterController_setOverlapRecovery(ptrCCT: ptr, value: boolean);
CapsuleCharacterControllerDesc_new(maxSlopeRadians: number, stepHeight: number, contactOffset: number,
ptrUpAxis: ptr, ptrInitPos: ptr, ptruUserControllerHitReport: ptr, radius: number, height: number): ptr;
CapsuleCharacterController_new(collisionWorld: ptr, ptrBtCapsuleCharacterControllerDesc: ptr, userObjectPointer: ptr): ptr;
CapsuleCharacterController_setRadius(ptrCCT: ptr, radius: number): void;
CapsuleCharacterController_setHeight(ptrCCT: ptr, height: number): void;
BoxCharacterControllerDesc_new(maxSlopeRadians: number, stepHeight: number, contactOffset: number,
ptrUpAxis: ptr, ptrInitPos: ptr, ptruUserControllerHitReport: ptr, halfHeight: number, halfSideExtent: number, halfForwardExtent: number): ptr;
BoxCharacterController_new(collisionWorld: ptr, ptrBtBoxCharacterControllerDesc: ptr, userObjectPointer: ptr): ptr;
BoxCharacterController_setHalfHeight(ptrCCT: ptr, v: number): void;
BoxCharacterController_setHalfSideExtent(ptrCCT: ptr, v: number): void;
BoxCharacterController_setHalfForwardExtent(ptrCCT: ptr, v: number): void;
}
}

Binary file not shown.

View File

@ -1,23 +0,0 @@
declare module 'external:emscripten/*.wasm' {
/**
* This is a wasm url relative from build output chunk.
*/
const wasmPath: string;
export default wasmPath;
}
declare module 'external:emscripten/*.wasm.fallback' {
/**
* This is a wasm fallback url relative from build output chunk.
*/
const wasmFallbackPath: string;
export default wasmFallbackPath;
}
declare module 'external:emscripten/*.js.mem' {
/**
* This is a js.mem url relative from build output chunk.
*/
const jsMemPath: string;
export default jsMemPath;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,35 +0,0 @@
declare module 'external:emscripten/meshopt/meshopt_decoder.asm.js' {
namespace MeshoptDecoder {
const supported: boolean;
const ready: Promise<void>;
function decodeVertexBuffer (target: Uint8Array, count: number, size: number, source: Uint8Array, filter?: string): void;
function decodeIndexBuffer (target: Uint8Array, count: number, size: number, source: Uint8Array): void;
function decodeIndexSequence (target: Uint8Array, count: number, size: number, source: Uint8Array): void;
function decodeGltfBuffer (target: Uint8Array, count: number, size: number, source: Uint8Array, mode: string, filter?: string): void;
function useWorkers (count: number): void;
function decodeGltfBufferAsync (count: number, size: number, source: Uint8Array, mode: string, filter?: string): Promise<Uint8Array>;
}
export default MeshoptDecoder;
}
declare module 'external:emscripten/meshopt/meshopt_decoder.wasm.js' {
namespace MeshoptDecoder {
const supported: boolean;
const ready: (instantiateWasm: any) => Promise<void>;
function decodeVertexBuffer (target: Uint8Array, count: number, size: number, source: Uint8Array, filter?: string): void;
function decodeIndexBuffer (target: Uint8Array, count: number, size: number, source: Uint8Array): void;
function decodeIndexSequence (target: Uint8Array, count: number, size: number, source: Uint8Array): void;
function decodeGltfBuffer (target: Uint8Array, count: number, size: number, source: Uint8Array, mode: string, filter?: string): void;
function useWorkers (count: number): void;
function decodeGltfBufferAsync (count: number, size: number, source: Uint8Array, mode: string, filter?: string): Promise<Uint8Array>;
}
export default MeshoptDecoder;
}

View File

@ -1,156 +0,0 @@
// This file is part of meshoptimizer library and is distributed under the terms of MIT License.
// Copyright (C) 2016-2023, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
var MeshoptDecoder = (function() {
"use strict";
var instance;
var supported = false;
var ready = (instantiateWasm = {}) => {
if (typeof instantiateWasm !== 'function') {
return Promise.reject(new Error('No wasm support detected'));
}
return instantiateWasm().then(function(result) {
supported = true;
instance = result.instance;
instance.exports.__wasm_call_ctors();
});
}
function decode(fun, target, count, size, source, filter) {
var sbrk = instance.exports.sbrk;
var count4 = (count + 3) & ~3;
var tp = sbrk(count4 * size);
var sp = sbrk(source.length);
var heap = new Uint8Array(instance.exports.memory.buffer);
heap.set(source, sp);
var res = fun(tp, count, size, sp, source.length);
if (res == 0 && filter) {
filter(tp, count4, size);
}
target.set(heap.subarray(tp, tp + count * size));
sbrk(tp - sbrk(0));
if (res != 0) {
throw new Error("Malformed buffer data: " + res);
}
}
var filters = {
NONE: "",
OCTAHEDRAL: "meshopt_decodeFilterOct",
QUATERNION: "meshopt_decodeFilterQuat",
EXPONENTIAL: "meshopt_decodeFilterExp",
};
var decoders = {
ATTRIBUTES: "meshopt_decodeVertexBuffer",
TRIANGLES: "meshopt_decodeIndexBuffer",
INDICES: "meshopt_decodeIndexSequence",
};
var workers = [];
var requestId = 0;
function createWorker(url) {
var worker = {
object: new Worker(url),
pending: 0,
requests: {}
};
worker.object.onmessage = function(event) {
var data = event.data;
worker.pending -= data.count;
worker.requests[data.id][data.action](data.value);
delete worker.requests[data.id];
};
return worker;
}
function initWorkers(count) {
var source =
"var instance; var ready = WebAssembly.instantiate(new Uint8Array([" + new Uint8Array(unpack(wasm)) + "]), {})" +
".then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });" +
"self.onmessage = workerProcess;" +
decode.toString() + workerProcess.toString();
var blob = new Blob([source], {type: 'text/javascript'});
var url = URL.createObjectURL(blob);
for (var i = 0; i < count; ++i) {
workers[i] = createWorker(url);
}
URL.revokeObjectURL(url);
}
function decodeWorker(count, size, source, mode, filter) {
var worker = workers[0];
for (var i = 1; i < workers.length; ++i) {
if (workers[i].pending < worker.pending) {
worker = workers[i];
}
}
return new Promise(function (resolve, reject) {
var data = new Uint8Array(source);
var id = requestId++;
worker.pending += count;
worker.requests[id] = { resolve: resolve, reject: reject };
worker.object.postMessage({ id: id, count: count, size: size, source: data, mode: mode, filter: filter }, [ data.buffer ]);
});
}
function workerProcess(event) {
ready.then(function() {
var data = event.data;
try {
var target = new Uint8Array(data.count * data.size);
decode(instance.exports[data.mode], target, data.count, data.size, data.source, instance.exports[data.filter]);
self.postMessage({ id: data.id, count: data.count, action: "resolve", value: target }, [ target.buffer ]);
} catch (error) {
self.postMessage({ id: data.id, count: data.count, action: "reject", value: error });
}
});
}
return {
ready: ready,
supported: supported,
useWorkers: function(count) {
initWorkers(count);
},
decodeVertexBuffer: function(target, count, size, source, filter) {
decode(instance.exports.meshopt_decodeVertexBuffer, target, count, size, source, instance.exports[filters[filter]]);
},
decodeIndexBuffer: function(target, count, size, source) {
decode(instance.exports.meshopt_decodeIndexBuffer, target, count, size, source);
},
decodeIndexSequence: function(target, count, size, source) {
decode(instance.exports.meshopt_decodeIndexSequence, target, count, size, source);
},
decodeGltfBuffer: function(target, count, size, source, mode, filter) {
decode(instance.exports[decoders[mode]], target, count, size, source, instance.exports[filters[filter]]);
},
decodeGltfBufferAsync: function(count, size, source, mode, filter) {
if (workers.length > 0) {
return decodeWorker(count, size, source, decoders[mode], filters[filter]);
}
return ready.then(function() {
var target = new Uint8Array(count * size);
decode(instance.exports[decoders[mode]], target, count, size, source, instance.exports[filters[filter]]);
return target;
});
}
};
})();
export default MeshoptDecoder;

File diff suppressed because it is too large Load Diff

View File

@ -1,103 +0,0 @@
/// <reference path="./phy.d.ts" />
declare module 'external:emscripten/physx/physx.release.asm.js' {
export default PhysX;
}
declare module 'external:emscripten/physx/physx.release.wasm.js' {
export default PhysX;
}
// tslint:disable
declare function PhysX (moduleOptions?: any): Promise<void>;
declare namespace PhysX {
type Constructor<T = {}> = new (...args: any[]) => T;
type VoidPtr = number;
const NULL: {};
const HEAPF32: Float32Array;
function destroy (obj: PhysX.Type): void;
function castObject<T1, T2 extends PhysX.Type> (obj: T1, fun: Constructor<T2>): T2;
function wrapPointer<T extends PhysX.Type> (params: number, obj: Constructor<T>): T;
function addFunction (params: Function): number;
function getClass (obj: PhysX.Type): void;
function getPointer (obj: PhysX.Type): void;
function getCache (fun: Constructor<PhysX.Type>): void;
function _malloc (byte: number): number;
function _free (...args: any): any;
function compare (obj1: PhysX.Type, obj2: PhysX.Type): boolean;
class GeometryType {
Enum: {
eSPHERE: number,
ePLANE: number,
eCAPSULE: number,
eBOX: number,
eCONVEXMESH: number,
eTRIANGLEMESH: number,
eHEIGHTFIELD: number,
eGEOMETRY_COUNT: number, //!< internal use only!
eINVALID: number //= -1 //!< internal use only!
}
}
const PX_PHYSICS_VERSION: number
interface AllocatorCallback { }
class DefaultErrorCallback implements AllocatorCallback { }
interface ErrorCallback { }
class DefaultAllocator implements ErrorCallback { }
class Foundation { }
function createFoundation (a: number, b: AllocatorCallback, c: ErrorCallback): Foundation
class Transform {
constructor (p: number[], q: number[]);
setPosition (t: number[]): void;
getPosition (): number[];
setQuaternion (t: number[]): void;
getQuaternion (): number[];
}
class Base { }
class Geometry { getType (): number }
class BoxGeometry extends Geometry { constructor (x: number, y: number, z: number); }
class SphereGeometry extends Geometry { constructor (r: number); }
class Material extends Base { }
class Shape extends Base { }
class Actor extends Base {
getGlobalPose (): Transform;
}
class RigidActor extends Actor {
attachShape (shape: Shape): void;
detachShape (shape: Shape, wakeOnLostTouch?: boolean | true): void;
}
class RigidBody extends RigidActor { }
class RigidStatic extends RigidBody { }
class RigidDynamic extends RigidBody { }
class SceneDesc { }
class Scene {
simulate (timeStep: number): void;
fetchResults (b: boolean): void;
getActiveActors (len: number): Actor[];
}
class Physics {
createSceneDesc (): SceneDesc;
createScene (a: SceneDesc): Scene;
createRigidDynamic (a: Transform): RigidDynamic;
createRigidStatic (a: Transform): RigidStatic;
createMaterial (staticFriction: number, dynamicFriction: number, restitution: number): Material;
//shapeFlags = PxShapeFlag:: eVISUALIZATION | PxShapeFlag:: eSCENE_QUERY_SHAPE | PxShapeFlag:: eSIMULATION_SHAPE
createShape (geometry: Geometry, material: Material, isExclusive: boolean | false, shapeFlags: number): Shape;
}
class TolerancesScale { length: number | 1.0; speed: number | 10.0 }
class Pvd { }
function createPhysics (a?: number, b?: Foundation, c?: TolerancesScale, trackOutstandingAllocations?: boolean, e?: Pvd): Physics;
type Type = {}
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,17 +0,0 @@
declare module 'external:emscripten/spine/spine.asm.js' {
export default SpineWasm;
}
declare module 'external:emscripten/spine/spine.wasm.js' {
export default SpineWasm;
}
// tslint:disable
declare function SpineWasm (moduleOptions?: any): Promise<void>;
declare namespace SpineWasm {
interface instance {
spineWasmInit(): void;
spineWasmDestroy(): void;
}
}

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

135
emscripten/webgpu/glslang.js Executable file → Normal file
View File

@ -1,47 +1,116 @@
var Module = (function() {
var Module = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
return ( return (
function(Module) { function(Module) {
Module = Module || {}; Module = Module || {};
var c;c||(c=typeof Module !== 'undefined' ? Module : {});
var c;c||(c=typeof Module !== 'undefined' ? Module : {});var r,t;c.ready=new Promise(function(b,d){r=b;t=d}); c.compileGLSLZeroCopy=function(a,b,d,e){d=!!d;switch(b){case "vertex":var g=0;break;case "fragment":g=4;break;case "compute":g=5;break;default:throw Error("shader_stage must be 'vertex', 'fragment', or 'compute'.");}switch(e||"1.0"){case "1.0":var f=65536;break;case "1.1":f=65792;break;case "1.2":f=66048;break;case "1.3":f=66304;break;case "1.4":f=66560;break;case "1.5":f=66816;break;default:throw Error("spirv_version must be '1.0' ~ '1.5'.");}e=c._malloc(4);b=c._malloc(4);var h=aa([a,g,d,f,e,b]);
c.compileGLSLZeroCopy=function(b,d,e,f){e=!!e;switch(d){case "vertex":var h=0;break;case "fragment":h=4;break;case "compute":h=5;break;default:throw Error("shader_stage must be 'vertex', 'fragment', or 'compute'.");}switch(f||"1.0"){case "1.0":var g=65536;break;case "1.1":g=65792;break;case "1.2":g=66048;break;case "1.3":g=66304;break;case "1.4":g=66560;break;case "1.5":g=66816;break;default:throw Error("spirv_version must be '1.0' ~ '1.5'.");}f=c._malloc(4);d=c._malloc(4);var m=aa([b,h,e,g,f,d]); d=k(e);a=k(b);c._free(e);c._free(b);if(0===h)throw Error("GLSL compilation failed");e={};d/=4;e.data=c.HEAPU32.subarray(d,d+a);e.free=function(){c._destroy_output_buffer(h)};return e};c.compileGLSL=function(a,b,d,e){a=c.compileGLSLZeroCopy(a,b,d,e);b=a.data.slice();a.free();return b};var p={},q;for(q in c)c.hasOwnProperty(q)&&(p[q]=c[q]);var r="./this.program",t=!1,u=!1;t="object"===typeof window;u="function"===typeof importScripts;var v="",w;
e=u(f);b=u(d);c._free(f);c._free(d);if(0===m)throw Error("GLSL compilation failed");f={};e/=4;f.data=c.HEAPU32.subarray(e,e+b);f.free=function(){c._destroy_output_buffer(m)};return f};c.compileGLSL=function(b,d,e,f){b=c.compileGLSLZeroCopy(b,d,e,f);d=b.data.slice();b.free();return d};var v=Object.assign({},c),x="./this.program",y="object"==typeof window,z="function"==typeof importScripts,B="",C; if(t||u)u?v=self.location.href:document.currentScript&&(v=document.currentScript.src),_scriptDir&&(v=_scriptDir),0!==v.indexOf("blob:")?v=v.substr(0,v.lastIndexOf("/")+1):v="",u&&(w=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var x=c.print||console.log.bind(console),y=c.printErr||console.warn.bind(console);for(q in p)p.hasOwnProperty(q)&&(c[q]=p[q]);p=null;c.thisProgram&&(r=c.thisProgram);var A;
if(y||z)z?B=self.location.href:"undefined"!=typeof document&&document.currentScript&&(B=document.currentScript.src),_scriptDir&&(B=_scriptDir),0!==B.indexOf("blob:")?B=B.substr(0,B.replace(/[?#].*/,"").lastIndexOf("/")+1):B="",z&&(C=b=>{var d=new XMLHttpRequest;d.open("GET",b,!1);d.responseType="arraybuffer";d.send(null);return new Uint8Array(d.response)});var ba=c.print||console.log.bind(console),D=c.printErr||console.warn.bind(console);Object.assign(c,v);v=null;c.thisProgram&&(x=c.thisProgram); c.wasmBinary&&(A=c.wasmBinary);"object"!==typeof WebAssembly&&y("no native wasm support detected");function k(a){var b="i32";"*"===b.charAt(b.length-1)&&(b="i32");switch(b){case "i1":return B[a>>0];case "i8":return B[a>>0];case "i16":return ba[a>>1];case "i32":return C[a>>2];case "i64":return C[a>>2];case "float":return ca[a>>2];case "double":return da[a>>3];default:D("invalid type for getValue: "+b)}return null}var E,ea=new WebAssembly.Table({initial:859,maximum:859,element:"anyfunc"}),fa=!1;
var E;c.wasmBinary&&(E=c.wasmBinary);var noExitRuntime=c.noExitRuntime||!0;"object"!=typeof WebAssembly&&F("no native wasm support detected");var G,H=!1,I="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0; function ha(){var a=c._convert_glsl_to_spirv;a||D("Assertion failed: Cannot call unknown function convert_glsl_to_spirv, make sure it is exported");return a}
function J(b,d){for(var e=d+NaN,f=d;b[f]&&!(f>=e);)++f;if(16<f-d&&b.buffer&&I)return I.decode(b.subarray(d,f));for(e="";d<f;){var h=b[d++];if(h&128){var g=b[d++]&63;if(192==(h&224))e+=String.fromCharCode((h&31)<<6|g);else{var m=b[d++]&63;h=224==(h&240)?(h&15)<<12|g<<6|m:(h&7)<<18|g<<12|m<<6|b[d++]&63;65536>h?e+=String.fromCharCode(h):(h-=65536,e+=String.fromCharCode(55296|h>>10,56320|h&1023))}}else e+=String.fromCharCode(h)}return e} function aa(a){var b="string number boolean number number number".split(" "),d={string:function(a){var b=0;if(null!==a&&void 0!==a&&0!==a){var d=(a.length<<2)+1;b=G(d);ia(a,H,b,d)}return b},array:function(a){var b=G(a.length);B.set(a,b);return b}},e=ha(),g=[],f=0;if(a)for(var h=0;h<a.length;h++){var n=d[b[h]];n?(0===f&&(f=ja()),g[h]=n(a[h])):g[h]=a[h]}a=e.apply(null,g);0!==f&&ka(f);return a}var la="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
function K(b,d,e,f){if(0<f){f=e+f-1;for(var h=0;h<b.length;++h){var g=b.charCodeAt(h);if(55296<=g&&57343>=g){var m=b.charCodeAt(++h);g=65536+((g&1023)<<10)|m&1023}if(127>=g){if(e>=f)break;d[e++]=g}else{if(2047>=g){if(e+1>=f)break;d[e++]=192|g>>6}else{if(65535>=g){if(e+2>=f)break;d[e++]=224|g>>12}else{if(e+3>=f)break;d[e++]=240|g>>18;d[e++]=128|g>>12&63}d[e++]=128|g>>6&63}d[e++]=128|g&63}}d[e]=0}}var L,M,N,ca,O,P,da,ea; function I(a,b,d){var e=b+d;for(d=b;a[d]&&!(d>=e);)++d;if(16<d-b&&a.subarray&&la)return la.decode(a.subarray(b,d));for(e="";b<d;){var g=a[b++];if(g&128){var f=a[b++]&63;if(192==(g&224))e+=String.fromCharCode((g&31)<<6|f);else{var h=a[b++]&63;g=224==(g&240)?(g&15)<<12|f<<6|h:(g&7)<<18|f<<12|h<<6|a[b++]&63;65536>g?e+=String.fromCharCode(g):(g-=65536,e+=String.fromCharCode(55296|g>>10,56320|g&1023))}}else e+=String.fromCharCode(g)}return e}
function fa(){var b=G.buffer;L=b;c.HEAP8=M=new Int8Array(b);c.HEAP16=ca=new Int16Array(b);c.HEAP32=O=new Int32Array(b);c.HEAPU8=N=new Uint8Array(b);c.HEAPU16=new Uint16Array(b);c.HEAPU32=P=new Uint32Array(b);c.HEAPF32=da=new Float32Array(b);c.HEAPF64=ea=new Float64Array(b)}var ha=[],ia=[],ja=[];function ka(){var b=c.preRun.shift();ha.unshift(b)}var Q=0,R=null,S=null; function ia(a,b,d,e){if(0<e){e=d+e-1;for(var g=0;g<a.length;++g){var f=a.charCodeAt(g);if(55296<=f&&57343>=f){var h=a.charCodeAt(++g);f=65536+((f&1023)<<10)|h&1023}if(127>=f){if(d>=e)break;b[d++]=f}else{if(2047>=f){if(d+1>=e)break;b[d++]=192|f>>6}else{if(65535>=f){if(d+2>=e)break;b[d++]=224|f>>12}else{if(d+3>=e)break;b[d++]=240|f>>18;b[d++]=128|f>>12&63}b[d++]=128|f>>6&63}b[d++]=128|f&63}}b[d]=0}}"undefined"!==typeof TextDecoder&&new TextDecoder("utf-16le");var J,B,H,ba,C,ca,da;
function F(b){if(c.onAbort)c.onAbort(b);b="Aborted("+b+")";D(b);H=!0;b=new WebAssembly.RuntimeError(b+". Build with -sASSERTIONS for more info.");t(b);throw b;}function la(){return T.startsWith("data:application/octet-stream;base64,")}var T;T="glslang.wasm";if(!la()){var ma=T;T=c.locateFile?c.locateFile(ma,B):B+ma}function na(){var b=T;try{if(b==T&&E)return new Uint8Array(E);if(C)return C(b);throw"both async and sync fetching of the wasm failed";}catch(d){F(d)}} function ma(a){J=a;c.HEAP8=B=new Int8Array(a);c.HEAP16=ba=new Int16Array(a);c.HEAP32=C=new Int32Array(a);c.HEAPU8=H=new Uint8Array(a);c.HEAPU16=new Uint16Array(a);c.HEAPU32=new Uint32Array(a);c.HEAPF32=ca=new Float32Array(a);c.HEAPF64=da=new Float64Array(a)}var na=c.TOTAL_MEMORY||16777216;c.wasmMemory?E=c.wasmMemory:E=new WebAssembly.Memory({initial:na/65536});E&&(J=E.buffer);na=J.byteLength;ma(J);C[84916]=5582704;
function ra(){return E||!y&&!z||"function"!=typeof fetch?Promise.resolve().then(function(){return na()}):fetch(T,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+T+"'";return b.arrayBuffer()}).catch(function(){return na()})}function U(b){for(;0<b.length;)b.shift()(c)} function K(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b();else{var d=b.J;"number"===typeof d?void 0===b.H?c.dynCall_v(d):c.dynCall_vi(d,b.H):d(void 0===b.H?null:b.H)}}}var oa=[],pa=[],qa=[],ra=[];function sa(){var a=c.preRun.shift();oa.unshift(a)}var L=0,M=null,N=null;c.preloadedImages={};c.preloadedAudios={};function D(a){if(c.onAbort)c.onAbort(a);x(a);y(a);fa=!0;throw new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");}
function u(b){var d="i32";d.endsWith("*")&&(d="*");switch(d){case "i1":return M[b>>0];case "i8":return M[b>>0];case "i16":return ca[b>>1];case "i32":return O[b>>2];case "i64":return O[b>>2];case "float":return da[b>>2];case "double":return ea[b>>3];case "*":return P[b>>2];default:F("invalid type for getValue: "+d)}return null}var V={}; function ta(){var a=O;return String.prototype.startsWith?a.startsWith("data:application/octet-stream;base64,"):0===a.indexOf("data:application/octet-stream;base64,")}var O="glslang.wasm";if(!ta()){var ua=O;O=c.locateFile?c.locateFile(ua,v):v+ua}function wa(){try{if(A)return new Uint8Array(A);if(w)return w(O);throw"both async and sync fetching of the wasm failed";}catch(a){D(a)}}
function sa(){if(!W){var b={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:x||"./this.program"},d;for(d in V)void 0===V[d]?delete b[d]:b[d]=V[d];var e=[];for(d in b)e.push(d+"="+b[d]);W=e}return W}var W,ta=[null,[],[]];function X(b){return 0===b%4&&(0!==b%100||0===b%400)}var ua=[31,29,31,30,31,30,31,31,30,31,30,31],va=[31,28,31,30,31,30,31,31,30,31,30,31]; function xa(){return A||!t&&!u||"function"!==typeof fetch?new Promise(function(a){a(wa())}):fetch(O,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+O+"'";return a.arrayBuffer()}).catch(function(){return wa()})}pa.push({J:function(){ya()}});var za=[null,[],[]],P=0;function Aa(){P+=4;return C[P-4>>2]}var Q={},Ba={};
function wa(b){for(var d=0,e=0;e<b.length;++e){var f=b.charCodeAt(e);127>=f?d++:2047>=f?d+=2:55296<=f&&57343>=f?(d+=4,++e):d+=3}d=Array(d+1);K(b,d,0,d.length);return d} function Ca(){if(!R){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:r},b;for(b in Ba)a[b]=Ba[b];var d=[];for(b in a)d.push(b+"="+a[b]);R=d}return R}var R;function S(a){return 0===a%4&&(0!==a%100||0===a%400)}function T(a,b){for(var d=0,e=0;e<=b;d+=a[e++]);return d}var U=[31,29,31,30,31,30,31,31,30,31,30,31],W=[31,28,31,30,31,30,31,31,30,31,30,31];
function xa(b,d,e,f){function h(a,k,l){for(a="number"==typeof a?a.toString():a||"";a.length<k;)a=l[0]+a;return a}function g(a,k){return h(a,k,"0")}function m(a,k){function l(oa){return 0>oa?-1:0<oa?1:0}var A;0===(A=l(a.getFullYear()-k.getFullYear()))&&0===(A=l(a.getMonth()-k.getMonth()))&&(A=l(a.getDate()-k.getDate()));return A}function w(a){switch(a.getDay()){case 0:return new Date(a.getFullYear()-1,11,29);case 1:return a;case 2:return new Date(a.getFullYear(),0,3);case 3:return new Date(a.getFullYear(), function X(a,b){for(a=new Date(a.getTime());0<b;){var d=a.getMonth(),e=(S(a.getFullYear())?U:W)[d];if(b>e-a.getDate())b-=e-a.getDate()+1,a.setDate(1),11>d?a.setMonth(d+1):(a.setMonth(0),a.setFullYear(a.getFullYear()+1));else{a.setDate(a.getDate()+b);break}}return a}
0,2);case 4:return new Date(a.getFullYear(),0,1);case 5:return new Date(a.getFullYear()-1,11,31);case 6:return new Date(a.getFullYear()-1,11,30)}}function p(a){var k=a.v;for(a=new Date((new Date(a.A+1900,0,1)).getTime());0<k;){var l=a.getMonth(),A=(X(a.getFullYear())?ua:va)[l];if(k>A-a.getDate())k-=A-a.getDate()+1,a.setDate(1),11>l?a.setMonth(l+1):(a.setMonth(0),a.setFullYear(a.getFullYear()+1));else{a.setDate(a.getDate()+k);break}}l=new Date(a.getFullYear()+1,0,4);k=w(new Date(a.getFullYear(),0, function Da(a,b,d,e){function g(a,b,d){for(a="number"===typeof a?a.toString():a||"";a.length<b;)a=d[0]+a;return a}function f(a,b){return g(a,b,"0")}function h(a,b){function V(a){return 0>a?-1:0<a?1:0}var d;0===(d=V(a.getFullYear()-b.getFullYear()))&&0===(d=V(a.getMonth()-b.getMonth()))&&(d=V(a.getDate()-b.getDate()));return d}function n(a){switch(a.getDay()){case 0:return new Date(a.getFullYear()-1,11,29);case 1:return a;case 2:return new Date(a.getFullYear(),0,3);case 3:return new Date(a.getFullYear(),
4));l=w(l);return 0>=m(k,a)?0>=m(l,a)?a.getFullYear()+1:a.getFullYear():a.getFullYear()-1}var n=O[f+40>>2];f={H:O[f>>2],G:O[f+4>>2],B:O[f+8>>2],D:O[f+12>>2],C:O[f+16>>2],A:O[f+20>>2],u:O[f+24>>2],v:O[f+28>>2],J:O[f+32>>2],F:O[f+36>>2],I:n?n?J(N,n):"":""};e=e?J(N,e):"";n={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d", 0,2);case 4:return new Date(a.getFullYear(),0,1);case 5:return new Date(a.getFullYear()-1,11,31);case 6:return new Date(a.getFullYear()-1,11,30)}}function z(a){a=X(new Date(a.A+1900,0,1),a.G);var b=n(new Date(a.getFullYear()+1,0,4));return 0>=h(n(new Date(a.getFullYear(),0,4)),a)?0>=h(b,a)?a.getFullYear()+1:a.getFullYear():a.getFullYear()-1}var m=C[e+40>>2];e={N:C[e>>2],M:C[e+4>>2],D:C[e+8>>2],C:C[e+12>>2],B:C[e+16>>2],A:C[e+20>>2],F:C[e+24>>2],G:C[e+28>>2],X:C[e+32>>2],L:C[e+36>>2],O:m?m?I(H,m,void 0):
"%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var q in n)e=e.replace(new RegExp(q,"g"),n[q]);var pa="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),qa="January February March April May June July August September October November December".split(" ");n={"%a":function(a){return pa[a.u].substring(0,3)},"%A":function(a){return pa[a.u]},"%b":function(a){return qa[a.C].substring(0,3)},"%B":function(a){return qa[a.C]}, "":""};d=d?I(H,d,void 0):"";m={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var l in m)d=d.replace(new RegExp(l,"g"),m[l]);var F="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
"%C":function(a){return g((a.A+1900)/100|0,2)},"%d":function(a){return g(a.D,2)},"%e":function(a){return h(a.D,2," ")},"%g":function(a){return p(a).toString().substring(2)},"%G":function(a){return p(a)},"%H":function(a){return g(a.B,2)},"%I":function(a){a=a.B;0==a?a=12:12<a&&(a-=12);return g(a,2)},"%j":function(a){for(var k=0,l=0;l<=a.C-1;k+=(X(a.A+1900)?ua:va)[l++]);return g(a.D+k,3)},"%m":function(a){return g(a.C+1,2)},"%M":function(a){return g(a.G,2)},"%n":function(){return"\n"},"%p":function(a){return 0<= va="January February March April May June July August September October November December".split(" ");m={"%a":function(a){return F[a.F].substring(0,3)},"%A":function(a){return F[a.F]},"%b":function(a){return va[a.B].substring(0,3)},"%B":function(a){return va[a.B]},"%C":function(a){return f((a.A+1900)/100|0,2)},"%d":function(a){return f(a.C,2)},"%e":function(a){return g(a.C,2," ")},"%g":function(a){return z(a).toString().substring(2)},"%G":function(a){return z(a)},"%H":function(a){return f(a.D,2)},
a.B&&12>a.B?"AM":"PM"},"%S":function(a){return g(a.H,2)},"%t":function(){return"\t"},"%u":function(a){return a.u||7},"%U":function(a){return g(Math.floor((a.v+7-a.u)/7),2)},"%V":function(a){var k=Math.floor((a.v+7-(a.u+6)%7)/7);2>=(a.u+371-a.v-2)%7&&k++;if(k)53==k&&(l=(a.u+371-a.v)%7,4==l||3==l&&X(a.A)||(k=1));else{k=52;var l=(a.u+7-a.v-1)%7;(4==l||5==l&&X(a.A%400-1))&&k++}return g(k,2)},"%w":function(a){return a.u},"%W":function(a){return g(Math.floor((a.v+7-(a.u+6)%7)/7),2)},"%y":function(a){return(a.A+ "%I":function(a){a=a.D;0==a?a=12:12<a&&(a-=12);return f(a,2)},"%j":function(a){return f(a.C+T(S(a.A+1900)?U:W,a.B-1),3)},"%m":function(a){return f(a.B+1,2)},"%M":function(a){return f(a.M,2)},"%n":function(){return"\n"},"%p":function(a){return 0<=a.D&&12>a.D?"AM":"PM"},"%S":function(a){return f(a.N,2)},"%t":function(){return"\t"},"%u":function(a){return a.F||7},"%U":function(a){var b=new Date(a.A+1900,0,1),d=0===b.getDay()?b:X(b,7-b.getDay());a=new Date(a.A+1900,a.B,a.C);return 0>h(d,a)?f(Math.ceil((31-
1900).toString().substring(2)},"%Y":function(a){return a.A+1900},"%z":function(a){a=a.F;var k=0<=a;a=Math.abs(a)/60;return(k?"+":"-")+String("0000"+(a/60*100+a%60)).slice(-4)},"%Z":function(a){return a.I},"%%":function(){return"%"}};e=e.replace(/%%/g,"\x00\x00");for(q in n)e.includes(q)&&(e=e.replace(new RegExp(q,"g"),n[q](f)));e=e.replace(/\0\0/g,"%");q=wa(e);if(q.length>d)return 0;M.set(q,b);return q.length-1} d.getDate()+(T(S(a.getFullYear())?U:W,a.getMonth()-1)-31)+a.getDate())/7),2):0===h(d,b)?"01":"00"},"%V":function(a){var b=n(new Date(a.A+1900,0,4)),d=n(new Date(a.A+1901,0,4)),e=X(new Date(a.A+1900,0,1),a.G);return 0>h(e,b)?"53":0>=h(d,e)?"01":f(Math.ceil((b.getFullYear()<a.A+1900?a.G+32-b.getDate():a.G+1-b.getDate())/7),2)},"%w":function(a){return a.F},"%W":function(a){var b=new Date(a.A,0,1),d=1===b.getDay()?b:X(b,0===b.getDay()?1:7-b.getDay()+1);a=new Date(a.A+1900,a.B,a.C);return 0>h(d,a)?f(Math.ceil((31-
function aa(b){var d="string number boolean number number number".split(" "),e={string:p=>{var n=0;if(null!==p&&void 0!==p&&0!==p){var q=(p.length<<2)+1;n=Y(q);K(p,N,n,q)}return n},array:p=>{var n=Y(p.length);M.set(p,n);return n}},f=c._convert_glsl_to_spirv,h=[],g=0;if(b)for(var m=0;m<b.length;m++){var w=e[d[m]];w?(0===g&&(g=ya()),h[m]=w(b[m])):h[m]=b[m]}b=f.apply(null,h);return b=function(p){0!==g&&za(g);return p}(b)} d.getDate()+(T(S(a.getFullYear())?U:W,a.getMonth()-1)-31)+a.getDate())/7),2):0===h(d,b)?"01":"00"},"%y":function(a){return(a.A+1900).toString().substring(2)},"%Y":function(a){return a.A+1900},"%z":function(a){a=a.L;var b=0<=a;a=Math.abs(a)/60;return(b?"+":"-")+String("0000"+(a/60*100+a%60)).slice(-4)},"%Z":function(a){return a.O},"%%":function(){return"%"}};for(l in m)0<=d.indexOf(l)&&(d=d.replace(new RegExp(l,"g"),m[l](e)));l=Ea(d);if(l.length>b)return 0;B.set(l,a);return l.length-1}
var Aa={b:function(){F("")},i:function(b,d,e){N.copyWithin(b,d,d+e)},g:function(b){var d=N.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var f=d*(1+.2/e);f=Math.min(f,b+100663296);var h=Math;f=Math.max(b,f);h=h.min.call(h,2147483648,f+(65536-f%65536)%65536);a:{try{G.grow(h-L.byteLength+65535>>>16);fa();var g=1;break a}catch(m){}g=void 0}if(g)return!0}return!1},e:function(b,d){var e=0;sa().forEach(function(f,h){var g=d+e;h=P[b+4*h>>2]=g;for(g=0;g<f.length;++g)M[h++>>0]=f.charCodeAt(g); function Ea(a){for(var b=0,d=0;d<a.length;++d){var e=a.charCodeAt(d);55296<=e&&57343>=e&&(e=65536+((e&1023)<<10)|a.charCodeAt(++d)&1023);127>=e?++b:b=2047>=e?b+2:65535>=e?b+3:b+4}b=Array(b+1);ia(a,b,0,b.length);return b}
M[h>>0]=0;e+=f.length+1});return 0},f:function(b,d){var e=sa();P[b>>2]=e.length;var f=0;e.forEach(function(h){f+=h.length+1});P[d>>2]=f;return 0},h:function(){return 52},c:function(){return 70},a:function(b,d,e,f){for(var h=0,g=0;g<e;g++){var m=P[d>>2],w=P[d+4>>2];d+=8;for(var p=0;p<w;p++){var n=N[m+p],q=ta[b];0===n||10===n?((1===b?ba:D)(J(q,0)),q.length=0):q.push(n)}h+=w}P[f>>2]=h;return 0},d:function(b,d,e,f){return xa(b,d,e,f)}}; var Ga={f:function(){},c:function(){c.___errno_location&&(C[c.___errno_location()>>2]=63);return-1},n:function(a,b){P=b;try{var d=Aa();var e=Aa();if(-1===d||0===e)var g=-28;else{var f=Q.K[d];if(f&&e===f.U){var h=(void 0).T(f.S);Q.R(d,h,e,f.flags,f.offset);(void 0).W(h);Q.K[d]=null;f.P&&Fa(f.V)}g=0}return g}catch(n){return D(n),-n.I}},a:function(){},b:function(){D()},k:function(a,b,d){H.set(H.subarray(b,b+d),a)},l:function(a){var b=B.length;if(2147418112<a)return!1;for(var d=1;4>=d;d*=2){var e=b*(1+
(function(){function b(h){c.asm=h.exports;G=c.asm.j;fa();ia.unshift(c.asm.k);Q--;c.monitorRunDependencies&&c.monitorRunDependencies(Q);0==Q&&(null!==R&&(clearInterval(R),R=null),S&&(h=S,S=null,h()))}function d(h){b(h.instance)}function e(h){return ra().then(function(g){return WebAssembly.instantiate(g,f)}).then(function(g){return g}).then(h,function(g){D("failed to asynchronously prepare wasm: "+g);F(g)})}var f={a:Aa};Q++;c.monitorRunDependencies&&c.monitorRunDependencies(Q);if(c.instantiateWasm)try{return c.instantiateWasm(f, .2/d);e=Math.min(e,a+100663296);e=Math.max(16777216,a,e);0<e%65536&&(e+=65536-e%65536);a:{try{E.grow(Math.min(2147418112,e)-J.byteLength+65535>>16);ma(E.buffer);var g=1;break a}catch(f){}g=void 0}if(g)return!0}return!1},d:function(a,b){var d=0;Ca().forEach(function(e,g){var f=b+d;g=C[a+4*g>>2]=f;for(f=0;f<e.length;++f)B[g++>>0]=e.charCodeAt(f);B[g>>0]=0;d+=e.length+1});return 0},e:function(a,b){var d=Ca();C[a>>2]=d.length;var e=0;d.forEach(function(a){e+=a.length+1});C[b>>2]=e;return 0},h:function(){return 0},
b)}catch(h){return D("Module.instantiateWasm callback failed with error: "+h),!1}(function(){return E||"function"!=typeof WebAssembly.instantiateStreaming||la()||"function"!=typeof fetch?e(d):fetch(T,{credentials:"same-origin"}).then(function(h){return WebAssembly.instantiateStreaming(h,f).then(d,function(g){D("wasm streaming compile failed: "+g);D("falling back to ArrayBuffer instantiation");return e(d)})})})().catch(t);return{}})(); j:function(){return 0},g:function(a,b,d,e){try{for(var g=0,f=0;f<d;f++){for(var h=C[b+8*f>>2],n=C[b+(8*f+4)>>2],z=0;z<n;z++){var m=H[h+z],l=za[a];0===m||10===m?((1===a?x:y)(I(l,0)),l.length=0):l.push(m)}g+=n}C[e>>2]=g;return 0}catch(F){return D(F),F.I}},memory:E,o:function(){},i:function(){},m:function(a,b,d,e){return Da(a,b,d,e)},table:ea},Ha=function(){function a(a){c.asm=a.exports;L--;c.monitorRunDependencies&&c.monitorRunDependencies(L);0==L&&(null!==M&&(clearInterval(M),M=null),N&&(a=N,N=null,
c.___wasm_call_ctors=function(){return(c.___wasm_call_ctors=c.asm.k).apply(null,arguments)};c._convert_glsl_to_spirv=function(){return(c._convert_glsl_to_spirv=c.asm.l).apply(null,arguments)};c._destroy_output_buffer=function(){return(c._destroy_output_buffer=c.asm.m).apply(null,arguments)};c._malloc=function(){return(c._malloc=c.asm.o).apply(null,arguments)};c._free=function(){return(c._free=c.asm.p).apply(null,arguments)}; a()))}function b(b){a(b.instance)}function d(a){return xa().then(function(a){return WebAssembly.instantiate(a,e)}).then(a,function(a){y("failed to asynchronously prepare wasm: "+a);D(a)})}var e={env:Ga,wasi_snapshot_preview1:Ga};L++;c.monitorRunDependencies&&c.monitorRunDependencies(L);if(c.instantiateWasm)try{return c.instantiateWasm(e,a)}catch(g){return y("Module.instantiateWasm callback failed with error: "+g),!1}(function(){if(A||"function"!==typeof WebAssembly.instantiateStreaming||ta()||"function"!==
var ya=c.stackSave=function(){return(ya=c.stackSave=c.asm.q).apply(null,arguments)},za=c.stackRestore=function(){return(za=c.stackRestore=c.asm.r).apply(null,arguments)},Y=c.stackAlloc=function(){return(Y=c.stackAlloc=c.asm.s).apply(null,arguments)},Z;S=function Ba(){Z||Ca();Z||(S=Ba)}; typeof fetch)return d(b);fetch(O,{credentials:"same-origin"}).then(function(a){return WebAssembly.instantiateStreaming(a,e).then(b,function(a){y("wasm streaming compile failed: "+a);y("falling back to ArrayBuffer instantiation");d(b)})})})();return{}}();c.asm=Ha;var ya=c.___wasm_call_ctors=function(){return(ya=c.___wasm_call_ctors=c.asm.p).apply(null,arguments)};c._convert_glsl_to_spirv=function(){return(c._convert_glsl_to_spirv=c.asm.q).apply(null,arguments)};
function Ca(){function b(){if(!Z&&(Z=!0,c.calledRun=!0,!H)){U(ia);r(c);if(c.onRuntimeInitialized)c.onRuntimeInitialized();if(c.postRun)for("function"==typeof c.postRun&&(c.postRun=[c.postRun]);c.postRun.length;){var d=c.postRun.shift();ja.unshift(d)}U(ja)}}if(!(0<Q)){if(c.preRun)for("function"==typeof c.preRun&&(c.preRun=[c.preRun]);c.preRun.length;)ka();U(ha);0<Q||(c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1);b()},1)):b())}} c._destroy_output_buffer=function(){return(c._destroy_output_buffer=c.asm.r).apply(null,arguments)};c._malloc=function(){return(c._malloc=c.asm.s).apply(null,arguments)};var Fa=c._free=function(){return(Fa=c._free=c.asm.t).apply(null,arguments)},ja=c.stackSave=function(){return(ja=c.stackSave=c.asm.u).apply(null,arguments)},G=c.stackAlloc=function(){return(G=c.stackAlloc=c.asm.v).apply(null,arguments)},ka=c.stackRestore=function(){return(ka=c.stackRestore=c.asm.w).apply(null,arguments)};
if(c.preInit)for("function"==typeof c.preInit&&(c.preInit=[c.preInit]);0<c.preInit.length;)c.preInit.pop()();Ca(); c.dynCall_vi=function(){return(c.dynCall_vi=c.asm.x).apply(null,arguments)};c.dynCall_v=function(){return(c.dynCall_v=c.asm.y).apply(null,arguments)};c.asm=Ha;var Y;c.then=function(a){if(Y)a(c);else{var b=c.onRuntimeInitialized;c.onRuntimeInitialized=function(){b&&b();a(c)}}return c};N=function Ia(){Y||Z();Y||(N=Ia)};
function Z(){function a(){if(!Y&&(Y=!0,!fa)){K(pa);K(qa);if(c.onRuntimeInitialized)c.onRuntimeInitialized();if(c.postRun)for("function"==typeof c.postRun&&(c.postRun=[c.postRun]);c.postRun.length;){var a=c.postRun.shift();ra.unshift(a)}K(ra)}}if(!(0<L)){if(c.preRun)for("function"==typeof c.preRun&&(c.preRun=[c.preRun]);c.preRun.length;)sa();K(oa);0<L||(c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1);a()},1)):a())}}c.run=Z;
if(c.preInit)for("function"==typeof c.preInit&&(c.preInit=[c.preInit]);0<c.preInit.length;)c.preInit.pop()();Z();
return Module.ready return Module
} }
); );
})(); })();
// if (typeof exports === 'object' && typeof module === 'object')
// module.exports = Module;
// else if (typeof define === 'function' && define['amd'])
// define([], function() { return Module; });
// else if (typeof exports === 'object')
// exports["Module"] = Module;
// export default (() => {
// const initialize = () => {
// return new Promise(resolve => {
// Module({
// locateFile() {
// const i = import.meta.url.lastIndexOf('/')
// return import.meta.url.substring(0, i) + '/glslang.wasm';
// },
// onRuntimeInitialized() {
// resolve({
// compileGLSLZeroCopy: this.compileGLSLZeroCopy,
// compileGLSL: this.compileGLSL,
// });
// },
// });
// });
// };
// let instance;
// return () => {
// if (!instance) {
// instance = initialize();
// }
// return instance;
// };
// })();
// (function tryToExport(root, factory) {
// if (typeof exports === 'object' && typeof module === 'object')
// module.exports = factory();
// else if (typeof define === 'function' && define.amd)
// define("glslang", [], factory);
// else if (typeof exports === 'object')
// exports["glslang"] = factory();
// else
// root["glslang"] = factory();
// })(typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : this, () => {
// const initialize = (wasmPath) => {
// wasmPath = 'http://localhost:7456/glslang.wasm'
// return new Promise(resolve => {
// Module({
// locateFile() {
// return wasmPath;
// },
// onRuntimeInitialized() {
// resolve({
// compileGLSLZeroCopy: this.compileGLSLZeroCopy,
// compileGLSL: this.compileGLSL,
// });
// },
// });
// });
// };
// let instance;
// return (wasmPath) => {
// if (!instance) {
// instance = initialize(wasmPath);
// }
// return instance;
// };
// });
const initialize = (wasmPath) => { const initialize = (wasmPath) => {
return new Promise(resolve => { return new Promise(resolve => {

BIN
emscripten/webgpu/glslang.wasm Executable file → Normal file

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -1,14 +0,0 @@
declare module 'external:emscripten/webgpu/webgpu_wasm.js' {
function factory (gfx: any): Promise<any>;
export default factory;
}
declare module 'external:emscripten/webgpu/glslang.js' {
function factory (wasmUrl: string): Promise<any>;
export default factory;
}
declare module 'external:emscripten/webgpu/twgsl.js' {
function factory (gfx: any): Promise<any>;
export default factory;
}

File diff suppressed because one or more lines are too long

BIN
emscripten/webgpu/webgpu_wasm.wasm Executable file → Normal file

Binary file not shown.

Binary file not shown.

6
linux/bin/swig/share/swig/4.1.0/allkw.swg Normal file → Executable file
View File

@ -1,5 +1,5 @@
#ifndef SWIG_INCLUDED_LIB_ALLKW_SWG #ifndef __Lib_allkw_swg__
#define SWIG_INCLUDED_LIB_ALLKW_SWG #define __Lib_allkw_swg__
/* /*
@ -30,4 +30,4 @@
%include <tcl/tclkw.swg> %include <tcl/tclkw.swg>
#endif // SWIG_INCLUDED_LIB_ALLKW_SWG #endif //__Lib_allkw_swg__

0
linux/bin/swig/share/swig/4.1.0/attribute.i Normal file → Executable file
View File

0
linux/bin/swig/share/swig/4.1.0/carrays.i Normal file → Executable file
View File

0
linux/bin/swig/share/swig/4.1.0/cdata.i Normal file → Executable file
View File

View File

@ -0,0 +1,294 @@
/* Define a C preprocessor symbol that can be used in interface files
to distinguish between the SWIG language modules. */
#define SWIG_CFFI
/* Typespecs for basic types. */
%typemap(cin) void ":void";
%typemap(cin) char ":char";
%typemap(cin) char * ":string";
%typemap(cin) unsigned char ":unsigned-char";
%typemap(cin) signed char ":char";
%typemap(cin) short ":short";
%typemap(cin) signed short ":short";
%typemap(cin) unsigned short ":unsigned-short";
%typemap(cin) int ":int";
%typemap(cin) signed int ":int";
%typemap(cin) unsigned int ":unsigned-int";
%typemap(cin) long ":long";
%typemap(cin) signed long ":long";
%typemap(cin) unsigned long ":unsigned-long";
%typemap(cin) long long ":long-long";
%typemap(cin) signed long long ":long-long";
%typemap(cin) unsigned long long ":unsigned-long-long";
%typemap(cin) float ":float";
%typemap(cin) double ":double";
%typemap(cin) SWIGTYPE ":pointer";
%typemap(cout) void ":void";
%typemap(cout) char ":char";
%typemap(cout) char * ":string";
%typemap(cout) unsigned char ":unsigned-char";
%typemap(cout) signed char ":char";
%typemap(cout) short ":short";
%typemap(cout) signed short ":short";
%typemap(cout) unsigned short ":unsigned-short";
%typemap(cout) int ":int";
%typemap(cout) signed int ":int";
%typemap(cout) unsigned int ":unsigned-int";
%typemap(cout) long ":long";
%typemap(cout) signed long ":long";
%typemap(cout) unsigned long ":unsigned-long";
%typemap(cout) long long ":long-long";
%typemap(cout) signed long long ":long-long";
%typemap(cout) unsigned long long ":unsigned-long-long";
%typemap(cout) float ":float";
%typemap(cout) double ":double";
%typemap(cout) SWIGTYPE ":pointer";
%typemap(ctype) bool "int";
%typemap(ctype) char, unsigned char, signed char,
short, signed short, unsigned short,
int, signed int, unsigned int,
long, signed long, unsigned long,
float, double, long double, char *, void *, void,
enum SWIGTYPE, SWIGTYPE *,
SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1_ltype";
%typemap(ctype) SWIGTYPE "$&1_type";
%typemap(in) bool "$1 = (bool)$input;";
%typemap(in) char, unsigned char, signed char,
short, signed short, unsigned short,
int, signed int, unsigned int,
long, signed long, unsigned long,
float, double, long double, char *, void *, void,
enum SWIGTYPE, SWIGTYPE *,
SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1 = $input;";
%typemap(in) SWIGTYPE "$1 = *$input;";
%typemap(out) void "";
%typemap(out) bool "$result = (int)$1;";
%typemap(out) char, unsigned char, signed char,
short, signed short, unsigned short,
int, signed int, unsigned int,
long, signed long, unsigned long,
float, double, long double, char *, void *,
enum SWIGTYPE, SWIGTYPE *,
SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$result = $1;";
#ifdef __cplusplus
%typemap(out) SWIGTYPE "$result = new $1_type($1);";
#else
%typemap(out) SWIGTYPE {
$result = ($&1_ltype) malloc(sizeof($1_type));
memmove($result, &$1, sizeof($1_type));
}
#endif
%typecheck(SWIG_TYPECHECK_BOOL) bool { $1 = 1; };
%typecheck(SWIG_TYPECHECK_CHAR) char { $1 = 1; };
%typecheck(SWIG_TYPECHECK_FLOAT) float { $1 = 1; };
%typecheck(SWIG_TYPECHECK_DOUBLE) double { $1 = 1; };
%typecheck(SWIG_TYPECHECK_STRING) char * { $1 = 1; };
%typecheck(SWIG_TYPECHECK_INTEGER)
unsigned char, signed char,
short, signed short, unsigned short,
int, signed int, unsigned int,
long, signed long, unsigned long,
enum SWIGTYPE { $1 = 1; };
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&,
SWIGTYPE[ANY], SWIGTYPE { $1 = 1; };
/* This maps C/C++ types to Lisp classes for overload dispatch */
%typemap(lisptype) bool "cl:boolean";
%typemap(lisptype) char "cl:character";
%typemap(lisptype) unsigned char "cl:integer";
%typemap(lisptype) signed char "cl:integer";
%typemap(lispclass) bool "t";
%typemap(lispclass) char "cl:character";
%typemap(lispclass) unsigned char, signed char,
short, signed short, unsigned short,
int, signed int, unsigned int,
long, signed long, unsigned long,
enum SWIGTYPE "cl:integer";
/* CLOS methods can't be specialized on single-float or double-float */
%typemap(lispclass) float "cl:number";
%typemap(lispclass) double "cl:number";
%typemap(lispclass) char * "cl:string";
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
%{
#ifdef __cplusplus
# define EXTERN extern "C"
#else
# define EXTERN extern
#endif
#define EXPORT EXTERN SWIGEXPORT
#include <string.h>
%}
%insert("swiglisp") %{
;;;SWIG wrapper code starts here
(cl:defmacro defanonenum (cl:&body enums)
"Converts anonymous enums to defconstants."
`(cl:progn ,@(cl:loop for value in enums
for index = 0 then (cl:1+ index)
when (cl:listp value) do (cl:setf index (cl:second value)
value (cl:first value))
collect `(cl:defconstant ,value ,index))))
(cl:eval-when (:compile-toplevel :load-toplevel)
(cl:unless (cl:fboundp 'swig-lispify)
(cl:defun swig-lispify (name flag cl:&optional (package cl:*package*))
(cl:labels ((helper (lst last rest cl:&aux (c (cl:car lst)))
(cl:cond
((cl:null lst)
rest)
((cl:upper-case-p c)
(helper (cl:cdr lst) 'upper
(cl:case last
((lower digit) (cl:list* c #\- rest))
(cl:t (cl:cons c rest)))))
((cl:lower-case-p c)
(helper (cl:cdr lst) 'lower (cl:cons (cl:char-upcase c) rest)))
((cl:digit-char-p c)
(helper (cl:cdr lst) 'digit
(cl:case last
((upper lower) (cl:list* c #\- rest))
(cl:t (cl:cons c rest)))))
((cl:char-equal c #\_)
(helper (cl:cdr lst) '_ (cl:cons #\- rest)))
(cl:t
(cl:error "Invalid character: ~A" c)))))
(cl:let ((fix (cl:case flag
((constant enumvalue) "+")
(variable "*")
(cl:t ""))))
(cl:intern
(cl:concatenate
'cl:string
fix
(cl:nreverse (helper (cl:concatenate 'cl:list name) cl:nil cl:nil))
fix)
package))))))
;;;SWIG wrapper code ends here
%}
#ifdef __cplusplus
%typemap(out) SWIGTYPE "$result = new $1_type($1);";
#else
%typemap(out) SWIGTYPE {
$result = ($&1_ltype) malloc(sizeof($1_type));
memmove($result, &$1, sizeof($1_type));
}
#endif
//////////////////////////////////////////////////////////////
/* name conversion for overloaded operators. */
#ifdef __cplusplus
%rename(__add__) *::operator+;
%rename(__pos__) *::operator+();
%rename(__pos__) *::operator+() const;
%rename(__sub__) *::operator-;
%rename(__neg__) *::operator-() const;
%rename(__neg__) *::operator-();
%rename(__mul__) *::operator*;
%rename(__deref__) *::operator*();
%rename(__deref__) *::operator*() const;
%rename(__div__) *::operator/;
%rename(__mod__) *::operator%;
%rename(__logxor__) *::operator^;
%rename(__logand__) *::operator&;
%rename(__logior__) *::operator|;
%rename(__lognot__) *::operator~();
%rename(__lognot__) *::operator~() const;
%rename(__not__) *::operator!();
%rename(__not__) *::operator!() const;
%rename(__assign__) *::operator=;
%rename(__add_assign__) *::operator+=;
%rename(__sub_assign__) *::operator-=;
%rename(__mul_assign__) *::operator*=;
%rename(__div_assign__) *::operator/=;
%rename(__mod_assign__) *::operator%=;
%rename(__logxor_assign__) *::operator^=;
%rename(__logand_assign__) *::operator&=;
%rename(__logior_assign__) *::operator|=;
%rename(__lshift__) *::operator<<;
%rename(__lshift_assign__) *::operator<<=;
%rename(__rshift__) *::operator>>;
%rename(__rshift_assign__) *::operator>>=;
%rename(__eq__) *::operator==;
%rename(__ne__) *::operator!=;
%rename(__lt__) *::operator<;
%rename(__gt__) *::operator>;
%rename(__lte__) *::operator<=;
%rename(__gte__) *::operator>=;
%rename(__and__) *::operator&&;
%rename(__or__) *::operator||;
%rename(__preincr__) *::operator++();
%rename(__postincr__) *::operator++(int);
%rename(__predecr__) *::operator--();
%rename(__postdecr__) *::operator--(int);
%rename(__comma__) *::operator,();
%rename(__comma__) *::operator,() const;
%rename(__member_ref__) *::operator->;
%rename(__member_func_ref__) *::operator->*;
%rename(__funcall__) *::operator();
%rename(__aref__) *::operator[];
#endif
%{
#ifdef __cplusplus
# define EXTERN extern "C"
#else
# define EXTERN extern
#endif
#define EXPORT EXTERN SWIGEXPORT
#include <string.h>
#include <stdlib.h>
%}

0
linux/bin/swig/share/swig/4.1.0/cmalloc.i Normal file → Executable file
View File

0
linux/bin/swig/share/swig/4.1.0/constraints.i Normal file → Executable file
View File

0
linux/bin/swig/share/swig/4.1.0/cpointer.i Normal file → Executable file
View File

View File

@ -0,0 +1,179 @@
/* -----------------------------------------------------------------------------
* arrays_csharp.i
*
* This file contains a two approaches to marshaling arrays. The first uses
* default p/invoke marshaling and the second uses pinning of the arrays.
*
* Default marshaling approach
* ----------------------------
* Array typemaps using default p/invoke marshaling. The data is copied to a separately
* allocated buffer when passing over the managed-native boundary.
*
* There are separate typemaps for in, out and inout arrays to enable avoiding
* unnecessary copying.
*
* Example usage:
*
* %include "arrays_csharp.i"
* %apply int INPUT[] { int* sourceArray }
* %apply int OUTPUT[] { int* targetArray }
* void myArrayCopy( int* sourceArray, int* targetArray, int nitems );
*
* %apply int INOUT[] { int* array1, int *array2 }
* void myArraySwap( int* array1, int* array2, int nitems );
*
* If handling large arrays you should consider using the pinning array typemaps
* described next.
*
* Pinning approach
* ----------------
* Array typemaps using pinning. These typemaps pin the managed array given
* as parameter and pass a pointer to it to the c/c++ side. This is very
* efficient as no copying is done (unlike in the default array marshaling),
* but it makes garbage collection more difficult. When considering using
* these typemaps, think carefully whether you have callbacks that may cause
* the control to re-enter the managed side from within the call (and produce
* garbage for the gc) or whether other threads may produce enough garbage to
* trigger gc while the call is being executed. In those cases it may be
* wiser to use the default marshaling typemaps.
*
* Please note that when using fixed arrays, you have to mark your corresponding
* module class method unsafe using
* %csmethodmodifiers "public unsafe"
* (the visibility of the method is up to you).
*
* Example usage:
*
* %include "arrays_csharp.i"
* %apply int FIXED[] { int* sourceArray, int *targetArray }
* %csmethodmodifiers myArrayCopy "public unsafe";
* void myArrayCopy( int *sourceArray, int* targetArray, int nitems );
*
* ----------------------------------------------------------------------------- */
%define CSHARP_ARRAYS( CTYPE, CSTYPE )
// input only arrays
%typemap(ctype) CTYPE INPUT[] "CTYPE*"
%typemap(cstype) CTYPE INPUT[] "CSTYPE[]"
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]") CTYPE INPUT[] "CSTYPE[]"
%typemap(csin) CTYPE INPUT[] "$csinput"
%typemap(in) CTYPE INPUT[] "$1 = $input;"
%typemap(freearg) CTYPE INPUT[] ""
%typemap(argout) CTYPE INPUT[] ""
// output only arrays
%typemap(ctype) CTYPE OUTPUT[] "CTYPE*"
%typemap(cstype) CTYPE OUTPUT[] "CSTYPE[]"
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]") CTYPE OUTPUT[] "CSTYPE[]"
%typemap(csin) CTYPE OUTPUT[] "$csinput"
%typemap(in) CTYPE OUTPUT[] "$1 = $input;"
%typemap(freearg) CTYPE OUTPUT[] ""
%typemap(argout) CTYPE OUTPUT[] ""
// inout arrays
%typemap(ctype) CTYPE INOUT[] "CTYPE*"
%typemap(cstype) CTYPE INOUT[] "CSTYPE[]"
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]") CTYPE INOUT[] "CSTYPE[]"
%typemap(csin) CTYPE INOUT[] "$csinput"
%typemap(in) CTYPE INOUT[] "$1 = $input;"
%typemap(freearg) CTYPE INOUT[] ""
%typemap(argout) CTYPE INOUT[] ""
%enddef // CSHARP_ARRAYS
CSHARP_ARRAYS(signed char, sbyte)
CSHARP_ARRAYS(unsigned char, byte)
CSHARP_ARRAYS(short, short)
CSHARP_ARRAYS(unsigned short, ushort)
CSHARP_ARRAYS(int, int)
CSHARP_ARRAYS(unsigned int, uint)
// FIXME - on Unix 64 bit, long is 8 bytes but is 4 bytes on Windows 64 bit.
// How can this be handled sensibly?
// See e.g. http://www.xml.com/ldd/chapter/book/ch10.html
CSHARP_ARRAYS(long, int)
CSHARP_ARRAYS(unsigned long, uint)
CSHARP_ARRAYS(long long, long)
CSHARP_ARRAYS(unsigned long long, ulong)
CSHARP_ARRAYS(float, float)
CSHARP_ARRAYS(double, double)
// By default C# will marshal bools as 4 bytes
// UnmanagedType.I1 will change this to 1 byte
// FIXME - When running on mono ArraySubType appears to be ignored and bools will be marshalled as 4-byte
// https://github.com/mono/mono/issues/15592
// input only arrays
%typemap(ctype) bool INPUT[] "bool*"
%typemap(cstype) bool INPUT[] "bool[]"
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray,ArraySubType=System.Runtime.InteropServices.UnmanagedType.I1)]") bool INPUT[] "bool[]"
%typemap(csin) bool INPUT[] "$csinput"
%typemap(in) bool INPUT[] %{
$1 = $input;
%}
%typemap(freearg) bool INPUT[] ""
%typemap(argout) bool INPUT[] ""
// output only arrays
%typemap(ctype) bool OUTPUT[] "bool*"
%typemap(cstype) bool OUTPUT[] "bool[]"
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray,ArraySubType=System.Runtime.InteropServices.UnmanagedType.I1)]") bool OUTPUT[] "bool[]"
%typemap(csin) bool OUTPUT[] "$csinput"
%typemap(in) bool OUTPUT[] %{
$1 = $input;
%}
%typemap(freearg) bool OUTPUT[] ""
%typemap(argout) bool OUTPUT[] ""
// inout arrays
%typemap(ctype) bool INOUT[] "bool*"
%typemap(cstype) bool INOUT[] "bool[]"
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray,ArraySubType=System.Runtime.InteropServices.UnmanagedType.I1)]") bool INOUT[] "bool[]"
%typemap(csin) bool INOUT[] "$csinput"
%typemap(in) bool INOUT[] %{
$1 = $input;
%}
%typemap(freearg) bool INOUT[] ""
%typemap(argout) bool INOUT[] ""
%define CSHARP_ARRAYS_FIXED( CTYPE, CSTYPE )
%typemap(ctype) CTYPE FIXED[] "CTYPE*"
%typemap(imtype) CTYPE FIXED[] "global::System.IntPtr"
%typemap(cstype) CTYPE FIXED[] "CSTYPE[]"
%typemap(csin,
pre= " fixed ( CSTYPE* swig_ptrTo_$csinput = $csinput ) {",
terminator=" }")
CTYPE FIXED[] "(global::System.IntPtr)swig_ptrTo_$csinput"
%typemap(in) CTYPE FIXED[] "$1 = $input;"
%typemap(freearg) CTYPE FIXED[] ""
%typemap(argout) CTYPE FIXED[] ""
%enddef // CSHARP_ARRAYS_FIXED
CSHARP_ARRAYS_FIXED(signed char, sbyte)
CSHARP_ARRAYS_FIXED(unsigned char, byte)
CSHARP_ARRAYS_FIXED(short, short)
CSHARP_ARRAYS_FIXED(unsigned short, ushort)
CSHARP_ARRAYS_FIXED(int, int)
CSHARP_ARRAYS_FIXED(unsigned int, uint)
CSHARP_ARRAYS_FIXED(long, int)
CSHARP_ARRAYS_FIXED(unsigned long, uint)
CSHARP_ARRAYS_FIXED(long long, long)
CSHARP_ARRAYS_FIXED(unsigned long long, ulong)
CSHARP_ARRAYS_FIXED(float, float)
CSHARP_ARRAYS_FIXED(double, double)
CSHARP_ARRAYS_FIXED(bool, bool)

View File

@ -0,0 +1,517 @@
// Users can provide their own SWIG_INTRUSIVE_PTR_TYPEMAPS or SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP macros before including this file to change the
// visibility of the constructor and getCPtr method if desired to public if using multiple modules.
#ifndef SWIG_INTRUSIVE_PTR_TYPEMAPS
#define SWIG_INTRUSIVE_PTR_TYPEMAPS(CONST, TYPE...) SWIG_INTRUSIVE_PTR_TYPEMAPS_IMPLEMENTATION(internal, internal, CONST, TYPE)
#endif
#ifndef SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP
#define SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(CONST, TYPE...) SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP_IMPLEMENTATION(internal, internal, CONST, TYPE)
#endif
%include <intrusive_ptr.i>
// Language specific macro implementing all the customisations for handling the smart pointer
%define SWIG_INTRUSIVE_PTR_TYPEMAPS_IMPLEMENTATION(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, CONST, TYPE...)
// %naturalvar is as documented for member variables
%naturalvar TYPE;
%naturalvar SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >;
// destructor wrapper customisation
%feature("unref") TYPE "(void)arg1; delete smartarg1;"
// Typemap customisations...
%typemap(in, canthrow=1) CONST TYPE ($&1_type argp = 0) %{
// plain value
argp = (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0;
if (!argp) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null $1_type", 0);
return $null;
}
$1 = *argp;
%}
%typemap(out, fragment="SWIG_intrusive_deleter") CONST TYPE %{
//plain value(out)
$1_ltype* resultp = new $1_ltype(($1_ltype &)$1);
intrusive_ptr_add_ref(resultp);
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(resultp, SWIG_intrusive_deleter< CONST TYPE >());
%}
%typemap(in, canthrow=1) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
// plain pointer
smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input;
$1 = (TYPE *)(smartarg ? smartarg->get() : 0);
%}
%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") CONST TYPE * %{
//plain pointer(out)
#if ($owner)
if ($1) {
intrusive_ptr_add_ref($1);
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1, SWIG_intrusive_deleter< CONST TYPE >());
} else {
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0;
}
#else
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
#endif
%}
%typemap(in, canthrow=1) CONST TYPE & %{
// plain reference
$1 = ($1_ltype)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0);
if(!$1) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type reference is null", 0);
return $null;
}
%}
%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") CONST TYPE & %{
//plain reference(out)
#if ($owner)
if ($1) {
intrusive_ptr_add_ref($1);
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1, SWIG_intrusive_deleter< CONST TYPE >());
} else {
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0;
}
#else
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0;
#endif
%}
%typemap(in) TYPE *CONST& ($*1_ltype temp = 0) %{
// plain pointer by reference
temp = ($*1_ltype)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0);
$1 = &temp;
%}
%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") TYPE *CONST& %{
// plain pointer by reference(out)
#if ($owner)
if (*$1) {
intrusive_ptr_add_ref(*$1);
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1, SWIG_intrusive_deleter< CONST TYPE >());
} else {
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0;
}
#else
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_0);
#endif
%}
%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{
// intrusive_ptr by value
smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input;
if (smartarg) {
$1 = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true);
}
%}
%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > %{
if ($1) {
intrusive_ptr_add_ref($1.get());
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1.get(), SWIG_intrusive_deleter< CONST TYPE >());
} else {
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0;
}
%}
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast ($&1_type smartarg) %{
// shared_ptr by value
smartarg = *($&1_ltype*)&$input;
if (smartarg) $1 = *smartarg;
%}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > ANY_TYPE_SWIGSharedPtrUpcast %{
*($&1_ltype*)&$result = $1 ? new $1_ltype($1) : 0;
%}
%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & ($*1_ltype tempnull, $*1_ltype temp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{
// intrusive_ptr by reference
if ( $input ) {
smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input;
temp = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true);
$1 = &temp;
} else {
$1 = &tempnull;
}
%}
%typemap(memberin) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & %{
delete &($1);
if ($self) {
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * temp = new SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(*$input);
$1 = *temp;
}
%}
%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & %{
if (*$1) {
intrusive_ptr_add_ref($1->get());
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1->get(), SWIG_intrusive_deleter< CONST TYPE >());
} else {
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0;
}
%}
%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * ($*1_ltype tempnull, $*1_ltype temp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{
// intrusive_ptr by pointer
if ( $input ) {
smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input;
temp = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true);
$1 = &temp;
} else {
$1 = &tempnull;
}
%}
%typemap(memberin) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * %{
delete $1;
if ($self) $1 = new SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(*$input);
%}
%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * %{
if ($1 && *$1) {
intrusive_ptr_add_ref($1->get());
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1->get(), SWIG_intrusive_deleter< CONST TYPE >());
} else {
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0;
}
if ($owner) delete $1;
%}
%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& (SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > temp, $*1_ltype tempp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{
// intrusive_ptr by pointer reference
smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input;
if ($input) {
temp = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true);
}
tempp = &temp;
$1 = &tempp;
%}
%typemap(memberin) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& %{
if ($self) $1 = *$input;
%}
%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& %{
if (*$1 && **$1) {
intrusive_ptr_add_ref((*$1)->get());
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >((*$1)->get(), SWIG_intrusive_deleter< CONST TYPE >());
} else {
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0;
}
%}
// various missing typemaps - If ever used (unlikely) ensure compilation error rather than runtime bug
%typemap(in) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{
#error "typemaps for $1_type not available"
%}
%typemap(out) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{
#error "typemaps for $1_type not available"
%}
%typemap (ctype) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &,
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *,
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "void *"
%typemap (imtype, out="global::System.IntPtr") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &,
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *,
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "global::System.Runtime.InteropServices.HandleRef"
%typemap (cstype) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &,
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *,
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "$typemap(cstype, TYPE)"
%typemap(csin) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &,
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *,
SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "$typemap(cstype, TYPE).getCPtr($csinput)"
%typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > {
global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > {
global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & {
global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * {
global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& {
global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(csvarout, excode=SWIGEXCODE2) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > %{
get {
$typemap(cstype, TYPE) ret = new $typemap(cstype, TYPE)($imcall, true);$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >& %{
get {
$typemap(cstype, TYPE) ret = new $typemap(cstype, TYPE)($imcall, true);$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >* %{
get {
$typemap(cstype, TYPE) ret = new $typemap(cstype, TYPE)($imcall, true);$excode
return ret;
} %}
%typemap(csout, excode=SWIGEXCODE) CONST TYPE {
$typemap(cstype, TYPE) ret = new $typemap(cstype, TYPE)($imcall, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) CONST TYPE & {
$typemap(cstype, TYPE) ret = new $typemap(cstype, TYPE)($imcall, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) CONST TYPE * {
global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) TYPE *CONST& {
global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret;
}
// Base proxy classes
%typemap(csbody) TYPE %{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
private bool swigCMemOwnBase;
PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwnBase = cMemoryOwn;
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
%}
// Derived proxy classes
%typemap(csbody_derived) TYPE %{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
private bool swigCMemOwnDerived;
PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) {
swigCMemOwnDerived = cMemoryOwn;
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
%}
%typemap(csdisposing, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") TYPE {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwnBase) {
swigCMemOwnBase = false;
$imcall;
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
}
}
%typemap(csdisposing_derived, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") TYPE {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwnDerived) {
swigCMemOwnDerived = false;
$imcall;
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
base.Dispose(disposing);
}
}
// CONST version needed ???? also for C#
%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > swigSharedPtrUpcast "global::System.Runtime.InteropServices.HandleRef"
%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast "global::System.Runtime.InteropServices.HandleRef"
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
%template() SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >;
%enddef
/////////////////////////////////////////////////////////////////////
%include <shared_ptr.i>
%define SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP_IMPLEMENTATION(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, CONST, TYPE...)
%naturalvar TYPE;
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
// destructor mods
%feature("unref") TYPE "(void)arg1; delete smartarg1;"
// plain value
%typemap(in, canthrow=1) CONST TYPE ($&1_type argp = 0) %{
argp = (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0;
if (!argp) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null $1_type", 0);
return $null;
}
$1 = *argp; %}
%typemap(out) CONST TYPE
%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %}
// plain pointer
%typemap(in) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input;
$1 = (TYPE *)(smartarg ? smartarg->get() : 0); %}
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE * %{
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0;
%}
// plain reference
%typemap(in, canthrow=1) CONST TYPE & %{
$1 = ($1_ltype)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0);
if (!$1) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type reference is null", 0);
return $null;
} %}
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE &
%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner); %}
// plain pointer by reference
%typemap(in) TYPE *CONST& ($*1_ltype temp = 0)
%{ temp = ($*1_ltype)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0);
$1 = &temp; %}
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST&
%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner); %}
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast ($&1_type smartarg) %{
// shared_ptr by value
smartarg = *($&1_ltype*)&$input;
if (smartarg) $1 = *smartarg;
%}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > ANY_TYPE_SWIGSharedPtrUpcast %{
*($&1_ltype*)&$result = $1 ? new $1_ltype($1) : 0;
%}
// various missing typemaps - If ever used (unlikely) ensure compilation error rather than runtime bug
%typemap(in) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{
#error "typemaps for $1_type not available"
%}
%typemap(out) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{
#error "typemaps for $1_type not available"
%}
%typemap (ctype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "void *"
%typemap (imtype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "void *"
%typemap (cstype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "$typemap(cstype, TYPE)"
%typemap (csin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "$typemap(cstype, TYPE).getCPtr($csinput)"
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > {
global::System.IntPtr cPtr = $imcall;
return (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);
}
%typemap(csout, excode=SWIGEXCODE) CONST TYPE {
return new $typemap(cstype, TYPE)($imcall, true);
}
%typemap(csout, excode=SWIGEXCODE) CONST TYPE & {
return new $typemap(cstype, TYPE)($imcall, true);
}
%typemap(csout, excode=SWIGEXCODE) CONST TYPE * {
global::System.IntPtr cPtr = $imcall;
return (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);
}
%typemap(csout, excode=SWIGEXCODE) TYPE *CONST& {
global::System.IntPtr cPtr = $imcall;
return (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);
}
// Base proxy classes
%typemap(csbody) TYPE %{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
private bool swigCMemOwnBase;
PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwnBase = cMemoryOwn;
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
%}
// Derived proxy classes
%typemap(csbody_derived) TYPE %{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
private bool swigCMemOwnDerived;
PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) {
swigCMemOwnDerived = cMemoryOwn;
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
%}
%typemap(csdisposing, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") TYPE {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwnBase) {
swigCMemOwnBase = false;
$imcall;
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
}
}
%typemap(csdisposing_derived, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") TYPE {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwnDerived) {
swigCMemOwnDerived = false;
$imcall;
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
base.Dispose(disposing);
}
}
// CONST version needed ???? also for C#
%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > swigSharedPtrUpcast "global::System.Runtime.InteropServices.HandleRef"
%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast "global::System.Runtime.InteropServices.HandleRef"
// Typecheck typemaps
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *")
TYPE CONST,
TYPE CONST &,
TYPE CONST *,
TYPE *CONST&,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
""
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
%enddef

View File

@ -0,0 +1,323 @@
// Users can provide their own SWIG_SHARED_PTR_TYPEMAPS macro before including this file to change the
// visibility of the constructor and getCPtr method if desired to public if using multiple modules.
#ifndef SWIG_SHARED_PTR_TYPEMAPS
#define SWIG_SHARED_PTR_TYPEMAPS(CONST, TYPE...) SWIG_SHARED_PTR_TYPEMAPS_IMPLEMENTATION(internal, internal, CONST, TYPE)
#endif
%include <shared_ptr.i>
// Language specific macro implementing all the customisations for handling the smart pointer
%define SWIG_SHARED_PTR_TYPEMAPS_IMPLEMENTATION(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, CONST, TYPE...)
// %naturalvar is as documented for member variables
%naturalvar TYPE;
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
// destructor mods
%feature("unref") TYPE
//"if (debug_shared) { cout << \"deleting use_count: \" << (*smartarg1).use_count() << \" [\" << (boost::get_deleter<SWIG_null_deleter>(*smartarg1) ? std::string(\"CANNOT BE DETERMINED SAFELY\") : ( (*smartarg1).get() ? (*smartarg1)->getValue() : std::string(\"NULL PTR\") )) << \"]\" << endl << flush; }\n"
"(void)arg1; delete smartarg1;"
// Typemap customisations...
// plain value
%typemap(in, canthrow=1) CONST TYPE ($&1_type argp = 0) %{
argp = ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0;
if (!argp) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null $1_type", 0);
return $null;
}
$1 = *argp; %}
%typemap(out) CONST TYPE
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %}
%typemap(directorin) CONST TYPE
%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %}
%typemap(directorout) CONST TYPE
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null $1_type", 0);
return $null;
}
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input;
$result = *smartarg->get();
%}
// plain pointer
%typemap(in, canthrow=1) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input;
$1 = (TYPE *)(smartarg ? smartarg->get() : 0); %}
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE * %{
$result = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0;
%}
%typemap(directorin) CONST TYPE *
%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0; %}
%typemap(directorout) CONST TYPE * %{
#error "typemaps for $1_type not available"
%}
// plain reference
%typemap(in, canthrow=1) CONST TYPE & %{
$1 = ($1_ltype)(((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0);
if (!$1) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type reference is null", 0);
return $null;
} %}
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE &
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner); %}
%typemap(directorin) CONST TYPE &
%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (&$1 SWIG_NO_NULL_DELETER_0); %}
%typemap(directorout) CONST TYPE & %{
#error "typemaps for $1_type not available"
%}
// plain pointer by reference
%typemap(in) TYPE *CONST& ($*1_ltype temp = 0)
%{ temp = (TYPE *)(((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0);
$1 = &temp; %}
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST&
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner); %}
%typemap(directorin) TYPE *CONST&
%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0; %}
%typemap(directorout) TYPE *CONST& %{
#error "typemaps for $1_type not available"
%}
// shared_ptr by value
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
%{ if ($input) $1 = *($&1_ltype)$input; %}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
%{ $result = $1 ? new $1_ltype($1) : 0; %}
%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0; %}
%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
%{ if ($input) {
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input;
$result = *smartarg;
}
%}
// shared_ptr by reference
%typemap(in, canthrow=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & ($*1_ltype tempnull)
%{ $1 = $input ? ($1_ltype)$input : &tempnull; %}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &
%{ $result = *$1 ? new $*1_ltype(*$1) : 0; %}
%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &
%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0; %}
%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
#error "typemaps for $1_type not available"
%}
// shared_ptr by pointer
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * ($*1_ltype tempnull)
%{ $1 = $input ? ($1_ltype)$input : &tempnull; %}
%typemap(out, fragment="SWIG_null_deleter") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *
%{ $result = ($1 && *$1) ? new $*1_ltype(*($1_ltype)$1) : 0;
if ($owner) delete $1; %}
%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *
%{ $input = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0; %}
%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
#error "typemaps for $1_type not available"
%}
// shared_ptr by pointer reference
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempnull, $*1_ltype temp = 0)
%{ temp = $input ? *($1_ltype)&$input : &tempnull;
$1 = &temp; %}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
%{ *($1_ltype)&$result = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0; %}
%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
%{ $input = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0; %}
%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& %{
#error "typemaps for $1_type not available"
%}
// various missing typemaps - If ever used (unlikely) ensure compilation error rather than runtime bug
%typemap(in) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{
#error "typemaps for $1_type not available"
%}
%typemap(out) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{
#error "typemaps for $1_type not available"
%}
%typemap (ctype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "void *"
%typemap (imtype, out="global::System.IntPtr") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "global::System.Runtime.InteropServices.HandleRef"
%typemap (cstype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(cstype, TYPE)"
%typemap(csin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(cstype, TYPE).getCPtr($csinput)"
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > {
global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & {
global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * {
global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& {
global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) CONST TYPE {
$typemap(cstype, TYPE) ret = new $typemap(cstype, TYPE)($imcall, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) CONST TYPE & {
$typemap(cstype, TYPE) ret = new $typemap(cstype, TYPE)($imcall, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) CONST TYPE * {
global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) TYPE *CONST& {
global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(csvarout, excode=SWIGEXCODE2) CONST TYPE & %{
get {
$csclassname ret = new $csclassname($imcall, true);$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) CONST TYPE * %{
get {
global::System.IntPtr cPtr = $imcall;
$csclassname ret = (cPtr == global::System.IntPtr.Zero) ? null : new $csclassname(cPtr, true);$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
get {
global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
get {
global::System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret;
} %}
%typemap(csdirectorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "$typemap(cstype, TYPE).getCPtr($cscall).Handle"
%typemap(csdirectorin) CONST TYPE,
CONST TYPE *,
CONST TYPE &,
TYPE *CONST& "($iminput == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)($iminput, true)"
%typemap(csdirectorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "($iminput == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)($iminput, true)"
// Proxy classes (base classes, ie, not derived classes)
%typemap(csbody) TYPE %{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
private bool swigCMemOwnBase;
PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwnBase = cMemoryOwn;
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
%}
// Derived proxy classes
%typemap(csbody_derived) TYPE %{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
private bool swigCMemOwnDerived;
PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) {
swigCMemOwnDerived = cMemoryOwn;
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
%}
%typemap(csdisposing, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") TYPE {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwnBase) {
swigCMemOwnBase = false;
$imcall;
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
}
}
%typemap(csdisposing_derived, methodname="Dispose", methodmodifiers="protected", parameters="bool disposing") TYPE {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwnDerived) {
swigCMemOwnDerived = false;
$imcall;
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
base.Dispose(disposing);
}
}
// Typecheck typemaps
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *")
TYPE CONST,
TYPE CONST &,
TYPE CONST *,
TYPE *CONST&,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
""
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
%enddef

View File

@ -0,0 +1,5 @@
#ifdef __cplusplus
%include <std_complex.i>
#else
#error C# module only supports complex in C++ mode.
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,339 @@
/* -----------------------------------------------------------------------------
* csharphead.swg
*
* Support code for exceptions if the SWIG_CSHARP_NO_EXCEPTION_HELPER is not defined
* Support code for strings if the SWIG_CSHARP_NO_STRING_HELPER is not defined
* ----------------------------------------------------------------------------- */
%insert(runtime) %{
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
%}
#if !defined(SWIG_CSHARP_NO_EXCEPTION_HELPER)
%insert(runtime) %{
/* Support for throwing C# exceptions from C/C++. There are two types:
* Exceptions that take a message and ArgumentExceptions that take a message and a parameter name. */
typedef enum {
SWIG_CSharpApplicationException,
SWIG_CSharpArithmeticException,
SWIG_CSharpDivideByZeroException,
SWIG_CSharpIndexOutOfRangeException,
SWIG_CSharpInvalidCastException,
SWIG_CSharpInvalidOperationException,
SWIG_CSharpIOException,
SWIG_CSharpNullReferenceException,
SWIG_CSharpOutOfMemoryException,
SWIG_CSharpOverflowException,
SWIG_CSharpSystemException
} SWIG_CSharpExceptionCodes;
typedef enum {
SWIG_CSharpArgumentException,
SWIG_CSharpArgumentNullException,
SWIG_CSharpArgumentOutOfRangeException
} SWIG_CSharpExceptionArgumentCodes;
typedef void (SWIGSTDCALL* SWIG_CSharpExceptionCallback_t)(const char *);
typedef void (SWIGSTDCALL* SWIG_CSharpExceptionArgumentCallback_t)(const char *, const char *);
typedef struct {
SWIG_CSharpExceptionCodes code;
SWIG_CSharpExceptionCallback_t callback;
} SWIG_CSharpException_t;
typedef struct {
SWIG_CSharpExceptionArgumentCodes code;
SWIG_CSharpExceptionArgumentCallback_t callback;
} SWIG_CSharpExceptionArgument_t;
static SWIG_CSharpException_t SWIG_csharp_exceptions[] = {
{ SWIG_CSharpApplicationException, NULL },
{ SWIG_CSharpArithmeticException, NULL },
{ SWIG_CSharpDivideByZeroException, NULL },
{ SWIG_CSharpIndexOutOfRangeException, NULL },
{ SWIG_CSharpInvalidCastException, NULL },
{ SWIG_CSharpInvalidOperationException, NULL },
{ SWIG_CSharpIOException, NULL },
{ SWIG_CSharpNullReferenceException, NULL },
{ SWIG_CSharpOutOfMemoryException, NULL },
{ SWIG_CSharpOverflowException, NULL },
{ SWIG_CSharpSystemException, NULL }
};
static SWIG_CSharpExceptionArgument_t SWIG_csharp_exceptions_argument[] = {
{ SWIG_CSharpArgumentException, NULL },
{ SWIG_CSharpArgumentNullException, NULL },
{ SWIG_CSharpArgumentOutOfRangeException, NULL }
};
static void SWIGUNUSED SWIG_CSharpSetPendingException(SWIG_CSharpExceptionCodes code, const char *msg) {
SWIG_CSharpExceptionCallback_t callback = SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback;
if ((size_t)code < sizeof(SWIG_csharp_exceptions)/sizeof(SWIG_CSharpException_t)) {
callback = SWIG_csharp_exceptions[code].callback;
}
callback(msg);
}
static void SWIGUNUSED SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpExceptionArgumentCodes code, const char *msg, const char *param_name) {
SWIG_CSharpExceptionArgumentCallback_t callback = SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback;
if ((size_t)code < sizeof(SWIG_csharp_exceptions_argument)/sizeof(SWIG_CSharpExceptionArgument_t)) {
callback = SWIG_csharp_exceptions_argument[code].callback;
}
callback(msg, param_name);
}
%}
%insert(runtime) %{
#ifdef __cplusplus
extern "C"
#endif
SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionCallbacks_$module(
SWIG_CSharpExceptionCallback_t applicationCallback,
SWIG_CSharpExceptionCallback_t arithmeticCallback,
SWIG_CSharpExceptionCallback_t divideByZeroCallback,
SWIG_CSharpExceptionCallback_t indexOutOfRangeCallback,
SWIG_CSharpExceptionCallback_t invalidCastCallback,
SWIG_CSharpExceptionCallback_t invalidOperationCallback,
SWIG_CSharpExceptionCallback_t ioCallback,
SWIG_CSharpExceptionCallback_t nullReferenceCallback,
SWIG_CSharpExceptionCallback_t outOfMemoryCallback,
SWIG_CSharpExceptionCallback_t overflowCallback,
SWIG_CSharpExceptionCallback_t systemCallback) {
SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback = applicationCallback;
SWIG_csharp_exceptions[SWIG_CSharpArithmeticException].callback = arithmeticCallback;
SWIG_csharp_exceptions[SWIG_CSharpDivideByZeroException].callback = divideByZeroCallback;
SWIG_csharp_exceptions[SWIG_CSharpIndexOutOfRangeException].callback = indexOutOfRangeCallback;
SWIG_csharp_exceptions[SWIG_CSharpInvalidCastException].callback = invalidCastCallback;
SWIG_csharp_exceptions[SWIG_CSharpInvalidOperationException].callback = invalidOperationCallback;
SWIG_csharp_exceptions[SWIG_CSharpIOException].callback = ioCallback;
SWIG_csharp_exceptions[SWIG_CSharpNullReferenceException].callback = nullReferenceCallback;
SWIG_csharp_exceptions[SWIG_CSharpOutOfMemoryException].callback = outOfMemoryCallback;
SWIG_csharp_exceptions[SWIG_CSharpOverflowException].callback = overflowCallback;
SWIG_csharp_exceptions[SWIG_CSharpSystemException].callback = systemCallback;
}
#ifdef __cplusplus
extern "C"
#endif
SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_$module(
SWIG_CSharpExceptionArgumentCallback_t argumentCallback,
SWIG_CSharpExceptionArgumentCallback_t argumentNullCallback,
SWIG_CSharpExceptionArgumentCallback_t argumentOutOfRangeCallback) {
SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback = argumentCallback;
SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentNullException].callback = argumentNullCallback;
SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentOutOfRangeException].callback = argumentOutOfRangeCallback;
}
%}
%pragma(csharp) imclasscode=%{
protected class SWIGExceptionHelper {
public delegate void ExceptionDelegate(string message);
public delegate void ExceptionArgumentDelegate(string message, string paramName);
static ExceptionDelegate applicationDelegate = new ExceptionDelegate(SetPendingApplicationException);
static ExceptionDelegate arithmeticDelegate = new ExceptionDelegate(SetPendingArithmeticException);
static ExceptionDelegate divideByZeroDelegate = new ExceptionDelegate(SetPendingDivideByZeroException);
static ExceptionDelegate indexOutOfRangeDelegate = new ExceptionDelegate(SetPendingIndexOutOfRangeException);
static ExceptionDelegate invalidCastDelegate = new ExceptionDelegate(SetPendingInvalidCastException);
static ExceptionDelegate invalidOperationDelegate = new ExceptionDelegate(SetPendingInvalidOperationException);
static ExceptionDelegate ioDelegate = new ExceptionDelegate(SetPendingIOException);
static ExceptionDelegate nullReferenceDelegate = new ExceptionDelegate(SetPendingNullReferenceException);
static ExceptionDelegate outOfMemoryDelegate = new ExceptionDelegate(SetPendingOutOfMemoryException);
static ExceptionDelegate overflowDelegate = new ExceptionDelegate(SetPendingOverflowException);
static ExceptionDelegate systemDelegate = new ExceptionDelegate(SetPendingSystemException);
static ExceptionArgumentDelegate argumentDelegate = new ExceptionArgumentDelegate(SetPendingArgumentException);
static ExceptionArgumentDelegate argumentNullDelegate = new ExceptionArgumentDelegate(SetPendingArgumentNullException);
static ExceptionArgumentDelegate argumentOutOfRangeDelegate = new ExceptionArgumentDelegate(SetPendingArgumentOutOfRangeException);
[global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterExceptionCallbacks_$module")]
public static extern void SWIGRegisterExceptionCallbacks_$module(
ExceptionDelegate applicationDelegate,
ExceptionDelegate arithmeticDelegate,
ExceptionDelegate divideByZeroDelegate,
ExceptionDelegate indexOutOfRangeDelegate,
ExceptionDelegate invalidCastDelegate,
ExceptionDelegate invalidOperationDelegate,
ExceptionDelegate ioDelegate,
ExceptionDelegate nullReferenceDelegate,
ExceptionDelegate outOfMemoryDelegate,
ExceptionDelegate overflowDelegate,
ExceptionDelegate systemExceptionDelegate);
[global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterExceptionArgumentCallbacks_$module")]
public static extern void SWIGRegisterExceptionCallbacksArgument_$module(
ExceptionArgumentDelegate argumentDelegate,
ExceptionArgumentDelegate argumentNullDelegate,
ExceptionArgumentDelegate argumentOutOfRangeDelegate);
static void SetPendingApplicationException(string message) {
SWIGPendingException.Set(new global::System.ApplicationException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingArithmeticException(string message) {
SWIGPendingException.Set(new global::System.ArithmeticException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingDivideByZeroException(string message) {
SWIGPendingException.Set(new global::System.DivideByZeroException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingIndexOutOfRangeException(string message) {
SWIGPendingException.Set(new global::System.IndexOutOfRangeException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingInvalidCastException(string message) {
SWIGPendingException.Set(new global::System.InvalidCastException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingInvalidOperationException(string message) {
SWIGPendingException.Set(new global::System.InvalidOperationException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingIOException(string message) {
SWIGPendingException.Set(new global::System.IO.IOException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingNullReferenceException(string message) {
SWIGPendingException.Set(new global::System.NullReferenceException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingOutOfMemoryException(string message) {
SWIGPendingException.Set(new global::System.OutOfMemoryException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingOverflowException(string message) {
SWIGPendingException.Set(new global::System.OverflowException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingSystemException(string message) {
SWIGPendingException.Set(new global::System.SystemException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingArgumentException(string message, string paramName) {
SWIGPendingException.Set(new global::System.ArgumentException(message, paramName, SWIGPendingException.Retrieve()));
}
static void SetPendingArgumentNullException(string message, string paramName) {
global::System.Exception e = SWIGPendingException.Retrieve();
if (e != null) message = message + " Inner Exception: " + e.Message;
SWIGPendingException.Set(new global::System.ArgumentNullException(paramName, message));
}
static void SetPendingArgumentOutOfRangeException(string message, string paramName) {
global::System.Exception e = SWIGPendingException.Retrieve();
if (e != null) message = message + " Inner Exception: " + e.Message;
SWIGPendingException.Set(new global::System.ArgumentOutOfRangeException(paramName, message));
}
static SWIGExceptionHelper() {
SWIGRegisterExceptionCallbacks_$module(
applicationDelegate,
arithmeticDelegate,
divideByZeroDelegate,
indexOutOfRangeDelegate,
invalidCastDelegate,
invalidOperationDelegate,
ioDelegate,
nullReferenceDelegate,
outOfMemoryDelegate,
overflowDelegate,
systemDelegate);
SWIGRegisterExceptionCallbacksArgument_$module(
argumentDelegate,
argumentNullDelegate,
argumentOutOfRangeDelegate);
}
}
protected static SWIGExceptionHelper swigExceptionHelper = new SWIGExceptionHelper();
public class SWIGPendingException {
[global::System.ThreadStatic]
private static global::System.Exception pendingException = null;
private static int numExceptionsPending = 0;
private static global::System.Object exceptionsLock = null;
public static bool Pending {
get {
bool pending = false;
if (numExceptionsPending > 0)
if (pendingException != null)
pending = true;
return pending;
}
}
public static void Set(global::System.Exception e) {
if (pendingException != null)
throw new global::System.ApplicationException("FATAL: An earlier pending exception from unmanaged code was missed and thus not thrown (" + pendingException.ToString() + ")", e);
pendingException = e;
lock(exceptionsLock) {
numExceptionsPending++;
}
}
public static global::System.Exception Retrieve() {
global::System.Exception e = null;
if (numExceptionsPending > 0) {
if (pendingException != null) {
e = pendingException;
pendingException = null;
lock(exceptionsLock) {
numExceptionsPending--;
}
}
}
return e;
}
static SWIGPendingException() {
exceptionsLock = new global::System.Object();
}
}
%}
#endif // SWIG_CSHARP_NO_EXCEPTION_HELPER
#if !defined(SWIG_CSHARP_NO_STRING_HELPER)
%insert(runtime) %{
/* Callback for returning strings to C# without leaking memory */
typedef char * (SWIGSTDCALL* SWIG_CSharpStringHelperCallback)(const char *);
static SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback = NULL;
%}
%pragma(csharp) imclasscode=%{
protected class SWIGStringHelper {
public delegate string SWIGStringDelegate(string message);
static SWIGStringDelegate stringDelegate = new SWIGStringDelegate(CreateString);
[global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterStringCallback_$module")]
public static extern void SWIGRegisterStringCallback_$module(SWIGStringDelegate stringDelegate);
static string CreateString(string cString) {
return cString;
}
static SWIGStringHelper() {
SWIGRegisterStringCallback_$module(stringDelegate);
}
}
static protected SWIGStringHelper swigStringHelper = new SWIGStringHelper();
%}
%insert(runtime) %{
#ifdef __cplusplus
extern "C"
#endif
SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_$module(SWIG_CSharpStringHelperCallback callback) {
SWIG_csharp_string_callback = callback;
}
%}
#endif // SWIG_CSHARP_NO_STRING_HELPER
#if !defined(SWIG_CSHARP_NO_IMCLASS_STATIC_CONSTRUCTOR)
// Ensure the class is not marked beforefieldinit
%pragma(csharp) imclasscode=%{
static $imclassname() {
}
%}
#endif
%insert(runtime) %{
/* Contract support */
#define SWIG_contract_assert(nullreturn, expr, msg) do { if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } } while (0)
%}

View File

@ -0,0 +1,97 @@
#ifndef CSHARP_CSHARPKW_SWG_
#define CSHARP_CSHARPKW_SWG_
/* Warnings for C# keywords */
#define CSHARPKW(x) %keywordwarn("'" `x` "' is a C# keyword",rename="%s_") `x`
#define CSHARPCLASSKW(x) %keywordwarn("'" `x` "' is a special method name used in the C# wrapper classes",%$isclass,rename="%s_") `x`
/*
from
http://www.jaggersoft.com/csharp_grammar.html#1.7%20Keywords
*/
CSHARPKW(abstract);
CSHARPKW(as);
CSHARPKW(base);
CSHARPKW(bool);
CSHARPKW(break);
CSHARPKW(byte);
CSHARPKW(case);
CSHARPKW(catch);
CSHARPKW(char);
CSHARPKW(checked);
CSHARPKW(class);
CSHARPKW(const);
CSHARPKW(continue);
CSHARPKW(decimal);
CSHARPKW(default);
CSHARPKW(delegate);
CSHARPKW(do);
CSHARPKW(double);
CSHARPKW(else);
CSHARPKW(enum);
CSHARPKW(event);
CSHARPKW(explicit);
CSHARPKW(extern);
CSHARPKW(false);
CSHARPKW(finally);
CSHARPKW(fixed);
CSHARPKW(float);
CSHARPKW(for);
CSHARPKW(foreach);
CSHARPKW(goto);
CSHARPKW(if);
CSHARPKW(implicit);
CSHARPKW(in);
CSHARPKW(int);
CSHARPKW(interface);
CSHARPKW(internal);
CSHARPKW(is);
CSHARPKW(lock);
CSHARPKW(long);
CSHARPKW(namespace);
CSHARPKW(new);
CSHARPKW(null);
CSHARPKW(object);
CSHARPKW(operator);
CSHARPKW(out);
CSHARPKW(override);
CSHARPKW(params);
CSHARPKW(private);
CSHARPKW(protected);
CSHARPKW(public);
CSHARPKW(readonly);
CSHARPKW(ref);
CSHARPKW(return);
CSHARPKW(sbyte);
CSHARPKW(sealed);
CSHARPKW(short);
CSHARPKW(sizeof);
CSHARPKW(stackalloc);
CSHARPKW(static);
CSHARPKW(struct);
CSHARPKW(string);
CSHARPKW(switch);
CSHARPKW(this);
CSHARPKW(throw);
CSHARPKW(true);
CSHARPKW(try);
CSHARPKW(typeof);
CSHARPKW(uint);
CSHARPKW(ulong);
CSHARPKW(unchecked);
CSHARPKW(unsafe);
CSHARPKW(ushort);
CSHARPKW(using);
CSHARPKW(virtual);
CSHARPKW(void);
CSHARPKW(volatile);
CSHARPKW(while);
CSHARPCLASSKW(delete);
#undef CSHARPKW
#endif //CSHARP_CSHARPKW_SWG_

View File

@ -0,0 +1,50 @@
/* -----------------------------------------------------------------------------
* director.swg
*
* This file contains support for director classes so that C# proxy
* methods can be called from C++.
* ----------------------------------------------------------------------------- */
#if defined(DEBUG_DIRECTOR_OWNED)
#include <iostream>
#endif
#include <string>
#include <exception>
namespace Swig {
/* Director base class - not currently used in C# directors */
class Director {
};
/* Base class for director exceptions */
class DirectorException : public std::exception {
protected:
std::string swig_msg;
public:
DirectorException(const char *msg) : swig_msg(msg) {
}
DirectorException(const std::string &msg) : swig_msg(msg) {
}
virtual ~DirectorException() throw() {
}
const char *what() const throw() {
return swig_msg.c_str();
}
};
/* Pure virtual method exception */
class DirectorPureVirtualException : public DirectorException {
public:
DirectorPureVirtualException(const char *msg) : DirectorException(std::string("Attempt to invoke pure virtual method ") + msg) {
}
static void raise(const char *msg) {
throw DirectorPureVirtualException(msg);
}
};
}

View File

@ -0,0 +1,86 @@
/* -----------------------------------------------------------------------------
* enums.swg
*
* Include this file in order for C/C++ enums to be wrapped by proper C# enums.
* Note that the PINVOKE layer handles the enum as an int.
* ----------------------------------------------------------------------------- */
// const enum SWIGTYPE & typemaps
%typemap(ctype) const enum SWIGTYPE & "int"
%typemap(imtype) const enum SWIGTYPE & "int"
%typemap(cstype) const enum SWIGTYPE & "$*csclassname"
%typemap(in) const enum SWIGTYPE & ($*1_ltype temp)
%{ temp = ($*1_ltype)$input;
$1 = &temp; %}
%typemap(out) const enum SWIGTYPE & %{ $result = (int)*$1; %}
%typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const enum SWIGTYPE &
%{ static $*1_ltype temp = ($*1_ltype)$input;
$result = &temp; %}
%typemap(directorin) const enum SWIGTYPE & "$input = (int)$1;"
%typemap(csdirectorin) const enum SWIGTYPE & "($*csclassname)$iminput"
%typemap(csdirectorout) const enum SWIGTYPE & "(int)$cscall"
%typecheck(SWIG_TYPECHECK_POINTER) const enum SWIGTYPE & ""
%typemap(throws, canthrow=1) const enum SWIGTYPE &
%{ (void)$1;
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, "C++ $1_type exception thrown");
return $null; %}
%typemap(csin) const enum SWIGTYPE & "(int)$csinput"
%typemap(csout, excode=SWIGEXCODE) const enum SWIGTYPE & {
$*csclassname ret = ($*csclassname)$imcall;$excode
return ret;
}
%typemap(csvarout, excode=SWIGEXCODE2) const enum SWIGTYPE & %{
get {
$*csclassname ret = ($*csclassname)$imcall;$excode
return ret;
} %}
// enum SWIGTYPE typemaps
%typemap(ctype) enum SWIGTYPE "int"
%typemap(imtype) enum SWIGTYPE "int"
%typemap(cstype) enum SWIGTYPE "$csclassname"
%typemap(in) enum SWIGTYPE %{ $1 = ($1_ltype)$input; %}
%typemap(out) enum SWIGTYPE %{ $result = (int)$1; %}
%typemap(directorout) enum SWIGTYPE %{ $result = ($1_ltype)$input; %}
%typemap(directorin) enum SWIGTYPE "$input = (int)$1;"
%typemap(csdirectorin) enum SWIGTYPE "($csclassname)$iminput"
%typemap(csdirectorout) enum SWIGTYPE "(int)$cscall"
%typecheck(SWIG_TYPECHECK_POINTER) enum SWIGTYPE ""
%typemap(throws, canthrow=1) enum SWIGTYPE
%{ (void)$1;
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, "C++ $1_type exception thrown");
return $null; %}
%typemap(csin) enum SWIGTYPE "(int)$csinput"
%typemap(csout, excode=SWIGEXCODE) enum SWIGTYPE {
$csclassname ret = ($csclassname)$imcall;$excode
return ret;
}
%typemap(csvarout, excode=SWIGEXCODE2) enum SWIGTYPE %{
get {
$csclassname ret = ($csclassname)$imcall;$excode
return ret;
} %}
%typemap(csbase) enum SWIGTYPE ""
%typemap(csclassmodifiers) enum SWIGTYPE "public enum"
%typemap(cscode) enum SWIGTYPE ""
%typemap(csimports) enum SWIGTYPE ""
%typemap(csinterfaces) enum SWIGTYPE ""
%typemap(csbody) enum SWIGTYPE ""
%csenum(proper);

View File

@ -0,0 +1,88 @@
/* -----------------------------------------------------------------------------
* enumsimple.swg
*
* This file provides backwards compatible enum wrapping. SWIG versions 1.3.21
* and earlier wrapped global enums with constant integers in the module
* class. Enums declared within a C++ class were wrapped by constant integers
* in the C# proxy class.
* ----------------------------------------------------------------------------- */
// const enum SWIGTYPE & typemaps
%typemap(ctype) const enum SWIGTYPE & "int"
%typemap(imtype) const enum SWIGTYPE & "int"
%typemap(cstype) const enum SWIGTYPE & "int"
%typemap(in) const enum SWIGTYPE & ($*1_ltype temp)
%{ temp = ($*1_ltype)$input;
$1 = &temp; %}
%typemap(out) const enum SWIGTYPE & %{ $result = (int)*$1; %}
%typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const enum SWIGTYPE &
%{ static $*1_ltype temp = ($*1_ltype)$input;
$result = &temp; %}
%typemap(directorin) const enum SWIGTYPE & "$input = (int)$1;"
%typemap(csdirectorin) const enum SWIGTYPE & "$iminput"
%typemap(csdirectorout) const enum SWIGTYPE & "$cscall"
%typecheck(SWIG_TYPECHECK_INT32) const enum SWIGTYPE & ""
%typemap(throws, canthrow=1) const enum SWIGTYPE &
%{ (void)$1;
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, "C++ $1_type exception thrown");
return $null; %}
%typemap(csin) const enum SWIGTYPE & "$csinput"
%typemap(csout, excode=SWIGEXCODE) const enum SWIGTYPE & {
int ret = $imcall;$excode
return ret;
}
%typemap(csvarout, excode=SWIGEXCODE2) const enum SWIGTYPE & %{
get {
int ret = $imcall;$excode
return ret;
} %}
// enum SWIGTYPE typemaps
%typemap(ctype) enum SWIGTYPE "int"
%typemap(imtype) enum SWIGTYPE "int"
%typemap(cstype) enum SWIGTYPE "int"
%typemap(in) enum SWIGTYPE %{ $1 = ($1_ltype)$input; %}
%typemap(out) enum SWIGTYPE %{ $result = (int)$1; %}
%typemap(directorout) enum SWIGTYPE %{ $result = ($1_ltype)$input; %}
%typemap(directorin) enum SWIGTYPE "$input = (int)$1;"
%typemap(csdirectorin) enum SWIGTYPE "$iminput"
%typemap(csdirectorout) enum SWIGTYPE "$cscall"
%typecheck(SWIG_TYPECHECK_INT32) enum SWIGTYPE ""
%typemap(throws, canthrow=1) enum SWIGTYPE
%{ (void)$1;
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, "C++ $1_type exception thrown");
return $null; %}
%typemap(csin) enum SWIGTYPE "$csinput"
%typemap(csout, excode=SWIGEXCODE) enum SWIGTYPE {
int ret = $imcall;$excode
return ret;
}
%typemap(csvarout, excode=SWIGEXCODE2) enum SWIGTYPE %{
get {
int ret = $imcall;$excode
return ret;
} %}
%typemap(csbase) enum SWIGTYPE ""
%typemap(csclassmodifiers) enum SWIGTYPE ""
%typemap(cscode) enum SWIGTYPE ""
%typemap(csimports) enum SWIGTYPE ""
%typemap(csinterfaces) enum SWIGTYPE ""
%typemap(csbody) enum SWIGTYPE ""
%csenum(simple);

View File

@ -0,0 +1,130 @@
/* -----------------------------------------------------------------------------
* enumtypesafe.swg
*
* Include this file in order for C/C++ enums to be wrapped by the so called
* typesafe enum pattern. Each enum has an equivalent C# class named after the
* enum and each enum item is a static instance of this class.
* ----------------------------------------------------------------------------- */
// const enum SWIGTYPE & typemaps
%typemap(ctype) const enum SWIGTYPE & "int"
%typemap(imtype) const enum SWIGTYPE & "int"
%typemap(cstype) const enum SWIGTYPE & "$*csclassname"
%typemap(in) const enum SWIGTYPE & ($*1_ltype temp)
%{ temp = ($*1_ltype)$input;
$1 = &temp; %}
%typemap(out) const enum SWIGTYPE & %{ $result = (int)*$1; %}
%typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const enum SWIGTYPE &
%{ static $*1_ltype temp = ($*1_ltype)$input;
$result = &temp; %}
%typemap(directorin) const enum SWIGTYPE & "$input = (int)$1;"
%typemap(csdirectorin) const enum SWIGTYPE & "$*csclassname.swigToEnum($iminput)"
%typemap(csdirectorout) const enum SWIGTYPE & "$cscall.swigValue"
%typecheck(SWIG_TYPECHECK_POINTER) const enum SWIGTYPE & ""
%typemap(throws, canthrow=1) const enum SWIGTYPE &
%{ (void)$1;
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, "C++ $1_type exception thrown");
return $null; %}
%typemap(csin) const enum SWIGTYPE & "$csinput.swigValue"
%typemap(csout, excode=SWIGEXCODE) const enum SWIGTYPE & {
$*csclassname ret = $*csclassname.swigToEnum($imcall);$excode
return ret;
}
%typemap(csvarout, excode=SWIGEXCODE2) const enum SWIGTYPE & %{
get {
$*csclassname ret = $*csclassname.swigToEnum($imcall);$excode
return ret;
} %}
// enum SWIGTYPE typemaps
%typemap(ctype) enum SWIGTYPE "int"
%typemap(imtype) enum SWIGTYPE "int"
%typemap(cstype) enum SWIGTYPE "$csclassname"
%typemap(in) enum SWIGTYPE %{ $1 = ($1_ltype)$input; %}
%typemap(out) enum SWIGTYPE %{ $result = (int)$1; %}
%typemap(directorout) enum SWIGTYPE %{ $result = ($1_ltype)$input; %}
%typemap(directorin) enum SWIGTYPE "$input = (int)$1;"
%typemap(csdirectorin) enum SWIGTYPE "$csclassname.swigToEnum($iminput)"
%typemap(csdirectorout) enum SWIGTYPE "$cscall.swigValue"
%typecheck(SWIG_TYPECHECK_POINTER) enum SWIGTYPE ""
%typemap(throws, canthrow=1) enum SWIGTYPE
%{ (void)$1;
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, "C++ $1_type exception thrown");
return $null; %}
%typemap(csin) enum SWIGTYPE "$csinput.swigValue"
%typemap(csout, excode=SWIGEXCODE) enum SWIGTYPE {
$csclassname ret = $csclassname.swigToEnum($imcall);$excode
return ret;
}
%typemap(csvarout, excode=SWIGEXCODE2) enum SWIGTYPE %{
get {
$csclassname ret = $csclassname.swigToEnum($imcall);$excode
return ret;
} %}
%typemap(csbase) enum SWIGTYPE ""
%typemap(csclassmodifiers) enum SWIGTYPE "public sealed class"
%typemap(cscode) enum SWIGTYPE ""
%typemap(csimports) enum SWIGTYPE ""
%typemap(csinterfaces) enum SWIGTYPE ""
/*
* The swigToEnum method is used to find the C# enum from a C++ enum integer value. The default one here takes
* advantage of the fact that most enums do not have initial values specified, so the lookup is fast. If initial
* values are specified then a lengthy linear search through all possible enums might occur. Specific typemaps could be
* written to possibly optimise this lookup by taking advantage of characteristics peculiar to the targeted enum.
* The special variable, $enumvalues, is replaced with a comma separated list of all the enum values.
*/
%typemap(csbody) enum SWIGTYPE %{
public readonly int swigValue;
public static $csclassname swigToEnum(int swigValue) {
if (swigValue < swigValues.Length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
return swigValues[swigValue];
for (int i = 0; i < swigValues.Length; i++)
if (swigValues[i].swigValue == swigValue)
return swigValues[i];
throw new global::System.ArgumentOutOfRangeException("No enum $csclassname with value " + swigValue);
}
public override string ToString() {
return swigName;
}
private $csclassname(string swigName) {
this.swigName = swigName;
this.swigValue = swigNext++;
}
private $csclassname(string swigName, int swigValue) {
this.swigName = swigName;
this.swigValue = swigValue;
swigNext = swigValue+1;
}
private $csclassname(string swigName, $csclassname swigEnum) {
this.swigName = swigName;
this.swigValue = swigEnum.swigValue;
swigNext = this.swigValue+1;
}
private static $csclassname[] swigValues = { $enumvalues };
private static int swigNext = 0;
private readonly string swigName;
%}
%csenum(typesafe);

View File

@ -0,0 +1,227 @@
/* -----------------------------------------------------------------------------
* std_array.i
*
* SWIG typemaps for std::array<T, N>
* C# implementation
* The C# wrapper is made to look and feel like a C# System.Collections.Generic.IReadOnlyList<> collection.
* ----------------------------------------------------------------------------- */
%{
#include <algorithm>
#include <array>
#include <stdexcept>
%}
%include <std_common.i>
%define SWIG_STD_ARRAY_INTERNAL(T, N)
%typemap(csinterfaces) std::array< T, N > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>\n";
%proxycode %{
public $csclassname(global::System.Collections.ICollection c) : this() {
if (c == null)
throw new global::System.ArgumentNullException("c");
int end = global::System.Math.Min(this.Count, c.Count);
int i = 0;
foreach ($typemap(cstype, T) elem in c) {
if (i >= end)
break;
this[i++] = elem;
}
}
public int Count {
get {
return (int)size();
}
}
public $typemap(cstype, T) this[int index] {
get {
return getitem(index);
}
set {
setitem(index, value);
}
}
public bool IsEmpty {
get {
return empty();
}
}
public void CopyTo($typemap(cstype, T)[] array)
{
CopyTo(0, array, 0, this.Count);
}
public void CopyTo($typemap(cstype, T)[] array, int arrayIndex)
{
CopyTo(0, array, arrayIndex, this.Count);
}
public void CopyTo(int index, $typemap(cstype, T)[] array, int arrayIndex, int count)
{
if (array == null)
throw new global::System.ArgumentNullException("array");
if (index < 0)
throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero");
if (arrayIndex < 0)
throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
if (count < 0)
throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero");
if (array.Rank > 1)
throw new global::System.ArgumentException("Multi dimensional array.", "array");
if (index+count > this.Count || arrayIndex+count > array.Length)
throw new global::System.ArgumentException("Number of elements to copy is too large.");
for (int i=0; i<count; i++)
array.SetValue(getitemcopy(index+i), arrayIndex+i);
}
global::System.Collections.Generic.IEnumerator<$typemap(cstype, T)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>.GetEnumerator() {
return new $csclassnameEnumerator(this);
}
global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
return new $csclassnameEnumerator(this);
}
public $csclassnameEnumerator GetEnumerator() {
return new $csclassnameEnumerator(this);
}
// Type-safe enumerator
/// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown
/// whenever the collection is modified. This has been done for changes in the size of the
/// collection but not when one of the elements of the collection is modified as it is a bit
/// tricky to detect unmanaged code that modifies the collection under our feet.
public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator
, global::System.Collections.Generic.IEnumerator<$typemap(cstype, T)>
{
private $csclassname collectionRef;
private int currentIndex;
private object currentObject;
private int currentSize;
public $csclassnameEnumerator($csclassname collection) {
collectionRef = collection;
currentIndex = -1;
currentObject = null;
currentSize = collectionRef.Count;
}
// Type-safe iterator Current
public $typemap(cstype, T) Current {
get {
if (currentIndex == -1)
throw new global::System.InvalidOperationException("Enumeration not started.");
if (currentIndex > currentSize - 1)
throw new global::System.InvalidOperationException("Enumeration finished.");
if (currentObject == null)
throw new global::System.InvalidOperationException("Collection modified.");
return ($typemap(cstype, T))currentObject;
}
}
// Type-unsafe IEnumerator.Current
object global::System.Collections.IEnumerator.Current {
get {
return Current;
}
}
public bool MoveNext() {
int size = collectionRef.Count;
bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
if (moveOkay) {
currentIndex++;
currentObject = collectionRef[currentIndex];
} else {
currentObject = null;
}
return moveOkay;
}
public void Reset() {
currentIndex = -1;
currentObject = null;
if (collectionRef.Count != currentSize) {
throw new global::System.InvalidOperationException("Collection modified.");
}
}
public void Dispose() {
currentIndex = -1;
currentObject = null;
}
}
%}
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef T value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type& reference;
typedef const value_type& const_reference;
array();
array(const array &other);
size_type size() const;
bool empty() const;
%rename(Fill) fill;
void fill(const value_type& value);
%rename(Swap) swap;
void swap(array& other);
%extend {
T getitemcopy(int index) throw (std::out_of_range) {
if (index>=0 && index<(int)$self->size())
return (*$self)[index];
else
throw std::out_of_range("index");
}
const_reference getitem(int index) throw (std::out_of_range) {
if (index>=0 && index<(int)$self->size())
return (*$self)[index];
else
throw std::out_of_range("index");
}
void setitem(int index, const_reference val) throw (std::out_of_range) {
if (index>=0 && index<(int)$self->size())
(*$self)[index] = val;
else
throw std::out_of_range("index");
}
void Reverse() {
std::reverse($self->begin(), $self->end());
}
void Reverse(int index, int count) throw (std::out_of_range, std::invalid_argument) {
if (index < 0)
throw std::out_of_range("index");
if (count < 0)
throw std::out_of_range("count");
if (index >= (int)$self->size()+1 || index+count > (int)$self->size())
throw std::invalid_argument("invalid range");
std::reverse($self->begin()+index, $self->begin()+index+count);
}
}
%enddef
%csmethodmodifiers std::array::empty "private"
%csmethodmodifiers std::array::getitemcopy "private"
%csmethodmodifiers std::array::getitem "private"
%csmethodmodifiers std::array::setitem "private"
%csmethodmodifiers std::array::size "private"
namespace std {
template<class T, size_t N> class array {
SWIG_STD_ARRAY_INTERNAL(T, N)
};
}

View File

@ -0,0 +1,25 @@
/*
The typemaps here allow handling functions returning std::auto_ptr<>,
which is the most common use of this type. If you have functions taking it
as parameter, these typemaps can't be used for them and you need to do
something else (e.g. use shared_ptr<> which SWIG supports fully).
*/
%define %auto_ptr(TYPE)
%typemap (ctype) std::auto_ptr<TYPE > "void *"
%typemap (imtype, out="System.IntPtr") std::auto_ptr<TYPE > "HandleRef"
%typemap (cstype) std::auto_ptr<TYPE > "$typemap(cstype, TYPE)"
%typemap (out) std::auto_ptr<TYPE > %{
$result = (void *)$1.release();
%}
%typemap(csout, excode=SWIGEXCODE) std::auto_ptr<TYPE > {
System.IntPtr cPtr = $imcall;
$typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode
return ret;
}
%template() std::auto_ptr<TYPE >;
%enddef
namespace std {
template <class T> class auto_ptr {};
}

View File

@ -0,0 +1,5 @@
%include <std_except.i>
%apply size_t { std::size_t };
%apply const size_t& { const std::size_t& };

View File

@ -0,0 +1,95 @@
/* -----------------------------------------------------------------------------
* std_complex.i
*
* Typemaps for handling std::complex<float> and std::complex<double> as a .NET
* System.Numerics.Complex type. Requires .NET 4 minimum.
* ----------------------------------------------------------------------------- */
%{
#include <complex>
%}
%fragment("SwigSystemNumericsComplex", "header") {
extern "C" {
// Identical to the layout of System.Numerics.Complex, but does assume that it is
// LayoutKind.Sequential on the managed side
struct SwigSystemNumericsComplex {
double real;
double imag;
};
}
SWIGINTERN SwigSystemNumericsComplex SwigCreateSystemNumericsComplex(double real, double imag) {
SwigSystemNumericsComplex cpx;
cpx.real = real;
cpx.imag = imag;
return cpx;
}
}
namespace std {
%naturalvar complex;
template<typename T>
class complex
{
public:
complex(T re = T(), T im = T());
};
}
%define SWIG_COMPLEX_TYPEMAPS(T)
%typemap(ctype, fragment="SwigSystemNumericsComplex") std::complex<T>, const std::complex<T> & "SwigSystemNumericsComplex"
%typemap(imtype) std::complex<T>, const std::complex<T> & "System.Numerics.Complex"
%typemap(cstype) std::complex<T>, const std::complex<T> & "System.Numerics.Complex"
%typemap(in) std::complex<T>
%{$1 = std::complex< double >($input.real, $input.imag);%}
%typemap(in) const std::complex<T> &($*1_ltype temp)
%{temp = std::complex< T >((T)$input.real, (T)$input.imag);
$1 = &temp;%}
%typemap(out, null="SwigCreateSystemNumericsComplex(0.0, 0.0)") std::complex<T>
%{$result = SwigCreateSystemNumericsComplex($1.real(), $1.imag());%}
%typemap(out, null="SwigCreateSystemNumericsComplex(0.0, 0.0)") const std::complex<T> &
%{$result = SwigCreateSystemNumericsComplex($1->real(), $1->imag());%}
%typemap(cstype) std::complex<T>, const std::complex<T> & "System.Numerics.Complex"
%typemap(csin) std::complex<T>, const std::complex<T> & "$csinput"
%typemap(csout, excode=SWIGEXCODE) std::complex<T>, const std::complex<T> & {
System.Numerics.Complex ret = $imcall;$excode
return ret;
}
%typemap(csvarin, excode=SWIGEXCODE2) const std::complex<T> & %{
set {
$imcall;$excode
}
%}
%typemap(csvarout, excode=SWIGEXCODE2) const std::complex<T> & %{
get {
System.Numerics.Complex ret = $imcall;$excode
return ret;
}
%}
%template() std::complex<T>;
%enddef
// By default, typemaps for both std::complex<double> and std::complex<float>
// are defined, but one of them can be disabled by predefining the
// corresponding symbol before including this file.
#ifndef SWIG_NO_STD_COMPLEX_DOUBLE
SWIG_COMPLEX_TYPEMAPS(double)
#endif
#ifndef SWIG_NO_STD_COMPLEX_FLOAT
SWIG_COMPLEX_TYPEMAPS(float)
#endif

View File

@ -0,0 +1 @@
%include <std/_std_deque.i>

View File

@ -0,0 +1,32 @@
/* -----------------------------------------------------------------------------
* std_except.i
*
* Typemaps used by the STL wrappers that throw exceptions. These typemaps are
* used when methods are declared with an STL exception specification, such as
* size_t at() const throw (std::out_of_range);
* ----------------------------------------------------------------------------- */
%{
#include <typeinfo>
#include <stdexcept>
%}
namespace std
{
%ignore exception;
struct exception {};
}
%typemap(throws, canthrow=1) std::bad_cast "SWIG_CSharpSetPendingException(SWIG_CSharpInvalidCastException, $1.what());\n return $null;"
%typemap(throws, canthrow=1) std::bad_exception "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
%typemap(throws, canthrow=1) std::domain_error "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
%typemap(throws, canthrow=1) std::exception "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
%typemap(throws, canthrow=1) std::invalid_argument "SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentException, $1.what(), \"\");\n return $null;"
%typemap(throws, canthrow=1) std::length_error "SWIG_CSharpSetPendingException(SWIG_CSharpIndexOutOfRangeException, $1.what());\n return $null;"
%typemap(throws, canthrow=1) std::logic_error "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
%typemap(throws, canthrow=1) std::out_of_range "SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, 0, $1.what());\n return $null;"
%typemap(throws, canthrow=1) std::overflow_error "SWIG_CSharpSetPendingException(SWIG_CSharpOverflowException, $1.what());\n return $null;"
%typemap(throws, canthrow=1) std::range_error "SWIG_CSharpSetPendingException(SWIG_CSharpIndexOutOfRangeException, $1.what());\n return $null;"
%typemap(throws, canthrow=1) std::runtime_error "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
%typemap(throws, canthrow=1) std::underflow_error "SWIG_CSharpSetPendingException(SWIG_CSharpOverflowException, $1.what());\n return $null;"

View File

@ -0,0 +1,519 @@
/* -----------------------------------------------------------------------------
* std_list.i
*
* SWIG typemaps for std::list<T>
* C# implementation
* The C# wrapper is made to look and feel like a C# System.Collections.Generic.LinkedList<> collection.
*
* Note that IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
* C++ std::list wrappers. The ICollection<> interface is also implemented to provide enhanced functionality
* whenever we are confident that the required C++ operator== is available. This is the case for when
* T is a primitive type or a pointer. If T does define an operator==, then use the SWIG_STD_LIST_ENHANCED
* macro to obtain this enhanced functionality, for example:
*
* SWIG_STD_LIST_ENHANCED(SomeNamespace::Klass)
* %template(ListKlass) std::list<SomeNamespace::Klass>;
* ----------------------------------------------------------------------------- */
%include <std_common.i>
// MACRO for use within the std::list class body
%define SWIG_STD_LIST_MINIMUM_INTERNAL(CSINTERFACE, CTYPE...)
%typemap(csinterfaces) std::list< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n";
%apply void *VOID_INT_PTR { std::list< CTYPE >::iterator * };
%proxycode %{
public $csclassname(global::System.Collections.IEnumerable c) : this() {
if (c == null)
throw new global::System.ArgumentNullException("c");
foreach ($typemap(cstype, CTYPE) element in c) {
this.AddLast(element);
}
}
public bool IsReadOnly {
get {
return false;
}
}
public int Count {
get {
return (int)size();
}
}
public $csclassnameNode First {
get {
if (Count == 0)
return null;
return new $csclassnameNode(getFirstIter(), this);
}
}
public $csclassnameNode Last {
get {
if (Count == 0)
return null;
return new $csclassnameNode(getLastIter(), this);
}
}
public $csclassnameNode AddFirst($typemap(cstype, CTYPE) value) {
push_front(value);
return new $csclassnameNode(getFirstIter(), this);
}
public void AddFirst($csclassnameNode newNode) {
ValidateNewNode(newNode);
if (!newNode.inlist) {
push_front(newNode.csharpvalue);
newNode.iter = getFirstIter();
newNode.inlist = true;
} else {
throw new global::System.InvalidOperationException("The " + newNode.GetType().Name + " node already belongs to a " + this.GetType().Name);
}
}
public $csclassnameNode AddLast($typemap(cstype, CTYPE) value) {
push_back(value);
return new $csclassnameNode(getLastIter(), this);
}
public void AddLast($csclassnameNode newNode) {
ValidateNewNode(newNode);
if (!newNode.inlist) {
push_back(newNode.csharpvalue);
newNode.iter = getLastIter();
newNode.inlist = true;
} else {
throw new global::System.InvalidOperationException("The " + newNode.GetType().Name + " node already belongs to a " + this.GetType().Name);
}
}
public $csclassnameNode AddBefore($csclassnameNode node, $typemap(cstype, CTYPE) value) {
return new $csclassnameNode(insertNode(node.iter, value), this);
}
public void AddBefore($csclassnameNode node, $csclassnameNode newNode) {
ValidateNode(node);
ValidateNewNode(newNode);
if (!newNode.inlist) {
newNode.iter = insertNode(node.iter, newNode.csharpvalue);
newNode.inlist = true;
} else {
throw new global::System.InvalidOperationException("The " + newNode.GetType().Name + " node already belongs to a " + this.GetType().Name);
}
}
public $csclassnameNode AddAfter($csclassnameNode node, $typemap(cstype, CTYPE) value) {
node = node.Next;
return new $csclassnameNode(insertNode(node.iter, value), this);
}
public void AddAfter($csclassnameNode node, $csclassnameNode newNode) {
ValidateNode(node);
ValidateNewNode(newNode);
if (!newNode.inlist) {
if (node == this.Last)
AddLast(newNode);
else
{
node = node.Next;
newNode.iter = insertNode(node.iter, newNode.csharpvalue);
newNode.inlist = true;
}
} else {
throw new global::System.InvalidOperationException("The " + newNode.GetType().Name + " node already belongs to a " + this.GetType().Name);
}
}
public void Add($typemap(cstype, CTYPE) value) {
AddLast(value);
}
public void Remove($csclassnameNode node) {
ValidateNode(node);
eraseIter(node.iter);
}
public void CopyTo($typemap(cstype, CTYPE)[] array, int index) {
if (array == null)
throw new global::System.ArgumentNullException("array");
if (index < 0 || index > array.Length)
throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero");
if (array.Rank > 1)
throw new global::System.ArgumentException("Multi dimensional array.", "array");
$csclassnameNode node = this.First;
if (node != null) {
do {
array[index++] = node.Value;
node = node.Next;
} while (node != null);
}
}
internal void ValidateNode($csclassnameNode node) {
if (node == null) {
throw new System.ArgumentNullException("node");
}
if (!node.inlist || node.list != this) {
throw new System.InvalidOperationException("node");
}
}
internal void ValidateNewNode($csclassnameNode node) {
if (node == null) {
throw new System.ArgumentNullException("node");
}
}
global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)>.GetEnumerator() {
return new $csclassnameEnumerator(this);
}
global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
return new $csclassnameEnumerator(this);
}
public $csclassnameEnumerator GetEnumerator() {
return new $csclassnameEnumerator(this);
}
public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator,
global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)>
{
private $csclassname collectionRef;
private $csclassnameNode currentNode;
private int currentIndex;
private object currentObject;
private int currentSize;
public $csclassnameEnumerator($csclassname collection) {
collectionRef = collection;
currentNode = collection.First;
currentIndex = 0;
currentObject = null;
currentSize = collectionRef.Count;
}
// Type-safe iterator Current
public $typemap(cstype, CTYPE) Current {
get {
if (currentIndex == -1)
throw new global::System.InvalidOperationException("Enumeration not started.");
if (currentIndex > currentSize)
throw new global::System.InvalidOperationException("Enumeration finished.");
if (currentObject == null)
throw new global::System.InvalidOperationException("Collection modified.");
return ($typemap(cstype, CTYPE))currentObject;
}
}
// Type-unsafe IEnumerator.Current
object global::System.Collections.IEnumerator.Current {
get {
return Current;
}
}
public bool MoveNext() {
if (currentNode == null) {
currentIndex = collectionRef.Count + 1;
return false;
}
++currentIndex;
currentObject = currentNode.Value;
currentNode = currentNode.Next;
return true;
}
public void Reset() {
currentIndex = -1;
currentObject = null;
if (collectionRef.Count != currentSize) {
throw new global::System.InvalidOperationException("Collection modified.");
}
}
public void Dispose() {
currentIndex = -1;
currentObject = null;
}
}
public sealed class $csclassnameNode {
internal $csclassname list;
internal System.IntPtr iter;
internal $typemap(cstype, CTYPE) csharpvalue;
internal bool inlist;
public $csclassnameNode($typemap(cstype, CTYPE) value) {
csharpvalue = value;
inlist = false;
}
internal $csclassnameNode(System.IntPtr iter, $csclassname list) {
this.list = list;
this.iter = iter;
inlist = true;
}
public $csclassname List {
get {
return this.list;
}
}
public $csclassnameNode Next {
get {
if (list.getNextIter(iter) == System.IntPtr.Zero)
return null;
return new $csclassnameNode(list.getNextIter(iter), list);
}
}
public $csclassnameNode Previous {
get {
if (list.getPrevIter(iter) == System.IntPtr.Zero)
return null;
return new $csclassnameNode(list.getPrevIter(iter), list);
}
}
public $typemap(cstype, CTYPE) Value {
get {
return list.getItem(this.iter);
}
set {
list.setItem(this.iter, value);
}
}
public static bool operator==($csclassnameNode node1, $csclassnameNode node2) {
if (object.ReferenceEquals(node1, null) && object.ReferenceEquals(node2, null))
return true;
if (object.ReferenceEquals(node1, null) || object.ReferenceEquals(node2, null))
return false;
return node1.Equals(node2);
}
public static bool operator!=($csclassnameNode node1, $csclassnameNode node2) {
if (node1 == null && node2 == null)
return false;
if (node1 == null || node2 == null)
return true;
return !node1.Equals(node2);
}
public bool Equals($csclassnameNode node) {
if (node == null)
return false;
if (!node.inlist || !this.inlist)
return object.ReferenceEquals(this, node);
return list.equals(this.iter, node.iter);
}
public override bool Equals(object node) {
return Equals(($csclassnameNode)node);
}
public override int GetHashCode() {
int hash = 13;
if (inlist) {
hash = (hash * 7) + this.list.GetHashCode();
hash = (hash * 7) + this.Value.GetHashCode();
hash = (hash * 7) + this.list.getNextIter(this.iter).GetHashCode();
hash = (hash * 7) + this.list.getPrevIter(this.iter).GetHashCode();
} else {
hash = (hash * 7) + this.csharpvalue.GetHashCode();
}
return hash;
}
public void Dispose() {
list.deleteIter(this.iter);
}
}
%}
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef CTYPE value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type& reference;
typedef const value_type& const_reference;
class iterator;
void push_front(CTYPE const& x);
void push_back(CTYPE const& x);
%rename(RemoveFirst) pop_front;
void pop_front();
%rename(RemoveLast) pop_back;
void pop_back();
size_type size() const;
%rename(Clear) clear;
void clear();
%extend {
const_reference getItem(iterator *iter) {
return **iter;
}
void setItem(iterator *iter, CTYPE const& val) {
*(*iter) = val;
}
iterator *getFirstIter() {
if ($self->size() == 0)
return NULL;
return new std::list< CTYPE >::iterator($self->begin());
}
iterator *getLastIter() {
if ($self->size() == 0)
return NULL;
return new std::list< CTYPE >::iterator(--$self->end());
}
iterator *getNextIter(iterator *iter) {
std::list< CTYPE >::iterator it = *iter;
if (std::distance(it, --$self->end()) != 0) {
std::list< CTYPE >::iterator* itnext = new std::list< CTYPE >::iterator(++it);
return itnext;
}
return NULL;
}
iterator *getPrevIter(iterator *iter) {
std::list< CTYPE >::iterator it = *iter;
if (std::distance($self->begin(), it) != 0) {
std::list< CTYPE >::iterator* itprev = new std::list< CTYPE >::iterator(--it);
return itprev;
}
return NULL;
}
iterator *insertNode(iterator *iter, CTYPE const& value) {
std::list< CTYPE >::iterator it = $self->insert(*iter, value);
return new std::list< CTYPE >::iterator(it);
}
void eraseIter(iterator *iter) {
std::list< CTYPE >::iterator it = *iter;
$self->erase(it);
}
void deleteIter(iterator *iter) {
delete iter;
}
bool equals(iterator *iter1, iterator *iter2) {
if (iter1 == NULL && iter2 == NULL)
return true;
std::list< CTYPE >::iterator it1 = *iter1;
std::list< CTYPE >::iterator it2 = *iter2;
return it1 == it2;
}
}
%enddef
// Extra methods added to the collection class if operator== is defined for the class being wrapped
// The class will then implement ICollection<>, which adds extra functionality
%define SWIG_STD_LIST_EXTRA_OP_EQUALS_EQUALS(CTYPE...)
%extend {
bool Contains(CTYPE const& value) {
return std::find($self->begin(), $self->end(), value) != $self->end();
}
bool Remove(CTYPE const& value) {
std::list< CTYPE >::iterator it = std::find($self->begin(), $self->end(), value);
if (it != $self->end()) {
$self->erase(it);
return true;
}
return false;
}
iterator *find(CTYPE const& value) {
if (std::find($self->begin(), $self->end(), value) != $self->end()) {
return new std::list< CTYPE >::iterator(std::find($self->begin(), $self->end(), value));
}
return NULL;
}
}
%proxycode %{
public $csclassnameNode Find($typemap(cstype, CTYPE) value) {
System.IntPtr tmp = find(value);
if (tmp != System.IntPtr.Zero) {
return new $csclassnameNode(tmp, this);
}
return null;
}
%}
%enddef
// Macros for std::list class specializations/enhancements
%define SWIG_STD_LIST_ENHANCED(CTYPE...)
namespace std {
template<> class list< CTYPE > {
SWIG_STD_LIST_MINIMUM_INTERNAL(ICollection, %arg(CTYPE));
SWIG_STD_LIST_EXTRA_OP_EQUALS_EQUALS(CTYPE)
};
}
%enddef
%{
#include <list>
#include <algorithm>
#include <stdexcept>
%}
%csmethodmodifiers std::list::size "private"
%csmethodmodifiers std::list::getItem "private"
%csmethodmodifiers std::list::setItem "private"
%csmethodmodifiers std::list::push_front "private"
%csmethodmodifiers std::list::push_back "private"
%csmethodmodifiers std::list::getFirstIter "private"
%csmethodmodifiers std::list::getNextIter "private"
%csmethodmodifiers std::list::getPrevIter "private"
%csmethodmodifiers std::list::getLastIter "private"
%csmethodmodifiers std::list::find "private"
%csmethodmodifiers std::list::deleteIter "private"
namespace std {
// primary (unspecialized) class template for std::list
// does not require operator== to be defined
template<class T>
class list {
SWIG_STD_LIST_MINIMUM_INTERNAL(IEnumerable, T)
};
// specialization for pointers
template<class T>
class list<T *> {
SWIG_STD_LIST_MINIMUM_INTERNAL(ICollection, T *)
SWIG_STD_LIST_EXTRA_OP_EQUALS_EQUALS(T *)
};
}
// template specializations for std::list
// these provide extra collections methods as operator== is defined
SWIG_STD_LIST_ENHANCED(char)
SWIG_STD_LIST_ENHANCED(signed char)
SWIG_STD_LIST_ENHANCED(unsigned char)
SWIG_STD_LIST_ENHANCED(short)
SWIG_STD_LIST_ENHANCED(unsigned short)
SWIG_STD_LIST_ENHANCED(int)
SWIG_STD_LIST_ENHANCED(unsigned int)
SWIG_STD_LIST_ENHANCED(long)
SWIG_STD_LIST_ENHANCED(unsigned long)
SWIG_STD_LIST_ENHANCED(long long)
SWIG_STD_LIST_ENHANCED(unsigned long long)
SWIG_STD_LIST_ENHANCED(float)
SWIG_STD_LIST_ENHANCED(double)
SWIG_STD_LIST_ENHANCED(std::string) // also requires a %include <std_string.i>
SWIG_STD_LIST_ENHANCED(std::wstring) // also requires a %include <std_wstring.i>

View File

@ -0,0 +1,312 @@
/* -----------------------------------------------------------------------------
* std_map.i
*
* SWIG typemaps for std::map< K, T, C >
*
* The C# wrapper is made to look and feel like a C# System.Collections.Generic.IDictionary<>.
*
* Using this wrapper is fairly simple. For example, to create a map from integers to doubles use:
*
* %include <std_map.i>
* %template(MapIntDouble) std::map<int, double>
*
* Notes:
* 1) IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
* C++ std::map wrappers.
*
* Warning: heavy macro usage in this file. Use swig -E to get a sane view on the real file contents!
* ----------------------------------------------------------------------------- */
%{
#include <map>
#include <algorithm>
#include <stdexcept>
%}
/* K is the C++ key type, T is the C++ value type */
%define SWIG_STD_MAP_INTERNAL(K, T, C)
%typemap(csinterfaces) std::map< K, T, C > "global::System.IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n";
%proxycode %{
public $typemap(cstype, T) this[$typemap(cstype, K) key] {
get {
return getitem(key);
}
set {
setitem(key, value);
}
}
public bool TryGetValue($typemap(cstype, K) key, out $typemap(cstype, T) value) {
if (this.ContainsKey(key)) {
value = this[key];
return true;
}
value = default($typemap(cstype, T));
return false;
}
public int Count {
get {
return (int)size();
}
}
public bool IsReadOnly {
get {
return false;
}
}
public global::System.Collections.Generic.ICollection<$typemap(cstype, K)> Keys {
get {
global::System.Collections.Generic.ICollection<$typemap(cstype, K)> keys = new global::System.Collections.Generic.List<$typemap(cstype, K)>();
int size = this.Count;
if (size > 0) {
global::System.IntPtr iter = create_iterator_begin();
for (int i = 0; i < size; i++) {
keys.Add(get_next_key(iter));
}
destroy_iterator(iter);
}
return keys;
}
}
public global::System.Collections.Generic.ICollection<$typemap(cstype, T)> Values {
get {
global::System.Collections.Generic.ICollection<$typemap(cstype, T)> vals = new global::System.Collections.Generic.List<$typemap(cstype, T)>();
foreach (global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> pair in this) {
vals.Add(pair.Value);
}
return vals;
}
}
public void Add(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
Add(item.Key, item.Value);
}
public bool Remove(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
if (Contains(item)) {
return Remove(item.Key);
} else {
return false;
}
}
public bool Contains(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
if (this[item.Key] == item.Value) {
return true;
} else {
return false;
}
}
public void CopyTo(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array) {
CopyTo(array, 0);
}
public void CopyTo(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array, int arrayIndex) {
if (array == null)
throw new global::System.ArgumentNullException("array");
if (arrayIndex < 0)
throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
if (array.Rank > 1)
throw new global::System.ArgumentException("Multi dimensional array.", "array");
if (arrayIndex+this.Count > array.Length)
throw new global::System.ArgumentException("Number of elements to copy is too large.");
global::System.Collections.Generic.IList<$typemap(cstype, K)> keyList = new global::System.Collections.Generic.List<$typemap(cstype, K)>(this.Keys);
for (int i = 0; i < keyList.Count; i++) {
$typemap(cstype, K) currentKey = keyList[i];
array.SetValue(new global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, this[currentKey]), arrayIndex+i);
}
}
global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>> global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>>.GetEnumerator() {
return new $csclassnameEnumerator(this);
}
global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
return new $csclassnameEnumerator(this);
}
public $csclassnameEnumerator GetEnumerator() {
return new $csclassnameEnumerator(this);
}
// Type-safe enumerator
/// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown
/// whenever the collection is modified. This has been done for changes in the size of the
/// collection but not when one of the elements of the collection is modified as it is a bit
/// tricky to detect unmanaged code that modifies the collection under our feet.
public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator,
global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>>
{
private $csclassname collectionRef;
private global::System.Collections.Generic.IList<$typemap(cstype, K)> keyCollection;
private int currentIndex;
private object currentObject;
private int currentSize;
public $csclassnameEnumerator($csclassname collection) {
collectionRef = collection;
keyCollection = new global::System.Collections.Generic.List<$typemap(cstype, K)>(collection.Keys);
currentIndex = -1;
currentObject = null;
currentSize = collectionRef.Count;
}
// Type-safe iterator Current
public global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> Current {
get {
if (currentIndex == -1)
throw new global::System.InvalidOperationException("Enumeration not started.");
if (currentIndex > currentSize - 1)
throw new global::System.InvalidOperationException("Enumeration finished.");
if (currentObject == null)
throw new global::System.InvalidOperationException("Collection modified.");
return (global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>)currentObject;
}
}
// Type-unsafe IEnumerator.Current
object global::System.Collections.IEnumerator.Current {
get {
return Current;
}
}
public bool MoveNext() {
int size = collectionRef.Count;
bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
if (moveOkay) {
currentIndex++;
$typemap(cstype, K) currentKey = keyCollection[currentIndex];
currentObject = new global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, collectionRef[currentKey]);
} else {
currentObject = null;
}
return moveOkay;
}
public void Reset() {
currentIndex = -1;
currentObject = null;
if (collectionRef.Count != currentSize) {
throw new global::System.InvalidOperationException("Collection modified.");
}
}
public void Dispose() {
currentIndex = -1;
currentObject = null;
}
}
%}
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef K key_type;
typedef T mapped_type;
typedef std::pair< const K, T > value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type& reference;
typedef const value_type& const_reference;
map();
map(const map& other);
size_type size() const;
bool empty() const;
%rename(Clear) clear;
void clear();
%extend {
const mapped_type& getitem(const key_type& key) throw (std::out_of_range) {
std::map< K, T, C >::iterator iter = $self->find(key);
if (iter != $self->end())
return iter->second;
else
throw std::out_of_range("key not found");
}
void setitem(const key_type& key, const mapped_type& x) {
(*$self)[key] = x;
}
bool ContainsKey(const key_type& key) {
std::map< K, T, C >::iterator iter = $self->find(key);
return iter != $self->end();
}
void Add(const key_type& key, const mapped_type& value) throw (std::out_of_range) {
std::map< K, T, C >::iterator iter = $self->find(key);
if (iter != $self->end())
throw std::out_of_range("key already exists");
$self->insert(std::pair< K, T >(key, value));
}
bool Remove(const key_type& key) {
std::map< K, T, C >::iterator iter = $self->find(key);
if (iter != $self->end()) {
$self->erase(iter);
return true;
}
return false;
}
// create_iterator_begin(), get_next_key() and destroy_iterator work together to provide a collection of keys to C#
%apply void *VOID_INT_PTR { std::map< K, T, C >::iterator *create_iterator_begin }
%apply void *VOID_INT_PTR { std::map< K, T, C >::iterator *swigiterator }
std::map< K, T, C >::iterator *create_iterator_begin() {
return new std::map< K, T, C >::iterator($self->begin());
}
const key_type& get_next_key(std::map< K, T, C >::iterator *swigiterator) {
std::map< K, T, C >::iterator iter = *swigiterator;
(*swigiterator)++;
return (*iter).first;
}
void destroy_iterator(std::map< K, T, C >::iterator *swigiterator) {
delete swigiterator;
}
}
%enddef
%csmethodmodifiers std::map::size "private"
%csmethodmodifiers std::map::getitem "private"
%csmethodmodifiers std::map::setitem "private"
%csmethodmodifiers std::map::create_iterator_begin "private"
%csmethodmodifiers std::map::get_next_key "private"
%csmethodmodifiers std::map::destroy_iterator "private"
// Default implementation
namespace std {
template<class K, class T, class C = std::less<K> > class map {
SWIG_STD_MAP_INTERNAL(K, T, C)
};
}
// Legacy macros (deprecated)
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary"
%enddef
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary"
%enddef
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary"
%enddef

View File

@ -0,0 +1,36 @@
/* -----------------------------------------------------------------------------
* std_pair.i
*
* SWIG typemaps for std::pair
* ----------------------------------------------------------------------------- */
%include <std_common.i>
%include <exception.i>
// ------------------------------------------------------------------------
// std::pair
// ------------------------------------------------------------------------
%{
#include <utility>
%}
namespace std {
template<class T, class U> struct pair {
typedef T first_type;
typedef U second_type;
pair();
pair(T first, U second);
pair(const pair& other);
template <class U1, class U2> pair(const pair<U1, U2> &other);
T first;
U second;
};
// add specializations here
}

View File

@ -0,0 +1,311 @@
/* -----------------------------------------------------------------------------
* std_set.i
*
* SWIG typemaps for std::set<T>.
*
* Note that ISet<> used here requires .NET 4 or later.
*
* The C# wrapper implements ISet<> interface and shares performance
* characteristics of C# System.Collections.Generic.SortedSet<> class, but
* doesn't provide quite all of its methods.
* ----------------------------------------------------------------------------- */
%{
#include <set>
#include <algorithm>
#include <stdexcept>
%}
%csmethodmodifiers std::set::size "private"
%csmethodmodifiers std::set::getitem "private"
%csmethodmodifiers std::set::create_iterator_begin "private"
%csmethodmodifiers std::set::get_next "private"
%csmethodmodifiers std::set::destroy_iterator "private"
namespace std {
// TODO: Add support for comparator and allocator template parameters.
template <class T>
class set {
%typemap(csinterfaces) std::set<T> "global::System.IDisposable, global::System.Collections.Generic.ISet<$typemap(cstype, T)>\n";
%proxycode %{
void global::System.Collections.Generic.ICollection<$typemap(cstype, T)>.Add($typemap(cstype, T) item) {
((global::System.Collections.Generic.ISet<$typemap(cstype, T)>)this).Add(item);
}
public bool TryGetValue($typemap(cstype, T) equalValue, out $typemap(cstype, T) actualValue) {
try {
actualValue = getitem(equalValue);
return true;
} catch {
actualValue = default($typemap(cstype, T));
return false;
}
}
public int Count {
get {
return (int)size();
}
}
public bool IsReadOnly {
get {
return false;
}
}
public void CopyTo($typemap(cstype, T)[] array) {
CopyTo(array, 0);
}
public void CopyTo($typemap(cstype, T)[] array, int arrayIndex) {
if (array == null)
throw new global::System.ArgumentNullException("array");
if (arrayIndex < 0)
throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
if (array.Rank > 1)
throw new global::System.ArgumentException("Multi dimensional array.", "array");
if (arrayIndex+this.Count > array.Length)
throw new global::System.ArgumentException("Number of elements to copy is too large.");
foreach ($typemap(cstype, T) item in this) {
array.SetValue(item, arrayIndex++);
}
}
public void ExceptWith(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
foreach ($typemap(cstype, T) item in other) {
Remove(item);
}
}
public void IntersectWith(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
$csclassname old = new $csclassname(this);
Clear();
foreach ($typemap(cstype, T) item in other) {
if (old.Contains(item))
Add(item);
}
}
private static int count_enum(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
int count = 0;
foreach ($typemap(cstype, T) item in other) {
count++;
}
return count;
}
public bool IsProperSubsetOf(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
return IsSubsetOf(other) && Count < count_enum(other);
}
public bool IsProperSupersetOf(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
return IsSupersetOf(other) && Count > count_enum(other);
}
public bool IsSubsetOf(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
int countContained = 0;
foreach ($typemap(cstype, T) item in other) {
if (Contains(item))
countContained++;
}
return countContained == Count;
}
public bool IsSupersetOf(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
foreach ($typemap(cstype, T) item in other) {
if (!Contains(item))
return false;
}
return true;
}
public bool Overlaps(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
foreach ($typemap(cstype, T) item in other) {
if (Contains(item))
return true;
}
return false;
}
public bool SetEquals(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
return IsSupersetOf(other) && Count == count_enum(other);
}
public void SymmetricExceptWith(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
foreach ($typemap(cstype, T) item in other) {
if (!Remove(item))
Add(item);
}
}
public void UnionWith(global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)> other) {
foreach ($typemap(cstype, T) item in other) {
Add(item);
}
}
private global::System.Collections.Generic.ICollection<$typemap(cstype, T)> Items {
get {
global::System.Collections.Generic.ICollection<$typemap(cstype, T)> items = new global::System.Collections.Generic.List<$typemap(cstype, T)>();
int size = this.Count;
if (size > 0) {
global::System.IntPtr iter = create_iterator_begin();
for (int i = 0; i < size; i++) {
items.Add(get_next(iter));
}
destroy_iterator(iter);
}
return items;
}
}
global::System.Collections.Generic.IEnumerator<$typemap(cstype, T)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>.GetEnumerator() {
return new $csclassnameEnumerator(this);
}
global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
return new $csclassnameEnumerator(this);
}
public $csclassnameEnumerator GetEnumerator() {
return new $csclassnameEnumerator(this);
}
// Type-safe enumerator
/// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown
/// whenever the collection is modified. This has been done for changes in the size of the
/// collection but not when one of the elements of the collection is modified as it is a bit
/// tricky to detect unmanaged code that modifies the collection under our feet.
public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator,
global::System.Collections.Generic.IEnumerator<$typemap(cstype, T)>
{
private $csclassname collectionRef;
private global::System.Collections.Generic.IList<$typemap(cstype, T)> ItemsCollection;
private int currentIndex;
private object currentObject;
private int currentSize;
public $csclassnameEnumerator($csclassname collection) {
collectionRef = collection;
ItemsCollection = new global::System.Collections.Generic.List<$typemap(cstype, T)>(collection.Items);
currentIndex = -1;
currentObject = null;
currentSize = collectionRef.Count;
}
// Type-safe iterator Current
public $typemap(cstype, T) Current {
get {
if (currentIndex == -1)
throw new global::System.InvalidOperationException("Enumeration not started.");
if (currentIndex > currentSize - 1)
throw new global::System.InvalidOperationException("Enumeration finished.");
if (currentObject == null)
throw new global::System.InvalidOperationException("Collection modified.");
return ($typemap(cstype, T))currentObject;
}
}
// Type-unsafe IEnumerator.Current
object global::System.Collections.IEnumerator.Current {
get {
return Current;
}
}
public bool MoveNext() {
int size = collectionRef.Count;
bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
if (moveOkay) {
currentIndex++;
currentObject = ItemsCollection[currentIndex];
} else {
currentObject = null;
}
return moveOkay;
}
public void Reset() {
currentIndex = -1;
currentObject = null;
if (collectionRef.Count != currentSize) {
throw new global::System.InvalidOperationException("Collection modified.");
}
}
public void Dispose() {
currentIndex = -1;
currentObject = null;
}
}
%}
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef T key_type;
typedef T value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type& reference;
typedef const value_type& const_reference;
set();
set(const set& other);
size_type size() const;
bool empty() const;
%rename(Clear) clear;
void clear();
%extend {
bool Add(const value_type& item) {
return $self->insert(item).second;
}
bool Contains(const value_type& item) {
return $self->count(item) != 0;
}
bool Remove(const value_type& item) {
return $self->erase(item) != 0;
}
const value_type& getitem(const value_type& item) throw (std::out_of_range) {
std::set<T>::iterator iter = $self->find(item);
if (iter == $self->end())
throw std::out_of_range("item not found");
return *iter;
}
// create_iterator_begin(), get_next() and destroy_iterator work together to provide a collection of items to C#
%apply void *VOID_INT_PTR { std::set<T>::iterator *create_iterator_begin }
%apply void *VOID_INT_PTR { std::set<T>::iterator *swigiterator }
std::set<T>::iterator *create_iterator_begin() {
return new std::set<T>::iterator($self->begin());
}
const key_type& get_next(std::set<T>::iterator *swigiterator) {
std::set<T>::iterator iter = *swigiterator;
(*swigiterator)++;
return *iter;
}
void destroy_iterator(std::set<T>::iterator *swigiterator) {
delete swigiterator;
}
}
};
}

View File

@ -0,0 +1,2 @@
#define SWIG_SHARED_PTR_NAMESPACE std
%include <boost_shared_ptr.i>

View File

@ -0,0 +1,111 @@
/* -----------------------------------------------------------------------------
* std_string.i
*
* Typemaps for std::string and const std::string&
* These are mapped to a C# String and are passed around by value.
*
* To use non-const std::string references use the following %apply. Note
* that they are passed by value.
* %apply const std::string & {std::string &};
* ----------------------------------------------------------------------------- */
%{
#include <string>
%}
namespace std {
%naturalvar string;
class string;
// string
%typemap(ctype) string "const char *"
%typemap(imtype) string "string"
%typemap(cstype) string "string"
%typemap(csdirectorin) string "$iminput"
%typemap(csdirectorout) string "$cscall"
%typemap(in, canthrow=1) string
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
return $null;
}
$1.assign($input); %}
%typemap(out) string %{ $result = SWIG_csharp_string_callback($1.c_str()); %}
%typemap(directorout, canthrow=1) string
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
return $null;
}
$result.assign($input); %}
%typemap(directorin) string %{ $input = $1.c_str(); %}
%typemap(csin) string "$csinput"
%typemap(csout, excode=SWIGEXCODE) string {
string ret = $imcall;$excode
return ret;
}
%typemap(typecheck) string = char *;
%typemap(throws, canthrow=1) string
%{ SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.c_str());
return $null; %}
// const string &
%typemap(ctype) const string & "const char *"
%typemap(imtype) const string & "string"
%typemap(cstype) const string & "string"
%typemap(csdirectorin) const string & "$iminput"
%typemap(csdirectorout) const string & "$cscall"
%typemap(in, canthrow=1) const string &
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
return $null;
}
$*1_ltype $1_str($input);
$1 = &$1_str; %}
%typemap(out) const string & %{ $result = SWIG_csharp_string_callback($1->c_str()); %}
%typemap(csin) const string & "$csinput"
%typemap(csout, excode=SWIGEXCODE) const string & {
string ret = $imcall;$excode
return ret;
}
%typemap(directorout, canthrow=1, warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const string &
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
return $null;
}
/* possible thread/reentrant code problem */
static $*1_ltype $1_str;
$1_str = $input;
$result = &$1_str; %}
%typemap(directorin) const string & %{ $input = $1.c_str(); %}
%typemap(csvarin, excode=SWIGEXCODE2) const string & %{
set {
$imcall;$excode
} %}
%typemap(csvarout, excode=SWIGEXCODE2) const string & %{
get {
string ret = $imcall;$excode
return ret;
} %}
%typemap(typecheck) const string & = char *;
%typemap(throws, canthrow=1) const string &
%{ SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.c_str());
return $null; %}
}

View File

@ -0,0 +1,418 @@
/* -----------------------------------------------------------------------------
* std_vector.i
*
* SWIG typemaps for std::vector<T>
* C# implementation
* The C# wrapper is made to look and feel like a C# System.Collections.Generic.List<> collection.
*
* Note that IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
* C++ std::vector wrappers. The IList<> interface is also implemented to provide enhanced functionality
* whenever we are confident that the required C++ operator== is available. This is the case for when
* T is a primitive type or a pointer. If T does define an operator==, then use the SWIG_STD_VECTOR_ENHANCED
* macro to obtain this enhanced functionality, for example:
*
* SWIG_STD_VECTOR_ENHANCED(SomeNamespace::Klass)
* %template(VectKlass) std::vector<SomeNamespace::Klass>;
* ----------------------------------------------------------------------------- */
%include <std_common.i>
// MACRO for use within the std::vector class body
%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CSINTERFACE, CONST_REFERENCE, CTYPE...)
%typemap(csinterfaces) std::vector< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n";
%proxycode %{
public $csclassname(global::System.Collections.IEnumerable c) : this() {
if (c == null)
throw new global::System.ArgumentNullException("c");
foreach ($typemap(cstype, CTYPE) element in c) {
this.Add(element);
}
}
public $csclassname(global::System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)> c) : this() {
if (c == null)
throw new global::System.ArgumentNullException("c");
foreach ($typemap(cstype, CTYPE) element in c) {
this.Add(element);
}
}
public bool IsFixedSize {
get {
return false;
}
}
public bool IsReadOnly {
get {
return false;
}
}
public $typemap(cstype, CTYPE) this[int index] {
get {
return getitem(index);
}
set {
setitem(index, value);
}
}
public int Capacity {
get {
return (int)capacity();
}
set {
if (value < 0 || ($typemap(cstype, size_t))value < size())
throw new global::System.ArgumentOutOfRangeException("Capacity");
reserve(($typemap(cstype, size_t))value);
}
}
public int Count {
get {
return (int)size();
}
}
public bool IsSynchronized {
get {
return false;
}
}
public void CopyTo($typemap(cstype, CTYPE)[] array)
{
CopyTo(0, array, 0, this.Count);
}
public void CopyTo($typemap(cstype, CTYPE)[] array, int arrayIndex)
{
CopyTo(0, array, arrayIndex, this.Count);
}
public void CopyTo(int index, $typemap(cstype, CTYPE)[] array, int arrayIndex, int count)
{
if (array == null)
throw new global::System.ArgumentNullException("array");
if (index < 0)
throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero");
if (arrayIndex < 0)
throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
if (count < 0)
throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero");
if (array.Rank > 1)
throw new global::System.ArgumentException("Multi dimensional array.", "array");
if (index+count > this.Count || arrayIndex+count > array.Length)
throw new global::System.ArgumentException("Number of elements to copy is too large.");
for (int i=0; i<count; i++)
array.SetValue(getitemcopy(index+i), arrayIndex+i);
}
public $typemap(cstype, CTYPE)[] ToArray() {
$typemap(cstype, CTYPE)[] array = new $typemap(cstype, CTYPE)[this.Count];
this.CopyTo(array);
return array;
}
global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)>.GetEnumerator() {
return new $csclassnameEnumerator(this);
}
global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
return new $csclassnameEnumerator(this);
}
public $csclassnameEnumerator GetEnumerator() {
return new $csclassnameEnumerator(this);
}
// Type-safe enumerator
/// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown
/// whenever the collection is modified. This has been done for changes in the size of the
/// collection but not when one of the elements of the collection is modified as it is a bit
/// tricky to detect unmanaged code that modifies the collection under our feet.
public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator
, global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)>
{
private $csclassname collectionRef;
private int currentIndex;
private object currentObject;
private int currentSize;
public $csclassnameEnumerator($csclassname collection) {
collectionRef = collection;
currentIndex = -1;
currentObject = null;
currentSize = collectionRef.Count;
}
// Type-safe iterator Current
public $typemap(cstype, CTYPE) Current {
get {
if (currentIndex == -1)
throw new global::System.InvalidOperationException("Enumeration not started.");
if (currentIndex > currentSize - 1)
throw new global::System.InvalidOperationException("Enumeration finished.");
if (currentObject == null)
throw new global::System.InvalidOperationException("Collection modified.");
return ($typemap(cstype, CTYPE))currentObject;
}
}
// Type-unsafe IEnumerator.Current
object global::System.Collections.IEnumerator.Current {
get {
return Current;
}
}
public bool MoveNext() {
int size = collectionRef.Count;
bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
if (moveOkay) {
currentIndex++;
currentObject = collectionRef[currentIndex];
} else {
currentObject = null;
}
return moveOkay;
}
public void Reset() {
currentIndex = -1;
currentObject = null;
if (collectionRef.Count != currentSize) {
throw new global::System.InvalidOperationException("Collection modified.");
}
}
public void Dispose() {
currentIndex = -1;
currentObject = null;
}
}
%}
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef CTYPE value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type& reference;
typedef CONST_REFERENCE const_reference;
%rename(Clear) clear;
void clear();
%rename(Add) push_back;
void push_back(CTYPE const& x);
size_type size() const;
size_type capacity() const;
void reserve(size_type n);
%newobject GetRange(int index, int count);
%newobject Repeat(CTYPE const& value, int count);
vector();
vector(const vector &other);
%extend {
vector(int capacity) throw (std::out_of_range) {
std::vector< CTYPE >* pv = 0;
if (capacity >= 0) {
pv = new std::vector< CTYPE >();
pv->reserve(capacity);
} else {
throw std::out_of_range("capacity");
}
return pv;
}
CTYPE getitemcopy(int index) throw (std::out_of_range) {
if (index>=0 && index<(int)$self->size())
return (*$self)[index];
else
throw std::out_of_range("index");
}
CONST_REFERENCE getitem(int index) throw (std::out_of_range) {
if (index>=0 && index<(int)$self->size())
return (*$self)[index];
else
throw std::out_of_range("index");
}
void setitem(int index, CTYPE const& val) throw (std::out_of_range) {
if (index>=0 && index<(int)$self->size())
(*$self)[index] = val;
else
throw std::out_of_range("index");
}
// Takes a deep copy of the elements unlike ArrayList.AddRange
void AddRange(const std::vector< CTYPE >& values) {
$self->insert($self->end(), values.begin(), values.end());
}
// Takes a deep copy of the elements unlike ArrayList.GetRange
std::vector< CTYPE > *GetRange(int index, int count) throw (std::out_of_range, std::invalid_argument) {
if (index < 0)
throw std::out_of_range("index");
if (count < 0)
throw std::out_of_range("count");
if (index >= (int)$self->size()+1 || index+count > (int)$self->size())
throw std::invalid_argument("invalid range");
return new std::vector< CTYPE >($self->begin()+index, $self->begin()+index+count);
}
void Insert(int index, CTYPE const& x) throw (std::out_of_range) {
if (index>=0 && index<(int)$self->size()+1)
$self->insert($self->begin()+index, x);
else
throw std::out_of_range("index");
}
// Takes a deep copy of the elements unlike ArrayList.InsertRange
void InsertRange(int index, const std::vector< CTYPE >& values) throw (std::out_of_range) {
if (index>=0 && index<(int)$self->size()+1)
$self->insert($self->begin()+index, values.begin(), values.end());
else
throw std::out_of_range("index");
}
void RemoveAt(int index) throw (std::out_of_range) {
if (index>=0 && index<(int)$self->size())
$self->erase($self->begin() + index);
else
throw std::out_of_range("index");
}
void RemoveRange(int index, int count) throw (std::out_of_range, std::invalid_argument) {
if (index < 0)
throw std::out_of_range("index");
if (count < 0)
throw std::out_of_range("count");
if (index >= (int)$self->size()+1 || index+count > (int)$self->size())
throw std::invalid_argument("invalid range");
$self->erase($self->begin()+index, $self->begin()+index+count);
}
static std::vector< CTYPE > *Repeat(CTYPE const& value, int count) throw (std::out_of_range) {
if (count < 0)
throw std::out_of_range("count");
return new std::vector< CTYPE >(count, value);
}
void Reverse() {
std::reverse($self->begin(), $self->end());
}
void Reverse(int index, int count) throw (std::out_of_range, std::invalid_argument) {
if (index < 0)
throw std::out_of_range("index");
if (count < 0)
throw std::out_of_range("count");
if (index >= (int)$self->size()+1 || index+count > (int)$self->size())
throw std::invalid_argument("invalid range");
std::reverse($self->begin()+index, $self->begin()+index+count);
}
// Takes a deep copy of the elements unlike ArrayList.SetRange
void SetRange(int index, const std::vector< CTYPE >& values) throw (std::out_of_range) {
if (index < 0)
throw std::out_of_range("index");
if (index+values.size() > $self->size())
throw std::out_of_range("index");
std::copy(values.begin(), values.end(), $self->begin()+index);
}
}
%enddef
// Extra methods added to the collection class if operator== is defined for the class being wrapped
// The class will then implement IList<>, which adds extra functionality
%define SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CTYPE...)
%extend {
bool Contains(CTYPE const& value) {
return std::find($self->begin(), $self->end(), value) != $self->end();
}
int IndexOf(CTYPE const& value) {
int index = -1;
std::vector< CTYPE >::iterator it = std::find($self->begin(), $self->end(), value);
if (it != $self->end())
index = (int)(it - $self->begin());
return index;
}
int LastIndexOf(CTYPE const& value) {
int index = -1;
std::vector< CTYPE >::reverse_iterator rit = std::find($self->rbegin(), $self->rend(), value);
if (rit != $self->rend())
index = (int)($self->rend() - 1 - rit);
return index;
}
bool Remove(CTYPE const& value) {
std::vector< CTYPE >::iterator it = std::find($self->begin(), $self->end(), value);
if (it != $self->end()) {
$self->erase(it);
return true;
}
return false;
}
}
%enddef
// Macros for std::vector class specializations/enhancements
%define SWIG_STD_VECTOR_ENHANCED(CTYPE...)
namespace std {
template<> class vector< CTYPE > {
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, const value_type&, %arg(CTYPE))
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CTYPE)
};
}
%enddef
// Legacy macros
%define SWIG_STD_VECTOR_SPECIALIZE(CSTYPE, CTYPE...)
#warning SWIG_STD_VECTOR_SPECIALIZE macro deprecated, please see csharp/std_vector.i and switch to SWIG_STD_VECTOR_ENHANCED
SWIG_STD_VECTOR_ENHANCED(CTYPE)
%enddef
%define SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(CSTYPE, CTYPE...)
#warning SWIG_STD_VECTOR_SPECIALIZE_MINIMUM macro deprecated, it is no longer required
%enddef
%{
#include <vector>
#include <algorithm>
#include <stdexcept>
%}
%csmethodmodifiers std::vector::getitemcopy "private"
%csmethodmodifiers std::vector::getitem "private"
%csmethodmodifiers std::vector::setitem "private"
%csmethodmodifiers std::vector::size "private"
%csmethodmodifiers std::vector::capacity "private"
%csmethodmodifiers std::vector::reserve "private"
namespace std {
// primary (unspecialized) class template for std::vector
// does not require operator== to be defined
template<class T> class vector {
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IEnumerable, const value_type&, T)
};
// specialization for pointers
template<class T> class vector<T *> {
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, const value_type&, T *)
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(T *)
};
// bool is specialized in the C++ standard - const_reference in particular
template<> class vector<bool> {
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, bool, bool)
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(bool)
};
}
// template specializations for std::vector
// these provide extra collections methods as operator== is defined
SWIG_STD_VECTOR_ENHANCED(char)
SWIG_STD_VECTOR_ENHANCED(signed char)
SWIG_STD_VECTOR_ENHANCED(unsigned char)
SWIG_STD_VECTOR_ENHANCED(short)
SWIG_STD_VECTOR_ENHANCED(unsigned short)
SWIG_STD_VECTOR_ENHANCED(int)
SWIG_STD_VECTOR_ENHANCED(unsigned int)
SWIG_STD_VECTOR_ENHANCED(long)
SWIG_STD_VECTOR_ENHANCED(unsigned long)
SWIG_STD_VECTOR_ENHANCED(long long)
SWIG_STD_VECTOR_ENHANCED(unsigned long long)
SWIG_STD_VECTOR_ENHANCED(float)
SWIG_STD_VECTOR_ENHANCED(double)
SWIG_STD_VECTOR_ENHANCED(std::string) // also requires a %include <std_string.i>
SWIG_STD_VECTOR_ENHANCED(std::wstring) // also requires a %include <std_wstring.i>

View File

@ -0,0 +1,120 @@
/* -----------------------------------------------------------------------------
* std_wstring.i
*
* Typemaps for std::wstring and const std::wstring&
* These are mapped to a C# String and are passed around by value.
*
* To use non-const std::wstring references use the following %apply. Note
* that they are passed by value.
* %apply const std::wstring & {std::wstring &};
* ----------------------------------------------------------------------------- */
%include <wchar.i>
%{
#include <string>
%}
namespace std {
%naturalvar wstring;
class wstring;
// wstring
%typemap(ctype, out="void *") wstring "wchar_t *"
%typemap(imtype,
inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]",
outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]"
) wstring "string"
%typemap(cstype) wstring "string"
%typemap(csdirectorin) wstring "$iminput"
%typemap(csdirectorout) wstring "$cscall"
%typemap(in, canthrow=1) wstring
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
return $null;
}
$1.assign($input); %}
%typemap(out) wstring %{ $result = SWIG_csharp_wstring_callback($1.c_str()); %}
%typemap(directorout, canthrow=1) wstring
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
return $null;
}
$result.assign($input); %}
%typemap(directorin) wstring %{ $input = SWIG_csharp_wstring_callback($1.c_str()); %}
%typemap(csin) wstring "$csinput"
%typemap(csout, excode=SWIGEXCODE) wstring {
string ret = $imcall;$excode
return ret;
}
%typemap(typecheck) wstring = wchar_t *;
%typemap(throws, canthrow=1) wstring
%{ std::string message($1.begin(), $1.end());
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, message.c_str());
return $null; %}
// const wstring &
%typemap(ctype, out="void *") const wstring & "wchar_t *"
%typemap(imtype,
inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]",
outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]"
) const wstring & "string"
%typemap(cstype) const wstring & "string"
%typemap(csdirectorin) const wstring & "$iminput"
%typemap(csdirectorout) const wstring & "$cscall"
%typemap(in, canthrow=1) const wstring &
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
return $null;
}
std::wstring $1_str($input);
$1 = &$1_str; %}
%typemap(out) const wstring & %{ $result = SWIG_csharp_wstring_callback($1->c_str()); %}
%typemap(csin) const wstring & "$csinput"
%typemap(csout, excode=SWIGEXCODE) const wstring & {
string ret = $imcall;$excode
return ret;
}
%typemap(directorout, canthrow=1, warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const wstring &
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
return $null;
}
/* possible thread/reentrant code problem */
static std::wstring $1_str;
$1_str = $input;
$result = &$1_str; %}
%typemap(directorin) const wstring & %{ $input = SWIG_csharp_wstring_callback($1.c_str()); %}
%typemap(csvarin, excode=SWIGEXCODE2) const wstring & %{
set {
$imcall;$excode
} %}
%typemap(csvarout, excode=SWIGEXCODE2) const wstring & %{
get {
string ret = $imcall;$excode
return ret;
} %}
%typemap(typecheck) const wstring & = wchar_t *;
%typemap(throws, canthrow=1) const wstring &
%{ std::string message($1.begin(), $1.end());
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, message.c_str());
return $null; %}
}

View File

@ -0,0 +1,10 @@
/* -----------------------------------------------------------------------------
* stl.i
* ----------------------------------------------------------------------------- */
%include <std_common.i>
%include <std_string.i>
%include <std_vector.i>
%include <std_map.i>
%include <std_pair.i>

View File

@ -0,0 +1,63 @@
/* -----------------------------------------------------------------------------
* swiginterface.i
*
* SWIG interface feature and typemaps implementation providing:
* %interface
* %interface_impl
* %interface_custom
* ----------------------------------------------------------------------------- */
%define INTERFACE_TYPEMAPS(CTYPE...)
%typemap(cstype) CTYPE "$&csinterfacename"
%typemap(cstype) CTYPE *, CTYPE [], CTYPE & "$csinterfacename"
%typemap(cstype) CTYPE *const& "$*csinterfacename"
%typemap(csin) CTYPE, CTYPE & "$csinput.GetInterfaceCPtr()"
%typemap(csin) CTYPE *, CTYPE *const&, CTYPE [] "$csinput == null ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : $csinput.GetInterfaceCPtr()"
%typemap(csout, excode=SWIGEXCODE) CTYPE {
$&csclassname ret = new $&csclassname($imcall, true);$excode
return ($&csinterfacename)ret;
}
%typemap(csout, excode=SWIGEXCODE) CTYPE & {
$csclassname ret = new $csclassname($imcall, $owner);$excode
return ($csinterfacename)ret;
}
%typemap(csout, excode=SWIGEXCODE) CTYPE *, CTYPE [] {
global::System.IntPtr cPtr = $imcall;
$csclassname ret = (cPtr == global::System.IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode
return ($csinterfacename)ret;
}
%typemap(csout, excode=SWIGEXCODE) CTYPE *const& {
global::System.IntPtr cPtr = $imcall;
$*csclassname ret = (cPtr == global::System.IntPtr.Zero) ? null : new $*csclassname(cPtr, $owner);$excode
return ($*csinterfacename)ret;
}
%typemap(csdirectorin) CTYPE "($&csinterfacename)new $&csclassname($iminput, true)"
%typemap(csdirectorin) CTYPE & "($csinterfacename)new $csclassname($iminput, false)"
%typemap(csdirectorin) CTYPE *, CTYPE [] "($iminput == global::System.IntPtr.Zero) ? null : ($csinterfacename)new $csclassname($iminput, false)"
%typemap(csdirectorin) CTYPE *const& "($iminput == global::System.IntPtr.Zero) ? null : ($*csinterfacename)new $*csclassname($iminput, false)"
%typemap(csdirectorout) CTYPE, CTYPE *, CTYPE *const&, CTYPE [], CTYPE & "$cscall.GetInterfaceCPtr()"
%typemap(csinterfacecode, declaration=" [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\n global::System.Runtime.InteropServices.HandleRef GetInterfaceCPtr();\n", cptrmethod="$interfacename_GetInterfaceCPtr") CTYPE %{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
global::System.Runtime.InteropServices.HandleRef $interfacename.GetInterfaceCPtr() {
return new global::System.Runtime.InteropServices.HandleRef(this, $imclassname.$csclazzname$interfacename_GetInterfaceCPtr(swigCPtr.Handle));
}
%}
%enddef
%define %interface(CTYPE...)
%feature("interface", name="%sSwigInterface") CTYPE;
INTERFACE_TYPEMAPS(CTYPE)
%enddef
%define %interface_impl(CTYPE...)
%rename("%sSwigImpl") CTYPE;
%feature("interface", name="%(rstrip:[SwigImpl])s") CTYPE;
INTERFACE_TYPEMAPS(CTYPE)
%enddef
%define %interface_custom(PROXY, INTERFACE, CTYPE...)
%rename(PROXY) CTYPE;
%feature("interface", name=INTERFACE) CTYPE;
INTERFACE_TYPEMAPS(CTYPE)
%enddef

View File

@ -0,0 +1,34 @@
/* -----------------------------------------------------------------------------
* swigtype_inout.i
*
* Pointer pointer and pointer reference handling typemap library for non-primitive types
*
* These mappings provide support for input/output arguments and common
* uses for C/C++ pointer references and pointer to pointers.
*
* These are named typemaps (OUTPUT) and can be used like any named typemap.
* Alternatively they can be made the default by using %apply:
* %apply SWIGTYPE *& OUTPUT { SWIGTYPE *& }
* ----------------------------------------------------------------------------- */
/*
* OUTPUT typemaps. Example usage wrapping:
*
* void f(XXX *& x) { x = new XXX(111); }
*
* would be:
*
* XXX x = null;
* f(out x);
* // use x
* x.Dispose(); // manually clear memory or otherwise leave out and leave it to the garbage collector
*/
%typemap(ctype) SWIGTYPE *& OUTPUT "void **"
%typemap(imtype, out="global::System.IntPtr") SWIGTYPE *& OUTPUT "out global::System.IntPtr"
%typemap(cstype) SWIGTYPE *& OUTPUT "out $*csclassname"
%typemap(csin,
pre=" global::System.IntPtr cPtr_$csinput = global::System.IntPtr.Zero;",
post=" $csinput = (cPtr_$csinput == global::System.IntPtr.Zero) ? null : new $*csclassname(cPtr_$csinput, true);",
cshin="out $csinput") SWIGTYPE *& OUTPUT "out cPtr_$csinput"
%typemap(in) SWIGTYPE *& OUTPUT %{ $1 = ($1_ltype)$input; %}
%typemap(freearg) SWIGTYPE *& OUTPUT ""

View File

@ -0,0 +1,253 @@
/* -----------------------------------------------------------------------------
* typemaps.i
*
* Pointer and reference handling typemap library
*
* These mappings provide support for input/output arguments and common
* uses for C/C++ pointers and C++ references.
* ----------------------------------------------------------------------------- */
/*
INPUT typemaps
--------------
These typemaps are used for pointer/reference parameters that are input only
and are mapped to a C# input parameter.
The following typemaps can be applied to turn a pointer or reference into a simple
input value. That is, instead of passing a pointer or reference to an object,
you would use a real value instead.
bool *INPUT, bool &INPUT
signed char *INPUT, signed char &INPUT
unsigned char *INPUT, unsigned char &INPUT
short *INPUT, short &INPUT
unsigned short *INPUT, unsigned short &INPUT
int *INPUT, int &INPUT
unsigned int *INPUT, unsigned int &INPUT
long *INPUT, long &INPUT
unsigned long *INPUT, unsigned long &INPUT
long long *INPUT, long long &INPUT
unsigned long long *INPUT, unsigned long long &INPUT
float *INPUT, float &INPUT
double *INPUT, double &INPUT
To use these, suppose you had a C function like this :
double fadd(double *a, double *b) {
return *a+*b;
}
You could wrap it with SWIG as follows :
%include <typemaps.i>
double fadd(double *INPUT, double *INPUT);
or you can use the %apply directive :
%include <typemaps.i>
%apply double *INPUT { double *a, double *b };
double fadd(double *a, double *b);
In C# you could then use it like this:
double answer = modulename.fadd(10.0, 20.0);
*/
%define INPUT_TYPEMAP(TYPE, CTYPE, CSTYPE)
%typemap(ctype, out="void *") TYPE *INPUT, TYPE &INPUT "CTYPE"
%typemap(imtype, out="global::System.IntPtr") TYPE *INPUT, TYPE &INPUT "CSTYPE"
%typemap(cstype, out="$csclassname") TYPE *INPUT, TYPE &INPUT "CSTYPE"
%typemap(csin) TYPE *INPUT, TYPE &INPUT "$csinput"
%typemap(in) TYPE *INPUT, TYPE &INPUT
%{ $1 = ($1_ltype)&$input; %}
%typemap(typecheck) TYPE *INPUT = TYPE;
%typemap(typecheck) TYPE &INPUT = TYPE;
%enddef
INPUT_TYPEMAP(bool, unsigned int, bool)
//INPUT_TYPEMAP(char, char, char)
INPUT_TYPEMAP(signed char, signed char, sbyte)
INPUT_TYPEMAP(unsigned char, unsigned char, byte)
INPUT_TYPEMAP(short, short, short)
INPUT_TYPEMAP(unsigned short, unsigned short, ushort)
INPUT_TYPEMAP(int, int, int)
INPUT_TYPEMAP(unsigned int, unsigned int, uint)
INPUT_TYPEMAP(long, long, int)
INPUT_TYPEMAP(unsigned long, unsigned long, uint)
INPUT_TYPEMAP(long long, long long, long)
INPUT_TYPEMAP(unsigned long long, unsigned long long, ulong)
INPUT_TYPEMAP(float, float, float)
INPUT_TYPEMAP(double, double, double)
#undef INPUT_TYPEMAP
/*
OUTPUT typemaps
---------------
These typemaps are used for pointer/reference parameters that are output only and
are mapped to a C# output parameter.
The following typemaps can be applied to turn a pointer or reference into an "output"
value. When calling a function, no input value would be given for
a parameter, but an output value would be returned. In C#, the 'out' keyword is
used when passing the parameter to a function that takes an output parameter.
bool *OUTPUT, bool &OUTPUT
signed char *OUTPUT, signed char &OUTPUT
unsigned char *OUTPUT, unsigned char &OUTPUT
short *OUTPUT, short &OUTPUT
unsigned short *OUTPUT, unsigned short &OUTPUT
int *OUTPUT, int &OUTPUT
unsigned int *OUTPUT, unsigned int &OUTPUT
long *OUTPUT, long &OUTPUT
unsigned long *OUTPUT, unsigned long &OUTPUT
long long *OUTPUT, long long &OUTPUT
unsigned long long *OUTPUT, unsigned long long &OUTPUT
float *OUTPUT, float &OUTPUT
double *OUTPUT, double &OUTPUT
For example, suppose you were trying to wrap the modf() function in the
C math library which splits x into integral and fractional parts (and
returns the integer part in one of its parameters):
double modf(double x, double *ip);
You could wrap it with SWIG as follows :
%include <typemaps.i>
double modf(double x, double *OUTPUT);
or you can use the %apply directive :
%include <typemaps.i>
%apply double *OUTPUT { double *ip };
double modf(double x, double *ip);
The C# output of the function would be the function return value and the
value returned in the second output parameter. In C# you would use it like this:
double dptr;
double fraction = modulename.modf(5, out dptr);
*/
%define OUTPUT_TYPEMAP(TYPE, CTYPE, CSTYPE, TYPECHECKPRECEDENCE)
%typemap(ctype, out="void *") TYPE *OUTPUT, TYPE &OUTPUT "CTYPE *"
%typemap(imtype, out="global::System.IntPtr") TYPE *OUTPUT, TYPE &OUTPUT "out CSTYPE"
%typemap(cstype, out="$csclassname") TYPE *OUTPUT, TYPE &OUTPUT "out CSTYPE"
%typemap(csin) TYPE *OUTPUT, TYPE &OUTPUT "out $csinput"
%typemap(in) TYPE *OUTPUT, TYPE &OUTPUT
%{ $1 = ($1_ltype)$input; %}
%typecheck(SWIG_TYPECHECK_##TYPECHECKPRECEDENCE) TYPE *OUTPUT, TYPE &OUTPUT ""
%enddef
OUTPUT_TYPEMAP(bool, unsigned int, bool, BOOL_PTR)
//OUTPUT_TYPEMAP(char, char, char, CHAR_PTR)
OUTPUT_TYPEMAP(signed char, signed char, sbyte, INT8_PTR)
OUTPUT_TYPEMAP(unsigned char, unsigned char, byte, UINT8_PTR)
OUTPUT_TYPEMAP(short, short, short, INT16_PTR)
OUTPUT_TYPEMAP(unsigned short, unsigned short, ushort, UINT16_PTR)
OUTPUT_TYPEMAP(int, int, int, INT32_PTR)
OUTPUT_TYPEMAP(unsigned int, unsigned int, uint, UINT32_PTR)
OUTPUT_TYPEMAP(long, long, int, INT32_PTR)
OUTPUT_TYPEMAP(unsigned long, unsigned long, uint, UINT32_PTR)
OUTPUT_TYPEMAP(long long, long long, long, INT64_PTR)
OUTPUT_TYPEMAP(unsigned long long, unsigned long long, ulong, UINT64_PTR)
OUTPUT_TYPEMAP(float, float, float, FLOAT_PTR)
OUTPUT_TYPEMAP(double, double, double, DOUBLE_PTR)
#undef OUTPUT_TYPEMAP
%typemap(in) bool *OUTPUT, bool &OUTPUT
%{ *$input = 0;
$1 = ($1_ltype)$input; %}
/*
INOUT typemaps
--------------
These typemaps are for pointer/reference parameters that are both input and
output and are mapped to a C# reference parameter.
The following typemaps can be applied to turn a pointer or reference into a
reference parameters, that is the parameter is both an input and an output.
In C#, the 'ref' keyword is used for reference parameters.
bool *INOUT, bool &INOUT
signed char *INOUT, signed char &INOUT
unsigned char *INOUT, unsigned char &INOUT
short *INOUT, short &INOUT
unsigned short *INOUT, unsigned short &INOUT
int *INOUT, int &INOUT
unsigned int *INOUT, unsigned int &INOUT
long *INOUT, long &INOUT
unsigned long *INOUT, unsigned long &INOUT
long long *INOUT, long long &INOUT
unsigned long long *INOUT, unsigned long long &INOUT
float *INOUT, float &INOUT
double *INOUT, double &INOUT
For example, suppose you were trying to wrap the following function :
void neg(double *x) {
*x = -(*x);
}
You could wrap it with SWIG as follows :
%include <typemaps.i>
void neg(double *INOUT);
or you can use the %apply directive :
%include <typemaps.i>
%apply double *INOUT { double *x };
void neg(double *x);
The C# output of the function would be the new value returned by the
reference parameter. In C# you would use it like this:
double x = 5.0;
neg(ref x);
The implementation of the OUTPUT and INOUT typemaps is different to the scripting
languages in that the scripting languages will return the output value as part
of the function return value.
*/
%define INOUT_TYPEMAP(TYPE, CTYPE, CSTYPE, TYPECHECKPRECEDENCE)
%typemap(ctype, out="void *") TYPE *INOUT, TYPE &INOUT "CTYPE *"
%typemap(imtype, out="global::System.IntPtr") TYPE *INOUT, TYPE &INOUT "ref CSTYPE"
%typemap(cstype, out="$csclassname") TYPE *INOUT, TYPE &INOUT "ref CSTYPE"
%typemap(csin) TYPE *INOUT, TYPE &INOUT "ref $csinput"
%typemap(in) TYPE *INOUT, TYPE &INOUT
%{ $1 = ($1_ltype)$input; %}
%typecheck(SWIG_TYPECHECK_##TYPECHECKPRECEDENCE) TYPE *INOUT, TYPE &INOUT ""
%enddef
INOUT_TYPEMAP(bool, unsigned int, bool, BOOL_PTR)
//INOUT_TYPEMAP(char, char, char, CHAR_PTR)
INOUT_TYPEMAP(signed char, signed char, sbyte, INT8_PTR)
INOUT_TYPEMAP(unsigned char, unsigned char, byte, UINT8_PTR)
INOUT_TYPEMAP(short, short, short, INT16_PTR)
INOUT_TYPEMAP(unsigned short, unsigned short, ushort, UINT16_PTR)
INOUT_TYPEMAP(int, int, int, INT32_PTR)
INOUT_TYPEMAP(unsigned int, unsigned int, uint, UINT32_PTR)
INOUT_TYPEMAP(long, long, int, INT32_PTR)
INOUT_TYPEMAP(unsigned long, unsigned long, uint, UINT32_PTR)
INOUT_TYPEMAP(long long, long long, long, INT64_PTR)
INOUT_TYPEMAP(unsigned long long, unsigned long long, ulong, UINT64_PTR)
INOUT_TYPEMAP(float, float, float, FLOAT_PTR)
INOUT_TYPEMAP(double, double, double, DOUBLE_PTR)
#undef INOUT_TYPEMAP

View File

@ -0,0 +1,103 @@
/* -----------------------------------------------------------------------------
* wchar.i
*
* Typemaps for the wchar_t type
* These are mapped to a C# String and are passed around by value.
*
* Support code for wide strings can be turned off by defining SWIG_CSHARP_NO_WSTRING_HELPER
*
* ----------------------------------------------------------------------------- */
#if !defined(SWIG_CSHARP_NO_WSTRING_HELPER)
#if !defined(SWIG_CSHARP_WSTRING_HELPER_)
#define SWIG_CSHARP_WSTRING_HELPER_
%insert(runtime) %{
/* Callback for returning strings to C# without leaking memory */
typedef void * (SWIGSTDCALL* SWIG_CSharpWStringHelperCallback)(const wchar_t *);
static SWIG_CSharpWStringHelperCallback SWIG_csharp_wstring_callback = NULL;
%}
%pragma(csharp) imclasscode=%{
protected class SWIGWStringHelper {
[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]
public delegate string SWIGWStringDelegate(global::System.IntPtr message);
static SWIGWStringDelegate wstringDelegate = new SWIGWStringDelegate(CreateWString);
[global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterWStringCallback_$module")]
public static extern void SWIGRegisterWStringCallback_$module(SWIGWStringDelegate wstringDelegate);
static string CreateWString([global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]global::System.IntPtr cString) {
return global::System.Runtime.InteropServices.Marshal.PtrToStringUni(cString);
}
static SWIGWStringHelper() {
SWIGRegisterWStringCallback_$module(wstringDelegate);
}
}
static protected SWIGWStringHelper swigWStringHelper = new SWIGWStringHelper();
%}
%insert(runtime) %{
#ifdef __cplusplus
extern "C"
#endif
SWIGEXPORT void SWIGSTDCALL SWIGRegisterWStringCallback_$module(SWIG_CSharpWStringHelperCallback callback) {
SWIG_csharp_wstring_callback = callback;
}
%}
#endif // SWIG_CSHARP_WSTRING_HELPER_
#endif // SWIG_CSHARP_NO_WSTRING_HELPER
// wchar_t
%typemap(ctype) wchar_t "wchar_t"
%typemap(imtype) wchar_t "char" // Requires adding CharSet=CharSet.Unicode to the DllImport to correctly marshal Unicode characters
%typemap(cstype) wchar_t "char"
%typemap(csin) wchar_t "$csinput"
%typemap(csout, excode=SWIGEXCODE) wchar_t {
char ret = $imcall;$excode
return ret;
}
%typemap(csvarin, excode=SWIGEXCODE2) wchar_t %{
set {
$imcall;$excode
} %}
%typemap(csvarout, excode=SWIGEXCODE2) wchar_t %{
get {
char ret = $imcall;$excode
return ret;
} %}
%typemap(in) wchar_t %{ $1 = ($1_ltype)$input; %}
%typemap(out) wchar_t %{ $result = (wchar_t)$1; %}
%typemap(typecheck) wchar_t = char;
// wchar_t *
%typemap(ctype) wchar_t * "wchar_t *"
%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", out="global::System.IntPtr" ) wchar_t * "string"
%typemap(cstype) wchar_t * "string"
%typemap(csin) wchar_t * "$csinput"
%typemap(csout, excode=SWIGEXCODE) wchar_t * {
string ret = global::System.Runtime.InteropServices.Marshal.PtrToStringUni($imcall);$excode
return ret;
}
%typemap(csvarin, excode=SWIGEXCODE2) wchar_t * %{
set {
$imcall;$excode
} %}
%typemap(csvarout, excode=SWIGEXCODE2) wchar_t * %{
get {
string ret = global::System.Runtime.InteropServices.Marshal.PtrToStringUni($imcall);$excode
return ret;
} %}
%typemap(in) wchar_t * %{ $1 = ($1_ltype)$input; %}
%typemap(out) wchar_t * %{ $result = (wchar_t *)$1; %}
%typemap(typecheck) wchar_t * = char *;

0
linux/bin/swig/share/swig/4.1.0/cstring.i Normal file → Executable file
View File

0
linux/bin/swig/share/swig/4.1.0/cwstring.i Normal file → Executable file
View File

View File

@ -0,0 +1,293 @@
%include <shared_ptr.i>
// Language specific macro implementing all the customisations for handling the smart pointer
%define SWIG_SHARED_PTR_TYPEMAPS(CONST, TYPE...)
// %naturalvar is as documented for member variables
%naturalvar TYPE;
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
// destructor mods
%feature("unref") TYPE
//"if (debug_shared) { cout << \"deleting use_count: \" << (*smartarg1).use_count() << \" [\" << (boost::get_deleter<SWIG_null_deleter>(*smartarg1) ? std::string(\"CANNOT BE DETERMINED SAFELY\") : ((*smartarg1).get() ? (*smartarg1)->getValue() : std::string(\"NULL PTR\"))) << \"]\" << endl << flush; }\n"
"(void)arg1; delete smartarg1;"
// Typemap customisations...
// plain value
%typemap(in, canthrow=1) CONST TYPE ($&1_type argp = 0) %{
argp = ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0;
if (!argp) {
SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "Attempt to dereference null $1_type");
return $null;
}
$1 = *argp; %}
%typemap(out) CONST TYPE
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %}
%typemap(directorin) CONST TYPE
%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %}
%typemap(directorout) CONST TYPE
%{ if (!$input) {
SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "Attempt to dereference null $1_type");
return $null;
}
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input;
$result = *smartarg->get();
%}
// plain pointer
%typemap(in, canthrow=1) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input;
$1 = (TYPE *)(smartarg ? smartarg->get() : 0); %}
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE * %{
$result = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0;
%}
%typemap(directorin) CONST TYPE *
%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0; %}
%typemap(directorout) CONST TYPE * %{
#error "typemaps for $1_type not available"
%}
// plain reference
%typemap(in, canthrow=1) CONST TYPE & %{
$1 = ($1_ltype)(((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0);
if (!$1) {
SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "$1_type reference is null");
return $null;
} %}
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE &
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner); %}
%typemap(directorin) CONST TYPE &
%{ $input = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (&$1 SWIG_NO_NULL_DELETER_0); %}
%typemap(directorout) CONST TYPE & %{
#error "typemaps for $1_type not available"
%}
// plain pointer by reference
%typemap(in) TYPE *CONST& ($*1_ltype temp = 0)
%{ temp = (TYPE *)(((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0);
$1 = &temp; %}
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST&
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner); %}
%typemap(directorin) TYPE *CONST&
%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0; %}
%typemap(directorout) TYPE *CONST& %{
#error "typemaps for $1_type not available"
%}
// shared_ptr by value
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
%{ if ($input) $1 = *($&1_ltype)$input; %}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
%{ $result = $1 ? new $1_ltype($1) : 0; %}
%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0; %}
%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
%{ if ($input) {
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input;
$result = *smartarg;
}
%}
// shared_ptr by reference
%typemap(in, canthrow=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & ($*1_ltype tempnull)
%{ $1 = $input ? ($1_ltype)$input : &tempnull; %}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &
%{ $result = *$1 ? new $*1_ltype(*$1) : 0; %}
%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &
%{ $input = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0; %}
%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
#error "typemaps for $1_type not available"
%}
// shared_ptr by pointer
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * ($*1_ltype tempnull)
%{ $1 = $input ? ($1_ltype)$input : &tempnull; %}
%typemap(out, fragment="SWIG_null_deleter") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *
%{ $result = ($1 && *$1) ? new $*1_ltype(*($1_ltype)$1) : 0;
if ($owner) delete $1; %}
%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *
%{ $input = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0; %}
%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
#error "typemaps for $1_type not available"
%}
// shared_ptr by pointer reference
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempnull, $*1_ltype temp = 0)
%{ temp = $input ? *($1_ltype)&$input : &tempnull;
$1 = &temp; %}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
%{ *($1_ltype)&$result = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0; %}
%typemap(directorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
%{ $input = ($1 && *$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1) : 0; %}
%typemap(directorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& %{
#error "typemaps for $1_type not available"
%}
// various missing typemaps - If ever used (unlikely) ensure compilation error rather than runtime bug
%typemap(in) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{
#error "typemaps for $1_type not available"
%}
%typemap(out) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{
#error "typemaps for $1_type not available"
%}
%typemap (ctype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "void *"
%typemap (imtype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "void*"
%typemap (dtype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(dtype, TYPE)"
%typemap(din) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(dtype, TYPE).swigGetCPtr($dinput)"
%typemap(ddirectorout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "$typemap(dtype, TYPE).swigGetCPtr($dcall)"
%typemap(ddirectorin) CONST TYPE,
CONST TYPE *,
CONST TYPE &,
TYPE *CONST& "($winput is null) ? null : new $typemap(dtype, TYPE)($winput, true)"
%typemap(ddirectorin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "($winput is null) ? null : new $typemap(dtype, TYPE)($winput, true)"
%typemap(dout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > {
void* cPtr = $imcall;
auto ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(dout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & {
void* cPtr = $imcall;
auto ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(dout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * {
void* cPtr = $imcall;
auto ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(dout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& {
void* cPtr = $imcall;
auto ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(dout, excode=SWIGEXCODE) CONST TYPE {
auto ret = new $typemap(dtype, TYPE)($imcall, true);$excode
return ret;
}
%typemap(dout, excode=SWIGEXCODE) CONST TYPE & {
auto ret = new $typemap(dtype, TYPE)($imcall, true);$excode
return ret;
}
%typemap(dout, excode=SWIGEXCODE) CONST TYPE * {
void* cPtr = $imcall;
auto ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(dout, excode=SWIGEXCODE) TYPE *CONST& {
void* cPtr = $imcall;
auto ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, true);$excode
return ret;
}
// Proxy classes (base classes, ie, not derived classes)
%typemap(dbody) SWIGTYPE %{
private void* swigCPtr;
private bool swigCMemOwn;
public this(void* cObject, bool ownCObject) {
swigCPtr = cObject;
swigCMemOwn = ownCObject;
}
public static void* swigGetCPtr(typeof(this) obj) {
return (obj is null) ? null : obj.swigCPtr;
}
%}
// Derived proxy classes
%typemap(dbody_derived) SWIGTYPE %{
private void* swigCPtr;
private bool swigCMemOwn;
public this(void* cObject, bool ownCObject) {
super($imdmodule.$dclazznameSmartPtrUpcast(cObject), ownCObject);
swigCPtr = cObject;
swigCMemOwn = ownCObject;
}
public static void* swigGetCPtr(typeof(this) obj) {
return (obj is null) ? null : obj.swigCPtr;
}
%}
%typemap(ddispose, methodname="dispose", methodmodifiers="public") TYPE {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
$imcall;
}
swigCPtr = null;
}
}
}
%typemap(ddispose_derived, methodname="dispose", methodmodifiers="public") TYPE {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
$imcall;
}
swigCPtr = null;
super.dispose();
}
}
}
// Typecheck typemaps
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, equivalent="TYPE *")
TYPE CONST,
TYPE CONST &,
TYPE CONST *,
TYPE *CONST&,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
""
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
%enddef

View File

@ -0,0 +1,111 @@
/* -----------------------------------------------------------------------------
* carrays.i
*
* D-specific version of ../carrays.i.
* ----------------------------------------------------------------------------- */
/* -----------------------------------------------------------------------------
* %array_functions(TYPE,NAME)
*
* Generates functions for creating and accessing elements of a C array
* (as pointers). Creates the following functions:
*
* TYPE *new_NAME(int nelements)
* void delete_NAME(TYPE *);
* TYPE NAME_getitem(TYPE *, int index);
* void NAME_setitem(TYPE *, int index, TYPE value);
*
* ----------------------------------------------------------------------------- */
%define %array_functions(TYPE,NAME)
%{
static TYPE *new_##NAME(int nelements) { %}
#ifdef __cplusplus
%{ return new TYPE[nelements](); %}
#else
%{ return (TYPE *) calloc(nelements,sizeof(TYPE)); %}
#endif
%{}
static void delete_##NAME(TYPE *ary) { %}
#ifdef __cplusplus
%{ delete [] ary; %}
#else
%{ free(ary); %}
#endif
%{}
static TYPE NAME##_getitem(TYPE *ary, int index) {
return ary[index];
}
static void NAME##_setitem(TYPE *ary, int index, TYPE value) {
ary[index] = value;
}
%}
TYPE *new_##NAME(int nelements);
void delete_##NAME(TYPE *ary);
TYPE NAME##_getitem(TYPE *ary, int index);
void NAME##_setitem(TYPE *ary, int index, TYPE value);
%enddef
/* -----------------------------------------------------------------------------
* %array_class(TYPE,NAME)
*
* Generates a class wrapper around a C array. The class has the following
* interface:
*
* struct NAME {
* NAME(int nelements);
* ~NAME();
* TYPE getitem(int index);
* void setitem(int index, TYPE value);
* TYPE * ptr();
* static NAME *frompointer(TYPE *t);
* }
*
* ----------------------------------------------------------------------------- */
%define %array_class(TYPE,NAME)
%{
typedef TYPE NAME;
%}
typedef struct {} NAME;
%extend NAME {
#ifdef __cplusplus
NAME(int nelements) {
return new TYPE[nelements]();
}
~NAME() {
delete [] self;
}
#else
NAME(int nelements) {
return (TYPE *) calloc(nelements,sizeof(TYPE));
}
~NAME() {
free(self);
}
#endif
TYPE getitem(int index) {
return self[index];
}
void setitem(int index, TYPE value) {
self[index] = value;
}
TYPE * ptr() {
return self;
}
static NAME *frompointer(TYPE *t) {
return (NAME *) t;
}
};
%types(NAME = TYPE);
%enddef

View File

@ -0,0 +1,171 @@
/* -----------------------------------------------------------------------------
* cpointer.i
*
* D-specific version of ../cpointer.i.
* ----------------------------------------------------------------------------- */
/* -----------------------------------------------------------------------------
* %pointer_class(type,name)
*
* Places a simple proxy around a simple type like 'int', 'float', or whatever.
* The proxy provides this interface:
*
* class type {
* public:
* type();
* ~type();
* type value();
* void assign(type value);
* };
*
* Example:
*
* %pointer_class(int, intp);
*
* int add(int *x, int *y) { return *x + *y; }
*
* In python (with proxies)
*
* >>> a = intp()
* >>> a.assign(10)
* >>> a.value()
* 10
* >>> b = intp()
* >>> b.assign(20)
* >>> print add(a,b)
* 30
*
* As a general rule, this macro should not be used on class/structures that
* are already defined in the interface.
* ----------------------------------------------------------------------------- */
%define %pointer_class(TYPE, NAME)
%{
typedef TYPE NAME;
%}
typedef struct {
} NAME;
%extend NAME {
#ifdef __cplusplus
NAME() {
return new TYPE();
}
~NAME() {
delete self;
}
#else
NAME() {
return (TYPE *) calloc(1,sizeof(TYPE));
}
~NAME() {
free(self);
}
#endif
}
%extend NAME {
void assign(TYPE value) {
*self = value;
}
TYPE value() {
return *self;
}
TYPE * ptr() {
return self;
}
static NAME * frompointer(TYPE *t) {
return (NAME *) t;
}
}
%types(NAME = TYPE);
%enddef
/* -----------------------------------------------------------------------------
* %pointer_functions(type,name)
*
* Create functions for allocating/deallocating pointers. This can be used
* if you don't want to create a proxy class or if the pointer is complex.
*
* %pointer_functions(int, intp)
*
* int add(int *x, int *y) { return *x + *y; }
*
* In python (with proxies)
*
* >>> a = copy_intp(10)
* >>> intp_value(a)
* 10
* >>> b = new_intp()
* >>> intp_assign(b,20)
* >>> print add(a,b)
* 30
* >>> delete_intp(a)
* >>> delete_intp(b)
*
* ----------------------------------------------------------------------------- */
%define %pointer_functions(TYPE,NAME)
%{
static TYPE *new_##NAME() { %}
#ifdef __cplusplus
%{ return new TYPE(); %}
#else
%{ return (TYPE *) calloc(1,sizeof(TYPE)); %}
#endif
%{}
static TYPE *copy_##NAME(TYPE value) { %}
#ifdef __cplusplus
%{ return new TYPE(value); %}
#else
%{ TYPE *self = (TYPE *) calloc(1,sizeof(TYPE));
*self = value;
return self; %}
#endif
%{}
static void delete_##NAME(TYPE *self) { %}
#ifdef __cplusplus
%{ delete self; %}
#else
%{ free(self); %}
#endif
%{}
static void NAME ##_assign(TYPE *self, TYPE value) {
*self = value;
}
static TYPE NAME ##_value(TYPE *self) {
return *self;
}
%}
TYPE *new_##NAME();
TYPE *copy_##NAME(TYPE value);
void delete_##NAME(TYPE *self);
void NAME##_assign(TYPE *self, TYPE value);
TYPE NAME##_value(TYPE *self);
%enddef
/* -----------------------------------------------------------------------------
* %pointer_cast(type1,type2,name)
*
* Generates a pointer casting function.
* ----------------------------------------------------------------------------- */
%define %pointer_cast(TYPE1,TYPE2,NAME)
%inline %{
TYPE2 NAME(TYPE1 x) {
return (TYPE2) x;
}
%}
%enddef

View File

@ -0,0 +1,46 @@
/* -----------------------------------------------------------------------------
* d.swg
*
* Main library file for the D language module. See the D chapter in the SWIG
* manual for explanation on the typemaps, pragmas, etc. used.
* ----------------------------------------------------------------------------- */
// Typemaps for exception handling.
%include <dexception.swg>
// Typemaps for primitive types.
%include <dprimitives.swg>
// Typemaps for non-primitive types (C/C++ classes and structs).
%include <dswigtype.swg>
// Typemaps for enumeration types.
%include <denums.swg>
// Typemaps for member function pointers.
%include <dmemberfunctionpointers.swg>
// Typemaps for wrapping pointers to/arrays of C chars as D strings.
%include <dstrings.swg>
// Typemaps for handling void function return types and empty parameter lists.
%include <dvoid.swg>
// Typemaps containing D code used when generating D proxy classes.
%include <dclassgen.swg>
// Mapping of C++ operator overloading methods to D.
%include <doperators.swg>
// Helper code string and exception handling.
%include <dhead.swg>
// Wrapper loader code for dynamically linking the C wrapper library from the D
// wrapper module.
%include <wrapperloader.swg>
// List of all reserved D keywords.
%include <dkw.swg>
// D-specific directives.
%include <ddirectives.swg>

Some files were not shown because too many files have changed in this diff Show More