comparison src/number.c @ 2500:3d8143fc88e1

[xemacs-hg @ 2005-01-24 23:33:30 by ben] get working with VC7 config.inc.samp: Declare OPTIONAL_LIBRARY_DIR as root of library directories. Redo all graphics library defaults to mirror the versions and directories in the current binary aux distribution on xemacs web site. Enable TIFF and COMPFACE by default since you can now compile with them and binary libs are provided. xemacs.mak: Put our own directories first in case of conflict (e.g. config.h in compface). xemacs.mak: Use MSVCRT to avoid link problems. s/windowsnt.h: bytecode.c, print.c: Add casts to avoid warning. compiler.h: Add MSC_VERSION and include definitions of DOESNT_RETURN and friends here, like for GCC. Need different definitions for VC7 and VC6. s/windowsnt.h: Remove stuff moved to compiler.h. Disable warning 4646 ("function declared with __declspec(noreturn) has non-void return type") on VC7 since lots of Lisp primitives trigger this and there is no easy way to kludge around the warning. glyphs-eimage.c: Some really nasty hacks to allow TIFF and JPEG to both be compiled. #### The better solution is to move the TIFF and JPEG code to different files. glyphs-msw.c: Define __STDC__ to avoid problems with compface.h. intl-auto-encap-win32.c, intl-auto-encap-win32.h, intl-encap-win32.c, syswindows.h: Those wankers at Microsoft cannot leave well enough alone. Various functions change parameter types semi-randomly between VC6 and VC7, so we need to include our own versions that can handle both kinds with appropriate casting. EmacsFrame.c, EmacsShell-sub.c, EmacsShell.c, alloc.c, alloca.c, buffer.c, bytecode.c, charset.h, chartab.c, cm.c, console-stream.c, console.c, data.c, debug.h, device-msw.c, device-tty.c, device-x.c, doprnt.c, dumper.c, dynarr.c, elhash.c, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, fns.c, font-lock.c, frame-gtk.c, frame-x.c, frame.c, free-hook.c, gccache-gtk.c, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-x.c, glyphs.c, gtk-glue.c, gutter.c, input-method-xlib.c, insdel.c, intl-win32.c, keymap.c, lisp.h, lread.c, lstream.c, macros.c, malloc.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, mule-coding.c, native-gtk-toolbar.c, number.c, objects-msw.c, objects.c, print.c, process-nt.c, process-unix.c, process.c, ralloc.c, rangetab.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, regex.c, scrollbar-gtk.c, scrollbar-x.c, search.c, select-x.c, signal.c, specifier.c, specifier.h, strftime.c, sunplay.c, symbols.c, sysdep.c, sysproc.h, text.c, text.h, toolbar-common.c, toolbar-msw.c, toolbar.c, ui-gtk.c, unexnt.c, unicode.c, win32.c, window.c, xgccache.c, s/windowsnt.h: abort() -> ABORT(). Eliminate preprocessor games with abort() since it creates huge problems in VC7, solvable only by including massive amounts of files in every compile (and not worth it).
author ben
date Mon, 24 Jan 2005 23:34:34 +0000
parents 04bc9d2f42c7
children 9f70af3ac939
comparison
equal deleted inserted replaced
2499:4c5ee4d2e921 2500:3d8143fc88e1
399 #ifdef HAVE_BIGFLOAT 399 #ifdef HAVE_BIGFLOAT
400 if (BIGFLOATP (arg)) 400 if (BIGFLOATP (arg))
401 return BIGFLOAT_T; 401 return BIGFLOAT_T;
402 #endif 402 #endif
403 /* Catch unintentional bad uses of this function */ 403 /* Catch unintentional bad uses of this function */
404 abort (); 404 ABORT ();
405 /* NOTREACHED */ 405 /* NOTREACHED */
406 return FIXNUM_T; 406 return FIXNUM_T;
407 } 407 }
408 408
409 /* Convert NUMBER to type TYPE. If TYPE is BIGFLOAT_T then use the indicated 409 /* Convert NUMBER to type TYPE. If TYPE is BIGFLOAT_T then use the indicated
423 number = make_int (XCHAR (number)); 423 number = make_int (XCHAR (number));
424 else if (MARKERP (number)) 424 else if (MARKERP (number))
425 number = make_int (marker_position (number)); 425 number = make_int (marker_position (number));
426 426
427 /* Note that CHECK_NUMBER ensures that NUMBER is a supported type. Hence, 427 /* Note that CHECK_NUMBER ensures that NUMBER is a supported type. Hence,
428 we abort() in the #else sections below, because it shouldn't be possible 428 we ABORT() in the #else sections below, because it shouldn't be possible
429 to arrive there. */ 429 to arrive there. */
430 CHECK_NUMBER (number); 430 CHECK_NUMBER (number);
431 current_type = get_number_type (number); 431 current_type = get_number_type (number);
432 switch (current_type) 432 switch (current_type)
433 { 433 {
438 return number; 438 return number;
439 case BIGNUM_T: 439 case BIGNUM_T:
440 #ifdef HAVE_BIGNUM 440 #ifdef HAVE_BIGNUM
441 return make_bignum (XREALINT (number)); 441 return make_bignum (XREALINT (number));
442 #else 442 #else
443 abort (); 443 ABORT ();
444 #endif /* HAVE_BIGNUM */ 444 #endif /* HAVE_BIGNUM */
445 case RATIO_T: 445 case RATIO_T:
446 #ifdef HAVE_RATIO 446 #ifdef HAVE_RATIO
447 return make_ratio (XREALINT (number), 1UL); 447 return make_ratio (XREALINT (number), 1UL);
448 #else 448 #else
449 abort (); 449 ABORT ();
450 #endif /* HAVE_RATIO */ 450 #endif /* HAVE_RATIO */
451 case FLOAT_T: 451 case FLOAT_T:
452 return make_float (XREALINT (number)); 452 return make_float (XREALINT (number));
453 case BIGFLOAT_T: 453 case BIGFLOAT_T:
454 #ifdef HAVE_BIGFLOAT 454 #ifdef HAVE_BIGFLOAT
455 return make_bigfloat (XREALINT (number), precision); 455 return make_bigfloat (XREALINT (number), precision);
456 #else 456 #else
457 abort (); 457 ABORT ();
458 #endif /* HAVE_BIGFLOAT */ 458 #endif /* HAVE_BIGFLOAT */
459 } 459 }
460 case BIGNUM_T: 460 case BIGNUM_T:
461 #ifdef HAVE_BIGNUM 461 #ifdef HAVE_BIGNUM
462 switch (type) 462 switch (type)
468 case RATIO_T: 468 case RATIO_T:
469 #ifdef HAVE_RATIO 469 #ifdef HAVE_RATIO
470 bignum_set_long (scratch_bignum, 1L); 470 bignum_set_long (scratch_bignum, 1L);
471 return make_ratio_bg (XBIGNUM_DATA (number), scratch_bignum); 471 return make_ratio_bg (XBIGNUM_DATA (number), scratch_bignum);
472 #else 472 #else
473 abort (); 473 ABORT ();
474 #endif /* HAVE_RATIO */ 474 #endif /* HAVE_RATIO */
475 case FLOAT_T: 475 case FLOAT_T:
476 return make_float (bignum_to_double (XBIGNUM_DATA (number))); 476 return make_float (bignum_to_double (XBIGNUM_DATA (number)));
477 case BIGFLOAT_T: 477 case BIGFLOAT_T:
478 #ifdef HAVE_BIGFLOAT 478 #ifdef HAVE_BIGFLOAT
481 temp = make_bigfloat (0.0, precision); 481 temp = make_bigfloat (0.0, precision);
482 bigfloat_set_bignum (XBIGFLOAT_DATA (temp), XBIGNUM_DATA (number)); 482 bigfloat_set_bignum (XBIGFLOAT_DATA (temp), XBIGNUM_DATA (number));
483 return temp; 483 return temp;
484 } 484 }
485 #else 485 #else
486 abort (); 486 ABORT ();
487 #endif /* HAVE_BIGFLOAT */ 487 #endif /* HAVE_BIGFLOAT */
488 } 488 }
489 #else 489 #else
490 abort (); 490 ABORT ();
491 #endif /* HAVE_BIGNUM */ 491 #endif /* HAVE_BIGNUM */
492 case RATIO_T: 492 case RATIO_T:
493 #ifdef HAVE_RATIO 493 #ifdef HAVE_RATIO
494 switch (type) 494 switch (type)
495 { 495 {
512 temp = make_bigfloat (0.0, precision); 512 temp = make_bigfloat (0.0, precision);
513 bigfloat_set_ratio (XBIGFLOAT_DATA (temp), XRATIO_DATA (number)); 513 bigfloat_set_ratio (XBIGFLOAT_DATA (temp), XRATIO_DATA (number));
514 return temp; 514 return temp;
515 } 515 }
516 #else 516 #else
517 abort (); 517 ABORT ();
518 #endif /* HAVE_BIGFLOAT */ 518 #endif /* HAVE_BIGFLOAT */
519 } 519 }
520 #else 520 #else
521 abort (); 521 ABORT ();
522 #endif /* HAVE_RATIO */ 522 #endif /* HAVE_RATIO */
523 case FLOAT_T: 523 case FLOAT_T:
524 switch (type) 524 switch (type)
525 { 525 {
526 case FIXNUM_T: 526 case FIXNUM_T:
528 case BIGNUM_T: 528 case BIGNUM_T:
529 #ifdef HAVE_BIGNUM 529 #ifdef HAVE_BIGNUM
530 bignum_set_double (scratch_bignum, XFLOAT_DATA (number)); 530 bignum_set_double (scratch_bignum, XFLOAT_DATA (number));
531 return make_bignum_bg (scratch_bignum); 531 return make_bignum_bg (scratch_bignum);
532 #else 532 #else
533 abort (); 533 ABORT ();
534 #endif /* HAVE_BIGNUM */ 534 #endif /* HAVE_BIGNUM */
535 case RATIO_T: 535 case RATIO_T:
536 #ifdef HAVE_RATIO 536 #ifdef HAVE_RATIO
537 ratio_set_double (scratch_ratio, XFLOAT_DATA (number)); 537 ratio_set_double (scratch_ratio, XFLOAT_DATA (number));
538 return make_ratio_rt (scratch_ratio); 538 return make_ratio_rt (scratch_ratio);
539 #else 539 #else
540 abort (); 540 ABORT ();
541 #endif /* HAVE_RATIO */ 541 #endif /* HAVE_RATIO */
542 case FLOAT_T: 542 case FLOAT_T:
543 return number; 543 return number;
544 case BIGFLOAT_T: 544 case BIGFLOAT_T:
545 #ifdef HAVE_BIGFLOAT 545 #ifdef HAVE_BIGFLOAT
546 bigfloat_set_prec (scratch_bigfloat, precision); 546 bigfloat_set_prec (scratch_bigfloat, precision);
547 bigfloat_set_double (scratch_bigfloat, XFLOAT_DATA (number)); 547 bigfloat_set_double (scratch_bigfloat, XFLOAT_DATA (number));
548 return make_bigfloat_bf (scratch_bigfloat); 548 return make_bigfloat_bf (scratch_bigfloat);
549 #else 549 #else
550 abort (); 550 ABORT ();
551 #endif /* HAVE_BIGFLOAT */ 551 #endif /* HAVE_BIGFLOAT */
552 } 552 }
553 case BIGFLOAT_T: 553 case BIGFLOAT_T:
554 #ifdef HAVE_BIGFLOAT 554 #ifdef HAVE_BIGFLOAT
555 switch (type) 555 switch (type)
559 case BIGNUM_T: 559 case BIGNUM_T:
560 #ifdef HAVE_BIGNUM 560 #ifdef HAVE_BIGNUM
561 bignum_set_bigfloat (scratch_bignum, XBIGFLOAT_DATA (number)); 561 bignum_set_bigfloat (scratch_bignum, XBIGFLOAT_DATA (number));
562 return make_bignum_bg (scratch_bignum); 562 return make_bignum_bg (scratch_bignum);
563 #else 563 #else
564 abort (); 564 ABORT ();
565 #endif /* HAVE_BIGNUM */ 565 #endif /* HAVE_BIGNUM */
566 case RATIO_T: 566 case RATIO_T:
567 #ifdef HAVE_RATIO 567 #ifdef HAVE_RATIO
568 ratio_set_bigfloat (scratch_ratio, XBIGFLOAT_DATA (number)); 568 ratio_set_bigfloat (scratch_ratio, XBIGFLOAT_DATA (number));
569 return make_ratio_rt (scratch_ratio); 569 return make_ratio_rt (scratch_ratio);
570 #else 570 #else
571 abort (); 571 ABORT ();
572 #endif 572 #endif
573 case FLOAT_T: 573 case FLOAT_T:
574 return make_float (bigfloat_to_double (XBIGFLOAT_DATA (number))); 574 return make_float (bigfloat_to_double (XBIGFLOAT_DATA (number)));
575 case BIGFLOAT_T: 575 case BIGFLOAT_T:
576 /* FIXME: Do we need to change the precision? */ 576 /* FIXME: Do we need to change the precision? */
577 return number; 577 return number;
578 } 578 }
579 #else 579 #else
580 abort (); 580 ABORT ();
581 #endif /* HAVE_BIGFLOAT */ 581 #endif /* HAVE_BIGFLOAT */
582 } 582 }
583 abort (); 583 ABORT ();
584 /* NOTREACHED */ 584 /* NOTREACHED */
585 return Qzero; 585 return Qzero;
586 } 586 }
587 587
588 /* This function promotes its arguments as necessary to make them both the 588 /* This function promotes its arguments as necessary to make them both the