[49029] trunk/base/src/macports1.0
toby at macports.org
toby at macports.org
Wed Apr 1 22:33:26 PDT 2009
Revision: 49029
http://trac.macports.org/changeset/49029
Author: toby at macports.org
Date: 2009-04-01 22:33:25 -0700 (Wed, 01 Apr 2009)
Log Message:
-----------
remove a bunch of dead code from macports1.0
Modified Paths:
--------------
trunk/base/src/macports1.0/Makefile
Removed Paths:
-------------
trunk/base/src/macports1.0/macports.h
trunk/base/src/macports1.0/options.h
trunk/base/src/macports1.0/portconf.c
trunk/base/src/macports1.0/session.c
trunk/base/src/macports1.0/session.h
trunk/base/src/macports1.0/util.c
trunk/base/src/macports1.0/util.h
Modified: trunk/base/src/macports1.0/Makefile
===================================================================
--- trunk/base/src/macports1.0/Makefile 2009-04-02 03:56:11 UTC (rev 49028)
+++ trunk/base/src/macports1.0/Makefile 2009-04-02 05:33:25 UTC (rev 49029)
@@ -1,6 +1,6 @@
SRCS= macports.tcl macports_dlist.tcl macports_util.tcl \
macports_autoconf.tcl macports_index.tcl macports_fastload.tcl
-OBJS= macports.o portconf.o session.o util.o
+OBJS= macports.o
SHLIB_NAME= MacPorts${SHLIB_SUFFIX}
INSTALLDIR= ${DESTDIR}${TCL_PACKAGE_DIR}/macports1.0
Deleted: trunk/base/src/macports1.0/macports.h
===================================================================
--- trunk/base/src/macports1.0/macports.h 2009-04-02 03:56:11 UTC (rev 49028)
+++ trunk/base/src/macports1.0/macports.h 2009-04-02 05:33:25 UTC (rev 49029)
@@ -1,60 +0,0 @@
-/*
- * macports.h
- * $Id$
- *
- * Copyright (c) 2003 Apple Computer, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __MACPORTS_H__
-#define __MACPORTS_H__
-
-typedef void* mp_session_t;
-typedef void* mp_software_t;
-
-typedef void* mp_array_t;
-mp_array_t mp_array_create();
-mp_array_t mp_array_create_copy(mp_array_t a);
-mp_array_t mp_array_retain(mp_array_t a);
-void mp_array_release(mp_array_t a);
-void mp_array_append(mp_array_t a, const void* data);
-int mp_array_get_count(mp_array_t a);
-const void* mp_array_get_index(mp_array_t a, int index);
-/* something for delete */
-
-mp_session_t mp_session_open();
-int mp_session_sync_index();
-
-int mp_software_search(mp_session_t mp, const char* regexp, mp_software_t* out_matches, int* out_count);
-mp_software_t mp_software_open_portfile(mp_session_t mp, const char* path, const char** options);
-mp_session_t mp_software_get_session(mp_software_t sw);
-mp_software_t mp_software_exec(mp_software_t sw, const char* target);
-int mp_softare_close(mp_software_t sw);
-
-int mp_session_close();
-
-#endif /* __MACPORTS_H__ */
Deleted: trunk/base/src/macports1.0/options.h
===================================================================
--- trunk/base/src/macports1.0/options.h 2009-04-02 03:56:11 UTC (rev 49028)
+++ trunk/base/src/macports1.0/options.h 2009-04-02 05:33:25 UTC (rev 49029)
@@ -1,127 +0,0 @@
-/*
- * options.h
- * $Id$
- *
- * Copyright (c) 2003 Apple Computer, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __OPTION_H__
-#define __OPTION_H__
-
-#include <sys/types.h>
-#include "util.h"
-
-/*
- * mp_options_t
- *
- * The mp_options_t type manages a collection of various options.
- * Each option has a type, either a string scalar, or an array
- * of strings. Options may also have a default value.
- *
- * Each mp_options_t should be thought of as a single namespace
- * for options.
- *
- * All option names and option values should be UTF-8 strings.
- *
- */
-
-typedef struct {
- u_int32_t type;
- u_int32_t size;
- union {
- void* ptr;
- char* string;
- u_int64_t integer;
- } data;
-} mp_desc_t;
-
-void mp_desc_free(mp_desc_t d);
- // uses free(3) on "array", "string", and "any" types
- // also performs mp_desc_free() on elements of arrays
-void mp_desc_copy(mp_desc_t* dst, mp_desc_t* src);
- // allocates any needed space with malloc(3)
-
-
-/* types */
-enum {
- MP_TYPE_NULL = 0x0000,
- MP_TYPE_DATA = 0x0001, // binary data
- MP_TYPE_UTF_8 = 0x0002, // UTF-8 string
- MP_TYPE_INT_64 = 0x0003, // 64-bit integer
-
- MP_TYPE_ARRAY = 0x0100 // array of descriptors
-};
-
-/* option flags */
-enum {
- MP_OPTIONS_FLAG_IMMUTABLE = 0x10000
-};
-
-typedef void* mp_options_t;
-
-
-/* result codes */
-enum {
- MP_OPTIONS_SUCCESS = 0,
-
- MP_OPTIONS_ERROR_UNDEFINED = -1,
- // the specified option has not been declared
-
- MP_OPTIONS_ERROR_WRONG_TYPE = -10,
- // array operation requested on a string type
- // type differs from previous declaration
-
- MP_OPTIONS_ERROR_WRONG_DEFAULT = -11,
- // default differs from previous declaration
-
- MP_OPTIONS_ERROR_IMMUTABLE = -12,
- // could not set the value, the option is immutable
-
- MP_OPTIONS_ERROR_LAST
-};
-
-mp_options_t mp_options_create();
-mp_options_t mp_options_retain(mp_options_t);
-void mp_options_release(mp_options_t);
-
-int mp_options_declare(mp_options_t o, char* name, int flags, mp_desc_t* default_value);
- // will copy default_value internally
-
-int mp_options_set_value(mp_options_t o, char* name, mp_desc_t* new_value);
- // will copy new_value internally
-
-int mp_options_get_value(mp_options_t o, char* name, mp_desc_t* out_value);
- // free out_value with mp_desc_free();
-
-int mp_options_set_ex_attr(mp_options_t o, char* name, char* key, mp_desc_t* new_value);
- // will copy new_value internally
-
-int mp_options_get_ex_attr(mp_options_t o, char* name, char* key, mp_desc_t* out_value);
- // free out_value with mp_desc_free();
-
-#endif /* __OPTION_H__ */
Deleted: trunk/base/src/macports1.0/portconf.c
===================================================================
--- trunk/base/src/macports1.0/portconf.c 2009-04-02 03:56:11 UTC (rev 49028)
+++ trunk/base/src/macports1.0/portconf.c 2009-04-02 05:33:25 UTC (rev 49029)
@@ -1,62 +0,0 @@
-/*
- * portconf.c
- * $Id$
- *
- * Copyright (c) 2003 Apple Computer, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <fcntl.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "macports.h"
-
-#include <tcl.h>
-
-static int set_session_option(ClientData clientData UNUSED, Tcl_Interp *interp UNUSED, int objc UNUSED, Tcl_Obj *CONST objv[] UNUSED) {
- return TCL_OK;
-}
-
-void parse_port_conf(mp_session_t mp UNUSED, char* path) {
- int fd = open(path, O_RDONLY, 0);
- if (fd != -1) {
- Tcl_Interp* interp = Tcl_CreateInterp();
- char* bootstrap_options[] = {"portdbpath", "libpath", "binpath", "master_site_local",
- "auto_path", "sources_conf", "prefix", NULL};
- char** option = bootstrap_options;
- while (*option != NULL) {
- Tcl_CreateObjCommand(interp, *option, &set_session_option, NULL, NULL);
- ++option;
- }
- /* XXX: parse config file */
- }
-}
Deleted: trunk/base/src/macports1.0/session.c
===================================================================
--- trunk/base/src/macports1.0/session.c 2009-04-02 03:56:11 UTC (rev 49028)
+++ trunk/base/src/macports1.0/session.c 2009-04-02 05:33:25 UTC (rev 49029)
@@ -1,113 +0,0 @@
-/*
- * session.c
- * $Id$
- *
- * Copyright (c) 2003 Apple Computer, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/param.h>
-
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <limits.h>
-
-#include "macports.h"
-
-#include <tcl.h>
-
-/*
- *
- * mp_session_t
- *
- */
-struct session {
- char* portdbpath;
- char* portconf;
- char* sources_conf;
- mp_array_t sources;
- char* portsharepath;
- char* registry_path;
-};
-
-mp_session_t mp_session_open() {
- struct session* mp = malloc(sizeof(struct session));
- char* path;
- /* mp_array_t conf_files = mp_array_create(); */
-
- mp->portconf = NULL;
-
- /* first look at PORTSRC for testing/debugging */
- path = getenv("PORTSRC");
- if (path != NULL && access(path, R_OK) == 0) {
- mp->portconf = strdup(path);
- /* mp_array_append(conf_files, mp->portconf); */
- }
-
- /* then look in ~/.macports/macports.conf */
- if (mp->portconf == NULL) {
- char* home = getenv("HOME");
- if (home != NULL) {
- char path[PATH_MAX];
- snprintf(path, sizeof(path), "%s/.macports/macports.conf", home);
- if (access(path, R_OK) == 0) {
- mp->portconf = strdup(path);
- /* mp_array_append(conf_files, mp->portconf); */
- }
- }
- }
-
- /* finally ${prefix}/etc/macports/macports.conf, or whatever path was configured */
- if (mp->portconf == NULL) {
- /* XXX: honor autoconf setting ($macports_conf_path) */
- char* path = "${prefix}/etc/macports/macports.conf";
- if (access(path, R_OK) == 0) {
- mp->portconf = strdup(path);
- /* mp_array_append(conf_files, mp->portconf); */
- }
- }
-
- /* foreach conf_files */
- {
- int fd = open(mp->portconf, O_RDONLY, 0);
- if (fd != -1) {
- /* XXX: parse config file */
- }
- }
-
- if (mp->sources_conf == NULL) {
- fprintf(stderr, "sources_conf must be set in ${prefix}/etc/macports/macports.conf or in your ~/.macports/macports.conf file\n");
- }
- return (mp_session_t)mp;
-}
-
Deleted: trunk/base/src/macports1.0/session.h
===================================================================
--- trunk/base/src/macports1.0/session.h 2009-04-02 03:56:11 UTC (rev 49028)
+++ trunk/base/src/macports1.0/session.h 2009-04-02 05:33:25 UTC (rev 49029)
@@ -1,38 +0,0 @@
-/*
- * session.h
- * $Id$
- *
- * Copyright (c) 2003 Apple Computer, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __SESSION_H__
-#define __SESSION_H__
-
-
-
-#endif /* __SESSION_H__ */
Deleted: trunk/base/src/macports1.0/util.c
===================================================================
--- trunk/base/src/macports1.0/util.c 2009-04-02 03:56:11 UTC (rev 49028)
+++ trunk/base/src/macports1.0/util.c 2009-04-02 05:33:25 UTC (rev 49029)
@@ -1,144 +0,0 @@
-/*
- * util.c
- * $Id$
- *
- * Copyright (c) 2003 Apple Computer, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "macports.h"
-#include "util.h"
-
-#include <tcl.h>
-
-static Tcl_Interp* _util_interp = NULL;
-
-/*
- *
- * mp_array_t
- *
- */
-
-mp_array_t mp_array_create() {
- Tcl_Obj* res = Tcl_NewListObj(0, NULL);
- if (_util_interp == NULL) _util_interp = Tcl_CreateInterp();
- return res;
-}
-
-mp_array_t mp_array_create_copy(mp_array_t a) {
- Tcl_Obj* array = (Tcl_Obj*)a;
- Tcl_Obj* res = Tcl_DuplicateObj(array);
- return res;
-}
-
-mp_array_t mp_array_retain(mp_array_t a) {
- Tcl_Obj* array = (Tcl_Obj*)a;
- Tcl_IncrRefCount(array);
- return (mp_array_t)array;
-}
-
-void mp_array_release(mp_array_t a) {
- Tcl_Obj* array = (Tcl_Obj*)a;
- Tcl_DecrRefCount(array);
-}
-
-void mp_array_append(mp_array_t a, const void* data) {
- Tcl_Obj* array = (Tcl_Obj*)a;
- Tcl_Obj* obj = Tcl_NewByteArrayObj((unsigned char*)&data, sizeof(void*));
- Tcl_ListObjAppendElement(_util_interp, array, obj);
-}
-
-int mp_array_get_count(mp_array_t a) {
- int result;
- Tcl_Obj* array = (Tcl_Obj*)a;
- Tcl_ListObjLength(_util_interp, array, &result);
- return result;
-}
-
-const void* mp_array_get_index(mp_array_t a, int index) {
- void** resultPtr;
- int size;
- Tcl_Obj* array = (Tcl_Obj*)a;
- Tcl_Obj* obj;
- Tcl_ListObjIndex(_util_interp, array, index, &obj);
- resultPtr = (void**)Tcl_GetByteArrayFromObj(obj, &size);
- return *resultPtr;
-}
-
-
-
-/*
- *
- * mp_hash_t
- *
- */
-struct hashtable {
- Tcl_HashTable table;
- int refcount;
-};
-
-mp_hash_t mp_hash_create() {
- struct hashtable* hash = malloc(sizeof(struct hashtable));
- Tcl_InitHashTable(&hash->table, TCL_STRING_KEYS);
- hash->refcount = 1;
- return (mp_hash_t)hash;
-}
-
-mp_hash_t mp_hash_retain(mp_hash_t h) {
- struct hashtable* hash = (struct hashtable*)h;
- ++hash->refcount;
- return h;
-}
-
-void mp_hash_release(mp_hash_t h) {
- struct hashtable* hash = (struct hashtable*)h;
- --hash->refcount;
- if (hash->refcount == 0) {
- Tcl_DeleteHashTable(&hash->table);
- free(hash);
- }
-}
-
-void mp_hash_set_value(mp_hash_t h, const void* key, const void* data) {
- struct hashtable* hash = (struct hashtable*)h;
- int created;
- Tcl_HashEntry* entry = Tcl_CreateHashEntry(&hash->table, key, &created);
- Tcl_SetHashValue(entry, (ClientData)data);
-}
-
-const void* mp_hash_get_value(mp_hash_t h, const void* key) {
- struct hashtable* hash = (struct hashtable*)h;
- Tcl_HashEntry* entry = Tcl_FindHashEntry(&hash->table, key);
- if (entry != NULL) {
- return (const void*)Tcl_GetHashValue(entry);
- } else {
- return NULL;
- }
-}
Deleted: trunk/base/src/macports1.0/util.h
===================================================================
--- trunk/base/src/macports1.0/util.h 2009-04-02 03:56:11 UTC (rev 49028)
+++ trunk/base/src/macports1.0/util.h 2009-04-02 05:33:25 UTC (rev 49029)
@@ -1,46 +0,0 @@
-/*
- * util.h
- * $Id$
- *
- * Copyright (c) 2003 Apple Computer, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __UTIL_H__
-#define __UTIL_H__
-
-typedef void* mp_hash_t;
-mp_hash_t mp_hash_create();
-mp_hash_t mp_hash_create_copy(mp_hash_t h);
-mp_hash_t mp_hash_retain(mp_hash_t h);
-void mp_hash_release(mp_hash_t h);
-void mp_hash_set_value(mp_hash_t h, const void* key, const void* data);
-int mp_hash_get_count(mp_hash_t h);
-const void* mp_hash_get_value(mp_hash_t h, const void* key);
-/* something for delete */
-
-#endif /* __UTIL_H__ */
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090401/86da0b2d/attachment-0001.html>
More information about the macports-changes
mailing list