Commit b0b751dd authored by Neil Turton's avatar Neil Turton

Import from cleaned 360 CD

parents
| Copyright 1996 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 1996 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 1996 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 install INSTDIR=<install$dir>.HardDisc4.Apps
c/** gitlab-language=c linguist-language=c linguist-detectable=true
h/** gitlab-language=c linguist-language=c linguist-detectable=true
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.
# Copyright 1996 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 !Squash
#
# ***********************************
# *** C h a n g e L i s t ***
# ***********************************
# Date Name Description
# ---- ---- -----------
# 25-Oct-94 AMcC Updated for Black build
#
#
# Program specific options:
#
COMPONENT = Squash
APP = !${COMPONENT}
RDIR = Resources
LDIR = ${RDIR}.${LOCALE}
INSTDIR = ${INSTDIR}.${APP}
#
# Generic options:
#
MKDIR = cdir
AS = objasm
CC = cc
CMHG = cmhg
CP = copy
LD = link
RM = remove
SQUEEZE = squeeze
WIPE = -wipe
AFLAGS = ${THROWBACK} -depend !Depend -nocache -stamp -quit
CFLAGS = ${THROWBACK} -c -depend !Depend -fah ${INCLUDES} ${DFLAGS}
CPFLAGS = ~cfr~v
WFLAGS = ~c~v
#
# Libraries
#
CLIB = CLIB:o.stubs
RLIB = RISC_OSLib:o.risc_oslib
#
# Include files
#
INCLUDES = -IC:
DFLAGS =
FILES = \
${RDIR}.!Boot\
${LDIR}.!Help\
${LDIR}.!Run\
${LDIR}.!Sprites\
${LDIR}.!Sprites22\
${LDIR}.Messages\
${LDIR}.Templates\
abs.!RunImage\
abs.Squash
OBJS = squash.o main.o debug.o
#
# Rule patterns
#
.c.o:; ${CC} ${CFLAGS} -o $@ $<
#
# Main rules:
#
# Application
#
all: ${FILES}
@echo ${COMPONENT}: Application built (Disc)
install: ${FILES}
${MKDIR} ${INSTDIR}
${CP} ${RDIR}.!Boot ${INSTDIR}.!Boot ${CPFLAGS}
${CP} ${LDIR}.!Help ${INSTDIR}.!Help ${CPFLAGS}
${CP} ${LDIR}.!Run ${INSTDIR}.!Run ${CPFLAGS}
${CP} abs.!RunImage ${INSTDIR}.!RunImage ${CPFLAGS}
${CP} ${LDIR}.!Sprites ${INSTDIR}.!Sprites ${CPFLAGS}
${CP} ${LDIR}.!Sprites22 ${INSTDIR}.!Sprites22 ${CPFLAGS}
${CP} ${LDIR}.Messages ${INSTDIR}.Messages ${CPFLAGS}
${CP} abs.Squash ${INSTDIR}.Squash ${CPFLAGS}
${CP} ${LDIR}.Templates ${INSTDIR}.Templates ${CPFLAGS}
Access ${INSTDIR} /r
Access ${INSTDIR}.* lr/r
@echo ${COMPONENT}: Application installed (Disc)
clean:
${WIPE} o.* ${WFLAGS}
${RM} abs.!RunImage
${RM} abs.Squash
@echo ${COMPONENT}: cleaned
#
# Static dependencies:
#
abs.!RunImage: ${OBJS} ${RLIB} ${CLIB}
${LD} -o $@ ${OBJS} ${RLIB} ${CLIB}
${SQUEEZE} $@
abs.Squash: util.o
${LD} -o $@ util.o ${CLIB}
${SQUEEZE} $@
util.o: squash.c squash.h
${CC} ${CFLAGS} -o $@ -DUTILITY squash.c
#---------------------------------------------------------------------------
# Dynamic dependencies:
Iconsprites <Obey$Dir>.!Sprites
Set File$Type_FCA Squash
Set Alias$@RunType_FCA "Run <Obey$Dir>.!Run %%*0"
!Squash
=======
Squash is copyright © Acorn Computers, 1991.
!Squash is an application which compresses files using the RISC OS Squash
module. The Squash module currently compresses using a 12-bit LZW
algorithm but no guarantee is made that this will be so in the future.
To use !Squash simply double click on the !Squash icon in the relevant
directory display. This will install !Squash on the icon bar where the
!Squash icon should then appear.
Compressing a file
==================
To compress a file simply drag it to the !Squash icon on the icon bar.
A save box will then be displayed which will contain the file name, a file
icon and an OK button. The compressed file may be saved back to itself
(ie. it will replace the original) by pressing return or clicking on OK
without changing the file name. If the file name is changed or the file
icon is dragged to a directory viewer then the original file will be left
untouched.
Decompressing a file
====================
To decompress a file either double click on the compressed file or drag it
to the !Squash icon on the icon bar. Double clicking on a compressed file
will overwrite the compressed file with the decompressed file. Dragging to
the icon bar allows the decompressed file to be saved elsewhere.
Compressing and decompressing files and directories
===================================================
To compress or decompress a directory just drag the directory to the !Squash
icon on the icon bar. A save box will then be displayed which will contain
the file name, a file icon, an OK button and two toggle buttons. The toggle
buttons are used to specify whether the contents of the directory are to be
compressed or decompressed, otherwise the procedure is the same as for
compressing files.
Menu options
============
!Squash has one menu displayed by pressing Menu on the !Squash icon on the
icon bar. This menu contains four options:
Info: Displays some information about the version of !Squash which is
running.
Save Box: Toggles the use of the save box. The save box is switched on
initially which results in the manner of operation described
above. Sometimes, if a large selection is made and dragged to
the squash icon for example, it may not be desirable to have a
save box for every file or directory selected. This menu option
can be used to turn off the save box which means that all files
and directories will be replaced by their compressed versions.
Squash Apps: This is used to toggle the compressing of application
directories. This is initially off ie. application directories
which are found as a sub_directory of another directory are not
compressed. Application directories which are explicitly dragged
to the !Squash icon will always be compressed.
Quit: Terminates the !Squash application.
Squash utility program
======================
The !Squash directory also contains a utility called "Squash". This utility
can be copied to the Library directory and used on the command line to
compress files. The syntax is:
Squash <from-file> [<to-file>]
With a single file name the compressed or decompressed version of the file
replaces the original. With a second file name the result is written to the
specified file. Note that directories cannot be compressed using this
utility.
With both !Squash and the command line utility, if an attempt is made to
compress or decompress a zero length file or the result of a compression is
larger than the original (this can happen for very small files) then the
original file will simply be copied. If the original file was to be
replaced by the output then the original file is left untouched.
NB. Squash prepends a header to the compressed data. This header is of the
form:
4-byte ID: "SQSH"
1-word: length of the original, uncompressed file
1-word: load address of the original file
1-word: execution address of the original file
1-word: reserved (currently always 0)
Where the load and execution addresses are used to hold the file type and
the date stamp of the original file. These are restored when the file is
decompressed.
|
| This application is 1991, 1992, 1993 Acorn Computers Ltd.
| All Rights Reserved.
|
RMEnsure UtilityModule 3.60 Error This application is only suitable for use with RISC OS 3.60 or later versions
If "<Wimp$ScrapDir>" = "" Then Error 0 System scrap directory can not be found, set Wimp$ScrapDir.
RMEnsure SharedCLibrary 3.99 RMLoad System:Modules.CLib
RMEnsure SharedCLibrary 3.99 Error You need a newer Clib (v 3.99 or better) to run Squash.
RMEnsure MessageTrans 0.10 RMLoad System:Modules.MsgTrans
RMEnsure MessageTrans 0.10 Error You need MessageTrans (v 0.10 or better) to run Squash.
RMEnsure Squash 0.21 RMLoad System:Modules.Squash
RMEnsure Squash 0.21 Error You need a newer Squash module (v 0.21 or better) to run Squash.
Run <Obey$Dir>.!Boot
Set Squash$Dir <Obey$Dir>
Set Squash$Path <Obey$Dir>.
WimpSlot -Min 104k -Max 104k
WimpSlot -Min 96k -Max 96k
Run <Squash$Dir>.!RunImage %*0
#Messages for !Squash
TaskId:Squash
TaskSprite:!Squash
Version:0.49 (13-Dec-94)
#
Squash0:Out of store
Squash1:Invalid Squash header
Squash2:Unknown menu click
Squash3:To save, drag the icon to a directory display
#
HelpTxt:This is the !Squash icon.|MDrag files onto it to compress them.|MDouble-click on compressed files (or drag them here again) to decompress.
#
IconMenu:>Info,Save Box,Squash Apps,Quit
*
!.gitignore
File added
/* Copyright 1996 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.
*/
#include <stdarg.h>
#include "kernel.h"
#include "debug.h"
#ifdef DEBUG
void dprintf( const char *str, ... )
{
_kernel_swi_regs r;
va_list arg_pointer;
_kernel_swi( 0x60100, &r, &r );
va_start(arg_pointer, str );
vprintf( str, arg_pointer );
va_end( arg_pointer);
_kernel_swi( 0x60101, &r, &r );
}
#endif
/* Copyright 1996 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.
*/
/* -> c.main
* Wimp driver for the squash application.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "wimpt.h"
#include "res.h"
#include "resspr.h"
#include "dbox.h"
#include "menu.h"
#include "baricon.h"
#include "event.h"
#include "win.h"
#include "werr.h"
#include "template.h"
#include "xferrecv.h"
#include "xfersend.h"
#include "swis.h"
#include "msgs.h"
#include "flex.h"
#include "saveas.h"
#include "visdelay.h"
#include "kernel.h"
#include "squash.h"
#include "debug.h"
#define VERSION_FIELD 4
#define MAX_FILES 100
static char *app_name;
static menu icon_menu;
static int use_save_box = 1;
static int blocking = 0;
#ifdef RISCOS_200
static int to_free = -1;
#endif
static char *fname[MAX_FILES];
static int ftype[MAX_FILES];
static int ffirst = 0;
static int flast = 0;
static int squash_dirs = 1;
static int squash_apps = 0;
#ifndef RISCOS_200
static char *lookup_message(char *token)
{
char *cp = msgs_lookup(token);
char *text = malloc(strlen(cp) + 1);
if (text == NULL)
werr(1, "Squash: Out of store");
strcpy(text, cp);
return text;
}
static char *lookup_error(int errno)
{
char token[12];
sprintf(token, "Squash%d", errno);
return lookup_message(token);
}
/*
* Get error text (with possible parameter) for the specified error
* number and possibly terminate.
*/
void show_error_num(int fatal, int errno)
{
char *errmess;
if (errno > MAX_ERROR)
errno = 0;
errmess = lookup_error(errno);
werr(fatal, "%s: %s", app_name, errmess);
free(errmess);
}
#else
void show_error_num(int fatal, int errno)
{
if (errno > MAX_ERROR)
errno = 0;
werr(fatal, "%s: %s", app_name, error[errno]);
}
#endif
void show_error(int fatal, char *text, char *fname)
{
if (fname != NULL)
werr(fatal, "%s (object '%s'): %s", app_name, fname, text);
else
werr(fatal, "%s: %s", app_name, text);
}
/*
* Display info box (triggered by Info option in icon menu).
*/
static void program_info(void)
{
dbox d;
#ifdef RISCOS_200
char *version = SQUASH_VERS;
#else
char *version = lookup_message("Version");
#endif
/* Create the dialogue box */
if (d = dbox_new("ProgInfo"), d != NULL) {
dbox_setfield(d, VERSION_FIELD, version);
dbox_show(d);
dbox_fillin(d);
dbox_dispose(&d);
};
#ifndef RISCOS_200
free(version);
#endif
}
/*
* Handle icon menu selections.
*/
static void menu_proc(void *handle, char *hit)
{
/*
* Three entries in the menu, one for info leading to (read only) dialogue box,
* one for toggling the save box (useful for large numbers of files)
* and the other the standard quit selection.
*/
switch (hit[0]) {
case 1:
if (hit[1] != 0) program_info();
break;
case 2:
use_save_box = !use_save_box;
menu_setflags(icon_menu, 2, use_save_box, 0);
break;
case 3:
squash_apps = !squash_apps;
menu_setflags(icon_menu, 3, squash_apps, 0);
break;
case 4:
/* Quit */
free(app_name);
exit(0);
default:
/* Should never happen */
show_error_num(1, unknown_menu_click);
};
}
/*
* Clicking on the icon has no effect.
*/
static void icon_click(wimp_i icon)
{
/* No action on select */
}
/*
* Create the icon menu.
*/
static menu create_menu(void)
{
#ifdef RISCOS_200
char *menutext = ">Info,Save Box,Squash Apps,Quit";
#else
char *menutext = lookup_message("IconMenu");
char *sprite = lookup_message("TaskSprite");
#endif
menu handle = menu_new(app_name, menutext);
if (handle == NULL) return NULL;
baricon(sprite, (int)resspr_area(), icon_click);
if (!event_attachmenu(win_ICONBAR, handle, menu_proc, 0))