| 1 |
diff -c --exclude=.depend --exclude='*.html*' -r -w solvers/asl.h /home/ladanyi/Ipopt.orig/Extern/ASL/solvers/asl.h |
| 2 |
*** solvers/asl.h 2005-06-25 12:56:47.000000000 -0400 |
| 3 |
--- /home/ladanyi/Ipopt.orig/Extern/ASL/solvers/asl.h 2006-03-03 14:50:03.000000000 -0500 |
| 4 |
*************** |
| 5 |
*** 200,205 **** |
| 6 |
--- 200,209 ---- |
| 7 |
char rl_buf[80]; |
| 8 |
void (*iadjfcn) ANSI((void*, unsigned long)); |
| 9 |
void (*dadjfcn) ANSI((void*, unsigned long)); |
| 10 |
+ /* LL */ |
| 11 |
+ char *snl; |
| 12 |
+ int snl_pos; |
| 13 |
+ int snl_len; |
| 14 |
} EdRead_ASL; |
| 15 |
#define EdRead EdRead_ASL |
| 16 |
|
| 17 |
*************** |
| 18 |
*** 542,547 **** |
| 19 |
--- 546,552 ---- |
| 20 |
ASL { |
| 21 |
Edagpars p; |
| 22 |
Edaginfo i; |
| 23 |
+ EdRead_ASL Rbackup; |
| 24 |
}; |
| 25 |
|
| 26 |
typedef struct |
| 27 |
diff -c --exclude=.depend --exclude='*.html*' -r -w solvers/jac0dim.c /home/ladanyi/Ipopt.orig/Extern/ASL/solvers/jac0dim.c |
| 28 |
*** solvers/jac0dim.c 2003-12-13 16:23:55.000000000 -0500 |
| 29 |
--- /home/ladanyi/Ipopt.orig/Extern/ASL/solvers/jac0dim.c 2006-03-03 14:50:01.000000000 -0500 |
| 30 |
*************** |
| 31 |
*** 122,134 **** |
| 32 |
FILE *nl; |
| 33 |
int i, k, nlv; |
| 34 |
char *s, *se; |
| 35 |
! EdRead ER, *R; |
| 36 |
|
| 37 |
if (!asl) |
| 38 |
badasl_ASL(asl,0,"jac0dim"); |
| 39 |
fpinit_ASL(); /* get IEEE arithmetic, if possible */ |
| 40 |
|
| 41 |
! if (stub_len <= 0) |
| 42 |
for(i = 0; stub[i]; i++); |
| 43 |
else |
| 44 |
for(i = stub_len; stub[i-1] == ' ' && i > 0; --i); |
| 45 |
--- 122,142 ---- |
| 46 |
FILE *nl; |
| 47 |
int i, k, nlv; |
| 48 |
char *s, *se; |
| 49 |
! EdRead *R; |
| 50 |
|
| 51 |
if (!asl) |
| 52 |
badasl_ASL(asl,0,"jac0dim"); |
| 53 |
fpinit_ASL(); /* get IEEE arithmetic, if possible */ |
| 54 |
|
| 55 |
! R = EdReadInit_ASL(&asl->Rbackup, asl, NULL, 0); |
| 56 |
! if (stub_len < 0) { |
| 57 |
! /* Treat the stub as the content of the file */ |
| 58 |
! R->snl = stub; |
| 59 |
! R->snl_pos = 0; |
| 60 |
! R->snl_len = -stub_len; |
| 61 |
! nl = NULL; |
| 62 |
! } else { |
| 63 |
! if (stub_len == 0) |
| 64 |
for(i = 0; stub[i]; i++); |
| 65 |
else |
| 66 |
for(i = stub_len; stub[i-1] == ' ' && i > 0; --i); |
| 67 |
*************** |
| 68 |
*** 150,156 **** |
| 69 |
fprintf(Stderr, "can't open %s\n", filename); |
| 70 |
exit(1); |
| 71 |
} |
| 72 |
! R = EdReadInit_ASL(&ER, asl, nl, 0); |
| 73 |
R->Line = 0; |
| 74 |
s = read_line(R); |
| 75 |
binary_nl = 0; |
| 76 |
--- 158,165 ---- |
| 77 |
fprintf(Stderr, "can't open %s\n", filename); |
| 78 |
exit(1); |
| 79 |
} |
| 80 |
! } |
| 81 |
! R->nl = nl; |
| 82 |
R->Line = 0; |
| 83 |
s = read_line(R); |
| 84 |
binary_nl = 0; |
| 85 |
*************** |
| 86 |
*** 285,291 **** |
| 87 |
{ |
| 88 |
FILE *nl; |
| 89 |
|
| 90 |
! if (nl = jac0dim_ASL(asl, stub, stub_len)) { |
| 91 |
*M = n_con; |
| 92 |
*N = n_var; |
| 93 |
*NO = n_obj; |
| 94 |
--- 294,303 ---- |
| 95 |
{ |
| 96 |
FILE *nl; |
| 97 |
|
| 98 |
! /* LL */ |
| 99 |
! nl = jac0dim_ASL(asl, stub, stub_len); |
| 100 |
! |
| 101 |
! if (nl && stub_len < 0) { |
| 102 |
*M = n_con; |
| 103 |
*N = n_var; |
| 104 |
*NO = n_obj; |
| 105 |
diff -c --exclude=.depend --exclude='*.html*' -r -w solvers/misc.c /home/ladanyi/Ipopt.orig/Extern/ASL/solvers/misc.c |
| 106 |
*** solvers/misc.c 2005-05-09 00:34:50.000000000 -0400 |
| 107 |
--- /home/ladanyi/Ipopt.orig/Extern/ASL/solvers/misc.c 2006-03-02 19:38:28.000000000 -0500 |
| 108 |
*************** |
| 109 |
*** 44,49 **** |
| 110 |
--- 44,86 ---- |
| 111 |
static char anyedag[] = "fg_read (or one of its variants)"; |
| 112 |
static char psedag[] = "pfg_read, pfgh_read, or jacpdim"; |
| 113 |
|
| 114 |
+ |
| 115 |
+ int |
| 116 |
+ #ifdef KR_headers |
| 117 |
+ LL_getc(R) EdRead *R; |
| 118 |
+ #else |
| 119 |
+ LL_getc(EdRead *R) |
| 120 |
+ #endif |
| 121 |
+ { |
| 122 |
+ int c; |
| 123 |
+ if (R->nl) { |
| 124 |
+ c = getc(R->nl); |
| 125 |
+ } else { |
| 126 |
+ if (R->snl_pos == R->snl_len) { |
| 127 |
+ c = EOF; |
| 128 |
+ } else { |
| 129 |
+ c = R->snl[R->snl_pos++]; |
| 130 |
+ } |
| 131 |
+ } |
| 132 |
+ return c; |
| 133 |
+ } |
| 134 |
+ |
| 135 |
+ void |
| 136 |
+ #ifdef KR_headers |
| 137 |
+ LL_ungetc(c, R) int c; EdRead *R; |
| 138 |
+ #else |
| 139 |
+ LL_ungetc(int c, EdRead *R) |
| 140 |
+ #endif |
| 141 |
+ { |
| 142 |
+ if (R->nl) { |
| 143 |
+ ungetc(c, R->nl); |
| 144 |
+ } else { |
| 145 |
+ if (c != EOF) { |
| 146 |
+ R->snl_pos--; |
| 147 |
+ } |
| 148 |
+ } |
| 149 |
+ } |
| 150 |
+ |
| 151 |
void |
| 152 |
#ifdef KR_headers |
| 153 |
exit_ASL(R, n) EdRead *R; int n; |
| 154 |
*************** |
| 155 |
*** 359,380 **** |
| 156 |
int c; |
| 157 |
R->Line++; |
| 158 |
R->lineinc = 0; |
| 159 |
! R->rl_buf[0] = c = getc(R->nl); |
| 160 |
return c; |
| 161 |
} |
| 162 |
|
| 163 |
static void |
| 164 |
#ifdef KR_headers |
| 165 |
! eatcr(nl) FILE *nl; |
| 166 |
#else |
| 167 |
! eatcr(FILE *nl) |
| 168 |
#endif |
| 169 |
{ |
| 170 |
int c; |
| 171 |
|
| 172 |
! while((c = getc(nl)) == '\r'); |
| 173 |
if (c >= 0 && c != '\n') |
| 174 |
! ungetc(c, nl); |
| 175 |
} |
| 176 |
|
| 177 |
char * |
| 178 |
--- 396,417 ---- |
| 179 |
int c; |
| 180 |
R->Line++; |
| 181 |
R->lineinc = 0; |
| 182 |
! R->rl_buf[0] = c = LL_getc(R); |
| 183 |
return c; |
| 184 |
} |
| 185 |
|
| 186 |
static void |
| 187 |
#ifdef KR_headers |
| 188 |
! eatcr(R) EdRead *R; |
| 189 |
#else |
| 190 |
! eatcr(EdRead *R) |
| 191 |
#endif |
| 192 |
{ |
| 193 |
int c; |
| 194 |
|
| 195 |
! while((c = LL_getc(R)) == '\r'); |
| 196 |
if (c >= 0 && c != '\n') |
| 197 |
! LL_ungetc(c, R); |
| 198 |
} |
| 199 |
|
| 200 |
char * |
| 201 |
*************** |
| 202 |
*** 399,405 **** |
| 203 |
} |
| 204 |
rv = s; |
| 205 |
for(;;) { |
| 206 |
! x = getc(nl); |
| 207 |
if (x < ' ') { |
| 208 |
if (x < 0) { |
| 209 |
eof: |
| 210 |
--- 436,442 ---- |
| 211 |
} |
| 212 |
rv = s; |
| 213 |
for(;;) { |
| 214 |
! x = LL_getc(R); |
| 215 |
if (x < ' ') { |
| 216 |
if (x < 0) { |
| 217 |
eof: |
| 218 |
*************** |
| 219 |
*** 413,428 **** |
| 220 |
if (x == '\n') |
| 221 |
break; |
| 222 |
if (x == '\r') { |
| 223 |
! eatcr(nl); |
| 224 |
break; |
| 225 |
} |
| 226 |
} |
| 227 |
*s++ = x; |
| 228 |
if (s >= se) { |
| 229 |
for(;;) { |
| 230 |
! x = getc(nl); |
| 231 |
if (x == '\r') { |
| 232 |
! eatcr(nl); |
| 233 |
goto eol; |
| 234 |
} |
| 235 |
if (x == '\n') |
| 236 |
--- 450,465 ---- |
| 237 |
if (x == '\n') |
| 238 |
break; |
| 239 |
if (x == '\r') { |
| 240 |
! eatcr(R); |
| 241 |
break; |
| 242 |
} |
| 243 |
} |
| 244 |
*s++ = x; |
| 245 |
if (s >= se) { |
| 246 |
for(;;) { |
| 247 |
! x = LL_getc(R); |
| 248 |
if (x == '\r') { |
| 249 |
! eatcr(R); |
| 250 |
goto eol; |
| 251 |
} |
| 252 |
if (x == '\n') |
| 253 |
*************** |
| 254 |
*** 848,853 **** |
| 255 |
--- 885,893 ---- |
| 256 |
R->can_end = 0; |
| 257 |
R->dadjfcn = asl->i.dadjfcn; |
| 258 |
R->iadjfcn = asl->i.iadjfcn; |
| 259 |
+ R->snl = NULL; |
| 260 |
+ R->snl_pos = 0; |
| 261 |
+ R->snl_len = 0; |
| 262 |
return R; |
| 263 |
} |
| 264 |
|
| 265 |
diff -c --exclude=.depend --exclude='*.html*' -r -w solvers/pfg_read.c /home/ladanyi/Ipopt.orig/Extern/ASL/solvers/pfg_read.c |
| 266 |
*** solvers/pfg_read.c 2005-06-25 12:57:51.000000000 -0400 |
| 267 |
--- /home/ladanyi/Ipopt.orig/Extern/ASL/solvers/pfg_read.c 2006-03-03 14:56:07.000000000 -0500 |
| 268 |
*************** |
| 269 |
*** 4651,4657 **** |
| 270 |
#endif |
| 271 |
{ |
| 272 |
ASLTYPE *asl; |
| 273 |
! EdRead ER, *R; |
| 274 |
Jmp_buf JB; |
| 275 |
Static SS, *S; |
| 276 |
cgrad *cg, **cgp; |
| 277 |
--- 4651,4657 ---- |
| 278 |
#endif |
| 279 |
{ |
| 280 |
ASLTYPE *asl; |
| 281 |
! EdRead ER, *R, Rbackup; |
| 282 |
Jmp_buf JB; |
| 283 |
Static SS, *S; |
| 284 |
cgrad *cg, **cgp; |
| 285 |
*************** |
| 286 |
*** 4667,4674 **** |
| 287 |
--- 4667,4679 ---- |
| 288 |
ASL_CHECK(a, asltype, who); |
| 289 |
asl = (ASLTYPE*)a; |
| 290 |
S = S_init(&SS, asl); |
| 291 |
+ Rbackup = a->Rbackup; |
| 292 |
ed_reset(asl); |
| 293 |
SS.R = R = EdReadInit_ASL(&ER, a, nl, S); |
| 294 |
+ /* LL */ |
| 295 |
+ R->snl = Rbackup.snl; |
| 296 |
+ R->snl_pos = Rbackup.snl_pos; |
| 297 |
+ R->snl_len = Rbackup.snl_len; |
| 298 |
if (flags & ASL_return_read_err) { |
| 299 |
a->i.err_jmp_ = &JB; |
| 300 |
i = setjmp(JB.jb); |
| 301 |
*************** |
| 302 |
*** 4796,4802 **** |
| 303 |
ER.can_end = 1; |
| 304 |
i = edag_peek(R); |
| 305 |
if (i == EOF) { |
| 306 |
! fclose(nl); |
| 307 |
do_ewalk(S); |
| 308 |
if (imap) |
| 309 |
del_mblk(kimap, imap); |
| 310 |
--- 4801,4808 ---- |
| 311 |
ER.can_end = 1; |
| 312 |
i = edag_peek(R); |
| 313 |
if (i == EOF) { |
| 314 |
! /* LL */ |
| 315 |
! if (nl) fclose(nl); |
| 316 |
do_ewalk(S); |
| 317 |
if (imap) |
| 318 |
del_mblk(kimap, imap); |