Skip to content

Commit

Permalink
Merge pull request #28 from ra3xdh/revert-25-develop
Browse files Browse the repository at this point in the history
Revert "Fix build issues"
  • Loading branch information
ra3xdh authored Sep 28, 2024
2 parents 5cb8565 + 4c70d83 commit 37658cd
Show file tree
Hide file tree
Showing 35 changed files with 159 additions and 290 deletions.
2 changes: 0 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ foreach(type ${ParserTypes})
${BISON_EXECUTABLE}
--defines=parse_${type}.hpp
--output=parse_${type}.cpp
-v
-Wprecedence
${bisonIn}
DEPENDS ${bisonIn})
# Create custom Flex
Expand Down
95 changes: 48 additions & 47 deletions src/check_citi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ static char * citi_get_package (struct citi_package_t * p) {
}

/* Create a valid vector for the dataset. */
static qucs::vector * citi_create_vector (struct citi_package_t * p, int i, char * n, char * type) {
static qucs::vector * citi_create_vector (struct citi_package_t * p, int i,
char * n, char * type) {
qucs::vector * vec;
vec = citi_get_vector (p, i); // fetch vector
vec = new qucs::vector (*vec); // copy vector
Expand Down Expand Up @@ -194,8 +195,8 @@ int citi_check (void) {
int cvar = citi_count_variables (p);
if (cvec != cvar) {
logprint (LOG_ERROR, "checker error, no. of vectors (%d) does not equal "
"no. of variables (%d) in package `%s'\n", cvec, cvar,
package);
"no. of variables (%d) in package `%s'\n", cvec, cvar,
package);
errors++;
break;
}
Expand All @@ -212,50 +213,50 @@ int citi_check (void) {
for (h = p->head; h != NULL; h = h->next) {
qucs::vector * v;
if (h->var != NULL) {
char txt[sizeof(opack) + 16];
if (h->i1 >= 0) {
/* dependent variables */
if (h->i2 >= 0) {
sprintf (txt, "%s%s[%d,%d]", opack, h->var, h->i1, h->i2);
v = citi_create_vector (p, n, txt, h->type);
v->setDependencies (new strlist (deps));
errors += citi_check_dep_length (v, deps, package);
citi_result->addVariable (v);
n++;
} else {
sprintf (txt, "%s%s[%d]", opack, h->var, h->i1);
v = citi_create_vector (p, n, txt, h->type);
v->setDependencies (new strlist (deps));
errors += citi_check_dep_length (v, deps, package);
citi_result->addVariable (v);
n++;
}
} else if (h->n >= 0) {
/* independent variable */
sprintf (txt, "%s%s", opack, h->var);
v = citi_create_vector (p, n, txt, h->type);
deps.add (txt);
if (!citi_result->findDependency (txt)) {
/* add independent vectors only once */
citi_result->addDependency (v);
}
n++;
// check length of independent vector
if (v->getSize () != h->n) {
logprint (LOG_ERROR, "checker error, vector `%s' length (%d) "
"does not equal defined length (%d) in package `%s'\n",
h->var, v->getSize (), h->n, package);
errors++;
}
} else {
/* dependent variables, no indices */
sprintf (txt, "%s%s", opack, h->var);
v = citi_create_vector (p, n, txt, h->type);
v->setDependencies (new strlist (deps));
errors += citi_check_dep_length (v, deps, package);
citi_result->addVariable (v);
n++;
}
char txt[256];
if (h->i1 >= 0) {
/* dependent variables */
if (h->i2 >= 0) {
sprintf (txt, "%s%s[%d,%d]", opack, h->var, h->i1, h->i2);
v = citi_create_vector (p, n, txt, h->type);
v->setDependencies (new strlist (deps));
errors += citi_check_dep_length (v, deps, package);
citi_result->addVariable (v);
n++;
} else {
sprintf (txt, "%s%s[%d]", opack, h->var, h->i1);
v = citi_create_vector (p, n, txt, h->type);
v->setDependencies (new strlist (deps));
errors += citi_check_dep_length (v, deps, package);
citi_result->addVariable (v);
n++;
}
} else if (h->n >= 0) {
/* independent variable */
sprintf (txt, "%s%s", opack, h->var);
v = citi_create_vector (p, n, txt, h->type);
deps.add (txt);
if (!citi_result->findDependency (txt)) {
/* add independent vectors only once */
citi_result->addDependency (v);
}
n++;
// check length of independent vector
if (v->getSize () != h->n) {
logprint (LOG_ERROR, "checker error, vector `%s' length (%d) "
"does not equal defined length (%d) in package `%s'\n",
h->var, v->getSize (), h->n, package);
errors++;
}
} else {
/* dependent variables, no indices */
sprintf (txt, "%s%s", opack, h->var);
v = citi_create_vector (p, n, txt, h->type);
v->setDependencies (new strlist (deps));
errors += citi_check_dep_length (v, deps, package);
citi_result->addVariable (v);
n++;
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/check_mdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ valuelist<int> * mdl_find_depdataset (struct mdl_link_t * link,
else if (!strcmp (hyptab->name, "List Table")) {
lstsweep * sw = new lstsweep ();
sw->create (nof);
char txt[32];
char txt[16];
for (int i = 0; i < nof; i++) {
sprintf (txt, "Value %d", i + 1);
val = mdl_helement_dvalue (link, hyptab->data, txt);
Expand Down Expand Up @@ -418,7 +418,7 @@ static void mdl_find_varlink (struct mdl_link_t * link, char * name,
// Sorts a dependency list according to their sweep order.
static strlist * mdl_sort_deps (valuelist<int> * d) {
strlist * deps = new strlist ();
for (int i = 0; i < static_cast<int>(d->size()); i++) {
for (int i = 0; i < d->size(); i++) {
for (auto &val: *d) {
if (val.second == i + 1) {
deps->append (val.first.c_str());
Expand Down
38 changes: 19 additions & 19 deletions src/circuit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,22 +229,22 @@ void circuit::freeMatrixHB (void) {
/* Allocates the HB-matrix memory. */
void circuit::allocMatrixHB (void) {
if (VectorQ) {
memset (static_cast<void*>(VectorQ), 0, size * sizeof (nr_complex_t));
memset (VectorQ, 0, size * sizeof (nr_complex_t));
} else {
VectorQ = new nr_complex_t[size];
}
if (MatrixQV) {
memset (static_cast<void*>(MatrixQV), 0, size * size * sizeof (nr_complex_t));
memset (MatrixQV, 0, size * size * sizeof (nr_complex_t));
} else {
MatrixQV = new nr_complex_t[size * size];
}
if (VectorCV) {
memset (static_cast<void*>(VectorCV), 0, size * sizeof (nr_complex_t));
memset (VectorCV, 0, size * sizeof (nr_complex_t));
} else {
VectorCV = new nr_complex_t[size];
}
if (VectorGV) {
memset (static_cast<void*>(VectorGV), 0, size * sizeof (nr_complex_t));
memset (VectorGV, 0, size * sizeof (nr_complex_t));
} else {
VectorGV = new nr_complex_t[size];
}
Expand All @@ -253,7 +253,7 @@ void circuit::allocMatrixHB (void) {
/* Allocates the S-parameter matrix memory. */
void circuit::allocMatrixS (void) {
if (MatrixS) {
memset (static_cast<void*>(MatrixS), 0, size * size * sizeof (nr_complex_t));
memset (MatrixS, 0, size * size * sizeof (nr_complex_t));
} else {
MatrixS = new nr_complex_t[size * size];
}
Expand Down Expand Up @@ -654,8 +654,8 @@ void circuit::setMatrixS (matrix s) {
circuit. */
matrix circuit::getMatrixS (void) {
matrix res (size);
for(int i=0; i < size; ++i)
for(int j=0; j < size; ++j)
for(unsigned int i=0; i < size; ++i)
for(unsigned int j=0; j < size; ++j)
res(i,j) = MatrixS[i*size + j];
return res;
}
Expand All @@ -675,8 +675,8 @@ void circuit::setMatrixN (matrix n) {
matrix of the circuit. */
matrix circuit::getMatrixN (void) {
matrix res (size);
for(int i=0; i < size; ++i)
for(int j=0; j < size; ++j)
for(unsigned int i=0; i < size; ++i)
for(unsigned int j=0; j < size; ++j)
res(i,j) = MatrixN[i*size + j];
return res;
}
Expand All @@ -696,50 +696,50 @@ void circuit::setMatrixY (matrix y) {
circuit. */
matrix circuit::getMatrixY (void) {
matrix res (size);
for(int i=0; i < size; ++i)
for(int j=0; j < size; ++j)
for(unsigned int i=0; i < size; ++i)
for(unsigned int j=0; j < size; ++j)
res(i,j) = MatrixY[i*size + j];
return res;
}

// The function cleans up the B-MNA matrix entries.
void circuit::clearB (void) {
memset (static_cast<void*>(MatrixB), 0, sizeof (nr_complex_t) * size * vsources);
memset (MatrixB, 0, sizeof (nr_complex_t) * size * vsources);
}

// The function cleans up the C-MNA matrix entries.
void circuit::clearC (void) {
memset (static_cast<void*>(MatrixC), 0, sizeof (nr_complex_t) * size * vsources);
memset (MatrixC, 0, sizeof (nr_complex_t) * size * vsources);
}

// The function cleans up the D-MNA matrix entries.
void circuit::clearD (void) {
memset (static_cast<void*>(MatrixD), 0, sizeof (nr_complex_t) * vsources * vsources);
memset (MatrixD, 0, sizeof (nr_complex_t) * vsources * vsources);
}

// The function cleans up the E-MNA matrix entries.
void circuit::clearE (void) {
memset (static_cast<void*>(VectorE), 0, sizeof (nr_complex_t) * vsources);
memset (VectorE, 0, sizeof (nr_complex_t) * vsources);
}

// The function cleans up the J-MNA matrix entries.
void circuit::clearJ (void) {
memset (static_cast<void*>(VectorJ), 0, sizeof (nr_complex_t) * vsources);
memset (VectorJ, 0, sizeof (nr_complex_t) * vsources);
}

// The function cleans up the I-MNA matrix entries.
void circuit::clearI (void) {
memset (static_cast<void*>(VectorI), 0, sizeof (nr_complex_t) * size);
memset (VectorI, 0, sizeof (nr_complex_t) * size);
}

// The function cleans up the V-MNA matrix entries.
void circuit::clearV (void) {
memset (static_cast<void*>(VectorV), 0, sizeof (nr_complex_t) * size);
memset (VectorV, 0, sizeof (nr_complex_t) * size);
}

// The function cleans up the G-MNA matrix entries.
void circuit::clearY (void) {
memset (static_cast<void*>(MatrixY), 0, sizeof (nr_complex_t) * size * size);
memset (MatrixY, 0, sizeof (nr_complex_t) * size * size);
}

/* This function can be used by several components in order to place
Expand Down
2 changes: 1 addition & 1 deletion src/components/devices/thyristor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void thyristor::calcTheModel (bool last) {
isOn = Ud > Ud_bo;

nr_double_t Vak = real (getV (NODE_A1) - getV (NODE_A2));
isOn &= (Vak > 0.0);
isOn *= (Vak > 0.0);

if (Ud >= 80.0) {
Id *= std::exp (80.0) * (1.0 + Ud - 80.0) - 1.0;
Expand Down
2 changes: 1 addition & 1 deletion src/components/microstrip/bondwire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ void bondwire::calcDC(void)
}
}

void bondwire::calcTR()
void bondwire::calcTR(nr_double_t t)
{
calcDC();
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/microstrip/bondwire.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class bondwire : public qucs::circuit
void initTR (void);
void calcDC (void);
void calcAC (nr_double_t);
void calcTR ();
void calcTR (nr_double_t);
void calcNoiseAC (nr_double_t);
qucs::matrix calcMatrixY (nr_double_t);
void saveCharacteristics (nr_double_t);
Expand Down
6 changes: 1 addition & 5 deletions src/converter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ foreach(type ${ParserTypes})
${BISON_EXECUTABLE}
--defines=parse_${type}.hpp
--output=parse_${type}.cpp
-v
-Wce
-Wprecedence
-Wmidrule-value
${bisonIn}
DEPENDS ${bisonIn})
# Create custom Flex
Expand Down Expand Up @@ -64,4 +60,4 @@ target_link_libraries(qucsconv_rf libqucsator ${CMAKE_DL_LIBS})
#
# Handle installation
#
install(TARGETS qucsconv_rf DESTINATION bin)
install(TARGETS qucsconv_rf DESTINATION bin)
2 changes: 1 addition & 1 deletion src/converter/check_spice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ static void spice_translate_nodes (struct definition_t * def, int pass) {
node->node = strdup (t->node);
else {
// no node given, occurs in device descriptions
char txt[17];
char txt[16];
sprintf (txt, "%s%d", "_node", n);
node->node = strdup (txt);
}
Expand Down
Loading

0 comments on commit 37658cd

Please sign in to comment.