aboutsummaryrefslogtreecommitdiff
path: root/pmt.c
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2018-08-14 10:08:27 -0500
committertlatorre <tlatorre@uchicago.edu>2018-08-14 10:08:27 -0500
commit24c8bcfe7f76b20124e2862ea050f815c0f768e7 (patch)
treee5bdbd638a2c7f38f1c094cc9e95cbdfe05b9481 /pmt.c
parent0b7f199c0d93074484ea580504485a32dc29f5e2 (diff)
downloadsddm-24c8bcfe7f76b20124e2862ea050f815c0f768e7.tar.gz
sddm-24c8bcfe7f76b20124e2862ea050f815c0f768e7.tar.bz2
sddm-24c8bcfe7f76b20124e2862ea050f815c0f768e7.zip
move everything to src directory
Diffstat (limited to 'pmt.c')
-rw-r--r--pmt.c82
1 files changed, 0 insertions, 82 deletions
diff --git a/pmt.c b/pmt.c
deleted file mode 100644
index d36e302..0000000
--- a/pmt.c
+++ /dev/null
@@ -1,82 +0,0 @@
-#include "pmt.h"
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include "vector.h"
-
-static int initialized = 0;
-
-pmt pmts[MAX_PMTS];
-
-int load_pmt_info()
-{
- int i, j;
- char line[256];
- char *str;
- double value;
- int n;
-
- FILE *f = fopen("pmt.txt", "r");
-
- if (!f) {
- fprintf(stderr, "failed to open pmt.txt: %s", strerror(errno));
- return -1;
- }
-
- i = 0;
- n = 0;
- /* For the first pass, we just count how many values there are. */
- while (fgets(line, sizeof(line), f)) {
- size_t len = strlen(line);
- if (len && (line[len-1] != '\n')) {
- fprintf(stderr, "got incomplete line on line %i: '%s'\n", i, line);
- goto err;
- }
-
- i += 1;
-
- if (!len) continue;
- else if (line[0] == '#') continue;
-
- str = strtok(line," \n");
-
- j = 0;
- while (str) {
- value = strtod(str, NULL);
- switch (j) {
- case 0:
- case 1:
- case 2:
- pmts[n].pos[j] = value/10.0;
- break;
- case 3:
- case 4:
- case 5:
- pmts[n].normal[j-3] = value;
- break;
- case 6:
- pmts[n].pmt_type = value;
- break;
- }
- j += 1;
- str = strtok(NULL," \n");
- }
-
- normalize(pmts[n].normal);
-
- n += 1;
- }
-
- fclose(f);
-
- initialized = 1;
-
- return 0;
-
-err:
- fclose(f);
-
- return -1;
-}
-