NaNoGenMo / 2021

National Novel Generation Month, 2021 edition.
45 stars 8 forks source link

novel generated from system headers #74

Open debamitro opened 2 years ago

debamitro commented 2 years ago

I have been working on a Rust library for only parsing structs from C headers. I want to generate a novel by scanning the headers on my MacBook.

debamitro commented 2 years ago

Here is my code so far. And here is a novel generated from the output of the following command on my MacBook Pro:

cargo run -- `xcrun --show-sdk-path`/usr/include

I am still working on it.

debamitro commented 2 years ago

I am done! I guess I could try to add some more drama, but I don't have any more ideas tonight. The generated novel is at the same link and so is the source code. I think there are ~58000 words.

hugovk commented 2 years ago

😆

Preview:

Introduction

This is the story of a brave knight who ventured into /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include in an attempt to conquer all the C structs he could find there

Chapter 1

One fine day our hero ventured into /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pcap/nflog.h

He conquered the puny struct nflog_hdr_t which had a uint8_t called nflog_family, and a uint8_t called nflog_version, and a uint16_t called nflog_rid.

He conquered the puny struct nflog_tlv_t which had a uint16_t called tlv_length, and a uint16_t called tlv_type.

He conquered the puny struct nflog_packet_hdr_t which had a uint16_t called hw_protocol, and a uint8_t called hook, and a uint8_t called pad.

He conquered the puny struct nflog_timestamp_t which had a uint64_t called sec, and a uint64_t called usec.