refactor: reorganize files
This commit is contained in:
parent
e39003f4cc
commit
af1dcb2bf2
@ -7,18 +7,24 @@ project(tanabata
|
|||||||
set(CMAKE_C_STANDARD 99)
|
set(CMAKE_C_STANDARD 99)
|
||||||
|
|
||||||
set(CORE_SRC
|
set(CORE_SRC
|
||||||
src/core/sasahyou.c
|
include/core.h
|
||||||
src/core/sappyou.c
|
core/sasahyou.c
|
||||||
src/core/shoppyou.c)
|
core/sappyou.c
|
||||||
|
core/shoppyou.c)
|
||||||
|
|
||||||
set(TANABATA_SRC
|
set(TANABATA_SRC
|
||||||
src/tanabata/database.c
|
${CORE_SRC}
|
||||||
src/tanabata/sasa.c
|
include/tanabata.h
|
||||||
src/tanabata/tanzaku.c
|
lib/database.c
|
||||||
src/tanabata/kazari.c)
|
lib/sasa.c
|
||||||
|
lib/tanzaku.c
|
||||||
|
lib/kazari.c)
|
||||||
|
|
||||||
# Tanabata shared main lib
|
set(CLI_SRC
|
||||||
add_library(tanabata SHARED ${CORE_SRC} ${TANABATA_SRC})
|
cli/cli.c)
|
||||||
|
|
||||||
|
# Tanabata shared lib
|
||||||
|
add_library(tanabata SHARED ${TANABATA_SRC})
|
||||||
|
|
||||||
# Tanabata CLI app
|
# Tanabata CLI app
|
||||||
add_executable(tfm main.c include/core.h ${CORE_SRC} include/tanabata.h ${TANABATA_SRC} include/cli.h src/cli.c)
|
add_executable(tfm ${TANABATA_SRC} ${CLI_SRC})
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include "../include/tanabata.h"
|
#include "../include/tanabata.h"
|
||||||
#include "../include/cli.h"
|
|
||||||
|
|
||||||
// Stylization macros
|
// Stylization macros
|
||||||
#define TABLE_HEADER(s) "[7;36m"s"[0m"
|
#define TABLE_HEADER(s) "[7;36m"s"[0m"
|
||||||
@ -246,7 +245,7 @@ int menu_rem_kazari() {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cli(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
fprintf(stderr, ERROR("No options provided\n"));
|
fprintf(stderr, ERROR("No options provided\n"));
|
||||||
return 1;
|
return 1;
|
||||||
@ -2,7 +2,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "../../include/core.h"
|
#include "../include/core.h"
|
||||||
|
|
||||||
const Tanzaku HOLE_TANZAKU = {HOLE_ID};
|
const Tanzaku HOLE_TANZAKU = {HOLE_ID};
|
||||||
|
|
||||||
@ -3,7 +3,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "../../include/core.h"
|
#include "../include/core.h"
|
||||||
|
|
||||||
const Sasa HOLE_SASA = {HOLE_ID};
|
const Sasa HOLE_SASA = {HOLE_ID};
|
||||||
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "../../include/core.h"
|
#include "../include/core.h"
|
||||||
|
|
||||||
const Kazari HOLE_KAZARI = {HOLE_ID};
|
const Kazari HOLE_KAZARI = {HOLE_ID};
|
||||||
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
// Tanabata file manager command line interface lib
|
|
||||||
// By Masahiko AMANO aka H1K0
|
|
||||||
|
|
||||||
#ifndef TANABATA_CLI_H
|
|
||||||
#define TANABATA_CLI_H
|
|
||||||
|
|
||||||
// Command Line Interface
|
|
||||||
int cli(int argc, char **argv);
|
|
||||||
|
|
||||||
#endif //TANABATA_CLI_H
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include "../../include/tanabata.h"
|
#include "../include/tanabata.h"
|
||||||
|
|
||||||
int tanabata_init(Tanabata *tanabata) {
|
int tanabata_init(Tanabata *tanabata) {
|
||||||
if (sasahyou_init(&tanabata->sasahyou) != 0) {
|
if (sasahyou_init(&tanabata->sasahyou) != 0) {
|
||||||
@ -1,6 +1,6 @@
|
|||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
|
||||||
#include "../../include/tanabata.h"
|
#include "../include/tanabata.h"
|
||||||
|
|
||||||
int tanabata_kazari_add(Tanabata *tanabata, uint64_t sasa_id, uint64_t tanzaku_id) {
|
int tanabata_kazari_add(Tanabata *tanabata, uint64_t sasa_id, uint64_t tanzaku_id) {
|
||||||
if (sasa_id >= tanabata->sasahyou.size) {
|
if (sasa_id >= tanabata->sasahyou.size) {
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../../include/tanabata.h"
|
#include "../include/tanabata.h"
|
||||||
|
|
||||||
int tanabata_sasa_add(Tanabata *tanabata, const char *path) {
|
int tanabata_sasa_add(Tanabata *tanabata, const char *path) {
|
||||||
Sasa *current_sasa = tanabata->sasahyou.database;
|
Sasa *current_sasa = tanabata->sasahyou.database;
|
||||||
@ -1,5 +1,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "../../include/tanabata.h"
|
|
||||||
|
#include "../include/tanabata.h"
|
||||||
|
|
||||||
int tanabata_tanzaku_add(Tanabata *tanabata, const char *name, const char *description) {
|
int tanabata_tanzaku_add(Tanabata *tanabata, const char *name, const char *description) {
|
||||||
Tanzaku *current_tanzaku = tanabata->sappyou.database;
|
Tanzaku *current_tanzaku = tanabata->sappyou.database;
|
||||||
Loading…
x
Reference in New Issue
Block a user