SunDtHelp.c 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: SunDtHelp.c /main/6 1996/08/22 10:39:25 rswiston $
  24. *
  25. * (c) Copyright 1996 Digital Equipment Corporation.
  26. * (c) Copyright 1996 Hewlett-Packard Company.
  27. * (c) Copyright 1996 International Business Machines Corp.
  28. * (c) Copyright 1996 Sun Microsystems, Inc.
  29. * (c) Copyright 1996 Novell, Inc.
  30. * (c) Copyright 1996 FUJITSU LIMITED.
  31. * (c) Copyright 1996 Hitachi.
  32. */
  33. /*
  34. *+SNOTICE
  35. *
  36. * RESTRICTED CONFIDENTIAL INFORMATION:
  37. *
  38. * The information in this document is subject to special
  39. * restrictions in a confidential disclosure agreement bertween
  40. * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
  41. * document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
  42. * Sun's specific written approval. This documment and all copies
  43. * and derivative works thereof must be returned or destroyed at
  44. * Sun's request.
  45. *
  46. * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
  47. *
  48. *+ENOTICE
  49. */
  50. #include <stdio.h>
  51. #include <dlfcn.h>
  52. #include "Help.h"
  53. #include "DtSvcLock.h"
  54. #pragma weak DtCreateHelpDialog = _DtCreateHelpDialog
  55. #pragma weak DtCreateHelpQuickDialog = _DtCreateHelpQuickDialog
  56. #pragma weak DtHelpQuickDialogGetChild = _DtHelpQuickDialogGetChild
  57. #pragma weak DtHelpReturnSelectedWidgetId = _DtHelpReturnSelectedWidgetId
  58. typedef Widget (*SUNWWidgetProc)();
  59. typedef int (*SUNWIntProc)();
  60. typedef struct _SUNWHelpProcList {
  61. SUNWWidgetProc DtCreateHelpDialogSym;
  62. SUNWWidgetProc DtCreateHelpQuickDialogSym;
  63. SUNWWidgetProc DtHelpQuickDialogGetChildSym;
  64. SUNWIntProc DtHelpReturnSelectedWidgetIdSym;
  65. } SUNWHelpProcList;
  66. static SUNWHelpProcList *pmySUNWProcList = NULL;
  67. int SUNWDtHelpdlopen()
  68. {
  69. void *libDtHelpHandle = NULL;
  70. _DtSvcProcessLock();
  71. pmySUNWProcList = (SUNWHelpProcList *)malloc(sizeof(SUNWHelpProcList));
  72. libDtHelpHandle = dlopen("libDtHelp.so.2.1", RTLD_LAZY | RTLD_GLOBAL);
  73. if (libDtHelpHandle == NULL) {
  74. char *my_err_msg;
  75. my_err_msg = dlerror();
  76. printf("%s\n", my_err_msg);
  77. _DtSvcProcessUnlock();
  78. return(FALSE);
  79. }
  80. pmySUNWProcList->DtCreateHelpDialogSym = (SUNWWidgetProc)
  81. dlsym(libDtHelpHandle, "DtCreateHelpDialog");
  82. pmySUNWProcList->DtCreateHelpQuickDialogSym = (SUNWWidgetProc)
  83. dlsym(libDtHelpHandle, "DtCreateHelpQuickDialog");
  84. pmySUNWProcList->DtHelpQuickDialogGetChildSym = (SUNWWidgetProc)
  85. dlsym(libDtHelpHandle, "DtHelpQuickDialogGetChild");
  86. pmySUNWProcList->DtHelpReturnSelectedWidgetIdSym = (SUNWIntProc)
  87. dlsym(libDtHelpHandle, "DtHelpReturnSelectedWidgetId");
  88. _DtSvcProcessUnlock();
  89. return(TRUE);
  90. }
  91. Widget _DtCreateHelpDialog(
  92. Widget parent,
  93. char *name,
  94. ArgList al,
  95. Cardinal ac)
  96. {
  97. int status;
  98. _DtSvcProcessLock();
  99. status = pmySUNWProcList || SUNWDtHelpdlopen();
  100. _DtSvcProcessUnlock();
  101. if (!status)
  102. return(NULL);
  103. return ((*pmySUNWProcList->DtCreateHelpDialogSym)(parent, name, al, ac));
  104. }
  105. Widget _DtCreateHelpQuickDialog(
  106. Widget parent,
  107. char *name,
  108. ArgList al,
  109. Cardinal ac)
  110. {
  111. int status;
  112. _DtSvcProcessLock();
  113. status = pmySUNWProcList || SUNWDtHelpdlopen();
  114. _DtSvcProcessUnlock();
  115. if (!status)
  116. return(NULL);
  117. return ((*pmySUNWProcList->DtCreateHelpQuickDialogSym)(parent, name, al, ac));
  118. }
  119. Widget _DtHelpQuickDialogGetChild(
  120. Widget widget,
  121. unsigned char child )
  122. {
  123. int status;
  124. _DtSvcProcessLock();
  125. status = pmySUNWProcList || SUNWDtHelpdlopen();
  126. _DtSvcProcessUnlock();
  127. if (!status)
  128. return(NULL);
  129. return ((*pmySUNWProcList->DtHelpQuickDialogGetChildSym)(widget, child));
  130. }
  131. int _DtHelpReturnSelectedWidgetId(
  132. Widget parent,
  133. Cursor cursor,
  134. Widget *widget)
  135. {
  136. int status;
  137. _DtSvcProcessLock();
  138. status = pmySUNWProcList || SUNWDtHelpdlopen();
  139. _DtSvcProcessUnlock();
  140. if (!status)
  141. return(NULL);
  142. return ((*pmySUNWProcList->DtHelpReturnSelectedWidgetIdSym)(parent, cursor,
  143. widget));
  144. }