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
*