From axeld at mail.berlios.de Wed Aug 1 00:37:22 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 1 Aug 2007 00:37:22 +0200 Subject: [Haiku-commits] r21778 - haiku/trunk/build/jam Message-ID: <200707312237.l6VMbMm2006309@sheep.berlios.de> Author: axeld Date: 2007-08-01 00:37:21 +0200 (Wed, 01 Aug 2007) New Revision: 21778 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21778&view=rev Modified: haiku/trunk/build/jam/MiscRules Log: bonefish: Fixed bug #1346. The relative output directory for the root directory was computed as '.' which resulted in output path ending with '/.', causing mkdir to choke. Modified: haiku/trunk/build/jam/MiscRules =================================================================== --- haiku/trunk/build/jam/MiscRules 2007-07-31 21:50:28 UTC (rev 21777) +++ haiku/trunk/build/jam/MiscRules 2007-07-31 22:37:21 UTC (rev 21778) @@ -2,6 +2,9 @@ rule SetupObjectsDir { local relPath = [ FDirName $(SUBDIR_TOKENS[2-]) ] ; + if $(relPath) = . { + relPath = ; + } COMMON_PLATFORM_LOCATE_TARGET = [ FDirName $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) $(relPath) ] ; From darkwyrm at earthlink.net Wed Aug 1 00:54:17 2007 From: darkwyrm at earthlink.net (DarkWyrm) Date: Tue, 31 Jul 2007 18:54:17 -0400 EDT Subject: [Haiku-commits] =?windows-1252?q?r21760_-_in_haiku/trunk/src/add-?= =?windows-1252?q?ons/kernel/drivers/audio/ac97=3A_=2E_es1370?= In-Reply-To: <1e80d8750707311322v263778dej7fdf3b85b638ff0a@mail.gmail.com> Message-ID: <2356713435-BeMail@tourmalline> > I will test with QEMU! > > Maybe I can help in some way to add 1371 support - I enabled the > device_id to see what would happen and it obviously crashed pretty > badly ;) I see that the header has many of the constants already > defined - I assume you used the freebsd driver for inspiration? > > Maybe I can take a look at it myself a bit - but I'm really not very > good at C/C++ According to my conversatioin yesterday with J?r?me, it partly works in QEMU and not at all in VMWare because QEMU emulates a 1370 and VMWare a 1371. Over vacation last week I managed to stumble upon the specs for it. I'll see if I can dig them up and -- maybe -- even see if I can kick in a little help myself. --DW From geist at foobox.com Wed Aug 1 10:01:43 2007 From: geist at foobox.com (Travis Geiselbrecht) Date: Wed, 1 Aug 2007 01:01:43 -0700 Subject: [Haiku-commits] r21757 - haiku/trunk/src/add-ons/kernel/partitioning_systems/intel In-Reply-To: References: <200707301957.l6UJvpuE011879@sheep.berlios.de> Message-ID: <6D10F625-7526-4CAC-ADCA-29DEAA3BE17B@foobox.com> On Jul 31, 2007, at 4:25 AM, J?r?me Duval wrote: > 2007/7/31, Ingo Weinhold : >> I meant your change. Since the compiler should be clever enough to >> recognize that multiplying with 1 is a no-op, all that's left is the >> promotion to double (instead of the previous cast to float). > > The compiler must use the op multiply with float, which is different > from cast to float. > >> >>> Could we link >>> every kernel addon against libgcc.a ? >> >> We could. That will increase the size of the kernel modules, of >> course. >> > > Even if they link to libgcc after kernel.so ? That would be a very bad idea, since it would tie the addon to that precise version of the kernel. If it happened to get the symbol because that version of the kernel needed that particular routine, and then a later version didn't use it, it'd fail to load. The point of libgcc.a is it's a collection of routines that the compiler emits calls to for pieces of code it decides for whatever reason it shouldn't inline. It doesn't tend to get called too often on x86, since there's an instruction for everything, but you can definitely see it when doing a bunch of 64bit routines on a 32bit x86. On other architectures, however, you may see it more often, especially if the instruction set is simpler (any floating point ops on a arm7 with no fpu, for example). Since it contains a bunch of internal gcc routines, they are also by definition compiler version specific, so you should always link the libgcc that comes with the compiler actually emitting the code. Most of the time when on an existing platform compiling code for that platform it automatically links against libgcc for you. For example on OSX x86 the last stage of gcc -v foo.c -o foo /usr/libexec/gcc/i686-apple-darwin8/4.0.1/collect2 -dynamic -arch i386 -weak_reference_mismatches non-weak -o foo -lcrt1.o -L/usr/lib/ gcc/i686-apple-darwin8/4.0.1 -L/usr/lib/gcc/i686-apple-darwin8/4.0.1 - L/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../.. /var/tmp//ccuMEv4u.o - lgcc -lSystem on linux x86: /usr/libexec/gcc/i686-pc-linux-gnu/4.1.2/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o foo /usr/lib/gcc/i686- pc-linux-gnu/4.1.2/../../../crt1.o /usr/lib/gcc/i686-pc-linux-gnu/ 4.1.2/../../../crti.o /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/crtbegin.o -L/usr/lib/gcc/i686-pc-linux-gnu/4.1.2 -L/usr/lib/gcc/i686-pc-linux- gnu/4.1.2 -L/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../i686-pc- linux-gnu/lib -L/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/../../.. /tmp/ ccoZfFGI.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as- needed -lgcc_s --no-as-needed /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/ crtend.o /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../crtn.o both have a -lgcc, though linux has some sort of shared libgcc thing going on. Travis From korli at users.berlios.de Wed Aug 1 10:40:12 2007 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Wed, 1 Aug 2007 10:40:12 +0200 Subject: [Haiku-commits] r21757 - haiku/trunk/src/add-ons/kernel/partitioning_systems/intel In-Reply-To: <6D10F625-7526-4CAC-ADCA-29DEAA3BE17B@foobox.com> References: <200707301957.l6UJvpuE011879@sheep.berlios.de> <6D10F625-7526-4CAC-ADCA-29DEAA3BE17B@foobox.com> Message-ID: 2007/8/1, Travis Geiselbrecht : > > Even if they link to libgcc after kernel.so ? > > That would be a very bad idea, since it would tie the addon to that > precise version of the kernel. If it happened to get the symbol > because that version of the kernel needed that particular routine, > and then a later version didn't use it, it'd fail to load. Indeed. > > The point of libgcc.a is it's a collection of routines that the > compiler emits calls to for pieces of code it decides for whatever > reason it shouldn't inline. It doesn't tend to get called too often > on x86, since there's an instruction for everything, but you can > definitely see it when doing a bunch of 64bit routines on a 32bit > x86. On other architectures, however, you may see it more often, > especially if the instruction set is simpler (any floating point ops > on a arm7 with no fpu, for example). Thanks for explaining. > > Since it contains a bunch of internal gcc routines, they are also by > definition compiler version specific, so you should always link the > libgcc that comes with the compiler actually emitting the code. Most > of the time when on an existing platform compiling code for that > platform it automatically links against libgcc for you. The current KernelAddon rule defines linking against custom libs and kernel.so. You're suggesting to define linking against libgcc.a, custom libs and kernel.so ? Bye, J?r?me From korli at users.berlios.de Wed Aug 1 11:08:26 2007 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Wed, 1 Aug 2007 11:08:26 +0200 Subject: [Haiku-commits] r21760 - in haiku/trunk/src/add-ons/kernel/drivers/audio/ac97: . es1370 In-Reply-To: <2356713435-BeMail@tourmalline> References: <1e80d8750707311322v263778dej7fdf3b85b638ff0a@mail.gmail.com> <2356713435-BeMail@tourmalline> Message-ID: 2007/8/1, DarkWyrm : > According to my conversatioin yesterday with J?r?me, it partly works in > QEMU and not at all in VMWare because QEMU emulates a 1370 and VMWare a > 1371. Over vacation last week I managed to stumble upon the specs for > it. I'll see if I can dig them up and -- maybe -- even see if I can > kick in a little help myself. > Thanks for digging up. If you don't come to me before, I'll try to make it support 1371, when I have time. Bye, J?r?me From bonefish at cs.tu-berlin.de Wed Aug 1 14:02:45 2007 From: bonefish at cs.tu-berlin.de (Ingo Weinhold) Date: Wed, 1 Aug 2007 14:02:45 +0200 (MEST) Subject: [Haiku-commits] r21757 - haiku/trunk/src/add-ons/kernel/partitioning_systems/intel In-Reply-To: References: <200707301957.l6UJvpuE011879@sheep.berlios.de> <6D10F625-7526-4CAC-ADCA-29DEAA3BE17B@foobox.com> Message-ID: On Wed, 1 Aug 2007, J?r?me Duval wrote: > 2007/8/1, Travis Geiselbrecht : >> >> Since it contains a bunch of internal gcc routines, they are also by >> definition compiler version specific, so you should always link the >> libgcc that comes with the compiler actually emitting the code. Most >> of the time when on an existing platform compiling code for that >> platform it automatically links against libgcc for you. > > The current KernelAddon rule defines linking against custom libs and kernel.so. > You're suggesting to define linking against libgcc.a, custom libs and > kernel.so ? I would add $(HAIKU_GCC_LIBGCC) to HAIKU_KERNEL_ADDON_END_GLUE_CODE (before crtend.o). I would have done this already, but I only have my not so amazingly fast laptop at hand and testing the change would at least require a full build. If you feel like doing that, please go ahead. There are probably a few kernel add-ons, that do already link manually against libgcc. Those should, of course, no longer do that (they can be tracked down easily by adding output to the KernelAddon rule). CU, Ingo From axeld at mail.berlios.de Wed Aug 1 16:28:50 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 1 Aug 2007 16:28:50 +0200 Subject: [Haiku-commits] r21779 - haiku/trunk/headers/private/kernel/util Message-ID: <200708011428.l71ESok7022302@sheep.berlios.de> Author: axeld Date: 2007-08-01 16:28:50 +0200 (Wed, 01 Aug 2007) New Revision: 21779 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21779&view=rev Modified: haiku/trunk/headers/private/kernel/util/DoublyLinkedList.h Log: * Added the default constructor to the Iterator class. * Added a Current() method to the same class that returns the current element again. Modified: haiku/trunk/headers/private/kernel/util/DoublyLinkedList.h =================================================================== --- haiku/trunk/headers/private/kernel/util/DoublyLinkedList.h 2007-07-31 22:37:21 UTC (rev 21778) +++ haiku/trunk/headers/private/kernel/util/DoublyLinkedList.h 2007-08-01 14:28:50 UTC (rev 21779) @@ -123,6 +123,10 @@ Rewind(); } + Iterator() + { + } + Iterator(const Iterator &other) { *this = other; @@ -141,6 +145,11 @@ return fCurrent; } + Element *Current() + { + return fCurrent; + } + Element *Remove() { Element *element = fCurrent; From axeld at mail.berlios.de Wed Aug 1 16:48:50 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 1 Aug 2007 16:48:50 +0200 Subject: [Haiku-commits] r21780 - in haiku/trunk: headers/os/drivers headers/private/kernel headers/private/kernel/fs src/kits/storage src/system/kernel src/system/kernel/fs Message-ID: <200708011448.l71EmoKJ024236@sheep.berlios.de> Author: axeld Date: 2007-08-01 16:48:44 +0200 (Wed, 01 Aug 2007) New Revision: 21780 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21780&view=rev Removed: haiku/trunk/headers/os/drivers/node_monitor.h Modified: haiku/trunk/headers/private/kernel/Notifications.h haiku/trunk/headers/private/kernel/fs/node_monitor.h haiku/trunk/headers/private/kernel/syscalls.h haiku/trunk/src/kits/storage/NodeMonitor.cpp haiku/trunk/src/system/kernel/Notifications.cpp haiku/trunk/src/system/kernel/fs/Jamfile haiku/trunk/src/system/kernel/fs/node_monitor.cpp Log: bonefish+axeld: * Simplified the notification framework: removed the updater stuff completely; it was only there to account for some peculiarities of the node monitor which we now solved differently. * NotificationListener no longer includes a doubly linked list link for convenience; it might want to listen to more than just one service. * NotificationService cannot have an abstract destructor. * Changed the _user_stop_watching() syscall to mirror the Be API; ie. it's no longer possible to just remove some flags separately, just to stop listening completely. * Adapted the node monitor implementation to live in the NodeMonitorService class that uses the new notification framework. * Removed the public kernel node monitor API - it wasn't useful that way since you couldn't do a lot with the KMessage in the kernel without using a private API. Now you will have to use the (private) notification manager to use the node monitor from inside the kernel. At a later point, we might introduce a public API for that, too. Deleted: haiku/trunk/headers/os/drivers/node_monitor.h Modified: haiku/trunk/headers/private/kernel/Notifications.h =================================================================== --- haiku/trunk/headers/private/kernel/Notifications.h 2007-08-01 14:28:50 UTC (rev 21779) +++ haiku/trunk/headers/private/kernel/Notifications.h 2007-08-01 14:48:44 UTC (rev 21780) @@ -22,21 +22,24 @@ #include #include -#include #include #include class NotificationService; -class NotificationListener - : public DoublyLinkedListLinkImpl { +class NotificationListener { public: virtual ~NotificationListener(); virtual void EventOccured(NotificationService& service, const KMessage* event); - virtual void AllListenersNotified(); + virtual void AllListenersNotified(NotificationService& service); + + virtual bool operator==(const NotificationListener& other) const; + + bool operator!=(const NotificationListener& other) const + { return !(*this == other); } }; class UserMessagingMessageSender { @@ -64,10 +67,10 @@ virtual void EventOccured(NotificationService& service, const KMessage* event); - virtual void AllListenersNotified(); + virtual void AllListenersNotified(NotificationService& service); - port_id Port() { return fPort; } - int32 Token() { return fToken; } + port_id Port() const { return fPort; } + int32 Token() const { return fToken; } private: UserMessagingMessageSender& fSender; @@ -75,55 +78,16 @@ int32 fToken; }; -class NotificationListenerUpdater { - public: - enum update_action { - UPDATED, - SKIP, - DELETE, - REMOVE - }; - - NotificationListenerUpdater(const KMessage* eventSpecifier); - virtual ~NotificationListenerUpdater(); - - virtual status_t UpdateListener(NotificationListener& listener, - enum update_action& action); - - virtual status_t CreateListener(NotificationListener** _listener); - - virtual void SetEventSpecifier(const KMessage* eventSpecifier); - const KMessage* EventSpecifier() const { return fEventSpecifier; } - - protected: - const KMessage* fEventSpecifier; -}; - -class UserMessagingListenerUpdater : public NotificationListenerUpdater { - public: - UserMessagingListenerUpdater(const KMessage* eventSpecifier, port_id port, - int32 token); - - virtual status_t UpdateListener(NotificationListener& listener, - enum update_action& action); - - protected: - virtual status_t UpdateListener(UserMessagingListener& listener, - enum update_action& action) = 0; - - port_id fPort; - int32 fToken; -}; - class NotificationService : public Referenceable { public: - virtual ~NotificationService() = 0; + virtual ~NotificationService(); virtual status_t AddListener(const KMessage* eventSpecifier, NotificationListener& listener) = 0; virtual status_t RemoveListener(const KMessage* eventSpecifier, NotificationListener& listener) = 0; - virtual status_t UpdateListener(NotificationListenerUpdater& updater) = 0; + virtual status_t UpdateListener(const KMessage* eventSpecifier, + NotificationListener& listener) = 0; virtual const char* Name() = 0; HashTableLink& Link() { return fLink; } @@ -148,14 +112,14 @@ status_t AddListener(const char* service, const KMessage* eventSpecifier, NotificationListener& listener); - status_t RemoveListener(const char* service, uint32 eventMask, - NotificationListener& listener); + status_t UpdateListener(const char* service, + uint32 eventMask, NotificationListener& listener); + status_t UpdateListener(const char* service, + const KMessage* eventSpecifier, NotificationListener& listener); + status_t RemoveListener(const char* service, const KMessage* eventSpecifier, NotificationListener& listener); - status_t UpdateListener(const char* service, - NotificationListenerUpdater& updater); - private: NotificationManager(); ~NotificationManager(); Modified: haiku/trunk/headers/private/kernel/fs/node_monitor.h =================================================================== --- haiku/trunk/headers/private/kernel/fs/node_monitor.h 2007-08-01 14:28:50 UTC (rev 21779) +++ haiku/trunk/headers/private/kernel/fs/node_monitor.h 2007-08-01 14:48:44 UTC (rev 21780) @@ -26,8 +26,8 @@ extern status_t _user_stop_notifying(port_id port, uint32 token); extern status_t _user_start_watching(dev_t device, ino_t node, uint32 flags, port_id port, uint32 token); -extern status_t _user_stop_watching(dev_t device, ino_t node, uint32 flags, - port_id port, uint32 token); +extern status_t _user_stop_watching(dev_t device, ino_t node, port_id port, + uint32 token); #ifdef __cplusplus } Modified: haiku/trunk/headers/private/kernel/syscalls.h =================================================================== --- haiku/trunk/headers/private/kernel/syscalls.h 2007-08-01 14:28:50 UTC (rev 21779) +++ haiku/trunk/headers/private/kernel/syscalls.h 2007-08-01 14:48:44 UTC (rev 21780) @@ -201,8 +201,8 @@ extern status_t _kern_stop_notifying(port_id port, uint32 token); extern status_t _kern_start_watching(dev_t device, ino_t node, uint32 flags, port_id port, uint32 token); -extern status_t _kern_stop_watching(dev_t device, ino_t node, uint32 flags, - port_id port, uint32 token); +extern status_t _kern_stop_watching(dev_t device, ino_t node, port_id port, + uint32 token); // time functions extern status_t _kern_set_real_time_clock(uint32 time); Modified: haiku/trunk/src/kits/storage/NodeMonitor.cpp =================================================================== --- haiku/trunk/src/kits/storage/NodeMonitor.cpp 2007-08-01 14:28:50 UTC (rev 21779) +++ haiku/trunk/src/kits/storage/NodeMonitor.cpp 2007-08-01 14:48:44 UTC (rev 21780) @@ -56,7 +56,7 @@ if (node == NULL) return B_BAD_VALUE; - return _kern_stop_watching(node->device, node->node, flags, port, token); + return _kern_stop_watching(node->device, node->node, port, token); } // subscribe to... Modified: haiku/trunk/src/system/kernel/Notifications.cpp =================================================================== --- haiku/trunk/src/system/kernel/Notifications.cpp 2007-08-01 14:28:50 UTC (rev 21779) +++ haiku/trunk/src/system/kernel/Notifications.cpp 2007-08-01 14:48:44 UTC (rev 21780) @@ -30,11 +30,18 @@ void -NotificationListener::AllListenersNotified() +NotificationListener::AllListenersNotified(NotificationService& service) { } +bool +NotificationListener::operator==(const NotificationListener& other) const +{ + return &other == this; +} + + // #pragma mark - UserMessagingMessageSender @@ -102,86 +109,18 @@ void -UserMessagingListener::AllListenersNotified() +UserMessagingListener::AllListenersNotified(NotificationService& service) { fSender.FlushMessage(); } -// #pragma mark - NotificationListenerUpdater +// #pragma mark - NotificationService -NotificationListenerUpdater::NotificationListenerUpdater( - const KMessage* eventSpecifier) - : fEventSpecifier(eventSpecifier) -{ -} - - -NotificationListenerUpdater::~NotificationListenerUpdater() -{ -} - - -status_t -NotificationListenerUpdater::UpdateListener(NotificationListener& listener, - enum update_action& action) -{ - action = SKIP; - return B_OK; -} - - -status_t -NotificationListenerUpdater::CreateListener(NotificationListener** _listener) -{ - return B_ERROR; -} - - -void -NotificationListenerUpdater::SetEventSpecifier(const KMessage* eventSpecifier) -{ - fEventSpecifier = eventSpecifier; -} - - -// #pragma mark - NotificationListenerUpdater - - -UserMessagingListenerUpdater::UserMessagingListenerUpdater( - const KMessage* eventSpecifier, port_id port, int32 token) - : - NotificationListenerUpdater(eventSpecifier), - fPort(port), - fToken(token) -{ -} - - -status_t -UserMessagingListenerUpdater::UpdateListener(NotificationListener& _listener, - enum update_action& action) -{ - UserMessagingListener* listener - = dynamic_cast(&_listener); - if (listener != NULL && listener->Port() == fPort - && listener->Token() == fToken) { - return UpdateListener(*listener, action); - } - - action = SKIP; - return B_OK; -} - - -// #pragma mark - NotificationManager - -#if 0 NotificationService::~NotificationService() { } -#endif // #pragma mark - NotificationManager @@ -285,20 +224,20 @@ status_t -NotificationManager::RemoveListener(const char* serviceName, uint32 eventMask, - NotificationListener& listener) +NotificationManager::UpdateListener(const char* serviceName, + uint32 eventMask, NotificationListener& listener) { char buffer[96]; KMessage specifier; specifier.SetTo(buffer, sizeof(buffer), 0); specifier.AddInt32("event mask", eventMask); - return RemoveListener(serviceName, &specifier, listener); + return UpdateListener(serviceName, &specifier, listener); } status_t -NotificationManager::RemoveListener(const char* serviceName, +NotificationManager::UpdateListener(const char* serviceName, const KMessage* eventSpecifier, NotificationListener& listener) { MutexLocker locker(fLock); @@ -309,13 +248,13 @@ Reference reference(service); locker.Unlock(); - return service->RemoveListener(eventSpecifier, listener); + return service->UpdateListener(eventSpecifier, listener); } status_t -NotificationManager::UpdateListener(const char* serviceName, - NotificationListenerUpdater& updater) +NotificationManager::RemoveListener(const char* serviceName, + const KMessage* eventSpecifier, NotificationListener& listener) { MutexLocker locker(fLock); NotificationService* service = _ServiceFor(serviceName); @@ -325,7 +264,7 @@ Reference reference(service); locker.Unlock(); - return service->UpdateListener(updater); + return service->RemoveListener(eventSpecifier, listener); } Modified: haiku/trunk/src/system/kernel/fs/Jamfile =================================================================== --- haiku/trunk/src/system/kernel/fs/Jamfile 2007-08-01 14:28:50 UTC (rev 21779) +++ haiku/trunk/src/system/kernel/fs/Jamfile 2007-08-01 14:48:44 UTC (rev 21780) @@ -3,7 +3,7 @@ UsePrivateHeaders [ FDirName kernel disk_device_manager ] ; UsePrivateHeaders [ FDirName kernel fs ] ; UsePrivateHeaders [ FDirName kernel util ] ; -UsePrivateHeaders storage ; +UsePrivateHeaders shared storage ; KernelMergeObject kernel_fs.o : devfs.cpp Modified: haiku/trunk/src/system/kernel/fs/node_monitor.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/node_monitor.cpp 2007-08-01 14:28:50 UTC (rev 21779) +++ haiku/trunk/src/system/kernel/fs/node_monitor.cpp 2007-08-01 14:48:44 UTC (rev 21780) @@ -4,23 +4,26 @@ */ -#include -#include +#include -#include -#include +#include +#include + +#include +#include + #include +#include #include -#include #include +#include +#include #include +#include #include #include -#include -#include - //#define TRACE_MONITOR #ifdef TRACE_MONITOR # define TRACE(x) dprintf x @@ -31,7 +34,6 @@ // ToDo: add more fine grained locking - maybe using a ref_count in the // node_monitor structure? -// ToDo: implement watching mounts/unmounts // ToDo: return another error code than B_NO_MEMORY if the team's maximum is hit @@ -39,333 +41,428 @@ typedef struct node_monitor node_monitor; struct monitor_listener { - monitor_listener *next; - monitor_listener *prev; - list_link monitor_link; - port_id port; - uint32 token; + list_link context_link; + DoublyLinkedListLink monitor_link; + NotificationListener *listener; uint32 flags; node_monitor *monitor; }; +typedef DoublyLinkedList > MonitorListenerList; + struct node_monitor { - node_monitor *next; + HashTableLink link; dev_t device; ino_t node; - struct list listeners; + MonitorListenerList listeners; }; -struct monitor_hash_key { - dev_t device; - ino_t node; -}; - struct interested_monitor_listener_list { - struct list *listeners; - monitor_listener *first_listener; + MonitorListenerList::Iterator iterator; uint32 flags; }; -#define MONITORS_HASH_TABLE_SIZE 16 +static UserMessagingMessageSender sNodeMonitorSender; -static hash_table *gMonitorHash; -static mutex gMonitorMutex; +class UserNodeListener : public UserMessagingListener { + public: + UserNodeListener(port_id port, int32 token) + : UserMessagingListener(sNodeMonitorSender, port, token) + { + } + bool operator==(const NotificationListener& _other) const + { + const UserNodeListener* other + = dynamic_cast(&_other); + return other != NULL && other->Port() == Port() + && other->Token() == Token(); + } +}; -static int -monitor_compare(void *_monitor, const void *_key) -{ - node_monitor *monitor = (node_monitor*)_monitor; - const struct monitor_hash_key *key = (const struct monitor_hash_key*)_key; +class NodeMonitorService : public NotificationService { + public: + NodeMonitorService(); + virtual ~NodeMonitorService(); - if (monitor->device == key->device && monitor->node == key->node) - return 0; + status_t InitCheck(); - return -1; -} + status_t NotifyEntryCreatedOrRemoved(int32 opcode, dev_t device, + ino_t directory, const char *name, ino_t node); + status_t NotifyEntryMoved(dev_t device, ino_t fromDirectory, + const char *fromName, ino_t toDirectory, const char *toName, + ino_t node); + status_t NotifyStatChanged(dev_t device, ino_t node, uint32 statFields); + status_t NotifyAttributeChanged(dev_t device, ino_t node, + const char *attribute, int32 cause); + status_t NotifyUnmount(dev_t device); + status_t NotifyMount(dev_t device, dev_t parentDevice, + ino_t parentDirectory); + status_t RemoveListeners(io_context *context); -static uint32 -monitor_hash(void *_monitor, const void *_key, uint32 range) -{ - node_monitor *monitor = (node_monitor*)_monitor; - const struct monitor_hash_key *key = (const struct monitor_hash_key*)_key; + status_t AddListener(const KMessage *eventSpecifier, + NotificationListener &listener); + status_t UpdateListener(const KMessage *eventSpecifier, + NotificationListener &listener); + status_t RemoveListener(const KMessage *eventSpecifier, + NotificationListener &listener); -#define MHASH(device, node) (((uint32)((node) >> 32) + (uint32)(node)) ^ (uint32)(device)) + status_t RemoveListener(io_context *context, dev_t device, ino_t node, + NotificationListener ¬ificationListener); - if (monitor != NULL) - return MHASH(monitor->device, monitor->node) % range; + status_t RemoveUserListeners(struct io_context *context, + port_id port, uint32 token); + status_t UpdateUserListener(io_context *context, dev_t device, + ino_t node, uint32 flags, UserNodeListener &userListener); - return MHASH(key->device, key->node) % range; -#undef MHASH -} + virtual const char* Name() { return "node monitor"; } + private: + void _RemoveMonitor(node_monitor *monitor); + void _RemoveListener(monitor_listener *listener); + node_monitor *_MonitorFor(dev_t device, ino_t node); + status_t _GetMonitor(io_context *context, dev_t device, ino_t node, + bool addIfNecessary, node_monitor **_monitor); + monitor_listener *_MonitorListenerFor(node_monitor* monitor, + NotificationListener& notificationListener); + status_t _AddMonitorListener(io_context *context, + node_monitor* monitor, uint32 flags, + NotificationListener& notificationListener); + status_t _AddListener(io_context *context, dev_t device, ino_t node, + uint32 flags, NotificationListener ¬ificationListener); + status_t _UpdateListener(io_context *context, dev_t device, ino_t node, + uint32 flags, bool addFlags, + NotificationListener ¬ificationListener); + void _GetInterestedMonitorListeners(dev_t device, ino_t node, + uint32 flags, interested_monitor_listener_list *interestedListeners, + int32 &interestedListenerCount); + status_t _SendNotificationMessage(KMessage &message, + interested_monitor_listener_list *interestedListeners, + int32 interestedListenerCount); -/** Returns the monitor that matches the specified device/node pair. - * Must be called with monitors lock hold. - */ + struct monitor_hash_key { + dev_t device; + ino_t node; + }; -static node_monitor * -get_monitor_for(dev_t device, ino_t node) + struct HashDefinition { + typedef monitor_hash_key* KeyType; + typedef node_monitor ValueType; + + size_t HashKey(monitor_hash_key* key) const + { return _Hash(key->device, key->node); } + size_t Hash(node_monitor *monitor) const + { return _Hash(monitor->device, monitor->node); } + + bool Compare(monitor_hash_key* key, node_monitor *monitor) const + { + return key->device == monitor->device + && key->node == monitor->node; + } + + HashTableLink* GetLink( + node_monitor* monitor) const + { return &monitor->link; } + + uint32 _Hash(dev_t device, ino_t node) const + { + return ((uint32)(node >> 32) + (uint32)node) ^ (uint32)device; + } + }; + + typedef OpenHashTable MonitorHash; + MonitorHash fMonitors; + mutex fMutex; +}; + +static NodeMonitorService sNodeMonitorService; + + +/*! \brief Notifies the listener of a live query that an entry has been added + to or removed from the query (for whatever reason). + \param opcode \c B_ENTRY_CREATED or \c B_ENTRY_REMOVED. + \param port The target port of the listener. + \param token The BHandler token of the listener. + \param device The ID of the mounted FS, the entry lives in. + \param directory The entry's parent directory ID. + \param name The entry's name. + \param node The ID of the node the entry refers to. + \return + - \c B_OK, if everything went fine, + - another error code otherwise. +*/ +static status_t +notify_query_entry_created_or_removed(int32 opcode, port_id port, int32 token, + dev_t device, ino_t directory, const char *name, ino_t node) { - struct monitor_hash_key key; - key.device = device; - key.node = node; + if (!name) + return B_BAD_VALUE; - return (node_monitor *)hash_lookup(gMonitorHash, &key); + // construct the message + char messageBuffer[1024]; + KMessage message; + message.SetTo(messageBuffer, sizeof(messageBuffer), B_QUERY_UPDATE); + message.AddInt32("opcode", opcode); + message.AddInt32("device", device); + message.AddInt64("directory", directory); + message.AddInt64("node", node); + message.AddString("name", name); + + // send the message + messaging_target target; + target.port = port; + target.token = token; + + return send_message(&message, &target, 1); } -/** Returns the listener that matches the specified port/token pair. - * Must be called with monitors lock hold. - */ +// #pragma mark - NodeMonitorService -static monitor_listener * -get_listener_for(node_monitor *monitor, port_id port, uint32 token) + +NodeMonitorService::NodeMonitorService() { - monitor_listener *listener = NULL; - - while ((listener = (monitor_listener*)list_get_next_item( - &monitor->listeners, listener)) != NULL) { - // does this listener match? - if (listener->port == port && listener->token == token) - return listener; - } + mutex_init(&fMutex, "node monitor"); +} - return NULL; + +NodeMonitorService::~NodeMonitorService() +{ } -/** Removes the specified node_monitor from the hashtable - * and free it. - * Must be called with monitors lock hold. - */ +status_t +NodeMonitorService::InitCheck() +{ + return fMutex.sem >= B_OK ? B_OK : fMutex.sem; +} -static void -remove_monitor(node_monitor *monitor) + +/*! Removes the specified node_monitor from the hashtable + and free it. + Must be called with monitors lock hold. +*/ +void +NodeMonitorService::_RemoveMonitor(node_monitor *monitor) { - hash_remove(gMonitorHash, monitor); - free(monitor); + fMonitors.Remove(monitor); + delete monitor; } -/** Removes the specified monitor_listener from all lists - * and free it. - * Must be called with monitors lock hold. - */ - -static void -remove_listener(monitor_listener *listener) +/*! Removes the specified monitor_listener from all lists + and free it. + Must be called with monitors lock hold. +*/ +void +NodeMonitorService::_RemoveListener(monitor_listener *listener) { node_monitor *monitor = listener->monitor; // remove it from the listener and I/O context lists - list_remove_link(&listener->monitor_link); + monitor->listeners.Remove(listener); list_remove_link(listener); - free(listener); + delete listener; - if (list_is_empty(&monitor->listeners)) - remove_monitor(monitor); + if (monitor->listeners.IsEmpty()) + _RemoveMonitor(monitor); } -static status_t -add_node_monitor(io_context *context, dev_t device, ino_t node, - uint32 flags, port_id port, uint32 token) +/*! Returns the monitor that matches the specified device/node pair. + Must be called with monitors lock hold. +*/ +node_monitor * +NodeMonitorService::_MonitorFor(dev_t device, ino_t node) { - monitor_listener *listener; - node_monitor *monitor; - status_t status = B_OK; + struct monitor_hash_key key; + key.device = device; + key.node = node; - TRACE(("add_node_monitor(dev = %ld, node = %Ld, flags = %ld, port = %ld, token = %ld\n", - device, node, flags, port, token)); + return fMonitors.Lookup(&key); +} - mutex_lock(&gMonitorMutex); - monitor = get_monitor_for(device, node); - if (monitor == NULL) { - // check if this team is allowed to have more listeners - if (context->num_monitors >= context->max_monitors) { - // the BeBook says to return B_NO_MEMORY in this case, but - // we should have another one. - status = B_NO_MEMORY; - goto out; - } +/*! Returns the monitor that matches the specified device/node pair. + If the monitor does not exist yet, it will be created. + Must be called with monitors lock hold. +*/ +status_t +NodeMonitorService::_GetMonitor(io_context *context, dev_t device, ino_t node, + bool addIfNecessary, node_monitor** _monitor) +{ + node_monitor* monitor = _MonitorFor(device, node); + if (monitor != NULL) { + *_monitor = monitor; + return B_OK; + } + if (!addIfNecessary) + return B_BAD_VALUE; - // create new monitor - monitor = (node_monitor *)malloc(sizeof(node_monitor)); - if (monitor == NULL) { - status = B_NO_MEMORY; - goto out; - } + // check if this team is allowed to have more listeners + if (context->num_monitors >= context->max_monitors) { + // the BeBook says to return B_NO_MEMORY in this case, but + // we should have another one. + return B_NO_MEMORY; + } - // initialize monitor - monitor->device = device; - monitor->node = node; - list_init_etc(&monitor->listeners, offsetof(monitor_listener, monitor_link)); + // create new monitor + monitor = new(std::nothrow) node_monitor; + if (monitor == NULL) + return B_NO_MEMORY; - hash_insert(gMonitorHash, monitor); - } else { - // check if the listener is already listening, and - // if so, just add the new flags + // initialize monitor + monitor->device = device; + monitor->node = node; - listener = get_listener_for(monitor, port, token); - if (listener != NULL) { - listener->flags |= flags; - goto out; - } + if (fMonitors.Insert(monitor) < B_OK) { + delete monitor; + return B_NO_MEMORY; + } - // check if this team is allowed to have more listeners - if (context->num_monitors >= context->max_monitors) { - // the BeBook says to return B_NO_MEMORY in this case, but - // we should have another one. - status = B_NO_MEMORY; - goto out; - } + *_monitor = monitor; + return B_OK; +} + + +/*! Returns the listener that matches the specified port/token pair. + Must be called with monitors lock hold. +*/ +monitor_listener* +NodeMonitorService::_MonitorListenerFor(node_monitor* monitor, + NotificationListener& notificationListener) +{ + MonitorListenerList::Iterator iterator + = monitor->listeners.GetIterator(); + + while (monitor_listener* listener = iterator.Next()) { + // does this listener match? + if (*listener->listener == notificationListener) + return listener; } - // add listener + return NULL; +} - listener = (monitor_listener *)malloc(sizeof(monitor_listener)); + +status_t +NodeMonitorService::_AddMonitorListener(io_context *context, + node_monitor* monitor, uint32 flags, + NotificationListener& notificationListener) +{ + monitor_listener *listener = new(std::nothrow) monitor_listener; if (listener == NULL) { // no memory for the listener, so remove the monitor as well if needed - if (list_is_empty(&monitor->listeners)) - remove_monitor(monitor); + if (monitor->listeners.IsEmpty()) + _RemoveMonitor(monitor); - status = B_NO_MEMORY; - goto out; + return B_NO_MEMORY; } // initialize listener, and add it to the lists - listener->port = port; - listener->token = token; + listener->listener = ¬ificationListener; listener->flags = flags; listener->monitor = monitor; - list_add_link_to_head(&monitor->listeners, &listener->monitor_link); + monitor->listeners.Add(listener); list_add_link_to_head(&context->node_monitors, listener); context->num_monitors++; - -out: - mutex_unlock(&gMonitorMutex); - return status; + return B_OK; } -static status_t -remove_node_monitor(struct io_context *context, dev_t device, ino_t node, - uint32 flags, port_id port, uint32 token) +status_t +NodeMonitorService::_AddListener(io_context *context, dev_t device, ino_t node, + uint32 flags, NotificationListener& notificationListener) { - monitor_listener *listener; - node_monitor *monitor; - status_t status = B_OK; + TRACE(("%s(dev = %ld, node = %Ld, flags = %ld, listener = %p\n", + __PRETTY_FUNCTION__, device, node, flags, ¬ificationListener)); - TRACE(("remove_node_monitor(dev = %ld, node = %Ld, flags = %ld, port = %ld, token = %ld\n", - device, node, flags, port, token)); + MutexLocker _(fMutex); - mutex_lock(&gMonitorMutex); + node_monitor *monitor; + status_t status = _GetMonitor(context, device, node, true, &monitor); + if (status < B_OK) + return status; - // get the monitor for this device/node pair - monitor = get_monitor_for(device, node); - if (monitor == NULL) { - status = B_ENTRY_NOT_FOUND; - goto out; - } + // add listener - // see if it has the listener we are looking for - listener = get_listener_for(monitor, port, token); - if (listener == NULL) { - status = B_ENTRY_NOT_FOUND; - goto out; - } - - // no flags means remove all flags - if (flags == B_STOP_WATCHING) - flags = ~0; - - listener->flags &= ~flags; - - // if there aren't anymore flags, remove this listener - if (listener->flags == B_STOP_WATCHING) { - remove_listener(listener); - context->num_monitors--; - } - -out: - mutex_unlock(&gMonitorMutex); - return status; + return _AddMonitorListener(context, monitor, flags, notificationListener); } -static status_t -remove_node_monitors_by_target(struct io_context *context, port_id port, uint32 token) +status_t +NodeMonitorService::_UpdateListener(io_context *context, dev_t device, + ino_t node, uint32 flags, bool addFlags, + NotificationListener& notificationListener) { - monitor_listener *listener = NULL; - int32 count = 0; + TRACE(("%s(dev = %ld, node = %Ld, flags = %ld, listener = %p\n", + __PRETTY_FUNCTION__, device, node, flags, ¬ificationListener)); - while ((listener = (monitor_listener*)list_get_next_item( - &context->node_monitors, listener)) != NULL) { - monitor_listener *removeListener; + MutexLocker _(fMutex); - if (listener->port != port || listener->token != token) - continue; + node_monitor *monitor; + status_t status = _GetMonitor(context, device, node, false, &monitor); + if (status < B_OK) + return status; - listener = (monitor_listener*)list_get_prev_item( - &context->node_monitors, removeListener = listener); - // this line sets the listener one item back, allowing us - // to remove its successor (which is saved in "removeListener") - - remove_listener(removeListener); - count++; + MonitorListenerList::Iterator iterator = monitor->listeners.GetIterator(); + while (monitor_listener* listener = iterator.Next()) { + if (*listener->listener == notificationListener) { + if (addFlags) + listener->flags |= flags; + else + listener->flags = flags; + return B_OK; + } } - return count > 0 ? B_OK : B_ENTRY_NOT_FOUND; + return B_BAD_VALUE; } -/** \brief Given device and node ID and a node monitoring event mask, the - * function checks whether there are listeners interested in any of - * the events for that node and, if so, adds the respective listener - * list to a supplied array of listener lists. - * - * Note, that in general not all of the listeners in an appended list will be - * interested in the events, but it is guaranteed that - * interested_monitor_listener_list::first_listener is indeed - * the first listener in the list, that is interested. - * - * \param device The ID of the mounted FS, the node lives in. - * \param node The ID of the node. - * \param flags The mask specifying the events occurred for the given node - * (a combination of \c B_WATCH_* constants). - * \param interestedListeners An array of listener lists. If there are - * interested listeners for the node, the list will be appended to - * this array. - * \param interestedListenerCount The number of elements in the - * \a interestedListeners array. Will be incremented, if a list is - * appended. - */ [... truncated: 1025 lines follow ...] From axeld at mail.berlios.de Wed Aug 1 18:46:26 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 1 Aug 2007 18:46:26 +0200 Subject: [Haiku-commits] r21781 - haiku/trunk/src/system/kernel Message-ID: <200708011646.l71GkQlt025193@sheep.berlios.de> Author: axeld Date: 2007-08-01 18:46:24 +0200 (Wed, 01 Aug 2007) New Revision: 21781 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21781&view=rev Modified: haiku/trunk/src/system/kernel/sem.c Log: Extended the "last acquirer" debug stuff to also contain the thread that released it last, and the counts involved. Furthermore, release_sem_etc() will now only negate the acquirer thread ID instead of setting it to -1. Modified: haiku/trunk/src/system/kernel/sem.c =================================================================== --- haiku/trunk/src/system/kernel/sem.c 2007-08-01 14:48:44 UTC (rev 21780) +++ haiku/trunk/src/system/kernel/sem.c 2007-08-01 16:46:24 UTC (rev 21781) @@ -50,6 +50,9 @@ team_id owner; // if set to -1, means owned by a port #ifdef DEBUG_LAST_ACQUIRER thread_id last_acquirer; + int32 last_acquire_count; + thread_id last_releaser; + int32 last_release_count; #endif } used; @@ -161,7 +164,10 @@ } else kprintf(" -\n"); #ifdef DEBUG_LAST_ACQUIRER - kprintf("last acquired by: 0x%lx\n", sem->u.used.last_acquirer); + kprintf("last acquired by: %ld, count: %ld\n", sem->u.used.last_acquirer, + sem->u.used.last_acquire_count); + kprintf("last released by: %ld, count: %ld\n", sem->u.used.last_releaser, + sem->u.used.last_release_count); #endif } else { kprintf("next: %p\n", sem->u.unused.next); @@ -649,8 +655,10 @@ } #ifdef DEBUG_LAST_ACQUIRER - if (thread->sem.acquire_status >= B_OK) + if (thread->sem.acquire_status >= B_OK) { sSems[slot].u.used.last_acquirer = thread_get_current_thread_id(); + sSems[slot].u.used.last_acquire_count = count; + } #endif restore_interrupts(state); @@ -662,6 +670,7 @@ } else { #ifdef DEBUG_LAST_ACQUIRER sSems[slot].u.used.last_acquirer = thread_get_current_thread_id(); + sSems[slot].u.used.last_acquire_count = count; #endif } @@ -715,13 +724,16 @@ // doesn't have any use outside the kernel if ((flags & B_CHECK_PERMISSION) != 0 && sSems[slot].u.used.owner == team_get_kernel_team_id()) { - dprintf("thread %ld tried to release kernel semaphore.\n", thread_get_current_thread()->id); + dprintf("thread %ld tried to release kernel semaphore.\n", + thread_get_current_thread_id()); status = B_NOT_ALLOWED; goto err; } #ifdef DEBUG_LAST_ACQUIRER - sSems[slot].u.used.last_acquirer = -1; + sSems[slot].u.used.last_acquirer = -sSems[slot].u.used.last_acquirer; + sSems[slot].u.used.last_releaser = thread_get_current_thread_id(); + sSems[slot].u.used.last_release_count = count; #endif // clear out a queue we will use to hold all of the threads that we will have to From mmlr at mail.berlios.de Wed Aug 1 20:00:46 2007 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Wed, 1 Aug 2007 20:00:46 +0200 Subject: [Haiku-commits] r21782 - haiku/trunk/src/apps/glteapot Message-ID: <200708011800.l71I0kPv022701@sheep.berlios.de> Author: mmlr Date: 2007-08-01 20:00:46 +0200 (Wed, 01 Aug 2007) New Revision: 21782 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21782&view=rev Modified: haiku/trunk/src/apps/glteapot/FPS.cpp Log: Made FPS counter of GLTeapot more scalable. Also made the file style guide compliant. Modified: haiku/trunk/src/apps/glteapot/FPS.cpp =================================================================== --- haiku/trunk/src/apps/glteapot/FPS.cpp 2007-08-01 16:46:24 UTC (rev 21781) +++ haiku/trunk/src/apps/glteapot/FPS.cpp 2007-08-01 18:00:46 UTC (rev 21782) @@ -2,38 +2,37 @@ Copyright 1999, Be Incorporated. All Rights Reserved. This file may be used under the terms of the Be Sample Code License. */ - - #include "FPS.h" - FPS::FPS() { } + FPS::~FPS() { } -void FPS::drawChar( GLfloat x, GLfloat y, GLint number ) + +void +FPS::drawChar(GLfloat x, GLfloat y, GLint number) { static bool numbers[13][7] = { - {true,true,true,true,true,true,false}, /* 0 */ - {false,true,true,false,false,false,false}, /* 1 */ - {true,true,false,true,true,false,true}, /* 2 */ - {true,true,true,true,false,false,true}, /* 3 */ - {false,true,true,false,false,true,true}, /* 4 */ - {true,false,true,true,false,true,true}, /* 5 */ - {true,false,true,true,true,true,true}, /* 6 */ - {true,true,true,false,false,false,false}, /* 7 */ - {true,true,true,true,true,true,true}, /* 8 */ - {true,true,true,false,false,true,true}, /* 9 */ + { true, true, true, true, true, true, false }, /* 0 */ + { false, true, true, false, false, false, false }, /* 1 */ + { true, true, false, true, true, false, true }, /* 2 */ + { true, true, true, true, false, false, true }, /* 3 */ + { false, true, true, false, false, true, true }, /* 4 */ + { true, false, true, true, false, true, true }, /* 5 */ + { true, false, true, true, true, true, true }, /* 6 */ + { true, true, true, false, false, false, false }, /* 7 */ + { true, true, true, true, true, true, true }, /* 8 */ + { true, true, true, false, false, true, true }, /* 9 */ - {true,false,false,false,true,true,true}, /* F */ - {true,true,false,false,true,true,true}, /* P */ - {true,false,true,true,false,true,true}, /* S */ - - }; + { true, false, false, false, true, true, true }, /* F */ + { true, true, false, false, true, true, true }, /* P */ + { true, false, true, true, false, true, true }, /* S */ + }; static GLfloat gap = 0.03; static GLfloat size = 1.0; @@ -51,85 +50,81 @@ static GLfloat y5 = -y1; static GLfloat y6 = -y0; - glBegin( GL_LINES ); - if( numbers[number][0] ) - { - glVertex2f( x1 + x, y0 + y ); - glVertex2f( x2 + x, y0 + y ); + glBegin(GL_LINES); + if (numbers[number][0]) { + glVertex2f(x1 + x, y0 + y); + glVertex2f(x2 + x, y0 + y); } - if( numbers[number][1] ) - { - glVertex2f( x3 + x, y1 + y ); - glVertex2f( x3 + x, y2 + y ); + + if (numbers[number][1]) { + glVertex2f(x3 + x, y1 + y); + glVertex2f(x3 + x, y2 + y); } - if( numbers[number][2] ) - { - glVertex2f( x3 + x, y4 + y ); - glVertex2f( x3 + x, y5 + y ); + + if (numbers[number][2]) { + glVertex2f(x3 + x, y4 + y); + glVertex2f(x3 + x, y5 + y); } - if( numbers[number][3] ) - { - glVertex2f( x1 + x, y6 + y ); - glVertex2f( x2 + x, y6 + y ); + + if (numbers[number][3]) { + glVertex2f(x1 + x, y6 + y); + glVertex2f(x2 + x, y6 + y); } - if( numbers[number][4] ) - { - glVertex2f( x0 + x, y5 + y ); - glVertex2f( x0 + x, y4 + y ); + + if (numbers[number][4]) { + glVertex2f(x0 + x, y5 + y); + glVertex2f(x0 + x, y4 + y); } - if( numbers[number][5] ) - { - glVertex2f( x0 + x, y2 + y ); - glVertex2f( x0 + x, y1 + y ); + + if (numbers[number][5]) { + glVertex2f(x0 + x, y2 + y); + glVertex2f(x0 + x, y1 + y); } - if( numbers[number][6] ) - { - glVertex2f( x1 + x, y3 + y ); - glVertex2f( x2 + x, y3 + y ); + + if (numbers[number][6]) { + glVertex2f(x1 + x, y3 + y); + glVertex2f(x2 + x, y3 + y); } - glEnd(); + glEnd(); } -void FPS::drawCounter( GLfloat frameRate ) + +void +FPS::drawCounter(GLfloat frameRate) { GLfloat pos = 0; - int ifps = (int) (frameRate * 10 +0.5); - int c100,c10,c1,c_1; + int ifps = (int)(frameRate * 10 + 0.5); - c100 = ifps / 1000; - c10 = (ifps / 100) % 10; - c1 = (ifps / 10) % 10; - c_1 = ifps % 10; - - if( c100 ) - { - drawChar( pos, 0, c100 ); - pos += 1; + int count = 0; + int number = 10; + while (ifps > number) { + number *= 10; + count++; } - if( c100 || c10 ) - { - drawChar( pos, 0, c10 ); - pos += 1; + + number /= 10; + for (int i = 0; i < count; i++) { + drawChar(pos, 0, (ifps / number) % 10); + pos += 1.0; + if (number == 1) + break; + number /= 10; } - drawChar( pos, 0, c1 ); - pos += 0.5; - glBegin( GL_POINTS ); - glVertex2f( pos, -0.5 ); + pos -= 0.5; + glBegin(GL_POINTS); + glVertex2f(pos, -0.5); glEnd(); pos += 0.5; - drawChar( pos, 0, c_1 ); + drawChar(pos, 0, (ifps / number) % 10); pos += 1.5; - - drawChar( pos, 0, 10 ); + drawChar(pos, 0, 10); pos += 1; - drawChar( pos, 0, 11 ); + drawChar(pos, 0, 11); pos += 1; - drawChar( pos, 0, 12 ); + drawChar(pos, 0, 12); pos += 1; - } - From bonefish at mail.berlios.de Thu Aug 2 04:37:38 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 2 Aug 2007 04:37:38 +0200 Subject: [Haiku-commits] r21783 - haiku/trunk/src/system/kernel/arch/x86 Message-ID: <200708020237.l722bcgc005716@sheep.berlios.de> Author: bonefish Date: 2007-08-02 04:37:35 +0200 (Thu, 02 Aug 2007) New Revision: 21783 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21783&view=rev Modified: haiku/trunk/src/system/kernel/arch/x86/arch_thread.c Log: axeld + bonefish: After exec() we re-entered the userland without removing the syscall iframe from the iframe stack, thus leaking one stack slot. Fixes bug #1304. Modified: haiku/trunk/src/system/kernel/arch/x86/arch_thread.c =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_thread.c 2007-08-01 18:00:46 UTC (rev 21782) +++ haiku/trunk/src/system/kernel/arch/x86/arch_thread.c 2007-08-02 02:37:35 UTC (rev 21783) @@ -334,6 +334,10 @@ disable_interrupts(); + // When entering the userspace, the iframe stack needs to be empty. After + // an exec() it'll still contain the iframe from the syscall, though. + t->arch_info.iframes.index = 0; + i386_set_tss_and_kstack(t->kernel_stack_base + KERNEL_STACK_SIZE); // set the CPU dependent GDT entry for TLS From bonefish at mail.berlios.de Thu Aug 2 04:48:12 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 2 Aug 2007 04:48:12 +0200 Subject: [Haiku-commits] r21784 - haiku/trunk/src/system/kernel/arch/x86 Message-ID: <200708020248.l722mC7M007433@sheep.berlios.de> Author: bonefish Date: 2007-08-02 04:48:11 +0200 (Thu, 02 Aug 2007) New Revision: 21784 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21784&view=rev Modified: haiku/trunk/src/system/kernel/arch/x86/arch_int.c Log: axeld + bonefish: Certain interrupts don't disable interrupts. We were calling x86_{push,pop}_iframe() without specifically disabling them, thus causing a race condition with could cause the iframe stack to be invalid. This could cause all kinds of problems. Modified: haiku/trunk/src/system/kernel/arch/x86/arch_int.c =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_int.c 2007-08-02 02:37:35 UTC (rev 21783) +++ haiku/trunk/src/system/kernel/arch/x86/arch_int.c 2007-08-02 02:48:11 UTC (rev 21784) @@ -355,10 +355,13 @@ { struct thread *thread = thread_get_current_thread(); int ret = B_HANDLED_INTERRUPT; + cpu_status state; // all exceptions besides 3 (breakpoint), and 99 (syscall) enter this // function with interrupts disabled + state = disable_interrupts(); + if (thread) x86_push_iframe(&thread->arch_info.iframes, &frame); else @@ -369,6 +372,8 @@ thread_at_kernel_entry(); } + restore_interrupts(state); + // if(frame.vector != 0x20) // dprintf("i386_handle_trap: vector 0x%x, ip 0x%x, cpu %d\n", frame.vector, frame.eip, smp_get_current_cpu()); @@ -457,7 +462,6 @@ if (kernelDebugger) { // if this thread has a fault handler, we're allowed to be here - struct thread *thread = thread_get_current_thread(); if (thread && thread->fault_handler != NULL) { frame.eip = thread->fault_handler; break; @@ -589,6 +593,8 @@ // dprintf("0x%x cpu %d!\n", thread_get_current_thread_id(), smp_get_current_cpu()); + disable_interrupts(); + if (thread) x86_pop_iframe(&thread->arch_info.iframes); else From stefano.ceccherini at gmail.com Thu Aug 2 08:21:49 2007 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Thu, 2 Aug 2007 08:21:49 +0200 Subject: [Haiku-commits] r21783 - haiku/trunk/src/system/kernel/arch/x86 In-Reply-To: <200708020237.l722bcgc005716@sheep.berlios.de> References: <200708020237.l722bcgc005716@sheep.berlios.de> Message-ID: <894b9700708012321r3aa587aeu6a858a90819a1382@mail.gmail.com> 2007/8/2, bonefish at BerliOS : > axeld + bonefish: > After exec() we re-entered the userland without removing the syscall > iframe from the iframe stack, thus leaking one stack slot. > Fixes bug #1304. > > Great work! From jackburton at mail.berlios.de Thu Aug 2 08:44:34 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Thu, 2 Aug 2007 08:44:34 +0200 Subject: [Haiku-commits] r21785 - haiku/trunk/src/apps/terminal Message-ID: <200708020644.l726iYxu015430@sheep.berlios.de> Author: jackburton Date: 2007-08-02 08:44:34 +0200 (Thu, 02 Aug 2007) New Revision: 21785 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21785&view=rev Modified: haiku/trunk/src/apps/terminal/SmartTabView.cpp haiku/trunk/src/apps/terminal/SmartTabView.h Log: Try to have a really smart tab view... It won't show any tabs when there's only one view attached. Modified: haiku/trunk/src/apps/terminal/SmartTabView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/SmartTabView.cpp 2007-08-02 02:48:11 UTC (rev 21784) +++ haiku/trunk/src/apps/terminal/SmartTabView.cpp 2007-08-02 06:44:34 UTC (rev 21785) @@ -8,10 +8,15 @@ #include "SmartTabView.h" +#include + + SmartTabView::SmartTabView(BRect frame, const char *name, button_width width, uint32 resizingMode, uint32 flags) : - BTabView(frame, name, width, resizingMode, flags) + BView(frame, name, resizingMode, flags), + fTabView(NULL), + fView(NULL) { } @@ -21,50 +26,116 @@ } +BView * +SmartTabView::ContainerView() +{ + return fTabView != NULL ? fTabView->ContainerView() : this; +} + + +BView * +SmartTabView::ViewForTab(int32 tab) +{ + return fTabView != NULL ? fTabView->ViewForTab(tab) : fView; +} + + void SmartTabView::Select(int32 index) { - BTabView::Select(index); - BTab *tab = TabAt(Selection()); - if (tab != NULL) { - BView *view = tab->View(); - if (view != NULL) - view->ResizeTo(Bounds().Width(), Bounds().Height()); + if (fView != NULL) { + fView->ResizeTo(Bounds().Width(), Bounds().Height()); + } else if (fTabView != NULL) { + fTabView->Select(index); + BTab *tab = fTabView->TabAt(fTabView->Selection()); + if (tab != NULL) { + BView *view = tab->View(); + if (view != NULL) + view->ResizeTo(fTabView->Bounds().Width(), fTabView->Bounds().Height()); + } } } -/* + +int32 +SmartTabView::Selection() const +{ + return fTabView != NULL ? fTabView->Selection() : 0; +} + + void SmartTabView::AddTab(BView *target, BTab *tab) { if (target == NULL) return; - if (CountTabs() == 1) { - - } - AddTab(target, tab); + if (fView == NULL && fTabView == NULL) { + fView = target; + AddChild(target); + } else { + if (fTabView == NULL) { + RemoveChild(fView); + fTabView = new BTabView(Bounds(), "tabview"); + AddChild(fTabView); + fTabView->MoveTo(B_ORIGIN); + fTabView->ResizeTo(Bounds().Width(), Bounds().Height()); + fTabView->AddTab(fView); + fTabView->Select(0); + fView = NULL; + } + fTabView->AddTab(target, tab); + } } BTab * SmartTabView::RemoveTab(int32 index) { - BTab *oldTab = RemoveTab(index); - if (CountTabs() == 1) { - + BTab *returnTab = NULL; + if (fTabView != NULL) { + returnTab = fTabView->RemoveTab(index); + if (fTabView->CountTabs() == 1) { + BTab *tab = fTabView->RemoveTab(0); + RemoveChild(fTabView); + delete fTabView; + fTabView = NULL; + fView = tab->View(); + tab->SetView(NULL); + AddChild(fView); + fView->MoveTo(B_ORIGIN); + fView->ResizeTo(Bounds().Width(), Bounds().Height()); + delete tab; + } + } else if (fView != NULL) { + RemoveChild(fView); + returnTab = new BTab(); + returnTab->SetView(fView); + fView = NULL; } - return oldTab; + + return returnTab; } -BRect -SmartTabView::DrawTabs() +int32 +SmartTabView::CountTabs() const { - //if (CountTabs() > 1) - return BTabView::DrawTabs(); - //return BRect(0, 0, -1, -1); + if (fTabView != NULL) + return fTabView->CountTabs(); + + return fView != NULL ? 1 : 0; } + + +/* +void +SmartTabView::Draw(BRect updateRect) +{ + if (fView != NULL) { + + } +} */ - + Modified: haiku/trunk/src/apps/terminal/SmartTabView.h =================================================================== --- haiku/trunk/src/apps/terminal/SmartTabView.h 2007-08-02 02:48:11 UTC (rev 21784) +++ haiku/trunk/src/apps/terminal/SmartTabView.h 2007-08-02 06:44:34 UTC (rev 21785) @@ -9,9 +9,10 @@ #ifndef __SMARTTABVIEW_H #define __SMARTTABVIEW_H -#include +#include -class SmartTabView : public BTabView { +class BTabView; +class SmartTabView : public BView { public: SmartTabView(BRect frame, const char *name, button_width width = B_WIDTH_AS_USUAL, @@ -20,12 +21,22 @@ B_WILL_DRAW | B_NAVIGABLE_JUMP | B_FRAME_EVENTS | B_NAVIGABLE); virtual ~SmartTabView(); + + virtual BView *ContainerView(); + virtual BView *ViewForTab(int32); + virtual void Select(int32 tab); - /* + virtual int32 Selection() const; + virtual void AddTab(BView *target, BTab *tab = NULL); virtual BTab* RemoveTab(int32 index); - virtual BRect DrawTabs();*/ + virtual int32 CountTabs() const; + + //virtual void Draw(BRect rect); +private: + BTabView *fTabView; + BView *fView; }; #endif // __SMARTTABVIEW_H From bonefish at mail.berlios.de Thu Aug 2 14:29:02 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 2 Aug 2007 14:29:02 +0200 Subject: [Haiku-commits] r21786 - haiku/trunk/build/jam Message-ID: <200708021229.l72CT2sP001391@sheep.berlios.de> Author: bonefish Date: 2007-08-02 14:29:02 +0200 (Thu, 02 Aug 2007) New Revision: 21786 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21786&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: Added bison to the image. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2007-08-02 06:44:34 UTC (rev 21785) +++ haiku/trunk/build/jam/HaikuImage 2007-08-02 12:29:02 UTC (rev 21786) @@ -22,8 +22,8 @@ GPL_ONLY = "" ; } -BEOS_BIN = "[" addattr alert arp basename bc beep bzip2 cat cardctl catattr chgrp - chmod chop chown cksum clear clockconfig cmp comm compress cp copyattr +BEOS_BIN = "[" addattr alert arp basename bc beep bison bzip2 cat cardctl catattr + chgrp chmod chop chown cksum clear clockconfig cmp comm compress cp copyattr $(X86_ONLY)CortexAddOnHost csplit ctags cut date dc dd desklink df diff diff3 dircolors dirname driveinfo dstcheck du dump_cis dump_cisreg echo eject env error expand @@ -334,6 +334,11 @@ AddFilesToHaikuImage home config settings : US-International : Key_map ; +# bison files +SEARCH on m4sugar.m4 + = [ FDirName $(HAIKU_TOP) src bin bison data m4sugar ] ; +AddFilesToHaikuImage beos etc m4sugar : m4sugar.m4 ; + # boot loader AddFilesToHaikuImage beos system : zbeos ; From bonefish at mail.berlios.de Thu Aug 2 14:33:00 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 2 Aug 2007 14:33:00 +0200 Subject: [Haiku-commits] r21787 - haiku/trunk/src/tests/apps/partitioner Message-ID: <200708021233.l72CX05W001661@sheep.berlios.de> Author: bonefish Date: 2007-08-02 14:33:00 +0200 (Thu, 02 Aug 2007) New Revision: 21787 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21787&view=rev Modified: haiku/trunk/src/tests/apps/partitioner/Partitioner.cpp Log: Return a valid partition index also when there's only the disk device. Modified: haiku/trunk/src/tests/apps/partitioner/Partitioner.cpp =================================================================== --- haiku/trunk/src/tests/apps/partitioner/Partitioner.cpp 2007-08-02 12:29:02 UTC (rev 21786) +++ haiku/trunk/src/tests/apps/partitioner/Partitioner.cpp 2007-08-02 12:33:00 UTC (rev 21787) @@ -549,6 +549,7 @@ // if the disk device has no children, we select it without asking if (fDevice->CountChildren() == 0) { partition = fDevice; + _partitionIndex = 0; return true; } From bonefish at mail.berlios.de Thu Aug 2 14:43:51 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 2 Aug 2007 14:43:51 +0200 Subject: [Haiku-commits] r21788 - in haiku/trunk: headers/os/drivers headers/private/fs_shell src/add-ons/kernel/file_systems/bfs src/kits/storage src/system/kernel/disk_device_manager src/tools/fs_shell Message-ID: <200708021243.l72ChpNq002168@sheep.berlios.de> Author: bonefish Date: 2007-08-02 14:43:49 +0200 (Thu, 02 Aug 2007) New Revision: 21788 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21788&view=rev Modified: haiku/trunk/headers/os/drivers/fs_interface.h haiku/trunk/headers/private/fs_shell/fssh_fs_interface.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp haiku/trunk/src/kits/storage/DiskDevice.cpp haiku/trunk/src/system/kernel/disk_device_manager/KFileSystem.cpp haiku/trunk/src/system/kernel/disk_device_manager/KPartitioningSystem.cpp haiku/trunk/src/tools/fs_shell/unistd.cpp haiku/trunk/src/tools/fs_shell/vfs.cpp Log: * Added mapping of dup() in the FS shell. * Adjusted the FS initialize() hook to have FD and partition_id parameters like the other hooks instead of the partition path. * Adjusted initialization in BFS accordingly. * Implemented the FS initialization method in KFileSystem. Modified: haiku/trunk/headers/os/drivers/fs_interface.h =================================================================== --- haiku/trunk/headers/os/drivers/fs_interface.h 2007-08-02 12:33:00 UTC (rev 21787) +++ haiku/trunk/headers/os/drivers/fs_interface.h 2007-08-02 12:43:49 UTC (rev 21788) @@ -245,10 +245,8 @@ const char *name, disk_job_id job); status_t (*set_content_parameters)(int fd, partition_id partition, const char *parameters, disk_job_id job); - status_t (*initialize)(const char *partition, const char *name, + status_t (*initialize)(int fd, partition_id partition, const char *name, const char *parameters, disk_job_id job); - // This is pretty close to how the hook in R5 looked. Save the job ID, - // of course and that the parameters were given as (void*, size_t) pair. } file_system_module_info; Modified: haiku/trunk/headers/private/fs_shell/fssh_fs_interface.h =================================================================== --- haiku/trunk/headers/private/fs_shell/fssh_fs_interface.h 2007-08-02 12:33:00 UTC (rev 21787) +++ haiku/trunk/headers/private/fs_shell/fssh_fs_interface.h 2007-08-02 12:43:49 UTC (rev 21788) @@ -279,10 +279,8 @@ const char *name, fssh_disk_job_id job); fssh_status_t (*set_content_parameters)(int fd, fssh_partition_id partition, const char *parameters, fssh_disk_job_id job); - fssh_status_t (*initialize)(const char *partition, const char *name, - const char *parameters, fssh_disk_job_id job); - // This is pretty close to how the hook in R5 looked. Save the job ID, - // of course and that the parameters were given as (void*, size_t) pair. + fssh_status_t (*initialize)(int fd, fssh_partition_id partition, + const char *name, const char *parameters, fssh_disk_job_id job); } fssh_file_system_module_info; Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp 2007-08-02 12:33:00 UTC (rev 21787) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp 2007-08-02 12:43:49 UTC (rev 21788) @@ -27,10 +27,12 @@ class DeviceOpener { public: + DeviceOpener(int fd, int mode); DeviceOpener(const char *device, int mode); ~DeviceOpener(); int Open(const char *device, int mode); + int Open(int fd, int mode); void *InitCache(off_t numBlocks, uint32 blockSize); void RemoveCache(bool allowWrites); @@ -56,6 +58,14 @@ } +DeviceOpener::DeviceOpener(int fd, int mode) + : + fBlockCache(NULL) +{ + Open(fd, mode); +} + + DeviceOpener::~DeviceOpener() { if (fDevice >= B_OK) { @@ -97,6 +107,19 @@ } +int +DeviceOpener::Open(int fd, int mode) +{ + fDevice = dup(fd); + if (fDevice < 0) + return errno; + + fMode = mode; + + return fDevice; +} + + void * DeviceOpener::InitCache(off_t numBlocks, uint32 blockSize) { @@ -563,7 +586,7 @@ status_t -Volume::Initialize(const char *device, const char *name, uint32 blockSize, +Volume::Initialize(int fd, const char *name, uint32 blockSize, uint32 flags) { // although there is no really good reason for it, we won't @@ -576,7 +599,7 @@ && blockSize != 8192) return B_BAD_VALUE; - DeviceOpener opener(device, O_RDWR); + DeviceOpener opener(fd, O_RDWR); if (opener.Device() < B_OK) return B_BAD_VALUE; Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.h 2007-08-02 12:33:00 UTC (rev 21787) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.h 2007-08-02 12:43:49 UTC (rev 21788) @@ -31,7 +31,7 @@ status_t Mount(const char *device, uint32 flags); status_t Unmount(); - status_t Initialize(const char *device, const char *name, + status_t Initialize(int fd, const char *name, uint32 blockSize, uint32 flags); bool IsValidSuperBlock(); Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp 2007-08-02 12:33:00 UTC (rev 21787) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp 2007-08-02 12:43:49 UTC (rev 21788) @@ -2038,12 +2038,9 @@ status_t -bfs_initialize(const char *partition, const char *name, const char *parameters, - disk_job_id job) +bfs_initialize(int fd, partition_id partition, const char *name, + const char *parameters, disk_job_id job) { - if (partition == NULL) - return B_BAD_VALUE; - uint32 blockSize = 1024; uint32 flags = 0; bool verbose = false; @@ -2070,7 +2067,7 @@ } Volume volume(-1); - status_t status = volume.Initialize(partition, name, blockSize, flags); + status_t status = volume.Initialize(fd, name, blockSize, flags); if (status < B_OK) { INFORM(("Initializing volume failed: %s\n", strerror(status))); return status; Modified: haiku/trunk/src/kits/storage/DiskDevice.cpp =================================================================== --- haiku/trunk/src/kits/storage/DiskDevice.cpp 2007-08-02 12:33:00 UTC (rev 21787) +++ haiku/trunk/src/kits/storage/DiskDevice.cpp 2007-08-02 12:43:49 UTC (rev 21788) @@ -228,6 +228,7 @@ if (!_IsShadow()) return B_BAD_VALUE; // TODO: Get port and token from the progressMessenger + // TODO: Respect "synchronously"! port_id port = -1; int32 token = -1; error = _kern_commit_disk_device_modifications(ID(), port, token, Modified: haiku/trunk/src/system/kernel/disk_device_manager/KFileSystem.cpp =================================================================== --- haiku/trunk/src/system/kernel/disk_device_manager/KFileSystem.cpp 2007-08-02 12:33:00 UTC (rev 21787) +++ haiku/trunk/src/system/kernel/disk_device_manager/KFileSystem.cpp 2007-08-02 12:43:49 UTC (rev 21788) @@ -7,6 +7,7 @@ #include #include "ddm_modules.h" +#include "KDiskDeviceJob.h" #include "KDiskDeviceUtils.h" #include "KFileSystem.h" #include "KPartition.h" @@ -308,8 +309,31 @@ KFileSystem::Initialize(KPartition *partition, const char *name, const char *parameters, KDiskDeviceJob *job) { - // to be implemented - return B_ERROR; + // check parameters + if (!partition || !job || !fModule) + return B_BAD_VALUE; + if (!fModule->initialize) + return B_NOT_SUPPORTED; + + // open partition device (we need a temporary read-lock) + KDiskDeviceManager *manager = KDiskDeviceManager::Default(); + if (!manager->ReadLockPartition(partition->ID())) + return B_ERROR; + DeviceReadLocker locker(partition->Device(), true); + + int fd = -1; + status_t result = partition->Open(O_RDWR, &fd); + if (result != B_OK) + return result; + + locker.Unlock(); + + // call the module hook + result = fModule->initialize(fd, partition->ID(), name, parameters, + job->ID()); + + close(fd); + return result; } Modified: haiku/trunk/src/system/kernel/disk_device_manager/KPartitioningSystem.cpp =================================================================== --- haiku/trunk/src/system/kernel/disk_device_manager/KPartitioningSystem.cpp 2007-08-02 12:33:00 UTC (rev 21787) +++ haiku/trunk/src/system/kernel/disk_device_manager/KPartitioningSystem.cpp 2007-08-02 12:43:49 UTC (rev 21788) @@ -901,6 +901,7 @@ } // let the module do its job +// TODO: The partition must not be locked at this point! status_t result = fModule->initialize(fd, partition->ID(), name, parameters, job->ID()); Modified: haiku/trunk/src/tools/fs_shell/unistd.cpp =================================================================== --- haiku/trunk/src/tools/fs_shell/unistd.cpp 2007-08-02 12:33:00 UTC (rev 21787) +++ haiku/trunk/src/tools/fs_shell/unistd.cpp 2007-08-02 12:43:49 UTC (rev 21788) @@ -34,7 +34,8 @@ #ifndef __BEOS__ - // The _kern_close() defined in libroot_build.so. + // Defined in libroot_build.so. + extern "C" int _kern_dup(int fd); extern "C" status_t _kern_close(int fd); #endif @@ -77,6 +78,24 @@ int +fssh_dup(int fd) +{ + // Use the _kern_dup() defined in libroot on BeOS incompatible systems. + // Required for proper attribute emulation support. + #if __BEOS__ + return dup(fd); + #else + int result = _kern_dup(fd); + if (result < 0) { + fssh_set_errno(result); + return -1; + } + return result; + #endif +} + + +int fssh_close(int fd) { // Use the _kern_close() defined in libroot on BeOS incompatible systems. Modified: haiku/trunk/src/tools/fs_shell/vfs.cpp =================================================================== --- haiku/trunk/src/tools/fs_shell/vfs.cpp 2007-08-02 12:33:00 UTC (rev 21787) +++ haiku/trunk/src/tools/fs_shell/vfs.cpp 2007-08-02 12:43:49 UTC (rev 21788) @@ -16,6 +16,7 @@ #include "fssh_atomic.h" #include "fssh_defs.h" #include "fssh_dirent.h" +#include "fssh_errno.h" #include "fssh_fcntl.h" #include "fssh_fs_info.h" #include "fssh_fs_volume.h" @@ -5184,30 +5185,30 @@ // The partition argument should point to a real file/device. - // normalize the device path - KPath normalizedDevice; -// status = normalizedDevice.SetTo(device, true); -// NOTE: normalizing works only in our namespace. - fssh_status_t status = normalizedDevice.SetTo(partition, false); - if (status != FSSH_B_OK) - return status; + // open partition + int fd = fssh_open(partition, FSSH_O_RDWR); + if (fd < 0) + return fssh_errno; - partition = normalizedDevice.Path(); - // correct path to file device - // get the file system module fssh_file_system_module_info* fsModule = get_file_system(fsName); - if (fsModule == NULL) + if (fsModule == NULL) { + fssh_close(fd); return FSSH_ENODEV; + } // initialize - if (fsModule->initialize) - status = (*fsModule->initialize)(partition, name, parameters, -1); - else + fssh_status_t status; + if (fsModule->initialize) { + status = (*fsModule->initialize)(fd, -1, name, parameters, -1); + // We've got no partition or job IDs -- the FS will hopefully + // ignore that. + } else status = FSSH_B_NOT_SUPPORTED; - // put the file system module + // put the file system module, close partition put_file_system(fsModule); + fssh_close(fd); return status; } From stippi at mail.berlios.de Thu Aug 2 15:04:28 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 2 Aug 2007 15:04:28 +0200 Subject: [Haiku-commits] r21789 - haiku/trunk/src/servers/app Message-ID: <200708021304.l72D4SED003440@sheep.berlios.de> Author: stippi Date: 2007-08-02 15:04:27 +0200 (Thu, 02 Aug 2007) New Revision: 21789 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21789&view=rev Modified: haiku/trunk/src/servers/app/MultiLocker.h Log: * added IsLocked() method to AutoWriteLocker Modified: haiku/trunk/src/servers/app/MultiLocker.h =================================================================== --- haiku/trunk/src/servers/app/MultiLocker.h 2007-08-02 12:43:49 UTC (rev 21788) +++ haiku/trunk/src/servers/app/MultiLocker.h 2007-08-02 13:04:27 UTC (rev 21789) @@ -112,6 +112,11 @@ fLock.WriteLock(); } + bool IsLocked() const + { + return fLock.IsWriteLocked(); + } + ~AutoWriteLocker() { fLock.WriteUnlock(); From jackburton at mail.berlios.de Thu Aug 2 15:17:23 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Thu, 2 Aug 2007 15:17:23 +0200 Subject: [Haiku-commits] r21790 - haiku/trunk/src/apps/terminal Message-ID: <200708021317.l72DHNf3004714@sheep.berlios.de> Author: jackburton Date: 2007-08-02 15:17:23 +0200 (Thu, 02 Aug 2007) New Revision: 21790 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21790&view=rev Modified: haiku/trunk/src/apps/terminal/SmartTabView.cpp haiku/trunk/src/apps/terminal/SmartTabView.h haiku/trunk/src/apps/terminal/TermWindow.cpp haiku/trunk/src/apps/terminal/TermWindow.h Log: Implemented tabbed terminal (with a couple of bad hacks which will go away soon, hopefully). The menuitem to open a new tab is still disabled, until I figure out how to catch the exit signal... HELP ? Plus there are still a couple of visual issues, but AFAICT without tabs the Terminal appearance should be the same as it was before, so no one should complain. Modified: haiku/trunk/src/apps/terminal/SmartTabView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/SmartTabView.cpp 2007-08-02 13:04:27 UTC (rev 21789) +++ haiku/trunk/src/apps/terminal/SmartTabView.cpp 2007-08-02 13:17:23 UTC (rev 21790) @@ -8,16 +8,19 @@ #include "SmartTabView.h" -#include +#include +#include +#include SmartTabView::SmartTabView(BRect frame, const char *name, button_width width, uint32 resizingMode, uint32 flags) : - BView(frame, name, resizingMode, flags), - fTabView(NULL), - fView(NULL) + BTabView(frame, name, width, resizingMode, flags) { + // See BTabView::_InitObject() to see why we are doing this + ContainerView()->MoveBy(-3, -TabHeight() - 3); + ContainerView()->ResizeBy(9, TabHeight() + 9); } @@ -26,116 +29,82 @@ } -BView * -SmartTabView::ContainerView() +void +SmartTabView::MouseDown(BPoint point) { - return fTabView != NULL ? fTabView->ContainerView() : this; + int32 buttons; + Window()->CurrentMessage()->FindInt32("buttons", &buttons); + + if (CountTabs() > 1 && point.y <= TabHeight() && buttons & B_TERTIARY_MOUSE_BUTTON) { + for (int32 i = 0; i < CountTabs(); i++) { + if (TabFrame(i).Contains(point)) { + // Select another tab + if (i > 0) + Select(i - 1); + else if (i < CountTabs()) + Select(i + 1); + BTab *tab = RemoveTab(i); + delete tab; + return; + } + } + } else + BTabView::MouseDown(point); } -BView * -SmartTabView::ViewForTab(int32 tab) +void +SmartTabView::AllAttached() { - return fTabView != NULL ? fTabView->ViewForTab(tab) : fView; + BTabView::AllAttached(); } void SmartTabView::Select(int32 index) { - if (fView != NULL) { - fView->ResizeTo(Bounds().Width(), Bounds().Height()); - } else if (fTabView != NULL) { - fTabView->Select(index); - BTab *tab = fTabView->TabAt(fTabView->Selection()); - if (tab != NULL) { - BView *view = tab->View(); - if (view != NULL) - view->ResizeTo(fTabView->Bounds().Width(), fTabView->Bounds().Height()); - } + BTabView::Select(index); + BView *view = ViewForTab(index); + if (view != NULL) { + view->ResizeTo(ContainerView()->Bounds().Width(), ContainerView()->Bounds().Height()); } } -int32 -SmartTabView::Selection() const -{ - return fTabView != NULL ? fTabView->Selection() : 0; -} - - void SmartTabView::AddTab(BView *target, BTab *tab) { if (target == NULL) return; - if (fView == NULL && fTabView == NULL) { - fView = target; - AddChild(target); - } else { - if (fTabView == NULL) { - RemoveChild(fView); - fTabView = new BTabView(Bounds(), "tabview"); - AddChild(fTabView); - fTabView->MoveTo(B_ORIGIN); - fTabView->ResizeTo(Bounds().Width(), Bounds().Height()); - fTabView->AddTab(fView); - fTabView->Select(0); - fView = NULL; - } - fTabView->AddTab(target, tab); + if (CountTabs() == 1) { + ContainerView()->ResizeBy(0, -TabHeight()); + ContainerView()->MoveBy(0, TabHeight()); } + BTabView::AddTab(target, tab); + + Invalidate(TabFrame(CountTabs() - 1).InsetByCopy(-2, -2)); } BTab * SmartTabView::RemoveTab(int32 index) { - BTab *returnTab = NULL; - if (fTabView != NULL) { - returnTab = fTabView->RemoveTab(index); - if (fTabView->CountTabs() == 1) { - BTab *tab = fTabView->RemoveTab(0); - RemoveChild(fTabView); - delete fTabView; - fTabView = NULL; - fView = tab->View(); - tab->SetView(NULL); - AddChild(fView); - fView->MoveTo(B_ORIGIN); - fView->ResizeTo(Bounds().Width(), Bounds().Height()); - delete tab; - } - } else if (fView != NULL) { - RemoveChild(fView); - returnTab = new BTab(); - returnTab->SetView(fView); - fView = NULL; + BTab *tab = BTabView::RemoveTab(index); + if (CountTabs() == 1) { + ContainerView()->MoveBy(0, -TabHeight()); + ContainerView()->ResizeBy(0, TabHeight()); } - - return returnTab; + return tab; } -int32 -SmartTabView::CountTabs() const +BRect +SmartTabView::DrawTabs() { - if (fTabView != NULL) - return fTabView->CountTabs(); - - return fView != NULL ? 1 : 0; + if (CountTabs() > 1) + return BTabView::DrawTabs(); + return BRect(); } -/* -void -SmartTabView::Draw(BRect updateRect) -{ - if (fView != NULL) { - - } -} -*/ - - Modified: haiku/trunk/src/apps/terminal/SmartTabView.h =================================================================== --- haiku/trunk/src/apps/terminal/SmartTabView.h 2007-08-02 13:04:27 UTC (rev 21789) +++ haiku/trunk/src/apps/terminal/SmartTabView.h 2007-08-02 13:17:23 UTC (rev 21790) @@ -9,10 +9,9 @@ #ifndef __SMARTTABVIEW_H #define __SMARTTABVIEW_H -#include +#include -class BTabView; -class SmartTabView : public BView { +class SmartTabView : public BTabView { public: SmartTabView(BRect frame, const char *name, button_width width = B_WIDTH_AS_USUAL, @@ -22,21 +21,15 @@ B_FRAME_EVENTS | B_NAVIGABLE); virtual ~SmartTabView(); - virtual BView *ContainerView(); - virtual BView *ViewForTab(int32); + virtual void MouseDown(BPoint where); + virtual void AllAttached(); virtual void Select(int32 tab); - virtual int32 Selection() const; - + virtual void AddTab(BView *target, BTab *tab = NULL); virtual BTab* RemoveTab(int32 index); - virtual int32 CountTabs() const; - - //virtual void Draw(BRect rect); -private: - BTabView *fTabView; - BView *fView; + virtual BRect DrawTabs(); }; #endif // __SMARTTABVIEW_H Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.cpp 2007-08-02 13:04:27 UTC (rev 21789) +++ haiku/trunk/src/apps/terminal/TermWindow.cpp 2007-08-02 13:17:23 UTC (rev 21790) @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -49,11 +50,11 @@ const static float kViewOffset = 3; +const static uint32 kNewTab = 'NTab'; TermWindow::TermWindow(BRect frame, const char* title, const char *command) : BWindow(frame, title, B_DOCUMENT_WINDOW, B_CURRENT_WORKSPACE|B_QUIT_ON_WINDOW_CLOSE), fTabView(NULL), - fTermView(NULL), fMenubar(NULL), fFilemenu(NULL), fEditmenu(NULL), @@ -75,14 +76,6 @@ fMatchWord(false) { _InitWindow(command); - /*BView *view = new TermView(Bounds()); - - AddChild(view); - BRect draggerFrame(0, 0, 16, 16); - draggerFrame.OffsetTo(Bounds().RightBottom() - BPoint(16, 16)); - BDragger *dragger = new BDragger(draggerFrame, view, B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM, B_WILL_DRAW); - - view->AddChild(dragger);*/ } @@ -110,71 +103,13 @@ // make menu bar _SetupMenu(); - // Setup font. + BRect textFrame = Bounds(); + textFrame.top = fMenubar->Bounds().bottom + 1.0; - const char *family = PrefHandler::Default()->getString(PREF_HALF_FONT_FAMILY); - - BFont halfFont; - halfFont.SetFamilyAndStyle(family, NULL); - float size = PrefHandler::Default()->getFloat(PREF_HALF_FONT_SIZE); - if (size < 6.0f) - size = 6.0f; - halfFont.SetSize(size); + fTabView = new SmartTabView(textFrame, "tab view"); + AddChild(fTabView); - family = PrefHandler::Default()->getString(PREF_FULL_FONT_FAMILY); - - BFont fullFont; - fullFont.SetFamilyAndStyle(family, NULL); - size = PrefHandler::Default()->getFloat(PREF_FULL_FONT_SIZE); - if (size < 6.0f) - size = 6.0f; - fullFont.SetSize(size); - fullFont.SetSpacing(B_FIXED_SPACING); - - // Make Terminal text view. - - BRect textframe = Bounds(); - textframe.top = fMenubar->Bounds().bottom + 1.0; - - fTermView = new TermView(textframe, command); - fTermView->SetEncoding(longname2id(PrefHandler::Default()->getString(PREF_TEXT_ENCODING))); - - // Initialize TermView. (font, size and color) - fTermView->SetTermFont(&halfFont, &fullFont); - - _SetTermColors(); - BRect rect = fTermView->SetTermSize(PrefHandler::Default()->getInt32(PREF_ROWS), - PrefHandler::Default()->getInt32(PREF_COLS), true); - - int width, height; - fTermView->GetFontSize(&width, &height); - SetSizeLimits(MIN_COLS * width, MAX_COLS * width, - MIN_COLS * height, MAX_COLS * height); - - // Add offset to baseview. - rect.InsetBy(-kViewOffset, -kViewOffset); - - // Resize Window - ResizeTo(rect.Width()+ B_V_SCROLL_BAR_WIDTH, - rect.Height() + fMenubar->Bounds().Height()); - - fTermView->ResizeTo(rect.Width(), rect.Height()); - - // Make Scroll Bar. - - BRect scrollRect(0, 0, B_V_SCROLL_BAR_WIDTH, - rect.Height() - B_H_SCROLL_BAR_HEIGHT + 1); - - scrollRect.OffsetBy(rect.Width() + 1, fMenubar->Bounds().Height()); - - BScrollBar *scrollBar = new BScrollBar(scrollRect, "scrollbar", - fTermView, 0, 0, B_VERTICAL); - fTermView->SetScrollBar(scrollBar); - - AddChild(scrollBar); - AddChild(fTermView); - - fEditmenu->SetTargetForItems(fTermView); + _NewTab(command); } @@ -182,7 +117,7 @@ TermWindow::MenusBeginning() { // Syncronize Encode Menu Pop-up menu and Preference. - BMenuItem *item = fEncodingmenu->FindItem(id2longname(fTermView->Encoding())); + BMenuItem *item = fEncodingmenu->FindItem(id2longname(_ActiveTermView()->Encoding())); if (item != NULL) item->SetMarked(true); BWindow::MenusBeginning(); @@ -203,6 +138,12 @@ fFilemenu = new BMenu("Terminal"); fFilemenu->AddItem(new BMenuItem("Switch Terminals", new BMessage(MENU_SWITCH_TERM),'G')); fFilemenu->AddItem(new BMenuItem("New Terminal" B_UTF8_ELLIPSIS, new BMessage(MENU_NEW_TERM), 'N')); + + + // TODO: Tabs disabled until various problems are fixed. + // n. 1: calling "exit" from a tab closes the whole app. + //fFilemenu->AddItem(new BMenuItem("New Tab", new BMessage(kNewTab), 'T')); + fFilemenu->AddSeparatorItem(); fFilemenu->AddItem(new BMenuItem("Page Setup...", new BMessage(MENU_PAGE_SETUP))); fFilemenu->AddItem(new BMenuItem("Print", new BMessage(MENU_PRINT),'P')); @@ -286,6 +227,10 @@ be_app->PostMessage(MENU_SWITCH_TERM); break; } + case kNewTab: + _NewTab(NULL); + break; + case MENU_NEW_TERM: { app_info info; be_app->GetAppInfo(&info); @@ -325,7 +270,7 @@ if (!fFindSelection) message->FindString("findstring", &fFindString); else - fTermView->GetSelection(fFindString); + _ActiveTermView()->GetSelection(fFindString); if (fFindString.Length() == 0) { BAlert *alert = new BAlert("find failed", "No search string.", "Okay", NULL, @@ -339,7 +284,7 @@ message->FindBool("forwardsearch", &fForwardSearch); message->FindBool("matchcase", &fMatchCase); message->FindBool("matchword", &fMatchWord); - findresult = fTermView->Find(fFindString, fForwardSearch, fMatchCase, fMatchWord); + findresult = _ActiveTermView()->Find(fFindString, fForwardSearch, fMatchCase, fMatchWord); if (!findresult) { BAlert *alert = new BAlert("find failed", "Not Found.", "Okay", NULL, @@ -356,7 +301,7 @@ break; } case MENU_FIND_FORWARD: { - findresult = fTermView->Find(fFindString, true, fMatchCase, fMatchWord); + findresult = _ActiveTermView()->Find(fFindString, true, fMatchCase, fMatchWord); if (!findresult) { BAlert *alert = new BAlert("find failed", "Not Found.", "Okay", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); @@ -365,7 +310,7 @@ break; } case MENU_FIND_BACKWARD: { - findresult = fTermView->Find(fFindString, false, fMatchCase, fMatchWord); + findresult = _ActiveTermView()->Find(fFindString, false, fMatchCase, fMatchWord); if (!findresult) { BAlert *alert = new BAlert("find failed", "Not Found.", "Okay", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); @@ -379,14 +324,14 @@ case MENU_ENCODING: { message->FindInt32 ("op", &coding_id); - fTermView->SetEncoding(coding_id); + _ActiveTermView()->SetEncoding(coding_id); break; } // Message from Preference panel. case MSG_ROWS_CHANGED: case MSG_COLS_CHANGED: { - r = fTermView->SetTermSize (PrefHandler::Default()->getInt32 (PREF_ROWS), + r = _ActiveTermView()->SetTermSize (PrefHandler::Default()->getInt32 (PREF_ROWS), PrefHandler::Default()->getInt32 (PREF_COLS), 0); ResizeTo (r.Width()+ B_V_SCROLL_BAR_WIDTH + kViewOffset * 2, @@ -410,12 +355,12 @@ fullFont.SetSize (PrefHandler::Default()->getFloat(PREF_FULL_FONT_SIZE)); fullFont.SetSpacing (B_FIXED_SPACING); - fTermView->SetTermFont (&halfFont, &fullFont); - r = fTermView->SetTermSize (0, 0, 0); + _ActiveTermView()->SetTermFont (&halfFont, &fullFont); + r = _ActiveTermView()->SetTermSize (0, 0, 0); int width, height; - fTermView->GetFontSize (&width, &height); + _ActiveTermView()->GetFontSize (&width, &height); SetSizeLimits (MIN_COLS * width, MAX_COLS * width, MIN_COLS * height, MAX_COLS * height); @@ -423,7 +368,7 @@ ResizeTo (r.Width()+ B_V_SCROLL_BAR_WIDTH + kViewOffset * 2, r.Height()+fMenubar->Bounds().Height() + kViewOffset * 2); - fTermView->Invalidate(); + _ActiveTermView()->Invalidate(); break; } case EIGHTYTWENTYFOUR: { @@ -461,9 +406,9 @@ float mbHeight = fMenubar->Bounds().Height() + 1; fSavedFrame = Frame(); BScreen screen(this); - fTermView->ScrollBar()->Hide(); + _ActiveTermView()->ScrollBar()->Hide(); fMenubar->Hide(); - fTermView->ResizeBy(B_V_SCROLL_BAR_WIDTH, mbHeight); + _ActiveTermView()->ResizeBy(B_V_SCROLL_BAR_WIDTH, mbHeight); fSavedLook = Look(); // done before ResizeTo to work around a Dano bug (not erasing the decor) SetLook(B_NO_BORDER_WINDOW_LOOK); @@ -472,10 +417,10 @@ } else { // exit fullscreen float mbHeight = fMenubar->Bounds().Height() + 1; fMenubar->Show(); - fTermView->ScrollBar()->Show(); + _ActiveTermView()->ScrollBar()->Show(); ResizeTo(fSavedFrame.Width(), fSavedFrame.Height()); MoveTo(fSavedFrame.left, fSavedFrame.top); - fTermView->ResizeBy(-B_V_SCROLL_BAR_WIDTH, -mbHeight); + _ActiveTermView()->ResizeBy(-B_V_SCROLL_BAR_WIDTH, -mbHeight); SetLook(fSavedLook); fSavedFrame = BRect(0,0,-1,-1); } @@ -488,7 +433,7 @@ } case MSG_COLOR_CHANGED: { _SetTermColors(); - fTermView->Invalidate(); + _ActiveTermView()->Invalidate(); break; } case SAVE_AS_DEFAULT: { @@ -536,13 +481,13 @@ void TermWindow::_SetTermColors() { - fTermView->SetTextColor(PrefHandler::Default()->getRGB(PREF_TEXT_FORE_COLOR), + _ActiveTermView()->SetTextColor(PrefHandler::Default()->getRGB(PREF_TEXT_FORE_COLOR), PrefHandler::Default()->getRGB(PREF_TEXT_BACK_COLOR)); - fTermView->SetSelectColor(PrefHandler::Default()->getRGB(PREF_SELECT_FORE_COLOR), + _ActiveTermView()->SetSelectColor(PrefHandler::Default()->getRGB(PREF_SELECT_FORE_COLOR), PrefHandler::Default()->getRGB(PREF_SELECT_BACK_COLOR)); - fTermView->SetCursorColor(PrefHandler::Default()->getRGB(PREF_CURSOR_FORE_COLOR), + _ActiveTermView()->SetCursorColor(PrefHandler::Default()->getRGB(PREF_CURSOR_FORE_COLOR), PrefHandler::Default()->getRGB(PREF_CURSOR_BACK_COLOR)); } @@ -579,7 +524,7 @@ int pHeight = (int)pageRect.Height(); int pWidth = (int)pageRect.Width(); float w,h; - fTermView->GetFrameSize(&w, &h); + _ActiveTermView()->GetFrameSize(&w, &h); int xPages = (int)ceil(w / pWidth); int yPages = (int)ceil(h / pHeight); @@ -589,7 +534,7 @@ for (int x = 0; x < xPages; x++) { for (int y = 0; y < yPages; y++) { curPageRect.OffsetTo(x * pWidth, y * pHeight); - job.DrawView(fTermView, curPageRect, B_ORIGIN); + job.DrawView(_ActiveTermView(), curPageRect, B_ORIGIN); job.SpoolPage(); if (!job.CanContinue()){ @@ -610,9 +555,78 @@ void TermWindow::_NewTab(const char *command) { - TermView *view = new TermView(Bounds(), command); - fTabView->AddTab(view); + // Setup font. + + const char *family = PrefHandler::Default()->getString(PREF_HALF_FONT_FAMILY); + + BFont halfFont; + halfFont.SetFamilyAndStyle(family, NULL); + float size = PrefHandler::Default()->getFloat(PREF_HALF_FONT_SIZE); + if (size < 6.0f) + size = 6.0f; + halfFont.SetSize(size); + + family = PrefHandler::Default()->getString(PREF_FULL_FONT_FAMILY); + + BFont fullFont; + fullFont.SetFamilyAndStyle(family, NULL); + size = PrefHandler::Default()->getFloat(PREF_FULL_FONT_SIZE); + if (size < 6.0f) + size = 6.0f; + fullFont.SetSize(size); + fullFont.SetSpacing(B_FIXED_SPACING); + + // Make Terminal text view. + TermView *view = new TermView(BRect(0, 0, 10, 10), command); + + BScrollView *scrollView = new BScrollView("scrollView", view, B_FOLLOW_ALL, + B_WILL_DRAW|B_FRAME_EVENTS, false, true); + fTabView->AddTab(scrollView); + view->SetScrollBar(scrollView->ScrollBar(B_VERTICAL)); + + // TODO: Resize the vertical scrollbar to take the window gripping handle into account + // (shouldn't this be done in BScrollView itself ? At least BScrollBar does that). + scrollView->ScrollBar(B_VERTICAL)->ResizeBy(0, -13); + view->SetEncoding(longname2id(PrefHandler::Default()->getString(PREF_TEXT_ENCODING))); + view->SetTermFont(&halfFont, &fullFont); + + _SetTermColors(); + + BRect rect = view->SetTermSize(PrefHandler::Default()->getInt32(PREF_ROWS), + PrefHandler::Default()->getInt32(PREF_COLS), false); + + + // If it's the first time we're called, setup the window + if (fTabView->CountTabs() == 1) { + int width, height; + view->GetFontSize(&width, &height); + SetSizeLimits(MIN_COLS * width, MAX_COLS * width, + MIN_COLS * height, MAX_COLS * height); + + // Add offset to baseview. + rect.InsetBy(-kViewOffset, -kViewOffset); + + // Resize Window + ResizeTo(rect.Width()+ B_V_SCROLL_BAR_WIDTH, + rect.Height() + fMenubar->Bounds().Height()); + + // TODO: If I don't do this, the view won't show up. + // Bug in BTabView or in my code ? + fTabView->Select(0); + } + + // TODO: How do I set this for the current active tab, + // every time a different tab is chosen ? + fEditmenu->SetTargetForItems(view); } +TermView * +TermWindow::_ActiveTermView() +{ + // TODO: BAD HACK: + // We should probably use the observer api to tell + // the various "tabs" when settings are changed. Fix this. + return (TermView *)((BScrollView *)fTabView->ViewForTab(fTabView->Selection()))->Target(); +} Modified: haiku/trunk/src/apps/terminal/TermWindow.h =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.h 2007-08-02 13:04:27 UTC (rev 21789) +++ haiku/trunk/src/apps/terminal/TermWindow.h 2007-08-02 13:17:23 UTC (rev 21790) @@ -60,6 +60,7 @@ status_t _DoPageSetup(); void _DoPrint(); void _NewTab(const char *command); + TermView* _ActiveTermView(); SmartTabView *fTabView; TermView *fTermView; From axeld at pinc-software.de Thu Aug 2 17:35:09 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Thu, 02 Aug 2007 17:35:09 +0200 Subject: [Haiku-commits] r21790 - haiku/trunk/src/apps/terminal In-Reply-To: <200708021317.l72DHNf3004714@sheep.berlios.de> Message-ID: <8389746148-BeMail@ibm> jackburton at BerliOS wrote: > Log: > Implemented tabbed terminal (with a couple of bad hacks which will go > away soon, hopefully). The menuitem to open a new tab is still > disabled, until I figure out how to catch the exit signal... HELP ? Who exactly is sending an exit signal? If it is you, you might just want to change how that mechanism works. Otherwise, have a look at sigaction(): http://www.opengroup.org/onlinepubs/009695399/toc.htm Just keep in mind that if you're catching this signal, nobody else will be able to send it to you either :-) Bye, Axel. From stippi at mail.berlios.de Thu Aug 2 18:23:49 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 2 Aug 2007 18:23:49 +0200 Subject: [Haiku-commits] r21791 - in haiku/trunk/src: kits/storage kits/tracker tests/servers/registrar Message-ID: <200708021623.l72GNnMa013136@sheep.berlios.de> Author: stippi Date: 2007-08-02 18:23:49 +0200 (Thu, 02 Aug 2007) New Revision: 21791 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21791&view=rev Modified: haiku/trunk/src/kits/storage/LibBeAdapter.cpp haiku/trunk/src/kits/tracker/FSUtils.cpp haiku/trunk/src/tests/servers/registrar/Jamfile Log: * fix the build of the app_server test environment (libbe_test) after the change to the nodemonitor syscall Modified: haiku/trunk/src/kits/storage/LibBeAdapter.cpp =================================================================== --- haiku/trunk/src/kits/storage/LibBeAdapter.cpp 2007-08-02 13:17:23 UTC (rev 21790) +++ haiku/trunk/src/kits/storage/LibBeAdapter.cpp 2007-08-02 16:23:49 UTC (rev 21791) @@ -125,10 +125,8 @@ status_t -_kern_stop_watching(dev_t device, ino_t node, uint32 flags, - port_id port, uint32 token) +_kern_stop_watching(dev_t device, ino_t node, port_id port, uint32 token) { - (void)flags; return _kstop_watching_vnode_(device, node, port, token); } Modified: haiku/trunk/src/kits/tracker/FSUtils.cpp =================================================================== --- haiku/trunk/src/kits/tracker/FSUtils.cpp 2007-08-02 13:17:23 UTC (rev 21790) +++ haiku/trunk/src/kits/tracker/FSUtils.cpp 2007-08-02 16:23:49 UTC (rev 21791) @@ -2891,7 +2891,7 @@ extern "C" char** environ; -#ifdef __HAIKU__ +#ifdef HAIKU_TARGET_PLATFORM_HAIKU extern "C" status_t _kern_load_image(int32 argCount, const char **args, int32 envCount, const char **env, int32 priority, uint32 flags, port_id errorPort, uint32 errorToken); @@ -2917,7 +2917,7 @@ char *argv[2] = { const_cast(path.Path()), 0}; -#ifdef __HAIKU__ +#ifdef HAIKU_TARGET_PLATFORM_HAIKU port_id errorPort = create_port(1, "Tracker loader error"); // count environment variables Modified: haiku/trunk/src/tests/servers/registrar/Jamfile =================================================================== --- haiku/trunk/src/tests/servers/registrar/Jamfile 2007-08-02 13:17:23 UTC (rev 21790) +++ haiku/trunk/src/tests/servers/registrar/Jamfile 2007-08-02 16:23:49 UTC (rev 21791) @@ -85,7 +85,6 @@ PriorityMessageQueue.cpp RecentApps.cpp RecentEntries.cpp - Referenceable.cpp Registrar.cpp RosterAppInfo.cpp RosterSettingsCharStream.cpp From stippi at mail.berlios.de Thu Aug 2 18:28:36 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 2 Aug 2007 18:28:36 +0200 Subject: [Haiku-commits] r21792 - in haiku/trunk: headers/private/shared src/kits/shared Message-ID: <200708021628.l72GSaBf013617@sheep.berlios.de> Author: stippi Date: 2007-08-02 18:28:34 +0200 (Thu, 02 Aug 2007) New Revision: 21792 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21792&view=rev Added: haiku/trunk/headers/private/shared/HashMap.h haiku/trunk/headers/private/shared/HashString.h haiku/trunk/headers/private/shared/OpenHashTable.h haiku/trunk/src/kits/shared/HashString.cpp Modified: haiku/trunk/src/kits/shared/Jamfile Log: * put some more useful utility classes into "shared". I tried to make sure that OpenHashTable.h does not collide with all the other places that this is used, it seems everything still builds fine. Most problematic could be the OpenHashTable.h at kernel/util, but it seems it the target using that are not affected. Added: haiku/trunk/headers/private/shared/HashMap.h =================================================================== --- haiku/trunk/headers/private/shared/HashMap.h 2007-08-02 16:23:49 UTC (rev 21791) +++ haiku/trunk/headers/private/shared/HashMap.h 2007-08-02 16:28:34 UTC (rev 21792) @@ -0,0 +1,450 @@ +// HashMap.h +// +// Copyright (c) 2004-2007, Ingo Weinhold (bonefish at cs.tu-berlin.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. +// +// Except as contained in this notice, the name of a copyright holder shall +// not be used in advertising or otherwise to promote the sale, use or other +// dealings in this Software without prior written authorization of the +// copyright holder. + +#ifndef HASH_MAP_H +#define HASH_MAP_H + +//#include +#include + +#include "AutoLocker.h" +#include "OpenHashTable.h" + +namespace BPrivate { + +// HashMapElement +template +class HashMapElement : public OpenHashElement { +private: + typedef HashMapElement Element; +public: + + HashMapElement() : OpenHashElement(), fKey(), fValue() + { + fNext = -1; + } + + inline uint32 Hash() const + { + return fKey.GetHashCode(); + } + + inline bool operator==(const OpenHashElement &_element) const + { + const Element &element = static_cast(_element); + return (fKey == element.fKey); + } + + inline void Adopt(Element &element) + { + fKey = element.fKey; + fValue = element.fValue; + } + + Key fKey; + Value fValue; +}; + +// HashMap +template +class HashMap { +public: + class Entry { + public: + Entry() {} + Entry(const Key& key, Value value) : key(key), value(value) {} + + Key key; + Value value; + }; + + class Iterator { + private: + typedef HashMapElement Element; + public: + Iterator(const Iterator& other) + : fMap(other.fMap), + fIndex(other.fIndex), + fElement(other.fElement), + fLastElement(other.fElement) + { + } + + bool HasNext() const + { + return fElement; + } + + Entry Next() + { + if (!fElement) + return Entry(); + Entry result(fElement->fKey, fElement->fValue); + _FindNext(); + return result; + } + + Entry Remove() + { + if (!fLastElement) + return Entry(); + Entry result(fLastElement->fKey, fLastElement->fValue); + fMap->fTable.Remove(fLastElement, true); + fLastElement = NULL; + return result; + } + + Iterator& operator=(const Iterator& other) + { + fMap = other.fMap; + fIndex = other.fIndex; + fElement = other.fElement; + fLastElement = other.fLastElement; + return *this; + } + + private: + Iterator(const HashMap* map) + : fMap(const_cast*>(map)), + fIndex(0), + fElement(NULL), + fLastElement(NULL) + { + // find first + _FindNext(); + } + + void _FindNext() + { + fLastElement = fElement; + if (fElement && fElement->fNext >= 0) { + fElement = fMap->fTable.ElementAt(fElement->fNext); + return; + } + fElement = NULL; + int32 arraySize = fMap->fTable.ArraySize(); + for (; !fElement && fIndex < arraySize; fIndex++) + fElement = fMap->fTable.FindFirst(fIndex); + } + + private: + friend class HashMap; + + HashMap* fMap; + int32 fIndex; + Element* fElement; + Element* fLastElement; + }; + + HashMap(); + ~HashMap(); + + status_t InitCheck() const; + + status_t Put(const Key& key, Value value); + Value Remove(const Key& key); + void Clear(); + Value Get(const Key& key) const; + + bool ContainsKey(const Key& key) const; + + int32 Size() const; + + Iterator GetIterator() const; + +protected: + typedef HashMapElement Element; + friend class Iterator; + +private: + Element *_FindElement(const Key& key) const; + +protected: + OpenHashElementArray fElementArray; + OpenHashTable > fTable; +}; + +// SynchronizedHashMap +template +class SynchronizedHashMap : public BLocker { +public: + typedef HashMap::Entry Entry; + typedef HashMap::Iterator Iterator; + + SynchronizedHashMap() : BLocker("synchronized hash map") {} + ~SynchronizedHashMap() { Lock(); } + + status_t InitCheck() const + { + return fMap.InitCheck(); + } + + status_t Put(const Key& key, Value value) + { + MapLocker locker(this); + if (!locker.IsLocked()) + return B_ERROR; + return fMap.Put(key, value); + } + + Value Remove(const Key& key) + { + MapLocker locker(this); + if (!locker.IsLocked()) + return Value(); + return fMap.Remove(key); + } + + void Clear() + { + MapLocker locker(this); + return fMap.Clear(); + } + + Value Get(const Key& key) const + { + const BLocker* lock = this; + MapLocker locker(const_cast(lock)); + if (!locker.IsLocked()) + return Value(); + return fMap.Get(key); + } + + bool ContainsKey(const Key& key) const + { + const BLocker* lock = this; + MapLocker locker(const_cast(lock)); + if (!locker.IsLocked()) + return false; + return fMap.ContainsKey(key); + } + + int32 Size() const + { + const BLocker* lock = this; + MapLocker locker(const_cast(lock)); + return fMap.Size(); + } + + Iterator GetIterator() + { + return fMap.GetIterator(); + } + + // for debugging only + const HashMap& GetUnsynchronizedMap() const { return fMap; } + HashMap& GetUnsynchronizedMap() { return fMap; } + +protected: + typedef AutoLocker MapLocker; + + HashMap fMap; +}; + +// HashKey32 +template +struct HashKey32 { + HashKey32() {} + HashKey32(const Value& value) : value(value) {} + + uint32 GetHashCode() const + { + return (uint32)value; + } + + HashKey32 operator=(const HashKey32& other) + { + value = other.value; + return *this; + } + + bool operator==(const HashKey32& other) const + { + return (value == other.value); + } + + bool operator!=(const HashKey32& other) const + { + return (value != other.value); + } + + Value value; +}; + + +// HashKey64 +template +struct HashKey64 { + HashKey64() {} + HashKey64(const Value& value) : value(value) {} + + uint32 GetHashCode() const + { + uint64 v = (uint64)value; + return (uint32)(v >> 32) ^ (uint32)v; + } + + HashKey64 operator=(const HashKey64& other) + { + value = other.value; + return *this; + } + + bool operator==(const HashKey64& other) const + { + return (value == other.value); + } + + bool operator!=(const HashKey64& other) const + { + return (value != other.value); + } + + Value value; +}; + + +// HashMap + +// constructor +template +HashMap::HashMap() + : fElementArray(1000), + fTable(1000, &fElementArray) +{ +} + +// destructor +template +HashMap::~HashMap() +{ +} + +// InitCheck +template +status_t +HashMap::InitCheck() const +{ + return (fTable.InitCheck() && fElementArray.InitCheck() + ? B_OK : B_NO_MEMORY); +} + +// Put +template +status_t +HashMap::Put(const Key& key, Value value) +{ + Element* element = _FindElement(key); + if (element) { + // already contains the key: just set the new value + element->fValue = value; + return B_OK; + } + // does not contain the key yet: add an element + element = fTable.Add(key.GetHashCode()); + if (!element) + return B_NO_MEMORY; + element->fKey = key; + element->fValue = value; + return B_OK; +} + +// Remove +template +Value +HashMap::Remove(const Key& key) +{ + Value value = Value(); + if (Element* element = _FindElement(key)) { + value = element->fValue; + fTable.Remove(element); + } + return value; +} + +// Clear +template +void +HashMap::Clear() +{ + fTable.RemoveAll(); +} + +// Get +template +Value +HashMap::Get(const Key& key) const +{ + if (Element* element = _FindElement(key)) + return element->fValue; + return Value(); +} + +// ContainsKey +template +bool +HashMap::ContainsKey(const Key& key) const +{ + return _FindElement(key); +} + +// Size +template +int32 +HashMap::Size() const +{ + return fTable.CountElements(); +} + +// GetIterator +template +HashMap::Iterator +HashMap::GetIterator() const +{ + return Iterator(this); +} + +// _FindElement +template +HashMap::Element * +HashMap::_FindElement(const Key& key) const +{ + Element* element = fTable.FindFirst(key.GetHashCode()); + while (element && element->fKey != key) { + if (element->fNext >= 0) + element = fTable.ElementAt(element->fNext); + else + element = NULL; + } + return element; +} + +} // namespace BPrivate + +using BPrivate::HashMap; + +#endif // HASH_MAP_H Added: haiku/trunk/headers/private/shared/HashString.h =================================================================== --- haiku/trunk/headers/private/shared/HashString.h 2007-08-02 16:23:49 UTC (rev 21791) +++ haiku/trunk/headers/private/shared/HashString.h 2007-08-02 16:28:34 UTC (rev 21792) @@ -0,0 +1,69 @@ +/* + * Copyright 2004-2007, Ingo Weinhold, bonefish at users.sf.net. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef HASH_STRING_H +#define HASH_STRING_H + +#include + +// string_hash +// +// from the Dragon Book: a slightly modified hashpjw() +static inline +uint32 +string_hash(const char *name) +{ + uint32 h = 0; + if (name) { + for (; *name; name++) { + uint32 g = h & 0xf0000000; + if (g) + h ^= g >> 24; + h = (h << 4) + *name; + } + } + return h; +} + +#ifdef __cplusplus + +namespace BPrivate { + +// HashString +class HashString { +public: + HashString(); + HashString(const HashString &string); + HashString(const char *string, int32 length = -1); + ~HashString(); + + bool SetTo(const char *string, int32 maxLength = -1); + void Unset(); + + void Truncate(int32 newLength); + + const char *GetString() const; + int32 GetLength() const { return fLength; } + + uint32 GetHashCode() const { return string_hash(GetString()); } + + HashString &operator=(const HashString &string); + bool operator==(const HashString &string) const; + bool operator!=(const HashString &string) const { return !(*this == string); } + +private: + bool _SetTo(const char *string, int32 length); + +private: + int32 fLength; + char *fString; +}; + +} // namespace BPrivate + +using BPrivate::HashString; + +#endif // __cplusplus + +#endif // HASH_STRING_H Added: haiku/trunk/headers/private/shared/OpenHashTable.h =================================================================== --- haiku/trunk/headers/private/shared/OpenHashTable.h 2007-08-02 16:23:49 UTC (rev 21791) +++ haiku/trunk/headers/private/shared/OpenHashTable.h 2007-08-02 16:28:34 UTC (rev 21792) @@ -0,0 +1,510 @@ +/* +Open Tracker License + +Terms and Conditions + +Copyright (c) 1991-2000, Be Incorporated. All rights reserved. + +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 applies to all licensees +and 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 TITLE, MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +BE INCORPORATED 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. + +Except as contained in this notice, the name of Be Incorporated shall not be +used in advertising or otherwise to promote the sale, use or other dealings in +this Software without prior written authorization from Be Incorporated. + +Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks +of Be Incorporated in the United States and other countries. Other brand product +names are registered trademarks or trademarks of their respective holders. +All rights reserved. +*/ + +// bonefish: +// * removed need for exceptions +// * fixed warnings +// * implemented rehashing +// * added RemoveAll() +// TODO: +// * shrinking of element vectors + +// Hash table with open addresssing + +#ifndef __OPEN_HASH_TABLE__ +#define __OPEN_HASH_TABLE__ + +#include +#include + +// don't include +#define ASSERT(E) (void)0 +#define TRESPASS() (void)0 + +namespace BPrivate { + +template +class ElementVector { + // element vector for OpenHashTable needs to implement this + // interface +public: + Element &At(int32 index); + Element *Add(); + int32 IndexOf(const Element &) const; + void Remove(int32 index); +}; + +class OpenHashElement { +public: + uint32 Hash() const; + bool operator==(const OpenHashElement &) const; + void Adopt(OpenHashElement &); + // low overhead copy, original element is in undefined state + // after call (calls Adopt on BString members, etc.) + int32 fNext; +}; + +const uint32 kPrimes [] = { + 509, 1021, 2039, 4093, 8191, 16381, 32749, 65521, 131071, 262139, + 524287, 1048573, 2097143, 4194301, 8388593, 16777213, 33554393, 67108859, + 134217689, 268435399, 536870909, 1073741789, 2147483647, 0 +}; + +template > +class OpenHashTable { +public: + OpenHashTable(int32 minSize, ElementVec *elementVector = 0, + float maxLoadFactor = 0.8); + // it is up to the subclass of OpenHashTable to supply + // elementVector + ~OpenHashTable(); + + bool InitCheck() const; + + void SetElementVector(ElementVec *elementVector); + + Element *FindFirst(uint32 elementHash) const; + Element *Add(uint32 elementHash); + + void Remove(Element *element, bool dontRehash = false); + void RemoveAll(); + + // when calling Add, any outstanding element pointer may become + // invalid; to deal with this, get the element index and restore + // it after the add + int32 ElementIndex(const Element *) const; + Element *ElementAt(int32 index) const; + + int32 ArraySize() const; + int32 VectorSize() const; + int32 CountElements() const; + +protected: + static int32 OptimalSize(int32 minSize); + +private: + bool _RehashIfNeeded(); + bool _Rehash(); + + int32 fArraySize; + int32 fInitialSize; + int32 fElementCount; + int32 *fHashArray; + ElementVec *fElementVector; + float fMaxLoadFactor; +}; + +template +class OpenHashElementArray : public ElementVector { + // this is a straightforward implementation of an element vector + // deleting is handled by linking deleted elements into a free list + // the vector never shrinks +public: + OpenHashElementArray(int32 initialSize); + ~OpenHashElementArray(); + + bool InitCheck() const; + + Element &At(int32 index); + const Element &At(int32 index) const; + Element *Add(const Element &); + Element *Add(); + void Remove(int32 index); + int32 IndexOf(const Element &) const; + int32 Size() const; + +private: + Element *fData; + int32 fSize; + int32 fNextFree; + int32 fNextDeleted; +}; + + +//----------------------------------- + +template +OpenHashTable::OpenHashTable(int32 minSize, + ElementVec *elementVector, float maxLoadFactor) + : fArraySize(OptimalSize(minSize)), + fInitialSize(fArraySize), + fElementCount(0), + fElementVector(elementVector), + fMaxLoadFactor(maxLoadFactor) +{ + // sanity check the maximal load factor + if (fMaxLoadFactor < 0.5) + fMaxLoadFactor = 0.5; + // allocate and init the array + fHashArray = (int32*)calloc(fArraySize, sizeof(int32)); + if (fHashArray) { + for (int32 index = 0; index < fArraySize; index++) + fHashArray[index] = -1; + } +} + +template +OpenHashTable::~OpenHashTable() +{ + RemoveAll(); + free(fHashArray); +} + +template +bool +OpenHashTable::InitCheck() const +{ + return (fHashArray && fElementVector); +} + +template +int32 +OpenHashTable::OptimalSize(int32 minSize) +{ + for (int32 index = 0; ; index++) + if (!kPrimes[index] || kPrimes[index] >= (uint32)minSize) + return (int32)kPrimes[index]; + + return 0; +} + +template +Element * +OpenHashTable::FindFirst(uint32 hash) const +{ + ASSERT(fElementVector); + hash %= fArraySize; + if (fHashArray[hash] < 0) + return 0; + + return &fElementVector->At(fHashArray[hash]); +} + +template +int32 +OpenHashTable::ElementIndex(const Element *element) const +{ + return fElementVector->IndexOf(*element); +} + +template +Element * +OpenHashTable::ElementAt(int32 index) const +{ + return &fElementVector->At(index); +} + +template +int32 +OpenHashTable::ArraySize() const +{ + return fArraySize; +} + +template +int32 +OpenHashTable::VectorSize() const +{ + return fElementVector->Size(); +} + +template +int32 +OpenHashTable::CountElements() const +{ + return fElementCount; +} + + +template +Element * +OpenHashTable::Add(uint32 hash) +{ + ASSERT(fElementVector); + _RehashIfNeeded(); + hash %= fArraySize; + Element *result = fElementVector->Add(); + if (result) { + result->fNext = fHashArray[hash]; + fHashArray[hash] = fElementVector->IndexOf(*result); + fElementCount++; + } + return result; +} + +template +void +OpenHashTable::Remove(Element *element, bool dontRehash) +{ + if (!dontRehash) + _RehashIfNeeded(); + uint32 hash = element->Hash() % fArraySize; + int32 next = fHashArray[hash]; + ASSERT(next >= 0); + + if (&fElementVector->At(next) == element) { + fHashArray[hash] = element->fNext; + fElementVector->Remove(next); + fElementCount--; + return; + } + + for (int32 index = next; index >= 0; ) { + // look for an existing match in table + next = fElementVector->At(index).fNext; + if (next < 0) { + TRESPASS(); + return; + } + + if (&fElementVector->At(next) == element) { + fElementVector->At(index).fNext = element->fNext; + fElementVector->Remove(next); + fElementCount--; + return; + } + index = next; + } +} + +template +void +OpenHashTable::RemoveAll() +{ + for (int32 i = 0; fElementCount > 0 && i < fArraySize; i++) { + int32 index = fHashArray[i]; + while (index >= 0) { + Element* element = &fElementVector->At(index); + int32 next = element->fNext; + fElementVector->Remove(index); + fElementCount--; + index = next; + } + fHashArray[i] = -1; + } + _RehashIfNeeded(); +} + +template +void +OpenHashTable::SetElementVector(ElementVec *elementVector) +{ + fElementVector = elementVector; +} + +// _RehashIfNeeded +template +bool +OpenHashTable::_RehashIfNeeded() +{ + // The load factor range [fMaxLoadFactor / 3, fMaxLoadFactor] is fine, + // I think. After rehashing the load factor will be about + // fMaxLoadFactor * 2 / 3, respectively fMaxLoadFactor / 2. + float loadFactor = (float)fElementCount / (float)fArraySize; + if (loadFactor > fMaxLoadFactor + || (fArraySize > fInitialSize && loadFactor < fMaxLoadFactor / 3)) { + return _Rehash(); + } + return true; +} + +// _Rehash +template +bool +OpenHashTable::_Rehash() +{ + bool result = true; + int32 newSize = int32(fElementCount * 1.73 * fMaxLoadFactor); + newSize = (fInitialSize > newSize ? fInitialSize : newSize); + if (newSize != fArraySize) { + // allocate a new array + int32 *newHashArray = (int32*)calloc(newSize, sizeof(int32)); + if (newHashArray) { + // init the new hash array + for (int32 index = 0; index < newSize; index++) + newHashArray[index] = -1; + // iterate through all elements and put them into the new + // hash array + for (int i = 0; i < fArraySize; i++) { + int32 index = fHashArray[i]; + while (index >= 0) { + // insert the element in the new array + Element &element = fElementVector->At(index); + int32 next = element.fNext; + uint32 hash = (element.Hash() % newSize); + element.fNext = newHashArray[hash]; + newHashArray[hash] = index; + // next element in old list + index = next; + } + } + // delete the old array and set the new one + free(fHashArray); + fHashArray = newHashArray; + fArraySize = newSize; + } else + result = false; + } + return result; +} + + +template +OpenHashElementArray::OpenHashElementArray(int32 initialSize) + : fSize(initialSize), + fNextFree(0), + fNextDeleted(-1) +{ + fData = (Element*)calloc((size_t)initialSize, sizeof(Element)); +} + +template +OpenHashElementArray::~OpenHashElementArray() +{ + free(fData); +} + +template +bool +OpenHashElementArray::InitCheck() const +{ + return fData; +} + +template +Element & +OpenHashElementArray::At(int32 index) +{ + ASSERT(index < fSize); + return fData[index]; +} + +template +const Element & +OpenHashElementArray::At(int32 index) const +{ + ASSERT(index < fSize); + return fData[index]; +} + +template +int32 +OpenHashElementArray::IndexOf(const Element &element) const +{ + int32 result = &element - fData; + if (result < 0 || result > fSize) + return -1; + + return result; +} + +template +int32 +OpenHashElementArray::Size() const +{ + return fSize; +} + + +template +Element * +OpenHashElementArray::Add(const Element &newElement) +{ + Element *element = Add(); + if (element) + element.Adopt(newElement); + return element; +} + +#if DEBUG +const int32 kGrowChunk = 10; +#else +const int32 kGrowChunk = 1024; +#endif + +template +Element * +OpenHashElementArray::Add() +{ + int32 index = fNextFree; + if (fNextDeleted >= 0) { + index = fNextDeleted; + fNextDeleted = At(index).fNext; + } else if (fNextFree >= fSize - 1) { [... truncated: 202 lines follow ...] From axeld at mail.berlios.de Thu Aug 2 18:55:46 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 2 Aug 2007 18:55:46 +0200 Subject: [Haiku-commits] r21793 - haiku/trunk/src/apps/terminal Message-ID: <200708021655.l72Gtk4h022161@sheep.berlios.de> Author: axeld Date: 2007-08-02 18:55:44 +0200 (Thu, 02 Aug 2007) New Revision: 21793 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21793&view=rev Modified: haiku/trunk/src/apps/terminal/Shell.cpp haiku/trunk/src/apps/terminal/TermApp.cpp haiku/trunk/src/apps/terminal/TermBuffer.cpp Log: Fixed the build under BeOS/Dano: * setenv() actually exists in Dano. * On R5, it now uses sprintf() - the previous version would not compile. * Cleaned some weird code in TermBuffer.cpp to set the "buf" variable to the end of the string - it also no longer uses the index() BSD extension (same as strchr()). Modified: haiku/trunk/src/apps/terminal/Shell.cpp =================================================================== --- haiku/trunk/src/apps/terminal/Shell.cpp 2007-08-02 16:28:34 UTC (rev 21792) +++ haiku/trunk/src/apps/terminal/Shell.cpp 2007-08-02 16:55:44 UTC (rev 21793) @@ -86,7 +86,7 @@ /* * Set environment variable. */ -#if !defined(__HAIKU__) || defined(HAIKU_TARGET_PLATFORM_LIBBE_TEST) +#if defined(HAIKU_TARGET_PLATFORM_BEOS) || defined(HAIKU_TARGET_PLATFORM_LIBBE_TEST) extern char **environ; @@ -102,7 +102,7 @@ /* found it */ if (overwrite) { environ[envindex] = (char *)malloc((unsigned)len + val_len + 2); - snprintf(environ[envindex], "%s=%s", var, value); + sprintf(environ[envindex], "%s=%s", var, value); } return 0; } Modified: haiku/trunk/src/apps/terminal/TermApp.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermApp.cpp 2007-08-02 16:28:34 UTC (rev 21792) +++ haiku/trunk/src/apps/terminal/TermApp.cpp 2007-08-02 16:55:44 UTC (rev 21793) @@ -25,6 +25,7 @@ #include #include +#include static bool sUsageRequested = false; Modified: haiku/trunk/src/apps/terminal/TermBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermBuffer.cpp 2007-08-02 16:28:34 UTC (rev 21792) +++ haiku/trunk/src/apps/terminal/TermBuffer.cpp 2007-08-02 16:55:44 UTC (rev 21793) @@ -200,7 +200,7 @@ if (ptr->attr != (ptr + 1)->attr) return all_count; - buf = (uchar *)index((char *)buf, 0x00); + buf += strlen((char *)buf); ptr++; col++; From axeld at mail.berlios.de Thu Aug 2 19:21:12 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 2 Aug 2007 19:21:12 +0200 Subject: [Haiku-commits] r21794 - haiku/trunk/src/apps/terminal Message-ID: <200708021721.l72HLCoP003738@sheep.berlios.de> Author: axeld Date: 2007-08-02 19:21:12 +0200 (Thu, 02 Aug 2007) New Revision: 21794 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21794&view=rev Modified: haiku/trunk/src/apps/terminal/Shell.cpp haiku/trunk/src/apps/terminal/SmartTabView.h haiku/trunk/src/apps/terminal/TermParse.cpp haiku/trunk/src/apps/terminal/TermView.cpp Log: * The PtyReader thread now just exits when there is no more left to be read. * setpgid() when spawning the shell was superfluous, as we're already the session leader. * Added a comment to TermView::NotifyQuit() about why sending B_QUIT_REQUESTED to the window isn't such a good idea when you have more than one use for it. Modified: haiku/trunk/src/apps/terminal/Shell.cpp =================================================================== --- haiku/trunk/src/apps/terminal/Shell.cpp 2007-08-02 16:55:44 UTC (rev 21793) +++ haiku/trunk/src/apps/terminal/Shell.cpp 2007-08-02 17:21:12 UTC (rev 21794) @@ -345,7 +345,6 @@ return B_ERROR; } - handshake_t handshake; if (fProcessID == 0) { @@ -489,21 +488,9 @@ ioctl(0, TIOCSWINSZ, &ws); - /* - * Set process group ID to process, and Terminal Process group ID - * to this process group ID (equal process ID). - */ + tcsetpgrp(0, getpgrp()); + // set this process group ID as the controlling terminal - pid_t processGroup = getpid(); - if (setpgid(processGroup, processGroup) < 0) { - handshake.status = PTY_NG; - snprintf(handshake.msg, sizeof(handshake.msg), - "can't set process group id."); - send_handshake_message(terminalThread, handshake); - exit(1); - } - tcsetpgrp(0, processGroup); - /* pty open and set termios successful. */ handshake.status = PTY_OK; send_handshake_message(terminalThread, handshake); Modified: haiku/trunk/src/apps/terminal/SmartTabView.h =================================================================== --- haiku/trunk/src/apps/terminal/SmartTabView.h 2007-08-02 16:55:44 UTC (rev 21793) +++ haiku/trunk/src/apps/terminal/SmartTabView.h 2007-08-02 17:21:12 UTC (rev 21794) @@ -5,7 +5,6 @@ * Authors: * Stefano Ceccherini (burton666 at libero.it) */ - #ifndef __SMARTTABVIEW_H #define __SMARTTABVIEW_H Modified: haiku/trunk/src/apps/terminal/TermParse.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.cpp 2007-08-02 16:55:44 UTC (rev 21793) +++ haiku/trunk/src/apps/terminal/TermParse.cpp 2007-08-02 17:21:12 UTC (rev 21794) @@ -258,10 +258,7 @@ int nread = read(fFd, buf, READ_BUF_SIZE - (read_p - fBufferPosition)); if (nread <= 0) { fView->NotifyQuit(errno); - // on the next iteration, fQuitting will probably be true, - // or the semaphore acquisition will fail, so this thread will - // be killed anyway. - continue; + return B_OK; } // Copy read string to PtyBuffer. Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2007-08-02 16:55:44 UTC (rev 21793) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2007-08-02 17:21:12 UTC (rev 21794) @@ -2454,7 +2454,8 @@ TermView::NotifyQuit(int32 reason) { // TODO: If we are a replicant, we can't just quit the BWindow, no?. - Window()->PostMessage(B_QUIT_REQUESTED); + // Exactly, and the same is true for tabs! + Window()->PostMessage(B_QUIT_REQUESTED); } From korli at mail.berlios.de Thu Aug 2 19:50:17 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Thu, 2 Aug 2007 19:50:17 +0200 Subject: [Haiku-commits] r21795 - in haiku/trunk: build/jam src/add-ons/kernel/partitioning_systems/intel Message-ID: <200708021750.l72HoH5P005382@sheep.berlios.de> Author: korli Date: 2007-08-02 19:50:17 +0200 (Thu, 02 Aug 2007) New Revision: 21795 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21795&view=rev Modified: haiku/trunk/build/jam/BuildSetup haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/intel.cpp Log: reverted r21757 which is now fixed by the following added $(HAIKU_GCC_LIBGCC) to HAIKU_KERNEL_ADDON_END_GLUE_CODE as suggested by Ingo Modified: haiku/trunk/build/jam/BuildSetup =================================================================== --- haiku/trunk/build/jam/BuildSetup 2007-08-02 17:21:12 UTC (rev 21794) +++ haiku/trunk/build/jam/BuildSetup 2007-08-02 17:50:17 UTC (rev 21795) @@ -306,7 +306,7 @@ ; HAIKU_EXECUTABLE_END_GLUE_CODE = $(HAIKU_LIBRARY_END_GLUE_CODE) ; HAIKU_KERNEL_ADDON_BEGIN_GLUE_CODE = crtbegin.o ; -HAIKU_KERNEL_ADDON_END_GLUE_CODE = crtend.o ; +HAIKU_KERNEL_ADDON_END_GLUE_CODE = $(HAIKU_GCC_LIBGCC) crtend.o ; SEARCH on crtbegin.o crtend.o = $(HAIKU_GCC_LIB_DIR) ; @@ -747,7 +747,7 @@ # common stuff -# start with a clean slate +# start with a clean state CCFLAGS = ; C++FLAGS = ; DEFINES = ; Modified: haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/intel.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/intel.cpp 2007-08-02 17:21:12 UTC (rev 21794) +++ haiku/trunk/src/add-ons/kernel/partitioning_systems/intel/intel.cpp 2007-08-02 17:50:17 UTC (rev 21795) @@ -1542,7 +1542,7 @@ return error; fromOffset += buffer_size; toOffset += buffer_size; - update_disk_device_job_progress(job, i * 1.0 / cycleCount); + update_disk_device_job_progress(job, (float)i / cycleCount); } if (remainingSize) error = move_block(fd, fromOffset, toOffset, buffer, remainingSize); From stippi at mail.berlios.de Thu Aug 2 20:32:00 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 2 Aug 2007 20:32:00 +0200 Subject: [Haiku-commits] r21796 - haiku/trunk/src/apps/fontdemo Message-ID: <200708021832.l72IW0SE008856@sheep.berlios.de> Author: stippi Date: 2007-08-02 20:32:00 +0200 (Thu, 02 Aug 2007) New Revision: 21796 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21796&view=rev Modified: haiku/trunk/src/apps/fontdemo/FontDemoView.cpp Log: * I was trying to debug my new font stuff in the app_server for about an hour before I realized that it was FontDemo which was broken. It was easy to tell once I ran it on R5 for comparison... :-\ Modified: haiku/trunk/src/apps/fontdemo/FontDemoView.cpp =================================================================== --- haiku/trunk/src/apps/fontdemo/FontDemoView.cpp 2007-08-02 17:50:17 UTC (rev 21795) +++ haiku/trunk/src/apps/fontdemo/FontDemoView.cpp 2007-08-02 18:32:00 UTC (rev 21796) @@ -141,12 +141,8 @@ xCoordArray[i] += xCenter; yCoordArray[i] += yCoord; - boundBoxes[i].left = xCoordArray[i] + edgeInfo[i].left * FontSize(); - boundBoxes[i].right = boundBoxes[i].left + width; + boundBoxes[i].OffsetBy(xCoordArray[i], yCoordArray[i]); - boundBoxes[i].bottom = yCoordArray[i]; - boundBoxes[i].top = boundBoxes[i].bottom - height; - if (OutLineLevel()) { view->MovePenTo(xCoordArray[i], yCoordArray[i]); view->SetHighColor(ui_color(B_PANEL_BACKGROUND_COLOR)); From stippi at mail.berlios.de Thu Aug 2 21:10:43 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 2 Aug 2007 21:10:43 +0200 Subject: [Haiku-commits] r21797 - in haiku/trunk: headers/os/interface headers/private/app src/kits/interface src/servers/app src/servers/app/drawing src/servers/app/drawing/Painter src/servers/app/drawing/Painter/font_support src/tests/servers/app Message-ID: <200708021910.l72JAheH010598@sheep.berlios.de> Author: stippi Date: 2007-08-02 21:10:38 +0200 (Thu, 02 Aug 2007) New Revision: 21797 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21797&view=rev Added: haiku/trunk/src/servers/app/FontCache.cpp haiku/trunk/src/servers/app/FontCache.h haiku/trunk/src/servers/app/FontCacheEntry.cpp haiku/trunk/src/servers/app/FontCacheEntry.h haiku/trunk/src/servers/app/FontEngine.cpp haiku/trunk/src/servers/app/FontEngine.h haiku/trunk/src/servers/app/GlyphLayoutEngine.h Removed: haiku/trunk/src/servers/app/drawing/Painter/font_support/agg_font_freetype.cpp haiku/trunk/src/servers/app/drawing/Painter/font_support/agg_font_freetype.h Modified: haiku/trunk/headers/os/interface/Font.h haiku/trunk/headers/private/app/ServerProtocol.h haiku/trunk/src/kits/interface/Font.cpp haiku/trunk/src/servers/app/Jamfile haiku/trunk/src/servers/app/ProfileMessageSupport.cpp haiku/trunk/src/servers/app/ServerFont.cpp haiku/trunk/src/servers/app/ServerFont.h haiku/trunk/src/servers/app/drawing/AccelerantHWInterface.cpp haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp haiku/trunk/src/servers/app/drawing/Painter/Jamfile haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp haiku/trunk/src/servers/app/drawing/Painter/Painter.h haiku/trunk/src/servers/app/drawing/Painter/font_support/AGGTextRenderer.cpp haiku/trunk/src/servers/app/drawing/Painter/font_support/AGGTextRenderer.h haiku/trunk/src/tests/servers/app/Jamfile Log: * complete overhaul of the font/glyph caching * the previous AGG implementation is superfluous * the new implementation is based on that one, but in a way that allows read/write locking to the list of cache entries (fonts) as well as read/write locking to the cached glyphs per individual font cache entry * new GlyphLayoutEngine.h, which is to be the central place for layouting glyphs along the baseline. It handles the locking for getting the font cache entries. It works by giving it a template class GlyphConsumer which does the actual work. * changed AGGTextRenderer to use the new font cache * changed ServerFont::StringWidth(), and the bounding box stuff to use it * changed DrawingEngine, it doesn't need the global font lock anymore * our BFont thought that GetBoundingBoxesAsGlyphs and GetBoundingBoxesAsString is the same, which of course it isn't, hence the two separate functions... AsGlyphs just gets the bounding box of each glyph in a string, not treating the string as an actual word AsString adds the offset of the glyph in the word to the bounding box * changed ServerProtocol.h accordingly for the different bounding box meaning Modified: haiku/trunk/headers/os/interface/Font.h =================================================================== --- haiku/trunk/headers/os/interface/Font.h 2007-08-02 18:32:00 UTC (rev 21796) +++ haiku/trunk/headers/os/interface/Font.h 2007-08-02 19:10:38 UTC (rev 21797) @@ -254,7 +254,7 @@ void _GetBoundingBoxes(const char charArray[], int32 numChars, font_metric_mode mode, bool string_escapement, escapement_delta *delta, - BRect boundingBoxArray[]) const; + BRect boundingBoxArray[], bool asString) const; }; Modified: haiku/trunk/headers/private/app/ServerProtocol.h =================================================================== --- haiku/trunk/headers/private/app/ServerProtocol.h 2007-08-02 18:32:00 UTC (rev 21796) +++ haiku/trunk/headers/private/app/ServerProtocol.h 2007-08-02 19:10:38 UTC (rev 21797) @@ -124,6 +124,7 @@ AS_GET_ESCAPEMENTS, AS_GET_ESCAPEMENTS_AS_FLOATS, AS_GET_BOUNDINGBOXES_CHARS, + AS_GET_BOUNDINGBOXES_STRING, AS_GET_BOUNDINGBOXES_STRINGS, AS_GET_HAS_GLYPHS, AS_GET_GLYPH_SHAPES, Modified: haiku/trunk/src/kits/interface/Font.cpp =================================================================== --- haiku/trunk/src/kits/interface/Font.cpp 2007-08-02 18:32:00 UTC (rev 21796) +++ haiku/trunk/src/kits/interface/Font.cpp 2007-08-02 19:10:38 UTC (rev 21797) @@ -1195,7 +1195,7 @@ BFont::GetBoundingBoxesAsGlyphs(const char charArray[], int32 numChars, font_metric_mode mode, BRect boundingBoxArray[]) const { - _GetBoundingBoxes(charArray, numChars, mode, false, NULL, boundingBoxArray); + _GetBoundingBoxes(charArray, numChars, mode, false, NULL, boundingBoxArray, false); } @@ -1203,13 +1203,13 @@ BFont::GetBoundingBoxesAsString(const char charArray[], int32 numChars, font_metric_mode mode, escapement_delta *delta, BRect boundingBoxArray[]) const { - _GetBoundingBoxes(charArray, numChars, mode, true, delta, boundingBoxArray); + _GetBoundingBoxes(charArray, numChars, mode, true, delta, boundingBoxArray, true); } void BFont::_GetBoundingBoxes(const char charArray[], int32 numChars, font_metric_mode mode, - bool string_escapement, escapement_delta *delta, BRect boundingBoxArray[]) const + bool string_escapement, escapement_delta *delta, BRect boundingBoxArray[], bool asString) const { if (!charArray || numChars < 1 || !boundingBoxArray) return; @@ -1217,7 +1217,7 @@ int32 code; BPrivate::AppServerLink link; - link.StartMessage(AS_GET_BOUNDINGBOXES_CHARS); + link.StartMessage(asString ? AS_GET_BOUNDINGBOXES_STRING : AS_GET_BOUNDINGBOXES_CHARS); link.Attach(fFamilyID); link.Attach(fStyleID); link.Attach(fSize); Added: haiku/trunk/src/servers/app/FontCache.cpp =================================================================== --- haiku/trunk/src/servers/app/FontCache.cpp 2007-08-02 18:32:00 UTC (rev 21796) +++ haiku/trunk/src/servers/app/FontCache.cpp 2007-08-02 19:10:38 UTC (rev 21797) @@ -0,0 +1,155 @@ +/* + * Copyright 2007, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan A?mus + */ + +#include "FontCache.h" + +#include +#include +#include + +#include +#include + +#include "AutoLocker.h" + + +using std::nothrow; + + +FontCache +FontCache::sDefaultInstance; + +// #pragma mark - + +// constructor +FontCache::FontCache() + : MultiLocker("FontCache lock") + , fFontCacheEntries() +{ +} + +// destructor +FontCache::~FontCache() +{ + FontMap::Iterator iterator = fFontCacheEntries.GetIterator(); + while (iterator.HasNext()) + iterator.Next().value->RemoveReference(); +} + +// Default +/*static*/ FontCache* +FontCache::Default() +{ + return &sDefaultInstance; +} + +// SetFont +FontCacheEntry* +FontCache::FontCacheEntryFor(const ServerFont& font) +{ + char signature[512]; + FontCacheEntry::GenerateSignature(signature, font); + + AutoReadLocker readLocker(this); + + FontCacheEntry* entry = fFontCacheEntries.Get(signature); + + if (entry) { + // the entry was already there + entry->AddReference(); + return entry; + } + + readLocker.Unlock(); + + AutoWriteLocker locker(this); + if (!locker.IsLocked()) + return NULL; + + // prevent getting screwed by a race condition: + // when we released the readlock above, another thread might have + // gotten the writelock before we have, and might have already + // inserted a cache entry for this font. So we look again if there + // is an entry now, and only then create it if it's still not there, + // all while holding the writelock + entry = fFontCacheEntries.Get(signature); + + if (!entry) { + // remove old entries, keep entries below certain count + _ConstrainEntryCount(); + entry = new (nothrow) FontCacheEntry(); + if (!entry || !entry->Init(font) + || fFontCacheEntries.Put(signature, entry) < B_OK) { + fprintf(stderr, "FontCache::FontCacheEntryFor() - " + "out of memory or no font file\n"); + delete entry; + return NULL; + } + } + + entry->AddReference(); + return entry; +} + +// Recycle +void +FontCache::Recycle(FontCacheEntry* entry) +{ + entry->UpdateUsage(); + entry->RemoveReference(); +} + +static const int32 kMaxEntryCount = 30; + +static inline double +usage_index(uint64 useCount, bigtime_t age) +{ + return 100.0 * useCount / age; +} + +// _ConstrainEntryCount +void +FontCache::_ConstrainEntryCount() +{ + // this function is only ever called with the WriteLock held + if (fFontCacheEntries.Size() < kMaxEntryCount) + return; +//printf("FontCache::_ConstrainEntryCount()\n"); + + FontMap::Iterator iterator = fFontCacheEntries.GetIterator(); + + // NOTE: if kMaxEntryCount has a sane value, there has got to be + // some entries, so using the iterator like that should be ok + FontCacheEntry* leastUsedEntry = iterator.Next().value; + bigtime_t now = system_time(); + bigtime_t age = now - leastUsedEntry->LastUsed(); + uint64 useCount = leastUsedEntry->UsedCount(); + double leastUsageIndex = usage_index(useCount, age); +//printf(" leastUsageIndex: %f\n", leastUsageIndex); + + while (iterator.HasNext()) { + FontCacheEntry* entry = iterator.Next().value; + age = now - entry->LastUsed(); + useCount = entry->UsedCount(); + double usageIndex = usage_index(useCount, age); +//printf(" usageIndex: %f\n", usageIndex); + if (usageIndex < leastUsageIndex) { + leastUsedEntry = entry; + leastUsageIndex = usageIndex; + } + } + + iterator = fFontCacheEntries.GetIterator(); + while (iterator.HasNext()) { + if (iterator.Next().value == leastUsedEntry) { + iterator.Remove(); + leastUsedEntry->RemoveReference(); + break; + } + } +} Added: haiku/trunk/src/servers/app/FontCache.h =================================================================== --- haiku/trunk/src/servers/app/FontCache.h 2007-08-02 18:32:00 UTC (rev 21796) +++ haiku/trunk/src/servers/app/FontCache.h 2007-08-02 19:10:38 UTC (rev 21797) @@ -0,0 +1,40 @@ +/* + * Copyright 2007, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan A?mus + */ + +#ifndef FONT_CACHE_H +#define FONT_CACHE_H + +#include "FontCacheEntry.h" +#include "HashMap.h" +#include "HashString.h" +#include "MultiLocker.h" +#include "ServerFont.h" + + +class FontCache : public MultiLocker { + public: + FontCache(); + virtual ~FontCache(); + + // global instance + static FontCache* Default(); + + FontCacheEntry* FontCacheEntryFor(const ServerFont& font); + void Recycle(FontCacheEntry* entry); + + private: + void _ConstrainEntryCount(); + + static FontCache sDefaultInstance; + + typedef HashMap FontMap; + + FontMap fFontCacheEntries; +}; + +#endif // FONT_CACHE_H Added: haiku/trunk/src/servers/app/FontCacheEntry.cpp =================================================================== --- haiku/trunk/src/servers/app/FontCacheEntry.cpp 2007-08-02 18:32:00 UTC (rev 21796) +++ haiku/trunk/src/servers/app/FontCacheEntry.cpp 2007-08-02 19:10:38 UTC (rev 21797) @@ -0,0 +1,238 @@ +/* + * Copyright 2007, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Maxim Shemanarev + * Stephan A?mus + */ + +//---------------------------------------------------------------------------- +// Anti-Grain Geometry - Version 2.4 +// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) +// +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. +// This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// +//---------------------------------------------------------------------------- +// Contact: mcseem at antigrain.com +// mcseemagg at yahoo.com +// http://www.antigrain.com +//---------------------------------------------------------------------------- + + +#include "FontCacheEntry.h" + +#include +#include + +#include + +#include "utf8_functions.h" + +BLocker +FontCacheEntry::sUsageUpdateLock("FontCacheEntry usage lock"); + + +class FontCacheEntry::GlyphCachePool { + public: + enum block_size_e { block_size = 16384-16 }; + + GlyphCachePool() + : fAllocator(block_size) + { + memset(fGlyphs, 0, sizeof(fGlyphs)); + } + + const GlyphCache* FindGlyph(uint16 glyphCode) const + { + unsigned msb = (glyphCode >> 8) & 0xFF; + if (fGlyphs[msb]) + return fGlyphs[msb][glyphCode & 0xFF]; + return 0; + } + + GlyphCache* CacheGlyph(uint16 glyphCode, unsigned glyphIndex, + unsigned dataSize, glyph_data_type dataType, const agg::rect_i& bounds, + double advanceX, double advanceY) + { + unsigned msb = (glyphCode >> 8) & 0xFF; + if (fGlyphs[msb] == 0) { + fGlyphs[msb] + = (GlyphCache**)fAllocator.allocate(sizeof(GlyphCache*) * 256, + sizeof(GlyphCache*)); + memset(fGlyphs[msb], 0, sizeof(GlyphCache*) * 256); + } + + unsigned lsb = glyphCode & 0xFF; + if (fGlyphs[msb][lsb]) + return 0; // already exists, do not overwrite + + GlyphCache* glyph + = (GlyphCache*)fAllocator.allocate(sizeof(GlyphCache), + sizeof(double)); + + glyph->glyph_index = glyphIndex; + glyph->data = fAllocator.allocate(dataSize); + glyph->data_size = dataSize; + glyph->data_type = dataType; + glyph->bounds = bounds; + glyph->advance_x = advanceX; + glyph->advance_y = advanceY; + + return fGlyphs[msb][lsb] = glyph; + } + + private: + agg::block_allocator fAllocator; + GlyphCache** fGlyphs[256]; +}; + +// #pragma mark - + +// constructor +FontCacheEntry::FontCacheEntry() + : MultiLocker("FontCacheEntry lock") + , Referenceable() + , fGlyphCache(new GlyphCachePool()) + , fEngine() + , fLastUsedTime(LONGLONG_MIN) + , fUseCounter(0) +{ +} + +// destructor +FontCacheEntry::~FontCacheEntry() +{ +//printf("~FontCacheEntry()\n"); + delete fGlyphCache; +} + +// Init +bool +FontCacheEntry::Init(const ServerFont& font) +{ + glyph_rendering renderingType = glyph_ren_native_gray8; + if (font.Rotation() != 0.0 || font.Shear() != 90.0) + renderingType = glyph_ren_outline; + + // TODO: encoding from font + FT_Encoding charMap = FT_ENCODING_NONE; + bool hinting = true; // TODO: font.Hinting(); + + if (!fEngine.Init(font.Path(), 0, font.Size(), charMap, + renderingType, hinting)) { + fprintf(stderr, "FontCacheEntry::Init() - some error loading font " + "file %s\n", font.Path()); + return false; + } + return true; +} + +// HasGlyphs +bool +FontCacheEntry::HasGlyphs(const char* utf8String, size_t length) const +{ + uint32 charCode; + const char* start = utf8String; + while ((charCode = UTF8ToCharCode(&utf8String))) { + if (!fGlyphCache->FindGlyph(charCode)) + return false; + if (utf8String - start + 1 > length) + break; + } + return true; +} + +// Glyph +const GlyphCache* +FontCacheEntry::Glyph(uint16 glyphCode) +{ + const GlyphCache* glyph = fGlyphCache->FindGlyph(glyphCode); + if (glyph) { + return glyph; + } else { + if (fEngine.PrepareGlyph(glyphCode)) { + glyph = fGlyphCache->CacheGlyph(glyphCode, + fEngine.GlyphIndex(), fEngine.DataSize(), + fEngine.DataType(), fEngine.Bounds(), + fEngine.AdvanceX(), fEngine.AdvanceY()); + + fEngine.WriteGlyphTo(glyph->data); + + return glyph; + } + } + return 0; +} + +// InitAdaptors +void +FontCacheEntry::InitAdaptors(const GlyphCache* glyph, + double x, double y, GlyphMonoAdapter& monoAdapter, + GlyphGray8Adapter& gray8Adapter, GlyphPathAdapter& pathAdapter, + double scale) +{ + if (!glyph) + return; + + switch(glyph->data_type) { + case glyph_data_mono: + monoAdapter.init(glyph->data, glyph->data_size, x, y); + break; + + case glyph_data_gray8: + gray8Adapter.init(glyph->data, glyph->data_size, x, y); + break; + + case glyph_data_outline: + pathAdapter.init(glyph->data, glyph->data_size, x, y, scale); + break; + + default: + break; + } +} + +// GetKerning +bool +FontCacheEntry::GetKerning(uint16 glyphCode1, uint16 glyphCode2, + double* x, double* y) +{ + return fEngine.GetKerning(glyphCode1, glyphCode2, x, y); +} + +// GenerateSignature +/*static*/ void +FontCacheEntry::GenerateSignature(char* signature, const ServerFont& font) +{ + glyph_rendering renderingType = glyph_ren_native_gray8; + if (font.Rotation() != 0.0 || font.Shear() != 90.0) + renderingType = glyph_ren_outline; + + // TODO: read more of these from the font + FT_Encoding charMap = FT_ENCODING_NONE; + bool hinting = true; // TODO: font.Hinting(); + + sprintf(signature, "%ld%u%d%d%.1f%d", + font.GetFamilyAndStyle(), charMap, + font.Face(), int(renderingType), font.Size(), hinting); +} + +// UpdateUsage +void +FontCacheEntry::UpdateUsage() +{ + // this is a static lock to prevent usage of too many semaphores, + // but on the other hand, it is not so nice to be using a lock + // here at all + // the hope is that the time is so short to hold this lock, that + // there is not much contention + BAutolock _(sUsageUpdateLock); + + fLastUsedTime = system_time(); + fUseCounter++; +} + Added: haiku/trunk/src/servers/app/FontCacheEntry.h =================================================================== --- haiku/trunk/src/servers/app/FontCacheEntry.h 2007-08-02 18:32:00 UTC (rev 21796) +++ haiku/trunk/src/servers/app/FontCacheEntry.h 2007-08-02 19:10:38 UTC (rev 21797) @@ -0,0 +1,116 @@ +/* + * Copyright 2007, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Maxim Shemanarev + * Stephan A?mus + */ + +//---------------------------------------------------------------------------- +// Anti-Grain Geometry - Version 2.4 +// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) +// +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. +// This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// +//---------------------------------------------------------------------------- +// Contact: mcseem at antigrain.com +// mcseemagg at yahoo.com +// http://www.antigrain.com +//---------------------------------------------------------------------------- + +#ifndef FONT_CACHE_ENTRY_H +#define FONT_CACHE_ENTRY_H + + +#include + +#include +#include +#include + +#include "ServerFont.h" +#include "FontEngine.h" +#include "MultiLocker.h" +#include "Referenceable.h" +#include "Transformable.h" + + +struct GlyphCache { + unsigned glyph_index; + uint8* data; + unsigned data_size; + glyph_data_type data_type; + agg::rect_i bounds; + double advance_x; + double advance_y; +}; + +class FontCache; + +class FontCacheEntry : public MultiLocker, public Referenceable { + public: + typedef FontEngine::PathAdapter GlyphPathAdapter; + typedef FontEngine::Gray8Adapter GlyphGray8Adapter; + typedef GlyphGray8Adapter::embedded_scanline GlyphGray8Scanline; + typedef FontEngine::MonoAdapter GlyphMonoAdapter; + typedef GlyphMonoAdapter::embedded_scanline GlyphMonoScanline; + typedef agg::conv_curve CurveConverter; + typedef agg::conv_contour ContourConverter; + + typedef agg::conv_transform + TransformedOutline; + + typedef agg::conv_transform + TransformedContourOutline; + + + FontCacheEntry(); + virtual ~FontCacheEntry(); + + bool Init(const ServerFont& font); + + bool HasGlyphs(const char* utf8String, + size_t glyphCount) const; + + const GlyphCache* Glyph(uint16 glyphCode); + + void InitAdaptors(const GlyphCache* glyph, + double x, double y, + GlyphMonoAdapter& monoAdapter, + GlyphGray8Adapter& gray8Adapter, + GlyphPathAdapter& pathAdapter, + double scale = 1.0); + + bool GetKerning(uint16 glyphCode1, + uint16 glyphCode2, double* x, double* y); + + static void GenerateSignature(char* signature, + const ServerFont& font); + + // private to FontCache class: + void UpdateUsage(); + bigtime_t LastUsed() const + { return fLastUsedTime; } + uint64 UsedCount() const + { return fUseCounter; } + + private: + FontCacheEntry(const FontCacheEntry&); + const FontCacheEntry& operator=(const FontCacheEntry&); + + class GlyphCachePool; + + GlyphCachePool* fGlyphCache; + FontEngine fEngine; + + static BLocker sUsageUpdateLock; + bigtime_t fLastUsedTime; + uint64 fUseCounter; +}; + +#endif // FONT_CACHE_ENTRY_H + Added: haiku/trunk/src/servers/app/FontEngine.cpp =================================================================== --- haiku/trunk/src/servers/app/FontEngine.cpp 2007-08-02 18:32:00 UTC (rev 21796) +++ haiku/trunk/src/servers/app/FontEngine.cpp 2007-08-02 19:10:38 UTC (rev 21797) @@ -0,0 +1,589 @@ +/* + * Copyright 2007, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Maxim Shemanarev + * Stephan A?mus + */ + +//---------------------------------------------------------------------------- +// Anti-Grain Geometry - Version 2.4 +// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) +// +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. +// This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// +//---------------------------------------------------------------------------- +// Contact: mcseem at antigrain.com +// mcseemagg at yahoo.com +// http://www.antigrain.com +//---------------------------------------------------------------------------- + + +#include "FontEngine.h" + +#include + +#include +#include + + +static const bool kFlipY = true; + + +// int26p6_to_dbl +static inline double +int26p6_to_dbl(int p) +{ + return double(p) / 64.0; +} + +// dbl_to_int26p6 +static inline int +dbl_to_int26p6(double p) +{ + return int(p * 64.0 + 0.5); +} + + +// decompose_ft_outline +template +bool +decompose_ft_outline(const FT_Outline& outline, bool flip_y, PathStorage& path) +{ + typedef typename PathStorage::value_type value_type; + + FT_Vector v_last; + FT_Vector v_control; + FT_Vector v_start; + double x1, y1, x2, y2, x3, y3; + + FT_Vector* point; + FT_Vector* limit; + char* tags; + + int n; // index of contour in outline + int first; // index of first point in contour + char tag; // current point's state + + first = 0; + + for (n = 0; n < outline.n_contours; n++) { + int last; // index of last point in contour + + last = outline.contours[n]; + limit = outline.points + last; + + v_start = outline.points[first]; + v_last = outline.points[last]; + + v_control = v_start; + + point = outline.points + first; + tags = outline.tags + first; + tag = FT_CURVE_TAG(tags[0]); + + // A contour cannot start with a cubic control point! + if (tag == FT_CURVE_TAG_CUBIC) + return false; + + // check first point to determine origin + if ( tag == FT_CURVE_TAG_CONIC) { + // first point is conic control. Yes, this happens. + if (FT_CURVE_TAG(outline.tags[last]) == FT_CURVE_TAG_ON) { + // start at last point if it is on the curve + v_start = v_last; + limit--; + } else { + // if both first and last points are conic, + // start at their middle and record its position + // for closure + v_start.x = (v_start.x + v_last.x) / 2; + v_start.y = (v_start.y + v_last.y) / 2; + + v_last = v_start; + } + point--; + tags--; + } + + x1 = int26p6_to_dbl(v_start.x); + y1 = int26p6_to_dbl(v_start.y); + if (flip_y) y1 = -y1; + path.move_to(value_type(dbl_to_int26p6(x1)), + value_type(dbl_to_int26p6(y1))); + + while(point < limit) { + point++; + tags++; + + tag = FT_CURVE_TAG(tags[0]); + switch(tag) { + case FT_CURVE_TAG_ON: { // emit a single line_to + x1 = int26p6_to_dbl(point->x); + y1 = int26p6_to_dbl(point->y); + if (flip_y) y1 = -y1; + path.line_to(value_type(dbl_to_int26p6(x1)), + value_type(dbl_to_int26p6(y1))); + //path.line_to(conv(point->x), flip_y ? -conv(point->y) : conv(point->y)); + continue; + } + + case FT_CURVE_TAG_CONIC: { // consume conic arcs + v_control.x = point->x; + v_control.y = point->y; + + Do_Conic: + if (point < limit) { + FT_Vector vec; + FT_Vector v_middle; + + point++; + tags++; + tag = FT_CURVE_TAG(tags[0]); + + vec.x = point->x; + vec.y = point->y; + + if (tag == FT_CURVE_TAG_ON) { + x1 = int26p6_to_dbl(v_control.x); + y1 = int26p6_to_dbl(v_control.y); + x2 = int26p6_to_dbl(vec.x); + y2 = int26p6_to_dbl(vec.y); + if (flip_y) { y1 = -y1; y2 = -y2; } + path.curve3(value_type(dbl_to_int26p6(x1)), + value_type(dbl_to_int26p6(y1)), + value_type(dbl_to_int26p6(x2)), + value_type(dbl_to_int26p6(y2))); + continue; + } + + if (tag != FT_CURVE_TAG_CONIC) + return false; + + v_middle.x = (v_control.x + vec.x) / 2; + v_middle.y = (v_control.y + vec.y) / 2; + + x1 = int26p6_to_dbl(v_control.x); + y1 = int26p6_to_dbl(v_control.y); + x2 = int26p6_to_dbl(v_middle.x); + y2 = int26p6_to_dbl(v_middle.y); + if (flip_y) { y1 = -y1; y2 = -y2; } + path.curve3(value_type(dbl_to_int26p6(x1)), + value_type(dbl_to_int26p6(y1)), + value_type(dbl_to_int26p6(x2)), + value_type(dbl_to_int26p6(y2))); + + //path.curve3(conv(v_control.x), + // flip_y ? -conv(v_control.y) : conv(v_control.y), + // conv(v_middle.x), + // flip_y ? -conv(v_middle.y) : conv(v_middle.y)); + + v_control = vec; + goto Do_Conic; + } + + x1 = int26p6_to_dbl(v_control.x); + y1 = int26p6_to_dbl(v_control.y); + x2 = int26p6_to_dbl(v_start.x); + y2 = int26p6_to_dbl(v_start.y); + if (flip_y) { y1 = -y1; y2 = -y2; } + path.curve3(value_type(dbl_to_int26p6(x1)), + value_type(dbl_to_int26p6(y1)), + value_type(dbl_to_int26p6(x2)), + value_type(dbl_to_int26p6(y2))); + + //path.curve3(conv(v_control.x), + // flip_y ? -conv(v_control.y) : conv(v_control.y), + // conv(v_start.x), + // flip_y ? -conv(v_start.y) : conv(v_start.y)); + goto Close; + } + + default: { // FT_CURVE_TAG_CUBIC + FT_Vector vec1, vec2; + + if (point + 1 > limit || FT_CURVE_TAG(tags[1]) != FT_CURVE_TAG_CUBIC) + return false; + + vec1.x = point[0].x; + vec1.y = point[0].y; + vec2.x = point[1].x; + vec2.y = point[1].y; + + point += 2; + tags += 2; + + if (point <= limit) { + FT_Vector vec; + + vec.x = point->x; + vec.y = point->y; + + x1 = int26p6_to_dbl(vec1.x); + y1 = int26p6_to_dbl(vec1.y); + x2 = int26p6_to_dbl(vec2.x); + y2 = int26p6_to_dbl(vec2.y); + x3 = int26p6_to_dbl(vec.x); + y3 = int26p6_to_dbl(vec.y); + if (flip_y) { y1 = -y1; y2 = -y2; y3 = -y3; } + path.curve4(value_type(dbl_to_int26p6(x1)), + value_type(dbl_to_int26p6(y1)), + value_type(dbl_to_int26p6(x2)), + value_type(dbl_to_int26p6(y2)), + value_type(dbl_to_int26p6(x3)), + value_type(dbl_to_int26p6(y3))); + + //path.curve4(conv(vec1.x), + // flip_y ? -conv(vec1.y) : conv(vec1.y), + // conv(vec2.x), + // flip_y ? -conv(vec2.y) : conv(vec2.y), + // conv(vec.x), + // flip_y ? -conv(vec.y) : conv(vec.y)); + continue; + } + + x1 = int26p6_to_dbl(vec1.x); + y1 = int26p6_to_dbl(vec1.y); + x2 = int26p6_to_dbl(vec2.x); + y2 = int26p6_to_dbl(vec2.y); + x3 = int26p6_to_dbl(v_start.x); + y3 = int26p6_to_dbl(v_start.y); + if (flip_y) { y1 = -y1; y2 = -y2; y3 = -y3; } + path.curve4(value_type(dbl_to_int26p6(x1)), + value_type(dbl_to_int26p6(y1)), + value_type(dbl_to_int26p6(x2)), + value_type(dbl_to_int26p6(y2)), + value_type(dbl_to_int26p6(x3)), + value_type(dbl_to_int26p6(y3))); + + //path.curve4(conv(vec1.x), + // flip_y ? -conv(vec1.y) : conv(vec1.y), + // conv(vec2.x), + // flip_y ? -conv(vec2.y) : conv(vec2.y), + // conv(v_start.x), + // flip_y ? -conv(v_start.y) : conv(v_start.y)); + goto Close; + } + } + } + + path.close_polygon(); + + Close: + first = last + 1; + } + + return true; +} + +// decompose_ft_bitmap_mono +template +void +decompose_ft_bitmap_mono(const FT_Bitmap& bitmap, int x, int y, + bool flip_y, Scanline& sl, ScanlineStorage& storage) +{ + int i; + const uint8* buf = (const uint8*)bitmap.buffer; + int pitch = bitmap.pitch; + sl.reset(x, x + bitmap.width); + storage.prepare(); + if (flip_y) { + buf += bitmap.pitch * (bitmap.rows - 1); + y += bitmap.rows; + pitch = -pitch; + } + for (i = 0; i < bitmap.rows; i++) { + sl.reset_spans(); + agg::bitset_iterator bits(buf, 0); + int j; + for (j = 0; j < bitmap.width; j++) { + if (bits.bit()) + sl.add_cell(x + j, agg::cover_full); + ++bits; + } + buf += pitch; + if (sl.num_spans()) { + sl.finalize(y - i - 1); + storage.render(sl); + } + } +} + +// decompose_ft_bitmap_gray8 +template +void +decompose_ft_bitmap_gray8(const FT_Bitmap& bitmap, int x, int y, + bool flip_y, Scanline& sl, ScanlineStorage& storage) +{ + int i, j; + const uint8* buf = (const uint8*)bitmap.buffer; + int pitch = bitmap.pitch; + sl.reset(x, x + bitmap.width); + storage.prepare(); + if (flip_y) { + buf += bitmap.pitch * (bitmap.rows - 1); + y += bitmap.rows; + pitch = -pitch; + } + for (i = 0; i < bitmap.rows; i++) { + sl.reset_spans(); + const uint8* p = buf; + for (j = 0; j < bitmap.width; j++) { + if (*p) + sl.add_cell(x + j, *p); + ++p; + } + buf += pitch; + if (sl.num_spans()) { + sl.finalize(y - i - 1); + storage.render(sl); + } + } +} + + +// #pragma mark - + + +// constructor +FontEngine::FontEngine() + : fLastError(0) + , fLibraryInitialized(false) + , fLibrary(0) [... truncated: 1785 lines follow ...] From axeld at mail.berlios.de Thu Aug 2 21:12:29 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 2 Aug 2007 21:12:29 +0200 Subject: [Haiku-commits] r21798 - haiku/trunk/src/add-ons/kernel/network/protocols/ipv4 Message-ID: <200708021912.l72JCTtm010707@sheep.berlios.de> Author: axeld Date: 2007-08-02 21:12:28 +0200 (Thu, 02 Aug 2007) New Revision: 21798 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21798&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp Log: IPv4 now uses module_dependencies, it mustn't put the stack module manually anymore. This fixes unloading of the stack (some fixes to the module code that let you determine this kind of bugs earlier will be committed next). Modified: haiku/trunk/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp 2007-08-02 19:10:38 UTC (rev 21797) +++ haiku/trunk/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp 2007-08-02 19:12:28 UTC (rev 21798) @@ -1673,7 +1673,6 @@ benaphore_destroy(&sRawSocketsLock); benaphore_destroy(&sReceivingProtocolLock); - put_module(NET_STACK_MODULE_NAME); return B_OK; } From korli at mail.berlios.de Thu Aug 2 21:32:29 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Thu, 2 Aug 2007 21:32:29 +0200 Subject: [Haiku-commits] r21799 - in haiku/trunk/src/add-ons/kernel/file_systems: ramfs reiserfs userlandfs/kernel_add_on Message-ID: <200708021932.l72JWTqu012065@sheep.berlios.de> Author: korli Date: 2007-08-02 21:32:28 +0200 (Thu, 02 Aug 2007) New Revision: 21799 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21799&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/ramfs/Jamfile haiku/trunk/src/add-ons/kernel/file_systems/reiserfs/Jamfile haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Jamfile Log: removed redundant TARGET_GCC_LIBGCC Modified: haiku/trunk/src/add-ons/kernel/file_systems/ramfs/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/ramfs/Jamfile 2007-08-02 19:12:28 UTC (rev 21798) +++ haiku/trunk/src/add-ons/kernel/file_systems/ramfs/Jamfile 2007-08-02 19:32:28 UTC (rev 21799) @@ -44,5 +44,5 @@ SymLink.cpp Volume.cpp - : $(TARGET_GCC_LIBGCC) $(HAIKU_LIBSUPC++) + : $(HAIKU_LIBSUPC++) ; Modified: haiku/trunk/src/add-ons/kernel/file_systems/reiserfs/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/reiserfs/Jamfile 2007-08-02 19:12:28 UTC (rev 21798) +++ haiku/trunk/src/add-ons/kernel/file_systems/reiserfs/Jamfile 2007-08-02 19:32:28 UTC (rev 21799) @@ -28,5 +28,5 @@ VNode.cpp Volume.cpp - : $(TARGET_GCC_LIBGCC) $(HAIKU_LIBSUPC++) + : $(HAIKU_LIBSUPC++) ; Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Jamfile 2007-08-02 19:12:28 UTC (rev 21798) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Jamfile 2007-08-02 19:32:28 UTC (rev 21799) @@ -40,5 +40,5 @@ UserlandFS.cpp Volume.cpp - : $(TARGET_GCC_LIBGCC) $(HAIKU_LIBSUPC++) + : $(HAIKU_LIBSUPC++) ; From stefano.ceccherini at gmail.com Thu Aug 2 23:01:03 2007 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Thu, 2 Aug 2007 23:01:03 +0200 Subject: [Haiku-commits] r21797 - in haiku/trunk: headers/os/interface headers/private/app src/kits/interface src/servers/app src/servers/app/drawing src/servers/app/drawing/Painter src/servers/app/drawing/Painter/font_support src/tests/servers/app In-Reply-To: <200708021910.l72JAheH010598@sheep.berlios.de> References: <200708021910.l72JAheH010598@sheep.berlios.de> Message-ID: <894b9700708021401t146475aej99e61a7ee71e92d2@mail.gmail.com> 2007/8/2, stippi at BerliOS : > Author: stippi > Date: 2007-08-02 21:10:38 +0200 (Thu, 02 Aug 2007) > New Revision: 21797 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21797&view=rev Hi. The build is broken for me after this change. C++ generated/objects/haiku/x86/release/servers/app/ServerApp.o src/servers/app/ServerApp.cpp: In method `void ServerApp::_DispatchMessage(long int, BPrivate::LinkReceiver &)': src/servers/app/ServerApp.cpp:1926: no matching function for call to `ServerFont::GetBoundingBoxesAsString (char *&, int32 &, BRect[((numChars - 1) + 1)], bool &, font_metric_mode &, escapement_delta &)' /home/stefano/haiku/haiku/generated/cross-tools/bin/i586-pc-beos-gcc -c "src/servers/app/ServerApp.cpp" -O -Wall -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare -nostdinc -Wno-multichar -D_ZETA_USING_DEPRECATED_API_=1 -D_ZETA_TS_FIND_DIR_=1 -D__HAIKU__ -DHAIKU_DISTRO_COMPATIBILITY_DEFAULT -D__INTEL__ -DARCH_x86 -D_BEOS_R5_COMPATIBLE_ -DHAIKU_TARGET_PLATFORM_HAIKU -Isrc/servers/app -Igenerated/objects/common/servers/app -Igenerated/objects/linux/x86/common/servers/app -Igenerated/objects/haiku/x86/common/servers/app -Isrc/servers/app/drawing -Isrc/servers/app/drawing/Painter -I- -Iheaders/libs/agg -Iheaders/libs/png -Iheaders/libs/zlib -Iheaders/private/app -Iheaders/private/graphics -Iheaders/private/input -Iheaders/private/interface -Iheaders/private/kernel -Iheaders/private/shared -Iheaders/private/storage -Iheaders/libs/freetype2 -Iheaders -Iheaders/posix -Iheaders/gnu -Iheaders/glibc -Iheaders/os -Iheaders/os/add-ons -Iheaders/os/add-ons/file_system -Iheaders/os/add-ons/graphics -Iheaders/os/add-ons/input_server -Iheaders/os/add-ons/registrar -Iheaders/os/add-ons/screen_saver -Iheaders/os/add-ons/tracker -Iheaders/os/app -Iheaders/os/device -Iheaders/os/drivers -Iheaders/os/game -Iheaders/os/interface -Iheaders/os/kernel -Iheaders/os/media -Iheaders/os/mail -Iheaders/os/midi -Iheaders/os/midi2 -Iheaders/os/net -Iheaders/os/opengl -Iheaders/os/storage -Iheaders/os/support -Iheaders/os/translation -Iheaders/private/. -Iheaders/cpp -I/home/stefano/haiku/haiku/generated/cross-tools/lib/gcc-lib/i586-pc-beos/2.95.3-beos-060710/include -o "generated/objects/haiku/x86/release/servers/app/ServerApp.o" ; ...failed C++ generated/objects/haiku/x86/release/servers/app/ServerApp.o ... ...skipped app_server for lack of ServerApp.o... ...skipped haiku.image-copy-files-dummy-beos/system/servers for lack of app_server... ...skipped haiku.image for lack of haiku.image-copy-files... ...skipped haiku.vmdk for lack of haiku.image... ...failed updating 1 target(s)... ...skipped 4 target(s)... ...updated 64 target(s)... From stippi at mail.berlios.de Thu Aug 2 23:05:01 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 2 Aug 2007 23:05:01 +0200 Subject: [Haiku-commits] r21800 - haiku/trunk/src/servers/app Message-ID: <200708022105.l72L51dl021845@sheep.berlios.de> Author: stippi Date: 2007-08-02 23:05:01 +0200 (Thu, 02 Aug 2007) New Revision: 21800 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21800&view=rev Modified: haiku/trunk/src/servers/app/ServerApp.cpp Log: * fixes the build, forgot to include in r21797 Modified: haiku/trunk/src/servers/app/ServerApp.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerApp.cpp 2007-08-02 19:32:28 UTC (rev 21799) +++ haiku/trunk/src/servers/app/ServerApp.cpp 2007-08-02 21:05:01 UTC (rev 21800) @@ -1854,6 +1854,7 @@ break; } case AS_GET_BOUNDINGBOXES_CHARS: + case AS_GET_BOUNDINGBOXES_STRING: { FTRACE(("ServerApp %s: AS_GET_BOUNDINGBOXES_CHARS\n", Signature())); // Attached Data: @@ -1922,8 +1923,9 @@ font.SetFlags(flags); // TODO implement for real - if (font.GetBoundingBoxesAsString(charArray, numChars, - rectArray, string_escapement, mode, delta) == B_OK) { + if (font.GetBoundingBoxes(charArray, numChars, + rectArray, string_escapement, mode, delta, + code == AS_GET_BOUNDINGBOXES_STRING) == B_OK) { fLink.StartMessage(B_OK); fLink.Attach(rectArray, sizeof(rectArray)); success = true; From stippi at mail.berlios.de Thu Aug 2 23:05:35 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 2 Aug 2007 23:05:35 +0200 Subject: [Haiku-commits] r21801 - haiku/trunk/src/servers/app/drawing/Painter Message-ID: <200708022105.l72L5ZT6021898@sheep.berlios.de> Author: stippi Date: 2007-08-02 23:05:34 +0200 (Thu, 02 Aug 2007) New Revision: 21801 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21801&view=rev Modified: haiku/trunk/src/servers/app/drawing/Painter/Transformable.cpp haiku/trunk/src/servers/app/drawing/Painter/Transformable.h Log: * TransformBounds() takes a const BRect& Modified: haiku/trunk/src/servers/app/drawing/Painter/Transformable.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/Painter/Transformable.cpp 2007-08-02 21:05:01 UTC (rev 21800) +++ haiku/trunk/src/servers/app/drawing/Painter/Transformable.cpp 2007-08-02 21:05:34 UTC (rev 21801) @@ -247,7 +247,7 @@ // TransformBounds BRect -Transformable::TransformBounds(BRect bounds) const +Transformable::TransformBounds(const BRect& bounds) const { if (bounds.IsValid()) { BPoint lt(bounds.left, bounds.top); Modified: haiku/trunk/src/servers/app/drawing/Painter/Transformable.h =================================================================== --- haiku/trunk/src/servers/app/drawing/Painter/Transformable.h 2007-08-02 21:05:01 UTC (rev 21800) +++ haiku/trunk/src/servers/app/drawing/Painter/Transformable.h 2007-08-02 21:05:34 UTC (rev 21801) @@ -51,7 +51,7 @@ // transforms the rectangle "bounds" and // returns the *bounding box* of that - BRect TransformBounds(BRect bounds) const; + BRect TransformBounds(const BRect& bounds) const; // some convenience functions virtual void TranslateBy(BPoint offset); From bonefish at mail.berlios.de Thu Aug 2 23:14:01 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 2 Aug 2007 23:14:01 +0200 Subject: [Haiku-commits] r21802 - in haiku/trunk: . build/jam src/add-ons/kernel/drivers/graphics/vmware src/add-ons/kernel/drivers/input/usb_hid src/add-ons/kernel/drivers/network/stack src/add-ons/media/media-add-ons/esound_sink src/add-ons/media/media-add-ons/multi_audio src/add-ons/media/media-add-ons/usb_webcam src/apps/networkstatus src/apps/pulse src/apps/resedit src/apps/stylededit src/bin/bash/lib/glob src/bin/bash/lib/readline src/bin/bash/lib/sh src/bin/desklink src/bin/network/arp src/bin/network/ftp src/bin/network/ifconfig src/bin/network/nc src/bin/network/ping src/bin/network/ppp_up src/bin/network/pppconfig src/bin/network/route src/bin/network/traceroute src/bin/pcmcia-cs src/kits/support src/kits/textencoding src/kits/textencoding/libiconv src/kits/tracker src/preferences/keyboard src/preferences/media src/preferences/sounds src/preferences/virtualmemory src/tools/bfs_shell Message-ID: <200708022114.l72LE1RE022898@sheep.berlios.de> Author: bonefish Date: 2007-08-02 23:13:56 +0200 (Thu, 02 Aug 2007) New Revision: 21802 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21802&view=rev Modified: haiku/trunk/build/jam/BuildSetup haiku/trunk/build/jam/HelperRules haiku/trunk/build/jam/KernelRules haiku/trunk/configure haiku/trunk/src/add-ons/kernel/drivers/graphics/vmware/Jamfile haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/Jamfile haiku/trunk/src/add-ons/kernel/drivers/network/stack/Jamfile haiku/trunk/src/add-ons/media/media-add-ons/esound_sink/Jamfile haiku/trunk/src/add-ons/media/media-add-ons/multi_audio/Jamfile haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/Jamfile haiku/trunk/src/apps/networkstatus/Jamfile haiku/trunk/src/apps/pulse/Jamfile haiku/trunk/src/apps/resedit/Jamfile haiku/trunk/src/apps/stylededit/Jamfile haiku/trunk/src/bin/bash/lib/glob/Jamfile haiku/trunk/src/bin/bash/lib/readline/Jamfile haiku/trunk/src/bin/bash/lib/sh/Jamfile haiku/trunk/src/bin/desklink/Jamfile haiku/trunk/src/bin/network/arp/Jamfile haiku/trunk/src/bin/network/ftp/Jamfile haiku/trunk/src/bin/network/ifconfig/Jamfile haiku/trunk/src/bin/network/nc/Jamfile haiku/trunk/src/bin/network/ping/Jamfile haiku/trunk/src/bin/network/ppp_up/Jamfile haiku/trunk/src/bin/network/pppconfig/Jamfile haiku/trunk/src/bin/network/route/Jamfile haiku/trunk/src/bin/network/traceroute/Jamfile haiku/trunk/src/bin/pcmcia-cs/Jamfile haiku/trunk/src/kits/support/Jamfile haiku/trunk/src/kits/textencoding/Jamfile haiku/trunk/src/kits/textencoding/libiconv/Jamfile haiku/trunk/src/kits/tracker/Jamfile haiku/trunk/src/preferences/keyboard/Jamfile haiku/trunk/src/preferences/media/Jamfile haiku/trunk/src/preferences/sounds/Jamfile haiku/trunk/src/preferences/virtualmemory/Jamfile haiku/trunk/src/tools/bfs_shell/Jamfile Log: Added Haiku as host platform supported by the build system ("haiku_host"). Completely untested yet. Modified: haiku/trunk/build/jam/BuildSetup =================================================================== --- haiku/trunk/build/jam/BuildSetup 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/build/jam/BuildSetup 2007-08-02 21:13:56 UTC (rev 21802) @@ -95,9 +95,10 @@ HAIKU_DEBUG_LEVELS = 0 1 2 3 4 5 ; # BeOS, BONE, Dan0 compatible platforms -HAIKU_BEOS_COMPATIBLE_PLATFORMS = haiku r5 bone dano ; -HAIKU_BONE_COMPATIBLE_PLATFORMS = haiku bone dano ; -HAIKU_DANO_COMPATIBLE_PLATFORMS = haiku dano ; +HAIKU_BEOS_COMPATIBLE_PLATFORMS = haiku r5 bone dano haiku_host ; +HAIKU_BONE_COMPATIBLE_PLATFORMS = haiku bone dano haiku_host ; +HAIKU_DANO_COMPATIBLE_PLATFORMS = haiku dano haiku_host ; +HAIKU_HAIKU_COMPATIBLE_PLATFORMS = haiku haiku_host ; #pragma mark - @@ -436,6 +437,7 @@ # debug flags switch $(HOST_PLATFORM) { case haiku : HOST_DEBUG_FLAGS ?= -ggdb ; + case haiku_host : HOST_DEBUG_FLAGS ?= -ggdb ; case linux : HOST_DEBUG_FLAGS ?= -ggdb ; case freebsd : HOST_DEBUG_FLAGS ?= -ggdb ; case darwin : HOST_DEBUG_FLAGS ?= -ggdb ; @@ -582,7 +584,7 @@ } # TODO: Fix the naming! -if $(TARGET_PLATFORM) = haiku { +if $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { NETWORK_LIBS = network ; SELECT_UNAME_ETC_LIB = root ; NETAPI_LIB = network ; @@ -674,6 +676,7 @@ case r5 : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_BEOS ; case bone : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_BONE ; case dano : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_DANO ; + case haiku_host : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_HAIKU ; case haiku : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_HAIKU ; case linux : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_LINUX ; case freebsd : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_FREEBSD ; @@ -686,7 +689,7 @@ case r5 : HOST_DEFINES += HAIKU_HOST_PLATFORM_BEOS ; case bone : HOST_DEFINES += HAIKU_HOST_PLATFORM_BONE ; case dano : HOST_DEFINES += HAIKU_HOST_PLATFORM_DANO ; - case haiku : HOST_DEFINES += HAIKU_HOST_PLATFORM_HAIKU ; + case haiku_host : HOST_DEFINES += HAIKU_HOST_PLATFORM_HAIKU ; case linux : HOST_DEFINES += HAIKU_HOST_PLATFORM_LINUX ; case freebsd : HOST_DEFINES += HAIKU_HOST_PLATFORM_FREEBSD ; case darwin : HOST_DEFINES += HAIKU_HOST_PLATFORM_DARWIN ; @@ -699,7 +702,7 @@ # include the HaikuBuildCompatibility.h header and link against # libhaikucompat.a. -if $(TARGET_PLATFORM) != haiku && $(TARGET_PLATFORM_BEOS_COMPATIBLE) { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) && $(TARGET_PLATFORM_BEOS_COMPATIBLE) { # headers and flags local compatibilityHeader = -include [ FDirName $(HAIKU_TOP) headers build HaikuBuildCompatibility.h ] ; Modified: haiku/trunk/build/jam/HelperRules =================================================================== --- haiku/trunk/build/jam/HelperRules 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/build/jam/HelperRules 2007-08-02 21:13:56 UTC (rev 21802) @@ -156,22 +156,27 @@ { $(varPrefix)_PLATFORM_BEOS_COMPATIBLE = true ; } - + case bone : { $(varPrefix)_PLATFORM_BONE_COMPATIBLE = true ; } - + case dano : { $(varPrefix)_PLATFORM_DANO_COMPATIBLE = true ; } - + + case haiku_host : + { + $(varPrefix)_PLATFORM_HAIKU_COMPATIBLE = true ; + } + case haiku : { $(varPrefix)_PLATFORM_HAIKU_COMPATIBLE = true ; } - + case * : { if ! ( $(platform) in $(otherPlatforms) ) { @@ -181,6 +186,8 @@ } # set lesser flags, e.g. "DANO" for "HAIKU" and "BEOS" for "BONE" + $(varPrefix)_PLATFORM_HAIKU_COMPATIBLE + ?= $($(varPrefix)_PLATFORM_HAIKU_COMPATIBLE) ; $(varPrefix)_PLATFORM_DANO_COMPATIBLE ?= $($(varPrefix)_PLATFORM_HAIKU_COMPATIBLE) ; $(varPrefix)_PLATFORM_BONE_COMPATIBLE @@ -191,6 +198,8 @@ # set the machine friendly flags $(varPrefix)_PLATFORM_(haiku)_COMPATIBLE ?= $($(varPrefix)_PLATFORM_HAIKU_COMPATIBLE) ; + $(varPrefix)_PLATFORM_(haiku_host)_COMPATIBLE + ?= $($(varPrefix)_PLATFORM_HAIKU_COMPATIBLE) ; $(varPrefix)_PLATFORM_(dano)_COMPATIBLE ?= $($(varPrefix)_PLATFORM_DANO_COMPATIBLE) ; $(varPrefix)_PLATFORM_(bone)_COMPATIBLE Modified: haiku/trunk/build/jam/KernelRules =================================================================== --- haiku/trunk/build/jam/KernelRules 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/build/jam/KernelRules 2007-08-02 21:13:56 UTC (rev 21802) @@ -93,6 +93,10 @@ kernel = kernel.so ; beginGlue = $(HAIKU_KERNEL_ADDON_BEGIN_GLUE_CODE) ; endGlue = $(HAIKU_KERNEL_ADDON_END_GLUE_CODE) ; + } else if $(PLATFORM) = haiku_host { + kernel = /boot/develop/lib/x86/kernel.so ; + beginGlue = $(HAIKU_KERNEL_ADDON_BEGIN_GLUE_CODE) ; + endGlue = $(HAIKU_KERNEL_ADDON_END_GLUE_CODE) ; } else { kernel = /boot/develop/lib/x86/_KERNEL_ ; } Modified: haiku/trunk/configure =================================================================== --- haiku/trunk/configure 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/configure 2007-08-02 21:13:56 UTC (rev 21802) @@ -290,9 +290,10 @@ exit 1 ;; esac ;; + Darwin) buildPlatform=darwin ;; + FreeBSD) buildPlatform=freebsd ;; + Haiku) buildPlatform=haiku_host ;; Linux) buildPlatform=linux ;; - FreeBSD) buildPlatform=freebsd ;; - Darwin) buildPlatform=darwin ;; *) echo Unsupported platform: ${platform} exit 1 ;; esac Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/vmware/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/vmware/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/vmware/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -11,7 +11,7 @@ device.c ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { LinkAgainst vmware : $(TARGET_HAIKU_COMPATIBILITY_LIBS) ; } Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -6,7 +6,7 @@ UsePrivateHeaders [ FDirName kernel util ] input ; local buffer_impl = ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { buffer_impl = ring_buffer.cpp ; } Modified: haiku/trunk/src/add-ons/kernel/drivers/network/stack/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/stack/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/add-ons/kernel/drivers/network/stack/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ; -if ( $(TARGET_PLATFORM) != haiku ) { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { UseHeaders [ FStandardOSHeaders ] : true ; # Needed for and maybe other stuff. UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ; Modified: haiku/trunk/src/add-ons/media/media-add-ons/esound_sink/Jamfile =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/esound_sink/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/add-ons/media/media-add-ons/esound_sink/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { SubDirC++Flags -fmultiple-symbol-spaces ; } Modified: haiku/trunk/src/add-ons/media/media-add-ons/multi_audio/Jamfile =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/multi_audio/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/add-ons/media/media-add-ons/multi_audio/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -4,7 +4,7 @@ UsePrivateHeaders media ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { SubDirC++Flags -fmultiple-symbol-spaces ; } Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/Jamfile =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -6,7 +6,7 @@ UseLibraryHeaders usb ; # Zeta has a libusb.so, we have a USBKit.a -if $(TARGET_PLATFORM) = haiku { +if $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { usbKitLibraryName = USBKit.a ; } else { usbKitLibraryName = usb ; Modified: haiku/trunk/src/apps/networkstatus/Jamfile =================================================================== --- haiku/trunk/src/apps/networkstatus/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/apps/networkstatus/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -6,7 +6,7 @@ UseLibraryHeaders agg icon ; local icon_libs ; -if $(TARGET) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { icon_libs = libicon.a libagg.a ; } Modified: haiku/trunk/src/apps/pulse/Jamfile =================================================================== --- haiku/trunk/src/apps/pulse/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/apps/pulse/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -3,7 +3,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ; UsePrivateHeaders shared ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { UseHeaders [ FDirName $(HAIKU_TOP) headers os kernel ] : true ; } Modified: haiku/trunk/src/apps/resedit/Jamfile =================================================================== --- haiku/trunk/src/apps/resedit/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/apps/resedit/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -6,7 +6,7 @@ local columnViewSources ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { columnViewSources = ColumnListView.cpp ColumnTypes.cpp ColorTools.cpp ; } Modified: haiku/trunk/src/apps/stylededit/Jamfile =================================================================== --- haiku/trunk/src/apps/stylededit/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/apps/stylededit/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -3,7 +3,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ; UsePrivateHeaders textencoding ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { UseHeaders [ FDirName $(HAIKU_TOP) headers os support ] : true ; UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ; } Modified: haiku/trunk/src/bin/bash/lib/glob/Jamfile =================================================================== --- haiku/trunk/src/bin/bash/lib/glob/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/bin/bash/lib/glob/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ; } Modified: haiku/trunk/src/bin/bash/lib/readline/Jamfile =================================================================== --- haiku/trunk/src/bin/bash/lib/readline/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/bin/bash/lib/readline/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ; } Modified: haiku/trunk/src/bin/bash/lib/sh/Jamfile =================================================================== --- haiku/trunk/src/bin/bash/lib/sh/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/bin/bash/lib/sh/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ; } Modified: haiku/trunk/src/bin/desklink/Jamfile =================================================================== --- haiku/trunk/src/bin/desklink/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/bin/desklink/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { UseHeaders [ FDirName $(HAIKU_TOP) headers os interface ] : true ; # We need the public interface headers also when not compiling for Haiku. UseHeaders [ FDirName $(HAIKU_TOP) headers os ] : true ; Modified: haiku/trunk/src/bin/network/arp/Jamfile =================================================================== --- haiku/trunk/src/bin/network/arp/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/bin/network/arp/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatforms $(HAIKU_BONE_COMPATIBLE_PLATFORMS) ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ; # We need the public network headers also when not compiling for Haiku. # Unfortunately we get more than we want, namely all POSIX headers. Modified: haiku/trunk/src/bin/network/ftp/Jamfile =================================================================== --- haiku/trunk/src/bin/network/ftp/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/bin/network/ftp/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatforms $(HAIKU_BONE_COMPATIBLE_PLATFORMS) ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ; # We need the public network headers also when not compiling for Haiku. # Unfortunately we get more than we want, namely all POSIX headers. Modified: haiku/trunk/src/bin/network/ifconfig/Jamfile =================================================================== --- haiku/trunk/src/bin/network/ifconfig/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/bin/network/ifconfig/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -1,6 +1,6 @@ SubDir HAIKU_TOP src bin network ifconfig ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ; # We need the public network headers also when not compiling for Haiku. # Unfortunately we get more than we want, namely all POSIX headers. Modified: haiku/trunk/src/bin/network/nc/Jamfile =================================================================== --- haiku/trunk/src/bin/network/nc/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/bin/network/nc/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatforms $(HAIKU_BONE_COMPATIBLE_PLATFORMS) ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ; # We need the public network headers also when not compiling for Haiku. # Unfortunately we get more than we want, namely all POSIX headers. Modified: haiku/trunk/src/bin/network/ping/Jamfile =================================================================== --- haiku/trunk/src/bin/network/ping/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/bin/network/ping/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatforms $(HAIKU_BONE_COMPATIBLE_PLATFORMS) ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ; # We need the public network headers also when not compiling for Haiku. # Unfortunately we get more than we want, namely all POSIX headers. Modified: haiku/trunk/src/bin/network/ppp_up/Jamfile =================================================================== --- haiku/trunk/src/bin/network/ppp_up/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/bin/network/ppp_up/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatforms $(HAIKU_BONE_COMPATIBLE_PLATFORMS) ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ; # We need the public network headers also when not compiling for Haiku. # Unfortunately we get more than we want, namely all POSIX headers. Modified: haiku/trunk/src/bin/network/pppconfig/Jamfile =================================================================== --- haiku/trunk/src/bin/network/pppconfig/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/bin/network/pppconfig/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatforms $(HAIKU_BONE_COMPATIBLE_PLATFORMS) ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ; # We need the public network headers also when not compiling for Haiku. # Unfortunately we get more than we want, namely all POSIX headers. Modified: haiku/trunk/src/bin/network/route/Jamfile =================================================================== --- haiku/trunk/src/bin/network/route/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/bin/network/route/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -1,6 +1,6 @@ SubDir HAIKU_TOP src bin network route ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ; # We need the public network headers also when not compiling for Haiku. # Unfortunately we get more than we want, namely all POSIX headers. Modified: haiku/trunk/src/bin/network/traceroute/Jamfile =================================================================== --- haiku/trunk/src/bin/network/traceroute/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/bin/network/traceroute/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatforms $(HAIKU_BONE_COMPATIBLE_PLATFORMS) ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ; # We need the public network headers also when not compiling for Haiku. # Unfortunately we get more than we want, namely all POSIX headers. Modified: haiku/trunk/src/bin/pcmcia-cs/Jamfile =================================================================== --- haiku/trunk/src/bin/pcmcia-cs/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/bin/pcmcia-cs/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -2,11 +2,11 @@ SetSubDirSupportedPlatformsBeOSCompatible ; -if $(TARGET_PLATFORM) != haiku { - UseHeaders [ FDirName $(HAIKU_TOP) headers os drivers ] : true ; - # We need the public pcmcia headers also when not compiling for Haiku. +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { + UseHeaders [ FDirName $(HAIKU_TOP) headers os drivers ] : true ; + # We need the public pcmcia headers also when not compiling for Haiku. UseHeaders [ FDirName $(HAIKU_TOP) headers os support ] : true ; - # We need Errors.h also when not compiling for Haiku. + # We need Errors.h also when not compiling for Haiku. } StdBinCommands Modified: haiku/trunk/src/kits/support/Jamfile =================================================================== --- haiku/trunk/src/kits/support/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/kits/support/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -1,12 +1,6 @@ SubDir HAIKU_TOP src kits support ; SetSubDirSupportedPlatforms haiku libbe_test ; -#if $(TARGET_PLATFORM) != haiku { -# UseHeaders [ FStandardOSHeaders ] : true ; -# UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ; -# # TODO: POSIX headers shouldn't be used. Needed for strlcpy() and -# # addr_t. -#} UsePrivateHeaders shared app media ; Modified: haiku/trunk/src/kits/textencoding/Jamfile =================================================================== --- haiku/trunk/src/kits/textencoding/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/kits/textencoding/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -6,7 +6,7 @@ UsePrivateHeaders textencoding ; SubDirSysHdrs [ FDirName $(SUBDIR) libiconv ] ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { # Argh! Just for . UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ; } Modified: haiku/trunk/src/kits/textencoding/libiconv/Jamfile =================================================================== --- haiku/trunk/src/kits/textencoding/libiconv/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/kits/textencoding/libiconv/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -20,7 +20,7 @@ SubDirSysHdrs $(SUBDIR) ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { # Argh! Just for . UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ; } Modified: haiku/trunk/src/kits/tracker/Jamfile =================================================================== --- haiku/trunk/src/kits/tracker/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/kits/tracker/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -18,7 +18,7 @@ ; local vector_icon_libs ; -if $(TARGET_PLATFORM) = haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { vector_icon_libs = libicon.a libagg.a ; } Modified: haiku/trunk/src/preferences/keyboard/Jamfile =================================================================== --- haiku/trunk/src/preferences/keyboard/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/preferences/keyboard/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { SubDirC++Flags -DCOMPILE_FOR_R5 ; # SubDirC++Flags -fmultiple-symbol-spaces ; } Modified: haiku/trunk/src/preferences/media/Jamfile =================================================================== --- haiku/trunk/src/preferences/media/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/preferences/media/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ; -if $(TARGET_PLATFORM) != haiku { +if $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { SubDirC++Flags -fmultiple-symbol-spaces ; } Modified: haiku/trunk/src/preferences/sounds/Jamfile =================================================================== --- haiku/trunk/src/preferences/sounds/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/preferences/sounds/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { SubDirC++Flags -fmultiple-symbol-spaces ; } Modified: haiku/trunk/src/preferences/virtualmemory/Jamfile =================================================================== --- haiku/trunk/src/preferences/virtualmemory/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/preferences/virtualmemory/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { DRIVER_SETTINGS = driver_settings.c ; } @@ -16,7 +16,7 @@ : VirtualMemory.rdef ; -if $(TARGET_PLATFORM) != haiku { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { SEARCH on [ FGristFiles driver_settings.c ] += [ FDirName $(HAIKU_TOP) src system libroot os ] ; } Modified: haiku/trunk/src/tools/bfs_shell/Jamfile =================================================================== --- haiku/trunk/src/tools/bfs_shell/Jamfile 2007-08-02 21:05:34 UTC (rev 21801) +++ haiku/trunk/src/tools/bfs_shell/Jamfile 2007-08-02 21:13:56 UTC (rev 21802) @@ -20,7 +20,7 @@ } local libHaikuCompat ; -if $(HOST_PLATFORM_BEOS_COMPATIBLE) && $(HOST_PLATFORM) != haiku { +if $(HOST_PLATFORM_BEOS_COMPATIBLE) && ! $(HOST_PLATFORM_HAIKU_COMPATIBLE) { libHaikuCompat = libhaikucompat_build.a ; } From axeld at mail.berlios.de Thu Aug 2 23:44:55 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 2 Aug 2007 23:44:55 +0200 Subject: [Haiku-commits] r21803 - haiku/trunk/src/system/kernel Message-ID: <200708022144.l72Litjv025621@sheep.berlios.de> Author: axeld Date: 2007-08-02 23:44:54 +0200 (Thu, 02 Aug 2007) New Revision: 21803 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21803&view=rev Modified: haiku/trunk/src/system/kernel/module.cpp Log: * Made the module code more robust against putting more module reference than you own - instead of crashing some time later, it will now panic as soon as it can. * No longer put the module image for B_KEEP_LOADED modules - essentially, that feature was broken. * Now use the RecursiveLocker in favour of manual locking where appropriate. This actually fixed two locking bugs in error code paths. * Applied a patch by Fran?\195?\167ois Revol: open_module_list() did not work when the prefix was already inside a module (as opposed to a directory on disk). The current solution is not as efficient, but that can be fixed by improving the iterator code. Modified: haiku/trunk/src/system/kernel/module.cpp =================================================================== --- haiku/trunk/src/system/kernel/module.cpp 2007-08-02 21:13:56 UTC (rev 21802) +++ haiku/trunk/src/system/kernel/module.cpp 2007-08-02 21:44:54 UTC (rev 21803) @@ -9,22 +9,23 @@ /** Manages kernel add-ons and their exported modules. */ +#include + +#include +#include +#include +#include + #include #include -#include #include #include - #include #include +#include #include -#include -#include -#include -#include - //#define TRACE_MODULE #ifdef TRACE_MODULE # define TRACE(x) dprintf x @@ -227,20 +228,6 @@ } -static inline void -inc_module_ref_count(struct module *module) -{ - module->ref_count++; -} - - -static inline void -dec_module_ref_count(struct module *module) -{ - module->ref_count--; -} - - /** Try to load the module image at the specified location. * If it could be loaded, it returns B_OK, and stores a pointer * to the module_image object in "_moduleImage". @@ -311,24 +298,23 @@ { TRACE(("unload_module_image(image = %p, path = %s)\n", moduleImage, path)); - recursive_lock_lock(&sModulesLock); + RecursiveLocker locker(sModulesLock); if (moduleImage == NULL) { // if no image was specified, lookup it up in the hash table moduleImage = (module_image *)hash_lookup(sModuleImagesHash, path); - if (moduleImage == NULL) { - recursive_lock_unlock(&sModulesLock); + if (moduleImage == NULL) return B_ENTRY_NOT_FOUND; - } } if (moduleImage->ref_count != 0) { - FATAL(("Can't unload %s due to ref_cnt = %ld\n", moduleImage->path, moduleImage->ref_count)); + FATAL(("Can't unload %s due to ref_cnt = %ld\n", moduleImage->path, + moduleImage->ref_count)); return B_ERROR; } hash_remove(sModuleImagesHash, moduleImage); - recursive_lock_unlock(&sModulesLock); + locker.Unlock(); unload_kernel_add_on(moduleImage->image); free(moduleImage->path); @@ -357,24 +343,21 @@ { struct module_image *image; - TRACE(("get_module_image(path = \"%s\", _image = %p)\n", path, _image)); + TRACE(("get_module_image(path = \"%s\", loadIfNeeded = %d)\n", path, + loadIfNeeded)); - recursive_lock_lock(&sModulesLock); + RecursiveLocker _(sModulesLock); image = (module_image *)hash_lookup(sModuleImagesHash, path); if (image == NULL) { status_t status = load_module_image(path, &image); - if (status < B_OK) { - recursive_lock_unlock(&sModulesLock); + if (status < B_OK) return status; - } } atomic_add(&image->ref_count, 1); *_image = image; - recursive_lock_unlock(&sModulesLock); - return B_OK; } @@ -451,7 +434,8 @@ module_info **info; int index = 0, match = B_ENTRY_NOT_FOUND; - TRACE(("check_module_image(path = \"%s\", searchedName = \"%s\")\n", path, searchedName)); + TRACE(("check_module_image(path = \"%s\", searchedName = \"%s\")\n", path, + searchedName)); if (get_module_image(path, &image) < B_OK) return B_ENTRY_NOT_FOUND; @@ -468,7 +452,8 @@ // The module we looked for couldn't be found, so we can unload the // loaded module at this point if (match != B_OK) { - TRACE(("check_module_file: unloading module file \"%s\" (not used yet)\n", path)); + TRACE(("check_module_file: unloading module file \"%s\" (not used yet)\n", + path)); unload_module_image(image, path); } @@ -517,14 +502,15 @@ static status_t put_dependent_modules(struct module *module) { + module_image *image = module->module_image; module_dependency *dependencies; - int32 i = 0; - if (module->module_image == NULL - || (dependencies = module->module_image->dependencies) == NULL) + // built-in modules don't have a module_image structure + if (image == NULL + || (dependencies = image->dependencies) == NULL) return B_OK; - for (; dependencies[i].name != NULL; i++) { + for (int32 i = 0; dependencies[i].name != NULL; i++) { status_t status = put_module(dependencies[i].name); if (status < B_OK) return status; @@ -537,20 +523,22 @@ static status_t get_dependent_modules(struct module *module) { + module_image *image = module->module_image; module_dependency *dependencies; - int32 i = 0; // built-in modules don't have a module_image structure - if (module->module_image == NULL - || (dependencies = module->module_image->dependencies) == NULL) + if (image == NULL + || (dependencies = image->dependencies) == NULL) return B_OK; TRACE(("resolving module dependencies...\n")); - for (; dependencies[i].name != NULL; i++) { - status_t status = get_module(dependencies[i].name, dependencies[i].info); + for (int32 i = 0; dependencies[i].name != NULL; i++) { + status_t status = get_module(dependencies[i].name, + dependencies[i].info); if (status < B_OK) { - TRACE(("loading dependent module \"%s\" failed!\n", dependencies[i].name)); + dprintf("loading dependent module %s of %s failed!\n", + dependencies[i].name, module->name); return status; } } @@ -651,10 +639,11 @@ module->state = MODULE_LOADED; put_dependent_modules(module); - return 0; + return B_OK; } - FATAL(("Error unloading module %s (%s)\n", module->name, strerror(status))); + FATAL(("Error unloading module %s (%s)\n", module->name, + strerror(status))); module->state = MODULE_ERROR; module->flags |= B_KEEP_LOADED; @@ -941,10 +930,14 @@ char path[B_FILE_NAME_LENGTH]; const char *name, *suffix; if (moduleImage->info[0] - && (suffix = strstr(name = moduleImage->info[0]->name, image->name)) != NULL) { - // even if strlcpy() is used here, it's by no means safe against buffer overflows - size_t length = strlcpy(path, "/boot/beos/system/add-ons/kernel/", sizeof(path)); - strlcpy(path + length, name, strlen(image->name) + 1 + (suffix - name)); + && (suffix = strstr(name = moduleImage->info[0]->name, + image->name)) != NULL) { + // even if strlcpy() is used here, it's by no means safe + // against buffer overflows + size_t length = strlcpy(path, "/boot/beos/system/add-ons/kernel/", + sizeof(path)); + strlcpy(path + length, name, strlen(image->name) + + 1 + (suffix - name)); moduleImage->path = strdup(path); } else @@ -1070,7 +1063,8 @@ if (sModulesHash == NULL) return B_NO_MEMORY; - sModuleImagesHash = hash_init(MODULE_HASH_SIZE, 0, module_image_compare, module_image_hash); + sModuleImagesHash = hash_init(MODULE_HASH_SIZE, 0, module_image_compare, + module_image_hash); if (sModuleImagesHash == NULL) return B_NO_MEMORY; @@ -1082,13 +1076,16 @@ for (image = args->preloaded_images; image != NULL; image = image->next) { status_t status = register_preloaded_module_image(image); - if (status != B_OK) - dprintf("Could not register image \"%s\": %s\n", image->name, strerror(status)); + if (status != B_OK) { + dprintf("Could not register image \"%s\": %s\n", image->name, + strerror(status)); + } } // ToDo: set sDisableUserAddOns from kernel_args! - add_debugger_command("modules", &dump_modules, "list all known & loaded modules"); + add_debugger_command("modules", &dump_modules, + "list all known & loaded modules"); return B_OK; } @@ -1145,6 +1142,18 @@ if (sDisableUserAddOns && i >= FIRST_USER_MODULE_PATH) break; + // Copy base path onto the iterator stack + char *path = strdup(sModulePaths[i]); + if (path == NULL) + continue; + + size_t length = strlen(path); + + // TODO: it would currently be nicer to use the commented + // version below, but the iterator won't work if the prefix + // is inside a module then. + // It works this way, but should be done better. +#if 0 // Build path component: base path + '/' + prefix size_t length = strlen(sModulePaths[i]); char *path = (char *)malloc(length + iterator->prefix_length + 2); @@ -1158,6 +1167,7 @@ path[length] = '/'; memcpy(path + length + 1, iterator->prefix, iterator->prefix_length + 1); +#endif iterator_push_path_on_stack(iterator, path, length + 1); } @@ -1203,7 +1213,7 @@ free(iterator->prefix); free(iterator); - return 0; + return B_OK; } @@ -1235,7 +1245,8 @@ iterator->status = status; recursive_lock_unlock(&sModulesLock); - TRACE(("read_next_module_name: finished with status %s\n", strerror(status))); + TRACE(("read_next_module_name: finished with status %s\n", + strerror(status))); return status; } @@ -1262,7 +1273,7 @@ status_t status = B_ENTRY_NOT_FOUND; uint32 offset = *_cookie; - recursive_lock_lock(&sModulesLock); + RecursiveLocker _(sModulesLock); hash_iterator iterator; hash_open(sModulesHash, &iterator); @@ -1280,7 +1291,6 @@ } hash_close(sModulesHash, &iterator, false); - recursive_lock_unlock(&sModulesLock); return status; } @@ -1298,7 +1308,7 @@ if (path == NULL) return B_BAD_VALUE; - recursive_lock_lock(&sModulesLock); + RecursiveLocker _(sModulesLock); module = (struct module *)hash_lookup(sModulesHash, path); @@ -1307,7 +1317,7 @@ module = search_module(path); if (module == NULL) { FATAL(("module: Search for %s failed.\n", path)); - goto err; + return B_ENTRY_NOT_FOUND; } } @@ -1320,7 +1330,7 @@ * is unloaded). */ if (get_module_image(module->file, &moduleImage) < B_OK) - goto err; + return B_ENTRY_NOT_FOUND; // (re)set in-memory data for the loaded module module->info = moduleImage->info[module->offset]; @@ -1339,17 +1349,15 @@ status = B_OK; if (status == B_OK) { - inc_module_ref_count(module); + if (module->ref_count < 0) + panic("argl %s", path); + module->ref_count++; *_info = module->info; - } else if ((module->flags & B_BUILT_IN_MODULE) == 0) + } else if ((module->flags & B_BUILT_IN_MODULE) == 0 + && (module->flags & B_KEEP_LOADED) == 0) put_module_image(module->module_image); - recursive_lock_unlock(&sModulesLock); return status; - -err: - recursive_lock_unlock(&sModulesLock); - return B_ENTRY_NOT_FOUND; } @@ -1360,25 +1368,23 @@ TRACE(("put_module(path = %s)\n", path)); - recursive_lock_lock(&sModulesLock); + RecursiveLocker _(sModulesLock); module = (struct module *)hash_lookup(sModulesHash, path); if (module == NULL) { - FATAL(("module: We don't seem to have a reference to module %s\n", path)); - recursive_lock_unlock(&sModulesLock); + FATAL(("module: We don't seem to have a reference to module %s\n", + path)); return B_BAD_VALUE; } - + + if (module->ref_count == 0) + panic("module %s has no references.\n", path); + if ((module->flags & B_KEEP_LOADED) == 0) { - dec_module_ref_count(module); - - if (module->ref_count == 0) + if (--module->ref_count == 0) uninit_module(module); - } - - if ((module->flags & B_BUILT_IN_MODULE) == 0) + } else if ((module->flags & B_BUILT_IN_MODULE) == 0) put_module_image(module->module_image); - recursive_lock_unlock(&sModulesLock); return B_OK; } From axeld at mail.berlios.de Fri Aug 3 01:05:54 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 3 Aug 2007 01:05:54 +0200 Subject: [Haiku-commits] r21804 - haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/pop3 Message-ID: <200708022305.l72N5s2L012458@sheep.berlios.de> Author: axeld Date: 2007-08-03 01:05:53 +0200 (Fri, 03 Aug 2007) New Revision: 21804 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21804&view=rev Modified: haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.h Log: * Fixed filling the log in ReceiveLine() - ie. it's not done anymore there. * Fixed error message in Open() when the server didn't return anything. * Made the pop3.h header self contained. Modified: haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp =================================================================== --- haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp 2007-08-02 21:44:54 UTC (rev 21803) +++ haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp 2007-08-02 23:05:53 UTC (rev 21804) @@ -7,28 +7,22 @@ //! POP3Protocol - implementation of the POP3 protocol +#include "pop3.h" + +#include +#include +#include #include -#include -#include -#include -#include -#include -#include +#include +#include #include -#include -#include -#ifndef HAIKU_TARGET_PLATFORM_BEOS // These headers don't exist in BeOS R5. + +#ifndef HAIKU_TARGET_PLATFORM_BEOS + // These headers don't exist in BeOS R5. #include #include #endif -#include -#include -#include -#include - -#include - #if USESSL #include #include @@ -37,8 +31,17 @@ #include "md5.h" #endif -#include "pop3.h" +#include +#include +#include +#include +#include +#include +#include + +#include + #define POP3_RETRIEVAL_TIMEOUT 60000000 #define CRLF "\r\n" @@ -206,8 +209,12 @@ } if (strncmp(line.String(), "+OK", 3) != 0) { - error_msg << MDR_DIALECT_CHOICE(". The server said:\n", - "???????????\n") << line.String(); + if (line.Length() > 0) { + error_msg << MDR_DIALECT_CHOICE(". The server said:\n", + "???????????\n") << line.String(); + } else + error_msg << ": No reply.\n"; + runner->ShowError(error_msg.String()); return B_ERROR; } @@ -623,15 +630,9 @@ line += (char)c; } } - } else { - status_t error = errno; - fLog = "POP3 "; - fLog << strerror(error) << "."; + } else + return errno; - runner->Stop(true); - return error; - } - return len; } Modified: haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.h =================================================================== --- haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.h 2007-08-02 21:44:54 UTC (rev 21803) +++ haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.h 2007-08-02 23:05:53 UTC (rev 21804) @@ -1,17 +1,23 @@ -#ifndef ZOIDBERG_POP3_H -#define ZOIDBERG_POP3_H -/* POP3Protocol - implementation of the POP3 protocol -** -** Copyright 2001-2002 Dr. Zoidberg Enterprises. All rights reserved. -*/ +/* + * Copyright 2001-2002 Dr. Zoidberg Enterprises. All rights reserved. + * Copyright 2007, Haiku Inc. All Rights Reserved. + * + * Distributed under the terms of the MIT License. + */ +#ifndef POP3_H +#define POP3_H -#include + #include +#include +#include + #include "SimpleMailProtocol.h" + class POP3Protocol : public SimpleMailProtocol { - public: +public: POP3Protocol(BMessage *settings, BMailChainRunner *status); ~POP3Protocol(); @@ -50,4 +56,4 @@ #endif }; -#endif /* ZOIDBERG_POP3_H */ +#endif /* POP3_H */ From stippi at mail.berlios.de Fri Aug 3 03:11:28 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 3 Aug 2007 03:11:28 +0200 Subject: [Haiku-commits] r21805 - in haiku/trunk/src/servers/app: . drawing/Painter Message-ID: <200708030111.l731BSOE021025@sheep.berlios.de> Author: stippi Date: 2007-08-03 03:11:27 +0200 (Fri, 03 Aug 2007) New Revision: 21805 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21805&view=rev Added: haiku/trunk/src/servers/app/drawing/Painter/AGGTextRenderer.cpp haiku/trunk/src/servers/app/drawing/Painter/AGGTextRenderer.h Removed: haiku/trunk/src/servers/app/drawing/Painter/font_support/ Modified: haiku/trunk/src/servers/app/FontCacheEntry.cpp haiku/trunk/src/servers/app/FontCacheEntry.h haiku/trunk/src/servers/app/FontEngine.cpp haiku/trunk/src/servers/app/FontEngine.h haiku/trunk/src/servers/app/GlyphLayoutEngine.h haiku/trunk/src/servers/app/ServerApp.cpp haiku/trunk/src/servers/app/ServerFont.cpp haiku/trunk/src/servers/app/drawing/Painter/Jamfile Log: * moved AGGTextRenderer alongside it's pal, Painter, it felt lonely, removed font_support folder * ServerApp can use ServerFont::StringWidth() directly again * more ServerFont functions implemented via GlyphLayoutEngine and custom consumer * extended GlyphCache data structure to hole the left/right insets of the glyph shape between its advance width, took it from the earlier ServerFont implementation, have not tested if that gives same result as R5 * TODO: implement GetGylphShapes via GlyphCache, although it might not look as clean as it does now Modified: haiku/trunk/src/servers/app/FontCacheEntry.cpp =================================================================== --- haiku/trunk/src/servers/app/FontCacheEntry.cpp 2007-08-02 23:05:53 UTC (rev 21804) +++ haiku/trunk/src/servers/app/FontCacheEntry.cpp 2007-08-03 01:11:27 UTC (rev 21805) @@ -56,7 +56,7 @@ GlyphCache* CacheGlyph(uint16 glyphCode, unsigned glyphIndex, unsigned dataSize, glyph_data_type dataType, const agg::rect_i& bounds, - double advanceX, double advanceY) + float advanceX, float advanceY, float insetLeft, float insetRight) { unsigned msb = (glyphCode >> 8) & 0xFF; if (fGlyphs[msb] == 0) { @@ -81,6 +81,8 @@ glyph->bounds = bounds; glyph->advance_x = advanceX; glyph->advance_y = advanceY; + glyph->inset_left = insetLeft; + glyph->inset_right = insetRight; return fGlyphs[msb][lsb] = glyph; } @@ -133,7 +135,7 @@ // HasGlyphs bool -FontCacheEntry::HasGlyphs(const char* utf8String, size_t length) const +FontCacheEntry::HasGlyphs(const char* utf8String, ssize_t length) const { uint32 charCode; const char* start = utf8String; @@ -158,7 +160,8 @@ glyph = fGlyphCache->CacheGlyph(glyphCode, fEngine.GlyphIndex(), fEngine.DataSize(), fEngine.DataType(), fEngine.Bounds(), - fEngine.AdvanceX(), fEngine.AdvanceY()); + fEngine.AdvanceX(), fEngine.AdvanceY(), + fEngine.InsetLeft(), fEngine.InsetRight()); fEngine.WriteGlyphTo(glyph->data); Modified: haiku/trunk/src/servers/app/FontCacheEntry.h =================================================================== --- haiku/trunk/src/servers/app/FontCacheEntry.h 2007-08-02 23:05:53 UTC (rev 21804) +++ haiku/trunk/src/servers/app/FontCacheEntry.h 2007-08-03 01:11:27 UTC (rev 21805) @@ -45,8 +45,10 @@ unsigned data_size; glyph_data_type data_type; agg::rect_i bounds; - double advance_x; - double advance_y; + float advance_x; + float advance_y; + float inset_left; + float inset_right; }; class FontCache; @@ -74,7 +76,7 @@ bool Init(const ServerFont& font); bool HasGlyphs(const char* utf8String, - size_t glyphCount) const; + ssize_t glyphCount) const; const GlyphCache* Glyph(uint16 glyphCode); Modified: haiku/trunk/src/servers/app/FontEngine.cpp =================================================================== --- haiku/trunk/src/servers/app/FontEngine.cpp 2007-08-02 23:05:53 UTC (rev 21804) +++ haiku/trunk/src/servers/app/FontEngine.cpp 2007-08-03 01:11:27 UTC (rev 21805) @@ -365,6 +365,8 @@ , fBounds(1, 1, 0, 0) , fAdvanceX(0.0) , fAdvanceY(0.0) + , fInsetLeft(0.0) + , fInsetRight(0.0) , fPath() , fCurves(fPath) @@ -411,6 +413,12 @@ if (fLastError != 0) return false; + fAdvanceX = int26p6_to_dbl(fFace->glyph->advance.x); + fAdvanceY = int26p6_to_dbl(fFace->glyph->advance.y); + fInsetLeft = int26p6_to_dbl(fFace->glyph->metrics.horiBearingX); + fInsetRight = int26p6_to_dbl(fFace->glyph->metrics.horiBearingX + + fFace->glyph->metrics.width - fFace->glyph->metrics.horiAdvance); + switch(fGlyphRendering) { case glyph_ren_native_mono: fLastError = FT_Render_Glyph(fFace->glyph, FT_RENDER_MODE_MONO); @@ -428,8 +436,6 @@ fBounds.y2 = fScanlineStorageBin.max_y(); fDataSize = fScanlineStorageBin.byte_size(); fDataType = glyph_data_mono; - fAdvanceX = int26p6_to_dbl(fFace->glyph->advance.x); - fAdvanceY = int26p6_to_dbl(fFace->glyph->advance.y); return true; } break; @@ -451,8 +457,6 @@ fBounds.y2 = fScanlineStorageAA.max_y(); fDataSize = fScanlineStorageAA.byte_size(); fDataType = glyph_data_gray8; - fAdvanceX = int26p6_to_dbl(fFace->glyph->advance.x); - fAdvanceY = int26p6_to_dbl(fFace->glyph->advance.y); return true; } break; @@ -470,8 +474,6 @@ fBounds.y1 = int(floor(bnd.y1)); fBounds.x2 = int(ceil(bnd.x2)); fBounds.y2 = int(ceil(bnd.y2)); - fAdvanceX = int26p6_to_dbl(fFace->glyph->advance.x); - fAdvanceY = int26p6_to_dbl(fFace->glyph->advance.y); return true; } break; Modified: haiku/trunk/src/servers/app/FontEngine.h =================================================================== --- haiku/trunk/src/servers/app/FontEngine.h 2007-08-02 23:05:53 UTC (rev 21804) +++ haiku/trunk/src/servers/app/FontEngine.h 2007-08-03 01:11:27 UTC (rev 21805) @@ -95,6 +95,10 @@ { return fAdvanceX; } double AdvanceY() const { return fAdvanceY; } + double InsetLeft() const + { return fInsetLeft; } + double InsetRight() const + { return fInsetRight; } void WriteGlyphTo(uint8* data) const; @@ -123,6 +127,8 @@ agg::rect_i fBounds; double fAdvanceX; double fAdvanceY; + double fInsetLeft; + double fInsetRight; // these members are for caching memory allocations // when rendering glyphs Modified: haiku/trunk/src/servers/app/GlyphLayoutEngine.h =================================================================== --- haiku/trunk/src/servers/app/GlyphLayoutEngine.h 2007-08-02 23:05:53 UTC (rev 21804) +++ haiku/trunk/src/servers/app/GlyphLayoutEngine.h 2007-08-03 01:11:27 UTC (rev 21805) @@ -28,17 +28,17 @@ bool kerning = true, uint8 spacing = B_BITMAP_SPACING); + static bool IsWhiteSpace(uint32 glyphCode); + private: GlyphLayoutEngine(); virtual ~GlyphLayoutEngine(); - - static bool _IsWhiteSpace(uint32 glyph); }; -// _IsWhiteSpace +// IsWhiteSpace inline bool -GlyphLayoutEngine::_IsWhiteSpace(uint32 charCode) +GlyphLayoutEngine::IsWhiteSpace(uint32 charCode) { switch (charCode) { case 0x0009: /* tab */ @@ -64,6 +64,7 @@ const char* utf8String, int32 length, const escapement_delta* delta, bool kerning, uint8 spacing) { + // TODO: implement spacing modes FontCache* cache = FontCache::Default(); FontCacheEntry* entry = cache->FontCacheEntryFor(font); @@ -113,7 +114,7 @@ y += advanceY; if (delta) - x += _IsWhiteSpace(charCode) ? delta->space : delta->nonspace; + x += IsWhiteSpace(charCode) ? delta->space : delta->nonspace; if (!consumer.ConsumeGlyph(index, charCode, glyph, entry, x, y)) break; Modified: haiku/trunk/src/servers/app/ServerApp.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerApp.cpp 2007-08-02 23:05:53 UTC (rev 21804) +++ haiku/trunk/src/servers/app/ServerApp.cpp 2007-08-03 01:11:27 UTC (rev 21805) @@ -1416,14 +1416,8 @@ if (!stringArray[i] || lengthArray[i] <= 0) widthArray[i] = 0.0; else { - widthArray[i] = fDesktop->GetDrawingEngine()-> - StringWidth(stringArray[i], lengthArray[i], font); - // NOTE: The line below will return the exact same thing. - // However, the line above uses the AGG rendering backend, - // for which glyph caching actually works. It is about - // 20 times faster! -// widthArray[i] = font.StringWidth(stringArray[i], -// lengthArray[i]); + widthArray[i] = font.StringWidth(stringArray[i], + lengthArray[i]); } } Modified: haiku/trunk/src/servers/app/ServerFont.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerFont.cpp 2007-08-02 23:05:53 UTC (rev 21804) +++ haiku/trunk/src/servers/app/ServerFont.cpp 2007-08-03 01:11:27 UTC (rev 21805) @@ -410,92 +410,171 @@ } -status_t -ServerFont::GetEdges(const char charArray[], int32 numChars, - edge_info edgeArray[]) const -{ - if (!charArray || numChars <= 0 || !edgeArray) - return B_BAD_DATA; - - FT_Face face = GetTransformedFace(false, false); - if (!face) - return B_ERROR; - - const char *string = charArray; - for (int i = 0; i < numChars; i++) { - FT_Load_Char(face, UTF8ToCharCode(&string), FT_LOAD_NO_BITMAP); - edgeArray[i].left = float(face->glyph->metrics.horiBearingX) - / 64 / fSize; - edgeArray[i].right = float(face->glyph->metrics.horiBearingX - + face->glyph->metrics.width - face->glyph->metrics.horiAdvance) - / 64 / fSize; +class EdgesConsumer { + public: + EdgesConsumer(edge_info* edges, float size) + : fEdges(edges) + , fSize(size) + { } + void Start() {} + void Finish(double x, double y) {} + void ConsumeEmptyGlyph(int32 index, uint32 charCode, double x, double y) + { + fEdges[index].left = 0.0; + fEdges[index].right = 0.0; + } + bool ConsumeGlyph(int32 index, uint32 charCode, const GlyphCache* glyph, + FontCacheEntry* entry, double x, double y) + { + fEdges[index].left = glyph->inset_left / fSize; + fEdges[index].right = glyph->inset_right / fSize; + return true; + } - PutTransformedFace(face); - return B_OK; -} + private: + edge_info* fEdges; + float fSize; +}; status_t -ServerFont::GetEscapements(const char charArray[], int32 numChars, - escapement_delta delta, BPoint escapementArray[], - BPoint offsetArray[]) const +ServerFont::GetEdges(const char* string, int32 numChars, + edge_info* edges) const { - if (!charArray || numChars <= 0 || !escapementArray) + if (!string || numChars <= 0 || !edges) return B_BAD_DATA; - FT_Face face = GetTransformedFace(true, false); - if (!face) - return B_ERROR; + bool kerning = true; // TODO make this a property? - const char *string = charArray; - for (int i = 0; i < numChars; i++) { - uint32 charCode = UTF8ToCharCode(&string); - FT_Load_Char(face, charCode, FT_LOAD_NO_BITMAP); - escapementArray[i].x = is_white_space(charCode) ? delta.space : delta.nonspace; - escapementArray[i].x += float(face->glyph->advance.x) / 64; - escapementArray[i].y = -float(face->glyph->advance.y) / 64; - escapementArray[i].x /= fSize; - escapementArray[i].y /= fSize; + EdgesConsumer consumer(edges, fSize); + if (GlyphLayoutEngine::LayoutGlyphs(consumer, *this, string, numChars, + NULL, kerning, fSpacing)) + return B_OK; - if (offsetArray) { + return B_ERROR; + +// FT_Face face = GetTransformedFace(false, false); +// if (!face) +// return B_ERROR; +// +// const char *string = charArray; +// for (int i = 0; i < numChars; i++) { +// FT_Load_Char(face, UTF8ToCharCode(&string), FT_LOAD_NO_BITMAP); +// edgeArray[i].left = float(face->glyph->metrics.horiBearingX) +// / 64 / fSize; +// edgeArray[i].right = float(face->glyph->metrics.horiBearingX +// + face->glyph->metrics.width - face->glyph->metrics.horiAdvance) +// / 64 / fSize; +// } +// +// PutTransformedFace(face); +// return B_OK; +} + + +class BPointEscapementConsumer { + public: + BPointEscapementConsumer(BPoint* escapements, BPoint* offsets, float size) + : fEscapements(escapements) + , fOffsets(offsets) + , fSize(size) + { + } + void Start() {} + void Finish(double x, double y) {} + void ConsumeEmptyGlyph(int32 index, uint32 charCode, double x, double y) + { + _Set(index, 0, 0); + } + bool ConsumeGlyph(int32 index, uint32 charCode, const GlyphCache* glyph, + FontCacheEntry* entry, double x, double y) + { + _Set(index, glyph->advance_x, glyph->advance_y); + return true; + } + private: + inline void _Set(int32 index, double x, double y) + { + fEscapements[index].x = x / fSize; + fEscapements[index].y = y / fSize; + if (fOffsets) { // ToDo: According to the BeBook: "The offsetArray is applied by // the dynamic spacing in order to improve the relative position // of the character's width with relation to another character, // without altering the width." So this will probably depend on // the spacing mode. - offsetArray[i].x = 0; - offsetArray[i].y = 0; + fOffsets[index].x = 0; + fOffsets[index].y = 0; } } - PutTransformedFace(face); - return B_OK; + BPoint* fEscapements; + BPoint* fOffsets; + float fSize; +}; + + +status_t +ServerFont::GetEscapements(const char* string, int32 numChars, + escapement_delta delta, BPoint escapementArray[], + BPoint offsetArray[]) const +{ + if (!string || numChars <= 0 || !escapementArray) + return B_BAD_DATA; + + bool kerning = true; // TODO make this a property? + + BPointEscapementConsumer consumer(escapementArray, offsetArray, fSize); + if (GlyphLayoutEngine::LayoutGlyphs(consumer, *this, string, numChars, + &delta, kerning, fSpacing)) + return B_OK; + + return B_ERROR; } +class WidthEscapementConsumer { + public: + WidthEscapementConsumer(float* widths, float size) + : fWidths(widths) + , fSize(size) + { + } + void Start() {} + void Finish(double x, double y) {} + void ConsumeEmptyGlyph(int32 index, uint32 charCode, double x, double y) + { + fWidths[index] = 0.0; + } + bool ConsumeGlyph(int32 index, uint32 charCode, const GlyphCache* glyph, + FontCacheEntry* entry, double x, double y) + { + fWidths[index] = glyph->advance_x / fSize; + return true; + } + + private: + float* fWidths; + float fSize; +}; + + + status_t -ServerFont::GetEscapements(const char charArray[], int32 numChars, +ServerFont::GetEscapements(const char* string, int32 numChars, escapement_delta delta, float widthArray[]) const { - if (!charArray || numChars <= 0 || !widthArray) + if (!string || numChars <= 0 || !widthArray) return B_BAD_DATA; - FT_Face face = GetTransformedFace(false, false); - if (!face) - return B_ERROR; + bool kerning = true; // TODO make this a property? - const char *string = charArray; - for (int i = 0; i < numChars; i++) { - uint32 charCode = UTF8ToCharCode(&string); - FT_Load_Char(face, charCode, FT_LOAD_NO_BITMAP); - widthArray[i] = is_white_space(charCode) ? delta.space : delta.nonspace; - widthArray[i] += float(face->glyph->metrics.horiAdvance) / 64.0; - widthArray[i] /= fSize; - } - - PutTransformedFace(face); - return B_OK; + WidthEscapementConsumer consumer(widthArray, fSize); + if (GlyphLayoutEngine::LayoutGlyphs(consumer, *this, string, numChars, + &delta, kerning, fSpacing)) + return B_OK; + return B_ERROR; } @@ -523,18 +602,18 @@ const agg::rect_i& r = glyph->bounds; if (fAsString) { rectArray[index].left = r.x1 + x; - rectArray[index].top = r.y1 + y - 1; + rectArray[index].top = r.y1 + y; rectArray[index].right = r.x2 + x + 1; rectArray[index].bottom = r.y2 + y + 1; } else { if (rectArray) { rectArray[index].left = r.x1; - rectArray[index].top = r.y1 - 1; + rectArray[index].top = r.y1; rectArray[index].right = r.x2 + 1; rectArray[index].bottom = r.y2 + 1; } else { stringBoundingBox = stringBoundingBox - | BRect(r.x1 + x, r.y1 + y - 1, + | BRect(r.x1 + x, r.y1 + y, r.x2 + x + 1, r.y2 + y + 1); } } Copied: haiku/trunk/src/servers/app/drawing/Painter/AGGTextRenderer.cpp (from rev 21798, haiku/trunk/src/servers/app/drawing/Painter/font_support/AGGTextRenderer.cpp) Copied: haiku/trunk/src/servers/app/drawing/Painter/AGGTextRenderer.h (from rev 21798, haiku/trunk/src/servers/app/drawing/Painter/font_support/AGGTextRenderer.h) Modified: haiku/trunk/src/servers/app/drawing/Painter/Jamfile =================================================================== --- haiku/trunk/src/servers/app/drawing/Painter/Jamfile 2007-08-02 23:05:53 UTC (rev 21804) +++ haiku/trunk/src/servers/app/drawing/Painter/Jamfile 2007-08-03 01:11:27 UTC (rev 21805) @@ -8,11 +8,9 @@ UseHeaders [ FDirName $(HAIKU_TOP) src servers app ] ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing ] ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter drawing_modes ] ; -UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter font_support ] ; UseFreeTypeHeaders ; SEARCH_SOURCE += [ FDirName $(SUBDIR) drawing_modes ] ; -SEARCH_SOURCE += [ FDirName $(SUBDIR) font_support ] ; StaticLibrary libpainter.a : Painter.cpp From axeld at mail.berlios.de Fri Aug 3 03:26:37 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 3 Aug 2007 03:26:37 +0200 Subject: [Haiku-commits] r21806 - haiku/trunk/src/system/kernel/vm Message-ID: <200708030126.l731QbbZ022323@sheep.berlios.de> Author: axeld Date: 2007-08-03 03:26:35 +0200 (Fri, 03 Aug 2007) New Revision: 21806 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21806&view=rev Modified: haiku/trunk/src/system/kernel/vm/vm.cpp Log: vfs_get_vnode_cache() was changed (read: fixed) since r18716; it was wrong to acquire the extra vnode reference, and actually prevented unmounting from working - which it now does again. Modified: haiku/trunk/src/system/kernel/vm/vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm.cpp 2007-08-03 01:11:27 UTC (rev 21805) +++ haiku/trunk/src/system/kernel/vm/vm.cpp 2007-08-03 01:26:35 UTC (rev 21806) @@ -1123,13 +1123,9 @@ } -/** Creates the vnode cache for the specified \a vnode. - * The vnode has to be marked busy when calling this function. - * If successful, it will also acquire an extra reference to - * the vnode (as the vnode store itself can't do this - * automatically). - */ - +/*! Creates the vnode cache for the specified \a vnode. + The vnode has to be marked busy when calling this function. +*/ status_t vm_create_vnode_cache(void *vnode, struct vm_cache **_cache) { @@ -1149,7 +1145,6 @@ cache->type = CACHE_TYPE_VNODE; *_cache = cache; - vfs_acquire_vnode(vnode); return B_OK; err1: From mmu_man at mail.berlios.de Fri Aug 3 03:28:21 2007 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 3 Aug 2007 03:28:21 +0200 Subject: [Haiku-commits] r21807 - haiku/trunk/src/add-ons/kernel/bus_managers/pci Message-ID: <200708030128.l731SLuL022424@sheep.berlios.de> Author: mmu_man Date: 2007-08-03 03:28:21 +0200 (Fri, 03 Aug 2007) New Revision: 21807 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21807&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/pci/pci.cpp Log: Add kdl commands (inb,ins,inw) to dump pci io ports (untested). Modified: haiku/trunk/src/add-ons/kernel/bus_managers/pci/pci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/pci/pci.cpp 2007-08-03 01:26:35 UTC (rev 21806) +++ haiku/trunk/src/add-ons/kernel/bus_managers/pci/pci.cpp 2007-08-03 01:28:21 UTC (rev 21807) @@ -7,6 +7,7 @@ */ +#include #include #define __HAIKU_PCI_BUS_MANAGER_TESTING 1 #include @@ -122,6 +123,80 @@ } +// #pragma mark kernel debugger commands + +static int +display_io(int argc, char **argv) +{ + int32 displayWidth; + int32 itemSize; + int32 num = -1; + int address; + int i = 1, j; + + switch (argc) { + case 3: + num = atoi(argv[2]); + case 2: + address = strtoul(argv[1], NULL, 0); + default: + kprintf("usage: %s
[num]\n", argv[0]); + return 0; + } + + // build the format string + if (strcmp(argv[0], "inb") == 0 || strcmp(argv[0], "in8") == 0) { + itemSize = 1; + displayWidth = 16; + } else if (strcmp(argv[0], "ins") == 0 || strcmp(argv[0], "in16") == 0) { + itemSize = 2; + displayWidth = 8; + } else if (strcmp(argv[0], "inw") == 0 || strcmp(argv[0], "in32") == 0) { + itemSize = 4; + displayWidth = 4; + } else { + kprintf("display_io called in an invalid way!\n"); + return 0; + } + + if (num <= 0) + num = displayWidth; + + for (i = 0; i < num; i++) { + if ((i % displayWidth) == 0) { + int32 displayed = min_c(displayWidth, (num-i)) * itemSize; + if (i != 0) + kprintf("\n"); + + kprintf("[0x%lx] ", address + i * itemSize); + + if (num > displayWidth) { + // make sure the spacing in the last line is correct + for (j = displayed; j < displayWidth * itemSize; j++) + kprintf(" "); + } + kprintf(" "); + } + + switch (itemSize) { + case 1: + kprintf(" %02x", pci_read_io_8(address + i * itemSize)); + break; + case 2: + kprintf(" %04x", pci_read_io_16(address + i * itemSize)); + break; + case 4: + kprintf(" %08lx", pci_read_io_32(address + i * itemSize)); + break; + } + } + + kprintf("\n"); + return 0; +} + + + // #pragma mark bus manager init/uninit status_t @@ -134,6 +209,13 @@ return B_ERROR; } + add_debugger_command("inw", &display_io, "dump io words (32-bit)"); + add_debugger_command("in32", &display_io, "dump io words (32-bit)"); + add_debugger_command("ins", &display_io, "dump io shorts (16-bit)"); + add_debugger_command("in16", &display_io, "dump io shorts (16-bit)"); + add_debugger_command("inb", &display_io, "dump io bytes (8-bit)"); + add_debugger_command("in8", &display_io, "dump io bytes (8-bit)"); + if (pci_controller_init() != B_OK) { TRACE(("PCI: pci_controller_init failed\n")); return B_ERROR; @@ -149,6 +231,12 @@ void pci_uninit(void) { + remove_debugger_command("inw", &display_io); + remove_debugger_command("in32", &display_io); + remove_debugger_command("ins", &display_io); + remove_debugger_command("in16", &display_io); + remove_debugger_command("inb", &display_io); + remove_debugger_command("in8", &display_io); delete sPCI; } From jackburton at mail.berlios.de Fri Aug 3 11:59:32 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Fri, 3 Aug 2007 11:59:32 +0200 Subject: [Haiku-commits] r21808 - haiku/trunk/src/apps/terminal Message-ID: <200708030959.l739xW9f001468@sheep.berlios.de> Author: jackburton Date: 2007-08-03 11:59:30 +0200 (Fri, 03 Aug 2007) New Revision: 21808 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21808&view=rev Modified: haiku/trunk/src/apps/terminal/Shell.cpp haiku/trunk/src/apps/terminal/Shell.h haiku/trunk/src/apps/terminal/SmartTabView.cpp haiku/trunk/src/apps/terminal/TermParse.cpp haiku/trunk/src/apps/terminal/TermView.cpp haiku/trunk/src/apps/terminal/TermView.h haiku/trunk/src/apps/terminal/TermWindow.cpp haiku/trunk/src/apps/terminal/TermWindow.h Log: Attach/DetachShell are now private. Added a new TermView constructor which only specifies the rows and columns, view size is automatically calculated, and used it in TermWindow. Added a TermView::SetTitle() method, thus TermParse doesn't call Window() anymore. Some cleanups, scrollbar was off by one. Modified: haiku/trunk/src/apps/terminal/Shell.cpp =================================================================== --- haiku/trunk/src/apps/terminal/Shell.cpp 2007-08-03 01:28:21 UTC (rev 21807) +++ haiku/trunk/src/apps/terminal/Shell.cpp 2007-08-03 09:59:30 UTC (rev 21808) @@ -232,14 +232,18 @@ status_t Shell::GetAttr(struct termios &attr) { - return tcgetattr(fFd, &attr); + if (tcgetattr(fFd, &attr) < 0) + return errno; + return B_OK; } status_t Shell::SetAttr(struct termios &attr) { - return tcsetattr(fFd, TCSANOW, &attr); + if (tcsetattr(fFd, TCSANOW, &attr) < 0) + return errno; + return B_OK; } @@ -378,13 +382,6 @@ exit(1); } - struct termios tio; - - /* get tty termios (not necessary). - * TODO: so why are we doing it ? - */ - tcgetattr(slave, &tio); - /* set signal default */ signal(SIGCHLD, SIG_DFL); signal(SIGHUP, SIG_DFL); @@ -393,6 +390,12 @@ signal(SIGINT, SIG_DFL); signal(SIGTTOU, SIG_DFL); + struct termios tio; + /* get tty termios (not necessary). + * TODO: so why are we doing it ? + */ + tcgetattr(slave, &tio); + /* * Set Terminal interface. */ Modified: haiku/trunk/src/apps/terminal/Shell.h =================================================================== --- haiku/trunk/src/apps/terminal/Shell.h 2007-08-03 01:28:21 UTC (rev 21807) +++ haiku/trunk/src/apps/terminal/Shell.h 2007-08-03 09:59:30 UTC (rev 21808) @@ -37,8 +37,8 @@ status_t GetAttr(struct termios &attr); status_t SetAttr(struct termios &attr); - int FD() const; - + int FD() const; + virtual void ViewAttached(TermView *view); virtual void ViewDetached(); Modified: haiku/trunk/src/apps/terminal/SmartTabView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/SmartTabView.cpp 2007-08-03 01:28:21 UTC (rev 21807) +++ haiku/trunk/src/apps/terminal/SmartTabView.cpp 2007-08-03 09:59:30 UTC (rev 21808) @@ -20,7 +20,7 @@ { // See BTabView::_InitObject() to see why we are doing this ContainerView()->MoveBy(-3, -TabHeight() - 3); - ContainerView()->ResizeBy(9, TabHeight() + 9); + ContainerView()->ResizeBy(10, TabHeight() + 9); } Modified: haiku/trunk/src/apps/terminal/TermParse.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.cpp 2007-08-03 01:28:21 UTC (rev 21807) +++ haiku/trunk/src/apps/terminal/TermParse.cpp 2007-08-03 09:59:30 UTC (rev 21808) @@ -19,7 +19,6 @@ #include #include -#include ////////////////////////////////////////////////////////////////////////////// @@ -851,7 +850,7 @@ switch (mode_char) { case '0': case '2': - fView->Window()->SetTitle(string); + fView->SetTitle(string); break; case '1': break; Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2007-08-03 01:28:21 UTC (rev 21807) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2007-08-03 09:59:30 UTC (rev 21808) @@ -19,7 +19,6 @@ #include "TermConst.h" #include "VTkeymap.h" -#include #include #include #include @@ -107,12 +106,31 @@ #define ROWS_DEFAULT 25 #define COLUMNS_DEFAULT 80 + +static property_info sPropList[] = { + { "encoding", + {B_GET_PROPERTY, 0}, + {B_DIRECT_SPECIFIER, 0}, + "get terminal encoding"}, + { "encoding", + {B_SET_PROPERTY, 0}, + {B_DIRECT_SPECIFIER, 0}, + "set terminal encoding"}, + { "tty", + {B_GET_PROPERTY, 0}, + {B_DIRECT_SPECIFIER, 0}, + "get tty name."}, + { 0 } +}; + + const static uint32 kUpdateSigWinch = 'Rwin'; const static rgb_color kBlackColor = { 0, 0, 0, 255 }; const static rgb_color kWhiteColor = { 255, 255, 255, 255 }; + TermView::TermView(BRect frame, const char *command, int32 historySize) : BView(frame, "termview", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS | B_PULSE_NEEDED), fShell(NULL), @@ -161,6 +179,55 @@ } +TermView::TermView(int rows, int columns, const char *command, int32 historySize) + : BView(BRect(0, 0, 0, 0), "termview", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS | B_PULSE_NEEDED), + fShell(NULL), + fFontWidth(0), + fFontHeight(0), + fFontAscent(0), + fUpdateFlag(false), + fInsertModeFlag(MODE_OVER), + fScrollUpCount(0), + fScrollBarRange(0), + fFrameResized(false), + fLastCursorTime(0), + fCursorDrawFlag(CURON), + fCursorStatus(CURON), + fCursorBlinkingFlag(CURON), + fCursorRedrawFlag(CURON), + fCursorHeight(0), + fCurPos(0, 0), + fCurStack(0, 0), + fBufferStartPos(-1), + fTermRows(rows), + fTermColumns(columns), + fEncoding(M_UTF8), + fTop(0), + fTextBuffer(NULL), + fScrollBar(NULL), + fTextForeColor(kBlackColor), + fTextBackColor(kWhiteColor), + fCursorForeColor(kWhiteColor), + fCursorBackColor(kBlackColor), + fSelectForeColor(kWhiteColor), + fSelectBackColor(kBlackColor), + fScrTop(0), + fScrBot(fTermRows - 1), + fScrBufSize(historySize), + fScrRegionSet(0), + fPreviousMousePoint(0, 0), + fSelStart(-1, -1), + fSelEnd(-1, -1), + fMouseTracking(false), + fMouseThread(-1), + fQuitting(false), + fIMflag(false) +{ + _InitObject(command); + SetTermSize(fTermRows, fTermColumns, true); +} + + TermView::TermView(BMessage *archive) : BView(archive), @@ -235,11 +302,12 @@ return B_NO_MEMORY; status_t status = fShell->Open(fTermRows, fTermColumns, - command, longname2shortname(id2longname(fEncoding))); + command, longname2shortname(id2longname(fEncoding))); + if (status < B_OK) return status; - status = AttachShell(fShell); + status = _AttachShell(fShell); if (status < B_OK) return status; @@ -254,7 +322,7 @@ TermView::~TermView() { - DetachShell(); + _DetachShell(); delete fTextBuffer; delete fShell; @@ -302,27 +370,6 @@ } -status_t -TermView::AttachShell(Shell *shell) -{ - if (shell == NULL) - return B_BAD_VALUE; - - fShell = shell; - fShell->ViewAttached(this); - - return B_OK; -} - - -void -TermView::DetachShell() -{ - fShell->ViewDetached(); - fShell = NULL; -} - - const char * TermView::TerminalName() const { @@ -467,6 +514,16 @@ } +void +TermView::SetTitle(const char *title) +{ + // TODO: Do something different in case we're a replicant, + // or in case we are inside a BTabView ? + if (Window()) + Window()->SetTitle(title); +} + + //! Print one character void TermView::PutChar(uchar *string, ushort attr, int width) @@ -950,6 +1007,27 @@ status_t +TermView::_AttachShell(Shell *shell) +{ + if (shell == NULL) + return B_BAD_VALUE; + + fShell = shell; + fShell->ViewAttached(this); + + return B_OK; +} + + +void +TermView::_DetachShell() +{ + fShell->ViewDetached(); + fShell = NULL; +} + + +status_t TermView::_InitMouseThread() { // spawn Mouse Tracking thread. @@ -1007,9 +1085,9 @@ } if (tmppos > stpos && tmppos < edpos) - be_app->SetCursor(M_ADD_CURSOR); + SetViewCursor(M_ADD_CURSOR); else - be_app->SetCursor(B_HAND_CURSOR); + SetViewCursor(B_HAND_CURSOR); } } snooze(50 * 1000); @@ -1442,13 +1520,18 @@ void TermView::KeyDown(const char *bytes, int32 numBytes) { - int32 key, mod; - Looper()->CurrentMessage()->FindInt32("modifiers", &mod); - Looper()->CurrentMessage()->FindInt32("key", &key); - if (fIMflag) return; + int32 key, mod, rawChar; + BMessage *currentMessage = Looper()->CurrentMessage(); + if (currentMessage == NULL) + return; + + currentMessage->FindInt32("modifiers", &mod); + currentMessage->FindInt32("key", &key); + currentMessage->FindInt32("raw_char", &rawChar); + // If bytes[0] equal intr character, // send signal to shell process group. struct termios tio; @@ -1458,6 +1541,8 @@ fShell->Signal(SIGINT); } + printf("rawKey: %c\n", (char)rawChar); + // Terminal filters RET, ENTER, F1...F12, and ARROW key code. // TODO: Cleanup if (numBytes == 1) { @@ -1594,7 +1679,7 @@ { const int cols = ((int)width + 1) / fFontWidth; const int rows = ((int)height + 1) / fFontHeight; - + int offset = 0; if (rows < fCurPos.y + 1) { @@ -1673,13 +1758,14 @@ _DoSelectAll(); break; - case B_SET_PROPERTY: { + case B_SET_PROPERTY: + { int32 i; int32 encodingID; - BMessage spe; - msg->GetCurrentSpecifier(&i, &spe); - if (!strcmp("encoding", spe.FindString("property", i))){ - msg->FindInt32 ("data", &encodingID); + BMessage specifier; + msg->GetCurrentSpecifier(&i, &specifier); + if (!strcmp("encoding", specifier.FindString("property", i))){ + msg->FindInt32 ("data", &encodingID); SetEncoding(encodingID); msg->SendReply(B_REPLY); } else { @@ -1688,16 +1774,16 @@ break; } - case B_GET_PROPERTY: { + case B_GET_PROPERTY: + { int32 i; - BMessage spe; - msg->GetCurrentSpecifier(&i, &spe); - if (!strcmp("encoding", spe.FindString("property", i))){ + BMessage specifier; + msg->GetCurrentSpecifier(&i, &specifier); + if (!strcmp("encoding", specifier.FindString("property", i))){ BMessage reply(B_REPLY); reply.AddInt32("result", Encoding()); msg->SendReply(&reply); - } - else if (!strcmp("tty", spe.FindString("property", i))) { + } else if (!strcmp("tty", specifier.FindString("property", i))) { BMessage reply(B_REPLY); reply.AddString("result", TerminalName()); msg->SendReply(&reply); @@ -1748,40 +1834,23 @@ status_t TermView::GetSupportedSuites(BMessage *message) { - static property_info propList[] = { - { "encoding", - {B_GET_PROPERTY, 0}, - {B_DIRECT_SPECIFIER, 0}, - "get muterminal encoding"}, - { "encoding", - {B_SET_PROPERTY, 0}, - {B_DIRECT_SPECIFIER, 0}, - "set muterminal encoding"}, - { "tty", - {B_GET_PROPERTY, 0}, - {B_DIRECT_SPECIFIER, 0}, - "get tty_name."}, - { 0 } - - }; - - message->AddString("suites", "suite/vnd.naan-termview"); - BPropertyInfo propInfo(propList); + BPropertyInfo propInfo(sPropList); + message->AddString("suites", "suite/vnd.naan-termview"); message->AddFlat("messages", &propInfo); return BView::GetSupportedSuites(message); } BHandler* -TermView::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier, - int32 form, const char *property) +TermView::ResolveSpecifier(BMessage *message, int32 index, BMessage *specifier, + int32 what, const char *property) { - if (((strcmp(property, "encode") == 0) - && ((msg->what == B_SET_PROPERTY) || (msg->what == B_GET_PROPERTY))) - || ((strcmp(property, "tty") == 0) && (msg->what == B_GET_PROPERTY))) - return this; - - return BView::ResolveSpecifier(msg, index, specifier, form, property); + BHandler *target = this; + BPropertyInfo propInfo(sPropList); + if (propInfo.FindMatch(message, index, specifier, what, property) < B_OK) + target = BView::ResolveSpecifier(message, index, specifier, what, property); + + return target; } @@ -2058,14 +2127,13 @@ void TermView::_Select(CurPos start, CurPos end) { - uchar buf[4]; - ushort attr; - if (start.x < 0) start.x = 0; if (end.x >= fTermColumns) end.x = fTermColumns - 1; + uchar buf[4]; + ushort attr; if (fTextBuffer->GetChar(start.y, start.x, buf, &attr) == IN_STRING) { start.x--; if (start.x < 0) @@ -2090,10 +2158,6 @@ void TermView::_AddSelectRegion(CurPos pos) { - uchar buf[4]; - ushort attr; - CurPos start, end, inPos; - if (!_HasSelection()) return; @@ -2107,14 +2171,17 @@ if (pos.y < 0) pos.y = 0; + uchar buf[4]; + ushort attr; if (fTextBuffer->GetChar(pos.y, pos.x, buf, &attr) == IN_STRING) { pos.x++; if (pos.x >= fTermColumns) pos.x = fTermColumns - 1; } - start = fSelStart; - end = fSelEnd; + CurPos start = fSelStart; + CurPos end = fSelEnd; + CurPos inPos; // Mouse point is same as selected line. if (pos.y == fSelStart.y && pos.y == fSelEnd.y) { @@ -2169,12 +2236,8 @@ void TermView::_ResizeSelectRegion(CurPos pos) { - CurPos inPos; - uchar buf[4]; - ushort attr; + CurPos inPos = fSelEnd; - inPos = fSelEnd; - // error check, and if mouse point to a plase full width character, // select point decliment. if (pos.x >= fTermColumns) @@ -2185,8 +2248,9 @@ if (pos.y < 0) pos.y = 0; - if (fTextBuffer->GetChar(pos.y, pos.x, buf, &attr) == IN_STRING) { - + uchar buf[4]; + ushort attr; + if (fTextBuffer->GetChar(pos.y, pos.x, buf, &attr) == IN_STRING) { pos.x++; if (pos == inPos) @@ -2206,15 +2270,13 @@ void TermView::_DeSelect(void) { - CurPos start, end; - if (!_HasSelection()) return; fTextBuffer->DeSelect(); - start = fSelStart; - end = fSelEnd; + CurPos start = fSelStart; + CurPos end = fSelEnd; fSelStart.Set(-1, -1); fSelEnd.Set(-1, -1); @@ -2241,19 +2303,13 @@ fTextBuffer->Select(start, end); if (mod & B_SHIFT_KEY) { - if (flag) { - if (start < fSelStart) _AddSelectRegion(start); else if (end > fSelEnd) - _AddSelectRegion(end); - - + _AddSelectRegion(end); } else _AddSelectRegion(pos); - - } else { _DeSelect(); if (flag) @@ -2441,6 +2497,7 @@ return true; } + //! Get the selected text and copy to str void TermView::GetSelection(BString &str) Modified: haiku/trunk/src/apps/terminal/TermView.h =================================================================== --- haiku/trunk/src/apps/terminal/TermView.h 2007-08-03 01:28:21 UTC (rev 21807) +++ haiku/trunk/src/apps/terminal/TermView.h 2007-08-03 09:59:30 UTC (rev 21808) @@ -33,22 +33,21 @@ class TermView : public BView { public: TermView(BRect frame, const char *command = NULL, int32 historySize = 1000); + TermView(int rows, int columns, const char *command = NULL, int32 historySize = 1000); TermView(BMessage *archive); ~TermView(); static BArchivable* Instantiate(BMessage* data); virtual status_t Archive(BMessage* data, bool deep = true) const; + virtual void GetPreferredSize(float *width, float *height); - status_t AttachShell(Shell *shell); - void DetachShell(); - const char *TerminalName() const; void SetTermFont(const BFont *halfFont, const BFont *fullFont); void GetFontSize(int *width, int *height); - BRect SetTermSize(int rows, int cols, bool flag); + BRect SetTermSize(int rows, int cols, bool resize); void SetTextColor(rgb_color fore, rgb_color back); void SetSelectColor(rgb_color fore, rgb_color back); void SetCursorColor(rgb_color fore, rgb_color back); @@ -60,6 +59,8 @@ void SetScrollBar(BScrollBar *scrbar); BScrollBar *ScrollBar() const { return fScrollBar; }; + void SetTitle(const char *title); + // Output Charactor void PutChar(uchar *string, ushort attr, int width); void PutCR(void); @@ -135,6 +136,9 @@ status_t _InitObject(const char *command); status_t _InitMouseThread(void); + status_t _AttachShell(Shell *shell); + void _DetachShell(); + void _AboutRequested(); void _DrawLines(int , int, ushort, uchar *, int, int, int, BView *); Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.cpp 2007-08-03 01:28:21 UTC (rev 21807) +++ haiku/trunk/src/apps/terminal/TermWindow.cpp 2007-08-03 09:59:30 UTC (rev 21808) @@ -33,8 +33,6 @@ #include #include #include -#include -#include #include #include @@ -60,9 +58,7 @@ fEditmenu(NULL), fEncodingmenu(NULL), fHelpmenu(NULL), - fFontMenu(NULL), fWindowSizeMenu(NULL), - fNewFontMenu(NULL), fPrintSettings(NULL), fPrefWindow(NULL), fFindPanel(NULL), @@ -181,28 +177,11 @@ fWindowSizeMenu->AddItem(new BMenuItem("132x25", new BMessage(ONETHREETWOTWENTYFIVE))); fWindowSizeMenu->AddItem(new BMenuItem("Fullscreen", new BMessage(FULLSCREEN), B_ENTER)); - // Considering we have this in the preferences window, this menu is not - // needed and should not be shown if we are to not confuse the user -/* fNewFontMenu = new BMenu("Font"); - fNewFontMenu->SetRadioMode(true); - int32 numFamilies1 = count_font_families(); - for ( int32 i = 0; i < numFamilies1; i++ ) { - font_family family; - uint32 flags; - if ( get_font_family(i, &family, &flags) == B_OK ) { - fNewFontMenu->AddItem(item = new BMenuItem(family, new BMessage(MSG_FONT_CHANGED))); - // if (0 ==i) item->SetMarked(true); - } - } - fNewFontMenu->FindItem (PrefHandler::Default()->getString(PREF_HALF_FONT_FAMILY))->SetMarked(true); -*/ - fEncodingmenu = new BMenu("Font Encoding"); fEncodingmenu->SetRadioMode(true); MakeEncodingMenu(fEncodingmenu, true); fHelpmenu->AddItem(fWindowSizeMenu); fHelpmenu->AddItem(fEncodingmenu); -// fHelpmenu->AddItem(fNewFontMenu); fHelpmenu->AddSeparatorItem(); fHelpmenu->AddItem(new BMenuItem("Preferences" B_UTF8_ELLIPSIS, new BMessage(MENU_PREF_OPEN))); fHelpmenu->AddSeparatorItem(); @@ -427,7 +406,6 @@ break; } case MSG_FONT_CHANGED: { - PrefHandler::Default()->setString (PREF_HALF_FONT_FAMILY, fNewFontMenu->FindMarked()->Label()); PostMessage(MSG_HALF_FONT_CHANGED); break; } @@ -473,6 +451,9 @@ bool TermWindow::QuitRequested() { + // TODO: Intercept the B_QUIT_REQUESTED message + // sent by the TermView, and only close one tab if there + // are multiple ones ? Or handle the case inside TermView itself ? be_app->PostMessage(B_QUIT_REQUESTED); return true; } @@ -577,7 +558,9 @@ fullFont.SetSpacing(B_FIXED_SPACING); // Make Terminal text view. - TermView *view = new TermView(BRect(0, 0, 10, 10), command); + TermView *view = new TermView(PrefHandler::Default()->getInt32(PREF_ROWS), + PrefHandler::Default()->getInt32(PREF_COLS), + command); BScrollView *scrollView = new BScrollView("scrollView", view, B_FOLLOW_ALL, B_WILL_DRAW|B_FRAME_EVENTS, false, true); @@ -592,10 +575,6 @@ _SetTermColors(); - BRect rect = view->SetTermSize(PrefHandler::Default()->getInt32(PREF_ROWS), - PrefHandler::Default()->getInt32(PREF_COLS), false); - - // If it's the first time we're called, setup the window if (fTabView->CountTabs() == 1) { int width, height; @@ -603,12 +582,11 @@ SetSizeLimits(MIN_COLS * width, MAX_COLS * width, MIN_COLS * height, MAX_COLS * height); - // Add offset to baseview. - rect.InsetBy(-kViewOffset, -kViewOffset); - + float fWidth, fHeight; + view->GetPreferredSize(&fWidth, &fHeight); + // Resize Window - ResizeTo(rect.Width()+ B_V_SCROLL_BAR_WIDTH, - rect.Height() + fMenubar->Bounds().Height()); + ResizeTo(fWidth + B_V_SCROLL_BAR_WIDTH, fHeight + fMenubar->Bounds().Height()); // TODO: If I don't do this, the view won't show up. // Bug in BTabView or in my code ? Modified: haiku/trunk/src/apps/terminal/TermWindow.h =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.h 2007-08-03 01:28:21 UTC (rev 21807) +++ haiku/trunk/src/apps/terminal/TermWindow.h 2007-08-03 09:59:30 UTC (rev 21808) @@ -69,9 +69,7 @@ *fEditmenu, *fEncodingmenu, *fHelpmenu, - *fFontMenu, - *fWindowSizeMenu, - *fNewFontMenu; + *fWindowSizeMenu; BMessage *fPrintSettings; PrefWindow *fPrefWindow; From jackburton at mail.berlios.de Fri Aug 3 12:47:37 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Fri, 3 Aug 2007 12:47:37 +0200 Subject: [Haiku-commits] r21809 - haiku/trunk/src/apps/terminal Message-ID: <200708031047.l73AlbXC031776@sheep.berlios.de> Author: jackburton Date: 2007-08-03 12:47:27 +0200 (Fri, 03 Aug 2007) New Revision: 21809 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21809&view=rev Modified: haiku/trunk/src/apps/terminal/Shell.cpp Log: In case the user supplied a wrong commandline, the Terminal didn't launch the shell as the code would seem to do. I've disabled showing the Alert, since system() doesn't return the return value of "alert". Modified: haiku/trunk/src/apps/terminal/Shell.cpp =================================================================== --- haiku/trunk/src/apps/terminal/Shell.cpp 2007-08-03 09:59:30 UTC (rev 21808) +++ haiku/trunk/src/apps/terminal/Shell.cpp 2007-08-03 10:47:27 UTC (rev 21809) @@ -557,14 +557,17 @@ * Exec failed. */ sleep(1); - const char *spawnAlertMessage = "alert --stop " + /*const char *spawnAlertMessage = "alert --stop " "'Cannot execute \"%s\":\n" - "\t%s\n'" + "\t%s' " "'Use Default Shell' 'Abort'"; char errorMessage[256]; snprintf(errorMessage, sizeof(errorMessage), spawnAlertMessage, commandLine, strerror(errno)); - if (system(errorMessage) == 0) + // TODO: I'm not sure that system should return the return value of alert. + // At least, it's not doing that right now. + int returnValue = system(errorMessage); + if (returnValue == 0)*/ execl("/bin/sh", "/bin/sh", "-login", NULL); exit(1); From korli at mail.berlios.de Fri Aug 3 20:13:56 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Fri, 3 Aug 2007 20:13:56 +0200 Subject: [Haiku-commits] r21810 - in haiku/trunk: headers/posix src/system/libroot/posix/unistd Message-ID: <200708031813.l73IDuUT031623@sheep.berlios.de> Author: korli Date: 2007-08-03 20:13:55 +0200 (Fri, 03 Aug 2007) New Revision: 21810 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21810&view=rev Modified: haiku/trunk/headers/posix/unistd.h haiku/trunk/src/system/libroot/posix/unistd/conf.c Log: added an empty implementation of confstr() Modified: haiku/trunk/headers/posix/unistd.h =================================================================== --- haiku/trunk/headers/posix/unistd.h 2007-08-03 10:47:27 UTC (rev 21809) +++ haiku/trunk/headers/posix/unistd.h 2007-08-03 18:13:55 UTC (rev 21810) @@ -111,6 +111,7 @@ extern long sysconf(int name); extern long fpathconf(int fd, int name); extern long pathconf(const char *path, int name); +extern size_t confstr(int name, char *buf, size_t len); /* process functions */ extern pid_t fork(void); Modified: haiku/trunk/src/system/libroot/posix/unistd/conf.c =================================================================== --- haiku/trunk/src/system/libroot/posix/unistd/conf.c 2007-08-03 10:47:27 UTC (rev 21809) +++ haiku/trunk/src/system/libroot/posix/unistd/conf.c 2007-08-03 18:13:55 UTC (rev 21810) @@ -100,3 +100,12 @@ return fpathconf(-1, name); } + +size_t +confstr(int name, char *buf, size_t len) +{ + // ToDo: find out what BeOS supports here + errno = EINVAL; + return 0; +} + From korli at mail.berlios.de Fri Aug 3 21:03:00 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Fri, 3 Aug 2007 21:03:00 +0200 Subject: [Haiku-commits] r21811 - haiku/trunk/headers/private/shared Message-ID: <200708031903.l73J30xh001883@sheep.berlios.de> Author: korli Date: 2007-08-03 21:02:59 +0200 (Fri, 03 Aug 2007) New Revision: 21811 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21811&view=rev Modified: haiku/trunk/headers/private/shared/HashMap.h Log: to please gcc4 Modified: haiku/trunk/headers/private/shared/HashMap.h =================================================================== --- haiku/trunk/headers/private/shared/HashMap.h 2007-08-03 18:13:55 UTC (rev 21810) +++ haiku/trunk/headers/private/shared/HashMap.h 2007-08-03 19:02:59 UTC (rev 21811) @@ -192,8 +192,8 @@ template class SynchronizedHashMap : public BLocker { public: - typedef HashMap::Entry Entry; - typedef HashMap::Iterator Iterator; + typedef struct HashMap::Entry Entry; + typedef struct HashMap::Iterator Iterator; SynchronizedHashMap() : BLocker("synchronized hash map") {} ~SynchronizedHashMap() { Lock(); } @@ -422,7 +422,7 @@ // GetIterator template -HashMap::Iterator +struct HashMap::Iterator HashMap::GetIterator() const { return Iterator(this); @@ -430,7 +430,7 @@ // _FindElement template -HashMap::Element * +struct HashMap::Element * HashMap::_FindElement(const Key& key) const { Element* element = fTable.FindFirst(key.GetHashCode()); From korli at mail.berlios.de Fri Aug 3 21:03:32 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Fri, 3 Aug 2007 21:03:32 +0200 Subject: [Haiku-commits] r21812 - haiku/trunk/src/preferences/media Message-ID: <200708031903.l73J3Wst001936@sheep.berlios.de> Author: korli Date: 2007-08-03 21:03:31 +0200 (Fri, 03 Aug 2007) New Revision: 21812 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21812&view=rev Modified: haiku/trunk/src/preferences/media/Jamfile Log: logic was inversed Modified: haiku/trunk/src/preferences/media/Jamfile =================================================================== --- haiku/trunk/src/preferences/media/Jamfile 2007-08-03 19:02:59 UTC (rev 21811) +++ haiku/trunk/src/preferences/media/Jamfile 2007-08-03 19:03:31 UTC (rev 21812) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ; -if $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { SubDirC++Flags -fmultiple-symbol-spaces ; } From bonefish at cs.tu-berlin.de Fri Aug 3 21:25:31 2007 From: bonefish at cs.tu-berlin.de (Ingo Weinhold) Date: Fri, 03 Aug 2007 21:25:31 +0200 Subject: [Haiku-commits] r21812 - haiku/trunk/src/preferences/media In-Reply-To: <200708031903.l73J3Wst001936@sheep.berlios.de> References: <200708031903.l73J3Wst001936@sheep.berlios.de> Message-ID: <20070803212531.750.2@cs.tu-berlin.de> On 2007-08-03 at 21:03:32 [+0200], korli at BerliOS wrote: > Author: korli > Date: 2007-08-03 21:03:31 +0200 (Fri, 03 Aug 2007) > New Revision: 21812 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21812&view=rev > > Modified: > haiku/trunk/src/preferences/media/Jamfile > Log: > logic was inversed > > > Modified: haiku/trunk/src/preferences/media/Jamfile > =================================================================== > --- haiku/trunk/src/preferences/media/Jamfile 2007-08-03 19:02:59 UTC > (rev 21811) > +++ haiku/trunk/src/preferences/media/Jamfile 2007-08-03 19:03:31 UTC > (rev 21812) > @@ -2,7 +2,7 @@ > > SetSubDirSupportedPlatformsBeOSCompatible ; > > -if $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { > +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { > SubDirC++Flags -fmultiple-symbol-spaces ; > } Oh, that reminds me: Why is it there anyway? CU, Ingo From jackburton at mail.berlios.de Fri Aug 3 22:41:05 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Fri, 3 Aug 2007 22:41:05 +0200 Subject: [Haiku-commits] r21813 - haiku/trunk/src/apps/terminal Message-ID: <200708032041.l73Kf5Vb006553@sheep.berlios.de> Author: jackburton Date: 2007-08-03 22:41:04 +0200 (Fri, 03 Aug 2007) New Revision: 21813 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21813&view=rev Modified: haiku/trunk/src/apps/terminal/TermView.cpp haiku/trunk/src/apps/terminal/TermView.h haiku/trunk/src/apps/terminal/TermWindow.cpp Log: Made some TermView functions (Paste, Copy, etc) public. Made SetTitle and NotifyQuit virtual. TermWindow now uses a TermView subclass which closes the tab on NotifyQuit. Enabled tabbed terminal. There are still some small glitches, most probably related to BTabView bugs ? Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2007-08-03 19:03:31 UTC (rev 21812) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2007-08-03 20:41:04 UTC (rev 21813) @@ -132,7 +132,8 @@ TermView::TermView(BRect frame, const char *command, int32 historySize) - : BView(frame, "termview", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS | B_PULSE_NEEDED), + : BView(frame, "termview", B_FOLLOW_ALL, + B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE| B_PULSE_NEEDED), fShell(NULL), fFontWidth(0), fFontHeight(0), @@ -180,7 +181,8 @@ TermView::TermView(int rows, int columns, const char *command, int32 historySize) - : BView(BRect(0, 0, 0, 0), "termview", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS | B_PULSE_NEEDED), + : BView(BRect(0, 0, 0, 0), "termview", B_FOLLOW_ALL, + B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE| B_PULSE_NEEDED), fShell(NULL), fFontWidth(0), fFontHeight(0), @@ -408,8 +410,6 @@ if (resize) ResizeTo(fTermColumns * fFontWidth - 1, fTermRows * fFontHeight -1); - Invalidate(); - return rect; } @@ -524,6 +524,104 @@ } +void +TermView::Copy(BClipboard *clipboard) +{ + if (!_HasSelection()) + return; + + BString copyStr; + fTextBuffer->GetStringFromRegion(copyStr, fSelStart, fSelEnd); + + if (clipboard->Lock()) { + BMessage *clipMsg = NULL; + clipboard->Clear(); + + if ((clipMsg = clipboard->Data()) != NULL) { + clipMsg->AddData("text/plain", B_MIME_TYPE, copyStr.String(), + copyStr.Length()); + clipboard->Commit(); + } + clipboard->Unlock(); + } + + // Deselecting the current selection is not the behavior that + // R5's Terminal app displays. We want to mimic the behavior, so we will + // no longer do the deselection +// if (!fMouseTracking) +// _DeSelect(); +} + + +void +TermView::Paste(BClipboard *clipboard) +{ + if (clipboard->Lock()) { + BMessage *clipMsg = clipboard->Data(); + char *text; + ssize_t numBytes; + if (clipMsg->FindData("text/plain", B_MIME_TYPE, + (const void **)&text, &numBytes) == B_OK ) { + // Clipboard text doesn't attached EOF? + text[numBytes] = '\0'; + _WritePTY((uchar *)text, numBytes); + } + + clipboard->Unlock(); + } +} + + +void +TermView::SelectAll() +{ + int screen_top = fTop / fFontHeight; + int viewheight = fTermRows; + + int start_pos = screen_top -(fScrBufSize - viewheight * 2); + + CurPos start, end; + start.x = 0; + end.x = fTermColumns -1; + + if (start_pos > 0) + start.y = start_pos; + else + start.y = 0; + + end.y = fCurPos.y + screen_top; + + _Select(start, end); +} + + +void +TermView::Clear() +{ + _DeSelect(); + fTextBuffer->Clear(); + + fTop = 0; + ScrollTo(0, 0); + + if (LockLooper()) { + SetHighColor(fTextBackColor); + + FillRect(Bounds()); + SetHighColor(fTextForeColor); + UnlockLooper(); + } + + // reset cursor pos + SetCurPos(0, 0); + + if (fScrollBar) { + fScrollBar->SetRange(0, 0); + fScrollBar->SetProportion(1); + } +} + + //! Print one character void TermView::PutChar(uchar *string, ushort attr, int width) @@ -1692,9 +1790,6 @@ fTermColumns = cols; fFrameResized = true; - - // TODO: Fix this - Invalidate(); } @@ -1743,19 +1838,19 @@ } case B_COPY: - _DoCopy(); + Copy(be_clipboard); break; case B_PASTE: { int32 code; if (msg->FindInt32("index", &code) == B_OK) - _DoPaste(); + Paste(be_clipboard); break; } case B_SELECT_ALL: - _DoSelectAll(); + SelectAll(); break; case B_SET_PROPERTY: @@ -1794,7 +1889,7 @@ } case MENU_CLEAR_ALL: - _DoClearAll(); + Clear(); fShell->Write(ctrl_l, 1); break; @@ -1867,110 +1962,6 @@ } -//! Copy selected text to Clipboard. -void -TermView::_DoCopy() -{ - if (!_HasSelection()) - return; - - BString copyStr; - fTextBuffer->GetStringFromRegion(copyStr, fSelStart, fSelEnd); - - if (be_clipboard->Lock()) { - BMessage *clipMsg = NULL; - be_clipboard->Clear(); - - if ((clipMsg = be_clipboard->Data()) != NULL) { - clipMsg->AddData("text/plain", B_MIME_TYPE, copyStr.String(), - copyStr.Length()); - be_clipboard->Commit(); - } - be_clipboard->Unlock(); - } - - // Deselecting the current selection is not the behavior that - // R5's Terminal app displays. We want to mimic the behavior, so we will - // no longer do the deselection -// if (!fMouseTracking) -// _DeSelect(); -} - - -//! Paste clipboard text at cursor position. -void -TermView::_DoPaste() -{ - if (be_clipboard->Lock()) { - BMessage *clipMsg = be_clipboard->Data(); - char *text; - ssize_t numBytes; - if (clipMsg->FindData("text/plain", B_MIME_TYPE, - (const void **)&text, &numBytes) == B_OK ) { - // Clipboard text doesn't attached EOF? - text[numBytes] = '\0'; - _WritePTY((uchar *)text, numBytes); - } - - be_clipboard->Unlock(); - } -} - - -//! Select all displayed text and text /in buffer. -void -TermView::_DoSelectAll(void) -{ - CurPos start, end; - int screen_top; - int viewheight, start_pos; - - screen_top = fTop / fFontHeight; - viewheight = fTermRows; - - start_pos = screen_top -(fScrBufSize - viewheight * 2); - - start.x = 0; - end.x = fTermColumns -1; - - if (start_pos > 0) - start.y = start_pos; - else - start.y = 0; - - end.y = fCurPos.y + screen_top; - - _Select(start, end); -} - -// Clear display and text buffer, then moves Cursorr at home position. -void -TermView::_DoClearAll(void) -{ - _DeSelect(); - fTextBuffer->Clear(); - - fTop = 0; - ScrollTo(0, 0); - - if (LockLooper()) { - SetHighColor(fTextBackColor); - - FillRect(Bounds()); - SetHighColor(fTextForeColor); - UnlockLooper(); - } - - // reset cursor pos - SetCurPos(0, 0); - - if (fScrollBar) { - fScrollBar->SetRange(0, 0); - fScrollBar->SetProportion(1); - } -} - - /*! Write strings to PTY device. If encoding system isn't UTF8, change encoding to UTF8 before writing PTY. */ @@ -2009,7 +2000,7 @@ _WritePTY((uchar *)copy.String(), copy.Length()); } else { // copy text from clipboard. - _DoPaste(); + Paste(be_clipboard); } return; } @@ -2123,6 +2114,13 @@ } +void +TermView::MouseUp(BPoint where) +{ + +} + + // Select a range of text void TermView::_Select(CurPos start, CurPos end) Modified: haiku/trunk/src/apps/terminal/TermView.h =================================================================== --- haiku/trunk/src/apps/terminal/TermView.h 2007-08-03 19:03:31 UTC (rev 21812) +++ haiku/trunk/src/apps/terminal/TermView.h 2007-08-03 20:41:04 UTC (rev 21813) @@ -24,8 +24,8 @@ #define CURON 1 +class BClipboard; class BMessageRunner; -class BPopUpMenu; class BScrollBar; class BString; class Shell; @@ -59,7 +59,14 @@ void SetScrollBar(BScrollBar *scrbar); BScrollBar *ScrollBar() const { return fScrollBar; }; - void SetTitle(const char *title); + virtual void SetTitle(const char *title); + virtual void NotifyQuit(int32 reason); + + // edit functions + void Copy(BClipboard *clipboard); + void Paste(BClipboard *clipboard); + void SelectAll(); + void Clear(); // Output Charactor void PutChar(uchar *string, ushort attr, int width); @@ -112,8 +119,6 @@ bool Find(const BString &str, bool forwardSearch, bool matchCase, bool matchWord); void GetSelection(BString &str); - void NotifyQuit(int32 reason); - protected: virtual void AttachedToWindow(); virtual void DetachedFromWindow(); @@ -121,8 +126,10 @@ virtual void Draw(BRect updateRect); virtual void WindowActivated(bool active); virtual void KeyDown(const char*, int32); + virtual void MouseDown(BPoint where); virtual void MouseMoved(BPoint, uint32, const BMessage *); + virtual void MouseUp(BPoint where); virtual void FrameResized(float width, float height); virtual void MessageReceived(BMessage* message); @@ -151,12 +158,6 @@ void _ResizeScrBarRange (void); void _DoFileDrop(entry_ref &ref); - // edit menu function. - void _DoCopy(); - void _DoPaste(); - void _DoSelectAll(); - void _DoClearAll(); - void _WritePTY(const uchar *text, int num_byteses); // Comunicate Input Method Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.cpp 2007-08-03 19:03:31 UTC (rev 21812) +++ haiku/trunk/src/apps/terminal/TermWindow.cpp 2007-08-03 20:41:04 UTC (rev 21813) @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -49,7 +50,17 @@ const static float kViewOffset = 3; const static uint32 kNewTab = 'NTab'; +const static uint32 kCloseView = 'ClVw'; + +class CustomTermView : public TermView { +public: + CustomTermView(int32 rows, int32 columns, const char *command = NULL, int32 historySize = 1000); + virtual void NotifyQuit(int32 reason); + virtual void SetTitle(const char *title); +}; + + TermWindow::TermWindow(BRect frame, const char* title, const char *command) : BWindow(frame, title, B_DOCUMENT_WINDOW, B_CURRENT_WORKSPACE|B_QUIT_ON_WINDOW_CLOSE), fTabView(NULL), @@ -135,10 +146,9 @@ fFilemenu->AddItem(new BMenuItem("Switch Terminals", new BMessage(MENU_SWITCH_TERM),'G')); fFilemenu->AddItem(new BMenuItem("New Terminal" B_UTF8_ELLIPSIS, new BMessage(MENU_NEW_TERM), 'N')); - // TODO: Tabs disabled until various problems are fixed. // n. 1: calling "exit" from a tab closes the whole app. - //fFilemenu->AddItem(new BMenuItem("New Tab", new BMessage(kNewTab), 'T')); + fFilemenu->AddItem(new BMenuItem("New Tab", new BMessage(kNewTab), 'T')); fFilemenu->AddSeparatorItem(); fFilemenu->AddItem(new BMenuItem("Page Setup...", new BMessage(MENU_PAGE_SETUP))); @@ -153,13 +163,13 @@ fEditmenu = new BMenu ("Edit"); fEditmenu->AddItem (new BMenuItem ("Copy", new BMessage (B_COPY),'C')); fEditmenu->AddItem (new BMenuItem ("Paste", new BMessage (B_PASTE),'V')); - fEditmenu->AddSeparatorItem (); + fEditmenu->AddSeparatorItem(); fEditmenu->AddItem (new BMenuItem ("Select All", new BMessage (B_SELECT_ALL), 'A')); fEditmenu->AddItem (new BMenuItem ("Clear All", new BMessage (MENU_CLEAR_ALL), 'L')); - fEditmenu->AddSeparatorItem (); + fEditmenu->AddSeparatorItem(); fEditmenu->AddItem (new BMenuItem ("Find" B_UTF8_ELLIPSIS, new BMessage (MENU_FIND_STRING),'F')); fFindBackwardMenuItem = new BMenuItem ("Find Backward", new BMessage (MENU_FIND_BACKWARD), '['); - fEditmenu->AddItem (fFindBackwardMenuItem); + fEditmenu->AddItem(fFindBackwardMenuItem); fFindBackwardMenuItem->SetEnabled(false); fFindForwardMenuItem = new BMenuItem ("Find Forward", new BMessage (MENU_FIND_FORWARD), ']'); fEditmenu->AddItem (fFindForwardMenuItem); @@ -202,6 +212,22 @@ bool findresult; switch (message->what) { + case B_COPY: + _ActiveTermView()->Copy(be_clipboard); + break; + + case B_PASTE: + _ActiveTermView()->Paste(be_clipboard); + break; + + case B_SELECT_ALL: + _ActiveTermView()->SelectAll(); + break; + + case MENU_CLEAR_ALL: + _ActiveTermView()->Clear(); + break; + case MENU_SWITCH_TERM: { be_app->PostMessage(MENU_SWITCH_TERM); break; @@ -210,6 +236,16 @@ _NewTab(NULL); break; + case kCloseView: + { + // TODO: We assume that this message was sent from the current active tab. + // Since the implementation of BTabView uses AddChild/RemoveChild on the + // views, the current active tab is the only one who is attached, thus + // the only one which could send a message. + delete fTabView->RemoveTab(fTabView->Selection()); + break; + } + case MENU_NEW_TERM: { app_info info; be_app->GetAppInfo(&info); @@ -558,7 +594,7 @@ fullFont.SetSpacing(B_FIXED_SPACING); // Make Terminal text view. - TermView *view = new TermView(PrefHandler::Default()->getInt32(PREF_ROWS), + CustomTermView *view = new CustomTermView(PrefHandler::Default()->getInt32(PREF_ROWS), PrefHandler::Default()->getInt32(PREF_COLS), command); @@ -592,10 +628,6 @@ // Bug in BTabView or in my code ? fTabView->Select(0); } - - // TODO: How do I set this for the current active tab, - // every time a different tab is chosen ? - fEditmenu->SetTargetForItems(view); } @@ -608,3 +640,29 @@ return (TermView *)((BScrollView *)fTabView->ViewForTab(fTabView->Selection()))->Target(); } + +// CustomTermView +CustomTermView::CustomTermView(int32 rows, int32 columns, const char *command, int32 historySize) + : + TermView(rows, columns, command, historySize) +{ +} + + +void +CustomTermView::NotifyQuit(int32 reason) +{ + if (Window()) { + BMessage message(kCloseView); + message.AddInt32("reason", reason); + Window()->PostMessage(&message); + } +} + + +void +CustomTermView::SetTitle(const char *title) +{ + //Window()->SetTitle(title); +} + From jackburton at mail.berlios.de Fri Aug 3 22:50:45 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Fri, 3 Aug 2007 22:50:45 +0200 Subject: [Haiku-commits] r21814 - haiku/trunk/src/apps/terminal Message-ID: <200708032050.l73Koj0j007056@sheep.berlios.de> Author: jackburton Date: 2007-08-03 22:50:41 +0200 (Fri, 03 Aug 2007) New Revision: 21814 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21814&view=rev Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp Log: removed old comments Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.cpp 2007-08-03 20:41:04 UTC (rev 21813) +++ haiku/trunk/src/apps/terminal/TermWindow.cpp 2007-08-03 20:50:41 UTC (rev 21814) @@ -145,9 +145,6 @@ fFilemenu = new BMenu("Terminal"); fFilemenu->AddItem(new BMenuItem("Switch Terminals", new BMessage(MENU_SWITCH_TERM),'G')); fFilemenu->AddItem(new BMenuItem("New Terminal" B_UTF8_ELLIPSIS, new BMessage(MENU_NEW_TERM), 'N')); - - // TODO: Tabs disabled until various problems are fixed. - // n. 1: calling "exit" from a tab closes the whole app. fFilemenu->AddItem(new BMenuItem("New Tab", new BMessage(kNewTab), 'T')); fFilemenu->AddSeparatorItem(); @@ -487,11 +484,8 @@ bool TermWindow::QuitRequested() { - // TODO: Intercept the B_QUIT_REQUESTED message - // sent by the TermView, and only close one tab if there - // are multiple ones ? Or handle the case inside TermView itself ? be_app->PostMessage(B_QUIT_REQUESTED); - return true; + return BWindow::QuitRequested(); } From bonefish at mail.berlios.de Sat Aug 4 02:24:15 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 4 Aug 2007 02:24:15 +0200 Subject: [Haiku-commits] r21815 - haiku/trunk/src/system/kernel/cache Message-ID: <200708040024.l740OFmf002703@sheep.berlios.de> Author: bonefish Date: 2007-08-04 02:24:13 +0200 (Sat, 04 Aug 2007) New Revision: 21815 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21815&view=rev Modified: haiku/trunk/src/system/kernel/cache/file_cache.cpp Log: Although probably not used ATM, cache_prefetch_vnode() should respect busy pages. Modified: haiku/trunk/src/system/kernel/cache/file_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/file_cache.cpp 2007-08-03 20:50:41 UTC (rev 21814) +++ haiku/trunk/src/system/kernel/cache/file_cache.cpp 2007-08-04 00:24:13 UTC (rev 21815) @@ -1112,6 +1112,15 @@ restart: vm_page *page = vm_cache_lookup_page(cache, offset); if (page != NULL) { + if (page->state == PAGE_STATE_BUSY) { + // if busy retry again a little later + mutex_unlock(&cache->lock); + snooze(20000); + mutex_lock(&cache->lock); + + goto restart; + } + // it is, so let's satisfy in the first part of the request if (lastOffset < offset) { size_t requestSize = offset - lastOffset; From bonefish at mail.berlios.de Sat Aug 4 02:33:50 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 4 Aug 2007 02:33:50 +0200 Subject: [Haiku-commits] r21816 - haiku/trunk/src/system/kernel/vm Message-ID: <200708040033.l740XogJ003235@sheep.berlios.de> Author: bonefish Date: 2007-08-04 02:33:47 +0200 (Sat, 04 Aug 2007) New Revision: 21816 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21816&view=rev Modified: haiku/trunk/src/system/kernel/vm/vm.cpp Log: fault_find_page(): Fixed a race condition in case of reading the page from the store into the top cache, which could lead to pages inserted multiple times into the cache. We don't insert a dummy page in this case anymore. Instead we mark a freshly allocated page busy and insert that one. That's exactly the approach the file cache uses too. This does probably make the whole dummy page special handling in the file cache obsolete. Modified: haiku/trunk/src/system/kernel/vm/vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm.cpp 2007-08-04 00:24:13 UTC (rev 21815) +++ haiku/trunk/src/system/kernel/vm/vm.cpp 2007-08-04 00:33:47 UTC (rev 21816) @@ -3239,59 +3239,56 @@ // The current cache does not contain the page we're looking for - // If we're at the top most cache, insert the dummy page here to keep other threads - // from faulting on the same address and chasing us up the cache chain - if (cache == topCache && dummyPage.state != PAGE_STATE_BUSY) - fault_insert_dummy_page(cache, dummyPage, cacheOffset); - // see if the vm_store has it vm_store *store = cache->store; - if (store->ops->has_page != NULL && store->ops->has_page(store, cacheOffset)) { - size_t bytesRead; - iovec vec; + if (store->ops->has_page != NULL + && store->ops->has_page(store, cacheOffset)) { + // insert a fresh page and mark it busy -- we're going to read it in page = vm_page_allocate_page(PAGE_STATE_FREE); + page->state = PAGE_STATE_BUSY; + vm_cache_insert_page(cache, page, cacheOffset); - // we mark that page busy reading, so that the file cache can - // ignore us in case it works on the very same page - // (this is actually only needed if this is the topRefCache, but we - // do it anyway for simplicity's sake) - dummyPage.queue_next = page; - dummyPage.busy_reading = true; - mutex_unlock(&cache->lock); - map->ops->get_physical_page(page->physical_page_number * B_PAGE_SIZE, + // get a virtual address for the page + iovec vec; + map->ops->get_physical_page( + page->physical_page_number * B_PAGE_SIZE, (addr_t *)&vec.iov_base, PHYSICAL_PAGE_CAN_WAIT); - vec.iov_len = bytesRead = B_PAGE_SIZE; + size_t bytesRead = vec.iov_len = B_PAGE_SIZE; + // read it in status_t status = store->ops->read(store, cacheOffset, &vec, 1, &bytesRead, false); - if (status < B_OK) { - // TODO: real error handling! - panic("reading from store %p (cache %p) returned: %s!\n", - store, cache, strerror(status)); - } + map->ops->put_physical_page((addr_t)vec.iov_base); mutex_lock(&cache->lock); - if (cache == topCache) - fault_remove_dummy_page(dummyPage, true); + if (status < B_OK) { + // on error remove and free the page + dprintf("reading page from store %p (cache %p) returned: %s!\n", + store, cache, strerror(status)); - // We insert the queue_next here, because someone else could have - // replaced our page - vm_cache_insert_page(cache, dummyPage.queue_next, cacheOffset); - - if (dummyPage.queue_next != page) { - // Indeed, the page got replaced by someone else - we can safely - // throw our page away now + vm_cache_remove_page(cache, page); vm_page_set_state(page, PAGE_STATE_FREE); - page = dummyPage.queue_next; + + return NULL; } + + // mark the page unbusy again + page->state = PAGE_STATE_ACTIVE; + break; } + // If we're at the top most cache, insert the dummy page here to keep + // other threads from faulting on the same address and chasing us up the + // cache chain + if (cache == topCache && dummyPage.state != PAGE_STATE_BUSY) + fault_insert_dummy_page(cache, dummyPage, cacheOffset); + vm_cache *nextCache; status_t status = fault_acquire_locked_source(cache, &nextCache); if (status == B_BUSY) { From bonefish at mail.berlios.de Sat Aug 4 02:36:51 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 4 Aug 2007 02:36:51 +0200 Subject: [Haiku-commits] r21817 - haiku/trunk/src/system/kernel/vm Message-ID: <200708040036.l740apQR003370@sheep.berlios.de> Author: bonefish Date: 2007-08-04 02:36:50 +0200 (Sat, 04 Aug 2007) New Revision: 21817 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21817&view=rev Modified: haiku/trunk/src/system/kernel/vm/vm_cache.cpp Log: Paranoia: vm_cache_insert_page() does now check whether a page for the offset of the page to insert is already in the cache. Revealed the bug fixed with my previous commit. Modified: haiku/trunk/src/system/kernel/vm/vm_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_cache.cpp 2007-08-04 00:33:47 UTC (rev 21816) +++ haiku/trunk/src/system/kernel/vm/vm_cache.cpp 2007-08-04 00:36:50 UTC (rev 21817) @@ -294,6 +294,18 @@ state = disable_interrupts(); acquire_spinlock(&sPageCacheTableLock); +#if KDEBUG + struct page_lookup_key key; + key.offset = (uint32)(offset >> PAGE_SHIFT); + key.cache = cache; + vm_page* otherPage = (vm_page *)hash_lookup(sPageCacheTable, &key); + if (otherPage != NULL) { + panic("vm_cache_insert_page(): there's already page %p with cache " + "offset %lu in cache %p; inserting page %p", otherPage, + page->cache_offset, cache, page); + } +#endif // KDEBUG + hash_insert(sPageCacheTable, page); release_spinlock(&sPageCacheTableLock); From superstippi at gmx.de Sat Aug 4 09:55:32 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Sat, 04 Aug 2007 09:55:32 +0200 Subject: [Haiku-commits] HaikuBuildCompatibility.h trouble Message-ID: <20070804095532.1356.1@stippis2.1186210982.fake> Hi, after updating the Haiku tree on my ZETA box, it seems HaikuBuildCompatibility.h is no longer included when building the libbe_test tartet. I tried to investigate but couldn't find the source of the problem. Best regards, -Stephan From superstippi at gmx.de Sat Aug 4 12:16:31 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Sat, 04 Aug 2007 12:16:31 +0200 Subject: [Haiku-commits] HaikuBuildCompatibility.h trouble In-Reply-To: <20070804095532.1356.1@stippis2.1186210982.fake> References: <20070804095532.1356.1@stippis2.1186210982.fake> Message-ID: <20070804121631.9957.3@stippis2.1186210982.fake> Hi, Stephan Assmus wrote (2007-08-04, 09:55:32 [+0200]): > after updating the Haiku tree on my ZETA box, it seems > HaikuBuildCompatibility.h is no longer included when building the > libbe_test tartet. I tried to investigate but couldn't find the source of > the problem. I've found what I need to change in order to build libbe_test on dano again: build/jam/BuildSetup: # TODO: Fix the naming! -if $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { +if $(TARGET_PLATFORM) = haiku { NETWORK_LIBS = network ; [...] # include the HaikuBuildCompatibility.h header and link against # libhaikucompat.a. -if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) && $(TARGET_PLATFORM_BEOS_COMPATIBLE) { +if $(TARGET_PLATFORM) != haiku && $(TARGET_PLATFORM_BEOS_COMPATIBLE) { I know these are not the "correct" fixes. libbe_test is TARGET_PLATFORM_HAIKU_COMPATIBLE because it is special cased in HelperRules, and that seems correct. I'm not sure if I compiled on R5 after r21802, so it may still work on R5, but I'm wondering if libbe_test defines should also depend more on the host platform. Like TARGET_PLATFORM_DANO_COMPATIBLE being defined when compiling libbe_test on Dano and TARGET_PLATFORM_BEOS_COMPATIBLE being defined when compiling it on R5. Don't know what to do about it. Best regards, -Stephan From stippi at mail.berlios.de Sat Aug 4 13:16:23 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 4 Aug 2007 13:16:23 +0200 Subject: [Haiku-commits] r21818 - haiku/trunk/headers/os/interface Message-ID: <200708041116.l74BGN7M007194@sheep.berlios.de> Author: stippi Date: 2007-08-04 13:16:22 +0200 (Sat, 04 Aug 2007) New Revision: 21818 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21818&view=rev Modified: haiku/trunk/headers/os/interface/Picture.h Log: * remove dos newlines Modified: haiku/trunk/headers/os/interface/Picture.h =================================================================== --- haiku/trunk/headers/os/interface/Picture.h 2007-08-04 00:36:50 UTC (rev 21817) +++ haiku/trunk/headers/os/interface/Picture.h 2007-08-04 11:16:22 UTC (rev 21818) @@ -1,105 +1,105 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS -// -// 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. -// -// File Name: Picture.h -// Author: Marc Flerackers (mflerackers at androme.be) -// Description: BPicture records a series of drawing instructions that can -// be "replayed" later. -//------------------------------------------------------------------------------ - -#ifndef _PICTURE_H -#define _PICTURE_H - -// Standard Includes ----------------------------------------------------------- - -// System Includes ------------------------------------------------------------- -#include -#include -#include -#include - -// Project Includes ------------------------------------------------------------ - -// Local Includes -------------------------------------------------------------- - -// Local Defines --------------------------------------------------------------- - -// Globals --------------------------------------------------------------------- - -class BView; -struct _BPictureExtent_; - -// BPicture class -------------------------------------------------------------- -class BPicture : public BArchivable { -public: - BPicture(); - BPicture(const BPicture &original); - BPicture(BMessage *data); -virtual ~BPicture(); -static BArchivable *Instantiate(BMessage *data); -virtual status_t Archive(BMessage *data, bool deep = true) const; -virtual status_t Perform(perform_code d, void *arg); - - status_t Play(void **callBackTable, - int32 tableEntries, - void *userData); - - status_t Flatten(BDataIO *stream); - status_t Unflatten(BDataIO *stream); - -/*----- Private or reserved -----------------------------------------*/ -private: - -friend class BWindow; -friend class BView; -friend class BPrintJob; - -virtual void _ReservedPicture1(); -virtual void _ReservedPicture2(); -virtual void _ReservedPicture3(); - - BPicture &operator=(const BPicture &); - - void init_data(); - void import_data(const void *data, int32 size, BPicture **subs, int32 subCount); - void import_old_data(const void *data, int32 size); - void set_token(int32 token); - bool assert_local_copy(); - bool assert_old_local_copy(); - bool assert_server_copy(); - - /**Deprecated API**/ - BPicture(const void *data, int32 size); - const void *Data() const; - int32 DataSize() const; - - void usurp(BPicture *lameDuck); - BPicture *step_down(); - - int32 token; - _BPictureExtent_ *extent; - BPicture *usurped; - uint32 _reserved[3]; -}; -//------------------------------------------------------------------------------ - -#endif // _PICTURE_H +//------------------------------------------------------------------------------ +// Copyright (c) 2001-2002, OpenBeOS +// +// 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. +// +// File Name: Picture.h +// Author: Marc Flerackers (mflerackers at androme.be) +// Description: BPicture records a series of drawing instructions that can +// be "replayed" later. +//------------------------------------------------------------------------------ +#ifndef _PICTURE_H +#define _PICTURE_H + +// Standard Includes ----------------------------------------------------------- + +// System Includes ------------------------------------------------------------- +#include +#include +#include +#include + +// Project Includes ------------------------------------------------------------ + +// Local Includes -------------------------------------------------------------- + +// Local Defines --------------------------------------------------------------- + +// Globals --------------------------------------------------------------------- + +class BView; +struct _BPictureExtent_; + +// BPicture class -------------------------------------------------------------- +class BPicture : public BArchivable { +public: + BPicture(); + BPicture(const BPicture &original); + BPicture(BMessage *data); +virtual ~BPicture(); +static BArchivable *Instantiate(BMessage *data); +virtual status_t Archive(BMessage *data, bool deep = true) const; +virtual status_t Perform(perform_code d, void *arg); + + status_t Play(void **callBackTable, + int32 tableEntries, + void *userData); + + status_t Flatten(BDataIO *stream); + status_t Unflatten(BDataIO *stream); + +/*----- Private or reserved -----------------------------------------*/ +private: + +friend class BWindow; +friend class BView; +friend class BPrintJob; + +virtual void _ReservedPicture1(); +virtual void _ReservedPicture2(); +virtual void _ReservedPicture3(); + + BPicture &operator=(const BPicture &); + + void init_data(); + void import_data(const void *data, int32 size, BPicture **subs, int32 subCount); + void import_old_data(const void *data, int32 size); + void set_token(int32 token); + bool assert_local_copy(); + bool assert_old_local_copy(); + bool assert_server_copy(); + + /**Deprecated API**/ + BPicture(const void *data, int32 size); + const void *Data() const; + int32 DataSize() const; + + void usurp(BPicture *lameDuck); + BPicture *step_down(); + + int32 token; + _BPictureExtent_ *extent; + BPicture *usurped; + uint32 _reserved[3]; +}; +//------------------------------------------------------------------------------ + +#endif // _PICTURE_H + From stippi at mail.berlios.de Sat Aug 4 13:18:22 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 4 Aug 2007 13:18:22 +0200 Subject: [Haiku-commits] r21819 - haiku/trunk/src/servers/app Message-ID: <200708041118.l74BIMYd009861@sheep.berlios.de> Author: stippi Date: 2007-08-04 13:18:21 +0200 (Sat, 04 Aug 2007) New Revision: 21819 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21819&view=rev Modified: haiku/trunk/src/servers/app/DefaultDecorator.cpp haiku/trunk/src/servers/app/DefaultDecorator.h Log: * cache the tab highlight and shadow color Modified: haiku/trunk/src/servers/app/DefaultDecorator.cpp =================================================================== --- haiku/trunk/src/servers/app/DefaultDecorator.cpp 2007-08-04 11:16:22 UTC (rev 21818) +++ haiku/trunk/src/servers/app/DefaultDecorator.cpp 2007-08-04 11:18:21 UTC (rev 21819) @@ -905,12 +905,6 @@ if (!fTabRect.IsValid() || !invalid.Intersects(fTabRect)) return; - // TODO: cache these - RGBColor tabColorLight = RGBColor(tint_color(fTabColor.GetColor32(), - (B_LIGHTEN_2_TINT + B_LIGHTEN_MAX_TINT) / 2)); - RGBColor tabColorShadow = RGBColor(tint_color(fTabColor.GetColor32(), - B_DARKEN_2_TINT)); - // outer frame fDrawingEngine->StrokeLine(fTabRect.LeftTop(), fTabRect.LeftBottom(), fFrameColors[0]); fDrawingEngine->StrokeLine(fTabRect.LeftTop(), fTabRect.RightTop(), fFrameColors[0]); @@ -922,17 +916,17 @@ // bevel fDrawingEngine->StrokeLine(BPoint(fTabRect.left + 1, fTabRect.top + 1), BPoint(fTabRect.left + 1, fTabRect.bottom - (fLook == kLeftTitledWindowLook ? 1 : 0)), - tabColorLight); + fTabColorLight); fDrawingEngine->StrokeLine(BPoint(fTabRect.left + 1, fTabRect.top + 1), BPoint(fTabRect.right - (fLook == kLeftTitledWindowLook ? 0 : 1), fTabRect.top + 1), - tabColorLight); + fTabColorLight); if (fLook != kLeftTitledWindowLook) { fDrawingEngine->StrokeLine(BPoint(fTabRect.right - 1, fTabRect.top + 2), - BPoint(fTabRect.right - 1, fTabRect.bottom), tabColorShadow); + BPoint(fTabRect.right - 1, fTabRect.bottom), fTabColorShadow); } else { fDrawingEngine->StrokeLine(BPoint(fTabRect.left + 2, fTabRect.bottom - 1), - BPoint(fTabRect.right, fTabRect.bottom - 1), tabColorShadow); + BPoint(fTabRect.right, fTabRect.bottom - 1), fTabColorShadow); } // fill @@ -1045,6 +1039,11 @@ // fFrameColors[4].SetColor(152, 152, 152); // fFrameColors[5].SetColor(96, 96, 96); } + + fTabColorLight = RGBColor(tint_color(fTabColor.GetColor32(), + (B_LIGHTEN_2_TINT + B_LIGHTEN_MAX_TINT) / 2)); + fTabColorShadow = RGBColor(tint_color(fTabColor.GetColor32(), + B_DARKEN_2_TINT)); } // _SetColors Modified: haiku/trunk/src/servers/app/DefaultDecorator.h =================================================================== --- haiku/trunk/src/servers/app/DefaultDecorator.h 2007-08-04 11:16:22 UTC (rev 21818) +++ haiku/trunk/src/servers/app/DefaultDecorator.h 2007-08-04 11:18:21 UTC (rev 21819) @@ -81,7 +81,9 @@ RGBColor fButtonLowColor; RGBColor fTextColor; RGBColor fTabColor; - + RGBColor fTabColorLight; + RGBColor fTabColorShadow; + RGBColor* fFrameColors; // Individual rects for handling window frame From stippi at mail.berlios.de Sat Aug 4 13:19:57 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 4 Aug 2007 13:19:57 +0200 Subject: [Haiku-commits] r21820 - haiku/trunk/src/system/libroot/os Message-ID: <200708041119.l74BJvg6010744@sheep.berlios.de> Author: stippi Date: 2007-08-04 13:19:56 +0200 (Sat, 04 Aug 2007) New Revision: 21820 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21820&view=rev Modified: haiku/trunk/src/system/libroot/os/scheduler.c Log: * if there is any app actually using suggest_thread_priority() it won't no longer use idle priority, even if an actual implementation is still missing Modified: haiku/trunk/src/system/libroot/os/scheduler.c =================================================================== --- haiku/trunk/src/system/libroot/os/scheduler.c 2007-08-04 11:18:21 UTC (rev 21819) +++ haiku/trunk/src/system/libroot/os/scheduler.c 2007-08-04 11:19:56 UTC (rev 21820) @@ -1,5 +1,5 @@ /* -** Copyright 2004, J?r?me Duval, korli at users.sourceforge.net. All rights reserved. +** Copyright 2004, J??r??me Duval, korli at users.sourceforge.net. All rights reserved. ** Distributed under the terms of the Haiku License. */ @@ -9,7 +9,7 @@ int32 suggest_thread_priority(uint32 what, int32 period, bigtime_t jitter, bigtime_t length) { - return 0; + return 10; } bigtime_t From stippi at mail.berlios.de Sat Aug 4 13:22:48 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 4 Aug 2007 13:22:48 +0200 Subject: [Haiku-commits] r21821 - in haiku/trunk: headers/private/app src/kits/interface src/servers/app Message-ID: <200708041122.l74BMmQm012087@sheep.berlios.de> Author: stippi Date: 2007-08-04 13:22:47 +0200 (Sat, 04 Aug 2007) New Revision: 21821 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21821&view=rev Modified: haiku/trunk/headers/private/app/ServerProtocol.h haiku/trunk/src/kits/interface/View.cpp haiku/trunk/src/servers/app/ServerWindow.cpp Log: * use a different message code for DrawString() with escapement delta and DrawString() without * this change also includes adding the penlocation to the shape to-screem coordinate conversion (temporarily breaks shape rendering, will be fixed in next commit) Modified: haiku/trunk/headers/private/app/ServerProtocol.h =================================================================== --- haiku/trunk/headers/private/app/ServerProtocol.h 2007-08-04 11:19:56 UTC (rev 21820) +++ haiku/trunk/headers/private/app/ServerProtocol.h 2007-08-04 11:22:47 UTC (rev 21821) @@ -213,6 +213,7 @@ AS_FILL_TRIANGLE, AS_DRAW_STRING, + AS_DRAW_STRING_WITH_DELTA, AS_SYNC, Modified: haiku/trunk/src/kits/interface/View.cpp =================================================================== --- haiku/trunk/src/kits/interface/View.cpp 2007-08-04 11:19:56 UTC (rev 21820) +++ haiku/trunk/src/kits/interface/View.cpp 2007-08-04 11:22:47 UTC (rev 21821) @@ -2424,21 +2424,17 @@ if (fOwner) { check_lock(); - fOwner->fLink->StartMessage(AS_DRAW_STRING); + // quite often delta will be NULL + if (delta) + fOwner->fLink->StartMessage(AS_DRAW_STRING_WITH_DELTA); + else + fOwner->fLink->StartMessage(AS_DRAW_STRING); fOwner->fLink->Attach(length); fOwner->fLink->Attach(location); - // Quite often delta will be NULL, so we have to accomodate this. if (delta) fOwner->fLink->Attach(*delta); - else { - escapement_delta tdelta; - tdelta.space = 0; - tdelta.nonspace = 0; - fOwner->fLink->Attach(tdelta); - } - fOwner->fLink->AttachString(string, length); _FlushIfNotInTransaction(); Modified: haiku/trunk/src/servers/app/ServerWindow.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerWindow.cpp 2007-08-04 11:19:56 UTC (rev 21820) +++ haiku/trunk/src/servers/app/ServerWindow.cpp 2007-08-04 11:22:47 UTC (rev 21821) @@ -2241,8 +2241,13 @@ if (link.Read(opList, opCount * sizeof(uint32)) >= B_OK && link.Read(ptList, ptCount * sizeof(BPoint)) >= B_OK) { - for (int32 i = 0; i < ptCount; i++) + // this might seem a bit weird, but under R5, the shapes + // are always offset by the current pen location + BPoint penLocation = fCurrentLayer->CurrentState()->PenLocation(); + for (int32 i = 0; i < ptCount; i++) { + ptList[i] += penLocation; fCurrentLayer->ConvertToScreenForDrawing(&ptList[i]); + } drawingEngine->DrawShape(shapeFrame, opCount, opList, ptCount, ptList, code == AS_FILL_SHAPE); @@ -2296,27 +2301,31 @@ break; } case AS_DRAW_STRING: + case AS_DRAW_STRING_WITH_DELTA: { DTRACE(("ServerWindow %s: Message AS_DRAW_STRING\n", Title())); char* string; int32 length; BPoint location; - escapement_delta delta; + escapement_delta _delta; + escapement_delta* delta = NULL; link.Read(&length); link.Read(&location); - link.Read(&delta); + if (code == AS_DRAW_STRING_WITH_DELTA) { + link.Read(&_delta); + if (_delta.nonspace != 0.0 || _delta.space != 0.0) + delta = &_delta; + } link.ReadString(&string); + fCurrentLayer->ConvertToScreenForDrawing(&location); BPoint penLocation = drawingEngine->DrawString(string, length, - location, &delta); + location, delta); fCurrentLayer->ConvertFromScreenForDrawing(&penLocation); fCurrentLayer->CurrentState()->SetPenLocation(penLocation); - // pen location has changed, update DrawingEngine - // TODO: optimize with flags - _UpdateDrawState(fCurrentLayer); free(string); break; From stippi at mail.berlios.de Sat Aug 4 13:37:17 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 4 Aug 2007 13:37:17 +0200 Subject: [Haiku-commits] r21822 - in haiku/trunk/src/servers/app: . drawing drawing/Painter Message-ID: <200708041137.l74BbHtl001700@sheep.berlios.de> Author: stippi Date: 2007-08-04 13:37:16 +0200 (Sat, 04 Aug 2007) New Revision: 21822 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21822&view=rev Modified: haiku/trunk/src/servers/app/FontCache.cpp haiku/trunk/src/servers/app/FontCacheEntry.cpp haiku/trunk/src/servers/app/GlyphLayoutEngine.h haiku/trunk/src/servers/app/ProfileMessageSupport.cpp haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp haiku/trunk/src/servers/app/drawing/Painter/AGGTextRenderer.cpp haiku/trunk/src/servers/app/drawing/Painter/AGGTextRenderer.h haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp haiku/trunk/src/servers/app/drawing/Painter/Painter.h Log: * after my last changes to font rendering, it was about 15% slower than before (although there should be much less lock contention) * with this change, there is quite a bit of cleanup, text drawing is now about 20% faster than before the original changes to font caching, mostly due to turning off the kerning feature, which at the moment gives absolutely no benefit. The correct way of doing it might be to use kerning depending on the provided glyph spacing mode * removed fPenLocation from Painter, the usage should be more correct now, since it is now consistently applied before the coordinate transformation from view to screen (also for DrawShape() now, before any view scaling and origin offset) * Painter no longer has it's own instance of a ServerFont, instead it uses its AGGTextRenderer instance, which was per Painter again after the last change, and not global anymore, made _UpdateFont() useless * When using GlyphLayoutEngine, it supports a second pass with the same FontCacheEntry through the introduction of a FontCacheReference. This speeds up DrawString a little, since it needs to calculate the bounding box for the string, and then draw the string in a second pass. This is now done with only one FontCacheEntry lookup * I also tried to optimize the on-the-fly conversion of UTF8->CharCode away, since it was done four times per DrawString, but surprisingly, it proofed to be a slight slowdown. * introduced a shortcut in DrawingEngine::DrawString() which avoids calculating the bounding box, we are now a tiny bit faster to figure out that we don't need to draw any string than Dano In the test environment (drawing to offscreen bitmap and blitting to screen eventually), text rendering is now about 3.7 times _faster_ than Dano text rendering (directly to screen), for untransformed text. Unfortunately I cannot test on the same machine in accelerant using version of the test environment. Modified: haiku/trunk/src/servers/app/FontCache.cpp =================================================================== --- haiku/trunk/src/servers/app/FontCache.cpp 2007-08-04 11:22:47 UTC (rev 21821) +++ haiku/trunk/src/servers/app/FontCache.cpp 2007-08-04 11:37:16 UTC (rev 21822) @@ -48,7 +48,7 @@ return &sDefaultInstance; } -// SetFont +// FontCacheEntryFor FontCacheEntry* FontCache::FontCacheEntryFor(const ServerFont& font) { @@ -62,6 +62,7 @@ if (entry) { // the entry was already there entry->AddReference(); +//printf("FontCacheEntryFor(%ld): %p\n", font.GetFamilyAndStyle(), entry); return entry; } @@ -91,6 +92,7 @@ return NULL; } } +//printf("FontCacheEntryFor(%ld): %p (insert)\n", font.GetFamilyAndStyle(), entry); entry->AddReference(); return entry; @@ -100,6 +102,7 @@ void FontCache::Recycle(FontCacheEntry* entry) { +//printf("Recycle(%p)\n", entry); entry->UpdateUsage(); entry->RemoveReference(); } Modified: haiku/trunk/src/servers/app/FontCacheEntry.cpp =================================================================== --- haiku/trunk/src/servers/app/FontCacheEntry.cpp 2007-08-04 11:22:47 UTC (rev 21821) +++ haiku/trunk/src/servers/app/FontCacheEntry.cpp 2007-08-04 11:37:16 UTC (rev 21822) @@ -212,8 +212,11 @@ FontCacheEntry::GenerateSignature(char* signature, const ServerFont& font) { glyph_rendering renderingType = glyph_ren_native_gray8; - if (font.Rotation() != 0.0 || font.Shear() != 90.0) + if (font.Rotation() != 0.0 || font.Shear() != 90.0 + || font.Flags() & B_DISABLE_ANTIALIASING + || font.Size() > 30) { renderingType = glyph_ren_outline; + } // TODO: read more of these from the font FT_Encoding charMap = FT_ENCODING_NONE; Modified: haiku/trunk/src/servers/app/GlyphLayoutEngine.h =================================================================== --- haiku/trunk/src/servers/app/GlyphLayoutEngine.h 2007-08-04 11:22:47 UTC (rev 21821) +++ haiku/trunk/src/servers/app/GlyphLayoutEngine.h 2007-08-04 11:37:16 UTC (rev 21822) @@ -16,6 +16,42 @@ #include "ServerFont.h" +class FontCacheReference { + public: + FontCacheReference() + : fCacheEntry(NULL) + , fWriteLocked(false) + { + } + ~FontCacheReference() + { + if (fCacheEntry) { + if (fWriteLocked) + fCacheEntry->WriteUnlock(); + else + fCacheEntry->ReadUnlock(); + + FontCache::Default()->Recycle( + fCacheEntry); + } + } + void SetTo(FontCacheEntry* entry, + bool writeLocked) + { + fCacheEntry = entry; + fWriteLocked = writeLocked; + } + inline FontCacheEntry* Entry() const + { return fCacheEntry; } + inline bool WriteLocked() const + { return fWriteLocked; } + + private: + FontCacheEntry* fCacheEntry; + bool fWriteLocked; +}; + + class GlyphLayoutEngine { public: @@ -26,7 +62,8 @@ int32 length, const escapement_delta* delta = NULL, bool kerning = true, - uint8 spacing = B_BITMAP_SPACING); + uint8 spacing = B_BITMAP_SPACING, + FontCacheReference* cacheReference = NULL); static bool IsWhiteSpace(uint32 glyphCode); @@ -62,27 +99,37 @@ GlyphLayoutEngine::LayoutGlyphs(GlyphConsumer& consumer, const ServerFont& font, const char* utf8String, int32 length, - const escapement_delta* delta, bool kerning, uint8 spacing) + const escapement_delta* delta, bool kerning, uint8 spacing, + FontCacheReference* cacheReference) { // TODO: implement spacing modes - FontCache* cache = FontCache::Default(); - FontCacheEntry* entry = cache->FontCacheEntryFor(font); - if (!entry || !entry->ReadLock()) { - cache->Recycle(entry); - return false; + FontCacheEntry* entry = NULL; + bool needsWriteLock = false; + if (cacheReference) { + entry = cacheReference->Entry(); + needsWriteLock = cacheReference->WriteLocked(); } - bool needsWriteLock - = !entry->HasGlyphs(utf8String, length); - - if (needsWriteLock) { - entry->ReadUnlock(); - if (!entry->WriteLock()) { + if (!entry) { + FontCache* cache = FontCache::Default(); + entry = cache->FontCacheEntryFor(font); + + if (!entry || !entry->ReadLock()) { cache->Recycle(entry); return false; } - } + + needsWriteLock = !entry->HasGlyphs(utf8String, length); + + if (needsWriteLock) { + entry->ReadUnlock(); + if (!entry->WriteLock()) { + cache->Recycle(entry); + return false; + } + } + } // else the entry was already used and is still locked consumer.Start(); @@ -107,8 +154,8 @@ continue; } - if (kerning) - entry->GetKerning(lastCharCode, charCode, &advanceX, &advanceY); +// if (kerning) +// entry->GetKerning(lastCharCode, charCode, &advanceX, &advanceY); x += advanceX; y += advanceY; @@ -133,12 +180,18 @@ y += advanceY; consumer.Finish(x, y); - if (needsWriteLock) - entry->WriteUnlock(); - else - entry->ReadUnlock(); - - cache->Recycle(entry); + if (!cacheReference) { + if (needsWriteLock) + entry->WriteUnlock(); + else + entry->ReadUnlock(); + + FontCache::Default()->Recycle(entry); + } else { + // the reference will take care of locking + if (!cacheReference->Entry()) + cacheReference->SetTo(entry, needsWriteLock); + } return true; } Modified: haiku/trunk/src/servers/app/ProfileMessageSupport.cpp =================================================================== --- haiku/trunk/src/servers/app/ProfileMessageSupport.cpp 2007-08-04 11:22:47 UTC (rev 21821) +++ haiku/trunk/src/servers/app/ProfileMessageSupport.cpp 2007-08-04 11:37:16 UTC (rev 21822) @@ -201,6 +201,7 @@ case AS_FILL_TRIANGLE: string = "AS_FILL_TRIANGLE"; break; case AS_DRAW_STRING: string = "AS_DRAW_STRING"; break; + case AS_DRAW_STRING_WITH_DELTA: string = "AS_DRAW_STRING_WITH_DELTA"; break; case AS_SYNC: string = "AS_SYNC"; break; Modified: haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp 2007-08-04 11:22:47 UTC (rev 21821) +++ haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp 2007-08-04 11:37:16 UTC (rev 21822) @@ -185,7 +185,7 @@ void DrawingEngine::SetDrawState(const DrawState* state, int32 xOffset, int32 yOffset) { - fPainter->SetDrawState(state, true, xOffset, yOffset); + fPainter->SetDrawState(state, xOffset, yOffset); } @@ -665,18 +665,12 @@ bool cursorTouched = fGraphicsCard->HideSoftwareCursor(touched); if (!fPainter->StraightLine(start, end, color.GetColor32())) { - // TODO: all this is quite expensive, but it is currently - // used only for the "gradient" decorator tab buttons - rgb_color previousColor = fPainter->HighColor(); - drawing_mode previousMode = fPainter->DrawingMode(); fPainter->SetHighColor(color); fPainter->SetDrawingMode(B_OP_OVER); fPainter->StrokeLine(start, end); - fPainter->SetHighColor(previousColor); - fPainter->SetDrawingMode(previousMode); - } else { - fGraphicsCard->Invalidate(touched); } + + fGraphicsCard->Invalidate(touched); if (cursorTouched) fGraphicsCard->ShowSoftwareCursor(); } @@ -742,17 +736,12 @@ BRect frame = r.Frame(); bool cursorTouched = fGraphicsCard->HideSoftwareCursor(frame); - bool doInSoftware = true; // try hardware optimized version first if ((fAvailableHWAccleration & HW_ACC_FILL_REGION) != 0 && frame.Width() * frame.Height() > 100) { fGraphicsCard->FillRegion(r, color, fSuspendSyncLevel == 0 || cursorTouched); - doInSoftware = false; - } - - if (doInSoftware) { - + } else { int32 count = r.CountRects(); for (int32 i = 0; i < count; i++) { fPainter->FillRectNoClipping(r.RectAt(i), color.GetColor32()); @@ -1037,6 +1026,19 @@ BPoint penLocation = pt; + // try a fast clipping path + float fontSize = fPainter->Font().Size(); + BRect clippingFrame = fPainter->ClippingRegion()->Frame(); + if (pt.x > clippingFrame.right || pt.y + fontSize < clippingFrame.top + || pt.y - fontSize > clippingFrame.bottom) { + penLocation.x += StringWidth(string, length, delta); + return penLocation; + } + + // use a FontCacheRefernece to speed up the second pass of + // drawing the string + FontCacheReference cacheReference; + //bigtime_t now = system_time(); // TODO: BoundingBox is quite slow!! Optimizing it will be beneficial. // Cursiously, the DrawString after it is actually faster!?! @@ -1045,7 +1047,8 @@ // in case we don't have one. // TODO: Watch out about penLocation and use Painter::PenLocation() when // not using BoundindBox anymore. - BRect b = fPainter->BoundingBox(string, length, pt, &penLocation, delta); + BRect b = fPainter->BoundingBox(string, length, pt, &penLocation, delta, + &cacheReference); // stop here if we're supposed to render outside of the clipping b = fPainter->ClipRect(b); if (b.IsValid()) { @@ -1053,7 +1056,8 @@ bool cursorTouched = fGraphicsCard->HideSoftwareCursor(b); //now = system_time(); - BRect touched = fPainter->DrawString(string, length, pt, delta); + BRect touched = fPainter->DrawString(string, length, pt, delta, + &cacheReference); //printf("drawing string: %lld ?s\n", system_time() - now); fGraphicsCard->Invalidate(touched); Modified: haiku/trunk/src/servers/app/drawing/Painter/AGGTextRenderer.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/Painter/AGGTextRenderer.cpp 2007-08-04 11:22:47 UTC (rev 21821) +++ haiku/trunk/src/servers/app/drawing/Painter/AGGTextRenderer.cpp 2007-08-04 11:37:16 UTC (rev 21822) @@ -29,7 +29,8 @@ // constructor -AGGTextRenderer::AGGTextRenderer() +AGGTextRenderer::AGGTextRenderer(renderer_type& solidRenderer, + renderer_bin_type& binRenderer, scanline_unpacked_type& scanline) : fPathAdaptor() , fGray8Adaptor() , fGray8Scanline() @@ -39,6 +40,11 @@ , fCurves(fPathAdaptor) , fContour(fCurves) + , fSolidRenderer(solidRenderer) + , fBinRenderer(binRenderer) + , fScanline(scanline) + , fRasterizer() + , fHinted(true) , fAntialias(true) , fKerning(true) @@ -101,9 +107,6 @@ class AGGTextRenderer::StringRenderer { public: StringRenderer(const IntRect& clippingFrame, bool dryRun, - renderer_type& solidRenderer, - renderer_bin_type& binRenderer, - scanline_unpacked_type& scanline, FontCacheEntry::TransformedOutline& transformedGlyph, FontCacheEntry::TransformedContourOutline& transformedContour, const Transformable& transform, @@ -119,10 +122,6 @@ , fNextCharPos(nextCharPos) , fVector(false) - , fSolidRenderer(solidRenderer) - , fBinRenderer(binRenderer) - , fScanline(scanline) - , fTransformedGlyph(transformedGlyph) , fTransformedContour(transformedContour) @@ -137,8 +136,8 @@ void Finish(double x, double y) { if (fVector) { - agg::render_scanlines(fRenderer.fRasterizer, fScanline, - fSolidRenderer); + agg::render_scanlines(fRenderer.fRasterizer, fRenderer.fScanline, + fRenderer.fSolidRenderer); } if (fNextCharPos) { @@ -157,7 +156,8 @@ { // "glyphBounds" is the bounds of the glyph transformed // by the x y location of the glyph along the base line, - // it is therefor yet "untransformed". + // it is therefor yet "untransformed" in case there is an + // embedded transformation. const agg::rect_i& r = glyph->bounds; IntRect glyphBounds(r.x1 + x, r.y1 + y - 1, r.x2 + x + 1, r.y2 + y + 1); @@ -211,12 +211,12 @@ switch (glyph->data_type) { case glyph_data_mono: agg::render_scanlines(fRenderer.fMonoAdaptor, - fRenderer.fMonoScanline, fBinRenderer); + fRenderer.fMonoScanline, fRenderer.fBinRenderer); break; case glyph_data_gray8: agg::render_scanlines(fRenderer.fGray8Adaptor, - fRenderer.fGray8Scanline, fSolidRenderer); + fRenderer.fGray8Scanline, fRenderer.fSolidRenderer); break; case glyph_data_outline: { @@ -262,9 +262,6 @@ BPoint* fNextCharPos; bool fVector; - renderer_type& fSolidRenderer; - renderer_bin_type& fBinRenderer; - scanline_unpacked_type& fScanline; FontCacheEntry::TransformedOutline& fTransformedGlyph; FontCacheEntry::TransformedContourOutline& fTransformedContour; AGGTextRenderer& fRenderer; @@ -274,14 +271,12 @@ BRect AGGTextRenderer::RenderString(const char* string, uint32 length, - renderer_type* solidRenderer, - renderer_bin_type* binRenderer, - scanline_unpacked_type& scanline, const BPoint& baseLine, const BRect& clippingFrame, bool dryRun, BPoint* nextCharPos, - const escapement_delta* delta) + const escapement_delta* delta, + FontCacheReference* cacheReference) { //printf("RenderString(\"%s\", length: %ld, dry: %d)\n", string, length, dryRun); @@ -303,12 +298,11 @@ transform.Transform(&transformOffset); StringRenderer renderer(clippingFrame, dryRun, - *solidRenderer, *binRenderer, scanline, transformedOutline, transformedContourOutline, transform, transformOffset, nextCharPos, *this); GlyphLayoutEngine::LayoutGlyphs(renderer, fFont, string, length, delta, - fKerning, B_BITMAP_SPACING); + fKerning, B_BITMAP_SPACING, cacheReference); return transform.TransformBounds(renderer.Bounds()); } Modified: haiku/trunk/src/servers/app/drawing/Painter/AGGTextRenderer.h =================================================================== --- haiku/trunk/src/servers/app/drawing/Painter/AGGTextRenderer.h 2007-08-04 11:22:47 UTC (rev 21821) +++ haiku/trunk/src/servers/app/drawing/Painter/AGGTextRenderer.h 2007-08-04 11:37:16 UTC (rev 21822) @@ -1,10 +1,11 @@ /* - * Copyright 2005-2006, Stephan A?mus . All rights reserved. + * Copyright 2005-2007, Stephan A?mus . All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef AGG_TEXT_RENDERER_H #define AGG_TEXT_RENDERER_H + #include "defines.h" #include "FontCacheEntry.h" @@ -16,12 +17,18 @@ #include +class FontCacheReference; + class AGGTextRenderer { public: - AGGTextRenderer(); + AGGTextRenderer(renderer_type& solidRenderer, + renderer_bin_type& binRenderer, + scanline_unpacked_type& scanline); virtual ~AGGTextRenderer(); void SetFont(const ServerFont &font); + inline const ServerFont& Font() const + { return fFont; } void SetHinting(bool hinting); bool Hinting() const @@ -37,14 +44,12 @@ BRect RenderString(const char* utf8String, uint32 length, - renderer_type* solidRenderer, - renderer_bin_type* binRenderer, - scanline_unpacked_type& scanline, const BPoint& baseLine, const BRect& clippingFrame, - bool dryRun = false, - BPoint* nextCharPos = NULL, - const escapement_delta* delta = NULL); + bool dryRun, + BPoint* nextCharPos, + const escapement_delta* delta, + FontCacheReference* cacheReference); private: @@ -61,6 +66,9 @@ FontCacheEntry::CurveConverter fCurves; FontCacheEntry::ContourConverter fContour; + renderer_type& fSolidRenderer; + renderer_bin_type& fBinRenderer; + scanline_unpacked_type& fScanline; rasterizer_type fRasterizer; // NOTE: the object has it's own rasterizer object // since it might be using a different gamma setting Modified: haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp 2007-08-04 11:22:47 UTC (rev 21821) +++ haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp 2007-08-04 11:37:16 UTC (rev 21822) @@ -72,13 +72,12 @@ fDrawingText(false), fAlphaSrcMode(B_PIXEL_ALPHA), fAlphaFncMode(B_ALPHA_OVERLAY), - fPenLocation(0.0, 0.0), fLineCapMode(B_BUTT_CAP), fLineJoinMode(B_MITER_JOIN), fMiterLimit(B_DEFAULT_MITER_LIMIT), fPatternHandler(), - fTextRenderer() + fTextRenderer(fRenderer, fRendererBin, fUnpackedScanline) { fPixelFormat.SetDrawingMode(fDrawingMode, fAlphaSrcMode, fAlphaFncMode, false); @@ -122,22 +121,19 @@ // SetDrawState void -Painter::SetDrawState(const DrawState* data, bool updateFont, - int32 xOffset, int32 yOffset) +Painter::SetDrawState(const DrawState* data, int32 xOffset, int32 yOffset) { - // NOTE: The custom clipping in "data" is ignored, because it has already been - // taken into account elsewhere + // NOTE: The custom clipping in "data" is ignored, because it has already + // been taken into account elsewhere // TODO: optimize "context switch" for speed... // but for now... SetPenSize(data->PenSize()); - SetPenLocation(data->PenLocation()); - if (updateFont) - SetFont(data->Font()); + SetFont(data->Font()); + fTextRenderer.SetAntialiasing(!(data->ForceFontAliasing() + || data->Font().Flags() & B_DISABLE_ANTIALIASING)); - fTextRenderer.SetAntialiasing(!(data->ForceFontAliasing() || data->Font().Flags() & B_DISABLE_ANTIALIASING)); - fSubpixelPrecise = data->SubPixelPrecise(); // any of these conditions means we need to use a different drawing @@ -259,18 +255,11 @@ } } -// SetPenLocation -void -Painter::SetPenLocation(const BPoint& location) -{ - fPenLocation = location; -} - // SetFont void Painter::SetFont(const ServerFont& font) { - fFont = font; + fTextRenderer.SetFont(font); } // #pragma mark - drawing @@ -524,14 +513,14 @@ for (int32 i = 0; i < opCount; i++) { uint32 op = opList[i] & 0xFF000000; if (op & OP_MOVETO) { - fPath.move_to(points->x + fPenLocation.x, points->y + fPenLocation.y); + fPath.move_to(points->x, points->y); points++; } if (op & OP_LINETO) { int32 count = opList[i] & 0x00FFFFFF; while (count--) { - fPath.line_to(points->x + fPenLocation.x, points->y + fPenLocation.y); + fPath.line_to(points->x, points->y); points++; } } @@ -539,9 +528,9 @@ if (op & OP_BEZIERTO) { int32 count = opList[i] & 0x00FFFFFF; while (count) { - fPath.curve4(points[0].x + fPenLocation.x, points[0].y + fPenLocation.y, - points[1].x + fPenLocation.x, points[1].y + fPenLocation.y, - points[2].x + fPenLocation.x, points[2].y + fPenLocation.y); + fPath.curve4(points[0].x, points[0].y, + points[1].x, points[1].y, + points[2].x, points[2].y); points += 3; count -= 3; } @@ -972,7 +961,8 @@ // DrawString BRect Painter::DrawString(const char* utf8String, uint32 length, - BPoint baseLine, const escapement_delta* delta) + BPoint baseLine, const escapement_delta* delta, + FontCacheReference* cacheReference) { CHECK_CLIPPING @@ -987,14 +977,10 @@ // make sure that the previous pattern is restored pattern oldPattern = *fPatternHandler.GetR5Pattern(); SetPattern(B_SOLID_HIGH, true); - // make sure the text renderer is using our font (the global - // instance of the text renderer is used by everyone) - _UpdateFont(); bounds = fTextRenderer.RenderString(utf8String, length, - &fRenderer, &fRendererBin, fUnpackedScanline, - baseLine, fClippingRegion->Frame(), false, - &fPenLocation, delta); + baseLine, fClippingRegion->Frame(), false, NULL, delta, + cacheReference); SetPattern(oldPattern); @@ -1005,21 +991,17 @@ BRect Painter::BoundingBox(const char* utf8String, uint32 length, BPoint baseLine, BPoint* penLocation, - const escapement_delta* delta) const + const escapement_delta* delta, + FontCacheReference* cacheReference) const { if (!fSubpixelPrecise) { baseLine.x = roundf(baseLine.x); baseLine.y = roundf(baseLine.y); } - // make sure the text renderer is using our font (the global - // instance of the text renderer is used by everyone) - _UpdateFont(); - static BRect dummy; return fTextRenderer.RenderString(utf8String, length, - &fRenderer, &fRendererBin, fUnpackedScanline, - baseLine, dummy, true, penLocation, delta); + baseLine, dummy, true, penLocation, delta, cacheReference); } // StringWidth @@ -1027,7 +1009,7 @@ Painter::StringWidth(const char* utf8String, uint32 length, const escapement_delta* delta) { - return fFont.StringWidth(utf8String, length, delta); + return Font().StringWidth(utf8String, length, delta); } // #pragma mark - @@ -1051,7 +1033,8 @@ bitmap->Height(), bitmap->BytesPerRow()); - _DrawBitmap(srcBuffer, bitmap->ColorSpace(), actualBitmapRect, bitmapRect, viewRect); + _DrawBitmap(srcBuffer, bitmap->ColorSpace(), actualBitmapRect, + bitmapRect, viewRect); } return touched; } @@ -1131,13 +1114,6 @@ return BRect(rect); } -// _UpdateFont -void -Painter::_UpdateFont() const -{ - fTextRenderer.SetFont(fFont); -} - // _UpdateDrawingMode void Painter::_UpdateDrawingMode(bool drawingText) Modified: haiku/trunk/src/servers/app/drawing/Painter/Painter.h =================================================================== --- haiku/trunk/src/servers/app/drawing/Painter/Painter.h 2007-08-04 11:22:47 UTC (rev 21821) +++ haiku/trunk/src/servers/app/drawing/Painter/Painter.h 2007-08-04 11:37:16 UTC (rev 21822) @@ -27,6 +27,7 @@ class BBitmap; class BRegion; class DrawState; +class FontCacheReference; class RenderingBuffer; class ServerBitmap; class ServerFont; @@ -47,7 +48,6 @@ { return fClippingRegion; } void SetDrawState(const DrawState* data, - bool updateFont = false, int32 xOffset = 0, int32 yOffset = 0); @@ -84,12 +84,9 @@ void SetBlendingMode(source_alpha srcAlpha, alpha_function alphaFunc); - void SetPenLocation(const BPoint& location); - inline BPoint PenLocation() const - { return fPenLocation; } void SetFont(const ServerFont& font); inline const ServerFont& Font() const - { return fFont; } + { return fTextRenderer.Font(); } // painting functions @@ -178,13 +175,15 @@ BRect DrawString( const char* utf8String, uint32 length, BPoint baseLine, - const escapement_delta* delta = NULL); + const escapement_delta* delta, + FontCacheReference* cacheReference = NULL); BRect BoundingBox( const char* utf8String, uint32 length, BPoint baseLine, BPoint* penLocation, - const escapement_delta* delta = NULL) const; + const escapement_delta* delta, + FontCacheReference* cacheReference = NULL) const; float StringWidth( const char* utf8String, uint32 length, @@ -278,14 +277,12 @@ bool fDrawingText; source_alpha fAlphaSrcMode; alpha_function fAlphaFncMode; - BPoint fPenLocation; cap_mode fLineCapMode; join_mode fLineJoinMode; float fMiterLimit; PatternHandler fPatternHandler; - ServerFont fFont; // a class handling rendering and caching of glyphs // it is setup to load from a specific Freetype supported // font file which it gets from ServerFont From michael.pfeiffer at utanet.at Sat Aug 4 13:40:25 2007 From: michael.pfeiffer at utanet.at (Michael Pfeiffer) Date: Sat, 4 Aug 2007 13:40:25 +0200 Subject: [Haiku-commits] r21820 - haiku/trunk/src/system/libroot/os In-Reply-To: <200708041119.l74BJvg6010744@sheep.berlios.de> References: <200708041119.l74BJvg6010744@sheep.berlios.de> Message-ID: <2D14BF16-AA8A-41F4-B233-9339CA35C722@utanet.at> Am 04.08.2007 um 13:19 schrieb stippi at BerliOS: > @@ -9,7 +9,7 @@ > int32 > suggest_thread_priority(uint32 what, int32 period, bigtime_t > jitter, bigtime_t length) > { > - return 0; > + return 10; > } Is it OK to implement a version that mimics behavior of BeOS R5? - Michael From superstippi at gmx.de Sat Aug 4 13:54:28 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Sat, 04 Aug 2007 13:54:28 +0200 Subject: [Haiku-commits] r21820 - haiku/trunk/src/system/libroot/os In-Reply-To: <2D14BF16-AA8A-41F4-B233-9339CA35C722@utanet.at> References: <200708041119.l74BJvg6010744@sheep.berlios.de> <2D14BF16-AA8A-41F4-B233-9339CA35C722@utanet.at> Message-ID: <20070804135428.2548.1@stippis2.1186228425.fake> Michael Pfeiffer wrote (2007-08-04, 13:40:25 [+0200]): > Am 04.08.2007 um 13:19 schrieb stippi at BerliOS: > > > @@ -9,7 +9,7 @@ > > int32 > > suggest_thread_priority(uint32 what, int32 period, bigtime_t > > jitter, bigtime_t length) > > { > > - return 0; > > + return 10; > > } > > Is it OK to implement a version that mimics behavior of BeOS R5? Yes, of course! Best regards, -Stephan From jackburton at mail.berlios.de Sat Aug 4 16:34:48 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Sat, 4 Aug 2007 16:34:48 +0200 Subject: [Haiku-commits] r21823 - haiku/trunk/src/servers/app Message-ID: <200708041434.l74EYm4i013578@sheep.berlios.de> Author: jackburton Date: 2007-08-04 16:34:47 +0200 (Sat, 04 Aug 2007) New Revision: 21823 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21823&view=rev Modified: haiku/trunk/src/servers/app/ServerWindow.cpp Log: Since AS_DRAW_STRING doesn't attach the escapement delta anymore, drawing a string inside a picture and then playing that picture triggered a debugger call. Fixed. Modified: haiku/trunk/src/servers/app/ServerWindow.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerWindow.cpp 2007-08-04 11:37:16 UTC (rev 21822) +++ haiku/trunk/src/servers/app/ServerWindow.cpp 2007-08-04 14:34:47 UTC (rev 21823) @@ -2545,15 +2545,17 @@ } case AS_DRAW_STRING: + case AS_DRAW_STRING_WITH_DELTA: { char* string = NULL; int32 length; BPoint location; - escapement_delta delta; - + link.Read(&length); link.Read(&location); - link.Read(&delta); + escapement_delta delta = { 0, 0 }; + if (code == AS_DRAW_STRING_WITH_DELTA) + link.Read(&delta); link.ReadString(&string); picture->WriteDrawString(location, string, length, delta); From jackburton at mail.berlios.de Sat Aug 4 16:35:38 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Sat, 4 Aug 2007 16:35:38 +0200 Subject: [Haiku-commits] r21824 - haiku/trunk/src/apps/terminal Message-ID: <200708041435.l74EZcTS013639@sheep.berlios.de> Author: jackburton Date: 2007-08-04 16:35:38 +0200 (Sat, 04 Aug 2007) New Revision: 21824 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21824&view=rev Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp Log: If there's only one tab, quit the window when TermView::NotifyQuit() is called. Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.cpp 2007-08-04 14:34:47 UTC (rev 21823) +++ haiku/trunk/src/apps/terminal/TermWindow.cpp 2007-08-04 14:35:38 UTC (rev 21824) @@ -239,7 +239,10 @@ // Since the implementation of BTabView uses AddChild/RemoveChild on the // views, the current active tab is the only one who is attached, thus // the only one which could send a message. - delete fTabView->RemoveTab(fTabView->Selection()); + if (fTabView->CountTabs() > 1) + delete fTabView->RemoveTab(fTabView->Selection()); + else + PostMessage(B_QUIT_REQUESTED); break; } From bonefish at cs.tu-berlin.de Sat Aug 4 17:48:21 2007 From: bonefish at cs.tu-berlin.de (Ingo Weinhold) Date: Sat, 04 Aug 2007 17:48:21 +0200 Subject: [Haiku-commits] HaikuBuildCompatibility.h trouble In-Reply-To: <20070804121631.9957.3@stippis2.1186210982.fake> References: <20070804095532.1356.1@stippis2.1186210982.fake> <20070804121631.9957.3@stippis2.1186210982.fake> Message-ID: <20070804174821.958.3@cs.tu-berlin.de> On 2007-08-04 at 12:16:31 [+0200], Stephan Assmus wrote: > Stephan Assmus wrote (2007-08-04, 09:55:32 [+0200]): > > after updating the Haiku tree on my ZETA box, it seems > > HaikuBuildCompatibility.h is no longer included when building the > > libbe_test tartet. I tried to investigate but couldn't find the source of > > the problem. > > I've found what I need to change in order to build libbe_test on dano again: > > build/jam/BuildSetup: > > # TODO: Fix the naming! > -if $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { > +if $(TARGET_PLATFORM) = haiku { > NETWORK_LIBS = network ; > > [...] > # include the HaikuBuildCompatibility.h header and link against > # libhaikucompat.a. > > -if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) && > $(TARGET_PLATFORM_BEOS_COMPATIBLE) { > +if $(TARGET_PLATFORM) != haiku && $(TARGET_PLATFORM_BEOS_COMPATIBLE) { > > I know these are not the "correct" fixes. libbe_test is > TARGET_PLATFORM_HAIKU_COMPATIBLE because it is special cased in > HelperRules, and that seems correct. I'm not sure if I compiled on R5 after > r21802, so it may still work on R5, but I'm wondering if libbe_test defines > should also depend more on the host platform. Like > TARGET_PLATFORM_DANO_COMPATIBLE being defined when compiling libbe_test on > Dano and TARGET_PLATFORM_BEOS_COMPATIBLE being defined when compiling it on > R5. Don't know what to do about it. I'll look into those later today. CU, Ingo From bonefish at cs.tu-berlin.de Sat Aug 4 17:51:16 2007 From: bonefish at cs.tu-berlin.de (Ingo Weinhold) Date: Sat, 04 Aug 2007 17:51:16 +0200 Subject: [Haiku-commits] r21822 - in haiku/trunk/src/servers/app: . drawing drawing/Painter In-Reply-To: <200708041137.l74BbHtl001700@sheep.berlios.de> References: <200708041137.l74BbHtl001700@sheep.berlios.de> Message-ID: <20070804175116.1002.4@cs.tu-berlin.de> On 2007-08-04 at 13:37:17 [+0200], stippi at BerliOS wrote: > Author: stippi > Date: 2007-08-04 13:37:16 +0200 (Sat, 04 Aug 2007) > New Revision: 21822 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21822&view=rev [...] > In the test environment (drawing to offscreen bitmap and blitting to > screen eventually), text rendering is now about 3.7 times _faster_ than Dano > text rendering (directly to screen), for untransformed text. Wow! :-) CU, Ingo From laplace at mail.berlios.de Sat Aug 4 18:35:20 2007 From: laplace at mail.berlios.de (laplace at BerliOS) Date: Sat, 4 Aug 2007 18:35:20 +0200 Subject: [Haiku-commits] r21825 - haiku/trunk/src/system/libroot/os Message-ID: <200708041635.l74GZKYT027268@sheep.berlios.de> Author: laplace Date: 2007-08-04 18:35:19 +0200 (Sat, 04 Aug 2007) New Revision: 21825 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21825&view=rev Modified: haiku/trunk/src/system/libroot/os/scheduler.c Log: * Updated copyright header. * Initial implementation of suggest_thread_priority. It behaves like version from BeOS R5. * TODO take arguments 'period', 'jitter', and 'length' into account as well . Modified: haiku/trunk/src/system/libroot/os/scheduler.c =================================================================== --- haiku/trunk/src/system/libroot/os/scheduler.c 2007-08-04 14:35:38 UTC (rev 21824) +++ haiku/trunk/src/system/libroot/os/scheduler.c 2007-08-04 16:35:19 UTC (rev 21825) @@ -1,15 +1,49 @@ /* -** Copyright 2004, J?r?me Duval, korli at users.sourceforge.net. All rights reserved. -** Distributed under the terms of the Haiku License. -*/ + * Copyright 2004-2007, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * J?r?me Duval, korli at users.sourceforge.net. + * Michael Pfeiffer, laplace at users.sourceforge.net + */ #include + +static struct { + uint32 what; + int32 priority; +} gWhatPriorityArray[] = { + // highest priority first + {B_MIDI_PROCESSING, 0x78}, + {B_AUDIO_RECORDING | B_AUDIO_PLAYBACK, 0x73}, + {B_LIVE_AUDIO_MANIPULATION, 0x6e}, + {B_VIDEO_RECORDING, 0x19}, + {B_VIDEO_PLAYBACK, 0x14}, + {B_USER_INPUT_HANDLING, 0x0f}, + {B_LIVE_VIDEO_MANIPULATION, 0x0e}, + {B_LIVE_3D_RENDERING, 0x0c}, + {B_STATUS_RENDERING, 0xa}, + {B_OFFLINE_PROCESSING, 0x06}, + {B_NUMBER_CRUNCHING, 0x05}, + {(uint32)-1, -1} +}; + int32 suggest_thread_priority(uint32 what, int32 period, bigtime_t jitter, bigtime_t length) { - return 10; + int32 priority = what == B_DEFAULT_MEDIA_PRIORITY ? 0x0a : 0; + // default priority + + for (int i = 0; gWhatPriorityArray[i].what != (uint32)-1; i ++) { + if ((what & gWhatPriorityArray[i].what) != 0) { + priority = gWhatPriorityArray[i].priority; + break; + } + } + + return priority; } bigtime_t From superstippi at gmx.de Sat Aug 4 18:30:40 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Sat, 04 Aug 2007 18:30:40 +0200 Subject: [Haiku-commits] r21823 - haiku/trunk/src/servers/app In-Reply-To: <200708041434.l74EYm4i013578@sheep.berlios.de> References: <200708041434.l74EYm4i013578@sheep.berlios.de> Message-ID: <20070804183040.20531.4@stippis2.1186232374.fake> jackburton at BerliOS wrote (2007-08-04, 16:34:48 [+0200]): > Author: jackburton > Date: 2007-08-04 16:34:47 +0200 (Sat, 04 Aug 2007) New Revision: 21823 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21823&view=rev > > Modified: > haiku/trunk/src/servers/app/ServerWindow.cpp > Log: > Since AS_DRAW_STRING doesn't attach the escapement delta anymore, drawing > a string inside a picture and then playing that picture triggered a > debugger call. Fixed. Oh, sorry about that. I seem to forget about BPictures all the time... :-) Best regards, -Stephan From superstippi at gmx.de Sat Aug 4 19:00:07 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Sat, 04 Aug 2007 19:00:07 +0200 Subject: [Haiku-commits] r21822 - in haiku/trunk/src/servers/app: . drawing drawing/Painter In-Reply-To: <20070804175116.1002.4@cs.tu-berlin.de> References: <200708041137.l74BbHtl001700@sheep.berlios.de> <20070804175116.1002.4@cs.tu-berlin.de> Message-ID: <20070804190007.21435.7@stippis2.1186232374.fake> Ingo Weinhold wrote (2007-08-04, 17:51:16 [+0200]): > > On 2007-08-04 at 13:37:17 [+0200], stippi at BerliOS > wrote: > > Author: stippi > > Date: 2007-08-04 13:37:16 +0200 (Sat, 04 Aug 2007) New Revision: 21822 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21822&view=rev > [...] > > In the test environment (drawing to offscreen bitmap and blitting to > > screen eventually), text rendering is now about 3.7 times _faster_ than > > Dano text rendering (directly to screen), for untransformed text. > > Wow! :-) I was able to test it on the same computer running the real Haiku and there, text rendering was about 1.5 times slower compared to Dano. Best regards, -Stephan From laplace at mail.berlios.de Sat Aug 4 19:09:47 2007 From: laplace at mail.berlios.de (laplace at BerliOS) Date: Sat, 4 Aug 2007 19:09:47 +0200 Subject: [Haiku-commits] r21826 - haiku/trunk/src/system/libroot/os Message-ID: <200708041709.l74H9lpX006342@sheep.berlios.de> Author: laplace Date: 2007-08-04 19:09:46 +0200 (Sat, 04 Aug 2007) New Revision: 21826 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21826&view=rev Modified: haiku/trunk/src/system/libroot/os/scheduler.c Log: Make C compiler happy. Modified: haiku/trunk/src/system/libroot/os/scheduler.c =================================================================== --- haiku/trunk/src/system/libroot/os/scheduler.c 2007-08-04 16:35:19 UTC (rev 21825) +++ haiku/trunk/src/system/libroot/os/scheduler.c 2007-08-04 17:09:46 UTC (rev 21826) @@ -33,10 +33,11 @@ int32 suggest_thread_priority(uint32 what, int32 period, bigtime_t jitter, bigtime_t length) { + int i; int32 priority = what == B_DEFAULT_MEDIA_PRIORITY ? 0x0a : 0; // default priority - for (int i = 0; gWhatPriorityArray[i].what != (uint32)-1; i ++) { + for (i = 0; gWhatPriorityArray[i].what != (uint32)-1; i ++) { if ((what & gWhatPriorityArray[i].what) != 0) { priority = gWhatPriorityArray[i].priority; break; From bonefish at cs.tu-berlin.de Sat Aug 4 19:50:32 2007 From: bonefish at cs.tu-berlin.de (Ingo Weinhold) Date: Sat, 04 Aug 2007 19:50:32 +0200 Subject: [Haiku-commits] r21822 - in haiku/trunk/src/servers/app: . drawing drawing/Painter In-Reply-To: <20070804190007.21435.7@stippis2.1186232374.fake> References: <200708041137.l74BbHtl001700@sheep.berlios.de> <20070804175116.1002.4@cs.tu-berlin.de> <20070804190007.21435.7@stippis2.1186232374.fake> Message-ID: <20070804195032.2116.7@cs.tu-berlin.de> On 2007-08-04 at 19:00:07 [+0200], Stephan Assmus wrote: > Ingo Weinhold wrote (2007-08-04, 17:51:16 [+0200]): > > On 2007-08-04 at 13:37:17 [+0200], stippi at BerliOS > > wrote: > > > Author: stippi > > > Date: 2007-08-04 13:37:16 +0200 (Sat, 04 Aug 2007) New Revision: 21822 > > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21822&view=rev > > [...] > > > In the test environment (drawing to offscreen bitmap and blitting to > > > screen eventually), text rendering is now about 3.7 times _faster_ than > > > Dano text rendering (directly to screen), for untransformed text. > > > > Wow! :-) > > I was able to test it on the same computer running the real Haiku and > there, text rendering was about 1.5 times slower compared to Dano. Given how much optimization potential our kernel has, that's still very promising. CU, Ingo From bonefish at mail.berlios.de Sun Aug 5 03:13:29 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 5 Aug 2007 03:13:29 +0200 Subject: [Haiku-commits] r21827 - in haiku/trunk: build/jam src/kits/tracker Message-ID: <200708050113.l751DTCO010924@sheep.berlios.de> Author: bonefish Date: 2007-08-05 03:13:27 +0200 (Sun, 05 Aug 2007) New Revision: 21827 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21827&view=rev Modified: haiku/trunk/build/jam/HelperRules haiku/trunk/src/kits/tracker/Jamfile Log: Made the compatibility level for target libbe_test depend on the compatibility of the host platform. The libtracker Jamfile seems to be the only one that needs another exception. Modified: haiku/trunk/build/jam/HelperRules =================================================================== --- haiku/trunk/build/jam/HelperRules 2007-08-04 17:09:46 UTC (rev 21826) +++ haiku/trunk/build/jam/HelperRules 2007-08-05 01:13:27 UTC (rev 21827) @@ -142,7 +142,7 @@ # special case: Haiku libbe.so built for testing under BeOS if $(platform) = libbe_test { - platform = haiku ; + platform = $(HOST_PLATFORM) ; } $(varPrefix)_PLATFORM_BEOS_COMPATIBLE = ; Modified: haiku/trunk/src/kits/tracker/Jamfile =================================================================== --- haiku/trunk/src/kits/tracker/Jamfile 2007-08-04 17:09:46 UTC (rev 21826) +++ haiku/trunk/src/kits/tracker/Jamfile 2007-08-05 01:13:27 UTC (rev 21827) @@ -18,7 +18,7 @@ ; local vector_icon_libs ; -if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { +if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) && $(TARGET_PLATFORM) != libbe_test { vector_icon_libs = libicon.a libagg.a ; } From marcusoverhagen at mail.berlios.de Sun Aug 5 15:24:52 2007 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sun, 5 Aug 2007 15:24:52 +0200 Subject: [Haiku-commits] r21828 - haiku/trunk/src/tests/misc Message-ID: <200708051324.l75DOqBD018566@sheep.berlios.de> Author: marcusoverhagen Date: 2007-08-05 15:24:52 +0200 (Sun, 05 Aug 2007) New Revision: 21828 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21828&view=rev Added: haiku/trunk/src/tests/misc/writev-test.cpp Modified: haiku/trunk/src/tests/misc/Jamfile Log: writev test application. I expected this to crash haiku, but it hasn't so far. Modified: haiku/trunk/src/tests/misc/Jamfile =================================================================== --- haiku/trunk/src/tests/misc/Jamfile 2007-08-05 01:13:27 UTC (rev 21827) +++ haiku/trunk/src/tests/misc/Jamfile 2007-08-05 13:24:52 UTC (rev 21828) @@ -3,5 +3,6 @@ SetSubDirSupportedPlatformsBeOSCompatible ; SimpleTest rtti-test : rtti-test.cpp : be ; +SimpleTest writev-test : writev-test.cpp : be ; SubInclude HAIKU_TOP src tests misc exception-test ; Added: haiku/trunk/src/tests/misc/writev-test.cpp =================================================================== --- haiku/trunk/src/tests/misc/writev-test.cpp 2007-08-05 01:13:27 UTC (rev 21827) +++ haiku/trunk/src/tests/misc/writev-test.cpp 2007-08-05 13:24:52 UTC (rev 21828) @@ -0,0 +1,44 @@ +#include +#include +#include +#include +#include +#include + +int +main() +{ + int fd = open("testfile", O_CREAT | O_RDWR, 0666); + + if (fd < 0) { + printf("file open error %s\n", strerror(errno)); + return 1; + } + + int dummy; + int ret; + iovec vec1 = { &dummy, sizeof(dummy) }; + ret = writev(fd, &vec1, 0x80000001); + + if (ret < 0) { + printf("vec 1 write error %s\n", strerror(errno)); + } + + iovec vec2 = { (void *)0x80100000, 0x1000 }; + ret = writev(fd, &vec2, 1); + + if (ret < 0) { + printf("vec 2 write error %s\n", strerror(errno)); + } + + iovec vec3 = { 0, 1 }; + ret = writev(fd, &vec3, 0xfff); + + if (ret < 0) { + printf("vec 3 write error %s\n", strerror(errno)); + } + + close(fd); + + return 0; +} From marcusoverhagen at mail.berlios.de Sun Aug 5 15:56:01 2007 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sun, 5 Aug 2007 15:56:01 +0200 Subject: [Haiku-commits] r21829 - haiku/trunk/src/system/kernel/fs Message-ID: <200708051356.l75Du1Qg020424@sheep.berlios.de> Author: marcusoverhagen Date: 2007-08-05 15:56:01 +0200 (Sun, 05 Aug 2007) New Revision: 21829 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21829&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: FD_CLOEXEC is a flag, other bits may be set Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2007-08-05 13:24:52 UTC (rev 21828) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2007-08-05 13:56:01 UTC (rev 21829) @@ -4206,7 +4206,7 @@ // O_CLOEXEC is the only flag available at this time mutex_lock(&context->io_mutex); - fd_set_close_on_exec(context, fd, argument == FD_CLOEXEC); + fd_set_close_on_exec(context, fd, argument & FD_CLOEXEC); mutex_unlock(&context->io_mutex); status = B_OK; From korli at users.berlios.de Sun Aug 5 16:00:14 2007 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Sun, 5 Aug 2007 16:00:14 +0200 Subject: [Haiku-commits] r21812 - haiku/trunk/src/preferences/media In-Reply-To: <20070803212531.750.2@cs.tu-berlin.de> References: <200708031903.l73J3Wst001936@sheep.berlios.de> <20070803212531.750.2@cs.tu-berlin.de> Message-ID: 2007/8/3, Ingo Weinhold : > > Oh, that reminds me: Why is it there anyway? Hmm, this option is only found in gcc 2.95.3 for BeOS and was added by Oliver. I think it allows multiple symbol spaces : it's a compatibility option with Be's librairies, which avoids the application crash on BeOS. Better ask Oliver for the real explanation :) Bye, J?r?me -------------- next part -------------- An HTML attachment was scrubbed... URL: From korli at users.berlios.de Sun Aug 5 16:04:56 2007 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Sun, 5 Aug 2007 16:04:56 +0200 Subject: [Haiku-commits] r21820 - haiku/trunk/src/system/libroot/os In-Reply-To: <200708041119.l74BJvg6010744@sheep.berlios.de> References: <200708041119.l74BJvg6010744@sheep.berlios.de> Message-ID: 2007/8/4, stippi at BerliOS : > > Modified: haiku/trunk/src/system/libroot/os/scheduler.c > =================================================================== > --- haiku/trunk/src/system/libroot/os/scheduler.c 2007-08-04 > 11:18:21 UTC (rev 21819) > +++ haiku/trunk/src/system/libroot/os/scheduler.c 2007-08-04 > 11:19:56 UTC (rev 21820) > @@ -1,5 +1,5 @@ > /* > -** Copyright 2004, J?r?me Duval, korli at users.sourceforge.net. All rights > reserved. > +** Copyright 2004, J?(c)r??me Duval, korli at users.sourceforge.net. All > rights reserved. > ** Distributed under the terms of the Haiku License. > */ Seems my name was mixed up by this change, Bye, J?r?me -------------- next part -------------- An HTML attachment was scrubbed... URL: From superstippi at gmx.de Sun Aug 5 16:50:03 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 05 Aug 2007 16:50:03 +0200 Subject: [Haiku-commits] r21820 - haiku/trunk/src/system/libroot/os In-Reply-To: References: <200708041119.l74BJvg6010744@sheep.berlios.de> Message-ID: <20070805165003.5222.11@stippis2.1186309169.fake> Hi J?r?me, J?r?me Duval wrote (2007-08-05, 16:04:56 [+0200]): > 2007/8/4, stippi at BerliOS : > > > > Modified: haiku/trunk/src/system/libroot/os/scheduler.c > > =================================================================== > > --- haiku/trunk/src/system/libroot/os/scheduler.c 2007-08-04 > > 11:18:21 UTC (rev 21819) > > +++ haiku/trunk/src/system/libroot/os/scheduler.c 2007-08-04 > > 11:19:56 UTC (rev 21820) > > @@ -1,5 +1,5 @@ > > /* > > -** Copyright 2004, J?r?me Duval, korli at users.sourceforge.net. All > > rights > > reserved. > > +** Copyright 2004, J?(c)r??me Duval, korli at users.sourceforge.net. All > > rights reserved. > > ** Distributed under the terms of the Haiku License. > > */ > > > Seems my name was mixed up by this change, I think not, Pe says this file is UTF8 encoded and your name is correct here, I think it is just a problem with the commit message. I think I've seen this problem before. Best regards, -Stephan From stefano.ceccherini at gmail.com Sun Aug 5 20:58:37 2007 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Sun, 5 Aug 2007 20:58:37 +0200 Subject: [Haiku-commits] r21823 - haiku/trunk/src/servers/app In-Reply-To: <20070804183040.20531.4@stippis2.1186232374.fake> References: <200708041434.l74EYm4i013578@sheep.berlios.de> <20070804183040.20531.4@stippis2.1186232374.fake> Message-ID: <894b9700708051158q72cbb879p8958dafd6b5d3cb8@mail.gmail.com> 2007/8/4, Stephan Assmus : > Oh, sorry about that. I seem to forget about BPictures all the time... :-) Don't worry, it was an easy fix :) From axeld at mail.berlios.de Mon Aug 6 01:38:32 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 6 Aug 2007 01:38:32 +0200 Subject: [Haiku-commits] r21830 - haiku/trunk/src/system/kernel/fs Message-ID: <200708052338.l75NcWG9022188@sheep.berlios.de> Author: axeld Date: 2007-08-06 01:38:31 +0200 (Mon, 06 Aug 2007) New Revision: 21830 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21830&view=rev Modified: haiku/trunk/src/system/kernel/fs/pipefs.cpp Log: mmlr+bonefish(+axeld - I put the bug in there ;-)): * Inode::MayReleaseWriter() would release the semaphore too often; therefore, Inode::WriteDataToBuffer() now loops in case it still couldn't write anything instead of failing - this fixes a race condition (ie. a device is full message). * In case the read request got filled two times (while adding the request, and after waiting for it to become filled), ReadRequest::PutBuffer() overwrote the output data. This fixes bug #1331. Modified: haiku/trunk/src/system/kernel/fs/pipefs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/pipefs.cpp 2007-08-05 13:56:01 UTC (rev 21829) +++ haiku/trunk/src/system/kernel/fs/pipefs.cpp 2007-08-05 23:38:31 UTC (rev 21830) @@ -626,17 +626,19 @@ // still come in and we don't block the whole inode data transfer // to prevent deadlocks from happening - if (!nonBlocking) + while (fBuffer.Writable() == 0) { + if (nonBlocking) + return B_WOULD_BLOCK; + benaphore_unlock(&fRequestLock); - status_t status = acquire_sem_etc(fWriteLock, 1, - (nonBlocking ? B_TIMEOUT : 0) | B_CAN_INTERRUPT, 0); + status_t status = acquire_sem_etc(fWriteLock, 1, B_CAN_INTERRUPT, 0); - if (!nonBlocking) benaphore_lock(&fRequestLock); - if (status != B_OK) - return status; + if (status != B_OK) + return status; + } // ensure that we don't write more than PIPEFS_MAX_BUFFER_SIZE // into a pipe without blocking @@ -1007,7 +1009,7 @@ if (length == 0) return B_OK; - if (buffer.UserRead(fBuffer, length) < B_OK) { + if (buffer.UserRead((char*)fBuffer + fBytesRead, length) < B_OK) { // if the buffer is just invalid, we release the reader as well release_sem(fLock); return B_BAD_ADDRESS; From axeld at mail.berlios.de Mon Aug 6 02:03:50 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 6 Aug 2007 02:03:50 +0200 Subject: [Haiku-commits] r21831 - haiku/trunk/docs/develop/befs Message-ID: <200708060003.l7603oGY023485@sheep.berlios.de> Author: axeld Date: 2007-08-06 02:03:49 +0200 (Mon, 06 Aug 2007) New Revision: 21831 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21831&view=rev Modified: haiku/trunk/docs/develop/befs/resources.html Log: Brought the document up to date; triggered by an update to this document by Kamikazow which can be seen as an attachment to bug #1356. Modified: haiku/trunk/docs/develop/befs/resources.html =================================================================== --- haiku/trunk/docs/develop/befs/resources.html 2007-08-05 23:38:31 UTC (rev 21830) +++ haiku/trunk/docs/develop/befs/resources.html 2007-08-06 00:03:49 UTC (rev 21831) @@ -1,54 +1,27 @@ + - Documentation and Resources for writing BeOS File Systems + Resources for the Be File System -

Hints for BeOS File System Authors

+

Resources for the Be File System

-

Besides the example DOS file system that comes with the BeOS developers -stuff, there's also a CD-ROM file system example. If you installed the -optional stuff on the BeOS 5.0 Pro CD-ROM (or the developer's kit from the free -site), it's at: /boot/optional/sample-code/add-ons/iso9660 +

Probably the best resource for a description of the inner workings of BFS is the +book "Practical File System Design with the Be File System" written by Dominic +Giampaolo and published by Morgan Kaufmann Publishers. Although that book is out of +print, it's available as a free download from +Dominic's web site. -

On BeBits you can get source code -examples from a few programs, such as AtheOS FS (app 2028 on BeBits). There used to -be a copy of NTFS too with source (app -620 on BeBits), but the site seems to be down. There are also other file -systems there, but source is not included (some have it available on request). +

If you prefer to see how it works in code, please have a look at Haiku's BFS +implementation - you can find that in the SVN repository under +src/add-ons/kernel/file_systems/bfs/. This code is not mature yet, but is considered +to be fairly stable. -

Another useful source of information is the BeOS developer library -web site. It has some articles on file systems, the most relevant being -the One -File Network File System, which shows one way of combining a user space -program with a kernel file system stub. Another good one is about -the FSP (file system protocol). The prior issue describes what features -the BFS supports. There are lots of other tangentially related articles, -such as ones on device drivers, programming in kernel mode, debugging, etc. +

If you are interested in the Haiku file system API, please refer to its documentation +as part of the Haiku book. -

There's also the very good Practical File System Design book -by Dominic Giampaolo, from Morgan Kaufmann -Publishers, read their catalog -entry for more info about the book. - -

Finally, there's Alexander G. -M. Smith's ongoing documentation of the file system API, condensed from all -these sources and from his continuing experiences with trying to write a RAM -file system. You can get the StyledEdit text file with the October -18 2001 version or check the BeOS directory on his site -for newer versions. - -

Last updated November 11, 2001 by AGMS. - From bonefish at cs.tu-berlin.de Mon Aug 6 03:05:58 2007 From: bonefish at cs.tu-berlin.de (Ingo Weinhold) Date: Mon, 06 Aug 2007 03:05:58 +0200 Subject: [Haiku-commits] r21830 - haiku/trunk/src/system/kernel/fs In-Reply-To: <200708052338.l75NcWG9022188@sheep.berlios.de> References: <200708052338.l75NcWG9022188@sheep.berlios.de> Message-ID: <20070806030558.2673.4@cs.tu-berlin.de> On 2007-08-06 at 01:38:32 [+0200], axeld at BerliOS wrote: > Author: axeld > Date: 2007-08-06 01:38:31 +0200 (Mon, 06 Aug 2007) > New Revision: 21830 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21830&view=rev > > Modified: > haiku/trunk/src/system/kernel/fs/pipefs.cpp > Log: > mmlr+bonefish(+axeld - I put the bug in there ;-)): > * Inode::MayReleaseWriter() would release the semaphore too often; > therefore, > Inode::WriteDataToBuffer() now loops in case it still couldn't write > anything > instead of failing - this fixes a race condition (ie. a device is full > message). > * In case the read request got filled two times (while adding the request, > and > after waiting for it to become filled), ReadRequest::PutBuffer() > overwrote the > output data. This fixes bug #1331. After sleeping over it, I think we need to review this. read - wait - read for a single request sounds like we could read non-contiguous data. CU, Ingo From nielx at mail.berlios.de Mon Aug 6 11:09:31 2007 From: nielx at mail.berlios.de (nielx at BerliOS) Date: Mon, 6 Aug 2007 11:09:31 +0200 Subject: [Haiku-commits] r21832 - haiku/trunk/docs/user Message-ID: <200708060909.l7699VZu004662@sheep.berlios.de> Author: nielx Date: 2007-08-06 11:09:29 +0200 (Mon, 06 Aug 2007) New Revision: 21832 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21832&view=rev Modified: haiku/trunk/docs/user/apidoc.dox Log: Update the API guidelines to make them more consistent with the coding guidelines. Three new guidelines: - Commas between names and email adresses in header blocks. - Indent with tabs (with lenght 4) - Two whitelines between blocks Modified: haiku/trunk/docs/user/apidoc.dox =================================================================== --- haiku/trunk/docs/user/apidoc.dox 2007-08-06 00:03:49 UTC (rev 21831) +++ haiku/trunk/docs/user/apidoc.dox 2007-08-06 09:09:29 UTC (rev 21832) @@ -1,687 +1,707 @@ -/* - * Copyright 2007 Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT License. - * - * Authors: - * Niels Sascha Reedijk - * Proofreaders: - * Alan Smale - */ - -/*! - \page apidoc Documenting the API - - This article explains how to document the API. Its intended audience are the - Haiku developers who want to document their own classes, and also the members - of the API Documentation team who want to brush up the documentation. - - This document is divided into three sections. \ref formalrequirements - describes the demands that are made from the markup and spacing of the files. - \ref commands describes the subset of Doxygen commands the Haiku API - documentation uses, and which commands are used in which situation. \ref style - describes the required style and structure of the documentation. - - If you are a developer and you want to prepare the first version of the - documentation for the API documentation team to go over, have a good look at - the formal requirements and the Doxygen commands. In addition, have a quick - glance at how to write member and class documentation, since you'll need to - know which information is mandatory for the documentation. Aspiring members or - members of the API documentation team should read the third section carefully, - and should also check out some of the finished documentation to get a good - grip on the actual tone, style and contents of the documentation. - - \section formalrequirements Formal Requirements - - This section describes formal requirements, such as location and naming of - the files, the header blocks of files, what blocks of documentation look like - and how to put delimiters to separate different 'blocks' in your source file. - - \subsection formalrequirements_location Location of the Documentation Source - - Doxygen, the tool that we use to generate the marked up documentation, has an - ingenious parser that is able to scan through both header and source files - making it possible to document the API directly in the headers or the source. - However, the Haiku project have decided not to put the documentation in either - location, and opt for the third option Doxygen provides: to put the - documentation into separate files. - - \note The reasons to not put the documentation in the header files are - twofold. First of all, it would add unnecessary cruft to the headers that - the compiler will needlessly have to parse. File access and speed isn't BeOS - and Haiku's best quality. The second reason is that the system headers are - included throughout the tree. It's a waste of electricity to have everybody - recompile the entire tree if someone fixes a typo in the documentation. - Likewise, the reason to not put the documentation in the source code is that - it unnecessarily clutters up that file. By not using direct documentation we - lose some advantages, like the fact that developers might be inclined to - update the documentation quicker if they change a method, but as you will - see we'll have some methods in place to prevent that to a certain extent. - - There are a few aspects to the naming and locations of files: - -# Most important, documentation files \b mirror header files. This not only - means that they get the same name, but also that the order of the methods, - variables, functions, etc. will have to be the same. - -# The root directory of the public API headers is at \c /trunk/headers/os. - In a similar vein, the root of the documentation files is at - \c /trunk/src/documentation/haiku_book. The subdirectory structure, or - the division of kits, will also be replicated. - -# The name of the files is the same as the base of the header files, with - the \c dox extension. So \c Something.h becomes \c Something.dox. Note - the case! - - \subsection formalrequirements_headerblock The Header Block - - Every documentation file will begin with the header block. It's basically a - copyright block, with a reference to the author(s) and against which revision - the documentation was written. - - \verbatim -/* - * Copyright 2007 Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT License. - * - * Authors: - * Niels Sascha Reedijk - * Proofreaders: - * Alan Smale - * Corresponds to: - * /trunk/headers/os/support/String.h rev 19731 - * /trunk/src/kits/support/String.cpp rev 19731 - */ - \endverbatim - - The example above has a few elements that you should take note of: - -# The header is put in a standard C comment, which is enclosed between - \c /* and \c *\/. - -# Every line starts with a whitespace and an asterix, followed by another - space. If the text is part of a category, such as Authors, put - three spaces after the delimiter. - -# We start with a copyright notice. The first line is empty, then the - copyright notice, then the line on \e MIT, followed by an empty line. - -# Then there is a label Authors:, which is followed by - lines with names and email addresses between brackets. - -# In the same vein there is the label Proofreaders: in case the - file has been proofread. - -# The final part is underneath the label Corresponds to:. - Underneath there is a list of files and their svn revisions that the - current documentation is known to correspond with. - -# The header block ends with the \c *\/, where the asterix is aligned with - the ones above it. - - \subsection formalrequirements_blocks Blocks - - Blocks are the basic units of documentation for Doxygen. At first it will feel - like overkill to use blocks, but realize that Doxygen was initially designed - to operate on header and source files, and then the blocks of documentation - would be before the definition or declaration of the methods, functions, - etcetera. Doxygen is used to operating on blocks, and that's why we need to - reproduce them in our \c dox files. - - Blocks should adhere to the following standards: - -# All blocks open with \c /*! and close with \c * / - -# The documentation is placed in between these markers. - -# All the contents in between the markers is indented by two spaces. - -# The maximum width of the contents between blocks is 80 columns. Try not - to cross this limit, because it will severely limit readability. - - Example: - \verbatim -/*! - \fn bool BList::AddItem(void *item) - \brief Append an item to the list. - - \param item The item to add. - \retval true The item was appended. - \retval false Item was not appended, since resizing the list failed. - \sa AddItem(void *item, int32 index) -*/ - \endverbatim - - \note Doxygen also allows the use of single line comments, starting with - \c //!, however, we won't use these \b except for group markers, which you - can read more about in the next section. - - \subsection formalrequirements_delimiters Delimiters - - Many of the header files in the Haiku API just document one class or one group - of functions. However, there be a time when you come across a more complex - header and for the sake of clarity in your \c dox file you want to mark the - sections. Use the standard delimiter marker for this, which consists of five - slashes, a space, the title of the section, a space and another five slashes. - Like this: ///// Global Functions /////. - - \note This is only for the source files and for you as documenter. It will - not show up in the actual generated documentation! - - \section commands Doxygen Commands - - This section describes all the Doxygen commands that will be used in the Haiku - API documentation. As a rule, Doxygen commands start with a backslash (\\) and - are followed by whitespace (such as a space or a newline), with the exception - of group markers; this is discussed in more detail later on. The commands can - be divided into several categories, which are described in the following - subsections. - - \note This section does not discuss which commands you should actually use - in documentation. See the next section on \ref style - for that. This section merely explains the different groupings and - syntaxes of commands. - - Most commands accept an argument. Arguments can be one of these three types: - - \ - The argument is a single word. - - (until the end of the line) - The argument runs until the end of the line. - - {paragraph} - The argument runs for an entire paragraph. A paragraph is - ended by an empty line, or if another command that defines a \ref - commands_sections sections is found. Note that if you use commands that - work on a paragraph and you split it over multiple lines (because of the - maximum line width of 80 characters or because it looks better), you will - have to indent subsequent lines that belong to the paragraph with two more - spaces, making the total of four. This is to visually distinguish - paragraphs for other documenters. - - \subsection commands_definitions Block Definitions - - Because our API documentation is not done in the source, nor in the headers, - Doxygen needs to be helped with figuring out what the documentation in the - different blocks actually are about. That's why the first line in a - documentation block would be one of the following commands: - - - \c \\class \ \n - Tells Doxygen that the following section is going to be on the class as - specified by \a name. - - \c \\fn (function declaration) \n - This block is going to be about the function that corresponds to the given - declaration. Please note that the declaration is what you find in the source - file, so if class members are declared, the classname and the scope operator, - \c ::, are to be added as well. Modifiers such as \c const should be - included. - - \c \\var (variable declaration) \n - This block is going to be about the variable indicated by the declaration. - This means basically that data members of a class should have the classname - and the scope operator as well. - - \c \\typedef (typedef declaration) \n - This block is going to be about the typedef indicated by the declaration. - Copy the declaration exactly, including the leading \c typedef keyword. - - \c \\struct \ \n - Tells Doxygen the section is going to be on the \c struct indicated by - \a name. - - \c \\def \ \n - This block is going to be about the \c \#define with the identifier \a name. - - \c \\page \n - This block represents a page. See the section on \ref commands_pages for - detailed information on pages. - - \subsection commands_sections Sections in Member Documentation - - If you have a look at the output that Doxygen generates, you can see that - there are recurring sections in the documentation. Documentation that belongs - to a certain section should be placed after a command that marks the start - of that section. All the commands take a paragraph as answer. A paragraph - ends with a whitespace, or with a command that marks a new section. Note that - this list only shows the syntax of the commands. For the semantics, have a - look at the next section on style. In member documentation you can use the - following: - - - \c \\brief {brief description} \n - This is the only \b mandatory section. Every member should have at least - a brief description. - - \c \\param \ {parameter description} \n - This section describes a parameter with the name \a parameter-name. The - parameter name must match the function declaration, since Doxygen will - check if all the documented parameters exist. - - \c \\return {description of the return value} \n - This section describes the return value. This is a totally free form - paragraph, whereas \c \\retval has a more structured form. - - \c \\retval \ {description} \n - This section describes the return value indicated by \a value. - - \c \\see {references} \n - This section contains references to other parts of the documentation. - - There are also a number of things that can be used in pages and member - documentation. See the style section to find out the appropriate situations in - which to use them. - - - \c \\note {text} - - \c \\attention {text} - - \c \\warning {text} - - \c \\remarks {text} - - \subsection commands_markup Markup - - Sometimes you might require certain text to have a special markup, to make - words stand out, but also if you want to have example code within the - documentation you'll need a special markup. Doxygen defines three types of - commands. There are commands that work on single words, commands that work on - longer phrases and commands that define blocks. Basically, the single letter - commands are commands that work on a the next word. If you need to mark - multiple words or sentences, use the HTML-style commands. Finally, for blocks - of code or blocks of text that need to be in "typewriter" font, use the block - commands. Have a look at the following listing: - - - \c \\a \n - Use to refer to parameters or arguments in a running text, for example - when referring to parameters in method descriptions. - - Bold text - - For single words, use \c \\b. - - For multiple words, enclose between the \c \ and \c \<\\b\> tags. - - Typewriter font \n - This can be used to refer to constants, or anything that needs to be in - a monospace, or typewriter, font. There are a few options - - \c \\c for single words. - - \c \ and \c \<\\tt\> for multiple words or phrases - - The commands \c \\verbatim and \c \\endverbatim. Everything between these - two commands will be put in a distinct block that stands out from the rest - of the text. - - The commands \c \\code and \c \\endcode do the same, but Doxygen will - parse the contents and try to mark up the code to make it look a little bit - nicer. - - Emphasis - - \c \\e for single words. - - \c \ and \c \<\\em\> for phrases. - - \subsection commands_pages Page Commands - - Pages are a very special element of the documentation. They are not - associated with any kind of module, such as files or classes, and therefore, - since they're not members, some of the structuring commands won't work. - Important to know is that a page is the complete length of the block, so - dividing it up in subsections by starting new blocks will not work. Instead, - Doxygen provides some commands to structure text on a page. - - First of all, you define a new page by using the \c \\page command. This - command takes two arguments: a \c \ and (a title). The name - is the internal identifier that can be used in linking between pages (see - \ref commands_miscellaneous for \c \\ref). After you've defined the block - to be a page, you can start writing the contents. - - For more complicated pages, you might want to divide the page up in sections. - Use the \c \\section command to define a new section. It takes the same - arguments as \c \\page, namely the \c \ and the (title). If - you need a deeper hierarchy you may use \c \\subsection and - \c \\subsubsection, again, both with the same syntax. If you need to - distinguish between sections in subsubsections, you are able to use - \c \\paragraph, which takes the same arguments. - - \note Before and after each of the commands above, you need to have an empty - line so as to provide readability. It is not necessary to indent sections - and subsections more than the normal two spaces, as long as you keep the - section markers clear. - - \warning If you are entering the realm of subsections and sub-subsections, - think about the nature of your page. Either it needs to be split up into - multiple pages, or what you're writing is too complex and would be better - off as a big tutorial on the Haiku website. - - If you are creating multiple pages that are related, you will be able to - structure them in a tree by using the \c \\subpage command. This will rank - the different pages in a tree structure. It will put a link in the place of - the command, so you should place it at the top of the parent place and use - it as an index. - - \subsection commands_grouping Member Grouping Commands - - Doxygen makes it possible to group certain members together. It is used - in the BString class for example, where the members are grouped by what kind - of operation they perform, such as appending, finding, etc. Defining groups - is currently not as powerful as it could be, but if you use it inside classes, - you will be fine if you follow the instructions presented in this section. - - \note If you are looking on how to add classes to kits, see - \ref commands_miscellaneous and have a look at the \c \\ingroup command. - - Groups of members are preceded by a block that describes what the group is - about. You are required to give each group of members at least a name. Have - a look at the example: - - \verbatim -/*! - \\name Appending Methods - - These methods append things to the object. -*/ - -//! \@{ - -... names of the methods ... - -//! \@} - \endverbatim - - The block preceding the block opening marker, //! \@{, contains a - \c \\name command and a paragraph that gives a description. The header block - can be as long or short as you want, but please don't make it too long. See - the \ref style section on how to effectively write group headers. The - members that you want to belong to the group are between the group opening - and closing markers. - - \note Group headers don't have a \c \\brief description. - - \subsection commands_miscellaneous Miscellaneous Commands - - There are some commands that don't fit into the categories above, but that - you will end up using every now and then. This section will describe those - commands. - - The first one is \c \\n. This commands sort of belongs to the category of - markup commands. It basically forces a newline. Because Doxygen parses - paragraphs as a single contiguous entity, it's not possible to mark up the - text using carriage returns in the documentation. \c \\n forces a newline in - the output. So in HTML it will be translated into a \c \. - - Sometimes there are some parts of the API that you don't want to be visible. - Since Doxygen extracts all the public and protected members from a class, - and virtually every member from a file, you might want to force it to hide - certain things. If so, use the \c \\internal command. If you place this just - after the block marker, the command will be hidden from documentation. Any - further documentation or remarks you put inside the block will not be visible - in the final documentation. - - Images can be a valuable addition to documentation. To include ones you made, - use the \c \\image command. It has the following prototype: - \\image \ \. The format is currently fixed at - \c html. The file refers to the filename relative to the location of the - documentation file. Any images you want to add should be in the same location - as the dox file, so only the file name will suffice. - - Modules are defined in the main book, and you can add classes to them by - using the \c \\ingroup command. This commands adds the class to the module - and groups it on a separate page. At this moment, the group handling has yet - to be finalised. For now, add the classes to the kit they belong in. In the - future this might change. - - Finally, it is a good idea to link between parts of the documentation. There - are two commands for that. The first one is \c \\ref, which enable you to refer - to pages, sections, etc. that you created yourself. The second one is \c \\link - which refers to members. The first one is takes one word as an argument, the - name of the section, and it inserts a link with the name of the title. \c \\link - is more complex. It should always be accompanied by \c \\endlink. The first - word between the two commands is the object that is referred to, and the - rest is the link text. - - \section style Writing Guidelines - - This final section will present guidelines for the actual writing of the - documentation. Both the structure of the documentation, which sections to use - when, and the style of the writing will be discussed. Before diverging into - the requirements for file and class descriptions, member descriptions and - pages, there are some general remarks that apply to all types of - documentation. - - First of all, everything you write should be in proper English - sentences. Spelling, grammar, punctuation, make sure you adhere to the - standards. It also means the following: - - It means that every sentence should at least have a - subject and a verb (unless it's an imperative statement). - - Also use the proper terminology. Remember, you are dealing with C++ - here, which means you should use the right names. So use \b method instead - of function, and data member instead of variable (where appropriate). - - Avoid informalism. Avoid constructs like 'if you want to disconnect the - object', but rather use 'to disconnect the object'. Avoid familiarisms, or - jokes. - - \remarks It isn't the goal to create dry, legal-style documentation. Just - try to find a balance. Read through documentation that's already been - approved to get a hint of what you should be aiming for. - \remarks If you are having a problem with phrasing certain things, put it - down in such a way that it says everything it needs to. A proofreader might - then be able to rephrase it to a better style. - - Throughout the documentation you might want to provide hints, warnings or - remarks that might interrupt the flow of the text, or that need to visually - stand out from the rest. Doxygen provides commands for paragraphs that - display remarks, warnings, notes and points of attention. You can use these - commands in case you meet one or more of the following requirements: - - The point is for a specific audience, such as beginners in the Haiku API. - Notes on what to read first, or mistakes that may be made by beginners will - not be for the entire audience, and such should be separated. These kinds of - notes should be at the end of blocks. - - The point needs to visually stand out. This is especially the case with - remarks, but could also apply for other types. - - The point is not completely relevant to the text and therefore should be - separated so that it doesn't interrupt the main flow. - - This listing shows which one to use for which situation: - - \c \\attention - - Used when the developer is bound to make a mistake, when the API is - ambiguous. The difference between this and a warning is that warnings warn - about things that are the developers fault, and attention blocks warn - about things that might go wrong because of the way the API is structured. - - Used to warn for abuse of the API that might be caused by the way the - internals of the system are structured. - - \c \\warning - - Used to warn developers about using the API in a certain way. Warnings - apply especially to new developers that aren't completely familiar with - the API and that might want to abuse it. For example, the thread safety - of BString requires a warning. - - \c \\note - - Used to place references to other documentation that might not be - directly related to the text. For example, BLooper will have a direct - reference to BHandler in the class description, but BMessenger will be - mentioned in a note because it does not directly influence the use of - the class. - - Can also be used for useful hints or notes that somehow need to stand - out from the rest of the text. - - \c \\remarks - - Remarks are small notes that would interrupt the flow of the text. For - example, if you in a text ignore a certain condition that is so extremely - rare and uncommon, you can put a remark at the end of the text to tell - that you have been lying. - - Remarks interact with the text whereas notes add something unmentioned to - it. - - \subsection style_files File Descriptions - - The design of Doxygen makes it very file oriented, and this might come off as - inconvenient. At the moment, how to actually group the documentation is still - under debate, but it does not change the requirement that a header needs to - be documented before the members of that header can be documented. As such, - the first documentation block in your \c dox file will be the block that - describes the header. Examples: - - \verbatim -/*! - \file String.h - \brief Defines the BString class and global operators and functions for - handling strings. -*/ - -/*! - \file SupportDefs.h - \brief Defines basic types and definitions for the Haiku API. -*/ - \endverbatim - - The first statement defines what the block is about, namely the header file. - The second element is the \c \\brief remark on what it contains. The first - file defines the BString class and some global operators. You can see that - reflected in the description. SupportDefs.h does not define classes, but - rather a range of different functions and defines, so the text refers to that. - - \remarks \\brief documentation for files is about what it \e implements, as - header files are passive (whereas members and functions are active). Thus, - use the third person form of the verb. - - \subsection style_classes Class Descriptions - - Classes are the basic building blocks in the Haiku API and as such have - extensive documentation. This section will go over the actual class - description. This section will present a list of items you should think about - when writing the class description. This doesn't mean you'll have to include - every item, it merely serves as a guiding principle that helps organise your - thoughts. Have a look at the list: - - -# The \c \\brief description is \b obligatory. This description describes - what it is. For example, BDataIO: "Abstract interface for objects that - provide read and write access to data." Note that this description is not - a full sentence, but it does end with a period. - -# One or more paragraphs that give a broad overview of what the class can - do. Describe things like what it works on, when you want to use it, what - advantage it might give over other directly related alternatives. Also - describe if a class is made to be derived from, and if so, how. Make - sure that a developer in the first few paragraphs can judge if what he - wants to do can be done with this class. - -# One or more paragraphs that show how this class ties in with the rest - of the kit or the API. What objects does it work with, how it interacts - with the servers, etcetera. - -# One or more paragraphs that give a concrete example or use case. Keep it - tidy and self contained. If you use code examples, make sure your examples - adhere to Haiku's coding guidelines. Remember, an example can illustrate - better than a few paragraphs of text. - -# End with a list of references to other classes, functions, pages, etc. that - might be of interest to the reader. - - When documenting classes, don't be to exhaustive. Avoid becoming a tutorial - or a complete guide. This documentation is for reference only. If you want to - enlighten the reader on bigger subjects, consider writing a separate - documentation page that connects the different points you want to make. - - Also, you don't have to put in any groupings of members in class descriptions. - If you want to do that, physically divide the members up in groups. Look at - the \ref commands_grouping for the actual commands, and at \ref style_groups - for help on writing group headers. - - \subsection style_members Members and Functions - - Members and functions share the same basic Doxygen syntax, and they can be - documented in a similar way. That's why this section deals with them together. - Documenting members is probably the main thing you'll do when writing the - actual documentation. There are some guidelines as to how, but the actual - implementation probably differs per class. Keep the following points in mind: - - -# To repeat a very important fact, the first line is a \c \\fn line. This - line needs to match the declaration, which is in the source file. This - means that for members, also the class name and the scope indicator (::) - should be present. Also note that this line doesn't have to adhere to - the 80 column width limit. - -# The first command is always the \c \\brief command. Give a short and - clear description. The description starts with a capital letter and ends - with a dot. Don't write the description saying what the method does, - like "Starts the timer", but rather as what it will do: "Start the timer." - -# If the brief description doesn't cover all of what the method or function - does, then you can add a few paragraphs that explain it in more depth. Don't - be too verbose, and use an example to illustrate points. Point out any - potential misunderstandings or problems you expect developers to have, but - don't repeat the class documentation too much. - -# You are obliged to then document all the parameters. Use the \c \\param - command for that. For the description, use a short phrase such as "The - offset (zero based) where to begin the move." Note the capital and the dot. - -# If the function is non-void, then you'll have to specify what it will - return. In case of fixed values, have a look at \c \\retval. You'll use - this one when the return type is a bool or a status_t. In case of something - else, use \c \\return. You can also combine these two. For example, a - method that returns a length (positive) or an error code (negative). - -# Use \c \\see if you have any references to other methods, classes or - global functions. At least document all the overloaded methods. Also add - methods that do the opposite of this method, or methods that are intimately - related. - - In case of overloaded members, you'll need to make a decision. If you need to - copy too much information, you might resort to putting it in one paragraph - with the text "This is an overloaded member function, and differs from - \ only by the type of parameter it takes." That will keep the copying - down and will point developers right to the place where they can get more - documentation. - - Again, like class descriptions, you'll have to find a good middle-ground - between too much information, and too little. Again, write for the broadest - audience possible, and resort to notes and warnings for specialised - audiences. - - \subsection style_variables Enumerations, Variables and Defines - - This section helps you document (member) variables and defines that define - constants, as well as enumerations and their values. If you need to document - a \c \#define macro that takes arguments, have a look at \ref style_members . - - The \c \\brief description of all these types follow a similar structure. - They are a short phrase that mention what the variable contains. Example: - - \verbatim -/*! - \var char* BString::fPrivateData - \brief BString's storage for data. - - This member is deprecated and might even become \c private in future releases. - - If you are planning to derive from this object and you want to manipulate the - raw string data, please have a look at LockBuffer() and UnlockBuffer(). -*/ - \endverbatim - - The variables you are going to encounter are either \c public or - \c protected member variables, or global variables that have a certain - significance. In the case of member variables, you'll need to document what - they mean and how the developer should manipulate them. If the class is one - that is meant to be derived from, make sure that in the description of the - variable you mention how it interacts with the others, and how the developer - should make sure that the internal coherence of the data and code members of - the inherited class is maintained. - - Global variables will mostly be constants. If so, document what they stand - for and what they might be used for, as well as which classes and functions - depend on that constant. If the variable is meant to be changed by the - developer, explain what values are valid and which functions and classes - depend on this variable. - - Defines are usually used as message constants. Give a short description of - what the message constant stands for, and where it might be send from and - where it might be received. - - Enumerations can either be anonymous or named. In case of the latter, you can - give a description of the enumeration in a documentation block that starts - with an \c \\enum command, followed by the name of the enumeration. If the - enumeration is within the scope of a class, prepend the classname and the - scope indicator. In case of an anonymous enum, you can only document the - individual members (which you should do for the named enumerations as well), - which can be done within code blocks that start with the \c \\var command. - Doxygen will know that it's an enumeration value, don't worry about mixups. - If the enumeration value is within a class, prepend the classname and scope - indicator. Give a short description of the value, which methods react to it, - where it might be used, etcetera. Don't go as far as to copy information too - much. For example, if you use an enumeration in only one class and you - document the possible values there, then don't do that again for the - enumeration documentation: rather just refer to it. That sort of documentation - belongs to the class description, not to the enumeration. - - \subsection style_groups Groups - - If you subdivide members of classes into groups, you have the ability to apply - some general information that will be listed above the listing of the members - in that group. See the section \ref commands_grouping on how to define groups. - This section is on what to put in the header block. - - First of all, it's probably a good idea to give your group a name. This name - will be printed as a title and will enhance the clarity of what the group - contains. If you put the \c \\name command as the first command of a group, - the rest of the words on that line will be used as the title. You should - choose simple titles of no more than three words. - - It's possible to add one or two paragraphs of information. These paragraphs - should contain some quick notes on which of the members in that group to use - for what purpose. See it as a quick subdivision that a developer could use as - a guide to see which method he actually wants to use. Don't go on describing - the methods in detail though, that's what the member documentation is about. - Have a look at the example: - - \verbatim -/*! - \name Comparison Methods - - There are two different comparison methods. First of all there is the whole - range of operators that return a boolean value, secondly there are methods - that return an integer value, both case sensitive and case insensitive. - - There are also global comparison operators and global compare functions. - You might need these in case you have a sort routine that takes a generic - comparison function, such as BList::SortItems(). - See the String.h documentation file to see the specifics, as they are - basically the same as implemented in this class. -*/ - \endverbatim - - Straight, to the point, gives no more information than necessary. Divides - the members up into two groups and refers to other functions the developer - might be looking for. The hard limit is two (short) paragraphs. Using more - will not improve clarity. - -*/ +/* + * Copyright 2007 Niels Sascha Reedijk. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Niels Sascha Reedijk, niels.reedijk at gmail.com + * Proofreaders: + * Alan Smale, ajsmale at gmail.com + */ + + +/*! + \page apidoc Documenting the API + + This article explains how to document the API. Its intended audience are the + Haiku developers who want to document their own classes, and also the + members of the API Documentation team who want to brush up the + documentation. + + This document is divided into three sections. \ref formalrequirements + describes the demands that are made from the markup and spacing of the + files. \ref commands describes the subset of Doxygen commands the Haiku API + documentation uses, and which commands are used in which situation. \ref + style describes the required style and structure of the documentation. If + you are a developer and you want to prepare the first version of the + documentation for the API documentation team to go over, have a good look at + the formal requirements and the Doxygen commands. In addition, have a quick + glance at how to write member and class documentation, since you'll need to + know which information is mandatory for the documentation. Aspiring members + or members of the API documentation team should read the third section + carefully, and should also check out some of the finished documentation to + get a good grip on the actual tone, style and contents of the documentation. + + \section formalrequirements Formal Requirements + + This section describes formal requirements, such as location and naming of + the files, the header blocks of files, what blocks of documentation look + like and how to put delimiters to separate different 'blocks' in your source + file. + + \subsection formalrequirements_location Location of the Documentation Source + + Doxygen, the tool that we use to generate the marked up documentation, has + an ingenious parser that is able to scan through both header and source + files making it possible to document the API directly in the headers or the + source. However, the Haiku project have decided not to put the documentation + in either location, and opt for the third option Doxygen provides: to put + the documentation into separate files. + + \note The reasons to not put the documentation in the header files are + twofold. First of all, it would add unnecessary cruft to the headers + that the compiler will needlessly have to parse. File access and speed + isn't BeOS and Haiku's best quality. The second reason is that the + system headers are included throughout the tree. It's a waste of + electricity to have everybody recompile the entire tree if someone fixes + a typo in the documentation. Likewise, the reason to not put the + documentation in the source code is that it unnecessarily clutters up + that file. By not using direct documentation we lose some advantages, + like the fact that developers might be inclined to update the + documentation quicker if they change a method, but as you will see we'll + have some methods in place to prevent that to a certain extent. + There are a few aspects to the naming and locations of files: + -# Most important, documentation files \b mirror header files. This + not only means that they get the same name, but also that the order + of the methods, variables, functions, etc. will have to be the same. + -# The root directory of the public API headers is at \c + /trunk/headers/os. In a similar vein, the root of the documentation + files is at \c /trunk/src/documentation/haiku_book. The subdirectory + structure, or the division of kits, will also be replicated. + -# The name of the files is the same as the base of the header files, + with the \c dox extension. So \c Something.h becomes \c + Something.dox. Note the case! + + \subsection formalrequirements_headerblock The Header Block + + Every documentation file will begin with the header block. It's basically a + copyright block, with a reference to the author(s) and against which + revision the documentation was written. + + \verbatim +/* +* Copyright 2007 Niels Sascha Reedijk. All rights reserved. +* Distributed under the terms of the MIT License. +* +* Authors: +* Niels Sascha Reedijk, niels.reedijk at gmail.com +* Proofreaders: +* Alan Smale, ajsmale at gmail.com +* Corresponds to: +* /trunk/headers/os/support/String.h rev 19731 +* /trunk/src/kits/support/String.cpp rev 19731 +*/ + \endverbatim + + The example above has a few elements that you should take note of: + -# The header is put in a standard C comment, which is enclosed between \c + /* and \c *\/. + -# Every line starts with a whitespace and an asterix, followed by another + space. If the text is part of a category, such as Authors, put + three spaces after the delimiter. + -# The first line is empty, then we get to the copyright notice. You may + either retain the copyright yourself, or you can attribute to to Haiku + Inc. It's your choice. The next line is the \e MIT licence notice, + followed by an empty line. + -# Then there is a label Authors:, which is followed by + lines with names and email addresses. The latter one is optional, but + recommended. + -# In the same vein there is the label Proofreaders: in case the + file has been proofread. + -# The final part is underneath the label Corresponds to:. + Underneath there is a list of files and their svn revisions that the + current documentation is known to correspond with. + -# The header block ends with the \c *\/, where the asterix is aligned with + the ones above it. + + \subsection formalrequirements_blocks Blocks + + Blocks are the basic units of documentation for Doxygen. At first it will + feel like overkill to use blocks, but realize that Doxygen was initially + designed to operate on header and source files, and then the blocks of + documentation would be before the definition or declaration of the methods, + functions, etcetera. Doxygen is used to operating on blocks, and that's why + we need to reproduce them in our \c dox files. + + Blocks should adhere to the following standards: + -# All blocks open with \c /*! and close with \c * / + -# The documentation is placed in between these markers. + -# All the contents in between the markers is indented by tabs. The tab + length should be four. + -# Between blocks, there should be two empty lines. + -# The maximum width of the contents between blocks is 80 columns. Try + not to cross this limit, because it will severely limit + readability. + + Example: + \verbatim +/*! + \fn bool BList::AddItem(void *item) + \brief Append an item to the list. + + \param item The item to add. + \retval true The item was appended. + \retval false Item was not appended, since resizing the list failed. + \sa AddItem(void *item, int32 index) +*/ + \endverbatim + + \note Doxygen also allows the use of single line comments, starting with + \c //!, however, we won't use these \b except for group markers, which + you can read more about in the next section. + + \subsection formalrequirements_delimiters Delimiters + + Many of the header files in the Haiku API just document one class or one + group of functions. However, there be a time when you come across a more + complex header and for the sake of clarity in your \c dox file you want to + mark the sections. Use the standard delimiter marker for this, which + consists of five slashes, a space, the title of the section, a space and + another five slashes. Like this: ///// Global Functions /////. + + \note This is only for the source files and for you as documenter. It will + not show up in the actual generated documentation! + + \section commands Doxygen Commands + + This section describes all the Doxygen commands that will be used in the + Haiku API documentation. As a rule, Doxygen commands start with a backslash + (\\) and are followed by whitespace (such as a space or a newline), with the + exception of group markers; this is discussed in more detail later on. The + commands can be divided into several categories, which are described in the + following subsections. + + \note This section does not discuss which commands you should actually use + in documentation. See the next section on \ref style for that. This + section merely explains the different groupings and syntaxes of + commands. + + Most commands accept an argument. Arguments can be one of these three types: + - \ - The argument is a single word. + - (until the end of the line) - The argument runs until the end of the line. + - {paragraph} - The argument runs for an entire paragraph. A paragraph is + ended by an empty line, or if another command that defines a \ref + commands_sections sections is found. Note that if you use commands that + work on a paragraph and you split it over multiple lines (because of the + maximum line width of 80 characters or because it looks better), you + will have to indent subsequent lines that belong to the paragraph with + two more spaces, making the total of four. This is to visually + distinguish paragraphs for other documenters. + + \subsection commands_definitions Block Definitions + + Because our API documentation is not done in the source, nor in the headers, + Doxygen needs to be helped with figuring out what the documentation in the + different blocks actually are about. That's why the first line in a + documentation block would be one of the following commands: + + - \c \\class \ \n + Tells Doxygen that the following section is going to be on the class as + specified by \a name. + - \c \\fn (function declaration) \n + This block is going to be about the function that corresponds to the + given declaration. Please note that the declaration is what you find in + the source file, so if class members are declared, the classname and the + scope operator, \c ::, are to be added as well. Modifiers such as \c + const should be included. + - \c \\var (variable declaration) \n + This block is going to be about the variable indicated by the + declaration. This means basically that data members of a class should + have the classname and the scope operator as well. + - \c \\typedef (typedef declaration) \n + This block is going to be about the typedef indicated by the + declaration. Copy the declaration exactly, including the leading \c + typedef keyword. + - \c \\struct \ \n + Tells Doxygen the section is going to be on the \c struct indicated by + \a name. + - \c \\def \ \n + This block is going to be about the \c \#define with the identifier \a + name. + - \c \\page \n + This block represents a page. See the section on \ref commands_pages for + detailed information on pages. + + \subsection commands_sections Sections in Member Documentation + + If you have a look at the output that Doxygen generates, you can see that + there are recurring sections in the documentation. Documentation that + belongs to a certain section should be placed after a command that marks the + start of that section. All the commands take a paragraph as answer. A + paragraph ends with a whitespace, or with a command that marks a new + section. Note that this list only shows the syntax of the commands. For the + semantics, have a look at the next section on style. In member documentation + you can use the following: + + - \c \\brief {brief description} \n + This is the only \b mandatory section. Every member should have at least + a brief description. + - \c \\param \ {parameter description} \n + This section describes a parameter with the name \a parameter-name. The + parameter name must match the function declaration, since Doxygen will + check if all the documented parameters exist. + - \c \\return {description of the return value} \n + This section describes the return value. This is a totally free form + paragraph, whereas \c \\retval has a more structured form. + - \c \\retval \ {description} \n + This section describes the return value indicated by \a value. + - \c \\see {references} \n + This section contains references to other parts of the documentation. + + There are also a number of things that can be used in pages and member + documentation. See the style section to find out the appropriate situations + in which to use them. + + - \c \\note {text} + - \c \\attention {text} + - \c \\warning {text} + - \c \\remarks {text} + + \subsection commands_markup Markup + + Sometimes you might require certain text to have a special markup, to make + words stand out, but also if you want to have example code within the + documentation you'll need a special markup. Doxygen defines three types of + commands. There are commands that work on single words, commands that work + on longer phrases and commands that define blocks. Basically, the single + letter commands are commands that work on a the next word. If you need to + mark multiple words or sentences, use the HTML-style commands. Finally, for + blocks of code or blocks of text that need to be in "typewriter" font, use + the block commands. Have a look at the following listing: + + - \c \\a \n + Use to refer to parameters or arguments in a running text, for example + when referring to parameters in method descriptions. + - Bold text + - For single words, use \c \\b. + - For multiple words, enclose between the \c \ and \c \<\\b\> tags. + - Typewriter font \n + This can be used to refer to constants, or anything that needs to be in + a monospace, or typewriter, font. There are a few options + - \c \\c for single words. + - \c \ and \c \<\\tt\> for multiple words or phrases + - The commands \c \\verbatim and \c \\endverbatim. Everything between + these two commands will be put in a distinct block that stands out + from the rest of the text. + - The commands \c \\code and \c \\endcode do the same, but Doxygen will + parse the contents and try to mark up the code to make it look a + little bit nicer. + - Emphasis + - \c \\e for single words. + - \c \ and \c \<\\em\> for phrases. + + \subsection commands_pages Page Commands + + Pages are a very special element of the documentation. They are not + associated with any kind of module, such as files or classes, and therefore, + since they're not members, some of the structuring commands won't work. + Important to know is that a page is the complete length of the block, so + dividing it up in subsections by starting new blocks will not work. Instead, + Doxygen provides some commands to structure text on a page. + + First of all, you define a new page by using the \c \\page command. This + command takes two arguments: a \c \ and (a title). The name + is the internal identifier that can be used in linking between pages (see + \ref commands_miscellaneous for \c \\ref). After you've defined the block + to be a page, you can start writing the contents. + + For more complicated pages, you might want to divide the page up in + sections. Use the \c \\section command to define a new section. It takes the [... truncated: 400 lines follow ...] From nielx at mail.berlios.de Mon Aug 6 11:32:28 2007 From: nielx at mail.berlios.de (nielx at BerliOS) Date: Mon, 6 Aug 2007 11:32:28 +0200 Subject: [Haiku-commits] r21833 - haiku/trunk/docs/user/support Message-ID: <200708060932.l769WS9N006174@sheep.berlios.de> Author: nielx Date: 2007-08-06 11:32:27 +0200 (Mon, 06 Aug 2007) New Revision: 21833 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21833&view=rev Modified: haiku/trunk/docs/user/support/Archivable.dox haiku/trunk/docs/user/support/BlockCache.dox haiku/trunk/docs/user/support/List.dox Log: Update according to the latest guideline changes. These files already passed phase 3, so they wouldn't be updated during the regular process. I guess the other files will get that update. Modified: haiku/trunk/docs/user/support/Archivable.dox =================================================================== --- haiku/trunk/docs/user/support/Archivable.dox 2007-08-06 09:09:29 UTC (rev 21832) +++ haiku/trunk/docs/user/support/Archivable.dox 2007-08-06 09:32:27 UTC (rev 21833) @@ -1,176 +1,196 @@ -/* - * Copyright 2007, Haiku, Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - * - * Author: - * Niels Sascha Reedijk - * - * Proofreader: - * David Weizades - * Thom Holwerda - * - * Corresponds to: - * /trunk/headers/os/support/Archivable.h rev 19972 - * /trunk/src/kits/support/Archivable.cpp rev 19095 - */ - -/*! - \file Archivable.h - \brief Provides the BArchivable interface. -*/ - -/*! - \class BArchivable - \ingroup support - \ingroup libbe - \brief Interface for objects that can be archived into a BMessage. - - BArchivable provides an interface for objects that can be put into message - archives and extracted into objects in another location. Using this you are - able to send objects between applications, or even between computers across - networks. - - BArchivable differs from BFlattenable in that BFlattenable is designed to - store objects into flat streams of data, the main objective being storage to - disk. The objective of this interface, however, is to store objects that will - be restored to other objects. To illustrate this point, BArchivable messages - know how to restore themselves whereas BFlattenables have a datatype which - you need to map to classes manually. - - Archiving is done with the Archive() method. If your class supports it, the - caller can request it to store into a deep archive, meaning that all child - objects in it will be stored. Extracting the archive works with the - Instantiate() method, which is static. Since the interface is designed to - extract objects without the caller knowing what kind of object it actually is, - the global function #instantiate_object() instantiates a message without you - manually having to determine the class the message is from. This adds - considerable flexibility and allows BArchivable to be used in combination with - other add-ons. - - To provide this interface in your classes you should publicly inherit this - class. You should implement Archive() and Instantiate(), and provide one - constructor that takes one BMessage argument. -*/ - -/*! - \fn BArchivable::BArchivable(BMessage* from) - \brief Constructor. Does nothing. - - If you inherit this interface you should provide at least one constructor that - takes one BMessage argument. -*/ - -/*! - \fn BArchivable::BArchivable() - \brief Constructor. Does nothing. -*/ - -/*! - \fn BArchivable::~BArchivable() - \brief Destructor. Does nothing. -*/ - -/*! - \fn virtual status_t BArchivable::Archive(BMessage* into, bool deep = true) const - \brief Archive the object into a BMessage. - - You should call this method from your derived implementation as it adds the - data needed to instantiate your object to the message. - - \param into The message you store your object in. - \param deep If \c true, all children of this object should be stored as well. - Only pay attention to this parameter if you actually have child objects. - \retval B_OK The archiving succeeded. - \retval "error codes" The archiving did not succeed. -*/ - -/*! - \fn static BArchivable* BArchivable::Instantiate(BMessage* archive) - \brief Static member to restore objects from messages. - - You should always check that the \a archive argument actually corresponds to - your class. The automatic functions, such as #instantiate_object() will not - choose the wrong class but manual calls to this member might be faulty. - - \param archive The message with the data of the object to restore. - \retval You should return a pointer to your object, or \c NULL if you - fail. - \warning The default implementation will always return \c NULL. Even though - it is possible to store plain BArchive objects, it is impossible to restore - them. - \see instantiate_object(BMessage *from) -*/ - -/*! - \fn virtual status_t BArchivable::Perform(perform_code d, void* arg) - \brief Internal method. - \internal This method is defined in case of unforeseen binary compatibility - API issues. Currently nothing of interest is implemented. -*/ - -///// Global methods ///// -/*! - \addtogroup support_globals - @{ -*/ - -/*! - \typedef typedef BArchivable* (*instantiation_func)(BMessage*) - \brief Internal definition of a function that can instantiate objects that - have been created with the BArchivable API. -*/ - -/*! - \fn BArchivable* instantiate_object(BMessage *from, image_id *id) - \brief Instantiate an archived object with the object being defined in a - different application or library. - - This function is similar to instantiate_object(BMessage *from), except that - it takes the \a id argument referring to an image where the object might be - stored. - - \note Images are names for executable files. Image id's refer to these - executable files that have been loaded by your application. Have a look - at the kernel API for further information. -*/ - -/*! - \fn BArchivable* instantiate_object(BMessage *from) - \brief Instantiate an archived object. - - This global function will determine the base class, based on the \a from - argument, and it will call the Instantiate() function of that object to - restore it. - - \param from The archived object. - \return The object returns a pointer to the instantiated object, or \c NULL - if the instantiation failed. The global \c errno variable will contain the - reason why it failed. - \see instantiate_object(BMessage *from, image_id *id) -*/ - -/*! - \fn bool validate_instantiation(BMessage* from, const char* className) - \brief Internal function that checks if the \a className is the same as the - one stored in the \a from message. -*/ - -/*! - \fn instantiation_func find_instantiation_func(const char* className, const char* signature) - \brief Internal function that searches for the instantiation func with a - specific signature. Use instantiate_object() instead. -*/ - -/*! - \fn instantiation_func find_instantiation_func(const char* className) - \brief Internal function that searches for the instantiation func of a - specific class. Use instantiate_object() instead. -*/ - -/*! - \fn instantiation_func find_instantiation_func(BMessage* archive) - \brief Internal function that searches for the instantiation func that - works on the specified \a archive. Use instantiate_object() instead. -*/ - -//! @} +/* + * Copyright 2007, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Author: + * Niels Sascha Reedijk, niels.reedijk at gmail.com + * + * Proofreader: + * David Weizades, ddewbofh at hotmail.com + * Thom Holwerda, slakje at quicknet.nl + * + * Corresponds to: + * /trunk/headers/os/support/Archivable.h rev 19972 + * /trunk/src/kits/support/Archivable.cpp rev 19095 + */ + + +/*! + \file Archivable.h + \brief Provides the BArchivable interface. +*/ + + +/*! + \class BArchivable + \ingroup support + \ingroup libbe + \brief Interface for objects that can be archived into a BMessage. + + BArchivable provides an interface for objects that can be put into message + archives and extracted into objects in another location. Using this you are + able to send objects between applications, or even between computers across + networks. + + BArchivable differs from BFlattenable in that BFlattenable is designed to + store objects into flat streams of data, the main objective being storage to + disk. The objective of this interface, however, is to store objects that + will be restored to other objects. To illustrate this point, BArchivable + messages know how to restore themselves whereas BFlattenables have a + datatype which you need to map to classes manually. + + Archiving is done with the Archive() method. If your class supports it, the + caller can request it to store into a deep archive, meaning that all child + objects in it will be stored. Extracting the archive works with the + Instantiate() method, which is static. Since the interface is designed to + extract objects without the caller knowing what kind of object it actually + is, the global function #instantiate_object() instantiates a message without + you manually having to determine the class the message is from. This adds + considerable flexibility and allows BArchivable to be used in combination + with other add-ons. + + To provide this interface in your classes you should publicly inherit this + class. You should implement Archive() and Instantiate(), and provide one + constructor that takes one BMessage argument. +*/ + + +/*! + \fn BArchivable::BArchivable(BMessage* from) + \brief Constructor. Does nothing. + + If you inherit this interface you should provide at least one constructor + that takes one BMessage argument. +*/ + + +/*! + \fn BArchivable::BArchivable() + \brief Constructor. Does nothing. +*/ + + +/*! + \fn BArchivable::~BArchivable() + \brief Destructor. Does nothing. +*/ + + +/*! + \fn virtual status_t BArchivable::Archive(BMessage* into, + bool deep = true) const + \brief Archive the object into a BMessage. + + You should call this method from your derived implementation as it adds the + data needed to instantiate your object to the message. + + \param into The message you store your object in. + \param deep If \c true, all children of this object should be stored as + well. Only pay attention to this parameter if you actually have child + objects. + \retval B_OK The archiving succeeded. + \retval "error codes" The archiving did not succeed. +*/ + + +/*! + \fn static BArchivable* BArchivable::Instantiate(BMessage* archive) + \brief Static member to restore objects from messages. + + You should always check that the \a archive argument actually corresponds to + your class. The automatic functions, such as #instantiate_object() will not + choose the wrong class but manual calls to this member might be faulty. + + \param archive The message with the data of the object to restore. + \retval You should return a pointer to your object, or \c NULL if you + fail. + \warning The default implementation will always return \c NULL. Even though + it is possible to store plain BArchive objects, it is impossible to + restore them. + \see instantiate_object(BMessage *from) +*/ + + +/*! + \fn virtual status_t BArchivable::Perform(perform_code d, void* arg) + \brief Internal method. + \internal This method is defined in case of unforeseen binary compatibility + API issues. Currently nothing of interest is implemented. +*/ + + +///// Global methods ///// +/*! + \addtogroup support_globals + @{ +*/ + + +/*! + \typedef typedef BArchivable* (*instantiation_func)(BMessage*) + \brief Internal definition of a function that can instantiate objects that + have been created with the BArchivable API. +*/ + + +/*! + \fn BArchivable* instantiate_object(BMessage *from, image_id *id) + \brief Instantiate an archived object with the object being defined in a + different application or library. + + This function is similar to instantiate_object(BMessage *from), except that + it takes the \a id argument referring to an image where the object might be + stored. + + \note Images are names for executable files. Image id's refer to these + executable files that have been loaded by your application. Have a look + at the kernel API for further information. +*/ + + +/*! + \fn BArchivable* instantiate_object(BMessage *from) + \brief Instantiate an archived object. + + This global function will determine the base class, based on the \a from + argument, and it will call the Instantiate() function of that object to + restore it. + + \param from The archived object. + \return The object returns a pointer to the instantiated object, or \c NULL + if the instantiation failed. The global \c errno variable will contain + the reason why it failed. + \see instantiate_object(BMessage *from, image_id *id) +*/ + + +/*! + \fn bool validate_instantiation(BMessage* from, const char* className) + \brief Internal function that checks if the \a className is the same as the + one stored in the \a from message. +*/ + + +/*! + \fn instantiation_func find_instantiation_func(const char* className, + const char* signature) + \brief Internal function that searches for the instantiation func with a + specific signature. Use instantiate_object() instead. +*/ + + +/*! + \fn instantiation_func find_instantiation_func(const char* className) + \brief Internal function that searches for the instantiation func of a + specific class. Use instantiate_object() instead. +*/ + + +/*! + \fn instantiation_func find_instantiation_func(BMessage* archive) + \brief Internal function that searches for the instantiation func that + works on the specified \a archive. Use instantiate_object() instead. +*/ + + +//! @} Modified: haiku/trunk/docs/user/support/BlockCache.dox =================================================================== --- haiku/trunk/docs/user/support/BlockCache.dox 2007-08-06 09:09:29 UTC (rev 21832) +++ haiku/trunk/docs/user/support/BlockCache.dox 2007-08-06 09:32:27 UTC (rev 21833) @@ -3,124 +3,133 @@ * Distributed under the terms of the MIT License. * * Authors: - * Niels Sascha Reedijk + * Niels Sascha Reedijk, niels.reedijk at gmail.com * * Proofreading: - * David Weizades - * Thom Holwerda + * David Weizades, ddewbofh at hotmail.com + * Thom Holwerda, slakje at quicknet.nl * * Corresponds to: * /trunk/headers/os/support/BlockCache.h rev 19972 * /trunk/src/kits/support/BlockCache.cpp rev 4568 */ - + + /*! - \file BlockCache.h - \brief Implements a mechanism to store and retrieve memory blocks. + \file BlockCache.h + \brief Implements a mechanism to store and retrieve memory blocks. */ + /*! - \var B_OBJECT_CACHE - \brief Used in the constructor of BBlockCache. Determines that objects will - be created using \c new[] and \c delete[]. + \var B_OBJECT_CACHE + \brief Used in the constructor of BBlockCache. Determines that objects will + be created using \c new[] and \c delete[]. */ + /*! - \var B_MALLOC_CACHE - \brief Used in the constructor of BBlockCache. Determines that objects will - be created using \c malloc() and \c free(). + \var B_MALLOC_CACHE + \brief Used in the constructor of BBlockCache. Determines that objects will + be created using \c malloc() and \c free(). */ + /*! - \class BBlockCache - \ingroup support - \ingroup libbe - \brief A class that creates and maintains a pool of memory blocks. + \class BBlockCache + \ingroup support + \ingroup libbe + \brief A class that creates and maintains a pool of memory blocks. + + In some performance critical code there might come a time where you require + a lot of little blocks of memory that you want to access and dispose of + continuously. Since allocating and freeing memory are 'expensive' + operations, it is better to have a pool of memory blocks at your disposal. + Luckily, the Haiku API provides a class that will act as the administrator + of your memory pool, so you will not have to reinvent the wheel every time. + + The principle is easy. The constructor takes the number of blocks you + want to create beforehand, the size of the blocks, and the method of + allocation. This can either be #B_OBJECT_CACHE or #B_MALLOC_CACHE. + The first one uses C++ operators \c new[] and \c delete[], while the second + one uses \c malloc() and \c free(). Unless you have specific demands on + performance or you want to take care of freeing the objects yourself, either + way works fine. + + As soon as you have the memory pool, you can Get() blocks. If the + pre-allocated memory blocks run out, BBlockCache will allocate new ones, so + you will not have to worry about availability. As soon as you are done you + can Save() the memory back into the pool. BBlockCache will make sure that no + more blocks will be saved than the initial number you requested when you + created the object, so be aware of that. + + As soon as you got a pointer from the Get() method, you own that block of + memory; this means that you have the liberty to dispose of it yourself. It + also means that when you delete your BBlockCache instance, any blocks of + memory that are checked out will not be destroyed. In case you might want to + delete your objects yourself, make sure you free the memory the right way. + If you created the object as #B_OBJECT_CACHE, use \c delete[] to free your + object. If you created the object as #B_MALLOC_CACHE, use \c free(). Please + note that it defeats the purpose of this class if your are going to free all + the objects yourself since it basically means that when the pool runs out, + Get() will be allocating the objects by itself. + + \note BBlockCache is thread-safe. +*/ - In some performance critical code there might come a time where you require a - lot of little blocks of memory that you want to access and dispose of - continuously. Since allocating and freeing memory are 'expensive' operations, - it is better to have a pool of memory blocks at your disposal. Luckily, the - Haiku API provides a class that will act as the administrator of your memory - pool, so you will not have to reinvent the wheel every time. - The principle is easy. The constructor takes the number of blocks you - want to create beforehand, the size of the blocks, and the method of - allocation. This can either be #B_OBJECT_CACHE or #B_MALLOC_CACHE. - The first one uses C++ operators \c new[] and \c delete[], while the second - one uses \c malloc() and \c free(). Unless you have specific demands on - performance or you want to take care of freeing the objects yourself, either - way works fine. +/*! + \fn BBlockCache::BBlockCache(uint32 blockCount, size_t blockSize, uint32 + allocationType) + \brief Allocate a new memory pool. + + \param blockCount The number of free memory blocks you want to allocate + initially. This number is also used as the maximum number of free blocks + that will be kept. + \param blockSize The size of the blocks. + \param allocationType Either #B_OBJECT_CACHE for using \c new[] and + \c delete[] or #B_MALLOC_CACHE for \c malloc() and \c free(). +*/ - As soon as you have the memory pool, you can Get() blocks. If the - pre-allocated memory blocks run out, BBlockCache will allocate new ones, so - you will not have to worry about availability. As soon as you are done you can - Save() the memory back into the pool. BBlockCache will make sure that no more - blocks will be saved than the initial number you requested when you created - the object, so be aware of that. - As soon as you got a pointer from the Get() method, you own that block of - memory; this means that you have the liberty to dispose of it yourself. It - also means that when you delete your BBlockCache instance, any blocks of - memory that are checked out will not be destroyed. In case you might want to - delete your objects yourself, make sure you free the memory the right way. If - you created the object as #B_OBJECT_CACHE, use \c delete[] to free your - object. If you created the object as #B_MALLOC_CACHE, use \c free(). Please - note that it defeats the purpose of this class if your are going to free all - the objects yourself since it basically means that when the pool runs out, - Get() will be allocating the objects by itself. - - \note BBlockCache is thread-safe. +/*! + \fn BBlockCache::~BBlockCache() + \brief Destroy the empty blocks in the free list. + + Note that the blocks you checked out with Get() and not checked back in with + Save() will not be freed, since ownership belongs to you. Make sure you + clean up after yourself. */ -/*! - \fn BBlockCache::BBlockCache(uint32 blockCount, size_t blockSize, uint32 allocationType) - \brief Allocate a new memory pool. - \param blockCount The number of free memory blocks you want to allocate - initially. This number is also used as the maximum number of free blocks - that will be kept. - \param blockSize The size of the blocks. - \param allocationType Either #B_OBJECT_CACHE for using \c new[] and - \c delete[] or #B_MALLOC_CACHE for \c malloc() and \c free(). -*/ - /*! - \fn BBlockCache::~BBlockCache() - \brief Destroy the empty blocks in the free list. - - Note that the blocks you checked out with Get() and not checked back in with - Save() will not be freed, since ownership belongs to you. Make sure you clean - up after yourself. + \fn void *BBlockCache::Get(size_t blockSize) + \brief Get a block from the pool of free blocks. + + If the pool runs out of free blocks, a new one will be allocated. Please + note that if the size given in the \c blockSize parameter is different from + the size given in the constructor, a new block of memory will be created. + Only sizes that match the blocks in the memory pool will come from the pool. + + \param blockSize The required size of the memory block. + \return Returns a pointer to a memory block, or \c NULL if locking the + object failed. */ -/*! - \fn void *BBlockCache::Get(size_t blockSize) - \brief Get a block from the pool of free blocks. - If the pool runs out of free blocks, a new one will be allocated. Please note - that if the size given in the \c blockSize parameter is different from the - size given in the constructor, a new block of memory will be created. Only - sizes that match the blocks in the memory pool will come from the pool. - - \param blockSize The required size of the memory block. - \return Returns a pointer to a memory block, or \c NULL if locking the object - failed. -*/ - /*! - \fn void BBlockCache::Save(void *pointer, size_t blockSize) - \brief Save a block of memory to the memory pool. - - The block of memory will only be added to the pool if the \c blockSize is - equal to the size the object was created with and if the maximum number of - free blocks in the list will not be exceeded. If not, the memory will be - freed. - - Note that it is perfectly valid to pass objects other than those you got from - Get(), but please note that the way it was created conforms to the way memory - is allocated and freed in this pool. Therefore, only feed blocks that were - created with \c new[] if the allocation type is #B_OBJECT_CACHE. Likewise, - you should only use objects allocated with \c malloc() when the allocation - type is #B_MALLOC_CACHE. + \fn void BBlockCache::Save(void *pointer, size_t blockSize) + \brief Save a block of memory to the memory pool. + + The block of memory will only be added to the pool if the \c blockSize is + equal to the size the object was created with and if the maximum number of + free blocks in the list will not be exceeded. If not, the memory will be + freed. + + Note that it is perfectly valid to pass objects other than those you got + from Get(), but please note that the way it was created conforms to the way + memory is allocated and freed in this pool. Therefore, only feed blocks that + were created with \c new[] if the allocation type is #B_OBJECT_CACHE. + Likewise, you should only use objects allocated with \c malloc() when the + allocation type is #B_MALLOC_CACHE. */ Modified: haiku/trunk/docs/user/support/List.dox =================================================================== --- haiku/trunk/docs/user/support/List.dox 2007-08-06 09:09:29 UTC (rev 21832) +++ haiku/trunk/docs/user/support/List.dox 2007-08-06 09:32:27 UTC (rev 21833) @@ -3,375 +3,421 @@ * Distributed under the terms of the MIT License. * * Authors: - * Niels Sascha Reedijk + * Niels Sascha Reedijk, niels.reedijk at gmail.com * * Proofreading: - * David Weizades - * Thom Holwerda - * John Drinkwater + * David Weizades, ddewbofh at hotmail.com + * Thom Holwerda, slakje at quicknet.nl + * John Drinkwater, jdrinkwater at gmail.com * * Corresponds to: * /trunk/headers/os/support/List.h rev 19972 * /trunk/src/kits/support/List.cpp rev 18649 */ + /*! - \file List.h - \brief Defines the BList class. + \file List.h + \brief Defines the BList class. */ + /*! - \class BList - \ingroup support - \ingroup libbe - \brief An ordered container that is designed to hold generic \c void * - objects. + \class BList + \ingroup support + \ingroup libbe + \brief An ordered container that is designed to hold generic \c void * + objects. + + This class is designed to be used for a variety of tasks. Unlike similar + implementations in other libraries, this class is not based on templates + and as such is inherently not typed. So it will be the job of the programmer + to make sure proper data is entered since the compiler cannot check this by + itself. + + BList contains a list of items that will grow and shrink depending on how + many items are in it. So you will not have to do any of the memory + management nor any ordering. These properties makes it useful in a whole + range of situations such as the interface kit within the BListView class. + + A note on the ownership of the objects might come in handy. BList never + assumes ownership of the objects. As such, removing items from the list will + only remove the entries from the list; it will not delete the items + themselves. Similarly, you should also make sure that before you might + delete an object that is in a list, you will have to remove it from the list + first. + + \warning This class is not thread-safe. + + The class implements methods to add, remove, reorder, retrieve, and query + items as well as some advanced methods which let you perform a task on all + the items in the list. +*/ - This class is designed to be used for a variety of tasks. Unlike similar - implementations in other libraries, this class is not based on templates - and as such is inherently not typed. So it will be the job of the programmer - to make sure proper data is entered since the compiler cannot check this by - itself. - BList contains a list of items that will grow and shrink depending on how - many items are in it. So you will not have to do any of the memory management - nor any ordering. These properties makes it useful in a whole range of - situations such as the interface kit within the BListView class. +/*! + \fn BList::BList(int32 count = 20) + \brief Create a new list with a number of empty slots. + + The memory management of this class allocates new memory per block. The + \c count parameter can be tweaked to determine the size of these blocks. + In general, if you know your list is only going to contain a certain number + of items at most, you can pass that value. If you expect your list to have + very few items, it is safe to choose a low number. This is to prevent the + list from taking up unneeded memory. If you expect the list to contain a + large number of items, choose a higher value. Every time the memory is full, + all the items have to be copied into a new piece of allocated memory, which + is an expensive operation. + + If you are unsure, you do not have to worry too much. Just make sure you do + not use a lot of lists, and as long as the list is not used in one of the + performance critical parts of the code, you are safe to go with the default + values. + + \param count The size of the blocks allocated in memory. +*/ - A note on the ownership of the objects might come in handy. BList never - assumes ownership of the objects. As such, removing items from the list will - only remove the entries from the list; it will not delete the items - themselves. Similarly, you should also make sure that before you might delete - an object that is in a list, you will have to remove it from the list first. - \warning This class is not thread-safe. - - The class implements methods to add, remove, reorder, retrieve, and query - items as well as some advanced methods which let you perform a task on all the - items in the list. +/*! + \fn BList::BList(const BList& anotherList) + \brief Copy constructor. Copy a complete list into this one. */ + /*! - \fn BList::BList(int32 count = 20) - \brief Create a new list with a number of empty slots. + \fn BList::~BList() + \brief Destroy the list. + + Please note that as BList does not assume ownership of the objects, + only the list will be freed, not the objects that are held in it. +*/ - The memory management of this class allocates new memory per block. The - \c count parameter can be tweaked to determine the size of these blocks. - In general, if you know your list is only going to contain a certain number of - items at most, you can pass that value. If you expect your list to have very - few items, it is safe to choose a low number. This is to prevent the list from - taking up unneeded memory. If you expect the list to contain a large number - of items, choose a higher value. Every time the memory is full, all the items - have to be copied into a new piece of allocated memory, which is an expensive - operation. - If you are unsure, you do not have to worry too much. Just make sure you do - not use a lot of lists, and as long as the list is not used in one of the - performance critical parts of the code, you are safe to go with the default - values. - - \param count The size of the blocks allocated in memory. +/*! + \fn BList& BList::operator=(const BList &list) + \brief Copy another list into this object. */ + /*! - \fn BList::BList(const BList& anotherList) - \brief Copy constructor. Copy a complete list into this one. + \name Adding and Removing Items */ -/*! - \fn BList::~BList() - \brief Destroy the list. - Please note that as BList does not assume ownership of the objects, - only the list will be freed, not the objects that are held in it. -*/ +//! @{ + /*! - \fn BList& BList::operator=(const BList &list) - \brief Copy another list into this object. + \fn bool BList::AddItem(void *item, int32 index) + \brief Add an item at a certain position. + + \param item The item to add. + \param index The place in the list. + \retval true The item was added. + \retval false Item was not added. Either the index is negative or invalid, + or resizing the list failed. + \see AddItem(void *item) */ + /*! - \name Adding and Removing Items + \fn bool BList::AddItem(void *item) + \brief Append an item to the list. + + \param item The item to add. + \retval true The item was appended. + \retval false Item was not appended, since resizing the list failed. + \see AddItem(void *item, int32 index) */ -//! @{ /*! - \fn bool BList::AddItem(void *item, int32 index) - \brief Add an item at a certain position. - - \param item The item to add. - \param index The place in the list. - \retval true The item was added. - \retval false Item was not added. Either the index is negative or invalid, - or resizing the list failed. - \see AddItem(void *item) + \fn bool BList::AddList(const BList *list, int32 index) + \brief Add items from another list to this list at a certain position. + + Note that the \a list parameter is \c const, so the original list will not + be altered. + + \param list The list to be added. + \param index The position in the current list where the new item(s) should + be put. + \retval true The list was added. + \retval false Failed to insert the list, due to the fact that resizing our + list failed. + \see AddList(const BList *list) */ + /*! - \fn bool BList::AddItem(void *item) - \brief Append an item to the list. - - \param item The item to add. - \retval true The item was appended. - \retval false Item was not appended, since resizing the list failed. - \see AddItem(void *item, int32 index) + \fn bool BList::AddList(const BList *list) + \brief Append a list to this list. + + Note that the \a list parameter is a \c const, so the original list will not + be altered. + + \param list The list to be appended. + \retval true The list was appended. + \retval false Failed to append the list, due to the fact that resizing of + our list failed. + \see AddList(const BList *list, int32 index) */ + /*! - \fn bool BList::AddList(const BList *list, int32 index) - \brief Add items from another list to this list at a certain position. + \fn bool BList::RemoveItem(void *item) + \brief Remove an item from the list. + + \param item The item that should be removed. + \retval true The item was found and removed. + \retval false The item was not in this list and thus not removed. + \see RemoveItem(int32 index) +*/ - Note that the \a list parameter is \c const, so the original list will not be - altered. - \param list The list to be added. - \param index The position in the current list where the new item(s) should be - put. - \retval true The list was added. - \retval false Failed to insert the list, due to the fact that resizing our - list failed. - \see AddList(const BList *list) +/*! + \fn void * BList::RemoveItem(int32 index) + \brief Remove the item at \a index from the list. + + \param index The item that should be removed. + \return The pointer to the item that was removed, or \c NULL in case the + index was invalid. + \see RemoveItem(void *item) */ + /*! - \fn bool BList::AddList(const BList *list) - \brief Append a list to this list. + \fn bool BList::RemoveItems(int32 index, int32 count) + \brief Remove a number of items starting at a certain position. + + If the count parameter is larger than the number of items in the list, + all the items from the offset to the end will be removed. + + \param index The offset in the list where removal should start. + \param count The number of items to remove. + \retval true Removal succeeded. + \retval false Failed to remove the items because the index was invalid. +*/ - Note that the \a list parameter is a \c const, so the original list will not - be altered. - \param list The list to be appended. - \retval true The list was appended. - \retval false Failed to append the list, due to the fact that resizing of our - list failed. - \see AddList(const BList *list, int32 index) +/*! + \fn bool BList::ReplaceItem(int32 index, void *newItem) + \brief Replace an item with another one. + + \param index The offset in the list where to put the item. + \param newItem The new item to put in the list. + \retval true Item replaced. + \retval false The index was invalid. */ -/*! - \fn bool BList::RemoveItem(void *item) - \brief Remove an item from the list. - \param item The item that should be removed. - \retval true The item was found and removed. - \retval false The item was not in this list and thus not removed. - \see RemoveItem(int32 index) -*/ - /*! - \fn void * BList::RemoveItem(int32 index) - \brief Remove the item at \a index from the list. - - \param index The item that should be removed. - \return The pointer to the item that was removed, or \c NULL in case the - index was invalid. - \see RemoveItem(void *item) + \fn void BList::MakeEmpty() + \brief Clear all the items from the list. + + Please note that this does not free the items. */ -/*! - \fn bool BList::RemoveItems(int32 index, int32 count) - \brief Remove a number of items starting at a certain position. - If the count parameter is larger than the number of items in the list, - all the items from the offset to the end will be removed. +//! @} - \param index The offset in the list where removal should start. - \param count The number of items to remove. - \retval true Removal succeeded. - \retval false Failed to remove the items because the index was invalid. -*/ /*! - \fn bool BList::ReplaceItem(int32 index, void *newItem) - \brief Replace an item with another one. - - \param index The offset in the list where to put the item. - \param newItem The new item to put in the list. - \retval true Item replaced. - \retval false The index was invalid. + \name Reordering Items */ -/*! - \fn void BList::MakeEmpty() - \brief Clear all the items from the list. - Please note that this does not free the items. -*/ +//! @{ -//! @} /*! - \name Reordering Items + \fn void BList::SortItems(int (*compareFunc)(const void *, const void *)) + \brief Sort the items with the use of a supplied comparison function. + + The function should take two \c const pointers as arguments and should + return an integer. + + For an example, see the Compare(const BString *, const BString *) function. */ -//! @{ /*! - \fn void BList::SortItems(int (*compareFunc)(const void *, const void *)) - \brief Sort the items with the use of a supplied comparison function. + \fn bool BList::SwapItems(int32 indexA, int32 indexB) + \brief Swap two items. + + \param indexA The first item. + \param indexB The second item. + \retval true Swap succeeded. + \retval false Swap failed because one of the indexes was invalid. +*/ [... truncated: 276 lines follow ...] From stippi at mail.berlios.de Mon Aug 6 11:46:42 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Mon, 6 Aug 2007 11:46:42 +0200 Subject: [Haiku-commits] r21834 - haiku/trunk/src/preferences/network Message-ID: <200708060946.l769kgZw007421@sheep.berlios.de> Author: stippi Date: 2007-08-06 11:46:42 +0200 (Mon, 06 Aug 2007) New Revision: 21834 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21834&view=rev Modified: haiku/trunk/src/preferences/network/EthernetSettings.cpp haiku/trunk/src/preferences/network/EthernetSettingsView.cpp haiku/trunk/src/preferences/network/EthernetSettingsWindow.cpp haiku/trunk/src/preferences/network/EthernetSettingsWindow.h Log: * patch by Andre Garzia to fix some coding style issues * fixed a potential memory leak in EthernetSettingsView::_ShowConfiguration() when the ioctl didn't succeed Modified: haiku/trunk/src/preferences/network/EthernetSettings.cpp =================================================================== --- haiku/trunk/src/preferences/network/EthernetSettings.cpp 2007-08-06 09:32:27 UTC (rev 21833) +++ haiku/trunk/src/preferences/network/EthernetSettings.cpp 2007-08-06 09:46:42 UTC (rev 21834) @@ -21,13 +21,15 @@ { } -void EthernetSettings::ReadyToRun() +void +EthernetSettings::ReadyToRun() { fEthWindow = new EthernetSettingsWindow(); fEthWindow->Show(); } -int main(int argc, char** argv) +int +main(int argc, char** argv) { EthernetSettings app; app.Run(); Modified: haiku/trunk/src/preferences/network/EthernetSettingsView.cpp =================================================================== --- haiku/trunk/src/preferences/network/EthernetSettingsView.cpp 2007-08-06 09:32:27 UTC (rev 21833) +++ haiku/trunk/src/preferences/network/EthernetSettingsView.cpp 2007-08-06 09:46:42 UTC (rev 21834) @@ -50,7 +50,8 @@ -bool EthernetSettingsView::_PrepareRequest(struct ifreq& request, const char* name) +bool +EthernetSettingsView::_PrepareRequest(struct ifreq& request, const char* name) { //This function is used for talking direct to the stack. //It?s used by _ShowConfiguration. @@ -62,7 +63,9 @@ return true; } -void EthernetSettingsView::_GatherInterfaces() { +void +EthernetSettingsView::_GatherInterfaces() +{ // iterate over all interfaces and retrieve minimal status ifconf config; @@ -83,12 +86,13 @@ if (ioctl(fSocket, SIOCGIFCONF, &config, sizeof(struct ifconf)) < 0) return; - ifreq *interface = (ifreq *)buffer; + ifreq* interface = (ifreq *)buffer; fInterfaces.MakeEmpty(); for (uint32 i = 0; i < count; i++) { - if (strncmp(interface->ifr_name, "loop", 4) && interface->ifr_name[0]) { + if (strncmp(interface->ifr_name, "loop", 4) && interface->ifr_name[0]) + { fInterfaces.AddItem(new BString(interface->ifr_name)); } @@ -102,20 +106,23 @@ } -void EthernetSettingsView::AttachedToWindow() +void +EthernetSettingsView::AttachedToWindow() { fOKButton->SetTarget(this); fApplyButton->SetTarget(this); + fDeviceMenuField->Menu()->SetTargetForItems(this); } -void EthernetSettingsView::DetachedFromWindow() +void +EthernetSettingsView::DetachedFromWindow() { - close(fSocket); } -EthernetSettingsView::EthernetSettingsView(BRect rect) : BView(rect, "EthernetSettingsView", B_FOLLOW_ALL, B_WILL_DRAW) +EthernetSettingsView::EthernetSettingsView(BRect rect) +: BView(rect, "EthernetSettingsView", B_FOLLOW_ALL, B_WILL_DRAW) { float defaultWidth = 190; float inset = ceilf(be_plain_font->Size() * 0.8); @@ -135,8 +142,8 @@ info->AddString("interface", name.String()); BMenuItem* item = new BMenuItem(label.String(), info); devmenu->AddItem(item); - item->SetTarget(this); + } @@ -146,50 +153,68 @@ modemenu->AddItem(modeitem); fDeviceMenuField = new BMenuField(frame, "networkcards", "Adapter:", devmenu); - fDeviceMenuField->SetDivider(fDeviceMenuField->StringWidth(fDeviceMenuField->Label()) + 8); + fDeviceMenuField->SetDivider( + fDeviceMenuField->StringWidth(fDeviceMenuField->Label()) + 8); AddChild(fDeviceMenuField); fDeviceMenuField->ResizeToPreferred(); fTypeMenuField = new BMenuField(frame, "type", "Mode:", modemenu); - fTypeMenuField->SetDivider(fTypeMenuField->StringWidth(fTypeMenuField->Label()) + 8); + fTypeMenuField->SetDivider( + fTypeMenuField->StringWidth(fTypeMenuField->Label()) + 8); fTypeMenuField->MoveTo(fDeviceMenuField->Frame().LeftBottom() + BPoint(0,10)); AddChild(fTypeMenuField); fTypeMenuField->ResizeToPreferred(); - fIPTextControl = new BTextControl(frame, "ip", "IP Address:", "", NULL, B_FOLLOW_TOP, B_WILL_DRAW ); - fIPTextControl->SetDivider(fIPTextControl->StringWidth(fIPTextControl->Label()) + 8); + fIPTextControl = new BTextControl(frame, "ip", "IP Address:", "", NULL, + B_FOLLOW_TOP, B_WILL_DRAW ); + fIPTextControl->SetDivider( + fIPTextControl->StringWidth(fIPTextControl->Label()) + 8); fIPTextControl->MoveTo(fTypeMenuField->Frame().LeftBottom() + BPoint(0,10)); fIPTextControl->ResizeToPreferred(); AddChild(fIPTextControl); - fNetMaskTextControl = new BTextControl(frame, "mask", "Netmask:", "", NULL, B_FOLLOW_TOP, B_WILL_DRAW ); - fNetMaskTextControl->SetDivider(fNetMaskTextControl->StringWidth(fNetMaskTextControl->Label()) + 8); - fNetMaskTextControl->MoveTo(fIPTextControl->Frame().LeftBottom() + BPoint(0,10)); + fNetMaskTextControl = new BTextControl(frame, "mask", "Netmask:", "", NULL, + B_FOLLOW_TOP, B_WILL_DRAW ); + fNetMaskTextControl->SetDivider( + fNetMaskTextControl->StringWidth(fNetMaskTextControl->Label()) + 8); + fNetMaskTextControl->MoveTo( + fIPTextControl->Frame().LeftBottom() + BPoint(0,10)); AddChild(fNetMaskTextControl); fNetMaskTextControl->ResizeToPreferred(); - fGatewayTextControl = new BTextControl(frame, "gateway", "Gateway:", "", NULL, B_FOLLOW_TOP, B_WILL_DRAW ); - fGatewayTextControl->SetDivider(fGatewayTextControl->StringWidth(fGatewayTextControl->Label()) + 8); - fGatewayTextControl->MoveTo(fNetMaskTextControl->Frame().LeftBottom() + BPoint(0,10)); + fGatewayTextControl = new BTextControl(frame, "gateway", "Gateway:", "", + NULL, B_FOLLOW_TOP, B_WILL_DRAW ); + fGatewayTextControl->SetDivider( + fGatewayTextControl->StringWidth(fGatewayTextControl->Label()) + 8); + fGatewayTextControl->MoveTo( + fNetMaskTextControl->Frame().LeftBottom() + BPoint(0,10)); AddChild(fGatewayTextControl); fGatewayTextControl->ResizeToPreferred(); - fPrimaryDNSTextControl = new BTextControl(frame, "dns1", "DNS #1:", "", NULL, B_FOLLOW_TOP, B_WILL_DRAW ); - fPrimaryDNSTextControl->SetDivider(fPrimaryDNSTextControl->StringWidth(fPrimaryDNSTextControl->Label()) + 8); - fPrimaryDNSTextControl->MoveTo(fGatewayTextControl->Frame().LeftBottom() + BPoint(0,10)); + fPrimaryDNSTextControl = new BTextControl( + frame, "dns1", "DNS #1:", "", NULL, B_FOLLOW_TOP, B_WILL_DRAW ); + fPrimaryDNSTextControl->SetDivider( + fPrimaryDNSTextControl->StringWidth(fPrimaryDNSTextControl->Label()) + 8); + fPrimaryDNSTextControl->MoveTo( + fGatewayTextControl->Frame().LeftBottom() + BPoint(0,10)); AddChild(fPrimaryDNSTextControl); fPrimaryDNSTextControl->ResizeToPreferred(); - fSecondaryDNSTextControl = new BTextControl(frame, "dns2", "DNS #2:", "", NULL, B_FOLLOW_TOP, B_WILL_DRAW ); - fSecondaryDNSTextControl->SetDivider(fSecondaryDNSTextControl->StringWidth(fSecondaryDNSTextControl->Label()) + 8); - fSecondaryDNSTextControl->MoveTo(fPrimaryDNSTextControl->Frame().LeftBottom() + BPoint(0,10)); + fSecondaryDNSTextControl = new BTextControl( + frame, "dns2", "DNS #2:", "", NULL, B_FOLLOW_TOP, B_WILL_DRAW ); + fSecondaryDNSTextControl->SetDivider( + fSecondaryDNSTextControl->StringWidth( + fSecondaryDNSTextControl->Label()) + 8); + fSecondaryDNSTextControl->MoveTo( + fPrimaryDNSTextControl->Frame().LeftBottom() + BPoint(0,10)); AddChild(fSecondaryDNSTextControl); fSecondaryDNSTextControl->ResizeToPreferred(); fApplyButton = new BButton(frame, "apply", "Apply", new BMessage(kMsgApply)); fApplyButton->ResizeToPreferred(); - fApplyButton->MoveTo(fSecondaryDNSTextControl->Frame().LeftBottom() + BPoint(0,10)); + fApplyButton->MoveTo( + fSecondaryDNSTextControl->Frame().LeftBottom() + BPoint(0,10)); AddChild(fApplyButton); fOKButton = new BButton(frame, "ok", "OK", new BMessage(kMsgOK)); @@ -201,12 +226,14 @@ EthernetSettingsView::~EthernetSettingsView() { + close(fSocket); } -void EthernetSettingsView::_ShowConfiguration(BMessage* message) +void +EthernetSettingsView::_ShowConfiguration(BMessage* message) { - const char *name; + const char* name; if (message->FindString("interface", &name) != B_OK) return; @@ -248,7 +275,7 @@ // Obtain gateway - char *gwAddress; + char* gwAddress; ifconf config; config.ifc_len = sizeof(config.ifc_value); if (ioctl(fSocket, SIOCGRTSIZE, &config, sizeof(struct ifconf)) < 0) @@ -265,8 +292,10 @@ config.ifc_len = size; config.ifc_buf = buffer; - if (ioctl(fSocket, SIOCGRTTABLE, &config, sizeof(struct ifconf)) < 0) + if (ioctl(fSocket, SIOCGRTTABLE, &config, sizeof(struct ifconf)) < 0) { + free(buffer); return; + } ifreq *interface = (ifreq *)buffer; ifreq *end = (ifreq *)((uint8 *)buffer + size); @@ -292,11 +321,12 @@ if (route.gateway != NULL) addressSize += route.gateway->sa_len; - interface = (ifreq *)((addr_t)interface + IF_NAMESIZE + sizeof(route_entry) + addressSize); + interface = (ifreq *)((addr_t)interface + + IF_NAMESIZE + sizeof(route_entry) + addressSize); } - free(buffer); + free(buffer); // Obtain DNS @@ -327,7 +357,8 @@ } -void EthernetSettingsView::MessageReceived(BMessage* message) +void +EthernetSettingsView::MessageReceived(BMessage* message) { switch (message->what) { case kMsgInfo: Modified: haiku/trunk/src/preferences/network/EthernetSettingsWindow.cpp =================================================================== --- haiku/trunk/src/preferences/network/EthernetSettingsWindow.cpp 2007-08-06 09:32:27 UTC (rev 21833) +++ haiku/trunk/src/preferences/network/EthernetSettingsWindow.cpp 2007-08-06 09:46:42 UTC (rev 21834) @@ -15,19 +15,21 @@ #include "EthernetSettingsView.h" -EthernetSettingsWindow::EthernetSettingsWindow() : BWindow(BRect(50, 50, 269, 302), - "Ethernet Settings", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE) +EthernetSettingsWindow::EthernetSettingsWindow() +: BWindow(BRect(50, 50, 269, 302), "Ethernet Settings", +B_TITLED_WINDOW, B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS +| B_NOT_ZOOMABLE) { fEthView = new EthernetSettingsView(Bounds()); AddChild(fEthView); - Show(); } -void EthernetSettingsWindow::MessageReceived(BMessage* message) +void +EthernetSettingsWindow::MessageReceived(BMessage* message) { switch (message->what) { case kMsgInfo: @@ -44,7 +46,8 @@ } -bool EthernetSettingsWindow::QuitRequested() +bool +EthernetSettingsWindow::QuitRequested() { be_app->PostMessage(B_QUIT_REQUESTED); return true; Modified: haiku/trunk/src/preferences/network/EthernetSettingsWindow.h =================================================================== --- haiku/trunk/src/preferences/network/EthernetSettingsWindow.h 2007-08-06 09:32:27 UTC (rev 21833) +++ haiku/trunk/src/preferences/network/EthernetSettingsWindow.h 2007-08-06 09:46:42 UTC (rev 21834) @@ -19,7 +19,7 @@ EthernetSettingsWindow(); virtual ~EthernetSettingsWindow(); virtual bool QuitRequested(); - virtual void EthernetSettingsWindow::MessageReceived(BMessage* mesage); + virtual void MessageReceived(BMessage* mesage); private: EthernetSettingsView *fEthView; From jackburton at mail.berlios.de Mon Aug 6 13:41:19 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Mon, 6 Aug 2007 13:41:19 +0200 Subject: [Haiku-commits] r21835 - haiku/trunk/src/servers/app Message-ID: <200708061141.l76BfJdp005795@sheep.berlios.de> Author: jackburton Date: 2007-08-06 13:41:18 +0200 (Mon, 06 Aug 2007) New Revision: 21835 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21835&view=rev Modified: haiku/trunk/src/servers/app/ServerWindow.cpp Log: Set the origin before playing the picture, so DrawPicture() with an offset works correctly. Drawing a BShape using a BPicture is currently broken. Stephan, any insight on what it's changed about shape drawing ? Modified: haiku/trunk/src/servers/app/ServerWindow.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerWindow.cpp 2007-08-06 09:46:42 UTC (rev 21834) +++ haiku/trunk/src/servers/app/ServerWindow.cpp 2007-08-06 11:41:18 UTC (rev 21835) @@ -2340,9 +2340,7 @@ ServerPicture *picture = App()->FindPicture(token); if (picture != NULL) { - fCurrentLayer->ConvertToScreenForDrawing(&where); - fCurrentLayer->CurrentState()->SetPenLocation(where); - // TODO: pass the location to the play method and handle it there + fCurrentLayer->CurrentState()->SetOrigin(where); picture->Play(fCurrentLayer); } } From axeld at pinc-software.de Mon Aug 6 13:49:57 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Mon, 06 Aug 2007 13:49:57 +0200 Subject: [Haiku-commits] r21830 - haiku/trunk/src/system/kernel/fs In-Reply-To: <20070806030558.2673.4@cs.tu-berlin.de> Message-ID: <1452391661-BeMail@ibm> Ingo Weinhold wrote: > After sleeping over it, I think we need to review this. read - wait - > read > for a single request sounds like we could read non-contiguous data. I'm actually not sure what you mean by that. Non-contiguous in what sense? There is no "message size" mechanism in a pipe, you just get what the other end put in there, and in that order -- at least that's the plan :-) Bye, Axel. From jackburton at mail.berlios.de Mon Aug 6 13:55:30 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Mon, 6 Aug 2007 13:55:30 +0200 Subject: [Haiku-commits] r21836 - haiku/trunk/src/servers/app Message-ID: <200708061155.l76BtUgJ006937@sheep.berlios.de> Author: jackburton Date: 2007-08-06 13:55:29 +0200 (Mon, 06 Aug 2007) New Revision: 21836 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21836&view=rev Modified: haiku/trunk/src/servers/app/ServerWindow.cpp Log: Nevermind Stephan, in the end I found it out. Fixed shape drawing inside a BPicture, though I'm not yet sure if I should do it there on when playing the picture... Modified: haiku/trunk/src/servers/app/ServerWindow.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerWindow.cpp 2007-08-06 11:41:18 UTC (rev 21835) +++ haiku/trunk/src/servers/app/ServerWindow.cpp 2007-08-06 11:55:29 UTC (rev 21836) @@ -2578,7 +2578,16 @@ if (opList != NULL && ptList != NULL && link.Read(opList, opCount * sizeof(uint32)) >= B_OK && link.Read(ptList, ptCount * sizeof(BPoint)) >= B_OK) { - + + // TODO: I'm not sure If I have to do this here (when the BPicture is + // recorded, or inside ServerPicture, when the picture is replayed. + // This might seem a bit weird, but under R5, the shapes + // are always offset by the current pen location + BPoint penLocation = fCurrentLayer->CurrentState()->PenLocation(); + for (int32 i = 0; i < ptCount; i++) { + ptList[i] += penLocation; + fCurrentLayer->ConvertToScreenForDrawing(&ptList[i]); + } const bool fill = (code == AS_FILL_SHAPE); picture->WriteDrawShape(opCount, opList, ptCount, ptList, fill); } From superstippi at gmx.de Mon Aug 6 14:06:47 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Mon, 06 Aug 2007 14:06:47 +0200 Subject: [Haiku-commits] r21836 - haiku/trunk/src/servers/app In-Reply-To: <200708061155.l76BtUgJ006937@sheep.berlios.de> References: <200708061155.l76BtUgJ006937@sheep.berlios.de> Message-ID: <20070806140647.7761.5@stippis2.1186385870.fake> jackburton at BerliOS wrote (2007-08-06, 13:55:30 [+0200]): > Author: jackburton > Date: 2007-08-06 13:55:29 +0200 (Mon, 06 Aug 2007) New Revision: 21836 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21836&view=rev > > Modified: > haiku/trunk/src/servers/app/ServerWindow.cpp > Log: > Nevermind Stephan, in the end I found it out. Fixed shape drawing inside > a BPicture, though I'm not yet sure if I should do it there on when > playing the picture... I would say do the conversion before playing. Otherwise the picture would display at the same position on screen even the view moved, or am I missing something? Best regards, -Stephan From stefano.ceccherini at gmail.com Mon Aug 6 14:08:18 2007 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Mon, 6 Aug 2007 14:08:18 +0200 Subject: [Haiku-commits] r21836 - haiku/trunk/src/servers/app In-Reply-To: <20070806140647.7761.5@stippis2.1186385870.fake> References: <200708061155.l76BtUgJ006937@sheep.berlios.de> <20070806140647.7761.5@stippis2.1186385870.fake> Message-ID: <894b9700708060508o259c2332jb3f2ae10ecef9d77@mail.gmail.com> 2007/8/6, Stephan Assmus : > I would say do the conversion before playing. Otherwise the picture would > display at the same position on screen even the view moved, or am I missing > something? No, that's probably correct. From bonefish at cs.tu-berlin.de Mon Aug 6 15:00:26 2007 From: bonefish at cs.tu-berlin.de (Ingo Weinhold) Date: Mon, 06 Aug 2007 15:00:26 +0200 Subject: [Haiku-commits] r21830 - haiku/trunk/src/system/kernel/fs In-Reply-To: <1452391661-BeMail@ibm> References: <1452391661-BeMail@ibm> Message-ID: <20070806150026.538.1@cs.tu-berlin.de> On 2007-08-06 at 13:49:57 [+0200], Axel D?rfler wrote: > Ingo Weinhold wrote: > > After sleeping over it, I think we need to review this. read - wait - > > read > > for a single request sounds like we could read non-contiguous data. > > I'm actually not sure what you mean by that. Non-contiguous in what > sense? There is no "message size" mechanism in a pipe, you just get > what the other end put in there, and in that order -- at least that's > the plan :-) Yep, but if you read once, then wait, then read again, another reader might have read something while you were waiting. Thus you end up with a buffer that contains two parts of the data stream that might have data missing inbetween. A rather unlikely use of pipes, but anyway... It does also not seem correct, that a reader would block, if it actually already has data. CU, Ingo From nielx at mail.berlios.de Mon Aug 6 16:28:41 2007 From: nielx at mail.berlios.de (nielx at BerliOS) Date: Mon, 6 Aug 2007 16:28:41 +0200 Subject: [Haiku-commits] r21837 - in haiku/trunk/docs/user: . support Message-ID: <200708061428.l76ESfBP021228@sheep.berlios.de> Author: nielx Date: 2007-08-06 16:28:40 +0200 (Mon, 06 Aug 2007) New Revision: 21837 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21837&view=rev Modified: haiku/trunk/docs/user/apidoc.dox haiku/trunk/docs/user/support/Archivable.dox haiku/trunk/docs/user/support/BlockCache.dox haiku/trunk/docs/user/support/List.dox Log: Modified: haiku/trunk/docs/user/apidoc.dox =================================================================== --- haiku/trunk/docs/user/apidoc.dox 2007-08-06 11:55:29 UTC (rev 21836) +++ haiku/trunk/docs/user/apidoc.dox 2007-08-06 14:28:40 UTC (rev 21837) @@ -3,9 +3,9 @@ * Distributed under the terms of the MIT License. * * Authors: - * Niels Sascha Reedijk, niels.reedijk at gmail.com + * Niels Sascha Reedijk, niels.reedijk at gmail.com * Proofreaders: - * Alan Smale, ajsmale at gmail.com + * Alan Smale, ajsmale at gmail.com */ @@ -15,7 +15,10 @@ This article explains how to document the API. Its intended audience are the Haiku developers who want to document their own classes, and also the members of the API Documentation team who want to brush up the - documentation. + documentation. The guidelines are synchronous with the Haiku Coding + Guidelines, which means that the formal requirements are the same where + applicable. If you find an inconsistency, it's usually a good idea to + report this on the documentation team's mailing list. This document is divided into three sections. \ref formalrequirements describes the demands that are made from the markup and spacing of the @@ -83,12 +86,12 @@ * Distributed under the terms of the MIT License. * * Authors: -* Niels Sascha Reedijk, niels.reedijk at gmail.com +* Niels Sascha Reedijk, niels.reedijk at gmail.com * Proofreaders: -* Alan Smale, ajsmale at gmail.com +* Alan Smale, ajsmale at gmail.com * Corresponds to: -* /trunk/headers/os/support/String.h rev 19731 -* /trunk/src/kits/support/String.cpp rev 19731 +* /trunk/headers/os/support/String.h rev 19731 +* /trunk/src/kits/support/String.cpp rev 19731 */ \endverbatim @@ -104,7 +107,7 @@ followed by an empty line. -# Then there is a label Authors:, which is followed by lines with names and email addresses. The latter one is optional, but - recommended. + recommended. Each author is preceeded by two tabs after the asterix. -# In the same vein there is the label Proofreaders: in case the file has been proofread. -# The final part is underneath the label Corresponds to:. Modified: haiku/trunk/docs/user/support/Archivable.dox =================================================================== --- haiku/trunk/docs/user/support/Archivable.dox 2007-08-06 11:55:29 UTC (rev 21836) +++ haiku/trunk/docs/user/support/Archivable.dox 2007-08-06 14:28:40 UTC (rev 21837) @@ -3,15 +3,15 @@ * Distributed under the terms of the MIT License. * * Author: - * Niels Sascha Reedijk, niels.reedijk at gmail.com + * Niels Sascha Reedijk, niels.reedijk at gmail.com * * Proofreader: - * David Weizades, ddewbofh at hotmail.com - * Thom Holwerda, slakje at quicknet.nl + * David Weizades, ddewbofh at hotmail.com + * Thom Holwerda, slakje at quicknet.nl * * Corresponds to: - * /trunk/headers/os/support/Archivable.h rev 19972 - * /trunk/src/kits/support/Archivable.cpp rev 19095 + * /trunk/headers/os/support/Archivable.h rev 19972 + * /trunk/src/kits/support/Archivable.cpp rev 19095 */ Modified: haiku/trunk/docs/user/support/BlockCache.dox =================================================================== --- haiku/trunk/docs/user/support/BlockCache.dox 2007-08-06 11:55:29 UTC (rev 21836) +++ haiku/trunk/docs/user/support/BlockCache.dox 2007-08-06 14:28:40 UTC (rev 21837) @@ -3,15 +3,15 @@ * Distributed under the terms of the MIT License. * * Authors: - * Niels Sascha Reedijk, niels.reedijk at gmail.com + * Niels Sascha Reedijk, niels.reedijk at gmail.com * * Proofreading: - * David Weizades, ddewbofh at hotmail.com - * Thom Holwerda, slakje at quicknet.nl + * David Weizades, ddewbofh at hotmail.com + * Thom Holwerda, slakje at quicknet.nl * * Corresponds to: - * /trunk/headers/os/support/BlockCache.h rev 19972 - * /trunk/src/kits/support/BlockCache.cpp rev 4568 + * /trunk/headers/os/support/BlockCache.h rev 19972 + * /trunk/src/kits/support/BlockCache.cpp rev 4568 */ Modified: haiku/trunk/docs/user/support/List.dox =================================================================== --- haiku/trunk/docs/user/support/List.dox 2007-08-06 11:55:29 UTC (rev 21836) +++ haiku/trunk/docs/user/support/List.dox 2007-08-06 14:28:40 UTC (rev 21837) @@ -3,16 +3,16 @@ * Distributed under the terms of the MIT License. * * Authors: - * Niels Sascha Reedijk, niels.reedijk at gmail.com + * Niels Sascha Reedijk, niels.reedijk at gmail.com * * Proofreading: - * David Weizades, ddewbofh at hotmail.com - * Thom Holwerda, slakje at quicknet.nl - * John Drinkwater, jdrinkwater at gmail.com + * David Weizades, ddewbofh at hotmail.com + * Thom Holwerda, slakje at quicknet.nl + * John Drinkwater, jdrinkwater at gmail.com * * Corresponds to: - * /trunk/headers/os/support/List.h rev 19972 - * /trunk/src/kits/support/List.cpp rev 18649 + * /trunk/headers/os/support/List.h rev 19972 + * /trunk/src/kits/support/List.cpp rev 18649 */ From bonefish at mail.berlios.de Mon Aug 6 19:35:58 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 6 Aug 2007 19:35:58 +0200 Subject: [Haiku-commits] r21838 - haiku/trunk/headers/private/kernel Message-ID: <200708061735.l76HZwrS017548@sheep.berlios.de> Author: bonefish Date: 2007-08-06 19:35:57 +0200 (Mon, 06 Aug 2007) New Revision: 21838 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21838&view=rev Modified: haiku/trunk/headers/private/kernel/debug.h Log: Added debug macros ASSERT_ALWAYS_PRINT and ASSERT_PRINT which take additional parameters that are fed into a dprintf() before panic() is invoked. Modified: haiku/trunk/headers/private/kernel/debug.h =================================================================== --- haiku/trunk/headers/private/kernel/debug.h 2007-08-06 14:28:40 UTC (rev 21837) +++ haiku/trunk/headers/private/kernel/debug.h 2007-08-06 17:35:57 UTC (rev 21838) @@ -24,11 +24,20 @@ #define ASSERT_ALWAYS(x) \ do { if (!(x)) { panic("ASSERT FAILED (%s:%d): %s\n", __FILE__, __LINE__, #x); } } while (0) +#define ASSERT_ALWAYS_PRINT(x, format...) \ + do { \ + if (!(x)) { \ + dprintf(format); \ + panic("ASSERT FAILED (%s:%d): %s\n", __FILE__, __LINE__, #x); \ + } \ + } while (0) + #if KDEBUG -#define ASSERT(x) ASSERT_ALWAYS(x) +# define ASSERT(x) ASSERT_ALWAYS(x) +# define ASSERT_PRINT(x, format...) ASSERT_ALWAYS_PRINT(x, format) #else -#define ASSERT(x) \ - do { } while(0) +# define ASSERT(x) do { } while(0) +# define ASSERT_PRINT(x, format...) do { } while(0) #endif extern int dbg_register_file[B_MAX_CPU_COUNT][14]; From korli at mail.berlios.de Mon Aug 6 19:44:00 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Mon, 6 Aug 2007 19:44:00 +0200 Subject: [Haiku-commits] r21839 - haiku/trunk/src/tests/system/libroot/posix Message-ID: <200708061744.l76Hi0Ak017849@sheep.berlios.de> Author: korli Date: 2007-08-06 19:43:59 +0200 (Mon, 06 Aug 2007) New Revision: 21839 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21839&view=rev Added: haiku/trunk/src/tests/system/libroot/posix/test_confstr.c Log: added a test for confstr() Added: haiku/trunk/src/tests/system/libroot/posix/test_confstr.c =================================================================== --- haiku/trunk/src/tests/system/libroot/posix/test_confstr.c 2007-08-06 17:35:57 UTC (rev 21838) +++ haiku/trunk/src/tests/system/libroot/posix/test_confstr.c 2007-08-06 17:43:59 UTC (rev 21839) @@ -0,0 +1,23 @@ +#include +#include +#include +#include + +size_t confstr(int name, char *buf, size_t len); +char string[512]; + +int main() +{ + int i; + size_t size; + for (i=0; i Message-ID: <23761724712-BeMail@ibm> Ingo Weinhold wrote: > On 2007-08-06 at 13:49:57 [+0200], Axel D?rfler > > wrote: > > I'm actually not sure what you mean by that. Non-contiguous in what > > sense? There is no "message size" mechanism in a pipe, you just get > > what the other end put in there, and in that order -- at least > > that's > > the plan :-) > Yep, but if you read once, then wait, then read again, another reader > might > have read something while you were waiting. Thus you end up with a > buffer > that contains two parts of the data stream that might have data > missing > inbetween. A rather unlikely use of pipes, but anyway... It's not just unlikely, I would also go as far to say that it doesn't make any sense to use them in such a way :-) That doesn't mean I would have a problem in changing that, I just don't see the need. > It does also not > seem correct, that a reader would block, if it actually already has > data. It doesn't really block, it will just try twice, but I agree that this is at least a bit strange :) Bye, Axel. From korli at mail.berlios.de Mon Aug 6 20:03:53 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Mon, 6 Aug 2007 20:03:53 +0200 Subject: [Haiku-commits] r21840 - haiku/trunk/src/system/libroot/posix/unistd Message-ID: <200708061803.l76I3r1w019317@sheep.berlios.de> Author: korli Date: 2007-08-06 20:03:52 +0200 (Mon, 06 Aug 2007) New Revision: 21840 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21840&view=rev Modified: haiku/trunk/src/system/libroot/posix/unistd/conf.c Log: now behaves like the BeOS version Modified: haiku/trunk/src/system/libroot/posix/unistd/conf.c =================================================================== --- haiku/trunk/src/system/libroot/posix/unistd/conf.c 2007-08-06 17:43:59 UTC (rev 21839) +++ haiku/trunk/src/system/libroot/posix/unistd/conf.c 2007-08-06 18:03:52 UTC (rev 21840) @@ -101,11 +101,22 @@ } +#define min_c(a,b) ((a)>(b)?(b):(a)) + size_t confstr(int name, char *buf, size_t len) { - // ToDo: find out what BeOS supports here - errno = EINVAL; - return 0; + size_t string_len = 1; + char *string = ""; + switch (name) { + case 0: + break; + default: + errno = EINVAL; + return 0; + } + if (buf != NULL) + strncpy(buf, string, min_c(len, string_len)); + return string_len; } From bonefish at mail.berlios.de Mon Aug 6 20:06:04 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 6 Aug 2007 20:06:04 +0200 Subject: [Haiku-commits] r21841 - haiku/trunk/src/system/kernel/vm Message-ID: <200708061806.l76I64PA019521@sheep.berlios.de> Author: bonefish Date: 2007-08-06 20:06:01 +0200 (Mon, 06 Aug 2007) New Revision: 21841 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21841&view=rev Modified: haiku/trunk/src/system/kernel/vm/vm.cpp Log: * Changed the signatures of fault_get_page() and fault_find_page(), so that an error can be propagated back to vm_soft_fault(). * Added boolean restart reference parameter to fault_find_page() which is set to true whenever a condition is it encountered that requires to start fault_find_page() from the very beginning. fault_get_page() checks the flag and executes fault_find_page() in a loop, now. * Removed the panic()s+TODOs in fault_find_page() when a cache became busy. The restart feature is used in this case. * fault_find_page(): If after the loop we haven't found a page yet, and after locking the right cache one turned up, we restart the function, too, thus avoiding double insertion of a page into a cache. * Fixed potential dead-lock in fault_get_page(): After inserting a clean page into a cache other than the top cache (read fault on copy-on-write area not backed by a file (e.g. the heap)) the dummy page was removed from the to be locked top cache while we still held a lock for the lower cache, thus inverting the locking direction required by the cache locking policy (top -> bottom). * fault_get_page(): In case of a write access and a readable page found in a lower cache, vm_cache_remove_consumer() could have replaced our dummy page with a real page from a collapsed lower cache while we had unlocked both caches. We didn't check for this condition and always inserted our freshly allocated page, thus potentially inserting a duplicate page into the top cache. We do the check now and discard our page, when another page turned up. Fixes bug #1359. * fault_get_page(), same if block: Removed unused case for removal of the dummy page from a non-top cache. We only ever insert it into the top cache and it should not be moved to another cache. Added an assert. Modified: haiku/trunk/src/system/kernel/vm/vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm.cpp 2007-08-06 18:03:52 UTC (rev 21840) +++ haiku/trunk/src/system/kernel/vm/vm.cpp 2007-08-06 18:06:01 UTC (rev 21841) @@ -3184,10 +3184,12 @@ otherwise, it will return the vm_cache that contains the cache. It always grabs a reference to the vm_cache that it returns, and also locks it. */ -static inline vm_page * +static inline status_t fault_find_page(vm_translation_map *map, vm_cache *topCache, - off_t cacheOffset, bool isWrite, vm_page &dummyPage, vm_cache **_pageCache) + off_t cacheOffset, bool isWrite, vm_page &dummyPage, vm_cache **_pageCache, + vm_page** _page, bool* _restart) { + *_restart = false; vm_cache *cache = topCache; vm_cache *lastCache = NULL; vm_page *page = NULL; @@ -3225,12 +3227,8 @@ // the top cache. mutex_unlock(&cache->lock); vm_cache_release_ref(cache); - - cache = topCache; - lastCache = cache; - - vm_cache_acquire_ref(cache); - mutex_lock(&cache->lock); + *_restart = true; + return B_OK; } } @@ -3274,7 +3272,7 @@ vm_cache_remove_page(cache, page); vm_page_set_state(page, PAGE_STATE_FREE); - return NULL; + return status; } // mark the page unbusy again @@ -3296,10 +3294,17 @@ // with his only consumer (cacheRef); since its pages are moved // upwards, too, we try this cache again mutex_unlock(&cache->lock); + thread_yield(); mutex_lock(&cache->lock); - if (cache->busy) - panic("fault_find_page(): cache became busy: %p\n", cache); - // TODO: Don't panic()! + if (cache->busy) { + // The cache became busy, which means, it is about to be + // removed by vm_cache_remove_consumer(). We start again with + // the top cache. + mutex_unlock(&cache->lock); + vm_cache_release_ref(cache); + *_restart = true; + return B_OK; + } lastCache = NULL; continue; } else if (status < B_OK) @@ -3321,9 +3326,26 @@ // top most cache may have direct write access. vm_cache_acquire_ref(cache); mutex_lock(&cache->lock); - if (cache->busy) - panic("fault_find_page(): 2. cache became busy: %p\n", cache); - // TOOD: Don't panic()! + + if (cache->busy) { + // The cache became busy, which means, it is about to be + // removed by vm_cache_remove_consumer(). We start again with + // the top cache. + mutex_unlock(&cache->lock); + vm_cache_release_ref(cache); + *_restart = true; + } else { + vm_page* newPage = vm_cache_lookup_page(cache, cacheOffset); + if (newPage && newPage != &dummyPage) { + // A new page turned up. It could be the one we're looking + // for, but it could as well be a dummy page from someone + // else or an otherwise busy page. We can't really handle + // that here. Hence we completely restart this functions. + mutex_unlock(&cache->lock); + vm_cache_release_ref(cache); + *_restart = true; + } + } } // release the reference of the last vm_cache we still have from the loop above @@ -3334,7 +3356,8 @@ } *_pageCache = cache; - return page; + *_page = page; + return B_OK; } @@ -3343,14 +3366,35 @@ It returns the owner of the page in \a sourceCache - it keeps a reference to it, and has also locked it on exit. */ -static inline vm_page * +static inline status_t fault_get_page(vm_translation_map *map, vm_cache *topCache, off_t cacheOffset, bool isWrite, vm_page &dummyPage, vm_cache **_sourceCache, - vm_cache **_copiedSource) + vm_cache **_copiedSource, vm_page** _page) { vm_cache *cache; - vm_page *page = fault_find_page(map, topCache, cacheOffset, isWrite, - dummyPage, &cache); + vm_page *page; + bool restart; + for (;;) { + status_t status = fault_find_page(map, topCache, cacheOffset, isWrite, + dummyPage, &cache, &page, &restart); + if (status != B_OK) + return status; + + if (!restart) + break; + + // Remove the dummy page, if it has been inserted. + mutex_lock(&topCache->lock); + + if (dummyPage.state == PAGE_STATE_BUSY) { + ASSERT_PRINT(dummyPage.cache == topCache, "dummy page: %p\n", + &dummyPage); + fault_remove_dummy_page(dummyPage, true); + } + + mutex_unlock(&topCache->lock); + } + if (page == NULL) { // we still haven't found a page, so we allocate a clean one @@ -3359,7 +3403,8 @@ // Insert the new page into our cache, and replace it with the dummy page if necessary - // if we inserted a dummy page into this cache, we have to remove it now + // If we inserted a dummy page into this cache (i.e. if it is the top + // cache), we have to remove it now if (dummyPage.state == PAGE_STATE_BUSY && dummyPage.cache == cache) { #ifdef DEBUG_PAGE_CACHE_TRANSITIONS page->debug_flags = dummyPage.debug_flags | 0x8; @@ -3383,8 +3428,12 @@ } #endif // DEBUG_PAGE_CACHE_TRANSITIONS - // we had inserted the dummy cache in another cache, so let's remove it from there + // This is not the top cache into which we inserted the dummy page, + // let's remove it from there. We need to temporarily unlock our + // cache to comply with the cache locking policy. + mutex_unlock(&cache->lock); fault_remove_dummy_page(dummyPage, false); + mutex_lock(&cache->lock); } } @@ -3392,8 +3441,11 @@ // sure that the area's cache can access it, too, and sees the correct data if (page->cache != topCache && isWrite) { - // now we have a page that has the data we want, but in the wrong cache object - // so we need to copy it and stick it into the top cache + // Now we have a page that has the data we want, but in the wrong cache + // object so we need to copy it and stick it into the top cache. + // Note that this and the "if" before are mutual exclusive. If + // fault_find_page() didn't find the page, it would return the top cache + // for write faults. vm_page *sourcePage = page; void *source, *dest; @@ -3431,17 +3483,41 @@ mutex_unlock(&cache->lock); mutex_lock(&topCache->lock); - // Insert the new page into our cache, and replace it with the dummy page if necessary + // Since the top cache has been unlocked for a while, someone else + // (vm_cache_remove_consumer()) might have replaced our dummy page. + vm_page* newPage = NULL; + for (;;) { + newPage = vm_cache_lookup_page(topCache, cacheOffset); + if (newPage == NULL || newPage == &dummyPage) { + newPage = NULL; + break; + } - // if we inserted a dummy page into this cache, we have to remove it now - if (dummyPage.state == PAGE_STATE_BUSY && dummyPage.cache == topCache) - fault_remove_dummy_page(dummyPage, true); + if (newPage->state != PAGE_STATE_BUSY) + break; - vm_cache_insert_page(topCache, page, cacheOffset); + // The page is busy, wait till it becomes unbusy. + mutex_unlock(&topCache->lock); + snooze(10000); + mutex_lock(&topCache->lock); + } - if (dummyPage.state == PAGE_STATE_BUSY) { - // we had inserted the dummy cache in another cache, so let's remove it from there - fault_remove_dummy_page(dummyPage, false); + if (newPage) { + // Indeed someone else threw in a page. We free ours and are happy. + vm_page_set_state(page, PAGE_STATE_FREE); + page = newPage; + } else { + // Insert the new page into our cache and remove the dummy page, if + // necessary. + + // if we inserted a dummy page into this cache, we have to remove it now + if (dummyPage.state == PAGE_STATE_BUSY) { + ASSERT_PRINT(dummyPage.cache == topCache, "dummy page: %p\n", + &dummyPage); + fault_remove_dummy_page(dummyPage, true); + } + + vm_cache_insert_page(topCache, page, cacheOffset); } *_copiedSource = cache; @@ -3451,7 +3527,8 @@ } *_sourceCache = cache; - return page; + *_page = page; + return B_OK; } @@ -3562,13 +3639,12 @@ vm_cache *copiedPageSource = NULL; vm_cache *pageSource; - vm_page *page = fault_get_page(map, topCache, cacheOffset, isWrite, - dummyPage, &pageSource, &copiedPageSource); + vm_page *page; + status_t status = fault_get_page(map, topCache, cacheOffset, isWrite, + dummyPage, &pageSource, &copiedPageSource, &page); - status_t status = B_OK; - acquire_sem_etc(addressSpace->sem, READ_COUNT, 0, 0); - if (changeCount != addressSpace->change_count) { + if (status == B_OK && changeCount != addressSpace->change_count) { // something may have changed, see if the address is still valid area = vm_area_lookup(addressSpace, address); if (area == NULL From stippi at mail.berlios.de Mon Aug 6 20:49:11 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Mon, 6 Aug 2007 20:49:11 +0200 Subject: [Haiku-commits] r21842 - haiku/trunk/src/servers/app Message-ID: <200708061849.l76InBXN023965@sheep.berlios.de> Author: stippi Date: 2007-08-06 20:49:11 +0200 (Mon, 06 Aug 2007) New Revision: 21842 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21842&view=rev Modified: haiku/trunk/src/servers/app/ServerWindow.cpp Log: * small cleanup Modified: haiku/trunk/src/servers/app/ServerWindow.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerWindow.cpp 2007-08-06 18:06:01 UTC (rev 21841) +++ haiku/trunk/src/servers/app/ServerWindow.cpp 2007-08-06 18:49:11 UTC (rev 21842) @@ -2080,12 +2080,8 @@ { DTRACE(("ServerWindow %s: Message AS_STROKE_RECT\n", Title())); - float left, top, right, bottom; - link.Read(&left); - link.Read(&top); - link.Read(&right); - link.Read(&bottom); - BRect rect(left,top,right,bottom); + BRect rect; + link.Read(&rect); fCurrentLayer->ConvertToScreenForDrawing(&rect); drawingEngine->StrokeRect(rect); From stippi at mail.berlios.de Mon Aug 6 20:50:44 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Mon, 6 Aug 2007 20:50:44 +0200 Subject: [Haiku-commits] r21843 - haiku/trunk/src/servers/app/drawing Message-ID: <200708061850.l76Ioi35024100@sheep.berlios.de> Author: stippi Date: 2007-08-06 20:50:44 +0200 (Mon, 06 Aug 2007) New Revision: 21843 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21843&view=rev Modified: haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp Log: * in FillRegion(), check if the current drawing mode is B_OP_INVERT, and then use hardware acceleration... found out this is what our BTextView is actually using, that's why it never used hardware acceleration for invert rect/region before. Have not tested this on real hardware yet. Modified: haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp 2007-08-06 18:49:11 UTC (rev 21842) +++ haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp 2007-08-06 18:50:44 UTC (rev 21843) @@ -853,6 +853,11 @@ fSuspendSyncLevel == 0 || cursorTouched); doInSoftware = false; + } else if (fAvailableHWAccleration & HW_ACC_INVERT_REGION + && fPainter->Pattern() == B_SOLID_HIGH + && fPainter->DrawingMode() == B_OP_INVERT) { + r.IntersectWith(fPainter->ClippingRegion()); + fGraphicsCard->InvertRegion(r); } } From stippi at mail.berlios.de Mon Aug 6 20:54:20 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Mon, 6 Aug 2007 20:54:20 +0200 Subject: [Haiku-commits] r21844 - haiku/trunk/data/artwork Message-ID: <200708061854.l76IsK00024316@sheep.berlios.de> Author: stippi Date: 2007-08-06 20:54:20 +0200 (Mon, 06 Aug 2007) New Revision: 21844 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21844&view=rev Added: haiku/trunk/data/artwork/HAIKU logo - black.svg haiku/trunk/data/artwork/HAIKU logo - white.svg Log: * added the Haiku logo with white and black letters as SVG. This does not have the nice drop shadows, so it's only meant to be helpful to reproduce the logo in other graphics packages, but it's not the real logo! Added: haiku/trunk/data/artwork/HAIKU logo - black.svg =================================================================== --- haiku/trunk/data/artwork/HAIKU logo - black.svg 2007-08-06 18:50:44 UTC (rev 21843) +++ haiku/trunk/data/artwork/HAIKU logo - black.svg 2007-08-06 18:54:20 UTC (rev 21844) @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Added: haiku/trunk/data/artwork/HAIKU logo - white.svg =================================================================== --- haiku/trunk/data/artwork/HAIKU logo - white.svg 2007-08-06 18:50:44 UTC (rev 21843) +++ haiku/trunk/data/artwork/HAIKU logo - white.svg 2007-08-06 18:54:20 UTC (rev 21844) @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From korli at mail.berlios.de Tue Aug 7 01:29:55 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Tue, 7 Aug 2007 01:29:55 +0200 Subject: [Haiku-commits] r21845 - haiku/trunk/src/preferences/devices Message-ID: <200708062329.l76NTtt9025872@sheep.berlios.de> Author: korli Date: 2007-08-07 01:29:54 +0200 (Tue, 07 Aug 2007) New Revision: 21845 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21845&view=rev Modified: haiku/trunk/src/preferences/devices/usbdevs Log: usb devices and vendors list from NetBSD version 1.480 Modified: haiku/trunk/src/preferences/devices/usbdevs =================================================================== --- haiku/trunk/src/preferences/devices/usbdevs 2007-08-06 18:54:20 UTC (rev 21844) +++ haiku/trunk/src/preferences/devices/usbdevs 2007-08-06 23:29:54 UTC (rev 21845) @@ -1,4 +1,4 @@ -$NetBSD: usbdevs,v 1.441 2006/10/11 13:02:58 gdt Exp $ +$NetBSD: usbdevs,v 1.480 2007/07/16 07:05:27 nisimura Exp $ /* * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. @@ -93,6 +93,7 @@ vendor DIAMOND2 0x045a Diamond (Supra) vendor MICROSOFT 0x045e Microsoft vendor PRIMAX 0x0461 Primax Electronics +vendor MGE 0x0463 MGE UPS Systems vendor AMP 0x0464 AMP vendor CHERRY 0x046a Cherry Mikroschalter vendor MEGATRENDS 0x046b American Megatrends @@ -134,9 +135,9 @@ vendor SCANLOGIC 0x04ce ScanLogic vendor MYSON 0x04cf Myson Technology vendor DIGI2 0x04d0 Digi -vendor HOLTEK 0x04d9 Holtek Semiconductor vendor ITTCANON 0x04d1 ITT Canon vendor ALTEC 0x04d2 Altec Lansing +vendor HOLTEK 0x04d9 Holtek Semiconductor vendor PANASONIC 0x04da Panasonic (Matsushita) vendor SHARP 0x04dd Sharp vendor IIYAMA 0x04e1 Iiyama @@ -195,6 +196,7 @@ vendor INSYSTEM 0x05ab In-System Design vendor APPLE 0x05ac Apple Computer vendor DIGI 0x05c5 Digi International +vendor QUALCOMM2 0x05c6 Qualcomm vendor QTRONIX 0x05c7 Qtronix vendor ELSA 0x05cc ELSA vendor BRAINBOXES 0x05d1 Brainboxes Limited @@ -221,17 +223,17 @@ vendor MACALLY 0x0618 Macally vendor ACTLABS 0x061c Act Labs vendor ALARIS 0x0620 Alaris +vendor APEX 0x0624 Apex vendor CREATIVE3 0x062a Creative Labs -vendor APEX 0x0624 Apex vendor VIVITAR 0x0636 Vivitar vendor AVISION 0x0638 Avision vendor TEAC 0x0644 TEAC -vendor ARKMICROCHIPS 0x6547 ArkMicroChips vendor SGI 0x065e Silicon Graphics vendor SANWASUPPLY 0x0663 Sanwa Supply vendor LINKSYS 0x066b Linksys vendor ACERSA 0x066e Acer Semiconductor America vendor SIGMATEL 0x066f Sigmatel +vendor DRAYTEK 0x0675 DrayTek vendor AIWA 0x0677 Aiwa vendor ACARD 0x0678 ACARD Technology vendor PROLIFIC 0x067b Prolific Technology @@ -274,6 +276,7 @@ vendor BRIMAX 0x078e Brimax vendor AXIS 0x0792 Axis Communications vendor ABL 0x0794 ABL Electronics +vendor SAGEM 0x079b Sagem vendor SUNCOMM 0x079c Sun Communications, Inc. vendor ALFADATA 0x079d Alfadata Computer vendor NATIONALTECH 0x07a2 National Technical Systems @@ -363,13 +366,14 @@ vendor TREK 0x0a16 Trek Technology vendor ASAHIOPTICAL 0x0a17 Asahi Optical vendor BOCASYSTEMS 0x0a43 Boca Systems +vendor SHANTOU 0x0a46 ShanTou vendor MEDIAGEAR 0x0a48 MediaGear vendor BROADCOM 0x0a5c Broadcom vendor GREENHOUSE 0x0a6b GREENHOUSE vendor GEOCAST 0x0a79 Geocast Network Systems vendor ZYDAS 0x0ace Zydas Technology Corporation vendor NEODIO 0x0aec Neodio -vendor VODAFONE 0x0af0 Vodafone +vendor OPTIONNV 0x0af0 Option N.V: vendor ASUSTEK 0x0b05 ASUSTeK Computer vendor TODOS 0x0b0c Todos Data System vendor SIIG2 0x0b39 SIIG @@ -381,7 +385,9 @@ vendor ZEEVO 0x0b7a Zeevo, Inc. vendor KURUSUGAWA 0x0b7e Kurusugawa Electronics, Inc. vendor ASIX 0x0b95 ASIX Electronics +vendor O2MICRO 0x0b97 O2 Micro vendor USR 0x0baf U.S. Robotics +vendor AMBIT 0x0bb2 Ambit Microsystems vendor REALTEK 0x0bda Realtek vendor ADDONICS2 0x0bf6 Addonics Technology vendor AGATE 0x0c08 Agate Technologies @@ -389,50 +395,70 @@ vendor CHICONY2 0x0c45 Chicony Electronics vendor SEALEVEL 0x0c52 Sealevel System vendor LUWEN 0x0c76 EasyDisk +vendor QUALCOMM_K 0x0c88 Qualcomm Kyocera vendor ZCOM 0x0cde Z-Com -vendor QUALCOMM_K 0x0c88 Qualcomm Kyocera vendor TANGTOP 0x0d3d Tangtop vendor SMC3 0x0d5c Standard Microsystems vendor PEN 0x0d7d Pen Drive vendor ACDC 0x0d7e American Computer & Digital Components vendor CMEDIA 0x0d8c C-Media Electronics Inc. vendor MSI 0x0db0 Micro Star +vendor ELCON 0x0db7 ELCON Systemtechnik vendor SITECOMEU 0x0df6 Sitecom Europe vendor HAWKING 0x0e66 Hawking +vendor GMATE 0x0e7e G.Mate, Inc vendor OTI 0x0ea0 Ours Technology vendor PILOTECH 0x0eaf Pilotech +vendor NOVATECH 0x0eb0 Nova Tech vendor EGALAX 0x0eef eGalax +vendor TOD 0x0ede TOD vendor AIRPRIME 0x0f3d AirPrime, Incorporated vendor VTECH 0x0f88 VTech vendor FALCOM 0x0f94 Falcom Wireless Communications GmbH +vendor RIM 0x0fca Research In Motion +vendor DYNASTREAM 0x0fcf Dynastream Innovations vendor QUALCOMM 0x1004 Qualcomm vendor GIGABYTE 0x1044 GIGABYTE vendor MOTOROLA 0x1063 Motorola vendor CCYU 0x1065 CCYU Technology +vendor SILABS2 0x10a6 SILABS2 +vendor USI 0x10ab USI vendor PLX 0x10b5 PLX vendor ASANTE 0x10bd Asante +vendor SILABS 0x10c4 Silicon Labs vendor JRC 0x1145 Japan Radio Company +vendor SPHAIRON 0x114b Sphairon Access Systems GmbH +vendor DELORME 0x1163 DeLorme vendor SERVERWORKS 0x1166 ServerWorks -vendor DELORME 0x1163 DeLorme vendor ACERCM 0x1189 Acer Communications & Multimedia vendor SIERRA 0x1199 Sierra Wireless vendor TOPFIELD 0x11db Topfield Co., Ltd +vendor NETINDEX 0x11f6 NetIndex vendor TSUNAMI 0x1241 Tsunami vendor TARGUS 0x1267 Targus +vendor TWINMOS 0x126f TwinMOS vendor CREATIVE2 0x1292 Creative Labs vendor BELKIN2 0x1293 Belkin Components +vendor CYBERTAN 0x129b CyberTAN Technology +vendor HUAWEI 0x12d1 Huawei Technologies vendor AINCOMM 0x12fd Aincomm vendor MOBILITY 0x1342 Mobility vendor DICKSMITH 0x1371 Dick Smith Electronics +vendor BALTECH 0x13ad Baltech vendor CISCOLINKSYS 0x13b1 Cisco-Linksys vendor SHARK 0x13d2 Shark -vendor HUAWEI3COM 0x1472 Huawei 3Com +vendor NOVATEL2 0x1410 Novatel +vendor WISTRONNEWEB 0x1435 Wistron NeWeb +vendor HUAWEI3COM 0x1472 Huawei-3Com vendor SILICOM 0x1485 Silicom vendor RALINK 0x1485 Ralink Technology vendor RALINK_2 0x148f Ralink Technology vendor CONCEPTRONIC 0x14b2 Conceptronic +vendor PLANEX3 0x14ea Planex Communications vendor SILICONPORTALS 0x1527 Silicon Portals vendor OQO 0x1557 OQO +vendor UMEDIA 0x157e U-MEDIA Communications +vendor FIBERLINE 0x1582 Fiberline vendor SOHOWARE 0x15e8 SOHOware vendor UMAX 0x1606 UMAX Data Systems vendor INSIDEOUT 0x1608 Inside Out Networks @@ -440,6 +466,11 @@ vendor ENTREGA 0x1645 Entrega vendor ACTIONTEC 0x1668 Actiontec Electronics vendor GIGASET 0x1690 Gigaset +vendor ANYDATA 0x16d5 AnyDATA Inc. +vendor JABLOTRON 0x16d6 Jablotron +vendor LINKSYS4 0x1737 Linksys +vendor SENAO 0x1740 Senao +vendor AMIT 0x18c5 AMIT vendor QCOM 0x18e8 Qcom vendor LINKSYS3 0x1915 Linksys vendor DLINK 0x2001 D-Link @@ -452,18 +483,21 @@ vendor PLANEX 0x2c02 Planex Communications vendor VIDZMEDIA 0x3275 VidzMedia Pte Ltd vendor AEI 0x3334 AEI +vendor HANK 0x3353 Hank Connection vendor PQI 0x3538 PQI vendor DAISY 0x3579 Daisy Technology vendor NI 0x3923 National Instruments -vendor HANK 0x3353 Hank Connection vendor MICRONET 0x3980 Micronet Communications vendor IODATA2 0x40bb I-O Data vendor IRIVER 0x4102 iRiver vendor DELL 0x413c Dell vendor AVERATEC 0x50c2 Averatec +vendor SWEEX 0x5173 Sweex vendor ONSPEC2 0x55aa OnSpec Electronic Inc. vendor ZINWELL 0x5a57 Zinwell vendor SITECOM 0x6189 Sitecom +vendor ARKMICROCHIPS 0x6547 ArkMicroChips +vendor 3COM2 0x6891 3Com vendor INTEL 0x8086 Intel vendor MOSCHIP 0x9710 MosChip Semiconductor vendor HP2 0xf003 Hewlett Packard @@ -480,6 +514,7 @@ product 3COM USR56K 0x3021 U.S.Robotics 56000 Voice Faxmodem Pro product 3COM 3C460 0x11f8 HomeConnect 3C460 product 3COM 3C460B 0x4601 HomeConnect 3C460B +product 3COM2 3CRUSB10075 0xa727 3CRUSB10075 product 3COMUSR OFFICECONN 0x0082 3Com OfficeConnect Analog Modem product 3COMUSR USRISDN 0x008f 3Com U.S. Robotics Pro ISDN TA @@ -488,8 +523,8 @@ /* ACDC products */ product ACDC HUB 0x2315 USB Pen Drive HUB +product ACDC SECWRITE 0x2316 USB Pen Drive Secure Write product ACDC PEN 0x2317 USB Pen Drive with Secure Write -product ACDC SECWRITE 0x2316 USB Pen Drive Secure Write /* AboCom products */ product ABOCOM XX1 0x110c XX1 @@ -505,14 +540,27 @@ product ABOCOM XX8 0x4102 XX8 product ABOCOM XX9 0x4104 XX9 product ABOCOM UFE2000 0x420a UFE2000 USB2.0 Fast Ethernet Adapter +product ABOCOM WL54 0x6001 WL54 product ABOCOM XX10 0xabc1 XX10 -product ABOCOM RT2573 0xb21d RT2573 +product ABOCOM HWU54DM 0xb21b HWU54DM +product ABOCOM RT2573_2 0xb21c RT2573 +product ABOCOM RT2573_3 0xb21d RT2573 +product ABOCOM RT2573_4 0xb21e RT2573 +product ABOCOM WUG2700 0xb21f WUG2700 /* Accton products */ product ACCTON USB320_EC 0x1046 USB320-EC Ethernet Adapter product ACCTON 111 0x3503 T-Sinus 111 WLAN +product ACCTON SMCWUSBG 0x4505 SMCWUSB-G product ACCTON SS1001 0x5046 SpeedStream Ethernet Adapter +product ACCTON ZD1211B 0xe501 ZD1211B +/* Acer Communications & Multimedia products */ +product ACERCM EP1427X2 0x0893 EP-1427X-2 Ethernet + +/* Acer Labs products */ +product ACERLABS M5632 0x5632 USB 2.0 Data Link + /* Acer Peripherals, Inc. products */ product ACERP ACERSCAN_C310U 0x12a6 Acerscan C310U product ACERP ACERSCAN_320U 0x2022 Acerscan 320U @@ -545,6 +593,7 @@ product ADDONICS2 205 0xa001 Cable 205 /* ADMtek products */ +product ADMTEK PEGASUSII_4 0x07c2 AN986A Ethernet product ADMTEK PEGASUS 0x0986 AN986 USB Ethernet product ADMTEK PEGASUSII 0x8511 AN8511 USB Ethernet product ADMTEK PEGASUSII_2 0x8513 AN8513 Ethernet @@ -572,14 +621,14 @@ product AGFA SNAPSCANE26 0x2097 SnapScan e26 product AGFA SNAPSCANE52 0x20fd SnapScan e52 -/* AirPrime products */ -product AIRPRIME PC5220 0x0112 CDMA Wireless PC Card +/* Aincomm products */ +product AINCOMM AWU2000B 0x1001 AWU2000B /* AIPTEK International products */ product AIPTEK2 PENCAM_MEGA_1_3 0x504a PenCam Mega 1.3 -/* Aincomm products */ -product AINCOMM AWU2000B 0x1001 AWU2000B +/* AirPrime products */ +product AIRPRIME PC5220 0x0112 CDMA Wireless PC Card /* AKS products */ product AKS USBHASP 0x0001 USB-HASP 0.06 @@ -597,12 +646,21 @@ product ALTEC ASC495 0xff05 ASC495 Speakers /* American Power Conversion products */ -product APC UPSPRO500 0x0002 Back-UPS Pro 500 +product APC UPS 0x0002 Uninterruptible Power Supply +/* Ambit Microsystems products */ +product AMBIT NTL_250 0x6098 NTL 250 cable modem + +/* AMIT products */ +product AMIT CGWLUSB2GO 0x0002 CG-WLUSB2GO + /* Anchor products */ product ANCHOR EZUSB 0x2131 EZUSB product ANCHOR EZLINK 0x2720 EZLINK +/* AnyDATA Inc. products */ +product ANYDATA ADU_E100H 0x6501 ADU-E100H + /* AOX, Inc. products */ product AOX USB101 0x0008 USB ethernet controller engine @@ -613,6 +671,9 @@ product APPLE EXT_KBD_HUB 0x1003 Hub in Apple Extended USB Keyboard product APPLE SPEAKERS 0x1101 Speakers +/* ArkMicroChips products */ +product ARKMICROCHIPS USBSERIAL 0x0232 USB-UART Controller + /* Asahi Optical products */ product ASAHIOPTICAL OPTIO230 0x0004 PENTAX Optio230 product ASAHIOPTICAL OPTIO330 0x0006 Digital camera @@ -621,15 +682,23 @@ product ASANTE EA 0x1427 Ethernet Adapter /* ASIX Electronics products */ -product ASIX AX88172 0x1720 USB 2.0 10/100 ethernet controller +product ASIX AX88172 0x1720 AX88172 USB 2.0 10/100 Ethernet adapter +product ASIX AX88178 0x1780 AX88178 USB 2.0 10/100 Ethernet adapter +product ASIX AX88772 0x7720 AX88772 USB 2.0 10/100 Ethernet adapter /* ASUSTeK computer products */ product ASUSTEK WL167G 0x1707 WL-167g USB2.0 WLAN Adapter +product ASUSTEK WL159G 0x170c WL-159g +product ASUSTEK A9T_WIFI 0x171b A9T wireless +product ASUSTEK WL167G_2 0x1723 WL-167g USB2.0 WLAN Adapter (version 2) +product ASUSTEK WL167G_3 0x1724 WL-167g USB2.0 WLAN Adapter (version 2) +product ASUSTEK MYPAL_A730 0x4202 MyPal A730 /* ATen products */ product ATEN UC1284 0x2001 Parallel printer adapter product ATEN UC10T 0x2002 10Mbps ethernet adapter product ATEN UC232A 0x2008 Serial adapter +product ATEN UC210T 0x2009 UC210T Ethernet adapter product ATEN DSB650C 0x4000 DSB-650C /* ATI products */ @@ -639,11 +708,10 @@ product ATMEL UHB124 0x3301 UHB124 hub product ATMEL DWL900AP 0x5601 DWL-900AP Wireless access point product ATMEL DWL120 0x7602 DWL-120 Wireless adapter +product ATMEL AT76C503A 0x7603 AT76C503A product ATMEL BW002 0x7605 BW002 Wireless adapter -product ATMEL BW002 0x7605 BW002 product ATMEL WL1130 0x7613 WL-1130 product ATMEL AT76C505A 0x7614 AT76C505A -product ATMEL AT76C503A 0x7603 AT76C503A /* Audio-Technica products */ product AUDIOTECHNICA ATCHA4USB 0x0009 ATC-HA4USB USB headphone @@ -657,6 +725,9 @@ /* Avision products */ product AVISION 1200U 0x0268 1200U scanner +/* Baltech products */ +product BALTECH CARDREADER 0x9999 Card reader + /* B&B Electronics products */ product BBELECTRONICS USOTL4 0xAC01 uLinks RS-422/485 @@ -666,15 +737,19 @@ product BELKIN F5D6050 0x0050 F5D6050 802.11b Wireless adapter product BELKIN F5U103 0x0103 F5U103 Serial adapter product BELKIN F5U109 0x0109 F5U109 Serial adapter -product BELKIN F5U409 0x0409 F5U409 Serial product BELKIN SCSI 0x0115 SCSI Adaptor product BELKIN USB2LAN 0x0121 USB to LAN Converter product BELKIN F5U208 0x0208 F5U208 VideoBus II product BELKIN F5U237 0x0237 F5U237 USB 2.0 7-Port Hub +product BELKIN F5U409 0x0409 F5U409 Serial product BELKIN UPS 0x0980 UPS product BELKIN F5U120 0x1203 F5U120-PC Hub +product BELKIN ZD1211B 0x4050 ZD1211B +product BELKIN F5D5055 0x5055 F5D5055 Ethernet adapter product BELKIN F5D7050 0x7050 F5D7050 54g USB Network Adapter +product BELKIN F5D7051 0x7051 F5D7051 54g USB Network Adapter product BELKIN F5D7050A 0x705a F5D705A 54g USB Network Adapter +product BELKIN F5D7050C 0x705c F5D705C 54g USB Network Adapter product BELKIN F5D9050V3 0x905b F5D9050 ver 3 /* Billionton products */ @@ -682,6 +757,7 @@ product BILLIONTON USBLP100 0x0987 USB100LP product BILLIONTON USBEL100 0x0988 USB100EL product BILLIONTON USBE100 0x8511 USBE100 +product BILLIONTON USB2AR 0x90ff USB2AR Ethernet /* Broadcom products */ product BROADCOM BCM2033 0x2000 BCM2033 @@ -706,18 +782,19 @@ product CANON A20 0x304e PowerShot A20 product CANON S200 0x3065 PowerShot S200 product CANON EOS300D 0x3084 EOS 300D / Digital Rebel +product CANON SD630 0x30fe PowerShot SD630 +/* CASIO products */ +product CASIO QV 0x1001 QV DigitalCamera +product CASIO BE300 0x2002 BE-300 PDA +product CASIO NAMELAND 0x4001 CASIO Nameland EZ-USB + /* CATC products */ product CATC NETMATE 0x000a Netmate ethernet adapter product CATC NETMATE2 0x000c Netmate2 ethernet adapter product CATC CHIEF 0x000d USB Chief Bus & Protocol Analyzer product CATC ANDROMEDA 0x1237 Andromeda hub -/* CASIO products */ -product CASIO QV 0x1001 QV DigitalCamera -product CASIO BE300 0x2002 BE-300 PDA -product CASIO NAMELAND 0x4001 CASIO Nameland EZ-USB - /* CCYU Technology products */ product CCYU EASYDISK 0x2136 EasyDisk Portable Device @@ -741,7 +818,13 @@ product CHPRODUCTS FLIGHTYOKE 0x00ff Flight Sim Yoke /* Cisco-Linksys products */ +product CISCOLINKSYS WUSB54G 0x000d WUSB54G Wireless-G USB Network Adapter +product CISCOLINKSYS WUSB54GP 0x0011 WUSB54GP Wireless-G USB Network Adapter +product CISCOLINKSYS USB200MV2 0x0018 USB200M v2 +product CISCOLINKSYS HU200TS 0x001a HU200-TS product CISCOLINKSYS WUSB54GC 0x0020 WUSB54GC +product CISCOLINKSYS WUSB54GR 0x0023 WUSB54GR +product CISCOLINKSYS WUSBF54G 0x0024 WUSBF54G /* Compaq products */ product COMPAQ IPAQPOCKETPC 0x0003 iPAQ PocketPC @@ -791,6 +874,9 @@ /* CTX products */ product CTX EX1300 0x9999 Ex1300 hub +/* CyberTAN Technology products */ +product CYBERTAN TG54USB 0x1666 TG54USB + /* Cypress Semiconductor products */ product CYPRESS MOUSE 0x0001 mouse product CYPRESS THERMO 0x0002 thermometer @@ -817,6 +903,7 @@ /* DeLorme products */ product DELORME EARTHMATE 0x0100 Earthmate GPS +product DELORME EARTHMATE_LT20 0x0200 Earthmate LT-20 GPS /* Diamond products */ product DIAMOND RIO500USB 0x0001 Rio 500 USB @@ -841,6 +928,7 @@ product DLINK DWLG122 0x3c00 AirPlus G Wireless USB Adapter product DLINK2 DWLG122C1 0x3c03 DWL-G122 rev C1 product DLINK2 WUA1340 0x3c04 WUA-1340 +product DLINK DUBE100B1 0x3c05 DUB-E100 rev B1 product DLINK DSB650C 0x4000 10Mbps ethernet adapter product DLINK DSB650TX1 0x4001 10/100 ethernet adapter product DLINK DSB650TX 0x4002 10/100 ethernet adapter @@ -849,14 +937,20 @@ product DLINK DSB650TX2 0x4102 10/100 ethernet adapter product DLINK DSB650 0xabc1 10/100 ethernet adapter +/* DMI products */ +product DMI SA2_0 0xb001 Storage Adapter + +/* DrayTek products */ +product DRAYTEK VIGOR550 0x0550 Vigor550 + +/* Dynastream Innovations */ +product DYNASTREAM ANTDEVBOARD 0x1003 ANT dev board + /* eGalax Products */ product EGALAX TPANEL 0x0001 Touch Panel product EGALAX TPANEL2 0x0002 Touch Panel product EGALAX2 TPANEL 0x0001 Touch Panel -/* DMI products */ -product DMI SA2_0 0xb001 Storage Adapter - /* Eicon Networks */ product EICON DIVA852 0x4905 Diva 852 ISDN TA @@ -864,12 +958,16 @@ product EIZO HUB 0x0000 hub product EIZO MONITOR 0x0001 monitor +/* ELCON Systemtechnik products */ +product ELCON PLAN 0x0002 Goldpfeil P-LAN + /* Elecom products */ product ELECOM MOUSE29UO 0x0002 mouse 29UO product ELECOM LDUSBTX0 0x200c LD-USB/TX product ELECOM LDUSBTX1 0x4002 LD-USB/TX product ELECOM LDUSBLTX 0x4005 LD-USBL/TX product ELECOM LDUSBTX2 0x400b LD-USB/TX +product ELECOM LDUSB20 0x4010 LD-USB20 product ELECOM UCSGT 0x5003 UC-SGT serial adapter product ELECOM UCSGT0 0x5004 UC-SGT0 Serial product ELECOM LDUSBTX3 0xabc1 LD-USB/TX @@ -926,11 +1024,15 @@ product FALCOM TWIST 0x0001 Twist GSM/GPRS modem product FALCOM SAMBA 0x0005 Samba 55/56 GSM/GPRS modem +/* Fiberline */ +product FIBERLINE WL430U 0x6003 WL-430U + /* Freecom products */ product FREECOM DVD 0xfc01 Connector for DVD drive /* Future Technology Devices products */ product FTDI SERIAL_8U232AM 0x6001 8U232AM Serial converter +product FTDI SERIAL_2232C 0x6010 2232C USB FAST SERIAL ADAPTER product FTDI PS2KBDMS 0x8371 PS/2 Keyboard/Mouse product FTDI SERIAL_8U100AX 0x8372 8U100AX Serial converter product FTDI MHAM_KW 0xeee8 KW @@ -970,16 +1072,24 @@ product GENESYS GL641USB2IDE 0x0702 GL641USB USB-IDE Bridge /* GIGABYTE products */ +product GIGABYTE GN54G 0x8001 GN-54G +product GIGABYTE GNBR402W 0x8002 GN-BR402W +product GIGABYTE GNWLBM101 0x8003 GN-WLBM101 product GIGABYTE GNWBKG 0x8007 GN-WBKG product GIGABYTE GNWB01GS 0x8008 GN-WB01GS +product GIGABYTE GNWI05GS 0x800a GN-WI05GS /* Gigaset products */ product GIGASET RT2573 0x0722 RT2573 +/* G.Mate, Inc products */ +product GMATE YP3X00 0x1001 YP3X00 PDA + /* GoHubs products */ product GOHUBS GOCOM232 0x1001 GoCOM232 Serial converter /* Good Way Technology products */ +product GOODWAY GWUSB2E 0x6200 GWUSB2E product GOODWAY RT2573 0xc019 RT2573 /* Gravis products */ @@ -995,6 +1105,8 @@ /* Guillemot Corporation */ product GUILLEMOT DALEADER 0xa300 DA Leader product GUILLEMOT HWGUSB254 0xe000 HWGUSB2-54 WLAN +product GUILLEMOT HWGUSB254LB 0xe010 HWGUSB2-54-LB +product GUILLEMOT HWGUSB254V2AP 0xe020 HWGUSB2-54V2-AP /* Hagiwara products */ product HAGIWARA FGSM 0x0002 FlashGate SmartMedia Card Reader @@ -1074,7 +1186,10 @@ /* HP products */ product HP2 C500 0x6002 PhotoSmart C500 -/* HUAWEI products */ +/* Huawei Technologies products */ +product HUAWEI MOBILE 0x1001 Huawei Mobile + +/* Huawei-3Com products */ product HUAWEI3COM RT2573 0x0009 RT2573 /* IBM Corporation */ @@ -1142,7 +1257,9 @@ product IODATA USBETTX 0x0904 USB ETTX product IODATA USBETTXS 0x0913 USB ETTX product IODATA USBWNB11 0x0922 USB Airport WN-B11 +product IODATA ETGUS2 0x0930 ETG-US2 product IODATA USBRSAQ 0x0a03 USB serial adapter USB-RSAQ1 +product IODATA USBRSAQ5 0x0a0e USB serial adapter USB-RSAQ5 product IODATA2 USB2SC 0x0a09 USB2.0-SCSI Bridge USB2-SC /* Iomega products */ @@ -1156,6 +1273,9 @@ product IRIVER IFP_3XX 0x1103 iFP-3xx product IRIVER IFP_5XX 0x1105 iFP-5xx +/* Jablotron products */ +product JABLOTRON PC60B 0x0001 PC-60B + /* Jaton products */ product JATON EDA 0x5704 Ethernet Device Adapter @@ -1167,8 +1287,7 @@ /* JVC products */ product JVC GR_DX95 0x000a GR-DX95 - -/* JVC products */ +product JVC MP_PRX1 0x3008 MP-PRX1 Ethernet product JVC MP_XP7250_WL 0x3009 MP-XP7250 Builtin WLAN /* Kawasaki products */ @@ -1212,8 +1331,8 @@ product KEYSPAN USA28XA 0x0115 USA-28XA serial adapter product KEYSPAN USA18XA_NF 0x0116 USA-18XA serial adapter (no firmware) product KEYSPAN USA18XA 0x0117 USA-18XA serial adapter -product KEYSPAN USA19QW_NF 0x0118 USA-19WQ serial adapter (no firmware) -product KEYSPAN USA19QW 0x0119 USA-19WQ serial adapter +product KEYSPAN USA19QW_NF 0x0118 USA-19QW serial adapter (no firmware) +product KEYSPAN USA19QW 0x0119 USA-19QW serial adapter product KEYSPAN UIA10 0x0201 UIA-10 remote control product KEYSPAN UIA11 0x0202 UIA-11 remote control @@ -1244,9 +1363,9 @@ product KYOCERA AHK3001V 0x0203 AH-K3001V /* LaCie products */ +product LACIE PKTDRV 0x0211 PocketDrive product LACIE HD 0xa601 Hard Disk product LACIE CDRW 0xa602 CD R/W -product LACIE PKTDRV 0x0211 PocketDrive /* Lexar products */ product LEXAR JUMPSHOT 0x0001 jumpSHOT CompactFlash Reader @@ -1266,12 +1385,11 @@ product LINKSYS WUSB11 0x2211 WUSB11 Wireless USB Network Adapter product LINKSYS WUSB11_25 0x2212 WUSB11 Wireless USB Network Adapter (version 2.5) product LINKSYS WUSB12_11 0x2213 WUSB12 802.11b v1.1 -product LINKSYS2 USB200M 0x2226 USB 2.0 10/100 ethernet controller product LINKSYS USB10TX2 0x400b USB10TX product LINKSYS2 WUSB11 0x2219 WUSB11 +product LINKSYS2 USB200M 0x2226 USB 2.0 10/100 ethernet controller product LINKSYS3 WUSB11V28 0x2233 WUSB11-V28 -product CISCOLINKSYS WUSB54G 0x000d WUSB54G Wireless-G USB Network Adapter -product CISCOLINKSYS WUSB54GP 0x0011 WUSB54GP Wireless-G USB Network Adapter +product LINKSYS4 USB1000 0x0039 USB1000 /* Logitec products */ product LOGITEC LDR_H443SU2 0x0033 DVD Multi-plus unit LDR-H443SU2 @@ -1297,11 +1415,10 @@ product LOGITECH USBPS2MOUSE 0xc00e USB-PS/2 Optical Mouse product LOGITECH MUV55A 0xc016 M-UV55a product LOGITECH UN58A 0xc030 iFeel Mouse -product LOGITECH WMRPAD 0xc20a WingMan RumblePad -product LOGITECH WMFFGP 0xc293 WingMan Formula Force GP (GT-Force) product LOGITECH WMPAD 0xc208 WingMan GamePad Extreme product LOGITECH WMRPAD 0xc20a WingMan RumblePad product LOGITECH WMJOY 0xc281 WingMan Force joystick +product LOGITECH WMFFGP 0xc293 WingMan Formula Force GP (GT-Force) product LOGITECH BB13 0xc401 USB-PS/2 Trackball product LOGITECH BB18 0xc404 TrackMan Wheel product LOGITECH MARBLEMOUSE 0xc408 Marble Mouse @@ -1344,18 +1461,27 @@ product MELCO KG54YB 0x005e WLI-U2-KG54-YB WLAN product MELCO KG54 0x0066 WLI-U2-KG54 WLAN product MELCO KG54AI 0x0067 WLI-U2-KG54-AI WLAN +product MELCO NINWIFI 0x008b Nintendo Wi-Fi +product MELCO SG54HP 0x00d8 WLI-U2-SG54HP +product MELCO G54HP 0x00d9 WLI-U2-G54HP +product MELCO KG54L 0x00da WLI-U2-KG54L /* Metricom products */ product METRICOM RICOCHET_GS 0x0001 Ricochet GS +/* MGE UPS Systems */ +product MGE UPS1 0x0001 MGE UPS SYSTEMS PROTECTIONCENTER 1 +product MGE UPS2 0xffff MGE UPS SYSTEMS PROTECTIONCENTER 2 + /* Micro Star International products */ product MSI BLUETOOTH 0x1967 Bluetooth USB Adapter product MSI MS6861 0x6861 MS-6861 product MSI MS6865 0x6865 MS-6865 product MSI MS6869 0x6869 MS-6869 -product MSI RT2573 0x6877 RT2573 -product MSI RT2573_2 0xa861 RT2573 -product MSI RT2573_3 0xa874 RT2573 +product MSI RT2573 0x6874 RT2573 +product MSI RT2573_2 0x6877 RT2573 +product MSI RT2573_3 0xa861 RT2573 +product MSI RT2573_4 0xa874 RT2573 /* Micronet Communications products */ product MICRONET SP128AR 0x0003 SP128AR EtherFast @@ -1372,6 +1498,11 @@ product MICROSOFT INETPRO2 0x002b Internet Keyboard Pro product MICROSOFT MN510 0x006e MN510 Wireless product MICROSOFT MN110 0x007a 10/100 USB NIC +product MICROSOFT XBOX_MEMORY_UNIT 0x0280 Xbox Memory Unit +product MICROSOFT XBOX_DVD_PLAYBACK 0x0284 Xbox DVD Movie Playback Kit +product MICROSOFT XBOX_CONTROLLER_S10 0x0285 Xbox Controller S (1.0) +product MICROSOFT XBOX_CONTROLLER_HUB 0x0288 Xbox Controller Hub +product MICROSOFT XBOX_CONTROLLER_S12 0x0289 Xbox Controller S (1.2) /* Microtech products */ product MICROTECH SCSIDB25 0x0004 USB-SCSI-DB25 @@ -1414,8 +1545,12 @@ /* Mobility products */ product MOBILITY EA 0x0204 Ethernet Adapter +product MOBILITY EASIDOCK 0x0304 EasiDock Ethernet /* MosChip Semiconductor */ +product MOSCHIP MCS7780 0x7780 Fast IrDA Adapter +product MOSCHIP MCS7781 0x7781 Fast IrDA Adapter +product MOSCHIP MCS7784 0x7784 Slow IrDA Adapter product MOSCHIP MCS7830 0x7830 Ethernet Adapter /* Motorola products */ @@ -1423,7 +1558,14 @@ product MOTOROLA SB4100 0x4100 SB4100 USB Cable Modem product MOTOROLA2 T720C 0x2822 T720c product MOTOROLA2 A920 0x4002 A920 +product MOTOROLA2 USBLAN 0x600c USBLAN +product MOTOROLA2 USBLAN2 0x6027 USBLAN +/* M-Systems products */ +product MSYSTEMS DISKONKEY 0x0010 DiskOnKey +product MSYSTEMS DISKONKEY2 0x0011 DiskOnKey +product MSYSTEMS DISKONKEY3 0x0012 DiskOnKey + /* MultiTech products */ product MULTITECH ATLAS 0xf101 MT5634ZBA-USB modem @@ -1440,11 +1582,6 @@ product MUSTEK MDC800 0xa800 MDC-800 digital camera product MUSTEK DV2000 0xc441 DV2000 digital camera -/* M-Systems products */ -product MSYSTEMS DISKONKEY 0x0010 DiskOnKey -product MSYSTEMS DISKONKEY2 0x0011 DiskOnKey -product MSYSTEMS DISKONKEY3 0x0012 DiskOnKey - /* National Instruments */ product NI GPIB_USB_A 0xc920 GPIB-USB-A @@ -1471,6 +1608,7 @@ /* NetChip Technology Products */ product NETCHIP TURBOCONNECT 0x1080 Turbo-Connect product NETCHIP CLIK40 0xa140 Clik! 40 +product NETCHIP ETHERNETGADGET 0xa4a2 Linux Ethernet/RNDIS gadget on pxa210/25x/26x /* Netgear products */ product NETGEAR EA101 0x1001 Ethernet adapter @@ -1483,19 +1621,28 @@ product NETGEAR2 MA101 0x4100 MA101 product NETGEAR2 MA101B 0x4102 MA101 Rev B +/* NetIndex products */ +product NETINDEX WS002IN 0x2001 Willcom WS002IN (DD) + +/* NHJ product */ +product NHJ CAM2 0x9120 Camera + /* Nikon products */ product NIKON E990 0x0102 Digital Camera E990 product NIKON E880 0x0103 Digital Camera E880 product NIKON E885 0x0105 Digital Camera E885 -/* NHJ product */ -product NHJ CAM2 0x9120 Camera - /* Nokia products */ product NOKIA CA42 0x0802 Mobile Phone adapter +/* Nova Tech products */ +product NOVATECH NV902W 0x9020 NV-902W +product NOVATECH RT2573 0x9021 RT2573 + /* NovAtel products */ product NOVATEL FLEXPACKGPS 0x0100 NovAtel FlexPack GPS receiver +product NOVATEL2 CDMA_MODEM 0x1110 Novatel Wireless Merlin CDMA +product NOVATEL2 MERLINU740 0x1400 Novatel Merlin U740 /* Olympus products */ product OLYMPUS C1 0x0102 C-1 Digital Camera @@ -1519,8 +1666,15 @@ product ONSPEC2 8IN2 0xb012 8In2 +/* Option N.V. products */ +product OPTIONNV MC3G 0x5000 Mobile Connect 3G datacard +product OPTIONNV QUADUMTS2 0x6000 GlobeTrotter Fusion Quad Lite UMTS/GPRS +product OPTIONNV QUADUMTS 0x6300 GlobeTrotter Fusion Quad Lite 3D +product OPTIONNV QUADPLUSUMTS 0x6600 GlobeTrotter 3G Quad Plus + /* OQO */ product OQO WIFI01 0x0002 model 01 WiFi interface +product OQO ETHER01PLUS 0x7720 model 01+ Ethernet product OQO ETHER01 0x8150 model 01 Ethernet interface /* Ours Technology Inc. */ @@ -1574,6 +1728,7 @@ product PHILIPS PCVC740K 0x0311 PCVC740K ToUCam Pro PC Camera product PHILIPS PCVC750K 0x0312 PCVC750K ToUCam Pro Scan PC Camera product PHILIPS DSS150 0x0471 DSS 150 Digital Speaker System +product PHILIPS SNU5600 0x1236 SNU5600 product PHILIPS DIVAUSB 0x1801 DIVA USB mp3 player /* Philips Semiconductor products */ @@ -1588,8 +1743,17 @@ product PILOTECH CRW600 0x0001 CRW-600 6-in-1 Reader /* Planex Communications products */ -product PLANEX GW_US11H 0x14ea GW-US11H WLAN +product PLANEX GW_US11H 0x14ea GW-US11H WLAN +product PLANEX2 GW_US11S 0x3220 GW-US11S WLAN +product PLANEX2 GWUS54GXS 0x5303 GW-US54GXS +product PLANEX2 GWUS54HP 0xab01 GW-US54HP +product PLANEX2 GWUS54MINI2 0xab50 GW-US54Mini2 +product PLANEX2 GWUS54SG 0xc002 GW-US54SG +product PLANEX2 GWUS54GZL 0xc007 GW-US54GZL product PLANEX2 GWUSMM 0xed02 GW-USMM +product PLANEX3 GWUS54GZ 0xab10 GW-US54GZ +product PLANEX3 GU1000T 0xab11 GU-1000T +product PLANEX3 GWUS54MINI 0xab13 GW-US54Mini /* Plantronics products */ product PLANTRONICS HEADSET 0x0ca1 Platronics DSP-400 Headset @@ -1635,12 +1799,12 @@ product PROLIFIC PL2301 0x0000 PL2301 Host-Host interface product PROLIFIC PL2302 0x0001 PL2302 Host-Host interface product PROLIFIC RSAQ2 0x04bb PL2303 Serial adapter (IODATA USB-RSAQ2) -product PROLIFIC RSAQ3 0xaaa2 PL2303 Serial adapter (IODATA USB-RSAQ3) product PROLIFIC PL2303 0x2303 PL2303 Serial adapter (ATEN/IOGEAR UC232A) product PROLIFIC PL2305 0x2305 Parallel printer adapter product PROLIFIC ATAPI4 0x2307 ATAPI-4 Bridge Controller product PROLIFIC PL2501 0x2501 PL2501 Host-Host interface product PROLIFIC PL2303X 0xaaa0 PL2303 Serial adapter (Pharos GPS) +product PROLIFIC RSAQ3 0xaaa2 PL2303 Serial adapter (IODATA USB-RSAQ3) /* Putercom products */ product PUTERCOM UPA100 0x047e USB-1284 BRIDGE @@ -1654,7 +1818,9 @@ /* Qualcomm products */ product QUALCOMM CDMA_MSM 0x6000 CDMA Technologies MSM phone +product QUALCOMM2 CDMA_MSM 0x3196 CDMA Technologies MSM modem +/* Qualcomm Kyocera products */ product QUALCOMM_K CDMA_MSM_K 0x17da Qualcomm Kyocera CDMA Technologies MSM /* Quickshot products */ @@ -1666,17 +1832,25 @@ /* Ralink Technology products */ product RALINK RT2570 0x1706 RT2570 product RALINK RT2570_2 0x2570 RT2570 +product RALINK RT2573 0x2573 RT2573 +product RALINK RT2671 0x2671 RT2671 product RALINK RT2570_3 0x9020 RT2570 product RALINK_2 RT2570 0x2570 RT2570 -product RALINK RT2573 0x2573 RT2573 -product RALINK RT2671 0x2671 RT2671 +product RALINK_2 RT2573 0x2573 RT2573 /* RATOC Systems products */ -product RATOC REXUSB60 0xb000 USB serial REX-USB60 +product RATOC REXUSB60 0xb000 USB serial adapter REX-USB60 /* Realtek products */ -product REALTEK RTL8150L 0x8150 Realtek RTL8150L USB-Ethernet Bridge +product REALTEK RTL8150L 0x8150 RTL8150L USB-Ethernet Bridge +product REALTEK RTL8151 0x8151 RTL8151 PNA +/* Research In Motion */ +product RIM BLACKBERRY 0x0001 BlackBerry + +/* Rockfire products */ +product ROCKFIRE GAMEPAD 0x2033 gamepad 203USB + /* Roland products */ product ROLAND UA100 0x0000 UA-100 USB Audio I/F product ROLAND UM4 0x0002 UM-4 MIDI I/F @@ -1710,18 +1884,16 @@ product ROLAND UA1EX 0x0096 EDIROL UA-1EX product ROLAND UM3 0x009A EDIROL UM-3 -/* Rockfire products */ -product ROCKFIRE GAMEPAD 0x2033 gamepad 203USB +/* Sagem products */ +product SAGEM XG760A 0x004a XG-760A +product SAGEM XG76NA 0x0062 XG-76NA -/* RATOC Systems products */ -product RATOC REXUSB60 0xb000 USB serial adapter REX-USB60 - /* Saitek products */ product SAITEK CYBORG_3D_GOLD 0x0006 Cyborg 3D Gold Joystick /* Samsung products */ +product SAMSUNG MIGHTYDRIVE 0x1623 Mighty Drive product SAMSUNG ML6060 0x3008 ML-6060 laser printer -product SAMSUNG MIGHTYDRIVE 0x1623 Mighty Drive /* SanDisk products */ product SANDISK SDDR05A 0x0001 ImageMate SDDR-05a @@ -1729,8 +1901,8 @@ product SANDISK SDDR05 0x0005 ImageMate SDDR-05 product SANDISK SDDR12 0x0100 ImageMate SDDR-12 product SANDISK SDDR09 0x0200 ImageMate SDDR-09 +product SANDISK SDDR86 0x0621 ImageMate SDDR-86 product SANDISK SDDR75 0x0810 ImageMate SDDR-75 -product SANDISK SDDR86 0x0621 ImageMate SDDR-86 /* Sanwa Supply products */ product SANWASUPPLY JYDV9USB 0x9806 JY-DV9USB gamepad @@ -1745,12 +1917,15 @@ /* Sealevel products */ product SEALEVEL USBSERIAL 0x2101 USB-Serial converter -/* ArkMicroChips products */ -product ARKMICROCHIPS USBSERIAL 0x0232 USB-UART Controller +/* Senao products */ +product SENAO NUB8301 0x2000 NUB-8301 /* SGI products */ product SGI SN1_L1_SC 0x1234 SN1 L1 System Controller +/* ShanTou products */ +product SHANTOU ST268_USB_NIC 0x0268 ST268 USB NIC + /* Shark products */ product SHARK PA 0x0400 Pocket Adapter @@ -1760,6 +1935,7 @@ product SHARP SL5600 0x8006 SL5600 product SHARP C700 0x8007 C700 product SHARP C750 0x9031 C750 +product SHARP WS007SH 0x9123 WS007SH /* Shuttle Technology products */ product SHUTTLE EUSB 0x0001 E-USB Bridge @@ -1782,12 +1958,16 @@ /* Siemens Info products */ product SIEMENS2 MC75 0x0034 Wireless Modules MC75 +product SIEMENS2 WL54G 0x3c06 54g USB Network Adapter /* Sierra Wireless products */ product SIERRA AIRCARD580 0x0112 Sierra Wireless AirCard 580 /* Sigmatel products */ +product SIGMATEL SIR4116 0x4116 StIR4116 SIR product SIGMATEL IRDA 0x4200 IrDA +product SIGMATEL FIR4210 0x4210 StIR4210 FIR +product SIGMATEL VFIR4220 0x4220 StIR4220 VFIR product SIGMATEL I_BEAD100 0x8008 i-Bead 100 MP3 Player product SIGMATEL DNSSF7X 0x8020 Datum Networks SSF-7X Multi Players @@ -1796,15 +1976,35 @@ product SIIG UISDMC2S 0x0200 MULTICARDREADER product SIIG MULTICARDREADER 0x0201 MULTICARDREADER +product SIIG2 USBTOETHER 0x0109 USB TO Ethernet product SIIG2 US2308 0x0421 Serial /* Silicom products */ product SILICOM U2E 0x0001 U2E +product SILICOM GPE 0x0002 Psion Gold Port Ethernet +/* Silicon Labs products */ +product SILABS POLOLU 0x803b Pololu Serial +product SILABS ARGUSISP 0x8066 Argussoft ISP +product SILABS CRUMB128 0x807a Crumb128 +product SILABS DEGREECONT 0x80ca Degree Controls +product SILABS SUNNTO 0x80f6 Suunto sports +product SILABS DESKTOPMOBILE 0x813d Burnside Desktop mobile +product SILABS IPLINK1220 0x815e IP-Link 1220 +product SILABS LIPOWSKY_JTAG 0x81c8 Lipowsky Baby-JTAG +product SILABS LIPOWSKY_LIN 0x81e2 Lipowsky Baby-LIN +product SILABS LIPOWSKY_HARP 0x8218 Lipowsky HARP-1 +product SILABS2 DCU11CLONE 0xaa26 DCU-11 clone +product SILABS CP210X_1 0xea60 CP210x Serial +product SILABS CP210X_2 0xea61 CP210x Serial + /* Silicon Portals Inc. */ product SILICONPORTALS YAPPH_NF 0x0200 YAP Phone (no firmware) product SILICONPORTALS YAPPHONE 0x0201 YAP Phone +/* Silicon Integrated Systems products */ +product SIS SIS_163U 0x0163 802.11g Wireless LAN Adapter + /* Sirius Technologies products */ product SIRIUS ROADSTER 0x0001 NetComm Roadster II 56 USB @@ -1814,6 +2014,7 @@ /* Sitecom Europe products */ product SITECOMEU WL113 0x9071 WL-113 +product SITECOMEU ZD1211B 0x9075 ZD1211B product SITECOMEU WL172 0x90ac WL-172 product SITECOMEU WL113R2 0x9712 WL-113 rev 2 @@ -1832,6 +2033,7 @@ /* SOHOware products */ product SOHOWARE NUB100 0x9100 10/100 USB Ethernet +product SOHOWARE NUB110 0x9110 NUB110 Ethernet /* SOLID YEAR products */ product SOLIDYEAR KEYBOARD 0x2101 Solid Year USB keyboard @@ -1859,9 +2061,12 @@ product SONY CLIE_TJ25 0x0169 Sony Clie tj25 /* SOURCENEXT products */ +product SOURCENEXT KEIKAI8_CHG 0x012e KeikaiDenwa 8 with charger product SOURCENEXT KEIKAI8 0x039f KeikaiDenwa 8 -product SOURCENEXT KEIKAI8_CHG 0x012e KeikaiDenwa 8 with charger +/* Sphairon Access Systems GmbH products */ +product SPHAIRON UB801R 0x0110 UB801R + /* STMicroelectronics products */ product STMICRO COMMUNICATOR 0x7554 USB Communicator @@ -1885,6 +2090,13 @@ /* XXX The above is a North American PC style keyboard possibly */ product SUN MOUSE 0x0100 Type 6 USB mouse +/* Supra products */ +product DIAMOND2 SUPRAEXPRESS56K 0x07da Supra Express 56K modem [... truncated: 157 lines follow ...] From axeld at mail.berlios.de Tue Aug 7 03:24:10 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 7 Aug 2007 03:24:10 +0200 Subject: [Haiku-commits] r21846 - haiku/trunk/src/servers/app Message-ID: <200708070124.l771OAfU032377@sheep.berlios.de> Author: axeld Date: 2007-08-07 03:24:09 +0200 (Tue, 07 Aug 2007) New Revision: 21846 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21846&view=rev Modified: haiku/trunk/src/servers/app/ServerFont.cpp Log: rectArray can only be NULL in case fAsString is true, not the other way around; this fixes ServerFont::GetBoundingBoxesForStrings() (ScreenSaver no longer crashes as reported by Brian Verre on the mailing list). Modified: haiku/trunk/src/servers/app/ServerFont.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerFont.cpp 2007-08-06 23:29:54 UTC (rev 21845) +++ haiku/trunk/src/servers/app/ServerFont.cpp 2007-08-07 01:24:09 UTC (rev 21846) @@ -592,6 +592,7 @@ , fTransform(transform) { } + void Start() {} void Finish(double x, double y) {} void ConsumeEmptyGlyph(int32 index, uint32 charCode, double x, double y) {} @@ -601,21 +602,21 @@ if (glyph->data_type != glyph_data_outline) { const agg::rect_i& r = glyph->bounds; if (fAsString) { - rectArray[index].left = r.x1 + x; - rectArray[index].top = r.y1 + y; - rectArray[index].right = r.x2 + x + 1; - rectArray[index].bottom = r.y2 + y + 1; - } else { if (rectArray) { - rectArray[index].left = r.x1; - rectArray[index].top = r.y1; - rectArray[index].right = r.x2 + 1; - rectArray[index].bottom = r.y2 + 1; + rectArray[index].left = r.x1 + x; + rectArray[index].top = r.y1 + y; + rectArray[index].right = r.x2 + x + 1; + rectArray[index].bottom = r.y2 + y + 1; } else { stringBoundingBox = stringBoundingBox | BRect(r.x1 + x, r.y1 + y, r.x2 + x + 1, r.y2 + y + 1); } + } else { + rectArray[index].left = r.x1; + rectArray[index].top = r.y1; + rectArray[index].right = r.x2 + 1; + rectArray[index].bottom = r.y2 + 1; } } else { if (fAsString) { @@ -686,8 +687,9 @@ status_t -ServerFont::GetBoundingBoxesForStrings(char *charArray[], int32 lengthArray[], - int32 numStrings, BRect rectArray[], font_metric_mode mode, escapement_delta deltaArray[]) +ServerFont::GetBoundingBoxesForStrings(char *charArray[], int32 lengthArray[], + int32 numStrings, BRect rectArray[], font_metric_mode mode, + escapement_delta deltaArray[]) { // TODO: The font_metric_mode is never used if (!charArray || !lengthArray|| numStrings <= 0 || !rectArray || !deltaArray) From axeld at mail.berlios.de Tue Aug 7 03:54:11 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 7 Aug 2007 03:54:11 +0200 Subject: [Haiku-commits] r21847 - haiku/trunk/src/system/kernel Message-ID: <200708070154.l771sBik001184@sheep.berlios.de> Author: axeld Date: 2007-08-07 03:54:08 +0200 (Tue, 07 Aug 2007) New Revision: 21847 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21847&view=rev Modified: haiku/trunk/src/system/kernel/thread.c Log: Now prints a more detailed message in case the kernel stack couldn't be created. Modified: haiku/trunk/src/system/kernel/thread.c =================================================================== --- haiku/trunk/src/system/kernel/thread.c 2007-08-07 01:24:09 UTC (rev 21846) +++ haiku/trunk/src/system/kernel/thread.c 2007-08-07 01:54:08 UTC (rev 21847) @@ -385,9 +385,11 @@ if (thread->kernel_stack_area < 0) { // we're not yet part of a team, so we can just bail out - dprintf("create_thread: error creating kernel stack!\n"); + status = thread->kernel_stack_area; - status = thread->kernel_stack_area; + dprintf("create_thread: error creating kernel stack: %s!\n", + strerror(status)); + delete_thread_struct(thread); return status; } From korli at users.berlios.de Tue Aug 7 12:17:06 2007 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Tue, 7 Aug 2007 12:17:06 +0200 Subject: [Haiku-commits] r21820 - haiku/trunk/src/system/libroot/os In-Reply-To: <20070805165003.5222.11@stippis2.1186309169.fake> References: <200708041119.l74BJvg6010744@sheep.berlios.de> <20070805165003.5222.11@stippis2.1186309169.fake> Message-ID: 2007/8/5, Stephan Assmus : > > > I think not, Pe says this file is UTF8 encoded and your name is correct > here, I think it is just a problem with the commit message. I think I've > seen this problem before. Hmm not only the commit message : http://svn.berlios.de/viewcvs/haiku/haiku/trunk/src/system/libroot/os/scheduler.c?rev=21820&view=diff&r1=21820&r2=21819&p1=haiku/trunk/src/system/libroot/os/scheduler.c&p2=/haiku/trunk/src/system/libroot/os/scheduler.c Anyway, Michael Pfeiffer fixed it. Bye, J?r?me -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.pfeiffer at utanet.at Tue Aug 7 12:23:49 2007 From: michael.pfeiffer at utanet.at (Michael Pfeiffer) Date: Tue, 7 Aug 2007 12:23:49 +0200 Subject: [Haiku-commits] r21820 - haiku/trunk/src/system/libroot/os In-Reply-To: References: <200708041119.l74BJvg6010744@sheep.berlios.de> <20070805165003.5222.11@stippis2.1186309169.fake> Message-ID: <64000B9C-8BFE-490B-8CC4-60E18349F28B@utanet.at> Am 07.08.2007 um 12:17 schrieb J?r?me Duval: > 2007/8/5, Stephan Assmus : > > I think not, Pe says this file is UTF8 encoded and your name is > correct > here, I think it is just a problem with the commit message. I think > I've > seen this problem before. > > Hmm not only the commit message : http://svn.berlios.de/viewcvs/ > haiku/haiku/trunk/src/system/libroot/os/scheduler.c? > rev=21820&view=diff&r1=21820&r2=21819&p1=haiku/trunk/src/system/ > libroot/os/scheduler.c&p2=/haiku/trunk/src/system/libroot/os/ > scheduler.c > > Anyway, Michael Pfeiffer fixed it. Nope. It's still UTF-8 encoded. But that's OK, isn't it? - Michael From axeld at mail.berlios.de Tue Aug 7 23:46:59 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 7 Aug 2007 23:46:59 +0200 Subject: [Haiku-commits] r21848 - in haiku/trunk: headers/private/kernel src/system/kernel/vm Message-ID: <200708072146.l77Lkxr1028645@sheep.berlios.de> Author: axeld Date: 2007-08-07 23:46:58 +0200 (Tue, 07 Aug 2007) New Revision: 21848 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21848&view=rev Modified: haiku/trunk/headers/private/kernel/vm_types.h haiku/trunk/src/system/kernel/vm/vm.cpp Log: bonefish+axeld: * Removed the ref_count from vm_areas. You now always need to have the address space locked (read or write, depending on what you do) when dealing with areas. * Added helper classes for locking the address space: AddressSpace{Read|Write}Locker, and MultiAddressSpaceLocker which can lock several spaces at once and makes sure no dead locks can happen. * resize_area() is now using the MultiAddressSpaceLocker instead of no locking at all; ie. it should now be safely to use. * Disabled transfer_area() for now; it will be changed to work like an atomic clone_area()/delete_area(), that is, it will hand out a new ID for the transfered area. Modified: haiku/trunk/headers/private/kernel/vm_types.h =================================================================== --- haiku/trunk/headers/private/kernel/vm_types.h 2007-08-07 01:54:08 UTC (rev 21847) +++ haiku/trunk/headers/private/kernel/vm_types.h 2007-08-07 21:46:58 UTC (rev 21848) @@ -163,7 +163,6 @@ uint32 protection; uint16 wiring; uint16 memory_type; - vint32 ref_count; struct vm_cache *cache; vint32 no_cache_change; Modified: haiku/trunk/src/system/kernel/vm/vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm.cpp 2007-08-07 01:54:08 UTC (rev 21847) +++ haiku/trunk/src/system/kernel/vm/vm.cpp 2007-08-07 21:46:58 UTC (rev 21848) @@ -59,6 +59,79 @@ #define ROUNDOWN(a, b) (((a) / (b)) * (b)) +class AddressSpaceReadLocker { +public: + AddressSpaceReadLocker(team_id team); + AddressSpaceReadLocker(); + ~AddressSpaceReadLocker(); + + status_t SetTo(team_id team); + status_t SetFromArea(area_id areaID, vm_area*& area); + + bool IsLocked() const { return fLocked; } + void Unlock(); + + void Unset(); + + vm_address_space* AddressSpace() { return fSpace; } + +private: + vm_address_space* fSpace; + bool fLocked; +}; + +class AddressSpaceWriteLocker { +public: + AddressSpaceWriteLocker(team_id team); + AddressSpaceWriteLocker(); + ~AddressSpaceWriteLocker(); + + status_t SetTo(team_id team); + status_t SetFromArea(area_id areaID, vm_area*& area); + status_t SetFromArea(team_id team, area_id areaID, bool allowKernel, + vm_area*& area); + status_t SetFromArea(team_id team, area_id areaID, vm_area*& area); + + bool IsLocked() const { return fLocked; } + void Unlock(); + + void DegradeToReadLock(); + void Unset(); + + vm_address_space* AddressSpace() { return fSpace; } + +private: + vm_address_space* fSpace; + bool fLocked; + bool fDegraded; +}; + +class MultiAddressSpaceLocker { +public: + MultiAddressSpaceLocker(); + ~MultiAddressSpaceLocker(); + + status_t AddTeam(team_id team, vm_address_space** _space = NULL); + status_t AddArea(area_id area, vm_address_space** _space = NULL); + + status_t Lock(); + void Unlock(); + bool IsLocked() const { return fLocked; } + + void Unset(); + +private: + bool _ResizeIfNeeded(); + vm_address_space*& _CurrentItem() { return fSpaces[fCount]; } + + static int _CompareItems(const void* _a, const void* _b); + + vm_address_space** fSpaces; + int32 fCapacity; + int32 fCount; + bool fLocked; +}; + #define REGION_HASH_TABLE_SIZE 1024 static area_id sNextAreaID; static hash_table *sAreaHash; @@ -70,10 +143,376 @@ static benaphore sAvailableMemoryLock; // function declarations -static status_t vm_soft_fault(addr_t address, bool is_write, bool is_user); -static bool vm_put_area(vm_area *area); +static void delete_area(vm_address_space *addressSpace, vm_area *area); +static vm_address_space *get_address_space_by_area_id(area_id id); +static status_t vm_soft_fault(addr_t address, bool isWrite, bool isUser); +// #pragma mark - + + +AddressSpaceReadLocker::AddressSpaceReadLocker(team_id team) + : + fSpace(NULL), + fLocked(false) +{ + SetTo(team); +} + + +AddressSpaceReadLocker::AddressSpaceReadLocker() + : + fSpace(NULL), + fLocked(false) +{ +} + + +AddressSpaceReadLocker::~AddressSpaceReadLocker() +{ + Unset(); +} + + +void +AddressSpaceReadLocker::Unset() +{ + Unlock(); + if (fSpace != NULL) + vm_put_address_space(fSpace); +} + + +status_t +AddressSpaceReadLocker::SetTo(team_id team) +{ + fSpace = vm_get_address_space_by_id(team); + if (fSpace == NULL) + return B_BAD_TEAM_ID; + + acquire_sem_etc(fSpace->sem, READ_COUNT, 0, 0); + fLocked = true; + return B_OK; +} + + +status_t +AddressSpaceReadLocker::SetFromArea(area_id areaID, vm_area*& area) +{ + fSpace = get_address_space_by_area_id(areaID); + if (fSpace == NULL) + return B_BAD_TEAM_ID; + + acquire_sem_etc(fSpace->sem, READ_COUNT, 0, 0); + + acquire_sem_etc(sAreaHashLock, READ_COUNT, 0, 0); + area = (vm_area *)hash_lookup(sAreaHash, &areaID); + release_sem_etc(sAreaHashLock, READ_COUNT, 0); + + if (area == NULL || area->address_space != fSpace) { + release_sem_etc(fSpace->sem, READ_COUNT, 0); + return B_BAD_VALUE; + } + + fLocked = true; + return B_OK; +} + + +void +AddressSpaceReadLocker::Unlock() +{ + if (fLocked) { + release_sem_etc(fSpace->sem, READ_COUNT, 0); + fLocked = false; + } +} + + +// #pragma mark - + + +AddressSpaceWriteLocker::AddressSpaceWriteLocker(team_id team) + : + fSpace(NULL), + fLocked(false), + fDegraded(false) +{ + SetTo(team); +} + + +AddressSpaceWriteLocker::AddressSpaceWriteLocker() + : + fSpace(NULL), + fLocked(false), + fDegraded(false) +{ +} + + +AddressSpaceWriteLocker::~AddressSpaceWriteLocker() +{ + Unset(); +} + + +void +AddressSpaceWriteLocker::Unset() +{ + Unlock(); + if (fSpace != NULL) + vm_put_address_space(fSpace); +} + + +status_t +AddressSpaceWriteLocker::SetTo(team_id team) +{ + fSpace = vm_get_address_space_by_id(team); + if (fSpace == NULL) + return B_BAD_TEAM_ID; + + acquire_sem_etc(fSpace->sem, WRITE_COUNT, 0, 0); + fLocked = true; + return B_OK; +} + + +status_t +AddressSpaceWriteLocker::SetFromArea(area_id areaID, vm_area*& area) +{ + fSpace = get_address_space_by_area_id(areaID); + if (fSpace == NULL) + return B_BAD_VALUE; + + acquire_sem_etc(fSpace->sem, WRITE_COUNT, 0, 0); + + acquire_sem_etc(sAreaHashLock, READ_COUNT, 0, 0); + area = (vm_area*)hash_lookup(sAreaHash, &areaID); + release_sem_etc(sAreaHashLock, READ_COUNT, 0); + + if (area == NULL || area->address_space != fSpace) { + release_sem_etc(fSpace->sem, WRITE_COUNT, 0); + return B_BAD_VALUE; + } + + fLocked = true; + return B_OK; +} + + +status_t +AddressSpaceWriteLocker::SetFromArea(team_id team, area_id areaID, + bool allowKernel, vm_area*& area) +{ + acquire_sem_etc(sAreaHashLock, READ_COUNT, 0, 0); + + area = (vm_area *)hash_lookup(sAreaHash, &areaID); + if (area != NULL + && (area->address_space->id == team + || allowKernel && team == vm_kernel_address_space_id())) { + fSpace = area->address_space; + atomic_add(&fSpace->ref_count, 1); + } + + release_sem_etc(sAreaHashLock, READ_COUNT, 0); + + if (fSpace == NULL) + return B_BAD_VALUE; + + // Second try to get the area -- this time with the address space + // write lock held + + acquire_sem_etc(fSpace->sem, WRITE_COUNT, 0, 0); + + acquire_sem_etc(sAreaHashLock, READ_COUNT, 0, 0); + area = (vm_area *)hash_lookup(sAreaHash, &areaID); + release_sem_etc(sAreaHashLock, READ_COUNT, 0); + + if (area == NULL) { + release_sem_etc(fSpace->sem, WRITE_COUNT, 0); + return B_BAD_VALUE; + } + + fLocked = true; + return B_OK; +} + + +status_t +AddressSpaceWriteLocker::SetFromArea(team_id team, area_id areaID, + vm_area*& area) +{ + return SetFromArea(team, areaID, false, area); +} + + +void +AddressSpaceWriteLocker::Unlock() +{ + if (fLocked) { + release_sem_etc(fSpace->sem, fDegraded ? READ_COUNT : WRITE_COUNT, 0); + fLocked = false; + } +} + + +void +AddressSpaceWriteLocker::DegradeToReadLock() +{ + release_sem_etc(fSpace->sem, WRITE_COUNT - READ_COUNT, 0); + fDegraded = true; +} + + +// #pragma mark - + + +MultiAddressSpaceLocker::MultiAddressSpaceLocker() + : + fSpaces(NULL), + fCapacity(0), + fCount(0), + fLocked(false) +{ +} + + +MultiAddressSpaceLocker::~MultiAddressSpaceLocker() +{ + Unset(); + free(fSpaces); +} + + +/*static*/ int +MultiAddressSpaceLocker::_CompareItems(const void* _a, const void* _b) +{ + vm_address_space* a = *(vm_address_space **)_a; + vm_address_space* b = *(vm_address_space **)_b; + return a->id - b->id; +} + + +bool +MultiAddressSpaceLocker::_ResizeIfNeeded() +{ + if (fCount == fCapacity) { + vm_address_space** items = (vm_address_space**)realloc(fSpaces, + (fCapacity + 4) * sizeof(void*)); + if (items == NULL) + return false; + + fCapacity += 4; + fSpaces = items; + } + + return true; +} + + +status_t +MultiAddressSpaceLocker::AddTeam(team_id team, vm_address_space** _space) +{ + if (!_ResizeIfNeeded()) + return B_NO_MEMORY; + + vm_address_space*& space = _CurrentItem(); + space = vm_get_address_space_by_id(team); + if (space == NULL) + return B_BAD_VALUE; + + fCount++; + + if (_space != NULL) + *_space = space; + + return B_OK; +} + + +status_t +MultiAddressSpaceLocker::AddArea(area_id area, vm_address_space** _space) +{ + if (!_ResizeIfNeeded()) + return B_NO_MEMORY; + + vm_address_space*& space = _CurrentItem(); + space = get_address_space_by_area_id(area); + if (space == NULL) + return B_BAD_VALUE; + + // check if we have already added this address space + for (int32 i = 0; i < fCount; i++) { + if (fSpaces[i] == space) { + // no need to add it again + vm_put_address_space(space); + if (_space != NULL) + *_space = space; + return B_OK; + } + } + + fCount++; + + if (_space != NULL) + *_space = space; + + return B_OK; +} + + +void +MultiAddressSpaceLocker::Unset() +{ + Unlock(); + + for (int32 i = 0; i < fCount; i++) { + vm_put_address_space(fSpaces[i]); + } + + fCount = 0; +} + + +status_t +MultiAddressSpaceLocker::Lock() +{ + qsort(fSpaces, fCount, sizeof(void*), &_CompareItems); + + for (int32 i = 0; i < fCount; i++) { + status_t status = acquire_sem_etc(fSpaces[i]->sem, WRITE_COUNT, 0, 0); + if (status < B_OK) { + while (--i >= 0) { + release_sem_etc(fSpaces[i]->sem, WRITE_COUNT, 0); + } + return status; + } + } + + fLocked = true; + return B_OK; +} + + +void +MultiAddressSpaceLocker::Unlock() +{ + if (!fLocked) + return; + + for (int32 i = 0; i < fCount; i++) { + release_sem_etc(fSpaces[i]->sem, WRITE_COUNT, 0); + } + + fLocked = false; +} + + +// #pragma mark - + + static int area_compare(void *_area, const void *key) { @@ -100,14 +539,34 @@ } +static vm_address_space * +get_address_space_by_area_id(area_id id) +{ + vm_address_space* addressSpace = NULL; + + acquire_sem_etc(sAreaHashLock, READ_COUNT, 0, 0); + + vm_area *area = (vm_area *)hash_lookup(sAreaHash, &id); + if (area != NULL) { + addressSpace = area->address_space; + atomic_add(&addressSpace->ref_count, 1); + } + + release_sem_etc(sAreaHashLock, READ_COUNT, 0); + + return addressSpace; +} + + +//! You need to have the address space locked when calling this function static vm_area * -vm_get_area(area_id id) +lookup_area(vm_address_space* addressSpace, area_id id) { acquire_sem_etc(sAreaHashLock, READ_COUNT, 0, 0); vm_area *area = (vm_area *)hash_lookup(sAreaHash, &id); - if (area != NULL) - atomic_add(&area->ref_count, 1); + if (area != NULL && area->address_space != addressSpace) + area = NULL; release_sem_etc(sAreaHashLock, READ_COUNT, 0); @@ -158,7 +617,6 @@ area->protection = protection; area->wiring = wiring; area->memory_type = 0; - area->ref_count = 1; area->cache = NULL; area->no_cache_change = 0; @@ -496,18 +954,22 @@ } -//! You need to hold the lock of the cache when calling this function. +/*! You need to hold the lock of the cache and the write lock of the address + space when calling this function. +*/ static status_t map_backing_store(vm_address_space *addressSpace, vm_cache *cache, void **_virtualAddress, off_t offset, addr_t size, uint32 addressSpec, - int wiring, int protection, int mapping, vm_area **_area, const char *areaName) + int wiring, int protection, int mapping, vm_area **_area, + const char *areaName) { TRACE(("map_backing_store: aspace %p, cache %p, *vaddr %p, offset 0x%Lx, size %lu, addressSpec %ld, wiring %d, protection %d, _area %p, area_name '%s'\n", addressSpace, cache, *_virtualAddress, offset, size, addressSpec, wiring, protection, _area, areaName)); ASSERT_LOCKED_MUTEX(&cache->lock); - vm_area *area = create_area_struct(addressSpace, areaName, wiring, protection); + vm_area *area = create_area_struct(addressSpace, areaName, wiring, + protection); if (area == NULL) return B_NO_MEMORY; @@ -521,8 +983,8 @@ vm_store *newStore; // create an anonymous store object - newStore = vm_store_create_anonymous_noswap((protection & B_STACK_AREA) != 0, - 0, USER_STACK_GUARD_PAGES); + newStore = vm_store_create_anonymous_noswap( + (protection & B_STACK_AREA) != 0, 0, USER_STACK_GUARD_PAGES); if (newStore == NULL) { status = B_NO_MEMORY; goto err1; @@ -551,19 +1013,17 @@ if (status != B_OK) goto err2; - acquire_sem_etc(addressSpace->sem, WRITE_COUNT, 0, 0); - // check to see if this address space has entered DELETE state if (addressSpace->state == VM_ASPACE_STATE_DELETION) { // okay, someone is trying to delete this address space now, so we can't // insert the area, so back out status = B_BAD_TEAM_ID; - goto err3; + goto err2; } status = insert_area(addressSpace, _virtualAddress, addressSpec, size, area); if (status < B_OK) - goto err3; + goto err2; // attach the cache to the area area->cache = cache; @@ -582,13 +1042,9 @@ // grab a ref to the address space (the area holds this) atomic_add(&addressSpace->ref_count, 1); - release_sem_etc(addressSpace->sem, WRITE_COUNT, 0); - *_area = area; return B_OK; -err3: - release_sem_etc(addressSpace->sem, WRITE_COUNT, 0); err2: if (mapping == REGION_PRIVATE_MAP) { // we created this cache, so we must delete it again @@ -605,27 +1061,21 @@ status_t vm_unreserve_address_range(team_id team, void *address, addr_t size) { - vm_address_space *addressSpace; - vm_area *area, *last = NULL; - status_t status = B_OK; - - addressSpace = vm_get_address_space_by_id(team); - if (addressSpace == NULL) + AddressSpaceWriteLocker locker(team); + if (!locker.IsLocked()) return B_BAD_TEAM_ID; - acquire_sem_etc(addressSpace->sem, WRITE_COUNT, 0, 0); - // check to see if this address space has entered DELETE state - if (addressSpace->state == VM_ASPACE_STATE_DELETION) { + if (locker.AddressSpace()->state == VM_ASPACE_STATE_DELETION) { // okay, someone is trying to delete this address space now, so we can't // insert the area, so back out - status = B_BAD_TEAM_ID; - goto out; + return B_BAD_TEAM_ID; } // search area list and remove any matching reserved ranges - area = addressSpace->areas; + vm_area* area = locker.AddressSpace()->areas; + vm_area* last = NULL; while (area) { // the area must be completely part of the reserved range if (area->id == RESERVED_AREA_ID && area->base >= (addr_t)address @@ -635,10 +1085,10 @@ if (last) last->address_space_next = reserved->address_space_next; else - addressSpace->areas = reserved->address_space_next; + locker.AddressSpace()->areas = reserved->address_space_next; area = reserved->address_space_next; - vm_put_address_space(addressSpace); + vm_put_address_space(locker.AddressSpace()); free(reserved); continue; } @@ -646,11 +1096,8 @@ last = area; area = area->address_space_next; } - -out: - release_sem_etc(addressSpace->sem, WRITE_COUNT, 0); - vm_put_address_space(addressSpace); - return status; + + return B_OK; } @@ -658,56 +1105,42 @@ vm_reserve_address_range(team_id team, void **_address, uint32 addressSpec, addr_t size, uint32 flags) { - vm_address_space *addressSpace; - vm_area *area; - status_t status = B_OK; - if (size == 0) return B_BAD_VALUE; - addressSpace = vm_get_address_space_by_id(team); - if (addressSpace == NULL) + AddressSpaceWriteLocker locker(team); + if (!locker.IsLocked()) return B_BAD_TEAM_ID; - area = create_reserved_area_struct(addressSpace, flags); - if (area == NULL) { - status = B_NO_MEMORY; - goto err1; + // check to see if this address space has entered DELETE state + if (locker.AddressSpace()->state == VM_ASPACE_STATE_DELETION) { + // okay, someone is trying to delete this address space now, so we + // can't insert the area, let's back out + return B_BAD_TEAM_ID; } - acquire_sem_etc(addressSpace->sem, WRITE_COUNT, 0, 0); + vm_area *area = create_reserved_area_struct(locker.AddressSpace(), flags); + if (area == NULL) + return B_NO_MEMORY; - // check to see if this address space has entered DELETE state - if (addressSpace->state == VM_ASPACE_STATE_DELETION) { - // okay, someone is trying to delete this address space now, so we can't - // insert the area, let's back out - status = B_BAD_TEAM_ID; - goto err2; + status_t status = insert_area(locker.AddressSpace(), _address, addressSpec, + size, area); + if (status < B_OK) { + free(area); + return status; } - status = insert_area(addressSpace, _address, addressSpec, size, area); - if (status < B_OK) - goto err2; - // the area is now reserved! area->cache_offset = area->base; // we cache the original base address here - release_sem_etc(addressSpace->sem, WRITE_COUNT, 0); return B_OK; - -err2: - release_sem_etc(addressSpace->sem, WRITE_COUNT, 0); - free(area); -err1: - vm_put_address_space(addressSpace); - return status; } area_id -vm_create_anonymous_area(team_id aid, const char *name, void **address, +vm_create_anonymous_area(team_id team, const char *name, void **address, uint32 addressSpec, addr_t size, uint32 wiring, uint32 protection) { vm_area *area; @@ -716,7 +1149,6 @@ vm_page *page = NULL; bool isStack = (protection & B_STACK_AREA) != 0; bool canOvercommit = false; - status_t status; TRACE(("create_anonymous_area %s: size 0x%lx\n", name, size)); @@ -761,20 +1193,20 @@ return B_BAD_VALUE; } - vm_address_space *addressSpace = vm_get_address_space_by_id(aid); - if (addressSpace == NULL) - return B_BAD_TEAM_ID; + AddressSpaceWriteLocker locker; + status_t status = locker.SetTo(team); + if (status != NULL) + return status; + vm_address_space *addressSpace = locker.AddressSpace(); size = PAGE_ALIGN(size); if (wiring == B_CONTIGUOUS) { // we try to allocate the page run here upfront as this may easily // fail for obvious reasons page = vm_page_allocate_page_run(PAGE_STATE_CLEAR, size / B_PAGE_SIZE); - if (page == NULL) { - vm_put_address_space(addressSpace); + if (page == NULL) return B_NO_MEMORY; - } } // create an anonymous store object @@ -820,6 +1252,8 @@ goto err1; } + locker.DegradeToReadLock(); + switch (wiring) { case B_NO_LOCK: case B_LAZY_LOCK: @@ -938,7 +1372,6 @@ default: break; } - vm_put_address_space(addressSpace); TRACE(("vm_create_anonymous_area: done\n")); @@ -961,31 +1394,28 @@ } } - vm_put_address_space(addressSpace); return status; } area_id -vm_map_physical_memory(team_id aspaceID, const char *name, void **_address, +vm_map_physical_memory(team_id team, const char *name, void **_address, uint32 addressSpec, addr_t size, uint32 protection, addr_t physicalAddress) { vm_area *area; vm_cache *cache; vm_store *store; addr_t mapOffset; - status_t status; - TRACE(("vm_map_physical_memory(aspace = %ld, \"%s\", virtual = %p, spec = %ld," - " size = %lu, protection = %ld, phys = %p)\n", - aspaceID, name, _address, addressSpec, size, protection, - (void *)physicalAddress)); + TRACE(("vm_map_physical_memory(aspace = %ld, \"%s\", virtual = %p, " + "spec = %ld, size = %lu, protection = %ld, phys = %#lx)\n", team, + name, _address, addressSpec, size, protection, physicalAddress)); if (!arch_vm_supports_protection(protection)) return B_NOT_SUPPORTED; - vm_address_space *addressSpace = vm_get_address_space_by_id(aspaceID); - if (addressSpace == NULL) + AddressSpaceWriteLocker locker(team); + if (!locker.IsLocked()) return B_BAD_TEAM_ID; // if the physical address is somewhat inside a page, @@ -999,14 +1429,13 @@ // create an device store object store = vm_store_create_device(physicalAddress); - if (store == NULL) { - status = B_NO_MEMORY; - goto err1; - } + if (store == NULL) + return B_NO_MEMORY; + cache = vm_cache_create(store); if (cache == NULL) { - status = B_NO_MEMORY; - goto err2; + store->ops->destroy(store); + return B_NO_MEMORY; } // tell the page scanner to skip over this area, it's pages are special @@ -1016,8 +1445,8 @@ mutex_lock(&cache->lock); - status = map_backing_store(addressSpace, cache, _address, 0, size, - addressSpec & ~B_MTR_MASK, B_FULL_LOCK, protection, + status_t status = map_backing_store(locker.AddressSpace(), cache, _address, + 0, size, addressSpec & ~B_MTR_MASK, B_FULL_LOCK, protection, REGION_NO_PRIVATE_MAP, &area, name); mutex_unlock(&cache->lock); @@ -1030,13 +1459,13 @@ status = arch_vm_set_memory_type(area, physicalAddress, addressSpec & B_MTR_MASK); if (status < B_OK) - vm_put_area(area); + delete_area(locker.AddressSpace(), area); } if (status >= B_OK) { // make sure our area is mapped in completely - vm_translation_map *map = &addressSpace->translation_map; + vm_translation_map *map = &locker.AddressSpace()->translation_map; map->ops->lock(map); for (addr_t offset = 0; offset < size; offset += B_PAGE_SIZE) { @@ -1047,7 +1476,6 @@ map->ops->unlock(map); } - vm_put_address_space(addressSpace); if (status < B_OK) return status; @@ -1057,12 +1485,6 @@ area->cache_type = CACHE_TYPE_DEVICE; return area->id; - -err2: - store->ops->destroy(store); -err1: - vm_put_address_space(addressSpace); - return status; } @@ -1075,8 +1497,8 @@ vm_store *store; status_t status; - vm_address_space *addressSpace = vm_get_address_space_by_id(team); - if (addressSpace == NULL) + AddressSpaceWriteLocker locker(team); + if (!locker.IsLocked()) return B_BAD_TEAM_ID; size = PAGE_ALIGN(size); @@ -1084,14 +1506,13 @@ // create an null store object store = vm_store_create_null(); - if (store == NULL) { - status = B_NO_MEMORY; - goto err1; - } + if (store == NULL) + return B_NO_MEMORY; + cache = vm_cache_create(store); if (cache == NULL) { - status = B_NO_MEMORY; - goto err2; + store->ops->destroy(store); + return B_NO_MEMORY; } // tell the page scanner to skip over this area, no pages will be mapped here @@ -1101,11 +1522,10 @@ mutex_lock(&cache->lock); - status = map_backing_store(addressSpace, cache, address, 0, size, addressSpec, 0, - B_KERNEL_READ_AREA, REGION_NO_PRIVATE_MAP, &area, name); + status = map_backing_store(locker.AddressSpace(), cache, address, 0, size, + addressSpec, 0, B_KERNEL_READ_AREA, REGION_NO_PRIVATE_MAP, &area, name); mutex_unlock(&cache->lock); - vm_put_address_space(addressSpace); if (status < B_OK) { vm_cache_release_ref(cache); @@ -1114,12 +1534,6 @@ area->cache_type = CACHE_TYPE_NULL; return area->id; - -err2: - store->ops->destroy(store); -err1: - vm_put_address_space(addressSpace); - return status; } @@ -1174,11 +1588,6 @@ // copy of a file at a given time, ie. later changes should not // make it into the mapped copy -- this will need quite some changes // to be done in a nice way - - vm_address_space *addressSpace = vm_get_address_space_by_id(team); - if (addressSpace == NULL) - return B_BAD_TEAM_ID; - TRACE(("_vm_map_file(\"%s\", offset = %Ld, size = %lu, mapping %ld)\n", path, offset, size, mapping)); @@ -1188,8 +1597,14 @@ // get the vnode for the object, this also grabs a ref to it status = vfs_get_vnode_from_path(path, kernel, &vnode); if (status < B_OK) - goto err1; + return status; + AddressSpaceWriteLocker locker(team); + if (!locker.IsLocked()) { + vfs_put_vnode(vnode); + return B_BAD_TEAM_ID; + } + // ToDo: this only works for file systems that use the file cache status = vfs_get_vnode_cache(vnode, &cache, false); @@ -1198,11 +1613,11 @@ // successful, the store already has a ref to it if (status < B_OK) - goto err1; + return status; mutex_lock(&cache->lock); - status = map_backing_store(addressSpace, cache, _address, + status = map_backing_store(locker.AddressSpace(), cache, _address, offset, size, addressSpec, 0, protection, mapping, &area, name); mutex_unlock(&cache->lock); @@ -1212,21 +1627,17 @@ vm_cache_release_ref(cache); } if (status < B_OK) - goto err1; + return status; - vm_put_address_space(addressSpace); area->cache_type = CACHE_TYPE_VNODE; return area->id; - -err1: - vm_put_address_space(addressSpace); [... truncated: 848 lines follow ...] From stippi at mail.berlios.de Wed Aug 8 11:14:39 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 8 Aug 2007 11:14:39 +0200 Subject: [Haiku-commits] r21849 - haiku/trunk/headers/posix Message-ID: <200708080914.l789EdsI012627@sheep.berlios.de> Author: stippi Date: 2007-08-08 11:14:38 +0200 (Wed, 08 Aug 2007) New Revision: 21849 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21849&view=rev Modified: haiku/trunk/headers/posix/math.h Log: * fix ticket #1365, isinf(x) -> isinf(value) Modified: haiku/trunk/headers/posix/math.h =================================================================== --- haiku/trunk/headers/posix/math.h 2007-08-07 21:46:58 UTC (rev 21848) +++ haiku/trunk/headers/posix/math.h 2007-08-08 09:14:38 UTC (rev 21849) @@ -251,7 +251,7 @@ : __isnanl(value)) /* returns non-zero if 'value is Inf */ -# define isinf(x) \ +# define isinf(value) \ (sizeof(value) == sizeof(float) ? __isinff(value) \ : sizeof(value) == sizeof(double) ? __isinf(value) \ : __isinfl(value)) From jackburton at mail.berlios.de Wed Aug 8 11:50:01 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Wed, 8 Aug 2007 11:50:01 +0200 Subject: [Haiku-commits] r21850 - haiku/trunk/src/apps/terminal Message-ID: <200708080950.l789o1sv014531@sheep.berlios.de> Author: jackburton Date: 2007-08-08 11:50:01 +0200 (Wed, 08 Aug 2007) New Revision: 21850 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21850&view=rev Modified: haiku/trunk/src/apps/terminal/SmartTabView.cpp haiku/trunk/src/apps/terminal/SmartTabView.h haiku/trunk/src/apps/terminal/TermWindow.cpp haiku/trunk/src/apps/terminal/TermWindow.h Log: Added a popup menu to the tabview: for now it only contains a "close tab" item. Note that you can also close the tab by clicking on it with the tertiary mouse button. Renamed some methods of TermWindow. I'm not really happy with this code (tab creation/deletion code is spread between TermWindow and SmartTabView), I will need to come up with something better. There are still some visual glitches when tabs are switched, created or deleted. Modified: haiku/trunk/src/apps/terminal/SmartTabView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/SmartTabView.cpp 2007-08-08 09:14:38 UTC (rev 21849) +++ haiku/trunk/src/apps/terminal/SmartTabView.cpp 2007-08-08 09:50:01 UTC (rev 21850) @@ -8,11 +8,16 @@ #include "SmartTabView.h" +#include #include +#include +#include #include #include +const static uint32 kCloseTab = 'ClTb'; + SmartTabView::SmartTabView(BRect frame, const char *name, button_width width, uint32 resizingMode, uint32 flags) : @@ -32,28 +37,49 @@ void SmartTabView::MouseDown(BPoint point) { - int32 buttons; - Window()->CurrentMessage()->FindInt32("buttons", &buttons); + bool handled = false; - if (CountTabs() > 1 && point.y <= TabHeight() && buttons & B_TERTIARY_MOUSE_BUTTON) { - for (int32 i = 0; i < CountTabs(); i++) { - if (TabFrame(i).Contains(point)) { - // Select another tab - if (i > 0) - Select(i - 1); - else if (i < CountTabs()) - Select(i + 1); - BTab *tab = RemoveTab(i); - delete tab; - return; + if (CountTabs() > 1) { + int32 tabIndex = _ClickedTabIndex(point); + if (tabIndex >= 0) { + int32 buttons; + Window()->CurrentMessage()->FindInt32("buttons", &buttons); + if (buttons & B_SECONDARY_MOUSE_BUTTON) { + BMessage *message = new BMessage(kCloseTab); + message->AddInt32("index", tabIndex); + + BPopUpMenu *popUpMenu = new BPopUpMenu("tab menu"); + popUpMenu->AddItem(new BMenuItem("Close Tab", message)); + popUpMenu->SetAsyncAutoDestruct(true); + popUpMenu->SetTargetForItems(BMessenger(this)); + + // TODO: I thought I'd get a "sticky" menu with this call... + // Bug in our implementation or I just have to use the "other" + // Go() method? + popUpMenu->Go(ConvertToScreen(point), true, true, true); + + handled = true; + } else if (buttons & B_TERTIARY_MOUSE_BUTTON) { + RemoveAndDeleteTab(tabIndex); + handled = true; } - } - } else + } + } + + if (!handled) BTabView::MouseDown(point); + } void +SmartTabView::AttachedToWindow() +{ + BTabView::AttachedToWindow(); +} + + +void SmartTabView::AllAttached() { BTabView::AllAttached(); @@ -61,6 +87,24 @@ void +SmartTabView::MessageReceived(BMessage *message) +{ + switch (message->what) { + case kCloseTab: + { + int32 tabIndex = 0; + if (message->FindInt32("index", &tabIndex) == B_OK) + RemoveAndDeleteTab(tabIndex); + break; + } + default: + BTabView::MessageReceived(message); + break; + } +} + + +void SmartTabView::Select(int32 index) { BTabView::Select(index); @@ -72,6 +116,21 @@ void +SmartTabView::RemoveAndDeleteTab(int32 index) +{ + // Select another tab + if (index == Selection()) { + if (index > 0) + Select(index - 1); + else if (index < CountTabs()) + Select(index + 1); + } + BTab *tab = RemoveTab(index); + delete tab; +} + + +void SmartTabView::AddTab(BView *target, BTab *tab) { if (target == NULL) @@ -108,3 +167,17 @@ } +int32 +SmartTabView::_ClickedTabIndex(const BPoint &point) +{ + if (point.y <= TabHeight()) { + for (int32 i = 0; i < CountTabs(); i++) { + if (TabFrame(i).Contains(point)) + return i; + } + } + + return -1; +} + + Modified: haiku/trunk/src/apps/terminal/SmartTabView.h =================================================================== --- haiku/trunk/src/apps/terminal/SmartTabView.h 2007-08-08 09:14:38 UTC (rev 21849) +++ haiku/trunk/src/apps/terminal/SmartTabView.h 2007-08-08 09:50:01 UTC (rev 21850) @@ -10,6 +10,7 @@ #include +class BPopUpMenu; class SmartTabView : public BTabView { public: SmartTabView(BRect frame, const char *name, @@ -22,13 +23,22 @@ virtual void MouseDown(BPoint where); + virtual void AttachedToWindow(); virtual void AllAttached(); + + virtual void MessageReceived(BMessage *message); + virtual void Select(int32 tab); + void RemoveAndDeleteTab(int32 index); + virtual void AddTab(BView *target, BTab *tab = NULL); virtual BTab* RemoveTab(int32 index); virtual BRect DrawTabs(); + +private: + int32 _ClickedTabIndex(const BPoint &point); }; #endif // __SMARTTABVIEW_H Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.cpp 2007-08-08 09:14:38 UTC (rev 21849) +++ haiku/trunk/src/apps/terminal/TermWindow.cpp 2007-08-08 09:50:01 UTC (rev 21850) @@ -116,7 +116,7 @@ fTabView = new SmartTabView(textFrame, "tab view"); AddChild(fTabView); - _NewTab(command); + _AddTab(command); } @@ -202,8 +202,7 @@ void TermWindow::MessageReceived(BMessage *message) { - int32 coding_id; - BRect r; + int32 encodingId; BFont halfFont; BFont fullFont; bool findresult; @@ -225,28 +224,24 @@ _ActiveTermView()->Clear(); break; - case MENU_SWITCH_TERM: { + case MENU_SWITCH_TERM: be_app->PostMessage(MENU_SWITCH_TERM); break; - } + case kNewTab: - _NewTab(NULL); + _AddTab(NULL); break; case kCloseView: - { // TODO: We assume that this message was sent from the current active tab. // Since the implementation of BTabView uses AddChild/RemoveChild on the // views, the current active tab is the only one who is attached, thus - // the only one which could send a message. - if (fTabView->CountTabs() > 1) - delete fTabView->RemoveTab(fTabView->Selection()); - else - PostMessage(B_QUIT_REQUESTED); + // the only one which could send a message. Change this. + _RemoveTab(fTabView->Selection()); break; - } - case MENU_NEW_TERM: { + case MENU_NEW_TERM: + { app_info info; be_app->GetAppInfo(&info); @@ -255,18 +250,18 @@ be_roster->Launch(TERM_SIGNATURE); break; } - case MENU_PREF_OPEN: { + case MENU_PREF_OPEN: if (!fPrefWindow) fPrefWindow = new PrefWindow(this); else fPrefWindow->Activate(); break; - } - case MSG_PREF_CLOSED: { + + case MSG_PREF_CLOSED: fPrefWindow = NULL; break; - } - case MENU_FIND_STRING: { + + case MENU_FIND_STRING: if (!fFindPanel) { BRect r = Frame(); r.left += 20; @@ -278,8 +273,8 @@ else fFindPanel->Activate(); break; - } - case MSG_FIND: { + + case MSG_FIND: fFindPanel->PostMessage(B_QUIT_REQUESTED); message->FindBool("findselection", &fFindSelection); if (!fFindSelection) @@ -314,8 +309,8 @@ fFindBackwardMenuItem->SetEnabled(true); fFindForwardMenuItem->SetEnabled(true); break; - } - case MENU_FIND_FORWARD: { + + case MENU_FIND_FORWARD: findresult = _ActiveTermView()->Find(fFindString, true, fMatchCase, fMatchWord); if (!findresult) { BAlert *alert = new BAlert("find failed", "Not Found.", "Okay", NULL, @@ -323,8 +318,8 @@ alert->Go(); } break; - } - case MENU_FIND_BACKWARD: { + + case MENU_FIND_BACKWARD: findresult = _ActiveTermView()->Find(fFindString, false, fMatchCase, fMatchWord); if (!findresult) { BAlert *alert = new BAlert("find failed", "Not Found.", "Okay", NULL, @@ -332,25 +327,25 @@ alert->Go(); } break; - } + case MSG_FIND_CLOSED: fFindPanel = NULL; break; - case MENU_ENCODING: { - message->FindInt32 ("op", &coding_id); - _ActiveTermView()->SetEncoding(coding_id); + case MENU_ENCODING: + if (message->FindInt32("op", &encodingId) == B_OK) + _ActiveTermView()->SetEncoding(encodingId); break; - } // Message from Preference panel. case MSG_ROWS_CHANGED: - case MSG_COLS_CHANGED: { - r = _ActiveTermView()->SetTermSize (PrefHandler::Default()->getInt32 (PREF_ROWS), + case MSG_COLS_CHANGED: + { + BRect rect = _ActiveTermView()->SetTermSize(PrefHandler::Default()->getInt32 (PREF_ROWS), PrefHandler::Default()->getInt32 (PREF_COLS), 0); - ResizeTo (r.Width()+ B_V_SCROLL_BAR_WIDTH + kViewOffset * 2, - r.Height()+fMenubar->Bounds().Height() + kViewOffset *2); + ResizeTo (rect.Width()+ B_V_SCROLL_BAR_WIDTH + kViewOffset * 2, + rect.Height()+fMenubar->Bounds().Height() + kViewOffset *2); BPath path; if (PrefHandler::GetDefaultPath(path) == B_OK) @@ -360,7 +355,8 @@ case MSG_HALF_FONT_CHANGED: case MSG_FULL_FONT_CHANGED: case MSG_HALF_SIZE_CHANGED: - case MSG_FULL_SIZE_CHANGED: { + case MSG_FULL_SIZE_CHANGED: + { halfFont.SetFamilyAndStyle (PrefHandler::Default()->getString(PREF_HALF_FONT_FAMILY),NULL); halfFont.SetSize (PrefHandler::Default()->getFloat(PREF_HALF_FONT_SIZE)); @@ -371,52 +367,51 @@ fullFont.SetSpacing (B_FIXED_SPACING); _ActiveTermView()->SetTermFont (&halfFont, &fullFont); - r = _ActiveTermView()->SetTermSize (0, 0, 0); + BRect rect = _ActiveTermView()->SetTermSize (0, 0, 0); int width, height; + _ActiveTermView()->GetFontSize(&width, &height); - _ActiveTermView()->GetFontSize (&width, &height); - SetSizeLimits (MIN_COLS * width, MAX_COLS * width, MIN_COLS * height, MAX_COLS * height); - ResizeTo (r.Width()+ B_V_SCROLL_BAR_WIDTH + kViewOffset * 2, - r.Height()+fMenubar->Bounds().Height() + kViewOffset * 2); + ResizeTo(rect.Width()+ B_V_SCROLL_BAR_WIDTH + kViewOffset * 2, + rect.Height()+fMenubar->Bounds().Height() + kViewOffset * 2); _ActiveTermView()->Invalidate(); break; } - case EIGHTYTWENTYFOUR: { + case EIGHTYTWENTYFOUR: PrefHandler::Default()->setString(PREF_COLS, "80"); PrefHandler::Default()->setString(PREF_ROWS, "24"); PostMessage (MSG_COLS_CHANGED); break; - } - case EIGHTYTWENTYFIVE: { + + case EIGHTYTWENTYFIVE: PrefHandler::Default()->setString(PREF_COLS, "80"); PrefHandler::Default()->setString(PREF_ROWS, "25"); PostMessage (MSG_COLS_CHANGED); break; - } - case EIGHTYFORTY: { + + case EIGHTYFORTY: PrefHandler::Default()->setString(PREF_COLS, "80"); PrefHandler::Default()->setString(PREF_ROWS, "40"); PostMessage (MSG_COLS_CHANGED); break; - } - case ONETHREETWOTWENTYFOUR: { + + case ONETHREETWOTWENTYFOUR: PrefHandler::Default()->setString(PREF_COLS, "132"); PrefHandler::Default()->setString(PREF_ROWS, "24"); PostMessage (MSG_COLS_CHANGED); break; - } - case ONETHREETWOTWENTYFIVE: { + + case ONETHREETWOTWENTYFIVE: PrefHandler::Default()->setString(PREF_COLS, "132"); PrefHandler::Default()->setString(PREF_ROWS, "25"); PostMessage (MSG_COLS_CHANGED); break; - } - case FULLSCREEN: { + + case FULLSCREEN: if (!fSavedFrame.IsValid()) { // go fullscreen float mbHeight = fMenubar->Bounds().Height() + 1; fSavedFrame = Frame(); @@ -440,39 +435,38 @@ fSavedFrame = BRect(0,0,-1,-1); } break; - } - case MSG_FONT_CHANGED: { + + case MSG_FONT_CHANGED: PostMessage(MSG_HALF_FONT_CHANGED); break; - } - case MSG_COLOR_CHANGED: { + + case MSG_COLOR_CHANGED: _SetTermColors(); _ActiveTermView()->Invalidate(); break; - } - case SAVE_AS_DEFAULT: { + + case SAVE_AS_DEFAULT: + { BPath path; if (PrefHandler::GetDefaultPath(path) == B_OK) PrefHandler::Default()->SaveAsText(path.Path(), PREFFILE_MIMETYPE); break; } - case MENU_PAGE_SETUP: { + case MENU_PAGE_SETUP: _DoPageSetup(); break; - } - case MENU_PRINT: { + + case MENU_PRINT: _DoPrint(); break; - } - case B_ABOUT_REQUESTED: { + case B_ABOUT_REQUESTED: be_app->PostMessage(B_ABOUT_REQUESTED); break; - } - default: { + + default: BWindow::MessageReceived(message); break; - } } } @@ -567,7 +561,7 @@ void -TermWindow::_NewTab(const char *command) +TermWindow::_AddTab(const char *command) { // Setup font. @@ -628,6 +622,16 @@ } +void +TermWindow::_RemoveTab(int32 index) +{ + if (fTabView->CountTabs() > 1) + delete fTabView->RemoveTab(fTabView->Selection()); + else + PostMessage(B_QUIT_REQUESTED); +} + + TermView * TermWindow::_ActiveTermView() { Modified: haiku/trunk/src/apps/terminal/TermWindow.h =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.h 2007-08-08 09:14:38 UTC (rev 21849) +++ haiku/trunk/src/apps/terminal/TermWindow.h 2007-08-08 09:50:01 UTC (rev 21850) @@ -59,7 +59,8 @@ void _SetupMenu(); status_t _DoPageSetup(); void _DoPrint(); - void _NewTab(const char *command); + void _AddTab(const char *command); + void _RemoveTab(int32 index); TermView* _ActiveTermView(); SmartTabView *fTabView; From nielx at mail.berlios.de Wed Aug 8 12:29:30 2007 From: nielx at mail.berlios.de (nielx at BerliOS) Date: Wed, 8 Aug 2007 12:29:30 +0200 Subject: [Haiku-commits] r21851 - in haiku/trunk/docs/user: . app Message-ID: <200708081029.l78ATUrT016724@sheep.berlios.de> Author: nielx Date: 2007-08-08 12:29:30 +0200 (Wed, 08 Aug 2007) New Revision: 21851 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21851&view=rev Added: haiku/trunk/docs/user/app/ haiku/trunk/docs/user/app/_app_intro.dox Modified: haiku/trunk/docs/user/Doxyfile haiku/trunk/docs/user/book.dox Log: Create framework for Application Kit. Modified: haiku/trunk/docs/user/Doxyfile =================================================================== --- haiku/trunk/docs/user/Doxyfile 2007-08-08 09:50:01 UTC (rev 21850) +++ haiku/trunk/docs/user/Doxyfile 2007-08-08 10:29:30 UTC (rev 21851) @@ -463,10 +463,12 @@ # with spaces. INPUT = . \ + app \ drivers \ midi \ midi2 \ support \ + ../../headers/os/app \ ../../headers/os/drivers/fs_interface.h \ ../../headers/os/drivers/USB3.h \ ../../headers/os/drivers/USB_spec.h \ Added: haiku/trunk/docs/user/app/_app_intro.dox =================================================================== --- haiku/trunk/docs/user/app/_app_intro.dox 2007-08-08 09:50:01 UTC (rev 21850) +++ haiku/trunk/docs/user/app/_app_intro.dox 2007-08-08 10:29:30 UTC (rev 21851) @@ -0,0 +1,40 @@ +/* + * Copyright 2007, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Documentation by: + * Niels Sascha Reedijk + */ + + +/*! + \page app_intro Introduction to the Application Kit. + + The Application Kit is a kit you will have to get to know in case you + want to effectively write Haiku applications with a GUI. The application + kit does exactly as the name might inform you: it is the basis for Haiku + applications. It is advised to read through this document, and the + documents referenced before going to any other part of the API. + + We can divide the classes in the application kit up in two categories. The + biggest part of the classes are in the 'messaging' classes. The following + are part of it: + - BHandler + - BInvoker + - BLooper + - BMessage + - BMessageFilter + - BMessageQueue + - BMessageRUnner + - BMessenger + + The second category is the 'system interaction' category. These classes + provides hooks for you application to interact with the rest of the system. + The most important class is BApplication. This is a list of all the + classes: + - BApplication + - BClipboard + - BCursor + - BPropertyInfo + - BRoster +*/ \ No newline at end of file Modified: haiku/trunk/docs/user/book.dox =================================================================== --- haiku/trunk/docs/user/book.dox 2007-08-08 09:50:01 UTC (rev 21850) +++ haiku/trunk/docs/user/book.dox 2007-08-08 10:29:30 UTC (rev 21851) @@ -3,6 +3,7 @@ \section kits Kits and Servers + - \ref app | \link app_intro \em Introduction \endlink - \ref drivers - \ref midi1 - \ref midi2 | \link midi2_intro \em Introduction \endlink From stippi at mail.berlios.de Wed Aug 8 20:29:10 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 8 Aug 2007 20:29:10 +0200 Subject: [Haiku-commits] r21852 - haiku/trunk/src/servers/app Message-ID: <200708081829.l78ITAPB008962@sheep.berlios.de> Author: stippi Date: 2007-08-08 20:29:09 +0200 (Wed, 08 Aug 2007) New Revision: 21852 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21852&view=rev Modified: haiku/trunk/src/servers/app/DrawState.cpp haiku/trunk/src/servers/app/DrawState.h Log: * added a way to get the unscaled pensize (ie that of the current draw state of a view) Modified: haiku/trunk/src/servers/app/DrawState.cpp =================================================================== --- haiku/trunk/src/servers/app/DrawState.cpp 2007-08-08 10:29:30 UTC (rev 21851) +++ haiku/trunk/src/servers/app/DrawState.cpp 2007-08-08 18:29:09 UTC (rev 21852) @@ -496,6 +496,18 @@ } +//! returns the unscaled pen size +float +DrawState::UnscaledPenSize() const +{ + // NOTE: As documented in the BeBook, + // pen size is never smaller than 1.0. + // This is supposed to be the smallest + // possible device size. + return max_c(fPenSize, 1.0); +} + + //! sets the font to be already scaled by fScale void DrawState::SetFont(const ServerFont& font, uint32 flags) Modified: haiku/trunk/src/servers/app/DrawState.h =================================================================== --- haiku/trunk/src/servers/app/DrawState.h 2007-08-08 10:29:30 UTC (rev 21851) +++ haiku/trunk/src/servers/app/DrawState.h 2007-08-08 18:29:09 UTC (rev 21852) @@ -108,6 +108,7 @@ void SetPenSize(float size); float PenSize() const; + float UnscaledPenSize() const; // font void SetFont(const ServerFont& font, From stippi at mail.berlios.de Wed Aug 8 20:30:28 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 8 Aug 2007 20:30:28 +0200 Subject: [Haiku-commits] r21853 - haiku/trunk/src/servers/app/drawing Message-ID: <200708081830.l78IUSoH009100@sheep.berlios.de> Author: stippi Date: 2007-08-08 20:30:28 +0200 (Wed, 08 Aug 2007) New Revision: 21853 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21853&view=rev Modified: haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp Log: * make sure that the pattern used for line arrays is B_SOLID_HIGH and that the previous pattern is restored after execution Modified: haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp 2007-08-08 18:29:09 UTC (rev 21852) +++ haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp 2007-08-08 18:30:28 UTC (rev 21853) @@ -1002,8 +1002,13 @@ data = (const LineArrayData *)&(linedata[0]); + // store current graphics state, we mess with the + // high color and pattern... rgb_color oldColor = fPainter->HighColor(); + struct pattern pattern = fPainter->Pattern(); + fPainter->SetHighColor(data->color); + fPainter->SetPattern(B_SOLID_HIGH); fPainter->StrokeLine(data->pt1, data->pt2); for (int32 i = 1; i < numLines; i++) { @@ -1012,8 +1017,9 @@ fPainter->StrokeLine(data->pt1, data->pt2); } - // restore correct drawing state highcolor + // restore correct drawing state highcolor and pattern fPainter->SetHighColor(oldColor); + fPainter->SetPattern(pattern); fGraphicsCard->Invalidate(touched); if (cursorTouched) From laplace at mail.berlios.de Wed Aug 8 20:33:59 2007 From: laplace at mail.berlios.de (laplace at BerliOS) Date: Wed, 8 Aug 2007 20:33:59 +0200 Subject: [Haiku-commits] r21854 - haiku/trunk/src/add-ons/print/drivers/pcl6 Message-ID: <200708081833.l78IXxmX009295@sheep.berlios.de> Author: laplace Date: 2007-08-08 20:33:59 +0200 (Wed, 08 Aug 2007) New Revision: 21854 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21854&view=rev Modified: haiku/trunk/src/add-ons/print/drivers/pcl6/PCL6.cpp Log: Bug #1092 (PCL6: Second page upside down in duplex mode) fixed by Dr. Hartmut Reh. Modified: haiku/trunk/src/add-ons/print/drivers/pcl6/PCL6.cpp =================================================================== --- haiku/trunk/src/add-ons/print/drivers/pcl6/PCL6.cpp 2007-08-08 18:30:28 UTC (rev 21853) +++ haiku/trunk/src/add-ons/print/drivers/pcl6/PCL6.cpp 2007-08-08 18:33:59 UTC (rev 21854) @@ -233,8 +233,9 @@ if (getJobData()->getPrintStyle() == JobData::kSimplex) { fWriter->BeginPage(orientation, mediaSize, mediaSource); } else if (getJobData()->getPrintStyle() == JobData::kDuplex) { + // TODO move duplex binding option to UI fWriter->BeginPage(orientation, mediaSize, mediaSource, - PCL6Writer::kDuplexHorizontalBinding, fMediaSide); + PCL6Writer::kDuplexVerticalBinding, fMediaSide); if (fMediaSide == PCL6Writer::kFrontMediaSide) { fMediaSide = PCL6Writer::kBackMediaSide; From stippi at mail.berlios.de Wed Aug 8 20:36:23 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 8 Aug 2007 20:36:23 +0200 Subject: [Haiku-commits] r21855 - haiku/trunk/src/servers/app Message-ID: <200708081836.l78IaNJ0009480@sheep.berlios.de> Author: stippi Date: 2007-08-08 20:36:23 +0200 (Wed, 08 Aug 2007) New Revision: 21855 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21855&view=rev Modified: haiku/trunk/src/servers/app/ServerPicture.cpp haiku/trunk/src/servers/app/ServerWindow.cpp Log: * convert shape coordinates to screen at the time of playing the picture (fixes ticket #1367, stefano I thought you knew that I meant this in an earlier mail) * move_pen_by() looked wrong in ServerPicture, have not tested though * make sure the pen location is adjusted after stroke_line() and draw_string() in ServerPicture * set_pen_location() does not need to update the Painter drawing state * ServerWindow AS_LAYER_SET_PEN_SIZE needs to set the resulting pen size of the drawing state stack, not the one set on the current state * ServerWindow AS_LAYER_GET_PEN_SIZE needs to return the current state's size, not the result of the stack * small cleanups Modified: haiku/trunk/src/servers/app/ServerPicture.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerPicture.cpp 2007-08-08 18:33:59 UTC (rev 21854) +++ haiku/trunk/src/servers/app/ServerPicture.cpp 2007-08-08 18:36:23 UTC (rev 21855) @@ -128,6 +128,7 @@ for(i = (ptCount - 1);i >= 0;i--) { ptList[i] = fPtStack.top(); fPtStack.pop(); + view->ConvertToScreenForDrawing(&ptList[i]); } view->Window()->GetDrawingEngine()->DrawShape(frame, opCount, opList, ptCount, ptList, @@ -173,16 +174,24 @@ static void move_pen_by(ViewLayer *view, BPoint delta) { - view->CurrentState()->SetPenLocation(delta - view->CurrentState()->PenLocation()); +// view->CurrentState()->SetPenLocation(delta - view->CurrentState()->PenLocation()); ?!? + view->CurrentState()->SetPenLocation(view->CurrentState()->PenLocation() + delta); } static void stroke_line(ViewLayer *view, BPoint start, BPoint end) { + BPoint penPos = end; + view->ConvertToScreenForDrawing(&start); view->ConvertToScreenForDrawing(&end); view->Window()->GetDrawingEngine()->StrokeLine(start, end); + + view->CurrentState()->SetPenLocation(penPos); + // the DrawingEngine/Painter does not need to be updated, since this + // effects only the view->screen coord conversion, which is handled + // by the view only } @@ -376,13 +385,20 @@ draw_string(ViewLayer *view, const char *string, float deltaSpace, float deltaNonSpace) { + // NOTE: the picture data was recorded with a "set pen location" command + // inserted before the "draw string" command, so we can use PenLocation() BPoint location = view->CurrentState()->PenLocation(); + escapement_delta delta = {deltaSpace, deltaNonSpace }; view->ConvertToScreenForDrawing(&location); view->Window()->GetDrawingEngine()->DrawString(string, strlen(string), location, &delta); - // TODO: Update pen location ? - + + view->ConvertFromScreenForDrawing(&location); + view->CurrentState()->SetPenLocation(location); + // the DrawingEngine/Painter does not need to be updated, since this + // effects only the view->screen coord conversion, which is handled + // by the view only } @@ -482,12 +498,9 @@ set_pen_location(ViewLayer *view, BPoint pt) { view->CurrentState()->SetPenLocation(pt); - - // TODO: faster version - IntPoint p = view->ScrollingOffset(); - p += IntPoint(view->CurrentState()->Origin()); - view->Window()->GetDrawingEngine()->SetDrawState( - view->CurrentState(), p.x, p.y); + // the DrawingEngine/Painter does not need to be updated, since this + // effects only the view->screen coord conversion, which is handled + // by the view only } @@ -546,6 +559,9 @@ set_scale(ViewLayer *view, float scale) { view->CurrentState()->SetScale(scale); + // the DrawingEngine/Painter does not need to be updated, since this + // effects only the view->screen coord conversion, which is handled + // by the view only } Modified: haiku/trunk/src/servers/app/ServerWindow.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerWindow.cpp 2007-08-08 18:33:59 UTC (rev 21854) +++ haiku/trunk/src/servers/app/ServerWindow.cpp 2007-08-08 18:36:23 UTC (rev 21855) @@ -1550,8 +1550,6 @@ link.Read(&y); fCurrentLayer->CurrentState()->SetPenLocation(BPoint(x, y)); - // TODO: is this necessary? - _UpdateDrawState(fCurrentLayer); break; } case AS_LAYER_GET_PEN_LOC: @@ -1570,15 +1568,16 @@ link.Read(&penSize); fCurrentLayer->CurrentState()->SetPenSize(penSize); - //_UpdateDrawState(fCurrentLayer); - fWindowLayer->GetDrawingEngine()->SetPenSize(penSize); + fWindowLayer->GetDrawingEngine()->SetPenSize( + fCurrentLayer->CurrentState()->PenSize()); break; } case AS_LAYER_GET_PEN_SIZE: { DTRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_SIZE: ViewLayer: %s\n", Title(), fCurrentLayer->Name())); fLink.StartMessage(B_OK); - fLink.Attach(fCurrentLayer->CurrentState()->PenSize()); + fLink.Attach( + fCurrentLayer->CurrentState()->UnscaledPenSize()); fLink.Flush(); break; @@ -1854,7 +1853,6 @@ link.Read(&c, sizeof(rgb_color)); fCurrentLayer->CurrentState()->SetHighColor(RGBColor(c)); -// _UpdateDrawState(fCurrentLayer); fWindowLayer->GetDrawingEngine()->SetHighColor(c); break; } @@ -1866,7 +1864,6 @@ link.Read(&c, sizeof(rgb_color)); fCurrentLayer->CurrentState()->SetLowColor(RGBColor(c)); -// _UpdateDrawState(fCurrentLayer); fWindowLayer->GetDrawingEngine()->SetLowColor(c); break; } @@ -1878,7 +1875,6 @@ link.Read(&pat, sizeof(pattern)); fCurrentLayer->CurrentState()->SetPattern(Pattern(pat)); -// _UpdateDrawState(fCurrentLayer); fWindowLayer->GetDrawingEngine()->SetPattern(pat); break; } @@ -2575,14 +2571,11 @@ && link.Read(opList, opCount * sizeof(uint32)) >= B_OK && link.Read(ptList, ptCount * sizeof(BPoint)) >= B_OK) { - // TODO: I'm not sure If I have to do this here (when the BPicture is - // recorded, or inside ServerPicture, when the picture is replayed. // This might seem a bit weird, but under R5, the shapes // are always offset by the current pen location BPoint penLocation = fCurrentLayer->CurrentState()->PenLocation(); for (int32 i = 0; i < ptCount; i++) { ptList[i] += penLocation; - fCurrentLayer->ConvertToScreenForDrawing(&ptList[i]); } const bool fill = (code == AS_FILL_SHAPE); picture->WriteDrawShape(opCount, opList, ptCount, ptList, fill); From korli at mail.berlios.de Wed Aug 8 22:06:44 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 8 Aug 2007 22:06:44 +0200 Subject: [Haiku-commits] r21856 - haiku/trunk/data/etc/fonts/ttfonts Message-ID: <200708082006.l78K6iBK015138@sheep.berlios.de> Author: korli Date: 2007-08-08 22:06:38 +0200 (Wed, 08 Aug 2007) New Revision: 21856 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21856&view=rev Modified: haiku/trunk/data/etc/fonts/ttfonts/Konatu.ttf haiku/trunk/data/etc/fonts/ttfonts/KonatuTohaba.ttf Log: Updated to version 21 of the Konatu font. Modified: haiku/trunk/data/etc/fonts/ttfonts/Konatu.ttf =================================================================== (Binary files differ) Modified: haiku/trunk/data/etc/fonts/ttfonts/KonatuTohaba.ttf =================================================================== (Binary files differ) From korli at mail.berlios.de Wed Aug 8 22:10:03 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 8 Aug 2007 22:10:03 +0200 Subject: [Haiku-commits] r21857 - haiku/trunk/data/etc/fonts/ttfonts Message-ID: <200708082010.l78KA3Px016078@sheep.berlios.de> Author: korli Date: 2007-08-08 22:07:40 +0200 (Wed, 08 Aug 2007) New Revision: 21857 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21857&view=rev Added: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSansCondensed-Bold.ttf haiku/trunk/data/etc/fonts/ttfonts/DejaVuSansCondensed-BoldOblique.ttf haiku/trunk/data/etc/fonts/ttfonts/DejaVuSansCondensed-Oblique.ttf haiku/trunk/data/etc/fonts/ttfonts/DejaVuSansCondensed.ttf haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerif-BoldItalic.ttf haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerif-Italic.ttf haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerifCondensed-Bold.ttf haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerifCondensed-BoldItalic.ttf haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerifCondensed-Italic.ttf haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerifCondensed.ttf Removed: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerif-BoldOblique.ttf haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerif-Oblique.ttf Modified: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSans-Bold.ttf haiku/trunk/data/etc/fonts/ttfonts/DejaVuSans-BoldOblique.ttf haiku/trunk/data/etc/fonts/ttfonts/DejaVuSans-ExtraLight.ttf haiku/trunk/data/etc/fonts/ttfonts/DejaVuSans-Oblique.ttf haiku/trunk/data/etc/fonts/ttfonts/DejaVuSans.ttf haiku/trunk/data/etc/fonts/ttfonts/DejaVuSansMono-Bold.ttf haiku/trunk/data/etc/fonts/ttfonts/DejaVuSansMono-BoldOblique.ttf haiku/trunk/data/etc/fonts/ttfonts/DejaVuSansMono-Oblique.ttf haiku/trunk/data/etc/fonts/ttfonts/DejaVuSansMono.ttf haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerif-Bold.ttf haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerif.ttf Log: updated DejaVu fonts to to 2.19 Modified: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSans-Bold.ttf =================================================================== (Binary files differ) Modified: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSans-BoldOblique.ttf =================================================================== (Binary files differ) Modified: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSans-ExtraLight.ttf =================================================================== (Binary files differ) Modified: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSans-Oblique.ttf =================================================================== (Binary files differ) Modified: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSans.ttf =================================================================== (Binary files differ) Added: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSansCondensed-Bold.ttf =================================================================== (Binary files differ) Property changes on: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSansCondensed-Bold.ttf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSansCondensed-BoldOblique.ttf =================================================================== (Binary files differ) Property changes on: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSansCondensed-BoldOblique.ttf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSansCondensed-Oblique.ttf =================================================================== (Binary files differ) Property changes on: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSansCondensed-Oblique.ttf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSansCondensed.ttf =================================================================== (Binary files differ) Property changes on: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSansCondensed.ttf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSansMono-Bold.ttf =================================================================== (Binary files differ) Modified: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSansMono-BoldOblique.ttf =================================================================== (Binary files differ) Modified: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSansMono-Oblique.ttf =================================================================== (Binary files differ) Modified: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSansMono.ttf =================================================================== (Binary files differ) Modified: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerif-Bold.ttf =================================================================== (Binary files differ) Added: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerif-BoldItalic.ttf =================================================================== (Binary files differ) Property changes on: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerif-BoldItalic.ttf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Deleted: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerif-BoldOblique.ttf Added: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerif-Italic.ttf =================================================================== (Binary files differ) Property changes on: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerif-Italic.ttf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Deleted: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerif-Oblique.ttf Modified: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerif.ttf =================================================================== (Binary files differ) Added: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerifCondensed-Bold.ttf =================================================================== (Binary files differ) Property changes on: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerifCondensed-Bold.ttf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerifCondensed-BoldItalic.ttf =================================================================== (Binary files differ) Property changes on: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerifCondensed-BoldItalic.ttf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerifCondensed-Italic.ttf =================================================================== (Binary files differ) Property changes on: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerifCondensed-Italic.ttf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerifCondensed.ttf =================================================================== (Binary files differ) Property changes on: haiku/trunk/data/etc/fonts/ttfonts/DejaVuSerifCondensed.ttf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream From laplace at mail.berlios.de Wed Aug 8 22:32:47 2007 From: laplace at mail.berlios.de (laplace at BerliOS) Date: Wed, 8 Aug 2007 22:32:47 +0200 Subject: [Haiku-commits] r21858 - in haiku/trunk: headers/private/interface src/preferences/print Message-ID: <200708082032.l78KWlC9017363@sheep.berlios.de> Author: laplace Date: 2007-08-08 22:32:46 +0200 (Wed, 08 Aug 2007) New Revision: 21858 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21858&view=rev Modified: haiku/trunk/headers/private/interface/pr_server.h haiku/trunk/src/preferences/print/AddPrinterDialog.cpp haiku/trunk/src/preferences/print/AddPrinterDialog.h haiku/trunk/src/preferences/print/JobListView.cpp haiku/trunk/src/preferences/print/Messages.h haiku/trunk/src/preferences/print/PrinterListView.cpp haiku/trunk/src/preferences/print/Printers.cpp haiku/trunk/src/preferences/print/PrintersWindow.cpp haiku/trunk/src/preferences/print/PrintersWindow.h Log: * open 'Add printer dialog' when 'addp' message is sent to Printers preflet * style changes Modified: haiku/trunk/headers/private/interface/pr_server.h =================================================================== --- haiku/trunk/headers/private/interface/pr_server.h 2007-08-08 20:07:40 UTC (rev 21857) +++ haiku/trunk/headers/private/interface/pr_server.h 2007-08-08 20:32:46 UTC (rev 21858) @@ -49,6 +49,9 @@ #define PSRV_PRINT_SPOOLED_JOB 'psns' #define PSRV_GET_DEFAULT_SETTINGS 'pdef' +// messages sent to Printers preflet +#define PRINTERS_ADD_PRINTER 'addp' + // mime file types #define PSRV_PRINTER_FILETYPE "application/x-vnd.Be.printer" #define PSRV_SPOOL_FILETYPE "application/x-vnd.Be.printer-spool" Modified: haiku/trunk/src/preferences/print/AddPrinterDialog.cpp =================================================================== --- haiku/trunk/src/preferences/print/AddPrinterDialog.cpp 2007-08-08 20:07:40 UTC (rev 21857) +++ haiku/trunk/src/preferences/print/AddPrinterDialog.cpp 2007-08-08 20:32:46 UTC (rev 21858) @@ -12,6 +12,7 @@ #include "PrinterListView.h" #include "pr_server.h" #include "Globals.h" +#include "Messages.h" #include #include @@ -26,17 +27,10 @@ #include -status_t -AddPrinterDialog::Start() -{ - new AddPrinterDialog(); - return B_OK; -} - - -AddPrinterDialog::AddPrinterDialog() +AddPrinterDialog::AddPrinterDialog(BWindow *parent) : Inherited(BRect(78.0, 71.0, 400, 300), "Add Printer", B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_NOT_ZOOMABLE) + , fPrintersPrefletMessenger(parent) { BuildGUI(0); @@ -44,6 +38,14 @@ } +bool +AddPrinterDialog::QuitRequested() +{ + fPrintersPrefletMessenger.SendMessage(kMsgAddPrinterClosed); + return Inherited::QuitRequested(); +} + + void AddPrinterDialog::MessageReceived(BMessage* msg) { Modified: haiku/trunk/src/preferences/print/AddPrinterDialog.h =================================================================== --- haiku/trunk/src/preferences/print/AddPrinterDialog.h 2007-08-08 20:07:40 UTC (rev 21857) +++ haiku/trunk/src/preferences/print/AddPrinterDialog.h 2007-08-08 20:32:46 UTC (rev 21858) @@ -23,7 +23,9 @@ typedef BWindow Inherited; public: - static status_t Start(); + AddPrinterDialog(BWindow *parent); + + bool QuitRequested(); private: enum MessageKind { @@ -32,7 +34,6 @@ kNameChangedMsg, }; - AddPrinterDialog(); void MessageReceived(BMessage *msg); void AddPrinter(BMessage *msg); @@ -44,6 +45,8 @@ void AddPortSubMenu(BMenu *menu, const char *transport, const char *port); void Update(); + BMessenger fPrintersPrefletMessenger; + BTextControl *fName; BPopUpMenu *fPrinter; BPopUpMenu *fTransport; @@ -52,7 +55,7 @@ BString fNameText; BString fPrinterText; BString fTransportText; - BString fTransportPathText; + BString fTransportPathText; }; #endif Modified: haiku/trunk/src/preferences/print/JobListView.cpp =================================================================== --- haiku/trunk/src/preferences/print/JobListView.cpp 2007-08-08 20:07:40 UTC (rev 21857) +++ haiku/trunk/src/preferences/print/JobListView.cpp 2007-08-08 20:32:46 UTC (rev 21858) @@ -50,7 +50,7 @@ { Inherited::AttachedToWindow(); - SetSelectionMessage(new BMessage(MSG_JOB_SELECTED)); + SetSelectionMessage(new BMessage(kMsgJobSelected)); SetTarget(Window()); } Modified: haiku/trunk/src/preferences/print/Messages.h =================================================================== --- haiku/trunk/src/preferences/print/Messages.h 2007-08-08 20:07:40 UTC (rev 21857) +++ haiku/trunk/src/preferences/print/Messages.h 2007-08-08 20:32:46 UTC (rev 21858) @@ -1,42 +1,24 @@ -/*****************************************************************************/ -// Printers Preference Application. -// -// This application and all source files used in its construction, except -// where noted, are licensed under the MIT License, and have been written -// and are: -// -// Copyright (c) 2001-2003 OpenBeOS Project -// -// 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. -/*****************************************************************************/ - +/* + * Copyright 2001-2007, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer + * Philippe Houdoin + */ + #ifndef MESSAGES_H #define MESSAGES_H #include -const uint32 MSG_ADD_PRINTER = 'AddP'; -const uint32 MSG_REMOVE_PRINTER = 'RemP'; -const uint32 MSG_MKDEF_PRINTER = 'MDfP'; -const uint32 MSG_PRINTER_SELECTED = 'PSel'; -const uint32 MSG_CANCEL_JOB = 'CncJ'; -const uint32 MSG_RESTART_JOB = 'RstJ'; -const uint32 MSG_JOB_SELECTED = 'JSel'; +const uint32 kMsgAddPrinter = 'AddP'; +const uint32 kMsgAddPrinterClosed = 'APCl'; +const uint32 kMsgRemovePrinter = 'RemP'; +const uint32 kMsgMakeDefaultPrinter = 'MDfP'; +const uint32 kMsgPrinterSelected = 'PSel'; +const uint32 kMsgCancelJob = 'CncJ'; +const uint32 kMsgRestartJob = 'RstJ'; +const uint32 kMsgJobSelected = 'JSel'; #endif Modified: haiku/trunk/src/preferences/print/PrinterListView.cpp =================================================================== --- haiku/trunk/src/preferences/print/PrinterListView.cpp 2007-08-08 20:07:40 UTC (rev 21857) +++ haiku/trunk/src/preferences/print/PrinterListView.cpp 2007-08-08 20:32:46 UTC (rev 21858) @@ -84,8 +84,8 @@ { Inherited::AttachedToWindow(); - SetSelectionMessage(new BMessage(MSG_PRINTER_SELECTED)); - SetInvocationMessage(new BMessage(MSG_MKDEF_PRINTER)); + SetSelectionMessage(new BMessage(kMsgPrinterSelected)); + SetInvocationMessage(new BMessage(kMsgMakeDefaultPrinter)); SetTarget(Window()); BPath path; Modified: haiku/trunk/src/preferences/print/Printers.cpp =================================================================== --- haiku/trunk/src/preferences/print/Printers.cpp 2007-08-08 20:07:40 UTC (rev 21857) +++ haiku/trunk/src/preferences/print/Printers.cpp 2007-08-08 20:32:46 UTC (rev 21858) @@ -28,9 +28,9 @@ #include "Printers.h" -#ifndef PRINTERSWINDOW_H - #include "PrintersWindow.h" -#endif +#include "pr_server.h" +#include "Messages.h" +#include "PrintersWindow.h" int main() { @@ -51,12 +51,16 @@ } void PrintersApp::MessageReceived(BMessage* msg) { - if (msg->what == B_PRINTER_CHANGED) { + if (msg->what == B_PRINTER_CHANGED || msg->what == PRINTERS_ADD_PRINTER) { // broadcast message + uint32 what = msg->what; + if (what == PRINTERS_ADD_PRINTER) + what = kMsgAddPrinter; + BWindow* w; for (int32 i = 0; (w = WindowAt(i)) != NULL; i ++) { BMessenger msgr(NULL, w); - msgr.SendMessage(B_PRINTER_CHANGED); + msgr.SendMessage(what); } } else { BApplication::MessageReceived(msg); Modified: haiku/trunk/src/preferences/print/PrintersWindow.cpp =================================================================== --- haiku/trunk/src/preferences/print/PrintersWindow.cpp 2007-08-08 20:07:40 UTC (rev 21857) +++ haiku/trunk/src/preferences/print/PrintersWindow.cpp 2007-08-08 20:32:46 UTC (rev 21858) @@ -47,6 +47,7 @@ PrintersWindow::PrintersWindow(BRect frame) : Inherited(BRect(78.0, 71.0, 561.0, 409.0), "Printers", B_TITLED_WINDOW, B_NOT_H_RESIZABLE) , fSelectedPrinter(NULL) + , fAddingPrinter(false) { BuildGUI(); } @@ -65,7 +66,7 @@ { switch(msg->what) { - case MSG_PRINTER_SELECTED: + case kMsgPrinterSelected: { fSelectedPrinter = fPrinterListView->SelectedItem(); if (fSelectedPrinter) @@ -88,18 +89,25 @@ } break; - case MSG_ADD_PRINTER: - AddPrinterDialog::Start(); + case kMsgAddPrinter: + if (!fAddingPrinter) { + fAddingPrinter = true; + new AddPrinterDialog(this); + } break; + + case kMsgAddPrinterClosed: + fAddingPrinter = false; + break; - case MSG_REMOVE_PRINTER: + case kMsgRemovePrinter: { fSelectedPrinter = fPrinterListView->SelectedItem(); if (fSelectedPrinter) fSelectedPrinter->Remove(fPrinterListView); } break; - case MSG_MKDEF_PRINTER: + case kMsgMakeDefaultPrinter: { int32 prIndex = fPrinterListView->CurrentSelection(); if (prIndex >= 0) @@ -121,13 +129,13 @@ break; - case MSG_CANCEL_JOB: fJobListView->CancelJob(); + case kMsgCancelJob: fJobListView->CancelJob(); break; - case MSG_RESTART_JOB: fJobListView->RestartJob(); + case kMsgRestartJob: fJobListView->RestartJob(); break; - case MSG_JOB_SELECTED: UpdateJobButtons(); + case kMsgJobSelected: UpdateJobButtons(); break; case B_PRINTER_CHANGED: @@ -162,14 +170,14 @@ float maxWidth = 0; // Add Button - BButton* addButton = new BButton(BRect(5,5,5,5), "add", "Add " B_UTF8_ELLIPSIS, new BMessage(MSG_ADD_PRINTER), B_FOLLOW_RIGHT); + BButton* addButton = new BButton(BRect(5,5,5,5), "add", "Add " B_UTF8_ELLIPSIS, new BMessage(kMsgAddPrinter), B_FOLLOW_RIGHT); printersBox->AddChild(addButton); addButton->ResizeToPreferred(); maxWidth = addButton->Bounds().Width(); // Remove button - fRemove = new BButton(BRect(5,30,5,30), "remove", "Remove", new BMessage(MSG_REMOVE_PRINTER), B_FOLLOW_RIGHT); + fRemove = new BButton(BRect(5,30,5,30), "remove", "Remove", new BMessage(kMsgRemovePrinter), B_FOLLOW_RIGHT); printersBox->AddChild(fRemove); fRemove->ResizeToPreferred(); @@ -177,7 +185,7 @@ maxWidth = fRemove->Bounds().Width(); // Make Default button - fMakeDefault = new BButton(BRect(5,60,5,60), "default", "Make Default", new BMessage(MSG_MKDEF_PRINTER), B_FOLLOW_RIGHT); + fMakeDefault = new BButton(BRect(5,60,5,60), "default", "Make Default", new BMessage(kMsgMakeDefaultPrinter), B_FOLLOW_RIGHT); printersBox->AddChild(fMakeDefault); fMakeDefault->ResizeToPreferred(); @@ -217,7 +225,7 @@ backdrop->AddChild(fJobsBox); // Cancel Job Button - BButton* cancelButton = new BButton(BRect(5,5,5,5), "cancel", "Cancel Job", new BMessage(MSG_CANCEL_JOB), B_FOLLOW_RIGHT+B_FOLLOW_TOP); + BButton* cancelButton = new BButton(BRect(5,5,5,5), "cancel", "Cancel Job", new BMessage(kMsgCancelJob), B_FOLLOW_RIGHT+B_FOLLOW_TOP); fJobsBox->AddChild(cancelButton); cancelButton->ResizeToPreferred(); fCancel = cancelButton; @@ -225,7 +233,7 @@ maxWidth = cancelButton->Bounds().Width(); // Restart Job button - BButton* restartButton = new BButton(BRect(5,30,5,30), "restart", "Restart Job", new BMessage(MSG_RESTART_JOB), B_FOLLOW_RIGHT+B_FOLLOW_TOP); + BButton* restartButton = new BButton(BRect(5,30,5,30), "restart", "Restart Job", new BMessage(kMsgRestartJob), B_FOLLOW_RIGHT+B_FOLLOW_TOP); fJobsBox->AddChild(restartButton); restartButton->ResizeToPreferred(); fRestart = restartButton; Modified: haiku/trunk/src/preferences/print/PrintersWindow.h =================================================================== --- haiku/trunk/src/preferences/print/PrintersWindow.h 2007-08-08 20:07:40 UTC (rev 21857) +++ haiku/trunk/src/preferences/print/PrintersWindow.h 2007-08-08 20:32:46 UTC (rev 21858) @@ -68,6 +68,8 @@ BBox* fJobsBox; PrinterItem* fSelectedPrinter; + + bool fAddingPrinter; }; #endif From stippi at mail.berlios.de Wed Aug 8 22:33:37 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 8 Aug 2007 22:33:37 +0200 Subject: [Haiku-commits] r21859 - haiku/trunk/data/artwork Message-ID: <200708082033.l78KXbZf017440@sheep.berlios.de> Author: stippi Date: 2007-08-08 22:33:36 +0200 (Wed, 08 Aug 2007) New Revision: 21859 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21859&view=rev Modified: haiku/trunk/data/artwork/HAIKU logo - black.svg Log: * the black SVG version now includes the dropshadows as bitmaps, which, given that they are blurry anyways, should give you a perfectly scalable version of the logo in SVG Modified: haiku/trunk/data/artwork/HAIKU logo - black.svg =================================================================== --- haiku/trunk/data/artwork/HAIKU logo - black.svg 2007-08-08 20:32:46 UTC (rev 21858) +++ haiku/trunk/data/artwork/HAIKU logo - black.svg 2007-08-08 20:33:36 UTC (rev 21859) @@ -1,50 +1,206 @@ - + - - - - - - - - + + + + - - - + + - - - - - + + + + From laplace at mail.berlios.de Wed Aug 8 22:48:06 2007 From: laplace at mail.berlios.de (laplace at BerliOS) Date: Wed, 8 Aug 2007 22:48:06 +0200 Subject: [Haiku-commits] r21860 - haiku/trunk/src/kits/interface Message-ID: <200708082048.l78Km6YE018143@sheep.berlios.de> Author: laplace Date: 2007-08-08 22:48:06 +0200 (Wed, 08 Aug 2007) New Revision: 21860 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21860&view=rev Modified: haiku/trunk/src/kits/interface/InterfaceDefs.cpp Log: * Implemented run_add_printer_panel(). Opens Printers preflet and sends to it the message for opening the 'Add printer dialog'. Modified: haiku/trunk/src/kits/interface/InterfaceDefs.cpp =================================================================== --- haiku/trunk/src/kits/interface/InterfaceDefs.cpp 2007-08-08 20:33:36 UTC (rev 21859) +++ haiku/trunk/src/kits/interface/InterfaceDefs.cpp 2007-08-08 20:48:06 UTC (rev 21860) @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -649,8 +650,11 @@ _IMPEXP_BE void run_select_printer_panel() { + if (be_roster == NULL) + return; + // Launches the Printer prefs app via the Roster - be_roster->Launch("application/x-vnd.Be-PRNT"); + be_roster->Launch(PRNT_SIGNATURE_TYPE); } @@ -659,7 +663,10 @@ { // Launches the Printer prefs app via the Roster and asks it to // add a printer - // TODO: Implement + run_select_printer_panel(); + + BMessenger printerPanelMessenger(PRNT_SIGNATURE_TYPE); + printerPanelMessenger.SendMessage(PRINTERS_ADD_PRINTER); } From mmu_man at mail.berlios.de Wed Aug 8 23:44:30 2007 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 8 Aug 2007 23:44:30 +0200 Subject: [Haiku-commits] r21861 - haiku/trunk/src/system/kernel Message-ID: <200708082144.l78LiUGs023430@sheep.berlios.de> Author: mmu_man Date: 2007-08-08 23:44:30 +0200 (Wed, 08 Aug 2007) New Revision: 21861 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21861&view=rev Modified: haiku/trunk/src/system/kernel/module.cpp Log: Fix building with TRACE Modified: haiku/trunk/src/system/kernel/module.cpp =================================================================== --- haiku/trunk/src/system/kernel/module.cpp 2007-08-08 20:48:06 UTC (rev 21860) +++ haiku/trunk/src/system/kernel/module.cpp 2007-08-08 21:44:30 UTC (rev 21861) @@ -343,8 +343,7 @@ { struct module_image *image; - TRACE(("get_module_image(path = \"%s\", loadIfNeeded = %d)\n", path, - loadIfNeeded)); + TRACE(("get_module_image(path = \"%s\")\n", path)); RecursiveLocker _(sModulesLock); From axeld at mail.berlios.de Thu Aug 9 00:38:47 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 9 Aug 2007 00:38:47 +0200 Subject: [Haiku-commits] r21862 - haiku/trunk/src/system/kernel/vm Message-ID: <200708082238.l78Mcl7x012397@sheep.berlios.de> Author: axeld Date: 2007-08-09 00:38:46 +0200 (Thu, 09 Aug 2007) New Revision: 21862 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21862&view=rev Modified: haiku/trunk/src/system/kernel/vm/vm.cpp Log: * get_memory_map() leaked vm_address_space references * fixes a dead lock in vm_soft_fault() - the locking scheme enforces you to lock the address space before a vm_cache, not the other way, around. Since we need to lock the cache that has our page in fault_get_page(), we violated that scheme by relocking the address space in order to get access to the vm_area. Now, we read lock the address space during the whole page fault; added a TODO that explains why this might not really be desirable, if we can avoid it (the only way would be to reverse that locking scheme which would potentially cause the more busy vm_cache locks to be held longer). * vm_copy_area() uses the MultiAddressSpaceLocker, but actually forget to call Lock() on it... * delete_area() leaks vm_address_space references - but fixing this currently causes other problems to be investigated; I'll open a bug for that. Modified: haiku/trunk/src/system/kernel/vm/vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm.cpp 2007-08-08 21:44:30 UTC (rev 21861) +++ haiku/trunk/src/system/kernel/vm/vm.cpp 2007-08-08 22:38:46 UTC (rev 21862) @@ -62,10 +62,12 @@ class AddressSpaceReadLocker { public: AddressSpaceReadLocker(team_id team); + AddressSpaceReadLocker(vm_address_space* space); AddressSpaceReadLocker(); ~AddressSpaceReadLocker(); status_t SetTo(team_id team); + void SetTo(vm_address_space* space); status_t SetFromArea(area_id areaID, vm_area*& area); bool IsLocked() const { return fLocked; } @@ -123,6 +125,7 @@ private: bool _ResizeIfNeeded(); vm_address_space*& _CurrentItem() { return fSpaces[fCount]; } + bool _HasAddressSpace(vm_address_space* space) const; static int _CompareItems(const void* _a, const void* _b); @@ -160,6 +163,16 @@ } +//! Takes over the reference of the address space +AddressSpaceReadLocker::AddressSpaceReadLocker(vm_address_space* space) + : + fSpace(NULL), + fLocked(false) +{ + SetTo(space); +} + + AddressSpaceReadLocker::AddressSpaceReadLocker() : fSpace(NULL), @@ -196,6 +209,16 @@ } +//! Takes over the reference of the address space +void +AddressSpaceReadLocker::SetTo(vm_address_space* space) +{ + fSpace = space; + acquire_sem_etc(fSpace->sem, READ_COUNT, 0, 0); + fLocked = true; +} + + status_t AddressSpaceReadLocker::SetFromArea(area_id areaID, vm_area*& area) { @@ -354,6 +377,7 @@ if (fLocked) { release_sem_etc(fSpace->sem, fDegraded ? READ_COUNT : WRITE_COUNT, 0); fLocked = false; + fDegraded = false; } } @@ -412,6 +436,18 @@ } +bool +MultiAddressSpaceLocker::_HasAddressSpace(vm_address_space* space) const +{ + for (int32 i = 0; i < fCount; i++) { + if (fSpaces[i] == space) + return true; + } + + return false; +} + + status_t MultiAddressSpaceLocker::AddTeam(team_id team, vm_address_space** _space) { @@ -423,6 +459,15 @@ if (space == NULL) return B_BAD_VALUE; + // check if we have already added this address space + if (_HasAddressSpace(space)) { + // no need to add it again + vm_put_address_space(space); + if (_space != NULL) + *_space = space; + return B_OK; + } + fCount++; if (_space != NULL) @@ -444,14 +489,12 @@ return B_BAD_VALUE; // check if we have already added this address space - for (int32 i = 0; i < fCount; i++) { - if (fSpaces[i] == space) { - // no need to add it again - vm_put_address_space(space); - if (_space != NULL) - *_space = space; - return B_OK; - } + if (_HasAddressSpace(space)) { + // no need to add it again + vm_put_address_space(space); + if (_space != NULL) + *_space = space; + return B_OK; } fCount++; @@ -1683,7 +1726,7 @@ { vm_area *newArea = NULL; vm_area *sourceArea; - + MultiAddressSpaceLocker locker; vm_address_space *sourceAddressSpace; status_t status = locker.AddArea(sourceID, &sourceAddressSpace); @@ -1822,6 +1865,10 @@ arch_vm_unset_memory_type(area); remove_area_from_address_space(addressSpace, area); + // TODO: the following line fixes an address space leak - however, + // there seems to be something wrong with the order in which teams + // are torn down, and the first shell command hangs on a pipe then + //vm_put_address_space(addressSpace); vm_cache_remove_area(area->cache, area); vm_cache_release_ref(area->cache); @@ -1948,25 +1995,26 @@ vm_copy_area(team_id team, const char *name, void **_address, uint32 addressSpec, uint32 protection, area_id sourceID) { + bool writableCopy = (protection & (B_KERNEL_WRITE_AREA | B_WRITE_AREA)) != 0; + + if ((protection & B_KERNEL_PROTECTION) == 0) { + // set the same protection for the kernel as for userland + protection |= B_KERNEL_READ_AREA; + if (writableCopy) + protection |= B_KERNEL_WRITE_AREA; + } + MultiAddressSpaceLocker locker; - vm_address_space *sourceAddressSpace = NULL; vm_address_space *targetAddressSpace; status_t status = locker.AddTeam(team, &targetAddressSpace); if (status == B_OK) status = locker.AddArea(sourceID, &sourceAddressSpace); + if (status == B_OK) + status = locker.Lock(); if (status != B_OK) return status; - bool writableCopy = (protection & (B_KERNEL_WRITE_AREA | B_WRITE_AREA)) != 0; - - if ((protection & B_KERNEL_PROTECTION) == 0) { - // set the same protection for the kernel as for userland - protection |= B_KERNEL_READ_AREA; - if (writableCopy) - protection |= B_KERNEL_WRITE_AREA; - } - vm_area* source = lookup_area(sourceAddressSpace, sourceID); if (source == NULL) return B_BAD_VALUE; @@ -3865,16 +3913,14 @@ return B_BAD_ADDRESS; } + AddressSpaceReadLocker locker(addressSpace); + atomic_add(&addressSpace->fault_count, 1); // Get the area the fault was in - acquire_sem_etc(addressSpace->sem, READ_COUNT, 0, 0); - vm_area *area = vm_area_lookup(addressSpace, address); if (area == NULL) { - release_sem_etc(addressSpace->sem, READ_COUNT, 0); - vm_put_address_space(addressSpace); dprintf("vm_soft_fault: va 0x%lx not covered by area in address space\n", originalAddress); return B_BAD_ADDRESS; @@ -3882,14 +3928,10 @@ // check permissions if (isUser && (area->protection & B_USER_PROTECTION) == 0) { - release_sem_etc(addressSpace->sem, READ_COUNT, 0); - vm_put_address_space(addressSpace); dprintf("user access on kernel area 0x%lx at %p\n", area->id, (void *)originalAddress); return B_PERMISSION_DENIED; } if (isWrite && (area->protection & (B_WRITE_AREA | (isUser ? 0 : B_KERNEL_WRITE_AREA))) == 0) { - release_sem_etc(addressSpace->sem, READ_COUNT, 0); - vm_put_address_space(addressSpace); dprintf("write access attempted on read-only area 0x%lx at %p\n", area->id, (void *)originalAddress); return B_PERMISSION_DENIED; @@ -3905,8 +3947,6 @@ atomic_add(&area->no_cache_change, 1); // make sure the area's cache isn't replaced during the page fault - release_sem_etc(addressSpace->sem, READ_COUNT, 0); - // See if this cache has a fault handler - this will do all the work for us { vm_store *store = topCache->store; @@ -3917,7 +3957,6 @@ status_t status = store->ops->fault(store, addressSpace, cacheOffset); if (status != B_BAD_HANDLER) { vm_area_put_locked_cache(topCache); - vm_put_address_space(addressSpace); return status; } } @@ -3943,22 +3982,12 @@ vm_cache *copiedPageSource = NULL; vm_cache *pageSource; vm_page *page; + // TODO: We keep the address space read lock during the whole operation + // which might be rather expensive depending on where the data has to + // be retrieved from. status_t status = fault_get_page(map, topCache, cacheOffset, isWrite, dummyPage, &pageSource, &copiedPageSource, &page); - acquire_sem_etc(addressSpace->sem, READ_COUNT, 0, 0); - if (status == B_OK && changeCount != addressSpace->change_count) { - // something may have changed, see if the address is still valid - area = vm_area_lookup(addressSpace, address); - if (area == NULL - || area->cache != topCache - || (address - area->base + area->cache_offset) != cacheOffset - || address > area->base + (area->size - 1)) { - dprintf("vm_soft_fault: address space layout changed effecting ongoing soft fault\n"); - status = B_BAD_ADDRESS; - } - } - if (status == B_OK) { // All went fine, all there is left to do is to map the page into the address space @@ -3979,7 +4008,6 @@ } atomic_add(&area->no_cache_change, -1); - release_sem_etc(addressSpace->sem, READ_COUNT, 0); mutex_unlock(&pageSource->lock); vm_cache_release_ref(pageSource); @@ -3993,7 +4021,6 @@ } vm_cache_release_ref(topCache); - vm_put_address_space(addressSpace); return status; } @@ -4340,7 +4367,8 @@ */ long -get_memory_map(const void *address, ulong numBytes, physical_entry *table, long numEntries) +get_memory_map(const void *address, ulong numBytes, physical_entry *table, + long numEntries) { vm_address_space *addressSpace; addr_t virtualAddress = (addr_t)address; @@ -4351,7 +4379,8 @@ addr_t offset = 0; bool interrupts = are_interrupts_enabled(); - TRACE(("get_memory_map(%p, %lu bytes, %ld entries)\n", address, numBytes, numEntries)); + TRACE(("get_memory_map(%p, %lu bytes, %ld entries)\n", address, numBytes, + numEntries)); if (numEntries == 0 || numBytes == 0) return B_BAD_VALUE; @@ -4385,6 +4414,7 @@ break; if ((flags & PAGE_PRESENT) == 0) { panic("get_memory_map() called on unmapped memory!"); + vm_put_address_space(addressSpace); return B_BAD_ADDRESS; } @@ -4415,6 +4445,8 @@ if (interrupts) map->ops->unlock(map); + vm_put_address_space(addressSpace); + // close the entry list if (status == B_OK) { From axeld at mail.berlios.de Thu Aug 9 00:43:53 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 9 Aug 2007 00:43:53 +0200 Subject: [Haiku-commits] r21863 - in haiku/trunk: headers/os/app src/kits/app Message-ID: <200708082243.l78Mhrer017625@sheep.berlios.de> Author: axeld Date: 2007-08-09 00:43:52 +0200 (Thu, 09 Aug 2007) New Revision: 21863 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21863&view=rev Modified: haiku/trunk/headers/os/app/Looper.h haiku/trunk/src/kits/app/Looper.cpp Log: Now uses the cache stack trick for a cheaper check_lock() version as suggested by stippi. Modified: haiku/trunk/headers/os/app/Looper.h =================================================================== --- haiku/trunk/headers/os/app/Looper.h 2007-08-08 22:38:46 UTC (rev 21862) +++ haiku/trunk/headers/os/app/Looper.h 2007-08-08 22:43:52 UTC (rev 21863) @@ -159,13 +159,14 @@ int32 fOwnerCount; thread_id fOwner; thread_id fThread; + addr_t fCachedStack; int32 fInitPriority; BHandler* fPreferred; BList fHandlers; BList* fCommonFilters; bool fTerminating; bool fRunCalled; - uint32 _reserved[12]; + uint32 _reserved[11]; }; #endif // _LOOPER_H Modified: haiku/trunk/src/kits/app/Looper.cpp =================================================================== --- haiku/trunk/src/kits/app/Looper.cpp 2007-08-08 22:38:46 UTC (rev 21862) +++ haiku/trunk/src/kits/app/Looper.cpp 2007-08-08 22:43:52 UTC (rev 21863) @@ -546,7 +546,6 @@ return false; } - // Got this from Jeremy's BLocker implementation return find_thread(NULL) == fOwner; } @@ -907,7 +906,8 @@ status_t -BLooper::_LockComplete(BLooper *looper, int32 oldCount, thread_id thread, sem_id sem, bigtime_t timeout) +BLooper::_LockComplete(BLooper *looper, int32 oldCount, thread_id thread, + sem_id sem, bigtime_t timeout) { status_t err = B_OK; @@ -922,6 +922,7 @@ #endif if (err == B_OK) { looper->fOwner = thread; + looper->fCachedStack = (addr_t)&err & ~(B_PAGE_SIZE - 1); looper->fOwnerCount = 1; } @@ -1332,8 +1333,12 @@ // This is a cheap variant of AssertLocked() // It is used in situations where it's clear that the looper is valid, // ie. from handlers - if (fOwner == -1 || fOwner != find_thread(NULL)) - debugger("Looper must be locked."); + uint32 stack; + if (((uint32)&stack & ~(B_PAGE_SIZE - 1)) == fCachedStack + || fOwner == find_thread(NULL)) + return; + + debugger("Looper must be locked."); } From axeld at mail.berlios.de Thu Aug 9 01:11:16 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 9 Aug 2007 01:11:16 +0200 Subject: [Haiku-commits] r21864 - haiku/trunk/src/kits/app Message-ID: <200708082311.l78NBGgh016765@sheep.berlios.de> Author: axeld Date: 2007-08-09 01:11:13 +0200 (Thu, 09 Aug 2007) New Revision: 21864 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21864&view=rev Modified: haiku/trunk/src/kits/app/Looper.cpp Log: fCachedStack needs to be initialized and reset when the looper is unlocked. Modified: haiku/trunk/src/kits/app/Looper.cpp =================================================================== --- haiku/trunk/src/kits/app/Looper.cpp 2007-08-08 22:43:52 UTC (rev 21863) +++ haiku/trunk/src/kits/app/Looper.cpp 2007-08-08 23:11:13 UTC (rev 21864) @@ -522,6 +522,7 @@ if (fOwnerCount == 0) { // Set fOwner to invalid thread_id (< 0) fOwner = -1; + fCachedStack = 0; #if DEBUG < 1 // Decrement requested lock count (using fAtomicCount for this) @@ -935,6 +936,7 @@ BLooper::_InitData(const char *name, int32 priority, int32 portCapacity) { fOwner = B_ERROR; + fCachedStack = 0; fRunCalled = false; fDirectTarget = new (std::nothrow) BPrivate::BDirectMessageTarget(); fCommonFilters = NULL; @@ -1401,6 +1403,7 @@ fOwnerCount = 0; // Nobody owns the lock now fOwner = -1; + fCachedStack = 0; #if DEBUG < 1 // There is now one less thread holding a lock on this looper int32 atomicCount = atomic_add(&fAtomicCount, -1); From axeld at mail.berlios.de Thu Aug 9 01:51:21 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 9 Aug 2007 01:51:21 +0200 Subject: [Haiku-commits] r21865 - haiku/trunk/src/system/kernel/vm Message-ID: <200708082351.l78NpLcw013045@sheep.berlios.de> Author: axeld Date: 2007-08-09 01:51:20 +0200 (Thu, 09 Aug 2007) New Revision: 21865 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21865&view=rev Modified: haiku/trunk/src/system/kernel/vm/vm.cpp Log: Since get_memory_map() can run with interrupts turned off, it can't put up it's reference to the vm_address_space - luckily, it doesn't even need a reference, since it always runs in the current address space, which cannot go away for obvious reasons. Modified: haiku/trunk/src/system/kernel/vm/vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm.cpp 2007-08-08 23:11:13 UTC (rev 21864) +++ haiku/trunk/src/system/kernel/vm/vm.cpp 2007-08-08 23:51:20 UTC (rev 21865) @@ -4387,9 +4387,9 @@ // in which address space is the address to be found? if (IS_USER_ADDRESS(virtualAddress)) - addressSpace = vm_get_current_user_address_space(); + addressSpace = thread_get_current_thread()->team->address_space; else - addressSpace = vm_get_kernel_address_space(); + addressSpace = vm_kernel_address_space(); if (addressSpace == NULL) return B_ERROR; @@ -4414,7 +4414,6 @@ break; if ((flags & PAGE_PRESENT) == 0) { panic("get_memory_map() called on unmapped memory!"); - vm_put_address_space(addressSpace); return B_BAD_ADDRESS; } @@ -4445,8 +4444,6 @@ if (interrupts) map->ops->unlock(map); - vm_put_address_space(addressSpace); - // close the entry list if (status == B_OK) { From stippi at mail.berlios.de Thu Aug 9 02:25:59 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 9 Aug 2007 02:25:59 +0200 Subject: [Haiku-commits] r21866 - haiku/trunk/src/servers/app Message-ID: <200708090025.l790PxdA016268@sheep.berlios.de> Author: stippi Date: 2007-08-09 02:25:52 +0200 (Thu, 09 Aug 2007) New Revision: 21866 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21866&view=rev Modified: haiku/trunk/src/servers/app/FontCacheEntry.cpp haiku/trunk/src/servers/app/FontCacheEntry.h Log: Didn't I have a bad feeling because of code duplication? * fixed a bug in the font cache, the signature was generated in one way (rendering type) while the initialization of the font engine could use another way * should fix non-antialiased straight text * weird non-transformed text in FontDemo * generally not using vector glyphs when it was supposed to use them (rotated or sheared text, or non-antialiased text) Modified: haiku/trunk/src/servers/app/FontCacheEntry.cpp =================================================================== --- haiku/trunk/src/servers/app/FontCacheEntry.cpp 2007-08-08 23:51:20 UTC (rev 21865) +++ haiku/trunk/src/servers/app/FontCacheEntry.cpp 2007-08-09 00:25:52 UTC (rev 21866) @@ -116,9 +116,7 @@ bool FontCacheEntry::Init(const ServerFont& font) { - glyph_rendering renderingType = glyph_ren_native_gray8; - if (font.Rotation() != 0.0 || font.Shear() != 90.0) - renderingType = glyph_ren_outline; + glyph_rendering renderingType = _RenderTypeFor(font); // TODO: encoding from font FT_Encoding charMap = FT_ENCODING_NONE; @@ -211,18 +209,13 @@ /*static*/ void FontCacheEntry::GenerateSignature(char* signature, const ServerFont& font) { - glyph_rendering renderingType = glyph_ren_native_gray8; - if (font.Rotation() != 0.0 || font.Shear() != 90.0 - || font.Flags() & B_DISABLE_ANTIALIASING - || font.Size() > 30) { - renderingType = glyph_ren_outline; - } + glyph_rendering renderingType = _RenderTypeFor(font); // TODO: read more of these from the font FT_Encoding charMap = FT_ENCODING_NONE; bool hinting = true; // TODO: font.Hinting(); - sprintf(signature, "%ld%u%d%d%.1f%d", + sprintf(signature, "%ld,%u,%d,%d,%.1f,%d", font.GetFamilyAndStyle(), charMap, font.Face(), int(renderingType), font.Size(), hinting); } @@ -242,3 +235,15 @@ fUseCounter++; } +// _RenderTypeFor +/*static*/ glyph_rendering +FontCacheEntry::_RenderTypeFor(const ServerFont& font) +{ + glyph_rendering renderingType = glyph_ren_native_gray8; + if (font.Rotation() != 0.0 || font.Shear() != 90.0 + || font.Flags() & B_DISABLE_ANTIALIASING + || font.Size() > 30) { + renderingType = glyph_ren_outline; + } + return renderingType; +} Modified: haiku/trunk/src/servers/app/FontCacheEntry.h =================================================================== --- haiku/trunk/src/servers/app/FontCacheEntry.h 2007-08-08 23:51:20 UTC (rev 21865) +++ haiku/trunk/src/servers/app/FontCacheEntry.h 2007-08-09 00:25:52 UTC (rev 21866) @@ -104,6 +104,8 @@ FontCacheEntry(const FontCacheEntry&); const FontCacheEntry& operator=(const FontCacheEntry&); + static glyph_rendering _RenderTypeFor(const ServerFont& font); + class GlyphCachePool; GlyphCachePool* fGlyphCache; From stippi at mail.berlios.de Thu Aug 9 02:33:51 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 9 Aug 2007 02:33:51 +0200 Subject: [Haiku-commits] r21867 - haiku/trunk/src/servers/app Message-ID: <200708090033.l790XpSJ016844@sheep.berlios.de> Author: stippi Date: 2007-08-09 02:33:50 +0200 (Thu, 09 Aug 2007) New Revision: 21867 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21867&view=rev Modified: haiku/trunk/src/servers/app/WindowLayer.cpp Log: Fixed an interesting bug in the app_server, after beating my head against this for a long time... what happens when the app_server has requested a redraw, but the client sends some drawing commands before starting the redraw session? This would be the case, for example, when TextViews got notified of their parent window becomming active (they would invert the selection outside of any update session). When there was an additional expose event, the app_server would already have the background cleared, so the lonely "invert" command would invert the freshly painted background. Then the normal Draw() of the TextView would be called because of the expose event. By the time the text was rendered, it was rendered on the inverted background, then the normal Draw() contained another "invert" command to invert the region of the selection. Thus inverting just the text, and the background twice. Solution: * introduced a special handling for drawing commands arriving between requested update session and beginning of that session: the pending update region is clipped from the region the client is allowed to draw in. * fixes funny text rendering in the selected part of text views. For example ticket #908. Modified: haiku/trunk/src/servers/app/WindowLayer.cpp =================================================================== --- haiku/trunk/src/servers/app/WindowLayer.cpp 2007-08-09 00:25:52 UTC (rev 21866) +++ haiku/trunk/src/servers/app/WindowLayer.cpp 2007-08-09 00:33:50 UTC (rev 21867) @@ -563,7 +563,11 @@ { if (!fEffectiveDrawingRegionValid) { fEffectiveDrawingRegion = VisibleContentRegion(); - if (fInUpdate) { + if (fUpdateRequested && !fInUpdate) { + // we requested an update, but the client has not started it yet, + // so it is only allowed to draw outside the pending update sessions region + fEffectiveDrawingRegion.Exclude(&fPendingUpdateSession.DirtyRegion()); + } else if (fInUpdate) { // enforce the dirty region of the update session fEffectiveDrawingRegion.IntersectWith(&fCurrentUpdateSession.DirtyRegion()); } else { @@ -1828,10 +1832,16 @@ // this could be done smarter (clip layers from pending // that have not yet been redrawn in the current update // session) - if (fCurrentUpdateSession.IsUsed() && fCurrentUpdateSession.IsExpose()) { - fCurrentUpdateSession.Exclude(contentDirtyRegion); - fEffectiveDrawingRegionValid = false; - } + // NOTE: appearently the R5 app_server does not do that, it just + // keeps drawing until the screen is valid, without caring much + // for a consistent display while it does so, it just keeps drawing + // until everything settles down. Potentially, this could even give + // the impression of faster updates, even though they might look + // wrong when looked at closer, but will fix themselves shortly later +// if (fCurrentUpdateSession.IsUsed() && fCurrentUpdateSession.IsExpose()) { +// fCurrentUpdateSession.Exclude(contentDirtyRegion); +// fEffectiveDrawingRegionValid = false; +// } if (!fUpdateRequested) { // send this to client @@ -1850,6 +1860,7 @@ ServerWindow()->SendMessageToClient(&message); fUpdateRequested = true; + fEffectiveDrawingRegionValid = false; } void From stefano.ceccherini at gmail.com Thu Aug 9 08:17:42 2007 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Thu, 9 Aug 2007 08:17:42 +0200 Subject: [Haiku-commits] r21867 - haiku/trunk/src/servers/app In-Reply-To: <200708090033.l790XpSJ016844@sheep.berlios.de> References: <200708090033.l790XpSJ016844@sheep.berlios.de> Message-ID: <894b9700708082317q76c7b0f4m15ef1925c66626a4@mail.gmail.com> 2007/8/9, stippi at BerliOS : > * fixes funny text rendering in the selected part of text views. For example > ticket #908. Cool! From stefano.ceccherini at gmail.com Thu Aug 9 08:23:31 2007 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Thu, 9 Aug 2007 08:23:31 +0200 Subject: [Haiku-commits] r21855 - haiku/trunk/src/servers/app In-Reply-To: <200708081836.l78IaNJ0009480@sheep.berlios.de> References: <200708081836.l78IaNJ0009480@sheep.berlios.de> Message-ID: <894b9700708082323p1898588awe3bf10c78aa0825b@mail.gmail.com> 2007/8/8, stippi at BerliOS : > * convert shape coordinates to screen at the time of playing the picture > (fixes ticket #1367, stefano I thought you knew that I meant this in an > earlier mail) Actually, I had tried to make this very change. But that didn't help. I tried so many different changes but none seemed to make any difference. Now I see why: I was calling jam update-vmware-image with a wrong commandline, so it wasn't really rebuilding the app_server. *_* From jackburton at mail.berlios.de Thu Aug 9 11:38:20 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Thu, 9 Aug 2007 11:38:20 +0200 Subject: [Haiku-commits] r21868 - haiku/trunk/src/kits/interface Message-ID: <200708090938.l799cKdC026132@sheep.berlios.de> Author: jackburton Date: 2007-08-09 11:38:19 +0200 (Thu, 09 Aug 2007) New Revision: 21868 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21868&view=rev Modified: haiku/trunk/src/kits/interface/TextView.cpp Log: Scrolling didn't work correctly if the user didn't move the mouse all the time. Fixed. Modified: haiku/trunk/src/kits/interface/TextView.cpp =================================================================== --- haiku/trunk/src/kits/interface/TextView.cpp 2007-08-09 00:33:50 UTC (rev 21867) +++ haiku/trunk/src/kits/interface/TextView.cpp 2007-08-09 09:38:19 UTC (rev 21868) @@ -90,23 +90,10 @@ class _BTextTrackState_ { public: - _BTextTrackState_(BMessenger messenger) - : - clickOffset(0), - shiftDown(false), - anchor(0), - selStart(0), - selEnd(0), - fRunner(NULL) - { - BMessage message(_PING_); - fRunner = new (nothrow) BMessageRunner(messenger, &message, 300000); - } + _BTextTrackState_(BMessenger messenger); + ~_BTextTrackState_(); - ~_BTextTrackState_() - { - delete fRunner; - } + void SimulateMouseMovement(BTextView *view); int32 clickOffset; bool shiftDown; @@ -906,8 +893,10 @@ delete fClickRunner; fClickRunner = NULL; } - } else + } else if (fTrackingMouse) { + fTrackingMouse->SimulateMouseMovement(this); PerformAutoScrolling(); + } break; } @@ -4539,3 +4528,39 @@ if (atomic_add(&sWidthAtom, -1) > 1) release_sem(sWidthSem); } + + +// _BTextTrackState_ +_BTextTrackState_::_BTextTrackState_(BMessenger messenger) + : + clickOffset(0), + shiftDown(false), + anchor(0), + selStart(0), + selEnd(0), + fRunner(NULL) +{ + BMessage message(_PING_); + fRunner = new (nothrow) BMessageRunner(messenger, &message, 300000); +} + + +_BTextTrackState_::~_BTextTrackState_() +{ + delete fRunner; +} + + +void +_BTextTrackState_::SimulateMouseMovement(BTextView *textView) +{ + BPoint where; + ulong buttons; + // When the mouse cursor is still and outside the textview, + // no B_MOUSE_MOVED message are sent, obviously. But scrolling + // has to work neverthless, so we "fake" a MouseMoved() call here. + textView->GetMouse(&where, &buttons); + textView->PerformMouseMoved(where, B_INSIDE_VIEW); +} + + From stippi at mail.berlios.de Thu Aug 9 11:48:28 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 9 Aug 2007 11:48:28 +0200 Subject: [Haiku-commits] r21869 - in haiku/trunk/src/servers/app: . drawing drawing/Painter Message-ID: <200708090948.l799mSvK027093@sheep.berlios.de> Author: stippi Date: 2007-08-09 11:48:28 +0200 (Thu, 09 Aug 2007) New Revision: 21869 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21869&view=rev Modified: haiku/trunk/src/servers/app/ServerWindow.cpp haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp haiku/trunk/src/servers/app/drawing/DrawingEngine.h haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp haiku/trunk/src/servers/app/drawing/Painter/Painter.h Log: * added a version of SetFont() that takes a DrawState* to DrawingEngine and Painter, that is needed to be able to tell if anti-aliasing is to be used, since the flags in the font can be overruled by the flags in the view... * fixes aliased fonts reliably, tested with FontDemo Modified: haiku/trunk/src/servers/app/ServerWindow.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerWindow.cpp 2007-08-09 09:38:19 UTC (rev 21868) +++ haiku/trunk/src/servers/app/ServerWindow.cpp 2007-08-09 09:48:28 UTC (rev 21869) @@ -1271,9 +1271,8 @@ { DTRACE(("ServerWindow %s: Message AS_LAYER_SET_FONT_STATE: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name())); fCurrentLayer->CurrentState()->ReadFontFromLink(link); -// _UpdateDrawState(fCurrentLayer); fWindowLayer->GetDrawingEngine()->SetFont( - fCurrentLayer->CurrentState()->Font()); + fCurrentLayer->CurrentState()); break; } case AS_LAYER_GET_STATE: Modified: haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp 2007-08-09 09:38:19 UTC (rev 21868) +++ haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp 2007-08-09 09:48:28 UTC (rev 21869) @@ -185,28 +185,28 @@ void DrawingEngine::SetDrawState(const DrawState* state, int32 xOffset, int32 yOffset) { - fPainter->SetDrawState(state, xOffset, yOffset); + fPainter->SetDrawState(state, xOffset, yOffset); } void DrawingEngine::SetHighColor(const rgb_color& color) { - fPainter->SetHighColor(color); + fPainter->SetHighColor(color); } void DrawingEngine::SetLowColor(const rgb_color& color) { - fPainter->SetLowColor(color); + fPainter->SetLowColor(color); } void DrawingEngine::SetPenSize(float size) { - fPainter->SetPenSize(size); + fPainter->SetPenSize(size); } @@ -214,38 +214,45 @@ DrawingEngine::SetStrokeMode(cap_mode lineCap, join_mode joinMode, float miterLimit) { - fPainter->SetStrokeMode(lineCap, joinMode, miterLimit); + fPainter->SetStrokeMode(lineCap, joinMode, miterLimit); } void DrawingEngine::SetBlendingMode(source_alpha srcAlpha, alpha_function alphaFunc) { - fPainter->SetBlendingMode(srcAlpha, alphaFunc); + fPainter->SetBlendingMode(srcAlpha, alphaFunc); } void DrawingEngine::SetPattern(const struct pattern& pattern) { - fPainter->SetPattern(pattern, false); + fPainter->SetPattern(pattern, false); } void DrawingEngine::SetDrawingMode(drawing_mode mode) { - fPainter->SetDrawingMode(mode); + fPainter->SetDrawingMode(mode); } void DrawingEngine::SetFont(const ServerFont& font) { - fPainter->SetFont(font); + fPainter->SetFont(font); } +void +DrawingEngine::SetFont(const DrawState* state) +{ + fPainter->SetFont(state); +} + + // #pragma mark - Modified: haiku/trunk/src/servers/app/drawing/DrawingEngine.h =================================================================== --- haiku/trunk/src/servers/app/drawing/DrawingEngine.h 2007-08-09 09:38:19 UTC (rev 21868) +++ haiku/trunk/src/servers/app/drawing/DrawingEngine.h 2007-08-09 09:48:28 UTC (rev 21869) @@ -79,6 +79,7 @@ void SetBlendingMode(source_alpha srcAlpha, alpha_function alphaFunc); void SetFont(const ServerFont& font); + void SetFont(const DrawState* state); void SuspendAutoSync(); void Sync(); Modified: haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp 2007-08-09 09:38:19 UTC (rev 21868) +++ haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp 2007-08-09 09:48:28 UTC (rev 21869) @@ -130,9 +130,7 @@ // but for now... SetPenSize(data->PenSize()); - SetFont(data->Font()); - fTextRenderer.SetAntialiasing(!(data->ForceFontAliasing() - || data->Font().Flags() & B_DISABLE_ANTIALIASING)); + SetFont(data); fSubpixelPrecise = data->SubPixelPrecise(); @@ -260,8 +258,19 @@ Painter::SetFont(const ServerFont& font) { fTextRenderer.SetFont(font); + fTextRenderer.SetAntialiasing( + !(font.Flags() & B_DISABLE_ANTIALIASING)); } +// SetFont +void +Painter::SetFont(const DrawState* state) +{ + fTextRenderer.SetFont(state->Font()); + fTextRenderer.SetAntialiasing(!(state->ForceFontAliasing() + || state->Font().Flags() & B_DISABLE_ANTIALIASING)); +} + // #pragma mark - drawing // StrokeLine Modified: haiku/trunk/src/servers/app/drawing/Painter/Painter.h =================================================================== --- haiku/trunk/src/servers/app/drawing/Painter/Painter.h 2007-08-09 09:38:19 UTC (rev 21868) +++ haiku/trunk/src/servers/app/drawing/Painter/Painter.h 2007-08-09 09:48:28 UTC (rev 21869) @@ -85,6 +85,7 @@ alpha_function alphaFunc); void SetFont(const ServerFont& font); + void SetFont(const DrawState* state); inline const ServerFont& Font() const { return fTextRenderer.Font(); } From jackburton at mail.berlios.de Thu Aug 9 12:35:10 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Thu, 9 Aug 2007 12:35:10 +0200 Subject: [Haiku-commits] r21870 - haiku/trunk/src/apps/terminal Message-ID: <200708091035.l79AZAgm009914@sheep.berlios.de> Author: jackburton Date: 2007-08-09 12:35:08 +0200 (Thu, 09 Aug 2007) New Revision: 21870 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21870&view=rev Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp haiku/trunk/src/apps/terminal/TermWindow.h Log: TermWindow didn't set the colors correctly on Terminals in a new tab. Now TermWindow::_SetTermColors() accepts a pointer to a TermView to fix that. Spotted by Andrea Bernardi. Thanks! Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.cpp 2007-08-09 09:48:28 UTC (rev 21869) +++ haiku/trunk/src/apps/terminal/TermWindow.cpp 2007-08-09 10:35:08 UTC (rev 21870) @@ -441,7 +441,7 @@ break; case MSG_COLOR_CHANGED: - _SetTermColors(); + _SetTermColors(_ActiveTermView()); _ActiveTermView()->Invalidate(); break; @@ -487,15 +487,15 @@ void -TermWindow::_SetTermColors() +TermWindow::_SetTermColors(TermView *termView) { - _ActiveTermView()->SetTextColor(PrefHandler::Default()->getRGB(PREF_TEXT_FORE_COLOR), + termView->SetTextColor(PrefHandler::Default()->getRGB(PREF_TEXT_FORE_COLOR), PrefHandler::Default()->getRGB(PREF_TEXT_BACK_COLOR)); - _ActiveTermView()->SetSelectColor(PrefHandler::Default()->getRGB(PREF_SELECT_FORE_COLOR), + termView->SetSelectColor(PrefHandler::Default()->getRGB(PREF_SELECT_FORE_COLOR), PrefHandler::Default()->getRGB(PREF_SELECT_BACK_COLOR)); - _ActiveTermView()->SetCursorColor(PrefHandler::Default()->getRGB(PREF_CURSOR_FORE_COLOR), + termView->SetCursorColor(PrefHandler::Default()->getRGB(PREF_CURSOR_FORE_COLOR), PrefHandler::Default()->getRGB(PREF_CURSOR_BACK_COLOR)); } @@ -600,7 +600,7 @@ view->SetEncoding(longname2id(PrefHandler::Default()->getString(PREF_TEXT_ENCODING))); view->SetTermFont(&halfFont, &fullFont); - _SetTermColors(); + _SetTermColors(view); // If it's the first time we're called, setup the window if (fTabView->CountTabs() == 1) { Modified: haiku/trunk/src/apps/terminal/TermWindow.h =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.h 2007-08-09 09:48:28 UTC (rev 21869) +++ haiku/trunk/src/apps/terminal/TermWindow.h 2007-08-09 10:35:08 UTC (rev 21870) @@ -54,7 +54,7 @@ private: - void _SetTermColors(); + void _SetTermColors(TermView *termView); void _InitWindow(const char *command); void _SetupMenu(); status_t _DoPageSetup(); From bonefish at mail.berlios.de Thu Aug 9 21:40:22 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 9 Aug 2007 21:40:22 +0200 Subject: [Haiku-commits] r21871 - haiku/trunk/build/jam Message-ID: <200708091940.l79JeMK2031856@sheep.berlios.de> Author: bonefish Date: 2007-08-09 21:40:19 +0200 (Thu, 09 Aug 2007) New Revision: 21871 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21871&view=rev Modified: haiku/trunk/build/jam/NetBootArchive Log: Remove mpu401 driver from the netboot archive. Modified: haiku/trunk/build/jam/NetBootArchive =================================================================== --- haiku/trunk/build/jam/NetBootArchive 2007-08-09 10:35:08 UTC (rev 21870) +++ haiku/trunk/build/jam/NetBootArchive 2007-08-09 19:40:19 UTC (rev 21871) @@ -38,7 +38,7 @@ AddFilesToNetBootArchive beos system add-ons kernel file_systems : $(BEOS_ADD_ONS_FILE_SYSTEMS) ; AddFilesToNetBootArchive beos system add-ons kernel generic - : block_io fast_log ide_adapter locked_pool mpu401 scsi_periph ; + : block_io fast_log ide_adapter locked_pool scsi_periph ; AddFilesToNetBootArchive beos system add-ons kernel partitioning_systems : intel session ; AddFilesToNetBootArchive beos system add-ons kernel interrupt_controllers @@ -82,7 +82,7 @@ $(BEOS_ADD_ONS_BUS_MANAGERS) ahci generic_ide_pci $(X86_ONLY)ide_isa silicon_image_3112 $(BEOS_ADD_ONS_FILE_SYSTEMS) - block_io fast_log ide_adapter locked_pool mpu401 scsi_periph + block_io fast_log ide_adapter locked_pool scsi_periph intel session $(PPC_ONLY)openpic $(X86_ONLY)generic_x86 From bonefish at mail.berlios.de Thu Aug 9 21:42:22 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 9 Aug 2007 21:42:22 +0200 Subject: [Haiku-commits] r21872 - haiku/trunk/build/jam Message-ID: <200708091942.l79JgMQB032074@sheep.berlios.de> Author: bonefish Date: 2007-08-09 21:42:21 +0200 (Thu, 09 Aug 2007) New Revision: 21872 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21872&view=rev Modified: haiku/trunk/build/jam/HeadersRules Log: New rule UsePrivateKernelHeaders. It adds header/private/kernel as well as all directories that might be needed by private kernel headers (arch, platform,... headers). Modified: haiku/trunk/build/jam/HeadersRules =================================================================== --- haiku/trunk/build/jam/HeadersRules 2007-08-09 19:40:19 UTC (rev 21871) +++ haiku/trunk/build/jam/HeadersRules 2007-08-09 19:42:21 UTC (rev 21872) @@ -338,6 +338,11 @@ SourceSysHdrs $(1) : [ FDirName $(HAIKU_TOP) headers legacy ] : $(2) ; } +rule UsePrivateKernelHeaders +{ + UseHeaders $(TARGET_PRIVATE_KERNEL_HEADERS) : true ; +} + rule FStandardOSHeaders { local osIncludes = add-ons add-ons/file_system add-ons/graphics From bonefish at mail.berlios.de Thu Aug 9 21:47:22 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 9 Aug 2007 21:47:22 +0200 Subject: [Haiku-commits] r21873 - in haiku/trunk: headers/private/kernel/util src/add-ons/kernel/drivers/tty src/add-ons/kernel/network/datalink_protocols/arp src/add-ons/kernel/network/devices/ethernet src/add-ons/kernel/network/protocols/ipv4 src/add-ons/kernel/network/protocols/tcp src/add-ons/kernel/network/protocols/udp Message-ID: <200708091947.l79JlMUs032423@sheep.berlios.de> Author: bonefish Date: 2007-08-09 21:47:22 +0200 (Thu, 09 Aug 2007) New Revision: 21873 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21873&view=rev Modified: haiku/trunk/headers/private/kernel/util/AutoLock.h haiku/trunk/src/add-ons/kernel/drivers/tty/Jamfile haiku/trunk/src/add-ons/kernel/network/datalink_protocols/arp/Jamfile haiku/trunk/src/add-ons/kernel/network/devices/ethernet/Jamfile haiku/trunk/src/add-ons/kernel/network/protocols/ipv4/Jamfile haiku/trunk/src/add-ons/kernel/network/protocols/tcp/Jamfile haiku/trunk/src/add-ons/kernel/network/protocols/udp/Jamfile Log: * Added AutoLocker instantiations IterruptsLocker (disables/restores interrupts) and SpinLocker (acquires/releases spinlocks). * Adjusted Jamfiles of components that used but didn't add all header directories required now ( was added). Modified: haiku/trunk/headers/private/kernel/util/AutoLock.h =================================================================== --- haiku/trunk/headers/private/kernel/util/AutoLock.h 2007-08-09 19:42:21 UTC (rev 21872) +++ haiku/trunk/headers/private/kernel/util/AutoLock.h 2007-08-09 19:47:22 UTC (rev 21873) @@ -6,10 +6,14 @@ #define KERNEL_UTIL_AUTO_LOCKER_H -#include +#include + #include +#include +#include + namespace BPrivate { // MutexLocking @@ -63,11 +67,60 @@ // BenaphoreLocker typedef AutoLocker BenaphoreLocker; +// InterruptsLocking +class InterruptsLocking { +public: + inline bool Lock(int* lockable) + { + *lockable = disable_interrupts(); + return true; + } + + inline void Unlock(int* lockable) + { + restore_interrupts(*lockable); + } +}; + +// InterruptsLocker +class InterruptsLocker : AutoLocker { +public: + inline InterruptsLocker(bool alreadyLocked = false, + bool lockIfNotLocked = true) + : AutoLocker(&fState, alreadyLocked, + lockIfNotLocked) + { + } + +private: + int fState; +}; + +// SpinLocking +class SpinLocking { +public: + inline bool Lock(spinlock* lockable) + { + acquire_spinlock(lockable); + return true; + } + + inline void Unlock(spinlock* lockable) + { + release_spinlock(lockable); + } +}; + +// SpinLocker +typedef AutoLocker SpinLocker; + } // namespace BPrivate using BPrivate::AutoLocker; using BPrivate::MutexLocker; using BPrivate::RecursiveLocker; using BPrivate::BenaphoreLocker; +using BPrivate::InterruptsLocker; +using BPrivate::SpinLocker; #endif // KERNEL_UTIL_AUTO_LOCKER_H Modified: haiku/trunk/src/add-ons/kernel/drivers/tty/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/tty/Jamfile 2007-08-09 19:42:21 UTC (rev 21872) +++ haiku/trunk/src/add-ons/kernel/drivers/tty/Jamfile 2007-08-09 19:47:22 UTC (rev 21873) @@ -1,6 +1,6 @@ SubDir HAIKU_TOP src add-ons kernel drivers tty ; -UsePrivateHeaders kernel ; +UsePrivateKernelHeaders ; KernelAddon tty : driver.cpp Modified: haiku/trunk/src/add-ons/kernel/network/datalink_protocols/arp/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/network/datalink_protocols/arp/Jamfile 2007-08-09 19:42:21 UTC (rev 21872) +++ haiku/trunk/src/add-ons/kernel/network/datalink_protocols/arp/Jamfile 2007-08-09 19:47:22 UTC (rev 21873) @@ -10,7 +10,8 @@ # Unfortunately we get more than we want, namely all POSIX headers. } -UsePrivateHeaders kernel net ; +UsePrivateKernelHeaders ; +UsePrivateHeaders net ; KernelAddon arp : arp.cpp Modified: haiku/trunk/src/add-ons/kernel/network/devices/ethernet/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/network/devices/ethernet/Jamfile 2007-08-09 19:42:21 UTC (rev 21872) +++ haiku/trunk/src/add-ons/kernel/network/devices/ethernet/Jamfile 2007-08-09 19:47:22 UTC (rev 21873) @@ -10,7 +10,8 @@ # Unfortunately we get more than we want, namely all POSIX headers. } -UsePrivateHeaders kernel net ; +UsePrivateKernelHeaders ; +UsePrivateHeaders net ; KernelAddon ethernet : ethernet.cpp Modified: haiku/trunk/src/add-ons/kernel/network/protocols/ipv4/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/ipv4/Jamfile 2007-08-09 19:42:21 UTC (rev 21872) +++ haiku/trunk/src/add-ons/kernel/network/protocols/ipv4/Jamfile 2007-08-09 19:47:22 UTC (rev 21873) @@ -10,7 +10,8 @@ # Unfortunately we get more than we want, namely all POSIX headers. } -UsePrivateHeaders kernel net ; +UsePrivateKernelHeaders ; +UsePrivateHeaders net ; KernelAddon ipv4 : ipv4.cpp Modified: haiku/trunk/src/add-ons/kernel/network/protocols/tcp/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/tcp/Jamfile 2007-08-09 19:42:21 UTC (rev 21872) +++ haiku/trunk/src/add-ons/kernel/network/protocols/tcp/Jamfile 2007-08-09 19:47:22 UTC (rev 21873) @@ -10,7 +10,8 @@ # Unfortunately we get more than we want, namely all POSIX headers. } -UsePrivateHeaders kernel net ; +UsePrivateKernelHeaders ; +UsePrivateHeaders net ; KernelAddon tcp : tcp.cpp Modified: haiku/trunk/src/add-ons/kernel/network/protocols/udp/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/udp/Jamfile 2007-08-09 19:42:21 UTC (rev 21872) +++ haiku/trunk/src/add-ons/kernel/network/protocols/udp/Jamfile 2007-08-09 19:47:22 UTC (rev 21873) @@ -10,7 +10,8 @@ # Unfortunately we get more than we want, namely all POSIX headers. } -UsePrivateHeaders kernel net ; +UsePrivateKernelHeaders ; +UsePrivateHeaders net ; KernelAddon udp : udp.cpp From korli at users.berlios.de Thu Aug 9 21:52:11 2007 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Thu, 9 Aug 2007 21:52:11 +0200 Subject: [Haiku-commits] r21871 - haiku/trunk/build/jam In-Reply-To: <200708091940.l79JeMK2031856@sheep.berlios.de> References: <200708091940.l79JeMK2031856@sheep.berlios.de> Message-ID: 2007/8/9, bonefish at BerliOS : > > Remove mpu401 driver from the netboot archive. the emuxki driver will fail to load without this module. not that important for a net boot :) Bye, J?r?me -------------- next part -------------- An HTML attachment was scrubbed... URL: From bonefish at mail.berlios.de Thu Aug 9 22:03:17 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 9 Aug 2007 22:03:17 +0200 Subject: [Haiku-commits] r21874 - in haiku/trunk: headers/private/kernel src/system/kernel Message-ID: <200708092003.l79K3Hpq000721@sheep.berlios.de> Author: bonefish Date: 2007-08-09 22:03:17 +0200 (Thu, 09 Aug 2007) New Revision: 21874 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21874&view=rev Added: haiku/trunk/headers/private/kernel/condition_variable.h haiku/trunk/src/system/kernel/condition_variable.cpp Modified: haiku/trunk/src/system/kernel/Jamfile Log: Added simple condition variables to the kernel. They are a relatively cheap means to block threads until notified explicitely. threads Added: haiku/trunk/headers/private/kernel/condition_variable.h =================================================================== --- haiku/trunk/headers/private/kernel/condition_variable.h 2007-08-09 19:47:22 UTC (rev 21873) +++ haiku/trunk/headers/private/kernel/condition_variable.h 2007-08-09 20:03:17 UTC (rev 21874) @@ -0,0 +1,151 @@ +/* + * Copyright 2007, Ingo Weinhold, bonefish at cs.tu-berlin.de. + * Distributed under the terms of the MIT License. + */ +#ifndef _KERNEL_CONDITION_VARIABLE_H +#define _KERNEL_CONDITION_VARIABLE_H + + +#include + +#ifdef __cplusplus + +#include + + +class PrivateConditionVariable; + +class PrivateConditionVariableEntry { +protected: + bool Add(const void* object); + void Wait(); + void Wait(const void* object); + +protected: + PrivateConditionVariableEntry* fNext; + PrivateConditionVariable* fVariable; + struct thread* fThread; + + friend class PrivateConditionVariable; +}; + + +struct PrivateConditionVariable + : protected HashTableLink { +public: + static void ListAll(); + void Dump(); + +protected: + void Publish(const void* object, + const char* objectType); + void Unpublish(); + void Notify(); + +private: + void _Notify(); + +protected: + const void* fObject; + const char* fObjectType; + PrivateConditionVariableEntry* fEntries; + + friend class PrivateConditionVariableEntry; + friend class ConditionVariableHashDefinition; +}; + + +template +class ConditionVariable : private PrivateConditionVariable { +public: + inline void Publish(const Type* object, + const char* objectType); + + inline void Unpublish(); + inline void Notify(); +}; + + +template +class ConditionVariableEntry : private PrivateConditionVariableEntry { +public: + inline bool Add(const Type* object); + inline void Wait(); + inline void Wait(const Type* object); + +private: + bool fAdded; +}; + + +template +inline void +ConditionVariable::Publish(const Type* object, const char* objectType) +{ + PrivateConditionVariable::Publish(object, objectType); +} + + +template +inline void +ConditionVariable::Unpublish() +{ + PrivateConditionVariable::Unpublish(); +} + + +template +inline void +ConditionVariable::Notify() +{ + PrivateConditionVariable::Notify(); +} + + +template +inline bool +ConditionVariableEntry::Add(const Type* object) +{ + return PrivateConditionVariableEntry::Add(object); +} + + +template +inline void +ConditionVariableEntry::Wait() +{ + PrivateConditionVariableEntry::Wait(); +} + + +template +inline void +ConditionVariableEntry::Wait(const Type* object) +{ + PrivateConditionVariableEntry::Wait(object); +} + + +#if 0 +extern void publish_stack_condition_variable(condition_variable* variable, + const void* object, const char* objectType); +extern void unpublish_condition_variable(const void* object); +extern void notify_condition_variable(const void* object); + +extern void wait_for_condition_variable(const void* object); +extern bool add_condition_variable_entry(const void* object, + condition_variable_entry* entry); +extern void wait_for_condition_variable_entry( + condition_variable_entry* entry); +#endif // 0 + +extern "C" { +#endif // __cplusplus + +extern void condition_variable_init(); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif /* _KERNEL_CONDITION_VARIABLE_H */ Modified: haiku/trunk/src/system/kernel/Jamfile =================================================================== --- haiku/trunk/src/system/kernel/Jamfile 2007-08-09 19:47:22 UTC (rev 21873) +++ haiku/trunk/src/system/kernel/Jamfile 2007-08-09 20:03:17 UTC (rev 21874) @@ -16,6 +16,7 @@ KernelMergeObject kernel_core.o : boot_item.cpp + condition_variable.cpp cpu.c elf.cpp heap.c Added: haiku/trunk/src/system/kernel/condition_variable.cpp =================================================================== --- haiku/trunk/src/system/kernel/condition_variable.cpp 2007-08-09 19:47:22 UTC (rev 21873) +++ haiku/trunk/src/system/kernel/condition_variable.cpp 2007-08-09 20:03:17 UTC (rev 21874) @@ -0,0 +1,427 @@ +/* + * Copyright 2007, Ingo Weinhold, bonefish at cs.tu-berlin.de. + * Distributed under the terms of the MIT License. + */ + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + + +static const int kConditionVariableHashSize = 64; + + +struct ConditionVariableHashDefinition { + typedef const void* KeyType; + typedef PrivateConditionVariable ValueType; + + size_t HashKey(const void* key) const + { return (size_t)key; } + size_t Hash(PrivateConditionVariable* variable) const + { return (size_t)variable->fObject; } + bool Compare(const void* key, PrivateConditionVariable* variable) const + { return key == variable->fObject; } + HashTableLink* GetLink( + PrivateConditionVariable* variable) const + { return variable; } +}; + +typedef OpenHashTable ConditionVariableHash; +static ConditionVariableHash sConditionVariableHash; +static spinlock sConditionVariablesLock; + + +static int +list_condition_variables(int argc, char** argv) +{ + PrivateConditionVariable::ListAll(); + return 0; +} + + +static int +dump_condition_variable(int argc, char** argv) +{ + if (argc < 2 || strlen(argv[1]) < 2 + || argv[1][0] != '0' + || argv[1][1] != 'x') { + kprintf("%s: invalid argument, pass address\n", argv[0]); + return 0; + } + + addr_t address = strtoul(argv[1], NULL, 0); + if (address == NULL) + return 0; + + PrivateConditionVariable* variable = sConditionVariableHash.Lookup( + (void*)address); + + if (variable == NULL) { + // It might be a direct pointer to a condition variable. Search the + // hash. + ConditionVariableHash::Iterator it(&sConditionVariableHash); + while (PrivateConditionVariable* hashVariable = it.Next()) { + if (hashVariable == (void*)address) { + variable = hashVariable; + break; + } + } + } + + if (variable != NULL) + variable->Dump(); + else + kprintf("no condition variable at or with key %p\n", (void*)address); + + return 0; +} + + +// #pragma mark - PrivateConditionVariableEntry + + +bool +PrivateConditionVariableEntry::Add(const void* object) +{ + ASSERT(object != NULL); + + fThread = thread_get_current_thread(); + + InterruptsLocker _; + SpinLocker locker(sConditionVariablesLock); + + fVariable = sConditionVariableHash.Lookup(object); + if (fVariable) { + fNext = fVariable->fEntries; + fVariable->fEntries = this; + } + + return (fVariable != NULL); +} + + +void +PrivateConditionVariableEntry::Wait() +{ + if (!are_interrupts_enabled()) { + panic("wait_for_condition_variable_entry() called with interrupts " + "disabled"); + return; + } + + InterruptsLocker _; + SpinLocker locker(sConditionVariablesLock); + + if (fVariable != NULL) { + struct thread* thread = thread_get_current_thread(); + thread->next_state = B_THREAD_WAITING; + thread->condition_variable = fVariable; + thread->sem.blocking = -1; + + GRAB_THREAD_LOCK(); + locker.Unlock(); + scheduler_reschedule(); + RELEASE_THREAD_LOCK(); + } +} + + +void +PrivateConditionVariableEntry::Wait(const void* object) +{ + if (Add(object)) + Wait(object); +} + + +// #pragma mark - PrivateConditionVariable + + +/*static*/ void +PrivateConditionVariable::ListAll() +{ + kprintf(" variable object (type) waiting threads\n"); + kprintf("------------------------------------------------------------\n"); + ConditionVariableHash::Iterator it(&sConditionVariableHash); + while (PrivateConditionVariable* variable = it.Next()) { + // count waiting threads + int count = 0; + PrivateConditionVariableEntry* entry = variable->fEntries; + while (entry) { + count++; + entry = entry->fNext; + } + + kprintf("%p %p %-20s %15d\n", variable, variable->fObject, + variable->fObjectType, count); + } +} + + +void +PrivateConditionVariable::Dump() +{ + kprintf("condition variable %p\n", this); + kprintf(" object: %p (%s)\n", fObject, fObjectType); + kprintf(" threads:"); + PrivateConditionVariableEntry* entry = fEntries; + while (entry) { + kprintf(" %ld", entry->fThread->id); + entry = entry->fNext; + } + kprintf("\n"); +} + + +void +PrivateConditionVariable::Publish(const void* object, const char* objectType) +{ + ASSERT(object != NULL); + + fObject = object; + fObjectType = objectType; + fEntries = NULL; + + InterruptsLocker _; + SpinLocker locker(sConditionVariablesLock); + + ASSERT_PRINT(sConditionVariableHash.Lookup(object) == NULL, + "condition variable: %p\n", sConditionVariableHash.Lookup(object)); + + sConditionVariableHash.InsertUnchecked(this); +} + + +void +PrivateConditionVariable::Unpublish() +{ + ASSERT(fObject != NULL); + + InterruptsLocker _; + SpinLocker locker(sConditionVariablesLock); + +#if KDEBUG + PrivateConditionVariable* variable = sConditionVariableHash.Lookup(fObject); + if (variable != this) { + panic("Condition variable %p not published, found: %p", this, variable); + return; + } +#endif + + sConditionVariableHash.RemoveUnchecked(this); + fObject = NULL; + fObjectType = NULL; + + if (fEntries) + _Notify(); +} + + +void +PrivateConditionVariable::Notify() +{ + ASSERT(fObject != NULL); + + InterruptsLocker _; + SpinLocker locker(sConditionVariablesLock); + +#if KDEBUG + PrivateConditionVariable* variable = sConditionVariableHash.Lookup(fObject); + if (variable != this) { + panic("Condition variable %p not published, found: %p", this, variable); + return; + } +#endif + + if (fEntries) + _Notify(); +} + + +//! Called with interrupts disabled and the condition variable spinlock held. +void +PrivateConditionVariable::_Notify() +{ + // dequeue and wake up the blocked threads + GRAB_THREAD_LOCK(); + + while (PrivateConditionVariableEntry* entry = fEntries) { + fEntries = entry->fNext; + + entry->fNext = NULL; + entry->fVariable = NULL; + + entry->fThread->condition_variable = NULL; + if (entry->fThread->state == B_THREAD_WAITING) { + entry->fThread->state = B_THREAD_READY; + scheduler_enqueue_in_run_queue(entry->fThread); + } + } + + RELEASE_THREAD_LOCK(); +} + + +#if 0 + +void +publish_stack_condition_variable(condition_variable* variable, + const void* object, const char* objectType) +{ + ASSERT(variable != NULL); + ASSERT(object != NULL); + + variable->object = object; + variable->object_type = objectType; + variable->entries = NULL; + + InterruptsLocker _; + SpinLocker locker(sConditionVariablesLock); + + ASSERT_PRINT(sConditionVariableHash.Lookup(object) == NULL, + "condition variable: %p\n", sConditionVariableHash.Lookup(object)); + + sConditionVariableHash.InsertUnchecked(variable); +} + + +void +unpublish_condition_variable(const void* object) +{ + ASSERT(object != NULL); + + InterruptsLocker _; + SpinLocker locker(sConditionVariablesLock); + + condition_variable* variable = sConditionVariableHash.Lookup(object); + condition_variable_entry* entries = NULL; + if (variable) { + sConditionVariableHash.RemoveUnchecked(variable); + entries = variable->entries; + variable->object = NULL; + variable->object_type = NULL; + variable->entries = NULL; + } else { + panic("No condition variable for %p\n", object); + } + + if (entries) + notify_condition_variable_entries(entries); +} + + +void +notify_condition_variable(const void* object) +{ + ASSERT(object != NULL); + + InterruptsLocker _; + SpinLocker locker(sConditionVariablesLock); + + condition_variable* variable = sConditionVariableHash.Lookup(object); + condition_variable_entry* entries = NULL; + if (variable) { + entries = variable->entries; + variable->entries = NULL; + } else { + panic("No condition variable for %p\n", object); + } + + locker.Unlock(); + + if (entries) + notify_condition_variable_entries(entries); +} + + +void +wait_for_condition_variable(const void* object) +{ + condition_variable_entry entry; + if (add_condition_variable_entry(object, &entry)) + wait_for_condition_variable_entry(&entry); +} + + +bool +add_condition_variable_entry(const void* object, + condition_variable_entry* entry) +{ + ASSERT(object != NULL); + ASSERT(entry != NULL); + + entry->thread = thread_get_current_thread(); + + InterruptsLocker _; + SpinLocker locker(sConditionVariablesLock); + + condition_variable* variable = sConditionVariableHash.Lookup(object); + if (variable) { + entry->variable = variable; + entry->next = variable->entries; + variable->entries = entry; + } else + entry->variable = NULL; + + return (variable != NULL); +} + + +void +wait_for_condition_variable_entry(condition_variable_entry* entry) +{ + ASSERT(entry != NULL); + + if (!are_interrupts_enabled()) { + panic("wait_for_condition_variable_entry() called with interrupts " + "disabled"); + return; + } + + InterruptsLocker _; + SpinLocker locker(sConditionVariablesLock); + + condition_variable* variable = entry->variable; + if (variable != NULL) { + struct thread* thread = thread_get_current_thread(); + thread->next_state = B_THREAD_WAITING; + thread->condition_variable = variable; + thread->sem.blocking = -1; + } + + if (variable != NULL) { + GRAB_THREAD_LOCK(); + locker.Unlock(); + scheduler_reschedule(); + RELEASE_THREAD_LOCK(); + } +} +#endif + + +void +condition_variable_init() +{ + new(&sConditionVariableHash) ConditionVariableHash( + kConditionVariableHashSize); + + status_t error = sConditionVariableHash.InitCheck(); + if (error != B_OK) { + panic("condition_variable_init(): Failed to init hash table: %s", + strerror(error)); + } + + add_debugger_command("condition_variable", &dump_condition_variable, + "Dump condition_variable"); + add_debugger_command("condition_variables", &list_condition_variables, + "List condition variables"); +} + From bonefish at mail.berlios.de Thu Aug 9 22:08:26 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 9 Aug 2007 22:08:26 +0200 Subject: [Haiku-commits] r21875 - in haiku/trunk: headers/private/kernel src/system/kernel src/system/kernel/cache src/system/kernel/vm Message-ID: <200708092008.l79K8QeJ000943@sheep.berlios.de> Author: bonefish Date: 2007-08-09 22:08:25 +0200 (Thu, 09 Aug 2007) New Revision: 21875 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21875&view=rev Added: haiku/trunk/src/system/kernel/vm/vm_page.cpp Removed: haiku/trunk/src/system/kernel/vm/vm_page.c Modified: haiku/trunk/headers/private/kernel/thread_types.h haiku/trunk/headers/private/kernel/vm_types.h haiku/trunk/src/system/kernel/cache/file_cache.cpp haiku/trunk/src/system/kernel/main.c haiku/trunk/src/system/kernel/thread.c haiku/trunk/src/system/kernel/vm/Jamfile haiku/trunk/src/system/kernel/vm/vm.cpp haiku/trunk/src/system/kernel/vm/vm_cache.cpp Log: * Use condition variables when waiting for busy pages or busy caches. * Removed a few instances where the page state was set busy directly after allocating it. This is a no-op, since a page is always busy after allocation. Modified: haiku/trunk/headers/private/kernel/thread_types.h =================================================================== --- haiku/trunk/headers/private/kernel/thread_types.h 2007-08-09 20:03:17 UTC (rev 21874) +++ haiku/trunk/headers/private/kernel/thread_types.h 2007-08-09 20:08:25 UTC (rev 21875) @@ -152,6 +152,8 @@ int32 flags; } sem; + struct PrivateConditionVariable *condition_variable; + struct { sem_id write_sem; sem_id read_sem; Modified: haiku/trunk/headers/private/kernel/vm_types.h =================================================================== --- haiku/trunk/headers/private/kernel/vm_types.h 2007-08-09 20:03:17 UTC (rev 21874) +++ haiku/trunk/headers/private/kernel/vm_types.h 2007-08-09 20:08:25 UTC (rev 21875) @@ -133,6 +133,16 @@ CACHE_TYPE_NULL }; +#ifdef __cplusplus + +#include + +struct vm_dummy_page : vm_page { + ConditionVariable busy_condition; +}; + +#endif // __cplusplus + // vm_cache typedef struct vm_cache { mutex lock; Modified: haiku/trunk/src/system/kernel/cache/file_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/file_cache.cpp 2007-08-09 20:03:17 UTC (rev 21874) +++ haiku/trunk/src/system/kernel/cache/file_cache.cpp 2007-08-09 20:08:25 UTC (rev 21875) @@ -9,13 +9,14 @@ #include #include +#include +#include +#include #include -#include #include #include #include #include -#include #include #include @@ -30,7 +31,7 @@ #endif // maximum number of iovecs per request -#define MAX_IO_VECS 64 // 256 kB +#define MAX_IO_VECS 32 // 128 kB #define MAX_FILE_IO_VECS 32 #define MAX_TEMP_IO_VECS 8 @@ -522,10 +523,13 @@ vm_cache *cache = ref->cache; + // TODO: We're using way too much stack! Rather allocate a sufficiently + // large chunk on the heap. iovec vecs[MAX_IO_VECS]; int32 vecCount = 0; vm_page *pages[MAX_IO_VECS]; + ConditionVariable busyConditions[MAX_IO_VECS]; int32 pageIndex = 0; // allocate pages for the cache and mark them busy @@ -534,7 +538,7 @@ if (page == NULL) panic("no more pages!"); - page->state = PAGE_STATE_BUSY; + busyConditions[pageIndex - 1].Publish(page, "page"); vm_cache_insert_page(cache, page, offset + pos); @@ -569,6 +573,7 @@ mutex_lock(&cache->lock); for (int32 i = 0; i < pageIndex; i++) { + busyConditions[i].Unpublish(); vm_cache_remove_page(cache, pages[i]); vm_page_set_state(pages[i], PAGE_STATE_FREE); } @@ -599,8 +604,10 @@ mutex_lock(&cache->lock); // make the pages accessible in the cache - for (int32 i = pageIndex; i-- > 0;) + for (int32 i = pageIndex; i-- > 0;) { pages[i]->state = PAGE_STATE_ACTIVE; + busyConditions[i].Unpublish(); + } return B_OK; } @@ -664,11 +671,14 @@ write_chunk_to_cache(file_cache_ref *ref, off_t offset, size_t numBytes, int32 pageOffset, addr_t buffer, size_t bufferSize) { + // TODO: We're using way too much stack! Rather allocate a sufficiently + // large chunk on the heap. iovec vecs[MAX_IO_VECS]; int32 vecCount = 0; vm_page *pages[MAX_IO_VECS]; int32 pageIndex = 0; status_t status = B_OK; + ConditionVariable busyConditions[MAX_IO_VECS]; // ToDo: this should be settable somewhere bool writeThrough = false; @@ -679,7 +689,7 @@ // big - shouldn't we better steal the pages directly in that case? // (a working set like approach for the file cache) vm_page *page = pages[pageIndex++] = vm_page_allocate_page(PAGE_STATE_FREE); - page->state = PAGE_STATE_BUSY; + busyConditions[pageIndex - 1].Publish(page, "page"); vm_cache_insert_page(ref->cache, page, offset + pos); @@ -769,6 +779,8 @@ // make the pages accessible in the cache for (int32 i = pageIndex; i-- > 0;) { + busyConditions[i].Unpublish(); + if (writeThrough) pages[i]->state = PAGE_STATE_ACTIVE; else @@ -914,9 +926,10 @@ return B_NO_MEMORY; } } else { + ConditionVariableEntry entry; + entry.Add(page); mutex_unlock(&cache->lock); - // ToDo: don't wait forever! - snooze(20000); + entry.Wait(); mutex_lock(&cache->lock); goto restart; } @@ -974,9 +987,10 @@ // we let the other party add our page currentPage->queue_next = page; } else { + ConditionVariableEntry entry; + entry.Add(page); mutex_unlock(&cache->lock); - // ToDo: don't wait forever! - snooze(20000); + entry.Wait(); mutex_lock(&cache->lock); goto restart_dummy_lookup; } @@ -1113,9 +1127,11 @@ vm_page *page = vm_cache_lookup_page(cache, offset); if (page != NULL) { if (page->state == PAGE_STATE_BUSY) { - // if busy retry again a little later + // if busy retry again later + ConditionVariableEntry entry; + entry.Add(page); mutex_unlock(&cache->lock); - snooze(20000); + entry.Wait(); mutex_lock(&cache->lock); goto restart; Modified: haiku/trunk/src/system/kernel/main.c =================================================================== --- haiku/trunk/src/system/kernel/main.c 2007-08-09 20:03:17 UTC (rev 21874) +++ haiku/trunk/src/system/kernel/main.c 2007-08-09 20:08:25 UTC (rev 21875) @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -131,6 +132,7 @@ TRACE("init semaphores\n"); sem_init(&sKernelArgs); + condition_variable_init(); // now we can create and use semaphores TRACE("init VM semaphores\n"); Modified: haiku/trunk/src/system/kernel/thread.c =================================================================== --- haiku/trunk/src/system/kernel/thread.c 2007-08-09 20:03:17 UTC (rev 21874) +++ haiku/trunk/src/system/kernel/thread.c 2007-08-09 20:08:25 UTC (rev 21875) @@ -210,6 +210,7 @@ thread->team = NULL; thread->cpu = cpu; thread->sem.blocking = -1; + thread->condition_variable = NULL; thread->fault_handler = 0; thread->page_faults_allowed = 1; thread->kernel_stack_area = -1; @@ -723,6 +724,7 @@ kprintf(" sem.count: 0x%lx\n", thread->sem.count); kprintf(" sem.acquire_status: 0x%lx\n", thread->sem.acquire_status); kprintf(" sem.flags: 0x%lx\n", thread->sem.flags); + kprintf("condition variable: %p\n", thread->condition_variable); kprintf("fault_handler: %p\n", (void *)thread->fault_handler); kprintf("args: %p %p\n", thread->args1, thread->args2); kprintf("entry: %p\n", (void *)thread->entry); @@ -826,7 +828,8 @@ kprintf("ignoring invalid team argument.\n"); } - kprintf("thread id state sem cpu pri stack team name\n"); + kprintf("thread id state sem/cv cpu pri stack team " + "name\n"); hash_open(sThreadHash, &i); while ((thread = hash_next(sThreadHash, &i)) != NULL) { @@ -840,11 +843,14 @@ kprintf("%p %6lx %-9s", thread, thread->id, state_to_text(thread, thread->state)); - // does it block on a semaphore? - if (thread->state == B_THREAD_WAITING) - kprintf("%6lx ", thread->sem.blocking); - else - kprintf(" - "); + // does it block on a semaphore or a condition variable? + if (thread->state == B_THREAD_WAITING) { + if (thread->condition_variable) + kprintf("%p ", thread->condition_variable); + else + kprintf("%10lx ", thread->sem.blocking); + } else + kprintf(" - "); // on which CPU does it run? if (thread->cpu) Modified: haiku/trunk/src/system/kernel/vm/Jamfile =================================================================== --- haiku/trunk/src/system/kernel/vm/Jamfile 2007-08-09 20:03:17 UTC (rev 21874) +++ haiku/trunk/src/system/kernel/vm/Jamfile 2007-08-09 20:08:25 UTC (rev 21875) @@ -6,7 +6,7 @@ vm_cache.cpp vm_daemons.c vm_low_memory.cpp - vm_page.c + vm_page.cpp vm_store_anonymous_noswap.c vm_store_device.c vm_store_null.c Modified: haiku/trunk/src/system/kernel/vm/vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm.cpp 2007-08-09 20:03:17 UTC (rev 21874) +++ haiku/trunk/src/system/kernel/vm/vm.cpp 2007-08-09 20:08:25 UTC (rev 21875) @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -3496,11 +3497,13 @@ away by grabbing a reference to it. */ static inline void -fault_insert_dummy_page(vm_cache *cache, vm_page &dummyPage, off_t cacheOffset) +fault_insert_dummy_page(vm_cache *cache, vm_dummy_page &dummyPage, + off_t cacheOffset) { dummyPage.state = PAGE_STATE_BUSY; vm_cache_acquire_ref(cache); vm_cache_insert_page(cache, &dummyPage, cacheOffset); + dummyPage.busy_condition.Publish(&dummyPage, "page"); } @@ -3509,7 +3512,7 @@ the cache. */ static inline void -fault_remove_dummy_page(vm_page &dummyPage, bool isLocked) +fault_remove_dummy_page(vm_dummy_page &dummyPage, bool isLocked) { vm_cache *cache = dummyPage.cache; if (!isLocked) @@ -3518,6 +3521,7 @@ if (dummyPage.state == PAGE_STATE_BUSY) { vm_cache_remove_page(cache, &dummyPage); dummyPage.state = PAGE_STATE_INACTIVE; + dummyPage.busy_condition.Unpublish(); } if (!isLocked) @@ -3537,8 +3541,8 @@ */ static inline status_t fault_find_page(vm_translation_map *map, vm_cache *topCache, - off_t cacheOffset, bool isWrite, vm_page &dummyPage, vm_cache **_pageCache, - vm_page** _page, bool* _restart) + off_t cacheOffset, bool isWrite, vm_dummy_page &dummyPage, + vm_cache **_pageCache, vm_page** _page, bool* _restart) { *_restart = false; vm_cache *cache = topCache; @@ -3560,24 +3564,36 @@ for (;;) { page = vm_cache_lookup_page(cache, cacheOffset); if (page != NULL && page->state != PAGE_STATE_BUSY) { + // Note: We set the page state to busy, but we don't need a + // condition variable here, since we keep the cache locked + // till we mark the page unbusy again (in fault_get_page() + // the source page, or in vm_soft_fault() when mapping the + // page), so no one will ever know the page was busy in the + // first place. vm_page_set_state(page, PAGE_STATE_BUSY); break; } if (page == NULL || page == &dummyPage) break; - // page must be busy - // ToDo: don't wait forever! - mutex_unlock(&cache->lock); - thread_yield(); - mutex_lock(&cache->lock); + // page must be busy -- wait for it to become unbusy + { + ConditionVariableEntry entry; + entry.Add(page); + mutex_unlock(&cache->lock); + entry.Wait(); + mutex_lock(&cache->lock); + } if (cache->busy) { // The cache became busy, which means, it is about to be // removed by vm_cache_remove_consumer(). We start again with // the top cache. + ConditionVariableEntry entry; + entry.Add(cache); mutex_unlock(&cache->lock); vm_cache_release_ref(cache); + entry.Wait(); *_restart = true; return B_OK; } @@ -3595,9 +3611,11 @@ // insert a fresh page and mark it busy -- we're going to read it in page = vm_page_allocate_page(PAGE_STATE_FREE); - page->state = PAGE_STATE_BUSY; vm_cache_insert_page(cache, page, cacheOffset); + ConditionVariable busyCondition; + busyCondition.Publish(page, "page"); + mutex_unlock(&cache->lock); // get a virtual address for the page @@ -3620,6 +3638,7 @@ dprintf("reading page from store %p (cache %p) returned: %s!\n", store, cache, strerror(status)); + busyCondition.Unpublish(); vm_cache_remove_page(cache, page); vm_page_set_state(page, PAGE_STATE_FREE); @@ -3628,6 +3647,7 @@ // mark the page unbusy again page->state = PAGE_STATE_ACTIVE; + busyCondition.Unpublish(); break; } @@ -3651,8 +3671,11 @@ // The cache became busy, which means, it is about to be // removed by vm_cache_remove_consumer(). We start again with // the top cache. + ConditionVariableEntry entry; + entry.Add(cache); mutex_unlock(&cache->lock); vm_cache_release_ref(cache); + entry.Wait(); *_restart = true; return B_OK; } @@ -3682,8 +3705,11 @@ // The cache became busy, which means, it is about to be // removed by vm_cache_remove_consumer(). We start again with // the top cache. + ConditionVariableEntry entry; + entry.Add(cache); mutex_unlock(&cache->lock); vm_cache_release_ref(cache); + entry.Wait(); *_restart = true; } else { vm_page* newPage = vm_cache_lookup_page(cache, cacheOffset); @@ -3718,8 +3744,8 @@ to it, and has also locked it on exit. */ static inline status_t -fault_get_page(vm_translation_map *map, vm_cache *topCache, - off_t cacheOffset, bool isWrite, vm_page &dummyPage, vm_cache **_sourceCache, +fault_get_page(vm_translation_map *map, vm_cache *topCache, off_t cacheOffset, + bool isWrite, vm_dummy_page &dummyPage, vm_cache **_sourceCache, vm_cache **_copiedSource, vm_page** _page) { vm_cache *cache; @@ -3848,8 +3874,10 @@ break; // The page is busy, wait till it becomes unbusy. + ConditionVariableEntry entry; + entry.Add(newPage); mutex_unlock(&topCache->lock); - snooze(10000); + entry.Wait(); mutex_lock(&topCache->lock); } @@ -3968,7 +3996,7 @@ // already have the page we're searching for (we're going from top to bottom) vm_translation_map *map = &addressSpace->translation_map; - vm_page dummyPage; + vm_dummy_page dummyPage; dummyPage.cache = NULL; dummyPage.state = PAGE_STATE_INACTIVE; dummyPage.type = PAGE_TYPE_DUMMY; Modified: haiku/trunk/src/system/kernel/vm/vm_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_cache.cpp 2007-08-09 20:03:17 UTC (rev 21874) +++ haiku/trunk/src/system/kernel/vm/vm_cache.cpp 2007-08-09 20:08:25 UTC (rev 21875) @@ -6,22 +6,23 @@ * Distributed under the terms of the NewOS License. */ +#include +#include +#include + +#include +#include +#include +#include #include +#include +#include +#include #include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include //#define TRACE_VM_CACHE #ifdef TRACE_VM_CACHE @@ -479,9 +480,12 @@ } } + ConditionVariable busyCondition; + if (merge) { // But since we need to keep the locking order upper->lower cache, we // need to unlock our cache now + busyCondition.Publish(cache, "cache"); cache->busy = true; mutex_unlock(&cache->lock); @@ -496,6 +500,7 @@ "not merging it\n", cache); merge = false; cache->busy = false; + busyCondition.Unpublish(); mutex_unlock(&consumer->lock); vm_cache_release_ref(consumer); } @@ -535,6 +540,7 @@ //dprintf("%ld: merged busy page %p, cache %p, offset %ld\n", find_thread(NULL), page, cacheRef->cache, page->cache_offset); vm_cache_remove_page(consumer, consumerPage); consumerPage->state = PAGE_STATE_INACTIVE; + ((vm_dummy_page*)consumerPage)->busy_condition.Unpublish(); vm_cache_remove_page(cache, page); vm_cache_insert_page(consumer, page, @@ -582,6 +588,9 @@ mutex_unlock(&consumer->lock); vm_cache_release_ref(consumer); } + + if (cache->busy) + busyCondition.Unpublish(); } mutex_unlock(&cache->lock); Deleted: haiku/trunk/src/system/kernel/vm/vm_page.c Copied: haiku/trunk/src/system/kernel/vm/vm_page.cpp (from rev 21851, haiku/trunk/src/system/kernel/vm/vm_page.c) =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_page.c 2007-08-08 10:29:30 UTC (rev 21851) +++ haiku/trunk/src/system/kernel/vm/vm_page.cpp 2007-08-09 20:08:25 UTC (rev 21875) @@ -0,0 +1,1196 @@ +/* + * Copyright 2002-2007, Axel D?rfler, axeld at pinc-software.de. + * Distributed under the terms of the MIT License. + * + * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. + * Distributed under the terms of the NewOS License. + */ + + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +//#define TRACE_VM_PAGE +#ifdef TRACE_VM_PAGE +# define TRACE(x) dprintf x +#else +# define TRACE(x) ; +#endif + +#define SCRUB_SIZE 16 + // this many pages will be cleared at once in the page scrubber thread + +typedef struct page_queue { + vm_page *head; + vm_page *tail; + int count; +} page_queue; + +extern bool trimming_cycle; + +static page_queue page_free_queue; +static page_queue page_clear_queue; +static page_queue page_modified_queue; +static page_queue page_active_queue; + +static vm_page *sPages; +static addr_t sPhysicalPageOffset; +static size_t sNumPages; + +static spinlock sPageLock; + +static sem_id modified_pages_available; + + +/*! Dequeues a page from the tail of the given queue */ +static vm_page * +dequeue_page(page_queue *q) +{ + vm_page *page; + + page = q->tail; + if (page != NULL) { + if (q->head == page) + q->head = NULL; + if (page->queue_prev != NULL) + page->queue_prev->queue_next = NULL; + + q->tail = page->queue_prev; + q->count--; + + #ifdef DEBUG_PAGE_QUEUE + if (page->queue != q) { + panic("dequeue_page(queue: %p): page %p thinks it is in queue " + "%p", q, page, page->queue); + } + + page->queue = NULL; + #endif // DEBUG_PAGE_QUEUE + } + + return page; +} + + +/*! Enqueues a page to the head of the given queue */ +static void +enqueue_page(page_queue *q, vm_page *page) +{ + #ifdef DEBUG_PAGE_QUEUE + if (page->queue != NULL) { + panic("enqueue_page(queue: %p, page: %p): page thinks it is " + "already in queue %p", q, page, page->queue); + } + #endif // DEBUG_PAGE_QUEUE + + if (q->head != NULL) + q->head->queue_prev = page; + page->queue_next = q->head; + q->head = page; + page->queue_prev = NULL; + if (q->tail == NULL) + q->tail = page; + q->count++; + + #ifdef DEBUG_PAGE_QUEUE + page->queue = q; + #endif + + if (q == &page_modified_queue) { + if (q->count == 1) + release_sem_etc(modified_pages_available, 1, B_DO_NOT_RESCHEDULE); + } +} + + +static void +remove_page_from_queue(page_queue *queue, vm_page *page) +{ + #ifdef DEBUG_PAGE_QUEUE + if (page->queue != queue) { + panic("remove_page_from_queue(queue: %p, page: %p): page thinks it " + "is in queue %p", queue, page, page->queue); + } + #endif // DEBUG_PAGE_QUEUE + + if (page->queue_prev != NULL) + page->queue_prev->queue_next = page->queue_next; + else + queue->head = page->queue_next; + + if (page->queue_next != NULL) + page->queue_next->queue_prev = page->queue_prev; + else + queue->tail = page->queue_prev; + + queue->count--; + + #ifdef DEBUG_PAGE_QUEUE + page->queue = NULL; + #endif +} + + +static void +move_page_to_queue(page_queue *fromQueue, page_queue *toQueue, vm_page *page) +{ + if (fromQueue != toQueue) { + remove_page_from_queue(fromQueue, page); + enqueue_page(toQueue, page); + } +} + + +static int +dump_free_page_table(int argc, char **argv) +{ + dprintf("not finished\n"); + return 0; +} + + +static int +find_page(int argc, char **argv) +{ + struct vm_page *page; + addr_t address; + int32 index = 1; + int i; + + struct { + const char* name; + page_queue* queue; + } pageQueueInfos[] = { + { "free", &page_free_queue }, + { "clear", &page_clear_queue }, + { "modified", &page_modified_queue }, + { "active", &page_active_queue }, + { NULL, NULL } + }; + + if (argc < 2 + || strlen(argv[index]) <= 2 + || argv[index][0] != '0' + || argv[index][1] != 'x') { + kprintf("usage: find_page
\n"); + return 0; + } + + address = strtoul(argv[index], NULL, 0); + page = (vm_page*)address; + + for (i = 0; pageQueueInfos[i].name; i++) { + vm_page* p = pageQueueInfos[i].queue->head; + while (p) { + if (p == page) { + kprintf("found page %p in queue %p (%s)\n", page, + pageQueueInfos[i].queue, pageQueueInfos[i].name); + return 0; + } + p = p->queue_next; + } + } + + kprintf("page %p isn't in any queue\n", page); + + return 0; +} + + +static int +dump_page(int argc, char **argv) +{ + struct vm_page *page; + addr_t address; + bool physical = false; + int32 index = 1; + + if (argc > 2) { + if (!strcmp(argv[1], "-p")) { + physical = true; + index++; + } else if (!strcmp(argv[1], "-v")) + index++; + } + + if (argc < 2 + || strlen(argv[index]) <= 2 + || argv[index][0] != '0' + || argv[index][1] != 'x') { + kprintf("usage: page [-p|-v]
\n" + " -v looks up a virtual address for the page, -p a physical address.\n" + " Default is to look for the page structure address directly\n."); + return 0; + } + + address = strtoul(argv[index], NULL, 0); + + if (index == 2) { + if (!physical) { + vm_address_space *addressSpace = vm_kernel_address_space(); + uint32 flags; + + if (thread_get_current_thread()->team->address_space != NULL) + addressSpace = thread_get_current_thread()->team->address_space; + + addressSpace->translation_map.ops->query_interrupt( + &addressSpace->translation_map, address, &address, &flags); + + } + page = vm_lookup_page(address / B_PAGE_SIZE); + } else + page = (struct vm_page *)address; + + kprintf("PAGE: %p\n", page); + kprintf("queue_next,prev: %p, %p\n", page->queue_next, page->queue_prev); + kprintf("hash_next: %p\n", page->hash_next); + kprintf("physical_number: %lx\n", page->physical_page_number); + kprintf("cache: %p\n", page->cache); + kprintf("cache_offset: %ld\n", page->cache_offset); + kprintf("cache_next,prev: %p, %p\n", page->cache_next, page->cache_prev); + kprintf("type: %d\n", page->type); + kprintf("state: %d\n", page->state); + kprintf("wired_count: %u\n", page->wired_count); + kprintf("usage_count: %u\n", page->usage_count); + #ifdef DEBUG_PAGE_QUEUE + kprintf("queue: %p\n", page->queue); + #endif + #ifdef DEBUG_PAGE_CACHE_TRANSITIONS + kprintf("debug_flags: 0x%lx\n", page->debug_flags); + kprintf("collided page: %p\n", page->collided_page); + #endif // DEBUG_PAGE_CACHE_TRANSITIONS + kprintf("area mappings:\n"); + + vm_page_mappings::Iterator iterator = page->mappings.GetIterator(); + vm_page_mapping *mapping; + while ((mapping = iterator.Next()) != NULL) { + kprintf(" %p (%#lx)\n", mapping->area, mapping->area->id); + mapping = mapping->page_link.next; + } + + return 0; +} + + +static int +dump_page_queue(int argc, char **argv) +{ + struct page_queue *queue; + + if (argc < 2) { + kprintf("usage: page_queue
[list]\n"); + return 0; + } + + if (strlen(argv[1]) >= 2 && argv[1][0] == '0' && argv[1][1] == 'x') + queue = (struct page_queue *)strtoul(argv[1], NULL, 16); + if (!strcmp(argv[1], "free")) + queue = &page_free_queue; + else if (!strcmp(argv[1], "clear")) + queue = &page_clear_queue; + else if (!strcmp(argv[1], "modified")) + queue = &page_modified_queue; + else if (!strcmp(argv[1], "active")) + queue = &page_active_queue; + else { + kprintf("page_queue: unknown queue \"%s\".\n", argv[1]); + return 0; + } + + kprintf("queue = %p, queue->head = %p, queue->tail = %p, queue->count = %d\n", queue, queue->head, queue->tail, queue->count); + + if (argc == 3) { + struct vm_page *page = queue->head; + int i; + + for (i = 0; page; i++, page = page->queue_next) { + kprintf("%5d. queue_next = %p, queue_prev = %p, type = %d, state = %d\n", i, page->queue_next, page->queue_prev, page->type, page->state); + } + } + return 0; +} + + +static int +dump_page_stats(int argc, char **argv) +{ + uint32 counter[8]; + int32 totalActive; + addr_t i; + + memset(counter, 0, sizeof(counter)); + + for (i = 0; i < sNumPages; i++) { + if (sPages[i].state > 7) + panic("page %li at %p has invalid state!\n", i, &sPages[i]); + + counter[sPages[i].state]++; + } + + kprintf("page stats:\n"); + kprintf("active: %lu\ninactive: %lu\nbusy: %lu\nunused: %lu\n", + counter[PAGE_STATE_ACTIVE], counter[PAGE_STATE_INACTIVE], counter[PAGE_STATE_BUSY], counter[PAGE_STATE_UNUSED]); + kprintf("wired: %lu\nmodified: %lu\nfree: %lu\nclear: %lu\n", + counter[PAGE_STATE_WIRED], counter[PAGE_STATE_MODIFIED], counter[PAGE_STATE_FREE], counter[PAGE_STATE_CLEAR]); + + kprintf("\nfree_queue: %p, count = %d\n", &page_free_queue, page_free_queue.count); + kprintf("clear_queue: %p, count = %d\n", &page_clear_queue, page_clear_queue.count); + kprintf("modified_queue: %p, count = %d\n", &page_modified_queue, page_modified_queue.count); + kprintf("active_queue: %p, count = %d\n", &page_active_queue, page_active_queue.count); + + return 0; +} + + +#if 0 +static int dump_free_page_table(int argc, char **argv) +{ + unsigned int i = 0; + unsigned int free_start = END_OF_LIST; + unsigned int inuse_start = PAGE_INUSE; + + dprintf("dump_free_page_table():\n"); + dprintf("first_free_page_index = %d\n", first_free_page_index); + + while(i < free_page_table_size) { + if (free_page_table[i] == PAGE_INUSE) { + if (inuse_start != PAGE_INUSE) { + i++; + continue; + } + if (free_start != END_OF_LIST) { + dprintf("free from %d -> %d\n", free_start + free_page_table_base, i-1 + free_page_table_base); + free_start = END_OF_LIST; + } + inuse_start = i; + } else { + if (free_start != END_OF_LIST) { + i++; + continue; + } + if (inuse_start != PAGE_INUSE) { + dprintf("inuse from %d -> %d\n", inuse_start + free_page_table_base, i-1 + free_page_table_base); + inuse_start = PAGE_INUSE; + } + free_start = i; + } + i++; + } + if (inuse_start != PAGE_INUSE) { + dprintf("inuse from %d -> %d\n", inuse_start + free_page_table_base, i-1 + free_page_table_base); + } + if (free_start != END_OF_LIST) { + dprintf("free from %d -> %d\n", free_start + free_page_table_base, i-1 + free_page_table_base); + } +/* + for (i = 0; i < free_page_table_size; i++) { + dprintf("%d->%d ", i, free_page_table[i]); + } +*/ + return 0; +} +#endif + + +static status_t +set_page_state_nolock(vm_page *page, int pageState) +{ + page_queue *from_q = NULL; + page_queue *to_q = NULL; + + switch (page->state) { + case PAGE_STATE_BUSY: + case PAGE_STATE_ACTIVE: + case PAGE_STATE_INACTIVE: + case PAGE_STATE_WIRED: + case PAGE_STATE_UNUSED: + from_q = &page_active_queue; + break; + case PAGE_STATE_MODIFIED: + from_q = &page_modified_queue; + break; + case PAGE_STATE_FREE: + from_q = &page_free_queue; + break; + case PAGE_STATE_CLEAR: + from_q = &page_clear_queue; + break; + default: + panic("vm_page_set_state: vm_page %p in invalid state %d\n", page, page->state); + } + + if (page->state == PAGE_STATE_CLEAR || page->state == PAGE_STATE_FREE) { + if (page->cache != NULL) + panic("free page %p has cache", page); + } + if (pageState == PAGE_STATE_CLEAR || pageState == PAGE_STATE_FREE) { + if (page->cache != NULL) + panic("to be freed page %p has cache", page); + } + + switch (pageState) { + case PAGE_STATE_BUSY: + case PAGE_STATE_ACTIVE: + case PAGE_STATE_INACTIVE: + case PAGE_STATE_WIRED: + case PAGE_STATE_UNUSED: + to_q = &page_active_queue; + break; + case PAGE_STATE_MODIFIED: + to_q = &page_modified_queue; + break; + case PAGE_STATE_FREE: + to_q = &page_free_queue; + break; + case PAGE_STATE_CLEAR: + to_q = &page_clear_queue; [... truncated: 735 lines follow ...] From korli at mail.berlios.de Thu Aug 9 23:02:47 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Thu, 9 Aug 2007 23:02:47 +0200 Subject: [Haiku-commits] r21876 - in haiku/vendor/mesa/current: glu/libnurbs/interface glu/libnurbs/nurbtess glu/libutil headers/public src/glapi src/main src/shader src/shader/slang src/shader/slang/library src/sparc src/swrast src/tnl src/vbo src/x86 src/x86-64 Message-ID: <200708092102.l79L2l5j004762@sheep.berlios.de> Author: korli Date: 2007-08-09 23:02:44 +0200 (Thu, 09 Aug 2007) New Revision: 21876 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21876&view=rev Added: haiku/vendor/mesa/current/src/shader/slang/library/slang_builtin_120_common_gc.h haiku/vendor/mesa/current/src/shader/slang/library/slang_builtin_120_fragment_gc.h Removed: haiku/vendor/mesa/current/src/tnl/t_save_api.c haiku/vendor/mesa/current/src/x86-64/Makefile haiku/vendor/mesa/current/src/x86/Makefile Modified: haiku/vendor/mesa/current/glu/libnurbs/interface/bezierPatch.cc haiku/vendor/mesa/current/glu/libnurbs/interface/glcurveval.h haiku/vendor/mesa/current/glu/libnurbs/interface/glsurfeval.cc haiku/vendor/mesa/current/glu/libnurbs/interface/glsurfeval.h haiku/vendor/mesa/current/glu/libnurbs/interface/insurfeval.cc haiku/vendor/mesa/current/glu/libnurbs/nurbtess/monoTriangulation.h haiku/vendor/mesa/current/glu/libutil/error.c haiku/vendor/mesa/current/headers/public/gl.h haiku/vendor/mesa/current/headers/public/glu.h haiku/vendor/mesa/current/headers/public/glut.h haiku/vendor/mesa/current/src/glapi/glapitemp.h haiku/vendor/mesa/current/src/glapi/glprocs.h haiku/vendor/mesa/current/src/main/api_validate.c haiku/vendor/mesa/current/src/main/dlist.c haiku/vendor/mesa/current/src/main/glheader.h haiku/vendor/mesa/current/src/main/image.c haiku/vendor/mesa/current/src/main/imports.c haiku/vendor/mesa/current/src/main/imports.h haiku/vendor/mesa/current/src/main/points.c haiku/vendor/mesa/current/src/main/shaders.c haiku/vendor/mesa/current/src/main/texcompress_fxt1.c haiku/vendor/mesa/current/src/main/texenvprogram.c haiku/vendor/mesa/current/src/main/teximage.c haiku/vendor/mesa/current/src/main/version.h haiku/vendor/mesa/current/src/shader/program.c haiku/vendor/mesa/current/src/shader/shader_api.c haiku/vendor/mesa/current/src/shader/slang/library/slang_core.gc haiku/vendor/mesa/current/src/shader/slang/library/slang_core_gc.h haiku/vendor/mesa/current/src/shader/slang/slang_codegen.c haiku/vendor/mesa/current/src/shader/slang/slang_compile.c haiku/vendor/mesa/current/src/shader/slang/slang_emit.c haiku/vendor/mesa/current/src/shader/slang/slang_ir.c haiku/vendor/mesa/current/src/shader/slang/slang_ir.h haiku/vendor/mesa/current/src/shader/slang/slang_link.c haiku/vendor/mesa/current/src/sparc/glapi_sparc.S haiku/vendor/mesa/current/src/swrast/s_drawpix.c haiku/vendor/mesa/current/src/vbo/vbo_exec_api.c haiku/vendor/mesa/current/src/vbo/vbo_save_api.c haiku/vendor/mesa/current/src/x86-64/glapi_x86-64.S haiku/vendor/mesa/current/src/x86/common_x86.c haiku/vendor/mesa/current/src/x86/glapi_x86.S Log: updating mesa vendor with version 7.0.1 Modified: haiku/vendor/mesa/current/glu/libnurbs/interface/bezierPatch.cc =================================================================== --- haiku/vendor/mesa/current/glu/libnurbs/interface/bezierPatch.cc 2007-08-09 20:08:25 UTC (rev 21875) +++ haiku/vendor/mesa/current/glu/libnurbs/interface/bezierPatch.cc 2007-08-09 21:02:44 UTC (rev 21876) @@ -111,8 +111,11 @@ void bezierPatchDeleteList(bezierPatch *b) { bezierPatch *temp; - for(temp = b; temp != NULL; temp = temp->next) - bezierPatchDelete(temp); + while (b != NULL) { + temp = b; + b = b->next; + bezierPatchDelete(temp); + } } bezierPatch* bezierPatchInsert(bezierPatch *list, bezierPatch *b) Modified: haiku/vendor/mesa/current/glu/libnurbs/interface/glcurveval.h =================================================================== --- haiku/vendor/mesa/current/glu/libnurbs/interface/glcurveval.h 2007-08-09 20:08:25 UTC (rev 21875) +++ haiku/vendor/mesa/current/glu/libnurbs/interface/glcurveval.h 2007-08-09 21:02:44 UTC (rev 21876) @@ -93,7 +93,7 @@ output_triangles = flag; } #ifdef _WIN32 - void putCallBack(GLenum which, void (APIENTRY *fn)() ); + void putCallBack(GLenum which, void (GLAPIENTRY *fn)() ); #else void putCallBack(GLenum which, _GLUfuncptr fn ); #endif Modified: haiku/vendor/mesa/current/glu/libnurbs/interface/glsurfeval.cc =================================================================== --- haiku/vendor/mesa/current/glu/libnurbs/interface/glsurfeval.cc 2007-08-09 20:08:25 UTC (rev 21875) +++ haiku/vendor/mesa/current/glu/libnurbs/interface/glsurfeval.cc 2007-08-09 21:02:44 UTC (rev 21876) @@ -1184,8 +1184,11 @@ } -void -OpenGLSurfaceEvaluator::putCallBack(GLenum which, _GLUfuncptr fn ) +#ifdef _WIN32 +void OpenGLSurfaceEvaluator::putCallBack(GLenum which, void (GLAPIENTRY *fn)() ) +#else +void OpenGLSurfaceEvaluator::putCallBack(GLenum which, _GLUfuncptr fn ) +#endif { switch(which) { Modified: haiku/vendor/mesa/current/glu/libnurbs/interface/glsurfeval.h =================================================================== --- haiku/vendor/mesa/current/glu/libnurbs/interface/glsurfeval.h 2007-08-09 20:08:25 UTC (rev 21875) +++ haiku/vendor/mesa/current/glu/libnurbs/interface/glsurfeval.h 2007-08-09 21:02:44 UTC (rev 21876) @@ -145,7 +145,7 @@ void newtmeshvert( long, long ); #ifdef _WIN32 - void putCallBack(GLenum which, void (APIENTRY *fn)() ); + void putCallBack(GLenum which, void (GLAPIENTRY *fn)() ); #else void putCallBack(GLenum which, _GLUfuncptr fn ); #endif Modified: haiku/vendor/mesa/current/glu/libnurbs/interface/insurfeval.cc =================================================================== --- haiku/vendor/mesa/current/glu/libnurbs/interface/insurfeval.cc 2007-08-09 20:08:25 UTC (rev 21875) +++ haiku/vendor/mesa/current/glu/libnurbs/interface/insurfeval.cc 2007-08-09 21:02:44 UTC (rev 21876) @@ -1533,9 +1533,9 @@ } //clean up free(leftXYZ); - free(leftXYZ); + free(rightXYZ); + free(leftNormal); free(rightNormal); - free(rightNormal); } /*-----------------------begin evalMachine-------------------*/ Modified: haiku/vendor/mesa/current/glu/libnurbs/nurbtess/monoTriangulation.h =================================================================== --- haiku/vendor/mesa/current/glu/libnurbs/nurbtess/monoTriangulation.h 2007-08-09 20:08:25 UTC (rev 21875) +++ haiku/vendor/mesa/current/glu/libnurbs/nurbtess/monoTriangulation.h 2007-08-09 21:02:44 UTC (rev 21876) @@ -43,10 +43,9 @@ #include "definitions.h" #include "primitiveStream.h" #include "directedLine.h" +#include "arc.h" class Backend; -class Arc; -typedef Arc *Arc_ptr; class reflexChain{ Real2 *queue; Modified: haiku/vendor/mesa/current/glu/libutil/error.c =================================================================== --- haiku/vendor/mesa/current/glu/libutil/error.c 2007-08-09 20:08:25 UTC (rev 21875) +++ haiku/vendor/mesa/current/glu/libutil/error.c 2007-08-09 21:02:44 UTC (rev 21876) @@ -82,7 +82,7 @@ if ((errorCode >= GLU_NURBS_ERROR1) && (errorCode <= GLU_NURBS_ERROR37)) { return (const GLubyte *) __gluNURBSErrorString(errorCode - (GLU_NURBS_ERROR1 - 1)); } - if ((errorCode >= GLU_TESS_ERROR1) && (errorCode <= GLU_TESS_ERROR8)) { + if ((errorCode >= GLU_TESS_ERROR1) && (errorCode <= GLU_TESS_ERROR6)) { return (const GLubyte *) __gluTessErrorString(errorCode - (GLU_TESS_ERROR1 - 1)); } return (const GLubyte *) 0; Modified: haiku/vendor/mesa/current/headers/public/gl.h =================================================================== --- haiku/vendor/mesa/current/headers/public/gl.h 2007-08-09 20:08:25 UTC (rev 21875) +++ haiku/vendor/mesa/current/headers/public/gl.h 2007-08-09 21:02:44 UTC (rev 21876) @@ -84,7 +84,8 @@ #include #endif -#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) \ + && !defined(OPENSTEP) && !defined(__CYGWIN__) || defined(__MINGW32__) #include #endif @@ -2161,11 +2162,11 @@ #define GL_DEBUG_PRINT_MESA 0x875A #define GL_DEBUG_ASSERT_MESA 0x875B -GLAPI GLhandleARB APIENTRY glCreateDebugObjectMESA (void); -GLAPI void APIENTRY glClearDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType); -GLAPI void APIENTRY glGetDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType, GLsizei maxLength, +GLAPI GLhandleARB GLAPIENTRY glCreateDebugObjectMESA (void); +GLAPI void GLAPIENTRY glClearDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType); +GLAPI void GLAPIENTRY glGetDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType, GLsizei maxLength, GLsizei *length, GLcharARB *debugLog); -GLAPI GLsizei APIENTRY glGetDebugLogLengthMESA (GLhandleARB obj, GLenum logType, GLenum shaderType); +GLAPI GLsizei GLAPIENTRY glGetDebugLogLengthMESA (GLhandleARB obj, GLenum logType, GLenum shaderType); #endif /* GL_MESA_shader_debug */ Modified: haiku/vendor/mesa/current/headers/public/glu.h =================================================================== --- haiku/vendor/mesa/current/headers/public/glu.h 2007-08-09 20:08:25 UTC (rev 21875) +++ haiku/vendor/mesa/current/headers/public/glu.h 2007-08-09 21:02:44 UTC (rev 21876) @@ -44,6 +44,19 @@ #define GLAPIENTRYP GLAPIENTRY * #endif +#ifdef GLAPI +#undef GLAPI +#endif + +# if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GLU32) +# define GLAPI __declspec(dllexport) +# elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ +# define GLAPI __declspec(dllimport) +# else /* for use with static link lib build of Win32 edition only */ +# define GLAPI extern +# endif /* _STATIC_MESA support */ + + #ifndef GLAPI #define GLAPI #endif Modified: haiku/vendor/mesa/current/headers/public/glut.h =================================================================== --- haiku/vendor/mesa/current/headers/public/glut.h 2007-08-09 20:08:25 UTC (rev 21875) +++ haiku/vendor/mesa/current/headers/public/glut.h 2007-08-09 21:02:44 UTC (rev 21876) @@ -10,6 +10,10 @@ #include #include +#if defined(__MINGW32__) +#include +#endif + #ifdef __cplusplus extern "C" { #endif @@ -115,7 +119,7 @@ #endif /* GLUT API entry point declarations for Win32. */ -#if defined(GLUT_BUILDING_LIB) && defined(_DLL) +#if (defined(BUILD_GLUT32) || defined(GLUT_BUILDING_LIB)) && defined(_DLL) # define GLUTAPI __declspec(dllexport) #elif defined(_DLL) # define GLUTAPI __declspec(dllimport) @@ -130,9 +134,12 @@ # pragma message( "----: being multiply defined you should include WINDOWS.H priot to gl/glut.h" ) # endif # define CALLBACK __stdcall -typedef int (GLUTAPIENTRY *PROC)(); -typedef void *HGLRC; -typedef void *HDC; + +#if !defined(__MINGW32__) + typedef int (GLUTAPIENTRY *PROC)(); + typedef void *HGLRC; + typedef void *HDC; +#endif typedef unsigned long COLORREF; #endif Modified: haiku/vendor/mesa/current/src/glapi/glapitemp.h =================================================================== --- haiku/vendor/mesa/current/src/glapi/glapitemp.h 2007-08-09 20:08:25 UTC (rev 21875) +++ haiku/vendor/mesa/current/src/glapi/glapitemp.h 2007-08-09 21:02:44 UTC (rev 21876) @@ -3284,6 +3284,11 @@ DISPATCH(VertexAttrib4NusvARB, (index, v), (F, "glVertexAttrib4NusvARB(%d, %p);\n", index, (const void *) v)); } +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4bv)(GLuint index, const GLbyte * v) +{ + DISPATCH(VertexAttrib4bvARB, (index, v), (F, "glVertexAttrib4bv(%d, %p);\n", index, (const void *) v)); +} + KEYWORD1 void KEYWORD2 NAME(VertexAttrib4bvARB)(GLuint index, const GLbyte * v) { DISPATCH(VertexAttrib4bvARB, (index, v), (F, "glVertexAttrib4bvARB(%d, %p);\n", index, (const void *) v)); @@ -3329,6 +3334,11 @@ DISPATCH(VertexAttrib4fvARB, (index, v), (F, "glVertexAttrib4fvARB(%d, %p);\n", index, (const void *) v)); } +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4iv)(GLuint index, const GLint * v) +{ + DISPATCH(VertexAttrib4ivARB, (index, v), (F, "glVertexAttrib4iv(%d, %p);\n", index, (const void *) v)); +} + KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ivARB)(GLuint index, const GLint * v) { DISPATCH(VertexAttrib4ivARB, (index, v), (F, "glVertexAttrib4ivARB(%d, %p);\n", index, (const void *) v)); @@ -3354,16 +3364,31 @@ DISPATCH(VertexAttrib4svARB, (index, v), (F, "glVertexAttrib4svARB(%d, %p);\n", index, (const void *) v)); } +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ubv)(GLuint index, const GLubyte * v) +{ + DISPATCH(VertexAttrib4ubvARB, (index, v), (F, "glVertexAttrib4ubv(%d, %p);\n", index, (const void *) v)); +} + KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ubvARB)(GLuint index, const GLubyte * v) { DISPATCH(VertexAttrib4ubvARB, (index, v), (F, "glVertexAttrib4ubvARB(%d, %p);\n", index, (const void *) v)); } +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4uiv)(GLuint index, const GLuint * v) +{ + DISPATCH(VertexAttrib4uivARB, (index, v), (F, "glVertexAttrib4uiv(%d, %p);\n", index, (const void *) v)); +} + KEYWORD1 void KEYWORD2 NAME(VertexAttrib4uivARB)(GLuint index, const GLuint * v) { DISPATCH(VertexAttrib4uivARB, (index, v), (F, "glVertexAttrib4uivARB(%d, %p);\n", index, (const void *) v)); } +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4usv)(GLuint index, const GLushort * v) +{ + DISPATCH(VertexAttrib4usvARB, (index, v), (F, "glVertexAttrib4usv(%d, %p);\n", index, (const void *) v)); +} + KEYWORD1 void KEYWORD2 NAME(VertexAttrib4usvARB)(GLuint index, const GLushort * v) { DISPATCH(VertexAttrib4usvARB, (index, v), (F, "glVertexAttrib4usvARB(%d, %p);\n", index, (const void *) v)); @@ -6458,12 +6483,17 @@ TABLE_ENTRY(VertexAttrib4Nubv), TABLE_ENTRY(VertexAttrib4Nuiv), TABLE_ENTRY(VertexAttrib4Nusv), + TABLE_ENTRY(VertexAttrib4bv), TABLE_ENTRY(VertexAttrib4d), TABLE_ENTRY(VertexAttrib4dv), TABLE_ENTRY(VertexAttrib4f), TABLE_ENTRY(VertexAttrib4fv), + TABLE_ENTRY(VertexAttrib4iv), TABLE_ENTRY(VertexAttrib4s), TABLE_ENTRY(VertexAttrib4sv), + TABLE_ENTRY(VertexAttrib4ubv), + TABLE_ENTRY(VertexAttrib4uiv), + TABLE_ENTRY(VertexAttrib4usv), TABLE_ENTRY(VertexAttribPointer), TABLE_ENTRY(BindBuffer), TABLE_ENTRY(BufferData), Modified: haiku/vendor/mesa/current/src/glapi/glprocs.h =================================================================== --- haiku/vendor/mesa/current/src/glapi/glprocs.h 2007-08-09 20:08:25 UTC (rev 21875) +++ haiku/vendor/mesa/current/src/glapi/glprocs.h 2007-08-09 21:02:44 UTC (rev 21876) @@ -957,12 +957,17 @@ "glVertexAttrib4Nubv\0" "glVertexAttrib4Nuiv\0" "glVertexAttrib4Nusv\0" + "glVertexAttrib4bv\0" "glVertexAttrib4d\0" "glVertexAttrib4dv\0" "glVertexAttrib4f\0" "glVertexAttrib4fv\0" + "glVertexAttrib4iv\0" "glVertexAttrib4s\0" "glVertexAttrib4sv\0" + "glVertexAttrib4ubv\0" + "glVertexAttrib4uiv\0" + "glVertexAttrib4usv\0" "glVertexAttribPointer\0" "glBindBuffer\0" "glBufferData\0" @@ -2100,142 +2105,147 @@ NAME_FUNC_OFFSET(16268, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB), NAME_FUNC_OFFSET(16288, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB), NAME_FUNC_OFFSET(16308, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB), - NAME_FUNC_OFFSET(16328, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), - NAME_FUNC_OFFSET(16345, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), - NAME_FUNC_OFFSET(16363, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), - NAME_FUNC_OFFSET(16380, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), - NAME_FUNC_OFFSET(16398, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), - NAME_FUNC_OFFSET(16415, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), - NAME_FUNC_OFFSET(16433, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), - NAME_FUNC_OFFSET(16455, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), - NAME_FUNC_OFFSET(16468, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), - NAME_FUNC_OFFSET(16481, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), - NAME_FUNC_OFFSET(16497, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), - NAME_FUNC_OFFSET(16513, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), - NAME_FUNC_OFFSET(16526, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), - NAME_FUNC_OFFSET(16549, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), - NAME_FUNC_OFFSET(16569, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), - NAME_FUNC_OFFSET(16588, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), - NAME_FUNC_OFFSET(16599, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), - NAME_FUNC_OFFSET(16611, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), - NAME_FUNC_OFFSET(16625, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), - NAME_FUNC_OFFSET(16638, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), - NAME_FUNC_OFFSET(16654, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), - NAME_FUNC_OFFSET(16665, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), - NAME_FUNC_OFFSET(16678, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), - NAME_FUNC_OFFSET(16697, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), - NAME_FUNC_OFFSET(16717, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), - NAME_FUNC_OFFSET(16730, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), - NAME_FUNC_OFFSET(16740, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), - NAME_FUNC_OFFSET(16756, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), - NAME_FUNC_OFFSET(16775, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), - NAME_FUNC_OFFSET(16793, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), - NAME_FUNC_OFFSET(16814, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), - NAME_FUNC_OFFSET(16829, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), - NAME_FUNC_OFFSET(16844, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), - NAME_FUNC_OFFSET(16858, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), - NAME_FUNC_OFFSET(16873, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), - NAME_FUNC_OFFSET(16885, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), - NAME_FUNC_OFFSET(16898, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), - NAME_FUNC_OFFSET(16910, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), - NAME_FUNC_OFFSET(16923, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), - NAME_FUNC_OFFSET(16935, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), - NAME_FUNC_OFFSET(16948, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), - NAME_FUNC_OFFSET(16960, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), - NAME_FUNC_OFFSET(16973, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), - NAME_FUNC_OFFSET(16985, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), - NAME_FUNC_OFFSET(16998, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), - NAME_FUNC_OFFSET(17010, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), - NAME_FUNC_OFFSET(17023, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), - NAME_FUNC_OFFSET(17035, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), - NAME_FUNC_OFFSET(17048, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), - NAME_FUNC_OFFSET(17060, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), - NAME_FUNC_OFFSET(17073, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), - NAME_FUNC_OFFSET(17092, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), - NAME_FUNC_OFFSET(17111, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), - NAME_FUNC_OFFSET(17130, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), - NAME_FUNC_OFFSET(17143, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), - NAME_FUNC_OFFSET(17161, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), - NAME_FUNC_OFFSET(17182, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), - NAME_FUNC_OFFSET(17200, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), - NAME_FUNC_OFFSET(17220, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(17234, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(17251, gl_dispatch_stub_568, gl_dispatch_stub_568, NULL, _gloffset_SampleMaskSGIS), - NAME_FUNC_OFFSET(17267, gl_dispatch_stub_569, gl_dispatch_stub_569, NULL, _gloffset_SamplePatternSGIS), - NAME_FUNC_OFFSET(17286, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17304, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17325, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17347, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17366, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17388, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17411, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), - NAME_FUNC_OFFSET(17430, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), - NAME_FUNC_OFFSET(17450, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), - NAME_FUNC_OFFSET(17469, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), - NAME_FUNC_OFFSET(17489, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), - NAME_FUNC_OFFSET(17508, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), - NAME_FUNC_OFFSET(17528, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), - NAME_FUNC_OFFSET(17547, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), - NAME_FUNC_OFFSET(17567, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), - NAME_FUNC_OFFSET(17586, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), - NAME_FUNC_OFFSET(17606, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), - NAME_FUNC_OFFSET(17626, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), - NAME_FUNC_OFFSET(17647, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), - NAME_FUNC_OFFSET(17667, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), - NAME_FUNC_OFFSET(17688, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), - NAME_FUNC_OFFSET(17708, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), - NAME_FUNC_OFFSET(17729, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), - NAME_FUNC_OFFSET(17753, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), - NAME_FUNC_OFFSET(17771, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), - NAME_FUNC_OFFSET(17791, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), - NAME_FUNC_OFFSET(17809, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), - NAME_FUNC_OFFSET(17821, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), - NAME_FUNC_OFFSET(17834, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), - NAME_FUNC_OFFSET(17846, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), - NAME_FUNC_OFFSET(17859, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(17879, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(17903, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(17917, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(17934, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(17949, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(17967, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(17981, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(17998, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(18013, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(18031, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(18045, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(18062, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(18077, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(18095, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(18109, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(18126, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(18141, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(18159, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(18173, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(18190, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(18205, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(18223, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(18237, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(18254, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(18269, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(18287, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(18301, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(18318, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(18333, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(18351, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(18365, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(18382, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(18397, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(18415, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), - NAME_FUNC_OFFSET(18432, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), - NAME_FUNC_OFFSET(18452, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), - NAME_FUNC_OFFSET(18469, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(18495, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(18524, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), - NAME_FUNC_OFFSET(18539, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), - NAME_FUNC_OFFSET(18557, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), - NAME_FUNC_OFFSET(18576, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(18600, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(16328, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB), + NAME_FUNC_OFFSET(16346, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), + NAME_FUNC_OFFSET(16363, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), + NAME_FUNC_OFFSET(16381, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), + NAME_FUNC_OFFSET(16398, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), + NAME_FUNC_OFFSET(16416, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB), + NAME_FUNC_OFFSET(16434, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), + NAME_FUNC_OFFSET(16451, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), + NAME_FUNC_OFFSET(16469, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB), + NAME_FUNC_OFFSET(16488, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB), + NAME_FUNC_OFFSET(16507, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB), + NAME_FUNC_OFFSET(16526, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), + NAME_FUNC_OFFSET(16548, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), + NAME_FUNC_OFFSET(16561, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), + NAME_FUNC_OFFSET(16574, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), + NAME_FUNC_OFFSET(16590, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), + NAME_FUNC_OFFSET(16606, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), + NAME_FUNC_OFFSET(16619, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), + NAME_FUNC_OFFSET(16642, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), + NAME_FUNC_OFFSET(16662, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), + NAME_FUNC_OFFSET(16681, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), + NAME_FUNC_OFFSET(16692, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), + NAME_FUNC_OFFSET(16704, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), + NAME_FUNC_OFFSET(16718, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), + NAME_FUNC_OFFSET(16731, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), + NAME_FUNC_OFFSET(16747, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), + NAME_FUNC_OFFSET(16758, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), + NAME_FUNC_OFFSET(16771, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), + NAME_FUNC_OFFSET(16790, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), + NAME_FUNC_OFFSET(16810, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), + NAME_FUNC_OFFSET(16823, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), + NAME_FUNC_OFFSET(16833, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), + NAME_FUNC_OFFSET(16849, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), + NAME_FUNC_OFFSET(16868, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), + NAME_FUNC_OFFSET(16886, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), + NAME_FUNC_OFFSET(16907, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), + NAME_FUNC_OFFSET(16922, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), + NAME_FUNC_OFFSET(16937, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), + NAME_FUNC_OFFSET(16951, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), + NAME_FUNC_OFFSET(16966, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), + NAME_FUNC_OFFSET(16978, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), + NAME_FUNC_OFFSET(16991, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), + NAME_FUNC_OFFSET(17003, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), + NAME_FUNC_OFFSET(17016, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), + NAME_FUNC_OFFSET(17028, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), + NAME_FUNC_OFFSET(17041, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), + NAME_FUNC_OFFSET(17053, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), + NAME_FUNC_OFFSET(17066, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), + NAME_FUNC_OFFSET(17078, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), + NAME_FUNC_OFFSET(17091, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), + NAME_FUNC_OFFSET(17103, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), + NAME_FUNC_OFFSET(17116, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), + NAME_FUNC_OFFSET(17128, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), + NAME_FUNC_OFFSET(17141, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), + NAME_FUNC_OFFSET(17153, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), + NAME_FUNC_OFFSET(17166, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), + NAME_FUNC_OFFSET(17185, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), + NAME_FUNC_OFFSET(17204, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), + NAME_FUNC_OFFSET(17223, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), + NAME_FUNC_OFFSET(17236, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), + NAME_FUNC_OFFSET(17254, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), + NAME_FUNC_OFFSET(17275, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), + NAME_FUNC_OFFSET(17293, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), + NAME_FUNC_OFFSET(17313, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET(17327, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET(17344, gl_dispatch_stub_568, gl_dispatch_stub_568, NULL, _gloffset_SampleMaskSGIS), + NAME_FUNC_OFFSET(17360, gl_dispatch_stub_569, gl_dispatch_stub_569, NULL, _gloffset_SamplePatternSGIS), + NAME_FUNC_OFFSET(17379, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17397, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17418, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17440, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17459, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17481, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17504, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), + NAME_FUNC_OFFSET(17523, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), + NAME_FUNC_OFFSET(17543, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), + NAME_FUNC_OFFSET(17562, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), + NAME_FUNC_OFFSET(17582, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), + NAME_FUNC_OFFSET(17601, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), + NAME_FUNC_OFFSET(17621, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), + NAME_FUNC_OFFSET(17640, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), + NAME_FUNC_OFFSET(17660, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), + NAME_FUNC_OFFSET(17679, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), + NAME_FUNC_OFFSET(17699, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), + NAME_FUNC_OFFSET(17719, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), + NAME_FUNC_OFFSET(17740, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), + NAME_FUNC_OFFSET(17760, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), + NAME_FUNC_OFFSET(17781, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), + NAME_FUNC_OFFSET(17801, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), + NAME_FUNC_OFFSET(17822, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), + NAME_FUNC_OFFSET(17846, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), + NAME_FUNC_OFFSET(17864, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), + NAME_FUNC_OFFSET(17884, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), + NAME_FUNC_OFFSET(17902, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), + NAME_FUNC_OFFSET(17914, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), + NAME_FUNC_OFFSET(17927, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), + NAME_FUNC_OFFSET(17939, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), + NAME_FUNC_OFFSET(17952, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(17972, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(17996, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(18010, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(18027, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(18042, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(18060, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(18074, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(18091, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(18106, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(18124, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(18138, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(18155, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(18170, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(18188, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(18202, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(18219, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(18234, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(18252, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(18266, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(18283, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(18298, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(18316, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(18330, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(18347, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(18362, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(18380, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(18394, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(18411, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(18426, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(18444, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(18458, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(18475, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(18490, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(18508, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), + NAME_FUNC_OFFSET(18525, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), + NAME_FUNC_OFFSET(18545, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), + NAME_FUNC_OFFSET(18562, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(18588, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(18617, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), + NAME_FUNC_OFFSET(18632, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), + NAME_FUNC_OFFSET(18650, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), + NAME_FUNC_OFFSET(18669, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(18693, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0) }; Modified: haiku/vendor/mesa/current/src/main/api_validate.c =================================================================== --- haiku/vendor/mesa/current/src/main/api_validate.c 2007-08-09 20:08:25 UTC (rev 21875) +++ haiku/vendor/mesa/current/src/main/api_validate.c 2007-08-09 21:02:44 UTC (rev 21876) @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.1 + * Version: 7.0.1 * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -100,6 +100,11 @@ (const GLubyte *) indices); } } + else { + /* not using a VBO */ + if (!indices) + return GL_FALSE; + } if (ctx->Const.CheckArrayBounds) { /* find max array index */ @@ -170,6 +175,16 @@ && !(ctx->VertexProgram._Enabled && ctx->Array.ArrayObj->VertexAttrib[0].Enabled)) return GL_FALSE; + /* Vertex buffer object tests */ + if (ctx->Array.ElementArrayBufferObj->Name) { + /* XXX re-use code from above? */ + } + else { + /* not using VBO */ + if (!indices) + return GL_FALSE; + } + if (ctx->Const.CheckArrayBounds) { /* Find max array index. * We don't trust the user's start and end values. Modified: haiku/vendor/mesa/current/src/main/dlist.c =================================================================== --- haiku/vendor/mesa/current/src/main/dlist.c 2007-08-09 20:08:25 UTC (rev 21875) +++ haiku/vendor/mesa/current/src/main/dlist.c 2007-08-09 21:02:44 UTC (rev 21876) @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.0.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -2716,22 +2716,21 @@ } -/* - * Polygon stipple must have been upacked already! - */ static void GLAPIENTRY save_PolygonStipple(const GLubyte * pattern) { GET_CURRENT_CONTEXT(ctx); + GLvoid *image = unpack_image(2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, + pattern, &ctx->Unpack); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_STIPPLE, 1); if (n) { - void *data; - n[1].data = _mesa_malloc(32 * 4); - data = n[1].data; /* This needed for Acorn compiler */ - MEMCPY(data, pattern, 32 * 4); + n[1].data = image; } + else if (image) { + _mesa_free(image); + } if (ctx->ExecuteFlag) { CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern)); } @@ -6169,7 +6168,12 @@ CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e)); break; case OPCODE_POLYGON_STIPPLE: - CALL_PolygonStipple(ctx->Exec, ((GLubyte *) n[1].data)); + { + const struct gl_pixelstore_attrib save = ctx->Unpack; + ctx->Unpack = ctx->DefaultPacking; + CALL_PolygonStipple(ctx->Exec, ((GLubyte *) n[1].data)); + ctx->Unpack = save; /* restore */ + } break; case OPCODE_POLYGON_OFFSET: CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f)); Modified: haiku/vendor/mesa/current/src/main/glheader.h =================================================================== --- haiku/vendor/mesa/current/src/main/glheader.h 2007-08-09 20:08:25 UTC (rev 21875) +++ haiku/vendor/mesa/current/src/main/glheader.h 2007-08-09 21:02:44 UTC (rev 21876) @@ -91,6 +91,9 @@ # pragma disable_message(201) /* Disable unreachable code warnings */ #endif +#ifdef WGLAPI +# undef WGLAPI +#endif #if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP) # if !defined(__GNUC__) /* mingw environment */ Modified: haiku/vendor/mesa/current/src/main/image.c =================================================================== --- haiku/vendor/mesa/current/src/main/image.c 2007-08-09 20:08:25 UTC (rev 21875) +++ haiku/vendor/mesa/current/src/main/image.c 2007-08-09 21:02:44 UTC (rev 21876) @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.0 + * Version: 7.0.1 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -850,7 +850,7 @@ return NULL; } - if (packing->SkipPixels == 0) { + if ((packing->SkipPixels & 7) == 0) { _mesa_memcpy( dst, src, width_in_bytes ); if (packing->LsbFirst) { flip_bytes( dst, width_in_bytes ); @@ -942,7 +942,7 @@ if (!dst) return; - if (packing->SkipPixels == 0) { + if ((packing->SkipPixels & 7) == 0) { _mesa_memcpy( dst, src, width_in_bytes ); if (packing->LsbFirst) { flip_bytes( dst, width_in_bytes ); @@ -961,20 +961,20 @@ if (*s & srcMask) { *d |= dstMask; } - if (srcMask == 128) { - srcMask = 1; + if (srcMask == 1) { + srcMask = 128; s++; } else { - srcMask = srcMask << 1; + srcMask = srcMask >> 1; } - if (dstMask == 1) { - dstMask = 128; + if (dstMask == 128) { + dstMask = 1; d++; *d = 0; } else { - dstMask = dstMask >> 1; + dstMask = dstMask << 1; } } } @@ -3648,11 +3648,13 @@ * Try simple cases first */ if (transferOps == 0 && + !ctx->Pixel.MapStencilFlag && srcType == GL_UNSIGNED_BYTE && dstType == GL_UNSIGNED_BYTE) { _mesa_memcpy(dest, source, n * sizeof(GLubyte)); } else if (transferOps == 0 && + !ctx->Pixel.MapStencilFlag && srcType == GL_UNSIGNED_INT && dstType == GL_UNSIGNED_INT && !srcPacking->SwapBytes) { @@ -3668,19 +3670,17 @@ extract_uint_indexes(n, indexes, GL_STENCIL_INDEX, srcType, source, srcPacking); - if (transferOps) { - if (transferOps & IMAGE_SHIFT_OFFSET_BIT) { - /* shift and offset indexes */ - shift_and_offset_ci(ctx, n, indexes); - } + if (transferOps & IMAGE_SHIFT_OFFSET_BIT) { + /* shift and offset indexes */ + shift_and_offset_ci(ctx, n, indexes); + } - if (ctx->Pixel.MapStencilFlag) { - /* Apply stencil lookup table */ - GLuint mask = ctx->PixelMaps.StoS.Size - 1; - GLuint i; - for (i=0;iPixelMaps.StoS.Map[ indexes[i] & mask ]; - } + if (ctx->Pixel.MapStencilFlag) { + /* Apply stencil lookup table */ + const GLuint mask = ctx->PixelMaps.StoS.Size - 1; + GLuint i; + for (i = 0; i < n; i++) { + indexes[i] = ctx->PixelMaps.StoS.Map[ indexes[i] & mask ]; } } @@ -3733,7 +3733,7 @@ switch (dstType) { case GL_UNSIGNED_BYTE: - if (sizeof(GLstencil) == 8) { + if (sizeof(GLstencil) == 1) { _mesa_memcpy( dest, source, n ); } else { @@ -3745,14 +3745,11 @@ } break; case GL_BYTE: - if (sizeof(GLstencil) == 8) { - _mesa_memcpy( dest, source, n ); - } - else { + { GLbyte *dst = (GLbyte *) dest; GLuint i; for (i=0;iSwapBytes here!!! */ - (void) srcPacking; - - /* convert incoming values to GLfloat */ + /* Convert incoming values to GLfloat. Some conversions will require + * clamping, below. + */ switch (srcType) { case GL_BYTE: - DEPTH_VALUES(GLbyte, BYTE_TO_FLOAT); - break; + DEPTH_VALUES(GLbyte, BYTE_TO_FLOAT); + needClamp = GL_TRUE; + break; case GL_UNSIGNED_BYTE: - DEPTH_VALUES(GLubyte, UBYTE_TO_FLOAT); - break; + DEPTH_VALUES(GLubyte, UBYTE_TO_FLOAT); + break; case GL_SHORT: - DEPTH_VALUES(GLshort, SHORT_TO_FLOAT); - break; + DEPTH_VALUES(GLshort, SHORT_TO_FLOAT); + needClamp = GL_TRUE; + break; case GL_UNSIGNED_SHORT: - DEPTH_VALUES(GLushort, USHORT_TO_FLOAT); - break; + DEPTH_VALUES(GLushort, USHORT_TO_FLOAT); + break; case GL_INT: - DEPTH_VALUES(GLint, INT_TO_FLOAT); - break; + DEPTH_VALUES(GLint, INT_TO_FLOAT); + needClamp = GL_TRUE; + break; case GL_UNSIGNED_INT: - DEPTH_VALUES(GLuint, UINT_TO_FLOAT); - break; + DEPTH_VALUES(GLuint, UINT_TO_FLOAT); + break; case GL_UNSIGNED_INT_24_8_EXT: /* GL_EXT_packed_depth_stencil */ if (dstType == GL_UNSIGNED_INT && depthScale == (GLfloat) 0xffffff && @@ -3981,19 +3993,21 @@ } break; case GL_FLOAT: - DEPTH_VALUES(GLfloat, 1*); - break; + DEPTH_VALUES(GLfloat, 1*); + needClamp = GL_TRUE; + break; case GL_HALF_FLOAT_ARB: { GLuint i; const GLhalfARB *src = (const GLhalfARB *) source; for (i = 0; i < n; i++) { - GLhalfARB value = src[i]; - if (srcPacking->SwapBytes) { - SWAP2BYTE(value); - } + GLhalfARB value = src[i]; + if (srcPacking->SwapBytes) { + SWAP2BYTE(value); + } depthValues[i] = _mesa_half_to_float(value); } + needClamp = GL_TRUE; } break; default: @@ -4001,12 +4015,30 @@ return; } + /* apply depth scale and bias */ + { + const GLfloat scale = ctx->Pixel.DepthScale; + const GLfloat bias = ctx->Pixel.DepthBias; + if (scale != 1.0 || bias != 0.0) { + GLuint i; + for (i = 0; i < n; i++) { + depthValues[i] = depthValues[i] * scale + bias; + } + needClamp = GL_TRUE; + } + } - /* apply depth scale and bias and clamp to [0,1] */ - if (ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0) { - _mesa_scale_and_bias_depth(ctx, n, depthValues); + /* clamp to [0, 1] */ + if (needClamp) { + GLuint i; + for (i = 0; i < n; i++) { + depthValues[i] = CLAMP(depthValues[i], 0.0, 1.0); + } } + /* + * Convert values to dstType + */ [... truncated: 1036 lines follow ...] From korli at mail.berlios.de Thu Aug 9 23:03:38 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Thu, 9 Aug 2007 23:03:38 +0200 Subject: [Haiku-commits] r21877 - haiku/vendor/mesa Message-ID: <200708092103.l79L3cqO004824@sheep.berlios.de> Author: korli Date: 2007-08-09 23:03:38 +0200 (Thu, 09 Aug 2007) New Revision: 21877 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21877&view=rev Added: haiku/vendor/mesa/7.0.1/ Log: tagging Mesa 7.0.1 Copied: haiku/vendor/mesa/7.0.1 (from rev 21876, haiku/vendor/mesa/current) From korli at mail.berlios.de Thu Aug 9 23:12:35 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Thu, 9 Aug 2007 23:12:35 +0200 Subject: [Haiku-commits] r21878 - in haiku/trunk: headers/os/opengl/GL src/kits/opengl/glu/libnurbs/interface src/kits/opengl/glu/libnurbs/nurbtess src/kits/opengl/glu/libutil src/kits/opengl/mesa/glapi src/kits/opengl/mesa/main src/kits/opengl/mesa/shader src/kits/opengl/mesa/shader/slang src/kits/opengl/mesa/shader/slang/library src/kits/opengl/mesa/sparc src/kits/opengl/mesa/swrast src/kits/opengl/mesa/tnl src/kits/opengl/mesa/vbo src/kits/opengl/mesa/x86 src/kits/opengl/mesa/x86-64 Message-ID: <200708092112.l79LCZ1i005478@sheep.berlios.de> Author: korli Date: 2007-08-09 23:12:30 +0200 (Thu, 09 Aug 2007) New Revision: 21878 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21878&view=rev Added: haiku/trunk/src/kits/opengl/mesa/shader/slang/library/slang_builtin_120_common_gc.h haiku/trunk/src/kits/opengl/mesa/shader/slang/library/slang_builtin_120_fragment_gc.h Removed: haiku/trunk/src/kits/opengl/mesa/tnl/t_save_api.c haiku/trunk/src/kits/opengl/mesa/x86-64/Makefile haiku/trunk/src/kits/opengl/mesa/x86/Makefile Modified: haiku/trunk/headers/os/opengl/GL/gl.h haiku/trunk/headers/os/opengl/GL/glu.h haiku/trunk/headers/os/opengl/GL/glut.h haiku/trunk/src/kits/opengl/glu/libnurbs/interface/bezierPatch.cc haiku/trunk/src/kits/opengl/glu/libnurbs/interface/glcurveval.h haiku/trunk/src/kits/opengl/glu/libnurbs/interface/glsurfeval.cc haiku/trunk/src/kits/opengl/glu/libnurbs/interface/glsurfeval.h haiku/trunk/src/kits/opengl/glu/libnurbs/interface/insurfeval.cc haiku/trunk/src/kits/opengl/glu/libnurbs/nurbtess/monoTriangulation.h haiku/trunk/src/kits/opengl/glu/libutil/error.c haiku/trunk/src/kits/opengl/mesa/glapi/glapitemp.h haiku/trunk/src/kits/opengl/mesa/glapi/glprocs.h haiku/trunk/src/kits/opengl/mesa/main/api_validate.c haiku/trunk/src/kits/opengl/mesa/main/dlist.c haiku/trunk/src/kits/opengl/mesa/main/glheader.h haiku/trunk/src/kits/opengl/mesa/main/image.c haiku/trunk/src/kits/opengl/mesa/main/imports.c haiku/trunk/src/kits/opengl/mesa/main/imports.h haiku/trunk/src/kits/opengl/mesa/main/points.c haiku/trunk/src/kits/opengl/mesa/main/shaders.c haiku/trunk/src/kits/opengl/mesa/main/texcompress_fxt1.c haiku/trunk/src/kits/opengl/mesa/main/texenvprogram.c haiku/trunk/src/kits/opengl/mesa/main/teximage.c haiku/trunk/src/kits/opengl/mesa/main/version.h haiku/trunk/src/kits/opengl/mesa/shader/program.c haiku/trunk/src/kits/opengl/mesa/shader/shader_api.c haiku/trunk/src/kits/opengl/mesa/shader/slang/library/slang_core.gc haiku/trunk/src/kits/opengl/mesa/shader/slang/library/slang_core_gc.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_codegen.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_compile.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_emit.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_ir.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_ir.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_link.c haiku/trunk/src/kits/opengl/mesa/sparc/glapi_sparc.S haiku/trunk/src/kits/opengl/mesa/swrast/s_drawpix.c haiku/trunk/src/kits/opengl/mesa/vbo/vbo_exec_api.c haiku/trunk/src/kits/opengl/mesa/vbo/vbo_save_api.c haiku/trunk/src/kits/opengl/mesa/x86-64/glapi_x86-64.S haiku/trunk/src/kits/opengl/mesa/x86/common_x86.c haiku/trunk/src/kits/opengl/mesa/x86/glapi_x86.S Log: updated mesa to 7.0.1 Modified: haiku/trunk/headers/os/opengl/GL/gl.h =================================================================== --- haiku/trunk/headers/os/opengl/GL/gl.h 2007-08-09 21:03:38 UTC (rev 21877) +++ haiku/trunk/headers/os/opengl/GL/gl.h 2007-08-09 21:12:30 UTC (rev 21878) @@ -84,7 +84,8 @@ #include #endif -#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) \ + && !defined(OPENSTEP) && !defined(__CYGWIN__) || defined(__MINGW32__) #include #endif @@ -2161,11 +2162,11 @@ #define GL_DEBUG_PRINT_MESA 0x875A #define GL_DEBUG_ASSERT_MESA 0x875B -GLAPI GLhandleARB APIENTRY glCreateDebugObjectMESA (void); -GLAPI void APIENTRY glClearDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType); -GLAPI void APIENTRY glGetDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType, GLsizei maxLength, +GLAPI GLhandleARB GLAPIENTRY glCreateDebugObjectMESA (void); +GLAPI void GLAPIENTRY glClearDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType); +GLAPI void GLAPIENTRY glGetDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType, GLsizei maxLength, GLsizei *length, GLcharARB *debugLog); -GLAPI GLsizei APIENTRY glGetDebugLogLengthMESA (GLhandleARB obj, GLenum logType, GLenum shaderType); +GLAPI GLsizei GLAPIENTRY glGetDebugLogLengthMESA (GLhandleARB obj, GLenum logType, GLenum shaderType); #endif /* GL_MESA_shader_debug */ Modified: haiku/trunk/headers/os/opengl/GL/glu.h =================================================================== --- haiku/trunk/headers/os/opengl/GL/glu.h 2007-08-09 21:03:38 UTC (rev 21877) +++ haiku/trunk/headers/os/opengl/GL/glu.h 2007-08-09 21:12:30 UTC (rev 21878) @@ -44,6 +44,19 @@ #define GLAPIENTRYP GLAPIENTRY * #endif +#ifdef GLAPI +#undef GLAPI +#endif + +# if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GLU32) +# define GLAPI __declspec(dllexport) +# elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ +# define GLAPI __declspec(dllimport) +# else /* for use with static link lib build of Win32 edition only */ +# define GLAPI extern +# endif /* _STATIC_MESA support */ + + #ifndef GLAPI #define GLAPI #endif Modified: haiku/trunk/headers/os/opengl/GL/glut.h =================================================================== --- haiku/trunk/headers/os/opengl/GL/glut.h 2007-08-09 21:03:38 UTC (rev 21877) +++ haiku/trunk/headers/os/opengl/GL/glut.h 2007-08-09 21:12:30 UTC (rev 21878) @@ -10,6 +10,10 @@ #include #include +#if defined(__MINGW32__) +#include +#endif + #ifdef __cplusplus extern "C" { #endif @@ -115,7 +119,7 @@ #endif /* GLUT API entry point declarations for Win32. */ -#if defined(GLUT_BUILDING_LIB) && defined(_DLL) +#if (defined(BUILD_GLUT32) || defined(GLUT_BUILDING_LIB)) && defined(_DLL) # define GLUTAPI __declspec(dllexport) #elif defined(_DLL) # define GLUTAPI __declspec(dllimport) @@ -130,9 +134,12 @@ # pragma message( "----: being multiply defined you should include WINDOWS.H priot to gl/glut.h" ) # endif # define CALLBACK __stdcall -typedef int (GLUTAPIENTRY *PROC)(); -typedef void *HGLRC; -typedef void *HDC; + +#if !defined(__MINGW32__) + typedef int (GLUTAPIENTRY *PROC)(); + typedef void *HGLRC; + typedef void *HDC; +#endif typedef unsigned long COLORREF; #endif Modified: haiku/trunk/src/kits/opengl/glu/libnurbs/interface/bezierPatch.cc =================================================================== --- haiku/trunk/src/kits/opengl/glu/libnurbs/interface/bezierPatch.cc 2007-08-09 21:03:38 UTC (rev 21877) +++ haiku/trunk/src/kits/opengl/glu/libnurbs/interface/bezierPatch.cc 2007-08-09 21:12:30 UTC (rev 21878) @@ -111,8 +111,11 @@ void bezierPatchDeleteList(bezierPatch *b) { bezierPatch *temp; - for(temp = b; temp != NULL; temp = temp->next) - bezierPatchDelete(temp); + while (b != NULL) { + temp = b; + b = b->next; + bezierPatchDelete(temp); + } } bezierPatch* bezierPatchInsert(bezierPatch *list, bezierPatch *b) Modified: haiku/trunk/src/kits/opengl/glu/libnurbs/interface/glcurveval.h =================================================================== --- haiku/trunk/src/kits/opengl/glu/libnurbs/interface/glcurveval.h 2007-08-09 21:03:38 UTC (rev 21877) +++ haiku/trunk/src/kits/opengl/glu/libnurbs/interface/glcurveval.h 2007-08-09 21:12:30 UTC (rev 21878) @@ -93,7 +93,7 @@ output_triangles = flag; } #ifdef _WIN32 - void putCallBack(GLenum which, void (APIENTRY *fn)() ); + void putCallBack(GLenum which, void (GLAPIENTRY *fn)() ); #else void putCallBack(GLenum which, _GLUfuncptr fn ); #endif Modified: haiku/trunk/src/kits/opengl/glu/libnurbs/interface/glsurfeval.cc =================================================================== --- haiku/trunk/src/kits/opengl/glu/libnurbs/interface/glsurfeval.cc 2007-08-09 21:03:38 UTC (rev 21877) +++ haiku/trunk/src/kits/opengl/glu/libnurbs/interface/glsurfeval.cc 2007-08-09 21:12:30 UTC (rev 21878) @@ -1184,8 +1184,11 @@ } -void -OpenGLSurfaceEvaluator::putCallBack(GLenum which, _GLUfuncptr fn ) +#ifdef _WIN32 +void OpenGLSurfaceEvaluator::putCallBack(GLenum which, void (GLAPIENTRY *fn)() ) +#else +void OpenGLSurfaceEvaluator::putCallBack(GLenum which, _GLUfuncptr fn ) +#endif { switch(which) { Modified: haiku/trunk/src/kits/opengl/glu/libnurbs/interface/glsurfeval.h =================================================================== --- haiku/trunk/src/kits/opengl/glu/libnurbs/interface/glsurfeval.h 2007-08-09 21:03:38 UTC (rev 21877) +++ haiku/trunk/src/kits/opengl/glu/libnurbs/interface/glsurfeval.h 2007-08-09 21:12:30 UTC (rev 21878) @@ -145,7 +145,7 @@ void newtmeshvert( long, long ); #ifdef _WIN32 - void putCallBack(GLenum which, void (APIENTRY *fn)() ); + void putCallBack(GLenum which, void (GLAPIENTRY *fn)() ); #else void putCallBack(GLenum which, _GLUfuncptr fn ); #endif Modified: haiku/trunk/src/kits/opengl/glu/libnurbs/interface/insurfeval.cc =================================================================== --- haiku/trunk/src/kits/opengl/glu/libnurbs/interface/insurfeval.cc 2007-08-09 21:03:38 UTC (rev 21877) +++ haiku/trunk/src/kits/opengl/glu/libnurbs/interface/insurfeval.cc 2007-08-09 21:12:30 UTC (rev 21878) @@ -1533,9 +1533,9 @@ } //clean up free(leftXYZ); - free(leftXYZ); + free(rightXYZ); + free(leftNormal); free(rightNormal); - free(rightNormal); } /*-----------------------begin evalMachine-------------------*/ Modified: haiku/trunk/src/kits/opengl/glu/libnurbs/nurbtess/monoTriangulation.h =================================================================== --- haiku/trunk/src/kits/opengl/glu/libnurbs/nurbtess/monoTriangulation.h 2007-08-09 21:03:38 UTC (rev 21877) +++ haiku/trunk/src/kits/opengl/glu/libnurbs/nurbtess/monoTriangulation.h 2007-08-09 21:12:30 UTC (rev 21878) @@ -43,10 +43,9 @@ #include "definitions.h" #include "primitiveStream.h" #include "directedLine.h" +#include "arc.h" class Backend; -class Arc; -typedef Arc *Arc_ptr; class reflexChain{ Real2 *queue; Modified: haiku/trunk/src/kits/opengl/glu/libutil/error.c =================================================================== --- haiku/trunk/src/kits/opengl/glu/libutil/error.c 2007-08-09 21:03:38 UTC (rev 21877) +++ haiku/trunk/src/kits/opengl/glu/libutil/error.c 2007-08-09 21:12:30 UTC (rev 21878) @@ -82,7 +82,7 @@ if ((errorCode >= GLU_NURBS_ERROR1) && (errorCode <= GLU_NURBS_ERROR37)) { return (const GLubyte *) __gluNURBSErrorString(errorCode - (GLU_NURBS_ERROR1 - 1)); } - if ((errorCode >= GLU_TESS_ERROR1) && (errorCode <= GLU_TESS_ERROR8)) { + if ((errorCode >= GLU_TESS_ERROR1) && (errorCode <= GLU_TESS_ERROR6)) { return (const GLubyte *) __gluTessErrorString(errorCode - (GLU_TESS_ERROR1 - 1)); } return (const GLubyte *) 0; Modified: haiku/trunk/src/kits/opengl/mesa/glapi/glapitemp.h =================================================================== --- haiku/trunk/src/kits/opengl/mesa/glapi/glapitemp.h 2007-08-09 21:03:38 UTC (rev 21877) +++ haiku/trunk/src/kits/opengl/mesa/glapi/glapitemp.h 2007-08-09 21:12:30 UTC (rev 21878) @@ -3284,6 +3284,11 @@ DISPATCH(VertexAttrib4NusvARB, (index, v), (F, "glVertexAttrib4NusvARB(%d, %p);\n", index, (const void *) v)); } +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4bv)(GLuint index, const GLbyte * v) +{ + DISPATCH(VertexAttrib4bvARB, (index, v), (F, "glVertexAttrib4bv(%d, %p);\n", index, (const void *) v)); +} + KEYWORD1 void KEYWORD2 NAME(VertexAttrib4bvARB)(GLuint index, const GLbyte * v) { DISPATCH(VertexAttrib4bvARB, (index, v), (F, "glVertexAttrib4bvARB(%d, %p);\n", index, (const void *) v)); @@ -3329,6 +3334,11 @@ DISPATCH(VertexAttrib4fvARB, (index, v), (F, "glVertexAttrib4fvARB(%d, %p);\n", index, (const void *) v)); } +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4iv)(GLuint index, const GLint * v) +{ + DISPATCH(VertexAttrib4ivARB, (index, v), (F, "glVertexAttrib4iv(%d, %p);\n", index, (const void *) v)); +} + KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ivARB)(GLuint index, const GLint * v) { DISPATCH(VertexAttrib4ivARB, (index, v), (F, "glVertexAttrib4ivARB(%d, %p);\n", index, (const void *) v)); @@ -3354,16 +3364,31 @@ DISPATCH(VertexAttrib4svARB, (index, v), (F, "glVertexAttrib4svARB(%d, %p);\n", index, (const void *) v)); } +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ubv)(GLuint index, const GLubyte * v) +{ + DISPATCH(VertexAttrib4ubvARB, (index, v), (F, "glVertexAttrib4ubv(%d, %p);\n", index, (const void *) v)); +} + KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ubvARB)(GLuint index, const GLubyte * v) { DISPATCH(VertexAttrib4ubvARB, (index, v), (F, "glVertexAttrib4ubvARB(%d, %p);\n", index, (const void *) v)); } +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4uiv)(GLuint index, const GLuint * v) +{ + DISPATCH(VertexAttrib4uivARB, (index, v), (F, "glVertexAttrib4uiv(%d, %p);\n", index, (const void *) v)); +} + KEYWORD1 void KEYWORD2 NAME(VertexAttrib4uivARB)(GLuint index, const GLuint * v) { DISPATCH(VertexAttrib4uivARB, (index, v), (F, "glVertexAttrib4uivARB(%d, %p);\n", index, (const void *) v)); } +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4usv)(GLuint index, const GLushort * v) +{ + DISPATCH(VertexAttrib4usvARB, (index, v), (F, "glVertexAttrib4usv(%d, %p);\n", index, (const void *) v)); +} + KEYWORD1 void KEYWORD2 NAME(VertexAttrib4usvARB)(GLuint index, const GLushort * v) { DISPATCH(VertexAttrib4usvARB, (index, v), (F, "glVertexAttrib4usvARB(%d, %p);\n", index, (const void *) v)); @@ -6458,12 +6483,17 @@ TABLE_ENTRY(VertexAttrib4Nubv), TABLE_ENTRY(VertexAttrib4Nuiv), TABLE_ENTRY(VertexAttrib4Nusv), + TABLE_ENTRY(VertexAttrib4bv), TABLE_ENTRY(VertexAttrib4d), TABLE_ENTRY(VertexAttrib4dv), TABLE_ENTRY(VertexAttrib4f), TABLE_ENTRY(VertexAttrib4fv), + TABLE_ENTRY(VertexAttrib4iv), TABLE_ENTRY(VertexAttrib4s), TABLE_ENTRY(VertexAttrib4sv), + TABLE_ENTRY(VertexAttrib4ubv), + TABLE_ENTRY(VertexAttrib4uiv), + TABLE_ENTRY(VertexAttrib4usv), TABLE_ENTRY(VertexAttribPointer), TABLE_ENTRY(BindBuffer), TABLE_ENTRY(BufferData), Modified: haiku/trunk/src/kits/opengl/mesa/glapi/glprocs.h =================================================================== --- haiku/trunk/src/kits/opengl/mesa/glapi/glprocs.h 2007-08-09 21:03:38 UTC (rev 21877) +++ haiku/trunk/src/kits/opengl/mesa/glapi/glprocs.h 2007-08-09 21:12:30 UTC (rev 21878) @@ -957,12 +957,17 @@ "glVertexAttrib4Nubv\0" "glVertexAttrib4Nuiv\0" "glVertexAttrib4Nusv\0" + "glVertexAttrib4bv\0" "glVertexAttrib4d\0" "glVertexAttrib4dv\0" "glVertexAttrib4f\0" "glVertexAttrib4fv\0" + "glVertexAttrib4iv\0" "glVertexAttrib4s\0" "glVertexAttrib4sv\0" + "glVertexAttrib4ubv\0" + "glVertexAttrib4uiv\0" + "glVertexAttrib4usv\0" "glVertexAttribPointer\0" "glBindBuffer\0" "glBufferData\0" @@ -2100,142 +2105,147 @@ NAME_FUNC_OFFSET(16268, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB), NAME_FUNC_OFFSET(16288, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB), NAME_FUNC_OFFSET(16308, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB), - NAME_FUNC_OFFSET(16328, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), - NAME_FUNC_OFFSET(16345, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), - NAME_FUNC_OFFSET(16363, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), - NAME_FUNC_OFFSET(16380, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), - NAME_FUNC_OFFSET(16398, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), - NAME_FUNC_OFFSET(16415, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), - NAME_FUNC_OFFSET(16433, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), - NAME_FUNC_OFFSET(16455, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), - NAME_FUNC_OFFSET(16468, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), - NAME_FUNC_OFFSET(16481, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), - NAME_FUNC_OFFSET(16497, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), - NAME_FUNC_OFFSET(16513, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), - NAME_FUNC_OFFSET(16526, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), - NAME_FUNC_OFFSET(16549, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), - NAME_FUNC_OFFSET(16569, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), - NAME_FUNC_OFFSET(16588, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), - NAME_FUNC_OFFSET(16599, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), - NAME_FUNC_OFFSET(16611, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), - NAME_FUNC_OFFSET(16625, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), - NAME_FUNC_OFFSET(16638, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), - NAME_FUNC_OFFSET(16654, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), - NAME_FUNC_OFFSET(16665, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), - NAME_FUNC_OFFSET(16678, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), - NAME_FUNC_OFFSET(16697, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), - NAME_FUNC_OFFSET(16717, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), - NAME_FUNC_OFFSET(16730, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), - NAME_FUNC_OFFSET(16740, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), - NAME_FUNC_OFFSET(16756, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), - NAME_FUNC_OFFSET(16775, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), - NAME_FUNC_OFFSET(16793, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), - NAME_FUNC_OFFSET(16814, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), - NAME_FUNC_OFFSET(16829, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), - NAME_FUNC_OFFSET(16844, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), - NAME_FUNC_OFFSET(16858, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), - NAME_FUNC_OFFSET(16873, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), - NAME_FUNC_OFFSET(16885, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), - NAME_FUNC_OFFSET(16898, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), - NAME_FUNC_OFFSET(16910, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), - NAME_FUNC_OFFSET(16923, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), - NAME_FUNC_OFFSET(16935, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), - NAME_FUNC_OFFSET(16948, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), - NAME_FUNC_OFFSET(16960, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), - NAME_FUNC_OFFSET(16973, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), - NAME_FUNC_OFFSET(16985, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), - NAME_FUNC_OFFSET(16998, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), - NAME_FUNC_OFFSET(17010, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), - NAME_FUNC_OFFSET(17023, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), - NAME_FUNC_OFFSET(17035, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), - NAME_FUNC_OFFSET(17048, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), - NAME_FUNC_OFFSET(17060, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), - NAME_FUNC_OFFSET(17073, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), - NAME_FUNC_OFFSET(17092, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), - NAME_FUNC_OFFSET(17111, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), - NAME_FUNC_OFFSET(17130, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), - NAME_FUNC_OFFSET(17143, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), - NAME_FUNC_OFFSET(17161, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), - NAME_FUNC_OFFSET(17182, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), - NAME_FUNC_OFFSET(17200, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), - NAME_FUNC_OFFSET(17220, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(17234, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(17251, gl_dispatch_stub_568, gl_dispatch_stub_568, NULL, _gloffset_SampleMaskSGIS), - NAME_FUNC_OFFSET(17267, gl_dispatch_stub_569, gl_dispatch_stub_569, NULL, _gloffset_SamplePatternSGIS), - NAME_FUNC_OFFSET(17286, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17304, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17325, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17347, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17366, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17388, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17411, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), - NAME_FUNC_OFFSET(17430, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), - NAME_FUNC_OFFSET(17450, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), - NAME_FUNC_OFFSET(17469, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), - NAME_FUNC_OFFSET(17489, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), - NAME_FUNC_OFFSET(17508, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), - NAME_FUNC_OFFSET(17528, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), - NAME_FUNC_OFFSET(17547, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), - NAME_FUNC_OFFSET(17567, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), - NAME_FUNC_OFFSET(17586, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), - NAME_FUNC_OFFSET(17606, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), - NAME_FUNC_OFFSET(17626, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), - NAME_FUNC_OFFSET(17647, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), - NAME_FUNC_OFFSET(17667, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), - NAME_FUNC_OFFSET(17688, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), - NAME_FUNC_OFFSET(17708, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), - NAME_FUNC_OFFSET(17729, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), - NAME_FUNC_OFFSET(17753, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), - NAME_FUNC_OFFSET(17771, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), - NAME_FUNC_OFFSET(17791, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), - NAME_FUNC_OFFSET(17809, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), - NAME_FUNC_OFFSET(17821, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), - NAME_FUNC_OFFSET(17834, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), - NAME_FUNC_OFFSET(17846, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), - NAME_FUNC_OFFSET(17859, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(17879, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(17903, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(17917, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(17934, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(17949, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(17967, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(17981, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(17998, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(18013, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(18031, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(18045, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(18062, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(18077, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(18095, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(18109, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(18126, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(18141, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(18159, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(18173, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(18190, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(18205, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(18223, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(18237, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(18254, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(18269, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(18287, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(18301, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(18318, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(18333, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(18351, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(18365, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(18382, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(18397, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(18415, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), - NAME_FUNC_OFFSET(18432, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), - NAME_FUNC_OFFSET(18452, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), - NAME_FUNC_OFFSET(18469, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(18495, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(18524, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), - NAME_FUNC_OFFSET(18539, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), - NAME_FUNC_OFFSET(18557, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), - NAME_FUNC_OFFSET(18576, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(18600, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(16328, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB), + NAME_FUNC_OFFSET(16346, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), + NAME_FUNC_OFFSET(16363, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), + NAME_FUNC_OFFSET(16381, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), + NAME_FUNC_OFFSET(16398, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), + NAME_FUNC_OFFSET(16416, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB), + NAME_FUNC_OFFSET(16434, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), + NAME_FUNC_OFFSET(16451, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), + NAME_FUNC_OFFSET(16469, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB), + NAME_FUNC_OFFSET(16488, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB), + NAME_FUNC_OFFSET(16507, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB), + NAME_FUNC_OFFSET(16526, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), + NAME_FUNC_OFFSET(16548, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), + NAME_FUNC_OFFSET(16561, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), + NAME_FUNC_OFFSET(16574, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), + NAME_FUNC_OFFSET(16590, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), + NAME_FUNC_OFFSET(16606, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), + NAME_FUNC_OFFSET(16619, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), + NAME_FUNC_OFFSET(16642, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), + NAME_FUNC_OFFSET(16662, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), + NAME_FUNC_OFFSET(16681, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), + NAME_FUNC_OFFSET(16692, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), + NAME_FUNC_OFFSET(16704, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), + NAME_FUNC_OFFSET(16718, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), + NAME_FUNC_OFFSET(16731, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), + NAME_FUNC_OFFSET(16747, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), + NAME_FUNC_OFFSET(16758, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), + NAME_FUNC_OFFSET(16771, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), + NAME_FUNC_OFFSET(16790, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), + NAME_FUNC_OFFSET(16810, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), + NAME_FUNC_OFFSET(16823, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), + NAME_FUNC_OFFSET(16833, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), + NAME_FUNC_OFFSET(16849, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), + NAME_FUNC_OFFSET(16868, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), + NAME_FUNC_OFFSET(16886, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), + NAME_FUNC_OFFSET(16907, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), + NAME_FUNC_OFFSET(16922, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), + NAME_FUNC_OFFSET(16937, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), + NAME_FUNC_OFFSET(16951, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), + NAME_FUNC_OFFSET(16966, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), + NAME_FUNC_OFFSET(16978, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), + NAME_FUNC_OFFSET(16991, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), + NAME_FUNC_OFFSET(17003, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), + NAME_FUNC_OFFSET(17016, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), + NAME_FUNC_OFFSET(17028, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), + NAME_FUNC_OFFSET(17041, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), + NAME_FUNC_OFFSET(17053, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), + NAME_FUNC_OFFSET(17066, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), + NAME_FUNC_OFFSET(17078, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), + NAME_FUNC_OFFSET(17091, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), + NAME_FUNC_OFFSET(17103, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), + NAME_FUNC_OFFSET(17116, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), + NAME_FUNC_OFFSET(17128, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), + NAME_FUNC_OFFSET(17141, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), + NAME_FUNC_OFFSET(17153, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), + NAME_FUNC_OFFSET(17166, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), + NAME_FUNC_OFFSET(17185, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), + NAME_FUNC_OFFSET(17204, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), + NAME_FUNC_OFFSET(17223, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), + NAME_FUNC_OFFSET(17236, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), + NAME_FUNC_OFFSET(17254, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), + NAME_FUNC_OFFSET(17275, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), + NAME_FUNC_OFFSET(17293, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), + NAME_FUNC_OFFSET(17313, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET(17327, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET(17344, gl_dispatch_stub_568, gl_dispatch_stub_568, NULL, _gloffset_SampleMaskSGIS), + NAME_FUNC_OFFSET(17360, gl_dispatch_stub_569, gl_dispatch_stub_569, NULL, _gloffset_SamplePatternSGIS), + NAME_FUNC_OFFSET(17379, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17397, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17418, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17440, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17459, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17481, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17504, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), + NAME_FUNC_OFFSET(17523, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), + NAME_FUNC_OFFSET(17543, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), + NAME_FUNC_OFFSET(17562, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), + NAME_FUNC_OFFSET(17582, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), + NAME_FUNC_OFFSET(17601, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), + NAME_FUNC_OFFSET(17621, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), + NAME_FUNC_OFFSET(17640, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), + NAME_FUNC_OFFSET(17660, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), + NAME_FUNC_OFFSET(17679, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), + NAME_FUNC_OFFSET(17699, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), + NAME_FUNC_OFFSET(17719, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), + NAME_FUNC_OFFSET(17740, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), + NAME_FUNC_OFFSET(17760, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), + NAME_FUNC_OFFSET(17781, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), + NAME_FUNC_OFFSET(17801, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), + NAME_FUNC_OFFSET(17822, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), + NAME_FUNC_OFFSET(17846, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), + NAME_FUNC_OFFSET(17864, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), + NAME_FUNC_OFFSET(17884, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), + NAME_FUNC_OFFSET(17902, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), + NAME_FUNC_OFFSET(17914, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), + NAME_FUNC_OFFSET(17927, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), + NAME_FUNC_OFFSET(17939, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), + NAME_FUNC_OFFSET(17952, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(17972, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(17996, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(18010, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(18027, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(18042, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(18060, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(18074, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(18091, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(18106, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(18124, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(18138, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(18155, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(18170, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(18188, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(18202, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(18219, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(18234, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(18252, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(18266, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(18283, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(18298, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(18316, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(18330, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(18347, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(18362, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(18380, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(18394, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(18411, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(18426, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(18444, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(18458, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(18475, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(18490, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(18508, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), + NAME_FUNC_OFFSET(18525, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), + NAME_FUNC_OFFSET(18545, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), + NAME_FUNC_OFFSET(18562, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(18588, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(18617, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), + NAME_FUNC_OFFSET(18632, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), + NAME_FUNC_OFFSET(18650, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), + NAME_FUNC_OFFSET(18669, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(18693, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0) }; Modified: haiku/trunk/src/kits/opengl/mesa/main/api_validate.c =================================================================== --- haiku/trunk/src/kits/opengl/mesa/main/api_validate.c 2007-08-09 21:03:38 UTC (rev 21877) +++ haiku/trunk/src/kits/opengl/mesa/main/api_validate.c 2007-08-09 21:12:30 UTC (rev 21878) @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.1 + * Version: 7.0.1 * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -100,6 +100,11 @@ (const GLubyte *) indices); } } + else { + /* not using a VBO */ + if (!indices) + return GL_FALSE; + } if (ctx->Const.CheckArrayBounds) { /* find max array index */ @@ -170,6 +175,16 @@ && !(ctx->VertexProgram._Enabled && ctx->Array.ArrayObj->VertexAttrib[0].Enabled)) return GL_FALSE; + /* Vertex buffer object tests */ + if (ctx->Array.ElementArrayBufferObj->Name) { + /* XXX re-use code from above? */ + } + else { + /* not using VBO */ + if (!indices) + return GL_FALSE; + } + if (ctx->Const.CheckArrayBounds) { /* Find max array index. * We don't trust the user's start and end values. Modified: haiku/trunk/src/kits/opengl/mesa/main/dlist.c =================================================================== --- haiku/trunk/src/kits/opengl/mesa/main/dlist.c 2007-08-09 21:03:38 UTC (rev 21877) +++ haiku/trunk/src/kits/opengl/mesa/main/dlist.c 2007-08-09 21:12:30 UTC (rev 21878) @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.0.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -2716,22 +2716,21 @@ } -/* - * Polygon stipple must have been upacked already! - */ static void GLAPIENTRY save_PolygonStipple(const GLubyte * pattern) { GET_CURRENT_CONTEXT(ctx); + GLvoid *image = unpack_image(2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, + pattern, &ctx->Unpack); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_STIPPLE, 1); if (n) { - void *data; - n[1].data = _mesa_malloc(32 * 4); - data = n[1].data; /* This needed for Acorn compiler */ - MEMCPY(data, pattern, 32 * 4); + n[1].data = image; } + else if (image) { + _mesa_free(image); + } if (ctx->ExecuteFlag) { CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern)); } @@ -6169,7 +6168,12 @@ CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e)); break; case OPCODE_POLYGON_STIPPLE: - CALL_PolygonStipple(ctx->Exec, ((GLubyte *) n[1].data)); + { + const struct gl_pixelstore_attrib save = ctx->Unpack; + ctx->Unpack = ctx->DefaultPacking; + CALL_PolygonStipple(ctx->Exec, ((GLubyte *) n[1].data)); + ctx->Unpack = save; /* restore */ + } break; case OPCODE_POLYGON_OFFSET: CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f)); Modified: haiku/trunk/src/kits/opengl/mesa/main/glheader.h =================================================================== --- haiku/trunk/src/kits/opengl/mesa/main/glheader.h 2007-08-09 21:03:38 UTC (rev 21877) +++ haiku/trunk/src/kits/opengl/mesa/main/glheader.h 2007-08-09 21:12:30 UTC (rev 21878) @@ -91,6 +91,9 @@ # pragma disable_message(201) /* Disable unreachable code warnings */ #endif +#ifdef WGLAPI +# undef WGLAPI +#endif #if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP) # if !defined(__GNUC__) /* mingw environment */ Modified: haiku/trunk/src/kits/opengl/mesa/main/image.c =================================================================== --- haiku/trunk/src/kits/opengl/mesa/main/image.c 2007-08-09 21:03:38 UTC (rev 21877) +++ haiku/trunk/src/kits/opengl/mesa/main/image.c 2007-08-09 21:12:30 UTC (rev 21878) @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.0 + * Version: 7.0.1 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -850,7 +850,7 @@ return NULL; } - if (packing->SkipPixels == 0) { + if ((packing->SkipPixels & 7) == 0) { _mesa_memcpy( dst, src, width_in_bytes ); if (packing->LsbFirst) { flip_bytes( dst, width_in_bytes ); @@ -942,7 +942,7 @@ if (!dst) return; - if (packing->SkipPixels == 0) { + if ((packing->SkipPixels & 7) == 0) { _mesa_memcpy( dst, src, width_in_bytes ); if (packing->LsbFirst) { flip_bytes( dst, width_in_bytes ); @@ -961,20 +961,20 @@ if (*s & srcMask) { *d |= dstMask; } - if (srcMask == 128) { - srcMask = 1; + if (srcMask == 1) { + srcMask = 128; s++; } else { - srcMask = srcMask << 1; + srcMask = srcMask >> 1; } - if (dstMask == 1) { - dstMask = 128; + if (dstMask == 128) { + dstMask = 1; d++; *d = 0; } else { - dstMask = dstMask >> 1; + dstMask = dstMask << 1; } } } @@ -3648,11 +3648,13 @@ * Try simple cases first */ if (transferOps == 0 && + !ctx->Pixel.MapStencilFlag && srcType == GL_UNSIGNED_BYTE && dstType == GL_UNSIGNED_BYTE) { _mesa_memcpy(dest, source, n * sizeof(GLubyte)); } else if (transferOps == 0 && + !ctx->Pixel.MapStencilFlag && srcType == GL_UNSIGNED_INT && dstType == GL_UNSIGNED_INT && !srcPacking->SwapBytes) { @@ -3668,19 +3670,17 @@ extract_uint_indexes(n, indexes, GL_STENCIL_INDEX, srcType, source, srcPacking); - if (transferOps) { - if (transferOps & IMAGE_SHIFT_OFFSET_BIT) { - /* shift and offset indexes */ - shift_and_offset_ci(ctx, n, indexes); - } + if (transferOps & IMAGE_SHIFT_OFFSET_BIT) { + /* shift and offset indexes */ + shift_and_offset_ci(ctx, n, indexes); + } - if (ctx->Pixel.MapStencilFlag) { - /* Apply stencil lookup table */ - GLuint mask = ctx->PixelMaps.StoS.Size - 1; - GLuint i; - for (i=0;iPixelMaps.StoS.Map[ indexes[i] & mask ]; - } + if (ctx->Pixel.MapStencilFlag) { + /* Apply stencil lookup table */ + const GLuint mask = ctx->PixelMaps.StoS.Size - 1; + GLuint i; + for (i = 0; i < n; i++) { + indexes[i] = ctx->PixelMaps.StoS.Map[ indexes[i] & mask ]; } } @@ -3733,7 +3733,7 @@ switch (dstType) { case GL_UNSIGNED_BYTE: - if (sizeof(GLstencil) == 8) { + if (sizeof(GLstencil) == 1) { _mesa_memcpy( dest, source, n ); } else { @@ -3745,14 +3745,11 @@ } break; case GL_BYTE: - if (sizeof(GLstencil) == 8) { - _mesa_memcpy( dest, source, n ); - } - else { + { GLbyte *dst = (GLbyte *) dest; GLuint i; for (i=0;iSwapBytes here!!! */ - (void) srcPacking; - - /* convert incoming values to GLfloat */ + /* Convert incoming values to GLfloat. Some conversions will require + * clamping, below. + */ switch (srcType) { case GL_BYTE: - DEPTH_VALUES(GLbyte, BYTE_TO_FLOAT); - break; + DEPTH_VALUES(GLbyte, BYTE_TO_FLOAT); + needClamp = GL_TRUE; + break; case GL_UNSIGNED_BYTE: - DEPTH_VALUES(GLubyte, UBYTE_TO_FLOAT); - break; + DEPTH_VALUES(GLubyte, UBYTE_TO_FLOAT); + break; case GL_SHORT: - DEPTH_VALUES(GLshort, SHORT_TO_FLOAT); - break; + DEPTH_VALUES(GLshort, SHORT_TO_FLOAT); + needClamp = GL_TRUE; + break; case GL_UNSIGNED_SHORT: - DEPTH_VALUES(GLushort, USHORT_TO_FLOAT); - break; + DEPTH_VALUES(GLushort, USHORT_TO_FLOAT); + break; case GL_INT: - DEPTH_VALUES(GLint, INT_TO_FLOAT); - break; + DEPTH_VALUES(GLint, INT_TO_FLOAT); + needClamp = GL_TRUE; + break; case GL_UNSIGNED_INT: - DEPTH_VALUES(GLuint, UINT_TO_FLOAT); - break; + DEPTH_VALUES(GLuint, UINT_TO_FLOAT); + break; case GL_UNSIGNED_INT_24_8_EXT: /* GL_EXT_packed_depth_stencil */ if (dstType == GL_UNSIGNED_INT && depthScale == (GLfloat) 0xffffff && @@ -3981,19 +3993,21 @@ } break; case GL_FLOAT: - DEPTH_VALUES(GLfloat, 1*); - break; + DEPTH_VALUES(GLfloat, 1*); + needClamp = GL_TRUE; + break; case GL_HALF_FLOAT_ARB: { GLuint i; const GLhalfARB *src = (const GLhalfARB *) source; for (i = 0; i < n; i++) { - GLhalfARB value = src[i]; - if (srcPacking->SwapBytes) { - SWAP2BYTE(value); - } + GLhalfARB value = src[i]; + if (srcPacking->SwapBytes) { + SWAP2BYTE(value); + } depthValues[i] = _mesa_half_to_float(value); } + needClamp = GL_TRUE; } break; default: @@ -4001,12 +4015,30 @@ return; } + /* apply depth scale and bias */ + { + const GLfloat scale = ctx->Pixel.DepthScale; + const GLfloat bias = ctx->Pixel.DepthBias; + if (scale != 1.0 || bias != 0.0) { + GLuint i; + for (i = 0; i < n; i++) { + depthValues[i] = depthValues[i] * scale + bias; + } + needClamp = GL_TRUE; + } + } - /* apply depth scale and bias and clamp to [0,1] */ - if (ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0) { - _mesa_scale_and_bias_depth(ctx, n, depthValues); + /* clamp to [0, 1] */ + if (needClamp) { + GLuint i; + for (i = 0; i < n; i++) { + depthValues[i] = CLAMP(depthValues[i], 0.0, 1.0); + } } + /* + * Convert values to dstType + */ [... truncated: 919 lines follow ...] From korli at mail.berlios.de Thu Aug 9 23:33:32 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Thu, 9 Aug 2007 23:33:32 +0200 Subject: [Haiku-commits] r21879 - in haiku/trunk: headers/libs/freetype2/freetype headers/libs/freetype2/freetype/config headers/libs/freetype2/freetype/internal headers/libs/freetype2/freetype/internal/services src/libs/freetype2/autofit src/libs/freetype2/base src/libs/freetype2/bdf src/libs/freetype2/cache src/libs/freetype2/cff src/libs/freetype2/cid src/libs/freetype2/gzip src/libs/freetype2/lzw src/libs/freetype2/pfr src/libs/freetype2/psaux src/libs/freetype2/pshinter src/libs/freetype2/psnames src/libs/freetype2/sfnt src/libs/freetype2/smooth src/libs/freetype2/truetype src/libs/freetype2/type1 src/libs/freetype2/type42 src/libs/freetype2/winfonts Message-ID: <200708092133.l79LXWos006784@sheep.berlios.de> Author: korli Date: 2007-08-09 23:33:28 +0200 (Thu, 09 Aug 2007) New Revision: 21879 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21879&view=rev Added: haiku/trunk/headers/libs/freetype2/freetype/internal/services/svttglyf.h haiku/trunk/src/libs/freetype2/autofit/afindic.c haiku/trunk/src/libs/freetype2/autofit/afindic.h haiku/trunk/src/libs/freetype2/autofit/aflatin2.c haiku/trunk/src/libs/freetype2/autofit/aflatin2.h haiku/trunk/src/libs/freetype2/base/ftpatent.c Modified: haiku/trunk/headers/libs/freetype2/freetype/config/ftoption.h haiku/trunk/headers/libs/freetype2/freetype/config/ftstdlib.h haiku/trunk/headers/libs/freetype2/freetype/freetype.h haiku/trunk/headers/libs/freetype2/freetype/ftcache.h haiku/trunk/headers/libs/freetype2/freetype/fterrdef.h haiku/trunk/headers/libs/freetype2/freetype/ftmodapi.h haiku/trunk/headers/libs/freetype2/freetype/ftstroke.h haiku/trunk/headers/libs/freetype2/freetype/fttypes.h haiku/trunk/headers/libs/freetype2/freetype/internal/ftobjs.h haiku/trunk/headers/libs/freetype2/freetype/internal/ftserv.h haiku/trunk/headers/libs/freetype2/freetype/internal/services/svttcmap.h haiku/trunk/headers/libs/freetype2/freetype/tttables.h haiku/trunk/src/libs/freetype2/autofit/Jamfile haiku/trunk/src/libs/freetype2/autofit/afcjk.c haiku/trunk/src/libs/freetype2/autofit/afglobal.c haiku/trunk/src/libs/freetype2/autofit/afglobal.h haiku/trunk/src/libs/freetype2/autofit/afhints.c haiku/trunk/src/libs/freetype2/autofit/afhints.h haiku/trunk/src/libs/freetype2/autofit/aflatin.c haiku/trunk/src/libs/freetype2/autofit/afloader.c haiku/trunk/src/libs/freetype2/autofit/aftypes.h haiku/trunk/src/libs/freetype2/autofit/autofit.c haiku/trunk/src/libs/freetype2/autofit/rules.mk haiku/trunk/src/libs/freetype2/base/Jamfile haiku/trunk/src/libs/freetype2/base/ftcalc.c haiku/trunk/src/libs/freetype2/base/ftglyph.c haiku/trunk/src/libs/freetype2/base/ftmac.c haiku/trunk/src/libs/freetype2/base/ftobjs.c haiku/trunk/src/libs/freetype2/base/ftoutln.c haiku/trunk/src/libs/freetype2/bdf/bdflib.c haiku/trunk/src/libs/freetype2/cache/ftcbasic.c haiku/trunk/src/libs/freetype2/cache/ftccache.c haiku/trunk/src/libs/freetype2/cache/ftccache.h haiku/trunk/src/libs/freetype2/cache/ftccmap.c haiku/trunk/src/libs/freetype2/cache/ftcglyph.h haiku/trunk/src/libs/freetype2/cff/cffgload.c haiku/trunk/src/libs/freetype2/cff/cffgload.h haiku/trunk/src/libs/freetype2/cid/cidgload.c haiku/trunk/src/libs/freetype2/cid/cidparse.c haiku/trunk/src/libs/freetype2/gzip/adler32.c haiku/trunk/src/libs/freetype2/gzip/zconf.h haiku/trunk/src/libs/freetype2/gzip/zutil.h haiku/trunk/src/libs/freetype2/lzw/ftzopen.c haiku/trunk/src/libs/freetype2/lzw/ftzopen.h haiku/trunk/src/libs/freetype2/pfr/pfrcmap.c haiku/trunk/src/libs/freetype2/pfr/pfrgload.c haiku/trunk/src/libs/freetype2/pfr/pfrtypes.h haiku/trunk/src/libs/freetype2/psaux/afmparse.c haiku/trunk/src/libs/freetype2/psaux/psobjs.c haiku/trunk/src/libs/freetype2/psaux/t1decode.c haiku/trunk/src/libs/freetype2/pshinter/pshmod.c haiku/trunk/src/libs/freetype2/pshinter/pshrec.c haiku/trunk/src/libs/freetype2/psnames/psmodule.c haiku/trunk/src/libs/freetype2/sfnt/sfobjs.c haiku/trunk/src/libs/freetype2/sfnt/ttcmap.c haiku/trunk/src/libs/freetype2/sfnt/ttkern.c haiku/trunk/src/libs/freetype2/sfnt/ttmtx.c haiku/trunk/src/libs/freetype2/sfnt/ttsbit0.c haiku/trunk/src/libs/freetype2/smooth/ftgrays.c haiku/trunk/src/libs/freetype2/truetype/ttdriver.c haiku/trunk/src/libs/freetype2/truetype/ttgload.c haiku/trunk/src/libs/freetype2/truetype/ttinterp.c haiku/trunk/src/libs/freetype2/truetype/ttobjs.c haiku/trunk/src/libs/freetype2/truetype/ttobjs.h haiku/trunk/src/libs/freetype2/type1/t1load.c haiku/trunk/src/libs/freetype2/type1/t1objs.c haiku/trunk/src/libs/freetype2/type42/t42objs.c haiku/trunk/src/libs/freetype2/type42/t42parse.c haiku/trunk/src/libs/freetype2/winfonts/winfnt.c haiku/trunk/src/libs/freetype2/winfonts/winfnt.h Log: updated freetype to 2.3.5 Modified: haiku/trunk/headers/libs/freetype2/freetype/config/ftoption.h =================================================================== --- haiku/trunk/headers/libs/freetype2/freetype/config/ftoption.h 2007-08-09 21:12:30 UTC (rev 21878) +++ haiku/trunk/headers/libs/freetype2/freetype/config/ftoption.h 2007-08-09 21:33:28 UTC (rev 21879) @@ -302,7 +302,9 @@ /* The size in bytes of the render pool used by the scan-line converter */ /* to do all of its work. */ /* */ - /* This must be greater than 4KByte. */ + /* This must be greater than 4KByte if you use FreeType to rasterize */ + /* glyphs; otherwise, you may set it to zero to avoid unnecessary */ + /* allocation of the render pool. */ /* */ #define FT_RENDER_POOL_SIZE 16384L @@ -461,13 +463,48 @@ /*************************************************************************/ /* */ - /* Define TT_CONFIG_OPTION_UNPATENTED_HINTING (in addition to */ - /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER) to compile the unpatented */ - /* work-around hinting system. Note that for the moment, the algorithm */ - /* is only used when selected at runtime through the parameter tag */ - /* FT_PARAM_TAG_UNPATENTED_HINTING; or when the debug hook */ - /* FT_DEBUG_HOOK_UNPATENTED_HINTING is globally activated. */ + /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version */ + /* of the TrueType bytecode interpreter is used that doesn't implement */ + /* any of the patented opcodes and algorithms. Note that the */ + /* the TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* if you */ + /* define TT_CONFIG_OPTION_BYTECODE_INTERPRETER; with other words, */ + /* either define TT_CONFIG_OPTION_BYTECODE_INTERPRETER or */ + /* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time. */ /* */ + /* This macro is only useful for a small number of font files (mostly */ + /* for Asian scripts) that require bytecode interpretation to properly */ + /* load glyphs. For all other fonts, this produces unpleasant results, */ + /* thus the unpatented interpreter is never used to load glyphs from */ + /* TrueType fonts unless one of the following two options is used. */ + /* */ + /* - The unpatented interpreter is explicitly activated by the user */ + /* through the FT_PARAM_TAG_UNPATENTED_HINTING parameter tag */ + /* when opening the FT_Face. */ + /* */ + /* - FreeType detects that the FT_Face corresponds to one of the */ + /* `trick' fonts (e.g., `Mingliu') it knows about. The font engine */ + /* contains a hard-coded list of font names and other matching */ + /* parameters (see function `tt_face_init' in file */ + /* `src/truetype/ttobjs.c'). */ + /* */ + /* Here a sample code snippet for using FT_PARAM_TAG_UNPATENTED_HINTING. */ + /* */ + /* { */ + /* FT_Parameter parameter; */ + /* FT_Open_Args open_args; */ + /* */ + /* */ + /* parameter.tag = FT_PARAM_TAG_UNPATENTED_HINTING; */ + /* */ + /* open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; */ + /* open_args.pathname = my_font_pathname; */ + /* open_args.num_params = 1; */ + /* open_args.params = ¶meter; */ + /* */ + /* error = FT_Open_Face( library, &open_args, index, &face ); */ + /* ... */ + /* } */ + /* */ #define TT_CONFIG_OPTION_UNPATENTED_HINTING @@ -591,6 +628,11 @@ /* */ #define AF_CONFIG_OPTION_CJK + /*************************************************************************/ + /* */ + /* Compile autofit module with Indic script support. */ + /* */ +#define AF_CONFIG_OPTION_INDIC /* */ Modified: haiku/trunk/headers/libs/freetype2/freetype/config/ftstdlib.h =================================================================== --- haiku/trunk/headers/libs/freetype2/freetype/config/ftstdlib.h 2007-08-09 21:12:30 UTC (rev 21878) +++ haiku/trunk/headers/libs/freetype2/freetype/config/ftstdlib.h 2007-08-09 21:33:28 UTC (rev 21879) @@ -78,15 +78,6 @@ /**********************************************************************/ -#include - -#define ft_isalnum isalnum -#define ft_isdigit isdigit -#define ft_islower islower -#define ft_isupper isupper -#define ft_isxdigit isxdigit - - #include #define ft_memchr memchr Modified: haiku/trunk/headers/libs/freetype2/freetype/freetype.h =================================================================== --- haiku/trunk/headers/libs/freetype2/freetype/freetype.h 2007-08-09 21:12:30 UTC (rev 21878) +++ haiku/trunk/headers/libs/freetype2/freetype/freetype.h 2007-08-09 21:33:28 UTC (rev 21879) @@ -648,8 +648,8 @@ { FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ), - FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ), - FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ), + FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ), + FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ), FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ), FT_ENC_TAG( FT_ENCODING_GB2312, 'g', 'b', ' ', ' ' ), @@ -2111,9 +2111,16 @@ /* FreeType error code. 0 means success. */ /* */ /* */ + /* If either the character width or height is zero, it is set equal */ + /* to the other value. */ + /* */ /* If either the horizontal or vertical resolution is zero, it is set */ - /* to a default value of 72dpi. */ + /* equal to the other value. */ /* */ + /* A character width or height smaller than 1pt is set to 1pt; if */ + /* both resolution values are zero, they are set to 72dpi. */ + /* */ + FT_EXPORT( FT_Error ) FT_Set_Char_Size( FT_Face face, FT_F26Dot6 char_width, @@ -2731,8 +2738,7 @@ /* */ /* */ /* Retrieve the ASCII name of a given glyph in a face. This only */ - /* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns */ - /* TRUE. */ + /* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns 1. */ /* */ /*