NetSurf
|
#include "amiga/os3support.h"
#include <stdlib.h>
#include <string.h>
#include <proto/icon.h>
#include <proto/dos.h>
#include <proto/datatypes.h>
#include <proto/exec.h>
#include <workbench/icon.h>
#include "netsurf/content.h"
#include "utils/log.h"
#include "utils/utils.h"
#include "amiga/filetype.h"
#include "amiga/object.h"
Go to the source code of this file.
Data Structures | |
struct | ami_mime_entry |
Enumerations | |
enum | { AMI_MIME_MIMETYPE , AMI_MIME_DATATYPE , AMI_MIME_FILETYPE , AMI_MIME_PLUGINCMD } |
Functions | |
const char * | fetch_filetype (const char *unix_path) |
Determine the MIME type of a local file. More... | |
const char * | ami_content_type_to_file_type (content_type type) |
static void | ami_mime_entry_free (void *nso) |
nserror | ami_mime_init (const char *mimefile) |
void | ami_mime_free (void) |
static struct ami_mime_entry * | ami_mime_entry_locate (lwc_string *search, int type, struct Node **start_node) |
Return next matching MIME entry. More... | |
static APTR | ami_mime_guess_add_datatype (struct DataType *dt, lwc_string **lwc_mimetype) |
struct Node * | ami_mime_from_datatype (struct DataType *dt, lwc_string **mimetype, struct Node *start_node) |
Return a MIME Type matching a DataType. More... | |
struct Node * | ami_mime_to_filetype (lwc_string *mimetype, lwc_string **filetype, struct Node *start_node) |
Return the DefIcons type matching a MIME type. More... | |
const char * | ami_mime_content_to_filetype (struct hlcache_handle *c) |
struct Node * | ami_mime_has_cmd (lwc_string **mimetype, struct Node *start_node) |
Return all MIME types containing a plugincmd. More... | |
static struct Node * | ami_mime_to_plugincmd (lwc_string *mimetype, lwc_string **plugincmd, struct Node *start_node) |
Return the plugincmd matching a MIME type. More... | |
lwc_string * | ami_mime_content_to_cmd (struct hlcache_handle *c) |
bool | ami_mime_compare (struct hlcache_handle *c, const char *type) |
Compare the MIME type of an hlcache_handle to a DefIcons type. More... | |
void | ami_mime_dump (void) |
Variables | |
static struct MinList * | ami_mime_list = NULL |
filetype – determine the MIME type of a local file More... | |
anonymous enum |
Enumerator | |
---|---|
AMI_MIME_MIMETYPE | |
AMI_MIME_DATATYPE | |
AMI_MIME_FILETYPE | |
AMI_MIME_PLUGINCMD |
Definition at line 50 of file filetype.c.
const char * ami_content_type_to_file_type | ( | content_type | type | ) |
Definition at line 141 of file filetype.c.
References CONTENT_CSS, CONTENT_HTML, CONTENT_IMAGE, CONTENT_TEXTPLAIN, and type.
Referenced by ami_mime_content_to_filetype().
bool ami_mime_compare | ( | struct hlcache_handle * | c, |
const char * | type | ||
) |
Compare the MIME type of an hlcache_handle to a DefIcons type.
Definition at line 614 of file filetype.c.
References ami_mime_to_filetype(), content_get_mime_type(), and type.
Referenced by ami_file_save(), ami_gui_menu_update_disabled(), and HOOKF().
lwc_string * ami_mime_content_to_cmd | ( | struct hlcache_handle * | c | ) |
Definition at line 595 of file filetype.c.
References ami_mime_to_plugincmd(), and content_get_mime_type().
Referenced by amiga_plugin_hack_execute().
const char * ami_mime_content_to_filetype | ( | struct hlcache_handle * | c | ) |
Definition at line 523 of file filetype.c.
References ami_content_type_to_file_type(), ami_mime_to_filetype(), content_get_mime_type(), and content_get_type().
void ami_mime_dump | ( | void | ) |
Definition at line 639 of file filetype.c.
References ami_mime_entry_locate(), AMI_MIME_MIMETYPE, ami_mime_entry::datatype, ami_mime_entry::filetype, ami_mime_entry::mimetype, NSLOG, and ami_mime_entry::plugincmd.
Referenced by ami_mime_free().
|
static |
Definition at line 167 of file filetype.c.
References ami_mime_entry::datatype, ami_mime_entry::filetype, ami_mime_entry::mimetype, and ami_mime_entry::plugincmd.
Referenced by ami_mime_guess_add_datatype(), and ami_mime_init().
|
static |
Return next matching MIME entry.
search | lwc_string to search for (or NULL for all) |
type | of value being searched for (AMI_MIME_#?) |
start_node | node to continue search (updated on exit) |
Definition at line 279 of file filetype.c.
References AMI_MIME_DATATYPE, AMI_MIME_FILETYPE, ami_mime_list, AMI_MIME_MIMETYPE, AMI_MIME_PLUGINCMD, ami_mime_entry::datatype, ami_mime_entry::filetype, GetHead(), GetSucc(), IsMinListEmpty, ami_mime_entry::mimetype, nsObject::objstruct, ami_mime_entry::plugincmd, and type.
Referenced by ami_mime_dump(), ami_mime_from_datatype(), ami_mime_has_cmd(), ami_mime_to_filetype(), and ami_mime_to_plugincmd().
void ami_mime_free | ( | void | ) |
Definition at line 264 of file filetype.c.
References ami_mime_dump(), ami_mime_list, and FreeObjList().
Referenced by main().
struct Node * ami_mime_from_datatype | ( | struct DataType * | dt, |
lwc_string ** | mimetype, | ||
struct Node * | start_node | ||
) |
Return a MIME Type matching a DataType.
dt | a DataType structure |
mimetype | lwc_string to hold the MIME type |
start_node | node to feed back in to continue search |
Definition at line 455 of file filetype.c.
References AMI_MIME_DATATYPE, ami_mime_entry_locate(), ami_mime_guess_add_datatype(), and ami_mime_entry::mimetype.
Referenced by fetch_filetype().
|
static |
Definition at line 350 of file filetype.c.
References AddObject(), ami_mime_entry_free(), ami_mime_list, AMINS_MIME, ami_mime_entry::datatype, ami_mime_entry::filetype, ami_mime_entry::mimetype, ObjectCallback(), nsObject::objstruct, and strlwr().
Referenced by ami_mime_from_datatype().
struct Node * ami_mime_has_cmd | ( | lwc_string ** | mimetype, |
struct Node * | start_node | ||
) |
Return all MIME types containing a plugincmd.
mimetype | ptr to lwc_string MIME type |
start_node | node to feed back in to continue search |
Definition at line 547 of file filetype.c.
References ami_mime_entry_locate(), AMI_MIME_PLUGINCMD, and ami_mime_entry::mimetype.
Referenced by amiga_plugin_hack_init().
nserror ami_mime_init | ( | const char * | mimefile | ) |
Definition at line 177 of file filetype.c.
References AddObject(), AMI_MIME_DATATYPE, ami_mime_entry_free(), AMI_MIME_FILETYPE, ami_mime_list, AMI_MIME_MIMETYPE, AMI_MIME_PLUGINCMD, AMINS_MIME, buffer, ami_mime_entry::datatype, FClose, ami_mime_entry::filetype, FOpen, ami_mime_entry::mimetype, NewObjList(), NSERROR_NOMEM, NSERROR_OK, NSLOG, ObjectCallback(), nsObject::objstruct, and ami_mime_entry::plugincmd.
Referenced by main().
struct Node * ami_mime_to_filetype | ( | lwc_string * | mimetype, |
lwc_string ** | filetype, | ||
struct Node * | start_node | ||
) |
Return the DefIcons type matching a MIME type.
mimetype | lwc_string MIME type |
filetype | ptr to lwc_string to hold DefIcons type |
start_node | node to feed back in to continue search |
Definition at line 503 of file filetype.c.
References ami_mime_entry_locate(), AMI_MIME_MIMETYPE, and ami_mime_entry::filetype.
Referenced by ami_mime_compare(), and ami_mime_content_to_filetype().
|
static |
Return the plugincmd matching a MIME type.
mimetype | lwc_string MIME type |
plugincmd | ptr to lwc_string to hold plugincmd |
start_node | node to feed back in to continue search |
Definition at line 575 of file filetype.c.
References ami_mime_entry_locate(), AMI_MIME_MIMETYPE, and ami_mime_entry::plugincmd.
Referenced by ami_mime_content_to_cmd().
const char * fetch_filetype | ( | const char * | unix_path | ) |
Determine the MIME type of a local file.
unix_path | Unix style path to file on disk |
Definition at line 58 of file filetype.c.
References ami_mime_from_datatype().
Referenced by fetch_rsrc_process(), and HOOKF().
|
static |
filetype – determine the MIME type of a local file
Definition at line 40 of file filetype.c.
Referenced by ami_mime_entry_locate(), ami_mime_free(), ami_mime_guess_add_datatype(), and ami_mime_init().