@@ -35,9 +35,9 @@ begins = which(diff(a)==1)+1
3535
3636f = file(opt $ out )
3737open(f ," wt" )
38- pushi = grep(" pushreal " ,lines )
39- looki = grep(" lookreal " ,lines )
40- popi = grep(" popreal " ,lines )
38+ pushi = grep(" push[rR]eal " ,lines )
39+ looki = grep(" look[rR]eal " ,lines )
40+ popi = grep(" pop[rR]eal " ,lines )
4141
4242begins = c(begins ,length(lines ))
4343alli = sort(c(pushi ,popi ,begins ,looki ))
@@ -63,7 +63,7 @@ for (i in alli) {
6363 decl = 0 ;
6464 } else {
6565 l = lines [i ]
66- l1 = sub(" [ pushpopreallook ]*" ," " ,l );
66+ l1 = sub(" [ pushpopRreallook ]*" ," " ,l );
6767 l1 = sub(" [_]?\\ (.*$" ," " ,l1 );
6868 tp = switch (l1 ,
6969 " 4" = list (type = " float" ,array = FALSE ),
@@ -92,21 +92,23 @@ for (i in alli) {
9292 cat(" var: " ,var ," ----- fixed\n " );
9393 buf = c(buf , paste(" //" ,l ));
9494 } else {
95- if (grepl(" pushreal " , l )) {
95+ if (grepl(" push " , l )) {
9696 idx = idx + 1
9797 name = paste(tmpname , idx , sep = " _" )
9898 if (idx > decl ) {
9999 vars = c(vars , paste(tp ," " ,name ,ar_dec ," ; // ADmod.R: " ,l ,sep = " " ));
100100 decl = idx ;
101101 }
102102 buf = c(buf , paste(name ,ar_idx ," = " , var ,ar_idx , " ; // ADmod.R: " ,l ,sep = " " ));
103- } else if (grepl(" lookreal " , l )) {
103+ } else if (grepl(" look " , l )) {
104104 name = paste(tmpname , idx , sep = " _" )
105105 buf = c(buf , paste(var ,ar_idx , " = " , name ,ar_idx ," ; // ADmod.R: " ,l ,sep = " " ));
106- } else {
106+ } else if (grepl( " pop " , l )) {
107107 name = paste(tmpname , idx , sep = " _" )
108108 buf = c(buf , paste(var ,ar_idx , " = " , name ,ar_idx ," ; // ADmod.R: " ,l ,sep = " " ));
109109 idx = idx - 1 ;
110+ } else {
111+ stop(" Unknown type of push/pop: " ,l );
110112 }
111113 }
112114 }
0 commit comments