Home Online Manual
Top
Back: export
Forward: for
FastBack: Functions
FastForward: System variables
Up: Control structures
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

5.2.7 exportto

Syntax:
exportto( package_name , name );
exportto( package_name , list_of_names );
Purpose:
transfers an identifier in the current package into the one specified by package_name. package_name can be Current, Top or any other identifier of type package.

Note:
Objects defined in a ring are not automatically exported when exporting the ring.

Warning:
The identifier is transfered to the other package. It does no longer exist in the current package. If the identifier should only be copied, importfrom should be used instead.

Example:

 
proc p1
{
  int i,j;
  exportto(Current,i);
  intmat m;
  listvar(Current);
  exportto(Top,m);
}
p1();
==> // Top                            [0]  package Top (N)
==> // ::m                            [1]  intmat 1 x 1
==> // ::i                            [0]  int 0
==> // ::j                            [1]  int 0
==> // ::#                            [1]  list, size: 0
==> // ::p1                           [0]  proc
==> // ::min                          [0]  proc from standard.lib
==> // ::max                          [0]  proc from standard.lib
==> // ::datetime                     [0]  proc from standard.lib
==> // ::weightKB                     [0]  proc from standard.lib
==> // ::fprintf                      [0]  proc from standard.lib
==> // ::printf                       [0]  proc from standard.lib
==> // ::sprintf                      [0]  proc from standard.lib
==> // ::quotient4                    [0]  proc from standard.lib
==> // ::quotient5                    [0]  proc from standard.lib
==> // ::quotient3                    [0]  proc from standard.lib
==> // ::quotient2                    [0]  proc from standard.lib
==> // ::quotient1                    [0]  proc from standard.lib
==> // ::quot                         [0]  proc from standard.lib
==> // ::res                          [0]  proc from standard.lib
==> // ::groebner                     [0]  proc from standard.lib
==> // ::qslimgb                      [0]  proc from standard.lib
==> // ::hilbRing                     [0]  proc from standard.lib
==> // ::par2varRing                  [0]  proc from standard.lib
==> // ::quotientList                 [0]  proc from standard.lib
==> // ::stdhilb                      [0]  proc from standard.lib
==> // ::stdfglm                      [0]  proc from standard.lib
==> // ::flintZ                       [0]  proc from kernel (C)
package Test1;
exportto(Test1,p1);
listvar(Top);
==> // Top                            [0]  package Top (N)
==> // ::m                            [0]  intmat 1 x 1
==> // ::i                            [0]  int 0
==> // ::min                          [0]  proc from standard.lib
==> // ::max                          [0]  proc from standard.lib
==> // ::datetime                     [0]  proc from standard.lib
==> // ::weightKB                     [0]  proc from standard.lib
==> // ::fprintf                      [0]  proc from standard.lib
==> // ::printf                       [0]  proc from standard.lib
==> // ::sprintf                      [0]  proc from standard.lib
==> // ::quotient4                    [0]  proc from standard.lib
==> // ::quotient5                    [0]  proc from standard.lib
==> // ::quotient3                    [0]  proc from standard.lib
==> // ::quotient2                    [0]  proc from standard.lib
==> // ::quotient1                    [0]  proc from standard.lib
==> // ::quot                         [0]  proc from standard.lib
==> // ::res                          [0]  proc from standard.lib
==> // ::groebner                     [0]  proc from standard.lib
==> // ::qslimgb                      [0]  proc from standard.lib
==> // ::hilbRing                     [0]  proc from standard.lib
==> // ::par2varRing                  [0]  proc from standard.lib
==> // ::quotientList                 [0]  proc from standard.lib
==> // ::stdhilb                      [0]  proc from standard.lib
==> // ::stdfglm                      [0]  proc from standard.lib
==> // ::flintZ                       [0]  proc from kernel (C)
listvar(Test1);
==> // Test1                          [0]  package Test1 (N)
==> // ::p1                           [0]  proc
Test1::p1();
==> // Test1                          [0]  package Test1 (N)
==> // ::m                            [1]  intmat 1 x 1
==> // ::i                            [0]  int 0
==> // ::j                            [1]  int 0
==> // ::#                            [1]  list, size: 0
==> // ::p1                           [0]  proc
==> // ** redefining m (  exportto(Top,m);)
listvar(Top);
==> // Top                            [0]  package Top (N)
==> // ::m                            [0]  intmat 1 x 1
==> // ::i                            [0]  int 0
==> // ::min                          [0]  proc from standard.lib
==> // ::max                          [0]  proc from standard.lib
==> // ::datetime                     [0]  proc from standard.lib
==> // ::weightKB                     [0]  proc from standard.lib
==> // ::fprintf                      [0]  proc from standard.lib
==> // ::printf                       [0]  proc from standard.lib
==> // ::sprintf                      [0]  proc from standard.lib
==> // ::quotient4                    [0]  proc from standard.lib
==> // ::quotient5                    [0]  proc from standard.lib
==> // ::quotient3                    [0]  proc from standard.lib
==> // ::quotient2                    [0]  proc from standard.lib
==> // ::quotient1                    [0]  proc from standard.lib
==> // ::quot                         [0]  proc from standard.lib
==> // ::res                          [0]  proc from standard.lib
==> // ::groebner                     [0]  proc from standard.lib
==> // ::qslimgb                      [0]  proc from standard.lib
==> // ::hilbRing                     [0]  proc from standard.lib
==> // ::par2varRing                  [0]  proc from standard.lib
==> // ::quotientList                 [0]  proc from standard.lib
==> // ::stdhilb                      [0]  proc from standard.lib
==> // ::stdfglm                      [0]  proc from standard.lib
==> // ::flintZ                       [0]  proc from kernel (C)
listvar(Test1);
==> // Test1                          [0]  package Test1 (N)
==> // ::i                            [0]  int 0
==> // ::p1                           [0]  proc
See export; importfrom; keepring.