Changeset 4498 for trunk/compiler
- Timestamp:
- 10/11/08 12:09:02 (3 months ago)
- Files:
-
- 1 modified
-
trunk/compiler/logtalk.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/compiler/logtalk.pl
r4480 r4498 524 524 525 525 526 % create_object( +object_identifier, +list, +list, +list)526 % create_object(?object_identifier, +list, +list, +list) 527 527 528 528 create_object(Obj, Rels, Dirs, Clauses) :- 529 (var( Obj); var(Rels); var(Dirs); var(Clauses)),529 (var(Rels); var(Dirs); var(Clauses)), 530 530 throw(error(instantiation_error, create_object(Obj, Rels, Dirs, Clauses))). 531 531 532 532 create_object(Obj, Rels, Dirs, Clauses) :- 533 nonvar(Obj), 533 534 \+ callable(Obj), 534 535 throw(error(type_error(object_identifier, Obj), create_object(Obj, Rels, Dirs, Clauses))). 535 536 536 537 create_object(Obj, Rels, Dirs, Clauses) :- 538 nonvar(Obj), 537 539 '$lgt_current_object_'(Obj, _, _, _, _, _, _, _, _, _, _, _, _), 538 540 throw(error(permission_error(modify, object, Obj), create_object(Obj, Rels, Dirs, Clauses))). 539 541 540 542 create_object(Obj, Rels, Dirs, Clauses) :- 543 nonvar(Obj), 541 544 '$lgt_current_category_'(Obj, _, _, _, _, _, _), 542 545 throw(error(permission_error(modify, category, Obj), create_object(Obj, Rels, Dirs, Clauses))). 543 546 544 547 create_object(Obj, Rels, Dirs, Clauses) :- 548 nonvar(Obj), 545 549 '$lgt_current_protocol_'(Obj, _, _, _, _), 546 550 throw(error(permission_error(modify, protocol, Obj), create_object(Obj, Rels, Dirs, Clauses))). … … 559 563 560 564 create_object(Obj, Rels, Dirs, Clauses) :- 565 ( var(Obj) -> 566 '$lgt_gen_entity_identifier'(0'o, Obj) 567 ; true 568 ), 561 569 '$lgt_clean_pp_clauses', 562 570 '$lgt_tr_object_id'(Obj, (dynamic)), … … 574 582 575 583 576 % create_category( +category_identifier, +list, +list, +list)584 % create_category(?category_identifier, +list, +list, +list) 577 585 578 586 create_category(Ctg, Rels, Dirs, Clauses) :- 579 (var( Ctg); var(Rels); var(Dirs); var(Clauses)),587 (var(Rels); var(Dirs); var(Clauses)), 580 588 throw(error(instantiation_error, create_category(Ctg, Rels, Dirs, Clauses))). 581 589 582 590 create_category(Ctg, Rels, Dirs, Clauses) :- 591 nonvar(Ctg), 583 592 \+ atom(Ctg), 584 593 throw(error(type_error(category_identifier, Ctg), create_category(Ctg, Rels, Dirs, Clauses))). 585 594 586 595 create_category(Ctg, Rels, Dirs, Clauses) :- 596 nonvar(Ctg), 587 597 '$lgt_current_category_'(Ctg, _, _, _, _, _, _), 588 598 throw(error(permission_error(modify, category, Ctg), create_category(Ctg, Rels, Dirs, Clauses))). 589 599 590 600 create_category(Ctg, Rels, Dirs, Clauses) :- 601 nonvar(Ctg), 591 602 '$lgt_current_object_'(Ctg, _, _, _, _, _, _, _, _, _, _, _, _), 592 603 throw(error(permission_error(modify, object, Ctg), create_category(Ctg, Rels, Dirs, Clauses))). 593 604 594 605 create_category(Ctg, Rels, Dirs, Clauses) :- 606 nonvar(Ctg), 595 607 '$lgt_current_protocol_'(Ctg, _, _, _, _), 596 608 throw(error(permission_error(modify, protocol, Ctg), create_category(Ctg, Rels, Dirs, Clauses))). … … 609 621 610 622 create_category(Ctg, Rels, Dirs, Clauses) :- 623 ( var(Ctg) -> 624 '$lgt_gen_entity_identifier'(0'c, Ctg) 625 ; true 626 ), 611 627 '$lgt_clean_pp_clauses', 612 628 '$lgt_tr_category_id'(Ctg, (dynamic)), … … 623 639 624 640 625 % create_protocol( +protocol_identifier, +list, +list)641 % create_protocol(?protocol_identifier, +list, +list) 626 642 627 643 create_protocol(Ptc, Rels, Dirs) :- 628 (var( Ptc); var(Rels); var(Dirs)),644 (var(Rels); var(Dirs)), 629 645 throw(error(instantiation_error, create_protocol(Ptc, Rels, Dirs))). 630 646 631 647 create_protocol(Ptc, Rels, Dirs) :- 648 nonvar(Ptc), 632 649 \+ atom(Ptc), 633 650 throw(error(type_error(protocol_identifier, Ptc), create_protocol(Ptc, Rels, Dirs))). 634 651 635 652 create_protocol(Ptc, Rels, Dirs) :- 653 nonvar(Ptc), 636 654 '$lgt_current_protocol_'(Ptc, _, _, _, _), 637 655 throw(error(permission_error(modify, protocol, Ptc), create_protocol(Ptc, Rels, Dirs))). 638 656 639 657 create_protocol(Ptc, Rels, Dirs) :- 658 nonvar(Ptc), 640 659 '$lgt_current_object_'(Ptc, _, _, _, _, _, _, _, _, _, _, _, _), 641 660 throw(error(permission_error(modify, object, Ptc), create_protocol(Ptc, Rels, Dirs))). 642 661 643 662 create_protocol(Ptc, Rels, Dirs) :- 663 nonvar(Ptc), 644 664 '$lgt_current_category_'(Ptc, _, _, _, _, _, _), 645 665 throw(error(permission_error(modify, category, Ptc), create_protocol(Ptc, Rels, Dirs))). … … 654 674 655 675 create_protocol(Ptc, Rels, Dirs) :- 676 ( var(Ptc) -> 677 '$lgt_gen_entity_identifier'(0'p, Ptc) 678 ; true 679 ), 656 680 '$lgt_clean_pp_clauses', 657 681 '$lgt_tr_protocol_id'(Ptc, (dynamic)), … … 662 686 '$lgt_assert_tr_entity', 663 687 '$lgt_clean_pp_clauses'. 688 689 690 691 % '$lgt_gen_entity_identifier'(+char_code, -entity_identifier) 692 693 '$lgt_gen_entity_identifier'(Base, Id) :- 694 repeat, 695 '$lgt_next_integer'(1, New), 696 number_codes(New, Codes), 697 atom_codes(Id, [Base| Codes]), 698 \+ '$lgt_current_protocol_'(Id, _, _, _, _), 699 \+ '$lgt_current_object_'(Id, _, _, _, _, _, _, _, _, _, _, _, _), 700 \+ '$lgt_current_category_'(Id, _, _, _, _, _, _), 701 !. 702 703 704 '$lgt_next_integer'(I, I). 705 '$lgt_next_integer'(I, J) :- 706 I2 is I + 1, 707 '$lgt_next_integer'(I2, J). 664 708 665 709
