Files
helmetc/libxtools/clconfig.c
Олег Бородин ba9f88879d work in progess
2025-10-12 09:45:29 +02:00

65 lines
1.5 KiB
C

/*
* Copyright 2023 Oleg Borodin <borodin@unix7.org>
*/
#include <stdio.h>
#include <cllexer.h>
#include <clcomp.h>
#include <vmapper.h>
#include <clconfig.h>
void clconfig_init(clconfig_t* clconfig, int argc, char **argv) {
//clcomp_init(&(clconfig->lexer), argv, argc);
vmapper_init(&(clconfig->mapper));
}
int clconfig_bind(clconfig_t* clconfig, int type, char* name, void* ptr) {
vmapper_t* vmapper = &(clconfig->mapper);
return vmapper_bind(vmapper, type, name, ptr);
}
int clconfig_parse(clconfig_t* clconfig) {
char token[1024];
int toktype = TOKEN_NULL;
int i = 0;
while (toktype != TOKEN_ENDF) {
toktype = clcomp_gettok(&(clconfig->lexer), token);
printf("clconfig_parse %d: %d [%s]\n", i, toktype, token);
i++;
}
return 0;
}
void clconfig_destroy(clconfig_t* clconfig) {
clcomp_destroy(&(clconfig->lexer));
vmapper_destroy(&(clconfig->mapper));
}
int __main(int argc, char **argv) {
(void)argc;
(void)argv;
/*
char*_argv[] = { argv[0], "--qwerty=-num12345", "--foo=-bar" };
int _argc = 2;
clcomp_t clcomp;
clcomp_init(&clcomp, _argv, _argc);
char token[1024];
int toktype = TOKEN_NULL;
int i = 0;
while (toktype != TOKEN_ENDF) {
toktype = clcomp_gettok(&lex, token);
printf("%d: %d [%s]\n", i, toktype, token);
i++;
}
*/
return 0;
}