Changeset 12561
- Timestamp:
- 03/18/10 11:59:59 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/Java.java
r12513 r12561 61 61 62 62 // ### register-java-exception exception-name condition-symbol => T 63 private static final Primitive REGISTER_JAVA_EXCEPTION = 64 new Primitive("register-java-exception", PACKAGE_JAVA, true, 65 "exception-name condition-symbol") 66 { 63 private static final Primitive REGISTER_JAVA_EXCEPTION = new pf_register_java_exception(); 64 private static final class pf_register_java_exception extends Primitive 65 { 66 pf_register_java_exception() 67 { 68 super("register-java-exception", PACKAGE_JAVA, true, 69 "exception-name condition-symbol"); 70 } 71 67 72 @Override 68 73 public LispObject execute(LispObject className, LispObject symbol) … … 81 86 82 87 // ### unregister-java-exception exception-name => T or NIL 83 private static final Primitive UNREGISTER_JAVA_EXCEPTION = 84 new Primitive("unregister-java-exception", PACKAGE_JAVA, true, 85 "exception-name") 86 { 88 private static final Primitive UNREGISTER_JAVA_EXCEPTION = new pf_unregister_java_exception(); 89 private static final class pf_unregister_java_exception extends Primitive 90 { 91 pf_unregister_java_exception() 92 { 93 super("unregister-java-exception", PACKAGE_JAVA, true, 94 "exception-name"); 95 } 96 87 97 @Override 88 98 public LispObject execute(LispObject className) … … 107 117 108 118 // ### jclass name-or-class-ref => class-ref 109 private static final Primitive JCLASS = 110 new Primitive(Symbol.JCLASS, "name-or-class-ref", 111 "Returns a reference to the Java class designated by NAME-OR-CLASS-REF.") 112 { 119 private static final Primitive JCLASS = new pf_jclass(); 120 private static final class pf_jclass extends Primitive 121 { 122 pf_jclass() 123 { 124 super(Symbol.JCLASS, "name-or-class-ref", 125 "Returns a reference to the Java class designated by NAME-OR-CLASS-REF."); 126 } 127 113 128 @Override 114 129 public LispObject execute(LispObject arg) … … 222 237 } 223 238 224 private static final Primitive JFIELD = 225 new Primitive("jfield", PACKAGE_JAVA, true, 226 "class-ref-or-field field-or-instance &optional instance value") 227 { 239 // ### jfield class-ref-or-field field-or-instance &optional instance value 240 private static final Primitive JFIELD = new pf_jfield(); 241 private static final class pf_jfield extends Primitive 242 { 243 pf_jfield() 244 { 245 super("jfield", PACKAGE_JAVA, true, 246 "class-ref-or-field field-or-instance &optional instance value"); 247 } 248 228 249 @Override 229 250 public LispObject execute(LispObject[] args) … … 234 255 235 256 // ### jfield-raw - retrieve or modify a field in a Java class or instance. 236 private static final Primitive JFIELD_RAW = 237 new Primitive("jfield-raw", PACKAGE_JAVA, true, 238 "class-ref-or-field field-or-instance &optional instance value") 239 { 257 private static final Primitive JFIELD_RAW = new pf_jfield_raw(); 258 private static final class pf_jfield_raw extends Primitive 259 { 260 pf_jfield_raw() 261 { 262 super("jfield-raw", PACKAGE_JAVA, true, 263 "class-ref-or-field field-or-instance &optional instance value"); 264 } 265 240 266 @Override 241 267 public LispObject execute(LispObject[] args) … … 246 272 247 273 // ### jconstructor class-ref &rest parameter-class-refs 248 private static final Primitive JCONSTRUCTOR = 249 new Primitive("jconstructor", PACKAGE_JAVA, true, 250 "class-ref &rest parameter-class-refs") 251 { 274 private static final Primitive JCONSTRUCTOR = new pf_jconstructor(); 275 private static final class pf_jconstructor extends Primitive 276 { 277 pf_jconstructor() 278 { 279 super("jconstructor", PACKAGE_JAVA, true, 280 "class-ref &rest parameter-class-refs"); 281 } 282 252 283 @Override 253 284 public LispObject execute(LispObject[] args) … … 291 322 292 323 // ### jmethod class-ref name &rest parameter-class-refs 293 private static final Primitive JMETHOD = 294 new Primitive("jmethod", PACKAGE_JAVA, true, 295 "class-ref name &rest parameter-class-refs") 296 { 324 private static final Primitive JMETHOD = new pf_jmethod(); 325 private static final class pf_jmethod extends Primitive 326 { 327 pf_jmethod() 328 { 329 super("jmethod", PACKAGE_JAVA, true, 330 "class-ref name &rest parameter-class-refs"); 331 } 332 297 333 @Override 298 334 public LispObject execute(LispObject[] args) … … 414 450 415 451 // ### jstatic method class &rest args 416 private static final Primitive JSTATIC = 417 new Primitive("jstatic", PACKAGE_JAVA, true, "method class &rest args") 418 { 452 private static final Primitive JSTATIC = new pf_jstatic(); 453 private static final class pf_jstatic extends Primitive 454 { 455 pf_jstatic() 456 { 457 super("jstatic", PACKAGE_JAVA, true, "method class &rest args"); 458 } 459 419 460 @Override 420 461 public LispObject execute(LispObject[] args) … … 425 466 426 467 // ### jstatic-raw method class &rest args 427 private static final Primitive JSTATIC_RAW = 428 new Primitive("jstatic-raw", PACKAGE_JAVA, true, 429 "method class &rest args") 430 { 468 private static final Primitive JSTATIC_RAW = new pf_jstatic_raw(); 469 private static final class pf_jstatic_raw extends Primitive 470 { 471 pf_jstatic_raw() 472 { 473 super("jstatic-raw", PACKAGE_JAVA, true, 474 "method class &rest args"); 475 } 476 431 477 @Override 432 478 public LispObject execute(LispObject[] args) … … 437 483 438 484 // ### jnew constructor &rest args 439 private static final Primitive JNEW = 440 new Primitive("jnew", PACKAGE_JAVA, true, "constructor &rest args") 441 { 485 private static final Primitive JNEW = new pf_jnew(); 486 private static final class pf_jnew extends Primitive 487 { 488 pf_jnew() 489 { 490 super("jnew", PACKAGE_JAVA, true, "constructor &rest args"); 491 } 492 442 493 @Override 443 494 public LispObject execute(LispObject[] args) … … 488 539 489 540 // ### jnew-array element-type &rest dimensions 490 private static final Primitive JNEW_ARRAY = 491 new Primitive("jnew-array", PACKAGE_JAVA, true, 492 "element-type &rest dimensions") 493 { 541 private static final Primitive JNEW_ARRAY = new pf_jnew_array(); 542 private static final class pf_jnew_array extends Primitive 543 { 544 pf_jnew_array() 545 { 546 super("jnew-array", PACKAGE_JAVA, true, 547 "element-type &rest dimensions"); 548 } 549 494 550 @Override 495 551 public LispObject execute(LispObject[] args) … … 541 597 542 598 // ### jarray-ref java-array &rest indices 543 private static final Primitive JARRAY_REF = 544 new Primitive("jarray-ref", PACKAGE_JAVA, true, 545 "java-array &rest indices") 546 { 599 private static final Primitive JARRAY_REF = new pf_jarray_ref(); 600 private static final class pf_jarray_ref extends Primitive 601 { 602 pf_jarray_ref() 603 { 604 super("jarray-ref", PACKAGE_JAVA, true, 605 "java-array &rest indices"); 606 } 607 547 608 @Override 548 609 public LispObject execute(LispObject[] args) … … 553 614 554 615 // ### jarray-ref-raw java-array &rest indices 555 private static final Primitive JARRAY_REF_RAW = 556 new Primitive("jarray-ref-raw", PACKAGE_JAVA, true, 557 "java-array &rest indices") 558 { 616 private static final Primitive JARRAY_REF_RAW = new pf_jarray_ref_raw(); 617 private static final class pf_jarray_ref_raw extends Primitive 618 { 619 pf_jarray_ref_raw() 620 { 621 super("jarray-ref-raw", PACKAGE_JAVA, true, 622 "java-array &rest indices"); 623 } 624 559 625 @Override 560 626 public LispObject execute(LispObject[] args) … … 565 631 566 632 // ### jarray-set java-array new-value &rest indices 567 private static final Primitive JARRAY_SET = 568 new Primitive("jarray-set", PACKAGE_JAVA, true, 569 "java-array new-value &rest indices") 570 { 633 private static final Primitive JARRAY_SET = new pf_jarray_set(); 634 private static final class pf_jarray_set extends Primitive 635 { 636 pf_jarray_set() 637 { 638 super("jarray-set", PACKAGE_JAVA, true, 639 "java-array new-value &rest indices"); 640 } 641 571 642 @Override 572 643 public LispObject execute(LispObject[] args) … … 600 671 601 672 // ### jcall method instance &rest args 602 // Calls makeLispObject() to convert the result to an appropriate Lisp type. 603 private static final Primitive JCALL = 604 new Primitive(Symbol.JCALL, "method-ref instance &rest args") 605 { 673 /** Calls makeLispObject() to convert the result to an appropriate Lisp type. */ 674 private static final Primitive JCALL = new pf_jcall(); 675 private static final class pf_jcall extends Primitive 676 { 677 pf_jcall() 678 { 679 super(Symbol.JCALL, "method-ref instance &rest args"); 680 } 681 606 682 @Override 607 683 public LispObject execute(LispObject[] args) … … 612 688 613 689 // ### jcall-raw method instance &rest args 614 // Does no type conversion. The result of the call is simply wrapped in a 615 // JavaObject. 616 private static final Primitive JCALL_RAW = 617 new Primitive(Symbol.JCALL_RAW, "method-ref instance &rest args") 618 { 690 /** 691 * Does no type conversion. The result of the call is simply wrapped in a 692 * JavaObject. 693 */ 694 private static final Primitive JCALL_RAW = new pf_jcall_raw(); 695 private static final class pf_jcall_raw extends Primitive 696 { 697 pf_jcall_raw() 698 { 699 super(Symbol.JCALL_RAW, "method-ref instance &rest args"); 700 } 701 619 702 @Override 620 703 public LispObject execute(LispObject[] args) … … 873 956 874 957 // ### make-immediate-object object &optional type 875 private static final Primitive MAKE_IMMEDIATE_OBJECT = 876 new Primitive("make-immediate-object", PACKAGE_JAVA, true, 877 "object &optional type") 878 { 958 private static final Primitive MAKE_IMMEDIATE_OBJECT = new pf_make_immediate_object(); 959 private static final class pf_make_immediate_object extends Primitive 960 { 961 pf_make_immediate_object() 962 { 963 super("make-immediate-object", PACKAGE_JAVA, true, 964 "object &optional type"); 965 } 966 879 967 @Override 880 968 public LispObject execute(LispObject[] args) … … 904 992 905 993 // ### java-object-p 906 private static final Primitive JAVA_OBJECT_P = 907 new Primitive("java-object-p", PACKAGE_JAVA, true, "object") 908 { 994 private static final Primitive JAVA_OBJECT_P = new pf_java_object_p(); 995 private static final class pf_java_object_p extends Primitive 996 { 997 pf_java_object_p() 998 { 999 super("java-object-p", PACKAGE_JAVA, true, "object"); 1000 } 1001 909 1002 @Override 910 1003 public LispObject execute(LispObject arg) … … 915 1008 916 1009 // ### jobject-lisp-value java-object 917 private static final Primitive JOBJECT_LISP_VALUE = 918 new Primitive("jobject-lisp-value", PACKAGE_JAVA, true, "java-object") 919 { 1010 private static final Primitive JOBJECT_LISP_VALUE = new pf_jobject_lisp_value(); 1011 private static final class pf_jobject_lisp_value extends Primitive 1012 { 1013 pf_jobject_lisp_value() 1014 { 1015 super("jobject-lisp-value", PACKAGE_JAVA, true, "java-object"); 1016 } 1017 920 1018 @Override 921 1019 public LispObject execute(LispObject arg) … … 926 1024 927 1025 // ### jcoerce java-object intended-class 928 private static final Primitive JCOERCE = 929 new Primitive("jcoerce", PACKAGE_JAVA, true, "java-object intended-class") 930 { 1026 private static final Primitive JCOERCE = new pf_jcoerce(); 1027 private static final class pf_jcoerce extends Primitive 1028 { 1029 pf_jcoerce() 1030 { 1031 super("jcoerce", PACKAGE_JAVA, true, "java-object intended-class"); 1032 } 1033 931 1034 @Override 932 1035 public LispObject execute(LispObject javaObject, LispObject intendedClass) … … 941 1044 } 942 1045 }; 943 944 private static final Primitive JGET_PROPERTY_VALUE = 945 new Primitive("%jget-property-value", PACKAGE_JAVA, true, 946 "java-object property-name") { 1046 1047 // ### %jget-property-value java-object property-name 1048 private static final Primitive JGET_PROPERTY_VALUE = new pf__jget_property_value(); 1049 private static final class pf__jget_property_value extends Primitive 1050 { 1051 pf__jget_property_value() 1052 { 1053 super("%jget-property-value", PACKAGE_JAVA, true, 1054 "java-object property-name"); 1055 } 947 1056 948 1057 @Override … … 965 1074 }; 966 1075 967 private static final Primitive JSET_PROPERTY_VALUE = 968 new Primitive("%jset-property-value", PACKAGE_JAVA, true, 969 "java-object property-name value") { 1076 // ### %jset-property-value java-object property-name value 1077 private static final Primitive JSET_PROPERTY_VALUE = new pf__jset_property_value(); 1078 private static final class pf__jset_property_value extends Primitive 1079 { 1080 pf__jset_property_value() 1081 { 1082 super("%jset-property-value", PACKAGE_JAVA, true, 1083 "java-object property-name value"); 1084 } 970 1085 971 1086 @Override … … 996 1111 997 1112 998 private static final Primitive JRUN_EXCEPTION_PROTECTED = 999 new Primitive("jrun-exception-protected", PACKAGE_JAVA, true, 1000 "closure") { 1001 1002 @Override 1003 public LispObject execute(LispObject closure) { 1004 Function fun = checkFunction(closure); 1005 1006 try { 1007 return LispThread.currentThread().execute(closure); 1008 } 1009 catch (OutOfMemoryError oom) { 1010 return error(new StorageCondition("Out of memory.")); 1011 } 1012 catch (StackOverflowError oos) { 1013 return error(new StorageCondition("Stack overflow.")); 1014 } 1015 } 1113 // ### jrun-exception-protected closure 1114 private static final Primitive JRUN_EXCEPTION_PROTECTED = new pf_jrun_exception_protection(); 1115 private static final class pf_jrun_exception_protection extends Primitive 1116 { 1117 pf_jrun_exception_protection() 1118 { 1119 super("jrun-exception-protected", PACKAGE_JAVA, true, 1120 "closure"); 1121 } 1122 1123 @Override 1124 public LispObject execute(LispObject closure) { 1125 Function fun = checkFunction(closure); 1126 1127 try { 1128 return LispThread.currentThread().execute(closure); 1129 } 1130 catch (OutOfMemoryError oom) { 1131 return error(new StorageCondition("Out of memory.")); 1132 } 1133 catch (StackOverflowError oos) { 1134 return error(new StorageCondition("Stack overflow.")); 1135 } 1136 } 1016 1137 }; 1017 1138
Note: See TracChangeset
for help on using the changeset viewer.