Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2010-05-05 15:00:28 -0400
committereutarass2010-05-05 15:00:28 -0400
commita7573ae8119e60578d9d0cc156a603e6f77132c1 (patch)
tree217e93336aa406798069daa6ea4c7145fb2ad79f /examples
parentdca028520f0197736bb1dc70c5bb1c88fd8cfb62 (diff)
downloadorg.eclipse.tcf-a7573ae8119e60578d9d0cc156a603e6f77132c1.tar.gz
org.eclipse.tcf-a7573ae8119e60578d9d0cc156a603e6f77132c1.tar.xz
org.eclipse.tcf-a7573ae8119e60578d9d0cc156a603e6f77132c1.zip
Bug 311420: Move CONFIG_MAIN into main.c:
1. Service initialization code moved from config.h into separate file: main/services.c 2. Server initialization code moved from main.c into separate file: main/server.c 3. Created file main/services-ext.h to allow user extensions of services initialization code.
Diffstat (limited to 'examples')
-rw-r--r--examples/org.eclipse.tm.tcf.examples.daytime.agent/Makefile3
-rw-r--r--examples/org.eclipse.tm.tcf.examples.daytime.agent/config.h29
-rw-r--r--examples/org.eclipse.tm.tcf.examples.daytime.agent/daytime.c2
-rw-r--r--examples/org.eclipse.tm.tcf.examples.daytime.agent/services-ext.h25
4 files changed, 30 insertions, 29 deletions
diff --git a/examples/org.eclipse.tm.tcf.examples.daytime.agent/Makefile b/examples/org.eclipse.tm.tcf.examples.daytime.agent/Makefile
index 62a3063e2..5f544787f 100644
--- a/examples/org.eclipse.tm.tcf.examples.daytime.agent/Makefile
+++ b/examples/org.eclipse.tm.tcf.examples.daytime.agent/Makefile
@@ -2,7 +2,8 @@ TCF_AGENT_DIR=../../agent
include $(TCF_AGENT_DIR)/Makefile.inc
-CFLAGS := $(foreach dir,$(SRCDIRS),-I$(dir)) $(CFLAGS)
+override CFLAGS := $(foreach dir,$(SRCDIRS),-I$(dir)) $(CFLAGS)
+
HFILES := $(foreach dir,$(SRCDIRS),$(wildcard $(dir)/*.h)) $(HFILES)
CFILES := $(sort $(foreach dir,$(SRCDIRS),$(wildcard $(dir)/*.c)) $(CFILES))
diff --git a/examples/org.eclipse.tm.tcf.examples.daytime.agent/config.h b/examples/org.eclipse.tm.tcf.examples.daytime.agent/config.h
index 7283525a2..b97f7356e 100644
--- a/examples/org.eclipse.tm.tcf.examples.daytime.agent/config.h
+++ b/examples/org.eclipse.tm.tcf.examples.daytime.agent/config.h
@@ -33,36 +33,11 @@
# define TARGET_UNIX 1
#endif
-#define SERVICE_FileSystem 1
-#define SERVICE_SysMonitor TARGET_UNIX
+#define SERVICE_FileSystem 1
+#define SERVICE_SysMonitor TARGET_UNIX
#define ENABLE_Trace 1
#define ENABLE_Discovery 1
-#ifdef CONFIG_MAIN
-/*
- * This part of config.h contains services initialization code,
- * which is executed during agent startup.
- */
-
-#include "discovery.h"
-#include "filesystem.h"
-#include "sysmon.h"
-#include "diagnostics.h"
-#include "daytime.h"
-
-static void ini_services(Protocol * proto, TCFBroadcastGroup * bcg) {
-#if SERVICE_FileSystem
- ini_file_system_service(proto);
-#endif
-#if SERVICE_SysMonitor
- ini_sys_mon_service(proto);
-#endif
- ini_diagnostics_service(proto);
- ini_daytime_service(proto);
-}
-
-#endif /* CONFIG_MAIN */
-
#endif /* D_config */
diff --git a/examples/org.eclipse.tm.tcf.examples.daytime.agent/daytime.c b/examples/org.eclipse.tm.tcf.examples.daytime.agent/daytime.c
index 247568bf1..55571e2eb 100644
--- a/examples/org.eclipse.tm.tcf.examples.daytime.agent/daytime.c
+++ b/examples/org.eclipse.tm.tcf.examples.daytime.agent/daytime.c
@@ -16,7 +16,7 @@
* Sample TCF service implementation.
*/
-#include "mdep.h"
+#include "config.h"
#include <time.h>
#include "daytime.h"
#include "json.h"
diff --git a/examples/org.eclipse.tm.tcf.examples.daytime.agent/services-ext.h b/examples/org.eclipse.tm.tcf.examples.daytime.agent/services-ext.h
new file mode 100644
index 000000000..74bd0ff07
--- /dev/null
+++ b/examples/org.eclipse.tm.tcf.examples.daytime.agent/services-ext.h
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v1.0 which accompany this distribution.
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+
+/*
+ * Services initialization code extension point.
+ * If the agent is built with additional user-defined services,
+ * a customized version of services-ext.h file can be added to compiler headers search paths.
+ */
+
+#include "daytime.h"
+
+static void ini_ext_services(Protocol * proto, TCFBroadcastGroup * bcg) {
+ ini_daytime_service(proto);
+}

Back to the top