NetSurf
Functions | Variables
main.c File Reference
#include "utils/config.h"
#include <limits.h>
#include <stdbool.h>
#include <windows.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <io.h>
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/filepath.h"
#include "utils/file.h"
#include "utils/nsurl.h"
#include "utils/nsoption.h"
#include "netsurf/url_db.h"
#include "netsurf/cookie_db.h"
#include "netsurf/browser.h"
#include "netsurf/browser_window.h"
#include "netsurf/fetch.h"
#include "netsurf/misc.h"
#include "netsurf/netsurf.h"
#include "desktop/hotlist.h"
#include "windows/findfile.h"
#include "windows/file.h"
#include "windows/cookies.h"
#include "windows/drawable.h"
#include "windows/corewindow.h"
#include "windows/download.h"
#include "windows/local_history.h"
#include "windows/window.h"
#include "windows/schedule.h"
#include "windows/font.h"
#include "windows/fetch.h"
#include "windows/pointers.h"
#include "windows/bitmap.h"
#include "windows/clipboard.h"
#include "windows/gui.h"
Include dependency graph for main.c:

Go to the source code of this file.

Functions

static int get_screen_dpi (void)
 Obtain the DPI of the display. More...
 
static nserror get_config_home (char **config_home_out)
 Get the path to the config directory. More...
 
static void die (const char *error)
 Cause an abnormal program termination. More...
 
static bool nslog_ensure (FILE *fptr)
 Ensures output logging stream is available. More...
 
static nserror set_defaults (struct nsoption_s *defaults)
 Set option defaults for windows frontend. More...
 
static nserror nsw32_option_init (int *pargc, char **argv, char **respaths, char *config_path)
 Initialise user options location and contents. More...
 
static nserror nsw32_messages_init (char **respaths)
 Initialise messages. More...
 
static nserror win32_to_unix_commandline (int *argc_out, char ***argv_out)
 Construct a unix style argc/argv. More...
 
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
 Entry point from windows. More...
 

Variables

static struct gui_misc_table win32_misc_table
 

Function Documentation

◆ die()

static void die ( const char *  error)
static

Cause an abnormal program termination.

Note
This never returns and is intended to terminate without any cleanup.
Parameters
errorThe message to display to the user.

Definition at line 134 of file main.c.

Referenced by WinMain().

Here is the caller graph for this function:

◆ get_config_home()

static nserror get_config_home ( char **  config_home_out)
static

Get the path to the config directory.

This ought to use SHGetKnownFolderPath(FOLDERID_RoamingAppData) and PathCcpAppend() but uses depricated API because that is what mingw supports.

Parameters
config_home_outPath to configuration directory.
Returns
NSERROR_OK on sucess and config_home_out updated else error code.

Definition at line 91 of file main.c.

References NSERROR_INVALID, NSERROR_NOT_DIRECTORY, NSERROR_NOT_FOUND, NSERROR_OK, and NSLOG.

Referenced by WinMain().

Here is the caller graph for this function:

◆ get_screen_dpi()

static int get_screen_dpi ( void  )
static

Obtain the DPI of the display.

Returns
The DPI of the device the window is displayed on.

Definition at line 66 of file main.c.

References NSLOG.

Referenced by WinMain().

Here is the caller graph for this function:

◆ nslog_ensure()

static bool nslog_ensure ( FILE *  fptr)
static

Ensures output logging stream is available.

Definition at line 144 of file main.c.

Referenced by WinMain().

Here is the caller graph for this function:

◆ nsw32_messages_init()

static nserror nsw32_messages_init ( char **  respaths)
static

Initialise messages.

Definition at line 294 of file main.c.

References filepath_find(), messages_add_from_file(), messages_add_from_inline(), NSERROR_NOT_FOUND, NSERROR_OK, nsw32_get_resource_data(), and respaths.

Referenced by WinMain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsw32_option_init()

static nserror nsw32_option_init ( int *  pargc,
char **  argv,
char **  respaths,
char *  config_path 
)
static

Initialise user options location and contents.

Definition at line 263 of file main.c.

References G_config_path, G_resource_pathv, netsurf_mkpath(), NSERROR_OK, nsoption_commandline(), nsoption_init(), nsoption_read(), nsoptions, nsoptions_default, respaths, and set_defaults().

Referenced by WinMain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_defaults()

static nserror set_defaults ( struct nsoption_s defaults)
static

Set option defaults for windows frontend.

Parameters
defaultsThe option table to update.
Returns
error status.

Definition at line 162 of file main.c.

References filepath_sfind(), G_config_path, G_resource_pathv, netsurf_mkpath(), NSERROR_NOMEM, NSERROR_OK, nsoption_setnull_charp, and PATH_MAX.

Referenced by nsw32_option_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ win32_to_unix_commandline()

static nserror win32_to_unix_commandline ( int *  argc_out,
char ***  argv_out 
)
static

Construct a unix style argc/argv.

Parameters
argc_outnumber of commandline arguments
argv_outstring vector of command line arguments
Returns
NSERROR_OK on success else error code

Definition at line 326 of file main.c.

References NSERROR_INVALID, NSERROR_NOMEM, and NSERROR_OK.

Referenced by WinMain().

Here is the caller graph for this function:

◆ WinMain()

int WINAPI WinMain ( HINSTANCE  hInstance,
HINSTANCE  hLastInstance,
LPSTR  lpcli,
int  ncmd 
)

Variable Documentation

◆ win32_misc_table

struct gui_misc_table win32_misc_table
static
Initial value:
= {
.schedule = win32_schedule,
.present_cookies = nsw32_cookies_present,
}
nserror nsw32_cookies_present(const char *search_term)
make the cookie window visible.
Definition: cookies.c:173
nserror win32_schedule(int ival, void(*callback)(void *p), void *p)
Schedule a callback.
Definition: schedule.c:99

Definition at line 372 of file main.c.

Referenced by WinMain().