Skip to content

default-writer/c

Repository files navigation

c project description

status

C/C++ CI Coverage Status

description

  • C memory management
static u64 read_data(u64 list_ptr, const char* prompt) {
    u64 data_ptr = 0;
    u64 ui_mode_ptr = string->load("UI_MODE");
    u64 mode_ptr = string->load("--ui");
    u64 value_ptr = os->getenv(ui_mode_ptr);
    if (ui_mode_ptr != 0 && string->strcmp(value_ptr, mode_ptr) != 0) {
        data_ptr = read_input(prompt);
    } else {
        printf(">%s:\n", prompt);
        data_ptr = list->pop(list_ptr);
        if (data_ptr == 0) {
            printf("\n");
        }
    }
    return data_ptr;
}
int main(void) {
    pointer->init(8); // initializes virtual memory manager with chunk size of 8

    // some work with standard classes: os, string, data, etc.

    pointer->gc();      // releases all resources added to GC
    pointer->destroy(); // releases virtual memory manager
    return 0;
}

inspiration

vision

  • managed (C programming language model)
  • safe
  • friendly
  • extensibe
  • simple
  • tested (100% code coverage)

brief

  • VM managed types / C API

  • user defined types / extensibility system

    1. C API
    2. memory management
    3. garbage collection
  • development environment:

    1. WSL2/devcontainers
    2. Ubuntu 22.04.3 LTS
  • C API generated docs (doxygen):

    1. docs

logo

media links

music credits

updates

  • 2023

    1. added v1 core Virtual Machine (vm1) with types:

    2. added support including:

      1. file IO
      2. string manupulation methods
      3. search

features

  • List<T> implementations
  • code coverage
  • coverage hot-reload
  • memory allocation playground
  • automatic garbage collection implementation (GC)
  • GTK GUI app demo ready to run on containerized environment

readme

repo is ready to run on containers, WSL, remote hosts.

remote development

  • installation from git repo (manually)

Installs sources from git repo

eval `ssh-agent -s`
git config --global user.name "$USER_NAME"
git config --global user.email "$USER_EMAIL"
git clone https://github.com/default-writer/c.git

clang

docs

containers

manual installation (minimal install)

  • init

Sets up primary/optional tools and git hooks

./bin/init.sh --setup
./bin/init.sh --optional
./bin/init.sh --hooks
  • rexo
./bin/utils/install.sh --submodule-rexo

GTK GUI app development

setup

  • add/update Visual Studio Code environment settings:
"environment": [
  {
    "name": "UI_MODE",
    "value": "--ui"
  }
]
  • run command line build
cd gtk
./bin/build.sh --target gtk-experiment1 --clean
UI_MODE=--ui ./build/gtk-experiment1

shell scripting documentation

all shell scripts

  • are self-documented
  • placed in ./bin folders
  • detects execution as user or root (sudo)
  • runs with required and optional command-line parameters

history

local repos

Use CLI or git.

support C project

sponsorship

support this project become a sponsor

img

2023

  • added support for classes / inheritance (oberon exaple)
  • added GC implementation
  • added several list implementations

2022

  • playing around with visibility in class declarations

documentation

initialization

- ./bin/init.sh --setup
- ./bin/init.sh --hooks
- ./bin/init.sh --optional

doxygen generated documentation

C API PDF(refman.pdf)

referential documentation

resources

links

requirements

SAST Tools

PVS-Studio - static analyzer for C, C++, C#, and Java code.