Convert CR-->LF in sources; they were checked in with the wrong newline

delimiters.
This commit is contained in:
gdr-ftp 1998-12-13 02:50:33 +00:00
parent fd0aff2031
commit 7ec020a057
40 changed files with 6290 additions and 40 deletions

View File

@ -1 +1,61 @@
FilePort is a Port Driver that simply prints to a file (instead of a printer port). If you need to capture output from a printer driver to print something on a printer you don't own then this port driver might be what you're looking for. The only restriction that this software has is that appletalk printer drivers aren't supported (so don't try using this port driver with the laserwriter driver, you'll crash into the monitor). NullPort is another Port Driver - this port driver doesn't print to anything. It seems kind of strange, but this is actually very usefull. Especially when you want to time the performance of a printer driver. Almost everyone assumes the printer driver is the slow part, when actually the slowest portions of printing are typically the transfering of data to the printer and actually printing. This port driver can be used by anyone to time just about any printer driver (again, the laserwriter driver isn't supported). Requirements: An Apple IIGS with probably 1.5 meg of memory or more, possibly a hard disk drive and system software 5.0.4 or later. The FilePort driver uses a 64k buffer so you'll need at least that much free memory to be able to use it to print to a file. Installation: Copy all of the files in this archive to your system disk and put them in your system:drivers folder. Select the direct connect printer control panel document and choose FilePort (or NullPort) from the port driver list. To change the folder where printer data files will be generated, simply edit the FilePort.Data file with any text editor and change the pathname. These programs are FreeWare - Do anything you want to with them. The sources to these programs are available to programmers that are interested - simply send me a blank diskette (3.5" only) and a self addressed and stamped return diskette mailer. The sources are a collection or Orca/C and Orca/M. That brings up the runtime libraries of Orca/C so here goes: This program contains material from the Orca/C Run-Time Libraries, copyright 1987-1991 by Byte Works, Inc. Used with permission. I would also like Apple II DTS and Development for their Technotes on printer port drivers - without them I wouldn't have been able to write these drivers. If your computer does something strange with this software then please tell me about it - I'd be interested in what went wrong. If you want to get in contact with me, send regular mail to: Kopriha Software c/o Dave Koppper 81 Main Boulevard Shrewsbury, MA 01545-3146 My electronic mail addresses are: Internet: dave@mystie.webo.dg.com or dave%mystie.webo.dg.com@relay.cs.net GEnie: D.Kopper
FilePort is a Port Driver that simply prints to a file (instead of a
printer port). If you need to capture output from a printer driver
to print something on a printer you don't own then this port driver
might be what you're looking for. The only restriction that this
software has is that appletalk printer drivers aren't supported
(so don't try using this port driver with the laserwriter driver,
you'll crash into the monitor).
NullPort is another Port Driver - this port driver doesn't print to
anything. It seems kind of strange, but this is actually very usefull.
Especially when you want to time the performance of a printer driver.
Almost everyone assumes the printer driver is the slow part, when actually
the slowest portions of printing are typically the transfering of data
to the printer and actually printing. This port driver can be used by
anyone to time just about any printer driver (again, the laserwriter
driver isn't supported).
Requirements: An Apple IIGS with probably 1.5 meg of memory or more,
possibly a hard disk drive and system software 5.0.4 or later. The
FilePort driver uses a 64k buffer so you'll need at least that much
free memory to be able to use it to print to a file.
Installation: Copy all of the files in this archive to your system
disk and put them in your system:drivers folder. Select the direct
connect printer control panel document and choose FilePort (or NullPort)
from the port driver list. To change the folder where printer data
files will be generated, simply edit the FilePort.Data file with any
text editor and change the pathname.
These programs are FreeWare - Do anything you want to with them.
The sources to these programs are available to programmers that are
interested - simply send me a blank diskette (3.5" only) and a self
addressed and stamped return diskette mailer. The sources are a
collection or Orca/C and Orca/M. That brings up the runtime libraries
of Orca/C so here goes:
This program contains material from the Orca/C
Run-Time Libraries, copyright 1987-1991
by Byte Works, Inc. Used with permission.
I would also like Apple II DTS and Development for their Technotes
on printer port drivers - without them I wouldn't have been able to
write these drivers.
If your computer does something strange with this software then
please tell me about it - I'd be interested in what went wrong.
If you want to get in contact with me, send regular mail to:
Kopriha Software
c/o Dave Koppper
81 Main Boulevard
Shrewsbury, MA 01545-3146
My electronic mail addresses are:
Internet: dave@mystie.webo.dg.com
or dave%mystie.webo.dg.com@relay.cs.net
GEnie: D.Kopper

View File

@ -1 +1,29 @@
# # $Id: Makefile,v 1.1 1997/12/19 07:54:44 gdr Exp $ # # Devin Reade, December 1997 ODIR = obj INCLUDE = ../includes CFLAGS += -I$(INCLUDE) -w -v OBJS = $(ODIR)/port.o $(ODIR)/c.port.o $(ODIR)/errors.o $(ODIR)/errormsgs.o LDLIBS = -l ../support/libdvr HDRS = $(INCLUDE)/ks.fileio.e $(INCLUDE)/ks.defines.h \ $(INCLUDE)/portable.c.h $(INCLUDE)/ks.routines.h \ $(INCLUDE)/ks.memory.h build: $(ODIR) FilePort FilePort: $(OBJS) $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LDLIBS) chtyp -t187 -a2 $@ # 187 == 0xBB $(ODIR): install -d $(ODIR) $(ODIR)/%.o: %.c; $(CC) -o $@ -c $(CFLAGS) $< $(ODIR)/%.o: %.asm; $(CC) -o $@ -c $(CFLAGS) $< port.o:: port.macros c.port.o:: $(HDRS) errors.h errors.o:: $(INCLUDE)/portable.c.h errors.h
#
# $Id: Makefile,v 1.2 1998/12/13 02:47:36 gdr-ftp Exp $
#
# Devin Reade, December 1997
ODIR = obj
INCLUDE = ../includes
CFLAGS += -I$(INCLUDE) -w -v
OBJS = $(ODIR)/port.o $(ODIR)/c.port.o $(ODIR)/errors.o $(ODIR)/errormsgs.o
LDLIBS = -l ../support/libdvr
HDRS = $(INCLUDE)/ks.fileio.e $(INCLUDE)/ks.defines.h \
$(INCLUDE)/portable.c.h $(INCLUDE)/ks.routines.h \
$(INCLUDE)/ks.memory.h
build: $(ODIR) FilePort
FilePort: $(OBJS)
$(CC) -o $@ $(LDFLAGS) $(OBJS) $(LDLIBS)
chtyp -t187 -a2 $@
# 187 == 0xBB
$(ODIR):
install -d $(ODIR)
$(ODIR)/%.o: %.c; $(CC) -o $@ -c $(CFLAGS) $<
$(ODIR)/%.o: %.asm; $(CC) -o $@ -c $(CFLAGS) $<
port.o:: port.macros
c.port.o:: $(HDRS) errors.h
errors.o:: $(INCLUDE)/portable.c.h errors.h

File diff suppressed because one or more lines are too long

View File

@ -1 +1,103 @@
;*********************************************************************** ;* ;* Copyright (C) Kopriha Software, 1990 - 1991 ;* All rights reserved. ;* Licensed material -- property of Kopriha Software ;* ;* This software is made available solely pursuant to the terms ;* of a Kopriha Software license agreement which governs its use. ;* ;* ;* Memory copy of copyright notice ;* Error messages for FilePort Port Driver ;* ;* ;* Description: ;* The copyright notice is included for anyone that gets a copy of ;* this software and decides to disassemble it. ;* ;* The error messages are defined in assembler, because Orca/C makes ;* the errors take up extra space (i.e.: All strings must be of a ;* fixed length). In assembler, no such restriction exists... ;* ;* ;* History: April 13 Dave Created this module ;* ;* ;* ;*********************************************************************** case on Set case sensitivity in assembler objcase on Set case sensitivity in object gen off List generated code trace off List all macro generation dummy start Throw away *.root file end ;*********************************************************************** ;* copyright_strings data ;* ;*********************************************************************** ; First a copyright notice that will be in our executable... dc c'Copyright (C) Kopriha Software, 1990 - 1991 ' dc c'All rights reserved. ' dc c'Licensed material -- property of Kopriha Software ' dc c'This software is made available solely pursuant to the terms ' dc c'of a Kopriha Software license agreement which governs its use. ' dc c'**** If you are reading this message then I''ll assume that you ' dc c'are disassembling this program - Good Luck! It is a collection ' dc c'of Orca/C and Orca/M. If you would like a copy of the sources ' dc c'then send a self addressed diskette mailer with a ProDOS formatted ' dc c'diskette to me: Kopriha Software, c/o Dave Kopper, 81 Main ' dc c'Boulevard, Shrewsbury, MA 01545-3146 ****' ; Define pointers to all the error messages... error_strings entry dc a4'E0' dc a4'E1' dc a4'E2' dc a4'E3' dc a4'E4' dc a4'E5' dc a4'E6' dc a4'E7' dc a4'E8' dc a4'E9' dc a4'E10' dc a4'E11' dc a4'EI' ; Now define all the error message strings... E0 dc c'I can''t set the buffer size correctly',i1'0' E1 dc c'I can''t open the configuration file {FilePort.Data}',i1'0' E2 dc c'I can''t allocate the pathname buffer',i1'0' E3 dc c'I can''t read the configuration file {FilePort.Data}',i1'0' E4 dc c'I can''t open the FilePort output directory',i1'0' E5 dc c'I can''t get the FilePort output directory count',i1'0' E6 dc c'I can''t get the next FilePort output directory entry',i1'0' E7 dc c'I can''t create the FilePort output file. ' dc c'There are too many printer data files in the ' dc c'FilePort output directory. Delete at least one and ' dc c'print your document again.',i1'0' E8 dc c'I can''t create a FilePort output file',i1'0' E9 dc c'I can''t open the FilePort output file',i1'0' E10 dc c'I can''t write to the FilePort output file',i1'0' E11 dc c'The line printer daemon is not active',i1'0' EI dc c'Oops... Invalid error message number (programmer error)',i1'0' end ; End of Error message definitions
;***********************************************************************
;*
;* Copyright (C) Kopriha Software, 1990 - 1991
;* All rights reserved.
;* Licensed material -- property of Kopriha Software
;*
;* This software is made available solely pursuant to the terms
;* of a Kopriha Software license agreement which governs its use.
;*
;*
;* Memory copy of copyright notice
;* Error messages for FilePort Port Driver
;*
;*
;* Description:
;* The copyright notice is included for anyone that gets a copy of
;* this software and decides to disassemble it.
;*
;* The error messages are defined in assembler, because Orca/C makes
;* the errors take up extra space (i.e.: All strings must be of a
;* fixed length). In assembler, no such restriction exists...
;*
;*
;* History: April 13 Dave Created this module
;*
;*
;*
;***********************************************************************
case on Set case sensitivity in assembler
objcase on Set case sensitivity in object
gen off List generated code
trace off List all macro generation
dummy start Throw away *.root file
end
;***********************************************************************
;*
copyright_strings data
;*
;***********************************************************************
; First a copyright notice that will be in our executable...
dc c'Copyright (C) Kopriha Software, 1990 - 1991 '
dc c'All rights reserved. '
dc c'Licensed material -- property of Kopriha Software '
dc c'This software is made available solely pursuant to the terms '
dc c'of a Kopriha Software license agreement which governs its use. '
dc c'**** If you are reading this message then I''ll assume that you '
dc c'are disassembling this program - Good Luck! It is a collection '
dc c'of Orca/C and Orca/M. If you would like a copy of the sources '
dc c'then send a self addressed diskette mailer with a ProDOS formatted '
dc c'diskette to me: Kopriha Software, c/o Dave Kopper, 81 Main '
dc c'Boulevard, Shrewsbury, MA 01545-3146 ****'
; Define pointers to all the error messages...
error_strings entry
dc a4'E0'
dc a4'E1'
dc a4'E2'
dc a4'E3'
dc a4'E4'
dc a4'E5'
dc a4'E6'
dc a4'E7'
dc a4'E8'
dc a4'E9'
dc a4'E10'
dc a4'E11'
dc a4'EI'
; Now define all the error message strings...
E0 dc c'I can''t set the buffer size correctly',i1'0'
E1 dc c'I can''t open the configuration file {FilePort.Data}',i1'0'
E2 dc c'I can''t allocate the pathname buffer',i1'0'
E3 dc c'I can''t read the configuration file {FilePort.Data}',i1'0'
E4 dc c'I can''t open the FilePort output directory',i1'0'
E5 dc c'I can''t get the FilePort output directory count',i1'0'
E6 dc c'I can''t get the next FilePort output directory entry',i1'0'
E7 dc c'I can''t create the FilePort output file. '
dc c'There are too many printer data files in the '
dc c'FilePort output directory. Delete at least one and '
dc c'print your document again.',i1'0'
E8 dc c'I can''t create a FilePort output file',i1'0'
E9 dc c'I can''t open the FilePort output file',i1'0'
E10 dc c'I can''t write to the FilePort output file',i1'0'
E11 dc c'The line printer daemon is not active',i1'0'
EI dc c'Oops... Invalid error message number (programmer error)',i1'0'
end ; End of Error message definitions

View File

@ -1 +1,145 @@
/* * Copyright (c) Kopriha Software, 1991 * All Rights Reserved * * Errors.CC * * Description: * This module is the heart of the file support of the * printer port driver. * * * Table of Contents: * * error_dialog . . . . . . . . . Display an error dialog for * our user - return whatever * button they click on. * * * History:April 13, 1991 Dave Created this file * */ #pragma noroot /* * define DEBUG_CODE * - add # to define to create the local * debug code (IE:module) */ #include <stdio.h> #include "errors.h" #ifndef __WINDOW__ #include <Window.h> #endif char error_string1[80]; Pointer substitute_array[10]; extern Pointer error_strings[NUMBER_OF_ERROR_CODES+1]; /* ****************************************************************** * * error_dialog - display an error dialog and return the selected * * button (typically the 'Ok' button). * * * * History: April 13, 1991 Dave Created this routine * * ****************************************************************** */ #define ROUTINE_NAME "error_dialog" Word error_dialog(Word error_message, Word error_code) { Word button; /* ************************************************************** * * Check for validity of the error code - if it is not a known * * error code then we will use the 'invalid error' message. * * ************************************************************** */ if ((error_message < 0) || (error_message > NUMBER_OF_ERROR_CODES)) { error_message = NUMBER_OF_ERROR_CODES+1; }; /* ************************************************************** * * Setup the substitution strings... * * ************************************************************** */ /* ************************************************************** * * Check if the window manager is active or not... * * ************************************************************** */ if (WindStatus() != 0) { /* ********************************************************** * * The window manager is available... so we are allowed to * * put up a simple alert window. Setup the substitution * * array and put up the dialog... * * ********************************************************** */ if (error_message == TOO_MANY_SPOOLFILES) { sprintf(error_string1, "32/FilePort error - *0/^#0", error_code); } else { sprintf(error_string1, "32/FilePort error - *0 (error code $%X)/^#0", error_code); }; substitute_array[0] = (Pointer) error_strings[ ((error_message >= 0) || (error_message < NUMBER_OF_ERROR_CODES)) ? error_message : (NUMBER_OF_ERROR_CODES+1)]; button = AlertWindow((Word) 0, (Pointer) &substitute_array, (Ref) error_string1); } else /* ********************************************************** * * The window manager isn't active... that means we can't * * put up a simple alertwindow... print the error strings * * out to standard out... lets hope a user sees it. * * ********************************************************** */ { printf("FilePort error - %s", (char *) error_strings[ ((error_message >= 0) || (error_message < NUMBER_OF_ERROR_CODES)) ? error_message : (NUMBER_OF_ERROR_CODES+1)]); if (error_message != TOO_MANY_SPOOLFILES) { printf(" (error code $%X)\n", error_code); }; button = 0; } /* ************************************************************** * * Return the button that was pressed. * * ************************************************************** */ return(button); } /* End of error_dialog() */
/*
* Copyright (c) Kopriha Software, 1991
* All Rights Reserved
*
* Errors.CC
*
* Description:
* This module is the heart of the file support of the
* printer port driver.
*
*
* Table of Contents:
*
* error_dialog . . . . . . . . . Display an error dialog for
* our user - return whatever
* button they click on.
*
*
* History:April 13, 1991 Dave Created this file
*
*/
#pragma noroot
/*
* define DEBUG_CODE
* - add # to define to create the local
* debug code (IE:module)
*/
#include <stdio.h>
#include "errors.h"
#ifndef __WINDOW__
#include <Window.h>
#endif
char error_string1[80];
Pointer substitute_array[10];
extern Pointer error_strings[NUMBER_OF_ERROR_CODES+1];
/* ****************************************************************** *
* error_dialog - display an error dialog and return the selected *
* button (typically the 'Ok' button). *
* *
* History: April 13, 1991 Dave Created this routine *
* ****************************************************************** */
#define ROUTINE_NAME "error_dialog"
Word error_dialog(Word error_message, Word error_code)
{
Word button;
/* ************************************************************** *
* Check for validity of the error code - if it is not a known *
* error code then we will use the 'invalid error' message. *
* ************************************************************** */
if ((error_message < 0) || (error_message > NUMBER_OF_ERROR_CODES))
{
error_message = NUMBER_OF_ERROR_CODES+1;
};
/* ************************************************************** *
* Setup the substitution strings... *
* ************************************************************** */
/* ************************************************************** *
* Check if the window manager is active or not... *
* ************************************************************** */
if (WindStatus() != 0)
{
/* ********************************************************** *
* The window manager is available... so we are allowed to *
* put up a simple alert window. Setup the substitution *
* array and put up the dialog... *
* ********************************************************** */
if (error_message == TOO_MANY_SPOOLFILES)
{
sprintf(error_string1,
"32/FilePort error - *0/^#0",
error_code);
}
else
{
sprintf(error_string1,
"32/FilePort error - *0 (error code $%X)/^#0",
error_code);
};
substitute_array[0] = (Pointer) error_strings[
((error_message >= 0) ||
(error_message < NUMBER_OF_ERROR_CODES)) ?
error_message :
(NUMBER_OF_ERROR_CODES+1)];
button = AlertWindow((Word) 0,
(Pointer) &substitute_array,
(Ref) error_string1);
}
else
/* ********************************************************** *
* The window manager isn't active... that means we can't *
* put up a simple alertwindow... print the error strings *
* out to standard out... lets hope a user sees it. *
* ********************************************************** */
{
printf("FilePort error - %s", (char *) error_strings[
((error_message >= 0) ||
(error_message < NUMBER_OF_ERROR_CODES)) ?
error_message :
(NUMBER_OF_ERROR_CODES+1)]);
if (error_message != TOO_MANY_SPOOLFILES)
{
printf(" (error code $%X)\n", error_code);
};
button = 0;
}
/* ************************************************************** *
* Return the button that was pressed. *
* ************************************************************** */
return(button);
} /* End of error_dialog() */

View File

@ -1 +1,81 @@
/* * Copyright (c) Kopriha Software, 1991 * All Rights Reserved * * Errors.H * * Description: This include file contains all the error * code definitions required for this program. * * * Table of contents: * * Macros: * * ERROR_DIALOG() . . . . . . . . Display an error dialog and * wait for the user to choose * an option (usually only one). * * * History:April 13, 1991 Dave Created this file * */ #ifndef _ERROR_ #define _ERROR_ #ifndef __TYPES__ #include <types.h> #endif #ifndef _PORTABLE_C_ #include "Portable.C.h" #endif /* ****************************************************************** * * Error code definitions for this product: * * ****************************************************************** */ #define BAD_BUFFER_SIZE 0 #define CANT_OPEN_CONFIG_FILE BAD_BUFFER_SIZE+1 #define CANT_ALLOCATE_PATHNAME CANT_OPEN_CONFIG_FILE+1 #define CANT_READ_PATHNAME CANT_ALLOCATE_PATHNAME+1 #define CANT_OPEN_DIR CANT_READ_PATHNAME+1 #define CANT_GET_ENTRY_COUNT CANT_OPEN_DIR+1 #define CANT_GET_NEXT_FILE CANT_GET_ENTRY_COUNT+1 #define TOO_MANY_SPOOLFILES CANT_GET_NEXT_FILE+1 #define CANT_CREATE_SPOOL_FILE TOO_MANY_SPOOLFILES+1 #define CANT_OPEN_SPOOL_FILE CANT_CREATE_SPOOL_FILE+1 #define CANT_WRITE_DATA CANT_OPEN_SPOOL_FILE+1 #define DAEMON_NOT_ACTIVE CANT_WRITE_DATA+1 #define NUMBER_OF_ERROR_CODES DAEMON_NOT_ACTIVE+1 /* ****************************************************************** * * Macro definitions: * * ****************************************************************** */ /* * ERROR_DIALOG - display an error dialog (with string substitution). * Returning the button pressed to our caller. */ #define ERROR_DIALOG(_error_msg, _error_code, _button) \ \ /*word*/_button = error_dialog( (_error_msg), (_error_code)) /* ****************************************************************** * * Prototypes of all functions: * * ****************************************************************** */ Word error_dialog(Word, Word); #endif
/*
* Copyright (c) Kopriha Software, 1991
* All Rights Reserved
*
* Errors.H
*
* Description: This include file contains all the error
* code definitions required for this program.
*
*
* Table of contents:
*
* Macros:
*
* ERROR_DIALOG() . . . . . . . . Display an error dialog and
* wait for the user to choose
* an option (usually only one).
*
*
* History:April 13, 1991 Dave Created this file
*
*/
#ifndef _ERROR_
#define _ERROR_
#ifndef __TYPES__
#include <types.h>
#endif
#ifndef _PORTABLE_C_
#include "Portable.C.h"
#endif
/* ****************************************************************** *
* Error code definitions for this product: *
* ****************************************************************** */
#define BAD_BUFFER_SIZE 0
#define CANT_OPEN_CONFIG_FILE BAD_BUFFER_SIZE+1
#define CANT_ALLOCATE_PATHNAME CANT_OPEN_CONFIG_FILE+1
#define CANT_READ_PATHNAME CANT_ALLOCATE_PATHNAME+1
#define CANT_OPEN_DIR CANT_READ_PATHNAME+1
#define CANT_GET_ENTRY_COUNT CANT_OPEN_DIR+1
#define CANT_GET_NEXT_FILE CANT_GET_ENTRY_COUNT+1
#define TOO_MANY_SPOOLFILES CANT_GET_NEXT_FILE+1
#define CANT_CREATE_SPOOL_FILE TOO_MANY_SPOOLFILES+1
#define CANT_OPEN_SPOOL_FILE CANT_CREATE_SPOOL_FILE+1
#define CANT_WRITE_DATA CANT_OPEN_SPOOL_FILE+1
#define DAEMON_NOT_ACTIVE CANT_WRITE_DATA+1
#define NUMBER_OF_ERROR_CODES DAEMON_NOT_ACTIVE+1
/* ****************************************************************** *
* Macro definitions: *
* ****************************************************************** */
/*
* ERROR_DIALOG - display an error dialog (with string substitution).
* Returning the button pressed to our caller.
*/
#define ERROR_DIALOG(_error_msg, _error_code, _button) \
\
/*word*/_button = error_dialog( (_error_msg), (_error_code))
/* ****************************************************************** *
* Prototypes of all functions: *
* ****************************************************************** */
Word error_dialog(Word, Word);
#endif

View File

@ -1 +1 @@
:var:spool:lpq:
:var:spool:lpq:

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1,17 @@
#include <stdio.h> void c_port_open(void); void c_port_write(char *, int); void c_port_close(void); char buffer[] = {"This is a simple test...\n"}; int main(int argc, char * argv[]) { c_port_open(); c_port_write(&buffer[0], (int) 25); c_port_close(); exit(0); }
#include <stdio.h>
void c_port_open(void);
void c_port_write(char *, int);
void c_port_close(void);
char buffer[] = {"This is a simple test...\n"};
int main(int argc, char * argv[])
{
c_port_open();
c_port_write(&buffer[0], (int) 25);
c_port_close();
exit(0);
}

View File

@ -1 +1,39 @@
#include <stdio.h> #include <texttool.h> void dor(int r) { if (r < 32) { ErrWriteChar(' '); ErrWriteChar('^'); ErrWriteChar(r+64); ErrWriteChar(' '); } else { ErrWriteChar(' '); ErrWriteChar(r); ErrWriteChar(' '); } } int main(int argc, char *argv[]) { int r; SetInputDevice(1,1l); SetOutputDevice(1,1l); InitTextDev(0); WriteChar(27); WriteChar('?'); r = ReadChar(0); dor(r); r = ReadChar(0); dor(r); r = ReadChar(0); dor(r); r = ReadChar(0); dor(r); r = ReadChar(0); dor(r); }
#include <stdio.h>
#include <texttool.h>
void dor(int r)
{
if (r < 32) {
ErrWriteChar(' ');
ErrWriteChar('^');
ErrWriteChar(r+64);
ErrWriteChar(' ');
}
else {
ErrWriteChar(' ');
ErrWriteChar(r);
ErrWriteChar(' ');
}
}
int main(int argc, char *argv[])
{
int r;
SetInputDevice(1,1l);
SetOutputDevice(1,1l);
InitTextDev(0);
WriteChar(27);
WriteChar('?');
r = ReadChar(0);
dor(r);
r = ReadChar(0);
dor(r);
r = ReadChar(0);
dor(r);
r = ReadChar(0);
dor(r);
r = ReadChar(0);
dor(r);
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1,85 @@
/* * Copyright (c) Kopriha Software, 1991 * All Rights Reserved * * ks.memory.h * * Description: This include file contains all the memory * support macros. * * * Table of contents: * * Macros: * * KS_MEMORY_ALLOCATE() . . . . . Allocate a block of memory * KS_MEMORY_FREE() . . . . . . . Free a block of memory * * * Notes: Why create these macros instead of using the standard * C I/O routines? I believe that the support * routines will require some user interface work to handle * cases like when we run out of memory. Standard C memory * routines don't give me the ability to do such processing. * * For now, these macros will simply call the C library * routines (malloc and free). I'm sure this will change * in the future. * * * History: March 2, 1991 Dave Created this file * */ #ifndef _KS_MEMORY_ #define _KS_MEMORY_ #ifndef _PORTABLE_C_ #include "Portable.C.h" #endif #ifndef _stdlib_ #include <stdlib.h> #endif #ifndef __MEMORY__ #include <memory.h> #endif /* * KS_MEMORY_ALLOCATE() - Allocate some memory */ #define KS_MEMORY_ALLOCATE(_memory_attr,_memory_size,_memory_id,_memory_hdl,_error)\ \ (_memory_hdl) = NewHandle((Long) (_memory_size), \ (_memory_id), \ (_memory_attr), \ 0L); \ (_error) = GET_ERROR() /* * KS_MEMORY_DEALLOCATE() - Release a block of memory back to the * free pool of memory */ #define KS_MEMORY_DEALLOCATE(_memory_hdl, _error) \ \ DisposeHandle( (_memory_hdl)); \ _error = KS_E_SUCCESS /* ****************************************************************** * * Memory routine prototypes: * * ****************************************************************** */ #endif
/*
* Copyright (c) Kopriha Software, 1991
* All Rights Reserved
*
* ks.memory.h
*
* Description: This include file contains all the memory
* support macros.
*
*
* Table of contents:
*
* Macros:
*
* KS_MEMORY_ALLOCATE() . . . . . Allocate a block of memory
* KS_MEMORY_FREE() . . . . . . . Free a block of memory
*
*
* Notes: Why create these macros instead of using the standard
* C I/O routines? I believe that the support
* routines will require some user interface work to handle
* cases like when we run out of memory. Standard C memory
* routines don't give me the ability to do such processing.
*
* For now, these macros will simply call the C library
* routines (malloc and free). I'm sure this will change
* in the future.
*
*
* History: March 2, 1991 Dave Created this file
*
*/
#ifndef _KS_MEMORY_
#define _KS_MEMORY_
#ifndef _PORTABLE_C_
#include "Portable.C.h"
#endif
#ifndef _stdlib_
#include <stdlib.h>
#endif
#ifndef __MEMORY__
#include <memory.h>
#endif
/*
* KS_MEMORY_ALLOCATE() - Allocate some memory
*/
#define KS_MEMORY_ALLOCATE(_memory_attr,_memory_size,_memory_id,_memory_hdl,_error)\
\
(_memory_hdl) = NewHandle((Long) (_memory_size), \
(_memory_id), \
(_memory_attr), \
0L); \
(_error) = GET_ERROR()
/*
* KS_MEMORY_DEALLOCATE() - Release a block of memory back to the
* free pool of memory
*/
#define KS_MEMORY_DEALLOCATE(_memory_hdl, _error) \
\
DisposeHandle( (_memory_hdl)); \
_error = KS_E_SUCCESS
/* ****************************************************************** *
* Memory routine prototypes: *
* ****************************************************************** */
#endif

File diff suppressed because one or more lines are too long

View File

@ -1 +1,109 @@
/* * Copyright (c) Kopriha Software, 1990 * All Rights Reserved * * Portable.C.h * * Description: This include file contains all the portable C language * definitions for Font Forge. * * * Table of contents: * * Structures: * * Macros: * * COPY_BYTES . . . . . . . . . . Copy bytes from one place to another * MAX . . . . . . . . . . . . . Return the maximum of two values * MIN . . . . . . . . . . . . . Return the minimum of two values * TO_POINTER . . . . . . . . . . Convert some pointer type to Pointer * ZERO . . . . . . . . . . . . . Initialize a structure to zero * * * Notes: Wherever possible, the macros defined in this module * will be used!!!! * * History:August 10, 1990 Dave Created this file * */ #ifndef _PORTABLE_C_ #define _PORTABLE_C_ #ifndef __stddef__ #include <stddef.h> #endif /* * COPY_BYTES() - Copies the specified number of bytes */ #define COPY_BYTES(_src_ptr, _src_offset, _dest_ptr, _dest_offset, _size)\ \ BlockMove( &(((char *) (_src_ptr))[(_src_offset)]), \ &(((char *) (_dest_ptr))[(_dest_offset)]), \ (Long) (_size)) /* * GET_ERROR() - returns the error from the last toolbox call. * Use this macro only in a assignment statement * (IE: z = MAX(x,y);) */ #define GET_ERROR() \ \ toolerror() /* * MAX(a,b) - returns the minimum value, use this macro only * in a assignment statement (IE: z = MAX(x,y);) */ #define MAX(_arg1, _arg2) \ \ (((_arg1) > (_arg2)) ? (_arg1) : (_arg2)) /* * MIN(a,b) - returns the minimum value, use this macro only * in a assignment statement (IE: z = MIN(x,y);) */ #define MIN(_arg1, _arg2) \ \ (((_arg1) < (_arg2)) ? (_arg1) : (_arg2)) /* * TO_POINTER(some_pointer) - returns some_pointer typecase as * a Pointer. Use this macro only in a assignment * statement (IE: z = MIN(x,y);) */ #define TO_POINTER(_some_pointer) \ \ ((Pointer) (_some_pointer)) /* * ZERO(structure) - sets a structure to zero. */ #define ZERO(_struct) \ \ memset( (char *) &(_struct), \ 0, \ ((size_t) sizeof(_struct)) ) #endif
/*
* Copyright (c) Kopriha Software, 1990
* All Rights Reserved
*
* Portable.C.h
*
* Description: This include file contains all the portable C language
* definitions for Font Forge.
*
*
* Table of contents:
*
* Structures:
*
* Macros:
*
* COPY_BYTES . . . . . . . . . . Copy bytes from one place to another
* MAX . . . . . . . . . . . . . Return the maximum of two values
* MIN . . . . . . . . . . . . . Return the minimum of two values
* TO_POINTER . . . . . . . . . . Convert some pointer type to Pointer
* ZERO . . . . . . . . . . . . . Initialize a structure to zero
*
*
* Notes: Wherever possible, the macros defined in this module
* will be used!!!!
*
* History:August 10, 1990 Dave Created this file
*
*/
#ifndef _PORTABLE_C_
#define _PORTABLE_C_
#ifndef __stddef__
#include <stddef.h>
#endif
/*
* COPY_BYTES() - Copies the specified number of bytes
*/
#define COPY_BYTES(_src_ptr, _src_offset, _dest_ptr, _dest_offset, _size)\
\
BlockMove( &(((char *) (_src_ptr))[(_src_offset)]), \
&(((char *) (_dest_ptr))[(_dest_offset)]), \
(Long) (_size))
/*
* GET_ERROR() - returns the error from the last toolbox call.
* Use this macro only in a assignment statement
* (IE: z = MAX(x,y);)
*/
#define GET_ERROR() \
\
toolerror()
/*
* MAX(a,b) - returns the minimum value, use this macro only
* in a assignment statement (IE: z = MAX(x,y);)
*/
#define MAX(_arg1, _arg2) \
\
(((_arg1) > (_arg2)) ? (_arg1) : (_arg2))
/*
* MIN(a,b) - returns the minimum value, use this macro only
* in a assignment statement (IE: z = MIN(x,y);)
*/
#define MIN(_arg1, _arg2) \
\
(((_arg1) < (_arg2)) ? (_arg1) : (_arg2))
/*
* TO_POINTER(some_pointer) - returns some_pointer typecase as
* a Pointer. Use this macro only in a assignment
* statement (IE: z = MIN(x,y);)
*/
#define TO_POINTER(_some_pointer) \
\
((Pointer) (_some_pointer))
/*
* ZERO(structure) - sets a structure to zero.
*/
#define ZERO(_struct) \
\
memset( (char *) &(_struct), \
0, \
((size_t) sizeof(_struct)) )
#endif

View File

@ -1 +1,167 @@
/* * Copyright (c) Kopriha Software, 1991 * All Rights Reserved * * SharedData.H * * Description: This include file contains the definition of the * shared data structure that has a pointer to it posted * to the message center. * * * Table of contents: * * Structures: * KS_SHARED_DATA . . . . . . . Shared data structure * * * History:April 21, 1991 Dave Created this file * */ #ifndef _KS_SHARED_DATA_ #define _KS_SHARED_DATA_ #ifndef _KS_DEFINES_ #include "KS.Defines.H" #endif #ifndef __GSOS__ #include <gsos.h> #endif /* * Filetype/auxtype of spoolfiles. */ #define SPOOLFILE_FILETYPE ((Word) 4) #define SPOOLFILE_AUXTYPE ((LongWord) 0) #define SPOOL_DONE_AUXTYPE ((LongWord) 256) /* * Shared data spoolport flag states */ enum port_flags {PORT_NOT_ACTIVE = 1, PORT_READY, PORT_SPOOLING, PORT_ERROR}; /* * Shared data spool flag states... */ enum spool_flags {SPOOL_INIT = 0, /* First call - initialize everything */ SPOOL_SCANNING, /* Scanning spool directory for a file */ SPOOL_OPEN, /* Setting up for printing */ SPOOL_WAITING, /* Waiting for port to be ready */ SPOOL_PRINTING, /* Printing a spoolfile */ SPOOL_CLOSE, /* Finished with a spoolfile */ SPOOL_ERROR}; /* Some error stopped spooling */ /* * KS_SHARED_DATA - generic shared data structure */ typedef struct { KS_STRUCT_ID struct_id; /* Structure id */ Word port_driver_length; /* Length of the port driver filename*/ char port_driver_name[64]; /* Name of port driver to print with */ Word spool_filename_length;/* Length of spool basename */ char spool_filename[64]; /* Basename of spool file */ LongWord buffer_size; /* User specified buffer size */ /* (This is the value of the */ /* scrollbar control) */ /* * Flag words (should use bits, but we'll be a little foolish): */ Word delete_flag; /* Delete spoolfile after printing */ Word print_flag; /* Print new spoolfiles */ /* * Data for the spoolport driver */ enum port_flags port_status; Word port_error; Word port_spoolnumber; /* * Now for the background task information. */ Pointer start_address; /* Start address of routine - pass */ /* this to add to run q! */ enum spool_flags spool_status; /* Status of spooler */ Word spool_error; /* Saved Error from spooler */ Word spool_spoolnumber; /* Spoolfile number being printed */ Pointer file_ptr; /* Pointer to the file we're spooling*/ LongWord bytes_written; /* Bytes written to the printer for */ /* the current spool file */ Word driver_user_id; /* Memory manager User ID for spooler*/ Handle buffer_handle; /* Handle to the I/O buffer */ Byte *buffer; /* Pointer to the I/O buffer */ LongWord buffer_bytesize; /* Size of the buffer (in bytes) */ LongWord buffer_offset; /* Offset of next available byte */ } KS_SHARED_DATA, *KS_SHARED_DATA_PTR, **KS_SHARED_DATA_HDL; typedef struct { Word length; char text[768]; } GSString768, *GSString768Ptr, **GSString768Hdl; typedef struct { Word bufSize; GSString768 buffer; } ResultBuf768, *ResultBuf768Ptr, **ResultBuf768Hdl; /* * KS_DATA_MESSAGE - record pointer passed to message center by name * This holds most of the user specifiable data. The only structure * missing is the pathname - and that is in the second message struct... */ typedef struct { Word blockLen; char name_length; /* 123456789 123456789 12345678 */ char message_name[28]; /* = "Kopriha Software SpoolMaster" */ KS_SHARED_DATA_HDL shared_data_handle; ResultBuf768Hdl shared_path_handle; } KS_NAMED_MESSAGE, *KS_NAMED_MSG_PTR, **KS_NAMED_MSG_HDL; /* * Function prototypes (for message center routines): */ void send_message(KS_SHARED_DATA_HDL *, ResultBuf255Hndl *); void receive_message(KS_SHARED_DATA_HDL *, ResultBuf255Hndl *); #endif
/*
* Copyright (c) Kopriha Software, 1991
* All Rights Reserved
*
* SharedData.H
*
* Description: This include file contains the definition of the
* shared data structure that has a pointer to it posted
* to the message center.
*
*
* Table of contents:
*
* Structures:
* KS_SHARED_DATA . . . . . . . Shared data structure
*
*
* History:April 21, 1991 Dave Created this file
*
*/
#ifndef _KS_SHARED_DATA_
#define _KS_SHARED_DATA_
#ifndef _KS_DEFINES_
#include "KS.Defines.H"
#endif
#ifndef __GSOS__
#include <gsos.h>
#endif
/*
* Filetype/auxtype of spoolfiles.
*/
#define SPOOLFILE_FILETYPE ((Word) 4)
#define SPOOLFILE_AUXTYPE ((LongWord) 0)
#define SPOOL_DONE_AUXTYPE ((LongWord) 256)
/*
* Shared data spoolport flag states
*/
enum port_flags {PORT_NOT_ACTIVE = 1,
PORT_READY,
PORT_SPOOLING,
PORT_ERROR};
/*
* Shared data spool flag states...
*/
enum spool_flags {SPOOL_INIT = 0, /* First call - initialize everything */
SPOOL_SCANNING, /* Scanning spool directory for a file */
SPOOL_OPEN, /* Setting up for printing */
SPOOL_WAITING, /* Waiting for port to be ready */
SPOOL_PRINTING, /* Printing a spoolfile */
SPOOL_CLOSE, /* Finished with a spoolfile */
SPOOL_ERROR}; /* Some error stopped spooling */
/*
* KS_SHARED_DATA - generic shared data structure
*/
typedef struct
{
KS_STRUCT_ID struct_id; /* Structure id */
Word port_driver_length; /* Length of the port driver filename*/
char port_driver_name[64]; /* Name of port driver to print with */
Word spool_filename_length;/* Length of spool basename */
char spool_filename[64]; /* Basename of spool file */
LongWord buffer_size; /* User specified buffer size */
/* (This is the value of the */
/* scrollbar control) */
/*
* Flag words (should use bits, but we'll be a little foolish):
*/
Word delete_flag; /* Delete spoolfile after printing */
Word print_flag; /* Print new spoolfiles */
/*
* Data for the spoolport driver
*/
enum port_flags port_status;
Word port_error;
Word port_spoolnumber;
/*
* Now for the background task information.
*/
Pointer start_address; /* Start address of routine - pass */
/* this to add to run q! */
enum spool_flags spool_status; /* Status of spooler */
Word spool_error; /* Saved Error from spooler */
Word spool_spoolnumber; /* Spoolfile number being printed */
Pointer file_ptr; /* Pointer to the file we're spooling*/
LongWord bytes_written; /* Bytes written to the printer for */
/* the current spool file */
Word driver_user_id; /* Memory manager User ID for spooler*/
Handle buffer_handle; /* Handle to the I/O buffer */
Byte *buffer; /* Pointer to the I/O buffer */
LongWord buffer_bytesize; /* Size of the buffer (in bytes) */
LongWord buffer_offset; /* Offset of next available byte */
} KS_SHARED_DATA, *KS_SHARED_DATA_PTR, **KS_SHARED_DATA_HDL;
typedef struct
{
Word length;
char text[768];
} GSString768, *GSString768Ptr, **GSString768Hdl;
typedef struct
{
Word bufSize;
GSString768 buffer;
} ResultBuf768, *ResultBuf768Ptr, **ResultBuf768Hdl;
/*
* KS_DATA_MESSAGE - record pointer passed to message center by name
* This holds most of the user specifiable data. The only structure
* missing is the pathname - and that is in the second message struct...
*/
typedef struct
{
Word blockLen;
char name_length; /* 123456789 123456789 12345678 */
char message_name[28]; /* = "Kopriha Software SpoolMaster" */
KS_SHARED_DATA_HDL shared_data_handle;
ResultBuf768Hdl shared_path_handle;
} KS_NAMED_MESSAGE, *KS_NAMED_MSG_PTR, **KS_NAMED_MSG_HDL;
/*
* Function prototypes (for message center routines):
*/
void send_message(KS_SHARED_DATA_HDL *,
ResultBuf255Hndl *);
void receive_message(KS_SHARED_DATA_HDL *,
ResultBuf255Hndl *);
#endif

View File

@ -1 +1,83 @@
/* * Copyright (c) Kopriha Software, 1990-1991 * All Rights Reserved * * AddFile.CC * * Description: * This module exists to abstract the data of the file I/O * primitives of GS/OS. * * * History:Oct 13, 1990 Dave Created this file * * Feb 25, 1991 Dave Added I/O buffering * * May 26, 1991 Dave Added set EOF * * Jun 07, 1991 Dave Broke the single source into lots * of small sources so we can build * a library to use... * */ /* * define DEBUG_CODE * - add # to define to create the local * debug code (IE:module) */ #ifndef _KS_FILEIO_ #include "ks.fileio.h" #endif #pragma noroot /* ****************************************************************** * * ks_file_path_add_file - Append a filename (or partial filename) * * to a pathname - although you can pass any* * pait of GS/OS strings. * * * * History: Mar 24, 1991 Dave Created this routine * * ****************************************************************** */ #undef ROUTINE_NAME #define ROUTINE_NAME "ks_file_path_add_file" KS_E_ERROR ks_file_path_add_file(GSString255Ptr path_ptr, GSString255Ptr file_ptr) { /* ************************************************************** * * Local declarations: * * ************************************************************** */ ROUTINE_ENTER(); /* ************************************************************** * * Append the filename to the pathname. * * ************************************************************** */ COPY_BYTES(&file_ptr->text, 0, &path_ptr->text[path_ptr->length], 0, file_ptr->length); path_ptr->length = path_ptr->length + file_ptr->length; /* ************************************************************** * * Return a success to our caller. * * ************************************************************** */ KS_SUCCESS(); } /* End of ks_file_path_add_file() */
/*
* Copyright (c) Kopriha Software, 1990-1991
* All Rights Reserved
*
* AddFile.CC
*
* Description:
* This module exists to abstract the data of the file I/O
* primitives of GS/OS.
*
*
* History:Oct 13, 1990 Dave Created this file
*
* Feb 25, 1991 Dave Added I/O buffering
*
* May 26, 1991 Dave Added set EOF
*
* Jun 07, 1991 Dave Broke the single source into lots
* of small sources so we can build
* a library to use...
*
*/
/*
* define DEBUG_CODE
* - add # to define to create the local
* debug code (IE:module)
*/
#ifndef _KS_FILEIO_
#include "ks.fileio.h"
#endif
#pragma noroot
/* ****************************************************************** *
* ks_file_path_add_file - Append a filename (or partial filename) *
* to a pathname - although you can pass any*
* pait of GS/OS strings. *
* *
* History: Mar 24, 1991 Dave Created this routine *
* ****************************************************************** */
#undef ROUTINE_NAME
#define ROUTINE_NAME "ks_file_path_add_file"
KS_E_ERROR ks_file_path_add_file(GSString255Ptr path_ptr,
GSString255Ptr file_ptr)
{
/* ************************************************************** *
* Local declarations: *
* ************************************************************** */
ROUTINE_ENTER();
/* ************************************************************** *
* Append the filename to the pathname. *
* ************************************************************** */
COPY_BYTES(&file_ptr->text,
0,
&path_ptr->text[path_ptr->length],
0,
file_ptr->length);
path_ptr->length = path_ptr->length + file_ptr->length;
/* ************************************************************** *
* Return a success to our caller. *
* ************************************************************** */
KS_SUCCESS();
} /* End of ks_file_path_add_file() */

View File

@ -1 +1,99 @@
/* * Copyright (c) Kopriha Software, 1990-1991 * All Rights Reserved * * ChangeAux.CC * * Description: * This module exists to abstract the data of the file I/O * primitives of GS/OS. * * * History:Oct 13, 1990 Dave Created this file * * Feb 25, 1991 Dave Added I/O buffering * * May 26, 1991 Dave Added set EOF * * Jun 07, 1991 Dave Broke the single source into lots * of small sources so we can build * a library to use... * */ /* * define DEBUG_CODE * - add # to define to create the local * debug code (IE:module) */ #ifndef _KS_FILEIO_ #include "ks.fileio.h" #endif #pragma noroot /* ****************************************************************** * * ks_file_change_auxtype - Change the aux type of a file. * * * * History: March 24, 1991 Dave Created this routine * * ****************************************************************** */ #undef ROUTINE_NAME #define ROUTINE_NAME "ks_file_change_auxtype" KS_E_ERROR ks_file_change_auxtype(GSString255Ptr GSPathPtr, LongWord new_auxtype) { /* ************************************************************** * * Local declarations: * * ************************************************************** */ KS_E_ERROR error; /* Holds error codes for subroutines */ ROUTINE_ENTER(); /* ************************************************************** * * First get some information about the file... * * ************************************************************** */ KSf_pkts.fileinfoGSOS.pCount = 4; KSf_pkts.fileinfoGSOS.pathname = GSPathPtr; GetFileInfoGS(&KSf_pkts.fileinfoGSOS); if ((error = GET_ERROR()) != KS_E_SUCCESS) { KS_ERROR(error, KS_FILE_ID); }; /* ************************************************************** * * Now set the file info (especially the new aux type)... * * ************************************************************** */ KSf_pkts.fileinfoGSOS.pCount = 4; KSf_pkts.fileinfoGSOS.auxType = new_auxtype; SetFileInfoGS(&KSf_pkts.fileinfoGSOS); if ((error = GET_ERROR()) != KS_E_SUCCESS) { KS_ERROR(error, KS_FILE_ID); }; /* ************************************************************** * * Return the success back to our caller. * * ************************************************************** */ KS_SUCCESS(); } /* End of ks_file_change_auxtype() */
/*
* Copyright (c) Kopriha Software, 1990-1991
* All Rights Reserved
*
* ChangeAux.CC
*
* Description:
* This module exists to abstract the data of the file I/O
* primitives of GS/OS.
*
*
* History:Oct 13, 1990 Dave Created this file
*
* Feb 25, 1991 Dave Added I/O buffering
*
* May 26, 1991 Dave Added set EOF
*
* Jun 07, 1991 Dave Broke the single source into lots
* of small sources so we can build
* a library to use...
*
*/
/*
* define DEBUG_CODE
* - add # to define to create the local
* debug code (IE:module)
*/
#ifndef _KS_FILEIO_
#include "ks.fileio.h"
#endif
#pragma noroot
/* ****************************************************************** *
* ks_file_change_auxtype - Change the aux type of a file. *
* *
* History: March 24, 1991 Dave Created this routine *
* ****************************************************************** */
#undef ROUTINE_NAME
#define ROUTINE_NAME "ks_file_change_auxtype"
KS_E_ERROR ks_file_change_auxtype(GSString255Ptr GSPathPtr,
LongWord new_auxtype)
{
/* ************************************************************** *
* Local declarations: *
* ************************************************************** */
KS_E_ERROR error; /* Holds error codes for subroutines */
ROUTINE_ENTER();
/* ************************************************************** *
* First get some information about the file... *
* ************************************************************** */
KSf_pkts.fileinfoGSOS.pCount = 4;
KSf_pkts.fileinfoGSOS.pathname = GSPathPtr;
GetFileInfoGS(&KSf_pkts.fileinfoGSOS);
if ((error = GET_ERROR()) != KS_E_SUCCESS)
{
KS_ERROR(error, KS_FILE_ID);
};
/* ************************************************************** *
* Now set the file info (especially the new aux type)... *
* ************************************************************** */
KSf_pkts.fileinfoGSOS.pCount = 4;
KSf_pkts.fileinfoGSOS.auxType = new_auxtype;
SetFileInfoGS(&KSf_pkts.fileinfoGSOS);
if ((error = GET_ERROR()) != KS_E_SUCCESS)
{
KS_ERROR(error, KS_FILE_ID);
};
/* ************************************************************** *
* Return the success back to our caller. *
* ************************************************************** */
KS_SUCCESS();
} /* End of ks_file_change_auxtype() */

View File

@ -1 +1,141 @@
/* * Copyright (c) Kopriha Software, 1990-1991 * All Rights Reserved * * Close.CC * * Description: * This module exists to abstract the data of the file I/O * primitives of GS/OS. * * * History:Oct 13, 1990 Dave Created this file * * Feb 25, 1991 Dave Added I/O buffering * * May 26, 1991 Dave Added set EOF * * Jun 07, 1991 Dave Broke the single source into lots * of small sources so we can build * a library to use... * */ /* * define DEBUG_CODE * - add # to define to create the local * debug code (IE:module) */ #ifndef _KS_FILEIO_ #include "ks.fileio.h" #endif #pragma noroot /* ****************************************************************** * * ks_file_close - close an open file. * * * * History: Oct 13, 1990 Dave Created this routine * * ****************************************************************** */ #define ROUTINE_NAME "ks_file_close" KS_E_ERROR ks_file_close(KS_FILE_PTR file_ptr) { /* ************************************************************** * * Local declarations: * * ************************************************************** */ KS_E_ERROR error; /* Holds error codes for subroutines */ ROUTINE_ENTER(); /* ************************************************************** * * Verify the structure ID passed in is the correct one. * * ************************************************************** */ if (file_ptr->struct_id != KS_FILE_ID) { KS_ERROR(KS_E_INVALID_STRUCT_ID, KS_FILE_ID); }; /* ************************************************************** * * Flush any remaining buffer to disk (if there is a buffer and * * we are writing to the file). * * ************************************************************** */ if (file_ptr->buffer_size != NULL) { if (file_ptr->access == KS_FILE_WRITE_ACCESS) { if (file_ptr->buffer_offset != 0) { /* ************************************************** * * We have something in a buffer - write the final * * buffer to disk. * * ************************************************** */ KSf_pkts.IO.pCount = 4; KSf_pkts.IO.refNum = file_ptr->refNum; KSf_pkts.IO.dataBuffer = TO_POINTER(file_ptr->buffer); KSf_pkts.IO.requestCount = file_ptr->buffer_offset; WriteGS(&KSf_pkts.IO); if ((error = GET_ERROR()) != KS_E_SUCCESS) { KS_ERROR(error, KS_FILE_ID); }; }; /* End if there was something in the buffer */ }; /* End if we were writing to the file */ /* ********************************************************** * * We used buffered I/O on this file - now lets free the * * buffer back to free memory. * * ********************************************************** */ KS_MEMORY_DEALLOCATE(file_ptr->buffer_handle, error); }; /* End if we used buffered I/O to the file */ /* ************************************************************** * * Set up the close packet and close the file. * * ************************************************************** */ KSf_pkts.close.pCount = 1; KSf_pkts.close.refNum = file_ptr->refNum; CloseGS(&KSf_pkts.close); /* ************************************************************** * * Clear the FILE structure and give it back to free memory. * * ************************************************************** */ file_ptr->struct_id = 0; KS_MEMORY_DEALLOCATE(file_ptr->file_handle, error); /* ************************************************************** * * Return the success back to our caller. * * ************************************************************** */ KS_SUCCESS(); } /* End of ks_file_close() */
/*
* Copyright (c) Kopriha Software, 1990-1991
* All Rights Reserved
*
* Close.CC
*
* Description:
* This module exists to abstract the data of the file I/O
* primitives of GS/OS.
*
*
* History:Oct 13, 1990 Dave Created this file
*
* Feb 25, 1991 Dave Added I/O buffering
*
* May 26, 1991 Dave Added set EOF
*
* Jun 07, 1991 Dave Broke the single source into lots
* of small sources so we can build
* a library to use...
*
*/
/*
* define DEBUG_CODE
* - add # to define to create the local
* debug code (IE:module)
*/
#ifndef _KS_FILEIO_
#include "ks.fileio.h"
#endif
#pragma noroot
/* ****************************************************************** *
* ks_file_close - close an open file. *
* *
* History: Oct 13, 1990 Dave Created this routine *
* ****************************************************************** */
#define ROUTINE_NAME "ks_file_close"
KS_E_ERROR ks_file_close(KS_FILE_PTR file_ptr)
{
/* ************************************************************** *
* Local declarations: *
* ************************************************************** */
KS_E_ERROR error; /* Holds error codes for subroutines */
ROUTINE_ENTER();
/* ************************************************************** *
* Verify the structure ID passed in is the correct one. *
* ************************************************************** */
if (file_ptr->struct_id != KS_FILE_ID)
{
KS_ERROR(KS_E_INVALID_STRUCT_ID, KS_FILE_ID);
};
/* ************************************************************** *
* Flush any remaining buffer to disk (if there is a buffer and *
* we are writing to the file). *
* ************************************************************** */
if (file_ptr->buffer_size != NULL)
{
if (file_ptr->access == KS_FILE_WRITE_ACCESS)
{
if (file_ptr->buffer_offset != 0)
{
/* ************************************************** *
* We have something in a buffer - write the final *
* buffer to disk. *
* ************************************************** */
KSf_pkts.IO.pCount = 4;
KSf_pkts.IO.refNum = file_ptr->refNum;
KSf_pkts.IO.dataBuffer = TO_POINTER(file_ptr->buffer);
KSf_pkts.IO.requestCount = file_ptr->buffer_offset;
WriteGS(&KSf_pkts.IO);
if ((error = GET_ERROR()) != KS_E_SUCCESS)
{
KS_ERROR(error, KS_FILE_ID);
};
}; /* End if there was something in the buffer */
}; /* End if we were writing to the file */
/* ********************************************************** *
* We used buffered I/O on this file - now lets free the *
* buffer back to free memory. *
* ********************************************************** */
KS_MEMORY_DEALLOCATE(file_ptr->buffer_handle,
error);
}; /* End if we used buffered I/O to the file */
/* ************************************************************** *
* Set up the close packet and close the file. *
* ************************************************************** */
KSf_pkts.close.pCount = 1;
KSf_pkts.close.refNum = file_ptr->refNum;
CloseGS(&KSf_pkts.close);
/* ************************************************************** *
* Clear the FILE structure and give it back to free memory. *
* ************************************************************** */
file_ptr->struct_id = 0;
KS_MEMORY_DEALLOCATE(file_ptr->file_handle,
error);
/* ************************************************************** *
* Return the success back to our caller. *
* ************************************************************** */
KS_SUCCESS();
} /* End of ks_file_close() */

View File

@ -1 +1,93 @@
/* * Copyright (c) Kopriha Software, 1990-1991 * All Rights Reserved * * Create.CC * * Description: * This module exists to abstract the data of the file I/O * primitives of GS/OS. * * * History:Oct 13, 1990 Dave Created this file * * Feb 25, 1991 Dave Added I/O buffering * * May 26, 1991 Dave Added set EOF * * Jun 07, 1991 Dave Broke the single source into lots * of small sources so we can build * a library to use... * */ /* * define DEBUG_CODE * - add # to define to create the local * debug code (IE:module) */ #ifndef _KS_FILEIO_ #include "ks.fileio.h" #endif #pragma noroot /* ****************************************************************** * * ks_file_create - Create a particular type/auxtype file * * * * History: Mar 3, 1991 Dave Created this routine * * ****************************************************************** */ #undef ROUTINE_NAME #define ROUTINE_NAME "ks_file_create" KS_E_ERROR ks_file_create(GSString255Ptr GSPathPtr, Word file_type, LongWord auxtype) { /* ************************************************************** * * Local declarations: * * ************************************************************** */ KS_E_ERROR error; /* Holds error codes for subroutines */ ROUTINE_ENTER(); /* ************************************************************** * * Create the file for our caller. * * * * Note: The access is setup such that the file is readable, * * writable, can be renamed and can be deleted. * * ************************************************************** */ KSf_pkts.create.pCount = 4; KSf_pkts.create.pathname = GSPathPtr; KSf_pkts.create.access = readWriteEnable | renameEnable | destroyEnable; KSf_pkts.create.fileType = file_type; KSf_pkts.create.auxType = auxtype; CreateGS(&KSf_pkts.create); /* ************************************************************** * * Return the success/error back to our caller. * * ************************************************************** */ if ((error = GET_ERROR()) != KS_E_SUCCESS) { KS_ERROR(error, KS_FILE_ID); }; KS_SUCCESS(); } /* End of ks_file_create() */
/*
* Copyright (c) Kopriha Software, 1990-1991
* All Rights Reserved
*
* Create.CC
*
* Description:
* This module exists to abstract the data of the file I/O
* primitives of GS/OS.
*
*
* History:Oct 13, 1990 Dave Created this file
*
* Feb 25, 1991 Dave Added I/O buffering
*
* May 26, 1991 Dave Added set EOF
*
* Jun 07, 1991 Dave Broke the single source into lots
* of small sources so we can build
* a library to use...
*
*/
/*
* define DEBUG_CODE
* - add # to define to create the local
* debug code (IE:module)
*/
#ifndef _KS_FILEIO_
#include "ks.fileio.h"
#endif
#pragma noroot
/* ****************************************************************** *
* ks_file_create - Create a particular type/auxtype file *
* *
* History: Mar 3, 1991 Dave Created this routine *
* ****************************************************************** */
#undef ROUTINE_NAME
#define ROUTINE_NAME "ks_file_create"
KS_E_ERROR ks_file_create(GSString255Ptr GSPathPtr,
Word file_type,
LongWord auxtype)
{
/* ************************************************************** *
* Local declarations: *
* ************************************************************** */
KS_E_ERROR error; /* Holds error codes for subroutines */
ROUTINE_ENTER();
/* ************************************************************** *
* Create the file for our caller. *
* *
* Note: The access is setup such that the file is readable, *
* writable, can be renamed and can be deleted. *
* ************************************************************** */
KSf_pkts.create.pCount = 4;
KSf_pkts.create.pathname = GSPathPtr;
KSf_pkts.create.access = readWriteEnable |
renameEnable |
destroyEnable;
KSf_pkts.create.fileType = file_type;
KSf_pkts.create.auxType = auxtype;
CreateGS(&KSf_pkts.create);
/* ************************************************************** *
* Return the success/error back to our caller. *
* ************************************************************** */
if ((error = GET_ERROR()) != KS_E_SUCCESS)
{
KS_ERROR(error, KS_FILE_ID);
};
KS_SUCCESS();
} /* End of ks_file_create() */

View File

@ -1 +1,41 @@
/* * Copyright (c) Kopriha Software, 1990-1991 * All Rights Reserved * * Data.CC * * Description: * This module exists to abstract the data of the file I/O * primitives of GS/OS. * * * History:Oct 13, 1990 Dave Created this file * * Feb 25, 1991 Dave Added I/O buffering * * May 26, 1991 Dave Added set EOF * * Jun 07, 1991 Dave Broke the single source into lots * of small sources so we can build * a library to use... * */ /* * define DEBUG_CODE * - add # to define to create the local * debug code (IE:module) */ #pragma noroot #define FILEIO_DATA #ifndef _KS_FILEIO_ #include "ks.fileio.h" #endif
/*
* Copyright (c) Kopriha Software, 1990-1991
* All Rights Reserved
*
* Data.CC
*
* Description:
* This module exists to abstract the data of the file I/O
* primitives of GS/OS.
*
*
* History:Oct 13, 1990 Dave Created this file
*
* Feb 25, 1991 Dave Added I/O buffering
*
* May 26, 1991 Dave Added set EOF
*
* Jun 07, 1991 Dave Broke the single source into lots
* of small sources so we can build
* a library to use...
*
*/
/*
* define DEBUG_CODE
* - add # to define to create the local
* debug code (IE:module)
*/
#pragma noroot
#define FILEIO_DATA
#ifndef _KS_FILEIO_
#include "ks.fileio.h"
#endif

View File

@ -1 +1,84 @@
/* * Copyright (c) Kopriha Software, 1990-1991 * All Rights Reserved * * Delete.CC * * Description: * This module exists to abstract the data of the file I/O * primitives of GS/OS. * * * History:Oct 13, 1990 Dave Created this file * * Feb 25, 1991 Dave Added I/O buffering * * May 26, 1991 Dave Added set EOF * * Jun 07, 1991 Dave Broke the single source into lots * of small sources so we can build * a library to use... * */ /* * define DEBUG_CODE * - add # to define to create the local * debug code (IE:module) */ #ifndef _KS_FILEIO_ #include "ks.fileio.h" #endif #pragma noroot /* ****************************************************************** * * ks_file_delete - Delete a file. * * * * History: March 24, 1991 Dave Created this routine * * ****************************************************************** */ #undef ROUTINE_NAME #define ROUTINE_NAME "ks_file_delete" KS_E_ERROR ks_file_delete(GSString255Ptr GSPathPtr) { /* ************************************************************** * * Local declarations: * * ************************************************************** */ KS_E_ERROR error; /* Holds error codes for subroutines */ ROUTINE_ENTER(); /* ************************************************************** * * Setup the delete packet and try to get rid of the file. * * Any errors are returned to our caller. * * ************************************************************** */ KSf_pkts.delete.pCount = 1; KSf_pkts.delete.pathname = GSPathPtr; DestroyGS(&KSf_pkts.delete); if ((error = GET_ERROR()) != KS_E_SUCCESS) { KS_ERROR(error, KS_FILE_ID); }; /* ************************************************************** * * Return the success back to our caller. * * ************************************************************** */ KS_SUCCESS(); } /* End of ks_file_delete() */
/*
* Copyright (c) Kopriha Software, 1990-1991
* All Rights Reserved
*
* Delete.CC
*
* Description:
* This module exists to abstract the data of the file I/O
* primitives of GS/OS.
*
*
* History:Oct 13, 1990 Dave Created this file
*
* Feb 25, 1991 Dave Added I/O buffering
*
* May 26, 1991 Dave Added set EOF
*
* Jun 07, 1991 Dave Broke the single source into lots
* of small sources so we can build
* a library to use...
*
*/
/*
* define DEBUG_CODE
* - add # to define to create the local
* debug code (IE:module)
*/
#ifndef _KS_FILEIO_
#include "ks.fileio.h"
#endif
#pragma noroot
/* ****************************************************************** *
* ks_file_delete - Delete a file. *
* *
* History: March 24, 1991 Dave Created this routine *
* ****************************************************************** */
#undef ROUTINE_NAME
#define ROUTINE_NAME "ks_file_delete"
KS_E_ERROR ks_file_delete(GSString255Ptr GSPathPtr)
{
/* ************************************************************** *
* Local declarations: *
* ************************************************************** */
KS_E_ERROR error; /* Holds error codes for subroutines */
ROUTINE_ENTER();
/* ************************************************************** *
* Setup the delete packet and try to get rid of the file. *
* Any errors are returned to our caller. *
* ************************************************************** */
KSf_pkts.delete.pCount = 1;
KSf_pkts.delete.pathname = GSPathPtr;
DestroyGS(&KSf_pkts.delete);
if ((error = GET_ERROR()) != KS_E_SUCCESS)
{
KS_ERROR(error, KS_FILE_ID);
};
/* ************************************************************** *
* Return the success back to our caller. *
* ************************************************************** */
KS_SUCCESS();
} /* End of ks_file_delete() */

View File

@ -1 +1,69 @@
/* * Copyright (c) Kopriha Software, 1990-1991 * All Rights Reserved * * GetBufSize.CC * * Description: * This module exists to abstract the data of the file I/O * primitives of GS/OS. * * * History:Oct 13, 1990 Dave Created this file * * Feb 25, 1991 Dave Added I/O buffering * * May 26, 1991 Dave Added set EOF * * Jun 07, 1991 Dave Broke the single source into lots * of small sources so we can build * a library to use... * */ /* * define DEBUG_CODE * - add # to define to create the local * debug code (IE:module) */ #ifndef _KS_FILEIO_ #include "ks.fileio.h" #endif #pragma noroot /* ****************************************************************** * * ks_file_get_buffer_size - return the currently specified I/O * * buffer size. * * * * History: Mar 3, 1991 Dave Created this routine * * ****************************************************************** */ #undef ROUTINE_NAME #define ROUTINE_NAME "ks_file_get_buffer_size" KS_E_ERROR ks_file_get_buffer_size(LongWord *buffer_size) { /* ************************************************************** * * Local declarations: * * ************************************************************** */ ROUTINE_ENTER(); /* ************************************************************** * * Return the buffer size back to our caller. * * ************************************************************** */ *buffer_size = KSf_FileBufferSize; KS_SUCCESS(); } /* End of ks_file_get_buffer_size() */
/*
* Copyright (c) Kopriha Software, 1990-1991
* All Rights Reserved
*
* GetBufSize.CC
*
* Description:
* This module exists to abstract the data of the file I/O
* primitives of GS/OS.
*
*
* History:Oct 13, 1990 Dave Created this file
*
* Feb 25, 1991 Dave Added I/O buffering
*
* May 26, 1991 Dave Added set EOF
*
* Jun 07, 1991 Dave Broke the single source into lots
* of small sources so we can build
* a library to use...
*
*/
/*
* define DEBUG_CODE
* - add # to define to create the local
* debug code (IE:module)
*/
#ifndef _KS_FILEIO_
#include "ks.fileio.h"
#endif
#pragma noroot
/* ****************************************************************** *
* ks_file_get_buffer_size - return the currently specified I/O *
* buffer size. *
* *
* History: Mar 3, 1991 Dave Created this routine *
* ****************************************************************** */
#undef ROUTINE_NAME
#define ROUTINE_NAME "ks_file_get_buffer_size"
KS_E_ERROR ks_file_get_buffer_size(LongWord *buffer_size)
{
/* ************************************************************** *
* Local declarations: *
* ************************************************************** */
ROUTINE_ENTER();
/* ************************************************************** *
* Return the buffer size back to our caller. *
* ************************************************************** */
*buffer_size = KSf_FileBufferSize;
KS_SUCCESS();
} /* End of ks_file_get_buffer_size() */

View File

@ -1 +1,90 @@
/* * Copyright (c) Kopriha Software, 1990-1991 * All Rights Reserved * * GetVolume.CC * * Description: * This module exists to abstract the data of the file I/O * primitives of GS/OS. * * * History:Oct 13, 1990 Dave Created this file * * Feb 25, 1991 Dave Added I/O buffering * * May 26, 1991 Dave Added set EOF * * Jun 07, 1991 Dave Broke the single source into lots * of small sources so we can build * a library to use... * */ /* * define DEBUG_CODE * - add # to define to create the local * debug code (IE:module) */ #ifndef _KS_FILEIO_ #include "ks.fileio.h" #endif #pragma noroot /* ****************************************************************** * * ks_file_get_volume - Return the volume name for the specified * * pathname. * * * * History: Mar 7, 1991 Dave Created this routine * * ****************************************************************** */ #undef ROUTINE_NAME #define ROUTINE_NAME "ks_file_get_volume" KS_E_ERROR ks_file_get_volume(GSString255Ptr pathname_ptr, GSString255Ptr volume_ptr) { /* ************************************************************** * * Local declarations: * * ************************************************************** */ Word counter; /* Counts characters copied */ ROUTINE_ENTER(); /* ************************************************************** * * Copy the volume name out of the pathname. The volume name * * will start with a special delimitor, when we get to either * * the next delimitor or the end of the string then we have * * copied all of the volume name. * * ************************************************************** */ volume_ptr->text[0] = pathname_ptr->text[0]; for (counter = 1; ((counter < (pathname_ptr->length) ) && ((pathname_ptr->text[0]) != (pathname_ptr->text[counter]))); counter++) { volume_ptr->text[counter] = pathname_ptr->text[counter]; }; volume_ptr->length = counter; /* ************************************************************** * * Return a success to our caller. * * ************************************************************** */ KS_SUCCESS(); } /* End of ks_file_get_volume() */
/*
* Copyright (c) Kopriha Software, 1990-1991
* All Rights Reserved
*
* GetVolume.CC
*
* Description:
* This module exists to abstract the data of the file I/O
* primitives of GS/OS.
*
*
* History:Oct 13, 1990 Dave Created this file
*
* Feb 25, 1991 Dave Added I/O buffering
*
* May 26, 1991 Dave Added set EOF
*
* Jun 07, 1991 Dave Broke the single source into lots
* of small sources so we can build
* a library to use...
*
*/
/*
* define DEBUG_CODE
* - add # to define to create the local
* debug code (IE:module)
*/
#ifndef _KS_FILEIO_
#include "ks.fileio.h"
#endif
#pragma noroot
/* ****************************************************************** *
* ks_file_get_volume - Return the volume name for the specified *
* pathname. *
* *
* History: Mar 7, 1991 Dave Created this routine *
* ****************************************************************** */
#undef ROUTINE_NAME
#define ROUTINE_NAME "ks_file_get_volume"
KS_E_ERROR ks_file_get_volume(GSString255Ptr pathname_ptr,
GSString255Ptr volume_ptr)
{
/* ************************************************************** *
* Local declarations: *
* ************************************************************** */
Word counter; /* Counts characters copied */
ROUTINE_ENTER();
/* ************************************************************** *
* Copy the volume name out of the pathname. The volume name *
* will start with a special delimitor, when we get to either *
* the next delimitor or the end of the string then we have *
* copied all of the volume name. *
* ************************************************************** */
volume_ptr->text[0] = pathname_ptr->text[0];
for (counter = 1;
((counter < (pathname_ptr->length) ) &&
((pathname_ptr->text[0]) != (pathname_ptr->text[counter])));
counter++)
{
volume_ptr->text[counter] = pathname_ptr->text[counter];
};
volume_ptr->length = counter;
/* ************************************************************** *
* Return a success to our caller. *
* ************************************************************** */
KS_SUCCESS();
} /* End of ks_file_get_volume() */

View File

@ -1 +1,140 @@
/* * Copyright (c) Kopriha Software, 1991 * All Rights Reserved * * MSGReceive.CC * * Description: * This module is message center options from the menus.. * * * Table of Contents: * * retrieve_message . . Get message by name for our caller... * * History:April 23, 1991 Dave Created this file * */ /* * define DEBUG_CODE * - add # to define to create the local * debug code (IE:module) */ #include <string.h> #ifndef __LOCATOR__ #include <Locator.h> #endif #ifndef __MISCTOOL__ #include <MiscTool.h> #endif #ifndef _KS_DEFINES_ #include "KS.Defines.h" #endif #ifndef _KS_MEMORY_ #include "KS.Memory.H" #endif #ifndef _KS_SHARED_DATA_ #include "SharedData.H" #endif #pragma noroot /* ****************************************************************** * * receive_message() - Get a pointer to the port data to the message * * center by name... * * * * History: Apr 23, 1991 Dave Created this routine * * ****************************************************************** */ #undef ROUTINE_NAME #define ROUTINE_NAME "receive_message" void receive_message(KS_SHARED_DATA_HDL *data_hdl, ResultBuf255Hndl *path_hdl) { ResponseRecord response_rec; KS_NAMED_MESSAGE named_msg; KS_NAMED_MSG_PTR msg_rec_ptr; Word message_id; Handle msg_handle; KS_E_ERROR error; extern Word ProgramID; *data_hdl = NULL; *path_hdl = NULL; /* ************************************************************** * * Start by getting the message id for the named message * * ************************************************************** */ named_msg.blockLen = sizeof(KS_NAMED_MESSAGE); strcpy(named_msg.message_name, "Kopriha Software SpoolMaster"); named_msg.name_length = strlen(named_msg.message_name); response_rec = MessageByName(FALSE, (void *) &named_msg); if (GET_ERROR() != KS_E_SUCCESS) { return; }; message_id = (response_rec & 0xffff); /* ************************************************************** * * Get the complete message from the message center * * ************************************************************** */ KS_MEMORY_ALLOCATE(attrNoSpec + attrNoCross, sizeof(KS_NAMED_MESSAGE), /* could be anything */ ProgramID, msg_handle, error); if (error != KS_E_SUCCESS) { return; }; MessageCenter((Word) getMessage, (Word) message_id, (Handle) msg_handle); if (GET_ERROR() == KS_E_SUCCESS) { msg_rec_ptr = (KS_NAMED_MSG_PTR) &(((MessageRecPtr) *msg_handle)->messageData); *data_hdl = msg_rec_ptr->shared_data_handle; *path_hdl = (ResultBuf255Hndl) msg_rec_ptr->shared_path_handle; }; KS_MEMORY_DEALLOCATE(msg_handle, error); /* ************************************************************** * * Return to our caller. * * ************************************************************** */ return; } /* End of receive_message() */
/*
* Copyright (c) Kopriha Software, 1991
* All Rights Reserved
*
* MSGReceive.CC
*
* Description:
* This module is message center options from the menus..
*
*
* Table of Contents:
*
* retrieve_message . . Get message by name for our caller...
*
* History:April 23, 1991 Dave Created this file
*
*/
/*
* define DEBUG_CODE
* - add # to define to create the local
* debug code (IE:module)
*/
#include <string.h>
#ifndef __LOCATOR__
#include <Locator.h>
#endif
#ifndef __MISCTOOL__
#include <MiscTool.h>
#endif
#ifndef _KS_DEFINES_
#include "KS.Defines.h"
#endif
#ifndef _KS_MEMORY_
#include "KS.Memory.H"
#endif
#ifndef _KS_SHARED_DATA_
#include "SharedData.H"
#endif
#pragma noroot
/* ****************************************************************** *
* receive_message() - Get a pointer to the port data to the message *
* center by name... *
* *
* History: Apr 23, 1991 Dave Created this routine *
* ****************************************************************** */
#undef ROUTINE_NAME
#define ROUTINE_NAME "receive_message"
void receive_message(KS_SHARED_DATA_HDL *data_hdl,
ResultBuf255Hndl *path_hdl)
{
ResponseRecord response_rec;
KS_NAMED_MESSAGE named_msg;
KS_NAMED_MSG_PTR msg_rec_ptr;
Word message_id;
Handle msg_handle;
KS_E_ERROR error;
extern Word ProgramID;
*data_hdl = NULL;
*path_hdl = NULL;
/* ************************************************************** *
* Start by getting the message id for the named message *
* ************************************************************** */
named_msg.blockLen = sizeof(KS_NAMED_MESSAGE);
strcpy(named_msg.message_name, "Kopriha Software SpoolMaster");
named_msg.name_length = strlen(named_msg.message_name);
response_rec = MessageByName(FALSE,
(void *) &named_msg);
if (GET_ERROR() != KS_E_SUCCESS)
{
return;
};
message_id = (response_rec & 0xffff);
/* ************************************************************** *
* Get the complete message from the message center *
* ************************************************************** */
KS_MEMORY_ALLOCATE(attrNoSpec + attrNoCross,
sizeof(KS_NAMED_MESSAGE), /* could be anything */
ProgramID,
msg_handle,
error);
if (error != KS_E_SUCCESS)
{
return;
};
MessageCenter((Word) getMessage,
(Word) message_id,
(Handle) msg_handle);
if (GET_ERROR() == KS_E_SUCCESS)
{
msg_rec_ptr = (KS_NAMED_MSG_PTR)
&(((MessageRecPtr) *msg_handle)->messageData);
*data_hdl = msg_rec_ptr->shared_data_handle;
*path_hdl = (ResultBuf255Hndl) msg_rec_ptr->shared_path_handle;
};
KS_MEMORY_DEALLOCATE(msg_handle,
error);
/* ************************************************************** *
* Return to our caller. *
* ************************************************************** */
return;
} /* End of receive_message() */

File diff suppressed because one or more lines are too long

View File

@ -1 +1,67 @@
# # $Id: Makefile,v 1.1 1997/12/19 07:54:51 gdr Exp $ # LIB = libdvr ODIR = obj OBJS = \ $(ODIR)/AddPath.o \ $(ODIR)/ChangeAux.o \ $(ODIR)/Close.o \ $(ODIR)/Create.o \ $(ODIR)/Data.o \ $(ODIR)/Delete.o \ $(ODIR)/GetBufSize.o \ $(ODIR)/GetVolume.o \ $(ODIR)/Gnfn.o \ $(ODIR)/MSGReceive.o \ $(ODIR)/MSGSend.o \ $(ODIR)/Open.o \ $(ODIR)/Read.o \ $(ODIR)/Rename.o \ $(ODIR)/SetBufSize.o \ $(ODIR)/SetDir.o \ $(ODIR)/SetEOF.o \ $(ODIR)/Space.o \ $(ODIR)/Write.o INCL2 = ../includes HDRS = ks.fileio.h $(INCL2)/ks.fileio.e $(INCL2)/ks.memory.h \ $(INCL2)/ks.defines.h $(INCL2)/KS.CDEV.h $(INCL2)/KS.Routines.h \ $(INCL2)/Portable.C.h $(INCL2)/SharedData.h SEGMENT = -Slibdvr____ CFLAGS = $(SEGMENT) -I$(INCL2) -r -w -v -O78 build: $(LIB) $(ODIR): install -d $(ODIR) $(LIB): $(OBJS) $(RM) -f $@ makelib.apw -w -r -p -l $@ $(OBJS) $(ODIR)/%.o: %.c $(CC) -o $@ -c $(CFLAGS) $< $(ODIR)/AddPath.o:: $(HDRS) $(ODIR)/Write.o:: $(HDRS) $(ODIR)/Space.o:: $(HDRS) $(ODIR)/SetEOF.o:: $(HDRS) $(ODIR)/SetDir.o:: $(HDRS) $(ODIR)/SetBufSize.o:: $(HDRS) $(ODIR)/Rename.o:: $(HDRS) $(ODIR)/Read.o:: $(HDRS) $(ODIR)/Open.o:: $(HDRS) $(ODIR)/msgsend.o:: $(HDRS) $(ODIR)/msgreceive.o:: $(HDRS) $(ODIR)/gnfn.o:: $(HDRS) $(ODIR)/GetVolume.o:: $(HDRS) $(ODIR)/GetBufSize.o:: $(HDRS) $(ODIR)/Delete.o:: $(HDRS) $(ODIR)/Data.o:: $(HDRS) $(ODIR)/Create.o:: $(HDRS) $(ODIR)/Close.o:: $(HDRS) $(ODIR)/ChangeAux.o:: $(HDRS)
#
# $Id: Makefile,v 1.2 1998/12/13 02:50:33 gdr-ftp Exp $
#
LIB = libdvr
ODIR = obj
OBJS = \
$(ODIR)/AddPath.o \
$(ODIR)/ChangeAux.o \
$(ODIR)/Close.o \
$(ODIR)/Create.o \
$(ODIR)/Data.o \
$(ODIR)/Delete.o \
$(ODIR)/GetBufSize.o \
$(ODIR)/GetVolume.o \
$(ODIR)/Gnfn.o \
$(ODIR)/MSGReceive.o \
$(ODIR)/MSGSend.o \
$(ODIR)/Open.o \
$(ODIR)/Read.o \
$(ODIR)/Rename.o \
$(ODIR)/SetBufSize.o \
$(ODIR)/SetDir.o \
$(ODIR)/SetEOF.o \
$(ODIR)/Space.o \
$(ODIR)/Write.o
INCL2 = ../includes
HDRS = ks.fileio.h $(INCL2)/ks.fileio.e $(INCL2)/ks.memory.h \
$(INCL2)/ks.defines.h $(INCL2)/KS.CDEV.h $(INCL2)/KS.Routines.h \
$(INCL2)/Portable.C.h $(INCL2)/SharedData.h
SEGMENT = -Slibdvr____
CFLAGS = $(SEGMENT) -I$(INCL2) -r -w -v -O78
build: $(LIB)
$(ODIR):
install -d $(ODIR)
$(LIB): $(OBJS)
$(RM) -f $@
makelib.apw -w -r -p -l $@ $(OBJS)
$(ODIR)/%.o: %.c
$(CC) -o $@ -c $(CFLAGS) $<
$(ODIR)/AddPath.o:: $(HDRS)
$(ODIR)/Write.o:: $(HDRS)
$(ODIR)/Space.o:: $(HDRS)
$(ODIR)/SetEOF.o:: $(HDRS)
$(ODIR)/SetDir.o:: $(HDRS)
$(ODIR)/SetBufSize.o:: $(HDRS)
$(ODIR)/Rename.o:: $(HDRS)
$(ODIR)/Read.o:: $(HDRS)
$(ODIR)/Open.o:: $(HDRS)
$(ODIR)/msgsend.o:: $(HDRS)
$(ODIR)/msgreceive.o:: $(HDRS)
$(ODIR)/gnfn.o:: $(HDRS)
$(ODIR)/GetVolume.o:: $(HDRS)
$(ODIR)/GetBufSize.o:: $(HDRS)
$(ODIR)/Delete.o:: $(HDRS)
$(ODIR)/Data.o:: $(HDRS)
$(ODIR)/Create.o:: $(HDRS)
$(ODIR)/Close.o:: $(HDRS)
$(ODIR)/ChangeAux.o:: $(HDRS)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1,78 @@
/* * Copyright (c) Kopriha Software, 1990-1991 * All Rights Reserved * * Rename.CC * * Description: * This module exists to abstract the data of the file I/O * primitives of GS/OS. * * * History:Jun 30, 1991 Dave Created this file * */ /* * define DEBUG_CODE * - add # to define to create the local * debug code (IE:module) */ #ifndef _KS_FILEIO_ #include "ks.fileio.h" #endif #pragma noroot /* ****************************************************************** * * ks_file_rename - Change the name of a file (given complete * * pathnames of the source/destination). * * * * History: June 30, 1991 Dave Created this routine * * ****************************************************************** */ #undef ROUTINE_NAME #define ROUTINE_NAME "ks_file_rename" KS_E_ERROR ks_file_rename(GSString255Ptr old_path, GSString255Ptr new_path) { /* ************************************************************** * * Local declarations: * * ************************************************************** */ KS_E_ERROR error; /* Holds error codes for subroutines */ ROUTINE_ENTER(); /* ************************************************************** * * Fill in the change path packet then issue the system call... * * ************************************************************** */ KSf_pkts.rename.pCount = 2; KSf_pkts.rename.pathname = old_path; KSf_pkts.rename.newPathname = new_path; ChangePathGS(&KSf_pkts.rename); if ((error = GET_ERROR()) != KS_E_SUCCESS) { KS_ERROR(error, KS_FILE_ID); }; /* ************************************************************** * * Return the success back to our caller. * * ************************************************************** */ KS_SUCCESS(); } /* End of ks_file_rename() */
/*
* Copyright (c) Kopriha Software, 1990-1991
* All Rights Reserved
*
* Rename.CC
*
* Description:
* This module exists to abstract the data of the file I/O
* primitives of GS/OS.
*
*
* History:Jun 30, 1991 Dave Created this file
*
*/
/*
* define DEBUG_CODE
* - add # to define to create the local
* debug code (IE:module)
*/
#ifndef _KS_FILEIO_
#include "ks.fileio.h"
#endif
#pragma noroot
/* ****************************************************************** *
* ks_file_rename - Change the name of a file (given complete *
* pathnames of the source/destination). *
* *
* History: June 30, 1991 Dave Created this routine *
* ****************************************************************** */
#undef ROUTINE_NAME
#define ROUTINE_NAME "ks_file_rename"
KS_E_ERROR ks_file_rename(GSString255Ptr old_path,
GSString255Ptr new_path)
{
/* ************************************************************** *
* Local declarations: *
* ************************************************************** */
KS_E_ERROR error; /* Holds error codes for subroutines */
ROUTINE_ENTER();
/* ************************************************************** *
* Fill in the change path packet then issue the system call... *
* ************************************************************** */
KSf_pkts.rename.pCount = 2;
KSf_pkts.rename.pathname = old_path;
KSf_pkts.rename.newPathname = new_path;
ChangePathGS(&KSf_pkts.rename);
if ((error = GET_ERROR()) != KS_E_SUCCESS)
{
KS_ERROR(error, KS_FILE_ID);
};
/* ************************************************************** *
* Return the success back to our caller. *
* ************************************************************** */
KS_SUCCESS();
} /* End of ks_file_rename() */

View File

@ -1 +1,70 @@
/* * Copyright (c) Kopriha Software, 1990-1991 * All Rights Reserved * * SetBufSize.CC * * Description: * This module exists to abstract the data of the file I/O * primitives of GS/OS. * * * History:Oct 13, 1990 Dave Created this file * * Feb 25, 1991 Dave Added I/O buffering * * May 26, 1991 Dave Added set EOF * * Jun 07, 1991 Dave Broke the single source into lots * of small sources so we can build * a library to use... * */ /* * define DEBUG_CODE * - add # to define to create the local * debug code (IE:module) */ #ifndef _KS_FILEIO_ #include "ks.fileio.h" #endif #pragma noroot /* ****************************************************************** * * ks_file_set_buffer_size - set the specified I/O buffer size. * * * * Note: Any open files that are using buffering will NOT change * * their buffer sizes until they need to do I/O! * * * * History: Mar 3, 1990 Dave Created this routine * * ****************************************************************** */ #undef ROUTINE_NAME #define ROUTINE_NAME "ks_file_set_buffer_size" KS_E_ERROR ks_file_set_buffer_size(LongWord buffer_size) { /* ************************************************************** * * Local declarations: * * ************************************************************** */ ROUTINE_ENTER(); /* ************************************************************** * * Set the buffer size back to our caller. * * ************************************************************** */ KSf_FileBufferSize = buffer_size; KS_SUCCESS(); } /* End of ks_file_set_buffer_size() */
/*
* Copyright (c) Kopriha Software, 1990-1991
* All Rights Reserved
*
* SetBufSize.CC
*
* Description:
* This module exists to abstract the data of the file I/O
* primitives of GS/OS.
*
*
* History:Oct 13, 1990 Dave Created this file
*
* Feb 25, 1991 Dave Added I/O buffering
*
* May 26, 1991 Dave Added set EOF
*
* Jun 07, 1991 Dave Broke the single source into lots
* of small sources so we can build
* a library to use...
*
*/
/*
* define DEBUG_CODE
* - add # to define to create the local
* debug code (IE:module)
*/
#ifndef _KS_FILEIO_
#include "ks.fileio.h"
#endif
#pragma noroot
/* ****************************************************************** *
* ks_file_set_buffer_size - set the specified I/O buffer size. *
* *
* Note: Any open files that are using buffering will NOT change *
* their buffer sizes until they need to do I/O! *
* *
* History: Mar 3, 1990 Dave Created this routine *
* ****************************************************************** */
#undef ROUTINE_NAME
#define ROUTINE_NAME "ks_file_set_buffer_size"
KS_E_ERROR ks_file_set_buffer_size(LongWord buffer_size)
{
/* ************************************************************** *
* Local declarations: *
* ************************************************************** */
ROUTINE_ENTER();
/* ************************************************************** *
* Set the buffer size back to our caller. *
* ************************************************************** */
KSf_FileBufferSize = buffer_size;
KS_SUCCESS();
} /* End of ks_file_set_buffer_size() */

View File

@ -1 +1,91 @@
/* * Copyright (c) Kopriha Software, 1990-1991 * All Rights Reserved * * SetDir.CC * * Description: * This module exists to abstract the data of the file I/O * primitives of GS/OS. * * * History:Oct 13, 1990 Dave Created this file * * Feb 25, 1991 Dave Added I/O buffering * * May 26, 1991 Dave Added set EOF * * Jun 07, 1991 Dave Broke the single source into lots * of small sources so we can build * a library to use... * */ /* * define DEBUG_CODE * - add # to define to create the local * debug code (IE:module) */ #ifndef _KS_FILEIO_ #include "ks.fileio.h" #endif #pragma noroot /* ****************************************************************** * * ks_file_set_directory - Set the current directory (actually, * * prefix 8). * * * * History: Mar 7, 1991 Dave Created this routine * * ****************************************************************** */ #undef ROUTINE_NAME #define ROUTINE_NAME "ks_file_set_directory" KS_E_ERROR ks_file_set_directory(GSString255Ptr directory_ptr) { /* ************************************************************** * * Local declarations: * * ************************************************************** */ KS_E_ERROR error; /* Holds error codes for subroutines */ ROUTINE_ENTER(); /* ************************************************************** * * Setup the packet to set prefix 8 then make the set prefix * * call. * * * * Note: We have to copy the prefix pathname into the buffer * * because of the way the GS/OS packet is set up. * * It would be nice to simply set a pointer... but we * * can't do that. * * ************************************************************** */ KSf_pkts.prefix.pCount = 2; KSf_pkts.prefix.prefixNum = 8; KSf_pkts.prefix.buffer.setPrefix = directory_ptr; SetPrefixGS(&KSf_pkts.prefix); /* ************************************************************** * * Return to our caller. * * ************************************************************** */ if ((error = GET_ERROR()) != KS_E_SUCCESS) { KS_ERROR(error, KS_FILE_ID); }; KS_SUCCESS(); } /* End of ks_file_set_directory() */
/*
* Copyright (c) Kopriha Software, 1990-1991
* All Rights Reserved
*
* SetDir.CC
*
* Description:
* This module exists to abstract the data of the file I/O
* primitives of GS/OS.
*
*
* History:Oct 13, 1990 Dave Created this file
*
* Feb 25, 1991 Dave Added I/O buffering
*
* May 26, 1991 Dave Added set EOF
*
* Jun 07, 1991 Dave Broke the single source into lots
* of small sources so we can build
* a library to use...
*
*/
/*
* define DEBUG_CODE
* - add # to define to create the local
* debug code (IE:module)
*/
#ifndef _KS_FILEIO_
#include "ks.fileio.h"
#endif
#pragma noroot
/* ****************************************************************** *
* ks_file_set_directory - Set the current directory (actually, *
* prefix 8). *
* *
* History: Mar 7, 1991 Dave Created this routine *
* ****************************************************************** */
#undef ROUTINE_NAME
#define ROUTINE_NAME "ks_file_set_directory"
KS_E_ERROR ks_file_set_directory(GSString255Ptr directory_ptr)
{
/* ************************************************************** *
* Local declarations: *
* ************************************************************** */
KS_E_ERROR error; /* Holds error codes for subroutines */
ROUTINE_ENTER();
/* ************************************************************** *
* Setup the packet to set prefix 8 then make the set prefix *
* call. *
* *
* Note: We have to copy the prefix pathname into the buffer *
* because of the way the GS/OS packet is set up. *
* It would be nice to simply set a pointer... but we *
* can't do that. *
* ************************************************************** */
KSf_pkts.prefix.pCount = 2;
KSf_pkts.prefix.prefixNum = 8;
KSf_pkts.prefix.buffer.setPrefix = directory_ptr;
SetPrefixGS(&KSf_pkts.prefix);
/* ************************************************************** *
* Return to our caller. *
* ************************************************************** */
if ((error = GET_ERROR()) != KS_E_SUCCESS)
{
KS_ERROR(error, KS_FILE_ID);
};
KS_SUCCESS();
} /* End of ks_file_set_directory() */

View File

@ -1 +1,86 @@
/* * Copyright (c) Kopriha Software, 1990-1991 * All Rights Reserved * * SetEOF.CC * * Description: * This module exists to abstract the data of the file I/O * primitives of GS/OS. * * * History:Oct 13, 1990 Dave Created this file * * Feb 25, 1991 Dave Added I/O buffering * * May 26, 1991 Dave Added set EOF * * Jun 07, 1991 Dave Broke the single source into lots * of small sources so we can build * a library to use... * */ /* * define DEBUG_CODE * - add # to define to create the local * debug code (IE:module) */ #ifndef _KS_FILEIO_ #include "ks.fileio.h" #endif #pragma noroot /* ****************************************************************** * * ks_file_set_eof - Set the end of file of an open file * * * * History: May 27, 1991 Dave Created this routine * * ****************************************************************** */ #undef ROUTINE_NAME #define ROUTINE_NAME "ks_file_set_eof" KS_E_ERROR ks_file_set_eof(KS_FILE_PTR file_ptr, LongWord new_eof) { /* ************************************************************** * * Local declarations: * * ************************************************************** */ KS_E_ERROR error; /* Holds error codes for subroutines */ ROUTINE_ENTER(); /* ************************************************************** * * Setup the packet then make the set EOF call... * * ************************************************************** */ KSf_pkts.position.pCount = 3; KSf_pkts.position.refNum = file_ptr->refNum; KSf_pkts.position.base = startPlus; KSf_pkts.position.displacement = new_eof; SetEOFGS(&KSf_pkts.position); /* ************************************************************** * * Return to our caller. * * ************************************************************** */ if ((error = GET_ERROR()) != KS_E_SUCCESS) { KS_ERROR(error, KS_FILE_ID); }; KS_SUCCESS(); } /* End of ks_file_set_eof() */
/*
* Copyright (c) Kopriha Software, 1990-1991
* All Rights Reserved
*
* SetEOF.CC
*
* Description:
* This module exists to abstract the data of the file I/O
* primitives of GS/OS.
*
*
* History:Oct 13, 1990 Dave Created this file
*
* Feb 25, 1991 Dave Added I/O buffering
*
* May 26, 1991 Dave Added set EOF
*
* Jun 07, 1991 Dave Broke the single source into lots
* of small sources so we can build
* a library to use...
*
*/
/*
* define DEBUG_CODE
* - add # to define to create the local
* debug code (IE:module)
*/
#ifndef _KS_FILEIO_
#include "ks.fileio.h"
#endif
#pragma noroot
/* ****************************************************************** *
* ks_file_set_eof - Set the end of file of an open file *
* *
* History: May 27, 1991 Dave Created this routine *
* ****************************************************************** */
#undef ROUTINE_NAME
#define ROUTINE_NAME "ks_file_set_eof"
KS_E_ERROR ks_file_set_eof(KS_FILE_PTR file_ptr,
LongWord new_eof)
{
/* ************************************************************** *
* Local declarations: *
* ************************************************************** */
KS_E_ERROR error; /* Holds error codes for subroutines */
ROUTINE_ENTER();
/* ************************************************************** *
* Setup the packet then make the set EOF call... *
* ************************************************************** */
KSf_pkts.position.pCount = 3;
KSf_pkts.position.refNum = file_ptr->refNum;
KSf_pkts.position.base = startPlus;
KSf_pkts.position.displacement = new_eof;
SetEOFGS(&KSf_pkts.position);
/* ************************************************************** *
* Return to our caller. *
* ************************************************************** */
if ((error = GET_ERROR()) != KS_E_SUCCESS)
{
KS_ERROR(error, KS_FILE_ID);
};
KS_SUCCESS();
} /* End of ks_file_set_eof() */

View File

@ -1 +1,116 @@
/* * Copyright (c) Kopriha Software, 1990-1991 * All Rights Reserved * * Space.CC * * Description: * This module exists to abstract the data of the file I/O * primitives of GS/OS. * * * History:Oct 13, 1990 Dave Created this file * * Feb 25, 1991 Dave Added I/O buffering * * May 26, 1991 Dave Added set EOF * * Jun 07, 1991 Dave Broke the single source into lots * of small sources so we can build * a library to use... * */ /* * define DEBUG_CODE * - add # to define to create the local * debug code (IE:module) */ #ifndef _KS_FILEIO_ #include "ks.fileio.h" #endif #pragma noroot /* ****************************************************************** * * ks_file_get_volume_space - Return the total/unused space of * * the specified volume * * * * History: Mar 13, 1991 Dave Created this routine * * ****************************************************************** */ #undef ROUTINE_NAME #define ROUTINE_NAME "ks_file_get_volume_space" KS_E_ERROR ks_file_get_volume_space(GSString255Ptr volume_ptr, LongWord *unused_space, LongWord *total_space) { /* ************************************************************** * * Local declarations: * * ************************************************************** */ KS_E_ERROR error; /* Holds error codes for subroutines */ ROUTINE_ENTER(); /* ************************************************************** * * Now lets generate some code that just shouldn't work... * * * * According to all the reference manuals, GetFileInfo does not * * return valid information on volumes or directories. * * * * The means we have to go back to the ProDOS 16 GET_FILE_INFO * * call that does return the volume size and number of allocated * * blocks (even if the manuals seem to disagree with this). * * * * To do a ProDOS 16 call, you have to pass a pascal string... * * which is a length byte followed by the string. Now a GS/OS * * string is a length word followed by the string. We are going * * to cheat once more by making the GS/OS string a Pascal string * * for the duration of this call... * * * * I don't like doing things this way, but the alternative is * * very ugly (start by scanning all devices with DInfo, the * * get the volume name of each disk device, then compare names * * until you find the specified volume, and finally you have * * the information for a Volume call). * * * * We'll cheat now - this may need fixing in the future. * * ************************************************************** */ (((char *) volume_ptr)[1]) = (((char *) volume_ptr)[0]); KSf_pkts.fileinfo.pathname = &(((char *) volume_ptr)[1]); GET_FILE_INFO(&KSf_pkts.fileinfo); (((char *) volume_ptr)[1]) = '\0'; if ((error = GET_ERROR()) != KS_E_SUCCESS) { KS_ERROR(error, KS_FILE_ID); }; *unused_space = (KSf_pkts.fileinfo.auxType - KSf_pkts.fileinfo.blocksUsed) / 2; *total_space = (KSf_pkts.fileinfo.auxType) / 2; /* ************************************************************** * * We'll never reach this part of the code... However, if by * * some cosmic reason we do - let us return a success. * * ************************************************************** */ KS_SUCCESS(); } /* End of ks_file_get_volume_space() */
/*
* Copyright (c) Kopriha Software, 1990-1991
* All Rights Reserved
*
* Space.CC
*
* Description:
* This module exists to abstract the data of the file I/O
* primitives of GS/OS.
*
*
* History:Oct 13, 1990 Dave Created this file
*
* Feb 25, 1991 Dave Added I/O buffering
*
* May 26, 1991 Dave Added set EOF
*
* Jun 07, 1991 Dave Broke the single source into lots
* of small sources so we can build
* a library to use...
*
*/
/*
* define DEBUG_CODE
* - add # to define to create the local
* debug code (IE:module)
*/
#ifndef _KS_FILEIO_
#include "ks.fileio.h"
#endif
#pragma noroot
/* ****************************************************************** *
* ks_file_get_volume_space - Return the total/unused space of *
* the specified volume *
* *
* History: Mar 13, 1991 Dave Created this routine *
* ****************************************************************** */
#undef ROUTINE_NAME
#define ROUTINE_NAME "ks_file_get_volume_space"
KS_E_ERROR ks_file_get_volume_space(GSString255Ptr volume_ptr,
LongWord *unused_space,
LongWord *total_space)
{
/* ************************************************************** *
* Local declarations: *
* ************************************************************** */
KS_E_ERROR error; /* Holds error codes for subroutines */
ROUTINE_ENTER();
/* ************************************************************** *
* Now lets generate some code that just shouldn't work... *
* *
* According to all the reference manuals, GetFileInfo does not *
* return valid information on volumes or directories. *
* *
* The means we have to go back to the ProDOS 16 GET_FILE_INFO *
* call that does return the volume size and number of allocated *
* blocks (even if the manuals seem to disagree with this). *
* *
* To do a ProDOS 16 call, you have to pass a pascal string... *
* which is a length byte followed by the string. Now a GS/OS *
* string is a length word followed by the string. We are going *
* to cheat once more by making the GS/OS string a Pascal string *
* for the duration of this call... *
* *
* I don't like doing things this way, but the alternative is *
* very ugly (start by scanning all devices with DInfo, the *
* get the volume name of each disk device, then compare names *
* until you find the specified volume, and finally you have *
* the information for a Volume call). *
* *
* We'll cheat now - this may need fixing in the future. *
* ************************************************************** */
(((char *) volume_ptr)[1]) = (((char *) volume_ptr)[0]);
KSf_pkts.fileinfo.pathname = &(((char *) volume_ptr)[1]);
GET_FILE_INFO(&KSf_pkts.fileinfo);
(((char *) volume_ptr)[1]) = '\0';
if ((error = GET_ERROR()) != KS_E_SUCCESS)
{
KS_ERROR(error, KS_FILE_ID);
};
*unused_space = (KSf_pkts.fileinfo.auxType -
KSf_pkts.fileinfo.blocksUsed) / 2;
*total_space = (KSf_pkts.fileinfo.auxType) / 2;
/* ************************************************************** *
* We'll never reach this part of the code... However, if by *
* some cosmic reason we do - let us return a success. *
* ************************************************************** */
KS_SUCCESS();
} /* End of ks_file_get_volume_space() */

File diff suppressed because one or more lines are too long

View File

@ -1 +1,105 @@
/* * Copyright (c) Kopriha Software, 1990-1991 * All Rights Reserved * * Gnfn.CC * * Description: * This module exists to abstract the data of the file I/O * primitives of GS/OS. * * * History:Oct 13, 1990 Dave Created this file * * Feb 25, 1991 Dave Added I/O buffering * * May 26, 1991 Dave Added set EOF * * Jun 07, 1991 Dave Broke the single source into lots * of small sources so we can build * a library to use... * */ /* * define DEBUG_CODE * - add # to define to create the local * debug code (IE:module) */ #ifndef _KS_FILEIO_ #include "ks.fileio.h" #endif #pragma noroot /* ****************************************************************** * * ks_file_get_next_file - Return the next filename in a directory. * * * * History: Mar 5, 1991 Dave Created this routine * * ****************************************************************** */ #undef ROUTINE_NAME #define ROUTINE_NAME "ks_file_get_next_file" KS_E_ERROR ks_file_get_next_file(KS_FILE_PTR file_ptr, DirEntryRecPtrGS dir_entry_ptr) { /* ************************************************************** * * Local declarations: * * ************************************************************** */ KS_E_ERROR error; /* Holds error codes for subroutines */ ROUTINE_ENTER(); /* ************************************************************** * * Set the parameters up and get the next directory entry. * * * * If we are at the end of the directory, then we have to do a * * special call to get the first entry - the open code will set * * the flag making it look like we're at the end of the directory* * for our first call. * * ************************************************************** */ dir_entry_ptr->pCount = 13; dir_entry_ptr->refNum = file_ptr->refNum; if (file_ptr->end_of_dir == TRUE) { dir_entry_ptr->base = 0; dir_entry_ptr->displacement = 0; file_ptr->end_of_dir = FALSE; } else { dir_entry_ptr->base = 1; dir_entry_ptr->displacement = 1; }; GetDirEntryGS(dir_entry_ptr); /* ************************************************************** * * Now check for errors. If we are at the end of the directory * * then send the end of directory flag. * * * * The last thing to do is to return to our caller. * * ************************************************************** */ if ((error = GET_ERROR()) != KS_E_SUCCESS) { if (error == endOfDir) { file_ptr->end_of_dir = TRUE; }; KS_ERROR(error, KS_FILE_ID); }; KS_SUCCESS(); } /* End of ks_file_get_next_file() */
/*
* Copyright (c) Kopriha Software, 1990-1991
* All Rights Reserved
*
* Gnfn.CC
*
* Description:
* This module exists to abstract the data of the file I/O
* primitives of GS/OS.
*
*
* History:Oct 13, 1990 Dave Created this file
*
* Feb 25, 1991 Dave Added I/O buffering
*
* May 26, 1991 Dave Added set EOF
*
* Jun 07, 1991 Dave Broke the single source into lots
* of small sources so we can build
* a library to use...
*
*/
/*
* define DEBUG_CODE
* - add # to define to create the local
* debug code (IE:module)
*/
#ifndef _KS_FILEIO_
#include "ks.fileio.h"
#endif
#pragma noroot
/* ****************************************************************** *
* ks_file_get_next_file - Return the next filename in a directory. *
* *
* History: Mar 5, 1991 Dave Created this routine *
* ****************************************************************** */
#undef ROUTINE_NAME
#define ROUTINE_NAME "ks_file_get_next_file"
KS_E_ERROR ks_file_get_next_file(KS_FILE_PTR file_ptr,
DirEntryRecPtrGS dir_entry_ptr)
{
/* ************************************************************** *
* Local declarations: *
* ************************************************************** */
KS_E_ERROR error; /* Holds error codes for subroutines */
ROUTINE_ENTER();
/* ************************************************************** *
* Set the parameters up and get the next directory entry. *
* *
* If we are at the end of the directory, then we have to do a *
* special call to get the first entry - the open code will set *
* the flag making it look like we're at the end of the directory*
* for our first call. *
* ************************************************************** */
dir_entry_ptr->pCount = 13;
dir_entry_ptr->refNum = file_ptr->refNum;
if (file_ptr->end_of_dir == TRUE)
{
dir_entry_ptr->base = 0;
dir_entry_ptr->displacement = 0;
file_ptr->end_of_dir = FALSE;
}
else
{
dir_entry_ptr->base = 1;
dir_entry_ptr->displacement = 1;
};
GetDirEntryGS(dir_entry_ptr);
/* ************************************************************** *
* Now check for errors. If we are at the end of the directory *
* then send the end of directory flag. *
* *
* The last thing to do is to return to our caller. *
* ************************************************************** */
if ((error = GET_ERROR()) != KS_E_SUCCESS)
{
if (error == endOfDir)
{
file_ptr->end_of_dir = TRUE;
};
KS_ERROR(error, KS_FILE_ID);
};
KS_SUCCESS();
} /* End of ks_file_get_next_file() */

View File

@ -1 +1,130 @@
/* * Copyright (c) Kopriha Software, 1990-1991 * All Rights Reserved * * ks.fileio.h * * Description: This include file contains all the generic file * support macros from Kopriha Software. * * * Table of contents: * * External Data Structures: * * Notes: * * History:Oct 13, 1990 Dave Created this file for basic * I/O (read/write) * * Feb 25, 1991 Dave Added buffer enhancements/create. * * Mar 5, 1991 Dave Added directory, file, path and * volume calls * * Mar 24, 1991 Dave Added delete and change aux type * */ #ifndef _KS_FILEIO_H_ #define _KS_FILEIO_H_ #ifndef _KS_FILEIO_E_ #include "ks.fileio.e" #endif #ifndef __GSOS__ #include <gsos.h> #endif #ifndef __PRODOS__ #include <ProDOS.h> #endif #ifndef __MEMORY__ #include <memory.h> #endif #ifndef _KS_MEMORY_ #include "ks.memory.h" #endif /* * Define all the external data referenced in this module: * * Note: The routines in this module minimize stack space usage, * which is why all the structures are external... */ /* ****************************************************************** * * KSf_Pkts - This is a union of all the GS/OS packets that are * * used by this module. Since multitasking isn't * * supported on a IIGS, we won't worry about needing * * seperate unions for each task (which is how we will * * solve this problem when multitasking does become * * available). * * * * Note: fileinfo is a ProDOS 16 structure - this is because GS/OS * * does not provide an easy method to determine the amount of * * space used on a volume. * * ****************************************************************** */ #ifdef FILEIO_DATA #ifdef EXTERNAL #undef EXTERNAL #define EXTERNAL #endif #endif #ifndef EXTERNAL #define EXTERNAL extern #endif EXTERNAL union { CreateRecGS create; OpenRecGS open; IORecGS IO; RefNumRecGS close; SetPositionRecGS position; PrefixRecGS prefix; FileRec fileinfo; FileInfoRecGS delete; FileInfoRecGS fileinfoGSOS; ChangePathRecGS rename; } KSf_pkts; /* ****************************************************************** * * KSf_pkts2 - This is the second unionized set of GS/OS packets. * * The reason for these packets is that the first packets* * sometimes have option fields that these packets must * * be used to fill in. * * * * optionList - this is the File System Translator specific * * area returned on the Open call. We don't do * * anything with this data. * * * * ****************************************************************** */ EXTERNAL union { Word optionList[20]; } KSf_pkts2; /* ****************************************************************** * * KSf_FileBufferSize - the specified size of the file buffers * * ****************************************************************** */ EXTERNAL Long KSf_FileBufferSize; #ifdef FILEIO_DATA #undef EXTERNAL #define EXTERNAL extern #endif #endif
/*
* Copyright (c) Kopriha Software, 1990-1991
* All Rights Reserved
*
* ks.fileio.h
*
* Description: This include file contains all the generic file
* support macros from Kopriha Software.
*
*
* Table of contents:
*
* External Data Structures:
*
* Notes:
*
* History:Oct 13, 1990 Dave Created this file for basic
* I/O (read/write)
*
* Feb 25, 1991 Dave Added buffer enhancements/create.
*
* Mar 5, 1991 Dave Added directory, file, path and
* volume calls
*
* Mar 24, 1991 Dave Added delete and change aux type
*
*/
#ifndef _KS_FILEIO_H_
#define _KS_FILEIO_H_
#ifndef _KS_FILEIO_E_
#include "ks.fileio.e"
#endif
#ifndef __GSOS__
#include <gsos.h>
#endif
#ifndef __PRODOS__
#include <ProDOS.h>
#endif
#ifndef __MEMORY__
#include <memory.h>
#endif
#ifndef _KS_MEMORY_
#include "ks.memory.h"
#endif
/*
* Define all the external data referenced in this module:
*
* Note: The routines in this module minimize stack space usage,
* which is why all the structures are external...
*/
/* ****************************************************************** *
* KSf_Pkts - This is a union of all the GS/OS packets that are *
* used by this module. Since multitasking isn't *
* supported on a IIGS, we won't worry about needing *
* seperate unions for each task (which is how we will *
* solve this problem when multitasking does become *
* available). *
* *
* Note: fileinfo is a ProDOS 16 structure - this is because GS/OS *
* does not provide an easy method to determine the amount of *
* space used on a volume. *
* ****************************************************************** */
#ifdef FILEIO_DATA
#ifdef EXTERNAL
#undef EXTERNAL
#define EXTERNAL
#endif
#endif
#ifndef EXTERNAL
#define EXTERNAL extern
#endif
EXTERNAL union
{
CreateRecGS create;
OpenRecGS open;
IORecGS IO;
RefNumRecGS close;
SetPositionRecGS position;
PrefixRecGS prefix;
FileRec fileinfo;
FileInfoRecGS delete;
FileInfoRecGS fileinfoGSOS;
ChangePathRecGS rename;
} KSf_pkts;
/* ****************************************************************** *
* KSf_pkts2 - This is the second unionized set of GS/OS packets. *
* The reason for these packets is that the first packets*
* sometimes have option fields that these packets must *
* be used to fill in. *
* *
* optionList - this is the File System Translator specific *
* area returned on the Open call. We don't do *
* anything with this data. *
* *
* ****************************************************************** */
EXTERNAL union
{
Word optionList[20];
} KSf_pkts2;
/* ****************************************************************** *
* KSf_FileBufferSize - the specified size of the file buffers *
* ****************************************************************** */
EXTERNAL Long KSf_FileBufferSize;
#ifdef FILEIO_DATA
#undef EXTERNAL
#define EXTERNAL extern
#endif
#endif

View File

@ -1 +1,20 @@
# # --- Link Script --- # # Build the Support library echo echo Putting objects into the Support.LB echo rm -f Support.LB makelib Support.LB +Objects/Close.A +Objects/ChangeAux.A makelib Support.LB +Objects/Create.A +Objects/Delete.A +Objects/GetBufSize.A makelib Support.LB +Objects/Gnfn.A +Objects/GetVolume.A +Objects/Space.A makelib Support.LB +Objects/Open.A +Objects/AddPath.A +Objects/Read.A makelib Support.LB +Objects/SetBufSize.A +Objects/SetDir.A +Objects/SetEOF.A makelib Support.LB +Objects/Write.A +Objects/Rename.A +Objects/Data.A makelib Support.LB +Objects/MSGSend.A +Objects/MSGReceive.A
#
# --- Link Script ---
#
# Build the Support library
echo
echo Putting objects into the Support.LB
echo
rm -f Support.LB
makelib Support.LB +Objects/Close.A +Objects/ChangeAux.A
makelib Support.LB +Objects/Create.A +Objects/Delete.A +Objects/GetBufSize.A
makelib Support.LB +Objects/Gnfn.A +Objects/GetVolume.A +Objects/Space.A
makelib Support.LB +Objects/Open.A +Objects/AddPath.A +Objects/Read.A
makelib Support.LB +Objects/SetBufSize.A +Objects/SetDir.A +Objects/SetEOF.A
makelib Support.LB +Objects/Write.A +Objects/Rename.A +Objects/Data.A
makelib Support.LB +Objects/MSGSend.A +Objects/MSGReceive.A