Changeset 18 in Main
- Timestamp:
- 26/11/2011 09:26:12 (18 months ago)
- Location:
- src/fake_app_server
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/fake_app_server/App.cpp
r16 r18 12 12 if (LoadTopology("topology.txt") != B_OK) 13 13 { 14 status = B_ERROR; 14 15 } 15 16 // TODO: create framebuffers and windows to display them … … 33 34 // connected(0/1) : number of resolutions : default / current resolution index : widthxheightxbpp@refresh : ... <-- one for each head 34 35 file.getline(rawline, 1024); 35 line = rawline; 36 // TODO: fix this if statement (skips any line that has a '#' in it, regardless of location) 37 if (line.FindFirst("#") != B_ERROR) 36 // TODO: implement a Trim function 37 if (rawline[0] == '#' || rawline[0] == '\n') 38 38 { 39 39 continue; 40 40 } 41 // get everything up to the first ':' 42 BString temp(""); 41 line = rawline; 42 BString temp; 43 uint32 slotnum; 43 44 line.MoveInto(temp, 0, line.FindFirst(":")); 44 45 line.RemoveFirst(":"); 46 slotnum = atoi(temp.String()); 47 cout<<"slotnum: "<<slotnum<<endl; 48 line.MoveInto(temp, 0, line.FindFirst(":")); 49 line.RemoveFirst(":"); 50 Devices[slotnum].HeadCount = atoi(temp.String()); 51 cout<<"headcount: "<<Devices[slotnum].HeadCount<<endl; 52 Devices[slotnum].Heads = new Head[Devices[slotnum].HeadCount]; 53 Devices[slotnum].DeviceID = line; 54 cout<<"deviceid: "<<Devices[slotnum].DeviceID<<endl; 55 for(int a = 0 ; a < Devices[slotnum].HeadCount ; a++) 56 { 57 do 58 { 59 file.getline(rawline, 1024); 60 } while (rawline[0] == '#' || rawline[0] == '\n'); 61 line = rawline; 62 line.MoveInto(temp, 0, line.FindFirst(":")); 63 line.RemoveFirst(":"); 64 if (atoi(temp.String()) == 0) 65 { 66 Devices[slotnum].Heads[a].Connected = false; 67 } 68 else 69 { 70 Devices[slotnum].Heads[a].Connected = true; 71 } 72 cout<<"connected: "<<Devices[slotnum].Heads[a].Connected<<endl; 73 line.MoveInto(temp, 0, line.FindFirst(":")); 74 line.RemoveFirst(":"); 75 Devices[slotnum].Heads[a].ResolutionCount = atoi(temp.String()); 76 cout<<"rescount: "<<Devices[slotnum].Heads[a].ResolutionCount<<endl; 77 Devices[slotnum].Heads[a].Resolutions = new Resolution[Devices[slotnum].Heads[a].ResolutionCount]; 78 line.MoveInto(temp, 0, line.FindFirst(":")); 79 line.RemoveFirst(":"); 80 Devices[slotnum].Heads[a].CurrentResolution = atoi(temp.String()); 81 cout<<"current: "<<Devices[slotnum].Heads[a].CurrentResolution<<endl; 82 for (int b = 0; b < Devices[slotnum].Heads[a].ResolutionCount; b++) 83 { 84 if (line.FindFirst(":") != B_ERROR) 85 { 86 line.MoveInto(temp, 0, line.FindFirst(":")); 87 line.RemoveFirst(":"); 88 } 89 else 90 { 91 temp = line; 92 } 93 BString temp2; 94 temp.MoveInto(temp2, 0, line.FindFirst("x")); 95 temp.RemoveFirst("x"); 96 Devices[slotnum].Heads[a].Resolutions[b].Width = atoi(temp2.String()); 97 temp.MoveInto(temp2, 0, line.FindFirst("x")); 98 temp.RemoveFirst("x"); 99 Devices[slotnum].Heads[a].Resolutions[b].Height = atoi(temp2.String()); 100 temp.MoveInto(temp2, 0, line.FindFirst("@")); 101 temp.RemoveFirst("@"); 102 Devices[slotnum].Heads[a].Resolutions[b].BPP = atoi(temp2.String()); 103 Devices[slotnum].Heads[a].Resolutions[b].Refresh = atoi(temp.String()); 104 } 105 } 45 106 } 107 } 108 else 109 { 110 // File not found 111 return B_ERROR; 46 112 } 47 113 return B_OK; 48 114 } 115 116 status_t 117 App::Status() 118 { 119 return status; 120 } -
src/fake_app_server/App.h
r17 r18 15 15 #include <iostream> 16 16 #include <fstream> 17 #include <stdlib.h> 18 19 #define MAX_SLOTS 8 17 20 18 21 … … 30 33 bool Connected; 31 34 uint32 ResolutionCount; 32 Resolution* ResolutionList; 35 uint32 CurrentResolution; 36 Resolution* Resolutions; 33 37 }; 34 38 … … 36 40 struct Device 37 41 { 38 uint32 Slot;39 42 uint32 HeadCount; 40 43 BString DeviceID; 41 Head Data* Heads;44 Head* Heads; 42 45 }; 43 46 … … 46 49 public: 47 50 App(void); 51 status_t Status(); 48 52 49 53 private: 50 54 status_t LoadTopology(BString); 51 Device* Devices; 55 Device Devices[MAX_SLOTS]; 56 status_t status; 52 57 }; 53 58 -
src/fake_app_server/main.cpp
r14 r18 15 15 { 16 16 App* app = new App(); 17 app->Run(); 17 if (app->Status() == B_OK) 18 { 19 app->Run(); 20 } 18 21 /* 19 22 // TODO: PUT THIS IN ANOTHER THREAD (probably from within App)
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)