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
6a9b3e779247924ff7ccf7c82655b0a7c055d8f6
e07af5d5401cec17dc0bbf6dea61f6c048f07787
/vlist.cpp
5487d3d34ac3b16117ab549998ebdf1cac01f82e
[]
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
15,974
cpp
//////////////////////////////////////////////////////////////////////////////// ////////// Author: newblue <[email protected]> ////////// Copyright by newblue, 2008. //////////////////////////////////////////////////////////////////////////////// #include "vlist.hpp" class Column { public: Column (); Column ( const wxString& label, const size_t& width = 200 ); ~Column (); size_t GetWidth () const; void SetWidth ( const size_t& width ); virtual void Draw ( wxDC& dc, const wxRect& rect ); Column& operator+= ( const size_t& width ); Column& operator-= ( const size_t& width ); Column& operator++ (); Column& operator-- (); private: size_t m_width; wxString m_label; }; Column::Column () {} Column::Column ( const wxString& label, const size_t& width ) : m_label (label), m_width (width) {} Column& Column::operator+= ( const size_t& width ) { m_width += width; return *this; } Column& Column::operator-= ( const size_t& width ) { m_width = ( m_width - width ) > 50 ? m_width - width : 50 ; return *this; } Column& Column::operator++ () { ++m_width; return *this; } Column& Column::operator-- () { if ( m_width >=50 ) --m_width; return *this; } size_t Column::GetWidth () const { return m_width; } void Column::SetWidth ( const size_t& width ) { m_width = width; } void Column::Draw ( wxDC& dc, const wxRect& rect ) { dc.DrawText ( m_label, rect.x, rect.y ); } Column::~Column () {} class Header : public wxWindow { public: Header ( wxWindow* parent, wxWindowID id ); ~Header (); void AddColumn ( Column* col ); size_t Count () const; size_t GetWidth ( const size_t& idx ) const; private: int HitBorder ( const wxPoint& point ); int InsideCol ( const wxPoint& point ); int WidthFromBegin ( const int& col ); void DrawCurrent (); void OnMouse ( wxMouseEvent& event ); void OnPaint ( wxPaintEvent& event ); void DrawRectangle ( wxDC& dc, const wxRect& rect ); typedef std::vector < Column* > Columns; Columns m_cols; bool m_dragging; int m_dragcurrent; int m_dragpoint; DECLARE_EVENT_TABLE () }; BEGIN_EVENT_TABLE ( Header, wxWindow ) EVT_MOUSE_EVENTS ( Header::OnMouse ) EVT_PAINT ( Header::OnPaint ) END_EVENT_TABLE () Header::Header ( wxWindow* parent, wxWindowID id ) : wxWindow ( parent, id, wxDefaultPosition, wxDefaultSize, 0, wxT("Header") ), m_dragging (false), m_dragcurrent (-1) { wxFont font = GetFont (); SetBackgroundColour ( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE) ); if ( font.IsOk () ) { SetClientSize (wxSize (-1, font.GetPointSize() + 10 )); } } size_t Header::Count () const { return m_cols.size (); } size_t Header::GetWidth ( const size_t& idx ) const { wxASSERT ( idx >= 0 && idx < m_cols.size () ); return m_cols[idx]->GetWidth (); } int Header::WidthFromBegin ( const int& col ) { int pos = 0, count = m_cols.size (), width = 0; for ( ; pos < count && pos != col; ++pos ) { width += (*m_cols[pos]).GetWidth(); } return width; } int Header::HitBorder ( const wxPoint& point ) { int pos = 0, count = m_cols.size () - 1, ret = -1, width = 0; for ( ; pos < count; ++pos ) { width += (*m_cols[pos]).GetWidth (); if ( point.x == width - 1 || point.x == width ) { ret = pos; break; } } return ret; } void Header::OnMouse ( wxMouseEvent& event ) { int cwidth = 0, bwidth = 0; GetClientSize ( &cwidth, NULL ); wxPoint point = event.GetPosition (); if ( m_dragging ) { DrawCurrent (); //! 这一行必须加上,不然鼠标拖动的时候,屏幕会花掉。 if ( event.ButtonUp () ) { m_dragging = false; m_dragcurrent = -1; wxWindow *parent = GetParent(); wxASSERT ( parent != NULL ); parent->Refresh (); } else if ( point.x <= cwidth ) { Column *col = m_cols[m_dragcurrent]; size_t x = 0, total_width = 0; total_width = WidthFromBegin ( m_dragcurrent ) + 50; if ( point.x > total_width ) { x = m_dragpoint - point.x; if ( x > 0 ) { (*col) -= x; m_dragpoint = point.x; } else if ( x < 0 ) { (*col) += (-x); m_dragpoint = point.x; } } } Refresh (); DrawCurrent (); } else { int fp = HitBorder (point); if ( fp != -1 && event.LeftDown () ) { m_dragcurrent = fp; m_dragging = true; m_dragpoint = point.x; DrawCurrent (); } else { SetCursor (wxCursor ( fp == -1 ? wxCURSOR_ARROW : wxCURSOR_SIZEWE)); } } } void Header::DrawCurrent () { wxVisualList* parent = static_cast <wxVisualList*> (GetParent ()); wxASSERT ( parent != NULL ); int sx = 0, sy = 0, ex = 0, ey = 0; ex = sx = m_dragpoint; GetClientSize ( NULL, &sy ); ClientToScreen ( NULL, &sy ); parent->GetClientSize ( NULL, &ey ); parent->ClientToScreen ( &ex, &ey ); sx = ex; wxScreenDC dc; dc.SetLogicalFunction (wxINVERT); dc.SetPen (wxPen (*wxBLACK, 1, wxDOT)); dc.SetBrush (*wxTRANSPARENT_BRUSH); dc.DrawLine (sx, sy, ex, ey); dc.SetLogicalFunction (wxCOPY); dc.SetPen (wxNullPen); dc.SetBrush (wxNullBrush); } void Header::OnPaint ( wxPaintEvent& event ) { wxPaintDC dc (this); wxSize size = GetClientSize (); dc.SetFont (GetFont ()); if ( m_cols.empty () ) { DrawRectangle (dc, wxRect ( 0, 0, size.GetWidth(), size.GetHeight())); } else { wxRect rect ( 0, 0, 0, size.GetHeight () ), textrect; Columns::iterator itr; for ( itr = m_cols.begin(); itr < m_cols.end(); ++itr ) { if ( (*itr)->GetWidth () <= 0 ) continue; rect.width = ( itr+1 != m_cols.end() ? (*itr)->GetWidth() : size.GetWidth() - rect.width ); textrect.x = rect.x + 5; textrect.y = 2; textrect.width = (*itr)->GetWidth (); textrect.height = rect.height; DrawRectangle ( dc, rect ); (*itr)->Draw (dc, textrect ); rect.x += (*itr)->GetWidth(); if ( rect.x >= size.GetWidth() ) { break; } } } } void Header::DrawRectangle ( wxDC& dc, const wxRect& rect ) { wxPen op, np, hl, shadow; wxBrush ob, nb; op = dc.GetPen (); ob = dc.GetBrush (); np = wxPen (*wxBLACK); nb = wxBrush (wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); hl = wxPen (wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT)); shadow = wxPen (wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW)); dc.SetPen (hl); dc.DrawLine ( rect.x, rect.y , rect.x + rect.width, rect.y ); dc.SetBrush (nb); dc.SetPen (np); dc.DrawLine ( rect.x, rect.height - 1, rect.x + rect.width, rect.height - 1); dc.DrawLine ( rect.x, rect.y, rect.x, rect.height ); dc.SetPen (op); dc.SetBrush (ob); } void Header::AddColumn ( Column* col ) { m_cols.push_back ( col ); } Header::~Header () { Columns::iterator itr; for ( itr = m_cols.begin(); itr < m_cols.end (); ++itr ) { delete (*itr); *itr = NULL; } m_cols.clear (); } class wxVList : public wxWindow { public: wxVList ( wxWindow *parent, wxWindowID id ); ~wxVList (); private: wxPoint m_mouse; void OnMouse ( wxMouseEvent& event ); void OnPaint ( wxPaintEvent& event ); DECLARE_EVENT_TABLE () }; BEGIN_EVENT_TABLE ( wxVList, wxWindow ) EVT_MOUSE_EVENTS ( wxVList::OnMouse ) EVT_PAINT ( wxVList::OnPaint ) END_EVENT_TABLE () wxVList::wxVList ( wxWindow *parent, wxWindowID id ) : wxWindow ( parent, id, wxDefaultPosition, wxDefaultSize, 0, wxT("wxVListWindow")) {} wxVList::~wxVList () {} void wxVList::OnMouse ( wxMouseEvent& event ) { wxVisualList *parent = static_cast <wxVisualList*> ( GetParent () ); wxASSERT ( parent != NULL ); parent->OnMouse (event); event.Skip (); } void wxVList::OnPaint ( wxPaintEvent& event ) { } BEGIN_EVENT_TABLE ( wxVisualList, wxPanel ) EVT_SIZE ( wxVisualList::OnResize ) EVT_PAINT ( wxVisualList::OnPaint ) EVT_SCROLL ( wxVisualList::OnScroll ) EVT_MOUSE_EVENTS( wxVisualList::OnMouse ) END_EVENT_TABLE () wxVisualList::wxVisualList ( wxWindow* parent, wxWindowID id, long style, const wxString& name ) : wxPanel ( parent, id, wxDefaultPosition, wxDefaultSize, style, name ), m_count (0), m_select (-1), m_position (0) { DoUI (); } void wxVisualList::DoUI () { wxBoxSizer *main, *body; main = new wxBoxSizer (wxVERTICAL); body = new wxBoxSizer (wxHORIZONTAL); this->SetSizer (main); wxVList* list = new wxVList( this, ID_LIST ); wxScrollBar *bar = new wxScrollBar ( this, ID_VSCROLL, wxDefaultPosition, wxDefaultSize, wxSB_VERTICAL); Header *header = new Header ( this, ID_HEADER ); wxASSERT ( list != NULL && bar != NULL && header != NULL ); list->SetBackgroundColour ( wxSystemSettings::GetColour (wxSYS_COLOUR_WINDOW)); bar->Enable (false); wxFont flist, fheader; flist = *wxNORMAL_FONT; //wxSystemSettings::GetFont (wxSYS_SYSTEM_FONT); fheader = wxSystemSettings::GetFont (wxSYS_DEFAULT_GUI_FONT); list->SetFont (flist); header->SetFont (fheader); body->Add ( list, 0, wxEXPAND, 0 ); body->Add ( bar, 0, wxALL, 0 ); main->Add ( header, 0, wxALL, 0 ); main->Add ( body, 0, wxALL, 0 ); main->SetSizeHints (this); SetAutoLayout (true); } void wxVisualList::SetCount ( const size_t& count ) { m_count = count; m_select = -1; m_position = 0; CalcScroll (); Refresh (); } void wxVisualList::AddColumn ( const wxString& label, const size_t& width ) { Header* header = static_cast <Header*> ( FindWindow (ID_HEADER) ); wxASSERT ( header != NULL ); header->AddColumn ( new Column (label, width) ); } void wxVisualList::CalcScroll () { wxWindow *list = FindWindow ( ID_LIST ); wxScrollBar *vscroll = static_cast <wxScrollBar*> (FindWindow(ID_VSCROLL)); wxASSERT ( list != NULL && vscroll != NULL ); wxSize lsize = list->GetClientSize (); size_t linecount = lsize.GetHeight () / GetLineHeight (), count = 0; count = ( (lsize.GetHeight() % GetLineHeight()) < GetLineHeight() ? m_count + 1 : m_count ); vscroll->Enable ( count > 0 ? true : false ); vscroll->SetScrollbar ( m_position, linecount, count, linecount, true ); } void wxVisualList::OnMouse ( wxMouseEvent& event ) { m_mouse.x = event.GetX (); m_mouse.y = event.GetY (); if ( event.ButtonDown () ) { size_t lineheight = GetLineHeight (), linecount = m_mouse.y / lineheight, select; select = linecount + m_position; if ( select < m_count ) { m_select = linecount + m_position; Refresh (false); } } } void wxVisualList::OnPaint ( wxPaintEvent& event ) { wxWindow *list = FindWindow (ID_LIST); Header *header = static_cast <Header*> (FindWindow (ID_HEADER)); wxASSERT ( list != NULL && header != NULL ); wxSize lsize = list->GetClientSize (); size_t line_count = 0, lineheight = GetLineHeight (); size_t col_count = 0, col_pos = 0, line_pos = 0, total_width = 0; line_count = lsize.GetHeight () / lineheight; line_count = (line_count + m_position) > m_count ? m_count - m_position : line_count; col_count = header->Count (); col_pos = 0; wxPaintDC dc (list); dc.SetFont ( list->GetFont () ); wxRect rect; if ( m_position <= m_select && ( m_position + line_count ) >= m_select ) { rect = CalcLineRect ( lsize, m_select - m_position, lineheight ); DrawSelectBox ( dc, rect ); } for ( total_width = 0, col_pos = 0; col_pos < col_count && m_count != 0; ++col_pos ) { size_t width = header->GetWidth (col_pos); if ( col_pos + 1 == col_count ) { int w; GetClientSize ( &w, NULL ); width += w - total_width - width; } for ( line_pos = 0; line_pos < line_count; ++line_pos ) { rect = CalcLineRect ( lsize, line_pos, lineheight ); rect.x += total_width; rect.width = width; OnDrawLine ( dc, line_pos + m_position, col_pos, rect ); } total_width += width; } event.Skip (); } void wxVisualList::OnDrawLine ( wxDC& dc, const size_t& line, const size_t& col, const wxRect& rect ) { wxDCClipper (dc, rect.x, rect.y, rect.width - 1, rect.height); dc.DrawText (wxString::Format (wxT("Line %d %d"), line, col), rect.x, rect.y); } void wxVisualList::DrawSelectBox ( wxDC& dc, const wxRect& rect ) { wxPen pen = dc.GetPen (), newpen = (*wxBLACK_PEN); newpen.SetStyle (wxLONG_DASH|wxTRANSPARENT); dc.SetPen ( newpen ); dc.DrawRectangle ( rect.x, rect.y + 1, rect.width - 1, rect.height + 1 ); dc.SetPen (pen); } wxRect wxVisualList::CalcLineRect ( const wxSize& size, const size_t& line, const size_t& lineheight ) const { return wxRect ( 1, line * lineheight, size.GetWidth(), lineheight ); } void wxVisualList::OnScroll ( wxScrollEvent& event ) { wxScrollBar *bar = static_cast <wxScrollBar*> (FindWindow (ID_VSCROLL)); wxWindow *list = FindWindow (ID_LIST); wxASSERT ( bar != NULL && list != NULL ); m_position = bar->GetThumbPosition (); list->SetFocus (); Refresh (false); } void wxVisualList::OnResize ( wxSizeEvent& event ) { wxSize size = event.GetSize (); wxWindow *list = FindWindow (ID_LIST); wxScrollBar *bar = static_cast <wxScrollBar*> (FindWindow (ID_VSCROLL)); wxWindow *header = FindWindow (ID_HEADER); wxASSERT ( list != NULL && bar != NULL ); wxSize listsize, barsize, headersize; listsize = list->GetSize (); barsize = bar->GetSize (); headersize = header->GetSize (); headersize.Set ( size.GetWidth (), headersize.GetHeight() ); listsize.Set ( size.GetWidth () - barsize.GetWidth(), size.GetHeight () - headersize.GetHeight () ); list->SetMinSize ( listsize ); list->Refresh (false); barsize.SetHeight ( size.GetHeight () - headersize.GetHeight() ); bar->SetMinSize ( barsize ); bar->Refresh (); header->SetMinSize ( headersize ); header->Refresh (false); if ( m_count != 0 ) CalcScroll (); event.Skip (); } size_t wxVisualList::GetLineHeight () const { return ( GetFont().IsOk () ? GetFont ().GetPointSize () + 4: 12 ); } wxVisualList::~wxVisualList () {}
[ [ [ 1, 502 ] ] ]
9e7ba97cb01eef6550c6fade1a75b7cfe9255c07
91b964984762870246a2a71cb32187eb9e85d74e
/SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/libs/wave/test/testwave/testfiles/t_9_003.cpp
24923ef8c831467101571d31f24db84f60c83dc7
[ "BSL-1.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
willrebuild/flyffsf
e5911fb412221e00a20a6867fd00c55afca593c7
d38cc11790480d617b38bb5fc50729d676aef80d
refs/heads/master
2021-01-19T20:27:35.200154
2011-02-10T12:34:43
2011-02-10T12:34:43
32,710,780
3
0
null
null
null
null
UTF-8
C++
false
false
1,214
cpp
/*============================================================================= Boost.Wave: A Standard compliant C++ preprocessor library http://www.boost.org/ Copyright (c) 2001-2006 Hartmut Kaiser. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ // Test, if additional whitespace is inserted at appropriate places. #define STRINGIZE(x) STRINGIZE_D(x) #define STRINGIZE_D(x) #x #define X() 1 #define PLUS() + #define MINUS() - #define DOT() . //R #line 21 "t_9_003.cpp" X()2 //R 1 2 STRINGIZE( X()2 ) //R "12" //R X() 2 //R 1 2 STRINGIZE( X() 2 ) //R "1 2" //R PLUS()MINUS() //R + - STRINGIZE( PLUS()MINUS() ) //R "+-" //R PLUS()PLUS() //R + + STRINGIZE( PLUS()PLUS() ) //R "++" //R MINUS()MINUS() //R - - STRINGIZE( MINUS()MINUS() ) //R "--" //R DOT()DOT()DOT() //R .. . STRINGIZE( DOT()DOT()DOT() ) //R "..."
[ "[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278" ]
[ [ [ 1, 37 ] ] ]
6d75bf970ea7654e4806087101f773f3a8742cc5
cd0987589d3815de1dea8529a7705caac479e7e9
/webkit/WebKit2/Platform/CoreIPC/ArgumentDecoder.h
a983e252734c44b5e3e93db691775912038aac70
[]
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
4,249
h
/* * 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. */ #ifndef ArgumentDecoder_h #define ArgumentDecoder_h #include "ArgumentCoder.h" #include "Attachment.h" #include <wtf/Deque.h> #include <wtf/Vector.h> namespace CoreIPC { class ArgumentDecoder { public: ArgumentDecoder(const uint8_t* buffer, size_t bufferSize); ArgumentDecoder(const uint8_t* buffer, size_t bufferSize, Deque<Attachment>&); ~ArgumentDecoder(); uint64_t destinationID() const { return m_destinationID; } bool isInvalid() const { return m_bufferPos > m_bufferEnd; } void markInvalid() { m_bufferPos = m_bufferEnd + 1; } bool decodeBytes(Vector<uint8_t>&); bool decodeBytes(uint8_t*, size_t); bool decodeBool(bool&); bool decodeUInt32(uint32_t&); bool decodeUInt64(uint64_t&); bool decodeInt32(int32_t&); bool decodeInt64(int64_t&); bool decodeFloat(float&); bool decodeDouble(double&); template<typename T> bool bufferIsLargeEnoughToContain(size_t numElements) const { if (numElements > std::numeric_limits<size_t>::max() / sizeof(T)) return false; return bufferIsLargeEnoughToContain(__alignof(T), numElements * sizeof(T)); } // Generic type decode function. template<typename T> bool decode(T& t) { return ArgumentCoder<T>::decode(this, t); } // This overload exists so we can pass temporaries to decode. In the Star Trek future, it // can take an rvalue reference instead. template<typename T> bool decode(const T& t) { return decode(const_cast<T&>(t)); } bool removeAttachment(Attachment&); void debug(); private: ArgumentDecoder(const ArgumentDecoder*); ArgumentDecoder* operator=(const ArgumentDecoder*); void initialize(const uint8_t* buffer, size_t bufferSize); bool alignBufferPosition(unsigned alignment, size_t size); bool bufferIsLargeEnoughToContain(unsigned alignment, size_t size) const; uint64_t m_destinationID; uint8_t* m_buffer; uint8_t* m_bufferPos; uint8_t* m_bufferEnd; Deque<Attachment> m_attachments; }; template<> inline bool ArgumentDecoder::decode(bool& n) { return decodeBool(n); } template<> inline bool ArgumentDecoder::decode(uint32_t& n) { return decodeUInt32(n); } template<> inline bool ArgumentDecoder::decode(uint64_t& n) { return decodeUInt64(n); } template<> inline bool ArgumentDecoder::decode(int32_t& n) { return decodeInt32(n); } template<> inline bool ArgumentDecoder::decode(int64_t& n) { return decodeInt64(n); } template<> inline bool ArgumentDecoder::decode(float& n) { return decodeFloat(n); } template<> inline bool ArgumentDecoder::decode(double& n) { return decodeDouble(n); } } // namespace CoreIPC #endif // ArgumentDecoder_h
[ [ [ 1, 139 ] ] ]
ad35cce39f78de6bb899b46883f7b70d62d000bd
c86f787916e295d20607cbffc13c524018888a0f
/tp1/codigo/ejercicio2/benchmark/poda_cant_operaciones/main2.cpp
c0fa05b026fd6efe93c325d4761002a3d2e85af5
[]
no_license
federicoemartinez/algo3-2008
0039a4bc6d83ab8005fa2169b919e6c03524bad5
3b04cbea4583d76d7a97f2aee72493b4b571a77b
refs/heads/master
2020-06-05T05:56:20.127248
2008-08-04T04:59:32
2008-08-04T04:59:32
32,117,945
0
0
null
null
null
null
ISO-8859-10
C++
false
false
3,780
cpp
#include <iostream> #include <assert.h> #include <string> #include <fstream> #include "SolucionPosible.h" using namespace std; void camionAux(SolucionPosible& candActual, Cosa* cosas, unsigned capacidad,unsigned indice, unsigned cant,SolucionPosible& mejorSol); void camion(Camion& c,SolucionPosible& mejorSol) { operaciones++; SolucionPosible * s = new SolucionPosible(c.cantCosas); camionAux(*s,c.cosas,c.capacidad,0,c.cantCosas,mejorSol); operaciones++; delete s; } // Variables utilizadas: // capacidad: capacidad del camion // cosas: arreglo con las cosas que hay para llevar // indice: posicion del arreglo que estoy tratando de meter // cant: tamaņo del arreglo cosas // candActual: la solucion que voy construyendo // mejorSol: la mejor solucion encontrada hasta ahora void camionAux(SolucionPosible& candActual, Cosa* cosas, unsigned capacidad,unsigned indice, unsigned cant,SolucionPosible& mejorSol){ // cuando ya llegue hasta el ultimo elemento paro, pero me fijo si consegui una mejor solucion operaciones = operaciones + 3; if(indice == cant && candActual.valor > mejorSol.valor) { operaciones++; mejorSol = candActual; return; } // caso base operaciones++; if(indice == cant) return; // caso recursivo operaciones++; while(indice < cant) { operaciones = operaciones + 2; if(candActual.costo + cosas[indice].costo <= capacidad) { // operaciones++; candActual.agregar(indice,cosas[indice].costo,cosas[indice].valor); operaciones++; camionAux(candActual,cosas, capacidad, indice+1, cant, mejorSol); // operaciones++; //sacamos el elemento agregado para hacer backtracking candActual.sacar(indice,cosas[indice].costo, cosas[indice].valor); } operaciones++; operaciones++; indice = indice + 1; } operaciones++; if(candActual.valor > mejorSol.valor) { operaciones++; mejorSol = candActual; } } int main(int argc, char* argv[]) { // leo los datos de entrada string ruta; if(argc >= 2) { ruta = argv[1]; } else { ruta="Tp1Ej2.in"; } fstream f (ruta.c_str()); assert(f.is_open()); string caso; f >> caso; // preparo el archivo de salida string salida; if(argc > 2) { salida = argv[2]; } else { salida = "Tp1Ej2.out"; } ofstream o (salida.c_str()); // leo la secuencia de cosas while(caso != "Fin"){ operaciones = 0; unsigned cantElem, capacidad; f >> cantElem; f >> capacidad; Cosa* cs = new Cosa[cantElem]; for(unsigned i = 0; i < cantElem; i++) { unsigned costo, valor; f >> valor; f >> costo; cs[i] = Cosa(valor,costo); } // resuelvo este caso Camion cam = Camion(cs,capacidad,cantElem); SolucionPosible* s = new SolucionPosible(cam.cantCosas); camion(cam,*s); // almaceno la salida del programa o << s->valor << " "; unsigned contador = 0; for(unsigned int i = 0; i < cam.cantCosas; i++) { if(s->guardo[i]) { contador++; } } o << contador << " "; for(unsigned int i = 0; i < cam.cantCosas; i++) { if(s->guardo[i]) { o << i+1 << " "; } } o << endl; delete cs; delete s; f >> caso; cout << operaciones << endl; } return 0; }
[ "seges.ar@bfd18afd-6e49-0410-abef-09437ef2666c" ]
[ [ [ 1, 139 ] ] ]
d5b03cbb881f90da415871b1d7118deaeb1ee9e8
c4f657391c5547c46f93ab933795935b0a5501d9
/Arduino/MSFTimeExample/MSFTime.h
faa238e18315f9e327563d062fcee7d1351052d7
[]
no_license
syninys/LowLevel
d769af6716e38ff181f13811cd9bd9f5c855c9d9
a3a17571f459dfdd823088a01f11dd0f20c63d27
refs/heads/master
2016-09-06T08:11:37.757368
2011-10-14T21:04:10
2011-10-14T21:04:10
2,543,840
0
1
null
null
null
null
UTF-8
C++
false
false
1,892
h
// MSFTime // Jarkman, 01/2011 // http://www.jarkman.co.uk/catalog/robots/msftime.htm // Decodes MSF time signals from a receiver like this: // http://www.pvelectronics.co.uk/index.php?main_page=product_info&cPath=9&products_id=2 // and integrates with the Time library to provide a real-time clock #ifndef MSFTime_h #define MSFTime_h #include <inttypes.h> typedef uint8_t byte; typedef uint8_t boolean; #define MSF_STATUS_CARRIER 1 // got radio activity of some sort #define MSF_STATUS_WAITING 2 // waiting for a sync marker #define MSF_STATUS_READING 4 // currently reading in a fix #define MSF_STATUS_FIX 8 // got a fix that's less than an hour old #define MSF_STATUS_FRESH_FIX 16 // got a fix on our last cycle class MSFTime { private: boolean mIsReading; byte mInputPin; byte mLedPin; volatile long mOffStartMillis; volatile long mOnStartMillis; volatile long mPrevOffStartMillis; volatile long mPrevOnStartMillis; long mOnWidth; // the fix we're reading in byte mABits[8]; byte mBBits[8]; volatile byte mBitIndex; volatile byte mGoodPulses; void doDecode(); boolean checkValid(); boolean checkParity( byte *bits, int from, int to, boolean p ); void setBit( byte*bits, int bitIndex, byte value ); boolean getBit( byte*bits, int bitIndex ); byte decodeBCD( byte *bits, byte lsb, byte msb ); public: volatile long mFixMillis; // value of millis() at last fix volatile byte mFixYear; // 0-99 volatile byte mFixMonth; // 1-12 volatile byte mFixDayOfMonth; // 1-31 volatile byte mFixDayOfWeek; volatile byte mFixHour; // 0-23 volatile byte mFixMinute; // 0-59 MSFTime(); void stateChange(); void init(byte ledPin); // initialise with radio signal mirrored on given pin time_t getTime(); byte getStatus(); byte getProgess(); long getFixAge(); }; #endif
[ "sdjp@heisenberg.(none)" ]
[ [ [ 1, 81 ] ] ]
93da5d92d8a9cfd2965da94db63ce037b87135d3
b83c990328347a0a2130716fd99788c49c29621e
/include/boost/archive/detail/register_archive.hpp
8e0031b248c2ca86970fa3c43fc7ad7309182ad9
[]
no_license
SpliFF/mingwlibs
c6249fbb13abd74ee9c16e0a049c88b27bd357cf
12d1369c9c1c2cc342f66c51d045b95c811ff90c
refs/heads/master
2021-01-18T03:51:51.198506
2010-06-13T15:13:20
2010-06-13T15:13:41
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,946
hpp
// Copyright David Abrahams 2006. Distributed under the Boost // Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_ARCHIVE_DETAIL_REGISTER_ARCHIVE_DWA2006521_HPP # define BOOST_ARCHIVE_DETAIL_REGISTER_ARCHIVE_DWA2006521_HPP namespace boost { namespace archive { namespace detail { // No instantiate_ptr_serialization overloads generated by // BOOST_SERIALIZATION_REGISTER_ARCHIVE that lexically follow the call // will be seen *unless* they are in an associated namespace of one of // the arguments, so we pass one of these along to make sure this // namespace is considered. See temp.dep.candidate (14.6.4.2) in the // standard. struct adl_tag {}; template <class Archive, class Serializable> struct ptr_serialization_support; // We could've just used ptr_serialization_support, above, but using // it with only a forward declaration causes vc6/7 to complain about a // missing instantiate member, even if it has one. This is just a // friendly layer of indirection. template <class Archive, class Serializable> struct _ptr_serialization_support : ptr_serialization_support<Archive,Serializable> { typedef int type; }; #ifdef __SUNPRO_CC template<int N> struct counter : counter<N-1> {}; template<> struct counter<0> {}; template<class Serializable> void instantiate_ptr_serialization(Serializable* s, int, adl_tag) { instantiate_ptr_serialization(s, counter<20>()); } template<class Archive> struct get_counter { static const int value = sizeof(adjust_counter(counter<20>())); typedef counter<value> type; typedef counter<value - 1> prior; typedef char (&next)[value+1]; }; char adjust_counter(counter<0>); template<class Serializable> void instantiate_ptr_serialization(Serializable*, counter<0>) {} #define BOOST_SERIALIZATION_REGISTER_ARCHIVE(Archive) \ namespace boost { namespace archive { namespace detail { \ get_counter<Archive>::next adjust_counter(get_counter<Archive>::type);\ template<class Serializable> \ void instantiate_ptr_serialization(Serializable* s, \ get_counter<Archive>::type) { \ ptr_serialization_support<Archive, Serializable> x; \ instantiate_ptr_serialization(s, get_counter<Archive>::prior()); \ }\ }}} #else // This function gets called, but its only purpose is to participate // in overload resolution with the functions declared by // BOOST_SERIALIZATION_REGISTER_ARCHIVE, below. // This function gets called, but its only purpose is to participate // in overload resolution with the functions declared by // BOOST_SERIALIZATION_REGISTER_ARCHIVE, below. template <class Serializable> void instantiate_ptr_serialization(Serializable*, int, adl_tag ) {} // The function declaration generated by this macro never actually // gets called, but its return type gets instantiated, and that's // enough to cause registration of serialization functions between // Archive and any exported Serializable type. See also: // boost/serialization/export.hpp # define BOOST_SERIALIZATION_REGISTER_ARCHIVE(Archive) \ namespace boost { namespace archive { namespace detail { \ \ template <class Serializable> \ BOOST_DEDUCED_TYPENAME _ptr_serialization_support<Archive, Serializable>::type \ instantiate_ptr_serialization( Serializable*, Archive*, adl_tag ); \ \ }}} #endif }}} // namespace boost::archive::detail #endif // BOOST_ARCHIVE_DETAIL_INSTANTIATE_SERIALIZE_DWA2006521_HPP
[ [ [ 1, 94 ] ] ]
b7806485cdb49e77d532e81bd761c80540104d10
9c62af23e0a1faea5aaa8dd328ba1d82688823a5
/rl/tags/techdemo2/engine/rules/src/CompositeEffect.cpp
95c593a2738facc8edfd9e1755f898aadcb3c557
[ "ClArtistic", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
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
UTF-8
C++
false
false
1,608
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 "CompositeEffect.h" namespace rl { CompositeEffect::CompositeEffect() : Effect() { } CompositeEffect::~CompositeEffect() { disable(); for (Effects::iterator it = mEffects.begin(); it != mEffects.end(); it++) { delete (*it); } } void CompositeEffect::addEffect(rl::Effect *effect) { mEffects.insert(effect); } bool CompositeEffect::isAlive() { bool alive = false; for (Effects::iterator it = mEffects.begin(); it != mEffects.end(); it++) { if ((*it)->isAlive()) alive = true; } return alive; } void CompositeEffect::apply() { for (Effects::const_iterator it = mEffects.begin(); it != mEffects.end(); it++) { (*it)->enable(); } } void CompositeEffect::remove() { for (Effects::const_iterator it = mEffects.begin(); it != mEffects.end(); it++) { (*it)->disable(); } } }
[ "tanis@4c79e8ff-cfd4-0310-af45-a38c79f83013" ]
[ [ [ 1, 64 ] ] ]
d540dc0567bfd94ba89fba1c60c146bdad15cdc3
8aa65aef3daa1a52966b287ffa33a3155e48cc84
/Source/Common/ConsoleOutputAppender.h
ad52910a3e8fde2c56efa35099d39088531fbc0c
[]
no_license
jitrc/p3d
da2e63ef4c52ccb70023d64316cbd473f3bd77d9
b9943c5ee533ddc3a5afa6b92bad15a864e40e1e
refs/heads/master
2020-04-15T09:09:16.192788
2009-06-29T04:45:02
2009-06-29T04:45:02
37,063,569
1
0
null
null
null
null
UTF-8
C++
false
false
354
h
#pragma once #include "LogAppender.h" namespace P3D { namespace LogAppenders { /* Writes log to the debug output. */ class ConsoleOutputAppender : public LogAppender { public: static LogAppender* CreateFromXMLDefenition(TiXmlElement* defenition); override void ProcessLogMessage(const LogMessage& msg); }; } }
[ "vadun87@6320d0be-1f75-11de-b650-e715bd6d7cf1" ]
[ [ [ 1, 20 ] ] ]
73f6fae4b51a582ea6aed5c8ce89ea63d02659f1
d95931daeed5ed4226a5c93e110490f6f9d4030b
/include/communication/message.h
40b63f095f3bebefdc07756832346e29bbda7566
[]
no_license
halberd-project/Poleaxe
9ee4abcebcf153137ef2a5bedd62a2582b087243
cf2c9036a9cef5696d843634ae9e8ad2664fdbbe
refs/heads/master
2020-04-05T20:16:32.376607
2010-02-10T01:06:52
2010-02-10T01:06:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,707
h
/* * * The Poleaxe Graphics and Windowing system. * * Jeff Shoulders and Robert Butler * hx86 working group * [email protected] * [email protected] * * (c) 2010 * */ #ifndef __POL_MESSAGE__ #define __POL_MESSAGE__ //system events #define MSG_STARTUP 0 #define MSG_EXIT 1 #define MSG_SYSTEM_SHUTDOWN 2 #define MSG_NO_MESSAGE 3 #define MSG_SHOW_DESKTOP 4 #define MSG_CHANGE_DESKTOP 5 // Mouse Event types #define MSG_MOUSE_BUTTON_DOWN 100 #define MSG_MOUSE_BUTTON_UP 102 #define MSG_MOUSE_MOVE 103 #define MSG_MOUSE_MOVE_Z 104 #define MSG_MOUSE_STATE_CHANGE 105 #define MSG_MOUSE_BUTTON_CHANGE 106 //Keyboard Event types #define MSG_KEYBOARD_STATE_CHANGE 200 #define MSG_KEY_UP 201 #define MSG_KEY_DOWN 202 #define MSG_SYSKEY_UP 203 #define MSG_SYSKEY_DOWN 204 //networking / socket events //todo later //graphics events #define MSG_GFX_SCREEN_RES_CHANGED 400 //Window events #define MSG_WIN_CREATE 1001 #define MSG_WIN_DESTROY 1002 #define MSG_WIN_CLOSE 1003 #define MSG_WIN_RESIZE 1004 #define MSG_WIN_MINIMIZE 1005 #define MSG_WIN_MAXIMIZE 1006 #define MSG_WIN_MOVE 1007 #define MSG_WIN_POSITION_CHANGED 1008 #define MSG_WIN_GAIN_FOCUS 1009 #define MSG_WIN_LOST_FOCUS 1010 #define MSG_WIN_MOVING 1011 #define MSG_WIN_ENABLE 1012 #define MSG_WIN_DISABLE 1013 class message : public object { protected: HANDLE handle; DWORD msgType; DWORD param1, param2; void *data; public: message(); message(HANDLE _handle, DWORD _msgType, DWORD _param1, DWORD _param2, void *_data); ~message(); HANDLE Handle(); void Handle(HANDLE _handle); DWORD MessageType(); DWORD Param1(); DWORD Param2(); void Param1(DWORD Param1); void Param2(DWORD Param2); void *Data(); void Data(void *Data); }; #endif //__POL_MESSAGE__
[ [ [ 1, 94 ] ] ]
a5e17c3dab130561346e85e7ec813d34215cb608
105cc69f4207a288be06fd7af7633787c3f3efb5
/HovercraftUniverse/HovercraftUniverse/AbstractHavokWorld.h
a0ba6ccbba3484a9bf4645a304498cbc0d8f0afc
[]
no_license
allenjacksonmaxplayio/uhasseltaacgua
330a6f2751e1d6675d1cf484ea2db0a923c9cdd0
ad54e9aa3ad841b8fc30682bd281c790a997478d
refs/heads/master
2020-12-24T21:21:28.075897
2010-06-09T18:05:23
2010-06-09T18:05:23
56,725,792
0
0
null
null
null
null
UTF-8
C++
false
false
2,505
h
#ifndef ABSTRACTHAVOKWORLD_H #define ABSTRACTHAVOKWORLD_H // Math and base include #include <Common/Base/hkBase.h> #include <Common/Base/System/hkBaseSystem.h> #include <Common/Base/Memory/hkThreadMemory.h> #include <Common/Base/Memory/Memory/Pool/hkPoolMemory.h> // World representation #include <Physics/Utilities/Serialize/hkpPhysicsData.h> #include <Physics/Dynamics/World/hkpWorld.h> #include <Common/Serialize/Packfile/hkPackfileReader.h> // Visual Debugger includes #include <Common/Visualize/hkVisualDebugger.h> #include <Physics/Utilities/VisualDebugger/hkpPhysicsContext.h> namespace HovUni { /** * Abstract class which handles a lot of basic functionality for a multithreaded havok program * The world will be initialised when load successfuly returns. */ class AbstractHavokWorld { private: // Visual Debugger hkVisualDebugger* vdb; hkpPhysicsContext* context; hkArray<hkProcessContext*> * contexts; //The real deal hkJobQueue* jobQueue; int totalNumThreadsUsed; hkJobThreadPool* threadPool; char* stackBuffer; hkPoolMemory* memoryManager; hkThreadMemory* threadMemory; protected: /** * Timestep */ hkReal mTimestep; /** * A flag that shows if a world is loaded */ bool mIsLoaded; /** * The world used in simulation */ hkpWorld* mPhysicsWorld; /** * The world in memory as loaded from file */ hkPackfileReader::AllocatedData* mLoadedData; hkpPhysicsData* mPhysicsData; public: /** * Constructor */ AbstractHavokWorld(hkReal mTimestep = 1.0/60.0f); /** * Destructor */ ~AbstractHavokWorld(void); /** * Get the world timestep * @return timestep */ inline const hkReal getTimeStep() const { return mTimestep; } /** * Load a hkv file * This will fill the mPhysicsWorld, mLoadedData and mPhysicsData * It will also set the loaded flag * @param filanem */ virtual bool load ( const char * filename ); /** * Check the loaded flag * @return true if world is loaded, false if not */ inline bool isLoaded() const { return mIsLoaded; } /** * Is called every step of the simulation before step method is called */ virtual void preStep(){}; /** * Is called every step of the simulation after step method is called */ virtual void postStep(){}; /** * Update the world * @return false if not loaded, true otherwise */ bool step(); }; } #endif
[ "[email protected]", "pintens.pieterjan@2d55a33c-0a8f-11df-aac0-2d4c26e34a4c" ]
[ [ [ 1, 2 ], [ 22, 22 ], [ 25, 25 ], [ 77, 77 ], [ 82, 82 ], [ 107, 108 ], [ 110, 110 ], [ 122, 122 ] ], [ [ 3, 21 ], [ 23, 24 ], [ 26, 76 ], [ 78, 81 ], [ 83, 106 ], [ 109, 109 ], [ 111, 121 ], [ 123, 127 ] ] ]
4e01376d679e1618a7c6c47e945d334246e80d9c
ef23e388061a637f82b815d32f7af8cb60c5bb1f
/src/mame/includes/quizpani.h
20604dd753945aaa372e3a879c51dfc2c87ff159
[]
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
599
h
class quizpani_state : public driver_device { public: quizpani_state(running_machine &machine, const driver_device_config_base &config) : driver_device(machine, config) { } UINT16 *m_bg_videoram; UINT16 *m_txt_videoram; UINT16 *m_scrollreg; tilemap_t *m_bg_tilemap; tilemap_t *m_txt_tilemap; int m_bgbank; int m_txtbank; }; /*----------- defined in video/quizpani.c -----------*/ WRITE16_HANDLER( quizpani_bg_videoram_w ); WRITE16_HANDLER( quizpani_txt_videoram_w ); WRITE16_HANDLER( quizpani_tilesbank_w ); VIDEO_START( quizpani ); SCREEN_UPDATE( quizpani );
[ "Mike@localhost" ]
[ [ [ 1, 24 ] ] ]
f386ea4cf569f8be2cebfdf98b1904a381a69c62
619941b532c6d2987c0f4e92b73549c6c945c7e5
/Stellar_/code/Render/coregraphics/shadervariation.cc
271847ceb652382b372b598859d86670d787ee45
[]
no_license
dzw/stellarengine
2b70ddefc2827be4f44ec6082201c955788a8a16
2a0a7db2e43c7c3519e79afa56db247f9708bc26
refs/heads/master
2016-09-01T21:12:36.888921
2008-12-12T12:40:37
2008-12-12T12:40:37
36,939,169
0
0
null
null
null
null
UTF-8
C++
false
false
498
cc
//------------------------------------------------------------------------------ // shadervariation.cc // (C) 2007 Radon Labs GmbH //------------------------------------------------------------------------------ #include "stdneb.h" #include "coregraphics/shadervariation.h" #if __WIN32__ namespace CoreGraphics { ImplementClass(CoreGraphics::ShaderVariation, 'SHVR', Direct3D9::D3D9ShaderVariation); } #else #error "ShaderVariation class not implemented on this platform!" #endif
[ "ctuoMail@5f320639-c338-0410-82ad-c55551ec1e38" ]
[ [ [ 1, 15 ] ] ]
3f723ed3a106899c3a8cdd6f915888485e986f90
1e90ca0380b31edfa5bd00307e802d8bb5aaa817
/ogl_learning/ogl_learning/stdafx.h
23018a072818ab29d693e96d850395fa4dab2cf9
[]
no_license
vanish87/my-opengl-ge
e89cc31816357f83caaddd153ed3bd99d1cc15a1
6c3340a8f5219dbbb6a2ece80d867bc751509c0d
refs/heads/master
2021-01-23T22:39:38.669472
2011-01-14T12:26:53
2011-01-14T12:26:53
32,132,332
0
0
null
null
null
null
GB18030
C++
false
false
361
h
// stdafx.h : 标准系统包含文件的包含文件, // 或是经常使用但不常更改的 // 特定于项目的包含文件 // #pragma once #include "targetver.h" #include <stdio.h> #include <tchar.h> #include<GL/freeglut.h> #include<iostream> using namespace std; // TODO: 在此处引用程序需要的其他头文件
[ "vanish8.7@7f91644b-6a5f-28f5-645b-ee1a16f7b3bf" ]
[ [ [ 1, 23 ] ] ]
3a65974238294431cec81c5494737d5d78ce2721
a0bc9908be9d42d58af7a1a8f8398c2f7dcfa561
/SlonEngine/src/Graphics/ProjectedGrid.cpp
ec42458b28298abd7a93ba99d4d501d7a8d8c0be
[]
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
11,011
cpp
#include "stdafx.h" #include "Graphics/Common.h" #include "Graphics/ParameterBinding.h" #include "Graphics/ProjectedGrid.h" #include "Scene/CullVisitor.h" #include <sgl/Math/Matrix.hpp> using namespace std; using namespace math; using namespace slon; using namespace scene; using namespace graphics; namespace { void setupQuadsGrid( int sizeX, int sizeY, std::vector<Vector2f>& vertices, std::vector<unsigned>& indices ) { // vertices vertices.resize(sizeX * sizeY); double dx = 1.0 / (sizeX - 1); double dy = 1.0 / (sizeY - 1); double y = 0.0; for(int i = 0; i<sizeY; ++i, y += dy) { double x = 0.0; for(int j = 0; j<sizeX; ++j, x += dx) { vertices[i*sizeX + j] = Vector2f( (float)x, (float)y ); } } // indices indices.resize( (sizeX - 1) * (sizeY - 1) * 4 ); for(int i = 0; i<sizeY - 1; ++i) { for(int j = 0; j<sizeX - 1; ++j) { int baseIndex = (i*(sizeX - 1) + j) * 4; indices[baseIndex] = i * sizeX + j; indices[baseIndex + 1] = (i + 1) * sizeX + j; indices[baseIndex + 2] = (i + 1) * sizeX + j + 1; indices[baseIndex + 3] = i * sizeX + j + 1; } } } void setupTriangleStripGrid( int sizeX, int sizeY, std::vector<Vector2f>& vertices, std::vector<unsigned>& indices ) { // vertices vertices.resize(sizeX * sizeY + 2); vertices[0] = math::Vector2f(0.0f, 0.0f); vertices[sizeX * sizeY + 1] = (sizeY % 2 == 0) ? math::Vector2f(1.0f, 1.0f) : math::Vector2f(0.0f, 1.0f); double dx = 1.0 / (double(sizeX) - 0.5); double dy = 1.0 / (double(sizeY) - 1.0); double y = 0.0; for(int i = 0; i<sizeY; ++i, y += dy) { double x = (i % 2 == 1) ? 0.0 : 0.5 * dx; for(int j = 0; j<sizeX; ++j, x += dx) { vertices[i*sizeX + j + 1] = Vector2f( (float)x, (float)y ); } } // indices indices.resize( (sizeY - 1) * sizeX * 2 + 2 ); indices[0] = 0; indices[(sizeY - 1) * sizeX * 2 + 1] = sizeY * sizeX + 1; bool forward = true; for(int i = 0; i<sizeY-1; ++i) { if (forward) { for(int j = 0; j<sizeX; ++j) { unsigned base = (i*sizeX + j) * 2 + 1; indices[base] = (i+1)*sizeX + j + 1; indices[base + 1] = i*sizeX + j + 1; } } else { for(int j = sizeX - 1; j>=0; --j) { unsigned base = (i*sizeX + (sizeX - j - 1)) * 2 + 1; indices[base] = (i+1)*sizeX + j + 1; indices[base + 1] = i*sizeX + j + 1; } } forward = !forward; } } void setupTrianglesGrid( int sizeX, int sizeY, int stripLength, std::vector<Vector2f>& vertices, std::vector<unsigned>& indices ) { // vertices vertices.resize(sizeX * sizeY); double dx = 1.0 / (double(sizeX) - 1.0); double dy = 1.0 / (double(sizeY) - 1.0); double y = 0.0; for(int i = 0; i<sizeY; ++i, y += dy) { double x = 0.0; for(int j = 0; j<sizeX; ++j, x += dx) { vertices[i*sizeX + j] = Vector2f( (float)x, (float)y ); } } // indices indices.reserve( sizeY * (sizeX - 1) * 6 ); for (int startX = 0; startX < sizeX - 1; startX += stripLength) { int maxJ = std::min(startX + stripLength, sizeX - 1); // warm strip for (int i = 0; i<stripLength; ++i) { indices.push_back(startX+i); } // fill row for(int i = 0; i<sizeY - 1; ++i) { for(int j = startX; j<maxJ; ++j) { indices.push_back( (i+1)*sizeX + j ); indices.push_back( (i+1)*sizeX + j + 1 ); indices.push_back( i*sizeX + j ); indices.push_back( i*sizeX + j ); indices.push_back( (i+1)*sizeX + j + 1 ); indices.push_back( i*sizeX + j + 1 ); } } } } } // anonymous namespace ProjectedGrid::ProjectedGrid(const effect_ptr& _effect) : effect(_effect) { assert(effect); setupGrid(128, 512); effect->bindParameter( hash_string("projectedGridCorners"), new parameter_binding<math::Vector3f>(corners, 4, true) ); effect->bindParameter( hash_string("allowCulling"), new parameter_binding<bool>(&allowCulling, 1, false) ); } ProjectedGrid::ProjectedGrid(int sizeX, int sizeY, const effect_ptr& _effect) : effect(_effect) { assert(effect); setupGrid(sizeX, sizeY); effect->bindParameter( hash_string("projectedGridCorners"), new parameter_binding<math::Vector3f>(corners, 4, true) ); effect->bindParameter( hash_string("allowCulling"), new parameter_binding<bool>(&allowCulling, 1, false) ); } void ProjectedGrid::setupGrid(int sizeX, int sizeY) { // vertices std::vector<Vector2f> vertices; std::vector<unsigned> indices; //setupQuadsGrid(sizeX, sizeY, vertices, indices); //primitiveType = sgl::QUADS; //setupTriangleStripGrid(sizeX, sizeY, vertices, indices); //primitiveType = sgl::TRIANGLE_STRIP; setupTrianglesGrid(sizeX, sizeY, 21, vertices, indices); primitiveType = sgl::TRIANGLES; allowCulling = true; // setup data sgl::Device* device = currentDevice(); { vertexBuffer.reset( device->CreateVertexBuffer() ); vertexBuffer->SetData(vertices.size() * sizeof(math::Vector2f), &vertices[0]); indexBuffer.reset( device->CreateIndexBuffer() ); indexBuffer->SetData(indices.size() * sizeof(unsigned int), &indices[0]); // retrieve binding positionBinding = detail::currentAttributeTable().queryAttribute( hash_string("position") ); // make vertex layout sgl::VertexLayout::ELEMENT elements[] = { {positionBinding->index, 2, 0, 8, sgl::FLOAT, sgl::VertexLayout::ATTRIBUTE} }; vertexLayout.reset( device->CreateVertexLayout(1, elements) ); } } void ProjectedGrid::accept(scene::CullVisitor& visitor) const { if ( const Camera* camera = visitor.getCamera() ) { math::Vector3f cameraPosition = math::get_translation( camera->getInverseViewMatrix() ); if (camera && cameraPosition.y > 0.0f) { Matrix4f projMat = camera->getProjectionMatrix(); Matrix4f modelView = camera->getViewMatrix(); Matrix4f clip = projMat * modelView; // frustum clip planes Vector3f left = Vector3f( clip(12) + clip(0), clip(13) + clip(1), clip(14) + clip(2) ); Vector3f right = Vector3f( clip(12) - clip(0), clip(13) - clip(1), clip(14) - clip(2) ); Vector3f top = Vector3f( clip(12) - clip(4), clip(13) - clip(5), clip(14) - clip(6) ); Vector3f bottom = Vector3f( clip(12) + clip(4), clip(13) + clip(5), clip(14) + clip(6) ); Vector4f farP = Vector4f( clip(12) - clip(8), clip(13) - clip(9), clip(14) - clip(10), clip(15) - clip(11) ); farP /= length( xyz(farP) ); // rays aligned with viewport corners[0] = normalize( cross(left, bottom) ); corners[1] = normalize( cross(top, left) ); corners[2] = normalize( cross(right, top) ); corners[3] = normalize( cross(bottom, right) ); // look up rays Vector3f lookUp[4]; lookUp[0] = normalize( corners[3] - corners[0] ); lookUp[1] = normalize( corners[0] - corners[1] ); lookUp[2] = normalize( corners[3] - corners[2] ); lookUp[3] = normalize( corners[1] - corners[0] ); // intersect with plane for(int i = 0; i<4; ++i) { float L = -cameraPosition.y / corners[i].y; if ( corners[i].y >= 0.0f || L > farP.w ) { // intersect with far plane L = -farP.w / dot( corners[i], math::Vector3f(farP.x, farP.y, farP.z) ); Vector3f frustumCorner = cameraPosition + L * corners[i]; // in analogy L = -frustumCorner.y / lookUp[i].y; corners[i] = frustumCorner + L * lookUp[i]; // intersection point } else { L = -cameraPosition.y / corners[i].y; corners[i] = cameraPosition + L * corners[i]; // intersection point } } // correct quad float L1 = length(corners[1] - corners[0]); float L2 = length(corners[2] - corners[3]); if ( L1 > L2 + 0.01f ) { corners[2] = corners[3] + (corners[2] - corners[3]) * L1 / L2; } else if ( L2 > L1 + 0.01f ) { corners[1] = corners[0] + (corners[1] - corners[0]) * L2 / L1; } // scale quad Vector3f center = (corners[0] + corners[1] + corners[2] + corners[3]) / 4.0f; for(int i = 0; i<4; ++i) { corners[i] += normalize(corners[i] - center) * 5.0f; } visitor.addRenderable(this); } } } void ProjectedGrid::render() const { vertexBuffer->Bind( vertexLayout.get() ); indexBuffer->Bind( sgl::IndexBuffer::UINT_32 ); currentDevice()->DrawIndexed( primitiveType, 0, indexBuffer->Size() / sizeof(unsigned int) ); }
[ "devnull@localhost" ]
[ [ [ 1, 299 ] ] ]
b2b7ffe3cee0cc0095618dd9475c42764bedf462
580738f96494d426d6e5973c5b3493026caf8b6a
/Include/Vcl/xsbuiltins.hpp
75aaa89bc210657457877f95c2b363f909cc6174
[]
no_license
bravesoftdz/cbuilder-vcl
6b460b4d535d17c309560352479b437d99383d4b
7b91ef1602681e094a6a7769ebb65ffd6f291c59
refs/heads/master
2021-01-10T14:21:03.726693
2010-01-11T11:23:45
2010-01-11T11:23:45
48,485,606
2
1
null
null
null
null
UTF-8
C++
false
false
19,173
hpp
// Borland C++ Builder // Copyright (c) 1995, 2002 by Borland Software Corporation // All rights reserved // (DO NOT EDIT: machine generated header) 'XSBuiltIns.pas' rev: 6.00 #ifndef XSBuiltInsHPP #define XSBuiltInsHPP #pragma delphiheader begin #pragma option push -w- #pragma option push -Vx #include <Types.hpp> // Pascal unit #include <FMTBcd.hpp> // Pascal unit #include <InvokeRegistry.hpp> // Pascal unit #include <SysUtils.hpp> // Pascal unit #include <SysInit.hpp> // Pascal unit #include <System.hpp> // Pascal unit //-- user supplied ----------------------------------------------------------- namespace Xsbuiltins { //-- type declarations ------------------------------------------------------- class DELPHICLASS TXSTime; class PASCALIMPLEMENTATION TXSTime : public Invokeregistry::TRemotableXS { typedef Invokeregistry::TRemotableXS inherited; private: AnsiString FFractionalSecondString; Word FHour; short FHourOffset; Word FMinute; short FMinuteOffset; bool FNegativeOffset; Word FSecond; bool FUseZeroMilliseconds; WideString __fastcall BuildHourOffset(); AnsiString __fastcall IntToFractionalSeconds(Word Value); protected: System::TDateTime __fastcall GetAsTime(void); double __fastcall GetFractionalSeconds(void); AnsiString __fastcall GetFractionalSecondString(); short __fastcall GetHourOffset(void); Word __fastcall GetMillisecond(void); short __fastcall GetMinuteOffset(void); void __fastcall SetAsTime(System::TDateTime Value); void __fastcall SetFractionalSeconds(double Value); void __fastcall SetHour(const Word Value); void __fastcall SetHourOffset(const short Value); void __fastcall SetMillisecond(const Word Value); void __fastcall SetMinute(const Word Value); void __fastcall SetMinuteOffset(const short Value); void __fastcall SetSecond(const Word Value); __property AnsiString FractionalSecondString = {read=GetFractionalSecondString}; public: __property System::TDateTime AsTime = {read=GetAsTime, write=SetAsTime}; __property double FractionalSeconds = {read=GetFractionalSeconds, write=SetFractionalSeconds}; __property Word Hour = {read=FHour, write=SetHour, default=0}; __property short HourOffset = {read=GetHourOffset, write=SetHourOffset, default=0}; __property Word Millisecond = {read=GetMillisecond, write=SetMillisecond, default=0}; __property Word Minute = {read=FMinute, write=SetMinute, default=0}; __property short MinuteOffset = {read=GetMinuteOffset, write=SetMinuteOffset, nodefault}; __property Word Second = {read=FSecond, write=SetSecond, default=0}; __property bool UseZeroMilliseconds = {read=FUseZeroMilliseconds, write=FUseZeroMilliseconds, nodefault}; TXSTime* __fastcall Clone(void); virtual void __fastcall XSToNative(WideString Value); virtual WideString __fastcall NativeToXS(); public: #pragma option push -w-inl /* TRemotable.Create */ inline __fastcall virtual TXSTime(void) : Invokeregistry::TRemotableXS() { } #pragma option pop #pragma option push -w-inl /* TRemotable.Destroy */ inline __fastcall virtual ~TXSTime(void) { } #pragma option pop }; class DELPHICLASS TXSDate; class PASCALIMPLEMENTATION TXSDate : public Invokeregistry::TRemotableXS { typedef Invokeregistry::TRemotableXS inherited; private: Word FAdditionalYearDigits; Word FMonth; Word FDay; int FYear; Word FMaxDay; Word FMaxMonth; Word FMinDay; Word FMinMonth; bool FNegativeDate; protected: System::TDateTime __fastcall GetAsDate(void); int __fastcall GetYear(void); void __fastcall SetAsDate(System::TDateTime Value); void __fastcall SetMonth(const Word Value); void __fastcall SetDay(const Word Value); void __fastcall SetYear(const int Value); __property Word MaxDay = {read=FMaxDay, write=FMaxDay, nodefault}; __property Word MaxMonth = {read=FMaxMonth, write=FMaxMonth, nodefault}; __property Word MinDay = {read=FMinDay, write=FMinDay, nodefault}; __property Word MinMonth = {read=FMinMonth, write=FMinMonth, nodefault}; public: __fastcall virtual TXSDate(void); __property Word Month = {read=FMonth, write=SetMonth, default=0}; __property Word Day = {read=FDay, write=SetDay, default=0}; __property int Year = {read=GetYear, write=SetYear, default=0}; TXSDate* __fastcall Clone(void); virtual void __fastcall XSToNative(WideString Value); virtual WideString __fastcall NativeToXS(); __property System::TDateTime AsDate = {read=GetAsDate, write=SetAsDate}; public: #pragma option push -w-inl /* TRemotable.Destroy */ inline __fastcall virtual ~TXSDate(void) { } #pragma option pop }; class DELPHICLASS TXSCustomDateTime; class PASCALIMPLEMENTATION TXSCustomDateTime : public Invokeregistry::TRemotableXS { typedef Invokeregistry::TRemotableXS inherited; private: TXSDate* FDateParam; TXSTime* FTimeParam; void __fastcall SetUseZeroMilliseconds(bool Value); bool __fastcall GetUseZeroMilliseconds(void); protected: System::TDateTime __fastcall GetAsDateTime(void); Word __fastcall GetDay(void); double __fastcall GetFractionalSeconds(void); Word __fastcall GetHour(void); short __fastcall GetHourOffset(void); Word __fastcall GetMonth(void); Word __fastcall GetMillisecond(void); Word __fastcall GetMinute(void); short __fastcall GetMinuteOffset(void); Word __fastcall GetSecond(void); int __fastcall GetYear(void); void __fastcall SetAsDateTime(System::TDateTime Value); void __fastcall SetFractionalSeconds(double Value); virtual void __fastcall SetDay(const Word Value); virtual void __fastcall SetHour(const Word Value); virtual void __fastcall SetHourOffset(const short Value); virtual void __fastcall SetMillisecond(const Word Value); virtual void __fastcall SetMinute(const Word Value); virtual void __fastcall SetMinuteOffset(const short Value); virtual void __fastcall SetMonth(const Word Value); virtual void __fastcall SetSecond(const Word Value); virtual void __fastcall SetYear(const int Value); __property Word Millisecond = {read=GetMillisecond, write=SetMillisecond, default=0}; public: __fastcall virtual TXSCustomDateTime(void); __fastcall virtual ~TXSCustomDateTime(void); __property System::TDateTime AsDateTime = {read=GetAsDateTime, write=SetAsDateTime}; __property Word Hour = {read=GetHour, write=SetHour, default=0}; __property Word Minute = {read=GetMinute, write=SetMinute, default=0}; __property Word Second = {read=GetSecond, write=SetSecond, default=0}; __property Word Month = {read=GetMonth, write=SetMonth, default=0}; __property Word Day = {read=GetDay, write=SetDay, default=0}; __property int Year = {read=GetYear, write=SetYear, default=0}; __property bool UseZeroMilliseconds = {read=GetUseZeroMilliseconds, write=SetUseZeroMilliseconds, nodefault}; }; class DELPHICLASS TXSDateTime; class DELPHICLASS TXSDuration; class PASCALIMPLEMENTATION TXSDateTime : public TXSCustomDateTime { typedef TXSCustomDateTime inherited; private: int __fastcall ValidValue(int Value, int Subtract, int Min, int Max, int &Remainder); public: TXSDuration* __fastcall CompareDateTimeParam(const TXSDateTime* Value1, const TXSDateTime* Value2); TXSDateTime* __fastcall Clone(void); __property Word Millisecond = {read=GetMillisecond, write=SetMillisecond, default=0}; __property short HourOffset = {read=GetHourOffset, write=SetHourOffset, default=0}; __property short MinuteOffset = {read=GetMinuteOffset, write=SetMinuteOffset, default=0}; virtual void __fastcall XSToNative(WideString Value); virtual WideString __fastcall NativeToXS(); public: #pragma option push -w-inl /* TXSCustomDateTime.Create */ inline __fastcall virtual TXSDateTime(void) : TXSCustomDateTime() { } #pragma option pop #pragma option push -w-inl /* TXSCustomDateTime.Destroy */ inline __fastcall virtual ~TXSDateTime(void) { } #pragma option pop }; class PASCALIMPLEMENTATION TXSDuration : public TXSCustomDateTime { typedef TXSCustomDateTime inherited; private: double FDecimalSecond; double __fastcall GetDecimalValue(const AnsiString AParam, const AnsiString AType); int __fastcall GetIntegerValue(const AnsiString AParam, const AnsiString AType); WideString __fastcall GetNumericString(const AnsiString AParam, const AnsiString AType, const bool Decimals = false); protected: void __fastcall SetDecimalSecond(const double Value); public: __fastcall virtual TXSDuration(void); virtual void __fastcall XSToNative(WideString Value); virtual WideString __fastcall NativeToXS(); __property double DecimalSecond = {read=FDecimalSecond, write=SetDecimalSecond}; public: #pragma option push -w-inl /* TXSCustomDateTime.Destroy */ inline __fastcall virtual ~TXSDuration(void) { } #pragma option pop }; class DELPHICLASS EXSDateTimeException; class PASCALIMPLEMENTATION EXSDateTimeException : public Sysutils::Exception { typedef Sysutils::Exception inherited; public: #pragma option push -w-inl /* Exception.Create */ inline __fastcall EXSDateTimeException(const AnsiString Msg) : Sysutils::Exception(Msg) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateFmt */ inline __fastcall EXSDateTimeException(const AnsiString Msg, const System::TVarRec * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateRes */ inline __fastcall EXSDateTimeException(int Ident)/* overload */ : Sysutils::Exception(Ident) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateResFmt */ inline __fastcall EXSDateTimeException(int Ident, const System::TVarRec * Args, const int Args_Size)/* overload */ : Sysutils::Exception(Ident, Args, Args_Size) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateHelp */ inline __fastcall EXSDateTimeException(const AnsiString Msg, int AHelpContext) : Sysutils::Exception(Msg, AHelpContext) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateFmtHelp */ inline __fastcall EXSDateTimeException(const AnsiString Msg, const System::TVarRec * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateResHelp */ inline __fastcall EXSDateTimeException(int Ident, int AHelpContext)/* overload */ : Sysutils::Exception(Ident, AHelpContext) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateResFmtHelp */ inline __fastcall EXSDateTimeException(System::PResStringRec ResStringRec, const System::TVarRec * Args, const int Args_Size, int AHelpContext)/* overload */ : Sysutils::Exception(ResStringRec, Args, Args_Size, AHelpContext) { } #pragma option pop public: #pragma option push -w-inl /* TObject.Destroy */ inline __fastcall virtual ~EXSDateTimeException(void) { } #pragma option pop }; class DELPHICLASS EXSDecimalException; class PASCALIMPLEMENTATION EXSDecimalException : public Sysutils::Exception { typedef Sysutils::Exception inherited; public: #pragma option push -w-inl /* Exception.Create */ inline __fastcall EXSDecimalException(const AnsiString Msg) : Sysutils::Exception(Msg) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateFmt */ inline __fastcall EXSDecimalException(const AnsiString Msg, const System::TVarRec * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateRes */ inline __fastcall EXSDecimalException(int Ident)/* overload */ : Sysutils::Exception(Ident) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateResFmt */ inline __fastcall EXSDecimalException(int Ident, const System::TVarRec * Args, const int Args_Size)/* overload */ : Sysutils::Exception(Ident, Args, Args_Size) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateHelp */ inline __fastcall EXSDecimalException(const AnsiString Msg, int AHelpContext) : Sysutils::Exception(Msg, AHelpContext) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateFmtHelp */ inline __fastcall EXSDecimalException(const AnsiString Msg, const System::TVarRec * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateResHelp */ inline __fastcall EXSDecimalException(int Ident, int AHelpContext)/* overload */ : Sysutils::Exception(Ident, AHelpContext) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateResFmtHelp */ inline __fastcall EXSDecimalException(System::PResStringRec ResStringRec, const System::TVarRec * Args, const int Args_Size, int AHelpContext)/* overload */ : Sysutils::Exception(ResStringRec, Args, Args_Size, AHelpContext) { } #pragma option pop public: #pragma option push -w-inl /* TObject.Destroy */ inline __fastcall virtual ~EXSDecimalException(void) { } #pragma option pop }; class DELPHICLASS EXSHexBinaryException; class PASCALIMPLEMENTATION EXSHexBinaryException : public Sysutils::Exception { typedef Sysutils::Exception inherited; public: #pragma option push -w-inl /* Exception.Create */ inline __fastcall EXSHexBinaryException(const AnsiString Msg) : Sysutils::Exception(Msg) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateFmt */ inline __fastcall EXSHexBinaryException(const AnsiString Msg, const System::TVarRec * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateRes */ inline __fastcall EXSHexBinaryException(int Ident)/* overload */ : Sysutils::Exception(Ident) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateResFmt */ inline __fastcall EXSHexBinaryException(int Ident, const System::TVarRec * Args, const int Args_Size)/* overload */ : Sysutils::Exception(Ident, Args, Args_Size) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateHelp */ inline __fastcall EXSHexBinaryException(const AnsiString Msg, int AHelpContext) : Sysutils::Exception(Msg, AHelpContext) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateFmtHelp */ inline __fastcall EXSHexBinaryException(const AnsiString Msg, const System::TVarRec * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateResHelp */ inline __fastcall EXSHexBinaryException(int Ident, int AHelpContext)/* overload */ : Sysutils::Exception(Ident, AHelpContext) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateResFmtHelp */ inline __fastcall EXSHexBinaryException(System::PResStringRec ResStringRec, const System::TVarRec * Args, const int Args_Size, int AHelpContext)/* overload */ : Sysutils::Exception(ResStringRec, Args, Args_Size, AHelpContext) { } #pragma option pop public: #pragma option push -w-inl /* TObject.Destroy */ inline __fastcall virtual ~EXSHexBinaryException(void) { } #pragma option pop }; class DELPHICLASS TXSHexBinary; class PASCALIMPLEMENTATION TXSHexBinary : public Invokeregistry::TRemotableXS { typedef Invokeregistry::TRemotableXS inherited; private: AnsiString FHexBinaryString; void __fastcall SetAsByteArray(TByteDynArray Value); TByteDynArray __fastcall GetAsByteArray(); public: virtual void __fastcall XSToNative(WideString Value); virtual WideString __fastcall NativeToXS(); __property AnsiString HexBinaryString = {read=FHexBinaryString, write=FHexBinaryString}; __property TByteDynArray AsByteArray = {read=GetAsByteArray, write=SetAsByteArray}; public: #pragma option push -w-inl /* TRemotable.Create */ inline __fastcall virtual TXSHexBinary(void) : Invokeregistry::TRemotableXS() { } #pragma option pop #pragma option push -w-inl /* TRemotable.Destroy */ inline __fastcall virtual ~TXSHexBinary(void) { } #pragma option pop }; class DELPHICLASS TXSDecimal; class PASCALIMPLEMENTATION TXSDecimal : public Invokeregistry::TRemotableXS { typedef Invokeregistry::TRemotableXS inherited; private: AnsiString FDecimalString; Fmtbcd::TBcd __fastcall GetAsBcd(); void __fastcall SetAsBcd(const Fmtbcd::TBcd &Value); public: virtual void __fastcall XSToNative(WideString Value); virtual WideString __fastcall NativeToXS(); __property AnsiString DecimalString = {read=FDecimalString, write=FDecimalString}; __property Fmtbcd::TBcd AsBcd = {read=GetAsBcd, write=SetAsBcd}; public: #pragma option push -w-inl /* TRemotable.Create */ inline __fastcall virtual TXSDecimal(void) : Invokeregistry::TRemotableXS() { } #pragma option pop #pragma option push -w-inl /* TRemotable.Destroy */ inline __fastcall virtual ~TXSDecimal(void) { } #pragma option pop }; class DELPHICLASS TXSString; class PASCALIMPLEMENTATION TXSString : public Invokeregistry::TRemotableXS { typedef Invokeregistry::TRemotableXS inherited; private: WideString FString; public: virtual void __fastcall XSToNative(WideString Value); virtual WideString __fastcall NativeToXS(); public: #pragma option push -w-inl /* TRemotable.Create */ inline __fastcall virtual TXSString(void) : Invokeregistry::TRemotableXS() { } #pragma option pop #pragma option push -w-inl /* TRemotable.Destroy */ inline __fastcall virtual ~TXSString(void) { } #pragma option pop }; typedef TXSDateTime TXSTimeInstant; ; //-- var, const, procedure --------------------------------------------------- static const char SHexMarker = '\x24'; static const char SoapTimePrefix = '\x54'; static const char XMLDateSeparator = '\x2d'; static const char XMLHourOffsetMinusMarker = '\x2d'; static const char XMLHourOffsetPlusMarker = '\x2b'; static const char XMLTimeSeparator = '\x3a'; static const Shortint XMLMonthPos = 0x6; static const Shortint XMLDayPos = 0x9; static const Shortint XMLYearPos = 0x1; static const Shortint XMLMilSecPos = 0xa; static const Shortint XMLDefaultYearDigits = 0x4; static const char XMLDurationStart = '\x50'; static const char XMLDurationYear = '\x59'; static const char XMLDurationMonth = '\x4d'; static const char XMLDurationDay = '\x44'; static const char XMLDurationHour = '\x48'; static const char XMLDurationMinute = '\x4d'; static const char XMLDurationSecond = '\x53'; #define SNAN "NAN" extern PACKAGE char SSciNotationMarker; extern PACKAGE char SDecimal; extern PACKAGE char SNegative; extern PACKAGE char SPlus; extern PACKAGE TXSDateTime* __fastcall DateTimeToXSDateTime(System::TDateTime Value, bool CalcLocalBias = false); } /* namespace Xsbuiltins */ using namespace Xsbuiltins; #pragma option pop // -w- #pragma option pop // -Vx #pragma delphiheader end. //-- end unit ---------------------------------------------------------------- #endif // XSBuiltIns
[ "bitscode@7bd08ab0-fa70-11de-930f-d36749347e7b" ]
[ [ [ 1, 459 ] ] ]
e2ca4c14b8051036a26e5c2f90c6e0620a76d0d5
41371839eaa16ada179d580f7b2c1878600b718e
/UVa/Volume IV/00437.cpp
dfd09204cfd790a259df4d0c8a2f28e1b76fe989
[]
no_license
marinvhs/SMAS
5481aecaaea859d123077417c9ee9f90e36cc721
2241dc612a653a885cf9c1565d3ca2010a6201b0
refs/heads/master
2021-01-22T16:31:03.431389
2009-10-01T02:33:01
2009-10-01T02:33:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,242
cpp
///////////////////////////////// // 00437 - The Tower of Babylon ///////////////////////////////// #include<cstdio> #include<cstring> #include<algorithm> typedef unsigned int UI; struct block{ UI x,y,h; block() {} block(UI a, UI b, UI c): x(a),y(b),h(c) {} }bks[90]; UI cnum, d[3], h[90], maxh, test; unsigned char p[90],bnum, i, j, last; bool comp(block a, block b){ return(a.x < b.x && a.y < b.y); } bool ord(block a, block b){ return(a.x < b.x); } void show(block a){ printf("%u %u %u\n",a.x,a.y,a.h); } int main(void){ while(scanf("%u",&bnum) && bnum){ cnum++; memset(h,0,sizeof(h)); for(last = i = 0; i < bnum; i++){ scanf("%u %u %u",&d[0],&d[1],&d[2]); std::sort(d,d+3); bks[last++] = block(d[0],d[1],d[2]); if(d[2] != d[1]) bks[last++] = block(d[0],d[2],d[1]); if(d[0] != d[1]) bks[last++] = block(d[1],d[2],d[0]); } std::sort(bks,bks+last,ord); //for(i = 0; i < last; i++) show(bks[i]); for(i = 0; i < last; i++){ maxh = 0; for(j = 0; j < i; j++) if(comp(bks[j],bks[i]) && h[j] > maxh) maxh = h[j]+h[i]; h[i] = maxh+bks[i].h; } for(maxh = i = 0; i < last; i++) if(h[i] > maxh) maxh = h[i]; printf("Case %u: maximum height = %u\n",cnum,maxh); } return 0; }
[ [ [ 1, 51 ] ] ]
4ed3bc73e43dd559b0a7c79acc1795652010c899
21fe9ddd8ba3a3798246be0f01a56a10e07acb2e
/v8/src/debug-agent.h
2466db2e7edc883c617bad3e0c45b4a482103fbf
[ "bzip2-1.0.6", "BSD-3-Clause" ]
permissive
yong/xruby2
5e2ed23574b8f9f790b7df2ab347acca4f651373
ecc8fa062c30cb54ef41d2ccdbe46c6d5ffaa844
refs/heads/master
2021-01-20T11:26:04.196967
2011-12-02T17:40:48
2011-12-02T17:40:48
2,893,039
0
0
null
null
null
null
UTF-8
C++
false
false
4,924
h
// Copyright 2006-2008 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef V8_DEBUG_AGENT_H_ #define V8_DEBUG_AGENT_H_ #ifdef ENABLE_DEBUGGER_SUPPORT #include "../include/v8-debug.h" #include "platform.h" namespace v8 { namespace internal { // Forward decelrations. class DebuggerAgentSession; // Debugger agent which starts a socket listener on the debugger port and // handles connection from a remote debugger. class DebuggerAgent: public Thread { public: DebuggerAgent(const char* name, int port) : Thread(name), isolate_(Isolate::Current()), name_(StrDup(name)), port_(port), server_(OS::CreateSocket()), terminate_(false), session_access_(OS::CreateMutex()), session_(NULL), terminate_now_(OS::CreateSemaphore(0)), listening_(OS::CreateSemaphore(0)) { ASSERT(isolate_->debugger_agent_instance() == NULL); isolate_->set_debugger_agent_instance(this); } ~DebuggerAgent() { isolate_->set_debugger_agent_instance(NULL); delete server_; } void Shutdown(); void WaitUntilListening(); Isolate* isolate() { return isolate_; } private: void Run(); void CreateSession(Socket* socket); void DebuggerMessage(const v8::Debug::Message& message); void CloseSession(); void OnSessionClosed(DebuggerAgentSession* session); Isolate* isolate_; SmartArrayPointer<const char> name_; // Name of the embedding application. int port_; // Port to use for the agent. Socket* server_; // Server socket for listen/accept. bool terminate_; // Termination flag. Mutex* session_access_; // Mutex guarging access to session_. DebuggerAgentSession* session_; // Current active session if any. Semaphore* terminate_now_; // Semaphore to signal termination. Semaphore* listening_; friend class DebuggerAgentSession; friend void DebuggerAgentMessageHandler(const v8::Debug::Message& message); DISALLOW_COPY_AND_ASSIGN(DebuggerAgent); }; // Debugger agent session. The session receives requests from the remote // debugger and sends debugger events/responses to the remote debugger. class DebuggerAgentSession: public Thread { public: DebuggerAgentSession(DebuggerAgent* agent, Socket* client) : Thread("v8:DbgAgntSessn"), agent_(agent), client_(client) {} void DebuggerMessage(Vector<uint16_t> message); void Shutdown(); private: void Run(); void DebuggerMessage(Vector<char> message); DebuggerAgent* agent_; Socket* client_; DISALLOW_COPY_AND_ASSIGN(DebuggerAgentSession); }; // Utility methods factored out to be used by the D8 shell as well. class DebuggerAgentUtil { public: static const char* const kContentLength; static const int kContentLengthSize; static SmartArrayPointer<char> ReceiveMessage(const Socket* conn); static bool SendConnectMessage(const Socket* conn, const char* embedding_host); static bool SendMessage(const Socket* conn, const Vector<uint16_t> message); static bool SendMessage(const Socket* conn, const v8::Handle<v8::String> message); static int ReceiveAll(const Socket* conn, char* data, int len); }; } } // namespace v8::internal #endif // ENABLE_DEBUGGER_SUPPORT #endif // V8_DEBUG_AGENT_H_
[ [ [ 1, 133 ] ] ]
7aecd08de0d18119cadb2fd6eaab1895b6f35edf
1db5ea1580dfa95512b8bfa211c63bafd3928ec5
/EnemyUnitData.h
3cd9b322fa12ca906837b99dd6101dc5d091bf2b
[]
no_license
armontoubman/scbatbot
3b9dd4532fbb78406b41dd0d8f08926bd710ad7b
bee2b0bf0281b8c2bd6edc4c10a597041ea4be9b
refs/heads/master
2023-04-18T12:08:13.655631
2010-09-17T23:03:26
2010-09-17T23:03:26
361,411,133
0
0
null
null
null
null
UTF-8
C++
false
false
268
h
#pragma once #include <BWAPI.h> class EnemyUnitData { public: EnemyUnitData(); void update(BWAPI::Unit* u); BWAPI::Unit* unit; BWAPI::UnitType unitType; int hitPoints; BWAPI::Position position; BWAPI::Position lastKnownPosition; int lastSeen; };
[ "armontoubman@a850bb65-3c1a-43af-a1ba-18f3eb5da290" ]
[ [ [ 1, 15 ] ] ]
95837b5c05879e5559f464d2ec831e2731b8bba5
9cb4de290d4dbb5fd5298043a9a8f1cf08615687
/ntg_gtest_utils.h
41234b91eb7540055f0b415bbceed7ddf5776f66
[]
no_license
rsofaer/no_tipping
0f9ee69fd5640fe8ed92d4ed31ce4b351db36f40
06dbce5a9eda3a14cbd3befc21e0764d50a26c16
refs/heads/master
2020-11-26T14:05:03.405033
2011-11-27T20:10:34
2011-11-27T20:10:34
2,487,036
1
0
null
null
null
null
UTF-8
C++
false
false
1,864
h
#ifndef _NO_TIPPING_GAME_NTG_GTEST_UTILS_H_ #define _NO_TIPPING_GAME_NTG_GTEST_UTILS_H_ #include "ntg.h" #include <vector> #include <algorithm> template <int Length> struct RandomPlayOrderGenerator { RandomPlayOrderGenerator() : seq(Length) { for (int i = 0; i < static_cast<int>(seq.size()); ++i) { seq[i] = i; } } std::vector<int> operator()() const { std::random_shuffle(seq.begin(), seq.end()); return seq; } mutable std::vector<int> seq; }; bool PlayerEmptyHand(const hps::Player& player) { if (player.remain > 0) { return false; } for (int handIdx = 0; handIdx < hps::Player::NumWeights; ++handIdx) { if (hps::Player::Played != player.hand[handIdx]) { return false; } } return true; } void RandomRemovingPhase(hps::State* state) { using namespace hps; Board& board = state->board; InitState(state); // Fill with weights. { assert(Board::Positions >= (2 * Player::NumWeights)); Weight* boardVal = board.begin(); for (int wIdx = 0; wIdx < Player::NumWeights; ++wIdx) { { Player* player = &state->red; Weight* w = player->hand + wIdx; while (Board::Empty != *boardVal) { ++boardVal; } *boardVal++ = *w; *w = Player::Played; --player->remain; } { Player* player = &state->blue; Weight* w = player->hand + wIdx; while (Board::Empty != *boardVal) { ++boardVal; } *boardVal++ = *w; *w = Player::Played; --player->remain; } } } // Find stable ordering. do { std::random_shuffle(board.begin(), board.end()); } while (Tipped(board)); // Switch phase. state->phase = State::Phase_Removing; } #endif //_NO_TIPPING_GAME_NTG_GTEST_UTILS_H_
[ [ [ 1, 80 ] ] ]
ef0845162d0fddd1b09b556bf74654713968135a
94c1c7459eb5b2826e81ad2750019939f334afc8
/source/CTaiScreen.h
3c9d1e8f7226af7a90e97d01b26d7e1c7dfa5807
[]
no_license
wgwang/yinhustock
1c57275b4bca093e344a430eeef59386e7439d15
382ed2c324a0a657ddef269ebfcd84634bd03c3a
refs/heads/master
2021-01-15T17:07:15.833611
2010-11-27T07:06:40
2010-11-27T07:06:40
37,531,026
1
3
null
null
null
null
UTF-8
C++
false
false
2,682
h
#if !defined(AFX_TJXGNEW_H__937DFD01_1696_11D4_941E_0080C8E20736__INCLUDED_) #define AFX_TJXGNEW_H__937DFD01_1696_11D4_941E_0080C8E20736__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // CTaiScreen.h : header file #include "CTaiScreenParent.h" class CTaiScreen : public CTaiScreenParent { public: bool m_bExecuteCalc; void AddCComboBoxString(CComboBox& comboBox,bool bInserFirst= false); void RefreshJishuTreeCtrl(); void ShowSetCompute(bool bShow = false); CTaiScreen(CWnd* pParent = NULL); CArray<BOOL,BOOL> m_stockrange; protected: bool m_bShowSetCompute; SymbolKindArr m_choose_result_save; protected: int FindStr(SymbolKindArr* array,SymbolKind& str); // Dialog Data //{{AFX_DATA(CTaiScreen) enum { IDD = IDD_SHOWTJXG }; CButtonST m_button1; CButtonST m_close1; CDateTimeCtrl m_comTmBegin; CProgressCtrl m_progress; CButtonST m_buttonExpl; CDateTimeCtrl m_conTmEnd; CListBox m_aggregation_list; CComboBox m_save_list; CListCtrl m_liststockrange; int m_choosed_number; int m_selected_number; int m_stock_number; int m_aggregation2; int m_operator; int m_aggregation1; int m_aggregation3; CTime m_tmEnd; int m_nKindScreen; CButtonST m_btExec; CButtonST m_btAddS; CButtonST m_btDeleteS; CTime m_tmBegin; //}}AFX_DATA //{{AFX_VIRTUAL(CTaiScreen) public: virtual BOOL PreTranslateMessage(MSG* pMsg); protected: virtual void DoDataExchange(CDataExchange* pDX); virtual void PostNcDestroy(); //}}AFX_VIRTUAL protected: void NotifySubclass(); //{{AFX_MSG(CTaiScreen) virtual BOOL OnInitDialog(); afx_msg void OnClickStockList(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnChoosestock(); virtual void OnCancel(); afx_msg void OnEqual(); afx_msg void OnToGrid(); afx_msg void OnButton2(); afx_msg void OnButton1(); afx_msg void OnRadio1(); afx_msg void OnRadioHistory(); afx_msg void OnDeleteStocks2(); afx_msg void OnAddStocksParent(); afx_msg void OnButtonSaveResult(); afx_msg void OnKeydownStockList(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnClose(); afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); afx_msg void OnClose1(); //}}AFX_MSG DECLARE_MESSAGE_MAP() private: bool CalcEach(IndexDataInfo& index_save2,CString StockId,int stkKind, int nCount, Kline *pKline,CTime& tmB,CTime& tmE, CBuySellList *pList); void EnableControl(bool bEnable = true); }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_TJXGNEW_H__937DFD01_1696_11D4_941E_0080C8E20736__INCLUDED_)
[ [ [ 1, 95 ] ] ]
cb334874f0497b69b0b2c4eead810269f7d4bcd7
5e6ff9e6e8427078135a7b4d3b194bcbf631e9cd
/EngineSource/dpslim/dpslim/Database/Source/MSDatabase.cpp
7ab6e3f0ef8ad5824e2edc262ef4092595cd9c84
[]
no_license
karakots/dpresurrection
1a6f3fca00edd24455f1c8ae50764142bb4106e7
46725077006571cec1511f31d314ccd7f5a5eeef
refs/heads/master
2016-09-05T09:26:26.091623
2010-02-01T11:24:41
2010-02-01T11:24:41
32,189,181
0
0
null
null
null
null
UTF-8
C++
false
false
26,398
cpp
// MSDatabase.cpp // // Database accessing routines using MFC classes for ODBC // // Copyright 2003 by DecisionPower // // author: Vicki de Mey // creation data: 9/18/2003 // // #ifndef __MSDATABASE__ #include "MSDatabase.h" #endif #define MAXORDERROWS 35 #define MAXDETAILROWS 25 #include "DBParameter.h" #include "DBProductTree.h" #include "DBScenario.h" #include "Math.h" #include <fstream> static int allID = -1; static int UndefID = -1; // using namespace MrktSimDb; // --------------------------------------------------------------------------- // constructor // --------------------------------------------------------------------------- MSDatabase::MSDatabase() { m_ModelInfo = NULL; m_Channel = NULL; m_ConsumerPrefs = NULL; m_DistDisplay = NULL; m_InitalConds = NULL; m_MassMedia = NULL; m_MarketUtility = NULL; m_ProdAttr = NULL; m_ProdAttrVal = NULL; m_ProdChan = NULL; m_Product = NULL; m_SegChan = NULL; m_Segment = NULL; m_ProductEvent = NULL; m_TaskEvent = NULL; m_Task = NULL; m_TaskProd = NULL; m_TaskRates = NULL; m_ProdMatrix = NULL; m_ProductTree = NULL; // VdM 10/25/04 m_OptimizationParams = NULL; m_OptimizationPlan = NULL; // VdM 11/3/04 m_OptimizationOutputSummary = NULL; // VdM 12/6/04 theOutputResults = NULL; // SSN 1/11/05 m_SimQueue = NULL; // SSN 4/15/05 m_Simulation = NULL; // SSN 4/26/2005 m_SocNetwork = NULL; m_NetworkParams = NULL; // SSN 7/4/2005 m_SimLog = NULL; // SSN 1/5/2007 m_product_size = NULL; comma = ","; slash = "/"; iResultsTableName.clear(); iOptResultsTableName.clear(); iConnectString = "Not connected"; // default value iModelID = UndefID; iRunID = UndefID; iScenarioID = -1; iStartTime = GetTickCount(); warningsLogged = false; dayLastWrite = 0; } int MSDatabase::Open(const char* fname, int run_id) { const int error = -1; const int configOK = 1; // Database* db = new Database(); int rtn = 0; // get connection info from the file dbconnct in the folder where the .EXE is found //LPCTSTR lpszConnectString; string writeTable; char connect[1024]; fstream in_file; fstream out_file; int err = 0; string dialogString; //string::CopyFromCString(appPath, &connectFileWithPath); //string::CopyFromCString("\\dbconnect", &connectFile); //string::StrCat(&connectFileWithPath, &connectFile, FALSE); int createFile = false; in_file.open(fname, fstream::in); if (in_file.is_open()) { in_file.getline(connect, 1024); in_file.close(); } else { // use dialog to establish connection strcpy(connect, ""); createFile = true; } // results table names iResultsTableName = "results_std"; iOptResultsTableName = "optimization_results_std"; // parse connect string iConnectString = connect; // connect with string try { //rtn = iTheCurrentDB.Open( _T( "Test" ), FALSE, FALSE, _T( "ODBC;UID=Vicki" ), FALSE); // CDatabase::useCursorLib so we can do snapshots of the DB //iTheCurrentDB.OpenEx( _T( "DSN=Test;UID=Vicki;Trusted_Connection=yes" ), FALSE); // CDatabase::useCursorLib); //rtn = iTheCurrentDB.OpenEx( _T( "DSN=Test;UID=Vicki" ), CDatabase::useCursorLib); //rtn = iTheCurrentDB.OpenEx( _T( "DSN=Test;UID=Vicki" ), FALSE); //rtn = iTheCurrentDB.OpenEx(connect, FALSE); //rtn = iTheCurrentDB.OpenEx(connect); rtn = iTheCurrentDB.OpenEx(CString(connect), CDatabase::useCursorLib); int length = iTheCurrentDB.GetConnect().GetLength(); iTheCurrentDB.SetQueryTimeout(0); if (!rtn || !iTheCurrentDB.IsOpen()) { return error; } if(createFile) { out_file.open(fname, fstream::out); if (out_file.is_open()) { // remove the first 5 characters from string // connection string for the database includes a ODBC; at the front that // is not understood by OpenEx. odd but true CString connection_string = iTheCurrentDB.GetConnect().Right(length - 5); const char* out_string = connection_string.GetString(); out_file << out_string << endl; out_file.close(); } } rtn = writeDataDB.OpenEx(iTheCurrentDB.GetConnect().Right(length - 5), CDatabase::useCursorLib); if (!rtn || !writeDataDB.IsOpen()) { return error; } } catch (CException* e) { e->Delete(); return error; } int b = iTheCurrentDB.CanUpdate(); if(run_id == -2) { return configOK; } if (SelectModel(run_id)) { iTheCurrentDB.BeginTrans(); ApplyParameters(); PreloadAllRecordsets(); RestoreValues(); iTheCurrentDB.CommitTrans(); } else { return error; } InitOutput(); // ok return 0; } // --------------------------------------------------------------------------- // destructor // --------------------------------------------------------------------------- MSDatabase::~MSDatabase() { if (m_ModelInfo != NULL) { m_ModelInfo->Close(); delete m_ModelInfo; } if (m_SimQueue != NULL) { m_SimQueue->Close(); delete m_SimQueue; } if (m_Simulation != NULL) { m_Simulation->Close(); delete m_Simulation; } // VdM 12/6/04 if (theOutputResults != NULL) delete theOutputResults; if (m_SimLog != NULL) { m_SimLog->Close(); delete m_SimLog; } FreeAllRecordsets(); if (iTheCurrentDB.IsOpen()) iTheCurrentDB.Close(); } void MSDatabase::FreeAllRecordsets() { if (m_Channel != NULL) { m_Channel->Close(); delete m_Channel; m_Channel = 0; } if (m_ConsumerPrefs != NULL) { m_ConsumerPrefs->Close(); delete m_ConsumerPrefs; m_ConsumerPrefs = 0; } if (m_DistDisplay != NULL) { m_DistDisplay->Close(); delete m_DistDisplay; m_DistDisplay = 0; } if (m_InitalConds != NULL) { m_InitalConds->Close(); delete m_InitalConds; m_InitalConds = 0; } if (m_MassMedia != NULL) { m_MassMedia->Close(); delete m_MassMedia; m_MassMedia = 0; } if (m_MarketUtility != NULL) { m_MarketUtility->Close(); delete m_MarketUtility; m_MarketUtility = 0; } if (m_ProdAttr != NULL) { m_ProdAttr->Close(); delete m_ProdAttr; m_ProdAttr = 0; } if (m_ProdAttrVal != NULL) { m_ProdAttrVal->Close(); delete m_ProdAttrVal; m_ProdAttrVal = 0; } if (m_ProdChan != NULL) { m_ProdChan->Close(); delete m_ProdChan; m_ProdChan = 0; } if (m_Product != NULL) { m_Product->Close(); delete m_Product; m_Product = 0; } if (m_SegChan != NULL) { m_SegChan->Close(); delete m_SegChan; m_SegChan = 0; } if (m_Segment != NULL) { m_Segment->Close(); delete m_Segment; m_Segment = 0; } if (m_ProductEvent != NULL) { m_ProductEvent->Close(); delete m_ProductEvent; m_ProductEvent = 0; } if (m_TaskEvent != NULL) { m_TaskEvent->Close(); delete m_TaskEvent; m_TaskEvent = 0; } if (m_Task != NULL) { m_Task->Close(); delete m_Task; m_Task = 0; } if (m_TaskProd != NULL) { m_TaskProd->Close(); delete m_TaskProd; m_TaskProd = 0; } if (m_TaskRates != NULL) { m_TaskRates->Close(); delete m_TaskRates; m_TaskRates = 0; } if (m_ProdMatrix != NULL) { m_ProdMatrix->Close(); delete m_ProdMatrix; m_ProdMatrix = 0; } if (m_ProductTree != NULL) { m_ProductTree->Close(); delete m_ProductTree; m_ProductTree = 0; } // VdM 10/25/04 if (m_OptimizationParams != NULL) { m_OptimizationParams->Close(); delete m_OptimizationParams; m_OptimizationParams = 0; } if (m_OptimizationPlan != NULL) { m_OptimizationPlan->Close(); delete m_OptimizationPlan; m_OptimizationPlan = 0; } // VdM 11/3/04 if (m_OptimizationOutputSummary != NULL) { m_OptimizationOutputSummary->Close(); delete m_OptimizationOutputSummary; m_OptimizationOutputSummary = 0; } // SSN 4/26/2005 if (m_SocNetwork != NULL) { m_SocNetwork->Close(); delete m_SocNetwork; m_SocNetwork = 0; } // SSN 4/26/2005 if (m_NetworkParams != NULL) { m_NetworkParams->Close(); delete m_NetworkParams; m_NetworkParams = 0; } // SSN 1/5/2007 if (m_product_size != NULL) { m_product_size->Close(); delete m_product_size; m_product_size = 0; } } int MSDatabase::SelectModel(int run_id) { int simulationID = UndefID; int scenarioID = UndefID; // reset the SimQueue and ModelInfo Object if (m_SimQueue != 0) { m_SimQueue->Close(); delete m_SimQueue; m_SimQueue = 0; } if (m_ModelInfo != 0) { m_ModelInfo->Close(); delete m_ModelInfo; m_ModelInfo = 0; } sprintf(&(ModelRecordset::ModelQuery[0]), " "); sprintf(&(ModelRecordset::MarketPlanQuery[0]), " "); sprintf(&(SimQueueRecordset::RunQuery[0]), " "); m_SimQueue = new SimQueueRecordset(&iTheCurrentDB); m_SimQueue->Open(); // there are no models in database if ( m_SimQueue->IsEOF()) { m_SimQueue->Close(); return false; } // check if current model is valid /*if (iModelID != UndefID ) { m_SimQueue->SetAbsolutePosition(1); while (!m_SimQueue->IsEOF()) { // check if iModelID is a valid model if( m_SimQueue->m_ModelID == iModelID) break; m_SimQueue->MoveNext(); } // could not find run if (m_SimQueue->IsEOF()) { iModelID = UndefID; iRunID = UndefID; } else { // make sure we are looking at the correct run iRunID = m_SimQueue->m_RunID; } } else {*/ // looking for first pending model on simulation queue // order is determined by num in queue iRunID = UndefID; if(run_id >= 0) { m_SimQueue->SetAbsolutePosition(1); while (!m_SimQueue->IsEOF()) { if( m_SimQueue->m_Status == 0 && m_SimQueue->m_RunID == run_id) { iModelID = m_SimQueue->m_ModelID; iRunID = m_SimQueue->m_RunID; simulationID = m_SimQueue->m_SimulationID; } m_SimQueue->MoveNext(); } } if(iRunID == UndefID) { int num = -1; m_SimQueue->SetAbsolutePosition(1); while (!m_SimQueue->IsEOF()) { if( m_SimQueue->m_Status == 0) { if(num == -1 || m_SimQueue->m_Num < num) { iModelID = m_SimQueue->m_ModelID; iRunID = m_SimQueue->m_RunID; simulationID = m_SimQueue->m_SimulationID; num = m_SimQueue->m_Num; } } m_SimQueue->MoveNext(); } } //} // could not find model if (iModelID == UndefID) return false; // reset sim queue to this run m_SimQueue->Close(); delete m_SimQueue; // construct query string to be used for selects sprintf(&(ModelRecordset::ModelQuery[0]), " WHERE model_id = %d ", iModelID); sprintf(&(SimQueueRecordset::RunQuery[0]), " WHERE run_id = %d ", iRunID); sprintf(&(SimulationRecordset::SimulationQuery[0]), " WHERE id = %d ", simulationID); ParameterRecordset::SetScenario(simulationID); // try it out m_SimQueue = new SimQueueRecordset(&iTheCurrentDB); m_SimQueue->Open(); // this is a bug ASSERT(!m_SimQueue->IsEOF()); // read in model info m_ModelInfo = new ModelRecordset(&iTheCurrentDB); m_ModelInfo->Open(); if (m_ModelInfo->IsEOF()) return false; m_ModelInfo->MoveFirst(); // get scenario information m_Simulation = new SimulationRecordset(&iTheCurrentDB); m_Simulation->Open(); // something amiss with scenario? // we can still run the sim but... if ( m_Simulation->IsEOF()) { SimLogRecordset* log = NewLogEntry(); log->message = "Error opening simulation"; log->Update(); m_Simulation->Close(); m_Simulation = 0; } else { // change start and end date of Model m_Simulation->MoveFirst(); // this is a test // always start mode at start // m_ModelInfo->start_date = m_Scenario->start_date; m_ModelInfo->end_date = m_Simulation->end_date; m_ModelInfo->access_time = m_Simulation->access_time; scenarioID = m_Simulation->scenario_id; sprintf(&(ScenarioRecordset::ScenarioQuery[0]), " WHERE scenario_id = %d ", scenarioID); sprintf(&(ModelRecordset::MarketPlanQuery[0]), " WHERE market_plan.model_id = %d AND market_plan_id = id AND id IN (SELECT child_id FROM market_plan_tree WHERE parent_id IN (SELECT market_plan_id FROM scenario_market_plan WHERE scenario_id = %d)) ORDER BY record_id", iModelID, scenarioID); sprintf(&(ModelRecordset::ExtFactQuery[0]), " WHERE market_plan.model_id = %d AND market_plan_id = id AND id IN (SELECT market_plan_id from scenario_market_plan where scenario_id = %d)", iModelID, scenarioID); int file_valid = m_ModelInfo->checkpoint_valid; //TBD check to make sure file exists int time_valid = (m_Simulation->start_date >= m_ModelInfo->checkpoint_date); if(fabs(m_Simulation->scale_factor - m_ModelInfo->checkpoint_scale_factor) < 0.005) { m_ModelInfo->scale_factor = m_ModelInfo->checkpoint_scale_factor; } else { m_ModelInfo->scale_factor = m_Simulation->scale_factor; file_valid = false; } if(file_valid && time_valid) { m_ModelInfo->using_checkpoint = true; m_ModelInfo->start_date = m_ModelInfo->checkpoint_date; CString checkPointDate = m_ModelInfo->checkpoint_date.Format("'%m/%d/%Y'"); // only load data significant to checkpoint sprintf(&(ScenarioRecordset::ScenarioQuery[0]), " WHERE end_date >= %s AND scenario_id = %d ", checkPointDate, scenarioID); sprintf(&(ModelRecordset::MarketPlanQuery[0]), " WHERE market_utility.end_date >= %s AND market_plan.model_id = %d AND market_plan_id = id AND id IN (SELECT child_id FROM market_plan_tree WHERE parent_id IN (SELECT market_plan_id FROM scenario_market_plan WHERE scenario_id = %d)) ORDER BY record_id", checkPointDate, iModelID, scenarioID); sprintf(&(ModelRecordset::ExtFactQuery[0]), " WHERE product_event.end_date >= %s AND market_plan.model_id = %d AND market_plan_id = id AND id IN (SELECT market_plan_id from scenario_market_plan where scenario_id = %d)", checkPointDate, iModelID, scenarioID); } if(m_Simulation->type == 150) { m_ModelInfo->writing_checkpoint = true; } if(m_Simulation->reset_panel_state) { CTime modelStartDate = CTime(m_ModelInfo->start_date.GetYear(),m_ModelInfo->start_date.GetMonth(), m_ModelInfo->start_date.GetDay(),0,0,0,0); CTime simStartDate = CTime(m_Simulation->start_date.GetYear(),m_Simulation->start_date.GetMonth(), m_Simulation->start_date.GetDay(),0,0,0,0); CTimeSpan diffStart = simStartDate - modelStartDate; m_ModelInfo->reset_panel_data_day = (int)diffStart.GetDays(); } else { m_ModelInfo->reset_panel_data_day = -1; } } SimStatus("Connected to Database"); return true; } // return the sim seed from the sim queue short MSDatabase::SimSeed() { return m_SimQueue->seed; } void MSDatabase::SimStatus(const string message) { if (m_SimQueue == 0) return; try { m_SimQueue->Edit(); } catch(CException* e) { // some problem with this record e->Delete(); return; } // this means that the simulation is now running m_SimQueue->m_Status = 1; m_SimQueue->current_status = message.c_str(); m_SimQueue->elapsed_time = GetTickCount() - iStartTime; // ------ Update - write to data source try { m_SimQueue->Update(); } catch (CException* e) { e->Delete(); return; } } void MSDatabase::SimStatus(CTime date, const string message) { if (m_SimQueue == 0) return; try { m_SimQueue->Edit(); } catch(CException* e) { // some problem with this record e->Delete(); return; } // this means that the simulation is now running m_SimQueue->m_Status = 1; m_SimQueue->current_status = message.c_str(); m_SimQueue->elapsed_time = GetTickCount() - iStartTime; m_SimQueue->current_date = date; // ------ Update - write to data source try { m_SimQueue->Update(); } catch (CException* e) { e->Delete(); return; } } SimLogRecordset* MSDatabase::NewLogEntry() { if (m_SimQueue == 0) return 0; if (m_SimLog == NULL) { if (!iTheCurrentDB.IsOpen()) return 0; m_SimLog = new SimLogRecordset(&iTheCurrentDB); if (m_SimLog->IsOpen()) m_SimLog->Requery(); else m_SimLog->Open(); } // create new log entry m_SimLog->AddNew(); m_SimLog->run_id = iRunID; warningsLogged = true; return m_SimLog; } // update database to show simulation is starting int MSDatabase::SimStart() { // FreeAllRecordsets(); // set the run time if (m_SimQueue == 0) return false; try { m_SimQueue->Edit(); } catch(CException* e) { // some problem with this record e->Delete(); return false; } // log when the sim starts m_SimQueue->run_time = CTime::GetCurrentTime(); // ------ Update - write to data source try { m_SimQueue->Update(); } catch (CException* e) { e->Delete(); return false; } SimStatus("running"); // TEST m_ModelInfo->start_date = m_Simulation->start_date; return true; } // update database to show simulation is done int MSDatabase::SimDone() { // flush the buffer theOutputResults->WriteSegData(); // write to log theOutputResults->WriteTransactionLog(m_ModelInfo->m_ModelName); if (m_SimQueue == 0) return false; try { m_SimQueue->Edit(); } catch(CException* e) { // some problem with this record e->Delete(); return false; } // this means that the simulation is now done m_SimQueue->m_Status = 2; m_SimQueue->elapsed_time = GetTickCount() - iStartTime; if (warningsLogged) m_SimQueue->current_status = _T("done (warnings logged)"); else m_SimQueue->current_status = _T("done"); // ------ Update - write to data source try { m_SimQueue->Update(); } catch (CException* e) { e->Delete(); return false; } m_SimQueue->Close(); delete m_SimQueue; m_SimQueue = 0; return true; } SegmentData* MSDatabase::NewSegData() { if (m_SimQueue == 0) return 0; SegmentData* m_SegData = theOutputResults->NewSegData(); m_SegData->m_runID = iRunID; return m_SegData; } void MSDatabase::WriteSegData() { if (m_SimQueue == 0) return; CTime currentDate = theOutputResults->CurrentDate(); // theOutputResults->WriteSegData(); // update simulation time m_SimQueue->Edit(); m_SimQueue->elapsed_time = GetTickCount() - iStartTime; m_SimQueue->current_date = currentDate; m_SimQueue->Update(); // we do want to write to the database once in awhile //CTimeSpan span = currentDate - m_ModelInfo->start_date; //int daysSinceStart = span.GetDays(); //// write out about every 6 months //if ( daysSinceStart - dayLastWrite > 180 ) //{ // dayLastWrite = daysSinceStart; //} } // SSN 1/15/2005 // for those items we are not using // we check the model info before loading in the data // no sense wasting precious time and memory void MSDatabase::PreloadAllRecordsets(void) { string dialogString; // Product if (m_Product == NULL) m_Product = new ProductRecordset(&iTheCurrentDB); if (m_Product->IsOpen()) m_Product->Requery(); else m_Product->Open(); // Channel if (m_Channel == NULL) m_Channel = new ChannelRecordset(&iTheCurrentDB); if (m_Channel->IsOpen()) m_Channel->Requery(); else m_Channel->Open(); // consumer preds if (m_ConsumerPrefs == NULL) m_ConsumerPrefs = new ConsumerPrefsRecordset(&iTheCurrentDB); if (m_ConsumerPrefs->IsOpen()) m_ConsumerPrefs->Requery(); else m_ConsumerPrefs->Open(); if (m_ModelInfo->distribution || m_ModelInfo->display) { // distribution and display if (m_DistDisplay == NULL) m_DistDisplay = new DistDisplayRecordset(&iTheCurrentDB); if (m_DistDisplay->IsOpen()) m_DistDisplay->Requery(); else m_DistDisplay->Open(); } // initial conds if (m_InitalConds == NULL) m_InitalConds = new InitialCondsRecordset(&iTheCurrentDB); if (m_InitalConds->IsOpen()) m_InitalConds->Requery(); else m_InitalConds->Open(); // mass media if (m_MassMedia == NULL) m_MassMedia = new MassMediaRecordset(&iTheCurrentDB); if (m_MassMedia->IsOpen()) m_MassMedia->Requery(); else m_MassMedia->Open(); // market utility if (m_MarketUtility == NULL) m_MarketUtility = new MarketUtilityRecordset(&iTheCurrentDB); if (m_MarketUtility->IsOpen()) m_MarketUtility->Requery(); else m_MarketUtility->Open(); // Product attr if (m_ProdAttr == NULL) m_ProdAttr = new ProdAttrRecordset(&iTheCurrentDB); if (m_ProdAttr->IsOpen()) m_ProdAttr->Requery(); else m_ProdAttr->Open(); // Product attr value if (m_ProdAttrVal == NULL) m_ProdAttrVal = new ProdAttrValRecordset(&iTheCurrentDB); if (m_ProdAttrVal->IsOpen()) m_ProdAttrVal->Requery(); else m_ProdAttrVal->Open(); // Product channel if (m_ProdChan == NULL) m_ProdChan = new ProdChanRecordset(&iTheCurrentDB); if (m_ProdChan->IsOpen()) m_ProdChan->Requery(); else m_ProdChan->Open(); // seg channel if (m_SegChan == NULL) m_SegChan = new SegChanRecordset(&iTheCurrentDB); if (m_SegChan->IsOpen()) m_SegChan->Requery(); else m_SegChan->Open(); // segment if (m_Segment == NULL) m_Segment = new SegmentRecordset(&iTheCurrentDB); if (m_Segment->IsOpen()) m_Segment->Requery(); else m_Segment->Open(); // product events if (m_ProductEvent == NULL) m_ProductEvent = new ProductEventRecordset(&iTheCurrentDB); if (m_ProductEvent->IsOpen()) m_ProductEvent->Requery(); else m_ProductEvent->Open(); // product tree if (m_ProductTree == NULL) m_ProductTree = new ProductTreeRecordset(&iTheCurrentDB); if (m_ProductTree->IsOpen()) m_ProductTree->Requery(); else m_ProductTree->Open(); // product size if (m_product_size == NULL) m_product_size = new ProductSizeRecordset(&iTheCurrentDB); if (m_product_size->IsOpen()) m_product_size->Requery(); else m_product_size->Open(); // task // need tasks even if model is not task based // TODO need to investigate task_based option // SSN 3/31/2005 // SSN 6/2/2006 // put back test - can now run without tasks if (m_ModelInfo->task_based) { // task events if (m_TaskEvent == NULL) m_TaskEvent = new TaskEventRecordset(&iTheCurrentDB); if (m_TaskEvent->IsOpen()) m_TaskEvent->Requery(); else m_TaskEvent->Open(); if (m_Task == NULL) m_Task = new TaskRecordset(&iTheCurrentDB); if (m_Task->IsOpen()) m_Task->Requery(); else m_Task->Open(); // task prod if (m_TaskProd == NULL) m_TaskProd = new TaskProdRecordset(&iTheCurrentDB); if (m_TaskProd->IsOpen()) m_TaskProd->Requery(); else m_TaskProd->Open(); // task rates if (m_TaskRates == NULL) m_TaskRates = new TaskRatesRecordset(&iTheCurrentDB); if (m_TaskRates->IsOpen()) m_TaskRates->Requery(); else m_TaskRates->Open(); } if (m_ModelInfo->product_dependency) { // product matrix if (m_ProdMatrix == NULL) m_ProdMatrix = new ProductMatrixRecordset(&iTheCurrentDB); if (m_ProdMatrix->IsOpen()) m_ProdMatrix->Requery(); else m_ProdMatrix->Open(); } if (m_ModelInfo->social_network) { // social network if (m_SocNetwork == NULL) m_SocNetwork = new SocNetworkRecordset(&iTheCurrentDB); if (m_SocNetwork->IsOpen()) m_SocNetwork->Requery(); else m_SocNetwork->Open(); // network parameters if (m_NetworkParams == NULL) m_NetworkParams = new NetworkParamsRecordset(&iTheCurrentDB); if (m_NetworkParams->IsOpen()) m_NetworkParams->Requery(); else m_NetworkParams->Open(); } } void MSDatabase::InitOutput() { if (theOutputResults == 0 ) { theOutputResults = new OutputResults(&iTheCurrentDB); } } void MSDatabase::GetProductName(int productID, string* productName) { if ( productID == allID) { productName = new string("all"); return; } else { char* temp = new char[256]; sprintf(temp, "%d", productID); productName = new string(temp); } } void MSDatabase::GetChannelName(int channelID, string* channelName) { if ( channelID == allID) { channelName = new string("all"); } else { char* temp = new char[256]; sprintf(temp, "%d", channelID); channelName = new string(temp); } } void MSDatabase::GetSegmentName(int segmentID, string* segmentName) { if ( segmentID == allID) { segmentName = new string("all"); } else { char* temp = new char[256]; sprintf(temp, "%d", segmentID); segmentName = new string(temp); } } void MSDatabase::GetProdAttrName(int prodAttrID, string* prodAttrName, double& tau) { tau = 0; if ( prodAttrID == allID) { prodAttrName = new string("all"); } else { char* temp = new char[256]; sprintf(temp, "%d", prodAttrID); prodAttrName = new string(temp); } } // apply parameters to database void MSDatabase::ApplyParameters() { ParameterRecordset parameter(&iTheCurrentDB); if(!parameter.Open()) { return; } if (!parameter.IsEOF()) { SimStatus("Updating parameter values"); parameter.MoveFirst(); while (!parameter.IsEOF()) { parameter.SetDBValues(); parameter.MoveNext(); } } parameter.Close(); } // restore database to origianl values void MSDatabase::RestoreValues() { ParameterRecordset parameter(&iTheCurrentDB); if(!parameter.Open()) { return; } if (!parameter.IsEOF()) { SimStatus("Updating parameter values"); parameter.MoveFirst(); while (!parameter.IsEOF()) { parameter.Restore(); parameter.MoveNext(); } } parameter.Close(); }
[ "Isaac.Noble@fd82578e-0ebe-11df-96d9-85c6b80b8d9c" ]
[ [ [ 1, 1279 ] ] ]
7b263293b2369997170c73b195aee6233945f040
fb16850c6d70f89751d75413b9c16a7a72821c39
/src/modules/graphics/opengl/wrap_Graphics.h
2441216807e1798d570522e88c4eb22057e3651c
[ "Zlib" ]
permissive
tst2005/love
b5e852cc538c957e773cdf14f76d71263887f066
bdec6facdf6054d24c89bea10b1f6146d89da11f
refs/heads/master
2021-01-15T12:36:17.510573
2010-05-23T22:30:38
2010-05-23T22:30:38
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,540
h
/** * Copyright (c) 2006-2010 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. **/ #ifndef LOVE_GRAPHICS_OPENGL_WRAP_GRAPHICS_H #define LOVE_GRAPHICS_OPENGL_WRAP_GRAPHICS_H // LOVE #include "wrap_Font.h" #include "wrap_Image.h" #include "wrap_Glyph.h" #include "wrap_Quad.h" #include "wrap_SpriteBatch.h" #include "wrap_ParticleSystem.h" #include "Graphics.h" namespace love { namespace graphics { namespace opengl { int w_checkMode(lua_State * L); int w_setMode(lua_State * L); int w_toggleFullscreen(lua_State * L); int w_reset(lua_State * L); int w_clear(lua_State * L); int w_present(lua_State * L); int w_setCaption(lua_State * L); int w_getCaption(lua_State * L); int w_getWidth(lua_State * L); int w_getHeight(lua_State * L); int w_isCreated(lua_State * L); int w_setScissor(lua_State * L); int w_getScissor(lua_State * L); int w_newImage(lua_State * L); int w_newGlyph(lua_State * L); int w_newQuad(lua_State * L); int w_newFrame(lua_State * L); int w_newFont1(lua_State * L); int w_newImageFont(lua_State * L); int w_newSpriteBatch(lua_State * L); int w_newParticleSystem(lua_State * L); int w_setColor(lua_State * L); int w_getColor(lua_State * L); int w_setBackgroundColor(lua_State * L); int w_getBackgroundColor(lua_State * L); int w_setFont1(lua_State * L); int w_getFont(lua_State * L); int w_setBlendMode(lua_State * L); int w_setColorMode(lua_State * L); int w_getBlendMode(lua_State * L); int w_getColorMode(lua_State * L); int w_setLineWidth(lua_State * L); int w_setLineStyle(lua_State * L); int w_setLine(lua_State * L); int w_setLineStipple(lua_State * L); int w_getLineWidth(lua_State * L); int w_getLineStyle(lua_State * L); int w_getLineStipple(lua_State * L); int w_setPointSize(lua_State * L); int w_setPointStyle(lua_State * L); int w_setPoint(lua_State * L); int w_getPointSize(lua_State * L); int w_getPointStyle(lua_State * L); int w_getMaxPointSize(lua_State * L); int w_newScreenshot(lua_State * L); int w_draw(lua_State * L); int w_drawq(lua_State * L); int w_drawTest(lua_State * L); int w_print1(lua_State * L); int w_printf1(lua_State * L); int w_point(lua_State * L); int w_line(lua_State * L); int w_triangle(lua_State * L); int w_rectangle(lua_State * L); int w_quad(lua_State * L); int w_circle(lua_State * L); int w_push(lua_State * L); int w_pop(lua_State * L); int w_rotate(lua_State * L); int w_scale(lua_State * L); int w_translate(lua_State * L); extern "C" LOVE_EXPORT int luaopen_love_graphics(lua_State * L); } // opengl } // graphics } // love #endif // LOVE_GRAPHICS_OPENGL_WRAP_GRAPHICS_H
[ "none@none" ]
[ [ [ 1, 106 ] ] ]
dc57aa7e44f55c3ab9e76fb81f21b5e2d7de9df7
38926bfe477f933a307f51376dd3c356e7893ffc
/Source/SDKs/STLPORT/stlport/stl/pointers/_deque.h
a3907f33c9d65ae8ef340d99e0fe9fee0b496d4a
[ "LicenseRef-scancode-stlport-4.5" ]
permissive
richmondx/dead6
b0e9dd94a0ebb297c0c6e9c4f24c6482ef4d5161
955f76f35d94ed5f991871407f3d3ad83f06a530
refs/heads/master
2021-12-05T14:32:01.782047
2008-01-01T13:13:39
2008-01-01T13:13:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
19,113
h
/* * * Copyright (c) 2004 * Francois Dumont * * 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. * */ /* NOTE: This is an internal header file, included by other STL headers. * You should not attempt to use it directly. */ #ifndef _STLP_SPECIALIZED_DEQUE_H #define _STLP_SPECIALIZED_DEQUE_H #ifndef _STLP_VOID_PTR_TRAITS_H # include <stl/pointers/_void_ptr_traits.h> #endif /* * The general deque class */ template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) > class deque { typedef _Deque_impl<_Tp, _Alloc> _Base; typedef deque<_Tp, _Alloc> _Self; public: _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) __IMPORT_WITH_REVERSE_ITERATORS(_Base) typedef typename _Base::_Iterator_category _Iterator_category; allocator_type get_allocator() const { return _M_impl.get_allocator(); } iterator begin() { return _M_impl.begin(); } iterator end() { return _M_impl.end(); } const_iterator begin() const { return _M_impl.begin(); } const_iterator end() const { return _M_impl.end(); } reverse_iterator rbegin() { return _M_impl.rbegin(); } reverse_iterator rend() { return _M_impl.rend(); } const_reverse_iterator rbegin() const { return _M_impl.rbegin(); } const_reverse_iterator rend() const { return _M_impl.rend(); } reference operator[](size_type __n) { return _M_impl[__n]; } const_reference operator[](size_type __n) const { return _M_impl[__n]; } reference at(size_type __n) { return _M_impl.at(__n); } const_reference at(size_type __n) const { return _M_impl.at(__n); } reference front() { return _M_impl.front(); } reference back() { return _M_impl.back(); } const_reference front() const { return _M_impl.front(); } const_reference back() const { return _M_impl.back(); } size_type size() const { return _M_impl.size(); } size_type max_size() const { return _M_impl.max_size(); } bool empty() const { return _M_impl.empty(); } explicit deque(const allocator_type& __a = allocator_type()) : _M_impl(__a) {} deque(const _Self& __x) : _M_impl(__x._M_impl) {} #if !defined(_STLP_DONT_SUP_DFLT_PARAM) explicit deque(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(value_type), #else deque(size_type __n, const value_type& __val, #endif /*_STLP_DONT_SUP_DFLT_PARAM*/ const allocator_type& __a = allocator_type()) : _M_impl(__n, __val, __a) {} #if defined(_STLP_DONT_SUP_DFLT_PARAM) explicit deque(size_type __n) : _M_impl(__n) {} #endif /*_STLP_DONT_SUP_DFLT_PARAM*/ #ifdef _STLP_MEMBER_TEMPLATES template <class _InputIterator> deque(_InputIterator __first, _InputIterator __last, const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) : _M_impl(__first, __last, __a) {} # ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS template <class _InputIterator> deque(_InputIterator __first, _InputIterator __last) : _M_impl(__first, __last) {} # endif # else deque(const value_type* __first, const value_type* __last, const allocator_type& __a = allocator_type() ) : _M_impl(__first, __last, __a) {} deque(const_iterator __first, const_iterator __last, const allocator_type& __a = allocator_type() ) : _M_impl(__first, __last, __a) {} #endif /* _STLP_MEMBER_TEMPLATES */ deque(__move_source<_Self> src) : _M_impl(__move_source<_Base>(src.get()._M_impl)) {} _Self& operator= (const _Self& __x) { _M_impl = __x._M_impl; return *this; } void swap(_Self& __x) { _M_impl.swap(__x._M_impl); } void assign(size_type __n, const_reference __val) { _M_impl.assign(__n, __val); } #ifdef _STLP_MEMBER_TEMPLATES template <class _InputIterator> void assign(_InputIterator __first, _InputIterator __last) #else void assign(const value_type *__first, const value_type *__last) { _M_impl.assign(__first, __last); } void assign(const_iterator __first, const_iterator __last) #endif /* _STLP_MEMBER_TEMPLATES */ { _M_impl.assign(__first, __last); } #if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) void push_back(const_reference __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) #else void push_back(const value_type& __x) #endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ { _M_impl.push_back(__x); } #if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) void push_front(const_reference __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) #else void push_front(const_reference __x) #endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ { _M_impl.push_front(__x); } # if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) void push_back() { _M_impl.push_back(); } void push_front() { _M_impl.push_front(); } # endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ void pop_back() { _M_impl.pop_back(); } void pop_front() { _M_impl.pop_front(); } #if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) iterator insert(iterator __pos, const_reference __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) #else iterator insert(iterator __pos, const_reference __x) #endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ { return _M_impl.insert(__pos, __x); } #if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) iterator insert(iterator __pos) { return _M_impl.insert(__pos); } #endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ void insert(iterator __pos, size_type __n, const_reference __x) { _M_impl.insert(__pos, __n, __x); } #ifdef _STLP_MEMBER_TEMPLATES template <class _InputIterator> void insert(iterator __pos, _InputIterator __first, _InputIterator __last) #else /* _STLP_MEMBER_TEMPLATES */ void insert(iterator __pos, const value_type* __first, const value_type* __last) { _M_impl.insert(__pos, __first, __last); } void insert(iterator __pos, const_iterator __first, const_iterator __last) #endif /* _STLP_MEMBER_TEMPLATES */ { _M_impl.insert(__pos, __first, __last); } #if !defined(_STLP_DONT_SUP_DFLT_PARAM) void resize(size_type __new_size, const_reference __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) #else void resize(size_type __new_size, const_reference __x) #endif /*_STLP_DONT_SUP_DFLT_PARAM*/ { _M_impl.resize(__new_size, __x); } #if defined(_STLP_DONT_SUP_DFLT_PARAM) void resize(size_type __new_size) { _M_impl.resize(__new_size); } #endif /*_STLP_DONT_SUP_DFLT_PARAM*/ iterator erase(iterator __pos) { return _M_impl.erase(__pos); } iterator erase(iterator __first, iterator __last) { return _M_impl.erase(__first, __last); } void clear() { _M_impl.clear(); } private: _Base _M_impl; }; /* * The pointer partial specialization. */ /* * struct helper to cast deque iterators: */ template <class _Tp> struct _Ite_cast { typedef _Deque_iterator<_Tp*, _Nonconst_traits<_Tp*> > iterator; typedef _Deque_iterator<_Tp*, _Const_traits<_Tp*> > const_iterator; typedef _Deque_iterator<void*, _Nonconst_traits<void*> > void_iterator; typedef _Deque_iterator<void*, _Const_traits<void*> > void_const_iterator; typedef __void_ptr_traits<_Tp> cast_traits; static iterator _M_cast (void_iterator const&__void_ite) { iterator tmp; tmp._M_cur = cast_traits::ptr_cast(__void_ite._M_cur); tmp._M_first = cast_traits::ptr_cast(__void_ite._M_first); tmp._M_last = cast_traits::ptr_cast(__void_ite._M_last); tmp._M_node = cast_traits::ptr_ptr_cast(__void_ite._M_node); return tmp; } static void_iterator _M_cast (iterator const&__t_ite) { void_iterator tmp; tmp._M_cur = cast_traits::ptr_cast(__t_ite._M_cur); tmp._M_first = cast_traits::ptr_cast(__t_ite._M_first); tmp._M_last = cast_traits::ptr_cast(__t_ite._M_last); tmp._M_node = cast_traits::ptr_ptr_cast(__t_ite._M_node); return tmp; } static const_iterator _M_ccast (void_const_iterator const&__void_ite) { const_iterator tmp; tmp._M_cur = cast_traits::ptr_cast(__void_ite._M_cur); tmp._M_first = cast_traits::ptr_cast(__void_ite._M_first); tmp._M_last = cast_traits::ptr_cast(__void_ite._M_last); tmp._M_node = cast_traits::ptr_ptr_cast(__void_ite._M_node); return tmp; } static void_const_iterator _M_ccast (const_iterator const&__t_ite) { void_const_iterator tmp; tmp._M_cur = cast_traits::ptr_cast(__t_ite._M_cur); tmp._M_first = cast_traits::ptr_cast(__t_ite._M_first); tmp._M_last = cast_traits::ptr_cast(__t_ite._M_last); tmp._M_node = cast_traits::ptr_ptr_cast(__t_ite._M_node); return tmp; } }; template <> struct _Ite_cast<void*> { typedef _Deque_iterator<void*, _Nonconst_traits<void*> > iterator; typedef _Deque_iterator<void*, _Const_traits<void*> > const_iterator; static iterator _M_cast (iterator const&ite) { return ite; } static const_iterator _M_ccast (const_iterator const&ite) { return ite; } }; #if defined (_STLP_USE_TEMPLATE_EXPORT) _STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<size_t, void*, allocator<void*> >; _STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<void***, void**, allocator<void**> >; _STLP_EXPORT template struct _STLP_CLASS_DECLSPEC _Deque_iterator<void*, _Nonconst_traits<void*> >; _STLP_EXPORT_TEMPLATE_CLASS _Deque_base<void*,allocator<void*> >; _STLP_EXPORT_TEMPLATE_CLASS _Deque_impl<void*,allocator<void*> >; #endif template <class _Tp, class _Alloc> class deque<_Tp*, _Alloc> { typedef typename _Alloc_traits<void*, _Alloc>::allocator_type _VoidAlloc; typedef _Deque_impl<void*, _VoidAlloc> _Base; typedef deque<_Tp*, _Alloc> _Self; typedef __void_ptr_traits<_Tp> cast_traits; typedef _Ite_cast<_Tp> ite_cast_traits; public: typedef _Tp* value_type; typedef value_type* pointer; typedef const value_type* const_pointer; typedef value_type& reference; typedef const value_type& const_reference; typedef size_t size_type; typedef ptrdiff_t difference_type; typedef random_access_iterator_tag _Iterator_category; _STLP_FORCE_ALLOCATORS(value_type, _Alloc) typedef typename _Alloc_traits<value_type, _Alloc>::allocator_type allocator_type; typedef _Deque_iterator<value_type, _Nonconst_traits<value_type> > iterator; typedef _Deque_iterator<value_type, _Const_traits<value_type> > const_iterator; _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; public: // Basic accessors iterator begin() { return ite_cast_traits::_M_cast(_M_impl.begin()); } iterator end() { return ite_cast_traits::_M_cast(_M_impl.end()); } const_iterator begin() const { return ite_cast_traits::_M_ccast(_M_impl.begin()); } const_iterator end() const { return ite_cast_traits::_M_ccast(_M_impl.end()); } reverse_iterator rbegin() { return reverse_iterator(end()); } reverse_iterator rend() { return reverse_iterator(begin()); } const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } reference operator[](size_type __n) { return cast_traits::ref_cast(_M_impl[__n]); } const_reference operator[](size_type __n) const { return cast_traits::const_ref_cast(_M_impl[__n]); } reference at(size_type __n) { return cast_traits::ref_cast(_M_impl.at(__n)); } const_reference at(size_type __n) const { return cast_traits::const_ref_cast(_M_impl.at(__n)); } reference front() { return cast_traits::ref_cast(_M_impl.front()); } reference back() { return cast_traits::ref_cast(_M_impl.back()); } const_reference front() const { return cast_traits::const_ref_cast(_M_impl.front()); } const_reference back() const { return cast_traits::const_ref_cast(_M_impl.back()); } size_type size() const { return _M_impl.size(); } size_type max_size() const { return _M_impl.max_size(); } bool empty() const { return _M_impl.empty(); } allocator_type get_allocator() const { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); } explicit deque(const allocator_type& __a = allocator_type()) : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, void*)) {} deque(const _Self& __x) : _M_impl(__x._M_impl) {} #if !defined(_STLP_DONT_SUP_DFLT_PARAM) explicit deque(size_type __n, value_type __val = 0, #else deque(size_type __n, value_type __val, #endif /*_STLP_DONT_SUP_DFLT_PARAM*/ const allocator_type& __a = allocator_type()) : _M_impl(__n, cast_traits::cast(__val), _STLP_CONVERT_ALLOCATOR(__a, void*)) {} // int,long variants may be needed #if defined(_STLP_DONT_SUP_DFLT_PARAM) explicit deque(size_type __n) : _M_impl(__n) {} #endif /*_STLP_DONT_SUP_DFLT_PARAM*/ #ifdef _STLP_MEMBER_TEMPLATES # ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS template <class _InputIterator> deque(_InputIterator __first, _InputIterator __last) : _M_impl(__first, __last) {} # endif template <class _InputIterator> deque(_InputIterator __first, _InputIterator __last, const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) : _M_impl(__iterator_wrapper<_Tp, _InputIterator>(__first), __iterator_wrapper<_Tp, _InputIterator>(__last), _STLP_CONVERT_ALLOCATOR(__a, void*)) {} # else deque(const_pointer __first, const_pointer __last, const allocator_type& __a = allocator_type() ) : _M_impl(cast_traits::const_ptr_cast(__first), cast_traits::const_ptr_cast(__last), _STLP_CONVERT_ALLOCATOR(__a, void*)) {} deque(const_iterator __first, const_iterator __last, const allocator_type& __a = allocator_type() ) : _M_impl(ite_cast_traits::_M_ccast(__first), ite_cast_traits::_M_ccast(__last), _STLP_CONVERT_ALLOCATOR(__a, void*)) {} #endif /* _STLP_MEMBER_TEMPLATES */ deque(__move_source<_Self> src) : _M_impl(__move_source<_Base>(src.get()._M_impl)) {} _Self& operator= (const _Self& __x) { _M_impl = __x._M_impl; return *this; } void swap(_Self& __x) { _M_impl.swap(__x._M_impl); } void assign(size_type __n, value_type __val) { _M_impl.assign(__n, cast_traits::cast(__val)); } #ifdef _STLP_MEMBER_TEMPLATES template <class _InputIterator> void assign(_InputIterator __first, _InputIterator __last) { _M_impl.assign(__iterator_wrapper<_Tp, _InputIterator>(__first), __iterator_wrapper<_Tp, _InputIterator>(__last)); } #else void assign(const value_type *__first, const value_type *__last) { _M_impl.assign(cast_traits::const_ptr_cast(__first), cast_traits::const_ptr_cast(__last)); } void assign(const_iterator __first, const_iterator __last) { _M_impl.assign(ite_cast_traits::_M_ccast(__first), ite_cast_traits::_M_ccast(__last)); } #endif /* _STLP_MEMBER_TEMPLATES */ #if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) void push_back(value_type __t = 0) #else void push_back(value_type __t) #endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ { _M_impl.push_back(cast_traits::cast(__t)); } #if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) void push_front(value_type __t = 0) #else void push_front(value_type __t) #endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ { _M_impl.push_front(cast_traits::cast(__t)); } # if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) void push_back() { _M_impl.push_back(); } void push_front() { _M_impl.push_front(); } # endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ void pop_back() { _M_impl.pop_back(); } void pop_front() { _M_impl.pop_front(); } #if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) iterator insert(iterator __pos, value_type __x = 0) #else iterator insert(iterator __pos, value_type __x) #endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ { return ite_cast_traits::_M_cast(_M_impl.insert(ite_cast_traits::_M_cast(__pos), cast_traits::cast(__x))); } #if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) iterator insert(iterator __pos) { return insert(__pos, 0); } #endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ void insert(iterator __pos, size_type __n, value_type __x) { _M_impl.insert(ite_cast_traits::_M_cast(__pos), __n, cast_traits::cast(__x)); } #ifdef _STLP_MEMBER_TEMPLATES template <class _InputIterator> void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { _M_impl.insert(ite_cast_traits::_M_cast(__pos), __iterator_wrapper<_Tp, _InputIterator>(__first), __iterator_wrapper<_Tp, _InputIterator>(__last)); } #else /* _STLP_MEMBER_TEMPLATES */ void insert(iterator __pos, const_pointer __first, const_pointer __last) { _M_impl.insert(ite_cast_traits::_M_cast(__pos), cast_traits::const_ptr_cast(__first), cast_traits::const_ptr_cast(__last)); } void insert(iterator __pos, const_iterator __first, const_iterator __last) { _M_impl.insert(ite_cast_traits::_M_cast(__pos), ite_cast_traits::_M_ccast(__first), ite_cast_traits::_M_ccast(__last)); } #endif /* _STLP_MEMBER_TEMPLATES */ #if !defined(_STLP_DONT_SUP_DFLT_PARAM) void resize(size_type __new_size, value_type __x = 0) #else void resize(size_type __new_size, value_type __x) #endif /*_STLP_DONT_SUP_DFLT_PARAM*/ { _M_impl.resize(__new_size, cast_traits::cast(__x)); } #if defined(_STLP_DONT_SUP_DFLT_PARAM) void resize(size_type __new_size) { _M_impl.resize(__new_size); } #endif /*_STLP_DONT_SUP_DFLT_PARAM*/ iterator erase(iterator __pos) { return ite_cast_traits::_M_cast(_M_impl.erase(ite_cast_traits::_M_cast(__pos))); } iterator erase(iterator __first, iterator __last) { return ite_cast_traits::_M_cast(_M_impl.erase(ite_cast_traits::_M_cast(__first), ite_cast_traits::_M_cast(__last))); } void clear() { _M_impl.clear(); } private: _Base _M_impl; }; #endif /* _STLP_SPECIALIZED_DEQUE_H */ // Local Variables: // mode:C++ // End:
[ [ [ 1, 466 ] ] ]
96cb566cede175f01440dd8af4649e9bce8767f4
1aa804f9ce4765517ead568d7306cab7bae08e8c
/libatom/Compiler.h
a3819938d1c54c80dcee0f541cde29a31631ed78
[]
no_license
marcomorain/atom-old
d6657233fbe3336760f5c873c9531c699cb51429
9300e17c25e4ed08d17b15d56b59eaa6da21de7c
refs/heads/master
2021-01-19T02:41:29.281966
2008-12-16T14:21:49
2008-12-16T14:21:49
32,418,516
0
0
null
null
null
null
UTF-8
C++
false
false
860
h
#pragma once #undef null #define null (0) typedef __int64 Integer; typedef unsigned hash; #ifdef WIN32 # define BREAKPOINT() do { __asm int 3 } while(0) # pragma warning ( disable : 4800 ) // Warning when casting to a bool from a pointer. #elif defined OSX # include <signal.h> # define BREAKPOINT() raise(SIGTRAP) #else # error could not define BREAKPOINT #endif class NoCopy { // Private copy CTORS with no implementation private: NoCopy(const NoCopy& copy); NoCopy& operator=(const NoCopy& copy); // Public non-copy CTOR public: inline NoCopy () {}; }; template <typename Type> class Counted { public: static int s_count; static int s_next; int m_object_number; Counted ( void ) { m_object_number = s_next; s_count++; s_next++; } ~Counted ( void ) { s_count--; } };
[ [ [ 1, 50 ] ] ]
ddd8732d897f152759a98fa75a77c939fe981704
ce0622a0f49dd0ca172db04efdd9484064f20973
/tools/GameList/Common/AtgApp.h
a056e4a104b5b00b39987aa233bbd7609474d86f
[]
no_license
maninha22crazy/xboxplayer
a78b0699d4002058e12c8f2b8c83b1cbc3316500
e9ff96899ad8e8c93deb3b2fe9168239f6a61fe1
refs/heads/master
2020-12-24T18:42:28.174670
2010-03-14T13:57:37
2010-03-14T13:57:37
56,190,024
1
0
null
null
null
null
UTF-8
C++
false
false
2,062
h
//-------------------------------------------------------------------------------------- // AtgApp.h // // Application class for samples // // Xbox Advanced Technology Group. // Copyright (C) Microsoft Corporation. All rights reserved. //-------------------------------------------------------------------------------------- #pragma once #ifndef ATGAPP_H #define ATGAPP_H // Use the overloaded D3DDevice class #include "AtgDevice.h" // Disable warning C4324: structure padded due to __declspec(align()) // Warning C4324 comes up often in samples derived from the Application class, since // they use XMVECTOR, XMMATRIX, and other member data types that must be aligned. #pragma warning( disable:4324 ) namespace ATG { // Global access to the main D3D device extern D3DDevice* g_pd3dDevice; //-------------------------------------------------------------------------------------- // Error codes //-------------------------------------------------------------------------------------- #define ATGAPPERR_MEDIANOTFOUND 0x82000003 //-------------------------------------------------------------------------------------- // A base class for creating sample Xbox applications. To create a simple // Xbox application, simply derive this class and override the following // functions: // Initialize() - To initialize the device-dependant objects // Update() - To animate the scene // Render() - To render the scene //-------------------------------------------------------------------------------------- class Application { public: // Main objects used for creating and rendering the 3D scene static D3DPRESENT_PARAMETERS m_d3dpp; static D3DDevice* m_pd3dDevice; static DWORD m_dwDeviceCreationFlags; // Overridable functions virtual HRESULT Initialize() = 0; virtual HRESULT Update() = 0; virtual HRESULT Render() = 0; // Function to create and run the application VOID Run(); }; } // namespace ATG #endif // ATGAPP_H
[ "goohome@343f5ee6-a13e-11de-ba2c-3b65426ee844" ]
[ [ [ 1, 63 ] ] ]
7f5421e61401a0ba985c46a0eededbbd1b98fabe
004b974bc5be3fd175c77f0a0ae4cf21681fa97b
/eclipse/CamPayloadArduino/main.cpp
c5e1d4fea250888036d657d4d57f66a0472d29d9
[]
no_license
michaelwh/uavcamera
c2313046b648fa6c71e6883811b336acf6508c68
73e63d2c27cf074134f4387ade1e333eec62622d
refs/heads/master
2021-01-20T23:11:45.013786
2011-12-15T06:06:55
2011-12-15T06:06:55
2,838,049
0
1
null
null
null
null
UTF-8
C++
false
false
7,997
cpp
/* * main.cpp * * Created on: Mar 5, 2010 * Author: ssmethurst */ #include <WProgram.h> // Camera -> SD Card Code // PIN LAYOUT: // Digital 13 <-> SD CLK // Digital 12 <-> SD MISO / Data 0 / SO // Digital 11 <-> SD MOSI / CMD / DI // Digital 4 <-> SD D3 // Arduino RX <-> Camera TX // Arduino TX <-> Camera RX #include "SoftwareSerial/SoftwareSerial.h" #include "SD/SD.h" #include <stdio.h> #define DLOG(...) sSerial.print(__VA_ARGS__) //#define DLOG(...) byte SYNC[] = {0xAA,0x0D,0x00,0x00,0x00,0x00}; byte RXtest[6]; // Serial PC cable to view error messages #define sRxPin 2 #define sTxPin 3 SoftwareSerial sSerial = SoftwareSerial(sRxPin, sTxPin); char filePrefix[] = "test"; //Prefix of file name written to the SD card char fileExt[] = ".jpg"; //File extension of the file being written to char fileName[13]; //Contains full file name of file being written to char numBuf[5]; //Number buffer, for the "find a file that doesn't exist" procedure. Could be a number up to 32767 File jpgFile; // The following are all self-explanatory. // Follows command structure described in the camera's datasheet // sends commands to the camera void sendCommand(byte ID1, byte ID2, byte par1, byte par2, byte par3, byte par4) { byte Command[] = {ID1,ID2,par1,par2,par3,par4}; Serial.write(Command, 6); } // receives messages from the camera void receiveComd() { for(int z = 0;z<6;z++){ while (Serial.available() <= 0) {} RXtest[z] = Serial.read(); } } void sendSYNC() { sendCommand(0xAA,0x0D,0x00,0x00,0x00,0x00); } void sendACK(byte comID, byte ACKcounter, byte pakID1, byte pakID2) { sendCommand(0xAA,0x0E,comID,ACKcounter,pakID1,pakID2); } void sendINITIAL(byte colourType, byte rawRes, byte jpegRes) { sendCommand(0xAA,0x01,0x00,colourType,rawRes,jpegRes); } void sendSETPACKAGESIZE(byte paklb, byte pakhb) { sendCommand(0xAA,0x06,0x08,paklb,pakhb,0x00); } void sendSNAPSHOT(byte snapType, byte skip1, byte skip2) { sendCommand(0xAA,0x05,snapType,skip1,skip2,0x00); } void sendGETPICTURE(byte picType) { sendCommand(0xAA,0x04,picType,0x00,0x00,0x00); } // verifies ACK boolean isACK(byte byteundertest[],byte comID, byte pakID1, byte pakID2){ byte testACK[] = {0xAA,0x0E,comID,0x00,pakID1,pakID2}; for(int z = 0;z<6;z++){ if((z != 3) && (byteundertest[z] != testACK[z])) return false; } return true; } // verifies SYNC boolean isSYNC(byte byteundertest[]){ for(int z = 0;z<6;z++){ if(byteundertest[z] != SYNC[z]) return false; } return true; } // verifies DATA boolean isDATA(byte byteundertest[]){ if((byteundertest[0] != 0xAA) || (byteundertest[1] != 0x0A)){ return false; } return true; } // setup the file on the sd card void setupSD(char fileName[]){ // For Optimisation of the SD card writing process. // See http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1293975555 jpgFile = SD.open(fileName, O_CREAT | O_WRITE); } // synchronise with camera void establishContact() { DLOG("Sending syncs\n\r\r"); // Send SYNC to the camera. //This could be up to 60 times while(1){ while (Serial.available() <= 0) { DLOG("."); sendSYNC(); delay(50); } receiveComd(); // Verify that the camera has sent back an ACK followed by SYNC if(!isACK(RXtest,0x0D,0x00,0x00)) continue; DLOG("ACK received\n\r"); receiveComd(); if(!isSYNC(RXtest)) continue; DLOG("SYNC received\n\r"); // Send back an ACK sendACK(0x0D,0x00,0x00,0x00); break; } } // takes a snapshot boolean takeSnapshot() { // setup image parameters DLOG("sending initial\n\r"); delay(50); sendINITIAL(0x07,0x07,0x07); receiveComd(); if(!isACK(RXtest,0x01,0x00,0x00)) return false; DLOG("ACK received\n\r"); // Package size = maximum of 512 bytes // Arduino serial.read() buffer size = 128 bytes unsigned int packageSize = 64; // sets the size of the packets to be sent from the camera DLOG("sending setpackagesize\n\r"); delay(50); sendSETPACKAGESIZE((byte)packageSize,(byte)(packageSize>>8)); receiveComd(); if(!isACK(RXtest,0x06,0x00,0x00)) return false; DLOG("ACK received\r"); // camera stores a single frame in its buffer DLOG("sending snapshot\n\r"); delay(50); sendSNAPSHOT(0x00,0x00,0x00); receiveComd(); if(!isACK(RXtest,0x05,0x00,0x00)) return false; DLOG("ACK received\n\r"); // requests the image from the camera DLOG("sending getpicture\n\r"); delay(50); sendGETPICTURE(0x01); receiveComd(); if(!isACK(RXtest,0x04,0x00,0x00)) return false; DLOG("ACK received\n\r"); receiveComd(); if(!isDATA(RXtest)) return false; DLOG("DATA received\n\r"); // Strips out the "number of packages" from the DATA command // then displays this over the serial link unsigned long bufferSize = 0; bufferSize = RXtest[5] | bufferSize; bufferSize = (bufferSize<<8) | RXtest[4]; bufferSize = (bufferSize<<8) | RXtest[3]; unsigned int numPackages = bufferSize/(packageSize-6); DLOG("Number of packages: "); DLOG(numPackages,DEC); sSerial.println(); byte dataIn[packageSize]; int flushCount = 0; for(unsigned int package = 0;package<numPackages;package++){ //DLOG("Sending ACK for package "); //DLOG(package,DEC); //DLOG("\n\r"); sendACK(0x00,0x00,(byte)package,(byte)(package>>8)); // receive package for(int dataPoint = 0; dataPoint<packageSize;dataPoint++){ while (Serial.available() <= 0) {} // wait for data to be available n.b. will wait forever... dataIn[dataPoint] = Serial.read(); if(dataPoint > 3 && dataPoint < (packageSize - 2)){ //strips out header data //sSerial.print(dataIn[dataPoint],BYTE); jpgFile.print(dataIn[dataPoint]); if(flushCount == 511){ jpgFile.flush(); flushCount = -1; // because it adds one straight away after } flushCount++; } //DLOG(dataPoint); //DLOG("\n\r"); } //DLOG("Package "); //DLOG(package); //DLOG(" read successfully\n\r"); } sendACK(0x0A,0x00,0xF0,0xF0); DLOG("Final ACK sent\n\r"); return true; } void setup() { // start serial port at 115200 bps Serial.begin(115200); sSerial.begin(9600); // start software serial library for debugging pinMode(sRxPin, INPUT); pinMode(sTxPin, OUTPUT); // Pin 10 = Chip Select pinMode(10, OUTPUT); // If SD not connected, stop execution if (!SD.begin(4)) { DLOG("SD Failed"); return; } DLOG("SD Working"); //DLOG("Attemting to establish contact.\n\r"); establishContact(); // send a byte to establish contact until receiver responds //DLOG("Contact established, captain\n\r"); delay(2000); // 2 second pause } void loop() { sSerial.read(); //Wait for something to be sent over the PC serial line boolean fileExists = true; int fileNum = 0; while(fileExists){ fileNum++; snprintf(fileName, sizeof(fileName), "%s%i%s", filePrefix, fileNum, fileExt); // prints "test{num},jpg" to fileName fileExists = SD.exists(fileName); // checks whether that file is on the SD card. } sSerial.println(fileName); setupSD(fileName); // creates the file on the sd for writing boolean wellness = takeSnapshot(); //Take a snapshot if(wellness){ //If no error is detected DLOG("All's well\n\r"); delay(2000); }else{ //Error has been detected DLOG("Trouble at mill...\n\r"); } jpgFile.close(); // Close JPG file } int main(void) { /* Must call init for arduino to work properly */ init(); setup(); for (;;) { loop(); } // end for } // end main
[ [ [ 1, 311 ] ] ]
7d9d88b725b0ac2aa282e93265c9ff10cc117f9d
58ef4939342d5253f6fcb372c56513055d589eb8
/LemonTangram/source/Controller/inc/LemonMenuList.h
23e0e072837fdb5fa84ef75b416aa1982e3154e5
[]
no_license
flaithbheartaigh/lemonplayer
2d77869e4cf787acb0aef51341dc784b3cf626ba
ea22bc8679d4431460f714cd3476a32927c7080e
refs/heads/master
2021-01-10T11:29:49.953139
2011-04-25T03:15:18
2011-04-25T03:15:18
50,263,327
0
0
null
null
null
null
UTF-8
C++
false
false
1,861
h
/* ============================================================================ Name : LemonMenuList.h Author : zengcity Version : 1.0 Copyright : Your copyright notice Description : CLemonMenuList declaration ============================================================================ */ #ifndef LEMONMENULIST_H #define LEMONMENULIST_H // INCLUDES #include <e32std.h> #include <e32base.h> #include <bitstd.h> // CLASS DECLARATION class CLemonMenuItem; /** * CLemonMenuList * */ class CLemonMenuList : public CBase { public: // Constructors and destructor ~CLemonMenuList(); static CLemonMenuList* NewL(const CFont* aFont); static CLemonMenuList* NewLC(const CFont* aFont); private: CLemonMenuList(const CFont* aFont); void ConstructL(); public: CLemonMenuItem* FindItemById(const TInt& aId); CLemonMenuList*& FindListById(const TInt& aId); void AddItem(CLemonMenuItem* aItem); void Clear(); void Draw(CFbsBitGc& gc); void SetPositon(const TPoint& aPosition) {iPosition = aPosition;}; TPoint GetPosition() const {return iPosition;}; void SetListSize(const TSize& aSize) {iSize = aSize;}; TSize GetListSize(){return iSize;}; void SetItemHeight(const TInt& aHeight) {iItemHeight = aHeight;}; TInt GetItemHeight(){return iItemHeight;}; void RecordItemWidth(TInt aWidth); void OffsetItem(); void ResetSelectedIndex(); void SetSelectedIndex(const TInt& aIndex); void IncreaseSelected(); void DecreaseSelected(); TInt GetSelectedCommand(); private: void DrawFrame(CFbsBitGc& gc); private: RPointerArray<CLemonMenuItem> iItems; TPoint iPosition; TSize iSize; TRgb iFrameColor; TRgb iBackgroundColor; TInt iItemWidth; TInt iItemHeight; const CFont* iFont; TInt iSelectedIndex; }; #endif // LEMONMENULIST_H
[ "zengcity@415e30b0-1e86-11de-9c9a-2d325a3e6494" ]
[ [ [ 1, 80 ] ] ]
6442287aeba32af1c63adba280a42aa5fdc644a2
d425cf21f2066a0cce2d6e804bf3efbf6dd00c00
/Laptop/Store Inventory.cpp
b9f6fa51da545aff1c42e15cdefc65c3dc3690d2
[]
no_license
infernuslord/ja2
d5ac783931044e9b9311fc61629eb671f376d064
91f88d470e48e60ebfdb584c23cc9814f620ccee
refs/heads/master
2021-01-02T23:07:58.941216
2011-10-18T09:22:53
2011-10-18T09:22:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
22,900
cpp
#ifdef PRECOMPILEDHEADERS #include "Laptop All.h" #else #include "Types.h" #include "Store Inventory.h" #include "Random.h" #include "Weapons.h" #include "Debug.h" #include "LaptopSave.h" #include "ShopKeeper Interface.h" #include "armsdealerinvinit.h" #include "GameSettings.h" #endif UINT8 StoreInventory[MAXITEMS][BOBBY_RAY_LISTS]; //= //{ //// //// The first column is for Bobby Rays new inventory, BOBBY_RAY_NEW, //// The second column is for Bobby Rays used inventory, BOBBY_RAY_USED, //// // {0, 0 }, /* nothing */ //// MADD MARKER ////---WEAPONS--- // {8, 1 }, /* Glock 17 */ // {6, 1 }, /* Glock 18 */ // {8, 1 }, /* Beretta 92F */ // {6, 1 }, /* Beretta 93R */ // {8, 1 }, /* .38 S&W Special */ // {8, 1 }, /* .357 Barracuda */ // {6, 1 }, /* .357 DesertEagle*/ // {7, 1 }, /* .45 M1911 */ // {4, 1 }, /* H&K MP5K */ // {4, 1 }, /* .45 MAC-10 */ // 10 // // {4, 1 }, /* Thompson M1A1 */ // {4, 1 }, /* Colt Commando */ // {4, 1 }, /* H&K MP53 */ // {4, 1 }, /* AKSU-74 */ // {2, 1 }, /* 5.7mm FN P90 */ // {4, 1 }, /* Type-85 */ // {3, 1 }, /* SKS */ // {2, 1 }, /* Dragunov */ // {2, 1 }, /* M24 */ // {3, 1 }, /* Steyr AUG */ //20 // // {3, 1 }, /* H&K G41 */ // {3, 1 }, /* Ruger Mini-14 */ // {3, 1 }, /* C-7 */ // {3, 1 }, /* FA-MAS */ // {3, 1 }, /* AK-74 */ // {3, 1 }, /* AKM */ // {3, 1 }, /* M-14 */ // {3, 1 }, /* FN-FAL */ // {3, 1 }, /* H&K G3A3 */ // {3, 1 }, /* H&K G11 */ // 30 // // {5, 1 }, /* Remington M870 */ // {3, 1 }, /* SPAS-15 */ // {2, 1 }, /* CAWS */ // {2, 1 }, /* FN Minimi */ // {2, 1 }, /* RPK-74 */ // {2, 1 }, /* H&K 21E */ // {5, 0 }, /* combat knife */ // {7, 0 }, /* throwing knife */ // {0, 0 }, /* rock */ // {2, 0 }, /* grenade launcher*/ // 40 // // {2, 0 }, /* mortar */ // {0, 0 }, /* another rock */ // {0, 0 }, /* claws */ // {0, 0 }, /* claws */ // {0, 0 }, /* claws */ // {0, 0 }, /* claws */ // {0, 0 }, /* tentacles */ // {0, 0 }, /* spit */ // {2, 0 }, /* brass knuckles */ // {6, 0 }, /* underslung g.l. */ // 50 // // {4, 0 }, /* rocket launcher */ // {0, 0 }, /* bloodcat claws */ // {0, 0 }, /* bloodcat bite */ // {2, 0 }, /* machete */ // {1, 0 }, /* rocket rifle */ // {0, 0 }, /* Automag III */ // {0, 0 }, /* spit */ // {0, 0 }, /* spit */ // {0, 0 }, /* spit */ // {0, 0 }, /* tank cannon */ // 60 // // {2, 1 }, /* dart gun */ // {0, 0 }, /* bloody throwing knife */ // {0, 0 }, /* flamethrower */ // {3, 0 }, /* Crowbar */ // {1, 0 }, /* Auto Rocket Rifle */ // {2, 1 }, /* barrett - nothing */ // {2, 1 }, /* val silent - nothing */ // {2, 1 }, /* psg - nothing */ // {2, 1 }, /* tar 21 - nothing */ // {0, 0 }, /* nothing */ // 70 // ////---AMMO--- // {50, 0 }, /* CLIP9_15 */ // {40, 0 }, /* CLIP9_30 */ // {8, 0 }, /* CLIP9_15_AP */ // {4, 0 }, /* CLIP9_30_AP */ // {7, 0 }, /* CLIP9_15_HP */ // {4, 0 }, /* CLIP9_30_HP */ // {50, 0 }, /* CLIP38_6 */ // {8, 0 }, /* CLIP38_6_AP */ // {6, 0 }, /* CLIP38_6_HP */ // {40, 0 }, /* CLIP45_7 */ // 80 // // {25, 0 }, /* CLIP45_30 */ // {6, 0 }, /* CLIP45_7_AP */ // {8, 0 }, /* CLIP45_30_AP */ // {6, 0 }, /* CLIP45_7_HP */ // {5, 0 }, /* CLIP45_30_HP */ // {40, 0 }, /* CLIP357_6 */ // {20, 0 }, /* CLIP357_9 */ // {6, 0 }, /* CLIP357_6_AP */ // {5, 0 }, /* CLIP357_9_AP */ // {4, 0 }, /* CLIP357_6_HP */ //90 // // {4, 0 }, /* CLIP357_9_HP */ // {25, 0 }, /* CLIP545_30_AP */ // {5, 0 }, /* CLIP545_30_HP */ // {15, 0 }, /* CLIP556_30_AP */ // {5, 0 }, /* CLIP556_30_HP */ // {15, 0 }, /* CLIP762W_10_AP */ // {12, 0 }, /* CLIP762W_30_AP */ // {4, 0 }, /* CLIP762W_10_HP */ // {5, 0 }, /* CLIP762W_30_HP */ // {10, 0 }, /* CLIP762N_5_AP */ //100 // // {10, 0 }, /* CLIP762N_20_AP */ // {5, 0 }, /* CLIP762N_5_HP */ // {5, 0 }, /* CLIP762N_20_HP */ // {10, 0 }, /* CLIP47_50_SAP */ // {10, 0 }, /* CLIP57_50_AP */ // {5, 0 }, /* CLIP57_50_HP */ // {20, 0 }, /* CLIP12G_7 */ // {40, 0 }, /* CLIP12G_7_BUCKSHOT */ // {10, 0 }, /* CLIPCAWS_10_SAP */ // {10, 0 }, /* CLIPCAWS_10_FLECH */ //110 // // {5, 0 }, /* CLIPROCKET_AP */ // {5, 0 }, /* CLIPROCKET_HE */ // {5, 0 }, /* CLIPROCKET_HEAT */ // {20, 0 }, /* sleep dart */ // {0, 0 }, /* Clip Flame */ // {6, 0 }, /* CLIP50_11 */ // {5, 0 }, /* CLIP9H_20 */ //120 // {8, 0 }, /* CLIP9_50 */ // {4, 0 }, /* CLIP9_50_AP */ // {4, 0 }, /* CLIP9_50_HP */ // // {2, 0 }, /* DRUM545_75_AP */ // {1, 0 }, /* DRUM545_75_HP */ // {2, 0 }, /* BELT556_200_AP */ // {1, 0 }, /* BELT556_200_HP */ // {2, 0 }, /* BELT762N_100_AP */ // {1, 0 }, /* BELT762N_100_HP */ // {10, 0 }, /* CLIP57_20_AP */ // {5, 0 }, /* CLIP57_20_HP */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ //130 // ////---EXPLOSIVES--- // {7, 0 }, /* stun grenade */ // {7, 0 }, /* tear gas grenade */ // {5, 0 }, /* mustard gas grenade*/ // {7, 0 }, /* mini hand grenade */ // {6, 0 }, /* reg hand grenade */ // {0, 0 }, /* RDX */ // {6, 0 }, /* TNT (="explosives")*/ // {0, 0 }, /* HMX (=RDX+TNT) */ // {0, 0 }, /* C1 (=RDX+min oil) */ // {6, 0 }, /* mortar shell */ //140 // // {0, 0 }, /* mine */ // {2, 0 }, /* C4 ("plastique") */ // {0, 0 }, /* trip flare */ // {0, 0 }, /* trip klaxon */ // {4, 0 }, /* shaped charge */ // {4, 0 }, /* break light */ // {5, 0 }, /* 40mm HE grenade */ // {5, 0 }, /* 40mm gas grenade */ // {5, 0 }, /* 40mm stun grenade */ // {5, 0 }, /* 40mm smoke grenade */ //150 // // {7, 0 }, /* smoke hand grenade */ // {0, 0 }, /* tank shell */ // {0, 0 }, /* structure ignite */ // {0, 0 }, /* creature cocktail */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ //160 // ////---ARMOUR--- // {2, 1 }, /* Flak jacket */ // {0, 0 }, /* Flak jacket w X */ // {0, 0 }, /* Flak jacket w Y */ // {1, 1 }, /* Kevlar vest */ // {0, 0 }, /* Kevlar vest w X */ // {0, 0 }, /* Kevlar vest w Y */ // {1, 1 }, /* Spectra vest */ // {0, 0 }, /* Spectra vest w X*/ // {0, 0 }, /* Spectra vest w Y*/ // {1, 1 }, /* Kevlar leggings */ //170 // // {0, 0 }, /* Kevlar legs w X */ // {0, 0 }, /* Kevlar legs w Y */ // {1, 1 }, /* Spectra leggings*/ // {0, 0 }, /* Spectra legs w X*/ // {0, 0 }, /* Spectra legs w Y*/ // {3, 1 }, /* Steel helmet */ // {1, 1 }, /* Kevlar helmet */ // {0, 0 }, /* Kevlar helm w X */ // {0, 0 }, /* Kevlar helm w Y */ // {1, 1 }, /* Spectra helmet */ //180 // // {0, 0 }, /* Spectra helm w X*/ // {0, 0 }, /* Spectra helm w Y*/ // {0, 0 }, /* Ceramic plates */ // {0, 0 }, /* hide */ // {0, 0 }, /* hide */ // {0, 0 }, /* hide */ // {0, 0 }, /* hide */ // {1, 0 }, /* Leather jacket */ // {1, 0 }, /* Leather jacket w kevlar */ // {0, 0 }, /* Leather jacket w kevlar 18 */ //190 // // {1, 0 }, /* Leather jacket w kevlar Y */ // {0, 0 }, /* hide */ // {0, 0 }, /* hide */ // {0, 0 }, /* T-shirt (Arulco) */ // {0, 0 }, /* T-shirt (Deidranna) */ // {1, 1 }, /* Kevlar 2 Vest */ // {0, 0 }, /* Kevlar 2 Vest w 18 */ // {0, 0 }, /* Kevlar 2 Vest w Y */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ //200 // ////---MISC--- // {8, 0 }, /* First aid kit */ // {6, 0 }, /* Medical Kit */ // {4, 1 }, /* Tool Kit */ // {3, 1 }, /* Locksmith kit */ // {4, 0 }, /* Camouflage kit*/ // {0, 0 }, /* nothing */ // Boobytrap kit - unused // {6, 1 }, /* Silencer */ // {6, 1 }, /* Sniper scope */ // {6, 1 }, /* Bipod */ // {6, 1 }, /* Extended ear */ // 210 // // {6, 1 }, /* Night goggles */ // {8, 0 }, /* Sun goggles */ // {6, 1 }, /* Gas mask */ // {10, 0 }, /* Canteen */ // {2, 0 }, /* Metal detector*/ // {6, 0 }, /* Compound 18 */ // {0, 0 }, /* Jar w/Queen Blood */ // {0, 0 }, /* Jar w/Elixir */ // {0, 0 }, /* Money */ // {0, 0 }, /* Glass jar */ //220 // // {0, 0 }, /* Jar w/Creature Blood */ // {0, 0 }, /* Adrenaline Booster */ // {6, 0 }, /* Detonator */ // {6, 0 }, /* Rem Detonator */ // {0, 0 }, /* VideoTape */ // {0, 0 }, /* Deed */ // {0, 0 }, /* Letter */ // {0, 0 }, /* Terrorist Info */ // {0, 0 }, /* Chalice */ // {0, 0 }, /* Mission4 */ //230 // // {0, 0 }, /* Mission5 */ // {0, 0 }, /* Mission6 */ // {0, 0 }, /* Switch */ // {0, 0 }, /* Action Item */ // {0, 0 }, /* Syringe2 */ // {0, 0 }, /* Syringe3 */ // {0, 0 }, /* Syringe4 */ // {0, 0 }, /* Syringe5 */ // {0, 0 }, /* Jar w/Human blood */ // {0, 0 }, /* Ownership item */ //240 // // {6, 1 }, /* Laser scope */ // {6, 0 }, /* Remote trigger*/ // {3, 0 }, /* Wirecutters */ //243 // {3, 0 }, /* Duckbill */ // {0, 0 }, /* Alcohol */ // {1, 1 }, /* UV Goggles */ // {0, 0 }, /* Discarded LAW */ // {0, 0 }, /* head - generic */ // {0, 0 }, /* head - Imposter*/ // {0, 0 }, /* head - T-Rex */ // 250 // // {0, 0 }, /* head - Slay */ // {0, 0 }, /* head - Druggist */ // {0, 0 }, /* head - Matron */ // {0, 0 }, /* head - Tiffany */ // {0, 0 }, /* wine */ // {0, 0 }, /* beer */ // {0, 0 }, /* pornos */ // {0, 0 }, /* video camera */ // {0, 0 }, /* robot remote control */ // {0, 0 }, /* creature claws */ // 260 // // {0, 0 }, /* creature flesh */ // {0, 0 }, /* creature organ */ // {0, 0 }, /* remote trigger */ // {0, 0 }, /* gold watch */ // {0, 0 }, /* golf clubs */ // {0, 0 }, /* walkman */ // {0, 0 }, /* portable TV */ // {0, 0 }, /* Money for player's account */ // {0, 0 }, /* cigars */ // {0, 0 }, /* nothing */ // 270 // // {0, 0 }, /* key */ // 271 // {0, 0 }, /* key */ // {0, 0 }, /* key */ // {0, 0 }, /* key */ // {0, 0 }, /* key */ // {0, 0 }, /* key */ // {0, 0 }, /* key */ // {0, 0 }, /* key */ // {0, 0 }, /* key */ // {0, 0 }, /* key */ // // {6, 1 }, /* flash suppressor */ // 281 // {2, 1 }, /* rpg 7 */ // {4, 0 }, /* RPG_HE_ROCKET */ // {4, 0 }, /* RPG_AP_ROCKET */ // {4, 0 }, /* RPG_FRAG_ROCKET */ // {6, 1 }, /* reflex_scoped */ // {6, 1 }, /* reflex_unscoped */ // {0, 0 }, /* key */ // {0, 0 }, /* key */ // {0, 0 }, /* key */ // // {0, 0 }, /* key */ // 291 // {0, 0 }, /* key */ // {0, 0 }, /* key */ // {0, 0 }, /* key */ // {0, 0 }, /* key */ // {0, 0 }, /* key */ // {0, 0 }, /* key */ // {0, 0 }, /* key */ // {0, 0 }, /* key */ // {0, 0 }, /* key */ // // {0, 0 }, /* key */ // 301 // {0, 0 }, /* key */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // // {0, 0 }, /* nothing */ // 311 // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // // {0, 0 }, /* nothing */ // 321 // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {3, 1 }, /* m900 */ // {6, 1 }, /* m950 */ // {3, 1 }, /* m960a - 330 */ // // {4, 1 }, /* micro uzi - 331 */ // {2, 1 }, /* enfield */ // {5, 1 }, /* MP5 */ // {3, 1 }, /* mp5sd */ // {2, 1 }, /* mp5n */ // {3, 1 }, /* ump45 */ // {4, 1 }, /* five7 */ // {6, 1 }, /* p7m8 */ // {5, 1 }, /* g36k */ // {4, 1 }, /* g36c */ // // {2, 1 }, /* MSG */ // 341 // {3, 1 }, /* Bennelli */ // {3, 1 }, /* AK103 */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // {0, 0 }, /* nothing */ // //}; //MADD MARKER INT16 WeaponROF[ MAXITEMS ];//= //{ // 0, /* Nothing */ // // 40, /* Glock 17 */ // 1300, /* Glock 18 */ // 45, /* Beretta 92F */ // 1100, /* Beretta 93R */ // 25, /* .38 S&W Special */ // 23, /* .357 Barracuda */ // 27, /* .357 DesertEagle*/ // 35, /* .45 M1911 */ // 900, /* H&K MP5K */ // 1090, /* .45 MAC-10 */ // 10 // // 700, /* Thompson M1A1 */ // 900, /* Colt Commando */ // 800, /* H&K MP53 */ // 900, /* AKSU-74 */ // 900, /* 5.7mm FN P90 */ // 780, /* Type-85 */ // 40, /* SKS */ // 20, /* Dragunov */ // 20, /* M24 */ // 650, /* Steyr AUG */ //20 // // 850, /* H&K G41 */ // 750, /* Ruger Mini-14 */ // 600, /* C-7 */ // 900, /* FA-MAS */ // 650, /* AK-74 */ // 600, /* AKM */ // 750, /* M-14 */ // 650, /* FN-FAL */ // 500, /* H&K G3A3 */ // 600, /* H&K G11 */ // 30 // // 21, /* Remington M870 */ // 30, /* SPAS-15 */ // -1, /* CAWS */ // 750, /* FN Minimi */ // 800, /* RPK-74 */ // 800, /* H&K 21E */ // 0, /* combat knife */ // 0, /* throwing knife */ // 0, /* rock */ // 1, /* grenade launcher */ // 40 // // 1, /* mortar */ // 0, /* another rock */ // 0, /* claws */ // 0, /* claws */ // 0, /* claws */ // 0, /* claws */ // 0, /* tentacles */ // 0, /* spit */ // 0, /* brass knuckles */ // 1, /* underslung g.l. */ // 50 // // 1, /* rocket launcher */ // 0, /* nothing */ // 0, /* nothing */ // 0, /* machete */ // 1, /* rocket rifle */ // 666, /* Automag III */ // 0, /* spit */ // 0, /* spit */ // 0, /* spit */ // 1, /* tank cannon */ // 1, /* dart gun */ // //0, // BLOODY_THROWING_KNIFE, //1, // FLAMETHROWER, //0, // CROWBAR, //1, // AUTO_ROCKET_RIFLE, //65 // //20, // BARRETT, //previously unused //25, // VAL_SILENT, //previously unused //22,// PSG, //previously unused //900, // TAR21, //previously unused // // 0, // Max_weapons 70 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 80 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 90 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 100 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 110 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 120 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 130 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 140 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 150 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 160 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 170 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 180 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 190 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 200 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 210 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 220 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 230 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 240 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 250 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 260 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 270 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 280 // 0, // nothing // 1, // rpg 7 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 290 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 300 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 310 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 320 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 1300, /* m900 */ // 600, /* m950 */ // 600, /* m960a - 330 */ // 800, /* micro uzi */ // 600, /* enfield */ // 800, // mp5 // 800, // mp5sd // 900, // mp5n // 800, // ump45 // 45, // five7 // 50, // p7m8 // 750, // G36k // 750, // G36c 340 // 2, // MSG90A1 // 35, // bennelli // 600, // ak103 // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing // 0, // nothing 350 //}; // SetupStoreInventory sets up the initial quantity on hand for all of Bobby Ray's inventory items void SetupStoreInventory( STORE_INVENTORY *pInventoryArray, BOOLEAN fUsed ) { UINT16 i; UINT16 usItemIndex; UINT8 ubNumBought; //loop through all items BR can stock to init a starting quantity on hand for(i = 0; i < LaptopSaveInfo.usInventoryListLength[fUsed]; i++) { usItemIndex = pInventoryArray[ i ].usItemIndex; Assert(usItemIndex < MAXITEMS); ubNumBought = DetermineInitialInvItems( -1, usItemIndex, StoreInventory[ usItemIndex ][ fUsed ], fUsed); if ( ubNumBought > 0) { // If doing used items if( fUsed ) { // then there should only be 1 of them, and it's damaged pInventoryArray[i].ubQtyOnHand = 1; pInventoryArray[i].ubItemQuality = 20 + (UINT8) Random( 60 ); } else // new { // Madd pInventoryArray[i].ubQtyOnHand = ubNumBought * gGameOptions.ubBobbyRay; pInventoryArray[i].ubItemQuality = 100; } } else { // doesn't sell / not in stock pInventoryArray[i].ubQtyOnHand = 0; pInventoryArray[i].ubItemQuality = 0; } } } BOOLEAN DoesGunOfSameClassExistInInventory( UINT8 ubItemIndex, UINT8 ubDealerID ) { UINT16 i; STORE_INVENTORY *pInventoryArray; pInventoryArray = GetPtrToStoreInventory( ubDealerID ); if( pInventoryArray == NULL ) return( FALSE ); //go through all of the guns for(i=0; i<MAXITEMS; i++) { //if it's the class we are looking for if( Weapon[ i ].ubWeaponClass == ubItemIndex ) { // and it's a sufficiently cool gun to be counted as good if (Item[ i ].ubCoolness >= 4) { //if there is already a qty on hand, then we found a match if( pInventoryArray[ i ].ubQtyOnHand ) { return(TRUE); } } } } return(FALSE); } //////////////////////////////////////////////////// //////////////////////////////////////////////////// //////////////////////////////////////////////////// //////////////////////////////////////////////////// STORE_INVENTORY *GetPtrToStoreInventory( UINT8 ubDealerID ) { if( ubDealerID >= BOBBY_RAY_LISTS ) return( NULL ); if( ubDealerID == BOBBY_RAY_NEW ) return( LaptopSaveInfo.BobbyRayInventory ); else if( ubDealerID == BOBBY_RAY_USED ) return( LaptopSaveInfo.BobbyRayUsedInventory ); else Assert( 0 ); return( NULL ); } /* INT16 CountNumberOfItemsInStoreInventory( UINT8 ubArmsDealerID ) { UINT16 cnt; INT16 ubNumItems=0; STORE_INVENTORY *pInventoryArray; pInventoryArray = GetPtrToStoreInventory( ubArmsDealerID ); if( pInventoryArray == NULL ) return( -1 ); for( cnt=0; cnt<MAXITEMS; cnt++ ) { if( pInventoryArray[cnt].ubQtyOnHand > 0 ) ubNumItems++; } return( ubNumItems ); } */ //////////////////////////////////////////////////// //////////////////////////////////////////////////// //////////////////////////////////////////////////// ////////////////////////////////////////////////////
[ "jazz_ja@b41f55df-6250-4c49-8e33-4aa727ad62a1" ]
[ [ [ 1, 922 ] ] ]
47907f1957e6c596f9910ed266bdc64f91813729
28aa891f07cc2240c771b5fb6130b1f4025ddc84
/extern/oolua/include/oolua_userdata.h
9b3fa18afe0272a573a1ebb8a32dbd4bd6c7dab4
[ "MIT" ]
permissive
Hincoin/mid-autumn
e7476d8c9826db1cc775028573fc01ab3effa8fe
5271496fb820f8ab1d613a1c2355504251997fef
refs/heads/master
2021-01-10T19:17:01.479703
2011-12-19T14:32:51
2011-12-19T14:32:51
34,730,620
0
0
null
null
null
null
UTF-8
C++
false
false
954
h
#ifndef OOLUA_USERDATA_H_ # define OOLUA_USERDATA_H_ #include <cstring> #include "lua_ref.h" namespace OOLUA { namespace INTERNAL { struct Lua_ud { void* void_class_ptr; char* name; char* none_const_name;//none constant name of the class int name_size;//size of name bool gc;//should it be garbage collected //Lua_table_ref mt;//meta_table Lua_ud_ref ud;//reference to self; void release(){ud.~Lua_ud_ref();} }; inline bool id_is_const(Lua_ud* ud) { return ud->name != ud->none_const_name; } #ifdef UNSAFE_ID_COMPARE inline bool ids_equal(char* lhsName,int /*lhsSize*/,char* rhsName,int /*rhsSize*/) { return lhsName == rhsName; } #else inline bool ids_equal(char* lhsName,int lhsSize,char* rhsName,int rhsSize) { if(lhsSize != rhsSize)return false; return memcmp(lhsName,rhsName,lhsSize) == 0; } #endif } } #endif
[ "luozhiyuan@ea6f400c-e855-0410-84ee-31f796524d81" ]
[ [ [ 1, 39 ] ] ]
7bbfcb01c2bdcf5af40cd2fcacfabd0525f26e8d
478570cde911b8e8e39046de62d3b5966b850384
/apicompatanamdw/bcdrivers/os/ossrv/stdlibs/apps/libc/testwideapis/src/twideapis.cpp
f84a1e6c4853a44f49bf784494910a3805b78c6b
[]
no_license
SymbianSource/oss.FCL.sftools.ana.compatanamdw
a6a8abf9ef7ad71021d43b7f2b2076b504d4445e
1169475bbf82ebb763de36686d144336fcf9d93b
refs/heads/master
2020-12-24T12:29:44.646072
2010-11-11T14:03:20
2010-11-11T14:03:20
72,994,432
0
0
null
null
null
null
UTF-8
C++
false
false
4,846
cpp
/* * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: * */ // INCLUDE FILES #include "twideapis.h" CTestWideApi::~CTestWideApi() { } CTestWideApi::CTestWideApi(const TDesC& aStepName) { // MANDATORY Call to base class method to set up the human readable name for logging. SetTestStepName(aStepName); } TVerdict CTestWideApi::doTestStepPreambleL() { __UHEAP_MARK; SetTestStepResult(EPass); return TestStepResult(); } TVerdict CTestWideApi::doTestStepPostambleL() { __UHEAP_MARKEND; return TestStepResult(); } TVerdict CTestWideApi::doTestStepL() { int err; if(TestStepName() == Kwfreopen_val) { INFO_PRINTF1(_L("wfreopen_val():")); err = wfreopen_val(); SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); } else if(TestStepName() == Kwfreopen_valm) { INFO_PRINTF1(_L("wfreopen_valm():")); err = wfreopen_valm(); SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); } else if(TestStepName() == Kwfreopen_valinv) { INFO_PRINTF1(_L("wfreopen_valinv():")); err = wfreopen_valinv(); SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); } else if(TestStepName() == Kwfdopen_val) { INFO_PRINTF1(_L("wfdopen_val():")); err = wfdopen_val(); SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); } else if(TestStepName() == Kwfdopen_ivalm) { INFO_PRINTF1(_L("wfdopen_ivalm():")); err = wfdopen_ivalm(); SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); } else if(TestStepName() == Kgetws_val) { INFO_PRINTF1(_L("getws_val():")); err = getws_val(); SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); } else if(TestStepName() == Kgetws_null) { INFO_PRINTF1(_L("getws_null():")); err = getws_null(); SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); } else if(TestStepName() == Kputws_val1) { INFO_PRINTF1(_L("putws_val1():")); err = putws_val1(); SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); } else if(TestStepName() == Kputws_val2) { INFO_PRINTF1(_L("putws_val2():")); err = putws_val2(); SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); } else if(TestStepName() == Kputws_null) { INFO_PRINTF1(_L("putws_null():")); err = putws_null(); SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); } else if(TestStepName() == Kwremove_val1) { INFO_PRINTF1(_L("wremove_val1():")); err = wremove_val1(); SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); } else if(TestStepName() == Kwremove_val2) { INFO_PRINTF1(_L("wremove_val2():")); err = wremove_val2(); SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); } else if(TestStepName() == Kwremove_val3) { INFO_PRINTF1(_L("wremove_val3():")); err = wremove_val3(); SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); } else if(TestStepName() == Kwremove_null) { INFO_PRINTF1(_L("wremove_null():")); err = wremove_null(); SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); } else if(TestStepName() == Kwfdopen_ivalm1) { INFO_PRINTF1(_L("wfdopen_ivalm1():")); err = wfdopen_ivalm1(); SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); } else if(TestStepName() == Kwpopen_1) { INFO_PRINTF1(_L("wpopen_1():")); err = wpopen_1(); SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); } return TestStepResult(); }
[ "none@none" ]
[ [ [ 1, 170 ] ] ]
628320444576e2bc8e5290c474aa72e9053c5b06
bec18a610cffcc9270d99e19539a8a74f773788a
/main.cpp
85cf50298609bfb1787c5136615e542a83f55561
[]
no_license
R-Lebowski/Scanner
8b0334eac7f1c578e968400f68940c430a89e8ed
e7f12237c2c4ebbcd001d7a38e7febf6aa4173ba
refs/heads/master
2021-01-22T23:49:06.054477
2010-10-05T22:08:23
2010-10-05T22:08:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,070
cpp
/* * main.cpp * * Version: * 0.01.5 * * Previous Versions: * * 2010-09-29: 0.01.1 * 2010-09-28: 0.00.5 */ /** * Project Scanner: * This project will create a simple c++ scanner, * to be used later in completeing a c++ compiler for * CSIT-433. * * @author Josh Galofaro * @date 2010-09-29 */ #include <iostream> #include <fstream> #include <sstream> #include <string> #include <stdlib.h> using namespace std; /* enum states: All FSM states, including sbegin as the only accept state enum tokens: All FSM tokens to be considered */ enum states{ sif, sint, swhile, selse, sreturn, svoid }; enum tokens{ tplus, tminus, tstar, tdiv, tgreater, tlesser, tass, tnot, tsemi, toparam, tcparam, tobracket, tcbracket }; void tokenizer( string, int ); /** * Main: * Main will read in from the input file provided in the * command line and output two arrays, toutput and soutput * which will contain the proper set of tokens generated by * the input file and their corrisponding string. * * @author Josh Galofaro * * @date 2010-09-28 * * @param int argc Holds the size of the command line input * @param char argv[] Char array for the command line input * * @exception 101 Improper command line arguments submitted * @exception 102 File handle error, File not opened */ int main(int argc, char *argv[]) { const char * fName; //File name given by command line args int curLine = 0; //Keep track of where you are in the file cout << "Scanner activated..." << endl; /* Check command line: only the file name should be submitted */ try { if( argc != 2 ) { throw 101; //Exception 101, command line arguments not proper } else if( argc == 2 ) { fName = argv[1]; } } catch (int e) { cerr << "An exception occured in program: " << argv[0] << endl << "Error No. " << e << endl; exit( 1 ); } /* Check file: Throw exception if fails to open */ try { if( argc != 2 ) { throw 101; //Exception 101, command line arguments not proper } else if( argc == 2 ) { fName = argv[1]; } ifstream inputFile; //Data file inputFile.open( fName ); /* * 2010-09-28: To do here: * Enter a loop; * Read in one line per loop, * Pass that line into parse method, * Parse method will generate the tokens and * add them to their proper arrays. * End of file, exit the loop */ if( inputFile.is_open() ) { string line; //Holds a single line of the input file cout << "File stream has opened..." << endl; cout << "Tokenizer activated for:" << endl; while( !inputFile.eof() ) { curLine++; getline(inputFile, line); tokenizer( line, curLine ); } inputFile.close(); cout << "File stream closed..." << endl; } else { throw 102; //Error 102, File not opened } } catch (int e) { cerr << "An exception occured in program: " << argv[0] << endl << "Error No. " << e << endl; if( e == 101 ) { cerr << "Improper command line arguments" << endl; } else if( e == 102 ) { cerr << "File could not be found/opened" << endl; } exit( 1 ); } cout << "Scanner deactivated..." << endl; return 0; } /** * Tokenizer: * Tokenizer will accept a single line of the input file in a string, and * parse the string to generate the proper tokens. It will then dump the * generated tokens into the toutput array and their corrisponding string * into the soutput array. * * @author Josh Galofaro * * @date 2010-09-28 * * @param string xLine The given line from the input file * @param int lineNum Integer to keep track of which line we are in */ void tokenizer( string xLine, int lineNum ) { /* To do here in this bitch: * Take xLine and split it up into single characters, * Toss those mother fuckers into an array * character by character follow the FSM to generate each token * Hitting a white space or symbol signifies the end * of that particular token. Once created toss the token * into the toutput array, and grab that hoe of a string * and toss her into the soutput array where she belongs. * Delete the character array. * Have the string make me a sammach. */ cout << "Entering line " << lineNum << "..." << endl; int charSize = 50, strSize = 10, curSize = 0; string str; string * strArray = new string[strSize]; char ch; //Char to split the string with char * charArray = new char[charSize]; //Single character array istringstream iss(xLine, istringstream::in); /* Split the line into single words */ while( iss >> str ) { if( curSize >= strSize ) { strSize = strSize * 2; strArray = (string *)realloc( strArray, strSize); } strArray[curSize] = str; curSize++; } for( int i = 0; i < curSize; i++) { cout << strArray[i] << endl; } delete strArray; cout << "Leaving line " << lineNum << "..." << endl; }
[ [ [ 1, 4 ], [ 6, 81 ], [ 152, 181 ], [ 187, 189 ], [ 192, 192 ], [ 194, 194 ], [ 197, 198 ], [ 200, 202 ], [ 204, 206 ], [ 208, 210 ] ], [ [ 5, 5 ], [ 82, 151 ], [ 182, 186 ], [ 190, 191 ], [ 193, 193 ], [ 195, 196 ], [ 199, 199 ], [ 203, 203 ], [ 207, 207 ] ] ]
27c07a11921d9820172bf651d1d6488686f6e3ef
df5277b77ad258cc5d3da348b5986294b055a2be
/ChatServer/WindowsLibrary/Console.cpp
620be9db0349511d2ba30061872084de50933e1f
[]
no_license
beentaken/cs260-last2
147eaeb1ab15d03c57ad7fdc5db2d4e0824c0c22
61b2f84d565cc94a0283cc14c40fb52189ec1ba5
refs/heads/master
2021-03-20T16:27:10.552333
2010-04-26T00:47:13
2010-04-26T00:47:13
null
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
2,776
cpp
/**************************************************************************************************/ /*! @file Console.cpp @author Robert Onulak @author Justin Keane @par email: robert.onulak@@digipen.edu @par email: justin.keane@@digipen.edu @par Course: CS260 @par Assignment #3 ---------------------------------------------------------------------------------------------------- @attention © Copyright 2010: DigiPen Institute of Technology (USA). All Rights Reserved. */ /**************************************************************************************************/ #include "Console.hpp" #include <windows.h> #include <stdio.h> #include <fcntl.h> #include <io.h> #include <iostream> namespace { /**************************************************************************************************/ /**************************************************************************************************/ void Redirect( FILE *file, const char *mode, HANDLE handle ) { #pragma warning(push) #pragma warning( disable : 4311 ) // 'type cast' : pointer truncation from 'HANDLE' to 'long' int fileHandle = _open_osfhandle( (long)handle, _O_TEXT ); #pragma warning(pop) FILE *fp = _fdopen( fileHandle, mode ); *file = *fp; setvbuf( file, NULL, _IONBF, 0 ); } } /**************************************************************************************************/ /**************************************************************************************************/ void CreateConsole( void ) { const WORD MAX_CONSOLE_LINES = 500; // Allocate a console window for this application. AllocConsole(); CONSOLE_SCREEN_BUFFER_INFO coninfo; GetConsoleScreenBufferInfo( GetStdHandle( STD_OUTPUT_HANDLE ), &coninfo ); // Change the size of our buffer to give us a good amount of room for analyzing our output. coninfo.dwSize.Y = MAX_CONSOLE_LINES; SetConsoleScreenBufferSize( GetStdHandle( STD_OUTPUT_HANDLE ), coninfo.dwSize ); HANDLE output = GetStdHandle( STD_OUTPUT_HANDLE ); HANDLE input = GetStdHandle( STD_INPUT_HANDLE ); HANDLE error = GetStdHandle( STD_ERROR_HANDLE ); // Redirect STDOUT, STDIN and STDERR towards our newly allocated console window. Redirect( stdout, "w", output ); Redirect( stdin, "r", input ); Redirect( stderr, "w", error ); // Also direct cout, cin, cerr, clog, etc... to our console window as well. std::ios::sync_with_stdio(); } /**************************************************************************************************/ /**************************************************************************************************/ void RemoveConsole( void ) { FreeConsole(); }
[ "rziugy@af704e40-745a-32bd-e5ce-d8b418a3b9ef" ]
[ [ [ 1, 79 ] ] ]
6ba2b20a5693d0aea499d426280d65599edafbab
7b4c786d4258ce4421b1e7bcca9011d4eeb50083
/_统计专用/C++Primer中文版(第4版)/第一次-代码集合-20090414/第十一章 泛型算法/20090214_习题11.21_使用find寻找最有一个特定元素.cpp
509d4eb6007bb29787a616bf836c6eda7ec0b4ef
[]
no_license
lzq123218/guoyishi-works
dbfa42a3e2d3bd4a984a5681e4335814657551ef
4e78c8f2e902589c3f06387374024225f52e5a92
refs/heads/master
2021-12-04T11:11:32.639076
2011-05-30T14:12:43
2011-05-30T14:12:43
null
0
0
null
null
null
null
GB18030
C++
false
false
759
cpp
#include <iostream> #include <list> #include <iterator> #include <algorithm> using namespace std; int main() { list<int> ilst; int ival; cout << "Enter some integers(Ctrl+Z to end):" << endl; while (cin >> ival) ilst.push_back(ival); cin.clear(); /************错误的find用法 list<int>::iterator iter = find(ilst.end(), ilst.begin(), 0); **********************************************/ /******************正确的find用法***********/ list<int>::reverse_iterator r_iter = find(ilst.rbegin(), ilst.rend(), 0); cout << "\t*iter = " << *r_iter << endl; if (r_iter != ilst.rend()) cout << "element after the lase 0: " << *(--r_iter) << endl; else cout << "no element 0" << endl; return 0; }
[ "baicaibang@70501136-4834-11de-8855-c187e5f49513" ]
[ [ [ 1, 35 ] ] ]
be0628db977b6afecd5a311aa2350192574e837b
68bfdfc18f1345d1ff394b8115681110644d5794
/Examples/Example01/ModelGeosetGroup.h
19f65a6cd79b5952f7c4d0077f3a75244ce9623c
[]
no_license
y-gupta/glwar3
43afa1efe475d937ce0439464b165c745e1ec4b1
bea5135bd13f9791b276b66490db76d866696f9a
refs/heads/master
2021-05-28T12:20:41.532727
2010-12-09T07:52:12
2010-12-09T07:52:12
32,911,819
1
0
null
null
null
null
UTF-8
C++
false
false
1,288
h
#pragma once //+----------------------------------------------------------------------------- //| Included files //+----------------------------------------------------------------------------- #include "Misc.h" //+----------------------------------------------------------------------------- //| Pre-declared classes //+----------------------------------------------------------------------------- class MODEL_BASE; //+----------------------------------------------------------------------------- //| Model geoset group node structure //+----------------------------------------------------------------------------- struct MODEL_GEOSET_GROUP_NODE { MODEL_GEOSET_GROUP_NODE() { NodeId = INVALID_INDEX; } INT NodeId; REFERENCE<VOID*, MODEL_BASE*> Node; }; //+----------------------------------------------------------------------------- //| Model geoset group class //+----------------------------------------------------------------------------- class MODEL_GEOSET_GROUP { public: CONSTRUCTOR MODEL_GEOSET_GROUP(); DESTRUCTOR ~MODEL_GEOSET_GROUP(); VOID Clear(); INT MatrixListSize; SIMPLE_CONTAINER<MODEL_GEOSET_GROUP_NODE*> MatrixList; MATRIX4 Matrix; REFERENCE_OBJECT<VOID*, MODEL_GEOSET_GROUP*> VertexNodes; };
[ "sihan6677@deb3bc48-0ee2-faf5-68d7-13371a682d83" ]
[ [ [ 1, 48 ] ] ]
4b0bd97bbdf327fa0c778d44a1348c6d311490ae
188058ec6dbe8b1a74bf584ecfa7843be560d2e5
/GodDK/lang/Character.h
fc017cf852e70b247be5d55b6da67fadd57a6e10
[]
no_license
mason105/red5cpp
636e82c660942e2b39c4bfebc63175c8539f7df0
fcf1152cb0a31560af397f24a46b8402e854536e
refs/heads/master
2021-01-10T07:21:31.412996
2007-08-23T06:29:17
2007-08-23T06:29:17
36,223,621
0
0
null
null
null
null
UTF-8
C++
false
false
1,559
h
#ifndef _CLASS_GOD_LANG_CHARACTER_H #define _CLASS_GOD_LANG_CHARACTER_H #ifdef __cplusplus #include "lang/String.h" using namespace goddk::lang; namespace goddk { namespace lang { /*!\ingroup CXX_LANG_m */ class Character : public goddk::lang::Object, public virtual goddk::lang::Comparable<Character> { private: jchar _val; public: static const jchar MIN_VALUE; static const jchar MAX_VALUE; static const jchar MIN_HIGH_SURROGATE; static const jchar MAX_HIGH_SURROGATE; static const jchar MIN_LOW_SURROGATE; static const jchar MAX_LOW_SURROGATE; static const jchar MIN_SURROGATE; static const jchar MAX_SURROGATE; static const jint MIN_SUPPLEMENTARY_CODE_POINT; static const jint MIN_CODE_POINT; static const jint MAX_CODE_POINT; static const jint MIN_RADIX; static const jint MAX_RADIX; static String toString(jchar c) throw (); static bool isHighSurrogate(jchar ch) throw (); static bool isLowSurrogate(jchar ch) throw (); public: Character(jchar value) throw (); virtual ~Character() {} bool instanceof(const char* class_name)const throw() { if(strcmp("Character", class_name)== 0) return true; else return __super::instanceof(class_name); } virtual jint hashCode() const throw (); virtual jint compareTo(const Character& anotherCharacter) const throw (); virtual string toString() const throw (); }; typedef CSmartPtr<Character> CharacterPtr; } } #endif #endif
[ "soaris@46205fef-a337-0410-8429-7db05d171fc8" ]
[ [ [ 1, 63 ] ] ]
7db11d95d9c086aa2b46a832c0bc4f4d03155cec
741b36f4ddf392c4459d777930bc55b966c2111a
/incubator/happylib/HappyLib/LWPSurfaceOptions.h
9eec2934178481aa70ac96b59bd15ca7c933fc2b
[]
no_license
BackupTheBerlios/lwpp-svn
d2e905641f60a7c9ca296d29169c70762f5a9281
fd6f80cbba14209d4ca639f291b1a28a0ed5404d
refs/heads/master
2021-01-17T17:01:31.802187
2005-10-16T22:12:52
2005-10-16T22:12:52
40,805,554
0
0
null
null
null
null
UTF-8
C++
false
false
11,302
h
#ifndef _LWPSURFACEOPTIONS_H #define _LWPSURFACEOPTIONS_H #include "LWPShader.h" #define LWID_SERIAL_SFOP LWID_('S','F','O','P') #define LWID_SERIAL_SVOP LWID_('S','V','O','P') //// [DOCUMENTME] //// class LWPSurfaceData { public: Color color; double luminous; double diffuse; double specular; double mirror; double transparency; double eta; double glossiness; double translucency; double colorHL; double colorFL; double addTransparency; double difSharpness; LWPSurfaceData() : color(Color::Black()), luminous(0), diffuse(1), specular(0), mirror(0), transparency(0), eta(1), glossiness(0.4), translucency(0), colorHL(0), colorFL(0), addTransparency(0), difSharpness(1) {} LWPSurfaceData(LWPShaderAccess const * sa) : color(sa->color), luminous(sa->luminous), diffuse(sa->diffuse), specular(sa->specular), mirror(sa->mirror), transparency(sa->transparency), eta(sa->eta), glossiness(sa->roughness == 0.0 ? 0.0 : 1.0/sa->roughness), translucency(sa->translucency), colorHL(sa->colorHL), colorFL(sa->colorFL), addTransparency(sa->addTransparency), difSharpness(sa->difSharpness) {} void load(const LWPLoadState * s) { color = s->readColor(); luminous = s->readFP(); diffuse = s->readFP(); specular = s->readFP(); mirror = s->readFP(); transparency = s->readFP(); eta = s->readFP(); glossiness = s->readFP(); translucency = s->readFP(); colorHL = s->readFP(); colorFL = s->readFP(); addTransparency = s->readFP(); difSharpness = s->readFP(); } void save(const LWPSaveState * s) const { s->writeColor(color); s->writeFP(luminous); s->writeFP(diffuse); s->writeFP(specular); s->writeFP(mirror); s->writeFP(transparency); s->writeFP(eta); s->writeFP(glossiness); s->writeFP(translucency); s->writeFP(colorHL); s->writeFP(colorFL); s->writeFP(addTransparency); s->writeFP(difSharpness); } }; class LWPSurfaceOptions { public: LWPSurfaceData surface; int doColor; int doLuminous; int doDiffuse; int doSpecular; int doMirror; int doTransparency; int doEta; int doGlossiness; int doTranslucency; int doColorHL; int doColorFL; int doAddTransparency; int doDifSharpness; LWPSurfaceOptions() : doColor(0), doLuminous(0), doDiffuse(0), doSpecular(0), doMirror(0), doTransparency(0), doEta(0), doGlossiness(0), doTranslucency(0), doColorHL(0), doColorFL(0), doAddTransparency(0), doDifSharpness(0) {} void load(const LWPLoadState * s) { doColor = s->readI1(); doLuminous = s->readI1(); doDiffuse = s->readI1(); doSpecular = s->readI1(); doMirror = s->readI1(); doTransparency = s->readI1(); doEta = s->readI1(); doGlossiness = s->readI1(); doTranslucency = s->readI1(); doColorHL = s->readI1(); doColorFL = s->readI1(); doAddTransparency = s->readI1(); doDifSharpness = s->readI1(); surface.load(s); } void save(const LWPSaveState * s) const { s->writeI1(doColor); s->writeI1(doLuminous); s->writeI1(doDiffuse); s->writeI1(doSpecular); s->writeI1(doMirror); s->writeI1(doTransparency); s->writeI1(doEta); s->writeI1(doGlossiness); s->writeI1(doTranslucency); s->writeI1(doColorHL); s->writeI1(doColorFL); s->writeI1(doAddTransparency); s->writeI1(doDifSharpness); surface.save(s); } void alphaMix(LWPShaderAccess * sa, double alpha) const { if (doColor) sa->color = Lerp(sa->color, surface.color, alpha); if (doLuminous) sa->luminous = Lerp(sa->luminous, surface.luminous, alpha); if (doDiffuse) sa->diffuse = Lerp(sa->diffuse, surface.diffuse, alpha); if (doSpecular) sa->specular = Lerp(sa->specular, surface.specular, alpha); if (doMirror) sa->mirror = Lerp(sa->mirror, surface.mirror, alpha); if (doTransparency) sa->transparency = Lerp(sa->transparency, surface.transparency, alpha); if (doEta) sa->eta = Lerp(sa->eta, surface.eta, alpha); if (doGlossiness) sa->roughness = Lerp(sa->roughness, surface.glossiness == 0.0 ? 0.0 : 1.0/surface.glossiness, alpha); if (doTranslucency) sa->translucency = Lerp(sa->translucency, surface.translucency, alpha); if (doColorHL) sa->colorHL = Lerp(sa->colorHL, surface.colorHL, alpha); if (doColorFL) sa->colorFL = Lerp(sa->colorFL, surface.colorFL, alpha); if (doAddTransparency) sa->addTransparency = Lerp(sa->addTransparency, surface.addTransparency, alpha); if (doDifSharpness) sa->difSharpness = Lerp(sa->difSharpness, surface.difSharpness, alpha); } // serialization class class SerializationLWPSurfaceOptions : public LWPSerialization::Serialization { public: SerializationLWPSurfaceOptions(char const * c, void * v) : LWPSerialization::Serialization(c, v) {} virtual void load(LWPLoadState const * lState) { if (lState->readU4() != LWID_SERIAL_SFOP) return; ((LWPSurfaceOptions*)data)->load(lState); } virtual void save(LWPSaveState const * sState) const { sState->writeU4(LWID_SERIAL_SFOP); ((LWPSurfaceOptions*)data)->save(sState); } virtual void copy(LWPSerialization::Serialization const & from) { *(LWPSurfaceOptions*)data = *(LWPSurfaceOptions*)from.data; } }; operator LWPSerialization::Serialization () { return SerializationLWPSurfaceOptions("", this); } }; //// [DOCUMENTME] //// class LWPVSurfaceData { public: LWPVParm color; LWPVParm luminous; LWPVParm diffuse; LWPVParm specular; LWPVParm glossiness; LWPVParm mirror; LWPVParm transparency; LWPVParm eta; LWPVParm translucency; LWPVParm colorHL; LWPVParm colorFL; LWPVParm addTransparency; LWPVParm difSharpness; LWPVSurfaceData() {} LWPVSurfaceData(LWChanGroupID group, int texType = LWVPDT_NOTXTR, LWTxtrContextID context = 0) : color(LWVP_COLOR, group, "Color", Color::Black(), texType, context), luminous(LWVP_PERCENT, group, "Luminosity", 0.0, texType, context), diffuse(LWVP_PERCENT, group, "Diffuse", 1.0, texType, context), specular(LWVP_PERCENT, group, "Specularity", 0.0, texType, context), glossiness(LWVP_PERCENT, group, "Glossiness", 0.4, texType, context), mirror(LWVP_PERCENT, group, "Reflectivity", 0.0, texType, context), transparency(LWVP_PERCENT, group, "Transparency", 0.0, texType, context), eta(LWVP_FLOAT, group, "Refraction Index", 1.0, texType, context), translucency(LWVP_PERCENT, group, "Translucency", 0.0, texType, context), colorHL(LWVP_PERCENT, group, "Color Highlights", 0.0, texType, context), colorFL(LWVP_PERCENT, group, "Color Filter", 0.0, texType, context), addTransparency(LWVP_PERCENT, group, "Additive Transparency", 0.0, texType, context), difSharpness(LWVP_PERCENT, group, "Diffuse Sharpness", 1.0, texType, context) {} void load(const LWPLoadState * s) { color.load(s); luminous.load(s); diffuse.load(s); specular.load(s); mirror.load(s); transparency.load(s); eta.load(s); glossiness.load(s); translucency.load(s); colorHL.load(s); colorFL.load(s); addTransparency.load(s); difSharpness.load(s); } void save(const LWPSaveState * s) const { color.save(s); luminous.save(s); diffuse.save(s); specular.save(s); mirror.save(s); transparency.save(s); eta.save(s); glossiness.save(s); translucency.save(s); colorHL.save(s); colorFL.save(s); addTransparency.save(s); difSharpness.save(s); } }; class LWPVSurfaceOptions { public: LWPVSurfaceData surface; int doColor; int doLuminous; int doDiffuse; int doSpecular; int doMirror; int doTransparency; int doEta; int doGlossiness; int doTranslucency; int doColorHL; int doColorFL; int doAddTransparency; int doDifSharpness; LWPVSurfaceOptions() {} LWPVSurfaceOptions(LWChanGroupID group, int texType = LWVPDT_NOTXTR, LWTxtrContextID context = 0) : surface(group, texType, context), doColor(0), doLuminous(0), doDiffuse(0), doSpecular(0), doMirror(0), doTransparency(0), doEta(0), doGlossiness(0), doTranslucency(0), doColorHL(0), doColorFL(0), doAddTransparency(0), doDifSharpness(0) {} void load(const LWPLoadState * s) { doColor = s->readI1(); doLuminous = s->readI1(); doDiffuse = s->readI1(); doSpecular = s->readI1(); doMirror = s->readI1(); doTransparency = s->readI1(); doEta = s->readI1(); doGlossiness = s->readI1(); doTranslucency = s->readI1(); doColorHL = s->readI1(); doColorFL = s->readI1(); doAddTransparency = s->readI1(); doDifSharpness = s->readI1(); surface.load(s); } void save(const LWPSaveState * s) const { s->writeI1(doColor); s->writeI1(doLuminous); s->writeI1(doDiffuse); s->writeI1(doSpecular); s->writeI1(doMirror); s->writeI1(doTransparency); s->writeI1(doEta); s->writeI1(doGlossiness); s->writeI1(doTranslucency); s->writeI1(doColorHL); s->writeI1(doColorFL); s->writeI1(doAddTransparency); s->writeI1(doDifSharpness); surface.save(s); } void alphaMix(LWPShaderAccess * sa, double alpha) const { LWTime t = LWPRender::timeInfo->time; if (doColor) sa->color = Lerp(sa->color, surface.color.evaluateColor(t), alpha); if (doLuminous) sa->luminous = Lerp(sa->luminous, surface.luminous.evaluateFloat(t), alpha); if (doDiffuse) sa->diffuse = Lerp(sa->diffuse, surface.diffuse.evaluateFloat(t), alpha); if (doSpecular) sa->specular = Lerp(sa->specular, surface.specular.evaluateFloat(t), alpha); if (doGlossiness) sa->roughness = Lerp(sa->roughness, surface.glossiness.evaluateFloat(t) == 0.0 ? 0.0 : 1.0/surface.glossiness.evaluateFloat(t), alpha); if (doMirror) sa->mirror = Lerp(sa->mirror, surface.mirror.evaluateFloat(t), alpha); if (doTransparency) sa->transparency = Lerp(sa->transparency, surface.transparency.evaluateFloat(t), alpha); if (doEta) sa->eta = Lerp(sa->eta, surface.eta.evaluateFloat(t), alpha); if (doTranslucency) sa->translucency = Lerp(sa->translucency, surface.translucency.evaluateFloat(t), alpha); if (doColorHL) sa->colorHL = Lerp(sa->colorHL, surface.colorHL.evaluateFloat(t), alpha); if (doColorFL) sa->colorFL = Lerp(sa->colorFL, surface.colorFL.evaluateFloat(t), alpha); if (doAddTransparency) sa->addTransparency = Lerp(sa->addTransparency, surface.addTransparency.evaluateFloat(t), alpha); if (doDifSharpness) sa->difSharpness = Lerp(sa->difSharpness, surface.difSharpness.evaluateFloat(t), alpha); } // serialization class class SerializationLWPVSurfaceOptions : public LWPSerialization::Serialization { public: SerializationLWPVSurfaceOptions(char const * c, void * v) : LWPSerialization::Serialization(c, v) {} virtual void load(LWPLoadState const * lState) { if (lState->readU4() != LWID_SERIAL_SFOP) return; ((LWPVSurfaceOptions*)data)->load(lState); } virtual void save(LWPSaveState const * sState) const { sState->writeU4(LWID_SERIAL_SFOP); ((LWPVSurfaceOptions*)data)->save(sState); } virtual void copy(LWPSerialization::Serialization const & from) { *(LWPVSurfaceOptions*)data = *(LWPVSurfaceOptions*)from.data; } }; operator LWPSerialization::Serialization () { return SerializationLWPVSurfaceOptions("", this); } }; #endif
[ "lightwolf@dac1304f-7ce9-0310-a59f-f2d444f72a61" ]
[ [ [ 1, 367 ] ] ]
78c1f7f67b022481a238e016f6162f4cdcbff009
0033659a033b4afac9b93c0ac80b8918a5ff9779
/game/shared/so2/weapon_sobase_sniper.h
1a34e0055dca7c2a82cb46308b6a04eca540704d
[]
no_license
jonnyboy0719/situation-outbreak-two
d03151dc7a12a97094fffadacf4a8f7ee6ec7729
50037e27e738ff78115faea84e235f865c61a68f
refs/heads/master
2021-01-10T09:59:39.214171
2011-01-11T01:15:33
2011-01-11T01:15:33
53,858,955
1
0
null
null
null
null
UTF-8
C++
false
false
1,526
h
// Originally implemented by Stephen 'SteveUK' Swires for SO // It has since been modified to support SO2 // Thanks Steve =) #ifndef SO_WEAPON_BASE_SNIPER_H #define SO_WEAPON_BASE_SNIPER_H #include "cbase.h" #include "weapon_sobase.h" #ifdef CLIENT_DLL #define CWeaponSOBaseSniper C_WeaponSOBaseSniper #endif class CWeaponSOBaseSniper : public CWeaponSOBase { DECLARE_CLASS( CWeaponSOBaseSniper, CWeaponSOBase ); public: CWeaponSOBaseSniper( void ); DECLARE_NETWORKCLASS(); DECLARE_PREDICTABLE(); public: virtual void PrimaryAttack( void ); virtual float GetAccuracyModifier( void ); virtual const Vector& GetBulletSpread( void ) { static Vector cone; if ( m_bIsScoped ) cone = Vector( 0, 0, 0 ); // do not take bullet spread into account when scoped else cone = VECTOR_CONE_10DEGREES; // unscoped snipers are not at all accurate return cone; } // Weapon scope system virtual bool HasScope( void ) { return true; } // all snipers have a scope...right? virtual bool UnscopeAfterShot( void ) { return true; } // by default, unscope after shooting since most of our snipers (all at the time of typing this) are bolt-action virtual float GetScopeFOV( void ) { return 22.5f; } // zoomy zoomy! this is a sniper after all! virtual bool ShouldDrawCrosshair( void ) { return false; } // snipers don't have crosshairs for aiming, only scopes private: CWeaponSOBaseSniper( const CWeaponSOBaseSniper & ); }; #endif // SO_WEAPON_BASE_SNIPER_H
[ "MadKowa@ec9d42d2-91e1-33f0-ec5d-f2a905d45d61" ]
[ [ [ 1, 52 ] ] ]
470bcfe5f1eeb83714efc4f6039408214eb8515f
8b3f876f510a6d347c12703f284022f4e80896e9
/SSReadSettings.h
ac1677a66d8b117cd1b84162a81edb4180949d4d
[]
no_license
flexoid/SolarSystem
77bf43464666800da0ad526005cb3a1113cadb55
8ee0f4c773704cb47ce234dc87307f879d6b4990
refs/heads/master
2021-03-12T20:37:24.346466
2009-05-22T18:14:34
2009-05-22T18:14:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
149
h
#include <irrlicht.h> #include <windows.h> #include <string> std::string GetTexturesQuality(); char GetDirectXVersion(); bool GetScreenMode();
[ [ [ 1, 7 ] ] ]
bc9d1870cebe502fdbadc4c54c2a03fba04c4b89
1bd75b9c45c3d5d5af3a9c9ba84ab0d4ec1bfd8f
/ibTabCtrl.cpp
249efdcc783b2e3738ca1ed9ad3c8557f9bca24e
[]
no_license
nadernt/whistle-recognizer
168634eda147752fada31d1b4e073971a053b4bf
7f260f7ee38d9445e2f0806566bbc0ceb45d3986
refs/heads/master
2020-04-06T04:26:13.138539
2010-01-12T17:11:08
2017-02-23T12:22:25
82,922,754
1
0
null
null
null
null
UTF-8
C++
false
false
1,986
cpp
// ibTabCtrl.cpp : implementation file // #include "stdafx.h" #include "waveInFFT.h" #include "ibTabCtrl.h" #include ".\ibtabctrl.h" // CibTabCtrl IMPLEMENT_DYNAMIC(CibTabCtrl, CTabCtrl) CibTabCtrl::CibTabCtrl() { m_iCurSel = -1; } CibTabCtrl::~CibTabCtrl() { } BEGIN_MESSAGE_MAP(CibTabCtrl, CTabCtrl) ON_NOTIFY_REFLECT(NM_CLICK, OnNMClick) ON_WM_MOVE() // ON_WM_CREATE() END_MESSAGE_MAP() // CibTabCtrl message handlers void CibTabCtrl::OnNMClick(NMHDR *pNMHDR, LRESULT *pResult) { // TODO: Add your control notification handler code here int iTab; int iPaneCount=0; CRect r; iTab=GetCurSel(); CDialog *p; m_iCurSel=iTab; while(iPaneCount<TabPanes.GetCount()) { p = TabPanes.GetAt(iPaneCount); p->ShowWindow(SW_HIDE); iPaneCount++; } p = TabPanes.GetAt(m_iCurSel); GetWindowRect(r); p->SetWindowPos(&CWnd::wndBottom,r.left+3,r.top+25,r.Width()-7,r.Height()-30,SWP_SHOWWINDOW); p->ShowWindow(SW_SHOW); *pResult = 0; } void CibTabCtrl::AddTabPane(CString strCaption,CDialog * pDlg) { TabCaptions.Add(strCaption); TabPanes.Add(pDlg); TC_ITEM tci; tci.mask = TCIF_TEXT; tci.pszText = (LPSTR)(LPCTSTR)strCaption; tci.cchTextMax = strCaption.GetLength(); InsertItem((TabCaptions.GetCount()-1),&tci); } void CibTabCtrl::OnMove(int x, int y) { CTabCtrl::OnMove(x, y); CDialog *p; CRect r; if(m_iCurSel>-1) { p = TabPanes.GetAt(m_iCurSel); GetWindowRect(r); p->SetWindowPos(&CWnd::wndNoTopMost,r.left+3,r.top+25,r.Width()-7,r.Height()-30,SWP_SHOWWINDOW); p->ShowWindow(SW_SHOW); } } void CibTabCtrl::SetDefaultPane(int iPaneIndex) { CDialog *p; CRect r; m_iCurSel = iPaneIndex; if(iPaneIndex<TabPanes.GetCount()) { SetCurSel(iPaneIndex); p = TabPanes.GetAt(iPaneIndex); GetWindowRect(r); p->SetWindowPos(&CWnd::wndBottom,r.left+3,r.top+25,r.Width()-7,r.Height()-30,SWP_SHOWWINDOW); p->ShowWindow(SW_SHOW); } }
[ [ [ 1, 96 ] ] ]
89b3292bebb264aa2aa3887cc821e6e74574b0b6
e419dcb4a688d0c7b743c52c2d3c4c2edffc3ab8
/Reports/Week08/ParticleTracer.cpp
0c8dcc391f6e6bacc902dc21664ebb39336b83a4
[]
no_license
Jazzinghen/DTU-Rendering
d7f833c01836fadb4401133d8a5c17523e04bf49
b03692ce19d0ea765d61e88e19cd8113da99b7fe
refs/heads/master
2021-01-01T15:29:49.250365
2011-12-20T00:49:32
2011-12-20T00:49:32
2,505,173
0
0
null
null
null
null
UTF-8
C++
false
false
5,160
cpp
// 02562 Rendering Framework // Written by Jeppe Revall Frisvad, 2011 // Copyright (c) DTU Informatics 2011 #include <iostream> #include <vector> #include <optix_world.h> #include "HitInfo.h" #include "ObjMaterial.h" #include "mt_random.h" #include "ParticleTracer.h" #ifdef _OPENMP #include <omp.h> #endif using namespace std; using namespace optix; void ParticleTracer::build_maps(int no_of_caustic_particles, unsigned int max_no_of_shots) { // Retrieve light sources const vector<Light*>& lights = scene->get_lights(); if(lights.size() == 0) return; // Check requested photon counts if(no_of_caustic_particles > caustics.get_max_photon_count()) { cerr << "Requested no. of caustic particles exceeds the maximum no. of particles." << endl; no_of_caustic_particles = caustics.get_max_photon_count(); } // Choose block size int block = std::max(1, no_of_caustic_particles/100); // Shoot particles unsigned int nshots = 0; unsigned int caustics_done = no_of_caustic_particles == 0 ? 1 : 0; while(!caustics_done) { // Stop if we cannot find the desired number of photons. if(nshots >= max_no_of_shots) { cerr << "Unable to store enough particles." << endl; if(!caustics_done) caustics_done = nshots; break; } // Trace a block of photons at the time #pragma omp parallel for private(randomizer) for(int i = 0; i < block; ++i) { // Sample a light source unsigned int light_idx = static_cast<unsigned int>(lights.size()*mt_random()); while(light_idx == lights.size()) light_idx = static_cast<unsigned int>(lights.size()*mt_random()); // Shoot a particle from the sampled source trace_particle(lights[light_idx], caustics_done); } nshots += block; // Check particle counts if(!caustics_done && caustics.get_photon_count() >= no_of_caustic_particles) caustics_done = nshots; } cout << "Particles in caustics map: " << caustics.get_photon_count() << endl; // Finalize photon maps caustics.scale_photon_power(lights.size()/static_cast<float>(caustics_done)); caustics.balance(); } float3 ParticleTracer::caustics_irradiance(const HitInfo& hit, float max_distance, int no_of_particles) { return caustics.irradiance_estimate(hit.position, hit.shading_normal, max_distance, no_of_particles); } void ParticleTracer::draw_caustics_map() { caustics.draw(); } void ParticleTracer::trace_particle(const Light* light, const unsigned int caustics_done) { if(caustics_done) return; // Shoot a particle from the sampled source Ray r; HitInfo hit; hit.position.x = hit.position.y=hit.position.z=-4; hit.trace_depth=0; float3 phy; if(!light->emit(r, hit, phy)) { return; } // Forward from all specular surfaces while(scene->is_specular(hit.material) && hit.trace_depth < 500) { switch(hit.material->illum) { case 3: { // Forward from mirror surfaces here Ray r_out; HitInfo hit_out=hit; if(!trace_reflected(r,hit, r_out, hit_out)) return; r=r_out; hit=hit_out; } break; case 2: case 4: case 11: case 12: { // Forward from transparent surfaces here Ray r_out; HitInfo hit_out=hit; float R; if(!trace_refracted(r,hit, r_out, hit_out,R)) return; if((rand()%1000) < R*1000) { //reflection required if(!trace_reflected(r,hit,r_out, hit_out)) return; } if (hit.material->illum > 10){ float3 trans = expf(-get_transmittance(hit) * hit.dist); float avg = (trans.x + trans.y + trans.z) * 0.333333; if (rand()%1000 < avg*1000) { phy *= trans / avg; } else return; } r=r_out; hit=hit_out; break; } break; default: return; } //hit.trace_depth += 1; } // Store in caustics map at first diffuse surface if (hit.trace_depth > 0 && hit.trace_depth < 499) { caustics.store(phy,hit.position, -r.direction); } } float3 ParticleTracer::get_diffuse(const HitInfo& hit) const { const ObjMaterial* m = hit.material; return m ? make_float3(m->diffuse[0], m->diffuse[1], m->diffuse[2]) : make_float3(0.8f); } float3 ParticleTracer::get_transmittance(const HitInfo& hit) const { float3 transmittance; transmittance = make_float3(1.0f); if(hit.material) { // Compute and return the transmittance using the diffuse reflectance of the material. // Diffuse reflectance rho_d does not make sense for a specular material, so we can use // this material property as an absorption coefficient. Since absorption has an effect // opposite that of reflection, using 1/rho_d-1 makes it more intuitive for the user. float3 rho_d = make_float3( hit.material->diffuse[0] , hit.material->diffuse[1] , hit.material->diffuse[2]); rho_d = (1.0/rho_d) - 1; transmittance = rho_d; } return transmittance; }
[ [ [ 1, 181 ] ] ]
40b0e31afac6e072cc624de3631e4171fc86e853
28aa23d9cb8f5f4e8c2239c70ef0f8f6ec6d17bc
/mytesgnikrow --username hotga2801/DoAnBaoMat/module exaple/AccountMgr/Login/UserUtils.cpp
a26ec91f05288bb900acf3b09417522893f57684
[]
no_license
taicent/mytesgnikrow
09aed8836e1297a24bef0f18dadd9e9a78ec8e8b
9264faa662454484ade7137ee8a0794e00bf762f
refs/heads/master
2020-04-06T04:25:30.075548
2011-02-17T13:37:16
2011-02-17T13:37:16
34,991,750
0
0
null
null
null
null
UTF-8
C++
false
false
6,043
cpp
#include "stdafx.h" #include "UserUtils.h" #include "Lm.h" UserUtilities::UserUtilities() { } UserUtilities::~UserUtilities() { } //Authentication bool UserUtilities::LoginUser(CString userName, CString userPass, HANDLE &hToken) { BOOL res = LogonUser(userName, TEXT("."), userPass, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, &hToken); return res; } bool UserUtilities::ImpersonateLoginUser(HANDLE hToken) { BOOL res = ImpersonateLoggedOnUser(hToken); return res; } bool UserUtilities::RevertToMainUser() { return RevertToSelf(); } //Group management bool UserUtilities::CreateGroup(Group *group) { LOCALGROUP_INFO_1* grp = new LOCALGROUP_INFO_1(); grp->lgrpi1_name = group->m_StrGroupName.GetBuffer(); grp->lgrpi1_comment = group->m_StrDescription.GetBuffer(); int res = NetLocalGroupAdd(NULL, 1, (LPBYTE)grp, NULL); if(res == 0) return true; return false; } std::vector<Group*> UserUtilities::GetGroupList() { std::vector<Group*> lstGroups; LOCALGROUP_INFO_1* grpInfo = NULL; LOCALGROUP_INFO_1* tempgrpInfo; DWORD entriesRead = 0; DWORD totalEntries = 0; DWORD resume = 0; int res = NetLocalGroupEnum(NULL, 1, (LPBYTE*)&grpInfo, -1, &entriesRead, &totalEntries, &resume); if(entriesRead > 0) { tempgrpInfo = grpInfo; for(int i = 0;i < entriesRead;i++) { Group* grp = new Group(); grp->m_StrGroupName = tempgrpInfo->lgrpi1_name; grp->m_StrDescription = tempgrpInfo->lgrpi1_comment; lstGroups.push_back(grp); tempgrpInfo++; } } if(grpInfo) { NetApiBufferFree(grpInfo); grpInfo = NULL; } return lstGroups; } std::vector<Group*> UserUtilities::GetUserGroupList(CString strUserName) { std::vector<Group*> lstUserGroups; LOCALGROUP_USERS_INFO_0 *grpInfo = NULL; LOCALGROUP_USERS_INFO_0 *tempgrpInfo = NULL; DWORD entriesRead = 0; DWORD totalEntries = 0; int res = NetUserGetLocalGroups(NULL, strUserName, 0, 0, (LPBYTE*)&grpInfo, MAX_PREFERRED_LENGTH, &entriesRead, &totalEntries); if(entriesRead > 0) { tempgrpInfo = grpInfo; for(int i = 0;i < entriesRead;i++) { Group* grp = new Group(); grp->m_StrGroupName = tempgrpInfo->lgrui0_name; lstUserGroups.push_back(grp); tempgrpInfo++; } } if(grpInfo) { NetApiBufferFree(grpInfo); grpInfo = NULL; } return lstUserGroups; } bool UserUtilities::DeleteGroup(Group* group) { int res = NetLocalGroupDel(NULL, group->m_StrGroupName); if(res == 0) return true; return false; } bool UserUtilities::ChangeGroupInfo(CString strGroupName, Group* group) { LOCALGROUP_INFO_1* groupInfo = new LOCALGROUP_INFO_1(); groupInfo->lgrpi1_name = group->m_StrGroupName.GetBuffer(); groupInfo->lgrpi1_comment = group->m_StrDescription.GetBuffer(); int res = NetLocalGroupSetInfo(NULL, strGroupName, 1, (LPBYTE)groupInfo, NULL); if(res == 0) return true; return false; } //Account management bool UserUtilities::CreateAccount(Account *account) { USER_INFO_1 *userInfo = new USER_INFO_1(); userInfo->usri1_name = account->m_StrUserName.GetBuffer(); userInfo->usri1_password = account->m_StrPassword.GetBuffer(); userInfo->usri1_priv = USER_PRIV_USER; userInfo->usri1_home_dir = NULL; userInfo->usri1_comment = account->m_StrDescription.GetBuffer(); userInfo->usri1_flags = UF_SCRIPT; userInfo->usri1_script_path = NULL; DWORD errCode; DWORD res = NetUserAdd(NULL, 1, (LPBYTE)userInfo, &errCode); if(res == 0) { return true; } return false; } #define chDIMOF(Array) (sizeof(Array) / sizeof(Array[0])) std::vector<Account*> UserUtilities::GetAccountList() { std::vector<Account*> lstAccount; USER_INFO_2* user = NULL; USER_INFO_2* tempuser; DWORD level = 2; DWORD filter = 2; BYTE* iAccountNum; DWORD iEntriesRead = 0; DWORD iTotalEntries = 0; DWORD iResume = 0; int iRes = NetUserEnum(NULL, level, filter, (LPBYTE*)&user, -1, &iEntriesRead, &iTotalEntries, &iResume); tempuser = user; for(int i = 0;i < iEntriesRead;i++) { Account* acc = new Account(); acc->m_StrUserName = tempuser->usri2_name; acc->m_StrFullName = tempuser->usri2_full_name; acc->m_StrDescription = tempuser->usri2_comment; acc->iType = tempuser->usri2_priv; lstAccount.push_back(acc); tempuser++; } if (user != NULL) { NetApiBufferFree(user); user = NULL; } return lstAccount; } bool UserUtilities::DeleteAccount(Account* account) { DWORD res = NetUserDel(NULL, account->m_StrUserName); if(res == 0) { return true; } else { return false; } return true; } bool UserUtilities::ChangeAccountInfo(Account* account) { USER_INFO_2 *userInfo = new USER_INFO_2(); DWORD error = 0; DWORD level; DWORD res; int getRes = NetUserGetInfo(NULL, account->m_StrUserName, 2, (LPBYTE*)&userInfo); if(getRes != 0) { return false; } else { userInfo->usri2_full_name = account->m_StrFullName.GetBuffer(); userInfo->usri2_password = account->m_StrPassword.GetBuffer(); userInfo->usri2_comment = account->m_StrDescription.GetBuffer(); res = NetUserSetInfo(NULL, account->m_StrUserName, 2, (LPBYTE)userInfo, &error); if(res == 0) { return true; } else { return false; } } return true; } bool UserUtilities::AddUserToGroup(CString strUserName, CString strGroupName) { LOCALGROUP_MEMBERS_INFO_3 *group = new LOCALGROUP_MEMBERS_INFO_3(); group->lgrmi3_domainandname = strUserName.GetBuffer(); int res = NetLocalGroupAddMembers(NULL, strGroupName, 3, (LPBYTE)group, 1); if(res == 0) { return true; } return false; } bool UserUtilities::RemoveUserToGroup(CString strUserName, CString strGroupName) { LOCALGROUP_MEMBERS_INFO_3 *group = new LOCALGROUP_MEMBERS_INFO_3(); group->lgrmi3_domainandname = strUserName.GetBuffer(); int res = NetLocalGroupDelMembers(NULL, strGroupName, 3, (LPBYTE)group, 1); if(res == 0) { return true; } return false; }
[ "hotga2801@ecd9aaca-b8df-3bf4-dfa7-576663c5f076" ]
[ [ [ 1, 257 ] ] ]
9a8a6671689c30d635fd59fbf41a306c6f3c8f7c
478570cde911b8e8e39046de62d3b5966b850384
/apicompatanamdw/bcdrivers/mw/classicui/uifw/apps/S60_SDK3.0/bctestcmdlg/src/bctestcmdlgcase.cpp
97b219f2cdec1115b5f6e139e7886903755b8c9e
[]
no_license
SymbianSource/oss.FCL.sftools.ana.compatanamdw
a6a8abf9ef7ad71021d43b7f2b2076b504d4445e
1169475bbf82ebb763de36686d144336fcf9d93b
refs/heads/master
2020-12-24T12:29:44.646072
2010-11-11T14:03:20
2010-11-11T14:03:20
72,994,432
0
0
null
null
null
null
UTF-8
C++
false
false
7,219
cpp
/* * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: test case * */ #include <w32std.h> #include <coecntrl.h> #include "BCTestCmDlgcase.h" #include "BCTestCmDlgcontainer.h" #include "BCTestCmDlg.hrh" #include "streamlogger.h" // ======== MEMBER FUNCTIONS ======== // --------------------------------------------------------------------------- // Symbian 2nd static Constructor // --------------------------------------------------------------------------- // CBCTestCmDlgCase* CBCTestCmDlgCase::NewL() { CBCTestCmDlgCase* self = new( ELeave ) CBCTestCmDlgCase(); CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop( self ); return self; } // --------------------------------------------------------------------------- // C++ default constructor // --------------------------------------------------------------------------- // CBCTestCmDlgCase::CBCTestCmDlgCase():iDlg(0) { } // --------------------------------------------------------------------------- // Destructor // --------------------------------------------------------------------------- // CBCTestCmDlgCase::~CBCTestCmDlgCase() { delete iDlg; } // --------------------------------------------------------------------------- // Symbian 2nd Constructor // --------------------------------------------------------------------------- // void CBCTestCmDlgCase::ConstructL() { BuildScriptL(); } // --------------------------------------------------------------------------- // CBCTestCmDlgCase::BuildScriptL // --------------------------------------------------------------------------- // void CBCTestCmDlgCase::BuildScriptL() { // Add script as your need. AddTestL( DELAY(1), TEND); for(int i=0; i<EBCTestCmdMemSelDlgEnd - EBCTestCmdMemSelDlgBegin -1; ++i) { AddTestL( LeftCBA, Right, TEND ); for(int j=0; j<i; ++j) AddTestL( Down, TEND); AddTestL( LeftCBA, TEND ); AddOKL(); } } void CBCTestCmDlgCase::AddOKL() { // add dlg response sciprts for(int i=0; i<1; ++i) AddTestL( WAIT(5), KeyOK, TEND); } void CBCTestCmDlgCase::AddCancelL() { // add dlg response sciprts for(int i=0; i<1; ++i) AddTestL( WAIT(5), RightCBA, TEND); } // --------------------------------------------------------------------------- // CBCTestCmDlgCase::RunL // --------------------------------------------------------------------------- // void CBCTestCmDlgCase::RunL( TInt aCmd ) { SetupL(); switch(aCmd){ case EBCTestCmdMemSelDlgCreate: TestCreateL(); break; case EBCTestCmdMemSelDlgCreateWithRes: TestCreateL(0); //0 indicate to default res break; case EBCTestCmdMemSelDlgWithRoot: TestWithRootL(); break; case EBCTestCmdMemSelDlgQuick: TestQuickCreateL(); break; case EBCTestCmdMemSelDlgQuickTitle: TestQuickCreateL(_L("a title")); break; case EBCTestCmdMemSelDlgQuickRes: TestQuickCreateL(0); //0 means default res break; case EBCTestCmdMemSelDlgSetting: TestSettingsL(); break; default: break; } Teardown(); } // --------------------------------------------------------------------------- // CBCTestCmDlgCase::ReleaseCaseL // --------------------------------------------------------------------------- // void CBCTestCmDlgCase::Teardown() { delete iDlg; iDlg = NULL; } void CBCTestCmDlgCase::TestCreateL() { iDlg = CAknMemorySelectionDialog::NewL( ECFDDialogTypeNormal, EFalse ); AssertNotNullL(iDlg, _L("mem sel dlg created")); AssertTrueL(iDlg->ExecuteL( iMemory ), _L("User Hit OK")); AssertIntL( CAknMemorySelectionDialog::EPhoneMemory, iMemory, _L("Phone memory created")); } void CBCTestCmDlgCase::TestCreateL(TInt aResID) { iDlg = CAknMemorySelectionDialog::NewL( ECFDDialogTypeNormal, aResID, EFalse ); AssertNotNullL(iDlg, _L("mem sel dlg with resID created")); AssertTrueL(CAknMemorySelectionDialog::RunDlgLD(iMemory), _L("Quick create, User hit OK")); AssertIntL( CAknMemorySelectionDialog::EPhoneMemory, iMemory, _L("Phone memroy created")); } void CBCTestCmDlgCase::TestQuickCreateL() { AssertTrueL(CAknMemorySelectionDialog::RunDlgLD(iMemory), _L("Quick create, User hit OK")); AssertIntL( CAknMemorySelectionDialog::EPhoneMemory, iMemory, _L("Phone memroy created")); } void CBCTestCmDlgCase::TestQuickCreateL(const TDesC &aTitle) { AssertTrueL(CAknMemorySelectionDialog::RunDlgLD(iMemory, aTitle), _L("Quick create with title, User hit OK")); AssertIntL( CAknMemorySelectionDialog::EPhoneMemory, iMemory, _L("Phone memroy created")); } void CBCTestCmDlgCase::TestQuickCreateL(TInt aResID) { AssertTrueL(CAknMemorySelectionDialog::RunDlgLD(iMemory, aResID), _L("Quick create with ResID, User hit OK")); AssertIntL( CAknMemorySelectionDialog::EPhoneMemory, iMemory, _L("Phone memroy created")); } void CBCTestCmDlgCase::SetupL() { iMemory = CAknMemorySelectionDialog::EPhoneMemory; } void CBCTestCmDlgCase::TestWithRootL() { _LIT( KRootPath, "C:\\Nokia\\Images\\" ); _LIT( KDefaultFileName, "DynamicFilename.jpg" ); TFileName rootFileName( KRootPath ); TFileName defaultFileName( KDefaultFileName ); iDlg = CAknMemorySelectionDialog::NewL( ECFDDialogTypeNormal, EFalse ); if(TInt res = iDlg->ExecuteL(iMemory, &rootFileName, &defaultFileName)) { TFileName msg(_L("default root: ")); msg.Append(rootFileName); msg.Append(_L(" default file: ")); msg.Append(defaultFileName); msg.ZeroTerminate(); AssertTrueL(res, msg); } } void CBCTestCmDlgCase::TestSettingsL() { iDlg = CAknMemorySelectionDialog::NewL( ECFDDialogTypeNormal, EFalse ); iDlg->SetObserver(NULL); AssertTrueL(ETrue, _L("Null Observer set")); iDlg->SetTitleL(_L("a title")); AssertTrueL(ETrue, _L("title set")); iDlg->SetLeftSoftkeyL(_L("left key")); AssertTrueL(ETrue, _L("left key text set")); iDlg->SetRightSoftkeyL(_L("right key")); AssertTrueL(ETrue, _L("right key text set")); if(iDlg->ExecuteL(iMemory)) { //get TFileName emptyFileName( KNullDesC ); iDlg->GetItem( iMemory, emptyFileName ); TFileName msg(_L("item got: ")); msg.Append(emptyFileName); msg.ZeroTerminate(); AssertTrueL(ETrue, msg); _LIT( KRootPath, "C:\\Nokia\\Images\\" ); _LIT( KDefaultFileName, "DynamicFilename.jpg" ); TFileName rootFileName( KRootPath ); TFileName defaultFileName( KDefaultFileName ); iDlg->GetMemories(iMemory, &rootFileName, &defaultFileName); msg = (_L("memory got, root: ")); msg.Append(rootFileName); msg.Append(_L(" default file: ")); msg.Append(defaultFileName); msg.ZeroTerminate(); AssertTrueL(ETrue, msg); } } // EOF
[ "none@none" ]
[ [ [ 1, 247 ] ] ]
4e4bc1f93f135d966a65b1c181502086b40a78d2
91b964984762870246a2a71cb32187eb9e85d74e
/SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/libs/wave/test/testwave/testfiles/t_2_006.cpp
96c920ab1109ea0bd2818ea6bc21d7e3aba31250
[ "BSL-1.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
willrebuild/flyffsf
e5911fb412221e00a20a6867fd00c55afca593c7
d38cc11790480d617b38bb5fc50729d676aef80d
refs/heads/master
2021-01-19T20:27:35.200154
2011-02-10T12:34:43
2011-02-10T12:34:43
32,710,780
3
0
null
null
null
null
UTF-8
C++
false
false
963
cpp
/*============================================================================= Boost.Wave: A Standard compliant C++ preprocessor library http://www.boost.org/ Copyright (c) 2001-2006 Hartmut Kaiser. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ // Tests correctness of macro expansion inside #pragma directives #define PRAGMA_BODY preprocessed pragma body //R #line 16 "t_2_006.cpp" //R #pragma some pragma body #pragma some pragma body //R #line 19 "t_2_006.cpp" //R #pragma preprocessed pragma body #pragma PRAGMA_BODY //R #line 22 "t_2_006.cpp" //R #pragma STDC some C99 standard pragma body #pragma STDC some C99 standard pragma body //R #line 25 "t_2_006.cpp" //R #pragma STDC preprocessed pragma body #pragma STDC PRAGMA_BODY
[ "[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278" ]
[ [ [ 1, 25 ] ] ]
3a936da0543cb1f502b6c5ff9561e6a93e80d03a
291355fd4592e4060bca01383e2c3a2eff55bd58
/src/cprapp.cpp
423835485063070c3bbfb5c59d9cc5544131dea2
[]
no_license
rrader/cprompt
6d7c9aac25d134971bbf99d4e84848252a626bf3
dfb7d55111b6e8d3c3a0a0a1c703c04a58d5e808
refs/heads/master
2020-05-16T22:06:16.127336
2010-01-23T21:33:04
2010-01-23T21:33:04
1,659,726
1
1
null
null
null
null
UTF-8
C++
false
false
44,450
cpp
#include <stdio.h> #include <stdlib.h> #include <sstream> #ifdef WIN32 #include <windows.h> #else #include <dlfcn.h> #endif #include "lists.h" #include "stringlist.h" #include "cprapp.h" #include "cprtypes.h" #include "cprexec.h" extern int argc; extern char** argv; extern int argnum; void CPRApplication::SetText(char* sText) { iSize=strlen(sText); sPText=new char[iSize+1]; strcpy(sPText,sText); sPText[iSize]=0; } void CPRApplication::SetFile(char* sName) { std::ifstream file; file.open (sName, std::ios::binary ); file.seekg (0, std::ios::end); int length = file.tellg(); file.seekg (0, std::ios::beg); sPText=new char[length+1]; file.read(sPText,length); sPText[length]=0; file.close(); int tmp=strlen(sName); sFilePath=new char[tmp+1]; strcpy(sFilePath,sName); sFilePath[tmp]=0; sWorkDir=new char[strlen(sName)+1]; strcpy(sWorkDir,sName); sWorkDir[strlen(sName)]=0; while((sWorkDir[strlen(sWorkDir)-1]!='/')&&(strlen(sWorkDir)>0)) sWorkDir[strlen(sWorkDir)-1]=0; } char* CPRApplication::GetFileText(char* sFName) { char* res; std::ifstream file; file.open (sFName, std::ios::binary ); file.seekg (0, std::ios::end); int length = file.tellg(); file.seekg (0, std::ios::beg); res=new char[length+1]; file.read(res,length); res[length]=0; file.close(); return res; } void CPRApplication::ParseIt(ag::list<CPRTokenInfo>* pTok,char* sText,bool bReadEoln, bool bReadSpaces, bool bReadQStr) { char* psText; if (sText==NULL) { psText=sPText; }else { psText=sText; } CPRParser cParser(psText); cParser.SetReadEOLN(bReadEoln); cParser.SetReadSpaces(bReadSpaces); cParser.SetReadQuotedStrings(bReadQStr); CPRTokenInfo i; ag::list<CPRTokenInfo>*pTokens; if (pTok!=NULL) pTokens=pTok; else pTokens=&aTokens; cParser.Next(); while (cParser.NowType()!=petEOF) { i=*(cParser.GetInfo()); pTokens->add_tail(i); cParser.Next(); } } DTVar* CPRApplication::FindVariable(char* sName, ag::list<DTVar*>* local) { char* s; if (local!=NULL) { for(ag::list<DTVar*>::member i=local->tail;i!=NULL;i=i->prev) { s=((DTMain*)(((DTVar*)i->data)->T))->sIdent; if (strcmp(s,sName)==0) { return i->data; break; } } } for(ag::list<DTVar*>::member i=aVars.tail;i!=NULL;i=i->prev) { s=((DTMain*)(((DTVar*)i->data)->T))->sIdent; if (strcmp(s,sName)==0) { return i->data; break; } } return NULL; } char* CPRApplication::ReadTypename(ag::list<CPRTokenInfo>::member& p) { if (debugmode) std::cout<<"CPRApplication::ReadTypename\n"; ag::stringlist sl; ag::stringlist::member sl_m; sl_m=aTypenames->findstr(p->data.sCurrText); sl.delall(); while(sl_m!=NULL) { sl.addstr(p->data.sCurrText); if (debugmode) std::cout<<"part of type (): '"<<p->data.sCurrText<<"'\n"; p=p->next; sl_m=aTypenames->findstr(p->data.sCurrText); }; p=p->prev; int iSz=0; for(sl_m=sl.head;sl_m!=NULL;sl_m=sl_m->next) iSz+=strlen(sl_m->data)+1; iSz--; char* str=new char[iSz+1]; int iSz2=0; for(sl_m=sl.head;sl_m!=NULL;sl_m=sl_m->next) { for(int i=0;i<strlen(sl_m->data);i++) str[i+iSz2]=sl_m->data[i]; iSz2+=strlen(sl_m->data)+1; str[iSz2-1]=' '; } str[iSz]=0; if (debugmode) std::cout<<"Typename: "<<str<<"\n"; return str; } bool CPRApplication::IsTypename(ag::list<CPRTokenInfo>::member p) { return (((aTypenames->findstr(p->data.sCurrText))!=NULL)&&((aTypenamesExclude->findstr(p->data.sCurrText))==NULL)); } char* CPRApplication::ReadToSymbol(ag::list<CPRTokenInfo>::member& p,char _symb,bool makespaces) { ag::stringlist sl; do { sl.addstr(p->data.sCurrText); p=p->next; if (makespaces) sl.addstr(" "); }while((p->data.sCurrText[0]!=_symb)&&(p!=NULL)); return sl.makestrfromelements(); } char* CPRApplication::ReadIdent(ag::list<CPRTokenInfo>::member* p, char* FText) { if (debugmode) std::cout<<"CPRApplication::ReadIdent()\n"; CPRParser prs(FText,(*p)->data.iStartPos); int* E=new int; char* m = prs.ReadIdent(); //trim while(m[0]==' ')m++; while(m[strlen(m)-1]==' ')m[strlen(m)-1]=0; /* char* m2 = ((strcmp(m,"*")==0)||(strcmp(m,"&")==0))?prs.ReadIdent():NULL; if (m2!=NULL) strcat(m,m2);*/ while((*p)->data.iStartPos<prs.iPosition-1)(*p)=(*p)->next; (*p)=(*p)->prev; if (debugmode) std::cout<<"Ident: "<<m<<"\n"; return m; } char* CPRApplication::ReadToEOLN(ag::list<CPRTokenInfo>::member* p, char* FText)//!!!!!!!!!!!!!!!!! { CPRParser prs(FText,(*p)->data.iStartPos); char* m = prs.ReadToEOLN(); /* char* m2 = ((strcmp(m,"*")==0)||(strcmp(m,"&")==0))?prs.ReadIdent():NULL; if (m2!=NULL) strcat(m,m2);*/ while((*p)->data.iStartPos<prs.iPosition-1)(*p)=(*p)->next; (*p)=(*p)->prev; return m; } void CPRApplication::PreprocessIfDefs(char** saveto, char* sText, char* workdir) { // обработка: define, ifdef, ifndef, endif, elif //ag::tree<> pPpcsTree; ag::list<CPRTokenInfo>* pTok=new ag::list<CPRTokenInfo>; ag::list<StartEndStruct> StartEndList; CPRDefine dfn; ag::stack<DefStackElement> DefStack; ParseIt(pTok,sText,true,true); DefStackElement dse; dse.iPos=0; dse.Processing=true; DefStack.add_tail(dse); for(ag::list<CPRTokenInfo>::member p=pTok->head;(p!=NULL)&&(p->data.petCurrType!=petEOF);p=p->next) { if (p->data.sCurrText[0]=='#') { do p=p->next; while (p->data.sCurrText[0]==' '); if (DefStack.empty()||(DefStack.tail->data.Processing)) { if (strcmp(p->data.sCurrText,"define")==0) { do p=p->next; while (p->data.sCurrText[0]==' '); char* ident; ident=ReadIdent(&p,sText); if (p->data.sCurrText[0]=='(') dfn.dt=cdtMacro; else dfn.dt=cdtConst; if (dfn.dt==cdtConst) { dfn.params=NULL; dfn.name=ident; while (p->data.sCurrText[0]==' ') p=p->next; if (p->data.sCurrText[0]!='\n') { dfn.expr=ReadToEOLN(&p,sText); }else dfn.expr=NULL; } if (dfn.dt==cdtMacro) { // } bool replace=false; for(ag::list<CPRDefine>::member m=sDefines.head;m!=NULL;m=m->next) { if(strcmp(m->data.name,ident)==0) { m->data.dt=dfn.dt; m->data.params=dfn.params; m->data.expr=dfn.expr; replace=true; break; } } if (!replace) sDefines.add_tail(dfn); } if (strcmp(p->data.sCurrText,"undef")==0) { do p=p->next; while (p->data.sCurrText[0]==' '); std::string ident; while(sIdentSymbs%p->data.sCurrText[0]) { ident+=p->data.sCurrText; p=p->next; } for(ag::list<CPRDefine>::member m=sDefines.head;m!=NULL;m=m->next) { if(strcmp(m->data.name,ident.c_str())==0) { sDefines.del(m); break; } } } if ((strcmp(p->data.sCurrText,"ifdef")==0)||(strcmp(p->data.sCurrText,"ifndef")==0)) { //if (StartEndList.count()==1) {StartEndList.tail->data.end=p->data.iStartPos;}; StartEndStruct ses; ses.start=DefStack.tail->data.iPos; ses.end=p->prev->data.iStartPos; StartEndList.add_tail(ses); do p=p->next; while (p->data.sCurrText[0]==' '); char* ident; ident=ReadIdent(&p,sText); bool def=false; for(ag::list<CPRDefine>::member m=sDefines.head;m!=NULL;m=m->next) { if(strcmp(m->data.name,ident)==0) { def=true; break; } } DefStackElement dse; dse.iPos = p->data.iStartPos; if (strcmp(p->data.sCurrText,"ifdef")==0) dse.Processing=def; else dse.Processing=!def; DefStack.push(dse); } } if (strcmp(p->data.sCurrText,"else")==0) { DefStack.tail->data.Processing=!DefStack.tail->data.Processing; if (DefStack.tail->data.Processing) { DefStack.tail->data.iPos=p->data.iFinishPos; StartEndStruct ses; }else { StartEndStruct ses; ses.start=DefStack.tail->data.iPos; ses.end=p->prev->data.iStartPos; StartEndList.add_tail(ses); } do p=p->next; while (p->data.sCurrText[0]==' '); } if (strcmp(p->data.sCurrText,"endif")==0) { if (DefStack.tail->data.Processing) { StartEndStruct ses; ses.start=DefStack.tail->data.iPos; ses.end=p->prev->data.iStartPos; StartEndList.add_tail(ses); } do p=p->next; while (p->data.sCurrText[0]==' '); DefStack.pop(); DefStack.tail->data.iPos=p->prev->data.iFinishPos; } } } StartEndStruct ses; ses.start=DefStack.tail->data.iPos; ses.end=strlen(sText)-1; StartEndList.add_tail(ses); DefStack.pop(); if (!DefStack.empty()) throw "The count of #ifdef's and #endif's is not equall"; std::string res; char* k; res=""; for(ag::list<StartEndStruct>::member p=StartEndList.head;(p!=NULL);p=p->next) { k=new char[p->data.end-p->data.start+1]; strncpy(k,sText+p->data.start,p->data.end-p->data.start); k[p->data.end-p->data.start]=0; res+=k; delete[] k; } k=new char[res.size()+1]; strcpy(k,res.c_str()); k[res.size()]=0; ((saveto!=NULL)?*saveto:sPText) = k; } void CPRApplication::PreprocessIncludes(char** saveto, char* sText, char* workdir) { // обработка инклудов ag::list<CPRTokenInfo>* pTok=new ag::list<CPRTokenInfo>; ParseIt(pTok,sText,true,true); ag::list<StartEndStruct> StartEndList; StartEndStruct ses; for(ag::list<CPRTokenInfo>::member p=pTok->head;(p!=NULL)&&(p->data.petCurrType!=petEOF);p=p->next) { if (p->data.sCurrText[0]=='#') { ses.start=p->data.iStartPos; do p=p->next; while (p->data.sCurrText[0]==' '); if (strcmp(p->data.sCurrText,"include")==0) { do p=p->next; while (p->data.sCurrText[0]==' '); int IncludeType = (p->data.sCurrText[0]=='"')?1:( (p->data.sCurrText[0]=='<')?2:-1 ); if (IncludeType==-1) throw "Invalid include directive"; if (IncludeType==1) { do p=p->next; while (p->data.sCurrText[0]==' '); std::string wd=workdir; if (workdir[strlen(workdir)-1]!='/') wd+='/'; std::string sPath; do{ sPath+=p->data.sCurrText; p=p->next;}while ((p->data.sCurrText[0]!='"')&&(p!=NULL)); do p=p->next; while (p->data.sCurrText[0]==' '); if (p==NULL) throw "Second brace is not found"; sPath=wd+sPath; if (debugmode) std::cout<<"Path: "<<sPath<<"\n"; if (debugmode) std::cout<<"Work: "<<wd <<"\n"; char** inc=new char*; ses.end=p->data.iStartPos; Preprocessing(inc,GetFileText((char*)sPath.c_str()),(char*)wd.c_str()); ses.data=inc; StartEndList.add_tail(ses); } if (IncludeType==2) { do p=p->next; while (p->data.sCurrText[0]==' '); char* incpath=getenv("CPROMPTINCLUDES"); if(incpath==NULL) { throw "(FATAL ERROR) Enviromnent variable CPROMPTINCLUDES is not initialized\n"; } std::string wd=incpath; if (incpath[strlen(incpath)-1]!='/') wd+='/'; std::string sPath; do{ sPath+=p->data.sCurrText; p=p->next;}while ((p->data.sCurrText[0]!='>')&&(p!=NULL)); do p=p->next; while (p->data.sCurrText[0]==' '); if (p==NULL) throw "Second brace is not found"; sPath=wd+sPath; if (debugmode) std::cout<<"Path: "<<sPath<<"\n"; if (debugmode) std::cout<<"Work: "<<wd <<"\n"; char** inc=new char*; ses.end=p->data.iStartPos; Preprocessing(inc,GetFileText((char*)sPath.c_str()),(char*)wd.c_str()); ses.data=inc; StartEndList.add_tail(ses); } } } } char* k; std::string res=""; int last=0; for(ag::list<StartEndStruct>::member p=StartEndList.head;(p!=NULL);p=p->next) { k=new char[p->data.start+1]; strncpy(k,sText+last,p->data.start-last); // if (debugmode) std::cout<<": "<<k<<"\n"; k[(p->data.start)-last]=0; res+=k; delete[] k; res+=*(char**)(p->data.data); last=p->data.end; } k=new char[strlen(sText)-last+1]; strncpy(k,sText+last,strlen(sText)-last); // if (debugmode) std::cout<<p->data.start<<' '<<p->data.end<<": "<<k; k[strlen(sText)-last]=0; res+=k; delete[] k; k=new char[res.size()+1]; strcpy(k,res.c_str()); k[res.size()]=0; ((saveto!=NULL)?*saveto:sPText) = k; } void CPRApplication::PreprocessDefineConsts(char** saveto, char* fText, char* workdir) { // обработка дефайн-констант char* sText=new char[strlen(fText)+1]; strcpy(sText,fText); sText[strlen(fText)]=0; ag::list<CPRTokenInfo>* pTok=new ag::list<CPRTokenInfo>; ParseIt(pTok,sText,true,true); ag::list<StartEndStruct> StartEndList; ag::list<StartEndStruct> ToErase; StartEndStruct ses; CPRDefine dfn; ag::list<CPRTokenInfo>* Tk=new ag::list<CPRTokenInfo>; //ag::list<CPRDefine> sDefinesL; int iSt; for(ag::list<CPRTokenInfo>::member p=pTok->head;(p!=NULL);p=p->next) { if (p->data.petCurrType==petEOF) break; if (p->data.sCurrText[0]=='#') { iSt=p->data.iStartPos; do p=p->next; while (p->data.sCurrText[0]==' '); if (strcmp(p->data.sCurrText,"pragma")==0) { sText[iSt]=' '; ReadToEOLN(&p,sText); } if (strcmp(p->data.sCurrText,"define")==0) { do p=p->next; while (p->data.sCurrText[0]==' '); char* ident; ident=ReadIdent(&p,sText); if (p->data.sCurrText[0]=='(') dfn.dt=cdtMacro; else dfn.dt=cdtConst; if (dfn.dt==cdtConst) { dfn.params=NULL; dfn.name=ident; while (p->data.sCurrText[0]==' ') p=p->next; if (p->data.sCurrText[0]!='\n') { dfn.expr=ReadToEOLN(&p,sText); }else dfn.expr=NULL; } if (dfn.dt==cdtMacro) { // } bool replace=false; for(ag::list<CPRDefine>::member m=sDefines.head;m!=NULL;m=m->next) { if(strcmp(m->data.name,ident)==0) { m->data.dt=dfn.dt; m->data.params=dfn.params; m->data.expr=dfn.expr; replace=true; break; } } if (!replace) sDefines.add_tail(dfn); } if (strcmp(p->data.sCurrText,"undef")==0) { do p=p->next; while (p->data.sCurrText[0]==' '); std::string ident; while(sIdentSymbs%p->data.sCurrText[0]) { ident+=p->data.sCurrText; p=p->next; } for(ag::list<CPRDefine>::member m=sDefines.head;m!=NULL;m=m->next) { if(strcmp(m->data.name,ident.c_str())==0) { sDefines.del(m); break; } } } } ag::list<CPRTokenInfo>::member Tkm; ag::list<CPRDefine>::member b; //if (debugmode) std::cout<<">>"; /*for(ag::list<CPRDefine>::member kms=sDefines.head;kms!=NULL;kms=kms->next) if (debugmode) std::cout<<kms->data.name<<"\n"; */ for(ag::list<CPRDefine>::member m=sDefines.head;m!=NULL;m=m->next) { Tk->delall(); ParseIt(Tk,m->data.name,true,true); Tkm=Tk->head; ses.start=p->data.iStartPos; while((strcmp(Tkm->data.sCurrText,p->data.sCurrText)==0)) { Tkm=Tkm->next; p=p->next; if (Tkm==NULL) { //Нашли! ses.end=p->prev->data.iFinishPos; char* j=new char[strlen(m->data.expr)+1]; strcpy(j,m->data.expr); j[strlen(m->data.expr)]=0; ses.data=j; if (ses.data!=NULL) StartEndList.add_tail(ses); break; } } } } char* k; std::string res; int last=0; for(ag::list<StartEndStruct>::member p=StartEndList.head;(p!=NULL);p=p->next) { k=new char[p->data.start+1]; strncpy(k,sText+last,p->data.start-last); // if (debugmode) std::cout<<": "<<k<<"\n"; k[(p->data.start)-last]=0; res+=k; delete[] k; if (p->data.data!=NULL) res+=(char*)(p->data.data); last=p->data.end; } k=new char[strlen(sText)-last+1]; strncpy(k,sText+last,strlen(sText)-last); // if (debugmode) std::cout<<p->data.start<<' '<<p->data.end<<": "<<k; k[strlen(sText)-last]=0; res+=k; // delete[] k; k=new char[res.size()+1]; strcpy(k,res.c_str()); k[res.size()]=0; pTok->delall(); ToErase.delall(); ParseIt(pTok,k,true,true); for(ag::list<CPRTokenInfo>::member p=pTok->head;(p!=NULL)&&(p->data.petCurrType!=petEOF);p=p->next) { if (p->data.sCurrText[0]=='#') { iSt=p->data.iStartPos; do p=p->next; while (p->data.sCurrText[0]==' '); if (strcmp(p->data.sCurrText,"define")==0) { ReadToEOLN(&p,k); ses.start=iSt; ses.end=p->data.iFinishPos; ses.data=NULL; ToErase.add_tail(ses); } if (strcmp(p->data.sCurrText,"undef")==0) { ReadToEOLN(&p,k); ses.start=iSt; ses.end=p->data.iFinishPos; ses.data=NULL; ToErase.add_tail(ses); } } } res=""; char* y; last=0; for(ag::list<StartEndStruct>::member p=ToErase.head;(p!=NULL);p=p->next) { y=new char[p->data.start+1]; strncpy(y,k+last,p->data.start-last); // if (debugmode) std::cout<<": "<<k<<"\n"; y[(p->data.start)-last]=0; res+=y; delete[] y; if (p->data.data!=NULL) res+=(char*)(p->data.data); last=p->data.end; } y=new char[strlen(k)-last+1]; strncpy(y,k+last,strlen(k)-last); // if (debugmode) std::cout<<p->data.start<<' '<<p->data.end<<": "<<k; y[strlen(k)-last]=0; res+=y; delete[] y; //if (debugmode) std::cout<<res; y=new char[res.size()+1]; strcpy(y,res.c_str()); y[res.size()]=0; ((saveto!=NULL)?*saveto:sPText) = y; } void CPRApplication::PreprocessComments(char** saveto, char* fText, char* workdir) { // обработка комментариев char* sText=new char[strlen(fText)+1]; strcpy(sText,fText); sText[strlen(fText)]=0; ag::list<CPRTokenInfo>* pTok=new ag::list<CPRTokenInfo>; ParseIt(pTok,sText,true,true); ag::list<StartEndStruct> StartEndList; ag::list<StartEndStruct> ToErase; StartEndStruct ses; CPRDefine dfn; ag::list<CPRTokenInfo>* Tk=new ag::list<CPRTokenInfo>; //ag::list<CPRDefine> sDefinesL; int iSt,iEnd; for(ag::list<CPRTokenInfo>::member p=pTok->head;(p!=NULL);p=p->next) { if (p->data.petCurrType==petEOF) break; if (p->data.sCurrText[0]=='/') { iSt=p->data.iStartPos; p=p->next; if (p->data.sCurrText[0]=='/') { ReadToEOLN(&p,sText); iEnd=p->data.iFinishPos; for (int j=iSt;j<iEnd;j++) { sText[j]='\n'; } } } } ((saveto!=NULL)?*saveto:sPText) = sText; } void CPRApplication::Preprocessing(char** saveto, char* sText, char* workdir) { // 1) обработка инклудов PreprocessIncludes (saveto,sText,workdir); // 2) обработка: define, ifdef, ifndef, endif, elif PreprocessIfDefs (saveto,((saveto!=NULL)?*saveto:sPText),workdir); PreprocessDefineConsts (saveto,((saveto!=NULL)?*saveto:sPText),workdir); // 3) обработка pragma ; // 4) обработка комментариев PreprocessComments (saveto,((saveto!=NULL)?*saveto:sPText),workdir); } bool CPRApplication::HashBang() { if ((sPText[0]=='#')&&(sPText[1]=='!')) { while((sPText[0]!='\xA')&&(sPText[0]!='\x0')) sPText++; sPText++; } } void CPRApplication::BuildTree(char* workpath, ag::list<CPRTokenInfo>* pTok,char* sftext,ag::tree<CPRTreeNode*>*parent) { if (debugmode) std::cout<<"CPRApplication::BuildTree()\n"; int state=0; ag::tree<CPRTreeNode*>* mainparent=this->aTree; ag::tree<CPRTreeNode*>* funcparent=FindText1InTree(aTree,"FUNCTIONS"); if (funcparent==NULL) funcparent=this->aTree->addchild(MakeCPRTreeNode(tntNone,"FUNCTIONS")); ag::tree<CPRTreeNode*>* currparent=(parent)?parent:funcparent; ag::tree<CPRTreeNode*>* tp; ag::list<CPRTextDataType>::member lm; CPRTreeNode *n; CPRTextDataType *dt=new CPRTextDataType; int k=0; char *str1,*str2,*str3,*str4; int* q; int iSz; int iSz2; bool outside=false; ag::list<CPRTokenInfo>*pTokens; CPROutsideHeader* coh; if (pTok!=NULL) pTokens=pTok; else pTokens=&aTokens; bool newnode; ag::tree<CPRTreeNode*>* pfc; int iCommandsIndexOut=-1; for(ag::list<CPRTokenInfo>::member p=pTokens->head;(p!=NULL)&&(p->data.petCurrType!=petEOF);p=p->next) { switch (state) { case 0://new expression if (debugmode) aTree->drawtree_con(&std::cout);// DELETE if (debugmode) std::cout<<"(s0) start: "<<p->data.sCurrText<<", "<<p->data.petCurrType<<"\n"; if (p->data.sCurrText[0]==';'){} else if ((p->data.sCurrText[0]=='}')||(iCommandsIndexOut==0)) { bool bCmdIndexOut=(iCommandsIndexOut==0); iCommandsIndexOut=-1; if (currparent->data->tntType==tntIFTrue) { if (!bCmdIndexOut) p=p->next; if (strcmp(p->data.sCurrText,"else")==0) { currparent=currparent->parent; for(ag::list<ag::tree<CPRTreeNode*>*>::member i=currparent->childs.head;i!=NULL;i=i->next) { if (i->data->data->tntType==tntIFFalse) { currparent=i->data; break; } } p=p->next; if (p->data.sCurrText[0]!='{') { iCommandsIndexOut=2; p=p->prev; } }else { currparent=currparent->parent->parent; p=p->prev; } }else { if (currparent->data->tntType==tntForLoop) { ag::list<CPRTokenInfo>* aTo=new ag::list<CPRTokenInfo>; std::string rs1=currparent->data->text3; rs1+=';'; ParseIt(aTo,(char*)rs1.c_str()); for(ag::list<CPRTokenInfo>::member pa=aTo->head;pa!=NULL;pa=pa->next) if (debugmode) std::cout << pa->data.sCurrText << ": " << pa->data.petCurrType << "; "; if (debugmode) std::cout<<"\n"; BuildTree(workpath,aTo,(char*)rs1.c_str(),currparent); if (bCmdIndexOut) p=p->prev; currparent=currparent->parent; }else if (currparent->data->tntType==tntDoWhileLoop) { if (p->data.sCurrText[0]=='}') p=p->next; if (strcmp(p->data.sCurrText,"while")!=0) throw "There is no \"while\" in Do-While loop"; p=p->next; str1=ReadToSymbol(p,';',false); currparent->data->r1=MakePostfixFromInfix(str1); currparent=currparent->parent; }else if (currparent->data->tntType==tntIFFalse) { currparent=currparent->parent->parent; if (bCmdIndexOut) p=p->prev; }else { if (bCmdIndexOut) p=p->prev; currparent=currparent->parent; if (debugmode) std::cout<<"(s0): level up\n"; } } }else if (strcmp(p->data.sCurrText,"if")==0) { p=p->next; int brackets=0; std::string ex; do { ex+=p->data.sCurrText; brackets=(p->data.sCurrText[0]=='(')?brackets+1:brackets; brackets=(p->data.sCurrText[0]==')')?brackets-1:brackets; p=p->next; }while ((brackets>0)&&(p->data.petCurrType!=petEOF)); str4=new char[ex.size()+1]; strcpy(str4,ex.c_str()); str4[ex.size()]=0; tp=new ag::tree<CPRTreeNode*>(currparent,MakeCPRTreeNode(tntIF,str4)); tp->data->r1=MakePostfixFromInfix(str4); currparent=tp; tp=new ag::tree<CPRTreeNode*>(currparent,MakeCPRTreeNode(tntIFFalse,"False branch")); tp=new ag::tree<CPRTreeNode*>(currparent,MakeCPRTreeNode(tntIFTrue,"True branch")); currparent=tp; if (debugmode) std::cout<<"(s0) IF "<<ex<<", TRUE level created && FALSE level created && TRUE level down\n"; if (p->data.sCurrText[0]!='{') { iCommandsIndexOut=2; p=p->prev; } }else if (strcmp(p->data.sCurrText,"while")==0) { p=p->next; int brackets=0; std::string ex; do { ex+=p->data.sCurrText; brackets=(p->data.sCurrText[0]=='(')?brackets+1:brackets; brackets=(p->data.sCurrText[0]==')')?brackets-1:brackets; p=p->next; }while ((brackets>0)&&(p->data.petCurrType!=petEOF)); str4=new char[ex.size()+1]; strcpy(str4,ex.c_str()); str4[ex.size()]=0; tp=new ag::tree<CPRTreeNode*>(currparent,MakeCPRTreeNode(tntWhileLoop,str4)); tp->data->r1=MakePostfixFromInfix(str4); currparent=tp; if (p->data.sCurrText[0]!='{') { iCommandsIndexOut=2; p=p->prev; } }else if (strcmp(p->data.sCurrText,"for")==0) { p=p->next; if (p->data.sCurrText[0]!='(') throw "'(' expected"; p=p->next; str1=ReadToSymbol(p,';',true); p=p->next; str2=ReadToSymbol(p,';',false); p=p->next; str3=ReadToSymbol(p,')',false); ag::list<CPRTokenInfo>* aTo=new ag::list<CPRTokenInfo>; std::string rs1=str1; rs1+=';'; ParseIt(aTo,(char*)rs1.c_str()); for(ag::list<CPRTokenInfo>::member pa=aTo->head;pa!=NULL;pa=pa->next) if (debugmode) std::cout << pa->data.sCurrText << ": " << pa->data.petCurrType << "; "; if (debugmode) std::cout<<"\n"; BuildTree(workpath,aTo,(char*)rs1.c_str(),currparent); tp=new ag::tree<CPRTreeNode*>(currparent,MakeCPRTreeNode(tntForLoop,str1,str2,str3)); tp->data->r2=MakePostfixFromInfix(str2); tp->data->r3=MakePostfixFromInfix(str3); currparent=tp; p=p->next; if (p->data.sCurrText[0]!='{') { iCommandsIndexOut=2; p=p->prev; } }else if (strcmp(p->data.sCurrText,"do")==0) { p=p->next; tp=new ag::tree<CPRTreeNode*>(currparent,MakeCPRTreeNode(tntDoWhileLoop)); currparent=tp; if (p->data.sCurrText[0]!='{') { iCommandsIndexOut=2; p=p->prev; } }else if (strcmp(p->data.sCurrText,"pragma")==0) { str1=ReadToEOLN(&p, sftext); if (debugmode) std::cout<<"(s0): directive: "<<str1<<"\n"; tp=new ag::tree<CPRTreeNode*>(currparent,MakeCPRTreeNode(tntDirective,str1)); }else if (strcmp(p->data.sCurrText,"outside")==0) { outside=true; coh=new CPROutsideHeader; p=p->next; char* x=ReadIdent(&p,sftext); while ((p!=NULL)&&(x[0]!=':')) { if(strcmp(x,"cdecl")==0) { coh->cc=occCDecl; } p=p->next; x=ReadIdent(&p,sftext); } p=p->next; }else /*if (p->data.sCurrText[0]=='@') { p=p->next; str1=ReadIdent(&p); tp=new ag::tree<CPRTreeNode*>(currparent,MakeCPRTreeNode(tntVarOutput,str1)); }*/ if (p->data.sCurrText[0]=='{') { tp=new ag::tree<CPRTreeNode*>(currparent,MakeCPRTreeNode(tntNone)); currparent=tp; if (debugmode) std::cout<<"(s0): new level created && level down\n"; }else if (IsTypename(p)) // it is typename { str1=ReadTypename(p); state=1; if (debugmode) std::cout<<"(s0): '"<<str1<<"' typename detected\n"; }else if (strcmp(p->data.sCurrText,"return")==0) { p=p->next; str1=ReadToSymbol(p,';',false); if (debugmode) std::cout<<"(s0): '"<<str1<<"' return expression\n"; tp=new ag::tree<CPRTreeNode*>(currparent,MakeCPRTreeNode(tntReturn,str1)); tp->data->r1=MakePostfixFromInfix(str1); }else { str1=ReadToSymbol(p,';',false); if (debugmode) std::cout<<"(s0): '"<<str1<<"' expression\n"; tp=new ag::tree<CPRTreeNode*>(currparent,MakeCPRTreeNode(tntExpression,str1)); tp->data->r1=MakePostfixFromInfix(str1); }; if (iCommandsIndexOut>-1) iCommandsIndexOut--; break; case 1://<typename>_ if (debugmode) std::cout<<"(s1) start\n"; str2=ReadIdent(&p, sftext); state=2; if (debugmode) std::cout<<"(s1): '"<<str2<<"' ident for typename '"<<str1<<"'\n"; break; case 2://<typename>_<ident>_ if (debugmode) std::cout<<"(s2) start\n"; if (strcmp(p->data.sCurrText,"(")==0) { // function if (debugmode) std::cout<<"(s2): '"<<str1<<" "<<str2<<"()' is function\n"; state=4; }else { // variable if (debugmode) std::cout<<"(s2): '"<<str1<<" "<<str2<<"' is variable\n"; p=p->prev; state=3; } break; case 3://<typename>_<ident>=, <typename>_<ident>; if (debugmode) std::cout<<"(s3) start\n"; if (strcmp(p->data.sCurrText,"=")==0) { p=p->next; str3=ReadToSymbol(p,';',false); if (debugmode) std::cout<<"(s3): init '"<<str2<<"' variable with '"<<str3<<"'\n"; // CPRTreeNode* C=MakeCPRTreeNode(tntDeclareVar,NULL,NULL,NULL); // tp=new ag::tree<CPRTreeNode*>(currparent,C); // FillCPRTreeNode(C,tntDeclareVar,str1,str2,str3); CPRTreeNode* C=MakeCPRTreeNode(tntDeclareVar,str1,str2,str3); tp=new ag::tree<CPRTreeNode*>(currparent,C); }else tp=new ag::tree<CPRTreeNode*>(currparent,MakeCPRTreeNode(tntDeclareVar,str1,str2,NULL)); state=0; break; case 4://<typename>_<ident>( if (debugmode) std::cout<<"(s4) start\n"; if (debugmode) aTree->drawtree_con(&std::cout); pfc=FindText2InTree(currparent,str2); newnode=(pfc==NULL); if (!newnode) { // n=pfc->data; // n->tntType=tntFunction; currparent->delchild(pfc); } if (debugmode) aTree->drawtree_con(&std::cout); n=MakeCPRTreeNode(tntFunction,str1,str2); n->r1=new ag::list<CPRTextDataType>; while ((strcmp(p->data.sCurrText,")")!=0)&&(p!=NULL)) { if (!IsTypename(p)) { if ((strcmp(p->data.sCurrText,".")==0)&&(strcmp(p->next->data.sCurrText,".")==0)&&(strcmp(p->next->next->data.sCurrText,".")==0)) { lm=((ag::list<CPRTextDataType>*)(n->r1))->add_tail(*dt); lm->data.str1="..."; lm->data.str2="..."; lm->data.str3=NULL; p=p->next->next->next; continue; } else { if (debugmode) std::cout<<"(s4) ERROR "<<p->data.sCurrText<<" is not typename\n"; state=0; break; } } lm=((ag::list<CPRTextDataType>*)(n->r1))->add_tail(*dt); str1=ReadTypename(p); lm->data.str1=str1; p=p->next; str2=ReadIdent(&p, sftext); lm->data.str2=str2; p=p->next; k=0; k+=(strcmp(p->data.sCurrText,"[")==0)?1:0; k+=(strcmp(p->data.sCurrText,"]")==0)?-1:0; //p=p->next; if (k>0) { str3=new char[1]; str3[0]=0; }else str3=NULL; if(k==1)strcat(str3,"["); if(k==-1)strcat(str3,"]"); if (k>0) p=p->next; while ((k>0)&&(p!=NULL)) { k+=(strcmp(p->data.sCurrText,"[")==0)?1:0; if(strcmp(p->data.sCurrText,"[")==0)strcat(str3,"["); k+=(strcmp(p->data.sCurrText,"]")==0)?-1:0; if(strcmp(p->data.sCurrText,"]")==0)strcat(str3,"]"); if(k>0) strcat(str3,p->data.sCurrText); p=p->next; }; lm->data.str3=str3; if (strcmp(p->data.sCurrText,",")==0) p=p->next; //if (debugmode) std::cout<<"(s4): function parameter '"<<str1<<" "<<str2<<"'\n"; } for(ag::list<CPRTextDataType>::member I=(*((ag::list<CPRTextDataType>*)(n->r1))).head;I!=NULL;I=I->next) { if (debugmode) std::cout<<"(s4): function parameter '"<<I->data.str1<<" "<<I->data.str2; if(I->data.str3!=NULL)if (debugmode) std::cout<<" "<<I->data.str3; if (debugmode) std::cout<<"'\n"; } p=p->next; if (strcmp(p->data.sCurrText,"{")==0) { tp=new ag::tree<CPRTreeNode*>(currparent,n); if (debugmode) aTree->drawtree_con(&std::cout); if (debugmode) std::cout<<"(s4): function start: new level. level down..\n"; currparent=tp; } if (strcmp(p->data.sCurrText,";")==0) { if (outside) { outside=false; n->tntType=tntOutside; n->r2=coh; tp=new ag::tree<CPRTreeNode*>(currparent,n); if (debugmode) aTree->drawtree_con(&std::cout); } else { ((ag::list<CPRTextDataType>*)(n->r1))->delall(); ag::list<CPRTextDataType>::member kx; for(ag::list<CPRTextDataType>::member I=(*((ag::list<CPRTextDataType>*)(n->r1))).tail;I!=NULL;) { kx=I->prev; delete I; I=kx; } delete n->r1; delete n; delete tp; } if (debugmode) std::cout<<"(s4): it was forward declaration of function\n"; } state=0; break; case 5: break; } //if (debugmode) std::cout << p->data.sCurrText << ": " << p->data.petCurrType << "; "; } } ag::tree<CPRTreeNode*>* FindText2InTree(ag::tree<CPRTreeNode*>* T,char* sText,CPRTreeNodeType tnt) { ag::listmember< ag::tree<CPRTreeNode*>* >* p=(*T).childs.head; while (p!=NULL) { if (strcmp(p->data->data->text2,sText)==0) { if ((tnt==tntNone)||((tnt!=tntNone)&&(p->data->data->tntType==tnt))) return p->data; } p=p->next; } return NULL; } ag::tree<CPRTreeNode*>* FindFunctionInTree(ag::tree<CPRTreeNode*>* T,char* sText) { ag::listmember< ag::tree<CPRTreeNode*>* >* p=(*T).childs.head; while (p!=NULL) { if (strcmp(p->data->data->text2,sText)==0) { if (p->data->data->tntType!=tntDeclareFunc) return p->data; } p=p->next; } return NULL; } ag::tree<CPRTreeNode*>* FindText1InTree(ag::tree<CPRTreeNode*>* T,char* sText,CPRTreeNodeType tnt) { ag::listmember< ag::tree<CPRTreeNode*>* >* p=(*T).childs.head; while (p!=NULL) { if (strcmp(p->data->data->text,sText)==0) { if ((tnt==tntNone)||((tnt!=tntNone)&&(p->data->data->tntType==tnt))) return p->data; } p=p->next; } return NULL; } void CPRApplication::ExecOutside(ag::tree<CPRTreeNode*>* T) { CPROutsideHeader* coh=(CPROutsideHeader*)(T->data->r2); if (coh->cc==occCDecl) { int wc; void* buf=CreateBufferFromStackStdCall((ag::list<CPRTextDataType>*)(T->data->r1),wc); //пихаем в буфер параметры #ifdef WIN32 void *addr = (void*)(GetProcAddress(0,T->data->text2)); #else void *addr = dlsym(NULL,T->data->text2); #endif if (debugmode) std::cout<<"calling the "<<T->data->text2<<" ...\n"; aStack.push(CallOutsideCDecl(addr,wc,buf,T->data->text)); if (debugmode) std::cout<<"\ncall finished\n"; //CallStdCall(addr,wc,buf,8); // скармливаем буфер функции } } void CPRApplication::OutVarList(ag::list<DTVar*>* Vars) { if (Vars==NULL) return; int b=0; if (debugmode) std::cout<<"Vars.count="<<Vars->count()<<"\n"; for (ag::list<DTVar*>::member m=Vars->head;m!=NULL;m=m->next) { b++; if (debugmode) std::cout<<"Local["<<b<<"]="<<(((DTMain*)(((DTVar*)m->data)->T))->sIdent)<<"\n"; } } void CPRApplication::ExecTree(ag::tree<CPRTreeNode*>* T,ag::list<DTVar*>* ExternalVars, char* retname) { try { ag::list<DTVar*> Local; //ag::list<CPRRestoreVarName*> ToRestore; if (ExternalVars!=NULL) { DTVar* q; rpnlist* rl; RPNStackElement* rse; DTVar* dv; for (ag::list<DTVar*>::member m=ExternalVars->head;m!=NULL;m=m->next) { Local.add_tail(m->data); } } OutVarList(&Local); bool was_ret=false; char* sq_s; if (T->data->tntType==tntFunction) {//if it's function, load arguments from stack to Local. search from the end int c=((ag::list<CPRTextDataType>*)(T->data->r1))->count(); int c_k=((DTMain*)(aStack.pop()->T))->toint(); if (c!=c_k) if (debugmode) std::cout<<"(WARNING) Params count is not equally to declaration\n"; ag::list<CPRTextDataType>::member pm=((ag::list<CPRTextDataType>*)(T->data->r1))->head; OutVarList(&Local); ag::list<DTVar*>::member m; for (int i=0;i<c;i++) { OutVarList(&Local); m=Local.add_tail(aStack.pop());// названия OutVarList(&Local); //CPRRestoreVarName* rvn=new CPRRestoreVarName; //rvn->mem=m; //rvn->name=new char[strlen(((DTMain*)(m->data->T))->sIdent)+1]; //strcpy(rvn->name,((DTMain*)(m->data->T))->sIdent); //rvn->name[strlen(rvn->name)]=0; //ToRestore.add_tail(rvn); ((DTMain*)(m->data->T))->sIdent=pm->data.str2; OutVarList(&Local); pm=pm->next; } OutVarList(&Local); std::string sq=T->data->text2; sq+="_result_"; // std::ostringstream si; // si << rand(); // sq+=si.str(); sq_s=new char[sq.size()+1]; strcpy(sq_s,sq.c_str()); sq_s[sq.size()]=0; DTVar* r=ParseDataTypeString(T->data->text,sq_s,NULL,&Local); Local.add_tail(r); }else { sq_s=retname; } OutVarList(&Local); ag::listmember< ag::tree<CPRTreeNode*>* >* p=(*T).childs.head; while (p!=NULL) { switch(p->data->data->tntType) { case tntDeclareVar: { //if (p->data->data->text3) if (debugmode) std::cout<<" : Declarating variable: "<<p->data->data->text<<", "<<p->data->data->text2; if (p->data->data->text3!=NULL) { if (debugmode) std::cout<<" = "<<p->data->data->text3; } if (debugmode) std::cout<<"; regular variable\n"; try { std::string rpnstr; /*rpnstr=p->data->data->text2; rpnstr+="=";*/ rpnstr+=(p->data->data->text3)?p->data->data->text3:""; DTVar* dtv=ParseDataTypeString(p->data->data->text,p->data->data->text2,//p->data->data->text3); NULL, NULL); Local.add_tail(dtv); rpnlist* rls; rls=MakePostfixFromInfix((char*)rpnstr.c_str()); RPNStackElement* rlsel=new RPNStackElement; rlsel->d=p->data->data->text2; rlsel->tp=rsetStr; rls->add_head(rlsel); rlsel=new RPNStackElement; rlsel->d=new char[3]; ((char*)rlsel->d)[0]='='; ((char*)rlsel->d)[1]=' '; ((char*)rlsel->d)[2]=0; rlsel->tp=rsetAct; rls->add_tail(rlsel); OutVarList(&Local); CalculateRPN(rls,&Local); OutVarList(&Local); if (debugmode) std::cout<<"variable was added to Local\n"; if (debugmode) std::cout<<((DTMain*)(dtv->T))->DTFullName()<<"\n"; }catch(char* k) { if (debugmode) std::cout<<"(Error): "<<k<<"\n"; } catch(const char* k) { if (debugmode) std::cout<<"(Error): "<<k<<"\n"; }; //((DTMain*)(dtv->T))->; OutVarList(&Local); break; } case tntDeclareFunc: { break; } case tntFunction: { break; } case tntIF: { ag::stack<DTVar*>* g= CalculateRPN((rpnlist*)p->data->data->r1, &Local); DTMain* if_ex=((DTMain*)(g->pop()->T)); if (if_ex->typeoftype()!=1) { char* qerr=new char[strlen("Result of expression at \"if\" must be integer type!")+1]; strcpy(qerr,"Result of expression at \"if\" must be integer type!"); qerr[strlen("Result of expression at \"if\" must be integer type!")]=0; throw qerr; } CPRTreeNodeType r; if (((DTIntegerTypes*)(if_ex))->toint()) r=tntIFTrue; else r=tntIFFalse; ag::tree<CPRTreeNode*>* call; for(ag::list<ag::tree<CPRTreeNode*>*>::member i=p->data->childs.head;i!=NULL;i=i->next) { if (i->data->data->tntType==r) { call=i->data; break; } } ExecTree(call,&Local,sq_s); break; } case tntWhileLoop: { bool bOk; do { ag::stack<DTVar*>* g= CalculateRPN((rpnlist*)p->data->data->r1, &Local); DTMain* if_ex=((DTMain*)(g->pop()->T)); if (if_ex->typeoftype()!=1) { char* qerr=new char[strlen("Result of expression at \"while\" must be integer type!")+1]; strcpy(qerr,"Result of expression at \"while\" must be integer type!"); qerr[strlen("Result of expression at \"while\" must be integer type!")]=0; throw qerr; } bOk=(((DTIntegerTypes*)(if_ex))->toint()); if (bOk) ExecTree(p->data,&Local,sq_s); }while (bOk); break; } case tntDoWhileLoop: { bool bOk; do { ExecTree(p->data,&Local,sq_s); ag::stack<DTVar*>* g= CalculateRPN((rpnlist*)p->data->data->r1, &Local); DTMain* if_ex=((DTMain*)(g->pop()->T)); if (if_ex->typeoftype()!=1) { char* qerr=new char[strlen("Result of expression at \"while\" must be integer type!")+1]; strcpy(qerr,"Result of expression at \"while\" must be integer type!"); qerr[strlen("Result of expression at \"while\" must be integer type!")]=0; throw qerr; } bOk=(((DTIntegerTypes*)(if_ex))->toint()); }while (bOk); break; } case tntForLoop: { bool bOk; do { ag::stack<DTVar*>* g= CalculateRPN((rpnlist*)p->data->data->r2, &Local); DTMain* if_ex=((DTMain*)(g->pop()->T)); if (if_ex->typeoftype()!=1) { char* qerr=new char[strlen("Result of expression at \"for\" must be integer type!")+1]; strcpy(qerr,"Result of expression at \"for\" must be integer type!"); qerr[strlen("Result of expression at \"for\" must be integer type!")]=0; throw qerr; } bOk=(((DTIntegerTypes*)(if_ex))->toint()); if (bOk) ExecTree(p->data,&Local,sq_s); }while (bOk); break; } case tntExpression: { CalculateRPN((rpnlist*)p->data->data->r1, &Local); break; } case tntReturn: { if (sq_s==NULL) throw "return is not allowed in this context"; ag::stack<DTVar*>* g= CalculateRPN((rpnlist*)p->data->data->r1, &Local); DTVar* ret_var=FindVariable(sq_s,&Local); DTMain* qw=(DTMain*)(g->pop()->T); DTMain* er=(DTMain*)(ret_var->T); CalculateAssignation(er,qw,&Local); aStack.push(ret_var); //if ((DTMain*)(ret_var->T)->typeoftype()==) return; break; } case tntDirective: { DTVar* g; if (debugmode) std::cout<<"#"<<p->data->data->text<<"\n"; CPRParser* pd=new CPRParser(p->data->data->text); pd->Next(); if (strcmp(pd->sCurrText,"pragma")==0) { pd->Next(); if (strcmp(pd->sCurrText,"out")==0) { pd->Next(); char* svar=pd->ReadIdent(); if (debugmode) std::cout<<"out("<<svar<<")\n"; DTVar* x=FindVariable(svar,&Local); if (x!=NULL) { if (debugmode) std::cout<<svar<<" = "<< (((DTMain*)(x->T))->tostring()) <<"\n"; }else { if (debugmode) std::cout<<svar<<" not found!"; } // for(ag::list<DTVar*>::member i=aVars.head;i!=NULL;i=i->next) // { // g=(DTVar*)(i->data); // if (((DTMain*)(g->T))->sIdent==NULL) continue; // if (strcmp((((DTMain*)(g->T))->sIdent),svar)==0) // { // if (debugmode) std::cout<<svar<<" = "<< (((DTMain*)(g->T))->tostring()) <<"\n"; // break; // }; // }; }; }; break; } }; p=p->next; }; if (T->data->tntType==tntFunction) aStack.push(FindVariable(sq_s,&Local)); // for (ag::list<CPRRestoreVarName*>::member m=ToRestore.head;m!=NULL;m=m->next) // { // ((DTMain*)(m->data->mem->data->T))->sIdent=m->data->name; // } }catch(char* k) { if (debugmode) std::cout<<"(Error): "<<k<<"\n"; } catch(const char* k) { if (debugmode) std::cout<<"(Error): "<<k<<"\n"; } } void CPRApplication::ExecMainTree(ag::tree<CPRTreeNode*>* T) { ag::tree<CPRTreeNode*>* tFuncs=T->childs[0]->data; ag::tree<CPRTreeNode*>* mainf=FindText2InTree(tFuncs,"main"); if (mainf==NULL) { if (debugmode) std::cout<<"(FATAL ERROR) Function 'main' not found. Terminated."; return; } if (debugmode) mainf->drawtree_con(&std::cout); if (debugmode) std::cout<<"function parameter argc="<<argc-1<<"\n"; DTInt* L=new DTInt("argc",argc-argnum); DTArray* cpargv=new DTArray("argv",sizeof(char*),argc-argnum,"char*"); DTVar* m=DTVar::CreateNativeDTVarFromDTMain(cpargv); aStack.push(m); aStack.push(DTVar::CreateNativeDTVarFromDTMain(L)); char* ss; void** tmp; for(int i=argnum;i<argc;i++) { //tmp=new void*; ss=new char[strlen(argv[i])+1]; strcpy(ss,argv[i]); ss[strlen(argv[i])]=0; cpargv->FillElement(i-argnum,ss); } for(int i=0;i<cpargv->count;i++) if (debugmode) std::cout<<"cpargv["<<i<<"]:: "<<((DTMain*)(((DTVar*)(cpargv->GetElement(i)))->T))->tostring()<<"\n"; if (debugmode) std::cout<<"DTArray.tostring(): \""<<cpargv->tostring()<<"\"\n"; L=new DTInt(NULL,2); aStack.push(DTVar::CreateNativeDTVarFromDTMain(L)); //test /* int k=*((unsigned int*)(((DTUInt*)(((DTVar*)(aStack.pop()))->T))->pData)); DTArray& a; a=(*aStack.pop())->T; for(int i=0;i<k;i++) { if (debugmode) std::cout<<i<<"\n"; try{ tmp=(((DTArray*)((*).T))->GetElement(i)); if (debugmode) std::cout<<i<<"\n"; if (debugmode) std::cout<<"pop: cpargv["<<i<<"]:: "<<tmp<<"\n"; } catch (...){ if (debugmode) std::cout<<"(INTERNAL ERROR) 1\n"; } } */ if (debugmode) std::cout<<"\n\n"; ExecTree(mainf); //recoursively run all childs ; }
[ [ [ 1, 1556 ] ] ]
f502e583baf2cd8d852d03698e1e69b151f42edc
6bdb3508ed5a220c0d11193df174d8c215eb1fce
/Codes/Halak/UIPanel.cpp
074326580aa05fa4cef8b8325cef7aa80e27f21e
[]
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
5,032
cpp
#include <Halak/PCH.h> #include <Halak/UIPanel.h> #include <Halak/Assert.h> #include <Halak/Math.h> #include <Halak/UIDrawingContext.h> #include <Halak/UIFrame.h> #include <Halak/UIPickingContext.h> #include <Halak/UIVisual.h> #include <algorithm> namespace Halak { UIPanel::UIPanel() { } UIPanel::UIPanel(int childrenCapacity) { children.reserve(childrenCapacity); } UIPanel::~UIPanel() { } UIVisual* UIPanel::FindChild(const String& name, bool searchAllChildren) const { if (searchAllChildren) { for (VisualCollection::const_iterator it = children.begin(); it != children.end(); it++) { if ((*it)->GetName() == name) return (*it); if ((*it)->IsPanel()) { if (UIVisual* found = static_cast<UIPanel*>((*it).GetPointee())->FindChild(name, true)) return found; } } } else { for (VisualCollection::const_iterator it = children.begin(); it != children.end(); it++) { if ((*it)->GetName() == name) return (*it); } } return nullptr; } bool UIPanel::IsPanel() const { return true; } void UIPanel::Add(UIVisual* item) { Insert(children.size(), item); } void UIPanel::Insert(int index, UIVisual* item) { index = Math::Clamp(index, 0, static_cast<int>(children.size())); if (index < 0 || static_cast<int>(children.size()) < index) return; if (item->GetParent()) item->GetParent()->Remove(item); HKAssert(item->GetParent() == nullptr); item->SetParent(this); if (index < static_cast<int>(children.size())) children.insert(children.begin() + index, item); else children.push_back(item); OnChildAdded(item); } bool UIPanel::Remove(UIVisual* item) { VisualCollection::iterator it = std::find(children.begin(), children.end(), item); if (it != children.end()) { RemoveByIterator(it); return true; } else return false; } bool UIPanel::RemoveAt(int index) { if (0 <= index && index < static_cast<int>(children.size())) { RemoveByIterator(children.begin() + index); return true; } else return false; } void UIPanel::RemoveByIterator(VisualCollection::iterator it) { HKAssertDebug(it != children.end() && (*it) != nullptr); UIVisualPtr child = (*it); children.erase(it); child->SetParent(nullptr); OnChildRemoved(child); } void UIPanel::RemoveAll() { VisualCollection removingChildren; removingChildren.swap(children); for (VisualCollection::iterator it = removingChildren.begin(); it != removingChildren.end(); it++) (*it)->SetParent(nullptr); OnChildrenRemoved(removingChildren); } void UIPanel::DrawChildren(UIDrawingContext& context) { for (VisualCollection::const_iterator it = children.begin(); it != children.end(); it++) context.DrawChild(*it); } void UIPanel::OnDraw(UIDrawingContext& context) { DrawChildren(context); } void UIPanel::OnPick(UIPickingContext& context) { if (context.Contains(context.GetCurrentClippedBounds())) { for (VisualCollection::const_reverse_iterator it = children.rbegin(); it != children.rend(); it++) { if (context.Pick(*it)) return; } context.SetResult(this); } } void UIPanel::OnChildAdded(UIVisual* /*child*/) { } void UIPanel::OnChildRemoved(UIVisual* /*child*/) { } void UIPanel::OnChildrenAdded(const VisualCollection& /*children*/) { } void UIPanel::OnChildrenRemoved(const VisualCollection& /*children*/) { } void UIPanel::BringChildToFront(UIVisual* child) { VisualCollection::iterator it = std::find(children.begin(), children.end(), child); HKAssert(it != children.end()); if (it == children.end() - 1) { children.erase(it); children.push_back(child); } } void UIPanel::SendChildToBack(UIVisual* child) { VisualCollection::iterator it = std::find(children.begin(), children.end(), child); HKAssert(it != children.end()); if (it != children.begin()) { children.erase(it); children.insert(children.begin(), child); } } }
[ [ [ 1, 193 ] ] ]
cd1aad1d4fe208675bded4d63facf6e1f0792f3c
5f0b8d4a0817a46a9ae18a057a62c2442c0eb17e
/Include/event/PropertyEvent.h
7b48acf5619217309994fbe173f667fae46be7ce
[ "BSD-3-Clause" ]
permissive
gui-works/ui
3327cfef7b9bbb596f2202b81f3fc9a32d5cbe2b
023faf07ff7f11aa7d35c7849b669d18f8911cc6
refs/heads/master
2020-07-18T00:46:37.172575
2009-11-18T22:05:25
2009-11-18T22:05:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,353
h
/* * Copyright (c) 2003-2006, Bram Stein * 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. * 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 AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef PROPERTYEVENT_H #define PROPERTYEVENT_H #include "./Event.h" namespace ui { namespace event { /** * Property events are for internal use. * Propery events are sent when the properties * of a Component change. These Events are specific * to the Component in question. */ class PropertyEvent : public Event { public: PropertyEvent(Component *source, int classID, int id); int getClassID() const; enum CLASSTYPES { /** * Events available for every Component. */ CORE = 1, /** * Events specific to a certain Component. */ SPECIAL = 2 }; enum COREEVENTS { ENABLED = 1, VISIBLE = 2 // more to be added }; private: int classID; }; } } #endif
[ "bs@bram.(none)" ]
[ [ [ 1, 75 ] ] ]
cf3ac8bc5271180034ce0a8554c1cd9d80e96738
78af025c564e5a348fd268e2f398a79a9b76d7d1
/src/iPhoneToday/Log.cpp
c0df9a0750a7e64e1f811e931c07c21c83bad293
[]
no_license
tronikos/iphonetoday
c2482f527299f315440a1afa1df72ab8e4f68154
d2ba13d97df16270c61642b2f477af8480c6abdf
refs/heads/master
2021-01-01T18:22:46.483398
2011-05-14T05:20:58
2011-05-14T05:20:58
32,228,280
1
0
null
null
null
null
UTF-8
C++
false
false
278
cpp
#include "Log.h" /* void WriteToLog(const TCHAR* message, ...) { FILE *f = _wfopen(L"\\iPhoneToday_log.txt", L"a+"); va_list args; va_start(args, message); vfwprintf(f, message, args); //fwprintf(f, L"\r\n"); va_end(args); fflush(f); fclose(f); } */
[ [ [ 1, 17 ] ] ]
2ab446c542366dc96637cc8309ef6bc06c20be36
478570cde911b8e8e39046de62d3b5966b850384
/apicompatanamdw/bcdrivers/mw/classicui/uifw/apps/S60_SDK3.0/bctestptieng/src/bctestptiengdocument.cpp
365d2fa8908bf63b94ace5f73e8939726d827c98
[]
no_license
SymbianSource/oss.FCL.sftools.ana.compatanamdw
a6a8abf9ef7ad71021d43b7f2b2076b504d4445e
1169475bbf82ebb763de36686d144336fcf9d93b
refs/heads/master
2020-12-24T12:29:44.646072
2010-11-11T14:03:20
2010-11-11T14:03:20
72,994,432
0
0
null
null
null
null
UTF-8
C++
false
false
2,189
cpp
/* * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: Avkon Template test application * */ // INCLUDE FILES #include "BCTestPtiEngDocument.h" #include "BCTestPtiEngAppUi.h" // ================= MEMBER FUNCTIONS ========================================= // ---------------------------------------------------------------------------- // CBCTestPtiEngDocument* CBCTestPtiEngDocument::NewL( CEikApplication& ) // Symbian OS two-phased constructor. // ---------------------------------------------------------------------------- // CBCTestPtiEngDocument* CBCTestPtiEngDocument::NewL( CEikApplication& aApp ) { CBCTestPtiEngDocument* self = new( ELeave ) CBCTestPtiEngDocument( aApp ); return self; } // ---------------------------------------------------------------------------- // CBCTestPtiEngDocument::~CBCTestPtiEngDocument() // Destructor. // ---------------------------------------------------------------------------- // CBCTestPtiEngDocument::~CBCTestPtiEngDocument() { } // ---------------------------------------------------------------------------- // CBCTestPtiEngDocument::CBCTestPtiEngDocument( CEikApplication& ) // Overload constructor. // ---------------------------------------------------------------------------- // CBCTestPtiEngDocument::CBCTestPtiEngDocument( CEikApplication& aApp ) : CEikDocument( aApp ) { } // ---------------------------------------------------------------------------- // CEikAppUi* CBCTestPtiEngDocument::CreateAppUiL() // Constructs CBCTestVolumeAppUi. // ---------------------------------------------------------------------------- // CEikAppUi* CBCTestPtiEngDocument::CreateAppUiL() { return new( ELeave ) CBCTestPtiEngAppUi; } // End of File
[ "none@none" ]
[ [ [ 1, 65 ] ] ]
94b298bfd5f87b12b6155f191234f23722a0811e
6a17cdafd868c66e547fedf631231a979e677b32
/Circles/Vector2D.h
9d8e4678bb09258649424f9a8881dc1ac6d2dec9
[]
no_license
jarodl/LearnOpenGL
312b68ace44b2a92e654bd2eedc49942e5ab87f7
e482b65d5ab56c7063a727f19fe97f4dd62f3d9b
refs/heads/master
2021-01-20T15:06:47.424290
2010-01-29T06:49:09
2010-01-29T06:49:09
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,953
h
#ifndef VECTOR2D_H #define VECTOR2D_H #include <math.h> class Vector2D { public: float x; float y; Vector2D() {} Vector2D(float r, float s) { x = r; y = s; } Vector2D& Set(float r, float s) { x = r; y = s; return (*this); } float& operator [](long k) { return ((&x)[k]); } const float& operator [](long k) const { return ((&x)[k]); } Vector2D& operator +=(const Vector2D& v) { x += v.x; y += v.y; return (*this); } Vector2D& operator -=(const Vector2D& v) { x -= v.x; y -= v.y; return (*this); } Vector2D& operator *=(float t) { x *= t; y *= t; return (*this); } Vector2D& operator /=(float t) { float f = 1.0F / t; x *= f; y *= f; return (*this); } Vector2D& operator &=(const Vector2D& v) { x *= v.x; y *= v.y; return (*this); } Vector2D operator -(void) const { return (Vector2D(-x, -y)); } Vector2D operator +(const Vector2D& v) const { return (Vector2D(x + v.x, y + v.y)); } Vector2D operator -(const Vector2D& v) const { return (Vector2D(x - v.x, y - v.y)); } Vector2D operator *(float t) const { return (Vector2D(x * t, y * t)); } Vector2D operator /(float t) const { float f = 1.0F / t; return (Vector2D(x * f, y * f)); } float operator *(const Vector2D& v) const { return (x * v.x + y * v.y); } Vector2D operator &(const Vector2D& v) const { return (Vector2D(x * v.x, y * v.y)); } bool operator ==(const Vector2D& v) const { return ((x == v.x) && (y == v.y)); } bool operator !=(const Vector2D& v) const { return ((x != v.x) || (y != v.y)); } float Length() const { return ( x * x + y * y ); } Vector2D& Normalize(void) { return (*this /= sqrtf(x * x + y * y)); } Vector2D& Rotate(float angle) { float s = sinf(angle); float c = cosf(angle); float nx = c * x - s * y; float ny = s * x + c * y; x = nx; y = ny; return (*this); } }; #endif
[ [ [ 1, 143 ] ] ]
3f7f98f168742fc33df657e20f0144f96535f938
478570cde911b8e8e39046de62d3b5966b850384
/apicompatanamdw/bcdrivers/mw/websrv/xml_fragment_api/src/maindomfragment.cpp
f0a3862764b255259d58a541773dc3f3a795d8c0
[]
no_license
SymbianSource/oss.FCL.sftools.ana.compatanamdw
a6a8abf9ef7ad71021d43b7f2b2076b504d4445e
1169475bbf82ebb763de36686d144336fcf9d93b
refs/heads/master
2020-12-24T12:29:44.646072
2010-11-11T14:03:20
2010-11-11T14:03:20
72,994,432
0
0
null
null
null
null
UTF-8
C++
false
false
4,872
cpp
/* * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: * */ #include "MainDomFragment.h" #include "SenFragmentBase.h" namespace { const TInt KStateParsingDelegate = 100; _LIT8(KMainFragmentXmlns, "urn:main:fragment"); _LIT8(KMainFragmentName, "MainFragment"); _LIT8(KMainFragmentQName, "mn:MainFragment"); _LIT8(KDelegateName, "DelegateFragment"); } CMainDomFragment* CMainDomFragment::NewL() { CMainDomFragment* pNew = NewLC(); CleanupStack::Pop(); // pNew; return pNew; } CMainDomFragment* CMainDomFragment::NewLC() { CMainDomFragment* pNew = new (ELeave) CMainDomFragment; CleanupStack::PushL(pNew); pNew->BaseConstructL(); return pNew; } CMainDomFragment* CMainDomFragment::NewL( const TDesC8& aNsUri, const TDesC8& aLocalName, const TDesC8& aQName ) { CMainDomFragment* pNew = NewLC( aNsUri, aLocalName, aQName ); CleanupStack::Pop(); // pNew; return pNew; } CMainDomFragment* CMainDomFragment::NewLC( const TDesC8& aNsUri, const TDesC8& aLocalName, const TDesC8& aQName ) { CMainDomFragment* pNew = new (ELeave) CMainDomFragment; CleanupStack::PushL(pNew); pNew->BaseConstructL(aNsUri, aLocalName, aQName); return pNew; } CMainDomFragment::CMainDomFragment() : ipDelegateFragment(NULL) { } void CMainDomFragment::BaseConstructL() { CSenDomFragmentBase::BaseConstructL( KMainFragmentXmlns, KMainFragmentName, KMainFragmentQName ); } void CMainDomFragment::BaseConstructL( const TDesC8& aNsUri, const TDesC8& aLocalName, const TDesC8& aQName ) { CSenDomFragmentBase::BaseConstructL(aNsUri, aLocalName, aQName); } CMainDomFragment::~CMainDomFragment() { delete ipDelegateFragment; } void CMainDomFragment::OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode) { switch (iState) { case KSenStateSave: { const TPtrC8 saxLocalName = aElement.LocalName().DesC(); if (saxLocalName == KDelegateName) { const TPtrC8 saxNsUri = aElement.Uri().DesC(); const TPtrC8 saxPrefix = aElement.Prefix().DesC(); TXmlEngElement element = AsElementL(); RSenDocument& document = AsDocumentL(); ipDelegateFragment = CDelegateDomFragment::NewL( saxNsUri, saxLocalName, saxPrefix, aAttributes, element, document ); iState = KStateParsingDelegate; OnDelegateParsingL(*ipDelegateFragment); } else { CSenDomFragmentBase::OnStartElementL(aElement, aAttributes, aErrorCode); } break; } default: { CSenDomFragmentBase::OnStartElementL(aElement, aAttributes, aErrorCode); break; } } } void CMainDomFragment::OnEndElementL(const RTagInfo& aElement, TInt aErrorCode) { switch(iState) { case KStateParsingDelegate: { iState = KSenStateSave; break; } default: { CSenDomFragmentBase::OnEndElementL(aElement, aErrorCode); break; } } } void CMainDomFragment::OnResumeParsingFromL(const RTagInfo& aElement, TInt aErrorCode) { SetContentHandler(*this); switch (iState) { // no other states may be resumed(!) case KStateParsingDelegate: { OnEndElementL(aElement, aErrorCode); } break; } } CDelegateDomFragment& CMainDomFragment::DelegateFragment() { return *ipDelegateFragment; } // END OF FILE
[ "none@none" ]
[ [ [ 1, 183 ] ] ]
496a0b5ef7ec1114ee69f1c183e6392c8af4b091
2a47a0a9749be9adae403d99f6392f9d412fca53
/OS simulation/FinalFiles/scheduler.cpp
b624d43eabd32e13e05378143cdb83ca782a6f99
[]
no_license
waseemilahi/waseem
153bed6788475a88d234d75a323049a9d8ec47fe
0bb2bddcc8758477f0ad5db85bfc927db2ae07af
refs/heads/master
2020-03-30T14:59:17.066002
2008-11-22T01:21:04
2008-11-22T01:21:04
32,640,847
0
0
null
null
null
null
UTF-8
C++
false
false
2,414
cpp
//Waseem Ilahi /*The scheduler function*/ void scheduler(long* a,long* p){ long a9; //If the ready queue is empty.set the valueofa to 1. if(readyqueue->empty()){ valueofa=1; return ; } //if the the ready queue is not empty check for the following cases and //act accordingly. else while(!readyqueue->empty()){ currentlyrunning=jobTable->findjob(readyqueue->top()); readyqueue->pop(); if(currentlyrunning==NULL){ *a=1; return;} //Job in transit. if(currentlyrunning->getintransitbit()==1){ if(!readyqueue->empty()){ jobmoving=1; continue; } else if(readyqueue->empty()){ readyqueue->push(currentlyrunning->getjobnumber()); sortqueue(readyqueue); valueofa=1; return; } } //The job is blocked. else if(currentlyrunning->getblockedbit()==1 && currentlyrunning->getiopending()>0 ){ blockedlist->push_back(currentlyrunning->getjobnumber()); if(!readyqueue->empty()){ continue; } else if(readyqueue->empty()){ valueofa=1; return ; } } else{ if(currentlyrunning->getblockedbit()==1 && currentlyrunning->getiopending()==0){ jobTable->findjob(currentlyrunning->getjobnumber())->setblockedbit(0); } //The job is not incore. if(currentlyrunning->getincorebit()==0){ swapper(currentlyrunning->getjobnumber()); if(!readyqueue->empty()){ continue; } else if(readyqueue->empty()){ valueofa=1; return ; } } //Run the incore jobs. else if(currentlyrunning->getincorebit()==1){ jobTable->findjob(currentlyrunning->getjobnumber())->settimejobran(p[5]); runningreg=1; valueofa=2; return ; } } } //if none of the above is true. valueofa=1; return ; }
[ "waseemilahi@b30cb682-9650-11dd-b20a-03c46e462ecf" ]
[ [ [ 1, 101 ] ] ]
c3decb2c9375b0f1703711e51f14a76e9f56347d
f8b364974573f652d7916c3a830e1d8773751277
/emulator/allegrex/instructions/CTC1.h
8772339bca24e22984bb29879d91eee4dfe4633e
[]
no_license
lemmore22/pspe4all
7a234aece25340c99f49eac280780e08e4f8ef49
77ad0acf0fcb7eda137fdfcb1e93a36428badfd0
refs/heads/master
2021-01-10T08:39:45.222505
2009-08-02T11:58:07
2009-08-02T11:58:07
55,047,469
0
0
null
null
null
null
UTF-8
C++
false
false
1,035
h
template< > struct AllegrexInstructionTemplate< 0x44c00000, 0xffe007ff > : AllegrexInstructionUnknown { static AllegrexInstructionTemplate &self() { static AllegrexInstructionTemplate insn; return insn; } static AllegrexInstruction *get_instance() { return &AllegrexInstructionTemplate::self(); } virtual AllegrexInstruction *instruction(u32 opcode) { return this; } virtual char const *opcode_name() { return "CTC1"; } virtual void interpret(Processor &processor, u32 opcode); virtual void disassemble(u32 address, u32 opcode, char *opcode_name, char *operands, char *comment); protected: AllegrexInstructionTemplate() {} }; typedef AllegrexInstructionTemplate< 0x44c00000, 0xffe007ff > AllegrexInstruction_CTC1; namespace Allegrex { extern AllegrexInstruction_CTC1 &CTC1; } #ifdef IMPLEMENT_INSTRUCTION AllegrexInstruction_CTC1 &Allegrex::CTC1 = AllegrexInstruction_CTC1::self(); #endif
[ [ [ 1, 41 ] ] ]
f1f7c767ab97c222fa45906726762f504ce4cfb0
11916febd7cf1bf31f029791171ed60ad8bbefcb
/criticality/scripts/add_long_link.cpp
667ef5ec6cf1a835f3e6a96f45eb7c4fae7467aa
[]
no_license
guopengwei/worm_sim
18d8b321744ed32c2ab4ca38f89723c835ef40de
260a7288fca3731fd082684ea3ca2ba243c951a2
refs/heads/master
2021-01-25T08:55:28.133828
2011-01-19T02:10:01
2011-01-19T02:10:01
1,269,438
0
1
null
null
null
null
UTF-8
C++
false
false
3,751
cpp
/************************************************************************ Author: Umit Ogras ([email protected]) File name: add_long)link.cpp Date Written: <Mon Feb 28 19:16:26 2005> Last Modified: Description: Add long link to mesh network based on input traffic Usage: ./add_lang_link rows cols wiring_constraint traffic.config arch.config print_out ************************************************************************/ #include <iostream> #include <fstream> #include <cstdio> #include <vector> #define MAX_LINE 1024 using namespace std; int gen_arch_config(int rows,int cols,int count,vector<int> long_links,char *arch_file); double free_packet_delay(int row, int col, char *traf_config, char *arch_config); int main(int argn, char **argv) { int *output=0; int row,col; int N = 0; int constraint=0; int utilization=0; char * arch_file=0; char input_line[MAX_LINE]; char * sub_string; int * RLink; bool print_out = 0; vector <int> long_links; if (argn == 7) print_out = 1; else print_out = 0; if ( !sscanf(argv[1],"%d",&row) || !sscanf(argv[2],"%d",&col) ) cerr <<"Network size is not specified! \n"; N = row*col; if ( !sscanf(argv[3],"%d",&constraint) ) cerr <<"Constraint is not specified! \n"; /*ofstream tr_config(argv[4]); if (!tr_config.is_open() || !tr_config.good()) { cerr <<"Traffic file cannot be opened \n"; return -1; }*/ arch_file = argv[5]; // The file for the architecture & routing info double min_rate=0; double curr_rate=0; int best_id[2]={0,0}; // Main loop: Continue until the utilization is less tha the // constraint. // Each time find the most beneficial link to be added bool link_add [N]; for (unsigned int r=0; r<N; r++) // for (unsigned int c=0; c<N; c++) link_add[r]=0; // No link is added initially unsigned int count = 2; // Number of long links already added, each node can have at most one long link while ( utilization < constraint ) { min_rate = 1000; // Try all possible additions of links for (unsigned int m=0; m<N; m++) { for (int n=0; n<N; n++) { if ( link_add[m] || link_add[n] || (m==n) ) continue; // Already added // Generate config file with this link added long_links.push_back(m); long_links.push_back(n); // Write architecture config file with routing info to argv[5] //printf("Now trying (%d,%d):\n",m,n); gen_arch_config(row,col,count,long_links,argv[5]); //cout <<"Architecture generated \n"; // Evaluate current configuration curr_rate = free_packet_delay(row,col,argv[4],argv[5]); // printf("The free packet delay is found as (%d,%d):%f\n",m,n,curr_rate); if ( curr_rate < min_rate ) { // A better configuration is found best_id[0] = m; best_id[1] = n; min_rate = curr_rate; } // if long_links.pop_back(); long_links.pop_back(); } // for c } // for r cout <<"cekirge 1:" << best_id[0] <<" " << best_id[1] <<endl; long_links.push_back(best_id[0]); long_links.push_back(best_id[1]); link_add[best_id[0]] = 1; link_add[best_id[1]] = 1; count += 2; int dy = abs( (best_id[0] % col)-(best_id[1] % col)); int dx =abs( ((int) (best_id[0]/row))-((int) (best_id[1]/row)) ); utilization = utilization + dy + dx; } // while for (int h=0;h<long_links.size();h++) printf("%d ",long_links[h]); printf("%d \n",count); gen_arch_config(row,col,count-2,long_links,argv[5]); }
[ [ [ 1, 112 ] ] ]
885237b8a8f3ebf7ffe6f53f7e4ee01e80110f88
2c9e29d0cdae3e532ff969c0de530b5b8084b61e
/psp/network.cpp
2705bceb64c4da30f3534c1348abb4eff12ed437
[]
no_license
Sondro/kurok
1695a976700f6c9732a761d33d092a679518e23b
59da1adb94e1132c5a2215b308280bacd7a3c812
refs/heads/master
2022-02-01T17:41:12.584690
2009-08-03T01:19:05
2009-08-03T01:19:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,897
cpp
/* Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 2007 Peter Mackay and Chris Swindle. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "network_psp.hpp" extern "C" { #include "../net_dgrm.h" #include "../net_loop.h" } net_driver_t net_drivers[MAX_NET_DRIVERS] = { { "Loopback", qfalse, Loop_Init, Loop_Listen, Loop_SearchForHosts, Loop_Connect, Loop_CheckNewConnections, Loop_GetMessage, Loop_SendMessage, Loop_SendUnreliableMessage, Loop_CanSendMessage, Loop_CanSendUnreliableMessage, Loop_Close, Loop_Shutdown } , { "Datagram", qfalse, Datagram_Init, Datagram_Listen, Datagram_SearchForHosts, Datagram_Connect, Datagram_CheckNewConnections, Datagram_GetMessage, Datagram_SendMessage, Datagram_SendUnreliableMessage, Datagram_CanSendMessage, Datagram_CanSendUnreliableMessage, Datagram_Close, Datagram_Shutdown } }; int net_numdrivers = 2; using namespace quake; using namespace quake::network; net_landriver_t net_landrivers[MAX_NET_DRIVERS] = { { "Infrastructure", qfalse, 0, infrastructure::init, infrastructure::shut_down, infrastructure::listen, infrastructure::open_socket, infrastructure::close_socket, infrastructure::connect, infrastructure::check_new_connections, infrastructure::read, infrastructure::write, infrastructure::broadcast, infrastructure::addr_to_string, infrastructure::string_to_addr, infrastructure::get_socket_addr, infrastructure::get_name_from_addr, infrastructure::get_addr_from_name, infrastructure::addr_compare, infrastructure::get_socket_port, infrastructure::set_socket_port }, { "Adhoc", qfalse, 0, adhoc::init, adhoc::shut_down, adhoc::listen, adhoc::open_socket, adhoc::close_socket, adhoc::connect, adhoc::check_new_connections, adhoc::read, adhoc::write, adhoc::broadcast, adhoc::addr_to_string, adhoc::string_to_addr, adhoc::get_socket_addr, adhoc::get_name_from_addr, adhoc::get_addr_from_name, adhoc::addr_compare, adhoc::get_socket_port, adhoc::set_socket_port } }; int net_numlandrivers = 2;
[ [ [ 1, 122 ] ] ]
fe520839ca5cd6702c1e49898c1f25d746959262
8289a2a1ffc9152826a50bc5cddbd91638564c42
/dcpp/version.cpp
0fffe3b8d37677bb7603b39dd48a55d8790a0120
[]
no_license
maciekgajewski/rufusdc
05b092fd618ca252061452bec85a935e651acc75
6920d8c287439ed35621568d5804b07d93fee940
refs/heads/master
2021-01-21T22:26:38.376386
2009-07-15T19:42:21
2009-07-15T19:42:21
32,141,786
0
0
null
null
null
null
UTF-8
C++
false
false
1,089
cpp
/* * Copyright (C) 2001-2009 Jacek Sieka, arnetheduck on gmail point com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "stdinc.h" #include "DCPlusPlus.h" #include "version.h" #ifndef DCPP_REVISION #define DCPP_REVISION 0 #endif #define xstrver(s) strver(s) #define strver(s) #s namespace dcpp { const string fullVersionString(APPNAME " v" VERSIONSTRING " (r" xstrver(DCPP_REVISION) ")"); }
[ "maciej.gajewski0@cbea7d28-d37d-11dd-87b6-9d1a99559f42" ]
[ [ [ 1, 34 ] ] ]
5183453b5ded6709a5507cbc99b0111642385752
46f6d6003ed790e6b4a735ef9baf087d45d2d29b
/Previewer/Source/Graphics/GraphicDevice.cpp
e0e53cf42ed2a4a898728a2ee520010f11b304f4
[]
no_license
larrson/metashader
ff8cb7b6912057f601113a437e2310ebb8fcf760
fb56ad3ee7df1b84a7ffd4a037cbf9a22e891e48
refs/heads/master
2021-01-19T18:53:11.362265
2011-07-12T11:09:56
2011-07-12T11:09:56
35,814,208
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
13,498
cpp
/** @file GraphicDevice.cpp @brief グラフィックデバイスクラス */ // Includes ---------------------------------------------------------------------------------- #include "stdafx.h" #include "GraphicDevice.h" // Global Variable Definitions --------------------------------------------------------------- namespace { /// メッセージ処理関数 LRESULT WINAPI MsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { return DefWindowProc(hWnd, msg, wParam, lParam); } // ウィンドウ作成 WNDCLASSEX wndclass = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, L"Previewer", NULL }; } namespace opk { // Function Definitions ---------------------------------------------------------------------- //------------------------------------------------------------------------------------------ CGraphicDevice::CGraphicDevice() : m_pd3d9 (NULL) , m_pd3dDevice9 (NULL) , m_pd3dSurface9(NULL) , m_hWnd (0) , m_bValid (false) , m_bActive (false) , m_nWidth (0) , m_nHeight(0) , m_viewport() , m_cameraInfo() { } //------------------------------------------------------------------------------------------ CGraphicDevice::~CGraphicDevice() { Dispose(); } //------------------------------------------------------------------------------------------ bool CGraphicDevice::Initialize(int i_nWidth, int i_nHeight) { HRESULT hr = S_OK; // D3Dオブジェクトの作成 m_pd3d9 = Direct3DCreate9(D3D_SDK_VERSION); if( !m_pd3d9 ) { return false; } // ダミーウィンドウを作成 if( CreateDummyWindow() == false ) { return false; } // デバイスを作成 if( CreateDevice(i_nWidth, i_nHeight) == false ) { return false; } // レンダーターゲットの作成 if( CreateRenderTarget(i_nWidth, i_nHeight) == false ) { return false; } /// 全てに成功 /// m_nWidth = i_nWidth; m_nHeight = i_nHeight; // ビューポートの設定 m_viewport.X = 0; m_viewport.Y = 0; m_viewport.Width = i_nWidth; m_viewport.Height = i_nHeight; m_viewport.MinZ = 0.0f; m_viewport.MaxZ = 1.0f; // トランスフォームの初期化(単位行列化) for(int i = 0; i < TransformType_Max; ++i) { D3DXMatrixIdentity( &m_mTransform[i] ); } // シェーダ管理の初期化 shader::CShaderMan::CreateInstance(); shader::CShaderMan::GetInstance()->Initialize(); m_bValid = true; return true; } //------------------------------------------------------------------------------------------ bool CGraphicDevice::CreateDummyWindow() { if (!RegisterClassEx(&wndclass)) { return false; } m_hWnd = CreateWindow( L"Previewer", L"Previewer", WS_OVERLAPPEDWINDOW, 0, // Initial X 0, // Initial Y 0, // Width 0, // Height NULL, NULL, wndclass.hInstance, NULL); return true; } //------------------------------------------------------------------------------------------ bool CGraphicDevice::CreateDevice( int i_nWidth, int i_nHeight ) { // Presentation Parameter の初期化 ZeroMemory( &m_d3dpp, sizeof(m_d3dpp) ); m_d3dpp.Windowed = TRUE; // サイズとフォーマット m_d3dpp.BackBufferWidth = i_nWidth; m_d3dpp.BackBufferHeight = i_nHeight; m_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; m_d3dpp.BackBufferFormat = D3DFMT_UNKNOWN; m_d3dpp.EnableAutoDepthStencil = TRUE; m_d3dpp.AutoDepthStencilFormat = D3DFMT_D24X8; // デバイス作成 HRESULT hr = m_pd3d9->CreateDevice( D3DADAPTER_DEFAULT , D3DDEVTYPE_HAL , m_hWnd , D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE , &m_d3dpp , &m_pd3dDevice9 ); if( FAILED(hr) ) { return false; } return true; } //------------------------------------------------------------------------------------------ bool CGraphicDevice::CreateRenderTarget(int i_nWidth, int i_nHeight) { HRESULT hr; hr = m_pd3dDevice9->CreateRenderTarget( i_nWidth , i_nHeight , D3DFMT_A8R8G8B8 , D3DMULTISAMPLE_NONE , 0 , true , &(m_pd3dSurface9) , NULL ); if( FAILED(hr) ) { return false; } if( FAILED( m_pd3dDevice9->SetRenderTarget(0, m_pd3dSurface9) ) ) { return false; } return true; } //------------------------------------------------------------------------------------------ void CGraphicDevice::Dispose() { // シェーダ管理の破棄 shader::CShaderMan::DisposeInstance(); // 破棄処理 SAFE_RELEASE( m_pd3dSurface9 ); SAFE_RELEASE( m_pd3dDevice9 ); SAFE_RELEASE( m_pd3d9 ); if( m_hWnd ) { DestroyWindow(m_hWnd); UnregisterClass(L"Previewer", NULL); } } //------------------------------------------------------------------------------------------ bool CGraphicDevice::Reset(int i_nWidth, int i_nHeight ) { HRESULT hr; // サーフェースの破棄 SAFE_RELEASE( m_pd3dSurface9 ); // デバイスのリセット // Presentation Parameter の初期化 m_d3dpp.BackBufferWidth = i_nWidth; m_d3dpp.BackBufferHeight = i_nHeight; hr = m_pd3dDevice9->Reset( &m_d3dpp ); MY_ASSERT( SUCCEEDED(hr) ); // サーフェースを新しいサイズで再作成 bool ret = CreateRenderTarget( i_nWidth, i_nHeight ); MY_ASSERT( ret ); m_nWidth = i_nWidth; m_nHeight = i_nHeight; // ビューポートの設定 m_viewport.X = 0; m_viewport.Y = 0; m_viewport.Width = i_nWidth; m_viewport.Height = i_nHeight; m_viewport.MinZ = 0.0f; m_viewport.MaxZ = 1.0f; return ret; } //------------------------------------------------------------------------------------------ HRESULT CGraphicDevice::Activate() { HRESULT hr; // 準備中 if( m_bValid == false ) { return E_FAIL; } V_RETURN( m_pd3dDevice9->BeginScene() ); // 実行中フラグをセット m_bActive = true; // ビューポートを設定 V_RETURN( m_pd3dDevice9->SetViewport(&m_viewport) ); // レンダーステートの設定 V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_ZENABLE, TRUE ) ); V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_ZWRITEENABLE, TRUE ) ); V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL ) ); // カリングの設定 V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW )); // ブレンドモードの設定 V_RETURN( SetBlendMode( m_nBlendMode, true ) ); return hr; } //------------------------------------------------------------------------------------------ void CGraphicDevice::Deactivate() { // レンダリング終了 m_pd3dDevice9->EndScene(); // 実行中フラグを下ろす m_bActive = false; } //------------------------------------------------------------------------------------------ IDirect3DSurface9* CGraphicDevice::GetBackBuffer() { // バックバッファの取得 return m_pd3dSurface9; } //------------------------------------------------------------------------------------------ HRESULT CGraphicDevice::SetTransform(TransformType i_nTransformType, D3DXMATRIX i_mMatrix) { #if !USE_SHADER HRESULT hr; #endif // USE_SHADER // IDirect3DDevice9::SetTransform用変換テーブル static const D3DTRANSFORMSTATETYPE tbStateType[TransformType_Max] = { D3DTS_WORLD, D3DTS_VIEW, D3DTS_PROJECTION, }; // 新しい行列を保持 m_mTransform[ i_nTransformType ] = i_mMatrix; // 実行時ならセット if( m_bActive ) { #if !USE_SHADER V_RETURN( m_pd3dDevice9->SetTransform( tbStateType[i_nTransformType], &(m_mTransform[i_nTransformType]) ) ); #endif // USE_SHADER } return S_OK; } //------------------------------------------------------------------------------------------ HRESULT CGraphicDevice::SetCameraInfo( const SCameraInfo& i_cameraInfo ) { HRESULT hr; // 新しいカメラ情報を保持 m_cameraInfo = i_cameraInfo; /// 新しいカメラ情報でビュー,射影行列を計算 /// D3DXMATRIX mView, mProj; // ビュー行列を計算 D3DXMatrixLookAtRH( &mView , &m_cameraInfo.vEyePos , &m_cameraInfo.vInterestPos , &m_cameraInfo.vUpDir ); // 射影行列を計算 D3DXMatrixPerspectiveFovRH( &mProj , m_cameraInfo.fFov , ((float)m_nWidth) / m_nHeight , m_cameraInfo.fNear , m_cameraInfo.fFar ); // 各行列を設定 V_RETURN( SetTransform(TransformType_View, mView) ); V_RETURN( SetTransform(TransformType_Projection, mProj) ); return S_OK; } //------------------------------------------------------------------------------------------ HRESULT CGraphicDevice::SetBlendMode( BlendMode i_nBlendMode, bool i_bForced ) { HRESULT hr = S_OK; // 同じであればなにもしない if( !i_bForced && m_nBlendMode == i_nBlendMode ) return hr; // 新しい値を保持 m_nBlendMode = i_nBlendMode; // 実行時ならセット if( m_bActive ) { switch( i_nBlendMode ) { case BlendMode_None: V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE) ); break; case BlendMode_Normal: V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE)); // RGB V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD )); V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA)); V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA )); // A V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_BLENDOPALPHA, D3DBLENDOP_ADD )); V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_ONE)); V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_DESTBLENDALPHA, D3DBLEND_ONE )); break; case BlendMode_Add: V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE)); // RGB V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD) ); V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA)); V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE )); // A V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_BLENDOPALPHA, D3DBLENDOP_ADD )); V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_ONE)); V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_DESTBLENDALPHA, D3DBLEND_ONE )); break; case BlendMode_Sub: V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE)); // RGB V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_REVSUBTRACT )); V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA)); V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE )); // A V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_BLENDOPALPHA, D3DBLENDOP_ADD )); V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_ONE)); V_RETURN( m_pd3dDevice9->SetRenderState(D3DRS_DESTBLENDALPHA, D3DBLEND_ONE )) break; } } return hr; } //------------------------------------------------------------------------------------------ void CGraphicDevice::SetDirLightEnable( int i_nIndex, bool i_bEnable ) { MY_ASSERT( i_nIndex < DirLight_Max ); m_dirLightInfo[ i_nIndex ].bEnable = i_bEnable; } //------------------------------------------------------------------------------------------ D3DXVECTOR3 CGraphicDevice::GetDirLightColor( int i_nIndex ) { MY_ASSERT( i_nIndex < DirLight_Max ); return m_dirLightInfo[ i_nIndex ].vColor; } //------------------------------------------------------------------------------------------ void CGraphicDevice::SetDirLightColor( int i_nIndex, float i_fR, float i_fG, float i_fB) { MY_ASSERT( i_nIndex < DirLight_Max ); m_dirLightInfo[ i_nIndex ].vColor.x = i_fR; m_dirLightInfo[ i_nIndex ].vColor.y = i_fG; m_dirLightInfo[ i_nIndex ].vColor.z = i_fB; } //------------------------------------------------------------------------------------------ D3DXVECTOR3 CGraphicDevice::GetDirLightDir( int i_nIndex ) { MY_ASSERT( i_nIndex < DirLight_Max ); return m_dirLightInfo[ i_nIndex ].vDir; } //------------------------------------------------------------------------------------------ void CGraphicDevice::SetDirLightDir( int i_nIndex, float i_fX, float i_fY, float i_fZ) { MY_ASSERT( i_nIndex < DirLight_Max ); m_dirLightInfo[ i_nIndex ].vDir.x = i_fX; m_dirLightInfo[ i_nIndex ].vDir.y = i_fY; m_dirLightInfo[ i_nIndex ].vDir.z = i_fZ; } //------------------------------------------------------------------------------------------ HRESULT CGraphicDevice::Clear(float i_fR, float i_fG, float i_fB, float i_fA) { HRESULT hr; V_RETURN( m_pd3dDevice9->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB((int)(i_fA * 255), (int)(i_fR * 255), (int)(i_fG * 255), (int)(i_fB * 255)), 1.0f, 0 ) ); return hr; } } // end of namespace opk
[ "[email protected]@a50acfb0-bd1f-d52a-3783-6e72a8704c9b" ]
[ [ [ 1, 472 ] ] ]
666112e82010629597eabfc034b818efefbfeed5
3d7fc34309dae695a17e693741a07cbf7ee26d6a
/aluminizerFPGA/exp_correlate.h
7fa1149d33819092b4db183d9bd7a15e63870f43
[ "LicenseRef-scancode-public-domain" ]
permissive
nist-ionstorage/ionizer
f42706207c4fb962061796dbbc1afbff19026e09
70b52abfdee19e3fb7acdf6b4709deea29d25b15
refs/heads/master
2021-01-16T21:45:36.502297
2010-05-14T01:05:09
2010-05-14T01:05:09
20,006,050
5
0
null
null
null
null
UTF-8
C++
false
false
911
h
#ifndef EXP_CORRELATE_H_ #define EXP_CORRELATE_H_ #include "experiments.h" #define N_BINS 16 #define N_BITS 16 #define PLOT_FFT 1 class exp_correlate : public exp_detect { public: exp_correlate(list_t* exp_list, const std::string& name = "Correlate"); virtual ~exp_correlate() { } virtual bool needInitDDS() { return false; } virtual void getPlotData(unsigned iPlot, unsigned iStart, GbE_msg& msg_out); virtual unsigned getNumPlots(); virtual void updateParams(); protected: virtual void run_exp(int iExp); virtual void init_exp(unsigned i); virtual void post_exp_calc_results(); virtual unsigned getNumDetect() const { return 1; } rp_bool removeFromQueue; rp_unsigned clockDivider; rp_double fftFrequency; dds_params Heat; unsigned histogram[N_BINS]; result_channel rcBin1FFT; std::vector<result_channel*> rcBins; }; #endif /*EXP_CORRELATE_H_*/
[ "trosen@814e38a0-0077-4020-8740-4f49b76d3b44" ]
[ [ [ 1, 50 ] ] ]
2855bb4ddb13695dd1a3c47e02e100ed23698abc
a0155e192c9dc2029b231829e3db9ba90861f956
/MailFilter/Main/SMTPProxy.h++
28df6c9698f2f52b666d59b33dcd99094840e285
[]
no_license
zeha/mailfilter
d2de4aaa79bed2073cec76c93768a42068cfab17
898dd4d4cba226edec566f4b15c6bb97e79f8001
refs/heads/master
2021-01-22T02:03:31.470739
2010-08-12T23:51:35
2010-08-12T23:51:35
81,022,257
0
0
null
null
null
null
UTF-8
C++
false
false
1,618
#include <winsock/novsock2.h> #define OK_SUCCESS 0 #define ERR_RUNNING 1 #define ERR_WSAFAIL 2 #define ERR_INVALIDSOCKET 3 #define ERR_BIND 4 #define ERR_LISTEN 5 #define ERR_HOST 6 #define ERR_CONNECT 7 #define ERR_STOPPED 8 class SMTPProxy { private: struct SSmtp { char SmtpServer[250]; char LocalIP[250]; char ClientIP[20]; unsigned int SmtpPort; unsigned int LocalPort; in_addr_t SmtpServer_addr; in_addr_t LocalIP_addr; SOCKET LocalSocket; SMTPProxy* pSMTPProxy; public: void CopyStruct(SSmtp *pSSmtp); }; struct socket_pair { SOCKET src; SOCKET dest; BOOL IsClient; SMTPProxy* pSMTPProxy; }; protected: BOOL AcceptFlag; SSmtp m_SSmtp; SOCKET SmtpServerSocket; char ProxySignature[2048]; public: int StopProxy(); int StartProxy(const char *server, unsigned int port, const char* bindaddr, unsigned int localport); SMTPProxy(); virtual ~SMTPProxy(); BOOL SetSignature(char *sig); private: static void AddToEnd(char* buff, char* b, char* sig); static int InsertTextSignature(char*,char*); static BOOL FoundBoundary(char *boundary, char *buff); static BOOL IsEndOfData(char*); static char * MakeUpper(char * ); static BOOL IsDataCommand(char *); static BOOL Is220Response(char *); DWORD SmtpProxyThreadMain(); static DWORD SmtpProxyThread(DWORD arg); void StartProxyThread(SMTPProxy* m_pSMTPProxy); static DWORD SmtpClientThread(DWORD arg); void StartClientThread(SSmtp *pSSmtp); static DWORD SmtpDataThread(DWORD arg); static void StartDataThread(socket_pair *pspair); };
[ [ [ 1, 68 ] ] ]
a1d6b8133cdf292baba53700b765ee4febe8b97a
2bb0e69fe1b6b3486f153ab13bcc6a698633e5d9
/VisStudioDeconv/MatrixLib/TVec.inl
e57b51d5657e022c88968e3d93336b18caf22a62
[]
no_license
liuguoyou/deblur-838
44973eceacae3a1fe735ee9fe2c31c78ae9c4a50
6dd9d4810ea983133f28294b830d2c77f2e43479
refs/heads/master
2020-03-23T21:19:23.329710
2009-03-10T04:06:17
2009-03-10T04:06:17
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,488
inl
#ifndef TVec_inl #define TVec_inl template <int N, class floating> Vec <N,floating> Vec<N,floating>::zero(void) { Vec <N,floating> z; int d; for (d=0;d<N;d++) { z[d] = (floating)0; } return z; } template <int N, class floating> Vec <N,floating> Vec<N,floating>::unit(int i) { Vec <N,floating> u = Vec<N,floating>::zero(); u[i] = (floating)1; return u; } template <int N, class floating> Vec <N,floating> ::Vec( const floating vec[N]) { int d; for (d=0;d<N;d++) { v[d] = vec[d]; } } template <int N, class floating> Vec <N,floating> ::Vec( const Vec <N,floating> &vec) { int d; for (d=0;d<N;d++) { v[d] = vec[d]; } } template <int N, class floating> bool Vec <N,floating> ::isconstant(floating f) const { int d; for (d=0;d<N;d++) { if (v[d] != f) { return false; } } return true; } template <int N, class floating> bool Vec <N,floating> ::iszero(void) const { int d; for (d=0;d<N;d++) { if (v[d] != (floating)0) { return false; } } return true; } template <int N, class floating> bool Vec<N,floating>::operator == (const Vec <N, floating> &vec) const { int d; for (d=0;d<N;d++) { if (v[d] != vec[d]) { return false; } } return true; } template <int N, class floating> void Vec<N,floating>::makezero(void) { int d; for (d=0;d<N;d++) { v[d] = (floating)0; } } template <int N, class floating> void Vec<N,floating>::makeunit(int i) { makezero(); v[i] = (floating)1; } template <int N, class floating> Vec <N, floating> &Vec<N,floating>::operator = (const Vec <N, floating> &vec) { int d; for (d=0;d<N;d++) { v[d] = vec[d]; } return *this; } template <int N, class floating> Vec <N, floating> &Vec<N,floating>::operator = (const floating &f) { int d; for (d=0;d<N;d++) { v[d] = f; } return *this; } template <int N, class floating> Vec <N, floating>& Vec<N,floating>::operator += (const Vec <N, floating> &vec) { int d; for (d=0;d<N;d++) { v[d] += vec[d]; } return *this; } template <int N, class floating> Vec <N, floating> &Vec<N,floating>::operator -= (const Vec <N, floating> &vec) { int d; for (d=0;d<N;d++) { v[d] -= vec[d]; } return *this; } template <int N, class floating> Vec <N, floating> &Vec<N,floating>::operator *= (floating s) { int d; for (d=0;d<N;d++) { v[d] *= s; } return *this; } template <int N, class floating> Vec <N, floating> operator - (const Vec <N, floating>&v) { Vec <N, floating> n; int d; for (d=0;d<N;d++) { n[d]=-v[d]; } return n; } template <int N, class floating> floating inner(const Vec <N,floating> &a, const Vec <N,floating> &b) { floating sum=0; int d; for (d=0;d<N;d++) { sum+=a[d]*b[d]; } return sum; } template <class floating> Vec<3, floating> cross(const Vec<3,floating> &a, const Vec<3,floating> &b) { Vec<3, floating> v; v[0] = a[1] * b[2] - a[2] * b[1]; v[1] = a[2] * b[0] - a[0] * b[2]; v[2] = a[0] * b[1] - a[1] * b[0]; return v; } template <int N, class floating> istream& operator >> (istream &is, Vec<N, floating> &m) { int j; for (j=0;j<N;j++) { is>>m[j]; } return is; } template <int N, class floating> ostream& operator << (ostream &os, const Vec<N, floating> &m) { int j; for (j=0;j<N;j++) { os<<m[j]<<"\t"; } //os<<endl; return os; } #endif
[ "brandonmichaelsmith@4448e800-f6fa-11dd-ada4-5153b8187bf2" ]
[ [ [ 1, 217 ] ] ]
9902f1de63fade5580676afb7e293be6acb867f2
9df2486e5d0489f83cc7dcfb3ccc43374ab2500c
/src/objects/sprite.h
a6936160a0e1ad9876c8a29ea21b055898250330
[]
no_license
renardchien/Eta-Chronicles
27ad4ffb68385ecaafae4f12b0db67c096f62ad1
d77d54184ec916baeb1ab7cc00ac44005d4f5624
refs/heads/master
2021-01-10T19:28:28.394781
2011-09-05T14:40:38
2011-09-05T14:40:38
1,914,623
1
2
null
null
null
null
WINDOWS-1252
C++
false
false
13,446
h
/*************************************************************************** * sprite.h - header for the corresponding cpp file * * Copyright (C) 2003 - 2009 Florian Richter ***************************************************************************/ /* 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. 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 SMC_SPRITE_H #define SMC_SPRITE_H #include "../core/global_game.h" #include "../core/math/rect.h" #include "../video/video.h" #include "../core/collision.h" namespace SMC { /* *** *** *** *** *** *** *** cCollidingSprite *** *** *** *** *** *** *** *** *** *** */ class cCollidingSprite { public: cCollidingSprite( void ); virtual ~cCollidingSprite( void ); // Handle collision data void Handle_Collisions( void ); /* Create a collision object * base : base/origin object * col : colliding object ( needed for the collision direction ) * valid_type : validation type */ cObjectCollision *Create_Collision_Object( const cSprite *base, cSprite *col, Col_Valid_Type valid_type ) const; /* Add a collision object to the collision list * returns true if successful * add_if_new : add the collision only if the collision object doesn't already collide with us and is deleted if it does */ bool Add_Collision( cObjectCollision *collision, bool add_if_new = 0 ); /* Add the collision objects to the collision list * add_if_new : add each collision only if the collision object doesn't already collide with us and is deleted if it does */ void Add_Collisions( cObjectCollisionType *col_list, bool add_if_new = 0 ); // Delete the given collision from the list void Delete_Collision( cObjectCollision *collision ); // Delete the last collision void Delete_Last_Collision( void ); /* Check if a collision is active in the given direction * and returns the collision object number else -1 */ int Is_Collision_In_Direction( const ObjectDirection dir ) const; // Returns the first added collision cObjectCollision *Get_First_Collision( void ) const; /* Returns the last added collision * if only_blocking is set only movement blocking collisions are returned */ cObjectCollision *Get_Last_Collision( bool only_blocking = 0 ) const; // returns true if the given collision obj was found in the list bool Is_Collision_Included( const cSprite *obj ) const; // Clear the Collision list void Clear_Collisions( void ); // default collision handler virtual void Handle_Collision( cObjectCollision *collision ); // collision from player virtual void Handle_Collision_Player( cObjectCollision *collision ); // collision from an enemy virtual void Handle_Collision_Enemy( cObjectCollision *collision ); // collision with massive virtual void Handle_Collision_Massive( cObjectCollision *collision ); // collision with passive virtual void Handle_Collision_Passive( cObjectCollision *collision ); // collision from a box virtual void Handle_Collision_Box( ObjectDirection cdirection, GL_rect *r2 ); // object collision list cObjectCollision_List collisions; }; /* *** *** *** *** *** *** *** cSprite *** *** *** *** *** *** *** *** *** *** */ class cSprite : public cCollidingSprite { public: // if del_img is set the given image will be deleted on change or class deletion cSprite( cGL_Surface *new_image = NULL, float x = 0, float y = 0, bool del_img = 0 ); // create from stream cSprite( CEGUI::XMLAttributes &attributes ); // destructor virtual ~cSprite( void ); // initialize defaults virtual void Init( void ); /* late initialization * this needs linked objects to be already loaded */ virtual void Init_Links( void ); // copy this sprite virtual cSprite *Copy( void ); // create from stream virtual void Create_From_Stream( CEGUI::XMLAttributes &attributes ); // save to stream virtual void Save_To_Stream( ofstream &file ); // load from savegame virtual void Load_From_Savegame( cSave_Level_Object *save_object ); // save to savegame virtual cSave_Level_Object *Save_To_Savegame( void ); /* Sets the image for drawing * if new_start_image is set the default start_image will be set to the given image * if del_img is set the given image will be deleted */ virtual void Set_Image( cGL_Surface *new_image, bool new_start_image = 0, bool del_img = 0 ); // Set the sprite type void Set_Sprite_Type( SpriteType ntype ); // Returns the sprite type as string std::string Get_Sprite_Type_String( void ) const; /* Set if the camera should be ignored * default : disabled */ void Set_Ignore_Camera( bool enable = 0 ); // Sets the Position void Set_Pos( float x, float y, bool new_startpos = 0 ); void Set_Pos_X( float x, bool new_startpos = 0 ); void Set_Pos_Y( float y, bool new_startpos = 0 ); // Set if active void Set_Active( bool enabled ); /* Set the shadow * if position is set to 0 the shadow is disabled */ void Set_Shadow( const Color &shadow, float pos ); /* Set the shadow position * if set to 0 the shadow is disabled */ void Set_Shadow_Pos( float pos ); // Set the shadow color void Set_Shadow_Color( const Color &shadow ); // Set image color void Set_Color( Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha = 255 ); void Set_Color( const Color &col ); /* Set a Color Combination ( GL_ADD, GL_MODULATE or GL_REPLACE ) * Addition ( adds white to color ) * 1.0 is the maximum and the given color will be white * 0.0 is the minimum and the color will have the default color * Modulation ( adds black to color ) * 1.0 is the maximum and the color will have the default color * 0.0 is the minimum and the given color will be black * Replace ( replaces color value ) * 1.0 is the maximum and the given color has maximum value * 0.0 is the minimum and the given color has minimum value */ void Set_Color_Combine( float red, float green, float blue, GLint com_type ); /* Set if rotation affects the collision rect * only supports 90° steps currently * if enabled col_pos, col_rect and rect must be reset manually before changing rotation */ void Set_Rotation_Affects_Rect( bool enable = 0 ); /* Set the rect rotation * does not reset col_pos, col_rect and rect before rotation * default : disabled */ void Update_Rect_Rotation( void ); // Set the X rect rotation void Update_Rect_Rotation_X( void ); // Set the Y rect rotation void Update_Rect_Rotation_Y( void ); // Set the Z rect rotation void Update_Rect_Rotation_Z( void ); // Set the X rotation void Set_Rotation_X( float rot, bool new_start_rot = 0 ); // Set the Y rotation void Set_Rotation_Y( float rot, bool new_start_rot = 0 ); // Set the Z rotation void Set_Rotation_Z( float rot, bool new_start_rot = 0 ); // Set the rotation void Set_Rotation( float x, float y, float z, bool new_start_rot = 0 ); // Add X rotation void Add_Rotation_X( float rot ); // Add Y rotation void Add_Rotation_Y( float rot ); // Add Z rotation void Add_Rotation_Z( float rot ); // Add rotation void Add_Rotation( float x, float y, float z ); /* Set if scale affects the collision rect * if enabled previous scale is always undone from rect before setting the new value * default : disabled */ void Set_Scale_Affects_Rect( bool enable = 0 ); /* Set which directions of the image get scaled * if all are set scaling is centered and if all are not set scaling is disabled * todo : if enabled with scale_affects_rect it should also scale the rect position */ void Set_Scale_Directions( bool up = 0, bool down = 1, bool left = 0, bool right = 1 ); // Set the scale void Set_Scale_X( const float scale, const bool new_startscale = 0 ); void Set_Scale_Y( const float scale, const bool new_startscale = 0 ); void Set_Scale( const float scale, const bool new_startscale = 0 ); // Add scale void Add_Scale_X( const float val ); void Add_Scale_Y( const float val ); void Add_Scale( const float val ); // Set this sprite on top of the given one void Set_On_Top( const cSprite *sprite, bool optimize_hor_pos = 1 ); /* Move this object * real : if set the speedfactor is not used */ virtual void Move( float move_x, float move_y, const bool real = 0 ); // default collision and movement handling virtual void Collide_Move( void ); // Update the position rect values void Update_Position_Rect( void ); // default update virtual void Update( void ); /* late update * use if it is needed that other objects are already updated */ virtual void Update_Late( void ); // update drawing validation virtual void Update_Valid_Draw( void ); // update updating validation virtual void Update_Valid_Update( void ); /* Draw * if request is NULL automatically creates the request */ virtual void Draw( cSurface_Request *request = NULL ); /* only draws the image * no position nor debug updates */ void Draw_Image( cSurface_Request *request = NULL ) const; /* Set the massive type * should be called after setting the new array */ virtual void Set_Massive_Type( MassiveType mtype ); // Check if this sprite is on top of the given object bool Is_On_Top( const cSprite *obj ) const; // if the sprite is visible on the screen bool Is_Visible_On_Screen( void ) const; // if the Object is in player range bool Is_In_Player_Range( void ) const; // if update is valid for the current state virtual bool Is_Update_Valid( void ); // if draw is valid for the current state and position virtual bool Is_Draw_Valid( void ); /* set this sprite to destroyed and completely disable it * sprite is still in the sprite manager but only to get possibly replaced */ virtual void Destroy( void ); // editor add window object void Editor_Add( const CEGUI::String &name, const CEGUI::String &tooltip, CEGUI::Window *window_setting, float obj_width, float obj_height = 28, bool advance_row = 1 ); // editor activation virtual void Editor_Activate( void ); // editor deactivation virtual void Editor_Deactivate( void ); // editor init virtual void Editor_Init( void ); // editor position update virtual void Editor_Position_Update( void ); // editor state update virtual void Editor_State_Update( void ); // current image used for drawing cGL_Surface *m_image; // editor and first image cGL_Surface *m_start_image; // complete image rect GL_rect m_rect; // editor and first image rect GL_rect m_start_rect; // collision rect GL_rect m_col_rect; // collision start point GL_point m_col_pos; // current position float m_pos_x, m_pos_y, m_pos_z; // start position float m_start_pos_x, m_start_pos_y; /* editor z position * it's only used if not 0 */ float m_editor_pos_z; // if set rotation not only affects the image but also the rectangle bool m_rotation_affects_rect; // editor and start rotation float m_start_rot_x, m_start_rot_y, m_start_rot_z; // rotation float m_rot_x, m_rot_y, m_rot_z; // if set scale not only affects the image but also the rectangle bool m_scale_affects_rect; /* which parts of the image get scaled * if all are set scaling is centered */ bool m_scale_up, m_scale_down, m_scale_left, m_scale_right; // editor and start scale float m_start_scale_x, m_start_scale_y; // scale float m_scale_x, m_scale_y; // color Color m_color; // combine type GLint m_combine_type; // combine color float m_combine_color[3]; // sprite type SpriteType m_type; // sprite array type ArrayType m_sprite_array; // massive collision type MassiveType m_massive_type; // visible name std::string m_name; // sprite editor tags std::string m_editor_tags; // true if not using the camera position bool m_no_camera; // if true we are active and can be updated and drawn bool m_active; // if spawned it shouldn't be saved bool m_spawned; // range to the player to get updates unsigned int m_player_range; // can be used as ground object bool m_can_be_ground; // delete the given image when it gets unloaded bool m_delete_image; /* if true this sprite is ready to be replaced with a later created sprite * and this sprite is not used anywhere anymore * should not be used for objects needed by the editor * should be used for not active spawned objects */ bool m_auto_destroy; // shadow position float m_shadow_pos; // shadow color Color m_shadow_color; // if drawing is valid bool m_valid_draw; // if updating is valid bool m_valid_update; // editor active window list typedef vector<cEditor_Object_Settings_Item *> Editor_Object_Settings_List; Editor_Object_Settings_List m_editor_windows; // width for all name windows based on largest name text width float m_editor_window_name_width; }; typedef vector<cSprite *> cSprite_List; /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ } // namespace SMC #endif
[ [ [ 1, 391 ] ] ]
0fa04a1cb611c59c373f023333fc5d8ee8910e5b
61fb1bf48c8eeeda8ecb2c40fcec1d3277ba6935
/patoGUI/replogdialog.h
fa976e73574ffcf5102dc222e2c4ae4e6f2500df
[]
no_license
matherthal/pato-scm
172497f3e5c6d71a2cbbd2db132282fb36ba4871
ba573dad95afa0c0440f1ae7d5b52a2736459b10
refs/heads/master
2020-05-20T08:48:12.286498
2011-11-25T11:05:23
2011-11-25T11:05:23
33,139,075
0
0
null
null
null
null
UTF-8
C++
false
false
425
h
#ifndef REPLOGDIALOG_H #define REPLOGDIALOG_H #include <QDialog> namespace Ui { class RepLogDialog; } class RepLogDialog : public QDialog { Q_OBJECT public: explicit RepLogDialog(QWidget *parent = 0); ~RepLogDialog(); private slots: void populatingLogExample(); void showMessage(); void showChanges(); private: Ui::RepLogDialog *ui; }; #endif // RepLogDialog_H
[ "rafael@Micro-Mariana" ]
[ [ [ 1, 26 ] ] ]
4e15f8b21b5895d1d426b92d1f1fdca179410564
279b68f31b11224c18bfe7a0c8b8086f84c6afba
/playground/barfan/0.0.1-DEV-02/log_initializer.hpp
b5a486096033a0d78dcfb9abbb0a3de608bba69b
[]
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
991
hpp
#ifndef LOG_INITIALIZER_HPP #define LOG_INITIALIZER_HPP // include log4cxx header files. #include "log4cxx/logger.h" #include "log4cxx/basicconfigurator.h" #include "log4cxx/propertyconfigurator.h" #include "log4cxx/helpers/exception.h" namespace findik { class log_initializer { public: //constructer initialize logger log_initializer(void); //load conf from log4j conf file bool load_conf(std::string conf_file); //reload conf bool reload_conf(void); //reset logging globally static void reset(void); //shutdown logging globally static void shutdown(void); //destructor ~log_initializer(void); //global user logger static log4cxx::LoggerPtr user_logger; //global debug logger static log4cxx::LoggerPtr debug_logger; //global filter logger static log4cxx::LoggerPtr filter_logger; private: //log4j file name std::string conf_file; }; } #endif // LOG_INITIALIZER_HPP
[ "barfan@d40773b4-ada0-11de-b0a2-13e92fe56a31" ]
[ [ [ 1, 49 ] ] ]
ad3a45454b42e1b296680a4bb45609b37f25ad75
a473bf3be1f1cda62b1d0dc23292fbf7ec00dcee
/inc/style.h
5d3572d97c4638a8b58a26ac6d72c2f588bdc219
[]
no_license
SymbiSoft/htmlcontrol-for-symbian
23821e9daa50707b1d030960e1c2dcf59633a335
504ca3cb3cf4baea3adc5c5b44e8037e0d73c3bb
refs/heads/master
2021-01-10T15:04:51.760462
2009-08-14T05:40:14
2009-08-14T05:40:14
48,186,784
1
0
null
null
null
null
UTF-8
C++
false
false
7,297
h
#ifndef HCSTYLE_H #define HCSTYLE_H #include <babitflags.h> #include <gdi.h> #include <gulutil.h> #include <gulalign.h> #include "htmlcontrol.hrh" class CHcImage; class CHcStyleSheet; enum THcOverflow { EOverflowHidden, EOverflowVisible, EOverflowAuto, EOverflowScroll }; enum THcLocationType { ELTFileGeneral, ELTFileMbm, ELTFileSvg, ELTAppIcon, ELTGradient, ELTSkin, ELTFrame, ELTIcon }; typedef TGulVAlignment TVAlign; enum THcLineWrap { ELWAuto, ELWClip, ELWScroll }; enum THcPosition { EPosRelative, EPosAbsolute }; enum THcClear { EClearNone, EClearLeft, EClearRight, EClearBoth }; enum THcDisplay { EDisplayBlock, EDisplayNone }; class THcLength { public: enum TValueType { ELenVTAbsolute, ELenVTRelative, ELenVTPercent, ELenVTAuto }; TValueType iValueType; TInt iValue; THcLength() { iValueType = ELenVTAbsolute; iValue = 0; } inline TBool operator==(const THcLength& aLength) const { return iValueType==aLength.iValueType && iValue==aLength.iValue; } TInt GetRealValue(TInt aMaxValue, TInt aAutoValue) const; }; class THcColor { public: TRgb iRgb; TInt iIndex1; TInt iIndex2; THcColor() { iIndex1 = 0; iIndex2 = 0; } inline TBool operator==(const THcColor& aColor) const { return iRgb==aColor.iRgb && iIndex1==aColor.iIndex1 && iIndex2==aColor.iIndex2; } inline TBool IsNone() const { return iIndex1==-1 && iIndex2==-1; } TRgb Rgb() const; }; class THcBorder { public: enum TBorderStyle { ENone, ESolid, EDotted, EDashed, EOutset, EInset }; TInt iWidth; TRgb iColor; TBorderStyle iStyle; THcBorder() { iWidth = 0; iColor = KRgbBlack; iStyle = ESolid; } TBool operator==( const THcBorder& aBorder) const { return iWidth==aBorder.iWidth && iColor==aBorder.iColor && iStyle==aBorder.iStyle; } }; class THcBorders { public: enum TBorderId { EBorderLeft, EBorderRight, EBorderTop, EBorderBottom }; THcBorder iTop; THcBorder iRight; THcBorder iBottom; THcBorder iLeft; TBitFlags8 iMask; void ShrinkRect(TRect& aRect) const; void Add(const THcBorders& aBorders); inline TBool IsEmpty() const { return iMask.iFlags==0; } inline void Clear() { iMask.ClearAll(); } }; class THcMargins { public: enum TMarginId { EMarginLeft, EMarginRight, EMarginTop, EMarginBottom }; THcLength iLeft; THcLength iRight; THcLength iTop; THcLength iBottom; TBitFlags8 iMask; void ShrinkRect(TRect& aRect) const; void GrowRect(TRect& aRect) const; void Add(const THcMargins& aMargins); TBool GetAlign(TAlign& aAlign) const; TBool GetVAlign(TVAlign& aVAlign) const; TMargins GetMargins(const TSize& aSize) const; inline TBool IsEmpty() const { return iMask.iFlags==0; } inline void Clear() { iMask.ClearAll(); } }; class THcImageLocation { public: THcLocationType iType; TFileName iFileName; TInt iIndex1; TInt iIndex2; TInt iIndex3; TBool iValid; THcImageLocation() { iFileName.Zero(); iIndex1 = 0; iIndex2 = 0; iIndex3 = 0; iType = ELTFileGeneral; iValid = EFalse; } TBool operator==( const THcImageLocation& aLocation) const { return iType==aLocation.iType && iIndex1==aLocation.iIndex1 && iIndex2==aLocation.iIndex2 && iIndex3==aLocation.iIndex3 && iFileName.Compare(aLocation.iFileName)==0; } }; class THcBackgroundPosition { public: THcLength iX; THcLength iY; TAlign iAlign; TVAlign iVAlign; TBool iStretch; void Clear() { iX.iValueType = THcLength::ELenVTAbsolute; iX.iValue = 0; iY.iValueType = THcLength::ELenVTAbsolute; iY.iValue = 0; iAlign = ELeft; iVAlign = EVTop; iStretch = EFalse; } }; class THcBackgroundPattern { public: CGraphicsContext::TBrushStyle iStyle; TRgb iColor; THcBackgroundPattern() { iStyle = CGraphicsContext::ENullBrush; } }; class THcTextStyle { public: enum TTextStyleId { EColor, EBackColor, ESize, EFamily, ELineHeight, EAlign, EBorder, EBold, EItalics, EUnderline, ELineThrough, ESub, ESup }; inline void Set(TTextStyleId aStyleId) { iMask.Set(aStyleId); } inline TBool IsSet(TTextStyleId aStyleId) const { return iMask.IsSet(aStyleId); } inline void Clear(TTextStyleId aStyleId) { iMask.Clear(aStyleId); } inline void ClearAll() { iMask.ClearAll(); } inline TBool IsEmpty() const { return iMask.iFlags==0; } inline TInt GetLineHeight(TInt aFontHeight) const { if(iMask.IsSet(ELineHeight)) { TInt ret = iLineHeight.GetRealValue(aFontHeight, aFontHeight); return ret==0?(aFontHeight + 4):ret; } else return aFontHeight + 4; } void Add(const THcTextStyle& aStyle); TBool operator==(const THcTextStyle& aStyle) const; TInt FontMatchCode() const; CFont* CreateFont() const; public: THcColor iColor; THcColor iBackColor; TInt iSize; TInt iFamily; THcLength iLineHeight; TAlign iAlign; THcBorder iBorder; private: TBitFlags16 iMask; }; class CHcStyle : public CBase { public: enum TStyleId { EPosition, ELeft, ETop, EWidth, EHeight, EMaxWidth, EBackColor, EBackImage, EBackPattern, EBackPosition, EBackRepeatX, EBackRepeatY, ECorner, EAlign, EClear, EOverflow, EHidden, EDisplay, EFaded, EOpacity, EScale9Grid }; inline void Set(TStyleId aStyleId) { iMask.Set(aStyleId); } inline TBool IsSet(TStyleId aStyleId) const { return iMask.IsSet(aStyleId); } inline void Clear(TStyleId aStyleId) { iMask.Clear(aStyleId); } void Add(const CHcStyle& aStyle); void ClearAll(); TBool IsEmpty() const; ~CHcStyle(); void SetBackgroundImageL(const THcImageLocation& aLocation); inline CHcImage* BackgroundImage() const; inline TBool IsDisplayNone() const; inline TBool IsHidden() const; inline TBool IsClearLeft() const; inline TBool IsClearRight() const; public: THcTextStyle iTextStyle; THcColor iBackColor; THcBackgroundPattern iBackPattern; THcBackgroundPosition iBackPosition; THcPosition iPosition; THcLength iLeft; THcLength iTop; THcLength iWidth; THcLength iHeight; THcLength iMaxWidth; TSize iCorner; TAlign iAlign; THcOverflow iOverflow; TUint8 iOpacity; TRect iScale9Grid; THcClear iClear; THcDisplay iDisplay; TBool iHidden; TBool iFaded; THcBorders iBorders; THcMargins iMargins; THcMargins iPaddings; private: TBitFlags32 iMask; CHcImage* iBackImage; }; inline CHcImage* CHcStyle::BackgroundImage() const { return iBackImage; } inline TBool CHcStyle::IsDisplayNone() const { return IsSet(EDisplay) && iDisplay==EDisplayNone; } inline TBool CHcStyle::IsHidden() const { return IsSet(EHidden) && iHidden; } inline TBool CHcStyle::IsClearLeft() const { return IsSet(EClear) && (iClear==EClearLeft || iClear==EClearBoth); } inline TBool CHcStyle::IsClearRight() const { return IsSet(EClear) && (iClear==EClearRight || iClear==EClearBoth); } #endif
[ "gzytom@0e8b9480-e87f-11dd-80ed-bda8ba2650cd" ]
[ [ [ 1, 447 ] ] ]
b8b76a3148461c84a9f5438f24216b6273769d52
94c1c7459eb5b2826e81ad2750019939f334afc8
/source/CAlertSetAdditional.h
421bff4661db0eeef590091f065f1e7dfdf6605a
[]
no_license
wgwang/yinhustock
1c57275b4bca093e344a430eeef59386e7439d15
382ed2c324a0a657ddef269ebfcd84634bd03c3a
refs/heads/master
2021-01-15T17:07:15.833611
2010-11-27T07:06:40
2010-11-27T07:06:40
37,531,026
1
3
null
null
null
null
UTF-8
C++
false
false
1,017
h
#if !defined(AFX_ALERTSETADDITIONAL_H__F218F664_69E0_11D4_970C_0080C8D6450E__INCLUDED_) #define AFX_ALERTSETADDITIONAL_H__F218F664_69E0_11D4_970C_0080C8D6450E__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class CAlertSetAdditional : public CDialog { public: CAlertSetAdditional(CWnd* pParent = NULL); //{{AFX_DATA(CAlertSetAdditional) enum { IDD = IDD_ALARM_ADDED_CASE }; CButtonST m_ok; CButtonST m_cancel; BOOL m_bSound; BOOL m_bContinueWatch; BOOL m_bMessageBox; //}}AFX_DATA //{{AFX_VIRTUAL(CAlertSetAdditional) protected: virtual void DoDataExchange(CDataExchange* pDX); //}}AFX_VIRTUAL protected: //{{AFX_MSG(CAlertSetAdditional) virtual void OnOK(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_ALERTSETADDITIONAL_H__F218F664_69E0_11D4_970C_0080C8D6450E__INCLUDED_)
[ [ [ 1, 45 ] ] ]
3669a1ff26dce097ee74d5964bbb4a3c036586c6
8ce47e73afa904a145a1104fa8eaa71e3a237907
/Robot/controller/NXTBluetooth/adc_8591.h
9393796bc1e06a0c6ca06cdc21c42ff30224236c
[]
no_license
nobody/magiclegoblimps
bc4f1459773773599ec397bdd1a43b1c341ff929
d66fe634cc6727937a066118f25847fa7d71b8f6
refs/heads/master
2021-01-23T15:42:15.729310
2010-05-05T03:15:00
2010-05-05T03:15:00
39,790,220
1
0
null
null
null
null
UTF-8
C++
false
false
2,000
h
#ifndef ADC_PCF8591 #define ADC_PCF8591 #include <iostream> #include <string> #include "connection.h" #include "I2C.h" #include "dllexport.h" /** * Class to retrieve ADC port reading from the the PCF8591 ADC chip/sensor * @see Adc_8591#read */ class DllExport Adc_ports : public Result{ public: Adc_ports(){} /** * Holds 8 bit value from port 0 */ unsigned int port0; /** * Holds 8 bit value from port 1 */ unsigned int port1; /** * Holds 8 bit value from port 2 */ unsigned int port2; /** * Holds 8 bit value from port 3 */ unsigned int port3; Result_type get_type(){return ADC_RESULT;} }; using namespace std; /** * Class for the PCF8591 8-bit A/D D/A converter (D/A feurures not implemented yet!) */ class DllExport Adc_8591: public I2c{ public: /** * Constructor for the PCF8591 ADC chip * @param port [which sensor port to use] * @param *connection [attach a connection] * @param i2c_address [set the I2C address of the chip] */ Adc_8591(Sensor_port port, Connection *connection, unsigned char i2c_address); ~Adc_8591(); /** * Initiate the sensor * @param reply [true = require reply from NXT; false = no reply from NXT] */ void init(bool reply=false); /** * Get value from all four AD ports * @param &result [must be of type Adc_ports - values are "stored" in result] * @see Adc_ports */ int read(Result &result); /** * Get the sensor type * @return ADC_8591_SENSOR */ Sensor_type get_type(); /** * Get the sensor reading as a string * (init method will be called if the sensor has not been initialized) * @return sensor reading as a string - "P0='some value' P1='some value' P2='some value' P3='some value'" */ string print(); private: int get_port_reading(unsigned int port); }; #endif
[ "eXceLynX@445d4ad4-0937-11df-b996-818f58f34e26" ]
[ [ [ 1, 82 ] ] ]
322b35aca07b9307222a4aa38c46b39b5c09d8c1
619941b532c6d2987c0f4e92b73549c6c945c7e5
/Stellar_/code/Render/apprender/renderapplication.cc
25b9d7d3c00d484b697e2756133d1657a3b95597
[]
no_license
dzw/stellarengine
2b70ddefc2827be4f44ec6082201c955788a8a16
2a0a7db2e43c7c3519e79afa56db247f9708bc26
refs/heads/master
2016-09-01T21:12:36.888921
2008-12-12T12:40:37
2008-12-12T12:40:37
36,939,169
0
0
null
null
null
null
UTF-8
C++
false
false
12,887
cc
//------------------------------------------------------------------------------ // renderapplication.cc // (C) 2007 Radon Labs GmbH //------------------------------------------------------------------------------ #include "stdneb.h" #include "apprender/renderapplication.h" //#include "scripting/lua/luaserver.h" #include "io/filestream.h" //#include "commands/iolibrary.h" //#include "commands/stdlibrary.h" //#include "resources/simpleresourcemapper.h" #include "coregraphics/texture.h" //#include "coregraphics/mesh.h" //#include "coregraphics/streamtextureloader.h" //#include "coregraphics/streammeshloader.h" //#include "resources/managedtexture.h" //#include "resources/managedmesh.h" #include "frame/frameserver.h" //#include "coregraphics/debug/displaypagehandler.h" //#include "coregraphics/debug/texturepagehandler.h" //#include "coregraphics/debug/meshpagehandler.h" //#include "coregraphics/debug/shaderpagehandler.h" //#include "scripting/debug/scriptingpagehandler.h" //#include "io/debug/iopagehandler.h" //#include "memory/debug/memorypagehandler.h" //#include "core/debug/corepagehandler.h" namespace App { using namespace Core; using namespace Util; using namespace Math; using namespace IO; //using namespace Interface; //using namespace Scripting; using namespace CoreGraphics; using namespace Resources; //using namespace Models; //using namespace Graphics; //using namespace Lighting; //using namespace Input; //using namespace Frame; //using namespace Http; using namespace Timing; //------------------------------------------------------------------------------ /** */ RenderApplication::RenderApplication() : time(0.0), frameTime(0.0), quitRequested(false) { // empty } //------------------------------------------------------------------------------ /** */ RenderApplication::~RenderApplication() { s_assert(!this->IsOpen()); } //------------------------------------------------------------------------------ /** */ bool RenderApplication::Open() { s_assert(!this->IsOpen()); if (Application::Open()) { // setup core subsystem //this->coreServer = CoreServer::Create(); //this->coreServer->SetCompanyName(this->companyName); //this->coreServer->SetAppName(this->appName); //this->coreServer->Open(); //// setup io subsystem //this->ioServer = IoServer::Create(); //this->ioServer->RegisterUriScheme("file", FileStream::RTTI); //this->ioServer->SetAssign(Assign("shd", "home:export/shaders")); //this->ioServer->SetAssign(Assign("frame", "home:export/frame")); //this->ioServer->SetAssign(Assign("msh", "home:export/meshes")); //this->ioServer->SetAssign(Assign("tex", "home:export/textures")); //this->ioServer->SetAssign(Assign("ani", "home:export/anims")); //this->ioServer->SetAssign(Assign("mdl", "home:export/gfxlib")); //// Nebul2 backward compat assigns: //this->ioServer->SetAssign(Assign("meshes", "home:export/meshes")); //this->ioServer->SetAssign(Assign("textures", "home:export/textures")); //this->ioServer->SetAssign(Assign("anims", "home:export/anims")); //this->ioInterface = IOInterface::Create(); //this->ioInterface->Open(); //// mount asset zip archives //if (IoServer::Instance()->FileExists("home:export.zip")) //{ // // main thread // this->ioServer->MountZipArchive("home:export.zip"); // // io thread // Ptr<Interface::MountZipArchive> mountZipArchiveMsg = Interface::MountZipArchive::Create(); // mountZipArchiveMsg->SetURI("home:export.zip"); // this->ioInterface->Send(mountZipArchiveMsg.upcast<Messaging::Message>()); //} //// setup debug http server //this->httpServer = HttpServer::Create(); //this->httpServer->Open(); //this->httpServer->AttachRequestHandler(Debug::MemoryPageHandler::Create()); //this->httpServer->AttachRequestHandler(Debug::CorePageHandler::Create()); //this->httpServer->AttachRequestHandler(Debug::IoPageHandler::Create()); //this->httpServer->AttachRequestHandler(Debug::ScriptingPageHandler::Create()); //this->httpServer->AttachRequestHandler(Debug::DisplayPageHandler::Create()); //this->httpServer->AttachRequestHandler(Debug::TexturePageHandler::Create()); //this->httpServer->AttachRequestHandler(Debug::MeshPageHandler::Create()); //this->httpServer->AttachRequestHandler(Debug::ShaderPageHandler::Create()); //// setup scripting subsystem //this->scriptServer = LuaServer::Create(); //this->scriptServer->Open(); //Commands::IOLibrary::Register(); //Commands::StdLibrary::Register(); // setup core graphics subsystem this->displayDevice = DisplayDevice::Create(); this->OnConfigureDisplayDevice(); if (!this->displayDevice->Open()) { s_error("RenderApplication: Failed to open display device!"); return false; } this->renderDevice = RenderDevice::Create(); if (!this->renderDevice->Open()) { s_error("RenderApplication: Failed to open render device!"); return false; } //this->vertexLayoutServer = VertexLayoutServer::Create(); //this->vertexLayoutServer->Open(); //this->transformDevice = TransformDevice::Create(); //this->transformDevice->Open(); //this->shaderServer = ShaderServer::Create(); //this->shaderServer->Open(); //this->shapeRenderer = ShapeRenderer::Create(); //this->shapeRenderer->Open(); //// setup resource subsystem //this->sharedResourceServer = SharedResourceServer::Create(); //this->sharedResourceServer->Open(); //this->resourceManager = ResourceManager::Create(); //this->resourceManager->Open(); //// setup frame server //this->frameServer = FrameServer::Create(); //this->frameServer->Open(); //// setup resource mapper for textures //Ptr<SimpleResourceMapper> texMapper = SimpleResourceMapper::Create(); //texMapper->SetPlaceholderResourceId(ResourceId("tex:system/placeholder.dds")); //texMapper->SetResourceClass(Texture::RTTI); //texMapper->SetResourceLoaderClass(StreamTextureLoader::RTTI); //texMapper->SetManagedResourceClass(ManagedTexture::RTTI); //this->resourceManager->AttachMapper(texMapper.upcast<ResourceMapper>()); //// setup resource mapper for meshes //Ptr<SimpleResourceMapper> meshMapper = SimpleResourceMapper::Create(); //meshMapper->SetPlaceholderResourceId(ResourceId("msh:system/placeholder_s_0.nvx2")); //meshMapper->SetResourceClass(Mesh::RTTI); //meshMapper->SetResourceLoaderClass(StreamMeshLoader::RTTI); //meshMapper->SetManagedResourceClass(ManagedMesh::RTTI); //this->resourceManager->AttachMapper(meshMapper.upcast<ResourceMapper>()); //// setup input subsystem //this->inputServer = InputServer::Create(); //this->inputServer->Open(); // //// setup model server //this->modelServer = ModelServer::Create(); //this->modelServer->Open(); //// setup graphics subsystem //this->graphicsServer = GraphicsServer::Create(); //this->graphicsServer->Open(); // setup lighting subsystem //this->lightServer = LightServer::Create(); //this->lightServer->Open(); //this->shadowServer = ShadowServer::Create(); //this->shadowServer->Open(); // setup frame timer this->timer.Start(); this->time = 0.0; this->frameTime = 0.01; return true; } return false; } //------------------------------------------------------------------------------ /** */ void RenderApplication::OnConfigureDisplayDevice() { // display adapter Adapter::Code adapter = Adapter::Primary; if (this->args.HasArg("-adapter")) { adapter = Adapter::FromString(this->args.GetString("-adapter")); if (this->displayDevice->AdapterExists(adapter)) { this->displayDevice->SetAdapter(adapter); } } // display mode DisplayMode displayMode; if (this->args.HasArg("-x")) { displayMode.SetXPos(this->args.GetInt("-x")); } if (this->args.HasArg("-y")) { displayMode.SetYPos(this->args.GetInt("-y")); } if (this->args.HasArg("-w")) { displayMode.SetWidth(this->args.GetInt("-w")); } if (this->args.HasArg("-h")) { displayMode.SetHeight(this->args.GetInt("-h")); } this->displayDevice->SetDisplayMode(displayMode); this->displayDevice->SetFullscreen(this->args.GetBool("-fullscreen")); this->displayDevice->SetAlwaysOnTop(this->args.GetBool("-alwaysontop")); this->displayDevice->SetVerticalSyncEnabled(this->args.GetBool("-vsync")); if (this->args.HasArg("-aa")) { this->displayDevice->SetAntiAliasQuality(AntiAliasQuality::FromString(this->args.GetString("-aa"))); } // window title if (this->args.HasArg("-windowtitle")) { this->displayDevice->SetWindowTitle(this->args.GetString("-windowtitle")); } else { this->displayDevice->SetWindowTitle("Setllar Viewer"); } } //------------------------------------------------------------------------------ /** */ void RenderApplication::Close() { s_assert(this->IsOpen()); /*this->shadowServer->Close(); this->shadowServer = 0; this->lightServer->Close(); this->lightServer = 0; this->graphicsServer->Close(); this->graphicsServer = 0; this->modelServer->Close(); this->modelServer = 0; this->resourceManager->Close(); this->resourceManager = 0; this->inputServer->Close(); this->inputServer = 0; this->frameServer->Close(); this->frameServer = 0; this->sharedResourceServer->Close(); this->sharedResourceServer = 0; this->shapeRenderer->Close(); this->shapeRenderer = 0;*/ this->shaderServer->Close(); this->shaderServer = 0; this->transformDevice->Close(); this->transformDevice = 0; /*this->vertexLayoutServer->Close(); this->vertexLayoutServer = 0;*/ this->renderDevice->Close(); this->renderDevice = 0; this->displayDevice->Close(); this->displayDevice = 0; /*this->scriptServer->Close(); this->scriptServer = 0; this->httpServer->Close(); this->httpServer = 0; this->ioInterface->Close(); this->ioInterface = 0; this->ioServer = 0; this->coreServer->Close(); this->coreServer = 0;*/ Application::Close(); } //------------------------------------------------------------------------------ /** */ void RenderApplication::Run() { s_assert(this->IsOpen()); while (!(this->displayDevice->IsQuitRequested() || this->IsQuitRequested())) { /*this->httpServer->OnFrame(); this->resourceManager->Prepare(); this->inputServer->BeginFrame();*/ this->displayDevice->ProcessWindowMessages(); //this->inputServer->OnFrame(); this->OnProcessInput(); this->UpdateTime(); this->OnUpdateFrame(); if (this->renderDevice->BeginFrame()) { this->OnRenderFrame(); this->renderDevice->EndFrame(); this->renderDevice->Present(); } //this->resourceManager->Update(); //this->inputServer->EndFrame(); } } //------------------------------------------------------------------------------ /** */ void RenderApplication::OnProcessInput() { // empty, override this method in a subclass } //------------------------------------------------------------------------------ /** */ void RenderApplication::OnUpdateFrame() { // empty, override this method in a subclass } //------------------------------------------------------------------------------ /** */ void RenderApplication::OnRenderFrame() { // empty, override this method in a subclass } //------------------------------------------------------------------------------ /** */ void RenderApplication::UpdateTime() { Time curTime = this->timer.GetTime(); this->frameTime = curTime - this->time; this->time = curTime; } } // namespace App
[ "ctuoMail@5f320639-c338-0410-82ad-c55551ec1e38", "ctuomail@5f320639-c338-0410-82ad-c55551ec1e38" ]
[ [ [ 1, 6 ], [ 8, 8 ], [ 12, 12 ], [ 18, 18 ], [ 27, 33 ], [ 36, 37 ], [ 44, 74 ], [ 127, 141 ], [ 188, 189 ], [ 194, 255 ], [ 257, 267 ], [ 269, 292 ], [ 294, 300 ], [ 303, 309 ], [ 311, 320 ], [ 322, 334 ], [ 336, 336 ], [ 338, 338 ], [ 340, 348 ], [ 351, 392 ] ], [ [ 7, 7 ], [ 9, 11 ], [ 13, 17 ], [ 19, 26 ], [ 34, 35 ], [ 38, 43 ], [ 75, 126 ], [ 142, 187 ], [ 190, 193 ], [ 256, 256 ], [ 268, 268 ], [ 293, 293 ], [ 301, 302 ], [ 310, 310 ], [ 321, 321 ], [ 335, 335 ], [ 337, 337 ], [ 339, 339 ], [ 349, 350 ] ] ]
a1121fd9c47f7407792620f37dc23b106669f56b
ac08a3afd8af6177a61cec3e608734aeedcff7c8
/OldCode/SbccMicroMouse/SbccMicroMouse/MazeBuild.cpp
5313000bda5fa962dbdfcbd3b79c48dbd6c18282
[]
no_license
ryanbahneman/ucsb-mm
a048b8d86e6c557a5058383ab537e57466e9d1c4
836041d18c9e9d4ed30a2500ec7dd06f6bab5422
refs/heads/master
2016-09-10T02:08:11.319245
2011-04-15T04:12:38
2011-04-15T04:12:38
32,126,035
0
0
null
null
null
null
UTF-8
C++
false
false
6,625
cpp
#include "MazeBuild.h" int MakeMaze(unsigned int maze[][16], int loops){ //Initialize variables int xCurrent = 0, yCurrent = 0; int xStack[256], yStack[256], stackNum = 0; // populate the maze using the lowest four bits; bits (high -> low): WSEN // (1 - wall, 0 - open) int i, j; for(i = 0; i < SIDE; i++){ for(j = 0; j < SIDE; j++){ maze[i][j] = ALLWALLS; } } //knocks down walls to create a maze BuildMaze(maze, xCurrent, yCurrent, xStack, yStack, stackNum); //Removes all but the wall information for(i = 0; i < SIDE; i++){ for(j = 0; j < SIDE; j++){ maze[i][j] &= ALLWALLS; } } // knock down walls to make loops while(loops > 0){ //pick a random cell int randx = rand()%(SIDE-2) +1; int randy = rand()%(SIDE-2) +1; //pick side to knock down wall int randdir = rand()%4; int exit = 0; do{ // make sure the cell has a wall to be knocked down if(maze[randy][randx] & (1<<((randdir)%4))){ // If it does, then remove the appropriate walls if (randdir%4 == 0){ maze[randy][randx] &= ~NORTH; maze[randy-1][randx] &= ~SOUTH; exit = 1; } else if (randdir%4 == 1){ maze[randy][randx] &= ~EAST; maze[randy][randx+1] &= ~WEST; exit = 1; } else if (randdir%4 == 2){ maze[randy][randx] &= ~SOUTH; maze[randy+1][randx] &= ~NORTH; exit = 1; } else if (randdir%4 == 3){ maze[randy][randx] &= ~WEST; maze[randy][randx-1] &= ~EAST; exit = 1; } } else{// no wall to knock down if (randdir < 10)// termination condition randdir += 1;// try a different direction else{ //the cell has no walls to knock down exit = 1;// pretend it worked loops++;// this prevents infinite loops } } }while(exit == 0); loops -= 1; } //make a wall around the center maze[7][7] = (NORTH | WEST); maze[6][7] |= SOUTH; maze[7][6] |= EAST; maze[7][8] = (NORTH | EAST); maze[6][8] |= SOUTH; maze[7][9] |= WEST; maze[8][7] = (SOUTH | WEST); maze[8][6] |= EAST; maze[9][7] |= NORTH; maze[8][8] = (SOUTH | EAST); maze[8][9] |= WEST; maze[9][8] |= NORTH; // make one exit out of the center int hole = rand()%8; if (hole == 0){ maze[7][7] &= ~NORTH; maze[6][7] &= ~SOUTH; } else if (hole == 1){ maze[7][8] &= ~NORTH; maze[6][8] &= ~SOUTH; } else if (hole == 2){ maze[7][8] &= ~EAST; maze[7][9] &= ~WEST; } else if (hole == 3){ maze[8][8] &= ~EAST; maze[8][9] &= ~WEST; } else if (hole == 4){ maze[8][8] &= ~SOUTH; maze[9][8] &= ~NORTH; } else if (hole == 5){ maze[8][7] &= ~SOUTH; maze[9][7] &= ~NORTH; } else if (hole == 6){ maze[8][7] &= ~WEST; maze[8][6] &= ~EAST; } else if (hole == 7){ maze[7][7] &= ~WEST; maze[7][6] &= ~EAST; } // check to see if the maze is solveable FloodFill(maze, GOALX, GOALY); if((maze[STARTY][STARTX] >> 8) < 255)// a path to the start was found return(EXIT_SUCCESS); //0 else return(EXIT_FAILURE); //1 } void BuildMaze(unsigned int maze[][16], int xCurrent, int yCurrent, int xStack[], int yStack[], int stackNum){ //set the current cell as haveing been traveled maze[yCurrent][xCurrent] |= TRAVELED; int i = 0, dir = 0; //check to see what possible directions it can expand if (yCurrent - 1 >= 0){// if there are cells above the current location if((maze[yCurrent - 1][xCurrent] & TRAVELED) == 0){// if the cell hasn't been traveled dir |= NORTH;// add it to possible directions i+=1;// increment the number of possilbe directions found } } if (xCurrent + 1 < SIDE){ if((maze[yCurrent][xCurrent + 1] & TRAVELED) == 0){ dir |= EAST; i+=1; } if (yCurrent + 1 < SIDE){ if((maze[yCurrent + 1][xCurrent] & TRAVELED) == 0){ dir |= SOUTH; i+=1; } } if (xCurrent - 1 >= 0){ if((maze[yCurrent][xCurrent - 1] & TRAVELED) == 0){ dir |= WEST; i+=1; } } } if (i > 0){//there is an unvisited neighbor //move cell onto stack xStack[stackNum] = xCurrent; yStack[stackNum] = yCurrent; stackNum++; //select a direction int exit = 0; int random = rand()%4; do{ if((1<<(random%4)) & dir){ dir &= (1<<(random%4)); exit =1; // a direction has been picked } else random += 1;// try another direction }while(exit == 0); //knock down walls in the direction chosen and set the current position to the new cell if ( dir == NORTH){ maze[yCurrent][xCurrent] &= ~NORTH;//turn off wall maze[yCurrent - 1][xCurrent] &= ~SOUTH;//turn off wall yCurrent -= 1;//set new cell position } if ( dir == EAST){ maze[yCurrent][xCurrent] &= ~EAST; maze[yCurrent][xCurrent + 1] &= ~WEST; xCurrent += 1; } if ( dir == SOUTH){ maze[yCurrent][xCurrent] &= ~SOUTH; maze[yCurrent + 1][xCurrent] &= ~NORTH; yCurrent += 1; } if ( dir == WEST){ maze[yCurrent][xCurrent] &= ~WEST; maze[yCurrent][xCurrent - 1] &= ~EAST; xCurrent -= 1; } //Recursively calls itself BuildMaze(maze, xCurrent, yCurrent, xStack, yStack, stackNum); } else{// no neighbor if (stackNum > 0){// if there are still cells to be explored //pick the first one off of the stack stackNum -=1; xCurrent = xStack[stackNum]; yCurrent = yStack[stackNum]; //make a recursive call with the new cell BuildMaze(maze, xCurrent, yCurrent, xStack, yStack, stackNum); } } } void InitializeMap(unsigned int map[][16]){ int i, j; for(i = 0; i < SIDE; i++){// for every row for(j = 0; j < SIDE; j++){// for every collumn //add walls if they are on the perimiter if(i == 0){ if (j == 0) map[i][j] = WEST | NORTH; else if (j == SIDE-1) map[i][j] = NORTH | EAST; else map[i][j] = NORTH; } else if(i == SIDE-1){ if (j == 0) map[i][j] = SOUTH | WEST; else if (j == SIDE-1) map[i][j] = SOUTH | EAST; else map[i][j] = SOUTH; } else{ if (j == 0) map[i][j] = WEST; else if (j == SIDE-1) map[i][j] = EAST; else map[i][j] = 0; } } } }
[ "[email protected]@96d5aad7-c30c-027e-2790-660a2b14230a" ]
[ [ [ 1, 270 ] ] ]
9b98a16977248537aad945a84ee0779ac8ef7cf9
c5ecda551cefa7aaa54b787850b55a2d8fd12387
/src/UILayer/TrayMenu/TrayDialog.cpp
12601380cd418fcb0c63461ae4e42ef803f31a24
[]
no_license
firespeed79/easymule
b2520bfc44977c4e0643064bbc7211c0ce30cf66
3f890fa7ed2526c782cfcfabb5aac08c1e70e033
refs/heads/master
2021-05-28T20:52:15.983758
2007-12-05T09:41:56
2007-12-05T09:41:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,736
cpp
//this file is part of eMule //Copyright (C)2002-2006 Merkur ( strEmail.Format("%s@%s", "devteam", "emule-project.net") / http://www.emule-project.net ) // //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., 675 Mass Ave, Cambridge, MA 02139, USA. #include "stdafx.h" #include "emule.h" #include "TrayDialog.h" #include "emuledlg.h" #include "MenuCmds.h" #include "UserMsgs.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #define NOTIFYICONDATA_V1_TIP_SIZE 128 // VC-SearchDream[2006-11-14]:Change from 64 to 128 for bug 0000010 ///////////////////////////////////////////////////////////////////////////// // CTrayDialog dialog const UINT WM_TASKBARCREATED = ::RegisterWindowMessage(_T("TaskbarCreated")); BEGIN_MESSAGE_MAP(CTrayDialog, CTrayDialogBase) ON_WM_CREATE() ON_WM_DESTROY() ON_WM_SYSCOMMAND() ON_MESSAGE(UM_TRAY_ICON_NOTIFY_MESSAGE, OnTrayNotify) ON_REGISTERED_MESSAGE(WM_TASKBARCREATED, OnTaskBarCreated) ON_WM_TIMER() END_MESSAGE_MAP() CTrayDialog::CTrayDialog(UINT uIDD,CWnd* pParent /*=NULL*/) : CTrayDialogBase(uIDD, pParent) { m_nidIconData.cbSize = sizeof(NOTIFYICONDATA); // VC-SearchDream[2006-11-14]: Change from NOTIFYICONDATA_V1_SIZE to NOTIFYICONDATA for bug 0000010 m_nidIconData.hWnd = 0; m_nidIconData.uID = 1; m_nidIconData.uCallbackMessage = UM_TRAY_ICON_NOTIFY_MESSAGE; m_nidIconData.hIcon = 0; m_nidIconData.szTip[0] = _T('\0'); m_nidIconData.uFlags = NIF_MESSAGE; m_bTrayIconVisible = FALSE; m_pbMinimizeToTray = NULL; m_nDefaultMenuItem = 0; m_hPrevIconDelete = NULL; m_bCurIconDelete = false; m_bLButtonDblClk = false; m_bLButtonDown = false; m_bLButtonUp = false; m_uSingleClickTimer = 0; } int CTrayDialog::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CTrayDialogBase::OnCreate(lpCreateStruct) == -1) return -1; ASSERT( WM_TASKBARCREATED ); m_nidIconData.hWnd = m_hWnd; m_nidIconData.uID = 1; return 0; } void CTrayDialog::OnDestroy() { KillSingleClickTimer(); CTrayDialogBase::OnDestroy(); // shouldn't that be done before passing the message to DefWinProc? if (m_nidIconData.hWnd && m_nidIconData.uID > 0 && TrayIsVisible()) { VERIFY( Shell_NotifyIcon(NIM_DELETE, &m_nidIconData) ); } } BOOL CTrayDialog::TrayIsVisible() { return m_bTrayIconVisible; } void CTrayDialog::TraySetIcon(HICON hIcon, bool bDelete) { ASSERT( hIcon ); if (hIcon) { //ASSERT(m_hPrevIconDelete == NULL); if (m_bCurIconDelete) { ASSERT( m_nidIconData.hIcon != NULL && (m_nidIconData.uFlags & NIF_ICON) ); m_hPrevIconDelete = m_nidIconData.hIcon; } m_bCurIconDelete = bDelete; m_nidIconData.hIcon = hIcon; m_nidIconData.uFlags |= NIF_ICON; } } void CTrayDialog::TraySetIcon(UINT nResourceID) { TraySetIcon(AfxGetApp()->LoadIcon(nResourceID)); } void CTrayDialog::TraySetIcon(LPCTSTR lpszResourceName) { TraySetIcon(AfxGetApp()->LoadIcon(lpszResourceName)); } void CTrayDialog::TraySetToolTip(LPCTSTR lpszToolTip) { ASSERT( _tcslen(lpszToolTip) > 0 && _tcslen(lpszToolTip) < NOTIFYICONDATA_V1_TIP_SIZE ); _tcsncpy(m_nidIconData.szTip, lpszToolTip, NOTIFYICONDATA_V1_TIP_SIZE); m_nidIconData.szTip[NOTIFYICONDATA_V1_TIP_SIZE - 1] = _T('\0'); m_nidIconData.uFlags |= NIF_TIP; Shell_NotifyIcon(NIM_MODIFY, &m_nidIconData); } BOOL CTrayDialog::TrayShow() { BOOL bSuccess = FALSE; if (!m_bTrayIconVisible) { bSuccess = Shell_NotifyIcon(NIM_ADD, &m_nidIconData); if (bSuccess) m_bTrayIconVisible = TRUE; } return bSuccess; } BOOL CTrayDialog::TrayHide() { BOOL bSuccess = FALSE; if (m_bTrayIconVisible) { bSuccess = Shell_NotifyIcon(NIM_DELETE, &m_nidIconData); if (bSuccess) m_bTrayIconVisible = FALSE; } return bSuccess; } BOOL CTrayDialog::TrayUpdate() { BOOL bSuccess = FALSE; if (m_bTrayIconVisible) { bSuccess = Shell_NotifyIcon(NIM_MODIFY, &m_nidIconData); if (!bSuccess) { //ASSERT(0); return FALSE; // don't delete 'm_hPrevIconDelete' because it's still attached to the tray } } if (m_hPrevIconDelete != NULL) { VERIFY( ::DestroyIcon(m_hPrevIconDelete) ); m_hPrevIconDelete = NULL; } return bSuccess; } BOOL CTrayDialog::TraySetMenu(UINT nResourceID) { BOOL bSuccess = m_mnuTrayMenu.LoadMenu(nResourceID); ASSERT( bSuccess ); return bSuccess; } BOOL CTrayDialog::TraySetMenu(LPCTSTR lpszMenuName) { BOOL bSuccess = m_mnuTrayMenu.LoadMenu(lpszMenuName); ASSERT( bSuccess ); return bSuccess; } BOOL CTrayDialog::TraySetMenu(HMENU hMenu) { m_mnuTrayMenu.Attach(hMenu); return TRUE; } LRESULT CTrayDialog::OnTrayNotify(WPARAM wParam, LPARAM lParam) { UINT uID = (UINT)wParam; if (uID != 1) return 0; CPoint pt; UINT uMsg = (UINT)lParam; switch (uMsg) { case WM_MOUSEMOVE: GetCursorPos(&pt); ClientToScreen(&pt); OnTrayMouseMove(pt); break; case WM_LBUTTONDOWN: GetCursorPos(&pt); ClientToScreen(&pt); OnTrayLButtonDown(pt); break; case WM_LBUTTONUP: // Handle the WM_LBUTTONUP only if we know that there was also an according // WM_LBUTTONDOWN or WM_LBUTTONDBLCLK on our tray bar icon. If we would handle // WM_LBUTTONUP without checking this, we may get a single WM_LBUTTONUP message // whereby the according WM_LBUTTONDOWN message was meant for some other tray bar // icon. m_bLButtonUp = true; if (m_bLButtonDblClk) { KillSingleClickTimer(); if (!m_bLButtonUp) { if(IsIconic()) { ShowWindow(SW_RESTORE); } else { if(thePrefs.GetCloseMode() == 2) ShowWindow(SW_HIDE); else ShowWindow(SW_MINIMIZE); } } //RestoreWindow(); m_bLButtonDblClk = false; m_bLButtonUp = false; } else if (m_bLButtonDown) { if (m_uSingleClickTimer == 0) { if (!IsWindowVisible()) m_uSingleClickTimer = SetTimer(IDT_SINGLE_CLICK, 300, NULL); } m_bLButtonDown = false; } KillSingleClickTimer(); if (m_bLButtonUp) { if(IsWindowVisible()) { if(IsIconic()) { ShowWindow(SW_RESTORE); } else { if(thePrefs.GetCloseMode() == 2) ShowWindow(SW_HIDE); else ShowWindow(SW_MINIMIZE); } } else { RestoreWindow(); } } if (m_bLButtonDown) { if (m_uSingleClickTimer == 0) { if (!IsWindowVisible()) { m_uSingleClickTimer = SetTimer(IDT_SINGLE_CLICK, 300, NULL); } } } m_bLButtonUp = false; break; case WM_LBUTTONDBLCLK: KillSingleClickTimer(); GetCursorPos(&pt); ClientToScreen(&pt); OnTrayLButtonDblClk(pt); break; case WM_RBUTTONUP: case WM_CONTEXTMENU: KillSingleClickTimer(); GetCursorPos(&pt); //ClientToScreen(&pt); OnTrayRButtonUp(pt);//bond006: systray menu gets stuck (bugfix) break; case WM_RBUTTONDBLCLK: KillSingleClickTimer(); GetCursorPos(&pt); ClientToScreen(&pt); OnTrayRButtonDblClk(pt); break; } return 1; } void CTrayDialog::KillSingleClickTimer() { if (m_uSingleClickTimer) { VERIFY( KillTimer(m_uSingleClickTimer) ); m_uSingleClickTimer = 0; } } void CTrayDialog::OnTimer(UINT nIDEvent) { if (nIDEvent == m_uSingleClickTimer) { OnTrayLButtonUp(CPoint(0, 0)); KillSingleClickTimer(); } CDialogMinTrayBtn<CResizableDialog>::OnTimer(nIDEvent); } void CTrayDialog::OnSysCommand(UINT nID, LPARAM lParam) { if (m_pbMinimizeToTray != NULL && *m_pbMinimizeToTray) { if ((nID & 0xFFF0) == SC_MINIMIZE) { if (TrayShow()) ShowWindow(SW_HIDE); } else CTrayDialogBase::OnSysCommand(nID, lParam); } else if ((nID & 0xFFF0) == MP_MINIMIZETOTRAY) { //if (TrayShow()) ShowWindow(SW_HIDE); } else CTrayDialogBase::OnSysCommand(nID, lParam); } void CTrayDialog::TraySetMinimizeToTray(bool* pbMinimizeToTray) { m_pbMinimizeToTray = pbMinimizeToTray; } void CTrayDialog::TrayMinimizeToTrayChange() { if (m_pbMinimizeToTray == NULL) return; if (*m_pbMinimizeToTray) MinTrayBtnHide(); else MinTrayBtnShow(); } void CTrayDialog::OnTrayRButtonUp(CPoint /*pt*/) { } void CTrayDialog::OnTrayLButtonDown(CPoint /*pt*/) { m_bLButtonDown = true; } void CTrayDialog::OnTrayLButtonUp(CPoint /*pt*/) { } void CTrayDialog::OnTrayLButtonDblClk(CPoint /*pt*/) { m_bLButtonDblClk = true; } void CTrayDialog::OnTrayRButtonDblClk(CPoint /*pt*/) { } void CTrayDialog::OnTrayMouseMove(CPoint /*pt*/) { } LRESULT CTrayDialog::OnTaskBarCreated(WPARAM /*wParam*/, LPARAM /*lParam*/) { if (m_bTrayIconVisible) { BOOL bResult = Shell_NotifyIcon(NIM_ADD, &m_nidIconData); if (!bResult) m_bTrayIconVisible = false; } return 0; } void CTrayDialog::RestoreWindow() { ShowWindow(SW_SHOW); }
[ "LanceFong@4a627187-453b-0410-a94d-992500ef832d" ]
[ [ [ 1, 420 ] ] ]
1cd9037f47aece48243c544d2d10f97bad5babea
138a353006eb1376668037fcdfbafc05450aa413
/source/ogre/OgreNewt/boost/mpl/vector/aux_/size.hpp
94a5c96d56f0883f876c9c810498851baf8d8c71
[]
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
1,263
hpp
#ifndef BOOST_MPL_VECTOR_AUX_SIZE_HPP_INCLUDED #define BOOST_MPL_VECTOR_AUX_SIZE_HPP_INCLUDED // Copyright Aleksey Gurtovoy 2000-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/vector/aux_/size.hpp,v $ // $Date: 2006/04/17 23:49:48 $ // $Revision: 1.1 $ #include <boost/mpl/size_fwd.hpp> #include <boost/mpl/vector/aux_/O1_size.hpp> #include <boost/mpl/vector/aux_/tag.hpp> #include <boost/mpl/aux_/config/typeof.hpp> #include <boost/mpl/aux_/config/ctps.hpp> namespace boost { namespace mpl { #if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES) template<> struct size_impl< aux::vector_tag > : O1_size_impl< aux::vector_tag > { }; #else #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) template< long N > struct size_impl< aux::vector_tag<N> > : O1_size_impl< aux::vector_tag<N> > { }; #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION #endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES }} #endif // BOOST_MPL_VECTOR_AUX_SIZE_HPP_INCLUDED
[ "Sonicma7@0822fb10-d3c0-11de-a505-35228575a32e" ]
[ [ [ 1, 49 ] ] ]
46cddc438720be785dab8955f9ca6962a489b6ca
23df069203762da415d03da6f61cdf340e84307b
/2009-2010/winter10/csci245/archive/listsfinal/number.cpp
93475df7ce095e4ad1cd9694d43f25faf786d2c3
[]
no_license
grablisting/ray
9356e80e638f3a20c5280b8dba4b6577044d4c6e
967f8aebe2107c8052c18200872f9389e87d19c1
refs/heads/master
2016-09-10T19:51:35.133301
2010-09-29T13:37:26
2010-09-29T13:37:26
null
0
0
null
null
null
null
UTF-8
C++
false
false
365
cpp
#include <iostream> #include "number.h" using namespace std; void Number::read(istream& in) { char ch = in.peek(); while(!isspace(ch) && (ch != '(') && (ch != ')')) { in.get(ch); name.push_back(ch); ch = in.peek(); } } void Number::print(ostream& out) { for (unsigned int i = 0; i < name.length(); i++) { cout << name[i]; } }
[ "Bobbbbommmbb@Bobbbbommmbb-PC.(none)", "[email protected]" ]
[ [ [ 1, 22 ] ], [ [ 23, 23 ] ] ]
adcdbcdd244537bcb2ced326360a2ed587921dc3
abafdd61ea123f3e90deb02fe5709951b453eec6
/fuzzy/patl/impl/node.hpp
ecf3882a7fbf120837c4a07ed8c88c8e02695a48
[ "BSD-3-Clause" ]
permissive
geoiq/geojoin-ruby
8a6a07938fe3d629de74aac50e61eb8af15ab027
247a80538c4fc68c365e71f9014b66d3c38526c1
refs/heads/master
2016-09-06T15:22:47.436634
2010-08-11T13:00:24
2010-08-11T13:00:24
13,863,658
2
0
null
null
null
null
UTF-8
C++
false
false
6,058
hpp
#ifndef PATL_IMPL_NODE_HPP #define PATL_IMPL_NODE_HPP #include <algorithm> #include "../config.hpp" namespace uxn { namespace patl { namespace impl { /// Base class of PATRICIA node template <typename Node> class node_generic { typedef Node node_type; public: /// return parent node const node_type *get_parent() const { #ifdef PATL_ALIGNHACK return reinterpret_cast<const node_type*>(parentid_ & ~word_t(1)); #else return parent_; #endif } node_type *get_parent() { #ifdef PATL_ALIGNHACK return reinterpret_cast<node_type*>(parentid_ & ~word_t(1)); #else return parent_; #endif } /// return node id relate to parent word_t get_parent_id() const { #ifdef PATL_ALIGNHACK return parentid_ & word_t(1); #else return tagsid_ >> 2 & word_t(1); #endif } /// return child node by id const node_type *get_xlink(word_t id) const { #ifdef PATL_ALIGNHACK return reinterpret_cast<const node_type*>(linktag_[id] & ~word_t(1)); #else return link_[id]; #endif } node_type *get_xlink(word_t id) { #ifdef PATL_ALIGNHACK return reinterpret_cast<node_type*>(linktag_[id] & ~word_t(1)); #else return link_[id]; #endif } /// return tag of child node by id word_t get_xtag(word_t id) const { #ifdef PATL_ALIGNHACK return linktag_[id] & word_t(1); #else return tagsid_ >> id & word_t(1); #endif } /// return the number of distinction bit word_t get_skip() const { return skip_; } /// set parent info void set_parentid(node_type *parent, word_t id) { #ifdef PATL_ALIGNHACK parentid_ = reinterpret_cast<word_t>(parent) | id; #else parent_ = parent; tagsid_ &= 3; tagsid_ |= id << 2; #endif } /// set child info by id void set_xlinktag(word_t id, const node_type *link, word_t tag) { #ifdef PATL_ALIGNHACK linktag_[id] = reinterpret_cast<word_t>(link) | tag; #else link_[id] = const_cast<node_type*>(link); tagsid_ &= ~(1 << id); tagsid_ |= tag << id; #endif } /// set the number of distinction bit void set_skip(word_t skip) { skip_ = skip; } /// root special initialization void init_root() { set_parentid(0, 0); // skip = -1 set_skip(~word_t(0)); // left link self-pointed (root) set_xlinktag(0, static_cast<node_type*>(this), 1); // right link null-pointed (end) set_xlinktag(1, 0, 1); } /// for debug only bool integrity() const { const word_t skip = get_skip(), tag0 = get_xtag(0), tag1 = get_xtag(1); const node_type *p0 = get_xlink(0), *p1 = get_xlink(1); return skip == ~word_t(0) && p1 == 0 && get_parent() == 0 && get_parent_id() == 0 || !tag0 && p0->get_parent() == this && !p0->get_parent_id() && skip < p0->get_skip() || !tag1 && p1->get_parent() == this && p1->get_parent_id() && skip < p1->get_skip() || tag0 && tag1; } /// for debug only const char *visualize(const node_type *id0) const { static char buf[256]; sprintf(buf, "%d skip: %d pt: %d ptId: %d lnk0: %d tag0: %d lnk1: %d tag1: %d\n", this - id0, get_skip(), get_parent() - id0, get_parent_id(), get_xlink(0) - id0, get_xtag(0), get_xlink(1) - id0, get_xtag(1)); return buf; } /// change the root void make_root(node_type *old_root) { std::swap(skip_, old_root->skip_); #ifdef PATL_ALIGNHACK std::swap(parentid_, old_root->parentid_); std::swap(linktag_[0], old_root->linktag_[0]); std::swap(linktag_[1], old_root->linktag_[1]); #else std::swap(parent_, old_root->parent_); std::swap(link_[0], old_root->link_[0]); std::swap(link_[1], old_root->link_[1]); std::swap(tagsid_, old_root->tagsid_); #endif old_root->get_parent()->set_xlinktag(old_root->get_parent_id(), old_root, 0); if (!old_root->get_xtag(0)) old_root->get_xlink(0)->set_parentid(old_root, 0); if (!old_root->get_xtag(1)) old_root->get_xlink(1)->set_parentid(old_root, 1); get_xlink(0)->set_parentid(reinterpret_cast<node_type*>(this), 0); } /// copy data members from right except value_ void set_all_but_value(const node_type *right) { skip_ = right->skip_; #ifdef PATL_ALIGNHACK parentid_ = right->parentid_; linktag_[0] = right->linktag_[0]; linktag_[1] = right->linktag_[1]; #else parent_ = right->parent_; link_[0] = right->link_[0]; link_[1] = right->link_[1]; tagsid_ = right->tagsid_; #endif } template <typename Functor> void realloc(const Functor &new_ptr) { if (get_parent()) { set_parentid(new_ptr(get_parent()), get_parent_id()); set_xlinktag(0, new_ptr(get_xlink(0)), get_xtag(0)); set_xlinktag(1, new_ptr(get_xlink(1)), get_xtag(1)); } else // if root set_xlinktag(0, new_ptr(get_xlink(0)), get_xtag(0)); } private: /// the number of distinction bit word_t skip_; #ifdef PATL_ALIGNHACK /// compact representation of parent node with parent-id word_t parentid_; /// compact representation of child nodes with their tags word_t linktag_[2]; #else node_type *parent_, /// parent node *link_[2]; /// child nodes word_t tagsid_; /// parent-id with child tags #endif }; } // namespace impl } // namespace patl } // namespace uxn #endif
[ "sderle@goldman.(none)" ]
[ [ [ 1, 229 ] ] ]
1e90ff9ecba5519a8efeb45a881672bfb7ef5952
fcdddf0f27e52ece3f594c14fd47d1123f4ac863
/TeCom/src/TdkLayout/Header Files/TdkLayoutHorizontalLineControlObject.h
5e5a6a87fe1ffc946b4c1cf3e08112bcf5b81a9e
[]
no_license
radtek/terra-printer
32a2568b1e92cb5a0495c651d7048db6b2bbc8e5
959241e52562128d196ccb806b51fda17d7342ae
refs/heads/master
2020-06-11T01:49:15.043478
2011-12-12T13:31:19
2011-12-12T13:31:19
null
0
0
null
null
null
null
ISO-8859-2
C++
false
false
1,881
h
/****************************************************************************** * FUNCATE - GIS development team * * TerraLib Components - TeCOM * * @(#) TdkLayoutHorizontalLineControlObject.h * ******************************************************************************* * * $Rev$: * * $Author: rui.gregorio $: * * $Date: 2010/09/17 17:24:38 $: * ******************************************************************************/ // Elaborated by Rui Mauricio Gregório #ifndef __TDK_LAYOUT_HORIZONTAL_LINE_CONTROL_OBJECT_H #define __TDK_LAYOUT_HORIZONTAL_LINE_CONTROL_OBJECT_H class TdkAbstractCursor; //! \class TdkLayoutHorizontalLineControlObject /*! Control line used to auxiliary user */ class TdkLayoutHorizontalLineControlObject : public TdkLayoutObject { protected: TdkAbstractCursor * _cursor; //!< cursor pointer used to change the cursor icon public: //! brief Constructor TdkLayoutHorizontalLineControlObject(const unsigned int &id, TdkAbstractCanvasDraw* canvas,const TeBox &box); //! \brief Destructor ~TdkLayoutHorizontalLineControlObject(); //! \brief Draw virtual void draw(); //! \brief Print virtual void print(TdkAbstractCanvasDraw *canvas); //! \brief registerExtendProperties virtual void registerExtendProperties(); //! \brief drawTranslateProcess /*! Method to draw translate process \param dx x displacement \param dy y displacement */ virtual void drawTranslateProcess(const double &dx, const double &dy); //! \brief drawSelectionBoundingBox /*! Method to draw selection */ virtual void drawSelection(const TdkAbstractCanvasDraw::TdkCanvasBuffer &buffer); //! \brief mouseMove Event virtual void mouseMove(TdkMouseEvent *e); //! \brief setCursor virtual void setCursor(TdkAbstractCursor *cursor); }; #endif
[ "[email protected]@58180da6-ba8b-8960-36a5-00cc02a3ddec" ]
[ [ [ 1, 69 ] ] ]
fdfbacb24b9729203fae6105aa5bc6c1a6d4329c
10849cd3e89248b48e5cc609736b91c3ca253f0f
/SHIFTROTATE/isim/SFR/shift/shift.h
28340cb3ff786b6a4f768d0a62b172fd622fbc17
[]
no_license
tomclemente/Spartan3E-VHDL
5925586baaa65fa163ded24c50d9fd64d89147df
4eed5b15f17ed8cfbfdd75eca8311731c2993f32
refs/heads/master
2021-01-01T18:37:44.117830
2011-10-09T14:12:15
2011-10-09T14:12:15
2,165,486
0
0
null
null
null
null
UTF-8
C++
false
false
1,413
h
//////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / // \ \ \/ // \ \ Copyright (c) 2003-2004 Xilinx, Inc. // / / All Right Reserved. // /---/ /\ // \ \ / \ // \___\/\___\ //////////////////////////////////////////////////////////////////////////////// #ifndef H_Sfr_shift_H #define H_Sfr_shift_H #ifdef __MINGW32__ #include "xsimMinGW.h" #else #include "xsim.h" #endif #include "ieee/std_logic_1164/std_logic_1164.h" class Sfr_shift: public HSim__s6 { public: HSimRecordType Shift; /* subprogram name SLAF */ char *Gs(HSimConstraints *reConstr, HSim__s1 *Sn, int ssindexSn, int offsetSn); /* subprogram name SRLF */ char *GF(HSimConstraints *reConstr, HSim__s1 *Sz, int ssindexSz, int offsetSz, HSim__s1 *SC, int ssindexSC, int offsetSC); /* subprogram name SLLP */ void GX(HSim__s7 *process, HSim__s1 *SM, int ssindexSM, int offsetSM, HSim__s1 *SP, int ssindexSP, int offsetSP, HSim__s1 *SV, int ssindexSV, int offsetSV, HSim__s2 * driver_SV); /* subprogram name SRAP */ void G1c(HSim__s7 *process, HSim__s1 *S14, int ssindexS14, int offsetS14, HSim__s1 *S1a, int ssindexS1a, int offsetS1a, HSim__s2 * driver_S1a); public: public: Sfr_shift(const HSimString &name); ~Sfr_shift(); }; extern Sfr_shift *SfrShift; #endif
[ [ [ 1, 46 ] ] ]
8db666049be5273e88b929b11bc8a1dd32b8a6e0
df5277b77ad258cc5d3da348b5986294b055a2be
/Spaceships/IDFactory.h
6048b455f2b49c4305d75b26ce4d7488722d2f34
[]
no_license
beentaken/cs260-last2
147eaeb1ab15d03c57ad7fdc5db2d4e0824c0c22
61b2f84d565cc94a0283cc14c40fb52189ec1ba5
refs/heads/master
2021-03-20T16:27:10.552333
2010-04-26T00:47:13
2010-04-26T00:47:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
305
h
#pragma once class IDFactory { public: IDFactory(void); ~IDFactory(void); // get an ID static int GetNextID(); // resets count to 0 static void ResetID(); // the next ID returned will be the value of seed static void ResetID(int seed); private: static int currentID; };
[ "ProstheticMind43@af704e40-745a-32bd-e5ce-d8b418a3b9ef" ]
[ [ [ 1, 20 ] ] ]
b08177aefa4d21930e021fc30fb87c05a0630024
74c8da5b29163992a08a376c7819785998afb588
/NetAnimal/Game/wheel/NetWheelDirector/src/DUI/Dan2.cpp
b4990acce16b803caf15845b736a2987c0ce0fb6
[]
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
4,729
cpp
#include "NetWheelDirectorStableHeaders.h" #include "DUI/Dan2.h" #include "WheelUIListener.h" #include "BlackBoardSystem.h" #include "WheelEnum.h" #include "F6TableInterface.h" using namespace Orz; Dan2::Dan2(DanListener * listener):KeyListener(true),_n(0), _time(-1.f),_callback(listener) { _f6table = Orz::ComponentFactories::getInstance().create("Table"); _win= CEGUI::WindowManager::getSingleton().loadWindowLayout("Dan2.layout"); _win->setAlwaysOnTop(true); _win->hide(); for(int i = 0; i<9; ++i) { _editboxs[i] = static_cast<CEGUI::Editbox*>(CEGUI::WindowManager::getSingleton().getWindow("Dan2/Bg/" + Ogre::StringConverter::toString(i+1))); _editboxs[i]->setMaxTextLength(1); // _editboxs[i]->subscribeEvent(CEGUI::Editbox::EventValidationStringChanged, CEGUI::Event::Subscriber(&Dan2::textAccepted, this)); } _editboxs[0]->setValidationString("[1-7]*"); _editboxs[1]->setValidationString("[1-4]*"); _editboxs[2]->setValidationString("[1-4]*"); _editboxs[3]->setValidationString("[1-6]*"); _editboxs[4]->setValidationString("[0-3]*"); _editboxs[5]->setValidationString("[0-9]*"); _editboxs[6]->setValidationString("[1-5]*"); _editboxs[7]->setValidationString("[1-9]*"); _editboxs[8]->setValidationString("[1-7]*"); } bool Dan2::textAccepted(const CEGUI::EventArgs&) { setup(); return true; } bool Dan2::onKeyPressed(const KeyEvent & evt) { return false; } bool Dan2::onKeyReleased(const KeyEvent & evt) { int old = _n; if(evt.getKey() == Orz::KC_UP) { if(_n > 0) --_n; } if(evt.getKey() == Orz::KC_DOWN) { if(_n < 8) ++_n; } int now = _n; redo(old, now); return false; } void Dan2::result(bool ret) { if(ret) CEGUI::WindowManager::getSingleton().getWindow("Dan2/Result")->setProperty("Image","set:UI4 image:w4"); else CEGUI::WindowManager::getSingleton().getWindow("Dan2/Result")->setProperty("Image","set:UI4 image:w5"); _time = 1.0; } void Dan2::show(void) { F6TableInterface * f6table = _f6table->queryInterface<F6TableInterface>(); for(int i = 0; i< F6TableInterface::ITEM_SIZE; ++i) { setDan2Data(i, f6table->getDataIndex(F6TableInterface::ITEM(i)) ); } CEGUI::Window * win = CEGUI::System::getSingleton().getGUISheet(); if(win) { win->addChildWindow(_win); } if(BlackBoardSystem::getInstance().has(WheelEnum::SETUP_STR)) { SetupInfoPtr setup = BlackBoardSystem::getInstance().read<SetupInfoPtr>(WheelEnum::SETUP_STR); for(size_t i=0; i< setup->size(); ++i) { setDan2Data(i, setup->at(i)); } } Orz::IInputManager::getSingleton().addKeyListener(this); _win->show(); _n = 0; redo(_n, _n); } void Dan2::redo(int old, int now) { _editboxs[old]->setSelection(0, 0); _editboxs[now]->activate(); _editboxs[now]->setSelection(0, 1); } void Dan2::setDan2Data(int i, int data) { _editboxs[i]->setText(Ogre::StringConverter::toString(data)); } void Dan2::hide(void) { Orz::IInputManager::getSingleton().removeKeyListener(this); _win->hide(); CEGUI::Window * win = CEGUI::System::getSingleton().getGUISheet(); if(win) { win->removeChildWindow(_win); } setup(); } void Dan2::setup(void) { F6TableInterface * f6table = _f6table->queryInterface<F6TableInterface>(); for(int i = 0; i< F6TableInterface::ITEM_SIZE; ++i) { int data = Ogre::StringConverter::parseInt(_editboxs[i]->getText().c_str()); f6table->setDataIndex(F6TableInterface::ITEM(i), data); //setDan2Data(i, f6table->getDataIndex(F6TableInterface::ITEM(i)) ); } f6table->save(); /*_callback->updateUIData( Ogre::StringConverter::parseInt(_editboxs[0]->getText().c_str()), Ogre::StringConverter::parseInt(_editboxs[1]->getText().c_str()), Ogre::StringConverter::parseInt(_editboxs[2]->getText().c_str()), Ogre::StringConverter::parseInt(_editboxs[3]->getText().c_str()), Ogre::StringConverter::parseInt(_editboxs[4]->getText().c_str()), Ogre::StringConverter::parseInt(_editboxs[5]->getText().c_str()), Ogre::StringConverter::parseInt(_editboxs[6]->getText().c_str()), Ogre::StringConverter::parseInt(_editboxs[7]->getText().c_str()), Ogre::StringConverter::parseInt(_editboxs[8]->getText().c_str()) );*/ } void Dan2::update(TimeType time) { if(_time > 0.f) { _time -= time; if( _time <= 0.f) { CEGUI::WindowManager::getSingleton().getWindow("Dan2/Result")->setProperty("Image","set:UI4 image:w0"); } } } Dan2::~Dan2(void) { for(int i = 0; i<9; ++i) { _editboxs[i]->removeAllEvents(); } } void Dan2::bao_zhang_ma(const std::string & n) { CEGUI::WindowManager::getSingleton().getWindow("Dan/Bg/Text/BzmText")->setText(n); }
[ [ [ 1, 176 ] ] ]
5f54dbeba92a037b83af96ae9eb596b5149ec90e
81ff4fb051a612ea7c7e9e7733de6a86ad846504
/notepad_plus_m/scintilla/src/LexObjC.cxx
c3e84753e8bad871ca05ef5a91c3e35e6c5add29
[ "LicenseRef-scancode-scintilla" ]
permissive
kuckaogh/testprojectoned
2e731dd2dbc994adb7775d90cd1b05b5cb2b4764
e7e8cb3457af7dddc5546ba8b516c843acfe3f39
refs/heads/master
2021-01-22T17:53:13.521646
2011-03-23T01:20:06
2011-03-23T01:20:06
32,550,118
0
0
null
null
null
null
UTF-8
C++
false
false
15,621
cxx
// Scintilla source code edit control /** @file LexCPP.cxx ** Lexer for C++, C, Java, Javascript, Resource File and Objective-C **/ // Copyright 1998-2002 by Neil Hodgson <[email protected]> // The License.txt file describes the conditions under which this software may be distributed. // Modified by Don <[email protected]> 2004 to add lexer Object C #include <stdlib.h> #include <string.h> #include <ctype.h> #include <stdio.h> #include <stdarg.h> #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "StyleContext.h" #include "KeyWords.h" #define INCLUDE_DEPRECATED_FEATURES #include "Scintilla.h" #include "SciLexer.h" #define KEYWORD_BOXHEADER 1 #define KEYWORD_FOLDCONTRACTED 2 static bool IsOKBeforeRE(const int ch) { return (ch == '(') || (ch == '=') || (ch == ','); } static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_'); } static inline bool IsAWordStart(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_'); } static inline bool IsADoxygenChar(const int ch) { return (islower(ch) || ch == '$' || ch == '@' || ch == '\\' || ch == '&' || ch == '<' || ch == '>' || ch == '#' || ch == '{' || ch == '}' || ch == '[' || ch == ']'); } static inline bool IsStateComment(const int state) { return ((state == SCE_C_COMMENT) || (state == SCE_C_COMMENTLINE) || (state == SCE_C_COMMENTDOC) || (state == SCE_C_COMMENTDOCKEYWORD) || (state == SCE_C_COMMENTDOCKEYWORDERROR)); } static inline bool IsStateString(const int state) { return ((state == SCE_C_STRING) || (state == SCE_C_VERBATIM)); } static void ColouriseObjCDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler, bool caseSensitive) { WordList &mainInstrsList = *keywordlists[0]; //Commun Instriction WordList &mainTypesList = *keywordlists[1]; //Commun Type WordList &DoxygenList = *keywordlists[2]; //Doxygen keyword WordList &objcDirectiveList = *keywordlists[3]; // objC Directive WordList &objcQualifierList = *keywordlists[4]; //objC Qualifier bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor") != 0; // Do not leak onto next line if (initStyle == SCE_C_STRINGEOL) initStyle = SCE_C_DEFAULT; int chPrevNonWhite = ' '; int visibleChars = 0; bool lastWordWasUUID = false; StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { if (sc.atLineStart && (sc.state == SCE_C_STRING)) { // Prevent SCE_C_STRINGEOL from leaking back to previous line sc.SetState(SCE_C_STRING); } // Handle line continuation generically. if (sc.ch == '\\') { if (sc.chNext == '\n' || sc.chNext == '\r') { sc.Forward(); if (sc.ch == '\r' && sc.chNext == '\n') { sc.Forward(); } continue; } } // Determine if the current state should terminate. switch (sc.state) { case SCE_C_OPERATOR : { sc.SetState(SCE_C_DEFAULT); break; } case SCE_C_NUMBER : { if (!IsAWordChar(sc.ch)) sc.SetState(SCE_C_DEFAULT); break; } case SCE_C_IDENTIFIER : { if (!IsAWordChar(sc.ch) || (sc.ch == '.')) { char s[100]; sc.GetCurrent(s, sizeof(s)); if (s[0] == '@') { char *ps = s + 1; if (objcDirectiveList.InList(ps)) sc.ChangeState(SCE_OBJC_DIRECTIVE); } else { if (mainInstrsList.InList(s)) { lastWordWasUUID = strcmp(s, "uuid") == 0; sc.ChangeState(SCE_C_WORD); } else if (mainTypesList.InList(s)) { sc.ChangeState(SCE_C_WORD2); } else if (objcQualifierList.InList(s)) { sc.ChangeState(SCE_OBJC_QUALIFIER); } } sc.SetState(SCE_C_DEFAULT); } break; } case SCE_C_PREPROCESSOR : { if (stylingWithinPreprocessor) { if (IsASpace(sc.ch)) sc.SetState(SCE_C_DEFAULT); } else { if ((sc.atLineEnd) || (sc.Match('/', '*')) || (sc.Match('/', '/'))) sc.SetState(SCE_C_DEFAULT); } break; } case SCE_C_COMMENT : { if (sc.Match('*', '/')) { sc.Forward(); sc.ForwardSetState(SCE_C_DEFAULT); } break; } case SCE_C_COMMENTDOC : { if (sc.Match('*', '/')) { sc.Forward(); sc.ForwardSetState(SCE_C_DEFAULT); } else if (sc.ch == '@' || sc.ch == '\\') { sc.SetState(SCE_C_COMMENTDOCKEYWORD); } break; } case SCE_C_COMMENTLINE : case SCE_C_COMMENTLINEDOC : { if (sc.atLineEnd) { sc.SetState(SCE_C_DEFAULT); visibleChars = 0; } break; } case SCE_C_COMMENTDOCKEYWORD : { if (sc.Match('*', '/')) { sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR); sc.Forward(); sc.ForwardSetState(SCE_C_DEFAULT); } else if (!IsADoxygenChar(sc.ch)) { char s[100]; if (caseSensitive) sc.GetCurrent(s, sizeof(s)); else sc.GetCurrentLowered(s, sizeof(s)); if (!isspace(sc.ch) || !DoxygenList.InList(s + 1)) sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR); sc.SetState(SCE_C_COMMENTDOC); } break; } case SCE_C_STRING : { if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') sc.Forward(); } else if (sc.ch == '\"') { sc.ForwardSetState(SCE_C_DEFAULT); } else if (sc.atLineEnd) { sc.ChangeState(SCE_C_STRINGEOL); sc.ForwardSetState(SCE_C_DEFAULT); visibleChars = 0; } break; } case SCE_C_CHARACTER : { if (sc.atLineEnd) { sc.ChangeState(SCE_C_STRINGEOL); sc.ForwardSetState(SCE_C_DEFAULT); visibleChars = 0; } else if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\'') { sc.ForwardSetState(SCE_C_DEFAULT); } break; } case SCE_C_REGEX : { if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == '/') { sc.ForwardSetState(SCE_C_DEFAULT); } else if (sc.ch == '\\') { // Gobble up the quoted character if (sc.chNext == '\\' || sc.chNext == '/') { sc.Forward(); } } break; } case SCE_C_VERBATIM : { if (sc.ch == '\"') { if (sc.chNext == '\"') sc.Forward(); else sc.ForwardSetState(SCE_C_DEFAULT); } break; } case SCE_C_UUID : { if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ')') sc.SetState(SCE_C_DEFAULT); break; } default : break; } // Determine if a new state should be entered. if (sc.state == SCE_C_DEFAULT) { if (sc.Match('@', '\"')) { sc.SetState(SCE_C_VERBATIM); sc.Forward(); } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { if (lastWordWasUUID) { sc.SetState(SCE_C_UUID); lastWordWasUUID = false; } else { sc.SetState(SCE_C_NUMBER); } } else if (IsAWordStart(sc.ch) || (sc.ch == '@')) { if (lastWordWasUUID) { sc.SetState(SCE_C_UUID); lastWordWasUUID = false; } else { sc.SetState(SCE_C_IDENTIFIER); } } else if (sc.Match('/', '*')) { if (sc.Match("/**") || sc.Match("/*!")) // Support of Qt/Doxygen doc. style sc.SetState(SCE_C_COMMENTDOC); else sc.SetState(SCE_C_COMMENT); sc.Forward(); // Eat the * so it isn't used for the end of the comment } else if (sc.Match('/', '/')) { if (sc.Match("///") || sc.Match("//!")) // Support of Qt/Doxygen doc. style sc.SetState(SCE_C_COMMENTLINEDOC); else sc.SetState(SCE_C_COMMENTLINE); } else if (sc.ch == '/' && IsOKBeforeRE(chPrevNonWhite)) { sc.SetState(SCE_C_REGEX); } else if (sc.ch == '\"') { sc.SetState(SCE_C_STRING); } else if (sc.ch == '\'') { sc.SetState(SCE_C_CHARACTER); } else if (sc.ch == '#' && visibleChars == 0) { // Preprocessor commands are alone on their line sc.SetState(SCE_C_PREPROCESSOR); // Skip whitespace between # and preprocessor word do { sc.Forward(); } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()); if (sc.atLineEnd) sc.SetState(SCE_C_DEFAULT); } else if (isoperator(static_cast<char>(sc.ch))) { sc.SetState(SCE_C_OPERATOR); } } if (sc.atLineEnd) { // Reset states to begining of colourise so no surprises // if different sets of lines lexed. chPrevNonWhite = ' '; visibleChars = 0; lastWordWasUUID = false; } if (!IsASpace(sc.ch)) { chPrevNonWhite = sc.ch; visibleChars++; } } sc.Complete(); } static bool IsStreamCommentStyle(int style) { return style == SCE_C_COMMENT || style == SCE_C_COMMENTDOC || style == SCE_C_COMMENTDOCKEYWORD || style == SCE_C_COMMENTDOCKEYWORDERROR; } static bool matchKeyword(unsigned int start, WordList &keywords, Accessor &styler, int keywordtype) { bool FoundKeyword = false; for (unsigned int i = 0; strlen(keywords.words[i]) > 0 && !FoundKeyword; i++) { if (atoi(keywords.words[i]) == keywordtype) { FoundKeyword = styler.Match(start, ((char *)keywords.words[i]) + 2); } } return FoundKeyword; } static bool IsCommentLine(int line, Accessor &styler) { unsigned int Pos = styler.LineStart(line); while (styler.GetLine(Pos) == line) { int PosStyle = styler.StyleAt(Pos); if ( !IsStreamCommentStyle(PosStyle) && PosStyle != SCE_C_COMMENTLINEDOC && PosStyle != SCE_C_COMMENTLINE && !IsASpace(styler.SafeGetCharAt(Pos)) ) return false; Pos++; } return true; } static void FoldObjCDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords4 = *keywordlists[3]; bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool firstLine = true; unsigned int endPos = startPos + length; int visibleChars = 0; int lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; int levelPrevPrev; int levelUnindent = 0; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; if (lineCurrent == 0) { levelPrevPrev = levelPrev; } else { levelPrevPrev = styler.LevelAt(lineCurrent - 1) & SC_FOLDLEVELNUMBERMASK; } for (unsigned int i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (foldComment && IsStreamCommentStyle(style)) { if (!IsStreamCommentStyle(stylePrev)) { levelCurrent++; } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { // Comments don't end at end of line and the next character may be unstyled. levelCurrent--; } } if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) { if (ch == '#') { unsigned int j = i + 1; while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } if (styler.Match(j, "region") || styler.Match(j, "if")) { levelCurrent++; } else if (styler.Match(j, "end")) { levelCurrent--; } } } if (style == SCE_C_OPERATOR || style == SCE_C_COMMENT || style == SCE_C_COMMENTLINE) { if (ch == '{') { levelCurrent++; // Special handling if line has closing brace followed by opening brace. if (levelCurrent == levelPrev) { if (firstLine) levelUnindent = 1; else levelUnindent = -1; } } else if (ch == '}') { levelCurrent--; } } if (style == SCE_OBJC_DIRECTIVE) { if (ch == '@') { unsigned int j = i + 1; if (styler.Match(j, "interface") || styler.Match(j, "implementation") || styler.Match(j, "protocol")) { levelCurrent++; } else if (styler.Match(j, "end")) { levelCurrent--; } } } /* Check for fold header keyword at beginning of word */ if ((style == SCE_C_WORD || style == SCE_C_COMMENT || style == SCE_C_COMMENTLINE) && (style != stylePrev)) { if (matchKeyword(i, keywords4, styler, KEYWORD_BOXHEADER)) { int line; // Loop backwards all empty or comment lines for (line = lineCurrent - 1; line >= 0 && levelCurrent == (styler.LevelAt(line) & SC_FOLDLEVELNUMBERMASK) && IsCommentLine(line, styler); line--) { // just loop backwards; } line++; if (line == lineCurrent) { // in current line } else { // at top of all preceding comment lines styler.SetLevel(line, styler.LevelAt(line)); } } } if (atEOL) { int lev; // Compute level correction for special case: '} else {' if (levelUnindent < 0) { levelPrev += levelUnindent; } else { levelCurrent += levelUnindent; } lev = levelPrev; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; // Produce footer line at line before (special handling for '} else {' if (levelPrev < levelPrevPrev) { styler.SetLevel(lineCurrent - 1, styler.LevelAt(lineCurrent - 1)); } // Mark the fold header (the line that is always visible) if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrevPrev = levelPrev; levelPrev = levelCurrent; levelUnindent = 0; visibleChars = 0; firstLine = false; } if (!isspacechar(ch)) visibleChars++; } // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } static const char * const cppWordLists[] = { "Primary keywords and identifiers", "Secondary keywords and identifiers", "Documentation comment keywords", "Fold header keywords", 0, }; static void ColouriseObjCDocSensitive(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { ColouriseObjCDoc(startPos, length, initStyle, keywordlists, styler, true); } LexerModule lmObjC(SCLEX_OBJC, ColouriseObjCDocSensitive, "cpp", FoldObjCDoc, cppWordLists);
[ "gph.kevin@0a44f7b2-fd79-11de-a344-e7ee0817407e" ]
[ [ [ 1, 601 ] ] ]
32ebeb05ff6f89f792ac30841b73e4ca33d1292f
ea73dcecdba82d5769db70666a7595bad7e1743d
/gajomi/gajomi/missil.cpp
2ae2a5fb0b35471b7f319a79b45a4b59b6eded80
[]
no_license
crossleyjuan/games
450ac4e9bb19e36dc983ff7a03b680f872397bd3
17e2bfe7a9c86af7a4e559a4654f66cb7050c3ea
refs/heads/master
2016-09-05T22:13:15.896289
2011-06-03T22:03:01
2011-06-03T22:03:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,503
cpp
#include "missil.h" #include "fps.h" #include "engine.h" #include <math.h> Missil::Missil() { _fired = false; } bool Missil::OnInit() { if (!Entity::OnLoad("./images/rocket.png", 16, 30, 1)) { return false; } return true; } void Missil::SetTarget(float *x, float *y) { this->targetX = x; this->targetY = y; } void Missil::OnLoop() { if (!_fired) return; float b = Y - *targetY; float a = X - *targetX; float c = sqrt(pow(a, 2) + pow(b, 2)); float hyp; if (c > a) { hyp = c; } else { hyp = a; } float dirX = *targetX - X; float dirY = *targetY - Y; // Normalize the vector dirX = dirX / hyp; dirY = dirY / hyp; float newX = dirX * 25; float newY = dirY * 25; /* AccelX = 1; AccelY = tang * (AccelX - X) + Y; SpeedX += AccelX * FPS::FPSControl.GetSpeedFactor(); SpeedY += AccelY * FPS::FPSControl.GetSpeedFactor(); if(SpeedX > MaxSpeedX) SpeedX = MaxSpeedX; if(SpeedX < -MaxSpeedX) SpeedX = -MaxSpeedX; if(SpeedY > MaxSpeedY) SpeedY = MaxSpeedY; if(SpeedY < -MaxSpeedY) SpeedY = -MaxSpeedY; */ OnAnimate(); OnMove(newX, newY); } void Missil::Fire() { _fired = true; } bool Missil::OnCollision(Entity *Entity) { _fired = false; Engine::GameEngine.RemoveEntity(this); return true;// avoid reprocess } bool Missil::isFired() { return _fired; }
[ [ [ 1, 76 ] ] ]
0f8eb815a6ab713530d78e1b5d3d7780010a8879
81e051c660949ac0e89d1e9cf286e1ade3eed16a
/quake3ce/code/renderer/tr_animation.cpp
fcca6e4b9de07fbcf3eee8d1e0288e78aaaf74a4
[]
no_license
crioux/q3ce
e89c3b60279ea187a2ebcf78dbe1e9f747a31d73
5e724f55940ac43cb25440a65f9e9e12220c9ada
refs/heads/master
2020-06-04T10:29:48.281238
2008-11-16T15:00:38
2008-11-16T15:00:38
32,103,416
5
0
null
null
null
null
UTF-8
C++
false
false
5,560
cpp
/* =========================================================================== Copyright (C) 1999-2005 Id Software, Inc. This file is part of Quake III Arena source code. Quake III Arena source code 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. Quake III Arena source code 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 Foobar; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ #include"renderer_pch.h" /* All bones should be an identity orientation to display the mesh exactly as it is specified. For all other frames, the bones represent the transformation from the orientation of the bone in the base frame to the orientation in this frame. */ /* ============== R_AddAnimSurfaces ============== */ void R_AddAnimSurfaces( trRefEntity_t *ent ) { md4Header_t *header; md4Surface_t *surface; md4LOD_t *lod; shader_t *shader; int i; header = tr.currentModel->md4; lod = (md4LOD_t *)( (byte *)header + header->ofsLODs ); surface = (md4Surface_t *)( (byte *)lod + lod->ofsSurfaces ); for ( i = 0 ; i < lod->numSurfaces ; i++ ) { shader = R_GetShaderByHandle( surface->shaderIndex ); R_AddDrawSurf( (surfaceType_t*)surface, shader, 0 /*fogNum*/, qfalse ); surface = (md4Surface_t *)( (byte *)surface + surface->ofsEnd ); } } /* ============== RB_SurfaceAnim ============== */ void RB_SurfaceAnim( md4Surface_t *surface ) { int i, j, k; gfixed frontlerp, backlerp; int *triangles; int indexes; int baseIndex, baseVertex; int numVerts; md4Vertex_t *v; md4Bone_t bones[MD4_MAX_BONES]; md4Bone_t *bonePtr, *bone; md4Header_t *header; md4Frame_t *frame; md4Frame_t *oldFrame; int frameSize; if ( backEnd.currentEntity->e.oldframe == backEnd.currentEntity->e.frame ) { backlerp = GFIXED_0; frontlerp = GFIXED_1; } else { backlerp = backEnd.currentEntity->e.backlerp; frontlerp = GFIXED_1 - backlerp; } header = (md4Header_t *)((byte *)surface + surface->ofsHeader); frameSize = (int)( &((md4Frame_t *)0)->bones[ header->numBones ] ); frame = (md4Frame_t *)((byte *)header + header->ofsFrames + backEnd.currentEntity->e.frame * frameSize ); oldFrame = (md4Frame_t *)((byte *)header + header->ofsFrames + backEnd.currentEntity->e.oldframe * frameSize ); RB_CheckOverflow( surface->numVerts, surface->numTriangles * 3 ); triangles = (int *) ((byte *)surface + surface->ofsTriangles); indexes = surface->numTriangles * 3; baseIndex = tess.numIndexes; baseVertex = tess.numVertexes; for (j = 0 ; j < indexes ; j++) { tess.indexes[baseIndex + j] = baseIndex + triangles[j]; } tess.numIndexes += indexes; // // lerp all the needed bones // if ( FIXED_IS_ZERO(backlerp) ) { // no lerping needed bonePtr = frame->bones; } else { bonePtr = bones; for ( i = 0 ; i < header->numBones*12 ; i++ ) { ((gfixed *)bonePtr)[i] = frontlerp * ((gfixed *)frame->bones)[i] + backlerp * ((gfixed *)oldFrame->bones)[i]; } } // // deform the vertexes by the lerped bones // numVerts = surface->numVerts; // FIXME // This makes TFC's skeletons work. Shouldn't be necessary anymore, but left // in for reference. //v = (md4Vertex_t *) ((byte *)surface + surface->ofsVerts + 12); v = (md4Vertex_t *) ((byte *)surface + surface->ofsVerts); for ( j = 0; j < numVerts; j++ ) { vec3_t tempVert, tempNormal; md4Weight_t *w; VectorClear( tempVert ); VectorClear( tempNormal ); w = v->weights; for ( k = 0 ; k < v->numWeights ; k++, w++ ) { bone = bonePtr + w->boneIndex; tempVert[0] += w->boneWeight * ( FIXED_VEC3DOT( bone->matrix[0], w->offset ) + bone->matrix[0][3] ); tempVert[1] += w->boneWeight * ( FIXED_VEC3DOT( bone->matrix[1], w->offset ) + bone->matrix[1][3] ); tempVert[2] += w->boneWeight * ( FIXED_VEC3DOT( bone->matrix[2], w->offset ) + bone->matrix[2][3] ); tempNormal[0] += w->boneWeight * FIXED_VEC3DOT( bone->matrix[0], v->normal ); tempNormal[1] += w->boneWeight * FIXED_VEC3DOT( bone->matrix[1], v->normal ); tempNormal[2] += w->boneWeight * FIXED_VEC3DOT( bone->matrix[2], v->normal ); } tess.xyz[baseVertex + j][0] = MAKE_BFIXED(tempVert[0]); tess.xyz[baseVertex + j][1] = MAKE_BFIXED(tempVert[1]); tess.xyz[baseVertex + j][2] = MAKE_BFIXED(tempVert[2]); tess.normal[baseVertex + j][0] = MAKE_AFIXED(tempNormal[0]); tess.normal[baseVertex + j][1] = MAKE_AFIXED(tempNormal[1]); tess.normal[baseVertex + j][2] = MAKE_AFIXED(tempNormal[2]); tess.texCoords[baseVertex + j][0][0] = v->texCoords[0]; tess.texCoords[baseVertex + j][0][1] = v->texCoords[1]; // FIXME // This makes TFC's skeletons work. Shouldn't be necessary anymore, but left // in for reference. //v = (md4Vertex_t *)( ( byte * )&v->weights[v->numWeights] + 12 ); v = (md4Vertex_t *)&v->weights[v->numWeights]; } tess.numVertexes += surface->numVerts; }
[ "jack.palevich@684fc592-8442-0410-8ea1-df6b371289ac" ]
[ [ [ 1, 171 ] ] ]
2d9d1287f25a99d3fce34c9fbc01e85122b66ffa
17558c17dbc37842111466c43add5b31e3f1b29b
/ui_mainwindow.h
b6f1af9ee82c1515d578b26e4d8f8d454e17ffe5
[]
no_license
AeroWorks/inav
5c61b6c7a5af1a3f99009de8e177a2ceff3447b0
5a97aaca791026d9a09c2273c37e237b18b9cb35
refs/heads/master
2020-09-05T23:45:11.561252
2011-04-24T01:53:22
2011-04-24T01:53:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
14,415
h
/******************************************************************************** ** Form generated from reading UI file 'mainwindow.ui' ** ** Created: Mon 15. Feb 01:52:07 2010 ** by: Qt User Interface Compiler version 4.6.1 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef UI_MAINWINDOW_H #define UI_MAINWINDOW_H #include <QtCore/QVariant> #include <QtGui/QAction> #include <QtGui/QApplication> #include <QtGui/QButtonGroup> #include <QtGui/QFrame> #include <QtGui/QHBoxLayout> #include <QtGui/QHeaderView> #include <QtGui/QLineEdit> #include <QtGui/QMainWindow> #include <QtGui/QPushButton> #include <QtGui/QTextBrowser> #include <QtGui/QVBoxLayout> #include <QtGui/QWidget> QT_BEGIN_NAMESPACE class Ui_MainWindow { public: QWidget *centralWidget; QVBoxLayout *verticalLayout; QFrame *frameContainerBody; QHBoxLayout *horizontalLayout; QFrame *frameNav; QVBoxLayout *verticalLayout_3; QTextBrowser *textBrowser; QLineEdit *lineEdit; QFrame *frameInfo; QVBoxLayout *verticalLayout_2; QFrame *frameInfoA; QVBoxLayout *verticalLayout_InfoA; QFrame *frameInfoB; QVBoxLayout *verticalLayout_InfoB; QFrame *frameInfoC; QVBoxLayout *verticalLayout_InfoC; QFrame *frameInfoD; QVBoxLayout *verticalLayout_InfoD; QFrame *frameInfoE; QVBoxLayout *verticalLayout_InfoE; QFrame *frameFiller; QFrame *frameContainerFooter; QHBoxLayout *horizontalLayout_2; QFrame *frameFooter; QHBoxLayout *horizontalLayout_3; QPushButton *pushButton; QPushButton *pushButton_2; QPushButton *pushButton_3; QPushButton *pushButton_4; QPushButton *pushButton_5; void setupUi(QMainWindow *MainWindow) { if (MainWindow->objectName().isEmpty()) MainWindow->setObjectName(QString::fromUtf8("MainWindow")); MainWindow->resize(755, 530); MainWindow->setStyleSheet(QString::fromUtf8("\n" "\n" "#MainWindow {\n" "background: black;\n" "\n" "}\n" "\n" "\n" "#frameNav{\n" "border: 1px solid gray;\n" "border-radius: 4px;\n" "\n" "}\n" "#frameFooter{\n" "border: 1px solid gray;\n" "border-radius: 4px;\n" "background: black;\n" "\n" "}\n" "\n" "QPushButton {\n" "font-family: \"Arial\";\n" "font-weight: bold;\n" "color: white;\n" "}")); centralWidget = new QWidget(MainWindow); centralWidget->setObjectName(QString::fromUtf8("centralWidget")); verticalLayout = new QVBoxLayout(centralWidget); verticalLayout->setSpacing(0); verticalLayout->setContentsMargins(0, 0, 0, 0); verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); frameContainerBody = new QFrame(centralWidget); frameContainerBody->setObjectName(QString::fromUtf8("frameContainerBody")); frameContainerBody->setFrameShape(QFrame::NoFrame); frameContainerBody->setFrameShadow(QFrame::Raised); horizontalLayout = new QHBoxLayout(frameContainerBody); horizontalLayout->setSpacing(0); horizontalLayout->setContentsMargins(0, 0, 0, 0); horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); frameNav = new QFrame(frameContainerBody); frameNav->setObjectName(QString::fromUtf8("frameNav")); QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(frameNav->sizePolicy().hasHeightForWidth()); frameNav->setSizePolicy(sizePolicy); frameNav->setFrameShape(QFrame::Box); frameNav->setFrameShadow(QFrame::Raised); verticalLayout_3 = new QVBoxLayout(frameNav); verticalLayout_3->setSpacing(0); verticalLayout_3->setContentsMargins(0, 0, 0, 0); verticalLayout_3->setObjectName(QString::fromUtf8("verticalLayout_3")); textBrowser = new QTextBrowser(frameNav); textBrowser->setObjectName(QString::fromUtf8("textBrowser")); verticalLayout_3->addWidget(textBrowser); lineEdit = new QLineEdit(frameNav); lineEdit->setObjectName(QString::fromUtf8("lineEdit")); verticalLayout_3->addWidget(lineEdit); horizontalLayout->addWidget(frameNav); frameInfo = new QFrame(frameContainerBody); frameInfo->setObjectName(QString::fromUtf8("frameInfo")); QSizePolicy sizePolicy1(QSizePolicy::Fixed, QSizePolicy::Preferred); sizePolicy1.setHorizontalStretch(0); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(frameInfo->sizePolicy().hasHeightForWidth()); frameInfo->setSizePolicy(sizePolicy1); frameInfo->setMinimumSize(QSize(100, 0)); frameInfo->setStyleSheet(QString::fromUtf8("#frameInfoA {\n" " border: 1px solid #3566ff;\n" "}\n" "#frameInfoB {\n" " border: 1px solid #3566ff;\n" "}")); frameInfo->setFrameShape(QFrame::NoFrame); frameInfo->setFrameShadow(QFrame::Raised); verticalLayout_2 = new QVBoxLayout(frameInfo); verticalLayout_2->setSpacing(1); verticalLayout_2->setContentsMargins(0, 0, 0, 0); verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2")); frameInfoA = new QFrame(frameInfo); frameInfoA->setObjectName(QString::fromUtf8("frameInfoA")); QSizePolicy sizePolicy2(QSizePolicy::Preferred, QSizePolicy::Fixed); sizePolicy2.setHorizontalStretch(0); sizePolicy2.setVerticalStretch(0); sizePolicy2.setHeightForWidth(frameInfoA->sizePolicy().hasHeightForWidth()); frameInfoA->setSizePolicy(sizePolicy2); frameInfoA->setMinimumSize(QSize(0, 44)); frameInfoA->setFrameShape(QFrame::StyledPanel); frameInfoA->setFrameShadow(QFrame::Raised); verticalLayout_InfoA = new QVBoxLayout(frameInfoA); verticalLayout_InfoA->setSpacing(0); verticalLayout_InfoA->setContentsMargins(11, 11, 11, 11); verticalLayout_InfoA->setObjectName(QString::fromUtf8("verticalLayout_InfoA")); verticalLayout_InfoA->setContentsMargins(2, 2, 0, 0); verticalLayout_2->addWidget(frameInfoA); frameInfoB = new QFrame(frameInfo); frameInfoB->setObjectName(QString::fromUtf8("frameInfoB")); sizePolicy2.setHeightForWidth(frameInfoB->sizePolicy().hasHeightForWidth()); frameInfoB->setSizePolicy(sizePolicy2); frameInfoB->setMinimumSize(QSize(0, 44)); frameInfoB->setStyleSheet(QString::fromUtf8("#frameInfoA {\n" " border: 1px solid #8f8f91;\n" "}")); frameInfoB->setFrameShape(QFrame::StyledPanel); frameInfoB->setFrameShadow(QFrame::Raised); verticalLayout_InfoB = new QVBoxLayout(frameInfoB); verticalLayout_InfoB->setSpacing(0); verticalLayout_InfoB->setContentsMargins(11, 11, 11, 11); verticalLayout_InfoB->setObjectName(QString::fromUtf8("verticalLayout_InfoB")); verticalLayout_InfoB->setContentsMargins(2, 2, 0, 0); verticalLayout_2->addWidget(frameInfoB); frameInfoC = new QFrame(frameInfo); frameInfoC->setObjectName(QString::fromUtf8("frameInfoC")); sizePolicy2.setHeightForWidth(frameInfoC->sizePolicy().hasHeightForWidth()); frameInfoC->setSizePolicy(sizePolicy2); frameInfoC->setMinimumSize(QSize(0, 44)); frameInfoC->setStyleSheet(QString::fromUtf8("#frameInfoC {\n" " border: 1px solid #3566ff;\n" "}")); frameInfoC->setFrameShape(QFrame::StyledPanel); frameInfoC->setFrameShadow(QFrame::Raised); verticalLayout_InfoC = new QVBoxLayout(frameInfoC); verticalLayout_InfoC->setSpacing(0); verticalLayout_InfoC->setContentsMargins(11, 11, 11, 11); verticalLayout_InfoC->setObjectName(QString::fromUtf8("verticalLayout_InfoC")); verticalLayout_InfoC->setContentsMargins(2, 2, 0, 0); verticalLayout_2->addWidget(frameInfoC); frameInfoD = new QFrame(frameInfo); frameInfoD->setObjectName(QString::fromUtf8("frameInfoD")); sizePolicy2.setHeightForWidth(frameInfoD->sizePolicy().hasHeightForWidth()); frameInfoD->setSizePolicy(sizePolicy2); frameInfoD->setMinimumSize(QSize(0, 44)); frameInfoD->setStyleSheet(QString::fromUtf8("#frameInfoD {\n" " border: 1px solid #3566ff;\n" "}")); frameInfoD->setFrameShape(QFrame::StyledPanel); frameInfoD->setFrameShadow(QFrame::Raised); verticalLayout_InfoD = new QVBoxLayout(frameInfoD); verticalLayout_InfoD->setSpacing(0); verticalLayout_InfoD->setContentsMargins(11, 11, 11, 11); verticalLayout_InfoD->setObjectName(QString::fromUtf8("verticalLayout_InfoD")); verticalLayout_InfoD->setContentsMargins(2, 2, 0, 0); verticalLayout_2->addWidget(frameInfoD); frameInfoE = new QFrame(frameInfo); frameInfoE->setObjectName(QString::fromUtf8("frameInfoE")); sizePolicy2.setHeightForWidth(frameInfoE->sizePolicy().hasHeightForWidth()); frameInfoE->setSizePolicy(sizePolicy2); frameInfoE->setMinimumSize(QSize(0, 44)); frameInfoE->setStyleSheet(QString::fromUtf8("#frameInfoE {\n" " border: 1px solid #3566ff;\n" "}")); frameInfoE->setFrameShape(QFrame::StyledPanel); frameInfoE->setFrameShadow(QFrame::Raised); verticalLayout_InfoE = new QVBoxLayout(frameInfoE); verticalLayout_InfoE->setSpacing(0); verticalLayout_InfoE->setContentsMargins(11, 11, 11, 11); verticalLayout_InfoE->setObjectName(QString::fromUtf8("verticalLayout_InfoE")); verticalLayout_InfoE->setContentsMargins(2, 2, 0, 0); verticalLayout_2->addWidget(frameInfoE); frameFiller = new QFrame(frameInfo); frameFiller->setObjectName(QString::fromUtf8("frameFiller")); frameFiller->setStyleSheet(QString::fromUtf8("#frameFiller {\n" " border: 1px solid gray;\n" "}")); frameFiller->setFrameShape(QFrame::StyledPanel); frameFiller->setFrameShadow(QFrame::Raised); verticalLayout_2->addWidget(frameFiller); horizontalLayout->addWidget(frameInfo); verticalLayout->addWidget(frameContainerBody); frameContainerFooter = new QFrame(centralWidget); frameContainerFooter->setObjectName(QString::fromUtf8("frameContainerFooter")); sizePolicy2.setHeightForWidth(frameContainerFooter->sizePolicy().hasHeightForWidth()); frameContainerFooter->setSizePolicy(sizePolicy2); frameContainerFooter->setMinimumSize(QSize(0, 40)); frameContainerFooter->setFrameShape(QFrame::NoFrame); frameContainerFooter->setFrameShadow(QFrame::Raised); horizontalLayout_2 = new QHBoxLayout(frameContainerFooter); horizontalLayout_2->setSpacing(0); horizontalLayout_2->setContentsMargins(0, 0, 0, 0); horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2")); frameFooter = new QFrame(frameContainerFooter); frameFooter->setObjectName(QString::fromUtf8("frameFooter")); frameFooter->setStyleSheet(QString::fromUtf8("QPushButton {\n" " border: 2px solid #8f8f91;\n" " border-radius: 6px;\n" " background-color: black;\n" " min-width: 80px;\n" " }\n" "\n" " QPushButton:pressed {\n" " background-color :gray;\n" " }\n" "\n" " QPushButton:flat {\n" " border: none; /* no border for a flat push button */\n" " }\n" "\n" " QPushButton:default {\n" " border-color: navy; /* make the \n" "}")); frameFooter->setFrameShape(QFrame::Box); frameFooter->setFrameShadow(QFrame::Raised); horizontalLayout_3 = new QHBoxLayout(frameFooter); horizontalLayout_3->setSpacing(0); horizontalLayout_3->setContentsMargins(0, 0, 0, 0); horizontalLayout_3->setObjectName(QString::fromUtf8("horizontalLayout_3")); pushButton = new QPushButton(frameFooter); pushButton->setObjectName(QString::fromUtf8("pushButton")); horizontalLayout_3->addWidget(pushButton); pushButton_2 = new QPushButton(frameFooter); pushButton_2->setObjectName(QString::fromUtf8("pushButton_2")); horizontalLayout_3->addWidget(pushButton_2); pushButton_3 = new QPushButton(frameFooter); pushButton_3->setObjectName(QString::fromUtf8("pushButton_3")); horizontalLayout_3->addWidget(pushButton_3); pushButton_4 = new QPushButton(frameFooter); pushButton_4->setObjectName(QString::fromUtf8("pushButton_4")); horizontalLayout_3->addWidget(pushButton_4); pushButton_5 = new QPushButton(frameFooter); pushButton_5->setObjectName(QString::fromUtf8("pushButton_5")); horizontalLayout_3->addWidget(pushButton_5); horizontalLayout_2->addWidget(frameFooter); verticalLayout->addWidget(frameContainerFooter); MainWindow->setCentralWidget(centralWidget); retranslateUi(MainWindow); QMetaObject::connectSlotsByName(MainWindow); } // setupUi void retranslateUi(QMainWindow *MainWindow) { MainWindow->setWindowTitle(QApplication::translate("MainWindow", "iNav", 0, QApplication::UnicodeUTF8)); pushButton->setText(QApplication::translate("MainWindow", "1. Nav", 0, QApplication::UnicodeUTF8)); pushButton_2->setText(QApplication::translate("MainWindow", "2. Route", 0, QApplication::UnicodeUTF8)); pushButton_3->setText(QApplication::translate("MainWindow", "3. Data", 0, QApplication::UnicodeUTF8)); pushButton_4->setText(QApplication::translate("MainWindow", "4. Signal ", 0, QApplication::UnicodeUTF8)); pushButton_5->setText(QApplication::translate("MainWindow", "5. Database", 0, QApplication::UnicodeUTF8)); } // retranslateUi }; namespace Ui { class MainWindow: public Ui_MainWindow {}; } // namespace Ui QT_END_NAMESPACE #endif // UI_MAINWINDOW_H
[ [ [ 1, 352 ] ] ]
4bf5fac8e1edf5c4d6a9bebf70e81fe7ecd2f1f1
1e01b697191a910a872e95ddfce27a91cebc57dd
/GrfDebugExecution.cpp
e9b52dacd0e94809dd7f0d5a2c44a1395b028367
[]
no_license
canercandan/codeworker
7c9871076af481e98be42bf487a9ec1256040d08
a68851958b1beef3d40114fd1ceb655f587c49ad
refs/heads/master
2020-05-31T22:53:56.492569
2011-01-29T19:12:59
2011-01-29T19:12:59
1,306,254
7
5
null
null
null
null
IBM852
C++
false
false
32,924
cpp
/* "CodeWorker": a scripting language for parsing and generating text. Copyright (C) 1996-1997, 1999-2002 CÚdric Lemaire 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 To contact the author: [email protected] */ #ifdef WIN32 #pragma warning (disable : 4786) #endif #include <fstream> #include "UtlException.h" #include "CppCompilerEnvironment.h" #include "CGRuntime.h" #include "DtaScriptVariable.h" #include "DtaProject.h" #include "DtaBNFScript.h" #include "ExprScriptVariable.h" #include "ExprScriptExpression.h" #include "UtlString.h" #include "GrfDebugExecution.h" #define printDebugLine traceLine #define printDebugText traceText #define debugCommand inputLine namespace CodeWorker { DtaBreakpoint::~DtaBreakpoint() { delete _pCondition; delete _pAction; } void DtaBreakpoint::setCondition(const std::string& sCondition) { _sCondition = sCondition; delete _pCondition; _pCondition = NULL; } void DtaBreakpoint::setAction(const std::string& sAction) { _sAction = sAction; delete _pAction; _pAction = NULL; } bool DtaBreakpoint::executeCondition(GrfCommand* pCommand, DtaScriptVariable& visibility) { if (_sCondition.empty()) return true; if (_pCondition == NULL) { GrfBlock* pBlock = pCommand->getParent(); ScpStream stream(_sCondition); try { _pCondition = pCommand->getParent()->getScript()->parseExpression(*pBlock, stream); } catch(UtlException& exception) { CGRuntime::printDebugLine("in 'when' clause of a breakpoint: " + _sCondition); CGRuntime::printDebugLine(exception.getMessage()); CGRuntime::printDebugText(exception.getTraceStack()); return true; } if (stream.skipEmpty()) { if (stream.peekChar() != '{') { delete _pCondition; _pCondition = NULL; CGRuntime::printDebugLine("syntax error at the end of the 'when' clause of a breakpoint: " + _sCondition); return true; } setAction(stream.readBuffer() + stream.getInputLocation()); } } std::string sResult = _pCondition->getValue(visibility); return !sResult.empty(); } void DtaBreakpoint::executeAction(GrfCommand* pCommand, DtaScriptVariable& visibility) { if (_sAction.empty()) return; if (_pAction == NULL) { ScpStream stream(_sAction); _pAction = new GrfBlock(pCommand->getParent()); try { pCommand->getParent()->getScript()->parseBlock(stream, *_pAction); } catch(UtlException& exception) { delete _pAction; _pAction = NULL; CGRuntime::printDebugLine("in action of a breakpoint: " + _sAction); CGRuntime::printDebugLine(exception.getMessage()); CGRuntime::printDebugText(exception.getTraceStack()); return; } } _pAction->execute(visibility); } class DtaWatchNodeListener : public DtaNodeListener { private: GrfDebugExecution* _pDebugContext; bool _bDeleted; DtaBreakpoint* _pBP; std::string _sKey; public: inline DtaWatchNodeListener(const std::string& sKey, GrfDebugExecution* pDebugContext) : _sKey(sKey), _pDebugContext(pDebugContext), _bDeleted(false), _pBP(NULL) {} virtual ~DtaWatchNodeListener() { _pDebugContext->removeWatchNodeListener(this); delete _pBP; } inline const std::string& getKey() const { return _sKey; } inline std::string getCondition() const { return (_pBP == NULL) ? "" : _pBP->getCondition(); } void setCondition(const std::string& sCondition) { if (_pBP == NULL) _pBP = new DtaBreakpoint; _pBP->setCondition(sCondition); } void setAction(const std::string& sAction) { if (_pBP == NULL) _pBP = new DtaBreakpoint; _pBP->setAction(sAction); } virtual void onSetValue(const char* tcValue) { onHasChanged(); } virtual void onConcatValue(const char* tcValue) { onHasChanged(); } virtual void onSetReference(DtaScriptVariable* pReference) { onHasChanged(); } virtual void onSetExternal(ExternalValueNode* pExternalValue) { onHasChanged(); } virtual void onSetIterator(DtaArrayIterator** pIteratorData) { onHasChanged(); } virtual void onAddAttribute(DtaScriptVariable* pAttribute) { onHasChanged(); } virtual void onRemoveAttribute(DtaScriptVariable* pAttribute) { onHasChanged(); } virtual void onArrayHasChanged() { onHasChanged(); } virtual void onClearContent() { onHasChanged(); } virtual void onDelete() { _bDeleted = true; } private: void onHasChanged() { if (!_bDeleted) { CGRuntime::printDebugLine("debug: the variable '" + getNode()->getCompleteName() + "' has changed"); if (_pBP == NULL) _pDebugContext->_bStop = true; else _pDebugContext->_pConditionalStop = _pBP; } } }; class GrfDebugActivation { private: static GrfDebugExecution* _pActiveDebugger; GrfDebugExecution* _pPreviousActiveDebugger; public: GrfDebugActivation(GrfDebugExecution* pActiveDebugger) { _pPreviousActiveDebugger = _pActiveDebugger; _pActiveDebugger = pActiveDebugger; } ~GrfDebugActivation() { _pActiveDebugger = _pPreviousActiveDebugger; } static void unactivateCurrentDebugger() { _pActiveDebugger = NULL; } static bool isActiveDebugger(GrfDebugExecution* pDebugger) { return (_pActiveDebugger == pDebugger); } }; GrfDebugExecution* GrfDebugActivation::_pActiveDebugger = NULL; GrfDebugExecution::~GrfDebugExecution() { clearBreakpoints(); clearWatchpoints(); } void GrfDebugExecution::clearBreakpoints() { for (std::map<std::string, std::map<int, DtaBreakpoint*> >::iterator i = _listOfBreakpoints.begin(); i != _listOfBreakpoints.end(); ++i) { for (std::map<int, DtaBreakpoint*>::iterator j = i->second.begin(); j != i->second.end(); ++j) { delete j->second; } } _listOfBreakpoints.clear(); } void GrfDebugExecution::clearWatchpoints() { while (!_watchListeners.empty()) { DtaWatchNodeListener* pListener = *(_watchListeners.begin()); _watchListeners.pop_front(); pListener->getNode()->removeListener(pListener); } } void GrfDebugExecution::clearWatchpoint(const std::string& sKey) { for (std::list<DtaWatchNodeListener*>::iterator i = _watchListeners.begin(); i != _watchListeners.end(); ++i) { if ((*i)->getKey() == sKey) { DtaWatchNodeListener* pListener = *i; _watchListeners.remove(pListener); pListener->getNode()->removeListener(pListener); break; } } } bool GrfDebugExecution::executeCommand(GrfCommand* pCommand, DtaScriptVariable& visibility, ScpStream& stream) { if (!stream.skipEmpty()) return false; bool bContinue = false; std::string sIdentifier; int iChar = stream.readChar(); while (((iChar >= (int) 'a') && (iChar <= (int) 'z')) || ((iChar >= (int) 'A') && (iChar <= (int) 'Z'))) { if ((iChar >= (int) 'A') && (iChar <= (int) 'Z')) iChar -= (int) ' '; sIdentifier += (char) iChar; iChar = stream.readChar(); } if (iChar > 0) stream.goBack(); if (sIdentifier.empty()) { if (stream.isEqualTo('?')) { help(); } else if (stream.peekChar() == '{') { try { GrfBlock action(pCommand->getParent()); DtaScript* pScript = pCommand->getParent()->getScript(); DtaPatternScript* pPatternScript = dynamic_cast<DtaPatternScript*>(pScript); if (pPatternScript != NULL) { pPatternScript->setExecMode(true); DtaBNFScript* pBNFScript = dynamic_cast<DtaBNFScript*>(pScript); if (pBNFScript != NULL) { pBNFScript->setBNFMode(false); } } pScript->parseBlock(stream, action); action.execute(visibility); } catch(UtlException& exception) { CGRuntime::printDebugLine(exception.getMessage()); CGRuntime::printDebugText(exception.getTraceStack()); return false; } } else if (stream.skipEmpty()) { CGRuntime::printDebugLine("debug: syntax error"); return false; } } else if ((sIdentifier == "h") || (sIdentifier == "help")) { help(); } else if ((sIdentifier == "q") || (sIdentifier == "quit")) { GrfDebugActivation::unactivateCurrentDebugger(); bContinue = true; } else if ((sIdentifier == "r") || (sIdentifier == "run")) { _bStop = false; _bRun = true; _pNext = NULL; bContinue = true; } else if ((sIdentifier == "s") || (sIdentifier == "step")) { stream.skipEmpty(); if (stream.readInt(_iIterations)) { if (_iIterations <= 0) { CGRuntime::printDebugLine("debug: 'step' cannot require a negative number of iterations"); return false; } } else _iIterations = 1; _bStop = true; _bRun = false; _pNext = NULL; bContinue = true; } else if ((sIdentifier == "n") || (sIdentifier == "next")) { stream.skipEmpty(); if (stream.readInt(_iIterations)) { if (_iIterations <= 0) { CGRuntime::printDebugLine("debug: 'next' cannot require a negative number of iterations"); return false; } } else _iIterations = 1; _bStop = false; _bRun = false; _pNext = pCommand; bContinue = true; } else if ((sIdentifier == "b") || (sIdentifier == "breakpoint")) { stream.skipEmpty(); std::string sFilename; if (!stream.readString(sFilename)) { if (stream.isEqualToIdentifier("list") || !stream.skipEmpty()) { std::string sCurrentDirectory = CGRuntime::getCurrentDirectory(); int iRank = 1; for (std::map<std::string, std::map<int, DtaBreakpoint*> >::const_iterator i = _listOfBreakpoints.begin(); i != _listOfBreakpoints.end(); ++i) { for (std::map<int, DtaBreakpoint*>::const_iterator j = i->second.begin(); j != i->second.end(); ++j) { std::string sFilename = i->first; if (sFilename.size() > sCurrentDirectory.size()) { std::string::size_type iSize = sCurrentDirectory.size(); std::string sPath = sFilename.substr(0, iSize); if (stricmp(sPath.c_str(), sCurrentDirectory.c_str()) == 0) { if ((sFilename[iSize] == '/') || (sFilename[iSize] == '\\')) ++iSize; sFilename = sFilename.substr(iSize); } } char tcRank[64]; sprintf(tcRank, "%4d: \"", iRank++); char tcNumber[64]; sprintf(tcNumber, "\" breakpoint at %d", j->first); CGRuntime::printDebugLine(tcRank + sFilename + tcNumber); if (!j->second->getCondition().empty()) { CGRuntime::printDebugLine("\t\twhen " + j->second->getCondition()); } } } goto finallyExecuteCommand; } GrfCommand* pCommand = getLastCommand(); if (pCommand == NULL) { CGRuntime::printDebugLine("debug: filename of breakpoint expected"); return false; } sFilename = getParsingFilePtr(pCommand); } else { stream.skipEmpty(); } std::string sIdentifier; if ((!stream.readIdentifier(sIdentifier)) || (sIdentifier != "at")) { CGRuntime::printDebugLine("debug: 'at' expected for giving line number"); return false; } stream.skipEmpty(); int iLineNumber; if ((!stream.readInt(iLineNumber)) || (iLineNumber <= 0)) { CGRuntime::printDebugLine("debug: positive line number expected after 'at'"); return false; } stream.skipEmpty(); DtaBreakpoint* pBP = registerBreakpoint(visibility, sFilename.c_str(), iLineNumber); if (stream.isEqualToIdentifier("when")) { std::string sCondition = stream.readBuffer() + stream.getInputLocation(); pBP->setCondition(sCondition); } else if (stream.peekChar() == '{') { std::string sAction = stream.readBuffer() + stream.getInputLocation(); if (!sAction.empty()) pBP->setAction(sAction); } } else if ((sIdentifier == "c") || (sIdentifier == "clear")) { stream.skipEmpty(); std::string sFilename; int iRank; if (stream.readString(sFilename)) { stream.skipEmpty(); if (stream.isEqualToIdentifier("at")) { stream.skipEmpty(); int iLineNumber; if ((!stream.readInt(iLineNumber)) || (iLineNumber <= 0)) { CGRuntime::printDebugLine("debug: positive line number expected after 'at'"); return false; } clearBreakpoint(visibility, sFilename.c_str(), iLineNumber); } else { clearBreakpoint(visibility, sFilename.c_str(), -1); } } else if (stream.isEqualToIdentifier("all")) { clearBreakpoint(visibility, NULL, -1); clearWatchpoints(); } else if (stream.readInt(iRank)) { for (std::map<std::string, std::map<int, DtaBreakpoint*> >::const_iterator i = _listOfBreakpoints.begin(); i != _listOfBreakpoints.end(); ++i) { for (std::map<int, DtaBreakpoint*>::const_iterator j = i->second.begin(); j != i->second.end(); ++j) { --iRank; if (iRank == 0) { clearBreakpoint(visibility, i->first.c_str(), j->first); goto finallyExecuteCommand; } } } CGRuntime::printDebugLine("debug: bad breakpoint rank; please check its value by typing 'b list'"); return false; } else { try { GrfBlock* pBlock = pCommand->getParent(); std::auto_ptr<ExprScriptVariable> pVarExpr(pCommand->getParent()->getScript()->parseVariableExpression(*pBlock, stream)); std::string sKey = pVarExpr->toString(); clearWatchpoint(sKey); } catch(UtlException& exception) { CGRuntime::printDebugLine(exception.getMessage()); CGRuntime::printDebugText(exception.getTraceStack()); return false; } } } else if ((sIdentifier == "d") || (sIdentifier == "display")) { stream.skipEmpty(); int iDisplaySize; if (stream.readInt(iDisplaySize) && (iDisplaySize >= 0)) _iDisplaySize = iDisplaySize; display(pCommand, visibility, _iDisplaySize); } else if ((sIdentifier == "fl") || (sIdentifier == "fs") || (sIdentifier == "file")) { stream.skipEmpty(); if (sIdentifier == "file") { if (!stream.readIdentifier(sIdentifier)) { CGRuntime::printDebugLine("debug: 'file load' or 'file save' expected"); return false; } if (sIdentifier == "load") sIdentifier = "fl"; else if (sIdentifier == "save") sIdentifier = "fs"; else { CGRuntime::printDebugLine("debug: 'file load' or 'file save' expected"); return false; } stream.skipEmpty(); } std::string sFile; if (!stream.readString(sFile)) { CGRuntime::printDebugLine("debug: file name between double quotes expected"); return false; } if (!_bReadingHistory) { if (sIdentifier == "fl") { try { ScpStream file(sFile, ScpStream::IN | ScpStream::PATH); _history << file.readBuffer(); } catch(std::exception& exception) { CGRuntime::printDebugLine("debug: " + std::string(exception.what())); return false; } _bReadingHistory = true; } else { _history.saveIntoFile(sFile, true); } } return false; } else if ((sIdentifier == "l") || (sIdentifier == "local")) { DtaScriptVariableList* pAttributes = visibility.getAttributes(); while (pAttributes != NULL) { CGRuntime::printDebugLine(pAttributes->getNode()->getName()); pAttributes = pAttributes->getNext(); } } else if ((sIdentifier == "o") || (sIdentifier == "object")) { DtaScript* pScript = pCommand->getParent()->getScript(); ExprScriptVariable* pVariableExpr = pScript->parseVariableExpression(*pCommand->getParent(), stream); stream.skipEmpty(); int iDepth; if (!stream.readInt(iDepth)) iDepth = 0; if (pVariableExpr == NULL) CGRuntime::printDebugLine("debug: syntax error on variable"); else { DtaScriptVariable* pVariable = visibility.getExistingVariable(*pVariableExpr); if (pVariable == NULL) { CGRuntime::printDebugLine("(null)"); } else { pVariable->traceObject(iDepth); } delete pVariableExpr; } } else if (sIdentifier == "stack") { traceStack(pCommand, visibility); } else if ((sIdentifier == "t") || (sIdentifier == "trace")) { std::auto_ptr<DtaScript> pScript(new DtaScript(NULL)); std::auto_ptr<ExprScriptExpression> pExpr(pScript->parseExpression(*pCommand->getParent(), stream)); if (pExpr.get() == NULL) CGRuntime::printDebugLine("debug: syntax error on expression"); else { std::string sValue = pExpr->getValue(visibility); CGRuntime::printDebugLine(sValue); } } else if ((sIdentifier == "w") || (sIdentifier == "watch")) { if (stream.skipEmpty()) { for (std::list<DtaWatchNodeListener*>::const_iterator i = _watchListeners.begin(); i != _watchListeners.end(); ++i) { DtaWatchNodeListener* pListener = *i; CGRuntime::printDebugText("\t" + pListener->getKey()); std::string sCondition = pListener->getCondition(); if (sCondition.empty()) { CGRuntime::printDebugLine(""); } else { CGRuntime::printDebugLine(" when " + sCondition); } } } else { try { GrfBlock* pBlock = pCommand->getParent(); std::auto_ptr<ExprScriptVariable> pVarExpr(pCommand->getParent()->getScript()->parseVariableExpression(*pBlock, stream)); DtaScriptVariable* pVariable = visibility.getExistingVariable(*pVarExpr); if (pVariable == NULL) { CGRuntime::printDebugLine("debug: variable not found in the scope"); return false; } std::string sKey = pVarExpr->toString(); clearWatchpoint(sKey); DtaWatchNodeListener* pListener = new DtaWatchNodeListener(sKey, this); _watchListeners.push_back(pListener); pVariable->addListener(pListener); stream.skipEmpty(); if (stream.isEqualToIdentifier("when")) { std::string sCondition = stream.readBuffer() + stream.getInputLocation(); pListener->setCondition(sCondition); } else if (stream.peekChar() == '{') { std::string sAction = stream.readBuffer() + stream.getInputLocation(); if (!sAction.empty()) pListener->setAction(sAction); } } catch(UtlException& exception) { CGRuntime::printDebugLine(exception.getMessage()); CGRuntime::printDebugText(exception.getTraceStack()); return false; } } } else { CGRuntime::printDebugLine("debug: unknown command '" + sIdentifier + "'"); return false; } finallyExecuteCommand: if (!_bReadingHistory) _history << stream.readBuffer() << '\n'; return bContinue; } void GrfDebugExecution::help() { CGRuntime::printDebugLine("Debugger"); CGRuntime::printDebugLine(" Commands available:"); CGRuntime::printDebugLine(" - 'b' [<filename>] 'at' <line> [<when>] [<action>] (or 'breakpoint'):"); CGRuntime::printDebugLine(" sets a breakpoint into file <filename> at line <line>"); CGRuntime::printDebugLine(" - <when> ::= 'when' <boolean_expression>"); CGRuntime::printDebugLine(" conditional breakpoint; the expression is in CW script"); CGRuntime::printDebugLine(" - <action> ::= '{' <instructions> '}'"); CGRuntime::printDebugLine(" a piece of CW script to execute when activating the bp"); CGRuntime::printDebugLine(" - 'b' ['list'] (or 'breakpoint'):"); CGRuntime::printDebugLine(" displays all breakpoints and their condition, if any"); CGRuntime::printDebugLine(" - 'c' [<filename> ['at' <line>]] (or 'clear'):"); CGRuntime::printDebugLine(" 1. clears a breakpoint into file <filename> at line <line>"); CGRuntime::printDebugLine(" 2. or clears all breakpoints into file <filename>"); CGRuntime::printDebugLine(" - 'c' <rank> (or 'clear'):"); CGRuntime::printDebugLine(" clears the breakpoint designated by its line number in the list"); CGRuntime::printDebugLine(" - 'c' <variable> (or 'clear'):"); CGRuntime::printDebugLine(" clears the watchpoint on <variable> if any"); CGRuntime::printDebugLine(" - 'c' 'all' (or 'clear all'):"); CGRuntime::printDebugLine(" clears all breakpoints and all watchpoints"); CGRuntime::printDebugLine(" - 'd' [<size>] or 'display' [<size>]:"); CGRuntime::printDebugLine(" current line is displayed with <size> lines above and below"); CGRuntime::printDebugLine(" If size isn't specified, the last known is taken"); CGRuntime::printDebugLine(" - 'fl' \"<filename>\" (or 'file load'):"); CGRuntime::printDebugLine(" loads a file containing debugger commands to execute"); CGRuntime::printDebugLine(" - 'fs' \"<filename>\" (or 'file save'):"); CGRuntime::printDebugLine(" saves the debugger commands executed up to now to a file"); CGRuntime::printDebugLine(" - 'h' or 'help' or '?': help"); CGRuntime::printDebugLine(" - 'l' or 'local': displays local variables on the stack"); CGRuntime::printDebugLine(" - 'n' or 'next': next"); CGRuntime::printDebugLine(" - 'o' or 'object' <variable> [<depth>]:"); CGRuntime::printDebugLine(" displays the content of a variable, eventually up to a given depth"); CGRuntime::printDebugLine(" - 'q' or 'quit' quits this debugging session"); CGRuntime::printDebugLine(" - 'r' or 'run': run up to next breakpoint"); CGRuntime::printDebugLine(" - 's' or 'step': go step by step"); CGRuntime::printDebugLine(" - 'stack': displays stack call"); CGRuntime::printDebugLine(" - 't' or 'trace' <expression>: displays result of an expression"); CGRuntime::printDebugLine(" - 'w' <variable> [<when>] [<action>] (or 'watch'):"); CGRuntime::printDebugLine(" the controlling sequence stops when <variable> changes"); CGRuntime::printDebugLine(" - <when> ::= 'when' <boolean_expression>"); CGRuntime::printDebugLine(" conditional watchpoint; the expression is in CW script"); CGRuntime::printDebugLine(" - <action> ::= '{' <instructions> '}'"); CGRuntime::printDebugLine(" a piece of CW script to execute at the watchpoint"); CGRuntime::printDebugLine(" - 'w' or 'watch':"); CGRuntime::printDebugLine(" displays all watchpoints and their condition, if any"); CGRuntime::printDebugLine(" - '{' <instructions> '}': a piece of CW script to execute immediatly"); CGRuntime::printDebugLine(" - '//' or '/*'...'*/': comment"); } std::string GrfDebugExecution::display(GrfCommand* pCommand, DtaScriptVariable& visibility, int iSize, bool bEchoOn) { std::string sDisplayedText; std::string sCompleteFileName; if (CGRuntime::getInputStream() != NULL) { sDisplayedText = "parsed file is \"" + CGRuntime::getInputStream()->getFilename() + "\":"; char sLocation[80]; sprintf(sLocation, "%d,%d\n", CGRuntime::countInputLines(), CGRuntime::countInputCols()); sDisplayedText += sLocation; } const char* tcParsingFile = getParsingFilePtr(pCommand); if (tcParsingFile == NULL) { sDisplayedText += "no debug information on the current command for displaying"; } else { std::ifstream* pFile = openInputFileFromIncludePath(tcParsingFile, sCompleteFileName); if (pFile == NULL) { sDisplayedText += "debug: unable to open file \""; sDisplayedText += getParsingFilePtr(pCommand); sDisplayedText += "\" for displaying\n"; } else { setLocation(*pFile, getFileLocation(pCommand)); setLocationAtXLines(*pFile, -iSize); for (int i = 0; i < 2*iSize + 1; i++) { std::string sLine; int iLocation = getLineCount(*pFile); if (readLine(*pFile, sLine)) { char sLineText[512]; if (iSize > 0) sprintf(sLineText, "%d: ", iLocation); else { const char* u = strrchr(getParsingFilePtr(pCommand), '/'); if (u == NULL) { u = strrchr(getParsingFilePtr(pCommand), '\\'); if (u == NULL) u = getParsingFilePtr(pCommand); else ++u; } else { const char* v = strrchr(u, '\\'); if (v != NULL) u = v; u++; } sprintf(sLineText, "\"%s\" at %d: ", u, iLocation); } sLine = sLineText + sLine + "\n"; if (i == iSize) { char* u = sLineText; while (*u != '\0') *u++ = ' '; sLine += sLineText; int iPrecedent = getLocation(*pFile); setLocation(*pFile, getFileLocation(pCommand)); std::string sHeader; getColEmptyHeader(*pFile, sHeader); setLocation(*pFile, iPrecedent); sLine += sHeader + "^\n"; } sDisplayedText += sLine; } } pFile->close(); delete pFile; } } if (bEchoOn && !sDisplayedText.empty()) CGRuntime::printDebugText(sDisplayedText); return sDisplayedText; } void GrfDebugExecution::traceStack(GrfCommand* pCommand, DtaScriptVariable& visibility) { display(pCommand, visibility, 0); std::string sPreviousText; for (std::list<GrfCommand*>::iterator i = _stack.begin(); i != _stack.end(); i++) { if (*i != NULL) { std::string sText = display(*i, visibility, 0, false); if (sPreviousText != sText) CGRuntime::printDebugText(sText); sPreviousText = sText; } } } DtaBreakpoint* GrfDebugExecution::registerBreakpoint(DtaScriptVariable& visibility, const char* sFilename, int iLineNumber) { std::string sCompleteFileName; if (_listOfBreakpoints.find(sFilename) == _listOfBreakpoints.end()) { std::ifstream* pFile = openInputFileFromIncludePath(sFilename, sCompleteFileName); if (pFile == NULL) { CGRuntime::printDebugLine("debug: unable to open file \"" + std::string(sFilename) + "\" for breakpoint"); return NULL; } pFile->close(); delete pFile; } else { sCompleteFileName = sFilename; } sCompleteFileName = CGRuntime::canonizePath(sCompleteFileName); std::map<int, DtaBreakpoint*>& bpList = _listOfBreakpoints[sCompleteFileName]; if (bpList.find(iLineNumber) == bpList.end()) { std::ifstream* pFile = openInputFileFromIncludePath(sFilename, sCompleteFileName); if (pFile == NULL) { CGRuntime::printDebugLine("debug: unable to open file \"" + std::string(sFilename) + "\" for breakpoint"); return NULL; } setLocationAtXLines(*pFile, iLineNumber - 1); int iBeginning = getLocation(*pFile); setLocationAtXLines(*pFile, 1); int iEnd = getLocation(*pFile); pFile->close(); delete pFile; if (iBeginning >= iEnd) { char tcNumber[32]; sprintf(tcNumber, "%d", iLineNumber); CGRuntime::printDebugLine("debug: unable to set a breakpoint at line " + std::string(tcNumber)); return NULL; } DtaBreakpoint* bp = new DtaBreakpoint; bpList[iLineNumber] = bp; bp->_iBeginning = iBeginning; bp->_iEnd = iEnd; return bp; } return bpList[iLineNumber]; } void GrfDebugExecution::clearBreakpoint(DtaScriptVariable& /*visibility*/, const char* sFilename, int iLineNumber) { if ((sFilename == NULL) || (*sFilename == '\0')) { clearBreakpoints(); } else { if (_listOfBreakpoints.find(sFilename) == _listOfBreakpoints.end()) { CGRuntime::printDebugLine("debug: no breakpoint on file \"" + std::string(sFilename) + "\""); } else if (iLineNumber <= 0) { std::map<int, DtaBreakpoint*> bpList; _listOfBreakpoints[sFilename] = bpList; } else { std::map<int, DtaBreakpoint*>& bpList = _listOfBreakpoints[sFilename]; if (bpList.find(iLineNumber) == bpList.end()) { char tcNumber[32]; sprintf(tcNumber, "%d", iLineNumber); CGRuntime::printDebugLine("debug: no breakpoint at line " + std::string(tcNumber) + " into file \"" + std::string(sFilename) + "\""); } else { delete bpList[iLineNumber]; bpList.erase(iLineNumber); } } } } DtaBreakpoint* GrfDebugExecution::stopOnBreakpoint(GrfCommand* pCommand, DtaScriptVariable& visibility) { const char* sFilename = getParsingFilePtr(pCommand); int iCharLocation = getFileLocation(pCommand); std::map<std::string, std::map<int, DtaBreakpoint*> >::const_iterator cursor = _listOfBreakpoints.find(sFilename); if (cursor == _listOfBreakpoints.end()) return NULL; const std::map<int, DtaBreakpoint*>& bpList = cursor->second; for (std::map<int, DtaBreakpoint*>::const_iterator i = bpList.begin(); i != bpList.end(); i++) { if (i->second->_iEnd > iCharLocation) { if (iCharLocation < i->second->_iBeginning) return NULL; if (i->second->executeCondition(pCommand, visibility)) return i->second; break; } } return NULL; } void GrfDebugExecution::handleBeforeExecutionCBK(GrfCommand* pCommand, DtaScriptVariable& visibility) { if (!GrfDebugActivation::isActiveDebugger(this)) return; if (getParsingFilePtr(pCommand) != NULL) { GrfExecutionContext::handleBeforeExecutionCBK(pCommand, visibility); DtaBreakpoint* pBP; if (_pConditionalStop != NULL) { if (_pConditionalStop->executeCondition(pCommand, visibility)) pBP = _pConditionalStop; else pBP = stopOnBreakpoint(pCommand, visibility); _pConditionalStop = NULL; } else pBP = stopOnBreakpoint(pCommand, visibility); if (pBP != NULL) { _iIterations = 0; pBP->executeAction(pCommand, visibility); } else if (_iIterations > 0) _iIterations--; if (_bStop || (pBP != NULL)) { if (_iIterations > 0) { if (_pNext != NULL) { _pNext = pCommand; _bStop = false; } } else { _pNext = NULL; std::string sText; bool bContinue; display(pCommand, visibility, 0); do { if (_bReadingHistory) { if (_history.skipEmpty() && _history.readLine(sText)) { CGRuntime::printDebugLine("<history> " + _sCursor + sText); } else { _bReadingHistory = false; sText = CGRuntime::debugCommand(true, _sCursor); } } else { sText = CGRuntime::debugCommand(true, _sCursor); } ScpStream stream; stream << sText; bContinue = !executeCommand(pCommand, visibility, stream); } while (bContinue); } } } } void GrfDebugExecution::handleAfterExecutionCBK(GrfCommand* pCommand, DtaScriptVariable& /*visibility*/) { if (_pNext == pCommand) { _bStop = true; } } void GrfDebugExecution::handleAfterExceptionCBK(GrfCommand* pCommand, DtaScriptVariable& visibility, UtlException& exception) { if (!GrfDebugActivation::isActiveDebugger(this)) return; GrfDebugActivation::unactivateCurrentDebugger(); if (getParsingFilePtr(pCommand) != NULL) { std::string sText; bool bContinue; CGRuntime::printDebugLine(exception.getMessage()); CGRuntime::printDebugLine(exception.getTraceStack()); do { if (_bReadingHistory) { if (_history.skipEmpty() && _history.readLine(sText)) { CGRuntime::printDebugLine("<history> " + _sCursor + sText); } else { _bReadingHistory = false; sText = CGRuntime::debugCommand(true, _sCursor); } } else { sText = CGRuntime::debugCommand(true, _sCursor); } ScpStream stream(sText); bContinue = !executeCommand(pCommand, visibility, stream); } while (bContinue); } } SEQUENCE_INTERRUPTION_LIST GrfDebugExecution::openSession(DtaScriptVariable& visibility) { SEQUENCE_INTERRUPTION_LIST result; int iDepth = 1; GrfExecutionContext* pContext = getLastExecutionContext(); while (pContext != NULL) { pContext = pContext->getLastExecutionContext(); iDepth++; } char tcDepth[16]; sprintf(tcDepth, "%d", iDepth); CGRuntime::printDebugLine("-- debug session 'D" + std::string(tcDepth) + "' --"); GrfDebugActivation debugActivation(this); char sBuffer[16]; sprintf(sBuffer, "D%d> ", iDepth); _sCursor = sBuffer; try { clearBreakpoints(); _pConditionalStop = NULL; result = GrfBlock::executeInternal(visibility); } catch(UtlException&/* exception*/) { CGRuntime::printDebugLine("-- debug session 'D" + std::string(tcDepth) + "' interrupted by an exception --"); throw/* UtlException(exception)*/; } CGRuntime::printDebugLine("-- end of debug session 'D" + std::string(tcDepth) + "' --"); return result; } void GrfDebugExecution::compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const { CW_BODY_INDENT << "// DEBUG execution required into the source code generation script: not translated"; CW_BODY_ENDL; } }
[ "cedric.p.r.lemaire@28b3f5f3-d42e-7560-b87f-5f53cf622bc4" ]
[ [ [ 1, 819 ] ] ]
0770f8d1ddfcc07df50d6e163c4f8d0ddfcf8a11
ad33a51b7d45d8bf1aa900022564495bc08e0096
/DES/DES_GOBSTG/Core/Keytable.cpp
e40ab44c394f6c491204ae47d8598988e8696a56
[]
no_license
CBE7F1F65/e20671a6add96e9aa3551d07edee6bd4
31aff43df2571d334672929c88dfd41315a4098a
f33d52bbb59dfb758b24c0651449322ecd1b56b7
refs/heads/master
2016-09-11T02:42:42.116248
2011-09-26T04:30:32
2011-09-26T04:30:32
32,192,691
0
0
null
null
null
null
UTF-8
C++
false
false
26,808
cpp
#include "../Header/Keytable.h" #include "../Header/Scripter.h" #include "../Header/Bullet.h" #include "../Header/SE.h" #include "../Header/Process.h" #include "../Header/BGLayer.h" #include "../Header/Data.h" #include "../Header/SelectSystem.h" #include "../Header/PushKey.h" #include "../Header/Beam.h" #include "../Header/Player.h" #include "../Header/Item.h" #include "../Header/Enemy.h" #include "../Header/Chat.h" #include "../Header/GameInput.h" #include "../Header/EventZone.h" scrKeyWord scrKeyTable[] = { {"DES_TH_TOB_SCRIPTFILE", SCR_SCRIPTTAG}, {"CONTROLFILE", SCR_CONTROL}, {"STAGEFILE", SCR_STAGE}, {"EDEFFILE", SCR_EDEF}, {"SCENEFILE", SCR_SCENE}, {"FUNCTIONFILE", SCR_FUNCTION}, {"EVENTFILE", SCR_EVENT}, {"#", SCR_FILENAME}, {"@", SCR_BLOCKCON}, {"SCRFILENAME", SCR_FILENAME}, {"SCRBLOCKCON", SCR_BLOCKCON}, /************************************************************************/ /* Action */ /************************************************************************/ {"SD", SCR_SD}, {"SDf", SCR_SDF}, {"ST", SCR_ST}, {"CALL", SCR_CALL}, {"CALLEX", SCR_CALLEX}, {"EXECUTE", SCR_EXECUTE}, {"RETURN", SCR_RETURN}, {"SETSTATE", SCR_SETSTATE}, {"SETTIME", SCR_SETTIME}, {"CLEARALL", SCR_CLEARALL}, {"SETCHARA", SCR_SETCHARA}, {"SETSCENE", SCR_SETSCENE}, {"SETMODE", SCR_SETMODE}, {"STARTPREP", SCR_STARTPREP}, {"SETKEY", SCR_SETKEY}, {"DISABLEALLKEY", SCR_DISABLEALLKEY}, {"SETPUSHEVENT", SCR_SETPUSHEVENT}, {"UPDATEPUSHEVENT", SCR_UPDATEPUSHEVENT}, {"STOPACTION", SCR_STOPACTION}, {"SETFRAMESKIP", SCR_SETFRAMESKIP}, {"SAVEREPLAY", SCR_SAVEREPLAY}, {"MUSICCHANGE", SCR_MUSICCHANGE}, {"MUSICSLIDE", SCR_MUSICSLIDE}, {"SE", SCR_SE}, {"SEOFF", SCR_SEOFF}, {"HSVTORGB", SCR_HSVTORGB}, {"PRINT", SCR_PRINT}, {"FRONTSPRITE", SCR_FRONTSPRITE}, {"FADEOUTFRONTSPRITE", SCR_FADEOUTFRONTSPRITE}, {"FREEFRONTSPRITE", SCR_FREEFRONTSPRITE}, {"SETSHAKE", SCR_SETSHAKE}, /************************************************************************/ /* Basic */ /************************************************************************/ {"B", SCR_BUBUILD}, {"A", SCR_BUACTIONSET}, {"BC", SCR_BUBUILDCIRCLE}, {"BL", SCR_BUBUILDLINE}, {"BUDECANCEL", SCR_BUDECANCEL}, {"IZEZONE", SCR_IZEZONE}, {"BEB", SCR_BEBUILD}, {"BEVECTOR", SCR_BEVECTOR}, {"BEHOLD", SCR_BEHOLD}, {"BEPIN", SCR_BEPIN}, {"GB", SCR_GHBUILD}, {"GHSAIM", SCR_GHSAIM}, {"GHSET", SCR_GHSET}, {"GHCHASE", SCR_GHCHASE}, {"GHSETLIFE", SCR_GHSETLIFE}, {"GHCHANGE", SCR_GHCHANGE}, {"EB", SCR_ENBUILD}, {"EA", SCR_ENACTIONSET}, {"ENSAIM", SCR_ENSAIM}, {"ENCHASE", SCR_ENCHASE}, {"ENSETLIFE", SCR_ENSETLIFE}, {"ENCHANGE", SCR_ENCHANGE}, {"ENTOI", SCR_ENTOI}, {"ENAZBUILD", SCR_ENAZBUILD}, {"DAMAGEZONE", SCR_DAMAGEZONE}, {"BOSSSTORE", SCR_BOSSSTORE}, {"BOSSATTACK", SCR_BOSSATTACK}, {"RAMA", SCR_RAMA}, {"DIST", SCR_DIST}, {"CHASEAIM", SCR_CHASEAIM}, {"INTER", SCR_INTER}, {"BOSSUP", SCR_BOSSUP}, {"SPELLUP", SCR_SPELLUP}, {"EZONEBUILD", SCR_EZONEBUILD}, {"ACONTROL", SCR_ACONTROL}, {"BCONTROL", SCR_BCONTROL}, {"COLLISION_CIRCLE", SCR_COLLISION_CIRCLE}, {"COLLISION_SQUARE", SCR_COLLISION_SQUARE}, {"ITEMBUILD", SCR_ITEMBUILD}, {"EFFSETUP", SCR_EFFSETUP}, {"EFFSETUPEX", SCR_EFFSETUPEX}, {"EFFSETUPCHASE", SCR_EFFSETUPCHASE}, {"EFFSTOP", SCR_EFFSTOP}, {"EFFOFF", SCR_EFFOFF}, {"EFFSET", SCR_EFFSET}, {"EFFMOVETO", SCR_EFFMOVETO}, {"SETPPOS", SCR_SETPPOS}, {"SETPLIFE", SCR_SETPLIFE}, {"SETPINITLIFE", SCR_SETPINITLIFE}, {"ADDPNCHARGE", SCR_ADDPNCHARGE}, {"SETPFAITH", SCR_SETPFAITH}, {"SETPPOINT", SCR_SETPPOINT}, {"SETPBBORDER", SCR_SETPBBORDER}, {"SETPBSLOW", SCR_SETPBSLOW}, {"SETPBINFI", SCR_SETPBINFI}, {"SETPSPEED", SCR_SETPSPEED}, {"SETPSLOWSPEED", SCR_SETPSLOWSPEED}, {"SETPSPEEDFACTOR", SCR_SETPSPEEDFACTOR}, {"COLLAPSE", SCR_COLLAPSE}, {"SHOOTPB", SCR_SHOOTPB}, {"BONUSFLAG", SCR_BONUSFLAG}, {"BGVALUE", SCR_BGVALUE}, {"BGVALEX", SCR_BGVALEX}, {"BGTEXRECT", SCR_BGTEXRECT}, {"BGRECT", SCR_BGRECT}, {"BGZ", SCR_BGZ}, {"BGSCALE", SCR_BGSCALE}, {"BGCOLOR", SCR_BGCOLOR}, {"BGMOVE", SCR_BGMOVE}, {"BGFLAG", SCR_BGFLAG}, {"BGPARAL", SCR_BGPARAL}, {"BG4V", SCR_BG4V}, {"BGOFF", SCR_BGOFF}, {"BGBLEND", SCR_BGBLEND}, {"BGSETUP", SCR_BGSETUP}, {"SELBUILD", SCR_SELBUILD}, {"SELCLEAR", SCR_SELCLEAR}, {"SELCONFIRM", SCR_SELCONFIRM}, {"SELSETUP", SCR_SELSETUP}, {"SELSET", SCR_SELSET}, {"SELFLAG", SCR_SELFLAG}, {"ISELBUILD", SCR_ISELBUILD}, {"ISELCLEAR", SCR_ISELCLEAR}, {"ISELSET", SCR_ISELSET}, {"ISELFLAG", SCR_ISELFLAG}, {"ISELCOLOR", SCR_ISELCOLOR}, /************************************************************************/ /* Control */ /************************************************************************/ {"IF", SCR_IF}, {"ELSE", SCR_ELSE}, {"ELSEIF", SCR_ELSEIF}, {"{", SCR_THEN}, {"}", SCR_END}, {"LOOP", SCR_LOOP}, {"SKIP", SCR_SKIP}, {"CHATON", SCR_CHATON}, {"CHAT", SCR_CHAT}, {"CHATOFF", SCR_CHATOFF}, /************************************************************************/ /* Data */ /************************************************************************/ {"DATAGET", SCR_DATAGET}, {"DATAGETf", SCR_DATAGETf}, {"DATASET", SCR_DATASET}, {"DATASETf", SCR_DATASETf}, {"SETFLAG", SCR_SETFLAG}, {"TRYSTAGE", SCR_TRYSTAGE}, {"DEBUG_BREAKPOINT", SCR_DEBUG_BREAKPOINT}, /************************************************************************/ /* Expression */ /************************************************************************/ {"+", SCR_ADD_INT}, {"-", SCR_SUB_INT}, {"*", SCR_MUL_INT}, {"/", SCR_DIV_INT}, {"+f", SCR_ADD_FLOAT}, {"-f", SCR_SUB_FLOAT}, {"*f", SCR_MUL_FLOAT}, {"/f", SCR_DIV_FLOAT}, {"+u", SCR_ADD_UINT}, {"-u", SCR_SUB_UINT}, {"*u", SCR_MUL_UINT}, {"/u", SCR_DIV_UINT}, {"%", SCR_MOD}, {"%u", SCR_MOD_UINT}, {"~", SCR_INVERSE}, {"!", SCR_NOT}, {">", SCR_GREAT_INT}, {"<", SCR_LESS_INT}, {">f", SCR_GREAT_FLOAT}, {"<f", SCR_LESS_FLOAT}, {">u", SCR_GREAT_UINT}, {"<u", SCR_LESS_UINT}, /************************************************************************/ /* Function */ /************************************************************************/ {"BUI", SCR_BUI}, {"BUANGLE", SCR_BUANGLE}, {"BUSPEED", SCR_BUSPEED}, {"BUX", SCR_BUX}, {"BUY", SCR_BUY}, {"BU@", SCR_BUTIMER}, {"BUTIMER", SCR_BUTIMER}, {"BUCANCELABLE", SCR_BUCANCELABLE}, {"BUHAVEGRAY", SCR_BUHAVEGRAY}, {"BEI", SCR_BEI}, {"BEANGLE", SCR_BEANGLE}, {"BESPEED", SCR_BESPEED}, {"BEX", SCR_BEX}, {"BEY", SCR_BEY}, {"BE@", SCR_BETIMER}, {"BETIMER", SCR_BETIMER}, {"BEHOLDTAR", SCR_BEHOLDTAR}, {"BEPINTAR", SCR_BEPINTAR}, {"GHX", SCR_GHX}, {"GHY", SCR_GHY}, {"GH@", SCR_GHTIMER}, {"GHTIMER", SCR_GHTIMER}, {"GHI", SCR_GHI}, {"GHANGLE", SCR_GHANGLE}, {"GHSPEED", SCR_GHSPEED}, {"GHAMAP", SCR_GHAMAP}, {"GHRMAP", SCR_GHRMAP}, {"GHAIMX", SCR_GHAIMX}, {"GHAIMY", SCR_GHAIMY}, {"GHLIFE", SCR_GHLIFE}, {"GHAC", SCR_GHAC}, {"ENX", SCR_ENX}, {"ENY", SCR_ENY}, {"EN@", SCR_ENTIMER}, {"ENTIMER", SCR_ENTIMER}, {"ENI", SCR_ENI}, {"ENANGLE", SCR_ENANGLE}, {"ENSPEED", SCR_ENSPEED}, {"ENAMAP", SCR_ENAMAP}, {"ENRMAP", SCR_ENRMAP}, {"ENLEVEL", SCR_ENLEVEL}, {"ENAIMX", SCR_ENAIMX}, {"ENAIMY", SCR_ENAIMY}, {"ENAIMANGLE", SCR_ENAIMANGLE}, {"ENLIFE", SCR_ENLIFE}, {"ENNUM", SCR_ENNUM}, {"RAND", SCR_RAND}, {"RANDR", SCR_RANDR}, {"SEED", SCR_SEED}, {"SINA", SCR_SINA}, {"COSA", SCR_COSA}, {"TANA", SCR_TANA}, {"ASIN2", SCR_ASIN2}, {"ACOS2", SCR_ACOS2}, {"ATAN2", SCR_ATAN2}, {"SQRT", SCR_SQRT}, {"SIGN", SCR_SIGN}, {"ROLL", SCR_ROLL}, {"INTER", SCR_INTER}, {"REGANGLE", SCR_REGANGLE}, {"D", SCR_D}, {"Du", SCR_DU}, {"TX", SCR_TX}, {"TY", SCR_TY}, {"TIME", SCR_TIME}, {"NOW#", SCR_NOWNAME}, {"NOW@", SCR_NOWCON}, {"NOWNAME", SCR_NOWNAME}, {"NOWCON", SCR_NOWCON}, {"RANK", SCR_RANK}, {"SNOSTAGE", SCR_SNOSTAGE}, {"SNODIFFI", SCR_SNODIFFI}, {"SNOBATTLE", SCR_SNOBATTLE}, {"SNOUSER", SCR_SNOUSER}, {"CHARA", SCR_CHARA}, {"GETSCENE", SCR_GETSCENE}, {"MODE", SCR_MODE}, {"REPLAYMODE", SCR_REPLAYMODE}, {"FRAMESKIP", SCR_SETFRAMESKIP}, {"CHATI", SCR_CHATI}, {"BOSSFAILED", SCR_BOSSFAILED}, {"BOSSFLAG", SCR_BOSSFLAG}, {"CHECKKEY", SCR_CHECKKEY}, {"GETFLAG", SCR_GETFLAG}, {"PLAYERNAME", SCR_PLAYERNAME}, {"BOSSNAME", SCR_ENEMYNAME}, {"SPELLNAME", SCR_SPELLNAME}, {"SPELLUSERNAME", SCR_SPELLUSERNAME}, {"SPELLUSERENAME", SCR_SPELLUSERENAME}, {"BGS@", SCR_BGSTIMER}, {"BGSTIMER", SCR_BGSTIMER}, {"BGSI", SCR_BGSINDEX}, {"SELCOMPLETE", SCR_SELCOMPLETE}, {"SEL", SCR_SEL}, {"SELFIRSTID", SCR_SELFIRSTID}, {"ISELCOMPLETE", SCR_ISELCOMPLETE}, {"ISEL", SCR_ISEL}, {"ISELFIRSTID", SCR_ISELFIRSTID}, {"PX", SCR_PX}, {"PY", SCR_PY}, {"PLIFE", SCR_PLIFE}, {"PBOMB", SCR_PBOMB}, {"PPOWER", SCR_PPOWER}, {"PFAITH", SCR_PFAITH}, {"PPOINT", SCR_PPOINT}, {"PBDRAIN", SCR_PBDRAIN}, {"PBSLOW", SCR_PBSLOW}, {"PBINFI", SCR_PBINFI}, {"PSPEED", SCR_PSPEED}, {"PSLOWSPEED", SCR_PSLOWSPEED}, {"PGX", SCR_PGX}, {"PGY", SCR_PGY}, {"HAVEPLAYER", SCR_HAVEPLAYER}, {SCR_CONST_STR, SCR_CONST}, {"true", true}, {"false", false}, {"STATE_START", STATE_START}, {"STATE_PAUSE", STATE_PAUSE}, {"STATE_CONTINUE", STATE_CONTINUE}, {"STATE_CLEAR", STATE_CLEAR}, {"STATE_ENDING", STATE_ENDING}, {"STATE_TITLE", STATE_TITLE}, {"STATE_MATCH_SELECT", STATE_MATCH_SELECT}, {"STATE_PLAYER_SELECT", STATE_PLAYER_SELECT}, {"STATE_SCENE_SELECT", STATE_SCENE_SELECT}, {"STATE_OVER", STATE_OVER}, {"STATE_SPELL", STATE_SPELL}, {"STATE_REPLAY", STATE_REPLAY}, {"STATE_RESULT", STATE_RESULT}, {"STATE_MUSIC", STATE_MUSIC}, {"STATE_OPTION", STATE_OPTION}, {"STATE_INIT", STATE_INIT}, {"PQUIT", PQUIT}, {"PGO", PGO}, {"POK", POK}, {"PBACK", PBACK}, {"PTURN", PTURN}, {"PSKIP", PSKIP}, {"THEN", THEN}, {"SECTIONEND", SECTIONEND}, {"EVERY", EVERY}, {"EVERYMOD", EVERYMOD}, {"TIMERGREAT", TIMERGREAT}, {"TIMEREQUAL", TIMEREQUAL}, {"TIMERLESS", TIMERLESS}, {"TIMERRANGE", TIMERRANGE}, {"TYPEEQUAL", TYPEEQUAL}, {"COLOREQUAL", COLOREQUAL}, {"ANGLEGREAT", ANGLEGREAT}, {"ANGLEEQUAL", ANGLEEQUAL}, {"ANGLELESS", ANGLELESS}, {"ANGLERANGE", ANGLERANGE}, {"XGREAT", XGREAT}, {"XLESS", XLESS}, {"XRANGE", XRANGE}, {"YGREAT", YGREAT}, {"YLESS", YLESS}, {"YRANGE", YRANGE}, {"VALGREAT", VALGREAT}, {"VALEQUAL", VALEQUAL}, {"VALLESS", VALLESS}, {"VALRANGE", VALRANGE}, {"SPEEDGREAT", SPEEDGREAT}, {"SPEEDEQUAL", SPEEDEQUAL}, {"SPEEDLESS", SPEEDLESS}, {"SPEEDRANGE", SPEEDRANGE}, {"INDEXMODGREAT", INDEXMODGREAT}, {"INDEXMODEQUAL", INDEXMODEQUAL}, {"INDEXMODLESS", INDEXMODLESS}, {"INDEXMODRANGE", INDEXMODRANGE}, {"BOUNCEGREAT", BOUNCEGREAT}, {"BOUNCEEQUAL", BOUNCEEQUAL}, {"BOUNCELESS", BOUNCELESS}, {"BOUNCERANGE", BOUNCERANGE}, {"TYPESET", TYPESET}, {"COLORSET", COLORSET}, {"ANGLESET", ANGLESET}, {"ANGLESETADD", ANGLESETADD}, {"ANGLEADJUST", ANGLEADJUST}, {"HEADANGLESET", HEADANGLESET}, {"HEADANGLESETADD", HEADANGLESETADD}, {"ANGLESETRMA", ANGLESETRMA}, {"ANGLESETRMAP", ANGLESETRMAP}, {"ANGLESETRMAT", ANGLESETRMAT}, {"ANGLESETAMA", ANGLESETAMA}, {"ANGLESETAMAP", ANGLESETAMAP}, {"ANGLESETAMAT", ANGLESETAMAT}, {"ANGLESETRAND", ANGLESETRAND}, {"ANGLESETADDRAND", ANGLESETADDRAND}, {"XSET", XSET}, {"YSET", YSET}, {"XSETADD", XSETADD}, {"YSETADD", YSETADD}, {"XSETACCADD", XSETACCADD}, {"YSETACCADD", YSETACCADD}, {"VALSET", VALSET}, {"VALSETADD", VALSETADD}, {"SPEEDSET", SPEEDSET}, {"SPEEDSETADD", SPEEDSETADD}, {"SPEEDSETMUL", SPEEDSETMUL}, {"CALLEVENT", CALLEVENT}, {"CHASE", CHASE}, {"AND", AND}, {"OR", OR}, {"NOT", NOT}, {"CONDITIONBYVAL", CONDITIONBYVAL}, {"CONDITIONBYINDEX", CONDITIONBYINDEX}, {"EXECUTEBYVAL", EXECUTEBYVAL}, {"EXECUTEBYINDEX", EXECUTEBYINDEX}, {"REMAIN", REMAIN}, {"DECANCEL", DECANCEL}, {"FADEOUT", FADEOUT}, {"BOUNCE", BOUNCE}, {"BOUNCELR", BOUNCELR}, {"BOUNCETB", BOUNCETB}, {"ENAC_NONE", ENAC_NONE}, {"ENAC_DIRECTSET_XYSOAOOO", ENAC_DIRECTSET_XYSOAOOO}, {"ENAC_CHASEPLAYER_OOSFATOO", ENAC_CHASEPLAYER_OOSFATOO}, {"ENAC_CHASEAIM_XYSOAOCO", ENAC_CHASEAIM_XYSOAOCO}, {"ENAC_TURNANGLE_OOOOATOE", ENAC_TURNANGLE_OOOOATOE}, {"ENAC_FADEOUT_OOOOOTOO", ENAC_FADEOUT_OOOOOTOO}, {"ENAC_REPOSITION_OOOOOOCO", ENAC_REPOSITION_OOOOOOCO}, {"ENAC_OVERPLAYER_XYOOOTCE", ENAC_OVERPLAYER_XYOOOTCE}, {"ENAC_DELAY_OOOOOTOO", ENAC_DELAY_OOOOOTOO}, {"ENAZTYPE_CIRCLE", ENAZTYPE_CIRCLE}, {"ENAZTYPE_ELLIPSE", ENAZTYPE_ELLIPSE}, {"ENAZTYPE_RECT", ENAZTYPE_RECT}, {"ENAZTYPE_RIGHTANGLED", ENAZTYPE_RIGHTANGLED}, {"ENAZOP_AND", ENAZOP_AND}, {"ENAZOP_OR", ENAZOP_OR}, {"ENAZOP_NOTAND", ENAZOP_NOTAND}, {"ENAZOP_NOTOR", ENAZOP_NOTOR}, {"ITEM_GAUGE", ITEM_GAUGE}, {"ITEM_BULLET", ITEM_BULLET}, {"ITEM_EX", ITEM_EX}, {"ITEM_POINT", ITEM_POINT}, {"ITEM_STARTSPEED", ITEM_STARTSPEED}, {"UBGID_BGMASK", UBGID_BGMASK}, {"UFGID_FGPAUSE", UFGID_FGPAUSE}, {"BG_NONE", BG_NONE}, {"BG_WHITEFLASH", BG_WHITEFLASH}, {"BG_REDFLASH", BG_REDFLASH}, {"BG_YELLOWFLASH", BG_YELLOWFLASH}, {"BG_WHITEOUT", BG_WHITEOUT}, {"BG_REDOUT", BG_REDOUT}, {"BG_FADEIN", BG_FADEIN}, {"BG_FADEINHALF", BG_FADEINHALF}, {"BG_FADEOUT", BG_FADEOUT}, {"BG_LIGHTUP", BG_LIGHTUP}, {"BG_LIGHTUPNORMAL", BG_LIGHTUPNORMAL}, {"BG_LIGHTRED", BG_LIGHTRED}, {"FG_PAUSEIN", FG_PAUSEIN}, {"FG_PAUSEOUT", FG_PAUSEOUT}, {"BGLAYERMAX", BGLAYERMAX}, {"FGLAYERMAX", FGLAYERMAX}, {"UBGLAYERMAX", UBGLAYERMAX}, {"BGLAYERSET_NONE", BGLAYERSET_NONE}, {"CS_L", CHATSPRITE_LEFT}, {"CS_R", CHATSPRITE_RIGHT}, {"CS_LF", CHATSPRITE_LEFTFLIP}, {"CS_RF", CHATSPRITE_RIGHTFLIP}, /* {"CS_LNN", CHATSPRITE_LEFT}, {"CS_RNN", CHATSPRITE_RIGHT}, {"CS_LFN", (CHATSPRITE_LEFT|CHATSPRITE_LEFTFLIP)}, {"CS_RFN", (CHATSPRITE_RIGHT|CHATSPRITE_LEFTFLIP)}, {"CS_LNF", (CHATSPRITE_LEFT|CHATSPRITE_RIGHTFLIP)}, {"CS_RNF", (CHATSPRITE_RIGHT|CHATSPRITE_RIGHTFLIP)}, {"CS_LFF", (CHATSPRITE_LEFT|CHATSPRITE_LEFTFLIP|CHATSPRITE_RIGHTFLIP)}, {"CS_RFF", (CHATSPRITE_RIGHT|CHATSPRITE_LEFTFLIP|CHATSPRITE_RIGHTFLIP)}, */ {"BLEND_COLORADD", BLEND_COLORADD}, {"BLEND_COLORMUL", BLEND_COLORMUL}, {"BLEND_ALPHABLEND", BLEND_ALPHABLEND}, {"BLEND_ALPHAADD", BLEND_ALPHAADD}, {"BLEND_ZWRITE", BLEND_ZWRITE}, {"BLEND_NOZWRITE", BLEND_NOZWRITE}, {"BLEND_DEFAULT", BLEND_DEFAULT}, {"BLEND_DEFAULT_Z", BLEND_DEFAULT_Z}, {"BGMT_FLASH", BGMT_FLASH}, {"BGMT_OUT", BGMT_OUT}, {"BGMT_FADE", BGMT_FADE}, {"BGMT_LIGHT", BGMT_LIGHT}, {"FGMT_PAUSE", FGMT_PAUSE}, {"BEAMFLAG_NONE", BEAMFLAG_NONE}, {"BEAMFLAG_HORIZON", BEAMFLAG_HORIZON}, {"BEAMFLAG_STOP", BEAMFLAG_STOP}, {"BEAMFLAG_HS", BEAMFLAG_HS}, {"BEAMFLAG_NOGRAZE", BEAMFLAG_NOGRAZE}, {"BEAMFLAG_DELAY", BEAMFLAG_DELAY}, {"PLAYERTYPEMAX", PLAYERTYPEMAX}, {"SE_DEFAULT", SE_DEFAULT}, {"SE_PLAYER_GRAZE", SE_PLAYER_GRAZE}, {"SE_PLAYER_SHOT", SE_PLAYER_SHOT}, {"SE_PLAYER_DEAD", SE_PLAYER_DEAD}, {"SE_PLAYER_EXPLODE", SE_PLAYER_EXPLODE}, {"SE_PLAYER_ALERT", SE_PLAYER_ALERT}, {"SE_PLAYER_SPELLCUTIN", SE_PLAYER_SPELLCUTIN}, {"SE_PLAYER_SLOWON", SE_PLAYER_SLOWON}, {"SE_PLAYER_SLOWOFF", SE_PLAYER_SLOWOFF}, {"SE_PLAYER_CHANGE", SE_PLAYER_CHANGE}, {"SE_PLAYER_BORDERON", SE_PLAYER_BORDERON}, {"SE_PLAYER_BORDEROFF", SE_PLAYER_BORDEROFF}, {"SE_PLAYER_CHARGEON", SE_PLAYER_CHARGEON}, {"SE_PLAYER_CHARGEUP", SE_PLAYER_CHARGEUP}, {"SE_BULLET_ERASE", SE_BULLET_ERASE}, {"SE_BULLET_CHANGE_1", SE_BULLET_CHANGE_1}, {"SE_BULLET_CHANGE_2", SE_BULLET_CHANGE_2}, {"SE_BULLET_BOUND", SE_BULLET_BOUND}, {"SE_BULLET_FADEOUT", SE_BULLET_FADEOUT}, {"SE_BULLET_SENDEX", SE_BULLET_SENDEX}, {"SE_BEAM_1", SE_BEAM_1}, {"SE_BEAM_2", SE_BEAM_2}, {"SE_BEAM_REFLECT", SE_BEAM_REFLECT}, {"SE_BEAM_FADEOUT", SE_BEAM_FADEOUT}, {"SE_BOSS_UP", SE_BOSS_UP}, {"SE_BOSS_DEAD", SE_BOSS_DEAD}, {"SE_BOSS_TIMEOUT", SE_BOSS_TIMEOUT}, {"SE_BOSS_TIMEUP", SE_BOSS_TIMEUP}, {"SE_BOSS_KIRA", SE_BOSS_KIRA}, {"SE_BOSS_POWER_1", SE_BOSS_POWER_1}, {"SE_BOSS_POWER_2", SE_BOSS_POWER_2}, {"SE_BOSS_BONUS", SE_BOSS_BONUS}, {"SE_BOSS_WARNING", SE_BOSS_WARNING}, {"SE_ENEMY_DAMAGE_1", SE_ENEMY_DAMAGE_1}, {"SE_ENEMY_DAMAGE_2", SE_ENEMY_DAMAGE_2}, {"SE_ENEMY_DEAD", SE_ENEMY_DEAD}, {"SE_GHOST_DEAD", SE_GHOST_DEAD}, {"SE_GHOST_MERGE", SE_GHOST_MERGE}, {"SE_GHOST_ACTIVATE", SE_GHOST_ACTIVATE}, {"SE_GHOST_SEND", SE_GHOST_SEND}, {"SE_ITEM_GET", SE_ITEM_GET}, {"SE_ITEM_EXTEND", SE_ITEM_EXTEND}, {"SE_ITEM_POWERUP", SE_ITEM_POWERUP}, {"SE_SYSTEM_OK", SE_SYSTEM_OK}, {"SE_SYSTEM_CANCEL", SE_SYSTEM_CANCEL}, {"SE_SYSTEM_SELECT", SE_SYSTEM_SELECT}, {"SE_SYSTEM_PAUSE", SE_SYSTEM_PAUSE}, {"MAXDESC", SCR_MAXDESC}, {"VARBEGIN", SCR_VARBEGIN}, {"FREEBEGIN", SCR_FREEBEGIN}, {"RESERVEBEGIN", SCR_RESERVEBEGIN}, {"INIT@", SCRIPT_CON_INIT}, {"POST@", SCRIPT_CON_POST}, {"QUIT@", SCRIPT_CON_QUIT}, {"INITAT", SCRIPT_CON_INIT}, {"POSTAT", SCRIPT_CON_POST}, {"QUITAT", SCRIPT_CON_QUIT}, {"BTYPE_BULLET", BTYPE_BULLET}, {"BTYPE_BEAM", BTYPE_BEAM}, {"BTYPE_ENEMY", BTYPE_ENEMY}, {"BTYPE_GHOST", BTYPE_GHOST}, {"CT_CONTROL", SCR_CTCONTROL}, {"CT_STAGE", SCR_CTSTAGE}, {"CT_EDEF", SCR_CTEDEF}, {"CT_SCENE", SCR_CTSCENE}, {"CT_FUNCTION", SCR_CTFUNCTION}, {"KEY_PRESSED", DIKEY_PRESSED}, {"KEY_DOWN", DIKEY_DOWN}, {"KEY_UP", DIKEY_UP}, {"STOPFLAG_WORLDSHAKE", FRAME_STOPFLAG_WORLDSHAKE}, {"STOPFLAG_PLAYER", FRAME_STOPFLAG_PLAYER}, {"STOPFLAG_PLAYERSPELL", FRAME_STOPFLAG_PLAYERSPELL}, {"STOPFLAG_PLAYERBULLET", FRAME_STOPFLAG_PLAYERBULLET}, {"STOPFLAG_ENEMY", FRAME_STOPFLAG_ENEMY}, {"STOPFLAG_EVENTZONE", FRAME_STOPFLAG_EVENTZONE}, {"STOPFLAG_BULLET", FRAME_STOPFLAG_BULLET}, {"STOPFLAG_BEAM", FRAME_STOPFLAG_BEAM}, {"STOPFLAG_ITEM", FRAME_STOPFLAG_ITEM}, {"STOPFLAG_LAYER", FRAME_STOPFLAG_LAYER}, {"STOPFLAG_EFFECTSP", FRAME_STOPFLAG_EFFECTSP}, {"STOPFLAG_EFFECTSYS", FRAME_STOPFLAG_EFFECTSYS}, {"STOPFLAG_PLAYERINDEX_0", FRAME_STOPFLAG_PLAYERINDEX_0}, {"STOPFLAG_PLAYERINDEX_1", FRAME_STOPFLAG_PLAYERINDEX_1}, {"STOPFLAG_PLAYERSET", FRAME_STOPFLAG_PLAYERSET}, {"STOPFLAG_ENEMYSET", FRAME_STOPFLAG_ENEMYSET}, {"STOPFLAG_ALLSET", FRAME_STOPFLAG_ALLSET}, {"STOPFLAG_SPELLSET", FRAME_STOPFLAG_SPELLSET}, {"EVENTZONE_OVERZONE", EVENTZONE_OVERZONE}, {"EZONETYPE_NULL", EVENTZONE_TYPE_NULL}, {"EZONETYPE_BULLETFADEOUT", EVENTZONE_TYPE_BULLETFADEOUT}, {"EZONETYPE_SENDBULLET", EVENTZONE_TYPE_SENDBULLET}, {"EZONETYPE_ENEMYDAMAGE", EVENTZONE_TYPE_ENEMYDAMAGE}, {"EZONETYPE_ENEMYBLAST", EVENTZONE_TYPE_ENEMYBLAST}, {"EZONETYPE_NOSEND", EVENTZONE_TYPE_NOSEND}, {"EZONETYPE_PLAYERSPEED", EVENTZONE_TYPE_PLAYERSPEED}, {"EZONETYPE_PLAYERDAMAGE", EVENTZONE_TYPE_PLAYERDAMAGE}, {"EZONETYPE_BULLETPERFECTFREEZE", EVENTZONE_TYPE_BULLETPERFECTFREEZE}, {"EZONETYPE_BULLETSTUPA", EVENTZONE_TYPE_BULLETSTUPA}, {"EZONETYPE_BULLETWARP", EVENTZONE_TYPE_BULLETWARP}, {"EZONECHECK_CIRCLE", EVENTZONE_CHECKTYPE_CIRCLE}, {"EZONECHECK_SQUARE", EVENTZONE_CHECKTYPE_SQUARE}, {"MODE_NORMAL", M_MODE_NORMAL}, {"MODE_STAGE", M_MODE_STAGE}, {"MODE_SPELL", M_MODE_SPELL}, {"PUSH_FIRST", M_PUSH_FIRST}, {"PUSH_ROLLTO", M_PUSH_ROLLTO}, {"PUSH_SKIP", M_PUSH_SKIP}, {"PUSHID_UIUSE_0", PUSHKEY_ID_UIUSE_0}, {"PUSHID_UIUSE_1", PUSHKEY_ID_UIUSE_1}, {"PUSHID_GAMEUSE_0", PUSHKEY_ID_GAMEUSE_0}, {"PUSHID_GAMEUSE_1", PUSHKEY_ID_GAMEUSE_1}, {"PUSHKEY_KEYNULL", PUSHKEY_KEYNULL}, {"SEL_NULL", SEL_NULL}, {"SEL_NONACTIVE", SEL_NONACTIVE}, {"SEL_GRAY", SEL_GRAY}, {"SEL_STAY", SEL_STAY}, {"SEL_NOSHIFT", SEL_NOSHIFT}, {"TotalCenterX", M_CLIENT_CENTER_X}, {"TotalCenterY", M_CLIENT_CENTER_Y}, {"TotalW", M_CLIENT_WIDTH}, {"TotalH", M_CLIENT_HEIGHT}, {"CenterX_0", M_GAMESQUARE_CENTER_X_(0)}, {"CenterX_1", M_GAMESQUARE_CENTER_X_(1)}, {"CenterY", M_GAMESQUARE_CENTER_Y}, {"CenterW", M_GAMESQUARE_WIDTH}, {"CenterH", M_GAMESQUARE_HEIGHT}, {"CenterBossX_0", M_GAMESQUARE_BOSSX_(0)}, {"CenterBossX_1", M_GAMESQUARE_BOSSX_(1)}, {"CenterBossY", M_GAMESQUARE_BOSSY}, {"EVENT_ENTERSTATE", SCR_EVENT_ENTERSTATE}, {"EVENT_LEAVESTATE", SCR_EVENT_LEAVESTATE}, {"EVENT_PLAYERDRAIN", SCR_EVENT_PLAYERDRAIN}, {"EVENT_PLAYERDRAINCHECK", SCR_EVENT_PLAYERDRAINCHECK}, {"EVENT_PLAYERSHOT", SCR_EVENT_PLAYERSHOT}, {"EVENT_PLAYERSENDEX", SCR_EVENT_PLAYERSENDEX}, {"EVENT_PLAYERSENDLILY", SCR_EVENT_PLAYERSENDLILY}, {"EVENT_PLAYERSHOOTCHARGE", SCR_EVENT_PLAYERSHOOTCHARGE}, {"EVENT_PLAYERSHOOTCHARGEONE", SCR_EVENT_PLAYERSHOOTCHARGEONE}, {"EVENT_PLAYERINSPELLSTOP", SCR_EVENT_PLAYERINSPELLSTOP}, {"EVENT_PLAYERINSTOP", SCR_EVENT_PLAYERINSTOP}, {"EVENT_PLAYERSENDITEMBULLET", SCR_EVENT_PLAYERSENDITEMBULLET}, {"EVENT_EFFSPCHASE", SCR_EVENT_EFFSPCHASE}, {"EVENT_BULLETENTERZONE", SCR_EVENT_BULLETENTERZONE}, {"EVENT_BOSSFADEOUT", SCR_EVENT_BOSSFADEOUT}, {"EVENT_ACTIVEGHOSTOVER", SCR_EVENT_ACTIVEGHOSTOVER}, {"EVENT_ONEMATCHOVER", SCR_EVENT_ONEMATCHOVER}, {"EFFSPCHASE_SENDREDBULLET", EFFSPSET_SYSTEM_SENDREDBULLET}, {"EFFSPCHASE_SENDBLUEBULLET", EFFSPSET_SYSTEM_SENDBLUEBULLET}, {"EFFSPCHASE_SENDREDBIGBULLET", EFFSPSET_SYSTEM_SENDREDBIGBULLET}, {"EFFSPCHASE_SENDBLUEBIGBULLET", EFFSPSET_SYSTEM_SENDBLUEBIGBULLET}, {"EFFSPCHASE_SENDITEMBULLET", EFFSPSET_SYSTEM_SENDITEMBULLET}, {"EFFSPCHASE_SENDGHOST", EFFSPSET_SYSTEM_SENDGHOST}, {"EFFSPCHASE_SENDEXATTACK", EFFSPSET_SYSTEM_SENDEXATTACK}, // {"MatchMode_N2N", M_MATCHMODE_N2N}, {"MatchMode_P2P", M_MATCHMODE_P2P}, {"MatchMode_P2C", M_MATCHMODE_P2C}, {"MatchMode_C2P", M_MATCHMODE_C2P}, {"MatchMode_C2C", M_MATCHMODE_C2C}, {"Latency_Min", M_LATENCY_MIN}, {"Latency_Max", M_LATENCY_MAX}, {"KSI_UP", KSI_UP}, {"KSI_DOWN", KSI_DOWN}, {"KSI_LEFT", KSI_LEFT}, {"KSI_RIGHT", KSI_RIGHT}, {"KSI_FIRE", KSI_FIRE}, {"KSI_QUICK", KSI_QUICK}, {"KSI_SLOW", KSI_SLOW}, {"KSI_DRAIN", KSI_DRAIN}, {"KSI_PAUSE", KSI_PAUSE}, {"KSI_SKIP", KSI_SKIP}, {"KSI_ENTER", KSI_ENTER}, {"KSI_ESCAPE", KSI_ESCAPE}, {"KSI_CAPTURE", KSI_CAPTURE}, {SCR_KEYSTATE_STR, SCR_KEYSTATE}, {"KS_UP", (DWORD)&(GameInput::KS_UP)}, {"KS_DOWN", (DWORD)&(GameInput::KS_DOWN)}, {"KS_LEFT", (DWORD)&(GameInput::KS_LEFT)}, {"KS_RIGHT", (DWORD)&(GameInput::KS_RIGHT)}, {"KS_FIRE", (DWORD)&(GameInput::KS_FIRE)}, {"KS_QUICK", (DWORD)&(GameInput::KS_QUICK)}, {"KS_SLOW", (DWORD)&(GameInput::KS_SLOW)}, {"KS_DRAIN", (DWORD)&(GameInput::KS_DRAIN)}, {"KS_PAUSE", (DWORD)&(GameInput::KS_PAUSE)}, {"KS_SKIP", (DWORD)&(GameInput::KS_SKIP)}, {"KS_ENTER", (DWORD)&(GameInput::KS_ENTER)}, {"KS_ESCAPE", (DWORD)&(GameInput::KS_ESCAPE)}, {"KS_CAPTURE", (DWORD)&(GameInput::KS_CAPTURE)}, {"KS_UP_0", (DWORD)&(GameInput::KS_UP_(0))}, {"KS_DOWN_0", (DWORD)&(GameInput::KS_DOWN_(0))}, {"KS_LEFT_0", (DWORD)&(GameInput::KS_LEFT_(0))}, {"KS_RIGHT_0", (DWORD)&(GameInput::KS_RIGHT_(0))}, {"KS_FIRE_0", (DWORD)&(GameInput::KS_FIRE_(0))}, {"KS_QUICK_0", (DWORD)&(GameInput::KS_QUICK_(0))}, {"KS_SLOW_0", (DWORD)&(GameInput::KS_SLOW_(0))}, {"KS_DRAIN_0", (DWORD)&(GameInput::KS_DRAIN_(0))}, {"KS_PAUSE_0", (DWORD)&(GameInput::KS_PAUSE_(0))}, {"KS_SKIP_0", (DWORD)&(GameInput::KS_SKIP_(0))}, {"KS_ENTER_0", (DWORD)&(GameInput::KS_ENTER_(0))}, {"KS_ESCAPE_0", (DWORD)&(GameInput::KS_ESCAPE_(0))}, {"KS_CAPTURE_0", (DWORD)&(GameInput::KS_CAPTURE_(0))}, {"KS_UP_1", (DWORD)&(GameInput::KS_UP_(1))}, {"KS_DOWN_1", (DWORD)&(GameInput::KS_DOWN_(1))}, {"KS_LEFT_1", (DWORD)&(GameInput::KS_LEFT_(1))}, {"KS_RIGHT_1", (DWORD)&(GameInput::KS_RIGHT_(1))}, {"KS_FIRE_1", (DWORD)&(GameInput::KS_FIRE_(1))}, {"KS_QUICK_1", (DWORD)&(GameInput::KS_QUICK_(1))}, {"KS_SLOW_1", (DWORD)&(GameInput::KS_SLOW_(1))}, {"KS_DRAIN_1", (DWORD)&(GameInput::KS_DRAIN_(1))}, {"KS_PAUSE_1", (DWORD)&(GameInput::KS_PAUSE_(1))}, {"KS_SKIP_1", (DWORD)&(GameInput::KS_SKIP_(1))}, {"KS_ENTER_1", (DWORD)&(GameInput::KS_ENTER_(1))}, {"KS_ESCAPE_1", (DWORD)&(GameInput::KS_ESCAPE_(1))}, {"KS_CAPTURE_1", (DWORD)&(GameInput::KS_CAPTURE_(1))}, {SCR_NULL_STR, SCR_NULL}, };
[ "CBE7F1F65@b503aa94-de59-8b24-8582-4b2cb17628fa" ]
[ [ [ 1, 781 ] ] ]
7414ac04c4130d6f534a4c52aba1489ce9d2d5b0
a705a17ff1b502ec269b9f5e3dc3f873bd2d3b9c
/include/include.hpp
27466ef7cdda75e251ce2e4d8dbc0271fa649826
[]
no_license
cantidio/ChicolinusQuest
82431a36516d17271685716590fe7aaba18226a0
9b77adabed9325bba23c4d99a3815e7f47456a4d
refs/heads/master
2021-01-25T07:27:54.263356
2011-08-09T11:17:53
2011-08-09T11:17:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
209
hpp
#ifndef _INCLUDES_ #define _INCLUDES_ #include <stdlib.h> #include <stdio.h> #include <allegro5/allegro.h> #include <allegro5/allegro_image.h> #include <audiere.h> #include <vector> #include <string> #endif
[ [ [ 1, 11 ] ] ]
6ead193f84f415258acdbcbe068bb6aa4fa13968
b8fbe9079ce8996e739b476d226e73d4ec8e255c
/src/engine/rb_extui/jangleeditor.cpp
4fe0116863cbc78c61b350cb06595458cea41a29
[]
no_license
dtbinh/rush
4294f84de1b6e6cc286aaa1dd48cf12b12a467d0
ad75072777438c564ccaa29af43e2a9fd2c51266
refs/heads/master
2021-01-15T17:14:48.417847
2011-06-16T17:41:20
2011-06-16T17:41:20
41,476,633
1
0
null
2015-08-27T09:03:44
2015-08-27T09:03:44
null
UTF-8
C++
false
false
1,929
cpp
/***********************************************************************************/ // File: JAngleEditor.cpp // Date: 23.09.2005 // Author: Ruslan Shestopalyuk /***********************************************************************************/ #include "stdafx.h" #include "JAngleEditor.h" /***********************************************************************************/ /* JAngleEditor implementation /***********************************************************************************/ decl_class(JAngleEditor); JAngleEditor::JAngleEditor() { SetXAlign( XAlign_Parent ); SetYAlign( YAlign_Parent ); SetBgColor( 0xFFEEEE00 ); SetFgColor( 0xFFEEEE00 ); m_Angle = 0.0f; m_Pivot = Vec2::null; m_OuterRadius = 30; m_InnerRadius = 5; m_DragSector = 0.5f; } void JAngleEditor::Render() { const int c_ArrowSpriteID = 3; static int spID = g_pDrawServer->GetSpriteID( "sys_gizmos" ); g_pDrawServer->DrawSprite( m_Pivot.x, m_Pivot.y, spID, c_ArrowSpriteID, GetFgColor(), DegToRad( m_Angle ) + c_PI*0.5f ); } // JAngleEditor::Render void JAngleEditor::OnDrag( JDragEvent& e ) { if (e.GetType() == deDragStart && e.Key() == mkLeft) { Vec2 dir = e.GetStartPos() - m_Pivot; float len = dir.norm(); float ang = wrap( atan2f( dir.y, dir.x ), c_Epsilon, c_PI*2.0f ); if (len >= m_InnerRadius && len <= m_OuterRadius && fabs( ang - DegToRad( m_Angle ) ) < m_DragSector) { e.SetSource( this ); e.Consume(); } } // perform rotation if (e.GetType() == deDrag && e.GetSource() == this) { Vec2 dir = e.GetCurPos() - m_Pivot; dir.normalize(); m_Angle = wrap( RadToDeg( atan2f( dir.y, dir.x ) ), 0.0f, 360.0f ); SendSignal( "angle" ); } } // JAngleEditor::OnDrag
[ [ [ 1, 60 ] ] ]
9ae20bf87c7b93022afe4af74965c5aeb4e27168
d9d008a8defae1fda50c9f67afcc6c2f117d4957
/src/Tree/Console.hpp
4b4c7d28223eac5bc8f2ea99909e843f3ac7af20
[]
no_license
treeman/My-Minions
efb902b34214ab8103fc573293693e7c8cc7930f
80f85c15c422fcfae67fa2815a5c4da796ef4450
refs/heads/master
2021-01-23T22:15:33.635844
2011-05-02T07:42:50
2011-05-02T07:42:50
1,689,566
0
1
null
null
null
null
UTF-8
C++
false
false
4,018
hpp
#ifndef CONSOLE_HPP_INCLUDED #define CONSOLE_HPP_INCLUDED #include <boost/shared_ptr.hpp> #include <string> #include <vector> #include <boost/bind.hpp> #include <boost/function.hpp> #include <boost/ref.hpp> #include "Tree/Graphics.hpp" #include "Tree/InputHandler.hpp" #include "Tree/Timer.hpp" #include "Tree/Dator.hpp" #include "Tree/Settings.hpp" namespace Tree { class Console : public InputHandler, public SettingsListener { public: Console(); ~Console(); bool HandleEvent( sf::Event &e ); void HearSetting( std::string setting, std::string value, std::string return_val ); void AddHistory( std::string str ); std::string Clear(); std::string ShowCommands(); std::string ShowCommandsValues(); void Update( float dt ); void Draw(); std::vector<std::string> GetHistory() const; private: void Activate(); void Deactivate(); typedef std::vector<std::string> StrList; typedef std::map<std::string, std::string> StrMap; float GetStringWidth( std::string str ); sf::String render_str; float x, y; float w, h; sf::Shape back; bool IsHistoryLocked(); void MoveBackInHistory(); void MoveForwardInHistory(); void ResetHistoryPos(); void PushCmd( std::string str ); StrList cmd_history; int cmd_pos; void PushHistory( std::string str ); StrList big_history; bool IsSuggestionLocked(); void MoveUpInSuggestion(); void MoveDownInSuggestion(); void AutoCompleteSuggestion(); void UpdateSuggestionList(); void ResetSuggestionPos(); StrMap suggestion_map; int sugg_pos; float suggestion_box_width; void InputLineSet( std::string str, bool update_suggestion = true ); void InputLineOnInput(); void InputLineSetBuff(); void InputLineRestoreBuff(); void InputLineInsert( std::string str, int pos ); void InputLineDeleteChar( int pos ); void InputLineAddChar( char ch, int pos ); void InputLineExecute(); void InputLineClear(); void InputLineMoveLeft(); void InputLineMoveRight(); std::string input_line_buff; std::string input_line; int input_line_pos; bool SelectionIsActive(); void SelectionAll(); void SelectionMoveLeft(); void SelectionMoveRight(); void SelectionClear(); void SelectionDelete(); void SelectionCopy(); void SelectionPaste( int pos ); int sel_start, sel_length; std::string selection_copy; void RenderBones(); void RenderHistory(); void RenderInputLine(); void RenderTypeSuggestions(); float text_off_left; float text_off_down; float text_off_top; float line_height; Timer blink_timer; float blinkie_time; bool is_active; int opacity; int fnt_opacity; int blinkie_opacity; int selection_opacity; int delimiter_opacity; int some_stuff; sf::Color fnt_color; sf::Color fnt_history_color; sf::Color fnt_history_line_sign_color; sf::Color fnt_highlight_color; sf::Color fnt_suggestion_color; sf::Color blinkie_color; sf::Color large_back_color; sf::Color suggestion_back_color; sf::Color selection_color; sf::Color delimiter_color; void RenderDebug(); boost::shared_ptr<Dator<bool> > showDebug; boost::shared_ptr<CallDator> clearHistory; boost::shared_ptr<CallDator> showCommands; boost::shared_ptr<CallDator> showCommandsValues; }; } #endif
[ [ [ 1, 162 ] ] ]
a2f5026289e7706b734611458e20bef8d2459694
80716d408715377e88de1fc736c9204b87a12376
/TspLib3/Src/Misc.cpp
85ef786323ba5a4f97489d2d818713b7709b96a3
[]
no_license
junction/jn-tapi
b5cf4b1bb010d696473cabcc3d5950b756ef37e9
a2ef6c91c9ffa60739ecee75d6d58928f4a5ffd4
refs/heads/master
2021-03-12T23:38:01.037779
2011-03-10T01:08:40
2011-03-10T01:08:40
199,317
2
2
null
null
null
null
UTF-8
C++
false
false
12,394
cpp
/******************************************************************************/ // // MISC.CPP - Source file for the misc. class functions // // Copyright (C) 1994-2004 JulMar Entertainment Technology, Inc. // All rights reserved // // This file implements all the request object constructors and // the various support classes required in the library which are // considered internal to the spLIB++ product. // // This source code is intended only as a supplement to the // TSP++ Class Library product documentation. This source code cannot // be used in part or whole in any form outside the TSP++ library. // /******************************************************************************/ /*---------------------------------------------------------------------------*/ // INCLUDE FILES /*---------------------------------------------------------------------------*/ #include "stdafx.h" ///////////////////////////////////////////////////////////////////////////////////////////////////////// // CTSPIBaseObject::CTSPIBaseObject // // Destructor for the base TSP object // CTSPIBaseObject::~CTSPIBaseObject() { }// CTSPIBaseObject::~CTSPIBaseObject ///////////////////////////////////////////////////////////////////////////////////////////////////////// // CTSPIBaseObject::DestroyObject // // This is called to destroy the object when all reference counts are zero. // void CTSPIBaseObject::DestroyObject() { _TSP_ASSERTE(*((LPDWORD)this) != 0x00000000); // Unintialized ptr _TSP_ASSERTE(*((LPDWORD)this) != 0xdddddddd); // Already free'd ptr _TSP_ASSERTE(m_lRefCount < 0); delete this; }// CTSPIBaseObject::DestroyObject #ifdef _DEBUG ///////////////////////////////////////////////////////////////////////////////////////////////////////// // CTSPIBaseObject::Dump // // Debug Dump function // TString CTSPIBaseObject::Dump() const { return _T(""); }// CTSPIBaseObject::Dump #endif ///////////////////////////////////////////////////////////////////////////////////////////////////////// // DEVICECLASSINFO::DEVICECLASSINFO // // Constructor for the device class information structure // DEVICECLASSINFO::DEVICECLASSINFO (LPCTSTR pszName, DWORD dwFormat, LPVOID lpData, DWORD dwDataSize, HANDLE htHandle) : strName(pszName), dwStringFormat(dwFormat), hHandle(htHandle), lpvData(NULL), dwSize(0) { if (dwDataSize > 0) { USES_CONVERSION; // If the format is to be stored in ASCII then do any necessary conversion // from Unicode or store directly from the given string. if (dwFormat == STRINGFORMAT_ASCII) { LPSTR lpsData = T2A(static_cast<LPTSTR>(lpData)); dwSize = lstrlenA(lpsData)+1; lpvData.reset(new BYTE[dwSize]); lstrcpyA(reinterpret_cast<LPSTR>(lpvData.get()), lpsData); } // Or.. if the format is in Unicode, then do any necessary conversion from // ASCII into the stored format. else if (dwFormat == STRINGFORMAT_UNICODE) { LPWSTR lpsData = T2W(static_cast<LPTSTR>(lpData)); dwSize = (lstrlenW(lpsData)+1) * sizeof(wchar_t); lpvData.reset(new BYTE[dwSize]); lstrcpyW(reinterpret_cast<LPWSTR>(lpvData.get()), lpsData); } // Otherwise in binary form -- assume passed length is in bytes. else { dwSize = dwDataSize; lpvData.reset(new BYTE[dwSize]); MoveMemory(lpvData.get(), lpData, dwSize); } } }// DEVICECLASSINFO::DEVICECLASSINFO ///////////////////////////////////////////////////////////////////////////////////////////////////////// // DEVICECLASSINFO::~DEVICECLASSINFO // // Destructor for the device class information structure // DEVICECLASSINFO::~DEVICECLASSINFO() { }// DEVICECLASSINFO::~DEVICECLASSINFO ///////////////////////////////////////////////////////////////////////////////////////////////////////// // LOCATIONINFO::Reload // // Loads location information from TAPIs location database. // bool LOCATIONINFO::Reload() { USES_CONVERSION; // Reset our current strings Reset(); // Load the TAPI32 dll and find the entrypoints we need. This will throw an // exception on failure. LLHelper TapiDLL; // Get the translation caps currently setup from our dialing location. std::auto_ptr<LINETRANSLATECAPS> lpCaps(TapiDLL.tapiGetTranslateCaps()); if (lpCaps.get() == NULL) return false; // If the current location is zero, then reset to what TAPI says. if (dwCurrentLocation == 0) dwCurrentLocation = lpCaps->dwCurrentLocationID; // Walk through all the entry structures looking for our current location id. LINELOCATIONENTRY* lpEntry = reinterpret_cast<LPLINELOCATIONENTRY>(reinterpret_cast<LPBYTE>(lpCaps.get()) + lpCaps->dwLocationListOffset); for (unsigned int i = 0; i < lpCaps->dwNumLocations; i++) { // If this isn't the area we are looking for, ignore it. if (lpEntry->dwPermanentLocationID != dwCurrentLocation) { ++lpEntry; continue; } // Copy the country code char chBuff[10]; _ltoa_s(lpEntry->dwCountryCode, chBuff, 10, 10); strCountryCode = A2T(chBuff); // Copy the area code if (lpEntry->dwCityCodeSize > 0) strAreaCode = A2T(reinterpret_cast<LPSTR>(reinterpret_cast<LPBYTE>(lpCaps.get()) + lpEntry->dwCityCodeOffset)); // Copy the long-distance access code if (lpEntry->dwLongDistanceAccessCodeSize > 0) strLongDistanceAccess = GetSP()->GetDialableNumber(A2T(reinterpret_cast<LPSTR>(reinterpret_cast<LPBYTE>(lpCaps.get()) + lpEntry->dwLongDistanceAccessCodeOffset))); // Copy the local access code if (lpEntry->dwLocalAccessCodeSize > 0) strLocalAccess = GetSP()->GetDialableNumber(A2T(reinterpret_cast<LPSTR>(reinterpret_cast<LPBYTE>(lpCaps.get()) + lpEntry->dwLocalAccessCodeOffset))); // Copy the call-waiting sequence. if (lpEntry->dwCancelCallWaitingSize > 0) strCallWaiting = GetSP()->GetDialableNumber(A2T(reinterpret_cast<LPSTR>(reinterpret_cast<LPBYTE>(lpCaps.get()) + lpEntry->dwCancelCallWaitingOffset)), _T("#*")); // Now using the country id, retrieve the international dialing rules // for this country. This includes the prefix which must be dialed // in order to make an international call. DWORD dwCountryID = lpEntry->dwCountryID; std::auto_ptr<LINECOUNTRYLIST> lpList(TapiDLL.tapiGetCountry(dwCountryID)); if (lpList.get() == NULL) { Reset(); return false; } LPLINECOUNTRYENTRY lpEntry = reinterpret_cast<LPLINECOUNTRYENTRY>(reinterpret_cast<LPBYTE>(lpList.get()) + lpList->dwCountryListOffset); for (i = 0; i < lpList->dwNumCountries; i++) { // Ignore all countries which are not the default. if (lpEntry->dwCountryID != dwCountryID) { ++lpEntry; continue; } if (lpEntry->dwInternationalRuleSize > 0) { strIntlCode = A2T(reinterpret_cast<LPSTR>(reinterpret_cast<LPBYTE>(lpList.get()) + lpEntry->dwInternationalRuleOffset)); TString::iterator it = std::find_if(strIntlCode.begin(), strIntlCode.end(), std::not1(std::ptr_fun(&tsplib::is_tdigit))); if (it != strIntlCode.end()) strIntlCode.resize(it-strIntlCode.begin()); } if (lpEntry->dwLongDistanceRuleSize > 0) { strNationalCode = A2T(reinterpret_cast<LPSTR>(reinterpret_cast<LPBYTE>(lpList.get()) + lpEntry->dwLongDistanceRuleOffset)); TString::iterator it = std::find_if(strNationalCode.begin(), strNationalCode.end(), std::not1(std::ptr_fun(&tsplib::is_tdigit))); if (it != strNationalCode.end()) strNationalCode.resize(it-strNationalCode.begin()); } break; } break; } _TSP_DTRACE(TRC_DUMP, _T("LOCATIONINFO structure loaded:\n")); _TSP_DTRACE(TRC_DUMP, _T(" CurrentLocation = %ld\n") _T(" CountryCode = (%s)\n") _T(" AreaCode = (%s)\n") _T(" NationalCode = (%s)\n") _T(" InternationalCode = (%s)\n") _T(" LongDistance Access Code = (%s)\n") _T(" Local Access Code = (%s)\n") _T(" Disable Call Waiting = (%s)\n"), dwCurrentLocation, strCountryCode.c_str(), strAreaCode.c_str(), strNationalCode.c_str(), strIntlCode.c_str(), strLongDistanceAccess.c_str(), strLocalAccess.c_str(), strCallWaiting.c_str()); // Mark that we have loaded the information. m_fLoaded = true; return true; }// LOCATIONINFO::Reload namespace TDynamicCreate { // Global variables within this namespace tsplib_TFactoryListMgr* tsplib_TFactoryListMgr::m_pHead = NULL; ////////////////////////////////////////////////////////////////////////////////////////////////////////// // CreateObject // // Create a new object dynamically. Search the list of dynamic // objects and call each CreateObject() method until one of them // is successful in making the required object. If we get to the end of the // list, then the object wasn't registered. // void* CreateObject (const char* pszClassName) { void* pObject = NULL; const tsplib_TFactoryListMgr* pCurrFactory = tsplib_TFactoryListMgr::m_pHead; for (; pCurrFactory != NULL; pCurrFactory = pCurrFactory->m_pNext) { pObject = pCurrFactory->m_pManufacturer->CreateObject(pszClassName); if (pObject != NULL) break; } return pObject; }// CreateObject ////////////////////////////////////////////////////////////////////////////////////////////////////////// // _TFactoryListMgr::~_TFactoryListMgr // // When the factory<t> is destroyed, its "manufacturer" // field is also destroyed, so this destructor is called. // Remove the current factory from the factory_list. // tsplib_TFactoryListMgr::~tsplib_TFactoryListMgr() { tsplib_TFactoryListMgr** ppNext = &tsplib_TFactoryListMgr::m_pHead; for (; *ppNext != NULL; ppNext = &(*ppNext)->m_pNext) { if (*ppNext == this) { *ppNext = (*ppNext)->m_pNext; break; } } }// _TFactoryListMgr::~_TFactoryListMgr } /******************************************************************************/ // // CEnterCode // /******************************************************************************/ #undef CEnterCode // Don't put any classes after these definitions!! ///////////////////////////////////////////////////////////////////////////////////////////////////////// // CEnterCode::CEnterCode // // Synchronization class // CEnterCode::CEnterCode (const CTSPIBaseObject* pObj, bool fAutoLock) : m_lLockCount(0), m_pObject(pObj) { // If we were passed a valid object to lock... if (m_pObject != NULL) { // Increment the reference count for the object so it cannot be destroyed // until this object is destroyed. m_pObject->AddRef(); // If we are to "auto-lock" the object ... if (fAutoLock) { if (!Lock(INFINITE)) { _TSP_DTRACE(_T("WARNING: Infinite Lock failed Thread 0x%lx, Object 0x%lx\n"), GetCurrentThreadId(), m_pObject); } } } }// CEnterCode::CEnterCode ///////////////////////////////////////////////////////////////////////////////////////////////////////// // CEnterCode::~CEnterCode // // Synchronization class // CEnterCode::~CEnterCode() { if (m_pObject != NULL) { // Unlock the critsec for each time we locked it. while (m_lLockCount > 0) Unlock(); // Decrement the object's usage count so it may self-destruct now that // we are done using it (if it's refcount hits zero). m_pObject->DecRef(); } }// CEnterCode::~CEnterCode ///////////////////////////////////////////////////////////////////////////////////////////////////////// // CEnterCode::Lock // // Enter and lock the object for update // bool CEnterCode::Lock (DWORD dwMsecs) { if (m_pObject != NULL) { bool fLock = m_pObject->GetSyncObject()->Lock(dwMsecs); if (fLock) ++m_lLockCount; return fLock; } return false; }// CEnterCode::Lock ///////////////////////////////////////////////////////////////////////////////////////////////////////// // CEnterCode::Unlock // // Exit and unlock the object // void CEnterCode::Unlock() { if (m_pObject && m_lLockCount > 0) { --m_lLockCount; m_pObject->GetSyncObject()->Unlock(); } }// CEnterCode::Unlock
[ "Owner@.(none)" ]
[ [ [ 1, 365 ] ] ]
9c91737a59b4ff8856081fb8d5b11095dd9095b5
2dbbca065b62a24f47aeb7ec5cd7a4fd82083dd4
/OUAN/OUAN/Src/Graphics/CameraManager/CameraInput.cpp
dfa53ffc0d07655b182567bff3d6fe1b3633c14d
[]
no_license
juanjmostazo/once-upon-a-night
9651dc4dcebef80f0475e2e61865193ad61edaaa
f8d5d3a62952c45093a94c8b073cbb70f8146a53
refs/heads/master
2020-05-28T05:45:17.386664
2010-10-06T12:49:50
2010-10-06T12:49:50
38,101,059
1
1
null
null
null
null
UTF-8
C++
false
false
231
cpp
#include "OUAN_Precompiled.h" #include "CameraInput.h" #include "CameraParameters.h" using namespace OUAN; CameraInput::CameraInput() { mCameraParameters.reset(new CameraParameters); } CameraInput::~CameraInput() { }
[ "wyern1@1610d384-d83c-11de-a027-019ae363d039" ]
[ [ [ 1, 13 ] ] ]
2e23c81b703c1718d11459a2b774a2981c43f634
0b66a94448cb545504692eafa3a32f435cdf92fa
/tags/0.5/cbear.berlios.de/locale/cast.hpp
db742c8d748074b75b75ee5d9db539d9ba1d22ac
[ "MIT" ]
permissive
BackupTheBerlios/cbear-svn
e6629dfa5175776fbc41510e2f46ff4ff4280f08
0109296039b505d71dc215a0b256f73b1a60b3af
refs/heads/master
2021-03-12T22:51:43.491728
2007-09-28T01:13:48
2007-09-28T01:13:48
40,608,034
0
0
null
null
null
null
UTF-8
C++
false
false
3,009
hpp
/* The MIT License Copyright (c) 2005 C Bear (http://cbear.berlios.de) 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 CBEAR_BERLIOS_DE_LOCALE_CAST_HPP_INCLUDED #define CBEAR_BERLIOS_DE_LOCALE_CAST_HPP_INCLUDED #include <locale> #include <cbear.berlios.de/range/value_type.hpp> #include <cbear.berlios.de/range/transform.hpp> namespace cbear_berlios_de { namespace locale { namespace detail { /// Casting. template<class To, class From> struct cast { /// Main function. static To run(const From &Source) { typedef typename range::value_type<From>::type from_char_type; typedef typename range::value_type<To>::type to_char_type; To Result; Result.resize(range::size(Source)); range::transform( Source, Result.begin(), cast<to_char_type, from_char_type>::run); return Result; } }; /// Returns std::ctype<Char>. template<class Char> const std::ctype<Char> &get_ctype() { return std::use_facet<std::ctype<Char> >(std::locale()); } /// Converts from wchar_t to char. template<> struct cast<char, wchar_t> { /// Main function. static char run(wchar_t C) { return get_ctype<wchar_t>().narrow(C, '@'); } }; /// Converts from char to wchar_t. template<> struct cast<wchar_t, char> { /// Main function. static wchar_t run(char C) { return get_ctype<char>().widen(C); } }; /* /// Converts to std::basic_string<Char>. template<class Char, class From> struct cast<std::basic_string<Char>, From> { typedef std::basic_string<Char> result_type; ///< A result type. /// Main function. static result_type run(const From &Source) { typedef typename range::value_type<From>::type source_char_type; result_type Result; range::transform( Source, std::back_inserter(Result), cast<Char, source_char_type>::run); return Result; } }; */ } /// Casting. template<class To, class From> To cast(const From &X) { return detail::cast<To, From>::run(X); } } } #endif
[ "sergey_shandar@e6e9985e-9100-0410-869a-e199dc1b6838" ]
[ [ [ 1, 110 ] ] ]
7ba8636e406e415762798aff26469b8a138dffe4
2112057af069a78e75adfd244a3f5b224fbab321
/branches/refactor/src_root/include/ireon_rs/db/root_db.h
66f5a1668b6a844c9e8ae82bf44755a914f2a4e4
[]
no_license
blockspacer/ireon
120bde79e39fb107c961697985a1fe4cb309bd81
a89fa30b369a0b21661c992da2c4ec1087aac312
refs/heads/master
2023-04-15T00:22:02.905112
2010-01-07T20:31:07
2010-01-07T20:31:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,881
h
/* Copyright (C) 2005 ireon.org developers council * $Id: root_db.h 285 2005-11-26 09:24:22Z zak $ * 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., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ /** * @file root_db.h * Player's database */ #ifndef _ROOT_DB #define _ROOT_DB struct ClientOwnCharData; ///Character's data, stored on root server struct RootCharPlayerData { void serialize(CData& d); ///Cluster where char lives uint m_cluster; ///Id of player's account uint m_account; ///Character's name String m_name; }; class CRootDB { friend class CRootApp; CRootDB() {} static bool init(); bool load(); bool save(); public: static CRootDB* CRootDB::instance() {return m_singleton;} public: /// Work with players /// Get cluster where we send new character uint getBirthCluster(ClientOwnCharData* ch); /// Get cluster wrere this character lives uint getCluster(uint); /// Find player by name RootCharPlayerData* findPlayer(String name); /// Find player by name RootCharPlayerData* findPlayer(uint id) {return (m_players.find(id) == m_players.end()) ? 0 : &m_players[id];} /// Find char player data, that is currently creating RootCharPlayerData* findCreating(uint id) {return (m_creating.find(id) != m_creating.end()) ? &m_creating[id] : 0; } byte addCharacter(RootCharPlayerData* ch, uint id); byte addCreatingCharacter(ClientOwnCharData* ch, uint acc); void deleteCharPlayer(uint id); void deleteCreating(uint id); void selectCharactersByAccount(uint id, std::map<uint, RootCharPlayerData> &chars); public: ///Create, initialize and add to DB new account AccPtr createAccount(const String& name); ///Deletes existing account bool deleteAccount(CAccount* acc); bool deleteAccount(uint m_id); bool deleteAccount(String name); ///Find account AccPtr findAccount(uint m_id); AccPtr findAccount(String name); public: std::vector<AccPtr> m_accounts; protected: /// Map player's characters to clusters std::map<uint,RootCharPlayerData> m_players; /// Characters that creating now std::map<uint,RootCharPlayerData> m_creating; static CRootDB* m_singleton; }; #endif
[ [ [ 1, 113 ] ] ]
10a2ad69f0ad4874db497768a3fcd8b29e72fcf4
2f43a19a5c96acfe8d6aed786dd57e092ac1f35f
/Classes/Side Libraries/libTexture/JpegLoader.cpp
edf9e3358209d24c0a7bc47df72285a063bb78e3
[]
no_license
NERDSstack/Trap
c89b123d765e696f36c9029816177fa746784fdf
78db7626ada289f4a4a6a7a3532e209608025c7f
refs/heads/master
2020-08-28T04:57:22.655861
2010-12-20T17:33:37
2010-12-20T17:33:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,828
cpp
// // Class to load images from jpeg files // // Author: Alex V. Boreskoff // #pragma comment (lib, "jpeg.lib") #include <stdio.h> #include <setjmp.h> #include "JpegLoader.h" #include "Texture.h" #include "Data.h" extern "C" { #include "jpeg/jpeglib.h" #include "jpeg/jerror.h" } struct my_error_mgr { jpeg_error_mgr pub; // "public" fields jmp_buf setjmp_buffer; // for return to caller }; // callbacks required by jpeglib // // Initialize source --- called by jpeg_read_header before any data is actually read. // static void initSource ( j_decompress_ptr ) { } // // Fill the input buffer --- called whenever buffer is emptied. should never happen // static boolean fillInputBuffer ( j_decompress_ptr ) { return TRUE; } // // Skip data --- used to skip over a potentially large amount of // uninteresting data (such as an APPn marker). // static void skipInputData ( j_decompress_ptr cinfo, long count ) { jpeg_source_mgr * src = cinfo -> src; if ( count > 0 ) { src -> bytes_in_buffer -= count; src -> next_input_byte += count; } } // // Terminate source --- called by jpeg_finish_decompress // after all data has been read. Often a no-op. // // NB: *not* called by jpeg_abort or jpeg_destroy; surrounding // application must deal with any cleanup that should happen even // for error exit. // static void termSource ( j_decompress_ptr ) { } static void myErrorExit (j_common_ptr cinfo) { // cinfo->err really points to a my_error_mgr struct, so coerce pointer my_error_mgr * myerr = (my_error_mgr *) cinfo->err; // Return control to the setjmp point longjmp ( myerr -> setjmp_buffer, 1 ); } inline dword rgbToInt ( dword red, dword green, dword blue ) { return (red << 16) | (green << 8) | (blue); } Texture * JpegLoader :: load ( Data * data ) { jpeg_decompress_struct cinfo; my_error_mgr jerr; // allocate and initialize JPEG decompression object // we set up the normal JPEG error routines, then override error_exit cinfo.err = jpeg_std_error ( &jerr.pub ); jerr.pub.error_exit = myErrorExit; if ( setjmp ( jerr.setjmp_buffer ) ) { jpeg_destroy_decompress ( &cinfo ); return NULL; } // now we can initialize the JPEG decompression object jpeg_create_decompress ( &cinfo ); // specify data source (memory buffer, in this case) jpeg_source_mgr jsrc; // set up data pointer jsrc.bytes_in_buffer = data -> getLength (); jsrc.next_input_byte = (JOCTET *) data -> getPtr (); jsrc.init_source = initSource; jsrc.fill_input_buffer = fillInputBuffer; jsrc.skip_input_data = skipInputData; jsrc.resync_to_restart = jpeg_resync_to_restart; // use default jsrc.term_source = termSource; cinfo.src = &jsrc; // read file parameters with jpeg_read_header() jpeg_read_header ( &cinfo, TRUE ); // We almost always want RGB output (no grayscale, yuv etc) if ( cinfo.jpeg_color_space != JCS_GRAYSCALE ) cinfo.out_color_space = JCS_RGB; // Recalculate output image dimensions jpeg_calc_output_dimensions ( &cinfo ); // Start decompressor jpeg_start_decompress ( &cinfo ); int width = cinfo.output_width; int height = cinfo.output_height; int rowSpan = cinfo.image_width * cinfo.num_components; // bool isGreyScale = cinfo.jpeg_color_space == JCS_GRAYSCALE; dword palette [256]; // Get palette if ( cinfo.quantize_colors ) { int shift = 8 - cinfo.data_precision; if ( cinfo.jpeg_color_space != JCS_GRAYSCALE ) { for ( int i = 0; i < cinfo.actual_number_of_colors; i++ ) palette [i] = rgbToInt ( cinfo.colormap [0][i] << shift, cinfo.colormap [1] [i] << shift, cinfo.colormap [2][i] << shift ); } else { for ( int i = 0; i < cinfo.actual_number_of_colors; i++ ) palette [i] = rgbToInt ( cinfo.colormap [0][i] << shift, cinfo.colormap [0] [i] << shift, cinfo.colormap [0][i] << shift ); } } Texture * texture = new Texture ( width, height, 3 ); dword * lineBuf = new dword [width]; // Make a one-row-high sample array that will go away when done with image JSAMPARRAY buffer = (*cinfo.mem->alloc_sarray) ((j_common_ptr) &cinfo, JPOOL_IMAGE, rowSpan, 1); // while (scan lines remain to be read) // jpeg_read_scanlines(...); // Here we use the library's state variable cinfo.output_scanline as the // loop counter, so that we don't have to keep track ourselves. int y = 0; while ( cinfo.output_scanline < cinfo.output_height ) { // jpeg_read_scanlines expects an array of pointers to scanlines. // Here the array is only one element long, but you could ask for // more than one scanline at a time if that's more convenient. jpeg_read_scanlines ( &cinfo, buffer, 1 ); if ( cinfo.output_components == 1 ) // paletted or grayscale image { if ( cinfo.quantize_colors ) // paletted image { for ( int i = 0; i < width; i++ ) lineBuf [i] = palette [buffer [0][i]]; } else // grayscale image { for ( int i = 0; i < width; i++ ) lineBuf [i] = rgbToInt ( buffer [0][i], buffer [0][i], buffer [0][i] ); } } else // rgb image { unsigned char * ptr = buffer [0]; for ( int i = 0; i < width; i++, ptr += 3 ) lineBuf [i] = rgbToInt ( ptr [2], ptr [1], ptr [0] ); } texture -> putLine ( height - 1 - y, lineBuf ); y++; } delete lineBuf; // Finish decompression jpeg_finish_decompress ( &cinfo ); // Release JPEG decompression object jpeg_destroy_decompress ( &cinfo ); return texture; }
[ [ [ 1, 222 ] ] ]
14d58c9090ed1ebc5b1712d73a06d78d59d7d071
6bdb3508ed5a220c0d11193df174d8c215eb1fce
/Codes/Halak/IClassQueryable.h
423be85d7ce600801e644435f59c9f5c283a335a
[]
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
434
h
#pragma once #ifndef __HALAK_ICLASSQUERYABLE_H__ #define __HALAK_ICLASSQUERYABLE_H__ # include <Halak/Foundation.h> namespace Halak { class IClassQueryable { public: virtual ~IClassQueryable() { } virtual void* QueryClass(uint32 classID) = 0; virtual const void* QueryClass(uint32 classID) const; }; } #endif
[ [ [ 1, 19 ] ] ]
a8016972b45937d17db0636b6f6e9da1a9c32fd8
3f6437b0deb731e795642e71ea219b911e6af3cc
/OpenGLView.h
e816ac9bb9d4e75e5004b28a90d121c583b60896
[]
no_license
tzafrir/graphics1
b910f554108235f595b7d3db1407c284afc5a66f
0bde27d56ad4b36c5b5b355d919e18e0367a4e0d
refs/heads/master
2016-09-10T21:37:58.249424
2011-01-03T19:35:18
2011-01-03T19:35:18
1,098,744
0
0
null
null
null
null
UTF-8
C++
false
false
11,351
h
// OpenGLView.h : interface of the COpenGLView class // ///////////////////////////////////////////////////////////////////////////// #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "gl\gl.h" // Include the standard OpenGL headers #include "gl\glu.h" // Add the utility library #include "Light.h" #include "afxdlgs.h" #include <string> using std::string; class COpenGLView : public CView { protected: // create from serialization only COpenGLView(); DECLARE_DYNCREATE(COpenGLView) // Attributes public: COpenGLDoc* GetDocument(); // Operations public: private: int m_nAxis; // Axis of Action, X Y or Z int m_nAction; // Rotate, Translate, Scale bool m_bTransformTexture; // transformations transform the texture only int m_nView; // Orthographic, perspective bool m_bIsPerspective; // is the view perspective CString m_strItdFileName; // file name of IRIT data int m_nLightShading; // shading: Flat, Gouraud. double m_lMaterialAmbient; // The Ambient in the scene double m_lMaterialDiffuse; // The Diffuse in the scene double m_lMaterialSpecular; // The Specular in the scene int m_nMaterialShininessFactor; // The cosine factor for the specular LightParams m_lights[MAX_LIGHT]; //configurable lights array LightParams m_ambientLight; //ambient light (only RGB is used) static double zoomRatioDefault; // hw1 'constant' CPoint lastClicked; // hw1: int nSpace; // hw1: object / view space int mouseSensitivity; // hw1 float sensFactor; // hw1 bool m_bShowNormals; // hw1: draw normals bool multipleViews; // hw1 bool multipleObjects; // hw1 int activeView; // hw1 double m_lNormalScale; // hw1 $$: Larger -> larger normals bool m_bDrawVertexNormals; // hw1 GLfloat m_lCenterX; GLfloat m_lCenterY; GLfloat m_lCenterZ; double m_lColorR; // $$$$$ double m_lColorG; // $ User chosen color double m_lColorB; // $$$$$ bool m_bChoseColor; // $^ Set this to true when user chooses a color double m_backColorR; // $$$$$ double m_backColorG; // $ User background chosen color double m_backColorB; // $$$$$ bool m_backChoseColor; double m_activeColorR; // $$$$$ double m_activeColorG; // $ User highlight chosen color double m_activeColorB; // $$$$$ bool m_bIsActiveView; GLfloat m_lTotalSize; // 0.5 Diagonal of the bounding box GLfloat m_lZoomRatio; // Amount of zoom in both perspective/ortho mode (managed by Scale() ) GLfloat m_lPerspectiveRight; GLfloat m_lPerspectiveLeft; GLfloat m_lPerspectiveTop; GLfloat m_lPerspectiveBottom; GLfloat m_lPerspectiveDVal; bool m_fogEnabled ; GLfloat density;// = 0.3; //set the density to 0.3 which is acctually quite thick GLfloat fogColor[4];// = {0.5, 0.5, 0.5, 1.0}; GLfloat fogStart; GLfloat fogEnd; int fogMode; int fogQuality; bool m_bMayDraw; // For internal use - lock for drawing bool m_bTessellation; bool m_bDrawBoundingBox; // $$ Should draw bounding box around each object bool m_bUseModelColors; // %gui% should use the colors from the model instead of global values bool m_bDrawWireframe; bool m_bCullBackFaces; // %gui% cull back faces or not // %gui%: Need dialog for this group: bool m_bGenerateTexturesU; // %gui% Use generated textures instead of using given U coords bool m_bGenerateTexturesV; // %gui% Use generated textures instead of using given V coords GLfloat texGenU[4]; // %gui% parameters for U generation. Only expose first 3. GLfloat texGenV[4]; // %gui% parameters for V generation. Only expose first 3. bool m_bGentexUScreenSpace; // %gui% Generate textures by screen coords or by object space coords bool m_bGentexVScreenSpace; // %gui% Generate textures by screen coords or by object space coords unsigned char* globalTexture; // %gui% that takes a file name, I have code that reads the file into this. // %gui% or clicks - control texture transformation (rotation in U, V, scaling in U, V, translation in U, V) GLfloat tex_rotation; GLfloat tex_scaleU, tex_scaleV, tex_transU, tex_transV; bool s_repeat, t_repeat; // %gui% choose for s, t if to repeat or clamp bool m_bUserCanSelectAnObject; // %gui% - need a button to start "selection mode" for the user. Set this to true, // and the next click will set the following three: bool m_bObjectWasSelected; // Set to true after select double selectX; // Set when clicking double selectY; // Set when clicking - please save this in opengl coords (windowSizeInY - y) bool m_bSelectingForMipmapping; void drawAllObjects(); // hw1 void setProjection(); void setupLighting(bool firstCall); void Init(bool first); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(COpenGLView) public: virtual void OnDraw(CDC* pDC); // overridden to draw this view virtual BOOL PreCreateWindow(CREATESTRUCT& cs); typedef GLfloat mat16[16]; static const int MAX_VIEWS = 100; // must be equal to (int)^2 mat16 viewMatrix[MAX_VIEWS]; int numViews; int numViewsRows; int numViewsCol; int numObjects; bool isActiveView(){ return m_bIsActiveView; } protected: //}}AFX_VIRTUAL // Implementation public: virtual ~COpenGLView(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: BOOL InitializeOpenGL(); BOOL SetupPixelFormat(PIXELFORMATDESCRIPTOR* pPFD = 0); // the '= 0' was added. BOOL SetupViewingFrustum(void); BOOL SetupViewingOrthoConstAspect(void); void EnableFog (void); int fogQulityConvert(int fogQuality); int fogModeConvert(int fogMode); virtual void RenderScene(); HGLRC m_hRC; // holds the Rendering Context CDC* m_pDC; // holds the Device Context int m_WindowWidth; // hold the windows width int m_WindowHeight; // hold the windows height double m_AspectRatio; // hold the fixed Aspect Ration private: void draw_axis(); // Generated message map functions protected: //{{AFX_MSG(COpenGLView) afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnDestroy(); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnFileLoad(); afx_msg void OnViewOrthographic(); afx_msg void OnUpdateViewOrthographic(CCmdUI* pCmdUI); afx_msg void OnViewPerspective(); afx_msg void OnUpdateViewPerspective(CCmdUI* pCmdUI); //hw1 start afx_msg void OnViewModelview(); afx_msg void OnUpdateViewModelview(CCmdUI* pCmdUI); afx_msg void OnViewCameraview(); afx_msg void OnUpdateViewCameraview(CCmdUI* pCmdUI); afx_msg void OnMenu(); //hw1 end afx_msg void OnActionRotate(); afx_msg void OnUpdateActionRotate(CCmdUI* pCmdUI); afx_msg void OnActionScale(); afx_msg void OnUpdateActionScale(CCmdUI* pCmdUI); afx_msg void OnActionTranslate(); afx_msg void OnUpdateActionTranslate(CCmdUI* pCmdUI); afx_msg void OnAxisX(); afx_msg void OnUpdateAxisX(CCmdUI* pCmdUI); afx_msg void OnAxisY(); afx_msg void OnUpdateAxisY(CCmdUI* pCmdUI); afx_msg void OnAxisZ(); afx_msg void OnUpdateAxisZ(CCmdUI* pCmdUI); afx_msg void OnLightShadingFlat(); afx_msg void OnUpdateLightShadingFlat(CCmdUI* pCmdUI); afx_msg void OnLightShadingGouraud(); afx_msg void OnUpdateLightShadingGouraud(CCmdUI* pCmdUI); afx_msg void OnLightConstants(); afx_msg void COpenGLView::Scale(float scaleX, float scaleY, float scaleZ);//hw1 afx_msg void COpenGLView::Rotate(float angle); //hw1 afx_msg void COpenGLView::Translate(int x, int y); //hw1 //}}AFX_MSG DECLARE_MESSAGE_MAP() public: afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnViewView1(); afx_msg void OnUpdateViewView1(CCmdUI* pCmdUI); afx_msg void OnViewView2(); afx_msg void OnUpdateViewView2(CCmdUI* pCmdUI); afx_msg void OnViewView3(); afx_msg void OnUpdateViewView3(CCmdUI* pCmdUI); afx_msg void OnViewView4(); afx_msg void OnUpdateViewView4(CCmdUI* pCmdUI); afx_msg void OnViewMultipleviews(); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnViewPolygonsnormals(); afx_msg void OnUpdateViewPolygonsnormals(CCmdUI *pCmdUI); afx_msg void OnViewVerticesnormals(); afx_msg void OnUpdateViewVerticesnormals(CCmdUI *pCmdUI); afx_msg void OnOptionsMousesensitivity(); afx_msg void COpenGLView::SetSensFactor(); afx_msg void OnOptionsPerspectivecontrol(); afx_msg void OnViewBoundingBox(); afx_msg void OnUpdateViewBoundingBox(CCmdUI *pCmdUI); afx_msg void OnUpdateViewMultipleviews(CCmdUI *pCmdUI); afx_msg void OnActionSetcolor(); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnActionSetbackgroundcolor(); afx_msg void OnActionResetcolors(); afx_msg void OnViewMultipleobjects(); afx_msg void OnUpdateViewMultipleobjects(CCmdUI *pCmdUI); afx_msg void OnViewWireframe(); afx_msg void OnUpdateViewWireframe(CCmdUI *pCmdUI); afx_msg void OnViewEnablefog(); afx_msg void OnViewSetfogparameters(); afx_msg void OnMaterialSetmaterialparameters(); afx_msg void OnUpdateViewEnablefog(CCmdUI *pCmdUI); afx_msg void OnViewTessellation(); afx_msg void OnUpdateViewTessellation(CCmdUI *pCmdUI); afx_msg void OnActionSetfogcolor(); afx_msg void OnActionUsemodelcolors(); afx_msg void OnUpdateActionUsemodelcolors(CCmdUI *pCmdUI); afx_msg void OnViewCullbackfaces(); afx_msg void OnUpdateViewCullbackfaces(CCmdUI *pCmdUI); afx_msg void OnActionTexturetransformation(); afx_msg void OnUpdateActionTexturetransformation(CCmdUI *pCmdUI); afx_msg void OnMaterialGenerateuvector(); afx_msg void OnMaterialGeneratevvector(); afx_msg void OnMaterialUsemipmap(); afx_msg void OnUpdateMaterialUsemipmap(CCmdUI *pCmdUI); afx_msg void OnUtexturefillingRepeat(); afx_msg void OnUpdateUtexturefillingRepeat(CCmdUI *pCmdUI); afx_msg void OnMaterialUseutexture(); afx_msg void OnUpdateMaterialUseutexture(CCmdUI *pCmdUI); afx_msg void OnUtexturefillingClamp(); afx_msg void OnUpdateUtexturefillingClamp(CCmdUI *pCmdUI); afx_msg void OnVtexturefillingRepeat(); afx_msg void OnUpdateVtexturefillingRepeat(CCmdUI *pCmdUI); afx_msg void OnVtexturefillingClamp(); afx_msg void OnUpdateVtexturefillingClamp(CCmdUI *pCmdUI); afx_msg void OnMaterialUsevtexture(); afx_msg void OnUpdateMaterialUsevtexture(CCmdUI *pCmdUI); afx_msg void OnUcoordinatesspaceScreenspace(); afx_msg void OnUpdateUcoordinatesspaceScreenspace(CCmdUI *pCmdUI); afx_msg void OnUcoordinatesspaceModelspace(); afx_msg void OnUpdateUcoordinatesspaceModelspace(CCmdUI *pCmdUI); afx_msg void OnVcoordinatesspaceScreenspace(); afx_msg void OnUpdateVcoordinatesspaceScreenspace(CCmdUI *pCmdUI); afx_msg void OnVcoordinatesspaceModelspace(); afx_msg void OnUpdateVcoordinatesspaceModelspace(CCmdUI *pCmdUI); afx_msg void OnMaterialSelectobjectformipmapping(); afx_msg void OnMaterialSelectobject(); afx_msg void OnFileLoadglobaltexture(); }; #ifndef _DEBUG // debug version in OpenGLView.cpp inline COpenGLDoc* COpenGLView::GetDocument() { return (COpenGLDoc*)m_pDocument; } #endif
[ [ [ 1, 309 ] ] ]
a22e62df4df96aa25cb88ccd98f6c503256a3890
a84b013cd995870071589cefe0ab060ff3105f35
/webdriver/branches/chrome_extension/third_party/gecko-1.9.0.11/win32/include/nsIDOMHTMLOptionElement.h
e7d7f86102a7994ed3405bfdeb8b7ce16e50fd3b
[ "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
9,326
h
/* * DO NOT EDIT. THIS FILE IS GENERATED FROM e:/xr19rel/WINNT_5.2_Depend/mozilla/dom/public/idl/html/nsIDOMHTMLOptionElement.idl */ #ifndef __gen_nsIDOMHTMLOptionElement_h__ #define __gen_nsIDOMHTMLOptionElement_h__ #ifndef __gen_nsIDOMHTMLElement_h__ #include "nsIDOMHTMLElement.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: nsIDOMHTMLOptionElement */ #define NS_IDOMHTMLOPTIONELEMENT_IID_STR "a6cf9092-15b3-11d2-932e-00805f8add32" #define NS_IDOMHTMLOPTIONELEMENT_IID \ {0xa6cf9092, 0x15b3, 0x11d2, \ { 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 }} /** * The nsIDOMHTMLOptionElement interface is the interface to a [X]HTML * option element. * * For more information on this interface please see * http://www.w3.org/TR/DOM-Level-2-HTML/ * * @status FROZEN */ class NS_NO_VTABLE NS_SCRIPTABLE nsIDOMHTMLOptionElement : public nsIDOMHTMLElement { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMHTMLOPTIONELEMENT_IID) /* readonly attribute nsIDOMHTMLFormElement form; */ NS_SCRIPTABLE NS_IMETHOD GetForm(nsIDOMHTMLFormElement * *aForm) = 0; /* attribute boolean defaultSelected; */ NS_SCRIPTABLE NS_IMETHOD GetDefaultSelected(PRBool *aDefaultSelected) = 0; NS_SCRIPTABLE NS_IMETHOD SetDefaultSelected(PRBool aDefaultSelected) = 0; /* readonly attribute DOMString text; */ NS_SCRIPTABLE NS_IMETHOD GetText(nsAString & aText) = 0; /* readonly attribute long index; */ NS_SCRIPTABLE NS_IMETHOD GetIndex(PRInt32 *aIndex) = 0; /* attribute boolean disabled; */ NS_SCRIPTABLE NS_IMETHOD GetDisabled(PRBool *aDisabled) = 0; NS_SCRIPTABLE NS_IMETHOD SetDisabled(PRBool aDisabled) = 0; /* attribute DOMString label; */ NS_SCRIPTABLE NS_IMETHOD GetLabel(nsAString & aLabel) = 0; NS_SCRIPTABLE NS_IMETHOD SetLabel(const nsAString & aLabel) = 0; /* attribute boolean selected; */ NS_SCRIPTABLE NS_IMETHOD GetSelected(PRBool *aSelected) = 0; NS_SCRIPTABLE NS_IMETHOD SetSelected(PRBool aSelected) = 0; /* attribute DOMString value; */ NS_SCRIPTABLE NS_IMETHOD GetValue(nsAString & aValue) = 0; NS_SCRIPTABLE NS_IMETHOD SetValue(const nsAString & aValue) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMHTMLOptionElement, NS_IDOMHTMLOPTIONELEMENT_IID) /* Use this macro when declaring classes that implement this interface. */ #define NS_DECL_NSIDOMHTMLOPTIONELEMENT \ NS_SCRIPTABLE NS_IMETHOD GetForm(nsIDOMHTMLFormElement * *aForm); \ NS_SCRIPTABLE NS_IMETHOD GetDefaultSelected(PRBool *aDefaultSelected); \ NS_SCRIPTABLE NS_IMETHOD SetDefaultSelected(PRBool aDefaultSelected); \ NS_SCRIPTABLE NS_IMETHOD GetText(nsAString & aText); \ NS_SCRIPTABLE NS_IMETHOD GetIndex(PRInt32 *aIndex); \ NS_SCRIPTABLE NS_IMETHOD GetDisabled(PRBool *aDisabled); \ NS_SCRIPTABLE NS_IMETHOD SetDisabled(PRBool aDisabled); \ NS_SCRIPTABLE NS_IMETHOD GetLabel(nsAString & aLabel); \ NS_SCRIPTABLE NS_IMETHOD SetLabel(const nsAString & aLabel); \ NS_SCRIPTABLE NS_IMETHOD GetSelected(PRBool *aSelected); \ NS_SCRIPTABLE NS_IMETHOD SetSelected(PRBool aSelected); \ NS_SCRIPTABLE NS_IMETHOD GetValue(nsAString & aValue); \ NS_SCRIPTABLE NS_IMETHOD SetValue(const nsAString & aValue); /* Use this macro to declare functions that forward the behavior of this interface to another object. */ #define NS_FORWARD_NSIDOMHTMLOPTIONELEMENT(_to) \ NS_SCRIPTABLE NS_IMETHOD GetForm(nsIDOMHTMLFormElement * *aForm) { return _to GetForm(aForm); } \ NS_SCRIPTABLE NS_IMETHOD GetDefaultSelected(PRBool *aDefaultSelected) { return _to GetDefaultSelected(aDefaultSelected); } \ NS_SCRIPTABLE NS_IMETHOD SetDefaultSelected(PRBool aDefaultSelected) { return _to SetDefaultSelected(aDefaultSelected); } \ NS_SCRIPTABLE NS_IMETHOD GetText(nsAString & aText) { return _to GetText(aText); } \ NS_SCRIPTABLE NS_IMETHOD GetIndex(PRInt32 *aIndex) { return _to GetIndex(aIndex); } \ NS_SCRIPTABLE NS_IMETHOD GetDisabled(PRBool *aDisabled) { return _to GetDisabled(aDisabled); } \ NS_SCRIPTABLE NS_IMETHOD SetDisabled(PRBool aDisabled) { return _to SetDisabled(aDisabled); } \ NS_SCRIPTABLE NS_IMETHOD GetLabel(nsAString & aLabel) { return _to GetLabel(aLabel); } \ NS_SCRIPTABLE NS_IMETHOD SetLabel(const nsAString & aLabel) { return _to SetLabel(aLabel); } \ NS_SCRIPTABLE NS_IMETHOD GetSelected(PRBool *aSelected) { return _to GetSelected(aSelected); } \ NS_SCRIPTABLE NS_IMETHOD SetSelected(PRBool aSelected) { return _to SetSelected(aSelected); } \ NS_SCRIPTABLE NS_IMETHOD GetValue(nsAString & aValue) { return _to GetValue(aValue); } \ NS_SCRIPTABLE NS_IMETHOD SetValue(const nsAString & aValue) { return _to SetValue(aValue); } /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ #define NS_FORWARD_SAFE_NSIDOMHTMLOPTIONELEMENT(_to) \ NS_SCRIPTABLE NS_IMETHOD GetForm(nsIDOMHTMLFormElement * *aForm) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetForm(aForm); } \ NS_SCRIPTABLE NS_IMETHOD GetDefaultSelected(PRBool *aDefaultSelected) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDefaultSelected(aDefaultSelected); } \ NS_SCRIPTABLE NS_IMETHOD SetDefaultSelected(PRBool aDefaultSelected) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetDefaultSelected(aDefaultSelected); } \ NS_SCRIPTABLE NS_IMETHOD GetText(nsAString & aText) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetText(aText); } \ NS_SCRIPTABLE NS_IMETHOD GetIndex(PRInt32 *aIndex) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIndex(aIndex); } \ NS_SCRIPTABLE NS_IMETHOD GetDisabled(PRBool *aDisabled) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDisabled(aDisabled); } \ NS_SCRIPTABLE NS_IMETHOD SetDisabled(PRBool aDisabled) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetDisabled(aDisabled); } \ NS_SCRIPTABLE NS_IMETHOD GetLabel(nsAString & aLabel) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLabel(aLabel); } \ NS_SCRIPTABLE NS_IMETHOD SetLabel(const nsAString & aLabel) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetLabel(aLabel); } \ NS_SCRIPTABLE NS_IMETHOD GetSelected(PRBool *aSelected) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetSelected(aSelected); } \ NS_SCRIPTABLE NS_IMETHOD SetSelected(PRBool aSelected) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetSelected(aSelected); } \ NS_SCRIPTABLE NS_IMETHOD GetValue(nsAString & aValue) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetValue(aValue); } \ NS_SCRIPTABLE NS_IMETHOD SetValue(const nsAString & aValue) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetValue(aValue); } #if 0 /* Use the code below as a template for the implementation class for this interface. */ /* Header file */ class nsDOMHTMLOptionElement : public nsIDOMHTMLOptionElement { public: NS_DECL_ISUPPORTS NS_DECL_NSIDOMHTMLOPTIONELEMENT nsDOMHTMLOptionElement(); private: ~nsDOMHTMLOptionElement(); protected: /* additional members */ }; /* Implementation file */ NS_IMPL_ISUPPORTS1(nsDOMHTMLOptionElement, nsIDOMHTMLOptionElement) nsDOMHTMLOptionElement::nsDOMHTMLOptionElement() { /* member initializers and constructor code */ } nsDOMHTMLOptionElement::~nsDOMHTMLOptionElement() { /* destructor code */ } /* readonly attribute nsIDOMHTMLFormElement form; */ NS_IMETHODIMP nsDOMHTMLOptionElement::GetForm(nsIDOMHTMLFormElement * *aForm) { return NS_ERROR_NOT_IMPLEMENTED; } /* attribute boolean defaultSelected; */ NS_IMETHODIMP nsDOMHTMLOptionElement::GetDefaultSelected(PRBool *aDefaultSelected) { return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP nsDOMHTMLOptionElement::SetDefaultSelected(PRBool aDefaultSelected) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute DOMString text; */ NS_IMETHODIMP nsDOMHTMLOptionElement::GetText(nsAString & aText) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute long index; */ NS_IMETHODIMP nsDOMHTMLOptionElement::GetIndex(PRInt32 *aIndex) { return NS_ERROR_NOT_IMPLEMENTED; } /* attribute boolean disabled; */ NS_IMETHODIMP nsDOMHTMLOptionElement::GetDisabled(PRBool *aDisabled) { return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP nsDOMHTMLOptionElement::SetDisabled(PRBool aDisabled) { return NS_ERROR_NOT_IMPLEMENTED; } /* attribute DOMString label; */ NS_IMETHODIMP nsDOMHTMLOptionElement::GetLabel(nsAString & aLabel) { return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP nsDOMHTMLOptionElement::SetLabel(const nsAString & aLabel) { return NS_ERROR_NOT_IMPLEMENTED; } /* attribute boolean selected; */ NS_IMETHODIMP nsDOMHTMLOptionElement::GetSelected(PRBool *aSelected) { return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP nsDOMHTMLOptionElement::SetSelected(PRBool aSelected) { return NS_ERROR_NOT_IMPLEMENTED; } /* attribute DOMString value; */ NS_IMETHODIMP nsDOMHTMLOptionElement::GetValue(nsAString & aValue) { return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP nsDOMHTMLOptionElement::SetValue(const nsAString & aValue) { return NS_ERROR_NOT_IMPLEMENTED; } /* End of implementation class template. */ #endif #endif /* __gen_nsIDOMHTMLOptionElement_h__ */
[ "simon.m.stewart@07704840-8298-11de-bf8c-fd130f914ac9" ]
[ [ [ 1, 224 ] ] ]
2647255138a048e72d88dd565d5d575a28a52d82
dd5c8920aa0ea96607f2498701c81bb1af2b3c96
/multicrewcore/streams.h
1a969c4632023048ff0f2419b4ff66903f6a7a4d
[]
no_license
BackupTheBerlios/multicrew-svn
913279401e9cf886476a3c912ecd3d2b8d28344c
5087f07a100f82c37d2b85134ccc9125342c58d1
refs/heads/master
2021-01-23T13:36:03.990862
2005-06-10T16:52:32
2005-06-10T16:52:32
40,747,367
0
0
null
null
null
null
UTF-8
C++
false
false
2,585
h
#ifndef MULTICREWCORE_STREAMS_H_INCLUDED #define MULTICREWCORE_STREAMS_H_INCLUDED #include "common.h" // parts copyright 1999, James M. Curran #include <strstream> #include <ostream> #include <windows.h> DLLEXPORT std::string formatError( HRESULT hr ); #define fe formatError #if defined (_DEBUG) using std::ostream; class DebugStream : public ostream { private: class DebugStreamBuf : public std::strstreambuf { protected: virtual int sync() { sputc('\0'); HANDLE thread = GetCurrentThread(); char s[16]; sprintf( s, "%x: ", (int)thread ); OutputDebugStringA(s); OutputDebugStringA(str()); freeze(false); setp(pbase(), pbase(), epptr()); return 0; } }; DebugStreamBuf m_buf; public: DebugStream() : ostream(&m_buf) {} ~DebugStream() {} // m_buf.pubsync();} }; #else class DebugStream { public: template <typename T> inline const DebugStream& operator<<(T) const {return(*this);} typedef std::basic_ostream<char>& (__cdecl * endl_type)(std::basic_ostream<char>&); inline const DebugStream& operator<<(const endl_type T) const {return(*this);} } ; #endif #if defined (_DEBUG) using std::ostream; class ErrorStream : public ostream { private: class DebugStreamBuf : public std::strstreambuf { protected: virtual int sync() { sputc('\0'); if( strlen(str())>0 ) { MessageBox( 0, str(), TEXT("Multicrew Error"), MB_OK ); OutputDebugStringA(str()); } freeze(false); setp(pbase(), pbase(), epptr()); return 0; } }; DebugStreamBuf m_buf; public: ErrorStream() : ostream(&m_buf) {} ~ErrorStream() {} // m_buf.pubsync();} }; #else // defined (_DEBUG) class ErrorStream { public: template <typename T> inline const ErrorStream& operator<<(T) const {return(*this);} typedef std::basic_ostream<char>& (__cdecl * endl_type)(std::basic_ostream<char>&); inline const ErrorStream& operator<<(const endl_type T) const {return(*this);} } ; #endif extern DLLEXPORT ErrorStream derr; extern DLLEXPORT DebugStream dout; #ifdef _DEBUG extern DLLEXPORT CRITICAL_SECTION ostreamCritSec; // And now some C magic to make ostreams thread aware (thanks to C guru Janko Heilgeist) #define dout do { EnterCriticalSection( &ostreamCritSec ); dout #define derr do { EnterCriticalSection( &ostreamCritSec ); derr #define endl endl; LeaveCriticalSection( &ostreamCritSec ); } while(false) #endif #endif
[ "schimmi@cb9ff89a-abed-0310-8fc6-a4cabe7d48c9" ]
[ [ [ 1, 130 ] ] ]
e209501a6067757f53e066f1164c58c5c364b06c
59166d9d1eea9b034ac331d9c5590362ab942a8f
/XMLTree2Geom/xml/xmlRoot/xmlFronds/xmlFrondsSave.cpp
50d97ce418e86c14af1b4cfe14a91fc12b02f022
[]
no_license
seafengl/osgtraining
5915f7b3a3c78334b9029ee58e6c1cb54de5c220
fbfb29e5ae8cab6fa13900e417b6cba3a8c559df
refs/heads/master
2020-04-09T07:32:31.981473
2010-09-03T15:10:30
2010-09-03T15:10:30
40,032,354
0
3
null
null
null
null
WINDOWS-1251
C++
false
false
323
cpp
#include "xmlFrondsSave.h" xmlFrondsSave::xmlFrondsSave() : m_pData( NULL ) { } xmlFrondsSave::~xmlFrondsSave() { } ticpp::Node* xmlFrondsSave::GetXmlData( const binFronds &_data ) { //получить xml тег с сформированными данными m_pData = &_data; return NULL; }
[ "asmzx79@3290fc28-3049-11de-8daa-cfecb5f7ff5b" ]
[ [ [ 1, 19 ] ] ]
ef2335d9355f6fc181a3a935a141a0205297ed28
e7c45d18fa1e4285e5227e5984e07c47f8867d1d
/Common/Scd/ScdLib/CBSPLINE.CPP
1d8d8f5fe64fd479d7bf3783897cf136dde88c12
[]
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
7,639
cpp
//================== SysCAD - Copyright Kenwalt (Pty) Ltd =================== // $Nokeywords: $ //=========================================================================== #include "stdafx.h" #include "sc_defs.h" #define _CBSPLINE_CPP #include "cbspline.h" #include "vectors.h" // ========================================================================= const double CubicSpline::yp1=1e30; const double CubicSpline::ypn=1e30; CubicSpline::CubicSpline() { Clear(); } // ------------------------------------------------------------------------- CubicSpline::~CubicSpline() { Clear(); } //--------------------------------------------------------------------------- void CubicSpline::Clear() { dY.SetSize(0); dX.SetSize(0); dYTab.SetSize(0,0); } // ------------------------------------------------------------------------- double CubicSpline::Xy(double Yi) { if ((Y.GetLen()>3)&&(X.ScanMin()>0.0)&&(Y.ScanMin()>0.0)) { if (dX.GetLen() <= 0) { Spline(Y, X, dX); } double xv, yv; yv=Range(Y.ScanMin(), Yi, Y.ScanMax()); // can't extrapolate too well if (Splint(Y, X, dX, yv, &xv)==0) return xv; else return 0.0; } else return 0.0; } // ------------------------------------------------------------------------- double CubicSpline::Yx(double Xi) { if ((X.GetLen()>3)&&(X.ScanMin()>0.0)&&(Y.ScanMin()>0.0)) { if (dY.GetLen() <= 0) { Spline(X, Y, dY); } double yv, xv; xv=Range(X.ScanMin(), Xi, X.ScanMax()); // can't extrapolate too well if (Splint(X, Y, dY, xv, &yv)==0) return yv; else return 0.0; } else return 0.0; } //---------------------------------------------------------- double CubicSpline::Yxx(double Xi, double Xii) { if ((X.GetLen()>3)&&(X1.GetLen()>3)) { if ((dYTab.GetRows()<=0)||(dYTab.GetCols()<=0)) Spline2(X, X1, YTable, dYTab); double xv1, xv2, yv; xv1=Range(X.ScanMin(), Xi, X.ScanMax()); xv2=Range(X1.ScanMin(), Xii, X1.ScanMax()); if (Splint2(X, X1, YTable, dYTab, xv1, xv2, &yv)==0) return yv; else return 0.0; } else return 0.0; } //---------------------------------------------------------- /* -------------------------------------------------------------------- Given arrays x[0..n-1] and y[0..n-1] containing a tabulated function, i.e. y = f(x) with x1 < x2 <....<xn, and given values yp1 and ypn for the first derivative of the interpolating function at points 0 and n-1, respectively, this routine returns an array y2[0..n-1] that contains the second derivative of the interpolating function at the tabulated points xi. If yp1 and/or ypn are equal to 1e30 or larger, the routine is signalled to set the corresponding boundary condition for a natural spline, with zero second derivative on that boundary -------------------------------------------------------------------- */ void CubicSpline::Spline(rCDVector x, rCDVector y, rCDVector y2) { long n = x.GetLen(); if ((n>3)&&(x.ScanMin()>0.0)&&(y.ScanMin()>0.0)) { y2.SetSize(n); //long n = NPts(); CDVector u; u.SetSize(n); int i, k; double p, qn, sig, un; if (yp1 > 0.99e+30) { y2[0] = 0.0; u[0] = 0.0; } else { y2[0]= - 0.5; // check in book for error below u[0] = (3.0 / (x[1]-x[0]))*((y[1]-y[0])/(x[1]-x[0])-yp1); } for (i=1; i<=n-2; i++) { sig = (x[i]-x[i-1])/(x[i+1]-x[i-1]); p = sig * y2[i - 1] + 2.0; y2[i] = (sig-1.0)/p; u[i] = (y[i+1]-y[i])/(x[i+1]-x[i])-(y[i]-y[i-1])/(x[i]-x[i-1]); u[i] = (6.0*u[i]/(x[i+1]-x[i-1])-sig*u[i-1])/p; } if (ypn > 0.99e+30) { qn = 0.0; un = 0.0; } else { qn = 0.5; un = (3.0/(x[n-1]-x[n-2]))*(ypn-(y[n-1]-y[n-2])/(x[n-1]-x[n-2])); } y2[n-1] = (un-qn*u[n-2])/(qn*y2[n-2]+1.0); for (k = n-2; k >= 0; k--) y2[k] = y2[k]*y2[k+1]+u[k]; } } // ------------------------------------------------------------------------- /* {--------------------------------------------------------------------- } { Given the arrays xa[0..n-1] and ya[0..n-1], which tabulate a function } { with the xa's in order), and given the array y2a[0..n-1], which is the } { output from Spline above, and given a value of x, this routine } { returns a cubic-spline interpolated value y. } {-------------------------------------------------------------------- -} */ int CubicSpline::Splint(rCDVector x, rCDVector y, rCDVector y2, double xv, double *yv) { long klo,khi, k, er; double h, b, a; long n = x.GetLen(); klo = 0; //1; khi = n-1; //n; while (khi-klo > 1) { k = (khi+klo) / 2; if (x[k] > xv) khi = k; else klo = k; } //h = x.m_d[khi]-x.m_d[klo]; h = x[khi]-x[klo]; if (h==0.0) { //printf(" pause in routine SPLINT\n"); //printf("....bad xa input\n"); er=1; } else er = 0; a = (x[khi]-xv)/h; b = (xv-x[klo])/h; *yv = a*y[klo]+b*y[khi]+((a*a*a-a)*y2[klo] +(b*b*b-b)*y2[khi])*(h*h)/6.0; return er; } //-------------------------------------------------------------------------- /* Given the tabulated independent variables x1[0..m-1] and x2[0..n-1], and a tabulated */ /* function ytab[0..m-1,0..n-1], this routine constructs one-dimensional natural cubic */ /* splines of the rows ytab and returns the second-derivatives in the array */ /* y2tab[0..m-1,0..n-1] */ void CubicSpline::Spline2(rCDVector x1, rCDVector x2, rCDMatrix ytab, rCDMatrix y2tab) { long m, n; CDVector ytmp, y2tmp; m=x1.GetLen(); n=x2.GetLen(); //ytmp.SetSize(n, 0.0); y2tmp.SetSize(n, 0.0); y2tab.SetSize(m, n, 0); for (long i=0; i<m; i++) { ytab.GetRow(i, ytmp); //for (long k=0; k<n; k++) ytmp[k]=ytab(j,k); Spline(x2, ytmp, y2tmp); y2tab.SetRow(i, y2tmp); //for (k=0;k<n; k++) y2tab(j,k)=y2tmp[k]; } } // ------------------------------------------------------------------------- /* Given x1, x2, ytab and y2tab as produced by Spline2 and given a desired interpolating */ /* point x1, x2; this routine returns an interpolated function value yv by bicubic spline */ /* interpolation. */ int CubicSpline::Splint2(rCDVector x1, rCDVector x2, rCDMatrix ytab, rCDMatrix y2tab, double xv1, double xv2, double *yv) { int res=0; long m, n; CDVector ytmp, y2tmp, yytmp; m=x1.GetLen(); n=x2.GetLen(); yytmp.SetSize(m, 0.0); for (long i=0; i<m; i++) { ytab.GetRow(i, ytmp); y2tab.GetRow(i, y2tmp); //for (long k=0; k<n; k++) // { // ytmp[k]=ytab(j,k); // y2tmp[k]=y2tab(j,k); // } if (Splint(x2, ytmp, y2tmp, xv2, &yytmp[i])!=0) res+=1; } Spline(x1, yytmp, y2tmp); if (Splint(x1, yytmp, y2tmp, xv1, yv)!=0) res+=1; return res; } // ------------------------------------------------------------------------- void CubicSpline::GetXYDerivs() { Spline(X, Y, dY); Spline(Y, X, dX); } //-------------------------------------------------------------------------- void CubicSpline::GetTableDerivs() { Spline2(X, X1, YTable, dYTab); } //-------------------------------------------------------------------------- // =========================================================================
[ [ [ 1, 300 ] ] ]
28b623e5f5bb98ebe9ba1bf14b7c021725ab47de
faacd0003e0c749daea18398b064e16363ea8340
/3rdparty/phonon/iodevicestream.cpp
c9c7c7bc8ea4dbcb7632b4c92485ad204cb0c554
[]
no_license
yjfcool/lyxcar
355f7a4df7e4f19fea733d2cd4fee968ffdf65af
750be6c984de694d7c60b5a515c4eb02c3e8c723
refs/heads/master
2016-09-10T10:18:56.638922
2009-09-29T06:03:19
2009-09-29T06:03:19
42,575,701
0
0
null
null
null
null
UTF-8
C++
false
false
2,831
cpp
/* This file is part of the KDE project Copyright (C) 2007 Matthias Kretz <[email protected]> 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) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), Trolltech ASA (or its successors, if any) and the KDE Free Qt Foundation, which shall act as a proxy defined in Section 6 of version 3 of the license. 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, see <http://www.gnu.org/licenses/>. */ #include "iodevicestream_p.h" #include "abstractmediastream_p.h" QT_BEGIN_NAMESPACE #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM namespace Phonon { class IODeviceStreamPrivate : public AbstractMediaStreamPrivate { Q_DECLARE_PUBLIC(IODeviceStream) protected: IODeviceStreamPrivate(QIODevice *_ioDevice) : ioDevice(_ioDevice) { if (!ioDevice->isOpen()) { ioDevice->open(QIODevice::ReadOnly); } Q_ASSERT(ioDevice->isOpen()); Q_ASSERT(ioDevice->isReadable()); streamSize = ioDevice->size(); streamSeekable = !ioDevice->isSequential(); } private: QIODevice *ioDevice; }; IODeviceStream::IODeviceStream(QIODevice *ioDevice, QObject *parent) : AbstractMediaStream(*new IODeviceStreamPrivate(ioDevice), parent) { Q_D(IODeviceStream); d->ioDevice->reset(); } IODeviceStream::~IODeviceStream() { } void IODeviceStream::reset() { Q_D(IODeviceStream); d->ioDevice->reset(); //resetDone(); } void IODeviceStream::needData() { quint32 size = 4096; Q_D(IODeviceStream); const QByteArray data = d->ioDevice->read(size); if (data.isEmpty() && !d->ioDevice->atEnd()) { error(Phonon::NormalError, d->ioDevice->errorString()); } writeData(data); if (d->ioDevice->atEnd()) { endOfData(); } } void IODeviceStream::seekStream(qint64 offset) { Q_D(IODeviceStream); d->ioDevice->seek(offset); //seekStreamDone(); } } // namespace Phonon #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM QT_END_NAMESPACE #include "moc_iodevicestream_p.cpp" // vim: sw=4 sts=4 et tw=100
[ "futurelink.vl@9e60f810-e830-11dd-9b7c-bbba4c9295f9" ]
[ [ [ 1, 100 ] ] ]
0dd95f6dae5123363fab911120c770129431b88c
b4f709ac9299fe7a1d3fa538eb0714ba4461c027
/trunk/powertabinputstream.h
433981f7011c0cbb9b2348050250f11850a4c5c5
[]
no_license
BackupTheBerlios/ptparser-svn
d953f916eba2ae398cc124e6e83f42e5bc4558f0
a18af9c39ed31ef5fd4c5e7b69c3768c5ebb7f0c
refs/heads/master
2020-05-27T12:26:21.811820
2005-11-06T14:23:18
2005-11-06T14:23:18
40,801,514
0
0
null
null
null
null
UTF-8
C++
false
false
2,874
h
///////////////////////////////////////////////////////////////////////////// // Name: powertabinputstream.h // Purpose: Input stream used to deserialize MFC based Power Tab data // Author: Brad Larsen // Modified by: // Created: Dec 19, 2004 // RCS-ID: // Copyright: (c) Brad Larsen // License: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifndef __POWERTABINPUTSTREAM_H__ #define __POWERTABINPUTSTREAM_H__ class PowerTabObject; WX_DECLARE_STRING_HASH_MAP(wxUint32, ClassIdHashMap); WX_DECLARE_HASH_MAP(wxUint32, wxString, wxIntegerHash, wxIntegerEqual, ClassIdIdHashMap); /// Input stream used to deserialize MFC based Power Tab data class PowerTabInputStream : public wxDataInputStream { friend class PowerTabFileHeader; friend class PowerTabObject; protected: bool m_mapsInitialized; ///< Determines whether or not the maps have been initialized wxUint32 m_mapCount; ///< Internal count of mapped objects PowerTabStreamError m_lastPowerTabError; ///< Last Power Tab specific error ClassIdHashMap m_classIdHashMap; ///< Map of class Ids to the id of the class id ClassIdIdHashMap m_classIdIdHashMap; ///< Map of Id of the class Id to the class id (opposite of above map) wxArrayPtrVoid m_loadArray; ///< Array of pointers to loaded objects and tags public: // Constructor/Destructor PowerTabInputStream(wxInputStream& stream); ~PowerTabInputStream(); // Read Functions wxUint32 ReadCount(); bool ReadAnsiText(wxUint32 length, wxString& text); bool ReadMFCString(wxString& string); bool ReadWin32ColorRef(wxColor& color); bool ReadMFCRect(wxRect& rect); PowerTabObject* ReadObject(wxWord version); protected: bool ReadClassInformation(wxWord version, wxString& classId, wxUint32& objectTag); wxUint32 ReadMFCStringLength(wxUint32& charSize); // Error Checking Functions public: /// Checks the current state of the stream /// @return True if the stream is OK, false if an error has occurred bool CheckState() {return (IsOk() && (m_lastPowerTabError == POWERTABSTREAM_NO_ERROR));} wxString GetLastErrorMessage(); protected: bool CheckCount(); // Operations bool MapObject(const PowerTabObject* object); public: /// Gets the current stream position, in bytes /// @return The current stream position, in bytes off_t TellI() const {wxCHECK(m_input != NULL, 0); return (m_input->TellI());} }; #endif
[ "blarsen@8c24db97-d402-0410-b267-f151a046c31a" ]
[ [ [ 1, 71 ] ] ]
91c7b910a38621448861fa9cd617ad429066aeb4
9c32a550d1aa302b16eeb904d51205b9ed2c38d2
/source/kioskcomp/kiosk_module.cpp
78ddf9967060506b43937e95cc26b77fab5a2e16
[]
no_license
javihernandez/KioskFox
0e4c5022ecbbe2f80a76fce42991163879cbc526
e5db814771f117a156b4f04cdbfab34085b7b6d8
refs/heads/master
2016-09-03T01:02:06.726253
2011-08-11T23:38:58
2011-08-11T23:38:58
2,052,557
0
0
null
null
null
null
UTF-8
C++
false
false
681
cpp
#include "nsIGenericFactory.h" #include "kiosk_impl.h" #pragma comment(lib,"xulrunner-sdk\\sdk\\lib\\nspr4.lib") #pragma comment(lib,"xulrunner-sdk\\sdk\\lib\\xpcomglue.lib") #pragma comment(lib,"xulrunner-sdk\\sdk\\lib\\xpcomglue_s.lib") #pragma comment(lib,"xulrunner-sdk\\sdk\\lib\\plds4.lib ") #pragma comment(lib,"xulrunner-sdk\\sdk\\lib\\plc4.lib") #pragma comment(lib,"xulrunner-sdk\\sdk\\lib\\xpcom.lib") NS_GENERIC_FACTORY_CONSTRUCTOR(CKioskComponent) static nsModuleComponentInfo components[] = { { KIOSK_CLASSNAME, KIOSK_CID, KIOSK_CONTRACTID, CKioskComponentConstructor, } }; NS_IMPL_NSGETMODULE("kiosk_module",components)
[ [ [ 1, 23 ] ] ]
8f1e8f4cf8177a270a552b239cd32983e38f8393
9a48be80edc7692df4918c0222a1640545384dbb
/Libraries/Boost1.40/libs/iostreams/test/tee_test.cpp
15fe8693f8c0f192fd32c1cb7ec4b501d9cf8bb6
[ "BSL-1.0" ]
permissive
fcrick/RepSnapper
05e4fb1157f634acad575fffa2029f7f655b7940
a5809843f37b7162f19765e852b968648b33b694
refs/heads/master
2021-01-17T21:42:29.537504
2010-06-07T05:38:05
2010-06-07T05:38:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,821
cpp
// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) // (C) Copyright 2004-2007 Jonathan Turkanis // 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/iostreams for documentation. #include <fstream> #include <boost/iostreams/compose.hpp> #include <boost/iostreams/device/file.hpp> #include <boost/iostreams/filtering_stream.hpp> #include <boost/iostreams/tee.hpp> #include <boost/test/test_tools.hpp> #include <boost/test/unit_test.hpp> #include "detail/closable.hpp" #include "detail/operation_sequence.hpp" #include "detail/temp_file.hpp" #include "detail/verification.hpp" using namespace std; using namespace boost; using namespace boost::iostreams; using namespace boost::iostreams::test; using boost::unit_test::test_suite; namespace io = boost::iostreams; void read_write_test() { { temp_file dest1; temp_file dest2; filtering_ostream out; out.push(tee(file_sink(dest1.name(), out_mode))); out.push(file_sink(dest2.name(), out_mode)); write_data_in_chars(out); out.reset(); BOOST_CHECK_MESSAGE( compare_files(dest1.name(), dest2.name()), "failed writing to a tee_filter in chars" ); } { temp_file dest1; temp_file dest2; filtering_ostream out; out.push(tee(file_sink(dest1.name(), out_mode))); out.push(file_sink(dest2.name(), out_mode)); write_data_in_chunks(out); out.reset(); BOOST_CHECK_MESSAGE( compare_files(dest1.name(), dest2.name()), "failed writing to a tee_filter in chunks" ); } { temp_file dest1; temp_file dest2; filtering_ostream out; out.push( tee( file_sink(dest1.name(), out_mode), file_sink(dest2.name(), out_mode) ) ); write_data_in_chars(out); out.reset(); BOOST_CHECK_MESSAGE( compare_files(dest1.name(), dest2.name()), "failed writing to a tee_device in chars" ); } { temp_file dest1; temp_file dest2; filtering_ostream out; out.push( tee( file_sink(dest1.name(), out_mode), file_sink(dest2.name(), out_mode) ) ); write_data_in_chunks(out); out.reset(); BOOST_CHECK_MESSAGE( compare_files(dest1.name(), dest2.name()), "failed writing to a tee_device in chunks" ); } } void close_test() { // Note: The implementation of tee_device closes the first // sink before the second // Tee two sinks (Borland <= 5.8.2 needs a little help compiling this case, // but it executes the closing algorithm correctly) { operation_sequence seq; chain<output> ch; ch.push( io::tee( closable_device<output>(seq.new_operation(1)), closable_device< #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) borland_output #else output #endif >(seq.new_operation(2)) ) ); BOOST_CHECK_NO_THROW(ch.reset()); BOOST_CHECK_OPERATION_SEQUENCE(seq); } // Tee two bidirectional devices { operation_sequence seq; chain<output> ch; ch.push( io::tee( closable_device<bidirectional>( seq.new_operation(1), seq.new_operation(2) ), closable_device<bidirectional>( seq.new_operation(3), seq.new_operation(4) ) ) ); BOOST_CHECK_NO_THROW(ch.reset()); BOOST_CHECK_OPERATION_SEQUENCE(seq); } // Tee two seekable devices { operation_sequence seq; chain<output> ch; ch.push( io::tee( closable_device<seekable>(seq.new_operation(1)), closable_device<seekable>(seq.new_operation(2)) ) ); BOOST_CHECK_NO_THROW(ch.reset()); BOOST_CHECK_OPERATION_SEQUENCE(seq); } // Tee a sink { operation_sequence seq; chain<output> ch; ch.push(io::tee(closable_device<output>(seq.new_operation(1)))); ch.push(closable_device<output>(seq.new_operation(2))); BOOST_CHECK_NO_THROW(ch.reset()); BOOST_CHECK_OPERATION_SEQUENCE(seq); } // Tee a bidirectional device { operation_sequence seq; chain<output> ch; ch.push( io::tee( closable_device<bidirectional>( seq.new_operation(1), seq.new_operation(2) ) ) ); ch.push(closable_device<output>(seq.new_operation(3))); BOOST_CHECK_NO_THROW(ch.reset()); BOOST_CHECK_OPERATION_SEQUENCE(seq); } // Tee a seekable device { operation_sequence seq; chain<output> ch; ch.push(io::tee(closable_device<seekable>(seq.new_operation(1)))); ch.push(closable_device<seekable>(seq.new_operation(2))); BOOST_CHECK_NO_THROW(ch.reset()); BOOST_CHECK_OPERATION_SEQUENCE(seq); } } void tee_composite_test() { // This test is probably redundant, given the above test and the tests in // compose_test.cpp, but it verifies that ticket #1002 is fixed // Tee a composite sink with a sink { operation_sequence seq; chain<output> ch; ch.push( io::tee( io::compose( closable_filter<output>(seq.new_operation(1)), closable_device<output>(seq.new_operation(2)) ), closable_device<output>(seq.new_operation(3)) ) ); BOOST_CHECK_NO_THROW(ch.reset()); BOOST_CHECK_OPERATION_SEQUENCE(seq); } // Tee a composite bidirectional device with a sink { operation_sequence seq; chain<output> ch; ch.push( io::tee( io::compose( closable_filter<bidirectional>( seq.new_operation(2), seq.new_operation(3) ), closable_device<bidirectional>( seq.new_operation(1), seq.new_operation(4) ) ), closable_device<output>(seq.new_operation(5)) ) ); BOOST_CHECK_NO_THROW(ch.reset()); BOOST_CHECK_OPERATION_SEQUENCE(seq); } // Tee a composite composite seekable device with a sink { operation_sequence seq; chain<output> ch; ch.push( io::tee( io::compose( closable_filter<seekable>(seq.new_operation(1)), closable_device<seekable>(seq.new_operation(2)) ), closable_device<output>(seq.new_operation(3)) ) ); BOOST_CHECK_NO_THROW(ch.reset()); BOOST_CHECK_OPERATION_SEQUENCE(seq); } // Tee a composite sink { operation_sequence seq; chain<output> ch; ch.push( io::tee( io::compose( closable_filter<output>(seq.new_operation(1)), closable_device<output>(seq.new_operation(2)) ) ) ); ch.push(closable_device<output>(seq.new_operation(3))); BOOST_CHECK_NO_THROW(ch.reset()); BOOST_CHECK_OPERATION_SEQUENCE(seq); } // Tee a composite bidirectional device with a sink { operation_sequence seq; chain<output> ch; ch.push( io::tee( io::compose( closable_filter<bidirectional>( seq.new_operation(2), seq.new_operation(3) ), closable_device<bidirectional>( seq.new_operation(1), seq.new_operation(4) ) ) ) ); ch.push(closable_device<output>(seq.new_operation(5))); BOOST_CHECK_NO_THROW(ch.reset()); BOOST_CHECK_OPERATION_SEQUENCE(seq); } // Tee a composite composite seekable device with a sink { operation_sequence seq; chain<output> ch; ch.push( io::tee( io::compose( closable_filter<seekable>(seq.new_operation(1)), closable_device<seekable>(seq.new_operation(2)) ) ) ); ch.push(closable_device<output>(seq.new_operation(3))); BOOST_CHECK_NO_THROW(ch.reset()); BOOST_CHECK_OPERATION_SEQUENCE(seq); } } test_suite* init_unit_test_suite(int, char* []) { test_suite* test = BOOST_TEST_SUITE("tee test"); test->add(BOOST_TEST_CASE(&read_write_test)); test->add(BOOST_TEST_CASE(&close_test)); return test; }
[ "metrix@Blended.(none)" ]
[ [ [ 1, 311 ] ] ]
94be32318e2417dd401ed7554159b2fe0421d669
fac8de123987842827a68da1b580f1361926ab67
/inc/physics/Physics/Dynamics/Common/hkpProperty.inl
308cec7d3198096775c9e05bf7f9f866c2dd054d
[]
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
2,526
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-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. * */ inline void hkpPropertyValue::setReal( const hkReal r ) { // Use a union to ensure that the hkReal is // always stored in the LSB end of m_data // regardless of platform endianness union { hkReal r; hkUint32 u; } u; u.r = r; m_data = u.u; } inline void hkpPropertyValue::setInt( const int i ) { m_data = i; } inline void hkpPropertyValue::setPtr( void* p ) { m_data = reinterpret_cast<hkUlong>(p); } // constructors here for inlining inline hkpPropertyValue::hkpPropertyValue( const int i ) { setInt(i); } inline hkpPropertyValue::hkpPropertyValue( const hkReal r ) { setReal(r); } inline hkpPropertyValue::hkpPropertyValue( void* p ) { setPtr(p); } inline hkReal hkpPropertyValue::getReal() const { // see comment in setReal union { hkReal r; hkUint32 u; } u; u.u = hkUint32(m_data); return u.r; } inline int hkpPropertyValue::getInt() const { return static_cast<int>(m_data); } inline void* hkpPropertyValue::getPtr() const { return reinterpret_cast<void*>(static_cast<hkUlong>(m_data)); } inline hkpProperty::hkpProperty() { } inline hkpProperty::hkpProperty( hkUint32 key, hkInt32 value ) : m_key(key), m_value(value) { } inline hkpProperty::hkpProperty( hkUint32 key, hkpPropertyValue value ) : m_key(key), m_value(value) { } /* * 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, 99 ] ] ]