Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
lektor
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Kubat
lektor
Validations
99593911
Vérifiée
Valider
99593911
rédigé
26 mai 2020
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Can now export regs + define repo reg
parent
b4656680
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion
!102
Modules
Modifications
4
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
4 fichiers modifiés
inc/lektor/reg.h
+15
-3
15 ajouts, 3 suppressions
inc/lektor/reg.h
src/module/module_sdl2.c
+1
-0
1 ajout, 0 suppression
src/module/module_sdl2.c
src/module/module_x11.c
+1
-0
1 ajout, 0 suppression
src/module/module_x11.c
src/module/repo.c
+6
-0
6 ajouts, 0 suppression
src/module/repo.c
avec
23 ajouts
et
3 suppressions
inc/lektor/reg.h
+
15
−
3
Voir le fichier @
99593911
#
pragma once
#
if ! defined(__REG_H__)
struct
lkt_state
;
struct
lkt_state
;
...
@@ -9,18 +9,28 @@ struct module_reg {
...
@@ -9,18 +9,28 @@ struct module_reg {
void
(
*
func
)(
void
);
void
(
*
func
)(
void
);
};
};
extern
struct
module_reg
*
reg
;
#define REG_BEGIN(reg) struct module_reg reg[] = {
#define REG_BEGIN(reg) struct module_reg reg[] = {
#define REG_ADD(__f) { .name = #__f, .func = (void(*)(void)) __f },
#define REG_ADD(__f) { .name = #__f, .func = (void(*)(void)) __f },
#define REG_ADD_NAMED(__n, __f) { .name = __n, .func = (void(*)(void)) __f },
#define REG_ADD_NAMED(__n, __f) { .name = __n, .func = (void(*)(void)) __f },
#define REG_END() { .name = NULL, .func = NULL } };
#define REG_END() { .name = NULL, .func = NULL } };
#if ! defined(_STATIC_MODULES)
#define REG_EXPORT(__reg) struct module_reg *__reg__ = __reg;
#else
#define REG_EXPORT(__reg)
#endif
/* If handle is NULL, file is unused and the reg is red. Otherwise,
/* If handle is NULL, file is unused and the reg is red. Otherwise,
we use dlfcn to search for the symbol which is returned. If *handle
we use dlfcn to search for the symbol which is returned. If *handle
is NULL, it will be created by opening the file. */
is NULL, it will be created by opening the file. */
void
*
reg_pick
(
const
char
*
file
,
void
**
handle
,
const
char
*
symbol
);
void
*
reg_pick
(
const
char
*
file
,
void
**
handle
,
const
char
*
symbol
);
/* Get the reg from a .so file. This reg must be exported by the
shared library with REG_EXPORT. Note that this reg is named `__reg__`,
thus no symbol must be named `__reg__` in the .so file.
Returns 0 on success, something else on error. */
int
reg_from_file
(
const
char
*
file
,
struct
module_reg
*
ret
);
/* Set the ref for this .a / .so file */
/* Set the ref for this .a / .so file */
void
reg_set
(
struct
module_reg
*
);
void
reg_set
(
struct
module_reg
*
);
...
@@ -28,3 +38,5 @@ void reg_set(struct module_reg *);
...
@@ -28,3 +38,5 @@ void reg_set(struct module_reg *);
type is done, it is up to the user to check if the structure passed as a
type is done, it is up to the user to check if the structure passed as a
`void*` is the right structure. */
`void*` is the right structure. */
int
load_module_by_name
(
struct
lkt_state
*
srv
,
const
char
*
name
,
void
*
mod
);
int
load_module_by_name
(
struct
lkt_state
*
srv
,
const
char
*
name
,
void
*
mod
);
#endif
Ce diff est replié.
Cliquez pour l'agrandir.
src/module/module_sdl2.c
+
1
−
0
Voir le fichier @
99593911
...
@@ -423,3 +423,4 @@ REG_ADD(module_sdl2_set_volume)
...
@@ -423,3 +423,4 @@ REG_ADD(module_sdl2_set_volume)
REG_ADD
(
module_sdl2_get_duration
)
REG_ADD
(
module_sdl2_get_duration
)
REG_ADD
(
module_sdl2_get_elapsed
)
REG_ADD
(
module_sdl2_get_elapsed
)
REG_END
()
REG_END
()
REG_EXPORT
(
sdl2_reg
)
Ce diff est replié.
Cliquez pour l'agrandir.
src/module/module_x11.c
+
1
−
0
Voir le fichier @
99593911
...
@@ -275,3 +275,4 @@ REG_ADD(module_x11_set_volume)
...
@@ -275,3 +275,4 @@ REG_ADD(module_x11_set_volume)
REG_ADD
(
module_x11_get_duration
)
REG_ADD
(
module_x11_get_duration
)
REG_ADD
(
module_x11_get_elapsed
)
REG_ADD
(
module_x11_get_elapsed
)
REG_END
()
REG_END
()
REG_EXPORT
(
x11_reg
)
Ce diff est replié.
Cliquez pour l'agrandir.
src/module/repo.c
+
6
−
0
Voir le fichier @
99593911
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include
<mthread/mthread.h>
#include
<mthread/mthread.h>
#include
<lektor/database.h>
#include
<lektor/database.h>
#include
<lektor/net.h>
#include
<lektor/net.h>
#include
<lektor/reg.h>
static
volatile
unsigned
int
curl_init
=
false
;
static
volatile
unsigned
int
curl_init
=
false
;
...
@@ -491,3 +492,8 @@ repo_update(struct lkt_repo *const repo)
...
@@ -491,3 +492,8 @@ repo_update(struct lkt_repo *const repo)
{
{
return
mthread_create
(
NULL
,
ATTR_DETACHED
,
__repo_get_all_id_async
,
repo
);
return
mthread_create
(
NULL
,
ATTR_DETACHED
,
__repo_get_all_id_async
,
repo
);
}
}
REG_BEGIN
(
repo_reg
)
REG_ADD_NAMED
(
"new"
,
load_repo_https
)
REG_END
()
REG_EXPORT
(
repo_reg
)
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter