[ros-diffs] [sginsberg] 42709: - Convert tditest to PSEH instead of a broken MSVC SEH attempt - Teach man how to use "subroutines"

sginsberg at svn.reactos.org sginsberg at svn.reactos.org
Sat Aug 15 18:40:52 CEST 2009


Author: sginsberg
Date: Sat Aug 15 18:40:51 2009
New Revision: 42709

URL: http://svn.reactos.org/svn/reactos?rev=42709&view=rev
Log:
- Convert tditest to PSEH instead of a broken MSVC SEH attempt
- Teach man how to use "subroutines"

Modified:
    trunk/rosapps/applications/net/tditest/tditest/tditest.c
    trunk/rosapps/applications/sysutils/man/man.c

Modified: trunk/rosapps/applications/net/tditest/tditest/tditest.c
URL: http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/net/tditest/tditest/tditest.c?rev=42709&r1=42708&r2=42709&view=diff
==============================================================================
--- trunk/rosapps/applications/net/tditest/tditest/tditest.c [iso-8859-1] (original)
+++ trunk/rosapps/applications/net/tditest/tditest/tditest.c [iso-8859-1] Sat Aug 15 18:40:51 2009
@@ -10,6 +10,7 @@
  *   26-Nov-2003 Vizzini Updated to run properly on Win2ksp4
  */
 #include <tditest.h>
+#include <pseh/pseh2.h>
 
 
 #if DBG
@@ -544,22 +545,18 @@
 			return STATUS_INSUFFICIENT_RESOURCES;
 		}
 
-#ifdef _MSC_VER
-	try
-		{
-#endif
-			MmProbeAndLockPages(Mdl, KernelMode, IoModifyAccess);
-#ifdef _MSC_VER
-		}
-	except(EXCEPTION_EXECUTE_HANDLER)
-		{
-			TDI_DbgPrint(MIN_TRACE, ("MmProbeAndLockPages() failed.\n"));
-			IoFreeMdl(Mdl);
-			IoFreeIrp(Irp);
-			ExFreePool(ConnectInfo);
-			return STATUS_UNSUCCESSFUL;
-		}
-#endif
+	_SEH2_TRY
+	{
+		MmProbeAndLockPages(Mdl, KernelMode, IoModifyAccess);
+	}
+	_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+	{
+		TDI_DbgPrint(MIN_TRACE, ("MmProbeAndLockPages() failed.\n"));
+		IoFreeMdl(Mdl);
+		IoFreeIrp(Irp);
+		ExFreePool(ConnectInfo);
+		return STATUS_UNSUCCESSFUL;
+	} _SEH2_END;
 
 	TdiBuildSendDatagram(
 		Irp,               /* I/O Request Packet */
@@ -675,23 +672,19 @@
 			return STATUS_INSUFFICIENT_RESOURCES;
 		}
 
-#ifdef _MSC_VER
-	try
-		{
-#endif
-			MmProbeAndLockPages(Mdl, KernelMode, IoModifyAccess);
-#ifdef _MSC_VER
-		}
-	except (EXCEPTION_EXECUTE_HANDLER)
-		{
-			TDI_DbgPrint(MIN_TRACE, ("MmProbeAndLockPages() failed.\n"));
-			IoFreeMdl(Mdl);
-			IoFreeIrp(Irp);
-			ExFreePool(MdlBuffer);
-			ExFreePool(ReceiveInfo);
-			return STATUS_INSUFFICIENT_RESOURCES;
-		}
-#endif
+	_SEH2_TRY
+	{
+		MmProbeAndLockPages(Mdl, KernelMode, IoModifyAccess);
+	}
+	_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+	{
+		TDI_DbgPrint(MIN_TRACE, ("MmProbeAndLockPages() failed.\n"));
+		IoFreeMdl(Mdl);
+		IoFreeIrp(Irp);
+		ExFreePool(MdlBuffer);
+		ExFreePool(ReceiveInfo);
+		return STATUS_INSUFFICIENT_RESOURCES;
+	} _SEH2_END;
 
 	TdiBuildReceiveDatagram(
 		Irp,                    /* I/O Request Packet */

Modified: trunk/rosapps/applications/sysutils/man/man.c
URL: http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/man/man.c?rev=42709&r1=42708&r2=42709&view=diff
==============================================================================
--- trunk/rosapps/applications/sysutils/man/man.c [iso-8859-1] (original)
+++ trunk/rosapps/applications/sysutils/man/man.c [iso-8859-1] Sat Aug 15 18:40:51 2009
@@ -119,48 +119,51 @@
     return element;
 }
 
-int
-AnalyzeFile()
-{
-    char *cur_string=(char*)malloc(sizeof(char)*MAXLINE);
+void sh_outp(char *cur_string)
+{
+    int symbol;
+    putchar('\n');
+    putchar('\n');
+    for(symbol=3;putchar(cur_string[symbol]); symbol++);
+}
+
+void th_outp(char *cur_string, char *THtag)
+{
+    int symbol;
+    putchar('\n');
+    putchar('\n');
+    putchar('\t');
+    putchar('\t');
+    SetCl(ITALIC);
+     for(symbol=3;putchar(THtag[symbol]); symbol++);
+    putchar('\n');
+    SetCl(NORMAL);
+}
+
+void text_outp(char *cur_string)
+{
+    char TagFlag=0;
     int symbol=0;
-    char *THtag=(char*)malloc(sizeof(char)*MAXLINE);
-
-
-    void sh_outp(void)
-     {
-      putchar('\n');
-      putchar('\n');
-      for(symbol=3;putchar(cur_string[symbol]); symbol++);
-     }
-
-    void th_outp(void)
-     {
-      putchar('\n');
-      putchar('\n');
-      putchar('\t');
-      putchar('\t');
-      SetCl(ITALIC);
-       for(symbol=3;putchar(THtag[symbol]); symbol++);
-      putchar('\n');
-      SetCl(NORMAL);
-     }
-
-    void text_outp(void)
-     {
-      char TagFlag=0;
-      symbol=0;
-
-      if(cur_string[0]=='.')
-       while(cur_string[symbol]!=' ')
-        symbol++;
-
-     if(symbol) TagFlag=1;
-
-     for(;cur_string[symbol]!='\n'; symbol++)
+
+    if(cur_string[0]=='.')
+        while(cur_string[symbol]!=' ')
+            symbol++;
+
+    if(symbol) TagFlag=1;
+
+    for(;cur_string[symbol]!='\n'; symbol++)
         putchar(cur_string[symbol]);
         putchar(' ');
-     }
+}
+
+int
+AnalyzeFile()
+{
+    char *cur_string=(char*)malloc(sizeof(char)*MAXLINE);
+    char *THtag=(char*)malloc(sizeof(char)*MAXLINE);
+
+
+
 
     while(fgets(cur_string,MAXLINE,manfile))
 
@@ -169,7 +172,7 @@
        (cur_string[2]=='H')) // .SH tag
       {
        SetCl(BOLD);
-       sh_outp();
+       sh_outp(cur_string);
        SetCl(NORMAL);
       }
      else
@@ -177,7 +180,7 @@
        (cur_string[2]==' ')) // .I tag
       {
        SetCl(ITALIC);
-       text_outp();
+       text_outp(cur_string);
        SetCl(NORMAL);
       }
      else
@@ -195,7 +198,7 @@
        (cur_string[2]==' ')) // .B tag
       {
        SetCl(BOLD);
-       text_outp();
+       text_outp(cur_string);
        SetCl(NORMAL);
       }
       else
@@ -206,8 +209,8 @@
         putchar(' ');
        }
 
-     else text_outp(); // print plane text
-     th_outp();
+     else text_outp(cur_string); // print plane text
+     th_outp(cur_string, THtag);
 /* END of TAGs processing */
      return 0;
 }




More information about the Ros-diffs mailing list