Skip to content

Commit

Permalink
[janitor] move extern into vapi
Browse files Browse the repository at this point in the history
  • Loading branch information
stronnag committed Dec 15, 2024
1 parent 07cec1e commit 5cfc9cf
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 56 deletions.
6 changes: 5 additions & 1 deletion src/clib/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ paho = meson.get_compiler('c').find_library('paho-mqtt3cs', kwargs: pahoargs)

clsrcs = files('btdev.c', 'get_locale_double.c', 'rserial.c', 'speech_wrapper.c')
if paho.found()
clsrcs += 'paho_wrapper.c'
clsrcs += files('paho_wrapper.c')
clib_dep += paho
endif

if build_machine.system() != 'linux'
clsrcs += files('poll_serials.c')
endif

common_inc_dir += [include_directories('.'), include_directories('../common')]

clib_cargs=[]
Expand Down
4 changes: 4 additions & 0 deletions src/clib/mwpfuncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ extern const char * get_build_compiler();
extern void start_cpu_stats();
extern int end_cpu_stats(double *cpu0, double* cpu1);

extern char** check_ports();
extern int check_insert_name(char *s);
extern int check_delete_name(char *s);

#define MWP_MISC_MWP_MAX_WP 60
9 changes: 9 additions & 0 deletions src/clib/mwpfuncs.vapi
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ namespace MwpMisc {

[CCode (cname="end_cpu_stats")]
int end_cpu_stats(double *cpu0, double* cpu1);

[CCode (cname="check_ports")]
char** check_ports();

[CCode (cname="check_insert_name")]
int check_insert_name(char *s);

[CCode (cname="check_delete_name")]
int check_delete_name(char *s);
}

[CCode (cheader_filename = "rserial.h")]
Expand Down
File renamed without changes.
4 changes: 0 additions & 4 deletions src/common/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ else
vcommon += files('posixspawn.vala', 'posix_psmisc.c')
endif

if build_machine.system() != 'linux'
vcommon += files('poll_serials.c')
endif

clicommon = ''

fccommon = files( 'mwptermcap.vala')
Expand Down
44 changes: 0 additions & 44 deletions src/mwp/mwp-epoxy.c

This file was deleted.

10 changes: 3 additions & 7 deletions src/mwp/serial_watcher.vala
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
extern char** check_ports();
extern int check_insert_name(char *s);
extern int check_delete_name(char *s);

namespace Mwp {
public class SerialWatcher : Object {
public SerialWatcher() {}
public void run() {
Timeout.add(2000, () => {
var devs = check_ports();
var devs = MwpMisc.check_ports();
if (devs != null) {
for (var sptr = devs; *sptr != null; sptr++) {
if (Mwp.find_combo(Mwp.dev_combox, (string)*sptr) == -1) {
var addme = check_insert_name(*sptr);
var addme = MwpMisc.check_insert_name(*sptr);
if (addme == 1) {
Mwp.prepend_combo(Mwp.dev_combox, (string)*sptr);
} else if (addme == -1) {
Expand All @@ -22,7 +18,7 @@ namespace Mwp {
}
var snames = Mwp.list_combo(Mwp.dev_combox);
foreach (var name in snames) {
if(check_delete_name((char*)name.data) == 0) {
if(MwpMisc.check_delete_name((char*)name.data) == 0) {
var found = false;
if (devs != null) {
for (var sptr = devs; *sptr != null; sptr++) {
Expand Down

0 comments on commit 5cfc9cf

Please sign in to comment.