File: mkprimefile

package info (click to toggle)
bergman 1.001%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 12,608 kB
  • sloc: csh: 1,690; lisp: 1,459; sh: 747; ansic: 57; haskell: 36; makefile: 12
file content (62 lines) | stat: -rw-r--r-- 1,513 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

% For debugging:
% (LOAD addr2id)
(OFF RAISE)
(ON EOLINSTRINGOK)
(GLOBAL '(Prime PrPrime HalfPrime Composit!* MPFError Arguments
	  &*ASKSTRONG &*NEWNUMBER PRIMLIST
	   FIRSTPRIMROOT EXPVECT LOGVECT OutFile))
%%(SETQ Arguments (GETUNIXARGS))
%(SETQ Prime (GETV UNIXARGS* 1))
(PROGN
(SETQ Prime $1)
(SETQ PrPrime (SUB1 Prime))
(SETQ HalfPrime (QUOTIENT Prime 2))
%(SETQ Composit!* (GETV UNIXARGS* 2))
(SETQ Composit!* $2)
%(SETQ MPFError!* (GETV UNIXARGS* 3))
(SETQ MPFError!* $3)
% (SETQ PrimeFilePreAmble "/usr/local/matte/bergman/domains/P")
% (SETQ PrimeFilePreAmble $4)
(LOAD "$5")
(DSKIN "$bmdomains/PRL")
(SETQ PL (PENULTIMA PRIMLIST))
(COND ((EQ (DECIDE1 Prime) 'COMPOSITE)
       (EXIT-WITH-STATUS Composite!*)))
% (SETQ OutFile (APPENDNUMBERTOSTRING Prime PrimeFilePreAmble))
(SETQ OutFile "$4")

% Doing the job

(SETQ FIRSTPRIMROOT (FirstPrimitiveRoot))
(SETQ EXPVECT (MKVECT (TIMES2 2 Prime)))
(SETQ LOGVECT (MKVECT (TIMES2 2 Prime)))
(MakeEXP!&LOGVECTs (TIMES2 2 Prime))

% For debugging:
% EXPVECT LOGVECT INTERPBACKTRACE

% Saving the result on OutFile

(WRS (OPEN OutFile 'OUTPUT))
(PRIN2 "% Preparation file for modulus calculation,
% with the prime modulus ")
(PRINT Prime)
(PRIN2 "% The exponents and logarithms are calculated
% with the base ") (PRINT FIRSTPRIMROOT)
(TERPRI)


(WRITEVECTPROG 'EXPVECT (TIMES2 PrPrime 2))
(TERPRI)
(TERPRI)

(WRITEVECTPROG 'LOGVECT (TIMES2 PrPrime 2))
(TERPRI)

(CLOSE (WRS NIL))

(PRIN2 "* Now the file $4 should exist") (TERPRI)
)
(EXIT-WITH-STATUS 0)
%EOP