[ros-diffs] [janderwald] 24720: - add a primitive tool to output text via DbgPrint

janderwald at svn.reactos.org janderwald at svn.reactos.org
Sat Nov 11 17:07:35 CET 2006


Author: janderwald
Date: Sat Nov 11 19:07:35 2006
New Revision: 24720

URL: http://svn.reactos.org/svn/reactos?rev=24720&view=rev
Log:
- add a primitive tool to output text via DbgPrint

Added:
    trunk/reactos/tools/dbgprint/   (with props)
    trunk/reactos/tools/dbgprint/dbgprint.c   (with props)
    trunk/reactos/tools/dbgprint/dbgprint.mak   (with props)
Modified:
    trunk/reactos/tools/tools.mak

Propchange: trunk/reactos/tools/dbgprint/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Nov 11 19:07:35 2006
@@ -1,0 +1,10 @@
+cdmake
+*.coff
+*.d
+*.exe
+*.o
+*.sym
+*.dsp
+*.dsw
+*.ncb
+*.opt

Added: trunk/reactos/tools/dbgprint/dbgprint.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/dbgprint/dbgprint.c?rev=24720&view=auto
==============================================================================
--- trunk/reactos/tools/dbgprint/dbgprint.c (added)
+++ trunk/reactos/tools/dbgprint/dbgprint.c Sat Nov 11 19:07:35 2006
@@ -1,0 +1,58 @@
+/* $Id$
+ *
+ * PROJECT:         ReactOS DbgPrint Utility
+ * LICENSE:         GPL - See COPYING in the top level directory
+ * FILE:            tools/dbgprint/dbgprint.c
+ * PURPOSE:         outputs a text via DbgPrint API
+ * PROGRAMMERS:     Johannes Anderwald (johannes.anderwald at student.tugraz.at)
+ */
+
+#include <windows.h>
+#include <tchar.h>
+#include <debug.h>
+
+int _tmain(int argc, TCHAR ** argv)
+{
+	TCHAR * buf;
+	int bufsize;
+	int i;
+	int offset;
+
+	bufsize = 0;
+	for(i = 1; i < argc; i++)
+	{
+		bufsize += _tcslen(argv[i]) + 1;
+	}
+
+	if (!bufsize)
+	{
+		return -1;
+	}
+
+	buf = HeapAlloc(GetProcessHeap(), 0, (bufsize+1) * sizeof(TCHAR));
+	if (!buf)
+	{
+		return -1;
+	}
+
+	offset = 0;
+	for(i = 1; i < argc; i++)
+	{
+		int length = _tcslen(argv[i]);
+		_tcsncpy(&buf[offset], argv[i], length);
+		offset += length;
+		if (i + 1 < argc)
+		{
+			buf[offset] = _T(' ');
+		}
+		else
+		{
+			buf[offset] = _T('\n');
+			buf[offset+1] = _T('\0');
+		}
+		offset++;
+	}
+	DbgPrint(buf);
+	HeapFree(GetProcessHeap(), 0, buf);
+	return 0;
+}

Propchange: trunk/reactos/tools/dbgprint/dbgprint.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: trunk/reactos/tools/dbgprint/dbgprint.c
------------------------------------------------------------------------------
    svn:keywords = author date id revision

Added: trunk/reactos/tools/dbgprint/dbgprint.mak
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/dbgprint/dbgprint.mak?rev=24720&view=auto
==============================================================================
--- trunk/reactos/tools/dbgprint/dbgprint.mak (added)
+++ trunk/reactos/tools/dbgprint/dbgprint.mak Sat Nov 11 19:07:35 2006
@@ -1,0 +1,46 @@
+DBGPRINT_BASE = $(TOOLS_BASE)$(SEP)dbgprint
+DBGPRINT_BASE_ = $(DBGPRINT_BASE)$(SEP)
+DBGPRINT_INT = $(INTERMEDIATE_)$(DBGPRINT_BASE)
+DBGPRINT_INT_ = $(DBGPRINT_INT)$(SEP)
+DBGPRINT_OUT = $(OUTPUT_)$(DBGPRINT_BASE)
+DBGPRINT_OUT_ = $(DBGPRINT_OUT)$(SEP)
+
+$(DBGPRINT_INT): | $(TOOLS_INT)
+	$(ECHO_MKDIR)
+	${mkdir} $@
+
+ifneq ($(INTERMEDIATE),$(OUTPUT))
+$(DBGPRINT_OUT): | $(TOOLS_OUT)
+	$(ECHO_MKDIR)
+	${mkdir} $@
+endif
+
+DBGPRINT_TARGET = \
+	$(EXEPREFIX)$(DBGPRINT_OUT_)DBGPRINT$(EXEPOSTFIX)
+
+DBGPRINT_SOURCES = $(addprefix $(DBGPRINT_BASE_), \
+	dbgprint.c \
+	)
+
+DBGPRINT_OBJECTS = \
+  $(addprefix $(INTERMEDIATE_), $(DBGPRINT_SOURCES:.c=.o))
+
+DBGPRINT_HOST_CFLAGS = $(TOOLS_CFLAGS) -D__USE_W32API -Iinclude -Iinclude/reactos -Iinclude/psdk
+
+DBGPRINT_HOST_LFLAGS = $(TOOLS_LFLAGS) -lntdll
+
+.PHONY: DBGPRINT
+DBGPRINT: $(DBGPRINT_TARGET)
+
+$(DBGPRINT_TARGET): $(DBGPRINT_OBJECTS) | $(DBGPRINT_OUT)
+	$(ECHO_LD)
+	${host_gcc} $(DBGPRINT_OBJECTS) $(DBGPRINT_HOST_LFLAGS) -o $@
+
+$(DBGPRINT_INT_)dbgprint.o: $(DBGPRINT_BASE_)dbgprint.c | $(DBGPRINT_INT)
+	$(ECHO_CC)
+	${host_gcc} $(DBGPRINT_HOST_CFLAGS) -c $< -o $@
+
+.PHONY: DBGPRINT_clean
+DBGPRINT_clean:
+	-@$(rm) $(DBGPRINT_TARGET) $(DBGPRINT_OBJECTS) 2>$(NUL)
+clean: DBGPRINT_clean

Propchange: trunk/reactos/tools/dbgprint/dbgprint.mak
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/reactos/tools/tools.mak
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/tools.mak?rev=24720&r1=24719&r2=24720&view=diff
==============================================================================
--- trunk/reactos/tools/tools.mak (original)
+++ trunk/reactos/tools/tools.mak Sat Nov 11 19:07:35 2006
@@ -58,4 +58,5 @@
 include tools/wmc/wmc.mak
 include tools/wpp/wpp.mak
 include tools/wrc/wrc.mak
-include tools/sysreg/sysreg.mak
+include tools/sysreg/sysreg.mak
+include tools/dbgprint/dbgprint.mak




More information about the Ros-diffs mailing list