An open API service indexing awesome lists of open source software.

https://github.com/msio808/rescal

A BASIC CLI RESISTOR COLOR CODE INTERPRETER WRITTEN IN C
https://github.com/msio808/rescal

c color-codes resistance resistance-calculator resistor resistor-calculator resistor-color-codes

Last synced: 29 days ago
JSON representation

A BASIC CLI RESISTOR COLOR CODE INTERPRETER WRITTEN IN C

Awesome Lists containing this project

README

        

RESISTOR COLOR CODE CALCULATOR

Image from te.com

# ๐Ÿš€ Getting Started

### Requirements


โ–บ gcc make cmake valgrind

## โš™๏ธ Installation

### Clone the quizbit repository:

```sh
git clone https://github.com/msio808/rescal.git
```

### Change to the project directory:

```sh
cd rescal/config/
```

### ๐Ÿค– Running the project

```sh
./build.sh --run
```

### ๐Ÿงช Debug with GDB
```sh
./build.sh --debug
```

### ๐Ÿงช Debug with Valgrind
```sh
./build --memcheck
```

### ๐Ÿ—‘ Clean generated build files
```sh
./build.sh --clean
```

# ๐Ÿ“‚ Folder Structure

```
.
โ”œโ”€โ”€ config
โ”‚ โ”œโ”€โ”€ build.sh
โ”‚ โ””โ”€โ”€ CMakeLists.txt
โ”œโ”€โ”€ docs
โ”‚ โ””โ”€โ”€ README.md
โ”œโ”€โ”€ include
โ”‚ โ”œโ”€โ”€ helpers.h
โ”‚ โ””โ”€โ”€ src.h
โ”œโ”€โ”€ LICENSE
โ””โ”€โ”€ src
โ”œโ”€โ”€ helpers
โ”‚ โ”œโ”€โ”€ helpers.c
โ”‚ โ””โ”€โ”€ src.c
โ””โ”€โ”€ main.c
```

---

# โš  If you want to run the program on windows

- Comment out the ```strings.h``` from the [```../include/src.h```](../include/src.h) file.
- Write your own custom ```strcasecmp()``` function.
- Unlike the ```strcmp()``` the ```strcasecmp()``` function is case-insensitive.

The code below might help

```c++
#include
#include

//? Custom implementation of strcasecmp
int strcasecmp(const char *str1, const char *str2) {
while (*str1 && *str2) {
const char ch1 = tolower((uint8_t)*str1);
const char ch2 = tolower((uint8_t)*str2);
if (ch1 != ch2) {
return ch1 - ch2;
}
str1++;
str2++;
}

return tolower((uint8_t)*str1) - tolower((uint8_t)*str2);
}
```