Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/kernel/gen_system')
-rw-r--r--source/kernel/gen_system/GEN_HashedPtr.cpp62
-rw-r--r--source/kernel/gen_system/GEN_HashedPtr.h51
-rw-r--r--source/kernel/gen_system/GEN_Map.h183
-rw-r--r--source/kernel/gen_system/SYS_SingletonSystem.cpp101
-rw-r--r--source/kernel/gen_system/SYS_SingletonSystem.h66
-rw-r--r--source/kernel/gen_system/SYS_System.cpp79
-rw-r--r--source/kernel/gen_system/SYS_System.h73
7 files changed, 0 insertions, 615 deletions
diff --git a/source/kernel/gen_system/GEN_HashedPtr.cpp b/source/kernel/gen_system/GEN_HashedPtr.cpp
deleted file mode 100644
index f065d27bee2..00000000000
--- a/source/kernel/gen_system/GEN_HashedPtr.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * 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.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
- */
-
-/** \file kernel/gen_system/GEN_HashedPtr.cpp
- * \ingroup gensys
- */
-
-#include "GEN_HashedPtr.h"
-
-#include "BLO_sys_types.h" // for intptr_t support
-
-//
-// Build hash index from pointer. Even though the final result
-// is a 32-bit integer, use all the bits of the pointer as long
-// as possible.
-//
-#if 1
-unsigned int GEN_Hash(void * inDWord)
-{
- uintptr_t key = (uintptr_t)inDWord;
-#if 0
- // this is way too complicated
- key += ~(key << 16);
- key ^= (key >> 5);
- key += (key << 3);
- key ^= (key >> 13);
- key += ~(key << 9);
- key ^= (key >> 17);
-
- return (unsigned int)(key & 0xffffffff);
-#else
- return (unsigned int)(key ^ (key>>4));
-#endif
-}
-#endif
diff --git a/source/kernel/gen_system/GEN_HashedPtr.h b/source/kernel/gen_system/GEN_HashedPtr.h
deleted file mode 100644
index 86a7ceb9ae7..00000000000
--- a/source/kernel/gen_system/GEN_HashedPtr.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * 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.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
- */
-
-/** \file kernel/gen_system/GEN_HashedPtr.h
- * \ingroup gensys
- */
-
-#ifndef __GEN_HASHEDPTR
-#define __GEN_HASHEDPTR
-
-unsigned int GEN_Hash(void * inDWord);
-
-class GEN_HashedPtr
-{
- void* m_valptr;
-public:
- GEN_HashedPtr(void* val) : m_valptr(val) {};
- unsigned int hash() const { return GEN_Hash(m_valptr);};
- inline friend bool operator ==(const GEN_HashedPtr & rhs, const GEN_HashedPtr & lhs) { return rhs.m_valptr == lhs.m_valptr;};
- void *getValue() const { return m_valptr; }
-};
-
-#endif //__GEN_HASHEDPTR
-
diff --git a/source/kernel/gen_system/GEN_Map.h b/source/kernel/gen_system/GEN_Map.h
deleted file mode 100644
index 4ac5a10c4c6..00000000000
--- a/source/kernel/gen_system/GEN_Map.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * 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.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file kernel/gen_system/GEN_Map.h
- * \ingroup gensys
- */
-
-#ifndef GEN_MAP_H
-#define GEN_MAP_H
-
-template <class Key, class Value>
-class GEN_Map {
-private:
- struct Entry {
- Entry (Entry *next, Key key, Value value) :
- m_next(next),
- m_key(key),
- m_value(value) {}
-
- Entry *m_next;
- Key m_key;
- Value m_value;
- };
-
-public:
- GEN_Map(int num_buckets = 100) : m_num_buckets(num_buckets) {
- m_buckets = new Entry *[num_buckets];
- for (int i = 0; i < num_buckets; ++i) {
- m_buckets[i] = 0;
- }
- }
-
- GEN_Map(const GEN_Map& map)
- {
- m_num_buckets = map.m_num_buckets;
- m_buckets = new Entry *[m_num_buckets];
-
- for (int i = 0; i < m_num_buckets; ++i) {
- m_buckets[i] = 0;
-
- for(Entry *entry = map.m_buckets[i]; entry; entry=entry->m_next)
- insert(entry->m_key, entry->m_value);
- }
- }
-
- int size() {
- int count=0;
- for (int i=0;i<m_num_buckets;i++)
- {
- Entry* bucket = m_buckets[i];
- while(bucket)
- {
- bucket = bucket->m_next;
- count++;
- }
- }
- return count;
- }
-
- Value* at(int index) {
- int count=0;
- for (int i=0;i<m_num_buckets;i++)
- {
- Entry* bucket = m_buckets[i];
- while(bucket)
- {
- if (count==index)
- {
- return &bucket->m_value;
- }
- bucket = bucket->m_next;
- count++;
- }
- }
- return 0;
- }
-
- Key* getKey(int index) {
- int count=0;
- for (int i=0;i<m_num_buckets;i++)
- {
- Entry* bucket = m_buckets[i];
- while(bucket)
- {
- if (count==index)
- {
- return &bucket->m_key;
- }
- bucket = bucket->m_next;
- count++;
- }
- }
- return 0;
- }
-
- void clear() {
- for (int i = 0; i < m_num_buckets; ++i) {
- Entry *entry_ptr = m_buckets[i];
-
- while (entry_ptr != 0) {
- Entry *tmp_ptr = entry_ptr->m_next;
- delete entry_ptr;
- entry_ptr = tmp_ptr;
- }
- m_buckets[i] = 0;
- }
- }
-
- ~GEN_Map() {
- clear();
- delete [] m_buckets;
- }
-
- void insert(const Key& key, const Value& value) {
- Entry *entry_ptr = m_buckets[key.hash() % m_num_buckets];
- while ((entry_ptr != 0) && !(key == entry_ptr->m_key)) {
- entry_ptr = entry_ptr->m_next;
- }
-
- if (entry_ptr != 0) {
- entry_ptr->m_value = value;
- }
- else {
- Entry **bucket = &m_buckets[key.hash() % m_num_buckets];
- *bucket = new Entry(*bucket, key, value);
- }
- }
-
- void remove(const Key& key) {
- Entry **entry_ptr = &m_buckets[key.hash() % m_num_buckets];
- while ((*entry_ptr != 0) && !(key == (*entry_ptr)->m_key)) {
- entry_ptr = &(*entry_ptr)->m_next;
- }
-
- if (*entry_ptr != 0) {
- Entry *tmp_ptr = (*entry_ptr)->m_next;
- delete *entry_ptr;
- *entry_ptr = tmp_ptr;
- }
- }
-
- Value *operator[](Key key) {
- Entry *bucket = m_buckets[key.hash() % m_num_buckets];
- while ((bucket != 0) && !(key == bucket->m_key)) {
- bucket = bucket->m_next;
- }
- return bucket != 0 ? &bucket->m_value : 0;
- }
-
-private:
- int m_num_buckets;
- Entry **m_buckets;
-};
-
-#endif
-
-
diff --git a/source/kernel/gen_system/SYS_SingletonSystem.cpp b/source/kernel/gen_system/SYS_SingletonSystem.cpp
deleted file mode 100644
index 08ee186c723..00000000000
--- a/source/kernel/gen_system/SYS_SingletonSystem.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * 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.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- * Unique instance of system class for system specific information / access
- * Used by SYS_System
- */
-
-/** \file kernel/gen_system/SYS_SingletonSystem.cpp
- * \ingroup gensys
- */
-
-#include "SYS_SingletonSystem.h"
-// #include "GEN_DataCache.h"
-
-SYS_SingletonSystem* SYS_SingletonSystem::_instance = 0;
-
-void SYS_SingletonSystem::Destruct()
-{
- if (_instance) {
- delete _instance;
- _instance = NULL;
- }
-}
-
-SYS_SingletonSystem *SYS_SingletonSystem::Instance()
-{
- if (!_instance) {
- _instance = new SYS_SingletonSystem();
- }
- return _instance;
-}
-
-int SYS_SingletonSystem::SYS_GetCommandLineInt(const char *paramname, int defaultvalue)
-{
- int *result = m_int_commandlineparms[paramname];
- if (result)
- return *result;
-
- return defaultvalue;
-}
-
-float SYS_SingletonSystem::SYS_GetCommandLineFloat(const char *paramname, float defaultvalue)
-{
- float *result = m_float_commandlineparms[paramname];
- if (result)
- return *result;
-
- return defaultvalue;
-}
-
-const char *SYS_SingletonSystem::SYS_GetCommandLineString(const char *paramname, const char *defaultvalue)
-{
- STR_String *result = m_string_commandlineparms[paramname];
- if (result)
- return *result;
-
- return defaultvalue;
-}
-
-void SYS_SingletonSystem::SYS_WriteCommandLineInt(const char *paramname, int value)
-{
- m_int_commandlineparms.insert(paramname, value);
-}
-
-void SYS_SingletonSystem::SYS_WriteCommandLineFloat(const char *paramname, float value)
-{
- m_float_commandlineparms.insert(paramname, value);
-}
-
-void SYS_SingletonSystem::SYS_WriteCommandLineString(const char *paramname, const char *value)
-{
- m_string_commandlineparms.insert(paramname, value);
-}
-
-SYS_SingletonSystem::SYS_SingletonSystem()
-{
-}
diff --git a/source/kernel/gen_system/SYS_SingletonSystem.h b/source/kernel/gen_system/SYS_SingletonSystem.h
deleted file mode 100644
index d8628558618..00000000000
--- a/source/kernel/gen_system/SYS_SingletonSystem.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * 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.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- * Unique instance of system class for system specific information / access
- * Used by SYS_System
- */
-
-/** \file kernel/gen_system/SYS_SingletonSystem.h
- * \ingroup gensys
- */
-
-#ifndef __SINGLETONSYSTEM_H
-#define __SINGLETONSYSTEM_H
-
-#include "GEN_Map.h"
-#include "STR_HashedString.h"
-
-class SYS_SingletonSystem
-{
-public:
- static SYS_SingletonSystem* Instance();
- static void Destruct();
-
- int SYS_GetCommandLineInt(const char* paramname,int defaultvalue);
- float SYS_GetCommandLineFloat(const char* paramname,float defaultvalue);
- const char* SYS_GetCommandLineString(const char* paramname,const char* defaultvalue);
-
- void SYS_WriteCommandLineInt(const char* paramname,int value);
- void SYS_WriteCommandLineFloat(const char* paramname,float value);
- void SYS_WriteCommandLineString(const char* paramname,const char* value);
-
- SYS_SingletonSystem();
-
-private:
- static SYS_SingletonSystem* _instance;
- GEN_Map<STR_HashedString,int> m_int_commandlineparms;
- GEN_Map<STR_HashedString,float> m_float_commandlineparms;
- GEN_Map<STR_HashedString,STR_String> m_string_commandlineparms;
-};
-
-#endif //__SINGLETONSYSTEM_H
-
diff --git a/source/kernel/gen_system/SYS_System.cpp b/source/kernel/gen_system/SYS_System.cpp
deleted file mode 100644
index b2de797fc8d..00000000000
--- a/source/kernel/gen_system/SYS_System.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * 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.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- * System specific information / access.
- * Interface to the commandline arguments
- */
-
-/** \file kernel/gen_system/SYS_System.cpp
- * \ingroup gensys
- */
-
-#include "SYS_System.h"
-#include "SYS_SingletonSystem.h"
-
-SYS_SystemHandle SYS_GetSystem()
-{
- return (SYS_SystemHandle) SYS_SingletonSystem::Instance();
-}
-
-void SYS_DeleteSystem(SYS_SystemHandle sys)
-{
- if (sys) {
- ((SYS_SingletonSystem *) sys)->Destruct();
- }
-}
-
-int SYS_GetCommandLineInt(SYS_SystemHandle sys, const char *paramname, int defaultvalue)
-{
- return ((SYS_SingletonSystem *) sys)->SYS_GetCommandLineInt(paramname, defaultvalue);
-}
-
-float SYS_GetCommandLineFloat(SYS_SystemHandle sys, const char *paramname, float defaultvalue)
-{
- return ((SYS_SingletonSystem *) sys)->SYS_GetCommandLineFloat(paramname, defaultvalue);
-}
-
-const char *SYS_GetCommandLineString(SYS_SystemHandle sys, const char *paramname, const char *defaultvalue)
-{
- return ((SYS_SingletonSystem *) sys)->SYS_GetCommandLineString(paramname, defaultvalue);
-}
-
-void SYS_WriteCommandLineInt(SYS_SystemHandle sys, const char *paramname, int value)
-{
- ((SYS_SingletonSystem *) sys)->SYS_WriteCommandLineInt(paramname, value);
-}
-
-void SYS_WriteCommandLineFloat(SYS_SystemHandle sys, const char *paramname, float value)
-{
- ((SYS_SingletonSystem *) sys)->SYS_WriteCommandLineFloat(paramname, value);
-}
-
-void SYS_WriteCommandLineString(SYS_SystemHandle sys, const char *paramname, const char *value)
-{
- ((SYS_SingletonSystem *) sys)->SYS_WriteCommandLineString(paramname, value);
-}
diff --git a/source/kernel/gen_system/SYS_System.h b/source/kernel/gen_system/SYS_System.h
deleted file mode 100644
index 34fed4a81a2..00000000000
--- a/source/kernel/gen_system/SYS_System.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * 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.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- * System specific information / access.
- * Interface to the commandline arguments
- */
-
-/** \file kernel/gen_system/SYS_System.h
- * \ingroup gensys
- */
-
-
-#ifndef __SYSTEM_INCLUDE
-#define __SYSTEM_INCLUDE
-
-#define SYS_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name
-
-SYS_DECLARE_HANDLE(SYS_SystemHandle);
-
-/**
- System specific information / access.
- For now, only used for commandline parameters.
- One of the available implementations must be linked to the application
- that uses this system routines.
- Please note that this protocol/interface is just for testing,
- it needs discussion in the development group for a more final version.
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern SYS_SystemHandle SYS_GetSystem(void);
-extern void SYS_DeleteSystem(SYS_SystemHandle sys);
-
-extern int SYS_GetCommandLineInt(SYS_SystemHandle sys, const char *paramname, int defaultvalue);
-extern float SYS_GetCommandLineFloat(SYS_SystemHandle sys, const char *paramname, float defaultvalue);
-extern const char *SYS_GetCommandLineString(SYS_SystemHandle sys, const char *paramname, const char *defaultvalue);
-
-extern void SYS_WriteCommandLineInt(SYS_SystemHandle sys, const char *paramname, int value);
-extern void SYS_WriteCommandLineFloat(SYS_SystemHandle sys, const char *paramname, float value);
-extern void SYS_WriteCommandLineString(SYS_SystemHandle sys, const char *paramname, const char *value);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__SYSTEM_INCLUDE
-