3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
*.o
|
||||||
|
*.d
|
||||||
|
/quip
|
||||||
28
LICENSE
Normal file
28
LICENSE
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
BSD 3-Clause License
|
||||||
|
|
||||||
|
Copyright (c) 2026, Ian Moffett
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
21
Makefile
Normal file
21
Makefile
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2026, Mirocom Laboratories
|
||||||
|
# Provided under the BSD-3 clause
|
||||||
|
#
|
||||||
|
|
||||||
|
CC = clang
|
||||||
|
CFLAGS = -Wall -Iinclude/ -pedantic
|
||||||
|
|
||||||
|
CFILES = $(shell find core/ -name "*.c")
|
||||||
|
CFILES += $(shell find frontend/ -name "*.c")
|
||||||
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
all: quip
|
||||||
|
|
||||||
|
.PHONY: quip
|
||||||
|
quip: $(OFILES)
|
||||||
|
$(CC) $^ -o $@
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
$(CC) -c $(CFLAGS) $< -o $@
|
||||||
7
READAME.md
Normal file
7
READAME.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# The quip build system
|
||||||
|
|
||||||
|
Quip is a modern build system for C projects aiming to be as simple as possible while balancing functionality.
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
To build quip, simply run ``make``
|
||||||
24
core/quip.c
Normal file
24
core/quip.c
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2026, Mirocom Laboratories
|
||||||
|
* Provided under the BSD-3 clause
|
||||||
|
*
|
||||||
|
* Abstract:
|
||||||
|
* This is the main file implementing early and core logic.
|
||||||
|
* Author:
|
||||||
|
* Ian M. Moffett <ian@mirocom.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include "common/knobs.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
if (access(QUIP_FILEPATH, F_OK) != 0) {
|
||||||
|
printf("fatal: No %s file found\n", QUIP_FILEPATH);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
47
core/state.c
Normal file
47
core/state.c
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2026, Mirocom Laboratories
|
||||||
|
* Provided under the BSD-3 clause
|
||||||
|
*
|
||||||
|
* Abstract:
|
||||||
|
* This file implements the quip state machine
|
||||||
|
* Author:
|
||||||
|
* Ian M. Moffett <ian@mirocom.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "common/state.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
quip_state_init(const char *build_file, struct quip_state *state)
|
||||||
|
{
|
||||||
|
if (build_file == NULL || state == NULL) {
|
||||||
|
errno = -EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
memset(state, 0, sizeof(*state));
|
||||||
|
state->line_num = 1;
|
||||||
|
state->in_fd = open(build_file, O_RDONLY);
|
||||||
|
|
||||||
|
if (state->in_fd < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
quip_state_destroy(struct quip_state *state)
|
||||||
|
{
|
||||||
|
if (state == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
close(state->in_fd);
|
||||||
|
state->in_fd = -1;
|
||||||
|
}
|
||||||
17
include/common/knobs.h
Normal file
17
include/common/knobs.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2026, Mirocom Laboratories
|
||||||
|
* Provided under the BSD-3 clause
|
||||||
|
*
|
||||||
|
* Abstract:
|
||||||
|
* This header defines settings related to quips operation.
|
||||||
|
* Author:
|
||||||
|
* Ian M. Moffett <ian@mirocom.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef COMMON_KNOBS_H
|
||||||
|
#define COMMON_KNOBS_H 1
|
||||||
|
|
||||||
|
#define QUIP_VERSION "0.0.1"
|
||||||
|
#define QUIP_FILEPATH "build.quip"
|
||||||
|
|
||||||
|
#endif /* !_COMMON_KNOBS_H_ */
|
||||||
43
include/common/state.h
Normal file
43
include/common/state.h
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2026, Mirocom Laboratories
|
||||||
|
* Provided under the BSD-3 clause
|
||||||
|
*
|
||||||
|
* Abstract:
|
||||||
|
* This header defines the quip state machine
|
||||||
|
* Author:
|
||||||
|
* Ian M. Moffett <ian@mirocom.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef COMMON_STATE_H
|
||||||
|
#define COMMON_STATE_H 1
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Represents the build state machine
|
||||||
|
*
|
||||||
|
* @in_fd: Input file descriptor of build file
|
||||||
|
* @line_num: Current line number
|
||||||
|
*/
|
||||||
|
struct quip_state {
|
||||||
|
int in_fd;
|
||||||
|
size_t line_num;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the quip state machine
|
||||||
|
*
|
||||||
|
* @build_file: Path to build file
|
||||||
|
* @state: State instance to initialize
|
||||||
|
*
|
||||||
|
* Returns zero on success
|
||||||
|
*/
|
||||||
|
int quip_state_init(const char *build_file, struct quip_state *state);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Destroy a quip state
|
||||||
|
*/
|
||||||
|
void quip_state_destroy(struct quip_state *state);
|
||||||
|
|
||||||
|
#endif /* !COMMON_STATE_H */
|
||||||
Reference in New Issue
Block a user