factorial: Fix usage message to fit in with conventions.
[u/mdw/catacomb] / pgen.h
diff --git a/pgen.h b/pgen.h
index 548fadb..a80fefa 100644 (file)
--- a/pgen.h
+++ b/pgen.h
@@ -168,44 +168,41 @@ extern pgen_proc pgen_jump;
 
 extern pgen_proc pgen_test;
 
-/*----- Safe prime functions ----------------------------------------------*/
-
-/* --- @pgen_safestep@ --- *
- *
- * Steps two numbers, %$q$% and %$p = 2q + 1$%, such that neither has any
- * small factors.  %$p$% is put in the event block.
- */
-
-typedef struct pgen_safestepctx {
-  pfilt q, p;
-} pgen_safestepctx;
-
-extern pgen_proc pgen_safestep;
-
-/* --- @pgen_safejump@ --- *
+/*----- Simultaneous primality checking -----------------------------------*/
+
+typedef struct pgen_simulprime {
+  mp *mul, *add;                       /* Arguments from the client */
+  unsigned f;                          /* Flags, set by client, changed */
+#define PGENF_KEEP 1u                  /*   Keep this prime's value */
+#define PGENF_JUMP 8u                  /*   Use jump table, not stepping */
+  pfilt p;                             /* This prime's filter */
+  rabin r;                             /* Rabin testing context */
+  union {
+    mpw step;                          /* The simple step to use */
+    pfilt *jump;                       /* The jump to move by */
+    mp *x;                             /* The result, if wanted */
+  } u;
+} pgen_simulprime;
+
+typedef struct pgen_simulctx {
+  pgen_simulprime *v;                  /* Vector of related primes */
+  unsigned n;                          /* Size of the vector */
+  mp *step;                            /* Basic stepping value */
+} pgen_simulctx;
+  
+/* --- @pgen_simulstep@ --- *
  *
- * Jumps two numbers, %$q$% and %$p = 2q + 1$% such that neither has any
- * small factors.
+ * Step a collection of numbers simultaneously.
  */
 
-typedef struct pgen_safejumpctx {
-  pfilt q, jq;
-  pfilt p, jp;
-} pgen_safejumpctx;
+extern pgen_proc pgen_simulstep;
 
-extern pgen_proc pgen_safejump;
-
-/* --- @pgen_safetest@ --- *
+/* --- @pgen_simultest@ --- *
  *
- * Applies Rabin-Miller tests to %$p$% and %$(p - 1)/2$%.
+ * Test a collection of numbers simultaneously.
  */
 
-typedef struct pgen_safetestctx {
-  pgen_safestepctx c;
-  rabin q, p;
-} pgen_safetestctx;
-
-extern pgen_proc pgen_safetest;
+extern pgen_proc pgen_simultest;
 
 /*----- Miscellaneous steppers and testers --------------------------------*/