source: git/Singular/sing_win.cc @ b0ca43c

spielwiese
Last change on this file since b0ca43c was 762407, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
config.h is for sources files only FIX: config.h should only be used by source (not from inside kernel/mod2.h!) NOTE: each source file should better include mod2.h right after config.h, while headers should better not include mod2.h.
  • Property mode set to 100644
File size: 2.4 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Id$ */
5
6/*
7* ABSTRACT: Windows specific routines
8*/
9
10#include "config.h"
11#include <kernel/mod2.h>
12#ifdef ix86_Win
13#include <windows.h>
14#include <winuser.h>
15#include <kernel/htmlhelp.h>
16#include <sys/cygwin.h>
17#include <stdio.h>
18#ifndef MAXPATHLEN
19#define MAXPATHLEN 1024
20#endif
21
22void heOpenWinHtmlHelp(const char* keyw, char* helppath )
23// API Call Sequence for Microsoft HTML Help System
24{
25  char path[MAXPATHLEN];
26#ifdef TEST
27  printf("keyw:%s\n", keyw);
28#endif
29  cygwin_conv_to_full_win32_path(helppath, path);
30#ifdef TEST
31  printf("path:%s\n", path);
32#endif
33HH_ALINKA link;
34   link.cbStruct =     sizeof(HH_ALINKA) ;
35   link.fReserved =    FALSE ;
36   link.pszKeywords =  keyw;
37   link.pszUrl =       NULL ;
38   link.pszMsgText =   NULL ;
39   link.pszMsgTitle =  NULL ;
40   link.pszWindow =    NULL ;
41   link.fIndexOnFail = TRUE ;
42  HtmlHelpA(NULL, path, HH_KEYWORD_LOOKUP, (DWORD)&link);
43}
44
45void heOpenWinntHlp(const char* keyw, char* helppath )
46{
47  char path[MAXPATHLEN];
48#ifdef TEST
49  printf("keyw:%s\n", keyw);
50#endif
51  cygwin_conv_to_full_win32_path(helppath, path);
52#ifdef TEST
53  printf("path:%s\n", path);
54#endif
55      WinHelp(NULL, path, HELP_PARTIALKEY,(DWORD)keyw);
56}
57
58void heOpenWinntUrl(const char* url, int local)
59{
60#ifdef TEST
61  printf("url:%s:local:%d\n", url, local);
62#endif
63  if (local)
64  {
65    char path[MAXPATHLEN];
66    char *p;
67    cygwin_conv_to_full_win32_path(url, path);
68    /* seems like I can not open url's wit # at the end */
69    if ((p=strchr(path, '#')) != NULL) *p = '\0';
70#ifdef TEST
71    printf("path:%s:local:%d\n", path, local);
72#endif
73    ShellExecute(NULL, "open", path, 0, 0, SW_SHOWNORMAL);
74  }
75  else
76  {
77    // need to check whether this works
78    ShellExecute(NULL, "open", url, 0, 0, SW_SHOWNORMAL);
79  }
80}
81
82void *dynl_open(char *filename)
83{
84  char path[MAXPATHLEN];
85  cygwin_conv_to_full_win32_path(filename, path);
86  HINSTANCE hLibrary = LoadLibrary( TEXT(path));
87
88  return(hLibrary);
89}
90
91void *dynl_sym(void *handle, char *symbol)
92{
93  FARPROC f;
94  f = GetProcAddress((HINSTANCE)handle, TEXT (symbol));
95  return((void*) f);
96}
97
98int dynl_close (void *handle)
99{
100  FreeLibrary((HINSTANCE)handle);
101  return(0);
102}
103
104const char *dynl_error()
105{
106  static char errmsg[] = "support for dynamic loading not implemented";
107
108  return errmsg;
109}
110
111#endif /*ix86_Win */
Note: See TracBrowser for help on using the repository browser.