Commit 31c23583 authored by Stewart Brodie's avatar Stewart Brodie
Browse files

Removed TinyStubs from ROM build

Detail:
  Can't use __ctype with TinyStubs.
Admin:
  Built from clean; verified RAM build works.

Version 0.84. Tagged as 'HTTP-0_84'
parent 1f905a0f
/* (0.83)
/* (0.84)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 0.83
#define Module_MajorVersion_CMHG 0.84
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 24 Aug 1998
#define Module_Date_CMHG 16 Sep 1998
#define Module_MajorVersion "0.83"
#define Module_Version 83
#define Module_MajorVersion "0.84"
#define Module_Version 84
#define Module_MinorVersion ""
#define Module_Date "24 Aug 1998"
#define Module_Date "16 Sep 1998"
......@@ -65,49 +65,52 @@ static const char *dates_skipnumbers(const char *ptr)
static months dates_match_month(const char *ptr)
{
char const *mon = ptr;
months result = no_month;
switch (mon[0]) {
case 'J':
if (mon[1] == 'a' && mon[2] == 'n') return month_jan;
if (mon[1] != 'u') return no_month;
if (mon[2] == 'n') return month_jun;
if (mon[2] == 'l') return month_jul;
return no_month;
if (mon[1] == 'a' && mon[2] == 'n') result = month_jan;
else if (mon[1] != 'u') result = no_month;
else if (mon[2] == 'n') result = month_jun;
else if (mon[2] == 'l') result = month_jul;
break;
case 'F':
if (mon[1] == 'e' && mon[2] == 'b') return month_feb;
return no_month;
if (mon[1] == 'e' && mon[2] == 'b') result = month_feb;
break;
case 'M':
if (mon[1] != 'a') return no_month;
if (mon[2] == 'y') return month_may;
if (mon[2] == 'r') return month_mar;
return no_month;
if (mon[1] != 'a') result = no_month;
else if (mon[2] == 'y') result = month_may;
else if (mon[2] == 'r') result = month_mar;
break;
case 'A':
if (mon[1] == 'p' && mon[2] == 'r') return month_apr;
if (mon[1] == 'u' && mon[2] == 'g') return month_aug;
return no_month;
if (mon[1] == 'p' && mon[2] == 'r') result = month_apr;
else if (mon[1] == 'u' && mon[2] == 'g') result = month_aug;
break;
case 'S':
if (mon[1] == 'e' && mon[2] == 'p') return month_sep;
return no_month;
if (mon[1] == 'e' && mon[2] == 'p') result = month_sep;
break;
case 'O':
if (mon[1] == 'c' && mon[2] == 't') return month_oct;
return no_month;
if (mon[1] == 'c' && mon[2] == 't') result = month_oct;
break;
case 'N':
if (mon[1] == 'o' && mon[2] == 'v') return month_nov;
return no_month;
if (mon[1] == 'o' && mon[2] == 'v') result = month_nov;
break;
case 'D':
if (mon[1] == 'e' && mon[2] == 'c') return month_dec;
return no_month;
if (mon[1] == 'e' && mon[2] == 'c') result = month_dec;
break;
default:
return no_month;
break;
}
return result;
}
static weekdays dates_match_weekday(const char *ptr)
......
......@@ -44,8 +44,19 @@ volatile static int callback_pending_flag = 0;
#define CMHG_CONST const
#endif
/* TinySupport SWIs. This does not work if any library static data
* is used within the module. This means errno (__errno) and __ctype
* (as used by any macro call to is.... functions) If you re-enable
* this SWI call, this module will fail to work at all.
*/
#define NO_TINYSTUBS
#ifdef ROM
#ifndef NO_TINYSTUBS
static _kernel_oserror *__ROM;
#define TinySupport_Share (0x82c43)
#define TinySupport_Die (0x82c41)
#endif
#endif
#define NO_SUCH_SWI (0x1E6)
......@@ -190,8 +201,10 @@ _kernel_oserror *module_init(CMHG_CONST char *cmd_tail, int podule_base, void *p
(void) podule_base;
(void) cmd_tail;
#ifdef ROM
__ROM = _swix(0xa2c43, _IN(0), pw);
#ifdef ROM
#ifndef NO_TINYSTUBS
__ROM = _swix(TinySupport_Share, _IN(0), pw);
#endif
#endif
registered_http = 0;
......@@ -314,8 +327,10 @@ _kernel_oserror *module_kill(int fatal, int podule, void *pw)
(void) try_to_deregister();
#ifdef ROM
if(!__ROM) _swix(0xa2c41, 0);
#ifdef ROM
#ifndef NO_TINYSTUBS
if(!__ROM) _swix(TinySupport_Die, 0);
#endif
#endif
return NULL;
......
......@@ -13,71 +13,67 @@
* limitations under the License.
*/
/*
* Small quick and ready test of the HTTP module. Relies on there
* being a URL "http://www/" avaliable!
* HTTP (c.test)
*
* Copyright (C) Acorn Computers Ltd. 1997, 1998.
*
*
* ADH 06/08/97: Well, OK, it's way out of date now. But someone
* may find an adapted version useful in future, so
* I decided not to get rid of it.
*/
#include "stdio.h" /* file handling */
#include "stdlib.h" /* for malloc/calloc */
#include "kernel.h" /* registers */
#include "swis.h" /* swis */
#include "string.h" /* string handling */
#include "errno.h" /* Include errno variable */
#include "module.h" /* Module name etc */
#include <stdio.h> /* file handling */
#include <stdlib.h> /* for malloc/calloc */
#include <string.h> /* string handling */
#include <errno.h> /* Include errno variable */
#define URLBASE 0x83e00
#define URLREG URLBASE
#define URLGET URLBASE+1
#define URLSTAT URLBASE+2
#define URLREAD URLBASE+3
#define URLSETP URLBASE+4
#define URLSTOP URLBASE+5
#define URLDERE URLBASE+6
int main(int argc, char *argv[])
{
_kernel_swi_regs r;
char *url_to_get=argc>1?argv[1]:"http://www.acorn.com/acorn/";
char *buffer;
int pollword;
#define BUFFER_SIZE (10240)
buffer=calloc(10240,1);
static int URL_handle = 0;
r.r[0] = 0;
_kernel_swi(URLREG,&r,&r);
pollword=r.r[1];
r.r[0]=0;
r.r[1]=pollword;
r.r[2]=1;
r.r[3]=(int)url_to_get;
r.r[4]=0;
r.r[5]=2;
_kernel_swi(URLGET,&r,&r);
keep_trying:
static void die(void)
{
(void) _swix(URLDERE, _INR(0,1), 0, URL_handle);
}
r.r[0]=0;
r.r[1]=pollword;
r.r[2]=(int)buffer;
r.r[3]=10240;
_kernel_swi(URLREAD,&r,&r);
static _kernel_oserror *fail(_kernel_oserror *e)
{
if (e) {
(void) fprintf(stderr, "httptest: %s\n", e->errmess);
exit(1);
}
return 0;
}
printf("Registers:\n R0=%d\n*R1=%d\n R4=%d\nR5=%d",
r.r[0],*(int *)r.r[1],r.r[4],r.r[5]);
int main(int argc, char *argv[])
{
const char *url_to_get=argc>1?argv[1]:"http://www.acorn.com/browser/";
FILE *out=argc>2?fopen(argv[2],"wb"):stdout;
if ((r.r[4] == 0) && (r.r[0] <= 31)) goto keep_trying;
if (!out) {
fprintf(stderr, "Unable to open output file\n");
return 1;
}
buffer[r.r[4]]='\0';
printf("Dataread:\n>>>>%s<<<<\n",buffer);
fail(_swix(URLREG, _IN(0)|_OUT(1), 0, &URL_handle));
(void) atexit(die);
fail(_swix(URLGET, _INR(0,5), 0, URL_handle, 1, url_to_get, 0, 2));
if (r.r[0] <= 31) goto keep_trying;
for (;;) {
char buffer[BUFFER_SIZE];
int flags, done;
fail(_swix(URLREAD, _INR(0,3)|_OUT(0)|_OUT(4), 0, URL_handle, buffer,
sizeof(buffer), &flags, &done));
if (done>0) (void) fwrite(buffer, done, 1, out);
if (flags & 96) break;
}
r.r[1]=pollword;
_kernel_swi(URLDERE,&r,&r);
(void) fclose(out);
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment