Author: mturk Date: Tue Apr 14 17:26:47 2009 New Revision: 764889 URL: http://svn.apache.org/viewvc?rev=764889&view=rev Log: Add Version class
Added: commons/sandbox/runtime/trunk/src/main/native/shared/version.c (with props) Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.in commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in commons/sandbox/runtime/trunk/src/main/native/include/acr_version.h commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestOS.java Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.in URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.in?rev=764889&r1=764888&r2=764889&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/Makefile.in (original) +++ commons/sandbox/runtime/trunk/src/main/native/Makefile.in Tue Apr 14 17:26:47 2009 @@ -69,7 +69,8 @@ $(SRCDIR)/shared/error.$(OBJ) \ $(SRCDIR)/shared/memory.$(OBJ) \ $(SRCDIR)/shared/string.$(OBJ) \ - $(SRCDIR)/shared/tables.$(OBJ) + $(SRCDIR)/shared/tables.$(OBJ) \ + $(SRCDIR)/shared/version.$(OBJ) LINUX_OBJS= \ $(SRCDIR)/os/unix/main.$(OBJ) \ Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in?rev=764889&r1=764888&r2=764889&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in (original) +++ commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in Tue Apr 14 17:26:47 2009 @@ -63,7 +63,8 @@ $(SRCDIR)/shared/error.$(OBJ) \ $(SRCDIR)/shared/memory.$(OBJ) \ $(SRCDIR)/shared/string.$(OBJ) \ - $(SRCDIR)/shared/tables.$(OBJ) + $(SRCDIR)/shared/tables.$(OBJ) \ + $(SRCDIR)/shared/version.$(OBJ) WINDOWS_OBJS= \ $(SRCDIR)/os/win32/main.$(OBJ) \ Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_version.h URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_version.h?rev=764889&r1=764888&r2=764889&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/include/acr_version.h (original) +++ commons/sandbox/runtime/trunk/src/main/native/include/acr_version.h Tue Apr 14 17:26:47 2009 @@ -62,10 +62,10 @@ #define ACR_PATCH_VERSION 3 /** - * This symbol is defined for internal, "development" copies of SIGHT. + * This symbol is defined for internal, "development" copies of ACR. * This symbol will be #undef'd for releases. */ -#undef ACR_IS_DEV_VERSION +#define ACR_IS_DEV_VERSION 1 /** Properly quote a value as a string in the C preprocessor */ #define ACR_STRINGIFY(n) ACR_STRINGIFY_HELPER(n) @@ -81,7 +81,7 @@ ACR_IS_DEV_STRING /** Internal: string form of the "is dev" flag */ -#ifdef ACR_IS_DEV_VERSION +#if ACR_IS_DEV_VERSION #define ACR_IS_DEV_STRING "-dev" #else #define ACR_IS_DEV_STRING "" Added: commons/sandbox/runtime/trunk/src/main/native/shared/version.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/version.c?rev=764889&view=auto ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/shared/version.c (added) +++ commons/sandbox/runtime/trunk/src/main/native/shared/version.c Tue Apr 14 17:26:47 2009 @@ -0,0 +1,54 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ + +#include "acr.h" +#include "acr_private.h" +#include "acr_version.h" + +ACR_JNI_EXPORT_DECLARE(jint, Version, get0)(ACR_JNISTDARGS, jint what) +{ + UNREFERENCED_STDARGS; + switch (what) { + case 0: + return ACR_MAJOR_VERSION; + break; + case 1: + return ACR_MINOR_VERSION; + break; + case 2: + return ACR_PATCH_VERSION; + break; + default: + break; + } + return -1; +} + +ACR_JNI_EXPORT_DECLARE(jboolean, Version, isDev)(ACR_JNISTDARGS) +{ + UNREFERENCED_STDARGS; +#if ACR_IS_DEV_VERSION + return JNI_TRUE; +#else + return JNI_FALSE; +#endif +} + +ACR_JNI_EXPORT_DECLARE(jstring, Version, getBuildmark)(ACR_JNISTDARGS) +{ + UNREFERENCED_O; + return CSTR_TO_JSTRING(ACR_GetLibraryBuilt()); +} Propchange: commons/sandbox/runtime/trunk/src/main/native/shared/version.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestOS.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestOS.java?rev=764889&r1=764888&r2=764889&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestOS.java (original) +++ commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestOS.java Tue Apr 14 17:26:47 2009 @@ -58,10 +58,18 @@ System.out.println("Processor " + OS.getProcessor()); System.out.println("Data Model " + OS.getDataModel()); System.out.println("Hardware " + OS.getHardwarePlatform()); + System.out.println(); JavaVersion v = new JavaVersion(); - System.out.println("JavaVerion:"); + System.out.println("Java Version:"); System.out.println("Name " + v.getSysname()); System.out.println("Processor " + v.getProcessor()); + System.out.println(); + System.out.println("Library Version:"); + System.out.println("Major " + Version.MAJOR); + System.out.println("Minor " + Version.MINOR); + System.out.println("Patch " + Version.PATCH); + System.out.println("Is Devel " + Version.IS_DEVELOPMENT); + System.out.println("Build at " + Version.BUILDMARK); }