incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r1200723 - in /incubator/ooo/trunk/main/vcl/os2/source/app: debug_printf.c makefile.mk printf.c
Date Fri, 11 Nov 2011 03:37:49 GMT
Author: pfg
Date: Fri Nov 11 03:37:48 2011
New Revision: 1200723

URL: http://svn.apache.org/viewvc?rev=1200723&view=rev
Log:
i118582: OS/2 port - remove pmprintf in vcl for dynamic implementation for debugging - based
on work by ydario.

Added:
    incubator/ooo/trunk/main/vcl/os2/source/app/debug_printf.c
Removed:
    incubator/ooo/trunk/main/vcl/os2/source/app/printf.c
Modified:
    incubator/ooo/trunk/main/vcl/os2/source/app/makefile.mk

Added: incubator/ooo/trunk/main/vcl/os2/source/app/debug_printf.c
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/os2/source/app/debug_printf.c?rev=1200723&view=auto
==============================================================================
--- incubator/ooo/trunk/main/vcl/os2/source/app/debug_printf.c (added)
+++ incubator/ooo/trunk/main/vcl/os2/source/app/debug_printf.c Fri Nov 11 03:37:48 2011
@@ -0,0 +1,75 @@
+/*************************************************************************
+
+   Copyright 2011 Yuri Dario <mc6530@mclink.it>
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ ************************************************************************/
+
+#define INCL_DOS
+#ifdef OS2
+#include <svpm.h>
+#else
+#include <os2.h>
+#endif
+#include <dlfcn.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#ifdef TESTME
+#include <stdio.h>
+#endif
+
+typedef APIRET _PMPRINTF(const char*, ...);
+typedef _PMPRINTF* PMPRINTF;
+
+static void* 	hmodPmPrintf = NULL;
+static PMPRINTF	pfnPmPrintf = NULL;
+
+int _Export debug_printf( const char* format, ...)
+{
+	va_list	args;
+	int		cnt;
+
+	if (hmodPmPrintf == NULL) {
+		// try dll loading
+		hmodPmPrintf = dlopen( "PMPRINTF", 0);
+		if (hmodPmPrintf == NULL)
+			return -1;
+
+		// search function
+		pfnPmPrintf = dlsym(hmodPmPrintf, "PmPrintfVa");
+		if (!pfnPmPrintf)
+			return -1;
+
+	}
+
+	// function loaded, print data
+	va_start(args, format);
+	cnt = pfnPmPrintf(format, args);
+	va_end(args);
+
+	return cnt;
+}
+
+
+#ifdef TESTME
+int main( void)
+{
+	printf( "Test PMPRINTF.DLL output, check PM window.\n");
+	debug_printf( "Test PMPRINTF.DLL output, check PM window.");
+	debug_printf( "Test PMPRINTF.DLL output: integer %d", 12345);
+	debug_printf( "Test PMPRINTF.DLL output: float %f", 123.45);
+	debug_printf( "Test PMPRINTF.DLL output: string '%s'", "Hello World");
+	exit(0);
+}
+#endif // TESTME

Modified: incubator/ooo/trunk/main/vcl/os2/source/app/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/os2/source/app/makefile.mk?rev=1200723&r1=1200722&r2=1200723&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/os2/source/app/makefile.mk (original)
+++ incubator/ooo/trunk/main/vcl/os2/source/app/makefile.mk Fri Nov 11 03:37:48 2011
@@ -48,7 +48,7 @@ YD00_CXXFILES=\
 			salsys.cxx
 
 SLOFILES=	$(SLO)$/salshl.obj	\
-			$(SLO)$/printf.obj \
+			$(SLO)$/debug_printf.obj \
 			$(SLO)$/salinfo.obj \
 			$(SLO)$/salinst.obj	\
 			$(SLO)$/sallang.obj	\



Mime
View raw message