A new city of code on a cosmopolitan foundation.

Related tags

Logging neopolitan
Overview
Neopolitan C
“A new city of code on a cosmopolitan foundation.”

<https://aquefir.co/neopolitan>
<https://github.com/aquefir/neopolitan>

Created by Alexander Nicholi
Copyright © 2019-2021 Aquefir
Released under BSD-2-Clause.

§1. WHAT IS THIS?
------------------

Some time in 2019, I began work on a scratch-built libc surrogate that, for
lack of a better name, I called “unilib”. It was put under the Aquefir name,
and I took great care of its structure and quality. unilib was similar in
purpose to GLib, but with better attention paid to handling very old
platforms, chiefly the IBM PC and the Nintendo Game Boy Advance. It is also a
strictly ANSI C library, adhering to the standard as laid out by the ANSI
committee in 1989. Call me old-fashioned, but I love the language as it
originally was. Most of the “rough edges” I find quite beneficial from a
hygiene standpoint. Later features have shown to be superfluous at best, one
way or another.

Around the beginning of 2021, I discovered Justine Tunney’s work on her APE
format and libc implementation supporting it, and I recognised it for the
incredible research work on ABIs that it is. It has been awkward for me to
apply, given that it is strongly tied to the x86 ISA and I have actively cared
for targeting ARM. Despite that, I knew that the one big feature API that
Cosmopolitan was lacking was a good way to handle graphics. Neopolitan C is a
step on the path to making that happen.

For years I have had in pre-planning a graphics innovation called OAM, and
have not created it yet as I need to work out what exactly it depends on
first. Cosmopolitan C provides a wonderful generalisation of all the great x86
operating systems, and this generalisation is needed to avoid spending so much
more time targeting those as separate platforms. However, Cosmopolitan
provides the well-established C libraries most of these platforms can share -
it does not try to give any sort of new interface with better design. This is
where unilib comes in to play. Neopolitan is simply unilib-on-cosmopolitan.
With that in hand, the complexities of OAM can be worked through much more
quickly and effectively. Yeah, I think the library is really that much better
- there’s hardly a point otherwise! 

Neopolitan is written in ANSI C, and always will be. The project uses the
Slick Makefiles for tooling out the development process, and SLI for
documentation.

§1.1. WHAT IS UNILIB?
----------------------

Unilib was one of the most heavily developed projects under the Aquefir
namesake. Its purpose was simple: provide primitive support functionality
for programs on a variety of platforms. These features are similar in nature
to the standard C library, and unilib does work without libc where it is
unavailable. After much development, Cosmopolitan libc was discovered, and
unilib was migrated to target that platform with its APE format exclusively.
This is what is now known as Neopolitan.

§2. WHAT’S INSIDE THE BOX
--------------------------

Neopolitan provides shorthands for all kinds of primitive data types. These
are a good deal cleaner and quicker to type than those of <stdint.h>:

neopolitan:
	u32, s16, u8, u64, ...

stdint:
	uint32_t, int16_t, uint8_t, uint64_t, ...

There is also another shorthand called ptri (pronounced like ‘petri’). It is
an integer the same size as a pointer, and is used in place of size_t and the
like. There are also shorthands for exact-size floating point primitives.

Neopolitan provides math primitive structs for basic geometry in the 2D and 3D
contexts. It also includes structs for ranges (signed) and bounds (unsigned).
Additionally, there are also primitives for ‘vector types’; these use SIMD
intrinsics provided by the compiler where available, and transparently fall
back to plain array semantics otherwise.

Checked math macros are available to ensure against integer overflow. There
are also macros for endianness conversion operations. Neopolitan also provides
a portable uni_die() function that aborts the program, which is ideal for
dealing with programmer errors.

UTF-8 validation, conversion, and inspection routines are also available.
There are also high-level structs and function collections for
automatically-memory-managed strings and generic arrays.

Lastly, there are cross-platform wrappers for standard I/O and heap usage,
which either wrap or implement logging and malloc where necessary.

§3. FOOTNOTES
--------------

Neopolitan is released under the BSD-2-Clause licence. See the COPYING file
for full terms.

Neopolitan adheres to ADP 1 for its repository layout, and ADP 2 for its
documentation.

§4. REFERENCES & ADDITIONAL READING
------------------------------------

ISO/IEC 9899:1990. Programming Languages – C.
	<https://www.iso.org/standard/17782.html>

Nicholi, Alexander. Slick Makefiles.
	<https://github.com/adp4>

Nicholi, Alexander. Project repository filesystem schema.
	<https://aquefir.co/adp1>

Nicholi, Alexander. Slick documentation format.
	<https://aquefir.co/adp2>

Tunney, Justine. Cosmopolitan libc.
	<https://justine.lol/cosmopolitan/index.html>

Tunney, Justine. Actually Portable Executable.
	<https://justine.lol/ape.html>
You might also like...
A web application which finds the shortest or quickest path from two points in the city of Rio de Janeiro.

A web application which finds the shortest or quickest path from two points in the city of Rio de Janeiro. Obviously not Waze. (final project for EDA @ EMAp, 2021)

GTA III, Vice City
GTA III, Vice City

Intro In this repository you'll find the fully reversed source code for GTA III (master branch) and GTA VC (miami branch). It has been tested and work

Cytopia is a free, open source retro pixel-art city building game with a big focus on mods.
Cytopia is a free, open source retro pixel-art city building game with a big focus on mods.

Cytopia is a free, open source retro pixel-art city building game with a big focus on mods. It utilizes a custom isometric rendering engine based on SDL2.

Brand new engine with new and QoL features. Grafex is Psych engine with some additions and Better graphics

Friday Night Funkin' - Graphex Engine Credits: Grafex Mod aka Psych Graphic Rework: Xale - Lead Coding, Artist PurpleSnake - Second Coder Psych Engine

New lateral movement technique by abusing Windows Perception Simulation Service to achieve DLL hijacking code execution.
New lateral movement technique by abusing Windows Perception Simulation Service to achieve DLL hijacking code execution.

BOF - Lateral movement technique by abusing Windows Perception Simulation Service to achieve DLL hijacking ServiceMove is a POC code for an interestin

A simple command line application in order to create new Code workspaces.

mkcws Summary A simple command line application in order to create new Code workspaces. License This project's license is GPL 2. The whole license tex

Lambda code is a new high level compiled statically typed programming language

Lambda code is a new high level compiled statically typed programming language. Written in python, C, C++. Its syntax is far more easier then other middle level compiled languages.

New generation entropy codecs : Finite State Entropy and Huff0

New Generation Entropy coders This library proposes two high speed entropy coders : Huff0, a Huffman codec designed for modern CPU, featuring OoO (Out

STL compatible C++ memory allocator library using a new RawAllocator concept that is similar to an Allocator but easier to use and write.

memory The C++ STL allocator model has various flaws. For example, they are fixed to a certain type, because they are almost necessarily required to b

Completely new interface to TinyXML

TiCPP is short for the official name TinyXML++. It is a completely new interface to TinyXML that uses MANY of the C++ strengths. Templates, exceptions

:fish_cake: A new take on polymorphism in C++
:fish_cake: A new take on polymorphism in C++

DynaMix (Dynamic Mixins) is a new take on polymorphism. It lets the user compose and modify polymorphic objects at run time in C++. The library is a m

New generation entropy codecs : Finite State Entropy and Huff0

New Generation Entropy coders This library proposes two high speed entropy coders : Huff0, a Huffman codec designed for modern CPU, featuring OoO (Out

:lock: Don't use this repo, use the new monorepo instead:

trezor-crypto Heavily optimized cryptography algorithms for embedded devices. These include: AES/Rijndael encryption/decryption Big Number (256 bit) A

Rubicon - a New Custom Encryption Algorithm/Tool

Rubicon - a New Custom Encryption Algorithm/Tool Disclaimer DO NOT use this project for purposes other than legitimate red teaming/pentesting jobs

Simple Directmedia Layer, 1.2 branch ... ***DEPRECATED***, please use https://github.com/libsdl-org/SDL for new projects!

DEPRECATED The 1.2 branch of SDL is deprecated. While we occasionally collect fixes in revision control, there has not been a formal release since 201

DOSBox Pure is a new fork of DOSBox built for RetroArch/Libretro aiming for simplicity and ease of use.
DOSBox Pure is a new fork of DOSBox built for RetroArch/Libretro aiming for simplicity and ease of use.

DOSBox Pure is a fork of DOSBox, an emulator for DOS games, built for RetroArch/Libretro aiming for simplicity and ease of use.

The new Windows Terminal and the original Windows console host, all in the same place!

The new Windows Terminal and the original Windows console host, all in the same place!

Monster Mash: New Sketch-Based Modeling and Animation Tool

Monster Mash is a new sketch-based modeling and animation tool that allows you to quickly sketch a character, inflate it into 3D, and promptly animate it. You can perform all interactions in the sketching plane. No 3D manipulation is required.

Comments
  • Consider deprecating char{16,32}

    Consider deprecating char{16,32}

    I am not sure whether these should be deprecated. char16 is unused AFAIK, while char32 is used for UCS-4/UTF-32 codepoints in the utf8.h submodule of uni_str. A u32 would be more appropriate, but this should be discussed. Also see hinterlib#9.

    opened by nicholatian 0
  • 80-bit float support in the type module

    80-bit float support in the type module

    The new notation journaled previously mentions 80-bit float type support for Neopolitan only. Since the rest is at parity with Hinterlib, this is all that is still needed to be implemented.

    feature 
    opened by nicholatian 0
  • 2D display buffer abstraction

    2D display buffer abstraction

    Aquefir’s OAMAS project will require a 2D canvas. Such a feature is general enough IMO to warrant inclusion into Neopolitan, especially considering how strange supporting this with an APE will be.

    Generally, this is the outline of how it will work:

    • On *DOS, this will abstract (S)VGA, possibly with “Mode X” support;
    • On Linux without X11, this will abstract the framebuffer itself (/dev/fb*);
    • On Linux with X11, this will talk to X11 over-the-wire;
    • On *BSD and other Unices with X11, this will talk to X11 over-the-wire
    • On macOS, this will talk to X11 over-the-wire via XQuartz; and
    • On Windows, this will use the Windows API canvas.

    *BSD and other Unices may have second-class framebuffer support where feasible if X11 is unavailable. This must be explored and decided on a per-kernel basis.

    From here, I will be researching the X11 wire protocol and writing a driver for it for the display buffer to use. It will provide a 2D canvas of arbitrary size with up to 24-bit RGB colour support. Colours may be less, but Mode X ensures it is possible to have 24-bit RGB even on *DOS. Mode X support will be opportunistic and with regard to the (S)VGA standards, whether de jure or de facto.

    macOS is the thorniest of the systems to support, but the good news is Apple forked off X11 support some time ago and graciously handed it to the open source community, meaning it is an easy package-install away for most users. No verdict from us on Apple M1 support for now.

    documentation feature help wanted 
    opened by nicholatian 0
Releases(1.4.2)
Owner
Aquefir
Massively multipurpose software.
Aquefir
My OI Code for OI learners.

MyOI My OI Career Some of My Code... 包括CLion工程,Visual Studio工程,和一些直接的cpp文件。 很容易区分,可以自行用对应的软件打开查看。 大部分是我做过的题目,可以当做题解来看。 但是注释比较少,可能并不是那么容易看懂…… 文件名即为题号,可

芊枫 121 Nov 22, 2022
Sample app code for LPR deployment on DeepStream

Sample For Car License Recognization Description Performance Prerequisition Download Build and Run Notice Description This sample is to show how to us

NVIDIA AI IOT 139 Nov 11, 2022
zeroEngine Logger Code-Base

zero-logger zeroEngine Logger - Part of zeroSDK Features basic log-levels lightweight unicode support by native wchar_t multibyte chars support platfo

Denis 1 Dec 11, 2021
My version of psxfunkin with new changes like new story mode, new options,etc

PSXFunkin Friday Night Funkin' on the PSX LOL Compilation Refer to COMPILE.md here Characters Igor Ver added new characters Like XmasGF,Monster and mu

IgorSou3000 4 Jun 8, 2022
A set of very empty header files that can be used when building apps with Cosmopolitan

cosmo-include A set of very empty header files that can be used when building apps with Cosmopolitan Why? When you build an application with Cosmopoli

null 24 Oct 2, 2022
The foundation for many embedded graphical display implementations

Ubuntu Frame Description The foundation for many embedded graphical display implementations. ubuntu-frame is a simple fullscreen shell (based on Wayla

null 120 Nov 11, 2022
OpenFOAM Foundation repository for OpenFOAM version 9

README for OpenFOAM-9 # About OpenFOAM OpenFOAM is a free, open source computational fluid dynamics (CFD) software package released by the OpenFOAM Fo

Official OpenFOAM Repository 61 Nov 10, 2022
This library provides a cross-platform image loading library in C11 for projects based on our foundation library

Image Library - Public Domain This library provides a cross-platform image loading library in C11 for projects based on our foundation library.

Mattias Jansson 1 Jan 29, 2022
Isometric city building game

HopCity Isometric defo not sim city building game Screenshots Thanks [https://github.com/MichaelKirsch] -> Profiler Joco223 -> Stone wall textures Bui

Matthew Hopson 17 Sep 3, 2022
Battle City Game Clone

BattleCity Battle City Game Clone 4 Level 3 Level 2 Level 1 Level Menu You can also add your own level as txt-extention file: -in first row you need t

Sergey Semionkin 2 Feb 19, 2022