*** empty log message ***
authorEmanuele Aliberti <ea@iol.it>
Sat, 15 May 1999 07:23:34 +0000 (07:23 +0000)
committerEmanuele Aliberti <ea@iol.it>
Sat, 15 May 1999 07:23:34 +0000 (07:23 +0000)
svn path=/trunk/; revision=468

rosapps/notevil/makefile [new file with mode: 0644]
rosapps/notevil/makefile.lcc [new file with mode: 0644]
rosapps/notevil/notevil.c [new file with mode: 0644]
rosapps/notevil/notevil.rc [new file with mode: 0644]
rosapps/notevil/readme.txt [new file with mode: 0644]
rosapps/notevil/resource.h [new file with mode: 0644]
rosapps/rules.mak

diff --git a/rosapps/notevil/makefile b/rosapps/notevil/makefile
new file mode 100644 (file)
index 0000000..a4d992e
--- /dev/null
@@ -0,0 +1,34 @@
+# $Id: makefile,v 1.1 1999/05/15 07:23:34 ea Exp $
+#
+# ReactOS makefile for notevil
+# Compiler: egcs 1.1.2
+#
+TARGET=notevil
+
+all: $(TARGET).exe
+
+OBJECTS = $(TARGET).o $(TARGET).coff
+
+CLEAN_FILES = *.o $(TARGET).exe $(TARGET).sym $(TARGET).coff
+
+clean: $(CLEAN_FILES:%=%_clean)
+
+$(CLEAN_FILES:%=%_clean): %_clean:
+       - $(RM) $*
+
+.phony: clean $(CLEAN_FILES:%=%_clean)
+
+$(TARGET).exe: $(OBJECTS)
+       $(CC) $(OBJECTS) \
+               -o $(TARGET).exe \
+               -lkernel32 \
+               -luser32 \
+               -lcrtdll 
+       $(NM) --numeric-sort $(TARGET).exe > $(TARGET).sym
+       
+$(TARGET).coff: $(TARGET).rc
+       $(RC) $(RFLAGS) $(TARGET).rc $(TARGET).coff
+       
+include ../rules.mak
+
+# EOF
diff --git a/rosapps/notevil/makefile.lcc b/rosapps/notevil/makefile.lcc
new file mode 100644 (file)
index 0000000..83e9bf3
--- /dev/null
@@ -0,0 +1,21 @@
+# $Id: makefile.lcc,v 1.1 1999/05/15 07:23:34 ea Exp $
+# Makefile for lcc-win32
+# 
+CC=lcc.exe
+CFLAGS=-c -O
+LD=lcclnk.exe
+LFLAGS=-s
+RC=lrc.exe
+
+OBJECTS=notevil.obj notevil.res
+
+notevil.exe: $(OBJECTS)
+       $(LD) $(LFLAGS) $(OBJECTS)
+
+notevil.obj: notevil.c resource.h
+       $(CC) $(CFLAGS) notevil.c
+
+notevil.res: notevil.rc
+       $(RC) notevil.rc
+       
+# EOF
diff --git a/rosapps/notevil/notevil.c b/rosapps/notevil/notevil.c
new file mode 100644 (file)
index 0000000..3466d92
--- /dev/null
@@ -0,0 +1,224 @@
+/* $Id: notevil.c,v 1.1 1999/05/15 07:23:34 ea Exp $
+ *
+ * notevil.c
+ * 
+ * --------------------------------------------------------------------
+ *
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this software; see the file COPYING.LIB. If
+ * not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+ * Cambridge, MA 02139, USA.  
+ *
+ * --------------------------------------------------------------------
+ * ReactOS Coders Console Parade
+ *
+ * 19990411 EA
+ * 19990515 EA
+ */
+//#define UNICODE
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <tchar.h>
+#include "resource.h"
+
+LPCTSTR app_name = _TEXT("notevil");
+
+HANDLE myself;
+HANDLE ScreenBuffer;
+
+void
+WriteStringAt(
+       LPTSTR  lpString,
+       COORD   xy,
+       WORD    wColor
+       )
+{
+       DWORD   cWritten = 0;
+       WORD    wLen = lstrlen(lpString);
+
+       if (0 == wLen) return;
+       WriteConsoleOutputCharacter(
+               ScreenBuffer,
+               lpString,
+               wLen,
+               xy,
+               & cWritten
+               );
+       FillConsoleOutputAttribute(
+               ScreenBuffer,
+               wColor,
+               wLen,
+               xy,
+               & cWritten
+               );
+}
+
+
+#ifdef DISPLAY_COORD
+void
+WriteCoord(COORD c)
+{
+       COORD xy = {0,0};
+       TCHAR buf [40];
+
+       wsprintf(
+               buf,
+               _TEXT("x=%d  y=%d"),
+               c.X,
+               c.Y
+               );
+       WriteStringAt(
+               buf,
+               xy,
+               (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE)
+               );
+}
+#endif /* def DISPLAY_COORD */
+
+
+INT
+GetNextString(
+       LPTSTR  Buffer,
+       INT     BufferSize,
+       DWORD   *Index
+       )
+{
+       if (RES_LAST_INDEX == *Index)
+       {
+               *Index = RES_FIRST_INDEX;
+       }
+       else
+       {
+               ++*Index;
+       }
+       LoadString(
+               myself,
+               *Index,
+               Buffer,
+               BufferSize
+               );
+       return 0;
+}
+
+       
+VOID
+DisplayTitle(VOID)
+{
+       COORD   xy = {24,12};
+
+       WriteStringAt(
+               _TEXT("ReactOS Coders Console Parade"),
+               xy,
+               (FOREGROUND_GREEN | FOREGROUND_INTENSITY)
+               );
+}
+
+
+
+#define RES_DELAY_CHANGE 12
+#define RES_BUFFER_SIZE  1024
+void
+MainLoop(void)
+{
+       TCHAR   NameString [RES_BUFFER_SIZE];
+       DWORD   NameIndex = 1;
+       INT     NameLength = 0;
+       COORD   xy = {40,12}; 
+       INT     n = RES_DELAY_CHANGE;
+       INT     dir_y = 1;
+       INT     dir_x = 1;
+       WORD    wColor = 0;
+
+       for ( ; 1; ++n )
+       {
+               if (n == RES_DELAY_CHANGE)
+               {
+                       n = GetNextString(
+                               NameString,
+                               RES_BUFFER_SIZE,
+                               & NameIndex
+                               );
+                       NameLength = lstrlen(NameString);
+                       ++wColor;
+               }
+               if (!xy.X)
+               {
+                       if (dir_x == -1) dir_x = 1;
+               }
+               else if (xy.X > 80 - NameLength)
+               {
+                       if (dir_x == 1) dir_x = -1;
+               }
+               xy.X += dir_x;
+               switch (xy.Y)
+               {
+                       case 0:
+                               if (dir_y == -1) dir_y = 1;
+                               break;
+                       case 24:
+                               if (dir_y == 1) dir_y = -1;
+                               break;
+               }
+               xy.Y += dir_y;
+#ifdef DISPLAY_COORD
+               WriteCoord(xy);
+#endif /* def DISPLAY_COORD */
+               DisplayTitle();
+               WriteStringAt(
+                       NameString,
+                       xy,
+                       (wColor & 0x000F)
+                       );
+               Sleep(100);
+               WriteStringAt(
+                       NameString,
+                       xy,
+                       0
+                       );      
+       }
+}
+
+
+int
+main(
+       int     argc,
+       char    *argv []
+       )
+{
+       myself = GetModuleHandle(NULL);
+
+       ScreenBuffer = CreateConsoleScreenBuffer(
+                       GENERIC_WRITE,
+                       0,
+                       NULL,
+                       CONSOLE_TEXTMODE_BUFFER,
+                       NULL
+                       );
+       if (INVALID_HANDLE_VALUE == ScreenBuffer)
+       {
+               _ftprintf(
+                       stderr,
+                       _TEXT("%s: could not create a new screen buffer\n"),
+                       app_name
+                       );
+               return EXIT_FAILURE;
+       }
+       SetConsoleActiveScreenBuffer(ScreenBuffer);
+       MainLoop();
+       CloseHandle(ScreenBuffer);
+       return EXIT_SUCCESS;
+}
+
+
+/* EOF */
diff --git a/rosapps/notevil/notevil.rc b/rosapps/notevil/notevil.rc
new file mode 100644 (file)
index 0000000..08c7f88
--- /dev/null
@@ -0,0 +1,69 @@
+/* $Id: notevil.rc,v 1.1 1999/05/15 07:23:34 ea Exp $ */
+#include "../../reactos/include/defines.h"
+#include "../../reactos/include/reactos/resource.h"
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+/* Version information. */
+
+VS_VERSION_INFO VERSIONINFO
+       FILEVERSION     0,0,13,RES_UINT_FILE_VERSION
+       PRODUCTVERSION  0,0,13,0
+       FILEFLAGSMASK   0x3fL
+#ifdef _DEBUG
+       FILEFLAGS       0x1L
+#else
+       FILEFLAGS       0x0L
+#endif
+       FILEOS          0x40004L
+       FILETYPE        0x2L
+       FILESUBTYPE     0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0"
+        BEGIN
+            VALUE "CompanyName",       RES_STR_COMPANY_NAME
+            VALUE "FileDescription",   "ReactOS Coders Console Parade\0"
+            VALUE "FileVersion",       "1.0.0\0"
+            VALUE "InternalName",      "notevil\0"
+            VALUE "LegalCopyright",    RES_STR_LEGAL_COPYRIGHT
+            VALUE "OriginalFilename",  "notevil.exe\0"
+            VALUE "ProductName",       RES_STR_PRODUCT_NAME
+            VALUE "ProductVersion",    RES_STR_PRODUCT_VERSION
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200
+    END
+END
+
+/*
+ * String table
+ *
+ * Order is the same as in the status report published weekly in
+ * the "ros-kernel" mailing list by Rex Jolliff.
+ *
+ */
+STRINGTABLE MOVEABLE
+BEGIN
+  1, "Boudewijn Dekker (Ariadne)" 
+  2, "Robert Bergkvist (FragDance Galore)"
+  3, "Arindam Das"
+  4, "Boudewijn Dekker"
+  5, "Jason Eager"
+  6, "Jason Filby"
+  7, "Rex Jolliff"
+  8, "Eric Kohl"
+  9, "Hans Kremer"
+ 10, "Frederik Leemans"
+ 11, "Jean Michault"
+ 12, "Jim Noeth"
+ 13, "Brian Palmer"
+ 14, "Matt Pyne"
+ 15, "Jason Weiler"
+ 16, "David Welch"
+END
+
+/* EOF */
diff --git a/rosapps/notevil/readme.txt b/rosapps/notevil/readme.txt
new file mode 100644 (file)
index 0000000..82f45c5
--- /dev/null
@@ -0,0 +1,21 @@
+$Id: readme.txt,v 1.1 1999/05/15 07:23:34 ea Exp $
+
+ReactOS Coders Console Parade
+-----------------------------
+
+The name "notevil" is from the well known Easter egg
+of the "3D Text (OpenGL)" screen saver, which
+displays the NT programmers' names if one writes
+"not evil" in the text box.
+
+To add a new name, add a new string in the
+resource script notevil.rc (string index numbers must be
+unique) and edit resource.h to update minimum and 
+maximum indices.
+
+Eventually run make.
+
+Written to test Win32 console functions implementation.
+
+___________
+19990411 EA
diff --git a/rosapps/notevil/resource.h b/rosapps/notevil/resource.h
new file mode 100644 (file)
index 0000000..8e41a9b
--- /dev/null
@@ -0,0 +1,2 @@
+#define RES_FIRST_INDEX 1
+#define RES_LAST_INDEX  16
index 9f4e5b4..afae57c 100644 (file)
@@ -67,6 +67,7 @@ STRIP = $(PREFIX)strip
 AS = $(PREFIX)gcc -c -x assembler-with-cpp
 CPP = $(PREFIX)cpp
 AR = $(PREFIX)ar
 AS = $(PREFIX)gcc -c -x assembler-with-cpp
 CPP = $(PREFIX)cpp
 AR = $(PREFIX)ar
+RC = $(PREFIX)windres
 
 %.o: %.c
        $(CC) $(CFLAGS) -c $< -o $@
 
 %.o: %.c
        $(CC) $(CFLAGS) -c $< -o $@