Commit 50cbda38 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Put some unused files in the attic, unused in 13 years. Not tagged.

parent bd7ef5fe
Subject: SprExtend2
Author: David De Vorchik
History:
30-Jan-91 DDeVorchik Created.
05-Feb-91 DDeVorchik Extended exit params on read size.
This document covers changes made to SpriteExtend after v0.28, these include
the following:
* Adding, removing and checking sprite palettes.
SpriteReason_CreateRemovePalette
--------------------------------
in: r0 = 37, SpriteReason_CreateRemovePalette (+0 / +256 / +512)
r1 -> sprite control block
r2 -> sprite name / -> sprite
r3 = reason code
= -1 : read current palette size
= 0 : remove palette from sprite
<> 0 : add palette to sprite
out: V=1 => r0 -> error block
if r3 =-1 on entry then; r3 = size palette (=0 if none), else all preserved.
r4 -> palette (=0 if none)
r5 = mode
This call simply adds, removes or returns the size of a palette associated
with a given sprite.
It should be noted then when output is switched to a sprite and the palette
is added or removed from it the current display pointers will become invalid
so you should switch output away, modify the palete and switch output back
to the sprite.
/* 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.repeat - simple tool to do a CLI command to each thing in a directory */
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "kernel.h"
#include "swis.h"
#define _ ,
#define ERROR(message) {printf(message); exit(1);}
#define SYSERROR ERROR("Error: %s.\n" _ _kernel_last_oserror()->errmess)
#define CALL(expr) {_kernel_oserror *e_ = (expr); if (e_) ERROR("Error: %s\n" _ e_->errmess)}
#define BOOL int
#define TRUE 1
#define FALSE 0
static void enumerate(char *pathname, int include, int include_type, void(*callit)(char*,int))
/* include&1 -> allow directories
include&2 -> allow all files
include&3 -> allow files only of specified type
*/
{
char buffer[512];
int offset = 0;
int entrytype;
int type;
char namebuf[256];
char *a;
while (1)
{
CALL(_swix(OS_GBPB,_IN(0)+_IN(1)+_IN(2)+_IN(3)+_IN(4)+_IN(5)+_IN(6)+_OUT(4),
10, pathname, buffer, 1, offset, 512, 0, &offset))
if (offset == -1) break;
entrytype = ((int*)buffer)[4]; /* type of directory entry */
a = buffer + 20; /* ensure that it is well terminated */
while (*a > ' ') a++;
*a = 0;
strcpy(namebuf, pathname);
strcat(namebuf, ".");
strcat(namebuf, buffer + 20);
if (entrytype == 1) /* it's a file */
{
type = (((int*)buffer)[0] >> 8) & 0xfff;
if (include&2 || (include&3 && type == include_type))
/* this = make_dir_entry(buffer + 20, type); */
callit(namebuf, type);
}
else if (entrytype == 2) /* it's a directory or application */
{
if (include&1) /* this = make_dir_entry(buffer + 20, -1); */ callit(namebuf, -1);
}
}
}
static char *command;
static void obey_it(char *name, int type)
{
char a[256];
/* printf("obey_it %s %i\n", name, type); */
sprintf(a, "%s %s", command, name);
if (type != -1)
{
system(a);
/* CALL(_swix(OS_CLI, _IN(0), "If \"<Sys$ReturnCode>\"=\"1\" Then Error Error in called program")) */
CALL(_swix(OS_CLI, _IN(0), "If \"<Sys$ReturnCode>\"=\"1\" Then *Quit"))
}
if (type == -1) enumerate(name, 3, 0, obey_it);
}
int main(int argc, char **argv)
{
int arg = 1;
char *options = 0;
char *root = 0;
BOOL loop = FALSE;
BOOL verbose = FALSE;
command = 0;
while (argv[arg] != 0 && argv[arg][0] != 0)
{
if (argv[arg][0] == '-') options = argv[arg++] + 1;
else if (root == 0) root = argv[arg++];
else if (command == 0) command = argv[arg++];
if (options)
{
while (*options)
{
switch (*options++)
{
case 'L': case 'l': loop = TRUE; break;
case 'V': case 'v': verbose = TRUE; break;
}
}
options = 0;
}
}
if (verbose) printf("repeat (%s)\n", __DATE__);
if (verbose && root != 0) printf("root=%s\n", root);
if (verbose && command != 0) printf("cmd=%s\n", command);
if (root == 0 || command == 0) ERROR("Syntax: repeat [-l] <rootdir> <command>\n")
do enumerate(root, 3, 0, obey_it); while (loop);
return 0;
}
File deleted
File deleted
File deleted
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