home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Audio 4.94 - Over 11,000 Files
/
audio-11000.iso
/
amiga
/
midi
/
obrst103.lha
/
OberSuite-1.03
/
SourceCode
/
usage.c
< prev
Wrap
C/C++ Source or Header
|
1993-01-23
|
6KB
|
213 lines
/**************************************************************************
* usage.c: Usage and error messages.
* A part of OberSuite for the Commodore Amiga.
*
* Author: Daniel Barrett, barrett@cs.umass.edu.
* Version: 1.0.
* Copyright: None! This program is in the Public Domain.
* Please share it with others.
***************************************************************************/
#include "decl.h"
#include "oberheim.h"
/***************************************************************************
* NOTE: programName is a global variable.
***************************************************************************/
/***************************************************************************
* Simple usage messages. The routine UsageMsg() must be supplied
* elsewhere. Look for it in the file containing main().
***************************************************************************/
/*
* A full usage message.
*/
void DetailedUsage(void)
{
if (!ERR_OUTPUT_ALLOWED)
return;
Author();
UsageMsg();
}
/*
* Tell the user how to get more help.
*/
void BegForUsage()
{
if (!ERR_OUTPUT_ALLOWED)
return;
fprintf(stderr, "Type \"%s ?\" for details.\n", programName);
}
/*
* Print the author's name and copyright information.
*/
void Author(void)
{
if (!ERR_OUTPUT_ALLOWED)
return;
fprintf(stderr, "%s%s%s version %s by %s.\n",
HILITE_ON, programName, HILITE_OFF,
Version(), AUTHOR);
fprintf(stderr,
"100%% public domain -- please share this program.\n\n");
}
/***************************************************************************
* Error message handling.
* Essentially a table of error message, indexed by the given integer code.
***************************************************************************/
void ErrorMsg(int code)
{
if (!ERR_OUTPUT_ALLOWED)
return;
fflush(stdout);
fprintf(stderr, "%sError:%s ", HILITE_ON, HILITE_OFF);
switch (code)
{
case ERROR_PATCHNUM:
fprintf(stderr,
"Your patch number is invalid or out of range (%d-%d).\n",
FIRST_PATCH, LAST_PATCH);
BegForUsage();
break;
case ERROR_PATCHTYPE:
fprintf(stderr, "Your patch number must begin with"
" the letter \"%c\" or \"%c\".\n",
LETTER_SINGLE, LETTER_MULTI);
BegForUsage();
break;
case ERROR_FINDFILE:
fprintf(stderr, "That file cannot be found.\n");
break;
case ERROR_CREATEFILE:
fprintf(stderr, "That file cannot be created.\n");
break;
case ERROR_READFILE:
fprintf(stderr, "Error while reading the file!\n");
break;
case ERROR_WRITEFILE:
fprintf(stderr, "Error while writing the file!\n");
break;
case ERROR_NUMARGS:
fprintf(stderr, "Wrong number of arguments.\n");
BegForUsage();
break;
case ERROR_FAILED:
fprintf(stderr, "The patch transmission FAILED.\n");
break;
case ERROR_FILESIZE:
fprintf(stderr, "Your file has an illegal size.\n");
break;
case ERROR_CTRLC:
fprintf(stderr, "You typed ^C to stop the program.\n");
break;
case ERROR_GETFAILED:
fprintf(stderr, "I could not read the data.\n");
break;
case ERROR_PUTFAILED_SEND:
fprintf(stderr, "I could not send the data.\n");
break;
case ERROR_PUTFAILED_SAVE:
fprintf(stderr, "I could not save the data.\n");
break;
case ERROR_NOTSYSEX:
fprintf(stderr,
"This data is missing a begin-system-exclusive byte.\n");
break;
case ERROR_NOTOBERHEIM:
fprintf(stderr, "This system exclusive data is not from an"
" Oberheim synth.");
break;
case ERROR_NOTXPMATRIX:
fprintf(stderr,
"This Oberheim system exclusive data is from "
" neither an Xpander\nnor a Matrix-12");
break;
case ERROR_NOTPATCHDATA:
fprintf(stderr,
"This Oberheim system exclusive data is not a patch dump.\n");
break;
case ERROR_UNKNOWNVOICEDATA:
fprintf(stderr,
"This Oberheim patch is neither a single nor a"
" multi patch");
break;
case ERROR_NOEOX:
fprintf(stderr, "This Oberheim patch data is missing an"
" end-of-system-exclusive byte");
break;
case ERROR_DATATOOBIG:
fprintf(stderr, "Too much data was found.\n");
break;
case ERROR_DATATOOSMALL:
fprintf(stderr, "Not enough data was found.\n");
break;
case ERROR_CREATEPORT:
fprintf(stderr, "Cannot create a message port.\n");
break;
case ERROR_IOEXTSER:
fprintf(stderr, "Cannot create an extended I/O request.\n");
break;
case ERROR_OPENDEVICE:
fprintf(stderr, "Cannot open the MIDI device.\n");
break;
case ERROR_SETPARAMS:
fprintf(stderr, "Cannot set the serial parameters.\n");
break;
case ERROR_OBDEVICE:
fprintf(stderr,
"Your MIDI device name (in variable "
ENVIRONMENT_VAR
") is missing a\ncolon and/or a unit number.\n");
break;
case ERROR_OBUNIT:
fprintf(stderr,
"Your MIDI device unit number (in variable "
ENVIRONMENT_VAR
") must be\nan integer.\n");
break;
case ERROR_MALLOC:
fprintf(stderr, "Not enough memory.\n");
break;
case ERROR_TWOPRINTS:
fprintf(stderr,
"You specified more than 1 output option.\n");
break;
case ERROR_NODEST:
fprintf(stderr, "You did not specify a destination.\n");
break;
case ERROR_REALNAMESFILEONLY:
fprintf(stderr,
"The -%c option requires the -%c option.\n",
OPT_USEREALNAMES, OPT_FILE);
break;
case ERROR_OVERWRITEFILEONLY:
fprintf(stderr,
"The -%c option requires the -%c option.\n",
OPT_OVERWRITE, OPT_FILE);
break;
default:
fprintf(stderr, "An unknown error (code %d) occurred.\n",
code);
break;
}
}