diff libpurple/plugins/tcl/tcl_ref.c @ 15822:32c366eeeb99

sed -ie 's/gaim/purple/g'
author Sean Egan <seanegan@gmail.com>
date Mon, 19 Mar 2007 07:01:17 +0000
parents 5fe8042783c1
children a910080ccf8b
line wrap: on
line diff
--- a/libpurple/plugins/tcl/tcl_ref.c	Mon Mar 19 06:11:46 2007 +0000
+++ b/libpurple/plugins/tcl/tcl_ref.c	Mon Mar 19 07:01:17 2007 +0000
@@ -1,7 +1,7 @@
 /**
- * @file tcl_ref.c Gaim Tcl typed references API
+ * @file tcl_ref.c Purple Tcl typed references API
  *
- * gaim
+ * purple
  *
  * Copyright (C) 2006 Ethan Blanton <eblanton@cs.purdue.edu>
  * 
@@ -23,45 +23,45 @@
 #include <tcl.h>
 #include <glib.h>
 
-#include "tcl_gaim.h"
+#include "tcl_purple.h"
 #include "stringref.h"
 
 /* Instead of all that internal representation mumbo jumbo, use these
- * macros to access the internal representation of a GaimTclRef */
+ * macros to access the internal representation of a PurpleTclRef */
 #define OBJ_REF_TYPE(obj) (obj->internalRep.twoPtrValue.ptr1)
 #define OBJ_REF_VALUE(obj) (obj->internalRep.twoPtrValue.ptr2)
 
-static Tcl_FreeInternalRepProc gaim_tcl_ref_free;
-static Tcl_DupInternalRepProc gaim_tcl_ref_dup;
-static Tcl_UpdateStringProc gaim_tcl_ref_update;
-static Tcl_SetFromAnyProc gaim_tcl_ref_set;
+static Tcl_FreeInternalRepProc purple_tcl_ref_free;
+static Tcl_DupInternalRepProc purple_tcl_ref_dup;
+static Tcl_UpdateStringProc purple_tcl_ref_update;
+static Tcl_SetFromAnyProc purple_tcl_ref_set;
 
-static Tcl_ObjType gaim_tcl_ref = {
-	"GaimTclRef",
-	gaim_tcl_ref_free,
-	gaim_tcl_ref_dup,
-	gaim_tcl_ref_update,
-	gaim_tcl_ref_set
+static Tcl_ObjType purple_tcl_ref = {
+	"PurpleTclRef",
+	purple_tcl_ref_free,
+	purple_tcl_ref_dup,
+	purple_tcl_ref_update,
+	purple_tcl_ref_set
 };
 
-void gaim_tcl_ref_init()
+void purple_tcl_ref_init()
 {
-	Tcl_RegisterObjType(&gaim_tcl_ref);
+	Tcl_RegisterObjType(&purple_tcl_ref);
 }
 
-void *gaim_tcl_ref_get(Tcl_Interp *interp, Tcl_Obj *obj, GaimStringref *type)
+void *purple_tcl_ref_get(Tcl_Interp *interp, Tcl_Obj *obj, PurpleStringref *type)
 {
-	if (obj->typePtr != &gaim_tcl_ref) {
-		if (Tcl_ConvertToType(interp, obj, &gaim_tcl_ref) != TCL_OK)
+	if (obj->typePtr != &purple_tcl_ref) {
+		if (Tcl_ConvertToType(interp, obj, &purple_tcl_ref) != TCL_OK)
 			return NULL;
 	}
-	if (strcmp(gaim_stringref_value(OBJ_REF_TYPE(obj)),
-		   gaim_stringref_value(type))) {
+	if (strcmp(purple_stringref_value(OBJ_REF_TYPE(obj)),
+		   purple_stringref_value(type))) {
 		if (interp) {
-			Tcl_Obj *error = Tcl_NewStringObj("Bad Gaim reference type: expected ", -1);
-			Tcl_AppendToObj(error, gaim_stringref_value(type), -1);
+			Tcl_Obj *error = Tcl_NewStringObj("Bad Purple reference type: expected ", -1);
+			Tcl_AppendToObj(error, purple_stringref_value(type), -1);
 			Tcl_AppendToObj(error, " but got ", -1);
-			Tcl_AppendToObj(error, gaim_stringref_value(OBJ_REF_TYPE(obj)), -1);
+			Tcl_AppendToObj(error, purple_stringref_value(OBJ_REF_TYPE(obj)), -1);
 			Tcl_SetObjResult(interp, error);
 		}
 		return NULL;
@@ -69,34 +69,34 @@
 	return OBJ_REF_VALUE(obj);
 }
 
-Tcl_Obj *gaim_tcl_ref_new(GaimStringref *type, void *value)
+Tcl_Obj *purple_tcl_ref_new(PurpleStringref *type, void *value)
 {
 	Tcl_Obj *obj = Tcl_NewObj();
-	obj->typePtr = &gaim_tcl_ref;
-	OBJ_REF_TYPE(obj) = gaim_stringref_ref(type);
+	obj->typePtr = &purple_tcl_ref;
+	OBJ_REF_TYPE(obj) = purple_stringref_ref(type);
 	OBJ_REF_VALUE(obj) = value;
 	Tcl_InvalidateStringRep(obj);
 	return obj;
 }
 
-static void gaim_tcl_ref_free(Tcl_Obj *obj)
+static void purple_tcl_ref_free(Tcl_Obj *obj)
 {
-	gaim_stringref_unref(OBJ_REF_TYPE(obj));
+	purple_stringref_unref(OBJ_REF_TYPE(obj));
 }
 
-static void gaim_tcl_ref_dup(Tcl_Obj *obj1, Tcl_Obj *obj2)
+static void purple_tcl_ref_dup(Tcl_Obj *obj1, Tcl_Obj *obj2)
 {
-	OBJ_REF_TYPE(obj2) = gaim_stringref_ref(OBJ_REF_TYPE(obj1));
+	OBJ_REF_TYPE(obj2) = purple_stringref_ref(OBJ_REF_TYPE(obj1));
 	OBJ_REF_VALUE(obj2) = OBJ_REF_VALUE(obj1);
 }
 
-static void gaim_tcl_ref_update(Tcl_Obj *obj)
+static void purple_tcl_ref_update(Tcl_Obj *obj)
 {
 	/* This is ugly on memory, but we pretty much have to either
 	 * do this or guesstimate lengths or introduce a varargs
 	 * function in here ... ugh. */
-	char *bytes = g_strdup_printf("gaim-%s:%p",
-				      gaim_stringref_value(OBJ_REF_TYPE(obj)),
+	char *bytes = g_strdup_printf("purple-%s:%p",
+				      purple_stringref_value(OBJ_REF_TYPE(obj)),
 				      OBJ_REF_VALUE(obj));
 
 	obj->length = strlen(bytes);
@@ -108,27 +108,27 @@
 /* This isn't as memory-efficient as setting could be, because we
  * essentially have to synthesize the Stringref here, where we would
  * really rather dup it.  Oh, well. */
-static int gaim_tcl_ref_set(Tcl_Interp *interp, Tcl_Obj *obj)
+static int purple_tcl_ref_set(Tcl_Interp *interp, Tcl_Obj *obj)
 {
 	char *bytes = Tcl_GetStringFromObj(obj, NULL);
 	char *ptr;
-	GaimStringref *type;
+	PurpleStringref *type;
 	void *value;
 
 	if (strlen(bytes) < 7
-	    || strncmp(bytes, "gaim-", 5)
+	    || strncmp(bytes, "purple-", 5)
 	    || (ptr = strchr(bytes, ':')) == NULL
 	    || (ptr - bytes) == 5)
 		goto badobject;
 
 	/* Bad Ethan */
 	*ptr = '\0';
-	type = gaim_stringref_new(bytes + 5);
+	type = purple_stringref_new(bytes + 5);
 	*ptr = ':';
 	ptr++;
 
 	if (sscanf(ptr, "%p", &value) == 0) {
-		gaim_stringref_unref(type);
+		purple_stringref_unref(type);
 		goto badobject;
 	}
 
@@ -137,7 +137,7 @@
 	if (obj->typePtr != NULL && obj->typePtr->freeIntRepProc != NULL)
 		obj->typePtr->freeIntRepProc(obj);
 
-	obj->typePtr = &gaim_tcl_ref;
+	obj->typePtr = &purple_tcl_ref;
 	OBJ_REF_TYPE(obj) = type;
 	OBJ_REF_VALUE(obj) = value;
 
@@ -146,7 +146,7 @@
 badobject:
 	if (interp) {
 		Tcl_SetObjResult(interp,
-				 Tcl_NewStringObj("invalid GaimTclRef representation", -1));
+				 Tcl_NewStringObj("invalid PurpleTclRef representation", -1));
 	}
 	return TCL_ERROR;
 }