gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Get rid of autogenerated concrete NSNumber/NSValue files


From: Andrew Ruder
Subject: Re: [PATCH] Get rid of autogenerated concrete NSNumber/NSValue files
Date: Thu, 25 May 2006 14:01:08 -0500
User-agent: Mutt/1.5.11

Sorry to reply to my own message, but I realized I had not done any of
the associated comment header changes in that last message.  Here is the
revised patch (although the last one is probably a little less noisy for
seeing the actual code ;)


- Andy


-- 
Andrew Ruder <address@hidden>
http://www.aeruder.net
=== Source/Makefile.postamble
==================================================================
--- Source/Makefile.postamble   (revision 3590)
+++ Source/Makefile.postamble   (revision 3592)
@@ -114,16 +114,6 @@
 # Things to do after checking
 # after-check::
 
-# Creation of NSValue and NSNumber concrete classes from templates
-$(NSVALUE_MFILES) : GSTemplateValue.m
-       rm -f $@
-       echo '#define TYPE_ORDER' `echo $@ | sed -e "s,[^0-9],,g"` >$@
-       cat GSTemplateValue.m >> $@
-$(NSNUMBER_MFILES) : NSConcreteNumber.m
-       rm -f $@
-       echo '#define TYPE_ORDER' `echo $@ | sed -e "s,[^0-9],,g"` >$@
-       cat NSConcreteNumber.m >> $@
-
 $(GNUSTEP_OBJ_DIR)/objc-load${OEXT}: dynamic-load.h
 
 dynamic-load.h: ../config.status
=== Source/GSConcreteValueTemplate.m
==================================================================
--- Source/GSConcreteValueTemplate.m    (revision 3590)
+++ Source/GSConcreteValueTemplate.m    (revision 3592)
@@ -1,5 +1,5 @@
-# line 1 "GSTemplateValue.m"   /* So gdb knows which file we are in */
-/* GSTemplateValue - Object encapsulation for C types.
+# line 1 "GSConcreteValueTemplate.m"   /* So gdb knows which file we are in */
+/* GSConcreteValueTemplate - Object encapsulation for C types.
    Copyright (C) 1993,1994 Free Software Foundation, Inc.
 
    Written by:  Adam Fedor <address@hidden>
@@ -22,15 +22,7 @@
    Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
02111 USA.
 */
 
-#include "config.h"
-#include "Foundation/NSValue.h"
-#include "Foundation/NSString.h"
-#include "Foundation/NSException.h"
-#include "Foundation/NSCoder.h"
-#include "Foundation/NSObjCRuntime.h"
-#include "GNUstepBase/preface.h"
 
-
 /* This file should be run through a preprocessor with the macro TYPE_ORDER
    defined to a number from 0 to 4 corresponding to each value type */
 #if TYPE_ORDER == 0
@@ -265,3 +257,6 @@
 }
 
 @end
+#undef GSTemplateValue
+#undef TYPE_METHOD
+#undef TYPE_NAME
=== Source/GNUmakefile
==================================================================
--- Source/GNUmakefile  (revision 3590)
+++ Source/GNUmakefile  (revision 3592)
@@ -133,6 +133,7 @@
 BASE_MFILES = \
 GSArray.m \
 GSAttributedString.m \
+GSConcreteValue.m \
 GSCountedSet.m \
 GSDictionary.m \
 GSFormat.m \
@@ -156,6 +157,7 @@
 NSCoder.m \
 NSCopyObject.m \
 NSCountedSet.m \
+NSConcreteNumber.m \
 NSConnection.m \
 NSData.m \
 NSDate.m \
@@ -248,17 +250,9 @@
 BASE_MFILES += GSFFCallInvocation.m
 endif
 
-NSVALUE_MFILES = \
-       GSValue0.m GSValue1.m GSValue2.m GSValue3.m \
-       GSValue4.m GSValue5.m
-NSNUMBER_MFILES = \
-       NSNumber0.m NSNumber1.m NSNumber2.m NSNumber3.m \
-       NSNumber4.m NSNumber5.m NSNumber6.m NSNumber7.m \
-       NSNumber8.m NSNumber9.m NSNumber10.m NSNumber11.m \
-       NSNumber12.m
-
 BASE_OTHER_SRCFILES = \
-NSConcreteNumber.m \
+NSConcreteNumberTemplate.m \
+GSConcreteValueTemplate.m \
 GSTemplateValue.m \
 dld-load.h \
 hpux-load.h \
@@ -374,7 +368,7 @@
 
 # The Objective-C source files to be compiled
 libgnustep-base_OBJC_FILES = $(GNU_MFILES) \
-       $(BASE_MFILES) $(NSVALUE_MFILES) $(NSNUMBER_MFILES)
+       $(BASE_MFILES)
 libgnustep-base_C_FILES = $(GNU_CFILES)
 
 # Extra DLL exports file
=== Source/GSConcreteValue.m
==================================================================
--- Source/GSConcreteValue.m    (revision 3590)
+++ Source/GSConcreteValue.m    (revision 3592)
@@ -0,0 +1,55 @@
+/* GSConcreteValue - Handle preprocessor magic for GSConcreteValueTemplate 
+   Copyright (C) 1993,1994 Free Software Foundation, Inc.
+
+   Written by: Andrew Ruder <address@hidden>
+   Date: May 2006
+
+   This file is part of the GNUstep Base Library.
+
+   This library 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 library 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 library; if not, write to the Free
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
02111 USA.
+*/
+
+#include "config.h"
+#include "Foundation/NSValue.h"
+#include "Foundation/NSString.h"
+#include "Foundation/NSException.h"
+#include "Foundation/NSCoder.h"
+#include "Foundation/NSObjCRuntime.h"
+#include "GNUstepBase/preface.h"
+
+#define TYPE_ORDER 0
+#include "GSConcreteValueTemplate.m"
+#undef TYPE_ORDER
+
+#define TYPE_ORDER 1
+#include "GSConcreteValueTemplate.m"
+#undef TYPE_ORDER
+
+#define TYPE_ORDER 2
+#include "GSConcreteValueTemplate.m"
+#undef TYPE_ORDER
+
+#define TYPE_ORDER 3
+#include "GSConcreteValueTemplate.m"
+#undef TYPE_ORDER
+
+#define TYPE_ORDER 4
+#include "GSConcreteValueTemplate.m"
+#undef TYPE_ORDER
+
+#define TYPE_ORDER 5
+#include "GSConcreteValueTemplate.m"
+#undef TYPE_ORDER
+
=== Source/NSConcreteNumberTemplate.m
==================================================================
--- Source/NSConcreteNumberTemplate.m   (revision 3590)
+++ Source/NSConcreteNumberTemplate.m   (revision 3592)
@@ -1,5 +1,5 @@
-# line 1 "NSConcreteNumber.m"  /* So gdb knows which file we are in */
-/* NSConcreteNumber - Object encapsulation of numbers
+# line 1 "NSConcreteNumberTemplate.m"  /* So gdb knows which file we are in */
+/* NSConcreteNumberTemplate - Object encapsulation of numbers
 
    Copyright (C) 1993, 1994, 1996, 2000 Free Software Foundation, Inc.
 
@@ -25,17 +25,6 @@
    Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
02111 USA.
 */
 
-#include "config.h"
-#include "GNUstepBase/preface.h"
-#include "GSConfig.h"
-#include "Foundation/NSObjCRuntime.h"
-#include "Foundation/NSString.h"
-#include "Foundation/NSException.h"
-#include "Foundation/NSCoder.h"
-#include "Foundation/NSPortCoder.h"
-#include "Foundation/NSCoder.h"
-#include "NSConcreteNumber.h"
-
 /* This file should be run through a preprocessor with the macro TYPE_ORDER
    defined to a number from 0 to 12 corresponding to each number type */
 #if TYPE_ORDER == 0
@@ -618,3 +607,6 @@
 
 @end
 
+#undef TYPE_TYPE
+#undef NumberTemplate
+#undef PT
=== Source/NSConcreteNumber.m
==================================================================
--- Source/NSConcreteNumber.m   (revision 3590)
+++ Source/NSConcreteNumber.m   (revision 3592)
@@ -0,0 +1,83 @@
+/* NSConcreteNumber - Handle preprocessor magic for NSConcreteNumberTemplate 
+   Copyright (C) 1993,1994 Free Software Foundation, Inc.
+
+   Written by: Andrew Ruder <address@hidden>
+   Date: May 2006
+
+   This file is part of the GNUstep Base Library.
+
+   This library 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 library 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 library; if not, write to the Free
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
02111 USA.
+*/
+
+#include "config.h"
+#include "GNUstepBase/preface.h"
+#include "GSConfig.h"
+#include "Foundation/NSObjCRuntime.h"
+#include "Foundation/NSString.h"
+#include "Foundation/NSException.h"
+#include "Foundation/NSCoder.h"
+#include "NSConcreteNumber.h"
+
+#define TYPE_ORDER 0
+#include "NSConcreteNumberTemplate.m"
+#undef TYPE_ORDER
+
+#define TYPE_ORDER 1
+#include "NSConcreteNumberTemplate.m"
+#undef TYPE_ORDER
+
+#define TYPE_ORDER 2
+#include "NSConcreteNumberTemplate.m"
+#undef TYPE_ORDER
+
+#define TYPE_ORDER 3
+#include "NSConcreteNumberTemplate.m"
+#undef TYPE_ORDER
+
+#define TYPE_ORDER 4
+#include "NSConcreteNumberTemplate.m"
+#undef TYPE_ORDER
+
+#define TYPE_ORDER 5
+#include "NSConcreteNumberTemplate.m"
+#undef TYPE_ORDER
+
+#define TYPE_ORDER 6
+#include "NSConcreteNumberTemplate.m"
+#undef TYPE_ORDER
+
+#define TYPE_ORDER 7
+#include "NSConcreteNumberTemplate.m"
+#undef TYPE_ORDER
+
+#define TYPE_ORDER 8
+#include "NSConcreteNumberTemplate.m"
+#undef TYPE_ORDER
+
+#define TYPE_ORDER 9
+#include "NSConcreteNumberTemplate.m"
+#undef TYPE_ORDER
+
+#define TYPE_ORDER 10
+#include "NSConcreteNumberTemplate.m"
+#undef TYPE_ORDER
+
+#define TYPE_ORDER 11
+#include "NSConcreteNumberTemplate.m"
+#undef TYPE_ORDER
+
+#define TYPE_ORDER 12
+#include "NSConcreteNumberTemplate.m"
+#undef TYPE_ORDER
=== ChangeLog
==================================================================
--- ChangeLog   (revision 3590)
+++ ChangeLog   (revision 3592)
@@ -1,3 +1,13 @@
+2006-05-25  Andrew Ruder <address@hidden>
+       * Source/NSConcreteNumberTemplate.m (from NSConcreteNumber.m):
+       * Source/GSConcreteValueTemplate.m (from GSTemplateValue.m):
+       * Source/GNUmakefile:
+       * Source/Makefile.postamble:
+       * Source/GSConcreteValue.m (added):
+       * Source/NSConcreteNumber.m (added):
+       Get rid of use of sed to generate concrete NSNumber/NSValue classes.
+       Use preprocessor to get around generation of additional files.
+       
 2006-05-24  Richard Frith-Macdonald <address@hidden>
 
        * Source/NSPredicate.m: Restore last changes with varargs rewrite

reply via email to

[Prev in Thread] Current Thread [Next in Thread]