Improve/clean up fix to 2004/vik2

Now the vik2_1.c file only has code from that file rather than other
pre-processed things from before.

Both vik2.c and vik2_1.c now don't use FNAME but rather include __FILE__
just to make it a bit easier. Note that this was not done with
vik2.possible.cat.death.c because it is there for fun and to demonstrate
the problem I fixed (which unfortunately involved heavy modifications to
the original file).

Format/typo check README.md file.
This commit is contained in:
Cody Boone Ferguson committed 2023-11-19 13:29:10 -08:00
1 parent 7bb8f6a988
commit 04c4388db4
4 files changed
+156 -718

No files matched your search

+16 -17
View File
@@ -12,13 +12,6 @@ make
```
### Try:
```sh
echo "Do or do not. There is no try."
```
## Judges' remarks:
The fun thing about [CPP](https://en.wikipedia.org/wiki/C_preprocessor) abuses
@@ -52,6 +45,7 @@ Since it takes a very long time to compile the program, there is a
symbol that can be defined to shorten the compile time and avoid
compiler errors.
### Features
The program implements an 11-bit
@@ -87,7 +81,7 @@ The ALU has six instructions:
Internally the [ALU](https://en.wikipedia.org/wiki/Arithmetic_logic_unit)
implements a one bit adder with a carry in and carry out. This adder is the core
of the ALU. The `ADD` instruction uses the one bit adder to create the 11-bit
adder. The SUB instruction is implemented by adding `~Y` to `X` and then add 1.
adder. The `SUB` instruction is implemented by adding `~Y` to `X` and then add 1.
Finally the `TST` instruction calculates `X-Y` and checks the result and the
[CARRY bit](https://en.wikipedia.org/wiki/Carry_flag) in the `SR`
[register](https://en.wikipedia.org/wiki/Processor_register) to set the `EQ` and
@@ -114,7 +108,7 @@ The choice of application may be a bit unfortunate since we've already
seen a winning entry calculating [prime
numbers](https://en.wikipedia.org/wiki/Prime_number) in the
[pre-processor](https://en.wikipedia.org/wiki/C_preprocessor).
There is a big difference though. The 1988 applin entry uses pre-
There is a big difference though. The [1988/applin](/1988/applin/README.md) entry uses pre-
processor arithmetic (in a very nice way though). This program only
defines and undefines symbols in a well defined ;) way and doesn't do
any pre-processor arithmetics.
@@ -122,11 +116,12 @@ any pre-processor arithmetics.
The reason why I chose to do a [prime
number](https://en.wikipedia.org/wiki/Prime_number) application is that the
algorithm can be written to do a lot of calculations without a lot of nesting
(`gnu cpp` allows only 200 nested includes).
(GNU `cpp` allows only 200 nested includes).
### Build and Run
First, do a first pre-processing of the initial definitions. The FNAME
First, do a first pre-processing of the initial definitions. The `FNAME`
symbol must be defined to the name of the output file. If you want to
speed up the compilation, define the `STOP` symbol to anything from `_3` to
`_10`. (The default value is `_10` which will make the compilation take some
@@ -157,10 +152,11 @@ Then run the program to reveal all prime numbers up to 32 (if you used
./vik2
```
### Verification
I wasn't able to compile the full program which calculates [prime
numbers](https://en.wikipedia.org/wiki/Prime_number) up to 1024 using `gnu cpp`
numbers](https://en.wikipedia.org/wiki/Prime_number) up to 1024 using GNU `cpp`
(or any other [pre-processor](https://en.wikipedia.org/wiki/C_preprocessor)) so
I had to write my own. Knowing how the program works it was quite easy to reduce
the compilation time from several hours to about one second. I also added some
@@ -168,6 +164,7 @@ statistics to my home made pre-processor and I found that calculating prime
numbers up to 1024 makes the program include itself over 6.8 million times (see
the statistics table below).
### Obfuscation
Well, since 98.5% of the program is
@@ -191,22 +188,24 @@ The program has 1029 lines which makes it the longest entry (so far).
Even though the pre-processed and indented output is easier to read, it
is quite hard to find the code in it. The size of the pre-processed file
is several Mb when using `gnu cpp`.
is several Mb when using GNU `cpp`.
### Limitations
In order to fit the program within the space limits, I had to define the
`#define`, `#endif`, and some other directives as single character symbols.
This does not compile on all
[pre-processors](https://en.wikipedia.org/wiki/C_preprocessor) but using `gnu
cpp` as a first compilation step solves this.
[pre-processors](https://en.wikipedia.org/wiki/C_preprocessor) but using GNU
`cpp` as a first compilation step solves this.
### Statistics
The table below contains some interesting statistics about the compilation of
the program. The intermediate file size is the size of the output file of the
cpp [pre-processor](https://en.wikipedia.org/wiki/C_preprocessor). The time
taken to pre-process the program were measured using gnu cpp on my 2.0MHz P4
`cpp` [pre-processor](https://en.wikipedia.org/wiki/C_preprocessor). The times
taken to pre-process the program were measured using GNU `cpp` on my 2.0MHz P4
with 512Mb ram and a lot of disk.
```
+65 -65
View File
@@ -118,7 +118,7 @@
#ifdef t
#define b
#endif
#include FNAME
#include __FILE__
#ifdef p
#define c
#endif
@@ -129,7 +129,7 @@
#ifdef s
#define b
#endif
#include FNAME
#include __FILE__
#ifdef p
#define d
#endif
@@ -140,7 +140,7 @@
#ifdef u
#define b
#endif
#include FNAME
#include __FILE__
#ifdef p
#define e
#endif
@@ -151,7 +151,7 @@
#ifdef v
#define b
#endif
#include FNAME
#include __FILE__
#ifdef p
#define f
#endif
@@ -162,7 +162,7 @@
#ifdef w
#define b
#endif
#include FNAME
#include __FILE__
#ifdef p
#define g
#endif
@@ -173,7 +173,7 @@
#ifdef x
#define b
#endif
#include FNAME
#include __FILE__
#ifdef p
#define h
#endif
@@ -184,7 +184,7 @@
#ifdef y
#define b
#endif
#include FNAME
#include __FILE__
#ifdef p
#define Z
#endif
@@ -195,7 +195,7 @@
#ifdef z
#define b
#endif
#include FNAME
#include __FILE__
#ifdef p
#define j
#endif
@@ -206,7 +206,7 @@
#ifdef A
#define b
#endif
#include FNAME
#include __FILE__
#ifdef p
#define k
#endif
@@ -217,7 +217,7 @@
#ifdef B
#define b
#endif
#include FNAME
#include __FILE__
#ifdef p
#define m
#endif
@@ -228,7 +228,7 @@
#ifdef r
#define b
#endif
#include FNAME
#include __FILE__
#ifdef p
#define n
#endif
@@ -237,10 +237,10 @@
#else
#ifdef H
#define E
#include FNAME
#include __FILE__
#define s
#define F
#include FNAME
#include __FILE__
#undef s
#undef H
#else
@@ -301,7 +301,7 @@
#define r
#endif
#define F
#include FNAME
#include __FILE__
#ifdef _v
#undef _v
#endif
@@ -309,10 +309,10 @@
#define _v
#endif
#define E
#include FNAME
#include __FILE__
#define t
#define F
#include FNAME
#include __FILE__
#ifdef _v
#ifdef q
#undef q
@@ -330,7 +330,7 @@
#undef _q
#endif
#define _u
#include FNAME
#include __FILE__
#ifndef c
#ifndef d
#ifndef e
@@ -434,7 +434,7 @@
#endif
#endif
#define E
#include FNAME
#include __FILE__
#define t
#ifdef _h
#define s
@@ -467,9 +467,9 @@
#define r
#endif
#define _w
#include FNAME
#include __FILE__
#define o
#include FNAME
#include __FILE__
#ifndef J
#ifdef _q
#define c
@@ -514,9 +514,9 @@
#define n
#endif
#define H
#include FNAME
#include __FILE__
#define E
#include FNAME
#include __FILE__
#define t
#ifdef d
#define X
@@ -601,9 +601,9 @@
#define n
#endif
#define H
#include FNAME
#include __FILE__
#define E
#include FNAME
#include __FILE__
#define t
#ifdef d
#define L
@@ -648,7 +648,7 @@
#endif
#endif
#define o
#include FNAME
#include __FILE__
#ifdef _y
#undef _y
#define c
@@ -695,7 +695,7 @@
#endif
#ifdef J
#define o
#include FNAME
#include __FILE__
#ifdef _s
#define c
#endif
@@ -730,9 +730,9 @@
#define n
#endif
#define H
#include FNAME
#include __FILE__
#define E
#include FNAME
#include __FILE__
#ifdef _M
#define t
#endif
@@ -767,10 +767,10 @@
#define r
#endif
#define _w
#include FNAME
#include __FILE__
#ifdef J
#undef i
#include FNAME
#include __FILE__
#ifdef _h
| 2
#endif
@@ -802,7 +802,7 @@
;
#endif
#define o
#include FNAME
#include __FILE__
#define c
#ifdef _h
#undef _h
@@ -845,7 +845,7 @@
#define n
#endif
#define H
#include FNAME
#include __FILE__
#ifdef d
#define _h
#endif
@@ -877,7 +877,7 @@
#define _r
#endif
#define o
#include FNAME
#include __FILE__
#undef _s
#else
#ifdef _q
@@ -885,7 +885,7 @@
#else
#define _u
#endif
#include FNAME
#include __FILE__
#ifdef c
#define _y
#endif
@@ -924,46 +924,46 @@
#else
#ifdef _J
#define _x
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#undef _x
#else
#ifdef _K
#define _J
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#undef _J
#else
#define _K
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include FNAME
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#undef _K
#ifndef K
#include FNAME
#include __FILE__
#endif
#endif
#endif
+67 -616
View File
@@ -1,11 +1,3 @@
# 1 "vik2.c"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 414 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "vik2.c" 2
# 18 "vik2.c"
#ifdef i
#ifdef o
#ifdef c
@@ -126,7 +118,7 @@
#ifdef t
#define b
#endif
#include "vik2_1.c"
#include __FILE__
#ifdef p
#define c
#endif
@@ -137,7 +129,7 @@
#ifdef s
#define b
#endif
#include "vik2_1.c"
#include __FILE__
#ifdef p
#define d
#endif
@@ -148,7 +140,7 @@
#ifdef u
#define b
#endif
#include "vik2_1.c"
#include __FILE__
#ifdef p
#define e
#endif
@@ -159,7 +151,7 @@
#ifdef v
#define b
#endif
#include "vik2_1.c"
#include __FILE__
#ifdef p
#define f
#endif
@@ -170,7 +162,7 @@
#ifdef w
#define b
#endif
#include "vik2_1.c"
#include __FILE__
#ifdef p
#define g
#endif
@@ -181,7 +173,7 @@
#ifdef x
#define b
#endif
#include "vik2_1.c"
#include __FILE__
#ifdef p
#define h
#endif
@@ -192,7 +184,7 @@
#ifdef y
#define b
#endif
#include "vik2_1.c"
#include __FILE__
#ifdef p
#define Z
#endif
@@ -203,7 +195,7 @@
#ifdef z
#define b
#endif
#include "vik2_1.c"
#include __FILE__
#ifdef p
#define j
#endif
@@ -214,7 +206,7 @@
#ifdef A
#define b
#endif
#include "vik2_1.c"
#include __FILE__
#ifdef p
#define k
#endif
@@ -225,7 +217,7 @@
#ifdef B
#define b
#endif
#include "vik2_1.c"
#include __FILE__
#ifdef p
#define m
#endif
@@ -236,7 +228,7 @@
#ifdef r
#define b
#endif
#include "vik2_1.c"
#include __FILE__
#ifdef p
#define n
#endif
@@ -245,10 +237,10 @@
#else
#ifdef H
#define E
#include "vik2_1.c"
#include __FILE__
#define s
#define F
#include "vik2_1.c"
#include __FILE__
#undef s
#undef H
#else
@@ -309,7 +301,7 @@
#define r
#endif
#define F
#include "vik2_1.c"
#include __FILE__
#ifdef _v
#undef _v
#endif
@@ -317,10 +309,10 @@
#define _v
#endif
#define E
#include "vik2_1.c"
#include __FILE__
#define t
#define F
#include "vik2_1.c"
#include __FILE__
#ifdef _v
#ifdef q
#undef q
@@ -338,7 +330,7 @@
#undef _q
#endif
#define _u
#include "vik2_1.c"
#include __FILE__
#ifndef c
#ifndef d
#ifndef e
@@ -443,7 +435,7 @@
#endif
#endif
#define E
#include "vik2_1.c"
#include __FILE__
#define t
#ifdef _h
#define s
@@ -476,9 +468,9 @@
#define r
#endif
#define _w
#include "vik2_1.c"
#include __FILE__
#define o
#include "vik2_1.c"
#include __FILE__
#ifndef J
#ifdef _q
#define c
@@ -523,9 +515,9 @@
#define n
#endif
#define H
#include "vik2_1.c"
#include __FILE__
#define E
#include "vik2_1.c"
#include __FILE__
#define t
#ifdef d
#define X
@@ -610,9 +602,9 @@
#define n
#endif
#define H
#include "vik2_1.c"
#include __FILE__
#define E
#include "vik2_1.c"
#include __FILE__
#define t
#ifdef d
#define L
@@ -657,7 +649,7 @@
#endif
#endif
#define o
#include "vik2_1.c"
#include __FILE__
#ifdef _y
#undef _y
#define c
@@ -704,7 +696,7 @@
#endif
#ifdef J
#define o
#include "vik2_1.c"
#include __FILE__
#ifdef _s
#define c
#endif
@@ -739,9 +731,9 @@
#define n
#endif
#define H
#include "vik2_1.c"
#include __FILE__
#define E
#include "vik2_1.c"
#include __FILE__
#ifdef _M
#define t
#endif
@@ -776,10 +768,10 @@
#define r
#endif
#define _w
#include "vik2_1.c"
#include __FILE__
#ifdef J
#undef i
#include "vik2_1.c"
#include __FILE__
#ifdef _h
| 2
#endif
@@ -811,7 +803,7 @@
;
#endif
#define o
#include "vik2_1.c"
#include __FILE__
#define c
#ifdef _h
#undef _h
@@ -854,7 +846,7 @@
#define n
#endif
#define H
#include "vik2_1.c"
#include __FILE__
#ifdef d
#define _h
#endif
@@ -886,7 +878,7 @@
#define _r
#endif
#define o
#include "vik2_1.c"
#include __FILE__
#undef _s
#else
#ifdef _q
@@ -894,7 +886,7 @@
#else
#define _u
#endif
#include "vik2_1.c"
#include __FILE__
#ifdef c
#define _y
#endif
@@ -933,46 +925,46 @@
#else
#ifdef _J
#define _x
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#undef _x
#else
#ifdef _K
#define _J
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#undef _J
#else
#define _K
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include "vik2_1.c"
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#include __FILE__
#undef _K
#ifndef K
#include "vik2_1.c"
#include __FILE__
#endif
#endif
#endif
@@ -995,547 +987,6 @@ printf(
1
#else
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h" 1 3 4
# 64 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h" 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h" 1 3 4
# 68 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h" 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h" 1 3 4
# 666 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h" 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_symbol_aliasing.h" 1 3 4
# 667 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h" 2 3 4
# 732 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h" 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_posix_availability.h" 1 3 4
# 733 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h" 2 3 4
# 69 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h" 2 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/Availability.h" 1 3 4
# 165 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/Availability.h" 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/AvailabilityVersions.h" 1 3 4
# 166 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/Availability.h" 2 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/AvailabilityInternal.h" 1 3 4
# 167 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/Availability.h" 2 3 4
# 70 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h" 2 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_types.h" 1 3 4
# 27 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_types.h" 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h" 1 3 4
# 33 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h" 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/_types.h" 1 3 4
# 34 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/_types.h" 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/arm/_types.h" 1 3 4
# 15 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/arm/_types.h" 3 4
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef short __int16_t;
typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
typedef long long __int64_t;
typedef unsigned long long __uint64_t;
typedef long __darwin_intptr_t;
typedef unsigned int __darwin_natural_t;
# 48 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/arm/_types.h" 3 4
typedef int __darwin_ct_rune_t;
typedef union {
char __mbstate8[128];
long long _mbstateL;
} __mbstate_t;
typedef __mbstate_t __darwin_mbstate_t;
typedef long int __darwin_ptrdiff_t;
typedef long unsigned int __darwin_size_t;
typedef __builtin_va_list __darwin_va_list;
typedef int __darwin_wchar_t;
typedef __darwin_wchar_t __darwin_rune_t;
typedef int __darwin_wint_t;
typedef unsigned long __darwin_clock_t;
typedef __uint32_t __darwin_socklen_t;
typedef long __darwin_ssize_t;
typedef long __darwin_time_t;
# 35 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/_types.h" 2 3 4
# 34 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h" 2 3 4
# 55 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h" 3 4
typedef __int64_t __darwin_blkcnt_t;
typedef __int32_t __darwin_blksize_t;
typedef __int32_t __darwin_dev_t;
typedef unsigned int __darwin_fsblkcnt_t;
typedef unsigned int __darwin_fsfilcnt_t;
typedef __uint32_t __darwin_gid_t;
typedef __uint32_t __darwin_id_t;
typedef __uint64_t __darwin_ino64_t;
typedef __darwin_ino64_t __darwin_ino_t;
typedef __darwin_natural_t __darwin_mach_port_name_t;
typedef __darwin_mach_port_name_t __darwin_mach_port_t;
typedef __uint16_t __darwin_mode_t;
typedef __int64_t __darwin_off_t;
typedef __int32_t __darwin_pid_t;
typedef __uint32_t __darwin_sigset_t;
typedef __int32_t __darwin_suseconds_t;
typedef __uint32_t __darwin_uid_t;
typedef __uint32_t __darwin_useconds_t;
typedef unsigned char __darwin_uuid_t[16];
typedef char __darwin_uuid_string_t[37];
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_pthread/_pthread_types.h" 1 3 4
# 57 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_pthread/_pthread_types.h" 3 4
struct __darwin_pthread_handler_rec {
void (*__routine)(void *);
void *__arg;
struct __darwin_pthread_handler_rec *__next;
};
struct _opaque_pthread_attr_t {
long __sig;
char __opaque[56];
};
struct _opaque_pthread_cond_t {
long __sig;
char __opaque[40];
};
struct _opaque_pthread_condattr_t {
long __sig;
char __opaque[8];
};
struct _opaque_pthread_mutex_t {
long __sig;
char __opaque[56];
};
struct _opaque_pthread_mutexattr_t {
long __sig;
char __opaque[8];
};
struct _opaque_pthread_once_t {
long __sig;
char __opaque[8];
};
struct _opaque_pthread_rwlock_t {
long __sig;
char __opaque[192];
};
struct _opaque_pthread_rwlockattr_t {
long __sig;
char __opaque[16];
};
struct _opaque_pthread_t {
long __sig;
struct __darwin_pthread_handler_rec *__cleanup_stack;
char __opaque[8176];
};
typedef struct _opaque_pthread_attr_t __darwin_pthread_attr_t;
typedef struct _opaque_pthread_cond_t __darwin_pthread_cond_t;
typedef struct _opaque_pthread_condattr_t __darwin_pthread_condattr_t;
typedef unsigned long __darwin_pthread_key_t;
typedef struct _opaque_pthread_mutex_t __darwin_pthread_mutex_t;
typedef struct _opaque_pthread_mutexattr_t __darwin_pthread_mutexattr_t;
typedef struct _opaque_pthread_once_t __darwin_pthread_once_t;
typedef struct _opaque_pthread_rwlock_t __darwin_pthread_rwlock_t;
typedef struct _opaque_pthread_rwlockattr_t __darwin_pthread_rwlockattr_t;
typedef struct _opaque_pthread_t *__darwin_pthread_t;
# 81 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h" 2 3 4
# 28 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_types.h" 2 3 4
# 40 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_types.h" 3 4
typedef int __darwin_nl_item;
typedef int __darwin_wctrans_t;
typedef __uint32_t __darwin_wctype_t;
# 72 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h" 2 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_va_list.h" 1 3 4
# 31 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_va_list.h" 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/types.h" 1 3 4
# 37 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/types.h" 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/arm/types.h" 1 3 4
# 55 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/arm/types.h" 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_int8_t.h" 1 3 4
# 30 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_int8_t.h" 3 4
typedef signed char int8_t;
# 56 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/arm/types.h" 2 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_int16_t.h" 1 3 4
# 30 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_int16_t.h" 3 4
typedef short int16_t;
# 57 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/arm/types.h" 2 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_int32_t.h" 1 3 4
# 30 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_int32_t.h" 3 4
typedef int int32_t;
# 58 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/arm/types.h" 2 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_int64_t.h" 1 3 4
# 30 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_int64_t.h" 3 4
typedef long long int64_t;
# 59 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/arm/types.h" 2 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_u_int8_t.h" 1 3 4
# 30 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_u_int8_t.h" 3 4
typedef unsigned char u_int8_t;
# 61 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/arm/types.h" 2 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_u_int16_t.h" 1 3 4
# 30 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_u_int16_t.h" 3 4
typedef unsigned short u_int16_t;
# 62 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/arm/types.h" 2 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_u_int32_t.h" 1 3 4
# 30 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_u_int32_t.h" 3 4
typedef unsigned int u_int32_t;
# 63 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/arm/types.h" 2 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_u_int64_t.h" 1 3 4
# 30 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_u_int64_t.h" 3 4
typedef unsigned long long u_int64_t;
# 64 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/arm/types.h" 2 3 4
typedef int64_t register_t;
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_intptr_t.h" 1 3 4
# 30 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_intptr_t.h" 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/types.h" 1 3 4
# 31 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_intptr_t.h" 2 3 4
typedef __darwin_intptr_t intptr_t;
# 72 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/arm/types.h" 2 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uintptr_t.h" 1 3 4
# 34 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uintptr_t.h" 3 4
typedef unsigned long uintptr_t;
# 73 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/arm/types.h" 2 3 4
typedef u_int64_t user_addr_t;
typedef u_int64_t user_size_t;
typedef int64_t user_ssize_t;
typedef int64_t user_long_t;
typedef u_int64_t user_ulong_t;
typedef int64_t user_time_t;
typedef int64_t user_off_t;
# 104 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/arm/types.h" 3 4
typedef u_int64_t syscall_arg_t;
# 38 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/types.h" 2 3 4
# 32 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_va_list.h" 2 3 4
typedef __darwin_va_list va_list;
# 76 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h" 2 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_size_t.h" 1 3 4
# 31 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_size_t.h" 3 4
typedef __darwin_size_t size_t;
# 77 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h" 2 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_null.h" 1 3 4
# 78 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h" 2 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/stdio.h" 1 3 4
# 47 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/stdio.h" 3 4
int renameat(int, const char *, int, const char *) __attribute__((availability(macosx,introduced=10.10)));
int renamex_np(const char *, const char *, unsigned int) __attribute__((availability(macosx,introduced=10.12))) __attribute__((availability(ios,introduced=10.0))) __attribute__((availability(tvos,introduced=10.0))) __attribute__((availability(watchos,introduced=3.0)));
int renameatx_np(int, const char *, int, const char *, unsigned int) __attribute__((availability(macosx,introduced=10.12))) __attribute__((availability(ios,introduced=10.0))) __attribute__((availability(tvos,introduced=10.0))) __attribute__((availability(watchos,introduced=3.0)));
# 80 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h" 2 3 4
typedef __darwin_off_t fpos_t;
# 92 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h" 3 4
struct __sbuf {
unsigned char *_base;
int _size;
};
struct __sFILEX;
# 126 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h" 3 4
typedef struct __sFILE {
unsigned char *_p;
int _r;
int _w;
short _flags;
short _file;
struct __sbuf _bf;
int _lbfsize;
void *_cookie;
int (* _Nullable _close)(void *);
int (* _Nullable _read) (void *, char *, int);
fpos_t (* _Nullable _seek) (void *, fpos_t, int);
int (* _Nullable _write)(void *, const char *, int);
struct __sbuf _ub;
struct __sFILEX *_extra;
int _ur;
unsigned char _ubuf[3];
unsigned char _nbuf[1];
struct __sbuf _lb;
int _blksize;
fpos_t _offset;
} FILE;
# 65 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h" 2 3 4
extern FILE *__stdinp;
extern FILE *__stdoutp;
extern FILE *__stderrp;
# 142 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h" 3 4
void clearerr(FILE *);
int fclose(FILE *);
int feof(FILE *);
int ferror(FILE *);
int fflush(FILE *);
int fgetc(FILE *);
int fgetpos(FILE * restrict, fpos_t *);
char *fgets(char * restrict, int, FILE *);
FILE *fopen(const char * restrict __filename, const char * restrict __mode) __asm("_" "fopen" );
int fprintf(FILE * restrict, const char * restrict, ...) __attribute__((__format__ (__printf__, 2, 3)));
int fputc(int, FILE *);
int fputs(const char * restrict, FILE * restrict) __asm("_" "fputs" );
size_t fread(void * restrict __ptr, size_t __size, size_t __nitems, FILE * restrict __stream);
FILE *freopen(const char * restrict, const char * restrict,
FILE * restrict) __asm("_" "freopen" );
int fscanf(FILE * restrict, const char * restrict, ...) __attribute__((__format__ (__scanf__, 2, 3)));
int fseek(FILE *, long, int);
int fsetpos(FILE *, const fpos_t *);
long ftell(FILE *);
size_t fwrite(const void * restrict __ptr, size_t __size, size_t __nitems, FILE * restrict __stream) __asm("_" "fwrite" );
int getc(FILE *);
int getchar(void);
__attribute__((__deprecated__("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of gets(3), it is highly recommended that you use fgets(3) instead.")))
char *gets(char *);
void perror(const char *) __attribute__((__cold__));
int printf(const char * restrict, ...) __attribute__((__format__ (__printf__, 1, 2)));
int putc(int, FILE *);
int putchar(int);
int puts(const char *);
int remove(const char *);
int rename (const char *__old, const char *__new);
void rewind(FILE *);
int scanf(const char * restrict, ...) __attribute__((__format__ (__scanf__, 1, 2)));
void setbuf(FILE * restrict, char * restrict);
int setvbuf(FILE * restrict, char * restrict, int, size_t);
__attribute__((__availability__(swift, unavailable, message="Use snprintf instead.")))
__attribute__((__deprecated__("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")))
int sprintf(char * restrict, const char * restrict, ...) __attribute__((__format__ (__printf__, 2, 3)));
int sscanf(const char * restrict, const char * restrict, ...) __attribute__((__format__ (__scanf__, 2, 3)));
FILE *tmpfile(void);
__attribute__((__availability__(swift, unavailable, message="Use mkstemp(3) instead.")))
__attribute__((__deprecated__("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of tmpnam(3), it is highly recommended that you use mkstemp(3) instead.")))
char *tmpnam(char *);
int ungetc(int, FILE *);
int vfprintf(FILE * restrict, const char * restrict, va_list) __attribute__((__format__ (__printf__, 2, 0)));
int vprintf(const char * restrict, va_list) __attribute__((__format__ (__printf__, 1, 0)));
__attribute__((__availability__(swift, unavailable, message="Use vsnprintf instead.")))
__attribute__((__deprecated__("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use vsnprintf(3) instead.")))
int vsprintf(char * restrict, const char * restrict, va_list) __attribute__((__format__ (__printf__, 2, 0)));
# 222 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h" 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_ctermid.h" 1 3 4
# 31 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_ctermid.h" 3 4
char *ctermid(char *);
# 223 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h" 2 3 4
FILE *fdopen(int, const char *) __asm("_" "fdopen" );
int fileno(FILE *);
# 240 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h" 3 4
int pclose(FILE *) __attribute__((__availability__(swift, unavailable, message="Use posix_spawn APIs or NSTask instead. (On iOS, process spawning is unavailable.)")));
FILE *popen(const char *, const char *) __asm("_" "popen" ) __attribute__((__availability__(swift, unavailable, message="Use posix_spawn APIs or NSTask instead. (On iOS, process spawning is unavailable.)")));
# 259 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h" 3 4
int __srget(FILE *);
int __svfscanf(FILE *, const char *, va_list) __attribute__((__format__ (__scanf__, 2, 0)));
int __swbuf(int, FILE *);
# 270 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h" 3 4
inline __attribute__ ((__always_inline__)) int __sputc(int _c, FILE *_p) {
if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
return (*_p->_p++ = _c);
else
return (__swbuf(_c, _p));
}
# 296 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h" 3 4
void flockfile(FILE *);
int ftrylockfile(FILE *);
void funlockfile(FILE *);
int getc_unlocked(FILE *);
int getchar_unlocked(void);
int putc_unlocked(int, FILE *);
int putchar_unlocked(int);
int getw(FILE *);
int putw(int, FILE *);
__attribute__((__availability__(swift, unavailable, message="Use mkstemp(3) instead.")))
__attribute__((__deprecated__("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of tempnam(3), it is highly recommended that you use mkstemp(3) instead.")))
char *tempnam(const char *__dir, const char *__prefix) __asm("_" "tempnam" );
# 334 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h" 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_off_t.h" 1 3 4
# 31 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_off_t.h" 3 4
typedef __darwin_off_t off_t;
# 335 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h" 2 3 4
int fseeko(FILE * __stream, off_t __offset, int __whence);
off_t ftello(FILE * __stream);
int snprintf(char * restrict __str, size_t __size, const char * restrict __format, ...) __attribute__((__format__ (__printf__, 3, 4)));
int vfscanf(FILE * restrict __stream, const char * restrict __format, va_list) __attribute__((__format__ (__scanf__, 2, 0)));
int vscanf(const char * restrict __format, va_list) __attribute__((__format__ (__scanf__, 1, 0)));
int vsnprintf(char * restrict __str, size_t __size, const char * restrict __format, va_list) __attribute__((__format__ (__printf__, 3, 0)));
int vsscanf(const char * restrict __str, const char * restrict __format, va_list) __attribute__((__format__ (__scanf__, 2, 0)));
# 359 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h" 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_ssize_t.h" 1 3 4
# 31 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_ssize_t.h" 3 4
typedef __darwin_ssize_t ssize_t;
# 360 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h" 2 3 4
int dprintf(int, const char * restrict, ...) __attribute__((__format__ (__printf__, 2, 3))) __attribute__((availability(macosx,introduced=10.7)));
int vdprintf(int, const char * restrict, va_list) __attribute__((__format__ (__printf__, 2, 0))) __attribute__((availability(macosx,introduced=10.7)));
ssize_t getdelim(char ** restrict __linep, size_t * restrict __linecapp, int __delimiter, FILE * restrict __stream) __attribute__((availability(macosx,introduced=10.7)));
ssize_t getline(char ** restrict __linep, size_t * restrict __linecapp, FILE * restrict __stream) __attribute__((availability(macosx,introduced=10.7)));
FILE *fmemopen(void * restrict __buf, size_t __size, const char * restrict __mode) __attribute__((availability(macos,introduced=10.13))) __attribute__((availability(ios,introduced=11.0))) __attribute__((availability(tvos,introduced=11.0))) __attribute__((availability(watchos,introduced=4.0)));
FILE *open_memstream(char **__bufp, size_t *__sizep) __attribute__((availability(macos,introduced=10.13))) __attribute__((availability(ios,introduced=11.0))) __attribute__((availability(tvos,introduced=11.0))) __attribute__((availability(watchos,introduced=4.0)));
# 377 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h" 3 4
extern const int sys_nerr;
extern const char *const sys_errlist[];
int asprintf(char ** restrict, const char * restrict, ...) __attribute__((__format__ (__printf__, 2, 3)));
char *ctermid_r(char *);
char *fgetln(FILE *, size_t *);
const char *fmtcheck(const char *, const char *) __attribute__((format_arg(2)));
int fpurge(FILE *);
void setbuffer(FILE *, char *, int);
int setlinebuf(FILE *);
int vasprintf(char ** restrict, const char * restrict, va_list) __attribute__((__format__ (__printf__, 2, 0)));
FILE *funopen(const void *,
int (* _Nullable)(void *, char *, int),
int (* _Nullable)(void *, const char *, int),
fpos_t (* _Nullable)(void *, fpos_t, int),
int (* _Nullable)(void *));
# 416 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h" 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h" 1 3 4
# 31 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h" 3 4
# 1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_common.h" 1 3 4
# 32 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h" 2 3 4
# 42 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h" 3 4
extern int __sprintf_chk (char * restrict, int, size_t,
const char * restrict, ...);
# 52 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h" 3 4
extern int __snprintf_chk (char * restrict, size_t, int, size_t,
const char * restrict, ...);
extern int __vsprintf_chk (char * restrict, int, size_t,
const char * restrict, va_list);
extern int __vsnprintf_chk (char * restrict, size_t, int, size_t,
const char * restrict, va_list);
# 417 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h" 2 3 4
# 1012 "vik2.c" 2
int main()
@@ -1544,12 +995,12 @@ int main()
#define _M
#undef i
{
#include "vik2_1.c"
#include __FILE__
+
1
)
;
#include "vik2_1.c"
#include __FILE__
}
#endif
#endif