Commit 96b70582 authored by Stewart Brodie's avatar Stewart Brodie
Browse files

Build process improvements :

* Standardised make process in common with other protocol modules.
* Resources put into standard structure for internationalisation
* Standard !MkClean, !MkRom, !MkRam to build different versions
parent 3b1e56ec
| Copyright 1998 Acorn Computers Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
amu_machine clean
| Copyright 1998 Acorn Computers Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
amu_machine all
| Copyright 1998 Acorn Computers Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
amu_machine rom
......@@ -2,4 +2,3 @@
c/** gitlab-language=c linguist-language=c linguist-detectable=true
h/** gitlab-language=c linguist-language=c linguist-detectable=true
cmhg/** gitlab-language=cmhg linguist-language=cmhg linguist-detectable=true
*,fe1 gitlab-language=make linguist-language=make linguist-detectable=true
# Copyright 1998 Acorn Computers Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Makefile for AcornHTTP
#
# ***********************************
# *** C h a n g e L i s t ***
# ***********************************
# Date Name Description
# ---- ---- -----------
# 10-Feb-98 SNB Created
#
#
# Component specific options:
#
COMPONENT = HTTP
ROM_MODULE = aof.${COMPONENT}
RAM_MODULE = rm.${COMPONENT}
RESFSDIR = Resources.URL.${COMPONENT}
#
# Export Paths for Messages module
#
RESDIR = <resource$dir>.Resources2.URL
#
# Generic options:
#
MKDIR = cdir
CC = cc
CMHG = cmhg
CP = copy
LD = link
TLD = tlink
RM = remove
WIPE = -wipe
CPFLAGS = ~cfr~v
WFLAGS = ~c~v
CFLAGS = -c -depend !Depend ${INCLUDES} -zM -Wp -ffah -zps1 ${DFLAGS}
DFLAGS = -D${SYSTEM} -DCOMPAT_INET4 -DCOOKIE -UTML -UTRACE
ROMFLAGS = -DROM
INCLUDES = -ITCPIPLibs:,C:
#
# Libraries
#
ANSILIB = CLib:o.ansilib
CLIB = CLIB:o.stubs
RLIB = RISCOSLIB:o.risc_oslib
ROMCSTUBS = RISCOSLIB:o.romcstubs
ABSSYM = RISC_OSLib:o.abssym
TCPIPLIBS = TCPIPLibs:o.inetlibzm TCPIPLIBS:o.socklibzm
OBJS =\
o.config\
o.connect\
o.connpool\
o.cookie\
o.dates\
o.dns\
o.generic\
o.header\
o.hosttrack\
o.module\
o.protocol\
o.readdata\
o.ses_ctrl\
o.start\
o.status\
o.stop\
o.URLclient\
o.utils\
o.writedata\
o.HTTPHdr
RAM_OBJS =\
o.config\
o.connect\
o.connpool\
o.cookie\
o.dates\
o.dns\
o.generic\
o.header\
o.hosttrack\
o.moduleRAM\
o.protocol\
o.readdata\
o.ses_ctrl\
o.start\
o.status\
o.stop\
o.URLclient\
o.utils\
o.writedata\
o.HTTPHdr
MSGSF=o.msgs
#
# Rule patterns
#
.c.o:; ${CC} ${CFLAGS} ${ROMFLAGS} -o $@ $<
.cmhg.o:; ${CMHG} -o $@ $< -d $*.h
HTTPHdr.h: HTTPHdr.o
@|
#
# Main rules:
#
#
all: ${RAM_MODULE}
@echo ${COMPONENT}: Module built (RAM)
rom: ${ROM_MODULE}
@echo ${COMPONENT}: Module built (ROM)
install_rom: ${ROM_MODULE}
${CP} ${ROM_MODULE} ${INSTDIR}.${COMPONENT} ${CPFLAGS}
@echo ${COMPONENT}: Module installed (ROM)
resources: Resources.${LOCALE}.Messages
${MKDIR} ${RESDIR}
${MKDIR} ${RESDIR}.${COMPONENT}
${CP} Resources.${LOCALE}.* ${RESDIR}.${COMPONENT}.* ${CPFLAGS}
@echo ${COMPONENT}: resource files copied to Messages module
clean:
${WIPE} o.* ${WFLAGS}
${WIPE} aof ${WFLAGS}
${WIPE} rm ${WFLAGS}
${WIPE} h.${COMPONENT}Hdr ${WFLAGS}
${WIPE} linked ${WFLAGS}
${WIPE} map ${WFLAGS}
@echo ${COMPONENT}: cleaned
${ROM_MODULE}: ${OBJS} ${ROMCSTUBS}
${MKDIR} aof
${LD} -o $@ -aof ${OBJS} ${TCPIPLIBS} ${ROMCSTUBS}
# final link for ROM Image (using given base address)
rom_link:
${MKDIR} linked
${MKDIR} map
${LD} -o linked.${COMPONENT} -bin -base ${ADDRESS} ${ROM_MODULE} ${ABSSYM} \
-map > map.${COMPONENT}
truncate map.${COMPONENT} linked.${COMPONENT}
${CP} linked.${COMPONENT} ${LINKDIR}.${COMPONENT} ${CPFLAGS}
@echo ${COMPONENT}: rom_link complete
${MSGSF}: @.Resources.${LOCALE}.Messages
resgen messages_file ${MSGSF} Resources.${LOCALE}.Messages ${RESFSDIR}.Messages
${RAM_MODULE}: ${RAM_OBJS} ${MSGSF} ${TCPIPLIBS}
${mkdir} rm
${TLD} -o $@ -module ${RAM_OBJS} ${MSGSF} ${TCPIPLIBS}
Access $@ RW/R
o.moduleRAM: module.c
$(CC) ${CFLAGS} -o $@ module.c
#---------------------------------------------------------------------------
# Dynamic dependencies:
# Copyright 1998 Acorn Computers Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Project: HTTPMOD
# Toolflags:
CCflags = -c -depend !Depend -ITCPIPLibs:,C:,Debug: -ffahu -throwback -DCOMPAT_INET4 -DCOOKIE -UTRACE -UTML -zps1 -zM -Wp
CCtflags = -c -depend !Depend -ITCPIPLibs:,C:,Debug: -fahn -throwback -DCOMPAT_INET4 -DCOOKIE -DTRACE -UTML -zps1 -zM -Wp
C++flags = -c -depend !Depend -IC: -throwback
Linkflags = -rmf -c++ -o $@
ObjAsmflags = -throwback -NoCache -depend !Depend
CMHGflags = -depend !Depend -p -throwback -IC: -d HTTP.h
LibFileflags = -c -o $@
Squeezeflags = -o $@
ExtraLibs = o.syslog-lib
SyslogExtraLibs = <syslog$dir>.c-veneer.o.syslog
# Final targets:
@.HTTP: @.o.module @.o.readdata @.o.ses_ctrl @.o.start @.o.status @.o.stop @.o.protocol \
@.o.writedata @.o.hosttrack @.o.connpool @.o.res @.o.utils @.o.generic \
@.o.URLclient @.o.config @.o.dates \
@.o.connect @.o.dns @.o.cookie @.o.header @.o.HttpHdr C:o.Stubs TCPIPLibs:o.inetlibzm \
TCPIPLibs:o.socklibzm
link $(linkflags) @.o.module @.o.readdata @.o.ses_ctrl @.o.start @.o.protocol \
@.o.writedata @.o.hosttrack @.o.connpool @.o.res @.o.utils @.o.generic \
@.o.URLclient @.o.config @.o.dates \
@.o.status @.o.dns @.o.cookie @.o.stop @.o.HttpHdr @.o.connect @.o.header C:o.stubs \
TCPIPLibs:o.inetlibzm TCPIPLibs:o.socklibzm
Access $@ WR/R
# User-editable dependencies:
@.o.res: @.Res.List @.Res.Messages
ResGen messages_file @.o.res -via @.Res.List
normal: @.HTTP
@|
trace: @.HTTP-tr
@|
@.HTTP-tr: @.od.module @.od.readdata @.od.ses_ctrl @.od.start @.od.status @.od.stop @.od.protocol \
@.od.writedata @.od.hosttrack @.od.connpool @.o.res @.od.utils @.od.generic \
$(ExtraLibs) @.od.URLclient @.od.config @.od.dates \
@.od.connect @.od.dns @.od.cookie @.od.header @.o.HttpHdr C:o.Stubs TCPIPLibs:o.inetlibzm \
TCPIPLibs:o.socklibzm
link $(linkflags) @.od.module @.od.readdata @.od.ses_ctrl @.od.start @.od.protocol \
@.od.writedata @.od.hosttrack @.od.connpool @.o.res @.od.utils @.od.generic \
$(ExtraLibs) @.od.URLclient @.od.config @.od.dates \
@.od.status @.od.dns @.od.cookie @.od.stop @.o.HttpHdr @.od.connect @.od.header C:o.Stubs \
TCPIPLibs:o.inetlibzm TCPIPLibs:o.socklibzm
.SUFFIXES: .c .o .od
.c.od:; cc $(cctflags) -o od.$* $*.c
.c.o:; cc $(ccflags) -o o.$* $*.c
$(ExtraLibs): $(SyslogExtraLibs)
libfile $(libfileflags) $(SyslogExtraLibs)
clean:
-wipe @.o.* ~v~cf~r
-wipe @.od.* ~v~cf~r
# Comment out the ExtraLibs at the top if you want to build without using !Syslog. You
# also need to uncomment the #define in protocol.c to allow debugging to be done via
# !Syslog. This was done because it is a lot faster than continually reopening
# writing and closing a disc file.
# Static dependencies:
@.o.HttpHdr @.h.Http: @.cmhg.HttpHdr
cmhg $(cmhgflags) -o @.o.HttpHdr @.cmhg.HttpHdr
# Dynamic dependencies:
@.Res.Messages Resources.HTTPFetcher.Messages
......@@ -27,7 +27,7 @@
#include "swis.h"
#include "module.h"
#include "header.h"
#include "http.h"
#include "httphdr.h"
#include "cookie.h"
#include "generic.h"
#include "protocol.h"
......
......@@ -15,7 +15,7 @@
/*
* HTTP (c.header)
*
* © Acorn Computers Ltd. 1997
* © Acorn Computers Ltd. 1997, 1998
*/
#include <stdio.h>
......@@ -29,13 +29,12 @@
#include "module.h"
#include "header.h"
#include "http.h"
#include "HTTPHdr.h"
#include "cookie.h"
#include "protocol.h"
#include "writedata.h"
#include "hosttrack.h"
#include "generic.h"
#include "HTTP.h"
/* NOTE: If you fix bugs in this code, bear in mind that the FTP module has a copy of
......
......@@ -15,7 +15,7 @@
/*
* HTTP (c.module)
*
* Acorn Computers Ltd. 1997
* Acorn Computers Ltd. 1997, 1998
*
*/
......@@ -25,7 +25,7 @@
#include "kernel.h"
#include "swis.h"
#include "sys/errno.h"
#include "HTTP.h"
#include "HTTPHdr.h"
#include "module.h"
#include "protocol.h"
#include "cookie.h"
......@@ -37,8 +37,23 @@
volatile static int callback_pending_flag = 0;
#ifdef ROM
static _kernel_oserror *__ROM;
#endif
#define NO_SUCH_SWI (0x1E6)
#define URL_PROTOCOL_REGISTER (0x83e20)
#define URL_PROTOCOL_DEREGISTER (0x83e21)
#ifndef ROM
extern int messages_file(void);
#endif
#ifndef ROM
int __errno;
#endif
/*************************************************************/
/* So the real error number that we have to return is: */
......@@ -61,10 +76,6 @@ typedef enum {
HTTP_PROXY_NOT_FOUND = HTTP_ERROR_NUM + 9 /* Unable to contact the proxy */
} http_internal_error_codes;
#define URL_PROTOCOL_REGISTER (0x83e20)
#define URL_PROTOCOL_DEREGISTER (0x83e21)
extern int messages_file(void);
/* Sets clibrary_realloc_routine_is_buggy non-zero if RISC OS 3.1 or earlier (ie. ROM realloc is broken) */
......@@ -109,8 +120,12 @@ static _kernel_oserror *register_with_url(void)
e = try_to_register();
if (e == NULL) return e;
if (e->errnum != NO_SUCH_SWI) return e;
#ifndef ROM
e = _swix(OS_Module, _INR(0,1), 1 /* Load */, "System:Modules.Network.URL.URL");
return try_to_register();
#else
return NULL;
#endif
}
/*************************************************************/
......@@ -125,6 +140,10 @@ _kernel_oserror *module_init(const char *cmd_tail, int podule_base, void *pw)
(void) podule_base;
(void) cmd_tail;
#ifdef ROM
__ROM = _swix(0xa2c43, _IN(0), pw);
#endif
registered = 0;
module_check_os_version();
config_init();
......@@ -135,19 +154,29 @@ _kernel_oserror *module_init(const char *cmd_tail, int podule_base, void *pw)
e = register_with_url();
if (e == NULL) {
#ifndef ROM
e = _swix(ResourceFS_RegisterFiles, _IN(0), messages_file());
#endif
if (e == NULL) {
e = messages_file_open("Resources:$.Resources.HTTPFetcher.Messages");
if (getenv(Module_Title "$Path")) {
e = messages_file_open(Module_Title ":Messages");
}
else {
e = messages_file_open("Resources:$.Resources.URL." "HTTP" ".Messages");
}
if (e == NULL) {
callback_pending_flag = 0;
e = _swix(OS_CallEvery, _INR(0,2), 5*100, callevery_entry, pw); /* 5 secs */
if (e != NULL) messages_file_close();
}
#ifndef ROM
if (e != NULL) (void) _swix(ResourceFS_DeregisterFiles, _IN(0), messages_file());
#endif
}
if (e != NULL) (void) try_to_deregister();
}
else {
#ifndef ROM
if (e->errnum == NO_SUCH_SWI) {
_kernel_oserror *newe = find_error();
const size_t length = strlen(strcpy(newe->errmess, e->errmess));
......@@ -156,6 +185,7 @@ _kernel_oserror *module_init(const char *cmd_tail, int podule_base, void *pw)
strncat(newe->errmess, " (Load the URL module)", sizeof(newe->errmess) - length);
e = newe;
}
#endif
}
if (e == NULL) {
......@@ -208,9 +238,16 @@ _kernel_oserror *module_kill(int fatal, int podule, void *pw)
http_free_agent();
messages_file_close();
#ifndef ROM
(void) _swix(ResourceFS_DeregisterFiles, _IN(0), messages_file());
#endif
(void) try_to_deregister();
#ifdef ROM
if(!__ROM) _swix(0xa2c41, 0);
#endif
return NULL;
}
......
......@@ -25,7 +25,7 @@
#include "swis.h"
#include "sys/errno.h"
#include "module.h"
#include "HTTP.h"
#include "HTTPHdr.h"
#include "socklib.h"
#include "protocol.h"
#include "cookie.h"
......
......@@ -41,7 +41,7 @@ static int messages_fd[4];
_kernel_oserror *find_error (void)
{
static _kernel_oserror global_error_block[ERR_BLOCKS] ={{0,0}};
static _kernel_oserror global_error_block[ERR_BLOCKS];
static int errblock = 0;
errblock = (errblock+1) % ERR_BLOCKS;
......
......@@ -21,7 +21,7 @@
title-string: AcornHTTP
; Version information
help-string: Acorn_HTTP 0.72
help-string: Acorn_HTTP 0.73
; Initialisation routine.
initialisation-code: module_init
......
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