| 1 |
#!/usr/bin/sh |
| 2 |
echo '* Am creating a new file '$4 |
| 3 |
exec $psys/psl $* <<%EOP |
| 4 |
(OFF ECHO) |
| 5 |
|
| 6 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 7 |
%% Copyright (C) 1996 Joergen Backelin |
| 8 |
%% |
| 9 |
%% Bergman is distributed in the hope that it will be useful, |
| 10 |
%% but WITHOUT ANY WARRANTY. No author or distributor |
| 11 |
%% accepts responsibility to anyone for the consequences of using it |
| 12 |
%% or for whether it serves any particular purpose or works at all, |
| 13 |
%% unless (s)he says so in writing. Refer to the Bergman General |
| 14 |
%% Public License for full details. |
| 15 |
|
| 16 |
%% Everyone is granted permission to copy, modify and redistribute |
| 17 |
%% bergman, but only under the conditions described in the |
| 18 |
%% Bergman General Public License. A copy of this license is |
| 19 |
%% supposed to have been given to you along with bergman so you |
| 20 |
%% can know your rights and responsibilities. It should be in a |
| 21 |
%% file named copyright. Among other things, the copyright notice |
| 22 |
%% and this notice must be preserved on all copies. |
| 23 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 24 |
|
| 25 |
% For debugging: |
| 26 |
% (LOAD addr2id) |
| 27 |
(off raise) |
| 28 |
(on eolinstringok) |
| 29 |
(global '(pRIME pRpRIME hALFpRIME cOMPOSIT!* mpfeRROR aRGUMENTS |
| 30 |
&*askstrong &*newnumber primlist |
| 31 |
firstprimroot expvect logvect oUTfILE)) |
| 32 |
%%(SETQ Arguments (GETUNIXARGS)) |
| 33 |
%(SETQ Prime (GETV UNIXARGS* 1)) |
| 34 |
(progn |
| 35 |
(setq pRIME $1) |
| 36 |
(setq pRpRIME (sub1 pRIME)) |
| 37 |
(setq hALFpRIME (quotient pRIME 2)) |
| 38 |
%(SETQ Composit!* (GETV UNIXARGS* 2)) |
| 39 |
(setq cOMPOSIT!* $2) |
| 40 |
%(SETQ MPFError!* (GETV UNIXARGS* 3)) |
| 41 |
(setq mpfeRROR!* $3) |
| 42 |
% (SETQ PrimeFilePreAmble "/usr/local/matte/bergman/domains/P") |
| 43 |
% (SETQ PrimeFilePreAmble $4) |
| 44 |
(load "$5") |
| 45 |
(dskin "$bmdomains/PRL") |
| 46 |
(setq pl (penultima primlist)) |
| 47 |
(cond ((eq (decide1 pRIME) 'composite) |
| 48 |
(exit-with-status cOMPOSITE!*))) |
| 49 |
% (SETQ OutFile (APPENDNUMBERTOSTRING Prime PrimeFilePreAmble)) |
| 50 |
(setq oUTfILE "$4") |
| 51 |
|
| 52 |
% Doing the job |
| 53 |
|
| 54 |
(setq firstprimroot (fIRSTpRIMITIVErOOT)) |
| 55 |
(setq expvect (mkvect (times2 2 pRIME))) |
| 56 |
(setq logvect (mkvect (times2 2 pRIME))) |
| 57 |
(mAKEexp!&logvectS (times2 2 pRIME)) |
| 58 |
|
| 59 |
% For debugging: |
| 60 |
% EXPVECT LOGVECT INTERPBACKTRACE |
| 61 |
|
| 62 |
% Saving the result on OutFile |
| 63 |
|
| 64 |
(wrs (open oUTfILE 'output)) |
| 65 |
(prin2 "% Preparation file for modulus calculation, |
| 66 |
% with the prime modulus ") |
| 67 |
(print pRIME) |
| 68 |
(prin2 "% The exponents and logarithms are calculated |
| 69 |
% with the base ") (print firstprimroot) |
| 70 |
(terpri) |
| 71 |
|
| 72 |
|
| 73 |
(writevectprog 'expvect (times2 pRpRIME 2)) |
| 74 |
(terpri) |
| 75 |
(terpri) |
| 76 |
|
| 77 |
(writevectprog 'logvect (times2 pRpRIME 2)) |
| 78 |
(terpri) |
| 79 |
|
| 80 |
(close (wrs nil)) |
| 81 |
|
| 82 |
(prin2 "* Now the file $4 should exist") (terpri) |
| 83 |
) |
| 84 |
(exit-with-status 0) |
| 85 |
%EOP |