tcladdressbook-commits Mailing List for TclAddressBook (Page 10)
Status: Alpha
Brought to you by:
bdesgraupes
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(114) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(37) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(52) |
Aug
(70) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
| 2005 |
Jan
|
Feb
|
Mar
(2) |
Apr
(9) |
May
|
Jun
(8) |
Jul
|
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <bde...@us...> - 2003-12-16 07:37:21
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1:/tmp/cvs-serv973/Source Modified Files: TclAddressBookUtils.h Log Message: [getme] and [record] return directly in resultObj Index: TclAddressBookUtils.h =================================================================== RCS file: /cvsroot/tcladdressbook/Source/TclAddressBookUtils.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- TclAddressBookUtils.h 13 Dec 2003 17:27:36 -0000 1.6 +++ TclAddressBookUtils.h 16 Dec 2003 07:37:18 -0000 1.7 @@ -38,7 +38,6 @@ void TclAB_GetAllValues(Tcl_Interp *interp, ABAddressBookRef ab, ABRecordRef inRecord, - CONST84 char * inVar, int inRecordType); void TclAB_GetValue(Tcl_Interp *interp, |
|
From: <bde...@us...> - 2003-12-16 07:37:16
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv948/Source
Modified Files:
TclAddressBookUtils.c
Log Message:
[getme] and [record] return directly in resultObj
Index: TclAddressBookUtils.c
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBookUtils.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- TclAddressBookUtils.c 14 Dec 2003 17:21:40 -0000 1.9
+++ TclAddressBookUtils.c 16 Dec 2003 07:37:12 -0000 1.10
@@ -26,9 +26,8 @@
*
* TclAB_GetAllValues --
*
- * This function is invoked to return the property/values pairs in an array.
- * The "inVar" argument must not be NULL because this is the name of the
- * variable in which the results are stored.
+ * This function is invoked to return the property/values pairs in the
+ * result object.
*
* Results:
* None.
@@ -41,21 +40,16 @@
void
TclAB_GetAllValues(Tcl_Interp *interp, ABAddressBookRef ab,
- ABRecordRef inRecord, CONST84 char * inVar,
- int inRecordType)
+ ABRecordRef inRecord, int inRecordType)
{
CFIndex theCount;
CFStringRef theValue, theProperty;
CFArrayRef allProps;
int i;
- if (inRecordType == rec_person) {
- allProps = ABCopyArrayOfPropertiesForRecordType(ab, kABPersonRecordType);
- } else {
- allProps = ABCopyArrayOfPropertiesForRecordType(ab, kABGroupRecordType);
- }
-
+ allProps = ABCopyArrayOfPropertiesForRecordType(ab, inRecordType ? kABPersonRecordType : kABGroupRecordType);
theCount = CFArrayGetCount(allProps);
+
for (i = 0; i < theCount; i++) {
// Get the property at index i
theProperty = CFArrayGetValueAtIndex(allProps, i);
@@ -70,8 +64,6 @@
}
}
CFRelease(allProps);
- // Store the result in the variable
- Tcl_SetVar2Ex(interp, inVar, NULL, Tcl_GetObjResult(interp), TCL_GLOBAL_ONLY);
}
@@ -1118,18 +1110,10 @@
// Get the address book
ab = ABGetSharedAddressBook();
-
- switch (inRecordType) {
- case rec_group:
- theItems = ABCopyArrayOfPropertiesForRecordType(ab, kABGroupRecordType);
- break;
-
- case rec_person:
- theItems = ABCopyArrayOfPropertiesForRecordType(ab, kABPersonRecordType);
- break;
- }
-
+ // Get the CFArray of properties
+ theItems = ABCopyArrayOfPropertiesForRecordType(ab, inRecordType ? kABPersonRecordType : kABGroupRecordType);
theCount = CFArrayGetCount(theItems);
+
for (i = 0; i < theCount; i++) {
// Get the record at index i
theProperty = CFArrayGetValueAtIndex(theItems,i);
@@ -1200,8 +1184,9 @@
// Create a CFArray
theArray = CFArrayCreateMutable(NULL, 0, NULL);
theProp = CFStringCreateWithCString(NULL, Tcl_GetStringFromObj(objv[4], &length), GetApplicationTextEncoding());
- // Populate the CFArray with the property pair
+ // Populate the CFArray with the property
CFArrayAppendValue(theArray, theProp);
+ CFRelease(theProp);
// Add the property to the Address Book
result = ABRemoveProperties(ab, inRecordType ? kABPersonRecordType : kABGroupRecordType, theArray);
@@ -1214,7 +1199,6 @@
}
Tcl_DecrRefCount(objv[4]);
- CFRelease(theProp);
CFRelease(theArray);
return result;
}
|
|
From: <bde...@us...> - 2003-12-16 07:37:08
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv882/Source
Modified Files:
TclAddressBook.c
Log Message:
[getme] and [record] return directly in resultObj
Index: TclAddressBook.c
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBook.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- TclAddressBook.c 13 Dec 2003 17:26:13 -0000 1.20
+++ TclAddressBook.c 16 Dec 2003 07:37:05 -0000 1.21
@@ -634,27 +634,20 @@
Tcl_Obj *resultPtr) /* Pointer to store the result. */
{
ABAddressBookRef ab;
- CONST84 char * var;
- int length;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "varname");
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, "");
return TCL_ERROR;
}
- var = Tcl_GetStringFromObj(objv[2], &length);
- if (!var || !strlen(var)) {
- Tcl_AppendStringsToObj(resultPtr, "Varname cannot be empty", (char *) NULL);
- return TCL_ERROR;
- }
-
+ Tcl_ResetResult(interp);
+
// Get the address book
ab = ABGetSharedAddressBook();
- // Store the record's data in the variable "var"
- TclAB_GetAllValues(interp, ab, ABGetMe(ab), var, rec_person);
+ // Store the record's data in the result object
+ TclAB_GetAllValues(interp, ab, ABGetMe(ab), rec_person);
- Tcl_ResetResult(interp);
return TCL_OK;
}
@@ -1104,7 +1097,7 @@
* See the user documentation for details on what it does.
*
* Syntax:
- * addressbook record recordID varname
+ * addressbook record recordID
*
* Results:
* A standard Tcl result.
@@ -1125,21 +1118,16 @@
{
ABAddressBookRef ab;
ABRecordRef theRecord;
- CONST84 char * var;
CONST84 char * theUID;
CFStringRef uidRef;
int kind, length, result;
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "recordID varname");
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "recordID");
return TCL_ERROR;
}
-
- var = Tcl_GetStringFromObj(objv[3], &length);
- if (!var || !strlen(var)) {
- Tcl_AppendStringsToObj(resultPtr, "Varname cannot be empty", (char *) NULL);
- return TCL_ERROR;
- }
+
+ Tcl_ResetResult(interp);
theUID = Tcl_GetStringFromObj(objv[2], &length);
uidRef = CFStringCreateWithCString(NULL, theUID, GetApplicationTextEncoding());
@@ -1159,11 +1147,10 @@
return TCL_ERROR;
}
- // Store the record's data in the variable "var"
- TclAB_GetAllValues(interp, ab, theRecord, var, kind);
+ // Store the record's data in the result object
+ TclAB_GetAllValues(interp, ab, theRecord, kind);
CFRelease(theRecord);
- Tcl_ResetResult(interp);
return TCL_OK;
}
|
|
From: <bde...@us...> - 2003-12-15 23:52:29
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1:/tmp/cvs-serv29892/Help Modified Files: TclAB_Home.aida Log Message: TclAB logo Index: TclAB_Home.aida =================================================================== RCS file: /cvsroot/tcladdressbook/Help/TclAB_Home.aida,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- TclAB_Home.aida 14 Dec 2003 20:25:37 -0000 1.1 +++ TclAB_Home.aida 15 Dec 2003 23:52:25 -0000 1.2 @@ -11,13 +11,15 @@ !! logo +((im Images/TclAB_logo.gif +TclAB Logo im)) ((/ Welcome to the Home Page of the Tcladdressbook extension for Tcl. /)) ((toc -((np +((np ((s1 Description The Tcladdressbook library is a Tcl extension defining a new command called |
|
From: <bde...@us...> - 2003-12-15 23:52:23
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1:/tmp/cvs-serv29860/Help Modified Files: TclAB.html Log Message: TclAB logo Index: TclAB.html =================================================================== RCS file: /cvsroot/tcladdressbook/Help/TclAB.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- TclAB.html 14 Dec 2003 20:25:31 -0000 1.1 +++ TclAB.html 15 Dec 2003 23:52:20 -0000 1.2 @@ -13,26 +13,18 @@ <!-- :Homepage: <A HREF="http://webperso.easyconnect.fr/bdesgraupes/">http://webperso.easyconnect.fr/bdesgraupes/</A> --> <!-- :Created: 2003-12-14 18:26:47 --> <!-- :Modified: 2003-12-14 18:26:52 --> -<!-- :Keywords: Address book, data base --> - - -<!-- logo --> - -<HR><BLOCKQUOTE><P><I> -This is the Home Page of the Tcladdressbook extension for Tcl. +<!-- :Keywords: Address book, data base --><P><!-- logo --> +<P><IMG SRC="Images/TclAB_logo.gif " ALT="TclAB Logo" ALIGN=bottom></P><P><HR><BLOCKQUOTE><P><I> + Welcome to the Home Page of the Tcladdressbook extension for Tcl. </I></P></BLOCKQUOTE><HR> <UL> <LI><A HREF="#M1">Description</A> <LI><A HREF="#M2">Requisites</A> -<LI><A HREF="#M3">Source code</A> -<LI><A HREF="#M4">Download</A> +<LI><A HREF="#M3">Download</A> +<LI><A HREF="#M4">Source code</A> <LI><A HREF="#M5">Help</A> <LI><A HREF="#M6">Bug reports</A> -</UL> - - - -<H2><A NAME="M1"></A> Description</H2> +</UL><P> <P><H2><A NAME="M1"></A> Description</H2> The Tcladdressbook library is a Tcl extension defining a new command called <I>addressbook</I> which lets you manipulate the OSX AddressBook. Under OSX (versions 10.2 or greater) every user has a single addressbook which all @@ -47,59 +39,37 @@ </PRE> The <I>addressbook</I> command has many subcommands such as <I>addressbook create, addressbook persons, addressbook record, addressbook set</I> etc. used -to invoke the various actions to perform. - -<H2><A NAME="M2"></A> Requisites</H2> +to invoke the various actions to perform.<P><H2><A NAME="M2"></A> Requisites</H2> This extension is useful only on Macintosh platforms with OSX System. Version 10.2 (aka -Jaguar) or greater of the system is required. - - -<H2><A NAME="M3"></A> Source code</H2> +Jaguar) or greater of the system is required.<P><H2><A NAME="M3"></A> Download</H2> +Binary releases of Tcladdressbook are available on the SourceForge site in +the <A href="http://sourceforge.net/project/showfiles.php?group_id=96169"> download area</A> +of the project.<P><H2><A NAME="M4"></A> Source code</H2> Tcladdressbook is an open source project. Its code is made publicly -available. It can be found on the +available and can be found on the <A href="http://sourceforge.net/projects/tcladdressbook"> SourceForge site</A>. <P> The code is under CVS control. You can retrieve the latest stage of development using any CVS client. <A href="http://sourceforge.net/cvs/?group_id=96169"> See instructions.</A> You can also <A href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcladdressbook"> browse the cvs repository</A> -online. - - -<H2><A NAME="M4"></A> Download</H2> -Binary releases of Tcladdressbook are available on the SourceForge site in -the <A href="http://sourceforge.net/project/showfiles.php?group_id=96169"> download area</A> -of the project. - - -<H2><A NAME="M5"></A> Help</H2> +online.<P><H2><A NAME="M5"></A> Help</H2> Tcladdressbook is distributed with a <A href="TclAddressBookHelp.html"> help file</A> containing the exact reference of all the commands and a <A href="TclAB_QuickStart.html"> Quick Start file</A> which is a tutorial giving examples -of how to use this extension. - - -<H2><A NAME="M6"></A> Bug reports</H2> - -<P> Bugs can be officially reported via the +of how to use this extension.<P><H2><A NAME="M6"></A> Bug reports</H2><P><P> Bugs can be officially reported via the <A href="http://sourceforge.net/tracker/?atid=613882&group_id=96169&func=browse"> Bug Tracker</A> of the project. You can also address <A href="http://sourceforge.net/tracker/?atid=613885&group_id=96169&func=browse"> feature requests</A> and propose -<A href="http://sourceforge.net/tracker/?atid=613884&group_id=96169&func=browse"> patches</A>. - -<P> Please e-mail about any question you might encounter: -<A HREF="mailto:bde...@us...">bde...@us...</A> - -<!-- logo SF --> +<A href="http://sourceforge.net/tracker/?atid=613884&group_id=96169&func=browse"> patches</A>.<P><P> Please e-mail about any question you might encounter: +<A HREF="mailto:bde...@us...">bde...@us...</A><P><!-- logo SF --> <!-- ------- --> <HR> <P> Tcladdressbook is hosted by -<A href="http://sourceforge.net"> <P><IMG SRC="http://sourceforge.net/sflogo.php?group_id=96169&type=4 " ALT="SourceForge.net Logo" ALIGN=bottom></P></A> - - +<A href="http://sourceforge.net"> <P><IMG SRC="http://sourceforge.net/sflogo.php?group_id=96169&type=4 " ALT="SourceForge.net Logo" ALIGN=bottom></P></A><P> </BODY> </HTML> |
|
From: <bde...@us...> - 2003-12-15 23:49:13
|
Update of /cvsroot/tcladdressbook/Help/Images In directory sc8-pr-cvs1:/tmp/cvs-serv29214/Help/Images Added Files: TclAB_logo.gif Log Message: TclAB logo --- NEW FILE: TclAB_logo.gif --- (This appears to be a binary file; contents omitted.) |
|
From: <bde...@us...> - 2003-12-15 23:48:07
|
Update of /cvsroot/tcladdressbook/Help/Images In directory sc8-pr-cvs1:/tmp/cvs-serv28996/Images Log Message: Directory /cvsroot/tcladdressbook/Help/Images added to the repository |
|
From: <bde...@us...> - 2003-12-15 22:54:40
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1:/tmp/cvs-serv18280/Help Modified Files: index.php Log Message: Forgotten html tag Index: index.php =================================================================== RCS file: /cvsroot/tcladdressbook/Help/index.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- index.php 14 Dec 2003 20:26:05 -0000 1.1 +++ index.php 15 Dec 2003 22:54:36 -0000 1.2 @@ -1,11 +1,4 @@ -/* - * If your project home page is not hosted with SourceForge.net, we encourage - * you to set up a simple redirect within your project web space (so people - * going to http://tcladdressbook.sourceforge.net/ will not get a blank page - * or old content. To set up a simple redirect, create an index.php file on - * shell.sourceforge.net in the /home/groups/t/tc/tcladdressbook/htdocs/ which - * contains (replace www.example.com with the correct URL): - * <?php header("Location: http://www.example.com/"); exit; ?> - */ - <?php header("Location: http://webperso.easyconnect.fr/bdesgraupes/DocHTML/TclAB.html"); exit; ?> + +<html> +</html> \ No newline at end of file |
|
From: <bde...@us...> - 2003-12-14 20:26:15
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1:/tmp/cvs-serv14274/Help Added Files: index.php Log Message: Home page redirect --- NEW FILE: index.php --- /* * If your project home page is not hosted with SourceForge.net, we encourage * you to set up a simple redirect within your project web space (so people * going to http://tcladdressbook.sourceforge.net/ will not get a blank page * or old content. To set up a simple redirect, create an index.php file on * shell.sourceforge.net in the /home/groups/t/tc/tcladdressbook/htdocs/ which * contains (replace www.example.com with the correct URL): * <?php header("Location: http://www.example.com/"); exit; ?> */ <?php header("Location: http://webperso.easyconnect.fr/bdesgraupes/DocHTML/TclAB.html"); exit; ?> |
|
From: <bde...@us...> - 2003-12-14 20:25:40
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1:/tmp/cvs-serv14175/Help Added Files: TclAB_Home.aida Log Message: Home page. First checkin. --- NEW FILE: TclAB_Home.aida --- :Title: TclAB :Project: addressbook extension for Tcl !! :Version: $Revision: 1.1 $ !! :CVSDate: $Date: 2003/12/14 20:25:37 $ !! :Author: Bernard Desgraupes <bde...@ea...> !! :Homepage: <http://webperso.easyconnect.fr/bdesgraupes/> !! :Created: 2003-12-14 18:26:47 :Modified: 2003-12-14 18:26:52 !! :Keywords: Address book, data base !! logo ((/ Welcome to the Home Page of the Tcladdressbook extension for Tcl. /)) ((toc ((np ((s1 Description The Tcladdressbook library is a Tcl extension defining a new command called ((i addressbook i)) which lets you manipulate the OSX AddressBook. Under OSX (versions 10.2 or greater) every user has a single addressbook which all applications are allowed to share. Thanks to the AddressBook framework any application can, if it wishes so, manipulate the data stored in the Address Book, create new records, modify or delete existing records etc. ((nl With the Tcladdressbook extension you can do this kind of manipulations in Tcl scripts. It can be loaded with the following instruction: ((| package require addressbook |)) The ((i addressbook i)) command has many subcommands such as ((i addressbook create, addressbook persons, addressbook record, addressbook set i)) etc. used to invoke the various actions to perform. ((s1 Requisites This extension is useful only on Macintosh platforms with OSX System. Version 10.2 (aka Jaguar) or greater of the system is required. ((s1 Download Binary releases of Tcladdressbook are available on the SourceForge site in the ((lk http://sourceforge.net/project/showfiles.php?group_id=96169 )) download area lk)) of the project. ((s1 Source code Tcladdressbook is an open source project. Its code is made publicly available and can be found on the ((lk http://sourceforge.net/projects/tcladdressbook )) SourceForge site lk)). ((nl The code is under CVS control. You can retrieve the latest stage of development using any CVS client. ((lk http://sourceforge.net/cvs/?group_id=96169 )) See instructions. lk)) You can also ((lk http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcladdressbook )) browse the cvs repository lk)) online. ((s1 Help Tcladdressbook is distributed with a ((lk TclAddressBookHelp.html )) help file lk)) containing the exact reference of all the commands and a ((lk TclAB_QuickStart.html )) Quick Start file lk)) which is a tutorial giving examples of how to use this extension. ((s1 Bug reports ((nl Bugs can be officially reported via the ((lk http://sourceforge.net/tracker/?atid=613882&group_id=96169&func=browse )) Bug Tracker lk)) of the project. You can also address ((lk http://sourceforge.net/tracker/?atid=613885&group_id=96169&func=browse )) feature requests lk)) and propose ((lk http://sourceforge.net/tracker/?atid=613884&group_id=96169&func=browse )) patches lk)). ((nl Please e-mail about any question you might encounter: <bde...@us...> !! logo SF !! ------- ((- ((nl Tcladdressbook is hosted by ((lk http://sourceforge.net )) ((im http://sourceforge.net/sflogo.php?group_id=96169&type=4 SourceForge.net Logo im)) lk)) |
|
From: <bde...@us...> - 2003-12-14 20:25:34
|
Update of /cvsroot/tcladdressbook/Help In directory sc8-pr-cvs1:/tmp/cvs-serv14151/Help Added Files: TclAB.html Log Message: Home page. First checkin. --- NEW FILE: TclAB.html --- <HTML> <HEAD> <TITLE>TclAB</TITLE> <META NAME=GENERATOR CONTENT="Aida Mode"> </HEAD> <BODY> <!-- :Title: TclAB --> <!-- :Project: addressbook extension for Tcl --> <!-- :Version: $Revision: 1.1 $ --> <!-- :CVSDate: $Date: 2003/12/14 20:25:31 $ --> <!-- :Author: Bernard Desgraupes <A HREF="mailto:bde...@ea...">bde...@ea...</A> --> <!-- :Homepage: <A HREF="http://webperso.easyconnect.fr/bdesgraupes/">http://webperso.easyconnect.fr/bdesgraupes/</A> --> <!-- :Created: 2003-12-14 18:26:47 --> <!-- :Modified: 2003-12-14 18:26:52 --> <!-- :Keywords: Address book, data base --> <!-- logo --> <HR><BLOCKQUOTE><P><I> This is the Home Page of the Tcladdressbook extension for Tcl. </I></P></BLOCKQUOTE><HR> <UL> <LI><A HREF="#M1">Description</A> <LI><A HREF="#M2">Requisites</A> <LI><A HREF="#M3">Source code</A> <LI><A HREF="#M4">Download</A> <LI><A HREF="#M5">Help</A> <LI><A HREF="#M6">Bug reports</A> </UL> <H2><A NAME="M1"></A> Description</H2> The Tcladdressbook library is a Tcl extension defining a new command called <I>addressbook</I> which lets you manipulate the OSX AddressBook. Under OSX (versions 10.2 or greater) every user has a single addressbook which all applications are allowed to share. Thanks to the AddressBook framework any application can, if it wishes so, manipulate the data stored in the Address Book, create new records, modify or delete existing records etc. <P> With the Tcladdressbook extension you can do this kind of manipulations in Tcl scripts. It can be loaded with the following instruction: <PRE> package require addressbook </PRE> The <I>addressbook</I> command has many subcommands such as <I>addressbook create, addressbook persons, addressbook record, addressbook set</I> etc. used to invoke the various actions to perform. <H2><A NAME="M2"></A> Requisites</H2> This extension is useful only on Macintosh platforms with OSX System. Version 10.2 (aka Jaguar) or greater of the system is required. <H2><A NAME="M3"></A> Source code</H2> Tcladdressbook is an open source project. Its code is made publicly available. It can be found on the <A href="http://sourceforge.net/projects/tcladdressbook"> SourceForge site</A>. <P> The code is under CVS control. You can retrieve the latest stage of development using any CVS client. <A href="http://sourceforge.net/cvs/?group_id=96169"> See instructions.</A> You can also <A href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcladdressbook"> browse the cvs repository</A> online. <H2><A NAME="M4"></A> Download</H2> Binary releases of Tcladdressbook are available on the SourceForge site in the <A href="http://sourceforge.net/project/showfiles.php?group_id=96169"> download area</A> of the project. <H2><A NAME="M5"></A> Help</H2> Tcladdressbook is distributed with a <A href="TclAddressBookHelp.html"> help file</A> containing the exact reference of all the commands and a <A href="TclAB_QuickStart.html"> Quick Start file</A> which is a tutorial giving examples of how to use this extension. <H2><A NAME="M6"></A> Bug reports</H2> <P> Bugs can be officially reported via the <A href="http://sourceforge.net/tracker/?atid=613882&group_id=96169&func=browse"> Bug Tracker</A> of the project. You can also address <A href="http://sourceforge.net/tracker/?atid=613885&group_id=96169&func=browse"> feature requests</A> and propose <A href="http://sourceforge.net/tracker/?atid=613884&group_id=96169&func=browse"> patches</A>. <P> Please e-mail about any question you might encounter: <A HREF="mailto:bde...@us...">bde...@us...</A> <!-- logo SF --> <!-- ------- --> <HR> <P> Tcladdressbook is hosted by <A href="http://sourceforge.net"> <P><IMG SRC="http://sourceforge.net/sflogo.php?group_id=96169&type=4 " ALT="SourceForge.net Logo" ALIGN=bottom></P></A> </BODY> </HTML> |
|
From: <bde...@us...> - 2003-12-14 17:21:58
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1:/tmp/cvs-serv10307/Source Modified Files: Changes.Log Log Message: Vs 1.0d10 Index: Changes.Log =================================================================== RCS file: /cvsroot/tcladdressbook/Source/Changes.Log,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- Changes.Log 13 Dec 2003 17:28:25 -0000 1.9 +++ Changes.Log 14 Dec 2003 17:21:53 -0000 1.10 @@ -31,6 +31,10 @@ = 1.0 released last update: ================================================================================ +================================================================================ += 1.0d10 last update: 2003-12-14 18:16:31 +================================================================================ + Fixes crashing bug when [set] is called with a multidictionary value. ================================================================================ = 1.0d9 last update: 2003-12-13 17:55:12 |
|
From: <bde...@us...> - 2003-12-14 17:21:43
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv10253/Source
Modified Files:
TclAddressBookUtils.c
Log Message:
Fixed crashing bug with [set] multidict values
Index: TclAddressBookUtils.c
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBookUtils.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- TclAddressBookUtils.c 13 Dec 2003 17:27:56 -0000 1.8
+++ TclAddressBookUtils.c 14 Dec 2003 17:21:40 -0000 1.9
@@ -1,7 +1,7 @@
/*
* File : "TclAddressBookUtils.c"
* Created: 2003-12-05 10:08:03
- * Last modification: 2003-12-13 07:44:50
+ * Last modification: 2003-12-13 21:25:43
* Author: Bernard Desgraupes
* e-mail: <bde...@ea...>
*
@@ -237,7 +237,6 @@
CFStringRef * theKeys;
CFStringRef * theVals;
-// Tcl_DStringStartSublist(&ds);
// Get the label
subLabel = ABMultiValueCopyLabelAtIndex(multiValue, j);
if (subLabel) {
@@ -258,27 +257,28 @@
CFDictionaryGetKeysAndValues(theDict, theKeys, theVals);
// Loop over all the entries
for (k = 0; k < dictCount; k++) {
- // Make a two items list for each key/value pair
- if (CFStringGetCString(theKeys[k], theStr, sizeof(theStr), theEncoding)
- && CFStringGetCString(theVals[k], theSubStr, sizeof(theSubStr), theEncoding)) {
- Tcl_DStringStartSublist(&ds);
- Tcl_DStringAppendElement(&ds, theStr);
- Tcl_DStringAppendElement(&ds, theSubStr);
- Tcl_DStringEndSublist(&ds);
+ if (!theKeys[k] && !theVals[k] ) {
+ // Make a two items list for each key/value pair
+ if (CFStringGetCString(theKeys[k], theStr, sizeof(theStr), theEncoding)
+ && CFStringGetCString(theVals[k], theSubStr, sizeof(theSubStr), theEncoding)) {
+ Tcl_DStringStartSublist(&ds);
+ Tcl_DStringAppendElement(&ds, theStr);
+ Tcl_DStringAppendElement(&ds, theSubStr);
+ Tcl_DStringEndSublist(&ds);
+ }
}
}
Tcl_DStringEndSublist(&ds);
Tcl_DStringEndSublist(&ds);
- DisposePtr(theKeys);
- DisposePtr(theVals);
} else {
// "Could not allocate memory for dictionary"
}
+ if (theKeys) DisposePtr(theKeys);
+ if (theVals) DisposePtr(theVals);
if (theDict) CFRelease(theDict);
}
CFRelease(localizedStr);
}
-// Tcl_DStringEndSublist(&ds);
}
TclAB_PutValueInResult(interp, thePropName, ds.string, allValues);
@@ -381,28 +381,12 @@
*
*----------------------------------------------------------------------
*/
-// case kABStringProperty:
-// case kABMultiStringProperty:
-// case kABDateProperty:
-// case kABMultiDateProperty:
-// case kABIntegerProperty:
-// case kABRealProperty:
-// case kABDictionaryProperty:
-// case kABMultiDictionaryProperty:
-// case kABMultiIntegerProperty:
-// case kABMultiRealProperty:
-
-// case kABArrayProperty:
-// case kABDataProperty:
-// case kABMultiArrayProperty:
-// case kABMultiDataProperty:
CFTypeRef
TclAB_MultiValueFromTcl(Tcl_Interp *interp, CONST84 char * inValue, ABPropertyType inPropType)
{
- CFStringRef theValue = NULL, subLabel, subKey, subValue;
+ CFTypeRef theValue = NULL, subLabel, subValue;
ABMutableMultiValueRef multiValue;
- CFMutableDictionaryRef theDict;
int j, k, listLen, subListLen, length, result = true;
SInt32 theSInt32;
double theDouble;
@@ -441,6 +425,7 @@
Tcl_ListObjLength(interp, objPtr, &listLen);
// Loop over all the sublists
for (j = 0; j < listLen; j++) {
+ // TclLindexList increments the RefCount
elemPtr = TclLindexList(interp, objPtr, Tcl_NewIntObj(j));
labelPtr = TclLindexList(interp, elemPtr, Tcl_NewIntObj(0));
valuePtr = TclLindexList(interp, elemPtr, Tcl_NewIntObj(1));
@@ -471,6 +456,9 @@
}
if (subValue) CFRelease(subValue);
if (subLabel) CFRelease(subLabel);
+ Tcl_DecrRefCount(elemPtr);
+ Tcl_DecrRefCount(labelPtr);
+ Tcl_DecrRefCount(valuePtr);
}
Tcl_DecrRefCount(objPtr);
return multiValue;
@@ -486,32 +474,38 @@
Tcl_ListObjLength(interp, objPtr, &listLen);
// Loop over all the label/dictionary pairs.
- // The dictionary itself is represented as a list of two items
- // sublists, each one corresponding to a key/value pair.
for (j = 0; j < listLen; j++) {
+ CFDictionaryRef theDict;
+ CFStringRef * theKeys;
+ CFStringRef * theVals;
+
+ // The dictionary itself is represented as a list of two-items
+ // sublists, each one corresponding to a key/value pair.
elemPtr = TclLindexList(interp, objPtr, Tcl_NewIntObj(j));
labelPtr = TclLindexList(interp, elemPtr, Tcl_NewIntObj(0));
dictPtr = TclLindexList(interp, elemPtr, Tcl_NewIntObj(1));
- Tcl_IncrRefCount(dictPtr);
Tcl_ListObjLength(interp, dictPtr, &subListLen);
- // Create and populate a CFDictionary with the key/value pairs
- theDict = CFDictionaryCreateMutable(NULL, subListLen, NULL, NULL);
- if (theDict) {
+
+ // Allocate memory to store the keys and values
+ theKeys = (CFStringRef*) NewPtrClear(sizeof(CFStringRef*) * subListLen);
+ theVals = (CFStringRef*) NewPtrClear(sizeof(CFStringRef*) * subListLen);
+ if ((theKeys != NULL) && (theVals != NULL)) {
// Loop over all the elements of the flat dict list
for (k = 0; k < subListLen; k++) {
subElemPtr = TclLindexList(interp, dictPtr, Tcl_NewIntObj(k));
keyPtr = TclLindexList(interp, subElemPtr, Tcl_NewIntObj(0));
valuePtr = TclLindexList(interp, subElemPtr, Tcl_NewIntObj(1));
// Make CFStrings out of the Tcl objects
- subKey = CFStringCreateWithCString(NULL, Tcl_GetStringFromObj(keyPtr, &length), theEncoding);
- subValue = CFStringCreateWithCString(NULL, Tcl_GetStringFromObj(valuePtr, &length), theEncoding);
- // Add the value/label pair to the dictionary
- if (subKey && subValue) {
- CFDictionaryAddValue(theDict, subKey, subValue);
- }
- if (subKey) CFRelease(subKey);
- if (subValue) CFRelease(subValue);
+ theKeys[k] = CFStringCreateWithCString(NULL, Tcl_GetStringFromObj(keyPtr, &length), theEncoding);
+ theVals[k] = CFStringCreateWithCString(NULL, Tcl_GetStringFromObj(valuePtr, &length), theEncoding);
+ Tcl_DecrRefCount(subElemPtr);
+ Tcl_DecrRefCount(keyPtr);
+ Tcl_DecrRefCount(valuePtr);
}
+ }
+ // Create and populate a CFDictionary with the key/value pairs
+ theDict = CFDictionaryCreate(NULL, theKeys, theVals, subListLen, NULL, NULL);
+ if (theDict) {
subLabel = CFStringCreateWithCString(NULL, Tcl_GetStringFromObj(labelPtr, &length), theEncoding);
if (subLabel) {
result = ABMultiValueAdd(multiValue, theDict, subLabel, NULL);
@@ -519,6 +513,10 @@
}
CFRelease(theDict);
}
+ if (theKeys) DisposePtr(theKeys);
+ if (theVals) DisposePtr(theVals);
+ Tcl_DecrRefCount(elemPtr);
+ Tcl_DecrRefCount(labelPtr);
Tcl_DecrRefCount(dictPtr);
}
Tcl_DecrRefCount(objPtr);
|
|
From: <bde...@us...> - 2003-12-14 10:53:18
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv12518/Source
Modified Files:
TclAddressBook.c
Log Message:
[getme] and [record] return keyed lists
Index: TclAddressBook.c
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBook.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- TclAddressBook.c 11 Dec 2003 10:35:13 -0000 1.19
+++ TclAddressBook.c 13 Dec 2003 17:26:13 -0000 1.20
@@ -614,7 +614,7 @@
* See the user documentation for details on what it does.
*
* Syntax:
- * addressbook getme arrayvar
+ * addressbook getme varname
*
* Results:
* A standard Tcl result.
@@ -631,23 +631,27 @@
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *CONST objv[], /* Argument values. */
- Tcl_Obj *resultPtr) /* Pointer to store the result. */
+ Tcl_Obj *resultPtr) /* Pointer to store the result. */
{
ABAddressBookRef ab;
CONST84 char * var;
int length;
if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "arrayvar");
+ Tcl_WrongNumArgs(interp, 2, objv, "varname");
return TCL_ERROR;
}
var = Tcl_GetStringFromObj(objv[2], &length);
-
+ if (!var || !strlen(var)) {
+ Tcl_AppendStringsToObj(resultPtr, "Varname cannot be empty", (char *) NULL);
+ return TCL_ERROR;
+ }
+
// Get the address book
ab = ABGetSharedAddressBook();
- // Store the record's data in the array variable "var"
+ // Store the record's data in the variable "var"
TclAB_GetAllValues(interp, ab, ABGetMe(ab), var, rec_person);
Tcl_ResetResult(interp);
@@ -1100,7 +1104,7 @@
* See the user documentation for details on what it does.
*
* Syntax:
- * addressbook record recordID arrayvar
+ * addressbook record recordID varname
*
* Results:
* A standard Tcl result.
@@ -1127,13 +1131,17 @@
int kind, length, result;
if (objc != 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "recordID arrayvar");
+ Tcl_WrongNumArgs(interp, 2, objv, "recordID varname");
return TCL_ERROR;
}
var = Tcl_GetStringFromObj(objv[3], &length);
+ if (!var || !strlen(var)) {
+ Tcl_AppendStringsToObj(resultPtr, "Varname cannot be empty", (char *) NULL);
+ return TCL_ERROR;
+ }
+
theUID = Tcl_GetStringFromObj(objv[2], &length);
-
uidRef = CFStringCreateWithCString(NULL, theUID, GetApplicationTextEncoding());
// Get the address book
ab = ABGetSharedAddressBook();
@@ -1151,7 +1159,7 @@
return TCL_ERROR;
}
- // Store the record's data in the array variable "var"
+ // Store the record's data in the variable "var"
TclAB_GetAllValues(interp, ab, theRecord, var, kind);
CFRelease(theRecord);
@@ -1573,7 +1581,7 @@
CFRelease(propertyRef);
return TCL_ERROR;
}
- TclAB_GetValue(interp, ab, propertyRef, valueRef, NULL, kind);
+ TclAB_GetValue(interp, ab, propertyRef, valueRef, 0, kind);
CFRelease(valueRef);
}
CFRelease(propertyRef);
|
|
From: <bde...@us...> - 2003-12-14 10:49:27
|
Update of /cvsroot/tcladdressbook/Help
In directory sc8-pr-cvs1:/tmp/cvs-serv12954/Help
Modified Files:
TclAddressBookHelp
Log Message:
Keyed lists
Index: TclAddressBookHelp
===================================================================
RCS file: /cvsroot/tcladdressbook/Help/TclAddressBookHelp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- TclAddressBookHelp 11 Dec 2003 08:46:36 -0000 1.6
+++ TclAddressBookHelp 13 Dec 2003 17:28:49 -0000 1.7
@@ -1,6 +1,6 @@
Title: Tcladdressbook Help
Project: addressbook extension for Tcl
-Modified: 2003-12-08 08:21:01
+Modified: 2003-12-13 18:24:43
Abstract
@@ -17,7 +17,7 @@
addressbook create (group | person) name ?-ingroup groupID?
addressbook delete recordID ?-fromgroup groupID?
addressbook export personID
- addressbook getme arrayvar
+ addressbook getme varname
addressbook groups ?-ids? ?-ingroup groupID?
addressbook image personID ?imageData?
addressbook import vCardData
@@ -26,7 +26,7 @@
addressbook property names (-groups | -persons)
addressbook property add (-groups | -persons) propName propType
addressbook property remove (-groups | -persons) propName
- addressbook record recordID arrayvar
+ addressbook record recordID varname
addressbook save
addressbook search ?(-groups | -persons)? ?-ids? ?-nocase? property op value
addressbook set recordID propertyName ?value?
@@ -93,11 +93,13 @@
a VCard. The result should be considered as binary data since it can
contain an image associated to the record.
- addressbook getme arrayvar
+ addressbook getme varname
This command retrieves all the data available in the database concerning
-the logged-in user ("Me") and stores it in the array variable specified by
-the arrayvar argument. See the addressbook record command
-for a description of the format of the various kinds of properties.
+the logged-in user ("Me") and stores it in the variable specified by
+the varname argument. The value of this variable takes the form of
+a keyed list: see the addressbook record command for a description
+of this format. Keyed lists can be very easily manipulated with the
+keylget and keylset commands defined in the TclX extension.
addressbook groups ?-ids? ?-ingroup groupID?
This command returns a list of all the existing group records: if no option
@@ -159,21 +161,19 @@
propName argument. One can get the list of all the existing
properties with the addressbook property names command.
- addressbook record recordID arrayvar
+ addressbook record recordID varname
This command retrieves all the data available in the database concerning
-the record with unique ID recordID and stores it in the array
-variable specified by the arrayvar argument. The keys of the array
-(as returned by the array names Tcl command) are the names of the
-properties: the values are the current values of the corresponding
-property. Only existing properties for the specified record are returned by
-this command: you should unset the arrayvar variable before
-invoking addressbook record in case you use this command repeatedly
-in order to be sure it does not keep stale information.
- The format used to return a particular value depends on the type of
+the record with unique ID recordID and stores it in the variable
+specified by the varname argument. The value of this variable
+takes the form of a keyed list: see the addressbook record command
+for a description of this format. Keyed lists can be very easily manipulated
+with the keylget and keylset commands defined in the TclX
+extension. One can also use the usual Tcl commands concerning lists.
+ The format used for a particular value depends on the type of
the property (string, integer, date, multivalue etc.). Some properties have
a multiple type: MultiString for fields like Email, Phone etc., MultiDate
for fields like ABDate, MultiDictionary for the Address field. In case of a
-multivalue, the returned value is a Tcl list. Each element of the list
+multivalue, the returned value is a keyed list itself. Each element of the list
corresponds to a single property. For instance:
the elements of a MultiString or MultiDate value list are two-elements
|
|
From: <bde...@us...> - 2003-12-14 10:39:48
|
Update of /cvsroot/tcladdressbook/Help
In directory sc8-pr-cvs1:/tmp/cvs-serv13017/Help
Modified Files:
TclAddressBookHelp.html
Log Message:
Keyed lists
Index: TclAddressBookHelp.html
===================================================================
RCS file: /cvsroot/tcladdressbook/Help/TclAddressBookHelp.html,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- TclAddressBookHelp.html 11 Dec 2003 08:46:42 -0000 1.6
+++ TclAddressBookHelp.html 13 Dec 2003 17:29:01 -0000 1.7
@@ -28,7 +28,7 @@
<UL><UL><LI><A HREF="#M7">addressbook create (group | person) <I>name</I> ?-ingroup <I>groupID</I>?</A></UL></UL>
<UL><UL><LI><A HREF="#M8">addressbook delete <I>recordID</I> ?-fromgroup <I>groupID</I>?</A></UL></UL>
<UL><UL><LI><A HREF="#M9">addressbook export <I>personID</I></A></UL></UL>
-<UL><UL><LI><A HREF="#M10">addressbook getme <I>arrayvar</I></A></UL></UL>
+<UL><UL><LI><A HREF="#M10">addressbook getme <I>varname</I></A></UL></UL>
<UL><UL><LI><A HREF="#M11">addressbook groups ?-ids? ?-ingroup <I>groupID</I>?</A></UL></UL>
<UL><UL><LI><A HREF="#M12">addressbook image <I>personID</I> ?<I>imageData</I>?</A></UL></UL>
<UL><UL><LI><A HREF="#M13">addressbook import <I>vCardData</I></A></UL></UL>
@@ -37,7 +37,7 @@
<UL><UL><LI><A HREF="#M16">addressbook property names (-groups | -persons)</A></UL></UL>
<UL><UL><LI><A HREF="#M17">addressbook property add (-groups | -persons) <I>propName</I> <I>propType</I></A></UL></UL>
<UL><UL><LI><A HREF="#M18">addressbook property remove (-groups | -persons) <I>propName</I></A></UL></UL>
-<UL><UL><LI><A HREF="#M19">addressbook record <I>recordID arrayvar</I></A></UL></UL>
+<UL><UL><LI><A HREF="#M19">addressbook record <I>recordID varname</I></A></UL></UL>
<UL><UL><LI><A HREF="#M20">addressbook save</A></UL></UL>
<UL><UL><LI><A HREF="#M21">addressbook search ?(-groups | -persons)? ?-ids? ?-nocase? <I>property op value</I></A></UL></UL>
<UL><UL><LI><A HREF="#M22">addressbook set <I>recordID propertyName</I> ?<I>value</I>?</A></UL></UL>
@@ -103,11 +103,13 @@
a VCard. The result should be considered as binary data since it can
contain an image associated to the record.
-<H4><A NAME="M10"></A> addressbook getme <I>arrayvar</I></H4>
+<H4><A NAME="M10"></A> addressbook getme <I>varname</I></H4>
This command retrieves all the data available in the database concerning
-the logged-in user ("Me") and stores it in the array variable specified by
-the <I>arrayvar</I> argument. See the <B>addressbook record</B> command
-for a description of the format of the various kinds of properties.
+the logged-in user ("Me") and stores it in the variable specified by
+the <I>varname</I> argument. The value of this variable takes the form of
+a keyed list: see the <B>addressbook record</B> command for a description
+of this format. Keyed lists can be very easily manipulated with the
+<B>keylget</B> and <B>keylset</B> commands defined in the TclX extension.
<H4><A NAME="M11"></A> addressbook groups ?-ids? ?-ingroup <I>groupID</I>?</H4>
This command returns a list of all the existing group records: if no option
@@ -169,21 +171,19 @@
<I>propName</I> argument. One can get the list of all the existing
properties with the <B>addressbook property names</B> command.
-<H4><A NAME="M19"></A> addressbook record <I>recordID arrayvar</I></H4>
+<H4><A NAME="M19"></A> addressbook record <I>recordID varname</I></H4>
This command retrieves all the data available in the database concerning
-the record with unique ID <I>recordID</I> and stores it in the array
-variable specified by the <I>arrayvar</I> argument. The keys of the array
-(as returned by the <B>array names</B> Tcl command) are the names of the
-properties: the values are the current values of the corresponding
-property. Only existing properties for the specified record are returned by
-this command: you should unset the <I>arrayvar</I> variable before
-invoking <B>addressbook record</B> in case you use this command repeatedly
-in order to be sure it does not keep stale information.
-<P> The format used to return a particular value depends on the type of
+the record with unique ID <I>recordID</I> and stores it in the variable
+specified by the <I>varname</I> argument. The value of this variable
+takes the form of a keyed list: see the <B>addressbook record</B> command
+for a description of this format. Keyed lists can be very easily manipulated
+with the <B>keylget</B> and <B>keylset</B> commands defined in the TclX
+extension. One can also use the usual Tcl commands concerning lists.
+<P> The format used for a particular value depends on the type of
the property (string, integer, date, multivalue etc.). Some properties have
a multiple type: MultiString for fields like Email, Phone etc., MultiDate
for fields like ABDate, MultiDictionary for the Address field. In case of a
-multivalue, the returned value is a Tcl list. Each element of the list
+multivalue, the returned value is a keyed list itself. Each element of the list
corresponds to a single property. For instance:
<UL>
<LI> the elements of a MultiString or MultiDate value list are two-elements
|
|
From: <bde...@us...> - 2003-12-14 10:39:48
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1:/tmp/cvs-serv12882/Source Modified Files: Changes.Log Log Message: Keyed lists var instead of array Index: Changes.Log =================================================================== RCS file: /cvsroot/tcladdressbook/Source/Changes.Log,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Changes.Log 13 Dec 2003 13:23:38 -0000 1.8 +++ Changes.Log 13 Dec 2003 17:28:25 -0000 1.9 @@ -33,12 +33,16 @@ ================================================================================ -= 1.0d9 last update: 2003-12-13 14:20:40 += 1.0d9 last update: 2003-12-13 17:55:12 ================================================================================ Command [remove] renamed to [delete]. - Commands return localized labels rather than their raw internal values. + Commands return localized labels rather than their raw internal values + (eliminating the ugly _$!<Home>!$_ etc.). Labelled values are formatted as lists suitable for TclX keyed lists commands. - + [getme] and [record] now return their result in a simple variable rather + than an array variable. The value of the variable is formatted as a keyed list + which can easily be manipulated by the keylget and keylset commands defined + in the TclX extension. ================================================================================ = 1.0d8 last update: 2003-12-11 07:42:21 |
|
From: <bde...@us...> - 2003-12-14 10:39:48
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv12781/Source
Modified Files:
TclAddressBookUtils.c
Log Message:
TclAB_PutValueInResult() builds keyed list
Index: TclAddressBookUtils.c
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBookUtils.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- TclAddressBookUtils.c 13 Dec 2003 13:23:13 -0000 1.7
+++ TclAddressBookUtils.c 13 Dec 2003 17:27:56 -0000 1.8
@@ -27,8 +27,8 @@
* TclAB_GetAllValues --
*
* This function is invoked to return the property/values pairs in an array.
- * The "var" argument must not be NULL because the pairs are store in this
- * array variable.
+ * The "inVar" argument must not be NULL because this is the name of the
+ * variable in which the results are stored.
*
* Results:
* None.
@@ -41,7 +41,7 @@
void
TclAB_GetAllValues(Tcl_Interp *interp, ABAddressBookRef ab,
- ABRecordRef inRecord, CONST84 char * var,
+ ABRecordRef inRecord, CONST84 char * inVar,
int inRecordType)
{
CFIndex theCount;
@@ -65,11 +65,13 @@
if (!theValue) {
continue;
}
- TclAB_GetValue(interp, ab, theProperty, theValue, var, inRecordType);
+ TclAB_GetValue(interp, ab, theProperty, theValue, 1, inRecordType);
CFRelease(theValue);
}
}
CFRelease(allProps);
+ // Store the result in the variable
+ Tcl_SetVar2Ex(interp, inVar, NULL, Tcl_GetObjResult(interp), TCL_GLOBAL_ONLY);
}
@@ -79,8 +81,9 @@
* TclAB_GetValue --
*
* This function is invoked to return a specific property/value pair.
- * Unlike in TclAB_GetAllValues(), the "var" argument can be NULL: in that
- * case the value is stored in the resultPtr.
+ * If the "allValues" argument is 0, the value is stored in the resultPtr
+ * replacing anything existing there. Otherwise it is appended to the
+ * resultPtr.
*
* Results:
* None.
@@ -98,7 +101,7 @@
void
TclAB_GetValue(Tcl_Interp *interp, ABAddressBookRef ab,
CFStringRef inProperty, CFStringRef inValue,
- CONST84 char * var, int inRecordType)
+ Boolean allValues, int inRecordType)
{
CFStringRef theValue, subValue, subLabel;
CFStringRef localizedStr;
@@ -132,7 +135,7 @@
case kABStringProperty:
// Get the entry for the string property
if (CFStringGetCString(theValue, theStr, sizeof(theStr), theEncoding)) {
- TclAB_SetArrayOrResult(interp, var, thePropName, theStr);
+ TclAB_PutValueInResult(interp, thePropName, theStr, allValues);
}
CFRelease(theValue);
break;
@@ -147,7 +150,7 @@
// [clock format 978307200 -gmt 1] ---> Mon Jan 01 00:00:00 GMT 2001
theAbsTime += kCFAbsoluteTimeIntervalSince1970;
sprintf(theStr, "%.0f", theAbsTime);
- TclAB_SetArrayOrResult(interp, var, thePropName, theStr);
+ TclAB_PutValueInResult(interp, thePropName, theStr, allValues);
CFRelease(theValue);
break;
@@ -155,7 +158,7 @@
case kABIntegerProperty:
if (CFNumberGetValue(theValue, kCFNumberSInt32Type, &theSInt32)) {
sprintf(theStr, "%d", theSInt32);
- TclAB_SetArrayOrResult(interp, var, thePropName, theStr);
+ TclAB_PutValueInResult(interp, thePropName, theStr, allValues);
}
CFRelease(theValue);
break;
@@ -183,7 +186,7 @@
if (subLabel) CFRelease(subLabel);
if (subValue) CFRelease(subValue);
}
- TclAB_SetArrayOrResult(interp, var, thePropName, ds.string);
+ TclAB_PutValueInResult(interp, thePropName, ds.string, allValues);
Tcl_DStringFree(&ds);
CFRelease(multiValue);
break;
@@ -214,7 +217,7 @@
if (subLabel) CFRelease(subLabel);
if (subValue) CFRelease(subValue);
}
- TclAB_SetArrayOrResult(interp, var, thePropName, ds.string);
+ TclAB_PutValueInResult(interp, thePropName, ds.string, allValues);
Tcl_DStringFree(&ds);
CFRelease(multiValue);
break;
@@ -278,7 +281,7 @@
// Tcl_DStringEndSublist(&ds);
}
- TclAB_SetArrayOrResult(interp, var, thePropName, ds.string);
+ TclAB_PutValueInResult(interp, thePropName, ds.string, allValues);
Tcl_DStringFree(&ds);
// Don't CFRelease the multiValue: each dict is released one after the other
CFRelease(multiValue);
@@ -298,10 +301,9 @@
/*
*----------------------------------------------------------------------
*
- * TclAB_SetArrayOrResult --
+ * TclAB_PutValueInResult --
*
- * This function is invoked to determine the type (group or person)
- * corresponding to a particular UID.
+ * This function is invoked to
*
* Results:
* None.
@@ -313,10 +315,17 @@
*/
void
-TclAB_SetArrayOrResult(Tcl_Interp *interp, CONST84 char * inVar, char * inPropName, char * inStr)
+TclAB_PutValueInResult(Tcl_Interp *interp, char * inPropName, char * inStr, Boolean allValues)
{
- if (inVar) {
- Tcl_SetVar2(interp, inVar, inPropName, inStr, 0);
+ if (allValues) {
+ int length;
+ Tcl_Obj * listPtr;
+ Tcl_Obj * objs[2];
+
+ objs[0] = Tcl_NewStringObj(inPropName, strlen(inPropName));
+ objs[1] = Tcl_NewStringObj(inStr, strlen(inStr));
+ listPtr = Tcl_NewListObj(2, objs);
+ Tcl_AppendElement(interp, Tcl_GetStringFromObj(listPtr, &length));
} else {
Tcl_SetObjResult(interp, Tcl_NewStringObj(inStr, strlen(inStr)));
}
|
|
From: <bde...@us...> - 2003-12-14 09:50:14
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1:/tmp/cvs-serv13312/Source Modified Files: TclAddressBook_version.h Log Message: Upped to 10 Index: TclAddressBook_version.h =================================================================== RCS file: /cvsroot/tcladdressbook/Source/TclAddressBook_version.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- TclAddressBook_version.h 11 Dec 2003 06:36:31 -0000 1.4 +++ TclAddressBook_version.h 13 Dec 2003 17:30:58 -0000 1.5 @@ -1,12 +1,12 @@ // File: "TclAddressBook_version.h" // Created: 2003-09-24 07:28:22 -// Last modification: 2003-12-11 07:32:42 +// Last modification: 2003-12-13 17:59:37 // Author: Bernard Desgraupes // Description: version numbering for Tcladdressbook #define TCLADDRESSBOOK_MAJOR 1 #define TCLADDRESSBOOK_MINOR 0 -#define TCLADDRESSBOOK_SUBMINOR 9 +#define TCLADDRESSBOOK_SUBMINOR 10 #define TCLADDRESSBOOK_STAGE 'd' // 'd' for developStage // 'a' for alphaStage |
|
From: <bde...@us...> - 2003-12-14 09:41:21
|
Update of /cvsroot/tcladdressbook/Help
In directory sc8-pr-cvs1:/tmp/cvs-serv12978/Help
Modified Files:
TclAddressBookHelp.aida
Log Message:
Keyed lists
Index: TclAddressBookHelp.aida
===================================================================
RCS file: /cvsroot/tcladdressbook/Help/TclAddressBookHelp.aida,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- TclAddressBookHelp.aida 11 Dec 2003 08:43:49 -0000 1.3
+++ TclAddressBookHelp.aida 13 Dec 2003 17:28:55 -0000 1.4
@@ -65,11 +65,13 @@
a VCard. The result should be considered as binary data since it can
contain an image associated to the record.
-((s3 addressbook getme ((i arrayvar i))
+((s3 addressbook getme ((i varname i))
This command retrieves all the data available in the database concerning
-the logged-in user ("Me") and stores it in the array variable specified by
-the ((i arrayvar i)) argument. See the ((b addressbook record b)) command
-for a description of the format of the various kinds of properties.
+the logged-in user ("Me") and stores it in the variable specified by
+the ((i varname i)) argument. The value of this variable takes the form of
+a keyed list: see the ((b addressbook record b)) command for a description
+of this format. Keyed lists can be very easily manipulated with the
+((b keylget b)) and ((b keylset b)) commands defined in the TclX extension.
((s3 addressbook groups ?-ids? ?-ingroup ((i groupID i))?
This command returns a list of all the existing group records: if no option
@@ -131,21 +133,19 @@
((i propName i)) argument. One can get the list of all the existing
properties with the ((b addressbook property names b)) command.
-((s3 addressbook record ((i recordID arrayvar i))
+((s3 addressbook record ((i recordID varname i))
This command retrieves all the data available in the database concerning
-the record with unique ID ((i recordID i)) and stores it in the array
-variable specified by the ((i arrayvar i)) argument. The keys of the array
-(as returned by the ((b array names b)) Tcl command) are the names of the
-properties: the values are the current values of the corresponding
-property. Only existing properties for the specified record are returned by
-this command: you should unset the ((i arrayvar i)) variable before
-invoking ((b addressbook record b)) in case you use this command repeatedly
-in order to be sure it does not keep stale information.
-((nl The format used to return a particular value depends on the type of
+the record with unique ID ((i recordID i)) and stores it in the variable
+specified by the ((i varname i)) argument. The value of this variable
+takes the form of a keyed list: see the ((b addressbook record b)) command
+for a description of this format. Keyed lists can be very easily manipulated
+with the ((b keylget b)) and ((b keylset b)) commands defined in the TclX
+extension. One can also use the usual Tcl commands concerning lists.
+((nl The format used for a particular value depends on the type of
the property (string, integer, date, multivalue etc.). Some properties have
a multiple type: MultiString for fields like Email, Phone etc., MultiDate
for fields like ABDate, MultiDictionary for the Address field. In case of a
-multivalue, the returned value is a Tcl list. Each element of the list
+multivalue, the returned value is a keyed list itself. Each element of the list
corresponds to a single property. For instance:
((lu
((li the elements of a MultiString or MultiDate value list are two-elements
|
|
From: <bde...@us...> - 2003-12-14 09:41:19
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1:/tmp/cvs-serv12711/Source Modified Files: TclAddressBookUtils.h Log Message: TclAB_PutValueInResult() Index: TclAddressBookUtils.h =================================================================== RCS file: /cvsroot/tcladdressbook/Source/TclAddressBookUtils.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- TclAddressBookUtils.h 13 Dec 2003 13:22:44 -0000 1.5 +++ TclAddressBookUtils.h 13 Dec 2003 17:27:36 -0000 1.6 @@ -45,7 +45,7 @@ ABAddressBookRef ab, CFStringRef theProperty, CFStringRef theValue, - CONST84 char * var, + Boolean allValues, int inRecordType); Boolean TclAB_SetValue(Tcl_Interp *interp, @@ -94,7 +94,7 @@ Tcl_Obj *resultPtr, int inRecordType); -void TclAB_SetArrayOrResult(Tcl_Interp *interp, CONST84 char * inVar, char * inPropName, char * inStr); +void TclAB_PutValueInResult(Tcl_Interp *interp, char * inPropName, char * inStr, Boolean allValues); Boolean TclAB_CheckGroup(Tcl_Interp *interp, ABAddressBookRef ab, |
|
From: <bde...@us...> - 2003-12-13 13:23:42
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1:/tmp/cvs-serv25319/Source Modified Files: Changes.Log Log Message: Localized labels. Keyed lists. Index: Changes.Log =================================================================== RCS file: /cvsroot/tcladdressbook/Source/Changes.Log,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Changes.Log 11 Dec 2003 09:23:26 -0000 1.7 +++ Changes.Log 13 Dec 2003 13:23:38 -0000 1.8 @@ -33,9 +33,11 @@ ================================================================================ -= 1.0d9 last update: 2003-12-11 07:42:57 += 1.0d9 last update: 2003-12-13 14:20:40 ================================================================================ Command [remove] renamed to [delete]. + Commands return localized labels rather than their raw internal values. + Labelled values are formatted as lists suitable for TclX keyed lists commands. ================================================================================ |
|
From: <bde...@us...> - 2003-12-13 13:23:17
|
Update of /cvsroot/tcladdressbook/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv25280/Source
Modified Files:
TclAddressBookUtils.c
Log Message:
Return localized labels. Better checking for NULLs.
Index: TclAddressBookUtils.c
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBookUtils.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- TclAddressBookUtils.c 9 Dec 2003 20:07:12 -0000 1.6
+++ TclAddressBookUtils.c 13 Dec 2003 13:23:13 -0000 1.7
@@ -1,7 +1,7 @@
/*
* File : "TclAddressBookUtils.c"
* Created: 2003-12-05 10:08:03
- * Last modification: 2003-12-09 09:19:04
+ * Last modification: 2003-12-13 07:44:50
* Author: Bernard Desgraupes
* e-mail: <bde...@ea...>
*
@@ -39,7 +39,8 @@
*----------------------------------------------------------------------
*/
-void TclAB_GetAllValues(Tcl_Interp *interp, ABAddressBookRef ab,
+void
+TclAB_GetAllValues(Tcl_Interp *interp, ABAddressBookRef ab,
ABRecordRef inRecord, CONST84 char * var,
int inRecordType)
{
@@ -89,12 +90,18 @@
*
*----------------------------------------------------------------------
*/
+// Multi dictionary
+// { {label1 { {key11 value11} {key12 value12} {key13 value13} } } {label2 { {key21 value2} {key22 value22} {key23 value23} } } }
+// Multi string / multi date
+// {label1 value1} {label2 value2} {label3 value3}
-void TclAB_GetValue(Tcl_Interp *interp, ABAddressBookRef ab,
+void
+TclAB_GetValue(Tcl_Interp *interp, ABAddressBookRef ab,
CFStringRef inProperty, CFStringRef inValue,
CONST84 char * var, int inRecordType)
{
CFStringRef theValue, subValue, subLabel;
+ CFStringRef localizedStr;
CFAbsoluteTime theAbsTime;
ABPropertyType thePropType;
ABMutableMultiValueRef multiValue;
@@ -108,6 +115,7 @@
Tcl_DString ds;
TextEncoding theEncoding = GetApplicationTextEncoding();
+
if (CFStringGetCString(inProperty, thePropName, sizeof(thePropName), theEncoding)) {
if (inRecordType == rec_person) {
@@ -154,30 +162,26 @@
case kABMultiStringProperty:
- // Create a multiValue and populate it with the items in the property
- multiValue = ABMultiValueCreateMutable();
multiValue = (ABMutableMultiValueRef) theValue;
-
mvCount = ABMultiValueCount(multiValue);
Tcl_DStringInit(&ds);
for (j = 0; j < mvCount; j++) {
subLabel = ABMultiValueCopyLabelAtIndex(multiValue, j);
subValue = ABMultiValueCopyValueAtIndex(multiValue, j);
- if (subValue
- && CFStringGetCString(subLabel, theLabelStr, sizeof(theLabelStr), theEncoding)
+ if (subLabel && subValue) {
+ localizedStr = ABCopyLocalizedPropertyOrLabel(subLabel);
+ if ( CFStringGetCString(localizedStr, theLabelStr, sizeof(theLabelStr), theEncoding)
&& CFStringGetCString(subValue, theSubStr, sizeof(theSubStr), theEncoding)) {
- if (mvCount > 1) {
Tcl_DStringStartSublist(&ds);
- }
- Tcl_DStringAppendElement(&ds, theLabelStr);
- Tcl_DStringAppendElement(&ds, theSubStr);
- CFRelease(subValue);
- CFRelease(subLabel);
- if (mvCount > 1) {
+ Tcl_DStringAppendElement(&ds, theLabelStr);
+ Tcl_DStringAppendElement(&ds, theSubStr);
Tcl_DStringEndSublist(&ds);
- }
+ }
+ CFRelease(localizedStr);
}
+ if (subLabel) CFRelease(subLabel);
+ if (subValue) CFRelease(subValue);
}
TclAB_SetArrayOrResult(interp, var, thePropName, ds.string);
Tcl_DStringFree(&ds);
@@ -186,33 +190,29 @@
case kABMultiDateProperty:
- // Create a multiValue and populate it with the items in the property
- multiValue = ABMultiValueCreateMutable();
multiValue = (ABMutableMultiValueRef) theValue;
-
mvCount = ABMultiValueCount(multiValue);
Tcl_DStringInit(&ds);
for (j = 0; j < mvCount; j++) {
subLabel = ABMultiValueCopyLabelAtIndex(multiValue, j);
subValue = ABMultiValueCopyValueAtIndex(multiValue, j);
- if (subValue
- && CFStringGetCString(subLabel, theLabelStr, sizeof(theLabelStr), theEncoding)) {
- if (mvCount > 1) {
+ if (subLabel && subValue) {
+ localizedStr = ABCopyLocalizedPropertyOrLabel(subLabel);
+ if (CFStringGetCString(localizedStr, theLabelStr, sizeof(theLabelStr), theEncoding)) {
Tcl_DStringStartSublist(&ds);
- }
- theAbsTime = CFDateGetAbsoluteTime(subValue);
- // See comment in kABDateProperty case above
- theAbsTime += kCFAbsoluteTimeIntervalSince1970;
- sprintf(theSubStr, "%.0f", theAbsTime);
- Tcl_DStringAppendElement(&ds, theLabelStr);
- Tcl_DStringAppendElement(&ds, theSubStr);
- CFRelease(subValue);
- CFRelease(subLabel);
- if (mvCount > 1) {
+ theAbsTime = CFDateGetAbsoluteTime(subValue);
+ // See comment in kABDateProperty case above
+ theAbsTime += kCFAbsoluteTimeIntervalSince1970;
+ sprintf(theSubStr, "%.0f", theAbsTime);
+ Tcl_DStringAppendElement(&ds, theLabelStr);
+ Tcl_DStringAppendElement(&ds, theSubStr);
Tcl_DStringEndSublist(&ds);
- }
+ }
+ CFRelease(localizedStr);
}
+ if (subLabel) CFRelease(subLabel);
+ if (subValue) CFRelease(subValue);
}
TclAB_SetArrayOrResult(interp, var, thePropName, ds.string);
Tcl_DStringFree(&ds);
@@ -221,16 +221,12 @@
case kABMultiDictionaryProperty:
- // Each item is made of a label and a CFDictionaryRef: the
- // dictionary is represented as a list of two elems lists (key/value).
-
- // Create a multiValue
- multiValue = ABMultiValueCreateMutable();
multiValue = (ABMutableMultiValueRef) theValue;
-
mvCount = ABMultiValueCount(multiValue);
Tcl_DStringInit(&ds);
+ // Each item is made of a label and a CFDictionaryRef: the
+ // dictionary is represented as a list of two elems lists (key/value).
for (j = 0; j < mvCount; j++) {
// Foreach CFDictionaryRef
CFDictionaryRef theDict;
@@ -238,45 +234,54 @@
CFStringRef * theKeys;
CFStringRef * theVals;
+// Tcl_DStringStartSublist(&ds);
// Get the label
subLabel = ABMultiValueCopyLabelAtIndex(multiValue, j);
- CFStringGetCString(subLabel, theLabelStr, sizeof(theLabelStr), theEncoding);
- // Get the dict
- theDict = ABMultiValueCopyValueAtIndex(multiValue, j);
- dictCount = CFDictionaryGetCount(theDict);
- // Allocate memory to store the keys and values
- theKeys = (CFStringRef*) NewPtrClear(sizeof(CFStringRef*) * dictCount);
- theVals = (CFStringRef*) NewPtrClear(sizeof(CFStringRef*) * dictCount);
- if ((NULL != theKeys) && (NULL != theVals)) {
- Tcl_DStringStartSublist(&ds);
- Tcl_DStringAppendElement(&ds, theLabelStr);
- Tcl_DStringStartSublist(&ds);
- // Fill the keys and values arrays from this dictionary
- CFDictionaryGetKeysAndValues(theDict, theKeys, theVals);
-
- for (k = 0; k < dictCount; k++) {
- // Make a two items list for each key/value pair
- if (CFStringGetCString(theKeys[k], theStr, sizeof(theStr), theEncoding)
- && CFStringGetCString(theVals[k], theSubStr, sizeof(theSubStr), theEncoding)) {
+ if (subLabel) {
+ localizedStr = ABCopyLocalizedPropertyOrLabel(subLabel);
+ CFRelease(subLabel);
+ if (CFStringGetCString(localizedStr, theLabelStr, sizeof(theLabelStr), theEncoding)) {
+ // Get the dict
+ theDict = ABMultiValueCopyValueAtIndex(multiValue, j);
+ dictCount = CFDictionaryGetCount(theDict);
+ // Allocate memory to store the keys and values
+ theKeys = (CFStringRef*) NewPtrClear(sizeof(CFStringRef*) * dictCount);
+ theVals = (CFStringRef*) NewPtrClear(sizeof(CFStringRef*) * dictCount);
+ if ((theKeys != NULL) && (theVals != NULL)) {
Tcl_DStringStartSublist(&ds);
- Tcl_DStringAppendElement(&ds, theStr);
- Tcl_DStringAppendElement(&ds, theSubStr);
+ Tcl_DStringAppendElement(&ds, theLabelStr);
+ Tcl_DStringStartSublist(&ds);
+ // Fill the keys and values arrays from this dictionary
+ CFDictionaryGetKeysAndValues(theDict, theKeys, theVals);
+ // Loop over all the entries
+ for (k = 0; k < dictCount; k++) {
+ // Make a two items list for each key/value pair
+ if (CFStringGetCString(theKeys[k], theStr, sizeof(theStr), theEncoding)
+ && CFStringGetCString(theVals[k], theSubStr, sizeof(theSubStr), theEncoding)) {
+ Tcl_DStringStartSublist(&ds);
+ Tcl_DStringAppendElement(&ds, theStr);
+ Tcl_DStringAppendElement(&ds, theSubStr);
+ Tcl_DStringEndSublist(&ds);
+ }
+ }
Tcl_DStringEndSublist(&ds);
- }
- }
- Tcl_DStringEndSublist(&ds);
- Tcl_DStringEndSublist(&ds);
- DisposePtr(theKeys);
- DisposePtr(theVals);
- }
- CFRelease(theDict);
- CFRelease(subLabel);
+ Tcl_DStringEndSublist(&ds);
+ DisposePtr(theKeys);
+ DisposePtr(theVals);
+ } else {
+ // "Could not allocate memory for dictionary"
+ }
+ if (theDict) CFRelease(theDict);
+ }
+ CFRelease(localizedStr);
+ }
+// Tcl_DStringEndSublist(&ds);
}
TclAB_SetArrayOrResult(interp, var, thePropName, ds.string);
Tcl_DStringFree(&ds);
- // Don't CFRelease: each dict is released one after the other
- // CFRelease(multiValue);
+ // Don't CFRelease the multiValue: each dict is released one after the other
+ CFRelease(multiValue);
break;
@@ -307,7 +312,8 @@
*----------------------------------------------------------------------
*/
-void TclAB_SetArrayOrResult(Tcl_Interp *interp, CONST84 char * inVar, char * inPropName, char * inStr)
+void
+TclAB_SetArrayOrResult(Tcl_Interp *interp, CONST84 char * inVar, char * inPropName, char * inStr)
{
if (inVar) {
Tcl_SetVar2(interp, inVar, inPropName, inStr, 0);
@@ -332,7 +338,8 @@
*----------------------------------------------------------------------
*/
-Boolean TclAB_SetValue(Tcl_Interp *interp, ABRecordRef inRecord, CFStringRef inProperty,
+Boolean
+TclAB_SetValue(Tcl_Interp *interp, ABRecordRef inRecord, CFStringRef inProperty,
CONST84 char * inValue, ABPropertyType inPropType)
{
CFStringRef theValueRef = NULL;
@@ -381,7 +388,8 @@
// case kABMultiArrayProperty:
// case kABMultiDataProperty:
-CFStringRef TclAB_MultiValueFromTcl(Tcl_Interp *interp, CONST84 char * inValue, ABPropertyType inPropType)
+CFTypeRef
+TclAB_MultiValueFromTcl(Tcl_Interp *interp, CONST84 char * inValue, ABPropertyType inPropType)
{
CFStringRef theValue = NULL, subLabel, subKey, subValue;
ABMutableMultiValueRef multiValue;
@@ -451,9 +459,9 @@
// Add the value/label pair to the multivalue
if (subValue && subLabel) {
result = ABMultiValueAdd(multiValue, subValue, subLabel, NULL);
- CFRelease(subValue);
- CFRelease(subLabel);
}
+ if (subValue) CFRelease(subValue);
+ if (subLabel) CFRelease(subLabel);
}
Tcl_DecrRefCount(objPtr);
return multiValue;
@@ -479,25 +487,29 @@
Tcl_ListObjLength(interp, dictPtr, &subListLen);
// Create and populate a CFDictionary with the key/value pairs
theDict = CFDictionaryCreateMutable(NULL, subListLen, NULL, NULL);
-
- for (k = 0; k < subListLen; k++) {
- subElemPtr = TclLindexList(interp, dictPtr, Tcl_NewIntObj(k));
- keyPtr = TclLindexList(interp, subElemPtr, Tcl_NewIntObj(0));
- valuePtr = TclLindexList(interp, subElemPtr, Tcl_NewIntObj(1));
- // Make CFStrings out of the Tcl objects
- subKey = CFStringCreateWithCString(NULL, Tcl_GetStringFromObj(keyPtr, &length), theEncoding);
- subValue = CFStringCreateWithCString(NULL, Tcl_GetStringFromObj(valuePtr, &length), theEncoding);
- // Add the value/label pair to the dictionary
- if (subKey && subValue) {
- CFDictionaryAddValue(theDict, subKey, subValue);
- CFRelease(subKey);
- CFRelease(subValue);
+ if (theDict) {
+ // Loop over all the elements of the flat dict list
+ for (k = 0; k < subListLen; k++) {
+ subElemPtr = TclLindexList(interp, dictPtr, Tcl_NewIntObj(k));
+ keyPtr = TclLindexList(interp, subElemPtr, Tcl_NewIntObj(0));
+ valuePtr = TclLindexList(interp, subElemPtr, Tcl_NewIntObj(1));
+ // Make CFStrings out of the Tcl objects
+ subKey = CFStringCreateWithCString(NULL, Tcl_GetStringFromObj(keyPtr, &length), theEncoding);
+ subValue = CFStringCreateWithCString(NULL, Tcl_GetStringFromObj(valuePtr, &length), theEncoding);
+ // Add the value/label pair to the dictionary
+ if (subKey && subValue) {
+ CFDictionaryAddValue(theDict, subKey, subValue);
+ }
+ if (subKey) CFRelease(subKey);
+ if (subValue) CFRelease(subValue);
+ }
+ subLabel = CFStringCreateWithCString(NULL, Tcl_GetStringFromObj(labelPtr, &length), theEncoding);
+ if (subLabel) {
+ result = ABMultiValueAdd(multiValue, theDict, subLabel, NULL);
+ CFRelease(subLabel);
}
- }
- subLabel = CFStringCreateWithCString(NULL, Tcl_GetStringFromObj(labelPtr, &length), theEncoding);
- result = ABMultiValueAdd(multiValue, theDict, subLabel, NULL);
- CFRelease(theDict);
- CFRelease(subLabel);
+ CFRelease(theDict);
+ }
Tcl_DecrRefCount(dictPtr);
}
Tcl_DecrRefCount(objPtr);
@@ -528,7 +540,8 @@
*----------------------------------------------------------------------
*/
-int TclAB_TypeFromRecord(ABAddressBookRef ab, ABRecordRef inRecord)
+int
+TclAB_TypeFromRecord(ABAddressBookRef ab, ABRecordRef inRecord)
{
CFStringRef typeRef;
int kind;
@@ -575,7 +588,8 @@
*----------------------------------------------------------------------
*/
-Boolean TclAB_RecordFromUID(ABAddressBookRef ab, CFStringRef inUID,
+Boolean
+TclAB_RecordFromUID(ABAddressBookRef ab, CFStringRef inUID,
Tcl_Obj *resultPtr, ABRecordRef * outRecordRef)
{
*outRecordRef = ABCopyRecordForUniqueId(ab, inUID);
@@ -604,7 +618,8 @@
*----------------------------------------------------------------------
*/
-Boolean TclAB_CheckGroup(Tcl_Interp *interp, ABAddressBookRef ab, CONST84 char * inGroupUID,
+Boolean
+TclAB_CheckGroup(Tcl_Interp *interp, ABAddressBookRef ab, CONST84 char * inGroupUID,
CONST84 char * option, ABRecordRef * outGroupRef)
{
CFStringRef groupCFStr;
@@ -752,7 +767,8 @@
*----------------------------------------------------------------------
*/
-void TclAB_ResultListFromCFArray(Tcl_Interp *interp, Tcl_Obj *resultPtr,
+void
+TclAB_ResultListFromCFArray(Tcl_Interp *interp, Tcl_Obj *resultPtr,
CFArrayRef allElements, Boolean onlyID,
int inRecordType)
{
|
|
From: <bde...@us...> - 2003-12-13 13:22:47
|
Update of /cvsroot/tcladdressbook/Source In directory sc8-pr-cvs1:/tmp/cvs-serv25153/Source Modified Files: TclAddressBookUtils.h Log Message: TclAB_MultiValueFromTcl returns CFTypeRef Index: TclAddressBookUtils.h =================================================================== RCS file: /cvsroot/tcladdressbook/Source/TclAddressBookUtils.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- TclAddressBookUtils.h 9 Dec 2003 20:05:50 -0000 1.4 +++ TclAddressBookUtils.h 13 Dec 2003 13:22:44 -0000 1.5 @@ -54,7 +54,7 @@ CONST84 char * inValue, ABPropertyType inPropType); -CFStringRef TclAB_MultiValueFromTcl(Tcl_Interp *interp, +CFTypeRef TclAB_MultiValueFromTcl(Tcl_Interp *interp, CONST84 char * inValue, ABPropertyType inPropType); @@ -107,7 +107,7 @@ Tcl_Obj *resultPtr, ABRecordRef * outRecordRef); -extern Tcl_Obj * TclLindexList(Tcl_Interp* interp, +extern Tcl_Obj * TclLindexList(Tcl_Interp* interp, Tcl_Obj* listPtr, Tcl_Obj* argPtr ); |
|
From: <bde...@us...> - 2003-12-11 11:20:05
|
Update of /cvsroot/tcladdressbook/Source/TclAddressBook.pbproj
In directory sc8-pr-cvs1:/tmp/cvs-serv10424/Source/TclAddressBook.pbproj
Modified Files:
project.pbxproj
Log Message:
Checked Tcl Framework
Index: project.pbxproj
===================================================================
RCS file: /cvsroot/tcladdressbook/Source/TclAddressBook.pbproj/project.pbxproj,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- project.pbxproj 11 Dec 2003 10:43:00 -0000 1.1
+++ project.pbxproj 11 Dec 2003 11:20:02 -0000 1.2
@@ -201,6 +201,12 @@
settings = {
};
};
+ D1004D7805888A3F003C0555 = {
+ fileRef = F94429230420B8C2006F146B;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
//D10
//D11
//D12
@@ -228,6 +234,7 @@
F5509190036C35B40130931B,
F5A272830377DE8E01FEA954,
D1004D1205887D9B003C0555,
+ D1004D7805888A3F003C0555,
);
isa = PBXFrameworksBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
|