RC1
This commit is contained in:
parent
db00076108
commit
21e3ad6ce4
2
LICENSE
2
LICENSE
@ -58,7 +58,7 @@ APPENDIX: How to apply the Apache License to your work.
|
|||||||
|
|
||||||
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
||||||
|
|
||||||
Copyright 2024 Jackrabbit-Labs-LLC
|
Copyright 2024 Jackrabbit-Founders-LLC
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|||||||
16
Makefile
16
Makefile
@ -13,16 +13,16 @@
|
|||||||
# ******************************************************************************
|
# ******************************************************************************
|
||||||
|
|
||||||
CC=gcc
|
CC=gcc
|
||||||
CFLAGS= -g3 -O0 -Wall -Wextra
|
CFLAGS?= -g3 -O0 -Wall -Wextra
|
||||||
MACROS=
|
MACROS?=
|
||||||
INCLUDE_DIR=/usr/local/include
|
INCLUDE_DIR?=/usr/local/include
|
||||||
LIB_DIR=/usr/local/lib
|
LIB_DIR?=/usr/local/lib
|
||||||
INCLUDE_PATH=-I $(INCLUDE_DIR) -I /usr/include/glib-2.0 -I /usr/lib/`uname -m`-linux-gnu/glib-2.0/include/
|
INCLUDE_PATH=-I $(INCLUDE_DIR) -I /usr/include/glib-2.0 -I /usr/lib/`uname -m`-linux-gnu/glib-2.0/include/
|
||||||
LIB_PATH=-L $(LIB_DIR)
|
LIB_PATH=-L $(LIB_DIR)
|
||||||
LIBS=-l yaml -l glib-2.0
|
LIBS=-l yaml -l glib-2.0
|
||||||
TARGET=yamlloader
|
TARGET=yamlloader
|
||||||
|
|
||||||
all: testbench lib$(TARGET).a
|
all: lib$(TARGET).a
|
||||||
|
|
||||||
testbench: testbench.c main.o
|
testbench: testbench.c main.o
|
||||||
$(CC) $^ $(CFLAGS) $(MACROS) $(INCLUDE_PATH) $(LIB_PATH) $(LIBS) -o $@
|
$(CC) $^ $(CFLAGS) $(MACROS) $(INCLUDE_PATH) $(LIB_PATH) $(LIBS) -o $@
|
||||||
@ -43,7 +43,11 @@ install: lib$(TARGET).a
|
|||||||
sudo cp lib$(TARGET).a $(LIB_DIR)/
|
sudo cp lib$(TARGET).a $(LIB_DIR)/
|
||||||
sudo cp main.h $(INCLUDE_DIR)/$(TARGET).h
|
sudo cp main.h $(INCLUDE_DIR)/$(TARGET).h
|
||||||
|
|
||||||
.PHONY: all clean doc install
|
uninstall:
|
||||||
|
sudo rm $(LIB_DIR)/lib$(TARGET).a
|
||||||
|
sudo rm $(INCLUDE_DIR)/$(TARGET).h
|
||||||
|
|
||||||
|
.PHONY: all clean doc install uninstall
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
# $^ Will expand to be all the sensitivity list
|
# $^ Will expand to be all the sensitivity list
|
||||||
|
|||||||
40
README.md
40
README.md
@ -1,2 +1,40 @@
|
|||||||
# yaml_loader-release
|
# Overview
|
||||||
|
|
||||||
|
This is a C library that provides a parsing facility to load a config file in
|
||||||
|
YAML format into a GLib Hash Table.
|
||||||
|
|
||||||
|
# Supported Operating System Versions
|
||||||
|
|
||||||
|
- Ubuntu 23.10
|
||||||
|
- Fedora 38, 39
|
||||||
|
|
||||||
|
# Building
|
||||||
|
|
||||||
|
1. Install OS libraries
|
||||||
|
|
||||||
|
Install the following build packages to compile the software on the following
|
||||||
|
operating systems.
|
||||||
|
|
||||||
|
**Ubuntu:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
apt install build-essential libglib2.0-dev libyaml-dev
|
||||||
|
```
|
||||||
|
|
||||||
|
**Fedora:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Build Dependencies
|
||||||
|
|
||||||
|
This library does not depend upon any other non-os provided library.
|
||||||
|
|
||||||
|
3. Build
|
||||||
|
|
||||||
|
To build, simply run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
9
main.c
9
main.c
@ -238,12 +238,13 @@ int yl_print(GHashTable *ht)
|
|||||||
/**
|
/**
|
||||||
* Print an individual entry in the GHashTable
|
* Print an individual entry in the GHashTable
|
||||||
*/
|
*/
|
||||||
GHFunc _yl_print_entry(gpointer key, gpointer value, gpointer user_data)
|
void _yl_print_entry(gpointer key, gpointer value, gpointer user_data)
|
||||||
{
|
{
|
||||||
int i, indent;
|
int i;
|
||||||
|
__u64 indent;
|
||||||
yl_obj_t *ylo;
|
yl_obj_t *ylo;
|
||||||
|
|
||||||
indent = (int) user_data;
|
indent = (__u64) user_data;
|
||||||
ylo = (yl_obj_t*) value;
|
ylo = (yl_obj_t*) value;
|
||||||
|
|
||||||
// Print the indent spaces
|
// Print the indent spaces
|
||||||
@ -255,7 +256,7 @@ GHFunc _yl_print_entry(gpointer key, gpointer value, gpointer user_data)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("%s:\n", (char*) key);
|
printf("%s:\n", (char*) key);
|
||||||
g_hash_table_foreach(ylo->ht, _yl_print_entry, indent+2);
|
g_hash_table_foreach(ylo->ht, _yl_print_entry, (void*)(indent+2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
main.h
2
main.h
@ -39,6 +39,6 @@ typedef struct yl_obj
|
|||||||
GHashTable *yl_load(char *filename);
|
GHashTable *yl_load(char *filename);
|
||||||
int yl_free(GHashTable *ht);
|
int yl_free(GHashTable *ht);
|
||||||
int yl_print(GHashTable *ht);
|
int yl_print(GHashTable *ht);
|
||||||
GHFunc _yl_print_entry(gpointer key, gpointer value, gpointer user_data);
|
void _yl_print_entry(gpointer key, gpointer value, gpointer user_data);
|
||||||
|
|
||||||
#endif //ifndef _YAMLLOADER_H
|
#endif //ifndef _YAMLLOADER_H
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include <glib-2.0/glib.h>
|
#include <glib-2.0/glib.h>
|
||||||
|
|
||||||
#include "yamlloader.h"
|
#include "main.h"
|
||||||
|
|
||||||
/* MACROS ====================================================================*/
|
/* MACROS ====================================================================*/
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user