?? vxw_pt5.html
字號:
Q: When I load a page from this server it takes a lot of time to load allthe items on this page. How can I increase the speed?<p>A: Use more than 1 HTTP deamon for multiple HTTP request.You were overloading your HTTP deamon before.<pre>#define HTTP_NR_OF_TASKS 1</pre>Change this macro in your httpconf.c file.<br>(From: Computer Engineer, engineer4computer@netscape.net)<p><hr WIDTH="50%"><a NAME="5.11-B"></a><p>Q: A page loads good with Netscape, but IE seems to hang on an applet. Whendownloading using a different server everything goes OK.<p>A: Actually it is the same solution as on the previous question.The problem is, that IE loads the applets with another socketconnection simultaneously to the rest of the page and since theWindWebServer is by default single tasked, it locks up. Setting<pre>#define HTTP_NR_OF_TASKS 2</pre>and the applets load on IE and NS as well.<br>(From: Andreas Vorgeitz, Andreas.Vorgeitz@de.bosch.com)<p><hr WIDTH="60%"><p><h3><a NAME="5.12"><center>5.12 Zinc/windML related items</center></a></h3><a NAME="5.12-A"></a>Q: How can I get the current cursor position?<p>A: The basic idea is to create input queues and attach them to the device.Then check the queue for a combination of conditions to see if the mouse hasmoved.<ol><li>Create Input Driver for mouse using either:<ul><li>ugl8250MsMouseDevCreate - assuming you have a MS serial mouse., or</li><li>uglPs2MouseDevCreate.</li></ul>Here you will specify the queue and interrupt number related to the mouse andalso port address.</li><li>call uglInputQEventGet to check for any new events...this can be in a lowpriority task.The elements in the queue will be in a structure of type UGL_INPUT_EVENT. Youneed to extractthe x,y and 'id' from it.</li></ol>More details with examples are in the Zinc manual.<br>(From: Vijay Kumar Peshkar, vpeshkar@cisco.com)<p><hr WIDTH="50%"><a NAME="5.12-B"></a><p>Q: Are there any alternatives to Zinc?<p>A: There were several discussion a few months back about this. You couldtry "groups.google.com" to look for them. Here are some links,<ul><li><A HREF="http://www.microwindows.org/">http://www.microwindows.org/</A></li><li><A HREF="http://www.panelsoft.com/uihwsw.htm">http://www.panelsoft.com/uihwsw.htm</A></li><li><A HREF="http://www.swellsoftware.com/index.shtml">http://www.swellsoftware.com/index.shtml</A></li></ul>If you want a small gui that works out of the box with vxWorks, thenyou can code with WindML itself. This use to be called UGL. It iscertainly capable of making a useful small screen GUI. Many featuresof Zinc really aren't needed for many products IMHO. Zinc is nice inallowing GUI development natively on a workstation or PC.<br>WindML is your best choice if you don't wish to port things.Microwindows might be a good choice if you have the time to portthings.<br>(From: Bill Pringlemeir, bpringlemeir@yahoo.com)<p><hr WIDTH="50%"><a NAME="5.12-C"></a><p>Q: How can I avoid that a combobox blocks input to a editbox?<p>A: If keyboardGrabId is NULL, then use the winRootGet() member to sendthe keys to. While using Zinc 6.0, a combobox on the screen wouldcause edit boxes to stop receiving keyboard input.<br>Using the following patch will solve this.<br>In WindML 2.0 $(WIND_BASE)/src/ugl/win/winroute.c,<pre>[start patch]--- winroute2.c Wed Aug 15 14:16:12 2001+++ winroute.c Wed Aug 15 14:15:51 2001@@ -137,6 +137,9 @@ { UGL_WINDOW_ID keyboardGrabId = winKeyboardGrabGet (eventRouterId);+ if (keyboardGrabId == UGL_NULL_ID)+ keyboardGrabId = winRootGet (eventRouterId);+ if (keyboardGrabId != UGL_NULL_ID) { pInputEvent->header.objectId = keyboardGrabId;[end patch]</pre><br>(From: Bill Pringlemeir, bpringlemeir@yahoo.com)<p><hr WIDTH="50%"><a NAME="5.12-D"></a><p>Q: How can I save and restore the contents of the screen?<p>A: This works for me [change SCREEN_BASE define to match your video memory],<pre>#include <VxWorks.h>#include <config.h>#include <stdlib.h>#include <stdio.h>#include <stddef.h>#include <string.h>#define SCREEN_BASE 0xc0000000#define WIDTH 640#define HEIGHT 480void screenDump(unsigned char *name){ FILE *fp; if(name == NULL || name[0] == 0) name = "screen.out"; fp = fopen(name,"w+"); fwrite((char*)SCREEN_BASE, sizeof(char),WIDTH*HEIGHT*4,fp); fclose(fp);}void screenPump(unsigned char *name){ FILE *fp; if(name == NULL || name[0] == 0) name = "screen.out"; fp = fopen(name,"r"); fread((char*)SCREEN_BASE, sizeof(char),WIDTH*HEIGHT*4,fp); fclose(fp);}</pre>I call these from the shell.<br>(From: Bill Pringlemeir, bpringlemeir@yahoo.com)<p><hr WIDTH="50%"><a NAME="5.12-E"></a><p>Q: How can I use a telephone-like keypad to enter alphanumerics?<p>A: For the most part WRS/Zinc seem to assume an `embedded PC' with101 keyboard, mouse and VGA.<br>I had the same problem and concluded that the Zinc layer was the bestplace to do this. I have some experience with hand helds, PDA andhave used different cell phones. The best way is to enable the`key value' cycling when you are in the ZafFormatString class/guielement. The format string specifies whether the keyboard entry isgoing to be numeric, alpha, alphanumeric, etc. I have modified thefile "src/zinc/generic/i_fmtstr.cpp"; specifically the Event()functions (especially E_KEY case (i hope you guessed that)).<pre> case E_KEY: { static const char special[30] = { '$', '%', '.', ',', '?', '!', '+', '-', '*', '=', '^', '#', </pre>[snip, pressing zero several times allows punctuation.]<pre> static const char decode[10][8] = { {'0', ' ', '~'}, {'1', 'q', 'z', 'Q', 'Z'}, {'2', 'a', 'b', 'c', 'A', 'B', 'C'},</pre>[snip, describes cycling sequence]<pre> // Search for legal characters. ZafIChar tChar = event.key.value; bool stepForward = true; /* move cursor forward */ // If special key, overwrite previous value (space). if('~' == lastKeyValue) { for(int i = 0; i < sizeof(special); i++)</pre>[snip]<pre> // Check to see if we should not repeat a value. if(tChar != lastKeyValue) { if(D_ON == zKeyTimer->Event(ZafEventStruct(D_STATE))) { zKeyTimer->Event(ZafEventStruct(D_OFF)); MoveCursor(L_RIGHT);</pre>[snip...<br>ok, this is somewhat ugly. I did this under time pressure as always.Run through the `decode' array and look for two possible charactersfrom IsLegalChar() virtual (or callback) function. If two are foundand then we cycle through the values. Don't move the cursor forwardand set a timer to move the cursor when that happens... ]<pre> // Cycle through keys. if(tChar >= '0' && tChar <= '9') { const char *p = &decode[tChar - '0'][0]; int i = curKeyIndex; do { if(IsLegalChar(p[i], cursor)) { tChar = p[i]; // multiple key values for this key? for(int j = i + 1; i != j; j = (j+1) %8) { if(IsLegalChar(p[j], cursor)) { stepForward = false; curKeyIndex = j; lastCursor = cursor; break; } } break; } i = (i+1) % 8; } while(i != curKeyIndex); } if(tChar == '~') {</pre>[snip, if zero is pressed several times bring up the ZafStringEditorclass. I have totatlly re-written this as well...]<pre> ZafStringEditor *stringEditor = new ZafStringEditor; stringEditor->SetRequestor(this); } else if (IsLegalChar(tChar, cursor)) { ZafEventStruct tEvent = event; tEvent.key.value = tChar; ZafUpdateType updateType = stringData->Update(); stringData->SetUpdate(ZAF_UPDATE_NONE); stringData->Replace(cursor, 1, &tChar, 1); stringData->SetUpdate(updateType);</pre>[only move forward if this is no possible cycling...]<pre> if(stepForward) { MoveCursor(L_RIGHT); // Reset cycle code. lastKeyValue = 0; curKeyIndex = 0; } else { // Restart timer... zKeyTimer->Event(ZafEventStruct(D_INITIALIZE)); zKeyTimer->Event(ZafEventStruct(D_ON)); }</pre>[...]<p>You must modify this for your application. I suggest that you gettogether with someone who knows your market and customize the UI to best fityour customers needs. This could be a key (*bad pun*) part of theproduct. Depending on your market, you may need some characters like"accente` gui`" [excuse my French] or other odd characters.<br>One strength of Zinc is that you can over-ride the behaviour of aclass to fit your UI requirements; especially over plan vanillaWindML. A weakness is the resource overhead.<br>(From: Bill Pringlemeir, bpringlemeir@yahoo.com)<p><hr WIDTH="50%"><a NAME="5.12-F"></a><p>OpenGL programs running under VxWorks<p>I've written a layer between UGL/WindML and Mesa so now one can runOpenGL applications on VxWorks 5.4/UGL 2.0. This layer opens the doorsof the embedded systems space to 3D graphics.<br>I've been inspired by xmesa sources thus I've used a similar design I'vealso ported some demos to WindML from GLUT for testing.<br>Wind River Systems gave his consent to release my work under MIT License.Thus many students and companies will be able to use Mesa on VxWorks.<br>The code is available for download from:<A HREF="http://sourceforge.net/projects/mesa3d">http://sourceforge.net/projects/mesa3d</A><br>(From: Stephane Raimbault, stephane.raimbault@deesse.univ-lemans.fr)<p><hr WIDTH="60%"><p><h3><a NAME="5.13"><center>5.13 Other items</center></a></h3><a NAME="5.13-A"></a>Q: How can I decode the error numbers?<p>A: VxWorks errnos are divided into two parts. The high 16 bits specify amodule number in which the error occurred, and the low 16 bits contain themodule-specific error code.<br>To identify the module, look in $WIND_BASE/target/h/vwModNum.h. Thebeginning of the list looks like this:<pre>/* module numbers - DO NOT CHANGE NUMBERS! Add or delete only! */#define M_errno (0 << 16) /* THIS MUST BE ZERO! */#define M_kernel (1 << 16)#define M_taskLib (3 << 16)#define M_dbgLib (4 << 16)</pre>So for example if the errno is 0x320001, we look for module 50 (0x32 = 50)and find:<pre>#define M_hostLib (50 << 16)</pre>So the error occurred in hostLib. The header file for hostLib is ofcourse hostLib.h, so we look there for the hostLib-specific error codes, andfind:<pre>/* status messages */#define S_hostLib_UNKNOWN_HOST (M_hostLib | 1)</pre>So error code 0x320001 is an Unknown Host error from hostLib!<br>(From: Dave Korn)<p><hr WIDTH="50%"><a NAME="5.13-B"></a><p>Q: How can I have a task that causes an (bus)error to continue afterthis occurs?<p>A: Take a look at this demo-code: <a href="sigVecDemo.c">sigVecDemo.c</a>.<br>(From: Albert H Chen, albertchen@directvinternet.com)<p><hr WIDTH="50%"><a NAME="5.13-C"></a><p>Q: How can I use compression in my application?<p>A: You can use the inflateLib as it is provided with VxWorks. Anotherpossibility is to use zLib. Get the source from<a href="http://www.gzip.org/zlib/">http://www.gzip.org/zlib/</a> or<a href="http://www.info-zip.org/pub/infozip/zlib/">http://www.info-zip.org/pub/infozip/zlib/</a>.It should compile easily for vxWorks. This package is more flexibleas you can handle gzip files.<pre># makefile.CPU = ?? Your CPU ??TOOL = gnuEXTRA_DEFINE = -WcommentMKDIR = mkdirTGT_DIR = $(WIND_BASE)/targetOBJS= adler32.o compress.o crc32.o deflate.o gzio.o infblock.o infcodes.o \ inffast.o inflate.o inftrees.o infutil.o trees.o uncompr.o zutil.oall : ($OBJS)include $(TGT_DIR)/h/make/defs.bspinclude $(TGT_DIR)/h/make/make.$(CPU)$(TOOL)include $(TGT_DIR)/h/make/defs.$(WIND_HOST_TYPE)## Allow C++ sytle comments (tell Pre-processor).ADDED_CFLAGS += -Wp,-lang-cADDED_CFLAGS += -DVXWORKS=1ADDED_CFLAGS += -Wall -Winline -O2 -fomit-frame-pointer -fno-strength-reduceADDED_CFLAGS += -DNO_DEFLATE=1</pre>The functions in gzio.o are nice. I don't think you have to modify anyof the source.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -