r12451 chris_y - in /trunk/netsurf/amiga: filetype.c filetype.h
by netsurf@semichrome.net
Author: chris_y
Date: Mon May 30 16:03:57 2011
New Revision: 12451
URL: http://source.netsurf-browser.org?rev=12451&view=rev
Log:
Remove ami_datatype_to_mimetype
Modified:
trunk/netsurf/amiga/filetype.c
trunk/netsurf/amiga/filetype.h
Modified: trunk/netsurf/amiga/filetype.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/filetype.c?rev=1245...
==============================================================================
--- trunk/netsurf/amiga/filetype.c (original)
+++ trunk/netsurf/amiga/filetype.c Mon May 30 16:03:57 2011
@@ -60,6 +60,7 @@
BPTR lock = 0;
struct DataType *dtn;
BOOL found = FALSE;
+ lwc_string *lwc_mimetype;
/* First, check if we appear to have an icon.
We'll just do a filename check here for quickness, although the
@@ -91,9 +92,7 @@
}
}
- /* If that didn't work, have a go at guessing it using datatypes.library. This isn't
- accurate - the base names differ from those used by MIME and it relies on the
- user having a datatype installed which can handle the file. */
+ /* If that didn't work, use the MIME file and DataTypes */
if(!found)
{
@@ -101,9 +100,13 @@
{
if (dtn = ObtainDataTypeA (DTST_FILE, (APTR)lock, NULL))
{
- ami_datatype_to_mimetype(dtn, &mimetype);
- found = TRUE;
- ReleaseDataType(dtn);
+ if(ami_mime_from_datatype(dtn, &lwc_mimetype, NULL))
+ {
+ strcpy(mimetype, lwc_string_data(lwc_mimetype));
+ lwc_string_unref(lwc_mimetype);
+ found = TRUE;
+ ReleaseDataType(dtn);
+ }
}
UnLock(lock);
}
@@ -168,61 +171,6 @@
}
}
-void ami_datatype_to_mimetype(struct DataType *dtn, char *mimetype)
-{
- struct DataTypeHeader *dth = dtn->dtn_Header;
-
- switch(dth->dth_GroupID)
- {
- case GID_TEXT:
- case GID_DOCUMENT:
- if(strcmp("ascii",dth->dth_BaseName)==0)
- {
- strcpy(mimetype,"text/plain");
- }
- else if(strcmp("simplehtml",dth->dth_BaseName)==0)
- {
- strcpy(mimetype,"text/html");
- }
- else
- {
- sprintf(mimetype,"text/%s",dth->dth_BaseName);
- }
- break;
- case GID_SOUND:
- case GID_INSTRUMENT:
- case GID_MUSIC:
- sprintf(mimetype,"audio/%s",dth->dth_BaseName);
- break;
- case GID_PICTURE:
- sprintf(mimetype,"image/%s",dth->dth_BaseName);
- if(strcmp("sprite",dth->dth_BaseName)==0)
- {
- strcpy(mimetype,"image/x-riscos-sprite");
- }
- if(strcmp("mng",dth->dth_BaseName)==0)
- {
- strcpy(mimetype,"video/mng");
- }
- break;
- case GID_ANIMATION:
- case GID_MOVIE:
- sprintf(mimetype,"video/%s",dth->dth_BaseName);
- break;
- case GID_SYSTEM:
- default:
- if(strcmp("directory",dth->dth_BaseName)==0)
- {
- strcpy(mimetype,"application/x-netsurf-directory");
- }
- else if(strcmp("binary",dth->dth_BaseName)==0)
- {
- strcpy(mimetype,"application/octet-stream");
- }
- else sprintf(mimetype,"application/%s",dth->dth_BaseName);
- break;
- }
-}
nserror ami_mime_init(const char *mimefile)
{
Modified: trunk/netsurf/amiga/filetype.h
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/filetype.h?rev=1245...
==============================================================================
--- trunk/netsurf/amiga/filetype.h (original)
+++ trunk/netsurf/amiga/filetype.h Mon May 30 16:03:57 2011
@@ -45,5 +45,4 @@
/* deprecated */
const char *ami_content_type_to_file_type(content_type type);
-void ami_datatype_to_mimetype(struct DataType *dtn, char *mimetype);
#endif
12 years, 3 months
r12450 chris_y - in /trunk/netsurf/amiga: dt_anim.c dt_picture.c filetype.c filetype.h
by netsurf@semichrome.net
Author: chris_y
Date: Mon May 30 15:52:31 2011
New Revision: 12450
URL: http://source.netsurf-browser.org?rev=12450&view=rev
Log:
Guess MIME type from DataType only if there isn't already a valid entry in the list
Modified:
trunk/netsurf/amiga/dt_anim.c
trunk/netsurf/amiga/dt_picture.c
trunk/netsurf/amiga/filetype.c
trunk/netsurf/amiga/filetype.h
Modified: trunk/netsurf/amiga/dt_anim.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/dt_anim.c?rev=12450...
==============================================================================
--- trunk/netsurf/amiga/dt_anim.c (original)
+++ trunk/netsurf/amiga/dt_anim.c Mon May 30 15:52:31 2011
@@ -101,21 +101,6 @@
{
ReleaseDataType(prevdt);
prevdt = dt;
- ami_datatype_to_mimetype(dt, dt_mime);
-
- LOG(("Guessed MIME from anim DT: %s", dt_mime));
-
- lerror = lwc_intern_string(dt_mime, strlen(dt_mime), &type);
- if (lerror != lwc_error_ok)
- return NSERROR_NOMEM;
-
- error = content_factory_register_handler(type,
- &amiga_dt_anim_content_handler);
-
- lwc_string_unref(type);
-
- if (error != NSERROR_OK)
- return error;
do {
node = ami_mime_from_datatype(dt, &type, node);
Modified: trunk/netsurf/amiga/dt_picture.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/dt_picture.c?rev=12...
==============================================================================
--- trunk/netsurf/amiga/dt_picture.c (original)
+++ trunk/netsurf/amiga/dt_picture.c Mon May 30 15:52:31 2011
@@ -88,21 +88,6 @@
{
ReleaseDataType(prevdt);
prevdt = dt;
- ami_datatype_to_mimetype(dt, dt_mime);
-
- LOG(("Guessed MIME from DT: %s", dt_mime));
-
- lerror = lwc_intern_string(dt_mime, strlen(dt_mime), &type);
- if (lerror != lwc_error_ok)
- return NSERROR_NOMEM;
-
- error = content_factory_register_handler(type,
- &amiga_dt_picture_content_handler);
-
- lwc_string_unref(type);
-
- if (error != NSERROR_OK)
- return error;
do {
node = ami_mime_from_datatype(dt, &type, node);
Modified: trunk/netsurf/amiga/filetype.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/filetype.c?rev=1245...
==============================================================================
--- trunk/netsurf/amiga/filetype.c (original)
+++ trunk/netsurf/amiga/filetype.c Mon May 30 15:52:31 2011
@@ -146,6 +146,8 @@
const char *ami_content_type_to_file_type(content_type type)
{
+ /* TODO: Can we pass MIME types to this function instead? */
+
switch(type)
{
case CONTENT_HTML:
@@ -394,6 +396,93 @@
else return NULL;
}
+
+APTR ami_mime_guess_add_datatype(struct DataType *dt, lwc_string **lwc_mimetype)
+{
+ struct nsObject *node;
+ char mimetype[100];
+ char *dt_name_lwr;
+ struct ami_mime_entry *mimeentry;
+ lwc_error lerror;
+ struct DataTypeHeader *dth = dt->dtn_Header;
+ char *p;
+
+ node = AddObject(ami_mime_list, AMINS_MIME);
+ mimeentry = AllocVec(sizeof(struct ami_mime_entry), MEMF_PRIVATE | MEMF_CLEAR);
+ node->objstruct = mimeentry;
+
+ lerror = lwc_intern_string(dth->dth_Name, strlen(dth->dth_Name), &mimeentry->datatype);
+ if (lerror != lwc_error_ok)
+ return NULL;
+
+ dt_name_lwr = strlwr(dth->dth_Name);
+ p = dt_name_lwr;
+
+ while(*p != '\0')
+ {
+ if(*p == ' ') *p = '-';
+ p++;
+ }
+
+ switch(dth->dth_GroupID)
+ {
+ case GID_TEXT:
+ case GID_DOCUMENT:
+ if(strcmp("ascii", dt_name_lwr)==0)
+ {
+ strcpy(mimetype,"text/plain");
+ }
+ else
+ {
+ sprintf(mimetype,"text/%s", dt_name_lwr);
+ }
+ break;
+ case GID_SOUND:
+ case GID_INSTRUMENT:
+ case GID_MUSIC:
+ sprintf(mimetype,"audio/%s", dt_name_lwr);
+ break;
+ case GID_PICTURE:
+ if(strcmp("sprite", dt_name_lwr)==0)
+ {
+ strcpy(mimetype,"image/x-riscos-sprite");
+ }
+ else
+ {
+ sprintf(mimetype,"image/%s", dt_name_lwr);
+ }
+ break;
+ case GID_ANIMATION:
+ case GID_MOVIE:
+ sprintf(mimetype,"video/%s", dt_name_lwr);
+ break;
+ case GID_SYSTEM:
+ default:
+ if(strcmp("directory", dt_name_lwr)==0)
+ {
+ strcpy(mimetype,"application/x-netsurf-directory");
+ }
+ else if(strcmp("binary", dt_name_lwr)==0)
+ {
+ strcpy(mimetype,"application/octet-stream");
+ }
+ else sprintf(mimetype,"application/%s", dt_name_lwr);
+ break;
+ }
+
+ lerror = lwc_intern_string(mimetype, strlen(mimetype), &mimeentry->mimetype);
+ if (lerror != lwc_error_ok)
+ return NULL;
+
+ *lwc_mimetype = mimeentry->mimetype;
+
+ lerror = lwc_intern_string(dt_name_lwr, strlen(dt_name_lwr), &mimeentry->filetype);
+ if (lerror != lwc_error_ok)
+ return NULL;
+
+ return node;
+}
+
/**
* Return a MIME Type matching a DataType
*
@@ -421,7 +510,6 @@
node = start_node;
mimeentry = ami_mime_entry_locate(dt_name, AMI_MIME_DATATYPE, &node);
-
lwc_string_unref(dt_name);
if(mimeentry != NULL)
@@ -431,7 +519,15 @@
}
else
{
- return NULL;
+ if(start_node == NULL)
+ {
+ /* If there are no matching entries in the file, guess */
+ return ami_mime_guess_add_datatype(dt, mimetype);
+ }
+ else
+ {
+ return NULL;
+ }
}
}
@@ -547,3 +643,19 @@
return ret;
}
+
+
+void ami_mime_dump(void)
+{
+ struct Node *node;
+ struct ami_mime_entry *mimeentry;
+
+ while(mimeentry = ami_mime_entry_locate(NULL, AMI_MIME_MIMETYPE, &node))
+ {
+ LOG(("%s DT=%s TYPE=%s CMD=%s",
+ mimeentry->mimetype ? lwc_string_data(mimeentry->mimetype) : "",
+ mimeentry->datatype ? lwc_string_data(mimeentry->datatype) : "",
+ mimeentry->filetype ? lwc_string_data(mimeentry->filetype) : "",
+ mimeentry->plugincmd ? lwc_string_data(mimeentry->plugincmd) : ""));
+ };
+}
Modified: trunk/netsurf/amiga/filetype.h
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/filetype.h?rev=1245...
==============================================================================
--- trunk/netsurf/amiga/filetype.h (original)
+++ trunk/netsurf/amiga/filetype.h Mon May 30 15:52:31 2011
@@ -30,6 +30,7 @@
nserror ami_mime_init(const char *mimefile);
void ami_mime_free(void);
void ami_mime_entry_free(struct ami_mime_entry *mimeentry);
+void ami_mime_dump(void);
struct Node *ami_mime_from_datatype(struct DataType *dt,
lwc_string **mimetype, struct Node *start_node);
12 years, 3 months
r12449 chris_y - /trunk/netsurf/amiga/gui.c
by netsurf@semichrome.net
Author: chris_y
Date: Mon May 30 13:17:09 2011
New Revision: 12449
URL: http://source.netsurf-browser.org?rev=12449&view=rev
Log:
Allow mixing of AmigaOS and NetSurf command line options
Modified:
trunk/netsurf/amiga/gui.c
Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=12449&r1=...
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Mon May 30 13:17:09 2011
@@ -589,10 +589,11 @@
struct RDArgs *args;
STRPTR temp_homepage_url = NULL;
BOOL notalreadyrunning;
- STRPTR template = "URL/K,FORCE/S";
- long rarray[] = {0,0};
+ STRPTR template = "NSOPTS/M,URL/K,FORCE/S";
+ long rarray[] = {0,0,0};
enum
{
+ A_NSOPTS, /* ignored */
A_URL,
A_FORCE
};
12 years, 3 months
r12448 chris_y - /trunk/netsurf/amiga/filetype.c
by netsurf@semichrome.net
Author: chris_y
Date: Mon May 30 11:16:48 2011
New Revision: 12448
URL: http://source.netsurf-browser.org?rev=12448&view=rev
Log:
Convert the supplied MIME type to the DefIcons type *before* doing the comparison
Modified:
trunk/netsurf/amiga/filetype.c
Modified: trunk/netsurf/amiga/filetype.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/filetype.c?rev=1244...
==============================================================================
--- trunk/netsurf/amiga/filetype.c (original)
+++ trunk/netsurf/amiga/filetype.c Mon May 30 11:16:48 2011
@@ -529,13 +529,17 @@
bool ret = false;
lwc_error lerror;
lwc_string *filetype;
+ lwc_string *mime_filetype;
lwc_string *mime = content_get_mime_type(c);
+
+ if(ami_mime_to_filetype(mime, &mime_filetype, NULL) == NULL)
+ return false;
lerror = lwc_intern_string(type, strlen(type), &filetype);
if (lerror != lwc_error_ok)
return false;
- lerror = lwc_string_isequal(filetype, mime, &ret);
+ lerror = lwc_string_isequal(filetype, mime_filetype, &ret);
if (lerror != lwc_error_ok)
return false;
12 years, 3 months
r12446 tlsa - /trunk/libcss/test/data/parse2/font.dat
by netsurf@semichrome.net
Author: tlsa
Date: Thu May 26 13:39:09 2011
New Revision: 12446
URL: http://source.netsurf-browser.org?rev=12446&view=rev
Log:
Add a few tests.
Modified:
trunk/libcss/test/data/parse2/font.dat
Modified: trunk/libcss/test/data/parse2/font.dat
URL: http://source.netsurf-browser.org/trunk/libcss/test/data/parse2/font.dat?...
==============================================================================
--- trunk/libcss/test/data/parse2/font.dat (original)
+++ trunk/libcss/test/data/parse2/font.dat Thu May 26 13:39:09 2011
@@ -52,6 +52,39 @@
#reset
#data
+* { font: oblique 10pt serif; }
+#errors
+#expected
+| *
+| font-style: oblique
+| font-variant: normal
+| font-weight: normal
+| font-size: 10pt
+| line-height: normal
+| font-family: serif
+#reset
+
+#data
+* { font: 12pt serif; }
+#errors
+#expected
+| *
+| font-style: normal
+| font-variant: normal
+| font-weight: normal
+| font-size: 12pt
+| line-height: normal
+| font-family: serif
+#reset
+
+#data
+* { font: serif 12pt; }
+#errors
+#expected
+| *
+#reset
+
+#data
* { font: small-caps 10pt serif; }
#errors
#expected
12 years, 4 months
r12445 tlsa - /trunk/libcss/test/dump.h
by netsurf@semichrome.net
Author: tlsa
Date: Thu May 26 12:57:12 2011
New Revision: 12445
URL: http://source.netsurf-browser.org?rev=12445&view=rev
Log:
Fix a bunch of warnings.
Modified:
trunk/libcss/test/dump.h
Modified: trunk/libcss/test/dump.h
URL: http://source.netsurf-browser.org/trunk/libcss/test/dump.h?rev=12445&r1=1...
==============================================================================
--- trunk/libcss/test/dump.h (original)
+++ trunk/libcss/test/dump.h Thu May 26 12:57:12 2011
@@ -777,11 +777,14 @@
case CSS_PROP_BORDER_BOTTOM_COLOR:
case CSS_PROP_BORDER_LEFT_COLOR:
case CSS_PROP_BACKGROUND_COLOR:
- assert(BACKGROUND_COLOR_TRANSPARENT ==
+ assert(BACKGROUND_COLOR_TRANSPARENT ==
+ (enum op_background_color)
BORDER_COLOR_TRANSPARENT);
assert(BACKGROUND_COLOR_CURRENT_COLOR ==
+ (enum op_background_color)
BORDER_COLOR_CURRENT_COLOR);
assert(BACKGROUND_COLOR_SET ==
+ (enum op_background_color)
BORDER_COLOR_SET);
switch (value) {
@@ -805,13 +808,23 @@
case CSS_PROP_CUE_AFTER:
case CSS_PROP_CUE_BEFORE:
case CSS_PROP_LIST_STYLE_IMAGE:
- assert(BACKGROUND_IMAGE_NONE == CUE_AFTER_NONE);
- assert(BACKGROUND_IMAGE_URI == CUE_AFTER_URI);
- assert(BACKGROUND_IMAGE_NONE == CUE_BEFORE_NONE);
- assert(BACKGROUND_IMAGE_URI == CUE_BEFORE_URI);
assert(BACKGROUND_IMAGE_NONE ==
+ (enum op_background_image)
+ CUE_AFTER_NONE);
+ assert(BACKGROUND_IMAGE_URI ==
+ (enum op_background_image)
+ CUE_AFTER_URI);
+ assert(BACKGROUND_IMAGE_NONE ==
+ (enum op_background_image)
+ CUE_BEFORE_NONE);
+ assert(BACKGROUND_IMAGE_URI ==
+ (enum op_background_image)
+ CUE_BEFORE_URI);
+ assert(BACKGROUND_IMAGE_NONE ==
+ (enum op_background_image)
LIST_STYLE_IMAGE_NONE);
assert(BACKGROUND_IMAGE_URI ==
+ (enum op_background_image)
LIST_STYLE_IMAGE_URI);
switch (value) {
@@ -928,24 +941,35 @@
case CSS_PROP_BORDER_BOTTOM_STYLE:
case CSS_PROP_BORDER_LEFT_STYLE:
case CSS_PROP_OUTLINE_STYLE:
- assert(BORDER_STYLE_NONE == OUTLINE_STYLE_NONE);
- assert(BORDER_STYLE_HIDDEN ==
+ assert(BORDER_STYLE_NONE ==
+ (enum op_border_style)
+ OUTLINE_STYLE_NONE);
+ assert(BORDER_STYLE_HIDDEN ==
+ (enum op_border_style)
OUTLINE_STYLE_HIDDEN);
assert(BORDER_STYLE_DOTTED ==
+ (enum op_border_style)
OUTLINE_STYLE_DOTTED);
assert(BORDER_STYLE_DASHED ==
+ (enum op_border_style)
OUTLINE_STYLE_DASHED);
assert(BORDER_STYLE_SOLID ==
+ (enum op_border_style)
OUTLINE_STYLE_SOLID);
assert(BORDER_STYLE_DOUBLE ==
+ (enum op_border_style)
OUTLINE_STYLE_DOUBLE);
assert(BORDER_STYLE_GROOVE ==
+ (enum op_border_style)
OUTLINE_STYLE_GROOVE);
assert(BORDER_STYLE_RIDGE ==
+ (enum op_border_style)
OUTLINE_STYLE_RIDGE);
assert(BORDER_STYLE_INSET ==
+ (enum op_border_style)
OUTLINE_STYLE_INSET);
assert(BORDER_STYLE_OUTSET ==
+ (enum op_border_style)
OUTLINE_STYLE_OUTSET);
switch (value) {
@@ -986,11 +1010,17 @@
case CSS_PROP_BORDER_BOTTOM_WIDTH:
case CSS_PROP_BORDER_LEFT_WIDTH:
case CSS_PROP_OUTLINE_WIDTH:
- assert(BORDER_WIDTH_SET == OUTLINE_WIDTH_SET);
- assert(BORDER_WIDTH_THIN == OUTLINE_WIDTH_THIN);
+ assert(BORDER_WIDTH_SET ==
+ (enum op_border_width)
+ OUTLINE_WIDTH_SET);
+ assert(BORDER_WIDTH_THIN ==
+ (enum op_border_width)
+ OUTLINE_WIDTH_THIN);
assert(BORDER_WIDTH_MEDIUM ==
+ (enum op_border_width)
OUTLINE_WIDTH_MEDIUM);
assert(BORDER_WIDTH_THICK ==
+ (enum op_border_width)
OUTLINE_WIDTH_THICK);
switch (value) {
@@ -1025,18 +1055,30 @@
case CSS_PROP_TOP:
case CSS_PROP_HEIGHT:
case CSS_PROP_WIDTH:
- assert(BOTTOM_SET == LEFT_SET);
- assert(BOTTOM_AUTO == LEFT_AUTO);
- assert(BOTTOM_SET == RIGHT_SET);
- assert(BOTTOM_AUTO == RIGHT_AUTO);
- assert(BOTTOM_SET == TOP_SET);
- assert(BOTTOM_AUTO == TOP_AUTO);
- assert(BOTTOM_SET == HEIGHT_SET);
- assert(BOTTOM_AUTO == HEIGHT_AUTO);
- assert(BOTTOM_SET == MARGIN_SET);
- assert(BOTTOM_AUTO == MARGIN_AUTO);
- assert(BOTTOM_SET == WIDTH_SET);
- assert(BOTTOM_AUTO == WIDTH_AUTO);
+ assert(BOTTOM_SET ==
+ (enum op_bottom) LEFT_SET);
+ assert(BOTTOM_AUTO ==
+ (enum op_bottom) LEFT_AUTO);
+ assert(BOTTOM_SET ==
+ (enum op_bottom) RIGHT_SET);
+ assert(BOTTOM_AUTO ==
+ (enum op_bottom) RIGHT_AUTO);
+ assert(BOTTOM_SET ==
+ (enum op_bottom) TOP_SET);
+ assert(BOTTOM_AUTO ==
+ (enum op_bottom) TOP_AUTO);
+ assert(BOTTOM_SET ==
+ (enum op_bottom) HEIGHT_SET);
+ assert(BOTTOM_AUTO ==
+ (enum op_bottom) HEIGHT_AUTO);
+ assert(BOTTOM_SET ==
+ (enum op_bottom) MARGIN_SET);
+ assert(BOTTOM_AUTO ==
+ (enum op_bottom) MARGIN_AUTO);
+ assert(BOTTOM_SET ==
+ (enum op_bottom) WIDTH_SET);
+ assert(BOTTOM_AUTO ==
+ (enum op_bottom) WIDTH_AUTO);
switch (value) {
case BOTTOM_SET:
@@ -1233,9 +1275,11 @@
break;
case CSS_PROP_COUNTER_INCREMENT:
case CSS_PROP_COUNTER_RESET:
- assert(COUNTER_INCREMENT_NONE ==
+ assert(COUNTER_INCREMENT_NONE ==
+ (enum op_counter_increment)
COUNTER_RESET_NONE);
assert(COUNTER_INCREMENT_NAMED ==
+ (enum op_counter_increment)
COUNTER_RESET_NAMED);
switch (value) {
@@ -1599,8 +1643,11 @@
break;
case CSS_PROP_LETTER_SPACING:
case CSS_PROP_WORD_SPACING:
- assert(LETTER_SPACING_SET == WORD_SPACING_SET);
+ assert(LETTER_SPACING_SET ==
+ (enum op_letter_spacing)
+ WORD_SPACING_SET);
assert(LETTER_SPACING_NORMAL ==
+ (enum op_letter_spacing)
WORD_SPACING_NORMAL);
switch (value) {
@@ -1704,8 +1751,12 @@
break;
case CSS_PROP_MAX_HEIGHT:
case CSS_PROP_MAX_WIDTH:
- assert(MAX_HEIGHT_SET == MAX_WIDTH_SET);
- assert(MAX_HEIGHT_NONE == MAX_WIDTH_NONE);
+ assert(MAX_HEIGHT_SET ==
+ (enum op_max_height)
+ MAX_WIDTH_SET);
+ assert(MAX_HEIGHT_NONE ==
+ (enum op_max_height)
+ MAX_WIDTH_NONE);
switch (value) {
case MAX_HEIGHT_SET:
@@ -1743,11 +1794,21 @@
case CSS_PROP_PAUSE_AFTER:
case CSS_PROP_PAUSE_BEFORE:
case CSS_PROP_TEXT_INDENT:
- assert(MIN_HEIGHT_SET == MIN_WIDTH_SET);
- assert(MIN_HEIGHT_SET == PADDING_SET);
- assert(MIN_HEIGHT_SET == PAUSE_AFTER_SET);
- assert(MIN_HEIGHT_SET == PAUSE_BEFORE_SET);
- assert(MIN_HEIGHT_SET == TEXT_INDENT_SET);
+ assert(MIN_HEIGHT_SET ==
+ (enum op_min_height)
+ MIN_WIDTH_SET);
+ assert(MIN_HEIGHT_SET ==
+ (enum op_min_height)
+ PADDING_SET);
+ assert(MIN_HEIGHT_SET ==
+ (enum op_min_height)
+ PAUSE_AFTER_SET);
+ assert(MIN_HEIGHT_SET ==
+ (enum op_min_height)
+ PAUSE_BEFORE_SET);
+ assert(MIN_HEIGHT_SET ==
+ (enum op_min_height)
+ TEXT_INDENT_SET);
switch (value) {
case MIN_HEIGHT_SET:
@@ -1767,10 +1828,18 @@
case CSS_PROP_RICHNESS:
case CSS_PROP_STRESS:
case CSS_PROP_WIDOWS:
- assert(ORPHANS_SET == PITCH_RANGE_SET);
- assert(ORPHANS_SET == RICHNESS_SET);
- assert(ORPHANS_SET == STRESS_SET);
- assert(ORPHANS_SET == WIDOWS_SET);
+ assert(ORPHANS_SET ==
+ (enum op_orphans)
+ PITCH_RANGE_SET);
+ assert(ORPHANS_SET ==
+ (enum op_orphans)
+ RICHNESS_SET);
+ assert(ORPHANS_SET ==
+ (enum op_orphans)
+ STRESS_SET);
+ assert(ORPHANS_SET ==
+ (enum op_orphans)
+ WIDOWS_SET);
switch (value) {
case ORPHANS_SET:
@@ -1821,15 +1890,20 @@
break;
case CSS_PROP_PAGE_BREAK_AFTER:
case CSS_PROP_PAGE_BREAK_BEFORE:
- assert(PAGE_BREAK_AFTER_AUTO ==
+ assert(PAGE_BREAK_AFTER_AUTO ==
+ (enum op_page_break_after)
PAGE_BREAK_BEFORE_AUTO);
assert(PAGE_BREAK_AFTER_ALWAYS ==
+ (enum op_page_break_after)
PAGE_BREAK_BEFORE_ALWAYS);
assert(PAGE_BREAK_AFTER_AVOID ==
+ (enum op_page_break_after)
PAGE_BREAK_BEFORE_AVOID);
assert(PAGE_BREAK_AFTER_LEFT ==
+ (enum op_page_break_after)
PAGE_BREAK_BEFORE_LEFT);
assert(PAGE_BREAK_AFTER_RIGHT ==
+ (enum op_page_break_after)
PAGE_BREAK_BEFORE_RIGHT);
switch (value) {
12 years, 4 months
r12443 mono - in /trunk/netsurf/atari: Makefile.target browser.c global_evnt.c gui.c nkcc.h nkcc.s nkccgc.c toolbar.c treeview.c
by netsurf@semichrome.net
Author: mono
Date: Tue May 24 16:44:20 2011
New Revision: 12443
URL: http://source.netsurf-browser.org?rev=12443&view=rev
Log:
Removed dependency to cflib,
call EvntWindom only one time per sec. when active flag is set.
Added:
trunk/netsurf/atari/nkcc.h (with props)
trunk/netsurf/atari/nkcc.s (with props)
trunk/netsurf/atari/nkccgc.c (with props)
Modified:
trunk/netsurf/atari/Makefile.target
trunk/netsurf/atari/browser.c
trunk/netsurf/atari/global_evnt.c
trunk/netsurf/atari/gui.c
trunk/netsurf/atari/toolbar.c
trunk/netsurf/atari/treeview.c
Modified: trunk/netsurf/atari/Makefile.target
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/Makefile.target?rev...
==============================================================================
--- trunk/netsurf/atari/Makefile.target (original)
+++ trunk/netsurf/atari/Makefile.target Tue May 24 16:44:20 2011
@@ -5,10 +5,8 @@
$(eval $(call feature_enabled,MNG,-DWITH_MNG,-lmng,PNG/MNG/JNG (libmng)))
$(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng) ))
-LDFLAGS += -lcflib
-
CFLAGS += -DATARI_USE_FREETYPE $(shell freetype-config --cflags)
-LDFLAGS += $(shell freetype-config --libs)
+LDFLAGS += -lfreetype
# define additional CFLAGS and LDFLAGS requirements for pkg-configed libs here
NETSURF_FEATURE_RSVG_CFLAGS := -DWITH_RSVG
@@ -16,10 +14,11 @@
NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
+#LDFLAGS += -lnsbmp -lnsgif
$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF))
-CFLAGS += -std=c99 -I. -Dsmall $(WARNFLAGS) -Dnsatari \
+CFLAGS += -U__STRICT_ANSI__ -std=c99 -I. -Dsmall $(WARNFLAGS) -Dnsatari \
-D_BSD_SOURCE \
-D_XOPEN_SOURCE=600 \
-D_POSIX_C_SOURCE=200112L \
@@ -27,9 +26,10 @@
$(shell xml2-config --cflags) \
$(shell curl-config --cflags)
-LDFLAGS += $(shell curl-config --libs)
-LDFLAGS += $(shell $(PKG_CONFIG) --libs libhubbub openssl libcss)
-LDFLAGS += -L/usr/lib/ -lxml2 -lz -lHermes -liconv -L/usr/lib -lwindom -lgem -lm
+LDFLAGS += -lcurl
+LDFLAGS += -lhubbub -lcss -lparserutils -lwapcaplet
+LDFLAGS += -lssl -lcrypto
+LDFLAGS += -lxml2 -lz -liconv -lHermes -lwindom -lgem -lm
# S_ATARI are sources purely for the Atari FreeMiNT build
@@ -39,7 +39,8 @@
plot.c plot/plotter.c plot/plotter_vdi.c plot/eddi.s \
plot/font_vdi.c plot/font_freetype.c plot/font_internal.c \
browser_win.c toolbar.c statusbar.c browser.c \
- global_evnt.c osspec.c dragdrop.c system_colour.c
+ global_evnt.c osspec.c dragdrop.c system_colour.c \
+ nkccgc.c nkcc.s
S_ATARI := $(addprefix atari/,$(S_ATARI))
Modified: trunk/netsurf/atari/browser.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/browser.c?rev=12443...
==============================================================================
--- trunk/netsurf/atari/browser.c (original)
+++ trunk/netsurf/atari/browser.c Tue May 24 16:44:20 2011
@@ -24,7 +24,6 @@
#include <stdbool.h>
#include <assert.h>
#include <windom.h>
-#include <cflib.h>
#include "desktop/gui.h"
#include "desktop/netsurf.h"
@@ -44,6 +43,7 @@
#include "atari/plot/plotter.h"
#include "atari/plot.h"
#include "atari/font.h"
+#include "atari/nkcc.h"
extern browser_mouse_state bmstate;
extern int mouse_click_time[3];
@@ -908,9 +908,14 @@
));
current_redraw_browser = b->bw;
-
+ struct rect a;
+ a.x0 = b->redraw.area.x0;
+ a.y0 = b->redraw.area.y0;
+ a.x1 = b->redraw.area.x1;
+ a.y1 = b->redraw.area.y1;
+
browser_window_redraw( b->bw, -b->scroll.current.x,
- -b->scroll.current.y, &b->redraw.area );
+ -b->scroll.current.y, &a );
current_redraw_browser = NULL;
}
@@ -1092,4 +1097,4 @@
}
return;
-}
+}
Modified: trunk/netsurf/atari/global_evnt.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/global_evnt.c?rev=1...
==============================================================================
--- trunk/netsurf/atari/global_evnt.c (original)
+++ trunk/netsurf/atari/global_evnt.c Tue May 24 16:44:20 2011
@@ -24,7 +24,6 @@
#include <stdbool.h>
#include <assert.h>
#include <windom.h>
-#include <cflib.h>
#include "desktop/gui.h"
#include "desktop/netsurf.h"
@@ -46,6 +45,7 @@
#include "atari/res/netsurf.rsh"
#include "atari/search.h"
#include "atari/options.h"
+#include "atari/nkcc.h"
extern const char * cfg_homepage_url;
extern struct gui_window *input_window;
Modified: trunk/netsurf/atari/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/gui.c?rev=12443&r1=...
==============================================================================
--- trunk/netsurf/atari/gui.c (original)
+++ trunk/netsurf/atari/gui.c Tue May 24 16:44:20 2011
@@ -29,7 +29,6 @@
#include <string.h>
#include <stdbool.h>
#include <windom.h>
-#include <cflib.h>
#include <hubbub/hubbub.h>
#include "content/urldb.h"
@@ -75,6 +74,7 @@
#include "atari/clipboard.h"
#include "atari/osspec.h"
#include "atari/search.h"
+#include "atari/nkcc.h"
#define TODO() (0)/*printf("%s Unimplemented!\n", __FUNCTION__)*/
@@ -93,6 +93,7 @@
int mouse_hold_start[3];
short last_drag_x;
short last_drag_y;
+long next_poll;
browser_mouse_state bmstate;
/* Comandline / Options: */
@@ -121,15 +122,13 @@
short aestop;
evnt.timer = schedule_run();
- if ( active || browser_reformat_pending )
- evnt.timer = 0;
wind_get( 0, WF_TOP, &aestop, &winloc[1], &winloc[2], &winloc[3]);
if( winloc[1] != _AESapid ){
aestop = 0;
}
- if(aestop > 0) {
+ if( (aestop > 0) && !active ) {
flags |= MU_M1;
wind_get( aestop, WF_WORKXYWH, &winloc[0],
&winloc[1], &winloc[2], &winloc[3] );
@@ -152,10 +151,18 @@
/*printf("time: %d, active: %d, pending: %d\n", evnt.timer,
active, browser_reformat_pending );*/
- if( evnt.timer > 0 ) {
+ if( active ) {
+ if( clock() >= next_poll ) {
+ evnt.timer = 0;
+ flags |= MU_TIMER;
+ EvntWindom( flags );
+ next_poll = clock() + CLOCKS_PER_SEC;
+ }
+ } else {
flags |= MU_TIMER;
- EvntWindom( flags );
- }
+ EvntWindom( flags );
+ }
+
struct gui_window * g;
for( g = window_list; g != NULL; g=g->next ) {
if( browser_redraw_required( g ) ){
Added: trunk/netsurf/atari/nkcc.h
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/nkcc.h?rev=12443&vi...
==============================================================================
--- trunk/netsurf/atari/nkcc.h (added)
+++ trunk/netsurf/atari/nkcc.h Tue May 24 16:44:20 2011
@@ -1,0 +1,185 @@
+/*
+ * $Id: nkcc.h,v 1.4 2010/10/16 21:21:51 hek Exp $
+ *
+ * XaAES - XaAES Ain't the AES (c) 1992 - 1998 C.Graham
+ * 1999 - 2003 H.Robbers
+ * 2004 F.Naumann & O.Skancke
+ *
+ * A multitasking AES replacement for FreeMiNT
+ *
+ * This file is part of XaAES.
+ *
+ * XaAES is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * XaAES is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XaAES; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * Project name : NORMALIZED KEY CODE CONVERTER (NKCC)
+ * Module name : Global definitions
+ * Symbol prefix: nkc
+ *
+ * Author : Harald Siegmund (HS)
+ * Co-Authors : Henk Robbers (Reductions for use in XaAES)
+ * Write access : HS
+ */
+
+#ifndef _nkcc_h
+#define _nkcc_h
+
+/* flags for NKCC initialization */
+
+#define NKI_BUTHND 0x00000001UL /* install button event handler */
+#define NKI_BHTOS 0x00000002UL /* additional flag: only if TOS has */
+ /* mouse click bug */
+#define NKI_NO200HZ 0x00000004UL /* don't install 200 Hz clock interrupt */
+ /* (this flag is ignored if the button */
+ /* event handler is being activated) */
+
+/* flag combinations for compatibility with old versions of NKCC */
+
+#define BE_ON NKI_BUTHND
+#define BE_OFF 0
+#define BE_TOS (NKI_BUTHND | NKI_BHTOS)
+
+
+/* flags for special key code handling */
+
+#define NKS_ALTNUM 0x00000001UL /* Alt + numeric pad -> ASCII */
+#define NKS_CTRL 0x00000002UL /* Control key emulation */
+ /* deadkey management: */
+#define NKS_D_CIRCUM 0x00010000UL /* ^ accent circumflex */
+#define NKS_D_TILDE 0x00020000UL /* ~ accent tilde */
+#define NKS_D_AGUI 0x00040000UL /* ' accent agui */
+#define NKS_D_GRAVE 0x00080000UL /* ` accent grave */
+#define NKS_D_UMLAUT 0x00100000UL /* ¹ umlaut */
+#define NKS_D_QUOTE 0x00200000UL /* " quote, synonym for umlaut */
+#define NKS_D_SMOERE 0x00400000UL /* ø smoerebroed */
+#define NKS_D_CEDIL 0x00800000UL /* , cedil */
+#define NKS_D_SLASH 0x01000000UL /* / slash, for scandinavian characters */
+#define NKS_DEADKEY 0xffff0000UL /* all deadkeys */
+
+/* NKCC key code flags */
+
+#define NKF_FUNC 0x8000 /* function */
+#define NKF_RESVD 0x4000 /* resvd, ignore it! */
+#define NKF_NUM 0x2000 /* numeric pad */
+#define NKF_CAPS 0x1000 /* CapsLock */
+#define NKF_ALT 0x0800 /* Alternate */
+#define NKF_CTRL 0x0400 /* Control */
+#define NKF_SHIFT 0x0300 /* any Shift key */
+#define NKF_LSH 0x0200 /* left Shift key */
+#define NKF_RSH 0x0100 /* right Shift key */
+
+#define NKF_IGNUM NKF_RESVD /* special flag for nkc_cmp() */
+
+/* special key codes for keys performing a function */
+
+#define NK_INVALID 0x00 /* invalid key code */
+#define NK_UP 0x01 /* cursor up */
+#define NK_DOWN 0x02 /* cursor down */
+#define NK_RIGHT 0x03 /* cursor right */
+#define NK_LEFT 0x04 /* cursor left */
+#define NK_M_PGUP 0x05 /* MAC Page up */
+#define NK_M_PGDOWN 0x06 /* MAC Page down */
+#define NK_M_END 0x07 /* reserved! */
+#define NK_BS 0x08 /* Backspace */
+#define NK_TAB 0x09 /* Tab */
+#define NK_ENTER 0x0a /* Enter */
+#define NK_INS 0x0b /* Insert */
+#define NK_CLRHOME 0x0c /* Clr/Home */
+#define NK_HOME 0x0c /* Clr/Home */
+#define NK_RET 0x0d /* Return */
+#define NK_HELP 0x0e /* Help */
+#define NK_UNDO 0x0f /* Undo */
+#define NK_F1 0x10 /* function key #1 */
+#define NK_F2 0x11 /* function key #2 */
+#define NK_F3 0x12 /* function key #3 */
+#define NK_F4 0x13 /* function key #4 */
+#define NK_F5 0x14 /* function key #5 */
+#define NK_F6 0x15 /* function key #6 */
+#define NK_F7 0x16 /* function key #7 */
+#define NK_F8 0x17 /* function key #8 */
+#define NK_F9 0x18 /* function key #9 */
+#define NK_F10 0x19 /* function key #10 */
+#define NK_RVD1A 0x1a /* reserved! */
+#define NK_ESC 0x1b /* Esc */
+#define NK_RVD1C 0x1c /* reserved! */
+#define NK_RVD1D 0x1d /* reserved! */
+#define NK_RVD1E 0x1e /* reserved! */
+#define NK_DEL 0x1f /* Delete */
+
+ /* terminator for key code tables */
+#define NK_TERM ((int)(NKF_FUNC | NK_INVALID))
+
+/* ASCII codes less than 32 */
+
+#define NUL 0x00 /* Null */
+#define SOH 0x01 /* Start Of Header */
+#define STX 0x02 /* Start Of Text */
+#define ETX 0x03 /* End Of Text */
+#define EOT 0x04 /* End Of Transmission */
+#define ENQ 0x05 /* Enquiry */
+#define ACK 0x06 /* positive Acknowledgement */
+#define BEL 0x07 /* Bell */
+#define BS 0x08 /* BackSpace */
+#define HT 0x09 /* Horizontal Tab */
+#define LF 0x0a /* Line Feed */
+#define VT 0x0b /* Vertical Tab */
+#define FF 0x0c /* Form Feed */
+#define CR 0x0d /* Carriage Return */
+#define SO 0x0e /* Shift Out */
+#define SI 0x0f /* Shift In */
+#define DLE 0x10 /* Data Link Escape */
+#define DC1 0x11 /* Device Control 1 */
+#define XON 0x11 /* same as DC1 */
+#define DC2 0x12 /* Device Control 2 */
+#define DC3 0x13 /* Device Control 3 */
+#define XOFF 0x13 /* same as DC3 */
+#define DC4 0x14 /* Device Control 4 */
+#define NAK 0x15 /* Negative Acknowledgement */
+#define SYN 0x16 /* Synchronize */
+#define ETB 0x17 /* End of Transmission Block */
+#define CAN 0x18 /* Cancel */
+#define EM 0x19 /* End of Medium */
+#define SUB 0x1a /* Substitute */
+#define ESC 0x1b /* Escape */
+#define FS 0x1c /* Form Separator */
+#define GS 0x1d /* Group Separator */
+#define RS 0x1e /* Record Separator */
+#define US 0x1f /* Unit Separator */
+
+/* XBRA vector link/unlink modes */
+
+#define NKXM_NUM 0 /* by vector number */
+#define NKXM_ADR 1 /* by vector address */
+
+/* additional flag in event mask */
+
+#define MU_XTIMER 0x100
+
+
+/* deinstall NKCC */
+int nkc_exit(void);
+
+/* from cflib */
+short nkc_init(void);
+
+unsigned short nkc_tos2n(long toskey);
+unsigned short gem_to_norm(short ks, short kr);
+
+/* XaAES used names */
+#define nkc_tconv nkc_tos2n
+#define normkey gem_to_norm
+
+#endif /* _nkcc_h */
Propchange: trunk/netsurf/atari/nkcc.h
------------------------------------------------------------------------------
svn:executable = *
Added: trunk/netsurf/atari/nkcc.s
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/nkcc.s?rev=12443&vi...
==============================================================================
--- trunk/netsurf/atari/nkcc.s (added)
+++ trunk/netsurf/atari/nkcc.s Tue May 24 16:44:20 2011
@@ -1,0 +1,1067 @@
+|*
+|* $Id: nkcc-gc.S,v 1.2 2011/05/16 08:43:20 alanh Exp $
+|*
+|* XaAES - XaAES Ain't the AES (c) 1992 - 1998 C.Graham
+|* 1999 - 2003 H.Robbers
+|* 2004 F.Naumann & O.Skancke
+|*
+|* A multitasking AES replacement for FreeMiNT
+|*
+|* This file is part of XaAES.
+|*
+|* XaAES is free software; you can redistribute it and/or modify
+|* it under the terms of the GNU General Public License as published by
+|* the Free Software Foundation; either version 2 of the License, or
+|* (at your option) any later version.
+|*
+|* XaAES is distributed in the hope that it will be useful,
+|* but WITHOUT ANY WARRANTY; without even the implied warranty of
+|* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+|* GNU General Public License for more details.
+|*
+|* You should have received a copy of the GNU General Public License
+|* along with XaAES; if not, write to the Free Software
+|* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+|*
+|***************************************************************************
+|
+| reduced NKCC for the CF-Lib
+| GNU-C compatible version
+|
+|***************************************************************************
+
+|***************************************************************************
+| ASSEMBLER CONTROL SECTION
+|***************************************************************************
+
+VERSION = 0x0294 | NKCC's version
+
+NKFf_FUNC = 0x8000
+NKFf_RESVD = 0x4000
+NKFf_NUM = 0x2000
+NKFf_CAPS = 0x1000
+NKFf_ALT = 0x0800
+NKFf_CTRL = 0x0400
+NKFf_SHIFT = 0x0300 | both shift keys
+
+NKFb_FUNC = 15 | function
+NKFb_RESVD = 14 | reserved, ignore it!
+NKFb_NUM = 13 | numeric pad
+NKFb_CAPS = 12 | CapsLock
+NKFb_ALT = 11 | Alternate
+NKFb_CTRL = 10 | Control
+NKFb_LSH = 9 | left Shift key
+NKFb_RSH = 8 | right Shift key
+
+NK_UP = 0x01 | cursor up
+NK_DOWN = 0x02 | cursor down
+NK_RIGHT = 0x03 | cursor right
+NK_LEFT = 0x04 | cursor left
+NK_M_PGUP = 0x05 | Mac: page up
+NK_M_PGDOWN = 0x06 | Mac: page down
+NK_M_END = 0x07 | Mac: end
+NK_INS = 0x0b | Insert
+NK_CLRHOME = 0x0c | Clr/Home
+NK_HELP = 0x0e | Help
+NK_UNDO = 0x0f | Undo
+NK_M_F11 = 0x1a | Mac: function key #11
+NK_M_F12 = 0x1c | Mac: function key #12
+NK_M_F14 = 0x1d | Mac: function key #14
+NK_ENTER = 0x0a | Enter
+NK_DEL = 0x1f | Delete
+
+|***************************************************************************
+| EXPORT
+|***************************************************************************
+
+ .globl _nkc_init | init NKCC
+ .globl _nkc_tos2n | TOS key code converter
+ .globl _nkc_n2tos | NKC to TOS key code converter
+ .globl _nkc_toupper | convert character to upper case
+ .globl _nkc_tolower | convert character to lower case
+
+|***************************************************************************
+| LOCAL TEXT SECTION
+|***************************************************************************
+
+|***************************************************************************
+|
+| nk_findscan: find scan code
+|
+|***************************************************************************
+
+nk_findscan:
+ btst #NKFb_NUM,d0 | on numeric keypad?
+ beqs search | no ->
+
+ moveql #0x4a,d1 | yes: try all numeric keypad
+#ifdef __mcoldfire__
+ cmpb a0@(d1:l),d0 | scan codes first
+#else
+ cmpb a0@(d1:w),d0 | scan codes first
+#endif
+ beqs found1 | it matches ->
+
+ moveql #0x4e,d1
+#ifdef __mcoldfire__
+ cmpb a0@(d1:l),d0
+#else
+ cmpb a0@(d1:w),d0
+#endif
+ beqs found1
+
+ moveql #0x63,d1 | block starts at 0x63
+
+numsearch:
+#ifdef __mcoldfire__
+ cmpb a0@(d1:l),d0 | match?
+#else
+ cmpb a0@(d1:w),d0 | match?
+#endif
+ beqs found1 | yes ->
+
+#ifdef __mcoldfire__
+ addql #1,d1 | next scan code
+#else
+ addqw #1,d1 | next scan code
+#endif
+ cmpw #0x73,d1 | block end at 0x72
+ bcss numsearch | continue search ->
+
+search:
+ moveql #1,d1 | start with first valid scan code
+
+mainsearch:
+#ifdef __mcoldfire__
+ cmpb a0@(d1:l),d0 | match?
+#else
+ cmpb a0@(d1:w),d0 | match?
+#endif
+ beqs found1 | yes ->
+
+#ifdef __mcoldfire__
+ addql #1,d1 | next scan code
+#else
+ addqb #1,d1 | next scan code
+#endif
+ cmpb #0x78,d1 | 0x78 = last valid scan code
+ bcss mainsearch | continue search ->
+
+ moveql #0,d1 | not found
+ rts
+
+found1:
+ tstw d1 | found set CCR
+ rts
+
+|***************************************************************************
+| GLOBAL TEXT SECTION
+|***************************************************************************
+
+|***************************************************************************
+|
+| nkc_init: initialize NKCC
+|
+|***************************************************************************
+
+_nkc_init:
+|------------- fetch addresses of TOS' key scan code translation tables
+
+ moveql #-1,d0 | the function is also used to
+ movel d0,sp@- | change the addresses| values
+ movel d0,sp@- | of -1 as new addresses tell
+ movel d0,sp@- | XBIOS not to change them
+ movew #0x10,sp@- | Keytbl
+ trap #14 | XBIOS
+ lea sp@(0xe),sp | clean stack
+
+ movel d0,a0 | ^key table structure
+ movel a0@+,pkey_unshift | get ^unshifted table
+ movel a0@+,pkey_shift | get ^shifted table
+ movel a0@,pkey_caps | get ^CapsLock table
+
+exit1:
+ movew #VERSION,d0 | load version #
+ rts | bye
+
+|***************************************************************************
+|
+| nkc_tconv: TOS key code converter
+|
+|***************************************************************************
+
+_nkc_tos2n:
+ movel sp@(4), d0 | Parameter via Stack!
+#ifdef __mcoldfire__
+ lea sp@(-12),sp
+ movem.l d2-d4,sp@ | store registers
+#else
+ movem.l d2-d4,sp@- | store registers
+#endif
+
+|------------- separate TOS key code
+
+ movel d0,d1 | TOS key code
+ swap d1 | .W = scan code and flags
+ movew d1,d2 | copy
+#ifdef __mcoldfire__
+ movel #0xff,d3 | and-mask
+ andl d3,d0 | .B = ASCII code
+ andl d3,d1 | .B = scan code
+#else
+ movew #0xff,d3 | and-mask
+ andw d3,d0 | .B = ASCII code
+ andw d3,d1 | .B = scan code
+#endif
+ beq tos306 | scancode=zero (key code created
+ | by ASCII input of TOS 3.06)? ->
+#ifdef __mcoldfire__
+ andl #0x1f00,d2 | .W = key flags (in high byte)
+#else
+ andw #0x1f00,d2 | .W = key flags (in high byte)
+#endif
+
+|------------- decide which translation table to use
+
+ movew d2,d3 | key flags
+#ifdef __mcoldfire__
+ andl #NKFf_SHIFT,d3 | isolate bits for shift keys
+#else
+ andw #NKFf_SHIFT,d3 | isolate bits for shift keys
+#endif
+ beqs ktab11 | shift key pressed? no->
+
+ movel pkey_shift,a0 | yes: use shift table
+ bras ktab13 | ->
+
+ktab11:
+ btst #NKFb_CAPS,d2 | CapsLock?
+ beqs ktab12 | no->
+
+ movel pkey_caps,a0 | yes: use CapsLock table
+ bras ktab13 | ->
+
+ktab12:
+ movel pkey_unshift,a0 | use unshifted table
+
+|------------- check if scan code is out of range
+|
+| Illegal scancodes can be used to produce 'macro key codes'. Their format is:
+|
+| - the scancode must be 0x84 or larger (should be 0xff to work properly with old
+| versions of Mag!x)
+| - the ASCII code must be in the range 0x20...0xff (values below are set to 0x20
+| by NKCC)
+| - Alternate and Control are not used for the normalized key code. However,
+| if at least one of them is non-zero, then the numeric keypad flag will be
+| set in the resulting key code.
+|
+
+ktab13:
+ cmpb #0x84,d1 | illegal scan code?
+ bcss ktab14 | no ->
+
+ movew d2,d1 | flags
+| andw #NKFf_ALT|NKFf_CTRL,d1 | Alternate or Control?
+#ifdef __mcoldfire__
+ andl #0xc00,d1 | Alternate or Control?
+#else
+ andw #0xc00,d1 | Alternate or Control?
+#endif
+ beqs special | no ->
+
+#ifdef __mcoldfire__
+ orl #NKFf_NUM,d0 | yes: set numeric keypad flag
+#else
+ orw #NKFf_NUM,d0 | yes: set numeric keypad flag
+#endif
+| and #NKFf_CAPS|NKFf_SHIFT,d2 | mask off both flags
+#ifdef __mcoldfire__
+ andl #0x1300,d2 | mask off both flags
+#else
+ andw #0x1300,d2 | mask off both flags
+#endif
+
+special:
+#ifdef __mcoldfire__
+ orl d2,d0 | combine with ASCII code
+#else
+ orw d2,d0 | combine with ASCII code
+#endif
+| orw #NKFf_FUNC|NKFf_RESVD,d0 | set function and resvd
+#ifdef __mcoldfire__
+ orl #0x1300,d0 | set function and resvd
+#else
+ orw #0x1300,d0 | set function and resvd
+#endif
+ cmpb #0x20,d0 | ASCII code in range?
+ bcc exit2 | yes ->
+
+ moveb #0x20,d0 | no: use minimum
+ bra exit2 | ->
+
+|------------- check if Alternate + number: they have simulated scan codes
+
+ktab14:
+ cmpb #0x78,d1 | scan code of Alt + number?
+ bcss scan1 | no->
+
+#ifdef __mcoldfire__
+ subl #0x76,d1 | yes: calculate REAL scan code
+ moveb a0@(d1:l),d0 | fetch ASCII code
+ orl #NKFf_ALT,d2 | set Alternate flag
+#else
+ subb #0x76,d1 | yes: calculate REAL scan code
+ moveb a0@(d1:w),d0 | fetch ASCII code
+ orw #NKFf_ALT,d2 | set Alternate flag
+#endif
+ bra cat_codes | -> add flag byte and exit
+
+|------------- check if exception scan code from cursor keypad
+
+scan1:
+ lea xscantab,a1 | ^exception scan code table
+
+search_scan:
+ movew a1@+,d3 | NKC and scan code
+ bmis tabend | <0? end of table reached ->
+
+ cmpb d1,d3 | scan code found?
+ bnes search_scan | no: continue search ->
+
+#ifdef __mcoldfire__
+ lsrl #8,d3 | .B = NKC
+#else
+ lsrw #8,d3 | .B = NKC
+#endif
+ moveql #0,d0 | mark: key code found
+ bras scan2 | ->
+
+tabend:
+ moveql #0,d3 | no NKC found yet
+
+|------------- check if rubbish ASCII code and erase it, if so
+
+scan2:
+#ifdef __mcoldfire__
+ moveb a0@(d1:l),d4 | ASCII code from translation table
+#else
+ moveb a0@(d1:w),d4 | ASCII code from translation table
+#endif
+ cmpb #32,d0 | ASCII returned by TOS < 32?
+ bccs scan3 | no -> can't be rubbish
+
+ cmpb d4,d0 | yes: compare with table entry
+ beqs scan3 | equal: that's ok ->
+
+ moveql #0,d0 | not equal: rubbish! clear it
+
+|------------- check if ASCII code could only be produced via Alternate key
+| combination
+
+scan3:
+ tstb d0 | ASCII code valid?
+ beqs scan4 | no ->
+
+ cmpb d4,d0 | compare with table entry
+ beqs scan4 | equal: normal key ->
+
+| and #!NKFf_ALT,d2 | no: clear Alternate flag
+#ifdef __mcoldfire__
+ andl #0xF7FF,d2 | no: clear Alternate flag
+#else
+ andw #0xF7FF,d2 | no: clear Alternate flag
+#endif
+
+|------------- check if ASCII code found yet, and set it, if not
+
+scan4:
+ tstb d0 | found?
+ bnes scan5 | yes ->
+
+ moveb d3,d0 | no: use code from exception table
+ bnes scan5 | now valid? yes ->
+
+ moveb d4,d0 | no: use code from transl. table
+
+|------------- check special case: delete key
+
+scan5:
+ cmpb #127,d0 | ASCII code of Delete?
+ bnes scan6 | no ->
+
+ moveb #NK_DEL,d0 | yes: set according NKC
+
+|------------- check if key is on numeric keypad (via scan code)
+
+scan6:
+ cmpb #0x4a,d1 | numeric pad scan code range?
+ beqs numeric | yes ->
+
+ cmpb #0x4e,d1
+ beqs numeric | yes ->
+
+ cmpb #0x63,d1
+ bcss scan7 | no ->
+
+ cmpb #0x72,d1
+ bhis scan7 | no ->
+
+numeric:
+#ifdef __mcoldfire__
+ orl #NKFf_NUM,d2 | yes: set numeric bit
+#else
+ orw #NKFf_NUM,d2 | yes: set numeric bit
+#endif
+
+|------------- check if "function key" and set bit accordingly
+
+scan7:
+ cmpb #32,d0 | ASCII code less than 32?
+ bccs scan8 | no ->
+
+#ifdef __mcoldfire__
+ orl #NKFf_FUNC,d2 | yes: set function bit
+#else
+ orw #NKFf_FUNC,d2 | yes: set function bit
+#endif
+
+|------------- check special case: Return or Enter key
+
+ cmpb #13,d0 | Return or Enter key?
+ bnes scan8 | no ->
+
+ btst #NKFb_NUM,d2 | yes: from the numeric pad?
+ beqs scan8 | no -> it's Return, keep code
+
+ moveql #NK_ENTER,d0 | yes: it's Enter| new code
+
+|------------- check if function key (F1-F10) via scan code
+
+scan8:
+ cmpb #0x54,d1 | shift + function key?
+ bcss scan9 | no ->
+
+ cmpb #0x5d,d1
+ bhis scan9 | no ->
+
+#ifdef __mcoldfire__
+ subl #0x54-0x3b,d1 | yes: scan code for unshifted key
+#else
+ subb #0x54-0x3b,d1 | yes: scan code for unshifted key
+#endif
+ movew d2,d3 | shift flags
+#ifdef __mcoldfire__
+ andl #NKFf_SHIFT,d3 | any shift key flag set?
+#else
+ andw #NKFf_SHIFT,d3 | any shift key flag set?
+#endif
+ bnes scan9 | yes ->
+#ifdef __mcoldfire__
+ orl #NKFf_SHIFT,d2 | no: set both flags
+#else
+ orw #NKFf_SHIFT,d2 | no: set both flags
+#endif
+
+scan9:
+ cmpb #0x3b,d1 | (unshifted) function key?
+ bcss cat_codes | no ->
+
+ cmpb #0x44,d1
+ bhis cat_codes | no ->
+
+ moveb d1,d0 | yes: calc NKC
+#ifdef __mcoldfire__
+ subl #0x2b,d0
+#else
+ subb #0x2b,d0
+#endif
+
+|------------- final flag handling| mix key code (low byte) and flag byte
+
+cat_codes:
+ movel pkey_shift,a0 | ^shifted table
+#ifdef __mcoldfire__
+ moveb a0@(d1:l),d3 | get shifted ASCII code
+ orl d2,d0 | mix flags with key code
+ tst.w d0
+#else
+ moveb a0@(d1:w),d3 | get shifted ASCII code
+ orw d2,d0 | mix flags with key code
+#endif
+ bmis scan10 | result is "function key"? ->
+
+#ifdef __mcoldfire__
+ andl #NKFf_CTRL+NKFf_ALT,d2 | Control or Alternate pressed?
+#else
+ andw #NKFf_CTRL+NKFf_ALT,d2 | Control or Alternate pressed?
+#endif
+ bnes scan11 | yes ->
+
+scan10:
+ movel pkey_unshift,a0 | ^unshifted table
+#ifdef __mcoldfire__
+ cmpb a0@(d1:l),d3 | shifted ASCII = unshifted ASCII?
+#else
+ cmpb a0@(d1:w),d3 | shifted ASCII = unshifted ASCII?
+#endif
+ beqs scan12 | yes ->
+
+ bras exit2 | no ->
+
+scan11:
+#ifdef __mcoldfire__
+ orl #NKFf_FUNC,d0 | Alt/Ctrl + char: set function bit
+#else
+ orw #NKFf_FUNC,d0 | Alt/Ctrl + char: set function bit
+#endif
+ movel pkey_caps,a0 | ^CapsLock table
+#ifdef __mcoldfire__
+ cmpb a0@(d1:l),d3 | shifted ASCII = CapsLocked ASCII?
+#else
+ cmpb a0@(d1:w),d3 | shifted ASCII = CapsLocked ASCII?
+#endif
+ bnes exit2 | no ->
+
+ moveb d3,d0 | yes: use shifted ASCII code
+
+scan12:
+#ifdef __mcoldfire__
+ orl #NKFf_RESVD,d0 | yes: nkc_cmp() has to check
+#else
+ orw #NKFf_RESVD,d0 | yes: nkc_cmp() has to check
+#endif
+
+|------------- restore registers and exit
+
+exit2:
+ tstw d0 | set CCR
+#ifdef __mcoldfire__
+ movem.l sp@,d2-d4 | restore registers
+ lea sp@(12),sp
+#else
+ movem.l sp@+,d2-d4 | restore registers
+#endif
+ rts | bye
+
+|------------- special handling for key codes created by TOS' 3.06 ASCII input
+
+tos306:
+#ifdef __mcoldfire__
+ andl #NKFf_CAPS,d2 | isolate CapsLock flag
+ orl d2,d0 | merge with ASCII code
+ movem.l sp@,d2-d4 | restore registers
+ lea sp@(12),sp
+#else
+ andw #NKFf_CAPS,d2 | isolate CapsLock flag
+ orw d2,d0 | merge with ASCII code
+ movem.l sp@+,d2-d4 | restore registers
+#endif
+ rts | bye
+
+|***************************************************************************
+|
+| nkc_n2tos: convert normalized key codes back to TOS format
+|
+|***************************************************************************
+
+_nkc_n2tos:
+ movel sp@(4),d0 | Parameter ber Stack!
+
+ movew d0,d1 | normalized key code
+| and #NKFf_FUNC|NKFf_ALT|NKFf_CTRL,d1| isolate flags
+#ifdef __mcoldfire__
+ andl #0x8c00,d1 | isolate flags
+#else
+ andw #0x8c00,d1 | isolate flags
+#endif
+ cmpw #NKFf_FUNC,d1 | only function flag set?
+ bnes ktab20 | no ->
+
+ cmpb #0x20,d0 | ASCII code >= 0x20?
+ bcss ktab20 | no ->
+
+|------------- macro key
+
+ movew d0,d1 | keep normalized key code
+| andl #NKFf_CAPS|NKFf_SHIFT,d0 | isolate usable flags
+ andl #0x1300,d0 | mask off both flags
+ btst #NKFb_NUM,d1 | numeric keypad flag set?
+ beqs mackey | no ->
+
+| or #NKFf_ALT|NKFf_CTRL,d0 | yes: set Alternate + Control
+#ifdef __mcoldfire__
+ orl #0xc00,d1 | yes: set Alternate + Control?
+#else
+ orw #0xc00,d1 | yes: set Alternate + Control?
+#endif
+
+mackey:
+#ifdef __mcoldfire__
+ orl #0xff,d0 | scan code always 0xff
+#else
+ orb #0xff,d0 | scan code always 0xff
+#endif
+ swap d0 | flags and scan code in upper word
+ moveb d1,d0 | ASCII code
+ bra exit3 | ->
+
+|------------- select system key table to use
+
+ktab20:
+ movew d0,d1 | normalized key code
+#ifdef __mcoldfire__
+ andl #NKFf_SHIFT,d1 | isolate bits for shift keys
+#else
+ andw #NKFf_SHIFT,d1 | isolate bits for shift keys
+#endif
+ beqs ktab21 | shift key pressed? no->
+
+ lea n_to_scan_s,a1 | ^default translation table
+ movel pkey_shift,a0 | yes: use shift table
+ bras ktab23 | ->
+
+ktab21:
+ lea n_to_scan_u,a1 | ^unshifted translation table
+ btst #NKFb_CAPS,d0 | CapsLock?
+ beqs ktab22 | no->
+
+ movel pkey_caps,a0 | yes: use CapsLock table
+ bras ktab23 | ->
+
+ktab22:
+ movel pkey_unshift,a0 | use unshifted table
+
+|------------- handling for ASCII codes >= 32
+
+ktab23:
+ cmpb #32,d0 | ASCII code < 32?
+ bcss lowascii | yes ->
+
+ bsr nk_findscan | find scan code
+ bnes found2 | found ->
+
+ btst #NKFb_FUNC,d0 | function flag set?
+ beqs notfound | no ->
+
+ movel a0,d1 | save a0
+ lea tolower,a0 | ^upper->lower case table
+ moveql #0,d2 | clear for word operation
+ moveb d0,d2 | ASCII code
+#ifdef __mcoldfire__
+ moveb a0@(d2:l),d0 | get lowercased ASCII code
+#else
+ moveb a0@(d2:w),d0 | get lowercased ASCII code
+#endif
+ movel d1,a0 | restore a0
+ bsr nk_findscan | try to find scan code again
+ bnes found2 | found ->
+
+|------------- unknown source: treat key code as it was entered using the
+| TOS 3.06 direct ASCII input
+
+notfound:
+ moveql #0,d1 | not found: clear for word op.
+ moveb d0,d1 | unchanged ASCII code
+#ifdef __mcoldfire__
+ andl #0x1f00,d0 | keep shift flags only
+#else
+ andw #0x1f00,d0 | keep shift flags only
+#endif
+ swap d0 | -> high word (scan code = 0)
+ movew d1,d0 | low word: ASCII code
+ bra exit3 | ->
+
+|------------- handling for ASCII codes < 32
+
+lowascii:
+ btst #NKFb_FUNC,d0 | function key?
+ bnes func | yes ->
+
+#ifdef __mcoldfire__
+ andl #0xffff10ff,d0 | clear all flags except CapsLock
+#else
+ andw #0x10ff,d0 | clear all flags except CapsLock
+#endif
+ bras notfound | ->
+
+func:
+ moveql #0,d1 | clear for word operation
+ moveb d0,d1 | ASCII code (0...0x1f)
+ movew d1,d2 | copy
+#ifdef __mcoldfire__
+ moveb a1@(d1:l),d1 | get scan code
+#else
+ moveb a1@(d1:w),d1 | get scan code
+#endif
+ bnes getascii | valid? ->
+
+ moveq #0,d0 | invalid key code!! return 0
+ bra exit3 | ->
+
+getascii:
+ lea n_to_scan_u,a1 | ^unshifted translation table
+#ifdef __mcoldfire__
+ moveb a1@(d2:l),d2 | get scan code from unshifted tab.
+ moveb a0@(d2:l),d0 | get ASCII from system's table
+#else
+ moveb a1@(d2:w),d2 | get scan code from unshifted tab.
+ moveb a0@(d2:w),d0 | get ASCII from system's table
+#endif
+
+| register contents:
+|
+| d0.b ASCII code
+| d1.b scan code
+| d0.hb NKCC flags
+|
+
+found2:
+ movew d0,d2 | flags and ASCII code
+#ifdef __mcoldfire__
+ andl #0x1f00,d0 | isolate shift flags
+#else
+ andw #0x1f00,d0 | isolate shift flags
+#endif
+ moveb d1,d0 | merge with scan code
+ swap d0 | -> high byte
+ clrw d0 | erase low word
+ moveb d2,d0 | restore ASCII code
+
+|------------- handling for Control key flag
+
+ btst #NKFb_CTRL,d2 | control key flag set?
+ beqs alternate | no ->
+
+ cmpb #0x4b,d1 | scan code = "cursor left"?
+ bnes scanchk2 | no ->
+
+ addl #0x280000,d0 | change scan code to 0x73
+ clrb d0 | erase ASCII code
+ bras exit3 | ->
+
+scanchk2:
+ cmpb #0x4d,d1 | scan code = "cursor right"?
+ bnes scanchk3 | no ->
+
+ addl #0x270000,d0 | change scan code to 0x74
+ clrb d0 | erase ASCII code
+ bras exit3 | ->
+
+scanchk3:
+ cmpb #0x47,d1 | scan code = "ClrHome"?
+ bnes ascchk | no ->
+
+ addl #0x300000,d0 | change scan code to 0x77
+| keep ASCII code in this case! What a mess...
+ bras exit3 | ->
+
+ascchk:
+ lea asc_trans,a0 | ^ASCII translation table
+
+ascloop:
+ movew a0@+,d1 | get next entry
+ beqs noctrlasc | end of table ->
+
+ cmpb d0,d1 | ASCII code found?
+ bnes ascloop | no -> continue search
+
+#ifdef __mcoldfire__
+ lsrl #8,d1 | yes: get translated code
+#else
+ lsrw #8,d1 | yes: get translated code
+#endif
+ moveb d1,d0 | use it
+ bras exit3 | ->
+
+noctrlasc:
+#ifdef __mcoldfire__
+ andl #0x1f,d0 | mask off upper 3 bits
+#else
+ andb #0x1f,d0 | mask off upper 3 bits
+#endif
+ bras exit3 | ->
+
+|------------- handling for Alternate key flag
+
+alternate:
+ btst #NKFb_ALT,d2 | alternate key flag set?
+ beqs exit3 | no ->
+
+ cmpb #2,d1 | top row on main keyboard?
+ bcss alphachk | no ->
+
+ cmpb #0xd,d1
+ bhis alphachk | no ->
+
+ addl #0x760000,d0 | yes: change scan code
+ clrb d0 | and erase ASCII code
+ bras exit3 | ->
+
+alphachk:
+ cmpb #65,d0 | alpha-characters?
+ bcss exit3 | no ->
+
+ cmpb #122,d0
+ bhis exit3 | no ->
+
+ cmpb #90,d0
+ blss ascii0 | yes ->
+
+ cmpb #97,d0
+ bcss exit3 | no ->
+
+ascii0:
+ clrb d0 | alpha-character: clear ASCII code
+
+exit3:
+ tstw d0 | set CCR
+ rts | bye
+
+
+|***************************************************************************
+|
+| nkc_toupper: convert character to upper case
+|
+|***************************************************************************
+
+_nkc_toupper:
+ movel sp@(4),d1 | Parameter via Stack!
+ lea toupper,a0 | ^upper case translation table
+#ifdef __mcoldfire__
+ andl #0xff,d1 | high byte = 0 for word operation
+#else
+ andw #0xff,d1 | high byte = 0 for word operation
+#endif
+ moveb a0@(d1:l),d0 | convert
+ rts | bye
+
+|***************************************************************************
+|
+| nkc_tolower: convert character to lower case
+|
+|***************************************************************************
+
+_nkc_tolower:
+ movel sp@(4),d1 | Parameter via Stack!
+ lea tolower,a0 | ^lower case translation table
+#ifdef __mcoldfire__
+ andl #0xff,d1 | high byte = 0 for word operation
+#else
+ andw #0xff,d1 | high byte = 0 for word operation
+#endif
+ moveb a0@(d1:l),d0 | convert
+ rts | bye
+
+|***************************************************************************
+| LOCAL DATA SECTION
+|***************************************************************************
+
+ .data
+
+| exception scan code table for cursor block keys
+|
+| first entry.B: NKCC key code
+| second entry.B: scan code returned by TOS
+|
+| the table is terminated with both entries -1
+
+xscantab:
+ .byte NK_UP , 0x48 | cursor up
+ .byte NK_DOWN , 0x50 | cursor down
+ .byte NK_LEFT , 0x4b | cursor left
+ .byte NK_LEFT , 0x73 | Control cursor left
+ .byte NK_RIGHT , 0x4d | cursor right
+ .byte NK_RIGHT , 0x74 | Control cursor right
+ .byte NK_M_PGUP , 0x49 | Mac: page up
+ .byte NK_M_PGDOWN , 0x51 | Mac: page down
+ .byte NK_M_END , 0x4f | Mac: end
+ .byte NK_INS , 0x52 | Insert
+ .byte NK_CLRHOME , 0x47 | ClrHome
+ .byte NK_CLRHOME , 0x77 | Control ClrHome
+ .byte NK_HELP , 0x62 | Help
+ .byte NK_UNDO , 0x61 | Undo
+ .byte NK_M_F11 , 0x45 | Mac: F11
+ .byte NK_M_F12 , 0x46 | Mac: F12
+ .byte NK_M_F14 , 0x37 | Mac: F14
+ .word -1
+
+| lower case to upper case conversion table
+| (array of 256 unsigned bytes)
+toupper:
+ .byte 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07
+ .byte 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f
+ .byte 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17
+ .byte 0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f
+ .byte 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27
+ .byte 0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F
+ .byte 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37
+ .byte 0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F
+ .byte 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47
+ .byte 0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F
+ .byte 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57
+ .byte 0x58,0x59,0x5A,0x5B,0x5c,0x5D,0x5E,0x5F
+ .byte 0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47
+ .byte 0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F
+ .byte 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57
+ .byte 0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F
+ .byte 0x80,0x9A,0x90,0x83,0x8E,0xB6,0x8F,0x80
+ .byte 0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F
+ .byte 0x90,0x92,0x92,0x93,0x99,0x95,0x96,0x97
+ .byte 0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F
+ .byte 0xA0,0xA1,0xA2,0xA3,0xA5,0xA5,0xA6,0xA7
+ .byte 0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF
+ .byte 0xB7,0xB8,0xB2,0xB2,0xB5,0xB5,0xB6,0xB7
+ .byte 0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF
+ .byte 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7
+ .byte 0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF
+ .byte 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7
+ .byte 0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF
+ .byte 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7
+ .byte 0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF
+ .byte 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7
+ .byte 0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF
+
+
+| upper case to lower case conversion table
+| (array of 256 unsigned bytes)
+tolower:
+ .byte 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07
+ .byte 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f
+ .byte 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17
+ .byte 0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f
+ .byte 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27
+ .byte 0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F
+ .byte 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37
+ .byte 0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F
+ .byte 0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67
+ .byte 0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F
+ .byte 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77
+ .byte 0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F
+ .byte 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67
+ .byte 0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F
+ .byte 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77
+ .byte 0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F
+ .byte 0x87,0x81,0x82,0x83,0x84,0x85,0x86,0x87
+ .byte 0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x84,0x86
+ .byte 0x82,0x91,0x91,0x93,0x94,0x95,0x96,0x97
+ .byte 0x98,0x94,0x81,0x9B,0x9C,0x9D,0x9E,0x9F
+ .byte 0xA0,0xA1,0xA2,0xA3,0xA4,0xA4,0xA6,0xA7
+ .byte 0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF
+ .byte 0xB0,0xB1,0xB3,0xB3,0xB4,0xB4,0x85,0xB0
+ .byte 0xB1,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF
+ .byte 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7
+ .byte 0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF
+ .byte 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7
+ .byte 0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF
+ .byte 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7
+ .byte 0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF
+ .byte 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7
+ .byte 0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF
+
+
+| ASCII code translation table for Control key
+|
+| first entry.B: modified ASCII code returned by TOS
+| second entry.B: original ASCII code as stored in key table
+|
+| The table is terminated with both entries 0
+
+asc_trans:
+ .byte 0,0x32 | Control '2' becomes ASCII 0
+ .byte 0x1e,0x36 | Control '6' becomes ASCII 0x1e
+ .byte 0x1f,0x2d | Control '-' becomes ASCII 0x1f
+ .byte 0xa,0xd | Control Return/Enter: 0xd -> 0xa
+ .word 0 | terminator
+
+
+| normalized key code -> scan code translation table
+| for unshifted key codes
+| indexed by function code (NK_...)
+
+n_to_scan_u:
+ .byte 0x00 | invalid key code
+ .byte 0x48 | cursor up
+ .byte 0x50 | cursor down
+ .byte 0x4d | cursor right
+ .byte 0x4b | cursor left
+ .byte 0x49 | Mac: page up
+ .byte 0x51 | Mac: page down
+ .byte 0x4f | Mac: end
+ .byte 0x0e | Backspace
+ .byte 0x0f | Tab
+ .byte 0x72 | Enter
+ .byte 0x52 | Insert
+ .byte 0x47 | ClrHome
+ .byte 0x1c | Return
+ .byte 0x62 | Help
+ .byte 0x61 | Undo
+ .byte 0x3b | function key #1
+ .byte 0x3c | function key #2
+ .byte 0x3d | function key #3
+ .byte 0x3e | function key #4
+ .byte 0x3f | function key #5
+ .byte 0x40 | function key #6
+ .byte 0x41 | function key #7
+ .byte 0x42 | function key #8
+ .byte 0x43 | function key #9
+ .byte 0x44 | function key #10
+ .byte 0x45 | Mac: F11
+ .byte 0x01 | Esc
+ .byte 0x46 | Mac: F12
+ .byte 0x37 | Mac: F14
+ .byte 0x00 | reserved!
+ .byte 0x53 | Delete
+
+| normalized key code -> scan code translation table
+| for shifted key codes
+| indexed by function code (NK_...)
+
+n_to_scan_s:
+ .byte 0x00 | invalid key code
+ .byte 0x48 | cursor up
+ .byte 0x50 | cursor down
+ .byte 0x4d | cursor right
+ .byte 0x4b | cursor left
+ .byte 0x49 | Mac: page up
+ .byte 0x51 | Mac: page down
+ .byte 0x4f | Mac: end
+ .byte 0x0e | Backspace
+ .byte 0x0f | Tab
+ .byte 0x72 | Enter
+ .byte 0x52 | Insert
+ .byte 0x47 | ClrHome
+ .byte 0x1c | Return
+ .byte 0x62 | Help
+ .byte 0x61 | Undo
+ .byte 0x54 | function key #1
+ .byte 0x55 | function key #2
+ .byte 0x56 | function key #3
+ .byte 0x57 | function key #4
+ .byte 0x58 | function key #5
+ .byte 0x59 | function key #6
+ .byte 0x5a | function key #7
+ .byte 0x5b | function key #8
+ .byte 0x5c | function key #9
+ .byte 0x5d | function key #10
+ .byte 0x45 | Mac: F11
+ .byte 0x01 | Esc
+ .byte 0x46 | Mac: F12
+ .byte 0x37 | Mac: F14
+ .byte 0x00 | reserved!
+ .byte 0x53 | Delete
+
+|***************************************************************************
+| LOCAL BSS SECTION
+|***************************************************************************
+
+| .bss
+
+pkey_unshift:
+ .long 1 | ^unshifted key table
+
+pkey_shift:
+ .long 1 | ^shifted key table
+
+pkey_caps:
+ .long 1 | ^CapsLock table
Propchange: trunk/netsurf/atari/nkcc.s
------------------------------------------------------------------------------
svn:executable = *
Added: trunk/netsurf/atari/nkccgc.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/nkccgc.c?rev=12443&...
==============================================================================
--- trunk/netsurf/atari/nkccgc.c (added)
+++ trunk/netsurf/atari/nkccgc.c Tue May 24 16:44:20 2011
@@ -1,0 +1,48 @@
+/*
+ * $Id: nkcc.c,v 1.4 2010/10/16 21:21:51 hek Exp $
+ *
+ * XaAES - XaAES Ain't the AES (c) 1992 - 1998 C.Graham
+ * 1999 - 2003 H.Robbers
+ * 2004 F.Naumann & O.Skancke
+ *
+ * A multitasking AES replacement for FreeMiNT
+ *
+ * This file is part of XaAES.
+ *
+ * XaAES is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * XaAES is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XaAES; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "atari/nkcc.h"
+//#include "nkcc.h"
+
+
+unsigned short
+gem_to_norm (short ks, short kr)
+{
+ unsigned short knorm;
+
+ knorm = nkc_tos2n (((long) (kr & 0xff) | /* ascii Bits 0-7 */
+ (((long) kr & 0x0000ff00L) << 8L) | /* scan Bits 16-23 */
+ ((long) (ks & 0xff) << 24L))); /* kstate Bits 24-31 */
+ return knorm;
+}
+
+
+int
+nkc_exit(void)
+{
+ /* dummy */
+ return 0;
+}
Propchange: trunk/netsurf/atari/nkccgc.c
------------------------------------------------------------------------------
svn:executable = *
Modified: trunk/netsurf/atari/toolbar.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/toolbar.c?rev=12443...
==============================================================================
--- trunk/netsurf/atari/toolbar.c (original)
+++ trunk/netsurf/atari/toolbar.c Tue May 24 16:44:20 2011
@@ -25,7 +25,6 @@
#include <stdlib.h>
#include <stdbool.h>
#include <windom.h>
-#include <cflib.h>
#include <assert.h>
#include <math.h>
@@ -44,6 +43,7 @@
#include "atari/clipboard.h"
#include "atari/misc.h"
#include "atari/global_evnt.h"
+#include "atari/nkcc.h"
#include "atari/res/netsurf.rsh"
#include "atari/plot/plotter.h"
Modified: trunk/netsurf/atari/treeview.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/treeview.c?rev=1244...
==============================================================================
--- trunk/netsurf/atari/treeview.c (original)
+++ trunk/netsurf/atari/treeview.c Tue May 24 16:44:20 2011
@@ -22,7 +22,6 @@
#include <string.h>
#include <time.h>
#include <windom.h>
-#include <cflib.h>
#include "content/urldb.h"
#include "desktop/browser.h"
@@ -38,6 +37,7 @@
#include "atari/treeview.h"
#include "atari/plot.h"
#include "atari/misc.h"
+#include "atari/nkcc.h"
extern int mouse_hold_start[3];
extern browser_mouse_state bmstate;
12 years, 4 months