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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a15642457f756c3c12ec68def1a31b62c9439c92 | 709cd826da3ae55945fd7036ecf872ee7cdbd82a | /Term/WildMagic2/Renderers/DX/WmlDxCamera.cpp | 2769e79f5fef8eb8c55b2b77b56c0a6833515580 | []
| no_license | argapratama/kucgbowling | 20dbaefe1596358156691e81ccceb9151b15efb0 | 65e40b6f33c5511bddf0fa350c1eefc647ace48a | refs/heads/master | 2018-01-08T15:27:44.784437 | 2011-06-19T15:23:39 | 2011-06-19T15:23:39 | 36,738,655 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,171 | cpp | // Magic Software, Inc.
// http://www.magic-software.com
// http://www.wild-magic.com
// Copyright (c) 2003. All Rights Reserved
//
// The Wild Magic Library (WML) source code is supplied under the terms of
// the license agreement http://www.magic-software.com/License/WildMagic.pdf
// and may not be copied or disclosed except in accordance with the terms of
// that agreement.
#include "WmlDxCamera.h"
#include "WmlDxRenderer.h"
using namespace Wml;
HRESULT DxCamera::ms_hResult = NULL;
WmlImplementRTTI(DxCamera,Camera);
WmlImplementStream(DxCamera);
//----------------------------------------------------------------------------
DxCamera::DxCamera (DxRenderer* pkRenderer, float fWidth, float fHeight)
{
m_fWidth = fWidth;
m_fHeight = fHeight;
m_pkRenderer = pkRenderer;
m_pqDevice = pkRenderer->GetDevice();
OnFrustumChange();
OnViewPortChange();
OnFrameChange();
}
//----------------------------------------------------------------------------
DxCamera::DxCamera ()
{
m_fWidth = m_fHeight = 0.0f;
}
//----------------------------------------------------------------------------
void DxCamera::OnResize (int iWidth, int iHeight)
{
Camera::OnResize(iWidth,iHeight);
m_fWidth = (float)iWidth;
m_fHeight = (float)iHeight;
}
//----------------------------------------------------------------------------
void DxCamera::OnFrustumChange ()
{
Camera::OnFrustumChange();
// WM uses right handed coordinates. DX uses left handed coordinates.
// Define as if for right handed coordinates and then negate the
// the z row.
D3DXMATRIX& rkProjMatrix = *m_pkRenderer->GetProjMatrix();
if ( GetUsePerspective() )
{
D3DXMatrixPerspectiveOffCenterRH(&rkProjMatrix,m_fFrustumL,
m_fFrustumR,m_fFrustumB,m_fFrustumT,m_fFrustumN,m_fFrustumF);
}
else
{
D3DXMatrixOrthoOffCenterRH(&rkProjMatrix,m_fFrustumL,
m_fFrustumR,m_fFrustumB,m_fFrustumT,m_fFrustumN,m_fFrustumF);
}
rkProjMatrix(2,0) = -rkProjMatrix(2,0);
rkProjMatrix(2,1) = -rkProjMatrix(2,1);
rkProjMatrix(2,2) = -rkProjMatrix(2,2);
rkProjMatrix(2,3) = -rkProjMatrix(2,3);
ms_hResult = m_pqDevice->SetTransform(D3DTS_PROJECTION,&rkProjMatrix);
WML_DX_ERROR_CHECK(SetTransform);
}
//----------------------------------------------------------------------------
void DxCamera::OnViewPortChange()
{
Camera::OnViewPortChange();
D3DVIEWPORT9 kViewport;
kViewport.X = (DWORD)(m_fPortL*m_fWidth);
kViewport.Y = (DWORD)(m_fPortB*m_fHeight);
kViewport.Width = (DWORD)((m_fPortR - m_fPortL)*m_fWidth);
kViewport.Height = (DWORD)((m_fPortT - m_fPortB)*m_fHeight);
kViewport.MinZ = 0.0f;
kViewport.MaxZ = 1.0f;
ms_hResult = m_pqDevice->SetViewport(&kViewport);
WML_DX_ERROR_CHECK(SetViewport);
}
//----------------------------------------------------------------------------
void DxCamera::OnFrameChange()
{
Camera::OnFrameChange();
// WM uses right handed coordinates. DX uses left handed coordinates.
// Define as if for right handed coordinates and then negate the
// the z column.
D3DXMATRIX& rkViewMatrix = *m_pkRenderer->GetViewMatrix();
D3DXVECTOR3 kEye(m_kLocation.X(),m_kLocation.Y(),m_kLocation.Z());
D3DXVECTOR3 kAt(m_kLocation.X()+m_kDirection.X(),
m_kLocation.Y()+m_kDirection.Y(),m_kLocation.Z()+m_kDirection.Z());
D3DXVECTOR3 kUp(m_kUp.X(),m_kUp.Y(),m_kUp.Z());
D3DXMatrixLookAtRH(&rkViewMatrix,&kEye,&kAt,&kUp);
rkViewMatrix(0,2) = -rkViewMatrix(0,2);
rkViewMatrix(1,2) = -rkViewMatrix(1,2);
rkViewMatrix(2,2) = -rkViewMatrix(2,2);
rkViewMatrix(3,2) = -rkViewMatrix(3,2);
ms_hResult = m_pqDevice->SetTransform(D3DTS_VIEW,&rkViewMatrix);
WML_DX_ERROR_CHECK(SetTransform);
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// streaming
//----------------------------------------------------------------------------
Object* DxCamera::Factory (Stream& rkStream)
{
DxCamera* pkObject = new DxCamera;
Stream::Link* pkLink = new Stream::Link(pkObject);
pkObject->Load(rkStream,pkLink);
return pkObject;
}
//----------------------------------------------------------------------------
void DxCamera::Load (Stream& rkStream, Stream::Link* pkLink)
{
Camera::Load(rkStream,pkLink);
StreamRead(rkStream,m_fWidth);
StreamRead(rkStream,m_fHeight);
}
//----------------------------------------------------------------------------
void DxCamera::Link (Stream& rkStream, Stream::Link* pkLink)
{
Camera::Link(rkStream,pkLink);
}
//----------------------------------------------------------------------------
bool DxCamera::Register (Stream& rkStream)
{
return Camera::Register(rkStream);
}
//----------------------------------------------------------------------------
void DxCamera::Save (Stream& rkStream)
{
Camera::Save(rkStream);
// native data
StreamWrite(rkStream,m_fWidth);
StreamWrite(rkStream,m_fHeight);
}
//----------------------------------------------------------------------------
StringTree* DxCamera::SaveStrings ()
{
// TO DO. Finish implementation.
StringTree* pkTree = new StringTree(1,0,1,0);
pkTree->SetString(0,MakeString(&ms_kRTTI,GetName()));
pkTree->SetChild(0,Camera::SaveStrings());
return pkTree;
}
//----------------------------------------------------------------------------
int DxCamera::GetMemoryUsed () const
{
int iBaseSize = sizeof(DxCamera) - sizeof(Camera);
int iTotalSize = iBaseSize + Camera::GetMemoryUsed();
return iTotalSize;
}
//----------------------------------------------------------------------------
int DxCamera::GetDiskUsed () const
{
return Camera::GetDiskUsed() +
sizeof(m_fWidth) +
sizeof(m_fHeight);
}
//----------------------------------------------------------------------------
| [
"[email protected]"
]
| [
[
[
1,
173
]
]
]
|
4db2accf97627bb6d40642ce707bc772e6d52d15 | bbcd9d87dfc5b475763174dc00ba6fef76aca82d | /wiNstaller/ziparchive/include/ZipMemFile.h | 0c2eb80627d7781ddce48cda6b3ff35d6d9364c9 | []
| no_license | wwxxyx/winstaller | 8cec98422fb18de2e65846e0562d3038a34ac14b | 722bda5b6687d50caa377ceedca7a222d5b04763 | refs/heads/master | 2020-05-24T07:50:29.060316 | 2007-09-13T05:43:05 | 2007-09-13T05:43:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,711 | h | ////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
// is Copyrighted 2000 - 2007 by Artpol Software - Tadeusz Dracz
//
// 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.
//
// For the licensing details refer to the License.txt file.
//
// Web Site: http://www.artpol-software.com
////////////////////////////////////////////////////////////////////////////////
/**
* \file ZipMemFile.h
* Includes the CZipMemFile class.
*
*/
#if !defined(ZIPARCHIVE_ZIPMEMFILE_DOT_H)
#define ZIPARCHIVE_ZIPMEMFILE_DOT_H
#if _MSC_VER > 1000
#pragma once
#endif
#include "ZipAbstractFile.h"
#include "ZipString.h"
#include "ZipExport.h"
/**
Represents a file in memory.
Automatically grows when necessary.
*/
class ZIP_API CZipMemFile : public CZipAbstractFile
{
protected:
size_t m_nGrowBy, m_nPos;
size_t m_nBufSize, m_nDataSize;
BYTE* m_lpBuf;
bool m_bAutoDelete;
void Free()
{
if (m_lpBuf)
{
free(m_lpBuf);
m_lpBuf = NULL;
}
}
void Init()
{
m_nGrowBy = m_nPos = 0;
m_nBufSize = m_nDataSize = 0;
m_lpBuf = NULL;
}
void Grow(size_t nBytes);
public:
bool IsClosed() const { return m_lpBuf == NULL;}
void Flush(){}
ZIP_FILE_USIZE Seek(ZIP_FILE_SIZE lOff, int nFrom);
ZIP_FILE_USIZE GetLength() const {return m_nDataSize;}
void Write(const void* lpBuf, UINT nCount);
UINT Read(void* lpBuf, UINT nCount);
void SetLength(ZIP_FILE_USIZE nNewLen);
CZipString GetFilePath() const {return _T("");}
CZipMemFile(long nGrowBy = 1024)
{
Init();
m_nGrowBy = nGrowBy;
m_bAutoDelete = true;
}
CZipMemFile(BYTE* lpBuf, UINT nBufSize, long nGrowBy = 0)
{
Init();
Attach(lpBuf, nBufSize, nGrowBy);
}
CZipMemFile(CZipMemFile& from)
{
Copy(from);
}
void Copy(CZipMemFile& from)
{
SetLength(from.m_nDataSize);
from.Read(m_lpBuf, (UINT)from.m_nDataSize);
}
ZIP_FILE_USIZE GetPosition() const { return m_nPos;}
void Attach(BYTE* lpBuf, UINT nBufSize, long nGrowBy = 0)
{
Close();
m_lpBuf = lpBuf;
m_nGrowBy = nGrowBy;
m_nBufSize = nBufSize;
m_nDataSize = nGrowBy == 0 ? nBufSize : 0;
m_bAutoDelete = false;
}
BYTE* Detach()
{
BYTE* b = m_lpBuf;
Init();
return b;
}
void Close()
{
if (m_bAutoDelete)
Free();
Init();
}
virtual ~CZipMemFile(){Close();}
};
#endif // !defined(ZIPARCHIVE_ZIPMEMFILE_DOT_H)
| [
"[email protected]"
]
| [
[
[
1,
120
]
]
]
|
2ae80b90add69ca117c0a66c10633dd756f94772 | da2575b50a44f20ef52d6f271e73ff15dd54682f | /3rdparty/tinyxml/samples/MyTest/MyTest.cpp | f6a613f8421df878ef583e4980844a564fdde932 | [
"Zlib"
]
| permissive | lqianlong/lincodelib | 0ef622bc988d6cf981a0aaf9da42b82fbd0b14cf | 27e71716f3279c02a90c213470b4c52cd8e86b60 | refs/heads/master | 2020-08-29T17:02:45.005037 | 2010-05-03T20:17:20 | 2010-05-03T20:17:20 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 568 | cpp | // MyTest.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "tinyxml.h"
#include "../../../KamaLib/Source/KmCommons.h"
using namespace kama;
int _tmain(int argc, _TCHAR* argv[])
{
TiXmlDocument doc;
if (doc.LoadFile("utf8test.xml"))
{
TiXmlElement* docEle = doc.FirstChildElement();
TiXmlElement* ele = docEle->FirstChildElement("SimplifiedChinese");
if (ele)
{
kstring str = "abc";
str.Append(ele->GetText(), CP_UTF8).Append(L"是的是的,就是的");
KTRACE(str);
}
}
return 0;
}
| [
"linzhenqun@785468e8-de65-11dd-a893-8d7ce9fbef62"
]
| [
[
[
1,
25
]
]
]
|
0ceec2f2d8b9888a98bb7a76a6f39ec6bd2396e0 | 5e72c94a4ea92b1037217e31a66e9bfee67f71dd | /old/src/net/curltest.cpp | a758d39f01f3947e1eebd73bc541252a01068c94 | []
| no_license | stein1/bbk | 1070d2c145e43af02a6df14b6d06d9e8ed85fc8a | 2380fc7a2f5bcc9cb2b54f61e38411468e1a1aa8 | refs/heads/master | 2021-01-17T23:57:37.689787 | 2011-05-04T14:50:01 | 2011-05-04T14:50:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,588 | cpp | // curltest.cpp : Defines the entry point for the console application.
//
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include <iostream>
#include <tchar.h>
#include "curl.h"
#include "curl_get.h"
#include "executor.h"
char *newstr(char *s) {
char *ret = (char *)malloc(strlen(s)+1);
strcpy(ret, s);
return ret;
}
int _tmain(int argc, _TCHAR* argv[])
{
CURL *curl;
CURLcode res;
double spd;
// thread arg struct and curl_get arg struct
struct curl_get_arg_struct *ca = new_curl_get_arg_struct();
struct thread_arg_struct *ta = new_thread_arg_struct();
ta->thread_args = (void *)ca;
HANDLE m_thread;
DWORD m_threadid;
LPTHREAD_START_ROUTINE m_test_executor = (LPTHREAD_START_ROUTINE)curl_get_executor;
ca->number_urls = 3;
ca->url_list = (char **) malloc(sizeof(char *) * ca->number_urls);
ca->url_list[0] = newstr("ftp://ftp.sunet.se/pub/pictures/fractals/arches.gif");
ca->url_list[1] = newstr("http://ftp.sunet.se/pub/os/FreeBSD/ports/i386/packages-4.11-release/mail/postfix-2.2.20041030,2.tgz");
ca->url_list[2] = newstr("http://lonn.org/gurkburk.html");
printf("Creating thread\n");
m_thread = CreateThread( NULL, 0, m_test_executor, (PVOID)ta, 0, &m_threadid);
while (ta->started != true);
while (ta->executing == true) {
printf("Progress: %d\n", ta->progress);
Sleep(500);
}
printf("\nResults: %d/%d\n", ca->connects, ca->number_urls);
printf("Speed min/avg/max: %.0f/%.0f/%.0f\n",
ca->min_speed, ca->avg_speed, ca->max_speed);
return 0;
}
| [
"[email protected]"
]
| [
[
[
1,
58
]
]
]
|
d0127b6453d79637211236ba97bfb2290ba00125 | 602ebbd79009761dddc04cebb737f09bbe9bf16f | /Pattern/Pattern.h | ad1fe3a0838d6df9691e02c41cc43e9269dc0332 | []
| no_license | RafaelMarinheiro/Objective-ART | f62d8ba8e0fc58fcf4291c8aed5288f2e01bc936 | 3a131981513360802398d0898772170b45d0d59f | refs/heads/master | 2021-01-19T09:44:21.829879 | 2011-10-21T19:58:25 | 2011-10-21T19:58:25 | 2,608,881 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 481 | h | #pragma once
namespace oart{
class Marker;
class Pattern
{
public:
char * name;
bool visible;
bool colliding;
Marker * marker;
Pattern();
Pattern(Pattern & p);
Pattern(int id, char * name, double width, Point & center);
Pattern & operator=(const Pattern & p);
~Pattern();
const int & id() const;
const double & width() const;
const Point & center() const;
private:
int mid;
double mwidth;
Point mcenter;
};
} | [
"[email protected]"
]
| [
[
[
1,
30
]
]
]
|
58d919ad5ba8a5449f54a3b6a3e4b5880a9f320c | e52b0e0e87fbeb76edd0f11a7e1b03d25027932e | /include/GameAnimation.h | 346ba63e3d7ce584f33122ce5eda4dcf030b9aec | []
| no_license | zerotri/Maxwell_Game_old | d9aaa4c38ee1b99fe9ddb6f777737229dc6eebeb | da7a02ff25697777efe285973e5cecba14154b6c | refs/heads/master | 2021-01-25T05:22:45.278629 | 2008-02-07T03:11:01 | 2008-02-07T03:11:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 641 | h | #ifndef GAMEANIMATION_H
#define GAMEANIMATION_H
#include "main.h"
typedef struct ANIM_type
{
GfxSurface pSurf;
float uTop;
float uLeft;
float uBottom;
float uRight;
float fAnimSpeed;
ANIM_type *lpNext; // next frame of animation
}ANIM;
class GameAnimation
{
public:
GameAnimation();
~GameAnimation();
void update(time_type updateTime);
void drawCurrentFrame(int x, int y, GfxSurface drawTexture = 0);
void setAnimation(ANIM* baseAnim);
void setGraphics(Graphics* _gfx);
protected:
private:
ANIM *baseAnimation;
time_type fTimeLeft;
Graphics* gfx;
};
#endif // GAMEANIMATION_H
| [
"[email protected]"
]
| [
[
[
1,
34
]
]
]
|
8a682c224bd737f6d54b3a5c48a5825741b12be1 | b7c505dcef43c0675fd89d428e45f3c2850b124f | /Src/SimulatorQt/Util/qt/Win32/include/Qt/qplastiquestyle.h | 0f651e7fbce3558317479f2c36e672ff2b0ea28e | [
"BSD-2-Clause"
]
| permissive | pranet/bhuman2009fork | 14e473bd6e5d30af9f1745311d689723bfc5cfdb | 82c1bd4485ae24043aa720a3aa7cb3e605b1a329 | refs/heads/master | 2021-01-15T17:55:37.058289 | 2010-02-28T13:52:56 | 2010-02-28T13:52:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,920 | h | /****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information ([email protected])
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at [email protected].
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QPLASTIQUESTYLE_H
#define QPLASTIQUESTYLE_H
#include <QtGui/qwindowsstyle.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
#if !defined(QT_NO_STYLE_PLASTIQUE)
class QPlastiqueStylePrivate;
class Q_GUI_EXPORT QPlastiqueStyle : public QWindowsStyle
{
Q_OBJECT
Q_DECLARE_PRIVATE(QPlastiqueStyle)
public:
QPlastiqueStyle();
~QPlastiqueStyle();
void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
QPainter *painter, const QWidget *widget = 0) const;
void drawControl(ControlElement element, const QStyleOption *option,
QPainter *painter, const QWidget *widget) const;
void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
QPainter *painter, const QWidget *widget) const;
QSize sizeFromContents(ContentsType type, const QStyleOption *option,
const QSize &size, const QWidget *widget) const;
QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const;
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
SubControl sc, const QWidget *widget) const;
int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0,
QStyleHintReturn *returnData = 0) const;
SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option,
const QPoint &pos, const QWidget *widget = 0) const;
int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const;
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
const QWidget *widget = 0) const;
void polish(QWidget *widget);
void polish(QApplication *app);
void polish(QPalette &pal);
void unpolish(QWidget *widget);
void unpolish(QApplication *app);
QPalette standardPalette() const;
protected Q_SLOTS:
QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt = 0,
const QWidget *widget = 0) const;
int layoutSpacingImplementation(QSizePolicy::ControlType control1,
QSizePolicy::ControlType control2,
Qt::Orientation orientation,
const QStyleOption *option = 0,
const QWidget *widget = 0) const;
protected:
bool eventFilter(QObject *watched, QEvent *event);
void timerEvent(QTimerEvent *event);
private:
Q_DISABLE_COPY(QPlastiqueStyle)
void *reserved;
};
#endif // QT_NO_STYLE_PLASTIQUE
QT_END_NAMESPACE
QT_END_HEADER
#endif // QPLASTIQUESTYLE_H
| [
"alon@rogue.(none)"
]
| [
[
[
1,
119
]
]
]
|
006e2a77420c7bcf37f67142b5973b99de60ecff | cfa6cdfaba310a2fd5f89326690b5c48c6872a2a | /References/MFC Controls/SkinListCtrl/XDateBox.h | 54f8f6abdffd9f9587d4cf42c7bf6c409257a4ac | []
| no_license | asdlei00/project-jb | 1cc70130020a5904e0e6a46ace8944a431a358f6 | 0bfaa84ddab946c90245f539c1e7c2e75f65a5c0 | refs/heads/master | 2020-05-07T21:41:16.420207 | 2009-09-12T03:40:17 | 2009-09-12T03:40:17 | 40,292,178 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,634 | h | #if !defined(AFX_XDATEBOX_H__3F6322A0_C720_405C_89F5_743E746954EA__INCLUDED_)
#define AFX_XDATEBOX_H__3F6322A0_C720_405C_89F5_743E746954EA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// XDateBox.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CXDateBox window
extern UINT NEAR WM_XDATEBOX_CHANGE;
class CXDateBox : public CDateTimeCtrl
{
// Construction
public:
CXDateBox();
// Attributes
public:
private:
int m_nVK;
// Singleton instance
static CXDateBox* m_pXDateBox;
// Operations
public:
// Returns the instance of the class
static CXDateBox* GetInstance();
// Deletes the instance of the class
static void DeleteInstance();
static CString GetDate(CTime &time, CString &sDateFormat);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CXDateBox)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CXDateBox();
// Generated message map functions
protected:
//{{AFX_MSG(CXDateBox)
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg void OnCloseup(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_XDATEBOX_H__3F6322A0_C720_405C_89F5_743E746954EA__INCLUDED_)
| [
"[email protected]"
]
| [
[
[
1,
68
]
]
]
|
3f9edf73e564f9567c68554a0c27c7f64f324a17 | 8e1e11e08b25e2b76b02769e14fee1a8f299846c | /component.cpp | 4266fd6f4180eb8701e09eb725d64ef3292cac86 | []
| no_license | qiuyan0528/cppbutterfly | e4a609da81dba84024842dca01a1e0a731f89500 | 4ef85a7644b44805c917e2b3e929c627d5720c9c | refs/heads/master | 2016-09-10T00:10:33.100622 | 2010-03-10T15:21:54 | 2010-03-10T15:21:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,171 | cpp | /*
Copyright (c) 2010 Gonzalo Diethelm
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 <zmq.hpp>
#include <assert.h>
#include <stdio.h>
int main (int argc, char *argv [])
{
// Parse command line arguments.
if (argc != 5) {
printf ("usage: component <out-interface> "
"<inp-interface> <processing-time [ms]> <name>\n");
return 1;
}
const char *out_interface = argv [1];
const char *inp_interface = argv [2];
int processing_time = atoi (argv [3]);
const char *cname = argv [4];
// Create the 0MQ infrastructure.
zmq::context_t ctx (1, 1);
zmq::socket_t inp_socket (ctx, ZMQ_UPSTREAM);
zmq::socket_t out_socket (ctx, ZMQ_DOWNSTREAM);
inp_socket.connect (inp_interface);
out_socket.connect (out_interface);
// Main event loop.
int count = 0;
while (true) {
zmq::message_t msg;
inp_socket.recv (&msg);
// Simulate processing, i.e. sleep for the specified time.
#if 1
Sleep (processing_time);
#else
usleep (processing_time * 1000);
#endif
out_socket.send (msg);
}
}
| [
"[email protected]"
]
| [
[
[
1,
67
]
]
]
|
762fbe1cc5907093fce89157eed2160ebaa04595 | 5ac13fa1746046451f1989b5b8734f40d6445322 | /minimangalore/Nebula2/code/contrib/nmax/src/pluginlibs/nmaxdirdlg.cc | f30f5aaa51d3800ae65b3f26d8b2a6a78cb7a0c7 | []
| no_license | moltenguy1/minimangalore | 9f2edf7901e7392490cc22486a7cf13c1790008d | 4d849672a6f25d8e441245d374b6bde4b59cbd48 | refs/heads/master | 2020-04-23T08:57:16.492734 | 2009-08-01T09:13:33 | 2009-08-01T09:13:33 | 35,933,330 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,536 | cc | //-----------------------------------------------------------------------------
// nmaxdirdlg.cc
//
// (C)2004 Kim, Hyoun Woo
//-----------------------------------------------------------------------------
#define _WIN32_DCOM
#include <windows.h>
#include <shlobj.h>
#include <objbase.h>
#include "export2/nmax.h"
#include "export2/nmaxexport2.h"
#include "../res/nmaxtoolbox.h"
#include "pluginlibs/nmaxdlg.h"
#include "pluginlibs/nmaxdirdlg.h"
#include "util/nstring.h"
#include "kernel/nfileserver2.h"
#include "kernel/nfile.h"
#include "misc/niniprefserver.h"
//-----------------------------------------------------------------------------
/**
*/
nMaxDirDlg::nMaxDirDlg(WORD resID, HINSTANCE hInst, HWND hwndParent) :
nMaxDlg(resID, hInst, hwndParent)
{
}
//-----------------------------------------------------------------------------
/**
*/
nMaxDirDlg::~nMaxDirDlg()
{
}
//-----------------------------------------------------------------------------
/**
called when the dialog get the message WM_INITDIALOG.
*/
void nMaxDirDlg::OnInitDialog()
{
nString homeDir;
nString binaryPath;
nString animsAssign;
nString gfxlibAssign;
nString guiAssign;
nString lightsAssign;
nString meshesAssign;
nString shadersAssign;
nString texturesAssign;
nString animsPath;
nString gfxlibPath;
nString guiPath;
nString lightsPath;
nString meshesPath;
nString shadersPath;
nString texturesPath;
nFileServer2* fileServer = nFileServer2::Instance();
nString iniFilename;
iniFilename += GetCOREInterface()->GetDir(APP_PLUGCFG_DIR);
iniFilename += "\\";
iniFilename += N_MAXEXPORT_INIFILE;
// check the .ini file exist in 3dsmax plugin directory.
if (!fileServer->FileExists(iniFilename))
{
// the .ini file does not exist, so make new one.
nFile* file = fileServer->NewFileObject();
file->Open(iniFilename.Get(), "w");
file->Close();
file->Release();
}
// read values from .ini file and specify those to dialog controls.
nIniPrefServer* iniFile = (nIniPrefServer*)nKernelServer::Instance()->New("niniprefserver", "/iniprefsrv");
iniFile->SetFileName(iniFilename);
iniFile->SetSection("GeneralSettings");
iniFile->SetDefault(".");
homeDir = iniFile->ReadString("HomeDir");
//projDir = iniFile->ReadString("ProjDir");
binaryPath = iniFile->ReadString("BinaryPath") ;
iniFile->SetDefault(N_MAXEXPORT_ANIMS_ASSIGN);
animsAssign = iniFile->ReadString("AnimsAssign");
iniFile->SetDefault(N_MAXEXPORT_GFXLIB_ASSIGN);
gfxlibAssign = iniFile->ReadString("GfxlibAssign");
iniFile->SetDefault(N_MAXEXPORT_GUI_ASSIGN);
guiAssign = iniFile->ReadString("GuiAssign") ;
iniFile->SetDefault(N_MAXEXPORT_LIGHTS_ASSIGN);
lightsAssign = iniFile->ReadString("LightsAssign");
iniFile->SetDefault(N_MAXEXPORT_MESHES_ASSIGN);
meshesAssign = iniFile->ReadString("MeshesAssign");
iniFile->SetDefault(N_MAXEXPORT_SHADERS_ASSIGN);
shadersAssign = iniFile->ReadString("ShadersAssign");
iniFile->SetDefault(N_MAXEXPORT_TEXTURES_ASSIGN);
texturesAssign = iniFile->ReadString("TexturesAssign");
iniFile->SetDefault(N_MAXEXPORT_ANIMS_PATH);
animsPath = iniFile->ReadString("AnimsPath");
iniFile->SetDefault(N_MAXEXPORT_GFXLIB_PATH);
gfxlibPath = iniFile->ReadString("GfxlibPath");
iniFile->SetDefault(N_MAXEXPORT_GUI_PATH);
guiPath = iniFile->ReadString("GuiPath");
iniFile->SetDefault(N_MAXEXPORT_LIGHTS_PATH);
lightsPath = iniFile->ReadString("LightsPath");
iniFile->SetDefault(N_MAXEXPORT_MESHES_PATH);
meshesPath = iniFile->ReadString("MeshesPath");
iniFile->SetDefault(N_MAXEXPORT_SHADERS_PATH);
shadersPath = iniFile->ReadString("ShadersPath");
iniFile->SetDefault(N_MAXEXPORT_TEXTURES_PATH);
texturesPath = iniFile->ReadString("TexturesPath");
iniFile->Release();
SetDlgItemText(hWnd, IDC_EXT_DIRNAME, homeDir.Get()); // home dir
SetDlgItemText(hWnd, IDC_EXT_BINARY_PATH, binaryPath.Get()); // binary path
// assigns
SetDlgItemText(hWnd, IDC_EXT_ASSIGN_ANIM, animsAssign.Get()); // anim
SetDlgItemText(hWnd, IDC_EXT_ASSIGN_GFXLIB, gfxlibAssign.Get()); // gfx
SetDlgItemText(hWnd, IDC_EXT_ASSIGN_GUI, guiAssign.Get()); // gui
SetDlgItemText(hWnd, IDC_EXT_ASSIGN_LIGHTS, lightsAssign.Get()); // lights
SetDlgItemText(hWnd, IDC_EXT_ASSIGN_MESHES, meshesAssign.Get()); // meshes
SetDlgItemText(hWnd, IDC_EXT_ASSIGN_SHADERS, shadersAssign.Get()); // shaders
SetDlgItemText(hWnd, IDC_EXT_ASSIGN_TEXTURES, texturesAssign.Get()); // textures
// paths
SetDlgItemText(hWnd, IDC_EXT_PATH_ANIM, animsPath.Get());
SetDlgItemText(hWnd, IDC_EXT_PATH_GFXLIB, gfxlibPath.Get());
SetDlgItemText(hWnd, IDC_EXT_PATH_GUI, guiPath.Get());
SetDlgItemText(hWnd, IDC_EXT_PATH_LIGHTS, lightsPath.Get());
SetDlgItemText(hWnd, IDC_EXT_PATH_MESHES, meshesPath.Get());
SetDlgItemText(hWnd, IDC_EXT_PATH_SHADERS, shadersPath.Get());
SetDlgItemText(hWnd, IDC_EXT_PATH_TEXTURES, texturesPath.Get());
}
//-----------------------------------------------------------------------------
/**
called when the dialog get the message WM_COMMAND.
*/
BOOL nMaxDirDlg::OnCommand(int wParamLow, int wParamHigh, long lParam)
{
switch(wParamLow)
{
case IDOK:
if (OnOK())
{
EndDialog(this->hWnd, IDOK);
}
break;
case IDCANCEL:
EndDialog(this->hWnd, IDCANCEL);
break;
case IDC_EXP_FILESEL:
OnSelHomeDir();
break;
// 'Set Default' button in 'Assigns'
case IDC_SET_DEFAULT_ASSIGNS:
OnSetDefaultAssigns();
break;
// 'Set Default' button in 'Paths'
case IDC_SET_DEFAULT_PATHS:
OnSetDefaultPaths();
break;
default:
break;
}
return TRUE;
}
//-----------------------------------------------------------------------------
/**
Message handler function for 'ok' button.
*/
bool nMaxDirDlg::OnOK()
{
nString homeDir;
nString binaryPath;
nString animsAssign;
nString gfxlibAssign;
nString guiAssign;
nString lightsAssign;
nString meshesAssign;
nString shadersAssign;
nString texturesAssign;
nString animsPath;
nString gfxlibPath;
nString guiPath;
nString lightsPath;
nString meshesPath;
nString shadersPath;
nString texturesPath;
const int BUFSIZE = 512;
char str[BUFSIZE];
// retrieves value from dialog controls.
GetDlgItemText(hWnd, IDC_EXT_DIRNAME, str, BUFSIZE); homeDir = str;
GetDlgItemText(hWnd, IDC_EXT_BINARY_PATH, str, BUFSIZE); binaryPath = str;
GetDlgItemText(hWnd, IDC_EXT_ASSIGN_ANIM, str, BUFSIZE); animsAssign = str;
GetDlgItemText(hWnd, IDC_EXT_ASSIGN_GFXLIB, str, BUFSIZE); gfxlibAssign = str;
GetDlgItemText(hWnd, IDC_EXT_ASSIGN_GUI, str, BUFSIZE); guiAssign = str;
GetDlgItemText(hWnd, IDC_EXT_ASSIGN_LIGHTS, str, BUFSIZE); lightsAssign = str;
GetDlgItemText(hWnd, IDC_EXT_ASSIGN_MESHES, str, BUFSIZE); meshesAssign = str;
GetDlgItemText(hWnd, IDC_EXT_ASSIGN_SHADERS, str, BUFSIZE); shadersAssign = str;
GetDlgItemText(hWnd, IDC_EXT_ASSIGN_TEXTURES, str, BUFSIZE); texturesAssign = str;
GetDlgItemText(hWnd, IDC_EXT_PATH_ANIM, str, BUFSIZE); animsPath = str;
GetDlgItemText(hWnd, IDC_EXT_PATH_GFXLIB, str, BUFSIZE); gfxlibPath = str;
GetDlgItemText(hWnd, IDC_EXT_PATH_GUI, str, BUFSIZE); guiPath = str;
GetDlgItemText(hWnd, IDC_EXT_PATH_LIGHTS, str, BUFSIZE); lightsPath = str;
GetDlgItemText(hWnd, IDC_EXT_PATH_MESHES, str, BUFSIZE); meshesPath = str;
GetDlgItemText(hWnd, IDC_EXT_PATH_SHADERS, str, BUFSIZE); shadersPath = str;
GetDlgItemText(hWnd, IDC_EXT_PATH_TEXTURES, str, BUFSIZE); texturesPath = str;
// check the specified assigns and paths are valid.
if (!nFileServer2::Instance()->DirectoryExists(homeDir))
{
// specified home directory does not exist.
MessageBox(this->hWnd, "The specified 'Home' assign directory does not exist.", "Error", MB_OK);
return false;
}
else
{
// write the values to .ini file.
nString iniFilename;
iniFilename += GetCOREInterface()->GetDir(APP_PLUGCFG_DIR);
iniFilename += "\\";
iniFilename += N_MAXEXPORT_INIFILE;
nIniPrefServer* iniFile = (nIniPrefServer*)nKernelServer::Instance()->New("niniprefserver", "/iniprefsrv");
iniFile->SetFileName(iniFilename);
iniFile->SetSection("GeneralSettings");
iniFile->WriteString("HomeDir", homeDir);
//iniFile->WriteString("ProjDir", projDir);
iniFile->WriteString("BinaryPath", binaryPath) ;
iniFile->WriteString("AnimsAssign", animsAssign);
iniFile->WriteString("GfxlibAssign", gfxlibAssign);
iniFile->WriteString("GuiAssign", guiAssign) ;
iniFile->WriteString("LightsAssign", lightsAssign);
iniFile->WriteString("MeshesAssign", meshesAssign);
iniFile->WriteString("ShadersAssign", shadersAssign);
iniFile->WriteString("TexturesAssign", texturesAssign);
iniFile->WriteString("AnimsPath", animsPath);
iniFile->WriteString("GfxlibPath", gfxlibPath);
iniFile->WriteString("GuiPath", guiPath);
iniFile->WriteString("LightsPath", lightsPath);
iniFile->WriteString("MeshesPath", meshesPath);
iniFile->WriteString("ShadersPath", shadersPath);
iniFile->WriteString("TexturesPath", texturesPath);
iniFile->Release();
}
return true;
}
//-----------------------------------------------------------------------------
/**
Shows up file select browser to specify nebula2 installed directory.
FIXME: shown up the dialog has ugly white background.
some setting of it seems be wrong.
*/
void nMaxDirDlg::OnSelHomeDir()
{
// Retrieve the task memory allocator.
LPMALLOC pIMalloc;
if (!SUCCEEDED(::SHGetMalloc(&pIMalloc)))
{
return;
}
char szBuf[MAX_PATH];
// Initialize a BROWSEINFO structure,
BROWSEINFO brInfo;
::ZeroMemory(&brInfo, sizeof(brInfo));
brInfo.hwndOwner = this->hWnd;
brInfo.pidlRoot = NULL;
brInfo.pszDisplayName = szBuf;
brInfo.lpszTitle = "Select Nebula2 installed directory";
// only want folders (no printers, etc.)
brInfo.ulFlags = BIF_RETURNONLYFSDIRS;
// Display the browser.
ITEMIDLIST* browseList = NULL;
browseList = ::SHBrowseForFolder(&brInfo);
// if the user selected a folder . . .
if (browseList)
{
// Convert the item ID to a pathname,
if(::SHGetPathFromIDList(browseList, szBuf))
{
nString homeDir;
homeDir.Format("%s", szBuf);
SetDlgItemText(hWnd, IDC_EXT_DIRNAME, homeDir.Get());
}
// Free the PIDL
pIMalloc->Free(browseList);
}
else
{
*szBuf=_T('\0');
}
// Decrement ref count on the allocator
pIMalloc->Release();
}
//-----------------------------------------------------------------------------
/**
Specifies 'assign' settings to default values.
*/
void nMaxDirDlg::OnSetDefaultAssigns()
{
SetDlgItemText(hWnd, IDC_EXT_ASSIGN_ANIM, N_MAXEXPORT_ANIMS_ASSIGN);
SetDlgItemText(hWnd, IDC_EXT_ASSIGN_GFXLIB, N_MAXEXPORT_GFXLIB_ASSIGN);
SetDlgItemText(hWnd, IDC_EXT_ASSIGN_GUI, N_MAXEXPORT_GUI_ASSIGN);
SetDlgItemText(hWnd, IDC_EXT_ASSIGN_LIGHTS, N_MAXEXPORT_LIGHTS_ASSIGN);
SetDlgItemText(hWnd, IDC_EXT_ASSIGN_MESHES, N_MAXEXPORT_MESHES_ASSIGN);
SetDlgItemText(hWnd, IDC_EXT_ASSIGN_SHADERS, N_MAXEXPORT_SHADERS_ASSIGN);
SetDlgItemText(hWnd, IDC_EXT_ASSIGN_TEXTURES, N_MAXEXPORT_TEXTURES_ASSIGN);
}
//-----------------------------------------------------------------------------
/**
Specifies 'path' settings to default values.
*/
void nMaxDirDlg::OnSetDefaultPaths()
{
SetDlgItemText(hWnd, IDC_EXT_PATH_ANIM, N_MAXEXPORT_ANIMS_PATH);
SetDlgItemText(hWnd, IDC_EXT_PATH_GFXLIB, N_MAXEXPORT_GFXLIB_PATH);
SetDlgItemText(hWnd, IDC_EXT_PATH_GUI, N_MAXEXPORT_GUI_PATH);
SetDlgItemText(hWnd, IDC_EXT_PATH_LIGHTS, N_MAXEXPORT_LIGHTS_PATH);
SetDlgItemText(hWnd, IDC_EXT_PATH_MESHES, N_MAXEXPORT_MESHES_PATH);
SetDlgItemText(hWnd, IDC_EXT_PATH_SHADERS, N_MAXEXPORT_SHADERS_PATH);
SetDlgItemText(hWnd, IDC_EXT_PATH_TEXTURES, N_MAXEXPORT_TEXTURES_PATH);
}
//-----------------------------------------------------------------------------
/**
Defined for scripting interface. See nmaxdlgscript.cc
*/
void ShowDirSettingDlg()
{
// get instance hanlde of dll
HINSTANCE hInstance = maxExportInterfaceClassDesc2.HInstance();
// get window handle of 3dsmax
Interface* intf = GetCOREInterface();
HWND parentHWnd = intf->GetMAXHWnd();
// show directory setting dialog up.
nMaxDirDlg dirDlg(IDD_DIR_SETTING, hInstance, parentHWnd);
int ret = dirDlg.DoModal();
}
| [
"BawooiT@d1c0eb94-fc07-11dd-a7be-4b3ef3b0700c"
]
| [
[
[
1,
393
]
]
]
|
66692c74bd7454d27af35b82ce0b04f178985f1a | 6477cf9ac119fe17d2c410ff3d8da60656179e3b | /Projects/openredalert/src/game/Projectile.cpp | 6cc416b7509468edbd3520e7b97be09b9923c3c7 | []
| no_license | crutchwalkfactory/motocakerteam | 1cce9f850d2c84faebfc87d0adbfdd23472d9f08 | 0747624a575fb41db53506379692973e5998f8fe | refs/heads/master | 2021-01-10T12:41:59.321840 | 2010-12-13T18:19:27 | 2010-12-13T18:19:27 | 46,494,539 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,609 | cpp | // Projectile.cpp
// 1.0
// This file is part of OpenRedAlert.
//
// OpenRedAlert 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, version 2 of the License.
//
// OpenRedAlert 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 OpenRedAlert. If not, see <http://www.gnu.org/licenses/>.
#include "Projectile.h"
#include <string>
#include <vector>
#include "ProjectileData.h"
#include "ProjectileDataList.h"
#include "include/Logger.h"
#include "video/ImageNotFound.h"
#include "video/SHPImage.h"
using std::string;
using std::vector;
extern Logger * logger;
Projectile::Projectile(string pname, ProjectileDataList* data, vector<SHPImage*>* imagePool)
{
// Get the Data of this projectile
ProjectileData* lProjectileData = data->getData(pname);
// Assign the Data
this->lnkProjectileData = lProjectileData;
// Get image name
string lImage = this->lnkProjectileData->getImage();
// Load the image in the pool
if (lImage!= "none"){
SHPImage* temp = 0;
imagenum = 0;
imagenum = imagePool->size()<<16;
try
{
lImage += ".shp";
temp = new SHPImage(lImage.c_str(), -1);
}
catch (ImageNotFound&)
{
logger->error("Image %s not found during loading of %s projectile\n", lImage.c_str(), pname.c_str());
}
// stack the image
imagePool->push_back(temp);
if (this->lnkProjectileData->getRotates()!= 0)
{
if (temp != 0)
{
rotationimgs = temp->getNumImg();
}
else
{
rotationimgs = 0;
}
}
}
}
Projectile::~Projectile()
{
}
Uint32 Projectile::getImageNum()
{
return imagenum;
}
bool Projectile::AntiSubmarine()
{
return this->lnkProjectileData->getASW();
}
bool Projectile::AntiGround()
{
return this->lnkProjectileData->getAG();
}
bool Projectile::AntiAir()
{
if (this->lnkProjectileData->getAA()==1)
{
return true;
}
return false;
}
bool Projectile::getInaccurate()
{
if (this->lnkProjectileData->getInaccurate()==1)
{
return true;
}
return false;
}
bool Projectile::doesRotate()
{
if (this->lnkProjectileData->getRotates()==1)
{
return true;
}
return false;
}
| [
"[email protected]"
]
| [
[
[
1,
126
]
]
]
|
b39c772d98b94701679b059cdc9fb2e402873a9f | e109ae97b8a43dbf4f4a42a40f8c8da0641237a5 | /Miner.h | d527973b19f24f67cc9ada0f2e1fbec97f0ba675 | []
| no_license | mtturner/strategoo-code | 8346d48e7b5c038d53843a5195fecd1dc0a4fec9 | 6bdd46fdbd8cc77eca1afdd0bc9e1d293e59e882 | refs/heads/master | 2016-09-06T15:57:20.713674 | 2011-05-06T03:36:15 | 2011-05-06T03:36:15 | 32,553,378 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 456 | h | /******************************************************
Miner.h
This is the header file for the Miner class.
******************************************************/
#ifndef MINER_H
#define MINER_H
#include"Piece.h"
class Miner : public Piece
{
public:
//constructors
Miner(int xPos = 0, int yPos = 0, int boardSpace = -1);
Miner(std::string filename);
//move
virtual Piece* move(Piece* const destination);
};
#endif
| [
"cakeeater07@28384a92-424b-c9e9-0b9a-6d5e880deeca",
"[email protected]@28384a92-424b-c9e9-0b9a-6d5e880deeca"
]
| [
[
[
1,
6
],
[
10,
12
],
[
14,
20
]
],
[
[
7,
9
],
[
13,
13
],
[
21,
23
]
]
]
|
195d007dfb5fde1cfdad0984413acc8316e18804 | 5ed707de9f3de6044543886ea91bde39879bfae6 | /ASBasketball/ASFIsapi/Source/ASBasketballHtmlPageBuilder.h | 254f8668fffb33ce9c3476a4149b1259ea1fa605 | []
| no_license | grtvd/asifantasysports | 9e472632bedeec0f2d734aa798b7ff00148e7f19 | 76df32c77c76a76078152c77e582faa097f127a8 | refs/heads/master | 2020-03-19T02:25:23.901618 | 1999-12-31T16:00:00 | 2018-05-31T19:48:19 | 135,627,290 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,445 | h | /* ASBasketballHTMLPageBuilder.h */
/******************************************************************************/
/******************************************************************************/
#ifndef ASBasketballHtmlPageBuilderH
#define ASBasketballHtmlPageBuilderH
#include "ASFantasyHTMLPageBuilder.h"
using namespace asfantasy;
namespace asbasketball
{
/******************************************************************************/
enum TASBasketballHTMLPage
{
// htmlXXXPage = htmlASFantasyLastPage,
};
/******************************************************************************/
class ASBasketballHtmlPageOptions : public THtmlPageOptions
{
public:
// defined in THtmlPageOptions
virtual AnsiString getWebURLBasePath(int /*siteID*/,bool secure) const; //BOB siteID will be used when multiple WebServers are needed to support the load.
virtual AnsiString getRootPath() const { return("/ASBasketball/"); }
virtual AnsiString getImageRootPath() const { return("Images/"); }
virtual AnsiString getJavaRootPath() const { return("Java/"); }
virtual AnsiString getIsapiDll() const { return("/Scripts/Secure/ASBkIsa.dll"); }
virtual AnsiString getIsapiDllNS() const { return("/Scripts/ASBkIsa.dll"); }
virtual CStrVar getAppNameFull() const { return("World Wide Fantasy Basketball"); }
virtual CStrVar getAppNameAbbr() const { return("WWFB"); }
virtual CStrVar getJavaDefaultArchive(ASFantasyJavaArchive fja) const;
virtual CStrVar getJavaRequestDll() const { return("/Scripts/ASBkIsOb.dll"); }
virtual int getTypeAlphaPageWidth() const { return(765); }
virtual int getTypeAlphaIconNavColWidth() const { return(135); }
virtual const THTMLPageLinkInfo& getPageLinkInfo(int htmlPage) const;
virtual int getPageLinkInfoEnum(const AnsiString& pageName) const;
virtual CStrVar getStandardImageName(const int standardImage) const;
virtual CStrVar getStandardImageRootPath(const int standardImage) const;
virtual void loadHeaderViewNavButtonBarArray(
vector<vector<int> >& htmlPageArray);
virtual THtmlViewPtr getFooterViewIconsHtmlView(const bool showCompanyOnly);
};
/******************************************************************************/
/******************************************************************************/
class ASBasketballFooterViewIcons : public ASFantasyFooterViewIcons
{
protected:
ASBasketballFooterViewIcons(THtmlPageOptions& pageOptions,
const bool showCompanyOnly) : ASFantasyFooterViewIcons(pageOptions,
showCompanyOnly) {}
public:
static THtmlViewPtr newInstance(THtmlPageOptions& pageOptions,
const bool showCompanyOnly)
{ return(new ASBasketballFooterViewIcons(pageOptions,showCompanyOnly)); }
protected:
virtual bool hasSponsor() const { return(false); }
virtual void writeSponsorIcon(THTMLWriter& htmlWriter);
virtual void writeSponsorText(THTMLWriter& htmlWriter);
virtual bool hasPlayerAssoc() const { return(false); }
virtual void writePlayerAssocIcon(THTMLWriter& htmlWriter);
virtual void writePlayerAssocText(THTMLWriter& htmlWriter);
};
/******************************************************************************/
}; //namespace asbasketball
#endif //ASBasketballHtmlPageBuilderH
/******************************************************************************/
/******************************************************************************/
| [
"[email protected]"
]
| [
[
[
1,
87
]
]
]
|
6bbe5a96a107b8fa8e9e93b78c82375b44a4a72e | 10c14a95421b63a71c7c99adf73e305608c391bf | /gui/image/qpixmap_raster_p.h | c6ab29a3a6e42c5cc910df97a710bcef7b2d8dc9 | []
| no_license | eaglezzb/wtlcontrols | 73fccea541c6ef1f6db5600f5f7349f5c5236daa | 61b7fce28df1efe4a1d90c0678ec863b1fd7c81c | refs/heads/master | 2021-01-22T13:47:19.456110 | 2009-05-19T10:58:42 | 2009-05-19T10:58:42 | 33,811,815 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,611 | h | /****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information ([email protected])
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at [email protected].
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QPIXMAPDATA_RASTER_P_H
#define QPIXMAPDATA_RASTER_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtGui/private/qpixmapdata_p.h>
// #include <QtGui/private/qpixmapdatafactory_p.h>
#ifdef Q_WS_WIN
// # include "qt_windows.h"
#include "core/qt_windows.h"
# ifndef QT_NO_DIRECT3D
# include <d3d9.h>
# endif
#endif
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QRasterPixmapData : public QPixmapData
{
public:
QRasterPixmapData(PixelType type);
~QRasterPixmapData();
void resize(int width, int height);
// void fromFile(const QString &filename, Qt::ImageConversionFlags flags);
void fromImage(const QImage &image, Qt::ImageConversionFlags flags);
void fill(const QColor &color);
void setMask(const QBitmap &mask);
bool hasAlphaChannel() const;
void setAlphaChannel(const QPixmap &alphaChannel);
QImage toImage() const;
QPaintEngine* paintEngine() const;
QImage* buffer();
protected:
// int metric(QPaintDevice::PaintDeviceMetric metric) const;
private:
#if defined(Q_WS_WIN) && !defined(QT_NO_DIRECT3D)
friend class QDirect3DPaintEnginePrivate;
IDirect3DTexture9 *texture;
#endif
friend class QPixmap;
friend class QBitmap;
friend class QDetachedPixmap;
friend class QRasterPaintEngine;
QImage image;
};
QT_END_NAMESPACE
#endif // QPIXMAPDATA_RASTER_P_H
| [
"zhangyinquan@0feb242a-2539-11de-a0d7-251e5865a1c7"
]
| [
[
[
1,
106
]
]
]
|
5725c1c58f38566428c632f33869692980a39eac | 138a353006eb1376668037fcdfbafc05450aa413 | /source/ogre/OgreNewt/boost/mpl/remove_if.hpp | e6d70be6d0acf32fed641559b9dce4ca40712204 | []
| no_license | sonicma7/choreopower | 107ed0a5f2eb5fa9e47378702469b77554e44746 | 1480a8f9512531665695b46dcfdde3f689888053 | refs/heads/master | 2020-05-16T20:53:11.590126 | 2009-11-18T03:10:12 | 2009-11-18T03:10:12 | 32,246,184 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,087 | hpp |
#ifndef BOOST_MPL_REMOVE_IF_HPP_INCLUDED
#define BOOST_MPL_REMOVE_IF_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
// Copyright David Abrahams 2003-2004
//
// 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)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Source: /cvsroot/ogre/ogreaddons/ogrenewt/OgreNewt_Main/inc/boost/mpl/remove_if.hpp,v $
// $Date: 2006/04/17 23:49:40 $
// $Revision: 1.1 $
#include <boost/mpl/fold.hpp>
#include <boost/mpl/reverse_fold.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/protect.hpp>
#include <boost/mpl/lambda.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/mpl/aux_/inserter_algorithm.hpp>
namespace boost { namespace mpl {
namespace aux {
template< typename Pred, typename InsertOp > struct remove_if_helper
{
template< typename Sequence, typename U > struct apply
{
typedef typename eval_if<
typename apply1<Pred,U>::type
, identity<Sequence>
, apply2<InsertOp,Sequence,U>
>::type type;
};
};
template<
typename Sequence
, typename Predicate
, typename Inserter
>
struct remove_if_impl
: fold<
Sequence
, typename Inserter::state
, protect< aux::remove_if_helper<
typename lambda<Predicate>::type
, typename Inserter::operation
> >
>
{
};
template<
typename Sequence
, typename Predicate
, typename Inserter
>
struct reverse_remove_if_impl
: reverse_fold<
Sequence
, typename Inserter::state
, protect< aux::remove_if_helper<
typename lambda<Predicate>::type
, typename Inserter::operation
> >
>
{
};
} // namespace aux
BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(3, remove_if)
}}
#endif // BOOST_MPL_REMOVE_IF_HPP_INCLUDED
| [
"Sonicma7@0822fb10-d3c0-11de-a505-35228575a32e"
]
| [
[
[
1,
83
]
]
]
|
57ef38d401c4bf4d48a6ba3438e0e98d7ed69f7a | 87f20a21fe39a6ead52d5ac15b2dd745ceaa15c8 | /MiniGame.h | 95d0782caa225e769b62705e374f3f0291346720 | []
| no_license | Phildo/Planet-Wars | a0ba13f75de84af2b8619af4617eeeb212f4ec67 | b3dce6e93b63152106173d4858a120cd8ea55129 | refs/heads/master | 2021-01-17T14:52:50.899870 | 2011-12-21T23:00:58 | 2011-12-21T23:00:58 | 2,921,506 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 607 | h | #ifndef MINIGAME_H
#define MINIGAME_H
class Lane;
#include <math.h>
#include <iostream>
#include "Model.h"
#include "Player.h"
#include "Unit.h"
#include "Lane.h"
class MiniGame
{
public:
MiniGame(Node * node, Ship * attackerShip, Ship * defenderShip);
Node * node;
Ship * attacker;
Ship * defender;
Lane ** lanes;
int selectedALane;
int selectedDLane;
void changeLane(int direction, bool attacker);
void selectLane(int lane, bool attacker);
void deployUnit(Ship * s, int type);
void update();
void drawGame();
};
#endif | [
"[email protected]",
"[email protected]"
]
| [
[
[
1,
14
],
[
16,
17
],
[
20,
21
],
[
24,
24
],
[
28,
32
]
],
[
[
15,
15
],
[
18,
19
],
[
22,
23
],
[
25,
27
]
]
]
|
6cddbe82179eb515821be7109aa34ebfddd222b1 | dee5075c0882a62edac4474fd4024cb348748691 | /src/glWidget.cpp | 94983bf22c3546679302bc8035a06723eeb89e08 | []
| no_license | pol51/Cg | c179e1e85fe87106b7ee74337640c6283acdf760 | 3bf2893f0145ccfca338749ddeed7e4de634237f | refs/heads/master | 2020-05-02T06:13:25.376934 | 2011-05-21T11:48:39 | 2011-05-21T11:48:39 | 4,607,164 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,493 | cpp | #include "glWidget.h"
#include <QtOpenGL>
#include <QDebug>
GlWidget::GlWidget(QWidget *parent)
:QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
{
_refreshTimer.setSingleShot(false);
QObject::connect(
&_refreshTimer, SIGNAL(timeout()),
this, SLOT(update())
);
_refreshTimer.start(20);
setAttribute(Qt::WA_NoSystemBackground);
setMinimumSize(480, 480);
setWindowTitle("Cg Tests");
_fragment_on = false;
_vertex_on = false;
_angle = 0.0;
_twist = 0.0;
_parts = 128;
}
GlWidget::~GlWidget()
{
this->makeCurrent();
}
QSize GlWidget::sizeHint() const
{
return QSize(480, 480);
}
void GlWidget::initializeGL()
{
glEnable(GL_DEPTH_TEST);
if ((_context = cgCreateContext()) == 0)
qDebug() << "context [ERROR]";
else
qDebug() << "context [OK]";
_vertex_profile = cgGLGetLatestProfile(CG_GL_VERTEX);
_fragment_profile = cgGLGetLatestProfile(CG_GL_FRAGMENT);
cgGLSetOptimalOptions(_vertex_profile);
cgGLSetOptimalOptions(_fragment_profile);
if (_vertex_profile == CG_PROFILE_UNKNOWN)
qDebug() << "vertex profile [ERRORS]";
else
qDebug() << "vertex profile [OK]";
if (_fragment_profile == CG_PROFILE_UNKNOWN)
qDebug() << "fragment profile[ERRORS]";
else
qDebug() << "fragment profile[OK]";
if ((_vertex_program = cgCreateProgramFromFile(
_context,
CG_SOURCE,
"../shaders/vertex.cg",
_vertex_profile,
"C3E2v_varying",
0)) == 0)
qDebug() << "vertex shader [ERROR]";
else
qDebug() << "vertex shader [OK]";
if ((_fragment_program = cgCreateProgramFromFile(
_context,
CG_SOURCE,
"../shaders/fragment.cg",
_fragment_profile,
"C2E2f_passthrough",
0)) == 0)
qDebug() << "fragment shader [ERROR]";
else
qDebug() << "fragment shader [OK]";
cgGLLoadProgram(_vertex_program);
cgGLLoadProgram(_fragment_program);
_position_v = cgGetNamedParameter(_vertex_program, "IN.position");
_color_v = cgGetNamedParameter(_vertex_program, "IN.color");
_texCoord_v = cgGetNamedParameter(_vertex_program, "IN.texCoord");
_modelViewMatrix_v = cgGetNamedParameter(_vertex_program, "ModelViewProj");
_twist_v = cgGetNamedParameter(_vertex_program, "twisting");
_texCoord_f = cgGetNamedParameter(_fragment_program, "texCoord");
_decal_f = cgGetNamedParameter(_fragment_program, "decal");
cgSetParameter4f(_color_v, 0.0, 0.0, 1.0, 1.0);
}
void GlWidget::paintGL()
{
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
resizeGL(width(), height());
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
if (_vertex_on)
cgGLEnableProfile(_vertex_profile);
if (_fragment_on)
cgGLEnableProfile(_fragment_profile);
cgGLBindProgram(_vertex_program);
cgGLBindProgram(_fragment_program);
glPushMatrix();
glRotatef(_angle, 0.0, 0.0, 1.0);
cgGLSetStateMatrixParameter(_modelViewMatrix_v,
CG_GL_MODELVIEW_MATRIX, CG_GL_MATRIX_IDENTITY);
cgGLSetParameter1f(_twist_v, _twist);
GLuint texture;
texture = bindTexture(QPixmap(QString(":/images/texture.png")));
glBindTexture(GL_TEXTURE_2D, texture);
glColor3f(1.0, 1.0, 1.0);
for (int i = 0; i <= (_parts - 1); i++)
{
glBegin(GL_QUAD_STRIP);
// textures
float xt1 = ((float)i / (float)_parts);
float xt2 = ((float)(i + 1) / (float)_parts);
// vertices
float x1 = 1.4 * xt1 - 0.7;
float x2 = 1.4 * xt2 - 0.7;
for (int j = 0; j <= _parts; j++)
{
float yt = ((float)j / float(_parts));
float y = 1.4 * yt - 0.7;
glTexCoord2f(xt2, yt); glVertex3f(x2, y, -0.2);
glTexCoord2f(xt1, yt); glVertex3f(x1, y, -0.2);
}
glEnd();
}
glPopMatrix();
cgGLDisableProfile(_vertex_profile);
cgGLDisableProfile(_fragment_profile);
glPushMatrix();
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_QUADS);
glTexCoord2f( 0, 0); glVertex3f( 0.7, 0.7, -0.2);
glTexCoord2f( 1, 0); glVertex3f(-0.7, 0.7, -0.2);
glTexCoord2f( 1, 1); glVertex3f(-0.7, -0.7, -0.2);
glTexCoord2f( 0, 1); glVertex3f( 0.7, -0.7, -0.2);
glEnd();
glPopMatrix();
glFlush();
glPopAttrib();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
}
void GlWidget::resizeGL(int width, int height)
{
int side = qMin(width, height);
glViewport((width - side) / 2, (height - side) / 2, side, side);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
}
void GlWidget::paintEvent(QPaintEvent */*event*/)
{
QPainter painter;
painter.begin(this);
paintGL();
painter.end();
}
void GlWidget::setAngle(int angle)
{
_angle = (double)angle / 16.;
}
void GlWidget::setTwist(int twist)
{
_twist = (double)twist * 3.141592654 / 16. / 180.;
}
void GlWidget::setParts(int parts)
{
if (parts > 0)
_parts = parts;
}
void GlWidget::setVertex(int state)
{
_vertex_on = (state == Qt::Checked);
}
void GlWidget::setFragment(int state)
{
_fragment_on = (state == Qt::Checked);
}
| [
"[email protected]"
]
| [
[
[
1,
226
]
]
]
|
88766daa6e5609508a85c41fb55f293eaba9e3a1 | 3eae1d8c99d08bca129aceb7c2269bd70e106ff0 | /trunk/Codes/DeviceCode/Targets/Native/sh2/DeviceCode/sh7619/hwsetup.cpp | 760f4af0218beef1e0943a01a296dbcbe2cc874b | []
| 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 | 1,498 | cpp | /***********************************************************************/
/* */
/* FILE :hwsetup.cpp */
/* DATE :Wed, Apr 22, 2009 */
/* DESCRIPTION :Hardware Setup file */
/* CPU TYPE :SH7619 */
/* */
/* This file is generated by Renesas Project Generator (Ver.4.9). */
/* */
/***********************************************************************/
#include "iodefine.h"
#ifdef __cplusplus
extern "C" {
#endif
extern void HardwareSetup(void);
#ifdef __cplusplus
}
#endif
void HardwareSetup(void)
{
/*
CPG.MCLKCR.BYTE = 0;
CPG.MCLKCR.BIT.FLSCS = 3;
CPG.MCLKCR.BIT.FLDIVS = 7;
CPG.FRQCR.WORD = 0;
CPG.FRQCR.BIT.CKOEN = 1;
CPG.FRQCR.BIT.STC = 7;
CPG.FRQCR.BIT.IFC = 7;
CPG.FRQCR.BIT._PFC = 7;
HUDI.SDIR.WORD = 0;
HUDI.SDIR.BIT.TI = 255;
HUDI.SDID = 0;
WDT.READ.WTCNT = 0;
WDT.READ.WTCSR.BYTE = 0;
WDT.READ.WTCSR.BIT.OVF = 1;
WDT.READ.WTCSR.BIT.WTIT = 1;
WDT.READ.WTCSR.BIT.WOVF = 1;
WDT.READ.WTCSR.BIT.IOVF = 1;
WDT.READ.WTCSR.BIT.CKS = 7;
WDT.WRITE.WTCNT = 0;
WDT.WRITE.WTCSR = 0;
*/
}
| [
"[email protected]"
]
| [
[
[
1,
50
]
]
]
|
e83e9fe89b5e4127cd9ef5d636b867ca4cc12ebe | 7e68ef369eff945f581e22595adecb6b3faccd0e | /code/linux/minifw/eventhandler.cpp | 57a339eb1198044fb7eddf3a1364b02000fa14ca | []
| no_license | kimhmadsen/mini-framework | 700bb1052227ba18eee374504ff90f41e98738d2 | d1983a68c6b1d87e24ef55ca839814ed227b3956 | refs/heads/master | 2021-01-01T05:36:55.074091 | 2008-12-16T00:33:10 | 2008-12-16T00:33:10 | 32,415,758 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 200 | cpp |
#include "stdafx.h"
#include "eventhandler.h"
EventHandler::EventHandler(void)
{
}
EventHandler::~EventHandler(void)
{
}
HANDLE EventHandler::GetHandle(void)
{
return handle;
}
| [
"mariasolercliment@77f6bdef-6155-0410-8b08-fdea0229669f"
]
| [
[
[
1,
17
]
]
]
|
3e64011baa625d5173de48d218b48b4a47713531 | b7c505dcef43c0675fd89d428e45f3c2850b124f | /Src/SimulatorQt/Util/qt/Win32/include/Qt/q3multilineedit.h | 67c6700cb4100e62ee58c0ac3f8744ef858c2839 | [
"BSD-2-Clause"
]
| permissive | pranet/bhuman2009fork | 14e473bd6e5d30af9f1745311d689723bfc5cfdb | 82c1bd4485ae24043aa720a3aa7cb3e605b1a329 | refs/heads/master | 2021-01-15T17:55:37.058289 | 2010-02-28T13:52:56 | 2010-02-28T13:52:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,872 | h | /****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information ([email protected])
**
** This file is part of the Qt3Support module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at [email protected].
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef Q3MULTILINEEDIT_H
#define Q3MULTILINEEDIT_H
#include <Qt3Support/q3textedit.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Qt3SupportLight)
#ifndef QT_NO_MULTILINEEDIT
class Q3MultiLineEditCommand;
class QValidator;
class Q3MultiLineEditData;
class Q_COMPAT_EXPORT Q3MultiLineEdit : public Q3TextEdit
{
Q_OBJECT
Q_PROPERTY(int numLines READ numLines)
Q_PROPERTY(bool atBeginning READ atBeginning)
Q_PROPERTY(bool atEnd READ atEnd)
Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
Q_PROPERTY(bool edited READ edited WRITE setEdited DESIGNABLE false)
public:
Q3MultiLineEdit(QWidget* parent=0, const char* name=0);
~Q3MultiLineEdit();
QString textLine(int line) const;
int numLines() const;
virtual void insertLine(const QString &s, int line = -1);
virtual void insertAt(const QString &s, int line, int col) {
insertAt(s, line, col, false);
}
virtual void insertAt(const QString &s, int line, int col, bool mark);
virtual void removeLine(int line);
virtual void setCursorPosition(int line, int col) {
setCursorPosition(line, col, false);
}
virtual void setCursorPosition(int line, int col, bool mark);
bool atBeginning() const;
bool atEnd() const;
void setAlignment(Qt::Alignment flags);
Qt::Alignment alignment() const;
void setEdited(bool);
bool edited() const;
bool hasMarkedText() const;
QString markedText() const;
void cursorWordForward(bool mark);
void cursorWordBackward(bool mark);
// noops
bool autoUpdate() const { return true; }
virtual void setAutoUpdate(bool) {}
int totalWidth() const { return contentsWidth(); }
int totalHeight() const { return contentsHeight(); }
int maxLines() const { return QWIDGETSIZE_MAX; }
void setMaxLines(int) {}
public Q_SLOTS:
void deselect() { selectAll(false); }
protected:
QPoint cursorPoint() const;
virtual void insertAndMark(const QString&, bool mark);
virtual void newLine();
virtual void killLine();
virtual void pageUp(bool mark=false);
virtual void pageDown(bool mark=false);
virtual void cursorLeft(bool mark=false, bool wrap = true);
virtual void cursorRight(bool mark=false, bool wrap = true);
virtual void cursorUp(bool mark=false);
virtual void cursorDown(bool mark=false);
virtual void backspace();
virtual void home(bool mark=false);
virtual void end(bool mark=false);
bool getMarkedRegion(int *line1, int *col1, int *line2, int *col2) const;
int lineLength(int row) const;
private:
Q_DISABLE_COPY(Q3MultiLineEdit)
Q3MultiLineEditData *d;
};
#endif // QT_NO_MULTILINEEDIT
QT_END_NAMESPACE
QT_END_HEADER
#endif // Q3MULTILINEEDIT_H
| [
"alon@rogue.(none)"
]
| [
[
[
1,
143
]
]
]
|
48399aed8a06168c30d70a26117f1782ac3c5600 | fac8de123987842827a68da1b580f1361926ab67 | /inc/physics/Common/Serialize/Version/hkVersionRegistry.h | 629981945f4670fed9031a084420d4bb9066b763 | []
| no_license | blockspacer/transporter-game | 23496e1651b3c19f6727712a5652f8e49c45c076 | 083ae2ee48fcab2c7d8a68670a71be4d09954428 | refs/heads/master | 2021-05-31T04:06:07.101459 | 2009-02-19T20:59:59 | 2009-02-19T20:59:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,947 | h | /*
*
* Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's
* prior written consent.This software contains code, techniques and know-how which is confidential and proprietary to Havok.
* Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2008 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement.
*
*/
#ifndef HK_SERIALIZE2_VERSION_REGISTRY_H
#define HK_SERIALIZE2_VERSION_REGISTRY_H
#include <Common/Base/Reflection/hkClass.h>
#include <Common/Base/Reflection/Registry/hkDynamicClassNameRegistry.h>
class hkBindingClassNameRegistry;
class hkStaticClassNameRegistry;
class hkObjectUpdateTracker;
template <typename T> class hkArray;
template <typename T> class hkStringMap;
/// Manages conversion between sdk versions.
/// Note that the registry has no concept of version numbers being greater
/// or less than one another. It just knows that it may call a function
/// to convert between two string identifiers.
class hkVersionRegistry : public hkReferencedObject, public hkSingleton<hkVersionRegistry>
{
public:
/// Signature of the generic version functions.
typedef void (HK_CALL *VersionFunc)(hkVariant& obj, hkVariant& newObj, hkObjectUpdateTracker& tracker);
/// Specifies how to handle class signatures.
enum SignatureFlags
{
AUTO_SIGNATURE = 0xffffffff
};
/// Specifies how the versioning should be handled.
enum VersionFlags
{
/// The object is neither copied, nor defaults applied.
VERSION_MANUAL = 1<<1,
/// The object can be updated in place and has defaults applied.
VERSION_INPLACE = 1<<2,
/// The object is copied and defaults applied.
VERSION_COPY = 1<<3,
/// The object is to be removed and all references to it nullified.
VERSION_REMOVED = 1<<4,
/// The object contains a variant.
VERSION_VARIANT = 1<<5
};
struct ClassRename
{
const char* oldName;
const char* newName;
HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR( HK_MEMORY_CLASS_SERIALIZE, ClassRename );
};
/// Describes the versioning changes for a single type.
struct ClassAction
{
/// Signature before updating.
hkUint32 oldSignature;
/// Signature after updating.
hkUint32 newSignature;
/// How should the type be versioned.
int /*VersionFlags*/ versionFlags;
/// The class name as it appears in the old version.
const char* oldClassName;
/// Custom function to call or HK_NULL.
VersionFunc versionFunc;
HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR( HK_MEMORY_CLASS_SERIALIZE, ClassAction );
};
struct UpdateDescription
{
UpdateDescription(const ClassRename* renames, const ClassAction* actions, const hkClassNameRegistry* staticNewClassRegistry = HK_NULL) :
m_renames(renames), m_actions(actions), m_newClassRegistry(staticNewClassRegistry), m_next(HK_NULL)
{
}
/// Find the update action for specified class.
//const ClassAction* findActionForClass( const hkClass& classIn ) const;
/// Null or null-terminated list of renames.
const ClassRename* m_renames;
/// Null or null terminated list of actions
const ClassAction* m_actions;
/// New versions of classes.
const hkClassNameRegistry* m_newClassRegistry;
/// Null or null terminated list (stack order) of update descriptions
UpdateDescription* m_next;
HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR( HK_MEMORY_CLASS_SERIALIZE, UpdateDescription );
};
/// Signature of an update function.
typedef hkResult (HK_CALL* UpdateFunction)(
hkArray<hkVariant>& loadedObjects,
hkObjectUpdateTracker& tracker );
/// Single entry to update between specified versions.
struct Updater
{
const char* fromVersion;
const char* toVersion;
UpdateDescription* desc;
UpdateFunction optionalCustomFunction;
HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR( HK_MEMORY_CLASS_SERIALIZE, hkVersionRegistry::Updater );
};
hkVersionRegistry();
///
~hkVersionRegistry();
/// Add an updater to the registry.
/// Usually updaters are compiled in via StaticLinkedUpdaters, but
/// dynamically loaded updaters may use this method.
void registerUpdater( const Updater* updater );
/// Find the sequence of updaters to convert between given versions.
/// If there is a path between fromVersion and toVersion write the sequence
/// of updaters needed into pathOut and return HK_SUCCESS.
/// If no such path exists, return HK_FAILURE.
hkResult getVersionPath( const char* fromVersion, const char* toVersion, hkArray<const Updater*>& pathOut ) const;
const hkClassNameRegistry* getClassNameRegistry( const char* versionString ) const;
hkResult registerStaticClassRegistry(const hkStaticClassNameRegistry& staticReg);
hkResult registerUpdateDescription(UpdateDescription& updateDescription, const char* fromVersion, const char* toVersion);
public:
/// Available updaters.
hkArray<const Updater*> m_updaters;
/// List of updaters available at compile time - SEE DETAILS BELOW.
/// NB Link errors (e.g. LNK2001 under .NET) for this array probably mean you
/// have not yet registered the updaters via eg sdk/include/common/Common/Compat/hkCompatVersions.h using the HK_COMPAT_FILE macro -
/// See the demo/demos/*Classes.cpp files for examples, (e.g. demo/demos/PhysicsClasses.cpp for Physics-Only customers).
static const Updater* StaticLinkedUpdaters[];
/// List of versions and corresponding classes available at compile time - SEE DETAILS BELOW.
/// NB Link errors (e.g. LNK2001 under .NET) for this array probably mean you
/// have not yet registered the classes via eg sdk/include/common/Common/Compat/hkCompatVersions.h using the HK_COMPAT_FILE macro -
/// See the demo/demos/*Classes.cpp files for examples, (e.g. demo/demos/PhysicsClasses.cpp for Physics-Only customers).
static const hkStaticClassNameRegistry* StaticLinkedClassRegistries[];
private:
hkDynamicClassNameRegistry* getDynamicClassNameRegistry( const char* versionString ) const;
mutable hkStringMap<hkDynamicClassNameRegistry*> m_versionToClassNameRegistryMap;
};
class ValidatedClassNameRegistry : public hkDynamicClassNameRegistry
{
public:
typedef hkResult (HK_CALL *ClassRegistryCallbackFunc)(hkDynamicClassNameRegistry& classRegistry, const hkClass& klass, void* userData);
static hkResult HK_CALL processClass(hkDynamicClassNameRegistry& classRegistry, const hkClass& classToProcess, void* userData);
ValidatedClassNameRegistry(const hkClassNameRegistry* classRegistry);
/// Register a class possibly under a different name.
/// If name is null, the class name is used.
/// The name is not copied and must be valid for the lifetime
/// of this object.
virtual void registerClass( const hkClass* klass, const char* name);
private:
hkResult validateClassRegistry(const hkClass& klass, hkStringMap<hkBool32>& doneClassesInOut, ClassRegistryCallbackFunc callbackFunc, void* userData);
};
#endif // HK_SERIALIZE2_VERSION_REGISTRY_H
/*
* Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20080529)
*
* Confidential Information of Havok. (C) Copyright 1999-2008
* Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok
* Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership
* rights, and intellectual property rights in the Havok software remain in
* Havok and/or its suppliers.
*
* Use of this software for evaluation purposes is subject to and indicates
* acceptance of the End User licence Agreement for this product. A copy of
* the license is included with this software and is also available at
* www.havok.com/tryhavok
*
*/
| [
"uraymeiviar@bb790a93-564d-0410-8b31-212e73dc95e4"
]
| [
[
[
1,
199
]
]
]
|
685a3f10a87c7a92a62f874e919b6308ceba07c4 | 34d807d2bc616a23486af858647301af98b6296e | /ccbot/bnet.cpp | 0a60c88fb91dca26890b42d01d2e6cdb585effd2 | [
"LicenseRef-scancode-warranty-disclaimer"
]
| no_license | Mofsy/ccbot | 65cf5bb08c211cdce2001a36db8968844fce2e05 | f171351c99cce4059a82a23399e7c4587f37beb5 | refs/heads/master | 2020-12-28T21:39:19.297873 | 2011-03-01T00:44:46 | 2011-03-01T00:44:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 44,241 | cpp | /*
Copyright [2009] [Joško Nikolić]
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.
HEAVILY MODIFIED PROJECT BASED ON GHost++: http://forum.codelain.com
GHOST++ CODE IS PORTED FROM THE ORIGINAL GHOST PROJECT: http://ghost.pwner.org/
*/
#include "ccbot.h"
#include "util.h"
#include "config.h"
#include "language.h"
#include "socket.h"
#include "ccbotdb.h"
#include "bncsutilinterface.h"
#include "bnetprotocol.h"
#include "bnet.h"
#include <cstdio>
#include <cstdlib>
//
// CBNET
//
CBNET :: CBNET( CCCBot *nCCBot, string nServer, string nCDKeyROC, string nCDKeyTFT, string nCountryAbbrev, string nCountry, string nUserName, string nUserPassword, string nFirstChannel, string nRootAdmin, char nCommandTrigger, unsigned char nWar3Version, BYTEARRAY nEXEVersion, BYTEARRAY nEXEVersionHash, string nPasswordHashType, unsigned char nMaxMessageLength, string nClanTag, bool nGreetUsers, bool nSwearingKick, bool nAnnounceGames, bool nSelfJoin, bool nBanChat, unsigned char nClanDefaultAccess, string nHostbotName, bool nAntiSpam ): m_CCBot( nCCBot ), m_Exiting( false ), m_Server( nServer ), m_ServerAlias( m_Server ), m_CDKeyROC( nCDKeyROC ), m_CDKeyTFT( nCDKeyTFT ), m_CountryAbbrev( nCountryAbbrev ), m_Country( nCountry ), m_UserName( nUserName ), m_UserPassword( nUserPassword ), m_FirstChannel( nFirstChannel ), m_CurrentChannel( nFirstChannel ), m_RootAdmin( nRootAdmin ), m_HostbotName( nHostbotName ), m_War3Version( nWar3Version ), m_EXEVersion( nEXEVersion ), m_EXEVersionHash( nEXEVersionHash ), m_PasswordHashType( nPasswordHashType ), m_Delay( 3001 ), m_ClanDefaultAccess( nClanDefaultAccess ), m_MaxMessageLength( nMaxMessageLength ), m_NextConnectTime( GetTime( ) ), m_LastNullTime( GetTime( ) ), m_LastGetClanTime( 0 ), m_LastRejoinTime( 0 ), m_RejoinInterval( 15 ), m_LastAnnounceTime( 0 ), m_LastInvitationTime( 0 ), m_LastChatCommandTicks( 0 ), m_LastOutPacketTicks( 0 ), m_LastSpamCacheCleaning( 0 ), m_WaitingToConnect( true ), m_LoggedIn( false ), m_InChat( false ), m_AntiSpam( nAntiSpam ), m_Announce( false ), m_IsLockdown( false ), m_ActiveInvitation( false ), m_ActiveCreation( false ), m_AnnounceGames( nAnnounceGames ), m_BanChat( nBanChat ), m_SwearingKick( nSwearingKick ), m_SelfJoin( nSelfJoin ), m_GreetUsers( nGreetUsers ), m_ClanTag( "Clan " + nClanTag )
{
// todotodo: append path seperator to Warcraft3Path if needed
m_Socket = new CTCPClient( );
m_Protocol = new CBNETProtocol( );
m_BNCSUtil = new CBNCSUtilInterface( nUserName, nUserPassword );
transform( m_ServerAlias.begin( ), m_ServerAlias.end( ), m_ServerAlias.begin( ), (int(*)(int))tolower );
if( m_ServerAlias == "server.eurobattle.net" )
m_ServerAlias = "eurobattle.net";
// needed only on BNET
if( m_CDKeyROC.size( ) != 26 )
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] warning - your ROC CD key is not 26 characters long and is probably invalid" );
if( !m_CDKeyTFT.empty( ) && m_CDKeyTFT.size( ) != 26 )
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] warning - your TFT CD key is not 26 characters long and is probably invalid" );
transform( m_CDKeyROC.begin( ), m_CDKeyROC.end( ), m_CDKeyROC.begin( ), (int(*)(int))toupper );
transform( m_CDKeyTFT.begin( ), m_CDKeyTFT.end( ), m_CDKeyTFT.begin( ), (int(*)(int))toupper );
transform( m_RootAdmin.begin( ), m_RootAdmin.end( ), m_RootAdmin.begin( ), (int(*)(int))tolower );
m_CCBot->m_DB->AccessSet( m_Server, m_RootAdmin, 10 );
m_CommandTrigger = nCommandTrigger;
}
CBNET :: ~CBNET( )
{
delete m_Socket;
delete m_Protocol;
delete m_BNCSUtil;
for( vector<CUser *> :: iterator i = m_Channel.begin( ); i != m_Channel.end( ); ++i )
delete *i;
}
unsigned int CBNET :: SetFD( void *fd, void *send_fd, int *nfds )
{
if( !m_Socket->HasError( ) && m_Socket->GetConnected( ) )
{
m_Socket->SetFD( (fd_set *)fd, (fd_set *)send_fd, nfds );
return 1;
}
return 0;
}
bool CBNET :: Update( void *fd, void *send_fd )
{
// we return at the end of each if statement so we don't have to deal with errors related to the order of the if statements
// that means it might take a few ms longer to complete a task involving multiple steps (in this case, reconnecting) due to blocking or sleeping
// but it's not a big deal at all, maybe 100ms in the worst possible case (based on a 50ms blocking time)
uint64_t Time = GetTime( ), Ticks = GetTicks( );
if( m_Socket->HasError( ) )
{
// the socket has an error
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] disconnected from battle.net due to socket error" );
m_BNCSUtil->Reset( m_UserName, m_UserPassword );
m_Socket->Reset( );
m_NextConnectTime = Time + 11;
m_LoggedIn = false;
m_InChat = false;
m_WaitingToConnect = true;
return m_Exiting;
}
if( m_Socket->GetConnected( ) )
{
// the socket is connected and everything appears to be working properly
m_Socket->DoRecv( (fd_set *)fd );
// extract as many packets as possible from the socket's receive buffer and put them in the m_Packets queue
string *RecvBuffer = m_Socket->GetBytes( );
BYTEARRAY Bytes = UTIL_CreateByteArray( (unsigned char *)RecvBuffer->c_str( ), RecvBuffer->size( ) );
CIncomingChatEvent *ChatEvent = NULL;
// a packet is at least 4 bytes so loop as long as the buffer contains 4 bytes
while( Bytes.size( ) >= 4 )
{
// byte 0 is always 255
if( Bytes[0] == BNET_HEADER_CONSTANT )
{
// bytes 2 and 3 contain the length of the packet
uint16_t Length = UTIL_ByteArrayToUInt16( Bytes, false, 2 );
if( Length >= 4 )
{
if( Bytes.size( ) >= Length )
{
switch( Bytes[1] )
{
case CBNETProtocol :: SID_NULL:
// warning: we do not respond to NULL packets with a NULL packet of our own
// this is because PVPGN servers are programmed to respond to NULL packets so it will create a vicious cycle of useless traffic
// official battle.net servers do not respond to NULL packets
m_Protocol->RECEIVE_SID_NULL( BYTEARRAY( Bytes.begin( ), Bytes.begin( ) + Length ) );
break;
case CBNETProtocol :: SID_ENTERCHAT:
if( m_Protocol->RECEIVE_SID_ENTERCHAT( BYTEARRAY( Bytes.begin( ), Bytes.begin( ) + Length ) ) )
{
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] joining channel [" + m_FirstChannel + "]" );
m_InChat = true;
m_Socket->PutBytes( m_Protocol->SEND_SID_JOINCHANNEL( m_FirstChannel ) );
}
break;
case CBNETProtocol :: SID_CHATEVENT:
ChatEvent = m_Protocol->RECEIVE_SID_CHATEVENT( BYTEARRAY( Bytes.begin( ), Bytes.begin( ) + Length ) );
if( ChatEvent )
ProcessChatEvent( ChatEvent );
delete ChatEvent;
ChatEvent = NULL;
break;
case CBNETProtocol :: SID_FLOODDETECTED:
if( m_Protocol->RECEIVE_SID_FLOODDETECTED( BYTEARRAY( Bytes.begin( ), Bytes.begin( ) + Length ) ) )
{
// we're disced for flooding, exit so we don't prolong the temp IP ban
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] flood detected - exiting" );
m_Exiting = true;
}
return m_Exiting;
case CBNETProtocol :: SID_PING:
m_Socket->PutBytes( m_Protocol->SEND_SID_PING( m_Protocol->RECEIVE_SID_PING( BYTEARRAY( Bytes.begin( ), Bytes.begin( ) + Length ) ) ) );
break;
case CBNETProtocol :: SID_AUTH_INFO:
if( m_Protocol->RECEIVE_SID_AUTH_INFO( BYTEARRAY( Bytes.begin( ), Bytes.begin( ) + Length ) ) )
{
if( m_BNCSUtil->HELP_SID_AUTH_CHECK( m_CCBot->m_Warcraft3Path, m_CDKeyROC, m_CDKeyTFT, m_Protocol->GetValueStringFormulaString( ), m_Protocol->GetIX86VerFileNameString( ), m_Protocol->GetClientToken( ), m_Protocol->GetServerToken( ) ) )
{
if( m_CDKeyTFT.empty( ) )
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] attempting to auth as Warcraft III: Reign of Chaos" );
else
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] attempting to auth as Warcraft III: The Frozen Throne" );
// override the exe information generated by bncsutil if specified in the config file
// apparently this is useful for pvpgn users
if( m_EXEVersion.size( ) == 4 )
{
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] using custom exe version bnet_custom_exeversion = " + UTIL_ToString( m_EXEVersion[0] ) + " " + UTIL_ToString( m_EXEVersion[1] ) + " " + UTIL_ToString( m_EXEVersion[2] ) + " " + UTIL_ToString( m_EXEVersion[3] ) );
m_BNCSUtil->SetEXEVersion( m_EXEVersion );
}
if( m_EXEVersionHash.size( ) == 4 )
{
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] using custom exe version hash bnet_custom_exeversionhash = " + UTIL_ToString( m_EXEVersionHash[0] ) + " " + UTIL_ToString( m_EXEVersionHash[1] ) + " " + UTIL_ToString( m_EXEVersionHash[2] ) + " " + UTIL_ToString( m_EXEVersionHash[3] ) );
m_BNCSUtil->SetEXEVersionHash( m_EXEVersionHash );
}
m_Socket->PutBytes( m_Protocol->SEND_SID_AUTH_CHECK( m_Protocol->GetClientToken( ), m_BNCSUtil->GetEXEVersion( ), m_BNCSUtil->GetEXEVersionHash( ), m_BNCSUtil->GetKeyInfoROC( ), m_BNCSUtil->GetKeyInfoTFT( ), m_BNCSUtil->GetEXEInfo( ), "CCBot" ) );
}
else
{
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] logon failed - bncsutil key hash failed (check your Warcraft 3 path and cd keys), disconnecting" );
m_Socket->Disconnect( );
return m_Exiting;
}
}
break;
case CBNETProtocol :: SID_AUTH_CHECK:
if( m_Protocol->RECEIVE_SID_AUTH_CHECK( BYTEARRAY( Bytes.begin( ), Bytes.begin( ) + Length ) ) )
{
// cd keys accepted
m_BNCSUtil->HELP_SID_AUTH_ACCOUNTLOGON( );
m_Socket->PutBytes( m_Protocol->SEND_SID_AUTH_ACCOUNTLOGON( m_BNCSUtil->GetClientKey( ), m_UserName ) );
}
else
{
// cd keys not accepted
switch( UTIL_ByteArrayToUInt32( m_Protocol->m_KeyState, false ) )
{
case CBNETProtocol :: KR_OLD_GAME_VERSION:
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] Old game version - update your hashes and/or ccbot.cfg" );
break;
case CBNETProtocol :: KR_INVALID_VERSION:
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] Invalid game version - update your hashes and/or ccbot.cfg" );
break;
case CBNETProtocol :: KR_INVALID_ROC_KEY:
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] Invalid RoC key" );
break;
case CBNETProtocol :: KR_ROC_KEY_IN_USE:
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] RoC key is being used by someone else" );
break;
case CBNETProtocol :: KR_ROC_KEY_BANNED:
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] Banned RoC key" );
break;
case CBNETProtocol :: KR_WRONG_PRODUCT:
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] Wrong product key" );
break;
case CBNETProtocol :: KR_INVALID_TFT_KEY:
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] Invalid TFT key" );
break;
case CBNETProtocol :: KR_TFT_KEY_BANNED:
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] Banned TFT key" );
break;
case CBNETProtocol :: KR_TFT_KEY_IN_USE:
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] TFT key is being used by someone else" );
break;
}
m_Socket->Disconnect( );
return m_Exiting;
}
break;
case CBNETProtocol :: SID_AUTH_ACCOUNTLOGON:
if( m_Protocol->RECEIVE_SID_AUTH_ACCOUNTLOGON( BYTEARRAY( Bytes.begin( ), Bytes.begin( ) + Length ) ) )
{
// pvpgn logon
m_BNCSUtil->HELP_PvPGNPasswordHash( m_UserPassword );
m_Socket->PutBytes( m_Protocol->SEND_SID_AUTH_ACCOUNTLOGONPROOF( m_BNCSUtil->GetPvPGNPasswordHash( ) ) );
}
else
{
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] logon failed - invalid username, disconnecting" );
m_Socket->Disconnect( );
return m_Exiting;
}
break;
case CBNETProtocol :: SID_AUTH_ACCOUNTLOGONPROOF:
if( m_Protocol->RECEIVE_SID_AUTH_ACCOUNTLOGONPROOF( BYTEARRAY( Bytes.begin( ), Bytes.begin( ) + Length ) ) )
{
// logon successful
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] logon successful" );
m_LoggedIn = true;
m_Socket->PutBytes( m_Protocol->SEND_SID_ENTERCHAT( ) );
m_Socket->PutBytes( m_Protocol->SEND_SID_CLANMEMBERLIST( ) );
/* for( vector<CIncomingChannelEvent *> :: iterator i = m_Event.begin( ); i != m_Event.end( ); ++i )
delete *i; */
}
else
{
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] logon failed - invalid password, disconnecting" );
m_Socket->Disconnect( );
return m_Exiting;
}
break;
case CBNETProtocol :: SID_CLANINVITATION:
switch( m_Protocol->RECEIVE_SID_CLANINVITATION( BYTEARRAY( Bytes.begin( ), Bytes.begin( ) + Length ) ) )
{
case 9:
QueueChatCommand( m_ClanTag + " is currently full, please contact a shaman/chieftain.", false );
break;
case 5:
QueueChatCommand( "Error: " + m_LastKnown + " is using a Chat client or already in clan.", false );
break;
case 0:
QueueChatCommand( m_LastKnown + " has successfully joined " + m_ClanTag + ".", false );
SendGetClanList( );
break;
case 4:
QueueChatCommand( m_LastKnown + " has rejected a clan invitation for " + m_ClanTag + ".", false );
break;
case 8:
QueueChatCommand( "Error: " + m_LastKnown + " is using a Chat client or already in clan.", false );
break;
default:
CONSOLE_Print( "[CLAN: " + m_ServerAlias + "] received unknown SID_CLANINVITATION value [" + UTIL_ToString( m_Protocol->RECEIVE_SID_CLANINVITATION( BYTEARRAY( Bytes.begin( ), Bytes.begin( ) + Length ) ) ) + "]" );
break;
}
case CBNETProtocol :: SID_CLANINVITATIONRESPONSE:
if( m_Protocol->RECEIVE_SID_CLANINVITATIONRESPONSE( BYTEARRAY( Bytes.begin( ), Bytes.begin( ) + Length ) ) )
{
QueueChatCommand( "Clan invitation received for [" + m_Protocol->GetClanName( ) + "] from [" + m_Protocol->GetInviterStr( ) + "].", false );
QueueChatCommand( "Type " + m_CommandTrigger + "accept to accept the clan invitation.", false );
m_ActiveInvitation = true;
m_LastInvitationTime = GetTime( );
}
break;
case CBNETProtocol :: SID_CLANCREATIONINVITATION:
if( m_Protocol->RECEIVE_SID_CLANCREATIONINVITATION( BYTEARRAY( Bytes.begin( ), Bytes.begin( ) + Length ) ) )
{
QueueChatCommand( "Clan creation of [" + m_Protocol->GetClanCreationName( ) + "] by [" + m_Protocol->GetClanCreatorStr( ) + "] received - accepting...", false );
m_ActiveCreation = true;
m_LastInvitationTime = GetTime( );
}
break;
case CBNETProtocol :: SID_CLANMAKECHIEFTAIN:
switch( m_Protocol->RECEIVE_SID_CLANMAKECHIEFTAIN( BYTEARRAY( Bytes.begin( ), Bytes.begin( ) + Length ) ) )
{
case 0:
QueueChatCommand( m_LastKnown + " successfuly promoted to chieftain.", false );
SendGetClanList( );
break;
default:
QueueChatCommand( "Error setting user to Chieftain.", false );
}
break;
case CBNETProtocol :: SID_CLANREMOVEMEMBER:
switch( m_Protocol->RECEIVE_SID_CLANREMOVEMEMBER( BYTEARRAY( Bytes.begin( ), Bytes.begin( ) + Length ) ) )
{
case 1:
QueueChatCommand( "Error: " + m_Removed + " - removal failed by " + m_UsedRemove + ".", false );
m_Removed = "Unknown User";
break;
case 2:
QueueChatCommand( "Error: " + m_Removed + " - can't be removed yet from " + m_ClanTag + ".", false );
m_Removed = "Unknown User";
break;
case 0:
QueueChatCommand( m_Removed + " has been kicked from " + m_ClanTag + " by " + m_UsedRemove + ".", false );
m_Removed = "Unknown User";
SendGetClanList( );
break;
case 7:
QueueChatCommand( "Error: " + m_Removed + " - can't be removed, bot not authorised to remove.", false );
m_Removed = "Unknown User";
break;
case 8:
QueueChatCommand( "Error: " + m_Removed + " - can't be removed, not allowed.", false );
m_Removed = "Unknown User";
break;
default:
CONSOLE_Print( "[CLAN: " + m_ServerAlias + "] received unknown SID_CLANREMOVEMEMBER value [" + UTIL_ToString( m_Protocol->RECEIVE_SID_CLANREMOVEMEMBER( BYTEARRAY( Bytes.begin( ), Bytes.begin( ) + Length ) ) ) + "]" );
break;
}
case CBNETProtocol :: SID_CLANMEMBERLIST:
{
vector<CIncomingClanList *> Clans = m_Protocol->RECEIVE_SID_CLANMEMBERLIST( BYTEARRAY( Bytes.begin( ), Bytes.begin( ) + Length ) );
for( vector<CIncomingClanList *> :: iterator i = m_Clans.begin( ); i != m_Clans.end( ); ++i )
delete *i;
m_Clans = Clans;
}
break;
}
*RecvBuffer = RecvBuffer->substr( Length );
Bytes = BYTEARRAY( Bytes.begin( ) + Length, Bytes.end( ) );
}
else
break;
}
else
{
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] error - received invalid packet from battle.net (bad length), disconnecting" );
m_Socket->Disconnect( );
return m_Exiting;
}
}
else
{
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] error - received invalid packet from battle.net (bad header constant), disconnecting" );
m_Socket->Disconnect( );
return m_Exiting;
}
}
if( !m_ChatCommands.empty( ) && Ticks >= m_LastChatCommandTicks + m_Delay )
{
string ChatCommand = m_ChatCommands.front( );
m_ChatCommands.pop( );
m_Delay = 1100 + ChatCommand.length( ) * 40;
SendChatCommand( ChatCommand, false );
m_LastChatCommandTicks = Ticks;
m_LastOutPacketTicks = Ticks;
}
// send a null packet to detect disconnects
if( Time >= m_LastNullTime + 60 )
{
m_Socket->PutBytes( m_Protocol->SEND_SID_NULL( ) );
m_LastNullTime = Time;
}
if( m_AntiSpam && Time >= m_LastSpamCacheCleaning + 5 )
{
m_SpamCache.clear( );
m_LastSpamCacheCleaning = Time;
}
// refresh the clan vector so it gets updated every 70 seconds
if( Time >= m_LastGetClanTime + 70 && m_LoggedIn )
{
SendGetClanList( );
m_LastGetClanTime = Time;
}
// part of !Announce
if( m_Announce && ( Time >= m_LastAnnounceTime + m_AnnounceInterval ) )
{
QueueChatCommand( m_AnnounceMsg, false );
m_LastAnnounceTime = Time;
}
// rejoining the channel when not in the set channel
if( m_Rejoin && Time >= m_LastRejoinTime + m_RejoinInterval && m_LoggedIn )
{
SendChatCommandHidden( "/join " + m_CurrentChannel, false );
m_LastRejoinTime = Time;
}
// if we didn't accept a clan invitation send a decline after 29 seconds (to be on the safe side it doesn't cross over 30 seconds )
if( m_ActiveInvitation && Time >= ( m_LastInvitationTime + 29 ) && m_LoggedIn )
{
m_Socket->PutBytes( m_Protocol->SEND_SID_CLANINVITATIONRESPONSE( m_Protocol->GetClanTag( ), m_Protocol->GetInviter( ), false ) );
m_ActiveInvitation = false;
}
// wait 5 seconds before accepting the invitation otherwise the clan can get created but you would get an false error
if( m_ActiveCreation && Time >= ( m_LastInvitationTime + 5 ) && m_LoggedIn )
{
m_Socket->PutBytes( m_Protocol->SEND_SID_CLANCREATIONINVITATION( m_Protocol->GetClanCreationTag( ), m_Protocol->GetClanCreator( ) ) );
m_ActiveCreation = false;
}
m_Socket->DoSend( (fd_set*)send_fd );
return m_Exiting;
}
if( !m_Socket->GetConnecting( ) && !m_Socket->GetConnected( ) && !m_WaitingToConnect )
{
// the socket was disconnected
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] disconnected from battle.net due to socket not connected" );
m_BNCSUtil->Reset( m_UserName, m_UserPassword );
m_Socket->Reset( );
m_NextConnectTime = Time + 11;
m_LoggedIn = false;
m_InChat = false;
m_WaitingToConnect = true;
return m_Exiting;
}
if( m_Socket->GetConnecting( ) )
{
// we are currently attempting to connect to battle.net
if( m_Socket->CheckConnect( ) )
{
// the connection attempt completed
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] connected" );
m_Socket->PutBytes( m_Protocol->SEND_PROTOCOL_INITIALIZE_SELECTOR( ) );
m_Socket->PutBytes( m_Protocol->SEND_SID_AUTH_INFO( m_War3Version, !m_CDKeyTFT.empty( ), m_CountryAbbrev, m_Country ) );
m_Socket->DoSend( (fd_set*)send_fd );
m_LastNullTime = Time;
m_LastChatCommandTicks = Ticks;
while( !m_OutPackets.empty( ) )
m_OutPackets.pop( );
return m_Exiting;
}
else if( Time >= m_NextConnectTime + 15 )
{
// the connection attempt timed out (11 seconds)
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] connect timed out" );
m_Socket->Reset( );
m_NextConnectTime = Time + 11;
m_WaitingToConnect = true;
return m_Exiting;
}
}
if( !m_Socket->GetConnecting( ) && !m_Socket->GetConnected( ) && Time >= m_NextConnectTime )
{
// attempt to connect to battle.net
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] connecting to server [" + m_Server + "] on port 6112" );
if( m_ServerIP.empty( ) )
{
m_Socket->Connect( m_Server, 6112 );
if( !m_Socket->HasError( ) )
{
m_ServerIP = m_Socket->GetIPString( );
CONSOLE_Print( "[BNET: " + m_ServerAlias + "] resolved and cached server IP address " + m_ServerIP );
}
}
else
{
// use cached server IP address since resolving takes time and is blocking
CONSOLE_Print( "[BNET: " + m_Server + "] using cached server IP address " + m_ServerIP );
m_Socket->Connect( m_ServerIP, 6112 );
}
m_WaitingToConnect = false;
return m_Exiting;
}
return m_Exiting;
}
void CBNET :: SendChatCommand( const string &chatCommand, bool console )
{
// don't call this function directly, use QueueChatCommand instead to prevent getting kicked for flooding
if( m_LoggedIn )
{
if( !console )
{
if( chatCommand.size( ) > 200 )
m_Socket->PutBytes( m_Protocol->SEND_SID_CHATCOMMAND( chatCommand.substr( 0, 200 ) ) );
else
m_Socket->PutBytes( m_Protocol->SEND_SID_CHATCOMMAND( chatCommand ) );
if( chatCommand.substr( 0, 3 ) == "/w " )
{
string chatCommandWhisper = chatCommand.substr( 3, chatCommand.size( ) -3 );
CONSOLE_Print( "[WHISPER: " + m_ServerAlias + "] to " + chatCommandWhisper.substr( 0, chatCommandWhisper.find_first_of(" ") ) +": " + chatCommandWhisper.substr( chatCommandWhisper.find_first_of(" ")+1 , chatCommandWhisper.size( ) - chatCommandWhisper.find_first_of(" ") - 1 ) );
}
else
CONSOLE_Print( "[LOCAL: " + m_ServerAlias + "] " + chatCommand );
}
else if( console )
{
if( chatCommand.substr( 0, 3 ) == "/w " )
CONSOLE_Print( "[LOCAL: " + m_ServerAlias + "] " + chatCommand.substr( 4 + m_RootAdmin.size( ) ) );
else
CONSOLE_Print( "[LOCAL: " + m_ServerAlias + "] " + chatCommand );
}
}
}
void CBNET :: SendChatCommandHidden( const string &chatCommand, bool console )
{
// don't call this function directly, use QueueChatCommand instead to prevent getting kicked for flooding
if( m_LoggedIn && !console )
{
if( chatCommand.size( ) > 200 )
m_Socket->PutBytes( m_Protocol->SEND_SID_CHATCOMMAND( chatCommand.substr( 0, 200 ) ) );
else
m_Socket->PutBytes( m_Protocol->SEND_SID_CHATCOMMAND( chatCommand ) );
}
}
void CBNET :: QueueChatCommand( const string &chatCommand, bool console )
{
if( chatCommand.empty( ) )
return;
if( !console )
m_ChatCommands.push( chatCommand );
}
void CBNET :: QueueChatCommand( const string &chatCommand, string user, bool whisper, bool console )
{
if( chatCommand.empty( ) )
return;
// if whisper is true send the chat command as a whisper to user, otherwise just queue the chat command
if( !console )
{
if( !whisper )
QueueChatCommand( chatCommand, console );
else
QueueChatCommand( "/w " + user + " " + chatCommand, console );
}
else if ( console )
{
if( whisper )
CONSOLE_Print( "[LOCAL: " + m_ServerAlias + "] " + chatCommand.substr( 4 + m_RootAdmin.size( ) ) );
else
CONSOLE_Print( "[LOCAL: " + m_ServerAlias + "] " + chatCommand );
}
}
void CBNET :: QueueWhisperCommand( const string &chatCommand, string user, bool console )
{
if( chatCommand.empty( ) )
return;
if( !console )
m_ChatCommands.push( "/w " + user + " " + chatCommand );
else
CONSOLE_Print( "[LOCAL: " + m_ServerAlias + "] " + chatCommand.substr( 4 + m_RootAdmin.size( ) ) );
}
void CBNET :: ImmediateChatCommand( const string &chatCommand, bool console )
{
if( chatCommand.empty( ) )
return;
if( GetTicks( ) >= m_LastChatCommandTicks + 1000 )
{
SendChatCommand( chatCommand, console );
m_LastChatCommandTicks = GetTicks( );
}
}
void CBNET :: ImmediateChatCommand( const string &chatCommand, string user, bool whisper, bool console )
{
if( chatCommand.empty( ) )
return;
if( !console )
{
if( !whisper )
ImmediateChatCommand( chatCommand, console );
else
ImmediateChatCommand( "/w " + user + " " + chatCommand, console );
}
else if ( console )
CONSOLE_Print( "[LOCAL: " + m_ServerAlias + "] " + chatCommand );
}
bool CBNET :: IsRootAdmin( string name )
{
// m_RootAdmin was already transformed to lower case in the constructor
transform( name.begin( ), name.end( ), name.begin( ), (int(*)(int))tolower );
return name == m_RootAdmin;
}
bool CBNET :: IsClanPeon( string name )
{
for( vector<CIncomingClanList *> :: iterator i = m_Clans.begin( ); i != m_Clans.end( ); ++i )
if( Match( (*i)->GetName( ), name ) && ( (*i)->GetRank( ) == "Peon" || (*i)->GetRank( ) == "Recruit" ) )
return true;
return false;
}
bool CBNET :: IsClanGrunt( string name )
{
for( vector<CIncomingClanList *> :: iterator i = m_Clans.begin( ); i != m_Clans.end( ); ++i )
if( Match( (*i)->GetName( ), name ) && (*i)->GetRank( ) == "Grunt" )
return true;
return false;
}
bool CBNET :: IsClanShaman( string name )
{
for( vector<CIncomingClanList *> :: iterator i = m_Clans.begin( ); i != m_Clans.end( ); ++i )
if( Match( (*i)->GetName( ), name ) && (*i)->GetRank( ) == "Shaman" )
return true;
return false;
}
bool CBNET :: IsClanChieftain( string name )
{
for( vector<CIncomingClanList *> :: iterator i = m_Clans.begin( ); i != m_Clans.end( ); ++i )
if( Match( (*i)->GetName( ), name ) && (*i)->GetRank( ) == "Chieftain" )
return true;
return false;
}
bool CBNET :: IsClanMember( string name )
{
for( vector<CIncomingClanList *> :: iterator i = m_Clans.begin( ); i != m_Clans.end( ); ++i )
if( Match( (*i)->GetName( ), name ) )
return true;
return false;
}
vector<string> :: iterator CBNET :: GetSquelched( string name )
{
for( vector<string> :: iterator i = m_Squelched.begin( ); i != m_Squelched.end( ); ++i )
if( Match( name, *i ) )
return i;
return m_Squelched.end( );
}
bool CBNET :: IsInChannel( string name )
{
transform( name.begin( ), name.end( ), name.begin( ), (int(*)(int))tolower );
for( vector<CUser *> :: iterator i = m_Channel.begin( ); i != m_Channel.end( ); ++i )
if( (*i)->GetLowerUser( ) == name )
return true;
return false;
}
vector<string> :: iterator CBNET :: GetLockdown( string name )
{
for( vector<string> :: iterator i = m_Lockdown.begin( ); i != m_Lockdown.end( ); ++i )
if( Match( name, (*i) ) )
return i;
return m_Lockdown.end( );
}
void CBNET :: SendClanChangeRank( string accountName, CBNETProtocol :: RankCode rank )
{
if( m_LoggedIn )
m_Socket->PutBytes( m_Protocol->SEND_SID_CLANCHANGERANK( accountName, rank ) );
}
void CBNET :: SendGetClanList( )
{
if( m_LoggedIn )
m_Socket->PutBytes( m_Protocol->SEND_SID_CLANMEMBERLIST( ) );
}
string CBNET :: GetUserFromNamePartial( string name )
{
int Matches = 0;
string User;
transform( name.begin( ), name.end( ), name.begin( ), (int(*)(int))tolower );
// try to match each username with the passed string (e.g. "Varlock" would be matched with "lock")
for( vector<CUser *> :: iterator i = m_Channel.begin( ); i != m_Channel.end( ); ++i )
{
if( (*i)->GetLowerUser( ).find( name ) != string :: npos )
{
++Matches;
User = (*i)->GetLowerUser( );
if( User == name )
return User;
}
}
if( Matches == 1 )
return User;
return string( );
}
//
// CUser
//
CUser :: CUser( const string &nUser, const string &nLowerUser, int nPing, uint32_t nUserflags ) : m_User ( nUser ), m_LowerUser( nLowerUser ), m_Ping( nPing ), m_UserFlags( nUserflags )
{
}
CUser :: ~CUser( )
{
}
CUser* CBNET :: GetUserByName( string name )
{
transform( name.begin( ), name.end( ), name.begin( ), (int(*)(int))tolower );
for( vector<CUser *> :: iterator i = m_Channel.begin( ); i != m_Channel.end( ); ++i )
{
if( name == (*i)->GetLowerUser( ) )
return *i;
}
return NULL;
}
| [
"[email protected]"
]
| [
[
[
1,
851
]
]
]
|
d848beea0eb13f02bb7b2be53895995765563e27 | 1c80a726376d6134744d82eec3129456b0ab0cbf | /Project/C++/POJ/3670/3670.cpp | 97e62c04282b57de31bc2e950becebabd6d1b7af | []
| no_license | dabaopku/project_pku | 338a8971586b6c4cdc52bf82cdd301d398ad909f | b97f3f15cdc3f85a9407e6bf35587116b5129334 | refs/heads/master | 2021-01-19T11:35:53.500533 | 2010-09-01T03:42:40 | 2010-09-01T03:42:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 694 | cpp | #include "stdio.h"
#include "iostream"
#include "string.h"
#include "math.h"
#include "string"
#include "vector"
#include "set"
#include "map"
#include "queue"
#include "list"
using namespace std;
int main()
{
int a[5][5];
bool find=false;
for(int i=0;i<5;i++)
for(int j=0;j<5;j++)
cin>>a[i][j];
for(int i=0;i<5;i++){
int max=-INT_MAX;
int col;
for(int j=0;j<5;j++){
if(a[i][j]>max) {
max=a[i][j];
col=j;
}
}
find =true;
for(int j=0;j<5;j++){
if(a[j][col] < max){
find=false;
break;
}
}
if(find){
cout<<i+1<<" "<<col+1<<" "<<a[i][col]<<endl;
break;
}
}
if(!find) cout<<"not found\n";
} | [
"[email protected]@592586dc-1302-11df-8689-7786f20063ad"
]
| [
[
[
1,
44
]
]
]
|
2b1a86f0ab8bf891847fc7f3fb4485abd0153157 | 5eabfcd54c3610a230068574fccaf47fdd40839d | /Cocos2dxSimpleGame/Classes/HelloWorldScene.h | 29b65a0a6ccc0be611aab9045782dc84b677d515 | [
"MIT"
]
| permissive | quning19/cocos2d_study | 34d2b5dfd66ab530d4fd3e2d99a4932f1dda2bc8 | 44737348da7e98b92af1e61e4bae967a2347d587 | refs/heads/master | 2021-01-16T18:02:21.979906 | 2011-12-19T03:09:33 | 2011-12-19T03:09:33 | 3,009,477 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,113 | h | #ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__
#include "cocos2d.h"
#include "SimpleAudioEngine.h"
class HelloWorld : public cocos2d::CCLayerColor
{
public:
HelloWorld();
~HelloWorld();
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();
// there's no 'id' in cpp, so we recommand to return the exactly class pointer
static cocos2d::CCScene* scene();
// a selector callback
virtual void menuCloseCallback(CCObject* pSender);
// implement the "static node()" method manually
LAYER_NODE_FUNC(HelloWorld);
void spriteMoveFinished(CCNode* sender);
void gameLogic(cocos2d::ccTime dt);
void updateGame(cocos2d::ccTime dt);
void registerWithTouchDispatcher();
protected:
cocos2d::CCMutableArray<cocos2d::CCSprite*> *_targets;
cocos2d::CCMutableArray<cocos2d::CCSprite*> *_projectiles;
int _projectilesDestroyed;
private:
void addTarget();
void ccTouchesEnded(cocos2d::CCSet* touches, cocos2d::CCEvent* event);
};
#endif // __HELLOWORLD_SCENE_H__ | [
"[email protected]"
]
| [
[
[
1,
45
]
]
]
|
63a60e95ccb3743d48045fdcd9debe8ebdb88bdb | 4a9370ade4c3484d818765ab15e260cb1537694b | /estructura_datos/solver/mylist.h | c494ac45680e80784f9936b0d536c991ccb7adf5 | []
| no_license | briandore/brian_ED | 74fa664d53d0da57354225e0f29d9dbb46ce9b19 | 1c0b12cd82dc48041d2f8646f0a3fcecbfbb6e7e | refs/heads/master | 2021-01-25T03:48:13.084136 | 2011-06-20T06:13:59 | 2011-06-20T06:13:59 | 1,754,120 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 286 | h | #ifndef MYLIST_H
#define MYLIST_H
#include <QHash>
class MyList
{
public:
MyList();
void addword(QString w);
int size(){return count;}
bool lookup(QString w);
private:
QHash <QChar,MyList> lista;
bool word;
int count;
};
#endif // MYLIST_H
| [
"[email protected]"
]
| [
[
[
1,
17
]
]
]
|
fa7eb299d1310deeeb213f21b50eba48135c9445 | 58496be10ead81e2531e995f7d66017ffdfc6897 | /Sources/System/Nix/SystemUtilsImpl.cpp | ac2939ca0f0bf2d35c1d32a270da5dddb79d892e | []
| no_license | Diego160289/cross-fw | ba36fc6c3e3402b2fff940342315596e0365d9dd | 532286667b0fd05c9b7f990945f42279bac74543 | refs/heads/master | 2021-01-10T19:23:43.622578 | 2011-01-09T14:54:12 | 2011-01-09T14:54:12 | 38,457,864 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,283 | cpp | //============================================================================
// Date : 22.12.2010
// Author : Tkachenko Dmitry
// Copyright : (c) Tkachenko Dmitry ([email protected])
//============================================================================
#include "SystemUtilsImpl.h"
#include <vector>
#include <stdlib.h>
#include "Utf8/utf8.h"
namespace System
{
std::wstring AStringToWStringImpl(const std::string &str, bool fromUTF8)
{
if (fromUTF8)
{
if (utf8::find_invalid(str.begin(), str.end()) != str.end())
return L"";
std::wstring RetStr;
utf8::utf8to16(str.begin(), str.end(), std::back_inserter(RetStr));
return RetStr;
}
size_t Len = str.length() + 1;
std::vector<wchar_t> Buf(Len, 0);
mbstowcs(&Buf[0], str.c_str(), Len - 1);
return &Buf[0];
}
std::string WStringToAStringImpl(const std::wstring &str, bool toUTF8)
{
if (toUTF8)
{
std::string RetStr;
utf8::utf16to8(str.begin(), str.end(), std::back_inserter(RetStr));
return RetStr;
}
size_t Len = str.length() + 1;
std::vector<char> Buf(Len, 0);
wcstombs(&Buf[0], str.c_str(), Len - 1);
return &Buf[0];
}
}
| [
"TkachenkoDmitryV@d548627a-540d-11de-936b-e9512c4d2277"
]
| [
[
[
1,
50
]
]
]
|
222ed928111fe925f01e5d6fe10b56492d252088 | 3533c9f37def95dcc9d6b530c59138f7570ca239 | /guCORE/include/guCORE_CGUCOREModule.h | 28a6d6d8e17e322502b6fb7030e97e1295cb443d | []
| no_license | LiberatorUSA/GU | 7e8af0dccede7edf5fc9c96c266b9888cff6d76e | 2493438447e5cde3270e1c491fe2a6094dc0b4dc | refs/heads/master | 2021-01-01T18:28:53.809051 | 2011-06-04T00:12:42 | 2011-06-04T00:12:42 | 41,840,823 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,736 | h | /*
* guCORE: Main module of the Galaxy Unlimited system
* Copyright (C) 2002 - 2008. Dinand Vanvelzen
*
* 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
*/
#ifndef GU_CORE_CGUCOREMODULE_H
#define GU_CORE_CGUCOREMODULE_H
/*-------------------------------------------------------------------------//
// //
// INCLUDES //
// //
//-------------------------------------------------------------------------*/
#ifndef GUCEGUI_MACROS_H
#include "guceGUI_macros.h" /* often used guceGUI macros */
#define GUCEGUI_MACROS_H
#endif /* GUCEGUI_MACROS_H ? */
/*-------------------------------------------------------------------------//
// //
// NAMESPACE //
// //
//-------------------------------------------------------------------------*/
namespace GU {
namespace CORE {
/*-------------------------------------------------------------------------//
// //
// CLASSES //
// //
//-------------------------------------------------------------------------*/
class CGUCOREModule
{
public:
static bool Load( void );
static bool Unload( void );
private:
CGUCOREModule( void );
CGUCOREModule( const CGUCOREModule& src );
~CGUCOREModule();
CGUCOREModule& operator=( const CGUCOREModule& src );
};
/*-------------------------------------------------------------------------//
// //
// NAMESPACE //
// //
//-------------------------------------------------------------------------*/
}; /* namespace CORE */
}; /* namespace GU */
/*-------------------------------------------------------------------------*/
#endif /* GU_CORE_CGUCOREMODULE_H ? */
/*-------------------------------------------------------------------------//
// //
// Info & Changes //
// //
//-------------------------------------------------------------------------//
- 26-04-2005 :
- Initial implementation
-----------------------------------------------------------------------------*/ | [
"[email protected]"
]
| [
[
[
1,
86
]
]
]
|
20711586689e6a6ad71beb285629fd5231eec66a | 21da454a8f032d6ad63ca9460656c1e04440310e | /tools/wcpp_vc9_projects/test.utest.win32/utInputStream.cpp | 25af1340f9916236d52b8dae3553d4432499d2f0 | []
| no_license | merezhang/wcpp | d9879ffb103513a6b58560102ec565b9dc5855dd | e22eb48ea2dd9eda5cd437960dd95074774b70b0 | refs/heads/master | 2021-01-10T06:29:42.908096 | 2009-08-31T09:20:31 | 2009-08-31T09:20:31 | 46,339,619 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 488 | cpp | #include "utInputStream.h"
#include <wcpp/lang/wscSystem.h>
#include <iostream>
void utInputStream::Init(void)
{
ws_ptr<wsiInputStream> is;
NewObj<utInputStream>( &is );
wscSystem::SetIn( is );
}
const ws_char * const utInputStream::s_class_name = "utInputStream";
utInputStream::utInputStream(void)
{
}
utInputStream::~utInputStream(void)
{
}
ws_int utInputStream::Read(void)
{
char chr;
std::cin >> chr;
return chr;
}
| [
"xukun0217@98f29a9a-77f1-11de-91f8-ab615253d9e8"
]
| [
[
[
1,
33
]
]
]
|
6eb753433788ed0ebf880e113a0b6b25cb13c236 | 0dba4a3016f3ad5aa22b194137a72efbc92ab19e | /a2e/src/a2eanim.h | e4b92d294cc3cf2e29491df5bdb1220f63ff6057 | []
| no_license | BackupTheBerlios/albion2 | 11e89586c3a2d93821b6a0d3332c1a7ef1af6abf | bc3d9ba9cf7b8f7579a58bc190a4abb32b30c716 | refs/heads/master | 2020-12-30T10:23:18.448750 | 2007-01-26T23:58:42 | 2007-01-26T23:58:42 | 39,515,887 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,817 | h | /*
* 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 Library 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.
*/
#ifndef __A2EANIM_H__
#define __A2EANIM_H__
#ifdef WIN32
#include <windows.h>
#endif
#include <iostream>
#include <fstream>
#include <string>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <SDL/SDL_thread.h>
#include <omp.h>
#include <cmath>
#include <GL/gl.h>
#include <GL/glu.h>
#include "msg.h"
#include "core.h"
#include "vertex3.h"
#include "quaternion.h"
#include "file_io.h"
#include "a2ematerial.h"
#include "engine.h"
#include "shader.h"
#include "extensions.h"
using namespace std;
#include "win_dll_export.h"
/*! @class a2eanim
* @brief class for loading and displaying an a2e skeletal animated model
* @author flo
* @todo -
*
* the a2e skeletal animation class
*
* thx to bozo for the .md5 format specification and
* julien rebetez for that very useful .md5 tutorial (and code)
*/
class A2E_API a2eanim
{
protected:
struct joint;
struct animation;
public:
a2eanim(engine* e, shader* s);
~a2eanim();
void draw(bool use_shader = true);
void draw_joints();
void load_model(char* filename, bool vbo = false);
void add_animation(char* filename);
void delete_animations();
void build_bone(unsigned int frame, joint* jnt, vertex3* parent_translation, quaternion* parent_oriantation);
void skin_mesh();
void set_material(a2ematerial* material);
void set_draw_joints(bool state);
bool get_draw_joints();
unsigned int get_animation_count();
animation* get_animation(unsigned int num);
unsigned int get_current_animation_number();
animation* get_current_animation();
unsigned int get_current_frame();
void set_current_frame(unsigned int num);
void set_current_animation(unsigned int num);
void play_frames(unsigned start, unsigned int end);
void set_position(float x, float y, float z);
vertex3* get_position();
void set_scale(float x, float y, float z);
vertex3* get_scale();
void set_rotation(float x, float y, float z);
vertex3* get_rotation();
void set_phys_scale(float x, float y, float z);
vertex3* get_phys_scale();
void set_visible(bool state);
bool get_visible();
core::aabbox* get_bounding_box();
void build_bounding_box();
string* get_object_names();
vertex3* get_vertices(unsigned int mesh);
unsigned int get_vertex_count(unsigned int mesh);
unsigned int get_vertex_count();
core::index* get_indices(unsigned int mesh);
unsigned int get_index_count(unsigned int mesh);
unsigned int get_index_count();
void set_draw_wireframe(bool state);
bool get_draw_wireframe();
void update_mview_matrix();
void update_scale_matrix();
// used for parallax mapping
void generate_normal_list();
void generate_normals();
void set_light_position(vertex3* lpos);
unsigned int get_object_count();
protected:
msg* m;
file_io* file;
core* c;
engine* e;
shader* s;
ext* exts;
struct joint {
int num;
int parent_num;
vertex3 position;
quaternion orientation;
joint* parent;
unsigned int children_count;
joint** childrens;
};
struct mesh {
unsigned int vertex_count;
unsigned int* weight_counts;
unsigned int* weight_indices;
vertex3* vertices;
core::coord* tex_coords;
GLuint vbo_vertices_id;
GLuint vbo_tex_coords_id;
// boolean that determines if we already computed
// the normal, binormal and tangent vector
bool nbt_computed;
vertex3** normal;
vertex3** binormal;
vertex3** tangent;
GLuint vbo_normals_id;
GLuint vbo_binormals_id;
GLuint vbo_tangents_id;
unsigned int triangle_count;
core::index* indices;
GLuint vbo_indices_ids;
unsigned int weight_count;
int* bone_indices;
float* weight_strenghts;
vertex3* weights;
};
struct animation {
unsigned int joint_count;
unsigned int frame_count;
unsigned int animated_components_count;
float frame_time;
int* joint_parents;
unsigned int* joint_flags;
unsigned int* joint_start_indices;
vertex3* joint_base_translation;
quaternion* joint_base_orientation;
float** frames;
};
struct nlist {
unsigned int* num;
unsigned int count;
};
unsigned int joint_count;
unsigned int base_joint_count;
unsigned int mesh_count;
joint* joints;
joint** base_joints;
mesh* meshes;
string* object_names;
unsigned int canimations;
animation** animations;
unsigned int current_animation;
unsigned int current_frame;
unsigned int last_frame;
unsigned int timer;
bool is_material;
a2ematerial* material;
bool is_draw_joints;
unsigned int start_frame;
unsigned int end_frame;
vertex3* position;
vertex3* scale;
vertex3* rotation;
vertex3* phys_scale;
bool is_visible;
float angle0;
nlist** normal_list;
unsigned int max_vertex_connections;
vertex3* light_position;
core::aabbox* bbox;
bool init;
bool draw_wireframe;
matrix4 mview_mat;
matrix4 scale_mat;
//! flag that specifies if this model uses a vertex buffer objects
bool vbo;
};
#endif
| [
"[email protected]"
]
| [
[
[
1,
251
]
]
]
|
60d7a7207aa946d086ba9bdaeb071542ba83bc09 | 611fc0940b78862ca89de79a8bbeab991f5f471a | /src/Event/EventManager.cpp | d0852a582172faacff6667b43e3acdb06b94e840 | []
| no_license | LakeIshikawa/splstage2 | df1d8f59319a4e8d9375b9d3379c3548bc520f44 | b4bf7caadf940773a977edd0de8edc610cd2f736 | refs/heads/master | 2021-01-10T21:16:45.430981 | 2010-01-29T08:57:34 | 2010-01-29T08:57:34 | 37,068,575 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 712 | cpp | #include "EventManager.h"
EventManager::EventManager()
{}
EventManager::~EventManager()
{}
/*
リストにはいっているイベントを全部
実行し、その後リストを空にします
イベントが消去されます
*/
void EventManager::Process()
{
for each (Event* ev in lstEvents){
if( ev->ElapseTime() ){
lstDelEvents.push_back( ev );
}
}
// 不要になったイベントを削除
for each (Event* rev in lstDelEvents){
lstEvents.remove( rev );
delete rev;
}
lstDelEvents.clear();
}
/*
リクエスト: イベントをリストに入れます
*/
void EventManager::Request(Event *rEvent)
{
lstEvents.push_back( rEvent );
}
| [
"lakeishikawa@c9935178-01ba-11df-8f7b-bfe16de6f99b"
]
| [
[
[
1,
38
]
]
]
|
e120c1eb2018906b993f5feacc04775d6ff2d4e6 | 74e7667ad65cbdaa869c6e384fdd8dc7e94aca34 | /MicroFrameworkPK_v4_1/BuildOutput/public/debug/Client/stubs/corlib_native_System_TimeSpan.h | e4c8f0fef6ee23dedd85aa9086b1bc17ad3f3405 | [
"BSD-3-Clause",
"OpenSSL",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
]
| permissive | gezidan/NETMF-LPC | 5093ab223eb9d7f42396344ea316cbe50a2f784b | db1880a03108db6c7f611e6de6dbc45ce9b9adce | refs/heads/master | 2021-01-18T10:59:42.467549 | 2011-06-28T08:11:24 | 2011-06-28T08:11:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,864 | h | //-----------------------------------------------------------------------------
//
// ** WARNING! **
// This file was generated automatically by a tool.
// Re-running the tool will overwrite this file.
// You should copy this file to a custom location
// before adding any customization in the copy to
// prevent loss of your changes when the tool is
// re-run.
//
//-----------------------------------------------------------------------------
#ifndef _CORLIB_NATIVE_SYSTEM_TIMESPAN_H_
#define _CORLIB_NATIVE_SYSTEM_TIMESPAN_H_
namespace System
{
struct TimeSpan
{
// Helper Functions to access fields of managed object
static INT64& Get_m_ticks( CLR_RT_HeapBlock* pMngObj ) { return Interop_Marshal_GetField_INT64( pMngObj, Library_corlib_native_System_TimeSpan::FIELD__m_ticks ); }
// Declaration of stubs. These functions are implemented by Interop code developers
static INT8 Equals( CLR_RT_HeapBlock* pMngObj, UNSUPPORTED_TYPE param0, HRESULT &hr );
static LPCSTR ToString( CLR_RT_HeapBlock* pMngObj, HRESULT &hr );
static void _ctor( CLR_RT_HeapBlock* pMngObj, INT32 param0, INT32 param1, INT32 param2, HRESULT &hr );
static void _ctor( CLR_RT_HeapBlock* pMngObj, INT32 param0, INT32 param1, INT32 param2, INT32 param3, HRESULT &hr );
static void _ctor( CLR_RT_HeapBlock* pMngObj, INT32 param0, INT32 param1, INT32 param2, INT32 param3, INT32 param4, HRESULT &hr );
static INT32 CompareTo( CLR_RT_HeapBlock* pMngObj, UNSUPPORTED_TYPE param0, HRESULT &hr );
static INT32 Compare( UNSUPPORTED_TYPE param0, UNSUPPORTED_TYPE param1, HRESULT &hr );
static INT8 Equals( UNSUPPORTED_TYPE param0, UNSUPPORTED_TYPE param1, HRESULT &hr );
};
}
#endif //_CORLIB_NATIVE_SYSTEM_TIMESPAN_H_
| [
"[email protected]"
]
| [
[
[
1,
35
]
]
]
|
efe0c41a9d652866ce9c702001d3f65654132280 | 0f40e36dc65b58cc3c04022cf215c77ae31965a8 | /src/apps/vis/writer/vis_png_writer.cpp | 62920994bc2a70c2346baf1c74dcfff460f911af | [
"MIT",
"BSD-3-Clause"
]
| permissive | venkatarajasekhar/shawn-1 | 08e6cd4cf9f39a8962c1514aa17b294565e849f8 | d36c90dd88f8460e89731c873bb71fb97da85e82 | refs/heads/master | 2020-06-26T18:19:01.247491 | 2010-10-26T17:40:48 | 2010-10-26T17:40:48 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,383 | cpp | /************************************************************************
** This file is part of the network simulator Shawn. **
** Copyright (C) 2004,2005 by SwarmNet (www.swarmnet.de) **
** and SWARMS (www.swarms.de) **
** Shawn is free software; you can redistribute it and/or modify it **
** under the terms of the GNU General Public License, version 2. **
************************************************************************/
#include "../buildfiles/_apps_enable_cmake.h"
#ifdef ENABLE_VIS
#include "apps/vis/writer/vis_png_writer.h"
#include "apps/vis/base/visualization.h"
#include "sys/util/defutils.h"
#include <cmath>
#include <sstream>
#include <iomanip>
#include "cairo.h"
namespace vis
{
PNGWriter::
PNGWriter()
: buffer_ ( NULL ),
buffer_size_ ( -1 )
{}
// ----------------------------------------------------------------------
PNGWriter::
~PNGWriter()
{
if( surface_ != NULL ) drop_surface();
if( buffer_ != NULL ) delete[] buffer_;
}
// ----------------------------------------------------------------------
void
PNGWriter::
write_frame_to_file( cairo_t* cr )
throw( std::runtime_error )
{
std::string fn=next_file_name();
cairo_surface_write_to_png( surface_, fn.c_str() );
}
// ----------------------------------------------------------------------
std::string
PNGWriter::
next_file_name( void )
throw()
{
if( multi_frame_ )
{
std::ostringstream oss;
oss << file_base_
<< "-"
<< std::setw(5) << std::setfill('0') << next_frame_number()
<< ".png";
return oss.str();
}
else
return file_base_ + std::string(".png");
}
// ----------------------------------------------------------------------
void
PNGWriter::
make_buffer( int w, int h )
throw()
{
int sz = w * h * 4;
if( buffer_ == NULL )
{
buffer_ = new unsigned char[sz];
buffer_size_ = sz;
}
else if( buffer_size_ < sz )
{
if( surface_ != NULL )
drop_surface();
delete [] buffer_;
buffer_ = new unsigned char[sz];
buffer_size_ = sz;
}
}
// ----------------------------------------------------------------------
void
PNGWriter::
make_surface( int w, int h )
throw()
{
make_buffer( w, h );
bool do_alloc=false;
if( (surface_ != NULL) &&
( (surface_width_ != w) ||
(surface_height_ != h) ) )
drop_surface();
if( surface_ == NULL )
{
assert( buffer_!=NULL );
assert( buffer_size_ >= w*h*4 );
surface_ =
cairo_image_surface_create_for_data ( buffer_,
CAIRO_FORMAT_ARGB32,
w,h,
w*4);
surface_width_ = w;
surface_height_ = h;
}
}
}
#endif
/*-----------------------------------------------------------------------
* Source $Source: /cvs/shawn/shawn/tubsapps/vis/writer/vis_png_writer.cpp,v $
* Version $Revision: 1.8 $
* Date $Date: 2006/03/15 14:14:02 $
*-----------------------------------------------------------------------
* $Log: vis_png_writer.cpp,v $
* Revision 1.8 2006/03/15 14:14:02 pfister
* *** empty log message ***
*
* Revision 1.7 2006/02/25 15:21:41 ali
* *** empty log message ***
*
* Revision 1.6 2006/02/22 09:18:57 ali
* *** empty log message ***
*
* Revision 1.5 2006/02/19 21:34:29 ali
* *** empty log message ***
*
* Revision 1.4 2006/02/14 21:53:10 ali
* *** empty log message ***
*
* Revision 1.3 2006/02/04 20:19:46 ali
* *** empty log message ***
*
* Revision 1.2 2006/02/01 17:07:29 ali
* *** empty log message ***
*
* Revision 1.1 2006/01/31 12:44:00 ali
* *** empty log message ***
*
*-----------------------------------------------------------------------*/
| [
"[email protected]"
]
| [
[
[
1,
144
]
]
]
|
92cd8b1a1fbb4ce1e8d848472897561af398d94c | 3a577d02f876776b22e2bf1c0db12a083f49086d | /vba2/gba2/common/igpio.h | d643f7ea3b34d9bc0e1c8c031fa6c67e2acc5ee0 | []
| no_license | xiaoluoyuan/VisualBoyAdvance-2 | d19565617b26e1771f437842dba5f0131d774e73 | cadd2193ba48e1846b45f87ff7c36246cd61b6ee | refs/heads/master | 2021-01-10T01:19:23.884491 | 2010-05-12T09:59:37 | 2010-05-12T09:59:37 | 46,539,728 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,273 | h | /* VisualBoyAdvance 2
Copyright (C) 2009-2010 VBA development team
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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef IGPIO_H
#define IGPIO_H
#include "Types.h"
/**
This class provides a standardized interface for sending and receiving 4 data bits through the cartridge general purpose input/output bus.
*/
class IGPIO {
public:
/**
send4 must only send bits if corresponding bit in mask4 is 1
*/
virtual void send4( u8 data4, u8 mask4 ) = 0;
/**
receive4 must only return bits if corresponding bit in mask4 is 0
*/
virtual u8 receive4( u8 mask4 ) = 0;
};
#endif // IGPIO_H
| [
"spacy51@5a53c671-dd2d-0410-9261-3f5c817b7aa0"
]
| [
[
[
1,
43
]
]
]
|
d505c56f63a894ff0293a2f0641bb6d661fc8404 | 67eb317425b7d73ef1ccfbaedde490e0c3ef697a | /os/Memory_Allocation.CPP | cb513e573b44176e16252159ea156b3e2c5fb0b3 | []
| no_license | selfcompiler/c---files | 3d97db0b537adbb12f33cee4192f4960f1c2804a | 1cfc8b97c038408334a3afe3401a36afbbda807e | refs/heads/master | 2021-01-18T03:58:31.900944 | 2011-11-14T11:42:28 | 2011-11-14T11:42:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,131 | cpp | #include<conio.h>
#include<stdio.h>
#include<iostream.h>
class memall
{
int avhl[25],n;
int req;
public :
void getdata();
void firstfit();
void bestfit();
void worstfit();
};
void memall :: getdata()
{
cout<<"\n\nEnter the total number of available holes: ";
cin>>n;
cout<<"\n\n";
for(int i=0;i<n;i++)
{
cout<<"\nEnter the size of hole "<<i+1<<": ";
cin>>avhl[i];
}
cout<<"\n\n Enter the memory space required for the process :";
cin>>req;
}
void memall :: firstfit()
{
int k=0;
for(int j =0;j < n;j++)
{
if(avhl[j] > req)
{
k++;
break;
}
}
if(k==0)
{
cout<<"\n\n No hole is big enough for this process..";
}
else
{
cout<<"\n\n Hole no "<<j+1<<" is allocated of size "<<avhl[j];
}
}
void memall :: worstfit()
{
int maxsize = avhl[0];
int k;
for(int j=1;j < n;j++)
{
if(maxsize <= avhl[j])
{
maxsize=avhl[j];
k = j;
}
}
if(maxsize >= req)
{
cout<<"\n\n Hole no "<<k+1<<" is allocated of size "<<avhl[k];
}
else
{
cout<<"\n\n No hole is big enough for the process..";
}
}
void memall :: bestfit()
{
int size,k=0;
size = avhl[0];
for(int l=1;l < n;l++)
{
if(size <= avhl[l])
{
size=avhl[l];
}
}
for(int j=1;j<n;j++)
{
if(size >= avhl[j] && avhl[j] >= req)
{
size = avhl[j];
k=j;
}
}
if(size >= req)
{
cout<<"\n\n The best possible fit is at hole "<<k+1<<" of size "<<avhl[k];
}
else
{
cout<<"\n\n No hole is big enough for this process..";
}
}
void main()
{
int ch;
memall o1;
clrscr();
cout<<"\n\n\t\t\t MEMORY ALLOCATION";
o1.getdata();
clrscr();
while(1){
cout<<"\n\n\n\n\t\t Memory Allocation Method";
cout<<"\n\n 1. First Fit";
cout<<"\n 2. Best Fit";
cout<<"\n 3. Worst Fit";
cout<<"\n 4. Exit";
cout<<"\n\n Enter your choice :";
cin>>ch;
if(ch == 4)
{
break;
}
switch(ch)
{
case 1 : o1.firstfit();
break;
case 2 : o1.bestfit();
break;
case 3 : o1.worstfit();
break;
}
getch();
}
} | [
"[email protected]"
]
| [
[
[
1,
148
]
]
]
|
8318d989ff285eae55e1592fe9d9d792a2e1a231 | e07af5d5401cec17dc0bbf6dea61f6c048f07787 | /frame.cpp | 2993d57d10924864dc2e74a5e669753f2ab08e3b | []
| no_license | Mosesofmason/nineo | 4189c378026f46441498a021d8571f75579ce55e | c7f774d83a7a1f59fde1ac089fde9aa0b0182d83 | refs/heads/master | 2016-08-04T16:33:00.101017 | 2009-12-26T15:25:54 | 2009-12-26T15:25:54 | 32,200,899 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,908 | cpp | ////////////////////////////////////////////////////////////////////////////////
////////// Author: newblue <[email protected]>
////////// Copyright by newblue, 2008.
////////////////////////////////////////////////////////////////////////////////
#include "frame.hpp"
#include "grouplist.hpp"
#include "db.hpp"
#include "thread.hpp"
#include "log.hpp"
#include "vlist.hpp"
#include "group.hpp"
#include <wx/laywin.h>
#include <wx/sashwin.h>
#include <wx/fontdlg.h>
NiFrame::NiFrame ( const wxString& title )
: wxFrame (NULL, wxID_ANY, title)
{
SetName (wxT("NiFrame"));
m_mgr.SetManagedWindow (this);
UI ();
m_mgr.Update ();
NiDB::ArticleDBManager::OpenManager ();
}
NiFrame::~NiFrame ()
{
m_mgr.UnInit();
NiDB::ArticleDBManager::CloseManager ();
NiDB::ActiveDBManager::CloseManager ();
}
void NiFrame::UI ()
{
wxAuiNotebook *nb = new wxAuiNotebook ( this, ID_NOTEBOOK,
wxDefaultPosition, wxDefaultSize,
wxBORDER_NONE|wxAUI_NB_TAB_MOVE|
wxAUI_NB_TAB_EXTERNAL_MOVE|
wxAUI_NB_SCROLL_BUTTONS|
wxAUI_NB_WINDOWLIST_BUTTON|
wxAUI_NB_BOTTOM );
wxASSERT ( nb != NULL );
wxAuiPaneInfo info;
info.Name(wxT("Notebook")).CenterPane().PaneBorder(false);
m_mgr.AddPane (nb, info);
NewsgroupUI ();
NiThread::TaskPanel *tp = new NiThread::TaskPanel (this, wxID_ANY );
if ( tp )
{
nb->AddPage (tp, _("Task Manager&Log Viewer"), true);
}
#if __WXDEBUG__
wxVisualList *list = new wxVisualList ( this, wxID_ANY );
if ( list )
{
list->SetCount (200);
nb->AddPage ( list, _("VisualList"), true );
}
#endif
nb->SetSelection (0);
CreateStatusBar();
BuildMenu ();
}
void NiFrame::NewsgroupUI ()
{
wxAuiNotebook *nb = static_cast <wxAuiNotebook*> (FindWindow (ID_NOTEBOOK));
wxASSERT ( nb != NULL );
wxPanel *panel = new wxPanel ( this, ID_NEWSGROUPPANEL );
wxSize size = panel->GetClientSize ();
wxSashLayoutWindow* left = new wxSashLayoutWindow(panel, ID_SASHLEFT,
wxDefaultPosition, wxSize (200, 600),
wxNO_BORDER|wxSW_BORDER|wxCLIP_CHILDREN );
wxSashLayoutWindow* rtop = new wxSashLayoutWindow(panel, ID_SASHRIGHTTOP,
wxDefaultPosition, wxSize (800, 500),
wxNO_BORDER|wxSW_BORDER|wxCLIP_CHILDREN );
wxSashLayoutWindow* rbottom = new wxSashLayoutWindow(panel, ID_SASHRIGHTBOTTOM,
wxDefaultPosition, wxSize (800, 500),
wxNO_BORDER|wxSW_BORDER|wxCLIP_CHILDREN );
left->SetDefaultSize (wxSize(300, 1000));
left->SetOrientation (wxLAYOUT_VERTICAL);
left->SetAlignment (wxLAYOUT_LEFT);
left->SetSashVisible (wxSASH_RIGHT, true);
rtop->SetDefaultSize ( wxSize (600, 300) );
rtop->SetOrientation (wxLAYOUT_HORIZONTAL);
rtop->SetAlignment (wxLAYOUT_TOP);
rtop->SetBackgroundColour(wxColor (55,22,33));
rtop->SetSashVisible (wxSASH_BOTTOM, true);
rbottom->SetDefaultSize ( wxSize (600, 400) );
rbottom->SetOrientation (wxLAYOUT_HORIZONTAL);
rbottom->SetAlignment (wxLAYOUT_TOP);
rbottom->SetBackgroundColour(wxColor (88,33,11));
NiGroupView *groupview = new NiGroupView ( left, ID_GROUPVIEW );
NiSummaryView *summaryview= new NiSummaryView ( rtop, ID_SUMMARYVIEW );
wxTextCtrl *text = new wxTextCtrl ( rbottom, ID_MESSAGEVIEW );
nb->AddPage ( panel, _("Newsgroup"), true );
}
void NiFrame::Init ()
{
NiConfig::Config *config = NiConfig::DefaultConfig::GetConfig ();
NiGroupView *groupview = static_cast <NiGroupView*> (FindWindow (ID_GROUPVIEW));
wxASSERT ( groupview != NULL && config != NULL );
bool noserver = config->CountServer() == 0;
groupview->LoadConfig ();
if ( noserver )
{
wxString message = _("Are you add a new server?");
wxMessageDialog dialog ( this, message, _("Add a new server?"),
wxYES_NO|wxICON_QUESTION );
if ( dialog.ShowModal () == wxID_YES )
groupview->AddNewServer ();
}
}
void NiFrame::OnSize ( wxSizeEvent& event )
{
Update ();
wxWindow* newsgroup_panel = FindWindow (ID_NEWSGROUPPANEL);
wxASSERT ( newsgroup_panel != NULL );
wxLayoutAlgorithm layout;
layout.LayoutWindow (newsgroup_panel);
event.Skip ();
}
void NiFrame::OnMouseEnter ( wxMouseEvent& event )
{
Update ();
event.Skip ();
}
void NiFrame::OnSashDrag ( wxSashEvent& event )
{
wxLogDebug (wxT("SashDrag"));
wxSashLayoutWindow *left = NULL, *right = NULL, *righttop = NULL, *rightbottom = NULL;
left = static_cast <wxSashLayoutWindow*> (FindWindow ( ID_SASHLEFT ));
righttop = static_cast <wxSashLayoutWindow*> (FindWindow ( ID_SASHRIGHTTOP ));
rightbottom = static_cast <wxSashLayoutWindow*> (FindWindow ( ID_SASHRIGHTBOTTOM ));
wxASSERT ( left != NULL && righttop != NULL && rightbottom != NULL );
wxWindow *panel = FindWindow ( ID_NEWSGROUPPANEL );
wxSize psize = panel->GetClientSize ();
left->SetDefaultSize ( wxSize ( 300, psize.GetHeight () ) );
righttop->SetDefaultSize ( wxSize ( psize.GetWidth() - 310, psize.GetHeight()/2 - 1) );
rightbottom->SetDefaultSize ( wxSize ( psize.GetWidth() - 310, psize.GetHeight()/2 -1 ) );
wxLayoutAlgorithm layout;
layout.LayoutWindow (panel);
panel->Refresh ();
}
void NiFrame::OnSelectGroup ( wxTreeEvent& event )
{
NiGroupView* gv = static_cast <NiGroupView*> (FindWindow (ID_GROUPVIEW));
NiSummaryView* sv = static_cast <NiSummaryView*> (FindWindow (ID_SUMMARYVIEW));
wxASSERT ( gv != NULL && sv != NULL );
NiGroup::SubGroup group;
bool isok = gv->GetGroup ( event.GetItem (), group );
if ( isok )
{
sv->Load (group);
}
}
void NiFrame::OnTest ( wxCommandEvent& event )
{
NiUtils::Loger* loger = NiUtils::DefaultLoger::GetLoger ();
loger->Message (wxT("Test begin:"));
#if 0
NiIdent::Ident ident;
NiIdent::NiIdentDialog iddialog ( this, wxID_ANY, ident );
iddialog.ShowModal ();
#endif
#if 0
NiServer::Server server;
NiServer::NiServerDialog server_dialog (this, wxID_ANY, server);
server_dialog.ShowModal ();
#endif
wxString desc;
wxWindow* gv = FindWindow ( ID_GROUPVIEW );
wxFont font;
font = gv->GetFont ();
desc += wxString::From8BitData (font.GetNativeFontInfoUserDesc ().ToUTF8 ().data());
desc << wxT("|");
font = wxSystemSettings::GetFont (wxSYS_OEM_FIXED_FONT);
desc += wxString::From8BitData (font.GetNativeFontInfoUserDesc ().ToUTF8 ().data());
desc << wxT("|");
font = wxSystemSettings::GetFont (wxSYS_ANSI_FIXED_FONT);
desc += wxString::From8BitData (font.GetNativeFontInfoUserDesc ().ToUTF8 ().data());
desc << wxT("|");
font = wxSystemSettings::GetFont (wxSYS_ANSI_VAR_FONT);
desc += wxString::From8BitData (font.GetNativeFontInfoUserDesc ().ToUTF8 ().data());
desc << wxT("|");
font = wxSystemSettings::GetFont (wxSYS_DEVICE_DEFAULT_FONT);
desc += wxString::From8BitData (font.GetNativeFontInfoUserDesc ().ToUTF8 ().data());
#if 0
desc += wxString::From8BitData (font.GetNativeFontInfoUserDesc ().ToUTF8 ().data());
desc += wxString::From8BitData (font.GetNativeFontInfoUserDesc ().ToUTF8 ().data());
desc += wxString::From8BitData (font.GetNativeFontInfoUserDesc ().ToUTF8 ().data());
#endif
wxLogDebug (wxT("GetFont: %s"), desc.c_str());
loger->Message (wxT("Test end."));
}
void NiFrame::BuildMenu ()
{
wxMenu *kineo, *help;
wxMenuBar *bar;
bar = new wxMenuBar;
kineo = new wxMenu;
wxASSERT ( bar != NULL && kineo != NULL );
kineo->Append ( ID_ADD_NEW_SERVER, _("Add new server"), _("Add a new server") );
kineo->Append ( ID_UPDATE_GROUPLIST, _("Update grouplist"),
_("Update grouplist of all server.") );
kineo->Append ( ID_SHOW_GROUPLIST, _("Show grouplist"),
_("Show all grouplist") );
kineo->Append ( ID_SYNC, _("Sync from newsgroup server"),
_("Sync all newsgroup from server"));
kineo->AppendSeparator ();
kineo->Append ( ID_EXIT, _("Exit"), _("Exit KiNeo"));
bar->Append ( kineo, _("KiNeo"));
#ifdef __WXDEBUG__
wxMenu *debug;
debug = new wxMenu ();
wxASSERT ( debug != NULL );
debug->Append ( ID_TEST, wxT("Test"), _("Test"));
bar->Append (debug, wxT("Debug"));
#endif
SetMenuBar (bar);
}
void NiFrame::OnAddNewServer ( wxCommandEvent& event )
{
NiGroupView* groupview = dynamic_cast <NiGroupView*> ( FindWindow (ID_GROUPVIEW) );
if ( groupview )
{
groupview->AddNewServer ();
}
}
void NiFrame::OnUpdateGrouplist ( wxCommandEvent& event )
{
NiGroupView* groupview = dynamic_cast <NiGroupView*> ( FindWindow (ID_GROUPVIEW) );
if ( groupview )
{
groupview->UpdateGrouplist ();
}
}
void NiFrame::OnShowGrouplist ( wxCommandEvent& event )
{
NiGroup::GrouplistDialog dialog ( this, wxID_ANY );
dialog.ShowModal ();
}
void NiFrame::OnSync ( wxCommandEvent& event )
{
NiGroupView *gv = static_cast <NiGroupView*> (FindWindow (ID_GROUPVIEW));
wxASSERT ( gv != NULL );
gv->SyncAll ();
}
void NiFrame::OnGroupviewMenu ( wxTreeEvent& event )
{
NiGroupView *gv = static_cast <NiGroupView*> (FindWindow (ID_GROUPVIEW));
wxASSERT ( gv != NULL );
gv->ItemMenu ();
}
void NiFrame::OnExit ( wxCommandEvent& event )
{
Close(true);
}
BEGIN_EVENT_TABLE (NiFrame, wxFrame)
EVT_SIZE ( NiFrame::OnSize )
EVT_ENTER_WINDOW ( NiFrame::OnMouseEnter )
EVT_MENU ( ID_EXIT, NiFrame::OnExit )
EVT_MENU ( ID_ADD_NEW_SERVER, NiFrame::OnAddNewServer )
EVT_MENU ( ID_UPDATE_GROUPLIST, NiFrame::OnUpdateGrouplist )
EVT_MENU ( ID_SHOW_GROUPLIST, NiFrame::OnShowGrouplist )
EVT_MENU ( ID_SYNC, NiFrame::OnSync )
EVT_SASH_DRAGGED_RANGE ( ID_SASHLEFT, ID_SASHRIGHTBOTTOM, NiFrame::OnSashDrag )
EVT_TREE_ITEM_MENU ( ID_GROUPVIEW, NiFrame::OnGroupviewMenu )
EVT_TREE_SEL_CHANGED ( ID_GROUPVIEW, NiFrame::OnSelectGroup )
#ifdef __WXDEBUG__
EVT_MENU ( ID_TEST, NiFrame::OnTest )
#endif
END_EVENT_TABLE();
| [
"[email protected]"
]
| [
[
[
1,
290
]
]
]
|
897f8980bffcd974550b792c5bd7c823dd1d8711 | 5ee08487a9cdb4aa377457d7589871b0934d7884 | /HINTS/IO.CPP | 6c1f64e16ddebd6821f7e68ab31ae5e8c73528b5 | []
| no_license | v0idkr4ft/algo.vga | 0cf5affdebd02a49401865d002679d16ac8efb09 | 72c97a01d1e004f62da556048b0ef5b7df34b89c | refs/heads/master | 2021-05-27T18:48:48.823361 | 2011-04-26T03:58:02 | 2011-04-26T03:58:02 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 3,786 | cpp | // Nothing special. Just palette stuff..
//
#include <stdio.h>
#include <conio.h>
unsigned char old_palette[768];
unsigned char current_palette[768]={0};
void WaitVerticalRetrace(void);
void FadeInPalette(unsigned char *,int);
void FadeOutPalette(int);
void GetPalette(unsigned char *);
void SetPalette(unsigned char *);
void GetPalette(unsigned char *palettebuffer)
{
int i;
for(i=0;i<256;i++)
{
outp(0x3c7,i); // color number to get data from
palettebuffer[i*3] = inp(0x3c9); // red
palettebuffer[i*3+1] = inp(0x3c9); // green
palettebuffer[i*3+2] = inp(0x3c9); // blue
}
}
void SetPalette(unsigned char *palettebuffer)
{
int i;
for(i=0;i<256;i++)
{
outp(0x3c8,i); // color number to set
outp(0x3c9,palettebuffer[i*3]); // red
outp(0x3c9,palettebuffer[i*3+1]); // green
outp(0x3c9,palettebuffer[i*3+2]); // blue
}
}
void WaitVerticalRetrace(void)
{
asm mov dx,3dah
top_of_retrace:
asm in al,dx
asm and al,08h
asm jnz top_of_retrace
bottom_of_retrace:
asm in al,dx
asm and al,08h
asm jz bottom_of_retrace
}
void FadeOutPalette(int speed)
{
int i,j,k;
unsigned char temppalette[768];
GetPalette(temppalette);
for(i=0;i<64;i++)
{
for(j=0;j<256;j++)
{
// do the red component
if(temppalette[j*3] > 0)
{
temppalette[j*3]--;
}
// do the green component
if(temppalette[j*3+1] > 0)
{
temppalette[j*3+1]--;
}
// do the blue component
if(temppalette[j*3+2] > 0)
{
temppalette[j*3+2]--;
}
}
for(k=0;k<speed;k++)
{
WaitVerticalRetrace();
}
SetPalette(temppalette);
}
}
void FadeInPalette(unsigned char *palettebuffer,int speed)
{
int i,j,k;
unsigned char temppalette[768]={0};
for(i=0;i<64;i++)
{
for(j=0;j<256;j++)
{
// do the red component
if(temppalette[j*3] < palettebuffer[j*3])
{
temppalette[j*3]++;
}
// do the green component
if(temppalette[j*3+1] < palettebuffer[j*3+1])
{
temppalette[j*3+1]++;
}
// do the blue component
if(temppalette[j*3+2] < palettebuffer[j*3+2])
{
temppalette[j*3+2]++;
}
}
for(k=0;k<speed;k++)
{
WaitVerticalRetrace();
}
SetPalette(temppalette);
}
}
// *******************************
// Yoikes! A tias fade!
// *******************************
main()
{
GetPalette(old_palette);
FadeOutPalette(1);
SetPalette(current_palette);
_setcursortype(_NOCURSOR);
clrscr();
printf(" å úù. . @ .\n");
printf(" . ù .úù°ßùú.úùú.!úùúùúù.².úù²±°ß. è § ú\n");
printf(" . ¦ ú ² ú ²± ² ² ú |\n");
printf(" ú ù ß°²²±°ß ° ² ²° °° ù Äù-éÄúÄ ù\n");
printf(" : ± ù ² ² ²² ù ² ù. . |\n");
printf(" ù ² ± ù ±² ß ² úú ù\n");
printf(" ÷ ù | .úùú.²±°ß.úùø`ùú.úùú.úß°±².úù ¦ ÷ •\n\n");
printf(" ú ú .úùÄ--ĵThä ¤Õ¡¤¡çî ’sçâàL Sæ¤ër™mî 1996ÆÄ--ÄÄùú. .\n");
printf(" è\n");
printf(" è ù úúùÄ--ĵWho Hath the How is Careless of the WhyÆÄ--ÄÄùúú.§ ù\n\n");
printf(".úù'`ùú.úù'`ùú.úù'`ùú.úù'`ùú.úù'`ùú.úù'`ùú.úù'`ùú.úù'`ùú.úù'`ùú.úù'`ùú.úù'`ùúú.\n\n");
printf(" cUrReNtlY âuNNiNg Ms-dOs v6.22 *8) Joyous!\n\n");
FadeInPalette(old_palette,2);
return(0);
}
| [
"[email protected]"
]
| [
[
[
1,
149
]
]
]
|
470459e1e8e928fd50413fdc4455f3344f9b6635 | b22c254d7670522ec2caa61c998f8741b1da9388 | /common/QuestHandler.cpp | 6ea8acb9c6416e3f656c577ab94966f95ecf7c29 | []
| no_license | ldaehler/lbanet | 341ddc4b62ef2df0a167caff46c2075fdfc85f5c | ecb54fc6fd691f1be3bae03681e355a225f92418 | refs/heads/master | 2021-01-23T13:17:19.963262 | 2011-03-22T21:49:52 | 2011-03-22T21:49:52 | 39,529,945 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 8,184 | cpp | /*
------------------------[ Lbanet Source ]-------------------------
Copyright (C) 2009
Author: Vivien Delage [Rincevent_123]
Email : [email protected]
-------------------------------[ GNU License ]-------------------------------
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 3 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, see <http://www.gnu.org/licenses/>.
-----------------------------------------------------------------------------
*/
#include "QuestHandler.h"
#ifndef _LBANET_SERVER_SIDE_
#include "DataLoader.h"
#include "InventoryHandler.h"
#endif
QuestHandler* QuestHandler::_singletonInstance = NULL;
/***********************************************************
singleton pattern
***********************************************************/
QuestHandler * QuestHandler::getInstance()
{
if(!_singletonInstance)
{
#ifndef _LBANET_SERVER_SIDE_
_singletonInstance = new QuestHandler(InventoryHandler::getInstance());
#else
_singletonInstance = new QuestHandler(NULL);
#endif
}
return _singletonInstance;
}
/***********************************************************
constructor
***********************************************************/
QuestHandler::QuestHandler(InventoryHandlerBase * InvH)
: _InvH(InvH)
{
}
/***********************************************************
init QH with quest database
***********************************************************/
void QuestHandler::Initialize(std::map<long, QuestPtr> questDb)
{
IceUtil::RecMutex::Lock lock(m_mutex);
_questDb = questDb;
}
/***********************************************************
set started and finished quests
***********************************************************/
void QuestHandler::SetStartedFinished(std::vector<long> questStarted, std::vector<long> questFinished)
{
IceUtil::RecMutex::Lock lock(m_mutex);
_questStarted = questStarted;
_questFinished = questFinished;
}
/***********************************************************
ask QH to start a quest
***********************************************************/
void QuestHandler::TriggerQuestStart(long QuestId)
{
IceUtil::RecMutex::Lock lock(m_mutex);
//! quest already started
if(std::find(_questStarted.begin(), _questStarted.end(), QuestId) != _questStarted.end())
return;
//! quest already finished
if(std::find(_questFinished.begin(), _questFinished.end(), QuestId) != _questFinished.end())
return;
_questStarted.push_back(QuestId);
#ifdef _LBANET_SERVER_SIDE_
// inform client quest is started
if(_InvH)
_InvH->InformQuestStarted(QuestId);
std::map<long, QuestPtr>::iterator it = _questDb.find(QuestId);
if(it != _questDb.end())
{
const std::vector<long>& listq =it->second->GetQuestsStartingAtStart();
for(size_t i=0; i<listq.size(); ++i)
TriggerQuestStart(listq[i]);
}
#endif
}
/***********************************************************
ask QH to end a quest
***********************************************************/
void QuestHandler::TriggerQuestEnd(long QuestId)
{
IceUtil::RecMutex::Lock lock(m_mutex);
#ifdef _LBANET_SERVER_SIDE_
if(QuestConditionFulfilled(QuestId))
{
// remove from quest started
std::vector<long>::iterator it = std::find(_questStarted.begin(), _questStarted.end(), QuestId);
if(it != _questStarted.end())
_questStarted.erase(it);
// add to quest finished
_questFinished.push_back(QuestId);
// inform client quest is finished
if(_InvH)
_InvH->InformQuestFinished(QuestId);
// trigger stuff at end quest
std::map<long, QuestPtr>::iterator itm = _questDb.find(QuestId);
if(itm != _questDb.end())
{
const std::vector<long>& listq =itm->second->GetQuestsStartingAtEnd();
for(size_t i=0; i<listq.size(); ++i)
TriggerQuestStart(listq[i]);
const std::vector<long>& listqT =itm->second->GetQuestsTriggeredAtEnd();
for(size_t i=0; i<listqT.size(); ++i)
TriggerQuestEnd(listqT[i]);
if(_InvH)
{
const std::vector<std::pair<long, int> >&givens = itm->second->GetObjectsGivenAtEnd();
const std::vector<std::pair<long, int> >&takens = itm->second->GetObjectsTakenAtEnd();
for(size_t i=0; i<givens.size(); ++i)
_InvH->UpdateItemNumber(givens[i].first, givens[i].second);
for(size_t i=0; i<takens.size(); ++i)
_InvH->UpdateItemNumber(takens[i].first, -takens[i].second);
}
}
}
#else
// no need to check in client side has it has been checked by server
{
// remove from quest started
std::vector<long>::iterator it = std::find(_questStarted.begin(), _questStarted.end(), QuestId);
if(it != _questStarted.end())
_questStarted.erase(it);
// add to quest finished
_questFinished.push_back(QuestId);
}
#endif
}
/***********************************************************
return true if quest is started and condition are fullfiled
***********************************************************/
bool QuestHandler::QuestConditionFulfilled(long QuestId)
{
IceUtil::RecMutex::Lock lock(m_mutex);
//! quest already finished
if(std::find(_questFinished.begin(), _questFinished.end(), QuestId) != _questFinished.end())
return false;
//! check if quest started
std::vector<long>::iterator it = std::find(_questStarted.begin(), _questStarted.end(), QuestId);
if(it == _questStarted.end())
return false;
std::map<long, QuestPtr>::iterator itm = _questDb.find(QuestId);
if(itm != _questDb.end())
return itm->second->CheckCondition();
return false;
}
/***********************************************************
return true if quest is started
***********************************************************/
bool QuestHandler::QuestStarted(long QuestId)
{
IceUtil::RecMutex::Lock lock(m_mutex);
return (std::find(_questStarted.begin(), _questStarted.end(), QuestId) != _questStarted.end());
}
/***********************************************************
return true if quest is started
***********************************************************/
bool QuestHandler::QuestFinished(long QuestId)
{
IceUtil::RecMutex::Lock lock(m_mutex);
return (std::find(_questFinished.begin(), _questFinished.end(), QuestId) != _questFinished.end());
}
/***********************************************************
get quests started
***********************************************************/
std::vector<long> QuestHandler::GetQuestsStarted()
{
IceUtil::RecMutex::Lock lock(m_mutex);
return _questStarted;
}
/***********************************************************
get quests finished
***********************************************************/
std::vector<long> QuestHandler::GetQuestsFinished()
{
IceUtil::RecMutex::Lock lock(m_mutex);
return _questFinished;
}
/***********************************************************
get quest info
***********************************************************/
QuestInfo QuestHandler::GetQuestInfo(long QuestId)
{
QuestInfo res;
res.Id = -1;
IceUtil::RecMutex::Lock lock(m_mutex);
std::map<long, QuestPtr>::iterator itm = _questDb.find(QuestId);
if(itm != _questDb.end())
{
res.Id = itm->first;
#ifndef _LBANET_SERVER_SIDE_
res.Visible = itm->second->GetVisible();
if(res.Visible)
{
res.Tittle = DataLoader::getInstance()->GetQuestText(itm->second->GetTitle());
res.Description = DataLoader::getInstance()->GetQuestText(itm->second->GetDescription());
res.QuestArea = DataLoader::getInstance()->GetQuestText(itm->second->GetQuestArea());
}
#endif
}
return res;
}
| [
"vdelage@3806491c-8dad-11de-9a8c-6d5b7d1e4d13"
]
| [
[
[
1,
281
]
]
]
|
c6d8d2d28227c544a399460fec388166c8f0f7d1 | a0bc9908be9d42d58af7a1a8f8398c2f7dcfa561 | /SlonEngine/extensions/PythonBindings/physics/src/PyCollisionShape.cpp | 41ff82db8023f01b3275bedd1c4e4e7d90062be2 | []
| no_license | BackupTheBerlios/slon | e0ca1137a84e8415798b5323bc7fd8f71fe1a9c6 | dc10b00c8499b5b3966492e3d2260fa658fee2f3 | refs/heads/master | 2016-08-05T09:45:23.467442 | 2011-10-28T16:19:31 | 2011-10-28T16:19:31 | 39,895,039 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,400 | cpp | #include "stdafx.h"
#include "PyCollisionShape.h"
#include "Physics/CollisionShape.h"
using namespace boost::python;
using namespace slon::physics;
void exportCollisionShape()
{
class_< CollisionShape, boost::intrusive_ptr<CollisionShape>, boost::noncopyable >("CollisionShape", no_init);
class_< PlaneShape, bases<CollisionShape>, boost::intrusive_ptr<PlaneShape> >("PlaneShape")
.def(init<>())
.def(init<math::Planer>())
.def(init<real, real, real, real>())
.def(init<const math::Vector3r&, real>())
.def(init<const math::Vector3r&, real>())
.def(init<const math::Vector3r&, const math::Vector3r&, const math::Vector3r&>())
.def_readwrite("plane", &PlaneShape::plane);
implicitly_convertible< boost::intrusive_ptr<PlaneShape>, boost::intrusive_ptr<CollisionShape> >();
implicitly_convertible< boost::intrusive_ptr<PlaneShape>, boost::intrusive_ptr<const CollisionShape> >();
implicitly_convertible< boost::intrusive_ptr<const PlaneShape>, boost::intrusive_ptr<const CollisionShape> >();
class_< SphereShape, bases<CollisionShape>, boost::intrusive_ptr<SphereShape> >("SphereShape")
.def(init<>())
.def(init<float>())
.def_readwrite("radius", &SphereShape::radius);
implicitly_convertible< boost::intrusive_ptr<SphereShape>, boost::intrusive_ptr<CollisionShape> >();
implicitly_convertible< boost::intrusive_ptr<SphereShape>, boost::intrusive_ptr<const CollisionShape> >();
implicitly_convertible< boost::intrusive_ptr<const SphereShape>, boost::intrusive_ptr<const CollisionShape> >();
class_< BoxShape, bases<CollisionShape>, boost::intrusive_ptr<BoxShape> >("BoxShape")
.def(init<>())
.def(init<float, float, float>())
.def(init<math::Vector3f>())
.def_readwrite("halfExtent", &BoxShape::halfExtent);
implicitly_convertible< boost::intrusive_ptr<BoxShape>, boost::intrusive_ptr<CollisionShape> >();
implicitly_convertible< boost::intrusive_ptr<BoxShape>, boost::intrusive_ptr<const CollisionShape> >();
implicitly_convertible< boost::intrusive_ptr<const BoxShape>, boost::intrusive_ptr<const CollisionShape> >();
class_< ConeShape, bases<CollisionShape>, boost::intrusive_ptr<ConeShape> >("ConeShape")
.def(init<>())
.def(init<float, float>())
.def_readwrite("radius", &ConeShape::radius)
.def_readwrite("height", &ConeShape::height);
implicitly_convertible< boost::intrusive_ptr<ConeShape>, boost::intrusive_ptr<CollisionShape> >();
implicitly_convertible< boost::intrusive_ptr<ConeShape>, boost::intrusive_ptr<const CollisionShape> >();
implicitly_convertible< boost::intrusive_ptr<const ConeShape>, boost::intrusive_ptr<const CollisionShape> >();
class_< CylinderXShape, bases<CollisionShape>, boost::intrusive_ptr<CylinderXShape> >("CylinderXShape")
.def(init<>())
.def(init<float, float, float>())
.def(init<math::Vector3f>())
.def_readwrite("halfExtent", &CylinderXShape::halfExtent);
implicitly_convertible< boost::intrusive_ptr<CylinderXShape>, boost::intrusive_ptr<CollisionShape> >();
implicitly_convertible< boost::intrusive_ptr<CylinderXShape>, boost::intrusive_ptr<const CollisionShape> >();
implicitly_convertible< boost::intrusive_ptr<const CylinderXShape>, boost::intrusive_ptr<const CollisionShape> >();
class_< CylinderYShape, bases<CollisionShape>, boost::intrusive_ptr<CylinderYShape> >("CylinderYShape")
.def(init<>())
.def(init<float, float, float>())
.def(init<math::Vector3f>())
.def_readwrite("halfExtent", &CylinderYShape::halfExtent);
implicitly_convertible< boost::intrusive_ptr<CylinderYShape>, boost::intrusive_ptr<CollisionShape> >();
implicitly_convertible< boost::intrusive_ptr<CylinderYShape>, boost::intrusive_ptr<const CollisionShape> >();
implicitly_convertible< boost::intrusive_ptr<const CylinderYShape>, boost::intrusive_ptr<const CollisionShape> >();
class_< CylinderZShape, bases<CollisionShape>, boost::intrusive_ptr<CylinderZShape> >("CylinderZShape")
.def(init<>())
.def(init<float, float, float>())
.def(init<math::Vector3f>())
.def_readwrite("halfExtent", &CylinderZShape::halfExtent);
implicitly_convertible< boost::intrusive_ptr<CylinderZShape>, boost::intrusive_ptr<CollisionShape> >();
implicitly_convertible< boost::intrusive_ptr<CylinderZShape>, boost::intrusive_ptr<const CollisionShape> >();
implicitly_convertible< boost::intrusive_ptr<const CylinderZShape>, boost::intrusive_ptr<const CollisionShape> >();
class_< ConvexShape, bases<CollisionShape>, boost::intrusive_ptr<ConvexShape> >("ConvexShape")
.def(init<>())
.def_readwrite("vertices", &ConvexShape::vertices)
.def("buildConvexHull", &ConvexShape::buildConvexHull);
implicitly_convertible< boost::intrusive_ptr<ConvexShape>, boost::intrusive_ptr<CollisionShape> >();
implicitly_convertible< boost::intrusive_ptr<ConvexShape>, boost::intrusive_ptr<const CollisionShape> >();
implicitly_convertible< boost::intrusive_ptr<const ConvexShape>, boost::intrusive_ptr<const CollisionShape> >();
} | [
"devnull@localhost"
]
| [
[
[
1,
84
]
]
]
|
e926d30f675c60838b371cd81e8ff5e86337e201 | 3eae8bea68fd2eb7965cca5afca717b86700adb5 | /Engine/Project/Core/GnMesh/Source/GUnitInfo.h | cbaeb77f5743d9c2089d78d463e0381aabe6cfa6 | []
| no_license | mujige77/WebGame | c0a218ee7d23609076859e634e10e29c92bb595b | 73d36f9d8bfbeaa944c851e8a1cfa5408ce1d3dd | refs/heads/master | 2021-01-01T15:51:20.045414 | 2011-10-03T01:02:59 | 2011-10-03T01:02:59 | 455,950 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 810 | h | #ifndef Core_GUnitInfo_h
#define Core_GUnitInfo_h
#include "GInfoBasic.h"
class GUnitInfo : public GnMemoryObject
{
class info
{
public:
info(guint32 uiIndex = 0, guint32 uiLevel = 1) : mIndex( uiIndex ), mLevel( uiLevel )
{}
public:
guint32 mIndex;
guint32 mLevel;
};
protected:
GnTPrimitiveSet<GUnitInfo::info> mUintInfos;
public:
inline bool GetUnitInfo(guint32 uiIndex, GUnitInfo::info& outInfo)
{
for ( gtuint i = 0 ; i < mUintInfos.GetSize() ; i++ )
{
if( mUintInfos.GetAt( i ).mIndex == uiIndex )
{
outInfo = mUintInfos.GetAt( i );
return true;
}
}
return false;
}
inline void AddUnitInfo(guint32 uiIndex, guint32 uiLevel)
{
GUnitInfo::info info( uiIndex, uiLevel );
mUintInfos.Add( info );
}
};
#endif
| [
"[email protected]"
]
| [
[
[
1,
42
]
]
]
|
08b6a7b87f06770dc4b0a4c22294dc0be3060e95 | c95a83e1a741b8c0eb810dd018d91060e5872dd8 | /libs/STLPort-4.0/src/num_get_inst_w.cpp | cf97729cefa77c3454be57b3c76af8aca6c32db7 | [
"LicenseRef-scancode-stlport-4.5"
]
| permissive | 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,936 | cpp | /*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
# include "stlport_prefix.h"
#include <cstring>
#include <cstdlib>
#include <climits>
#include <cmath>
#include <cfloat>
#include <iterator>
#include <locale>
#include <limits>
__STL_BEGIN_NAMESPACE
# ifndef __STL_NO_WCHAR_T
// Similar, except return the character itself instead of the numeric
// value. Used for floating-point input.
pair<char, bool> __STL_CALL __get_fdigit(wchar_t c, const wchar_t* digits)
{
const wchar_t* p = find(digits, digits + 10, c);
if (p != digits + 10)
return pair<char, bool>((char)('0' + (p - digits)), true);
else
return pair<char, bool>((char)'\0', false);
}
pair<char, bool> __STL_CALL __get_fdigit_or_sep(wchar_t c, wchar_t sep,
const wchar_t * digits)
{
if (c == sep)
return pair<char, bool>(',', true);
else
return __get_fdigit(c, digits);
}
//----------------------------------------------------------------------
// Force instantiation of of num_get<>
#if !defined(__STL_NO_FORCE_INSTANTIATE)
template class num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
template class num_get<wchar_t, const wchar_t*>;
#endif
__STL_END_NAMESPACE
# endif /* INSTANTIATE_WIDE_STREAMS */
// Local Variables:
// mode:C++
// End:
| [
"[email protected]"
]
| [
[
[
1,
67
]
]
]
|
370bfc397c3255721ba8eace2c91e3b9f04cac38 | ea2ebb5e92b4391e9793c5a326d0a31758c2a0ec | /Bomberman/Bomberman/Engine.h | ca4fc5c71c0410f02645efb89d31a89799eb5f02 | []
| no_license | weimingtom/bombman | d0f022541e9c550af7c6dbd26481771c94828460 | d73ee4c680423a79826187013d343111a62f89b7 | refs/heads/master | 2021-01-10T01:36:39.712497 | 2011-05-01T07:03:16 | 2011-05-01T07:03:16 | 44,462,509 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 552 | h | #pragma once
#include"GlWindow.h"
#include"HiResTimer.h"
class Scene;
class Engine : public GlWindow
{
public:
Engine(){}
Engine(const TCHAR* windowName, bool fullScreen, int width, int height, int b):GlWindow(windowName,fullScreen,width,height,b){}
~Engine(){}
LRESULT EnterMessageLoop();
protected:
//CHiResTimer *timer;
virtual void GameCycle(float deltaTime);
virtual void OnPrepare(){}
virtual Scene* OnGetScene();
virtual void CheckInput(float deltaTime);
private:
Scene* gameScene;
CHiResTimer *timer;
}; | [
"yvetterowe1116@d9104e88-05a6-3fce-0cda-3a6fd9c40cd8"
]
| [
[
[
1,
25
]
]
]
|
f3d5e3bcbb3ea8b8b79551c1c62960ff7ab91f03 | 279b68f31b11224c18bfe7a0c8b8086f84c6afba | /playground/barfan/findik-poc-4/mysqldbmanager.cpp | 42ada4e1b47709d6e5f58f216416c6915bf2e894 | []
| 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 | 1,835 | cpp | #include "mysqldbmanager.hpp"
namespace findik {
mysqldbmanager::mysqldbmanager() {
}
void mysqldbmanager::connectDb(std::string host, std::string db, std::string username, std::string password) {
this->host = host;
this->username = username;
this->password = password;
this->db = db;
try {
this->driver = get_driver_instance();
std::auto_ptr< sql::Connection > con1(driver->connect(host, username, password));
this->con = con1;
this->con->setSchema(db);
} catch (sql::SQLException &e) {
}
}
bool mysqldbmanager::contentQuery(std::string content) {
return true;
}
bool mysqldbmanager::contentRegexQuery(std::string content) {
return true;
}
bool mysqldbmanager::domainQuery(std::string hostname) {
try {
std::auto_ptr< sql::Statement > stmt(this->con->createStatement());
std::auto_ptr< sql::ResultSet > res(stmt->executeQuery("SELECT domain from blacklist_domain where domain='"+hostname+"'"));
if(res->rowsCount() > 0)
return false;
} catch (sql::SQLException &e) {
std::cout << "ERROR" << e.what() << std::endl;
return false;
}
return true;
}
bool mysqldbmanager::domainRegexQuery(std::string hostname) {
return true;
}
bool mysqldbmanager::urlQuery(std::string url) {
try {
std::auto_ptr< sql::Statement > stmt(this->con->createStatement());
std::auto_ptr< sql::ResultSet > res(stmt->executeQuery("SELECT url from blacklist_url where url='"+url+"'"));
if(res->rowsCount() > 0)
return false;
} catch (sql::SQLException &e) {
std::cout << "ERROR" << e.what() << std::endl;
return false;
}
return true;
}
bool mysqldbmanager::urlRegexQuery(std::string url) {
return true;
}
} | [
"shelta@d40773b4-ada0-11de-b0a2-13e92fe56a31"
]
| [
[
[
1,
71
]
]
]
|
98645d080710f928968cac6405bbd0c000e39414 | 0f8559dad8e89d112362f9770a4551149d4e738f | /Wall_Destruction/Havok/Source/Common/Compat/Deprecated/UnitTest/Xml/hkStressTestCinfo.h | 21ac0aabe5a9a090784c6d0ef1ca2565d8320aef | []
| no_license | TheProjecter/olafurabertaymsc | 9360ad4c988d921e55b8cef9b8dcf1959e92d814 | 456d4d87699342c5459534a7992f04669e75d2e1 | refs/heads/master | 2021-01-10T15:15:49.289873 | 2010-09-20T12:58:48 | 2010-09-20T12:58:48 | 45,933,002 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,686 | h | /*
*
* Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's
* prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok.
* Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2009 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement.
*
*/
#ifndef DEMOS_TEST_UNITTEST_HKSERIALIZE_XML_HKSTRESSTESTCINFO_XML_H
#define DEMOS_TEST_UNITTEST_HKSERIALIZE_XML_HKSTRESSTESTCINFO_XML_H
#include <Common/Base/hkBase.h>
#include <Common/Base/hkBase.h>
/// hkStressTestCinfo meta information
extern const class hkClass hkStressTestCinfoClass;
/// A class to test all parts of the serialization infrastructure.
class hkStressTestCinfo
{
public:
HK_DECLARE_REFLECTION();
HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR(HK_MEMORY_CLASS_DEMO, hkStressTestCinfo);
///
enum AnEnum
{
///
VAL_INVALID,
///
VAL_TEN=10,
///
VAL_ELEVEN,
///
VAL_TWENTY=20
};
///
struct SimpleStruct
{
HK_DECLARE_REFLECTION();
HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR(HK_MEMORY_CLASS_DEMO, SimpleStruct);
///
hkUint32 m_key;
///
hkUint32 m_value;
SimpleStruct() : m_key(0), m_value(0) {}
SimpleStruct( const SimpleStruct& s ) : m_key(s.m_key), m_value(s.m_value) {}
};
///
struct AllPodsStruct
{
HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR( HK_MEMORY_CLASS_SERIALIZE, hkStressTestCinfo::AllPodsStruct );
///
hkBool m_bool;
///
hkChar m_char;
///
hkInt8 m_int8;
///
hkUint8 m_uint8;
///
hkInt16 m_int16;
///
hkUint16 m_uint16;
///
hkInt32 m_int32;
///
hkUint32 m_uint32;
///
hkInt64 m_int64;
///
hkUint64 m_uint64;
///
hkReal m_real;
///
hkVector4 m_vector4;
///
hkQuaternion m_quaternion;
///
hkMatrix3 m_matrix3;
///
hkRotation m_rotation;
///
hkMatrix4 m_matrix4;
///
hkTransform m_transform;
};
///
struct StructWithVirtualFunctions
{
HK_DECLARE_REFLECTION();
HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR(HK_MEMORY_CLASS_DEMO, StructWithVirtualFunctions);
virtual ~StructWithVirtualFunctions() {}
///
hkUint32 m_value;
virtual void doesNothingMuch() = 0;
};
///
struct StructWithVtable : public hkStressTestCinfo::StructWithVirtualFunctions
{
HK_DECLARE_REFLECTION();
HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR(HK_MEMORY_CLASS_DEMO, StructWithVtable);
///
hkUint32 m_newvalue;
virtual void doesNothingMuch() { m_newvalue = 1; }
StructWithVtable() {}
StructWithVtable( const StructWithVtable& s ) : StructWithVirtualFunctions(s), m_newvalue(s.m_newvalue) {}
StructWithVtable( hkFinishLoadedObjectFlag flag ) {}
};
///
struct StructWithArrays
{
HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR( HK_MEMORY_CLASS_SERIALIZE, hkStressTestCinfo::StructWithArrays );
HK_DECLARE_REFLECTION();
///
hkArray<hkUint32> m_anArray;
///
hkArray<char*> m_anArrayOfPointers;
///
hkArray<struct StructWithVtable> m_anArrayOfStructs;
StructWithArrays() {}
StructWithArrays( const StructWithArrays& s ) {}
};
/// Default constructor
hkStressTestCinfo() { }
//
// Members
//
public:
///
hkBool m_simpleBool;
///
hkChar m_simpleChar;
///
hkInt8 m_simpleInt8;
///
hkUint8 m_simpleUint8;
///
hkInt16 m_simpleInt16;
///
hkUint16 m_simpleUint16;
///
hkInt32 m_simpleInt32;
///
hkUint32 m_simpleUint32;
///
hkInt64 m_simpleInt64;
///
hkUint64 m_simpleUint64;
///
hkReal m_simpleReal;
///
hkVector4 m_simpleVector4;
///
hkQuaternion m_simpleQuaternion;
///
hkMatrix3 m_simpleMatrix3;
///
hkRotation m_simpleRotation;
///
hkMatrix4 m_simpleMatrix4;
///
hkTransform m_simpleTransform;
///
void* m_optionalPtr;
///
hkEnum<AnEnum, hkInt8> m_simpleEnum;
///
char* m_name;
///
char* m_metaSyntacticVariable;
///
struct SimpleStruct m_simpleStruct;
///
struct SimpleStruct m_simpleStructCarray[6];
///
hkBool* m_simpleBoolPointer;
///
hkChar* m_simpleCharPointer;
///
hkInt8* m_simpleInt8Pointer;
///
hkUint8* m_simpleUint8Pointer;
///
hkInt16* m_simpleInt16Pointer;
///
hkUint16* m_simpleUint16Pointer;
///
hkInt32* m_simpleInt32Pointer;
///
hkUint32* m_simpleUint32Pointer;
///
hkInt64* m_simpleInt64Pointer;
///
hkUint64* m_simpleUint64Pointer;
///
hkReal* m_simpleRealPointer;
///
hkVector4* m_simpleVector4Pointer;
///
hkQuaternion* m_simpleQuaternionPointer;
///
hkMatrix3* m_simpleMatrix3Pointer;
///
hkRotation* m_simpleRotationPointer;
///
hkMatrix4* m_simpleMatrix4Pointer;
///
hkTransform* m_simpleTransformPointer;
///
hkArray<hkChar> m_arrayCharEmpty;
///
hkArray<hkInt8> m_arrayInt8Empty;
///
hkArray<hkUint8> m_arrayUint8Empty;
///
hkArray<hkInt16> m_arrayInt16Empty;
///
hkArray<hkUint16> m_arrayUint16Empty;
///
hkArray<hkInt32> m_arrayInt32Empty;
///
hkArray<hkUint32> m_arrayUint32Empty;
///
hkArray<hkInt64> m_arrayInt64Empty;
///
hkArray<hkUint64> m_arrayUint64Empty;
///
hkArray<hkReal> m_arrayRealEmpty;
///
hkArray<hkVector4> m_arrayVector4Empty;
///
hkArray<hkQuaternion> m_arrayQuaternionEmpty;
///
hkArray<hkMatrix3> m_arrayMatrix3Empty;
///
hkArray<hkRotation> m_arrayRotationEmpty;
///
hkArray<hkMatrix4> m_arrayMatrix4Empty;
///
hkArray<hkTransform> m_arrayTransformEmpty;
///
hkArray<hkBool> m_arrayBoolEmpty;
///
hkArray<hkReal> m_arrayRealWithIntializer;
///
hkArray<hkVector4> m_arrayVector4WithIntializer;
///
hkBool m_simpleCarrayBoolEmpty[5];
///
hkChar m_simpleCarrayCharEmpty[5];
///
hkInt8 m_simpleCarrayInt8Empty[5];
///
hkUint8 m_simpleCarrayUint8Empty[5];
///
hkInt16 m_simpleCarrayInt16Empty[5];
///
hkUint16 m_simpleCarrayUint16Empty[5];
///
hkInt32 m_simpleCarrayInt32Empty[5];
///
hkUint32 m_simpleCarrayUint32Empty[5];
///
hkInt64 m_simpleCarrayInt64Empty[5];
///
hkUint64 m_simpleCarrayUint64Empty[5];
///
hkReal m_simpleCarrayRealEmpty[5];
///
hkVector4 m_simpleCarrayVector4Empty[5];
///
hkQuaternion m_simpleCarrayQuaternionEmpty[5];
///
hkMatrix3 m_simpleCarrayMatrix3Empty[5];
///
hkRotation m_simpleCarrayRotationEmpty[5];
///
hkMatrix4 m_simpleCarrayMatrix4Empty[5];
///
hkTransform m_simpleCarrayTransformEmpty[5];
///
hkReal m_simpleCarrayRealOneInit[5];
///
hkReal m_simpleCarrayRealFullInit[5];
///
hkArray<struct SimpleStruct*> m_arrayStructPtrs;
///
hkArray<struct SimpleStruct> m_arrayStructEmpty;
///
struct SimpleStruct m_carrayStructEmpty[5];
///
struct SimpleStruct m_carrayStructInit[5];
///
hkInt8* m_simpleArray;
hkInt32 m_numSimpleArray;
///
hkUint16 m_serializeAsZero;
///
hkUint16* m_serializePointerAsZero;
///
hkArray<hkUint16> m_serializeArrayAsZero;
///
//struct StructWithVtable m_structWithVtable;
///
struct StructWithArrays m_structWithArrays;
///
//struct StructWithArrays m_cArrayOfStructsWithArrays[5];
};
hkBool::CompileTimeTrueType hkIsVirtual(hkStressTestCinfo::StructWithVirtualFunctions*);
#endif // DEMOS_TEST_UNITTEST_HKSERIALIZE_XML_HKSTRESSTESTCINFO_XML_H
/*
* Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20091222)
*
* Confidential Information of Havok. (C) Copyright 1999-2009
* Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok
* Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership
* rights, and intellectual property rights in the Havok software remain in
* Havok and/or its suppliers.
*
* Use of this software for evaluation purposes is subject to and indicates
* acceptance of the End User licence Agreement for this product. A copy of
* the license is included with this software and is also available at www.havok.com/tryhavok.
*
*/
| [
"[email protected]"
]
| [
[
[
1,
453
]
]
]
|
c1caf6ba4d802ecdfb5d8d0eab05c915dd9e7c35 | f13f46fbe8535a7573d0f399449c230a35cd2014 | /JelloMan/Fluid.h | 85fe79072838135e40c6de8d6be89b5ac19ede77 | []
| no_license | fangsunjian/jello-man | 354f1c86edc2af55045d8d2bcb58d9cf9b26c68a | 148170a4834a77a9e1549ad3bb746cb03470df8f | refs/heads/master | 2020-12-24T16:42:11.511756 | 2011-06-14T10:16:51 | 2011-06-14T10:16:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,503 | h | #pragma once
#include "D3DUtil.h"
#include "RenderContext.h"
#include "FluidEffect.h"
#include "vertex.h"
#include "Particle.h"
#include "Color.h"
#include "ModelMesh.h"
class Fluid
{
public:
/* CONSTRUCTOR - DESTRUCTOR */
Fluid(NxScene* pScene, NxFluidDesc &desc, const Color& particleColor, float particleSize, ID3D10Device* pDevice);
~Fluid();
/* GENERAL */
void Draw(const RenderContext* pRenderContext);
/* GETTERS */
NxFluid* GetNxFluid() { return m_pFluid; }
const vector<Particle>& GetParticles() { return m_ParticleBuffer; }
unsigned GetNrParticles() { return m_NrParticleBuffer; }
float GetParticleSize() { return m_ParticleSize; }
const Color& GetColor() { return m_ParticleColor; }
/* SETTERS */
void SetParticleSize(float size) { m_ParticleSize = size; }
void SetParticleColor(const Color& color) { m_ParticleColor = color; }
private:
/* DATAMEMBERS */
unsigned int m_NrParticleBuffer;
vector<Particle> m_ParticleBuffer;
NxFluid* m_pFluid;
Color m_ParticleColor;
float m_ParticleSize;
unsigned int m_MaxParticles;
// RENDERSTUFF
void BuildVertexBuffer();
void UpdateVertexBuffer();
ID3D10Device* m_pDevice;
ID3D10Buffer* m_pVertexBuffer;
vector<VertexPos> m_VecVertices;
FluidEffect* m_pEffect;
Texture2D* m_pTexRainbow;
Matrix m_mtxWorld;
/* Disableing default copyconstructor and assignment operator */
Fluid(const Fluid&);
Fluid& operator=(const Fluid&);
}; | [
"[email protected]",
"bastian.damman@0fb7bab5-1bf9-c5f3-09d9-7611b49293d6"
]
| [
[
[
1,
4
],
[
6,
8
],
[
10,
26
],
[
28,
40
],
[
42,
49
],
[
51,
52
],
[
54,
55
],
[
57,
57
],
[
60,
61
],
[
67,
67
]
],
[
[
5,
5
],
[
9,
9
],
[
27,
27
],
[
41,
41
],
[
50,
50
],
[
53,
53
],
[
56,
56
],
[
58,
59
],
[
62,
66
]
]
]
|
6561d741e78131a1cc54f4a0870ddb3bc680fc9e | cf98fd401c09dffdd1e7b1aaa91615e9fe64961f | /tags/0.0.0/src/com/sc/cosmartcard.cpp | cc25e9e8d33d08bbc8eb71427e8c4b3d172e8a12 | []
| no_license | BackupTheBerlios/bvr20983-svn | 77f4fcc640bd092c3aa85311fecfbea1a3b7677e | 4d177c13f6ec110626d26d9a2c2db8af7cb1869d | refs/heads/master | 2021-01-21T13:36:43.379562 | 2009-10-22T00:25:39 | 2009-10-22T00:25:39 | 40,663,412 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,154 | cpp | /*
* $Id$
*
* COSmartcard COM Object Class.
*
* Copyright (C) 2008 Dorothea Wachmann
*
* 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 3 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, see http://www.gnu.org/licenses/.
*/
#include "os.h"
#include "com/sc/cosmartcard.h"
#include "com/sc/cowallet.h"
#include "com/sc/coatr.h"
#include "com/cocollection.h"
#include "util/logstream.h"
#include "util/comlogstream.h"
#include "exception/bvr20983exception.h"
#include "bvr20983sc-dispid.h"
#include "bvr20983sc.h"
#define LOGGER_INFO_THREAD LogStreamT::GetLogger(_T("cosmartcardthread.cpp"))<<INF<<setlineno(__LINE__)
#define LOGGER_DEBUG_THREAD LogStreamT::GetLogger(_T("cosmartcardthread.cpp"))<<DBG<<setlineno(__LINE__)
#define LOGGER_TRACE_THREAD LogStreamT::GetLogger(_T("cosmartcardthread.cpp"))<<TRC<<setlineno(__LINE__)
#define LOGGER_WARN_THREAD LogStreamT::GetLogger(_T("cosmartcardthread.cpp"))<<WRN<<setlineno(__LINE__)
#define LOGGER_ERROR_THREAD LogStreamT::GetLogger(_T("cosmartcardthread.cpp"))<<ERR<<setlineno(__LINE__)
#define LOGGER_FATAL_THREAD LogStreamT::GetLogger(_T("cosmartcardthread.cpp"))<<FTL<<setlineno(__LINE__)
static VARTYPE rgIUnk[] = { VT_UNKNOWN };
namespace bvr20983
{
namespace COM
{
/**
*
*/
COEventInfo COSmartcard::m_eventInfo[] =
{ { DIID_DISmartcardEvent,DISPID_ONINSERTED,0,NULL },
{ DIID_DISmartcardEvent,DISPID_ONREMOVED,0,NULL },
{ DIID_DISmartcardEvent,DISPID_ONRECEIVED,ARRAYSIZE(rgIUnk),rgIUnk }
};
#pragma region Construction & Deconstruction
/**
*
*/
HRESULT COSmartcard::Create(REFCLSID clsid,LPUNKNOWN* ppv,LPUNKNOWN pUnkOuter)
{ HRESULT hr = NOERROR;
if( NULL==ppv )
hr = E_POINTER;
else
{ COSmartcard* pCOSmartcard = new COSmartcard(pUnkOuter);
if( NULL==pCOSmartcard )
hr = E_OUTOFMEMORY;
else
*ppv = pCOSmartcard->PrivateUnknown();
} // of else
return hr;
} // of COSmartcard::Create()
/*
* COSmartcard::COSmartcard
*
* Purpose:
* Constructor.
*
* Parameters:
* IUnknown* pUnkOuter Pointer to the the outer Unknown. NULL means this COM Object
* is not being Aggregated. Non NULL means it is being created
* on behalf of an outside COM object that is reusing it via
* aggregation.
* COMServer* pServer Pointer to the server's control object.
*
* Return:
* void
*/
#pragma warning(disable:4355)
COSmartcard::COSmartcard(IUnknown* pUnkOuter)
: CODispatch(pUnkOuter,(ISmartcard*)this,LIBID_BVR20983SC,IID_ISmartcard,CLSID_Smartcard,DIID_DISmartcardEvent),
m_workingThread(this,true)
{ m_pApplications = NULL;
m_pRegisteredCards = NULL;
m_pReaders = NULL;
m_pSmartCard = NULL;
m_workingThread.StartThread();
}
#pragma warning(default:4355)
/*
*
*/
COSmartcard::~COSmartcard()
{ LOGGER_DEBUG<<_T("COSmartcard::~COSmartcard()")<<endl;
m_workingThread.StopThread();
RELEASE_INTERFACE(m_pApplications);
RELEASE_INTERFACE(m_pRegisteredCards);
RELEASE_INTERFACE(m_pReaders);
LOGGER_DEBUG<<_T("COSmartcard::~COSmartcard() terminated")<<endl;
}
#pragma endregion
#pragma region ISmartcard
/**
*
*/
STDMETHODIMP COSmartcard::get_ATR(IUnknown **ppATR)
{ HRESULT hr = NOERROR;
if( NULL==ppATR )
hr = Exception(BVR_SOURCE_SMARTCARD,E_POINTER);
else
{ try
{ Critical crit(m_SmartCardCS);
*ppATR = NULL;
if( NULL==m_pSmartCard )
hr = Exception(BVR_DISP_SC_NOTINITED);
else if( !m_pSmartCard->IsCardPresent() )
hr = Exception(BVR_DISP_SC_NOTCONNECTED);
else
{ COATR* pATR = new COATR();
ATR atr;
m_pSmartCard->GetATR(atr);
pATR->SetATR(atr);
*ppATR = pATR->ExternalUnknown();
} // of if
}
catch(BVR20983Exception e)
{ LOGGER_ERROR<<e<<endl;
hr = e.GetErrorCode();
}
catch(...)
{ hr = Exception(BVR_SOURCE_SMARTCARD,E_FAIL);
}
} // of else
return hr;
} // of COSmartcard::GetATR()
/**
*
*/
STDMETHODIMP COSmartcard::get_CardPresent(VARIANT_BOOL *pIsCardPresent)
{ HRESULT hr = NOERROR;
*pIsCardPresent = VARIANT_FALSE;
try
{ Critical crit(m_SmartCardCS);
if( NULL==pIsCardPresent )
hr = Exception(BVR_SOURCE_SMARTCARD,E_POINTER);
else if( NULL==m_pSmartCard )
hr = Exception(BVR_DISP_SC_NOTINITED);
else
*pIsCardPresent = m_pSmartCard->IsCardPresent() ? VARIANT_TRUE : VARIANT_FALSE;
}
catch(BVR20983Exception e)
{ LOGGER_ERROR<<e<<endl;
hr = e.GetErrorCode();
}
catch(...)
{ hr = Exception(BVR_SOURCE_SMARTCARD,E_FAIL);
}
LOGGER_DEBUG<<_T("COSmartcard::CImpISmartcard::get_CardPresent. Called. state=")<<*pIsCardPresent<<endl;
return hr;
} // of COSmartcard::GetCardPresent()
/**
*
*/
STDMETHODIMP COSmartcard::Attribute(Attributes attrib,BSTR *pAttribute)
{ HRESULT hr = NOERROR;
if( NULL==pAttribute )
hr = Exception(BVR_SOURCE_SMARTCARD,E_POINTER);
return hr;
} // of COSmartcard::Attribute()
/**
*
*/
STDMETHODIMP COSmartcard::Feature(Features feature,VARIANT_BOOL *pHasFeature)
{ HRESULT hr = NOERROR;
if( NULL==pHasFeature )
hr = Exception(BVR_SOURCE_SMARTCARD,E_POINTER);
return hr;
} // of COSmartcard::Feature()
/**
*
*/
STDMETHODIMP COSmartcard::WaitForInsertEvent(unsigned short timeInSeconds)
{ HRESULT hr = NOERROR;
try
{ Critical crit(m_SmartCardCS);
if( NULL==m_pSmartCard )
hr = Exception(BVR_DISP_SC_NOTINITED);
else
m_pSmartCard->WaitForInsertEvent(timeInSeconds);
}
catch(BVR20983Exception e)
{ LOGGER_ERROR<<e<<endl;
hr = e.GetErrorCode();
}
catch(...)
{ hr = Exception(BVR_SOURCE_SMARTCARD,E_FAIL);
}
return hr;
} // of COSmartcard::WaitForInsertEvent()
/**
*
*/
STDMETHODIMP COSmartcard::WaitForRemoveEvent(unsigned short timeInSeconds)
{ HRESULT hr = NOERROR;
try
{ Critical crit(m_SmartCardCS);
if( NULL==m_pSmartCard )
hr = Exception(BVR_DISP_SC_NOTINITED);
else
m_pSmartCard->WaitForRemoveEvent(timeInSeconds);
}
catch(BVR20983Exception e)
{ LOGGER_ERROR<<e<<endl;
hr = e.GetErrorCode();
}
catch(...)
{ hr = Exception(BVR_SOURCE_SMARTCARD,E_FAIL);
}
return hr;
} // of COSmartcard::WaitForRemoveEvent()
/*
* COSmartcard::GetApplications
*
* Purpose:
* returns a collection of registered smartcard applications
*
* Return:
* IUnknown** collection object
*/
STDMETHODIMP COSmartcard::get_Applications(IUnknown** retval)
{ HRESULT hr = NOERROR;
try
{ if( NULL==retval )
hr = Exception(BVR_SOURCE_SMARTCARD,E_POINTER);
else
{ Critical crit(m_SmartCardCS);
*retval = NULL;
LOGGER_DEBUG<<_T("COSmartcard::GetApplications().1")<<endl;
if( NULL==m_pApplications )
{ CoCollection* pApplications = new CoCollection();
if( NULL!=pApplications )
{ IWallet* pIWallet = NULL;
LOGGER_DEBUG<<_T("COSmartcard::GetApplications().2")<<endl;
COWallet* pWallet = new COWallet(NULL);
pWallet->QueryInterface(IID_IWallet,(VOID**)&pIWallet);
pApplications->Add(pIWallet);
m_pApplications = pApplications;
pIWallet->Release();
} // of if
else
hr = Exception(BVR_SOURCE_SMARTCARD,E_OUTOFMEMORY);
} // of if
if( NULL!=m_pApplications )
{ m_pApplications->AddRef();
*retval = m_pApplications;
LOGGER_DEBUG<<_T("COSmartcard::GetApplications().3")<<endl;
} // of if
} // of else
}
catch(BVR20983Exception e)
{ LOGGER_ERROR<<e<<endl;
hr = e.GetErrorCode();
}
catch(...)
{ hr = Exception(BVR_SOURCE_SMARTCARD,E_FAIL);
}
return hr;
}
/*
* COSmartcard::get_RegisteredCards
*
* Purpose:
* returns a collection of registered cards
*
* Return:
* IUnknown** collection object
*/
STDMETHODIMP COSmartcard::get_RegisteredCards(IUnknown** retval)
{ HRESULT hr = NOERROR;
try
{ Critical crit(m_SmartCardCS);
if( NULL==retval )
hr = Exception(BVR_SOURCE_SMARTCARD,E_POINTER);
else
{ Critical crit(m_SmartCardCS);
if( NULL==m_pSmartCard )
hr = BVR_DISP_SC_NOTINITED;
else
{ *retval = NULL;
LOGGER_DEBUG<<_T("COSmartcard::GetRegisteredCard().1")<<endl;
if( NULL==m_pRegisteredCards )
{ CoCollection* pRegisteredCards = new CoCollection();
if( NULL!=pRegisteredCards )
{ VTString cards = VTString();
m_pSmartCard->ListCards(cards);
VTString::iterator iter;
for( iter=cards.begin();iter!=cards.end();iter++ )
pRegisteredCards->Add(iter->c_str());
m_pRegisteredCards = pRegisteredCards;
} // of if
else
hr = Exception(BVR_SOURCE_SMARTCARD,E_OUTOFMEMORY);
} // of if
if( NULL!=m_pRegisteredCards )
{ m_pRegisteredCards->AddRef();
*retval = m_pRegisteredCards;
LOGGER_DEBUG<<_T("COSmartcard::GetRegisteredCards().3")<<endl;
} // of if
} // of else
} // of else
}
catch(BVR20983Exception e)
{ LOGGER_ERROR<<e<<endl;
hr = e.GetErrorCode();
}
catch(...)
{ hr = Exception(BVR_SOURCE_SMARTCARD,E_FAIL);
}
return hr;
}
/*
* COSmartcard::get_Readers
*
* Purpose:
* returns a collection of registered readers
*
* Return:
* IUnknown** collection object
*/
STDMETHODIMP COSmartcard::get_Readers(IUnknown** retval)
{ HRESULT hr = NOERROR;
try
{ if( NULL==retval )
hr = Exception(BVR_SOURCE_SMARTCARD,E_POINTER);
else
{ Critical crit(m_SmartCardCS);
if( NULL==m_pSmartCard )
hr = Exception(BVR_DISP_SC_NOTINITED);
else
{ *retval = NULL;
LOGGER_DEBUG<<_T("COSmartcard::GetReaders().1")<<endl;
if( NULL==m_pReaders )
{ CoCollection* pReaders = new CoCollection();
if( NULL!=pReaders )
{ VTString readers = VTString();
m_pSmartCard->ListReaders(readers);
VTString::iterator iter;
for( iter=readers.begin();iter!=readers.end();iter++ )
pReaders->Add(iter->c_str());
m_pReaders = pReaders;
m_pReaders->AddRef();
} // of if
else
hr = Exception(BVR_SOURCE_SMARTCARD,E_OUTOFMEMORY);
} // of if
if( NULL!=m_pReaders )
{ m_pReaders->AddRef();
*retval = m_pReaders;
LOGGER_DEBUG<<_T("COSmartcard::GetReaders().3")<<endl;
} // of if
} // of else
} // of else
}
catch(BVR20983Exception e)
{ LOGGER_ERROR<<e<<endl;
hr = e.GetErrorCode();
}
catch(...)
{ hr = Exception(BVR_SOURCE_SMARTCARD,E_FAIL);
}
return hr;
}
#pragma endregion
#pragma region Events
/*
* COSmartcard::OnInserted
*
* Purpose:
* fire callback for card inserted event
*
*/
void COSmartcard::OnInserted()
{ TriggerEvent( &m_eventInfo[Event_OnInserted] ); }
/*
* COSmartcard::OnRemoved
*
* Purpose:
* fire callback for card removed event
*
*/
void COSmartcard::OnRemoved()
{ TriggerEvent( &m_eventInfo[Event_OnRemoved] ); }
#pragma endregion
#pragma region Smartcard Thread
/**
* called from working thread
*/
bool COSmartcard::InitThread()
{ bool result = false;
HRESULT hr = ::CoInitializeEx(NULL,COINIT_MULTITHREADED);
if( SUCCEEDED(hr) )
{ Critical crit(m_SmartCardCS);
m_pSmartCard = new Smartcard();
result = true;
} // of if
else
{ LOGGER_DEBUG_THREAD<<_T("COSmartcard::InitThread(): ")<<setHR<<CHResult(hr)<<endl; }
return result;
} // of COSmartcard::InitThread()
/**
* called from working thread
*/
void COSmartcard::ExitThread(HRESULT hr)
{ { Critical crit(m_SmartCardCS);
DELETE_POINTER(m_pSmartCard);
}
::CoUninitialize();
} // of COSmartcard::ExitThread()
/**
*
*/
void COSmartcard::RunThread(HANDLE hWaitEvent)
{
::Sleep(5000);
OnInserted();
::Sleep(3000);
OnRemoved();
} // of Run()
} // of namespace COM
} // of namespace bvr20983
#pragma endregion
/*==========================END-OF-FILE===================================*/
| [
"dwachmann@01137330-e44e-0410-aa50-acf51430b3d2"
]
| [
[
[
1,
543
]
]
]
|
559ed077ad417d5599daa85f0d4811eb28d3f328 | 6581dacb25182f7f5d7afb39975dc622914defc7 | /WinsockLab/Ip_multicast_ttl/ip_multicast_ttlsrc.cpp | 7bec0d142d88b692142f8b0a87d299df7704ba52 | []
| no_license | dice2019/alexlabonline | caeccad28bf803afb9f30b9e3cc663bb2909cc4f | 4c433839965ed0cff99dad82f0ba1757366be671 | refs/heads/master | 2021-01-16T19:37:24.002905 | 2011-09-21T15:20:16 | 2011-09-21T15:20:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,986 | cpp | // Description:
// This is a simple multicast application which illustrates
// the use of the IP_TTL option to modify the time-to-live
// field of the IP header similar to the SIO_MULTIPOINT_SCOPE
// ioctl does except this applies to anykind of IP traffic.
//
// Command Line Arguments/Parameters
// ip_multicast_ttl [s|r] ttl
// s Sender
// r Receiver
// ttl Integer TTL value
//
// Vista issue: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=329162
//
// A program that includes Winsock.h should only link with Wsock32.lib
//
// Link to ws2_32.lib
#include <winsock2.h>
// Windows Server 2003 and Windows XP
#include <Ws2tcpip.h>
#include <stdio.h>
#define MAX_BUF 64
// Change the IP accordingly for testing
// Multicast address range 224.0.0.0 - 239.255.255.255
// http://www.iana.org/assignments/multicast-addresses/
#define MULTICAST_IP "192.168.1.1"
#define MULTICAST_PORT 24000
// Function: usage
// Description: Prints usage information
int usage(char *progname)
{
printf("Usage: %s s|r ttl\n", progname);
printf(" s = sender\n");
printf(" r = receiver\n");
printf(" ttl = multicast TTL value\n");
printf("Example: %s s 100\n", progname);
printf("Example: %s r 100\n", progname);
return 0;
}
// Function: main
// Description:
// Load Winsock, parse the arguments and start either the
// multicast sender or receiver. Before sending data
// set the IP_TTL to the specified value.
int main(int argc, char **argv)
{
WSADATA wsd;
SOCKET s;
// struct ipv6_mreq for IPv6
struct ip_mreq mcast; // IPv4
// or better one, use struct ip_mreq_source/IP_MREQ_SOURCE/*PIP_MREQ_SOURCE
// http://msdn.microsoft.com/en-us/library/ms738704(VS.85).aspx
// Vista or later use GROUP_REQ and the GROUP_SOURCE_REQ structures
// which for both IPv6 and IPv4
SOCKADDR_IN local, from;
int ttl, ttlsz, fromsz, ret;
char databuf[MAX_BUF];
BOOL bReceive=FALSE;
// Parse the command line
if (argc < 2)
{
usage(argv[0]);
exit(1);
}
if (tolower(argv[1][0]) == 's')
bReceive = FALSE;
else if (tolower(argv[1][0]) == 'r')
bReceive = TRUE;
else
usage(argv[0]);
ttl = atoi(argv[2]);
// Load winsock
if (WSAStartup(MAKEWORD(2,2), &wsd))
{
printf("WSAStartup() failed with error code %d\n", WSAGetLastError());
return -1;
}
else
printf("WSAStartup() is OK!\n");
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s == INVALID_SOCKET)
{
printf("socket() failed with error code %d\n", WSAGetLastError());
return -1;
}
else
printf("socket() is OK!\n");
if (bReceive)
{
local.sin_family = AF_INET;
local.sin_port = htons(MULTICAST_PORT);
local.sin_addr.s_addr = INADDR_ANY;
if (bind(s, (SOCKADDR *)&local, sizeof(local)) == SOCKET_ERROR)
{
printf("bind() failed with error code %d\n", WSAGetLastError());
return -1;
}
else
printf("bind() is OK!\n");
}
// Join the multicast group
// For XP sp2 and Windows 2003 not needed in order to send,
// only the receivers need to join a multicast group in order to receive
if(bReceive)
{
mcast.imr_multiaddr.s_addr = inet_addr(MULTICAST_IP);
mcast.imr_interface.s_addr = INADDR_ANY;
if (setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&mcast, sizeof(mcast)) == SOCKET_ERROR)
{
printf("setsockopt(IP_ADD_MEMBERSHIP) failed with error code %d\n", WSAGetLastError());
return -1;
}
else
printf("setsockopt(IP_ADD_MEMBERSHIP) is OK!\n");
}
// Set the TTL to our value
ttlsz = sizeof(ttl);
if (setsockopt(s, IPPROTO_IP, IP_MULTICAST_TTL, (char *)&ttl, sizeof(ttl)) == SOCKET_ERROR)
{
printf("setsockopt(IP_MULTICAST_TTL) failed with error code %d\n", WSAGetLastError());
return -1;
}
else
printf("setsockopt(IP_MULTICAST_TTL) is OK!\n");
// Verify
if (getsockopt(s, IPPROTO_IP, IP_MULTICAST_TTL, (char *)&ttl, &ttlsz) == SOCKET_ERROR)
{
printf("getsockopt(IP_MULTICAST_TTL) failed: %d\n", WSAGetLastError());
return -1;
}
else
printf("getsockopt(IP_MULTICAST_TTL) is OK!\n");
printf("Multicast TTL is set to: %d\n", ttl);
if (bReceive)
{
// Receive some data
fromsz = sizeof(from);
ret = recvfrom(s, databuf, MAX_BUF, 0, (SOCKADDR *)&from, &fromsz);
if (ret == SOCKET_ERROR)
{
printf("recvfrom() failed with error code %d\n", WSAGetLastError());
return -1;
}
else
printf("recvfrom() is OK!\n");
databuf[ret] = 0;
printf("read: [%s] from [%s]\n", databuf, inet_ntoa(from.sin_addr));
}
else
{
// Send some data
SOCKADDR_IN to;
memset(databuf, '$', MAX_BUF);
to.sin_family = AF_INET;
to.sin_port = htons(MULTICAST_PORT);
to.sin_addr.s_addr = inet_addr(MULTICAST_IP);
ret = sendto(s, databuf, MAX_BUF-1, 0, (SOCKADDR *)&to, sizeof(to));
if (ret == SOCKET_ERROR)
{
printf("sendto() failed with error code %d\n", WSAGetLastError());
return -1;
}
else
printf("sendto() is OK!\n");
printf("Sent %d bytes to %s\n", ret, inet_ntoa(to.sin_addr));
}
// Cleanup
if(closesocket(s) == 0)
printf("closesocket() should be fine!\n");
else
printf("closesocket() failed with error code %d\n", WSAGetLastError());
if(WSACleanup() == 0)
printf("WSACleanup() is OK!\n");
else
printf("WSACleanup() failed with error code %d\n", WSAGetLastError());
return 0;
}
| [
"damoguyan8844@3a4e9f68-f5c2-36dc-e45a-441593085838"
]
| [
[
[
1,
203
]
]
]
|
f6cf24099bbdac9477081533a2509ee392e4ef09 | 927e18c69355c4bf87b59dffefe59c2974e86354 | /super-go-proj/SgPoint.cpp | 0565e431591b7055e90854ad5499ea0f27fea4f3 | []
| no_license | lqhl/iao-gim-ca | 6fc40adc91a615fa13b72e5b4016a8b154196b8f | f177268804d1ba6edfd407fa44a113a44203ec30 | refs/heads/master | 2020-05-18T17:07:17.972573 | 2011-06-17T03:54:51 | 2011-06-17T03:54:51 | 32,191,309 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,528 | cpp | //----------------------------------------------------------------------------
/** @file SgPoint.cpp
See SgPoint.h */
//----------------------------------------------------------------------------
#include "SgPoint.h"
#include <iostream>
#include <sstream>
#include "SgUtil.h"
using namespace std;
//----------------------------------------------------------------------------
std::string SgPointUtil::PointToString(SgPoint p)
{
ostringstream buffer;
if (p == SG_NULLMOVE)
buffer << "NULL";
else if (p == SG_PASS)
buffer << "PASS";
else if (p == SG_COUPONMOVE)
buffer << "COUPON";
else if (p == SG_COUPONMOVE_VIRTUAL)
buffer << "COUPON_VIRTUAL";
else if (p == SG_RESIGN)
buffer << "RESIGN";
else
buffer << Letter(Col(p)) << Row(p);
return buffer.str();
}
SgPoint SgPointUtil::Rotate(int rotation, SgPoint p, int size)
{
poco_assert(rotation < 8);
if (p == SG_PASS)
return SG_PASS;
int col = Col(p);
int row = Row(p);
switch (rotation)
{
case 0:
return Pt(col, row);
case 1:
return Pt(size - col + 1, row);
case 2:
return Pt(col, size - row + 1);
case 3:
return Pt(row, col);
case 4:
return Pt(size - row + 1, col);
case 5:
return Pt(row, size - col + 1);
case 6:
return Pt(size - col + 1, size - row + 1);
case 7:
return Pt(size - row + 1, size - col + 1);
default:
poco_assert(false);
return p;
}
}
int SgPointUtil::InvRotation(int rotation)
{
switch (rotation)
{
case 0:
return 0;
case 1:
return 1;
case 2:
return 2;
case 3:
return 3;
case 4:
return 5;
case 5:
return 4;
case 6:
return 6;
case 7:
return 7;
default:
poco_assert(false);
return 0;
}
}
//----------------------------------------------------------------------------
void SgReadPoint::Read(std::istream& in) const
{
string s;
in >> s;
if (! in)
return;
poco_assert(s.length() > 0);
if (s == "PASS" || s == "pass")
{
m_point = SG_PASS;
return;
}
if (s == "COUPON" || s == "coupon")
{
m_point = SG_COUPONMOVE;
return;
}
if (s == "COUPON_VIRTUAL" || s == "coupon_virtual")
{
m_point = SG_COUPONMOVE_VIRTUAL;
return;
}
if (s == "RESIGN" || s == "resign")
{
m_point = SG_RESIGN;
return;
}
char c = s[0];
if (c >= 'A' && c <= 'Z')
c = char(c - 'A' + 'a');
else if (c < 'a' || c > 'z')
{
in.setstate(ios::failbit);
return;
}
int col = c - 'a' + 1;
if (c >= 'j')
--col;
istringstream sin(s.substr(1));
int row;
sin >> row;
if (! sin || ! SgUtil::InRange(col, 1, SG_MAX_SIZE)
|| ! SgUtil::InRange(row, 1, SG_MAX_SIZE))
{
in.setstate(ios::failbit);
return;
}
m_point = SgPointUtil::Pt(col, row);
}
//----------------------------------------------------------------------------
ostream& operator<<(ostream& out, const SgWritePoint& writePoint)
{
out << SgPointUtil::PointToString(writePoint.m_p);
return out;
}
//----------------------------------------------------------------------------
| [
"[email protected]"
]
| [
[
[
1,
152
]
]
]
|
5fe56aa7b02e1bd3769353bd69fa8e03f1572220 | 74c8da5b29163992a08a376c7819785998afb588 | /NetAnimal/Game/wheel/NetWheelDirector/include/Logic/StartLogic.h | bcea065c2fef073c3ca27ac19809e16b173253b2 | []
| no_license | dbabox/aomi | dbfb46c1c9417a8078ec9a516cc9c90fe3773b78 | 4cffc8e59368e82aed997fe0f4dcbd7df626d1d0 | refs/heads/master | 2021-01-13T14:05:10.813348 | 2011-06-07T09:36:41 | 2011-06-07T09:36:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 653 | h | #ifndef __Orz_StartLogic_h__
#define __Orz_StartLogic_h__
#include "WheelLogic.h"
#include "TasksManager.h"
#include "GameLogic.h"
#include "WheelAnimalProcess.h"
#include "CommunicateInterface.h"
namespace Orz
{
class TimeLogic;
class SetupRateLogic;
class StartLogic: public FSM::LogicAdv<StartLogic, GameLogic, SetupRateLogic>//, public UpdateToEnable<LogiLogo>
{
public:
typedef boost::mpl::list< sc::custom_reaction< UpdateEvt > > reactions;
sc::result react(const UpdateEvt & evt) ;
StartLogic(my_context ctx);
~StartLogic(void);
void exit(void);
private:
ProcessPtr _process;
};
}
#endif | [
"[email protected]"
]
| [
[
[
1,
30
]
]
]
|
39ab69ddd4e5ee7759825d98ef91457a87fb4dd5 | 00c36cc82b03bbf1af30606706891373d01b8dca | /OpenGUI/OpenGUI_ResourceProvider.h | 838f5e9e07983ce8750a031c36c67ccd14ad87b3 | [
"BSD-3-Clause"
]
| permissive | VB6Hobbyst7/opengui | 8fb84206b419399153e03223e59625757180702f | 640be732a25129a1709873bd528866787476fa1a | refs/heads/master | 2021-12-24T01:29:10.296596 | 2007-01-22T08:00:22 | 2007-01-22T08:00:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,056 | h | // OpenGUI (http://opengui.sourceforge.net)
// This source code is released under the BSD License
// See LICENSE.TXT for details
#ifndef C2BAA2EC_6763_411d_8E50_19614B119573
#define C2BAA2EC_6763_411d_8E50_19614B119573
#include "OpenGUI_PreRequisites.h"
#include "OpenGUI_Exports.h"
#include "OpenGUI_String.h"
#include "OpenGUI_Resource.h"
namespace OpenGUI {
//! Abstract class. Used as a base class for custom resource providers.
class OPENGUI_API ResourceProvider {
public:
// Constructor (base implemenation does nothing)
ResourceProvider() { }
// virtual destructor (base implemenation does nothing)
virtual ~ResourceProvider() { }
//! This will be called whenever %OpenGUI needs data from the registered resource provider.
virtual void loadResource( const String& filename, Resource& output ) = 0;
//! This is called whenever %OpenGUI is done with the data and is ready to destroy the Resource contents
virtual void unloadResource( Resource& resource ) = 0;
};
}
;//namespace OpenGUI{
#endif
| [
"zeroskill@2828181b-9a0d-0410-a8fe-e25cbdd05f59"
]
| [
[
[
1,
31
]
]
]
|
828ca6c2d37511e4930e2874788b1eb294c1a2c7 | bd89d3607e32d7ebb8898f5e2d3445d524010850 | /adaptationlayer/dataport/dataport_csy/inc/dprx2dte.h | 9a7a56d46ccd2dee4b78dddab5cfb88f7a8a35a7 | []
| no_license | wannaphong/symbian-incubation-projects.fcl-modemadaptation | 9b9c61ba714ca8a786db01afda8f5a066420c0db | 0e6894da14b3b096cffe0182cedecc9b6dac7b8d | refs/heads/master | 2021-05-30T05:09:10.980036 | 2010-10-19T10:16:20 | 2010-10-19T10:16:20 | null | 0 | 0 | null | null | null | null | WINDOWS-1250 | C++ | false | false | 9,608 | h | /*
* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "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:
*
*/
#ifndef DPRX2DTE_H
#define DPRX2DTE_H
// INCLUDES
#include "dpdatabuffer.h" // base class for rx and tx buffers
#include "dpdataclient.h" // data client that access buffer
// CONSTANTS
// none
// MACROS
// none
// DATA TYPES
// none
// FUNCTION PROTOTYPES
// none
// FORWARD DECLARATIONS
// none
// CLASS DECLARATION
/**
* CDpRx2Dte abstracts data flow from RX buffer into the C32 client.
* When CDpRx2Dte is signalled, CDpRx2Dte writes requested (from the C32
* client) amount of data into client space. The request involves multiple
* Rx2Dte signalling operations, if data needs to be written in parts.
* CDpRx2Dte handles also echoing and terminator characters detection.
*
* @lib ?library
* @since Series ?XX ?SeriesXX_version
*/
class CDpRx2Dte :public CActive, public MDpDataClient
{
public: // Constructors and destructor
/**
* Two-phased constructor.
* @param aDataPort Dataport main class
*/
static CDpRx2Dte* NewL( CDpDataPort& aDataPort );
/**
* Destructor.
*/
~CDpRx2Dte();
public: // New methods
/**
* This method reserves read data element, and makes write into client
* space. Amount of data to be written is maximum of requested length,
* maximum reservation size (MMRS), and bytes before break.
* @return Error code
*/
TInt Write();
/**
* This method handles forwarded read requests from the C32 client. This
* method also signals ourselves (Rx2Dte), if there is data in receive
* (RX) or echo buffer.
* @param aDes Pointer into client address space to the
* descriptor containing the client’s buffer
* @param aLength The amount of data to be written into client space
* @return Error code
*/
TInt SetDteRead( const TAny* aDes, const TInt aLength );
/**
* This method handles forwarded read cancellation request from the C32
* client. This method cancels read operation.
* @return Error code
*/
TInt ResetDteRead();
/**
* This method informs, whether read is pending.
* @return Is read pending?
*/
inline TBool ReadPending();
/**
* This method informs the wanted length.
* @return How much data the C32 client requested?
*/
inline TInt LengthWanted();
/**
* This method sets amount of break bytes to be sent before break.
* If amount of break bytes is zero and the client has ordered
* break notify, we complete break notify.
* @param aBreakBytes Amount of break bytes
*/
void SetBreakBytes( const TInt aBreakBytes );
/**
* We are requested to write TX data back to client buffer. This method
* appends data to echo buffer, and signals ourselves (Rx2Dte).
* @param aEchoData Echo data Reference
*/
void EchoTx( const TPtr8& aEchoData );
/**
* This method gets the amount of echo bytes.
* @return Amount of echo bytes
*/
TInt EchoBytes();
/**
* This method gets the amount of free bytes in echo buffer.
* @return Amount of free space
*/
TInt EchoBytesFreeSpace();
/**
* This method resets echo bytes.
*/
void ResetEchoBytes();
/**
* This method gests write offset.
* @return Write offset
*/
inline TInt IPCWriteOffset();
public: // Methods from base classes
/**
* From CActive. This method cancels pending request with KErrCancel.
*/
void DoCancel();
/**
* From CActive. This method handles writing of data into client space.
*/
void RunL();
/**
* From CActive. This method handles leave in RunL() and returns
* the given error value.
* @param aError Leave reason
* @return Leave reason is returned in error code
*/
TInt RunError( TInt aError );
/**
* From CDpDataClient. This method signals ourselves (Rx2Dte).
*/
void ReleaseNotify();
/**
* From CDpDataClient. This method notifies that buffer is flushed.
* Classes which have access to buffers are derived from this class.
* Derived class could override this method, otherwise this default
* method will be used.
*/
void FlushNotify();
/**
* This method gets the role (reader/writer) of data client.
* @return Role (EDbDataClientReader/EDbDataClientWriter)
*/
TUint8 Role();
protected: // New methods
// none
protected: // Methods from base classes
// none
private: // Methods
/**
* C++ default constructor.
* @param aDataPort Dataport main class
*/
CDpRx2Dte( CDpDataPort& aDataPort );
/**
* By default Symbian 2nd phase constructor is private.
*/
void ConstructL();
/**
* This method writes echo bytes back to the C32 client and signals
* Dte2Tx. This method completes read to the client, if the client
* has read with ReadOneOrMore() or if client requested length or
* client buffer is full.
* @return Error code
*/
TInt WriteEchoToClient();
/**
* Writes bytes into the client space. This method also handles
* low water mark, if Dcs2Dp flow control is ON and low water
* mark is reached.
* @return Error code
*/
TInt WriteIntoClientSpace();
/**
* This method finds maximum length. i.e. which one is smaller: maximum
* reservation size (MMRS) or client buffer where we write.
* @return Maximum length in bytes
*/
TInt FindMaximumLength();
/**
* This method returns amount of break bytes, if break is pending. Amount
* of used bytes is returned, if break is not pending. If the amount
* exceeds given length, the length is returned.
* @param aMaxLen Maximum length
* @return Length
*/
TInt FindLength( const TInt aMaxLen );
/**
* This method makes actual write operation into client space. This
* method writes also tail part of data element, if it exists. Data
* is written only 'till terminator character, if terminator characters
* are used. Read is completed to the C32 client, if the client has read
* with ReadOneOrMore(), if terminator character was found, or if client
* requested length or client buffer is full.
* Reserved data element is released.
* @param aLen Amount of bytes to be written
* @return Error code
*/
TInt MakeRx2DteWrite( const TInt aLen );
/**
* This method writes the tail into client space. Data is written only
* till terminator character, if terminator characters are used.
* @param aInd On return, aInd contains index of terminator character
* @param aTermCount Terminator characters count
* @return Error code
*/
TInt WriteTail( TInt& aInd, const TInt aTermCount );
public: // Data
// none
protected: // Data
// none
private: // Data
// DataPort
CDpDataPort& iDataPort;
// RX buffer
CDpDataBuffer& iBufferRx;
// Flow control handler
CDpFlowCtrl& iFlowCtrl;
// Port data configuration
CDpDataConfig& iDataConfig;
// Break signal handler
CDpBreak& iBreak;
// Termination characters detector
CDpTermDetect& iTermDetect;
// Reserved RX buffer area
TPtr8 iRx;
// Reserved RX buffer area tail
TPtr8 iRxTail;
// Pointer to client buffer
TAny* iClientBuffer;
// Client buffer length
TInt iClientBufferLength;
// Requested length.
TInt iClientRequestedLength;
// Is read pending?
TBool iReadPending;
// Is break pending?
TBool iBreakPending;
// Amount of break bytes
TInt iBreakBytes;
// Write offset
TInt iIPCWriteOffset;
// Echo buffer
TBuf8<KDpMaximumEchoDataSize> iEchoData;
// Is request active
TBool iRequestActive;
// Role (EDbDataClientReader/EDbDataClientWriter)
const TUint8 iRole;
#ifdef _DEBUG
// Amount of total received bytes
TInt iTotalReceived;
#endif
};
#include "dprx2dte.inl" // inline methods
#endif // DPRX2DTE_H
// End of File
| [
"dalarub@localhost"
]
| [
[
[
1,
334
]
]
]
|
5324adfd914c1177b1512c8a1edeadf652404c77 | 58496be10ead81e2531e995f7d66017ffdfc6897 | /Include/ManualEvent.h | 9dd090a73e7d252873d33afc4087c21f1298e3ea | []
| no_license | Diego160289/cross-fw | ba36fc6c3e3402b2fff940342315596e0365d9dd | 532286667b0fd05c9b7f990945f42279bac74543 | refs/heads/master | 2021-01-10T19:23:43.622578 | 2011-01-09T14:54:12 | 2011-01-09T14:54:12 | 38,457,864 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 751 | h | //============================================================================
// Date : 22.12.2010
// Author : Tkachenko Dmitry
// Copyright : (c) Tkachenko Dmitry ([email protected])
//============================================================================
#ifndef __MANUALEVENT_H__
#define __MANUALEVENT_H__
#include "NoCopyable.h"
#include "Exceptions.h"
namespace System
{
DECLARE_RUNTIME_EXCEPTION(ManualEvent)
class ManualEvent
: private Common::NoCopyable
{
public:
ManualEvent();
~ManualEvent();
void Set();
void Reset();
bool Wait();
private:
class ManualEventImpl;
ManualEventImpl *Impl;
};
}
#endif // !__MANUALEVENT_H__
| [
"TkachenkoDmitryV@d548627a-540d-11de-936b-e9512c4d2277"
]
| [
[
[
1,
36
]
]
]
|
eb1460f99f41757aff3412e60b82186aa4972252 | 30e4267e1a7fe172118bf26252aa2eb92b97a460 | /code/pkg_Core/Interface/Log/LogHelper.h | 7ca4640682a66c910904828ac9783ae2a2eadec2 | [
"Apache-2.0"
]
| permissive | thinkhy/x3c_extension | f299103002715365160c274314f02171ca9d9d97 | 8a31deb466df5d487561db0fbacb753a0873a19c | refs/heads/master | 2020-04-22T22:02:44.934037 | 2011-01-07T06:20:28 | 2011-01-07T06:20:28 | 1,234,211 | 2 | 0 | null | null | null | null | GB18030 | C++ | false | false | 7,911 | h | // Copyright 2008-2011 Zhang Yun Gui, [email protected]
// https://sourceforge.net/projects/x3c/
//
// 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.
/*! \file LogHelper.h
* \brief 定义日志输出的 LOG_WARNING 等宏和 CAutoLogGroup
* \author Zhang Yun Gui, C++ Plugin Framework
* \date 2010.10.19
*/
#ifndef X3_LOG_LOGHELPER_H_
#define X3_LOG_LOGHELPER_H_
#include "XComPtr.h"
#include "Ix_LogManager.h"
#pragma warning (push, 1)
#include <sstream> // std::wostringstream
#pragma warning (pop)
// LOG_DEBUG(msg)
// LOG_DEBUG2(name, extra)
// LOG_INFO(msg)
// LOG_INFO2(name, extra)
// LOG_WARNING(msg)
// LOG_WARNING2(name, extra)
// LOG_ERROR(msg)
// LOG_ERROR2(name, extra)
// LOG_FATAL(msg)
// LOG_FATAL2(name, extra)
// LOG_EVENT_ANSI(name, extra, type, file, line)
//
// void RegisterLogObserver(ILogObserver* observer)
// void UnRegisterLogObserver(ILogObserver* observer)
// CAutoLogGroup(msg)
//! 输出调试信息
/*!
\ingroup _GROUP_PLUGIN_LOG_
\param msg 要输出的信息,为任意类型数值或Unicode字符串(不能是ANSI串),
如果是以@开头接上“Module:StrID”格式则自动换为本地化文字
*/
#define LOG_DEBUG(msg) \
LOG_EVENT_(msg, kLogType_Debug, __FILE__, __LINE__)
//! 输出调试信息和附加信息
/*!
\ingroup _GROUP_PLUGIN_LOG_
\param name Unicode字符串,以@开头接上“Module:StrID”格式
\param extra 附加的上下文信息,为任意类型数值或Unicode字符串(不能是ANSI串)
*/
#define LOG_DEBUG2(name, extra) \
LOG_EVENT_2(name, extra, kLogType_Debug, __FILE__, __LINE__)
//! 输出普通信息
/*!
\ingroup _GROUP_PLUGIN_LOG_
\param msg 要输出的信息,为任意类型数值或Unicode字符串(不能是ANSI串),
如果是以@开头接上“Module:StrID”格式则自动换为本地化文字
*/
#define LOG_INFO(msg) \
LOG_EVENT_(msg, kLogType_Info, __FILE__, __LINE__)
//! 输出普通信息和附加信息
/*!
\ingroup _GROUP_PLUGIN_LOG_
\param name Unicode字符串,以@开头接上“Module:StrID”格式
\param extra 附加的上下文信息,为任意类型数值或Unicode字符串(不能是ANSI串)
*/
#define LOG_INFO2(name, extra) \
LOG_EVENT_2(name, extra, kLogType_Info, __FILE__, __LINE__)
//! 输出警告信息
/*!
\ingroup _GROUP_PLUGIN_LOG_
\param msg 要输出的信息,为任意类型数值或Unicode字符串(不能是ANSI串),
如果是以@开头接上“Module:StrID”格式则自动换为本地化文字
*/
#define LOG_WARNING(msg) \
LOG_EVENT_(msg, kLogType_Warning, __FILE__, __LINE__)
//! 输出警告信息和附加信息
/*!
\ingroup _GROUP_PLUGIN_LOG_
\param name Unicode字符串,以@开头接上“Module:StrID”格式
\param extra 附加的上下文信息,为任意类型数值或Unicode字符串(不能是ANSI串)
*/
#define LOG_WARNING2(name, extra) \
LOG_EVENT_2(name, extra, kLogType_Warning, __FILE__, __LINE__)
//! 输出错误信息
/*!
\ingroup _GROUP_PLUGIN_LOG_
\param msg 要输出的信息,为任意类型数值或Unicode字符串(不能是ANSI串),
如果是以@开头接上“Module:StrID”格式则自动换为本地化文字
*/
#define LOG_ERROR(msg) \
LOG_EVENT_(msg, kLogType_Error, __FILE__, __LINE__)
//! 输出错误信息和附加信息
/*!
\ingroup _GROUP_PLUGIN_LOG_
\param name Unicode字符串,以@开头接上“Module:StrID”格式
\param extra 附加的上下文信息,为任意类型数值或Unicode字符串(不能是ANSI串)
*/
#define LOG_ERROR2(name, extra) \
LOG_EVENT_2(name, extra, kLogType_Error, __FILE__, __LINE__)
//! 输出严重错误信息
/*!
\ingroup _GROUP_PLUGIN_LOG_
\param msg 要输出的信息,为任意类型数值或Unicode字符串(不能是ANSI串),
如果是以@开头接上“Module:StrID”格式则自动换为本地化文字
*/
#define LOG_FATAL(msg) \
LOG_EVENT_(msg, kLogType_Fatal, __FILE__, __LINE__)
//! 输出严重错误信息和附加信息
/*!
\ingroup _GROUP_PLUGIN_LOG_
\param name Unicode字符串,以@开头接上“Module:StrID”格式
\param extra 附加的上下文信息,为任意类型数值或Unicode字符串(不能是ANSI串)
*/
#define LOG_FATAL2(name, extra) \
LOG_EVENT_2(name, extra, kLogType_Fatal, __FILE__, __LINE__)
//! 注册日志输出观察者
/*!
\ingroup _GROUP_PLUGIN_LOG_
\param observer 要注册的观察者
\return 是否注册成功
\see UnRegisterLogObserver
*/
inline bool RegisterLogObserver(ILogObserver* observer)
{
Cx_Interface<Ix_LogManager> pIFManager(CLSID_LogManager);
if (pIFManager.IsNotNull())
{
return pIFManager->RegisterObserver(observer);
}
return false;
}
//! 注销日志输出观察者
/*!
\ingroup _GROUP_PLUGIN_LOG_
\see RegisterLogObserver
*/
inline void UnRegisterLogObserver(ILogObserver* observer)
{
Cx_Interface<Ix_LogManager> pIFManager(CLSID_LogManager);
if (pIFManager.IsNotNull())
{
pIFManager->UnRegisterObserver(observer);
}
}
//! 自动开始一组日志的辅助类,用于在函数中定义局部变量
/*!
\ingroup _GROUP_PLUGIN_LOG_
*/
class CAutoLogGroup
{
public:
//! 构造函数,自动开始新的一组日志
/*!
\param msg 日志组的文字,如果是以@开头接上“Module:StrID”格式则自动换为本地化文字
\param extra 附加的上下文信息
*/
CAutoLogGroup(LPCWSTR msg, LPCWSTR extra = NULL)
{
Cx_Interface<Ix_LogManager> pIFManager(CLSID_LogManager);
if (pIFManager.IsNotNull())
{
pIFManager->PushGroup(msg, extra);
}
}
//! 析构函数,自动结束一组日志
~CAutoLogGroup()
{
Cx_Interface<Ix_LogManager> pIFManager(CLSID_LogManager);
if (pIFManager.IsNotNull())
{
pIFManager->PopGroup();
}
}
};
#pragma warning(disable:4127) // conditional expression is constant
#define LOG_EVENT_(msg, type, file, line) \
do { \
Cx_Interface<Ix_LogManager> pIFManager(CLSID_LogManager); \
if (pIFManager.IsNotNull()) \
{ \
std::wostringstream buf; \
buf << msg; \
pIFManager->WriteLog(type, buf.str().c_str(), L"", file, line); \
}} while (0)
#define LOG_EVENT_2(name, extra, type, file, line) \
do { \
Cx_Interface<Ix_LogManager> pIFManager(CLSID_LogManager); \
if (pIFManager.IsNotNull()) \
{ \
std::wostringstream buf; \
buf << extra; \
pIFManager->WriteLog(type, name, buf.str().c_str(), file, line); \
}} while (0)
//! 输出ANSI串的日志信息
/*!
\ingroup _GROUP_PLUGIN_LOG_
\param name ANSI字符串,以@开头接上“Module:StrID”格式
\param extra 附加的上下文信息,为任意类型数值或ANSI字符串
\param type 日志类型,见 kLogType
\param file 源代码文件名, 一般取为 __FILE__
\param line 源代码行号, 一般取为 __LINE__
*/
#define LOG_EVENT_ANSI(name, extra, type, file, line) \
do { \
Cx_Interface<Ix_LogManager> pIFManager(CLSID_LogManager); \
if (pIFManager.IsNotNull()) \
{ \
std::ostringstream buf; \
buf << extra; \
pIFManager->WriteLog(type, name, buf.str().c_str(), file, line); \
}} while (0)
#endif // X3_LOG_LOGHELPER_H_
| [
"rhcad1@71899303-b18e-48b3-b26e-8aaddbe541a3"
]
| [
[
[
1,
250
]
]
]
|
c4c4cb133b446efb547039efdbe1baeb9f3f7ada | 4d6de81299cbccbbc34637ee62813c0920b0319f | /compiler/stdafx.cpp | 5d7733546ec8c6f5eab96f95229a1b050863b02d | []
| no_license | carlosh/gcompiler | f9657b957cb173acf7e600704607eaab7c43bdd6 | 32789ae2ba4da2e3ca784a96bc5669c2b69a8fa1 | refs/heads/master | 2020-05-19T09:19:02.376055 | 2011-11-06T13:09:45 | 2011-11-06T13:09:45 | 2,055,579 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 301 | cpp | // stdafx.cpp : source file that includes just the standard includes
// PascalCompiler.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
| [
"[email protected]"
]
| [
[
[
1,
8
]
]
]
|
ae3352e3ba634f6a78f5704ae75b9d2784df0609 | e8db4eeab529af596d2761e20583ebf0603bb6e9 | /Charack/charack/CharackCoastGenerator.h | 785d7ca853f5c6f2e102eff83ede3a66def0bc82 | []
| no_license | gamedevforks/charack | 099c83fe64c076c126b1ea9212327cd3bd05b42c | c5153d3107cb2a64983d52ee37c015bcd7e93426 | refs/heads/master | 2020-04-11T04:18:57.615099 | 2008-10-29T13:26:33 | 2008-10-29T13:26:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,003 | h | #ifndef __CHARACK_COST_GENERATOR_H_
#define __CHARACK_COST_GENERATOR_H_
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <list>
#include "config.h"
#include "vector3.h"
#define _CK_CG_RRAND(a, b) (int)((a) + rand()/(RAND_MAX + 1.0) * ((b) - (a) + 1))
/**
* Generates the coast for a continent. Using the midpoint displacement fractal, the class can transform
* a straight line into a set of disturbed points, which can be used to render a continent coast.
*/
class CharackCoastGenerator {
private:
int mMaxDivision;
int mMaxVariation;
public:
static enum CLASS_DEFS {
AXIS_X,
AXIS_Y,
AXIS_Z
};
CharackCoastGenerator();
~CharackCoastGenerator();
void setMaxDivisions(int theHowMany);
int getMaxDivisions();
void setVariation(int theHowMuch);
int getVariation();
void setRandSeed(int theSeed);
std::list<Vector3> generate(Vector3 thePointA, Vector3 thePointB, int thePerturbationAxis);
};
#endif | [
"[email protected]"
]
| [
[
[
1,
44
]
]
]
|
3e6b3f117eceabe5030a23e512a9bbc1ef58a508 | a0bc9908be9d42d58af7a1a8f8398c2f7dcfa561 | /SlonEngine/slon/Scene/SlaveCamera.h | bc6da97366d634ba84c8efeaae7fe5fe284c9c97 | []
| no_license | BackupTheBerlios/slon | e0ca1137a84e8415798b5323bc7fd8f71fe1a9c6 | dc10b00c8499b5b3966492e3d2260fa658fee2f3 | refs/heads/master | 2016-08-05T09:45:23.467442 | 2011-10-28T16:19:31 | 2011-10-28T16:19:31 | 39,895,039 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,881 | h | #ifndef __SLON_ENGINE_CAMER_SLAVE_CAMERA__
#define __SLON_ENGINE_CAMER_SLAVE_CAMERA__
#include "CommonCamera.h"
namespace slon {
namespace scene {
/** Slave camera get its transformation from the master camera.
* Slave camera must have valid master camera, otherwise any get
* function except getMasterCamera, getRenderPass will assert.
*/
class SLON_PUBLIC SlaveCamera :
public CommonCamera
{
private:
// noncopyable
SlaveCamera(const SlaveCamera&);
SlaveCamera& operator = (const SlaveCamera&);
public:
SlaveCamera();
SlaveCamera(const Camera& masterCamera);
virtual ~SlaveCamera() {}
/** Get master camera of this slave camera */
const Camera* getMasterCamera() const { return masterCamera.get(); }
/** Set master camera of this slave camera */
void setMasterCamera(const Camera* _masterCamera) { masterCamera.reset(_masterCamera); }
// Override camera
const math::Frustumf& getFrustum() const { assert(masterCamera); return masterCamera->getFrustum(); }
const math::Matrix4f& getProjectionMatrix() const { assert(masterCamera); return masterCamera->getProjectionMatrix(); }
const math::Matrix4f& getViewMatrix() const { assert(masterCamera); return masterCamera->getViewMatrix(); }
const math::Matrix4f& getInverseViewMatrix() const { assert(masterCamera); return masterCamera->getInverseViewMatrix(); }
const math::Matrix3f& getNormalMatrix() const { assert(masterCamera); return masterCamera->getNormalMatrix(); }
protected:
boost::intrusive_ptr<const Camera> masterCamera;
};
typedef boost::intrusive_ptr<SlaveCamera> slave_camera_ptr;
typedef boost::intrusive_ptr<const SlaveCamera> const_slave_camera_ptr;
} // namespace scene
} // namespace slon
#endif // __SLON_ENGINE_CAMER_SLAVE_CAMERA__
| [
"devnull@localhost"
]
| [
[
[
1,
49
]
]
]
|
0bdd689d04e8574cce3179082493047b2d5e5af1 | 2f443516e0d67713fc3c47e7a60d5cd7501b521c | /dll/tags/conitec_081108/ackwiimote.h | b7080670e88d8dec32148b95a477671b91d64251 | []
| no_license | firoball/Wiimote | 66acbbc21b5349c89cc20b736d3edf5df22e1b99 | bfc1a9351117630abeb1d464fffcc38e01d4f204 | refs/heads/master | 2021-01-19T19:47:11.911215 | 2009-10-25T22:15:49 | 2009-10-25T22:15:49 | 88,445,550 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,214 | h | /*
*******************************************************************************
* wiimote.cpp
* Creation date: 2007
* Author: Firoball
*
*******************************************************************************
* $Date$
* $Revision$
* $Author$
*
*******************************************************************************
* Description
*
* Acknex game engine specific extensions for wiimote library - header
*
* Comments
*
* IMPORTANT: Changes to this structure have to be copied to ackwii.h of
* Wiimote Lite-C Project.
* Array defines of Wiimote C-Script project have to be adapted as well.
*
*******************************************************************************
*/
#ifndef ACKWIIMOTE_H
#define ACKWIIMOTE_H
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
// engine specific header file
#define DLL_USE // always define before including adll.h
#include "adll.h"
#include "wiimote.h"
//battery update every 5 minutes
#define BAT_PERIOD 300 /* 300 seconds */
typedef struct
{
var joy_x;
var joy_y;
}STICK;
typedef struct
{
var ir_x;
var ir_y;
}IR;
typedef struct
{
var l;
var r;
}SHOULDER;
typedef struct
{
var topright;
var botright;
var topleft;
var botleft;
var weight;
}BOARD;
typedef struct
{
var butA;
var butB;
var butX;
var butY;
var butC;
var butZ;
var but1;
var but2;
var butL;
var butR;
var butZL;
var butZR;
var butPlus;
var butMinus;
var butHome;
var butGreen;
var butRed;
var butYellow;
var butBlue;
var butOrange;
var butAny;
}BUTTONS;
typedef struct
{
var up;
var down;
var left;
var right;
}DPAD;
typedef struct
{
var ir;
var nunchuk;
var classic;
var guitar;
var balanceboard;
var battery;
var batteryraw;
var vibration;
var index;
}STATUS;
typedef struct
{
//wiimote, Nunchuk, Classic Controller buttons
void* on_a;
void* on_b;
void* on_x;
void* on_y;
void* on_c;
void* on_z;
void* on_1;
void* on_2;
void* on_l;
void* on_r;
void* on_zl;
void* on_zr;
void* on_plus;
void* on_minus;
void* on_home;
//guitar buttons
void* on_green;
void* on_red;
void* on_yellow;
void* on_blue;
void* on_orange;
//directional pad
void* on_up;
void* on_down;
void* on_left;
void* on_right;
void* on_any;
}EVT;
typedef struct
{
ANGLE angle1;
ANGLE angle2;
VECTOR accel1;
VECTOR accel2;
STICK stick1;
STICK stick2;
BOARD board;
IR ir[4];
SHOULDER shoulder;
BUTTONS buttons;
DPAD dpad;
STATUS status;
EVT event;
}WIIMOTE;
typedef struct
{
BUTTONS buttons;
DPAD dpad;
}LOCKER;
class ackWiiMote:public cWiiMote
{
public:
ackWiiMote();
~ackWiiMote();
bool ConnectToDevice(int index = 0);
bool Disconnect();
void GetStatus(WIIMOTE * buffer);
bool ShutdownRequested() const {return shutdown;}
void CallPointers(WIIMOTE * buffer);
private:
bool shutdown;
HANDLE ThreadHandle;
DWORD ThreadID;
var BatTimer;
LOCKER locked;
int dev_index;
int batRaw, bat;
};
#endif
| [
"Firo@78409304-7c08-194f-9fca-1d8c658d3d9e"
]
| [
[
[
1,
199
]
]
]
|
5e88f0c24964dd9349c4508abe38002e5ede02b3 | 97f1be9ac088e1c9d3fd73d76c63fc2c4e28749a | /3dc/win95/awBmpLd.cpp | 8fd48d2d385affeae2f37a65ad6f7b33a503602d | [
"LicenseRef-scancode-warranty-disclaimer"
]
| no_license | SR-dude/AvP-Wine | 2875f7fd6b7914d03d7f58e8f0ec4793f971ad23 | 41a9c69a45aacc2c345570ba0e37ec3dc89f4efa | refs/heads/master | 2021-01-23T02:54:33.593334 | 2011-09-17T11:10:07 | 2011-09-17T11:10:07 | 2,375,686 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,952 | cpp | #include "advwin32.h"
#ifndef DB_LEVEL
#define DB_LEVEL 4
#endif
#include "db.h"
#include "awTexLd.hpp"
// BMP Loader
class AwBmpLoader : public AwTl::TypicalTexFileLoader
{
protected:
virtual void LoadHeaderInfo(MediaMedium * pMedium);
virtual AwTl::Colour * GetPalette();
virtual bool AreRowsReversed();
virtual void LoadNextRow(AwTl::PtrUnion pRow);
WORD bmp_bitdepth;
DWORD bmp_offset;
DWORD bmp_headsize;
unsigned bmp_filepitchpad;
unsigned bmp_bitmask;
MediaMedium * m_pMedium;
};
void AwBmpLoader::LoadHeaderInfo(MediaMedium * pMedium)
{
m_pMedium = pMedium; // store for later
db_log4("\tLoading a BMP file");
pMedium->MovePos(+10); // 2 bytes BM (magic) and 4 bytes bmp_filesize and 4 bytes reserved
MediaRead(pMedium,&bmp_offset);
MediaRead(pMedium,&bmp_headsize);
// 12 for OS/2 1.x 40 for Windows, 64 for OS/2 2.x
if (12 != bmp_headsize && 40 != bmp_headsize && 64 != bmp_headsize)
{
awTlLastErr = AW_TLE_BADFILEFORMAT;
db_logf3(("AwCreateTexture(): ERROR: BMP_headersize (%u) is not a recognized BMP format",bmp_headsize));
}
#if DB_LEVEL >= 4
switch (bmp_headsize)
{
case 12:
db_log4("\tBMP format is OS/2 1.x");
break;
case 40:
db_log4("\tBMP format is Windows 3.x");
break;
case 64:
db_log4("\tBMP format is OS/2 2.x");
}
#endif
if (bmp_headsize >= 40)
{
DWORD width, height;
MediaRead(pMedium,&width);
MediaRead(pMedium,&height);
m_nWidth = width;
m_nHeight = height;
}
else
{
WORD width, height;
MediaRead(pMedium,&width);
MediaRead(pMedium,&height);
m_nWidth = width;
m_nHeight = height;
}
// next WORD is planes and should == 1
WORD bmp_planes = 0; // ALEX: added in initialization to prevent compiler warnings
MediaRead(pMedium,&bmp_planes);
if (1!=bmp_planes)
{
awTlLastErr = AW_TLE_BADFILEDATA;
db_log3("AwCreateTexture(): ERROR: BMP_planes should be 1");
}
MediaRead(pMedium,&bmp_bitdepth);
db_logf4(("\tBMP_bitdepth is %hd",bmp_bitdepth));
if (1!=bmp_bitdepth && 2!=bmp_bitdepth && 4!=bmp_bitdepth && 8!=bmp_bitdepth && 24!=bmp_bitdepth)
{
awTlLastErr = AW_TLE_BADFILEDATA;
db_logf3(("AwCreateTexture(): ERROR: BMP_bitdepth (%u) should be 1,2,4,8 or 24",bmp_bitdepth));
}
if (bmp_headsize >= 40)
{
// next DWORD is compression, not supported so only accept 0
DWORD compression = 0;
MediaRead(pMedium,&compression);
if (compression)
{
db_log3("AwCreateTexture(): ERROR: Cannont read compressed BMP files");
awTlLastErr = AW_TLE_BADFILEFORMAT;
}
// DWORD bmp_size - ignored, 2xDWORDS ignored
pMedium->MovePos(+12);
DWORD palette_size = 0; // ALEX: added in initialization to prevent compiler warnings
MediaRead(pMedium,&palette_size);
m_nPaletteSize = palette_size;
// skip to the start of the palette if there would be one
pMedium->MovePos(bmp_headsize-36);
}
else
{
m_nPaletteSize = 0;
}
bmp_offset -= (bmp_headsize+14);
if (!m_nPaletteSize && bmp_bitdepth<=8)
m_nPaletteSize = 1<<bmp_bitdepth;
if (m_nPaletteSize)
bmp_offset -= bmp_headsize >= 40 ? m_nPaletteSize*4 : m_nPaletteSize*3;
db_logf4(("\tBMP_palettesize is %u",m_nPaletteSize));
bmp_filepitchpad = (~(m_nWidth*bmp_bitdepth-1))/8 & 3;
db_logf4(("\tBMP has %u bytes padding per row",bmp_filepitchpad));
bmp_bitmask = (1<<bmp_bitdepth)-1;
}
AwTl::Colour * AwBmpLoader::GetPalette()
{
db_assert1(m_nPaletteSize);
db_assert1(m_pPalette);
if (m_nPaletteSize > 256)
{
awTlLastErr = AW_TLE_BADFILEDATA;
db_log3("AwCreateTexture(): ERROR: BMP_palettesize is too large");
}
else
{
AwTl::Colour * pmP = m_pPalette;
for (unsigned pc = m_nPaletteSize; pc; --pc,++pmP)
{
MediaRead(m_pMedium,&pmP->b);
MediaRead(m_pMedium,&pmP->g);
MediaRead(m_pMedium,&pmP->r);
if (bmp_headsize >= 40) m_pMedium->MovePos(+1);
}
}
// skip to the start of the pixel data
m_pMedium->MovePos(bmp_offset);
return m_pPalette;
}
bool AwBmpLoader::AreRowsReversed()
{
return true;
}
void AwBmpLoader::LoadNextRow(AwTl::PtrUnion pRow)
{
if (m_nPaletteSize)
{
unsigned shift = 0;
BYTE byte = 0; // Not needed.
for (unsigned colcount = m_nWidth; colcount; --colcount)
{
if (!shift)
{
shift = 8;
MediaRead(m_pMedium, &byte);
}
shift -= bmp_bitdepth;
*pRow.byteP++ = static_cast<BYTE>(byte>>shift & bmp_bitmask);
}
}
else
{
for (unsigned colcount = m_nWidth; colcount; --colcount)
{
MediaRead(m_pMedium,&pRow.colourP->b);
MediaRead(m_pMedium,&pRow.colourP->g);
MediaRead(m_pMedium,&pRow.colourP->r);
++pRow.colourP;
}
}
m_pMedium->MovePos(bmp_filepitchpad);
}
#ifdef _MSC_VER
// VC5.0 tries to compile out code that is in a library
// and it thinks isn't being used
#line 186
#endif
AWTEXLD_IMPLEMENT_DYNCREATE("BM",AwBmpLoader)
| [
"a_jagers@ANTHONYJ.(none)"
]
| [
[
[
1,
192
]
]
]
|
5623218aab7370aedc5d81fc29cf9771b663230e | da9e4cd28021ecc9e17e48ac3ded33b798aae59c | /SRC/DRIVERS/KEYBD/Matrix_0409/s3c6410_layout.cpp | e60690cc2979b01d8eb61e48909046fa2005c341 | []
| no_license | hibive/sjmt6410pm090728 | d45242e74b94f954cf0960a4392f07178088e560 | 45ceea6c3a5a28172f7cd0b439d40c494355015c | refs/heads/master | 2021-01-10T10:02:35.925367 | 2011-01-27T04:22:44 | 2011-01-27T04:22:44 | 43,739,703 | 1 | 1 | null | null | null | null | WINDOWS-1256 | C++ | false | false | 19,154 | cpp | //
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Copyright (c) 2008. Samsung Electronics, co. ltd All rights reserved.
Module Name:
Abstract:
This file implements the S3C6410 Keyboard function
Notes:
--*/
#include <windows.h>
#include <keybddr.h>
#include <laymgr.h>
#include <devicelayout.h>
#include <keybddbg.h>
#include "winuserm.h"
#include "KeyMatrix.hpp"
#define VK_MATRIX_FN 0xC1
#if (MATRIX_LAYOUT == LAYOUT0)
#define ScanCodeTableFirst 0x00
#define ScanCodeTableLast 0x3F
UINT8 ScanCodeToVKeyTable[] =
{
VK_ESCAPE, // scan code 0, ESC
'A', // scan code 1,
'B', // scan code 2,
'C', // scan code 3
'D', // scan code 4
VK_T1, // scan code 5
VK_T2, // scan code 6
VK_T3, // scan code 7
VK_RETURN, // scan code 8, Enter
'E', // scan code 9
'F', // scan code 10
'G', // scan code 11
'H', // scan code 12
VK_T4, // scan code 13
VK_T5, // scan code 14
VK_T6, // scan code 15
VK_TAB, // scan code 16, TAB
'I', // scan code 17,
'J', // scan code 18,
'K', // scan code 19,
'L', // scan code 20,
VK_T7, // scan code 21,
VK_T8, // scan code 22,
VK_T9, // scan code 23,
VK_SHIFT, // scan code 24, Shift
'M', // scan code 25,
'N', // scan code 26,
'O', // scan code 27,
'P', // scan code 28,
VK_MULTIPLY, // scan code 29,
VK_T0, // scan code 30,
VK_PERIOD, // scan code 31,
VK_CONTROL, // scan code 32, CTRL
'Q', // scan code 33,
'R', // scan code 34,
'S', // scan code 35,
'T', // scan code 36,
VK_HYPHEN, // scan code 37,
VK_APOSTROPHE, // scan code 38,
VK_COMMA, // scan code 39,
VK_MENU, // scan code 40, ALT
'U', // scan code 41,
'V', // scan code 42,
'W', // scan code 43,
'X', // scan code 44,
VK_SLASH, // scan code 45,
VK_SEMICOLON, // scan code 46,
VK_CAPITAL, // scan code 47,
VK_HANGUL, // scan code 48, Korean/English
'Y', // scan code 49,
'Z', // scan code 50,
VK_SUBTRACT, // scan code 51, -
VK_EQUAL, // scan code 52, =
VK_LBRACKET, // scan code 53, [
VK_UP, // scan code 54,
VK_RBRACKET, // scan code 55, ]
VK_LWIN, // scan code 56, Windows launcher
VK_DELETE, // scan code 57,
VK_SPACE, // scan code 58,
VK_BACK, // scan code 59,
VK_BACKSLASH, // scan code 60,
VK_LEFT, // scan code 61,
VK_DOWN, // scan code 62,
VK_RIGHT, // scan code 63,
};
#elif (MATRIX_LAYOUT == LAYOUT1)
#define ScanCodeTableFirst 0x00
#define ScanCodeTableLast 0x09
UINT8 ScanCodeToVKeyTable[] =
{
VK_UP, // scan code 0
VK_LWIN, // scan code 1
VK_RETURN, // scan code 2
VK_CONTROL, // scan code 3
VK_DOWN, // scan code 4
VK_DELETE, // scan code 5
VK_RIGHT, // scan code 6
VK_ESCAPE, // scan code 7
VK_LEFT, // scan code 8
VK_MENU, // scan code 9
};
#elif (MATRIX_LAYOUT == LAYOUT2)
#define ScanCodeTableFirst 0x00
#define ScanCodeTableLast 0x3F
UINT8 ScanCodeToVKeyTable[] =
{
#ifdef OMNIBOOK_VER
VK_T0, // scan code 0
VK_T9, // scan code 1
VK_T8, // scan code 2
VK_T7, // scan code 3
VK_T6, // scan code 4
VK_T5, // scan code 5
VK_T4, // scan code 6
VK_MATRIX_FN, // scan code 7
VK_T3, // scan code 8
VK_T2, // scan code 9
VK_T1, // scan code 10
'Q', // scan code 11
'W', // scan code 12
'E', // scan code 13
'R', // scan code 14
VK_SHIFT, // scan code 15
'T', // scan code 16
'Y', // scan code 17
'U', // scan code 18
'I', // scan code 19
'P', // scan code 20
'O', // scan code 21
VK_BACK, // scan code 22
VK_MENU, // scan code 23
'L', // scan code 24
'K', // scan code 25
'J', // scan code 26
'H', // scan code 27
'G', // scan code 28
'F', // scan code 29
'D', // scan code 30
#if (OMNIBOOK_VER==4)
VK_F15,//VK_HOME, // scan code 31
#else
0, // scan code 31
#endif (OMNIBOOK_VER==4)
'A', // scan code 32
'S', // scan code 33
'Z', // scan code 34
'X', // scan code 35
'C', // scan code 36
'V', // scan code 37
'B', // scan code 38
0, // scan code 39
'N', // scan code 40
'M', // scan code 41
VK_PERIOD, //'.' // scan code 42
VK_SLASH, //'/' // scan code 43
VK_RETURN, // scan code 44
VK_F21, // Sym // scan code 45
VK_F20, // Aa // scan code 46
0, // scan code 47
VK_HANGUL, // scan code 48
VK_PRIOR, // scan code 49
VK_NEXT, // scan code 50
VK_F13,//VK_BACK, // scan code 51
VK_F18,//VK_MENU, // scan code 52
#if (OMNIBOOK_VER==3)
VK_F15,//VK_HOME, // scan code 53
#elif (OMNIBOOK_VER==4)
VK_NEXT, // scan code 53
#endif //(OMNIBOOK_VER==x)
VK_SPACE, // scan code 54
0, // scan code 55
VK_VOLUME_DOWN, // scan code 56
VK_VOLUME_UP, // scan code 57
VK_RIGHT, // scan code 58
VK_UP, // scan code 59
VK_RETURN, // scan code 60
VK_DOWN, // scan code 61
VK_LEFT, // scan code 62
0, // scan code 63
#else //!OMNIBOOK_VER
0, // scan code 0,
0, // scan code 1,
VK_T1, // scan code 2,
'Q', // scan code 3
'A', // scan code 4
VK_CONTROL, // scan code 5
VK_TACTION, // scan code 6
VK_LEFT, // scan code 7
0, // scan code 8,
0, // scan code 9
VK_T2, // scan code 10
'W', // scan code 11
'S', // scan code 12
'Z', // scan code 13
VK_RIGHT, // scan code 14
VK_F2, // scan code 15
0, // scan code 16,
0, // scan code 17,
VK_T3, // scan code 18,
'E', // scan code 19,
'D', // scan code 20,
'X', // scan code 21,
VK_DELETE, // scan code 22,
VK_UP, // scan code 23,
0, // scan code 24,
0, // scan code 25,
VK_T4, // scan code 26,
'R', // scan code 27,
'F', // scan code 28,
'C', // scan code 29,
VK_CAPITAL, // scan code 30,
VK_F1, // scan code 31,
0, // scan code 32,
'O', // scan code 33,
VK_T5, // scan code 34,
'T', // scan code 35,
'G', // scan code 36,
'V', // scan code 37,
VK_DOWN, // scan code 38,
VK_BACK, // scan code 39,
'P', // scan code 40,
VK_T0, // scan code 41,
VK_T6, // scan code 42,
'Y', // scan code 43,
'H', // scan code 44,
VK_SPACE, // scan code 45,
VK_LWIN, // scan code 46,
VK_MULTIPLY, // scan code 47,
'M', // scan code 48,
'L', // scan code 49,
VK_T7, // scan code 50,
'U', // scan code 51,
'J', // scan code 52,
'N', // scan code 53,
VK_ESCAPE, // scan code 54,
VK_RETURN, // scan code 55,
VK_SHIFT, // scan code 56,
VK_T9, // scan code 57,
VK_T8, // scan code 58,
'I', // scan code 59,
'K', // scan code 60,
'B', // scan code 61,
VK_TAB, // scan code 62,
VK_MENU, // scan code 63,
#endif OMNIBOOK_VER
};
#endif
static ScanCodeToVKeyData scvkEngUS =
{
0,
ScanCodeTableFirst,
ScanCodeTableLast,
ScanCodeToVKeyTable
};
#if (MATRIX_LAYOUT == LAYOUT0)
#define ScanCodeTableExtFirst 0xE000
#define ScanCodeTableExtLast 0xE03F
UINT8 ScanCodeToVKeyExtTable[] =
{
0,
VK_T1,
VK_T2,
VK_T3,
0,
0,
0,
0,
0,
VK_T4,
VK_T5,
VK_T6,
0,
0,
0,
0,
0,
VK_T7,
VK_T8,
VK_T9,
0,
0,
0,
0,
0,
VK_TTALK,
0,
0,
0,
0,
0,
0,
0,
VK_TEND,
0,
0,
0,
0,
0,
0,
0,
VK_TVOLUMEUP,
VK_TVOLUMEDOWN,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
#elif (MATRIX_LAYOUT == LAYOUT1)
#define ScanCodeTableExtFirst 0xE000
#define ScanCodeTableExtLast 0xE009
UINT8 ScanCodeToVKeyExtTable[] =
{
VK_T1,
VK_T2,
VK_T3,
VK_T4,
VK_T5,
VK_T6,
VK_TVOLUMEUP,
VK_TVOLUMEDOWN,
0,
0,
};
#elif (MATRIX_LAYOUT == LAYOUT2)
#define ScanCodeTableExtFirst 0xE000
#define ScanCodeTableExtLast 0xE03F
UINT8 ScanCodeToVKeyExtTable[] =
{
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
#endif
static ScanCodeToVKeyData scvkEngExtUS =
{
0xe000,
ScanCodeTableExtFirst,
ScanCodeTableExtLast,
ScanCodeToVKeyExtTable
};
static ScanCodeToVKeyData *rgscvkMatrixEngUSTables[] =
{
&scvkEngUS,
&scvkEngExtUS
};
struct VirtualKeyMapping
{
UINT32 uiVk;
UINT32 uiVkGenerated;
};
static const VirtualKeyMapping g_rgvkMapFn[] =
{
{ '1', VK_F1 },
{ '2', VK_F2 },
{ '3', VK_F3 },
{ '4', VK_F4 },
{ '5', VK_F5 },
{ '6', VK_F6 },
{ '7', VK_F7 },
{ '8', VK_F8 },
{ '9', VK_F9 },
{ '0', VK_F10 },
#ifdef OMNIBOOK_VER
{ VK_HANGUL, VK_HANJA }, // ار/؟µ
{ VK_F20, VK_CAPITAL }, // Aa
{ VK_F21, VK_TAB }, // Sym
{ VK_RETURN, VK_TAB }, // ENTER
{ VK_BACK, VK_DELETE }, // DEL
{ 'T', VK_F22 }, // Test Program...
{ 'W', VK_BROWSER_REFRESH }, // Wifi OnOff
{ VK_VOLUME_DOWN, VK_BROWSER_BACK }, // System Volume Down
{ VK_VOLUME_UP, VK_BROWSER_FORWARD }, // System Volume Up
#else //!OMNIBOOK_VER
{ VK_HYPHEN, VK_NUMLOCK },
{ VK_EQUAL, VK_CANCEL },
{ 'P', VK_INSERT },
{ VK_LBRACKET, VK_PAUSE },
{ VK_RBRACKET, VK_SCROLL },
{ VK_SEMICOLON, VK_SNAPSHOT },
{ VK_APOSTROPHE, VK_SNAPSHOT },
#endif OMNIBOOK_VER
{ VK_LEFT, VK_HOME },
{ VK_UP, VK_PRIOR},
{ VK_DOWN, VK_NEXT },
{ VK_RIGHT, VK_END },
};
static const VirtualKeyMapping g_rgvkMapNumLock[] =
{
{ '7', VK_NUMPAD7 },
{ '8', VK_NUMPAD8 },
{ '9', VK_NUMPAD9 },
{ '0', VK_MULTIPLY },
{ 'U', VK_NUMPAD4 },
{ 'I', VK_NUMPAD5 },
{ 'O', VK_NUMPAD6 },
{ 'P', VK_SUBTRACT },
{ 'J', VK_NUMPAD1 },
{ 'K', VK_NUMPAD2 },
{ 'L', VK_NUMPAD3 },
{ VK_SEMICOLON, VK_ADD },
{ 'M', VK_NUMPAD0 },
{ VK_PERIOD, VK_DECIMAL },
{ VK_SLASH, VK_DIVIDE },
};
// Find a virtual key mapping in the given array.
static
const VirtualKeyMapping *
FindRemappedKey(
UINT32 uiVk,
const VirtualKeyMapping *pvkMap,
DWORD cvkMap
)
{
const VirtualKeyMapping *pvkMapMatch = NULL;
UINT ui;
if(pvkMap == NULL)
{
DEBUGMSG(ZONE_ERROR, (_T("FindRemappedKey: pvkMap error\r\n")));
return NULL;
}
for (ui = 0; ui < cvkMap; ++ui)
{
if (pvkMap[ui].uiVk == uiVk)
{
pvkMapMatch = &pvkMap[ui];
break;
}
}
return pvkMapMatch;
}
#define IS_NUMLOCK_ON(ksf) (ksf & KeyShiftNumLockFlag)
// Remapping function for the matrix keyboard
static
UINT
WINAPI
MatrixUsRemapVKey(
const KEYBD_EVENT *pKbdEvents,
UINT cKbdEvents,
KEYBD_EVENT *pRmpKbdEvents,
UINT cMaxRmpKbdEvents
)
{
SETFNAME(_T("MatrixUsRemapVKey"));
static BOOL fFnDown = FALSE;
UINT cRmpKbdEvents = 0;
UINT ui;
if (pRmpKbdEvents == NULL)
{
// 1 to 1 mapping
if (cMaxRmpKbdEvents != 0)
{
DEBUGMSG(ZONE_ERROR, (_T("%s: cMaxRmpKbdEvents error!\r\n"), pszFname));
}
return cKbdEvents;
}
if (pKbdEvents == NULL)
{
DEBUGMSG(ZONE_ERROR, (_T("%s: pKbdEvents error!\r\n"), pszFname));
}
if (cMaxRmpKbdEvents < cKbdEvents)
{
DEBUGMSG(ZONE_ERROR, (_T("%s: Buffer is not large enough!\r\n"), pszFname));
return 0;
}
for (ui = 0; ui < cKbdEvents; ++ui)
{
const KEYBD_EVENT *pKbdEventCurr = &pKbdEvents[ui];
KEYBD_EVENT *pKbdEventRmpCurr = &pRmpKbdEvents[cRmpKbdEvents];
// Copy the input key event to our remapped list
pKbdEventRmpCurr->uiVk = pKbdEventCurr->uiVk;
pKbdEventRmpCurr->uiSc = pKbdEventCurr->uiSc;
pKbdEventRmpCurr->KeyStateFlags = pKbdEventCurr->KeyStateFlags;
const VirtualKeyMapping *pvkMap = NULL;
BOOL fKeyDown = (pKbdEventCurr->KeyStateFlags & KeyStateDownFlag) != 0;
UINT32 uiVkCurr = pKbdEventCurr->uiVk;
if (uiVkCurr == VK_MATRIX_FN)
{
fFnDown = fKeyDown;
// Fn virtual key does not get sent to the system so
// do not increment cRmpKbdEvents.
DEBUGMSG(ZONE_DEVICELAYOUT, (_T("%s: Fn key is now %s\r\n"),
pszFname, (fFnDown ? _T("DOWN") : _T("UP"))));
}
else
{
// We have one key event
++cRmpKbdEvents;
if (fKeyDown)
{
// Handle key down
if (fFnDown)
{
// Fn key is on
if (IS_NUMLOCK_ON(pKbdEventCurr->KeyStateFlags))
{
pvkMap = FindRemappedKey(uiVkCurr, g_rgvkMapNumLock, dim(g_rgvkMapNumLock));
}
if (pvkMap == NULL)
{
// NumLock did not effect this key. See if the
// Fn key by itself does.
pvkMap = FindRemappedKey(uiVkCurr, g_rgvkMapFn, dim(g_rgvkMapFn));
}
}
}
else
{
// Handle key up
if (fFnDown)
{
// Fn key is on
if (IS_NUMLOCK_ON(pKbdEventCurr->KeyStateFlags))
{
pvkMap = FindRemappedKey(uiVkCurr, g_rgvkMapNumLock, dim(g_rgvkMapNumLock));
}
if (pvkMap == NULL)
{
// NumLock did not effect this key. See if the
// Fn key by itself does.
pvkMap = FindRemappedKey(uiVkCurr, g_rgvkMapFn, dim(g_rgvkMapFn));
}
}
}
if (pvkMap != NULL)
{
// This combination generates a different virtual key
if (pvkMap->uiVkGenerated == NULL)
{
DEBUGMSG(ZONE_ERROR, (_T("%s: pvkMap->uiVkGenerated error!\r\n"), pszFname));
}
pKbdEventRmpCurr->uiVk = pvkMap->uiVkGenerated;
}
}
}
return cRmpKbdEvents;
}
static DEVICE_LAYOUT dlMatrixEngUs =
{
sizeof(DEVICE_LAYOUT),
MATRIX_PDD,
rgscvkMatrixEngUSTables,
dim(rgscvkMatrixEngUSTables),
MatrixUsRemapVKey,
};
extern "C"
BOOL
Matrix(
PDEVICE_LAYOUT pDeviceLayout
)
{
SETFNAME(_T("Matrix"));
BOOL fRet = FALSE;
if (pDeviceLayout == NULL)
{
DEBUGMSG(ZONE_ERROR, (_T("%s: pDeviceLayout error!\r\n"), pszFname));
return FALSE;
}
if (pDeviceLayout->dwSize != sizeof(DEVICE_LAYOUT))
{
DEBUGMSG(ZONE_ERROR, (_T("Matrix: data structure size mismatch\r\n")));
goto leave;
}
// Make sure that the Sc->Vk tables are the sizes that we expect
if (dim(ScanCodeToVKeyTable) != (1 + ScanCodeTableLast - ScanCodeTableFirst))
{
DEBUGMSG(ZONE_ERROR, (_T("%s: ScanCodeToVKeyTable error!\r\n"), pszFname));
}
*pDeviceLayout = dlMatrixEngUs;
fRet = TRUE;
leave:
return fRet;
}
#ifdef DEBUG
// Verify function declaration against the typedef.
static PFN_DEVICE_LAYOUT_ENTRY v_pfnDeviceLayout = Matrix;
#endif
| [
"jhlee74@a3c55b0e-9d05-11de-8bf8-05dd22f30006"
]
| [
[
[
1,
763
]
]
]
|
a75c7d66be292ae710d2418e8238db3d0a2de240 | 9907be749dc7553f97c9e51c5f35e69f55bd02c0 | /FrameworkMenu/FrameworkMenu/text.cpp | 2d05eebc818037643bb195f9b30435178053a1d7 | []
| no_license | jdeering/csci476winthrop | bc8907b9cc0406826de76aca05e6758810377813 | 2bc485781f819c8fd82393ac86de33404e7ad6d3 | refs/heads/master | 2021-01-10T19:53:14.853438 | 2009-04-24T14:26:36 | 2009-04-24T14:26:36 | 32,223,762 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,179 | cpp | #include "text.h"
ISpVoice* Text::pVoice = NULL;
/******************************************************
Default Constructor
******************************************************/
Text::Text()
{
x = 0;
y = 0;
visible = false;
}
/******************************************************
Default Destructor
******************************************************/
Text::~Text()
{
if(pVoice)
{
pVoice->Release();
pVoice = NULL;
}
}
/******************************************************
Loads the values for the <code>Text</code> object
@param txt The std::string to be displayed and/or read for the text object
@param x_ The x coordinate of the text object
@param y_ The y coordinate of the text object
@param vis <code>true</code> if the text object should be visible, <code>false</code> otherwise
******************************************************/
void Text::LoadText(std::string txt, int x_, int y_, bool vis)
{
text = txt;
x = x_;
y = y_;
visible = vis;
}
/******************************************************
Reads the string parameter using Windows text-to-speech
@param stringToRead The string to be read via text-to-speech.
@param volume Volume value (0-100)
******************************************************/
void Text::ReadText(std::string stringToRead, unsigned short volume)
{
const std::wstring str(stringToRead.begin(), stringToRead.end());
HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice);
if( SUCCEEDED( hr ) )
{
hr = pVoice->SetRate(0);
hr = pVoice->SetVolume(volume);
hr = pVoice->Speak(str.c_str(), 0, NULL);
pVoice->Release();
pVoice = NULL;
}
}
/******************************************************
Sets the new position of the text on screen to (x,y)
@param x_ New x coordinate of the text position
@param y_ New y coordinate of the text position
******************************************************/
void Text::SetPosition(int x_, int y_)
{
x = x_;
y = y_;
}
/******************************************************
Changes the text std::string for the object to the specified
value.
@param txt The new <code>std::string</code> to associate with the object
******************************************************/
void Text::ChangeText(std::string txt)
{
text = txt;
}
/******************************************************
Displays the text on the specified BITMAP if it is
visible and reads the text if specified to do so.
@param read <code>true</code> if text-to-speech should be used, <code>false</code> otherwise
@param dest Allegro BITMAP on which to display the text
******************************************************/
void Text::ShowText(bool read, BITMAP *dest)
{
double multiplier = size / 8.0; // Regular font size is 8 pixels, set multiplier to scale up to size
BITMAP *tmp;
tmp = create_bitmap(text_length(font, text.c_str()), text_height(font));
if(!tmp)
{
allegro_message("Error creating font for text object.");
return;
}
clear_to_color(tmp, makecol(255, 0, 255));
textout_ex(tmp, font, text.c_str(), 0, 0, color, bg_color);
masked_stretch_blit(tmp, dest, 0, 0, tmp->w, tmp->h, x+XOFFSET, y, (int)(tmp->w * multiplier), (int)(tmp->h * multiplier));
destroy_bitmap(tmp);
}
/******************************************************
Changes the pixel size of the text object for display.
@param sz The pixel size for the text object.
******************************************************/
void Text::SetSize(int sz)
{
size = sz;
}
/******************************************************
Changes the foreground color of the text object for display.
@param r The amount of red (0-255) in the RGB color.
@param g The amount of green (0-255) in the RGB color.
@param b The amount of blue (0-255) in the RGB color.
******************************************************/
void Text::SetColor(int r, int g, int b)
{
// Maintain correct ranges
if(r < 0) r = 0;
if(g < 0) g = 0;
if(b < 0) b = 0;
if(r > 255) r = 255;
if(g > 255) g = 255;
if(b > 255) b = 255;
color = makecol(r, g, b);
}
/******************************************************
Changes the background color of the text object for display.
@param r The amount of red (0-255) in the RGB color.
@param g The amount of green (0-255) in the RGB color.
@param b The amount of blue (0-255) in the RGB color.
******************************************************/
void Text::SetBackgroundColor(int r, int g, int b)
{
// Maintain correct ranges
if(r < 0) r = 0;
if(g < 0) g = 0;
if(b < 0) b = 0;
if(r > 255) r = 255;
if(g > 255) g = 255;
if(b > 255) b = 255;
bg_color = makecol(r, g, b);
}
/******************************************************
Changes the visibility of the text object.
@param vis The new visibilty. 0 for invisible, non-zero for visible.
******************************************************/
void Text::SetVisible(int vis)
{
if(vis == 0)
visible = false;
else
visible = true;
} | [
"deeringj2@2656ef14-ecf4-11dd-8fb1-9960f2a117f8"
]
| [
[
[
1,
176
]
]
]
|
8094d307efd4e276c2634cf33ea28b9ef42fff6d | b73f27ba54ad98fa4314a79f2afbaee638cf13f0 | /driver/drivertest/DriverMngr.h | a70f4fe32df1afb78f9b870022ab5f2bf8df5050 | []
| no_license | weimingtom/httpcontentparser | 4d5ed678f2b38812e05328b01bc6b0c161690991 | 54554f163b16a7c56e8350a148b1bd29461300a0 | refs/heads/master | 2021-01-09T21:58:30.326476 | 2009-09-23T08:05:31 | 2009-09-23T08:05:31 | 48,733,304 | 3 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,401 | h | #ifndef _APPCONTROLLER_H__
#define _APPCONTROLLER_H__
#include <string>
#include <driver_const.h>
class CheckProcessCreate {
public:
virtual bool enable_process_create(const char * process_path_name) = 0;
};
class AppController {
class ExchangeBuffer;
public:
AppController(CheckProcessCreate * checker) ;
~AppController();
// 安装驱动
public:
int begin();
int end();
protected:
int InstallDriver();
int UninstallDriver();
int InstallService();
int DeleteService();
public:
int checkpassed(const char * filename);
int checkpassed();
// 是否退出线程
bool exitThread() const { return exit_thread_;}
ExchangeBuffer * get_exchange_buffer() {
return &exchange_buffer_;
}
private:
HANDLE m_hDevice;
DWORD dwThreadId;
friend DWORD CALLBACK CheckAppProc(LPVOID param);
volatile int exit_thread_;
CheckProcessCreate * checker_;
// 控制交换缓冲区
class ExchangeBuffer {
public:
ExchangeBuffer();
bool need_check();
std::string get_filepath() ;
void set_check_result(const bool passed);
char * get_buffer_addr() {
return exchange_buffer;
}
void reset_status();
private:
char exchange_buffer[EXCHANGE_BUFFER_SIZE];
};
ExchangeBuffer exchange_buffer_;
protected:
AppController();
AppController(const AppController &);
};
#endif // _APPCONTROLLER_H__
| [
"[email protected]"
]
| [
[
[
1,
75
]
]
]
|
0446076f8850b065c5dd305e7ee46269af7b19ab | 610590a1925a6f9d185d4a562b5736438689318b | /JHLIB/AccountCrypter.cpp | 694c48ee4a83fab60e519b82045dc62c446e6cdb | []
| no_license | ltsochev-dev/tabula-rasa-server-emulator | 47a46ed296215c978044d2816d63bd9148943561 | 50c7b4ebce644d3b7ab7b9012b3fe5e975a0409b | refs/heads/master | 2021-05-28T10:51:32.729642 | 2011-05-21T11:49:07 | 2011-05-21T11:49:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 18,371 | cpp | #include<Windows.h>
#include<stdio.h>
//#include "AccountHasherArray.h"
#include "AccountCrypter.h"
unsigned char DecArray1[0x38] =
{
0x39,0x31,0x29,0x21,0x19,0x11,0x09,0x01,0x3A,0x32,0x2A,0x22,0x1A,0x12,0x0A,0x02,
0x3B,0x33,0x2B,0x23,0x1B,0x13,0x0B,0x03,0x3C,0x34,0x2C,0x24,0x3F,0x37,0x2F,0x27,
0x1F,0x17,0x0F,0x07,0x3E,0x36,0x2E,0x26,0x1E,0x16,0x0E,0x06,0x3D,0x35,0x2D,0x25,
0x1D,0x15,0x0D,0x05,0x1C,0x14,0x0C,0x04
};
unsigned char DecArray2_CEA3D0[0x10] =
{
0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01
};
unsigned char DecArray3[0x10] =
{
0x01,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x0F,0x11,0x13,0x15,0x17,0x19,0x1B,0x1C
};
unsigned char DecArray4_CEA180[48] =
{
0x0E,0x11,0x0B,0x18,0x01,0x05,0x03,0x1C,0x0F,0x06,0x15,0x0A,0x17,0x13,0x0C,0x04,0x1A,0x08,0x10,0x07,0x1B,0x14,0x0D,0x02,0x29,0x34,0x1F,0x25,0x2F,0x37,0x1E,0x28,0x33,0x2D,0x21,0x30,0x2C,0x31,0x27,0x38,0x22,0x35,0x2E,0x2A,0x32,0x24,0x1D,0x20
};
unsigned char DecArray5_CEA3B0[32] =
{
0x10,0x07,0x14,0x15,0x1D,0x0C,0x1C,0x11,0x01,0x0F,0x17,0x1A,0x05,0x12,0x1F,0x0A,0x02,0x08,0x18,0x0E,0x20,0x1B,0x03,0x09,0x13,0x0D,0x1E,0x06,0x16,0x0B,0x04,0x19
};
unsigned int DecArray6_CEA3F0[4] =
{
8,4,2,1
};
struct _DecStruct1T
{
unsigned char D1[6];
};
struct _DecStruct2T
{
unsigned char D1[64];
};
struct _DecStruct3T
{
unsigned char D1[1024];
};
unsigned char CEA1B0_DATA[16*64] =
{
0x0E,0x04,0x0D,0x01,0x02,0x0F,0x0B,0x08,0x03,0x0A,0x06,0x0C,0x05,0x09,0x00,0x07,0x00,0x0F,0x07,0x04,0x0E,0x02,0x0D,0x01,0x0A,0x06,0x0C,0x0B,0x09,0x05,0x03,0x08,0x04,0x01,0x0E,0x08,0x0D,0x06,0x02,0x0B,0x0F,0x0C,0x09,0x07,0x03,0x0A,0x05,0x00,0x0F,0x0C,0x08,0x02,0x04,0x09,0x01,0x07,0x05,0x0B,0x03,0x0E,0x0A,0x00,0x06,0x0D,0x0F,0x01,0x08,0x0E,0x06,0x0B,0x03,0x04,0x09,0x07,0x02,0x0D,0x0C,0x00,0x05,0x0A,0x03,0x0D,0x04,0x07,0x0F,0x02,0x08,0x0E,0x0C,0x00,0x01,0x0A,0x06,0x09,0x0B,0x05,0x00,0x0E,0x07,0x0B,0x0A,0x04,0x0D,0x01,0x05,0x08,0x0C,0x06,0x09,0x03,0x02,0x0F,0x0D,0x08,0x0A,0x01,0x03,0x0F,0x04,0x02,0x0B,0x06,0x07,0x0C,0x00,0x05,0x0E,0x09,0x0A,0x00,0x09,0x0E,0x06,0x03,0x0F,0x05,0x01,0x0D,0x0C,0x07,0x0B,0x04,0x02,0x08,0x0D,0x07,0x00,0x09,0x03,0x04,0x06,0x0A,0x02,0x08,0x05,0x0E,0x0C,0x0B,0x0F,0x01,0x0D,0x06,0x04,0x09,0x08,0x0F,0x03,0x00,0x0B,0x01,0x02,0x0C,0x05,0x0A,0x0E,0x07,0x01,0x0A,0x0D,0x00,0x06,0x09,0x08,0x07,0x04,0x0F,0x0E,0x03,0x0B,0x05,0x02,0x0C,0x07,0x0D,0x0E,0x03,0x00,0x06,0x09,0x0A,0x01,0x02,0x08,0x05,0x0B,0x0C,0x04,0x0F,0x0D,0x08,0x0B,0x05,0x06,0x0F,0x00,0x03,0x04,0x07,0x02,0x0C,0x01,0x0A,0x0E,0x09,0x0A,0x06,0x09,0x00,0x0C,0x0B,0x07,0x0D,0x0F,0x01,0x03,0x0E,0x05,0x02,0x08,0x04,0x03,0x0F,0x00,0x06,0x0A,0x01,0x0D,0x08,0x09,0x04,0x05,0x0B,0x0C,0x07,0x02,0x0E,0x02,0x0C,0x04,0x01,0x07,0x0A,0x0B,0x06,0x08,0x05,0x03,0x0F,0x0D,0x00,0x0E,0x09,0x0E,0x0B,0x02,0x0C,0x04,0x07,0x0D,0x01,0x05,0x00,0x0F,0x0A,0x03,0x09,0x08,0x06,0x04,0x02,0x01,0x0B,0x0A,0x0D,0x07,0x08,0x0F,0x09,0x0C,0x05,0x06,0x03,0x00,0x0E,0x0B,0x08,0x0C,0x07,0x01,0x0E,0x02,0x0D,0x06,0x0F,0x00,0x09,0x0A,0x04,0x05,0x03,0x0C,0x01,0x0A,0x0F,0x09,0x02,0x06,0x08,0x00,0x0D,0x03,0x04,0x0E,0x07,0x05,0x0B,0x0A,0x0F,0x04,0x02,0x07,0x0C,0x09,0x05,0x06,0x01,0x0D,0x0E,0x00,0x0B,0x03,0x08,0x09,0x0E,0x0F,0x05,0x02,0x08,0x0C,0x03,0x07,0x00,0x04,0x0A,0x01,0x0D,0x0B,0x06,0x04,0x03,0x02,0x0C,0x09,0x05,0x0F,0x0A,0x0B,0x0E,0x01,0x07,0x06,0x00,0x08,0x0D,0x04,0x0B,0x02,0x0E,0x0F,0x00,0x08,0x0D,0x03,0x0C,0x09,0x07,0x05,0x0A,0x06,0x01,0x0D,0x00,0x0B,0x07,0x04,0x09,0x01,0x0A,0x0E,0x03,0x05,0x0C,0x02,0x0F,0x08,0x06,0x01,0x04,0x0B,0x0D,0x0C,0x03,0x07,0x0E,0x0A,0x0F,0x06,0x08,0x00,0x05,0x09,0x02,0x06,0x0B,0x0D,0x08,0x01,0x04,0x0A,0x07,0x09,0x05,0x00,0x0F,0x0E,0x02,0x03,0x0C,0x0D,0x02,0x08,0x04,0x06,0x0F,0x0B,0x01,0x0A,0x09,0x03,0x0E,0x05,0x00,0x0C,0x07,0x01,0x0F,0x0D,0x08,0x0A,0x03,0x07,0x04,0x0C,0x05,0x06,0x0B,0x00,0x0E,0x09,0x02,0x07,0x0B,0x04,0x01,0x09,0x0C,0x0E,0x02,0x00,0x06,0x0A,0x0D,0x0F,0x03,0x05,0x08,0x02,0x01,0x0E,0x07,0x04,0x0A,0x08,0x0D,0x0F,0x0C,0x09,0x00,0x03,0x05,0x06,0x0B
};
struct _DecStruct1T DecStruct1[16];
struct _DecStruct2T *DecStruct2_CEA1B0 = (struct _DecStruct2T*)CEA1B0_DATA;//[16];
struct _DecStruct3T DecStruct3_D1D4B0[4];
unsigned char DecArrayOut1_D23548[0x38];
unsigned char DecArrayOut2_D1E4B0[0x38]; //Only written D1E4B0
unsigned char DecArrayOut3_D1ECE8[4096*4]; //This is huge and important
unsigned char InputData_0CEA0B8[0x40] =
{
0x3A,0x32,0x2A,0x22,0x1A,0x12,0x0A,0x02,0x3C,0x34,0x2C,0x24,0x1C,0x14,0x0C,0x04,0x3E,0x36,0x2E,0x26,0x1E,0x16,0x0E,0x06,0x40,0x38,0x30,0x28,0x20,0x18,0x10,0x08,
0x39,0x31,0x29,0x21,0x19,0x11,0x09,0x01,0x3B,0x33,0x2B,0x23,0x1B,0x13,0x0B,0x03,0x3D,0x35,0x2D,0x25,0x1D,0x15,0x0D,0x05,0x3F,0x37,0x2F,0x27,0x1F,0x17,0x0F,0x07
};
unsigned char InputData_0CEA0F8[0x40] =
{
0x28,0x08,0x30,0x10,0x38,0x18,0x40,0x20,0x27,0x07,0x2F,0x0F,0x37,0x17,0x3F,0x1F,0x26,0x06,0x2E,0x0E,0x36,0x16,0x3E,0x1E,0x25,0x05,0x2D,0x0D,0x35,0x15,0x3D,0x1D,
0x24,0x04,0x2C,0x0C,0x34,0x14,0x3C,0x1C,0x23,0x03,0x2B,0x0B,0x33,0x13,0x3B,0x1B,0x22,0x02,0x2A,0x0A,0x32,0x12,0x3A,0x1A,0x21,0x01,0x29,0x09,0x31,0x11,0x39,0x19
};
unsigned char OutputData_D1E4E8[128*16];
unsigned char OutputData_D22D48[128*16];
int __cdecl CryptInit_PrepareBasic(unsigned __int8 *Output, unsigned __int8 *Input)
{
int result; // eax@9
signed int v3; // [sp+14h] [bp-4h]@1
signed int v4; // [sp+4h] [bp-14h]@3
signed int v5; // [sp+10h] [bp-8h]@5
signed int v6; // [sp+Ch] [bp-Ch]@17
int v7; // [sp+8h] [bp-10h]@21
v3 = 0;
while ( v3 < 16 )
{
v4 = 0;
while ( v4 < 16 )
{
v5 = 0;
while ( v5 < 8 )
*(&Output[128 * v3] + 8 * v4 + v5++) = 0;
++v4;
}
result = v3++ + 1;
}
v3 = 0;
while ( v3 < 16 )
{
v4 = 0;
while ( v4 < 16 )
{
v5 = 0;
while ( v5 < 64 )
{
v6 = Input[v5] - 1;
if ( v6 >> 2 == v3 )
{
if ( DecArray6_CEA3F0[v6 & 3] & v4 )
{
v7 = v5 & 7;
*(&Output[128 * v3] + 8 * v4 + (v5 >> 3)) |= (unsigned char)(DecArray2_CEA3D0[v5 & 7]);
}
}
++v5;
}
result = v4++ + 1;
}
++v3;
}
return result;
}
void __cdecl CryptInit_Keyintegrate(unsigned char *Key) //sub_A7D2D0
{
// fsdf optimize this!
int result; // eax@3
int v2; // [sp+4h] [bp-10h]@1
int v3; // [sp+Ch] [bp-8h]@3
int v4; // [sp+8h] [bp-Ch]@3
int v6; // [sp+0h] [bp-14h]@15
v2 = 0;
for(int i=0; i<56; i++)//while ( v2 < 56 )
{
v3 = DecArray1[i] - 1;
v4 = v3 & 7;
DecArrayOut1_D23548[i] = (DecArray2_CEA3D0[v3 & 7] & Key[v3 >> 3]) != 0;
//result = v2++ + 1;
}
for(int i=0; i<16; i++)
memset((void*)&DecStruct1[i], 0x00, sizeof(struct _DecStruct1T));
for(int i=0; i<16; i++)//while ( v5 < 16 )
{
for(int i2=0; i2<56; i2++)//while ( v2 < 56 )
{
v3 = i2 + DecArray3[i];
if ( v3 >= (((i2 >= 28) - 1) & 0xFFFFFFE4) + 56 )
v6 = v3 - 28;
else
v6 = v3;
result = v6;
DecArrayOut2_D1E4B0[i2] = DecArrayOut1_D23548[v6];//byte_D23548[v6];
}
for(int i2=0; i2<48; i2++)//while ( v2 < 48 )
{
//result = v2;
if( DecArray4_CEA180[i2] == 0 )
__debugbreak(); //Should not happen
if ( DecArrayOut2_D1E4B0[DecArray4_CEA180[i2]-1] )
DecStruct1[i].D1[i2>>3] += DecArray2_CEA3D0[i2 & 7];
}
}
}
/*** SUB ******/
int __cdecl sub_A7D470(int a1, int a2)
{
int v3; // [sp+4h] [bp-4h]@1
int v4; // [sp+0h] [bp-8h]@1
v3 = a2 & 1 | ((a2 & 0x20) >> 4);
v4 = (a2 & 0x1F) >> 1;
return DecStruct2_CEA1B0[a1].D1[16 * (a2 & 1 | ((a2 & 0x20) >> 4)) + ((a2 & 0x1F) >> 1)];//*(&DecStruct2_CEA1B0[64 * a1] + 16 * (a2 & 1 | ((a2 & 0x20) >> 4)) + ((a2 & 0x1F) >> 1));
}
void __cdecl CryptInit_Keyintegrate_Part2()
{
int v0; // ebx@5
signed int v1; // [sp+8h] [bp-4h]@1
signed int v2; // [sp+4h] [bp-8h]@3
v1 = 0;
while ( v1 < 4 )
{
v2 = 0;
while ( v2 < 4096 )
{
v0 = 16 * sub_A7D470(2 * v1, v2 >> 6);
DecArrayOut3_D1ECE8[4096 * v1 + v2] = sub_A7D470(2 * v1 + 1, v2 & 0x3F) & 0xF | (unsigned char)v0;
//*(&byte_D1ECE8[4096 * v1] + v2) = sub_A7D470(2 * v1 + 1, v2 & 0x3F) & 0xF | (_BYTE)v0;
++v2;
}
++v1;
}
}
int __cdecl CryptInit_Keyintegrate_Part3() //A7D180
{
int result; // eax@9
signed int v1; // [sp+14h] [bp-4h]@1
signed int v2; // [sp+4h] [bp-14h]@3
signed int v3; // [sp+10h] [bp-8h]@5
signed int v4; // [sp+Ch] [bp-Ch]@17
int v5; // [sp+8h] [bp-10h]@21
v1 = 0;
while ( v1 < 4 )
{
v2 = 0;
while ( v2 < 256 )
{
v3 = 0;
while ( v3 < 4 )
DecStruct3_D1D4B0[v1].D1[4 * v2 + v3++] = 0;//*((_BYTE *)&stru_D1D4B0[256 * v1] + 4 * v2 + v3++) = 0;
++v2;
}
result = v1++ + 1;
}
v1 = 0;
while ( v1 < 4 )
{
v2 = 0;
while ( v2 < 256 )
{
v3 = 0;
while ( v3 < 32 )
{
v4 = DecArray5_CEA3B0[v3] - 1;
if ( v4 >> 3 == v1 )
{
if ( DecArray2_CEA3D0[v4 & 7] & v2 )
{
v5 = v3 & 7;
DecStruct3_D1D4B0[v1].D1[4 * v2 + (v3 >> 3)] |= (unsigned char)(DecArray2_CEA3D0[v3 & 7]);
//*((_BYTE *)&stru_D1D4B0[256 * v1] + 4 * v2 + (v3 >> 3)) |= (unsigned char)(DecArray2_CEA3D0[v3 & 7]);
}
}
++v3;
}
result = v2++ + 1;
}
++v1;
}
return result;
}
/***************************** Encoding *************************/
int __cdecl sub_A7D8D0_3(unsigned __int8 *DataP, unsigned __int8 *B_, unsigned __int8 *Out)
{
int result; // eax@1
signed int v4; // [sp+Ch] [bp-Ch]@1
unsigned __int8 *v5; // [sp+8h] [bp-10h]@1
unsigned __int8 *v6; // [sp+10h] [bp-8h]@4
signed int v7; // [sp+0h] [bp-18h]@4
unsigned __int8 *v8; // [sp+14h] [bp-4h]@6
unsigned __int8 *v9; // [sp+4h] [bp-14h]@6
v4 = 0;
result = (int)Out;
v5 = Out;
while ( v4 < 8 )
{
*v5 = 0;
result = (int)(v5++ + 1);
++v4;
}
v6 = DataP;
v7 = 0;
while ( v7 < 16 )
{
v5 = Out;
v8 = &B_[128 * v7] + 8 * (((signed int)*v6 >> 4) & 0xF);
v9 = &B_[128 * (v7 + 1)] + 8 * (*v6 & 0xF);
v4 = 0;
while ( v4 < 8 )
{
*v5++ |= *v9++ | *v8++;
++v4;
}
v7 += 2;
result = (int)(v6++ + 1);
}
return result;
}
int __cdecl sub_A7D790(unsigned __int8 *a1, unsigned __int8 *a2)
{
int result; // eax@1
unsigned __int8 *v3; // [sp+8h] [bp-8h]@1
unsigned __int8 *v4; // [sp+Ch] [bp-4h]@1
signed int v5; // [sp+0h] [bp-10h]@1
unsigned __int8 *v6; // [sp+4h] [bp-Ch]@3
v3 = a2;
*a2 = 0;
++v3;
*v3++ = 0;
*v3++ = 0;
*v3 = 0;
result = (int)a1;
v4 = a1;
v5 = 0;
while ( v5 < 4 )
{
v6 = &DecStruct3_D1D4B0[v5].D1[4 * *v4];//(unsigned __int8 *)((char *)&stru_D1D4B0[1024 * v5] + 4 * *v4);
v3 = a2;
*a2 |= *v6++;
++v3;
*v3++ |= *v6++;
*v3++ |= *v6++;
result = (int)v3;
*v3 |= *v6;
++v5;
++v4;
}
return result;
}
int __cdecl sub_A7D4B0(unsigned __int8 *a1, unsigned __int8 *a2)
{
unsigned __int8 *v3; // [sp+1Ch] [bp-4h]@1
int v4; // [sp+10h] [bp-10h]@1
unsigned int v5; // [sp+18h] [bp-8h]@1
int v6; // [sp+0h] [bp-20h]@1
int v7; // [sp+Ch] [bp-14h]@1
unsigned int v8; // [sp+8h] [bp-18h]@1
int v9; // [sp+14h] [bp-Ch]@1
unsigned __int8 *v10; // [sp+4h] [bp-1Ch]@1
v3 = a1;
v4 = *a1;
v3 = a1 + 1;
v5 = *(a1 + 1);
v3 = a1 + 2;
v6 = *(a1 + 2);
v3 = a1 + 3;
v7 = *(a1 + 3);
v3 = a1 + 4;
v8 = *(a1 + 4);
v3 = a1 + 5;
v9 = *(a1 + 5);
v3 = a1 + 6;
v10 = a2;
*a2 = DecArrayOut3_D1ECE8[(((unsigned int)v5 >> 4) & 0xF | (unsigned __int16)(16 * (unsigned short)v4)) & 0xFFF];
++v10;
*v10++ = DecArrayOut3_D1ECE8[0x1000 + (((unsigned __int8)v6 | (unsigned __int16)((unsigned short)v5 << 8)) & 0xFFF)];
*v10++ = DecArrayOut3_D1ECE8[0x2000 + ((((unsigned int)v8 >> 4) & 0xF | (unsigned __int16)(16 * (unsigned short)v7)) & 0xFFF)];
*v10 =DecArrayOut3_D1ECE8[0x3000 + (((unsigned __int8)v9 | (unsigned __int16)((unsigned short)v8 << 8)) & 0xFFF)];
return (int)(v10 + 1);
}
int __cdecl sub_A7D5E0_5(unsigned __int8 *p1, unsigned __int8 *p2)
{
unsigned __int8 *v3; // [sp+Ch] [bp-8h]@1
unsigned __int8 *v4; // [sp+4h] [bp-10h]@1
unsigned __int8 v5; // [sp+Bh] [bp-9h]@1
unsigned __int8 v6; // [sp+13h] [bp-1h]@1
unsigned __int8 v7; // [sp+12h] [bp-2h]@1
unsigned __int8 v8; // [sp+3h] [bp-11h]@1
v3 = p2;
v4 = p1;
v5 = *p1;
v4 = p1 + 1;
v6 = *(p1 + 1);
v4 = p1 + 2;
v7 = *(p1 + 2);
v4 = p1 + 3;
v8 = *(p1 + 3);
*v3++ = (unsigned __int8)((v5 & 0x18) >> 3) | (unsigned __int8)((unsigned __int8)((v5 & 0xF8) >> 1) | (unsigned __int8)((v8 & 1) << 7));
*v3++ = (unsigned __int8)((v6 & 0xE0) >> 5) | (unsigned __int8)((unsigned __int8)(8 * (v5 & 1)) | (unsigned __int8)((unsigned __int8)((v6 & 0x80) >> 3) | (unsigned __int8)(32 * (v5 & 7))));
*v3++ = (unsigned __int8)((v7 & 0x80) >> 7) | (unsigned __int8)((unsigned __int8)(2 * (v6 & 0x1F)) | (unsigned __int8)(8 * (v6 & 0x18)));
*v3++ = (unsigned __int8)((v7 & 0x18) >> 3) | (unsigned __int8)((unsigned __int8)((v7 & 0xF8) >> 1) | (unsigned __int8)((v6 & 1) << 7));
*v3++ = (unsigned __int8)((v8 & 0xE0) >> 5) | (unsigned __int8)((unsigned __int8)(8 * (v7 & 1)) | (unsigned __int8)((unsigned __int8)((v8 & 0x80) >> 3) | (unsigned __int8)(32 * (v7 & 7))));
*v3 = (unsigned __int8)((v5 & 0x80) >> 7) | (unsigned __int8)((unsigned __int8)(2 * (v8 & 0x1F)) | (unsigned __int8)(8 * (v8 & 0x18)));
return (int)(v3 + 1);
}
int __cdecl sub_A7DA60_4(unsigned __int8 *d, int idx, unsigned __int8 *a3)
{
unsigned __int8 *v4; // [sp+Ch] [bp-14h]@1
unsigned __int8 v5[6]; // [sp+18h] [bp-8h]@1
unsigned __int8 *p2; // [sp+14h] [bp-Ch]@1
unsigned __int8 a1[6]; // [sp+0h] [bp-20h]@1
unsigned __int8 *v8; // [sp+8h] [bp-18h]@1
unsigned __int8 a2[4]; // [sp+10h] [bp-10h]@1
v4 = &DecStruct1[idx].D1[0];//(unsigned __int8 *)&stru_D22CE8[6 * idx];
p2 = v5;
v8 = a1;
sub_A7D5E0_5(d, v5);
*v8++ = *v4++ ^ *p2++;
*v8++ = *v4++ ^ *p2++;
*v8++ = *v4++ ^ *p2++;
*v8++ = *v4++ ^ *p2++;
*v8++ = *v4++ ^ *p2++;
*v8++ = *v4++ ^ *p2++;
sub_A7D4B0(a1, (unsigned __int8 *)a2); //Correct
return sub_A7D790((unsigned __int8 *)a2, a3);
}
int __cdecl sub_A7DC90_3(int idx, unsigned char *m, unsigned char *m2)
{
unsigned __int8 *v4; // [sp+0h] [bp-10h]@1
unsigned __int8 *v5; // [sp+8h] [bp-8h]@1
unsigned char v6[6]; // [sp+4h] [bp-Ch]@1 - maybe too big but thats no problem - only 4 byte size
v4 = m2;
v5 = m + 4;
sub_A7DA60_4(m + 4, idx, v6); //Correct
*v4++ = *v5++;
*v4++ = *v5++;
*v4++ = *v5++;
*v4++ = *v5;
//Correct till here
m2[4] = m[0] ^ v6[0];
m2[5] = m[1] ^ v6[1];
m2[6] = m[2] ^ v6[2];
m2[7] = m[3] ^ v6[3];
/*v5 = m;
v7 = v6;
*v4++ = *v7++ ^ *m;
++v7;
++v5;
*v4++ = *v7++ ^ *v5++;
*v4++ = *v7++ ^ *v5++;
*v4 = *v7 ^ *v5;*/
return (int)(v4 + 1);
}
unsigned int __cdecl sub_A7DE00_2(unsigned char *DataP1, unsigned char *DataP2) //Decrypt
{
unsigned int v4; // [sp+98h] [bp-4h]@1
unsigned char v5[128+8]; // [sp+14h] [bp-88h]@3
unsigned char v7[8];
sub_A7D8D0_3(DataP1, OutputData_D22D48, v5);
v4 = 0;
while ( v4 < 16 )
{
sub_A7DC90_3(15 - v4, &v5[8 * v4], &v5[8 * v4 + 8]);
++v4;
}
v7[0] = v5[0x84];
v7[1] = v5[0x85];
v7[2] = v5[0x86];
v7[3] = v5[0x87];
v7[4] = v5[0x80];
v7[5] = v5[0x81];
v7[6] = v5[0x82];
v7[7] = v5[0x83];
return sub_A7D8D0_3(v7, OutputData_D1E4E8, DataP2);
}
int __cdecl sub_A7DFD0(unsigned __int8 *a1, unsigned __int8 *a2) //Encrypt
{
unsigned char M2[128 + 8];
//unsigned char Out[8]; // [sp+Ch] [bp-90h]@1
int idx; // [sp+98h] [bp-4h]@1
//unsigned char m2[128]; // [sp+14h] [bp-88h]@3
/*char v6; // [sp+90h] [bp-Ch]@4
char v7; // [sp+0h] [bp-9Ch]@4
char v8; // [sp+91h] [bp-Bh]@4
char v9; // [sp+1h] [bp-9Bh]@4
char v10; // [sp+92h] [bp-Ah]@4
char v11; // [sp+2h] [bp-9Ah]@4
char v12; // [sp+93h] [bp-9h]@4
char v13; // [sp+3h] [bp-99h]@4
char v14; // [sp+8Ch] [bp-10h]@4
char v15; // [sp+4h] [bp-98h]@4
char v16; // [sp+8Dh] [bp-Fh]@4
char v17; // [sp+5h] [bp-97h]@4
char v18; // [sp+8Eh] [bp-Eh]@4
char v19; // [sp+6h] [bp-96h]@4
char v20; // [sp+8Fh] [bp-Dh]@4
char v21; // [sp+7h] [bp-95h]@4
char *v22; // [sp+8h] [bp-94h]@4
char **v23; // [sp+94h] [bp-8h]@4
*/
unsigned char v7[8];
sub_A7D8D0_3(a1, OutputData_D22D48, M2); //DataPointer, Magic, 8-BYTE-UNITILIZED-ARRAY
idx = 0;
while ( idx < 16 )
{
sub_A7DC90_3(idx, &M2[8 * idx], &M2[8 * idx + 8]); //IDX, 8-Array-P, 8-Array-P - Seems correct
++idx;
}
v7[0] = M2[0x84];
v7[1] = M2[0x85];
v7[2] = M2[0x86];
v7[3] = M2[0x87];
v7[4] = M2[0x80];
v7[5] = M2[0x81];
v7[6] = M2[0x82];
v7[7] = M2[0x83];
return sub_A7D8D0_3(v7, OutputData_D1E4E8, a2);
}
int __cdecl sub_A7E190_1(unsigned __int8 *Data, int Len, int State)
{
int result; // eax@1
unsigned __int8 *DataP; // [sp+0h] [bp-4h]@1
result = (int)Data;
DataP = Data;
while ( Len > 0 )
{
if ( State )
result = sub_A7DFD0(DataP, DataP);
else
result = sub_A7DE00_2(DataP, DataP);//sub_A7DE00(DataP, DataP);
Len -= 8;
DataP += 8;
}
return result;
}
extern void __cdecl Tabula_CryptInit()
{
//Init base arrays
CryptInit_PrepareBasic(OutputData_D22D48, InputData_0CEA0B8);
CryptInit_PrepareBasic(OutputData_D1E4E8, InputData_0CEA0F8);
//We have the super secure key hardcoded
unsigned char Key64[8] = {'T','E','S','T',0,0,0,0};
CryptInit_Keyintegrate(Key64); //Seems to work fully!
CryptInit_Keyintegrate_Part2(); //Also correct
CryptInit_Keyintegrate_Part3(); //Also correct
}
extern void __cdecl Tabula_Encrypt(unsigned char *Data, unsigned int Len)
{
Len &= ~7; //Round down to 8 byte alignment
sub_A7E190_1(Data, Len, 1);
}
extern void __cdecl Tabula_Decrypt(unsigned char *Data, unsigned int Len)
{
Len &= ~7; //Round down to 8 byte alignment
sub_A7E190_1(Data, Len, 0);
} | [
"[email protected]@d6b412fb-78a4-b329-1f31-49661cb3b798"
]
| [
[
[
1,
574
]
]
]
|
744caf84f9fee90c939f1ee8eb2a1725506b5ce0 | 72a68ce49feae720df8440a87f2c0abb890fd826 | /src/BookMemo.cpp | bf13a08f1fff795cc7f5479a68fb41015266331b | []
| no_license | maconel/simplereader | e70c15ab2f62b3f1dc392ff0d2b777d1bcda4df6 | a22516a833d75153eb312b580d0702b43fa03066 | refs/heads/master | 2021-01-10T21:16:03.600270 | 2010-06-30T06:57:16 | 2010-06-30T06:57:16 | 32,499,515 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 2,644 | cpp |
#include "StdAfx.h"
#include "BookMemo.h"
#include "global.h"
CBookMemo::CBookMemo()
{
iFile = NULL;
iOffset = 0;
}
CBookMemo::~CBookMemo()
{
CloseFile();
}
void CBookMemo::SetFilename(LPCTSTR aFilename)
{
//加上.mem扩展名换成。
iFilename = aFilename;
iFilename = iFilename + _T(".mem");
//载入内容。
if (!Load())
{
iOffset = 0;
}
}
unsigned int CBookMemo::GetOffset()
{
return iOffset;
}
void CBookMemo::SetOffset(unsigned int aOffset)
{
iOffset = aOffset;
Save();
}
bool CBookMemo::Load()
{
//打开文件。
if (!OpenFile(_T("rb")))
return false;
//头。
CMzStringW head;
if (!LoadStr(iFile, head))
return false;
if (head.Compare(BOOKMEMO_HEAD) != 0)
return false;
//版本号。
int version = 0;
if (!LoadInt(iFile, version))
return false;
if (version != BOOKMEMO_VERSION)
return false;
//memo.
switch (version)
{
case 0:
if (!LoadMemoV0(iFile))
return false;
break;
default:
return false;
}
//关闭文件。
CloseFile();
return true;
}
bool CBookMemo::Save()
{
//打开文件。
if (!OpenFile(_T("wb")))
return false;
//头。
if (!SaveStr(iFile, BOOKMEMO_HEAD))
return false;
//版本号。
if (!SaveInt(iFile, BOOKMEMO_VERSION))
return false;
//memo.
if (!SaveMemo(iFile))
return false;
//关闭文件。
CloseFile();
return true;
}
bool CBookMemo::OpenFile(LPCTSTR aMode)
{
CloseFile();
iFile = _tfopen(iFilename, aMode);
return (iFile != NULL);
}
void CBookMemo::CloseFile()
{
if (iFile != NULL)
{
fclose(iFile);
iFile = NULL;
}
}
bool CBookMemo::SaveInt(FILE* aFile, int aValue)
{
return (1 == fwrite(&aValue, sizeof(int), 1, aFile));
}
bool CBookMemo::SaveStr(FILE* aFile, LPCTSTR aValue)
{
bool ret = false;
int len = _tcslen(aValue);
if (SaveInt(aFile, len))
ret = (len == fwrite(aValue, sizeof(TCHAR), len, aFile));
return ret;
}
bool CBookMemo::LoadInt(FILE* aFile, int& aValue)
{
int ret = 0;
return (1 == fread(&aValue, sizeof(int), 1, aFile));
}
bool CBookMemo::LoadStr(FILE* aFile, CMzStringW& aValue)
{
bool ret = false;
int len = 0;
if (LoadInt(aFile, len))
{
aValue.SetBufferSize(len);
ret = (len == fread(aValue, sizeof(TCHAR), len, aFile));
}
return ret;
}
bool CBookMemo::LoadMemoV0(FILE* aFile)
{
//offset.
if (!LoadInt(aFile, (int&)iOffset))
return false;
return true;
}
bool CBookMemo::SaveMemo(FILE* aFile)
{
//offset.
if (!SaveInt(aFile, iOffset))
return false;
return true;
}
| [
"lenocam@a666e572-7c07-11de-a7be-13e53affbef8"
]
| [
[
[
1,
174
]
]
]
|
4f7b0a3dcac822bc7a974d6c53b3cf5a9100ad41 | bfdfb7c406c318c877b7cbc43bc2dfd925185e50 | /compiler/test/tester.cpp | 92d9794e7d588f77ad45288ccab06864c655e149 | [
"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 | 2,816 | cpp | /* -*- coding: sjis-dos; -*- */
/*
* copyright 2010 FUKUZAWA Tadashi. All rights reserved.
*/
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/CompilerOutputter.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <stdarg.h>
#include "hyCCompiler.h"
#include "hyCStrTable.h"
#include "hyCFfiType.h"
// hmd_loadFile_inPathで使うロードパス定義
const char* m_HMD_LOADPATH[] = {
#ifndef WIN32
"out",
"../../stdlib/out",
NULL
#else
"out",
"..\\..\\stdlib\\out",
NULL
#endif
};
const char** HMD_LOADPATH = m_HMD_LOADPATH;
const char* gFfiDir;
const char* gFfiOutDir;
Hayat::Compiler::SymbolTable Hayat::Compiler::gLocalVarSymbols;
namespace Houken {
class SyntaxTree;
}
namespace Hayat {
namespace Compiler {
SymbolTable gSymTable;
SymbolID_t gFinallyValVar_SymTop;
SymbolID_t HyCSymS_cppSize;
SymbolID_t HyCSym_Object;
SymbolID_t HyCSym_nil;
FfiTypeMgr gFfiTypeMgr;
int jumpLabelCheckLevel = 0;
bool isJumpControlLabel(SymbolID_t) { return true; }
}
}
void compileError(const char* msg, ...) {
va_list ap;
va_start(ap, msg);
vfprintf(stderr, msg, ap);
va_end(ap);
fflush(stderr);
throw "compileError";
}
void compileError_pos(Houken::SyntaxTree*, const char* msg, ...) {
va_list ap;
va_start(ap, msg);
vfprintf(stderr, msg, ap);
va_end(ap);
fflush(stderr);
throw "compileError";
}
void init_gSymTable(void)
{
static const char* RESERVED_SYMS[] = { // 予約シンボルテーブル
"nil", // "nil"シンボルを0番にする
"NilClass",
"*REF", // 参照
"*MAIN", // メインクラス、メインルーチン
"*INDIRECT_REF", // 間接ローカル変数参照
"*INDIRECT_ENT", // 間接ローカル変数実体
"*cppSize", // c++オブジェクトのサイズを求める関数
"Object",
NULL
};
Hayat::Compiler::gSymTable.initialize(RESERVED_SYMS);
Hayat::Compiler::HyCSymS_cppSize = Hayat::Compiler::gSymTable.symbolID("*cppSize");
Hayat::Compiler::HyCSym_Object = Hayat::Compiler::gSymTable.symbolID("Object");
Hayat::Compiler::HyCSym_nil = Hayat::Compiler::gSymTable.symbolID("nil");
}
int main(int argc, char* argv[])
{
CppUnit::TextUi::TestRunner runner;
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
CppUnit::Outputter* outputter =
new CppUnit::CompilerOutputter(&runner.result(),std::cout);
runner.setOutputter(outputter);
int result = runner.run() ? 0 : 1;
return result;
}
| [
"[email protected]"
]
| [
[
[
1,
100
]
]
]
|
9369b4ecc1194479c3ba264c181c80af22ca9536 | 9c62af23e0a1faea5aaa8dd328ba1d82688823a5 | /rl/tags/v0-1/engine/core/src/RubyInterpreter.cpp | 92809a327173d36192d55330fb882f71d35bf3e9 | [
"ClArtistic",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
]
| permissive | jacmoe/dsa-hl-svn | 55b05b6f28b0b8b216eac7b0f9eedf650d116f85 | 97798e1f54df9d5785fb206c7165cd011c611560 | refs/heads/master | 2021-04-22T12:07:43.389214 | 2009-11-27T22:01:03 | 2009-11-27T22:01:03 | null | 0 | 0 | null | null | null | null | ISO-8859-3 | C++ | false | false | 10,378 | cpp | /* This source file is part of Rastullahs Lockenpracht.
* Copyright (C) 2003-2005 Team Pantheon. http://www.team-pantheon.de
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the Clarified Artistic License.
*
* 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
* Clarified Artistic License for more details.
*
* You should have received a copy of the Clarified Artistic License
* along with this program; if not you can get it here
* http://www.jpaulmorrison.com/fbp/artistic2.htm.
*/
#include "FixRubyHeaders.h"
#include "RubyInterpreter.h"
#include "ScriptObject.h"
#include "CoreSubsystem.h"
#include "ConfigurationManager.h"
#include "ScriptObjectRepository.h"
using namespace Ogre;
namespace rl {
RubyInterpreter::RubyInterpreter() : mScriptObjects(), mScriptInstances()
{
}
ScriptObject* RubyInterpreter::getScriptObject( const String& instname )
{
ScriptObjectPtr_Map::const_iterator pSoIter = mScriptObjects.find(instname);
if( pSoIter != mScriptObjects.end() )
return pSoIter->second;
return 0;
}
void RubyInterpreter::initializeInterpreter()
{
/*
Standard-Initialisierung, derzeit ohne Funktion da zur Korrekten Ausgabe in der Console
eine static method übergeben werden muss, die die Ruby-Standardausgabe handelt
*/
}
void RubyInterpreter::initializeInterpreter(staticValueMethod func)
{
//Ruby Initialisieren
ruby_init();
// UTF 8 aktivieren
execute( "$KCODE = 'u'" );
//Skript-Verzeichnisse der Dateien duerfen auch in /script liegen
StringVector modules = CoreSubsystem::getSingleton().getCommonModules();
modules.push_back(CoreSubsystem::getSingleton().getActiveAdventureModule());
for (StringVector::iterator iter = modules.begin(); iter != modules.end(); iter++)
{
//wir suchen die Scripte im modules Verzeichnis relativ zum ModuleRootPath!
addSearchPath(ConfigurationManager::getSingleton().
getModulesRootDirectory() + "/modules/" + (*iter) + "/scripts");
addSearchPath(ConfigurationManager::getSingleton().
getModulesRootDirectory() + "/modules/" + (*iter) +
"/scripts/maps");
}
ruby_init_loadpath();
//Skriptname
ruby_script("Rastullah");
// Fuer Ruby .dll oder .so dazu laden
loadProtected(&RubyInterpreter::loadDlls, 0, "Ruby error while loading dlls");
//Ersetzt die Standard-Ausgabe von Ruby durch Ausgaben in die Console
rb_defout = rb_str_new("", 0);
// Eigentlich nicht mehr notwendig, aber ohne das gibts nen Absturz?!?!
// rb_define_singleton_method(rb_defout, "write", (VALUE(*)(...))console_write, 1);
rb_define_singleton_method(rb_defout, "write", func, 1);
//to Prevent the Ruby GC from deleting
mRubyObjects = rb_ary_new();
rb_gc_register_address(&mRubyObjects);
new ScriptObjectRepository();
}
void RubyInterpreter::addSearchPath(const String& path)
{
ruby_incpush(path.c_str());
}
VALUE RubyInterpreter::loadDlls(VALUE val)
{
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
rb_require("RlScript");
#else
rb_require("libRlScript");
#endif
return Qnil;
}
void RubyInterpreter::loadProtected(ProtectedMethod func, VALUE val, const std::string& msg, bool exitOnFail)
{
int error = 0;
rb_protect(func, val, &error);
logRubyErrors("Ruby error while initializing", error);
}
void RubyInterpreter::logRubyErrors(const std::string& intro, int errorcode)
{
if(errorcode != 0)
{
VALUE info = rb_inspect(ruby_errinfo);
rb_backtrace();
if (intro.length() > 0)
Logger::getSingleton().log(Logger::CORE, Ogre::LML_CRITICAL, intro);
Logger::getSingleton().log(Logger::CORE, Ogre::LML_CRITICAL, STR2CSTR(info));
}
}
void RubyInterpreter::setDefOut(staticValueMethod func)
{
rb_define_singleton_method(rb_defout, "write", func, 1);
}
RubyInterpreter::~RubyInterpreter()
{
rb_gc_unregister_address(&mRubyObjects);
ruby_finalize();
}
bool RubyInterpreter::execute(String command)
{
int status = -1;
Logger::getSingleton().log(Logger::CORE, Ogre::LML_TRIVIAL, command, "RubyInterpreter::execute" );
rb_eval_string_protect(command.c_str(), &status);
logRubyErrors("", status);
if( status )
rb_eval_string_protect("print $!", &status);
return false;
}
String RubyInterpreter::val2str(const VALUE rval){
return STR2CSTR(rb_funcall(rval, rb_intern("to_s"), 0));
}
CeGuiString RubyInterpreter::val2ceguistr(const VALUE rval){
return CeGuiString((CEGUI::utf8*)STR2CSTR(rb_funcall(rval, rb_intern("to_s"), 0)));
}
String RubyInterpreter::strval2str(const VALUE rval){
return String(RSTRING(rval)->ptr);
}
void RubyInterpreter::registerScriptObject( ScriptObject* obj, const String& instname )
{
mScriptObjects.insert( ScriptObjectPtr_Pair(instname,obj) );
createScriptInstance(instname);
}
void RubyInterpreter::unregisterScriptObject( const String& instname )
{
removeScriptInstance(instname);
mScriptObjects.erase( instname );
}
void RubyInterpreter::registerRubyObject(VALUE pObject)
{
rb_ary_push(mRubyObjects, pObject);
}
void RubyInterpreter::unregisterRubyObject(VALUE pObject)
{
rb_ary_delete(mRubyObjects, pObject);
}
// Wrapper
VALUE rb_const_get_wrapper(VALUE data)
{
VALUE *args = (VALUE *) data;
return rb_const_get(args[0], args[1]);
}
VALUE rb_funcall_wrapper(VALUE data)
{
VALUE *args=(VALUE *) data;
const VALUE argsT=args[3];
return rb_funcall2(args[0], rb_intern(StringValuePtr(args[1])), (int)NUM2INT(args[2]), &argsT);
}
void RubyInterpreter::setScript(
const String& instname, const String& scriptname,
const String& classname, int argc, const CeGuiString args[] )
{
// unregister old script
removeScriptInstance(instname);
createScriptInstance(instname);
// Includes the file with the class definition
rb_require( scriptname.c_str() );
// Converts the String args into ruby VALUES
VALUE *rArgs = rubyArgs( argc, args );
// This is need to wrap rb_get_const with rb_protect
VALUE cgargs[4];
int error = 0;
cgargs[0] = rb_cObject;
cgargs[1] = rb_intern(classname.c_str());
VALUE pClass = rb_protect( (VALUE(*)(VALUE) )rb_const_get_wrapper , (VALUE) &cgargs[0], &error);
logRubyErrors("RubyInterpreter::setScript", error);
cgargs[0] = pClass;
cgargs[1] = rb_str_new2("new");
cgargs[2] = rb_int_new(argc);
cgargs[3] = rArgs[0];
// Generates a new instance of our class
VALUE pScriptInstance = rb_protect((VALUE(*)(VALUE) )rb_funcall_wrapper,(VALUE)&cgargs[0],&error );
logRubyErrors("RubyInterpreter::setScript", error);
// Registers it with the ruby GC, so it won't be deleted
registerRubyObject( pScriptInstance );
// Insert it in our map
mScriptInstances[ instname ] = pScriptInstance;
// delete args
delete[] rArgs;
}
void RubyInterpreter::callFunction( const String& instname, const String& funcname, int argc, const CeGuiString args[] )
{
Value_Map::const_iterator pSoIter = mScriptInstances.find(instname);
if( pSoIter != mScriptInstances.end() )
{
// Converts the String args into ruby VALUES
VALUE *rArgs = rubyArgs( argc, args );
int error=0;
VALUE cgargs[4];
cgargs[0] = pSoIter->second;
cgargs[1] = rb_str_new2( funcname.c_str() );
cgargs[2] = rb_int_new(argc);
cgargs[3] = rArgs[0];
// Calls the Function of our script instance
rb_protect( ( VALUE(*)(VALUE) )rb_funcall_wrapper,(VALUE)&cgargs[0],&error );
logRubyErrors("RubyInterpreter::callFunction", error);
// delete args
delete[] rArgs;
}
}
int RubyInterpreter::callIntegerFunction( const String& instname, const String& funcname, int argc, const CeGuiString args[] )
{
Value_Map::const_iterator pSoIter = mScriptInstances.find(instname);
int iReturn = 0;
if( pSoIter != mScriptInstances.end() )
{
// Converts the String args into ruby VALUES
VALUE *rArgs = rubyArgs( argc, args );
int error=0;
VALUE cgargs[4];
cgargs[0] = pSoIter->second;
cgargs[1] = rb_str_new2( funcname.c_str() );
cgargs[2] = rb_int_new(argc);
cgargs[3] = rArgs[0];
// Calls the Function of our script instance
VALUE rReturn = rb_protect( ( VALUE(*)(VALUE) )rb_funcall_wrapper,(VALUE)&cgargs[0],&error );
logRubyErrors("RubyInterpreter::callIntegerFunction", error);
iReturn = NUM2INT(rReturn);
// delete args
delete[] rArgs;
}
return iReturn;
}
CeGuiString RubyInterpreter::callStringFunction( const String& instname, const String& funcname, int argc, const CeGuiString args[] )
{
Value_Map::const_iterator pSoIter = mScriptInstances.find(instname);
CeGuiString sReturn = "";
if( pSoIter != mScriptInstances.end() )
{
// Converts the String args into ruby VALUES
VALUE *rArgs = rubyArgs( argc, args );
int error=0;
VALUE cgargs[4];
cgargs[0] = pSoIter->second;
cgargs[1] = rb_str_new2( funcname.c_str() );
cgargs[2] = rb_int_new(argc);
cgargs[3] = rArgs[0];
// Calls the Function of our script instance
VALUE rReturn = rb_protect( ( VALUE(*)(VALUE) )rb_funcall_wrapper,(VALUE)&cgargs[0],&error );
logRubyErrors("RubyInterpreter::setStringFunction", error);
// VALUE rReturn = rb_funcall2(pSoIter->second, rb_intern( funcname.c_str() ), argc, rArgs);
sReturn = STR2CSTR(rReturn);
// delete args
delete[] rArgs;
}
return sReturn;
}
VALUE* RubyInterpreter::rubyArgs( int argc, const CeGuiString args[] )
{
VALUE *rArgs = new VALUE[argc];
// Each argument is inserted as a simple rb_str
// Conversion of arguments in scripts
if( args != 0 )
for( int i = 0; i < argc ; i++ )
rArgs[i] = rb_str_new2(args[i].c_str());
return rArgs;
}
void RubyInterpreter::createScriptInstance( const String& instname )
{
VALUE pScriptInstance = 0;
mScriptInstances.insert( Value_Pair(instname,pScriptInstance) );
}
void RubyInterpreter::removeScriptInstance( const String& instname )
{
Value_Map::iterator pSoIter = mScriptInstances.find(instname);
if( pSoIter != mScriptInstances.end() )
{
unregisterRubyObject( mScriptInstances[instname] );
mScriptInstances.erase( pSoIter );
}
}
}
| [
"blakharaz@4c79e8ff-cfd4-0310-af45-a38c79f83013"
]
| [
[
[
1,
349
]
]
]
|
02cc733974b8d814126e1d27a78be6c3ac1848d2 | 33f59b1ba6b12c2dd3080b24830331c37bba9fe2 | /Depend/Foundation/Curves/Wm4NURBSCurve2.h | 520406e18c519a903f31d96b56d704f5aef28902 | []
| no_license | daleaddink/flagship3d | 4835c223fe1b6429c12e325770c14679c42ae3c6 | 6cce5b1ff7e7a2d5d0df7aa0594a70d795c7979a | refs/heads/master | 2021-01-15T16:29:12.196094 | 2009-11-01T10:18:11 | 2009-11-01T10:18:11 | 37,734,654 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,681 | h | // Geometric Tools, Inc.
// http://www.geometrictools.com
// Copyright (c) 1998-2006. All Rights Reserved
//
// The Wild Magic Version 4 Foundation Library source code is supplied
// under the terms of the license agreement
// http://www.geometrictools.com/License/Wm4FoundationLicense.pdf
// and may not be copied or disclosed except in accordance with the terms
// of that agreement.
#ifndef WM4NURBSCURVE2_H
#define WM4NURBSCURVE2_H
#include "Wm4FoundationLIB.h"
#include "Wm4SingleCurve2.h"
#include "Wm4BSplineBasis.h"
namespace Wm4
{
template <class Real>
class WM4_FOUNDATION_ITEM NURBSCurve2 : public SingleCurve2<Real>
{
public:
// Construction and destruction. The caller is responsible for deleting
// the input arrays if they were dynamically allocated. Internal copies
// of the arrays are made, so to dynamically change control points,
// control weights, or knots, you must use the 'SetControlPoint',
// 'GetControlPoint', 'SetControlWeight', 'GetControlWeight', and 'Knot'
// member functions.
// The homogeneous input points are (x,y,w) where the (x,y) values are
// stored in the akCtrlPoint array and the w values are stored in the
// afCtrlWeight array. The output points from curve evaluations are of
// the form (x',y') = (x/w,y/w).
// Uniform spline. The number of control points is n+1 >= 2. The degree
// of the spline is d and must satisfy 1 <= d <= n. The knots are
// implicitly calculated in [0,1]. If bOpen is 'true', the spline is
// open and the knots are
// t[i] = 0, 0 <= i <= d
// (i-d)/(n+1-d), d+1 <= i <= n
// 1, n+1 <= i <= n+d+1
// If bOpen is 'false', the spline is periodic and the knots are
// t[i] = (i-d)/(n+1-d), 0 <= i <= n+d+1
// If bLoop is 'true', extra control points are added to generate a closed
// curve. For an open spline, the control point array is reallocated and
// one extra control point is added, set to the first control point
// C[n+1] = C[0]. For a periodic spline, the control point array is
// reallocated and the first d points are replicated. In either case the
// knot array is calculated accordingly.
NURBSCurve2 (int iNumCtrlPoints, const Vector2<Real>* akCtrlPoint,
const Real* afCtrlWeight, int iDegree, bool bLoop, bool bOpen);
// Open, nonuniform spline. The knot array must have n-d elements. The
// elements must be nondecreasing. Each element must be in [0,1].
NURBSCurve2 (int iNumCtrlPoints, const Vector2<Real>* akCtrlPoint,
const Real* afCtrlWeight, int iDegree, bool bLoop,
const Real* afKnot);
virtual ~NURBSCurve2 ();
int GetNumCtrlPoints () const;
int GetDegree () const;
bool IsOpen () const;
bool IsUniform () const;
bool IsLoop () const;
// Control points and weights may be changed at any time. The input index
// should be valid (0 <= i <= n). If it is invalid, the return value of
// GetControlPoint is a vector whose components are all MAX_REAL, and the
// return value of GetControlWeight is MAX_REAL.
// undefined.
void SetControlPoint (int i, const Vector2<Real>& rkCtrl);
Vector2<Real> GetControlPoint (int i) const;
void SetControlWeight (int i, Real fWeight);
Real GetControlWeight (int i) const;
// The knot values can be changed only if the basis function is nonuniform
// and the input index is valid (0 <= i <= n-d-1). If these conditions
// are not satisfied, GetKnot returns MAX_REAL.
void SetKnot (int i, Real fKnot);
Real GetKnot (int i) const;
// The spline is defined for 0 <= t <= 1. If a t-value is outside [0,1],
// an open spline clamps t to [0,1]. That is, if t > 1, t is set to 1;
// if t < 0, t is set to 0. A periodic spline wraps to to [0,1]. That
// is, if t is outside [0,1], then t is set to t-floor(t).
virtual Vector2<Real> GetPosition (Real fTime) const;
virtual Vector2<Real> GetFirstDerivative (Real fTime) const;
virtual Vector2<Real> GetSecondDerivative (Real fTime) const;
virtual Vector2<Real> GetThirdDerivative (Real fTime) const;
// If you need position and derivatives at the same time, it is more
// efficient to call these functions. Pass the addresses of those
// quantities whose values you want. You may pass 0 in any argument
// whose value you do not want.
void Get (Real fTime, Vector2<Real>* pkPos, Vector2<Real>* pkDer1,
Vector2<Real>* pkDer2, Vector2<Real>* pkDer3) const;
// Access the basis function to compute it without control points. This
// is useful for least squares fitting of curves.
BSplineBasis<Real>& GetBasis ();
// TO DO. This is not yet implemented.
virtual Real GetVariation (Real fT0, Real fT1,
const Vector2<Real>* pkP0 = 0, const Vector2<Real>* pkP1 = 0) const;
protected:
// Replicate the necessary number of control points when the Create
// function has bLoop equal to true, in which case the spline curve must
// be a closed curve.
void CreateControl (const Vector2<Real>* akCtrlPoint,
const Real* afCtrlWeight);
int m_iNumCtrlPoints;
Vector2<Real>* m_akCtrlPoint; // ctrl[n+1]
Real* m_afCtrlWeight; // weight[n+1]
bool m_bLoop;
BSplineBasis<Real> m_kBasis;
int m_iReplicate; // the number of replicated control points
};
typedef NURBSCurve2<float> NURBSCurve2f;
typedef NURBSCurve2<double> NURBSCurve2d;
}
#endif
| [
"yf.flagship@e79fdf7c-a9d8-11de-b950-3d5b5f4ea0aa"
]
| [
[
[
1,
130
]
]
]
|
e8269ed39d462e65adaa289133ef9720f9499a3a | ef23e388061a637f82b815d32f7af8cb60c5bb1f | /src/osd/osdmini/system/src/ESThreads.h | ebae9b280da9d9ac302e12b73f46e18c8213e004 | []
| no_license | marcellodash/psmame | 76fd877a210d50d34f23e50d338e65a17deff066 | 09f52313bd3b06311b910ed67a0e7c70c2dd2535 | refs/heads/master | 2021-05-29T23:57:23.333706 | 2011-06-23T20:11:22 | 2011-06-23T20:11:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 752 | h | #pragma once
typedef int (*ThreadFunction) (void*);
class ESThread
{
public:
virtual ~ESThread () {};
virtual int32_t Wait () = 0;
};
class ESMutex
{
public:
virtual ~ESMutex () {};
virtual void Lock () = 0;
virtual void Unlock () = 0;
};
class ESSemaphore
{
public:
virtual ~ESSemaphore () {};
virtual uint32_t GetValue () = 0;
virtual void Post () = 0;
virtual void Wait () = 0;
};
class ESThreads
{
public:
virtual ESThread* MakeThread (ThreadFunction aFunction, void* aUserData) = 0;
virtual ESMutex* MakeMutex () = 0;
virtual ESSemaphore* MakeSemaphore (uint32_t aValue) = 0;
};
| [
"Mike@localhost"
]
| [
[
[
1,
39
]
]
]
|
981b2adcb481c28cacc6eb39e22ebc30a21dc537 | 6bdb3508ed5a220c0d11193df174d8c215eb1fce | /Codes/Halak.wxWidgets/Window.cpp | ba985453ac05c7983d2eefc4110053db7c52a4e8 | []
| no_license | halak/halak-plusplus | d09ba78640c36c42c30343fb10572c37197cfa46 | fea02a5ae52c09ff9da1a491059082a34191cd64 | refs/heads/master | 2020-07-14T09:57:49.519431 | 2011-07-09T14:48:07 | 2011-07-09T14:48:07 | 66,716,624 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,271 | cpp | #include <Halak.wxWidgets/PCH.h>
#include <Halak.wxWidgets/Window.h>
namespace Halak
{
namespace wxWidgets
{
Window::Window(wxWindow* window)
: window(window)
{
}
Window::~Window()
{
}
void Window::Close()
{
window->Close();
}
Point Window::GetPosition() const
{
const wxPoint position = window->GetPosition();
return Point(position.x, position.y);
}
void Window::SetPosition(Point value)
{
window->SetPosition(wxPoint(value.X, value.Y));
}
Point Window::GetSize() const
{
const wxSize size = window->GetClientSize();
return Point(size.x, size.y);
}
void Window::SetSize(Point value)
{
window->SetClientSize(value.X, value.Y);
}
bool Window::GetVisible() const
{
return window->IsShown();
}
void Window::SetVisible(bool value)
{
window->Show(value);
}
void* Window::GetHandle() const
{
return window->GetHandle();
}
}
} | [
"[email protected]"
]
| [
[
[
1,
59
]
]
]
|
e2279ecd81a5f4f52b52f5b2aad77403cf1f083b | e7c45d18fa1e4285e5227e5984e07c47f8867d1d | /Common/Models/MDLBASE/MultiFB.h | 095dbc7d28c966238b00e4a54d55e329d4db4345 | []
| 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 | 11,902 | h | //================== SysCAD - Copyright Kenwalt (Pty) Ltd ===================
// $Nokeywords: $
//===========================================================================
// SysCAD Copyright Kenwalt (Pty) Ltd 1992
#ifndef __MULTIFB_H
#define __MULTIFB_H
#ifndef __SC_DEFS_H
#include "sc_defs.h"
#endif
#ifndef __FLWNODE_H
#include "flwnode.h"
#endif
#ifndef __VLEBASE_H
#include "vlebase.h"
#endif
#include <typeinfo.h>
#if defined(__MULTIFB_CPP)
#define DllImportExport DllExport
#elif !defined(MdlBase)
#define DllImportExport DllImport
#else
#define DllImportExport
#endif
#define WITHMFBDEDT 01
XID xidMFBOn = FlwBlkXID(1);
XID xidMFBBuildIt = FlwBlkXID(2);
XID xidMFBDiam = FlwBlkXID(3);
XID xidPFMethod = FlwBlkXID(4);
// ===========================================================================
//
//
//
// ===========================================================================
// Void Fraction Methods
const int VM_Butterworth = 0;
const int VM_Premoli = 1;
// Void Fraction Butterworth Factors
const int VMB_Fauske = 0;
const int VMB_Zivi = 1;
const int VMB_Baroczy = 2;
const int VMB_Wallis = 3;
const int VMB_LockhartMartinelli = 4;
const int VMB_Thom = 5;
const int VMB_Moody = 6;
const int VMB_Homogeneous = 7;
// Density Multiplier Methods
const int DM_Friedel = 0;
const int DM_Beattie = 1;
extern DllImportExport CFlwEqnGrp MFBPipeGroup;
extern DllImportExport CFlwEqnGrp MFBJoinGroup;
extern DllImportExport CFlwEqnGrp MFBEnExGroup;
class MFCommonBlk
{
friend class CMultiFlwBlk;
friend class CMultiFlwBlkEdt;
protected:
double dMagn_Fac;
double dPowr_Fac;
double dAge_Fac;
double dRoughness;
//double dLViscosity;
//double dGViscosity;
double dIntDiamMult;
byte iVoidMeth;
byte iVMButterFact;
byte iDensMultMeth;
//double dRoughness;
// DualDbl LVisc;
// DualDbl GVisc;
// DualDbl GDens;
// DualDbl LDens;
// //DualDbl TPDens;
// DualDbl STens;
//double ;
double LVisc, LViscI, LViscO;
double GVisc, GViscI, GViscO;
double GDens, GDensI, GDensO;
double LDens;
//DualDbl TPDens;
double STens, STensI, STensO;
flag fDoXfer;
flag fAppRhoH;
flag fFindRhoH;
flag fPressOK;
CVLEBase *pVLE;
// SetPhysInfo
double DiamI, AreaI;
double DiamE, AreaE;
double DiamO, AreaO;
double DiamMean, AreaMean;
double DZ;
double Length;
double KFact;
// SetFlowInfo
double Tk;
double MassFlow;
double VelMix;
double G;
double X;
flag VFracOK;
double VFrac, LFrac; // SFrac=1-VFrac-LFrac
//double GDens, LDens;
double TPDens;
//double SurfaceTension;
//double GVisc, LVisc;
double ReLiq, ReGas, WeLiq;
// SetFricFact
double LFricFact, GFricFact, FLog;
//SetDensityMul t
double VoidFrac; // Correlation
double Slip; //
double Phi; // Multiplier
//double FLC, FGC, FL, FG, FLog;
//double LFricFact, GFricFact, FLog;
double DPFricLiq1;
double DPAccl1, DPStat1, DPFric1;
double DPAccl2, DPStat2, DPFric2;
double DPAccl, DPStat, DPFric;
double DPScale;
double dOnePhPart; // Correlation
//double dPrevDiam;
double TIn;
double HIn;
double PIn, POut;
double VfIn, VfOut;
double dOnePhDPQ, dOnePhDPZ;
public:
MFCommonBlk(CVLEBase *VLE);
double Reynolds(double Diam, double Vel, double Dens) { return Diam*Vel*Dens/LVisc; };
double RelRough(double Diam) { return dRoughness/Diam; };
double FrictionFact(double Diam, double Vel, double Dens);
double FrictionFactTurbulent(double Diam, double Dens) { return FrictionFact(Diam, 1e3, Dens); };
double PressDropLength(double Diam, double Vel, double Dens, double Length);
double PressDropKFact(double Vel, double Dens, double KFact);
flag TestPressureOK(double &P0, double &P1);
flag DoSatPLiqAtStart(flag AtEntry, CFlwBlkBase & FE,
double Regulation, SpConduit &Cd,
double K, double DI, double DE, double DO);//, double D2);
flag DoSatPVapAtStart(flag AtEntry, CFlwBlkBase & FE,
double Regulation, SpConduit &Cd,
double K, double DI, double DE, double DO);//, double D2);
flag DoFlash(flag AtEntry, CFlwBlkBase & FE,
double Regulation, SpConduit &Cd,
double K, double DI, double DE, double DO,//double D2,
double OnePhDPQ, double OnePhDPZ);
//void SetPrevDiam(double D1) { dPrevDiam=D1; };
void SetPhysInfo(double DI, double DE, double DO, double KMax, double Len, double Rise, double Scale);
flag SetFlowInfo(SpConduit & Cd, double RqdPress);
void SetFricFact();
void SetVoidFrac();
void SetDensityMult();
void SetProperties(SpConduit & Cd, double RqdP, double MaxT, flag DoDbgHdr);
void SetTwoPhDPs1(SpConduit & Cd, double P1);
void SetTwoPhDPs2(SpConduit & Cd, double P2, double MaxTemp);
void SetTwoPhDPs();
double DPa() { return DPAccl; };
double DPz() { return DPStat; };
double DPq() { return DPFric; };
double VapFrac() { return VFrac; };
double LiqFrac() { return LFrac; };
double SolFrac() { return 1-VFrac-LFrac; };
double MixVel() { return VelMix; };
double SlipRatio() { return Slip; };
double DensMult() { return Phi; };
double VoidFraction() { return VoidFrac; };
double OnePhPart() { return dOnePhPart; };
};
// ---------------------------------------------------------------------------
class MFB_Eqn : public CFlwEqn
{
public:
MFCommonBlk *pMFCB;
Strng m_sIdStr;
MFB_Eqn(pTagObjClass pClass_, pchar pTag, pTaggedObject pAttach, TagObjAttachment eAttach) :
CFlwEqn(pClass_, pTag, pAttach, eAttach)
{
pMFCB=NULL;
};
virtual ~MFB_Eqn() {};
virtual void BuildDataDefn(DataDefnBlk & DDB);
virtual flag DataXchg(DataChangeBlk & DCB);
virtual double GetFricFact() { return dNAN; };
virtual double GetSlipRatio() { return pMFCB ? pMFCB->SlipRatio() : dNAN; };
virtual double GetVoidFraction() { return pMFCB ? pMFCB->VoidFraction() : dNAN; };
virtual double GetOnePhPart() { return pMFCB ? pMFCB->OnePhPart() : 1.0; };
};
// ===========================================================================
//
//
//
// ===========================================================================
union CFBCount
{
dword Msk;
int Cnt[4];
long Total() { return Cnt[0]+Cnt[1]+Cnt[2]+Cnt[3]; };
};
struct CFBPtr
{
FlwBlk * pFB;
int iBlk;
int iFE;
int iSgn;
CFBPtr()
{
pFB=NULL;
iBlk=iFE=iSgn=0;
};
};
#if WITHMFBDEDT
DEFINE_TAGOBJEDT(CMultiFlwBlk);
#else
DEFINE_TAGOBJ(CMultiFlwBlk);
#endif
class DllImportExport CMultiFlwBlk : public TaggedObject
{
friend class CMultiFlwBlkEdt;
protected:
flag fOn, fOnRqd; // Buffered
int iIoIn, iIoOut;
CFBCount FBCnt;
int FBEdtBlkId[4];
CArray <CFBPtr, CFBPtr&> FBA;
MFCommonBlk Common;
public:
CMultiFlwBlk(pTagObjClass pClass_, pchar pTag, pTaggedObject pAttach, TagObjAttachment eAttach);
CMultiFlwBlk(pchar pTag, pTaggedObject pAttach, TagObjAttachment eAttach, int IoIn, int IoOut, CVLEBase * Vle);
virtual ~CMultiFlwBlk();
flag On() { return fOn; };
void SetOn(flag On);
void SetOnRqd(flag On);
virtual void AssignFlowGroups();
void GetFBInfo();
void SetFBs();
void ChgFBs(int Blk, int At, int Inc);
virtual void BuildDataDefn(DataDefnBlk & DDB);
virtual flag DataXchg(DataChangeBlk & DCB);// {return TaggedObject::DataXchg(DCB);};
virtual flag ValidateData(ValidateDataBlk & VDB);
virtual void SetPhysicalData();
virtual void SetDatums(int Pass, CFlwNodeIndexList & List, int IOIn, double &RiseRqd, double &DatumChg);
virtual void EvalJoinPressures(flag DoXfer, flag AppRhoH);
};
// ===========================================================================
//
//
//
// ===========================================================================
#if WITHMFBDEDT
struct MFBColDesc
{
char * sTag;
int iId;
flag bOn;
int iWide;
UCHAR iJust;
CnvAttribute Cnv;
FmtAttribute Fmt;
MFBColDesc()
{
sTag=NULL;
iId=-1;
bOn=false;
iWide=8;
}
MFBColDesc(char * D, int Id, flag On, int Wide, UCHAR Just, CCnvIndex DC, char * CnvTxt, int NDec) :
Cnv(DC, CnvTxt),
Fmt("", 0, (byte)NDec, 'f')
{
sTag=D;
iId=Id;
bOn=On;
iWide=Wide;
iJust=Just;
}
};
_FWDDEF(CMultiFlwBlkEdt);
class DllImportExport CMultiFlwBlkEdt : public FxdEdtBookRef
{
public :
CMultiFlwBlk &rMFB;
int iPg1;
CnvAttribute ViscCnv, DensCnv, STensCnv, RoughCnv;
FmtAttribute ViscFmt, DensFmt, STensFmt, RoughFmt;
CArray <MFBColDesc, MFBColDesc&> CDs;
int DistFromPgNo(int Pg);
CMultiFlwBlkEdt(pFxdEdtView pView_, pCMultiFlwBlk pChgO_);//, rStrng Tag, rStrng Name);
virtual ~CMultiFlwBlkEdt();
virtual void PutDataStart();
virtual void PutDataDone();
virtual void GetDataStart();
virtual void GetDataDone();
virtual void StartBuild();
virtual void Build();
virtual void Load(FxdEdtInfo &EI, Strng & Str);
virtual long ButtonPushed(FxdEdtInfo &EI, Strng & Str);
virtual long Parse(FxdEdtInfo &EI, Strng & Str);
virtual flag DoLButtonDown(UINT nFlags, CPoint point);
virtual flag DoLButtonUp(UINT nFlags, CPoint point);
virtual flag DoLButtonDblClk(UINT nFlags, CPoint point);
virtual flag DoRButtonDown(UINT nFlags, CPoint point);
virtual flag DoRButtonUp(UINT nFlags, CPoint point);
virtual flag DoRButtonDblClk(UINT nFlags, CPoint point);
virtual flag DoAccCnv(UINT Id);
virtual flag DoAccFmt(UINT Id);
virtual flag DoAccRptTagLists();
virtual flag SelectValues(char* DataFile, char* Table, char** Columns, CStringArray &RetValues);
virtual flag DumpPDS(char * Fn);
};
#endif
// ===========================================================================
//
//
//
//===========================================================================
#undef DllImportExport
#endif
| [
"[email protected]",
"[email protected]"
]
| [
[
[
1,
161
],
[
163,
164
],
[
166,
288
],
[
290,
385
]
],
[
[
162,
162
],
[
165,
165
],
[
289,
289
]
]
]
|
3b7b170b369a575e4b8917300d6912fe0a43d4a4 | 2ba8e856d07f4c4bd9c92b215429bc3331c2bd5a | /src/demos/explosion/explosion.cpp | 20e99c501024ff06946442ea01f5c52725d1c45a | [
"MIT"
]
| permissive | paytonrules/cyclone-physics | bebd6aa782d754d701f1d0bb153c8243a78d3f67 | c6c087d53e0ecf37143441a07f8fcbde78f58ae2 | refs/heads/master | 2021-01-17T21:30:36.299122 | 2011-10-04T04:00:04 | 2011-10-04T04:00:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,810 | cpp | /*
* The explosion demo.
*
* Part of the Cyclone physics system.
*
* Copyright (c) Icosagon 2003. All Rights Reserved.
*
* This software is distributed under licence. Use of this software
* implies agreement with all terms and conditions of the accompanying
* software licence.
*/
#if defined(_MSC_VER)
#include <gl/glut.h>
#else
#include <GLUT/glut.h>
#endif
#include <cyclone/cyclone.h>
#include "../app.h"
#include "../timing.h"
#include <stdio.h>
#define OBJECTS 5
// Holds a transform matrix for rendering objects
// reflected in the floor.
GLfloat floorMirror[16] =
{
1, 0, 0, 0,
0, -1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
};
class Ball : public cyclone::CollisionSphere
{
public:
Ball()
{
body = new cyclone::RigidBody;
}
~Ball()
{
delete body;
}
/** Draws the box, excluding its shadow. */
void render()
{
// Get the OpenGL transformation
GLfloat mat[16];
body->getGLTransform(mat);
if (body->getAwake()) glColor3f(1.0f,0.7f,0.7f);
else glColor3f(0.7f,0.7f,1.0f);
glPushMatrix();
glMultMatrixf(mat);
glutSolidSphere(radius, 20, 20);
glPopMatrix();
}
/** Draws the ground plane shadow for the box. */
void renderShadow()
{
// Get the OpenGL transformation
GLfloat mat[16];
body->getGLTransform(mat);
glPushMatrix();
glScalef(1.0f, 0, 1.0f);
glMultMatrixf(mat);
glutSolidSphere(radius, 20, 20);
glPopMatrix();
}
/** Sets the box to a specific location. */
void setState(cyclone::Vector3 position,
cyclone::Quaternion orientation,
cyclone::real radius,
cyclone::Vector3 velocity)
{
body->setPosition(position);
body->setOrientation(orientation);
body->setVelocity(velocity);
body->setRotation(cyclone::Vector3(0,0,0));
Ball::radius = radius;
cyclone::real mass = 4.0f*0.3333f*3.1415f * radius*radius*radius;
body->setMass(mass);
cyclone::Matrix3 tensor;
cyclone::real coeff = 0.4f*mass*radius*radius;
tensor.setInertiaTensorCoeffs(coeff,coeff,coeff);
body->setInertiaTensor(tensor);
body->setLinearDamping(0.95f);
body->setAngularDamping(0.8f);
body->clearAccumulators();
body->setAcceleration(0,-10.0f,0);
//body->setCanSleep(false);
body->setAwake();
body->calculateDerivedData();
}
/** Positions the box at a random location. */
void random(cyclone::Random *random)
{
const static cyclone::Vector3 minPos(-5, 5, -5);
const static cyclone::Vector3 maxPos(5, 10, 5);
cyclone::Random r;
setState(
random->randomVector(minPos, maxPos),
random->randomQuaternion(),
random->randomReal(0.5f, 1.5f),
cyclone::Vector3()
);
}
};
class Box : public cyclone::CollisionBox
{
public:
bool isOverlapping;
Box()
{
body = new cyclone::RigidBody;
}
~Box()
{
delete body;
}
/** Draws the box, excluding its shadow. */
void render()
{
// Get the OpenGL transformation
GLfloat mat[16];
body->getGLTransform(mat);
if (isOverlapping) glColor3f(0.7f,1.0f,0.7f);
else if (body->getAwake()) glColor3f(1.0f,0.7f,0.7f);
else glColor3f(0.7f,0.7f,1.0f);
glPushMatrix();
glMultMatrixf(mat);
glScalef(halfSize.x*2, halfSize.y*2, halfSize.z*2);
glutSolidCube(1.0f);
glPopMatrix();
}
/** Draws the ground plane shadow for the box. */
void renderShadow()
{
// Get the OpenGL transformation
GLfloat mat[16];
body->getGLTransform(mat);
glPushMatrix();
glScalef(1.0f, 0, 1.0f);
glMultMatrixf(mat);
glScalef(halfSize.x*2, halfSize.y*2, halfSize.z*2);
glutSolidCube(1.0f);
glPopMatrix();
}
/** Sets the box to a specific location. */
void setState(const cyclone::Vector3 &position,
const cyclone::Quaternion &orientation,
const cyclone::Vector3 &extents,
const cyclone::Vector3 &velocity)
{
body->setPosition(position);
body->setOrientation(orientation);
body->setVelocity(velocity);
body->setRotation(cyclone::Vector3(0,0,0));
halfSize = extents;
cyclone::real mass = halfSize.x * halfSize.y * halfSize.z * 8.0f;
body->setMass(mass);
cyclone::Matrix3 tensor;
tensor.setBlockInertiaTensor(halfSize, mass);
body->setInertiaTensor(tensor);
body->setLinearDamping(0.95f);
body->setAngularDamping(0.8f);
body->clearAccumulators();
body->setAcceleration(0,-10.0f,0);
body->setAwake();
body->calculateDerivedData();
}
/** Positions the box at a random location. */
void random(cyclone::Random *random)
{
const static cyclone::Vector3 minPos(-5, 5, -5);
const static cyclone::Vector3 maxPos(5, 10, 5);
const static cyclone::Vector3 minSize(0.5f, 0.5f, 0.5f);
const static cyclone::Vector3 maxSize(4.5f, 1.5f, 1.5f);
setState(
random->randomVector(minPos, maxPos),
random->randomQuaternion(),
random->randomVector(minSize, maxSize),
cyclone::Vector3()
);
}
};
/**
* The main demo class definition.
*/
class ExplosionDemo : public RigidBodyApplication
{
bool editMode, upMode;
/**
* Holds the number of boxes in the simulation.
*/
const static unsigned boxes = OBJECTS;
/** Holds the box data. */
Box boxData[boxes];
/**
* Holds the number of balls in the simulation.
*/
const static unsigned balls = OBJECTS;
/** Holds the ball data. */
Ball ballData[balls];
/** Detonates the explosion. */
void fire();
/** Resets the position of all the boxes and primes the explosion. */
virtual void reset();
/** Processes the contact generation code. */
virtual void generateContacts();
/** Processes the objects in the simulation forward in time. */
virtual void updateObjects(cyclone::real duration);
public:
/** Creates a new demo object. */
ExplosionDemo();
/** Sets up the rendering. */
virtual void initGraphics();
/** Returns the window title for the demo. */
virtual const char* getTitle();
/** Display the particle positions. */
virtual void display();
/** Handles a key press. */
virtual void key(unsigned char key);
/** Handle a mouse drag */
virtual void mouseDrag(int x, int y);
};
// Method definitions
ExplosionDemo::ExplosionDemo()
:
RigidBodyApplication(),
editMode(false),
upMode(false)
{
// Reset the position of the boxes
reset();
}
const char* ExplosionDemo::getTitle()
{
return "Cyclone > Explosion Demo";
}
void ExplosionDemo::fire()
{
cyclone::Vector3 pos = ballData[0].body->getPosition();
pos.normalise();
ballData[0].body->addForce(pos * -1000.0f);
}
void ExplosionDemo::reset()
{
Box *box = boxData;
box++->setState(cyclone::Vector3(0,3,0),
cyclone::Quaternion(),
cyclone::Vector3(4,1,1),
cyclone::Vector3(0,1,0));
if (boxes > 1)
{
box++->setState(cyclone::Vector3(0,4.75,2),
cyclone::Quaternion(1.0,0.1,0.05,0.01),
cyclone::Vector3(1,1,4),
cyclone::Vector3(0,1,0));
}
// Create the random objects
cyclone::Random random;
for (; box < boxData+boxes; box++)
{
box->random(&random);
}
for (Ball *ball = ballData; ball < ballData+balls; ball++)
{
ball->random(&random);
}
// Reset the contacts
cData.contactCount = 0;
}
void ExplosionDemo::generateContacts()
{
// Note that this method makes a lot of use of early returns to avoid
// processing lots of potential contacts that it hasn't got room to
// store.
// Create the ground plane data
cyclone::CollisionPlane plane;
plane.direction = cyclone::Vector3(0,1,0);
plane.offset = 0;
// Set up the collision data structure
cData.reset(maxContacts);
cData.friction = (cyclone::real)0.9;
cData.restitution = (cyclone::real)0.6;
cData.tolerance = (cyclone::real)0.1;
// Perform exhaustive collision detection
cyclone::Matrix4 transform, otherTransform;
cyclone::Vector3 position, otherPosition;
for (Box *box = boxData; box < boxData+boxes; box++)
{
// Check for collisions with the ground plane
if (!cData.hasMoreContacts()) return;
cyclone::CollisionDetector::boxAndHalfSpace(*box, plane, &cData);
// Check for collisions with each other box
for (Box *other = box+1; other < boxData+boxes; other++)
{
if (!cData.hasMoreContacts()) return;
cyclone::CollisionDetector::boxAndBox(*box, *other, &cData);
if (cyclone::IntersectionTests::boxAndBox(*box, *other))
{
box->isOverlapping = other->isOverlapping = true;
}
}
// Check for collisions with each ball
for (Ball *other = ballData; other < ballData+balls; other++)
{
if (!cData.hasMoreContacts()) return;
cyclone::CollisionDetector::boxAndSphere(*box, *other, &cData);
}
}
for (Ball *ball = ballData; ball < ballData+balls; ball++)
{
// Check for collisions with the ground plane
if (!cData.hasMoreContacts()) return;
cyclone::CollisionDetector::sphereAndHalfSpace(*ball, plane, &cData);
for (Ball *other = ball+1; other < ballData+balls; other++)
{
// Check for collisions with the ground plane
if (!cData.hasMoreContacts()) return;
cyclone::CollisionDetector::sphereAndSphere(*ball, *other, &cData);
}
}
}
void ExplosionDemo::updateObjects(cyclone::real duration)
{
// Update the physics of each box in turn
for (Box *box = boxData; box < boxData+boxes; box++)
{
// Run the physics
box->body->integrate(duration);
box->calculateInternals();
box->isOverlapping = false;
}
// Update the physics of each ball in turn
for (Ball *ball = ballData; ball < ballData+balls; ball++)
{
// Run the physics
ball->body->integrate(duration);
ball->calculateInternals();
}
}
void ExplosionDemo::initGraphics()
{
GLfloat lightAmbient[] = {0.8f,0.8f,0.8f,1.0f};
GLfloat lightDiffuse[] = {0.9f,0.95f,1.0f,1.0f};
glLightfv(GL_LIGHT0, GL_AMBIENT, lightAmbient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, lightDiffuse);
glEnable(GL_LIGHT0);
Application::initGraphics();
}
void ExplosionDemo::display()
{
const static GLfloat lightPosition[] = {1,-1,0,0};
const static GLfloat lightPositionMirror[] = {1,1,0,0};
// Update the transform matrices of each box in turn
for (Box *box = boxData; box < boxData+boxes; box++)
{
box->calculateInternals();
box->isOverlapping = false;
}
// Update the transform matrices of each ball in turn
for (Ball *ball = ballData; ball < ballData+balls; ball++)
{
// Run the physics
ball->calculateInternals();
}
// Clear the viewport and set the camera direction
RigidBodyApplication::display();
// Render each element in turn as a shadow
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
glPushMatrix();
glMultMatrixf(floorMirror);
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
for (Box *box = boxData; box < boxData+boxes; box++)
{
box->render();
}
for (Ball *ball = ballData; ball < ballData+balls; ball++)
{
ball->render();
}
glPopMatrix();
glDisable(GL_LIGHTING);
glDisable(GL_COLOR_MATERIAL);
// Draw some scale circles
glColor3f(0.75, 0.75, 0.75);
for (unsigned i = 1; i < 20; i++)
{
glBegin(GL_LINE_LOOP);
for (unsigned j = 0; j < 32; j++)
{
float theta = 3.1415926f * j / 16.0f;
glVertex3f(i*cosf(theta),0.0f,i*sinf(theta));
}
glEnd();
}
glBegin(GL_LINES);
glVertex3f(-20,0,0);
glVertex3f(20,0,0);
glVertex3f(0,0,-20);
glVertex3f(0,0,20);
glEnd();
// Render each shadow in turn
glEnable(GL_BLEND);
glColor4f(0,0,0,0.1f);
glDisable(GL_DEPTH_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
for (Box *box = boxData; box < boxData+boxes; box++)
{
box->renderShadow();
}
for (Ball *ball = ballData; ball < ballData+balls; ball++)
{
ball->renderShadow();
}
glDisable(GL_BLEND);
// Render the boxes themselves
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glLightfv(GL_LIGHT0, GL_POSITION, lightPositionMirror);
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
for (Box *box = boxData; box < boxData+boxes; box++)
{
box->render();
}
for (Ball *ball = ballData; ball < ballData+balls; ball++)
{
ball->render();
}
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST);
// Finish the frame, rendering any additional information
drawDebug();
}
void ExplosionDemo::mouseDrag(int x, int y)
{
if (editMode)
{
boxData[0].body->setPosition(boxData[0].body->getPosition() +
cyclone::Vector3(
(x-last_x) * 0.125f,
0,
(y-last_y) * 0.125f
)
);
boxData[0].body->calculateDerivedData();
}
else if (upMode)
{
boxData[0].body->setPosition(boxData[0].body->getPosition() +
cyclone::Vector3(
0,
(y-last_y) * 0.125f,
0
)
);
boxData[0].body->calculateDerivedData();
}
else
{
RigidBodyApplication::mouseDrag(x, y);
}
// Remember the position
last_x = x;
last_y = y;
}
void ExplosionDemo::key(unsigned char key)
{
switch(key)
{
case 'e': case 'E':
editMode = !editMode;
upMode = false;
return;
case 't': case 'T':
upMode = !upMode;
editMode = false;
return;
case 'w': case 'W':
for (Box *box = boxData; box < boxData+boxes; box++)
box->body->setAwake();
for (Ball *ball = ballData; ball < ballData+balls; ball++)
ball->body->setAwake();
return;
}
RigidBodyApplication::key(key);
}
/**
* Called by the common demo framework to create an application
* object (with new) and return a pointer.
*/
Application* getApplication()
{
return new ExplosionDemo();
}
| [
"[email protected]",
"[email protected]"
]
| [
[
[
1,
12
],
[
14,
14
],
[
19,
592
]
],
[
[
13,
13
],
[
15,
18
],
[
593,
593
]
]
]
|
445e6eb41a062f71d1b50e9449331169b304487e | 60cd554f2136295108f7a76cfcc479df0df1774c | /controller.cpp | fbea8c994c5495b4b8bef40eaa2ff768cf9ab235 | []
| no_license | s-partridge/TicTacToeAI | 2434923db98c4c3462df1799bafdcee6beff6dee | d87e21b8cac6cc7582e9b3166711da3597f172bf | refs/heads/master | 2021-01-19T09:44:54.337054 | 2011-10-17T00:27:57 | 2011-10-17T00:27:57 | 2,566,347 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 960 | cpp | #include "controller.h"
Controller::Controller(Model *model)
{
//Connect the controller to the model and view.
m_modelPointer = model;
m_turnNumber = 0;
m_currentPlayer = EMPTY;
}
GameState Controller::updateBoard(int x, int y)
{
++m_turnNumber;
m_currentState.squares[x][y] = m_currentPlayer;
m_modelPointer->setMove(m_turnNumber, m_currentState);
return rulesEngine.testBoard(m_currentState);
}
Grid Controller::ResetBoard(int &turnNumber)
{
if(turnNumber >=0 && turnNumber < 10)
{
m_currentState = m_modelPointer->getMove(turnNumber);
m_turnNumber = turnNumber;
}
else
{
m_currentState.init();
m_turnNumber = 0;
}
return m_currentState;
}
int Controller::setPlayerID(PlayerType player)
{
if(player >= EMPTY && player <= OPLAYER)
{
m_currentPlayer = player;
return 0;
}
return 1;
}
| [
"[email protected]"
]
| [
[
[
1,
45
]
]
]
|
9939129a48565cbc35d473bb158216c90279db68 | 2a3952c00a7835e6cb61b9cb371ce4fb6e78dc83 | /BasicOgreFramework/PhysxSDK/Samples/SamplePulleyJoint/src/SamplePulleyJoint.cpp | 35c554c9ae5d914e789f21e4b017d5a9ceeaffee | []
| no_license | mgq812/simengines-g2-code | 5908d397ef2186e1988b1d14fa8b73f4674f96ea | 699cb29145742c1768857945dc59ef283810d511 | refs/heads/master | 2016-09-01T22:57:54.845817 | 2010-01-11T19:26:51 | 2010-01-11T19:26:51 | 32,267,377 | 0 | 0 | null | null | null | null | ISO-8859-3 | C++ | false | false | 15,638 | cpp | // ===============================================================================
//
// AGEIA PhysX SDK Sample Program
//
// Title: Motorized Pulley Joint
// Description: This sample program shows how to use the pulley joint.
//
// Originally written by: Bob Schade & Matthias Müller-Fischer (02-21-05)
//
// ===============================================================================
#include "SamplePulleyJoint.h"
#include "GLFontRenderer.h"
#include "Utilities.h"
#include "SamplesVRDSettings.h"
// Physics SDK globals
NxPhysicsSDK* gPhysicsSDK = NULL;
NxScene* gScene = NULL;
NxVec3 gDefaultGravity(0,-9.8,0);
DebugRenderer gDebugRenderer;
// Time globals
NxReal gTime;
NxReal gLastTime;
// Display globals
int mx = 0;
int my = 0;
char gDisplayString[512] = "";
// Camera globals
NxVec3 gCameraPos(0,5,-8);
NxVec3 gCameraForward(0,0,1);
NxVec3 gCameraRight(-1,0,0);
const NxReal gCameraSpeed = 0.02;
// Force globals
NxVec3 gForceVec(0,0,0);
NxReal gForceStrength = 1000;
bool bForceMode = true;
// Limit globals
NxReal gLinearLimit = 1.0f;
NxReal gSwing1Limit = NxPiF32 / 180.0f * 30.0f;
NxReal gSwing2Limit = NxPiF32 / 180.0f * 70.0f;
NxReal gTwistLowLimit = NxPiF32 / 180.0f * -90.0f;
NxReal gTwistHighLimit = NxPiF32 / 180.0f * 45.0f;
// Keyboard globals
#define MAX_KEYS 256
bool gKeys[MAX_KEYS];
// Simulation globals
bool bPause = false;
bool bShadows = true;
bool bDebugWireframeMode = true;
bool bWireframeMode = false;
// Motor
NxReal gMotorVelocity = 1.0f;
NxMotorDesc gMotorDesc;
// Actor globals
NxActor* groundPlane = NULL;
NxActor* capsule1 = NULL;
NxActor* capsule2 = NULL;
// Joint globals
NxPulleyJoint* pulleyJoint = NULL;
// Focus actor
NxActor* gSelectedActor = NULL;
void PrintControls()
{
printf("\n Flight Controls:\n ----------------\n w = forward, s = back\n a = strafe left, d = strafe right\n q = up, z = down\n");
printf("\n Force Controls:\n ---------------\n i = +z, k = -z\n j = +x, l = -x\n u = +y, m = -y\n");
printf("\n Motor Control:\n --------------\n 0 = stop, 1 = forward, 2 = backward\n");
printf("\n Miscellaneous:\n --------------\n p = Pause\n r = Select Next Actor\n f = Toggle Force Mode\n b = Toggle Debug Wireframe Mode\n x = Toggle Shadows\n");
}
void DisplayText()
{
float y = 0.95f;
int len = strlen(gDisplayString);
len = (len < 256)?len:255;
int start = 0;
char textBuffer[256];
for(int i=0;i<len;i++)
{
if(gDisplayString[i] == '\n' || i == len-1)
{
int offset = i;
if(i == len-1) offset= i+1;
memcpy(textBuffer, gDisplayString+start, offset-start);
textBuffer[offset-start]=0;
GLFontRenderer::print(0.01, y, 0.03f, textBuffer);
y -= 0.035f;
start = offset+1;
}
}
}
void RefreshDisplayString()
{
sprintf(gDisplayString, "PULLEY JOINT subject to %s\nMotor control: 0 stop 1 forward 2 backward",
bForceMode ? "force" : "torque");
}
void setMotor(NxReal vel)
{
gMotorDesc.velTarget = vel;
pulleyJoint->setMotor(gMotorDesc);
}
NxVec3 ApplyForceToActor(NxActor* actor, const NxVec3& forceDir, const NxReal forceStrength, bool forceMode)
{
NxVec3 forceVec = forceStrength*forceDir;
if (forceMode)
actor->addForce(forceVec);
else
actor->addTorque(forceVec);
return forceVec;
}
void SelectNextActor()
{
NxU32 nbActors = gScene->getNbActors();
NxActor** actors = gScene->getActors();
for(NxU32 i = 0; i < nbActors; i++)
{
if (actors[i] == gSelectedActor)
{
gSelectedActor = actors[(i+1)%nbActors];
if (gSelectedActor == groundPlane) // skip the ground plane
{
gSelectedActor = actors[(i+2)%nbActors];
}
break;
}
}
}
void ProcessKeys()
{
// Process keys
for (int i = 0; i < MAX_KEYS; i++)
{
if (!gKeys[i]) { continue; }
switch (i)
{
// Camera controls
case 'w':{ gCameraPos += gCameraForward*gCameraSpeed; break; }
case 's':{ gCameraPos -= gCameraForward*gCameraSpeed; break; }
case 'a':{ gCameraPos -= gCameraRight*gCameraSpeed; break; }
case 'd':{ gCameraPos += gCameraRight*gCameraSpeed; break; }
case 'z':{ gCameraPos -= NxVec3(0,1,0)*gCameraSpeed; break; }
case 'q':{ gCameraPos += NxVec3(0,1,0)*gCameraSpeed; break; }
// Force controls
case 'i': {gForceVec = ApplyForceToActor(gSelectedActor,NxVec3(0,0,1),gForceStrength,bForceMode); break; }
case 'k': {gForceVec = ApplyForceToActor(gSelectedActor,NxVec3(0,0,-1),gForceStrength,bForceMode); break; }
case 'j': {gForceVec = ApplyForceToActor(gSelectedActor,NxVec3(+1,0,0),gForceStrength,bForceMode); break; }
case 'l': {gForceVec = ApplyForceToActor(gSelectedActor,NxVec3(-1,0,0),gForceStrength,bForceMode); break; }
case 'u': {gForceVec = ApplyForceToActor(gSelectedActor,NxVec3(0,+1,0),gForceStrength,bForceMode); break; }
case 'm': {gForceVec = ApplyForceToActor(gSelectedActor,NxVec3(0,-1,0),gForceStrength,bForceMode); break; }
}
}
}
void SetupCamera()
{
// Setup camera
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0f, (float)glutGet(GLUT_WINDOW_WIDTH)/(float)glutGet(GLUT_WINDOW_HEIGHT), 1.0f, 10000.0f);
gluLookAt(gCameraPos.x,gCameraPos.y,gCameraPos.z,gCameraPos.x + gCameraForward.x, gCameraPos.y + gCameraForward.y, gCameraPos.z + gCameraForward.z, 0.0f, 1.0f, 0.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void RenderActors(bool shadows)
{
// Render all the actors in the scene
int nbActors = gScene->getNbActors();
NxActor** actors = gScene->getActors();
while (nbActors--)
{
NxActor* actor = *actors++;
DrawActor(actor, gSelectedActor);
// Handle shadows
if (shadows)
{
DrawActorShadow(actor);
}
}
}
void DrawForce(NxActor* actor, NxVec3& forceVec, const NxVec3& color)
{
// draw only if the force is large enough
NxReal force = forceVec.magnitude();
if (force < 0.1f) return;
forceVec = 3*forceVec/force;
NxVec3 pos = actor->getCMassGlobalPosition();
DrawArrow(pos, pos + forceVec, color);
}
void RenderCallback()
{
if (gScene && !bPause)
RunPhysics();
// Clear buffers
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
ProcessKeys();
SetupCamera();
RenderActors(bShadows);
if (bForceMode)
DrawForce(gSelectedActor, gForceVec, NxVec3(1,1,0));
else
DrawForce(gSelectedActor, gForceVec, NxVec3(0,1,1));
gForceVec = NxVec3(0,0,0);
// Show debug wireframes
if(bDebugWireframeMode)
{
const NxDebugRenderable * p = gScene->getDebugRenderable();
if(p != NULL)
{
glDisable(GL_LIGHTING);
gDebugRenderer.renderData(*p);
glEnable(GL_LIGHTING);
}
}
DisplayText();
glutSwapBuffers();
}
void ReshapeCallback(int width, int height)
{
glViewport(0, 0, width, height);
}
void IdleCallback()
{
glutPostRedisplay();
}
void KeyboardCallback(unsigned char key, int x, int y)
{
gKeys[key] = true;
switch (key)
{
case 'r': { SelectNextActor(); break; }
case 27 : { exit(0); break; }
default : { break; }
case 'p': { bPause = !bPause; UpdateTime(); break; }
case 'x': { bShadows = !bShadows; break; }
case 'b': { bDebugWireframeMode = !bDebugWireframeMode; break; }
case 'f': { bForceMode = !bForceMode; RefreshDisplayString(); break; }
case '0': { setMotor(0.0f); break; }
case '1': { setMotor(gMotorVelocity); break; }
case '2': { setMotor(-gMotorVelocity); break; }
}
}
void KeyboardUpCallback(unsigned char key, int x, int y)
{
gKeys[key] = false;
}
void MouseCallback(int button, int state, int x, int y)
{
mx = x;
my = y;
}
void MotionCallback(int x, int y)
{
int dx = mx - x;
int dy = my - y;
gCameraForward.normalize();
gCameraRight.cross(gCameraForward,NxVec3(0,1,0));
NxQuat qx(NxPiF32 * dx * 20 / 180.0f, NxVec3(0,1,0));
qx.rotate(gCameraForward);
NxQuat qy(NxPiF32 * dy * 20 / 180.0f, gCameraRight);
qy.rotate(gCameraForward);
mx = x;
my = y;
}
static void ExitCallback()
{
ReleaseNx();
}
void InitGlut(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitWindowSize(512, 512);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
int mainHandle = glutCreateWindow("SamplePullyJoint");
glutSetWindow(mainHandle);
glutDisplayFunc(RenderCallback);
glutReshapeFunc(ReshapeCallback);
glutIdleFunc(IdleCallback);
glutKeyboardFunc(KeyboardCallback);
glutKeyboardUpFunc(KeyboardUpCallback);
glutMouseFunc(MouseCallback);
glutMotionFunc(MotionCallback);
MotionCallback(0,0);
atexit(ExitCallback);
// Setup default render states
glClearColor(0.52f, 0.60f, 0.71f, 1.0f);
glEnable(GL_DEPTH_TEST);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_CULL_FACE);
// Setup lighting
glEnable(GL_LIGHTING);
float AmbientColor[] = { 0.0f, 0.1f, 0.2f, 0.0f };
glLightfv(GL_LIGHT0, GL_AMBIENT, AmbientColor);
float DiffuseColor[] = { 0.2f, 0.2f, 0.2f, 0.0f };
glLightfv(GL_LIGHT0, GL_DIFFUSE, DiffuseColor);
float SpecularColor[] = { 0.5f, 0.5f, 0.5f, 0.0f };
glLightfv(GL_LIGHT0, GL_SPECULAR, SpecularColor);
float Position[] = { 100.0f, 100.0f, -400.0f, 1.0f };
glLightfv(GL_LIGHT0, GL_POSITION, Position);
glEnable(GL_LIGHT0);
}
NxPulleyJoint* CreatePulleyJoint(NxActor* a0, NxActor* a1, const NxVec3& pulley0, const NxVec3& pulley1, const NxVec3& globalAxis, NxReal distance, NxReal ratio)
{
NxPulleyJointDesc pulleyDesc;
pulleyDesc.actor[0] = a0;
pulleyDesc.actor[1] = a1;
pulleyDesc.localAnchor[0] = NxVec3(0,2,0);
pulleyDesc.localAnchor[1] = NxVec3(0,2,0);
pulleyDesc.setGlobalAxis(globalAxis);
pulleyDesc.pulley[0] = pulley0; // suspension points of two bodies in world space.
pulleyDesc.pulley[1] = pulley1; // suspension points of two bodies in world space.
pulleyDesc.distance = distance; // the rest length of the rope connecting the two objects. The distance is computed as ||(pulley0 - anchor0)|| + ||(pulley1 - anchor1)|| * ratio.
pulleyDesc.stiffness = 1.0f; // how stiff the constraint is, between 0 and 1 (stiffest)
pulleyDesc.ratio = ratio; // transmission ratio
pulleyDesc.flags = NX_PJF_IS_RIGID; // This is a combination of the bits defined by ::NxPulleyJointFlag.
pulleyDesc.motor = gMotorDesc;
// pulleyDesc.projectionMode = NX_JPM_NONE;
// pulleyDesc.projectionMode = NX_JPM_POINT_MINDIST;
// pulleyDesc.jointFlags |= NX_JF_COLLISION_ENABLED;
NxJoint* pulleyJoint = gScene->createJoint(pulleyDesc);
return (NxPulleyJoint*)pulleyJoint->is(NX_JOINT_PULLEY);
}
bool InitNx()
{
// Initialize PhysicsSDK
NxPhysicsSDKDesc desc;
NxSDKCreateError errorCode = NXCE_NO_ERROR;
gPhysicsSDK = NxCreatePhysicsSDK(NX_PHYSICS_SDK_VERSION, NULL, new ErrorStream(), desc, &errorCode);
if(gPhysicsSDK == NULL)
{
printf("\nSDK create error (%d - %s).\nUnable to initialize the PhysX SDK, exiting the sample.\n\n", errorCode, getNxSDKCreateError(errorCode));
return false;
}
#if SAMPLES_USE_VRD
// The settings for the VRD host and port are found in SampleCommonCode/SamplesVRDSettings.h
if (gPhysicsSDK->getFoundationSDK().getRemoteDebugger() && !gPhysicsSDK->getFoundationSDK().getRemoteDebugger()->isConnected())
gPhysicsSDK->getFoundationSDK().getRemoteDebugger()->connect(SAMPLES_VRD_HOST, SAMPLES_VRD_PORT, SAMPLES_VRD_EVENTMASK);
#endif
// Set the physics parameters
gPhysicsSDK->setParameter(NX_SKIN_WIDTH, 0.005f);
// Set the debug visualization parameters
gPhysicsSDK->setParameter(NX_VISUALIZATION_SCALE, 1);
gPhysicsSDK->setParameter(NX_VISUALIZE_COLLISION_SHAPES, 1);
gPhysicsSDK->setParameter(NX_VISUALIZE_JOINT_LIMITS, 1);
gPhysicsSDK->setParameter(NX_VISUALIZE_JOINT_LOCAL_AXES, 1);
// Create the scene
NxSceneDesc sceneDesc;
sceneDesc.gravity = gDefaultGravity;
gScene = gPhysicsSDK->createScene(sceneDesc);
if(gScene == NULL)
{
printf("\nError: Unable to create a PhysX scene, exiting the sample.\n\n");
return false;
}
// Create the default material
NxMaterialDesc matDesc;
matDesc.restitution = 0.5;
matDesc.staticFriction = 0.5;
matDesc.dynamicFriction = 0.5;
NxMaterial *mat = gScene->getMaterialFromIndex(0);
mat->loadFromDesc(matDesc);
// Create the default material
NxMaterial* defaultMaterial = gScene->getMaterialFromIndex(0);
defaultMaterial->setRestitution(0.5);
defaultMaterial->setStaticFriction(0.5);
defaultMaterial->setDynamicFriction(0.5);
// Create the objects in the scene
groundPlane = CreateGroundPlane();
capsule1 = CreateCapsule(NxVec3(-1,4,0), 1, 0.5, 10);
capsule1->setLinearDamping(1.5f);
capsule2 = CreateCapsule(NxVec3(1,4,0), 1, 0.5, 20);
capsule2->setLinearDamping(1.5f);
// Motor specs
gMotorDesc.maxForce = NX_MAX_REAL;
gMotorDesc.freeSpin = false;
gMotorDesc.velTarget = 0.0f;
// Test pulley Joint
NxVec3 pulley1 = NxVec3(-1,7,0);
NxVec3 pulley2 = NxVec3(1,7,0);
NxVec3 globalAxis = NxVec3(0,-1,0);
pulleyJoint = CreatePulleyJoint(capsule1, capsule2, pulley1, pulley2, globalAxis, 4.0f, 2.0f);
gSelectedActor = capsule1;
UpdateTime();
RefreshDisplayString();
return true;
}
void ReleaseNx()
{
if(gPhysicsSDK != NULL)
{
if(gScene != NULL) gPhysicsSDK->releaseScene(*gScene);
gScene = NULL;
NxReleasePhysicsSDK(gPhysicsSDK);
gPhysicsSDK = NULL;
}
}
NxReal UpdateTime()
{
NxReal deltaTime;
gTime = timeGetTime()*0.001f; // Get current time in seconds
deltaTime = gTime - gLastTime;
if (deltaTime > 0)
{
gLastTime = gTime;
return deltaTime;
}
else
return 0.0f;
}
void RunPhysics()
{
// Update the time step
NxReal deltaTime = UpdateTime();
// Run collision and dynamics for delta time since the last frame
gScene->simulate(deltaTime);
gScene->flushStream();
gScene->fetchResults(NX_RIGID_BODY_FINISHED, true);
}
int main(int argc, char** argv)
{
PrintControls();
#if defined(_XBOX) || defined(__CELLOS_LV2__)
glutRemapButtonExt(4, 'k', false); //Up to force forward
glutRemapButtonExt(5, 'i', false); //Down to force backward
glutRemapButtonExt(6, 'l', false); //Left to force left
glutRemapButtonExt(7, 'j', false); //Right to force right
glutRemapButtonExt(8, 'u', false); //Left shoulder to force up
glutRemapButtonExt(9, 'm', false); //Right shoulder to force down
glutRemapButtonExt(4, 'w', true); //Shift+Up to camera forward
glutRemapButtonExt(5, 's', true); //Shift+Down to camera backward
glutRemapButtonExt(6, 'a', true); //Shift+Left to camera left
glutRemapButtonExt(7, 'd', true); //Shift+Right to camera right
glutRemapButtonExt(8, 'q', true); //Shift+Left shoulder to camera up
glutRemapButtonExt(9, 'z', true); //Shift+Right shoulder to camera down
glutRemapButtonExt(1, '1', false); //B/O to motor forward
glutRemapButtonExt(2, '2', false); //X/S to motor backward
glutRemapButtonExt(3, '0', false); //Y/T to motor stop
glutRemapButtonExt(0, 'x', true); //Shift+A/X to toggle shadows
glutRemapButtonExt(1, 'r', true); //Shift+B/O to select next actor
glutRemapButtonExt(2, 'f', true); //Shift+X/S to force mode
glutRemapButtonExt(3, 'b', true); //Shift+Y/T to toggle wireframe
#endif
InitGlut(argc, argv);
// Initialize physics scene and start the application main loop if scene was created
if (InitNx())
glutMainLoop();
return 0;
}
| [
"erucarno@789472dc-e1c3-11de-81d3-db62269da9c1"
]
| [
[
[
1,
522
]
]
]
|
4ce008451f4cb7b7db6de232925eb9ec212de3e4 | 91b964984762870246a2a71cb32187eb9e85d74e | /SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/boost/multi_index/detail/index_base.hpp | 09c3979cc4cce64b007d333f172914c84fc4718f | [
"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 | ISO-8859-1 | C++ | false | false | 5,538 | hpp | /* Copyright 2003-2005 Joaquín M López Muñoz.
* 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)
*
* See http://www.boost.org/libs/multi_index for library home page.
*/
#ifndef BOOST_MULTI_INDEX_DETAIL_INDEX_BASE_HPP
#define BOOST_MULTI_INDEX_DETAIL_INDEX_BASE_HPP
#if defined(_MSC_VER)&&(_MSC_VER>=1200)
#pragma once
#endif
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <boost/call_traits.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/multi_index/detail/copy_map.hpp>
#include <boost/multi_index/detail/node_type.hpp>
#include <boost/multi_index_container_fwd.hpp>
#include <boost/tuple/tuple.hpp>
#include <utility>
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
#include <boost/multi_index/detail/index_loader.hpp>
#include <boost/multi_index/detail/index_saver.hpp>
#endif
namespace boost{
namespace multi_index{
namespace detail{
/* The role of this class is threefold:
* - tops the linear hierarchy of indices.
* - terminates some cascading backbone function calls (insert_, etc.),
* - grants access to the backbone functions of the final
* multi_index_container class (for access restriction reasons, these
* cannot be called directly from the index classes.)
*/
template<typename Value,typename IndexSpecifierList,typename Allocator>
class index_base
{
protected:
typedef index_node_base<Value> node_type;
typedef typename multi_index_node_type<
Value,IndexSpecifierList,Allocator>::type final_node_type;
typedef multi_index_container<
Value,IndexSpecifierList,Allocator> final_type;
typedef tuples::null_type ctor_args_list;
typedef typename
boost::detail::allocator::rebind_to<
Allocator,
typename Allocator::value_type>::type final_allocator_type;
typedef mpl::vector0<> index_type_list;
typedef mpl::vector0<> iterator_type_list;
typedef mpl::vector0<> const_iterator_type_list;
typedef copy_map<
final_node_type,
final_allocator_type> copy_map_type;
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
typedef index_saver<
node_type,
final_allocator_type> index_saver_type;
typedef index_loader<
node_type,
final_node_type,
final_allocator_type> index_loader_type;
#endif
private:
typedef typename call_traits<Value>::param_type value_param_type;
protected:
explicit index_base(const ctor_args_list&,const Allocator&){}
void copy_(
const index_base<Value,IndexSpecifierList,Allocator>&,const copy_map_type&)
{}
node_type* insert_(value_param_type v,node_type* x)
{
boost::detail::allocator::construct(&x->value(),v);
return x;
}
node_type* insert_(value_param_type v,node_type*,node_type* x)
{
boost::detail::allocator::construct(&x->value(),v);
return x;
}
void erase_(node_type* x)
{
boost::detail::allocator::destroy(&x->value());
}
void delete_node_(node_type* x)
{
boost::detail::allocator::destroy(&x->value());
}
void clear_(){}
void swap_(index_base<Value,IndexSpecifierList,Allocator>&){}
bool replace_(value_param_type v,node_type* x)
{
x->value()=v;
return true;
}
bool modify_(node_type*){return true;}
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
/* serialization */
template<typename Archive>
void save_(Archive&,const unsigned int,const index_saver_type&)const{}
template<typename Archive>
void load_(Archive&,const unsigned int,const index_loader_type&){}
#endif
#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)
/* invariant stuff */
bool invariant_()const{return true;}
#endif
/* access to backbone memfuns of Final class */
final_type& final(){return *static_cast<final_type*>(this);}
const final_type& final()const{return *static_cast<const final_type*>(this);}
final_node_type* final_header()const{return final().header();}
bool final_empty_()const{return final().empty_();}
std::size_t final_size_()const{return final().size_();}
std::size_t final_max_size_()const{return final().max_size_();}
std::pair<final_node_type*,bool> final_insert_(value_param_type x)
{return final().insert_(x);}
std::pair<final_node_type*,bool> final_insert_(
value_param_type x,final_node_type* position)
{return final().insert_(x,position);}
void final_erase_(final_node_type* x){final().erase_(x);}
void final_delete_node_(final_node_type* x){final().delete_node_(x);}
void final_delete_all_nodes_(){final().delete_all_nodes_();}
void final_clear_(){final().clear_();}
void final_swap_(final_type& x){final().swap_(x);}
bool final_replace_(
value_param_type k,final_node_type* x)
{return final().replace_(k,x);}
template<typename Modifier>
bool final_modify_(Modifier mod,final_node_type* x)
{return final().modify_(mod,x);}
#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)
void final_check_invariant_()const{final().check_invariant_();}
#endif
};
} /* namespace multi_index::detail */
} /* namespace multi_index */
} /* namespace boost */
#endif
| [
"[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278"
]
| [
[
[
1,
179
]
]
]
|
c1d02b285124079f343f2e4ec09b0ccc845a7859 | 53e701fe83f4fad3439d7acfde20a3a86f869a02 | /main.cpp | 4842d2422f2e64cec21fb646265b9d0d8f9909e9 | []
| no_license | odashi/x2msh | 3417c175ffd16b629661d60184dc321dfdf1fa38 | 6c46e99dcd5870c06b117be50a685cdda2ce05e6 | refs/heads/master | 2021-01-10T22:01:21.951134 | 2011-10-16T10:21:35 | 2011-10-16T10:21:35 | 2,542,268 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 2,302 | cpp | // mqo2msh.cpp
#include <iostream>
#include <fstream>
#include <string>
#include <exception>
#include <boost/scoped_array.hpp>
#include "XParser.h"
#include "Mesh.h"
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
using namespace std;
int main(int argc, char **argv)
{
// 終了時にヒープのチェックをする
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
if (argc != 2 && argc != 3)
{
// 引数がおかしい
cout << "USAGE: x2msh <input file> [<output file>]" << endl;
return 1;
}
// ファイル名
string infilename = argv[1];
string outfilename;
if (argc == 3)
outfilename = argv[2];
else
{
size_t dot_pos = infilename.find_last_of('.');
if (dot_pos == string::npos)
outfilename = infilename;
else
outfilename = infilename.substr(0, dot_pos);
outfilename += ".msh";
}
cout << "Input : " << infilename << endl;
cout << "Output: " << outfilename << endl;
try
{
// ファイルを開く
ifstream fin(infilename.c_str(), ios::in | ios::binary);
if (!fin.is_open())
throw exception(("Opening \"" + infilename + "\" failed.").c_str());
// ファイルサイズを取得
size_t avail;
fin.peek(); // 強制的にファイルを開く
fin.seekg(0, ios::end);
avail = fin.tellg();
fin.seekg(0, ios::beg);
// 文字列バッファに読み込み
boost::scoped_array<char> buffer(new char[avail+1]);
fin.read(buffer.get(), avail);
buffer[avail] = '\0';
// Xファイルの解析
cout << "Parsing \"" << infilename << "\" ... ";
XDataList data_list;
XParser::Parse(buffer.get(), avail, data_list);
cout << "Succeeded." << endl;
// メッシュ情報の構築
cout << "Restructuring ... ";
Mesh mesh(data_list);
cout << "Succeeded." << endl;
// メッシュ情報の書き出し
cout << "Writing \"" << outfilename << "\" ... ";
mesh.WriteOut(outfilename.c_str());
cout << "Succeeded." << endl;
}
catch (exception &e)
{
cout << endl;
cerr << "**** ERROR **** " << e.what() << endl;
return 1;
}
catch (...)
{
cout << endl;
cerr << "**** ERROR **** Unknown error." << endl;
return 1;
}
cout << "Converting completed successfully." << endl;
return 0;
}
| [
"[email protected]"
]
| [
[
[
1,
96
]
]
]
|
1118dbfd6f0d80d248ac34f881778272c5a091aa | 4c3c35e4fe1ff2567ef20f0b203fe101a4a2bf20 | /HW5/src/Gz.h | 4f5f9f2c8fd7fa0c36b16835581ea671afeacf30 | []
| no_license | kolebole/monopolocoso | 63c0986707728522650bd2704a5491d1da20ecf7 | a86c0814f5da2f05e7676b2e41f6858d87077e6a | refs/heads/master | 2021-01-19T15:04:09.283953 | 2011-03-27T23:21:53 | 2011-03-27T23:21:53 | 34,309,551 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,527 | h | #ifndef __GZ_H_
#define __GZ_H_
#include "GzCommon.h"
#include "GzImage.h"
#include "GzFrameBuffer.h" //For assignment #1, #2
#include "GzMatrix.h" //For assignment #3
#include "GzVector.h" //For assignment #4
#include <queue>
using namespace std;
class Gz {
//============================================================================
//Declarations in Assignment #1
//============================================================================
public:
void initFrameSize(GzInt width, GzInt height); //Initialize
GzImage toImage(); //Convert the current rendering result to image
void clear(GzFunctional buffer); //Clear buffers to preset values
void clearColor(const GzColor& color); //Specify clear values for the color buffer
void clearDepth(GzReal depth); //Specify the clear value for the depth buffer
void enable(GzFunctional f); //Enable some capabilities
void disable(GzFunctional f); //Disable some capabilities
GzBool get(GzFunctional f); //Return the value of a selected parameter
void begin(GzPrimitiveType p); //Delimit the vertices of a primitive
void end(); //End of limit
void addVertex(const GzVertex& v); //Specify a vertex
void addColor(const GzColor& c); //Specify a color
private:
GzFrameBuffer frameBuffer; //The frame buffer
queue<GzVertex> vertexQueue; //Store vertices in queue for rendering
queue<GzColor> colorQueue; //Store colors in queue for rendering
GzPrimitiveType currentPrimitive; //The current primitive, set by Gz::begin()
GzFunctional status; //Current capabilities
//============================================================================
//End of Declarations in Assignment #1
//============================================================================
//============================================================================
//Declarations in Assignment #3
//============================================================================
public:
void viewport(GzInt x, GzInt y); //Set the viewport center at (x, y)
//Transformations---------------------------------------------------------
void lookAt(GzReal eyeX, GzReal eyeY, GzReal eyeZ,
GzReal centerX, GzReal centerY, GzReal centerZ,
GzReal upX, GzReal upY, GzReal upZ); //Define viewing transformation
void translate(GzReal x, GzReal y, GzReal z); //Multiply transMatrix by a translation matrix
void rotate(GzReal angle, GzReal x, GzReal y, GzReal z); //Multiply transMatrix by a rotation matrix
void scale(GzReal x, GzReal y, GzReal z); //Multiply transMatrix by a scaling matrix
void multMatrix(GzMatrix mat); //Multiply transMatrix by the matrix mat
//End of Transformations--------------------------------------------------
//Projections-------------------------------------------------------------
void perspective(GzReal fovy, GzReal aspect,
GzReal zNear, GzReal zFar); //Set up a perspective projection matrix
void orthographic(GzReal left, GzReal right, GzReal bottom, GzReal top,
GzReal nearVal, GzReal farVal); //Set up a orthographic projection matrix
//End of Projections------------------------------------------------------
private:
GzMatrix transMatrix; //The transformation matrix
GzMatrix prjMatrix; //The projection matrix
GzReal xViewport, yViewport; //The center of the viewport
GzReal wViewport, hViewport; //Size of the viewport
//Design function
GzVertex transAll(GzVertex& v);
//============================================================================
//End of Declarations in Assignment #3
//============================================================================
//============================================================================
//Declarations in Assignment #4
//============================================================================
public:
void shadeModel(const GzInt model); //Set the current shade model (curShadeModel)
void addLight(const GzVector& v, const GzColor& c); //Add a light source at position p with color c
void material(GzReal _kA, GzReal _kD, GzReal _kS, GzReal _s); //Specify the meterial of the object, includes:
// _kA: The ambient coefficients
// _kD: The diffuse coefficients
// _kS: The specular coefficients
// _s: The spec power
void addNormal(const GzVector& v); //Specify a normal vector
private:
queue<GzVector> normalQueue; //Store normal vectors in queue for rendering
GzMatrix transNormalMatrix; //The normal vectors transformation matrix
//============================================================================
//End of Declarations in Assignment #4
//============================================================================
//============================================================================
//Declarations in Assignment #5
//============================================================================
public:
void texture(const GzImage& t); //Specify the texture
void addTexCoord(const GzTexCoord& tc); //Specify the texture coordinate
private:
queue<GzTexCoord> texCoordQueue; //Store texture coordinates in queue for rendering
//============================================================================
//End of Declarations in Assignment #5
//============================================================================
};
#endif
| [
"[email protected]@a7811d78-34aa-4512-2aaf-9c23cbf1bc95"
]
| [
[
[
1,
120
]
]
]
|
f19aef9dca04cb136debef60cb9efa52321b3e2a | 3856c39683bdecc34190b30c6ad7d93f50dce728 | /server/UI_ConnectionList.h | 8bb961ede087232705b8d37f11ea2a47cb3bda0b | []
| no_license | yoonhada/nlinelast | 7ddcc28f0b60897271e4d869f92368b22a80dd48 | 5df3b6cec296ce09e35ff0ccd166a6937ddb2157 | refs/heads/master | 2021-01-20T09:07:11.577111 | 2011-12-21T22:12:36 | 2011-12-21T22:12:36 | 34,231,967 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 238 | h | #ifndef _UI_CONNECTIONLIST_H_
#define _UI_CONNECTIONLIST_H_
#include "UI.h"
class CUI_ConnectionList : public CUI
{
private:
public:
CUI_ConnectionList();
virtual ~CUI_ConnectionList();
VOID Draw();
};
#endif | [
"[email protected]@d02aaf57-2019-c8cd-d06c-d029ef2af4e0"
]
| [
[
[
1,
20
]
]
]
|
b256dabbe313a1d21caf473ceb1f67d80367f93f | 5236606f2e6fb870fa7c41492327f3f8b0fa38dc | /srpc/include/srpc/IStream.h | 24031386cf2ff3a52bca0f3e04837bd48fd24a58 | []
| 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 | 5,158 | h | #ifndef SRPC_ISTREAM_H
#define SRPC_ISTREAM_H
#ifdef _MSC_VER
# pragma once
#endif
#include "Types.h"
#include "StringTypes.h"
#include "utility/Bits.h"
#ifdef _MSC_VER
# pragma warning (push)
# pragma warning (disable: 4819)
#endif
#include <boost/type_traits/integral_constant.hpp>
#include <boost/type_traits/is_fundamental.hpp>
#include <boost/utility.hpp>
#ifdef _MSC_VER
# pragma warning (pop)
#endif
#include <string>
#include <cassert>
namespace srpc {
class IStream;
/** @addtogroup serialization
* @{
*/
namespace
{
/// 기본 데이터형이 아닌 것은 무조건 RpcType으로 가정
template <typename T, bool isFundamental, bool isEnum>
struct StreamReaderImpl;
// fundamental type
template <typename T>
struct StreamReaderImpl<T, true, false>
{
static void read(IStream& istream, T& value) {
istream.read(value);
}
};
// enum type
template <typename T>
struct StreamReaderImpl<T, false, true>
{
static void read(IStream& istream, T& value) {
Int32 intValue;
istream.read(intValue);
value = static_cast<T>(intValue);
}
};
template <typename T>
struct StreamReaderImpl<T, false, false>
{
static void read(IStream& istream, T& value) {
value.serialize(istream);
}
};
} // namespace
/**
* @class IStream
*
* Input stream.
* - CAUTION: 데이터 타입을 기준으로 스트림에서 읽어온다
*/
class IStream : public boost::noncopyable
{
public:
virtual ~IStream() {}
template <typename T>
IStream& operator>>(T& value) {
StreamReaderImpl<T, boost::is_fundamental<T>::value,
boost::is_enum<T>::value>::read(*this, value);
return *this;
}
/// same as boost.serialization
template <typename T>
IStream& operator&(T& value) {
return operator>>(value);
}
/// 스트림버퍼로 부터 64비트 부호 없는 정수 타입을 읽어 온다
virtual void read(UInt64& value, int bitCount = Bits<UInt64>::size) = 0;
/// 스트림버퍼로 부터 32비트 부호 없는 정수 타입을 읽어 온다
virtual void read(UInt32& value, int bitCount = Bits<UInt32>::size) = 0;
/// 스트림버퍼로 부터 16비트 부호 없는 정수 타입을 읽어 온다
virtual void read(UInt16& value, int bitCount = Bits<UInt16>::size) = 0;
/// 스트림버퍼로 부터 8비트 부호 없는 정수 타입을 읽어 온다
virtual void read(UInt8& value, int bitCount = Bits<UInt8>::size) = 0;
/// 스트림버퍼로 부터 64비트 부호 있는 정수 타입을 읽어 온다
virtual void read(Int64& value, int bitCount = Bits<Int64>::size) = 0;
/// 스트림버퍼로 부터 32비트 부호 있는 정수 타입을 읽어 온다
virtual void read(Int32& value, int bitCount = Bits<Int32>::size) = 0;
/// 스트림버퍼로 부터 16비트 부호 있는 정수 타입을 읽어 온다
virtual void read(Int16& value, int bitCount = Bits<Int16>::size) = 0;
/// 스트림버퍼로 부터 8비트 부호 있는 정수 타입을 읽어 온다
virtual void read(Int8& value, int bitCount = Bits<Int8>::size) = 0;
/// 스트림버퍼로 부터 부울린값을 읽어 온다
virtual void read(bool& value, int bitCount = Bits<bool>::size) = 0;
/// 스트림버퍼로 부터 32비트 부동 소숫점 타입을 읽어 온다
virtual void read(Float32& value, int bitCount = Bits<Int32>::size) = 0;
/// 최대 maxLength 길이의 문자열을 읽어온다
virtual void read(String& value, size_t maxLength,
int sizeBitCount) = 0;
/// 최대 maxLength 길이의 문자열을 읽어온다
virtual void read(WString& value, size_t maxLength,
int sizeBitCount) = 0;
/**
* 스트림버퍼로 부터 raw buffer를 읽어 온다
* @param buffer 입력 버퍼. 반드 length 이상의 메모리를 확보해야 한다.
* @param length 읽어올 바이트 수
*/
virtual void read(void* buffer, UInt16 length) = 0;
/// 스트림을 바이트 단위로 정렬한다(버퍼에 남아있는 비트를 버린다)
virtual void align() = 0;
/**
* 스트림을 초기화한다.
* @param resetBuffer 버퍼를 초기화할 것인가?
*/
virtual void reset(bool resetBuffer) = 0;
/// 버퍼에 남아 있는 데이터의 총 크기(비트 단위)를 얻는다
virtual int getTotalBitCount() const = 0;
/// 버퍼에 남아 있는 데이터의 총 크기(바이트 단위)를 얻는다
virtual int getTotalSize() const = 0;
template <typename T>
void do_read(T& value, int sizeBitCount, const boost::false_type&) {
read(value, sizeBitCount);
}
template <typename T>
void do_read(T& value, int sizeBitCount, const boost::true_type&) {
Int32 temp;
read(temp, sizeBitCount);
value = static_cast<T>(temp);
}
};
/** @} */ // addtogroup serialization
} // namespace srpc
#endif // SRPC_ISTREAM_H
| [
"kcando@6d7ccee0-1a3b-0410-bfa1-83648d9ec9a4"
]
| [
[
[
1,
171
]
]
]
|
fd1ec288b00ae76b790b06c01bb2c6977561757f | a84b013cd995870071589cefe0ab060ff3105f35 | /webdriver/branches/chrome_extension/third_party/gecko-1.9.0.11/win32/include/nsIWeakReference.h | fae7f7aae994b50911d2c41e9fed394fc2403263 | [
"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 | 6,865 | h | /*
* DO NOT EDIT. THIS FILE IS GENERATED FROM e:/xr19rel/WINNT_5.2_Depend/mozilla/xpcom/base/nsIWeakReference.idl
*/
#ifndef __gen_nsIWeakReference_h__
#define __gen_nsIWeakReference_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIWeakReference */
#define NS_IWEAKREFERENCE_IID_STR "9188bc85-f92e-11d2-81ef-0060083a0bcf"
#define NS_IWEAKREFERENCE_IID \
{0x9188bc85, 0xf92e, 0x11d2, \
{ 0x81, 0xef, 0x00, 0x60, 0x08, 0x3a, 0x0b, 0xcf }}
/**
* An instance of |nsIWeakReference| is a proxy object that cooperates with
* its referent to give clients a non-owning, non-dangling reference. Clients
* own the proxy, and should generally manage it with an |nsCOMPtr| (see the
* type |nsWeakPtr| for a |typedef| name that stands out) as they would any
* other XPCOM object. The |QueryReferent| member function provides a
* (hopefully short-lived) owning reference on demand, through which clients
* can get useful access to the referent, while it still exists.
*
* @status FROZEN
* @version 1.0
* @see nsISupportsWeakReference
* @see nsWeakReference
* @see nsWeakPtr
*/
class NS_NO_VTABLE NS_SCRIPTABLE nsIWeakReference : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IWEAKREFERENCE_IID)
/**
* |QueryReferent| queries the referent, if it exists, and like |QueryInterface|, produces
* an owning reference to the desired interface. It is designed to look and act exactly
* like (a proxied) |QueryInterface|. Don't hold on to the produced interface permanently;
* that would defeat the purpose of using a non-owning |nsIWeakReference| in the first place.
*/
/* void QueryReferent (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
NS_SCRIPTABLE NS_IMETHOD QueryReferent(const nsIID & uuid, void * *result) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIWeakReference, NS_IWEAKREFERENCE_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIWEAKREFERENCE \
NS_SCRIPTABLE NS_IMETHOD QueryReferent(const nsIID & uuid, void * *result);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIWEAKREFERENCE(_to) \
NS_SCRIPTABLE NS_IMETHOD QueryReferent(const nsIID & uuid, void * *result) { return _to QueryReferent(uuid, result); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIWEAKREFERENCE(_to) \
NS_SCRIPTABLE NS_IMETHOD QueryReferent(const nsIID & uuid, void * *result) { return !_to ? NS_ERROR_NULL_POINTER : _to->QueryReferent(uuid, result); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsWeakReference : public nsIWeakReference
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWEAKREFERENCE
nsWeakReference();
private:
~nsWeakReference();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsWeakReference, nsIWeakReference)
nsWeakReference::nsWeakReference()
{
/* member initializers and constructor code */
}
nsWeakReference::~nsWeakReference()
{
/* destructor code */
}
/* void QueryReferent (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
NS_IMETHODIMP nsWeakReference::QueryReferent(const nsIID & uuid, void * *result)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
/* starting interface: nsISupportsWeakReference */
#define NS_ISUPPORTSWEAKREFERENCE_IID_STR "9188bc86-f92e-11d2-81ef-0060083a0bcf"
#define NS_ISUPPORTSWEAKREFERENCE_IID \
{0x9188bc86, 0xf92e, 0x11d2, \
{ 0x81, 0xef, 0x00, 0x60, 0x08, 0x3a, 0x0b, 0xcf }}
/**
* |nsISupportsWeakReference| is a factory interface which produces appropriate
* instances of |nsIWeakReference|. Weak references in this scheme can only be
* produced for objects that implement this interface.
*
* @status FROZEN
* @version 1.0
* @see nsIWeakReference
* @see nsSupportsWeakReference
*/
class NS_NO_VTABLE NS_SCRIPTABLE nsISupportsWeakReference : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISUPPORTSWEAKREFERENCE_IID)
/**
* |GetWeakReference| produces an appropriate instance of |nsIWeakReference|.
* As with all good XPCOM `getters', you own the resulting interface and should
* manage it with an |nsCOMPtr|.
*
* @see nsIWeakReference
* @see nsWeakPtr
* @see nsCOMPtr
*/
/* nsIWeakReference GetWeakReference (); */
NS_SCRIPTABLE NS_IMETHOD GetWeakReference(nsIWeakReference **_retval) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsISupportsWeakReference, NS_ISUPPORTSWEAKREFERENCE_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSISUPPORTSWEAKREFERENCE \
NS_SCRIPTABLE NS_IMETHOD GetWeakReference(nsIWeakReference **_retval);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSISUPPORTSWEAKREFERENCE(_to) \
NS_SCRIPTABLE NS_IMETHOD GetWeakReference(nsIWeakReference **_retval) { return _to GetWeakReference(_retval); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSISUPPORTSWEAKREFERENCE(_to) \
NS_SCRIPTABLE NS_IMETHOD GetWeakReference(nsIWeakReference **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetWeakReference(_retval); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsSupportsWeakReference : public nsISupportsWeakReference
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISUPPORTSWEAKREFERENCE
nsSupportsWeakReference();
private:
~nsSupportsWeakReference();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsSupportsWeakReference, nsISupportsWeakReference)
nsSupportsWeakReference::nsSupportsWeakReference()
{
/* member initializers and constructor code */
}
nsSupportsWeakReference::~nsSupportsWeakReference()
{
/* destructor code */
}
/* nsIWeakReference GetWeakReference (); */
NS_IMETHODIMP nsSupportsWeakReference::GetWeakReference(nsIWeakReference **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#ifdef MOZILLA_INTERNAL_API
#include "nsIWeakReferenceUtils.h"
#endif
#endif /* __gen_nsIWeakReference_h__ */
| [
"simon.m.stewart@07704840-8298-11de-bf8c-fd130f914ac9"
]
| [
[
[
1,
207
]
]
]
|
5a61effdea70a88365c2dca90395e9838b753020 | 83eb2c294effbd7640cdb8c7a8620b565d027f64 | /src/ImageGalleryEntry.cpp | 95b075f798de19005e8d95d2f0ac659491c9078e | []
| no_license | drstrangecode/BadaImageGallery_SampleApp | 0dac8d048777731662321dc72eafc388d53736e1 | 70242e82ae8c8b063ce3b5f8a4c9c269d01e1d94 | refs/heads/master | 2020-06-04T21:24:23.993780 | 2011-10-06T19:31:20 | 2011-10-06T19:31:20 | 2,528,300 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,144 | cpp | /**
* This file contains the bada application entry point.
*/
#include "ImageGallery.h"
using namespace Osp::Base;
using namespace Osp::Base::Collection;
#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus
_EXPORT_ int OspMain(int argc, char *pArgv[]);
#ifdef _PROFILE
extern void start_profile (void);
extern void end_profile (void);
#else
#define start_profile()
#define end_profile()
#endif
/**
* The entry function of bada application called by the operating system.
*/
int
OspMain(int argc, char *pArgv[])
{
result r = E_SUCCESS;
AppLog("Application started.");
ArrayList* pArgs = new ArrayList();
pArgs->Construct();
for (int i = 0; i < argc; i++)
pArgs->Add(*(new String(pArgv[i])));
start_profile();
r = Osp::App::Application::Execute(ImageGallery::CreateInstance, pArgs);
if (IsFailed(r))
{
AppLogException("Application execution failed-[%s].", GetErrorMessage(r));
r &= 0x0000FFFF;
}
end_profile();
pArgs->RemoveAll(true);
delete pArgs;
AppLog("Application finished.");
return static_cast<int>(r);
}
#ifdef __cplusplus
}
#endif // __cplusplus
| [
"[email protected]"
]
| [
[
[
1,
55
]
]
]
|
f1c07dee6433e40813af6a9fc2ed3f1f781e99a1 | a6387f0813647cdceb39e889ca19bbaf78597b48 | /tools/screenshot.h | f986f5fd4537d00bef81cb8048191b3185dd852f | []
| no_license | manjeetdahiya/lightscreen-clone | a31e8a68aa8219c334d301d3ef27c4663d790abe | 2a1fd54ff73ea2e623ed297dddacc7ac38923f1c | refs/heads/master | 2020-09-12T19:35:34.938255 | 2010-07-14T10:08:03 | 2010-07-14T10:08:03 | 774,260 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,495 | h | #ifndef SCREENSHOT_H
#define SCREENSHOT_H
#include <QObject>
#include <QString>
#include <QDir>
#include <QPixmap>
#include <QVariantMap>
class Screenshot : public QObject
{
Q_OBJECT
public:
enum Format
{
PNG = 0,
JPEG = 1,
BMP = 2,
TIFF = 3
};
enum Naming
{
Numeric = 0,
Date = 1,
};
enum Mode
{
WholeScreen = 0,
ActiveWindow = 1,
SelectedArea = 2,
SelectedWindow = 3
};
struct Options
{
QString fileName;
bool result;
int format;
QString prefix;
int naming;
QDir directory;
int mode;
int quality;
bool flipNaming;
bool currentMonitor;
bool clipboard;
bool file;
bool preview;
bool magnify;
bool cursor;
bool saveAs;
bool animations;
};
Screenshot(QObject *parent, Screenshot::Options options);
~Screenshot();
Screenshot::Options options();
QPixmap &pixmap();
QString newFileName();
public slots:
void take();
void confirm(bool result = true);
void discard();
void save();
void setPixmap(QPixmap pixmap);
signals:
void askConfirmation();
void finished();
private:
void activeWindow();
QString extension();
void selectedArea();
void selectedWindow();
void wholeScreen();
void grabDesktop();
private:
Screenshot::Options mOptions;
QPixmap mPixmap;
bool mPixmapDelay;
};
#endif // SCREENSHOT_H
| [
"k39@80aa95d3-9837-0410-88af-92ee65f5bde1"
]
| [
[
[
1,
93
]
]
]
|
478bdef13cee23a7af901f37265edd2967a598cb | cd0987589d3815de1dea8529a7705caac479e7e9 | /webkit/WebKit2/UIProcess/API/C/WKFramePolicyListener.cpp | 75695db8a45723af06688f981b1e43af9e2bdce9 | []
| no_license | 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 | 2,024 | cpp | /*
* Copyright (C) 2010 Apple 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:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 "WKFramePolicyListener.h"
#include "WKAPICast.h"
#include "WebFramePolicyListenerProxy.h"
#include "WebFrameProxy.h"
using namespace WebKit;
WKTypeID WKFramePolicyListenerGetTypeID()
{
return toRef(WebFramePolicyListenerProxy::APIType);
}
void WKFramePolicyListenerUse(WKFramePolicyListenerRef policyListenerRef)
{
toWK(policyListenerRef)->use();
}
void WKFramePolicyListenerDownload(WKFramePolicyListenerRef policyListenerRef)
{
toWK(policyListenerRef)->download();
}
void WKFramePolicyListenerIgnore(WKFramePolicyListenerRef policyListenerRef)
{
toWK(policyListenerRef)->ignore();
}
| [
"[email protected]"
]
| [
[
[
1,
52
]
]
]
|
fcf6a8fd506c8dcdf1583d912625d006bbdc418d | 38664d844d9fad34e88160f6ebf86c043db9f1c5 | /branches/initialize/skin/test/kPad_src/OptionDlg.h | d735eb9c394e50344f2558af6cff4e40477b5a97 | []
| no_license | cnsuhao/jezzitest | 84074b938b3e06ae820842dac62dae116d5fdaba | 9b5f6cf40750511350e5456349ead8346cabb56e | refs/heads/master | 2021-05-28T23:08:59.663581 | 2010-11-25T13:44:57 | 2010-11-25T13:44:57 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,926 | h | /*
Copyright (c) 2000
Author: Konstantin Boukreev
E-mail: [email protected]
Created: 11.07.2000 14:23:49
Version: 1.0.0
*/
#ifndef _OptionDlg_8118f492_cb27_4b5d_a57a_60666dd352e5
#define _OptionDlg_8118f492_cb27_4b5d_a57a_60666dd352e5
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class kOptionDlg :
public CDialogImpl<kOptionDlg>
{
kColorPickerButton m_btnTextColor;
kColorPickerButton m_btnBackColor;
kFontCombo m_comboFontName;
kFlatCombo m_comboFontSize;
kFlatCombo m_comboApply;
int m_nUpdate;
public:
enum {applyDefault, applyActive, applyActiveDefault};
kOption m_option;
int m_nApply;
int m_nChange;
public:
kOptionDlg(kOption option, int nApply) :
m_option(option),
m_nApply(nApply),
m_nChange(0)
{
m_nUpdate = 0;
}
enum { IDD = IDD_OPTION };
BEGIN_MSG_MAP(CAboutDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
COMMAND_ID_HANDLER(IDOK, OnOk)
COMMAND_ID_HANDLER(IDAPPLY, OnApply)
COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
COMMAND_CODE_HANDLER(EN_CHANGE, OnUpdateUI)
COMMAND_HANDLER(IDC_COMBO_FONT, CBN_EDITCHANGE, OnUpdateUI)
COMMAND_HANDLER(IDC_COMBO_FONT, CBN_SELCHANGE, OnUpdateUI)
COMMAND_HANDLER(IDC_COMBO_SIZE, CBN_EDITCHANGE, OnUpdateUI)
COMMAND_HANDLER(IDC_COMBO_SIZE, CBN_SELCHANGE, OnUpdateUI)
COMMAND_HANDLER(IDC_TEXT_COLOR, BN_CLICKED, OnUpdateUI)
COMMAND_HANDLER(IDC_TEXT_COLOR, BN_CLICKED, OnUpdateUI)
COMMAND_HANDLER(IDC_BACK_COLOR, BN_CLICKED, OnUpdateUI)
COMMAND_HANDLER(IDC_BACK_COLOR, BN_CLICKED, OnUpdateUI)
COMMAND_HANDLER(IDC_AUTO_URL, BN_CLICKED, OnUpdateUI)
COMMAND_HANDLER(IDC_WORD_WRAP, BN_CLICKED, OnUpdateUI)
REFLECT_NOTIFICATIONS()
END_MSG_MAP()
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CenterWindow(GetParent());
m_comboApply.SubclassWindow(GetDlgItem(IDC_COMBO_APPLY));
m_comboFontSize.SubclassWindow(GetDlgItem(IDC_COMBO_SIZE));
RECT rc;
::GetWindowRect(GetDlgItem(IDC_COMBO_FONT), &rc);
::DestroyWindow(GetDlgItem(IDC_COMBO_FONT));
ScreenToClient(&rc);
rc.bottom += 150;
m_comboFontName.CreateEx(m_hWnd, rc, -1, IDC_COMBO_FONT);
////// !
m_comboFontSize.LimitText(4);
TCHAR str[10];
for( int i=0; i < sizeof font_size / sizeof font_size[0]; i++ )
{
wsprintf(str, "%d", font_size[i] );
m_comboFontSize.AddString( str );
}
/////////
TCHAR* sApply [] = {
_T("Default"),
_T("Active view"),
_T("Active view and default") };
int nCount = (m_nApply == applyDefault) ? 1 : sizeof sApply / sizeof sApply[0];
for( int x = 0; x < nCount; x++ )
m_comboApply.AddString( sApply[x] );
m_btnTextColor.SubclassWindow(GetDlgItem(IDC_TEXT_COLOR));
m_btnBackColor.SubclassWindow(GetDlgItem(IDC_BACK_COLOR));
SetData();
m_nUpdate = 0;
::EnableWindow(GetDlgItem(IDOK), FALSE);
::EnableWindow(GetDlgItem(IDAPPLY), FALSE);
return TRUE;
}
LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
return 0;
}
LRESULT OnOk(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
GetData();
int nApply = m_comboApply.GetCurSel();
if (nApply != m_nApply)
{
m_nApply = nApply;
m_nChange = kOption::opAll;
}
EndDialog(wID);
return 0;
}
LRESULT OnApply(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
GetData();
::EnableWindow(GetDlgItem(IDAPPLY), FALSE);
::EnableWindow(GetDlgItem(IDOK), TRUE);
return 0;
}
LRESULT OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
EndDialog(wID);
return 0;
}
LRESULT OnUpdateUI(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled)
{
bHandled = FALSE;
if (!m_nUpdate)
{
::EnableWindow(GetDlgItem(IDAPPLY), TRUE);
::EnableWindow(GetDlgItem(IDOK), TRUE);
}
switch (wID)
{
case IDC_COMBO_FONT: m_nUpdate |= kOption::opFontName; break;
case IDC_COMBO_SIZE: m_nUpdate |= kOption::opFontSize; break;
case IDC_TEXT_COLOR: m_nUpdate |= kOption::opTextColor; break;
case IDC_BACK_COLOR: m_nUpdate |= kOption::opBackColor; break;
case IDC_LEFT_MARGIN: m_nUpdate |= kOption::opLeftMargin; break;
case IDC_RIGHT_MARGIN: m_nUpdate |= kOption::opRightMargin; break;
case IDC_TAB_COUNT: m_nUpdate |= kOption::opTabCount; break;
case IDC_UNDO_SIZE: m_nUpdate |= kOption::opUndoSize; break;
case IDC_MAX_BUFFER: m_nUpdate |= kOption::opMaxBuffer; break;
case IDC_AUTO_URL: m_nUpdate |= kOption::opAutoURL; break;
case IDC_WORD_WRAP: m_nUpdate |= kOption::opWordWrap; break;
default:
ATLASSERT(0);
}
return 0;
}
void SetData()
{
SetDlgItemInt(IDC_RIGHT_MARGIN, m_option.RightMargin);
SetDlgItemInt(IDC_LEFT_MARGIN, m_option.LeftMargin);
SetDlgItemInt(IDC_TAB_COUNT, m_option.TabCount);
SetDlgItemInt(IDC_UNDO_SIZE, m_option.UndoSize);
SetDlgItemInt(IDC_MAX_BUFFER, m_option.MaxBuffer);
TCHAR sSize[10];
wsprintf(sSize, _T("%u"), m_option.FontSize);
m_comboFontSize.SelectString(-1, sSize);
m_comboFontName.SelectString(-1, m_option.szFontName);
m_comboApply.SetCurSel(m_nApply);
m_btnTextColor.m_clr = m_option.TextColor;
m_btnBackColor.m_clr = m_option.BackColor;
CheckDlgButton(IDC_AUTO_URL, m_option.AutoURL ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(IDC_WORD_WRAP, m_option.WordWrap ? BST_CHECKED : BST_UNCHECKED);
}
void GetData()
{
if (m_nUpdate & kOption::opFontName)
m_comboFontName.GetWindowText(m_option.szFontName, LF_FACESIZE);
if (m_nUpdate & kOption::opFontSize)
m_option.FontSize = min(72, max(6, GetDlgItemInt(IDC_COMBO_SIZE)));
if (m_nUpdate & kOption::opTextColor)
m_option.TextColor = m_btnTextColor.m_clr;
if (m_nUpdate & kOption::opBackColor)
m_option.BackColor = m_btnBackColor.m_clr;
if (m_nUpdate & kOption::opLeftMargin)
m_option.LeftMargin = GetDlgItemInt(IDC_LEFT_MARGIN);
if (m_nUpdate & kOption::opRightMargin)
m_option.RightMargin = GetDlgItemInt(IDC_RIGHT_MARGIN);
if (m_nUpdate & kOption::opTabCount)
m_option.TabCount = GetDlgItemInt(IDC_TAB_COUNT);
if (m_nUpdate & kOption::opUndoSize)
m_option.UndoSize = GetDlgItemInt(IDC_UNDO_SIZE);
if (m_nUpdate & kOption::opMaxBuffer)
m_option.MaxBuffer = GetDlgItemInt(IDC_MAX_BUFFER);
if (m_nUpdate & kOption::opAutoURL)
m_option.AutoURL = IsDlgButtonChecked(IDC_AUTO_URL) == BST_CHECKED;
if (m_nUpdate & kOption::opWordWrap)
m_option.WordWrap = IsDlgButtonChecked(IDC_WORD_WRAP) == BST_CHECKED;
m_nChange |= m_nUpdate;
m_nUpdate = 0;
}
};
#endif //_OptionDlg_8118f492_cb27_4b5d_a57a_60666dd352e5
| [
"zhongzeng@ba8f1dc9-3c1c-0410-9eed-0f8a660c14bd"
]
| [
[
[
1,
233
]
]
]
|
ade602ea66a278b4e4fd4cd97b5d28fe6e9b1ba7 | fdfaf8e8449c5e80d93999ea665db48feaecccbe | /trunk/cg ex3/ParticleSystem.h | aa3bbee1a70747dc34c81ff79c3f69a1526e41bd | []
| no_license | BackupTheBerlios/glhuji2005-svn | 879e60533f820d1bdcfa436fd27894774c27a0b7 | 3afe113b265704e385c94fabaf99a7d1ad1fdb02 | refs/heads/master | 2016-09-01T17:25:30.876585 | 2006-09-03T18:04:19 | 2006-09-03T18:04:19 | 40,673,356 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,125 | h | #pragma once
#include "constants.h"
class CParticle
{
public:
CParticle() :
m_bAlive(true),
birthplace(0.0,0.0,0.0),
type(0),
X(0.0,0.0,0.0),
a(0.0,0.0,0.0),
V(0.0,0.0,0.0),
F(0.0,0.0,0.0),
mass(1.0),
radius(0.01),
span(-1),
age(0.0),
lifepan(-1.0),
persistance(1.0),
elasticity(1.0),
energy(0.0),
shape(C_PARTICLESHAPE_DOT),
size(1,1,1),
color(0,0,1),
alpha(1)
{
}
//The following 3 are autofilling on Add
bool m_bAlive;
double age; //[sec]
Point3d birthplace; //X at birth
int type; //Can mean anything - inside a specific system. defaults to 0
Point3d X; //position
Point3d a; //acceleration
Point3d V; //velocity
Point3d F; //Force
double mass; //[Kg]
double radius; //[m]
double span; //[m]
double lifepan; //[sec]
double persistance; //0.0-1.0 - the chance of dying (per frame)
double elasticity; //how much of the velocity is preserved when hitting a surface [0.0 - stop when hit anything, 1.0 - full elasticity]
double energy; //how much internal energy does the particle have - isn't used - may be used by each system as needed
ParticleShapeType shape;
Point3d size; //X,Y,Z dimensions
Point3d color; //RGB value
Point3d color2; //RGB value
double alpha; //transparency
Point3d getColor(){
if (color != color2)
{
double coef = age/lifepan;
return (color + (color2 - color) * coef);
}
return color;
}
};
class CParticleSystem
{
protected:
typedef vector<CParticle> ParticleList;
protected:
int m_nCurFrame;
bool m_bUsingA;
double m_dt;
ParticleList m_ParticlesA;
ParticleList m_ParticlesB;
ParticleList* m_pCurSystem;
ParticleList* m_pNewSystem;
// particle defaults
public: //TODO: fix this
int m_nParticlesPerFrame;
double m_dDefaultMass; //[Kg]
double m_dDefaultRadius; //[m]
double m_dDefaultSpan; //[m]
double m_dDefaultLifespan; //[sec]
double m_dDefaultPersistance; //0.0-1.0 - the chance of dying (per frame)
Point3d m_dDefaultOrigin;
ParticleShapeType m_particleShape;
Point3d m_pParticleSize; //X,Y,Z dimensions
double m_dParticleSizeRand;
Point3d m_pParticleColor; //RGB value
Point3d m_pParticleColor2;//RGB value
double m_dColorRandomness;
double m_dParticleAlpha; //transparency
double mMaxParticleVelocity;
public:
void AddParticle(CParticle particle)
{
particle.m_bAlive = true;
particle.birthplace = particle.X;
particle.age = 0.0;
m_pCurSystem->push_back(particle);
}
CParticleSystem(void);
virtual ~CParticleSystem(void);
virtual Point3d getLookAtPoint();
virtual bool calcNextFrame();
virtual bool prevFrame();
virtual bool gotoFrame(int nFrame);
virtual bool init();
virtual bool display(int nFrameNum, int nShading);
virtual bool isParticleDead (int i);
virtual void killParticle(unsigned int nParticle)
{
m_pNewSystem->erase(m_pNewSystem->begin()+nParticle);
}
void drawAnt();
};
| [
"itai@c8a6d0be-e207-0410-856a-d97b7f264bab",
"dagan@c8a6d0be-e207-0410-856a-d97b7f264bab",
"playmobil@c8a6d0be-e207-0410-856a-d97b7f264bab"
]
| [
[
[
1,
1
],
[
3,
19
],
[
21,
22
],
[
27,
28
],
[
30,
48
],
[
64,
67
],
[
70,
73
],
[
99,
108
],
[
110,
119
],
[
122,
122
]
],
[
[
2,
2
],
[
20,
20
],
[
23,
26
],
[
29,
29
],
[
49,
63
],
[
78,
80
],
[
85,
85
],
[
88,
88
],
[
90,
90
],
[
92,
92
],
[
94,
95
],
[
98,
98
],
[
109,
109
],
[
120,
121
]
],
[
[
68,
69
],
[
74,
77
],
[
81,
84
],
[
86,
87
],
[
89,
89
],
[
91,
91
],
[
93,
93
],
[
96,
97
]
]
]
|
8bb2ae657b9f30fae3ade95bd6fdf3fc3614f9f1 | 5ff30d64df43c7438bbbcfda528b09bb8fec9e6b | /kgraphics/math/CatmullRom.h | d718d62d3374c2573c71a285868a0a4a35fde939 | []
| no_license | lvtx/gamekernel | c80cdb4655f6d4930a7d035a5448b469ac9ae924 | a84d9c268590a294a298a4c825d2dfe35e6eca21 | refs/heads/master | 2016-09-06T18:11:42.702216 | 2011-09-27T07:22:08 | 2011-09-27T07:22:08 | 38,255,025 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,742 | h | #pragma once
#include <kgraphics/math/math.h>
#include <kgraphics/math/Writer.h>
#include <kgraphics/math/Vector3.h>
namespace gfx {
/**
* @class CatmullRom
*
*
*/
class CatmullRom
{
public:
// constructor/destructor
CatmullRom();
~CatmullRom();
// text output (for debugging)
friend Writer& operator<<( Writer& out, const CatmullRom& source );
// set up
bool Initialize( const Vector3* positions,
const float* times,
unsigned int count );
// break down
void Clean();
// evaluate position
Vector3 Evaluate( float t );
// evaluate derivative
Vector3 Velocity( float t );
// evaluate second derivative
Vector3 Acceleration( float t );
// find parameter that moves s distance from Q(t1)
float FindParameterByDistance( float t1, float s );
// return length of curve between t1 and t2
float ArcLength( float t1, float t2 );
// get total length of curve
inline float GetLength() { return mTotalLength; }
protected:
// return length of curve between u1 and u2
float SegmentArcLength( u_int i, float u1, float u2 );
Vector3* mPositions; // sample positions
float* mTimes; // time to arrive at each point
float* mLengths; // length of each curve segment
float mTotalLength; // total length of curve
unsigned int mCount; // number of points and times
private:
// copy operations
// made private so they can't be used
CatmullRom( const CatmullRom& other );
CatmullRom& operator=( const CatmullRom& other );
};
} // namespace gfx
| [
"keedongpark@keedongpark"
]
| [
[
[
1,
67
]
]
]
|
4dd5a5ab322994d7edfe420fab015893bbb030a0 | 3472e587cd1dff88c7a75ae2d5e1b1a353962d78 | /ytk_bak/BatDown/src/MusicModel.cpp | 1b795fb9d3664fdf9bb08daf41a50bf1a265172d | []
| no_license | yewberry/yewtic | 9624d05d65e71c78ddfb7bd586845e107b9a1126 | 2468669485b9f049d7498470c33a096e6accc540 | refs/heads/master | 2021-01-01T05:40:57.757112 | 2011-09-14T12:32:15 | 2011-09-14T12:32:15 | 32,363,059 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,153 | cpp | #include "MusicModel.h"
#include "BatDown.h"
MusicModel::MusicModel(BatDown* app, QObject *parent)
: BaseTableModel(app, parent)
{
m_table = "btdl_music";
m_dbFields = QString("title,artist,album,md5,file_path,music_url,post_url,track,genre,year,notes").split(",");
m_headers<<tr("Title")<<tr("Artist")<<tr("Album")<<tr("MD5");
m_entries = m_pApp->getDbMgr().queryAsMap( QString("SELECT %1 FROM %2").arg(m_dbFields.join(",")).arg(m_table) );
}
QVariant MusicModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid()) return QVariant();
record_t entry = m_entries.at(index.row());
if (role == Qt::ToolTipRole) {
QString tip, key, value;
tip = "<table>";
tip += QString("<tr><td><b>Path</b>: %1</td></tr>\
<tr><td><b>Music URL</b>: %2</td></tr>\
<tr><td><b>Post URL</b>: %3</td></tr>\
<tr><td><b>MD5</b>: %4</td></tr>\
").arg(entry.value("file_path"))\
.arg(entry.value("music_url"))\
.arg(entry.value("post_url"))\
.arg(entry.value("md5"));
tip += "</table>";
return tip;
}
return BaseTableModel::data(index, role);
}
| [
"yew1998@5ddc4e96-dffd-11de-b4b3-6d349e4f6f86"
]
| [
[
[
1,
36
]
]
]
|
307604b3eb8946d5e5fd485800ffb75a84c59f37 | c70941413b8f7bf90173533115c148411c868bad | /core/include/vtxMovieClipResource.h | 10433acb2bdde9d1ca0834caa5956344b2b5e4a8 | []
| no_license | cnsuhao/vektrix | ac6e028dca066aad4f942b8d9eb73665853fbbbe | 9b8c5fa7119ff7f3dc80fb05b7cdba335cf02c1a | refs/heads/master | 2021-06-23T11:28:34.907098 | 2011-03-27T17:39:37 | 2011-03-27T17:39:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,282 | h | /*
-----------------------------------------------------------------------------
This source file is part of "vektrix"
(the rich media and vector graphics rendering library)
For the latest info, see http://www.fuse-software.com/
Copyright (c) 2009-2010 Fuse-Software (tm)
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 __vtxMovieClipResource_H__
#define __vtxMovieClipResource_H__
#include "vtxPrerequisites.h"
#include "vtxDisplayResource.h"
namespace vtx
{
//-----------------------------------------------------------------------
/** A Resource which contains all necessary data for creating an animated MovieClip instance */
class vtxExport MovieClipResource : public DisplayResource
{
public:
MovieClipResource(const String& id);
virtual ~MovieClipResource();
/** @copybrief Resource::getType */
const String& getType() const;
/** Set the Timeline associated with this movieclip */
void setTimeline(Timeline* timeline);
/** Get the Timeline associated with this movieclip */
Timeline* getTimeline();
protected:
Timeline* mTimeline;
};
//-----------------------------------------------------------------------
}
#endif
| [
"stonecold_@9773a11d-1121-4470-82d2-da89bd4a628a",
"fixxxeruk@9773a11d-1121-4470-82d2-da89bd4a628a"
]
| [
[
[
1,
31
],
[
33,
59
]
],
[
[
32,
32
]
]
]
|
ffa69654a9c039f36776b584dd0c6c2c6ba5b8d9 | 0f7af923b9d3a833f70dd5ab6f9927536ac8e31c | / elistestserver/SpeedFast.cpp | 031794fcb929a3649d14810cc0bef6612e091c72 | []
| no_license | empiredan/elistestserver | c422079f860f166dd3fcda3ced5240d24efbd954 | cfc665293731de94ff308697f43c179a4a2fc2bb | refs/heads/master | 2016-08-06T07:24:59.046295 | 2010-01-25T16:40:32 | 2010-01-25T16:40:32 | 32,509,805 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 906 | cpp | #include "stdafx.h"
#include "SpeedFast.h"
CSpeedFast::CSpeedFast(void)
{
//此处加入计算speed fast body长度的代码要根据
//收到的命令所解析的结构CActTable来计算
//bodyLen = sizeof();
AfxMessageBox(_T("此处加入计算speed fast body长度的代码要根据收到的命令所解析的结构CActTable来计算"));
cmdLen = bodyLen + SOCK_RECEIVE_HEADER_LEN;
cmdType = NET_RETURN_SPEEDFAST;
}
CSpeedFast::CSpeedFast(BUF_TYPE* bf, ULONG len):CFrontData(bf, len) {
//此处加入计算speed fast body长度的代码要根据
//收到的命令所解析的结构CActTable来计算
//bodyLen = sizeof();
AfxMessageBox(_T("此处加入计算speed fast body长度的代码要根据收到的命令所解析的结构CActTable来计算"));
cmdLen = bodyLen + SOCK_RECEIVE_HEADER_LEN;
cmdType = NET_RETURN_SPEEDFAST;
}
CSpeedFast::~CSpeedFast(void)
{
}
| [
"zwusheng@3065b396-e208-11de-81d3-db62269da9c1"
]
| [
[
[
1,
24
]
]
]
|
e51bdd6390ecaef204ba27356a1e7d1842177274 | fd518ed0226c6a044d5e168ab50a0e4a37f8efa9 | /iAuthor/Author/Author.cpp | 48bd265c9497611e8289032484a4cc7dad42f625 | []
| no_license | shilinxu/iprojects | e2e2394df9882afaacfb9852332f83cbef6a8c93 | 79bc8e45596577948c45cf2afcff331bc71ab026 | refs/heads/master | 2020-05-17T19:15:43.197685 | 2010-04-02T15:58:11 | 2010-04-02T15:58:11 | 41,959,151 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 3,844 | cpp | // Author.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "Author.h"
#include "AuthorDlg.h"
#include "SplashDlg.h"
#include "AppSettings.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAuthorApp
BEGIN_MESSAGE_MAP(CAuthorApp, CWinApp)
//{{AFX_MSG_MAP(CAuthorApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAuthorApp construction
CAuthorApp::CAuthorApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CAuthorApp object
ULONG_PTR g_gdiplusToken;
CAuthorApp theApp;
// For avoiding Multiple Instances of an Application
// This can be done by creating a shared data segment.
// g_hMainWnd is set when the main window is created.
//
#pragma comment(linker, "/SECTION:.shr,RWS")
#pragma data_seg(".shr")
HWND g_hMainWnd = NULL;
#pragma data_seg()
/////////////////////////////////////////////////////////////////////////////
// CAuthorApp initialization
BOOL CAuthorApp::InitInstance()
{
////////////////////////////////////////////////////////////////////////////
// Avoiding Multiple Instances of an Application
bool AlreadyRunning = (g_hMainWnd != NULL);
if (AlreadyRunning)
{
::SetForegroundWindow(g_hMainWnd);
if (IsIconic(g_hMainWnd))
{
::ShowWindow(g_hMainWnd, SW_RESTORE);
}
return FALSE; // terminates the creation
}
// Avoiding Multiple Instances of an Application end
////////////////////////////////////////////////////////////////////////////
if(!AfxOleInit())
{
AfxMessageBox("Cannot initialize COM services.");
return FALSE;
}
AfxEnableControlContainer();
GdiplusStartupInput gdiplusStartupInput;
GdiplusStartup(&g_gdiplusToken, &gdiplusStartupInput, NULL);
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
CAppSettings::Init();
if (CAppSettings::CheckVistaDWM4Restart())
{
AfxMessageBox("비스타 호환성 설정을 변경하고 종료합니다.\n다시 시작해 주세요..");
return TRUE;
}
CSplashDlg SplashDlg;
SplashDlg.DoModal();
CAuthorDlg dlg;
m_pMainWnd = &dlg;
// For avoid multiple instance.
g_hMainWnd = m_pMainWnd->GetSafeHwnd();
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
int CAuthorApp::ExitInstance()
{
// TODO: Add your specialized code here and/or call the base class
GdiplusShutdown(g_gdiplusToken);
return CWinApp::ExitInstance();
}
/////////////////////////////////////////////////////////////////////////////
// CAuthorApp message handlers
| [
"[email protected]"
]
| [
[
[
1,
135
]
]
]
|
e588df178f0056f863b837c3b4753b39d9e8b364 | f252ab3c994811efa57be24b8a7481e781bcf290 | /crypto-cretin/HelperFunctions.hpp | bf986ea322a30cc4a9b05ce58c774c3050e9e58d | []
| no_license | WestleyArgentum/crypto-cretin | cdde937702c0636662f00b2dd54c2c505a1cd0ab | 958095c9fe233363c39f1648a58395ec90f161c2 | refs/heads/master | 2020-08-23T16:55:40.164548 | 2010-12-04T21:56:39 | 2010-12-04T21:56:39 | 33,832,437 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,910 | hpp | /*!-----------------//------------------------------------------------------------
\file HelperFunctions.hpp
\author Zak Whaley
\par email: zak.whaley\@gmail.com
\par DigiPen login: zwhaley
\par Course: GAM350 A
\par Language: C++, Microsoft Visual Studio 2005
\par Platform: Windows XP
\date 07/06/09
(c) Copyright 2010, DigiPen Institute of Technology (USA). All rights reserved.
Reproduction or disclosure of this file or its contents without the prior
written consent of DigiPen Institute of Technology is prohibited.
------------------------------------------------------------------------------*/
#ifndef HELPER_FUNCTIONS_HPP
#define HELPER_FUNCTIONS_HPP
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <stack>
//#define Assert(x, msg)
#define ErrorIf(x, msg)
#define Insist(x, msg)
#define WarnIf(x, msg)
#define AlwaysAssert(x, msg)
#define AlwaysErrorIf(x, msg)
#define AlwaysInsist(x, msg)
#define AlwaysWarnIf(x, msg)
namespace Tools
{
bool PathIsReadable(const std::string &iPath);
bool PathIsWritable(const std::string &iPath);
bool FileExists(const std::string &iPath);
bool PathExists(const std::string &iPath);
std::string RemoveExtension(const std::string &iFile);
void ReplaceInString(std::string &oString, const std::string &iSequence, const std::string &iReplace);
template <typename T>
std::string ToString(const T &iData)
{
std::stringstream ss;
ss << iData;
return ss.str();
}
template <typename T>
void SafeRelease(T &iObject) //iterator support
{
if(!iObject)
return;
iObject->Release();
iObject = 0;
}
template <typename T>
void SafeDelete(T &iObject) //iterator support
{
delete iObject;
iObject = 0;
}
} //Tools
#endif
| [
"[email protected]"
]
| [
[
[
1,
71
]
]
]
|
a55429b91cdb0046baf7f8bb3be4911afdd1cbfd | 0f8559dad8e89d112362f9770a4551149d4e738f | /Wall_Destruction/Havok/Source/Physics/Collide/Query/Collector/BodyPairCollector/hkpFlagCdBodyPairCollector.inl | aeab24a7400d27a68f69bd82760a367ccae13649 | []
| no_license | TheProjecter/olafurabertaymsc | 9360ad4c988d921e55b8cef9b8dcf1959e92d814 | 456d4d87699342c5459534a7992f04669e75d2e1 | refs/heads/master | 2021-01-10T15:15:49.289873 | 2010-09-20T12:58:48 | 2010-09-20T12:58:48 | 45,933,002 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,402 | inl | /*
*
* Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's
* prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok.
* Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2009 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement.
*
*/
hkpFlagCdBodyPairCollector::hkpFlagCdBodyPairCollector()
{
reset();
}
hkpFlagCdBodyPairCollector::~hkpFlagCdBodyPairCollector()
{
}
hkBool hkpFlagCdBodyPairCollector::hasHit( ) const
{
return getEarlyOut();
}
/*
* Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20091222)
*
* Confidential Information of Havok. (C) Copyright 1999-2009
* Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok
* Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership
* rights, and intellectual property rights in the Havok software remain in
* Havok and/or its suppliers.
*
* Use of this software for evaluation purposes is subject to and indicates
* acceptance of the End User licence Agreement for this product. A copy of
* the license is included with this software and is also available at www.havok.com/tryhavok.
*
*/
| [
"[email protected]"
]
| [
[
[
1,
39
]
]
]
|
1cd82b0f57e99b3eba085e7df23e46ee82fc1c30 | 6e563096253fe45a51956dde69e96c73c5ed3c18 | /os/AX_Condition_Thread_Mutex.h | 231ee1e971b8e02b00972e39651e5be85e61802b | []
| 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 | UTF-8 | C++ | false | false | 4,008 | h | #ifndef CONDITION_THREAD_MUTEX
#define CONDITION_THREAD_MUTEX
#include "AX_OS.h"
#include "AX_Mutex.h"
#include "AX_Thread_Mutex.h"
#ifndef _WIN32
#include <errno.h>
#endif
class AX_Condition_Thread_Mutex;
class AX_Condition_Attributes
{
public:
/// Constructor
AX_Condition_Attributes (int type);
/// Destructor
~AX_Condition_Attributes (void);
private:
friend class AX_Condition_Thread_Mutex;
/// The attributes
AX_condattr_t attributes_;
private:
// = Prevent assignment and initialization.
void operator= (const AX_Condition_Attributes &);
AX_Condition_Attributes (const AX_Condition_Attributes &);
};
/**
* @class ACE_Condition_Thread_Mutex
*
* @brief ACE_Condition variable wrapper written using ACE_Mutexes This
* allows threads to block until shared data changes state.
* A condition variable enables threads to atomically block and
* test the condition under the protection of a mutual exclu-
* sion lock (mutex) until the condition is satisfied. That is,
* the mutex must have been held by the thread before calling
* wait or signal on the condition. If the condition is false,
* a thread blocks on a condition variable and atomically
* releases the mutex that is waiting for the condition to
* change. If another thread changes the condition, it may wake
* up waiting threads by signaling the associated condition
* variable. The waiting threads, upon awakening, reacquire the
* mutex and re-evaluate the condition.
*
* This should be an instantiation of ACE_Condition but problems
* with compilers precludes this...
*/
class AX_Condition_Thread_Mutex
{
public:
/// Initialize the condition variable.
AX_Condition_Thread_Mutex (const AX_Thread_Mutex &m,const char *name = 0,void *arg = 0);
/// Initialize the condition variable.
AX_Condition_Thread_Mutex (AX_Thread_Mutex &m,
AX_Condition_Attributes &attributes,
const char *name = 0,
void *arg = 0);
/// Implicitly destroy the condition variable.
~AX_Condition_Thread_Mutex (void);
/**
* Explicitly destroy the condition variable. Note that only one
* thread should call this method since it doesn't protect against
* race conditions.
*/
int remove (void);
/**
* Block on condition, or until absolute time-of-day has passed. If
* abstime == 0 use "blocking" <wait> semantics. Else, if <abstime>
* != 0 and the call times out before the condition is signaled
* <wait> returns -1 and sets errno to ETIME.
*/
int wait (const timeval *abstime);
/// Block on condition.
int wait (void);
/**
* Block on condition or until absolute time-of-day has passed. If
* abstime == 0 use "blocking" wait() semantics on the <mutex>
* passed as a parameter (this is useful if you need to store the
* <Condition> in shared memory). Else, if <abstime> != 0 and the
* call times out before the condition is signaled <wait> returns -1
* and sets errno to ETIME.
*/
int wait (AX_Thread_Mutex &mutex, const timeval *abstime = 0);
/// Signal one waiting thread.
int signal (void);
/// Signal *all* waiting threads.
int broadcast (void);
/// Returns a reference to the underlying mutex;
AX_Thread_Mutex& mutex (void);
/// Dump the state of an object.
void dump (void) const;
protected:
/// Condition variable.
AX_cond_t cond_;
/// Reference to mutex lock.
AX_Thread_Mutex &mutex_;
/// Keeps track of whether <remove> has been called yet to avoid
/// multiple <remove> calls, e.g., explicitly and implicitly in the
/// destructor. This flag isn't protected by a lock, so make sure
/// that you don't have multiple threads simultaneously calling
/// <remove> on the same object, which is a bad idea anyway...
int removed_;
private:
// = Prevent assignment and initialization.
void operator= (const AX_Condition_Thread_Mutex &);
AX_Condition_Thread_Mutex (const AX_Condition_Thread_Mutex &);
};
#include "AX_Condition_Thread_Mutex.inl"
#endif
| [
"guoqiao@a83c37f4-16cc-5f24-7598-dca3a346d5dd"
]
| [
[
[
1,
130
]
]
]
|
ab6f10e104b06c449ab10e21307e58e081b69499 | c5534a6df16a89e0ae8f53bcd49a6417e8d44409 | /trunk/Dependencies/Xerces/include/xercesc/validators/schema/identity/IC_Field.cpp | c9125575cd4224968f49157f860bc1e7f05b8d9f | []
| 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 | 4,739 | cpp | /*
* Copyright 2001,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: IC_Field.cpp 191054 2005-06-17 02:56:35Z jberry $
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#include <xercesc/validators/schema/identity/FieldActivator.hpp>
#include <xercesc/validators/schema/identity/IC_Field.hpp>
#include <xercesc/validators/schema/identity/ValueStore.hpp>
#include <xercesc/validators/schema/identity/XercesXPath.hpp>
#include <xercesc/validators/schema/identity/IdentityConstraint.hpp>
XERCES_CPP_NAMESPACE_BEGIN
// ---------------------------------------------------------------------------
// FieldMatcher: Constructors and Destructor
// ---------------------------------------------------------------------------
FieldMatcher::FieldMatcher(XercesXPath* const xpath,
IC_Field* const aField,
ValueStore* const valueStore,
FieldActivator* const fieldActivator,
MemoryManager* const manager)
: XPathMatcher(xpath, (IdentityConstraint*) 0, manager)
, fValueStore(valueStore)
, fField(aField)
, fFieldActivator(fieldActivator)
{
}
// ---------------------------------------------------------------------------
// FieldMatcher: Match methods
// ---------------------------------------------------------------------------
void FieldMatcher::matched(const XMLCh* const content,
DatatypeValidator* const dv,
const bool isNil) {
if(isNil) {
fValueStore->reportNilError(fField->getIdentityConstraint());
}
fValueStore->addValue(fFieldActivator, fField, dv, content);
// once we've stored the value for this field, we set the mayMatch
// member to false so that, in the same scope, we don't match any more
// values (and throw an error instead).
fFieldActivator->setMayMatch(fField, false);
}
// ---------------------------------------------------------------------------
// IC_Field: Constructors and Destructor
// ---------------------------------------------------------------------------
IC_Field::IC_Field(XercesXPath* const xpath,
IdentityConstraint* const identityConstraint)
: fXPath(xpath)
, fIdentityConstraint(identityConstraint)
{
}
IC_Field::~IC_Field()
{
delete fXPath;
}
// ---------------------------------------------------------------------------
// IC_Field: operators
// ---------------------------------------------------------------------------
bool IC_Field::operator== (const IC_Field& other) const {
return (*fXPath == *(other.fXPath));
}
bool IC_Field::operator!= (const IC_Field& other) const {
return !operator==(other);
}
// ---------------------------------------------------------------------------
// IC_Field: Factory methods
// ---------------------------------------------------------------------------
XPathMatcher* IC_Field::createMatcher(ValueStore* const,
MemoryManager* const) {
return 0;
}
XPathMatcher* IC_Field::createMatcher(FieldActivator* const fieldActivator,
ValueStore* const valueStore,
MemoryManager* const manager)
{
return new (manager) FieldMatcher(fXPath, this, valueStore, fieldActivator, manager);
}
/***
* Support for Serialization/De-serialization
***/
IMPL_XSERIALIZABLE_TOCREATE(IC_Field)
void IC_Field::serialize(XSerializeEngine& serEng)
{
if (serEng.isStoring())
{
serEng<<fXPath;
IdentityConstraint::storeIC(serEng, fIdentityConstraint);
}
else
{
serEng>>fXPath;
fIdentityConstraint = IdentityConstraint::loadIC(serEng);
}
}
IC_Field::IC_Field(MemoryManager* const )
:fXPath(0)
,fIdentityConstraint(0)
{
}
XERCES_CPP_NAMESPACE_END
/**
* End of file IC_Field.cpp
*/
| [
"Riddlemaster@fdc6060e-f348-4335-9a41-9933a8eecd57"
]
| [
[
[
1,
146
]
]
]
|
e755d3c1f2c3804626457d12a5ecccc84a79326c | 0f8559dad8e89d112362f9770a4551149d4e738f | /Wall_Destruction/Havok/Source/Physics/Dynamics/World/Util/hkpTreeWorldManager.h | 09b73f7083fc32d1aa4be1817b204c0908599f7a | []
| no_license | TheProjecter/olafurabertaymsc | 9360ad4c988d921e55b8cef9b8dcf1959e92d814 | 456d4d87699342c5459534a7992f04669e75d2e1 | refs/heads/master | 2021-01-10T15:15:49.289873 | 2010-09-20T12:58:48 | 2010-09-20T12:58:48 | 45,933,002 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,788 | h | /*
*
* Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's
* prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok.
* Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2009 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement.
*
*/
#ifndef HKP_TREE_WORLD_MANAGER_H
#define HKP_TREE_WORLD_MANAGER_H
#include <Common/Internal/Collide/Tree/AabbTree/hkAabbTreeData.h>
class hkJobThreadPool;
class hkJobQueue;
struct hkpWorldRayCastInput;
struct hkpWorldRayCastOutput;
class hkpRayHitCollector;
struct hkpLinearCastInput;
class hkpCdPointCollector;
class hkpCollisionFilter;
class hkKdTree;
template<typename BOUNDING_VOLUME, typename IDXTYPE>
class hkAabbTree;
class hkpTreeWorldManager : public hkReferencedObject
{
public:
hkpTreeWorldManager(){m_inactiveTree = HK_NULL; m_kdTree = HK_NULL;}
virtual void updateFromWorld(hkJobQueue* jobQueue = HK_NULL, hkJobThreadPool* jobThreadPool = HK_NULL) = 0;
virtual bool isUpToDate() const = 0;
virtual void setUpToDate(bool upToDate) = 0;
//
// Raycasting and linearcasting interface.
// The methods are analogical to those in hkpWorld.
//
/// Cast a ray into the world and get the closest hit.
virtual void castRay(const hkpWorldRayCastInput& input, const hkpCollisionFilter* filter, hkpWorldRayCastOutput& output ) const = 0;
/// Cast a ray into the world and do a callback for every hit.
virtual void castRay(const hkpWorldRayCastInput& input, const hkpCollisionFilter* filter, hkpRayHitCollector& collector ) const = 0;
/// Cast a shape within the world.
/// The castCollector collects all potential hits.
virtual void linearCast(const hkpCollidable* collA,
const struct hkpLinearCastInput& input, const class hkpCollidableCollidableFilter* filter,
const struct hkpCollisionInput& collInput, struct hkpCollisionAgentConfig* config,
class hkpCdPointCollector& castCollector, class hkpCdPointCollector* startPointCollector ) = 0;
/// Calculate required working buffer size.
/// The buffer have to be passed by set WorkingBuffer
virtual int calcWorkingBufferSize(int maxObjects){return 0;}
/// If aabbTreeWorldManager is used, this buffer have to be set before tree build.
virtual void setWorkingBuffer(void* ptr){}
/// Get KdTree.
const hkKdTree* getKdTree() const{return m_kdTree;}
/// Get AabbTree, which is used for inactive objects if aabbTreeWorldManager is used. Otherwise returns HK_NULL.
const hkAabbTree<hkAabbTreeData::hkAabbTreeAabb16, hkUint16>* getAabbTree() const{return m_inactiveTree;}
enum Type
{
MANAGER_KDTREE,
MANAGER_AABBTREE,
};
Type m_type;
// hkAabbTree<hkAabbTreeData::hkAabbTreeAabb16>* m_inactiveTree;
hkAabbTree<hkAabbTreeData::hkAabbTreeAabb16, hkUint16>* m_inactiveTree;
hkKdTree* m_kdTree;
};
#endif
/*
* Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20091222)
*
* Confidential Information of Havok. (C) Copyright 1999-2009
* Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok
* Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership
* rights, and intellectual property rights in the Havok software remain in
* Havok and/or its suppliers.
*
* Use of this software for evaluation purposes is subject to and indicates
* acceptance of the End User licence Agreement for this product. A copy of
* the license is included with this software and is also available at www.havok.com/tryhavok.
*
*/
| [
"[email protected]"
]
| [
[
[
1,
98
]
]
]
|
971819c2647f32a9064eb4f0fc230a1632460430 | 3b70a7b1d647a401c69c10b39ca75e38ee8741cb | /ofxArgos/src/ArgosCore/WidgetTypeHandler.cpp | 8033c006ce215a3559c4f6b869238deb11e0468b | []
| no_license | nuigroup/argos-interface-builder | dc4e2daea0e318052165432f09a08b2c2285e516 | dc231f73a04b7bad23fb03c8f4eca4dcfc3d8fd8 | refs/heads/master | 2020-05-19T09:20:38.019073 | 2010-05-30T05:41:34 | 2010-05-30T05:41:34 | 8,322,636 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,429 | cpp | /***********************************************************************
Copyright (c) 2009, 2010 Dimitri Diakopoulos, http://argos.dimitridiakopoulos.com/
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. 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.
3. The name of the author may not 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 NOEVENT 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, ORPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OFLIABILITY, 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 "WidgetTypeHandler.h"
WidgetTypeHandler::WidgetTypeHandler(ofxArgosUI_Panel &panel) {
this->editor = &panel;
}
WidgetTypeHandler::~WidgetTypeHandler(){
editor->resetPanel("No Focus", 210, 30);
}
void WidgetTypeHandler::editBaseProperties (ofxArgosUI_Control *control) {
editor->addTextField("Label:", 10, 30, 190, 20, control->getPropertyRef("name"));
editor->addTextField("X:", 10, 70, 40, 20, control->getPropertyRef("x"));
editor->addTextField("Y:", 60, 70, 40, 20, control->getPropertyRef("y"));
editor->addTextField("W:", 110, 70, 40, 20, control->getPropertyRef("w"));
editor->addTextField("H:", 160, 70, 40, 20, control->getPropertyRef("h"));
editor->addTextField("OSC Address:", 10, 110, 190, 20, control->getPropertyRef("osc"));
} | [
"eliftherious@85a45124-5891-11de-8d7d-01d876f1962d"
]
| [
[
[
1,
48
]
]
]
|
766e55253a446431015676e3d10b041553bbd9d3 | c79def23ba8a4ad23bb51068d303f3ead942ed2a | /source/SuperIterator.cpp | 896d798f241e3d5d70f6c77f78ebb02655ab3819 | [
"BSD-3-Clause"
]
| permissive | programmingisgood/superprofiler | a519020250ed236331219dc5da7adf9c8cf8863c | 1fa7d1785ca3c91457c6fb634ab027290a2fa8e6 | refs/heads/master | 2021-01-19T15:02:08.250385 | 2009-08-13T18:37:05 | 2009-08-13T18:37:05 | 32,189,128 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,966 | cpp | /**
Copyright (c) 2009, Brian Cronin
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 <ORGANIZATION> 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.
**/
#include "SuperIterator.h"
#include "SuperStackNode.h"
#include "SuperFunctionData.h"
#include "SuperException.h"
namespace SuperProfiler
{
SuperIterator::SuperIterator() : currentChild(NULL), currentParent(NULL)
{
}
SuperIterator::SuperIterator(SuperStackNode * start)
{
if (start == NULL)
{
throw SUPER_EXCEPTION("NULL SuperStackNode passed into SuperIterator::SuperIterator(SuperStackNode *)");
}
currentChild = NULL;
currentParent = start;
if (currentParent->GetNumChildren() > 0)
{
currentChild = currentParent->GetChild(static_cast<size_t>(0));
}
}
SuperIterator::~SuperIterator()
{
currentParent = NULL;
currentChild = NULL;
}
SuperIterator::SuperIterator(const SuperIterator & rhs)
{
currentParent = rhs.currentParent;
currentChild = rhs.currentChild;
}
const SuperIterator & SuperIterator::operator=(const SuperIterator & rhs)
{
currentParent = rhs.currentParent;
currentChild = rhs.currentChild;
return *this;
}
void SuperIterator::SetFirst(void)
{
if (currentParent && currentParent->GetNumChildren() > 0)
{
currentChild = currentParent->GetChild(static_cast<size_t>(0));
}
}
void SuperIterator::SetNext(void)
{
if (currentParent)
{
bool foundNext = false;
size_t numChildren = currentParent->GetNumChildren();
for (size_t currChildIndex = 0; currChildIndex < numChildren; currChildIndex++)
{
if (foundNext)
{
currentChild = currentParent->GetChild(currChildIndex);
break;
}
if (currentChild == currentParent->GetChild(currChildIndex))
{
foundNext = true;
}
}
}
}
void SuperIterator::SetCurrentChild(size_t index)
{
if (currentParent)
{
if (index < currentParent->GetNumChildren())
{
currentChild = currentParent->GetChild(index);
}
}
}
bool SuperIterator::IsEnd(void) const
{
if (currentParent)
{
size_t numChildren = currentParent->GetNumChildren();
if (numChildren == 0)
{
return true;
}
for (size_t currChildIndex = 0; currChildIndex < numChildren; currChildIndex++)
{
if (currentChild == currentParent->GetChild(currChildIndex))
{
if (currChildIndex == numChildren - 1)
{
return true;
}
break;
}
}
return false;
}
return true;
}
bool SuperIterator::IsRoot(void) const
{
if (currentParent)
{
return (currentParent->GetParent() == NULL);
}
return true;
}
size_t SuperIterator::GetNumChildren(void) const
{
if (currentParent)
{
return currentParent->GetNumChildren();
}
return 0;
}
void SuperIterator::EnterChild(size_t index)
{
if (currentParent && index < currentParent->GetNumChildren())
{
currentParent = currentParent->GetChild(index);
currentChild = NULL;
SetFirst();
}
}
void SuperIterator::EnterParent(void)
{
if (currentParent && currentParent->GetParent())
{
currentParent = currentParent->GetParent();
currentChild = NULL;
SetFirst();
}
}
size_t SuperIterator::GetCurrentID(void) const
{
if (currentChild)
{
return currentChild->GetFuncData()->GetID();
}
return NULL;
}
const char * SuperIterator::GetCurrentName(void) const
{
if (currentChild)
{
return currentChild->GetFuncData()->GetName();
}
return NULL;
}
size_t SuperIterator::GetCurrentTotalCalls(void) const
{
if (currentChild)
{
return currentChild->GetNumTimesCalled();
}
return 0;
}
double SuperIterator::GetCurrentTotalTime(void) const
{
if (currentChild)
{
return currentChild->GetTotalTime();
}
return 0;
}
double SuperIterator::GetCurrentMeasureTime(void) const
{
if (currentChild)
{
return currentChild->GetLastMeasureTime();
}
return 0;
}
double SuperIterator::GetCurrentLastHighestTimeWhileMeasuring(void) const
{
if (currentChild)
{
return currentChild->GetLastHighestTimeWhileMeasuring();
}
return 0;
}
size_t SuperIterator::GetCurrentParentID(void) const
{
if (currentParent->GetFuncData())
{
return currentParent->GetFuncData()->GetID();
}
return 0;
}
const char * SuperIterator::GetCurrentParentName(void) const
{
if (currentParent->GetFuncData())
{
return currentParent->GetFuncData()->GetName();
}
return "ROOT";
}
size_t SuperIterator::GetCurrentParentTotalCalls(void) const
{
if (currentParent)
{
//If this is the root, add up the children to find the total
if (currentParent->GetFuncData() == NULL)
{
size_t totalCalls = 0;
size_t numChildren = currentParent->GetNumChildren();
for (size_t c = 0; c < numChildren; c++)
{
totalCalls += currentParent->GetChild(c)->GetNumTimesCalled();
}
return totalCalls;
}
//Otherwise, return the accurate parent count
return currentParent->GetNumTimesCalled();
}
return 0;
}
double SuperIterator::GetCurrentParentTotalTime(void) const
{
if (currentParent)
{
//If this is the root, add up the children times to find the total time
if (currentParent->GetFuncData() == NULL)
{
double totalTime = 0;
size_t numChildren = currentParent->GetNumChildren();
for (size_t c = 0; c < numChildren; c++)
{
totalTime += currentParent->GetChild(c)->GetTotalTime();
}
return totalTime;
}
//Otherwise, return the accurate parent time
return currentParent->GetTotalTime();
}
return 0;
}
double SuperIterator::GetCurrentParentMeasureTime(void) const
{
if (currentParent)
{
//If this is the root, add up the children times to find the total time
if (currentParent->GetFuncData() == NULL)
{
double totalMeasureTime = 0;
size_t numChildren = currentParent->GetNumChildren();
for (size_t c = 0; c < numChildren; c++)
{
totalMeasureTime += currentParent->GetChild(c)->GetLastMeasureTime();
}
return totalMeasureTime;
}
//Otherwise, return the accurate parent time
return currentParent->GetLastMeasureTime();
}
return 0;
}
double SuperIterator::GetCurrentParentLastHighestTimeWhileMeasuring(void) const
{
if (currentParent)
{
return currentParent->GetLastHighestTimeWhileMeasuring();
}
return 0;
}
} | [
"programmingisgood@1faae0e8-f407-11dd-984d-ab748d24aa7e"
]
| [
[
[
1,
339
]
]
]
|
ff710d308ea0cdc060b2f516306c43d5064acf62 | c6f4fe2766815616b37beccf07db82c0da27e6c1 | /Autopilot.h | 61f8f7454829e75c869480293fd236f8be1c6712 | []
| no_license | fragoulis/gpm-sem1-spacegame | c600f300046c054f7ab3cbf7193ccaad1503ca09 | 85bdfb5b62e2964588f41d03a295b2431ff9689f | refs/heads/master | 2023-06-09T03:43:53.175249 | 2007-12-13T03:03:30 | 2007-12-13T03:03:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,104 | h | #pragma once
#include "Singleton.h"
#include "Object.h"
using tlib::Object;
// ____________________________________________________________________________
// Waypoint structure
class Waypoint : public Object
{};
static const int MAX_WPOINTS = 4;
// ____________________________________________________________________________
// The autopilot class holds a number of waypoints to guide the spaceship
// through
class Autopilot : public Singleton<Autopilot>
{
friend Singleton<Autopilot>;
private:
bool m_bIsActive;
Waypoint m_WPoints[MAX_WPOINTS];
unsigned m_uiCurWPoint;
float m_vfShipEndPos[3];
public:
void start() {
create();
m_bIsActive = true;
}
bool isActive() const { return m_bIsActive; }
/**
* Updates the spaceship's orientation in order to reach the
* next waypoint
*/
void update();
private:
/**
* Constructor
*/
Autopilot();
/**
* Creates the waypoints based on the spaceship's and the reactor's position
*/
void create();
}; | [
"john.fragkoulis@201bd241-053d-0410-948a-418211174e54"
]
| [
[
[
1,
48
]
]
]
|
42a413158d0c257890fed763337cd1545fe6aa42 | cb9967f3c1349124878d5769d1ecd16500f60a08 | /TaskbarNativeCode/SystemTaskbarCommunicator.cpp | c790d0ff36932930d485aa497d779b72be4314d6 | []
| no_license | josiahdecker/TaskbarExtender | b71ab2439e6844060e6b41763b23ace6c00ccad2 | 3977192ba85d48bd8caf543bfc3a0f6d0df9efc9 | refs/heads/master | 2020-05-30T17:11:14.543553 | 2011-03-20T14:08:46 | 2011-03-20T14:08:46 | 1,503,110 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 990 | cpp | #include "StdAfx.h"
#include "SystemTaskbarCommunicator.h"
#include "AppbarMessenger.h"
namespace TaskbarExtender{
namespace NativeMethods {
SystemTaskbarCommunicator::SystemTaskbarCommunicator(void)
{
taskbarList = new CComQIPtr<ITaskbarList>();
CoInitialize(NULL);
HRESULT success = taskbarList->CoCreateInstance(CLSID_TaskbarList);
if (SUCCEEDED(success)){
(*taskbarList)->HrInit();
}else {
CoUninitialize();
throw gcnew System::Exception(System::String::Format("Taskbar communicator initialzation failed, error {0}", GetLastError()));
}
}
SystemTaskbarCommunicator::~SystemTaskbarCommunicator(void)
{
taskbarList->Release();
CoUninitialize();
delete taskbarList;
}
void SystemTaskbarCommunicator::AddTabToBar(System::IntPtr handle){
(*taskbarList)->AddTab((HWND)handle.ToPointer());
}
void SystemTaskbarCommunicator::RemoveTabFromBar(System::IntPtr handle){
(*taskbarList)->DeleteTab((HWND)handle.ToPointer());
}
}
}
| [
"[email protected]"
]
| [
[
[
1,
41
]
]
]
|
787b5cae3e7dfdf5c53c038135b1c4252b959909 | c95a83e1a741b8c0eb810dd018d91060e5872dd8 | /Game/ObjectDLL/ObjectShared/RandomSpawner.cpp | b15029099cdba1ceee5d1d24952222c9fa3581ab | []
| 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 | 7,293 | cpp | // ----------------------------------------------------------------------- //
//
// MODULE : RandomSpawner.h
//
// PURPOSE : RandomSpawner - Implementation
//
// CREATED : 04.23.1999
//
// ----------------------------------------------------------------------- //
#include "stdafx.h"
#include "RandomSpawner.h"
#include "ServerUtilities.h"
#include "ObjectMsgs.h"
LINKFROM_MODULE( RandomSpawner );
#pragma force_active on
BEGIN_CLASS(RandomSpawner)
ADD_STRINGPROP(Spawner, "")
ADD_LONGINTPROP(Number, 1)
END_CLASS_DEFAULT(RandomSpawner, BaseClass, NULL, NULL)
#pragma force_active off
// Statics
const char s_szSpawnTrigger[] = "DEFAULT";
// ----------------------------------------------------------------------- //
//
// ROUTINE: RandomSpawner::RandomSpawner()
//
// PURPOSE: Constructor
//
// ----------------------------------------------------------------------- //
RandomSpawner::RandomSpawner() : BaseClass()
{
m_bFirstUpdate = LTTRUE;
m_hstrSpawner = LTNULL;
m_cSpawn = 0;
m_ahSpawners = debug_newa(LTObjRef, kMaxSpawners);
for ( int iSpawner = 0 ; iSpawner < kMaxSpawners ; iSpawner++ )
{
m_ahSpawners[iSpawner] = LTNULL;
}
}
// ----------------------------------------------------------------------- //
//
// ROUTINE: RandomSpawner::~RandomSpawner()
//
// PURPOSE: Destructor
//
// ----------------------------------------------------------------------- //
RandomSpawner::~RandomSpawner()
{
FREE_HSTRING(m_hstrSpawner);
debug_deletea(m_ahSpawners);
}
// ----------------------------------------------------------------------- //
//
// ROUTINE: RandomSpawner::EngineMessageFn
//
// PURPOSE: Handle engine messages
//
// ----------------------------------------------------------------------- //
uint32 RandomSpawner::EngineMessageFn(uint32 messageID, void *pData, LTFLOAT fData)
{
switch(messageID)
{
case MID_UPDATE:
{
Update();
break;
}
case MID_PRECREATE:
{
if (fData == PRECREATE_WORLDFILE || fData == PRECREATE_STRINGPROP)
{
ReadProp((ObjectCreateStruct*)pData);
}
PostPropRead((ObjectCreateStruct*)pData);
break;
}
case MID_INITIALUPDATE:
{
if (fData != INITIALUPDATE_SAVEGAME)
{
InitialUpdate();
}
break;
}
case MID_SAVEOBJECT:
{
Save((ILTMessage_Write*)pData);
}
break;
case MID_LOADOBJECT:
{
Load((ILTMessage_Read*)pData);
}
break;
default : break;
}
return BaseClass::EngineMessageFn(messageID, pData, fData);
}
// ----------------------------------------------------------------------- //
//
// ROUTINE: RandomSpawner::ReadProp
//
// PURPOSE: Set property value
//
// ----------------------------------------------------------------------- //
LTBOOL RandomSpawner::ReadProp(ObjectCreateStruct *pInfo)
{
if (!pInfo) return LTFALSE;
GenericProp genProp;
if ( g_pLTServer->GetPropGeneric( "Spawner", &genProp ) == LT_OK )
if ( genProp.m_String[0] )
m_hstrSpawner = g_pLTServer->CreateString( genProp.m_String );
if ( g_pLTServer->GetPropGeneric( "Number", &genProp ) == LT_OK )
m_cSpawn = genProp.m_Long;
return LTTRUE;
}
// ----------------------------------------------------------------------- //
//
// ROUTINE: RandomSpawner::PostPropRead()
//
// PURPOSE: Update Properties
//
// ----------------------------------------------------------------------- //
void RandomSpawner::PostPropRead(ObjectCreateStruct *pStruct)
{
if ( !pStruct ) return;
}
// ----------------------------------------------------------------------- //
//
// ROUTINE: RandomSpawner::InitialUpdate()
//
// PURPOSE: First update
//
// ----------------------------------------------------------------------- //
LTBOOL RandomSpawner::InitialUpdate()
{
SetNextUpdate(m_hObject, UPDATE_NEXT_FRAME);
return LTTRUE;
}
// ----------------------------------------------------------------------- //
//
// ROUTINE: RandomSpawner::Update()
//
// PURPOSE: Update
//
// ----------------------------------------------------------------------- //
LTBOOL RandomSpawner::Update()
{
if ( m_bFirstUpdate )
{
Setup();
Spawn();
m_bFirstUpdate = LTFALSE;
SetNextUpdate(m_hObject, UPDATE_NEVER);
}
return LTTRUE;
}
// ----------------------------------------------------------------------- //
//
// ROUTINE: RandomSpawner::Save
//
// PURPOSE: Save the object
//
// ----------------------------------------------------------------------- //
void RandomSpawner::Save(ILTMessage_Write *pMsg)
{
if (!pMsg) return;
SAVE_BOOL(m_bFirstUpdate);
SAVE_HSTRING(m_hstrSpawner);
SAVE_DWORD(m_cSpawn);
for ( int iSpawner = 0 ; iSpawner < kMaxSpawners ; iSpawner++ )
{
SAVE_HOBJECT(m_ahSpawners[iSpawner]);
}
}
// ----------------------------------------------------------------------- //
//
// ROUTINE: RandomSpawner::Load
//
// PURPOSE: Load the object
//
// ----------------------------------------------------------------------- //
void RandomSpawner::Load(ILTMessage_Read *pMsg)
{
if (!pMsg) return;
LOAD_BOOL(m_bFirstUpdate);
LOAD_HSTRING(m_hstrSpawner);
LOAD_DWORD(m_cSpawn);
for ( int iSpawner = 0 ; iSpawner < kMaxSpawners ; iSpawner++ )
{
LOAD_HOBJECT(m_ahSpawners[iSpawner]);
}
}
// ----------------------------------------------------------------------- //
//
// ROUTINE: RandomSpawner::Setup()
//
// PURPOSE: Setup
//
// ----------------------------------------------------------------------- //
void RandomSpawner::Setup()
{
HCLASS hSpawner = g_pLTServer->GetClass("Spawner");
_ASSERT(hSpawner);
if ( !hSpawner ) return;
const char* szSpawnerBase = g_pLTServer->GetStringData(m_hstrSpawner);
_ASSERT(szSpawnerBase);
if ( !szSpawnerBase ) return;
int cSpawners = 0;
while ( cSpawners <= kMaxSpawners )
{
char szSpawner[256];
sprintf(szSpawner, "%s%2.2d", szSpawnerBase, cSpawners);
ObjArray <HOBJECT, 1> objArray;
g_pLTServer->FindNamedObjects(szSpawner,objArray);
if(!objArray.NumObjects()) break;
HOBJECT hObject = objArray.GetObject(0);
if ( hObject )
{
m_ahSpawners[cSpawners++] = hObject;
}
else
{
break;
}
}
}
// ----------------------------------------------------------------------- //
//
// ROUTINE: RandomSpawner::Spawn()
//
// PURPOSE: Spawn
//
// ----------------------------------------------------------------------- //
void RandomSpawner::Spawn()
{
LTBOOL abSpawned[kMaxSpawners];
memset(abSpawned, LTFALSE, sizeof(abSpawned));
for ( int iSpawn = 0 ; iSpawn < m_cSpawn ; iSpawn++ )
{
// Keep picking a random one until we have one that hasn't spawned yet
int iSafety = 50000;
int iSpawner = GetRandom(0, kMaxSpawners-1);
while ( (abSpawned[iSpawner] || !m_ahSpawners[iSpawner]) && (--iSafety > 0) )
{
iSpawner = GetRandom(0, kMaxSpawners-1);
}
abSpawned[iSpawner] = LTTRUE;
// Trigger the spawner to spawn the default object
SendTriggerMsgToObject(this, m_ahSpawners[iSpawner], LTFALSE, (char*)s_szSpawnTrigger);
}
} | [
"[email protected]"
]
| [
[
[
1,
317
]
]
]
|
91e04d9d02bf4b5671b446c0d5602de79c0fd962 | e7c45d18fa1e4285e5227e5984e07c47f8867d1d | /Common/ModelsC/RTTS/RtSpMdl.h | 4df6d459fbcebb46e99de26d93cd3eee1dc04f4d | []
| 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 | 1,726 | h | //================== SysCAD - Copyright Kenwalt (Pty) Ltd ===================
// $Nokeywords: $
//===========================================================================
#ifndef __RTSPMDL_H
#define __RTSPMDL_H
#ifndef __SC_DEFS_H
#include <sc_defs.h>
#endif
#ifndef __SP_MODEL_H
#include <sp_model.h>
#endif
#define MDLBASE
#define BASIC1
#include "models.h"
#ifdef __RTSPMDL_CPP
#define DllImportExport DllExport
#elif !defined(RTTS)
#define DllImportExport DllImport
#else
#define DllImportExport
#endif
// ===========================================================================
//
// Rio Tinto Specie Model
//
// ===========================================================================
DEFINE_SPMODEL(CRtSpMdl)
// ===========================================================================
class DllImportExport CRtSpMdl : public SpModel
{
DEFINE_SPARES(CRtSpMdl)
public:
CRtSpMdl(pTagObjClass pClass_, pchar Tag_, pTaggedObject pAttach, TagObjAttachment eAttach);
virtual ~CRtSpMdl();
virtual bool IsBaseClassOf(pSpModel pOther)
{ return (dynamic_cast<CRtSpMdl*>(pOther)) != NULL; };
virtual void BuildDataDefn_Vars(DataDefnBlk & DDB);
virtual flag DataXchg(DataChangeBlk & DCB);
virtual flag ValidateData(ValidateDataBlk & VDB);
public:
// ConditionBlk Override
DEFINE_CI(CRtSpMdl, SpModel, 6);
};
// ==========================================================================
//
// End
//
// ==========================================================================
#undef DllImportExport
#endif
| [
"[email protected]"
]
| [
[
[
1,
66
]
]
]
|
26416462d72773310a4e0d27727f440edc256314 | 6b99c157ea698e70fca17073c680638f8e516d08 | /Connection.cpp | a104e325e7d60930ecde590ad9b3d29b86f158b1 | []
| no_license | melagabri/sendelf | 3aef89b2e3e7d0424e738fbe87701672d6026fbf | beb17f02ceef3f71cf9e13cae545abe77c282764 | refs/heads/master | 2021-01-10T06:30:37.130626 | 2009-10-10T16:39:39 | 2009-10-10T16:39:39 | 54,057,363 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 127 | cpp | #include "StdAfx.h"
#include "Connection.h"
CConnection::CConnection(void)
{
}
CConnection::~CConnection(void)
{
}
| [
"[email protected]"
]
| [
[
[
1,
10
]
]
]
|
5b9745868c1d50bb6f5758764fae04fc169635a3 | 1d415fdfabd9db522a4c3bca4ba66877ec5b8ef4 | /avstream/ttheaderlist.h | c683b72ecb021fc3d0e3c23fc3cfd4738a9a53e4 | []
| 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 | 3,383 | h | /*----------------------------------------------------------------------------*/
/* COPYRIGHT: TriTime (c) 2003/2010 / www.tritime.org */
/*----------------------------------------------------------------------------*/
/* PROJEKT : TTCUT 2005 */
/* FILE : ttheaderlist.h */
/*----------------------------------------------------------------------------*/
/* AUTHOR : b. altendorf (E-Mail: [email protected]) DATE: 05/12/2005 */
/* MODIFIED: b. altendorf DATE: 06/20/2008 */
/* MODIFIED: DATE: */
/*----------------------------------------------------------------------------*/
// ----------------------------------------------------------------------------
// TTHEADERLIST
// ----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Overview
// -----------------------------------------------------------------------------
//
// +- TTAudioHeaderList
// |
// TTHeaderList -+
// |
// +- TTVideoHeaderList
//
// -----------------------------------------------------------------------------
/*----------------------------------------------------------------------------*/
/* 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. */
/*----------------------------------------------------------------------------*/
#ifndef TTHEADERLIST_H
#define TTHEADERLIST_H
#include "ttavheader.h"
#include "../common/ttmessagelogger.h"
#include <QVector>
// -----------------------------------------------------------------------------
// TTHeaderList: Pointer list for TTAVHeader objects
// -----------------------------------------------------------------------------
class TTHeaderList : public QVector<TTAVHeader*>
{
public:
virtual ~TTHeaderList();
virtual void add( TTAVHeader* header );
virtual void deleteAll();
protected:
TTHeaderList(int size);
virtual void sort() = 0;
virtual void checkIndexRange(int index);
protected:
TTMessageLogger* log;
int initial_size;
};
#endif //TTHEADERLIST
| [
"[email protected]"
]
| [
[
[
1,
73
]
]
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.