ftp.nice.ch/pub/next/science/physics/gck.2.01.s.tar.gz#/gckc.2.0.1/gck_errors.c

This is gck_errors.c in view mode; [Download] [Up]

/* ******************************************************************** */
/* *                           GCK                                    * */
/* *               A Circuit Simulation Program                       * */
/* *                    by Tanju Cataltepe                            * */
/* *                    (c) Copyright 1989                            * */
/* ******************************************************************** */
/* (c) Copyright 1989, Tanju Cataltepe */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>			
#include <ctype.h>
#include <time.h>

#ifdef Macintosh
#include <console.h> 
#include <Files.h>
#else
#include <sys/types.h>
#include <sys/stat.h>
#endif

#include <math.h>
#include <float.h>
#include "gck.h"
#include "gck_vars.h"
#include "gck_protos.h"
#include "gck_errors.h"

/* errorReport enhanced RdH January 1992 */
void errorReport(err_code, nm, err_type, err_index)
long err_code;
long err_type;		/* detailed description to err_code */
long err_index;		/* param relating to type of error  */
char *nm;
{
  fprintf(stderr,"*GCKC APPLICATION ERROR -- Program Terminating\n");
  
  /* progName */

  switch (err_code) {

  case ERROR_ARGUMENT_USAGE:
    fprintf(stderr,"Command Line requires at least one parameter passed.\n");
    break;

  case ERROR_COMMAND_LINE_SYMBOL:
    fprintf(stderr,"A Symbol on the Command Line (%s) is not of the correct form.\n",nm);
    break;

  case ERROR_GAUSSIAN:
    fprintf(stderr,"Gaussian Elimination reveals a Singular system\n");
    if (err_type == ERR_NODE)
      if (err_index != 0)
        fprintf(stderr,"Node:  %s\n",nodeNames.node[err_index].name);
      else
        fprintf(stderr,"Unable to determine node location.\nThe trouble Node may be within a Subcircuit\n");
    break;

  case ERROR_UNRESOLVED_BRANCH:
    fprintf(stderr,"The BRANCH (%s) is unknown.\n", nm);
    break;

  case ERROR_UNRESOLVED_MODEL:
    fprintf(stderr,"The MODEL (%s) was not found.\n", nm);
    break;

  case ERROR_UNRESOLVED_CLOCK:
    fprintf(stderr,"The CLOCK signal (%s) was not found.\n", nm);
    break;

  case ERROR_UNRESOLVED_SUBCKT:
    fprintf(stderr,"The SUBCKT (%s) is not defined.\n", nm);
    break;

  case ERROR_DUPLICATE_MODEL:
    fprintf(stderr,"The MODEL (%s) has already been defined.\n", nm);
    break;

  case ERROR_RECURSIVE_SUBCKT:
    fprintf(stderr,"The MODEL (%s) is defined within itself.\n", nm);
    fprintf(stderr,"Recursive subcircuits, obviously, are not allowed.\n");
    break;

  case ERROR_UNRESOLVED_SOURCE:
    fprintf(stderr,"Unknown source specification\n");
    break;

  case ERROR_QUANTIZER:
    fprintf(stderr,"The quantizer model (%s) is not of the correct form.\n", nm);
    break;

  case ERROR_DELAY_ZERO:
    fprintf(stderr,"The Delay of (%s) must be greater than 0.\n", nm);
    break;

  case ERROR_DIGITAL_UNKNOWN:
    fprintf(stderr,"Unknown digital component.\n");
    break;

  case ERROR_DUPLICATE_TABLE:
    fprintf(stderr,"The TABLE (%s) has already been defined.\n", nm);
    break;

  case ERROR_UNRESOLVED_TABLE:
    fprintf(stderr,"The TABLE (%s) was not defined.\n", nm);
    break;

/* misc. */
  case ERROR_WINDOW_NOT_FOUND:
    fprintf(stderr,"The Window Type (%s) is not available.\n",nm);
    break;

  case ERROR_LIBRARY_DEPTH:
    fprintf(stderr,"You have specified too many levels of LIBRARY indirection.\n");
    fprintf(stderr,"Go take a walk or something.  You're working too hard!\n");
    fprintf(stderr,"(Libraries can reference libraries, but not past %ld levels).\n",MAX_FILE_DEPTH);
    break;  

  case ERROR_INCONSISTENT_CLOCKS:
    fprintf(stderr,"An inconsistency in the number of clock phases has been found.\n");
    fprintf(stderr,"Make certain all .CLOCK and .SAMPLE cards all have the same number of phases.\n");
    break;  

  case ERROR_NODE_REQUEST:
    fprintf(stderr,"The NODE (%s) referenced does not exist.\n",nm);
    break;  

  case ERROR_SUBCKT_DEPTH:
    fprintf(stderr,"The Maximum Sub-Circuit Depth has been exceeded. (MAX_DEPTH = %ld).\n",MAX_SUBCKT_DEPTH);
	fprintf(stderr,"Might I suggest SABER, if you really need more levels of abstraction!\n");
    break;  

  case ERROR_SYMBOL_NOT_ASSIGNED:
    fprintf(stderr,"The reference SYMBOL (%s) was never assigned a global value.\n",nm);
    fprintf(stderr,"If you are referencing this SYMBOL locally,\n  assign a dummy value to the symbol at least once.\n");
    break;  

/* files not found */
  case ERROR_INPUT_FILE_NOT_FOUND:
    fprintf(stderr,"A Source Input FILE was not found.  (Filename %s).\n",nm);
    break;  

  case ERROR_INPUT_NOT_FOUND:
    fprintf(stderr,"The Main Input FILE was not found.  (Filename %s).\n",nm);
    break;  

  case ERROR_LIBRARY_NOT_FOUND:
    fprintf(stderr,"The Library Input FILE was not found (Filename %s).\n",nm);
    break;  

  case ERROR_MULTIPLE_INPUT_FILES:
	fprintf(stderr,"The Command Line found more than one input file.\n");
	break;

  case ERROR_SYMBOLS_ON_CQ:
    fprintf(stderr,"Symbols cannot be specified on the command line with the -Z option.\n");
    fprintf(stderr,"Circuit compilation not performed.\n");
    break;

  case ERROR_COMPILER_FILE_COULDNT_OPEN:
    fprintf(stderr,"The Circuit Compiler was unable to open the output file (%s).\n",nm);
    break;
    
  case ERROR_FILE_FFT_CANNOT_OPEN:
    fprintf(stderr,"The FFT Print Routine was unable to open the output file (%s).\n",nm);
    break;
    
  case ERROR_FILE_PRINT_CANNOT_OPEN:
    fprintf(stderr,"The Print Routine was unable to open the output file (%s).\n",nm);
    break;
    
  case ERROR_COMPILER_FILE_NOT_FOUND:
    fprintf(stderr,"The Quick Compiler couldn't find the compiled circuit file (%s).\n");
    break;
    
  case ERROR_COMPILER_TICKS_INCONSISTENT:
    fprintf(stderr,"The Quick Compiler found an inconsistent number of clock phases.\n");
    break;
    
  case ERROR_COMPILER_VARS_INCONSISTENT:
    fprintf(stderr,"The Quick Compiler found an inconsistent number of Variables.\n");
    break;
    
/* "broken" */
  case ERROR_BAD_PRINTSPEC:
    fprintf(stderr,"Print Card Specification is confusing.\n");
    fprintf(stderr,"Print variables are \"v\" or \"i\"\n");
    fprintf(stderr,"Prototype:  .PRINT V(1,2) V(Output) I(R1)\n");
    fprintf(stderr,"Your Card:\n  %s\n",rcard.Card);
    break;

  case ERROR_BAD_FFTSPEC:
    fprintf(stderr,"FFT Card Specification is confusing.\n");
    fprintf(stderr,"FFT variables are \"v\" or \"i\"\n");
    fprintf(stderr,"Prototype:  .FFT V(1,2) V(Output) I(R1)\n");
    fprintf(stderr,"Your Card:\n  %s\n",rcard.Card);
    break;

  case ERROR_SIN_CARD_BROKEN:
    fprintf(stderr,"Card parser unable to resolve card.\n");
    fprintf(stderr,"Source specification for SIN card is confusing.\n");
    fprintf(stderr,"Prototype:\n  Vyyyy <node_1> <node_2> SIN <amplitude> <frequency> [<delay>]\n");
    fprintf(stderr,"Your Card:\n  %s\n",rcard.Card);
    break;  

  case ERROR_COMB_CARD_BROKEN:
    fprintf(stderr,"Card parser unable to resolve card.\n");
    fprintf(stderr,"Source specification for COMB card is confusing.\n");
    fprintf(stderr,"Prototype:\n  Vyyyy <node_1> <node_2> COMB <amplitude> <start_f> <delta_f> <#_of_freq>\n");
    fprintf(stderr,"Your Card:\n  %s\n",rcard.Card);
    break;  

  case ERROR_PULSE_CARD_BROKEN:
    fprintf(stderr,"Card parser unable to resolve card.\n");
    fprintf(stderr,"Source specification for PULSE card is confusing.\n");
    fprintf(stderr,"Prototype:\n  Vyyyy <node_1> <node_2> PULSE <unpulsed_value> <pulsed_value> <period>\n  <delay> <rise_time> <duration_high> <fall_time>\n");
    fprintf(stderr,"Your Card:\n  %s\n",rcard.Card);
    break;  

  case ERROR_ADDER_CARD_BROKEN:
    fprintf(stderr,"Card parser unable to resolve card.\n");
    fprintf(stderr,"Digital ADDER card is confusing--check syntax please.\n");
    fprintf(stderr,"Prototype:\n  @AYYYY <n_output> <n_input1> <n_input2> <value1> <value2>\n");
    fprintf(stderr,"Your Card:\n  %s\n",rcard.Card);
    break;  

  case ERROR_LOGIC_CARD_BROKEN:
    fprintf(stderr,"Card parser unable to resolve card.\n");
    fprintf(stderr,"Digital LOGIC card is confusing--check syntax please.\n");
    fprintf(stderr,"Prototype:\n  $YYYY <n_output> <n_input> <node_0> ... <node_M> <Table> <0|1>\n  <v_th> <v_lo> <v_hi>\n");
    fprintf(stderr,"Your Card:\n  %s\n",rcard.Card);
    break;  

/* out of memory errors */
  case ERROR_REALLOC_MODEL:
    fprintf(stderr,"Out of Memory!\n");
    fprintf(stderr,"A Memory request when parsing a MODEL failed.\n");
    break;  

  case ERROR_REALLOC_DELAY:
    fprintf(stderr,"Out of Memory!\n");
    fprintf(stderr,"A Memory request when creating a DELAY element failed.\n");
    break;  

  case ERROR_REALLOC_NODE_MANAGER:
    fprintf(stderr,"Out of Memory!\n");
    fprintf(stderr,"A Memory request when creating additional space for NODES failed.\n");
    break;  

  case ERROR_REALLOC_NODE_ID:
    fprintf(stderr,"Out of Memory!\n");
    fprintf(stderr,"A Memory request when creating additional space for the NODE MANAGER failed.\n");
    break;  

  case ERROR_C_MALLOC_VOID:
    fprintf(stderr,"Out of Memory!\n");
    fprintf(stderr,"A Generic Memory allocation call failed.\n");
    break;  

  case ERROR_REALLOC_SYMBOL:
    fprintf(stderr,"Out of Memory!\n");
    fprintf(stderr,"A Memory request when allocating space for a SYMBOL failed.\n");
    break;  

/* internal errors */    
  case ERROR_GAUSSIAN_UNKNOWN_ELEMENT:
    fprintf(stderr,"Internal Circuit Compiler Error!\n");
    fprintf(stderr,"Gaussian Elimination Routine is unable to resolve the BRANCH (%s)\n", nm);
    break;

  case ERROR_C_MALLOC_SIZE_ZERO:
    fprintf(stderr,"Internal Circuit Compiler Error!\n");
    fprintf(stderr,"A request to allocate memory of size ZERO occurred.\n");
    break;  

  case ERROR_LOGICAL_LIST_COMPILER_ERROR:
    fprintf(stderr,"Internal Circuit Compiler Error!\n");
    fprintf(stderr,"Contact your program support representative for assistance.\n");
    fprintf(stderr,"Error Code %ld\n",ERROR_LOGICAL_LIST_COMPILER_ERROR);
    break;  

  case ERROR_GET_SYMBOL_VALUE:
    fprintf(stderr,"Internal Circuit Compiler Error!\n");
    fprintf(stderr,"The SYMBOL name requested was blank.\n");
    break;  

  case ERROR_SYMBOL_UNRESOLVED:
    fprintf(stderr,"Internal Circuit Compiler Error!\n");
    fprintf(stderr,"An internal attempt to find a SYMBOL failed.\n");
    break;  

  case ERROR_SYMBOL_CHECK:
    fprintf(stderr,"Internal Circuit Compiler Error!\n");
    fprintf(stderr,"The SYMBOL checking routine was handed a blank name.\n");
    break;  

  case ERROR_SYMBOL_CREATION_NULL:
    fprintf(stderr,"Internal Circuit Compiler Error!\n");
    fprintf(stderr,"The routine which creates a SYMBOL was handed a blank name.\n");
    break;  

  default:
    fprintf(stderr,"Internal Circuit Compiler Error!\n");
    fprintf(stderr,"Contact your program support representative for assistance.\n");
    fprintf(stderr,"Error Code \"DEFAULT\"\n");
    break;  

  }
  exit_now();
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.