Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:redwil:15.4
octave-forge-ocs
0001-Fix-break-fallthrough-in-switch-statements...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Fix-break-fallthrough-in-switch-statements.patch of Package octave-forge-ocs
From 7006872a694bac06d4a00723750981c0ff30f589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de> Date: Fri, 15 Mar 2019 22:53:28 +0100 Subject: [PATCH] Fix break/fallthrough in switch statements Octave's switch never fallthrough, and since Octave 5.1 a break inside a switch (outside a loop) is a syntax error. case 'Foo' <NL> case 'Bar' is an empty body for 'Foo'. --- inst/prs/prs_spice.m | 34 +++++++------------------------- inst/sbn/Mcapacitors.m | 6 +----- inst/sbn/Mcurrentsources.m | 3 +-- inst/sbn/Mdiode.m | 3 --- inst/sbn/Minductors.m | 2 +- inst/sbn/Mnmosfet.m | 4 ---- inst/sbn/Mpmosfet.m | 3 --- inst/sbn/Mresistors.m | 5 ----- inst/sbn/Mshichmanhodgesmosfet.m | 7 +------ inst/sbn/Mvoltagesources.m | 8 ++------ 10 files changed, 13 insertions(+), 62 deletions(-) diff --git a/inst/prs/prs_spice.m b/inst/prs/prs_spice.m index 35e6d27..033c0ca 100644 --- a/inst/prs/prs_spice.m +++ b/inst/prs/prs_spice.m @@ -323,8 +323,7 @@ endfunction function [outstruct, count] = lineParse (line, outstruct, count) if length (line) switch (line (1)) - case 'B' - case 'C' + case { 'B', 'C' } [outstruct, count] = prs_spice_C (line, outstruct, count); case 'D' [outstruct, count] = prs_spice_D (line, outstruct, count); @@ -338,8 +337,7 @@ function [outstruct, count] = lineParse (line, outstruct, count) ##mspINP2H (line, lineCounter); case 'I' ##mspINP2I (line, lineCounter); - case 'J' - case 'K' + case { 'J', 'K' } ##mspINP2K (line, lineCounter); case 'L' ##mspINP2L (line, lineCounter); @@ -349,18 +347,11 @@ function [outstruct, count] = lineParse (line, outstruct, count) ## case 'P' ## temporarily assigned to pMOS devices. ##[outstruct, count] = prs_spice_P (line, outstruct, count); - case 'Q' - case 'R' + case { 'Q', 'R' } [outstruct, count] = prs_spice_R (line, outstruct, count); - case 'S' - case 'T' - case 'U' - case 'V' + case { 'S', 'T', 'U', 'V' } [outstruct, count] = prs_spice_V (line, outstruct, count); - case 'W' - case 'X' - case 'Z' - case '.' + case { 'W', 'X', 'Z', '.' } [outstruct, count] = prs_spice_dot (line, outstruct, count); otherwise warn = sprintf (['prs_spice: Unsupported circuit element in line: ' line ]); @@ -909,23 +900,12 @@ function [outstruct, count] = prs_spice_dot (line, outstruct, count) model = regexp (line, '.MODEL[\s]+(?<mname>[\S]+)[\s]+(?<mtype>R|C|URC|D|NPN|PNP|NJF|PJF|NMOS|PMOS|NMF|PMF|SW|CSW)[\s]*\([\s]*(?<prms>.+)[\s]*\)', 'names'); if !isempty (model) switch (model.mtype) - case 'R' - case 'C' - case 'URC' - case 'D' + case { 'R', 'C', 'URC', 'D' } element = "Mdiode"; - case 'NPN' - case 'PNP' - case 'NJF' - case 'PJF' - case 'NMOS' + case { 'NPN', 'PNP', 'NJF', 'PJF', 'NMOS' } element = "Mnmosfet"; case 'PMOS' element = "Mpmosfet"; - case 'NMF' - case 'PMF' - case 'SW' - case 'CSW' otherwise syntaxError (line); endswitch diff --git a/inst/sbn/Mcapacitors.m b/inst/sbn/Mcapacitors.m index fdb22b1..b3a2d4e 100644 --- a/inst/sbn/Mcapacitors.m +++ b/inst/sbn/Mcapacitors.m @@ -72,7 +72,6 @@ function [a,b,c] = Mcapacitors(string,parameters,parameternames,extvar,intvar,t) a = [0 0 1; 0 0 -1; 0 0 0]; b = [0 0 0;0 0 0;-C C 1]; c = [0 0 0]'; - break case "MULTICAP" @@ -82,8 +81,6 @@ function [a,b,c] = Mcapacitors(string,parameters,parameternames,extvar,intvar,t) a = [zeros(n) eye(n); zeros(n) zeros(n)]; b = [zeros(n) zeros(n); -C eye(n)]; c = [zeros(2*n,1)]'; - - break ##NLC part case "PDE_NMOS" @@ -111,7 +108,6 @@ function [a,b,c] = Mcapacitors(string,parameters,parameternames,extvar,intvar,t) a = [0 0 1; 0 0 -1; 0 0 0]; b = [0 0 0;0 0 0;C -C -1]; c = [0 0 Q-q]'; - break otherwise error (["unknown section:" string]) @@ -175,4 +171,4 @@ function [Q,C]=Mnmoscap(tbulk,tox,Area,Vg,Na,Nnodes,toll,maxit); C = Area*C*(q*ns*xs/Vs); Q = Area*Q*(q*ns*xs); -endfunction \ No newline at end of file +endfunction diff --git a/inst/sbn/Mcurrentsources.m b/inst/sbn/Mcurrentsources.m index 707aa75..869c32f 100644 --- a/inst/sbn/Mcurrentsources.m +++ b/inst/sbn/Mcurrentsources.m @@ -71,7 +71,6 @@ function [a,b,c] = Mcurrentsources (string,parameters,parameternames,extvar,intv a = zeros(2); b = a; c = [I -I]'; - break case "VCCS" ## Voltage controlled current source @@ -86,6 +85,7 @@ function [a,b,c] = Mcurrentsources (string,parameters,parameternames,extvar,intv 0 0 0 0;... 0 0 0 0]; c = zeros(4,1); + ## NLC part case "sinwave" for ii=1:length(parameternames) @@ -96,7 +96,6 @@ function [a,b,c] = Mcurrentsources (string,parameters,parameternames,extvar,intv a = zeros(2); b = a; c = [I -I]'; - break case "VCPS" ## Voltage controlled power source diff --git a/inst/sbn/Mdiode.m b/inst/sbn/Mdiode.m index 9db5410..44a4b00 100644 --- a/inst/sbn/Mdiode.m +++ b/inst/sbn/Mdiode.m @@ -74,7 +74,6 @@ function [a,b,c] = Mdiode (string,parameters,parameternames,extvar,intvar,t) a = zeros(2); b = [geq -geq; -geq geq]; c = [I ; -I] ; - break case "PDEsymmetric" @@ -102,8 +101,6 @@ function [a,b,c] = Mdiode (string,parameters,parameternames,extvar,intvar,t) b = [g -g; -g g]; c = [I ; -I] ; - break - otherwise error(["unknown section:" string]) endswitch diff --git a/inst/sbn/Minductors.m b/inst/sbn/Minductors.m index 219a922..799cf98 100644 --- a/inst/sbn/Minductors.m +++ b/inst/sbn/Minductors.m @@ -74,4 +74,4 @@ function [a,b,c] = Minductors (string,parameters,parameternames,extvar,intvar,t) endswitch endfunction - \ No newline at end of file + diff --git a/inst/sbn/Mnmosfet.m b/inst/sbn/Mnmosfet.m index 5fe4962..a37bcc7 100644 --- a/inst/sbn/Mnmosfet.m +++ b/inst/sbn/Mnmosfet.m @@ -79,7 +79,6 @@ function [a,b,c]=Mnmosfet(string,parameters,parameternames,extvar,intvar,t) if (vgs < Vth) - gm = 0; gd = 1/rd; id = vds*gd; @@ -112,7 +111,6 @@ function [a,b,c]=Mnmosfet(string,parameters,parameternames,extvar,intvar,t) 0 0 0 0]; c = [0 -id id 0]'; - break; case "lincap" @@ -140,7 +138,6 @@ function [a,b,c]=Mnmosfet(string,parameters,parameternames,extvar,intvar,t) tmpstruct = prs_iff(mtdnmos); endif - tmpstruct.NLC.pvmatrix = [k Vth rd]; tmpstruct.LCR(1).pvmatrix = [Rs; Rd]; @@ -153,7 +150,6 @@ function [a,b,c]=Mnmosfet(string,parameters,parameternames,extvar,intvar,t) b = B+Jac; c = res + B*[extvar;intvar] + C; - break; otherwise error(["unknown option:" string]); endswitch diff --git a/inst/sbn/Mpmosfet.m b/inst/sbn/Mpmosfet.m index c4fbae3..58ef919 100644 --- a/inst/sbn/Mpmosfet.m +++ b/inst/sbn/Mpmosfet.m @@ -108,7 +108,6 @@ function [a,b,c]= Mpmosfet (string,parameters,parameternames,extvar,intvar,t) 0 0 0 0 ]; c =[0 -id id 0]'; - break; case "lincap" @@ -144,8 +143,6 @@ function [a,b,c]= Mpmosfet (string,parameters,parameternames,extvar,intvar,t) b = B+Jac; c = res + B*[extvar;intvar] + C; - break; - otherwise error(["unknown option:" string]); endswitch diff --git a/inst/sbn/Mresistors.m b/inst/sbn/Mresistors.m index e8862b9..e0d43d4 100644 --- a/inst/sbn/Mresistors.m +++ b/inst/sbn/Mresistors.m @@ -75,7 +75,6 @@ function [a,b,c] = Mresistors (string, parameters, parameternames, b = [1 -1 ;-1 1]/R; c = -[0; 0]; - break ##NLCpart case "THERMAL" @@ -100,8 +99,6 @@ function [a,b,c] = Mresistors (string, parameters, parameternames, -2*(v1-v2)/RT -2*(v2-v1)/RT (v1-v2)^2*dRdT/RT^2]; c = [i1 i2 P]'; - break; - case "THERMAL1D" for ii=1:length(parameternames) @@ -123,8 +120,6 @@ function [a,b,c] = Mresistors (string, parameters, parameternames, b = k*(S/h)*[B(ext,ext), B(ext,int); B(int,ext), B(int,int)]; c = zeros(N+1,1); - break; - otherwise error (["unknown section:" string]) endswitch diff --git a/inst/sbn/Mshichmanhodgesmosfet.m b/inst/sbn/Mshichmanhodgesmosfet.m index d5a2c93..893872d 100644 --- a/inst/sbn/Mshichmanhodgesmosfet.m +++ b/inst/sbn/Mshichmanhodgesmosfet.m @@ -140,9 +140,6 @@ function [a,b,c]= Mshichmanhodgesmosfet (string,parameters,parameternames,extvar c = [c1;c2]; - - break; - case "PMOS" rd = 1e6; @@ -218,8 +215,6 @@ function [a,b,c]= Mshichmanhodgesmosfet (string,parameters,parameternames,extvar c = [c1;c2]; - break; - otherwise error(["unknown option:" string]); endswitch @@ -329,4 +324,4 @@ function [gm,gd,ids,didT,P,dPdT,dPdvgs,dPdvds] = pmos(extvar,mu0,Cox,W,L,Vth,rd, dPdvgs = -(gm*vds); dPdvds = -(gd*vds + ids); -endfunction \ No newline at end of file +endfunction diff --git a/inst/sbn/Mvoltagesources.m b/inst/sbn/Mvoltagesources.m index b0a9819..e0a2408 100644 --- a/inst/sbn/Mvoltagesources.m +++ b/inst/sbn/Mvoltagesources.m @@ -92,7 +92,7 @@ function [a,b,c] = Mvoltagesources (string,parameters,parameternames,extvar,intv a = zeros(3); b = [0 0 1;0 0 -1;1 -1 0]; c = [0 0 -V]; - break + ## NLC part case "sinwave" for ii=1:length(parameternames) @@ -105,7 +105,6 @@ function [a,b,c] = Mvoltagesources (string,parameters,parameternames,extvar,intv a = zeros(3); b = [0 0 1;0 0 -1;1 -1 0]; c = [0 0 -DV]' + b * [extvar;intvar]; - break case "pwl" @@ -118,7 +117,6 @@ function [a,b,c] = Mvoltagesources (string,parameters,parameternames,extvar,intv a = zeros(3); b = [0 0 1;0 0 -1;1 -1 0]; c = [0 0 -DV]' + b * [extvar;intvar]; - break case "squarewave" for ii=1:length(parameternames) @@ -144,7 +142,6 @@ function [a,b,c] = Mvoltagesources (string,parameters,parameternames,extvar,intv a = zeros(3); b = [0 0 1;0 0 -1;1 -1 0]; c = [0 0 -DV]' + b * [extvar;intvar]; - break case "step" for ii=1:length(parameternames) @@ -162,7 +159,6 @@ function [a,b,c] = Mvoltagesources (string,parameters,parameternames,extvar,intv a = zeros(3); b = [0 0 1;0 0 -1;1 -1 0]; c = [0 0 -DV]' + b * [extvar;intvar]; - break case "VCVS" K = 1; @@ -175,7 +171,7 @@ function [a,b,c] = Mvoltagesources (string,parameters,parameternames,extvar,intv a = zeros(5); b = [0 0 0 0 1;0 0 0 0 -1;0 0 0 0 0;0 0 0 0 0;1 -1 -K K 0]; c = zeros(5,1); - break + otherwise error (["unknown section:" string]) endswitch -- 2.21.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor