• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* glib-private.h - GLib-internal private API, shared between glib, gobject, gio
2  * Copyright (C) 2011 Red Hat, Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __GLIB_PRIVATE_H__
19 #define __GLIB_PRIVATE_H__
20 
21 #include <glib.h>
22 #include "gwakeup.h"
23 #include "gstdioprivate.h"
24 
25 GMainContext *          g_get_worker_context            (void);
26 gboolean                g_check_setuid                  (void);
27 GMainContext *          g_main_context_new_with_next_id (guint next_id);
28 
29 #ifdef G_OS_WIN32
30 gchar *_glib_get_dll_directory (void);
31 GLIB_AVAILABLE_IN_ALL
32 gchar *_glib_get_locale_dir    (void);
33 #endif
34 
35 GDir * g_dir_open_with_errno (const gchar *path, guint flags);
36 GDir * g_dir_new_from_dirp (gpointer dirp);
37 
38 #define GLIB_PRIVATE_CALL(symbol) (glib__private__()->symbol)
39 
40 typedef struct {
41   /* See gwakeup.c */
42   GWakeup *             (* g_wakeup_new)                (void);
43   void                  (* g_wakeup_free)               (GWakeup *wakeup);
44   void                  (* g_wakeup_get_pollfd)         (GWakeup *wakeup,
45                                                         GPollFD *poll_fd);
46   void                  (* g_wakeup_signal)             (GWakeup *wakeup);
47   void                  (* g_wakeup_acknowledge)        (GWakeup *wakeup);
48 
49   /* See gmain.c */
50   GMainContext *        (* g_get_worker_context)        (void);
51 
52   gboolean              (* g_check_setuid)              (void);
53   GMainContext *        (* g_main_context_new_with_next_id) (guint next_id);
54 
55   GDir *                (* g_dir_open_with_errno)       (const gchar *path,
56                                                          guint        flags);
57   GDir *                (* g_dir_new_from_dirp)         (gpointer dirp);
58 
59   /* See glib-init.c */
60   void                  (* glib_init)                   (void);
61 
62   /* See gstdio.c */
63 #ifdef G_OS_WIN32
64   int                   (* g_win32_stat_utf8)           (const gchar        *filename,
65                                                          GWin32PrivateStat  *buf);
66 
67   int                   (* g_win32_lstat_utf8)          (const gchar        *filename,
68                                                          GWin32PrivateStat  *buf);
69 
70   int                   (* g_win32_readlink_utf8)       (const gchar        *filename,
71                                                          gchar              *buf,
72                                                          gsize               buf_size,
73                                                          gchar             **alloc_buf,
74                                                          gboolean            terminate);
75 
76   int                   (* g_win32_fstat)               (int                 fd,
77                                                          GWin32PrivateStat  *buf);
78 #endif
79 
80 
81   /* Add other private functions here, initialize them in glib-private.c */
82 } GLibPrivateVTable;
83 
84 GLIB_AVAILABLE_IN_ALL
85 GLibPrivateVTable *glib__private__ (void);
86 
87 /* Please see following for the use of ".ACP" over ""
88  * on Windows, although both are accepted at compile-time
89  * but "" renders translated console messages unreadable if
90  * built with Visual Studio 2012 and later (this is, unfortunately,
91  * undocumented):
92  *
93  * https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setlocale-wsetlocale
94  * https://gitlab.gnome.org/GNOME/glib/merge_requests/895#note_525881
95  * https://gitlab.gnome.org/GNOME/glib/merge_requests/895#note_525900
96  *
97  * Additional related items:
98  * https://stackoverflow.com/questions/22604329/php-5-5-setlocale-not-working-in-cli-on-windows
99  * https://bugs.php.net/bug.php?id=66265
100  */
101 
102 #ifdef G_OS_WIN32
103 # define GLIB_DEFAULT_LOCALE ".ACP"
104 #else
105 # define GLIB_DEFAULT_LOCALE ""
106 #endif
107 
108 #endif /* __GLIB_PRIVATE_H__ */
109