Commit Graph

153 Commits

Author SHA1 Message Date
Ingo Weinhold
4f7d12cf6a Made C++ save.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15854 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-01-07 03:14:02 +00:00
Ingo Weinhold
9897917b9c Added (more Be-ish) Add() methods.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15682 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-27 21:08:02 +00:00
Ingo Weinhold
758b1d0e05 Fixes that make Haiku build with gcc 4. Mainly out of the following
categories:
* Missing includes (like <stdlib.h> and <string.h>).
* Linking against $(TARGET_LIBSTDC++) instead of libstdc++.r4.so.
* Local variables shadowing parameters.
* Default parameters in function definitions (as opposed to function
  declarations).
* All C++ stuff (nothrow, map, set, vector, min, max,...) must be imported
  explicitly from the std:: namespace now.
* "new (sometype)[...]" must read "new sometype[...]", even if sometype is
  something like "const char *".
* __FUNCTION__ is no longer a string literal (but a string expression), i.e.
  'printf(__FUNCTION__ ": ...\n")' is invalid code.
* A type cast results in a non-lvalue. E.g. "(char *)buffer += bytes"
  is an invalid expression.
* "friend class SomeClass" only works when SomeClass is known before.
  Otherwise the an inner class with that name is considered as friend.
  gcc 4 is much pickier about scopes.
* gcc 4 is generally stricter with respect to type conversions in C.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14878 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-12 23:27:14 +00:00
Axel Dörfler
3ea780cdf9 If booted from an image, the list of possible boot partitions is now ordered by
some heuristic: when you booted from a CD, CDs are preferred; else, volumes with
names like "Haiku" or "System" are preferred - if someone has better ideas, please
shout.
Note, this heuristic will only come into play if the boot loader was loaded from
an image (ie. floppy/CD/network), and you didn't choose any boot device.
Added evil methods to the Stack class that come in handy (you can now directly
access the array) for this.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14410 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-18 18:45:55 +00:00
Axel Dörfler
3e15f83d9e Added a BenaphoreLocker.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12380 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-13 22:40:48 +00:00
Axel Dörfler
ef2b38e7a9 Added a simple ring buffer implementation to be used by the mouse
and keyboard drivers, as well as pipefs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12357 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-04-13 12:57:42 +00:00
Ingo Weinhold
8af41139d5 Added default constructor. Useful in combination with SetTo().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11924 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-20 21:59:51 +00:00
Axel Dörfler
52fe8bf7a8 Minor header cleanup: moved some headers to better matching directories,
removed unused headers. Adapted sources to still compile with the new
header locations.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11913 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-19 01:58:05 +00:00
Ingo Weinhold
f42f300bd5 Work around a gcc bug: A private typedef in a base class can class with an equal identifier in a derived class.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11192 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-02-02 02:31:06 +00:00
Ingo Weinhold
50d68edcf4 It's fun to rename functions in templatized code. You only realize, that you missed some, when that specific part is instantiated.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11190 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-02-02 02:12:35 +00:00
Ingo Weinhold
2cfdb0ed38 * Added DoublyLinkedListMemberGetLink class which directly accesses the
link member in the element class. Usually more comfortable for structs.
* Added Add() method as synonym for Insert().
* Made fGetLink member static to save memory in objects using it.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11188 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-02-02 01:48:43 +00:00
Ingo Weinhold
297ffaeb84 Appended the new DoublyLinkedList implementation to DoublyLinkedList.h. The old implementation will go, when all the places where it is used have been adjusted.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11185 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-02-02 01:14:47 +00:00
Ingo Weinhold
b6933d8acc Moved generic auto locking code out of
<disk_device_manager/KDiskDeviceUtils.h> into <util/AutoLock.h>.
Added instantiations for recursive locks (moved from vfs.cpp) and
mutexes.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11157 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-01-30 16:09:06 +00:00
Ingo Weinhold
4a24ce3652 An alternative doubly linked list implementation which is far more complete and usable.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11138 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-01-30 00:42:56 +00:00
Ingo Weinhold
ea69d9d35f Moved the kMessageHeaderMagic constant into the class. Made BMessage a friend of KMessage.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11059 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-01-26 02:10:42 +00:00
Ingo Weinhold
e81d2d2645 Added missing headers.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10982 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-01-23 19:43:32 +00:00
Ingo Weinhold
c3a3ddf246 Added KMessage, a data container pretty much like BMessage, but
append-only and hence has very compact storage and a comparatively small
footprint implementation. Can be used for kernel->userland messaging.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10958 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-01-22 19:19:36 +00:00
Axel Dörfler
6de263b12e This can be useful at other places as well (originally came from the
BFS implementation).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10819 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-01-18 02:31:56 +00:00
Ingo Weinhold
90072e721d Always define the symbols needed for basic C++ features. If we link against libgcc.a the symbols from there are simply overridden.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9778 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-03 17:33:17 +00:00
Ingo Weinhold
5de8542789 Since the kernel links against libgcc.a and we use some C++ features that cause functions of libgcc.a to be included that use a couple of formerly undefined symbols (stderr, fprintf, abort, debugger) those had to be added to kernel_cpp.cpp. We don't build the kernel utils as static library anymore, since libgcc.a is listed at the end of the link command line and trying to change that would be a bit ugly. For C++ in the boot loader nothing changes.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9554 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 22:07:00 +00:00
Axel Dörfler
85f6117e32 Moved the user_memcpy()/strlcpy()/memset() calls to KernelExport.h.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9104 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-29 10:29:00 +00:00
Axel Dörfler
9eed5c272c This fixes all "implicit typename" warnings when compiling with GCC 3.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8024 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-06-17 12:51:57 +00:00
Axel Dörfler
ede8809e4a This fixes several "implicit typename" warnings with GCC 3.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8023 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-06-17 12:37:40 +00:00
Axel Dörfler
960371b741 Replaced <new> with <util/kernel_cpp.h> - this is the kernel.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7913 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-06-11 21:00:10 +00:00
Axel Dörfler
56c7aeaee8 Fixed a typo, thanks to Jack Burton for pointing this out.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7060 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-03-23 15:37:48 +00:00
Axel Dörfler
ed3f63ae37 Added a call to move the contents of one list to another.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6957 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-03-12 21:34:20 +00:00
Axel Dörfler
3f7d503ff1 Fixed DoublyLinkedList::Iterator().
Switched back to a pointer to the list in the Iterator internally, so
that it can still be just copied without having to overload "=", etc.
This fixes the boot loader build, too (shame on me).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6941 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-03-10 00:49:52 +00:00
Axel Dörfler
03d14a728a kernel_cpp.h can now safely be included from C code, great, isn't it?
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6940 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-03-10 00:44:39 +00:00
Axel Dörfler
8e623d69b5 Made it a bit nicer to use.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6866 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-03-03 00:50:01 +00:00
Axel Dörfler
0fc073341c Renamed CHECK_USER_ADDRESS to IS_USER_ADDRESS.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6675 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-02-23 02:18:32 +00:00
Tyler Dauwalder
581cfaf2c0 - Added declaration and definition of std::nothrow
- Wrapped everything but #includes in #if _KERNEL_MODE to keep from
  redeclaring/definining operator new and nothrow in userland.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5921 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-01-06 00:27:34 +00:00
Axel Dörfler
da69f27233 The iterator was broken.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5006 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-10-13 03:19:21 +00:00
Axel Dörfler
8174112d40 Almost straight copy of the list.h doubly linked list implementation to
a C++ one ready for kernel use, but very basic, too.
Has not been tested yet, expect some bug fixes soon.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5001 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-10-13 01:57:05 +00:00
Axel Dörfler
d172714dbd Lazy man's GCC 3 adaption.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4996 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-10-12 00:48:49 +00:00
Ingo Weinhold
eae4df8320 Fixed the usage of CHECK_USER_ADDRESS(). R5 has the inverse memory layout, so we need to adjust the KERNEL_BASE macro when compiling for it.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4853 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-09-29 18:50:02 +00:00
Ingo Weinhold
e0e5d17627 Handy functions to copy from and to userland reference parameters.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4837 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-09-28 15:12:27 +00:00
Tyler Dauwalder
c72c47f361 Switched from <Strategy> to <Value, Strategy = Auto> template paramter format.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4603 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-09-09 06:25:31 +00:00
Axel Dörfler
405a3fb126 Moved list.h to the util/ subfolder. (It currently still is in the kernel
private headers directory to not break the build.)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4585 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-09-09 02:09:33 +00:00
Axel Dörfler
e731e11702 Added the nothrow variants of the new operator.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4549 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-09-08 02:33:37 +00:00
Axel Dörfler
ccc316dc1c Our <new> lets delete throw __nothing - kernel_cpp.h now reflects this,
although I might change this issue after having had a look at the PPC
compilation.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4471 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-09-03 14:57:55 +00:00
Ingo Weinhold
83744ac99d Added the ImplicitKey entry strategy, which allows the key to be calculated on the fly.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3802 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-07-02 03:17:43 +00:00
Ingo Weinhold
7e65f8eb29 Added a Vector based map implementation.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3793 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-07-01 20:37:17 +00:00
Ingo Weinhold
92ec26a3be Fixed documentation and a minor issue.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3792 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-07-01 20:36:11 +00:00
Ingo Weinhold
bd3ed7497a Apparently invoking non-static member functions for default arguments doesn't work. Removed the default argument for Find() and added respective additional versions. Some more minor changes.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3754 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-06-30 01:00:23 +00:00
Ingo Weinhold
4489db253c Added a Vector based set implementation.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3751 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-06-30 00:53:50 +00:00
Ingo Weinhold
eaf9864cde Added a generic Vector implementation.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3744 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-06-29 19:45:10 +00:00
Ingo Weinhold
c4de095cd1 Fixed invalid default argument. Not that the compiler eats the file now...
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3743 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-06-29 19:44:14 +00:00
Ingo Weinhold
42b47c7c30 Some small interface fixes.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3715 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-06-28 15:53:21 +00:00
Ingo Weinhold
e0f43e3e84 The beginning of an AVL tree based map implementation. Well, the tree part
is complete, the interface needs work.
Unfortunately our ancient compiler chokes on this (`Internal Compiler
Error'). I got around the problem by restructuring parts of the code once,
but now I'm stuck -- no idea what I could change. So, there won't be
AVLTree{Map,Set} until we have a working compiler. :-(


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3712 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-06-28 15:49:33 +00:00
Axel Dörfler
fb68886768 C++ for the kernel.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3701 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-06-27 22:58:58 +00:00
Tyler Dauwalder
d3a0e7c306 General object constructor class
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3623 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-06-23 05:56:09 +00:00
Tyler Dauwalder
ab608058b4 Allocator that uses malloc()/free()
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3622 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-06-23 05:55:31 +00:00
Tyler Dauwalder
e9ebb4a961 Beginnings of the kernel utils library.
Templated singly linked list class (not quite complete).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3621 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-06-23 05:54:53 +00:00