blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 5
146
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
7
| license_type
stringclasses 2
values | repo_name
stringlengths 6
79
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 4
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.07k
426M
⌀ | star_events_count
int64 0
27
| fork_events_count
int64 0
12
| gha_license_id
stringclasses 3
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 6
values | src_encoding
stringclasses 26
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 1
class | length_bytes
int64 20
6.28M
| extension
stringclasses 20
values | content
stringlengths 20
6.28M
| authors
listlengths 1
16
| author_lines
listlengths 1
16
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f59c4696db84f47ab1ad586cabde3df11ae82f11
|
99d3989754840d95b316a36759097646916a15ea
|
/tags/2011_09_07_to_baoxin_gpd_0.1/ferrylibs/src/ferry/feature_tracking/OpenCVCornerDetector.h
|
949895e144c605762173e170b704e21e396bc2d4
|
[] |
no_license
|
svn2github/ferryzhouprojects
|
5d75b3421a9cb8065a2de424c6c45d194aeee09c
|
482ef1e6070c75f7b2c230617afe8a8df6936f30
|
refs/heads/master
| 2021-01-02T09:20:01.983370 | 2011-10-20T11:39:38 | 2011-10-20T11:39:38 | 11,786,263 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,465 |
h
|
#pragma once
#include <vector>
#include "highgui.h"
#include "cv.h"
#include "CornerDetector.h"
using namespace std;
namespace ferry {
namespace feature_tracking {
class OpenCVCornerDetector : public CornerDetector
{
public:
OpenCVCornerDetector(int corners_count, double quality_level, double min_distance) {
this->corners_count = corners_count;
this->quality_level = quality_level;
this->min_distance = min_distance;
}
public:
void compute(IplImage* src, vector<CvPoint>& corners) {
CvSize size = cvGetSize(src);
IplImage* gray = cvCreateImage(size, 8, 1);
if (src->nChannels == 3) {
gray = cvCreateImage(size, 8, 1);
cvCvtColor(src, gray, CV_BGR2GRAY);
} else cvCopy(src, gray);
IplImage* eig_image = cvCreateImage(size, IPL_DEPTH_32F, 1);
IplImage* temp_image = cvCreateImage(size, IPL_DEPTH_32F, 1);
CvPoint2D32f pcorners[1000];
//int corner_count = 1000;
int temp_corners_count = corners_count;
cvGoodFeaturesToTrack(gray, eig_image, temp_image, pcorners, &temp_corners_count, quality_level, min_distance);
corners.clear();
for (int i = 0; i < temp_corners_count; i++) {
corners.push_back(cvPointFrom32f(pcorners[i]));
}
//if (clean) cleanCorners(corners);
cvReleaseImage(&gray);
cvReleaseImage(&eig_image);
cvReleaseImage(&temp_image);
}
private:
int corners_count;
double quality_level;
double min_distance;
};
}
}
|
[
"ferryzhou@b6adba56-547e-11de-b413-c5e99dc0a8e2"
] |
[
[
[
1,
64
]
]
] |
d048fa54bff777c4ac1a0b7a005a07c4594891ee
|
fd47272bb959679789cf1c65afa778569886232f
|
/Noise/LatticeNoise.h
|
ecfb721e4a7991bdd9b7dd0e2ea7afea0bf02f50
|
[] |
no_license
|
dicta/ray
|
5aeed98fe0cc76b7a5dea2c4b93c38caf0485b6c
|
5e6290077a92b8468877a8b6751f1ed13da81a43
|
refs/heads/master
| 2021-01-17T16:16:21.768537 | 2011-09-26T06:03:12 | 2011-09-28T04:36:22 | 2,471,865 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,099 |
h
|
#ifndef _LATTICE_NOISE_H_
#define _LATTICE_NOISE_H_
#define PERM(x) permutations[(x)& 255]
#define INDEX(ix,iy,iz) PERM((ix)+PERM((iy)+PERM(iz)))
#include "Math/Point3D.h"
#include "Math/Vector3D.h"
class Hash;
class LatticeNoise {
public:
LatticeNoise(int seed = 253);
virtual ~LatticeNoise();
void setHash(Hash* h);
float fractalSum(const Point3D& p) const;
float turbulence(const Point3D& p) const;
Vector3D vectorTurbulence(const Point3D& p) const;
float fbm(const Point3D& p) const;
Vector3D vectorFbm(const Point3D& p) const;
virtual float valueNoise(const Point3D& p) const = 0;
virtual Vector3D vectorNoise(const Point3D& p) const = 0;
protected:
float values[256];
Vector3D vectors[256];
static const unsigned char permutations[256];
private:
void initValueTable(int seed);
/** Creates table of random unit vectors distributed among a unit sphere. */
void initVectorTable(int seed);
int numOctaves;
float lacunarity;
float gain;
float fsMin, fsMax;
};
#endif
|
[
"esaari1@13d0956a-e706-368b-88ec-5b7e5bac2ff7"
] |
[
[
[
1,
46
]
]
] |
daf45245dc839e1819b79bf06acc8d48ca9ee9f0
|
cd0987589d3815de1dea8529a7705caac479e7e9
|
/webkit/WebKit/chromium/public/WebHTTPBody.h
|
59d7ba416dca6128e2118160d3c174be8e25785b
|
[
"BSD-2-Clause"
] |
permissive
|
azrul2202/WebKit-Smartphone
|
0aab1ff641d74f15c0623f00c56806dbc9b59fc1
|
023d6fe819445369134dee793b69de36748e71d7
|
refs/heads/master
| 2021-01-15T09:24:31.288774 | 2011-07-11T11:12:44 | 2011-07-11T11:12:44 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 3,947 |
h
|
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WebHTTPBody_h
#define WebHTTPBody_h
#include "WebData.h"
#include "WebFileInfo.h"
#include "WebNonCopyable.h"
#include "WebString.h"
#include "WebURL.h"
#if WEBKIT_IMPLEMENTATION
namespace WebCore { class FormData; }
namespace WTF { template <typename T> class PassRefPtr; }
#endif
namespace WebKit {
class WebHTTPBodyPrivate;
class WebHTTPBody {
public:
struct Element {
enum { TypeData, TypeFile, TypeBlob } type;
WebData data;
WebString filePath;
long long fileStart;
long long fileLength; // -1 means to the end of the file.
WebFileInfo fileInfo;
WebURL blobURL;
};
~WebHTTPBody() { reset(); }
WebHTTPBody() : m_private(0) { }
WebHTTPBody(const WebHTTPBody& b) : m_private(0) { assign(b); }
WebHTTPBody& operator=(const WebHTTPBody& b)
{
assign(b);
return *this;
}
WEBKIT_API void initialize();
WEBKIT_API void reset();
WEBKIT_API void assign(const WebHTTPBody&);
bool isNull() const { return !m_private; }
// Returns the number of elements comprising the http body.
WEBKIT_API size_t elementCount() const;
// Sets the values of the element at the given index. Returns false if
// index is out of bounds.
WEBKIT_API bool elementAt(size_t index, Element&) const;
// Append to the list of elements.
WEBKIT_API void appendData(const WebData&);
WEBKIT_API void appendFile(const WebString&);
// Passing -1 to fileLength means to the end of the file.
WEBKIT_API void appendFileRange(const WebString&, long long fileStart, long long fileLength, const WebFileInfo&);
WEBKIT_API void appendBlob(const WebURL&);
// Identifies a particular form submission instance. A value of 0 is
// used to indicate an unspecified identifier.
WEBKIT_API long long identifier() const;
WEBKIT_API void setIdentifier(long long);
#if WEBKIT_IMPLEMENTATION
WebHTTPBody(const WTF::PassRefPtr<WebCore::FormData>&);
WebHTTPBody& operator=(const WTF::PassRefPtr<WebCore::FormData>&);
operator WTF::PassRefPtr<WebCore::FormData>() const;
#endif
private:
void assign(WebHTTPBodyPrivate*);
void ensureMutable();
WebHTTPBodyPrivate* m_private;
};
} // namespace WebKit
#endif
|
[
"[email protected]"
] |
[
[
[
1,
110
]
]
] |
fe21b6de41e05f2beb97350198142c85337b3d02
|
a1e5c0a674084927ef5b050ebe61a89cd0731bc6
|
/OpenGL_SceneGraph_Stussman/Code/Aufgabe2/main.cpp
|
84a4ad44a3606df929b2158a3fcf3e0af88ca43d
|
[] |
no_license
|
danielkummer/scenegraph
|
55d516dc512e1b707b6d75ec2741f48809d8797f
|
6c67c41a38946ac413333a84c76340c91b87dc96
|
refs/heads/master
| 2016-09-01T17:36:02.995636 | 2008-06-05T09:45:24 | 2008-06-05T09:45:24 | 32,327,185 | 0 | 0 | null | null | null | null |
ISO-8859-3
|
C++
| false | false | 7,393 |
cpp
|
/**************************************************/
/* */
/* Main Sourcecode Aufgabe 2 */
/* */
/**************************************************/
/* Authors: Reto Bollinger */
/* [email protected] */
/* */
/* Hanspeter Brühlmann */
/* [email protected] */
/* */
/**************************************************/
/* Date: 15. October 2004 */
/**************************************************/
#include "main.h"
#include "draw.h"
/**************************************************/
/* Variable definition */
/**************************************************/
KeyFlag keyFlag; // Placeholder for pressed keys
int width = 1024; // Dimensions of our window
int height = 768;
bool fullscreen = false; // Fullscreen or windowed mode
/**************************************************/
/* Exit */
/**************************************************/
void quit_program( int code )
{
SDL_Quit( ); // Quit SDL and restore previous video settings
exit( code ); // Exit program
}
/**************************************************/
/* Poll Keyevents */
/**************************************************/
void process_events( )
{
SDL_Event event; // SDL event placeholder
// Used for camera control
//////////////////////////
while( SDL_PollEvent( &event ) ) // Grab all the events off the queue
{
switch( event.type )
{
case SDL_QUIT: // Handle quit requests (like Ctrl-c)
quit_program( 0 );
break;
case SDL_MOUSEMOTION:
keyFlag.relMouseX = event.motion.xrel;
keyFlag.relMouseY = event.motion.yrel;
break;
case SDL_MOUSEBUTTONDOWN:
switch( event.button.button ){
case 4:
case 5:
keyFlag.rollButton = event.button.button;
break;
}
case SDL_MOUSEBUTTONUP:
switch( event.button.button ){
case 4:
case 5:
// keyFlag.rollButton = -1;
break;
}
case SDL_KEYDOWN: // Handle each keydown
switch( event.key.keysym.sym ) {
case SDLK_ESCAPE:
quit_program( 0 ); // Quit program
break;
case SDLK_RIGHT:
keyFlag.right = true; // Set keyflags
break;
case SDLK_LEFT:
keyFlag.left = true;
break;
case SDLK_UP:
keyFlag.up = true;
break;
case SDLK_DOWN:
keyFlag.down = true;
break;
case SDLK_PAGEUP:
keyFlag.pageUp = true;
break;
case SDLK_PAGEDOWN:
keyFlag.pageDown = true;
break;
default:
break;
}
break;
case SDL_KEYUP: // Handle each keyup
switch( event.key.keysym.sym )
{
case SDLK_RIGHT:
keyFlag.right = false; // Set keyflags
break;
case SDLK_LEFT:
keyFlag.left = false;
break;
case SDLK_UP:
keyFlag.up = false;
break;
case SDLK_DOWN:
keyFlag.down = false;
break;
case SDLK_PAGEUP:
keyFlag.pageUp = false;
break;
case SDLK_PAGEDOWN:
keyFlag.pageDown = false;
break;
case SDL_VIDEORESIZE: // Handle resize events
width = event.resize.w; // Set event width value
height = event.resize.h; // Set event height vlaue
SDL_Quit(); // Quit SDL
init_SDL(); // Restart SDL
init_OpenGL(); // Restart OpenGL
break;
default:
break;
}
break;
}
}
}
/**************************************************/
/* Init OpenGL */
/* Returnvalue: true if init was successful */
/**************************************************/
bool init_OpenGL( ) {
float ratio = (float) width / (float) height; // Calculate and store the aspect ratio of the display
glMatrixMode( GL_PROJECTION ); // Change to the projection matrix
gluPerspective( 60.0, ratio, 0.1, 1024.0 ); // Set view perspective
glMatrixMode( GL_MODELVIEW ); // Change to the modelview matrix
glEnable(GL_DEPTH_TEST); // Enable hidden surface removal
return true;
}
/**************************************************/
/* Init SDL */
/* Returnvalue: true if init was successful */
/**************************************************/
bool init_SDL()
{
const SDL_VideoInfo* info = NULL; // Information about the current video settings
int bpp = 0; // Color depth in bits of our window
int flags = 0; // Flags we will pass into SDL_SetVideoMode
if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) // First, initialize SDL's video subsystem (video only)
{
fprintf( stderr, "Video initialization failed: %s\n", SDL_GetError( ) );
quit_program( 1 ); // Failed, exit
}
info = SDL_GetVideoInfo( ); // Get some video information
if( !info ) // This should probably never happen
{
fprintf( stderr, "Video query failed: %s\n", SDL_GetError( ) );
return false;
}
bpp = info->vfmt->BitsPerPixel; // Get color depth
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8 ); // Sets the color-depth of the red, green and blue color-part
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8 ); // to 8bit (standard today)
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); // Set depth buffer
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); // Sets wether to enable or disable doublebuffering
flags = SDL_OPENGL; // Set flags for SDL OpenGL
flags = flags | SDL_RESIZABLE;
if (fullscreen) {
flags = flags | SDL_FULLSCREEN; // Set flag for fullscreen or windowed mode
}
if( SDL_SetVideoMode( width, height, bpp, flags ) == 0 ) // Set the video mode
{
fprintf( stderr, "Video mode set failed: %s\n", SDL_GetError( ) );
return false;
}
SDL_ShowCursor(false);
SDL_WM_GrabInput(SDL_GRAB_ON);
return true;
}
/**************************************************/
/* Main */
/* Returnvalue: 0 if main was successful */
/**************************************************/
int main( int argc, char* argv[] )
{
if(!init_SDL()) // If intialising of SDL fails -> quit the program with error code 1
{
quit_program( 1 );
}
if(!init_OpenGL()) // If intialising of OpenGL fails -> quit the program with error code 1
{
quit_program( 1 );
}
while(true) // Repeat forever
{
draw_screen(); // Draw your graphics
process_events( ); // Process any ocuring events
}
quit_program(0); // You shouldn't get here. Only if someone changes the while condition...
}
|
[
"dr0iddr0id@fe886383-234b-0410-a1ab-e127868e2f45"
] |
[
[
[
1,
252
]
]
] |
c4ba9938836a695e7b3e3afce9e96a87cb389ad2
|
c440e6c62e060ee70b82fc07dfb9a93e4cc13370
|
/src/modules/gain.cpp
|
2562810aeaab794e489fa2b583aa63f9afc78827
|
[] |
no_license
|
BackupTheBerlios/pgrtsound-svn
|
2a3f2ae2afa4482f9eba906f932c30853c6fe771
|
d7cefe2129d20ec50a9e18943a850d0bb26852e1
|
refs/heads/master
| 2020-05-21T01:01:41.354611 | 2005-10-02T13:09:13 | 2005-10-02T13:09:13 | 40,748,578 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 468 |
cpp
|
#include "gain.h"
Gain::Gain() :
iIn("input"),
oOut("output"),
pGain("Wzmocnienie")
{
AddInput(iIn);
AddOutput(oOut);
pGain.Bound(0, 1, 0.01); // ograczniczenie wartosci
AddParameter(pGain);
}
Gain::~Gain() {
}
void Gain::Process() {
unsigned long n;
float* in = iIn.GetSignal();
float* out = oOut.GetSignal();
float gain = pGain.GetValue();
for (n = 0; n < Module::framesPerBlock; n++) {
*out++ = (*in++) * gain;
}
}
|
[
"ad4m@fa088095-53e8-0310-8a07-f9518708c3e6"
] |
[
[
[
1,
26
]
]
] |
c9931acf77409f84f9ea5e10d77d5f73333d196e
|
305f56324b8c1625a5f3ba7966d1ce6c540e9d97
|
/src/Urp/UrpPane.h
|
2ea1d7832d2551a9f362c5be2e73bb6b663388b8
|
[] |
no_license
|
radtek/lister
|
be45f7ac67da72c1c2ac0d7cd878032c9648af7b
|
71418c72b31823624f545ad86cc804c43b6e9426
|
refs/heads/master
| 2021-01-01T19:56:30.878680 | 2011-06-22T17:04:13 | 2011-06-22T17:04:13 | 41,946,076 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 320 |
h
|
#ifndef _lister_Urp_UrpPane_h_
#define _lister_Urp_UrpPane_h_
#include "UrpShared.h"
class UrpPane: public StaticRect {
public:
VectorMap<String, Ctrl *> ctrls;
virtual ~UrpPane();
// Add and display control and hide others
// Pane takes ownership
void Add(String name, Ctrl *ctrl);
};
#endif
|
[
"jeffshumphreys@97668ed5-8355-0e3d-284e-ab2976d7b0b4"
] |
[
[
[
1,
15
]
]
] |
e2146171d8941c583096bd266445eecf23258d5f
|
5155ce0bfd77ae28dbf671deef6692220ac71aba
|
/main/src/exe/Test_dx9.cpp
|
1b71ac18db33c1efa79a3542ceb12aad5a7d97c4
|
[] |
no_license
|
OldRepoPreservation/taksi
|
1ffcfbb0a100520ba4a050f571a15389ee9e9098
|
631c9080c14cf80d028b841ba41f8e884d252c8a
|
refs/heads/master
| 2021-07-08T16:26:24.168833 | 2011-03-13T22:00:57 | 2011-03-13T22:00:57 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 3,017 |
cpp
|
//
// Test_DX9.cpp
// must be in seperate file from DX8
//
#include "../stdafx.h"
#include "Taksi.h"
#ifdef USE_DIRECTX9
#include <d3d9types.h>
#include <d3d9.h>
typedef IDirect3D9* (STDMETHODCALLTYPE *DIRECT3DCREATE9)(UINT);
bool Test_DirectX9( HWND hWnd )
{
// get the offset from the start of the DLL to the interface element we want.
// step 1: Load d3d9.dll
CDllFile _DX9;
HRESULT hRes = _DX9.LoadDll( TEXT("d3d9"));
if (IS_ERROR(hRes))
{
LOG_MSG(("Test_DirectX9 Failed to load d3d9.dll (0x%x)" LOG_CR, hRes ));
return false;
}
// step 2: Get IDirect3D9
DIRECT3DCREATE9 pDirect3DCreate9 = (DIRECT3DCREATE9)_DX9.GetProcAddress("Direct3DCreate9");
if (pDirect3DCreate9 == NULL)
{
LOG_MSG(("Test_DirectX9 Unable to find Direct3DCreate9" LOG_CR));
return false;
}
IRefPtr<IDirect3D9> pD3D = pDirect3DCreate9(D3D_SDK_VERSION);
if ( !pD3D.IsValidRefObj())
{
LOG_MSG(("Test_DirectX9 Direct3DCreate9(%d) call FAILED" LOG_CR, D3D_SDK_VERSION ));
return false;
}
// step 3: Get IDirect3DDevice9
D3DDISPLAYMODE d3ddm;
hRes = pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm );
if (FAILED(hRes))
{
LOG_MSG(("Test_DirectX9 GetAdapterDisplayMode failed. 0x%x" LOG_CR, hRes));
return false;
}
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp));
d3dpp.Windowed = true;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = d3ddm.Format;
IRefPtr<IDirect3DDevice9> pD3DDevice;
hRes = pD3D->CreateDevice(
D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL, // the device we suppose any app would be using.
hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_DISABLE_DRIVER_MANAGEMENT,
&d3dpp, IREF_GETPPTR(pD3DDevice,IDirect3DDevice9));
if (FAILED(hRes))
{
LOG_MSG(("Test_DirectX9 CreateDevice failed. 0x%x" LOG_CR, hRes ));
return false;
}
// step 4: store method addresses in out vars
UINT_PTR* pVTable = (UINT_PTR*)(*((UINT_PTR*)pD3DDevice.get_RefObj()));
ASSERT(pVTable);
sg_Shared.m_nDX9_Present = ( pVTable[TAKSI_INTF_DX9_Present] - _DX9.get_DllInt());
sg_Shared.m_nDX9_Reset = ( pVTable[TAKSI_INTF_DX9_Reset] - _DX9.get_DllInt());
LOG_MSG(("Test_DirectX9: %08x, Present=0%x, Reset=0%x " LOG_CR,
(UINT_PTR)pD3DDevice.get_RefObj(),
sg_Shared.m_nDX9_Present, sg_Shared.m_nDX9_Reset ));
IRefPtr<IDirect3DSwapChain9> pD3DSwapChain;
hRes = pD3DDevice->GetSwapChain( 0, IREF_GETPPTR(pD3DSwapChain,IDirect3DSwapChain9) );
if (FAILED(hRes))
{
LOG_MSG(("Test_DirectX9 GetSwapChain failed. 0x%x" LOG_CR, hRes ));
}
else
{
pVTable = (UINT_PTR*)(*((UINT_PTR*)pD3DSwapChain.get_RefObj()));
ASSERT(pVTable);
sg_Shared.m_nDX9_SCPresent = ( pVTable[TAKSI_INTF_DX9_SCPresent] - _DX9.get_DllInt());
LOG_MSG(("Test_DirectX9: %08x, GetSwapChain=0%x" LOG_CR,
(UINT_PTR)pD3DSwapChain.get_RefObj(),
sg_Shared.m_nDX9_SCPresent ));
}
return true;
}
#endif // USE_DIRECTX9
|
[
"[email protected]",
"prowler7@8bb48286-aa14-0410-aaaf-826319861694"
] |
[
[
[
1,
77
],
[
94,
97
]
],
[
[
78,
93
]
]
] |
5a271e3008c979e4de6bc1db5bd47f5569530ea2
|
49b6646167284329aa8644c8cf01abc3d92338bd
|
/SEP2_RELEASE/HAL/HALCore.h
|
8bb0331ffd15b37c51a6c5daf0004b03ce4c4018
|
[] |
no_license
|
StiggyB/javacodecollection
|
9d017b87b68f8d46e09dcf64650bd7034c442533
|
bdce3ddb7a56265b4df2202d24bf86a06ecfee2e
|
refs/heads/master
| 2020-08-08T22:45:47.779049 | 2011-10-24T12:10:08 | 2011-10-24T12:10:08 | 32,143,796 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 14,784 |
h
|
#ifndef HALCore_H_
#define HALCore_H_
#include <iostream>
#include <unistd.h>
#include <stdlib.h>
#include <vector>
#include "HWaccess.h"
#include "../Thread/Mutex.h"
#include "../Thread/HAWThread.h"
#include "../Thread/Semaphor.h"
#include "../Thread/Condition.h"
#include "../Thread/Singleton_T.h"
#define CONDOR
//#define SEMAP
/**
* Delete a bit
*/
#define BIT_DELETE (false)
/**
* Set a bit
*/
#define BIT_SET (true)
/**
* BASE ADRESS for Digital IO
*/
#define D_IOBASE 0x300 // Anfangsadresse Ports
/**
* BASE ADRESS for Analog IO
*/
#define A_IOBASE 0x320
/*
* tolerance range plane and normal work piece
*/
#define TOLERANCE_NORMAL 50
/*
* tolerance range work piece with a pocket
*/
#define TOLERANCE_POCKET 100
/*
* 12Bit-Mask for the height measure
*/
#define HEIGHT_MASK 0xFFF
/**
* PORT A:
*/
enum PortA {
BIT_ENGINE_RIGHT = (1 << 0),
BIT_ENGINE_LEFT = (1 << 1),
BIT_ENGINE_SLOW = (1 << 2),
BIT_ENGINE_STOP = (1 << 3),
BIT_SWITCH = (1 << 4),
BIT_LIGHT_GREEN = (1 << 5),
BIT_LIGHT_YELLOW = (1 << 6),
BIT_LIGHT_RED = (1 << 7),
BIT_ENGINE_S_L = (0x06),
BIT_ENGINE_S_R = (0x05),
BIT_LIGHT_OFF = (0x00),
BIT_LIGHTS_ON = (0xE0)
};
/**
* PORT B:
*/
enum PortB {
BIT_WP_OUT = 0,
BIT_WP_RUN_IN = (1 << 0),
BIT_WP_IN_HEIGHT = (1 << 1),
BIT_HEIGHT_1 = (1 << 2),
BIT_WP_IN_SWITCH = (1 << 3),
BIT_WP_METAL = (1 << 4),
BIT_SWITCH_STATUS = (1 << 5),
BIT_WP_IN_SLIDE = (1 << 6),
BIT_WP_OUTLET = (1 << 7)
};
//BIT_SWITCH_OPEN -> BIT_SWITCH_STATUS
//BIT_SLIDE_FULL -> BIT_WP_IN_SLIDE
/**
* PORT B Bits:
*/
enum PortB_Bit{
WP_RUN_IN = 0,WP_IN_HEIGHT = 1,WP_HEIGHT_STATUS = 2,WP_IN_SWITCH = 3,
WP_METAL = 4,WP_WITCH_STATUS = 5, WP_IN_SLIDE = 6, WP_OUTLET = 7
};
/**
* PORT C:
*/
enum PortC {
BIT_LED_START = (1 << 0),
BIT_LED_RESET = (1 << 1),
BIT_LED_Q1 = (1 << 2),
BIT_LED_Q2 = (1 << 3),
BIT_START = (1 << 4),
BIT_STOP = (1 << 5),
BIT_RESET = (1 << 6),
BIT_E_STOP = (1 << 7),
BIT_LEDS_ON = (0x0F)
};
enum PortC_Bit{
WP_LED_START=0, WP_LED_RESET=1, WP_LED_Q1=2, WP_LED_Q2=3,
WP_START=4, WP_STOP=5, WP_RESET=6, WP_E_STOP=7
};
/**
* PORT ADDRESS:
*/
enum PortAdress {
PORT_A = (D_IOBASE + 0x00), PORT_B = (D_IOBASE + 0x01), PORT_C = (D_IOBASE
+ 0x02), PORT_CNTRL = (D_IOBASE + 0x03)
};
/**
* CONTROLBITS:
*/
enum ControlBits {
BIT_PORT_A = (1 << 4),
BIT_PORT_B = (1 << 1),
BIT_PORT_C = ((1 << 0) + (1 << 3)),
BIT_PORT_C_LOW = (1 << 0),
BIT_PORT_C_HIGH = (1 << 3),
BIT_CNTRLS = (0x8A)
};
/**
* Height Measures
*/
enum Height {
HEIGHT_MEASURE_STATUS = (A_IOBASE + 0x00),
HEIGHT_REGISTER_PART1 = (A_IOBASE + 0x02),
HEIGHT_REGISTER_PART2 = (A_IOBASE + 0x03),
HEIGHT_START_CODE = (0x10)
};
/**
*
*/
enum WPHeight{
PLANE_WP = 2715 , NORMAL_WP = 2472, POCKET_WP = 3514
};
/**
* Enumeration for Colors
*/
enum Color {
RED, GREEN, YELLOW, OFF
};
/**
* Enumeration for LEDS
*/
enum LEDS {
START_LED, RESET_LED, Q1_LED, Q2_LED, LEDS_OFF, LEDS_ON
};
/**
* interrupts
*/
enum Interrupts_D {
INTERRUPT_D_PORT_A = (1 << 0),
INTERRUPT_D_PORT_B = (1 << 1),
INTERRUPT_D_PORT_C = (1 << 2),
INTERRUPT_D_PORT_C_HIGH = (1 << 3),
INTERRUPT_VECTOR_NUMMER_A = 14,
INTERRUPT_VECTOR_NUMMER_D = 11,
INTERRUPT_SET_ADRESS_D = (D_IOBASE + 0xB),
INTERRUPT_RESET_ADRESS_D = (D_IOBASE + 0xF),
PORT_IRE = (D_IOBASE + 0xB),
PORT_IRQ = (D_IOBASE + 0xF),
PORT_IRQ_AND_RESET = (D_IOBASE + 0x18),
IIR_MASK_D = 0xF
};
enum Function{
WRITE=0,RESET=1
};
/**
* PULS Codes
*/
enum PULSE_CODE {
LICHTSCHRANKE, HEIGHT
};
/**
* Interrupt Service Routine
*/
extern const struct sigevent * ISR(void *arg, int id);
/**
* Port A: contains the byte of Port A
*/
extern volatile int portA;
/**
* Port B: contains the byte of Port B
*/
extern volatile int portB;
/**
* Port C: contains the byte of Port C
*/
extern volatile int portC;
/**
* Port IRE: contains the byte of Port IRE
*/
extern volatile int portIRE;
/**
* Port IRQ: contains the byte of Port IRQ
*/
extern volatile int portIRQ;
/**
* Port ControlBits: contains the byte of Port ControlBits
*/
extern volatile int controlBits;
/*
* Emergency Stop pushed!
*/
extern volatile bool emstopped;
/**
* Hardware Abstraction Layer for Aktorik and Sensorik.
*
* SE2 (+ SY and PL) Project SoSe 2011
*
* Milestone 2: HAL Aktorik
* Milestone 3: HAL Sensorik
*
* Authors: Rico Flaegel,
* Tell Mueller-Pettenpohl,
* Torsten Krane,
* Jan Quenzel
*
* Capsulates many functions for the direct
* in- and output from and to the Festo Transfersystem and
* with Interrupts using Pulse Messages.
*
* Inherits: IHAL.h
*/
class HALCore: public thread::HAWThread, public Singleton_T<HALCore>{
friend class Singleton_T<HALCore>;
public:
/**
* Reads from a port.
* \param dir an integer, specifying the Port.
* \return an integer, the value read.
*/
int read(int dir);
/**
* Checks if a port is set to Input.
* \param dir an integer, specifying the Port.
* \return true if port is set to Input.
*/
bool isInput(int dir);
/**
* Checks if a port is set to Output.
* \param dir an integer, specifying the Port.
* \return true if port is set to Output.
*/
bool isOutput(int dir);
/**
* Writing to a port.
* \param dir an integer, specifying the port.
* \param value an integer. The position, where the bits will be set to one.
* \return an integer, the actual value of the port.
*/
void write(int dir, int value);
void write(void *ptr);
/**
* Reseting specified bit position on a port.
* \param dir an integer, specifying the port.
* \param value an integer. The position, where the bits will be reset to zero.
* \return an integer, the actual value of the port.
*/
void reset(int dir, int value);
void reset(void *ptr);
/**
* Starting the Engine into a given direction.
* \param direction an integer, specifying the direction (LEFT (BIT_ENGINE_LEFT),
* RIGHT (BIT_ENGINE_RIGHT)).
* \return a bool, true if engine started.
*/
void engineStart(int direction);
/**
* Opens the Switch.
* \return a bool, true if switch is open.
*/
void openSwitch();
/**
* Closes the Switch.
* \return a bool, true if switch is closed.
*/
void closeSwitch();
/**
* Sets the Switch to open or closed.
* \param dir a bool,
* \return a bool, true action succeeded.
*/
void setSwitchDirection(bool dir);
/**
* Resets the engine. (Resetting port A Bit 0 to 3)
* \return a bool, true action succeeded.
*/
void engineReset();
/**
* Stops the engine through setting the stopbit.
* \return a bool, true action succeeded.
*/
void engineStop();
/**
* Continues the engine through resetting the stopbit.
* \return a bool, true action succeeded.
*/
void engineContinue();
/**
* Sets the engine direction to the right, if not stopped.
* \return a bool, true action succeeded.
*/
void engineRight();
/**
* Sets the engine direction to the left, if not stopped.
* \return a bool, true action succeeded.
*/
void engineLeft();
/**
* Sets the engine to slow speed.
* \return a bool, true action succeeded.
*/
void engineSlowSpeed();
/**
* Sets the engine to slow speed.
* \param dir an integer, BIT_ENGINE_LEFT, BIT_ENGINE_S_L, else it will be slowed.
* \return a bool, true action succeeded.
*/
void engineSlowSpeed(int dir);/**
* Sets the engine to normal speed.
* \return a bool, true action succeeded.
*/
void engineNormalSpeed();
/**
* Retrieves if the engine has stopped (stop bit set).
* \return a bool, true if stop bit set.
*/
bool engineStopped();
/**
* Sets the engine to slow speed.
* \param slow a bool. If true, the engine will be set to slow speed,
* false will continue.
* \return a bool, true action succeeded.
*/
void engineSpeed(bool slow);
/**
* Sets the engine to slow speed and left direction.
* \return a bool, true action succeeded.
*/
void engineSlowLeft();
/**
* Sets the engine to slow speed and right direction.
* \return a bool, true action succeeded.
*/
void engineSlowRight();
/**
* Retrieves the set interrupts.
* \return an integer, set interrupts
*/
int getSetInterrupt();
/**
* Retrieves the triggered interrupts.
* \return an integer, triggered interrupts
*/
int getInterrupt();
/**
* activates the Interrupt to a certain
* \param port an integer, specifying the Port.
* \return a bool, true if action was successful, false if not.
*/
void activateInterrupt(int port);
/**
* deactivates the Interrupt to a certain port
* \param port an integer, specifying the Port.
* \return a bool, true if action was successful, false if not.
*/
void deactivateInterrupt(int port);
/**
* Resets all bits from Port A.
* \return a bool, true action succeeded.
*/
void resetAllOutPut();
/**
* Removes a certain light.
* \param col specifies the color of the light.
*/
void removeLight(Color col);
/**
* Adds a certain light.
* \param col specifies the color of the light.
* \return a bool, true action succeeded.
*/
void addLight(Color col);
/**
* Adds a certain light.
* Equals void addLight(Color col);
* \param col specifies the color of the light.
* \return a bool, true action succeeded.
*/
void shine(Color col);
/**
* Removes a certain light.
* \param led specifies the color of the light.
*/
void removeLED(LEDS led);
/**
* Adds a certain LED.
* \param led specifies the color of the light.
* \return a bool, true action succeeded.
*/
void addLED(LEDS led);
/**
* Adds a certain light.
* Equals void addLED(LEDS led);
* \param led specifies the color of the light.
* \return a bool, true action succeeded.
*/
void shineLED(LEDS led);
/*!
* returns a Pointer to the threadsafe Singleton Instance of the Hardware Abstraction Layer (HAL)
* \return a Pointer to HAL.
*/
//static HALCore* getInstance();
/**
* deletes the Instance
*/
//static void deleteInstance();
/**
* activates the light specified by color
* \param color an integer, specifying the color.
* \return a bool, true if action was successful, false if not.
*/
void shine(int color);
/**
* activates the LED specified by led
* \param led an integer, specifying the Led which should be activated.
* \return a bool, true if action was successful, false if not.
*/
void shineLED(int led);
void stopProcess();
/**
* Performes an emergency stop.
*/
void emergencyStop();
/**
* Stops the machine.
*/
void stopMachine();
/**
* Restarts the machine.
*/
void restart();
/**
* Resets all hardware and software.
*/
void resetAll();
int identifyHeight();
bool isSlideFull();
/**
* Returns if there is metal under the metal detector.
* \return a bool, true if there is metal.
*/
bool isMetal();
protected:
void execute(void*);
void shutdown();
/**
* functionpointer on HALCore functions
*/
typedef void (HALCore::*FP)(void*);
typedef struct val {
int value1;
int value2;
bool value3;
} __attribute__((__packed__)) VAL;
typedef struct f {
FP func;
VAL* v;
} __attribute__((__packed__)) Functions;
private:
/**
* Writes to the transfersystem.
* \param dir an integer representing the port address
* \param value an integer, the bits which should be written or deleted
* \param overwrite a bool that indicates if the given bits from value should be overwritten or not.
* \returns the new value from the port
*/
int write(int dir, int value, bool overwrite);
/**
* Sets ports direction to the specified value.
* \param cb an integer, the new status for the ControlBit-Register
*/
void setPortsTo(int cb);
/**
* Reset the all ports direction.
*/
void resetPortsDirection();
/**
* Set the Ports to Output direction.
* \param bits an integer, whose bits will be set to Output direction.
* \return an integer
*/
int setPortToOutput(int bits);
/**
* Set the Ports to Input direction.
* \param bits an integer, whose bits will be set to Input direction.
* \return an integer, true.
*/
int setPortToInput(int bits);
/**
* Retrieve the Value of the specified port.
* \param dir an integer, the ports Address.
* \return an integer, the Value of the port.
*/
int getValueFromAdress(int dir);
/**
* Calculate the bit for the specified port.
* \param dir an integer, the ports Address.
* \return an integer, the bits to the address.
*/
int getBitsToAdress(int dir);
/**
* Checks the Value, which will be written, for problems with other bits.
* \param dir an integer, port which will be written to.
* \param value an integer, bits which will be changed.
* \param set a bool, overwrite or not.
* \return an integer, the bits which will need to change.
*/
int checkVal(int dir, int value, bool set);
/**
* Calculate the bit mask for the Color.
* \param col of enumtype Color, Color whose mask will be returned.
* \return an integer, the bit mask.
*/
int getColorCode(Color col);
/**
* Calculate the bit mask for LED.
* \param led of enumtype LED, LED whose mask will be returned.
* \return an integer, the bit mask.
*/
int getLEDCode(LEDS led);
HALCore();
~HALCore();
/**
* for Singleton
*/
HALCore(const HALCore&);
HALCore& operator=(const HALCore&);
/**
* Pointer for singleton HALCore
*/
//static HALCore* pInstance;
/**
* Pointer for Mutex to keep singleton threadsafe
*/
//static Mutex singleton;
/**
* Mutex to ensure threadsafety
*/
//static Mutex mutEx;
/**
* Stop pushed!
*/
bool stopped;
/**
* Wakeup the thread
*/
void wakeup();
/**
* function pointer array
*/
FP funcArray[2];
/**
* sets the function pointer array
*/
void setFPArray();
/**
* List of function pointers which should worked up
*/
vector<Functions *> lst;
#ifdef CONDOR
Condition condvar;
Mutex mut;
Mutex changedMutex;
bool requested;
#endif
#ifdef SEMAP
/**
* Semaphore to wakeup the thread
*/
Semaphor sem;
#endif
Functions * buildFunctions(FP f, int val1, int val2);
Functions * buildFunctions(FP f, bool val3);
Functions * buildFunctions(FP f, int val1);
Functions * buildFunctions(FP f, int val1, int val2, bool val3);
};
#endif /* HALCore_H_ */
|
[
"[email protected]@72d44fe2-11f0-84eb-49d3-ba3949d4c1b1"
] |
[
[
[
1,
619
]
]
] |
008a8f71f709dff90d56227b0cc27d397d12d3b7
|
ed6f03c2780226a28113ba535d3e438ee5d70266
|
/src/eljbusyinfo.cpp
|
7127e7531c091c0d8d28f16517ff914fa4c92ece
|
[] |
no_license
|
snmsts/wxc
|
f06c0306d0ff55f0634e5a372b3a71f56325c647
|
19663c56e4ae2c79ccf647d687a9a1d42ca8cb61
|
refs/heads/master
| 2021-01-01T05:41:20.607789 | 2009-04-08T09:12:08 | 2009-04-08T09:12:08 | 170,876 | 4 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 504 |
cpp
|
#include "wrapper.h"
extern "C"
{
EWXWEXPORT(wxBusyInfo*,wxBusyInfo_Create)(wxString* _txt)
{
return new wxBusyInfo (*_txt);
}
EWXWEXPORT(void,wxBusyInfo_Delete)(wxBusyInfo* self)
{
delete self;
}
EWXWEXPORT(wxBusyCursor*,wxBusyCursor_Create)()
{
return new wxBusyCursor ();
}
EWXWEXPORT(wxBusyCursor*,wxBusyCursor_CreateWithCursor)(wxCursor* _cur)
{
return new wxBusyCursor (_cur);
}
EWXWEXPORT(void,wxBusyCursor_Delete)(wxBusyCursor* self)
{
delete self;
}
}
|
[
"[email protected]"
] |
[
[
[
1,
31
]
]
] |
480f3492452665d6ad0aea8b0f67e6ac79220098
|
4497c10f3b01b7ff259f3eb45d0c094c81337db6
|
/VideoMontage/SobelImageQuality.cpp
|
7de981675ac53832529ddb4939bd5fbb39aa7e27
|
[] |
no_license
|
liuguoyou/retarget-toolkit
|
ebda70ad13ab03a003b52bddce0313f0feb4b0d6
|
d2d94653b66ea3d4fa4861e1bd8313b93cf4877a
|
refs/heads/master
| 2020-12-28T21:39:38.350998 | 2010-12-23T16:16:59 | 2010-12-23T16:16:59 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 985 |
cpp
|
#include "StdAfx.h"
#include "SobelImageQuality.h"
SobelImageQuality::SobelImageQuality(void)
{
}
SobelImageQuality::~SobelImageQuality(void)
{
}
double SobelImageQuality::GetImageQuality(IplImage* image)
{
IplImage* clone;
IplImage* gray = cvCreateImage(cvSize(image->width, image->height), image->depth, 1);
cvCvtColor(image, gray, CV_RGB2GRAY);
if(image->depth = IPL_DEPTH_8U)
{
clone = cvCreateImage(cvSize(image->width, image->height), IPL_DEPTH_16S, 1);
cvSobel(gray, clone, 2, 2);
int width = clone->width;
int height = clone->height;
double max = 0;
for(int x = 0; x < width; x++)
for(int y = 0; y < height; y++)
{
CvScalar value = cvGet2D(clone, y, x);
double tempMax = abs(value.val[0]) + abs(value.val[1])
+ abs(value.val[2]) + abs(value.val[3]);
if(tempMax > max)
max = tempMax;
}
return max;
}
else
{
printf("need IPL_DEPTH_8U image");
return -1;
}
}
|
[
"kidphys@aeedd7dc-6096-11de-8dc1-e798e446b60a"
] |
[
[
[
1,
45
]
]
] |
321f2717bb6d89cc1c0de87eb0b3862342de08d4
|
96e96a73920734376fd5c90eb8979509a2da25c0
|
/C3DE/CubeMovie.h
|
73ef401c9644ecdcaaa57535c3d1ed50954ac89e
|
[] |
no_license
|
lianlab/c3de
|
9be416cfbf44f106e2393f60a32c1bcd22aa852d
|
a2a6625549552806562901a9fdc083c2cacc19de
|
refs/heads/master
| 2020-04-29T18:07:16.973449 | 2009-11-15T10:49:36 | 2009-11-15T10:49:36 | 32,124,547 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 176 |
h
|
#ifndef CUBE_MOVIE_H
#define CUBE_MOVIE_H
#include "VideoMesh.h"
class CubeMovie : public VideoMesh
{
public:
CubeMovie(int fleps = 0);
~CubeMovie();
};
#endif
|
[
"caiocsabino@7e2be596-0d54-0410-9f9d-cf4183935158"
] |
[
[
[
1,
13
]
]
] |
d71d404c3dd18773ce7aa011f9da2cad5d498b80
|
8d577ee98e411bdc23b25cc907416d827ca32a84
|
/bestfit.cpp
|
25f895d52b8cb3ff785022950f84dafec86e49c9
|
[] |
no_license
|
jaechoonchon/Vpano
|
bc3a1b64f52faea0bbe1eb251d653765f0b03cf1
|
c79c0bd7fcd08d0b2040591ec057f60df8ff83da
|
refs/heads/master
| 2016-09-05T13:02:44.822626 | 2010-11-17T00:58:11 | 2010-11-17T00:58:11 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 11,540 |
cpp
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>
// Geometric Tools, Inc.
// http://www.geometrictools.com
// Copyright (c) 1998-2006. All Rights Reserved
//
// The Wild Magic Library (WM3) source code is supplied under the terms of
// the license agreement
// http://www.geometrictools.com/License/WildMagic3License.pdf
// and may not be copied or disclosed except in accordance with the terms
// of that agreement.
/*!
**
** Copyright (c) 2007 by John W. Ratcliff mailto:[email protected]
**
** Portions of this source has been released with the PhysXViewer application, as well as
** Rocket, CreateDynamics, ODF, and as a number of sample code snippets.
**
** If you find this code useful or you are feeling particularily generous I would
** ask that you please go to http://www.amillionpixels.us and make a donation
** to Troy DeMolay.
**
** DeMolay is a youth group for young men between the ages of 12 and 21.
** It teaches strong moral principles, as well as leadership skills and
** public speaking. The donations page uses the 'pay for pixels' paradigm
** where, in this case, a pixel is only a single penny. Donations can be
** made for as small as $4 or as high as a $100 block. Each person who donates
** will get a link to their own site as well as acknowledgement on the
** donations blog located here http://www.amillionpixels.blogspot.com/
**
** If you wish to contact me you can use the following methods:
**
** Skype Phone: 636-486-4040 (let it ring a long time while it goes through switches)
** Skype ID: jratcliff63367
** Yahoo: jratcliff63367
** AOL: jratcliff1961
** email: [email protected]
** Personal website: http://jratcliffscarab.blogspot.com
** Coding Website: http://codesuppository.blogspot.com
** FundRaising Blog: http://amillionpixels.blogspot.com
** Fundraising site: http://www.amillionpixels.us
** New Temple Site: http://newtemple.blogspot.com
**
**
** The MIT license:
**
** Permission is hereby granted, free of charge, to any person obtaining a copy
** of this software and associated documentation files (the "Software"), to deal
** in the Software without restriction, including without limitation the rights
** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
** copies of the Software, and to permit persons to whom the Software is furnished
** to do so, subject to the following conditions:
**
** The above copyright notice and this permission notice shall be included in all
** copies or substantial portions of the Software.
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
** WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "bestfit.h"
class Vec3
{
public:
Vec3(void) { };
Vec3(double _x,double _y,double _z) { x = _x; y = _y; z = _z; };
double dot(const Vec3 &v)
{
return x*v.x + y*v.y + z*v.z; // the dot product
}
double x;
double y;
double z;
};
class Eigen
{
public:
void DecrSortEigenStuff(void)
{
Tridiagonal(); //diagonalize the matrix.
QLAlgorithm(); //
DecreasingSort();
GuaranteeRotation();
}
void Tridiagonal(void)
{
double fM00 = mElement[0][0];
double fM01 = mElement[0][1];
double fM02 = mElement[0][2];
double fM11 = mElement[1][1];
double fM12 = mElement[1][2];
double fM22 = mElement[2][2];
m_afDiag[0] = fM00;
m_afSubd[2] = 0;
if (fM02 != (double)0.0)
{
double fLength = sqrt(fM01*fM01+fM02*fM02);
double fInvLength = ((double)1.0)/fLength;
fM01 *= fInvLength;
fM02 *= fInvLength;
double fQ = ((double)2.0)*fM01*fM12+fM02*(fM22-fM11);
m_afDiag[1] = fM11+fM02*fQ;
m_afDiag[2] = fM22-fM02*fQ;
m_afSubd[0] = fLength;
m_afSubd[1] = fM12-fM01*fQ;
mElement[0][0] = (double)1.0;
mElement[0][1] = (double)0.0;
mElement[0][2] = (double)0.0;
mElement[1][0] = (double)0.0;
mElement[1][1] = fM01;
mElement[1][2] = fM02;
mElement[2][0] = (double)0.0;
mElement[2][1] = fM02;
mElement[2][2] = -fM01;
m_bIsRotation = false;
}
else
{
m_afDiag[1] = fM11;
m_afDiag[2] = fM22;
m_afSubd[0] = fM01;
m_afSubd[1] = fM12;
mElement[0][0] = (double)1.0;
mElement[0][1] = (double)0.0;
mElement[0][2] = (double)0.0;
mElement[1][0] = (double)0.0;
mElement[1][1] = (double)1.0;
mElement[1][2] = (double)0.0;
mElement[2][0] = (double)0.0;
mElement[2][1] = (double)0.0;
mElement[2][2] = (double)1.0;
m_bIsRotation = true;
}
}
bool QLAlgorithm(void)
{
const int iMaxIter = 32;
for (int i0 = 0; i0 <3; i0++)
{
int i1;
for (i1 = 0; i1 < iMaxIter; i1++)
{
int i2;
for (i2 = i0; i2 <= (3-2); i2++)
{
double fTmp = fabs(m_afDiag[i2]) + fabs(m_afDiag[i2+1]);
if ( fabs(m_afSubd[i2]) + fTmp == fTmp )
break;
}
if (i2 == i0)
{
break;
}
double fG = (m_afDiag[i0+1] - m_afDiag[i0])/(((double)2.0) * m_afSubd[i0]);
double fR = sqrt(fG*fG+(double)1.0);
if (fG < (double)0.0)
{
fG = m_afDiag[i2]-m_afDiag[i0]+m_afSubd[i0]/(fG-fR);
}
else
{
fG = m_afDiag[i2]-m_afDiag[i0]+m_afSubd[i0]/(fG+fR);
}
double fSin = (double)1.0, fCos = (double)1.0, fP = (double)0.0;
for (int i3 = i2-1; i3 >= i0; i3--)
{
double fF = fSin*m_afSubd[i3];
double fB = fCos*m_afSubd[i3];
if (fabs(fF) >= fabs(fG))
{
fCos = fG/fF;
fR = sqrt(fCos*fCos+(double)1.0);
m_afSubd[i3+1] = fF*fR;
fSin = ((double)1.0)/fR;
fCos *= fSin;
}
else
{
fSin = fF/fG;
fR = sqrt(fSin*fSin+(double)1.0);
m_afSubd[i3+1] = fG*fR;
fCos = ((double)1.0)/fR;
fSin *= fCos;
}
fG = m_afDiag[i3+1]-fP;
fR = (m_afDiag[i3]-fG)*fSin+((double)2.0)*fB*fCos;
fP = fSin*fR;
m_afDiag[i3+1] = fG+fP;
fG = fCos*fR-fB;
for (int i4 = 0; i4 < 3; i4++)
{
fF = mElement[i4][i3+1];
mElement[i4][i3+1] = fSin*mElement[i4][i3]+fCos*fF;
mElement[i4][i3] = fCos*mElement[i4][i3]-fSin*fF;
}
}
m_afDiag[i0] -= fP;
m_afSubd[i0] = fG;
m_afSubd[i2] = (double)0.0;
}
if (i1 == iMaxIter)
{
return false;
}
}
return true;
}
void DecreasingSort(void)
{
//sort eigenvalues in decreasing order, e[0] >= ... >= e[iSize-1]
for (int i0 = 0, i1; i0 <= 3-2; i0++)
{
// locate maximum eigenvalue
i1 = i0;
double fMax = m_afDiag[i1];
int i2;
for (i2 = i0+1; i2 < 3; i2++)
{
if (m_afDiag[i2] > fMax)
{
i1 = i2;
fMax = m_afDiag[i1];
}
}
if (i1 != i0)
{
// swap eigenvalues
m_afDiag[i1] = m_afDiag[i0];
m_afDiag[i0] = fMax;
// swap eigenvectors
for (i2 = 0; i2 < 3; i2++)
{
double fTmp = mElement[i2][i0];
mElement[i2][i0] = mElement[i2][i1];
mElement[i2][i1] = fTmp;
m_bIsRotation = !m_bIsRotation;
}
}
}
}
void GuaranteeRotation(void)
{
if (!m_bIsRotation)
{
// change sign on the first column
for (int iRow = 0; iRow <3; iRow++)
{
mElement[iRow][0] = -mElement[iRow][0];
}
}
}
double mElement[3][3];
double m_afDiag[3];
double m_afSubd[3];
bool m_bIsRotation;
};
bool getBestFitPlane(unsigned int vcount,
const double *points,
unsigned int vstride,
const double *weights,
unsigned int wstride,
double *plane,
double *eigenvalues)
{
bool ret = false;
Vec3 kOrigin(0,0,0);
double wtotal = 0;
if ( 1 )
{
const char *source = (const char *) points;
const char *wsource = (const char *) weights;
for (unsigned int i=0; i<vcount; i++)
{
const double *p = (const double *) source;
double w = 1;
if ( wsource )
{
const double *ws = (const double *) wsource;
w = *ws; //
wsource+=wstride;
}
kOrigin.x+=p[0]*w;
kOrigin.y+=p[1]*w;
kOrigin.z+=p[2]*w;
wtotal+=w;
source+=vstride;
}
}
double recip = 1.0f / wtotal; // reciprocol of total weighting
kOrigin.x*=recip;
kOrigin.y*=recip;
kOrigin.z*=recip;
double fSumXX=0;
double fSumXY=0;
double fSumXZ=0;
double fSumYY=0;
double fSumYZ=0;
double fSumZZ=0;
if ( 1 )
{
const char *source = (const char *) points;
const char *wsource = (const char *) weights;
for (unsigned int i=0; i<vcount; i++)
{
const double *p = (const double *) source;
double w = 1;
if ( wsource )
{
const double *ws = (const double *) wsource;
w = *ws; //
wsource+=wstride;
}
Vec3 kDiff;
kDiff.x = w*(p[0] - kOrigin.x); // apply vertex weighting!
kDiff.y = w*(p[1] - kOrigin.y);
kDiff.z = w*(p[2] - kOrigin.z);
fSumXX+= kDiff.x * kDiff.x; // sume of the squares of the differences.
fSumXY+= kDiff.x * kDiff.y; // sume of the squares of the differences.
fSumXZ+= kDiff.x * kDiff.z; // sume of the squares of the differences.
fSumYY+= kDiff.y * kDiff.y;
fSumYZ+= kDiff.y * kDiff.z;
fSumZZ+= kDiff.z * kDiff.z;
source+=vstride;
}
}
fSumXX *= recip;
fSumXY *= recip;
fSumXZ *= recip;
fSumYY *= recip;
fSumYZ *= recip;
fSumZZ *= recip;
// setup the eigensolver
Eigen kES;
kES.mElement[0][0] = fSumXX;
kES.mElement[0][1] = fSumXY;
kES.mElement[0][2] = fSumXZ;
kES.mElement[1][0] = fSumXY;
kES.mElement[1][1] = fSumYY;
kES.mElement[1][2] = fSumYZ;
kES.mElement[2][0] = fSumXZ;
kES.mElement[2][1] = fSumYZ;
kES.mElement[2][2] = fSumZZ;
// compute eigenstuff, smallest eigenvalue is in last position
kES.DecrSortEigenStuff();
Vec3 kNormal;
kNormal.x = kES.mElement[0][2];
kNormal.y = kES.mElement[1][2];
kNormal.z = kES.mElement[2][2];
// the minimum energy
plane[0] = kNormal.x;
plane[1] = kNormal.y;
plane[2] = kNormal.z;
plane[3] = 0 - kNormal.dot(kOrigin);
if (eigenvalues != NULL)
{
eigenvalues[0] = kES.m_afDiag[0];
eigenvalues[1] = kES.m_afDiag[1];
eigenvalues[2] = kES.m_afDiag[2];
}
return ret;
}
|
[
"[email protected]"
] |
[
[
[
1,
434
]
]
] |
a01a56b6dd7ef7d0d88a09ace5e367f1d07981d4
|
11c5e387a64d7b58117e8d3551e5749a5ba89368
|
/scriptline.h
|
1ff3e5dd1e9ef740100fcf436a749af3190ad855
|
[] |
no_license
|
a711960/sb-rpg-game-engine
|
68e4ccd76b3dc612b9e2f4e4bfa333d1aec19218
|
f418b7097a756afd930d54cb54626fa2b92eb1db
|
refs/heads/master
| 2016-08-12T08:44:55.422547 | 2011-02-14T19:47:57 | 2011-02-14T19:47:57 | 51,718,261 | 0 | 0 | null | null | null | null |
WINDOWS-1250
|
C++
| false | false | 326 |
h
|
#pragma once
#include <string>
#include <vector>
using namespace std;
class scriptline
{
public:
string scline; // zawiera całą linie, może będe potrzebować
vector<string> words; // wektor ze słowami
scriptline(void);
void changestring(string line); // aktualizacja obiektu
~scriptline(void);
};
|
[
"bartexsz@8cc52d28-822c-a204-14e7-ae2a17bdcdc8"
] |
[
[
[
1,
16
]
]
] |
b5961ad6770510fc1cefb0f970e8742294f3cefd
|
1d415fdfabd9db522a4c3bca4ba66877ec5b8ef4
|
/avstream/ttac3audioheader.cpp
|
8588b87bacbd270667be2b0bf73fb131227975cc
|
[] |
no_license
|
panjinan333/ttcut
|
61b160c0c38c2ea6c8785ba258c2fa4b6d18ae1a
|
fc13ec3289ae4dbce6a888d83c25fbc9c3d21c1a
|
refs/heads/master
| 2022-03-23T21:55:36.535233 | 2010-12-23T20:58:13 | 2010-12-23T20:58:13 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 4,440 |
cpp
|
/*----------------------------------------------------------------------------*/
/* COPYRIGHT: TriTime (c) 2003/2005 / www.tritime.org */
/*----------------------------------------------------------------------------*/
/* PROJEKT : TTCUT 2005 */
/* FILE : ttac3audioheader.cpp */
/*----------------------------------------------------------------------------*/
/* AUTHOR : b. altendorf (E-Mail: [email protected]) DATE: 05/12/2005 */
/* MODIFIED: DATE: */
/*----------------------------------------------------------------------------*/
// ----------------------------------------------------------------------------
// TTAC3AUDIOHEADER
// ----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Overview
// -----------------------------------------------------------------------------
//
// +- TTMpegAudioHeader
// +- TTAudioHeader -|
// | +- TTAC3AudioHeader
// TTAVHeader -|
// |
// | +- TTSequenceHeader
// | |
// | +- TTSequenceEndHeader
// +- TTVideoHeader -TTMpeg2VideoHeader -|
// | +- TTPicturesHeader
// | |
// | +- TTGOPHeader
// |
// +- TTVideoIndex
// |
// +- TTBreakObject
//
// -----------------------------------------------------------------------------
/*----------------------------------------------------------------------------*/
/* This program is free software; you can redistribute it and/or modify it */
/* under the terms of the GNU General Public License as published by the Free */
/* Software Foundation; */
/* either version 2 of the License, or (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, but WITHOUT*/
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
/* FITNESS FOR A PARTICULAR PURPOSE. */
/* See the GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License along */
/* with this program; if not, write to the Free Software Foundation, */
/* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */
/*----------------------------------------------------------------------------*/
#include "ttac3audioheader.h"
#include <QString>
const char c_name[] = "TTAC3HEADER : ";
TTAC3AudioHeader::TTAC3AudioHeader()
: TTAudioHeader()
{
str_description = "AC-3";
str_mode = "unknown";
}
QString& TTAC3AudioHeader::descString()
{
return str_description;
}
QString& TTAC3AudioHeader::modeString()
{
//QString num_string;
//num_string.setNum(AC3AudioCodingMode[acmod]);
//TODO: Question, is AC3 mode correct ???
//qDebug( "%sAC3 mode: %d",c_name,acmod );
str_mode = QString("%1-%2%3").arg(AC3Mode[acmod]).arg(AC3AudioCodingMode[acmod]).arg((lfeon == 0) ? ".0" : ".1");
//str_mode = AC3Mode[acmod];
//str_mode += "-";
//str_mode += num_string;
//str_mode += (lfeon == 0) ? ".0" : ".1";
return str_mode;
}
int TTAC3AudioHeader::bitRate()
{
return 1000*AC3BitRate[frmsizecod];
}
QString& TTAC3AudioHeader::bitRateString()
{
str_bit_rate = QString("%1 KBit/s").arg(bitRate());
return str_bit_rate;
}
int TTAC3AudioHeader::sampleRate()
{
return AC3SampleRate[fscod];
}
QString& TTAC3AudioHeader::sampleRateString()
{
str_sample_rate = QString("%1").arg(sampleRate());
return str_sample_rate;
}
|
[
"[email protected]"
] |
[
[
[
1,
116
]
]
] |
f856b204a3dbba87d468fafa8add6ff70a88394a
|
611169056d3316b2771b2640af675c762780ff1b
|
/drv/main/security.cpp
|
e250c0749d40906ca62610539fa5d03cf810aebe
|
[] |
no_license
|
trietptm/accessch
|
9dea3ea07793febe6ed84302d87ce7b8184e766d
|
4c4f4f4ba6038ee01811b34dfd5f33003b1080af
|
refs/heads/master
| 2021-01-10T01:59:39.303722 | 2011-08-22T08:09:14 | 2011-08-22T08:09:14 | 54,322,896 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 4,603 |
cpp
|
#include "../inc/commonkrnl.h"
#include "../inc/memmgr.h"
#include "security.h"
void
SecurityFreeSid (
__deref_out_opt PSID* Sid
)
{
if ( !*Sid )
return;
FREE_POOL( *Sid );
}
__checkReturn
NTSTATUS
SecurityGetLuid (
__out PLUID Luid
)
{
NTSTATUS status = STATUS_UNSUCCESSFUL;
PACCESS_TOKEN pToken = 0;
SECURITY_SUBJECT_CONTEXT SubjectCtx;
SeCaptureSubjectContext( &SubjectCtx );
pToken = SeQuerySubjectContextToken( &SubjectCtx );
if ( pToken )
{
status = SeQueryAuthenticationIdToken( pToken, Luid );
}
SeReleaseSubjectContext( &SubjectCtx );
return status;
}
BOOLEAN
SecurityIsLuidValid (
__in PLUID Luid
)
{
if ( Luid->LowPart || Luid->HighPart )
{
return TRUE;
}
return FALSE;
}
void
SecurityLuidReset (
__in PLUID Luid
)
{
ASSERT( ARGUMENT_PRESENT( Luid ) );
RtlZeroMemory( Luid, sizeof( LUID ) );
}
__checkReturn
NTSTATUS
SecurityAllocateCopySid (
__in PSID SidSrc,
__deref_out_opt PSID* Sid
)
{
NTSTATUS status;
ASSERT( RtlValidSid( SidSrc ) );
ULONG SidLength = RtlLengthSid( SidSrc );
*Sid = ExAllocatePoolWithTag( PagedPool, SidLength, 'isSA' );
if ( !*Sid )
{
return STATUS_INSUFFICIENT_RESOURCES;
}
status = RtlCopySid( SidLength, *Sid, SidSrc );
if ( !NT_SUCCESS( status ) )
{
FREE_POOL( *Sid );
}
return status;
}
__checkReturn
NTSTATUS
SecurityGetSid (
__in_opt PFLT_CALLBACK_DATA Data,
__drv_when(return==0, __deref_out_opt __drv_valueIs(!=0)) PSID *Sid
)
{
NTSTATUS status = STATUS_UNSUCCESSFUL;
PACCESS_TOKEN pAccessToken = NULL;
PTOKEN_USER pTokenUser = NULL;
BOOLEAN CopyOnOpen;
BOOLEAN EffectiveOnly;
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
PSID pSid = NULL;
__try
{
if ( PsIsThreadTerminating( PsGetCurrentThread() ) )
{
__leave;
}
if ( Data )
{
pAccessToken = PsReferenceImpersonationToken(
Data->Thread,
&CopyOnOpen,
&EffectiveOnly,
&ImpersonationLevel
);
if ( !pAccessToken )
{
pAccessToken = PsReferencePrimaryToken(
FltGetRequestorProcess( Data )
);
}
}
if ( !pAccessToken )
{
pAccessToken = PsReferencePrimaryToken( PsGetCurrentProcess() );
}
if ( !pAccessToken )
{
__leave;
}
status = SeQueryInformationToken(
pAccessToken,
TokenUser,
(PVOID*) &pTokenUser
);
if( !NT_SUCCESS( status ) )
{
pTokenUser = NULL;
__leave;
}
status = SecurityAllocateCopySid( pTokenUser->User.Sid, &pSid );
if( !NT_SUCCESS( status ) )
{
pSid = NULL;
__leave;
}
*Sid = pSid;
pSid = NULL;
}
__finally
{
if ( pTokenUser )
{
FREE_POOL( pTokenUser );
}
if ( pAccessToken )
{
PsDereferenceImpersonationToken( pAccessToken );
pAccessToken = NULL;
}
SecurityFreeSid( &pSid );
}
return status;
}
__checkReturn
NTSTATUS
Security_CaptureContext (
__in PETHREAD OrigTh,
__in PSECURITY_CLIENT_CONTEXT SecurityContext
)
{
SECURITY_QUALITY_OF_SERVICE SecurityQos;
SecurityQos.Length = sizeof( SECURITY_QUALITY_OF_SERVICE );
SecurityQos.ImpersonationLevel = SecurityImpersonation;
SecurityQos.ContextTrackingMode = SECURITY_DYNAMIC_TRACKING;
SecurityQos.EffectiveOnly = FALSE;
NTSTATUS status = SeCreateClientSecurity(
OrigTh,
&SecurityQos,
FALSE,
SecurityContext
);
return status;
}
void
Security_ReleaseContext (
__in PSECURITY_CLIENT_CONTEXT SecurityContext
)
{
ASSERT( SecurityContext );
SeDeleteClientSecurity( SecurityContext );
}
__checkReturn
NTSTATUS
Security_ImpersonateClient (
__in PSECURITY_CLIENT_CONTEXT SecurityContext,
__in_opt PETHREAD ServerThread
)
{
NTSTATUS status = SeImpersonateClientEx( SecurityContext, ServerThread );
return status;
}
|
[
"Andrey.Sobko@202ed0b6-6a49-11de-80b8-55702d16276a",
"andrey.sobko@202ed0b6-6a49-11de-80b8-55702d16276a"
] |
[
[
[
1,
1
],
[
3,
116
],
[
118,
125
],
[
127,
141
],
[
143,
181
]
],
[
[
2,
2
],
[
117,
117
],
[
126,
126
],
[
142,
142
],
[
182,
227
]
]
] |
19bd7cc958390a748a8356f2d8d239cf4da90688
|
43626054205d6048ec98c76db5641ce8e42b8237
|
/SGP Sprint 2/SGP First Playable/SGP First Playable/SGP First Playable/source/CMessageManager.cpp
|
6b09a2496954b5d480aaca9425ad347bd01ffc85
|
[] |
no_license
|
Wazoobi/whitewings
|
b700da98b855a64442ad7b7c4b0be23427b0ee23
|
a53fdb832cfb1ce8605209c9af47f36b01c44727
|
refs/heads/master
| 2021-01-10T19:33:22.924792 | 2009-08-05T18:30:07 | 2009-08-05T18:30:07 | 32,119,981 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,409 |
cpp
|
#include "CMessageManager.h"
CMessageManager* CMessageManager::GetInstance(void)
{
static CMessageManager instance;
return &instance;
}
void CMessageManager::InitMessageSystem(MESSAGEPROC pfnMessageProc)
{
// Error check to make sure the message proc is valid.
if (!pfnMessageProc)
return;
// Get the Msg Proc
m_pfnMessageProc = pfnMessageProc;
}
void CMessageManager::SendMsg(CBaseMessage* pMsg)
{
// Make sure the message exists.
if (!pMsg)
return;
// Send the message to the queue for processing later on.
m_MessageQueue.push(pMsg);
}
void CMessageManager::ProcessMessages(void)
{
// Error check to make sure we get a message proc.
if(!m_pfnMessageProc)
return;
// go through the entire queue and process the messsages that are waiting.
while(!m_MessageQueue.empty())
{
m_pfnMessageProc(m_MessageQueue.front()); // Process the first message.
delete m_MessageQueue.front(); // Delete the message memory.
m_MessageQueue.pop(); // Go to the next message.
}
}
void CMessageManager::ClearMessages(void)
{
// Clear out any messages waititng.
while(!m_MessageQueue.empty())
{
delete m_MessageQueue.front();
m_MessageQueue.pop();
}
}
void CMessageManager::ShutdownMessageSystem(void)
{
// Clear out any messages waiting.
ClearMessages();
// Clear the function pointer
m_pfnMessageProc = NULL;
}
|
[
"Juno05@1cfc0206-7002-11de-8585-3f51e31374b7"
] |
[
[
[
1,
61
]
]
] |
c301c5e417c1cb49d7f1a461a6150615367b24e7
|
5fb9b06a4bf002fc851502717a020362b7d9d042
|
/developertools/GumpEditor/GumpEditorDoc.h
|
5ca657b97f2323a34a78750c1825d4cf2057536f
|
[] |
no_license
|
bravesoftdz/iris-svn
|
8f30b28773cf55ecf8951b982370854536d78870
|
c03438fcf59d9c788f6cb66b6cb9cf7235fbcbd4
|
refs/heads/master
| 2021-12-05T18:32:54.525624 | 2006-08-21T13:10:54 | 2006-08-21T13:10:54 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 4,289 |
h
|
// GumpEditorDoc.h : interface of the CGumpEditorDoc class
//
#pragma once
#include "iris/GumpLoader.h"
#include "iris/HueLoader.h"
#include "diagram/DialogEditorDemoDoc.h"
#include <map>
class CGumpView;
class CGumpEditorView;
class CLeftVIew;
class CDynControl;
class CGumpEditorDoc : public CDialogEditorDemoDoc
{
protected: // create from serialization only
CGumpEditorDoc();
DECLARE_DYNCREATE(CGumpEditorDoc)
// Attributes
public:
CView* FindView(CRuntimeClass* pClass);
cGumpLoader* GetGumpLoader() { return m_pGumpLoader; }
CGumpPtr GetGump(int iGumpID) { return FindGump(iGumpID,0,0,1); }
// if w,h is 0, ignore w, h
CGumpPtr FindGump(int iStartGumpID, int w, int h, int iTryCount=10);
cHueLoader* GetHueLoader() { return m_pHueLoader; }
const stHue* GetHue(int iHueId);
// if iHudeId=0 then use default font color
COLORREF GetHueColor(int iHueId, int iFontId=-1);
CFont* GetFont(int iFontId);
CString GetName() const { return m_strName; }
void SetName(LPCTSTR szName) { m_strName = szName; }
enum EVENT { ONCLICK, ONCLOSE, ONMOUSEDOWN, ONMOUSEUP, ONKEYPRESSED, NUM_EVENT };
CString GetEventHandler(EVENT e) const { return m_strEventHandler[e]; }
void SetEventHandler(EVENT e, LPCTSTR szEventHandler) { m_strEventHandler[e] = szEventHandler; SetModifiedFlag(); }
void GetEventHandler(CString& strEvClick, CString& strEvClose, CString& strEvMouseUp, CString& strEvMouseDown, CString& strEvKeyPressed) const;
void SetEventHandler(LPCTSTR szEvClick, LPCTSTR szEvClose, LPCTSTR szEvMouseUp, LPCTSTR szEvMouseDown, LPCTSTR szEvKeyPressed);
int GetAlpha() const { return m_iAlpha; }
void SetAlpha(int iAlpha) { m_iAlpha = iAlpha; SetModifiedFlag(); }
int GetFlags() const { return m_iFlags; }
void SetFlags(int iFlags) { m_iFlags = iFlags; SetModifiedFlag(); }
void SetFade(int iAlpha, int iTime) { m_iFadeAlpha = iAlpha; m_iFadeTime = iTime; SetModifiedFlag(); }
void GetFade(int& iAlpha, int& iTime) const { iAlpha = m_iFadeAlpha; iTime = m_iFadeTime; }
int GetFadeAlpha() const { return m_iFadeAlpha; }
int GetFadeTime() const { return m_iFadeTime; }
void SetShapeName(LPCTSTR szShapeName) { m_strShapeName = szShapeName; SetModifiedFlag(); }
CString GetShapeName() const { return m_strShapeName; }
void SelectGump(int iGumpID);
CGumpPtr GetSelectedGump(void);
void SetBackgroundImage(CGumpPtr pDib);
void SelectGumpList(int iGumpID);
void InsertGump(int iGumpID);
void UpdateGumpEditorView(void);
void ShowCode(BOOL bShow, CDiagramEntity *entity=NULL);
void ShowControlList(void);
CString GetDocVersion() const { return m_strDocVersion; }
CString GetLoadDocVersion() const { return m_strLoadDocVersion; }
CString GetDocName() const;
protected:
CString m_strDocVersion;
CString m_strLoadDocVersion;
void SetLoadDocVersion(LPCTSTR szVersion) { m_strLoadDocVersion; }
static const int m_iDefWidth = 640;
static const int m_iDefHeight = 480;
CString m_strName;
CString m_strEventHandler[NUM_EVENT];
int m_iAlpha;
int m_iFlags;
int m_iFadeAlpha, m_iFadeTime;
CString m_strShapeName;
cHueLoader* m_pHueLoader;
struct sMyFont {
std::string file;
COLORREF color;
CFont* font;
};
std::map<int,sMyFont> m_fonts;
typedef std::map<int,sMyFont>::iterator font_iter;
cGumpLoader* m_pGumpLoader;
bool Init();
void UnInit();
bool m_bInitUOData;
CString m_strIrisPath;
CString m_strXmlViewerPath;
bool LoadGfmFile(LPCTSTR lpszPathName, bool bLoadForm);
// Operations
public:
// Implementation
public:
virtual ~CGumpEditorDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
DECLARE_MESSAGE_MAP()
public:
virtual BOOL OnNewDocument();
virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
afx_msg void OnSettings();
afx_msg void OnViewSwitch();
afx_msg void OnViewViewxml();
protected:
virtual BOOL SaveModified();
public:
afx_msg void OnFileRun();
public:
afx_msg void OnViewSetting();
public:
afx_msg void OnFileImport();
};
CGumpEditorDoc* GfxGetGumpDocument();
|
[
"sience@a725d9c3-d2eb-0310-b856-fa980ef11a19"
] |
[
[
[
1,
148
]
]
] |
162254a1d38f11534f2f5cbdc846b70c64fc6774
|
4019f3d4f76a1d9cfe6099c9c9780cd69d4a187e
|
/Compilers/src/sbl_iap.cpp
|
f3e5f5af72320ca32f4eb03f4d85251fe7ec4ada
|
[] |
no_license
|
electricFeel/Ant-Runner
|
4f431539feeb69529f24358e6141e2bf8aef6780
|
b68ea4e357db29a96accf8152415cfb21f3dd7ef
|
refs/heads/master
| 2022-02-05T07:20:44.499885 | 2009-07-05T21:06:20 | 2009-07-05T21:06:20 | 244,880 | 0 | 1 | null | 2022-01-27T16:18:36 | 2009-07-07T02:21:49 |
Java
|
UTF-8
|
C++
| false | false | 6,801 |
cpp
|
//-----------------------------------------------------------------------------
// Software that is described herein is for illustrative purposes only
// which provides customers with programming information regarding the
// products. This software is supplied "AS IS" without any warranties.
// NXP Semiconductors assumes no responsibility or liability for the
// use of the software, conveys no license or title under any patent,
// copyright, or mask work right to the product. NXP Semiconductors
// reserves the right to make changes in the software without
// notification. NXP Semiconductors also make no representation or
// warranty that such application will be suitable for the specified
// use without further testing or modification.
//-----------------------------------------------------------------------------
#include <LPC23XX.H>
#include "type.h"
#include "sbl_iap.h"
#include "sbl_config.h"
const unsigned crp __attribute__((section(".ARM.__at_0x1FC"))) = CRP;
const unsigned sector_start_map[MAX_FLASH_SECTOR] = {SECTOR_0_START, \
SECTOR_1_START,SECTOR_2_START,SECTOR_3_START,SECTOR_4_START,SECTOR_5_START, \
SECTOR_6_START,SECTOR_7_START,SECTOR_8_START,SECTOR_9_START,SECTOR_10_START, \
SECTOR_11_START,SECTOR_12_START,SECTOR_13_START,SECTOR_14_START,SECTOR_15_START, \
SECTOR_16_START,SECTOR_17_START,SECTOR_18_START,SECTOR_19_START,SECTOR_20_START, \
SECTOR_21_START,SECTOR_22_START,SECTOR_23_START,SECTOR_24_START,SECTOR_25_START, \
SECTOR_26_START,SECTOR_27_START,SECTOR_28_START,SECTOR_29_START,SECTOR_30_START, \
SECTOR_31_START};
const unsigned sector_end_map[MAX_FLASH_SECTOR] = {SECTOR_0_END,SECTOR_1_END, \
SECTOR_2_END,SECTOR_3_END,SECTOR_4_END,SECTOR_5_END,SECTOR_6_END,SECTOR_7_END, \
SECTOR_8_END,SECTOR_9_END,SECTOR_10_END,SECTOR_11_END,SECTOR_12_END, \
SECTOR_13_END,SECTOR_14_END,SECTOR_15_END,SECTOR_16_END,SECTOR_17_END, \
SECTOR_18_END,SECTOR_19_END,SECTOR_20_END,SECTOR_21_END,SECTOR_22_END, \
SECTOR_23_END,SECTOR_24_END,SECTOR_25_END,SECTOR_26_END, \
SECTOR_27_END,SECTOR_28_END,SECTOR_29_END,SECTOR_30_END,SECTOR_31_END};
unsigned param_table[5];
unsigned result_table[5];
unsigned cclk = CCLK;
char flash_buf[FLASH_BUF_SIZE];
unsigned * flash_address = 0;
unsigned byte_ctr = 0;
void write_data(unsigned cclk,unsigned flash_address,unsigned * flash_data_buf, unsigned count);
void find_erase_prepare_sector(unsigned cclk, unsigned flash_address);
void erase_sector(unsigned start_sector,unsigned end_sector,unsigned cclk);
void prepare_sector(unsigned start_sector,unsigned end_sector,unsigned cclk);
void iap_entry(unsigned param_tab[],unsigned result_tab[]);
void enable_interrupts(unsigned interrupts);
void disable_interrupts(unsigned interrupts);
unsigned write_flash(unsigned int * dst, unsigned char * src, unsigned no_of_bytes)
{
unsigned i;
if (flash_address == 0)
{
/* Store flash start address */
flash_address = (unsigned *)dst;
}
for( i = 0;i<no_of_bytes;i++ )
{
flash_buf[(byte_ctr+i)] = *(src+i);
}
byte_ctr = byte_ctr + no_of_bytes;
if( byte_ctr == FLASH_BUF_SIZE)
{
/* We have accumulated enough bytes to trigger a flash write */
find_erase_prepare_sector(cclk, (unsigned)flash_address);
if(result_table[0] != CMD_SUCCESS)
{
while(1); /* No way to recover. Just let Windows report a write failure */
}
write_data(cclk,(unsigned)flash_address,(unsigned *)flash_buf,FLASH_BUF_SIZE);
if(result_table[0] != CMD_SUCCESS)
{
while(1); /* No way to recover. Just let Windows report a write failure */
}
/* Reset byte counter and flash address */
byte_ctr = 0;
flash_address = 0;
}
return(CMD_SUCCESS);
}
void find_erase_prepare_sector(unsigned cclk, unsigned flash_address)
{
unsigned i;
unsigned interrupts;
interrupts = VICIntEnable;
disable_interrupts(interrupts);
for(i=USER_START_SECTOR;i<=MAX_USER_SECTOR;i++)
{
if(flash_address < sector_end_map[i])
{
if( flash_address == sector_start_map[i])
{
prepare_sector(i,i,cclk);
erase_sector(i,i,cclk);
}
prepare_sector(i,i,cclk);
break;
}
}
enable_interrupts(interrupts);
}
void write_data(unsigned cclk,unsigned flash_address,unsigned * flash_data_buf, unsigned count)
{
unsigned interrupts;
interrupts = VICIntEnable;
disable_interrupts(interrupts);
param_table[0] = COPY_RAM_TO_FLASH;
param_table[1] = flash_address;
param_table[2] = (unsigned)flash_data_buf;
param_table[3] = count;
param_table[4] = cclk;
iap_entry(param_table,result_table);
enable_interrupts(interrupts);
}
void erase_sector(unsigned start_sector,unsigned end_sector,unsigned cclk)
{
param_table[0] = ERASE_SECTOR;
param_table[1] = start_sector;
param_table[2] = end_sector;
param_table[3] = cclk;
iap_entry(param_table,result_table);
}
void prepare_sector(unsigned start_sector,unsigned end_sector,unsigned cclk)
{
param_table[0] = PREPARE_SECTOR_FOR_WRITE;
param_table[1] = start_sector;
param_table[2] = end_sector;
param_table[3] = cclk;
iap_entry(param_table,result_table);
}
void iap_entry(unsigned param_tab[],unsigned result_tab[])
{
void (*iap)(unsigned [],unsigned []);
iap = (void (*)(unsigned [],unsigned []))IAP_ADDRESS;
iap(param_tab,result_tab);
}
void enable_interrupts(unsigned interrupts)
{
VICIntEnable = interrupts;
}
void disable_interrupts(unsigned interrupts)
{
VICIntEnClr = interrupts;
}
void (*user_code_entry)(void);
void (*user_code_entry2)(void);
void execute_user_code(void)
{
user_code_entry = (void (*)(void))USER_FLASH_START;
user_code_entry();
}
BOOL user_code_present(void)
{
param_table[0] = BLANK_CHECK_SECTOR;
param_table[1] = USER_START_SECTOR;
param_table[2] = USER_START_SECTOR;
iap_entry(param_table,result_table);
if( result_table[0] == CMD_SUCCESS )
{
return (FALSE);
}
else
{
return (TRUE);
}
}
void check_isp_entry_pin(void)
{
if( (*(volatile unsigned *)ISP_ENTRY_GPIO_REG) & (0x1<<ISP_ENTRY_PIN) )
{
execute_user_code();
}
else
{
// Enter ISP mode
}
}
void erase_user_flash(void)
{
prepare_sector(USER_START_SECTOR,MAX_USER_SECTOR,cclk);
erase_sector(USER_START_SECTOR,MAX_USER_SECTOR,cclk);
if(result_table[0] != CMD_SUCCESS)
{
while(1); /* No way to recover. Just let Windows report a write failure */
}
}
|
[
"[email protected]"
] |
[
[
[
1,
214
]
]
] |
018d8a7f3b8a4afb7960fc8eb118e3c28cd6c4c2
|
ee065463a247fda9a1927e978143186204fefa23
|
/Src/Engine/Core/CoreManager.h
|
063bcfa9f740ff009bddc7a7d1e5a70f91aae885
|
[] |
no_license
|
ptrefall/hinsimviz
|
32e9a679170eda9e552d69db6578369a3065f863
|
9caaacd39bf04bbe13ee1288d8578ece7949518f
|
refs/heads/master
| 2021-01-22T09:03:52.503587 | 2010-09-26T17:29:20 | 2010-09-26T17:29:20 | 32,448,374 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,300 |
h
|
#pragma once
class CL_SetupCore;
namespace Engine
{
namespace GUI { class IMainGuiManager; class IGuiManager; }
namespace Resource { class ResManager; }
namespace Log { class LogManager; }
namespace Events { class IEngineEventManager; }
namespace Scene { class SceneManager; class ObjectManager; }
namespace Script { class ScriptManager; }
//namespace Sound { class SoundManager; }
namespace Player { class PlayerManager; }
namespace GameState { class GameStateManager; }
namespace Core
{
class ITimer;
class CoreManager
{
public:
CoreManager(int argc, char *argv[], GUI::IMainGuiManager *mainGuiMgr, GUI::IGuiManager *guiMgr);
~CoreManager();
void resize(int w, int h);
void frame();
void exit() {}
GUI::IMainGuiManager *getMainGuiMgr() const { return mainGuiMgr; }
GUI::IGuiManager *getGuiMgr() const { return guiMgr; }
Resource::ResManager *getResMgr() const { return resMgr; }
Events::IEngineEventManager *getEngineEventMgr() const { return engineEventMgr; }
Log::LogManager *getLogMgr() const { return logMgr; }
//Input::IManager *getInputMgr() const { return inputMgr; }
Scene::ObjectManager *getObjectMgr() const { return objMgr; }
Scene::SceneManager *getSceneMgr() const { return sceneMgr; }
Script::ScriptManager *getScriptMgr() const { return scriptMgr; }
//Sound::SoundManager *getSoundMgr() const { return soundMgr; }
Player::PlayerManager *getPlayerMgr() const { return playerMgr; }
GameState::GameStateManager *getGameStateMgr() const { return gameStateMgr; }
//Utility::ITimer *getTimer() const { return timer; }
private:
void init(const char *arg);
GUI::IMainGuiManager *mainGuiMgr;
GUI::IGuiManager *guiMgr;
Resource::ResManager *resMgr;
Events::IEngineEventManager *engineEventMgr;
Log::LogManager *logMgr;
//Input::IManager *inputMgr;
Scene::ObjectManager *objMgr;
Scene::SceneManager *sceneMgr;
Script::ScriptManager *scriptMgr;
//Sound::SoundManager *soundMgr;
Player::PlayerManager *playerMgr;
GameState::GameStateManager *gameStateMgr;
CL_SetupCore *setupCore; // Initializes clanlib core lib when CoreManager is instanciated/constructed
ITimer *timer;
double timeAccumulator;
double timeStep;
bool isRunning;
};
}
}
|
[
"[email protected]@28a56cb3-1e7c-bc60-7718-65c159e1d2df"
] |
[
[
[
1,
70
]
]
] |
1854a6f204650620efc5a9af8243d1b2ac7b27fa
|
5b3221bdc6edd8123287b2ace0a971eb979d8e2d
|
/Fiew/Layer_Thumblay.cpp
|
6e59add2aaf3378172a5625dca15206f5614d280
|
[] |
no_license
|
jackiejohn/fedit-image-editor
|
0a4b67b46b88362d45db6a2ba7fa94045ad301e2
|
fd6a87ed042e8adf4bf88ddbd13f2e3b475d985a
|
refs/heads/master
| 2021-05-29T23:32:39.749370 | 2009-02-25T21:01:11 | 2009-02-25T21:01:11 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 11,367 |
cpp
|
/*
Layer_Thumblay.cpp
Partially inherited from Fiew 2.0
Object responsible for displaying thumbnail view, ie. for opening a folder dialog.
It relies on a Cacher object, and is refreshed to represent current Cacher state.
*/
#include "stdafx.h"
#include "Core.h"
/*
Construct Thumblay as Overlay, like in Fiew 2.0
*/
Thumblay::Thumblay(ChildCore *core, Image *image) : Overlay(core,image)
{
this->explorer = NULL;
this->cacher = core->getCacher();
this->lastCell = NULL;
this->ticker = TICKER_OFF;
this->picker = NULL;
if( this->image != NULL )
delete this->image;
if( this->core->getCacher() != NULL ){
this->lastCell = this->core->getCacher()->getThat();
this->core->getCacher()->setFull(true);
}
this->image = new Bitmap(OVL_SIZE,OVL_SIZE,Core::getPixelFormat());
this->update(true);
}
/*
Construct Thumblay as dialog, like in Fedit 1.0
*/
Thumblay::Thumblay(HWND hOwner, Core *core, FwCHAR *path) : Overlay(NULL,NULL)
{
this->hOwner = hOwner;
this->hardcore = core;
this->lastCell = NULL;
this->ticker = TICKER_OFF;
this->picker = NULL;
this->explorer = new Explorer(core);
this->cacher = NULL;
this->image = NULL;
if( this->explorer->browse( new FwCHAR(path->toWCHAR()) ) == true ){
this->hardcore->setExplorer(this->explorer);
this->cacher = new Cacher(core);
this->lastCell = this->cacher->getThat();
this->cacher->setFull(true);
this->image = new Bitmap(OVL_SIZE,OVL_SIZE,Core::getPixelFormat());
this->update(true);
}
else {
EndDialog(this->hOwner,NO);
DestroyWindow(this->hOwner);
}
}
Thumblay::~Thumblay()
{
this->hardcore->setExplorer(NULL);
if( this->cacher != NULL )
delete this->cacher;
if( this->explorer != NULL )
delete this->explorer;
}
/*
Update the view of the state of thumbnail list
and eventually tick the ticker representing Cacher processing
*/
void Thumblay::update(bool init)
{
this->subrender();
if( this->core != NULL )
this->invalidate(init);
else
InvalidateRect(this->hOwner,NULL,TRUE);
if( this->cacher != NULL ){
if( this->cacher->isRunning() == true ){
this->ticker++;
this->ticker = this->ticker % TICKER_STEPS;
HWND owner = NULL;
if( this->core != NULL )
owner = this->core->getWindowHandle();
else
owner = this->hOwner;
SetTimer(owner,TIMER_THB,THB_TOUT,NULL);
return;
}
}
if( this->ticker > TICKER_OFF ){
this->ticker = TICKER_OFF;
HWND owner = NULL;
if( this->core != NULL )
owner = this->core->getWindowHandle();
else
owner = this->hOwner;
SetTimer(owner,TIMER_THB,THB_TOUT,NULL);
}
}
/*
Overloaded method from Layer object
Opens the currently selected file on thumbnails list
in an editor MDI child window
*/
void Thumblay::hide()
{
ChildCore *child = NULL;
if( this->lastCell->getFile()->isArchived() == true ){
FwCHAR *archpath = this->explorer->getArchivePath();
FwCHAR *filepath = this->lastCell->getFile()->getFilePath();
FwCHAR *file = new FwCHAR();
file->getFilenameFrom(filepath);
FwCHAR *diskpath = new FwCHAR();
diskpath->getFolderFrom(archpath);
diskpath->mergeWith(file->toWCHAR());
delete file;
child = new ChildCore(
this->hardcore,
(Bitmap *)this->lastCell->getImage(),
diskpath
);
this->hardcore->neww(child);
}
else {
this->hardcore->open( new FwCHAR(this->lastCell->getFile()->getFilePath()->toWCHAR()) );
}
}
/*
Overloaded method from Layer object
Represents RMOUSEBUTTON click, closes the Thumblay
*/
void Thumblay::nextImage(int x, int y)
{
if( this->core != NULL ){
this->setCancel();
this->hide();
}
else {
EndDialog(this->hOwner,YES);
}
}
/*
Overloaded method from Layer object
Represents LMOUSEBUTTON click, chooses a thumbnail
*/
void Thumblay::prevImage(int x, int y)
{
if( x != FERROR && y != FERROR ){
int newpick = this->getPicker(x,y);
this->setPicker(newpick);
}
}
void Thumblay::prevImageDblClk(int x, int y)
{
if( x != FERROR && y != FERROR ){
int newpick = this->getPicker(x,y);
if( newpick == this->picker )
this->hide();
this->setPicker(newpick);
}
}
/*
Sets the current thumbnail
*/
void Thumblay::setPicker(int newpick)
{
if( this->cacher != NULL ){
if( newpick != INT_MAX ){
int i, diff = abs(newpick - this->picker);
bool result = false;
this->cacher->lockCache();
for( i = 0; i < diff; i++ ){
if( newpick < this->picker ){
if( this->cacher->prev() == false )
break;
this->picker--;
if( this->picker < -THB_COUNT )
this->picker = -THB_COUNT + THB_ROW - 1;
result = true;
}
else {
if( this->cacher->next() == false )
break;
this->picker++;
if( this->picker > THB_COUNT )
this->picker = THB_COUNT - THB_ROW + 1;
result = true;
}
}
this->lastCell = this->cacher->getThat();
this->cacher->unlockCache();
if( result == true ){
this->subrender();
if( this->core != NULL )
this->invalidate(false);
else
InvalidateRect(this->hOwner,NULL,TRUE);
}
}
}
}
/*
Gets the index of a thumbnail basing on mouse click position
*/
int Thumblay::getPicker(int x, int y)
{
RECT lay;
if( this->core != NULL )
lay = this->getOverlayRect();
else
SetRect(&lay,0,0,OVL_SIZE,OVL_SIZE);
int picker = INT_MAX;
if( x > lay.left && x < lay.right &&
y > lay.top && y < lay.bottom ){
x -= (lay.left + OVL_MARGIN);
y -= (lay.top + OVL_MARGIN);
int col = (int)floor( (double)(x / (THB_SMSIZE + THB_SPACE)) );
int row = (int)floor( (double)(y / (THB_SMSIZE + THB_SPACE)) );
if( col < THB_ROW && row < THB_ROW )
picker = col - THB_COUNT + THB_ROW * row;
}
return picker;
}
void Thumblay::scroll(int hor, int ver, bool invalidate)
{
return;
}
void Thumblay::scrollSet(int x, int y, bool invalidate)
{
return;
}
void Thumblay::scrollHor(int val)
{
if( val < 0 )
this->setPicker(this->picker + 1);
else if( val > 0 )
this->setPicker(this->picker - 1);
}
void Thumblay::scrollVer(int val)
{
if( val < 0 )
this->setPicker(this->picker + THB_ROW);
else if( val > 0 )
this->setPicker(this->picker - THB_ROW);
}
void Thumblay::zoomer(double val)
{
return;
}
void Thumblay::zoomat(double val, bool invalidate)
{
return;
}
void Thumblay::zoomend(bool invalidate)
{
return;
}
void Thumblay::rotate(int val)
{
return;
}
void Thumblay::rotateReset(bool novalid)
{
return;
}
void Thumblay::setFitmode(int mode)
{
return;
}
void Thumblay::unsetFitmode()
{
return;
}
void Thumblay::setSidedraw()
{
return;
}
void Thumblay::setSidemode(int mode)
{
return;
}
/*
Subrender routing for filling the Layer image object with
thumbnails view scene
*/
void Thumblay::subrender()
{
Graphics *gfx = Graphics::FromImage(this->image);
gfx->Clear(CLR_WHITE);
Cacher *cacher = this->cacher;
if( cacher != NULL ){
Image *thumb = NULL;
Cell *cell = NULL;
int i, x, y, mx, my, count;
bool top, bot, left, right;
right = false;
left = false;
top = false;
bot = false;
mx = OVL_MARGIN + 2 * (THB_SMSIZE + THB_SPACE);
my = mx;
x = y = OVL_MARGIN;
count = 0;
for( i = -THB_COUNT - this->picker; i <= THB_COUNT - this->picker; i++ ){
cacher->lockCache();
if( cacher->getCache() != NULL ){
cell = cacher->getCache()->gettoThat(i);
if( cell != NULL ){
thumb = cell->getImageThumb();
if( thumb != NULL ){
if( i != 0 ){
gfx->DrawImage(thumb,x,y,THB_SMSIZE,THB_SMSIZE);
gfx->DrawRectangle(this->Pen_Border,
x,
y,
THB_SMSIZE,
THB_SMSIZE);
}
else {
mx = x + (int)((THB_SIZE - THB_SMSIZE)/4);
my = y + (int)((THB_SIZE - THB_SMSIZE)/4);
}
}
if( i == -THB_ROW )
top = true;
if( i == THB_ROW )
bot = true;
if( i == -1 && cacher->getCache()->isThatHead() == false )
left = true;
if( i == 1 && cacher->getCache()->isThatTail() == false )
right = true;
}
}
count++;
x += THB_SMSIZE + THB_SPACE;
if( count >= THB_ROW ){
x = OVL_MARGIN;
y += THB_SMSIZE + THB_SPACE;
count = 0;
}
cacher->unlockCache();
}
int frame = 2;
cacher->lockCache();
if( cacher->getCache() != NULL ){
cell = cacher->getThat();
if( cell != NULL ){
thumb = cell->getImageThumb();
if( thumb != NULL ){
gfx->FillRectangle(this->Brush_Back,
mx - THB_SIZE/4,
my - THB_SIZE/4,
THB_SIZE,
THB_SIZE);
gfx->DrawImage(thumb,
mx - THB_SIZE/4,
my - THB_SIZE/4,
THB_SIZE,
THB_SIZE);
gfx->DrawRectangle(this->Pen_Border,
mx - THB_SIZE/4,
my - THB_SIZE/4,
THB_SIZE,
THB_SIZE);
gfx->DrawRectangle( this->Pen_DarkBorder,
mx - frame - THB_SIZE/4,
my - frame - THB_SIZE/4,
THB_SIZE + 2*frame,
THB_SIZE + 2*frame );
}
}
}
cacher->unlockCache();
int size = 3;
int width = 10;
int ax = (int)(mx - frame - THB_SIZE/4);
int ay = (int)(my - frame - THB_SIZE/4);
int asize = THB_SIZE + 2*frame;
Point arrow[3];
if( top == true ){
arrow[0].X = (int)(ax + (THB_SIZE/2) - width);
arrow[0].Y = ay;
arrow[1].X = (int)(ax + (THB_SIZE/2));
arrow[1].Y = ay - width;
arrow[2].X = (int)(ax + (THB_SIZE/2) + width);
arrow[2].Y = ay;
gfx->FillPolygon(this->Brush_DarkBack,arrow,size);
}
if( bot == true ){
arrow[0].X = (int)(ax + (THB_SIZE/2) - width);
arrow[0].Y = ay + asize;
arrow[1].X = (int)(ax + (THB_SIZE/2));
arrow[1].Y = ay + asize + width;
arrow[2].X = (int)(ax + (THB_SIZE/2) + width);
arrow[2].Y = ay + asize;
gfx->FillPolygon(this->Brush_DarkBack,arrow,size);
}
if( left == true ){
arrow[0].X = ax;
arrow[0].Y = (int)(ay + (THB_SIZE/2) - width);
arrow[1].X = ax - width;
arrow[1].Y = (int)(ay + (THB_SIZE/2));
arrow[2].X = ax;
arrow[2].Y = (int)(ay + (THB_SIZE/2) + width);
gfx->FillPolygon(this->Brush_DarkBack,arrow,size);
}
if( right == true ){
arrow[0].X = ax + asize;
arrow[0].Y = (int)(ay + (THB_SIZE/2) - width);
arrow[1].X = ax + asize + width;
arrow[1].Y = (int)(ay + (THB_SIZE/2));
arrow[2].X = ax + asize;
arrow[2].Y = (int)(ay + (THB_SIZE/2) + width);
gfx->FillPolygon(this->Brush_DarkBack,arrow,size);
}
}
if( this->ticker > TICKER_OFF ){
int tsize = TICKER_SIZE;
int tx,ty;
if( this->ticker == 0 ){
tx = OVL_SIZE - 2*TICKER_INDENT;
ty = OVL_SIZE - 2*TICKER_INDENT;
}
if( this->ticker == 1 ){
tx = OVL_SIZE - TICKER_INDENT;
ty = OVL_SIZE - 2*TICKER_INDENT;
}
if( this->ticker == 2 ){
tx = OVL_SIZE - TICKER_INDENT;
ty = OVL_SIZE - TICKER_INDENT;
}
if( this->ticker == 3 ){
tx = OVL_SIZE - 2*TICKER_INDENT;
ty = OVL_SIZE - TICKER_INDENT;
}
gfx->FillRectangle(this->Brush_DarkBack,tx,ty,tsize,tsize);
}
delete gfx;
}
Cell *Thumblay::getLastCell()
{
return this->lastCell;
}
|
[
"[email protected]"
] |
[
[
[
1,
488
]
]
] |
03f13c1d6fe2f40d31e550cbab8d8b6deb2a00e0
|
9566086d262936000a914c5dc31cb4e8aa8c461c
|
/EnigmaCommon/Entities/RealmSnapshot.cpp
|
efb1447f21ef34d642e31ef57574250005306bbd
|
[] |
no_license
|
pazuzu156/Enigma
|
9a0aaf0cd426607bb981eb46f5baa7f05b66c21f
|
b8a4dfbd0df206e48072259dbbfcc85845caad76
|
refs/heads/master
| 2020-06-06T07:33:46.385396 | 2011-12-19T03:14:15 | 2011-12-19T03:14:15 | 3,023,618 | 1 | 0 | null | null | null | null |
WINDOWS-1252
|
C++
| false | false | 1,779 |
cpp
|
/*
Copyright © 2009 Christopher Joseph Dean Schaefer (disks86)
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "RealmSnapshot.hpp"
namespace Enigma
{
RealmSnapshot::RealmSnapshot()
{
}
RealmSnapshot::~RealmSnapshot()
{
}
Map& RealmSnapshot::GetMap()
{
return mMap;
}
User& RealmSnapshot::GetUser()
{
return mUser;
}
std::vector<Party>& RealmSnapshot::GetParties()
{
return mParties;
}
std::map<size_t,Guild>& RealmSnapshot::GetGuilds()
{
return mGuilds;
}
void RealmSnapshot::Clear()
{
boost::unique_lock< boost::shared_mutex > applicationLock(ApplicationMutex);
boost::unique_lock< boost::shared_mutex > sceneLock(SceneMutex);
boost::unique_lock< boost::shared_mutex > chatLock(ChatMutex);
this->mMap = Map(); //clears map
this->GetGuilds().clear();
this->GetParties().clear();
this->mUser = User(); //clears user
}
};
|
[
"[email protected]"
] |
[
[
[
1,
60
]
]
] |
23b7ec600300750f0d567f43ec5c4f59062e7bde
|
465943c5ffac075cd5a617c47fd25adfe496b8b4
|
/POS_TEST.CPP
|
0e278e9df169838ea552af8cc8e315e016f3840e
|
[] |
no_license
|
paulanthonywilson/airtrafficcontrol
|
7467f9eb577b24b77306709d7b2bad77f1b231b7
|
6c579362f30ed5f81cabda27033f06e219796427
|
refs/heads/master
| 2016-08-08T00:43:32.006519 | 2009-04-09T21:33:22 | 2009-04-09T21:33:22 | 172,292 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,260 |
cpp
|
/* Test position class
Paul Wilson
26/3/96
*/
# include <stdio.h>
# include "position.h"
# include "heading.h"
int main (void) {
Position P1 (10,10), P2, P3, P4, P5;
Heading h, h1, h2;
int Expected;
printf ("\n\n\nTest\n");
h = D0;
Expected = 0;
do {
P2 = P1.NextMove (h);
printf ("\n%4d%4d\t%4d%4d", P2.X(), P2.Y(),
P1.AngleTo (P2), Expected);
assert (h == P1.HeadingTo (P2));
h++;
Expected += 45;
}while (h != D0);
printf ("\n");
P2.Set (1,1);
assert (P2.inArena());
assert (P2.inField());
assert (!P2.inBoundary());
P2 = P2.NextMove (D270);
assert (P2.inArena());
assert (!P2.inField());
assert (P2.inBoundary());
P2 = P2.NextMove (D270);
assert (!P2.inArena());
assert (!P2.inField());
assert (!P2.inBoundary());
h1 = P1.HeadingTo (P2);
h2 = P2.HeadingTo (P1);
assert (!(&h1 == &h2));
P2 = P1.NextMove (D0);
P3 = P1.NextMove (D45);
assert (P2 != P3);
P1.Set (0,0);
P2.Set (1,1);
P3.Set (2,2);
P4.Set (3,3);
P5.Set (2,3);
cout << '\n' <<P1.AngleTo (P2) << '\n';
cout << '\n' <<P1.AngleTo (P3) << '\n';
cout << '\n' <<P1.AngleTo (P4) << '\n';
cout << '\n' <<P1.AngleTo (P5) << '\n';
return 0;
}
|
[
"[email protected]"
] |
[
[
[
1,
83
]
]
] |
e9752441d87ef79011077b957b3295f38db0e46e
|
580738f96494d426d6e5973c5b3493026caf8b6a
|
/Include/Vcl/xmldom.hpp
|
8470f7c0a97aca03bda75d8484b82da69de41d2b
|
[] |
no_license
|
bravesoftdz/cbuilder-vcl
|
6b460b4d535d17c309560352479b437d99383d4b
|
7b91ef1602681e094a6a7769ebb65ffd6f291c59
|
refs/heads/master
| 2021-01-10T14:21:03.726693 | 2010-01-11T11:23:45 | 2010-01-11T11:23:45 | 48,485,606 | 2 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 40,906 |
hpp
|
// Borland C++ Builder
// Copyright (c) 1995, 2002 by Borland Software Corporation
// All rights reserved
// (DO NOT EDIT: machine generated header) 'xmldom.pas' rev: 6.00
#ifndef xmldomHPP
#define xmldomHPP
#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <Classes.hpp> // Pascal unit
#include <Variants.hpp> // Pascal unit
#include <SysUtils.hpp> // Pascal unit
#include <SysInit.hpp> // Pascal unit
#include <System.hpp> // Pascal unit
//-- user supplied -----------------------------------------------------------
namespace Xmldom
{
//-- type declarations -------------------------------------------------------
typedef WideString DOMString;
typedef __int64 DOMTimeStamp;
class DELPHICLASS DOMException;
class PASCALIMPLEMENTATION DOMException : public Sysutils::Exception
{
typedef Sysutils::Exception inherited;
public:
Word code;
public:
#pragma option push -w-inl
/* Exception.Create */ inline __fastcall DOMException(const AnsiString Msg) : Sysutils::Exception(Msg) { }
#pragma option pop
#pragma option push -w-inl
/* Exception.CreateFmt */ inline __fastcall DOMException(const AnsiString Msg, const System::TVarRec * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
#pragma option pop
#pragma option push -w-inl
/* Exception.CreateRes */ inline __fastcall DOMException(int Ident)/* overload */ : Sysutils::Exception(Ident) { }
#pragma option pop
#pragma option push -w-inl
/* Exception.CreateResFmt */ inline __fastcall DOMException(int Ident, const System::TVarRec * Args, const int Args_Size)/* overload */ : Sysutils::Exception(Ident, Args, Args_Size) { }
#pragma option pop
#pragma option push -w-inl
/* Exception.CreateHelp */ inline __fastcall DOMException(const AnsiString Msg, int AHelpContext) : Sysutils::Exception(Msg, AHelpContext) { }
#pragma option pop
#pragma option push -w-inl
/* Exception.CreateFmtHelp */ inline __fastcall DOMException(const AnsiString Msg, const System::TVarRec * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext) { }
#pragma option pop
#pragma option push -w-inl
/* Exception.CreateResHelp */ inline __fastcall DOMException(int Ident, int AHelpContext)/* overload */ : Sysutils::Exception(Ident, AHelpContext) { }
#pragma option pop
#pragma option push -w-inl
/* Exception.CreateResFmtHelp */ inline __fastcall DOMException(System::PResStringRec ResStringRec, const System::TVarRec * Args, const int Args_Size, int AHelpContext)/* overload */ : Sysutils::Exception(ResStringRec, Args, Args_Size, AHelpContext) { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~DOMException(void) { }
#pragma option pop
};
class DELPHICLASS EDOMParseError;
__interface IDOMParseError;
typedef System::DelphiInterface<IDOMParseError> _di_IDOMParseError;
__interface INTERFACE_UUID("{2BF4C0F2-096E-11D4-83DA-00C04F60B2DD}") IDOMParseError : public IInterface
{
public:
virtual int __fastcall get_errorCode(void) = 0 ;
virtual HRESULT __safecall get_url(WideString &get_url_result) = 0 ;
virtual HRESULT __safecall get_reason(WideString &get_reason_result) = 0 ;
virtual HRESULT __safecall get_srcText(WideString &get_srcText_result) = 0 ;
virtual int __fastcall get_line(void) = 0 ;
virtual int __fastcall get_linepos(void) = 0 ;
virtual int __fastcall get_filepos(void) = 0 ;
__property int errorCode = {read=get_errorCode};
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_url() { WideString r; HRESULT hr = get_url(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString url = {read=_scw_get_url};
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_reason() { WideString r; HRESULT hr = get_reason(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString reason = {read=_scw_get_reason};
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_srcText() { WideString r; HRESULT hr = get_srcText(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString srcText = {read=_scw_get_srcText};
__property int line = {read=get_line};
__property int linePos = {read=get_linepos};
__property int filePos = {read=get_filepos};
};
class PASCALIMPLEMENTATION EDOMParseError : public Sysutils::Exception
{
typedef Sysutils::Exception inherited;
private:
_di_IDOMParseError FParseError;
int __fastcall GetFilePos(void);
int __fastcall GetLine(void);
int __fastcall GetLinePos(void);
WideString __fastcall GetReason();
WideString __fastcall GetSrcText();
WideString __fastcall GetURL();
int __fastcall GetErrorCode(void);
protected:
__property _di_IDOMParseError ParseError = {read=FParseError};
public:
__fastcall EDOMParseError(const _di_IDOMParseError ParseError, const AnsiString Msg);
__property int ErrorCode = {read=GetErrorCode, nodefault};
__property WideString URL = {read=GetURL};
__property WideString Reason = {read=GetReason};
__property WideString SrcText = {read=GetSrcText};
__property int Line = {read=GetLine, nodefault};
__property int LinePos = {read=GetLinePos, nodefault};
__property int FilePos = {read=GetFilePos, nodefault};
public:
#pragma option push -w-inl
/* Exception.CreateFmt */ inline __fastcall EDOMParseError(const AnsiString Msg, const System::TVarRec * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
#pragma option pop
#pragma option push -w-inl
/* Exception.CreateRes */ inline __fastcall EDOMParseError(int Ident)/* overload */ : Sysutils::Exception(Ident) { }
#pragma option pop
#pragma option push -w-inl
/* Exception.CreateResFmt */ inline __fastcall EDOMParseError(int Ident, const System::TVarRec * Args, const int Args_Size)/* overload */ : Sysutils::Exception(Ident, Args, Args_Size) { }
#pragma option pop
#pragma option push -w-inl
/* Exception.CreateHelp */ inline __fastcall EDOMParseError(const AnsiString Msg, int AHelpContext) : Sysutils::Exception(Msg, AHelpContext) { }
#pragma option pop
#pragma option push -w-inl
/* Exception.CreateFmtHelp */ inline __fastcall EDOMParseError(const AnsiString Msg, const System::TVarRec * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext) { }
#pragma option pop
#pragma option push -w-inl
/* Exception.CreateResHelp */ inline __fastcall EDOMParseError(int Ident, int AHelpContext)/* overload */ : Sysutils::Exception(Ident, AHelpContext) { }
#pragma option pop
#pragma option push -w-inl
/* Exception.CreateResFmtHelp */ inline __fastcall EDOMParseError(System::PResStringRec ResStringRec, const System::TVarRec * Args, const int Args_Size, int AHelpContext)/* overload */ : Sysutils::Exception(ResStringRec, Args, Args_Size, AHelpContext) { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~EDOMParseError(void) { }
#pragma option pop
};
__interface IDOMImplementation;
typedef System::DelphiInterface<IDOMImplementation> _di_IDOMImplementation;
__interface IDOMDocumentType;
typedef System::DelphiInterface<IDOMDocumentType> _di_IDOMDocumentType;
__interface IDOMDocument;
typedef System::DelphiInterface<IDOMDocument> _di_IDOMDocument;
__interface INTERFACE_UUID("{2BF4C0E0-096E-11D4-83DA-00C04F60B2DD}") IDOMImplementation : public IInterface
{
public:
virtual Word __fastcall hasFeature(const WideString feature, const WideString version) = 0 ;
virtual HRESULT __safecall createDocumentType(const WideString qualifiedName, const WideString publicId, const WideString systemId, _di_IDOMDocumentType &createDocumentType_result) = 0 ;
virtual HRESULT __safecall createDocument(const WideString namespaceURI, const WideString qualifiedName, _di_IDOMDocumentType doctype, _di_IDOMDocument &createDocument_result) = 0 ;
};
__interface IDOMNode;
typedef System::DelphiInterface<IDOMNode> _di_IDOMNode;
__interface IDOMNodeList;
typedef System::DelphiInterface<IDOMNodeList> _di_IDOMNodeList;
__interface IDOMNamedNodeMap;
typedef System::DelphiInterface<IDOMNamedNodeMap> _di_IDOMNamedNodeMap;
__interface INTERFACE_UUID("{2BF4C0E1-096E-11D4-83DA-00C04F60B2DD}") IDOMNode : public IInterface
{
public:
virtual HRESULT __safecall get_nodeName(WideString &get_nodeName_result) = 0 ;
virtual HRESULT __safecall get_nodeValue(WideString &get_nodeValue_result) = 0 ;
virtual void __fastcall set_nodeValue(WideString value) = 0 ;
virtual HRESULT __safecall get_nodeType(Word &get_nodeType_result) = 0 ;
virtual HRESULT __safecall get_parentNode(_di_IDOMNode &get_parentNode_result) = 0 ;
virtual HRESULT __safecall get_childNodes(_di_IDOMNodeList &get_childNodes_result) = 0 ;
virtual HRESULT __safecall get_firstChild(_di_IDOMNode &get_firstChild_result) = 0 ;
virtual HRESULT __safecall get_lastChild(_di_IDOMNode &get_lastChild_result) = 0 ;
virtual HRESULT __safecall get_previousSibling(_di_IDOMNode &get_previousSibling_result) = 0 ;
virtual HRESULT __safecall get_nextSibling(_di_IDOMNode &get_nextSibling_result) = 0 ;
virtual HRESULT __safecall get_attributes(_di_IDOMNamedNodeMap &get_attributes_result) = 0 ;
virtual HRESULT __safecall get_ownerDocument(_di_IDOMDocument &get_ownerDocument_result) = 0 ;
virtual HRESULT __safecall get_namespaceURI(WideString &get_namespaceURI_result) = 0 ;
virtual HRESULT __safecall get_prefix(WideString &get_prefix_result) = 0 ;
virtual HRESULT __safecall get_localName(WideString &get_localName_result) = 0 ;
virtual HRESULT __safecall insertBefore(const _di_IDOMNode newChild, const _di_IDOMNode refChild, _di_IDOMNode &insertBefore_result) = 0 ;
virtual HRESULT __safecall replaceChild(const _di_IDOMNode newChild, const _di_IDOMNode oldChild, _di_IDOMNode &replaceChild_result) = 0 ;
virtual HRESULT __safecall removeChild(const _di_IDOMNode childNode, _di_IDOMNode &removeChild_result) = 0 ;
virtual HRESULT __safecall appendChild(const _di_IDOMNode newChild, _di_IDOMNode &appendChild_result) = 0 ;
virtual HRESULT __safecall hasChildNodes(Word &hasChildNodes_result) = 0 ;
virtual HRESULT __safecall cloneNode(Word deep, _di_IDOMNode &cloneNode_result) = 0 ;
virtual void __fastcall normalize(void) = 0 ;
virtual Word __fastcall supports(const WideString feature, const WideString version) = 0 ;
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_nodeName() { WideString r; HRESULT hr = get_nodeName(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString nodeName = {read=_scw_get_nodeName};
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_nodeValue() { WideString r; HRESULT hr = get_nodeValue(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString nodeValue = {read=_scw_get_nodeValue, write=set_nodeValue};
#pragma option push -w-inl
/* safecall wrapper */ inline Word _scw_get_nodeType() { Word r; HRESULT hr = get_nodeType(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property Word nodeType = {read=_scw_get_nodeType};
#pragma option push -w-inl
/* safecall wrapper */ inline _di_IDOMNode _scw_get_parentNode() { _di_IDOMNode r; HRESULT hr = get_parentNode(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property _di_IDOMNode parentNode = {read=_scw_get_parentNode};
#pragma option push -w-inl
/* safecall wrapper */ inline _di_IDOMNodeList _scw_get_childNodes() { _di_IDOMNodeList r; HRESULT hr = get_childNodes(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property _di_IDOMNodeList childNodes = {read=_scw_get_childNodes};
#pragma option push -w-inl
/* safecall wrapper */ inline _di_IDOMNode _scw_get_firstChild() { _di_IDOMNode r; HRESULT hr = get_firstChild(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property _di_IDOMNode firstChild = {read=_scw_get_firstChild};
#pragma option push -w-inl
/* safecall wrapper */ inline _di_IDOMNode _scw_get_lastChild() { _di_IDOMNode r; HRESULT hr = get_lastChild(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property _di_IDOMNode lastChild = {read=_scw_get_lastChild};
#pragma option push -w-inl
/* safecall wrapper */ inline _di_IDOMNode _scw_get_previousSibling() { _di_IDOMNode r; HRESULT hr = get_previousSibling(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property _di_IDOMNode previousSibling = {read=_scw_get_previousSibling};
#pragma option push -w-inl
/* safecall wrapper */ inline _di_IDOMNode _scw_get_nextSibling() { _di_IDOMNode r; HRESULT hr = get_nextSibling(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property _di_IDOMNode nextSibling = {read=_scw_get_nextSibling};
#pragma option push -w-inl
/* safecall wrapper */ inline _di_IDOMNamedNodeMap _scw_get_attributes() { _di_IDOMNamedNodeMap r; HRESULT hr = get_attributes(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property _di_IDOMNamedNodeMap attributes = {read=_scw_get_attributes};
#pragma option push -w-inl
/* safecall wrapper */ inline _di_IDOMDocument _scw_get_ownerDocument() { _di_IDOMDocument r; HRESULT hr = get_ownerDocument(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property _di_IDOMDocument ownerDocument = {read=_scw_get_ownerDocument};
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_namespaceURI() { WideString r; HRESULT hr = get_namespaceURI(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString namespaceURI = {read=_scw_get_namespaceURI};
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_prefix() { WideString r; HRESULT hr = get_prefix(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString prefix = {read=_scw_get_prefix};
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_localName() { WideString r; HRESULT hr = get_localName(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString localName = {read=_scw_get_localName};
};
__interface INTERFACE_UUID("{2BF4C0E2-096E-11D4-83DA-00C04F60B2DD}") IDOMNodeList : public IInterface
{
public:
_di_IDOMNode operator[](int index) { return item[index]; }
public:
virtual HRESULT __safecall get_item(int index, _di_IDOMNode &get_item_result) = 0 ;
virtual HRESULT __safecall get_length(int &get_length_result) = 0 ;
#pragma option push -w-inl
/* safecall wrapper */ inline _di_IDOMNode _scw_get_item(int index) { _di_IDOMNode r; HRESULT hr = get_item(index, r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property _di_IDOMNode item[int index] = {read=_scw_get_item/*, default*/};
#pragma option push -w-inl
/* safecall wrapper */ inline int _scw_get_length() { int r; HRESULT hr = get_length(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property int length = {read=_scw_get_length};
};
__interface INTERFACE_UUID("{2BF4C0E3-096E-11D4-83DA-00C04F60B2DD}") IDOMNamedNodeMap : public IInterface
{
public:
_di_IDOMNode operator[](int index) { return item[index]; }
public:
virtual HRESULT __safecall get_item(int index, _di_IDOMNode &get_item_result) = 0 ;
virtual int __fastcall get_length(void) = 0 ;
virtual HRESULT __safecall getNamedItem(const WideString name, _di_IDOMNode &getNamedItem_result) = 0 ;
virtual HRESULT __safecall setNamedItem(const _di_IDOMNode arg, _di_IDOMNode &setNamedItem_result) = 0 ;
virtual HRESULT __safecall removeNamedItem(const WideString name, _di_IDOMNode &removeNamedItem_result) = 0 ;
virtual HRESULT __safecall getNamedItemNS(const WideString namespaceURI, const WideString localName, _di_IDOMNode &getNamedItemNS_result) = 0 ;
virtual HRESULT __safecall setNamedItemNS(const _di_IDOMNode arg, _di_IDOMNode &setNamedItemNS_result) = 0 ;
virtual HRESULT __safecall removeNamedItemNS(const WideString namespaceURI, const WideString localName, _di_IDOMNode &removeNamedItemNS_result) = 0 ;
#pragma option push -w-inl
/* safecall wrapper */ inline _di_IDOMNode _scw_get_item(int index) { _di_IDOMNode r; HRESULT hr = get_item(index, r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property _di_IDOMNode item[int index] = {read=_scw_get_item/*, default*/};
__property int length = {read=get_length};
};
__interface IDOMCharacterData;
typedef System::DelphiInterface<IDOMCharacterData> _di_IDOMCharacterData;
__interface INTERFACE_UUID("{2BF4C0E4-096E-11D4-83DA-00C04F60B2DD}") IDOMCharacterData : public IDOMNode
{
public:
virtual WideString __fastcall get_data(void) = 0 ;
virtual void __fastcall set_data(const WideString data) = 0 ;
virtual int __fastcall get_length(void) = 0 ;
virtual WideString __fastcall substringData(int offset, int count) = 0 ;
virtual void __fastcall appendData(const WideString data) = 0 ;
virtual void __fastcall insertData(int offset, const WideString data) = 0 ;
virtual void __fastcall deleteData(int offset, int count) = 0 ;
virtual void __fastcall replaceData(int offset, int count, const WideString data) = 0 ;
__property WideString data = {read=get_data, write=set_data};
__property int length = {read=get_length};
};
__interface IDOMAttr;
typedef System::DelphiInterface<IDOMAttr> _di_IDOMAttr;
__interface IDOMElement;
typedef System::DelphiInterface<IDOMElement> _di_IDOMElement;
__interface INTERFACE_UUID("{2BF4C0E5-096E-11D4-83DA-00C04F60B2DD}") IDOMAttr : public IDOMNode
{
public:
virtual WideString __fastcall get_name(void) = 0 ;
virtual Word __fastcall get_specified(void) = 0 ;
virtual WideString __fastcall get_value(void) = 0 ;
virtual void __fastcall set_value(const WideString attributeValue) = 0 ;
virtual _di_IDOMElement __fastcall get_ownerElement(void) = 0 ;
__property WideString name = {read=get_name};
__property Word specified = {read=get_specified};
__property WideString value = {read=get_value, write=set_value};
__property _di_IDOMElement ownerElement = {read=get_ownerElement};
};
__interface INTERFACE_UUID("{2BF4C0E6-096E-11D4-83DA-00C04F60B2DD}") IDOMElement : public IDOMNode
{
public:
virtual HRESULT __safecall get_tagName(WideString &get_tagName_result) = 0 ;
virtual HRESULT __safecall getAttribute(const WideString name, WideString &getAttribute_result) = 0 ;
virtual void __fastcall setAttribute(const WideString name, const WideString value) = 0 ;
virtual void __fastcall removeAttribute(const WideString name) = 0 ;
virtual HRESULT __safecall getAttributeNode(const WideString name, _di_IDOMAttr &getAttributeNode_result) = 0 ;
virtual HRESULT __safecall setAttributeNode(const _di_IDOMAttr newAttr, _di_IDOMAttr &setAttributeNode_result) = 0 ;
virtual HRESULT __safecall removeAttributeNode(const _di_IDOMAttr oldAttr, _di_IDOMAttr &removeAttributeNode_result) = 0 ;
virtual HRESULT __safecall getElementsByTagName(const WideString name, _di_IDOMNodeList &getElementsByTagName_result) = 0 ;
virtual HRESULT __safecall getAttributeNS(const WideString namespaceURI, const WideString localName, WideString &getAttributeNS_result) = 0 ;
virtual void __fastcall setAttributeNS(const WideString namespaceURI, const WideString qulifiedName, const WideString value) = 0 ;
virtual void __fastcall removeAttributeNS(const WideString namespaceURI, const WideString localName) = 0 ;
virtual HRESULT __safecall getAttributeNodeNS(const WideString namespaceURI, const WideString localName, _di_IDOMAttr &getAttributeNodeNS_result) = 0 ;
virtual HRESULT __safecall setAttributeNodeNS(const _di_IDOMAttr newAttr, _di_IDOMAttr &setAttributeNodeNS_result) = 0 ;
virtual HRESULT __safecall getElementsByTagNameNS(const WideString namespaceURI, const WideString localName, _di_IDOMNodeList &getElementsByTagNameNS_result) = 0 ;
virtual HRESULT __safecall hasAttribute(const WideString name, Word &hasAttribute_result) = 0 ;
virtual Word __fastcall hasAttributeNS(const WideString namespaceURI, const WideString localName) = 0 ;
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_tagName() { WideString r; HRESULT hr = get_tagName(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString tagName = {read=_scw_get_tagName};
};
__interface IDOMText;
typedef System::DelphiInterface<IDOMText> _di_IDOMText;
__interface INTERFACE_UUID("{2BF4C0E7-096E-11D4-83DA-00C04F60B2DD}") IDOMText : public IDOMCharacterData
{
public:
virtual HRESULT __safecall splitText(int offset, _di_IDOMText &splitText_result) = 0 ;
};
__interface IDOMComment;
typedef System::DelphiInterface<IDOMComment> _di_IDOMComment;
__interface INTERFACE_UUID("{2BF4C0E8-096E-11D4-83DA-00C04F60B2DD}") IDOMComment : public IDOMCharacterData
{
};
__interface IDOMCDATASection;
typedef System::DelphiInterface<IDOMCDATASection> _di_IDOMCDATASection;
__interface INTERFACE_UUID("{2BF4C0E9-096E-11D4-83DA-00C04F60B2DD}") IDOMCDATASection : public IDOMText
{
};
__interface INTERFACE_UUID("{2BF4C0EA-096E-11D4-83DA-00C04F60B2DD}") IDOMDocumentType : public IDOMNode
{
public:
virtual HRESULT __safecall get_name(WideString &get_name_result) = 0 ;
virtual HRESULT __safecall get_entities(_di_IDOMNamedNodeMap &get_entities_result) = 0 ;
virtual HRESULT __safecall get_notations(_di_IDOMNamedNodeMap &get_notations_result) = 0 ;
virtual HRESULT __safecall get_publicId(WideString &get_publicId_result) = 0 ;
virtual HRESULT __safecall get_systemId(WideString &get_systemId_result) = 0 ;
virtual HRESULT __safecall get_internalSubset(WideString &get_internalSubset_result) = 0 ;
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_name() { WideString r; HRESULT hr = get_name(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString name = {read=_scw_get_name};
#pragma option push -w-inl
/* safecall wrapper */ inline _di_IDOMNamedNodeMap _scw_get_entities() { _di_IDOMNamedNodeMap r; HRESULT hr = get_entities(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property _di_IDOMNamedNodeMap entities = {read=_scw_get_entities};
#pragma option push -w-inl
/* safecall wrapper */ inline _di_IDOMNamedNodeMap _scw_get_notations() { _di_IDOMNamedNodeMap r; HRESULT hr = get_notations(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property _di_IDOMNamedNodeMap notations = {read=_scw_get_notations};
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_publicId() { WideString r; HRESULT hr = get_publicId(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString publicId = {read=_scw_get_publicId};
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_systemId() { WideString r; HRESULT hr = get_systemId(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString systemId = {read=_scw_get_systemId};
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_internalSubset() { WideString r; HRESULT hr = get_internalSubset(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString internalSubset = {read=_scw_get_internalSubset};
};
__interface IDOMNotation;
typedef System::DelphiInterface<IDOMNotation> _di_IDOMNotation;
__interface INTERFACE_UUID("{2BF4C0EB-096E-11D4-83DA-00C04F60B2DD}") IDOMNotation : public IDOMNode
{
public:
virtual HRESULT __safecall get_publicId(WideString &get_publicId_result) = 0 ;
virtual HRESULT __safecall get_systemId(WideString &get_systemId_result) = 0 ;
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_publicId() { WideString r; HRESULT hr = get_publicId(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString publicId = {read=_scw_get_publicId};
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_systemId() { WideString r; HRESULT hr = get_systemId(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString systemId = {read=_scw_get_systemId};
};
__interface IDOMEntity;
typedef System::DelphiInterface<IDOMEntity> _di_IDOMEntity;
__interface INTERFACE_UUID("{2BF4C0EC-096E-11D4-83DA-00C04F60B2DD}") IDOMEntity : public IDOMNode
{
public:
virtual HRESULT __safecall get_publicId(WideString &get_publicId_result) = 0 ;
virtual HRESULT __safecall get_systemId(WideString &get_systemId_result) = 0 ;
virtual HRESULT __safecall get_notationName(WideString &get_notationName_result) = 0 ;
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_publicId() { WideString r; HRESULT hr = get_publicId(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString publicId = {read=_scw_get_publicId};
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_systemId() { WideString r; HRESULT hr = get_systemId(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString systemId = {read=_scw_get_systemId};
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_notationName() { WideString r; HRESULT hr = get_notationName(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString notationName = {read=_scw_get_notationName};
};
__interface IDOMEntityReference;
typedef System::DelphiInterface<IDOMEntityReference> _di_IDOMEntityReference;
__interface INTERFACE_UUID("{2BF4C0ED-096E-11D4-83DA-00C04F60B2DD}") IDOMEntityReference : public IDOMNode
{
};
__interface IDOMProcessingInstruction;
typedef System::DelphiInterface<IDOMProcessingInstruction> _di_IDOMProcessingInstruction;
__interface INTERFACE_UUID("{2BF4C0EE-096E-11D4-83DA-00C04F60B2DD}") IDOMProcessingInstruction : public IDOMNode
{
public:
virtual HRESULT __safecall get_target(WideString &get_target_result) = 0 ;
virtual HRESULT __safecall get_data(WideString &get_data_result) = 0 ;
virtual void __fastcall set_data(const WideString value) = 0 ;
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_target() { WideString r; HRESULT hr = get_target(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString target = {read=_scw_get_target};
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_data() { WideString r; HRESULT hr = get_data(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString data = {read=_scw_get_data, write=set_data};
};
__interface IDOMDocumentFragment;
typedef System::DelphiInterface<IDOMDocumentFragment> _di_IDOMDocumentFragment;
__interface INTERFACE_UUID("{2BF4C0EF-096E-11D4-83DA-00C04F60B2DD}") IDOMDocumentFragment : public IDOMNode
{
};
__interface INTERFACE_UUID("{2BF4C0F0-096E-11D4-83DA-00C04F60B2DD}") IDOMDocument : public IDOMNode
{
public:
virtual HRESULT __safecall get_doctype(_di_IDOMDocumentType &get_doctype_result) = 0 ;
virtual HRESULT __safecall get_domImplementation(_di_IDOMImplementation &get_domImplementation_result) = 0 ;
virtual HRESULT __safecall get_documentElement(_di_IDOMElement &get_documentElement_result) = 0 ;
virtual void __fastcall set_documentElement(const _di_IDOMElement Element) = 0 ;
virtual HRESULT __safecall createElement(const WideString tagName, _di_IDOMElement &createElement_result) = 0 ;
virtual HRESULT __safecall createDocumentFragment(_di_IDOMDocumentFragment &createDocumentFragment_result) = 0 ;
virtual HRESULT __safecall createTextNode(const WideString data, _di_IDOMText &createTextNode_result) = 0 ;
virtual HRESULT __safecall createComment(const WideString data, _di_IDOMComment &createComment_result) = 0 ;
virtual HRESULT __safecall createCDATASection(const WideString data, _di_IDOMCDATASection &createCDATASection_result) = 0 ;
virtual HRESULT __safecall createProcessingInstruction(const WideString target, const WideString data, _di_IDOMProcessingInstruction &createProcessingInstruction_result) = 0 ;
virtual HRESULT __safecall createAttribute(const WideString name, _di_IDOMAttr &createAttribute_result) = 0 ;
virtual HRESULT __safecall createEntityReference(const WideString name, _di_IDOMEntityReference &createEntityReference_result) = 0 ;
virtual HRESULT __safecall getElementsByTagName(const WideString tagName, _di_IDOMNodeList &getElementsByTagName_result) = 0 ;
virtual HRESULT __safecall importNode(_di_IDOMNode importedNode, Word deep, _di_IDOMNode &importNode_result) = 0 ;
virtual HRESULT __safecall createElementNS(const WideString namespaceURI, const WideString qualifiedName, _di_IDOMElement &createElementNS_result) = 0 ;
virtual HRESULT __safecall createAttributeNS(const WideString namespaceURI, const WideString qualifiedName, _di_IDOMAttr &createAttributeNS_result) = 0 ;
virtual HRESULT __safecall getElementsByTagNameNS(const WideString namespaceURI, const WideString localName, _di_IDOMNodeList &getElementsByTagNameNS_result) = 0 ;
virtual _di_IDOMElement __fastcall getElementById(const WideString elementId) = 0 ;
#pragma option push -w-inl
/* safecall wrapper */ inline _di_IDOMDocumentType _scw_get_doctype() { _di_IDOMDocumentType r; HRESULT hr = get_doctype(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property _di_IDOMDocumentType doctype = {read=_scw_get_doctype};
#pragma option push -w-inl
/* safecall wrapper */ inline _di_IDOMImplementation _scw_get_domImplementation() { _di_IDOMImplementation r; HRESULT hr = get_domImplementation(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property _di_IDOMImplementation domImplementation = {read=_scw_get_domImplementation};
#pragma option push -w-inl
/* safecall wrapper */ inline _di_IDOMElement _scw_get_documentElement() { _di_IDOMElement r; HRESULT hr = get_documentElement(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property _di_IDOMElement documentElement = {read=_scw_get_documentElement, write=set_documentElement};
};
__interface IDOMNodeSelect;
typedef System::DelphiInterface<IDOMNodeSelect> _di_IDOMNodeSelect;
__interface INTERFACE_UUID("{2A3602E0-2B39-11D4-83DA-00C04F60B2DD}") IDOMNodeSelect : public IInterface
{
public:
virtual HRESULT __safecall selectNode(const WideString nodePath, _di_IDOMNode &selectNode_result) = 0 ;
virtual HRESULT __safecall selectNodes(const WideString nodePath, _di_IDOMNodeList &selectNodes_result) = 0 ;
};
__interface IDOMNodeEx;
typedef System::DelphiInterface<IDOMNodeEx> _di_IDOMNodeEx;
__interface INTERFACE_UUID("{B06BFFDD-337B-48DA-980B-6F7AA8ADE85C}") IDOMNodeEx : public IDOMNode
{
public:
virtual HRESULT __safecall get_text(WideString &get_text_result) = 0 ;
virtual HRESULT __safecall get_xml(WideString &get_xml_result) = 0 ;
virtual HRESULT __safecall set_text(const WideString Value) = 0 ;
virtual void __fastcall transformNode(const _di_IDOMNode stylesheet, WideString &output) = 0 /* overload */;
virtual void __fastcall transformNode(const _di_IDOMNode stylesheet, const _di_IDOMDocument output) = 0 /* overload */;
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_text() { WideString r; HRESULT hr = get_text(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString text = {read=_scw_get_text, write=set_text};
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_xml() { WideString r; HRESULT hr = get_xml(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString xml = {read=_scw_get_xml};
};
typedef void __fastcall (__closure *TAsyncEventHandler)(System::TObject* Sender, int AsyncLoadState);
__interface IDOMPersist;
typedef System::DelphiInterface<IDOMPersist> _di_IDOMPersist;
__interface INTERFACE_UUID("{2BF4C0F1-096E-11D4-83DA-00C04F60B2DD}") IDOMPersist : public IInterface
{
public:
virtual HRESULT __safecall get_xml(WideString &get_xml_result) = 0 ;
virtual HRESULT __safecall asyncLoadState(int &asyncLoadState_result) = 0 ;
virtual HRESULT __safecall load(const OleVariant source, Word &load_result) = 0 ;
virtual HRESULT __safecall loadFromStream(const Classes::TStream* stream, Word &loadFromStream_result) = 0 ;
virtual HRESULT __safecall loadxml(const WideString Value, Word &loadxml_result) = 0 ;
virtual HRESULT __safecall save(const OleVariant destination) = 0 ;
virtual HRESULT __safecall saveToStream(const Classes::TStream* stream) = 0 ;
virtual HRESULT __safecall set_OnAsyncLoad(const System::TObject* Sender, TAsyncEventHandler EventHandler) = 0 ;
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_xml() { WideString r; HRESULT hr = get_xml(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString xml = {read=_scw_get_xml};
};
__interface IDOMParseOptions;
typedef System::DelphiInterface<IDOMParseOptions> _di_IDOMParseOptions;
__interface INTERFACE_UUID("{2BF4C0F3-096E-11D4-83DA-00C04F60B2DD}") IDOMParseOptions : public IInterface
{
public:
virtual bool __fastcall get_async(void) = 0 ;
virtual bool __fastcall get_preserveWhiteSpace(void) = 0 ;
virtual bool __fastcall get_resolveExternals(void) = 0 ;
virtual bool __fastcall get_validate(void) = 0 ;
virtual void __fastcall set_async(bool Value) = 0 ;
virtual void __fastcall set_preserveWhiteSpace(bool Value) = 0 ;
virtual void __fastcall set_resolveExternals(bool Value) = 0 ;
virtual void __fastcall set_validate(bool Value) = 0 ;
__property bool async = {read=get_async, write=set_async};
__property bool preserveWhiteSpace = {read=get_preserveWhiteSpace, write=set_preserveWhiteSpace};
__property bool resolveExternals = {read=get_resolveExternals, write=set_resolveExternals};
__property bool validate = {read=get_validate, write=set_validate};
};
__interface IDOMXMLProlog;
typedef System::DelphiInterface<IDOMXMLProlog> _di_IDOMXMLProlog;
__interface INTERFACE_UUID("{7C192633-C267-483C-B0D5-89289A14D522}") IDOMXMLProlog : public IInterface
{
public:
virtual HRESULT __safecall get_Encoding(WideString &get_Encoding_result) = 0 ;
virtual HRESULT __safecall get_Standalone(WideString &get_Standalone_result) = 0 ;
virtual HRESULT __safecall get_Version(WideString &get_Version_result) = 0 ;
virtual HRESULT __safecall set_Encoding(const WideString Value) = 0 ;
virtual HRESULT __safecall set_Standalone(const WideString Value) = 0 ;
virtual HRESULT __safecall set_Version(const WideString Value) = 0 ;
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_Encoding() { WideString r; HRESULT hr = get_Encoding(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString Encoding = {read=_scw_get_Encoding, write=set_Encoding};
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_Standalone() { WideString r; HRESULT hr = get_Standalone(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString Standalone = {read=_scw_get_Standalone, write=set_Standalone};
#pragma option push -w-inl
/* safecall wrapper */ inline WideString _scw_get_Version() { WideString r; HRESULT hr = get_Version(r); System::CheckSafecallResult(hr); return r; }
#pragma option pop
__property WideString Version = {read=_scw_get_Version, write=set_Version};
};
class DELPHICLASS TDOMVendor;
class PASCALIMPLEMENTATION TDOMVendor : public System::TObject
{
typedef System::TObject inherited;
public:
virtual AnsiString __fastcall Description(void) = 0 ;
virtual _di_IDOMImplementation __fastcall DOMImplementation(void) = 0 ;
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TDOMVendor(void) : System::TObject() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TDOMVendor(void) { }
#pragma option pop
};
typedef DynamicArray<TDOMVendor* > TDOMVendorArray;
class DELPHICLASS TDOMVendorList;
class PASCALIMPLEMENTATION TDOMVendorList : public System::TObject
{
typedef System::TObject inherited;
public:
TDOMVendor* operator[](int Index) { return Vendors[Index]; }
private:
DynamicArray<TDOMVendor* > FVendors;
protected:
TDOMVendor* __fastcall GetVendors(int Index);
public:
void __fastcall Add(const TDOMVendor* Vendor);
int __fastcall Count(void);
TDOMVendor* __fastcall Find(const AnsiString VendorDesc);
void __fastcall Remove(const TDOMVendor* Vendor);
__property TDOMVendor* Vendors[int Index] = {read=GetVendors/*, default*/};
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TDOMVendorList(void) : System::TObject() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TDOMVendorList(void) { }
#pragma option pop
};
//-- var, const, procedure ---------------------------------------------------
#define DOMWrapperVersion (1.000000E+00)
static const Shortint ELEMENT_NODE = 0x1;
static const Shortint ATTRIBUTE_NODE = 0x2;
static const Shortint TEXT_NODE = 0x3;
static const Shortint CDATA_SECTION_NODE = 0x4;
static const Shortint ENTITY_REFERENCE_NODE = 0x5;
static const Shortint ENTITY_NODE = 0x6;
static const Shortint PROCESSING_INSTRUCTION_NODE = 0x7;
static const Shortint COMMENT_NODE = 0x8;
static const Shortint DOCUMENT_NODE = 0x9;
static const Shortint DOCUMENT_TYPE_NODE = 0xa;
static const Shortint DOCUMENT_FRAGMENT_NODE = 0xb;
static const Shortint NOTATION_NODE = 0xc;
static const Shortint INDEX_SIZE_ERR = 0x1;
static const Shortint DOMSTRING_SIZE_ERR = 0x2;
static const Shortint HIERARCHY_REQUEST_ERR = 0x3;
static const Shortint WRONG_DOCUMENT_ERR = 0x4;
static const Shortint INVALID_CHARACTER_ERR = 0x5;
static const Shortint NO_DATA_ALLOWED_ERR = 0x6;
static const Shortint NO_MODIFICATION_ALLOWED_ERR = 0x7;
static const Shortint NOT_FOUND_ERR = 0x8;
static const Shortint NOT_SUPPORTED_ERR = 0x9;
static const Shortint INUSE_ATTRIBUTE_ERR = 0xa;
static const Shortint INVALID_STATE_ERR = 0xb;
static const Shortint SYNTAX_ERR = 0xc;
static const Shortint INVALID_MODIFICATION_ERR = 0xd;
static const Shortint NAMESPACE_ERR = 0xe;
static const Shortint INVALID_ACCESS_ERR = 0xf;
static const char NSDelim = '\x3a';
#define SXML "xml"
#define SVersion "version"
#define SEncoding "encoding"
#define SStandalone "standalone"
#define SXMLNS "xmlns"
#define SHttp "http:/"
#define SXMLNamespaceURI "http://www.w3.org/2000/xmlns/"
extern PACKAGE AnsiString DefaultDOMVendor;
extern PACKAGE TDOMVendorList* DOMVendors;
extern PACKAGE bool __fastcall IsPrefixed(const WideString AName);
extern PACKAGE WideString __fastcall ExtractLocalName(const WideString AName);
extern PACKAGE WideString __fastcall ExtractPrefix(const WideString AName);
extern PACKAGE WideString __fastcall MakeNodeName(const WideString Prefix, const WideString LocalName);
extern PACKAGE bool __fastcall SameNamespace(const _di_IDOMNode Node, const WideString namespaceURI)/* overload */;
extern PACKAGE bool __fastcall SameNamespace(const WideString URI1, const WideString URI2)/* overload */;
extern PACKAGE bool __fastcall NodeMatches(const _di_IDOMNode Node, const WideString TagName, const WideString NamespaceURI)/* overload */;
extern PACKAGE _di_IDOMNodeEx __fastcall GetDOMNodeEx(const _di_IDOMNode Node);
extern PACKAGE void __fastcall RegisterDOMVendor(const TDOMVendor* Vendor);
extern PACKAGE void __fastcall UnRegisterDOMVendor(const TDOMVendor* Vendor);
extern PACKAGE TDOMVendor* __fastcall GetDOMVendor(AnsiString VendorDesc);
extern PACKAGE _di_IDOMImplementation __fastcall GetDOM(const AnsiString VendorDesc = "");
extern PACKAGE void __fastcall DOMVendorNotSupported(const AnsiString PropOrMethod, const AnsiString VendorName);
} /* namespace Xmldom */
using namespace Xmldom;
#pragma option pop // -w-
#pragma option pop // -Vx
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // xmldom
|
[
"bitscode@7bd08ab0-fa70-11de-930f-d36749347e7b"
] |
[
[
[
1,
748
]
]
] |
96a06e703e3262b7c67ad239679ac65ac35e6fcd
|
110f8081090ba9591d295d617a55a674467d127e
|
/tests/test.cpp
|
73cea52e8ec715a571f5e01bca230135fa3c8e0a
|
[] |
no_license
|
rayfill/cpplib
|
617bcf04368a2db70aea8b9418a45d7fd187d8c2
|
bc37fbf0732141d0107dd93bcf5e0b31f0d078ca
|
refs/heads/master
| 2021-01-25T03:49:26.965162 | 2011-07-17T15:19:11 | 2011-07-17T15:19:11 | 783,979 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 758 |
cpp
|
#include <vector>
#include <iostream>
#include <string>
#include <stdexcept>
class Test
{
private:
std::vector<int> vec;
std::string member;
public:
Test():
vec(),
member()
{}
void setMember(const char* newString)
{
member = newString;
}
const char* getMember() const
{
return member.c_str();
}
virtual ~Test()
{}
};
void test(const std::string& reason)
{
Test test2;
throw std::runtime_error((std::string("aaaabbbbcccc") + reason).c_str());
}
void nested(const int nest)
{
if (nest == 0)
test("testtest");
else
nested(nest - 1);
}
int main()
{
try
{
nested(10000);
}
catch (std::exception& e)
{
std::cerr << e.what() << std::endl;
}
return 0;
}
|
[
"bpokazakijr@287b3242-7fab-264f-8401-8509467ab285",
"alfeim@287b3242-7fab-264f-8401-8509467ab285"
] |
[
[
[
1,
1
],
[
39,
39
],
[
41,
41
],
[
46,
49
],
[
58,
60
]
],
[
[
2,
38
],
[
40,
40
],
[
42,
45
],
[
50,
57
]
]
] |
6f3907ffd9d69063d88524f7ae49749a40a63811
|
118ded1d2bad8ae3b5fa5b6abaf4d45b54ece2fa
|
/src/Library/Logger/SqliteLogger.h
|
889914ea46ba37cc3233294902e957dc6980efbc
|
[] |
no_license
|
gpoleszuk/kinematic
|
ab064f6dffeea91f7dd91ebc6eac5c30e3d6ee16
|
b5c95c43771f74b17152498b602295ee21c60037
|
refs/heads/master
| 2021-01-10T10:52:24.487730 | 2011-01-15T17:29:25 | 2011-01-15T17:29:25 | 55,036,059 | 0 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 593 |
h
|
#ifndef SqliteLogger_included
#define SqliteLogger_included
#include "RawReceiver.h"
#include "sqlite3.h"
class SqliteLogger
{
bool ErrCode;
int station_id;
RawReceiver &gps;
const char* filename;
sqlite3* db;
sqlite3_stmt* begin;
sqlite3_stmt* insert;
sqlite3_stmt* end;
public:
bool GetError() {return ErrCode;}
SqliteLogger(const char* filename, RawReceiver& gps, int station_id);
bool OutputEpoch();
virtual ~SqliteLogger();
private:
bool Initialize();
bool Cleanup();
};
#endif
|
[
"[email protected]"
] |
[
[
[
1,
37
]
]
] |
43e7e3025d39e0d800fc95c77d0fb67dca10233e
|
b88e3fe619adf0d3c56251f63afb63aba25fceaa
|
/Point.cpp
|
3957498817724538a730eb68fee01044414b2c64
|
[] |
no_license
|
pads/cplusplus-scratchpad
|
e4bfac971ab00cb9d95d3f0d1f01fe4f3224dca3
|
1deeac43c8d341ad1661c09b9aab22cf5c1ab9df
|
refs/heads/master
| 2020-05-18T11:56:56.037725 | 2011-03-30T17:24:38 | 2011-03-30T17:24:38 | 1,537,188 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,439 |
cpp
|
#include <iostream>
using namespace std;
// Can use struct but is not the same as a C struct here.
class Point {
private:
int x;
int y;
public:
Point() {
x = 0;
y = 0;
}
Point(int x0, int y0) {
// . takes precedence over *
// this is implicit so don't need this anyway.
// Just use x = x0; and y = y0;
(*this).x = x0;
(*this).y = y0;
}
// Copy constructor
Point(const Point& copy) {
}
// Deconstructor
~Point() {
// Called just before objects are freed from memory.
// This isn't needed if the class has no pointer variables.
}
void moveBy(int dx = 1, int dy = 1) {
x+= dx;
y+= dy;
}
void display() {
// endl is a new line and a flush in one go.
cout << "point is at: " << x << ", " << y << endl;
}
};
int main() {
// Created on the stack - defaults to 8k allocation, change with a compiler flag.
// Will only live in memory until main completes.
Point p1(100, 100), p2(400, 250), p3(200, 150);
// p4 cannot use brackets as compiler will think it's a function call.
Point p4;
p1.moveBy(1, 1);
p2.moveBy();
p3.moveBy(1, 1);
p4.moveBy(1, 1);
p1.display();
p2.display();
p3.display();
p4.display();
// Created on the heap (can allocate at runtime and have full control of its life span).
Point* ptr = new Point(22, 33);
(*ptr).moveBy(1, 1);
ptr->display();
// Need to free this object from memory
//TODO
}
|
[
"[email protected]"
] |
[
[
[
1,
67
]
]
] |
e36945c2099826066c216bf345e16c1847577d21
|
6c8c4728e608a4badd88de181910a294be56953a
|
/Core/CoreStableHeaders.cpp
|
284335c7bebcb97c23984c8708c116ceee3bf4c2
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
caocao/naali
|
29c544e121703221fe9c90b5c20b3480442875ef
|
67c5aa85fa357f7aae9869215f840af4b0e58897
|
refs/heads/master
| 2021-01-21T00:25:27.447991 | 2010-03-22T15:04:19 | 2010-03-22T15:04:19 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 114 |
cpp
|
// For conditions of distribution and use, see copyright notice in license.txt
#include "CoreStableHeaders.h"
|
[
"cmayhem@5b2332b8-efa3-11de-8684-7d64432d61a3"
] |
[
[
[
1,
3
]
]
] |
0315aeabafdb2c6220b5c9ca909b2628e6bad9f8
|
c95a83e1a741b8c0eb810dd018d91060e5872dd8
|
/Game/ClientShellDLL/ClientShellShared/FlashLight.h
|
a49f3cd136376db0ac4b1b56f34b4c643fb1b9f3
|
[] |
no_license
|
rickyharis39/nolf2
|
ba0b56e2abb076e60d97fc7a2a8ee7be4394266c
|
0da0603dc961e73ac734ff365bfbfb8abb9b9b04
|
refs/heads/master
| 2021-01-01T17:21:00.678517 | 2011-07-23T12:11:19 | 2011-07-23T12:11:19 | 38,495,312 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,615 |
h
|
// ----------------------------------------------------------------------- //
//
// MODULE : FlashLight.h
//
// PURPOSE : FlashLight class - Definition
//
// CREATED : 07/21/99
//
// (c) 1999-2002 Monolith Productions, Inc. All Rights Reserved
//
// ----------------------------------------------------------------------- //
#ifndef __FLASH_LIGHT_H__
#define __FLASH_LIGHT_H__
#include "ltbasedefs.h"
#include "PolyLineFX.h"
class CFlashLight
{
public :
CFlashLight();
virtual ~CFlashLight();
virtual void Update();
virtual void Toggle() { (m_bOn ? TurnOff() : TurnOn());}
virtual void TurnOn();
virtual void TurnOff();
virtual LTBOOL IsOn() const { return m_bOn; }
protected :
virtual void CreateLight();
virtual void GetLightPositions(LTVector & vStartPos, LTVector & vEndPos, LTVector & vUOffset, LTVector & vROffset) = 0;
virtual LTBOOL UpdateServer() { return LTTRUE; }
private :
LTBOOL m_bOn;
HOBJECT m_hLight;
};
class CFlashLightPlayer : public CFlashLight
{
protected :
void GetLightPositions(LTVector & vStartPos, LTVector & vEndPos, LTVector & vUOffset, LTVector & vROffset);
};
class CFlashLight3rdPerson : public CFlashLight
{
public :
CFlashLight3rdPerson();
~CFlashLight3rdPerson();
void Init(HOBJECT hObj);
protected :
virtual void GetLightPositions(LTVector & vStartPos, LTVector & vEndPos, LTVector & vUOffset, LTVector & vROffset);
virtual LTBOOL UpdateServer() { return LTFALSE; }
protected :
HOBJECT m_hObj;
};
#endif // __FLASH_LIGHT_H__
|
[
"[email protected]"
] |
[
[
[
1,
75
]
]
] |
3e77669702d2762b128723b907cf8cb81244e507
|
4aedb4f2fba771b4a2f1b6ba85001fff23f16d09
|
/icfpc_gui/ship.h
|
31907e973b5717588951e73fd020aaa3c8c81c7d
|
[] |
no_license
|
orfest/codingmonkeys-icfpc
|
9eacf6b51f03ed271505235e65e53a44ae4addd0
|
8ee42d89261c62ecaddf853edd4e5bb9b097b10b
|
refs/heads/master
| 2020-12-24T16:50:44.419429 | 2009-06-29T17:52:44 | 2009-06-29T17:52:44 | 32,205,184 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 778 |
h
|
#ifndef SHIP_H
#define SHIP_H
#include <QtGlobal>
#include <QVector>
#include <QPointF>
#include <QColor>
class Ship{
QVector<QPointF> track;
QColor color;
int sweepedPointsUpTo;
int numSweeps;
int maxPointsPerShip;
public:
Ship() : sweepedPointsUpTo(0), numSweeps(0), maxPointsPerShip(1000) {}
QColor getColor() const { return color; }
const QVector<QPointF>& getTrack() const { return track; }
void pushPosition(const QPointF& p);
void setColor(QColor col) { color = col; }
const void reset() { track.clear(); sweepedPointsUpTo = 0; numSweeps = 0; }
void setMaxPoints(int maxPoints) { maxPointsPerShip = maxPoints; }
private:
void removeExcessTrackPoints(int maxPoints = 1000);
void doSweep();
};
#endif //SHIP_H
|
[
"nkurtov@6cd8edf8-6250-11de-81d0-cf1ed2c911a4",
"vizovitin@6cd8edf8-6250-11de-81d0-cf1ed2c911a4"
] |
[
[
[
1,
11
],
[
15,
15
],
[
17,
20
],
[
26,
28
]
],
[
[
12,
14
],
[
16,
16
],
[
21,
25
]
]
] |
d86bd88b293451a9d2127d46746aacab12cd7f38
|
c5534a6df16a89e0ae8f53bcd49a6417e8d44409
|
/trunk/Dependencies/Xerces/include/xercesc/util/Transcoders/Uniconv390/XMLEBCDICTranscoder390.hpp
|
b7e46d9c71ab61fd4c248a2e8ccd95cec9349d1a
|
[] |
no_license
|
svn2github/ngene
|
b2cddacf7ec035aa681d5b8989feab3383dac012
|
61850134a354816161859fe86c2907c8e73dc113
|
refs/heads/master
| 2023-09-03T12:34:18.944872 | 2011-07-27T19:26:04 | 2011-07-27T19:26:04 | 78,163,390 | 2 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,639 |
hpp
|
/*
* Copyright 2004,2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id: XMLEBCDICTranscoder390.hpp 191054 2005-06-17 02:56:35Z jberry $
*/
#ifndef XMLEBCDICTRANSCODER390_HPP
#define XMLEBCDICTRANSCODER390_HPP
#include <xercesc/util/XercesDefs.hpp>
#include <xercesc/util/Transcoders/Uniconv390/XML256TableTranscoder390.hpp>
XERCES_CPP_NAMESPACE_BEGIN
//
// This class provides an implementation of the XMLTranscoder interface
// for a simple EBCDIC-US transcoder. The parser does some encodings
// intrinsically without depending upon external transcoding services.
// To make everything more orthagonal, we implement these internal
// transcoders using the same transcoder abstraction as the pluggable
// transcoding services do.
//
// EBCDIC-US is the same as IBM037, CP37, EBCDIC-CP-US, etc...
//
class XMLUTIL_EXPORT XMLEBCDICTranscoder390 : public XML256TableTranscoder390
{
public :
// -----------------------------------------------------------------------
// Public, static methods
// -----------------------------------------------------------------------
static XMLCh xlatThisOne(const XMLByte toXlat);
// -----------------------------------------------------------------------
// Public constructors and destructor
// -----------------------------------------------------------------------
XMLEBCDICTranscoder390
(
const XMLCh* const encodingName
, const unsigned int blockSize
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
virtual ~XMLEBCDICTranscoder390();
private :
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
XMLEBCDICTranscoder390();
XMLEBCDICTranscoder390(const XMLEBCDICTranscoder390&);
XMLEBCDICTranscoder390& operator=(const XMLEBCDICTranscoder390&);
};
XERCES_CPP_NAMESPACE_END
#endif
|
[
"Riddlemaster@fdc6060e-f348-4335-9a41-9933a8eecd57"
] |
[
[
[
1,
72
]
]
] |
246b614451d8ce927091b220d688a56de987fced
|
1318dc65808b102d4afcdd7831ab89873c3968ce
|
/MyClass5/src/sax/SAXCallLogHandler.h
|
6a69d55bd06852e575f933c0d1b3408f496b6471
|
[] |
no_license
|
mpoullet/QtTutorial
|
33cf98232e78d3a35aaec94e4071d342ccfee152
|
cf261a402fea7de8f67f37e1e03ccf979786f5b2
|
refs/heads/master
| 2021-01-23T19:45:06.023179 | 2011-11-04T16:58:43 | 2011-11-04T16:58:43 | 2,682,092 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 382 |
h
|
#include <QXmlDefaultHandler>
#include <QDebug>
class SAXCallLogHandler : public QXmlDefaultHandler
{
public:
SAXCallLogHandler();
bool characters(const QString &str);
bool endElement( const QString&, const QString&, const QString &);
bool startElement( const QString&, const QString&, const QString &, const QXmlAttributes & );
private:
QString itemText;
};
|
[
"[email protected]"
] |
[
[
[
1,
15
]
]
] |
450e38743fd380c24bfc0015f6b3c9711a3ea6ae
|
6c8c4728e608a4badd88de181910a294be56953a
|
/Core/CoreMath.h
|
bd3c64709623a80dfba3bc7bfa04706907ad12ab
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
caocao/naali
|
29c544e121703221fe9c90b5c20b3480442875ef
|
67c5aa85fa357f7aae9869215f840af4b0e58897
|
refs/heads/master
| 2021-01-21T00:25:27.447991 | 2010-03-22T15:04:19 | 2010-03-22T15:04:19 | null | 0 | 0 | null | null | null | null |
WINDOWS-1252
|
C++
| false | false | 13,220 |
h
|
// Based on Irrlicht Engine implementation.
// This file is under following license:
//
// The Irrlicht Engine License
//
// Copyright © 2002-2005 Nikolaus Gebhardt
//
// This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
//
// The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
// Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
// This notice may not be removed or altered from any source distribution.
#ifndef incl_Core_Math_h
#define incl_Core_Math_h
#include "CoreTypes.h"
#include <cmath>
#if defined(_IRR_SOLARIS_PLATFORM_) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) || defined (_WIN32_WCE)
#define sqrtf(X) (f32)sqrt((f64)(X))
#define sinf(X) (f32)sin((f64)(X))
#define cosf(X) (f32)cos((f64)(X))
#define asinf(X) (f32)asin((f64)(X))
#define acosf(X) (f32)acos((f64)(X))
#define atan2f(X,Y) (f32)atan2((f64)(X),(f64)(Y))
#define ceilf(X) (f32)ceil((f64)(X))
#define floorf(X) (f32)floor((f64)(X))
#define powf(X,Y) (f32)pow((f64)(X),(f64)(Y))
#define fmodf(X,Y) (f32)fmod((f64)(X),(f64)(Y))
#define fabsf(X) (f32)fabs((f64)(X))
#endif
//! Rounding error constant often used when comparing f32 values.
#ifdef IRRLICHT_FAST_MATH
const f32 ROUNDING_ERROR_32 = 0.00005f;
const f64 ROUNDING_ERROR_64 = 0.000005;
#else
const f32 ROUNDING_ERROR_32 = 0.000001f;
const f64 ROUNDING_ERROR_64 = 0.00000001;
#endif
#ifdef PI // make sure we don't collide with a define
#undef PI
#endif
//! Constant for PI.
const f32 PI = 3.14159265359f;
//! Constant for reciprocal of PI.
const f32 RECIPROCAL_PI = 1.0f/PI;
//! Constant for half of PI.
const f32 HALF_PI = PI/2.0f;
#ifdef PI64 // make sure we don't collide with a define
#undef PI64
#endif
//! Constant for 64bit PI.
const f64 PI64 = 3.1415926535897932384626433832795028841971693993751;
//! Constant for 64bit reciprocal of PI.
const f64 RECIPROCAL_PI64 = 1.0/PI64;
//! 32bit Constant for converting from degrees to radians
const f32 DEGTORAD = PI / 180.0f;
//! 32bit constant for converting from radians to degrees (formally known as GRAD_PI)
const f32 RADTODEG = 180.0f / PI;
//! 64bit constant for converting from degrees to radians (formally known as GRAD_PI2)
const f64 DEGTORAD64 = PI64 / 180.0;
//! 64bit constant for converting from radians to degrees
const f64 RADTODEG64 = 180.0 / PI64;
//! Utility function to convert a radian value to degrees
/** Provided as it can be clearer to write radToDeg(X) than RADTODEG * X
\param radians The radians value to convert to degrees.
*/
inline f32 radToDeg(f32 radians)
{
return RADTODEG * radians;
}
//! Utility function to convert a radian value to degrees
/** Provided as it can be clearer to write radToDeg(X) than RADTODEG * X
\param radians The radians value to convert to degrees.
*/
inline f64 radToDeg(f64 radians)
{
return RADTODEG64 * radians;
}
//! Utility function to convert a degrees value to radians
/** Provided as it can be clearer to write degToRad(X) than DEGTORAD * X
\param degrees The degrees value to convert to radians.
*/
inline f32 degToRad(f32 degrees)
{
return DEGTORAD * degrees;
}
//! Utility function to convert a degrees value to radians
/** Provided as it can be clearer to write degToRad(X) than DEGTORAD * X
\param degrees The degrees value to convert to radians.
*/
inline f64 degToRad(f64 degrees)
{
return DEGTORAD64 * degrees;
}
//! returns minimum of two values. Own implementation to get rid of the STL (VS6 problems)
template<class T>
inline const T& min_(const T& a, const T& b)
{
return a < b ? a : b;
}
//! returns minimum of three values. Own implementation to get rid of the STL (VS6 problems)
template<class T>
inline const T& min_(const T& a, const T& b, const T& c)
{
return a < b ? min_(a, c) : min_(b, c);
}
//! returns maximum of two values. Own implementation to get rid of the STL (VS6 problems)
template<class T>
inline const T& max_(const T& a, const T& b)
{
return a < b ? b : a;
}
//! returns maximum of three values. Own implementation to get rid of the STL (VS6 problems)
template<class T>
inline const T& max_(const T& a, const T& b, const T& c)
{
return a < b ? max_(b, c) : max_(a, c);
}
//! returns abs of two values. Own implementation to get rid of STL (VS6 problems)
template<class T>
inline T abs_(const T& a)
{
return a < (T)0 ? -a : a;
}
//! returns linear interpolation of a and b with ratio t
//! \return: a if t==0, b if t==1, and the linear interpolation else
template<class T>
inline T lerp(const T& a, const T& b, const f32 t)
{
return (T)(a*(1.f-t)) + (b*t);
}
//! clamps a value between low and high
template <class T>
inline const T clamp (const T& value, const T& low, const T& high)
{
return min_ (max_(value,low), high);
}
//! returns if a equals b, taking possible rounding errors into account
inline bool equals(const f64 a, const f64 b, const f64 tolerance = ROUNDING_ERROR_64)
{
return (a + tolerance >= b) && (a - tolerance <= b);
}
//! returns if a equals b, taking possible rounding errors into account
inline bool equals(const f32 a, const f32 b, const f32 tolerance = ROUNDING_ERROR_32)
{
return (a + tolerance >= b) && (a - tolerance <= b);
}
//! returns if a equals b, taking possible rounding errors into account
inline bool equals(const s32 a, const s32 b, const s32 tolerance = 0)
{
return (a + tolerance >= b) && (a - tolerance <= b);
}
//! returns if a equals b, taking possible rounding errors into account
inline bool equals(const u32 a, const u32 b, const u32 tolerance = 0)
{
return (a + tolerance >= b) && (a - tolerance <= b);
}
//! returns if a equals zero, taking rounding errors into account
inline bool iszero(const f32 a, const f32 tolerance = ROUNDING_ERROR_32)
{
return fabsf ( a ) <= tolerance;
}
//! returns if a equals zero, taking rounding errors into account
inline bool iszero(const s32 a, const s32 tolerance = 0)
{
return ( a & 0x7ffffff ) <= tolerance;
}
//! returns if a equals zero, taking rounding errors into account
inline bool iszero(const u32 a, const u32 tolerance = 0)
{
return a <= tolerance;
}
inline s32 s32_min ( s32 a, s32 b)
{
s32 mask = (a - b) >> 31;
return (a & mask) | (b & ~mask);
}
inline s32 s32_max ( s32 a, s32 b)
{
s32 mask = (a - b) >> 31;
return (b & mask) | (a & ~mask);
}
inline s32 s32_clamp (s32 value, s32 low, s32 high)
{
return s32_min (s32_max(value,low), high);
}
/*
float IEEE-754 bit represenation
0 0x00000000
1.0 0x3f800000
0.5 0x3f000000
3 0x40400000
+inf 0x7f800000
-inf 0xff800000
+NaN 0x7fc00000 or 0x7ff00000
in general: number = (sign ? -1:1) * 2^(exponent) * 1.(mantissa bits)
*/
typedef union { u32 u; s32 s; f32 f; } inttofloat;
#define F32_AS_S32(f) (*((s32 *) &(f)))
#define F32_AS_U32(f) (*((u32 *) &(f)))
#define F32_AS_U32_POINTER(f) ( ((u32 *) &(f)))
#define F32_VALUE_0 0x00000000
#define F32_VALUE_1 0x3f800000
#define F32_SIGN_BIT 0x80000000U
#define F32_EXPON_MANTISSA 0x7FFFFFFFU
//! code is taken from IceFPU
//! Integer representation of a floating-point value.
#ifdef IRRLICHT_FAST_MATH
#define IR(x) ((u32&)(x))
#else
inline u32 IR(f32 x) {inttofloat tmp; tmp.f=x; return tmp.u;}
#endif
//! Absolute integer representation of a floating-point value
#define AIR(x) (IR(x)&0x7fffffff)
//! Floating-point representation of an integer value.
#ifdef IRRLICHT_FAST_MATH
#define FR(x) ((f32&)(x))
#else
inline f32 FR(u32 x) {inttofloat tmp; tmp.u=x; return tmp.f;}
inline f32 FR(s32 x) {inttofloat tmp; tmp.s=x; return tmp.f;}
#endif
//! integer representation of 1.0
#define IEEE_1_0 0x3f800000
//! integer representation of 255.0
#define IEEE_255_0 0x437f0000
#ifdef IRRLICHT_FAST_MATH
#define F32_LOWER_0(f) (F32_AS_U32(f) > F32_SIGN_BIT)
#define F32_LOWER_EQUAL_0(f) (F32_AS_S32(f) <= F32_VALUE_0)
#define F32_GREATER_0(f) (F32_AS_S32(f) > F32_VALUE_0)
#define F32_GREATER_EQUAL_0(f) (F32_AS_U32(f) <= F32_SIGN_BIT)
#define F32_EQUAL_1(f) (F32_AS_U32(f) == F32_VALUE_1)
#define F32_EQUAL_0(f) ( (F32_AS_U32(f) & F32_EXPON_MANTISSA ) == F32_VALUE_0)
// only same sign
#define F32_A_GREATER_B(a,b) (F32_AS_S32((a)) > F32_AS_S32((b)))
#else
#define F32_LOWER_0(n) ((n) < 0.0f)
#define F32_LOWER_EQUAL_0(n) ((n) <= 0.0f)
#define F32_GREATER_0(n) ((n) > 0.0f)
#define F32_GREATER_EQUAL_0(n) ((n) >= 0.0f)
#define F32_EQUAL_1(n) ((n) == 1.0f)
#define F32_EQUAL_0(n) ((n) == 0.0f)
#define F32_A_GREATER_B(a,b) ((a) > (b))
#endif
#ifndef REALINLINE
#ifdef _MSC_VER
#define REALINLINE __forceinline
#else
#define REALINLINE inline
#endif
#endif
//! conditional set based on mask and arithmetic shift
REALINLINE u32 if_c_a_else_b ( const s32 condition, const u32 a, const u32 b )
{
return ( ( -condition >> 31 ) & ( a ^ b ) ) ^ b;
}
//! conditional set based on mask and arithmetic shift
REALINLINE u32 if_c_a_else_0 ( const s32 condition, const u32 a )
{
return ( -condition >> 31 ) & a;
}
/*
if (condition) state |= m; else state &= ~m;
*/
REALINLINE void setbit_cond ( u32 &state, s32 condition, u32 mask )
{
// 0, or any postive to mask
//s32 conmask = -condition >> 31;
state ^= ( ( -condition >> 31 ) ^ state ) & mask;
}
inline f32 round_( f32 x )
{
return floorf( x + 0.5f );
}
REALINLINE void clearFPUException ()
{
#ifdef IRRLICHT_FAST_MATH
#ifdef feclearexcept
feclearexcept(FE_ALL_EXCEPT);
#elif defined(_MSC_VER)
__asm fnclex;
#elif defined(__GNUC__) && defined(__x86__)
__asm__ __volatile__ ("fclex \n\t");
#else
# warn clearFPUException not supported.
#endif
#endif
}
REALINLINE f32 reciprocal_squareroot(const f32 x)
{
#ifdef IRRLICHT_FAST_MATH
// comes from Nvidia
#if 1
u32 tmp = (u32(IEEE_1_0 << 1) + IEEE_1_0 - *(u32*)&x) >> 1;
f32 y = *(f32*)&tmp;
return y * (1.47f - 0.47f * x * y * y);
#elif defined(_MSC_VER)
// an sse2 version
__asm
{
movss xmm0, x
rsqrtss xmm0, xmm0
movss x, xmm0
}
return x;
#endif
#else // no fast math
return 1.f / sqrtf ( x );
#endif
}
REALINLINE f32 reciprocal ( const f32 f )
{
#ifdef IRRLICHT_FAST_MATH
//! i do not divide through 0.. (fpu expection)
// instead set f to a high value to get a return value near zero..
// -1000000000000.f.. is use minus to stay negative..
// must test's here (plane.normal dot anything ) checks on <= 0.f
return 1.f / f;
//u32 x = (-(AIR(f) != 0 ) >> 31 ) & ( IR(f) ^ 0xd368d4a5 ) ^ 0xd368d4a5;
//return 1.f / FR ( x );
#else // no fast math
return 1.f / f;
#endif
}
REALINLINE f32 reciprocal_approxim ( const f32 p )
{
#ifdef IRRLICHT_FAST_MATH
register u32 x = 0x7F000000 - IR ( p );
const f32 r = FR ( x );
return r * (2.0f - p * r);
#else // no fast math
return 1.f / p;
#endif
}
REALINLINE s32 floor32(f32 x)
{
#ifdef IRRLICHT_FAST_MATH
const f32 h = 0.5f;
s32 t;
#if defined(_MSC_VER)
__asm
{
fld x
fsub h
fistp t
}
#elif defined(__GNUC__)
__asm__ __volatile__ (
"fsub %2 \n\t"
"fistpl %0"
: "=m" (t)
: "t" (x), "f" (h)
: "st"
);
#else
# warn IRRLICHT_FAST_MATH not supported.
return (s32) floorf ( x );
#endif
return t;
#else // no fast math
return (s32) floorf ( x );
#endif
}
REALINLINE s32 ceil32 ( f32 x )
{
#ifdef IRRLICHT_FAST_MATH
const f32 h = 0.5f;
s32 t;
#if defined(_MSC_VER)
__asm
{
fld x
fadd h
fistp t
}
#elif defined(__GNUC__)
__asm__ __volatile__ (
"fadd %2 \n\t"
"fistpl %0 \n\t"
: "=m"(t)
: "t"(x), "f"(h)
: "st"
);
#else
# warn IRRLICHT_FAST_MATH not supported.
return (s32) ceilf ( x );
#endif
return t;
#else // not fast math
return (s32) ceilf ( x );
#endif
}
REALINLINE s32 round32(f32 x)
{
#if defined(IRRLICHT_FAST_MATH)
s32 t;
#if defined(_MSC_VER)
__asm
{
fld x
fistp t
}
#elif defined(__GNUC__)
__asm__ __volatile__ (
"fistpl %0 \n\t"
: "=m"(t)
: "t"(x)
: "st"
);
#else
# warn IRRLICHT_FAST_MATH not supported.
return (s32) round_(x);
#endif
return t;
#else // no fast math
return (s32) round_(x);
#endif
}
inline f32 f32_max3(const f32 a, const f32 b, const f32 c)
{
return a > b ? (a > c ? a : c) : (b > c ? b : c);
}
inline f32 f32_min3(const f32 a, const f32 b, const f32 c)
{
return a < b ? (a < c ? a : c) : (b < c ? b : c);
}
inline f32 fract ( f32 x )
{
return x - floorf ( x );
}
#endif
|
[
"cmayhem@5b2332b8-efa3-11de-8684-7d64432d61a3",
"jujjyl@5b2332b8-efa3-11de-8684-7d64432d61a3",
"cadaver@5b2332b8-efa3-11de-8684-7d64432d61a3"
] |
[
[
[
1,
18
],
[
21,
22
],
[
34,
35
],
[
37,
38
],
[
41,
41
],
[
44,
48
],
[
51,
51
],
[
54,
54
],
[
57,
60
],
[
63,
63
],
[
66,
66
],
[
69,
69
],
[
72,
72
],
[
75,
75
],
[
78,
78
],
[
114,
114
],
[
121,
121
],
[
128,
128
],
[
135,
135
],
[
142,
142
],
[
149,
149
],
[
157,
157
],
[
164,
164
],
[
170,
170
],
[
176,
176
],
[
182,
182
],
[
188,
188
],
[
194,
194
],
[
200,
200
],
[
206,
206
],
[
212,
212
],
[
218,
218
],
[
250,
250
],
[
252,
252
],
[
254,
255
],
[
258,
258
],
[
260,
260
],
[
262,
262
],
[
265,
266
],
[
271,
272
],
[
279,
279
],
[
282,
284
],
[
292,
295
],
[
301,
303
],
[
309,
309
],
[
315,
315
],
[
325,
325
],
[
330,
330
],
[
333,
334
],
[
336,
336
],
[
338,
338
],
[
340,
343
],
[
345,
345
],
[
348,
348
],
[
350,
350
],
[
354,
354
],
[
363,
364
],
[
366,
366
],
[
368,
370
],
[
373,
373
],
[
381,
381
],
[
383,
383
],
[
385,
386
],
[
389,
389
],
[
393,
393
],
[
395,
395
],
[
397,
398
],
[
401,
401
],
[
403,
403
],
[
405,
406
],
[
413,
413
],
[
421,
422
],
[
424,
424
],
[
426,
426
],
[
428,
428
],
[
430,
431
],
[
434,
434
],
[
436,
436
],
[
438,
439
],
[
446,
446
],
[
454,
455
],
[
457,
457
],
[
459,
459
],
[
461,
461
],
[
463,
465
],
[
468,
468
],
[
470,
471
],
[
477,
477
],
[
484,
485
],
[
487,
487
],
[
489,
489
],
[
491,
491
],
[
493,
493
],
[
498,
498
],
[
503,
503
],
[
508,
510
]
],
[
[
19,
20
]
],
[
[
23,
33
],
[
36,
36
],
[
39,
40
],
[
42,
43
],
[
49,
50
],
[
52,
53
],
[
55,
56
],
[
61,
62
],
[
64,
65
],
[
67,
68
],
[
70,
71
],
[
73,
74
],
[
76,
77
],
[
79,
113
],
[
115,
120
],
[
122,
127
],
[
129,
134
],
[
136,
141
],
[
143,
148
],
[
150,
156
],
[
158,
163
],
[
165,
169
],
[
171,
175
],
[
177,
181
],
[
183,
187
],
[
189,
193
],
[
195,
199
],
[
201,
205
],
[
207,
211
],
[
213,
217
],
[
219,
249
],
[
251,
251
],
[
253,
253
],
[
256,
257
],
[
259,
259
],
[
261,
261
],
[
263,
264
],
[
267,
270
],
[
273,
278
],
[
280,
281
],
[
285,
291
],
[
296,
300
],
[
304,
308
],
[
310,
314
],
[
316,
324
],
[
326,
329
],
[
331,
332
],
[
335,
335
],
[
337,
337
],
[
339,
339
],
[
344,
344
],
[
346,
347
],
[
349,
349
],
[
351,
353
],
[
355,
362
],
[
365,
365
],
[
367,
367
],
[
371,
372
],
[
374,
380
],
[
382,
382
],
[
384,
384
],
[
387,
388
],
[
390,
392
],
[
394,
394
],
[
396,
396
],
[
399,
400
],
[
402,
402
],
[
404,
404
],
[
407,
412
],
[
414,
420
],
[
423,
423
],
[
425,
425
],
[
427,
427
],
[
429,
429
],
[
432,
433
],
[
435,
435
],
[
437,
437
],
[
440,
445
],
[
447,
453
],
[
456,
456
],
[
458,
458
],
[
460,
460
],
[
462,
462
],
[
466,
467
],
[
469,
469
],
[
472,
476
],
[
478,
483
],
[
486,
486
],
[
488,
488
],
[
490,
490
],
[
492,
492
],
[
494,
497
],
[
499,
502
],
[
504,
507
]
]
] |
0ec8a36e383235721f5336c7a9eef1e255097c0e
|
619941b532c6d2987c0f4e92b73549c6c945c7e5
|
/Source/Nuclex/Audio/Sound.cpp
|
820fe67d5a3218f4b22adc2acb3a488047e38e56
|
[] |
no_license
|
dzw/stellarengine
|
2b70ddefc2827be4f44ec6082201c955788a8a16
|
2a0a7db2e43c7c3519e79afa56db247f9708bc26
|
refs/heads/master
| 2016-09-01T21:12:36.888921 | 2008-12-12T12:40:37 | 2008-12-12T12:40:37 | 36,939,169 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 898 |
cpp
|
// //
// # # ### # # -= Nuclex Library =- //
// ## # # # ## ## Sound.cpp - Active sound //
// ### # # ### //
// # ### # ### Controls a sound while it is playing //
// # ## # # ## ## //
// # # ### # # R1 (C)2002-2004 Markus Ewald -> License.txt //
// //
#include "Nuclex/Audio/Sound.h"
using namespace Nuclex;
using namespace Nuclex::Audio;
|
[
"[email protected]"
] |
[
[
[
1,
12
]
]
] |
79421bd59d7e0e2f24ba8a1289984844f89bd1d2
|
67572b0f04e5bbc9e7204d093204d0739e589450
|
/src/params.cpp
|
4180bc03bfcdbb0cc579b45bc50997db509eae40
|
[
"MIT-0"
] |
permissive
|
vikram/pyodbc
|
b4e9e35a5d310a550b807618c9ff06536ea4805d
|
0895a249ece7f845150e84948a40590444a62994
|
refs/heads/master
| 2021-01-18T03:01:19.707313 | 2011-07-21T08:22:18 | 2011-07-21T08:22:18 | 1,777,004 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 23,392 |
cpp
|
#include "pyodbc.h"
#include "pyodbcmodule.h"
#include "params.h"
#include "cursor.h"
#include "connection.h"
#include "buffer.h"
#include "wrapper.h"
#include "errors.h"
#include "dbspecific.h"
#include "sqlwchar.h"
inline Connection* GetConnection(Cursor* cursor)
{
return (Connection*)cursor->cnxn;
}
static bool GetParamType(Cursor* cur, Py_ssize_t iParam, SQLSMALLINT& type);
static void FreeInfos(ParamInfo* a, Py_ssize_t count)
{
for (Py_ssize_t i = 0; i < count; i++)
if (a[i].allocated)
pyodbc_free(a[i].ParameterValuePtr);
pyodbc_free(a);
}
#define _MAKESTR(n) case n: return #n
static const char* SqlTypeName(SQLSMALLINT n)
{
switch (n)
{
_MAKESTR(SQL_UNKNOWN_TYPE);
_MAKESTR(SQL_CHAR);
_MAKESTR(SQL_VARCHAR);
_MAKESTR(SQL_LONGVARCHAR);
_MAKESTR(SQL_NUMERIC);
_MAKESTR(SQL_DECIMAL);
_MAKESTR(SQL_INTEGER);
_MAKESTR(SQL_SMALLINT);
_MAKESTR(SQL_FLOAT);
_MAKESTR(SQL_REAL);
_MAKESTR(SQL_DOUBLE);
_MAKESTR(SQL_DATETIME);
_MAKESTR(SQL_WCHAR);
_MAKESTR(SQL_WVARCHAR);
_MAKESTR(SQL_WLONGVARCHAR);
_MAKESTR(SQL_TYPE_DATE);
_MAKESTR(SQL_TYPE_TIME);
_MAKESTR(SQL_TYPE_TIMESTAMP);
_MAKESTR(SQL_SS_TIME2);
_MAKESTR(SQL_SS_XML);
_MAKESTR(SQL_BINARY);
_MAKESTR(SQL_VARBINARY);
_MAKESTR(SQL_LONGVARBINARY);
}
return "unknown";
}
static const char* CTypeName(SQLSMALLINT n)
{
switch (n)
{
_MAKESTR(SQL_C_CHAR);
_MAKESTR(SQL_C_WCHAR);
_MAKESTR(SQL_C_LONG);
_MAKESTR(SQL_C_SHORT);
_MAKESTR(SQL_C_FLOAT);
_MAKESTR(SQL_C_DOUBLE);
_MAKESTR(SQL_C_NUMERIC);
_MAKESTR(SQL_C_DEFAULT);
_MAKESTR(SQL_C_DATE);
_MAKESTR(SQL_C_TIME);
_MAKESTR(SQL_C_TIMESTAMP);
_MAKESTR(SQL_C_TYPE_DATE);
_MAKESTR(SQL_C_TYPE_TIME);
_MAKESTR(SQL_C_TYPE_TIMESTAMP);
_MAKESTR(SQL_C_INTERVAL_YEAR);
_MAKESTR(SQL_C_INTERVAL_MONTH);
_MAKESTR(SQL_C_INTERVAL_DAY);
_MAKESTR(SQL_C_INTERVAL_HOUR);
_MAKESTR(SQL_C_INTERVAL_MINUTE);
_MAKESTR(SQL_C_INTERVAL_SECOND);
_MAKESTR(SQL_C_INTERVAL_YEAR_TO_MONTH);
_MAKESTR(SQL_C_INTERVAL_DAY_TO_HOUR);
_MAKESTR(SQL_C_INTERVAL_DAY_TO_MINUTE);
_MAKESTR(SQL_C_INTERVAL_DAY_TO_SECOND);
_MAKESTR(SQL_C_INTERVAL_HOUR_TO_MINUTE);
_MAKESTR(SQL_C_INTERVAL_HOUR_TO_SECOND);
_MAKESTR(SQL_C_INTERVAL_MINUTE_TO_SECOND);
_MAKESTR(SQL_C_BINARY);
_MAKESTR(SQL_C_BIT);
_MAKESTR(SQL_C_SBIGINT);
_MAKESTR(SQL_C_UBIGINT);
_MAKESTR(SQL_C_TINYINT);
_MAKESTR(SQL_C_SLONG);
_MAKESTR(SQL_C_SSHORT);
_MAKESTR(SQL_C_STINYINT);
_MAKESTR(SQL_C_ULONG);
_MAKESTR(SQL_C_USHORT);
_MAKESTR(SQL_C_UTINYINT);
_MAKESTR(SQL_C_GUID);
}
return "unknown";
}
static bool GetNullInfo(Cursor* cur, Py_ssize_t index, ParamInfo& info)
{
if (!GetParamType(cur, index, info.ParameterType))
return false;
info.ValueType = SQL_C_DEFAULT;
info.ColumnSize = 1;
info.StrLen_or_Ind = SQL_NULL_DATA;
return true;
}
static bool GetStringInfo(Cursor* cur, Py_ssize_t index, PyObject* param, ParamInfo& info)
{
Py_ssize_t len = PyString_GET_SIZE(param);
info.ValueType = SQL_C_CHAR;
info.ColumnSize = max(len, 1);
if (len <= cur->cnxn->varchar_maxlength)
{
info.ParameterType = SQL_VARCHAR;
info.StrLen_or_Ind = len;
info.ParameterValuePtr = PyString_AS_STRING(param);
}
else
{
// Too long to pass all at once, so we'll provide the data at execute.
info.ParameterType = SQL_LONGVARCHAR;
info.StrLen_or_Ind = SQL_LEN_DATA_AT_EXEC((SQLLEN)len);
info.ParameterValuePtr = param;
}
return true;
}
static bool GetUnicodeInfo(Cursor* cur, Py_ssize_t index, PyObject* param, ParamInfo& info)
{
Py_UNICODE* pch = PyUnicode_AsUnicode(param);
Py_ssize_t len = PyUnicode_GET_SIZE(param);
info.ValueType = SQL_C_WCHAR;
info.ColumnSize = max(len, 1);
if (len <= cur->cnxn->wvarchar_maxlength)
{
#if SQLWCHAR_SIZE == Py_UNICODE_SIZE
info.ParameterValuePtr = pch;
#else
// SQLWCHAR and Py_UNICODE are not the same size, so we need to allocate and copy a buffer.
if (len > 0)
{
info.ParameterValuePtr = SQLWCHAR_FromUnicode(pch, len);
if (info.ParameterValuePtr == 0)
return false;
info.allocated = true;
}
else
{
info.ParameterValuePtr = pch;
}
#endif
info.ParameterType = SQL_WVARCHAR;
info.StrLen_or_Ind = len * sizeof(SQLWCHAR);
}
else
{
// Too long to pass all at once, so we'll provide the data at execute.
info.ParameterType = SQL_WLONGVARCHAR;
info.StrLen_or_Ind = SQL_LEN_DATA_AT_EXEC((SQLLEN)len);
info.ParameterValuePtr = param;
}
return true;
}
static bool GetBooleanInfo(Cursor* cur, Py_ssize_t index, PyObject* param, ParamInfo& info)
{
info.ValueType = SQL_C_BIT;
info.ParameterType = SQL_BIT;
info.StrLen_or_Ind = 1;
info.Data.ch = (unsigned char)(param == Py_True ? 1 : 0);
info.ParameterValuePtr = &info.Data.ch;
return true;
}
static bool GetDateTimeInfo(Cursor* cur, Py_ssize_t index, PyObject* param, ParamInfo& info)
{
info.Data.timestamp.year = (SQLSMALLINT) PyDateTime_GET_YEAR(param);
info.Data.timestamp.month = (SQLUSMALLINT)PyDateTime_GET_MONTH(param);
info.Data.timestamp.day = (SQLUSMALLINT)PyDateTime_GET_DAY(param);
info.Data.timestamp.hour = (SQLUSMALLINT)PyDateTime_DATE_GET_HOUR(param);
info.Data.timestamp.minute = (SQLUSMALLINT)PyDateTime_DATE_GET_MINUTE(param);
info.Data.timestamp.second = (SQLUSMALLINT)PyDateTime_DATE_GET_SECOND(param);
// SQL Server chokes if the fraction has more data than the database supports. We expect other databases to be the
// same, so we reduce the value to what the database supports. http://support.microsoft.com/kb/263872
int precision = ((Connection*)cur->cnxn)->datetime_precision - 20; // (20 includes a separating period)
if (precision <= 0)
{
info.Data.timestamp.fraction = 0;
}
else
{
info.Data.timestamp.fraction = (SQLUINTEGER)(PyDateTime_DATE_GET_MICROSECOND(param) * 1000); // 1000 == micro -> nano
// (How many leading digits do we want to keep? With SQL Server 2005, this should be 3: 123000000)
int keep = (int)pow(10.0, 9-min(9, precision));
info.Data.timestamp.fraction = info.Data.timestamp.fraction / keep * keep;
info.DecimalDigits = (SQLSMALLINT)precision;
}
info.ValueType = SQL_C_TIMESTAMP;
info.ParameterType = SQL_TIMESTAMP;
info.ColumnSize = ((Connection*)cur->cnxn)->datetime_precision;
info.StrLen_or_Ind = sizeof(TIMESTAMP_STRUCT);
info.ParameterValuePtr = &info.Data.timestamp;
return true;
}
static bool GetDateInfo(Cursor* cur, Py_ssize_t index, PyObject* param, ParamInfo& info)
{
info.Data.date.year = (SQLSMALLINT) PyDateTime_GET_YEAR(param);
info.Data.date.month = (SQLUSMALLINT)PyDateTime_GET_MONTH(param);
info.Data.date.day = (SQLUSMALLINT)PyDateTime_GET_DAY(param);
info.ValueType = SQL_C_TYPE_DATE;
info.ParameterType = SQL_TYPE_DATE;
info.ColumnSize = 10;
info.ParameterValuePtr = &info.Data.date;
info.StrLen_or_Ind = sizeof(DATE_STRUCT);
return true;
}
static bool GetTimeInfo(Cursor* cur, Py_ssize_t index, PyObject* param, ParamInfo& info)
{
info.Data.time.hour = (SQLUSMALLINT)PyDateTime_TIME_GET_HOUR(param);
info.Data.time.minute = (SQLUSMALLINT)PyDateTime_TIME_GET_MINUTE(param);
info.Data.time.second = (SQLUSMALLINT)PyDateTime_TIME_GET_SECOND(param);
info.ValueType = SQL_C_TYPE_TIME;
info.ParameterType = SQL_TYPE_TIME;
info.ColumnSize = 8;
info.ParameterValuePtr = &info.Data.time;
info.StrLen_or_Ind = sizeof(TIME_STRUCT);
return true;
}
static bool GetIntInfo(Cursor* cur, Py_ssize_t index, PyObject* param, ParamInfo& info)
{
info.Data.l = PyInt_AsLong(param);
info.ValueType = SQL_C_LONG;
info.ParameterType = SQL_INTEGER;
info.ParameterValuePtr = &info.Data.l;
return true;
}
static bool GetLongInfo(Cursor* cur, Py_ssize_t index, PyObject* param, ParamInfo& info)
{
// TODO: Overflow?
info.Data.i64 = (INT64)PyLong_AsLongLong(param);
info.ValueType = SQL_C_SBIGINT;
info.ParameterType = SQL_BIGINT;
info.ParameterValuePtr = &info.Data.i64;
return true;
}
static bool GetFloatInfo(Cursor* cur, Py_ssize_t index, PyObject* param, ParamInfo& info)
{
// TODO: Overflow?
info.Data.dbl = PyFloat_AsDouble(param);
info.ValueType = SQL_C_DOUBLE;
info.ParameterType = SQL_DOUBLE;
info.ParameterValuePtr = &info.Data.dbl;
info.ColumnSize = 15;
return true;
}
static char* CreateDecimalString(long sign, PyObject* digits, long exp)
{
long count = (long)PyTuple_GET_SIZE(digits);
char* pch;
long len;
if (exp >= 0)
{
// (1 2 3) exp = 2 --> '12300'
len = sign + count + exp + 1; // 1: NULL
pch = (char*)pyodbc_malloc(len);
if (pch)
{
char* p = pch;
if (sign)
*p++ = '-';
for (long i = 0; i < count; i++)
*p++ = (char)('0' + PyInt_AS_LONG(PyTuple_GET_ITEM(digits, i)));
for (long i = 0; i < exp; i++)
*p++ = '0';
*p = 0;
}
}
else if (-exp < count)
{
// (1 2 3) exp = -2 --> 1.23 : prec = 3, scale = 2
len = sign + count + 2; // 2: decimal + NULL
pch = (char*)pyodbc_malloc(len);
if (pch)
{
char* p = pch;
if (sign)
*p++ = '-';
int i = 0;
for (; i < (count + exp); i++)
*p++ = (char)('0' + PyInt_AS_LONG(PyTuple_GET_ITEM(digits, i)));
*p++ = '.';
for (; i < count; i++)
*p++ = (char)('0' + PyInt_AS_LONG(PyTuple_GET_ITEM(digits, i)));
*p++ = 0;
}
}
else
{
// (1 2 3) exp = -5 --> 0.00123 : prec = 5, scale = 5
len = sign + -exp + 3; // 3: leading zero + decimal + NULL
pch = (char*)pyodbc_malloc(len);
if (pch)
{
char* p = pch;
if (sign)
*p++ = '-';
*p++ = '0';
*p++ = '.';
for (int i = 0; i < -(exp + count); i++)
*p++ = '0';
for (int i = 0; i < count; i++)
*p++ = (char)('0' + PyInt_AS_LONG(PyTuple_GET_ITEM(digits, i)));
*p++ = 0;
}
}
I(pch == 0 || strlen(pch) + 1 == len);
return pch;
}
static bool GetDecimalInfo(Cursor* cur, Py_ssize_t index, PyObject* param, ParamInfo& info)
{
// The NUMERIC structure never works right with SQL Server and probably a lot of other drivers. We'll bind as a
// string. Unfortunately, the Decimal class doesn't seem to have a way to force it to return a string without
// exponents, so we'll have to build it ourselves.
Object t = PyObject_CallMethod(param, "as_tuple", 0);
if (!t)
return false;
long sign = PyInt_AsLong(PyTuple_GET_ITEM(t.Get(), 0));
PyObject* digits = PyTuple_GET_ITEM(t.Get(), 1);
long exp = PyInt_AsLong(PyTuple_GET_ITEM(t.Get(), 2));
Py_ssize_t count = PyTuple_GET_SIZE(digits);
info.ValueType = SQL_C_CHAR;
info.ParameterType = SQL_NUMERIC;
if (exp >= 0)
{
// (1 2 3) exp = 2 --> '12300'
info.ColumnSize = count + exp;
info.DecimalDigits = 0;
}
else if (-exp <= count)
{
// (1 2 3) exp = -2 --> 1.23 : prec = 3, scale = 2
info.ColumnSize = count;
info.DecimalDigits = (SQLSMALLINT)-exp;
}
else
{
// (1 2 3) exp = -5 --> 0.00123 : prec = 5, scale = 5
info.ColumnSize = count + (-exp);
info.DecimalDigits = (SQLSMALLINT)info.ColumnSize;
}
I(info.ColumnSize >= (SQLULEN)info.DecimalDigits);
info.ParameterValuePtr = CreateDecimalString(sign, digits, exp);
if (!info.ParameterValuePtr)
{
PyErr_NoMemory();
return false;
}
info.allocated = true;
info.StrLen_or_Ind = strlen((char*)info.ParameterValuePtr);
return true;
}
static bool GetBufferInfo(Cursor* cur, Py_ssize_t index, PyObject* param, ParamInfo& info)
{
info.ValueType = SQL_C_BINARY;
const char* pb;
Py_ssize_t cb = PyBuffer_GetMemory(param, &pb);
if (cb != -1 && cb <= cur->cnxn->binary_maxlength)
{
// There is one segment, so we can bind directly into the buffer object.
info.ParameterType = SQL_VARBINARY;
info.ParameterValuePtr = (SQLPOINTER)pb;
info.BufferLength = cb;
info.ColumnSize = max(cb, 1);
info.StrLen_or_Ind = cb;
}
else
{
// There are multiple segments, so we'll provide the data at execution time. Pass the PyObject pointer as
// the parameter value which will be pased back to us when the data is needed. (If we release threads, we
// need to up the refcount!)
info.ParameterType = SQL_LONGVARBINARY;
info.ParameterValuePtr = param;
info.ColumnSize = PyBuffer_Size(param);
info.BufferLength = sizeof(PyObject*); // How big is ParameterValuePtr; ODBC copies it and gives it back in SQLParamData
info.StrLen_or_Ind = SQL_LEN_DATA_AT_EXEC(PyBuffer_Size(param));
}
return true;
}
static bool GetParameterInfo(Cursor* cur, Py_ssize_t index, PyObject* param, ParamInfo& info)
{
// Binds the given parameter and populates `info`.
if (param == Py_None)
return GetNullInfo(cur, index, info);
if (PyString_Check(param))
return GetStringInfo(cur, index, param, info);
if (PyUnicode_Check(param))
return GetUnicodeInfo(cur, index, param, info);
if (PyBool_Check(param))
return GetBooleanInfo(cur, index, param, info);
if (PyDateTime_Check(param))
return GetDateTimeInfo(cur, index, param, info);
if (PyDate_Check(param))
return GetDateInfo(cur, index, param, info);
if (PyTime_Check(param))
return GetTimeInfo(cur, index, param, info);
if (PyInt_Check(param))
return GetIntInfo(cur, index, param, info);
if (PyLong_Check(param))
return GetLongInfo(cur, index, param, info);
if (PyFloat_Check(param))
return GetFloatInfo(cur, index, param, info);
if (PyDecimal_Check(param))
return GetDecimalInfo(cur, index, param, info);
if (PyBuffer_Check(param))
return GetBufferInfo(cur, index, param, info);
RaiseErrorV("HY105", ProgrammingError, "Invalid parameter type. param-index=%zd param-type=%s", index, param->ob_type->tp_name);
return false;
}
bool BindParameter(Cursor* cur, Py_ssize_t index, ParamInfo& info)
{
TRACE("BIND: param=%d ValueType=%d (%s) ParameterType=%d (%s) ColumnSize=%d DecimalDigits=%d BufferLength=%d *pcb=%d\n",
(index+1), info.ValueType, CTypeName(info.ValueType), info.ParameterType, SqlTypeName(info.ParameterType), info.ColumnSize,
info.DecimalDigits, info.BufferLength, info.StrLen_or_Ind);
SQLRETURN ret = -1;
Py_BEGIN_ALLOW_THREADS
ret = SQLBindParameter(cur->hstmt, (SQLUSMALLINT)(index + 1), SQL_PARAM_INPUT, info.ValueType, info.ParameterType, info.ColumnSize, info.DecimalDigits, info.ParameterValuePtr, info.BufferLength, &info.StrLen_or_Ind);
Py_END_ALLOW_THREADS;
if (GetConnection(cur)->hdbc == SQL_NULL_HANDLE)
{
// The connection was closed by another thread in the ALLOW_THREADS block above.
RaiseErrorV(0, ProgrammingError, "The cursor's connection was closed.");
return false;
}
if (!SQL_SUCCEEDED(ret))
{
RaiseErrorFromHandle("SQLBindParameter", GetConnection(cur)->hdbc, cur->hstmt);
return false;
}
return true;
}
void FreeParameterData(Cursor* cur)
{
// Unbinds the parameters and frees the parameter buffer.
if (cur->paramInfos)
{
// MS ODBC will crash if we use an HSTMT after the HDBC has been freed.
if (cur->cnxn->hdbc != SQL_NULL_HANDLE)
{
Py_BEGIN_ALLOW_THREADS
SQLFreeStmt(cur->hstmt, SQL_RESET_PARAMS);
Py_END_ALLOW_THREADS
}
FreeInfos(cur->paramInfos, cur->paramcount);
cur->paramInfos = 0;
}
}
void FreeParameterInfo(Cursor* cur)
{
// Internal function to free just the cached parameter information. This is not used by the general cursor code
// since this information is also freed in the less granular free_results function that clears everything.
Py_XDECREF(cur->pPreparedSQL);
pyodbc_free(cur->paramtypes);
cur->pPreparedSQL = 0;
cur->paramtypes = 0;
cur->paramcount = 0;
}
bool PrepareAndBind(Cursor* cur, PyObject* pSql, PyObject* original_params, bool skip_first)
{
//
// Normalize the parameter variables.
//
// Since we may replace parameters (we replace objects with Py_True/Py_False when writing to a bit/bool column),
// allocate an array and use it instead of the original sequence. Since we don't change ownership we don't bother
// with incref. (That is, PySequence_GetItem will INCREF and ~ObjectArrayHolder will DECREF.)
int params_offset = skip_first ? 1 : 0;
Py_ssize_t cParams = original_params == 0 ? 0 : PySequence_Length(original_params) - params_offset;
//
// Prepare the SQL if necessary.
//
if (pSql != cur->pPreparedSQL)
{
FreeParameterInfo(cur);
SQLRETURN ret;
SQLSMALLINT cParamsT = 0;
const char* szErrorFunc = "SQLPrepare";
if (PyString_Check(pSql))
{
TRACE("SQLPrepare(%s)\n", PyString_AS_STRING(pSql));
Py_BEGIN_ALLOW_THREADS
ret = SQLPrepare(cur->hstmt, (SQLCHAR*)PyString_AS_STRING(pSql), SQL_NTS);
if (SQL_SUCCEEDED(ret))
{
szErrorFunc = "SQLNumParams";
ret = SQLNumParams(cur->hstmt, &cParamsT);
}
Py_END_ALLOW_THREADS
}
else
{
SQLWChar sql(pSql);
Py_BEGIN_ALLOW_THREADS
ret = SQLPrepareW(cur->hstmt, sql, SQL_NTS);
if (SQL_SUCCEEDED(ret))
{
szErrorFunc = "SQLNumParams";
ret = SQLNumParams(cur->hstmt, &cParamsT);
}
Py_END_ALLOW_THREADS
}
if (cur->cnxn->hdbc == SQL_NULL_HANDLE)
{
// The connection was closed by another thread in the ALLOW_THREADS block above.
RaiseErrorV(0, ProgrammingError, "The cursor's connection was closed.");
return false;
}
if (!SQL_SUCCEEDED(ret))
{
RaiseErrorFromHandle(szErrorFunc, GetConnection(cur)->hdbc, cur->hstmt);
return false;
}
cur->paramcount = (int)cParamsT;
cur->pPreparedSQL = pSql;
Py_INCREF(cur->pPreparedSQL);
}
if (cParams != cur->paramcount)
{
RaiseErrorV(0, ProgrammingError, "The SQL contains %d parameter markers, but %d parameters were supplied",
cur->paramcount, cParams);
return false;
}
cur->paramInfos = (ParamInfo*)pyodbc_malloc(sizeof(ParamInfo) * cParams);
if (cur->paramInfos == 0)
{
PyErr_NoMemory();
return 0;
}
memset(cur->paramInfos, 0, sizeof(ParamInfo) * cParams);
// Since you can't call SQLDesribeParam *after* calling SQLBindParameter, we'll loop through all of the
// GetParameterInfos first, then bind.
for (Py_ssize_t i = 0; i < cParams; i++)
{
PyObject* param = PySequence_GetItem(original_params, i + params_offset);
if (!GetParameterInfo(cur, i, param, cur->paramInfos[i]))
{
FreeInfos(cur->paramInfos, cParams);
cur->paramInfos = 0;
return false;
}
}
for (Py_ssize_t i = 0; i < cParams; i++)
{
if (!BindParameter(cur, i, cur->paramInfos[i]))
{
FreeInfos(cur->paramInfos, cParams);
cur->paramInfos = 0;
return false;
}
}
return true;
}
static bool GetParamType(Cursor* cur, Py_ssize_t index, SQLSMALLINT& type)
{
// Returns the ODBC type of the of given parameter.
//
// Normally we set the parameter type based on the parameter's Python object type (e.g. str --> SQL_CHAR), so this
// is only called when the parameter is None. In that case, we can't guess the type and have to use
// SQLDescribeParam.
//
// If the database doesn't support SQLDescribeParam, we return SQL_VARCHAR since it converts to most other types.
// However, it will not usually work if the target column is a binary column.
if (!GetConnection(cur)->supports_describeparam || cur->paramcount == 0)
{
type = SQL_VARCHAR;
return true;
}
if (cur->paramtypes == 0)
{
cur->paramtypes = reinterpret_cast<SQLSMALLINT*>(pyodbc_malloc(sizeof(SQLSMALLINT) * cur->paramcount));
if (cur->paramtypes == 0)
{
PyErr_NoMemory();
return false;
}
// SQL_UNKNOWN_TYPE is zero, so zero out all columns since we haven't looked any up yet.
memset(cur->paramtypes, 0, sizeof(SQLSMALLINT) * cur->paramcount);
}
if (cur->paramtypes[index] == SQL_UNKNOWN_TYPE)
{
SQLULEN ParameterSizePtr;
SQLSMALLINT DecimalDigitsPtr;
SQLSMALLINT NullablePtr;
SQLRETURN ret;
Py_BEGIN_ALLOW_THREADS
ret = SQLDescribeParam(cur->hstmt, (SQLUSMALLINT)(index + 1), &cur->paramtypes[index], &ParameterSizePtr, &DecimalDigitsPtr, &NullablePtr);
Py_END_ALLOW_THREADS
if (!SQL_SUCCEEDED(ret))
{
// This can happen with ("select ?", None). We'll default to VARCHAR which works with most types.
cur->paramtypes[index] = SQL_VARCHAR;
}
}
type = cur->paramtypes[index];
return true;
}
|
[
"[email protected]",
"[email protected]"
] |
[
[
[
1,
551
],
[
553,
572
],
[
574,
577
],
[
580,
584
],
[
590,
596
],
[
602,
613
],
[
615,
617
],
[
619,
623
],
[
631,
676
],
[
678,
682
],
[
684,
685
],
[
687,
691
],
[
694,
698
],
[
702,
716
]
],
[
[
552,
552
],
[
573,
573
],
[
578,
579
],
[
585,
589
],
[
597,
601
],
[
614,
614
],
[
618,
618
],
[
624,
630
],
[
677,
677
],
[
683,
683
],
[
686,
686
],
[
692,
693
],
[
699,
701
]
]
] |
9eae9f1cf9946541a00e6e9b770dbc666defd99d
|
df238aa31eb8c74e2c208188109813272472beec
|
/BCGInclude/BCGPWinXPVisualManager.h
|
b7b67dcdefdb5f5b41b698b42da4d1388de104bb
|
[] |
no_license
|
myme5261314/plugin-system
|
d3166f36972c73f74768faae00ac9b6e0d58d862
|
be490acba46c7f0d561adc373acd840201c0570c
|
refs/heads/master
| 2020-03-29T20:00:01.155206 | 2011-06-27T15:23:30 | 2011-06-27T15:23:30 | 39,724,191 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 11,770 |
h
|
//*******************************************************************************
// COPYRIGHT NOTES
// ---------------
// This is a part of the BCGControlBar Library
// Copyright (C) 1998-2008 BCGSoft Ltd.
// All rights reserved.
//
// This source code can be used, distributed or modified
// only under terms and conditions
// of the accompanying license agreement.
//*******************************************************************************
// BCGWinXPVisualManager.h: interface for the CBCGPWinXPVisualManager class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_BCGPWINXPVISUALMANAGER_H__0795BCE7_8E67_4145_A840_D9655AC0293D__INCLUDED_)
#define AFX_BCGPWINXPVISUALMANAGER_H__0795BCE7_8E67_4145_A840_D9655AC0293D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "BCGCBPro.h"
#include "BCGPVisualManagerXP.h"
#include "BCGGlobals.h"
class CBCGPButton;
class BCGCBPRODLLEXPORT CBCGPWinXPVisualManager : public CBCGPVisualManagerXP
{
DECLARE_DYNCREATE(CBCGPWinXPVisualManager)
public:
CBCGPWinXPVisualManager(BOOL bIsTemporary = FALSE);
virtual ~CBCGPWinXPVisualManager();
static BOOL IsWinXPThemeAvailible ();
void SetOfficeStyleMenus (BOOL bOn = TRUE);
BOOL IsOfficeStyleMenus () const
{
return m_bOfficeStyleMenus;
}
static BOOL m_b3DTabsXPTheme;
virtual BOOL IsWinXPThemeSupported () const { return m_hThemeWindow != NULL; }
virtual void OnUpdateSystemColors ();
virtual int GetPopupMenuGap () const
{
return m_bOfficeStyleMenus ? 0 : 1;
}
virtual void OnFillBarBackground (CDC* pDC, CBCGPBaseControlBar* pBar,
CRect rectClient, CRect rectClip,
BOOL bNCArea = FALSE);
virtual void OnDrawBarBorder (CDC* pDC, CBCGPBaseControlBar* pBar, CRect& rect);
virtual void OnDrawBarGripper (CDC* pDC, CRect rectGripper, BOOL bHorz, CBCGPBaseControlBar* pBar);
virtual void OnDrawSeparator (CDC* pDC, CBCGPBaseControlBar* pBar, CRect rect, BOOL bIsHoriz);
virtual void OnDrawCaptionButton (CDC* pDC, CBCGPCaptionButton* pButton, BOOL bActive, BOOL bHorz,
BOOL bMaximized, BOOL bDisabled, int nImageID = -1);
virtual COLORREF OnDrawControlBarCaption (CDC* pDC, CBCGPDockingControlBar* pBar,
BOOL bActive, CRect rectCaption, CRect rectButtons);
virtual void OnDrawCaptionButtonIcon (CDC* pDC,
CBCGPCaptionButton* pButton,
CBCGPMenuImages::IMAGES_IDS id,
BOOL bActive, BOOL bDisabled,
CPoint ptImage);
virtual void OnDrawMenuSystemButton (CDC* pDC, CRect rect, UINT uiSystemCommand,
UINT nStyle, BOOL bHighlight);
virtual void OnDrawStatusBarPaneBorder (CDC* pDC, CBCGPStatusBar* pBar,
CRect rectPane, UINT uiID, UINT nStyle);
virtual void OnDrawStatusBarProgress (CDC* pDC, CBCGPStatusBar* pStatusBar,
CRect rectProgress, int nProgressTotal, int nProgressCurr,
COLORREF clrBar, COLORREF clrProgressBarDest, COLORREF clrProgressText,
BOOL bProgressText);
virtual void OnDrawStatusBarSizeBox (CDC* pDC, CBCGPStatusBar* pStatBar,
CRect rectSizeBox);
virtual void OnDrawMenuBorder (CDC* pDC, CBCGPPopupMenu* pMenu, CRect rect);
virtual void OnDrawComboDropButton (CDC* pDC, CRect rect,
BOOL bDisabled,
BOOL bIsDropped,
BOOL bIsHighlighted,
CBCGPToolbarComboBoxButton* pButton);
virtual void OnDrawComboBorder (CDC* pDC, CRect rect,
BOOL bDisabled,
BOOL bIsDropped,
BOOL bIsHighlighted,
CBCGPToolbarComboBoxButton* pButton);
virtual void OnDrawEditBorder (CDC* pDC, CRect rect,
BOOL bDisabled,
BOOL bIsHighlighted,
CBCGPToolbarEditBoxButton* pButton);
virtual void OnDrawTearOffCaption (CDC* pDC, CRect rect, BOOL bIsActive);
virtual COLORREF GetToolbarButtonTextColor (CBCGPToolbarButton* pButton,
CBCGPVisualManager::BCGBUTTON_STATE state);
virtual void OnFillButtonInterior (CDC* pDC,
CBCGPToolbarButton* pButton, CRect rect, CBCGPVisualManager::BCGBUTTON_STATE state);
virtual void OnDrawButtonBorder (CDC* pDC,
CBCGPToolbarButton* pButton, CRect rect, CBCGPVisualManager::BCGBUTTON_STATE state);
virtual void OnFillMenuImageRect (CDC* pDC,
CBCGPToolbarButton* pButton, CRect rect, CBCGPVisualManager::BCGBUTTON_STATE state);
virtual void OnDrawButtonSeparator (CDC* pDC,
CBCGPToolbarButton* pButton, CRect rect, CBCGPVisualManager::BCGBUTTON_STATE state,
BOOL bHorz);
virtual void OnHighlightMenuItem (CDC *pDC, CBCGPToolbarMenuButton* pButton,
CRect rect, COLORREF& clrText);
virtual COLORREF GetHighlightedMenuItemTextColor (CBCGPToolbarMenuButton* pButton);
virtual void OnHighlightRarelyUsedMenuItems (CDC* pDC, CRect rectRarelyUsed);
virtual BOOL IsHighlightWholeMenuItem () { return m_bOfficeStyleMenus || m_hThemeMenu != NULL; }
// Tab control:
virtual void OnDrawTab (CDC* pDC, CRect rectTab,
int iTab, BOOL bIsActive, const CBCGPBaseTabWnd* pTabWnd);
virtual void OnDrawTabCloseButton (CDC* pDC, CRect rect,
const CBCGPBaseTabWnd* pTabWnd,
BOOL bIsHighlighted,
BOOL bIsPressed,
BOOL bIsDisabled);
virtual void OnEraseTabsButton (CDC* pDC, CRect rect,
CBCGPButton* pButton,
CBCGPBaseTabWnd* pWndTab);
virtual void OnDrawTabsButtonBorder (CDC* pDC, CRect& rect,
CBCGPButton* pButton, UINT uiState,
CBCGPBaseTabWnd* pWndTab);
virtual BOOL AlwaysHighlight3DTabs () const { return m_hThemeTab != NULL; }
virtual void OnEraseTabsArea (CDC* pDC, CRect rect, const CBCGPBaseTabWnd* pTabWnd);
virtual BOOL OnEraseTabsFrame (CDC* pDC, CRect rect, const CBCGPBaseTabWnd* pTabWnd);
// Miniframe
virtual COLORREF OnFillMiniFrameCaption (CDC* pDC, CRect rectCaption,
CBCGPMiniFrameWnd* pFrameWnd,
BOOL bActive);
virtual void OnDrawMiniFrameBorder (CDC* pDC, CBCGPMiniFrameWnd* pFrameWnd,
CRect rectBorder, CRect rectBorderSize);
virtual void OnDrawFloatingToolbarBorder ( CDC* pDC, CBCGPBaseToolBar* pToolBar,
CRect rectBorder, CRect rectBorderSize);
virtual int GetDockingBarCaptionExtraHeight () const
{
return globalData.bIsWindowsVista ? 0 : 3;
}
// Outlook bar page buttons:
virtual void OnFillOutlookPageButton ( CDC* pDC, const CRect& rect,
BOOL bIsHighlighted, BOOL bIsPressed,
COLORREF& clrText);
virtual void OnDrawOutlookPageButtonBorder (CDC* pDC,
CRect& rectBtn, BOOL bIsHighlighted, BOOL bIsPressed);
// Customization dialog:
virtual COLORREF OnFillCommandsListBackground (CDC* pDC, CRect rect, BOOL bIsSelected = FALSE);
virtual CSize GetButtonExtraBorder () const;
virtual CSize GetCaptionButtonExtraBorder () const;
virtual void OnDrawHeaderCtrlBorder (CBCGPHeaderCtrl* pCtrl, CDC* pDC,
CRect& rect, BOOL bIsPressed, BOOL bIsHighlighted);
virtual void OnDrawHeaderCtrlSortArrow (CBCGPHeaderCtrl* pCtrl, CDC* pDC, CRect& rect, BOOL bIsUp);
// Tasks pane:
#ifndef BCGP_EXCLUDE_TASK_PANE
virtual void OnFillTasksPaneBackground(CDC* pDC, CRect rectWorkArea);
virtual void OnDrawTasksGroupCaption(CDC* pDC, CBCGPTasksGroup* pGroup,
BOOL bIsHighlighted = FALSE, BOOL bIsSelected = FALSE,
BOOL bCanCollapse = FALSE);
virtual void OnFillTasksGroupInterior(CDC* pDC, CRect rect, BOOL bSpecial = FALSE);
virtual void OnDrawTasksGroupAreaBorder(CDC* pDC, CRect rect, BOOL bSpecial = FALSE,
BOOL bNoTitle = FALSE);
virtual void OnDrawTask(CDC* pDC, CBCGPTask* pTask, CImageList* pIcons,
BOOL bIsHighlighted = FALSE, BOOL bIsSelected = FALSE);
virtual void OnDrawScrollButtons(CDC* pDC, const CRect& rect, const int nBorderSize,
int iImage, BOOL bHilited);
#endif
virtual void OnDrawExpandingBox (CDC* pDC, CRect rect, BOOL bIsOpened, COLORREF colorBox);
virtual void OnDrawControlBorder (CDC* pDC, CRect rect, CWnd* pWndCtrl, BOOL bDrawOnGlass);
// Date/time controls:
virtual void GetCalendarColors (const CBCGPCalendar* pCalendar,
CBCGPCalendarColors& colors);
virtual void OnDrawCheckBoxEx (CDC *pDC, CRect rect,
int nState,
BOOL bHighlighted,
BOOL bPressed,
BOOL bEnabled);
virtual void OnDrawRadioButton (CDC *pDC, CRect rect,
BOOL bOn,
BOOL bHighlighted,
BOOL bPressed,
BOOL bEnabled);
virtual BOOL IsOfficeXPStyleMenus () const
{
return m_bOfficeStyleMenus;
}
virtual BOOL DrawPushButtonWinXP (CDC* pDC, CRect rect, CBCGPButton* pButton, UINT uiState)
{
return DrawPushButton (pDC, rect, pButton, uiState);
}
virtual BOOL DrawComboDropButtonWinXP (CDC* pDC, CRect rect,
BOOL bDisabled,
BOOL bIsDropped,
BOOL bIsHighlighted)
{
return DrawComboDropButton (pDC, rect,
bDisabled,
bIsDropped,
bIsHighlighted);
}
virtual BOOL DrawComboBorderWinXP (CDC* pDC, CRect rect,
BOOL bDisabled,
BOOL bIsDropped,
BOOL bIsHighlighted)
{
return DrawComboBorder (pDC, rect,
bDisabled,
bIsDropped,
bIsHighlighted);
}
// Calculator:
virtual BOOL OnDrawCalculatorButton (CDC* pDC, CRect rect, CBCGPToolbarButton* pButton, CBCGPVisualManager::BCGBUTTON_STATE state, int cmd /* CBCGPCalculator::CalculatorCommands */, CBCGPCalculator* pCalculator);
// Edit box:
virtual BOOL OnDrawBrowseButton (CDC* pDC, CRect rect, CBCGPEdit* pEdit, CBCGPVisualManager::BCGBUTTON_STATE state, COLORREF& clrText);
virtual void OnDrawSpinButtons (CDC* pDC, CRect rectSpin, int nState, BOOL bOrientation, CBCGPSpinButtonCtrl* pSpinCtrl);
// Popup window:
#ifndef BCGP_EXCLUDE_POPUP_WINDOW
virtual void OnErasePopupWindowButton (CDC* pDC, CRect rectClient, CBCGPPopupWndButton* pButton);
virtual void OnDrawPopupWindowButtonBorder (CDC* pDC, CRect rectClient, CBCGPPopupWndButton* pButton);
virtual BOOL IsDefaultWinXPPopupButton (CBCGPPopupWndButton* pButton) const;
#endif
// Grid control:
#ifndef BCGP_EXCLUDE_GRID_CTRL
virtual void OnFillGridHeaderBackground (CBCGPGridCtrl* pCtrl, CDC* pDC, CRect rect);
virtual BOOL OnDrawGridHeaderItemBorder (CBCGPGridCtrl* pCtrl, CDC* pDC, CRect rect, BOOL bPressed);
virtual void OnDrawGridHeaderMenuButton (CBCGPGridCtrl* pCtrl, CDC* pDC, CRect rect,
BOOL bHighlighted, BOOL bPressed, BOOL bDisabled);
#endif
// Gantt control:
#ifndef BCGP_EXCLUDE_GANTT
virtual void DrawGanttHeaderCell (const CBCGPGanttChart* pChart, CDC& dc, const BCGP_GANTT_CHART_HEADER_CELL_INFO& cellInfo, BOOL bHilite);
virtual void FillGanttBar (const CBCGPGanttItem* pItem, CDC& dc, const CRect& rectFill, COLORREF color, double dGlowLine);
#endif // BCGP_EXCLUDE_GANTT
#ifndef BCGP_EXCLUDE_TOOLBOX
virtual BOOL OnEraseToolBoxButton (CDC* pDC, CRect rect, CBCGPToolBoxButton* pButton);
virtual BOOL OnDrawToolBoxButtonBorder (CDC* pDC, CRect& rect, CBCGPToolBoxButton* pButton, UINT uiState);
#endif
// Push button:
virtual BOOL OnDrawPushButton (CDC* pDC, CRect rect, CBCGPButton* pButton, COLORREF& clrText);
#ifndef BCGP_EXCLUDE_RIBBON
// Ribbon control:
virtual void OnDrawRibbonProgressBar (
CDC* pDC, CBCGPRibbonProgressBar* pProgress,
CRect rectProgress, CRect rectChunk, BOOL bInfiniteMode);
#endif
protected:
BOOL m_bOfficeStyleMenus;
COLORREF m_clrCalendarCaption;
COLORREF m_clrCalendarCaptionText;
};
#endif // !defined(AFX_BCGPWINXPVISUALMANAGER_H__0795BCE7_8E67_4145_A840_D9655AC0293D__INCLUDED_)
|
[
"myme5261314@ec588229-7da7-b333-41f6-0e1ebc3afda5"
] |
[
[
[
1,
295
]
]
] |
9f96f336281589c2de6ef39c43228db3c53db696
|
a96b15c6a02225d27ac68a7ed5f8a46bddb67544
|
/SetGame/GazaFrameSheetCollection.hpp
|
07568e79e862905a7f75e7ae525ab4e64cd2cf8d
|
[] |
no_license
|
joelverhagen/Gaza-2D-Game-Engine
|
0dca1549664ff644f61fe0ca45ea6efcbad54591
|
a3fe5a93e5d21a93adcbd57c67c888388b402938
|
refs/heads/master
| 2020-05-15T05:08:38.412819 | 2011-04-03T22:22:01 | 2011-04-03T22:22:01 | 1,519,417 | 3 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,152 |
hpp
|
#ifndef GAZAFRAMESHEETCOLLECTION_HPP
#define GAZAFRAMESHEETCOLLECTION_HPP
#include "Gaza.hpp"
#include "GazaFrameSheet.hpp"
#include "GazaFrame.hpp"
#include <string>
#include <vector>
namespace Gaza
{
class FrameSheetCollection
{
public:
FrameSheetCollection();
~FrameSheetCollection();
void addFrameSheet(FrameSheet * frameSheet);
Frame * getFrame(const std::string &name);
std::vector<Frame *> getAnimationFrameList(const std::string &name);
bool addAnimationFrameList(const std::string &name, const std::vector<Frame *> &frames);
bool addAnimationFrameList(const std::string &name, const std::vector<std::string> &frameNames);
bool newAnimationFrameList(const std::string &name);
bool addAnimationFrame(const std::string &name, Frame * frame);
bool addAnimationFrame(const std::string &name, const std::string &frameName);
int getFrameSheetCount();
int getFrameCount();
std::vector<std::string> getFrameNames();
void clearFrameSheets();
private:
std::vector<FrameSheet *> frameSheets;
std::map<std::string, std::vector<Frame *> > animationFrameLists;
};
}
#endif
|
[
"[email protected]"
] |
[
[
[
1,
41
]
]
] |
b51d18459f2d5ab166df3072548b915e387e5e83
|
8b68ff41fd39c9cf20d27922bb9f8b9d2a1c68e9
|
/TWL/include/util/ffutil.h
|
b723c14598ba5cefc2396d1a6573c7909321f763
|
[] |
no_license
|
dandycheung/dandy-twl
|
2ec6d500273b3cb7dd6ab9e5a3412740d73219ae
|
991220b02f31e4ec82760ece9cd974103c7f9213
|
refs/heads/master
| 2020-12-24T15:06:06.260650 | 2009-05-20T14:46:07 | 2009-05-20T14:46:07 | 32,625,192 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 6,788 |
h
|
#ifndef __FFUTIL_H__
#define __FFUTIL_H__
#ifndef UNUSED_ALWAYS
#define UNUSED_ALWAYS(x) x
#endif // UNUSED_ALWAYS
class CFileFind
{
public:
CFileFind()
{
m_pFoundInfo = NULL;
m_pNextInfo = NULL;
m_hContext = NULL;
m_pszRoot = NULL;
m_chDirSeparator = TEXT('\\');
}
virtual ~CFileFind()
{
Close();
}
// Attributes
public:
DWORD GetLength() const
{
ASSERT(m_hContext != NULL);
if(m_pFoundInfo != NULL)
return ((LPWIN32_FIND_DATA)m_pFoundInfo)->nFileSizeLow;
return 0;
}
#if defined(_X86_) || defined(_ALPHA_)
__int64 GetLength64() const
{
ASSERT(m_hContext != NULL);
if(m_pFoundInfo != NULL)
return ((LPWIN32_FIND_DATA)m_pFoundInfo)->nFileSizeLow +
(((LPWIN32_FIND_DATA)m_pFoundInfo)->nFileSizeHigh << 32);
return 0;
}
#endif
virtual LPCTSTR GetFileName() const
{
ASSERT(m_hContext != NULL);
if(m_pFoundInfo != NULL)
return ((LPWIN32_FIND_DATA)m_pFoundInfo)->cFileName;
return NULL;
}
virtual BOOL GetFilePath(LPTSTR pszPath, PDWORD pdwPath) const
{
ASSERT(m_hContext != NULL);
if(pdwPath == NULL)
return FALSE;
DWORD dwLengthRoot = lstrlen(m_pszRoot);
DWORD dwLength = dwLengthRoot;
if(m_pszRoot[dwLength - 1] != TEXT('\\') && m_pszRoot[dwLength - 1] != TEXT('/'))
dwLength++;
dwLength += lstrlen(GetFileName());
dwLength++; // for NULL terminator
if(*pdwPath < dwLength)
{
*pdwPath = dwLength;
return FALSE;
}
lstrcpy(pszPath, m_pszRoot);
if(m_pszRoot[dwLengthRoot - 1] != TEXT('\\') && m_pszRoot[dwLengthRoot - 1] != TEXT('/'))
{
pszPath[dwLengthRoot] = m_chDirSeparator;
pszPath[dwLengthRoot + 1] = TEXT('\0');
}
lstrcat(pszPath, GetFileName());
*pdwPath = dwLength;
return TRUE;
}
virtual LPCTSTR GetRoot() const
{
ASSERT(m_hContext != NULL);
return m_pszRoot;
}
virtual BOOL GetLastWriteTime(FILETIME* pTimeStamp) const
{
ASSERT(m_hContext != NULL);
ASSERT(pTimeStamp != NULL);
if(m_pFoundInfo != NULL && pTimeStamp != NULL)
{
*pTimeStamp = ((LPWIN32_FIND_DATA)m_pFoundInfo)->ftLastWriteTime;
return TRUE;
}
return FALSE;
}
virtual BOOL GetLastAccessTime(FILETIME* pTimeStamp) const
{
ASSERT(m_hContext != NULL);
ASSERT(pTimeStamp != NULL);
if(m_pFoundInfo != NULL && pTimeStamp != NULL)
{
*pTimeStamp = ((LPWIN32_FIND_DATA)m_pFoundInfo)->ftLastAccessTime;
return TRUE;
}
return FALSE;
}
virtual BOOL GetCreationTime(FILETIME* pTimeStamp) const
{
ASSERT(m_hContext != NULL);
if(m_pFoundInfo != NULL && pTimeStamp != NULL)
{
*pTimeStamp = ((LPWIN32_FIND_DATA)m_pFoundInfo)->ftCreationTime;
return TRUE;
}
return FALSE;
}
virtual BOOL MatchesMask(DWORD dwMask) const
{
ASSERT(m_hContext != NULL);
if(m_pFoundInfo != NULL)
return (!!(((LPWIN32_FIND_DATA)m_pFoundInfo)->dwFileAttributes & dwMask));
return FALSE;
}
virtual BOOL IsDots() const
{
ASSERT(m_hContext != NULL);
// return TRUE if the file name is "." or ".." and
// the file is a directory
BOOL bResult = FALSE;
if(m_pFoundInfo != NULL && IsDirectory())
{
LPWIN32_FIND_DATA pFindData = (LPWIN32_FIND_DATA)m_pFoundInfo;
if(pFindData->cFileName[0] == TEXT('.'))
{
if(pFindData->cFileName[1] == TEXT('\0') ||
(pFindData->cFileName[1] == TEXT('.') &&
pFindData->cFileName[2] == TEXT('\0')))
{
bResult = TRUE;
}
}
}
return bResult;
}
// these aren't virtual because they all use MatchesMask(), which is
BOOL IsReadOnly() const
{ return MatchesMask(FILE_ATTRIBUTE_READONLY); }
BOOL IsDirectory() const
{ return MatchesMask(FILE_ATTRIBUTE_DIRECTORY); }
BOOL IsCompressed() const
{ return MatchesMask(FILE_ATTRIBUTE_COMPRESSED); }
BOOL IsSystem() const
{ return MatchesMask(FILE_ATTRIBUTE_SYSTEM); }
BOOL IsHidden() const
{ return MatchesMask(FILE_ATTRIBUTE_HIDDEN); }
BOOL IsTemporary() const
{ return MatchesMask(FILE_ATTRIBUTE_TEMPORARY); }
BOOL IsNormal() const
{ return MatchesMask(FILE_ATTRIBUTE_NORMAL); }
BOOL IsArchived() const
{ return MatchesMask(FILE_ATTRIBUTE_ARCHIVE); }
// Operations
void Close()
{
if(m_pFoundInfo != NULL)
{
delete m_pFoundInfo;
m_pFoundInfo = NULL;
}
if(m_pNextInfo != NULL)
{
delete m_pNextInfo;
m_pNextInfo = NULL;
}
if(m_hContext != NULL && m_hContext != INVALID_HANDLE_VALUE)
{
CloseContext();
m_hContext = NULL;
}
if(m_pszRoot != NULL)
{
delete[] m_pszRoot;
m_pszRoot = NULL;
}
}
virtual BOOL FindFile(LPCTSTR pstrName = NULL, DWORD dwUnused = 0)
{
UNUSED_ALWAYS(dwUnused);
Close();
m_pNextInfo = new WIN32_FIND_DATA;
m_bGotLast = FALSE;
if(pstrName == NULL)
pstrName = _T("*.*");
lstrcpy(((LPWIN32_FIND_DATA)m_pNextInfo)->cFileName, pstrName);
m_hContext = ::FindFirstFile(pstrName, (LPWIN32_FIND_DATA)m_pNextInfo);
if(m_hContext == INVALID_HANDLE_VALUE)
{
DWORD dwTemp = ::GetLastError();
Close();
::SetLastError(dwTemp);
return FALSE;
}
m_pszRoot = new TCHAR[MAX_PATH];
if(m_pszRoot == NULL)
return FALSE;
LPTSTR pstrRoot = m_pszRoot;
#ifndef _WIN32_WCE
LPCTSTR pstr = _tfullpath(pstrRoot, pstrName, MAX_PATH);
#else
LPCTSTR pstr = lstrcpy(pstrRoot, pstrName);
#endif
// passed name isn't a valid path but was found by the API
ASSERT(pstr != NULL);
if(pstr == NULL)
{
Close();
::SetLastError(ERROR_INVALID_NAME);
return FALSE;
}
// find the last forward or backward whack
LPTSTR pstrBack = _tcsrchr(pstrRoot, _T('\\'));
LPTSTR pstrFront = _tcsrchr(pstrRoot, _T('/'));
if(pstrFront != NULL || pstrBack != NULL)
{
if(pstrFront == NULL)
pstrFront = pstrRoot;
if(pstrBack == NULL)
pstrBack = pstrRoot;
// from the start to the last whack is the root
if(pstrFront >= pstrBack)
*pstrFront = TEXT('\0');
else
*pstrBack = TEXT('\0');
}
return TRUE;
}
virtual BOOL FindNextFile()
{
ASSERT(m_hContext != NULL);
if(m_hContext == NULL)
return FALSE;
if(m_pFoundInfo == NULL)
m_pFoundInfo = new WIN32_FIND_DATA;
void* pTemp = m_pFoundInfo;
m_pFoundInfo = m_pNextInfo;
m_pNextInfo = pTemp;
return ::FindNextFile(m_hContext, (LPWIN32_FIND_DATA)m_pNextInfo);
}
protected:
virtual void CloseContext()
{
::FindClose(m_hContext);
}
// Implementation
protected:
void* m_pFoundInfo;
void* m_pNextInfo;
HANDLE m_hContext;
BOOL m_bGotLast;
LPTSTR m_pszRoot;
TCHAR m_chDirSeparator; // not '\\' for Internet classes
};
#endif // __FFUTIL_H__
|
[
"dandycheung@9b253700-4547-11de-82b9-170f4fd74ac7"
] |
[
[
[
1,
324
]
]
] |
4dcbec071d91425926c6452785211a9f0d562ff1
|
c9efecddc566c701b4b24b9d0997eb3cf929e5f5
|
/TestRec/TestRec/RuleManager.h
|
d6068fafb0b261ba9f2e64d9312d6603737224b9
|
[] |
no_license
|
vlalo001/metaballs3d
|
f8ee9404f28cda009654f8edf2f322c72d5bfe8a
|
a24fddce4ec73fc7348287e2074268cc2920cc2f
|
refs/heads/master
| 2021-01-20T16:56:20.721059 | 2009-07-24T16:33:36 | 2009-07-24T16:33:36 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 570 |
h
|
#pragma once
#include "Common.h"
#include "Rule.h"
#include "LuaManager.h"
// ------------------------------------
// RuleManager
// ------------------------------------
class RuleManager
{
public:
RuleManager();
~RuleManager();
Rule* CreateRule(const std::string& name);
Rule* GetRuleByName(const std::string& name);
void ReadFile(const std::string& path);
public:
static int Lua_CreateRule(lua_State* state);
static int Lua_AddRule(lua_State* state);
private:
std::vector<Rule*> m_rules;
LuaManager m_lua;
};
|
[
"garry.wls@99a8374a-4571-11de-aeda-3f4d37dfb5fa"
] |
[
[
[
1,
30
]
]
] |
b1dee5db197368801a87348dfbc5aa878b39466b
|
9ba08620ddc3579995435d6e0e9cabc436e1c88d
|
/src/ListBag.h
|
143005c6ccd821ed7736ffa46a16442e81be8518
|
[
"MIT"
] |
permissive
|
foxostro/CheeseTesseract
|
f5d6d7a280cbdddc94a5d57f32a50caf1f15e198
|
737ebbd19cee8f5a196bf39a11ca793c561e56cb
|
refs/heads/master
| 2021-01-01T17:31:27.189613 | 2009-08-02T13:27:20 | 2009-08-02T13:27:33 | 267,008 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 593 |
h
|
#ifndef LIST_BAG_H
#define LIST_BAG_H
#include "PropertyBag.h"
/** List of elements contained within a PropertyBag data source */
template<typename ElementType>
class ListBag : public vector<ElementType> {
public:
ListBag() { /* Do Nothing */ }
size_t size() const {
return vector<ElementType>::size();
}
const ElementType& at(size_t i) const {
return vector<ElementType>::at(i);
}
const ElementType& getRandom() const {
if (size()==1) {
return at(0);
} else {
size_t idx = IRAND_RANGE(0, size());
return at(idx);
}
}
};
#endif
|
[
"arfox@arfox-desktop"
] |
[
[
[
1,
30
]
]
] |
007f2ed0460771a0a114f35dbd15edaf507b8e67
|
6e563096253fe45a51956dde69e96c73c5ed3c18
|
/dhnetsdk/Demo/TransCom.cpp
|
33bcb2be62c32798a212e6a94bb8009eba3e5b9f
|
[] |
no_license
|
15831944/phoebemail
|
0931b76a5c52324669f902176c8477e3bd69f9b1
|
e10140c36153aa00d0251f94bde576c16cab61bd
|
refs/heads/master
| 2023-03-16T00:47:40.484758 | 2010-10-11T02:31:02 | 2010-10-11T02:31:02 | null | 0 | 0 | null | null | null | null |
GB18030
|
C++
| false | false | 6,351 |
cpp
|
// TransCom.cpp : implementation file
//
#include "stdafx.h"
#include "netsdkdemo.h"
#include "TransCom.h"
#include "NetSDKDemoDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTransCom dialog
CTransCom::CTransCom(CWnd* pParent /*=NULL*/)
: CDialog(CTransCom::IDD, pParent)
{
m_devHandle = 0;
//{{AFX_DATA_INIT(CTransCom)
m_recievestring = _T("");
m_sendstring = _T("");
//}}AFX_DATA_INIT
m_count = 0;
}
void CTransCom::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTransCom)
DDX_Control(pDX, IDC_COMSTOPBIT, m_stopbit);
DDX_Control(pDX, IDC_COMSEL, m_comsel);
DDX_Control(pDX, IDC_COMPARITY, m_parity);
DDX_Control(pDX, IDC_COMDATABIT, m_databit);
DDX_Control(pDX, IDC_BAUDRATE, m_baudrate);
DDX_Text(pDX, IDC_RECIEVERANGE, m_recievestring);
DDX_Text(pDX, IDC_EDITCOMSEND, m_sendstring);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTransCom, CDialog)
//{{AFX_MSG_MAP(CTransCom)
ON_BN_CLICKED(IDC_OPENCLOSE, OnOpenclose)
ON_BN_CLICKED(IDC_COMSEND, OnComsend)
ON_BN_CLICKED(IDC_DELETEREVICE, OnDeleterevice)
ON_BN_CLICKED(IDC_DELETESEND, OnDeletesend)
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTransCom message handlers
#define BAUDRATE_NUM 8
unsigned int Tbaudrate[BAUDRATE_NUM] = {1200,2400,4800,9600,19200,38400,57600,115200};
BOOL CTransCom::OnInitDialog()
{
g_SetWndStaticText(this);
int i;
CString strTemp;
CDialog::OnInitDialog();
//初始化com选择
m_comsel.InsertString(0, "com");
m_comsel.InsertString(1, "485");
m_comsel.SetItemData(0, 0);
m_comsel.SetItemData(1, 1);
m_comsel.SetCurSel(0);
//初始化波特率
for(i = 0; i < BAUDRATE_NUM; i++)
{
strTemp.Format(" %d",Tbaudrate[i]);
m_baudrate.InsertString(i, strTemp.GetBuffer(0));
m_baudrate.SetItemData(i, i +1); //设置值为1~8
}
m_baudrate.SetCurSel(3); //默认9600
//初始化数据位
for(i = 0; i < 5; i ++)
{
strTemp.Format(" %d ",i+4);
strTemp += ConvertString(MSG_TRANSCOM_DATABIT_BITS);
m_databit.InsertString(i,strTemp );
m_databit.SetItemData(i, (DWORD)(i+4));
}
m_databit.SetCurSel(4);
//初始化停止位
m_stopbit.InsertString(0, ConvertString(MSG_TRANSCOM_STOPBIT_1BIT ));
m_stopbit.InsertString(1, ConvertString(MSG_TRANSCOM_STOPBIT_15BITS ));
m_stopbit.InsertString(2, ConvertString(MSG_TRANSCOM_STOPBIT_2BITS ));
m_stopbit.SetItemData(0, 1);
m_stopbit.SetItemData(1, 2);
m_stopbit.SetItemData(2, 3);
m_stopbit.SetCurSel(0);
//初始化奇偶检验
m_parity.InsertString(0, ConvertString(MSG_TRANSCOM_PARITY_NO));
m_parity.InsertString(1, ConvertString(MSG_TRANSCOM_PARITY_ODD));
m_parity.InsertString(2, ConvertString(MSG_TRANSCOM_PARITY_EVEN));
m_parity.SetItemData(0, 3);
m_parity.SetItemData(1, 1);
m_parity.SetItemData(2, 2);
m_parity.SetCurSel(0);
m_isComOpen = FALSE;
m_comHandle = 0;
UpdataOpenCloseState();
return TRUE;
}
void CTransCom::UpdataOpenCloseState()
{
if(m_isComOpen)
{
GetDlgItem(IDC_OPENCLOSE)->SetWindowText(ConvertString(MSG_TRANSCOM_CLOSECOM));
}
else
{
GetDlgItem(IDC_OPENCLOSE)->SetWindowText(ConvertString(MSG_TRANSCOM_OPENCOM));
}
}
void CALLBACK TransComCB(LONG lLoginID, LONG lTransComChannel, char *pBuffer, DWORD dwBufSize, DWORD dwUser)
{
if(dwUser == 0)
{
return;
}
CTransCom *dlg = (CTransCom *)dwUser;
dlg->ComRecieveData(lLoginID, lTransComChannel,pBuffer, dwBufSize);
}
void CTransCom::ComRecieveData(LONG lLoginID, LONG lTransComChannel,char *pBuffer, DWORD dwBufSize)
{
if(lLoginID != m_devHandle || lTransComChannel != m_comHandle )
{
return;
}
char *tmp = new char[dwBufSize + 1];
memset(tmp, 0, dwBufSize + 1);
memcpy(tmp, pBuffer, dwBufSize);
CString strR;
strR.Format("%s",tmp);
m_recievestring += strR;
GetDlgItem(IDC_RECIEVERANGE)->SetWindowText(m_recievestring);
if (m_recievestring.GetLength() > 255)
{
m_recievestring.Empty();
}
delete[] tmp;
}
void CTransCom::OnOpenclose()
{
BOOL nRet = TRUE;
if(m_isComOpen) //已打开时执行关闭
{
if(m_comHandle)
{
nRet = CLIENT_DestroyTransComChannel(m_comHandle);
if(nRet)
{
m_comHandle = 0;
}
else if(!nRet)
{
((CNetSDKDemoDlg *)GetParent())->LastError();//Peng Dongfeng 06.11.24
}
}
}
else //打开操作
{
if(m_devHandle)
{
m_comHandle = CLIENT_CreateTransComChannel(m_devHandle,m_comsel.GetItemData(m_comsel.GetCurSel()),
m_baudrate.GetItemData(m_baudrate.GetCurSel()),m_databit.GetItemData(m_databit.GetCurSel()),
m_stopbit.GetItemData(m_stopbit.GetCurSel()),m_parity.GetItemData(m_parity.GetCurSel()),
TransComCB,(DWORD)this);
if(m_comHandle)
{
nRet = TRUE;
}
else
{
((CNetSDKDemoDlg *)GetParent())->LastError();//Peng Dongfeng 06.11.24
MessageBox(MSG_TRANSCOM_OPENTRANSCOMFAILED);
}
}
}
if(nRet)
{
m_isComOpen = !m_isComOpen;
}
else if(!nRet)
{
((CNetSDKDemoDlg *)GetParent())->LastError();//Peng Dongfeng 06.11.24
}
UpdataOpenCloseState();
}
void CTransCom::SetDeviceId(LONG nDeviceId)
{
m_devHandle = nDeviceId;
}
//发送
void CTransCom::OnComsend()
{
UpdateData();
if(m_isComOpen && m_comHandle)
{
BOOL ret = CLIENT_SendTransComData(m_comHandle, m_sendstring.GetBuffer(0), m_sendstring.GetLength());
if(!ret)
{
((CNetSDKDemoDlg *)GetParent())->LastError();//Peng Dongfeng 06.11.24
MessageBox(ConvertString(MSG_TRANSCOM_SENDDATAFAILED));
}
}
}
void CTransCom::OnDeleterevice()
{
m_recievestring.Empty() ;
UpdateData(FALSE);
}
void CTransCom::OnDeletesend()
{
m_sendstring.Empty();
UpdateData(false);
}
void CTransCom::OnClose()
{
if(m_isComOpen) //已打开时执行关闭
{
if(m_comHandle)
{
int nRet = CLIENT_DestroyTransComChannel(m_comHandle);
if(nRet)
{
m_comHandle = 0;
}
else if(!nRet)
{
((CNetSDKDemoDlg *)GetParent())->LastError();//Peng Dongfeng 06.11.24
}
}
}
CDialog::OnClose();
}
|
[
"guoqiao@a83c37f4-16cc-5f24-7598-dca3a346d5dd"
] |
[
[
[
1,
267
]
]
] |
958cb8289d3db64dbeeb2b38dd4f67874b766dea
|
4d5ee0b6f7be0c3841c050ed1dda88ec128ae7b4
|
/src/nvimage/DirectDrawSurface.h
|
12b430a686fbcfef99bef1d98a85810340ef80c1
|
[] |
no_license
|
saggita/nvidia-mesh-tools
|
9df27d41b65b9742a9d45dc67af5f6835709f0c2
|
a9b7fdd808e6719be88520e14bc60d58ea57e0bd
|
refs/heads/master
| 2020-12-24T21:37:11.053752 | 2010-09-03T01:39:02 | 2010-09-03T01:39:02 | 56,893,300 | 0 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 3,923 |
h
|
// Copyright NVIDIA Corporation 2007 -- Ignacio Castano <[email protected]>
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
#ifndef NV_IMAGE_DIRECTDRAWSURFACE_H
#define NV_IMAGE_DIRECTDRAWSURFACE_H
#include <nvimage/nvimage.h>
namespace nv
{
class Image;
class Stream;
struct ColorBlock;
struct NVIMAGE_CLASS DDSPixelFormat
{
uint size;
uint flags;
uint fourcc;
uint bitcount;
uint rmask;
uint gmask;
uint bmask;
uint amask;
};
struct NVIMAGE_CLASS DDSCaps
{
uint caps1;
uint caps2;
uint caps3;
uint caps4;
};
/// DDS file header for DX10.
struct NVIMAGE_CLASS DDSHeader10
{
uint dxgiFormat;
uint resourceDimension;
uint miscFlag;
uint arraySize;
uint reserved;
};
/// DDS file header.
struct NVIMAGE_CLASS DDSHeader
{
uint fourcc;
uint size;
uint flags;
uint height;
uint width;
uint pitch;
uint depth;
uint mipmapcount;
uint reserved[11];
DDSPixelFormat pf;
DDSCaps caps;
uint notused;
DDSHeader10 header10;
// Helper methods.
DDSHeader();
void setWidth(uint w);
void setHeight(uint h);
void setDepth(uint d);
void setMipmapCount(uint count);
void setTexture2D();
void setTexture3D();
void setTextureCube();
void setLinearSize(uint size);
void setPitch(uint pitch);
void setFourCC(uint8 c0, uint8 c1, uint8 c2, uint8 c3);
void setFormatCode(uint code);
void setSwizzleCode(uint8 c0, uint8 c1, uint8 c2, uint8 c3);
void setPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask);
void setDX10Format(uint format);
void setNormalFlag(bool b);
void swapBytes();
bool hasDX10Header() const;
};
NVIMAGE_API Stream & operator<< (Stream & s, DDSHeader & header);
/// DirectDraw Surface. (DDS)
class NVIMAGE_CLASS DirectDrawSurface
{
public:
DirectDrawSurface(const char * file);
~DirectDrawSurface();
bool isValid() const;
bool isSupported() const;
bool hasAlpha() const;
uint mipmapCount() const;
uint width() const;
uint height() const;
uint depth() const;
bool isTexture1D() const;
bool isTexture2D() const;
bool isTexture3D() const;
bool isTextureCube() const;
void setNormalFlag(bool b);
void mipmap(Image * img, uint f, uint m);
// void mipmap(FloatImage * img, uint f, uint m);
void printInfo() const;
private:
uint blockSize() const;
uint faceSize() const;
uint mipmapSize(uint m) const;
uint offset(uint f, uint m);
void readLinearImage(Image * img);
void readBlockImage(Image * img);
void readBlock(ColorBlock * rgba);
private:
Stream * const stream;
DDSHeader header;
DDSHeader10 header10;
};
} // nv namespace
#endif // NV_IMAGE_DIRECTDRAWSURFACE_H
|
[
"castano@0f2971b0-9fc2-11dd-b4aa-53559073bf4c"
] |
[
[
[
1,
159
]
]
] |
6591c9ca69cdf25e02522e8498017a0a6cf6c3ec
|
91b964984762870246a2a71cb32187eb9e85d74e
|
/SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/boost/xpressive/xpressive_static.hpp
|
bcec316b565977a53d01c466d068e9aa2c9126bf
|
[
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
willrebuild/flyffsf
|
e5911fb412221e00a20a6867fd00c55afca593c7
|
d38cc11790480d617b38bb5fc50729d676aef80d
|
refs/heads/master
| 2021-01-19T20:27:35.200154 | 2011-02-10T12:34:43 | 2011-02-10T12:34:43 | 32,710,780 | 3 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,123 |
hpp
|
///////////////////////////////////////////////////////////////////////////////
/// \file xpressive_static.hpp
/// Includes everything you need to write static regular expressions and use
/// them.
//
// Copyright 2004 Eric Niebler. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_XPRESSIVE_STATIC_HPP_EAN_10_04_2005
#define BOOST_XPRESSIVE_STATIC_HPP_EAN_10_04_2005
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#ifdef _MSC_VER
// inline aggressively
# pragma inline_recursion(on) // turn on inline recursion
# pragma inline_depth(255) // max inline depth
#endif
#include <boost/xpressive/regex_primitives.hpp>
#include <boost/xpressive/basic_regex.hpp>
#include <boost/xpressive/sub_match.hpp>
#include <boost/xpressive/match_results.hpp>
#include <boost/xpressive/regex_algorithms.hpp>
#include <boost/xpressive/regex_iterator.hpp>
#include <boost/xpressive/regex_token_iterator.hpp>
#endif
|
[
"[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278"
] |
[
[
[
1,
32
]
]
] |
5685f11b5927a7ca62a67c1b9c4956de385cb9a1
|
92bedc8155e2fb63f82603c5bf4ddec445d49468
|
/src/foundation/Configuration.cpp
|
c8ad9eec91ae014303768e316a10a2711e52d28d
|
[] |
no_license
|
jemyzhang/pluto-hades
|
16372453f05510918b07720efa210c748b887316
|
78d9cf2ec7022ad35180e4fb685d780525ffc45d
|
refs/heads/master
| 2016-09-06T15:11:35.964172 | 2009-09-26T09:53:12 | 2009-09-26T09:53:12 | 32,126,635 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 5,414 |
cpp
|
/*******************************************************************************
**
** NAME: Configuration.cpp
** VER: 1.0
** CREATE DATE: 06/08/2009
** AUTHOR: Roger
**
** Copyright (C) 2009 - PlutoWare All Rights Reserved
**
**
** PURPOSE: Class Configuration, provide configuration information of system
**
** --------------------------------------------------------------
**
** HISTORY:
**
**
*******************************************************************************/
#include "StdAfx.h"
#include "Configuration.h"
#include "Assertion.h"
namespace foundation {
QString Configuration::defaultConfigFile_;
QString Configuration::defaultSettingsFile_;
QList<Configuration*> Configuration::systemConfigurations_;
Configuration::Configuration()
{
Configuration::initDefaultFiles();
this->config_ = QSharedPointer<QSettings>(
new QSettings(defaultConfigFile_, QSettings::IniFormat));
this->settings_ = QSharedPointer<QSettings>(
new QSettings(defaultSettingsFile_, QSettings::IniFormat));
__POSTCOND_E(config_ && settings_, "Cannot create QSettings");
Configuration::systemConfigurations_.append(this);
}
Configuration::Configuration(const QString& configFile,
const QString& settingsFile)
{
this->config_ = QSharedPointer<QSettings>(
new QSettings(configFile, QSettings::IniFormat));
this->settings_ = QSharedPointer<QSettings>(
new QSettings(settingsFile, QSettings::IniFormat));
__POSTCOND_E(config_ && settings_, "Cannot create QSettings");
Configuration::systemConfigurations_.append(this);
}
Configuration::~Configuration(void)
{
}
QString
Configuration::configFile() const
{
return this->config_->fileName();
}
QString
Configuration::settingsFile() const
{
return this->settings_->fileName();
}
QVariant
Configuration::value(const QString& key,
const QVariant& default /*= QVariant()*/) const
{
if (this->settings_->contains(key))
{
return this->settings_->value(key, default);
}
else
{
return this->config_->value(key, default);
}
}
QString
Configuration::stringValue(const QString& key,
const QString& default /*= QString()*/) const
{
return this->value(key, default).toString();
}
bool
Configuration::boolValue(const QString& key, bool default /*= false*/) const
{
return this->value(key, default).toBool();
}
int
Configuration::intValue(const QString& key, int default /*= 0*/) const
{
return this->value(key, default).toInt();
}
double
Configuration::doubleValue(const QString& key, double default /*= 0.0*/) const
{
return this->value(key, default).toDouble();
}
QSettings*
Configuration::configuration()
{
return this->config_.data();
}
QSettings*
Configuration::settings()
{
return this->settings_.data();
}
void
Configuration::beginGroup(const QString& groupPrefix)
{
this->settings_->beginGroup(groupPrefix);
this->config_->beginGroup(groupPrefix);
}
void
Configuration::endGroup()
{
this->settings_->endGroup();
this->config_->endGroup();
}
void
Configuration::setSettingsValue(const QString& key, const QVariant& value)
{
this->settings_->setValue(key, value);
this->settings_->sync();
}
void
Configuration::setConfigValue(const QString& key, const QVariant& value)
{
this->config_->setValue(key, value);
}
void
Configuration::setDefaultFiles(const QString& configFile,
const QString& settingsFile)
{
Configuration::defaultConfigFile_ = configFile;
Configuration::defaultSettingsFile_ = settingsFile;
}
bool
Configuration::hasInstance(const QString& configFile,
const QString& settingsFile)
{
foreach (Configuration* config, Configuration::systemConfigurations_)
{
if (QFileInfo(configFile) == QFileInfo(config->configFile()) &&
QFileInfo(settingsFile) == QFileInfo(config->settingsFile()))
{
return true;
}
}
return false;
}
Configuration*
Configuration::instance()
{
if (systemConfigurations_.size())
{
return systemConfigurations_.first();
}
else
{
Configuration::initDefaultFiles();
return instance(Configuration::defaultConfigFile_,
Configuration::defaultSettingsFile_);
}
}
Configuration*
Configuration::instance(const QString& configFile,
const QString& settingsFile)
{
Configuration* result = NULL;
foreach (Configuration* config, Configuration::systemConfigurations_)
{
if (QFileInfo(configFile) == QFileInfo(config->configFile()) &&
QFileInfo(settingsFile) == QFileInfo(config->settingsFile()))
{
result = config;
}
}
if (!result)
{
result = new Configuration(configFile, settingsFile);
}
__POSTCOND_E(result, "Cannot create Configuration.");
return result;
}
void
Configuration::initDefaultFiles()
{
//init default files
if (Configuration::defaultConfigFile_.isEmpty())
{
Configuration::defaultConfigFile_ =
QCoreApplication::applicationDirPath() + "/config/config.ini";
Configuration::defaultSettingsFile_ =
QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/settings.ini";
__LOG(QString("Config file : %1, settings file : %2")
.arg(Configuration::defaultConfigFile_, Configuration::defaultSettingsFile_));
}
}
//end foundation namespace
}
|
[
"roger2yi@35b8d456-67b3-11de-a2f9-0f955267958a"
] |
[
[
[
1,
254
]
]
] |
2194661c0952b9f5a6b819ee74aac15f9be3ca7e
|
e7c45d18fa1e4285e5227e5984e07c47f8867d1d
|
/Application/SysCAD/ScdProject.h
|
14424bb54b114f8a4a012095961edddf8dd5a586
|
[] |
no_license
|
abcweizhuo/Test3
|
0f3379e528a543c0d43aad09489b2444a2e0f86d
|
128a4edcf9a93d36a45e5585b70dee75e4502db4
|
refs/heads/master
| 2021-01-17T01:59:39.357645 | 2008-08-20T00:00:29 | 2008-08-20T00:00:29 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 3,843 |
h
|
// ScdProject.h : Declaration of the CScdProject
#ifndef __SCDPROJECT_H_
#define __SCDPROJECT_H_
#include "resource.h" // main symbols
#include "scdapplication.h"
/////////////////////////////////////////////////////////////////////////////
// CScdProject
class ATL_NO_VTABLE CScdProject :
public CScdCOCmdBase,
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<CScdProject, &CLSID_ScdProject>,
public ISupportErrorInfo,
public IConnectionPointContainerImpl<CScdProject>,
public IDispatchImpl<IScdProject, &IID_IScdProject, &LIBID_ScdApp>,
public IDispatchImpl<IScdASyncEvents, &IID_IScdASyncEvents, &LIBID_ScdIF>
{
public:
CScdProject() : CScdCOCmdBase(WMU_COM_APP)
{
//m_pUnkMarshaler = NULL;
m_iSeqNo=-1;
}
DECLARE_REGISTRY_RESOURCEID(IDR_SCDPROJECT)
DECLARE_GET_CONTROLLING_UNKNOWN()
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CScdProject)
COM_INTERFACE_ENTRY(IScdProject)
//DEL COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY(IConnectionPointContainer)
//COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
COM_INTERFACE_ENTRY2(IDispatch, IScdProject)
COM_INTERFACE_ENTRY(IScdASyncEvents)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(CScdProject)
END_CONNECTION_POINT_MAP()
DECLARE_SCD(long);
#ifdef _DEBUG
BEGIN_CATEGORY_MAP(CScdProject)
IMPLEMENTED_CATEGORY(CATID_SysCADAppObject)
END_CATEGORY_MAP()
#endif
HRESULT FinalConstruct();
void FinalRelease();
//CComPtr<IUnknown> m_pUnkMarshaler;
CComPtr<IScdGraphics > m_pGraphics ;
CComPtr<IScdTrends > m_pTrends ;
CComPtr<IScdHistorian > m_pHistorian;
CComPtr<IScdAppTags > m_pAppTags ;
CComPtr<IScdSolver > m_pSolver ;
CComPtr<IScdReports > m_pReports ;
//CComPtr<IScdSnapshot > m_pSnapshot ;
CComPtr<IScdReplay > m_pReplay ;
CComPtr<IScdOPCServer > m_pOPCServer;
CComPtr<IScdIOMarshal > m_pIOMarshal;
CComPtr<IScdDDEServer > m_pDDEServer;
// ISupportsErrorInfo
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
public:
// IScdASyncEvents
STDMETHOD(DoEventMsg)(LONG Evt, LONG Data)
{
CScdCOCmdBase::DoEventMsg(Evt, Data);
return S_OK;
}
virtual void FireTheEvent(long Evt, long Data);
// IScdProject
STDMETHOD(Save)(/*[in]*/ BSTR Filename, /*[in]*/ VARIANT_BOOL NewVersion);
STDMETHOD(get_Tags)(/*[out, retval]*/ IScdAppTags ** pTags);
STDMETHOD(get_SpecieDefns)(/*[out, retval]*/ IScdSpecieDefns ** pSpecieDefns);
STDMETHOD(get_Solver)(/*[out, retval]*/ IScdSolver ** pSolver);
//STDMETHOD(get_Snapshot)(/*[out, retval]*/ IScdSnapshot ** pSnapshot);
STDMETHOD(get_Reports)(/*[out, retval]*/ IScdReports ** pReport);
STDMETHOD(get_Historian)(/*[out, retval]*/ IScdHistorian ** pHistorian);
STDMETHOD(get_Trends)(/*[out, retval]*/ IScdTrends ** pTrends);
STDMETHOD(get_Graphics)(/*[out, retval]*/ IScdGraphics ** pGraphics);
STDMETHOD(get_OPCServer)(IScdOPCServer ** pVal);
STDMETHOD(get_IOMarshal)(IScdIOMarshal ** pVal);
STDMETHOD(get_DDEServer)(IScdDDEServer** pVal);
STDMETHOD(get_CfgFolder)(BSTR* pVal);
STDMETHOD(get_PrjFolder)(BSTR* pVal);
STDMETHOD(ExportNeutralDB)(eScdNDBOptions Options, BSTR GraphicsDatabase, BSTR ModelDatabase);
STDMETHOD(ImportNeutralDB)(eScdNDBOptions Options, BSTR GraphicsDatabase, BSTR ModelDatabase, IScdTagFixup * TagFixups);
STDMETHOD(SaveSnapshot)(BSTR FileName, long SeqStart);
STDMETHOD(LoadSnapshot)(BSTR FileName, long NoInSeq);
long m_iSeqNo;
CString m_sSnapName;
};
#endif //__SCDPROJECT_H_
|
[
"[email protected]",
"[email protected]"
] |
[
[
[
1,
24
],
[
26,
62
],
[
64,
85
],
[
87,
98
],
[
105,
107
]
],
[
[
25,
25
],
[
63,
63
],
[
86,
86
],
[
99,
104
]
]
] |
af465bae44f48459e662926bb7c74d7bf5e404bd
|
91b964984762870246a2a71cb32187eb9e85d74e
|
/SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/libs/wave/samples/cpp_tokens/instantiate_defined_grammar.cpp
|
14ef88ce6dd2438d7ccabc3d233be8c4b4765f1c
|
[
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
willrebuild/flyffsf
|
e5911fb412221e00a20a6867fd00c55afca593c7
|
d38cc11790480d617b38bb5fc50729d676aef80d
|
refs/heads/master
| 2021-01-19T20:27:35.200154 | 2011-02-10T12:34:43 | 2011-02-10T12:34:43 | 32,710,780 | 3 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,437 |
cpp
|
/*=============================================================================
Boost.Wave: A Standard compliant C++ preprocessor library
http://www.boost.org/
Copyright (c) 2001-2007 Hartmut Kaiser. Distributed under the Boost
Software License, Version 1.0. (See accompanying file
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#include "cpp_tokens.hpp" // config data
#if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0
#include <string>
#include <boost/wave/token_ids.hpp>
#include "slex_token.hpp"
#include "slex_iterator.hpp"
#include <boost/wave/grammars/cpp_defined_grammar.hpp>
///////////////////////////////////////////////////////////////////////////////
//
// Explicit instantiation of the defined_grammar_gen template
// with the correct token type. This instantiates the corresponding parse
// function, which in turn instantiates the defined_grammar
// object (see wave/grammars/cpp_defined_grammar.hpp)
//
///////////////////////////////////////////////////////////////////////////////
typedef boost::wave::cpplexer::slex::slex_iterator<
boost::wave::cpplexer::slex_token<> >
lexer_type;
template struct boost::wave::grammars::defined_grammar_gen<lexer_type>;
#endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0
|
[
"[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278"
] |
[
[
[
1,
39
]
]
] |
a0a4c811c5de53c596e7d51eeb8b500ebdb8ad0c
|
bdb1e38df8bf74ac0df4209a77ddea841045349e
|
/CapsuleSortor/新昌天龙/ToolCVB/ConfigInfo.cpp
|
84d7dd690ce7a17fb1bf39f1d437cc48f5586b19
|
[] |
no_license
|
Strongc/my001project
|
e0754f23c7818df964289dc07890e29144393432
|
07d6e31b9d4708d2ef691d9bedccbb818ea6b121
|
refs/heads/master
| 2021-01-19T07:02:29.673281 | 2010-12-17T03:10:52 | 2010-12-17T03:10:52 | 49,062,858 | 0 | 1 | null | 2016-01-05T11:53:07 | 2016-01-05T11:53:07 | null |
GB18030
|
C++
| false | false | 17,361 |
cpp
|
#include "stdafx.h"
#include "ConfigInfo.h"
#include "TIniFile.h"
GrabIndex ConfigInfo::m_grabIndex = ONEBYONE;
ConfigInfo::ConfigInfo()
{ }
ConfigInfo::~ConfigInfo()
{ }
/*******************************************************************************
* 函数名称: TheConfigInfo
*
* 参数 :
*
* 输出 : 得到配置信息的引用
*
* 功能 : 得到配置信息
*
*
********************************************************************************/
ConfigInfo& ConfigInfo::TheConfigInfo()
{
static ConfigInfo theCfgInfo;
return theCfgInfo;
}
/*******************************************************************************
* 函数名称: LoadIniFile
*
* 参数 :
*
* 输出 : 得到配置信息的引用
*
* 功能 : 得到配置信息
*
*
********************************************************************************/
bool ConfigInfo::LoadIniFile(const TString& fileName,
TIniFile::EnumPath ePath)
{
if(!TIniFile::SetFileName(fileName, ePath))
{
AfxMessageBox( "载入配置文件失败!");
return false;
}
m_simlation = TIniFile::GetInt("SysConfig", "Simulator", 1);
m_grabIndex = static_cast<GrabIndex>(TIniFile::GetInt("SysConfig", "GrabIndex", 1));
m_firstCapsuleParam.capsuleDim.tolerance = TIniFile::GetInt("FirstCapsuleParam", "Tolerance", 10 );
m_firstCapsuleParam.capsuleDim.width = TIniFile::GetInt("FirstCapsuleParam", "Width", 138 );
m_firstCapsuleParam.capsuleDim.height = TIniFile::GetInt("FirstCapsuleParam", "Height", 380 );
m_firstCapsuleParam.capColor.L = TIniFile::GetInt("FirstCapsuleParam", "Cap_L", 0 );
m_firstCapsuleParam.capColor.a = TIniFile::GetInt("FirstCapsuleParam", "Cap_a" , 0 );
m_firstCapsuleParam.capColor.b = TIniFile::GetInt("FirstCapsuleParam", "Cap_b" , 0 );
m_firstCapsuleParam.capLength = TIniFile::GetInt("FirstCapsuleParam", "Cap_Length", 0 );
m_firstCapsuleParam.bodyColor.L = TIniFile::GetInt("FirstCapsuleParam", "Body_L", 0 );
m_firstCapsuleParam.bodyColor.a = TIniFile::GetInt("FirstCapsuleParam", "Body_a", 0 );
m_firstCapsuleParam.bodyColor.b = TIniFile::GetInt("FirstCapsuleParam", "Body_b", 0 );
m_firstCapsuleParam.bodyLength = TIniFile::GetInt("FirstCapsuleParam", "Body_Length", 0 );
m_firstCapsuleParam.partTolerance = TIniFile::GetInt("FirstCapsuleParam", "PartTolerance", 0 );
m_secondCapsuleParam.capsuleDim.tolerance = TIniFile::GetInt("SecondCapsuleParam", "Tolerance", 10 );
m_secondCapsuleParam.capsuleDim.width = TIniFile::GetInt("SecondCapsuleParam", "Width", 138 );
m_secondCapsuleParam.capsuleDim.height = TIniFile::GetInt("SecondCapsuleParam", "Height", 380 );
m_secondCapsuleParam.capColor.L = TIniFile::GetInt("SecondCapsuleParam", "Cap_L", 0 );
m_secondCapsuleParam.capColor.a = TIniFile::GetInt("SecondCapsuleParam", "Cap_a" , 0 );
m_secondCapsuleParam.capColor.b = TIniFile::GetInt("SecondCapsuleParam", "Cap_b" , 0 );
m_secondCapsuleParam.capLength = TIniFile::GetInt("SecondCapsuleParam", "Cap_Length", 0 );
m_secondCapsuleParam.bodyColor.L = TIniFile::GetInt("SecondCapsuleParam", "Body_L", 0 );
m_secondCapsuleParam.bodyColor.a = TIniFile::GetInt("SecondCapsuleParam", "Body_a", 0 );
m_secondCapsuleParam.bodyColor.b = TIniFile::GetInt("SecondCapsuleParam", "Body_b", 0 );
m_secondCapsuleParam.bodyLength = TIniFile::GetInt("SecondCapsuleParam", "Body_Length", 0 );
m_secondCapsuleParam.partTolerance = TIniFile::GetInt("SecondCapsuleParam", "PartTolerance", 0 );
m_secondParam.maxValue = TIniFile::GetInt("MonoSortor", "MaxValue", 230 );
m_secondParam.shrinkX = TIniFile::GetInt("MonoSortor", "ShrinkX", 10 );
m_secondParam.shrinkY = TIniFile::GetInt("MonoSortor", "ShrinkY", 5 );
m_secondParam.edgeThres = TIniFile::GetInt("MonoSortor", "EdgeThres", 3 );
m_secondParam.edgeDensity = TIniFile::GetInt("MonoSortor", "EdgeDensity", 500 );
m_secondParam.dynThres = TIniFile::GetInt("MonoSortor", "DynThres", 6 );
m_secondParam.dynWndSize = TIniFile::GetInt("MonoSortor", "dynWndSize", 20 );
m_secondParam.blobSize = TIniFile::GetInt("MonoSortor", "BlobSize", 15 );
m_secondParam.transparent = TIniFile::GetInt("MonoSortor", "Transparent", 0 );
m_firstParam.maxValue = TIniFile::GetInt("ColorSortor", "MaxValue", 230 );
m_firstParam.shrinkX = TIniFile::GetInt("ColorSortor", "ShrinkX", 15 );
m_firstParam.shrinkY = TIniFile::GetInt("ColorSortor", "ShrinkY", 8 );
m_firstParam.edgeThres = TIniFile::GetInt("ColorSortor", "EdgeThres", 2 );
m_firstParam.edgeDensity = TIniFile::GetInt("ColorSortor", "EdgeDensity", 300 );
m_firstParam.dynThres = TIniFile::GetInt("ColorSortor", "DynThres", 6 );
m_firstParam.dynWndSize = TIniFile::GetInt("ColorSortor", "DynWndSize", 30 );
m_firstParam.blobSize = TIniFile::GetInt("ColorSortor", "BlobSize", 15 );
m_firstParam.transparent = TIniFile::GetInt("ColorSortor", "Transparent", 0 );
m_secondCamParam.roiStartX = TIniFile::GetInt("SecondCam", "ROIStartX", 0 );
m_secondCamParam.roiStartY = TIniFile::GetInt("SecondCam", "ROIStartY", 220 );
m_secondCamParam.roiWidth = TIniFile::GetInt("SecondCam", "ROIWidth", 1024);
m_secondCamParam.roiHeight = TIniFile::GetInt("SecondCam", "ROIHeight" , 480 );
m_secondCamParam.gain = TIniFile::GetInt("SecondCam", "Gain" , 0 );
m_secondCamParam.expTime = TIniFile::GetInt("SecondCam", "ExpTime" , 500 );
m_secondCamParam.balanceRed = TIniFile::GetInt("SecondCam", "BalanceRed", 100 );
m_secondCamParam.balanceGreen = TIniFile::GetInt("SecondCam", "BalanceGreen", 100 );
m_secondCamParam.balanceBlue = TIniFile::GetInt("SecondCam", "BalanceBlue", 100 );
m_secondCamParam.camTag = TIniFile::GetStr("SecondCam", "CamTag");
m_firstCamParam.roiStartX = TIniFile::GetInt("FirstCam", "ROIStartX" , 0 );
m_firstCamParam.roiStartY = TIniFile::GetInt("FirstCam", "ROIStartY" , 220 );
m_firstCamParam.roiWidth = TIniFile::GetInt("FirstCam", "ROIWidth" , 1024);
m_firstCamParam.roiHeight = TIniFile::GetInt("FirstCam", "ROIHeight" , 480 );
m_firstCamParam.gain = TIniFile::GetInt("FirstCam", "Gain" , 0 );
m_firstCamParam.expTime = TIniFile::GetInt("FirstCam", "ExpTime" , 1000);
m_firstCamParam.balanceRed = TIniFile::GetInt("FirstCam", "BalanceRed", 174 );
m_firstCamParam.balanceGreen = TIniFile::GetInt("FirstCam", "BalanceGreen", 100 );
m_firstCamParam.balanceBlue = TIniFile::GetInt("FirstCam", "BalanceBlue", 257 );
m_firstCamParam.camTag = TIniFile::GetStr("FirstCam", "CamTag" );
m_valveParam.IOBoard = TIniFile::GetInt("ValveCtrl", "IOBoard" , 0 );
m_valveParam.ResultInterval = TIniFile::GetInt("ValveCtrl", "ResultInterval", 5 );
m_comCtrl.baudRate = TIniFile::GetInt("ComCtrl", "BaudRate" , 57600);
m_comCtrl.portIndex = TIniFile::GetInt("ComCtrl", "PortIndex" , 1 );
m_colorRemain.radius = TIniFile::GetInt("Remain", "ColorRadius", 58);
m_colorRemain.minBoxWidth = TIniFile::GetInt("Remain", "ColorMinBoxWidth", 15);
m_colorRemain.binaryLowThres = TIniFile::GetInt("Remain", "ColorBinaryLowThres", 50);
m_colorRemain.binaryUpThres = TIniFile::GetInt("Remain", "ColorBinaryUpThres", 255);
m_monoRemain.radius = TIniFile::GetInt("Remain", "MonoRadius", 58);
m_monoRemain.minBoxWidth = TIniFile::GetInt("Remain", "MonoMinboxWidth", 15);
m_monoRemain.binaryLowThres = TIniFile::GetInt("Remain", "MonoBinaryLowThres", 50);
m_monoRemain.binaryUpThres = TIniFile::GetInt("Remain", "MonoBinaryUpThres", 255);
m_radiumRange.minRadium = TIniFile::GetInt("RadiumRange","minRadium", 50);
m_radiumRange.maxRadium = TIniFile::GetInt("RadiumRange","maxRadium", 60);
m_minboxWidthRange.minWidth = TIniFile::GetInt("MinboxWidthRange", "minWidth", 0);
m_minboxWidthRange.maxWidth = TIniFile::GetInt("MinboxWidthRange", "maxWidth", 20);
return true;
}
bool ConfigInfo::SaveIniFile(const TString& fileName,
TIniFile::EnumPath ePath)
{
TIniFile::SetFileName(fileName, ePath);
TIniFile::SetInt("SysConfig", "Simulator", m_simlation );
TIniFile::SetInt("SysConfig", "GrabIndex", m_grabIndex );
TIniFile::SetInt("FirstCapsuleParam", "Tolerance", m_firstCapsuleParam.capsuleDim.tolerance );
TIniFile::SetInt("FirstCapsuleParam", "Width", m_firstCapsuleParam.capsuleDim.width );
TIniFile::SetInt("FirstCapsuleParam", "Height", m_firstCapsuleParam.capsuleDim.height );
TIniFile::SetInt("FirstCapsuleParam", "Cap_L", m_firstCapsuleParam.capColor.L );
TIniFile::SetInt("FirstCapsuleParam", "Cap_a", m_firstCapsuleParam.capColor.a );
TIniFile::SetInt("FirstCapsuleParam", "Cap_b", m_firstCapsuleParam.capColor.b );
TIniFile::SetInt("FirstCapsuleParam", "Body_L", m_firstCapsuleParam.bodyColor.L );
TIniFile::SetInt("FirstCapsuleParam", "Body_a", m_firstCapsuleParam.bodyColor.a );
TIniFile::SetInt("FirstCapsuleParam", "Body_b", m_firstCapsuleParam.bodyColor.b );
TIniFile::SetInt("FirstCapsuleParam", "Body_Length", m_firstCapsuleParam.bodyLength );
TIniFile::SetInt("FirstCapsuleParam", "Cap_Length", m_firstCapsuleParam.capLength );
TIniFile::SetInt("FirstCapsuleParam", "PartTolerance", m_firstCapsuleParam.partTolerance );
TIniFile::SetInt("SecondCapsuleParam", "Tolerance", m_secondCapsuleParam.capsuleDim.tolerance );
TIniFile::SetInt("SecondCapsuleParam", "Width", m_secondCapsuleParam.capsuleDim.width );
TIniFile::SetInt("SecondCapsuleParam", "Height", m_secondCapsuleParam.capsuleDim.height );
TIniFile::SetInt("SecondCapsuleParam", "Cap_L", m_secondCapsuleParam.capColor.L );
TIniFile::SetInt("SecondCapsuleParam", "Cap_a", m_secondCapsuleParam.capColor.a );
TIniFile::SetInt("SecondCapsuleParam", "Cap_b", m_secondCapsuleParam.capColor.b );
TIniFile::SetInt("SecondCapsuleParam", "Body_L", m_secondCapsuleParam.bodyColor.L );
TIniFile::SetInt("SecondCapsuleParam", "Body_a", m_secondCapsuleParam.bodyColor.a );
TIniFile::SetInt("SecondCapsuleParam", "Body_b", m_secondCapsuleParam.bodyColor.b );
TIniFile::SetInt("SecondCapsuleParam", "Body_Length", m_secondCapsuleParam.bodyLength );
TIniFile::SetInt("SecondCapsuleParam", "Cap_Length", m_secondCapsuleParam.capLength );
TIniFile::SetInt("SecondCapsuleParam", "PartTolerance", m_secondCapsuleParam.partTolerance );
TIniFile::SetInt("MonoSortor", "MaxValue", m_secondParam.maxValue );
TIniFile::SetInt("MonoSortor", "ShrinkX", m_secondParam.shrinkX );
TIniFile::SetInt("MonoSortor", "ShrinkY", m_secondParam.shrinkY );
TIniFile::SetInt("MonoSortor", "EdgeThres", m_secondParam.edgeThres );
TIniFile::SetInt("MonoSortor", "EdgeDensity", m_secondParam.edgeDensity );
TIniFile::SetInt("MonoSortor", "DynThres", m_secondParam.dynThres );
TIniFile::SetInt("MonoSortor", "DynWndSize", m_secondParam.dynWndSize );
TIniFile::SetInt("MonoSortor", "BlobSize", m_secondParam.blobSize );
TIniFile::SetInt("MonoSortor", "Transparent", m_secondParam.transparent );
TIniFile::SetInt("ColorSortor", "MaxValue", m_firstParam.maxValue );
TIniFile::SetInt("ColorSortor", "ShrinkX", m_firstParam.shrinkX );
TIniFile::SetInt("ColorSortor", "ShrinkY", m_firstParam.shrinkY );
TIniFile::SetInt("ColorSortor", "EdgeThres", m_firstParam.edgeThres );
TIniFile::SetInt("ColorSortor", "EdgeDensity", m_firstParam.edgeDensity );
TIniFile::SetInt("ColorSortor", "DynThres", m_firstParam.dynThres );
TIniFile::SetInt("ColorSortor", "DynWndSize", m_firstParam.dynWndSize );
TIniFile::SetInt("ColorSortor", "BlobSize", m_firstParam.blobSize );
TIniFile::SetInt("ColorSortor", "Transparent", m_firstParam.transparent );
TIniFile::SetInt("SecondCam", "ROIStartX", m_secondCamParam.roiStartX );
TIniFile::SetInt("SecondCam", "ROIStartY", m_secondCamParam.roiStartY );
TIniFile::SetInt("SecondCam", "ROIWidth", m_secondCamParam.roiWidth );
TIniFile::SetInt("SecondCam", "ROIHeight", m_secondCamParam.roiHeight );
TIniFile::SetInt("SecondCam", "Gain", m_secondCamParam.gain );
TIniFile::SetInt("SecondCam", "ExpTime", m_secondCamParam.expTime );
TIniFile::SetInt("SecondCam", "BalanceRed", m_secondCamParam.balanceRed );
TIniFile::SetInt("SecondCam", "BalanceGreen", m_secondCamParam.balanceGreen );
TIniFile::SetInt("SecondCam", "BalanceBlue", m_secondCamParam.balanceBlue );
TIniFile::SetStr("SecondCam", "CamTag", m_secondCamParam.camTag );
TIniFile::SetInt("FirstCam", "ROIStartX", m_firstCamParam.roiStartX );
TIniFile::SetInt("FirstCam", "ROIStartY", m_firstCamParam.roiStartY );
TIniFile::SetInt("FirstCam", "ROIWidth", m_firstCamParam.roiWidth );
TIniFile::SetInt("FirstCam", "ROIHeight", m_firstCamParam.roiHeight );
TIniFile::SetInt("FirstCam", "Gain", m_firstCamParam.gain );
TIniFile::SetInt("FirstCam", "ExpTime", m_firstCamParam.expTime );
TIniFile::SetInt("FirstCam", "BalanceRed", m_firstCamParam.balanceRed );
TIniFile::SetInt("FirstCam", "BalanceGreen", m_firstCamParam.balanceGreen );
TIniFile::SetInt("FirstCam", "BalanceBlue", m_firstCamParam.balanceBlue );
TIniFile::SetStr("FirstCam", "CamTag", m_firstCamParam.camTag );
TIniFile::SetInt("ValveCtrl", "IOBoard" , m_valveParam.IOBoard );
TIniFile::SetInt("ValveCtrl", "ResultInterval", m_valveParam.ResultInterval );
TIniFile::SetInt("ComCtrl", "BaudRate", m_comCtrl.baudRate );
TIniFile::SetInt("ComCtrl", "PortIndex", m_comCtrl.portIndex );
TIniFile::SetInt("RadiumRange", "minRadium", m_radiumRange.minRadium );
TIniFile::SetInt("RadiumRange", "maxRadium", m_radiumRange.maxRadium );
TIniFile::SetInt("Remain", "ColorRadius", m_colorRemain.radius );
TIniFile::SetInt("Remain", "ColorMinBoxWidth", m_colorRemain.minBoxWidth );
TIniFile::SetInt("Remain", "ColorBinaryLowThres", m_colorRemain.binaryLowThres);
TIniFile::SetInt("Remain", "ColorBinaryUpThres", m_colorRemain.binaryUpThres);
TIniFile::SetInt("Remain", "MonoRadius", m_monoRemain.radius );
TIniFile::SetInt("Remain", "MonoMinBoxWidth", m_monoRemain.minBoxWidth );
TIniFile::SetInt("Remain", "MonoBinaryLowThres", m_monoRemain.binaryLowThres);
TIniFile::SetInt("Remain", "MonoBinaryUpThres", m_monoRemain.binaryUpThres);
TIniFile::SetInt("MinboxWidthRange", "minWidth", m_minboxWidthRange.minWidth);
TIniFile::SetInt("MinboxWidthRange", "maxWidth", m_minboxWidthRange.maxWidth);
return true;
}
//const CapsuleParam& ConfigInfo::CapsuleInfo() const
//{ return m_capsuleParam; }
const SortorParam& ConfigInfo::ColorInfo () const
{ return m_firstParam; }
const SortorParam& ConfigInfo::MonoInfo () const
{ return m_secondParam; }
const CameraParam& ConfigInfo::SecondCamInfo () const
{ return m_secondCamParam;}
const CameraParam& ConfigInfo::FirstCamInfo ()const
{ return m_firstCamParam; }
const ValveParam& ConfigInfo::ValveInfo () const
{ return m_valveParam; }
const ComCtrlParam& ConfigInfo::ComCtrlInfo () const
{ return m_comCtrl; }
const RemainParam& ConfigInfo::RemainInfo ( PROTYPE type) const
{
switch(type)
{
case FIRST:
return m_colorRemain;
case SECOND:
return m_monoRemain;
default:
return m_monoRemain;
}
}
bool ConfigInfo::Simulation () const
{ return (m_simlation != 0) ? true : false; }
void ConfigInfo::ColorInfo ( const SortorParam& param)
{ m_firstParam = param; }
void ConfigInfo::MonoInfo ( const SortorParam& param)
{ m_secondParam = param; }
void ConfigInfo::SecondCamInfo ( const CameraParam& param)
{ m_secondCamParam = param; }
void ConfigInfo::FirstCamInfo ( const CameraParam& param)
{ m_firstCamParam = param; }
void ConfigInfo::ValveInfo ( const ValveParam& param)
{ m_valveParam = param; }
void ConfigInfo::ComCtrlInfo ( const ComCtrlParam& param)
{ m_comCtrl = param; }
const CapsuleParam& ConfigInfo::FirstCapsuleInfo() const
{ return m_firstCapsuleParam; }
const CapsuleParam& ConfigInfo::SecondCapsuleInfo() const
{ return m_secondCapsuleParam; }
void ConfigInfo::FirstCapsuleInfo ( const CapsuleParam& param)
{ m_firstCapsuleParam = param; }
void ConfigInfo::SecondCapsuleInfo ( const CapsuleParam& param)
{ m_secondCapsuleParam = param; }
const RadiumRange& ConfigInfo::RadiumRangeInfo () const
{
return m_radiumRange;
}
void ConfigInfo::RemainInfo ( PROTYPE type, const RemainParam& param)
{
switch(type)
{
case FIRST:
m_colorRemain = param;
break;
case SECOND:
m_monoRemain = param;
break;
}
}
const MinboxWidthRange& ConfigInfo::MinboxWidthInfo () const
{
return m_minboxWidthRange;
}
const GrabIndex ConfigInfo::GetGrabIndex () const
{
return m_grabIndex;
}
void ConfigInfo::SetGrabIndex ( const GrabIndex grabIndex)
{
m_grabIndex = grabIndex;
}
|
[
"vincen.cn@66f52ff4-a261-11de-b161-9f508301ba8e"
] |
[
[
[
1,
347
]
]
] |
28421586aefe154432d98f0efcfa6b60d72c9471
|
a7513d1fb4865ea56dbc1fcf4584fb552e642241
|
/avl_array/src/detail/aa_balance.hpp
|
c34144f1b8236155519219c3c58ef4f83f699e0f
|
[
"MIT"
] |
permissive
|
det/avl_array
|
f0cab062fa94dd94cdf12bea4321c5488fb5cdcc
|
d57524a623af9cfeeff060b479cc47285486d741
|
refs/heads/master
| 2021-01-15T19:40:10.287367 | 2010-05-06T13:13:35 | 2010-05-06T13:13:35 | 35,425,204 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 10,175 |
hpp
|
///////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2006-2009, Universidad de Alcala //
// //
// See accompanying LICENSE.TXT //
// //
///////////////////////////////////////////////////////////////////
/*
detail/aa_balance.hpp
---------------------
Private helper methods for maintaining the tree balance:
update_counters():
climb from a node to the root updating all height and
count fields in the way (O(log N))
update_counters_and_rebalance():
climb from a node to the root updating all height and
count fields in the way _and_ rebalancing with AVL
rotations where required (O(log N))
*/
#ifndef _AVL_ARRAY_BALANCE_HPP_
#define _AVL_ARRAY_BALANCE_HPP_
#ifndef _AVL_ARRAY_HPP_
#error "Don't include this file. Include avl_array.hpp instead."
#endif
namespace mkr // Public namespace
{
//////////////////////////////////////////////////////////////////
// ------------------- PRIVATE HELPER METHODS --------------------
// update_counters(): climb from a node to the root updating all
// height and count fields in the way
//
// Complexity: O(log N)
template<class T,class A,bool bW,class W,bool bP,class P>
void
avl_array<T,A,bW,W,bP,P>::update_counters
(typename avl_array<T,A,bW,W,bP,P>::node_t * p)
{
size_type i, j;
while (p) // Climb until the root is
{ // reached
i = p->left_height ();
j = p->right_height ();
p->m_height = (i>j?i:j) + 1; // The height is that of the
// largest branch, plus one
i = p->left_count ();
j = p->right_count ();
// The count is the sum of the
p->m_count = i + j + 1; // subtrees' counts plus one
// The width works like count,
p->update_width (); // but adding the node's width
// instead of just 1
p = p->m_parent; // Step up
}
}
// update_counters_and_rebalance(): climb from a node to the root
// updating all height and count fields in the way _and_
// rebalancing with AVL rotations if necessary (this is what makes
// the whole thing possible, so thanks go to G.M. Adelson-Velsky
// and E.M. Landis)
//
// Complexity: O(log N)
template<class T,class A,bool bW,class W,bool bP,class P>
// not inline
void
avl_array<T,A,bW,W,bP,P>::update_counters_and_rebalance
(typename avl_array<T,A,bW,W,bP,P>::node_t * p)
{
size_type i, j;
int s;
node_t * q, * r;
while (p) // Climb until the root is
{ // reached
i = p->left_height ();
j = p->right_height ();
p->m_height = (i>j?i:j) + 1; // The height is that of the
// largest branch, plus one
// The width works like count,
p->update_width (); // but adding the node's width
// instead of just 1
s = -1; // -1 means balanced
if (p->m_parent) // (don't re-balance dummy node)
{
if (i > j+1) // Unbalanced to the left..
s = R; // .. rotate to the right
else if (j > i+1) // Unbalanced to the right..
s = L; // .. rotate to the left
}
if (s==-1) // If we are in the dummy node or
{ // the current node is balanced
i = p->left_count ();
j = p->right_count ();
// The count is the sum of the
p->m_count = i + j + 1; // subtrees' counts plus one
p = p->m_parent; // Step up
continue; // This node is done
}
// Otherwise... re-balance!
// Go down to child
p = p->m_children[1-s]; // (side of the long branch)
i = p->left_height (); // Calculate heights of this
j = p->right_height (); // new position
// Consider the sub-subtrees of the long subtree.
// If the sub-subtree in the middle (between the
// other sub-subtree and the short subtree) is shorter
// or equal to the side sub-subtree, we just need
// a simple rotation; otherwise, we need a double
// rotation
if ( (s==R && i>=j) || // If a simple rotation
(s==L && i<=j) ) // is enough...
{
/*
Before: C
| Y shorter or eq. to X
B
/ \ p -> A
A Z
/ \ ***
X Y *****_____
*** *** |
***** *****_ _ | 2 <-- unbalanced!
***** ..... | 0/1 |
*****_.....____|_______ |
Simple rotation
After: C (with s==R in
| the figure)
A
/ \
X B
*** / \
***** Y Z
***** *** ***
___***** ***** *****___
0/1 | ..... | 0/1
| __________....._________ |
Notation for comments in the code bellow:
F
| F's downling points to G
G G's uplink points to F
F
v F's downling points to G
G G's uplink points to somthing else (not to F)
F
^ F's downling points to somthing else (not to G)
G G's uplink points to F
*/
p->m_parent->m_children[1-s] =
p->m_children[s]; // B B
// / =>> /^
if (p->m_children[s]) // A Y A
p->m_children[s]->m_parent =
p->m_parent;
// C C
p->m_children[s] = p->m_parent; // | ^
p->m_parent = // B =>> A
p->m_children[s]->m_parent; // ^ \.
p->m_children[s]->m_parent = p; // A B
if (p->m_parent->m_children[L] ==
p->m_children[s]) // C C
p->m_parent->m_children[L] = p; // v =>> |
else // B A
p->m_parent->m_children[R] = p;
// Step down to B
p = p->m_children[s]; // (it is balanced but it needs
} // count and height updates)
else
{ // If a double rotation
q = p->m_children[s]; // is required...
r = p->m_parent;
/*
Before: C
| Y larger than X
B
/ \ p -> A
A Z q -> Y
/ \ *** r -> B
X Y *****___
*** / \ |
___***** U V | 2 <-- unbalanced!
1 | *** *** |
| _________**** ****_________ |
Double rotation
After: C (with s==R in
| the figure)
Y
/ \
A B
/ \ / \
X U V Z
*** *** *** ***
***** ***** ***** *****
(See notation for comments in simple rotation)
*/
// C
q->m_parent = r->m_parent; // |
// B C
if (q->m_parent->m_children[L] == r) // / =>> |
q->m_parent->m_children[L] = q; // A Y
else // \.
q->m_parent->m_children[R] = q; // Y
r->m_children[1-s] = q->m_children[s]; // B B
// / =>> /
if (r->m_children[1-s]) // A V
r->m_children[1-s]->m_parent = r;
p->m_children[s] = q->m_children[1-s]; // A A
// \ =>> \.
if (p->m_children[s]) // Y U
p->m_children[s]->m_parent = p;
// B Y Y
q->m_children[1-s] = p; // ^ v =>> /
p->m_parent = q; // A U A
q->m_children[s] = r; // C Y Y
r->m_parent = q; // ^ v =>> \.
// B V B
i = r->left_height ();
j = r->right_height (); // A, B, Y, C and upper
// nodes need height and
r->m_height = (i>j?i:j) + 1; // count updates
i = r->left_count (); // Update B here and go on
j = r->right_count (); // from A (and up) in the
// next iteration
r->m_count = i + j + 1;
r->update_width (); // Update B's width too
}
}
}
//////////////////////////////////////////////////////////////////
} // namespace mkr
#endif
|
[
"martin@cobete"
] |
[
[
[
1,
277
]
]
] |
b739f87201888875a42b6e75c2b1d1b1f98aaf9a
|
c7120eeec717341240624c7b8a731553494ef439
|
/src/cplusplus/freezone-samp/src/core/messages/player_messages/player_messages.hpp
|
4ee0d218e8144d1c96227a74248ec51dac1102ff
|
[] |
no_license
|
neverm1ndo/gta-paradise-sa
|
d564c1ed661090336621af1dfd04879a9c7db62d
|
730a89eaa6e8e4afc3395744227527748048c46d
|
refs/heads/master
| 2020-04-27T22:00:22.221323 | 2010-09-04T19:02:28 | 2010-09-04T19:02:28 | 174,719,907 | 1 | 0 | null | 2019-03-09T16:44:43 | 2019-03-09T16:44:43 | null |
WINDOWS-1251
|
C++
| false | false | 3,000 |
hpp
|
#ifndef PLAYER_MESSAGES_HPP
#define PLAYER_MESSAGES_HPP
#include "core/module_h.hpp"
#include "core/time_outs.hpp"
#include "chat_msg_item.hpp"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/optional.hpp>
#include <map>
class player_messages
:public application_item
,public players_events::on_connect_i
{
public:
typedef std::tr1::shared_ptr<player_messages> ptr;
static ptr instance();
player_messages();
virtual ~player_messages();
public: // players_events::*
virtual void on_connect(player_ptr_t const& player_ptr);
public:
// Методы отсылки простых сообщений в чат. Не требуют восстановления состояния
static void send_message(player_ptr_t const& player_ptr, std::string const& msg);
static void send_message(player_ptr_t const& player_ptr, chat_msg_item_t const& msg_item);
static void set_chat_bubble(player_ptr_t const& player_ptr, std::string const& text);
// Метод отсылки сообщения от имени игрока
static void send_player_message(player_ptr_t const& player_ptr, player_ptr_t const& from_player, std::string const& msg, bool is_close_chat = false);
// Восстанавливает состояние игрока - должно быть вызвано после всех вызовов send_player_message для данного игрока
static void send_player_message_restore(player_ptr_t const& from_player);
};
class player_messages_bubble_item
:public player_item
,public player_events::on_player_stream_in_i
,public player_events::on_disconnect_i
{
friend class player_messages;
player_messages_bubble_item();
virtual ~player_messages_bubble_item();
public:
typedef std::tr1::shared_ptr<player_messages_bubble_item> ptr;
public: // player_events::*
virtual void on_player_stream_in(player_ptr_t const& player_ptr);
virtual void on_disconnect(samp::player_disconnect_reason reason);
private: // Внешний интерфейс
// Устанвливаем новый чат буббл
void set_chat_bubble(chat_bubble_t const& chat_bubble);
private:
boost::optional<time_base::millisecond_t> last_chat_bubble_expire_time;
chat_bubble_t last_chat_bubble;
int last_chat_bubble_id;
time_base::millisecond_t max_expire_time;
typedef std::map<player_ptr_t, int> showed_ids_t;
showed_ids_t showed_ids; // Список игроков, чьи бублы видел данный игрок
void set_chat_bubble_impl(chat_bubble_t const& chat_bubble, time_base::millisecond_t expire_time);
bool is_chat_bubble_active(int& show_time);
public:
void update_chat_bubble();
};
#endif // PLAYER_MESSAGES_HPP
|
[
"dimonml@19848965-7475-ded4-60a4-26152d85fbc5"
] |
[
[
[
1,
74
]
]
] |
c28f7fcda9fa102be29545594fe501f45be0d68a
|
478570cde911b8e8e39046de62d3b5966b850384
|
/apicompatanamdw/bcdrivers/mw/classicui/uifw/apps/S60_SDK3.0/bctestsettingpage/src/bctestsettingitemlist.cpp
|
090a0ff9fe25edd6840347f3499867ce5f7a7d6f
|
[] |
no_license
|
SymbianSource/oss.FCL.sftools.ana.compatanamdw
|
a6a8abf9ef7ad71021d43b7f2b2076b504d4445e
|
1169475bbf82ebb763de36686d144336fcf9d93b
|
refs/heads/master
| 2020-12-24T12:29:44.646072 | 2010-11-11T14:03:20 | 2010-11-11T14:03:20 | 72,994,432 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 4,656 |
cpp
|
/*
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: test case
*
*/
#include "bctestsettingitemlist.h"
// -------------------------------
// CAknSettingItem
// -------------------------------
//
// public:
/**
* Default constructor.
*/
EXPORT_C CBCTestSettingItem::CBCTestSettingItem( TInt aIdentifier)
: CAknSettingItem( aIdentifier )
{
}
EXPORT_C CBCTestSettingItem::~CBCTestSettingItem()
{
}
// ---------------------------------------
// CAknTextSettingItem
//
//----------------------------------------
EXPORT_C CBCTestTextSettingItem::CBCTestTextSettingItem( TInt aIdentifier, TDes& aText ):
CAknTextSettingItem( aIdentifier, aText )
{
// iInternalTextPtr points to no buffer, so no allocation is done here
}
EXPORT_C CBCTestTextSettingItem::~CBCTestTextSettingItem()
{
}
// ---------------------------------------
// CAknIntegerSettingItem
//
//----------------------------------------
EXPORT_C CBCTestIntegerSettingItem::CBCTestIntegerSettingItem( TInt aIdentifier, TInt& aValue ):
CAknIntegerSettingItem(aIdentifier, aValue )
{
}
EXPORT_C CBCTestIntegerSettingItem::~CBCTestIntegerSettingItem()
{
}
void CBCTestIntegerSettingItem::EditItemL( TBool /*aCalledFromMenu */)
{
}
// ---------------------------------------
// CAknPasswordSettingItem
//
//----------------------------------------
EXPORT_C CBCTestPasswordSettingItem::CBCTestPasswordSettingItem( TInt aIdentifier, enum CAknPasswordSettingItem::TAknPasswordSettingItemMode aPasswordMode, TDes& aPassword ):
CAknPasswordSettingItem( aIdentifier, aPasswordMode, aPassword )
{
}
// ---------------------------------------
// CAknVolumeSettingItem
//
//----------------------------------------
EXPORT_C CBCTestVolumeSettingItem::CBCTestVolumeSettingItem( TInt aIdentifier, TInt& aVolume ):
CAknVolumeSettingItem(aIdentifier, aVolume )
{
}
// ---------------------------------------
// CAknSliderSettingItem
//
//----------------------------------------
EXPORT_C CBCTestSliderSettingItem::CBCTestSliderSettingItem( TInt aIdentifier, TInt& aSliderValue ):
CAknSliderSettingItem( aIdentifier, aSliderValue )
{
}
//
// Implementation of CAknEnumeratedTextSettingItem
//
//
EXPORT_C CBCTestEnumeratedTextSettingItem::CBCTestEnumeratedTextSettingItem(
TInt aIdentifier ):
CAknEnumeratedTextSettingItem(aIdentifier)
{
}
EXPORT_C CBCTestEnumeratedTextSettingItem::~CBCTestEnumeratedTextSettingItem()
{
}
//
// Implementation of CAknEnumeratedTextPopupSettingItem
//
EXPORT_C CBCTestEnumeratedTextPopupSettingItem::CBCTestEnumeratedTextPopupSettingItem(
TInt aIdentifier,
TInt& aValue ):
CAknEnumeratedTextPopupSettingItem( aIdentifier, aValue )
{
}
EXPORT_C CBCTestEnumeratedTextPopupSettingItem::~CBCTestEnumeratedTextPopupSettingItem()
{
}
// ==============================================================================
// CAknBinaryPopupSettingItem
// ==============================================================================
EXPORT_C CBCTestBinaryPopupSettingItem::CBCTestBinaryPopupSettingItem(
TInt aIdentifier,
TBool& aBinaryValue ):
CAknBinaryPopupSettingItem(aIdentifier, aBinaryValue )
{
}
/**
* This constructor merely initializes the empty string descriptor required for formatting the
* listbox text
*
*/
EXPORT_C CBCTestBigSettingItemBase::CBCTestBigSettingItemBase( TInt aIdentifier ): CAknBigSettingItemBase( aIdentifier )
{
}
//========================================
EXPORT_C CBCTestSettingItemArray::CBCTestSettingItemArray(TInt aGranularity, TBool aIsNumbered, TInt aInitialOrdinal ) :
CAknSettingItemArray( aGranularity, aIsNumbered, aInitialOrdinal )
{
}
EXPORT_C CBCTestSettingItemArray::~CBCTestSettingItemArray()
{
}
// -------------------------------
// CAknSettingItemList
// -------------------------------
EXPORT_C CBCTestSettingItemList::CBCTestSettingItemList()
{
}
EXPORT_C CBCTestSettingItemList::~CBCTestSettingItemList()
{
}
// End of File
|
[
"none@none"
] |
[
[
[
1,
184
]
]
] |
669174ccfd6462ee0abf4d512a123d434a88a1df
|
299a1b0fca9e1de3858a5ebeaf63be6dc3a02b48
|
/tags/ic2005demo/dingus/dingus/audio/SoundResource.h
|
ffd2e926ac1ec7dc80f045c59c65cbf35083dd6d
|
[] |
no_license
|
BackupTheBerlios/dingus-svn
|
331d7546a6e7a5a3cb38ffb106e57b224efbf5df
|
1223efcf4c2079f58860d7fa685fa5ded8f24f32
|
refs/heads/master
| 2016-09-05T22:15:57.658243 | 2006-09-02T10:10:47 | 2006-09-02T10:10:47 | 40,673,143 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,958 |
h
|
#ifndef __SOUND_RESOURCE_H
#define __SOUND_RESOURCE_H
#include <mmsystem.h>
#include <mmreg.h>
#include <dsound.h>
#include "../utils/MemoryPool.h"
namespace dingus {
class CSoundWaveFmt;
/**
* CSoundResource is a container for sound data which can be played by the
* audio system. The sound may be static or mStreaming, oneshot or mLooping.
* A sound resource should be able play itself several times simultaneously,
* the intended number of parallel "tracks" can be set by the user before
* opening the resource.
*
* Sound resources are shared and are referenced by CSound objects (there
* should be one CSound per "sound instance", but several sound objects
* should reference the same CSoundResource object).
*/
class CSoundResource : public boost::noncopyable {
public:
CSoundResource();
~CSoundResource();
bool createResource( const std::string& fileName, int tracks, bool ambient, bool streaming );
void deleteResource();
/// stop all buffers
//void stop();
/**
* @return Buffer index, or -1 on error.
*/
int play( int sndID, DWORD priority, DWORD flags, LONG volume, LONG freq = -1, LONG pan = 0 );
/**
* @return Buffer index, or -1 on error.
*/
int play3D( int sndID, const DS3DBUFFER& props3D, DWORD priority, DWORD flags, LONG volume, LONG freq = 0 );
/**
* Stops sound at given buffer index if it matches the sound ID.
*/
void stop( int bufferIdx, int sndID );
void setVolume( int bufferIndex, int sndID, LONG volume );
/// Resets sound at given buffer index.
bool reset( int bufferIdx, bool looping );
//bool isPlaying();
bool isPlaying( int bufferIdx, int sndID );
bool handleStreamNotify( bool looped );
bool checkStreamUpdate();
bool isStreaming() const { return mStreaming; }
bool isAmbient() const { return mAmbient; }
private:
bool internalCreate( const std::string& filename, DWORD creationFlags = 0, GUID guid3DAlgo = GUID_NULL );
bool restoreBuffer( IDirectSoundBuffer* buffer, bool* wasRestored );
bool restoreBufferAndFill( IDirectSoundBuffer* buffer, bool repeatIfLargerBuffer );
bool fillBufferWithSound( IDirectSoundBuffer* buffer, bool repeatIfLargerBuffer );
int getFreeBufferIndex();
long get3DBuffer( DWORD index, IDirectSound3DBuffer** buffer3D );
bool isInside( DWORD pos, DWORD start, DWORD end ) const;
private:
DECLARE_POOLED_ALLOC(dingus::CSoundResource);
private:
// General params
int mTrackCount;
bool mAmbient;
bool mStreaming;
// DSound params
IDirectSoundBuffer** mDSBuffers; // ds buffer per track
int* mPlayingIDs; // playing sound IDs per track
DWORD mDSBufferSize;
CSoundWaveFmt* mWaveFile;
DWORD mCreationFlags;
// streaming params
DWORD mLastPlayPos;
DWORD mPlayProgress;
DWORD mNotifySize;
DWORD mTriggerWriteOffset;
DWORD mNextWriteOffset;
bool mFillNextWithSilence;
};
}; // namespace
#endif
|
[
"nearaz@73827abb-88f4-0310-91e6-a2b8c1a3e93d"
] |
[
[
[
1,
105
]
]
] |
cc7cfbdd5863a805684e7e10066cc6e3fa6cb54a
|
d235b8143a573107d81ea4f0d1ed78e853b6dd06
|
/RobotFindDoor/obstacle.cpp
|
bc4ff331c7c7b992255c6271edfeebf6c043ca7a
|
[] |
no_license
|
joshuaeckroth/Robot-Find-Door
|
e9ff4cdf0f7f34c2abad2d98ee5597ac91127f36
|
beddc08c73287055f78230b42ebfca39b81b000d
|
refs/heads/master
| 2021-01-02T23:07:36.643436 | 2010-05-30T17:19:18 | 2010-05-30T17:19:18 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 369 |
cpp
|
#include "obstacle.h"
#include <QPainter>
Obstacle::Obstacle(QRectF _rect)
: QGraphicsItem(0), rect(_rect)
{ }
QRectF Obstacle::boundingRect() const
{
return rect;
}
void Obstacle::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
painter->setBrush(QColor(242, 149, 68));
painter->drawRect(rect);
}
|
[
"[email protected]"
] |
[
[
[
1,
17
]
]
] |
91b0dbd9665feb7055dc3b6cb99dd67ef0a56cec
|
25a408954fdda07b6a27f84f74c9b9b6af1a282c
|
/ReLips/ResultGameState.cpp
|
f8cf53fd622b0ee26bbf531a1daa7e1c180ae101
|
[] |
no_license
|
nkuln/relips
|
6a6f9b99d72157d038bc9badff42a644fe094bf5
|
f6ec7614710e7b3785469b2e670f3abc854b9e2e
|
refs/heads/master
| 2016-09-11T02:58:48.354657 | 2009-02-17T15:29:02 | 2009-02-17T15:29:02 | 33,202,450 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,745 |
cpp
|
#include "StdAfx.h"
#include "ResultGameState.h"
#include "ResultStateParam.h"
ResultGameState::ResultGameState( char* s )
:GameState(s),
m_currentScore(0),
m_targetScore(0)
{
}
ResultGameState::~ResultGameState(void)
{
}
bool ResultGameState::Update( const FrameEvent& evt )
{
if(m_currentScore < m_targetScore){
int offset = (int)(evt.timeSinceLastFrame * 100.0);
if(m_currentScore + offset < m_targetScore)
m_currentScore += offset;
else
m_currentScore = m_targetScore;
}
UpdateScore();
return true;
}
void ResultGameState::UpdateScore(){
GETOVERLAYELEM(elem, "ResultText1");
stringstream s;
s << m_currentScore;
elem->setCaption(s.str());
}
bool ResultGameState::KeyPressed( const OIS::KeyEvent &arg )
{
switch(arg.key){
case OIS::KC_RETURN:
{
m_reqChangeState = true;
m_changeToStateName = "MenuGameState";
m_paramToPass = NULL;
break;
}
case OIS::KC_ESCAPE:
{
m_reqExitGame = true;
break;
}
}
return true;
}
bool ResultGameState::KeyReleased( const OIS::KeyEvent &arg )
{
return true;
}
ResultGameState * ResultGameState::CreateInstance()
{
return new ResultGameState("ResultGameState");
}
void ResultGameState::Initialize()
{
m_targetScore = static_cast<ResultStateParam *>(m_param)->Score();
m_camera->setPosition(Vector3(0,0,600));
m_camera->lookAt(Vector3(0,0,0));
// Create some nice fireworks
m_sceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(
m_sceneMgr->createParticleSystem("Fireworks", "Examples/Fireworks"));
GETOVERLAY(ov, "ResultOverlay");
ov->show();
}
void ResultGameState::CleanUp()
{
GETOVERLAY(ov, "ResultOverlay");
ov->hide();
}
|
[
"m3rlinez@4e9c09b0-ef73-11dd-a70c-37889e090ee0"
] |
[
[
[
1,
85
]
]
] |
775fdd9b2dd1df509076bc20b04165b858f0febe
|
27d5670a7739a866c3ad97a71c0fc9334f6875f2
|
/CPP/Targets/SupportWFLib/symbian/DummySlaveAudio.cpp
|
8396885d65cd91656988777aa9eb45b28902859f
|
[
"BSD-3-Clause"
] |
permissive
|
ravustaja/Wayfinder-S60-Navigator
|
ef506c418b8c2e6498ece6dcae67e583fb8a4a95
|
14d1b729b2cea52f726874687e78f17492949585
|
refs/heads/master
| 2021-01-16T20:53:37.630909 | 2010-06-28T09:51:10 | 2010-06-28T09:51:10 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,683 |
cpp
|
/*
Copyright (c) 1999 - 2010, Vodafone Group Services Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the Vodafone Group Services Ltd nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#include "DummySlaveAudio.h"
#include "SlaveAudioListener.h"
CDummySlaveAudio::CDummySlaveAudio( MSlaveAudioListener& soundListener )
: m_soundListener( soundListener )
{
m_mute = false;
}
CDummySlaveAudio*
CDummySlaveAudio::NewL( MSlaveAudioListener& listener,
RFs& fileServerSession,
const TDesC& resourcePath )
{
CDummySlaveAudio* retVal = new (ELeave)CDummySlaveAudio( listener );
return retVal;
}
CDummySlaveAudio::~CDummySlaveAudio()
{
}
void
CDummySlaveAudio::PrepareSound( TInt aNumberSounds, const TInt* aSounds )
{
TRAPD( trapRes,
m_soundListener.SoundReadyL( KErrNone, 10 ) );
}
void
CDummySlaveAudio::Play()
{
TRAPD( trapRes, m_soundListener.SoundPlayedL( KErrNone ) );
}
void
CDummySlaveAudio::Stop()
{
}
void
CDummySlaveAudio::SetVolume( TInt vol )
{
}
void
CDummySlaveAudio::SetMute( TBool mute )
{
m_mute = mute;
}
TBool
CDummySlaveAudio::IsMute()
{
return m_mute;
}
TInt32
CDummySlaveAudio::GetDuration()
{
return 10;
}
|
[
"[email protected]"
] |
[
[
[
1,
88
]
]
] |
346691522dd2d73a688cba1aa0bdba59d12e0ed7
|
27d5670a7739a866c3ad97a71c0fc9334f6875f2
|
/CPP/Modules/include/QueueSerial.h
|
fdd473865870f5c8d669d8430910896a96132ab0
|
[
"BSD-3-Clause"
] |
permissive
|
ravustaja/Wayfinder-S60-Navigator
|
ef506c418b8c2e6498ece6dcae67e583fb8a4a95
|
14d1b729b2cea52f726874687e78f17492949585
|
refs/heads/master
| 2021-01-16T20:53:37.630909 | 2010-06-28T09:51:10 | 2010-06-28T09:51:10 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 8,042 |
h
|
/*
Copyright (c) 1999 - 2010, Vodafone Group Services Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the Vodafone Group Services Ltd nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef QUEUESERIAL_H
#define QUEUESERIAL_H
#include <queue>
namespace isab {
/** A class that acts as a serial provider to Nav2 and as a
* I/O-queue to anyone else.*/
class QueueSerial : public Module,
public SerialProviderInterface
{
public:
typedef std::deque<class Buffer*> Container;
class OverflowPolicy{
public:
virtual void clean(Container& deq) = 0;
};
/** Constructor.
* @param name the name of the Module thread. Must be unique.
* @param microSecondsPoll a hint to whoever is reading data from
* this module what a suitable poll interval
* might be. In microseconds.
* Defaults to 0.2 seconds. */
QueueSerial(const char* name, OverflowPolicy* policy,
int microSecondsPoll = 200000);
virtual ~QueueSerial();
/** Creates a new SerialProviderPublic object used to reach this
* module.
* @return a new SerialProviderPublic object connected to the queue.
*/
class SerialProviderPublic * newPublicSerial();
/** Handles incoming data relayed from the public interface.
* @param length the number of bytes to deal with.
* @param data a pointer to an array of char at least length
* bytes long.
* @param src the address of the sender of this package.
*/
virtual void decodedSendData(int length, const uint8 *data, uint32 src);
/** Handles orders regarding this objects connection.
* @param ctrl the order: CONNECT, DISCONNECT ...
* @param method a string argument detailing the order.
* @param src the address of the sender of the order. */
virtual void decodedConnectionCtrl(enum ConnectionCtrl ctrl,
const char *method,
uint32 src);
/** Signals that the module tree has started up correctly and is
* ready to relay messages. Causes QueueSerial to send a
* connectionNotify message.*/
virtual void decodedStartupComplete();
/** Used from the non-Nav2 side to signal to Nav2 that a
* connection has been set up.*/
void connect();
/**Used from the non-Nav2 side to signal to Nav2 that a
* connection has been disconnected .*/
void disconnect();
/** Used from the non-Nav2 side to send data to Nav2.*/
bool write(const uint8* data, int length);
/** Used from the non-Nav2 side to read data sent from Nav2.
* @param data a pointer to a data area where the data will be
* written.
* @param length the length of the data area.
* @return the number of bytes written to data.*/
int read(uint8* data, int length);
/** Used from the non-Nav2 side to read data sent from Nav2.
* @param buf a Buffer that will receive the data. */
bool read(class Buffer* buf);
/** Checks how much data is available that has been sent from Nav2.
* This is a blocking function, and not recursively so.
* @return the amount of bytes available to read.*/
int available() const;
/** Tests if the I/O-queue is empty.
* @return true of no data is in the queue. */
bool empty() const;
#ifdef __SYMBIAN32__
/** Signal that the caller wants to be notified of when more data
* becomes available for reading. */
void armReader(TRequestStatus *aStatus);
void cancelArm();
#endif
int getPollInterval() const;
private:
///This function is private as it is meant only for internal
///use. This function accesses member data without first
///locking the mutex, which means it may only be called from
///within a critical region.
///@return the amount of bytes available to read.*/
int internalAvailable() const;
protected:
void removeOverflow();
/** This function is used in this class to send messages to the
* Module immediatly above us, i.e. closer to the CtrlHub. */
class SerialConsumerPublic * rootPublic();
/** Decoder for SerialProvider-messages */
SerialProviderDecoder m_providerDecoder;
/** Decides what should be done with incoming Buffers. */
virtual class MsgBuffer * dispatch(class MsgBuffer *buf);
/** The queue where data from nav2 is stored until it is read out
* with one of the read methods.*/
Container m_outQue;
/** A mutex to protect the queue.*/
mutable Mutex m_outMutex;
///connectsState is very relative. Let the state be connected as
///soon as the other end tries to read. for the first time.
enum ConnectionNotify m_connectState;
///The recommended Poll interval for this QueueSerial. In microseconds.
int m_pollInterval;
OverflowPolicy* m_policy;
std::queue<class Buffer*> m_incoming;
#ifdef __SYMBIAN32__
TThreadId m_guiSideThread;
TRequestStatus *m_guiSideRequestStatus;
#endif
};
inline int QueueSerial::getPollInterval() const
{
return m_pollInterval;
}
inline void QueueSerial::removeOverflow()
{
if(m_policy)m_policy->clean(m_outQue);
}
class KeepLatestGuiMessage : public QueueSerial::OverflowPolicy{
public:
virtual void clean(QueueSerial::Container& deq);
typedef QueueSerial::Container argument_type;
typedef void result_type;
result_type operator()(argument_type& deq)
{
clean(deq);
}
};
class KeepLatestBuffer : public QueueSerial::OverflowPolicy{
public:
virtual void clean(QueueSerial::Container& deq);
typedef QueueSerial::Container argument_type;
typedef void result_type;
result_type operator()(argument_type& deq)
{
clean(deq);
}
};
class RemoveGpsAndRoute : public QueueSerial::OverflowPolicy{
public:
virtual void clean(QueueSerial::Container& deq);
typedef QueueSerial::Container argument_type;
typedef void result_type;
result_type operator()(argument_type& deq)
{
clean(deq);
}
};
} /* namespace isab */
#endif
|
[
"[email protected]"
] |
[
[
[
1,
188
]
]
] |
11ccf17bf9de5cb0566589d9eff1aa2cc4f65499
|
b90f7dce513fd3d13bab0b8769960dea901d4f3b
|
/game_client/game_client/Http.h
|
1de9c1e87a41f31ebea6b943035a5a721da3c0cf
|
[] |
no_license
|
lasti15/easygametools
|
f447052cd4c42609955abd76b4c8571422816b11
|
0b819c957077a4eeaf9a2492772040dafdfca4c3
|
refs/heads/master
| 2021-01-10T09:14:52.182154 | 2011-03-09T01:51:51 | 2011-03-09T01:51:51 | 55,684,684 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 305 |
h
|
#ifndef __HTTP_H
#define __HTTP_H
#include <cstring>
#include <cctype>
namespace ROG {
typedef enum {HTTP_OK = 200, HTTP_ERR = 500} HttpStatus;
class Http {
public:
const static int getStatus(char* response);
const static char* getData(char* response);
};
}
#endif
|
[
"[email protected]"
] |
[
[
[
1,
22
]
]
] |
bac231d922f7f0bef0be719cf231c455c3ca95f2
|
a25ae39364a71855afdb33978b8f3e092ada9df2
|
/GGChess/GGChess/Common/terrain.cpp
|
f84a0c398c1a706990ba3c8c691e721f761726b2
|
[] |
no_license
|
yotamgi/ggchess
|
ef803468f089901e1a32d45dc4d8e629548e5057
|
92fee6cef59e259a75c05c5ad1a1deef4a62178d
|
refs/heads/master
| 2021-01-10T22:01:39.501543 | 2008-12-19T10:21:33 | 2008-12-19T10:21:33 | 35,048,046 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 12,882 |
cpp
|
//////////////////////////////////////////////////////////////////////////////////////////////////
//
// File: terrain.cpp
//
// Author: Frank Luna (C) All Rights Reserved
//
// System: AMD Athlon 1800+ XP, 512 DDR, Geforce 3, Windows XP, MSVC++ 7.0
//
// Desc: Represents a 3D terrain.
//
//////////////////////////////////////////////////////////////////////////////////////////////////
#include "terrain.h"
#include <fstream>
#include <cmath>
const DWORD Terrain::TerrainVertex::FVF = D3DFVF_XYZ | D3DFVF_TEX1;
Terrain::Terrain(IDirect3DDevice9* device,
std::string heightmapFileName,
int numVertsPerRow,
int numVertsPerCol,
int cellSpacing,
float heightScale)
{
_device = device;
_numVertsPerRow = numVertsPerRow;
_numVertsPerCol = numVertsPerCol;
_cellSpacing = cellSpacing;
_numCellsPerRow = _numVertsPerRow - 1;
_numCellsPerCol = _numVertsPerCol - 1;
_width = _numCellsPerRow * _cellSpacing;
_depth = _numCellsPerCol * _cellSpacing;
_numVertices = _numVertsPerRow * _numVertsPerCol;
_numTriangles = _numCellsPerRow * _numCellsPerCol * 2;
_heightScale = heightScale;
// load heightmap
if( !readRawFile(heightmapFileName) )
{
::MessageBoxA(0, "readRawFile - FAILED", 0, 0);
::PostQuitMessage(0);
}
// scale heights
for(int i = 0; i < _heightmap.size(); i++)
_heightmap[i] *= heightScale;
// compute the vertices
if( !computeVertices() )
{
::MessageBoxA(0, "computeVertices - FAILED", 0, 0);
::PostQuitMessage(0);
}
// compute the indices
if( !computeIndices() )
{
::MessageBoxA(0, "computeIndices - FAILED", 0, 0);
::PostQuitMessage(0);
}
}
Terrain::~Terrain()
{
d3d::Release<IDirect3DVertexBuffer9*>(_vb);
d3d::Release<IDirect3DIndexBuffer9*>(_ib);
d3d::Release<IDirect3DTexture9*>(_tex);
}
int Terrain::getHeightmapEntry(int row, int col)
{
return _heightmap[row * _numVertsPerRow + col];
}
void Terrain::setHeightmapEntry(int row, int col, int value)
{
_heightmap[row * _numVertsPerRow + col] = value;
}
bool Terrain::computeVertices()
{
HRESULT hr = 0;
hr = _device->CreateVertexBuffer(
_numVertices * sizeof(TerrainVertex),
D3DUSAGE_WRITEONLY,
TerrainVertex::FVF,
D3DPOOL_MANAGED,
&_vb,
0);
if(FAILED(hr))
return false;
// coordinates to start generating vertices at
int startX = -_width / 2;
int startZ = _depth / 2;
// coordinates to end generating vertices at
int endX = _width / 2;
int endZ = -_depth / 2;
// compute the increment size of the texture coordinates
// from one vertex to the next.
float uCoordIncrementSize = 1.0f / (float)_numCellsPerRow;
float vCoordIncrementSize = 1.0f / (float)_numCellsPerCol;
TerrainVertex* v = 0;
_vb->Lock(0, 0, (void**)&v, 0);
int i = 0;
for(int z = startZ; z >= endZ; z -= _cellSpacing)
{
int j = 0;
for(int x = startX; x <= endX; x += _cellSpacing)
{
// compute the correct index into the vertex buffer and heightmap
// based on where we are in the nested loop.
int index = i * _numVertsPerRow + j;
v[index] = TerrainVertex(
(float)x,
(float)_heightmap[index],
(float)z,
(float)j * uCoordIncrementSize,
(float)i * vCoordIncrementSize);
j++; // next column
}
i++; // next row
}
_vb->Unlock();
return true;
}
bool Terrain::computeIndices()
{
HRESULT hr = 0;
hr = _device->CreateIndexBuffer(
_numTriangles * 3 * sizeof(WORD), // 3 indices per triangle
D3DUSAGE_WRITEONLY,
D3DFMT_INDEX16,
D3DPOOL_MANAGED,
&_ib,
0);
if(FAILED(hr))
return false;
WORD* indices = 0;
_ib->Lock(0, 0, (void**)&indices, 0);
// index to start of a group of 6 indices that describe the
// two triangles that make up a quad
int baseIndex = 0;
// loop through and compute the triangles of each quad
for(int i = 0; i < _numCellsPerCol; i++)
{
for(int j = 0; j < _numCellsPerRow; j++)
{
indices[baseIndex] = i * _numVertsPerRow + j;
indices[baseIndex + 1] = i * _numVertsPerRow + j + 1;
indices[baseIndex + 2] = (i+1) * _numVertsPerRow + j;
indices[baseIndex + 3] = (i+1) * _numVertsPerRow + j;
indices[baseIndex + 4] = i * _numVertsPerRow + j + 1;
indices[baseIndex + 5] = (i+1) * _numVertsPerRow + j + 1;
// next quad
baseIndex += 6;
}
}
_ib->Unlock();
return true;
}
bool Terrain::loadTexture(std::string fileName)
{
HRESULT hr = 0;
hr = D3DXCreateTextureFromFile(
_device,
(LPCWSTR)fileName.c_str(),
&_tex);
if(FAILED(hr))
return false;
return true;
}
bool Terrain::genTexture(D3DXVECTOR3* directionToLight)
{
// Method fills the top surface of a texture procedurally. Then
// lights the top surface. Finally, it fills the other mipmap
// surfaces based on the top surface data using D3DXFilterTexture.
HRESULT hr = 0;
// texel for each quad cell
int texWidth = _numCellsPerRow;
int texHeight = _numCellsPerCol;
// create an empty texture
hr = D3DXCreateTexture(
_device,
texWidth, texHeight,
0, // create a complete mipmap chain
0, // usage
D3DFMT_X8R8G8B8,// 32 bit XRGB format
D3DPOOL_MANAGED, &_tex);
if(FAILED(hr))
return false;
D3DSURFACE_DESC textureDesc;
_tex->GetLevelDesc(0 /*level*/, &textureDesc);
// make sure we got the requested format because our code
// that fills the texture is hard coded to a 32 bit pixel depth.
if( textureDesc.Format != D3DFMT_X8R8G8B8 )
return false;
D3DLOCKED_RECT lockedRect;
_tex->LockRect(0/*lock top surface*/, &lockedRect,
0 /* lock entire tex*/, 0/*flags*/);
DWORD* imageData = (DWORD*)lockedRect.pBits;
for(int i = 0; i < texHeight; i++)
{
for(int j = 0; j < texWidth; j++)
{
D3DXCOLOR c;
// get height of upper left vertex of quad.
float height = (float)getHeightmapEntry(i, j) / _heightScale;
if( (height) < 42.5f ) c = d3d::BEACH_SAND;
else if( (height) < 85.0f ) c = d3d::LIGHT_YELLOW_GREEN;
else if( (height) < 127.5f ) c = d3d::PUREGREEN;
else if( (height) < 170.0f ) c = d3d::DARK_YELLOW_GREEN;
else if( (height) < 212.5f ) c = d3d::DARKBROWN;
else c = d3d::WHITE;
// fill locked data, note we divide the pitch by four because the
// pitch is given in bytes and there are 4 bytes per DWORD.
imageData[i * lockedRect.Pitch / 4 + j] = (D3DCOLOR)c;
}
}
_tex->UnlockRect(0);
if(!lightTerrain(directionToLight))
{
::MessageBoxA(0, "lightTerrain() - FAILED", 0, 0);
return false;
}
hr = D3DXFilterTexture(
_tex,
0, // default palette
0, // use top level as source level
D3DX_DEFAULT); // default filter
if(FAILED(hr))
{
::MessageBoxA(0, "D3DXFilterTexture() - FAILED", 0, 0);
return false;
}
return true;
}
bool Terrain::lightTerrain(D3DXVECTOR3* directionToLight)
{
HRESULT hr = 0;
D3DSURFACE_DESC textureDesc;
_tex->GetLevelDesc(0 /*level*/, &textureDesc);
// make sure we got the requested format because our code that fills the
// texture is hard coded to a 32 bit pixel depth.
if( textureDesc.Format != D3DFMT_X8R8G8B8 )
return false;
D3DLOCKED_RECT lockedRect;
_tex->LockRect(
0, // lock top surface level in mipmap chain
&lockedRect,// pointer to receive locked data
0, // lock entire texture image
0); // no lock flags specified
DWORD* imageData = (DWORD*)lockedRect.pBits;
for(int i = 0; i < textureDesc.Height; i++)
{
for(int j = 0; j < textureDesc.Width; j++)
{
// index into texture, note we use the pitch and divide by
// four since the pitch is given in bytes and there are
// 4 bytes per DWORD.
int index = i * lockedRect.Pitch / 4 + j;
// get current color of quad
D3DXCOLOR c( imageData[index] );
// shade current quad
c *= computeShade(i, j, directionToLight);;
// save shaded color
imageData[index] = (D3DCOLOR)c;
}
}
_tex->UnlockRect(0);
return true;
}
float Terrain::computeShade(int cellRow, int cellCol, D3DXVECTOR3* directionToLight)
{
// get heights of three vertices on the quad
float heightA = getHeightmapEntry(cellRow, cellCol);
float heightB = getHeightmapEntry(cellRow, cellCol+1);
float heightC = getHeightmapEntry(cellRow+1, cellCol);
// build two vectors on the quad
D3DXVECTOR3 u(_cellSpacing, heightB - heightA, 0.0f);
D3DXVECTOR3 v(0.0f, heightC - heightA, -_cellSpacing);
// find the normal by taking the cross product of two
// vectors on the quad.
D3DXVECTOR3 n;
D3DXVec3Cross(&n, &u, &v);
D3DXVec3Normalize(&n, &n);
float cosine = D3DXVec3Dot(&n, directionToLight);
if(cosine < 0.0f)
cosine = 0.0f;
return cosine;
}
bool Terrain::readRawFile(std::string fileName)
{
// Restriction: RAW file dimensions must be >= to the
// dimensions of the terrain. That is a 128x128 RAW file
// can only be used with a terrain constructed with at most
// 128x128 vertices.
// A height for each vertex
std::vector<BYTE> in( _numVertices );
std::ifstream inFile(fileName.c_str(), std::ios_base::binary);
if( inFile == 0 )
return false;
inFile.read(
(char*)&in[0], // buffer
in.size());// number of bytes to read into buffer
inFile.close();
// copy BYTE vector to int vector
_heightmap.resize( _numVertices );
for(int i = 0; i < in.size(); i++)
_heightmap[i] = in[i];
return true;
}
float Terrain::getHeight(float x, float z)
{
// Translate on xz-plane by the transformation that takes
// the terrain START point to the origin.
x = ((float)_width / 2.0f) + x;
z = ((float)_depth / 2.0f) - z;
// Scale down by the transformation that makes the
// cellspacing equal to one. This is given by
// 1 / cellspacing since; cellspacing * 1 / cellspacing = 1.
x /= (float)_cellSpacing;
z /= (float)_cellSpacing;
// From now on, we will interpret our positive z-axis as
// going in the 'down' direction, rather than the 'up' direction.
// This allows to extract the row and column simply by 'flooring'
// x and z:
float col = ::floorf(x);
float row = ::floorf(z);
// get the heights of the quad we're in:
//
// A B
// *---*
// | / |
// *---*
// C D
float A = getHeightmapEntry(row, col);
float B = getHeightmapEntry(row, col+1);
float C = getHeightmapEntry(row+1, col);
float D = getHeightmapEntry(row+1, col+1);
//
// Find the triangle we are in:
//
// Translate by the transformation that takes the upper-left
// corner of the cell we are in to the origin. Recall that our
// cellspacing was nomalized to 1. Thus we have a unit square
// at the origin of our +x -> 'right' and +z -> 'down' system.
float dx = x - col;
float dz = z - row;
// Note the below compuations of u and v are unneccessary, we really
// only need the height, but we compute the entire vector to emphasis
// the books discussion.
float height = 0.0f;
if(dz < 1.0f - dx) // upper triangle ABC
{
float uy = B - A; // A->B
float vy = C - A; // A->C
// Linearly interpolate on each vector. The height is the vertex
// height the vectors u and v originate from {A}, plus the heights
// found by interpolating on each vector u and v.
height = A + d3d::Lerp(0.0f, uy, dx) + d3d::Lerp(0.0f, vy, dz);
}
else // lower triangle DCB
{
float uy = C - D; // D->C
float vy = B - D; // D->B
// Linearly interpolate on each vector. The height is the vertex
// height the vectors u and v originate from {D}, plus the heights
// found by interpolating on each vector u and v.
height = D + d3d::Lerp(0.0f, uy, 1.0f - dx) + d3d::Lerp(0.0f, vy, 1.0f - dz);
}
return height;
}
bool Terrain::draw(D3DXMATRIX* world, bool drawTris)
{
HRESULT hr = 0;
if( _device )
{
_device->SetTransform(D3DTS_WORLD, world);
_device->SetStreamSource(0, _vb, 0, sizeof(TerrainVertex));
_device->SetFVF(TerrainVertex::FVF);
_device->SetIndices(_ib);
_device->SetTexture(0, _tex);
// turn off lighting since we're lighting it ourselves
_device->SetRenderState(D3DRS_LIGHTING, false);
hr =_device->DrawIndexedPrimitive(
D3DPT_TRIANGLELIST,
0,
0,
_numVertices,
0,
_numTriangles);
_device->SetRenderState(D3DRS_LIGHTING, true);
if( drawTris )
{
_device->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
hr =_device->DrawIndexedPrimitive(
D3DPT_TRIANGLELIST,
0,
0,
_numVertices,
0,
_numTriangles);
_device->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
}
if(FAILED(hr))
return false;
}
return true;
}
|
[
"yotam.gi@f2da17e6-a22b-11dd-9dc9-65bc890fb60a"
] |
[
[
[
1,
505
]
]
] |
3e3fa74f3b0d0b1bf179bc755ecdc45937cf581e
|
a04058c189ce651b85f363c51f6c718eeb254229
|
/Src/Forms/M411EnterZipForm.hpp
|
9abbb72caf0c4f870a09be1b59bb4b037f5db373
|
[] |
no_license
|
kjk/moriarty-palm
|
090f42f61497ecf9cc232491c7f5351412fba1f3
|
a83570063700f26c3553d5f331968af7dd8ff869
|
refs/heads/master
| 2016-09-05T19:04:53.233536 | 2006-04-04T06:51:31 | 2006-04-04T06:51:31 | 18,799 | 4 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 805 |
hpp
|
#ifndef __M411_ENTER_ZIP_FORM_HPP__
#define __M411_ENTER_ZIP_FORM_HPP__
#include "MoriartyForm.hpp"
class M411EnterZipForm: public MoriartyForm
{
Field locationField_;
void handleControlSelect(const EventType& data);
public:
enum FormMode
{
m411zipMode,
gasPricesMode
};
protected:
void attachControls();
void resize(const ArsRectangle& screenBounds);
bool handleEvent(EventType& event);
private:
FormMode formMode_;
public:
M411EnterZipForm(MoriartyApplication& app):
MoriartyForm(app, m411EnterZipForm, true),
locationField_(*this),
formMode_(m411zipMode)
{
setFocusControlId(locationField);
}
~M411EnterZipForm();
};
#endif
|
[
"andrzejc@a75a507b-23da-0310-9e0c-b29376b93a3c"
] |
[
[
[
1,
45
]
]
] |
e14e248bf299d699d5aefa8dd7d873691d04f9f0
|
fbd2deaa66c52fc8c38baa90dd8f662aabf1f0dd
|
/totalFirePower/ta demo/code/Bitmap.cpp
|
73f8789d25a990c9021a515d0993816e30534a65
|
[] |
no_license
|
arlukin/dev
|
ea4f62f3a2f95e1bd451fb446409ab33e5c0d6e1
|
b71fa9e9d8953e33f25c2ae7e5b3c8e0defd18e0
|
refs/heads/master
| 2021-01-15T11:29:03.247836 | 2011-02-24T23:27:03 | 2011-02-24T23:27:03 | 1,408,455 | 2 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 3,743 |
cpp
|
// Bitmap.cpp: implementation of the CBitmap class.
//
//////////////////////////////////////////////////////////////////////
#include "Bitmap.h"
#include <GL\glaux.h>
#include <ostream>
#include <fstream>
#include "jpeglib.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CBitmap::CBitmap()
: xsize(1),
ysize(1)
{
mem=new unsigned char[4];
}
CBitmap::~CBitmap()
{
if(mem!=0)
delete[] mem;
}
CBitmap::CBitmap(unsigned char *data, int xsize, int ysize)
: xsize(xsize),
ysize(ysize)
{
mem=new unsigned char[xsize*ysize*4];
memcpy(mem,data,xsize*ysize*4);
}
CBitmap::CBitmap(string filename)
: mem(0),
xsize(0),
ysize(0)
{
Load(filename);
}
void CBitmap::Load(string filename)
{
if(mem!=0)
delete[] mem;
if(filename.find(".jpg")!=string::npos)
LoadJPG(filename);
else
LoadBMP(filename);
}
void CBitmap::Save(string filename)
{
char* buf=new char[xsize*ysize*3];
for(int a=0;a<xsize*ysize;a++){
buf[a*3]=mem[a*4+2];
buf[a*3+1]=mem[a*4+1];
buf[a*3+2]=mem[a*4];
}
BITMAPFILEHEADER bmfh;
bmfh.bfType=('B')+('M'<<8);
bmfh.bfSize=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+ysize*xsize*3;
bmfh.bfReserved1=0;
bmfh.bfReserved2=0;
bmfh.bfOffBits=sizeof(BITMAPINFOHEADER)+sizeof(BITMAPFILEHEADER);
BITMAPINFOHEADER bmih;
bmih.biSize=sizeof(BITMAPINFOHEADER);
bmih.biWidth=xsize;
bmih.biHeight=ysize;
bmih.biPlanes=1;
bmih.biBitCount=24;
bmih.biCompression=BI_RGB;
bmih.biSizeImage=0;
bmih.biXPelsPerMeter=1000;
bmih.biYPelsPerMeter=1000;
bmih.biClrUsed=0;
bmih.biClrImportant=0;
std::ofstream ofs(filename.c_str(), std::ios::out|std::ios::binary);
if(ofs.bad() || !ofs.is_open())
MessageBox(0,"Couldnt save file",filename.c_str(),0);
ofs.write((char*)&bmfh,sizeof(bmfh));
ofs.write((char*)&bmih,sizeof(bmih));
ofs.write((char*)buf,xsize*ysize*3);
delete[] buf;
}
void CBitmap::LoadBMP(string filename)
{
AUX_RGBImageRec *TextureImage=auxDIBImageLoad(filename.c_str());
if (TextureImage){
xsize=TextureImage->sizeX;
ysize=TextureImage->sizeY;
mem=new unsigned char[xsize*ysize*4];
for(int a=0;a<xsize*ysize;++a){
mem[a*4]=TextureImage->data[a*3];
mem[a*4+1]=TextureImage->data[a*3+1];
mem[a*4+2]=TextureImage->data[a*3+2];
mem[a*4+3]=255;
}
if (TextureImage->data)
{
free(TextureImage->data);
}
free(TextureImage);
} else {
xsize=1;
ysize=1;
mem=new unsigned char[4];
}
}
void CBitmap::LoadJPG(string filename)
{
struct jpeg_decompress_struct cinfo;
jpeg_error_mgr jerr;
FILE *pFile;
if((pFile = fopen(filename.c_str(), "rb")) == NULL)
{
// Display an error message saying the file was not found, then return NULL
MessageBox(0, "Unable to load JPG File!", "Error", MB_OK);
return;
}
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo);
jpeg_stdio_src(&cinfo, pFile);
jpeg_read_header(&cinfo, TRUE);
jpeg_start_decompress(&cinfo);
int rowSpan = cinfo.image_width * cinfo.num_components;
xsize = cinfo.image_width;
ysize = cinfo.image_height;
unsigned char* tempLine=new unsigned char[rowSpan];
mem=new unsigned char[xsize*ysize*4];
for(int y=0;y<ysize;++y){
jpeg_read_scanlines(&cinfo, &tempLine, 1);
for(int x=0;x<xsize;++x){
mem[((ysize-1-y)*xsize+x)*4+0]=tempLine[x*3];
mem[((ysize-1-y)*xsize+x)*4+1]=tempLine[x*3+1];
mem[((ysize-1-y)*xsize+x)*4+2]=tempLine[x*3+2];
mem[((ysize-1-y)*xsize+x)*4+3]=255;
}
}
delete[] tempLine;
jpeg_destroy_decompress(&cinfo);
fclose(pFile);
}
|
[
"[email protected]"
] |
[
[
[
1,
160
]
]
] |
aef5e22409944cc024002aa0ae7d226572faba50
|
d115cf7a1b374d857f6b094d4b4ccd8e9b1ac189
|
/pyplusplus_dev/unittests/data/ctypes/templates/templates.h
|
b77335f711030ce7e85904826052790c427785f0
|
[
"BSL-1.0"
] |
permissive
|
gatoatigrado/pyplusplusclone
|
30af9065fb6ac3dcce527c79ed5151aade6a742f
|
a64dc9aeeb718b2f30bd6a5ff8dcd8bfb1cd2ede
|
refs/heads/master
| 2016-09-05T23:32:08.595261 | 2010-05-16T10:53:45 | 2010-05-16T10:53:45 | 700,369 | 4 | 2 | null | null | null | null |
UTF-8
|
C++
| false | false | 232 |
h
|
#include "libconfig.h"
template< class ValueType >
struct value_t{
ValueType get_value(){ return value;}
ValueType value;
};
void EXPORT_SYMBOL init( value_t<int>& );
template class EXPORT_SYMBOL value_t<int>;
|
[
"roman_yakovenko@dc5859f9-2512-0410-ae5c-dd123cda1f76"
] |
[
[
[
1,
11
]
]
] |
cce860a152a13e6b104c66f11f9444d43064c387
|
6dac9369d44799e368d866638433fbd17873dcf7
|
/src/branches/26042005/fusioncore/Fusion.cpp
|
d52fe9bf917ba32ceae21ed70b280d3427dddf16
|
[] |
no_license
|
christhomas/fusionengine
|
286b33f2c6a7df785398ffbe7eea1c367e512b8d
|
95422685027bb19986ba64c612049faa5899690e
|
refs/heads/master
| 2020-04-05T22:52:07.491706 | 2006-10-24T11:21:28 | 2006-10-24T11:21:28 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 8,054 |
cpp
|
#include <Fusion.h>
#ifdef _WIN32
#include <Win32ModuleDB.h>
#else
#include <UnixModuleDB.h>
#endif
void WindowActivateEvent( bool activate ){}
void WindowDestroyEvent( void ){}
/**
* Fusion Engine Constructor.
*
* Creates the m_moduledb and m_platformdata objects,
* assigns all ptrs to null, sets the default active state to true
*/
Fusion::Fusion()
{
// Setup the errlog system
errlog.enableFile("errlog.txt");
#ifdef _WIN32
m_moduledb = new Win32ModuleDB;
m_platform = new Win32PlatformData;
#else
// Create Unix ModuleDB + Platform class here
m_moduledb = new UnixModuleDB;
m_platform = new UnixPlatformData;
#endif
m_platform->Initialise();
m_active = true;
Graphics = NULL;
Input = NULL;
Mesh = NULL;
Scene = NULL;
Interface = NULL;
Font = NULL;
Sound = NULL;
Network = NULL;
vfs = NULL;
// Null out the lib filename, create + destroy ptrs for all the supported objects
for ( int a = 0;a < numsystems;a++ )
{
m_libfilename[ a ] = NULL;
create[ a ] = NULL;
destroy[ a ] = NULL;
}
}
/**
* Fusion Engine Deconstructor.
*
* Deletes all the requested subsystems,
* also the IModuleDB and PlatformData objects
*/
Fusion::~Fusion()
{
// Unload all the DLL modules
UnloadModules();
// Delete all the platform data
delete m_platform;
// Delete all the module data
delete m_moduledb;
m_moduledb = NULL;
}
/**
* Updates the Fusion system and all it's subobjects that are initialised
*
* If Fusion is active it will:
* -# update the Input,
* -# update the UserInterface
* -# update the SceneGraphDB
* -# update the Graphics system
*
* @returns boolean true or false, depending on whether the Input, Interface and Scenegraph objects rendered ok
*
* If the Input, Interface or Scenegraph objects dont exist, this object will not return false, it will just skip their update methods.
*
* Regardless of whether the Fusion Engine is active or not,
* it will update the Graphic' Window message loop for
* obvious reasons, if it didnt update, how can the user
* click the Maximise or Close buttons?
*/
bool Fusion::Update( void )
{
Graphics->Window->MessageLoop();
if ( m_active == true )
{
if ( Input != NULL )
{
if ( Input->Update() == false )
{
return false;
}
}
if ( Interface->Update() == false )
return false;
if ( Scene->RenderScene() == false )
return false;
Graphics->Update();
}
return true;
}
/**
* Sets whether to pause the Fusion Engine or not
*
* @param active Tells whether to pause Fusion' execution or not
*/
void Fusion::Pause( bool active )
{
m_active = active;
}
/**
* Tells Fusion to load a configuration file
*
* @param configfile char pointer to config filename
*
* This method will search through the config file, if it parses [FUSION]
* it'll happily start extracting data from that section, until the next
* section is detected (which, incidentally starts with "["). Upon reading
* a valid command, the data section will be removed (part of the string
* after the = in each valid command line) and compared against what
* Fusion is programmed to cope with, upon getting a correct comparison
* from the command, the data section will be tagged into the appropiate
* place in the internal configuration data, to be used later
*/
void Fusion::LoadConfig( char *configfile )
{
// FIXME: Should probably move all this to use STL more
// considering it's 2-3 years old, I didnt know STL then
// should fix it now I know better
bool begin = false;
char buffer[ 2048 ];
std::ifstream config( configfile );
std::ofstream output( "output.txt" );
output << "LoadConfig" << std::endl;
// Did the file open successfully?
if ( config.is_open() == false )
return ;
// Parse the config file, pull out all the data in the [Fusion] section
while ( config.eof() == 0 )
{
config.getline( buffer, 2048 );
// Start reading the config file only when you reach the Fusion section
if ( strcmp( buffer, "[FUSION]" ) == 0 )
{
begin = true;
continue;
}
// End reading when you read the next section (each section starts like [SECTION] or [ANOTHERSECTION]
if ( ( begin == true ) && ( strncmp( buffer, "[", 1 ) == 0 ) )
{
break;
}
// Ignore any blank lines
if ( strcmp( buffer, "\0" ) == 0 )
{
continue;
}
// If begun, process config data
if ( begin == true )
{
char * command = strtok( buffer, "=" );
if ( command != NULL )
{
char * temp = strtok( &buffer[ strlen( command ) + 1 ], "\n" );
char *param = new char[ strlen( temp ) + 1 ];
strcpy( param, temp );
output << "command:param = " << command << ":" << param << std::endl;
for ( int a = 0;a < numsystems;a++ )
{
if ( m_libfilename[ a ] == NULL ){
output << "m_filename[" << a << "] = " << (int *) m_libfilename[ a ] << std::endl;
}else{
output << "m_filename[" << a << "] = " << m_libfilename[ a ] << std::endl;
}
}
output << std::endl;
if ( strcmp( command, "MODULEDB" ) == 0 )
{
m_moduledb->AddPath( param );
continue;
}
if ( strcmp( command, "GRAPHICS" ) == 0 )
{
m_libfilename[ GRAPHICS ] = param;
continue;
}
if ( strcmp( command, "INPUT" ) == 0 )
{
m_libfilename[ INPUT ] = param;
continue;
}
if ( strcmp( command, "SOUND" ) == 0 )
{
m_libfilename[ SOUND ] = param;
continue;
}
if ( strcmp( command, "VFS" ) == 0 )
{
m_libfilename[ VFS ] = param;
continue;
}
if ( strcmp( command, "NETWORK" ) == 0 )
{
m_libfilename[ NETWORK ] = param;
continue;
}
delete[] param;
}
}
}
config.close();
}
/**
* Tells Fusion to initialise a supported subsystem
*
* @param id Fusion::Subsystem
*
* Attempts to retrieve a function ptr from the dll module which owns
* the subsystem requested, if successful, it'll call the subsystem's
* create method, and a new Subsystem will be available
*/
void Fusion::InitSystem( Fusion::Subsystem id, create_t c )
{
if ( id < numsystems )
{
if ( c != NULL )
{
create[ id ] = c;
destroy[ id ] = NULL;
}
else
{
create[ id ] = ( create_t ) m_moduledb->GetFunction( m_libfilename[ id ], ( char * ) "GetInstance" );
destroy[ id ] = ( destroy_t ) m_moduledb->GetFunction( m_libfilename[ id ], ( char * ) "DestroyInstance" );
}
if ( create[ id ] != NULL )
create[ id ] ( *this );
if ( id == GRAPHICS )
{
Graphics->ActivateEvent = WindowActivateEvent;
Graphics->DestroyEvent = WindowDestroyEvent;
}
}
}
/** Unloads all the DLL based modules from the system
*
* Example of use:
* If fusion system is shutting down some applications
* require early release of all DLL modules because their
* files are to be deleted from the disk, DLL modules
* can't be deleted whilst they are opened by the
* application, so they have to be closed first then
* removed from the disk
*/
void Fusion::UnloadModules( void )
{
for ( int a = 0;a < numsystems;a++ )
{
// Delete all initialised DLL Modules
if ( destroy[ a ] != NULL )
{
destroy[ a ] ();
destroy[ a ] = NULL;
if ( m_moduledb->UnloadModule( m_libfilename[ a ] ) == true )
{
// success code
}
else
{
// failure code
}
delete[] m_libfilename[ a ];
}
}
m_moduledb->UnloadAll();
}
/**
* Retrieves a pointer to the Fusion systems Platform specific data
*
* @return Pointer to the Platform Data
*/
PlatformData * Fusion::GetPlatformData( void )
{
return m_platform;
}
/**
* Retrieves a pointer to the Fusion systems DLL Module Database
*
* @return Pointer to the DLL Module Database
*/
IModuleDB * Fusion::GetModuleDB( void )
{
return m_moduledb;
}
|
[
"chris_a_thomas@1bf15c89-c11e-0410-aefd-b6ca7aeaabe7"
] |
[
[
[
1,
332
]
]
] |
d04bfe663d719b97ef8e6024516a504f13dcbe57
|
3d677d3bcbd5322bd814adae4d6c6cf45dc67666
|
/JuceLibraryCode/modules/juce_core/text/juce_String.h
|
a40a36df05be626b777d5f859a1dadd3e8c52b28
|
[] |
no_license
|
sonic59/JuceS2Text
|
281e5fc7fa31e715b4d7b1459181637e4f684974
|
e116dc0dfc20222028bab0180f6b93b2f8a2c40c
|
refs/heads/master
| 2016-09-10T18:40:38.239670 | 2011-11-25T17:37:21 | 2011-11-25T17:37:21 | 2,850,515 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 62,026 |
h
|
/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-11 by Raw Material Software Ltd.
------------------------------------------------------------------------------
JUCE can be redistributed and/or modified under the terms of the GNU General
Public License (Version 2), as published by the Free Software Foundation.
A copy of the license is included in the JUCE distribution, or can be found
online at www.gnu.org/licenses.
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.rawmaterialsoftware.com/juce for more information.
==============================================================================
*/
#ifndef __JUCE_STRING_JUCEHEADER__
#define __JUCE_STRING_JUCEHEADER__
#include "juce_CharacterFunctions.h"
#ifndef JUCE_STRING_UTF_TYPE
#define JUCE_STRING_UTF_TYPE 8
#endif
#if JUCE_MSVC
#pragma warning (push)
#pragma warning (disable: 4514 4996)
#endif
#include "../memory/juce_Atomic.h"
#include "juce_CharPointer_UTF8.h"
#include "juce_CharPointer_UTF16.h"
#include "juce_CharPointer_UTF32.h"
#include "juce_CharPointer_ASCII.h"
#if JUCE_MSVC
#pragma warning (pop)
#endif
class OutputStream;
//==============================================================================
/**
The JUCE String class!
Using a reference-counted internal representation, these strings are fast
and efficient, and there are methods to do just about any operation you'll ever
dream of.
@see StringArray, StringPairArray
*/
class JUCE_API String
{
public:
//==============================================================================
/** Creates an empty string.
@see empty
*/
String() noexcept;
/** Creates a copy of another string. */
String (const String& other) noexcept;
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
String (String&& other) noexcept;
#endif
/** Creates a string from a zero-terminated ascii text string.
The string passed-in must not contain any characters with a value above 127, because
these can't be converted to unicode without knowing the original encoding that was
used to create the string. If you attempt to pass-in values above 127, you'll get an
assertion.
To create strings with extended characters from UTF-8, you should explicitly call
String (CharPointer_UTF8 ("my utf8 string..")). It's *highly* recommended that you
use UTF-8 with escape characters in your source code to represent extended characters,
because there's no other way to represent unicode strings in a way that isn't dependent
on the compiler, source code editor and platform.
*/
String (const char* text);
/** Creates a string from a string of 8-bit ascii characters.
The string passed-in must not contain any characters with a value above 127, because
these can't be converted to unicode without knowing the original encoding that was
used to create the string. If you attempt to pass-in values above 127, you'll get an
assertion.
To create strings with extended characters from UTF-8, you should explicitly call
String (CharPointer_UTF8 ("my utf8 string..")). It's *highly* recommended that you
use UTF-8 with escape characters in your source code to represent extended characters,
because there's no other way to represent unicode strings in a way that isn't dependent
on the compiler, source code editor and platform.
This will use up the the first maxChars characters of the string (or less if the string
is actually shorter).
*/
String (const char* text, size_t maxChars);
/** Creates a string from a whcar_t character string.
Depending on the platform, this may be treated as either UTF-32 or UTF-16.
*/
String (const wchar_t* text);
/** Creates a string from a whcar_t character string.
Depending on the platform, this may be treated as either UTF-32 or UTF-16.
*/
String (const wchar_t* text, size_t maxChars);
//==============================================================================
/** Creates a string from a UTF-8 character string */
String (const CharPointer_UTF8& text);
/** Creates a string from a UTF-8 character string */
String (const CharPointer_UTF8& text, size_t maxChars);
/** Creates a string from a UTF-8 character string */
String (const CharPointer_UTF8& start, const CharPointer_UTF8& end);
//==============================================================================
/** Creates a string from a UTF-16 character string */
String (const CharPointer_UTF16& text);
/** Creates a string from a UTF-16 character string */
String (const CharPointer_UTF16& text, size_t maxChars);
/** Creates a string from a UTF-16 character string */
String (const CharPointer_UTF16& start, const CharPointer_UTF16& end);
//==============================================================================
/** Creates a string from a UTF-32 character string */
String (const CharPointer_UTF32& text);
/** Creates a string from a UTF-32 character string */
String (const CharPointer_UTF32& text, size_t maxChars);
/** Creates a string from a UTF-32 character string */
String (const CharPointer_UTF32& start, const CharPointer_UTF32& end);
//==============================================================================
/** Creates a string from an ASCII character string */
String (const CharPointer_ASCII& text);
//==============================================================================
/** Creates a string from a single character. */
static String charToString (juce_wchar character);
/** Destructor. */
~String() noexcept;
//==============================================================================
/** This is an empty string that can be used whenever one is needed.
It's better to use this than String() because it explains what's going on
and is more efficient.
*/
static const String empty;
/** This is the character encoding type used internally to store the string.
By setting the value of JUCE_STRING_UTF_TYPE to 8, 16, or 32, you can change the
internal storage format of the String class. UTF-8 uses the least space (if your strings
contain few extended characters), but call operator[] involves iterating the string to find
the required index. UTF-32 provides instant random access to its characters, but uses 4 bytes
per character to store them. UTF-16 uses more space than UTF-8 and is also slow to index,
but is the native wchar_t format used in Windows.
It doesn't matter too much which format you pick, because the toUTF8(), toUTF16() and
toUTF32() methods let you access the string's content in any of the other formats.
*/
#if (JUCE_STRING_UTF_TYPE == 32)
typedef CharPointer_UTF32 CharPointerType;
#elif (JUCE_STRING_UTF_TYPE == 16)
typedef CharPointer_UTF16 CharPointerType;
#elif (JUCE_STRING_UTF_TYPE == 8)
typedef CharPointer_UTF8 CharPointerType;
#else
#error "You must set the value of JUCE_STRING_UTF_TYPE to be either 8, 16, or 32!"
#endif
//==============================================================================
/** Generates a probably-unique 32-bit hashcode from this string. */
int hashCode() const noexcept;
/** Generates a probably-unique 64-bit hashcode from this string. */
int64 hashCode64() const noexcept;
/** Returns the number of characters in the string. */
int length() const noexcept;
//==============================================================================
// Assignment and concatenation operators..
/** Replaces this string's contents with another string. */
String& operator= (const String& other) noexcept;
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
String& operator= (String&& other) noexcept;
#endif
/** Appends another string at the end of this one. */
String& operator+= (const String& stringToAppend);
/** Appends another string at the end of this one. */
String& operator+= (const char* textToAppend);
/** Appends another string at the end of this one. */
String& operator+= (const wchar_t* textToAppend);
/** Appends a decimal number at the end of this string. */
String& operator+= (int numberToAppend);
/** Appends a character at the end of this string. */
String& operator+= (char characterToAppend);
/** Appends a character at the end of this string. */
String& operator+= (wchar_t characterToAppend);
#if ! JUCE_NATIVE_WCHAR_IS_UTF32
/** Appends a character at the end of this string. */
String& operator+= (juce_wchar characterToAppend);
#endif
/** Appends a string to the end of this one.
@param textToAppend the string to add
@param maxCharsToTake the maximum number of characters to take from the string passed in
*/
void append (const String& textToAppend, size_t maxCharsToTake);
/** Appends a string to the end of this one.
@param textToAppend the string to add
@param maxCharsToTake the maximum number of characters to take from the string passed in
*/
template <class CharPointer>
void appendCharPointer (const CharPointer& textToAppend, size_t maxCharsToTake)
{
if (textToAppend.getAddress() != nullptr)
{
size_t extraBytesNeeded = 0;
size_t numChars = 0;
for (CharPointer t (textToAppend); numChars < maxCharsToTake && ! t.isEmpty();)
{
extraBytesNeeded += CharPointerType::getBytesRequiredFor (t.getAndAdvance());
++numChars;
}
if (numChars > 0)
{
const size_t byteOffsetOfNull = getByteOffsetOfEnd();
preallocateBytes (byteOffsetOfNull + extraBytesNeeded);
CharPointerType (addBytesToPointer (text.getAddress(), (int) byteOffsetOfNull)).writeWithCharLimit (textToAppend, (int) (numChars + 1));
}
}
}
/** Appends a string to the end of this one. */
template <class CharPointer>
void appendCharPointer (const CharPointer& textToAppend)
{
if (textToAppend.getAddress() != nullptr)
{
size_t extraBytesNeeded = 0;
for (CharPointer t (textToAppend); ! t.isEmpty();)
extraBytesNeeded += CharPointerType::getBytesRequiredFor (t.getAndAdvance());
if (extraBytesNeeded > 0)
{
const size_t byteOffsetOfNull = getByteOffsetOfEnd();
preallocateBytes (byteOffsetOfNull + extraBytesNeeded);
CharPointerType (addBytesToPointer (text.getAddress(), (int) byteOffsetOfNull)).writeAll (textToAppend);
}
}
}
//==============================================================================
// Comparison methods..
/** Returns true if the string contains no characters.
Note that there's also an isNotEmpty() method to help write readable code.
@see containsNonWhitespaceChars()
*/
inline bool isEmpty() const noexcept { return text[0] == 0; }
/** Returns true if the string contains at least one character.
Note that there's also an isEmpty() method to help write readable code.
@see containsNonWhitespaceChars()
*/
inline bool isNotEmpty() const noexcept { return text[0] != 0; }
/** Case-insensitive comparison with another string. */
bool equalsIgnoreCase (const String& other) const noexcept;
/** Case-insensitive comparison with another string. */
bool equalsIgnoreCase (const wchar_t* other) const noexcept;
/** Case-insensitive comparison with another string. */
bool equalsIgnoreCase (const char* other) const noexcept;
/** Case-sensitive comparison with another string.
@returns 0 if the two strings are identical; negative if this string comes before
the other one alphabetically, or positive if it comes after it.
*/
int compare (const String& other) const noexcept;
/** Case-sensitive comparison with another string.
@returns 0 if the two strings are identical; negative if this string comes before
the other one alphabetically, or positive if it comes after it.
*/
int compare (const char* other) const noexcept;
/** Case-sensitive comparison with another string.
@returns 0 if the two strings are identical; negative if this string comes before
the other one alphabetically, or positive if it comes after it.
*/
int compare (const wchar_t* other) const noexcept;
/** Case-insensitive comparison with another string.
@returns 0 if the two strings are identical; negative if this string comes before
the other one alphabetically, or positive if it comes after it.
*/
int compareIgnoreCase (const String& other) const noexcept;
/** Lexicographic comparison with another string.
The comparison used here is case-insensitive and ignores leading non-alphanumeric
characters, making it good for sorting human-readable strings.
@returns 0 if the two strings are identical; negative if this string comes before
the other one alphabetically, or positive if it comes after it.
*/
int compareLexicographically (const String& other) const noexcept;
/** Tests whether the string begins with another string.
If the parameter is an empty string, this will always return true.
Uses a case-sensitive comparison.
*/
bool startsWith (const String& text) const noexcept;
/** Tests whether the string begins with a particular character.
If the character is 0, this will always return false.
Uses a case-sensitive comparison.
*/
bool startsWithChar (juce_wchar character) const noexcept;
/** Tests whether the string begins with another string.
If the parameter is an empty string, this will always return true.
Uses a case-insensitive comparison.
*/
bool startsWithIgnoreCase (const String& text) const noexcept;
/** Tests whether the string ends with another string.
If the parameter is an empty string, this will always return true.
Uses a case-sensitive comparison.
*/
bool endsWith (const String& text) const noexcept;
/** Tests whether the string ends with a particular character.
If the character is 0, this will always return false.
Uses a case-sensitive comparison.
*/
bool endsWithChar (juce_wchar character) const noexcept;
/** Tests whether the string ends with another string.
If the parameter is an empty string, this will always return true.
Uses a case-insensitive comparison.
*/
bool endsWithIgnoreCase (const String& text) const noexcept;
/** Tests whether the string contains another substring.
If the parameter is an empty string, this will always return true.
Uses a case-sensitive comparison.
*/
bool contains (const String& text) const noexcept;
/** Tests whether the string contains a particular character.
Uses a case-sensitive comparison.
*/
bool containsChar (juce_wchar character) const noexcept;
/** Tests whether the string contains another substring.
Uses a case-insensitive comparison.
*/
bool containsIgnoreCase (const String& text) const noexcept;
/** Tests whether the string contains another substring as a distict word.
@returns true if the string contains this word, surrounded by
non-alphanumeric characters
@see indexOfWholeWord, containsWholeWordIgnoreCase
*/
bool containsWholeWord (const String& wordToLookFor) const noexcept;
/** Tests whether the string contains another substring as a distict word.
@returns true if the string contains this word, surrounded by
non-alphanumeric characters
@see indexOfWholeWordIgnoreCase, containsWholeWord
*/
bool containsWholeWordIgnoreCase (const String& wordToLookFor) const noexcept;
/** Finds an instance of another substring if it exists as a distict word.
@returns if the string contains this word, surrounded by non-alphanumeric characters,
then this will return the index of the start of the substring. If it isn't
found, then it will return -1
@see indexOfWholeWordIgnoreCase, containsWholeWord
*/
int indexOfWholeWord (const String& wordToLookFor) const noexcept;
/** Finds an instance of another substring if it exists as a distict word.
@returns if the string contains this word, surrounded by non-alphanumeric characters,
then this will return the index of the start of the substring. If it isn't
found, then it will return -1
@see indexOfWholeWord, containsWholeWordIgnoreCase
*/
int indexOfWholeWordIgnoreCase (const String& wordToLookFor) const noexcept;
/** Looks for any of a set of characters in the string.
Uses a case-sensitive comparison.
@returns true if the string contains any of the characters from
the string that is passed in.
*/
bool containsAnyOf (const String& charactersItMightContain) const noexcept;
/** Looks for a set of characters in the string.
Uses a case-sensitive comparison.
@returns Returns false if any of the characters in this string do not occur in
the parameter string. If this string is empty, the return value will
always be true.
*/
bool containsOnly (const String& charactersItMightContain) const noexcept;
/** Returns true if this string contains any non-whitespace characters.
This will return false if the string contains only whitespace characters, or
if it's empty.
It is equivalent to calling "myString.trim().isNotEmpty()".
*/
bool containsNonWhitespaceChars() const noexcept;
/** Returns true if the string matches this simple wildcard expression.
So for example String ("abcdef").matchesWildcard ("*DEF", true) would return true.
This isn't a full-blown regex though! The only wildcard characters supported
are "*" and "?". It's mainly intended for filename pattern matching.
*/
bool matchesWildcard (const String& wildcard, bool ignoreCase) const noexcept;
//==============================================================================
// Substring location methods..
/** Searches for a character inside this string.
Uses a case-sensitive comparison.
@returns the index of the first occurrence of the character in this
string, or -1 if it's not found.
*/
int indexOfChar (juce_wchar characterToLookFor) const noexcept;
/** Searches for a character inside this string.
Uses a case-sensitive comparison.
@param startIndex the index from which the search should proceed
@param characterToLookFor the character to look for
@returns the index of the first occurrence of the character in this
string, or -1 if it's not found.
*/
int indexOfChar (int startIndex, juce_wchar characterToLookFor) const noexcept;
/** Returns the index of the first character that matches one of the characters
passed-in to this method.
This scans the string, beginning from the startIndex supplied, and if it finds
a character that appears in the string charactersToLookFor, it returns its index.
If none of these characters are found, it returns -1.
If ignoreCase is true, the comparison will be case-insensitive.
@see indexOfChar, lastIndexOfAnyOf
*/
int indexOfAnyOf (const String& charactersToLookFor,
int startIndex = 0,
bool ignoreCase = false) const noexcept;
/** Searches for a substring within this string.
Uses a case-sensitive comparison.
@returns the index of the first occurrence of this substring, or -1 if it's not found.
If textToLookFor is an empty string, this will always return 0.
*/
int indexOf (const String& textToLookFor) const noexcept;
/** Searches for a substring within this string.
Uses a case-sensitive comparison.
@param startIndex the index from which the search should proceed
@param textToLookFor the string to search for
@returns the index of the first occurrence of this substring, or -1 if it's not found.
If textToLookFor is an empty string, this will always return -1.
*/
int indexOf (int startIndex, const String& textToLookFor) const noexcept;
/** Searches for a substring within this string.
Uses a case-insensitive comparison.
@returns the index of the first occurrence of this substring, or -1 if it's not found.
If textToLookFor is an empty string, this will always return 0.
*/
int indexOfIgnoreCase (const String& textToLookFor) const noexcept;
/** Searches for a substring within this string.
Uses a case-insensitive comparison.
@param startIndex the index from which the search should proceed
@param textToLookFor the string to search for
@returns the index of the first occurrence of this substring, or -1 if it's not found.
If textToLookFor is an empty string, this will always return -1.
*/
int indexOfIgnoreCase (int startIndex, const String& textToLookFor) const noexcept;
/** Searches for a character inside this string (working backwards from the end of the string).
Uses a case-sensitive comparison.
@returns the index of the last occurrence of the character in this string, or -1 if it's not found.
*/
int lastIndexOfChar (juce_wchar character) const noexcept;
/** Searches for a substring inside this string (working backwards from the end of the string).
Uses a case-sensitive comparison.
@returns the index of the start of the last occurrence of the substring within this string,
or -1 if it's not found. If textToLookFor is an empty string, this will always return -1.
*/
int lastIndexOf (const String& textToLookFor) const noexcept;
/** Searches for a substring inside this string (working backwards from the end of the string).
Uses a case-insensitive comparison.
@returns the index of the start of the last occurrence of the substring within this string, or -1
if it's not found. If textToLookFor is an empty string, this will always return -1.
*/
int lastIndexOfIgnoreCase (const String& textToLookFor) const noexcept;
/** Returns the index of the last character in this string that matches one of the
characters passed-in to this method.
This scans the string backwards, starting from its end, and if it finds
a character that appears in the string charactersToLookFor, it returns its index.
If none of these characters are found, it returns -1.
If ignoreCase is true, the comparison will be case-insensitive.
@see lastIndexOf, indexOfAnyOf
*/
int lastIndexOfAnyOf (const String& charactersToLookFor,
bool ignoreCase = false) const noexcept;
//==============================================================================
// Substring extraction and manipulation methods..
/** Returns the character at this index in the string.
In a release build, no checks are made to see if the index is within a valid range, so be
careful! In a debug build, the index is checked and an assertion fires if it's out-of-range.
Also beware that depending on the encoding format that the string is using internally, this
method may execute in either O(1) or O(n) time, so be careful when using it in your algorithms.
If you're scanning through a string to inspect its characters, you should never use this operator
for random access, it's far more efficient to call getCharPointer() to return a pointer, and
then to use that to iterate the string.
@see getCharPointer
*/
const juce_wchar operator[] (int index) const noexcept;
/** Returns the final character of the string.
If the string is empty this will return 0.
*/
juce_wchar getLastCharacter() const noexcept;
//==============================================================================
/** Returns a subsection of the string.
If the range specified is beyond the limits of the string, as much as
possible is returned.
@param startIndex the index of the start of the substring needed
@param endIndex all characters from startIndex up to (but not including)
this index are returned
@see fromFirstOccurrenceOf, dropLastCharacters, getLastCharacters, upToFirstOccurrenceOf
*/
String substring (int startIndex, int endIndex) const;
/** Returns a section of the string, starting from a given position.
@param startIndex the first character to include. If this is beyond the end
of the string, an empty string is returned. If it is zero or
less, the whole string is returned.
@returns the substring from startIndex up to the end of the string
@see dropLastCharacters, getLastCharacters, fromFirstOccurrenceOf, upToFirstOccurrenceOf, fromLastOccurrenceOf
*/
String substring (int startIndex) const;
/** Returns a version of this string with a number of characters removed
from the end.
@param numberToDrop the number of characters to drop from the end of the
string. If this is greater than the length of the string,
an empty string will be returned. If zero or less, the
original string will be returned.
@see substring, fromFirstOccurrenceOf, upToFirstOccurrenceOf, fromLastOccurrenceOf, getLastCharacter
*/
String dropLastCharacters (int numberToDrop) const;
/** Returns a number of characters from the end of the string.
This returns the last numCharacters characters from the end of the string. If the
string is shorter than numCharacters, the whole string is returned.
@see substring, dropLastCharacters, getLastCharacter
*/
String getLastCharacters (int numCharacters) const;
//==============================================================================
/** Returns a section of the string starting from a given substring.
This will search for the first occurrence of the given substring, and
return the section of the string starting from the point where this is
found (optionally not including the substring itself).
e.g. for the string "123456", fromFirstOccurrenceOf ("34", true) would return "3456", and
fromFirstOccurrenceOf ("34", false) would return "56".
If the substring isn't found, the method will return an empty string.
If ignoreCase is true, the comparison will be case-insensitive.
@see upToFirstOccurrenceOf, fromLastOccurrenceOf
*/
String fromFirstOccurrenceOf (const String& substringToStartFrom,
bool includeSubStringInResult,
bool ignoreCase) const;
/** Returns a section of the string starting from the last occurrence of a given substring.
Similar to fromFirstOccurrenceOf(), but using the last occurrence of the substring, and
unlike fromFirstOccurrenceOf(), if the substring isn't found, this method will
return the whole of the original string.
@see fromFirstOccurrenceOf, upToLastOccurrenceOf
*/
String fromLastOccurrenceOf (const String& substringToFind,
bool includeSubStringInResult,
bool ignoreCase) const;
/** Returns the start of this string, up to the first occurrence of a substring.
This will search for the first occurrence of a given substring, and then
return a copy of the string, up to the position of this substring,
optionally including or excluding the substring itself in the result.
e.g. for the string "123456", upTo ("34", false) would return "12", and
upTo ("34", true) would return "1234".
If the substring isn't found, this will return the whole of the original string.
@see upToLastOccurrenceOf, fromFirstOccurrenceOf
*/
String upToFirstOccurrenceOf (const String& substringToEndWith,
bool includeSubStringInResult,
bool ignoreCase) const;
/** Returns the start of this string, up to the last occurrence of a substring.
Similar to upToFirstOccurrenceOf(), but this finds the last occurrence rather than the first.
If the substring isn't found, this will return the whole of the original string.
@see upToFirstOccurrenceOf, fromFirstOccurrenceOf
*/
String upToLastOccurrenceOf (const String& substringToFind,
bool includeSubStringInResult,
bool ignoreCase) const;
//==============================================================================
/** Returns a copy of this string with any whitespace characters removed from the start and end. */
String trim() const;
/** Returns a copy of this string with any whitespace characters removed from the start. */
String trimStart() const;
/** Returns a copy of this string with any whitespace characters removed from the end. */
String trimEnd() const;
/** Returns a copy of this string, having removed a specified set of characters from its start.
Characters are removed from the start of the string until it finds one that is not in the
specified set, and then it stops.
@param charactersToTrim the set of characters to remove.
@see trim, trimStart, trimCharactersAtEnd
*/
String trimCharactersAtStart (const String& charactersToTrim) const;
/** Returns a copy of this string, having removed a specified set of characters from its end.
Characters are removed from the end of the string until it finds one that is not in the
specified set, and then it stops.
@param charactersToTrim the set of characters to remove.
@see trim, trimEnd, trimCharactersAtStart
*/
String trimCharactersAtEnd (const String& charactersToTrim) const;
//==============================================================================
/** Returns an upper-case version of this string. */
String toUpperCase() const;
/** Returns an lower-case version of this string. */
String toLowerCase() const;
//==============================================================================
/** Replaces a sub-section of the string with another string.
This will return a copy of this string, with a set of characters
from startIndex to startIndex + numCharsToReplace removed, and with
a new string inserted in their place.
Note that this is a const method, and won't alter the string itself.
@param startIndex the first character to remove. If this is beyond the bounds of the string,
it will be constrained to a valid range.
@param numCharactersToReplace the number of characters to remove. If zero or less, no
characters will be taken out.
@param stringToInsert the new string to insert at startIndex after the characters have been
removed.
*/
String replaceSection (int startIndex,
int numCharactersToReplace,
const String& stringToInsert) const;
/** Replaces all occurrences of a substring with another string.
Returns a copy of this string, with any occurrences of stringToReplace
swapped for stringToInsertInstead.
Note that this is a const method, and won't alter the string itself.
*/
String replace (const String& stringToReplace,
const String& stringToInsertInstead,
bool ignoreCase = false) const;
/** Returns a string with all occurrences of a character replaced with a different one. */
String replaceCharacter (juce_wchar characterToReplace,
juce_wchar characterToInsertInstead) const;
/** Replaces a set of characters with another set.
Returns a string in which each character from charactersToReplace has been replaced
by the character at the equivalent position in newCharacters (so the two strings
passed in must be the same length).
e.g. replaceCharacters ("abc", "def") replaces 'a' with 'd', 'b' with 'e', etc.
Note that this is a const method, and won't affect the string itself.
*/
String replaceCharacters (const String& charactersToReplace,
const String& charactersToInsertInstead) const;
/** Returns a version of this string that only retains a fixed set of characters.
This will return a copy of this string, omitting any characters which are not
found in the string passed-in.
e.g. for "1122334455", retainCharacters ("432") would return "223344"
Note that this is a const method, and won't alter the string itself.
*/
String retainCharacters (const String& charactersToRetain) const;
/** Returns a version of this string with a set of characters removed.
This will return a copy of this string, omitting any characters which are
found in the string passed-in.
e.g. for "1122334455", removeCharacters ("432") would return "1155"
Note that this is a const method, and won't alter the string itself.
*/
String removeCharacters (const String& charactersToRemove) const;
/** Returns a section from the start of the string that only contains a certain set of characters.
This returns the leftmost section of the string, up to (and not including) the
first character that doesn't appear in the string passed in.
*/
String initialSectionContainingOnly (const String& permittedCharacters) const;
/** Returns a section from the start of the string that only contains a certain set of characters.
This returns the leftmost section of the string, up to (and not including) the
first character that occurs in the string passed in. (If none of the specified
characters are found in the string, the return value will just be the original string).
*/
String initialSectionNotContaining (const String& charactersToStopAt) const;
//==============================================================================
/** Checks whether the string might be in quotation marks.
@returns true if the string begins with a quote character (either a double or single quote).
It is also true if there is whitespace before the quote, but it doesn't check the end of the string.
@see unquoted, quoted
*/
bool isQuotedString() const;
/** Removes quotation marks from around the string, (if there are any).
Returns a copy of this string with any quotes removed from its ends. Quotes that aren't
at the ends of the string are not affected. If there aren't any quotes, the original string
is returned.
Note that this is a const method, and won't alter the string itself.
@see isQuotedString, quoted
*/
String unquoted() const;
/** Adds quotation marks around a string.
This will return a copy of the string with a quote at the start and end, (but won't
add the quote if there's already one there, so it's safe to call this on strings that
may already have quotes around them).
Note that this is a const method, and won't alter the string itself.
@param quoteCharacter the character to add at the start and end
@see isQuotedString, unquoted
*/
String quoted (juce_wchar quoteCharacter = '"') const;
//==============================================================================
/** Creates a string which is a version of a string repeated and joined together.
@param stringToRepeat the string to repeat
@param numberOfTimesToRepeat how many times to repeat it
*/
static String repeatedString (const String& stringToRepeat,
int numberOfTimesToRepeat);
/** Returns a copy of this string with the specified character repeatedly added to its
beginning until the total length is at least the minimum length specified.
*/
String paddedLeft (juce_wchar padCharacter, int minimumLength) const;
/** Returns a copy of this string with the specified character repeatedly added to its
end until the total length is at least the minimum length specified.
*/
String paddedRight (juce_wchar padCharacter, int minimumLength) const;
/** Creates a string from data in an unknown format.
This looks at some binary data and tries to guess whether it's Unicode
or 8-bit characters, then returns a string that represents it correctly.
Should be able to handle Unicode endianness correctly, by looking at
the first two bytes.
*/
static String createStringFromData (const void* data, int size);
/** Creates a String from a printf-style parameter list.
I don't like this method. I don't use it myself, and I recommend avoiding it and
using the operator<< methods or pretty much anything else instead. It's only provided
here because of the popular unrest that was stirred-up when I tried to remove it...
If you're really determined to use it, at least make sure that you never, ever,
pass any String objects to it as parameters. And bear in mind that internally, depending
on the platform, it may be using wchar_t or char character types, so that even string
literals can't be safely used as parameters if you're writing portable code.
*/
static String formatted (const String formatString, ... );
//==============================================================================
// Numeric conversions..
/** Creates a string containing this signed 32-bit integer as a decimal number.
@see getIntValue, getFloatValue, getDoubleValue, toHexString
*/
explicit String (int decimalInteger);
/** Creates a string containing this unsigned 32-bit integer as a decimal number.
@see getIntValue, getFloatValue, getDoubleValue, toHexString
*/
explicit String (unsigned int decimalInteger);
/** Creates a string containing this signed 16-bit integer as a decimal number.
@see getIntValue, getFloatValue, getDoubleValue, toHexString
*/
explicit String (short decimalInteger);
/** Creates a string containing this unsigned 16-bit integer as a decimal number.
@see getIntValue, getFloatValue, getDoubleValue, toHexString
*/
explicit String (unsigned short decimalInteger);
/** Creates a string containing this signed 64-bit integer as a decimal number.
@see getLargeIntValue, getFloatValue, getDoubleValue, toHexString
*/
explicit String (int64 largeIntegerValue);
/** Creates a string containing this unsigned 64-bit integer as a decimal number.
@see getLargeIntValue, getFloatValue, getDoubleValue, toHexString
*/
explicit String (uint64 largeIntegerValue);
/** Creates a string representing this floating-point number.
@param floatValue the value to convert to a string
@param numberOfDecimalPlaces if this is > 0, it will format the number using that many
decimal places, and will not use exponent notation. If 0 or
less, it will use exponent notation if necessary.
@see getDoubleValue, getIntValue
*/
explicit String (float floatValue,
int numberOfDecimalPlaces = 0);
/** Creates a string representing this floating-point number.
@param doubleValue the value to convert to a string
@param numberOfDecimalPlaces if this is > 0, it will format the number using that many
decimal places, and will not use exponent notation. If 0 or
less, it will use exponent notation if necessary.
@see getFloatValue, getIntValue
*/
explicit String (double doubleValue,
int numberOfDecimalPlaces = 0);
/** Reads the value of the string as a decimal number (up to 32 bits in size).
@returns the value of the string as a 32 bit signed base-10 integer.
@see getTrailingIntValue, getHexValue32, getHexValue64
*/
int getIntValue() const noexcept;
/** Reads the value of the string as a decimal number (up to 64 bits in size).
@returns the value of the string as a 64 bit signed base-10 integer.
*/
int64 getLargeIntValue() const noexcept;
/** Parses a decimal number from the end of the string.
This will look for a value at the end of the string.
e.g. for "321 xyz654" it will return 654; for "2 3 4" it'll return 4.
Negative numbers are not handled, so "xyz-5" returns 5.
@see getIntValue
*/
int getTrailingIntValue() const noexcept;
/** Parses this string as a floating point number.
@returns the value of the string as a 32-bit floating point value.
@see getDoubleValue
*/
float getFloatValue() const noexcept;
/** Parses this string as a floating point number.
@returns the value of the string as a 64-bit floating point value.
@see getFloatValue
*/
double getDoubleValue() const noexcept;
/** Parses the string as a hexadecimal number.
Non-hexadecimal characters in the string are ignored.
If the string contains too many characters, then the lowest significant
digits are returned, e.g. "ffff12345678" would produce 0x12345678.
@returns a 32-bit number which is the value of the string in hex.
*/
int getHexValue32() const noexcept;
/** Parses the string as a hexadecimal number.
Non-hexadecimal characters in the string are ignored.
If the string contains too many characters, then the lowest significant
digits are returned, e.g. "ffff1234567812345678" would produce 0x1234567812345678.
@returns a 64-bit number which is the value of the string in hex.
*/
int64 getHexValue64() const noexcept;
/** Creates a string representing this 32-bit value in hexadecimal. */
static String toHexString (int number);
/** Creates a string representing this 64-bit value in hexadecimal. */
static String toHexString (int64 number);
/** Creates a string representing this 16-bit value in hexadecimal. */
static String toHexString (short number);
/** Creates a string containing a hex dump of a block of binary data.
@param data the binary data to use as input
@param size how many bytes of data to use
@param groupSize how many bytes are grouped together before inserting a
space into the output. e.g. group size 0 has no spaces,
group size 1 looks like: "be a1 c2 ff", group size 2 looks
like "bea1 c2ff".
*/
static String toHexString (const void* data, int size, int groupSize = 1);
//==============================================================================
/** Returns the character pointer currently being used to store this string.
Because it returns a reference to the string's internal data, the pointer
that is returned must not be stored anywhere, as it can be deleted whenever the
string changes.
*/
inline const CharPointerType& getCharPointer() const noexcept { return text; }
/** Returns a pointer to a UTF-8 version of this string.
Because it returns a reference to the string's internal data, the pointer
that is returned must not be stored anywhere, as it can be deleted whenever the
string changes.
To find out how many bytes you need to store this string as UTF-8, you can call
CharPointer_UTF8::getBytesRequiredFor (myString.getCharPointer())
@see getCharPointer, toUTF16, toUTF32
*/
CharPointer_UTF8 toUTF8() const;
/** Returns a pointer to a UTF-32 version of this string.
Because it returns a reference to the string's internal data, the pointer
that is returned must not be stored anywhere, as it can be deleted whenever the
string changes.
To find out how many bytes you need to store this string as UTF-16, you can call
CharPointer_UTF16::getBytesRequiredFor (myString.getCharPointer())
@see getCharPointer, toUTF8, toUTF32
*/
CharPointer_UTF16 toUTF16() const;
/** Returns a pointer to a UTF-32 version of this string.
Because it returns a reference to the string's internal data, the pointer
that is returned must not be stored anywhere, as it can be deleted whenever the
string changes.
@see getCharPointer, toUTF8, toUTF16
*/
CharPointer_UTF32 toUTF32() const;
/** Returns a pointer to a wchar_t version of this string.
Because it returns a reference to the string's internal data, the pointer
that is returned must not be stored anywhere, as it can be deleted whenever the
string changes.
Bear in mind that the wchar_t type is different on different platforms, so on
Windows, this will be equivalent to calling toUTF16(), on unix it'll be the same
as calling toUTF32(), etc.
@see getCharPointer, toUTF8, toUTF16, toUTF32
*/
const wchar_t* toWideCharPointer() const;
//==============================================================================
/** Creates a String from a UTF-8 encoded buffer.
If the size is < 0, it'll keep reading until it hits a zero.
*/
static String fromUTF8 (const char* utf8buffer, int bufferSizeBytes = -1);
/** Returns the number of bytes required to represent this string as UTF8.
The number returned does NOT include the trailing zero.
@see toUTF8, copyToUTF8
*/
int getNumBytesAsUTF8() const noexcept;
//==============================================================================
/** Copies the string to a buffer as UTF-8 characters.
Returns the number of bytes copied to the buffer, including the terminating null
character.
To find out how many bytes you need to store this string as UTF-8, you can call
CharPointer_UTF8::getBytesRequiredFor (myString.getCharPointer())
@param destBuffer the place to copy it to; if this is a null pointer, the method just
returns the number of bytes required (including the terminating null character).
@param maxBufferSizeBytes the size of the destination buffer, in bytes. If the string won't fit, it'll
put in as many as it can while still allowing for a terminating null char at the
end, and will return the number of bytes that were actually used.
@see CharPointer_UTF8::writeWithDestByteLimit
*/
int copyToUTF8 (CharPointer_UTF8::CharType* destBuffer, int maxBufferSizeBytes) const noexcept;
/** Copies the string to a buffer as UTF-16 characters.
Returns the number of bytes copied to the buffer, including the terminating null
character.
To find out how many bytes you need to store this string as UTF-16, you can call
CharPointer_UTF16::getBytesRequiredFor (myString.getCharPointer())
@param destBuffer the place to copy it to; if this is a null pointer, the method just
returns the number of bytes required (including the terminating null character).
@param maxBufferSizeBytes the size of the destination buffer, in bytes. If the string won't fit, it'll
put in as many as it can while still allowing for a terminating null char at the
end, and will return the number of bytes that were actually used.
@see CharPointer_UTF16::writeWithDestByteLimit
*/
int copyToUTF16 (CharPointer_UTF16::CharType* destBuffer, int maxBufferSizeBytes) const noexcept;
/** Copies the string to a buffer as UTF-16 characters.
Returns the number of bytes copied to the buffer, including the terminating null
character.
To find out how many bytes you need to store this string as UTF-32, you can call
CharPointer_UTF32::getBytesRequiredFor (myString.getCharPointer())
@param destBuffer the place to copy it to; if this is a null pointer, the method just
returns the number of bytes required (including the terminating null character).
@param maxBufferSizeBytes the size of the destination buffer, in bytes. If the string won't fit, it'll
put in as many as it can while still allowing for a terminating null char at the
end, and will return the number of bytes that were actually used.
@see CharPointer_UTF32::writeWithDestByteLimit
*/
int copyToUTF32 (CharPointer_UTF32::CharType* destBuffer, int maxBufferSizeBytes) const noexcept;
//==============================================================================
/** Increases the string's internally allocated storage.
Although the string's contents won't be affected by this call, it will
increase the amount of memory allocated internally for the string to grow into.
If you're about to make a large number of calls to methods such
as += or <<, it's more efficient to preallocate enough extra space
beforehand, so that these methods won't have to keep resizing the string
to append the extra characters.
@param numBytesNeeded the number of bytes to allocate storage for. If this
value is less than the currently allocated size, it will
have no effect.
*/
void preallocateBytes (size_t numBytesNeeded);
/** Swaps the contents of this string with another one.
This is a very fast operation, as no allocation or copying needs to be done.
*/
void swapWith (String& other) noexcept;
//==============================================================================
#if JUCE_MAC || JUCE_IOS || DOXYGEN
/** MAC ONLY - Creates a String from an OSX CFString. */
static String fromCFString (CFStringRef cfString);
/** MAC ONLY - Converts this string to a CFString.
Remember that you must use CFRelease() to free the returned string when you're
finished with it.
*/
CFStringRef toCFString() const;
/** MAC ONLY - Returns a copy of this string in which any decomposed unicode characters have
been converted to their precomposed equivalents. */
String convertToPrecomposedUnicode() const;
#endif
private:
//==============================================================================
CharPointerType text;
//==============================================================================
struct PreallocationBytes
{
explicit PreallocationBytes (size_t);
size_t numBytes;
};
explicit String (const PreallocationBytes&); // This constructor preallocates a certain amount of memory
void appendFixedLength (const char* text, int numExtraChars);
size_t getByteOffsetOfEnd() const noexcept;
JUCE_DEPRECATED (String (const String& stringToCopy, size_t charsToAllocate));
// This private cast operator should prevent strings being accidentally cast
// to bools (this is possible because the compiler can add an implicit cast
// via a const char*)
operator bool() const noexcept { return false; }
};
//==============================================================================
/** Concatenates two strings. */
JUCE_API String JUCE_CALLTYPE operator+ (const char* string1, const String& string2);
/** Concatenates two strings. */
JUCE_API String JUCE_CALLTYPE operator+ (const wchar_t* string1, const String& string2);
/** Concatenates two strings. */
JUCE_API String JUCE_CALLTYPE operator+ (char string1, const String& string2);
/** Concatenates two strings. */
JUCE_API String JUCE_CALLTYPE operator+ (wchar_t string1, const String& string2);
#if ! JUCE_NATIVE_WCHAR_IS_UTF32
/** Concatenates two strings. */
JUCE_API String JUCE_CALLTYPE operator+ (juce_wchar string1, const String& string2);
#endif
/** Concatenates two strings. */
JUCE_API String JUCE_CALLTYPE operator+ (String string1, const String& string2);
/** Concatenates two strings. */
JUCE_API String JUCE_CALLTYPE operator+ (String string1, const char* string2);
/** Concatenates two strings. */
JUCE_API String JUCE_CALLTYPE operator+ (String string1, const wchar_t* string2);
/** Concatenates two strings. */
JUCE_API String JUCE_CALLTYPE operator+ (String string1, char characterToAppend);
/** Concatenates two strings. */
JUCE_API String JUCE_CALLTYPE operator+ (String string1, wchar_t characterToAppend);
#if ! JUCE_NATIVE_WCHAR_IS_UTF32
/** Concatenates two strings. */
JUCE_API String JUCE_CALLTYPE operator+ (String string1, juce_wchar characterToAppend);
#endif
//==============================================================================
/** Appends a character at the end of a string. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, char characterToAppend);
/** Appends a character at the end of a string. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, wchar_t characterToAppend);
#if ! JUCE_NATIVE_WCHAR_IS_UTF32
/** Appends a character at the end of a string. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, juce_wchar characterToAppend);
#endif
/** Appends a string to the end of the first one. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, const char* string2);
/** Appends a string to the end of the first one. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, const wchar_t* string2);
/** Appends a string to the end of the first one. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, const String& string2);
/** Appends a decimal number at the end of a string. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, short number);
/** Appends a decimal number at the end of a string. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, int number);
/** Appends a decimal number at the end of a string. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, long number);
/** Appends a decimal number at the end of a string. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, float number);
/** Appends a decimal number at the end of a string. */
JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, double number);
//==============================================================================
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const String& string2) noexcept;
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const char* string2) noexcept;
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const wchar_t* string2) noexcept;
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF8& string2) noexcept;
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF16& string2) noexcept;
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator== (const String& string1, const CharPointer_UTF32& string2) noexcept;
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const String& string2) noexcept;
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const char* string2) noexcept;
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const wchar_t* string2) noexcept;
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF8& string2) noexcept;
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF16& string2) noexcept;
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator!= (const String& string1, const CharPointer_UTF32& string2) noexcept;
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator> (const String& string1, const String& string2) noexcept;
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator< (const String& string1, const String& string2) noexcept;
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator>= (const String& string1, const String& string2) noexcept;
/** Case-sensitive comparison of two strings. */
JUCE_API bool JUCE_CALLTYPE operator<= (const String& string1, const String& string2) noexcept;
//==============================================================================
/** This operator allows you to write a juce String directly to std output streams.
This is handy for writing strings to std::cout, std::cerr, etc.
*/
template <class traits>
std::basic_ostream <char, traits>& JUCE_CALLTYPE operator<< (std::basic_ostream <char, traits>& stream, const String& stringToWrite)
{
return stream << stringToWrite.toUTF8().getAddress();
}
/** This operator allows you to write a juce String directly to std output streams.
This is handy for writing strings to std::wcout, std::wcerr, etc.
*/
template <class traits>
std::basic_ostream <wchar_t, traits>& JUCE_CALLTYPE operator<< (std::basic_ostream <wchar_t, traits>& stream, const String& stringToWrite)
{
return stream << stringToWrite.toWideCharPointer();
}
/** Writes a string to an OutputStream as UTF8. */
JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const String& stringToWrite);
#endif // __JUCE_STRING_JUCEHEADER__
|
[
"[email protected]"
] |
[
[
[
1,
1326
]
]
] |
dab2bebc2908bee2a02554f0cd8d3496cc7aa7ee
|
5dc78c30093221b4d2ce0e522d96b0f676f0c59a
|
/src/modules/audio/null/Audio.cpp
|
76504548383aa0ace5e58e05cb6ecaca29f684ca
|
[
"Zlib"
] |
permissive
|
JackDanger/love
|
f03219b6cca452530bf590ca22825170c2b2eae1
|
596c98c88bde046f01d6898fda8b46013804aad6
|
refs/heads/master
| 2021-01-13T02:32:12.708770 | 2009-07-22T17:21:13 | 2009-07-22T17:21:13 | 142,595 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,201 |
cpp
|
/**
* Copyright (c) 2006-2009 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#include "Audio.h"
namespace love
{
namespace audio
{
namespace null
{
Audio::Audio()
{
}
Audio::~Audio()
{
}
const char * Audio::getName() const
{
return "love.audio.null";
}
love::audio::Sound * Audio::newSound(love::sound::SoundData * data)
{
return new Sound(data);
}
love::audio::Music * Audio::newMusic(love::sound::Decoder * decoder)
{
return new Music(decoder);
}
love::audio::Source * Audio::newSource()
{
return new Source();
}
int Audio::getNumSources() const
{
return 0;
}
int Audio::getMaxSources() const
{
return 0;
}
void Audio::play(love::audio::Source * source)
{
}
void Audio::play(love::audio::Sound * sound)
{
}
void Audio::play(love::audio::Music * music)
{
}
void Audio::play()
{
}
void Audio::stop(love::audio::Source * source)
{
}
void Audio::stop()
{
}
void Audio::pause(love::audio::Source * source)
{
}
void Audio::pause()
{
}
void Audio::resume(love::audio::Source * source)
{
}
void Audio::resume()
{
}
void Audio::rewind(love::audio::Source * source)
{
}
void Audio::rewind()
{
}
void Audio::setVolume(float volume)
{
this->volume = volume;
}
float Audio::getVolume() const
{
return volume;
}
} // null
} // audio
} // love
|
[
"prerude@3494dbca-881a-0410-bd34-8ecbaf855390"
] |
[
[
[
1,
127
]
]
] |
2eb9378c5f16ca5e84b90568e1eb89158af834bd
|
00fdb9c8335382401ee0a8c06ad6ebdcaa136b40
|
/ARM9/source/plugin/_dpgfs.cpp
|
fb9b6edf853a24e501e55a3d56b181cfdfaea3af
|
[] |
no_license
|
Mbmax/ismart-kernel
|
d82633ba0864f9f697c3faa4ebc093a51b8463b2
|
f80d8d7156897d019eb4e16ef9cec8a431d15ed3
|
refs/heads/master
| 2016-09-06T13:28:25.260481 | 2011-03-29T10:31:04 | 2011-03-29T10:31:04 | 35,029,299 | 1 | 2 | null | null | null | null |
UTF-8
|
C++
| false | false | 7,953 |
cpp
|
#include <nds.h>
#include <stdio.h>
#include "_console.h"
#include "_const.h"
#include "memtool.h"
#include "_dpgfs.h"
#include "fat2.h"
#include "disc_io.h"
extern LPIO_INTERFACE active_interface;
#define CLUSTER_FREE 0x0000
#define CLUSTER_EOF 0x0FFFFFFF
static FAT_FILE *pFileHandle;
typedef struct {
u32 Sector;
u32 Count;
} TBurstList;
static u32 BurstListCount;
static TBurstList *pBurstList;
static void CreateBurstList(void)
{
_consolePrint("CreateBurstList.\n");
BurstListCount=0;
{
u32 CurClus=pFileHandle->firstCluster;
BurstListCount++;
while(1){
if(CurClus==CLUSTER_FREE){
_consolePrint("FileSysterm: Fatal error cluster link search.\n");
ShowLogHalt();
}
u32 NextClus=FAT2_NextCluster(CurClus);
if(NextClus==CLUSTER_EOF) break;
if((CurClus+1)!=NextClus){
BurstListCount++;
}else{
}
CurClus=NextClus;
}
BurstListCount++;
}
u32 SecPerClus=FAT2_GetSecPerClus();
pBurstList=(TBurstList*)safemalloc(BurstListCount*sizeof(TBurstList));
{
u32 BurstListIndex=0;
u32 CurClus=pFileHandle->firstCluster;
pBurstList[BurstListIndex].Sector=FAT2_ClustToSect(CurClus);
pBurstList[BurstListIndex].Count=SecPerClus;
BurstListIndex++;
while(1){
if(CurClus==CLUSTER_FREE){
_consolePrint("FileSysterm: Fatal error cluster link search.\n");
ShowLogHalt();
}
u32 NextClus=FAT2_NextCluster(CurClus);
if(NextClus==CLUSTER_EOF) break;
if((CurClus+1)!=NextClus){
pBurstList[BurstListIndex].Sector=FAT2_ClustToSect(NextClus);
pBurstList[BurstListIndex].Count=SecPerClus;
BurstListIndex++;
}else{
pBurstList[BurstListIndex-1].Count+=SecPerClus;
}
CurClus=NextClus;
}
pBurstList[BurstListIndex].Sector=CLUSTER_EOF;
pBurstList[BurstListIndex].Count=0;
BurstListIndex++;
}
for(u32 idx=0;idx<BurstListCount;idx++){
_consolePrintf("Index=%d Sector=0x%x Count=%d\n",idx,pBurstList[idx].Sector,pBurstList[idx].Count);
}
}
static void FreeBurstList(void)
{
BurstListCount=0;
if(pBurstList!=NULL){
safefree(pBurstList); pBurstList=NULL;
}
}
void DPGFS_Init(FAT_FILE *FileHandle)
{
pFileHandle=FileHandle;
CreateBurstList();
}
void DPGFS_Free(void)
{
pFileHandle=NULL;
FreeBurstList();
}
#define SectorSize (512)
typedef struct {
u32 DataTopOffset;
u32 Size;
u32 Offset;
u8 SectorBuffer[SectorSize];
u32 SectorRemainByte;
u32 BurstListIndex;
u32 BurstListCurSector;
u32 BurstListRemainSectorCount;
} TFile;
static TFile FileMovie,FileAudio;
static void SetAttribute(TFile *pf,u32 _DataTopOffset,u32 _Size)
{
pf->DataTopOffset=_DataTopOffset;
pf->Size=_Size;
}
void DPGFS_Movie_SetAttribute(u32 _DataTopOffset,u32 _Size)
{
SetAttribute(&FileMovie,_DataTopOffset,_Size);
DPGFS_Movie_SetOffset(0);
}
void DPGFS_Audio_SetAttribute(u32 _DataTopOffset,u32 _Size)
{
SetAttribute(&FileAudio,_DataTopOffset,_Size);
DPGFS_Audio_SetOffset(0);
}
static void MoveTop(TFile *pf)
{
pf->Offset=0;
MemSet32CPU(0,pf->SectorBuffer,SectorSize);
pf->SectorRemainByte=0;
pf->BurstListIndex=0;
pf->BurstListCurSector=pBurstList[pf->BurstListIndex].Sector;
pf->BurstListRemainSectorCount=pBurstList[pf->BurstListIndex].Count;
}
static void ReadSkip(TFile *pf,u32 size)
{
pf->Offset=size;
if(size!=0){
u32 reqsize=size;
if(pf->SectorRemainByte<reqsize) reqsize=pf->SectorRemainByte;
size-=reqsize;
pf->SectorRemainByte-=reqsize;
}
if(pf->BurstListRemainSectorCount==0) return;
while(SectorSize<=size){
pf->BurstListCurSector++;
pf->BurstListRemainSectorCount--;
size-=SectorSize;
if(pf->BurstListRemainSectorCount==0){
pf->BurstListIndex++;
pf->BurstListCurSector=pBurstList[pf->BurstListIndex].Sector;
pf->BurstListRemainSectorCount=pBurstList[pf->BurstListIndex].Count;
}
}
if(pf->BurstListRemainSectorCount==0) return;
if(size!=0){
active_interface->fn_ReadSectors(pf->BurstListCurSector,1,pf->SectorBuffer);
pf->SectorRemainByte=SectorSize-size;
pf->BurstListCurSector++;
pf->BurstListRemainSectorCount--;
if(pf->BurstListRemainSectorCount==0){
pf->BurstListIndex++;
pf->BurstListCurSector=pBurstList[pf->BurstListIndex].Sector;
pf->BurstListRemainSectorCount=pBurstList[pf->BurstListIndex].Count;
}
}
}
static u32 Read32bit(TFile *pf,u8 *pbuf,u32 size)
{
if((((u32)pbuf)&3)!=0){
_consolePrintf("pbuf align error. (0x%x)\n",pbuf);
}
if((size&3)!=0){
_consolePrintf("size align error. (0x%x)\n",pbuf);
}
u32 readedsize=0;
if(size!=0){
u32 reqsize=size;
if(pf->SectorRemainByte<reqsize) reqsize=pf->SectorRemainByte;
MemCopy32CPU(&pf->SectorBuffer[SectorSize-pf->SectorRemainByte],pbuf,reqsize);
readedsize+=reqsize;
pbuf+=reqsize;
size-=reqsize;
pf->SectorRemainByte-=reqsize;
}
if(pf->BurstListRemainSectorCount==0) return(readedsize);
while(SectorSize<=size){
u32 reqsector=size/SectorSize;
if(pf->BurstListRemainSectorCount<reqsector) reqsector=pf->BurstListRemainSectorCount;
if(255<reqsector) reqsector=255;
if(pf->BurstListCurSector==CLUSTER_EOF) break;
// _consolePrintf("[%d,%d,%d,%d]",pf->BurstListIndex,pf->BurstListCurSector,pf->BurstListRemainSectorCount,reqsector);
active_interface->fn_ReadSectors(pf->BurstListCurSector,reqsector,pbuf);
u32 reqsize=reqsector*SectorSize;
readedsize+=reqsize;
pbuf+=reqsize;
size-=reqsize;
pf->BurstListCurSector+=reqsector;
pf->BurstListRemainSectorCount-=reqsector;
if(pf->BurstListRemainSectorCount==0){
pf->BurstListIndex++;
pf->BurstListCurSector=pBurstList[pf->BurstListIndex].Sector;
pf->BurstListRemainSectorCount=pBurstList[pf->BurstListIndex].Count;
}
}
if(pf->BurstListRemainSectorCount==0) return(readedsize);
if(size!=0){
if(pf->BurstListCurSector==CLUSTER_EOF){
}else{
active_interface->fn_ReadSectors(pf->BurstListCurSector,1,pf->SectorBuffer);
MemCopy32CPU(pf->SectorBuffer,pbuf,size);
readedsize+=size;
pf->SectorRemainByte=SectorSize-size;
pf->BurstListCurSector++;
pf->BurstListRemainSectorCount--;
if(pf->BurstListRemainSectorCount==0){
pf->BurstListIndex++;
pf->BurstListCurSector=pBurstList[pf->BurstListIndex].Sector;
pf->BurstListRemainSectorCount=pBurstList[pf->BurstListIndex].Count;
}
}
}
pf->Offset+=readedsize;
return(readedsize);
}
u32 DPGFS_Movie_GetSize(void)
{
TFile *pf=&FileMovie;
return(pf->Size);
}
u32 DPGFS_Audio_GetSize(void)
{
TFile *pf=&FileAudio;
return(pf->Size);
}
void DPGFS_Movie_SetOffset(u32 ofs)
{
// _consolePrintf("MovieSetOffset=%d\n",ofs);
TFile *pf=&FileMovie;
MoveTop(pf);
ReadSkip(pf,pf->DataTopOffset+ofs);
}
void DPGFS_Audio_SetOffset(u32 ofs)
{
// _consolePrintf("AudioSetOffset=%d\n",ofs);
TFile *pf=&FileAudio;
MoveTop(pf);
ReadSkip(pf,pf->DataTopOffset+ofs);
}
u32 DPGFS_Audio_GetOffset(void)
{
TFile *pf=&FileAudio;
return(pf->Offset-pf->DataTopOffset);
}
u32 DPGFS_Movie_Read32bit(void *_pbuf,u32 size)
{
TFile *pf=&FileMovie;
size=Read32bit(pf,(u8*)_pbuf,size);
// DCache_CleanRangeOverrun(_pbuf,size);
return(size);
}
u32 DPGFS_Audio_Read32bit(void *_pbuf,u32 size)
{
TFile *pf=&FileAudio;
size=Read32bit(pf,(u8*)_pbuf,size);
// DCache_CleanRangeOverrun(_pbuf,size);
return(size);
}
|
[
"feng.flash@4bd7f34a-4c62-84e7-1fb2-5fbc975ebfb2"
] |
[
[
[
1,
326
]
]
] |
029cbcd791b7f34b55f5ab1c898410c17606cdc0
|
27651c3f5f829bff0720d7f835cfaadf366ee8fa
|
/QBluetooth/Connection/ObjectExchange/Server/Impl/QBtObjectExchangeServer_win32.cpp
|
a8a0ef04ecd6b412e716d8011989deffe232dc9a
|
[
"LicenseRef-scancode-warranty-disclaimer"
] |
no_license
|
cpscotti/Push-Snowboarding
|
8883907e7ee2ddb9a013faf97f2d9673b9d0fad5
|
cc3cc940292d6d728865fe38018d34b596943153
|
refs/heads/master
| 2021-05-27T16:35:49.846278 | 2011-07-08T10:25:17 | 2011-07-08T10:25:17 | 1,395,155 | 1 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,137 |
cpp
|
/*
* QBtObjectExchangeServer_win32.cpp
*
*
* Author: Ftylitakis Nikolaos
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "../QBtObjectExchangeServer_win32.h"
QBtObjectExchangeServerPrivate::QBtObjectExchangeServerPrivate(
QBtObjectExchangeServer* publicClass) : p_ptr(publicClass)
{
}
QBtObjectExchangeServerPrivate::~QBtObjectExchangeServerPrivate()
{
}
bool QBtObjectExchangeServerPrivate::StartServer()
{
return false;
}
void QBtObjectExchangeServerPrivate::Disconnect()
{
}
bool QBtObjectExchangeServerPrivate::IsConnected()
{
return false;
}
|
[
"cpscotti@c819a03f-852d-4de4-a68c-c3ac47756727"
] |
[
[
[
1,
43
]
]
] |
8d285503acf0e18423e5df9279ab93ded0131e2a
|
c5534a6df16a89e0ae8f53bcd49a6417e8d44409
|
/trunk/Dependencies/Xerces/include/xercesc/util/Transcoders/Uniconv390/XML88591Transcoder390.cpp
|
42dda7074ea77017f4e11146322ae252bc14f22a
|
[] |
no_license
|
svn2github/ngene
|
b2cddacf7ec035aa681d5b8989feab3383dac012
|
61850134a354816161859fe86c2907c8e73dc113
|
refs/heads/master
| 2023-09-03T12:34:18.944872 | 2011-07-27T19:26:04 | 2011-07-27T19:26:04 | 78,163,390 | 2 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 8,129 |
cpp
|
/*
* Copyright 2004,2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id: XML88591Transcoder390.cpp 191054 2005-06-17 02:56:35Z jberry $
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#include <xercesc/util/XMLUniDefs.hpp>
#include <xercesc/util/TranscodingException.hpp>
#include <xercesc/util/Transcoders/Uniconv390/XML88591Transcoder390.hpp>
#include <xercesc/util/XMLString.hpp>
#include <string.h>
extern "OS" void TROT(const XMLByte * input, XMLCh * output,
int length, const XMLCh *table,
int STOP);
XERCES_CPP_NAMESPACE_BEGIN
//Add a long double in front of the table, the compiler will set the
//table starting address on a double word boundary
struct temp{
long double pad;
XMLCh gFromTable[256];
};
static struct temp padding_temp={
0,
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007
, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F
, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017
, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F
, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027
, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F
, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037
, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F
, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047
, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F
, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057
, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F
, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067
, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F
, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077
, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F
, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087
, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F
, 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097
, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F
, 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7
, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF
, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7
, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF
, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7
, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF
, 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7
, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF
, 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7
, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF
, 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7
, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF
};
// ---------------------------------------------------------------------------
// XML88591Transcoder390: Constructors and Destructor
// ---------------------------------------------------------------------------
XML88591Transcoder390::XML88591Transcoder390( const XMLCh* const encodingName
, const unsigned int blockSize
, MemoryManager* const manager) :
XMLTranscoder(encodingName, blockSize, manager)
{
}
XML88591Transcoder390::~XML88591Transcoder390()
{
}
// ---------------------------------------------------------------------------
// XML88591Transcoder390: Implementation of the transcoder API
// ---------------------------------------------------------------------------
unsigned int
XML88591Transcoder390::transcodeFrom( const XMLByte* const srcData
, const unsigned int srcCount
, XMLCh* const toFill
, const unsigned int maxChars
, unsigned int& bytesEaten
, unsigned char* const charSizes)
{
// If debugging, make sure that the block size is legal
#if defined(XERCES_DEBUG)
checkBlockSize(maxChars);
#endif
//
// Calculate the max chars we can do here. Its the lesser of the
// max output chars and the number of bytes in the source.
//
const unsigned int countToDo = srcCount < maxChars ? srcCount : maxChars;
//
// Loop through the bytes to do and convert over each byte. Its just
// a cast to the wide char type.
//
const XMLByte* srcPtr = srcData;
XMLCh* destPtr = toFill;
const XMLByte* srcEnd = srcPtr + countToDo;
TROT(srcPtr, destPtr, countToDo, padding_temp.gFromTable, 0xFFFF);
// Set the bytes eaten, and set the char size array to the fixed size
bytesEaten = countToDo;
memset(charSizes, 1, countToDo);
// Return the chars we transcoded
return countToDo;
}
unsigned int
XML88591Transcoder390::transcodeTo(const XMLCh* const srcData
, const unsigned int srcCount
, XMLByte* const toFill
, const unsigned int maxBytes
, unsigned int& charsEaten
, const UnRepOpts options)
{
// If debugging, make sure that the block size is legal
#if defined(XERCES_DEBUG)
checkBlockSize(maxBytes);
#endif
//
// Calculate the max chars we can do here. Its the lesser of the
// max output bytes and the number of chars in the source.
//
const unsigned int countToDo = srcCount < maxBytes ? srcCount : maxBytes;
//
// Loop through the bytes to do and convert over each byte. Its just
// a downcast of the wide char, checking for unrepresentable chars.
//
const XMLCh* srcPtr = srcData;
const XMLCh* srcEnd = srcPtr + countToDo;
XMLByte* destPtr = toFill;
while (srcPtr < srcEnd)
{
// If its legal, take it and jump back to top
if (*srcPtr < 256)
{
*destPtr++ = XMLByte(*srcPtr++);
continue;
}
//
// Its not representable so use a replacement char. According to
// the options, either throw or use the replacement.
//
if (options == UnRep_Throw)
{
XMLCh tmpBuf[17];
XMLString::binToText((unsigned int)*srcPtr, tmpBuf, 16, 16, getMemoryManager());
ThrowXMLwithMemMgr2
(
TranscodingException
, XMLExcepts::Trans_Unrepresentable
, tmpBuf
, getEncodingName()
, getMemoryManager()
);
}
*destPtr++ = 0x1A;
srcPtr++;
}
// Set the chars eaten
charsEaten = countToDo;
// Return the bytes we transcoded
return countToDo;
}
bool XML88591Transcoder390::canTranscodeTo(const unsigned int toCheck) const
{
return (toCheck < 256);
}
XERCES_CPP_NAMESPACE_END
|
[
"Riddlemaster@fdc6060e-f348-4335-9a41-9933a8eecd57"
] |
[
[
[
1,
207
]
]
] |
4d301b7457c6a74a39caef60d5c3fe46ea95ffaa
|
e4ba3d959ab92a5d4d1650ce5dd6f89c73295479
|
/symbian/camera/xqcamera.cpp
|
43dc1e0aa8d11abee2d3d7026488f0088b3c5320
|
[] |
no_license
|
rhelmus/asurocontrol
|
305c8c20fffda27f9f8e97eaae94ffa5156169a2
|
40bc5f399d549949111fc9b94771cbe0c8c9b832
|
refs/heads/master
| 2021-01-19T16:24:01.047598 | 2009-12-31T17:42:55 | 2009-12-31T17:42:55 | 32,216,156 | 0 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 4,137 |
cpp
|
#include "xqcamera.h"
#include "xqcamera_p.h"
#include <QSize>
/*!
\class XQCamera
\brief The XQCamera class can be used to take photos with the device's onboard camera.
*/
/*!
\enum XQCamera::Error
This enum defines the possible errors for a XQCamera object.
*/
/*! \var XQCamera::Error XQCamera::NoError
No error occured.
*/
/*! \var XQCamera::Error XQCamera::OutOfMemoryError
Not enough memory.
*/
/*! \var XQCamera::Error XQCamera::InUseError
Resource already in use.
*/
/*! \var XQCamera::Error XQCamera::NotReadyError
Camera is not yet ready
*/
/*! \var XQCamera::Error XQCamera::UnknownError
Unknown error.
*/
/*!
Constructs a XQCamera object with the given parent.
*/
XQCamera::XQCamera(QObject* parent)
: QObject(parent), d(new XQCameraPrivate(this))
{
}
/*!
Destroys the XQCamera object.
*/
XQCamera::~XQCamera()
{
delete d;
}
/*!
Opens the camera. This function also reserves and powers on the camera.
The cameraReady() signal is emitted when the camera is ready to be used.
\param index The index indicating which camera to open. The default value is 0.
\return If false is returned it means an error has occurred. Call error() to get the
XQCamera::Error value that indicates which error occurred
\sa error()
*/
bool XQCamera::open(int index)
{
return d->open(index);
}
/*!
Sets the size of image that will be captured from the camera
\param size Requested image size
*/
void XQCamera::setCaptureSize(QSize size)
{
d->setCaptureSize(size);
}
/*!
Starts capturing the actual image. When the image is ready,
the captureCompleted() signal is emitted.
\return If false is returned it means an error has occurred. Call error() to get the
XQCamera::Error value that indicates which error occurred.
\sa captureCompleted(), error()
*/
bool XQCamera::capture()
{
return d->capture();
}
/*!
Closes the camera. This function also releases and powers off the camera.
*/
void XQCamera::close()
{
d->close();
}
/*!
Starts focusing the camera. The focused() signal is emitted when the camera is focused.
Note: Does nothing if AutoFocus is not supported.
\return If false is returned it means an error has occurred. Call error() to get the
XQCamera::Error value that indicates which error occurred.
\sa focused()
*/
bool XQCamera::focus()
{
return d->focus();
}
/*!
Cancels the focussing of the camera.
*/
void XQCamera::cancelFocus()
{
d->cancelFocus();
}
/*!
Returns the number of cameras available in the device.
\return Number of cameras available on the device.
*/
int XQCamera::camerasAvailable()
{
return XQCameraPrivate::camerasAvailable();
}
/*!
Releases memory for the last captured image.
Client must call this in response to \a captureCompleted(QByteArray imageData) function,
after processing the data/bitmap is complete.
*/
void XQCamera::releaseImageBuffer()
{
d->releaseImageBuffer();
}
/*!
Returns the type of error that occurred if the latest function call failed. Otherwise it returns NoError
\return Error code
*/
XQCamera::Error XQCamera::error() const
{
return d->error();
}
/*!
\fn void XQCamera::cameraReady();
This signal is emitted when the camera is ready to be used. The image may
be from viewfinder of actual capturing.
*/
/*!
\fn void XQCamera::focused();
This signal is emitted when the focus procedure has completed.
*/
/*!
\fn void XQCamera::captureCompleted(QByteArray image);
This signal is emitted when the image has been captured.
\param image Captured image. Note that the buffer is released right after
this function call.
*/
/*!
\fn void error(XQCamera::Error error);
This signal is emitted when an error has occurred with the camera.
\param error Indicates the type of error that has occurred.
*/
// End of file
|
[
"rhelmus@07f91fa8-e1f7-11de-9e61-43d41527e390"
] |
[
[
[
1,
172
]
]
] |
55fec9ecefa92773b963d53f0a8d78028ce7b05c
|
fd3f2268460656e395652b11ae1a5b358bfe0a59
|
/srchybrid/SelCategoryDlg.h
|
f7ab6297359dbe006934a93f871412d859d43b05
|
[] |
no_license
|
mikezhoubill/emule-gifc
|
e1cc6ff8b1bb63197bcfc7e67c57cfce0538ff60
|
46979cf32a313ad6d58603b275ec0b2150562166
|
refs/heads/master
| 2021-01-10T20:37:07.581465 | 2011-08-13T13:58:37 | 2011-08-13T13:58:37 | 32,465,033 | 4 | 2 | null | null | null | null |
UTF-8
|
C++
| false | false | 768 |
h
|
// khaos::categorymod+
#pragma once
//#include "PPGtooltipped.h"
// CSelCategoryDlg dialog
class CSelCategoryDlg : public CPropertyPage
{
DECLARE_DYNAMIC(CSelCategoryDlg)
public:
CSelCategoryDlg(CWnd* pWnd = NULL,bool bFromClipboard=false);
virtual ~CSelCategoryDlg();
virtual BOOL OnInitDialog();
afx_msg void OnOK();
afx_msg void OnCancel();
int GetInput() { return m_Return; }
bool CreatedNewCat() { return m_bCreatedNew; }
bool WasCancelled() { return m_cancel;}
// Dialog Data
enum { IDD = IDD_SELCATEGORY };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
private:
int m_Return;
bool m_bFromClipboard;
bool m_cancel;
bool m_bCreatedNew;
};
|
[
"Mike.Ken.S@dd569cc8-ff36-11de-bbca-1111db1fd05b",
"[email protected]@dd569cc8-ff36-11de-bbca-1111db1fd05b"
] |
[
[
[
1,
11
],
[
13,
20
],
[
22,
29
],
[
32,
33
]
],
[
[
12,
12
],
[
21,
21
],
[
30,
31
]
]
] |
2b95ccb0ef3b20783f99f283920c9537677031b6
|
677f7dc99f7c3f2c6aed68f41c50fd31f90c1a1f
|
/SolidSBCDatabaseLib/SolidSBCResultDBConnector.h
|
ad88f5107dd2f0926060b1d2238cb7415fda5143
|
[] |
no_license
|
M0WA/SolidSBC
|
0d743c71ec7c6f8cfe78bd201d0eb59c2a8fc419
|
3e9682e90a22650e12338785c368ed69a9cac18b
|
refs/heads/master
| 2020-04-19T14:40:36.625222 | 2011-12-02T01:50:05 | 2011-12-02T01:50:05 | 168,250,374 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,297 |
h
|
#pragma once
#include "defines.h"
#include "SolidSBCDatabaseLib.h"
class SOLIDSBCDATABASELIB_API CSolidSBCResultDBConnector : public CObject
{
////////////////////////////////////////////////////////////////////
//
//used by all
//
public:
CSolidSBCResultDBConnector(void);
~CSolidSBCResultDBConnector(void);
void SetConfig(CString strServer, DWORD nPort, CString strDatabase, CString strUser, CString strPassword);
////////////////////////////////////////////////////////////////////
//
// pure virtual functions (need to be implemented by derived child classes)
//
public:
virtual int Connect (void)=0;
virtual int Disconnect(void)=0;
virtual bool ExecStmts(const std::string& sSql, const bool bMultipleStmts = false)=0;
////////////////////////////////////////////////////////////////////
//
//used by client
//
public:
virtual int GetConfigsForClient(const CString& strClientUUID, std::vector<CString>& vecXmlConfigs)=0;
virtual int AddTestResult (const CString& strClientUUID, const CString& strTestSQL)=0;
virtual int AddClientHistory (const CString& strClientUUID, SSBC_CLIENT_HISTORY_ACTION nAction)=0;
virtual int GetClients (std::vector<std::pair<std::string,std::string > >& vecClients)=0;
protected:
int GetAddTestResultSQLString (const CString& strClientUUID, const CString& strTestSQL, CStringArray& arSQLCmds);
int GetAddClientHistorySQLString(const CString& strClientUUID, const SSBC_CLIENT_HISTORY_ACTION nAction, CStringArray& arSQLCmds);
int GetConfigsForClientSQLString(const CString& strClientUUID, CStringArray& arSQLCmds);
int GetClientsSQLString (CStringArray& arSQLCmds);
////////////////////////////////////////////////////////////////////
//
//used by result viewer
//
public:
virtual int GetNameFromUuid(const CString& strUuid, CString& strName)=0;
protected:
int GetNameFromUuidSQLString(const CString& strUuid, CStringArray& arSQLCmds);
////////////////////////////////////////////////////////////////////
//
//internal implementation of this class
//
protected:
CMutex m_DBConnMutex;
CString m_strServer;
DWORD m_nPort;
CString m_strDatabase;
CString m_strUser;
CString m_strPassword;
SSBC_DB_TYPE m_Type;
};
|
[
"admin@bd7e3521-35e9-406e-9279-390287f868d3"
] |
[
[
[
1,
65
]
]
] |
2d88ea7ce00421f65de75571be77ff48e1dd9ce6
|
25f79693b806edb9041e3786fa3cf331d6fd4b97
|
/src/fft/il/fft_il.h
|
ab0d01b3376a1ae04a820199b3fd27f877b89d7f
|
[] |
no_license
|
ouj/amd-spl
|
ff3c9faf89d20b5d6267b7f862c277d16aae9eee
|
54b38e80088855f5e118f0992558ab88a7dea5b9
|
refs/heads/master
| 2016-09-06T03:13:23.993426 | 2009-08-29T08:55:02 | 2009-08-29T08:55:02 | 32,124,284 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 116,015 |
h
|
#ifndef _FFT_IL_SOURCE_H_
#define _FFT_IL_SOURCE_H_
namespace amdspl
{
namespace fft
{
static const char* _fft8_tomo_fft_source_ =
"il_cs_2_0 \n"
"dcl_num_thread_per_group 64 \n"
"; l0 = (0.0f, 1.401298464e-45f, -1.#QNANf, 1.121038771e-44f, ) \n"
"dcl_literal l0, 0x00000000, 0x00000001, 0xFFFFFFFF, 0x00000008 \n"
"; l1 = (0.0f, 1.0f, -1.0f, 0.7071067691f, ) \n"
"dcl_literal l1, 0x00000000, 0x3F800000, 0xBF800000, 0x3F3504F3 \n"
"; l29 = (1.261168618e-44f, 7.174648137e-43f, 0.0f, 0.0f, ) \n"
"dcl_literal l29, 0x00000009, 0x00000200, 0x00000000, 0x00000000 \n"
"ishl r70.x___, vThreadGrpIdFlat0.x, l29.x \n"
"iadd r70.x___, vTidInGrpFlat0.x, r70.x \n"
"call 5 \n"
"call 4 \n"
"call 6 \n"
"endmain \n"
"func 0 \n"
"mul_ieee r100, r40, r41 \n"
"mul_ieee r101, r40, r41.yxwz \n"
"sub r40.x_z_, r100.xxzz, r100.yyww \n"
"add r40._y_w, r101.xxzz, r101.yyww \n"
"ret \n"
"endfunc \n"
"func 2 \n"
"mov r100, r50 \n"
"add r50, r100, r51 \n"
"sub r51, r100, r51 \n"
"ret \n"
"endfunc \n"
"func 3 \n"
"mov r50, r60 \n"
"mov r51, r62 \n"
"call 2 \n"
"mov r60, r50 \n"
"mov r62, r51 \n"
"mov r50, r61 \n"
"mov r51, r63 \n"
"call 2 \n"
"mov r61, r50 \n"
"mov r63, r51 \n"
"mov r40, r63 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r63, r40 \n"
"mov r50, r60 \n"
"mov r51, r61 \n"
"call 2 \n"
"mov r60, r50 \n"
"mov r61, r51 \n"
"mov r50, r62 \n"
"mov r51, r63 \n"
"call 2 \n"
"mov r62, r50 \n"
"mov r63, r51 \n"
"ret \n"
"endfunc \n"
";FFT8. \n"
"func 4 \n"
"mov r50, r400 \n"
"mov r51, r404 \n"
"call 2 \n"
"mov r400, r50 \n"
"mov r404, r51 \n"
"mov r50, r401 \n"
"mov r51, r405 \n"
"call 2 \n"
"mov r401, r50 \n"
"mov r405, r51 \n"
"mov r50, r402 \n"
"mov r51, r406 \n"
"call 2 \n"
"mov r402, r50 \n"
"mov r406, r51 \n"
"mov r50, r403 \n"
"mov r51, r407 \n"
"call 2 \n"
"mov r403, r50 \n"
"mov r407, r51 \n"
"mov r40, r405 \n"
"mov r41, l1.yzyz \n"
"call 0 \n"
"mov r405, r40 \n"
"mul_ieee r405, r405, l1.w \n"
"mov r40, r406 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r406, r40 \n"
"mov r40, r407 \n"
"mov r41, l1.z \n"
"call 0 \n"
"mov r407, r40 \n"
"mul_ieee r407, r407, l1.w \n"
"mov r60, r400 \n"
"mov r61, r401 \n"
"mov r62, r402 \n"
"mov r63, r403 \n"
"call 3 \n"
"mov r400, r60 \n"
"mov r401, r61 \n"
"mov r402, r62 \n"
"mov r403, r63 \n"
"mov r60, r404 \n"
"mov r61, r405 \n"
"mov r62, r406 \n"
"mov r63, r407 \n"
"call 3 \n"
"mov r404, r60 \n"
"mov r405, r61 \n"
"mov r406, r62 \n"
"mov r407, r63 \n"
"ret \n"
"endfunc \n"
"func 5 \n"
"mov r400, g[r70.x+0] \n"
"mov r401, g[r70.x+64] \n"
"mov r402, g[r70.x+128] \n"
"mov r403, g[r70.x+192] \n"
"mov r404, g[r70.x+256] \n"
"mov r405, g[r70.x+320] \n"
"mov r406, g[r70.x+384] \n"
"mov r407, g[r70.x+448] \n"
"ret \n"
"endfunc \n"
"func 6 \n"
"mov g[r70.x+0], r400 \n"
"mov g[r70.x+64], r404 \n"
"mov g[r70.x+128], r402 \n"
"mov g[r70.x+192], r406 \n"
"mov g[r70.x+256], r401 \n"
"mov g[r70.x+320], r405 \n"
"mov g[r70.x+384], r403 \n"
"mov g[r70.x+448], r407 \n"
"ret \n"
"endfunc \n"
"end \n";
static const char* _fft16_tomo_fft_source_ =
"il_cs_2_0 \n"
"dcl_num_thread_per_group 64 \n"
"; l0 = (0.0f, 1.401298464e-45f, -1.#QNANf, 2.242077543e-44f, ) \n"
"dcl_literal l0, 0x00000000, 0x00000001, 0xFFFFFFFF, 0x00000010 \n"
"; l1 = (0.0f, 1.0f, -1.0f, 0.7071067691f, ) \n"
"dcl_literal l1, 0x00000000, 0x3F800000, 0xBF800000, 0x3F3504F3 \n"
"; l2 = (0.3826834261f, 0.9238795042f, -0.3826834261f, -0.9238795042f, ) \n"
"dcl_literal l2, 0x3EC3EF15, 0x3F6C835E, 0xBEC3EF15, 0xBF6C835E \n"
"; l29 = (1.261168618e-44f, 7.174648137e-43f, 0.0f, 0.0f, ) \n"
"dcl_literal l29, 0x00000009, 0x00000200, 0x00000000, 0x00000000 \n"
"; l30 = (1.401298464e-44f, 1.434929627e-42f, 0.0f, 0.0f, ) \n"
"dcl_literal l30, 0x0000000A, 0x00000400, 0x00000000, 0x00000000 \n"
"ishl r70.x___, vThreadGrpIdFlat0.x, l30.x \n"
"iadd r70.x___, vTidInGrpFlat0.x, r70.x \n"
"iadd r70._y__, r70.x, l29.y \n"
"call 5 \n"
"call 4 \n"
"call 6 \n"
"endmain \n"
"func 0 \n"
"mul_ieee r100, r40, r41 \n"
"mul_ieee r101, r40, r41.yxwz \n"
"sub r40.x_z_, r100.xxzz, r100.yyww \n"
"add r40._y_w, r101.xxzz, r101.yyww \n"
"ret \n"
"endfunc \n"
"func 2 \n"
"mov r100, r50 \n"
"add r50, r100, r51 \n"
"sub r51, r100, r51 \n"
"ret \n"
"endfunc \n"
"func 3 \n"
"mov r50, r60 \n"
"mov r51, r62 \n"
"call 2 \n"
"mov r60, r50 \n"
"mov r62, r51 \n"
"mov r50, r61 \n"
"mov r51, r63 \n"
"call 2 \n"
"mov r61, r50 \n"
"mov r63, r51 \n"
"mov r40, r63 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r63, r40 \n"
"mov r50, r60 \n"
"mov r51, r61 \n"
"call 2 \n"
"mov r60, r50 \n"
"mov r61, r51 \n"
"mov r50, r62 \n"
"mov r51, r63 \n"
"call 2 \n"
"mov r62, r50 \n"
"mov r63, r51 \n"
"ret \n"
"endfunc \n"
";FFT16 \n"
"func 4 \n"
"mov r60, r400 \n"
"mov r61, r404 \n"
"mov r62, r408 \n"
"mov r63, r412 \n"
"call 3 \n"
"mov r400, r60 \n"
"mov r404, r61 \n"
"mov r408, r62 \n"
"mov r412, r63 \n"
"mov r60, r401 \n"
"mov r61, r405 \n"
"mov r62, r409 \n"
"mov r63, r413 \n"
"call 3 \n"
"mov r401, r60 \n"
"mov r405, r61 \n"
"mov r409, r62 \n"
"mov r413, r63 \n"
"mov r60, r402 \n"
"mov r61, r406 \n"
"mov r62, r410 \n"
"mov r63, r414 \n"
"call 3 \n"
"mov r402, r60 \n"
"mov r406, r61 \n"
"mov r410, r62 \n"
"mov r414, r63 \n"
"mov r60, r403 \n"
"mov r61, r407 \n"
"mov r62, r411 \n"
"mov r63, r415 \n"
"call 3 \n"
"mov r403, r60 \n"
"mov r407, r61 \n"
"mov r411, r62 \n"
"mov r415, r63 \n"
"mov r40, r405 \n"
"mov r41, l1.yzyz \n"
"call 0 \n"
"mov r405, r40 \n"
"mul_ieee r405, r405, l1.w \n"
"mov r40, r406 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r406, r40 \n"
"mov r40, r407 \n"
"mov r41, l1.z \n"
"call 0 \n"
"mov r407, r40 \n"
"mul_ieee r407, r407, l1.w \n"
"mov r40, r409 \n"
"mov r41, l2.yzyz \n"
"call 0 \n"
"mov r409, r40 \n"
"mov r40, r410 \n"
"mov r41, l1.yzyz \n"
"call 0 \n"
"mov r410, r40 \n"
"mul_ieee r410, r410, l1.w \n"
"mov r40, r411 \n"
"mov r41, l2.xwxw \n"
"call 0 \n"
"mov r411, r40 \n"
"mov r40, r413 \n"
"mov r41, l2.xwxw \n"
"call 0 \n"
"mov r413, r40 \n"
"mov r40, r414 \n"
"mov r41, l1.z \n"
"call 0 \n"
"mov r414, r40 \n"
"mul_ieee r414, r414, l1.w \n"
"mov r40, r415 \n"
"mov r41, l2.wxwx \n"
"call 0 \n"
"mov r415, r40 \n"
"mov r60, r400 \n"
"mov r61, r401 \n"
"mov r62, r402 \n"
"mov r63, r403 \n"
"call 3 \n"
"mov r400, r60 \n"
"mov r401, r61 \n"
"mov r402, r62 \n"
"mov r403, r63 \n"
"mov r60, r404 \n"
"mov r61, r405 \n"
"mov r62, r406 \n"
"mov r63, r407 \n"
"call 3 \n"
"mov r404, r60 \n"
"mov r405, r61 \n"
"mov r406, r62 \n"
"mov r407, r63 \n"
"mov r60, r408 \n"
"mov r61, r409 \n"
"mov r62, r410 \n"
"mov r63, r411 \n"
"call 3 \n"
"mov r408, r60 \n"
"mov r409, r61 \n"
"mov r410, r62 \n"
"mov r411, r63 \n"
"mov r60, r412 \n"
"mov r61, r413 \n"
"mov r62, r414 \n"
"mov r63, r415 \n"
"call 3 \n"
"mov r412, r60 \n"
"mov r413, r61 \n"
"mov r414, r62 \n"
"mov r415, r63 \n"
"ret \n"
"endfunc \n"
"func 5 \n"
"mov r400, g[r70.x+0] \n"
"mov r401, g[r70.x+64] \n"
"mov r402, g[r70.x+128] \n"
"mov r403, g[r70.x+192] \n"
"mov r404, g[r70.x+256] \n"
"mov r405, g[r70.x+320] \n"
"mov r406, g[r70.x+384] \n"
"mov r407, g[r70.x+448] \n"
"mov r408, g[r70.y+0] \n"
"mov r409, g[r70.y+64] \n"
"mov r410, g[r70.y+128] \n"
"mov r411, g[r70.y+192] \n"
"mov r412, g[r70.y+256] \n"
"mov r413, g[r70.y+320] \n"
"mov r414, g[r70.y+384] \n"
"mov r415, g[r70.y+448] \n"
"ret \n"
"endfunc \n"
"func 6 \n"
"mov g[r70.x+0], r400 \n"
"mov g[r70.x+64], r408 \n"
"mov g[r70.x+128], r404 \n"
"mov g[r70.x+192], r412 \n"
"mov g[r70.x+256], r402 \n"
"mov g[r70.x+320], r410 \n"
"mov g[r70.x+384], r406 \n"
"mov g[r70.x+448], r414 \n"
"mov g[r70.y+0], r401 \n"
"mov g[r70.y+64], r409 \n"
"mov g[r70.y+128], r405 \n"
"mov g[r70.y+192], r413 \n"
"mov g[r70.y+256], r403 \n"
"mov g[r70.y+320], r411 \n"
"mov g[r70.y+384], r407 \n"
"mov g[r70.y+448], r415 \n"
"ret \n"
"endfunc \n"
"end \n";
static const char* _fft32_tomo_fft_source_ =
"il_cs_2_0 \n"
"dcl_num_thread_per_group 64 \n"
"; l0 = (0.0f, 1.401298464e-45f, -1.#QNANf, 2.242077543e-44f, ) \n"
"dcl_literal l0, 0x00000000, 0x00000001, 0xFFFFFFFF, 0x00000010 \n"
"; l1 = (0.0f, 1.0f, -1.0f, 0.7071067691f, ) \n"
"dcl_literal l1, 0x00000000, 0x3F800000, 0xBF800000, 0x3F3504F3 \n"
"; l10 = (0.9238795042f, -0.3826834261f, 0.7071067691f, -0.7071067691f, ) \n"
"dcl_literal l10, 0x3F6C835E, 0xBEC3EF15, 0x3F3504F3, 0xBF3504F3 \n"
"; l11 = (0.3826834261f, -0.9238795042f, -0.3826834261f, -0.9238795042f, ) \n"
"dcl_literal l11, 0x3EC3EF15, 0xBF6C835E, 0xBEC3EF15, 0xBF6C835E \n"
"; l12 = (-0.7071067691f, -0.7071067691f, -0.9238795042f, -0.3826834261f, ) \n"
"dcl_literal l12, 0xBF3504F3, 0xBF3504F3, 0xBF6C835E, 0xBEC3EF15 \n"
"; l13 = (0.9807852507f, -0.1950903237f, 0.9238795042f, -0.3826834261f, ) \n"
"dcl_literal l13, 0x3F7B14BE, 0xBE47C5C2, 0x3F6C835E, 0xBEC3EF15 \n"
"; l14 = (0.8314695954f, -0.5555702448f, 0.7071067691f, -0.7071067691f, ) \n"
"dcl_literal l14, 0x3F54DB31, 0xBF0E39DA, 0x3F3504F3, 0xBF3504F3 \n"
"; l15 = (0.5555702448f, -0.8314695954f, 0.3826834261f, -0.9238795042f, ) \n"
"dcl_literal l15, 0x3F0E39DA, 0xBF54DB31, 0x3EC3EF15, 0xBF6C835E \n"
"; l16 = (0.1950903237f, -0.9807852507f, 0.8314695954f, -0.5555702448f, ) \n"
"dcl_literal l16, 0x3E47C5C2, 0xBF7B14BE, 0x3F54DB31, 0xBF0E39DA \n"
"; l17 = (0.3826834261f, -0.9238795042f, -0.1950903237f, -0.9807852507f, ) \n"
"dcl_literal l17, 0x3EC3EF15, 0xBF6C835E, 0xBE47C5C2, 0xBF7B14BE \n"
"; l18 = (-0.7071067691f, -0.7071067691f, -0.9807852507f, -0.1950903237f, ) \n"
"dcl_literal l18, 0xBF3504F3, 0xBF3504F3, 0xBF7B14BE, 0xBE47C5C2 \n"
"; l19 = (-0.9238795042f, 0.3826834261f, -0.5555702448f, 0.8314695954f, ) \n"
"dcl_literal l19, 0xBF6C835E, 0x3EC3EF15, 0xBF0E39DA, 0x3F54DB31 \n"
"; l30 = (1.541428311e-44f, 7.006492322e-45f, 7.174648137e-43f, 1.121038771e-44f, ) \n"
"dcl_literal l30, 0x0000000B, 0x00000005, 0x00000200, 0x00000008 \n"
"ishl r90.x___, vThreadGrpIdFlat0.x, l30.x \n"
"iadd r80.x___, vTidInGrpFlat0.x, r90.x \n"
"call 6 \n"
"call 5 \n"
"ishl r90._y__, vTidInGrpFlat0.x, l30.y \n"
"iadd r80.x___, r90.x, r90.y \n"
"call 7 \n"
"endmain \n"
"func 0 \n"
"mul_ieee r100, r40, r41 \n"
"mul_ieee r101, r40, r41.yxwz \n"
"sub r40.x_z_, r100.xxzz, r100.yyww \n"
"add r40._y_w, r101.xxzz, r101.yyww \n"
"ret \n"
"endfunc \n"
";FFT2 \n"
"func 2 \n"
"mov r100, r50 \n"
"add r50, r100, r51 \n"
"sub r51, r100, r51 \n"
"ret \n"
"endfunc \n"
";FFT4 \n"
"func 3 \n"
"mov r50, r60 \n"
"mov r51, r62 \n"
"call 2 \n"
"mov r60, r50 \n"
"mov r62, r51 \n"
"mov r50, r61 \n"
"mov r51, r63 \n"
"call 2 \n"
"mov r61, r50 \n"
"mov r63, r51 \n"
"mov r40, r63 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r63, r40 \n"
"mov r50, r60 \n"
"mov r51, r61 \n"
"call 2 \n"
"mov r60, r50 \n"
"mov r61, r51 \n"
"mov r50, r62 \n"
"mov r51, r63 \n"
"call 2 \n"
"mov r62, r50 \n"
"mov r63, r51 \n"
"ret \n"
"endfunc \n"
";FFT8 \n"
"func 4 \n"
"mov r50, r70 \n"
"mov r51, r74 \n"
"call 2 \n"
"mov r70, r50 \n"
"mov r74, r51 \n"
"mov r50, r71 \n"
"mov r51, r75 \n"
"call 2 \n"
"mov r71, r50 \n"
"mov r75, r51 \n"
"mov r50, r72 \n"
"mov r51, r76 \n"
"call 2 \n"
"mov r72, r50 \n"
"mov r76, r51 \n"
"mov r50, r73 \n"
"mov r51, r77 \n"
"call 2 \n"
"mov r73, r50 \n"
"mov r77, r51 \n"
"mov r40, r75 \n"
"mov r41, l1.yzyz \n"
"call 0 \n"
"mov r75, r40 \n"
"mul_ieee r75, r75, l1.w \n"
"mov r40, r76 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r76, r40 \n"
"mov r40, r77 \n"
"mov r41, l1.z \n"
"call 0 \n"
"mov r77, r40 \n"
"mul_ieee r77, r77, l1.w \n"
"mov r60, r70 \n"
"mov r61, r71 \n"
"mov r62, r72 \n"
"mov r63, r73 \n"
"call 3 \n"
"mov r70, r60 \n"
"mov r71, r61 \n"
"mov r72, r62 \n"
"mov r73, r63 \n"
"mov r60, r74 \n"
"mov r61, r75 \n"
"mov r62, r76 \n"
"mov r63, r77 \n"
"call 3 \n"
"mov r74, r60 \n"
"mov r75, r61 \n"
"mov r76, r62 \n"
"mov r77, r63 \n"
"ret \n"
"endfunc \n"
";FFT32 \n"
"func 5 \n"
"mov r60, r400 \n"
"mov r61, r408 \n"
"mov r62, r416 \n"
"mov r63, r424 \n"
"call 3 \n"
"mov r400, r60 \n"
"mov r408, r61 \n"
"mov r416, r62 \n"
"mov r424, r63 \n"
"mov r60, r401 \n"
"mov r61, r409 \n"
"mov r62, r417 \n"
"mov r63, r425 \n"
"call 3 \n"
"mov r401, r60 \n"
"mov r409, r61 \n"
"mov r417, r62 \n"
"mov r425, r63 \n"
"mov r60, r402 \n"
"mov r61, r410 \n"
"mov r62, r418 \n"
"mov r63, r426 \n"
"call 3 \n"
"mov r402, r60 \n"
"mov r410, r61 \n"
"mov r418, r62 \n"
"mov r426, r63 \n"
"mov r60, r403 \n"
"mov r61, r411 \n"
"mov r62, r419 \n"
"mov r63, r427 \n"
"call 3 \n"
"mov r403, r60 \n"
"mov r411, r61 \n"
"mov r419, r62 \n"
"mov r427, r63 \n"
"mov r60, r404 \n"
"mov r61, r412 \n"
"mov r62, r420 \n"
"mov r63, r428 \n"
"call 3 \n"
"mov r404, r60 \n"
"mov r412, r61 \n"
"mov r420, r62 \n"
"mov r428, r63 \n"
"mov r60, r405 \n"
"mov r61, r413 \n"
"mov r62, r421 \n"
"mov r63, r429 \n"
"call 3 \n"
"mov r405, r60 \n"
"mov r413, r61 \n"
"mov r421, r62 \n"
"mov r429, r63 \n"
"mov r60, r406 \n"
"mov r61, r414 \n"
"mov r62, r422 \n"
"mov r63, r430 \n"
"call 3 \n"
"mov r406, r60 \n"
"mov r414, r61 \n"
"mov r422, r62 \n"
"mov r430, r63 \n"
"mov r60, r407 \n"
"mov r61, r415 \n"
"mov r62, r423 \n"
"mov r63, r431 \n"
"call 3 \n"
"mov r407, r60 \n"
"mov r415, r61 \n"
"mov r423, r62 \n"
"mov r431, r63 \n"
"mov r40, r409 \n"
"mov r41, l10.xyxy \n"
"call 0 \n"
"mov r409, r40 \n"
"mov r40, r410 \n"
"mov r41, l10.zwzw \n"
"call 0 \n"
"mov r410, r40 \n"
"mov r40, r411 \n"
"mov r41, l11.xyxy \n"
"call 0 \n"
"mov r411, r40 \n"
"mov r40, r412 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r412, r40 \n"
"mov r40, r413 \n"
"mov r41, l11.zwzw \n"
"call 0 \n"
"mov r413, r40 \n"
"mov r40, r414 \n"
"mov r41, l12.xyxy \n"
"call 0 \n"
"mov r414, r40 \n"
"mov r40, r415 \n"
"mov r41, l12.zwzw \n"
"call 0 \n"
"mov r415, r40 \n"
"mov r40, r417 \n"
"mov r41, l13.xyxy \n"
"call 0 \n"
"mov r417, r40 \n"
"mov r40, r418 \n"
"mov r41, l13.zwzw \n"
"call 0 \n"
"mov r418, r40 \n"
"mov r40, r419 \n"
"mov r41, l14.xyxy \n"
"call 0 \n"
"mov r419, r40 \n"
"mov r40, r420 \n"
"mov r41, l14.zwzw \n"
"call 0 \n"
"mov r420, r40 \n"
"mov r40, r421 \n"
"mov r41, l15.xyxy \n"
"call 0 \n"
"mov r421, r40 \n"
"mov r40, r422 \n"
"mov r41, l15.zwzw \n"
"call 0 \n"
"mov r422, r40 \n"
"mov r40, r423 \n"
"mov r41, l16.xyxy \n"
"call 0 \n"
"mov r423, r40 \n"
"mov r40, r425 \n"
"mov r41, l16.zwzw \n"
"call 0 \n"
"mov r425, r40 \n"
"mov r40, r426 \n"
"mov r41, l17.xyxy \n"
"call 0 \n"
"mov r426, r40 \n"
"mov r40, r427 \n"
"mov r41, l17.zwzw \n"
"call 0 \n"
"mov r427, r40 \n"
"mov r40, r428 \n"
"mov r41, l18.xyxy \n"
"call 0 \n"
"mov r428, r40 \n"
"mov r40, r429 \n"
"mov r41, l18.zwzw \n"
"call 0 \n"
"mov r429, r40 \n"
"mov r40, r430 \n"
"mov r41, l19.xyxy \n"
"call 0 \n"
"mov r430, r40 \n"
"mov r40, r431 \n"
"mov r41, l19.zwzw \n"
"call 0 \n"
"mov r431, r40 \n"
"mov r70, r400 \n"
"mov r71, r401 \n"
"mov r72, r402 \n"
"mov r73, r403 \n"
"mov r74, r404 \n"
"mov r75, r405 \n"
"mov r76, r406 \n"
"mov r77, r407 \n"
"call 4 \n"
"mov r400, r70 \n"
"mov r401, r71 \n"
"mov r402, r72 \n"
"mov r403, r73 \n"
"mov r404, r74 \n"
"mov r405, r75 \n"
"mov r406, r76 \n"
"mov r407, r77 \n"
"mov r70, r408 \n"
"mov r71, r409 \n"
"mov r72, r410 \n"
"mov r73, r411 \n"
"mov r74, r412 \n"
"mov r75, r413 \n"
"mov r76, r414 \n"
"mov r77, r415 \n"
"call 4 \n"
"mov r408, r70 \n"
"mov r409, r71 \n"
"mov r410, r72 \n"
"mov r411, r73 \n"
"mov r412, r74 \n"
"mov r413, r75 \n"
"mov r414, r76 \n"
"mov r415, r77 \n"
"mov r70, r416 \n"
"mov r71, r417 \n"
"mov r72, r418 \n"
"mov r73, r419 \n"
"mov r74, r420 \n"
"mov r75, r421 \n"
"mov r76, r422 \n"
"mov r77, r423 \n"
"call 4 \n"
"mov r416, r70 \n"
"mov r417, r71 \n"
"mov r418, r72 \n"
"mov r419, r73 \n"
"mov r420, r74 \n"
"mov r421, r75 \n"
"mov r422, r76 \n"
"mov r423, r77 \n"
"mov r70, r424 \n"
"mov r71, r425 \n"
"mov r72, r426 \n"
"mov r73, r427 \n"
"mov r74, r428 \n"
"mov r75, r429 \n"
"mov r76, r430 \n"
"mov r77, r431 \n"
"call 4 \n"
"mov r424, r70 \n"
"mov r425, r71 \n"
"mov r426, r72 \n"
"mov r427, r73 \n"
"mov r428, r74 \n"
"mov r429, r75 \n"
"mov r430, r76 \n"
"mov r431, r77 \n"
"ret \n"
"endfunc \n"
"func 6 \n"
"mov r80._y__, r80.x \n"
"mov r400, g[r80.y+0] \n"
"mov r401, g[r80.y+64] \n"
"mov r402, g[r80.y+128] \n"
"mov r403, g[r80.y+192] \n"
"mov r404, g[r80.y+256] \n"
"mov r405, g[r80.y+320] \n"
"mov r406, g[r80.y+384] \n"
"mov r407, g[r80.y+448] \n"
"iadd r80._y__, r80.y, l30.z \n"
"mov r408, g[r80.y+0] \n"
"mov r409, g[r80.y+64] \n"
"mov r410, g[r80.y+128] \n"
"mov r411, g[r80.y+192] \n"
"mov r412, g[r80.y+256] \n"
"mov r413, g[r80.y+320] \n"
"mov r414, g[r80.y+384] \n"
"mov r415, g[r80.y+448] \n"
"iadd r80._y__, r80.y, l30.z \n"
"mov r416, g[r80.y+0] \n"
"mov r417, g[r80.y+64] \n"
"mov r418, g[r80.y+128] \n"
"mov r419, g[r80.y+192] \n"
"mov r420, g[r80.y+256] \n"
"mov r421, g[r80.y+320] \n"
"mov r422, g[r80.y+384] \n"
"mov r423, g[r80.y+448] \n"
"iadd r80._y__, r80.y, l30.z \n"
"mov r424, g[r80.y+0] \n"
"mov r425, g[r80.y+64] \n"
"mov r426, g[r80.y+128] \n"
"mov r427, g[r80.y+192] \n"
"mov r428, g[r80.y+256] \n"
"mov r429, g[r80.y+320] \n"
"mov r430, g[r80.y+384] \n"
"mov r431, g[r80.y+448] \n"
"ret \n"
"endfunc \n"
"func 7 \n"
"mov g[r80.x+0], r400 \n"
"mov g[r80.x+1], r416 \n"
"mov g[r80.x+2], r408 \n"
"mov g[r80.x+3], r424 \n"
"mov g[r80.x+4], r404 \n"
"mov g[r80.x+5], r420 \n"
"mov g[r80.x+6], r412 \n"
"mov g[r80.x+7], r428 \n"
"mov g[r80.x+8], r402 \n"
"mov g[r80.x+9], r418 \n"
"mov g[r80.x+10], r410 \n"
"mov g[r80.x+11], r426 \n"
"mov g[r80.x+12], r406 \n"
"mov g[r80.x+13], r422 \n"
"mov g[r80.x+14], r414 \n"
"mov g[r80.x+15], r430 \n"
"mov g[r80.x+16], r401 \n"
"mov g[r80.x+17], r417 \n"
"mov g[r80.x+18], r409 \n"
"mov g[r80.x+19], r425 \n"
"mov g[r80.x+20], r405 \n"
"mov g[r80.x+21], r421 \n"
"mov g[r80.x+22], r413 \n"
"mov g[r80.x+23], r429 \n"
"mov g[r80.x+24], r403 \n"
"mov g[r80.x+25], r419 \n"
"mov g[r80.x+26], r411 \n"
"mov g[r80.x+27], r427 \n"
"mov g[r80.x+28], r407 \n"
"mov g[r80.x+29], r423 \n"
"mov g[r80.x+30], r415 \n"
"mov g[r80.x+31], r431 \n"
"ret \n"
"endfunc \n"
"end \n";
static const char* _fft64_tomo_fft_source_ =
"il_cs_2_0 \n"
"dcl_num_thread_per_group 64 \n"
"dcl_lds_size_per_thread 8 \n"
"dcl_lds_sharing_mode _wavefrontRel \n"
"; l0 = (0.0f, 1.401298464e-45f, -1.#QNANf, 2.802596929e-45f, ) \n"
"dcl_literal l0, 0x00000000, 0x00000001, 0xFFFFFFFF, 0x00000002 \n"
"; l1 = (0.0f, 1.0f, -1.0f, 0.7071067691f, ) \n"
"dcl_literal l1, 0x00000000, 0x3F800000, 0xBF800000, 0x3F3504F3 \n"
"; l2 = (0.3826834261f, 0.9238795042f, -0.3826834261f, -0.9238795042f, ) \n"
"dcl_literal l2, 0x3EC3EF15, 0x3F6C835E, 0xBEC3EF15, 0xBF6C835E \n"
"; l5 = (64.0f, 0.0f, 0.0f, 0.0f, ) \n"
"dcl_literal l5, 0x42800000, 0x00000000, 0x00000000, 0x00000000 \n"
"; l10 = (0.0f, -25.13274193f, -12.56637096f, -37.69911194f, ) \n"
"dcl_literal l10, 0x80000000, 0xC1C90FDB, 0xC1490FDB, 0xC216CBE4 \n"
"; l11 = (-6.283185482f, -31.41592598f, -18.84955597f, -43.98229599f, ) \n"
"dcl_literal l11, 0xC0C90FDB, 0xC1FB53D1, 0xC196CBE4, 0xC22FEDDF \n"
"; l20 = (0.0f, 1.401298464e-45f, -1.#QNANf, 0.0f, ) \n"
"dcl_literal l20, 0x00000000, 0x00000001, 0xFFFFFFFF, 0x00000000 \n"
"; l21 = (1.401298464e-45f, 2.802596929e-45f, -1.#QNANf, 1.401298464e-45f, ) \n"
"dcl_literal l21, 0x00000001, 0x00000002, 0xFFFFFFFE, 0x00000001 \n"
"; l22 = (2.802596929e-45f, 5.605193857e-45f, -1.#QNANf, 4.203895393e-45f, ) \n"
"dcl_literal l22, 0x00000002, 0x00000004, 0xFFFFFFFC, 0x00000003 \n"
"; l23 = (4.203895393e-45f, 1.121038771e-44f, -1.#QNANf, 9.809089250e-45f, ) \n"
"dcl_literal l23, 0x00000003, 0x00000008, 0xFFFFFFF8, 0x00000007 \n"
"; l24 = (5.605193857e-45f, 2.242077543e-44f, -1.#QNANf, 2.101947696e-44f, ) \n"
"dcl_literal l24, 0x00000004, 0x00000010, 0xFFFFFFF0, 0x0000000F \n"
"; l25 = (7.006492322e-45f, 4.484155086e-44f, -1.#QNANf, 4.344025239e-44f, ) \n"
"dcl_literal l25, 0x00000005, 0x00000020, 0xFFFFFFE0, 0x0000001F \n"
"; l29 = (1.261168618e-44f, 7.174648137e-43f, 0.0f, 0.0f, ) \n"
"dcl_literal l29, 0x00000009, 0x00000200, 0x00000000, 0x00000000 \n"
"; l30 = (1.401298464e-44f, 1.434929627e-42f, 0.0f, 0.0f, ) \n"
"dcl_literal l30, 0x0000000A, 0x00000400, 0x00000000, 0x00000000 \n"
"ishl r70.x___, vThreadGrpIdFlat0.x, l29.x \n"
"iadd r70.x___, vTidInGrpFlat0.x, r70.x \n"
"call 5 \n"
"call 4 \n"
"and r0.x___, vTidInGrpFlat0.x, l23.w \n"
"itof r80.x___, r0.x \n"
"div_zeroop(fltmax) r80, r80.x, l5.x \n"
"call 7 \n"
"call 81 \n"
"inot r75.x___, l24.x \n"
"and r75.x___, vTidInGrpFlat0.x, r75.x \n"
"and r75._y__, vTidInGrpFlat0.x, l24.x \n"
"call 91 \n"
"call 82 \n"
"inot r75.x___, l24.x \n"
"and r75.x___, vTidInGrpFlat0.x, r75.x \n"
"and r75._y__, vTidInGrpFlat0.x, l24.x \n"
"call 92 \n"
"call 83 \n"
"inot r75.x___, l24.x \n"
"and r75.x___, vTidInGrpFlat0.x, r75.x \n"
"and r75._y__, vTidInGrpFlat0.x, l24.x \n"
"call 93 \n"
"call 84 \n"
"inot r75.x___, l24.x \n"
"and r75.x___, vTidInGrpFlat0.x, r75.x \n"
"and r75._y__, vTidInGrpFlat0.x, l24.x \n"
"call 94 \n"
"call 4 \n"
"call 6 \n"
"endmain \n"
"func 7 \n"
"mul_ieee r100, r80, l10 \n"
"mul_ieee r101, r80, l11 \n"
"cos_vec r110, r100 \n"
"cos_vec r111, r101 \n"
"sin_vec r120, r100 \n"
"sin_vec r121, r101 \n"
"mov r40, r401 \n"
"mov r41.x_z_, r110.y \n"
"mov r41._y_w, r120.y \n"
"call 0 \n"
"mov r401, r40 \n"
"mov r40, r402 \n"
"mov r41.x_z_, r110.z \n"
"mov r41._y_w, r120.z \n"
"call 0 \n"
"mov r402, r40 \n"
"mov r40, r403 \n"
"mov r41.x_z_, r110.w \n"
"mov r41._y_w, r120.w \n"
"call 0 \n"
"mov r403, r40 \n"
"mov r40, r404 \n"
"mov r41.x_z_, r111.x \n"
"mov r41._y_w, r121.x \n"
"call 0 \n"
"mov r404, r40 \n"
"mov r40, r405 \n"
"mov r41.x_z_, r111.y \n"
"mov r41._y_w, r121.y \n"
"call 0 \n"
"mov r405, r40 \n"
"mov r40, r406 \n"
"mov r41.x_z_, r111.z \n"
"mov r41._y_w, r121.z \n"
"call 0 \n"
"mov r406, r40 \n"
"mov r40, r407 \n"
"mov r41.x_z_, r111.w \n"
"mov r41._y_w, r121.w \n"
"call 0 \n"
"mov r407, r40 \n"
"ret \n"
"endfunc \n"
"func 81 \n"
"mov r500.x___, r400.x \n"
"mov r500._y__, r404.x \n"
"mov r500.__z_, r402.x \n"
"mov r500.___w, r406.x \n"
"mov r501.x___, r401.x \n"
"mov r501._y__, r405.x \n"
"mov r501.__z_, r403.x \n"
"mov r501.___w, r407.x \n"
"lds_write_vec mem0, r500 \n"
"lds_write_vec_lOffset(4) mem0, r501 \n"
"fence_lds \n"
"ret \n"
"endfunc \n"
"func 91 \n"
"lds_read_vec_neighborExch r500, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r501, r75.xyyy \n"
"mov r400.x___, r500.x \n"
"mov r401.x___, r500.y \n"
"mov r402.x___, r500.z \n"
"mov r403.x___, r500.w \n"
"mov r404.x___, r501.x \n"
"mov r405.x___, r501.y \n"
"mov r406.x___, r501.z \n"
"mov r407.x___, r501.w \n"
"ret \n"
"endfunc \n"
"func 82 \n"
"mov r500.x___, r400.y \n"
"mov r500._y__, r404.y \n"
"mov r500.__z_, r402.y \n"
"mov r500.___w, r406.y \n"
"mov r501.x___, r401.y \n"
"mov r501._y__, r405.y \n"
"mov r501.__z_, r403.y \n"
"mov r501.___w, r407.y \n"
"lds_write_vec mem0, r500 \n"
"lds_write_vec_lOffset(4) mem0, r501 \n"
"fence_lds \n"
"ret \n"
"endfunc \n"
"func 92 \n"
"lds_read_vec_neighborExch r500, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r501, r75.xyyy \n"
"mov r400._y__, r500.x \n"
"mov r401._y__, r500.y \n"
"mov r402._y__, r500.z \n"
"mov r403._y__, r500.w \n"
"mov r404._y__, r501.x \n"
"mov r405._y__, r501.y \n"
"mov r406._y__, r501.z \n"
"mov r407._y__, r501.w \n"
"ret \n"
"endfunc \n"
"func 83 \n"
"mov r500.x___, r400.z \n"
"mov r500._y__, r404.z \n"
"mov r500.__z_, r402.z \n"
"mov r500.___w, r406.z \n"
"mov r501.x___, r401.z \n"
"mov r501._y__, r405.z \n"
"mov r501.__z_, r403.z \n"
"mov r501.___w, r407.z \n"
"lds_write_vec mem0, r500 \n"
"lds_write_vec_lOffset(4) mem0, r501 \n"
"fence_lds \n"
"ret \n"
"endfunc \n"
"func 93 \n"
"lds_read_vec_neighborExch r500, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r501, r75.xyyy \n"
"mov r400.__z_, r500.x \n"
"mov r401.__z_, r500.y \n"
"mov r402.__z_, r500.z \n"
"mov r403.__z_, r500.w \n"
"mov r404.__z_, r501.x \n"
"mov r405.__z_, r501.y \n"
"mov r406.__z_, r501.z \n"
"mov r407.__z_, r501.w \n"
"ret \n"
"endfunc \n"
"func 84 \n"
"mov r500.x___, r400.w \n"
"mov r500._y__, r404.w \n"
"mov r500.__z_, r402.w \n"
"mov r500.___w, r406.w \n"
"mov r501.x___, r401.w \n"
"mov r501._y__, r405.w \n"
"mov r501.__z_, r403.w \n"
"mov r501.___w, r407.w \n"
"lds_write_vec mem0, r500 \n"
"lds_write_vec_lOffset(4) mem0, r501 \n"
"fence_lds \n"
"ret \n"
"endfunc \n"
"func 94 \n"
"lds_read_vec_neighborExch r500, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r501, r75.xyyy \n"
"mov r400.___w, r500.x \n"
"mov r401.___w, r500.y \n"
"mov r402.___w, r500.z \n"
"mov r403.___w, r500.w \n"
"mov r404.___w, r501.x \n"
"mov r405.___w, r501.y \n"
"mov r406.___w, r501.z \n"
"mov r407.___w, r501.w \n"
"ret \n"
"endfunc \n"
"func 0 \n"
"mul_ieee r100, r40, r41 \n"
"mul_ieee r101, r40, r41.yxwz \n"
"sub r40.x_z_, r100.xxzz, r100.yyww \n"
"add r40._y_w, r101.xxzz, r101.yyww \n"
"ret \n"
"endfunc \n"
"func 2 \n"
"mov r100, r50 \n"
"add r50, r100, r51 \n"
"sub r51, r100, r51 \n"
"ret \n"
"endfunc \n"
"func 3 \n"
"mov r50, r60 \n"
"mov r51, r62 \n"
"call 2 \n"
"mov r60, r50 \n"
"mov r62, r51 \n"
"mov r50, r61 \n"
"mov r51, r63 \n"
"call 2 \n"
"mov r61, r50 \n"
"mov r63, r51 \n"
"mov r40, r63 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r63, r40 \n"
"mov r50, r60 \n"
"mov r51, r61 \n"
"call 2 \n"
"mov r60, r50 \n"
"mov r61, r51 \n"
"mov r50, r62 \n"
"mov r51, r63 \n"
"call 2 \n"
"mov r62, r50 \n"
"mov r63, r51 \n"
"ret \n"
"endfunc \n"
";FFT8. \n"
"func 4 \n"
"mov r50, r400 \n"
"mov r51, r404 \n"
"call 2 \n"
"mov r400, r50 \n"
"mov r404, r51 \n"
"mov r50, r401 \n"
"mov r51, r405 \n"
"call 2 \n"
"mov r401, r50 \n"
"mov r405, r51 \n"
"mov r50, r402 \n"
"mov r51, r406 \n"
"call 2 \n"
"mov r402, r50 \n"
"mov r406, r51 \n"
"mov r50, r403 \n"
"mov r51, r407 \n"
"call 2 \n"
"mov r403, r50 \n"
"mov r407, r51 \n"
"mov r40, r405 \n"
"mov r41, l1.yzyz \n"
"call 0 \n"
"mov r405, r40 \n"
"mul_ieee r405, r405, l1.w \n"
"mov r40, r406 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r406, r40 \n"
"mov r40, r407 \n"
"mov r41, l1.z \n"
"call 0 \n"
"mov r407, r40 \n"
"mul_ieee r407, r407, l1.w \n"
"mov r60, r400 \n"
"mov r61, r401 \n"
"mov r62, r402 \n"
"mov r63, r403 \n"
"call 3 \n"
"mov r400, r60 \n"
"mov r401, r61 \n"
"mov r402, r62 \n"
"mov r403, r63 \n"
"mov r60, r404 \n"
"mov r61, r405 \n"
"mov r62, r406 \n"
"mov r63, r407 \n"
"call 3 \n"
"mov r404, r60 \n"
"mov r405, r61 \n"
"mov r406, r62 \n"
"mov r407, r63 \n"
"ret \n"
"endfunc \n"
"func 5 \n"
"mov r400, g[r70.x+0] \n"
"mov r401, g[r70.x+64] \n"
"mov r402, g[r70.x+128] \n"
"mov r403, g[r70.x+192] \n"
"mov r404, g[r70.x+256] \n"
"mov r405, g[r70.x+320] \n"
"mov r406, g[r70.x+384] \n"
"mov r407, g[r70.x+448] \n"
"ret \n"
"endfunc \n"
"func 6 \n"
"mov g[r70.x+0], r400 \n"
"mov g[r70.x+64], r404 \n"
"mov g[r70.x+128], r402 \n"
"mov g[r70.x+192], r406 \n"
"mov g[r70.x+256], r401 \n"
"mov g[r70.x+320], r405 \n"
"mov g[r70.x+384], r403 \n"
"mov g[r70.x+448], r407 \n"
"ret \n"
"endfunc \n"
"end \n";
static const char* _fft256_tomo_fft_source_ =
"il_cs_2_0 \n"
"dcl_num_thread_per_group 64 \n"
"dcl_lds_size_per_thread 16 \n"
"dcl_lds_sharing_mode _wavefrontRel \n"
"; l0 = (0.0f, 1.401298464e-45f, -1.#QNANf, 2.802596929e-45f, ) \n"
"dcl_literal l0, 0x00000000, 0x00000001, 0xFFFFFFFF, 0x00000002 \n"
"; l1 = (0.0f, 1.0f, -1.0f, 0.7071067691f, ) \n"
"dcl_literal l1, 0x00000000, 0x3F800000, 0xBF800000, 0x3F3504F3 \n"
"; l2 = (0.3826834261f, 0.9238795042f, -0.3826834261f, -0.9238795042f, ) \n"
"dcl_literal l2, 0x3EC3EF15, 0x3F6C835E, 0xBEC3EF15, 0xBF6C835E \n"
"; l3 = (-1.#QNANf, 1.681558157e-44f, 5.605193857e-45f, 1.121038771e-44f, ) \n"
"dcl_literal l3, 0xFFFFFFF3, 0x0000000C, 0x00000004, 0x00000008 \n"
"; l5 = (256.0f, 0.0f, 0.0f, 0.0f, ) \n"
"dcl_literal l5, 0x43800000, 0x00000000, 0x00000000, 0x00000000 \n"
"; l10 = (0.0f, -50.26548386f, -25.13274193f, -75.39822388f, ) \n"
"dcl_literal l10, 0x80000000, 0xC2490FDB, 0xC1C90FDB, 0xC296CBE4 \n"
"; l11 = (-12.56637096f, -62.83185196f, -37.69911194f, -87.96459198f, ) \n"
"dcl_literal l11, 0xC1490FDB, 0xC27B53D1, 0xC216CBE4, 0xC2AFEDDF \n"
"; l12 = (-6.283185482f, -56.54866791f, -31.41592598f, -81.68141174f, ) \n"
"dcl_literal l12, 0xC0C90FDB, 0xC26231D6, 0xC1FB53D1, 0xC2A35CE2 \n"
"; l13 = (-18.84955597f, -69.11503601f, -43.98229599f, -94.24777985f, ) \n"
"dcl_literal l13, 0xC196CBE4, 0xC28A3AE6, 0xC22FEDDF, 0xC2BC7EDD \n"
"; l20 = (0.0f, 1.401298464e-45f, -1.#QNANf, 0.0f, ) \n"
"dcl_literal l20, 0x00000000, 0x00000001, 0xFFFFFFFF, 0x00000000 \n"
"; l21 = (1.401298464e-45f, 2.802596929e-45f, -1.#QNANf, 1.401298464e-45f, ) \n"
"dcl_literal l21, 0x00000001, 0x00000002, 0xFFFFFFFE, 0x00000001 \n"
"; l22 = (2.802596929e-45f, 5.605193857e-45f, -1.#QNANf, 4.203895393e-45f, ) \n"
"dcl_literal l22, 0x00000002, 0x00000004, 0xFFFFFFFC, 0x00000003 \n"
"; l23 = (4.203895393e-45f, 1.121038771e-44f, -1.#QNANf, 9.809089250e-45f, ) \n"
"dcl_literal l23, 0x00000003, 0x00000008, 0xFFFFFFF8, 0x00000007 \n"
"; l24 = (5.605193857e-45f, 2.242077543e-44f, -1.#QNANf, 2.101947696e-44f, ) \n"
"dcl_literal l24, 0x00000004, 0x00000010, 0xFFFFFFF0, 0x0000000F \n"
"; l25 = (7.006492322e-45f, 4.484155086e-44f, -1.#QNANf, 4.344025239e-44f, ) \n"
"dcl_literal l25, 0x00000005, 0x00000020, 0xFFFFFFE0, 0x0000001F \n"
"; l29 = (1.261168618e-44f, 7.174648137e-43f, 0.0f, 0.0f, ) \n"
"dcl_literal l29, 0x00000009, 0x00000200, 0x00000000, 0x00000000 \n"
"; l30 = (1.401298464e-44f, 1.434929627e-42f, 0.0f, 0.0f, ) \n"
"dcl_literal l30, 0x0000000A, 0x00000400, 0x00000000, 0x00000000 \n"
"ishl r70.x___, vThreadGrpIdFlat0.x, l30.x \n"
"iadd r70.x___, vTidInGrpFlat0.x, r70.x \n"
"iadd r70._y__, r70.x, l29.y \n"
"call 5 \n"
"call 4 \n"
"and r0.x___, vTidInGrpFlat0.x, l24.w \n"
"itof r80.x___, r0.x \n"
"div_zeroop(fltmax) r80, r80.x, l5.x \n"
"call 7 \n"
"call 81 \n"
"and r75.x___, vTidInGrpFlat0.x, l3.x \n"
"and r75._y__, vTidInGrpFlat0.x, l3.y \n"
"call 91 \n"
"call 82 \n"
"and r75.x___, vTidInGrpFlat0.x, l3.x \n"
"and r75._y__, vTidInGrpFlat0.x, l3.y \n"
"call 92 \n"
"call 83 \n"
"and r75.x___, vTidInGrpFlat0.x, l3.x \n"
"and r75._y__, vTidInGrpFlat0.x, l3.y \n"
"call 93 \n"
"call 84 \n"
"and r75.x___, vTidInGrpFlat0.x, l3.x \n"
"and r75._y__, vTidInGrpFlat0.x, l3.y \n"
"call 94 \n"
"call 4 \n"
"call 6 \n"
"endmain \n"
"func 7 \n"
"mul_ieee r100, r80.x, l10 \n"
"mul_ieee r101, r80.x, l11 \n"
"mul_ieee r102, r80.x, l12 \n"
"mul_ieee r103, r80.x, l13 \n"
"cos_vec r110._yzw, r100 \n"
"cos_vec r111, r101 \n"
"cos_vec r112, r102 \n"
"cos_vec r113, r103 \n"
"sin_vec r120._yzw, r100 \n"
"sin_vec r121, r101 \n"
"sin_vec r122, r102 \n"
"sin_vec r123, r103 \n"
"mov r40, r401 \n"
"mov r41.x_z_, r110.y \n"
"mov r41._y_w, r120.y \n"
"call 0 \n"
"mov r401, r40 \n"
"mov r40, r402 \n"
"mov r41.x_z_, r110.z \n"
"mov r41._y_w, r120.z \n"
"call 0 \n"
"mov r402, r40 \n"
"mov r40, r403 \n"
"mov r41.x_z_, r110.w \n"
"mov r41._y_w, r120.w \n"
"call 0 \n"
"mov r403, r40 \n"
"mov r40, r404 \n"
"mov r41.x_z_, r111.x \n"
"mov r41._y_w, r121.x \n"
"call 0 \n"
"mov r404, r40 \n"
"mov r40, r405 \n"
"mov r41.x_z_, r111.y \n"
"mov r41._y_w, r121.y \n"
"call 0 \n"
"mov r405, r40 \n"
"mov r40, r406 \n"
"mov r41.x_z_, r111.z \n"
"mov r41._y_w, r121.z \n"
"call 0 \n"
"mov r406, r40 \n"
"mov r40, r407 \n"
"mov r41.x_z_, r111.w \n"
"mov r41._y_w, r121.w \n"
"call 0 \n"
"mov r407, r40 \n"
"mov r40, r408 \n"
"mov r41.x_z_, r112.x \n"
"mov r41._y_w, r122.x \n"
"call 0 \n"
"mov r408, r40 \n"
"mov r40, r409 \n"
"mov r41.x_z_, r112.y \n"
"mov r41._y_w, r122.y \n"
"call 0 \n"
"mov r409, r40 \n"
"mov r40, r410 \n"
"mov r41.x_z_, r112.z \n"
"mov r41._y_w, r122.z \n"
"call 0 \n"
"mov r410, r40 \n"
"mov r40, r411 \n"
"mov r41.x_z_, r112.w \n"
"mov r41._y_w, r122.w \n"
"call 0 \n"
"mov r411, r40 \n"
"mov r40, r412 \n"
"mov r41.x_z_, r113.x \n"
"mov r41._y_w, r123.x \n"
"call 0 \n"
"mov r412, r40 \n"
"mov r40, r413 \n"
"mov r41.x_z_, r113.y \n"
"mov r41._y_w, r123.y \n"
"call 0 \n"
"mov r413, r40 \n"
"mov r40, r414 \n"
"mov r41.x_z_, r113.z \n"
"mov r41._y_w, r123.z \n"
"call 0 \n"
"mov r414, r40 \n"
"mov r40, r415 \n"
"mov r41.x_z_, r113.w \n"
"mov r41._y_w, r123.w \n"
"call 0 \n"
"mov r415, r40 \n"
"ret \n"
"endfunc \n"
"func 81 \n"
"mov r500.x___, r400.x \n"
"mov r500._y__, r408.x \n"
"mov r500.__z_, r404.x \n"
"mov r500.___w, r412.x \n"
"mov r501.x___, r402.x \n"
"mov r501._y__, r410.x \n"
"mov r501.__z_, r406.x \n"
"mov r501.___w, r414.x \n"
"mov r502.x___, r401.x \n"
"mov r502._y__, r409.x \n"
"mov r502.__z_, r405.x \n"
"mov r502.___w, r413.x \n"
"mov r503.x___, r403.x \n"
"mov r503._y__, r411.x \n"
"mov r503.__z_, r407.x \n"
"mov r503.___w, r415.x \n"
"lds_write_vec mem0, r500 \n"
"lds_write_vec_lOffset(4) mem0, r501 \n"
"lds_write_vec_lOffset(8) mem0, r502 \n"
"lds_write_vec_lOffset(12) mem0, r503 \n"
"fence_lds \n"
"ret \n"
"endfunc \n"
"func 91 \n"
"lds_read_vec_neighborExch r500, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r501, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r502, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r503, r75.xyyy \n"
"mov r400.x___, r500.x \n"
"mov r401.x___, r500.y \n"
"mov r402.x___, r500.z \n"
"mov r403.x___, r500.w \n"
"mov r404.x___, r501.x \n"
"mov r405.x___, r501.y \n"
"mov r406.x___, r501.z \n"
"mov r407.x___, r501.w \n"
"mov r408.x___, r502.x \n"
"mov r409.x___, r502.y \n"
"mov r410.x___, r502.z \n"
"mov r411.x___, r502.w \n"
"mov r412.x___, r503.x \n"
"mov r413.x___, r503.y \n"
"mov r414.x___, r503.z \n"
"mov r415.x___, r503.w \n"
"ret \n"
"endfunc \n"
"func 82 \n"
"mov r500.x___, r400.y \n"
"mov r500._y__, r408.y \n"
"mov r500.__z_, r404.y \n"
"mov r500.___w, r412.y \n"
"mov r501.x___, r402.y \n"
"mov r501._y__, r410.y \n"
"mov r501.__z_, r406.y \n"
"mov r501.___w, r414.y \n"
"mov r502.x___, r401.y \n"
"mov r502._y__, r409.y \n"
"mov r502.__z_, r405.y \n"
"mov r502.___w, r413.y \n"
"mov r503.x___, r403.y \n"
"mov r503._y__, r411.y \n"
"mov r503.__z_, r407.y \n"
"mov r503.___w, r415.y \n"
"lds_write_vec mem0, r500 \n"
"lds_write_vec_lOffset(4) mem0, r501 \n"
"lds_write_vec_lOffset(8) mem0, r502 \n"
"lds_write_vec_lOffset(12) mem0, r503 \n"
"fence_lds \n"
"ret \n"
"endfunc \n"
"func 92 \n"
"lds_read_vec_neighborExch r500, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r501, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r502, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r503, r75.xyyy \n"
"mov r400._y__, r500.x \n"
"mov r401._y__, r500.y \n"
"mov r402._y__, r500.z \n"
"mov r403._y__, r500.w \n"
"mov r404._y__, r501.x \n"
"mov r405._y__, r501.y \n"
"mov r406._y__, r501.z \n"
"mov r407._y__, r501.w \n"
"mov r408._y__, r502.x \n"
"mov r409._y__, r502.y \n"
"mov r410._y__, r502.z \n"
"mov r411._y__, r502.w \n"
"mov r412._y__, r503.x \n"
"mov r413._y__, r503.y \n"
"mov r414._y__, r503.z \n"
"mov r415._y__, r503.w \n"
"ret \n"
"endfunc \n"
"func 83 \n"
"mov r500.x___, r400.z \n"
"mov r500._y__, r408.z \n"
"mov r500.__z_, r404.z \n"
"mov r500.___w, r412.z \n"
"mov r501.x___, r402.z \n"
"mov r501._y__, r410.z \n"
"mov r501.__z_, r406.z \n"
"mov r501.___w, r414.z \n"
"mov r502.x___, r401.z \n"
"mov r502._y__, r409.z \n"
"mov r502.__z_, r405.z \n"
"mov r502.___w, r413.z \n"
"mov r503.x___, r403.z \n"
"mov r503._y__, r411.z \n"
"mov r503.__z_, r407.z \n"
"mov r503.___w, r415.z \n"
"lds_write_vec mem0, r500 \n"
"lds_write_vec_lOffset(4) mem0, r501 \n"
"lds_write_vec_lOffset(8) mem0, r502 \n"
"lds_write_vec_lOffset(12) mem0, r503 \n"
"fence_lds \n"
"ret \n"
"endfunc \n"
"func 93 \n"
"lds_read_vec_neighborExch r500, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r501, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r502, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r503, r75.xyyy \n"
"mov r400.__z_, r500.x \n"
"mov r401.__z_, r500.y \n"
"mov r402.__z_, r500.z \n"
"mov r403.__z_, r500.w \n"
"mov r404.__z_, r501.x \n"
"mov r405.__z_, r501.y \n"
"mov r406.__z_, r501.z \n"
"mov r407.__z_, r501.w \n"
"mov r408.__z_, r502.x \n"
"mov r409.__z_, r502.y \n"
"mov r410.__z_, r502.z \n"
"mov r411.__z_, r502.w \n"
"mov r412.__z_, r503.x \n"
"mov r413.__z_, r503.y \n"
"mov r414.__z_, r503.z \n"
"mov r415.__z_, r503.w \n"
"ret \n"
"endfunc \n"
"func 84 \n"
"mov r500.x___, r400.w \n"
"mov r500._y__, r408.w \n"
"mov r500.__z_, r404.w \n"
"mov r500.___w, r412.w \n"
"mov r501.x___, r402.w \n"
"mov r501._y__, r410.w \n"
"mov r501.__z_, r406.w \n"
"mov r501.___w, r414.w \n"
"mov r502.x___, r401.w \n"
"mov r502._y__, r409.w \n"
"mov r502.__z_, r405.w \n"
"mov r502.___w, r413.w \n"
"mov r503.x___, r403.w \n"
"mov r503._y__, r411.w \n"
"mov r503.__z_, r407.w \n"
"mov r503.___w, r415.w \n"
"lds_write_vec mem0, r500 \n"
"lds_write_vec_lOffset(4) mem0, r501 \n"
"lds_write_vec_lOffset(8) mem0, r502 \n"
"lds_write_vec_lOffset(12) mem0, r503 \n"
"fence_lds \n"
"ret \n"
"endfunc \n"
"func 94 \n"
"lds_read_vec_neighborExch r500, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r501, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r502, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r503, r75.xyyy \n"
"mov r400.___w, r500.x \n"
"mov r401.___w, r500.y \n"
"mov r402.___w, r500.z \n"
"mov r403.___w, r500.w \n"
"mov r404.___w, r501.x \n"
"mov r405.___w, r501.y \n"
"mov r406.___w, r501.z \n"
"mov r407.___w, r501.w \n"
"mov r408.___w, r502.x \n"
"mov r409.___w, r502.y \n"
"mov r410.___w, r502.z \n"
"mov r411.___w, r502.w \n"
"mov r412.___w, r503.x \n"
"mov r413.___w, r503.y \n"
"mov r414.___w, r503.z \n"
"mov r415.___w, r503.w \n"
"ret \n"
"endfunc \n"
"func 0 \n"
"mul_ieee r100, r40, r41 \n"
"mul_ieee r101, r40, r41.yxwz \n"
"sub r40.x_z_, r100.xxzz, r100.yyww \n"
"add r40._y_w, r101.xxzz, r101.yyww \n"
"ret \n"
"endfunc \n"
"func 2 \n"
"mov r100, r50 \n"
"add r50, r100, r51 \n"
"sub r51, r100, r51 \n"
"ret \n"
"endfunc \n"
"func 3 \n"
"mov r50, r60 \n"
"mov r51, r62 \n"
"call 2 \n"
"mov r60, r50 \n"
"mov r62, r51 \n"
"mov r50, r61 \n"
"mov r51, r63 \n"
"call 2 \n"
"mov r61, r50 \n"
"mov r63, r51 \n"
"mov r40, r63 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r63, r40 \n"
"mov r50, r60 \n"
"mov r51, r61 \n"
"call 2 \n"
"mov r60, r50 \n"
"mov r61, r51 \n"
"mov r50, r62 \n"
"mov r51, r63 \n"
"call 2 \n"
"mov r62, r50 \n"
"mov r63, r51 \n"
"ret \n"
"endfunc \n"
";FFT16 \n"
"func 4 \n"
"mov r60, r400 \n"
"mov r61, r404 \n"
"mov r62, r408 \n"
"mov r63, r412 \n"
"call 3 \n"
"mov r400, r60 \n"
"mov r404, r61 \n"
"mov r408, r62 \n"
"mov r412, r63 \n"
"mov r60, r401 \n"
"mov r61, r405 \n"
"mov r62, r409 \n"
"mov r63, r413 \n"
"call 3 \n"
"mov r401, r60 \n"
"mov r405, r61 \n"
"mov r409, r62 \n"
"mov r413, r63 \n"
"mov r60, r402 \n"
"mov r61, r406 \n"
"mov r62, r410 \n"
"mov r63, r414 \n"
"call 3 \n"
"mov r402, r60 \n"
"mov r406, r61 \n"
"mov r410, r62 \n"
"mov r414, r63 \n"
"mov r60, r403 \n"
"mov r61, r407 \n"
"mov r62, r411 \n"
"mov r63, r415 \n"
"call 3 \n"
"mov r403, r60 \n"
"mov r407, r61 \n"
"mov r411, r62 \n"
"mov r415, r63 \n"
"mov r40, r405 \n"
"mov r41, l1.yzyz \n"
"call 0 \n"
"mov r405, r40 \n"
"mul_ieee r405, r405, l1.w \n"
"mov r40, r406 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r406, r40 \n"
"mov r40, r407 \n"
"mov r41, l1.z \n"
"call 0 \n"
"mov r407, r40 \n"
"mul_ieee r407, r407, l1.w \n"
"mov r40, r409 \n"
"mov r41, l2.yzyz \n"
"call 0 \n"
"mov r409, r40 \n"
"mov r40, r410 \n"
"mov r41, l1.yzyz \n"
"call 0 \n"
"mov r410, r40 \n"
"mul_ieee r410, r410, l1.w \n"
"mov r40, r411 \n"
"mov r41, l2.xwxw \n"
"call 0 \n"
"mov r411, r40 \n"
"mov r40, r413 \n"
"mov r41, l2.xwxw \n"
"call 0 \n"
"mov r413, r40 \n"
"mov r40, r414 \n"
"mov r41, l1.z \n"
"call 0 \n"
"mov r414, r40 \n"
"mul_ieee r414, r414, l1.w \n"
"mov r40, r415 \n"
"mov r41, l2.wxwx \n"
"call 0 \n"
"mov r415, r40 \n"
"mov r60, r400 \n"
"mov r61, r401 \n"
"mov r62, r402 \n"
"mov r63, r403 \n"
"call 3 \n"
"mov r400, r60 \n"
"mov r401, r61 \n"
"mov r402, r62 \n"
"mov r403, r63 \n"
"mov r60, r404 \n"
"mov r61, r405 \n"
"mov r62, r406 \n"
"mov r63, r407 \n"
"call 3 \n"
"mov r404, r60 \n"
"mov r405, r61 \n"
"mov r406, r62 \n"
"mov r407, r63 \n"
"mov r60, r408 \n"
"mov r61, r409 \n"
"mov r62, r410 \n"
"mov r63, r411 \n"
"call 3 \n"
"mov r408, r60 \n"
"mov r409, r61 \n"
"mov r410, r62 \n"
"mov r411, r63 \n"
"mov r60, r412 \n"
"mov r61, r413 \n"
"mov r62, r414 \n"
"mov r63, r415 \n"
"call 3 \n"
"mov r412, r60 \n"
"mov r413, r61 \n"
"mov r414, r62 \n"
"mov r415, r63 \n"
"ret \n"
"endfunc \n"
"func 5 \n"
"mov r400, g[r70.x+0] \n"
"mov r401, g[r70.x+64] \n"
"mov r402, g[r70.x+128] \n"
"mov r403, g[r70.x+192] \n"
"mov r404, g[r70.x+256] \n"
"mov r405, g[r70.x+320] \n"
"mov r406, g[r70.x+384] \n"
"mov r407, g[r70.x+448] \n"
"mov r408, g[r70.y+0] \n"
"mov r409, g[r70.y+64] \n"
"mov r410, g[r70.y+128] \n"
"mov r411, g[r70.y+192] \n"
"mov r412, g[r70.y+256] \n"
"mov r413, g[r70.y+320] \n"
"mov r414, g[r70.y+384] \n"
"mov r415, g[r70.y+448] \n"
"ret \n"
"endfunc \n"
"func 6 \n"
"mov g[r70.x+0], r400 \n"
"mov g[r70.x+64], r408 \n"
"mov g[r70.x+128], r404 \n"
"mov g[r70.x+192], r412 \n"
"mov g[r70.x+256], r402 \n"
"mov g[r70.x+320], r410 \n"
"mov g[r70.x+384], r406 \n"
"mov g[r70.x+448], r414 \n"
"mov g[r70.y+0], r401 \n"
"mov g[r70.y+64], r409 \n"
"mov g[r70.y+128], r405 \n"
"mov g[r70.y+192], r413 \n"
"mov g[r70.y+256], r403 \n"
"mov g[r70.y+320], r411 \n"
"mov g[r70.y+384], r407 \n"
"mov g[r70.y+448], r415 \n"
"ret \n"
"endfunc \n"
"end \n";
static const char* _fft512_tomo_fft_source_ =
"il_cs_2_0 \n"
"dcl_num_thread_per_group 64 \n"
"dcl_lds_size_per_thread 32 \n"
"dcl_lds_sharing_mode _wavefrontRel \n"
"; l0 = (0.0f, 1.401298464e-45f, -1.#QNANf, 2.242077543e-44f, ) \n"
"dcl_literal l0, 0x00000000, 0x00000001, 0xFFFFFFFF, 0x00000010 \n"
"; l1 = (0.0f, 1.0f, -1.0f, 0.7071067691f, ) \n"
"dcl_literal l1, 0x00000000, 0x3F800000, 0xBF800000, 0x3F3504F3 \n"
"; l2 = (0.3826834261f, 0.9238795042f, -0.3826834261f, -0.9238795042f, ) \n"
"dcl_literal l2, 0x3EC3EF15, 0x3F6C835E, 0xBEC3EF15, 0xBF6C835E \n"
"; l3 = (-1.#QNANf, 1.681558157e-44f, 5.605193857e-45f, 1.121038771e-44f, ) \n"
"dcl_literal l3, 0xFFFFFFF3, 0x0000000C, 0x00000004, 0x00000008 \n"
"; l5 = (512.0f, 0.0f, 0.0f, 0.0f, ) \n"
"dcl_literal l5, 0x44000000, 0x00000000, 0x00000000, 0x00000000 \n"
"; l10 = (0.9238795042f, -0.3826834261f, 0.7071067691f, -0.7071067691f, ) \n"
"dcl_literal l10, 0x3F6C835E, 0xBEC3EF15, 0x3F3504F3, 0xBF3504F3 \n"
"; l11 = (0.3826834261f, -0.9238795042f, -0.3826834261f, -0.9238795042f, ) \n"
"dcl_literal l11, 0x3EC3EF15, 0xBF6C835E, 0xBEC3EF15, 0xBF6C835E \n"
"; l12 = (-0.7071067691f, -0.7071067691f, -0.9238795042f, -0.3826834261f, ) \n"
"dcl_literal l12, 0xBF3504F3, 0xBF3504F3, 0xBF6C835E, 0xBEC3EF15 \n"
"; l13 = (0.9807852507f, -0.1950903237f, 0.9238795042f, -0.3826834261f, ) \n"
"dcl_literal l13, 0x3F7B14BE, 0xBE47C5C2, 0x3F6C835E, 0xBEC3EF15 \n"
"; l14 = (0.8314695954f, -0.5555702448f, 0.7071067691f, -0.7071067691f, ) \n"
"dcl_literal l14, 0x3F54DB31, 0xBF0E39DA, 0x3F3504F3, 0xBF3504F3 \n"
"; l15 = (0.5555702448f, -0.8314695954f, 0.3826834261f, -0.9238795042f, ) \n"
"dcl_literal l15, 0x3F0E39DA, 0xBF54DB31, 0x3EC3EF15, 0xBF6C835E \n"
"; l16 = (0.1950903237f, -0.9807852507f, 0.8314695954f, -0.5555702448f, ) \n"
"dcl_literal l16, 0x3E47C5C2, 0xBF7B14BE, 0x3F54DB31, 0xBF0E39DA \n"
"; l17 = (0.3826834261f, -0.9238795042f, -0.1950903237f, -0.9807852507f, ) \n"
"dcl_literal l17, 0x3EC3EF15, 0xBF6C835E, 0xBE47C5C2, 0xBF7B14BE \n"
"; l18 = (-0.7071067691f, -0.7071067691f, -0.9807852507f, -0.1950903237f, ) \n"
"dcl_literal l18, 0xBF3504F3, 0xBF3504F3, 0xBF7B14BE, 0xBE47C5C2 \n"
"; l19 = (-0.9238795042f, 0.3826834261f, -0.5555702448f, 0.8314695954f, ) \n"
"dcl_literal l19, 0xBF6C835E, 0x3EC3EF15, 0xBF0E39DA, 0x3F54DB31 \n"
"; l40 = (0.0f, -100.5309677f, -50.26548386f, -150.7964478f, ) \n"
"dcl_literal l40, 0x80000000, 0xC2C90FDB, 0xC2490FDB, 0xC316CBE4 \n"
"; l41 = (-25.13274193f, -125.6637039f, -75.39822388f, -175.929184f, ) \n"
"dcl_literal l41, 0xC1C90FDB, 0xC2FB53D1, 0xC296CBE4, 0xC32FEDDF \n"
"; l42 = (-12.56637096f, -113.0973358f, -62.83185196f, -163.3628235f, ) \n"
"dcl_literal l42, 0xC1490FDB, 0xC2E231D6, 0xC27B53D1, 0xC3235CE2 \n"
"; l43 = (-37.69911194f, -138.230072f, -87.96459198f, -188.4955597f, ) \n"
"dcl_literal l43, 0xC216CBE4, 0xC30A3AE6, 0xC2AFEDDF, 0xC33C7EDD \n"
"; l44 = (-6.283185482f, -106.8141479f, -56.54866791f, -157.0796356f, ) \n"
"dcl_literal l44, 0xC0C90FDB, 0xC2D5A0D8, 0xC26231D6, 0xC31D1463 \n"
"; l45 = (-31.41592598f, -131.9468842f, -81.68141174f, -182.2123718f, ) \n"
"dcl_literal l45, 0xC1FB53D1, 0xC303F267, 0xC2A35CE2, 0xC336365E \n"
"; l46 = (-18.84955597f, -119.3805237f, -69.11503601f, -169.6459961f, ) \n"
"dcl_literal l46, 0xC196CBE4, 0xC2EEC2D4, 0xC28A3AE6, 0xC329A560 \n"
"; l47 = (-43.98229599f, -144.5132599f, -94.24777985f, -194.7787476f, ) \n"
"dcl_literal l47, 0xC22FEDDF, 0xC3108365, 0xC2BC7EDD, 0xC342C75C \n"
"; l20 = (0.0f, 1.401298464e-45f, -1.#QNANf, 0.0f, ) \n"
"dcl_literal l20, 0x00000000, 0x00000001, 0xFFFFFFFF, 0x00000000 \n"
"; l21 = (1.401298464e-45f, 2.802596929e-45f, -1.#QNANf, 1.401298464e-45f, ) \n"
"dcl_literal l21, 0x00000001, 0x00000002, 0xFFFFFFFE, 0x00000001 \n"
"; l22 = (2.802596929e-45f, 5.605193857e-45f, -1.#QNANf, 4.203895393e-45f, ) \n"
"dcl_literal l22, 0x00000002, 0x00000004, 0xFFFFFFFC, 0x00000003 \n"
"; l23 = (4.203895393e-45f, 1.121038771e-44f, -1.#QNANf, 9.809089250e-45f, ) \n"
"dcl_literal l23, 0x00000003, 0x00000008, 0xFFFFFFF8, 0x00000007 \n"
"; l24 = (5.605193857e-45f, 2.242077543e-44f, -1.#QNANf, 2.101947696e-44f, ) \n"
"dcl_literal l24, 0x00000004, 0x00000010, 0xFFFFFFF0, 0x0000000F \n"
"; l25 = (7.006492322e-45f, 4.484155086e-44f, -1.#QNANf, 4.344025239e-44f, ) \n"
"dcl_literal l25, 0x00000005, 0x00000020, 0xFFFFFFE0, 0x0000001F \n"
"; l30 = (1.541428311e-44f, 7.006492322e-45f, 8.968310172e-44f, 7.174648137e-43f, ) \n"
"dcl_literal l30, 0x0000000B, 0x00000005, 0x00000040, 0x00000200 \n"
"ishl r90.x___, vThreadGrpIdFlat0.x, l30.x \n"
"call 11 \n"
"call 6 \n"
"and r0.x___, vTidInGrpFlat0.x, l24.w \n"
"itof r200.x___, r0.x \n"
"div_zeroop(fltmax) r200, r200.x, l5.x \n"
"call 10 \n"
"and r85.x___, vTidInGrpFlat0.x, l3.x \n"
"and r85._y__, vTidInGrpFlat0.x, l3.y \n"
"ishl r85._y__, r85.y, l0.y \n"
"call 81 \n"
"call 91 \n"
"call 82 \n"
"call 92 \n"
"call 83 \n"
"call 93 \n"
"call 84 \n"
"call 94 \n"
"call 7 \n"
"call 13 \n"
"endmain \n"
"func 11 \n"
"iadd r80.x___, r90.x, vTidInGrpFlat0.x \n"
"iadd r80._y__, r80.x, l30.w \n"
"iadd r80.__z_, r80.y, l30.w \n"
"iadd r80.___w, r80.z, l30.w \n"
"mov r400, g[r80.x+0] \n"
"mov r401, g[r80.x+64] \n"
"mov r402, g[r80.x+128] \n"
"mov r403, g[r80.x+192] \n"
"mov r404, g[r80.x+256] \n"
"mov r405, g[r80.x+320] \n"
"mov r406, g[r80.x+384] \n"
"mov r407, g[r80.x+448] \n"
"mov r408, g[r80.y+0] \n"
"mov r409, g[r80.y+64] \n"
"mov r410, g[r80.y+128] \n"
"mov r411, g[r80.y+192] \n"
"mov r412, g[r80.y+256] \n"
"mov r413, g[r80.y+320] \n"
"mov r414, g[r80.y+384] \n"
"mov r415, g[r80.y+448] \n"
"mov r416, g[r80.z+0] \n"
"mov r417, g[r80.z+64] \n"
"mov r418, g[r80.z+128] \n"
"mov r419, g[r80.z+192] \n"
"mov r420, g[r80.z+256] \n"
"mov r421, g[r80.z+320] \n"
"mov r422, g[r80.z+384] \n"
"mov r423, g[r80.z+448] \n"
"mov r424, g[r80.w+0] \n"
"mov r425, g[r80.w+64] \n"
"mov r426, g[r80.w+128] \n"
"mov r427, g[r80.w+192] \n"
"mov r428, g[r80.w+256] \n"
"mov r429, g[r80.w+320] \n"
"mov r430, g[r80.w+384] \n"
"mov r431, g[r80.w+448] \n"
"ret \n"
"endfunc \n"
"func 13 \n"
"ishl r80.x___, vTidInGrpFlat0.x, l30.y \n"
"iadd r80.x___, r90.x, r80.x \n"
"mov g[r80.x+0], r400 \n"
"mov g[r80.x+1], r408 \n"
"mov g[r80.x+2], r404 \n"
"mov g[r80.x+3], r412 \n"
"mov g[r80.x+4], r402 \n"
"mov g[r80.x+5], r410 \n"
"mov g[r80.x+6], r406 \n"
"mov g[r80.x+7], r414 \n"
"mov g[r80.x+8], r401 \n"
"mov g[r80.x+9], r409 \n"
"mov g[r80.x+10], r405 \n"
"mov g[r80.x+11], r413 \n"
"mov g[r80.x+12], r403 \n"
"mov g[r80.x+13], r411 \n"
"mov g[r80.x+14], r407 \n"
"mov g[r80.x+15], r415 \n"
"mov g[r80.x+16], r416 \n"
"mov g[r80.x+17], r424 \n"
"mov g[r80.x+18], r420 \n"
"mov g[r80.x+19], r428 \n"
"mov g[r80.x+20], r418 \n"
"mov g[r80.x+21], r426 \n"
"mov g[r80.x+22], r422 \n"
"mov g[r80.x+23], r430 \n"
"mov g[r80.x+24], r417 \n"
"mov g[r80.x+25], r425 \n"
"mov g[r80.x+26], r421 \n"
"mov g[r80.x+27], r429 \n"
"mov g[r80.x+28], r419 \n"
"mov g[r80.x+29], r427 \n"
"mov g[r80.x+30], r423 \n"
"mov g[r80.x+31], r431 \n"
"ret \n"
"endfunc \n"
"func 0 \n"
"mul_ieee r100, r40, r41 \n"
"mul_ieee r101, r40, r41.yxwz \n"
"sub r40.x_z_, r100.xxzz, r100.yyww \n"
"add r40._y_w, r101.xxzz, r101.yyww \n"
"ret \n"
"endfunc \n"
";FFT2 \n"
"func 2 \n"
"mov r100, r50 \n"
"add r50, r100, r51 \n"
"sub r51, r100, r51 \n"
"ret \n"
"endfunc \n"
";FFT4 \n"
"func 3 \n"
"mov r50, r60 \n"
"mov r51, r62 \n"
"call 2 \n"
"mov r60, r50 \n"
"mov r62, r51 \n"
"mov r50, r61 \n"
"mov r51, r63 \n"
"call 2 \n"
"mov r61, r50 \n"
"mov r63, r51 \n"
"mov r40, r63 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r63, r40 \n"
"mov r50, r60 \n"
"mov r51, r61 \n"
"call 2 \n"
"mov r60, r50 \n"
"mov r61, r51 \n"
"mov r50, r62 \n"
"mov r51, r63 \n"
"call 2 \n"
"mov r62, r50 \n"
"mov r63, r51 \n"
"ret \n"
"endfunc \n"
";FFT8 \n"
"func 4 \n"
"mov r50, r70 \n"
"mov r51, r74 \n"
"call 2 \n"
"mov r70, r50 \n"
"mov r74, r51 \n"
"mov r50, r71 \n"
"mov r51, r75 \n"
"call 2 \n"
"mov r71, r50 \n"
"mov r75, r51 \n"
"mov r50, r72 \n"
"mov r51, r76 \n"
"call 2 \n"
"mov r72, r50 \n"
"mov r76, r51 \n"
"mov r50, r73 \n"
"mov r51, r77 \n"
"call 2 \n"
"mov r73, r50 \n"
"mov r77, r51 \n"
"mov r40, r75 \n"
"mov r41, l1.yzyz \n"
"call 0 \n"
"mov r75, r40 \n"
"mul_ieee r75, r75, l1.w \n"
"mov r40, r76 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r76, r40 \n"
"mov r40, r77 \n"
"mov r41, l1.z \n"
"call 0 \n"
"mov r77, r40 \n"
"mul_ieee r77, r77, l1.w \n"
"mov r60, r70 \n"
"mov r61, r71 \n"
"mov r62, r72 \n"
"mov r63, r73 \n"
"call 3 \n"
"mov r70, r60 \n"
"mov r71, r61 \n"
"mov r72, r62 \n"
"mov r73, r63 \n"
"mov r60, r74 \n"
"mov r61, r75 \n"
"mov r62, r76 \n"
"mov r63, r77 \n"
"call 3 \n"
"mov r74, r60 \n"
"mov r75, r61 \n"
"mov r76, r62 \n"
"mov r77, r63 \n"
"ret \n"
"endfunc \n"
";FFT16 \n"
"func 5 \n"
"mov r60, r700 \n"
"mov r61, r704 \n"
"mov r62, r708 \n"
"mov r63, r712 \n"
"call 3 \n"
"mov r700, r60 \n"
"mov r704, r61 \n"
"mov r708, r62 \n"
"mov r712, r63 \n"
"mov r60, r701 \n"
"mov r61, r705 \n"
"mov r62, r709 \n"
"mov r63, r713 \n"
"call 3 \n"
"mov r701, r60 \n"
"mov r705, r61 \n"
"mov r709, r62 \n"
"mov r713, r63 \n"
"mov r60, r702 \n"
"mov r61, r706 \n"
"mov r62, r710 \n"
"mov r63, r714 \n"
"call 3 \n"
"mov r702, r60 \n"
"mov r706, r61 \n"
"mov r710, r62 \n"
"mov r714, r63 \n"
"mov r60, r703 \n"
"mov r61, r707 \n"
"mov r62, r711 \n"
"mov r63, r715 \n"
"call 3 \n"
"mov r703, r60 \n"
"mov r707, r61 \n"
"mov r711, r62 \n"
"mov r715, r63 \n"
"mov r40, r705 \n"
"mov r41, l1.yzyz \n"
"call 0 \n"
"mov r705, r40 \n"
"mul_ieee r705, r705, l1.w \n"
"mov r40, r706 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r706, r40 \n"
"mov r40, r707 \n"
"mov r41, l1.z \n"
"call 0 \n"
"mov r707, r40 \n"
"mul_ieee r707, r707, l1.w \n"
"mov r40, r709 \n"
"mov r41, l2.yzyz \n"
"call 0 \n"
"mov r709, r40 \n"
"mov r40, r710 \n"
"mov r41, l1.yzyz \n"
"call 0 \n"
"mov r710, r40 \n"
"mul_ieee r710, r710, l1.w \n"
"mov r40, r711 \n"
"mov r41, l2.xwxw \n"
"call 0 \n"
"mov r711, r40 \n"
"mov r40, r713 \n"
"mov r41, l2.xwxw \n"
"call 0 \n"
"mov r713, r40 \n"
"mov r40, r714 \n"
"mov r41, l1.z \n"
"call 0 \n"
"mov r714, r40 \n"
"mul_ieee r714, r714, l1.w \n"
"mov r40, r715 \n"
"mov r41, l2.wxwx \n"
"call 0 \n"
"mov r715, r40 \n"
"mov r60, r700 \n"
"mov r61, r701 \n"
"mov r62, r702 \n"
"mov r63, r703 \n"
"call 3 \n"
"mov r700, r60 \n"
"mov r701, r61 \n"
"mov r702, r62 \n"
"mov r703, r63 \n"
"mov r60, r704 \n"
"mov r61, r705 \n"
"mov r62, r706 \n"
"mov r63, r707 \n"
"call 3 \n"
"mov r704, r60 \n"
"mov r705, r61 \n"
"mov r706, r62 \n"
"mov r707, r63 \n"
"mov r60, r708 \n"
"mov r61, r709 \n"
"mov r62, r710 \n"
"mov r63, r711 \n"
"call 3 \n"
"mov r708, r60 \n"
"mov r709, r61 \n"
"mov r710, r62 \n"
"mov r711, r63 \n"
"mov r60, r712 \n"
"mov r61, r713 \n"
"mov r62, r714 \n"
"mov r63, r715 \n"
"call 3 \n"
"mov r712, r60 \n"
"mov r713, r61 \n"
"mov r714, r62 \n"
"mov r715, r63 \n"
"ret \n"
"endfunc \n"
";FFT32 \n"
"func 6 \n"
"mov r60, r400 \n"
"mov r61, r408 \n"
"mov r62, r416 \n"
"mov r63, r424 \n"
"call 3 \n"
"mov r400, r60 \n"
"mov r408, r61 \n"
"mov r416, r62 \n"
"mov r424, r63 \n"
"mov r60, r401 \n"
"mov r61, r409 \n"
"mov r62, r417 \n"
"mov r63, r425 \n"
"call 3 \n"
"mov r401, r60 \n"
"mov r409, r61 \n"
"mov r417, r62 \n"
"mov r425, r63 \n"
"mov r60, r402 \n"
"mov r61, r410 \n"
"mov r62, r418 \n"
"mov r63, r426 \n"
"call 3 \n"
"mov r402, r60 \n"
"mov r410, r61 \n"
"mov r418, r62 \n"
"mov r426, r63 \n"
"mov r60, r403 \n"
"mov r61, r411 \n"
"mov r62, r419 \n"
"mov r63, r427 \n"
"call 3 \n"
"mov r403, r60 \n"
"mov r411, r61 \n"
"mov r419, r62 \n"
"mov r427, r63 \n"
"mov r60, r404 \n"
"mov r61, r412 \n"
"mov r62, r420 \n"
"mov r63, r428 \n"
"call 3 \n"
"mov r404, r60 \n"
"mov r412, r61 \n"
"mov r420, r62 \n"
"mov r428, r63 \n"
"mov r60, r405 \n"
"mov r61, r413 \n"
"mov r62, r421 \n"
"mov r63, r429 \n"
"call 3 \n"
"mov r405, r60 \n"
"mov r413, r61 \n"
"mov r421, r62 \n"
"mov r429, r63 \n"
"mov r60, r406 \n"
"mov r61, r414 \n"
"mov r62, r422 \n"
"mov r63, r430 \n"
"call 3 \n"
"mov r406, r60 \n"
"mov r414, r61 \n"
"mov r422, r62 \n"
"mov r430, r63 \n"
"mov r60, r407 \n"
"mov r61, r415 \n"
"mov r62, r423 \n"
"mov r63, r431 \n"
"call 3 \n"
"mov r407, r60 \n"
"mov r415, r61 \n"
"mov r423, r62 \n"
"mov r431, r63 \n"
"mov r40, r409 \n"
"mov r41, l10.xyxy \n"
"call 0 \n"
"mov r409, r40 \n"
"mov r40, r410 \n"
"mov r41, l10.zwzw \n"
"call 0 \n"
"mov r410, r40 \n"
"mov r40, r411 \n"
"mov r41, l11.xyxy \n"
"call 0 \n"
"mov r411, r40 \n"
"mov r40, r412 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r412, r40 \n"
"mov r40, r413 \n"
"mov r41, l11.zwzw \n"
"call 0 \n"
"mov r413, r40 \n"
"mov r40, r414 \n"
"mov r41, l12.xyxy \n"
"call 0 \n"
"mov r414, r40 \n"
"mov r40, r415 \n"
"mov r41, l12.zwzw \n"
"call 0 \n"
"mov r415, r40 \n"
"mov r40, r417 \n"
"mov r41, l13.xyxy \n"
"call 0 \n"
"mov r417, r40 \n"
"mov r40, r418 \n"
"mov r41, l13.zwzw \n"
"call 0 \n"
"mov r418, r40 \n"
"mov r40, r419 \n"
"mov r41, l14.xyxy \n"
"call 0 \n"
"mov r419, r40 \n"
"mov r40, r420 \n"
"mov r41, l14.zwzw \n"
"call 0 \n"
"mov r420, r40 \n"
"mov r40, r421 \n"
"mov r41, l15.xyxy \n"
"call 0 \n"
"mov r421, r40 \n"
"mov r40, r422 \n"
"mov r41, l15.zwzw \n"
"call 0 \n"
"mov r422, r40 \n"
"mov r40, r423 \n"
"mov r41, l16.xyxy \n"
"call 0 \n"
"mov r423, r40 \n"
"mov r40, r425 \n"
"mov r41, l16.zwzw \n"
"call 0 \n"
"mov r425, r40 \n"
"mov r40, r426 \n"
"mov r41, l17.xyxy \n"
"call 0 \n"
"mov r426, r40 \n"
"mov r40, r427 \n"
"mov r41, l17.zwzw \n"
"call 0 \n"
"mov r427, r40 \n"
"mov r40, r428 \n"
"mov r41, l18.xyxy \n"
"call 0 \n"
"mov r428, r40 \n"
"mov r40, r429 \n"
"mov r41, l18.zwzw \n"
"call 0 \n"
"mov r429, r40 \n"
"mov r40, r430 \n"
"mov r41, l19.xyxy \n"
"call 0 \n"
"mov r430, r40 \n"
"mov r40, r431 \n"
"mov r41, l19.zwzw \n"
"call 0 \n"
"mov r431, r40 \n"
"mov r70, r400 \n"
"mov r71, r401 \n"
"mov r72, r402 \n"
"mov r73, r403 \n"
"mov r74, r404 \n"
"mov r75, r405 \n"
"mov r76, r406 \n"
"mov r77, r407 \n"
"call 4 \n"
"mov r400, r70 \n"
"mov r401, r71 \n"
"mov r402, r72 \n"
"mov r403, r73 \n"
"mov r404, r74 \n"
"mov r405, r75 \n"
"mov r406, r76 \n"
"mov r407, r77 \n"
"mov r70, r408 \n"
"mov r71, r409 \n"
"mov r72, r410 \n"
"mov r73, r411 \n"
"mov r74, r412 \n"
"mov r75, r413 \n"
"mov r76, r414 \n"
"mov r77, r415 \n"
"call 4 \n"
"mov r408, r70 \n"
"mov r409, r71 \n"
"mov r410, r72 \n"
"mov r411, r73 \n"
"mov r412, r74 \n"
"mov r413, r75 \n"
"mov r414, r76 \n"
"mov r415, r77 \n"
"mov r70, r416 \n"
"mov r71, r417 \n"
"mov r72, r418 \n"
"mov r73, r419 \n"
"mov r74, r420 \n"
"mov r75, r421 \n"
"mov r76, r422 \n"
"mov r77, r423 \n"
"call 4 \n"
"mov r416, r70 \n"
"mov r417, r71 \n"
"mov r418, r72 \n"
"mov r419, r73 \n"
"mov r420, r74 \n"
"mov r421, r75 \n"
"mov r422, r76 \n"
"mov r423, r77 \n"
"mov r70, r424 \n"
"mov r71, r425 \n"
"mov r72, r426 \n"
"mov r73, r427 \n"
"mov r74, r428 \n"
"mov r75, r429 \n"
"mov r76, r430 \n"
"mov r77, r431 \n"
"call 4 \n"
"mov r424, r70 \n"
"mov r425, r71 \n"
"mov r426, r72 \n"
"mov r427, r73 \n"
"mov r428, r74 \n"
"mov r429, r75 \n"
"mov r430, r76 \n"
"mov r431, r77 \n"
"ret \n"
"endfunc \n"
"func 7 \n"
"mov r700, r400 \n"
"mov r701, r401 \n"
"mov r702, r402 \n"
"mov r703, r403 \n"
"mov r704, r404 \n"
"mov r705, r405 \n"
"mov r706, r406 \n"
"mov r707, r407 \n"
"mov r708, r408 \n"
"mov r709, r409 \n"
"mov r710, r410 \n"
"mov r711, r411 \n"
"mov r712, r412 \n"
"mov r713, r413 \n"
"mov r714, r414 \n"
"mov r715, r415 \n"
"call 5 \n"
"mov r400, r700 \n"
"mov r401, r701 \n"
"mov r402, r702 \n"
"mov r403, r703 \n"
"mov r404, r704 \n"
"mov r405, r705 \n"
"mov r406, r706 \n"
"mov r407, r707 \n"
"mov r408, r708 \n"
"mov r409, r709 \n"
"mov r410, r710 \n"
"mov r411, r711 \n"
"mov r412, r712 \n"
"mov r413, r713 \n"
"mov r414, r714 \n"
"mov r415, r715 \n"
"mov r700, r416 \n"
"mov r701, r417 \n"
"mov r702, r418 \n"
"mov r703, r419 \n"
"mov r704, r420 \n"
"mov r705, r421 \n"
"mov r706, r422 \n"
"mov r707, r423 \n"
"mov r708, r424 \n"
"mov r709, r425 \n"
"mov r710, r426 \n"
"mov r711, r427 \n"
"mov r712, r428 \n"
"mov r713, r429 \n"
"mov r714, r430 \n"
"mov r715, r431 \n"
"call 5 \n"
"mov r416, r700 \n"
"mov r417, r701 \n"
"mov r418, r702 \n"
"mov r419, r703 \n"
"mov r420, r704 \n"
"mov r421, r705 \n"
"mov r422, r706 \n"
"mov r423, r707 \n"
"mov r424, r708 \n"
"mov r425, r709 \n"
"mov r426, r710 \n"
"mov r427, r711 \n"
"mov r428, r712 \n"
"mov r429, r713 \n"
"mov r430, r714 \n"
"mov r431, r715 \n"
"ret \n"
"endfunc \n"
"func 81 \n"
"mov r500.x___, r400.x \n"
"mov r500._y__, r408.x \n"
"mov r500.__z_, r404.x \n"
"mov r500.___w, r412.x \n"
"mov r501.x___, r416.x \n"
"mov r501._y__, r424.x \n"
"mov r501.__z_, r420.x \n"
"mov r501.___w, r428.x \n"
"mov r502.x___, r402.x \n"
"mov r502._y__, r410.x \n"
"mov r502.__z_, r406.x \n"
"mov r502.___w, r414.x \n"
"mov r503.x___, r418.x \n"
"mov r503._y__, r426.x \n"
"mov r503.__z_, r422.x \n"
"mov r503.___w, r430.x \n"
"mov r504.x___, r401.x \n"
"mov r504._y__, r409.x \n"
"mov r504.__z_, r405.x \n"
"mov r504.___w, r413.x \n"
"mov r505.x___, r417.x \n"
"mov r505._y__, r425.x \n"
"mov r505.__z_, r421.x \n"
"mov r505.___w, r429.x \n"
"mov r506.x___, r403.x \n"
"mov r506._y__, r411.x \n"
"mov r506.__z_, r407.x \n"
"mov r506.___w, r415.x \n"
"mov r507.x___, r419.x \n"
"mov r507._y__, r427.x \n"
"mov r507.__z_, r423.x \n"
"mov r507.___w, r431.x \n"
"lds_write_vec mem0, r500 \n"
"lds_write_vec_lOffset(4) mem0, r501 \n"
"lds_write_vec_lOffset(8) mem0, r502 \n"
"lds_write_vec_lOffset(12) mem0, r503 \n"
"lds_write_vec_lOffset(16) mem0, r504 \n"
"lds_write_vec_lOffset(20) mem0, r505 \n"
"lds_write_vec_lOffset(24) mem0, r506 \n"
"lds_write_vec_lOffset(28) mem0, r507 \n"
"fence_lds \n"
"ret \n"
"endfunc \n"
"func 91 \n"
"mov r95, r85.xyxy \n"
"lds_read_vec_neighborExch r500, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r501, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r502, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r503, r95.xyyy \n"
"mov r95, r85.xyxy \n"
"iadd r95._y__, r95.y, l24.x \n"
"lds_read_vec_neighborExch r504, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r505, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r506, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r507, r95.xyyy \n"
"mov r400.x___, r500.x \n"
"mov r401.x___, r500.y \n"
"mov r402.x___, r500.z \n"
"mov r403.x___, r500.w \n"
"mov r404.x___, r501.x \n"
"mov r405.x___, r501.y \n"
"mov r406.x___, r501.z \n"
"mov r407.x___, r501.w \n"
"mov r408.x___, r502.x \n"
"mov r409.x___, r502.y \n"
"mov r410.x___, r502.z \n"
"mov r411.x___, r502.w \n"
"mov r412.x___, r503.x \n"
"mov r413.x___, r503.y \n"
"mov r414.x___, r503.z \n"
"mov r415.x___, r503.w \n"
"mov r416.x___, r504.x \n"
"mov r417.x___, r504.y \n"
"mov r418.x___, r504.z \n"
"mov r419.x___, r504.w \n"
"mov r420.x___, r505.x \n"
"mov r421.x___, r505.y \n"
"mov r422.x___, r505.z \n"
"mov r423.x___, r505.w \n"
"mov r424.x___, r506.x \n"
"mov r425.x___, r506.y \n"
"mov r426.x___, r506.z \n"
"mov r427.x___, r506.w \n"
"mov r428.x___, r507.x \n"
"mov r429.x___, r507.y \n"
"mov r430.x___, r507.z \n"
"mov r431.x___, r507.w \n"
"ret \n"
"endfunc \n"
"func 82 \n"
"mov r500.x___, r400.y \n"
"mov r500._y__, r408.y \n"
"mov r500.__z_, r404.y \n"
"mov r500.___w, r412.y \n"
"mov r501.x___, r416.y \n"
"mov r501._y__, r424.y \n"
"mov r501.__z_, r420.y \n"
"mov r501.___w, r428.y \n"
"mov r502.x___, r402.y \n"
"mov r502._y__, r410.y \n"
"mov r502.__z_, r406.y \n"
"mov r502.___w, r414.y \n"
"mov r503.x___, r418.y \n"
"mov r503._y__, r426.y \n"
"mov r503.__z_, r422.y \n"
"mov r503.___w, r430.y \n"
"mov r504.x___, r401.y \n"
"mov r504._y__, r409.y \n"
"mov r504.__z_, r405.y \n"
"mov r504.___w, r413.y \n"
"mov r505.x___, r417.y \n"
"mov r505._y__, r425.y \n"
"mov r505.__z_, r421.y \n"
"mov r505.___w, r429.y \n"
"mov r506.x___, r403.y \n"
"mov r506._y__, r411.y \n"
"mov r506.__z_, r407.y \n"
"mov r506.___w, r415.y \n"
"mov r507.x___, r419.y \n"
"mov r507._y__, r427.y \n"
"mov r507.__z_, r423.y \n"
"mov r507.___w, r431.y \n"
"lds_write_vec mem0, r500 \n"
"lds_write_vec_lOffset(4) mem0, r501 \n"
"lds_write_vec_lOffset(8) mem0, r502 \n"
"lds_write_vec_lOffset(12) mem0, r503 \n"
"lds_write_vec_lOffset(16) mem0, r504 \n"
"lds_write_vec_lOffset(20) mem0, r505 \n"
"lds_write_vec_lOffset(24) mem0, r506 \n"
"lds_write_vec_lOffset(28) mem0, r507 \n"
"fence_lds \n"
"ret \n"
"endfunc \n"
"func 92 \n"
"mov r95, r85.xyxy \n"
"lds_read_vec_neighborExch r500, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r501, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r502, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r503, r95.xyyy \n"
"mov r95, r85.xyxy \n"
"iadd r95._y__, r95.y, l24.x \n"
"lds_read_vec_neighborExch r504, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r505, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r506, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r507, r95.xyyy \n"
"mov r400._y__, r500.x \n"
"mov r401._y__, r500.y \n"
"mov r402._y__, r500.z \n"
"mov r403._y__, r500.w \n"
"mov r404._y__, r501.x \n"
"mov r405._y__, r501.y \n"
"mov r406._y__, r501.z \n"
"mov r407._y__, r501.w \n"
"mov r408._y__, r502.x \n"
"mov r409._y__, r502.y \n"
"mov r410._y__, r502.z \n"
"mov r411._y__, r502.w \n"
"mov r412._y__, r503.x \n"
"mov r413._y__, r503.y \n"
"mov r414._y__, r503.z \n"
"mov r415._y__, r503.w \n"
"mov r416._y__, r504.x \n"
"mov r417._y__, r504.y \n"
"mov r418._y__, r504.z \n"
"mov r419._y__, r504.w \n"
"mov r420._y__, r505.x \n"
"mov r421._y__, r505.y \n"
"mov r422._y__, r505.z \n"
"mov r423._y__, r505.w \n"
"mov r424._y__, r506.x \n"
"mov r425._y__, r506.y \n"
"mov r426._y__, r506.z \n"
"mov r427._y__, r506.w \n"
"mov r428._y__, r507.x \n"
"mov r429._y__, r507.y \n"
"mov r430._y__, r507.z \n"
"mov r431._y__, r507.w \n"
"ret \n"
"endfunc \n"
"func 83 \n"
"mov r500.x___, r400.z \n"
"mov r500._y__, r408.z \n"
"mov r500.__z_, r404.z \n"
"mov r500.___w, r412.z \n"
"mov r501.x___, r416.z \n"
"mov r501._y__, r424.z \n"
"mov r501.__z_, r420.z \n"
"mov r501.___w, r428.z \n"
"mov r502.x___, r402.z \n"
"mov r502._y__, r410.z \n"
"mov r502.__z_, r406.z \n"
"mov r502.___w, r414.z \n"
"mov r503.x___, r418.z \n"
"mov r503._y__, r426.z \n"
"mov r503.__z_, r422.z \n"
"mov r503.___w, r430.z \n"
"mov r504.x___, r401.z \n"
"mov r504._y__, r409.z \n"
"mov r504.__z_, r405.z \n"
"mov r504.___w, r413.z \n"
"mov r505.x___, r417.z \n"
"mov r505._y__, r425.z \n"
"mov r505.__z_, r421.z \n"
"mov r505.___w, r429.z \n"
"mov r506.x___, r403.z \n"
"mov r506._y__, r411.z \n"
"mov r506.__z_, r407.z \n"
"mov r506.___w, r415.z \n"
"mov r507.x___, r419.z \n"
"mov r507._y__, r427.z \n"
"mov r507.__z_, r423.z \n"
"mov r507.___w, r431.z \n"
"lds_write_vec mem0, r500 \n"
"lds_write_vec_lOffset(4) mem0, r501 \n"
"lds_write_vec_lOffset(8) mem0, r502 \n"
"lds_write_vec_lOffset(12) mem0, r503 \n"
"lds_write_vec_lOffset(16) mem0, r504 \n"
"lds_write_vec_lOffset(20) mem0, r505 \n"
"lds_write_vec_lOffset(24) mem0, r506 \n"
"lds_write_vec_lOffset(28) mem0, r507 \n"
"fence_lds \n"
"ret \n"
"endfunc \n"
"func 93 \n"
"mov r95, r85.xyxy \n"
"lds_read_vec_neighborExch r500, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r501, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r502, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r503, r95.xyyy \n"
"mov r95, r85.xyxy \n"
"iadd r95._y__, r95.y, l24.x \n"
"lds_read_vec_neighborExch r504, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r505, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r506, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r507, r95.xyyy \n"
"mov r400.__z_, r500.x \n"
"mov r401.__z_, r500.y \n"
"mov r402.__z_, r500.z \n"
"mov r403.__z_, r500.w \n"
"mov r404.__z_, r501.x \n"
"mov r405.__z_, r501.y \n"
"mov r406.__z_, r501.z \n"
"mov r407.__z_, r501.w \n"
"mov r408.__z_, r502.x \n"
"mov r409.__z_, r502.y \n"
"mov r410.__z_, r502.z \n"
"mov r411.__z_, r502.w \n"
"mov r412.__z_, r503.x \n"
"mov r413.__z_, r503.y \n"
"mov r414.__z_, r503.z \n"
"mov r415.__z_, r503.w \n"
"mov r416.__z_, r504.x \n"
"mov r417.__z_, r504.y \n"
"mov r418.__z_, r504.z \n"
"mov r419.__z_, r504.w \n"
"mov r420.__z_, r505.x \n"
"mov r421.__z_, r505.y \n"
"mov r422.__z_, r505.z \n"
"mov r423.__z_, r505.w \n"
"mov r424.__z_, r506.x \n"
"mov r425.__z_, r506.y \n"
"mov r426.__z_, r506.z \n"
"mov r427.__z_, r506.w \n"
"mov r428.__z_, r507.x \n"
"mov r429.__z_, r507.y \n"
"mov r430.__z_, r507.z \n"
"mov r431.__z_, r507.w \n"
"ret \n"
"endfunc \n"
"func 84 \n"
"mov r500.x___, r400.w \n"
"mov r500._y__, r408.w \n"
"mov r500.__z_, r404.w \n"
"mov r500.___w, r412.w \n"
"mov r501.x___, r416.w \n"
"mov r501._y__, r424.w \n"
"mov r501.__z_, r420.w \n"
"mov r501.___w, r428.w \n"
"mov r502.x___, r402.w \n"
"mov r502._y__, r410.w \n"
"mov r502.__z_, r406.w \n"
"mov r502.___w, r414.w \n"
"mov r503.x___, r418.w \n"
"mov r503._y__, r426.w \n"
"mov r503.__z_, r422.w \n"
"mov r503.___w, r430.w \n"
"mov r504.x___, r401.w \n"
"mov r504._y__, r409.w \n"
"mov r504.__z_, r405.w \n"
"mov r504.___w, r413.w \n"
"mov r505.x___, r417.w \n"
"mov r505._y__, r425.w \n"
"mov r505.__z_, r421.w \n"
"mov r505.___w, r429.w \n"
"mov r506.x___, r403.w \n"
"mov r506._y__, r411.w \n"
"mov r506.__z_, r407.w \n"
"mov r506.___w, r415.w \n"
"mov r507.x___, r419.w \n"
"mov r507._y__, r427.w \n"
"mov r507.__z_, r423.w \n"
"mov r507.___w, r431.w \n"
"lds_write_vec mem0, r500 \n"
"lds_write_vec_lOffset(4) mem0, r501 \n"
"lds_write_vec_lOffset(8) mem0, r502 \n"
"lds_write_vec_lOffset(12) mem0, r503 \n"
"lds_write_vec_lOffset(16) mem0, r504 \n"
"lds_write_vec_lOffset(20) mem0, r505 \n"
"lds_write_vec_lOffset(24) mem0, r506 \n"
"lds_write_vec_lOffset(28) mem0, r507 \n"
"fence_lds \n"
"ret \n"
"endfunc \n"
"func 94 \n"
"mov r95, r85.xyxy \n"
"lds_read_vec_neighborExch r500, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r501, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r502, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r503, r95.xyyy \n"
"mov r95, r85.xyxy \n"
"iadd r95._y__, r95.y, l24.x \n"
"lds_read_vec_neighborExch r504, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r505, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r506, r95.xyyy \n"
"iadd r95.x___, r95.x, l24.x \n"
"lds_read_vec_neighborExch r507, r95.xyyy \n"
"mov r400.___w, r500.x \n"
"mov r401.___w, r500.y \n"
"mov r402.___w, r500.z \n"
"mov r403.___w, r500.w \n"
"mov r404.___w, r501.x \n"
"mov r405.___w, r501.y \n"
"mov r406.___w, r501.z \n"
"mov r407.___w, r501.w \n"
"mov r408.___w, r502.x \n"
"mov r409.___w, r502.y \n"
"mov r410.___w, r502.z \n"
"mov r411.___w, r502.w \n"
"mov r412.___w, r503.x \n"
"mov r413.___w, r503.y \n"
"mov r414.___w, r503.z \n"
"mov r415.___w, r503.w \n"
"mov r416.___w, r504.x \n"
"mov r417.___w, r504.y \n"
"mov r418.___w, r504.z \n"
"mov r419.___w, r504.w \n"
"mov r420.___w, r505.x \n"
"mov r421.___w, r505.y \n"
"mov r422.___w, r505.z \n"
"mov r423.___w, r505.w \n"
"mov r424.___w, r506.x \n"
"mov r425.___w, r506.y \n"
"mov r426.___w, r506.z \n"
"mov r427.___w, r506.w \n"
"mov r428.___w, r507.x \n"
"mov r429.___w, r507.y \n"
"mov r430.___w, r507.z \n"
"mov r431.___w, r507.w \n"
"ret \n"
"endfunc \n"
"func 10 \n"
"mul_ieee r100, r200.x, l40 \n"
"mul_ieee r101, r200.x, l41 \n"
"mul_ieee r102, r200.x, l42 \n"
"mul_ieee r103, r200.x, l43 \n"
"mul_ieee r104, r200.x, l44 \n"
"mul_ieee r105, r200.x, l45 \n"
"mul_ieee r106, r200.x, l46 \n"
"mul_ieee r107, r200.x, l47 \n"
"cos_vec r110._yzw, r100 \n"
"cos_vec r111, r101 \n"
"cos_vec r112, r102 \n"
"cos_vec r113, r103 \n"
"cos_vec r114, r104 \n"
"cos_vec r115, r105 \n"
"cos_vec r116, r106 \n"
"cos_vec r117, r107 \n"
"sin_vec r120._yzw, r100 \n"
"sin_vec r121, r101 \n"
"sin_vec r122, r102 \n"
"sin_vec r123, r103 \n"
"sin_vec r124, r104 \n"
"sin_vec r125, r105 \n"
"sin_vec r126, r106 \n"
"sin_vec r127, r107 \n"
"mov r40, r401 \n"
"mov r41.x_z_, r110.y \n"
"mov r41._y_w, r120.y \n"
"call 0 \n"
"mov r401, r40 \n"
"mov r40, r402 \n"
"mov r41.x_z_, r110.z \n"
"mov r41._y_w, r120.z \n"
"call 0 \n"
"mov r402, r40 \n"
"mov r40, r403 \n"
"mov r41.x_z_, r110.w \n"
"mov r41._y_w, r120.w \n"
"call 0 \n"
"mov r403, r40 \n"
"mov r40, r404 \n"
"mov r41.x_z_, r111.x \n"
"mov r41._y_w, r121.x \n"
"call 0 \n"
"mov r404, r40 \n"
"mov r40, r405 \n"
"mov r41.x_z_, r111.y \n"
"mov r41._y_w, r121.y \n"
"call 0 \n"
"mov r405, r40 \n"
"mov r40, r406 \n"
"mov r41.x_z_, r111.z \n"
"mov r41._y_w, r121.z \n"
"call 0 \n"
"mov r406, r40 \n"
"mov r40, r407 \n"
"mov r41.x_z_, r111.w \n"
"mov r41._y_w, r121.w \n"
"call 0 \n"
"mov r407, r40 \n"
"mov r40, r408 \n"
"mov r41.x_z_, r112.x \n"
"mov r41._y_w, r122.x \n"
"call 0 \n"
"mov r408, r40 \n"
"mov r40, r409 \n"
"mov r41.x_z_, r112.y \n"
"mov r41._y_w, r122.y \n"
"call 0 \n"
"mov r409, r40 \n"
"mov r40, r410 \n"
"mov r41.x_z_, r112.z \n"
"mov r41._y_w, r122.z \n"
"call 0 \n"
"mov r410, r40 \n"
"mov r40, r411 \n"
"mov r41.x_z_, r112.w \n"
"mov r41._y_w, r122.w \n"
"call 0 \n"
"mov r411, r40 \n"
"mov r40, r412 \n"
"mov r41.x_z_, r113.x \n"
"mov r41._y_w, r123.x \n"
"call 0 \n"
"mov r412, r40 \n"
"mov r40, r413 \n"
"mov r41.x_z_, r113.y \n"
"mov r41._y_w, r123.y \n"
"call 0 \n"
"mov r413, r40 \n"
"mov r40, r414 \n"
"mov r41.x_z_, r113.z \n"
"mov r41._y_w, r123.z \n"
"call 0 \n"
"mov r414, r40 \n"
"mov r40, r415 \n"
"mov r41.x_z_, r113.w \n"
"mov r41._y_w, r123.w \n"
"call 0 \n"
"mov r415, r40 \n"
"mov r40, r416 \n"
"mov r41.x_z_, r114.x \n"
"mov r41._y_w, r124.x \n"
"call 0 \n"
"mov r416, r40 \n"
"mov r40, r417 \n"
"mov r41.x_z_, r114.y \n"
"mov r41._y_w, r124.y \n"
"call 0 \n"
"mov r417, r40 \n"
"mov r40, r418 \n"
"mov r41.x_z_, r114.z \n"
"mov r41._y_w, r124.z \n"
"call 0 \n"
"mov r418, r40 \n"
"mov r40, r419 \n"
"mov r41.x_z_, r114.w \n"
"mov r41._y_w, r124.w \n"
"call 0 \n"
"mov r419, r40 \n"
"mov r40, r420 \n"
"mov r41.x_z_, r115.x \n"
"mov r41._y_w, r125.x \n"
"call 0 \n"
"mov r420, r40 \n"
"mov r40, r421 \n"
"mov r41.x_z_, r115.y \n"
"mov r41._y_w, r125.y \n"
"call 0 \n"
"mov r421, r40 \n"
"mov r40, r422 \n"
"mov r41.x_z_, r115.z \n"
"mov r41._y_w, r125.z \n"
"call 0 \n"
"mov r422, r40 \n"
"mov r40, r423 \n"
"mov r41.x_z_, r115.w \n"
"mov r41._y_w, r125.w \n"
"call 0 \n"
"mov r423, r40 \n"
"mov r40, r424 \n"
"mov r41.x_z_, r116.x \n"
"mov r41._y_w, r126.x \n"
"call 0 \n"
"mov r424, r40 \n"
"mov r40, r425 \n"
"mov r41.x_z_, r116.y \n"
"mov r41._y_w, r126.y \n"
"call 0 \n"
"mov r425, r40 \n"
"mov r40, r426 \n"
"mov r41.x_z_, r116.z \n"
"mov r41._y_w, r126.z \n"
"call 0 \n"
"mov r426, r40 \n"
"mov r40, r427 \n"
"mov r41.x_z_, r116.w \n"
"mov r41._y_w, r126.w \n"
"call 0 \n"
"mov r427, r40 \n"
"mov r40, r428 \n"
"mov r41.x_z_, r117.x \n"
"mov r41._y_w, r127.x \n"
"call 0 \n"
"mov r428, r40 \n"
"mov r40, r429 \n"
"mov r41.x_z_, r117.y \n"
"mov r41._y_w, r127.y \n"
"call 0 \n"
"mov r429, r40 \n"
"mov r40, r430 \n"
"mov r41.x_z_, r117.z \n"
"mov r41._y_w, r127.z \n"
"call 0 \n"
"mov r430, r40 \n"
"mov r40, r431 \n"
"mov r41.x_z_, r117.w \n"
"mov r41._y_w, r127.w \n"
"call 0 \n"
"mov r431, r40 \n"
"ret \n"
"endfunc \n"
"end \n";
const char _fft1024_tomo_fft_source_[] =
"il_cs_2_0 \n"
"dcl_num_thread_per_group 64 \n"
"dcl_lds_size_per_thread 32 \n"
"dcl_lds_sharing_mode _wavefrontRel \n"
"; l0 = (0.0f, 1.401298464e-45f, -1.#QNANf, 2.242077543e-44f, ) \n"
"dcl_literal l0, 0x00000000, 0x00000001, 0xFFFFFFFF, 0x00000010 \n"
"; l1 = (0.0f, 1.0f, -1.0f, 0.7071067691f, ) \n"
"dcl_literal l1, 0x00000000, 0x3F800000, 0xBF800000, 0x3F3504F3 \n"
"; l3 = (-1.#QNANf, 3.923635700e-44f, 5.605193857e-45f, 1.121038771e-44f, ) \n"
"dcl_literal l3, 0xFFFFFFE3, 0x0000001C, 0x00000004, 0x00000008 \n"
"; l5 = (1024.0f, 0.0f, 0.0f, 0.0f, ) \n"
"dcl_literal l5, 0x44800000, 0x00000000, 0x00000000, 0x00000000 \n"
"; l10 = (0.9238795042f, -0.3826834261f, 0.7071067691f, -0.7071067691f, ) \n"
"dcl_literal l10, 0x3F6C835E, 0xBEC3EF15, 0x3F3504F3, 0xBF3504F3 \n"
"; l11 = (0.3826834261f, -0.9238795042f, -0.3826834261f, -0.9238795042f, ) \n"
"dcl_literal l11, 0x3EC3EF15, 0xBF6C835E, 0xBEC3EF15, 0xBF6C835E \n"
"; l12 = (-0.7071067691f, -0.7071067691f, -0.9238795042f, -0.3826834261f, ) \n"
"dcl_literal l12, 0xBF3504F3, 0xBF3504F3, 0xBF6C835E, 0xBEC3EF15 \n"
"; l13 = (0.9807852507f, -0.1950903237f, 0.9238795042f, -0.3826834261f, ) \n"
"dcl_literal l13, 0x3F7B14BE, 0xBE47C5C2, 0x3F6C835E, 0xBEC3EF15 \n"
"; l14 = (0.8314695954f, -0.5555702448f, 0.7071067691f, -0.7071067691f, ) \n"
"dcl_literal l14, 0x3F54DB31, 0xBF0E39DA, 0x3F3504F3, 0xBF3504F3 \n"
"; l15 = (0.5555702448f, -0.8314695954f, 0.3826834261f, -0.9238795042f, ) \n"
"dcl_literal l15, 0x3F0E39DA, 0xBF54DB31, 0x3EC3EF15, 0xBF6C835E \n"
"; l16 = (0.1950903237f, -0.9807852507f, 0.8314695954f, -0.5555702448f, ) \n"
"dcl_literal l16, 0x3E47C5C2, 0xBF7B14BE, 0x3F54DB31, 0xBF0E39DA \n"
"; l17 = (0.3826834261f, -0.9238795042f, -0.1950903237f, -0.9807852507f, ) \n"
"dcl_literal l17, 0x3EC3EF15, 0xBF6C835E, 0xBE47C5C2, 0xBF7B14BE \n"
"; l18 = (-0.7071067691f, -0.7071067691f, -0.9807852507f, -0.1950903237f, ) \n"
"dcl_literal l18, 0xBF3504F3, 0xBF3504F3, 0xBF7B14BE, 0xBE47C5C2 \n"
"; l19 = (-0.9238795042f, 0.3826834261f, -0.5555702448f, 0.8314695954f, ) \n"
"dcl_literal l19, 0xBF6C835E, 0x3EC3EF15, 0xBF0E39DA, 0x3F54DB31 \n"
"; l20 = (0.0f, 1.401298464e-45f, -1.#QNANf, 0.0f, ) \n"
"dcl_literal l20, 0x00000000, 0x00000001, 0xFFFFFFFF, 0x00000000 \n"
"; l21 = (1.401298464e-45f, 2.802596929e-45f, -1.#QNANf, 1.401298464e-45f, ) \n"
"dcl_literal l21, 0x00000001, 0x00000002, 0xFFFFFFFE, 0x00000001 \n"
"; l22 = (2.802596929e-45f, 5.605193857e-45f, -1.#QNANf, 4.203895393e-45f, ) \n"
"dcl_literal l22, 0x00000002, 0x00000004, 0xFFFFFFFC, 0x00000003 \n"
"; l23 = (4.203895393e-45f, 1.121038771e-44f, -1.#QNANf, 9.809089250e-45f, ) \n"
"dcl_literal l23, 0x00000003, 0x00000008, 0xFFFFFFF8, 0x00000007 \n"
"; l24 = (5.605193857e-45f, 2.242077543e-44f, -1.#QNANf, 2.101947696e-44f, ) \n"
"dcl_literal l24, 0x00000004, 0x00000010, 0xFFFFFFF0, 0x0000000F \n"
"; l25 = (7.006492322e-45f, 4.484155086e-44f, -1.#QNANf, 4.344025239e-44f, ) \n"
"dcl_literal l25, 0x00000005, 0x00000020, 0xFFFFFFE0, 0x0000001F \n"
"; l29 = (1.261168618e-44f, 7.174648137e-43f, 0.0f, 0.0f, ) \n"
"dcl_literal l29, 0x00000009, 0x00000200, 0x00000000, 0x00000000 \n"
"; l30 = (1.541428311e-44f, 7.006492322e-45f, 7.174648137e-43f, 1.121038771e-44f, ) \n"
"dcl_literal l30, 0x0000000B, 0x00000005, 0x00000200, 0x00000008 \n"
"; l40 = (0.0f, -100.5309677f, -50.26548386f, -150.7964478f, ) \n"
"dcl_literal l40, 0x80000000, 0xC2C90FDB, 0xC2490FDB, 0xC316CBE4 \n"
"; l41 = (-25.13274193f, -125.6637039f, -75.39822388f, -175.929184f, ) \n"
"dcl_literal l41, 0xC1C90FDB, 0xC2FB53D1, 0xC296CBE4, 0xC32FEDDF \n"
"; l42 = (-12.56637096f, -113.0973358f, -62.83185196f, -163.3628235f, ) \n"
"dcl_literal l42, 0xC1490FDB, 0xC2E231D6, 0xC27B53D1, 0xC3235CE2 \n"
"; l43 = (-37.69911194f, -138.230072f, -87.96459198f, -188.4955597f, ) \n"
"dcl_literal l43, 0xC216CBE4, 0xC30A3AE6, 0xC2AFEDDF, 0xC33C7EDD \n"
"; l44 = (-6.283185482f, -106.8141479f, -56.54866791f, -157.0796356f, ) \n"
"dcl_literal l44, 0xC0C90FDB, 0xC2D5A0D8, 0xC26231D6, 0xC31D1463 \n"
"; l45 = (-31.41592598f, -131.9468842f, -81.68141174f, -182.2123718f, ) \n"
"dcl_literal l45, 0xC1FB53D1, 0xC303F267, 0xC2A35CE2, 0xC336365E \n"
"; l46 = (-18.84955597f, -119.3805237f, -69.11503601f, -169.6459961f, ) \n"
"dcl_literal l46, 0xC196CBE4, 0xC2EEC2D4, 0xC28A3AE6, 0xC329A560 \n"
"; l47 = (-43.98229599f, -144.5132599f, -94.24777985f, -194.7787476f, ) \n"
"dcl_literal l47, 0xC22FEDDF, 0xC3108365, 0xC2BC7EDD, 0xC342C75C \n"
"ishl r90.x___, vThreadGrpIdFlat0.x, l30.x \n"
"iadd r80.x___, vTidInGrpFlat0.x, r90.x \n"
"call 6 \n"
"call 5 \n"
"and r0.x___, vTidInGrpFlat0.x, l25.w \n"
"itof r80.x___, r0.x \n"
"div_zeroop(fltmax) r80, r80.x, l5.x \n"
"call 10 \n"
"call 81 \n"
"and r75.x___, vTidInGrpFlat0.x, l3.x \n"
"and r75._y__, vTidInGrpFlat0.x, l3.y \n"
"call 91 \n"
"call 82 \n"
"and r75.x___, vTidInGrpFlat0.x, l3.x \n"
"and r75._y__, vTidInGrpFlat0.x, l3.y \n"
"call 92 \n"
"call 83 \n"
"and r75.x___, vTidInGrpFlat0.x, l3.x \n"
"and r75._y__, vTidInGrpFlat0.x, l3.y \n"
"call 93 \n"
"call 84 \n"
"and r75.x___, vTidInGrpFlat0.x, l3.x \n"
"and r75._y__, vTidInGrpFlat0.x, l3.y \n"
"call 94 \n"
"call 5 \n"
"ishl r90._y__, vTidInGrpFlat0.x, l30.y \n"
"iadd r80.x___, r90.x, r90.y \n"
"call 7 \n"
"endmain \n"
"func 0 \n"
"mul_ieee r100, r40, r41 \n"
"mul_ieee r101, r40, r41.yxwz \n"
"sub r40.x_z_, r100.xxzz, r100.yyww \n"
"add r40._y_w, r101.xxzz, r101.yyww \n"
"ret \n"
"endfunc \n"
";FFT2 \n"
"func 2 \n"
"mov r100, r50 \n"
"add r50, r100, r51 \n"
"sub r51, r100, r51 \n"
"ret \n"
"endfunc \n"
";FFT4 \n"
"func 3 \n"
"mov r50, r60 \n"
"mov r51, r62 \n"
"call 2 \n"
"mov r60, r50 \n"
"mov r62, r51 \n"
"mov r50, r61 \n"
"mov r51, r63 \n"
"call 2 \n"
"mov r61, r50 \n"
"mov r63, r51 \n"
"mov r40, r63 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r63, r40 \n"
"mov r50, r60 \n"
"mov r51, r61 \n"
"call 2 \n"
"mov r60, r50 \n"
"mov r61, r51 \n"
"mov r50, r62 \n"
"mov r51, r63 \n"
"call 2 \n"
"mov r62, r50 \n"
"mov r63, r51 \n"
"ret \n"
"endfunc \n"
";FFT8 \n"
"func 4 \n"
"mov r50, r70 \n"
"mov r51, r74 \n"
"call 2 \n"
"mov r70, r50 \n"
"mov r74, r51 \n"
"mov r50, r71 \n"
"mov r51, r75 \n"
"call 2 \n"
"mov r71, r50 \n"
"mov r75, r51 \n"
"mov r50, r72 \n"
"mov r51, r76 \n"
"call 2 \n"
"mov r72, r50 \n"
"mov r76, r51 \n"
"mov r50, r73 \n"
"mov r51, r77 \n"
"call 2 \n"
"mov r73, r50 \n"
"mov r77, r51 \n"
"mov r40, r75 \n"
"mov r41, l1.yzyz \n"
"call 0 \n"
"mov r75, r40 \n"
"mul_ieee r75, r75, l1.w \n"
"mov r40, r76 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r76, r40 \n"
"mov r40, r77 \n"
"mov r41, l1.z \n"
"call 0 \n"
"mov r77, r40 \n"
"mul_ieee r77, r77, l1.w \n"
"mov r60, r70 \n"
"mov r61, r71 \n"
"mov r62, r72 \n"
"mov r63, r73 \n"
"call 3 \n"
"mov r70, r60 \n"
"mov r71, r61 \n"
"mov r72, r62 \n"
"mov r73, r63 \n"
"mov r60, r74 \n"
"mov r61, r75 \n"
"mov r62, r76 \n"
"mov r63, r77 \n"
"call 3 \n"
"mov r74, r60 \n"
"mov r75, r61 \n"
"mov r76, r62 \n"
"mov r77, r63 \n"
"ret \n"
"endfunc \n"
";FFT32 \n"
"func 5 \n"
"mov r60, r400 \n"
"mov r61, r408 \n"
"mov r62, r416 \n"
"mov r63, r424 \n"
"call 3 \n"
"mov r400, r60 \n"
"mov r408, r61 \n"
"mov r416, r62 \n"
"mov r424, r63 \n"
"mov r60, r401 \n"
"mov r61, r409 \n"
"mov r62, r417 \n"
"mov r63, r425 \n"
"call 3 \n"
"mov r401, r60 \n"
"mov r409, r61 \n"
"mov r417, r62 \n"
"mov r425, r63 \n"
"mov r60, r402 \n"
"mov r61, r410 \n"
"mov r62, r418 \n"
"mov r63, r426 \n"
"call 3 \n"
"mov r402, r60 \n"
"mov r410, r61 \n"
"mov r418, r62 \n"
"mov r426, r63 \n"
"mov r60, r403 \n"
"mov r61, r411 \n"
"mov r62, r419 \n"
"mov r63, r427 \n"
"call 3 \n"
"mov r403, r60 \n"
"mov r411, r61 \n"
"mov r419, r62 \n"
"mov r427, r63 \n"
"mov r60, r404 \n"
"mov r61, r412 \n"
"mov r62, r420 \n"
"mov r63, r428 \n"
"call 3 \n"
"mov r404, r60 \n"
"mov r412, r61 \n"
"mov r420, r62 \n"
"mov r428, r63 \n"
"mov r60, r405 \n"
"mov r61, r413 \n"
"mov r62, r421 \n"
"mov r63, r429 \n"
"call 3 \n"
"mov r405, r60 \n"
"mov r413, r61 \n"
"mov r421, r62 \n"
"mov r429, r63 \n"
"mov r60, r406 \n"
"mov r61, r414 \n"
"mov r62, r422 \n"
"mov r63, r430 \n"
"call 3 \n"
"mov r406, r60 \n"
"mov r414, r61 \n"
"mov r422, r62 \n"
"mov r430, r63 \n"
"mov r60, r407 \n"
"mov r61, r415 \n"
"mov r62, r423 \n"
"mov r63, r431 \n"
"call 3 \n"
"mov r407, r60 \n"
"mov r415, r61 \n"
"mov r423, r62 \n"
"mov r431, r63 \n"
"mov r40, r409 \n"
"mov r41, l10.xyxy \n"
"call 0 \n"
"mov r409, r40 \n"
"mov r40, r410 \n"
"mov r41, l10.zwzw \n"
"call 0 \n"
"mov r410, r40 \n"
"mov r40, r411 \n"
"mov r41, l11.xyxy \n"
"call 0 \n"
"mov r411, r40 \n"
"mov r40, r412 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r412, r40 \n"
"mov r40, r413 \n"
"mov r41, l11.zwzw \n"
"call 0 \n"
"mov r413, r40 \n"
"mov r40, r414 \n"
"mov r41, l12.xyxy \n"
"call 0 \n"
"mov r414, r40 \n"
"mov r40, r415 \n"
"mov r41, l12.zwzw \n"
"call 0 \n"
"mov r415, r40 \n"
"mov r40, r417 \n"
"mov r41, l13.xyxy \n"
"call 0 \n"
"mov r417, r40 \n"
"mov r40, r418 \n"
"mov r41, l13.zwzw \n"
"call 0 \n"
"mov r418, r40 \n"
"mov r40, r419 \n"
"mov r41, l14.xyxy \n"
"call 0 \n"
"mov r419, r40 \n"
"mov r40, r420 \n"
"mov r41, l14.zwzw \n"
"call 0 \n"
"mov r420, r40 \n"
"mov r40, r421 \n"
"mov r41, l15.xyxy \n"
"call 0 \n"
"mov r421, r40 \n"
"mov r40, r422 \n"
"mov r41, l15.zwzw \n"
"call 0 \n"
"mov r422, r40 \n"
"mov r40, r423 \n"
"mov r41, l16.xyxy \n"
"call 0 \n"
"mov r423, r40 \n"
"mov r40, r425 \n"
"mov r41, l16.zwzw \n"
"call 0 \n"
"mov r425, r40 \n"
"mov r40, r426 \n"
"mov r41, l17.xyxy \n"
"call 0 \n"
"mov r426, r40 \n"
"mov r40, r427 \n"
"mov r41, l17.zwzw \n"
"call 0 \n"
"mov r427, r40 \n"
"mov r40, r428 \n"
"mov r41, l18.xyxy \n"
"call 0 \n"
"mov r428, r40 \n"
"mov r40, r429 \n"
"mov r41, l18.zwzw \n"
"call 0 \n"
"mov r429, r40 \n"
"mov r40, r430 \n"
"mov r41, l19.xyxy \n"
"call 0 \n"
"mov r430, r40 \n"
"mov r40, r431 \n"
"mov r41, l19.zwzw \n"
"call 0 \n"
"mov r431, r40 \n"
"mov r70, r400 \n"
"mov r71, r401 \n"
"mov r72, r402 \n"
"mov r73, r403 \n"
"mov r74, r404 \n"
"mov r75, r405 \n"
"mov r76, r406 \n"
"mov r77, r407 \n"
"call 4 \n"
"mov r400, r70 \n"
"mov r401, r71 \n"
"mov r402, r72 \n"
"mov r403, r73 \n"
"mov r404, r74 \n"
"mov r405, r75 \n"
"mov r406, r76 \n"
"mov r407, r77 \n"
"mov r70, r408 \n"
"mov r71, r409 \n"
"mov r72, r410 \n"
"mov r73, r411 \n"
"mov r74, r412 \n"
"mov r75, r413 \n"
"mov r76, r414 \n"
"mov r77, r415 \n"
"call 4 \n"
"mov r408, r70 \n"
"mov r409, r71 \n"
"mov r410, r72 \n"
"mov r411, r73 \n"
"mov r412, r74 \n"
"mov r413, r75 \n"
"mov r414, r76 \n"
"mov r415, r77 \n"
"mov r70, r416 \n"
"mov r71, r417 \n"
"mov r72, r418 \n"
"mov r73, r419 \n"
"mov r74, r420 \n"
"mov r75, r421 \n"
"mov r76, r422 \n"
"mov r77, r423 \n"
"call 4 \n"
"mov r416, r70 \n"
"mov r417, r71 \n"
"mov r418, r72 \n"
"mov r419, r73 \n"
"mov r420, r74 \n"
"mov r421, r75 \n"
"mov r422, r76 \n"
"mov r423, r77 \n"
"mov r70, r424 \n"
"mov r71, r425 \n"
"mov r72, r426 \n"
"mov r73, r427 \n"
"mov r74, r428 \n"
"mov r75, r429 \n"
"mov r76, r430 \n"
"mov r77, r431 \n"
"call 4 \n"
"mov r424, r70 \n"
"mov r425, r71 \n"
"mov r426, r72 \n"
"mov r427, r73 \n"
"mov r428, r74 \n"
"mov r429, r75 \n"
"mov r430, r76 \n"
"mov r431, r77 \n"
"ret \n"
"endfunc \n"
"func 6 \n"
"mov r80._y__, r80.x \n"
"mov r400, g[r80.y+0] \n"
"mov r401, g[r80.y+64] \n"
"mov r402, g[r80.y+128] \n"
"mov r403, g[r80.y+192] \n"
"mov r404, g[r80.y+256] \n"
"mov r405, g[r80.y+320] \n"
"mov r406, g[r80.y+384] \n"
"mov r407, g[r80.y+448] \n"
"iadd r80._y__, r80.y, l30.z \n"
"mov r408, g[r80.y+0] \n"
"mov r409, g[r80.y+64] \n"
"mov r410, g[r80.y+128] \n"
"mov r411, g[r80.y+192] \n"
"mov r412, g[r80.y+256] \n"
"mov r413, g[r80.y+320] \n"
"mov r414, g[r80.y+384] \n"
"mov r415, g[r80.y+448] \n"
"iadd r80._y__, r80.y, l30.z \n"
"mov r416, g[r80.y+0] \n"
"mov r417, g[r80.y+64] \n"
"mov r418, g[r80.y+128] \n"
"mov r419, g[r80.y+192] \n"
"mov r420, g[r80.y+256] \n"
"mov r421, g[r80.y+320] \n"
"mov r422, g[r80.y+384] \n"
"mov r423, g[r80.y+448] \n"
"iadd r80._y__, r80.y, l30.z \n"
"mov r424, g[r80.y+0] \n"
"mov r425, g[r80.y+64] \n"
"mov r426, g[r80.y+128] \n"
"mov r427, g[r80.y+192] \n"
"mov r428, g[r80.y+256] \n"
"mov r429, g[r80.y+320] \n"
"mov r430, g[r80.y+384] \n"
"mov r431, g[r80.y+448] \n"
"ret \n"
"endfunc \n"
"func 7 \n"
"mov g[r80.x+0], r400 \n"
"mov g[r80.x+1], r416 \n"
"mov g[r80.x+2], r408 \n"
"mov g[r80.x+3], r424 \n"
"mov g[r80.x+4], r404 \n"
"mov g[r80.x+5], r420 \n"
"mov g[r80.x+6], r412 \n"
"mov g[r80.x+7], r428 \n"
"mov g[r80.x+8], r402 \n"
"mov g[r80.x+9], r418 \n"
"mov g[r80.x+10], r410 \n"
"mov g[r80.x+11], r426 \n"
"mov g[r80.x+12], r406 \n"
"mov g[r80.x+13], r422 \n"
"mov g[r80.x+14], r414 \n"
"mov g[r80.x+15], r430 \n"
"mov g[r80.x+16], r401 \n"
"mov g[r80.x+17], r417 \n"
"mov g[r80.x+18], r409 \n"
"mov g[r80.x+19], r425 \n"
"mov g[r80.x+20], r405 \n"
"mov g[r80.x+21], r421 \n"
"mov g[r80.x+22], r413 \n"
"mov g[r80.x+23], r429 \n"
"mov g[r80.x+24], r403 \n"
"mov g[r80.x+25], r419 \n"
"mov g[r80.x+26], r411 \n"
"mov g[r80.x+27], r427 \n"
"mov g[r80.x+28], r407 \n"
"mov g[r80.x+29], r423 \n"
"mov g[r80.x+30], r415 \n"
"mov g[r80.x+31], r431 \n"
"ret \n"
"endfunc \n"
"func 81 \n"
"mov r500.x___, r400.x \n"
"mov r500._y__, r416.x \n"
"mov r500.__z_, r408.x \n"
"mov r500.___w, r424.x \n"
"mov r501.x___, r404.x \n"
"mov r501._y__, r420.x \n"
"mov r501.__z_, r412.x \n"
"mov r501.___w, r428.x \n"
"mov r502.x___, r402.x \n"
"mov r502._y__, r418.x \n"
"mov r502.__z_, r410.x \n"
"mov r502.___w, r426.x \n"
"mov r503.x___, r406.x \n"
"mov r503._y__, r422.x \n"
"mov r503.__z_, r414.x \n"
"mov r503.___w, r430.x \n"
"mov r504.x___, r401.x \n"
"mov r504._y__, r417.x \n"
"mov r504.__z_, r409.x \n"
"mov r504.___w, r425.x \n"
"mov r505.x___, r405.x \n"
"mov r505._y__, r421.x \n"
"mov r505.__z_, r413.x \n"
"mov r505.___w, r429.x \n"
"mov r506.x___, r403.x \n"
"mov r506._y__, r419.x \n"
"mov r506.__z_, r411.x \n"
"mov r506.___w, r427.x \n"
"mov r507.x___, r407.x \n"
"mov r507._y__, r423.x \n"
"mov r507.__z_, r415.x \n"
"mov r507.___w, r431.x \n"
"lds_write_vec mem0, r500 \n"
"lds_write_vec_lOffset(4) mem0, r501 \n"
"lds_write_vec_lOffset(8) mem0, r502 \n"
"lds_write_vec_lOffset(12) mem0, r503 \n"
"lds_write_vec_lOffset(16) mem0, r504 \n"
"lds_write_vec_lOffset(20) mem0, r505 \n"
"lds_write_vec_lOffset(24) mem0, r506 \n"
"lds_write_vec_lOffset(28) mem0, r507 \n"
"fence_lds \n"
"ret \n"
"endfunc \n"
"func 91 \n"
"lds_read_vec_neighborExch r500, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r501, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r502, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r503, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r504, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r505, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r506, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r507, r75.xyyy \n"
"mov r400.x___, r500.x \n"
"mov r401.x___, r500.y \n"
"mov r402.x___, r500.z \n"
"mov r403.x___, r500.w \n"
"mov r404.x___, r501.x \n"
"mov r405.x___, r501.y \n"
"mov r406.x___, r501.z \n"
"mov r407.x___, r501.w \n"
"mov r408.x___, r502.x \n"
"mov r409.x___, r502.y \n"
"mov r410.x___, r502.z \n"
"mov r411.x___, r502.w \n"
"mov r412.x___, r503.x \n"
"mov r413.x___, r503.y \n"
"mov r414.x___, r503.z \n"
"mov r415.x___, r503.w \n"
"mov r416.x___, r504.x \n"
"mov r417.x___, r504.y \n"
"mov r418.x___, r504.z \n"
"mov r419.x___, r504.w \n"
"mov r420.x___, r505.x \n"
"mov r421.x___, r505.y \n"
"mov r422.x___, r505.z \n"
"mov r423.x___, r505.w \n"
"mov r424.x___, r506.x \n"
"mov r425.x___, r506.y \n"
"mov r426.x___, r506.z \n"
"mov r427.x___, r506.w \n"
"mov r428.x___, r507.x \n"
"mov r429.x___, r507.y \n"
"mov r430.x___, r507.z \n"
"mov r431.x___, r507.w \n"
"ret \n"
"endfunc \n"
"func 82 \n"
"mov r500.x___, r400.y \n"
"mov r500._y__, r416.y \n"
"mov r500.__z_, r408.y \n"
"mov r500.___w, r424.y \n"
"mov r501.x___, r404.y \n"
"mov r501._y__, r420.y \n"
"mov r501.__z_, r412.y \n"
"mov r501.___w, r428.y \n"
"mov r502.x___, r402.y \n"
"mov r502._y__, r418.y \n"
"mov r502.__z_, r410.y \n"
"mov r502.___w, r426.y \n"
"mov r503.x___, r406.y \n"
"mov r503._y__, r422.y \n"
"mov r503.__z_, r414.y \n"
"mov r503.___w, r430.y \n"
"mov r504.x___, r401.y \n"
"mov r504._y__, r417.y \n"
"mov r504.__z_, r409.y \n"
"mov r504.___w, r425.y \n"
"mov r505.x___, r405.y \n"
"mov r505._y__, r421.y \n"
"mov r505.__z_, r413.y \n"
"mov r505.___w, r429.y \n"
"mov r506.x___, r403.y \n"
"mov r506._y__, r419.y \n"
"mov r506.__z_, r411.y \n"
"mov r506.___w, r427.y \n"
"mov r507.x___, r407.y \n"
"mov r507._y__, r423.y \n"
"mov r507.__z_, r415.y \n"
"mov r507.___w, r431.y \n"
"lds_write_vec mem0, r500 \n"
"lds_write_vec_lOffset(4) mem0, r501 \n"
"lds_write_vec_lOffset(8) mem0, r502 \n"
"lds_write_vec_lOffset(12) mem0, r503 \n"
"lds_write_vec_lOffset(16) mem0, r504 \n"
"lds_write_vec_lOffset(20) mem0, r505 \n"
"lds_write_vec_lOffset(24) mem0, r506 \n"
"lds_write_vec_lOffset(28) mem0, r507 \n"
"fence_lds \n"
"ret \n"
"endfunc \n"
"func 92 \n"
"lds_read_vec_neighborExch r500, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r501, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r502, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r503, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r504, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r505, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r506, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r507, r75.xyyy \n"
"mov r400._y__, r500.x \n"
"mov r401._y__, r500.y \n"
"mov r402._y__, r500.z \n"
"mov r403._y__, r500.w \n"
"mov r404._y__, r501.x \n"
"mov r405._y__, r501.y \n"
"mov r406._y__, r501.z \n"
"mov r407._y__, r501.w \n"
"mov r408._y__, r502.x \n"
"mov r409._y__, r502.y \n"
"mov r410._y__, r502.z \n"
"mov r411._y__, r502.w \n"
"mov r412._y__, r503.x \n"
"mov r413._y__, r503.y \n"
"mov r414._y__, r503.z \n"
"mov r415._y__, r503.w \n"
"mov r416._y__, r504.x \n"
"mov r417._y__, r504.y \n"
"mov r418._y__, r504.z \n"
"mov r419._y__, r504.w \n"
"mov r420._y__, r505.x \n"
"mov r421._y__, r505.y \n"
"mov r422._y__, r505.z \n"
"mov r423._y__, r505.w \n"
"mov r424._y__, r506.x \n"
"mov r425._y__, r506.y \n"
"mov r426._y__, r506.z \n"
"mov r427._y__, r506.w \n"
"mov r428._y__, r507.x \n"
"mov r429._y__, r507.y \n"
"mov r430._y__, r507.z \n"
"mov r431._y__, r507.w \n"
"ret \n"
"endfunc \n"
"func 83 \n"
"mov r500.x___, r400.z \n"
"mov r500._y__, r416.z \n"
"mov r500.__z_, r408.z \n"
"mov r500.___w, r424.z \n"
"mov r501.x___, r404.z \n"
"mov r501._y__, r420.z \n"
"mov r501.__z_, r412.z \n"
"mov r501.___w, r428.z \n"
"mov r502.x___, r402.z \n"
"mov r502._y__, r418.z \n"
"mov r502.__z_, r410.z \n"
"mov r502.___w, r426.z \n"
"mov r503.x___, r406.z \n"
"mov r503._y__, r422.z \n"
"mov r503.__z_, r414.z \n"
"mov r503.___w, r430.z \n"
"mov r504.x___, r401.z \n"
"mov r504._y__, r417.z \n"
"mov r504.__z_, r409.z \n"
"mov r504.___w, r425.z \n"
"mov r505.x___, r405.z \n"
"mov r505._y__, r421.z \n"
"mov r505.__z_, r413.z \n"
"mov r505.___w, r429.z \n"
"mov r506.x___, r403.z \n"
"mov r506._y__, r419.z \n"
"mov r506.__z_, r411.z \n"
"mov r506.___w, r427.z \n"
"mov r507.x___, r407.z \n"
"mov r507._y__, r423.z \n"
"mov r507.__z_, r415.z \n"
"mov r507.___w, r431.z \n"
"lds_write_vec mem0, r500 \n"
"lds_write_vec_lOffset(4) mem0, r501 \n"
"lds_write_vec_lOffset(8) mem0, r502 \n"
"lds_write_vec_lOffset(12) mem0, r503 \n"
"lds_write_vec_lOffset(16) mem0, r504 \n"
"lds_write_vec_lOffset(20) mem0, r505 \n"
"lds_write_vec_lOffset(24) mem0, r506 \n"
"lds_write_vec_lOffset(28) mem0, r507 \n"
"fence_lds \n"
"ret \n"
"endfunc \n"
"func 93 \n"
"lds_read_vec_neighborExch r500, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r501, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r502, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r503, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r504, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r505, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r506, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r507, r75.xyyy \n"
"mov r400.__z_, r500.x \n"
"mov r401.__z_, r500.y \n"
"mov r402.__z_, r500.z \n"
"mov r403.__z_, r500.w \n"
"mov r404.__z_, r501.x \n"
"mov r405.__z_, r501.y \n"
"mov r406.__z_, r501.z \n"
"mov r407.__z_, r501.w \n"
"mov r408.__z_, r502.x \n"
"mov r409.__z_, r502.y \n"
"mov r410.__z_, r502.z \n"
"mov r411.__z_, r502.w \n"
"mov r412.__z_, r503.x \n"
"mov r413.__z_, r503.y \n"
"mov r414.__z_, r503.z \n"
"mov r415.__z_, r503.w \n"
"mov r416.__z_, r504.x \n"
"mov r417.__z_, r504.y \n"
"mov r418.__z_, r504.z \n"
"mov r419.__z_, r504.w \n"
"mov r420.__z_, r505.x \n"
"mov r421.__z_, r505.y \n"
"mov r422.__z_, r505.z \n"
"mov r423.__z_, r505.w \n"
"mov r424.__z_, r506.x \n"
"mov r425.__z_, r506.y \n"
"mov r426.__z_, r506.z \n"
"mov r427.__z_, r506.w \n"
"mov r428.__z_, r507.x \n"
"mov r429.__z_, r507.y \n"
"mov r430.__z_, r507.z \n"
"mov r431.__z_, r507.w \n"
"ret \n"
"endfunc \n"
"func 84 \n"
"mov r500.x___, r400.w \n"
"mov r500._y__, r416.w \n"
"mov r500.__z_, r408.w \n"
"mov r500.___w, r424.w \n"
"mov r501.x___, r404.w \n"
"mov r501._y__, r420.w \n"
"mov r501.__z_, r412.w \n"
"mov r501.___w, r428.w \n"
"mov r502.x___, r402.w \n"
"mov r502._y__, r418.w \n"
"mov r502.__z_, r410.w \n"
"mov r502.___w, r426.w \n"
"mov r503.x___, r406.w \n"
"mov r503._y__, r422.w \n"
"mov r503.__z_, r414.w \n"
"mov r503.___w, r430.w \n"
"mov r504.x___, r401.w \n"
"mov r504._y__, r417.w \n"
"mov r504.__z_, r409.w \n"
"mov r504.___w, r425.w \n"
"mov r505.x___, r405.w \n"
"mov r505._y__, r421.w \n"
"mov r505.__z_, r413.w \n"
"mov r505.___w, r429.w \n"
"mov r506.x___, r403.w \n"
"mov r506._y__, r419.w \n"
"mov r506.__z_, r411.w \n"
"mov r506.___w, r427.w \n"
"mov r507.x___, r407.w \n"
"mov r507._y__, r423.w \n"
"mov r507.__z_, r415.w \n"
"mov r507.___w, r431.w \n"
"lds_write_vec mem0, r500 \n"
"lds_write_vec_lOffset(4) mem0, r501 \n"
"lds_write_vec_lOffset(8) mem0, r502 \n"
"lds_write_vec_lOffset(12) mem0, r503 \n"
"lds_write_vec_lOffset(16) mem0, r504 \n"
"lds_write_vec_lOffset(20) mem0, r505 \n"
"lds_write_vec_lOffset(24) mem0, r506 \n"
"lds_write_vec_lOffset(28) mem0, r507 \n"
"fence_lds \n"
"ret \n"
"endfunc \n"
"func 94 \n"
"lds_read_vec_neighborExch r500, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r501, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r502, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r503, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r504, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r505, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r506, r75.xyyy \n"
"iadd r75.x___, r75.x, l24.x \n"
"lds_read_vec_neighborExch r507, r75.xyyy \n"
"mov r400.___w, r500.x \n"
"mov r401.___w, r500.y \n"
"mov r402.___w, r500.z \n"
"mov r403.___w, r500.w \n"
"mov r404.___w, r501.x \n"
"mov r405.___w, r501.y \n"
"mov r406.___w, r501.z \n"
"mov r407.___w, r501.w \n"
"mov r408.___w, r502.x \n"
"mov r409.___w, r502.y \n"
"mov r410.___w, r502.z \n"
"mov r411.___w, r502.w \n"
"mov r412.___w, r503.x \n"
"mov r413.___w, r503.y \n"
"mov r414.___w, r503.z \n"
"mov r415.___w, r503.w \n"
"mov r416.___w, r504.x \n"
"mov r417.___w, r504.y \n"
"mov r418.___w, r504.z \n"
"mov r419.___w, r504.w \n"
"mov r420.___w, r505.x \n"
"mov r421.___w, r505.y \n"
"mov r422.___w, r505.z \n"
"mov r423.___w, r505.w \n"
"mov r424.___w, r506.x \n"
"mov r425.___w, r506.y \n"
"mov r426.___w, r506.z \n"
"mov r427.___w, r506.w \n"
"mov r428.___w, r507.x \n"
"mov r429.___w, r507.y \n"
"mov r430.___w, r507.z \n"
"mov r431.___w, r507.w \n"
"ret \n"
"endfunc \n"
"func 10 \n"
"mul_ieee r100, r80.x, l40 \n"
"mul_ieee r101, r80.x, l41 \n"
"mul_ieee r102, r80.x, l42 \n"
"mul_ieee r103, r80.x, l43 \n"
"mul_ieee r104, r80.x, l44 \n"
"mul_ieee r105, r80.x, l45 \n"
"mul_ieee r106, r80.x, l46 \n"
"mul_ieee r107, r80.x, l47 \n"
"cos_vec r110._yzw, r100 \n"
"cos_vec r111, r101 \n"
"cos_vec r112, r102 \n"
"cos_vec r113, r103 \n"
"cos_vec r114, r104 \n"
"cos_vec r115, r105 \n"
"cos_vec r116, r106 \n"
"cos_vec r117, r107 \n"
"sin_vec r120._yzw, r100 \n"
"sin_vec r121, r101 \n"
"sin_vec r122, r102 \n"
"sin_vec r123, r103 \n"
"sin_vec r124, r104 \n"
"sin_vec r125, r105 \n"
"sin_vec r126, r106 \n"
"sin_vec r127, r107 \n"
"mov r40, r401 \n"
"mov r41.x_z_, r110.y \n"
"mov r41._y_w, r120.y \n"
"call 0 \n"
"mov r401, r40 \n"
"mov r40, r402 \n"
"mov r41.x_z_, r110.z \n"
"mov r41._y_w, r120.z \n"
"call 0 \n"
"mov r402, r40 \n"
"mov r40, r403 \n"
"mov r41.x_z_, r110.w \n"
"mov r41._y_w, r120.w \n"
"call 0 \n"
"mov r403, r40 \n"
"mov r40, r404 \n"
"mov r41.x_z_, r111.x \n"
"mov r41._y_w, r121.x \n"
"call 0 \n"
"mov r404, r40 \n"
"mov r40, r405 \n"
"mov r41.x_z_, r111.y \n"
"mov r41._y_w, r121.y \n"
"call 0 \n"
"mov r405, r40 \n"
"mov r40, r406 \n"
"mov r41.x_z_, r111.z \n"
"mov r41._y_w, r121.z \n"
"call 0 \n"
"mov r406, r40 \n"
"mov r40, r407 \n"
"mov r41.x_z_, r111.w \n"
"mov r41._y_w, r121.w \n"
"call 0 \n"
"mov r407, r40 \n"
"mov r40, r408 \n"
"mov r41.x_z_, r112.x \n"
"mov r41._y_w, r122.x \n"
"call 0 \n"
"mov r408, r40 \n"
"mov r40, r409 \n"
"mov r41.x_z_, r112.y \n"
"mov r41._y_w, r122.y \n"
"call 0 \n"
"mov r409, r40 \n"
"mov r40, r410 \n"
"mov r41.x_z_, r112.z \n"
"mov r41._y_w, r122.z \n"
"call 0 \n"
"mov r410, r40 \n"
"mov r40, r411 \n"
"mov r41.x_z_, r112.w \n"
"mov r41._y_w, r122.w \n"
"call 0 \n"
"mov r411, r40 \n"
"mov r40, r412 \n"
"mov r41.x_z_, r113.x \n"
"mov r41._y_w, r123.x \n"
"call 0 \n"
"mov r412, r40 \n"
"mov r40, r413 \n"
"mov r41.x_z_, r113.y \n"
"mov r41._y_w, r123.y \n"
"call 0 \n"
"mov r413, r40 \n"
"mov r40, r414 \n"
"mov r41.x_z_, r113.z \n"
"mov r41._y_w, r123.z \n"
"call 0 \n"
"mov r414, r40 \n"
"mov r40, r415 \n"
"mov r41.x_z_, r113.w \n"
"mov r41._y_w, r123.w \n"
"call 0 \n"
"mov r415, r40 \n"
"mov r40, r416 \n"
"mov r41.x_z_, r114.x \n"
"mov r41._y_w, r124.x \n"
"call 0 \n"
"mov r416, r40 \n"
"mov r40, r417 \n"
"mov r41.x_z_, r114.y \n"
"mov r41._y_w, r124.y \n"
"call 0 \n"
"mov r417, r40 \n"
"mov r40, r418 \n"
"mov r41.x_z_, r114.z \n"
"mov r41._y_w, r124.z \n"
"call 0 \n"
"mov r418, r40 \n"
"mov r40, r419 \n"
"mov r41.x_z_, r114.w \n"
"mov r41._y_w, r124.w \n"
"call 0 \n"
"mov r419, r40 \n"
"mov r40, r420 \n"
"mov r41.x_z_, r115.x \n"
"mov r41._y_w, r125.x \n"
"call 0 \n"
"mov r420, r40 \n"
"mov r40, r421 \n"
"mov r41.x_z_, r115.y \n"
"mov r41._y_w, r125.y \n"
"call 0 \n"
"mov r421, r40 \n"
"mov r40, r422 \n"
"mov r41.x_z_, r115.z \n"
"mov r41._y_w, r125.z \n"
"call 0 \n"
"mov r422, r40 \n"
"mov r40, r423 \n"
"mov r41.x_z_, r115.w \n"
"mov r41._y_w, r125.w \n"
"call 0 \n"
"mov r423, r40 \n"
"mov r40, r424 \n"
"mov r41.x_z_, r116.x \n"
"mov r41._y_w, r126.x \n"
"call 0 \n"
"mov r424, r40 \n"
"mov r40, r425 \n"
"mov r41.x_z_, r116.y \n"
"mov r41._y_w, r126.y \n"
"call 0 \n"
"mov r425, r40 \n"
"mov r40, r426 \n"
"mov r41.x_z_, r116.z \n"
"mov r41._y_w, r126.z \n"
"call 0 \n"
"mov r426, r40 \n"
"mov r40, r427 \n"
"mov r41.x_z_, r116.w \n"
"mov r41._y_w, r126.w \n"
"call 0 \n"
"mov r427, r40 \n"
"mov r40, r428 \n"
"mov r41.x_z_, r117.x \n"
"mov r41._y_w, r127.x \n"
"call 0 \n"
"mov r428, r40 \n"
"mov r40, r429 \n"
"mov r41.x_z_, r117.y \n"
"mov r41._y_w, r127.y \n"
"call 0 \n"
"mov r429, r40 \n"
"mov r40, r430 \n"
"mov r41.x_z_, r117.z \n"
"mov r41._y_w, r127.z \n"
"call 0 \n"
"mov r430, r40 \n"
"mov r40, r431 \n"
"mov r41.x_z_, r117.w \n"
"mov r41._y_w, r127.w \n"
"call 0 \n"
"mov r431, r40 \n"
"ret \n"
"endfunc \n"
"end \n";
static const char* _fft2048_fft8_tomo_source_ =
"il_cs_2_0 \n"
"dcl_num_thread_per_group 64 \n"
"; l0 = (0.0f, 1.401298464e-45f, -1.#QNANf, 2.802596929e-45f, ) \n"
"dcl_literal l0, 0x00000000, 0x00000001, 0xFFFFFFFF, 0x00000002 \n"
"; l1 = (0.0f, 1.0f, -1.0f, 0.7071067691f, ) \n"
"dcl_literal l1, 0x00000000, 0x3F800000, 0xBF800000, 0x3F3504F3 \n"
"; l2 = (4.203895393e-45f, -1.#QNANf, 8.407790786e-45f, 1.261168618e-44f, ) \n"
"dcl_literal l2, 0x00000003, 0xFFFFFFFC, 0x00000006, 0x00000009 \n"
"; l3 = (2048.0f, 0.0f, 0.0f, 0.0f, ) \n"
"dcl_literal l3, 0x45000000, 0x00000000, 0x00000000, 0x00000000 \n"
"; l4 = (2.101947696e-44f, -1.#QNANf, 0.0f, 0.0f, ) \n"
"dcl_literal l4, 0x0000000F, 0xFFFFFFF0, 0x00000000, 0x00000000 \n"
"; l10 = (0.0f, -25.13274193f, -12.56637096f, -37.69911194f, ) \n"
"dcl_literal l10, 0x80000000, 0xC1C90FDB, 0xC1490FDB, 0xC216CBE4 \n"
"; l11 = (-6.283185482f, -31.41592598f, -18.84955597f, -43.98229599f, ) \n"
"dcl_literal l11, 0xC0C90FDB, 0xC1FB53D1, 0xC196CBE4, 0xC22FEDDF \n"
"and r70.x___, vThreadGrpIdFlat0.x, l2.x \n"
"and r70._y__, vThreadGrpIdFlat0.x, l2.y \n"
"ishl r70.x___, r70.x, l2.z \n"
"ishl r70._y__, r70.y, l2.w \n"
"iadd r70.__z_, r70.x, vTidInGrpFlat0.x \n"
"iadd r70.x___, r70.y, r70.z \n"
"call 5 \n"
"call 4 \n"
"itof r80.x___, r70.z \n"
"div_zeroop(fltmax) r80, r80.x, l3.x \n"
"call 7 \n"
"and r70.x___, r70.z, l4.x \n"
"and r70.___w, r70.z, l4.y \n"
"ishl r70.___w, r70.w, l0.w \n"
"iadd r70.x___, r70.x, r70.w \n"
"iadd r70.x___, r70.x, r70.y \n"
"call 6 \n"
"endmain \n"
";twiddle 8 \n"
"func 7 \n"
"mul_ieee r100, r80, l10 \n"
"mul_ieee r101, r80, l11 \n"
"cos_vec r110, r100 \n"
"cos_vec r111, r101 \n"
"sin_vec r120, r100 \n"
"sin_vec r121, r101 \n"
"mov r40, r401 \n"
"mov r41.x_z_, r110.y \n"
"mov r41._y_w, r120.y \n"
"call 0 \n"
"mov r401, r40 \n"
"mov r40, r402 \n"
"mov r41.x_z_, r110.z \n"
"mov r41._y_w, r120.z \n"
"call 0 \n"
"mov r402, r40 \n"
"mov r40, r403 \n"
"mov r41.x_z_, r110.w \n"
"mov r41._y_w, r120.w \n"
"call 0 \n"
"mov r403, r40 \n"
"mov r40, r404 \n"
"mov r41.x_z_, r111.x \n"
"mov r41._y_w, r121.x \n"
"call 0 \n"
"mov r404, r40 \n"
"mov r40, r405 \n"
"mov r41.x_z_, r111.y \n"
"mov r41._y_w, r121.y \n"
"call 0 \n"
"mov r405, r40 \n"
"mov r40, r406 \n"
"mov r41.x_z_, r111.z \n"
"mov r41._y_w, r121.z \n"
"call 0 \n"
"mov r406, r40 \n"
"mov r40, r407 \n"
"mov r41.x_z_, r111.w \n"
"mov r41._y_w, r121.w \n"
"call 0 \n"
"mov r407, r40 \n"
"ret \n"
"endfunc \n"
";mov global buffer to register, interval is 256 \n"
"func 5 \n"
"mov r400, g[r70.x+0] \n"
"mov r401, g[r70.x+256] \n"
"mov r402, g[r70.x+512] \n"
"mov r403, g[r70.x+768] \n"
"mov r404, g[r70.x+1024] \n"
"mov r405, g[r70.x+1280] \n"
"mov r406, g[r70.x+1536] \n"
"mov r407, g[r70.x+1792] \n"
"ret \n"
"endfunc \n"
";mov register to global buffer, interval is 512 \n"
"func 6 \n"
"mov g[r70.x+0], r400 \n"
"mov g[r70.x+16], r404 \n"
"mov g[r70.x+32], r402 \n"
"mov g[r70.x+48], r406 \n"
"mov g[r70.x+1024], r401 \n"
"mov g[r70.x+1040], r405 \n"
"mov g[r70.x+1056], r403 \n"
"mov g[r70.x+1072], r407 \n"
"ret \n"
"endfunc \n"
";FFT2. \n"
"func 2 \n"
"mov r100, r50 \n"
"add r50, r100, r51 \n"
"sub r51, r100, r51 \n"
"ret \n"
"endfunc \n"
";FFT4. \n"
"func 3 \n"
"mov r50, r60 \n"
"mov r51, r62 \n"
"call 2 \n"
"mov r60, r50 \n"
"mov r62, r51 \n"
"mov r50, r61 \n"
"mov r51, r63 \n"
"call 2 \n"
"mov r61, r50 \n"
"mov r63, r51 \n"
"mov r40, r63 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r63, r40 \n"
"mov r50, r60 \n"
"mov r51, r61 \n"
"call 2 \n"
"mov r60, r50 \n"
"mov r61, r51 \n"
"mov r50, r62 \n"
"mov r51, r63 \n"
"call 2 \n"
"mov r62, r50 \n"
"mov r63, r51 \n"
"ret \n"
"endfunc \n"
";FFT8. \n"
"func 4 \n"
"mov r50, r400 \n"
"mov r51, r404 \n"
"call 2 \n"
"mov r400, r50 \n"
"mov r404, r51 \n"
"mov r50, r401 \n"
"mov r51, r405 \n"
"call 2 \n"
"mov r401, r50 \n"
"mov r405, r51 \n"
"mov r50, r402 \n"
"mov r51, r406 \n"
"call 2 \n"
"mov r402, r50 \n"
"mov r406, r51 \n"
"mov r50, r403 \n"
"mov r51, r407 \n"
"call 2 \n"
"mov r403, r50 \n"
"mov r407, r51 \n"
"mov r40, r405 \n"
"mov r41, l1.yzyz \n"
"call 0 \n"
"mov r405, r40 \n"
"mul_ieee r405, r405, l1.w \n"
"mov r40, r406 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r406, r40 \n"
"mov r40, r407 \n"
"mov r41, l1.z \n"
"call 0 \n"
"mov r407, r40 \n"
"mul_ieee r407, r407, l1.w \n"
"mov r60, r400 \n"
"mov r61, r401 \n"
"mov r62, r402 \n"
"mov r63, r403 \n"
"call 3 \n"
"mov r400, r60 \n"
"mov r401, r61 \n"
"mov r402, r62 \n"
"mov r403, r63 \n"
"mov r60, r404 \n"
"mov r61, r405 \n"
"mov r62, r406 \n"
"mov r63, r407 \n"
"call 3 \n"
"mov r404, r60 \n"
"mov r405, r61 \n"
"mov r406, r62 \n"
"mov r407, r63 \n"
"ret \n"
"endfunc \n"
"func 0 \n"
"mul_ieee r100, r40, r41 \n"
"mul_ieee r101, r40, r41.yxwz \n"
"sub r40.x_z_, r100.xxzz, r100.yyww \n"
"add r40._y_w, r101.xxzz, r101.yyww \n"
"ret \n"
"endfunc \n"
"end \n";
const char _fft2048_fft4_tomo_source_[] =
"il_cs_2_0 \n"
"dcl_num_thread_per_group 64 \n"
"; l0 = (0.0f, 1.401298464e-45f, -1.#QNANf, 2.802596929e-45f, ) \n"
"dcl_literal l0, 0x00000000, 0x00000001, 0xFFFFFFFF, 0x00000002 \n"
"; l1 = (0.0f, 1.0f, -1.0f, 0.7071067691f, ) \n"
"dcl_literal l1, 0x00000000, 0x3F800000, 0xBF800000, 0x3F3504F3 \n"
"; l2 = (9.809089250e-45f, -1.#QNANf, 8.407790786e-45f, 1.121038771e-44f, ) \n"
"dcl_literal l2, 0x00000007, 0xFFFFFFF8, 0x00000006, 0x00000008 \n"
"; l3 = (2048.0f, 0.0f, 0.0f, 0.0f, ) \n"
"dcl_literal l3, 0x45000000, 0x00000000, 0x00000000, 0x00000000 \n"
"; l4 = (0.0f, -12.56637096f, -6.283185482f, -18.84955597f, ) \n"
"dcl_literal l4, 0x80000000, 0xC1490FDB, 0xC0C90FDB, 0xC196CBE4 \n"
"and r70.x___, vThreadGrpIdFlat0.x, l2.x \n"
"and r70._y__, vThreadGrpIdFlat0.x, l2.y \n"
"ishl r70.x___, r70.x, l2.z \n"
"ishl r70._y__, r70.y, l2.w \n"
"iadd r70.__z_, r70.x, vTidInGrpFlat0.x \n"
"iadd r70.x___, r70.y, r70.z \n"
"call 4 \n"
"call 3 \n"
"call 6 \n"
"call 5 \n"
"endmain \n"
";twiddle 4 \n"
"func 6 \n"
"itof r100.x___, r70.z \n"
"div_zeroop(fltmax) r100, r100.x, l3.x \n"
"mul_ieee r100, r100, l4 \n"
"cos_vec r110, r100 \n"
"sin_vec r120, r100 \n"
"mov r40, r401 \n"
"mov r41.x_z_, r110.y \n"
"mov r41._y_w, r120.y \n"
"call 0 \n"
"mov r401, r40 \n"
"mov r40, r402 \n"
"mov r41.x_z_, r110.z \n"
"mov r41._y_w, r120.z \n"
"call 0 \n"
"mov r402, r40 \n"
"mov r40, r403 \n"
"mov r41.x_z_, r110.w \n"
"mov r41._y_w, r120.w \n"
"call 0 \n"
"mov r403, r40 \n"
"ret \n"
"endfunc \n"
";mov global buffer to register, interval is 512 \n"
"func 4 \n"
"mov r400, g[r70.x+0] \n"
"mov r401, g[r70.x+512] \n"
"mov r402, g[r70.x+1024] \n"
"mov r403, g[r70.x+1536] \n"
"ret \n"
"endfunc \n"
";mov register to global buffer, interval is 512 \n"
"func 5 \n"
"mov g[r70.x+0], r400 \n"
"mov g[r70.x+1024], r401 \n"
"mov g[r70.x+512], r402 \n"
"mov g[r70.x+1536], r403 \n"
"ret \n"
"endfunc \n"
";FFT2. \n"
"func 2 \n"
"mov r100, r50 \n"
"add r50, r100, r51 \n"
"sub r51, r100, r51 \n"
"ret \n"
"endfunc \n"
";FFT4. \n"
"func 3 \n"
"mov r50, r400 \n"
"mov r51, r402 \n"
"call 2 \n"
"mov r400, r50 \n"
"mov r402, r51 \n"
"mov r50, r401 \n"
"mov r51, r403 \n"
"call 2 \n"
"mov r401, r50 \n"
"mov r403, r51 \n"
"mov r40, r403 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r403, r40 \n"
"mov r50, r400 \n"
"mov r51, r401 \n"
"call 2 \n"
"mov r400, r50 \n"
"mov r401, r51 \n"
"mov r50, r402 \n"
"mov r51, r403 \n"
"call 2 \n"
"mov r402, r50 \n"
"mov r403, r51 \n"
"ret \n"
"endfunc \n"
"func 0 \n"
"mul_ieee r100, r40, r41 \n"
"mul_ieee r101, r40, r41.yxwz \n"
"sub r40.x_z_, r100.xxzz, r100.yyww \n"
"add r40._y_w, r101.xxzz, r101.yyww \n"
"ret \n"
"endfunc \n"
"end \n";
static const CALchar * _transpose2048_tomo_fft_source_ =
"il_cs_2_0 \n"
"dcl_num_thread_per_group 64 \n"
"; l1 = (2.802596929e-45f, 0.0f, 0.0f, 0.0f, ) \n"
"dcl_literal l1, 0x00000002, 0x00000000, 0x00000000, 0x00000000 \n"
"; l2 = (9.809089250e-45f, -1.#QNANf, 8.407790786e-45f, 1.121038771e-44f, ) \n"
"dcl_literal l2, 0x00000007, 0xFFFFFFF8, 0x00000006, 0x00000008 \n"
"and r70.x___, vThreadGrpIdFlat0.x, l2.x \n"
"and r70._y__, vThreadGrpIdFlat0.x, l2.y \n"
"ishl r70.x___, r70.x, l2.z \n"
"ishl r70._y__, r70.y, l2.w \n"
"iadd r70.__z_, r70.x, vTidInGrpFlat0.x \n"
"iadd r70.x___, r70.y, r70.z \n"
"call 4 \n"
"fence_memory \n"
"ishl r70.x___, vAbsTidFlat0.x, l1.x \n"
"call 5 \n"
"endmain \n"
";mov global buffer to register, interval is 512 \n"
"func 4 \n"
"mov r400, g[r70.x+0] \n"
"mov r401, g[r70.x+512] \n"
"mov r402, g[r70.x+1024] \n"
"mov r403, g[r70.x+1536] \n"
"ret \n"
"endfunc \n"
";mov register to global buffer, interval is 512 \n"
"func 5 \n"
"mov g[r70.x+0], r400 \n"
"mov g[r70.x+1], r401 \n"
"mov g[r70.x+2], r402 \n"
"mov g[r70.x+3], r403 \n"
"ret \n"
"endfunc \n"
"end \n";
static const CALchar * _simple_compute_tomo_fft_source_ =
"il_cs_2_0 \n"
"dcl_num_thread_per_group 64 \n"
"; l0 = (0.0f, 1.401298464e-45f, -1.#QNANf, 2.802596929e-45f, ) \n"
"dcl_literal l0, 0x00000000, 0x00000001, 0xFFFFFFFF, 0x00000002 \n"
"; l1 = (0.0f, 1.0f, -1.0f, 0.7071067691f, ) \n"
"dcl_literal l1, 0x00000000, 0x3F800000, 0xBF800000, 0x3F3504F3 \n"
"; l2 = (9.809089250e-45f, -1.#QNANf, 8.407790786e-45f, 1.121038771e-44f, ) \n"
"dcl_literal l2, 0x00000007, 0xFFFFFFF8, 0x00000006, 0x00000008 \n"
"; l3 = (2048.0f, 0.0f, 0.0f, 0.0f, ) \n"
"dcl_literal l3, 0x45000000, 0x00000000, 0x00000000, 0x00000000 \n"
"; l4 = (0.0f, -12.56637096f, -6.283185482f, -18.84955597f, ) \n"
"dcl_literal l4, 0x80000000, 0xC1490FDB, 0xC0C90FDB, 0xC196CBE4 \n"
"and r70.x___, vThreadGrpIdFlat0.x, l2.x \n"
"and r70._y__, vThreadGrpIdFlat0.x, l2.y \n"
"ishl r70.x___, r70.x, l2.z \n"
"ishl r70._y__, r70.y, l2.w \n"
"iadd r70.__z_, r70.x, vTidInGrpFlat0.x \n"
"iadd r70.x___, r70.y, r70.z \n"
"call 4 \n"
//"call 3 \n"
//"call 6 \n"
"call 5 \n"
"endmain \n"
";twiddle 4 \n"
"func 6 \n"
"itof r100.x___, r70.z \n"
"div_zeroop(fltmax) r100, r100.x, l3.x \n"
"mul_ieee r100, r100, l4 \n"
"cos_vec r110, r100 \n"
"sin_vec r120, r100 \n"
"mov r40, r401 \n"
"mov r41.x_z_, r110.y \n"
"mov r41._y_w, r120.y \n"
"call 0 \n"
"mov r401, r40 \n"
"mov r40, r402 \n"
"mov r41.x_z_, r110.z \n"
"mov r41._y_w, r120.z \n"
"call 0 \n"
"mov r402, r40 \n"
"mov r40, r403 \n"
"mov r41.x_z_, r110.w \n"
"mov r41._y_w, r120.w \n"
"call 0 \n"
"mov r403, r40 \n"
"ret \n"
"endfunc \n"
";mov global buffer to register, interval is 512 \n"
"func 4 \n"
"mov r400, g[r70.x+0] \n"
"mov r401, g[r70.x+512] \n"
"mov r402, g[r70.x+1024] \n"
"mov r403, g[r70.x+1536] \n"
"ret \n"
"endfunc \n"
";mov register to global buffer, interval is 512 \n"
"func 5 \n"
"mov g[r70.x+0], r400 \n"
"mov g[r70.x+1024], r401 \n"
"mov g[r70.x+512], r402 \n"
"mov g[r70.x+1536], r403 \n"
"ret \n"
"endfunc \n"
";FFT2. \n"
"func 2 \n"
"mov r100, r50 \n"
"add r50, r100, r51 \n"
"sub r51, r100, r51 \n"
"ret \n"
"endfunc \n"
";FFT4. \n"
"func 3 \n"
"mov r50, r400 \n"
"mov r51, r402 \n"
"call 2 \n"
"mov r400, r50 \n"
"mov r402, r51 \n"
"mov r50, r401 \n"
"mov r51, r403 \n"
"call 2 \n"
"mov r401, r50 \n"
"mov r403, r51 \n"
"mov r40, r403 \n"
"mov r41, l1.xzxz \n"
"call 0 \n"
"mov r403, r40 \n"
"mov r50, r400 \n"
"mov r51, r401 \n"
"call 2 \n"
"mov r400, r50 \n"
"mov r401, r51 \n"
"mov r50, r402 \n"
"mov r51, r403 \n"
"call 2 \n"
"mov r402, r50 \n"
"mov r403, r51 \n"
"ret \n"
"endfunc \n"
"func 0 \n"
"mul_ieee r100, r40, r41 \n"
"mul_ieee r101, r40, r41.yxwz \n"
"sub r40.x_z_, r100.xxzz, r100.yyww \n"
"add r40._y_w, r101.xxzz, r101.yyww \n"
"ret \n"
"endfunc \n"
"end \n";
}
}
#endif // _FFT_IL_SOURCE_H_
|
[
"the729@1960d7c4-c739-11dd-8829-37334faa441c"
] |
[
[
[
1,
4446
]
]
] |
53f61e1b16387c271e145640f2f537b91446098e
|
fde5aa467c3a25c49765c2b441c0f3bd58a02d93
|
/git/git/git.cpp
|
b6a959b660802644ba460b31dc2f56f96859a345
|
[] |
no_license
|
Stals/Git-Rpg
|
85d50816214b5260fefb199ec7f7c5c14558984c
|
76461c19ae87513d3c2b17386d3adda822574f12
|
refs/heads/master
| 2021-01-20T09:09:21.289695 | 2011-07-14T10:29:00 | 2011-07-14T10:29:00 | 1,576,842 | 0 | 0 | null | null | null | null |
WINDOWS-1251
|
C++
| false | false | 4,996 |
cpp
|
// git.cpp : Defines the entry point for the console application.
//
//TODO
// брать дериктории из .cfg
//
//
#include "stdafx.h"
#include <iostream>
#include <string>
#include <Windows.h>
#include <map>
#include <fstream>
//
struct lines {
int plus;
int minus;
void clear(){plus=0;minus=0;}
}l;
std::map<std::string,lines> data; //data from "your name" file
std::map<std::string,lines> rawData; //data from raw file
std::map<std::string,lines>::iterator it;
std::string projectDir;
int plusDif;//разница плюсов по сравнению с тем что было до commit'а
int minusDif;//разница минусов
void getData(){
int numberOfProjects=0;
std::ifstream f("Stals");
f>>numberOfProjects;
for(int i=0;i<numberOfProjects;++i){
std::getline(f,projectDir);//чтобы убрать конец строки
std::getline(f,projectDir);
f>>l.plus;
f>>l.minus;
data.insert ( std::pair<std::string,lines >(projectDir,l) );
l.clear();
projectDir.clear();
}
f.close();
}
void parseRaw(){
std::ifstream f("raw");
std::string str;//используется чтобы перебирать сторки
std::string nick; //хранит ник человека комит которого мы просматриваем
f>>projectDir;
while(str!="commit"){//если путь с пробелами собираем его по словам
projectDir=projectDir+" "+str;
f>>str;
}
// Если встречается слово files то, если следующее слово changed, то после этого следает нужное нам число.
while(f>>str){
//TODO:Ник может быть из нескольких слово поэтом нужно сделать append до тех пор пока в слове первый символ не будет < - что значит почта, но почта не обязательно будет.
//что будет если человек не укажет почту? там всёравно будут <> -????
//а что если у человека в нике есть < ? Ну это может быть только если второе слово начинается с этого символа что мало вероятно
if(str=="Author:"){//тут можно получить ник
nick="";
f>>str;
while(str[0]!='<'){
nick.append(str);
f>>str;
}
}
if(str=="files"){
f>>str;
if(str=="changed,"){
f>>l.plus;
f>>str;
if(str=="insertions(+),"){
f>>l.minus;
it=rawData.find(nick);
//Если такого ника нету в map , тогда добавляется запись - иначе увеличивается кол-вл plus и minus для этого ника
if(it==rawData.end()){ //если записи с таким ником еще небыло
rawData.insert ( std::pair<std::string,lines >(nick,l) );
}else{
it->second.plus+=l.plus;
it->second.minus+=l.minus;
}
}
l.clear();
}
}
}
}
//Сравнивает raw с data для этой дериктории и изменяет в data ,если raw число увеличилось
//Если такой дериктории небыло то создаёт её
//TODO: передавать сюда строку с ником человека для которого меняем
void editData(){
/*minusDif=rawData["Stals"].minus-data[projectDir].minus;
plusDif=rawData["Stals"].plus-data[projectDir].plus;*///это для высчитывания разницы
it=data.find(projectDir);
if(it!=data.end()){
it->second.minus=rawData["Stals"].minus;
it->second.plus=rawData["Stals"].plus;
}else{
l.minus=rawData["Stals"].minus;
l.plus=rawData["Stals"].plus;
data.insert ( std::pair<std::string,lines >(projectDir,l) );
}
l.clear();
projectDir.empty();
}
//Сохраняет В Stals новую информацию полученную из raw
void saveData(){
std::ofstream f("Stals");
f<<data.size()<<std::endl;
for(it=data.begin();it!=data.end();++it){
f<<it->first<<std::endl;
f<<it->second.plus<<std::endl;
f<<it->second.minus<<std::endl;
}
f.close();
}
int main()
{
getData();
parseRaw();
//Сейчас projectDir - это дериктория проекта из которого был получен raw
//Сейчас мы должны сравнить кол-во плючсов и минусов для этой дериктории по сравнению с этой дерикторией в Stals , если такой нет, тогда добавляем новую запись в тот map
editData();
//сохраняем всё обратно в файл(ы)
saveData();
return 0;
}
|
[
"[email protected]",
"[email protected]"
] |
[
[
[
1,
68
],
[
71,
71
],
[
81,
151
]
],
[
[
69,
70
],
[
72,
80
]
]
] |
0aaae583830ee9b1f8d0a63665c9b31cddd2dbe7
|
eb9c9c17a5266763562e53098e70128dab7043a7
|
/src/vgRegHacker/vgRegTree.cpp
|
f03c2923dc0954515dd91d43cdf31b5a8ee4d130
|
[] |
no_license
|
kimmyungwon/videogear
|
36b80c1c346ed14f923bd7e05e84a72cd5cacde6
|
e5f35adb7d561bfc1c6ecf61900ad7a45d02dc88
|
refs/heads/master
| 2016-09-06T09:49:37.589673 | 2010-05-11T07:06:47 | 2010-05-11T07:06:47 | 35,530,887 | 0 | 0 | null | null | null | null |
WINDOWS-1252
|
C++
| false | false | 19,703 |
cpp
|
#include "vgRegTree.hpp"
#include "vgUtil/vgConsole.h"
#include "vgUtil/vgHook.hpp"
#include "vgUtil/vgString.hpp"
#include "vgUtil/vgWinDDK.hpp"
#define MAX_KEY_LENGTH 255
#define MAX_VALUE_NAME_LENGTH 16383
#define HOOK(api) m_hook->Hook(Real_##api, Mine_##api);
#define UNHOOK(api) m_hook->Unhook(Real_##api, Mine_##api);
VG_NAMESPACE_BEGIN
#include "vgRegTree_Impl.inl"
RegTree& RegTree::GetInstance( void )
{
static RegTree instance;
return instance;
}
RegTree::~RegTree( void )
{
delete m_hook;
m_hook = NULL;
}
void RegTree::Hook( void )
{
HOOK(RegCloseKey);
HOOK(RegCreateKeyExW);
HOOK(RegDeleteKeyW);
HOOK(RegDeleteValueW);
HOOK(RegEnumKeyW);
HOOK(RegEnumKeyExW);
HOOK(RegEnumValueW);
HOOK(RegFlushKey);
HOOK(RegGetKeySecurity);
HOOK(RegLoadKeyW);
HOOK(RegNotifyChangeKeyValue);
HOOK(RegOpenKeyExW);
HOOK(RegOverridePredefKey);
HOOK(RegQueryInfoKeyW);
HOOK(RegQueryMultipleValuesW);
HOOK(RegQueryValueExW);
HOOK(RegReplaceKeyW);
HOOK(RegRestoreKeyW);
HOOK(RegSaveKeyW);
HOOK(RegSaveKeyExW);
HOOK(RegSetKeySecurity);
HOOK(RegSetValueExW);
HOOK(RegUnLoadKeyW);
}
void RegTree::Unhook( void )
{
UNHOOK(RegCloseKey);
UNHOOK(RegCreateKeyExW);
UNHOOK(RegDeleteKeyW);
UNHOOK(RegDeleteValueW);
UNHOOK(RegEnumKeyW);
UNHOOK(RegEnumKeyExW);
UNHOOK(RegEnumValueW);
UNHOOK(RegFlushKey);
UNHOOK(RegGetKeySecurity);
UNHOOK(RegLoadKeyW);
UNHOOK(RegNotifyChangeKeyValue);
UNHOOK(RegOpenKeyExW);
UNHOOK(RegOverridePredefKey);
UNHOOK(RegQueryInfoKeyW);
UNHOOK(RegQueryMultipleValuesW);
UNHOOK(RegQueryValueExW);
UNHOOK(RegReplaceKeyW);
UNHOOK(RegRestoreKeyW);
UNHOOK(RegSaveKeyW);
UNHOOK(RegSaveKeyExW);
UNHOOK(RegSetKeySecurity);
UNHOOK(RegSetValueExW);
UNHOOK(RegUnLoadKeyW);
}
LSTATUS APIENTRY RegTree::RegCloseKey(HKEY hKey)
{
if (IsVirtualKey(hKey))
return ERROR_SUCCESS;
else
return Real_RegCloseKey(hKey);
}
LSTATUS APIENTRY RegTree::RegCreateKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD Reserved, LPWSTR lpClass, DWORD dwOptions, REGSAM samDesired, LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult, LPDWORD lpdwDisposition)
{
RegPath path;
if (ResolveKey(hKey, lpSubKey, path))
{
RegNode *node = CreateKey(path, lpdwDisposition);
if (node != NULL)
{
*phkResult = node->AsKey();
return ERROR_SUCCESS;
}
else
return ERROR_ACCESS_DENIED;
}
else
return Real_RegCreateKeyExW(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, phkResult, lpdwDisposition);
}
LSTATUS APIENTRY RegTree::RegDeleteKeyW(HKEY hKey, LPCWSTR lpSubKey)
{
RegPath path;
ResolveKey(hKey, lpSubKey, path);
Console::GetInstance().Print(L"DeleteKey: %s\n", path.ToString().c_str());
return Real_RegDeleteKeyW(hKey, lpSubKey);
}
LSTATUS APIENTRY RegTree::RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
{
RegPath path;
ResolveKey(hKey, path);
Console::GetInstance().Print(L"DeleteValue: %s\n", path.ToString().c_str());
return Real_RegDeleteValueW(hKey, lpValueName);
}
LSTATUS APIENTRY RegTree::RegEnumKeyW( HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cchName )
{
if (IsVirtualKey(hKey))
{
RegNode *node = (RegNode*)((int)hKey & ~0x40000000);
if (dwIndex == 0)
LoadRealChildren(node);
if (dwIndex < node->m_children.size())
{
RegNode *childNode = node->m_children[dwIndex];
wcscpy_s(lpName, cchName, childNode->m_name.c_str());
return ERROR_SUCCESS;
}
else
return ERROR_NO_MORE_ITEMS;
}
else
return Real_RegEnumKeyW(hKey, dwIndex, lpName, cchName);
}
LSTATUS APIENTRY RegTree::RegEnumKeyExW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, LPDWORD lpcchName, LPDWORD lpReserved, LPWSTR lpClass, LPDWORD lpcchClass, PFILETIME lpftLastWriteTime)
{
if (IsVirtualKey(hKey))
{
RegNode *node = (RegNode*)((int)hKey & ~0x40000000);
if (dwIndex == 0)
LoadRealChildren(node);
if (dwIndex < node->m_children.size())
{
RegNode *childNode = node->m_children[dwIndex];
if (lpName != NULL)
wcscpy_s(lpName, *lpcchName, childNode->m_name.c_str());
*lpcchName = childNode->m_name.length();
return ERROR_SUCCESS;
}
else
return ERROR_NO_MORE_ITEMS;
}
else
return Real_RegEnumKeyExW(hKey, dwIndex, lpName, lpcchName, lpReserved, lpClass, lpcchClass, lpftLastWriteTime);
}
LSTATUS APIENTRY RegTree::RegEnumValueW(HKEY hKey, DWORD dwIndex, LPWSTR lpValueName, LPDWORD lpcchValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData)
{
RegPath path;
if (IsVirtualKey(hKey))
{
RegNode *node = (RegNode*)((int)hKey & ~0x40000000);
if (dwIndex == 0)
LoadRealChildren(node);
if (dwIndex < node->m_values.size())
{
RegValue *value = node->m_values[dwIndex];
if (lpValueName != NULL)
wcscpy_s(lpValueName, *lpcchValueName, value->m_name.c_str());
if (lpcchValueName != NULL)
*lpcchValueName = value->m_name.length();
if (lpType != NULL)
*lpType = value->m_dataType;
if (lpData != NULL)
memcpy_s(lpData, *lpcbData, value->m_data.c_str(), value->m_data.size());
if (lpcbData != NULL)
*lpcbData = value->m_data.size();
return ERROR_SUCCESS;
}
else
return ERROR_NO_MORE_ITEMS;
}
else
return Real_RegEnumValueW(hKey, dwIndex, lpValueName, lpcchValueName, lpReserved, lpType, lpData, lpcbData);
}
LSTATUS APIENTRY RegTree::RegFlushKey(HKEY hKey)
{
RegPath path;
ResolveKey(hKey, path);
Console::GetInstance().Print(L"FlushKey: %s\n", path.ToString().c_str());
return Real_RegFlushKey(hKey);
}
LSTATUS APIENTRY RegTree::RegGetKeySecurity(HKEY hKey, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, LPDWORD lpcbSecurityDescriptor)
{
RegPath path;
ResolveKey(hKey, path);
Console::GetInstance().Print(L"GetKeySecurity: %s\n", path.ToString().c_str());
return Real_RegGetKeySecurity(hKey, SecurityInformation, pSecurityDescriptor, lpcbSecurityDescriptor);
}
LSTATUS APIENTRY RegTree::RegLoadKeyW(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpFile)
{
return Real_RegLoadKeyW(hKey, lpSubKey, lpFile);
}
LSTATUS APIENTRY RegTree::RegNotifyChangeKeyValue(HKEY hKey, BOOL bWatchSubtree, DWORD dwNotifyFilter, HANDLE hEvent, BOOL fAsynchronous)
{
RegPath path;
ResolveKey(hKey, path);
Console::GetInstance().Print(L"NotifyChangeKeyValue: %s\n", path.ToString().c_str());
return Real_RegNotifyChangeKeyValue(hKey, bWatchSubtree, dwNotifyFilter, hEvent, fAsynchronous);
}
LSTATUS APIENTRY RegTree::RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
{
Console::GetInstance().Print(L"RegOpenKeyExW: %.8X, %s\n", hKey, lpSubKey);
RegPath path;
if (ResolveKey(hKey, lpSubKey, path))
{
RegNode *node = OpenKey(path);
if (node != NULL)
{
HKEY resultKey = node->AsKey();
if (IsVirtualKey(resultKey))
{
*phkResult = resultKey;
return ERROR_SUCCESS;
}
else
return Real_RegOpenKeyExW(resultKey, NULL, ulOptions, samDesired, phkResult);
}
else
return ERROR_NOT_FOUND;
}
else
return Real_RegOpenKeyExW(hKey, lpSubKey, ulOptions, samDesired, phkResult);
}
LSTATUS APIENTRY RegTree::RegOverridePredefKey(HKEY hKey, HKEY hNewHKey)
{
RegPath path;
ResolveKey(hKey, path);
Console::GetInstance().Print(L"OverridePredefKey: %s\n", path.ToString().c_str());
return Real_RegOverridePredefKey(hKey, hNewHKey);
}
LSTATUS APIENTRY RegTree::RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcchClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcbMaxSubKeyLen, LPDWORD lpcbMaxClassLen, LPDWORD lpcValues, LPDWORD lpcbMaxValueNameLen, LPDWORD lpcbMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
{
RegPath path;
if (IsVirtualKey(hKey))
{
RegNode *node = (RegNode*)((int)hKey & ~0x40000000);
LoadRealChildren(node);
if (lpClass != NULL)
lpClass[0] = 0;
if (lpcchClass != NULL)
*lpcchClass = 0;
if (lpcSubKeys != NULL)
*lpcSubKeys = node->m_children.size();
if (lpcbMaxSubKeyLen != NULL)
*lpcbMaxSubKeyLen = 255;
if (lpcbMaxClassLen)
*lpcbMaxClassLen = MAX_PATH;
if (lpcValues != NULL)
*lpcValues = 0;
if (lpcbMaxValueNameLen != NULL)
*lpcbMaxValueNameLen = 16383;
if (lpcbMaxValueLen != NULL)
*lpcbMaxValueLen = 0xFFFFFFFF;
return ERROR_SUCCESS;
}
else
return Real_RegQueryInfoKeyW(hKey, lpClass, lpcchClass, lpReserved, lpcSubKeys, lpcbMaxSubKeyLen, lpcbMaxClassLen, lpcValues, lpcbMaxValueNameLen, lpcbMaxValueLen, lpcbSecurityDescriptor, lpftLastWriteTime);
}
LSTATUS APIENTRY RegTree::RegQueryMultipleValuesW(HKEY hKey, PVALENTW val_list, DWORD num_vals, LPWSTR lpValueBuf, LPDWORD ldwTotsize)
{
RegPath path;
ResolveKey(hKey, path);
Console::GetInstance().Print(L"QueryMultipleValues: %s\n", path.ToString().c_str());
return Real_RegQueryMultipleValuesW(hKey, val_list, num_vals, lpValueBuf, ldwTotsize);
}
LSTATUS APIENTRY RegTree::RegQueryValueExW(HKEY hKey, LPCWSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData)
{
RegPath path;
ResolveKey(hKey, path);
Console::GetInstance().Print(L"QueryValueEx: %s, %s\n", path.ToString().c_str(), lpValueName);
return Real_RegQueryValueExW(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData);
}
LSTATUS APIENTRY RegTree::RegReplaceKeyW(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpNewFile, LPCWSTR lpOldFile)
{
RegPath path;
ResolveKey(hKey, lpSubKey, path);
Console::GetInstance().Print(L"ReplaceKey: %s\n", path.ToString().c_str());
return Real_RegReplaceKeyW(hKey, lpSubKey, lpNewFile, lpOldFile);
}
LSTATUS APIENTRY RegTree::RegRestoreKeyW(HKEY hKey, LPCWSTR lpFile, DWORD dwFlags)
{
RegPath path;
ResolveKey(hKey, path);
Console::GetInstance().Print(L"RestoreKey: %s\n", path.ToString().c_str());
return Real_RegRestoreKeyW(hKey, lpFile, dwFlags);
}
LSTATUS APIENTRY RegTree::RegSaveKeyW(HKEY hKey, LPCWSTR lpFile, CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes)
{
RegPath path;
ResolveKey(hKey, path);
Console::GetInstance().Print(L"SaveKey: %s\n", path.ToString().c_str());
return Real_RegSaveKeyW(hKey, lpFile, lpSecurityAttributes);
}
LSTATUS APIENTRY RegTree::RegSaveKeyExW(HKEY hKey, LPCWSTR lpFile, CONST LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD Flags)
{
RegPath path;
ResolveKey(hKey, path);
Console::GetInstance().Print(L"SaveKeyEx: %s\n", path.ToString().c_str());
return Real_RegSaveKeyExW(hKey, lpFile, lpSecurityAttributes, Flags);
}
LSTATUS APIENTRY RegTree::RegSetKeySecurity(HKEY hKey, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor)
{
RegPath path;
ResolveKey(hKey, path);
Console::GetInstance().Print(L"SetKeySecurity: %s\n", path.ToString().c_str());
return Real_RegSetKeySecurity(hKey, SecurityInformation, pSecurityDescriptor);
}
LSTATUS APIENTRY RegTree::RegSetValueExW(HKEY hKey, LPCWSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE* lpData, DWORD cbData)
{
RegPath path;
ResolveKey(hKey, path);
Console::GetInstance().Print(L"SetValueEx: %s, %s\n", path.ToString().c_str(), lpValueName);
return Real_RegSetValueExW(hKey, lpValueName, Reserved, dwType, lpData, cbData);
}
LSTATUS APIENTRY RegTree::RegUnLoadKeyW(HKEY hKey, LPCWSTR lpSubKey)
{
RegPath path;
ResolveKey(hKey, lpSubKey, path);
Console::GetInstance().Print(L"UnLoadKey: %s\n", path.ToString().c_str());
return Real_RegUnLoadKeyW(hKey, lpSubKey);
}
RegTree::RegTree( void )
{
InitPrefixs();
m_hook = new CodeHook;
m_rootNodes.insert(HKEY_CLASSES_ROOT, RegNode::CreateRoot(HKEY_CLASSES_ROOT));
m_rootNodes.insert(HKEY_CURRENT_USER, RegNode::CreateRoot(HKEY_CURRENT_USER));
m_rootNodes.insert(HKEY_LOCAL_MACHINE, RegNode::CreateRoot(HKEY_LOCAL_MACHINE));
m_rootNodes.insert(HKEY_USERS, RegNode::CreateRoot(HKEY_USERS));
m_rootNodes.insert(HKEY_CURRENT_CONFIG, RegNode::CreateRoot(HKEY_CURRENT_CONFIG));
HKEY key;
RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\iLuE\\VideoGear", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &key, NULL);
RegCloseKey(key);
}
void RegTree::ClearRealChildren( RegNode *node )
{
typedef RegNodeList::index<RegNodeIndex::Type>::type Index;
Index &index = node->m_children.get<RegNodeIndex::Type>();
pair<Index::iterator, Index::iterator> range = index.equal_range(RegNodeType_Real);
for (Index::iterator iter = range.first; iter != range.second; )
{
RegNode *child = *iter;
index.erase(iter++);
delete child;
}
}
RegNode* RegTree::CreateKey( const RegPath &path, LPDWORD disposition )
{
return OpenKey(path, true, disposition);
}
RegNode* RegTree::GetRoot( HKEY rootKey )
{
RootNodeList::iterator iter = m_rootNodes.find(rootKey);
if (iter != m_rootNodes.end())
return iter->second;
else
throw "Invalid root";
}
void RegTree::LoadRealChildren( RegNode *node )
{
if (node->m_realKey != NULL)
{
ClearRealChildren(node);
for (DWORD index = 0; ; index++)
{
WCHAR keyName[MAX_KEY_LENGTH + 1];
DWORD keyNameLen = _countof(keyName);
WCHAR className[MAX_PATH + 1];
DWORD classNameLen = _countof(className);
if (Real_RegEnumKeyExW(node->m_realKey, index, keyName, &keyNameLen, NULL, className, &classNameLen, NULL) != ERROR_SUCCESS)
break;
HKEY newKey;
if (Real_RegOpenKeyExW(node->m_realKey, keyName, 0, KEY_ALL_ACCESS, &newKey) != ERROR_SUCCESS)
continue;
typedef RegNodeList::index<RegNodeIndex::Name>::type Index;
Index &childIndex = node->m_children.get<RegNodeIndex::Name>();
Index::iterator iter = childIndex.find(to_lower_copy(wstring(keyName)));
if (iter != childIndex.end())
continue;
auto_ptr<RegNode> newNode = RegNode::CreateReal(node->m_rootKey, keyName, newKey);
newNode->m_parent = node;
node->m_children.push_back(newNode.release());
}
BYTE *data = (BYTE*)malloc(1000000);
for (DWORD index = 0; ; index++)
{
WCHAR valueName[MAX_VALUE_NAME_LENGTH + 1];
DWORD valueNameLen = _countof(valueName);
DWORD dataType = 0;
DWORD dataSize =1000000;
if (Real_RegEnumValueW(node->m_realKey, index, valueName, &valueNameLen, NULL, &dataType, data, &dataSize) != ERROR_SUCCESS)
break;
auto_ptr<RegValue> newValue = RegValue::Create(RegValueType_Real, valueName, dataType, data, dataSize);
node->m_values.push_back(newValue.release());
}
free(data);
}
}
void RegTree::InitPrefixs( void )
{
HKEY key;
wstring path;
RegOpenCurrentUser(KEY_READ, &key);
ResolveKey(key, path);
m_currentUserPrefix = path;
Real_RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Classes", 0, KEY_READ, &key);
ResolveKey(key, path);
m_classesRootPrefix = path;
Real_RegOpenKeyExW(HKEY_CURRENT_CONFIG, L"Software", 0, KEY_READ, &key);
ResolveKey(key, path);
m_currentConfigSoftwarePrefix = path;
Real_RegOpenKeyExW(HKEY_CURRENT_CONFIG, L"System", 0, KEY_READ, &key);
ResolveKey(key, path);
m_currentConfigSystemPrefix = path;
}
bool RegTree::IsVirtualKey( HKEY key )
{
return ((int)key & 0x40000000) != 0 && ((int)key & 0x80000000) == 0;
}
RegNode* RegTree::OpenKey( const RegPath &path, bool openAlways, LPDWORD disposition )
{
RegNode *root = GetRoot(path.m_rootKey);
if (path.m_segments.empty())
return root;
RegNode *parent = root;
wstring subKey;
BOOST_FOREACH(const wstring &segment, path.m_segments)
{
if (!subKey.empty())
subKey += L"\\";
subKey += segment;
typedef RegNodeList::index<RegNodeIndex::Name>::type Index;
Index &index = parent->m_children.get<RegNodeIndex::Name>();
Index::iterator iter = index.find(to_lower_copy(segment));
if (iter != index.end())
{
parent = *iter;
if (openAlways && parent->m_type == RegNodeType_Real)
{
ClearRealChildren(parent);
parent->m_type = RegNodeType_Normal;
}
}
else
{
HKEY newKey;
if (Real_RegOpenKeyExW(path.m_rootKey, subKey.c_str(), 0, KEY_ALL_ACCESS, &newKey) == ERROR_SUCCESS)
{
RegNode *newNode;
if (openAlways)
newNode = RegNode::CreateNormal(path.m_rootKey, segment, newKey).release();
else
newNode = RegNode::CreateReal(path.m_rootKey, segment, newKey).release();
newNode->m_parent = parent;
parent->m_children.push_back(newNode);
parent = newNode;
if (openAlways && disposition != NULL)
*disposition = REG_OPENED_EXISTING_KEY;
}
else if (openAlways)
{
RegNode *newNode = RegNode::CreateNormal(path.m_rootKey, segment, NULL).release();
newNode->m_parent = parent;
parent->m_children.push_back(newNode);
parent = newNode;
if (disposition != NULL)
*disposition = REG_CREATED_NEW_KEY;
}
else
{
parent = NULL;
break;
}
}
}
return parent;
}
bool RegTree::ResolveKey( HKEY key, wstring &path )
{
BYTE result[1024];
DWORD resultSize;
if (WinDDK::GetInstance().ZwQueryKey(key, KeyNameInformation, result, sizeof(result), &resultSize) == STATUS_SUCCESS)
{
KEY_BASIC_INFORMATION &info = *(KEY_BASIC_INFORMATION*)result;
path = wstring(info.Name, (resultSize - sizeof(KEY_BASIC_INFORMATION)) / sizeof(WCHAR) + 1);
if (!starts_with(path, L"TRY\\"))
return false;
path = path.substr(4);
return true;
}
else
return false;
}
bool RegTree::ResolveKey( HKEY key, RegPath &path )
{
if ((int)key & 0x80000000)
{
path.m_rootKey = key;
path.m_segments.clear();
}
else if ((int)key & 0x40000000)
{
RegNode *node = (RegNode*)((int)key & ~0x40000000);
path.m_rootKey = node->m_rootKey;
path.m_segments.clear();
node->GetSubKey(path.m_segments);
}
else
{
wstring keyPath;
if (!ResolveKey(key, keyPath))
return false;
// ½âÎöRoot
size_t sepPos = keyPath.find(L'\\');
wstring rootName = keyPath.substr(0, sepPos);
wstring subKey;
if (rootName == L"USER")
{
if (istarts_with(keyPath, m_classesRootPrefix))
{
path.m_rootKey = HKEY_CLASSES_ROOT;
subKey = keyPath.substr(m_classesRootPrefix.length());
if (starts_with(subKey, L"\\"))
subKey = subKey.substr(1);
}
else if (istarts_with(keyPath, m_currentUserPrefix))
{
path.m_rootKey = HKEY_CURRENT_USER;
subKey = keyPath.substr(m_currentUserPrefix.length());
if (starts_with(subKey, L"\\"))
subKey = subKey.substr(1);
}
else
{
path.m_rootKey = HKEY_USERS;
subKey = keyPath.substr(sepPos + 1);
}
}
else if (rootName == L"MACHINE")
{
path.m_rootKey = HKEY_LOCAL_MACHINE;
if (istarts_with(keyPath, m_currentConfigSoftwarePrefix))
{
subKey = keyPath.substr(m_currentConfigSoftwarePrefix.length());
if (starts_with(subKey, L"\\"))
subKey = subKey.substr(1);
}
else if (istarts_with(keyPath, m_currentConfigSystemPrefix))
{
subKey = keyPath.substr(m_currentConfigSystemPrefix.length());
if (starts_with(subKey, L"\\"))
subKey = subKey.substr(1);
}
else
subKey = keyPath.substr(sepPos + 1);
}
else
return false;
// ·Ö¸îSubKey
path.m_segments.clear();
String::Split(subKey, L"\\", path.m_segments);
}
return true;
}
bool RegTree::ResolveKey( HKEY key, const wstring &subKey, RegPath &path )
{
RegPath result;
if (!ResolveKey(key, result))
return false;
path = result;
String::Split(subKey, L"\\", path.m_segments);
return true;
}
VG_NAMESPACE_END
|
[
"[email protected]@e2f205af-d647-0410-b852-25b4803e6a9f"
] |
[
[
[
1,
668
]
]
] |
91d2b1967c2a8659dd063d3d063645296abb82d9
|
59166d9d1eea9b034ac331d9c5590362ab942a8f
|
/FrustumTerrain/FrustumSingleton.cpp
|
57d99380d56502bc51d874c02bb7059ddeca2386
|
[] |
no_license
|
seafengl/osgtraining
|
5915f7b3a3c78334b9029ee58e6c1cb54de5c220
|
fbfb29e5ae8cab6fa13900e417b6cba3a8c559df
|
refs/heads/master
| 2020-04-09T07:32:31.981473 | 2010-09-03T15:10:30 | 2010-09-03T15:10:30 | 40,032,354 | 0 | 3 | null | null | null | null |
WINDOWS-1251
|
C++
| false | false | 4,680 |
cpp
|
#include "FrustumSingleton.h"
FrustumSingleton::FrustumSingleton()
{
//создать и выделить память под 8 точек, определяющих view frustum
vOrig = new osg::Vec3Array;
vTrans = new osg::Vec3Array;
vOrig->resize( 8 );
vTrans->resize( 8 );
}
FrustumSingleton::~FrustumSingleton()
{
}
void FrustumSingleton::UpdateProjection( osg::Matrix proj )
{
//обновить информацию матрицы проекции
//Get near and far from the Projection matrix.
float near = proj(3,2) / (proj(2,2)-1.0);
float far = proj(3,2) / (1.0+proj(2,2));
// Get the sides of the near plane.
float nLeft = near * (proj(2,0)-1.0) / proj(0,0);
float nRight = near * (1.0+proj(2,0)) / proj(0,0);
float nTop = near * (1.0+proj(2,1)) / proj(1,1);
float nBottom = near * (proj(2,1)-1.0) / proj(1,1);
// Get the sides of the far plane.
float fLeft = far * (proj(2,0)-1.0) / proj(0,0);
float fRight = far * (1.0+proj(2,0)) / proj(0,0);
float fTop = far * (1.0+proj(2,1)) / proj(1,1);
float fBottom = far * (proj(2,1)-1.0) / proj(1,1);
//заполнение массива вершин, определяющих view frustum
(*vOrig)[0].set( nLeft, nBottom, -near );
(*vOrig)[1].set( nRight, nBottom, -near );
(*vOrig)[2].set( nRight, nTop, -near );
(*vOrig)[3].set( nLeft, nTop, -near );
(*vOrig)[4].set( fLeft, fBottom, -far );
(*vOrig)[5].set( fRight, fBottom, -far );
(*vOrig)[6].set( fRight, fTop, -far );
(*vOrig)[7].set( fLeft, fTop, -far );
}
void FrustumSingleton::UpdateFrustum( osg::Matrix inv_mv )
{
//обновить плоскости отсечения камеры
(*vTrans)[0] = (*vOrig)[0] * inv_mv;
(*vTrans)[1] = (*vOrig)[1] * inv_mv;
(*vTrans)[2] = (*vOrig)[2] * inv_mv;
(*vTrans)[3] = (*vOrig)[3] * inv_mv;
(*vTrans)[4] = (*vOrig)[4] * inv_mv;
(*vTrans)[5] = (*vOrig)[5] * inv_mv;
(*vTrans)[6] = (*vOrig)[6] * inv_mv;
(*vTrans)[7] = (*vOrig)[7] * inv_mv;
//вычислить плоскости отсечения
CalcClipPlanes();
}
void FrustumSingleton::CalcClipPlanes()
{
//вычислить плоскости отсечения
//левая плоскость отсечения
plane[0] = MakePlane( (*vTrans)[0] , (*vTrans)[7] , (*vTrans)[3] );
//правая плоскость отсечения
plane[1] = MakePlane( (*vTrans)[1] , (*vTrans)[2] , (*vTrans)[6] );
//верхняя плоскость
plane[2] = MakePlane( (*vTrans)[2] , (*vTrans)[3] , (*vTrans)[7] );
//нижняя плоскость
plane[3] = MakePlane( (*vTrans)[0] , (*vTrans)[1] , (*vTrans)[4] );
//ближняя плоскость
plane[4] = MakePlane( (*vTrans)[0] , (*vTrans)[2] , (*vTrans)[1] );
//дальняя плоскость
plane[5] = MakePlane( (*vTrans)[5] , (*vTrans)[6] , (*vTrans)[7] );
}
osg::Vec4 FrustumSingleton::MakePlane( osg::Vec3 P1 , osg::Vec3 P2 , osg::Vec3 P3 )
{
//вычислить уравнение плоскости по трем точкам
osg::Vec4 plane;
// A = y1 (z2 - z3) + y2 (z3 - z1) + y3 (z1 - z2)
plane.x() = P1.y() * ( P2.z() - P3.z() ) + P2.y() * ( P3.z() - P1.z() ) + P3.y() * ( P1.z() - P2.z() );
// B = z1 (x2 - x3) + z2 (x3 - x1) + z3 (x1 - x2)
plane.y() = P1.z() * ( P2.x() - P3.x() ) + P2.z() * ( P3.x() - P1.x() ) + P3.z() * ( P1.x() - P2.x() );
// C = x1 (y2 - y3) + x2 (y3 - y1) + x3 (y1 - y2)
plane.z() = P1.x() * ( P2.y() - P3.y() ) + P2.x() * ( P3.y() - P1.y() ) + P3.x() * ( P1.y() - P2.y() );
// - D = x1 (y2 z3 - y3 z2) + x2 (y3 z1 - y1 z3) + x3 (y1 z2 - y2 z1)
plane.w() = -P1.x() * ( P2.y() * P3.z() - P3.y() * P2.z() )
- P2.x() * ( P3.y() * P1.z() - P1.y() * P3.z() )
- P3.x() * ( P1.y() * P2.z() - P2.y() * P1.z() );
return plane;
}
bool FrustumSingleton::BoxVisible( const osg::Vec3 &minn , const osg::Vec3 &maxx )
{
//Определение видимости BOX'a
for( int i = 0 ; i < 6 ; i++ )
{
if( plane[i] * osg::Vec4( minn.x() , minn.y() , minn.z() , 1.0 ) > 0.0 ) continue;
if( plane[i] * osg::Vec4( minn.x() , minn.y() , maxx.z() , 1.0 ) > 0.0 ) continue;
if( plane[i] * osg::Vec4( minn.x() , maxx.y() , minn.z() , 1.0 ) > 0.0 ) continue;
if( plane[i] * osg::Vec4( minn.x() , maxx.y() , maxx.z() , 1.0 ) > 0.0 ) continue;
if( plane[i] * osg::Vec4( maxx.x() , minn.y() , minn.z() , 1.0 ) > 0.0 ) continue;
if( plane[i] * osg::Vec4( maxx.x() , minn.y() , maxx.z() , 1.0 ) > 0.0 ) continue;
if( plane[i] * osg::Vec4( maxx.x() , maxx.y() , minn.z() , 1.0 ) > 0.0 ) continue;
if( plane[i] * osg::Vec4( maxx.x() , maxx.y() , maxx.z() , 1.0 ) > 0.0 ) continue;
return false;
}
return true;
}
|
[
"asmzx79@3290fc28-3049-11de-8daa-cfecb5f7ff5b"
] |
[
[
[
1,
125
]
]
] |
9540f2ebe0c89de7a4dc6ec156eae4c891b5a48d
|
ea12fed4c32e9c7992956419eb3e2bace91f063a
|
/zombie/code/exporter/3dsplugin/src/n3dsanimationexport/n3dsanimationexport_skeleton.cc
|
becf2791b2794db6ca27cf7b98f00a6b00060883
|
[] |
no_license
|
ugozapad/TheZombieEngine
|
832492930df28c28cd349673f79f3609b1fe7190
|
8e8c3e6225c2ed93e07287356def9fbdeacf3d6a
|
refs/heads/master
| 2020-04-30T11:35:36.258363 | 2011-02-24T14:18:43 | 2011-02-24T14:18:43 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 21,199 |
cc
|
#include "precompiled/pchn3dsmaxexport.h"
//------------------------------------------------------------------------------
#include "n3dsanimationexport/n3dsanimationexport.h"
#include "n3dsanimationexport/n3dsskeleton.h"
#include "n3dsexporters/n3dssystemcoordinates.h"
#include "n3dsexporters/n3dsexportserver.h"
#include "n3dsexporters/n3dslog.h"
//------------------------------------------------------------------------------
#include "animcomp/ncskeletonclass.h"
#include "ncragdoll/ncragdollclass.h"
#include "nphysics/ncphyhumragdollclass.h"
#include "nphysics/ncphyfourleggedragdollclass.h"
//------------------------------------------------------------------------------
#include "zombieentity/ncdictionaryclass.h"
#include "nspatial/ncspatialclass.h"
//------------------------------------------------------------------------------
/**
only create neskeleton class
object is not created, not needed
*/
void
n3dsAnimationExport::ExportSkeleton( nEntityClass * entityClass, int lodLevel, const nArray<n3dsSkeleton*>& skeletons )
{
//set skeleton data
n_assert(entityClass);
ncSkeletonClass *skeletonClass = entityClass->GetComponent<ncSkeletonClass>();
skeletonClass->CleanData();
// set joints
if (skeletons[lodLevel]->BonesArray.Size()>0)
{
skeletonClass->BeginJoints(skeletons[lodLevel]->BonesArray.Size());
int numJoints = skeletons[lodLevel]->BonesArray.Size();
for (int iBoneIdx= 0; iBoneIdx < numJoints; iBoneIdx++)
{
vector3 scale, pos;
quaternion quat;
// get scale, quat and pose
skeletons[lodLevel]->BonesArray[iBoneIdx].localTr.get(scale,quat,pos);
// update scale
// i dunno why ( but otherwise do not work )
if (scale.z<0)
{
scale.z=-scale.z;
}
skeletonClass->SetJoint(iBoneIdx,
skeletons[lodLevel]->BonesArray[iBoneIdx].iParentBoneId,
pos,
quat,
scale );
skeletonClass->AddJointName(iBoneIdx,skeletons[lodLevel]->BonesArray[iBoneIdx].strBoneName.Get());
}
skeletonClass->EndJoints();
}
this->CreateJointGroups(skeletonClass, lodLevel, skeletons[lodLevel]);
// add dynamic attachment helpers
skeletonClass->BeginAttachments(skeletons[0]->HelperArray.Size());
for( int i=0; i< skeletons[0]->HelperArray.Size(); i++)
{
n3dsDynAttach helper = skeletons[0]->HelperArray[i];
vector3 scale, pos;
quaternion quat;
// get lod 0 bone name
nString maxLodJointName = skeletons[0]->BonesArray[helper.GetJointIndex()].strBoneName;
// remove Bip0x from name
nString maxJointName = maxLodJointName.ExtractRange(5, maxLodJointName.Length() - 5);
int lodLevelJointIndex = skeletons[lodLevel]->FindBoneThatContains( maxJointName );
n_assert(lodLevelJointIndex != -1 );
this->GetPosRotScale( helper.GetTransformation(), helper.GetJointIndex(), pos, quat, scale);
skeletonClass->SetAttachmentHelper(i, helper.GetAtName().Get(), lodLevelJointIndex, pos, quat);
}
skeletonClass->EndAttachments();
//for default character visualization
ncDictionaryClass *dictionaryClass = entityClass->GetComponent<ncDictionaryClass>();
dictionaryClass->SetFloatVariable("one", 1);
}
//------------------------------------------------------------------------------
/**
only create nehumragdoll class
object is not created, not needed
*/
void
n3dsAnimationExport::ExportRagdollSkeleton( nEntityClass * entityClass, const nArray<n3dsSkeleton*>& skeletons )
{
//set skeleton data
n_assert(entityClass);
ncRagDollClass *ragdollSkeletonClass = entityClass->GetComponent<ncRagDollClass>();
ragdollSkeletonClass->CleanData();
// set joints
ragdollSkeletonClass->BeginJoints(skeletons[0]->RagBonesArray.Size());
int numJoints = skeletons[0]->RagBonesArray.Size();
for (int iBoneIdx= 0; iBoneIdx < numJoints; iBoneIdx++)
{
vector3 scale, pos;
quaternion quat;
// get scale, quat and pose
skeletons[0]->RagBonesArray[iBoneIdx].localTr.get(scale,quat,pos);
// update scale
// i dunno why ( but otherwise do not work )
if (scale.z<0)
{
scale.z=-scale.z;
}
ragdollSkeletonClass->SetJoint(iBoneIdx,
skeletons[0]->RagBonesArray[iBoneIdx].iParentBoneId,
pos,
quat,
scale );
ragdollSkeletonClass->AddJointName(iBoneIdx,skeletons[0]->RagBonesArray[iBoneIdx].strBoneName.Get());
}
ragdollSkeletonClass->EndJoints();
// joint correspondence between lod skeletons and that one
for( int ragJointIdx=0; ragJointIdx< skeletons[0]->RagCorresp.Size(); ragJointIdx++)
{
int maxSkeletonGfxJoint = skeletons[0]->RagCorresp[ragJointIdx];
for( int lodLevel =0; lodLevel< skeletons.Size(); lodLevel++)
{
int lodJointIdx;
nString jointName = skeletons[0]->BonesArray[maxSkeletonGfxJoint].strBoneName;
jointName = jointName.ExtractRange(5, jointName.Length() - 5);
jointName.Strip( "." );
if( lodLevel == 0)
{
lodJointIdx = maxSkeletonGfxJoint;
}
else
{
lodJointIdx = skeletons[lodLevel]->FindBoneThatContains( jointName );
}
ragdollSkeletonClass->SetJointCorrespondence( lodLevel, lodJointIdx, ragJointIdx);
}
}
ncPhyHumRagDollClass* phyclass = 0;
ncPhyFourleggedRagDollClass* phy4class = 0;
n3dsExportSettings::CritterNameType exportCritter = n3dsExportServer::Instance()->GetSettings().critterName;
switch ( exportCritter )
{
case n3dsExportSettings::Human:
phyclass = entityClass->GetComponentSafe<ncPhyHumRagDollClass>();
phyclass->SetHumanAngles();
ragdollSkeletonClass->SetRagType( ncRagDollClass::TypeToString(ncRagDollClass::Human) );
this->ExportHumanRagdollCorrespondence( ragdollSkeletonClass, skeletons );
break;
/* case n3dsExportSettings::Scavenger:
phy4class = entityClass->GetComponentSafe<ncPhyFourleggedRagDollClass>();
phy4class->SetScavengerAngles();
ragdollSkeletonClass->SetRagType( ncRagDollClass::TypeToString(ncRagDollClass::Scavenger) );
this->ExportScvRagdollCorrespondence( ragdollSkeletonClass, skeletons );
break;
case n3dsExportSettings::Strider:
phyclass = entityClass->GetComponentSafe<ncPhyHumRagDollClass>();
phyclass->SetStriderAngles();
ragdollSkeletonClass->SetRagType( ncRagDollClass::TypeToString(ncRagDollClass::Strider) );
this->ExportStriderRagdollCorrespondence( ragdollSkeletonClass, skeletons );
break;*/
default:
n_assert_always();
}
}
//------------------------------------------------------------------------------
/**
*/
void
n3dsAnimationExport::ExportHumanRagdollCorrespondence( ncRagDollClass * ragdollSkeletonClass, const nArray<n3dsSkeleton*>& skeletons )
{
// set ragdoll joints (correspondence between physics ragdoll and gfx ragdoll)
// order them in the same way physic joints are created
int phyRagdollJointIdx = -1;
int fullSkJointIdx = 0;
int gfxRagdollJointIdx = 0;
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "Head" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "L_UpperArm" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "R_UpperArm" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "L_Forearm" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "R_Forearm" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "L_Thigh" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "R_Thigh" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "L_Calf" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "R_Calf" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
}
//------------------------------------------------------------------------------
/**
*/
void
n3dsAnimationExport::ExportScvRagdollCorrespondence( ncRagDollClass * ragdollSkeletonClass, const nArray<n3dsSkeleton*>& skeletons )
{
// set ragdoll joints (correspondence between physics ragdoll and gfx ragdoll)
// order them in the same way physic joints are created
int phyRagdollJointIdx = -1;
int fullSkJointIdx = 0;
int gfxRagdollJointIdx = 0;
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "Head" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "L_Leg_B2" ); //upperarm
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "R_Leg_B2" ); //upperarm
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "L_Leg_B3" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "R_Leg_B3" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "L_Leg_A2" ); //thigh
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "R_Leg_A2" ); //thigh
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "L_Leg_A3" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "R_Leg_A3" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
}
//------------------------------------------------------------------------------
/**
*/
void
n3dsAnimationExport::ExportStriderRagdollCorrespondence( ncRagDollClass * ragdollSkeletonClass, const nArray<n3dsSkeleton*>& skeletons )
{
// set ragdoll joints (correspondence between physics ragdoll and gfx ragdoll)
// order them in the same way physic joints are created
int phyRagdollJointIdx = -1;
int fullSkJointIdx = 0;
int gfxRagdollJointIdx = 0;
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "Head" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "L_Arm1" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "R_Arm1" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "L_Arm2" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "R_Arm2" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "L_Leg1" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "R_Leg1" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "L_Leg2" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
fullSkJointIdx = skeletons[0]->FindBoneThatContains( "R_Leg2" );
gfxRagdollJointIdx = skeletons[0]->RagCorresp.FindIndex( fullSkJointIdx );
ragdollSkeletonClass->SetRagdollJoint( gfxRagdollJointIdx , phyRagdollJointIdx++);
}
//------------------------------------------------------------------------------
/**
gets bone position, rotation and scale from 3dsMax
*/
void
n3dsAnimationExport::GetPosRotScale( Matrix3 localMatrix, int parentID, vector3& pos, quaternion& quat, vector3& scale)
{
// aux data
n3dsSystemCoordinates* systemCoord= n3dsExportServer::Instance()->GetSystemCoordinates();
// get right joint pose, rot, scale
Matrix3 trans(true);
if (parentID == -1)
{
trans = this->GetSkinPivotMatrix();
trans.Invert();
}
Matrix3 tm = localMatrix;
tm = tm*trans;
tm.NoScale();
// convert to nebula
matrix44d auxMatrix = systemCoord->MaxToNebulaMatrix(tm);
// get scale, quat and pose
auxMatrix.get(scale,quat,pos);
// update scale
// i dunno why ( but otherwise do not work )
if (scale.z<0)
{
scale.z=-scale.z;
}
}
//------------------------------------------------------------------------------
/**
*/
void
n3dsAnimationExport::CreateJointGroups(ncSkeletonClass *skeletonClass, int /*lodLevel*/, const n3dsSkeleton* skeleton )
{
////////////////////////
int numGroups = 0;
n3dsExportSettings::CritterNameType exportCritter = n3dsExportServer::Instance()->GetSettings().critterName;
switch ( exportCritter )
{
case n3dsExportSettings::Human:
numGroups = 3;
break;
case n3dsExportSettings::Scavenger:
numGroups = 1;
break;
case n3dsExportSettings::Strider:
numGroups = 3;
break;
default:
n_assert_always();
}
////////////////////////
int jointGroupIndex = 0;
//int humanNumGroups = 3;
//can be used always, not only for humans
//********************************************
skeletonClass->BeginJointGroups(numGroups);
for( ; jointGroupIndex< numGroups; jointGroupIndex++)
{
//all joints for all lodLevels
if( jointGroupIndex == 0)
{
skeletonClass->SetGroupNumberJoints( jointGroupIndex, skeleton->BonesArray.Size());
for( int jointIndex=0; jointIndex< skeleton->BonesArray.Size();)
{
int jointIndices[4];
//set jointIndices in groups of 4
for(int j=0; j<4 ; j++, jointIndex++)
{
if( jointIndex < skeleton->BonesArray.Size())
{
jointIndices[j] = jointIndex;
}
else
{
jointIndices[j] = 0;
}
}
skeletonClass->SetGroup( jointGroupIndex, jointIndices[0], jointIndices[1], jointIndices[2], jointIndices[3]);
}
}
else
{
// create jointIndices array, to use easily SetGroup method
nArray<int> jointIndices;
// add from 0 to jointseparation only for lower train (before it was added for all joint groups)
// because in separationArray not has bip 01
if( jointGroupIndex +1 == numGroups)
{
for(int jointIndex=0; ((jointIndex < skeleton->SeparationArray[0].GetJointIndex()) && (jointIndex<skeleton->BonesArray.Size())); jointIndex++)
{
jointIndices.Append( jointIndex );
}
}
// for other joint separations
for(int j=0; j< skeleton->SeparationArray.Size(); j++)
{
//if joint group index i'm working with
if( skeleton->SeparationArray[j].GetGroupIndex() == jointGroupIndex)
{
// add joints till next joint separation
if( j < skeleton->SeparationArray.Size() - 1 )
{
for(int jointIndex = skeleton->SeparationArray[j].GetJointIndex(); jointIndex < skeleton->SeparationArray[j+1].GetJointIndex(); jointIndex++)
{
jointIndices.Append( jointIndex );
}
}
else
{
for(int jointIndex = skeleton->SeparationArray[j].GetJointIndex(); jointIndex < skeleton->BonesArray.Size(); jointIndex++)
{
jointIndices.Append( jointIndex );
}
}
}
}
skeletonClass->SetGroupNumberJoints( jointGroupIndex, jointIndices.Size());
// easy use of setgroup
int jIndices[4];
int jI = 0;
for( jI=0; jI< jointIndices.Size();)
{
//set jointIndices in groups of 4
for(int j=0; j<4 ; j++, jI++)
{
if( jI < jointIndices.Size())
{
jIndices[j] = jointIndices[jI];
}
else
{
jIndices[j] = 0;
}
}
skeletonClass->SetGroup( jointGroupIndex, jIndices[0], jIndices[1], jIndices[2], jIndices[3]);
}
}
}
skeletonClass->EndJointGroups();
//********************************************
// always these common joints
//skeletonClass->SetCommonJoint(0);
//skeletonClass->SetCommonJoint(1);
}
|
[
"magarcias@c1fa4281-9647-0410-8f2c-f027dd5e0a91"
] |
[
[
[
1,
508
]
]
] |
7f7b6a14e2dd3816abc9f36989daa4ecdbf2e83b
|
b38ab5dcfb913569fc1e41e8deedc2487b2db491
|
/libraries/SoftFX/header/Clip.hpp
|
22fb414c33427975ec772256a41ce066fe63d994
|
[] |
no_license
|
santosh90n/Fury2
|
dacec86ab3972952e4cf6442b38e66b7a67edade
|
740a095c2daa32d33fdc24cc47145a1c13431889
|
refs/heads/master
| 2020-03-21T00:44:27.908074 | 2008-10-16T07:09:17 | 2008-10-16T07:09:17 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,682 |
hpp
|
/*
SoftFX (Software graphics manipulation library)
Copyright (C) 2003 Kevin Gadd
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
Export int Clip2D_Simple(Rectangle *Rect, Image *Dest, Image *Source, int &X, int &Y, int &CX, int &CY);
Export int Clip2D_SimpleRect(Rectangle *Rect, Image *Dest, Image *Source, Rectangle *DestRect, int &CX, int &CY);
Export int Clip2D_SimpleRectWrap(Rectangle *Rect, Image *Dest, Image *Source, Rectangle *DestRect);
Export int Clip2D_PairedRect(Rectangle *Rect, Rectangle *RectS, Image *Dest, Image *Source, Rectangle *DestRect, Rectangle *SourceRect, int *CropOutput);
Export int Clip2D_PairToRect(Rectangle *Dest, Rectangle *Source, Rectangle *Clip);
Export int ClipRectangle_Rect(Rectangle *Rect, Rectangle *Clip);
Export int ClipRectangle_Image(Rectangle *Rect, Image *Image);
Export int ClipRectangle_ImageClipRect(Rectangle *Rect, Image *Image);
int ClipRectangle_ImageClipRect(Rectangle *Rect, Image *Image, int *CropOutput);
extern bool enableClipping;
|
[
"kevin@1af785eb-1c5d-444a-bf89-8f912f329d98"
] |
[
[
[
1,
32
]
]
] |
791b28481f01b17002ce6be57826cfb0acb3c2dd
|
e2e49023f5a82922cb9b134e93ae926ed69675a1
|
/tools/aosdesigner/core/EditionSession.cpp
|
3043eec225b867abdc42acd0e94e2656d63c8550
|
[] |
no_license
|
invy/mjklaim-freewindows
|
c93c867e93f0e2fe1d33f207306c0b9538ac61d6
|
30de8e3dfcde4e81a57e9059dfaf54c98cc1135b
|
refs/heads/master
| 2021-01-10T10:21:51.579762 | 2011-12-12T18:56:43 | 2011-12-12T18:56:43 | 54,794,395 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 3,343 |
cpp
|
#include "core/EditionSession.hpp"
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/exception/diagnostic_information.hpp>
#include "utilcpp/Assert.hpp"
#include "utilcpp/Log.hpp"
#include "core/Sequence.hpp"
#include "core/Project.hpp"
#include "aoslcpp/SequenceInterpreter.hpp"
#include "Paths.hpp"
namespace aosd
{
namespace core
{
EditionSession::EditionSession( const Project& project, const Sequence& sequence, const std::string& name )
: m_sequence( &sequence )
, m_project( project )
, m_interpreter( sequence.make_interpreter() )
, m_id( to_string( boost::uuids::random_generator()() ) )
, m_sequence_id( sequence.id() )
, m_name( name )
{
UTILCPP_ASSERT_NOT_NULL( m_sequence ); // TODO : replace this by an throwing an exception at runtime
}
EditionSession::EditionSession( const Project& project, const bfs::path& file_path )
: m_project( project )
, m_sequence( nullptr )
, m_id( EditionSessionId_INVALID )
, m_save_filepath( file_path )
{
using namespace boost::property_tree;
try
{
bfs::ifstream file_stream( file_path );
if( file_stream.fail() )
{
UTILCPP_LOG_ERROR << "Failed to open file " << file_path;
return;
}
ptree infos;
read_xml( file_stream, infos );
m_id = infos.get<EditionSessionId>( "edition_session.id" );
m_name = infos.get<std::string>( "edition_session.name" );
m_sequence_id = infos.get<SequenceId>( "edition_session.sequence", "NONE" );
if( !m_sequence_id.empty() && m_sequence_id != "NONE" )
{
m_sequence = project.find_sequence( m_sequence_id );
if( m_sequence )
{
m_interpreter = m_sequence->make_interpreter();
// TODO : inject the path in the interpreter, maybe in another (public) function?
}
else
{
UTILCPP_LOG_ERROR << "Sequence id not found in the project!";
}
}
else
{
UTILCPP_LOG_ERROR << "No valid sequence id!";
}
}
catch( const boost::exception& e )
{
UTILCPP_LOG_ERROR << boost::diagnostic_information(e);
}
}
void EditionSession::save( const bfs::path& file_path )
{
UTILCPP_ASSERT( m_sequence ? m_sequence_id == m_sequence->id() : true, "Edition session isn't in sync with the sequence id!" )
using namespace boost::property_tree;
ptree infos;
// write the sequence id
infos.put( "edition_session.id", id() );
infos.put( "edition_session.name", name() );
infos.put( "edition_session.sequence", m_sequence ? m_sequence->id() : "NONE" );
// write the path taken in the sequence
if( m_interpreter )
{
m_interpreter->path().for_each_step( [&]( const aoslcpp::StoryPath::Step& step )
{
//infos.put( "edition_session.steps.move", step.move );
//infos.put( "edition_session.steps.stage", step.stage );
});
}
try
{
m_save_filepath = file_path;
namespace bfs = boost::filesystem;
bfs::ofstream file_stream( file_path );
write_xml( file_stream, infos );
}
catch( const boost::exception& e )
{
UTILCPP_LOG_ERROR << boost::diagnostic_information(e);
}
}
}
}
|
[
"klaim@localhost"
] |
[
[
[
1,
130
]
]
] |
a14746d7cc32494be571baa1c678dc64b0674db7
|
7b379862f58f587d9327db829ae4c6493b745bb1
|
/JuceLibraryCode/modules/juce_core/memory/juce_ReferenceCountedObject.h
|
660ba822cd2f763c02e293cc927989778591593a
|
[] |
no_license
|
owenvallis/Nomestate
|
75e844e8ab68933d481640c12019f0d734c62065
|
7fe7c06c2893421a3c77b5180e5f27ab61dd0ffd
|
refs/heads/master
| 2021-01-19T07:35:14.301832 | 2011-12-28T07:42:50 | 2011-12-28T07:42:50 | 2,950,072 | 2 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 12,971 |
h
|
/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-11 by Raw Material Software Ltd.
------------------------------------------------------------------------------
JUCE can be redistributed and/or modified under the terms of the GNU General
Public License (Version 2), as published by the Free Software Foundation.
A copy of the license is included in the JUCE distribution, or can be found
online at www.gnu.org/licenses.
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.rawmaterialsoftware.com/juce for more information.
==============================================================================
*/
#ifndef __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
#define __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
#include "juce_Atomic.h"
//==============================================================================
/**
Adds reference-counting to an object.
To add reference-counting to a class, derive it from this class, and
use the ReferenceCountedObjectPtr class to point to it.
e.g. @code
class MyClass : public ReferenceCountedObject
{
void foo();
// This is a neat way of declaring a typedef for a pointer class,
// rather than typing out the full templated name each time..
typedef ReferenceCountedObjectPtr<MyClass> Ptr;
};
MyClass::Ptr p = new MyClass();
MyClass::Ptr p2 = p;
p = nullptr;
p2->foo();
@endcode
Once a new ReferenceCountedObject has been assigned to a pointer, be
careful not to delete the object manually.
This class uses an Atomic<int> value to hold the reference count, so that it
the pointers can be passed between threads safely. For a faster but non-thread-safe
version, use SingleThreadedReferenceCountedObject instead.
@see ReferenceCountedObjectPtr, ReferenceCountedArray, SingleThreadedReferenceCountedObject
*/
class JUCE_API ReferenceCountedObject
{
public:
//==============================================================================
/** Increments the object's reference count.
This is done automatically by the smart pointer, but is public just
in case it's needed for nefarious purposes.
*/
inline void incReferenceCount() noexcept
{
++refCount;
}
/** Decreases the object's reference count.
If the count gets to zero, the object will be deleted.
*/
inline void decReferenceCount() noexcept
{
jassert (getReferenceCount() > 0);
if (--refCount == 0)
delete this;
}
/** Returns the object's current reference count. */
inline int getReferenceCount() const noexcept { return refCount.get(); }
protected:
//==============================================================================
/** Creates the reference-counted object (with an initial ref count of zero). */
ReferenceCountedObject()
{
}
/** Destructor. */
virtual ~ReferenceCountedObject()
{
// it's dangerous to delete an object that's still referenced by something else!
jassert (getReferenceCount() == 0);
}
/** Resets the reference count to zero without deleting the object.
You should probably never need to use this!
*/
void resetReferenceCount() noexcept
{
refCount = 0;
}
private:
//==============================================================================
Atomic <int> refCount;
};
//==============================================================================
/**
Adds reference-counting to an object.
This is efectively a version of the ReferenceCountedObject class, but which
uses a non-atomic counter, and so is not thread-safe (but which will be more
efficient).
For more details on how to use it, see the ReferenceCountedObject class notes.
@see ReferenceCountedObject, ReferenceCountedObjectPtr, ReferenceCountedArray
*/
class JUCE_API SingleThreadedReferenceCountedObject
{
public:
//==============================================================================
/** Increments the object's reference count.
This is done automatically by the smart pointer, but is public just
in case it's needed for nefarious purposes.
*/
inline void incReferenceCount() noexcept
{
++refCount;
}
/** Decreases the object's reference count.
If the count gets to zero, the object will be deleted.
*/
inline void decReferenceCount() noexcept
{
jassert (getReferenceCount() > 0);
if (--refCount == 0)
delete this;
}
/** Returns the object's current reference count. */
inline int getReferenceCount() const noexcept { return refCount; }
protected:
//==============================================================================
/** Creates the reference-counted object (with an initial ref count of zero). */
SingleThreadedReferenceCountedObject() : refCount (0) {}
/** Destructor. */
virtual ~SingleThreadedReferenceCountedObject()
{
// it's dangerous to delete an object that's still referenced by something else!
jassert (getReferenceCount() == 0);
}
private:
//==============================================================================
int refCount;
};
//==============================================================================
/**
A smart-pointer class which points to a reference-counted object.
The template parameter specifies the class of the object you want to point to - the easiest
way to make a class reference-countable is to simply make it inherit from ReferenceCountedObject,
but if you need to, you could roll your own reference-countable class by implementing a pair of
mathods called incReferenceCount() and decReferenceCount().
When using this class, you'll probably want to create a typedef to abbreviate the full
templated name - e.g.
@code typedef ReferenceCountedObjectPtr<MyClass> MyClassPtr;@endcode
@see ReferenceCountedObject, ReferenceCountedObjectArray
*/
template <class ReferenceCountedObjectClass>
class ReferenceCountedObjectPtr
{
public:
/** The class being referenced by this pointer. */
typedef ReferenceCountedObjectClass ReferencedType;
//==============================================================================
/** Creates a pointer to a null object. */
inline ReferenceCountedObjectPtr() noexcept
: referencedObject (nullptr)
{
}
/** Creates a pointer to an object.
This will increment the object's reference-count if it is non-null.
*/
inline ReferenceCountedObjectPtr (ReferenceCountedObjectClass* const refCountedObject) noexcept
: referencedObject (refCountedObject)
{
if (refCountedObject != nullptr)
refCountedObject->incReferenceCount();
}
/** Copies another pointer.
This will increment the object's reference-count (if it is non-null).
*/
inline ReferenceCountedObjectPtr (const ReferenceCountedObjectPtr& other) noexcept
: referencedObject (other.referencedObject)
{
if (referencedObject != nullptr)
referencedObject->incReferenceCount();
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
inline ReferenceCountedObjectPtr (ReferenceCountedObjectPtr&& other) noexcept
: referencedObject (other.referencedObject)
{
other.referencedObject = nullptr;
}
#endif
/** Changes this pointer to point at a different object.
The reference count of the old object is decremented, and it might be
deleted if it hits zero. The new object's count is incremented.
*/
ReferenceCountedObjectPtr& operator= (const ReferenceCountedObjectPtr& other)
{
ReferenceCountedObjectClass* const newObject = other.referencedObject;
if (newObject != referencedObject)
{
if (newObject != nullptr)
newObject->incReferenceCount();
ReferenceCountedObjectClass* const oldObject = referencedObject;
referencedObject = newObject;
if (oldObject != nullptr)
oldObject->decReferenceCount();
}
return *this;
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
ReferenceCountedObjectPtr& operator= (ReferenceCountedObjectPtr&& other)
{
std::swap (referencedObject, other.referencedObject);
return *this;
}
#endif
/** Changes this pointer to point at a different object.
The reference count of the old object is decremented, and it might be
deleted if it hits zero. The new object's count is incremented.
*/
ReferenceCountedObjectPtr& operator= (ReferenceCountedObjectClass* const newObject)
{
if (referencedObject != newObject)
{
if (newObject != nullptr)
newObject->incReferenceCount();
ReferenceCountedObjectClass* const oldObject = referencedObject;
referencedObject = newObject;
if (oldObject != nullptr)
oldObject->decReferenceCount();
}
return *this;
}
/** Destructor.
This will decrement the object's reference-count, and may delete it if it
gets to zero.
*/
inline ~ReferenceCountedObjectPtr()
{
if (referencedObject != nullptr)
referencedObject->decReferenceCount();
}
/** Returns the object that this pointer references.
The pointer returned may be zero, of course.
*/
inline operator ReferenceCountedObjectClass*() const noexcept
{
return referencedObject;
}
// the -> operator is called on the referenced object
inline ReferenceCountedObjectClass* operator->() const noexcept
{
return referencedObject;
}
/** Returns the object that this pointer references.
The pointer returned may be zero, of course.
*/
inline ReferenceCountedObjectClass* getObject() const noexcept
{
return referencedObject;
}
private:
//==============================================================================
ReferenceCountedObjectClass* referencedObject;
};
/** Compares two ReferenceCountedObjectPointers. */
template <class ReferenceCountedObjectClass>
bool operator== (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object1, ReferenceCountedObjectClass* const object2) noexcept
{
return object1.getObject() == object2;
}
/** Compares two ReferenceCountedObjectPointers. */
template <class ReferenceCountedObjectClass>
bool operator== (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object1, const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object2) noexcept
{
return object1.getObject() == object2.getObject();
}
/** Compares two ReferenceCountedObjectPointers. */
template <class ReferenceCountedObjectClass>
bool operator== (ReferenceCountedObjectClass* object1, ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object2) noexcept
{
return object1 == object2.getObject();
}
/** Compares two ReferenceCountedObjectPointers. */
template <class ReferenceCountedObjectClass>
bool operator!= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object1, const ReferenceCountedObjectClass* object2) noexcept
{
return object1.getObject() != object2;
}
/** Compares two ReferenceCountedObjectPointers. */
template <class ReferenceCountedObjectClass>
bool operator!= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object1, ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object2) noexcept
{
return object1.getObject() != object2.getObject();
}
/** Compares two ReferenceCountedObjectPointers. */
template <class ReferenceCountedObjectClass>
bool operator!= (ReferenceCountedObjectClass* object1, ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object2) noexcept
{
return object1 != object2.getObject();
}
#endif // __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
|
[
"ow3nskip"
] |
[
[
[
1,
376
]
]
] |
4746ee7dca145aebf2bb976c5d8bc4281369138a
|
279b68f31b11224c18bfe7a0c8b8086f84c6afba
|
/branches/0.0.1-DEV/mime_types.cpp
|
9303b8a4f4ab5aa15dca84aeb93ea25ad0afa8ee
|
[] |
no_license
|
bogus/findik
|
83b7b44b36b42db68c2b536361541ee6175bb791
|
2258b3b3cc58711375fe05221588d5a068da5ea8
|
refs/heads/master
| 2020-12-24T13:36:19.550337 | 2009-08-16T21:46:57 | 2009-08-16T21:46:57 | 32,120,100 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 663 |
cpp
|
#include "mime_types.hpp"
namespace findik {
namespace io {
namespace mime_types {
struct mapping
{
const char* extension;
const char* mime_type;
} mappings[] =
{
{ "gif", "image/gif" },
{ "htm", "text/html" },
{ "html", "text/html" },
{ "jpg", "image/jpeg" },
{ "png", "image/png" },
{ 0, 0 } // Marks end of list.
};
std::string extension_to_type(const std::string& extension)
{
for (mapping* m = mappings; m->extension; ++m)
{
if (m->extension == extension)
{
return m->mime_type;
}
}
return "text/plain";
}
} // namespace mime_types
} // namespace server3
} // namespace http
|
[
"shelta@d40773b4-ada0-11de-b0a2-13e92fe56a31"
] |
[
[
[
1,
36
]
]
] |
4ed780d6b656aa513f36fd6affb7b3013af98b28
|
ad80c85f09a98b1bfc47191c0e99f3d4559b10d4
|
/code/src/gfx/nprimitiveserver_cmds.cc
|
0e8fa2baff5b46a7f194ecbac5c863cd9f40392a
|
[] |
no_license
|
DSPNerd/m-nebula
|
76a4578f5504f6902e054ddd365b42672024de6d
|
52a32902773c10cf1c6bc3dabefd2fd1587d83b3
|
refs/heads/master
| 2021-12-07T18:23:07.272880 | 2009-07-07T09:47:09 | 2009-07-07T09:47:09 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,111 |
cc
|
#define N_IMPLEMENTS nPrimitiveServer
//------------------------------------------------------------------------------
// (C) 2003 Leaf Garland & Vadim Macagon
//
// nPrimitiveServer is licensed under the terms of the Nebula License.
//------------------------------------------------------------------------------
#include "gfx/nprimitiveserver.h"
#include "kernel/npersistserver.h"
//------------------------------------------------------------------------------
/**
@scriptclass
nprimitiveserver
@superclass
nroot
@classinfo
A detailed description of what the class does (written for script programmers!)
*/
void
n_initcmds(nClass* clazz)
{
clazz->BeginCmds();
clazz->EndCmds();
}
//------------------------------------------------------------------------------
/**
@param ps writes the nCmd object contents out to a file.
@return success or failure
*/
bool
nPrimitiveServer::SaveCmds(nPersistServer* ps)
{
if (nRoot::SaveCmds(ps))
{
return true;
}
return false;
}
|
[
"plushe@411252de-2431-11de-b186-ef1da62b6547"
] |
[
[
[
1,
43
]
]
] |
a0292fe1c12a94a22d1a8300718b2794ffd47c89
|
c1bcff0f1321de8a6425723cdfa0b5aa65b5c81f
|
/TransX/tags/3.12/parser.cpp
|
9ade6fa5f664e930584118c63a2e785f5aaffb20
|
[
"MIT"
] |
permissive
|
net-lisias-orbiter/transx
|
560266e7a4ef73ed29d9004e406fd8db28da9a43
|
b9297027718a7499934a9614430aebb47422ce7f
|
refs/heads/master
| 2023-06-27T14:16:10.697238 | 2010-09-05T01:18:54 | 2010-09-05T01:18:54 | 390,398,358 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,477 |
cpp
|
/* Copyright (c) 2007 Duncan Sharpe, Steve Arch
**
** Permission is hereby granted, free of charge, to any person obtaining a copy
** of this software and associated documentation files (the "Software"), to deal
** in the Software without restriction, including without limitation the rights
** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
** copies of the Software, and to permit persons to whom the Software is
** furnished to do so, subject to the following conditions:
**
** The above copyright notice and this permission notice shall be included in
** all copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
** THE SOFTWARE.*/
#define STRICT
#include <windows.h>
#include <stdio.h>
#include <math.h>
#include "parser.h"
void parser::parseline(char *xbuffer)//Parses the line
{
char *tbuffer;
tbuffer=xbuffer;
currmember=0;
totalmembers=0;
bool whitespace=true;//Currently moving through whitespace
bool loop=true;
while (loop) //While not end of line
{
if (*tbuffer!=0)
{
if (whitespace)
{
if (*tbuffer!=' ')
{
memberstart[currmember]=tbuffer;
whitespace=false;
totalmembers++;
}
else
{
tbuffer++;
}
}
else
{
if (*tbuffer!=' ')
{
tbuffer++;
}
else
{
whitespace=true;
memberend[currmember]=tbuffer;
currmember++;
}
}
}
if (*tbuffer==0 && whitespace==false)
{
memberend[currmember]=tbuffer;
currmember++;
}
if (*tbuffer==0 || currmember>9) loop=false;
}
}
bool parser::getlineelement(int element, char **tbuffer, int *length)
{
if (element>totalmembers-1 || element<0)
return false;//Requested element doesn't exist
*tbuffer=memberstart[element];
*length=memberend[element]-memberstart[element];
if (*length>39) return false;
strncpy(parserbuffer,memberstart[element],*length);
parserbuffer[*length]=0;
*tbuffer=parserbuffer;
return true;
}
|
[
"steve@5a6c10e1-6920-0410-8c7b-9669c677a970"
] |
[
[
[
1,
88
]
]
] |
fd282ced6fb425702941f970fc400cd7ee7ab19b
|
942b88e59417352fbbb1a37d266fdb3f0f839d27
|
/src/bitmap.cxx
|
2e431001c903a4e8125daf020e0b0acc89e9e439
|
[
"BSD-2-Clause"
] |
permissive
|
take-cheeze/ARGSS...
|
2c1595d924c24730cc714d017edb375cfdbae9ef
|
2f2830e8cc7e9c4a5f21f7649287cb6a4924573f
|
refs/heads/master
| 2016-09-05T15:27:26.319404 | 2010-12-13T09:07:24 | 2010-12-13T09:07:24 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 28,203 |
cxx
|
//////////////////////////////////////////////////////////////////////////////////
/// ARGSS - Copyright (c) 2009 - 2010, Alejandro Marzini (vgvgf)
/// All rights reserved.
///
/// Redistribution and use in source and binary forms, with or without
/// modification, are permitted provided that the following conditions are met:
/// * Redistributions of source code must retain the above copyright
/// notice, this list of conditions and the following disclaimer.
/// * Redistributions in binary form must reproduce the above copyright
/// notice, this list of conditions and the following disclaimer in the
/// documentation and/or other materials provided with the distribution.
///
/// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY
/// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
/// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
/// DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
/// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
/// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
/// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
/// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
/// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
/// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
/// Headers
////////////////////////////////////////////////////////////
#include <boost/ptr_container/ptr_unordered_map.hpp>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstring>
#include <SOIL.h>
#include <argss/error.hxx>
#include "text.hxx"
#include "bitmap.hxx"
#include "defines.hxx"
#include "hslrgb.hxx"
#include "graphics.hxx"
#include "system.hxx"
#include "filefinder.hxx"
namespace
{
////////////////////////////////////////////////////////////
/// Static Variables
////////////////////////////////////////////////////////////
typedef boost::ptr_unordered_map<VALUE, Bitmap> BitmapTable;
BitmapTable bitmaps_;
} // namespace
////////////////////////////////////////////////////////////
/// Constructors
////////////////////////////////////////////////////////////
Bitmap::Bitmap()
{
int iwidth = 0, iheight = 0;
id = 0;
pixels_.resize(iwidth * iheight, 0);
width_ = (long)iwidth;
height_ = (long)iheight;
glBitmap_ = GL_INVALID_VALUE;
}
Bitmap::Bitmap(int iwidth, int iheight)
{
id = 0;
pixels_.resize(iwidth * iheight, 0);
width_ = (long)iwidth;
height_ = (long)iheight;
glBitmap_ = GL_INVALID_VALUE;
}
Bitmap::Bitmap(VALUE iid, std::string const& filename)
{
std::vector< uint8_t > const& bin = FileFinder::FindImage(filename);
if ( bin.empty() ) {
return;
VALUE enoent = rb_const_get(rb_mErrno, rb_intern("ENOENT"));
rb_raise(enoent, "No such file or directory - %s", filename.c_str());
}
int rwidth, rheight, channels;
unsigned char* load_pixels = SOIL_load_image_from_memory(
reinterpret_cast< unsigned char const* const >( &(bin[0]) ), bin.size(),
&rwidth, &rheight, &channels, SOIL_LOAD_RGBA
);
if (!load_pixels) {
rb_raise(ARGSS::AError::getID(), "couldn't load %s image.\n%s\n", filename.c_str(), SOIL_last_result());
}
pixels_.resize(rwidth * rheight);
std::memcpy(&pixels_[0], load_pixels, rwidth * rheight * sizeof(Uint32));
SOIL_free_image_data(load_pixels);
id = iid;
width_ = (long)rwidth;
height_ = (long)rheight;
glBitmap_ = GL_INVALID_VALUE;
}
Bitmap::Bitmap(VALUE iid, int iwidth, int iheight)
: pixels_(iwidth * iheight, 0)
{
if (iwidth <= 0 && iheight <= 0) {
rb_raise(ARGSS::AError::getID(), "cant't create %dx%d image.\nWidth and height_ must be bigger than 0.\n", iwidth, iheight);
}
id = iid;
width_ = (long)iwidth;
height_ = (long)iheight;
glBitmap_ = GL_INVALID_VALUE;
}
Bitmap::Bitmap(Bitmap const& source, Rect const& srcRect)
: pixels_(srcRect.width * srcRect.height, 0)
{
if (srcRect.width <= 0 && srcRect.height <= 0) {
rb_raise(ARGSS::AError::getID(), "cant't create %dx%d image.\nWidth and height_ must be bigger than 0.\n", srcRect.width, srcRect.height);
}
id = Qnil;
width_ = (long)srcRect.width;
height_ = (long)srcRect.height;
glBitmap_ = GL_INVALID_VALUE;
Copy(0, 0, source, srcRect);
}
Bitmap::Bitmap(Bitmap const& src)
: id(Qnil), glBitmap_(GL_INVALID_VALUE)
, width_(src.width_), height_(src.height_)
, pixels_(src.pixels_)
{
}
////////////////////////////////////////////////////////////
/// Destructor
////////////////////////////////////////////////////////////
Bitmap::~Bitmap()
{
if (glBitmap_ != GL_INVALID_VALUE) {
glDeleteTextures(1, &glBitmap_);
}
}
////////////////////////////////////////////////////////////
/// Class Is Bitmap Disposed?
////////////////////////////////////////////////////////////
bool Bitmap::IsDisposed(VALUE id)
{
return bitmaps_.count(id) == 0;
}
////////////////////////////////////////////////////////////
/// Class New Bitmap
////////////////////////////////////////////////////////////
void Bitmap::New(VALUE id, std::string const& filename)
{
bitmaps_.insert( id, std::auto_ptr<Bitmap>( new Bitmap(id, filename) ) );
}
void Bitmap::New(VALUE id, int width, int height)
{
bitmaps_.insert( id, std::auto_ptr<Bitmap>( new Bitmap(id, width, height) ) );
}
////////////////////////////////////////////////////////////
/// Class get Bitmap
////////////////////////////////////////////////////////////
Bitmap& Bitmap::get(VALUE id)
{
assert( bitmaps_.find(id) != bitmaps_.end() );
return *bitmaps_.find(id)->second;
}
////////////////////////////////////////////////////////////
/// Class Dispose Bitmap
////////////////////////////////////////////////////////////
void Bitmap::Dispose(VALUE id)
{
bitmaps_.erase(id);
}
////////////////////////////////////////////////////////////
/// Class Refresh Bitmaps
////////////////////////////////////////////////////////////
void Bitmap::RefreshBitmaps()
{
for(BitmapTable::iterator it = bitmaps_.begin(); it != bitmaps_.end(); it++) {
it->second->Changed();
}
}
////////////////////////////////////////////////////////////
/// Class Dispose Bitmaps
////////////////////////////////////////////////////////////
void Bitmap::DisposeBitmaps()
{
bitmaps_.clear();
}
////////////////////////////////////////////////////////////
/// Changed
////////////////////////////////////////////////////////////
void Bitmap::Changed()
{
if (glBitmap_ != GL_INVALID_VALUE) {
glEnable(GL_TEXTURE_2D);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glBindTexture(GL_TEXTURE_2D, glBitmap_);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width_, height_, GL_RGBA, GL_UNSIGNED_BYTE, &pixels_[0]);
//glDeleteTextures(1, &glBitmap_);
//glBitmap_ = GL_INVALID_VALUE;
}
}
////////////////////////////////////////////////////////////
/// Refresh
////////////////////////////////////////////////////////////
void Bitmap::Refresh()
{
if (glBitmap_ != GL_INVALID_VALUE) return;
glEnable(GL_TEXTURE_2D);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glGenTextures(1, &glBitmap_);
assert(glBitmap_ != GL_INVALID_VALUE);
glBindTexture(GL_TEXTURE_2D, glBitmap_);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, 4, width_, height_, 0, GL_RGBA, GL_UNSIGNED_BYTE, &pixels_[0]);
}
////////////////////////////////////////////////////////////
/// Bind Bitmap texture
////////////////////////////////////////////////////////////
void Bitmap::BindBitmap()
{
glBindTexture(GL_TEXTURE_2D, glBitmap_);
}
////////////////////////////////////////////////////////////
/// Copy
////////////////////////////////////////////////////////////
void Bitmap::Copy(int x, int y, Bitmap const& srcBitmap, Rect srcRect)
{
if (srcBitmap.getWidth() == 0 || srcBitmap.getHeight() == 0 || width_ == 0 || height_ == 0) return;
if (x >= width_ || y >= height_) return;
if (x < 0) { srcRect.x -= x; x = 0; }
if (y < 0) { srcRect.y -= y; y = 0; }
srcRect.Adjust(srcBitmap.getWidth(), srcBitmap.getHeight());
if (srcRect.IsOutOfBounds(srcBitmap.getWidth(), srcBitmap.getHeight())) return;
int src_width = srcRect.width;
int src_height = srcRect.height;
if (x + src_width > width_) src_width = width_ - x;
if (y + src_height > height_) src_height = height_ - y;
if (src_width <= 0 || src_height <= 0) return;
int src_pitch = sizeof(Uint32) * src_width;
int src_row = srcBitmap.getWidth();
Uint32 const* src_pixels = ((Uint32*)(&srcBitmap.pixels_[0])) + srcRect.x + srcRect.y * srcBitmap.getWidth();
Uint32* dst_pixels = ((Uint32*)(&pixels_[0])) + x + y * width_;
for (int i = 0; i < src_height; ++i) {
std::memcpy(dst_pixels, src_pixels, src_pitch);
src_pixels += src_row;
dst_pixels += width_;
}
Changed();
}
////////////////////////////////////////////////////////////
/// Blit
////////////////////////////////////////////////////////////
void Bitmap::Blit(int x, int y, Bitmap const& srcBitmap, Rect srcRect, int opacity)
{
if (srcBitmap.getWidth() == 0 || srcBitmap.getHeight() == 0 || width_ == 0 || height_ == 0) return;
if (x >= width_ || y >= height_) return;
if (x < 0) { srcRect.x -= x; x = 0; }
if (y < 0) { srcRect.y -= y; y = 0; }
srcRect.Adjust(srcBitmap.getWidth(), srcBitmap.getHeight());
if (srcRect.IsOutOfBounds(srcBitmap.getWidth(), srcBitmap.getHeight())) return;
int src_width = srcRect.width;
int src_height = srcRect.height;
if (x + src_width > width_ ) src_width = width_ - x;
if (y + src_height > height_) src_height = height_ - y;
if (src_width <= 0 || src_height <= 0) return;
int src_row = srcBitmap.getWidth() * 4;
int dst_row = width_ * 4;
Uint8 const* src_pixels = ((Uint8*)(&srcBitmap.pixels_[0])) + (srcRect.x + srcRect.y * srcBitmap.getWidth()) * 4;
Uint8 * dst_pixels = ((Uint8*)(&pixels_[0])) + (x + y * width_) * 4;
if (opacity > 255) opacity = 255;
if (opacity > 0) {
for (int i = 0; i < src_height; ++i) {
for (int j = 0; j < src_width; ++j) {
Uint8 const* src = src_pixels + j * 4;
Uint8 * dst = dst_pixels + j * 4;
Uint8 srca = src[3] * opacity / 255;
dst[0] = (dst[0] * (255 - srca) + src[0] * srca) / 255;
dst[1] = (dst[1] * (255 - srca) + src[1] * srca) / 255;
dst[2] = (dst[2] * (255 - srca) + src[2] * srca) / 255;
dst[3] = dst[3] * (255 - srca) / 255 + srca;
}
src_pixels += src_row;
dst_pixels += dst_row;
}
}
Changed();
}
////////////////////////////////////////////////////////////
/// Stretch blit
////////////////////////////////////////////////////////////
void Bitmap::StretchBlit(Rect const& dstRect, Bitmap const& srcBitmap, Rect srcRect, int opacity)
{
if (srcRect.width == dstRect.width && srcRect.height == dstRect.height) {
Blit(dstRect.x, dstRect.y, srcBitmap, srcRect, opacity);
} else {
srcRect.Adjust(srcBitmap.getWidth(), srcBitmap.getHeight());
if (srcRect.IsOutOfBounds(srcBitmap.getWidth(), srcBitmap.getHeight())) return;
std::auto_ptr< Bitmap > resampled = srcBitmap.Resample(dstRect.width, dstRect.height, srcRect);
Rect rect(0, 0, dstRect.width, dstRect.height);
Blit(dstRect.x, dstRect.y, *resampled, rect, opacity);
}
Changed();
}
////////////////////////////////////////////////////////////
/// Fill rect
////////////////////////////////////////////////////////////
void Bitmap::FillRect(Rect rect, Color const& color)
{
rect.Adjust(getWidth(), getHeight());
if (rect.IsOutOfBounds(getWidth(), getHeight())) return;
// TODO: alpha blending
long dst = rect.x + rect.y * width_;
Uint32 col = color.getUint32();
for (int i = 0; i < rect.height; i++) {
std::fill_n(pixels_.begin() + dst, rect.width, col);
dst += width_;
}
Changed();
}
////////////////////////////////////////////////////////////
/// Clear
////////////////////////////////////////////////////////////
void Bitmap::Clear()
{
std::memset(&pixels_[0], 0x0, width_ * height_ * 4);
Changed();
}
void Bitmap::Clear(Color const& color)
{
std::fill_n(pixels_.begin(), width_ * height_, color.getUint32());
Changed();
}
void Bitmap::ClearRect(Rect rect)
{
if( rect == getRect() ) Clear();
else {
rect.Adjust( getWidth(), getHeight() );
for(int i = 0; i < rect.height; i++) {
std::memset( &pixels_[rect.x + width_ * i], 0x0, sizeof(Uint32) * rect.width );
}
Changed();
}
}
////////////////////////////////////////////////////////////
/// get pixel
////////////////////////////////////////////////////////////
Color Bitmap::getPixel(int x, int y)
{
if (x < 0 || y < 0) return Color(0, 0, 0, 0);
if (x >= getWidth() || y > getHeight()) return Color(0, 0, 0, 0);
return Color::NewUint32(pixels_[(y * width_) + x]);
}
////////////////////////////////////////////////////////////
/// set pixel
////////////////////////////////////////////////////////////
void Bitmap::setPixel(int x, int y, Color const& color)
{
if (x < 0 || y < 0) return;
if (x >= width_ || y > height_) return;
pixels_[(y * width_) + x] = color.getUint32();
Changed();
}
////////////////////////////////////////////////////////////
/// Hue change
////////////////////////////////////////////////////////////
void Bitmap::HueChange(double hue)
{
for(int i = 0; i < height_; i++) {
for(int j = 0; j < width_; j++) {
Color color = Color::NewUint32(pixels_[(i * width_) + j]);
pixels_[(i * width_) + j] = RGBAdjustHSL(color, hue, 0, 1).getUint32();
}
}
Changed();
}
////////////////////////////////////////////////////////////
/// Saturation change
////////////////////////////////////////////////////////////
void Bitmap::SatChange(double saturation)
{
for(int i = 0; i < height_; i++) {
for(int j = 0; j < width_; j++) {
Color color = Color::NewUint32(pixels_[(i * width_) + j]);
pixels_[(i * width_) + j] = RGBAdjustHSL(color, 0, saturation, 1).getUint32();
}
}
Changed();
}
////////////////////////////////////////////////////////////
/// Luminance change
////////////////////////////////////////////////////////////
void Bitmap::LumChange(double luminance)
{
for(int i = 0; i < height_; i++) {
for(int j = 0; j < width_; j++) {
Color color = Color::NewUint32(pixels_[(i * width_) + j]);
pixels_[(i * width_) + j] = RGBAdjustHSL(color, 0, 0, luminance).getUint32();
}
}
Changed();
}
////////////////////////////////////////////////////////////
/// HSL change
////////////////////////////////////////////////////////////
void Bitmap::HSLChange(double h, double s, double l)
{
for(int i = 0; i < height_; i++) {
for(int j = 0; j < width_; j++) {
Color color = Color::NewUint32(pixels_[(i * width_) + j]);
pixels_[(i * width_) + j] = RGBAdjustHSL(color, h, s, l).getUint32();
}
}
Changed();
}
void Bitmap::HSLChange(double h, double s, double l, Rect rect)
{
rect.Adjust(getWidth(), getHeight());
if (rect.IsOutOfBounds(getWidth(), getHeight())) return;
for(int i = rect.y; i < rect.y + rect.height; i++) {
for(int j = rect.x; j < rect.x + rect.width; j++) {
Color color = Color::NewUint32(pixels_[(i * width_) + j]);
pixels_[(i * width_) + j] = RGBAdjustHSL(color, h, s, l).getUint32();
}
}
Changed();
}
////////////////////////////////////////////////////////////
/// Draw text
////////////////////////////////////////////////////////////
void Bitmap::TextDraw(Rect const& rect, std::string const& text, int align)
{
if (text.length() == 0) return;
if (rect.IsOutOfBounds(getWidth(), getHeight())) return;
VALUE font_id = rb_iv_get(id, "@font");
VALUE name_id = rb_iv_get(font_id, "@name");
Color color = Color(rb_iv_get(font_id, "@color"));
int size = NUM2INT(rb_iv_get(font_id, "@size"));
bool bold = ARGSS::NUM2BOOL(rb_iv_get(font_id, "@bold"));
bool italic = ARGSS::NUM2BOOL(rb_iv_get(font_id, "@italic"));
std::auto_ptr< Bitmap > text_bmp = Text::draw(text, StringValueCStr(name_id), color, size, bold, italic, false);
if (text_bmp->getWidth() > rect.width) {
int stretch = (int)(text_bmp->getWidth() * 0.4);
if (rect.width > stretch) stretch = rect.width;
Rect resample_rect(0, 0, text_bmp->getWidth(), text_bmp->getHeight());
text_bmp = text_bmp->Resample(stretch, text_bmp->getHeight(), resample_rect);;
}
Rect srcRect(0, 0, rect.width, rect.height);
int y = rect.y;
if (rect.height > text_bmp->getHeight()) y += ((rect.height - text_bmp->getHeight()) / 2);
int x = rect.x;
if (rect.width > text_bmp->getWidth()) {
if (align == 1) x += (rect.width - text_bmp->getWidth()) / 2;
else if (align == 2) x += rect.width - text_bmp->getWidth();
}
Blit(x, y, *text_bmp, srcRect, (int)color.alpha);
Changed();
}
////////////////////////////////////////////////////////////
/// get text size
////////////////////////////////////////////////////////////
Rect Bitmap::getTextSize(std::string const& text)
{
VALUE font_id = rb_iv_get(id, "@font");
VALUE name_id = rb_iv_get(font_id, "@name");
int size = NUM2INT(rb_iv_get(font_id, "@size"));
return Text::RectSize(text, StringValueCStr(name_id), size);
}
////////////////////////////////////////////////////////////
/// Gradient fill rect
////////////////////////////////////////////////////////////
void Bitmap::GradientFillRect(Rect rect, Color const& color1, Color const& color2, bool vertical)
{
rect.Adjust( getWidth(), getHeight() );
std::vector< Uint32 > srcPix(rect.width);
Color range = ( color1 - color2 );
if(vertical) {
for(int y = 0; y < rect.height; y++) {
std::fill( srcPix.begin(), srcPix.end(), ( color1 + range * y / rect.width ).getUint32() );
std::memcpy( &(pixels_[(rect.y + y) * rect.x]), &(srcPix[0]), sizeof(Uint32) * srcPix.size() );
}
} else { // horizontal
for(int x = 0; x < rect.width ; x++) {
srcPix[x] = ( color1 + range * x / rect.width ).getUint32();
}
for(int y = 0; y < rect.height; y++) {
std::memcpy( &(pixels_[(rect.y + y) * rect.x]), &(srcPix[0]), sizeof(Uint32) * srcPix.size() );
}
}
Changed();
}
////////////////////////////////////////////////////////////
/// Blur
////////////////////////////////////////////////////////////
void Bitmap::Blur(int radius)
{
std::vector<Uint32> const src = this->pixels_;
std::vector<Uint32>& dst = this->pixels_;
int pixNum = ( (radius * 2 + 1) * (radius * 2 + 1) );
// TODO: filtering edges
for (int y = radius; y < (this->getHeight() - radius); y++) {
for (int x = radius; x < (this->getWidth() - radius); x++) {
Color total;
for (int ky = -radius; ky <= radius; ++ky)
for (int kx = -radius; kx <= radius; ++kx)
total += Color::NewUint32( src[ (this->getWidth() * (y + ky)) + (x + kx) ] );
dst[ (this->getWidth() * y) + x ] = (total / pixNum).getUint32();
}
}
/*
std::cout << getPixel(getWidth()/2, getHeight()/2).red << std::endl;
std::cout << getPixel(getWidth()/2, getHeight()/2).green << std::endl;
std::cout << getPixel(getWidth()/2, getHeight()/2).blue << std::endl;
std::cout << getPixel(getWidth()/2, getHeight()/2).alpha << std::endl;
*/
Refresh();
Changed();
assert(glBitmap_ != GL_INVALID_VALUE);
}
////////////////////////////////////////////////////////////
/// Radial Blur
////////////////////////////////////////////////////////////
void Bitmap::RadialBlur(int angle, int division)
{
// TODO
}
////////////////////////////////////////////////////////////
/// Tone change
////////////////////////////////////////////////////////////
void Bitmap::ToneChange(Tone tone)
{
if (tone.red == 0 && tone.green == 0 && tone.blue == 0 && tone.gray == 0) return;
Uint8 *dst_pixels = (Uint8*)&pixels_[0];
if (tone.gray == 0) {
for (int i = 0; i < getHeight(); i++) {
for (int j = 0; j < getWidth(); j++) {
Uint8 *pixel = dst_pixels;
pixel[0] = (Uint8)std::max(std::min( int(pixel[0] + tone.red ), 255), 0);
pixel[1] = (Uint8)std::max(std::min( int(pixel[1] + tone.green), 255), 0);
pixel[2] = (Uint8)std::max(std::min( int(pixel[2] + tone.blue ), 255), 0);
dst_pixels += 4;
}
}
} else {
double factor = (255 - tone.gray) / 255.0;
double gray;
for (int i = 0; i < getHeight(); i++) {
for (int j = 0; j < getWidth(); j++) {
Uint8 *pixel = dst_pixels;
gray = pixel[0] * 0.299 + pixel[1] * 0.587 + pixel[2] * 0.114;
pixel[0] = (Uint8)std::max( std::min( int( ( pixel[0] - gray) * factor + gray + tone.red + 0.5 ), 255 ), 0 );
pixel[1] = (Uint8)std::max( std::min( int( ( pixel[1] - gray) * factor + gray + tone.green + 0.5 ), 255 ), 0 );
pixel[2] = (Uint8)std::max( std::min( int( ( pixel[2] - gray) * factor + gray + tone.blue + 0.5 ), 255 ), 0 );
dst_pixels += 4;
}
}
}
Changed();
}
////////////////////////////////////////////////////////////
/// Opacity change
////////////////////////////////////////////////////////////
void Bitmap::OpacityChange(int opacity, int bush_depth)
{
/*if (opacity >= 255 && bush_depth <= 0) return;
SDL_LockSurface(bitmap);
Uint8 *pixels_ = (Uint8 *)bitmap->pixels_;
int start_bush = std::max(getHeight() - bush_depth, 0);
const int abyte = MaskgetByte(bitmap->format->Amask);
if (opacity < 255) {
for (int i = 0; i < start_bush; i++) {
for (int j = 0; j < getWidth(); j++) {
Uint8 *pixel = pixels_;
pixel[abyte] = pixel[abyte] * opacity / 255;
pixels_ += 4;
}
}
for (int i = start_bush; i< getHeight(); i++) {
for (int j = 0; j < getWidth(); j++) {
Uint8 *pixel = pixels_;
pixel[abyte] = (pixel[abyte] / 2) * opacity / 255;
pixels_ += 4;
}
}
}
else {
pixels_ += start_bush * getWidth() * 4;
for (int i = start_bush; i < getHeight(); i++) {
for (int j = 0; j < getWidth(); j++) {
Uint8 *pixel = pixels_;
pixel[abyte] = pixel[abyte] / 2;
pixels_ += 4;
}
}
}
SDL_UnlockSurface(bitmap);
Changed();*/
}
////////////////////////////////////////////////////////////
/// Flip
////////////////////////////////////////////////////////////
void Bitmap::Flip(bool flipx, bool flipy)
{
/*if (!(flipx || flipy)) return;
SDL_LockSurface(bitmap);
Bitmap* temp_bmp = new Bitmap(getWidth(), getHeight());
SDL_Surface* temp = temp_bmp->bitmap;
SDL_LockSurface(temp);
Uint32* srcpixels = (Uint32*)bitmap->pixels_;
Uint32* dstpixels = (Uint32*)temp->pixels_;
if (flipx && flipy) {
long srcpixel = 0;
long dstpixel = getWidth() + (getHeight() - 1) * getWidth() - 1;
for(int i = 0; i < getHeight(); i++) {
for(int j = 0; j < getWidth(); j++) {
dstpixels[dstpixel] = srcpixels[srcpixel];
srcpixel += 1;
dstpixel -= 1;
}
}
}
else if (flipx) {
long srcpixel = 0;
long dstpixel = getWidth() - 1;
for(int i = 0; i < getHeight(); i++) {
for(int j = 0; j < getWidth(); j++) {
dstpixels[dstpixel] = srcpixels[srcpixel];
srcpixel += 1;
dstpixel -= 1;
}
dstpixel += getWidth() * 2;
}
}
else if (flipy) {
dstpixels += (getHeight() - 1) * getWidth();
for(int i = 0; i < getHeight(); i++) {
std::memcpy(dstpixels, srcpixels, getWidth() * 4);
srcpixels += getWidth();
dstpixels -= getWidth();
}
}
SDL_UnlockSurface(bitmap);
SDL_UnlockSurface(temp);
SDL_FreeSurface(bitmap);
bitmap = temp;
temp_bmp->bitmap = NULL;
delete temp_bmp;
Changed();*/
}
////////////////////////////////////////////////////////////
/// Zoom
////////////////////////////////////////////////////////////
void Bitmap::Zoom(double zoom_x, double zoom_y)
{
/*if (zoom_x == 1.0 && zoom_y == 1.0) return;
SDL_LockSurface(bitmap);
int scalew = (int)(getWidth() * zoom_x);
int scaleh = (int)(getHeight() * zoom_y);
Bitmap* nbitmap = new Bitmap(scalew, scaleh);
SDL_Surface* surface = nbitmap->bitmap;
SDL_LockSurface(surface);
Uint8* srcpixels = (Uint8*)bitmap->pixels_;
Uint8* dstpixels = (Uint8*)surface->pixels_;
int row = getWidth() * 4;
for(int yy = 0; yy < surface->h; yy++) {
int nearest_matchy = (int)(yy / zoom_y) * row;
for(int xx = 0; xx < surface->w; xx++) {
int nearest_match = nearest_matchy + (int)(xx / zoom_x) * 4;
dstpixels[0] = srcpixels[nearest_match];
dstpixels[1] = srcpixels[nearest_match + 1];
dstpixels[2] = srcpixels[nearest_match + 2];
dstpixels[3] = srcpixels[nearest_match + 3];
dstpixels += 4;
}
}
SDL_UnlockSurface(surface);
SDL_FreeSurface(bitmap);
bitmap = surface;
nbitmap->bitmap = NULL;
delete nbitmap;
Changed();*/
}
////////////////////////////////////////////////////////////
/// Resample
////////////////////////////////////////////////////////////
std::auto_ptr< Bitmap > Bitmap::Resample(int scalew, int scaleh, Rect const& srcRect) const
{
double zoom_x = (double)(scalew) / srcRect.width;
double zoom_y = (double)(scaleh) / srcRect.height;
std::auto_ptr< Bitmap > resampled( new Bitmap(scalew, scaleh) );
Uint8 const* src_pixels = reinterpret_cast< Uint8 const* >(&pixels_[0]);
Uint8* dst_pixels = reinterpret_cast< Uint8* >(&resampled->pixels_[0]);
int row = sizeof(Uint32) * width_;
for(int yy = 0; yy < scaleh; yy++) {
int nearest_matchy = (srcRect.y + (int)(yy / zoom_y)) * row;
for(int xx = 0; xx < scalew; xx++) {
int nearest_match = nearest_matchy + (srcRect.x + (int)(xx / zoom_x)) * 4;
dst_pixels[0] = src_pixels[nearest_match];
dst_pixels[1] = src_pixels[nearest_match + 1];
dst_pixels[2] = src_pixels[nearest_match + 2];
dst_pixels[3] = src_pixels[nearest_match + 3];
dst_pixels += 4;
}
}
return resampled;
}
////////////////////////////////////////////////////////////
/// Rotate
////////////////////////////////////////////////////////////
void Bitmap::Rotate(float angle)
{
/*while (angle > 360)
angle -= 360;
while (angle < 360)
angle += 360;
if (angle == 0) return;
SDL_LockSurface(bitmap);
float radians = angle * 3.14159f / 180.0f;
float cosine = (float)cos(radians);
float sine = (float)sin(radians);
float p1x = -getHeight() * sine;
float p1y = getHeight() * cosine;
float p2x = getWidth() * cosine - getHeight() * sine;
float p2y = getHeight() * cosine + getWidth() * sine;
float p3x = getWidth() * cosine;
float p3y = getWidth() * sine;
float std::minx = std::min(0, std::min(p1x, std::min(p2x, p3x)));
float std::miny = std::min(0, std::min(p1y, std::min(p2y, p3y)));
float std::maxx = std::max(p1x, std::max(p2x, p3x));
float std::maxy = std::max(p1y, std::max(p2y, p3y));
int nwidth = (int)ceil(fabs(std::maxx)-std::minx);
int nheight = (int)ceil(fabs(std::maxy)-std::miny);
SDL_Surface* nbitmap = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA, nwidth, nheight, 32, rmask, gmask, bmask, amask);
SDL_LockSurface(nbitmap);
Uint32* srcpixels = (Uint32*)bitmap->pixels_;
Uint32* dstpixels = (Uint32*)nbitmap->pixels_;
for(int i = 0; i < nbitmap->h; i++) {
for(int j = 0; j < nbitmap->w; j++) {
int sx = (int)((j + std::minx) * cosine + (i + std::miny) * sine);
int sy = (int)((i + std::miny) * cosine - (j + std::minx) * sine);
if (sx >= 0 && sx < bitmap->w && sy >= 0 && sy < bitmap->h) {
dstpixels[0] = srcpixels[sy * bitmap->w + sx];
}
else {
dstpixels[0] = 0;
}
dstpixels++;
}
}
SDL_UnlockSurface(nbitmap);
SDL_FreeSurface(bitmap);
bitmap = nbitmap;
Changed();*/
}
|
[
"[email protected]"
] |
[
[
[
1,
887
]
]
] |
d2941ac113ec3e8acb748e631eb1454f99007a24
|
3eae1d8c99d08bca129aceb7c2269bd70e106ff0
|
/trunk/Codes/DeviceCode/Targets/Native/LPC22XX/deviceCode/SPI/LPC22XX__SPI.cpp
|
d487be6d3b89a6c93a9e3607ef3870228f94c960
|
[] |
no_license
|
yuaom/miniclr
|
9bfd263e96b0d418f6f6ba08cfe4c7e2a8854082
|
4d41d3d5fb0feb572f28cf71e0ba02acb9b95dc1
|
refs/heads/master
| 2023-06-07T09:10:33.703929 | 2010-12-27T14:41:18 | 2010-12-27T14:41:18 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 9,948 |
cpp
|
//-----------------------------------------------------------------------------
// Software that is described herein is for illustrative purposes only
// which provides customers with programming information regarding the
// products. This software is supplied "AS IS" without any warranties.
// NXP Semiconductors assumes no responsibility or liability for the
// use of the software, conveys no license or title under any patent,
// copyright, or mask work right to the product. NXP Semiconductors
// reserves the right to make changes in the software without
// notification. NXP Semiconductors also make no representation or
// warranty that such application will be suitable for the specified
// use without further testing or modification.
//-----------------------------------------------------------------------------
#include <tinyhal.h>
#include "..\LPC22XX.h"
//--//
/***************************************************************************/
#if defined(ADS_LINKER_BUG__NOT_ALL_UNUSED_VARIABLES_ARE_REMOVED)
#pragma arm section zidata = "g_LPC22XX_SPI_Driver"
#endif
LPC22XX_SPI_Driver g_LPC22XX_SPI_Driver;
#if defined(ADS_LINKER_BUG__NOT_ALL_UNUSED_VARIABLES_ARE_REMOVED)
#pragma arm section zidata
#endif
//--//
BOOL CPU_SPI_Initialize()
{
return LPC22XX_SPI_Driver::Initialize();
}
void CPU_SPI_Uninitialize()
{
LPC22XX_SPI_Driver::Uninitialize();
}
UINT32 CPU_SPI_PortsCount()
{
return LPC22XX_SPI::c_MAX_SPI;
}
void CPU_SPI_GetPins( UINT32 spi_mod, GPIO_PIN& msk, GPIO_PIN& miso, GPIO_PIN& mosi )
{
LPC22XX_SPI_Driver::GetPins(spi_mod, msk, miso, mosi );
}
BOOL CPU_SPI_nWrite16_nRead16( const SPI_CONFIGURATION& Configuration, UINT16* Write16, INT32 WriteCount, UINT16* Read16, INT32 ReadCount, INT32 ReadStartOffset )
{
return LPC22XX_SPI_Driver::nWrite16_nRead16( Configuration, Write16, WriteCount, Read16, ReadCount, ReadStartOffset );
}
BOOL CPU_SPI_nWrite8_nRead8( const SPI_CONFIGURATION& Configuration, UINT8* Write8, INT32 WriteCount, UINT8* Read8, INT32 ReadCount, INT32 ReadStartOffset )
{
return LPC22XX_SPI_Driver::nWrite8_nRead8( Configuration, Write8, WriteCount, Read8, ReadCount, ReadStartOffset );
}
BOOL CPU_SPI_Xaction_Start( const SPI_CONFIGURATION& Configuration )
{
return LPC22XX_SPI_Driver::Xaction_Start( Configuration );
}
BOOL CPU_SPI_Xaction_Stop( const SPI_CONFIGURATION& Configuration )
{
return LPC22XX_SPI_Driver::Xaction_Stop( Configuration );
}
BOOL CPU_SPI_Xaction_nWrite16_nRead16( SPI_XACTION_16& Transaction )
{
return LPC22XX_SPI_Driver::Xaction_nWrite16_nRead16( Transaction );
}
BOOL CPU_SPI_Xaction_nWrite8_nRead8( SPI_XACTION_8& Transaction )
{
return LPC22XX_SPI_Driver::Xaction_nWrite8_nRead8( Transaction );
}
//--//
//---------------------------//
BOOL LPC22XX_SPI_Driver::Initialize()
{
// allow peripheral control of pins
CPU_GPIO_DisablePin( LPC22XX_SPI::c_SPI0_SCLK, RESISTOR_DISABLED, 0, GPIO_ALT_MODE_1);
CPU_GPIO_DisablePin( LPC22XX_SPI::c_SPI0_MOSI, RESISTOR_DISABLED, 0, GPIO_ALT_MODE_1);
CPU_GPIO_DisablePin( LPC22XX_SPI::c_SPI0_MISO, RESISTOR_DISABLED, 0, GPIO_ALT_MODE_1);
CPU_GPIO_DisablePin( LPC22XX_SPI::c_SPI0_SSEL, RESISTOR_DISABLED, 0, GPIO_ALT_MODE_1);
CPU_GPIO_DisablePin(LPC22XX_SPI::c_SPI1_SCLK, RESISTOR_DISABLED, 0, GPIO_ALT_MODE_2);
CPU_GPIO_DisablePin(LPC22XX_SPI::c_SPI1_MOSI, RESISTOR_DISABLED, 0, GPIO_ALT_MODE_2);
CPU_GPIO_DisablePin(LPC22XX_SPI::c_SPI1_MISO, RESISTOR_DISABLED, 0, GPIO_ALT_MODE_2);
CPU_GPIO_DisablePin(LPC22XX_SPI::c_SPI1_SSEL, RESISTOR_DISABLED, 0, GPIO_ALT_MODE_2);
return TRUE;
}
void LPC22XX_SPI_Driver::Uninitialize()
{
}
void LPC22XX_SPI_Driver::GetPins( UINT32 spi_mod, GPIO_PIN& msk, GPIO_PIN& miso, GPIO_PIN& mosi )
{
switch (spi_mod)
{
case (LPC22XX_SPI::c_SPI0):
msk = LPC22XX_SPI::c_SPI0_SCLK;
miso = LPC22XX_SPI::c_SPI0_MISO;
mosi = LPC22XX_SPI::c_SPI0_MOSI;
break;
case (LPC22XX_SPI::c_SPI1):
msk = LPC22XX_SPI::c_SPI1_SCLK;
miso = LPC22XX_SPI::c_SPI1_MISO;
mosi = LPC22XX_SPI::c_SPI1_MOSI;
break;
default:
break;
}
}
/***************************************************************************/
void LPC22XX_SPI_Driver::ISR( void* Param )
{
ASSERT(0);
}
BOOL LPC22XX_SPI_Driver::nWrite16_nRead16( const SPI_CONFIGURATION& Configuration, UINT16* Write16, INT32 WriteCount, UINT16* Read16, INT32 ReadCount, INT32 ReadStartOffset )
{
lcd_printf("\fSPI Peripheral does not support 16 bit transfer\r\n");
hal_printf("\fSPI Peripheral does not support 16 bit transfer\r\n");
HARD_BREAKPOINT();
return FALSE;
}
BOOL LPC22XX_SPI_Driver::nWrite8_nRead8( const SPI_CONFIGURATION& Configuration, UINT8* Write8, INT32 WriteCount, UINT8* Read8, INT32 ReadCount, INT32 ReadStartOffset )
{
if(g_LPC22XX_SPI_Driver.m_Enabled[Configuration.SPI_mod])
{
lcd_printf("\fSPI Xaction 1\r\n");
HARD_BREAKPOINT();
return FALSE;
}
if(Configuration.SPI_mod > LPC22XX_SPI::c_MAX_SPI)
{
lcd_printf("\fSPI wrong mod\r\n");
HARD_BREAKPOINT();
return FALSE;
}
if (!Xaction_Start( Configuration )) return FALSE;
{
SPI_XACTION_8 Transaction;
Transaction.Read8 = Read8;
Transaction.ReadCount = ReadCount;
Transaction.ReadStartOffset = ReadStartOffset;
Transaction.Write8 = Write8;
Transaction.WriteCount = WriteCount;
Transaction.SPI_mod = Configuration.SPI_mod;
Transaction.BusyPin.Pin = GPIO_PIN_NONE;
if(!Xaction_nWrite8_nRead8( Transaction )) return FALSE;
}
return Xaction_Stop( Configuration );
}
//--//
BOOL LPC22XX_SPI_Driver::Xaction_Start( const SPI_CONFIGURATION& Configuration )
{
if(!g_LPC22XX_SPI_Driver.m_Enabled[Configuration.SPI_mod])
{
g_LPC22XX_SPI_Driver.m_Enabled[Configuration.SPI_mod] = TRUE;
UINT32 index = Configuration.SPI_mod;
LPC22XX_SPI & SPI = LPC22XX::SPI(index);
// first build the mode register
SPI.SPCR = LPC22XX_SPI::ConfigurationToMode( Configuration );
// Set SPI Clock
SPI.SPCCR = LPC22XX_SPI::c_SPI_Clk_KHz / (Configuration.Clock_RateKHz);
// first set CS active as soon as clock and data pins are in proper initial state
if(Configuration.DeviceCS != LPC22XX_GPIO::c_Pin_None)
{
CPU_GPIO_EnableOutputPin( Configuration.DeviceCS, Configuration.CS_Active );
}
if(Configuration.CS_Setup_uSecs)
{
HAL_Time_Sleep_MicroSeconds_InterruptEnabled( Configuration.CS_Setup_uSecs );
}
}
else
{
lcd_printf( "\fSPI Collision 3\r\n" );
HARD_BREAKPOINT();
return FALSE;
}
return TRUE;
}
BOOL LPC22XX_SPI_Driver::Xaction_Stop( const SPI_CONFIGURATION& Configuration )
{
if(g_LPC22XX_SPI_Driver.m_Enabled[Configuration.SPI_mod])
{
if(Configuration.CS_Hold_uSecs)
{
HAL_Time_Sleep_MicroSeconds_InterruptEnabled( Configuration.CS_Hold_uSecs );
}
// next, bring the CS to the proper inactive state
if(Configuration.DeviceCS != LPC22XX_GPIO::c_Pin_None)
{
CPU_GPIO_SetPinState( Configuration.DeviceCS, !Configuration.CS_Active );
}
g_LPC22XX_SPI_Driver.m_Enabled[Configuration.SPI_mod] = FALSE;
}
else
{
lcd_printf("\fSPI Collision 4\r\n");
HARD_BREAKPOINT();
return FALSE;
}
return TRUE;
}
BOOL LPC22XX_SPI_Driver::Xaction_nWrite16_nRead16( SPI_XACTION_16& Transaction )
{
lcd_printf("\fSPI Peripheral does not support 16 bit transfer\r\n");
hal_printf("\fSPI Peripheral does not support 16 bit transfer\r\n");
HARD_BREAKPOINT();
return FALSE;
}
BOOL LPC22XX_SPI_Driver::Xaction_nWrite8_nRead8( SPI_XACTION_8& Transaction )
{
INT32 i;
INT32 d;
INT32 loop;
UINT8 Data8;
if(!g_LPC22XX_SPI_Driver.m_Enabled[Transaction.SPI_mod])
{
lcd_printf("\fSPI Xaction OFF\r\n");
HARD_BREAKPOINT();
return FALSE;
}
LPC22XX_SPI& SPI = LPC22XX::SPI(Transaction.SPI_mod);
UINT8* Write8 = Transaction.Write8;
INT32 WriteCount = Transaction.WriteCount;
UINT8* Read8 = Transaction.Read8;
INT32 ReadCount = Transaction.ReadCount;
INT32 ReadStartOffset = Transaction.ReadStartOffset;
ASSERT(WriteCount > 0);
ASSERT(Write8);
ASSERT(ReadCount == 0 || Read8);
if(ReadCount)
{
i = ReadCount + ReadStartOffset;
d = ReadStartOffset;
}
else
{
i = WriteCount;
d = -1;
}
for( loop = 0; loop < i; loop++ )
{
// Write Transmit Data
SPI.SPDR = Write8[0];
// repeat last write word for all subsequent reads
if(WriteCount)
{
WriteCount--;
Write8++;
}
// wait while the Transmission is in progress
// No error checking as there is no mechanism to report errors
while((SPI.SPSR & LPC22XX_SPI::SPIF_Mask) == 0x0)
{
}
// Read recieved data
Data8 = SPI.SPDR;
// Throw away read data until ReadStartOffset is reached
if(loop >= d)
{
Read8[0] = Data8;
Read8++;
}
}
return TRUE;
}
|
[
"[email protected]"
] |
[
[
[
1,
332
]
]
] |
792ce984458bb0aac8ab6e075b0090dd2900609a
|
ab41c2c63e554350ca5b93e41d7321ca127d8d3a
|
/glm/gtx/half_float.inl
|
2ca386e94af6fadeb785a057b1999bfeb0657008
|
[] |
no_license
|
burner/e3rt
|
2dc3bac2b7face3b1606ee1430e7ecfd4523bf2e
|
775470cc9b912a8c1199dd1069d7e7d4fc997a52
|
refs/heads/master
| 2021-01-11T08:08:00.665300 | 2010-04-26T11:42:42 | 2010-04-26T11:42:42 | 337,021 | 3 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 595 |
inl
|
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2005-12-21
// Updated : 2008-10-02
// Licence : This source is under MIT License
// File : glm/gtx/half.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace detail{
}//namespace detail
}//namespace glm
|
[
"[email protected]"
] |
[
[
[
1,
16
]
]
] |
d6d881faf4b08df895154abfc2de3ddc0a3bd700
|
d8f64a24453c6f077426ea58aaa7313aafafc75c
|
/utils.h
|
780ff6d1e979ee9b6e703faaab89aa7bf2e32d22
|
[] |
no_license
|
dotted/wfto
|
5b98591645f3ddd72cad33736da5def09484a339
|
6eebb66384e6eb519401bdd649ae986d94bcaf27
|
refs/heads/master
| 2021-01-20T06:25:20.468978 | 2010-11-04T21:01:51 | 2010-11-04T21:01:51 | 32,183,921 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 27,712 |
h
|
#ifndef UTILS_H
#define UTILS_H
#include <cml/cml.h>
#include "triangle.h"
using namespace std;
using namespace geometry;
namespace utils
{
#define SAFE_DELETE(x) if (x) { delete x; x=NULL;}
#define SAFE_DELETE_ARRAY(x) if (x) { delete [] x; x=NULL;}
#define SAFE_DELETE_ARRAY_ELEMENTS(x2d,w) if (x2d) {for (int x=0; x<(GLint)w; x++) { SAFE_DELETE(x2d[x]); }}
#define SAFE_DELETE_2D_ARRAY(x2d,h) if (x2d) {for (int i=0; i<h; i++){SAFE_DELETE_ARRAY(x2d[i])} SAFE_DELETE_ARRAY(x2d)}
#define SAFE_DELETE_2D_ARRAY_ELEMENTS(x2d,w,h) for (int y=0; y<h; y++) { for (int x=0; x<w; x++) { SAFE_DELETE(x2d[y][x]); } }
#define SAFE_DELETE_3D_ARRAY(x3d,d,h) if (x3d) {for (int _i=0; _i<d; _i++){SAFE_DELETE_2D_ARRAY(x3d[_i],h)} SAFE_DELETE_ARRAY(x3d)}
#define NULL_POINTER_ARRAY(x2d,w) ZeroMemory(x2d,sizeof(void*)*w);
#define NULL_VEC vector3f(0.0f,0.0f,0.0f)
#define PI 3.14159265f
#define TWOPI 2.0f*PI
#define UPDA(angle,amount) {angle+=amount; if (angle>360.0f) angle=0; else if (angle<0.0f) angle=359.0f;}
#define EPSILON 1e-6f
struct sColor
{
GLubyte r,b,g;
sColor(GLubyte r, GLubyte g, GLubyte b)
{
this->r = r;
this->g = g;
this->b = b;
}
cml::vector3ub getNextColorUB()
{
b++;
if(b>=255)
{
g++;
b=0;
if (g>=255)
{
r++;
g=0;
if (r>=255)
{
r=0;
}
}
}
return cml::vector3ub(r,g,b);
}
};
struct sGeneralUtils
{
static std::string getCurrentDirectory()
{
char path[MAX_PATH];
GetCurrentDirectory(MAX_PATH,path);
return std::string(path);
}
};
struct sStringUtils
{
static std::string trim(std::string str)
{
while (str[0]==' ' || str[0]=='\t')
{
str=str.substr(1);
}
while (str[str.length()-1]==' ' || str[str.length()-1]=='\t')
{
str=str.substr(0,str.length()-1);
}
return str;
};
static GLvoid tokenizeString(std::vector<string> &container, std::string const &in, const char * const delimiters = " \t\n")
{
const string::size_type len = in.length();
string::size_type i = 0;
while ( i < len )
{
// eat leading whitespace
i = in.find_first_not_of (delimiters, i);
if (i == string::npos)
return; // nothing left but white space
// find the end of the token
string::size_type j = in.find_first_of (delimiters, i);
// push token
if (j == string::npos) {
container.push_back (in.substr(i));
return;
} else
container.push_back (in.substr(i, j-i));
// set up for next loop
i = j + 1;
}
}
};
struct sGeometryUtils
{
static GLfloat N(GLint i, GLint k, GLfloat u, GLfloat *U)
{
if (k==0)
{
if (u>=U[i] && u<U[i+1])
{
return 1.0f;
}
else
{
return 0.0f;
}
}
else
{
GLfloat a0=u-U[i];
GLfloat b0=U[i+k]-U[i];
GLfloat p0=0.0f;
if (b0==0.0f)
{
p0=0.0f;
}
else
{
p0=a0/b0*N(i,k-1,u,U);
}
GLfloat a1=U[i+k+1]-u;
GLfloat b1=U[i+k+1]-U[i+1];
GLfloat p1=0.0f;
if (b1==0.0f)
{
p1=0.0f;
}
else
{
p1=a1/b1*N(i+1,k-1,u,U);
}
return p0+p1;
}
}
static GLfloat *calcU(GLint k, GLint numPoints)
{
GLint pos=0;
GLint lengthA=(k+1);
GLint lengthB=(k+1);
GLint lengthBetween=(numPoints-1-k);
if (lengthBetween<0)
{
return NULL;
}
GLfloat inc=1.0f/(GLfloat)(lengthBetween+1);
GLfloat *U = new GLfloat[lengthA+lengthBetween+lengthB];
for (GLint i=0; i<lengthA; i++)
{
U[pos++]=0.0f;
}
GLfloat s=inc;
for (GLint i=0; i<lengthBetween; i++)
{
U[pos++]=s;
s+=inc;
}
for (GLint i=0; i<lengthB; i++)
{
U[pos++]=1.0f;
}
return U;
}
static std::vector<cml::vector3f> generateBSplines(std::vector<cml::vector3f> &inPoints, GLint resolution, GLint degree = 3)
{
GLfloat *U = calcU(degree,inPoints.size());
std::vector<cml::vector3f> returnPoints;
for (GLint r=0; r<resolution; r++)
{
cml::vector3f p_s(0.0f,0.0f,0.0f);
GLfloat p_i=0.0f;
for (std::vector<cml::vector3f>::iterator iter = inPoints.begin(); iter != inPoints.end(); iter++)
{
GLfloat n=N(distance(inPoints.begin(),iter),degree,(GLfloat)r/(GLfloat)resolution,U);
p_s+=(*iter)*n;
p_i+=n;
}
returnPoints.push_back(p_s/p_i);
}
SAFE_DELETE_ARRAY(U);
return returnPoints;
}
static bool closeEnough(GLfloat f1, GLfloat f2)
{
return fabsf((f1 - f2) / ((f2 == 0.0f) ? 1.0f : f2)) < EPSILON;
}
static GLvoid calcTangentVector( cml::vector3f &pos1, cml::vector3f &pos2, cml::vector3f &pos3,
cml::vector2f &texCoord1, cml::vector2f &texCoord2, cml::vector2f &texCoord3,
cml::vector3f &tangent)
{
cml::vector3f edge1(pos2[0] - pos1[0], pos2[1] - pos1[1], pos2[2] - pos1[2]);
cml::vector3f edge2(pos3[0] - pos1[0], pos3[1] - pos1[1], pos3[2] - pos1[2]);
edge1.normalize();
edge2.normalize();
cml::vector2f texEdge1(texCoord2[0] - texCoord1[0], texCoord2[1] - texCoord1[1]);
cml::vector2f texEdge2(texCoord3[0] - texCoord1[0], texCoord3[1] - texCoord1[1]);
texEdge1.normalize();
texEdge2.normalize();
GLfloat det = (texEdge1[0] * texEdge2[1]) - (texEdge1[1] * texEdge2[0]);
if (closeEnough(det, 0.0f))
{
tangent.set(1.0f, 0.0f, 0.0f);
}
else
{
det = 1.0f / det;
tangent[0] = (texEdge2[1] * edge1[0] - texEdge1[1] * edge2[0]) * det;
tangent[1] = (texEdge2[1] * edge1[1] - texEdge1[1] * edge2[1]) * det;
tangent[2] = (texEdge2[1] * edge1[2] - texEdge1[1] * edge2[2]) * det;
tangent.normalize();
}
}
inline static GLfloat squareDistance(cml::vector3f &v0, cml::vector3f &v1)
{
return powf(v0[0]-v1[0],2.0f)+powf(v0[1]-v1[1],2.0f)+powf(v0[2]-v1[2],2.0f);
}
static GLfloat angleBetweenVectors2D(cml::vector3f &v1, cml::vector3f &v2)
{
v1.normalize();
v2.normalize();
GLfloat cs = acos(dot(v1,v2));
cml::vector3f c = cross(v1,v2);
return ((c[2]>0.0f && c[2]<=1.0f)?360.0f-rad2deg(cs):rad2deg(cs));
}
static GLfloat rad2deg(GLfloat rad)
{
return (180.0f*rad)/PI;
}
static GLfloat deg2rad(GLfloat deg)
{
return (PI*deg)/180.0f;
}
static bool sameSide(cml::vector3f &p1, cml::vector3f &p2, cml::vector3f &a, cml::vector3f &b)
{
cml::vector3f cp1 = cml::cross(b-a, p1-a);
cml::vector3f cp2 = cml::cross(b-a, p2-a);
if (cml::dot(cp1, cp2) >= 0.0f)
{
return true;
}
else
{
return false;
}
}
static bool pointTest(cml::vector3f &p, cml::vector3f a, cml::vector3f b, cml::vector3f c)
{
if (sameSide(p,a, b,c) && sameSide(p,b, a,c) && sameSide(p,c, a,b))
{
return true;
}
else
{
return false;
}
}
/*
Calculates the distance from a plane defined by a normal (planeN) and a point (planeP)
to a given point in space (P).
*/
static float pointPlaneDistance(cml::vector3f planeN, cml::vector3f planeP, cml::vector3f P)
{
float planeD = -planeP[0]*planeN[0]-planeP[1]*planeN[1]-planeP[2]*planeN[2];
return P[0]*planeN[0]+P[1]*planeN[1]+P[2]*planeN[2]+planeD;
}
static bool pointInTriangle(cml::vector3f &pnt, sTriangle *tri, GLfloat eps)
{
GLfloat D = pnt[0]*tri->N[0] +
pnt[1]*tri->N[1] +
pnt[2]*tri->N[2] + tri->calculateD(tri->N);
if (fabs(D)<eps)
{
bool in = pointTest(pnt,tri->A,tri->B,tri->C);
if (in)
{
cml::vector3f NN = tri->Na;
NN.normalize();
tri->projectedPoint=(pnt - NN*D);
}
return in;
}
return false;
}
static bool pointInTriangle2D(cml::vector3f &pnt, sTriangle &tri)
{
return pointTest(pnt,tri.A,tri.B,tri.C);
}
#define FABS(x) ((float)fabs(x)) /* implement as is fastest on your machine */
/* if USE_EPSILON_TEST is true then we do a check:
if |dv|<EPSILON then dv=0.0;
else no check is done (which is less robust)
*/
#define USE_EPSILON_TEST TRUE
/* some macros */
#define CROSS(dest,v1,v2) \
dest[0]=v1[1]*v2[2]-v1[2]*v2[1]; \
dest[1]=v1[2]*v2[0]-v1[0]*v2[2]; \
dest[2]=v1[0]*v2[1]-v1[1]*v2[0];
#define DOT(v1,v2) (v1[0]*v2[0]+v1[1]*v2[1]+v1[2]*v2[2])
#define SUB(dest,v1,v2) dest[0]=v1[0]-v2[0]; dest[1]=v1[1]-v2[1]; dest[2]=v1[2]-v2[2];
#define ADD(dest,v1,v2) dest[0]=v1[0]+v2[0]; dest[1]=v1[1]+v2[1]; dest[2]=v1[2]+v2[2];
#define MULT(dest,v,factor) dest[0]=factor*v[0]; dest[1]=factor*v[1]; dest[2]=factor*v[2];
#define SET(dest,src) dest[0]=src[0]; dest[1]=src[1]; dest[2]=src[2];
/* sort so that a<=b */
#define SORT(a,b) \
if(a>b) \
{ \
float c; \
c=a; \
a=b; \
b=c; \
}
#define ISECT(VV0,VV1,VV2,D0,D1,D2,isect0,isect1) \
isect0=VV0+(VV1-VV0)*D0/(D0-D1); \
isect1=VV0+(VV2-VV0)*D0/(D0-D2);
#define COMPUTE_INTERVALS(VV0,VV1,VV2,D0,D1,D2,D0D1,D0D2,isect0,isect1) \
if(D0D1>0.0f) \
{ \
/* here we know that D0D2<=0.0 */ \
/* that is D0, D1 are on the same side, D2 on the other or on the plane */ \
ISECT(VV2,VV0,VV1,D2,D0,D1,isect0,isect1); \
} \
else if(D0D2>0.0f) \
{ \
/* here we know that d0d1<=0.0 */ \
ISECT(VV1,VV0,VV2,D1,D0,D2,isect0,isect1); \
} \
else if(D1*D2>0.0f || D0!=0.0f) \
{ \
/* here we know that d0d1<=0.0 or that D0!=0.0 */ \
ISECT(VV0,VV1,VV2,D0,D1,D2,isect0,isect1); \
} \
else if(D1!=0.0f) \
{ \
ISECT(VV1,VV0,VV2,D1,D0,D2,isect0,isect1); \
} \
else if(D2!=0.0f) \
{ \
ISECT(VV2,VV0,VV1,D2,D0,D1,isect0,isect1); \
} \
else \
{ \
/* triangles are coplanar */ \
return coplanarTriTri(N1,V0,V1,V2,U0,U1,U2); \
}
/* this edge to edge test is based on Franlin Antonio's gem:
"Faster Line Segment Intersection", in Graphics Gems III,
pp. 199-202 */
#define EDGE_EDGE_TEST(V0,U0,U1) \
Bx=U0[i0]-U1[i0]; \
By=U0[i1]-U1[i1]; \
Cx=V0[i0]-U0[i0]; \
Cy=V0[i1]-U0[i1]; \
f=Ay*Bx-Ax*By; \
d=By*Cx-Bx*Cy; \
if((f>0 && d>=0 && d<=f) || (f<0 && d<=0 && d>=f)) \
{ \
e=Ax*Cy-Ay*Cx; \
if(f>0) \
{ \
if(e>=0 && e<=f) return 1; \
} \
else \
{ \
if(e<=0 && e>=f) return 1; \
} \
}
#define EDGE_AGAINST_TRI_EDGES(V0,V1,U0,U1,U2) \
{ \
float Ax,Ay,Bx,By,Cx,Cy,e,d,f; \
Ax=V1[i0]-V0[i0]; \
Ay=V1[i1]-V0[i1]; \
/* test edge U0,U1 against V0,V1 */ \
EDGE_EDGE_TEST(V0,U0,U1); \
/* test edge U1,U2 against V0,V1 */ \
EDGE_EDGE_TEST(V0,U1,U2); \
/* test edge U2,U1 against V0,V1 */ \
EDGE_EDGE_TEST(V0,U2,U0); \
}
#define POINT_IN_TRI(V0,U0,U1,U2) \
{ \
float a,b,c,d0,d1,d2; \
/* is T1 completly inside T2? */ \
/* check if V0 is inside tri(U0,U1,U2) */ \
a=U1[i1]-U0[i1]; \
b=-(U1[i0]-U0[i0]); \
c=-a*U0[i0]-b*U0[i1]; \
d0=a*V0[i0]+b*V0[i1]+c; \
\
a=U2[i1]-U1[i1]; \
b=-(U2[i0]-U1[i0]); \
c=-a*U1[i0]-b*U1[i1]; \
d1=a*V0[i0]+b*V0[i1]+c; \
\
a=U0[i1]-U2[i1]; \
b=-(U0[i0]-U2[i0]); \
c=-a*U2[i0]-b*U2[i1]; \
d2=a*V0[i0]+b*V0[i1]+c; \
if(d0*d1>0.0) \
{ \
if(d0*d2>0.0) return 1; \
} \
}
static int coplanarTriTri(float N[3],float V0[3],float V1[3],float V2[3],
float U0[3],float U1[3],float U2[3])
{
float A[3];
short i0,i1;
/* first project onto an axis-aligned plane, that maximizes the area */
/* of the triangles, compute indices: i0,i1. */
A[0]=fabs(N[0]);
A[1]=fabs(N[1]);
A[2]=fabs(N[2]);
if(A[0]>A[1])
{
if(A[0]>A[2])
{
i0=1; /* A[0] is greatest */
i1=2;
}
else
{
i0=0; /* A[2] is greatest */
i1=1;
}
}
else /* A[0]<=A[1] */
{
if(A[2]>A[1])
{
i0=0; /* A[2] is greatest */
i1=1;
}
else
{
i0=0; /* A[1] is greatest */
i1=2;
}
}
/* test all edges of sTriangle 1 against the edges of sTriangle 2 */
EDGE_AGAINST_TRI_EDGES(V0,V1,U0,U1,U2);
EDGE_AGAINST_TRI_EDGES(V1,V2,U0,U1,U2);
EDGE_AGAINST_TRI_EDGES(V2,V0,U0,U1,U2);
/* finally, test if tri1 is totally contained in tri2 or vice versa */
POINT_IN_TRI(V0,U0,U1,U2);
POINT_IN_TRI(U0,V0,V1,V2);
return 0;
}
static int triTriIntersect(float V0[3],float V1[3],float V2[3],
float U0[3],float U1[3],float U2[3])
{
float E1[3],E2[3];
float N1[3],N2[3],d1,d2;
float du0,du1,du2,dv0,dv1,dv2;
float D[3];
float isect1[2], isect2[2];
float du0du1,du0du2,dv0dv1,dv0dv2;
short index;
float vp0,vp1,vp2;
float up0,up1,up2;
float b,c,max;
/* compute plane equation of sTriangle(V0,V1,V2) */
SUB(E1,V1,V0);
SUB(E2,V2,V0);
CROSS(N1,E1,E2);
d1=-DOT(N1,V0);
/* plane equation 1: N1.X+d1=0 */
/* put U0,U1,U2 into plane equation 1 to compute signed distances to the plane*/
du0=DOT(N1,U0)+d1;
du1=DOT(N1,U1)+d1;
du2=DOT(N1,U2)+d1;
/* coplanarity robustness check */
#if USE_EPSILON_TEST==TRUE
if(fabs(du0)<EPSILON) du0=0.0;
if(fabs(du1)<EPSILON) du1=0.0;
if(fabs(du2)<EPSILON) du2=0.0;
#endif
du0du1=du0*du1;
du0du2=du0*du2;
if(du0du1>0.0f && du0du2>0.0f) /* same sign on all of them + not equal 0 ? */
return 0; /* no intersection occurs */
/* compute plane of sTriangle (U0,U1,U2) */
SUB(E1,U1,U0);
SUB(E2,U2,U0);
CROSS(N2,E1,E2);
d2=-DOT(N2,U0);
/* plane equation 2: N2.X+d2=0 */
/* put V0,V1,V2 into plane equation 2 */
dv0=DOT(N2,V0)+d2;
dv1=DOT(N2,V1)+d2;
dv2=DOT(N2,V2)+d2;
#if USE_EPSILON_TEST==TRUE
if(fabs(dv0)<EPSILON) dv0=0.0;
if(fabs(dv1)<EPSILON) dv1=0.0;
if(fabs(dv2)<EPSILON) dv2=0.0;
#endif
dv0dv1=dv0*dv1;
dv0dv2=dv0*dv2;
if(dv0dv1>0.0f && dv0dv2>0.0f) /* same sign on all of them + not equal 0 ? */
return 0; /* no intersection occurs */
/* compute direction of intersection line */
CROSS(D,N1,N2);
/* compute and index to the largest component of D */
max=fabs(D[0]);
index=0;
b=fabs(D[1]);
c=fabs(D[2]);
if(b>max) max=b,index=1;
if(c>max) max=c,index=2;
/* this is the simplified projection onto L*/
vp0=*V0;
vp1=*V1;
vp2=*V2;
up0=*U0;
up1=*U1;
up2=*U2;
/* compute interval for sTriangle 1 */
COMPUTE_INTERVALS(vp0,vp1,vp2,dv0,dv1,dv2,dv0dv1,dv0dv2,isect1[0],isect1[1]);
/* compute interval for sTriangle 2 */
COMPUTE_INTERVALS(up0,up1,up2,du0,du1,du2,du0du1,du0du2,isect2[0],isect2[1]);
SORT(isect1[0],isect1[1]);
SORT(isect2[0],isect2[1]);
if(isect1[1]<isect2[0] || isect2[1]<isect1[0]) return 0;
return 1;
}
/*
*
* Three-dimensional Ray-Triangle Overlap Test.
* The function returns 1 if the ray defined by its
* origin point 'orig' and a direction vector 'dir'
* intersects the sTriangle having vertices 'a', 'b' and 'c'.
* If an intersection exists, the triplet (t,u,v), such that
* orig + t. dir = (1 - u - v)a + u.b + v.c
* is returned.
*
*/
static int rayTriangleIntersection(float orig[3], float dir[3], float a[3], float b[3], float c[3], float *t, float *u, float *v)
{
float vect0[3], vect1[3], nvect[3];
float normal[3];
float det, inv_det;
SUB(vect0, b,a)
SUB(vect1, c,a)
CROSS(normal, vect0, vect1);
/* orientation of the ray with respect to the sTriangle's normal,
also used to calculate output parameters*/
det = - DOT(dir,normal);
#ifdef TEST_CULL /* define TEST_CULL if culling is desired */
if (det < EPSILON) return 0;
/* calculate vector from ray origin to a */
SUB(vect0,a,orig);
/* vector used to calculate u and v parameters */
CROSS(nvect,dir,vect0);
/* calculate vector from ray origin to b*/
SUB(vect1,b,orig);
/* calculate unnormalized v parameter and test bounds */
*v = - DOT(vect1,nvect);
if (*v < 0.0 || *v > det) return 0;
/* calculate vector from ray origin to c*/
SUB(vect1,c,orig);
/* calculate unnormalized v parameter and test bounds */
*u = DOT(vect1,nvect);
if (*u < 0.0 || *u + *v > det) return 0;
/* calculate unormalized t parameter */
*t = - DOT(vect0,normal);
inv_det = 1.0 / det;
/* calculate u v t, ray intersects sTriangle */
*u = *u * inv_det;
*v = *v * inv_det;
*t = *t * inv_det;
#else /* the non-culling branch */
/* if determinant is near zero, ray is parallel to the plane of sTriangle */
if (det > -EPSILON && det < EPSILON) return 0;
/* calculate vector from ray origin to a */
SUB(vect0,a,orig);
/* normal vector used to calculate u and v parameters */
CROSS(nvect,dir,vect0);
inv_det = 1.0f / det;
/* calculate vector from ray origin to b*/
SUB(vect1,b,orig);
/* calculate v parameter and test bounds */
*v = - DOT(vect1,nvect) * inv_det;
if (*v < 0.0 || *v > 1.0) return 0;
/* calculate vector from ray origin to c*/
SUB(vect1,c,orig);
/* calculate v parameter and test bounds */
*u = DOT(vect1,nvect) * inv_det;
if (*u < 0.0 || *u + *v > 1.0) return 0;
/* calculate t, ray intersects sTriangle */
*t = - DOT(vect0,normal) * inv_det;
#endif
return (*t >= 0);
// return 1;
}
#define CLIP_RIGHT (1<<0) // cohen-sutherland clipping outcodes
#define CLIP_LEFT (1<<1)
#define CLIP_TOP (1<<2)
#define CLIP_BOTTOM (1<<3)
#define CLIP_FRONT (1<<4)
#define CLIP_BACK (1<<5)
// calculates the cohen-sutherland outcode for a point and a bounding box.
//
// bbox_min: min vector of the bounding box
// bbox_max: max vector of the bounding box
// pnt: the point to check
//
// returns: the outcode
//
static unsigned long calcOutcode( cml::vector3f &bbox_min, cml::vector3f &bbox_max, cml::vector3f &pnt )
{
unsigned long outcode = 0;
if( pnt[0] > bbox_max[0] ) {
outcode |= CLIP_RIGHT;
} else if( pnt[0] < bbox_min[0] ) {
outcode |= CLIP_LEFT;
}
if( pnt[1] > bbox_max[1] ) {
outcode |= CLIP_TOP;
} else if( pnt[1] < bbox_min[1] ) {
outcode |= CLIP_BOTTOM;
}
if( pnt[2] > bbox_max[2] ) {
outcode |= CLIP_BACK;
} else if( pnt[2] < bbox_min[2] ) {
outcode |= CLIP_FRONT;
}
return outcode;
}
// determines if a linesegment intersects a bounding box. this is based on
// the cohen-sutherland line-clipping algorithm.
//
// bbox_min: bounding box min vector
// bbox_max: bounding box max vector
// p1: end point of line segment
// p2: other end point
// intercept: (out) the point in/on the bounding box where the intersection
// occured. note that this point may not be on the surface of the box.
//
// returns: true if the segment and box intersect.
//
static bool collideLineSegmentBoundingBox( cml::vector3f &bbox_min, cml::vector3f &bbox_max, cml::vector3f &p1, cml::vector3f &p2, cml::vector3f &intercept )
{
unsigned long outcode1, outcode2;
outcode1 = calcOutcode( bbox_min, bbox_max, p1 );
if( outcode1 == 0 ) {
// point inside bounding box
intercept = p1;
return true;
}
outcode2 = calcOutcode( bbox_min, bbox_max, p2 );
if( outcode2 == 0 ) {
// point inside bounding box
intercept = p2;
return true;
}
if( (outcode1 & outcode2) > 0 ) {
// both points on same side of box
return false;
}
// check intersections
if( outcode1 & (CLIP_RIGHT | CLIP_LEFT) ) {
if( outcode1 & CLIP_RIGHT ) {
intercept[0] = bbox_max[0];
} else {
intercept[0] = bbox_min[0];
}
float x1 = p2[0] - p1[0];
float x2 = intercept[0] - p1[0];
intercept[1] = p1[1] + x2 * (p2[1] - p1[1]) / x1;
intercept[2] = p1[2] + x2 * (p2[2] - p1[2]) / x1;
if( intercept[1] <= bbox_max[1] && intercept[1] >= bbox_min[1] && intercept[2] <= bbox_max[2] && intercept[2] >= bbox_min[2] ) {
return true;
}
}
if( outcode1 & (CLIP_TOP | CLIP_BOTTOM) ) {
if( outcode1 & CLIP_TOP ) {
intercept[1] = bbox_max[1];
} else {
intercept[1] = bbox_min[1];
}
float y1 = p2[1] - p1[1];
float y2 = intercept[1] - p1[1];
intercept[0] = p1[0] + y2 * (p2[0] - p1[0]) / y1;
intercept[2] = p1[2] + y2 * (p2[2] - p1[2]) / y1;
if( intercept[0] <= bbox_max[0] && intercept[0] >= bbox_min[0] && intercept[2] <= bbox_max[2] && intercept[2] >= bbox_min[2] ) {
return true;
}
}
if( outcode1 & (CLIP_FRONT | CLIP_BACK) ) {
if( outcode1 & CLIP_BACK ) {
intercept[2] = bbox_max[2];
} else {
intercept[2] = bbox_min[2];
}
float z1 = p2[2] - p1[2];
float z2 = intercept[2] - p1[2];
intercept[0] = p1[0] + z2 * (p2[0] - p1[0]) / z1;
intercept[1] = p1[1] + z2 * (p2[1] - p1[1]) / z1;
if( intercept[0] <= bbox_max[0] && intercept[0] >= bbox_min[0] && intercept[1] <= bbox_max[1] && intercept[1] >= bbox_min[1] ) {
return true;
}
}
// nothing found
return false;
}
typedef struct {GLfloat xs,ys,xe,ye;} SEGMENT ;
static bool lineSegmentsIntersection(cml::vector3f &pA, cml::vector3f &pB, cml::vector3f &pC, cml::vector3f &pD, GLfloat &X, GLfloat &Y)
{
cml::vector3f DP,QA,QB;
GLfloat d,la,lb;
SEGMENT A = { pA[0] , pA[1], pB[0], pB[1] };
SEGMENT B = { pC[0] , pC[1], pD[0], pD[1] };
DP[0] = B.xs - A.xs ;
DP[1] = B.ys - A.ys ;
QA[0] = A.xe - A.xs ;
QA[1] = A.ye - A.ys ;
QB[0] = B.xe - B.xs ;
QB[1] = B.ye - B.ys ;
d = QA[1] * QB[0] - QB[1] * QA[0] ;
la = ( QB[0] * DP[1] - QB[1] * DP[0] ) / d ;
lb = ( QA[0] * DP[1] - QA[1] * DP[0] ) / d ;
X = A.xs + la * QA[0];
Y = A.ys + la * QA[1];
return (la>=0.0f && la<=1.0f && lb>=0.0f && lb<=1.0f);
}
static inline GLfloat crossProduct(cml::vector3f &v1, cml::vector3f &v2)
{
return v1[0] * v2[1] - v1[1] * v2[0];
}
static bool linesIntersect(cml::vector3f l1s, cml::vector3f l1f, cml::vector3f l2s, cml::vector3f l2f )
{
cml::vector3f v1 = l1f - l1s;
cml::vector3f v2 = l2s - l1s;
cml::vector3f v3 = l2f - l1s;
GLfloat crossProd1 = crossProduct(v1,v2);
GLfloat crossProd2 = crossProduct(v1,v3);
if ( (crossProd1 > 0 && crossProd2 < 0) || (crossProd1 < 0 && crossProd2 > 0) || (crossProd1 == 0 && crossProd2 == 0) )
{
v1 = l2s - l2f;
v2 = l1s - l2f;
v3 = l1f - l2f;
crossProd1 = crossProduct(v1,v2);
crossProd2 = crossProduct(v1,v3);
if ( (crossProd1 > 0 && crossProd2 < 0) || (crossProd1 < 0 && crossProd2 > 0) || (crossProd1 == 0 && crossProd2 == 0) )
{
return true;
}
}
return false;
}
static bool pointInTriangleCircumcircle0(cml::vector3f &point, sTriangle &sTriangle)
{
GLfloat a = sTriangle.A[0];
GLfloat b = sTriangle.A[1];
GLfloat c = sTriangle.B[0];
GLfloat d = sTriangle.B[1];
GLfloat e = sTriangle.C[0];
GLfloat f = sTriangle.C[1];
GLfloat k = ((a*a+b*b)*(e-c) + (c*c+d*d)*(a-e) + (e*e+f*f)*(c-a)) / (2.0f*(b*(e-c)+d*(a-e)+f*(c-a)));
GLfloat h = ((a*a+b*b)*(f-d) + (c*c+d*d)*(b-f) + (e*e+f*f)*(d-b)) / (2.0f*(a*(f-d)+c*(b-f)+e*(d-b)));
GLfloat r = sqrt(pow(a-h,2) + pow(b-k,2));
return ((cml::vector3f(h,k,0.0f)-point).length()<=r);
}
static bool pointInTriangleCircumcircle1(cml::vector3f &point, sTriangle &sTriangle)
{
GLfloat C[3][3];
C[0][0] = sTriangle.A[0] - point[0];
C[0][1] = sTriangle.A[1] - point[1];
C[0][2] = C[0][0] * C[0][0] + C[0][1] * C[0][1];
C[1][0] = sTriangle.B[0] - point[0];
C[1][1] = sTriangle.B[1] - point[1];
C[1][2] = C[1][0] * C[1][0] + C[1][1] * C[1][1];
C[2][0] = sTriangle.C[0] - point[0];
C[2][1] = sTriangle.C[1] - point[1];
C[2][2] = C[2][0] * C[2][0] + C[2][1] * C[2][1];
GLfloat D = C[0][0] * (C[1][1] * C[2][2] - C[1][2] * C[2][1])
+ C[0][1] * (C[1][2] * C[2][0] - C[1][0] * C[2][2])
+ C[0][2] * (C[1][0] * C[2][1] - C[1][1] * C[2][0]);
return (D<0.0f);
}
static GLdouble Angle2D(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
{
GLdouble dtheta,theta1,theta2;
theta1 = atan2(y1,x1);
theta2 = atan2(y2,x2);
dtheta = theta2 - theta1;
while (dtheta > PI)
{
dtheta -= TWOPI;
}
while (dtheta < -PI)
{
dtheta += TWOPI;
}
return(dtheta);
}
static bool pointInsidePolygon(vector<cml::vector3f> &polygon, cml::vector3f &p)
{
GLint i;
GLdouble angle=0;
GLint n = polygon.size();
cml::vector3f p1,p2;
for (i=0;i<n;i++)
{
p1[0] = polygon[i][0] - p[0];
p1[1] = polygon[i][1] - p[1];
p2[0] = polygon[(i+1)%n][0] - p[0];
p2[1] = polygon[(i+1)%n][1] - p[1];
angle += Angle2D(p1[0],p1[1],p2[0],p2[1]);
}
return (abs(angle)>PI);
}
};
};
#endif // UTILS_H
|
[
"[email protected]",
"[email protected]"
] |
[
[
[
1,
39
],
[
41,
44
],
[
46,
49
],
[
51,
987
]
],
[
[
40,
40
],
[
45,
45
],
[
50,
50
]
]
] |
1533ff684d9623ab063659cf5c563ebc1e26e83d
|
dba70d101eb0e52373a825372e4413ed7600d84d
|
/RendererComplement/include/RenderData.h
|
f77464176b1fd56b76a6ccdd70093e034bf6087c
|
[] |
no_license
|
nustxujun/simplerenderer
|
2aa269199f3bab5dc56069caa8162258e71f0f96
|
466a43a1e4f6e36e7d03722d0d5355395872ad86
|
refs/heads/master
| 2021-03-12T22:38:06.759909 | 2010-10-02T03:30:26 | 2010-10-02T03:30:26 | 32,198,944 | 0 | 0 | null | null | null | null |
GB18030
|
C++
| false | false | 1,213 |
h
|
#ifndef _RenderData_H_
#define _RenderData_H_
#include "Prerequisites.h"
#include "Material.h"
#include "Light.h"
#include "Viewport.h"
#include "Sampler.h"
namespace RCP
{
struct RenderParameter
{
//当前vb
VertexBuffer* vertexBuffer;
//当前ib
IndexBuffer* indexBuffer;
//当前纹理,限定8层(不是有什么不可实现,只是模拟显卡最大数)
Texture* texture[8];
//当前材质
Material material;
//当前矩阵
Matrix4X4 matrices[TS_BASALNUM];
//灯光
Light light[8];
//视口
Viewport viewport;
//纹理状态
Sampler sampler[8];
//渲染状态
RenderState renderState;
//frameBuffer
FrameBuffer* frameBuffer;
//assistantBuffer,暂时是z + stencil
RenderTarget* assistantBuffer[2];
//其他属性状态
typedef std::map<std::string , Any> Propertys;
Propertys propertys;
};
class RenderData
{
public :
RenderData(Primitives type, unsigned int offset, unsigned int count, const RenderParameter& paras);
Primitives ptType;
unsigned int beginPrimitiveOffset;
unsigned int primitiveCount;
const RenderParameter& renderParameter;
};
}
#endif//_RenderData_H_
|
[
"[email protected]@c2606ca0-2ebb-fda8-717c-293879e69bc3"
] |
[
[
[
1,
57
]
]
] |
2d30969df19400467d1b562f4395c81e37fa921a
|
b505ef7eb1a6c58ebcb73267eaa1bad60efb1cb2
|
/source/graphics/graphics2drender6.cpp
|
9a44807f3d3a3f9113f93aac9a27e3df75e9ef4d
|
[] |
no_license
|
roxygen/maid2
|
230319e05d6d6e2f345eda4c4d9d430fae574422
|
455b6b57c4e08f3678948827d074385dbc6c3f58
|
refs/heads/master
| 2021-01-23T17:19:44.876818 | 2010-07-02T02:43:45 | 2010-07-02T02:43:45 | 38,671,921 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 6,856 |
cpp
|
#include"graphics2drender.h"
#include"customvertextemplate.h"
#include"../auxiliary/mathematics/vector.h"
#include"../auxiliary/mathematics/matrix.h"
namespace Maid
{
//! 指定したテクスチャをマスク領域にしたがって描画する
/*!
@param Pos [i ] 描画開始座標
@param TexBegin [i ] 描画するもの
@param BeginRect [i ] 切り抜き範囲
@param Center [i ] 中心座標
@param alpha [i ] 透明度(0.0f:見えない 1.0f:完全に見える)
@param TexEnd [i ] 合成先テクスチャ
@param EndRect [i ] TexEndの切り抜き範囲
@param pow [i ] 影響量(0でTexBeginが完全に表示されて 1だとTexEndが表示される)
*/
void Graphics2DRender::BltMix( const POINT2DI& Pos, const Texture2DBase& TexBegin, const RECT2DI& BeginRect, const POINT2DI& Center, float alpha, const Texture2DBase& TexEnd, const RECT2DI& EndRect, float pow )
{
MAID_ASSERT( IsInitializing(), "初期化中は呼ばないこと" );
MODELINFO m;
CreateVirtualScreenModel( Pos, TexBegin.GetSize(), Center, m );
BltMix( m.Model, m.Translate, TexBegin, BeginRect, alpha, TexEnd, EndRect, pow );
}
//! 指定したテクスチャをマスク領域にしたがって描画する
/*!
@param Pos [i ] 描画開始座標
@param TexBegin [i ] 描画するもの
@param BeginRect [i ] 切り抜き範囲
@param Center [i ] 中心座標
@param Scale [i ] 拡大率(1.0f が等倍)
@param alpha [i ] 透明度(0.0f:見えない 1.0f:完全に見える)
@param TexEnd [i ] 合成先テクスチャ
@param EndRect [i ] TexEndの切り抜き範囲
@param pow [i ] 影響量(0でTexBeginが完全に表示されて 1だとTexEndが表示される)
*/
void Graphics2DRender::BltMixS ( const POINT2DI& Pos, const Texture2DBase& TexBegin, const RECT2DI& BeginRect, const POINT2DI& Center, float alpha, const SIZE2DF& Scale, const Texture2DBase& TexEnd, const RECT2DI& EndRect, float pow )
{
MAID_ASSERT( IsInitializing(), "初期化中は呼ばないこと" );
MODELINFO m;
CreateVirtualScreenModel( Pos, TexBegin.GetSize(), Center, m );
BltMix( m.Model, MATRIX4DF().SetScale(Scale.w,Scale.h,1)*m.Translate, TexBegin, BeginRect, alpha, TexEnd, EndRect, pow );
}
//! 指定したテクスチャをマスク領域にしたがって描画する
/*!
@param Pos [i ] 描画開始座標
@param TexBegin [i ] 描画するもの
@param BeginRect [i ] 切り抜き範囲
@param Center [i ] 中心座標
@param alpha [i ] 透明度(0.0f:見えない 1.0f:完全に見える)
@param Rotate [i ] 回転角度(ラジアン度)
@param vec [i ] 回転軸
@param TexEnd [i ] 合成先テクスチャ
@param EndRect [i ] TexEndの切り抜き範囲
@param pow [i ] 影響量(0でTexBeginが完全に表示されて 1だとTexEndが表示される)
*/
void Graphics2DRender::BltMixR ( const POINT2DI& Pos, const Texture2DBase& TexBegin, const RECT2DI& BeginRect, const POINT2DI& Center, float alpha, float Rotate, const VECTOR3DF& vec, const Texture2DBase& TexEnd, const RECT2DI& EndRect, float pow )
{
MAID_ASSERT( IsInitializing(), "初期化中は呼ばないこと" );
MODELINFO m;
CreateVirtualScreenModel( Pos, TexBegin.GetSize(), Center, m );
BltMix( m.Model, MATRIX4DF().SetRotationXYZ(Rotate,vec)*m.Translate, TexBegin, BeginRect, alpha, TexEnd, EndRect, pow );
}
//! 指定したテクスチャをマスク領域にしたがって描画する
/*!
@param Pos [i ] 描画開始座標
@param TexBegin [i ] 描画するもの
@param BeginRect [i ] 切り抜き範囲
@param Center [i ] 中心座標
@param alpha [i ] 透明度(0.0f:見えない 1.0f:完全に見える)
@param Scale [i ] 拡大率(1.0f が等倍)
@param Rotate [i ] 回転角度(ラジアン度)
@param vec [i ] 回転軸
@param TexEnd [i ] 合成先テクスチャ
@param EndRect [i ] TexEndの切り抜き範囲
@param pow [i ] 影響量(0でTexBeginが完全に表示されて 1だとTexEndが表示される)
*/
void Graphics2DRender::BltMixSR( const POINT2DI& Pos, const Texture2DBase& TexBegin, const RECT2DI& BeginRect, const POINT2DI& Center, float alpha, const SIZE2DF& Scale, float Rotate, const VECTOR3DF& vec, const Texture2DBase& TexEnd, const RECT2DI& EndRect, float pow )
{
MAID_ASSERT( IsInitializing(), "初期化中は呼ばないこと" );
MODELINFO info;
CreateVirtualScreenModel( Pos, TexBegin.GetSize(), Center, info );
const MATRIX4DF m = MATRIX4DF().SetScale(Scale.w,Scale.h,1)
* MATRIX4DF().SetRotationXYZ(Rotate,vec)
* info.Translate;
BltMix( info.Model, m, TexBegin, BeginRect, alpha, TexEnd, EndRect, pow );
}
void Graphics2DRender::BltMix ( const VECTOR4DF* Model, const MATRIX4DF& mat, const Texture2DBase& TexBegin, const RECT2DI& BeginRect, float alpha, const Texture2DBase& TexEnd, const RECT2DI& EndRect, float pow )
{
const RECT2DF BeginUV = TexBegin.CalcUV( BeginRect );
const RECT2DF EndUV = TexEnd.CalcUV( EndRect );
const COLOR_R32G32B32A32F Color(pow,1,1,alpha);
CUSTOMVERTEX_SPRITE2 v[] =
{
CUSTOMVERTEX_SPRITE2( POINT3DF(0,0,0), Color, EndUV.GetLT(), BeginUV.GetLT() ),
CUSTOMVERTEX_SPRITE2( POINT3DF(0,0,0), Color, EndUV.GetRT(), BeginUV.GetRT() ),
CUSTOMVERTEX_SPRITE2( POINT3DF(0,0,0), Color, EndUV.GetLB(), BeginUV.GetLB() ),
CUSTOMVERTEX_SPRITE2( POINT3DF(0,0,0), Color, EndUV.GetRB(), BeginUV.GetRB() ),
};
SetupVertex( Model, mat, v, v[0].GetStructSize() );
SetCommonVertex( v, sizeof(v), v[0].GetStructSize() );
const IInputLayout& layout = m_BltMixLayout;
const IVertexShader& vs = m_BltMixVertexShader;
const IMaterial& material0 = TexEnd;
const IMaterial& material1 = TexBegin;
Graphics::IDrawCommand& Command = GetCommand();
Command.SetPrimitiveTopology( Graphics::IDrawCommand::PRIMITIVE_TOPOLOGY_TRIANGLESTRIP );
Command.SetInputLayout( layout.Get() );
Command.PSSetMaterial( 0, material0.Get() );
Command.PSSetMaterial( 1, material1.Get() );
Command.VSSetShader( vs.Get() );
if( m_BltState==BLENDSTATE_MUL || m_BltState==BLENDSTATE_SCREEN )
{
const IPixelShader& ps = m_BltMixPixelShader231;
Command.PSSetShader( ps.Get() );
}
else if( m_BltState==BLENDSTATE_REVERSE )
{
const IPixelShader& ps = m_BltMixPixelShader232;
Command.PSSetShader( ps.Get() );
}
else
{
const IPixelShader& ps = m_BltMixPixelShader230;
Command.PSSetShader( ps.Get() );
}
SetupState();
Command.Draw( 4, 0 );
}
}
|
[
"[email protected]"
] |
[
[
[
1,
156
]
]
] |
7df8c03b45dbde79e3198704e72e9b263b120ae2
|
a5cbc2c1c12b3df161d9028791c8180838fbf2fb
|
/Heimdall/heimdall-frontend/Source/aboutform.cpp
|
f043c2009e49154c3ef018796487ca3c44cace35
|
[] |
no_license
|
atinm/Heimdall
|
e8659fe869172baceb590bc445f383d8bcb72b82
|
692cda38c99834384c4f0c7687c209f432300993
|
refs/heads/master
| 2020-03-27T12:29:58.609089 | 2010-12-03T19:25:19 | 2010-12-03T19:25:19 | 1,136,137 | 2 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,274 |
cpp
|
/* Copyright (c) 2010 Benjamin Dobell, Glass Echidna
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.*/
// Heimdall
#include "aboutform.h"
using namespace HeimdallFrontend;
AboutForm::AboutForm(QWidget *parent) : QWidget(parent)
{
setupUi(this);
}
|
[
"[email protected]"
] |
[
[
[
1,
29
]
]
] |
af029de68c8e505447ee87b2ed347b11690fe56e
|
555ce7f1e44349316e240485dca6f7cd4496ea9c
|
/DirectShowFilters/StreamingServer/Source/MultiFileReader.h
|
13a1b7ec1417ed24c9f9148e19910f39f2bbd807
|
[] |
no_license
|
Yura80/MediaPortal-1
|
c71ce5abf68c70852d261bed300302718ae2e0f3
|
5aae402f5aa19c9c3091c6d4442b457916a89053
|
refs/heads/master
| 2021-04-15T09:01:37.267793 | 2011-11-25T20:02:53 | 2011-11-25T20:11:02 | 2,851,405 | 2 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 3,072 |
h
|
/**
* MultiFileReader.h
* Copyright (C) 2005 nate
* Copyright (C) 2006 bear
*
* This file is part of TSFileSource, a directshow push source filter that
* provides an MPEG transport stream output.
*
* TSFileSource is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* TSFileSource is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TSFileSource; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* nate can be reached on the forums at
* http://forums.dvbowners.com/
*/
#ifndef MULTIFILEREADER
#define MULTIFILEREADER
#include "FileReader.h"
#include <vector>
class MultiFileReaderFile
{
public:
LPWSTR filename;
__int64 startPosition;
__int64 length;
long filePositionId;
};
class MultiFileReader : public FileReader
{
public:
MultiFileReader();
virtual ~MultiFileReader();
virtual FileReader* CreateFileReader();
virtual HRESULT GetFileName(LPOLESTR *lpszFileName);
virtual HRESULT SetFileName(LPCOLESTR pszFileName);
virtual HRESULT OpenFile();
virtual HRESULT CloseFile();
virtual HRESULT Read(PBYTE pbData, ULONG lDataLength, ULONG *dwReadBytes);
virtual HRESULT Read(PBYTE pbData, ULONG lDataLength, ULONG *dwReadBytes, __int64 llDistanceToMove, DWORD dwMoveMethod);
virtual HRESULT get_ReadOnly(WORD *ReadOnly);
virtual HRESULT set_DelayMode(WORD DelayMode);
virtual HRESULT get_DelayMode(WORD *DelayMode);
virtual HRESULT get_ReaderMode(WORD *ReaderMode);
virtual DWORD setFilePointer(__int64 llDistanceToMove, DWORD dwMoveMethod);
virtual __int64 getFilePointer();
virtual __int64 getBufferPointer();
virtual void setBufferPointer();
//TODO: GetFileSize should go since get_FileSize should do the same thing.
virtual HRESULT GetFileSize(__int64 *pStartPosition, __int64 *pLength);
virtual BOOL IsFileInvalid();
virtual DWORD SetFilePointer(__int64 llDistanceToMove, DWORD dwMoveMethod);
virtual __int64 GetFilePointer();
virtual __int64 GetFileSize();
protected:
HRESULT RefreshTSBufferFile();
HRESULT GetFileLength(LPWSTR pFilename, __int64 &length);
void RefreshFileSize();
// SharedMemory* m_pSharedMemory;
FileReader m_TSBufferFile;
__int64 m_startPosition;
__int64 m_endPosition;
__int64 m_currentPosition;
__int64 m_llBufferPointer;
long m_filesAdded;
long m_filesRemoved;
std::vector<MultiFileReaderFile *> m_tsFiles;
FileReader m_TSFile;
long m_TSFileId;
BOOL m_bReadOnly;
BOOL m_bDelay;
BOOL m_bDebugOutput;
__int64 m_cachedFileSize;
};
#endif
|
[
"[email protected]",
"[email protected]",
"[email protected]"
] |
[
[
[
1,
3
],
[
5,
35
],
[
37,
48
],
[
61,
62
],
[
65,
66
],
[
68,
75
],
[
78,
79
],
[
81,
84
],
[
86,
94
],
[
96,
100
]
],
[
[
4,
4
],
[
36,
36
],
[
50,
60
],
[
63,
64
],
[
67,
67
],
[
76,
77
],
[
80,
80
],
[
85,
85
],
[
95,
95
]
],
[
[
49,
49
]
]
] |
d421508014bc114918aa189779ccc19ec433a02d
|
bdb1e38df8bf74ac0df4209a77ddea841045349e
|
/CapsuleSortor/Version 1.0 -2.0/CapsuleSortor-10-12-17/ToolSrc/TColorChecker.h
|
e68218b27c49583f7e11f3aad400df7a65881fd9
|
[] |
no_license
|
Strongc/my001project
|
e0754f23c7818df964289dc07890e29144393432
|
07d6e31b9d4708d2ef691d9bedccbb818ea6b121
|
refs/heads/master
| 2021-01-19T07:02:29.673281 | 2010-12-17T03:10:52 | 2010-12-17T03:10:52 | 49,062,858 | 0 | 1 | null | 2016-01-05T11:53:07 | 2016-01-05T11:53:07 | null |
UTF-8
|
C++
| false | false | 1,172 |
h
|
// TColorChecker.h: interface for the TColorChecker class.
//
//////////////////////////////////////////////////////////////////////
#ifndef TCOLORCHECKER_H
#define TCOLORCHECKER_H
#include "PixelType.h"
class TColorChecker
{
public:
TColorChecker();
~TColorChecker();
bool RightRGB ( const PelRGB24& color);
bool RightHSL ( const PelHSL24& color);
bool RightLab ( const PelLab24& color);
PelHSL24 CvtRGBToHSL ( const PelRGB24& color);
PelLab24 CvtRGBToLab ( const PelRGB24& color);
bool SetStandard ( const PelHSL24& hslValue,
const PelHSL24& hslTolerance);
bool SetStandard ( const PelLab24& LabValue,
const char distance);
private:
template<typename T> T Max(T a, T b) { return a > b ? a : b; }
template<typename T> T Min(T a, T b) { return a < b ? a : b; }
bool RightColor ( long realColor,
long stdColor,
long tolerance,
long period = HSLMAX);
private:
enum { HSLMAX = 240, RGBMAX = 255, LOWSAT = 20 };
PelHSL24 m_stdHSL;
PelHSL24 m_tolHSL;
PelLab24 m_stdLab;
size_t m_distLab; //the square of Lab color space distance;
};
#endif //TCOLORCHECKER_H
|
[
"vincen.cn@66f52ff4-a261-11de-b161-9f508301ba8e"
] |
[
[
[
1,
42
]
]
] |
022f50cf86f9a9d2b6a1866590695a2a460b00c6
|
2c1e5a69ca68fe185cc04c5904aa104b0ba42e32
|
/src/game/Cinematic.cpp
|
affb563a6ebb7e18797f2c5685cb7a2f0b4c5152
|
[] |
no_license
|
dogtwelve/newsiderpg
|
e3f8284a7cd9938156ef8d683dca7bcbd928c593
|
303566a034dca3e66cf0f29cf9eaea1d54d63e4a
|
refs/heads/master
| 2021-01-10T13:03:31.986204 | 2010-06-27T05:36:33 | 2010-06-27T05:36:33 | 46,550,247 | 0 | 1 | null | null | null | null |
UHC
|
C++
| false | false | 27,118 |
cpp
|
#include "Cinematic.h"
//--------------------------------------------------------------------------
cCinematic::cCinematic(void* _sASpriteSet)
//--------------------------------------------------------------------------
{
s_ASpriteSet = (ASpriteSet*)_sASpriteSet;
}
//--------------------------------------------------------------------------
cCinematic::~cCinematic()
//--------------------------------------------------------------------------
{
Release_Cinematics();
}
//--------------------------------------------------------------------------
void cCinematic::Load_Cinematics(char* _packtype, int _DataNum, int nextEvtcode, Field* _pField)
//--------------------------------------------------------------------------
{
//필드의 카메라를 일치시켜준다.
//m_mapX = _pField->m_nSrcCamAngle_X;
m_mapX = 0;
m_nTheaterTimer = 0;
// m_nReadyCinemaCount = 10;
// m_nEndCinemaCount = 0;
m_nNextEventCode = nextEvtcode;
m_IsPlayCinema = true;
m_IsSendEndEvt = false;
byte* data = NULL;
// SUTIL_Data_open(packIndex);
SUTIL_Data_init(_packtype);
data = SUTIL_Data_readAll(_DataNum);
SUTIL_Data_free();
int pos = 0;
short cin_nums = data[pos++];
s_cinematics = GL_NEW byte**[cin_nums];
s_cinematics_sz_len = GL_NEW int[cin_nums];
s_cinematics_sz2_len = GL_NEW int*[cin_nums];
s_cinematicsId = GL_NEW short[cin_nums];
s_cinematicsId_len = cin_nums;
s_currentFramePos = GL_NEW int*[cin_nums];
// s_runningCinematicTrackActors = GL_NEW int*[cin_nums];
m_ASpriteIns = GL_NEW ASpriteInstance**[cin_nums];
m_IsShadow = GL_NEW bool*[cin_nums];
// Init_Asprite ( cin_nums );
for (int c = 0; c < cin_nums; c++)
{
s_cinematicsId[c] = (short)((data[pos] & 0xFF) + ((data[pos + 1] & 0xFF) << 8));
pos += 2;
byte tracks_nums = data[pos++];
s_tracks_nums = tracks_nums;
pos += 2; //skip cinematic_number_of_key_frames
s_cinematics[c] = GL_NEW byte*[tracks_nums];
s_cinematics_sz2_len[c] = GL_NEW int[tracks_nums];
s_cinematics_sz_len[c] = tracks_nums;
s_currentFramePos[c] = GL_NEW int[tracks_nums];
m_ASpriteIns[c] = GL_NEW ASpriteInstance*[tracks_nums];
m_IsShadow[c] = GL_NEW bool[tracks_nums];
// s_runningCinematicTrackActors[c] = GL_NEW int[tracks_nums];
s_infoasprite = GL_NEW int*[tracks_nums];
s_infoasprite_len = tracks_nums;
for (int t = 0; t < tracks_nums; t++)
{
m_ASpriteIns[c][t] = NULL;
m_IsShadow[c][t] = NULL;
s_infoasprite[t] = NULL;
s_infoasprite[t] = GL_NEW int[4]; //sprite,ani,x,y
//s_infoasprite = GL_NEW int[tracks_nums];
int track_start = pos;
byte track_type = data[pos++];
pos++; //skip track_flags
switch (track_type)
{
case CTRACK_BASIC:
case CTRACK_CAMERA:
//------------------------------------------------------
{
// Set_MatchAsprite( 0 , t );
break;
}
case CTRACK_OBJ_LAYER:
//------------------------------------------------------
{
int uid = (data[pos] & 0xFF) + ((data[pos + 1] & 0xFF) << 8);
// s_runningCinematicTrackActors[c][t] = uid;
pos += 2; // skip track_object_layer_id
// 스프라이트를 로드시킨다.
// m_ASpriteIns[c][t] = LoadSpriteInstance(uid);
break;
}
}
// Set_MatchAsprite( s_runningCinematicTrackActors[c][t] , t ); //Actor NUM , tracks_nums
short key_frames_nums = (short)((data[pos] & 0xFF) + ((data[pos + 1] & 0xFF) << 8));
pos += 2;
int keyframe_start = pos;
for (int k = 0; k < key_frames_nums; k++)
{
pos += 2; //skip key_frame_time
byte commands_nums = data[pos++];
for (int l = 0; l < commands_nums; l++)
{
byte cmd_type = data[pos++];
if(cmd_type >= CCMD_FIRST_CUSTOM)
{
// //dbg("READING CUSTOM PARAM" + cmd_type + " " + GetCustomCinematicCommandNumParams(cmd_type));
// pos += GetCustomCinematicCommandNumParams(cmd_type);
}
else
{
switch (cmd_type)
{
case CCMD_CAMERA_SET_POS:
case CCMD_CAMERA_CENTER_TO:
case CCMD_OBJ_LAYER_SET_POS:
case CCMD_BASIC_SET_POS:
case CCMD_SI_SET_POS:
//-------------------------------------------------------------
{
pos += 2; //skip key_frame_cmd_x
pos += 2; //skip key_frame_cmd_y
break;
}
case CCMD_CAMERA_FOCUS_ON:
//-------------------------------------------------------------
{
pos += 1; //skip Thread to follow,
pos += 2; //skip OffsetY
pos += 2; //skip OffsetY
break;
}
case CCMD_BASIC_SET_ACTION:
//-------------------------------------------------------------
{
pos += 2; // skip key_frame_cmd_anim
break;
}
case CCMD_OBJ_LAYER_SET_ANIM:
case CCMD_SI_SET_ANIM:
//-------------------------------------------------------------
{
pos++; // skip key_frame_cmd_anim
break;
}
case CCMD_OBJ_LAYER_ADD_FLAGS:
case CCMD_OBJ_LAYER_REMOVE_FLAGS:
case CCMD_SI_ADD_FLAGS:
case CCMD_SI_REMOVE_FLAGS:
//-------------------------------------------------------------
{
pos += 4; // skip key_frame_cmd_flags
break;
}
case CCMD_BASIC_OBJEVENT1: {pos += 2; break;}
case CCMD_BASIC_OBJEVENT2: {pos += 4; break;}
case CCMD_BASIC_OBJEVENT3: {pos += 6; break;}
case CCMD_BASIC_EVENT1: {pos += 2; break;}
case CCMD_BASIC_EVENT2: {pos += 4; break;}
case CCMD_BASIC_EVENT3: {pos += 6; break;}
default:
//-------------------------------------------------------------
{
// //dbg("Unknown command type " + cmd_type);
// //dbg("Current pos " + pos);
break;
}
}//End Switch
}// End if(cmd_type)
}//End for (int l = 0; l < commands_nums; l++)
}//End for (int k = 0; k < key_frames_nums; k++)
int track_length = pos - track_start;
s_cinematics[c][t] = GL_NEW byte[track_length + 2]; //2 more byte to store pos for use when reset
s_cinematics_sz2_len[c][t] = track_length + 2;
s_currentFramePos[c][t] = keyframe_start - track_start; //start key frame offset to track data
//System.arraycopy(data, track_start, s_cinematics[c][t], 0, track_length);
MEMCPY(s_cinematics[c][t],data+track_start,sizeof(byte)*track_length);
s_cinematics[c][t][track_length] = (byte)(s_currentFramePos[c][t] & 0xFF);
s_cinematics[c][t][track_length + 1] = (byte)((s_currentFramePos[c][t] >> 8) & 0xFF);
}
}
SAFE_DELETE_ARRAY(s_cinematicsFrameTime);
s_cinematicsFrameTime = GL_NEW short[cin_nums];
s_cinematicsFrameTime_len = cin_nums;
/// Reset_Cinematics();
SAFE_DELETE(data);
// 필드 추가
pField = _pField;
// 한 프레임을 추가시켜서 리소스를 등록한다.
Update_Cinematics();
}
//--------------------------------------------------------------------------
void cCinematic::Update_Cinematics()
//--------------------------------------------------------------------------
{
bool isObjEvent = false;
// 퍼즈상태일 경우는 에니메이션만 돌려준다.
if(true == s_cinematicsPause)
{
for (int c = 0; c < s_cinematicsId_len; c++)
{
for (int t = 0; t < s_cinematics_sz_len[c]; t++)
{
if(NULL != m_ASpriteIns[c][t])
{
SUTIL_UpdateTimeAsprite(m_ASpriteIns[c][t]);
}
}
}
// 배경은 자동갱신되므로 따로 처리하지 않는다.
return;
}
for (int c = 0; c < s_cinematicsId_len; c++)
{
s_param1 = s_param2 = s_param3 = -1;
if (s_cinematicsFrameTime[c] >= 0)
{
bool cinematicEnd = true;
byte** currentCinematic = s_cinematics[c];
int current_frame_time = s_cinematicsFrameTime[c]++;
for (int t = 0; t < s_cinematics_sz_len[c]; t++)
{
//int uid;
int pos = 0;
byte* data = currentCinematic[t];
if (s_currentFramePos[c][t] >= s_cinematics_sz2_len[c][t] - 2)
{
continue;
}
byte track_type = data[pos++];
byte track_flags = data[pos++];
switch (track_type)
{
case CTRACK_BASIC:
//-------------------------------------------------------------
{
break;
}
case CTRACK_CAMERA:
//-------------------------------------------------------------
{
break;
}
case CTRACK_OBJ_LAYER:
//-------------------------------------------------------------
{
pos += 2;
break;
}
}
pos = s_currentFramePos[c][t];
int nextPosX = 0, nextPosY = 0, nextPosFrameTime = -1;
short key_frame_time = (short)((data[pos] & 0xFF) + ((data[pos + 1] & 0xFF) << 8));
pos += 2;
byte command_nums = data[pos++];
isObjEvent = false;
byte cmd_type = 0;
for (int k = 0; k < command_nums; k++)
{
cmd_type = data[pos++];
if(cmd_type >= CCMD_FIRST_CUSTOM)
{
//pos += ExecuteCustomCinematicCommand(cmd_type, data, pos, current_frame_time, key_frame_time);
continue;
}
isObjEvent = false;
switch (cmd_type)
{
case CCMD_CAMERA_SET_POS:
case CCMD_CAMERA_CENTER_TO:
case CCMD_OBJ_LAYER_SET_POS:
case CCMD_BASIC_SET_POS:
case CCMD_SI_SET_POS:
//-------------------------------------------------------------------
{
int cmd_x = (short)((data[pos] & 0xFF) + ((data[pos + 1] & 0xFF) << 8));
pos += 2;
int cmd_y = (short)((data[pos] & 0xFF) + ((data[pos + 1] & 0xFF) << 8));
pos += 2;
if(0 == current_frame_time && cmd_type == CCMD_OBJ_LAYER_SET_POS)
{
// 스프라이트를 로드시킨다.
LoadSpriteInstance(c, t, cmd_x, cmd_y);
int a = 0;
}
else
{
if(cmd_x == -1) //use current position X
{
if ( s_infoasprite[t][0] > -1 )
{
cmd_x = s_infoasprite[t][2];
}
}
if(cmd_y == -1) //use current position in Y
{
if ( s_infoasprite[t][0] > -1 )
{
cmd_y = s_infoasprite[t][3];
}
}
if (current_frame_time <= key_frame_time)
{
nextPosX = cmd_x;
nextPosY = cmd_y;
nextPosFrameTime = key_frame_time;
}
}
break;
}
case CCMD_CAMERA_FOCUS_ON:
//-------------------------------------------------------------------
{
short focusedActorID = (short)(data[pos++] & 0xFF);
short OffsetX = (short)((data[pos] & 0xFF) + ((data[pos + 1] & 0xFF) << 8));
pos += 2;
short OffsetY = (short)((data[pos] & 0xFF) + ((data[pos + 1] & 0xFF) << 8));
pos += 2;
if (current_frame_time <= key_frame_time)
{
//note : REMOVE THIS SPECIAL CASE HACK, I'm just not sure yet the newer code (in the else)
// works for flying levels made in china... (the focusedActorID == 1) is sort of cryptik.
nextPosX += OffsetX;
nextPosY += OffsetY;
nextPosFrameTime = key_frame_time;
}
break;
}
case CCMD_OBJ_LAYER_SET_ANIM:
case CCMD_BASIC_SET_ACTION:
case CCMD_SI_SET_ANIM:
//-------------------------------------------------------------------
{
if (key_frame_time <= current_frame_time)
{
byte anim = data[pos];
if ( s_infoasprite[t][0] > -1 )
{
s_infoasprite[t][1] = anim;
SUTIL_SetTypeAniAsprite(m_ASpriteIns[c][t], s_infoasprite[t][1]);
// s_ASprite[s_infoasprite[t][0]]->SetCurrentAnimation(s_infoasprite[t][1], anim, true );
}
}
pos++;
break;
}
case CCMD_OBJ_LAYER_ADD_FLAGS:
//-------------------------------------------------------------------
{
if (key_frame_time <= current_frame_time)
{
if(0 != data[pos])
{
SUTIL_SetDirAsprite(m_ASpriteIns[c][t], SDIR_LEFT);
}
}
pos += 4;
break;
}
case CCMD_SI_ADD_FLAGS:
//-------------------------------------------------------------------
{
pos += 4;
break;
}
case CCMD_OBJ_LAYER_REMOVE_FLAGS:
case CCMD_SI_REMOVE_FLAGS:
//-------------------------------------------------------------------
{
if (key_frame_time <= current_frame_time)
{
SUTIL_SetDirAsprite(m_ASpriteIns[c][t], SDIR_RIGHT);
}
pos += 4;
break;
}
case CCMD_BASIC_OBJEVENT1:
//-------------------------------------------------------------------
{
if (key_frame_time <= current_frame_time)
{
int a = 0;
}
pos += 2;
break;
}
case CCMD_BASIC_OBJEVENT2:
//-------------------------------------------------------------------
{
if (key_frame_time <= current_frame_time)
{
int a = 0;
}
pos += 4;
break;
}
case CCMD_BASIC_OBJEVENT3:
//-------------------------------------------------------------------
{
if (key_frame_time <= current_frame_time)
{
int a = 0;
}
pos += 6;
break;
}
case CCMD_BASIC_EVENT1:
//-------------------------------------------------------------------
{
if (key_frame_time <= current_frame_time)
{
short evtcode1 = (short)((data[pos] & 0xFF) + ((data[pos + 1] & 0xFF) << 8));
ADD_EVENT_MSG(EVT_CINEMA_ADDEVT, 0, evtcode1);
}
pos += 2;
break;
}
case CCMD_BASIC_EVENT2:
//-------------------------------------------------------------------
{
if (key_frame_time <= current_frame_time)
{
short evtcode1 = (short)((data[pos ] & 0xFF) + ((data[pos + 1] & 0xFF) << 8));
short evtcode2 = (short)((data[pos + 2] & 0xFF) + ((data[pos + 3] & 0xFF) << 8));
ADD_EVENT_MSG(EVT_CINEMA_ADDEVT, 0, evtcode1, evtcode2);
}
pos += 4;
break;
}
case CCMD_BASIC_EVENT3:
//-------------------------------------------------------------------
{
if (key_frame_time <= current_frame_time)
{
short evtcode1 = (short)((data[pos ] & 0xFF) + ((data[pos + 1] & 0xFF) << 8));
short evtcode2 = (short)((data[pos + 2] & 0xFF) + ((data[pos + 3] & 0xFF) << 8));
short evtcode3 = (short)((data[pos + 4] & 0xFF) + ((data[pos + 5] & 0xFF) << 8));
ADD_EVENT_MSG(EVT_CINEMA_ADDEVT, 0, evtcode1, evtcode2, evtcode3);
}
pos += 6;
break;
}
}
}//end of command
if (key_frame_time == current_frame_time)
{
s_currentFramePos[c][t] = pos;
}
else if (key_frame_time < current_frame_time)
{
//bug:this may occour, sames like Aurola bug.
s_currentFramePos[c][t] = pos;
}
if (s_currentFramePos[c][t] < s_cinematics_sz2_len[c][t] - 2)
{
cinematicEnd = false;
}
if (nextPosFrameTime >= 0)
{
if ( track_type == CTRACK_CAMERA )
{
if (nextPosFrameTime >= 0) {
if( cmd_type == CCMD_CAMERA_FOCUS_ON )
{
m_mapX = nextPosX;//ConstraintToRange( nextPosX, cGame.VIEWPORT_WIDTH_HALF, s_mapWidth - cGame.VIEWPORT_WIDTH_HALF);
m_mapY = nextPosY;//ConstraintToRange( nextPosY, cGame.VIEWPORT_HEIGHT_HALF, s_mapHeight - cGame.VIEWPORT_HEIGHT_HALF);
if(pField)
{
pField->SetCamera(m_mapX+120);
}
// //dbg("_CAMERA_FOCUS_ON m_mapX = "+ m_mapX + "m_mapY = "+m_mapY);
}
else
{
int offsetX = (nextPosX - m_mapX) / (nextPosFrameTime - current_frame_time + 1);
int offsetY = (nextPosY - m_mapY) / (nextPosFrameTime - current_frame_time + 1);
m_mapX = m_mapX + offsetX;//ConstraintToRange( m_mapX + offsetX, 0, cGame.m_tileMapW*DEF.TILE_W - m_pGame->width );
m_mapY = m_mapY + offsetY;//ConstraintToRange( m_mapY + offsetY, 0, cGame.m_tileMapH*DEF.TILE_H - m_pGame->height );
if(pField)
{
pField->SetCamera(m_mapX+120);
}
// //dbg("_CAMERA_OTHER m_mapX = "+ m_mapX + "m_mapY = "+m_mapY);
}
}
}
if ( track_type != CTRACK_CAMERA )
{
if ( s_infoasprite[t][0] > -1 && s_infoasprite[t][1] > -1 )
{
//asp.UpdateSpriteAnim( );
if ( s_infoasprite[t][0] > -1 )
{
s_infoasprite[t][2] += (nextPosX - s_infoasprite[t][2]) / (nextPosFrameTime - current_frame_time + 1);
s_infoasprite[t][3] += (nextPosY - s_infoasprite[t][3]) / (nextPosFrameTime - current_frame_time + 1);
SUTIL_UpdateTimeAsprite(m_ASpriteIns[c][t]);
//SUTIL_SetTypeAniAsprite(m_ASpriteIns[c][t], s_infoasprite[t][1]);
// s_ASprite[s_infoasprite[t][0]]->UpdateAnimation( s_infoasprite[t][1] );
}
}
}
}
} // end of track
if (cinematicEnd)
{
if(false == m_IsSendEndEvt)
{
m_IsSendEndEvt = true;
ADD_EVENT_MSG(EVT_SCREEN_FADE_OUT, 0, 10);
ADD_EVENT_MSG(EVT_END_CINEMA, 10, m_nNextEventCode);
}
// m_nEndCinemaCount = 10;
// return 0;
/// EndCinematic(c);
}
}// end of if cinema is running
}// end of cinema
if(pField) {pField->Process();}
return;
}
//--------------------------------------------------------------------------
void cCinematic::Paint_Cinematics()
//--------------------------------------------------------------------------
{
if(pField) {pField->Paint(true);}
for (int c = 0; c < s_cinematicsId_len; c++)
{
for (int t = 0; t < s_cinematics_sz_len[c]; t++)
{
// 이미지
if(NULL != m_ASpriteIns[c][t])
{
SUTIL_SetXPosAsprite(m_ASpriteIns[c][t], s_infoasprite[t][2]-m_mapX);
SUTIL_SetYPosAsprite(m_ASpriteIns[c][t], s_infoasprite[t][3]-m_mapY);
SUTIL_SetZPosAsprite(m_ASpriteIns[c][t], 0);
SUTIL_PaintAsprite(m_ASpriteIns[c][t], S_INCLUDE_SORT);
}
// 그림자
if(true == m_IsShadow[c][t])
{
SUTIL_Paint_Frame(s_ASpriteSet->pShadowAs, 1, m_ASpriteIns[c][t]->m_posX, m_ASpriteIns[c][t]->m_posY, m_ASpriteIns[c][t]->m_posZ);
}
}
}
if(pField)
{
pField->MiddlePaint();
pField->FrontPaint();
}
if(16 > m_nTheaterTimer) {m_nTheaterTimer++;}
m_nTheaterTimer = 16;
if(m_nTheaterTimer)
{
SUTIL_SetColor(0x000000);
SUTIL_FillRect(0,0,240,m_nTheaterTimer*2);
SUTIL_FillRect(0,296-(m_nTheaterTimer*2),240,(m_nTheaterTimer*2));
//
// SUTIL_SetColor(0xff1010);
SUTIL_SetColor(0x555555);
SUTIL_DrawLine(0,m_nTheaterTimer*2,240,m_nTheaterTimer*2);
SUTIL_DrawLine(0,296-(m_nTheaterTimer*2),240,296-(m_nTheaterTimer*2));
}
// if(m_nReadyCinemaCount)
/// {
// for(int loop = 0; loop < (m_nReadyCinemaCount); loop++)
// {
// _SUTIL->g->blandBlur();
// }
// }
//
// if(m_nEndCinemaCount)
// {
// for(int loop = 0; loop < (10-m_nEndCinemaCount); loop++)
// {
// _SUTIL->g->blandBlur();
// }
// }
}
//--------------------------------------------------------------------------
void cCinematic::LoadSpriteInstance(int c, int t, int uniquenum, int color)
//--------------------------------------------------------------------------
{
ASprite* pTmpAs = NULL;
ASpriteInstance* pTmpAsIns = NULL;
m_IsShadow[c][t] = true;
switch(uniquenum)
{
case 0: // HERO_MC
//--------------------------------------------------------------------------
{
pTmpAs = SUTIL_LoadSprite(PACK_SPRITE, Character::Check_sex(SPRITE_MAN_BODY,SPRITE_WOMAN_BODY));
pTmpAs->SetBlendFrame(Character::Check_sex(FRAME_MAN_BODY_BLEND,FRAME_WOMAN_BODY_BLEND));
pTmpAsIns = GL_NEW ASpriteInstance(pTmpAs, 0, 500, NULL);
break;
}
case 1: // HERO_MPC
//--------------------------------------------------------------------------
{
pTmpAs = SUTIL_LoadSprite(PACK_SPRITE, SPRITE_MAN_BODY);
pTmpAs->SetBlendFrame(FRAME_MAN_BODY_BLEND);
pTmpAsIns = GL_NEW ASpriteInstance(pTmpAs, 0, 500, NULL);
break;
}
case 2: // NPC1_BOY
case 3: // NPC2
case 4: // NPC3_DAEMURI_NOIN
case 5: // NPC_4
case 6: // NPC_5
case 7: // NPC_6
case 8: // NPC_7
case 9: // NPC_8
case 10:// NPC_9
case 11:// NPC_10
case 12:// NPC_11_SIGE
case 13:// NPC_12_RONE
case 14:// NPC_13
case 15:// NPC_14_ANGELS
case 16:// NPC_15
case 17:// NPC_16
case 18:// NPC_17_SIRANO
//--------------------------------------------------------------------------
{
pTmpAs = SUTIL_LoadSprite(PACK_SPRITE_NPC, uniquenum-2);
// pTmpAs->SetBlendFrame(FRAME_MAN_BODY_BLEND);
pTmpAsIns = GL_NEW ASpriteInstance(pTmpAs, 0, 500, NULL);
break;
}
case 19:// MON_COBOLT
//--------------------------------------------------------------------------
{
pTmpAs = SUTIL_LoadSprite(PACK_SPRITE_MON, SPRITE_MON_COBOLT);
//pTmpAs->SetBlendFrame(FRAME_MAN_BODY_BLEND);
pTmpAsIns = GL_NEW ASpriteInstance(pTmpAs, 0, 500, NULL);
break;
}
case 20:// EFFECT
//--------------------------------------------------------------------------
{
pTmpAs = SUTIL_LoadSprite(PACK_SPRITE_UI, SPRITE_UI_FIELDEFT_UI);
//pTmpAs->SetBlendFrame(FRAME_MAN_BODY_BLEND);
pTmpAsIns = GL_NEW ASpriteInstance(pTmpAs, 0, 500, NULL);
m_IsShadow[c][t] = false;
break;
}
case 21:// NPC18
//--------------------------------------------------------------------------
{
pTmpAs = SUTIL_LoadSprite(PACK_SPRITE_NPC, SPRITE_NPC_NPC18);
//pTmpAs->SetBlendFrame(FRAME_MAN_BODY_BLEND);
pTmpAsIns = GL_NEW ASpriteInstance(pTmpAs, 0, 500, NULL);
break;
}
case 22:// NPC19
//--------------------------------------------------------------------------
{
pTmpAs = SUTIL_LoadSprite(PACK_SPRITE_NPC, SPRITE_NPC_NPC19);
//pTmpAs->SetBlendFrame(FRAME_MAN_BODY_BLEND);
pTmpAsIns = GL_NEW ASpriteInstance(pTmpAs, 0, 500, NULL);
break;
}
case 23:// BLACKOUT
//--------------------------------------------------------------------------
{
pTmpAs = SUTIL_LoadSprite(PACK_SPRITE_CINEMA, SPRITE_CINEMA_BLACKOUT);
//pTmpAs->SetBlendFrame(FRAME_MAN_BODY_BLEND);
pTmpAsIns = GL_NEW ASpriteInstance(pTmpAs, 0, 500, NULL);
m_IsShadow[c][t] = false;
break;
}
case 24:// EMOTION_QUEST
//--------------------------------------------------------------------------
{
pTmpAs = SUTIL_LoadSprite(PACK_SPRITE_CINEMA, SPRITE_CINEMA_EMOTION_QUEST);
//pTmpAs->SetBlendFrame(FRAME_MAN_BODY_BLEND);
pTmpAsIns = GL_NEW ASpriteInstance(pTmpAs, 0, 500, NULL);
m_IsShadow[c][t] = false;
break;
}
case 25:// EMOTION_ETC
//--------------------------------------------------------------------------
{
pTmpAs = SUTIL_LoadSprite(PACK_SPRITE_CINEMA, SPRITE_CINEMA_EMOTION_ETC);
//pTmpAs->SetBlendFrame(FRAME_MAN_BODY_BLEND);
pTmpAsIns = GL_NEW ASpriteInstance(pTmpAs, 0, 500, NULL);
m_IsShadow[c][t] = false;
break;
}
case 26:// UI
//--------------------------------------------------------------------------
{
pTmpAs = SUTIL_LoadSprite(PACK_SPRITE_UI, SPRITE_UI_ITEM_UI);
//pTmpAs->SetBlendFrame(FRAME_MAN_BODY_BLEND);
pTmpAsIns = GL_NEW ASpriteInstance(pTmpAs, 0, 500, NULL);
m_IsShadow[c][t] = false;
break;
}
}
// 컬러셋팅
pTmpAsIns->SetAniMoveLock(true);
pTmpAsIns->m_pal = color;
m_ASpriteIns[c][t] = pTmpAsIns;
}
//--------------------------------------------------------------------------
void cCinematic::Release_Cinematics()
//--------------------------------------------------------------------------
{
m_IsPlayCinema = false;
if(NULL != s_cinematics_sz_len)
{
for (int c = 0; c < s_cinematicsId_len; c++)
{
for (int t = 0; t < s_cinematics_sz_len[c]; t++)
{
if(NULL != m_ASpriteIns[c][t])
{
SUTIL_FreeSprite(m_ASpriteIns[c][t]->m_sprite);
SUTIL_FreeSpriteInstance(m_ASpriteIns[c][t]);
}
// SAFE_DELETE(m_IsShadow[c][t]);
}
SAFE_DELETE(m_IsShadow[c]);
}
SAFE_DELETE(m_ASpriteIns);
SAFE_DELETE(m_IsShadow);
}
//m_pGame->m_waveInitY = 0;
if(s_cinematics)
{
for(int i=0 ;i<s_cinematicsId_len;i++)
{
SAFE_DELETE_ARRAY_ARRAY(s_cinematics[i],s_cinematics_sz_len[i]);
}
SAFE_DELETE_ARRAY(s_cinematics);
}
SAFE_DELETE_ARRAY(s_cinematics_sz_len);
SAFE_DELETE_ARRAY_ARRAY(s_cinematics_sz2_len,s_cinematicsId_len);
SAFE_DELETE_ARRAY(s_cinematicsId);
SAFE_DELETE_ARRAY(s_cinematicsFrameTime);
SAFE_DELETE_ARRAY_ARRAY(s_currentFramePos,s_cinematicsId_len);
// SAFE_DELETE_ARRAY_ARRAY(s_runningCinematicTrackActors,s_cinematicsId_len);
// SAFE_DELETE(Back_Img);
// SAFE_DELETE(mascot_asp);
SAFE_DELETE_ARRAY_ARRAY(s_infoasprite,s_infoasprite_len);
// SAFE_DELETE(pField);
///////////////////////
///////////////////////////////////////////////
/*
s_cinematics = GL_NEW byte**[cin_nums];
s_cinematics_sz_len = GL_NEW int[cin_nums];
s_cinematics_sz2_len = GL_NEW int*[cin_nums];
s_cinematicsId = GL_NEW short[cin_nums];
s_currentFramePos = GL_NEW int*[cin_nums];
m_ASpriteIns = GL_NEW ASpriteInstance**[cin_nums];
s_cinematics[c] = GL_NEW byte*[tracks_nums];
s_cinematics_sz2_len[c] = GL_NEW int[tracks_nums];
s_currentFramePos[c] = GL_NEW int[tracks_nums];
m_ASpriteIns[c] = GL_NEW ASpriteInstance*[tracks_nums];
s_infoasprite = GL_NEW int*[tracks_nums];
s_infoasprite[t] = GL_NEW int[4]; //sprite,ani,x,y
// 스프라이트를 로드시킨다.
m_ASpriteIns[c][t] = LoadSpriteInstance(uid);
s_cinematics[c][t] = GL_NEW byte[track_length + 2]; //2 more byte to store pos for use when reset
SAFE_DELETE_ARRAY(s_cinematicsFrameTime);
s_cinematicsFrameTime = GL_NEW short[cin_nums];
/// Reset_Cinematics();
SAFE_DELETE(data);
// 필드 추가
pField = _pField;
*/
}
//--------------------------------------------------------------------------
void cCinematic::Pause_Cinematics()
//--------------------------------------------------------------------------
{
s_cinematicsPause = true;
}
//--------------------------------------------------------------------------
void cCinematic::Resume_Cinematics()
//--------------------------------------------------------------------------
{
s_cinematicsPause = false;
// // 싱크를 맞추기 위해서 리줌을 해준다.
// Update_Cinematics();
// Update_Cinematics();
}
|
[
"[email protected]"
] |
[
[
[
1,
937
]
]
] |
6ad7061e4c5bdc535c7d034dee380e90c0eb6ee5
|
5236606f2e6fb870fa7c41492327f3f8b0fa38dc
|
/nsrpc/include/nsrpc/RpcReactorSession.h
|
e3de09cc08eb5a3d27e94de189330d728f7b5033
|
[] |
no_license
|
jcloudpld/srpc
|
aa8ecf4ffc5391b7183b19d217f49fb2b1a67c88
|
f2483c8177d03834552053e8ecbe788e15b92ac0
|
refs/heads/master
| 2021-01-10T08:54:57.140800 | 2010-02-08T07:03:00 | 2010-02-08T07:03:00 | 44,454,693 | 0 | 0 | null | null | null | null |
UHC
|
C++
| false | false | 2,034 |
h
|
#if !defined(NSRPC_RPCREACTORSESSION_H)
#define NSRPC_RPCREACTORSESSION_H
#ifdef _MSC_VER
# pragma once
#endif
#include "ReactorSession.h"
#include "PacketSeedExchangerCallback.h"
#include "detail/SessionRpcNetworkCallback.h"
#include <srpc/srpc_macros.h>
#include <boost/scoped_ptr.hpp>
namespace srpc
{
class RpcForwarder;
class RpcReceiver;
} // namespace srpc
namespace nsrpc
{
class SessionRpcNetwork;
class PacketSeedExchanger;
/**
* @class RpcReactorSession
* RPC ReactorSession
* - 현재는 클라이언트용 세션만 지원한다.
*/
class NSRPC_API RpcReactorSession : public ReactorSession,
private SessionRpcNetworkCallback,
protected PacketSeedExchangerCallback
{
public:
explicit RpcReactorSession(ACE_Reactor* reactor = 0,
PacketCoderFactory* packetCoderFactory = 0,
bool useBitPacking = true,
bool shouldUseUtf8ForString = true);
virtual ~RpcReactorSession();
void registerRpcForwarder(srpc::RpcForwarder& forwarder);
void registerRpcReceiver(srpc::RpcReceiver& receiver);
private:
void sendingFailed();
void receivingFailed();
protected:
virtual void onConnected();
virtual void onDisconnected();
virtual void onMessageArrived(CsMessageType messageType);
private:
/// 전송 중 에러가 발생하였다(marshaling 실패 등)
virtual void onSendError() = 0;
/// 수신 중 에러가 발생하였다(unmarshaling 실패 등)
virtual void onReceiveError() = 0;
private:
// = SessionRpcNetworkCallback overriding
virtual void sendNow(ACE_Message_Block& mblock,
CsMessageType messageType) {
sendMessage(mblock, messageType);
}
virtual void marshalingErrorOccurred() {
sendingFailed();
}
virtual void unmarshalingErrorOccurred() {
receivingFailed();
}
private:
boost::scoped_ptr<SessionRpcNetwork> rpcNetwork_;
boost::scoped_ptr<PacketSeedExchanger> seedExchanger_;
};
} // namespace nsrpc
#endif // !defined(NSRPC_RPCREACTORSESSION_H)
|
[
"kcando@6d7ccee0-1a3b-0410-bfa1-83648d9ec9a4"
] |
[
[
[
1,
80
]
]
] |
ae7c907459346bef35689a479578860793772fde
|
a84b013cd995870071589cefe0ab060ff3105f35
|
/webdriver/branches/android/third_party/gecko-1.9.0.11/win32/include/nsIDOMWindow2.h
|
73c88275823666e696e78349ca665dbdcad1a086
|
[
"Apache-2.0"
] |
permissive
|
vdt/selenium
|
137bcad58b7184690b8785859d77da0cd9f745a0
|
30e5e122b068aadf31bcd010d00a58afd8075217
|
refs/heads/master
| 2020-12-27T21:35:06.461381 | 2009-08-18T15:56:32 | 2009-08-18T15:56:32 | 13,650,409 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 3,690 |
h
|
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM e:/xr19rel/WINNT_5.2_Depend/mozilla/dom/public/idl/base/nsIDOMWindow2.idl
*/
#ifndef __gen_nsIDOMWindow2_h__
#define __gen_nsIDOMWindow2_h__
#ifndef __gen_nsIDOMWindow_h__
#include "nsIDOMWindow.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIDOMOfflineResourceList; /* forward declaration */
/* starting interface: nsIDOMWindow2 */
#define NS_IDOMWINDOW2_IID_STR "73c5fa35-3add-4c87-a303-a850ccf4d65a"
#define NS_IDOMWINDOW2_IID \
{0x73c5fa35, 0x3add, 0x4c87, \
{ 0xa3, 0x03, 0xa8, 0x50, 0xcc, 0xf4, 0xd6, 0x5a }}
class NS_NO_VTABLE NS_SCRIPTABLE nsIDOMWindow2 : public nsIDOMWindow {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMWINDOW2_IID)
/**
* Get the window root for this window. This is useful for hooking
* up event listeners to this window and every other window nested
* in the window root.
*/
/* [noscript] readonly attribute nsIDOMEventTarget windowRoot; */
NS_IMETHOD GetWindowRoot(nsIDOMEventTarget * *aWindowRoot) = 0;
/**
* Get the application cache object for this window.
*/
/* readonly attribute nsIDOMOfflineResourceList applicationCache; */
NS_SCRIPTABLE NS_IMETHOD GetApplicationCache(nsIDOMOfflineResourceList * *aApplicationCache) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMWindow2, NS_IDOMWINDOW2_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMWINDOW2 \
NS_IMETHOD GetWindowRoot(nsIDOMEventTarget * *aWindowRoot); \
NS_SCRIPTABLE NS_IMETHOD GetApplicationCache(nsIDOMOfflineResourceList * *aApplicationCache);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMWINDOW2(_to) \
NS_IMETHOD GetWindowRoot(nsIDOMEventTarget * *aWindowRoot) { return _to GetWindowRoot(aWindowRoot); } \
NS_SCRIPTABLE NS_IMETHOD GetApplicationCache(nsIDOMOfflineResourceList * *aApplicationCache) { return _to GetApplicationCache(aApplicationCache); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMWINDOW2(_to) \
NS_IMETHOD GetWindowRoot(nsIDOMEventTarget * *aWindowRoot) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetWindowRoot(aWindowRoot); } \
NS_SCRIPTABLE NS_IMETHOD GetApplicationCache(nsIDOMOfflineResourceList * *aApplicationCache) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetApplicationCache(aApplicationCache); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMWindow2 : public nsIDOMWindow2
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMWINDOW2
nsDOMWindow2();
private:
~nsDOMWindow2();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMWindow2, nsIDOMWindow2)
nsDOMWindow2::nsDOMWindow2()
{
/* member initializers and constructor code */
}
nsDOMWindow2::~nsDOMWindow2()
{
/* destructor code */
}
/* [noscript] readonly attribute nsIDOMEventTarget windowRoot; */
NS_IMETHODIMP nsDOMWindow2::GetWindowRoot(nsIDOMEventTarget * *aWindowRoot)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIDOMOfflineResourceList applicationCache; */
NS_IMETHODIMP nsDOMWindow2::GetApplicationCache(nsIDOMOfflineResourceList * *aApplicationCache)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMWindow2_h__ */
|
[
"alexber@07704840-8298-11de-bf8c-fd130f914ac9"
] |
[
[
[
1,
113
]
]
] |
774a9f66b6b8ac8f9613e2db9e30f5f0dcaa604a
|
580738f96494d426d6e5973c5b3493026caf8b6a
|
/Include/Vcl/qactnlist.hpp
|
fe09862431edfff8394500b9d9295e936fb6035e
|
[] |
no_license
|
bravesoftdz/cbuilder-vcl
|
6b460b4d535d17c309560352479b437d99383d4b
|
7b91ef1602681e094a6a7769ebb65ffd6f291c59
|
refs/heads/master
| 2021-01-10T14:21:03.726693 | 2010-01-11T11:23:45 | 2010-01-11T11:23:45 | 48,485,606 | 2 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 13,827 |
hpp
|
// Borland C++ Builder
// Copyright (c) 1995, 2002 by Borland Software Corporation
// All rights reserved
// (DO NOT EDIT: machine generated header) 'QActnList.pas' rev: 6.00
#ifndef QActnListHPP
#define QActnListHPP
#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <QImgList.hpp> // Pascal unit
#include <QTypes.hpp> // Pascal unit
#include <Types.hpp> // Pascal unit
#include <Qt.hpp> // Pascal unit
#include <Classes.hpp> // Pascal unit
#include <SysUtils.hpp> // Pascal unit
#include <SysInit.hpp> // Pascal unit
#include <System.hpp> // Pascal unit
//-- user supplied -----------------------------------------------------------
namespace Qactnlist
{
//-- type declarations -------------------------------------------------------
class DELPHICLASS ERegisterActionsException;
class PASCALIMPLEMENTATION ERegisterActionsException : public Sysutils::Exception
{
typedef Sysutils::Exception inherited;
public:
#pragma option push -w-inl
/* Exception.Create */ inline __fastcall ERegisterActionsException(const AnsiString Msg) : Sysutils::Exception(Msg) { }
#pragma option pop
#pragma option push -w-inl
/* Exception.CreateFmt */ inline __fastcall ERegisterActionsException(const AnsiString Msg, const System::TVarRec * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
#pragma option pop
#pragma option push -w-inl
/* Exception.CreateRes */ inline __fastcall ERegisterActionsException(int Ident)/* overload */ : Sysutils::Exception(Ident) { }
#pragma option pop
#pragma option push -w-inl
/* Exception.CreateResFmt */ inline __fastcall ERegisterActionsException(int Ident, const System::TVarRec * Args, const int Args_Size)/* overload */ : Sysutils::Exception(Ident, Args, Args_Size) { }
#pragma option pop
#pragma option push -w-inl
/* Exception.CreateHelp */ inline __fastcall ERegisterActionsException(const AnsiString Msg, int AHelpContext) : Sysutils::Exception(Msg, AHelpContext) { }
#pragma option pop
#pragma option push -w-inl
/* Exception.CreateFmtHelp */ inline __fastcall ERegisterActionsException(const AnsiString Msg, const System::TVarRec * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext) { }
#pragma option pop
#pragma option push -w-inl
/* Exception.CreateResHelp */ inline __fastcall ERegisterActionsException(int Ident, int AHelpContext)/* overload */ : Sysutils::Exception(Ident, AHelpContext) { }
#pragma option pop
#pragma option push -w-inl
/* Exception.CreateResFmtHelp */ inline __fastcall ERegisterActionsException(System::PResStringRec ResStringRec, const System::TVarRec * Args, const int Args_Size, int AHelpContext)/* overload */ : Sysutils::Exception(ResStringRec, Args, Args_Size, AHelpContext) { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~ERegisterActionsException(void) { }
#pragma option pop
};
class DELPHICLASS TContainedAction;
class DELPHICLASS TCustomActionList;
typedef void __fastcall (__closure *TActionEvent)(Classes::TBasicAction* Action, bool &Handled);
#pragma option push -b-
enum TActionListState { asNormal, asSuspended, asSuspendedEnabled };
#pragma option pop
class PASCALIMPLEMENTATION TCustomActionList : public Classes::TComponent
{
typedef Classes::TComponent inherited;
public:
TContainedAction* operator[](int Index) { return Actions[Index]; }
private:
Classes::TList* FActions;
Qimglist::TChangeLink* FImageChangeLink;
Qimglist::TCustomImageList* FImages;
Classes::TNotifyEvent FOnChange;
TActionEvent FOnExecute;
TActionEvent FOnUpdate;
TActionListState FState;
TContainedAction* __fastcall GetAction(int Index);
int __fastcall GetActionCount(void);
void __fastcall ImageListChange(System::TObject* Sender);
void __fastcall SetAction(int Index, TContainedAction* Value);
void __fastcall SetImages(Qimglist::TCustomImageList* Value);
void __fastcall SetState(const TActionListState Value);
protected:
void __fastcall AddAction(TContainedAction* Action);
void __fastcall RemoveAction(TContainedAction* Action);
virtual void __fastcall Change(void);
DYNAMIC void __fastcall GetChildren(Classes::TGetChildProc Proc, Classes::TComponent* Root);
virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation);
DYNAMIC void __fastcall SetChildOrder(Classes::TComponent* Component, int Order);
__property Classes::TNotifyEvent OnChange = {read=FOnChange, write=FOnChange};
__property TActionEvent OnExecute = {read=FOnExecute, write=FOnExecute};
__property TActionEvent OnUpdate = {read=FOnUpdate, write=FOnUpdate};
public:
__fastcall virtual TCustomActionList(Classes::TComponent* AOwner);
__fastcall virtual ~TCustomActionList(void);
DYNAMIC bool __fastcall ExecuteAction(Classes::TBasicAction* Action);
bool __fastcall IsShortCut(int Key, Classes::TShiftState Shift, const WideString KeyText);
DYNAMIC bool __fastcall UpdateAction(Classes::TBasicAction* Action);
__property TContainedAction* Actions[int Index] = {read=GetAction, write=SetAction/*, default*/};
__property int ActionCount = {read=GetActionCount, nodefault};
__property Qimglist::TCustomImageList* Images = {read=FImages, write=SetImages};
__property TActionListState State = {read=FState, write=SetState, nodefault};
};
class PASCALIMPLEMENTATION TContainedAction : public Classes::TBasicAction
{
typedef Classes::TBasicAction inherited;
private:
AnsiString FCategory;
TCustomActionList* FActionList;
int __fastcall GetIndex(void);
bool __fastcall IsCategoryStored(void);
void __fastcall SetCategory(const AnsiString Value);
void __fastcall SetIndex(int Value);
void __fastcall SetActionList(TCustomActionList* AActionList);
protected:
virtual void __fastcall ReadState(Classes::TReader* Reader);
DYNAMIC void __fastcall SetParentComponent(Classes::TComponent* AParent);
public:
__fastcall virtual ~TContainedAction(void);
DYNAMIC bool __fastcall Execute(void);
DYNAMIC Classes::TComponent* __fastcall GetParentComponent(void);
DYNAMIC bool __fastcall HasParent(void);
virtual bool __fastcall Update(void);
__property TCustomActionList* ActionList = {read=FActionList, write=SetActionList};
__property int Index = {read=GetIndex, write=SetIndex, stored=false, nodefault};
__published:
__property AnsiString Category = {read=FCategory, write=SetCategory, stored=IsCategoryStored};
public:
#pragma option push -w-inl
/* TBasicAction.Create */ inline __fastcall virtual TContainedAction(Classes::TComponent* AOwner) : Classes::TBasicAction(AOwner) { }
#pragma option pop
};
typedef TMetaClass*TContainedActionClass;
class DELPHICLASS TActionList;
class PASCALIMPLEMENTATION TActionList : public TCustomActionList
{
typedef TCustomActionList inherited;
__published:
__property Images ;
__property OnChange ;
__property OnExecute ;
__property OnUpdate ;
public:
#pragma option push -w-inl
/* TCustomActionList.Create */ inline __fastcall virtual TActionList(Classes::TComponent* AOwner) : TCustomActionList(AOwner) { }
#pragma option pop
#pragma option push -w-inl
/* TCustomActionList.Destroy */ inline __fastcall virtual ~TActionList(void) { }
#pragma option pop
};
typedef void __fastcall (__closure *THintEvent)(WideString &HintStr, bool &CanShow);
class DELPHICLASS TCustomAction;
class PASCALIMPLEMENTATION TCustomAction : public TContainedAction
{
typedef TContainedAction inherited;
private:
bool FDisableIfNoHandler;
WideString FCaption;
bool FChecked;
bool FEnabled;
Classes::THelpType FHelpType;
Classes::THelpContext FHelpContext;
AnsiString FHelpKeyword;
WideString FHint;
Qimglist::TImageIndex FImageIndex;
Classes::TShortCut FShortCut;
bool FVisible;
THintEvent FOnHint;
void __fastcall SetCaption(const WideString Value);
void __fastcall SetChecked(bool Value);
void __fastcall SetEnabled(bool Value);
virtual void __fastcall SetHelpContext(Classes::THelpContext Value);
virtual void __fastcall SetHelpKeyword(const AnsiString Value);
void __fastcall SetHelpType(Classes::THelpType Value);
void __fastcall SetHint(const WideString Value);
void __fastcall SetImageIndex(Qimglist::TImageIndex Value);
void __fastcall SetShortCut(Classes::TShortCut Value);
void __fastcall SetVisible(bool Value);
protected:
System::TObject* FImage;
System::TObject* FMask;
virtual void __fastcall AssignTo(Classes::TPersistent* Dest);
virtual void __fastcall SetName(const AnsiString Value);
public:
__fastcall virtual TCustomAction(Classes::TComponent* AOwner);
__fastcall virtual ~TCustomAction(void);
DYNAMIC bool __fastcall DoHint(WideString &HintStr);
DYNAMIC bool __fastcall Execute(void);
__property WideString Caption = {read=FCaption, write=SetCaption};
__property bool Checked = {read=FChecked, write=SetChecked, default=0};
__property bool DisableIfNoHandler = {read=FDisableIfNoHandler, write=FDisableIfNoHandler, default=1};
__property bool Enabled = {read=FEnabled, write=SetEnabled, default=1};
__property Classes::THelpContext HelpContext = {read=FHelpContext, write=SetHelpContext, default=0};
__property AnsiString HelpKeyword = {read=FHelpKeyword, write=SetHelpKeyword};
__property Classes::THelpType HelpType = {read=FHelpType, write=SetHelpType, default=0};
__property WideString Hint = {read=FHint, write=SetHint};
__property Qimglist::TImageIndex ImageIndex = {read=FImageIndex, write=SetImageIndex, default=-1};
__property Classes::TShortCut ShortCut = {read=FShortCut, write=SetShortCut, default=0};
__property bool Visible = {read=FVisible, write=SetVisible, default=1};
__property THintEvent OnHint = {read=FOnHint, write=FOnHint};
};
class DELPHICLASS TAction;
class PASCALIMPLEMENTATION TAction : public TCustomAction
{
typedef TCustomAction inherited;
__published:
__property Caption ;
__property Checked = {default=0};
__property Enabled = {default=1};
__property HelpContext = {default=0};
__property HelpKeyword ;
__property HelpType = {default=0};
__property Hint ;
__property ImageIndex = {default=-1};
__property ShortCut = {default=0};
__property Visible = {default=1};
__property OnExecute ;
__property OnHint ;
__property OnUpdate ;
public:
#pragma option push -w-inl
/* TCustomAction.Create */ inline __fastcall virtual TAction(Classes::TComponent* AOwner) : TCustomAction(AOwner) { }
#pragma option pop
#pragma option push -w-inl
/* TCustomAction.Destroy */ inline __fastcall virtual ~TAction(void) { }
#pragma option pop
};
class DELPHICLASS TActionLink;
class PASCALIMPLEMENTATION TActionLink : public Classes::TBasicActionLink
{
typedef Classes::TBasicActionLink inherited;
protected:
virtual bool __fastcall IsCaptionLinked(void);
virtual bool __fastcall IsCheckedLinked(void);
virtual bool __fastcall IsEnabledLinked(void);
virtual bool __fastcall IsHelpLinked(void);
virtual bool __fastcall IsHintLinked(void);
virtual bool __fastcall IsImageIndexLinked(void);
virtual bool __fastcall IsShortCutLinked(void);
virtual bool __fastcall IsVisibleLinked(void);
virtual void __fastcall SetCaption(const WideString Value);
virtual void __fastcall SetChecked(bool Value);
virtual void __fastcall SetEnabled(bool Value);
virtual void __fastcall SetHelpContext(Classes::THelpContext Value);
virtual void __fastcall SetHelpKeyword(const AnsiString Value);
virtual void __fastcall SetHelpType(Classes::THelpType Value);
virtual void __fastcall SetHint(const WideString Value);
virtual void __fastcall SetImageIndex(int Value);
virtual void __fastcall SetShortCut(Classes::TShortCut Value);
virtual void __fastcall SetVisible(bool Value);
public:
#pragma option push -w-inl
/* TBasicActionLink.Create */ inline __fastcall virtual TActionLink(System::TObject* AClient) : Classes::TBasicActionLink(AClient) { }
#pragma option pop
#pragma option push -w-inl
/* TBasicActionLink.Destroy */ inline __fastcall virtual ~TActionLink(void) { }
#pragma option pop
};
typedef TMetaClass*TActionLinkClass;
typedef void __fastcall (__closure *TEnumActionProc)(const AnsiString Category, TMetaClass* ActionClass, void * Info);
//-- var, const, procedure ---------------------------------------------------
#define QEventType_CMActionExecute (Qt::QEventType)(1005)
#define QEventType_CMActionUpdate (Qt::QEventType)(1006)
extern PACKAGE void __fastcall (*RegisterActionsProc)(const AnsiString CategoryName, TMetaClass* * AClasses, const int AClasses_Size, TMetaClass* Resource);
extern PACKAGE void __fastcall (*UnRegisterActionsProc)(TMetaClass* * AClasses, const int AClasses_Size);
extern PACKAGE void __fastcall (*EnumRegisteredActionsProc)(TEnumActionProc Proc, void * Info);
extern PACKAGE Classes::TBasicAction* __fastcall (*CreateActionProc)(Classes::TComponent* AOwner, TMetaClass* ActionClass);
extern PACKAGE void __fastcall RegisterActions(const AnsiString CategoryName, TMetaClass* * AClasses, const int AClasses_Size, TMetaClass* Resource);
extern PACKAGE void __fastcall UnRegisterActions(TMetaClass* * AClasses, const int AClasses_Size);
extern PACKAGE void __fastcall EnumRegisteredActions(TEnumActionProc Proc, void * Info);
extern PACKAGE Classes::TBasicAction* __fastcall CreateAction(Classes::TComponent* AOwner, TMetaClass* ActionClass);
} /* namespace Qactnlist */
using namespace Qactnlist;
#pragma option pop // -w-
#pragma option pop // -Vx
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // QActnList
|
[
"bitscode@7bd08ab0-fa70-11de-930f-d36749347e7b"
] |
[
[
[
1,
324
]
]
] |
2c16ded2de797006dc95ef80b3b9fae20780d691
|
28aa23d9cb8f5f4e8c2239c70ef0f8f6ec6d17bc
|
/mytesgnikrow --username hotga2801/Project/AdaboostFaceDetection/AdaboostFaceDetection/Global.cpp
|
3d42618ed5edef6c6698bd18cf1863c8b029ee0c
|
[] |
no_license
|
taicent/mytesgnikrow
|
09aed8836e1297a24bef0f18dadd9e9a78ec8e8b
|
9264faa662454484ade7137ee8a0794e00bf762f
|
refs/heads/master
| 2020-04-06T04:25:30.075548 | 2011-02-17T13:37:16 | 2011-02-17T13:37:16 | 34,991,750 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 15,302 |
cpp
|
#include "stdafx.h"
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <float.h>
using namespace std;
#include "IntImage.h"
#include "SimpleClassifier.h"
#include "AdaBoostClassifier.h"
#include "CascadeClassifier.h"
#include "Label.h"
#include "Global.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CString gSetup_Filename = _T("C:\\options.txt");
int gTotal_fp;
CString gTrainset_Filename;
CString gValidationset_Filename;
CString gClassifier_Filename;
CString gAda_Log_Filename;
CString gCascade_Filename;
CString gBootstrap_Database_Filename;
CString gBackup_Directory_Name;
CString gTestSet_Filename;
CString gTestSet_Label;
int gSx; //height
int gSy; //width
int gTrain_Method;
int linear_classifier;
int bootstrap_level;
int max_bootstrap_level;
vector<REAL> bootstrap_resizeratio;
vector<int> bootstrap_increment;
int gTotalFeatures;
int gMaxNumFiles;
REAL gNode_fp_Goal;
int gMaxNumNodes;
vector<int> gNof;
int gStartingNode;
int gFaceCount, gValidFaceCount;
IntImage* gTrainSet = NULL;
IntImage* gValidationSet = NULL;
int gTotalCount;
int gValidationCount;
CascadeClassifier* gCascade = NULL;
REAL* gWeights= NULL;
int** gTable= NULL;
WeakClassifier* gClassifiers = NULL;
REAL* gFeatures=NULL;
int* gLabels=NULL;
int* gFileUsed = NULL;
int gBootstrapSize;
CString* gBootstrap_Filenames = NULL;
REAL gMean_Min, gMean_Max, gSq_Min, gSq_Max, gVar_Min, gVar_Max;
vector<CLabel> gFaceLabels;
int gTotalLabel;
int gNumRightLabel;
int gNumWrongDetectedFace;
IplImage* gOrgImg = NULL;
CString gHomePath;
void WriteRangeFile(void)
// images are already integral images.
{
CString filename;
ofstream f;
filename = gHomePath + gCascade_Filename + _T(".range");
f.open(filename);
gMean_Min = REAL(gSx*gSy*256); gSq_Min = REAL(gSx*gSy*256*256); gVar_Min = 256;
gMean_Max = 0; gSq_Max = 0; gVar_Max = -256;
for(int i=0;i<gFaceCount;i++)
{
REAL ex, sq, v;
ex = sq = 0;
for(int j=1;j<gTrainSet[i].m_iHeight;j++)
for(int k=1;k<gTrainSet[i].m_iWidth;k++)
{
v = gTrainSet[i].m_Data[j][k]+gTrainSet[i].m_Data[j-1][k-1]-gTrainSet[i].m_Data[j-1][k]-gTrainSet[i].m_Data[j][k-1];
sq += (v*v);
}
ex = gTrainSet[i].m_Data[gSx][gSy];
gMean_Min = min(gMean_Min,ex);
gMean_Max = max(gMean_Max,ex);
gSq_Min = min(gSq_Min,sq);
gSq_Max = max(gSq_Max,sq);
gVar_Min = min(gVar_Min,gTrainSet[i].m_rVariance);
gVar_Max = max(gVar_Max,gTrainSet[i].m_rVariance);
}
gMean_Min *= REAL(0.90);
gMean_Max *= REAL(1.10);
gSq_Min *= REAL(0.90);
gSq_Max *= REAL(1.10);
gVar_Min *= REAL(0.90);
gVar_Max *= REAL(1.10);
f<<gMean_Min<<endl<<gMean_Max<<endl<<gSq_Min<<endl<<gSq_Max<<endl<<gVar_Min<<endl<<gVar_Max<<endl;
f.close();
}
void ReadRangeFile(void)
{
CString filename;
ifstream f;
filename = gHomePath + gCascade_Filename + _T(".range");
f.open(filename);
f>>gMean_Min>>gMean_Max>>gSq_Min>>gSq_Max>>gVar_Min>>gVar_Max;
f.close();
}
void ReadOneTrainingSample(ifstream& is,IntImage& image)
{
int i,j;
char buf[256];
ASSERT(gSx<=256 && gSy<=256);
is>>image.m_iLabel; is.ignore(256,'\n');
ASSERT( (image.m_iLabel == 0) || (image.m_iLabel == 1) );
is>>image.m_iHeight>>image.m_iWidth; is.ignore(256,'\n');
ASSERT(image.m_iHeight==gSx);
ASSERT(image.m_iWidth==gSy);
image.SetSize(CSize(image.m_iHeight+1,image.m_iWidth+1));
for(i=0;i<image.m_iHeight;i++) image.m_Data[i][0] = 0;
for(i=0;i<image.m_iWidth;i++) image.m_Data[0][i] = 0;
for(i=1;i<image.m_iHeight;i++)
{
is.read(buf,image.m_iWidth-1);
for(j=1;j<image.m_iWidth;j++)
{
image.m_Data[i][j] = REAL(int(unsigned char(buf[j-1])));
ASSERT(image.m_Data[i][j]>=0 && image.m_Data[i][j] <= 255);
}
}
is.ignore(256,'\n');
}
void GetFeatureValues0(REAL* const features,const int from,const int to,const int x1,const int x2,const int x3,const int y1,const int y3)
{
int i;
REAL f1;
REAL** data;
for(i=from;i<to;i++)
{
data = gTrainSet[i].m_Data;
f1 = data[x1][y3] - data[x1][y1] + data[x3][y3] - data[x3][y1]
+ 2*(data[x2][y1] - data[x2][y3]);
features[i] = f1 / gTrainSet[i].m_rVariance;
}
}
void GetFeatureValues1(REAL* const features,const int from,const int to,const int x1,const int x3,const int y1,const int y2,const int y3)
{
int i;
REAL f1;
REAL** data;
for(i=from;i<to;i++)
{
data = gTrainSet[i].m_Data;
f1 = data[x3][y1] + data[x3][y3] - data[x1][y1] - data[x1][y3]
+ 2*(data[x1][y2] - data[x3][y2]);
features[i] = f1 / gTrainSet[i].m_rVariance;
}
}
void GetFeatureValues2(REAL* const features,const int from,const int to,const int x1,const int x2,const int x3,const int x4,const int y1,const int y3)
{
int i;
REAL f1;
REAL** data;
for(i=from;i<to;i++)
{
data = gTrainSet[i].m_Data;
f1 = data[x1][y1] -data[x1][y3] + data[x4][y3] - data[x4][y1]
+ 3*(data[x2][y3] - data[x2][y1] + data[x3][y1] - data[x3][y3]);
features[i] = f1 / gTrainSet[i].m_rVariance;
}
}
void GetFeatureValues3(REAL* const features,const int from,const int to,const int x1,const int x3,const int y1,const int y2,const int y3,const int y4)
{
int i;
REAL f1;
REAL** data;
for(i=from;i<to;i++)
{
data = gTrainSet[i].m_Data;
f1 = data[x1][y1] - data[x1][y4] + data[x3][y4] - data[x3][y1]
+ 3*(data[x3][y2] - data[x3][y3] + data[x1][y3] - data[x1][y2] );
features[i] = f1 / gTrainSet[i].m_rVariance;
}
}
void GetFeatureValues4(REAL* const features,const int from,const int to,const int x1,const int x2,const int x3,const int y1,const int y2,const int y3)
{
int i;
REAL f1;
REAL** data;
for(i=from;i<to;i++)
{
data = gTrainSet[i].m_Data;
f1 = data[x1][y1] + data[x1][y3] + data[x3][y1] + data[x3][y3]
- 2*(data[x2][y1] + data[x2][y3] + data[x1][y2] + data[x3][y2])
+ 4*data[x2][y2];
features[i] = f1 / gTrainSet[i].m_rVariance;
}
}
void QuickSort(REAL* values,int* labels,const int lo,const int hi)
{
int i=lo, j=hi;
REAL v; int l;
REAL x = values[(lo+hi)/2];
do
{
while (values[i]<x) i++;
while (values[j]>x) j--;
if (i<=j)
{
v=values[i]; values[i]=values[j]; values[j]=v;
l=labels[i]; labels[i]=labels[j]; labels[j]=l;
i++; j--;
}
} while (i<=j);
if (lo<j) QuickSort(values,labels,lo, j);
if (i<hi) QuickSort(values,labels,i, hi);
}
void FillTheTable(int* const row,const WeakClassifier& sc)
{
int i;
int x1,x2,x3,x4,y1,y2,y3,y4;
x1 = sc.x1; y1 = sc.y1;
x2 = sc.x2; y2 = sc.y2;
x3 = sc.x3; y3 = sc.y3;
x4 = sc.x4; y4 = sc.y4;
switch(sc.m_iType)
{
case 0:GetFeatureValues0(gFeatures,0,gTotalCount,x1,x2,x3,y1,y3);break;
case 1:GetFeatureValues1(gFeatures,0,gTotalCount,x1,x3,y1,y2,y3);break;
case 2:GetFeatureValues2(gFeatures,0,gTotalCount,x1,x2,x3,x4,y1,y3);break;
case 3:GetFeatureValues3(gFeatures,0,gTotalCount,x1,x3,y1,y2,y3,y4);break;
case 4:GetFeatureValues4(gFeatures,0,gTotalCount,x1,x2,x3,y1,y2,y3);break;
}
for(i=0;i<gTotalCount;i++) row[i] = i;
QuickSort(gFeatures,row,0,gTotalCount-1);
}
const int CountTrainFaces()
{
int i,count;
count = 0;
for(i=0;i<gTotalCount;i++)
count += gTrainSet[i].m_iLabel;
return count;
}
const int CountValidFaces()
{
int i,count;
count = 0;
for(i=0;i<gValidationCount;i++)
count += gValidationSet[i].m_iLabel;
return count;
}
void InitializeWeights()
{
int i;
for(i=0;i<gFaceCount;i++) gWeights[i] = REAL(0.5)/gFaceCount;
for(i=gFaceCount;i<gTotalCount;i++) gWeights[i] = REAL(0.5)/(gTotalCount-gFaceCount);
}
void ReadClassifiers()
{
ifstream f;
int i;
f.open(gHomePath + gClassifier_Filename);
for(i=0;i<gTotalFeatures;i++) gClassifiers[i].ReadFromFile(f);
f.close();
}
void IgnoreComments(ifstream& f)
{
f.ignore(65536,'\n');
}
void ReadlnString(ifstream& f, CString& s)
{
char buf[256];
f.getline(buf,255,'\n');
s = buf;
}
void LoadOptions()
{
ifstream f;
int i;
f.open(gSetup_Filename);
IgnoreComments(f); ReadlnString(f,gTrainset_Filename);
IgnoreComments(f); ReadlnString(f,gValidationset_Filename);
IgnoreComments(f); ReadlnString(f,gClassifier_Filename);
IgnoreComments(f); ReadlnString(f,gAda_Log_Filename);
IgnoreComments(f); ReadlnString(f,gCascade_Filename);
IgnoreComments(f); ReadlnString(f,gBootstrap_Database_Filename);
gBackup_Directory_Name = _T("temp\\");
IgnoreComments(f); ReadlnString(f,gTestSet_Filename);
IgnoreComments(f); f>>gSx; IgnoreComments(f);
IgnoreComments(f); f>>gSy; IgnoreComments(f);
IgnoreComments(f); f>>bootstrap_level; IgnoreComments(f);
IgnoreComments(f); f>>max_bootstrap_level; IgnoreComments(f);
bootstrap_resizeratio.resize(max_bootstrap_level);
IgnoreComments(f); for(i=0;i<max_bootstrap_level;i++) f>>bootstrap_resizeratio[i]; IgnoreComments(f);
bootstrap_increment.resize(max_bootstrap_level);
IgnoreComments(f); for(i=0;i<max_bootstrap_level;i++) f>>bootstrap_increment[i]; IgnoreComments(f);
IgnoreComments(f); f>>gTotalFeatures; IgnoreComments(f);
IgnoreComments(f); f>>gMaxNumFiles; IgnoreComments(f);
IgnoreComments(f); f>>gNode_fp_Goal; IgnoreComments(f);
IgnoreComments(f); f>>gMaxNumNodes; IgnoreComments(f);
gNof.resize(gMaxNumNodes);
IgnoreComments(f); for(i=0;i<gMaxNumNodes;i++) f>>gNof[i]; IgnoreComments(f);
f.close();
}
void ReadTrainSet(CString filename)
{
ifstream f;
int i;
f.open(filename, ios_base::binary | ios_base::in);
f>>gTotalCount; f.ignore(256,'\n');
ASSERT(gTotalCount > 0);
delete[] gTrainSet; gTrainSet=NULL;
gTrainSet = new IntImage[gTotalCount]; ASSERT(gTrainSet != NULL);
for(i=0;i<gTotalCount;i++) ReadOneTrainingSample(f,gTrainSet[i]);
for(i=0;i<gTotalCount;i++) gTrainSet[i].CalculateVarianceAndIntegralImageInPlace();
f.close();
gFaceCount = CountTrainFaces();
}
void ReadValidSet(CString filename)
{
ifstream f;
int i;
f.open(filename, ios_base::binary | ios_base::in);
f>>gValidationCount; f.ignore(256,'\n');
ASSERT(gValidationCount > 0);
delete[] gValidationSet; gValidationSet=NULL;
gValidationSet = new IntImage[gValidationCount]; ASSERT(gValidationSet != NULL);
for(i=0;i<gValidationCount;i++) ReadOneTrainingSample(f,gValidationSet[i]);
for(i=0;i<gValidationCount;i++) gValidationSet[i].CalculateVarianceAndIntegralImageInPlace();
f.close();
gValidFaceCount = CountValidFaces();
}
void InitializeAuxiliaryVariables()
{
int i;
ASSERT(gTrainSet != NULL);
ASSERT(gTotalCount > 0);
delete[] gWeights; gWeights = NULL;
gWeights = new REAL[__max(gTotalCount,gValidationCount)]; ASSERT(gWeights != NULL);
InitializeWeights();
if(gTable!=NULL)
{
for(i=0;i<gTotalFeatures;i++)
{
delete[] gTable[i]; gTable[i] = NULL;
}
}
delete[] gTable; gTable = NULL;
gTable = new int*[gTotalFeatures]; ASSERT(gTable != NULL);
for(i=0;i<gTotalFeatures;i++)
{
gTable[i] = new int[gTotalCount];
ASSERT(gTable[i] != NULL);
}
delete[] gFeatures; gFeatures = NULL;
gFeatures = new REAL[__max(gTotalCount,gValidationCount)]; ASSERT(gFeatures != NULL);
delete[] gLabels; gLabels = NULL;
gLabels = new int[__max(gTotalCount,gValidationCount)]; ASSERT(gLabels!=NULL);
}
void SaveTrainSet(CString filename)
{
ofstream f;
int i;
f.open(filename,ios_base::out | ios_base::binary);
f<<gTotalCount<<endl;
unsigned char writebuf[24*24];
for(i=0;i<gTotalCount;i++)
{
int k,t;
f<<gTrainSet[i].m_iLabel<<endl;
f<<gSx<<" "<<gSy<<endl;
for(k=0;k<gSx;k++)
for(t=0;t<gSy;t++)
writebuf[k*gSx+t] = (unsigned char)((int)(gTrainSet[i].m_Data[k+1][t+1]-gTrainSet[i].m_Data[k][t+1]-gTrainSet[i].m_Data[k+1][t]+gTrainSet[i].m_Data[k][t]));
f.write((char*)writebuf,gSx*gSy);
f<<endl;
}
f.close();
}
void SaveValidSet(CString filename)
{
ofstream f;
int i;
f.open(filename,ios_base::out | ios_base::binary);
f<<gValidationCount<<endl;
unsigned char writebuf[24*24];
for(i=0;i<gValidationCount;i++)
{
int k,t;
f<<gValidationSet[i].m_iLabel<<endl;
f<<gSx<<" "<<gSy<<endl;
for(k=0;k<gSx;k++)
for(t=0;t<gSy;t++)
writebuf[k*gSx+t] = (unsigned char)((int)(gValidationSet[i].m_Data[k+1][t+1]-gValidationSet[i].m_Data[k][t+1]-gValidationSet[i].m_Data[k+1][t]+gValidationSet[i].m_Data[k][t]));
f.write((char*)writebuf,gSx*gSy);
f<<endl;
}
f.close();
}
void ReadBootstrapFileNames()
{
ifstream f;
int i;
f.open(gHomePath + gBootstrap_Database_Filename);
f>>gBootstrapSize; IgnoreComments(f);
gBootstrap_Filenames = new CString[gBootstrapSize]; ASSERT(gBootstrap_Filenames!=NULL);
for(i=0;i<gBootstrapSize;i++) ReadlnString(f,gBootstrap_Filenames[i]);
f.close();
}
void InitGlobalData()
{
int i;
srand((unsigned)time(NULL));
LoadOptions();
ReadTrainSet(gHomePath + gTrainset_Filename);
ReadValidSet(gHomePath + gValidationset_Filename);
InitializeAuxiliaryVariables();
ReadBootstrapFileNames();
gCascade = new CascadeClassifier;
ASSERT(gCascade != NULL);
gCascade->LoadDefaultCascade();
gStartingNode = gCascade->m_iCount+1;
gClassifiers = new WeakClassifier[gTotalFeatures]; ASSERT(gClassifiers != NULL);
ReadClassifiers();
gFileUsed = new int[gMaxNumFiles]; ASSERT(gFileUsed != NULL);
for(i=0;i<gMaxNumFiles;i++) gFileUsed[i] = 0;
ReadRangeFile();
}
void ClearUpGlobalData()
{
//gSetup_Filename.Empty();
gTrainset_Filename.Empty();
gValidationset_Filename.Empty();
gClassifier_Filename.Empty();
gAda_Log_Filename.Empty();
gCascade_Filename.Empty();
gBootstrap_Database_Filename.Empty();
gBackup_Directory_Name.Empty();
gTestSet_Filename.Empty();
gSx = gSy = 0;
gTrain_Method = 0;
linear_classifier = 0;
bootstrap_level = 0;
max_bootstrap_level = 0;
bootstrap_resizeratio.clear();
bootstrap_increment.clear();
gMaxNumFiles = 0;
gNode_fp_Goal = 0.0;
gMaxNumNodes = 0;
gNof.clear();
if(gTrainSet)
{
delete[] gTrainSet;
gTrainSet = NULL;
}
if(gValidationSet)
{
delete[] gValidationSet;
gValidationSet = NULL;
}
gTotalCount = gValidationCount = 0;
if(gCascade)
{
delete gCascade;
gCascade = NULL;
}
if(gWeights)
{
delete[] gWeights;
gWeights = NULL;
}
if(gTable)
{
for(int i=0;i<gTotalFeatures;i++)
{
delete[] gTable[i];
gTable[i] = NULL;
}
gTotalFeatures = 0;
delete[] gTable;
gTable = NULL;
}
if(gClassifiers)
{
delete[] gClassifiers;
gClassifiers = NULL;
}
if(gFeatures)
{
delete[] gFeatures;
gFeatures = NULL;
}
if(gLabels)
{
delete[] gLabels;
gLabels = NULL;
}
if(gFileUsed)
{
delete[] gFileUsed;
gFileUsed = NULL;
}
gBootstrapSize = 0;
if(gBootstrap_Filenames)
{
delete[] gBootstrap_Filenames;
gBootstrap_Filenames = NULL;
}
if(gOrgImg)
{
cvReleaseImage(&gOrgImg);
gOrgImg = NULL;
}
}
void NormalizeWeight()
{
REAL sum;
int i;
sum = 0.0;
for(i=0;i<gTotalCount;i++) sum += gWeights[i];
for(i=0;i<gTotalCount;i++) gWeights[i] /= sum;
}
|
[
"hotga2801@ecd9aaca-b8df-3bf4-dfa7-576663c5f076"
] |
[
[
[
1,
608
]
]
] |
f185439926168fe32920d0d4dadda451928c751a
|
72a2eb6600382e79f3a099775c8c2cf924cb7acb
|
/VirtualMachine_deprecated/Parser.h
|
5c81e2df6ac814aafce96cb14115b8050da0c8eb
|
[] |
no_license
|
beuville/minesweepersolver
|
b8d666fd7ffcb5f48be3cc6454e3f2aba5fbe910
|
7940175a15d356dea243d236559fe16cb9b758e5
|
refs/heads/master
| 2021-01-25T07:35:18.270328 | 2008-12-02T15:21:52 | 2008-12-02T15:21:52 | 32,225,286 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 21,624 |
h
|
#ifndef PARSER_H_
#define PARSER_H_
#include <string>
#include <sstream>
#include <iostream>
#include <fstream>
#include "GameInterface.h"
#define FALSE 0
#define DECLARE 100
#define UPDATE 101
#define EVALUATE 102
#define MARKER 103
#define GOTO 104
#define DISPLAY 200
#define GAMESPEC 404
#define VALUE "<val>"
#define NAME "<nam>"
#define CONDITION "<cnd>"
using namespace std;
/* symbol_table is a single entry in the symbol table array containing information about
variable declarations, loops, and control statments
these will be the commands found in the symbol table. Due to the fact that commands will
be read in from a config file however, they are subject to change.
name: value:
int int value
float float value
if next else line# or eif line# if no else present
eif if line#
elseif next else line# or eif if last else statement
else next else line# or eif if last else statement
for efor line#
efor for line#
do edo line#
edo do line#
while ewhile line#
ewhile while line#
location:
each command in symbol table will have the array index that it can be found at in parsed programs source
count:
each variable, and each group of if/else/eif, for/efor, do/edo, while/ewhile will have a unique count to
identify themselves and group together control/loop structures.
*/
struct symbol_table{
string name;
double value;
int location;
int count;
};
/* actions are individual lines in the actions array. They are read in from a config file and tell the parser what
action to take when a given command is read in. This allows the parseing language to be defined somewhat
dynamically from said config file. This also focuses the language definition into one location so later
communications with the main program will be synchronized by reading the same file.
sytnax will be used in conjunction with regular expression matching to identify commands.
See actions.cfg
*/
struct action_struct{
string command;
string action;
string link;
string syntax;
};
/* pre_parse_array is a tool used to reduce lookups to other arrays while storing pre-parse relevant information in
single struct elements. During pre parse an array of these will be used to store information temporarily about each
line of program code.
*/
struct pre_parse_array{
int action_index;
int symbol_index;
string variables;
};
class Parser{
public:
Parser(string * code, int pcount, string cfg_path);
~Parser();
void loadcfg(string cfg_path);
void preparse();
int get_action(string line); //returns action index of a given line
int action_to_int(string action); //returns int action values based on string conversion
string get_variables(string line, string syntax); //returns variables from a given line of code based on syntax froma actions.cfg
string get_value(string line,string var_type); //function for returning specific variable values from coded get_varibales strings
int get_next_link(string command, string links, int pcount); //negotiates evaluate commands
string eval_link(string command,string links); //helper function for get_next_link
double parse();
string lookup_replace(string cmd);//lookup and replace
double lookup_eval(string vars); //lookup and evaluate
void disp_at();
void disp_st();
void disp_ppa();
private:
int p_count; //holds the length of the code array
int a_count; //holds the lenght of the actions array
int s_count; //holds the lenght of the symbol table array
string * program; //program array
symbol_table * st; //symbol table array
action_struct * actions; //action list array
pre_parse_array * ppa; //meta-data for program code
GameInterface gi;
};
//float to string converter used in lookup_replace
string float_to_a(const double value)
{
stringstream converter;
string str;
converter << value;
converter >> str;
return str;
}
Parser::Parser(string * code, int pcount, string cfg_path){
p_count = pcount; //assign length of code to private variable
//load up the program array
program = new string[p_count];
//line by line
for(int i = 0;i<p_count;i++){
program[i]=code[i];
}
loadcfg(cfg_path); //load configuration file into memory
cout << "configuration loaded\n";
gi.initGame("easy",-1); //initialize game board
cout << "game initialized\n";
preparse(); //load symbol table, and ppa
cout << "preparse completed\n";
}
/*Destructor
*/
Parser::~Parser(){
delete[] actions;
delete[] st;
delete[] ppa;
}
/*loadcfg
* open the config file and read the actions into the actions array
* ignore lines starting with #
* also dynamically allocates actions array
* returns 0 on success, error codes for file not found etc
*/
void Parser::loadcfg(string cfg_path){
//initialize
ifstream cfg_fp;
char line_in[256];
char * next_token;
int line_count = 0;
//open config file
cfg_fp.open(cfg_path.c_str(),ifstream::in);
//count lines that are not commented (don't begin with #)
while(cfg_fp.getline(line_in,256)){
if(line_in[0] != '#'){
line_count++;
}
}
//rewind config file
cfg_fp.clear();
cfg_fp.seekg(0,ios::beg);
//allocate actions memory
actions = new action_struct[line_count];
a_count = line_count; //store the actions count in a private variable
//fill actions table
line_count=0;
while(cfg_fp.getline(line_in,256)){
if(line_in[0] != '#'){
actions[line_count].command=strtok_s(line_in,"\t",&next_token);
actions[line_count].action=strtok_s(NULL,"\t",&next_token);
actions[line_count].link=strtok_s(NULL,"\t",&next_token);
actions[line_count].syntax=strtok_s(NULL,"\t",&next_token);
line_count++;
}
}
//cleanup
cfg_fp.close();
}
/*preparse
* load the symbol table according to actions array
*/
void Parser::preparse(){
int symbol_count = 0; //counter for lines in the symbol table
ppa = new pre_parse_array[p_count]; //allocate meta-data table entries for each line of code
//go line by line through program code to determine the size of the symbol table
//all declare, evaluate, marker and goto commands will need entries in the symbol
//table
for(int i=0;i<p_count;i++){
//load ppa entry
ppa[i].action_index = get_action(program[i]);
//dont get variables for game specific commands
if(ppa[i].action_index != 0){
ppa[i].variables = get_variables(program[i],actions[ppa[i].action_index].syntax);
}
//switch action value, because the first step will be to count space needed in
// the symbol table, each action that requires room in the symbol table
// (declare,evaluate,marker,goto)
switch(action_to_int(actions[ppa[i].action_index].action)){
case DECLARE:
case EVALUATE:
case MARKER:
case GOTO:
case GAMESPEC: symbol_count++; break;
}
}
symbol_count+=1;//make room for the gamespec return variable
//with symbol_count accurate, time to allocate the symbol table array
st = new symbol_table[symbol_count];
s_count = symbol_count;
//populte the symbol table based on actions. for more detail view the programming language definition.
//start by looping the program array once again, we need a value to hold the next open location in symbol
// table, we will re-use symbol_count now that s_count permantly holds its value.
//first create a variable at location 0 that will hold the return value from gamspec commands
st[0].name = "GSRETURN";
st[0].value = 0;
st[0].count = -1;
st[0].location = 0;
symbol_count = 1;
//cmd_count will serve to act as the 'count' variable for symbol table entries
//opening and closing statements for loop and conditional statements will have the same count value
//while symbol_count is updated after every entry in the symbol table, cmd_count will only be updated
//after a command group is completely filled (i.e when the end if for an if structure is logged)
int cmd_count =0;
int next_link;
//This is the main loop responsible for filling the symbol table
for(int i=0;i<p_count;i++){
//-after each sucessfull entry in the symbol table symbol_count needs to be incremented
//-for detailed information about preparser actions, consult the programming language definition
switch(action_to_int(actions[ppa[i].action_index].action)){
case DECLARE:
st[symbol_count].name = get_value(ppa[i].variables,NAME);//load name
st[symbol_count].value = atof(get_value(ppa[i].variables,VALUE).c_str());//load value
st[symbol_count].location = i; //load location
st[symbol_count].count = cmd_count; //load count
ppa[i].symbol_index = symbol_count;
cmd_count++;
symbol_count++;
break;
//evaluate commands (if, elseif, and for) will have symbol table entries based on their link properties
case EVALUATE:
next_link = i;
//resolve the links
do{
ppa[next_link].symbol_index = symbol_count;
st[symbol_count].name = actions[ppa[next_link].action_index].command;//load name
st[symbol_count].location = next_link; //load location
next_link = get_next_link(actions[ppa[next_link].action_index].command,actions[ppa[next_link].action_index].link,next_link);
st[symbol_count].value = next_link; //load value
st[symbol_count].count = cmd_count; //load count
symbol_count++;
}while(actions[ppa[next_link].action_index].link.compare("nill")!=0);
//closing statement entries in the symbol table (eif, efor, etc)
st[symbol_count].name = actions[ppa[next_link].action_index].command;//load name
st[symbol_count].location = next_link; //load location
st[symbol_count].value = i; //back to the top for the value
st[symbol_count].count = cmd_count; //load count
ppa[next_link].symbol_index = symbol_count;
symbol_count++;
cmd_count++;
break;
case GAMESPEC:
st[symbol_count].name = "gamespec";
st[symbol_count].location = i;
st[symbol_count].value = i;
st[symbol_count].count = -1;
ppa[i].symbol_index = symbol_count;
symbol_count++;
break;
case UPDATE:
ppa[i].symbol_index = -1;
break;
}
}
}
/* get_action
* returns the index of the action associated with a given line
*/
int Parser::get_action(string line){
//check the actions table line by line to compare syntax with the parameter line
//if a syntax matches return the appropriate action.
for(int i =0;i<a_count;i++){
//due to the fact that the programming language definition demands that all syntax be
// prefixed by the command name, identifying the action can be accomplised with simple
// string parsing
//if the line has an occurance of the name of a function defined by actions.cfg then
// we can return the corresponding action index.
if(line.find(actions[i].command,0) == 0){
return i;
}
}
//no syntax matched, we will return a value that will associate this line with game-specific commands
return 0;
}
/* get_variables
* returns a coded string containing all variables from a given line of code based on syntax from the actions.cfg fing
* strings will be returned in the format <var>value,<var2>value2,... example: <nam>var1,<val>100
*/
string Parser::get_variables(string line, string syntax){
string ret = "";
//as long as there are more variables to be found...
while(syntax.find_first_of('<') != string::npos){
//remove syntactical prefixes
line=line.substr(syntax.find_first_of('<'));
syntax=syntax.substr(syntax.find_first_of('<'));
//append next variable type
ret = ret + syntax.substr(0,5);
//remove variable tag to get to next separator
syntax=syntax.substr(5);
//append variable value and a separator (',')
ret = ret + line.substr(0,line.find_first_of(syntax.substr(0,syntax.find_first_of('<')))) + ',';
//remove variable up to next separtor from line
line = line.substr(line.substr(0,line.find_first_of(syntax.substr(0,syntax.find_first_of('<')))).length());
}
return ret;
}
/* get_value
* returns a value based on a given variable type (<nam><val><cnd>)
*/
//get_nam
string Parser::get_value(string line, string var_type){
int start = line.find(var_type) + var_type.length();
string s1 = line.substr(start,line.find_first_of(',',start)-start);
//trim then return
s1=s1.substr(s1.find_first_not_of(' '),s1.find_last_not_of(' ')+1);
return s1;
}
/* get_next_link
* returns the line number of the next link related to a given command. starting at pcount for example
* command: if links: elseif|else|endif
* will search for the next elseif,else while negotiating nested if commands.
*/
int Parser::get_next_link(string command, string links, int pcount){
int nest_count=0;
//loop doesnt check to make sure pcount stays within the program array max index, but a well formed
//program should never raise such an exception
while(true){
//start with the line after the give command, contines as incrementor
pcount +=1;
//if we come accros another command of the same type, we have found a nested conditoin
if(actions[get_action(program[pcount])].command.compare(command.c_str())==0){
nest_count +=1;
}
//found a match!
if(eval_link(program[pcount],links)!= "")
{
//if nest count is not zero we have jumped into another struture's nesting
if(nest_count != 0){
//if the current line of code we are examining has no link value(link==nill),we must decrement the nest_count
//this can be determined with a simple lookup in the actions table
for(int i = 0;i<a_count;i++){
//found the command
if(program[pcount].compare(actions[i].command)==0){
if(actions[i].link.compare("nill")==0){
nest_count -=1;
}
}
}
}
//found our match
else{
return pcount;
}
}
}
}
/* eval_link
* returns the matched link if one occurs in string, essentiall a helper function for get_next_link
*/
string Parser::eval_link(string command,string links){
while(links.length() != 0)
{
if(links.find_first_of('|') == string::npos){
if(links.compare(command) == 0){
return command;
}
return "";
}
else{
//cout <<links.substr(0,links.find_first_of('|')) << "\n";
if(command.compare(links.substr(0,links.find_first_of('|'))) == 0){
return command;
}
links.erase(0,links.find_first_of('|') + 1);
}
}
return "";
}
//factoring out of a commonly used specific string to integer converter
int Parser::action_to_int(string action){
if(action.compare("declare")==0){return DECLARE;}
else if(action.compare("evaluate")==0){return EVALUATE;}
else if(action.compare("update")==0){return UPDATE;}
else if(action.compare("marker")==0){return MARKER;}
else if(action.compare("goto")==0){return GOTO;}
else if(action.compare("gamespec")==0){return GAMESPEC;}
else if(action.compare("display")==0){return DISPLAY;}
else{return -1;}
}
/*parse
* parse the array of code lines
*/
double Parser::parse(){
int pc = 0;//program counter
string s1;
string s2;
//go the program line by line, use the ppa in conjuntion with actions table and symbol
//table to determine the necessary action
while(pc < p_count){ //as long as pc has not exceeded the total length of the program, keep executing
//switch the action associated with the current line of code pointed to by pc
switch(action_to_int(actions[ppa[pc].action_index].action)){
//for specific information on what actions are taken in the parseing stage see
//programming language definition
case UPDATE:
//replace variable names in 'value' field with lookups from the symbol table
//lookup update variable name
s1 = get_value(ppa[pc].variables,NAME);//value name
for(int i=0;i<s_count;i++){
//if the name field from the program line and the symbol table name are the same
s2 = string(st[i].name);//symbol table name
if(s1.compare(s2)==0){
//update the value in the symbol table
st[i].value = lookup_eval(get_value(ppa[pc].variables,VALUE));
break;
}
}
pc+=1;
break;
case GOTO:
//move the pc to the line number indicated by the symbol table
pc=(int)st[ppa[pc].symbol_index].value;
break;
case EVALUATE:
//lookup_eval the condition, if it is false (0), move pc to one line past the link value
if(lookup_eval(get_value(ppa[pc].variables,CONDITION)) == FALSE){
pc = (int)st[ppa[pc].symbol_index].value + 1;
}
else{ //if it is true increment pc
pc+=1;
}
break;
case GAMESPEC:
//return value from sendCommand is stored at location 0(GSRETURN) in the symbol table
st[0].value = gi.sendCommand(lookup_replace(program[pc]));
//after every game specific command we will evaluate the status of the game
if(gi.report_status()==false){
//if the previously issued command ended the game, we will return the completion
//percentage of the board, otherwise, play on
return gi.report();
}
pc+=1;
break;
case DISPLAY:
if(actions[get_action(program[pc])].command.compare("disp")==0){
s1 = get_value(ppa[pc].variables,NAME);//value name
for(int i=0;i<s_count;i++){
//if the name field from the program line and the symbol table name are the same
s2 = string(st[i].name);//symbol table name
if(s1.compare(s2)==0){
//output the value
cout << "msso: " << st[i].value<<"\n";
break;
}
}
}
else if(actions[get_action(program[pc])].command.compare("write")==0){
cout << "msso: " << get_value(ppa[pc].variables,NAME)<<"\n";
}
pc+=1;
break;
default:
pc+=1;
}
}
//if the whole program loop falls through, return the status of board
return gi.report_status();
}
/* lookup_replace
* return a string containing values for any variables found in cmd string, replaced from
* symbol table (used specifically in handling GAMESPEC commands)
* currently this function assumes variables will appear only onces in a given string
* furthermore, this function will not negotiate variable operations within the string
* i.e picsq x+1,y+2 however, it is possible to use lookup_eval to accomplish this, just not now
*/
string Parser::lookup_replace(string cmd){
//loop through the symbol table
for(int i =0;i<s_count;i++){
string::size_type loc = cmd.find(st[i].name);
//found a match
if(loc != string::npos){
//erase variable name
cmd.erase(loc,st[i].name.length());
//insert new value
cmd.insert(loc,float_to_a(st[i].value));
}
}
//once all replacements have been made, return the string.
return cmd;
}
/* lookup_eval
* lookup the values of variables in the string vars, then evaluate the string returing an integer value
*/
double Parser::lookup_eval(string vars){
char op;
string s1;
string s2;
double var1;
double var2;
for(unsigned int i = 0;i < vars.length();i++){
switch(vars[i]){
//find the location of operator
case '*':
case '/':
case '+':
case '-':
case '=':
case '<':
case '>':
case '#':
case '$':
case '%':
case '!':
//store the operator
op = vars[i];
//parse,lookup the operands
s1 = vars.substr(0,i);
s2 = vars.substr(i+1,vars.length());
//trim strings
s1=s1.substr(s1.find_first_not_of(' '),s1.find_last_not_of(' ')+1);
s2=s2.substr(s2.find_first_not_of(' '),s2.find_last_not_of(' ')+1);
//initialize variables
var1=atof(s1.c_str());
var2=atof(s2.c_str());
//lookup variable values
for(int j =0;j<s_count;j++){
if(s1.compare(st[j].name)==0){
var1 = st[j].value;
}
}
for(int j =0;j<s_count;j++){
if(s2.compare(st[j].name)==0){
var2 = st[j].value;
}
}
//evaluate and return
switch(op){
case '*':
return var1 * var2;
break;
case '/':
return var1 / var2;
break;
case '+':
return var1 + var2;
break;
case '-':
return var1 - var2;
break;
case '=':
return var1 == var2;
break;
case '<':
return var1 < var2;
break;
case '>':
return var1 > var2;
break;
case '#':
return var1 <= var2;
break;
case '$':
return var1 >= var2;
break;
case '%':
return (int)var1 % (int)var2;
break;
case '!':
return var1 != var2;
break;
}
}
}
//if the loop falls through, there were no operators, lookup the value
//lookup variable values
for(int j =0;j<s_count;j++){
if(vars.compare(st[j].name)==0){
return st[j].value;
}
}
//or return the value
return atoi(vars.c_str());
}
//crude display functions
void Parser:: disp_at(){
cout << "cmd\tact\tlnk\tstx\n";
for(int i=0;i<a_count;i++){
cout <<actions[i].command<<"\t"<<actions[i].action<<"\t"<<actions[i].link<<"\t"<<actions[i].syntax<<"\n";
}
cout <<"\n";
}
void Parser:: disp_st(){
cout << "name\tvalu\tloca\tcoun\n";
for(int i=0;i<s_count;i++){
cout<<st[i].name<<"\t"<<st[i].value<<"\t"<<st[i].location<<"\t"<<st[i].count<<"\n";
}
cout <<"\n";
}
void Parser:: disp_ppa(){
for(int i=0;i<p_count;i++){
cout <<ppa[i].action_index<<"\t"<<ppa[i].symbol_index<<"\t"<<program[i]<<"\t"<<ppa[i].variables<<"\n";
}
cout <<"\n";
}
#endif //PARSER_H_
|
[
"[email protected]@7e498df5-8955-0410-9177-9339b6f37624"
] |
[
[
[
1,
650
]
]
] |
8c116a1b9ddcee02518e18ec22648caf7c9b446e
|
000b887c9052e3af1cfb46e671c0f71a56576af1
|
/LD18_Source/src/window_win.cpp
|
a6bb20c99c29ce89a34a0c817f81046e3d6954bf
|
[] |
no_license
|
PhilCK/LD18
|
781c999a395f64ead76bcc174908e8ec9eb21f58
|
a9ca4bd0224900382fb9ffda5ea934a70057b16f
|
refs/heads/master
| 2021-01-10T18:40:44.982764 | 2010-08-23T19:32:41 | 2010-08-23T19:32:41 | 855,157 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 687 |
cpp
|
// window_win.cpp
#include <Gosu/Autolink.hpp>
#include <iso646.h>
#include "window.hpp"
#include "game.hpp"
#include "object_manager.hpp"
class GameWindow : public Gosu::Window
{
Game game;
public:
GameWindow()
: Gosu::Window(Screen::Width, Screen::Height, Screen::Fullscreen)
{
setCaption(L"LD 18");
}
void draw()
{
game.draw();
}
void update()
{
game.update();
if (input().down(Gosu::kbEscape))
close();
}
void buttonUp(Gosu::Button button)
{
game.buttonUp(button);
}
};
Gosu::Window& windowInstance() {
static GameWindow game;
return game;
}
int main()
{
windowInstance().show();
}
|
[
"[email protected]"
] |
[
[
[
1,
54
]
]
] |
dc0593c0a7edc3b5c704e7487bba79c9d000ed28
|
d37a1d5e50105d82427e8bf3642ba6f3e56e06b8
|
/DVR/HaohanITPlayer/public/Common/SysUtils/FieldDoubleConversion.h
|
034eab867fb8a8338bd26584b3cd82fa5d2ec98b
|
[] |
no_license
|
080278/dvrmd-filter
|
176f4406dbb437fb5e67159b6cdce8c0f48fe0ca
|
b9461f3bf4a07b4c16e337e9c1d5683193498227
|
refs/heads/master
| 2016-09-10T21:14:44.669128 | 2011-10-17T09:18:09 | 2011-10-17T09:18:09 | 32,274,136 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,071 |
h
|
//-----------------------------------------------------------------------------
// FieldDoubleConversion.h
// Copyright (c) 1999 - 2004, Haohanit. All rights reserved.
//-----------------------------------------------------------------------------
//SR FS: Reviewed [JAW 20040912]
//SR FS: Reviewed [wwt 20040915]: safe input param; no MBCS; no dangerous API; no registry/sys folder/temp file
#ifndef __FIELDDOUBLECONVERSION__
#define __FIELDDOUBLECONVERSION__
#include <cmath>
#include "video_const.h"
inline
double FieldsToDouble(UInt32 fields, eVideoRate rate)
{
if (rate == eVideoRate525_60) return fields * videoFieldRate525_60;
else if (rate == eVideoRate625_50) return fields * videoFieldRate625_50;
return 0;
}
inline
UInt32 DoubleToFields(double time, eVideoRate rate)
{
if (rate == eVideoRate525_60) return static_cast<UInt32>( std::floor((time / videoFieldRate525_60) + .5) );
else if (rate == eVideoRate625_50) return static_cast<UInt32>( std::floor((time / videoFieldRate625_50) + .5) );
return 0;
}
#endif
|
[
"[email protected]@27769579-7047-b306-4d6f-d36f87483bb3"
] |
[
[
[
1,
31
]
]
] |
9c2ba8710fc8f7d888acf3b7e2b207a31a32e323
|
bfdfb7c406c318c877b7cbc43bc2dfd925185e50
|
/stdlib/ffi/HSca_Stack.cpp
|
407a4ccef7ba050f531b1dce31a3b3e7b9f7cb38
|
[
"MIT"
] |
permissive
|
ysei/Hayat
|
74cc1e281ae6772b2a05bbeccfcf430215cb435b
|
b32ed82a1c6222ef7f4bf0fc9dedfad81280c2c0
|
refs/heads/master
| 2020-12-11T09:07:35.606061 | 2011-08-01T12:38:39 | 2011-08-01T12:38:39 | null | 0 | 0 | null | null | null | null |
SHIFT_JIS
|
C++
| false | false | 1,287 |
cpp
|
/* -*- coding: sjis-dos; -*- */
/*
* copyright 2010 FUKUZAWA Tadashi. All rights reserved.
*/
#include "HSca_Stack.h"
FFI_DEFINITION_START {
// new(n)で生成したインスタンスの初期化
ValueStack* FFI_FUNC(initialize) (Value selfVal, hys32 initCapacity)
{
FFI_DEBUG_ASSERT_INSTANCEMETHOD(selfVal);
ValueStack* self = selfVal.toCppObj<ValueStack>(HSym_Stack);
self->initialize((hyu32)initCapacity);
return self;
}
hys32 FFI_FUNC(hashCode) (Value selfVal)
{
FFI_DEBUG_ASSERT_INSTANCEMETHOD(selfVal);
// 中身を見ない手抜き関数
return ((hys32)selfVal.data) >> 2;
}
ValueStack* FFI_FUNC(clean) (Value selfVal)
{
FFI_DEBUG_ASSERT_INSTANCEMETHOD(selfVal);
ValueStack* self = selfVal.toCppObj<ValueStack>();
self->clean();
return self;
}
ValueStack* FFI_FUNC(push) (Value selfVal, Value x)
{
FFI_DEBUG_ASSERT_INSTANCEMETHOD(selfVal);
ValueStack* self = selfVal.toCppObj<ValueStack>();
self->push(x);
GC::writeBarrier(x);
return self;
}
FFI_GCMARK_FUNC()
{
ValueStack* s = object->cppObj<ValueStack>();
for (hyu32 i = 1; i <= s->size(); i++) {
Value& v = s->getNth(i);
GC::markValue(v);
}
}
} FFI_DEFINITION_END
|
[
"[email protected]"
] |
[
[
[
1,
54
]
]
] |
926b69d8609c6941119f46b9d4765625f6714806
|
fb8ab028c5e7865229f7032052ef6419cce6d843
|
/patterndemo/jpegdemo/jpegdemo.cpp
|
614f629563477f23741ab3148fb6f087f3aa7eca
|
[] |
no_license
|
alexunder/autumtao
|
d3fbca5b87fef96606501de8bfd600825b628e42
|
296db161b50c96efab48b05b5846e6f1ac90c38a
|
refs/heads/master
| 2016-09-05T09:43:36.361738 | 2011-03-25T16:13:51 | 2011-03-25T16:13:51 | 33,286,987 | 0 | 0 | null | null | null | null |
GB18030
|
C++
| false | false | 6,287 |
cpp
|
// jpegdemo.cpp : Defines the entry point for the console application.
//
// TestLibjpeg.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "windows.h"
#include "memory.h"
#include "string.h"
#include "jpeglib.h"
typedef unsigned long DWORD;
typedef int BOOL;
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef long LONG;
/***********************************************************************
压缩图像到jpeg格式
如果压缩前图像为灰度图或24位图,压缩后图像色彩模式不变
如果压缩前图像为256色索引位图,压缩后变为灰度图
************************************************************************/
void bmptojpg(const char *strSourceFileName, const char *strDestFileName)
{
}
/**************************************************************************
压缩图像到jpeg格式,如果压缩前的图像不是24位图,则强行转换为24位图后压缩
**************************************************************************/
void bmptojpg24(const char *strSourceFileName, const char *strDestFileName)
{
}
/***********************************************
*解压缩jpeg到bmp格式
*对于灰度图和24位图,图像解压后正常
*对于256色索引位图,图像解压后为灰度图
**************************************************/
void jpgtobmp(const char *strSourceFileName, const char *strDestFileName)
{
BITMAPFILEHEADER bfh; // bmp文件头
BITMAPINFOHEADER bih; // bmp头信息
RGBQUAD rq[256]; // 调色板
int nAdjust; // 用于字节对齐
char indata[1000000]; // 用于存放解压缩前的图像数据,该数据直接从jpg文件读取
BYTE *data= NULL;//new BYTE[bih.biWidth*bih.biHeight];
//BYTE *pDataConv = NULL;//new BYTE[bih.biWidth*bih.biHeight];
int nComponent = 0;
// 声明解压缩对象及错误信息管理器
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo);
FILE *f = fopen(strSourceFileName,"rb");
if (f==NULL)
{
printf("Open file error!\n");
return;
}
//int nSize = fread(indata,1,1000000,f); // 读取jpg图像数据,nSize为实际读取的图像数据大小
//fclose(f);
// 下面代码用于解压缩,从本行开始解压缩
jpeg_stdio_src(&cinfo, f );
jpeg_read_header(&cinfo, TRUE);
nAdjust = cinfo.image_width*cinfo.num_components%4;
if (nAdjust) nAdjust = 4-nAdjust;
data = new BYTE[(cinfo.image_width*cinfo.num_components+nAdjust)*cinfo.image_height];
jpeg_start_decompress(&cinfo);
JSAMPROW row_pointer[1];
while (cinfo.output_scanline < cinfo.output_height)
{
row_pointer[0] = &data[(cinfo.output_height - cinfo.output_scanline-1)*(cinfo.image_width*cinfo.num_components+nAdjust)];
jpeg_read_scanlines(&cinfo,row_pointer ,
1);
}
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
// 上面代码用于解压缩,到本行为止解压缩完成
fclose(f);
// 以下代码讲解压缩后的图像存入文件,可以根据实际应用做其他处理,如传输
f=fopen(strDestFileName,"wb");
if (f==NULL)
{
delete [] data;
//delete [] pDataConv;
return;
}
// 写文件头
memset(&bfh,0,sizeof(bfh));
bfh.bfSize = sizeof(bfh)+sizeof(bih);
bfh.bfOffBits = sizeof(bfh)+sizeof(bih);
if (cinfo.num_components==1)
{
bfh.bfOffBits += 1024;
bfh.bfSize += 1024;
}
bfh.bfSize += (cinfo.image_width*cinfo.num_components+nAdjust)*cinfo.image_height;
bfh.bfType = 0x4d42;
fwrite(&bfh,sizeof(bfh),1,f);
// 写图像信息
bih.biBitCount = cinfo.num_components*8;
bih.biSize = sizeof(bih);
bih.biWidth = cinfo.image_width;
bih.biHeight = cinfo.image_height;
bih.biPlanes = 1;
bih.biCompression = 0;
bih.biSizeImage = (cinfo.image_width*cinfo.num_components+nAdjust)*cinfo.image_height;
bih.biXPelsPerMeter = 0;
bih.biYPelsPerMeter = 0;
bih.biClrUsed = 0;
bih.biClrImportant = 0;
fwrite(&bih,sizeof(bih),1,f);
// 写调色板
if (cinfo.num_components ==1)
{
for (int i=0;i<256;i++)
{
rq[i].rgbBlue =i;
rq[i].rgbGreen = i;
rq[i].rgbRed = i;
rq[i].rgbReserved = 0;
}
fwrite(rq,1024,1,f);
}
if (cinfo.num_components==3)
{
// 调整rgb顺序
for (int j=0;j<bih.biHeight;j++)
for (int i = 0;i<bih.biWidth;i++)
{
BYTE red = data[j*(cinfo.image_width*cinfo.num_components+nAdjust)+i*3];
data[j*(cinfo.image_width*cinfo.num_components+nAdjust)+i*3] = data[j*(cinfo.image_width*cinfo.num_components+nAdjust)+i*3+2];
data[j*(cinfo.image_width*cinfo.num_components+nAdjust)+i*3+2] = red;
}
}
fwrite(data,(cinfo.image_width*cinfo.num_components+nAdjust)*cinfo.image_height,1,f);
fclose(f);
delete [] data;
}
int main(int argc, char* argv[])
{
// 本程序要在命令行模式下运行,需要带参数,不带参数运行显示参数格式
switch (argc)
{
case 4:
if (strcmp(argv[1],"j")==0)
{
bmptojpg(argv[2],argv[3]);
break;
}
else if (strcmp(argv[1],"j24")==0)
{
bmptojpg24(argv[2],argv[3]);
break;
}
else if (strcmp(argv[1],"b")==0)
{
jpgtobmp(argv[2],argv[3]);
break;
}
default :
printf("本程序利用了libjpeg库,该libjpeg.lib在vs 2005下重新编译过,可以直接使用.\n");
printf("转换bmp位图为jpg格式,或解压缩jpg格式图像为bmp格式\n");
printf("TestLibjpeg.exe j|j24|b s_name d_name\n");
printf("如:TestLibjpeg.exe j 05.bmp 05.jpg\n");
printf("TestLibjpeg.exe j24 05.bmp 05.jpg\n");
printf("TestLibjpeg.exe b 05.jpg 05.bmp\n");
printf("\n格式如下:\n");
printf("\tj:压缩图像到jpeg格式,如果压缩前图像为灰度图或24位图,压缩后图像色彩模式不变,如果压缩前图像为256色索引位图,压缩后变为灰度图;\n");
printf("\tj24:压缩图像到jpeg格式,如果压缩前的图像不是24位图,则强行转换为24位图后压缩;\n");
printf("\tb:解压缩jpeg到bmp格式,对于灰度图和24位图,图像解压后正常,对于256色索引位图,图像解压后为灰度图\n");
break;
}
return 0;
}
|
[
"Xalexu@59d19903-2beb-cf48-5e42-6f21bef2d45e"
] |
[
[
[
1,
190
]
]
] |
544377a0cc6621dc2def340320c891c32a008012
|
a5cc77a18ce104eefd5d117ac21a623461fe98ca
|
/mainwindow.hpp
|
e5833dfcf597f19bdebfb1c78d0ebcb9165ad524
|
[] |
no_license
|
vinni-au/yax
|
7267ccaba9ce8e207a0a2ea60f3c61b2602895f9
|
122413eefc71a31f4e6700cc958406d244bf9a8f
|
refs/heads/master
| 2016-09-10T03:16:43.293156 | 2011-12-15T19:37:53 | 2011-12-15T19:37:53 | 32,195,604 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,383 |
hpp
|
#ifndef MAINWINDOW_HPP
#define MAINWINDOW_HPP
#include <QtGui>
#include <QAction>
#include "domainsdockwidget.hpp"
#include "variablesdockwidget.hpp"
#include "rulesdockwidget.hpp"
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
protected:
QMenu* m_menuFile;
QMenu* m_menuEdit;
QMenu* m_menuConsult;
QMenu* m_menuHelp;
QAction* m_actFileCreate;
QAction* m_actFileOpen;
QAction* m_actFileSave;
QAction* m_actFileSaveAs;
QAction* m_actFileQuit;
QAction* m_actEditDomains;
QAction* m_actEditVariables;
QAction* m_actEditRules;
QAction* m_actConsultGoal;
QAction* m_actConsultConsult;
QAction* m_actConsultReasoning;
QAction* m_actHelpAbout;
QAction* m_actHelpAboutQt;
DomainsDockWidget* m_domainsDock;
VariablesDockWidget* m_variablesDock;
RulesDockWidget* m_rulesDock;
protected slots:
void fileCreate();
void fileOpen();
void fileSave();
void fileSaveAs();
void fileQuit();
void editDomains();
void editVariables();
void editRules();
void consultGoal();
void consultConsult();
void consultReasoning();
void helpAbout();
void helpAboutQt();
private:
void setupUI();
};
#endif // MAINWINDOW_HPP
|
[
"[email protected]"
] |
[
[
[
1,
67
]
]
] |
c962f30146b3a3a42026f4223aef4e3ae03f9ae8
|
3ea33f3b6b61d71216d9e81993a7b6ab0898323b
|
/src/Network/Server.cpp.h
|
88df2b4dd054271865aa662430124164c3b2bab5
|
[] |
no_license
|
drivehappy/tlmp
|
fd1510f48ffea4020a277f28a1c4525dffb0397e
|
223c07c6a6b83e4242a5e8002885e23d0456f649
|
refs/heads/master
| 2021-01-10T20:45:15.629061 | 2011-07-07T00:43:00 | 2011-07-07T00:43:00 | 32,191,389 | 2 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,599 |
h
|
#pragma once
// Template member function definitions
// this file should _only_ be used in the header
template<typename T>
void TLMP::Network::Server::BroadcastMessage(Message msg, ::google::protobuf::Message *message)
{
if (m_pServer) {
// Write message data to array
u32 size = sizeof(u8) * message->ByteSize();
u8 *dump = new u8[size];
message->SerializeToArray(dump, size);
// Write data and size to raknet
m_pBitStream->Reset();
m_pBitStream->Write((u8)(ID_USER_PACKET_ENUM+1));
m_pBitStream->Write((u32)msg);
m_pBitStream->Write(size);
m_pBitStream->Write((const char *)dump, size);
m_pServer->Send(m_pBitStream, HIGH_PRIORITY, RELIABLE_ORDERED, 1, UNASSIGNED_SYSTEM_ADDRESS, true);
delete dump;
}
}
template<typename T>
void TLMP::Network::Server::BroadcastMessage(const AddressOrGUID systemIdentifier, Message msg, ::google::protobuf::Message *message)
{
if (m_pServer) {
// Write message data to array
u32 size = sizeof(u8) * message->ByteSize();
u8 *dump = new u8[size];
message->SerializeToArray(dump, size);
// Write data and size to raknet
m_pBitStream->Reset();
m_pBitStream->Write((u8)(ID_USER_PACKET_ENUM+1));
m_pBitStream->Write((u32)msg);
m_pBitStream->Write(size);
m_pBitStream->Write((const char *)dump, size);
m_pServer->Send(m_pBitStream, HIGH_PRIORITY, RELIABLE_ORDERED, 1, systemIdentifier, true);
delete dump;
}
}
template<typename T>
void TLMP::Network::Server::SendMessage(const AddressOrGUID systemIdentifier, Message msg, ::google::protobuf::Message *message)
{
if (m_pServer) {
// Write message data to array
u32 size = sizeof(u8) * message->ByteSize();
u8 *dump = new u8[size];
message->SerializeToArray(dump, size);
// Write data and size to raknet
m_pBitStream->Reset();
m_pBitStream->Write((u8)(ID_USER_PACKET_ENUM+1));
m_pBitStream->Write((u32)msg);
m_pBitStream->Write(size);
m_pBitStream->Write((const char *)dump, size);
m_pServer->Send(m_pBitStream, HIGH_PRIORITY, RELIABLE_ORDERED, 1, systemIdentifier, false);
delete dump;
}
}
template<typename T>
T* TLMP::Network::Server::ParseMessage(RakNet::BitStream *bitStream)
{
T* message = new T();
u32 size = 0;
u8 *data;
bitStream->ReadPtr<u32>(&size);
data = new u8[size];
bitStream->ReadAlignedBytes(data, size);
//log("Received serialized of size: %i", size);
message->ParseFromArray(data, size);
delete data;
return message;
}
|
[
"drivehappy@7af81de8-dd64-11de-95c9-073ad895b44c"
] |
[
[
[
1,
89
]
]
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.