Jspice3
cktclrbk.c
Go to the documentation of this file.
1 /***************************************************************************
2 JSPICE3 adaptation of Spice3f2 - Copyright (c) Stephen R. Whiteley 1992
3 Copyright 1990 Regents of the University of California. All rights reserved.
4 Authors: 1985 Thomas L. Quarles
5  1993 Stephen R. Whiteley
6 ****************************************************************************/
7 
8  /* CKTclrBreak(ckt)
9  * delete the first time from the breakpoint table for the given circuit
10  */
11 
12 #include "spice.h"
13 #include <stdio.h>
14 #include "cktdefs.h"
15 #include "sperror.h"
16 #include "util.h"
17 #include "cktext.h"
18 
19 
20 int
22 
23 CKTcircuit *ckt;
24 {
25  double *tmp;
26  int j;
27 
28  if (ckt->CKTbreakSize > 2) {
29  tmp = (double *)MALLOC((ckt->CKTbreakSize-1)*sizeof(double));
30  if (tmp == (double *)NULL) return(E_NOMEM);
31  for (j = 1; j < ckt->CKTbreakSize; j++) {
32  *(tmp+j-1) = *(ckt->CKTbreaks+j);
33  }
34  FREE(ckt->CKTbreaks);
35  ckt->CKTbreakSize--;
36  ckt->CKTbreaks=tmp;
37  }
38  else {
39  *(ckt->CKTbreaks) = *(ckt->CKTbreaks+1);
40  *(ckt->CKTbreaks+1) = ckt->CKTfinalTime;
41  }
42  return (OK);
43 }
#define FREE(ptr)
Definition: spdefs.h:436
#define OK
Definition: iferrmsg.h:17
#define MALLOC(x)
Definition: util.h:9
int CKTclrBreak(CKTcircuit *ckt)
Definition: cktclrbk.c:21
#define NULL
Definition: spdefs.h:121
#define E_NOMEM
Definition: iferrmsg.h:27