modified: src1/input.c
[GalaxyCodeBases.git] / c_cpp / salusFstReCoord / src1 / main.c
blobcea935a419a82675bd4ced49428bbc5b0f84e7ed
1 #include <stdio.h> // printf, fopen
3 #include "common.h"
5 #ifdef TARGET_OS_OSX
6 #include <malloc/malloc.h>
7 #endif
9 const char *argp_program_version = "fstBC transCorrd demo 0.1 @" __TIME__ "," __DATE__;
10 const char *argp_program_bug_address = "huxs@salus-bio.com";
12 /* Program documentation. */
13 static char doc[] =
14 "fstBC transCorrd single threaded"
15 #if defined(DEBUG)
16 " (Debug Version)"
17 #elif defined(NDEBUG)
18 " (Release Version)"
19 #else
20 " (with assert)"
21 #endif
24 /* Global Var for "common.h" */
25 parameters_t Parameters = {
26 .fqSkipped = 0,
27 .fqValid = 0,
29 // static_assert(VARTYPE(Parameters.jobDataState)==1, "It is not uint8_t");
30 workerArray_t *workerArray;
32 int main(int argc, char *argv[]) {
33 if (argc != 3) {
34 fprintf(stderr, "====== %s ======\n[i]Usage: %s <fstBC.fq[.gz]> <spatial.txt>\n", doc, argv[0]);
35 return 2;
37 printf("[i]%s %s %s\n", argv[0], argv[1], argv[2]);
38 Parameters.inFastqFilename = argv[1];
39 // 没printf拖时间就得加 barrier
40 Parameters.outSpatialFilename = argv[2];
41 errno = 0; /* extern int, but do not declare errno manually */
42 Parameters.outfp = fopen(Parameters.outSpatialFilename, "w");
43 if (errno != 0) {
44 fprintf(stderr, "[x]Error on opening output file [%s]: %s.\n", Parameters.outSpatialFilename, strerror(errno));
45 exit(EXIT_FAILURE);
47 // defLoop_p = uv_default_loop();
49 int_least16_t n_threads = 1;
50 workerArray_t *workerArray = (workerArray_t *)calloc(n_threads, sizeof(workerArray_t));
52 #ifndef RELEASE
53 #if __has_builtin(__builtin_dump_struct)
54 #pragma GCC diagnostic push
55 #pragma GCC diagnostic ignored "-Wformat-pedantic"
56 __builtin_dump_struct(&Parameters, &printf);
57 #pragma GCC diagnostic pop
58 #endif
59 #endif
61 free(workerArray);
62 fclose(Parameters.outfp);
63 fprintf(stderr, "[i]Run to the end.\n");
64 return 0;