Changeset 27 in Main
- Timestamp:
- 28/11/2011 06:13:31 (18 months ago)
- Location:
- src
- Files:
-
- 9 added
- 6 edited
-
gfx_server/App.cpp (modified) (2 diffs)
-
gfx_server/App.h (modified) (2 diffs)
-
test_client (added)
-
test_client/(Objects.test_client) (added)
-
test_client/Drafter.h (added)
-
test_client/Makefile (added)
-
test_client/main.cpp (added)
-
test_client/objects.x86-gcc2-release (added)
-
test_client/objects.x86-gcc2-release/main.d (added)
-
test_client/objects.x86-gcc2-release/test_client (added)
-
test_client/test_client.pld (added)
-
test_lib/Drafter.h (modified) (3 diffs)
-
test_lib/DrafterPrivateDefs.h (modified) (2 diffs)
-
test_lib/context.cpp (modified) (5 diffs)
-
test_lib/lib3DStack.pld (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/gfx_server/App.cpp
r26 r27 28 28 HeadList = new Head*[HeadCount]; 29 29 headindex = 0; 30 ContextNum = 0; 30 31 } 31 32 … … 176 177 { 177 178 QuitRequested(); 179 break; 178 180 } 179 case GFX_CREATE_CONTEXT:181 case D_CREATE_CONTEXT: 180 182 { 181 183 cout<<"Context creation request received"<<endl; 184 // respond... 185 BMessage* m = new BMessage(D_REPLY); 186 m->AddInt32("contextid", (int32)ContextNum); 187 message->SendReply(m); 188 ContextNum++; 189 break; 182 190 } 183 191 } -
src/gfx_server/App.h
r25 r27 24 24 #define MAX_SLOTS 8 25 25 26 #define D_CREATE_CONTEXT 'dcct' 27 #define D_REPLY 'drep' 28 26 29 class App : public BApplication { 27 30 public: … … 41 44 Head** HeadList; 42 45 thread_id ConsoleID; 46 uint32 ContextNum; 43 47 }; 44 48 -
src/test_lib/Drafter.h
r8 r27 7 7 8 8 #include <SupportDefs.h> 9 9 #include <Messenger.h> 10 10 11 11 // CONSTANTS ///////////////////////////// … … 16 16 #define D_ERR_NO_CONTEXT_AVAILABLE 0xFFFFFFFF 17 17 #define D_ERR_BAD_CONTEXT_ID 1 18 19 #define D_CREATE_CONTEXT 'dcct' 20 #define D_REPLY 'drep' 18 21 19 22 // FUNCTIONS ///////////////////////////// … … 28 31 29 32 // LOCAL VARIABLES /////////////////////// 30 uint32 current_context ;31 33 uint32 current_context = 0xdeadbeef; 34 BMessenger* server_msgr = NULL; 32 35 33 36 #endif // DRAFTER_H -
src/test_lib/DrafterPrivateDefs.h
r8 r27 16 16 #ifdef __HAIKU__ 17 17 18 static area_id context_area = B_ERROR; // invalid default19 static char* context_addr = NULL;18 //static area_id context_area = B_ERROR; // invalid default 19 //static char* context_addr = NULL; 20 20 21 21 #define CONTEXT_AREA_NAME "Drafter Context Area" … … 44 44 }; 45 45 46 static ContextData* contexts;47 static uint32* contextCount;46 //static ContextData* contexts; 47 //static uint32* contextCount; 48 48 49 49 -
src/test_lib/context.cpp
r8 r27 9 9 #include <iostream> 10 10 11 using namespace std; 12 11 13 // TODO: add parameters like width, height, team id, workspace, etc 12 14 uint32 13 15 CreateContext() 14 16 { 15 #ifdef __HAIKU__ 16 // set sizes etc 17 uint32 size = sizeof(ContextData) * DRAFTER_MAX_CONTEXTS + sizeof(uint32); 18 if (size > B_PAGE_SIZE) 17 // get a messenger for the gfx_server 18 status_t error; 19 if (server_msgr == NULL) 19 20 { 20 //panic("Drafter context area size larger than page size\n"); 21 cout<<"Context area size larger than page size"<<endl; 22 return D_ERR_NO_CONTEXT_AVAILABLE; 23 } 24 25 // check if we already know about an existing area 26 if (context_area == B_ERROR) 27 { 28 char* temp_addr = NULL; 29 // check if an area already exists 30 area_id temp_area = find_area(CONTEXT_AREA_NAME); 31 // if not, create one, then clone it 32 if (temp_area == B_NAME_NOT_FOUND) 21 server_msgr = new BMessenger("application/x-vnd.Drafter-gfx-server", -1, &error); 22 if (error != B_OK) 33 23 { 34 // create a new area 35 temp_area = create_area(CONTEXT_AREA_NAME, &(void*)temp_addr, B_ANY_ADDRESS, B_PAGE_SIZE, B_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA); 36 cout<<"Creating Area: "<<temp_area<<endl; 37 } 38 // clone the area 39 context_area = clone_area(CONTEXT_AREA_CLONE_NAME, &(void*)context_addr, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, temp_area); 40 // increment usage counter 41 if (context_area < B_OK) 42 { 43 cout<<"Cannot clone area"<<endl; 44 return D_ERR_NO_CONTEXT_AVAILABLE; 45 } 46 contexts = (ContextData*)context_addr; 47 contextCount = (uint32*)context_addr + sizeof(ContextData) * DRAFTER_MAX_CONTEXTS; 48 *contextCount++; 49 } 50 #endif 51 // TODO: add locking 52 bool foundcontext = false; 53 int a; 54 for (a = 0; a < DRAFTER_MAX_CONTEXTS; a++) 55 { 56 if ((contexts[a].flags & DRAFTER_CONTEXT_USED) == 0) 57 { 58 // use this context! 59 contexts[a].flags |= DRAFTER_CONTEXT_USED; 60 foundcontext = true; 61 break; 24 return 0xdeadbeef; 62 25 } 63 26 } 64 if (foundcontext == false) 65 { 66 a = D_ERR_NO_CONTEXT_AVAILABLE; 67 } 68 return a; 27 // TODO: send a request for a new context 28 BMessage request(D_CREATE_CONTEXT); 29 BMessage reply; 30 //BMessage* reply = new BMessage(D_REPLY); 31 server_msgr->SendMessage(&request, &reply); 32 33 // TODO: retrieve the resuls 34 uint32 contextnum; 35 reply.FindInt32("contextid", 0, &((int32)contextnum)); 36 cout<<"Context returned: "<< contextnum << endl; 37 return contextnum; 69 38 } 70 39 … … 72 41 SwitchContext(uint32 context) 73 42 { 43 /* 74 44 if (context < DRAFTER_MAX_CONTEXTS) 75 45 { … … 81 51 } 82 52 return D_ERR_BAD_CONTEXT_ID; 53 */ 54 return 0; 83 55 } 84 56 … … 88 60 // TODO: add locking 89 61 // TODO: check the teamID too 90 if (context < DRAFTER_MAX_CONTEXTS)62 /* if (context < DRAFTER_MAX_CONTEXTS) 91 63 { 92 64 if (contexts[context].flags & DRAFTER_CONTEXT_USED) … … 97 69 } 98 70 return D_ERR_BAD_CONTEXT_ID; 71 */ 72 return 0; 99 73 } -
src/test_lib/lib3DStack.pld
r8 r27 7 7 SOURCEFILE=context.cpp 8 8 DEPENDENCY=/boot/home/Desktop/My Sources/lib3DStack/Drafter.h|/boot/home/Desktop/My Sources/lib3DStack/DrafterPrivateDefs.h 9 LOCALINCLUDE=10 9 SYSTEMINCLUDE=/boot/develop/headers/be 11 10 SYSTEMINCLUDE=/boot/develop/headers/cpp
Note: See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](http://pulkomandy.lexinfo.fr/projects/haiku3daccel/export/24/Main/artwork/Drafter%20Logo.png)