Преглед на файлове

Sorting automake file, ordering questions and finally solving the header issue.

As commented, it is fair enought to put the headers also in _SORUCES variable,
hence I'm doing that.
Using some variables and patterns for registering new questions, and
distinguishing them from the generic utilities (qarith, qstrings, ..).
Michele Orrù преди 11 години
родител
ревизия
85880993a6
променени са 5 файла, в които са добавени 37 реда и са изтрити 5 реда
  1. 15 2
      src/questions/Makefile.am
  2. 10 1
      src/questions/allquestions.c
  3. 4 0
      src/questions/include/qarith.h
  4. 5 0
      src/questions/qarith.c
  5. 3 2
      src/questions/tests/Makefile.am

+ 15 - 2
src/questions/Makefile.am

@@ -1,5 +1,18 @@
 SUBDIRS = tests/
 
+# following the fucking manual, I am putting headers into the _SOURCES variable
+#  <https://www.gnu.org/software/automake/manual/html_node/Headers.html>
+EXAMPLE_QUESTION =   example.c
+WIENER_QUESTION =     wiener.c         include/qwiener.h
+POLLARD_QUESTION =   pollard.c         include/qpollard.h
+DIXON_QUESTION =       dixon.c
+
+QUESTIONS = $(WIENER_QUESTION) $(POLLARD_QUESTION) $(DIXON_QUESTION) \
+	    $(FERMAT_QUESTION) $(EXAMPLE_QUESTION)
+
+QLIBSOURCES =         qarith.c         include/qarith.h \
+	            qstrings.c         include/qstrings.h \
+                allquestions.c         include/questions.h
+
 lib_LIBRARIES = libquestions.a
-libquestions_a_SOURCES = wiener.c pollard.c example.c dixon.c allquestions.c qarith.c qstrings.c
-# da fuck liquestions_a_HEADERS = qwiener.h questions.h
+libquestions_a_SOURCES = $(QUESTIONS) $(QLIBSOURCES)

+ 10 - 1
src/questions/allquestions.c

@@ -1,3 +1,12 @@
+/**
+ * \file allquestions.c
+ *
+ * \brief Quetions controller.
+ *
+ * Implements procedures for addign and removing questions from the global \ref
+ * questions variable.
+ */
+
 #include <assert.h>
 #include <string.h>
 #include <bsd/sys/queue.h>
@@ -21,7 +30,7 @@ void select_question(const char *sq)
 }
 
 /**
- * /brief Puts registered questions into \ref questions.
+ * \brief Puts registered questions into \ref questions.
  *
  * Disposes all registered questions into a global linked list, so that future
  * procedures can iterate over all possible tests.

+ 4 - 0
src/questions/include/qarith.h

@@ -1,6 +1,10 @@
 #ifndef _QA_ARITH_H_
 #define _QA_ARITH_H
 
+
+/* shortcut macros. */
+#define BN_uiadd1(a) BN_uadd(a, a, BN_value_one())
+
 /**
  * Fractions made of bignums.
  */

+ 5 - 0
src/questions/qarith.c

@@ -1,3 +1,8 @@
+/**
+ * \file qarith.c
+ * \brief Random Algebraic utilities with BIGNUMs.
+ *
+ */
 #include <openssl/bn.h>
 
 #include "qa/questions/qarith.h"

+ 3 - 2
src/questions/tests/Makefile.am

@@ -1,8 +1,9 @@
 # unittesting my ass
 LDADD=../libquestions.a -lssl -lcrypto
 
-check_PROGRAMS = test_qarith test_qstrings test_wiener test_pollard
-TESTS = $(check_PROGRAMS)
+TESTS = test_qarith test_qstrings test_wiener test_pollard
+check_PROGRAMS = $(TESTS)
+# check_LIBRARIES = libquestions.a
 
 test_qstrings_SOURCES = test_qstrings.c
 test_qarith_SOURCES = test_qarith.c