NetSurf
Data Structures | Functions | Variables
misc.c File Reference
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <sys/types.h>
#include <mint/osbind.h>
#include "utils/nsoption.h"
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/file.h"
#include "utils/dirent.h"
#include "netsurf/mouse.h"
#include "netsurf/keypress.h"
#include "content/content.h"
#include "content/hlcache.h"
#include "desktop/cookie_manager.h"
#include "atari/gui.h"
#include "atari/toolbar.h"
#include "atari/misc.h"
#include "atari/encoding.h"
#include "atari/gemtk/gemtk.h"
#include "cflib.h"
Include dependency graph for misc.c:

Go to the source code of this file.

Data Structures

struct  is_process_running_callback_data
 

Functions

nserror atari_warn_user (const char *warning, const char *detail)
 Warn the user of an event. More...
 
void die (const char *error)
 Cause an abnormal program termination. More...
 
struct gui_windowfind_guiwin_by_aes_handle (short handle)
 
static int scan_process_list (scan_process_callback cb, void *data)
 
static int proc_running_callback (int pid, void *arg)
 
bool is_process_running (const char *name)
 
void gem_set_cursor (MFORM_EX *cursor)
 
long nkc_to_input_key (short nkc, long *ucs4_out)
 Convert NKC to netsurf input key code and/or to ucs4 (depends on keycode). More...
 
const char * file_select (const char *title, const char *name)
 Show default file selector. More...
 
void dbg_grect (const char *str, GRECT *r)
 
void dbg_pxy (const char *str, short *pxy)
 
void dbg_rect (const char *str, int *pxy)
 

Variables

void * h_gem_rsrc
 

Function Documentation

◆ atari_warn_user()

nserror atari_warn_user ( const char *  warning,
const char *  detail 
)

Warn the user of an event.

Parameters
[in]warningA warning looked up in the message translation table
[in]detailAdditional text to be displayed or NULL.
Returns
NSERROR_OK on success or error code if there was a faliure displaying the message to the user.

Definition at line 56 of file misc.c.

References messages_get(), and NSERROR_OK.

Referenced by atari_about_show(), atari_treeview_create(), context_popup(), gui_download_window_create(), main(), menu_new_win(), menu_open_file(), read_locales(), toolbar_home_click(), and toolbar_key_input().

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

◆ dbg_grect()

void dbg_grect ( const char *  str,
GRECT *  r 
)

Definition at line 388 of file misc.c.

◆ dbg_pxy()

void dbg_pxy ( const char *  str,
short *  pxy 
)

Definition at line 394 of file misc.c.

◆ dbg_rect()

void dbg_rect ( const char *  str,
int *  pxy 
)

Definition at line 400 of file misc.c.

◆ die()

void die ( const char *const  error)

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 69 of file misc.c.

Referenced by fetch_rsrc_register(), gui_download_window_create(), nsfont_check_fonts(), nsfont_init(), plot_init(), ro_gui_configure_initialise(), ro_gui_configure_register(), ro_gui_dialog_create(), ro_gui_dialog_load_template(), ro_gui_dialog_open_url_init(), ro_gui_iconbar_initialise(), ro_gui_menu_define_menu(), ro_gui_menu_define_menu_add(), and ro_gui_saveas_create().

Here is the caller graph for this function:

◆ file_select()

const char * file_select ( const char *  title,
const char *  name 
)

Show default file selector.

Parameters
titleThe selector title.
nameDefault file name
Returns
a static char pointer or null if the user aborted the selection.

Definition at line 363 of file misc.c.

References path(), and PATH_MAX.

Referenced by handle_filesystem_select_button(), menu_open_file(), and menu_save_page().

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

◆ find_guiwin_by_aes_handle()

struct gui_window * find_guiwin_by_aes_handle ( short  handle)

Definition at line 77 of file misc.c.

References gui_window::next, gui_window::root, s_gui_win_root::win, and window_list.

◆ gem_set_cursor()

void gem_set_cursor ( MFORM_EX cursor)

Definition at line 196 of file misc.c.

References mform_ex_s::flags, MFORM_EX_FLAG_USERFORM, mform_ex_s::number, and mform_ex_s::tree.

Referenced by gui_init(), gui_window_set_pointer(), handle_event(), and on_mbutton_event().

Here is the caller graph for this function:

◆ is_process_running()

bool is_process_running ( const char *  name)

Definition at line 186 of file misc.c.

References is_process_running_callback_data::found, proc_running_callback(), and scan_process_list().

Here is the call graph for this function:

◆ nkc_to_input_key()

long nkc_to_input_key ( short  nkc,
long *  ucs4_out 
)

Convert NKC to netsurf input key code and/or to ucs4 (depends on keycode).

Parameters
[in]nkcatari normalized key code
[out]ucs4_outThe ucs4 converted keycode
Returns
The netsurf input keycode or 0 and ucs4_out updated with the NKC converted to UC4 encoding.

Definition at line 213 of file misc.c.

References atari_to_ucs4(), NS_KEY_COPY_SELECTION, NS_KEY_CR, NS_KEY_CUT_SELECTION, NS_KEY_DELETE_LEFT, NS_KEY_DELETE_RIGHT, NS_KEY_DOWN, NS_KEY_ESCAPE, NS_KEY_LEFT, NS_KEY_LINE_END, NS_KEY_LINE_START, NS_KEY_NL, NS_KEY_PAGE_DOWN, NS_KEY_PAGE_UP, NS_KEY_PASTE, NS_KEY_RIGHT, NS_KEY_SELECT_ALL, NS_KEY_SHIFT_TAB, NS_KEY_TAB, NS_KEY_TEXT_START, NS_KEY_UNDO, and NS_KEY_UP.

Referenced by on_content_keypress(), on_keybd_event(), and toolbar_key_input().

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

◆ proc_running_callback()

static int proc_running_callback ( int  pid,
void *  arg 
)
static

Definition at line 131 of file misc.c.

References is_process_running_callback_data::fname, is_process_running_callback_data::found, MIN, and PATH_MAX.

Referenced by is_process_running().

Here is the caller graph for this function:

◆ scan_process_list()

static int scan_process_list ( scan_process_callback  cb,
void *  data 
)
static

Definition at line 99 of file misc.c.

References count().

Referenced by is_process_running().

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

Variable Documentation

◆ h_gem_rsrc

void* h_gem_rsrc
extern

Definition at line 76 of file gui.c.