comparison src/user-prefs.cc @ 195:13c6086c325c

[project @ 1993-11-06 10:12:29 by jwe]
author jwe
date Sat, 06 Nov 1993 10:14:11 +0000
parents 7a647cf4850c
children a99f28f5e351
comparison
equal deleted inserted replaced
194:4f3364dcf450 195:13c6086c325c
46 * return of 1 => never ok. 46 * return of 1 => never ok.
47 */ 47 */
48 static int 48 static int
49 check_str_pref (char *var) 49 check_str_pref (char *var)
50 { 50 {
51 char *val = octave_string_variable (var); 51 char *val = builtin_string_variable (var);
52 int pref = -1; 52 int pref = -1;
53 if (val != (char *) NULL) 53 if (val != (char *) NULL)
54 { 54 {
55 if (strncmp (val, "yes", 3) == 0 55 if (strncmp (val, "yes", 3) == 0
56 || strncmp (val, "true", 4) == 0) 56 || strncmp (val, "true", 4) == 0)
235 235
236 return 0; 236 return 0;
237 } 237 }
238 238
239 /* 239 /*
240 * Should Octave always check to see if M-files have changed since
241 * they were last compiled?
242 */
243 int
244 ignore_function_time_stamp (void)
245 {
246 int pref = 0;
247
248 char *val = builtin_string_variable ("ignore_function_time_stamp");
249
250 if (val != (char *) NULL)
251 {
252 if (strncmp (val, "all", 3) == 0)
253 pref = 2;
254 if (strncmp (val, "system", 6) == 0)
255 pref = 1;
256 }
257
258 user_pref.ignore_function_time_stamp = pref;
259
260 return 0;
261 }
262
263 /*
240 * Should should big matrices be split into smaller slices for output? 264 * Should should big matrices be split into smaller slices for output?
241 */ 265 */
242 int 266 int
243 split_long_rows (void) 267 split_long_rows (void)
244 { 268 {
299 */ 323 */
300 int 324 int
301 warn_assign_as_truth_value (void) 325 warn_assign_as_truth_value (void)
302 { 326 {
303 user_pref.warn_assign_as_truth_value = 327 user_pref.warn_assign_as_truth_value =
304 check_str_pref ("user_pref.warn_assign_as_truth_value"); 328 check_str_pref ("warn_assign_as_truth_value");
305 329
306 return 0; 330 return 0;
307 } 331 }
308 332
309 /* 333 /*
324 int status = 0; 348 int status = 0;
325 349
326 static int kludge = 0; 350 static int kludge = 0;
327 351
328 double val; 352 double val;
329 if (octave_real_scalar_variable ("output_max_field_width", val) == 0) 353 if (builtin_real_scalar_variable ("output_max_field_width", val) == 0)
330 { 354 {
331 int ival = NINT (val); 355 int ival = NINT (val);
332 if (ival > 0 && (double) ival == val) 356 if (ival > 0 && (double) ival == val)
333 { 357 {
334 user_pref.output_max_field_width= ival; 358 user_pref.output_max_field_width= ival;
353 int status = 0; 377 int status = 0;
354 378
355 static int kludge = 0; 379 static int kludge = 0;
356 380
357 double val; 381 double val;
358 if (octave_real_scalar_variable ("output_precision", val) == 0) 382 if (builtin_real_scalar_variable ("output_precision", val) == 0)
359 { 383 {
360 int ival = NINT (val); 384 int ival = NINT (val);
361 if (ival >= 0 && (double) ival == val) 385 if (ival >= 0 && (double) ival == val)
362 { 386 {
363 user_pref.output_precision = ival; 387 user_pref.output_precision = ival;
379 int 403 int
380 sv_loadpath (void) 404 sv_loadpath (void)
381 { 405 {
382 int status = 0; 406 int status = 0;
383 407
384 char *s = octave_string_variable ("LOADPATH"); 408 char *s = builtin_string_variable ("LOADPATH");
385 if (s != (char *) NULL) 409 if (s != (char *) NULL)
386 { 410 {
387 delete [] user_pref.loadpath; 411 delete [] user_pref.loadpath;
388 user_pref.loadpath = s; 412 user_pref.loadpath = s;
389 } 413 }
399 int 423 int
400 sv_info_file (void) 424 sv_info_file (void)
401 { 425 {
402 int status = 0; 426 int status = 0;
403 427
404 char *s = octave_string_variable ("INFO_FILE"); 428 char *s = builtin_string_variable ("INFO_FILE");
405 if (s != (char *) NULL) 429 if (s != (char *) NULL)
406 { 430 {
407 delete [] user_pref.info_file; 431 delete [] user_pref.info_file;
408 user_pref.info_file = s; 432 user_pref.info_file = s;
409 } 433 }
415 439
416 return status; 440 return status;
417 } 441 }
418 442
419 int 443 int
444 sv_editor (void)
445 {
446 int status = 0;
447
448 char *s = builtin_string_variable ("EDITOR");
449 if (s != (char *) NULL)
450 {
451 delete [] user_pref.editor;
452 user_pref.editor = s;
453 }
454 else
455 {
456 warning ("invalid value specified for EDITOR");
457 status = -1;
458 }
459
460 return status;
461 }
462
463 int
420 sv_ps1 (void) 464 sv_ps1 (void)
421 { 465 {
422 int status = 0; 466 int status = 0;
423 467
424 char *s = octave_string_variable ("PS1"); 468 char *s = builtin_string_variable ("PS1");
425 if (s != (char *) NULL) 469 if (s != (char *) NULL)
426 { 470 {
427 delete [] user_pref.ps1; 471 delete [] user_pref.ps1;
428 user_pref.ps1 = s; 472 user_pref.ps1 = s;
429 } 473 }
439 int 483 int
440 sv_ps2 (void) 484 sv_ps2 (void)
441 { 485 {
442 int status = 0; 486 int status = 0;
443 487
444 char *s = octave_string_variable ("PS2"); 488 char *s = builtin_string_variable ("PS2");
445 if (s != (char *) NULL) 489 if (s != (char *) NULL)
446 { 490 {
447 delete [] user_pref.ps2; 491 delete [] user_pref.ps2;
448 user_pref.ps2 = s; 492 user_pref.ps2 = s;
449 } 493 }
459 int 503 int
460 sv_pwd (void) 504 sv_pwd (void)
461 { 505 {
462 int status = 0; 506 int status = 0;
463 507
464 char *s = octave_string_variable ("PWD"); 508 char *s = builtin_string_variable ("PWD");
465 if (s != (char *) NULL) 509 if (s != (char *) NULL)
466 { 510 {
467 delete [] user_pref.pwd; 511 delete [] user_pref.pwd;
468 user_pref.pwd = s; 512 user_pref.pwd = s;
469 } 513 }
479 int 523 int
480 sv_gnuplot_binary (void) 524 sv_gnuplot_binary (void)
481 { 525 {
482 int status = 0; 526 int status = 0;
483 527
484 char *s = octave_string_variable ("gnuplot_binary"); 528 char *s = builtin_string_variable ("gnuplot_binary");
485 if (s != (char *) NULL) 529 if (s != (char *) NULL)
486 { 530 {
487 delete [] user_pref.gnuplot_binary; 531 delete [] user_pref.gnuplot_binary;
488 user_pref.gnuplot_binary = s; 532 user_pref.gnuplot_binary = s;
489 } 533 }
499 int 543 int
500 sv_pager_binary (void) 544 sv_pager_binary (void)
501 { 545 {
502 int status = 0; 546 int status = 0;
503 547
504 char *s = octave_string_variable ("PAGER"); 548 char *s = builtin_string_variable ("PAGER");
505 if (s != (char *) NULL) 549 if (s != (char *) NULL)
506 { 550 {
507 delete [] user_pref.pager_binary; 551 delete [] user_pref.pager_binary;
508 user_pref.pager_binary = s; 552 user_pref.pager_binary = s;
509 } 553 }