Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

Terminal.c

Go to the documentation of this file.
00001 /*
00002  *    gui - [gega user interface] the flexible solution for user interface problems
00003  *    Copyright (C) 2002  Gergely Gati
00004  *
00005  *    This program is free software; you can redistribute it and/or modify
00006  *    it under the terms of the GNU General Public License as published by
00007  *    the Free Software Foundation; version 2 of the License.
00008  *
00009  *    This program is distributed in the hope that it will be useful,
00010  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *    GNU General Public License for more details.
00013  *
00014  *    You should have received a copy of the GNU General Public License
00015  *    along with this program; if not, write to the Free Software
00016  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  *
00018  *    Gergely Gati
00019  *      email:           g.gati@freemail.hu
00020  *      AIM screenname:  GatiGergely
00021  *      ICQ number:      93131690
00022  *
00023  */
00024 /* Terminal.c */
00025 
00026 #include "debug.h"
00027 #include "types.h"
00028 #include "Bases.h"
00029 #include "Memory.h"
00030 #include "Terminal.h"
00031 #include "Glw.h"
00032 #include "Endian.h"
00033 #include "Marshal.h"
00034 
00035 
00036 //Declare call_vector[]
00037 static u32 (*call_vector[TERM_FUNC_DONE-TERM_FUNCBASE+1])(tag *);
00038 
00039 
00041 inline static u32 term_RpcCallA(u32 conn, u16 code, tag *taglist)
00042 {
00043   u32 ret=~0L;
00044   int mlen;
00045   u8 *msg,*m;
00046 
00047   debug_Begin();
00048 
00049   if(GLW_ENDIAN==glw_GetTerminalByteOrder(conn))
00050   {
00051     mlen=marshal_GetTaglistMsgLen(taglist)+4;
00052     if(NULL!=(msg=mem_malloc(mlen)))
00053     {
00054       m=msg+2;
00055       (*(u16 *)m)=endian_ToAlien16(code);
00056       m+=2;
00057       marshal_PutTaglistC(m,taglist);
00058       ret=glw_SendTerm(conn,msg+2,mlen-2);
00059       mem_free(msg);
00060     }
00061   }
00062   else
00063   {
00064     mlen=marshal_GetTaglistMsgLen(taglist)+4;
00065     if(NULL!=(msg=mem_malloc(mlen)))
00066     {
00067       m=msg+2;
00068       *((u16 *)m)=code;
00069       m+=2;
00070       marshal_PutTaglist(m,taglist);
00071       ret=glw_SendTerm(conn,msg+2,mlen-2);
00072       mem_free(msg);
00073     }
00074   }
00075 
00076   debug_End();
00077 
00078   return(ret);
00079 }
00080 
00081 
00083 inline static u32 term_RpcCallR(u32 conn, u16 code, tag *taglist)
00084 {
00085   u32 ret=~0L;
00086   int mlen;
00087   u8 *msg,*m;
00088   u8 buff[4];
00089 
00090   debug_Begin();
00091 
00092   if(GLW_ENDIAN==glw_GetTerminalByteOrder(conn))
00093   {
00094     mlen=marshal_GetTaglistMsgLen(taglist)+4;
00095     if(NULL!=(msg=mem_malloc(mlen)))
00096     {
00097       m=msg+2;
00098       *((u16 *)m)=code;
00099       m+=2;
00100       marshal_PutTaglist(m,taglist);
00101       glw_SendTerm(conn,msg+2,mlen-2);
00102       mem_free(msg);
00103       glw_ReadTerm(conn,buff,4);
00104       ret=*((u32 *)buff);
00105     }
00106   }
00107   else
00108   {
00109     mlen=marshal_GetTaglistMsgLen(taglist)+4;
00110     if(NULL!=(msg=mem_malloc(mlen)))
00111     {
00112       m=msg+2;
00113       *((u16 *)m)=endian_ToAlien16(code);
00114       m+=2;
00115       marshal_PutTaglistC(m,taglist);
00116       glw_SendTerm(conn,msg+2,mlen-2);
00117       mem_free(msg);
00118       glw_ReadTerm(conn,buff,4);
00119       ret=endian_FromAlien32(*((u32 *)buff));
00120     }
00121   }
00122 
00123   debug_End();
00124 
00125   return(ret);
00126 }
00127 
00128 
00130 inline static u32 term_RpcCallT(u32 conn, u16 code, tag *taglist)
00131 {
00132   u32 ret=~0L;
00133   int mlen;
00134   u8 *msg,*m;
00135   tag *newtaglist=NULL,*tags,*mod;
00136 
00137   debug_Begin();
00138 
00139   if(GLW_ENDIAN==glw_GetTerminalByteOrder(conn))
00140   {
00141     mlen=marshal_GetTaglistMsgLen(taglist)+4;
00142     if(NULL!=(msg=mem_malloc(mlen)))
00143     {
00144       m=msg+2;
00145       *((u16 *)m)=code;
00146       m+=2;
00147       marshal_PutTaglist(m,taglist);
00148       glw_SendTerm(conn,msg+2,mlen-2);
00149       glw_ReadTerm(conn,msg,mlen-4);
00150       newtaglist=marshal_GetTaglist(&msg);
00151       mem_free(msg);
00152     }
00153   }
00154   else
00155   {
00156     mlen=marshal_GetTaglistMsgLen(taglist)+4;
00157     if(NULL!=(msg=mem_malloc(mlen)))
00158     {
00159       m=msg+2;
00160       *((u16 *)m)=endian_ToAlien16(code);
00161       m+=2;
00162       marshal_PutTaglistC(m,taglist);
00163       glw_SendTerm(conn,msg+2,mlen-2);
00164       glw_ReadTerm(conn,msg,mlen-4);
00165       newtaglist=marshal_GetTaglistC(&msg);
00166       mem_free(msg);
00167     }
00168   }
00169   if(newtaglist!=NULL)
00170   {
00171     ret=0L;
00172     for(tags=newtaglist;tags->Name!=TAG_DONE;tags=tag_GetNextTag(tags))
00173     {
00174       if(NULL!=(mod=tag_FindTag(taglist,tags->Name)))
00175       {
00176         if((tags->Name&TAGT_RECT)!=0)
00177         {
00178           memcpy(((Rect_t *)mod->Data),((Rect_t *)tags->Data),sizeof(Rect_t));
00179         }
00180         else if((tags->Name&TAGT_STRING)!=0||(tags->Name&TAGT_VECTOR)!=0||(tags->Name&TAGT_PIXELS)!=0)
00181         {
00182           mod->Data=0L;
00183           debug_Warning("Strings and binaries are don't copied back");
00184         }
00185         else mod->Data=tags->Data;
00186       }
00187     }
00188   }
00189   marshal_FreeTaglist(newtaglist);
00190 
00191   debug_End();
00192 
00193   return(ret);
00194 }
00195 
00196 
00198 inline static u32 term_RpcCall(u32 conn, u16 code, tag *taglist)
00199 {
00200   u32 ret=~0L;
00201 
00202   debug_Begin();
00203 
00204   if(code!=RPC_INVALID&&conn!=0L&&taglist!=NULL)
00205   {
00206     if((code&RPCF_RETVAL)!=0) ret=term_RpcCallR(conn,code,taglist);
00207     else if((code&RPCF_TAGLIST)!=0) ret=term_RpcCallT(conn,code,taglist);
00208     else ret=term_RpcCallA(conn,code,taglist);
00209   }
00210   else debug_Error("Invalid parameter");
00211 
00212   debug_End();
00213 
00214   return(ret);
00215 }
00216 
00217 
00219 
00220 
00224 u32 term_StartMouseTracking(u32 firsttag, ...)
00225 {
00226   return(term_StartMouseTrackingTL((tag *)&firsttag));
00227 }
00228 u32 term_StartMouseTrackingTL(tag *taglist)
00229 {
00230   u32 window;
00231   u32 ret=~0L;
00232 
00233   debug_Begin();
00234 
00235   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00236   if(window!=0L)
00237   {
00238     ret=term_RpcCall(glw_GetConnection(window),RPC_STARTMOUSETRACKING,taglist);
00239   }
00240 
00241   debug_End();
00242 
00243   return(ret);
00244 }
00245 
00246 
00250 u32 term_StopMouseTracking(u32 firsttag, ...)
00251 {
00252   return(term_StopMouseTrackingTL((tag *)&firsttag));
00253 }
00254 u32 term_StopMouseTrackingTL(tag *taglist)
00255 {
00256   u32 window;
00257   u32 ret=~0L;
00258 
00259   debug_Begin();
00260 
00261   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00262   if(window!=0L)
00263   {
00264     ret=term_RpcCall(glw_GetConnection(window),RPC_STOPMOUSETRACKING,taglist);
00265   }
00266 
00267   debug_End();
00268 
00269   return(ret);
00270 }
00271 
00272 
00276 u32 term_DragWindow(u32 firsttag, ...)
00277 {
00278   return(term_DragWindowTL((tag *)&firsttag));
00279 }
00280 u32 term_DragWindowTL(tag *taglist)
00281 {
00282   u32 window;
00283   u32 ret=~0L;
00284 
00285   debug_Begin();
00286 
00287   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00288   if(window!=0L)
00289   {
00290     ret=term_RpcCall(glw_GetConnection(window),RPC_DRAGWINDOW,taglist);
00291   }
00292 
00293   debug_End();
00294 
00295   return(ret);
00296 }
00297 
00298 
00303 u32 term_ResizeWindow(u32 firsttag, ...)
00304 {
00305   return(term_ResizeWindowTL((tag *)&firsttag));
00306 }
00307 u32 term_ResizeWindowTL(tag *taglist)
00308 {
00309   u32 window;
00310   u32 ret=~0L;
00311 
00312   debug_Begin();
00313 
00314   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00315   if(window!=0L)
00316   {
00317     ret=term_RpcCall(glw_GetConnection(window),RPC_RESIZEWINDOW,taglist);
00318   }
00319 
00320   debug_End();
00321 
00322   return(ret);
00323 }
00324 
00325 
00330 u32 term_SetColor(u32 firsttag, ...)
00331 {
00332   return(term_SetColorTL((tag *)&firsttag));
00333 }
00334 u32 term_SetColorTL(tag *taglist)
00335 {
00336   u32 window;
00337   u32 ret=~0L;
00338 
00339   debug_Begin();
00340 
00341   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00342   if(window!=0L)
00343   {
00344     ret=term_RpcCall(glw_GetConnection(window),RPC_SETCOLOR,taglist);
00345   }
00346 
00347   debug_End();
00348 
00349   return(ret);
00350 }
00351 
00352 
00357 u32 term_SetBackground(u32 firsttag, ...)
00358 {
00359   return(term_SetBackgroundTL((tag *)&firsttag));
00360 }
00361 u32 term_SetBackgroundTL(tag *taglist)
00362 {
00363   u32 window;
00364   u32 ret=~0L;
00365 
00366   debug_Begin();
00367 
00368   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00369   if(window!=0L)
00370   {
00371     ret=term_RpcCall(glw_GetConnection(window),RPC_SETBACKGROUND,taglist);
00372   }
00373 
00374   debug_End();
00375 
00376   return(ret);
00377 }
00378 
00379 
00387 u32 term_DrawLine(u32 firsttag, ...)
00388 {
00389   return(term_DrawLineTL((tag *)&firsttag));
00390 }
00391 u32 term_DrawLineTL(tag *taglist)
00392 {
00393   u32 window;
00394   u32 ret=~0L;
00395 
00396   debug_Begin();
00397 
00398   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00399   if(window!=0L)
00400   {
00401     ret=term_RpcCall(glw_GetConnection(window),RPC_DRAWLINE,taglist);
00402   }
00403 
00404   debug_End();
00405 
00406   return(ret);
00407 }
00408 
00409 
00417 u32 term_DrawRect(u32 firsttag, ...)
00418 {
00419   return(term_DrawRectTL((tag *)&firsttag));
00420 }
00421 u32 term_DrawRectTL(tag *taglist)
00422 {
00423   u32 window;
00424   u32 ret=~0L;
00425 
00426   debug_Begin();
00427 
00428   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00429   if(window!=0L)
00430   {
00431     ret=term_RpcCall(glw_GetConnection(window),RPC_DRAWRECT,taglist);
00432   }
00433 
00434   debug_End();
00435 
00436   return(ret);
00437 }
00438 
00439 
00447 u32 term_DrawFilledRect(u32 firsttag, ...)
00448 {
00449   return(term_DrawFilledRectTL((tag *)&firsttag));
00450 }
00451 u32 term_DrawFilledRectTL(tag *taglist)
00452 {
00453   u32 window;
00454   u32 ret=~0L;
00455 
00456   debug_Begin();
00457 
00458   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00459   if(window!=0L)
00460   {
00461     ret=term_RpcCall(glw_GetConnection(window),RPC_DRAWFILLEDRECT,taglist);
00462   }
00463 
00464   debug_End();
00465 
00466   return(ret);
00467 }
00468 
00469 
00475 u32 term_DrawPixel(u32 firsttag, ...)
00476 {
00477   return(term_DrawPixelTL((tag *)&firsttag));
00478 }
00479 u32 term_DrawPixelTL(tag *taglist)
00480 {
00481   u32 window;
00482   u32 ret=~0L;
00483 
00484   debug_Begin();
00485 
00486   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00487   if(window!=0L)
00488   {
00489     ret=term_RpcCall(glw_GetConnection(window),RPC_DRAWPIXEL,taglist);
00490   }
00491 
00492   debug_End();
00493 
00494   return(ret);
00495 }
00496 
00497 
00504 u32 term_OpenFont(u32 firsttag, ...)
00505 {
00506   return(term_OpenFontTL((tag *)&firsttag));
00507 }
00508 u32 term_OpenFontTL(tag *taglist)
00509 {
00510   u32 conn;
00511   u32 ret=~0L;
00512 
00513   debug_Begin();
00514 
00515   conn=(u32)tag_GetTagData(taglist,TAG_GLW_CONN,0L);
00516   ret=term_RpcCall(conn,RPC_OPENFONT,taglist);
00517 
00518   debug_End();
00519 
00520   return(ret);
00521 }
00522 
00523 
00527 u32 term_CloseFont(u32 firsttag, ...)
00528 {
00529   return(term_CloseFontTL((tag *)&firsttag));
00530 }
00531 u32 term_CloseFontTL(tag *taglist)
00532 {
00533   u32 font;
00534   u32 ret=~0L;
00535 
00536   debug_Begin();
00537 
00538   font=(u32)tag_GetTagData(taglist,TAG_GLW_FONT,0L);
00539   if(font!=0L)
00540   {
00541     ret=term_RpcCall(glw_GetFontConnection(font),RPC_CLOSEFONT,taglist);
00542   }
00543 
00544   debug_End();
00545 
00546   return(ret);
00547 }
00548 
00549 
00557 u32 term_DrawText(u32 firsttag, ...)
00558 {
00559   return(term_DrawTextTL((tag *)&firsttag));
00560 }
00561 u32 term_DrawTextTL(tag *taglist)
00562 {
00563   u32 window;
00564   u32 ret=~0L;
00565 
00566   debug_Begin();
00567 
00568   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00569   if(window!=0L)
00570   {
00571     ret=term_RpcCall(glw_GetConnection(window),RPC_DRAWTEXT,taglist);
00572   }
00573 
00574   debug_End();
00575 
00576   return(ret);
00577 }
00578 
00579 
00583 u32 term_GetFontSize(u32 firsttag, ...)
00584 {
00585   return(term_GetFontSizeTL((tag *)&firsttag));
00586 }
00587 u32 term_GetFontSizeTL(tag *taglist)
00588 {
00589   u32 font;
00590   u32 ret=~0L;
00591 
00592   debug_Begin();
00593 
00594   font=(u32)tag_GetTagData(taglist,TAG_GLW_FONT,0L);
00595   if(font!=0L)
00596   {
00597     ret=term_RpcCall(glw_GetFontConnection(font),RPC_GETFONTSIZE,taglist);
00598   }
00599 
00600   debug_End();
00601 
00602   return(ret);
00603 }
00604 
00605 
00610 u32 term_GetTextLength(u32 firsttag, ...)
00611 {
00612   return(term_GetTextLengthTL((tag *)&firsttag));
00613 }
00614 u32 term_GetTextLengthTL(tag *taglist)
00615 {
00616   u32 font;
00617   u32 ret=~0L;
00618 
00619   debug_Begin();
00620 
00621   font=(u32)tag_GetTagData(taglist,TAG_GLW_FONT,0L);
00622   if(font!=0L)
00623   {
00624     ret=term_RpcCall(glw_GetFontConnection(font),RPC_GETTEXTLENGTH,taglist);
00625   }
00626 
00627   debug_End();
00628 
00629   return(ret);
00630 }
00631 
00632 
00642 u32 term_PutImage(u32 firsttag, ...)
00643 {
00644   return(term_PutImageTL((tag *)&firsttag));
00645 }
00646 u32 term_PutImageTL(tag *taglist)
00647 {
00648   u32 window;
00649   u32 ret=~0L;
00650 
00651   debug_Begin();
00652 
00653   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00654   if(window!=0L)
00655   {
00656     ret=term_RpcCall(glw_GetConnection(window),RPC_PUTIMAGE,taglist);
00657   }
00658 
00659   debug_End();
00660 
00661   return(ret);
00662 }
00663 
00664 
00669 u32 term_GetScreenDimensions(u32 firsttag, ...)
00670 {
00671   return(term_GetScreenDimensionsTL((tag *)&firsttag));
00672 }
00673 u32 term_GetScreenDimensionsTL(tag *taglist)
00674 {
00675   u32 window;
00676   u32 ret=~0L;
00677 
00678   debug_Begin();
00679 
00680   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00681   if(window!=0L)
00682   {
00683     ret=term_RpcCall(glw_GetConnection(window),RPC_GETSCREENDIMENSIONS,taglist);
00684   }
00685 
00686   debug_End();
00687 
00688   return(ret);
00689 }
00690 
00691 
00696 u32 term_SetWindowDimensions(u32 firsttag, ...)
00697 {
00698   return(term_SetWindowDimensionsTL((tag *)&firsttag));
00699 }
00700 u32 term_SetWindowDimensionsTL(tag *taglist)
00701 {
00702   u32 window;
00703   u32 ret=~0L;
00704 
00705   debug_Begin();
00706 
00707   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00708   if(window!=0L)
00709   {
00710     ret=term_RpcCall(glw_GetConnection(window),RPC_SETWINDOWDIMENSIONS,taglist);
00711   }
00712 
00713   debug_End();
00714 
00715   return(ret);
00716 }
00717 
00718 
00723 u32 term_GetWindowDimensions(u32 firsttag, ...)
00724 {
00725   return(term_GetWindowDimensionsTL((tag *)&firsttag));
00726 }
00727 u32 term_GetWindowDimensionsTL(tag *taglist)
00728 {
00729   u32 window;
00730   u32 ret=~0L;
00731 
00732   debug_Begin();
00733 
00734   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00735   if(window!=0L)
00736   {
00737     ret=term_RpcCall(glw_GetConnection(window),RPC_GETWINDOWDIMENSIONS,taglist);
00738   }
00739 
00740   debug_End();
00741 
00742   return(ret);
00743 }
00744 
00745 
00750 u32 term_SetPointer(u32 firsttag, ...)
00751 {
00752   return(term_SetPointerTL((tag *)&firsttag));
00753 }
00754 u32 term_SetPointerTL(tag *taglist)
00755 {
00756   u32 window;
00757   u32 ret=~0L;
00758 
00759   debug_Begin();
00760 
00761   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00762   if(window!=0L)
00763   {
00764     ret=term_RpcCall(glw_GetConnection(window),RPC_SETPOINTER,taglist);
00765   }
00766 
00767   debug_End();
00768 
00769   return(ret);
00770 }
00771 
00772 
00777 u32 term_SetWindowTransparency(u32 firsttag, ...)
00778 {
00779   return(term_SetWindowTransparencyTL((tag *)&firsttag));
00780 }
00781 u32 term_SetWindowTransparencyTL(tag *taglist)
00782 {
00783   u32 window;
00784   u32 ret=~0L;
00785 
00786   debug_Begin();
00787 
00788   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00789   if(window!=0L)
00790   {
00791     ret=term_RpcCall(glw_GetConnection(window),RPC_SETWINDOWTRANSPARENCY,taglist);
00792   }
00793 
00794   debug_End();
00795 
00796   return(ret);
00797 }
00798 
00799 
00801 
00802 
00809 u32 term_OpenWindow(u32 firsttag, ...)
00810 {
00811   return(term_OpenWindowTL((tag *)&firsttag));
00812 }
00813 u32 term_OpenWindowTL(tag *taglist)
00814 {
00815   u32 conn;
00816   u32 ret=~0L;
00817 
00818   debug_Begin();
00819 
00820   conn=(u32)tag_GetTagData(taglist,TAG_GLW_CONN,0L);
00821   ret=term_RpcCall(conn,RPC_OPENWINDOW,taglist);
00822 
00823   debug_End();
00824 
00825   return(ret);
00826 }
00827 
00828 
00832 u32 term_CloseWindow(u32 firsttag, ...)
00833 {
00834   return(term_CloseWindowTL((tag *)&firsttag));
00835 }
00836 u32 term_CloseWindowTL(tag *taglist)
00837 {
00838   u32 window;
00839   u32 ret=~0L;
00840 
00841   debug_Begin();
00842 
00843   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00844   if(window!=0L)
00845   {
00846     ret=term_RpcCall(glw_GetConnection(window),RPC_CLOSEWINDOW,taglist);
00847   }
00848 
00849   debug_End();
00850 
00851   return(ret);
00852 }
00853 
00854 
00858 u32 term_RefreshWindow(u32 firsttag, ...)
00859 {
00860   return(term_RefreshWindowTL((tag *)&firsttag));
00861 }
00862 u32 term_RefreshWindowTL(tag *taglist)
00863 {
00864   u32 window;
00865   u32 ret=~0L;
00866 
00867   debug_Begin();
00868 
00869   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00870   if(window!=0L)
00871   {
00872     ret=term_RpcCall(glw_GetConnection(window),RPC_REFRESHWINDOW,taglist);
00873   }
00874 
00875   debug_End();
00876 
00877   return(ret);
00878 }
00879 
00880 
00885 u32 term_RefreshWindowPartial(u32 firsttag, ...)
00886 {
00887   return(term_RefreshWindowPartialTL((tag *)&firsttag));
00888 }
00889 u32 term_RefreshWindowPartialTL(tag *taglist)
00890 {
00891   u32 window;
00892   u32 ret=~0L;
00893 
00894   debug_Begin();
00895 
00896   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00897   if(window!=0L)
00898   {
00899     ret=term_RpcCall(glw_GetConnection(window),RPC_REFRESHWINDOWPARTIAL,taglist);
00900   }
00901 
00902   debug_End();
00903 
00904   return(ret);
00905 }
00906 
00907 
00911 u32 term_ClearWindow(u32 firsttag, ...)
00912 {
00913   return(term_ClearWindowTL((tag *)&firsttag));
00914 }
00915 u32 term_ClearWindowTL(tag *taglist)
00916 {
00917   u32 window;
00918   u32 ret=~0L;
00919 
00920   debug_Begin();
00921 
00922   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00923   if(window!=0L)
00924   {
00925     ret=term_RpcCall(glw_GetConnection(window),RPC_CLEARWINDOW,taglist);
00926   }
00927 
00928   debug_End();
00929 
00930   return(ret);
00931 }
00932 
00933 
00937 u32 term_GetWindowUserdata(u32 firsttag, ...)
00938 {
00939   return(term_GetWindowUserdataTL((tag *)&firsttag));
00940 }
00941 u32 term_GetWindowUserdataTL(tag *taglist)
00942 {
00943   u32 window;
00944   u32 ret=~0L;
00945 
00946   debug_Begin();
00947 
00948   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00949   if(window!=0L)
00950   {
00951     ret=term_RpcCall(glw_GetConnection(window),RPC_GETWINDOWUSERDATA,taglist);
00952   }
00953 
00954   debug_End();
00955 
00956   return(ret);
00957 }
00958 
00959 
00967 u32 term_SetWindowLimits(u32 firsttag, ...)
00968 {
00969   return(term_SetWindowLimitsTL((tag *)&firsttag));
00970 }
00971 u32 term_SetWindowLimitsTL(tag *taglist)
00972 {
00973   u32 window;
00974   u32 ret=~0L;
00975 
00976   debug_Begin();
00977 
00978   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
00979   if(window!=0L)
00980   {
00981     ret=term_RpcCall(glw_GetConnection(window),RPC_SETWINDOWLIMITS,taglist);
00982   }
00983 
00984   debug_End();
00985 
00986   return(ret);
00987 }
00988 
00989 
00994 u32 term_SetWindowState(u32 firsttag, ...)
00995 {
00996   return(term_SetWindowStateTL((tag *)&firsttag));
00997 }
00998 u32 term_SetWindowStateTL(tag *taglist)
00999 {
01000   u32 window;
01001   u32 ret=~0L;
01002 
01003   debug_Begin();
01004 
01005   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
01006   if(window!=0L)
01007   {
01008     ret=term_RpcCall(glw_GetConnection(window),RPC_SETWINDOWSTATE,taglist);
01009   }
01010 
01011   debug_End();
01012 
01013   return(ret);
01014 }
01015 
01016 
01024 u32 term_SetWindowShape(u32 firsttag, ...)
01025 {
01026   return(term_SetWindowShapeTL((tag *)&firsttag));
01027 }
01028 u32 term_SetWindowShapeTL(tag *taglist)
01029 {
01030   u32 window;
01031   u32 ret=~0L;
01032 
01033   debug_Begin();
01034 
01035   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
01036   if(window!=0L)
01037   {
01038     ret=term_RpcCall(glw_GetConnection(window),RPC_SETWINDOWSHAPE,taglist);
01039   }
01040 
01041   debug_End();
01042 
01043   return(ret);
01044 }
01045 
01046 
01050 u32 term_GetWindowState(u32 firsttag, ...)
01051 {
01052   return(term_GetWindowStateTL((tag *)&firsttag));
01053 }
01054 u32 term_GetWindowStateTL(tag *taglist)
01055 {
01056   u32 window;
01057   u32 ret=~0L;
01058 
01059   debug_Begin();
01060 
01061   window=(u32)tag_GetTagData(taglist,TAG_GLW_WINDOW,0L);
01062   if(window!=0L)
01063   {
01064     ret=term_RpcCall(glw_GetConnection(window),RPC_GETWINDOWSTATE,taglist);
01065   }
01066 
01067   debug_End();
01068 
01069   return(ret);
01070 }
01071 
01072 
01074 
01075 
01076 u32 term_Call(int function, u32 firsttag, ...)
01077 {
01078   return(term_CallTL(function,(tag *)&firsttag));
01079 }
01080 u32 term_CallTL(int function, tag *taglist)
01081 {
01082   u32 ret=~0L;
01083 
01084   debug_Begin();
01085 
01086   if(function>=TERM_FUNCBASE&&function<TERM_FUNC_DONE)
01087   {
01088     ret=call_vector[function-TERM_FUNCBASE](taglist);
01089   }
01090   else debug_Warning("%s(): Function code out of range! code=0x%04x",__FUNCTION__,function);
01091 
01092   debug_End();
01093 
01094   return(ret);
01095 }
01096 
01097 
01098 int term_Init(void)
01099 {
01100 
01101   debug_Begin();
01102 
01103 //Initialize call vector BEGIN - put this into the init function of this module
01104   call_vector[TERM_STARTMOUSETRACKING-TERM_FUNCBASE]=term_StartMouseTrackingTL;
01105   call_vector[TERM_STOPMOUSETRACKING-TERM_FUNCBASE]=term_StopMouseTrackingTL;
01106   call_vector[TERM_DRAGWINDOW-TERM_FUNCBASE]=term_DragWindowTL;
01107   call_vector[TERM_RESIZEWINDOW-TERM_FUNCBASE]=term_ResizeWindowTL;
01108   call_vector[TERM_SETCOLOR-TERM_FUNCBASE]=term_SetColorTL;
01109   call_vector[TERM_SETBACKGROUND-TERM_FUNCBASE]=term_SetBackgroundTL;
01110   call_vector[TERM_DRAWLINE-TERM_FUNCBASE]=term_DrawLineTL;
01111   call_vector[TERM_DRAWRECT-TERM_FUNCBASE]=term_DrawRectTL;
01112   call_vector[TERM_DRAWFILLEDRECT-TERM_FUNCBASE]=term_DrawFilledRectTL;
01113   call_vector[TERM_DRAWPIXEL-TERM_FUNCBASE]=term_DrawPixelTL;
01114   call_vector[TERM_OPENFONT-TERM_FUNCBASE]=term_OpenFontTL;
01115   call_vector[TERM_CLOSEFONT-TERM_FUNCBASE]=term_CloseFontTL;
01116   call_vector[TERM_DRAWTEXT-TERM_FUNCBASE]=term_DrawTextTL;
01117   call_vector[TERM_GETFONTSIZE-TERM_FUNCBASE]=term_GetFontSizeTL;
01118   call_vector[TERM_GETTEXTLENGTH-TERM_FUNCBASE]=term_GetTextLengthTL;
01119   call_vector[TERM_PUTIMAGE-TERM_FUNCBASE]=term_PutImageTL;
01120   call_vector[TERM_GETSCREENDIMENSIONS-TERM_FUNCBASE]=term_GetScreenDimensionsTL;
01121   call_vector[TERM_SETWINDOWDIMENSIONS-TERM_FUNCBASE]=term_SetWindowDimensionsTL;
01122   call_vector[TERM_GETWINDOWDIMENSIONS-TERM_FUNCBASE]=term_GetWindowDimensionsTL;
01123   call_vector[TERM_SETPOINTER-TERM_FUNCBASE]=term_SetPointerTL;
01124   call_vector[TERM_SETWINDOWTRANSPARENCY-TERM_FUNCBASE]=term_SetWindowTransparencyTL;
01125   bases_modules.term_Call=term_Call;
01126   bases_modules.term_CallTL=term_CallTL;
01127 //Initialize call vector END
01128 
01129   debug_End();
01130 
01131   return(0);
01132 }
01133 
01134 
01135 void term_CleanUp(void)
01136 {
01137   debug_Begin();
01138   debug_End();
01139 }

Generated on Tue Jan 7 12:11:24 2003 for THEGUI by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002