25#include <proto/intuition.h>
27#include <proto/exec.h>
28#include <proto/clicktab.h>
29#include <gadgets/clicktab.h>
30#include <reaction/reaction_macros.h>
80#define RXHOOKF(func) static VOID func(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
82#define RXHOOKF(func) static ASM VOID func(REG(a0, struct ARexxCmd* cmd), REG(a1, struct RexxMsg* msg))
106 {
"OPEN",
RX_OPEN,rx_open,
"URL/A,NEW=NEWWINDOW/S,NEWTAB/S,SAVEAS/K,W=WINDOW/K/N,T=TAB/K/N,ACTIVE/S", 0, NULL, 0, 0, NULL },
107 {
"QUIT",
RX_QUIT,rx_quit,NULL, 0, NULL, 0, 0, NULL },
108 {
"TOFRONT",
RX_TOFRONT,rx_tofront,NULL, 0, NULL, 0, 0, NULL },
109 {
"GETURL",
RX_GETURL,rx_geturl,
"W=WINDOW/K/N,T=TAB/K/N", 0, NULL, 0, 0, NULL },
110 {
"GETTITLE",
RX_GETTITLE,rx_gettitle,
"W=WINDOW/K/N,T=TAB/K/N", 0, NULL, 0, 0, NULL },
111 {
"VERSION",
RX_VERSION,rx_version,
"VERSION/N,SVN=REVISION/N,RELEASE/S", 0, NULL, 0, 0, NULL },
112 {
"SAVE",
RX_SAVE,rx_save,
"FILENAME/A,W=WINDOW/K/N,T=TAB/K/N", 0, NULL, 0, 0, NULL },
113 {
"GETSCREENNAME",
RX_PUBSCREEN,rx_pubscreen,NULL, 0, NULL, 0, 0, NULL },
114 {
"BACK",
RX_BACK, rx_back,
"W=WINDOW/K/N,T=TAB/K/N", 0, NULL, 0, 0, NULL },
115 {
"FORWARD",
RX_FORWARD, rx_forward,
"W=WINDOW/K/N,T=TAB/K/N", 0, NULL, 0, 0, NULL },
116 {
"HOME",
RX_HOME, rx_home,
"W=WINDOW/K/N,T=TAB/K/N", 0, NULL, 0, 0, NULL },
117 {
"RELOAD",
RX_RELOAD, rx_reload,
"FORCE/S,W=WINDOW/K/N,T=TAB/K/N", 0, NULL, 0, 0, NULL },
118 {
"WINDOWS",
RX_WINDOWS, rx_windows,
"W=WINDOW/K/N", 0, NULL, 0, 0, NULL },
119 {
"ACTIVE",
RX_ACTIVE, rx_active,
"T=TAB/S", 0, NULL, 0, 0, NULL },
120 {
"CLOSE",
RX_CLOSE, rx_close,
"W=WINDOW/K/N,T=TAB/K/N", 0, NULL, 0, 0, NULL },
121 {
"HOTLIST",
RX_HOTLIST, rx_hotlist,
"A=ACTION/A", 0, NULL, 0, 0, NULL },
122 {
"SLABSTATS",
RX_SLABSTATS, rx_slabstats,
"FILE", 0, NULL, 0, 0, NULL },
123 {
"EXEC",
RX_EXEC, rx_exec,
"W=WINDOW/K/N,T=TAB/K/N,COMMAND/A/F", 0, NULL, 0, 0, NULL },
124 { NULL, 0, NULL, NULL, 0, NULL, 0, 0, NULL }
130 AREXX_HostName,
"NETSURF",
133 AREXX_ReplyHook,NULL,
134 AREXX_DefExtension,
"nsrx",
145 AREXX_HostName,
"NETSURF",
148 AREXX_ReplyHook,NULL,
149 AREXX_DefExtension,
"nsrx",
174 char full_script_path[1025];
177 if((lock = Lock(script, ACCESS_READ))) {
179 NSLOG(netsurf, INFO,
"Executing script: %s", full_script_path);
205 GetClickTabNodeAttrs(ctab,
209 }
while((ctab=ntab));
229 GetClickTabNodeAttrs(ctab,
233 }
while((ctab=ntab));
256 if(windows == window)
259 }
while((node = nnode));
272 if((cmd->ac_ArgList[4]) && (cmd->ac_ArgList[5]))
273 gw =
ami_find_tab(*(ULONG *)cmd->ac_ArgList[4], *(ULONG *)cmd->ac_ArgList[5]);
280 if(cmd->ac_ArgList[3])
284 dln = calloc(1,
sizeof(
struct dlnode));
285 dln->
filename = strdup((
char *)cmd->ac_ArgList[3]);
286 dln->
node.ln_Name = strdup((
char *)cmd->ac_ArgList[0]);
287 dln->
node.ln_Type = NT_USER;
297 else if(cmd->ac_ArgList[2])
313 if(cmd->ac_ArgList[6]) {
318 else if(cmd->ac_ArgList[1])
357 if((cmd->ac_ArgList[1]) && (cmd->ac_ArgList[2]))
358 gw =
ami_find_tab(*(ULONG *)cmd->ac_ArgList[1], *(ULONG *)cmd->ac_ArgList[2]);
364 if((fh =
FOpen((
char *)cmd->ac_ArgList[0], MODE_NEWFILE, 0)))
366 const uint8_t *source_data;
370 if (source_data != NULL) {
371 FWrite(fh, source_data, 1, source_size);
399 if((cmd->ac_ArgList[0]) && (cmd->ac_ArgList[1]))
400 gw =
ami_find_tab(*(ULONG *)cmd->ac_ArgList[0], *(ULONG *)cmd->ac_ArgList[1]);
420 if((cmd->ac_ArgList[0]) && (cmd->ac_ArgList[1]))
421 gw =
ami_find_tab(*(ULONG *)cmd->ac_ArgList[0], *(ULONG *)cmd->ac_ArgList[1]);
442 if(cmd->ac_ArgList[2])
444 if(cmd->ac_ArgList[1])
455 else if(cmd->ac_ArgList[0])
473 if(cmd->ac_ArgList[1])
484 else if(cmd->ac_ArgList[0])
526 if((cmd->ac_ArgList[0]) && (cmd->ac_ArgList[1]))
527 gw =
ami_find_tab(*(ULONG *)cmd->ac_ArgList[0], *(ULONG *)cmd->ac_ArgList[1]);
538 if((cmd->ac_ArgList[0]) && (cmd->ac_ArgList[1]))
539 gw =
ami_find_tab(*(ULONG *)cmd->ac_ArgList[0], *(ULONG *)cmd->ac_ArgList[1]);
552 if((cmd->ac_ArgList[0]) && (cmd->ac_ArgList[1]))
553 gw =
ami_find_tab(*(ULONG *)cmd->ac_ArgList[0], *(ULONG *)cmd->ac_ArgList[1]);
555 if(gw == NULL)
return;
577 if((cmd->ac_ArgList[1]) && (cmd->ac_ArgList[2]))
578 gw =
ami_find_tab(*(ULONG *)cmd->ac_ArgList[1], *(ULONG *)cmd->ac_ArgList[2]);
582 if(cmd->ac_ArgList[0])
595 int windows = 0,
tabs = 0;
598 if(cmd->ac_ArgList[0])
window = *(ULONG *)cmd->ac_ArgList[0];
603 if(cmd->ac_ArgList[0]) sprintf(
result,
"%d",
tabs);
604 else sprintf(
result,
"%d", windows);
639 }
while((node = nnode));
642 if(cmd->ac_ArgList[0])
647 if(cmd->ac_ArgList[0]) sprintf(
result,
"%d", tab);
648 else sprintf(
result,
"%d", window);
658 if((cmd->ac_ArgList[0]) && (cmd->ac_ArgList[1]))
659 gw =
ami_find_tab(*(ULONG *)cmd->ac_ArgList[0], *(ULONG *)cmd->ac_ArgList[1]);
660 else if(cmd->ac_ArgList[0])
673 if(strcasecmp((
char *)cmd->ac_ArgList[0],
"OPEN") == 0) {
675 }
else if(strcasecmp((
char *)cmd->ac_ArgList[0],
"CLOSE") == 0) {
686 cmd->ac_RC = RETURN_FAIL;
690 if((cmd->ac_ArgList[0]) && (cmd->ac_ArgList[1]))
691 gw =
ami_find_tab(*(ULONG *)cmd->ac_ArgList[0], *(ULONG *)cmd->ac_ArgList[1]);
694 NSLOG(netsurf, WARNING,
"Executing js: %s", (
char *)cmd->ac_ArgList[2]);
696 (
char *)cmd->ac_ArgList[2], strlen((
char *)cmd->ac_ArgList[2]));
700 cmd->ac_RC = RETURN_ERROR;
702 cmd->ac_RC = RETURN_OK;
712 if(cmd->ac_ArgList[0] != NULL) {
713 fh = Open((
char *)cmd->ac_ArgList[0], MODE_NEWFILE);
717 if(fh != 0) Close(fh);
struct Screen * ami_gui_get_screen(void)
Get a pointer to the screen NetSurf is running on.
void ami_gui_switch_to_new_tab(struct gui_window_2 *gwin)
Switch to the most-recently-opened tab.
void ami_gui_history(struct gui_window_2 *gwin, bool back)
void ami_gui_close_window(void *w)
Close a window and all tabs attached to it.
void ami_set_pointer(struct gui_window_2 *gwin, gui_pointer_shape shape, bool update)
static struct MinList * window_list
struct gui_window * ami_gui_get_active_gw(void)
Get a pointer to the gui_window which NetSurf considers to be the current/active one.
void ami_reset_pointer(struct gui_window_2 *gwin)
const char * ami_gui_get_win_title(struct gui_window *gw)
Get window title from gui_window.
const char * ami_gui_get_tab_title(struct gui_window *gw)
Get tab title from gui_window.
struct gui_window * ami_gui2_get_gui_window(struct gui_window_2 *gwin)
Get gui_window from gui_window_2.
struct List * ami_gui_get_download_list(struct gui_window *gw)
Get download list from gui_window.
ULONG ami_gui2_get_tabs(struct gui_window_2 *gwin)
Get tabs from gui_window_2.
struct List * ami_gui2_get_tab_list(struct gui_window_2 *gwin)
Get tab list from gui_window_2.
int ami_gui_count_windows(int window, int *tabs)
Count windows, and optionally tabs.
struct browser_window * ami_gui_get_browser_window(struct gui_window *gw)
Get browser window from gui_window.
struct MinList * ami_gui_get_window_list(void)
Get the window list.
struct gui_window_2 * ami_gui_get_gui_window_2(struct gui_window *gw)
Get gui_window_2 from gui_window.
void ami_quit_netsurf(void)
#define IS_CURRENT_GW(GWIN, GW)
nserror amiga_warn_user(const char *warning, const char *detail)
Warn the user of an event.
const char *const wt_revid
static int ami_find_tab_bw(struct gui_window_2 *gwin, struct browser_window *bw)
void ami_arexx_cleanup(void)
static void ami_arexx_command(const char *cmd, const char *port)
STATIC struct ARexxCmd Commands[]
static Object * arexx_obj
const char *const verarexx
static struct gui_window * ami_find_tab(int window, int tab)
bool ami_arexx_init(ULONG *rxsig)
static struct gui_window * ami_find_tab_gwin(struct gui_window_2 *gwin, int tab)
void ami_arexx_self(const char *cmd)
void ami_arexx_execute(char *script)
void ami_arexx_handle(void)
Browser window creation and manipulation interface.
nserror browser_window_navigate(struct browser_window *bw, struct nsurl *url, struct nsurl *referrer, enum browser_window_nav_flags flags, char *post_urlenc, struct fetch_multipart_data *post_multipart, struct hlcache_handle *parent)
Start fetching a page in a browser window.
bool browser_window_exec(struct browser_window *bw, const char *src, size_t srclen)
Execute some JavaScript code in a browsing context.
void browser_window_destroy(struct browser_window *bw)
Close and destroy a browser window.
nserror browser_window_reload(struct browser_window *bw, bool all)
Reload the page in a browser window.
struct nsurl * browser_window_access_url(const struct browser_window *bw)
Access a browser window's URL.
nserror browser_window_create(enum browser_window_create_flags flags, struct nsurl *url, struct nsurl *referrer, struct browser_window *existing, struct browser_window **bw)
Create and open a new root browser window with the given page.
struct hlcache_handle * browser_window_get_content(struct browser_window *bw)
Get a cache handle for the content within a browser window.
@ BW_CREATE_HISTORY
this will form a new history node (don't set for back/reload/etc)
@ BW_CREATE_TAB
New gui_window to be tab in same window as "existing" gui_window.
@ BW_NAVIGATE_DOWNLOAD
download rather than render the uri
@ BW_NAVIGATE_HISTORY
this will form a new history node (don't set for back/reload/etc)
const int netsurf_version_minor
NetSuf browser minor version number.
const int netsurf_version_major
NetSuf browser major version number.
void ami_hotlist_close(void)
Close the hotlist viewer normally this shouldn't be used; only exists for ARexx use.
nserror ami_hotlist_present(void)
Open the hotlist viewer.
static CONST_STRPTR tabs[OPTS_MAX_TABS]
Public content interface.
const uint8_t * content_get_source_data(struct hlcache_handle *h, size_t *size)
Retrieve source of content.
#define NSLOG(catname, level, logmsg, args...)
void ami_memory_slab_dump(BPTR fh)
NetSurf URL handling (interface).
nserror nsurl_create(const char *const url_s, nsurl **url)
Create a NetSurf URL object from a URL string.
void nsurl_unref(nsurl *url)
Drop a reference to a NetSurf URL object.
const char * nsurl_access(const nsurl *url)
Access a NetSurf URL object as a string.
struct nsurl nsurl
NetSurf URL object.
struct Node * GetHead(struct List *list)
struct Node * GetSucc(struct Node *node)
Minimal compatibility header for AmigaOS 3.
#define DevNameFromLock(A, B, C, D)
#define IsMinListEmpty(L)
Interface to utility string handling.
first entry in window list
struct fbtk_widget_s * window
struct browser_window * bw
The 'content' window that is rendered in the gui_window.
Option reading and saving interface.
#define nsoption_charp(OPTION)
Get the value of a string option.
#define nsoption_bool(OPTION)
Get the value of a boolean option.
Version information interface.