Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

default-writer/c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

2,592 Commits

Repository files navigation

c project

description

Memory management and pointer management library in C

  • cross-platfrom C library designed to create a safe C codebase.
  • implementation of memory management/type system/GC in C

features

  • memory managemens
  • GC
  • type system
  • pointer-free ABI

dashboards

status

static analysis

history

  • 2025-09-10: added support for codacy; added codacy tokens
  • 2025-05-01: added support for MSVC
  • 2025-02-28: added mocks for standart functions calloc/free to simulate out-ouf-memory function call flow

examples

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

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

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

commands

./bin/cleanup.sh --clean
./bin/init.sh --clangd
./bin/init.sh --init --setup
./bin/init.sh --env
./bin/coverageall.sh --all --clean
./bin/target.sh --target=main-tests-vm1 --release
./bin/cmake.sh --target=main-tests-vm1 --verbose --tty
./bin/lib.sh --c-sys
./bin/lib.sh --c-vm

build commands

./bin/tmp.sh
./bin/cmake.sh --target=main-tests-vm1 --verbose --tty --clean
./bin/cmake.sh --target=main-tests-vm1 --verbose --tty --clean --release
./bin/cmake.sh --target=main-tests-vm1 --verbose --tty --clean --gc
./bin/cmake.sh --target=main-tests-vm1 --verbose --tty --clean --gc --release
./bin/coverageall.sh --all --clean

resources

youtube

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 18.04.6 / 22.04.3 / 24/.04.2 LTS
    3. MSVC
  • C API generated docs (doxygen):

    1. docs

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

info

  • List 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

log

local repos

Use CLI or git.

support C project

sponsorship

support this project become a sponsor

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

FAQ

  • Q: Ninja generator not known (windows build)

  • A: Download and Set Up Ninja Ninja for Windows

    1. Download the latest version from the official GitHub releases page
    2. Look for the ninja-win.zip file under the "Assets" section of the latest release.
    3. Extract the ninja.exe file from the zip archive.
    4. Create a new directory (e.g., C:\Tools\Ninja) and add it to your PATH.
    5. Place ninja.exe in a directory that is included in your system's PATH.

doxygen generated documentation

C API PDF(refman.pdf)

referential documentation

resources

links

requirements

code

C standart

guidelines

  • C guidelines in development of critical code (refers to Secure Coding in C and C 2nd Edition, Robert C. Seacord).
  • NASA guidlines (refers to The Power of Ten - Rules for Developing Safety Critical Code, Gerard J. Holzmann, NASA/JPL Laboratory for Reliable Software, Pasadena, CA 91109)

SAST Tools

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

funding

  • etherium: 0x035ebC06C7e667200695Cf8FC3686EEBBBD5A452

About

Visual Studio Code C/C++ development

Topics

Resources

Readme

License

BSD-3-Clause license

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

Contributors