Subversion Repositories Tewi

Rev

Rev 25 | Rev 159 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 25 Rev 156
Line 1... Line 1...
1
/* $Id: module.c 25 2024-09-14 15:10:29Z nishi $ */
1
/* $Id: module.c 156 2024-09-25 12:28:10Z nishi $ */
2
 
2
 
3
#define SOURCE
3
#define SOURCE
4
 
4
 
5
#include "tw_module.h"
5
#include "tw_module.h"
6
 
6
 
7
#include "tw_config.h"
7
#include "tw_config.h"
8
 
8
 
9
#include <cm_string.h>
9
#include <cm_string.h>
10
#include <cm_log.h>
10
#include <cm_log.h>
11
 
11
 
-
 
12
#include <string.h>
12
#include <unistd.h>
13
#include <unistd.h>
13
#include <stdlib.h>
14
#include <stdlib.h>
14
 
15
 
15
#ifdef __MINGW32__
16
#ifdef __MINGW32__
16
#include <windows.h>
17
#include <windows.h>
Line 53... Line 54...
53
		config.extension = cm_strcat3(tmp, " ", string);
54
		config.extension = cm_strcat3(tmp, " ", string);
54
		free(tmp);
55
		free(tmp);
55
	}
56
	}
56
}
57
}
57
 
58
 
-
 
59
void tw_add_define(const char* string) {
-
 
60
	int i;
-
 
61
	for(i = 0; config.defined[i] != NULL; i++)
-
 
62
		;
-
 
63
	config.defined[i] = cm_strdup(string);
-
 
64
	config.defined[i + 1] = NULL;
-
 
65
}
-
 
66
 
-
 
67
void tw_delete_define(const char* string) {
-
 
68
	int i;
-
 
69
	for(i = 0; config.defined[i] != NULL; i++) {
-
 
70
		if(strcmp(config.defined[i], string) == 0) {
-
 
71
			free(config.defined[i]);
-
 
72
			for(; config.defined[i] != NULL; i++) {
-
 
73
				config.defined[i] = config.defined[i + 1];
-
 
74
			}
-
 
75
		}
-
 
76
	}
-
 
77
}
-
 
78
 
58
void tw_init_tools(struct tw_tool* tools) {
79
void tw_init_tools(struct tw_tool* tools) {
59
	tools->log = cm_log;
80
	tools->log = cm_log;
60
	tools->add_version = tw_add_version;
81
	tools->add_version = tw_add_version;
-
 
82
	tools->add_define = tw_add_define;
61
}
83
}
62
 
84
 
63
int tw_module_init(void* mod) {
85
int tw_module_init(void* mod) {
64
	tw_mod_init_t mod_init = (tw_mod_init_t)tw_module_symbol(mod, "mod_init");
86
	tw_mod_init_t mod_init = (tw_mod_init_t)tw_module_symbol(mod, "mod_init");
65
	if(mod_init == NULL) {
87
	if(mod_init == NULL) {