quipu mercurial repository
Revisión | 49f4c4cf72ad9009cb3684be91682d0b4e0686f8 (tree) |
---|---|
Tiempo | 2020-04-08 12:55:27 |
Autor | Agustina Arzille <avarzille@rise...> |
Commiter | Agustina Arzille |
Remove dead code
@@ -1524,138 +1524,6 @@ | ||
1524 | 1524 | return (interp->retval); |
1525 | 1525 | } |
1526 | 1526 | |
1527 | -#if 0 | |
1528 | -static inline void | |
1529 | -import_sym (interpreter *interp, package *p, | |
1530 | - object sym, object as = UNBOUND, bool locked = false) | |
1531 | -{ | |
1532 | - object snam; | |
1533 | - | |
1534 | - if (str_p (sym)) | |
1535 | - snam = sym; | |
1536 | - else if (symbol_p (sym)) | |
1537 | - snam = symname (sym); | |
1538 | - else | |
1539 | - interp->raise ("type-error", "import list must " | |
1540 | - "consist of strings or symbols"); | |
1541 | - | |
1542 | - valref sv (interp, find_sym (interp, p->as_obj (), snam)); | |
1543 | - if (!symbol_p (*sv)) | |
1544 | - interp->raise ("load-error", QP_SPRINTF (interp, | |
1545 | - "symbol %Q not found", snam)); | |
1546 | - | |
1547 | - if (as == UNBOUND) | |
1548 | - { | |
1549 | - inherit_sym (interp, *sv, interp->xpkg, locked); | |
1550 | - return; | |
1551 | - } | |
1552 | - | |
1553 | - if (str_p (as)) | |
1554 | - ; | |
1555 | - else if (symbol_p (as)) | |
1556 | - as = symname (as); | |
1557 | - else | |
1558 | - interp->raise ("type-error", "alias list must " | |
1559 | - "consist of strings or symbols"); | |
1560 | - | |
1561 | - symval(intern (interp, as_str (as), nullptr, | |
1562 | - as_symbol(*sv)->vo_full & (symbol::special_flag | | |
1563 | - symbol::ctv_flag | symbol::alias_flag))) = symval (*sv); | |
1564 | -} | |
1565 | - | |
1566 | -[[noreturn]] static inline void | |
1567 | -import_alias_error (interpreter *interp, const char *msg) | |
1568 | -{ | |
1569 | - char buf[128]; | |
1570 | - sprintf (buf, "import list and aliases must %s", msg); | |
1571 | - interp->raise ("arg-error", buf); | |
1572 | -} | |
1573 | - | |
1574 | -// (%use path alias symbols) | |
1575 | -static DEFBUILTIN (p_use_fct) | |
1576 | -{ | |
1577 | - object path = *argv; | |
1578 | - if (!str_p (path)) | |
1579 | - interp->raise ("type-error", "package name must be a string"); | |
1580 | - | |
1581 | - object as = argv[1] == NIL ? UNBOUND : argv[1]; | |
1582 | - object syms = argv[2] == NIL ? UNBOUND : argv[2]; | |
1583 | - | |
1584 | - object rv; | |
1585 | - if (syms != UNBOUND || as == UNBOUND) | |
1586 | - rv = import_pkg (interp, path); | |
1587 | - else | |
1588 | - { | |
1589 | - object a2 = as; | |
1590 | - if (symbol_p (a2)) | |
1591 | - a2 = symname (a2); | |
1592 | - else if (!str_p (a2)) | |
1593 | - interp->raise ("type-error", "package alias " | |
1594 | - "must be a symbol or string"); | |
1595 | - | |
1596 | - rv = import_pkg (interp, path, as = a2); | |
1597 | - } | |
1598 | - | |
1599 | - if (rv == UNBOUND) | |
1600 | - interp->raise ("load-error", QP_SPRINTF (interp, | |
1601 | - "use: package %Q not found", path)); | |
1602 | - | |
1603 | - valref pkg (interp, rv); | |
1604 | - | |
1605 | - if (syms == UNBOUND) | |
1606 | - { // Intern the package and return it. | |
1607 | - symval(intern (interp, as_str (as != UNBOUND ? | |
1608 | - as : as_package(*pkg)->name))) = *pkg; | |
1609 | - qp_return (*pkg); | |
1610 | - } | |
1611 | - | |
1612 | - valref sym_a (interp, UNBOUND), sym_d (interp, UNBOUND); | |
1613 | - valref al_a (interp, UNBOUND), al_d (interp, UNBOUND); | |
1614 | - package *p = as_package (*pkg); | |
1615 | - | |
1616 | - if (as == UNBOUND) | |
1617 | - { | |
1618 | - if (!xcons_p (syms)) | |
1619 | - import_sym (interp, p, syms); | |
1620 | - else | |
1621 | - { | |
1622 | - for (*sym_d = syms; *sym_d != NIL; *sym_d = xcdr (*sym_d)) | |
1623 | - { | |
1624 | - if (!xcons_p (*sym_d)) | |
1625 | - interp->raise ("arg-error", | |
1626 | - "import list must not be dotted"); | |
1627 | - | |
1628 | - import_sym (interp, p, *sym_a = xcar (*sym_d)); | |
1629 | - } | |
1630 | - } | |
1631 | - } | |
1632 | - else if (itype (as) != itype (syms)) | |
1633 | - import_alias_error (interp, "be of the same type (symbols or conses)"); | |
1634 | - else | |
1635 | - { // We have an import list and the alias list. | |
1636 | - if (!xcons_p (syms)) | |
1637 | - import_sym (interp, p, syms, as); | |
1638 | - else | |
1639 | - { | |
1640 | - lwlock_guard g (interp, &as_package(interp->xpkg)->lock); | |
1641 | - | |
1642 | - for (*sym_d = syms, *al_d = as; *sym_d != NIL; | |
1643 | - *sym_d = xcdr (*sym_d), *al_d = xcdr (*al_d)) | |
1644 | - { | |
1645 | - if (!xcons_p (*sym_d) || !xcons_p (*al_d)) | |
1646 | - import_alias_error (interp, "not be dotted"); | |
1647 | - | |
1648 | - import_sym (interp, p, *sym_a = xcar (*sym_d), | |
1649 | - *al_d == NIL ? UNBOUND : (*al_a = xcar (*al_d)), true); | |
1650 | - } | |
1651 | - } | |
1652 | - } | |
1653 | - | |
1654 | - qp_return (symbol::t); | |
1655 | -} | |
1656 | - | |
1657 | -#endif | |
1658 | - | |
1659 | 1527 | // (%use name (:as alias) (:pull (:all symbols...))) |
1660 | 1528 | static DEFBUILTIN (p_use_fct) |
1661 | 1529 | { |