Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

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
/cansidPublic

A minimal ANSI escape sequence parser, written in C.

License

NotificationsYou must be signed in to change notification settings

64/cansid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repository contains a simple C ANSI escape sequence parser. It is intended for use in my own hobby operating system, but can be adapted for different uses.

Usage

First, call the functioncansid_init(void) which returns astruct cansid_state:

structcansid_statestate=cansid_init();

Then, whenever you receive a char that you want to run through the parser, hand it tocansid_process(struct cansid_state *, char). This returns astruct color_char.

charc='x';// Whatever you want to parsestructcolor_charch=cansid_process(&state,c);

The returned struct indicates how you should print the character. It contains two fields:style, andascii. Thestyle field is arranged inthis format. Theascii field is simply the character which should be printed. Ifascii is the NUL byte (i.e0x00 or\0), then the character should not be outputted to the screen (and therefore thestyle field should be ignored too).

Building

To add CANSID to your repository, simply place the filescansid.c andcansid.h in the appropriate locations. There are no dependencies and can even be compiled in a freestanding environment.

Tests

Running tests can be done withmake test.

Contributing

Feel free to open an issue or a pull request if you would like to contribute or ask a question.

About

A minimal ANSI escape sequence parser, written in C.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp