Skip to Content.
Sympa Menu

cc-devel - [cc-devel] liblicense: named constant URIs

cc-devel AT lists.ibiblio.org

Subject: Developer discussion for Creative Commons technology and tools

List archive

Chronological Thread  
  • From: Peter Miller <millerp AT canb.auug.org.au>
  • To: creative commons developers <cc-devel AT lists.ibiblio.org>
  • Subject: [cc-devel] liblicense: named constant URIs
  • Date: Thu, 06 Sep 2007 13:18:27 +1000

Today on #cc there was some discussion about the use of helper functions
vs the use of named constant URIs. This came about as a comment by
paulproteus (sorry, don't know mapping from IRC handle to email address)
on a recent commit by me (pmiller) of the ll_license_get_creator and
ll_license_get_publisher functions.

The question was: which of the following is better in the public API?

ll_get_attribute(license_uri, LL_ATTRIBUTE_URI_CREATOR, 0)

or

ll_license_get_creator(license_uri)

The second form is quite simply a wrapper function which uses the first
form.

My feeling is that both are desirable. The first is great for
generality and experts, when code wants to loop over every attribute in
a license. The second form simply has less for beginners to get wrong.
Both forms can be made equally robust in the face of changes in the
spelling of the actual attribute URIs. We already had wrapper functions
like this before ll_license_get_creator and ll_license_get_publisher
were committed, so the API remains self consistent.

We agree on something: neither of us likes the
"http://creativecommons.org/ns#blah"; constant strings in the code. They
should appear exactly once, and replace uses with named constants.


A second point of discussion: which of the following forms should be
used to define the constants?

#define LL_ATTRIBUTE_URI_CREATOR "http://blah...";

or

extern const char LL_ATTRIBUTE_URI_CREATOR[];

we both like the second form, but for different reasons. Robustness
mentioned above would use the second form.


Attached is a patch which implements what we were talking about, or at
least what I *think* we were talking about. I haven't committed it yet,
I would like some discussion first.


Regards
Peter Miller <millerp AT canb.auug.org.au>
/\/\* http://miller.emu.id.au/pmiller/

PGP public key ID: 1024D/D0EDB64D
fingerprint = AD0A C5DF C426 4F03 5D53 2BDB 18D8 A4E2 D0ED B64D
See http://www.keyserver.net or any PGP keyserver for public key.

"This is terribly unsatisfying." "It's far more satisfying if you throw
it at someone." -- Final Cut Pro easter egg
MIME-Version: 1.0
Content-Type: application/aegis-patch
Subject: liblicense.0.4 - named constant URIs
Content-Name: liblicense.0.4.C034.patch
Content-Disposition: attachment; filename=liblicense.0.4.C034.patch
X-Aegis-Project-Name: liblicense.0.4
X-Aegis-Change-Number: 34

#
# This change set moves hard coded attribute URIs and rights URIs into
# named constants. This means that you can either use the helper
# functions (ll_get_name, ll_get_jurisdiction, etc) or use ll_get_
# attribute with an attribute named constant (LL_ATTRIBUTE_URI_NAME, LL_
# ATTRIBUTE_URI_JURISDICTION, etc).
#
# Aegis-Change-Set-Begin
# QlpoOTFBWSZTWSxi0JkAAW9fgAAQUGf/6j43ngq/99/qQAL8mMyiBoaTIIp6epqbZTAgYpkD
# TQNADINU9Jsg00KQ9T1A0AAAAAA5gAJgACYAAAAACSIEJk00ZFPU9T0TQaB6nqHqbJNqDTEm
# Ygv8gYSPfBJnQRBHl5cOJxXRkOk7AwDASVeEKR5PSlfWMQjWdY10d4vACuPljXCQEzMpAbqA
# KtnTbom2HB87igosj3ggEHMgN0e9uOYYcVQxUi6OLA5BFqnbatolrnRBJVc21VR2QwW5CKeJ
# z5HMOjUBaNgV9NcThLkPOStDFSyU6JRzNSMMkJCpc6pFXXYQQWuIkpYUJ7OBLTEMdTnc41VH
# 0ssjB0bOWNA9knFVkH3dd9ikSYriKELvQkZGhQ0asp3AE/Nwdiw3mBBBBouLekI3dDivDlzO
# ZydxTq4+B+Ocs1R0E7HOBMws6VDrocwtMxwNh8W7fHrtiO7DDsAUN/B3bvl7Ew62IOo027mI
# m4RAEgmAHJ/JRAq3ehqhAjeo0mYLXHw3xd00Loi7K5njSnhJlPLsd+EXxQYF3n7AqRVy1dl+
# Ly9OG3PlleBPQCnI/bhbX2EgJ0YDZWyhZBBnTKqnWLs5uZaKc/F9MBFsWgCv+IC414gA9iGh
# mtiEWSXNZrqjpjrXW8lEWd5YgCfQ6SdSygL9Thr6MGv5lcYBTTDm0SWSmGiZZBLSGQMmKuxM
# KK79V7dMimVX4YAN76NwENADYIgrsfdLdVEcd9fAjsO1LaDAsvWBBwGLe4C6d9twyRc1RvGn
# 32aa2itIHfiLWk6KPcfeBUkQZd0IIGXwERGybPdtYClra6mbODWVu4J046gPpsy2e0CaE6yx
# e2qmbx2AWVR9EFmMI3swzU0AaM+meq8Nd+FCvNlQNzfPRJ3i8SJMBiTqQjPc5ZK9wL6kSTu+
# ZM9WVIqLswyYCEzLB+iJFmqggosMBCVQIQwY2QCssswLAC2aAeeAFdxkEEGqcpQVAHtmIP+L
# uSKcKEgWMWhMgA==
# Aegis-Change-Set-End
#
Index: .indent.pro
--- .indent.pro
+++ .indent.pro
@@ -16,3 +16,8 @@
-TPyObject
-TLicenseChooser
-TPyMODINIT_FUNC
+-Tsqlite3
+-Traptor_statement
+-Traptor_serializer
+-Traptor_uri
+-TxmlNode
Index: liblicense/liblicense.h
--- liblicense/liblicense.h
+++ liblicense/liblicense.h
@@ -319,8 +319,104 @@
typedef char *ll_filename_t;

/**
+ * The LL_RIGHTS_URI_ATTRIBUTION string may be returned by the
+ * #ll_get_permits, #ll_get_requires and #ll_get_prohibits functions.
+ *
+ * credit be given to copyright holder and/or author
+ */
+extern const char LL_RIGHTS_URI_ATTRIBUTION[];
+
+/**
+ * The LL_RIGHTS_URI_COMMERCIAL_USE string may be returned by the
+ * #ll_get_permits, #ll_get_requires and #ll_get_prohibits functions.
+ *
+ * exercising rights for commercial purposes
+ */
+extern const char LL_RIGHTS_URI_COMMERCIAL_USE[];
+
+/**
+ * The LL_RIGHTS_URI_DERIVATIVE_WORKS string may be returned by the
+ * #ll_get_permits, #ll_get_requires and #ll_get_prohibits functions.
+ *
+ * creation and distribution of derivative works
+ */
+extern const char LL_RIGHTS_URI_DERIVATIVE_WORKS[];
+
+/**
+ * The LL_RIGHTS_URI_DISTRIBUTION string may be returned by the
+ * #ll_get_permits, #ll_get_requires and #ll_get_prohibits functions.
+ *
+ * distribution, public display, and publicly performance
+ */
+extern const char LL_RIGHTS_URI_DISTRIBUTION[];
+
+/**
+ * The LL_RIGHTS_URI_HIGH_INCOME_NATION_USE string may be returned
+ * by the #ll_get_permits, #ll_get_requires and #ll_get_prohibits
+ * functions.
+ *
+ * use in a non-developing country
+ */
+extern const char LL_RIGHTS_URI_HIGH_INCOME_NATION_USE[];
+
+/**
+ * The LL_RIGHTS_URI_NOTICE string may be returned by the
+ * #ll_get_permits, #ll_get_requires and #ll_get_prohibits functions.
+ *
+ * copyright and license notices be kept intact
+ */
+extern const char LL_RIGHTS_URI_NOTICE[];
+
+/**
+ * The LL_RIGHTS_URI_REPRODUCTION string may be returned by the
+ * #ll_get_permits, #ll_get_requires and #ll_get_prohibits functions.
+ *
+ * making multiple copies
+ */
+extern const char LL_RIGHTS_URI_REPRODUCTION[];
+
+/**
+ * The LL_RIGHTS_URI_SHARE_ALIKE string may be returned by the
+ * #ll_get_permits, #ll_get_requires and #ll_get_prohibits functions.
+ *
+ * derivative works be licensed under the same terms as the original work
+ */
+extern const char LL_RIGHTS_URI_SHARE_ALIKE[];
+
+/**
+ * The LL_RIGHTS_URI_SHARING string may be returned by the
+ * #ll_get_permits, #ll_get_requires and #ll_get_prohibits functions.
+ *
+ * noncommercial distribution, permits commercial derivatives, but only
+ * non-commercial distribution
+ */
+extern const char LL_RIGHTS_URI_SHARING[];
+
+/**
+ * The LL_RIGHTS_URI_SOURCE_CODE string may be returned by the
+ * #ll_get_permits, #ll_get_requires and #ll_get_prohibits functions.
+ *
+ * source code (the preferred form for making modifications) must be
+ * provided for all derivative works
+ */
+extern const char LL_RIGHTS_URI_SOURCE_CODE[];
+
+/**
+ * The LL_ATTRIBUTE_URI_REPLACED_BY string can be passed to the
+ * #ll_get_attribute function to obtain a license's successor.
+ */
+extern const char LL_ATTRIBUTE_URI_REPLACED_BY[];
+
+/**
+ * The LL_ATTRIBUTE_URI_JURISDICTION string can be passed to the
+ * #ll_get_attribute function to obtain a license's jurisdiction. The
+ * #ll_get_jurisdiction function does this very thing.
+ */
+extern const char LL_ATTRIBUTE_URI_JURISDICTION[];
+
+/**
* The ll_get_jurisdiction function is used to obtain the jurisdiction
- * code for the given license (the "coverage" attribute).
+ * code for the given license (the #LL_ATTRIBUTE_URI_JURISDICTION attribute).
*
* @param license_uri
* The URI of the license of interest
@@ -331,8 +427,15 @@
ll_juris_t ll_get_jurisdiction (const ll_uri_t license_uri);

/**
+ * The LL_ATTRIBUTE_URI_NAME string can be passed to the
+ * #ll_get_attribute function to obtain a license's name. The
+ * #ll_get_name function does this very thing.
+ */
+extern const char LL_ATTRIBUTE_URI_NAME[];
+
+/**
* The ll_get_name function is used to obtain the name of a license
- * (specifically, it gets the "title" attribute).
+ * (the #LL_ATTRIBUTE_URI_NAME attribute).
*
* @param license_uri
* The URI of the license of interest
@@ -343,8 +446,15 @@
char *ll_get_name (const ll_uri_t license_uri);

/**
+ * The LL_ATTRIBUTE_URI_VERSION string can be passed to the
+ * #ll_get_attribute function to obtain a license's version. The
+ * #ll_get_version function does this very thing.
+ */
+extern const char LL_ATTRIBUTE_URI_VERSION[];
+
+/**
* The ll_get_version functions is used to obtain the version of the
- * license of interest (the "hasVersion" attribute).
+ * license of interest (the #LL_ATTRIBUTE_URI_VERSION attribute).
*
* @param license_uri
* The URI of the license of interest
@@ -357,8 +467,15 @@
ll_version_t ll_get_version (const ll_uri_t license_uri);

/**
+ * The LL_ATTRIBUTE_URI_CREATOR string can be passed to the
+ * #ll_get_attribute function to obtain a license's creator. The
+ * #ll_license_get_creator function does this very thing.
+ */
+extern const char LL_ATTRIBUTE_URI_CREATOR[];
+
+/**
* The ll_license_get_creator function is used to obtain the creator of
- * the license of interest (the "creator" attribute).
+ * the license of interest (the #LL_ATTRIBUTE_URI_CREATOR attribute).
*
* @param license_uri
* The URI of the license of interest
@@ -369,8 +486,15 @@
char **ll_license_get_creator (const ll_uri_t license_uri);

/**
+ * The LL_ATTRIBUTE_URI_PUBLISHER string can be passed to the
+ * #ll_get_attribute function to obtain a license's publisher. The
+ * #ll_license_get_publisher function does this very thing.
+ */
+extern const char LL_ATTRIBUTE_URI_PUBLISHER[];
+
+/**
* The ll_license_get_publisher function is used to obtain the publisher
- * of the license of interest (the "publisher" attribute).
+ * of the license of interest (the #LL_ATTRIBUTE_PUBLISHER attribute).
*
* @param license_uri
* The URI of the license of interest
@@ -381,57 +505,81 @@
char **ll_license_get_publisher (const ll_uri_t license_uri);

/**
+ * The LL_ATTRIBUTE_URI_PROHIBITS string can be passed to the
+ * #ll_get_attribute function to obtain a list of the rights prohibited
+ * by a license. The #ll_get_prohibits function does this very
+ * thing.
+ */
+extern const char LL_ATTRIBUTE_URI_PROHIBITS[];
+
+/**
* The ll_get_prohibits function is used to determine the attributes
- * prohibited by a license.
+ * prohibited by a license (the #LL_ATTRIBUTE_URI_PROHIBITS attribute).
*
* @param license_uri
* The license of interest
* @returns
- * a NULL terminated list of attribute URIs the license prohibits.
+ * a NULL terminated list of rights URIs the license prohibits.
* Use #ll_free_list when you are done with it.
*/
char **ll_get_prohibits (const ll_uri_t license_uri);

/**
+ * The LL_ATTRIBUTE_URI_PERMITS string can be passed to the
+ * #ll_get_attribute function to obtain a list of the rights permitted
+ * by a license. The #ll_get_permits function does this very
+ * thing.
+ */
+extern const char LL_ATTRIBUTE_URI_PERMITS[];
+
+/**
* The ll_get_permits function is used to determine the attributes
- * permitted by a license.
+ * permitted by a license (the #LL_ATTRIBUTE_URI_PERMITS attribute).
*
* @param license_uri
* The license of interest
* @returns
- * a list of attribute URIs the license prohibits.
+ * a NULL terminated list of rights URIs the license prohibits.
* Use #ll_free_list when you are done with it.
*/
char **ll_get_permits (const ll_uri_t license_uri);

/**
+ * The LL_ATTRIBUTE_URI_REQUIRES string can be passed to the
+ * #ll_get_attribute function to obtain a list of the rights required
+ * by a license. The #ll_get_requires function does this very
+ * thing.
+ */
+extern const char LL_ATTRIBUTE_URI_REQUIRES[];
+
+/**
* The ll_get_requires function is used to determine the attributes
- * required by a license.
+ * required by a license (the #LL_ATTRIBUTE_URI_REQUIRES attribute).
*
* @param license_uri
* The license of interest
* @returns
- * a list of attribute URIs the license prohibits.
+ * a NULL terminated list of rights URIs the license requires.
* use #ll_free_list when you are done with it.
*/
char **ll_get_requires (const ll_uri_t license_uri);

/**
* The ll_get_attribute function is used to obtain the names of all
- * attributes of the given license which havre the given value.
+ * attributes of the given license which have the given URI.
*
* @param license_uri
* The license of interest
- * @param attr_val
- * The attribute value of interest (permitted, required, prohibited)
+ * @param attribute_uri
+ * The attribute URI of interest (e.g. #LL_ATTRIBUTE_URI_PERMITS)
* @param locale
* non-zero if $LANG to be used,
* zero if not relevant
* @returns
- * a list of attribute URIs of the license with matching values.
- * Use #ll_free_list when you are done with it.
+ * a NULL terminated list of strings,
+ * use #ll_free_list when you are done with it.
*/
-char **ll_get_attribute (ll_uri_t license_uri, ll_attribute_t attr_val,
+char **ll_get_attribute (ll_uri_t license_uri, const char *attribute_uri,
int locale);

/**
@@ -697,8 +845,8 @@
* @param needle
* The string to be searched for
* @returns
- * 1 if the needle is found in the haystack,
- * 0 if not found.
+ * non-zero (true) if the needle is found in the haystack,
+ * zero (false) if not found.
*/
int _ll_contains_token (const char *haystack, const char *needle);

@@ -750,6 +898,10 @@
0 \
};

+/**
+ * The LL_DEPRECATED define is used to mark deprecated functions as
+ * such, when compiling woth GCC. All other compilers unaffected.
+ */
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
#define LL_DEPRECATED __attribute__((deprecated))
#else
Index: liblicense/license_get_creator.c
--- liblicense/license_get_creator.c
+++ liblicense/license_get_creator.c
@@ -21,8 +21,11 @@
#include <liblicense/liblicense.h>


+const char LL_ATTRIBUTE_CREATOR[] =
+ "http://purl.org/dc/elements/1.1/creator";;
+
char **
ll_license_get_creator (ll_uri_t uri)
{
- return ll_get_attribute (uri, "http://purl.org/dc/elements/1.1/creator";,
0);
+ return ll_get_attribute (uri, LL_ATTRIBUTE_CREATOR, 0);
}
Index: liblicense/license_get_publisher.c
--- liblicense/license_get_publisher.c
+++ liblicense/license_get_publisher.c
@@ -20,10 +20,11 @@

#include <liblicense/liblicense.h>

+const char LL_ATTRIBUTE_URI_PUBLISHER[] =
+ "http://purl.org/dc/elements/1.1/publisher";;

char **
ll_license_get_publisher (ll_uri_t uri)
{
- return ll_get_attribute (uri, "http://purl.org/dc/elements/1.1/publisher";,
- 0);
+ return ll_get_attribute (uri, LL_ATTRIBUTE_URI_PUBLISHER, 0);
}
Index: liblicense/license_info.c
--- liblicense/license_info.c
+++ liblicense/license_info.c
@@ -36,6 +36,30 @@
#include "config.h"
#endif

+const char LL_RIGHTS_URI_ATTRIBUTION[] =
+ "http://creativecommons.org/ns#Attribution";;
+const char LL_RIGHTS_URI_REPRODUCTION[] =
+ "http://creativecommons.org/ns#Reproduction";;
+const char LL_RIGHTS_URI_DISTRIBUTION[] =
+ "http://creativecommons.org/ns#Distribution";;
+const char LL_RIGHTS_URI_DERIVATIVE_WORKS[] =
+ "http://creativecommons.org/ns#DerivativeWorks";;
+const char LL_RIGHTS_URI_HIGH_INCOME_NATION_USE[] =
+ "http://creativecommons.org/ns#HighIncomeNationUse";;
+const char LL_RIGHTS_URI_SHARING[] =
+ "http://creativecommons.org/ns#Sharing";;
+const char LL_RIGHTS_URI_NOTICE[] =
+ "http://creativecommons.org/ns#Notice";;
+const char LL_RIGHTS_URI_SHARE_ALIKE[] =
+ "http://creativecommons.org/ns#ShareAlike";;
+const char LL_RIGHTS_URI_SOURCECODE[] =
+ "http://creativecommons.org/ns#SourceCode";;
+const char LL_RIGHTS_URI_COMMERCIAL_USE[] =
+ "http://creativecommons.org/ns#CommercialUse";;
+
+const char LL_ATTRIBUTE_URI_REPLACED_BY[] =
+ "http://purl.org/dc/elements/1.1/isReplacedBy";;
+
/**
* The _ll_get_first function is used to extract the first elment of a
* list and the free the list.
@@ -132,28 +156,34 @@
return strdup (juris);
}

+const char LL_ATTRIBUTE_URI_JURISDICTION[] =
+ "http://purl.org/dc/elements/1.1/coverage";;
+
ll_juris_t
ll_get_jurisdiction (const ll_uri_t uri)
{
return
- _ll_get_first (ll_get_attribute
- (uri, "http://purl.org/dc/elements/1.1/coverage";, false));
+ _ll_get_first (ll_get_attribute (uri, LL_ATTRIBUTE_URI_JURISDICTION,
+ false));
}

+const char LL_ATTRIBUTE_URI_NAME[] =
+ "http://purl.org/dc/elements/1.1/title";;
+
char *
ll_get_name (const ll_uri_t u)
{
- return
- _ll_get_first (ll_get_attribute
- (u, "http://purl.org/dc/elements/1.1/title";, true));
+ return _ll_get_first (ll_get_attribute (u, LL_ATTRIBUTE_URI_NAME, true));
}

+const char LL_ATTRIBUTE_URI_VERSION[] =
+ "http://purl.org/dc/elements/1.1/hasVersion";;
+
ll_version_t
ll_get_version (const ll_uri_t u)
{
char *version =
- _ll_get_first (ll_get_attribute
- (u, "http://purl.org/dc/elements/1.1/hasVersion";, false));
+ _ll_get_first (ll_get_attribute (u, LL_ATTRIBUTE_URI_VERSION, false));
if (version)
{
int c;
@@ -193,24 +223,31 @@
return NULL;
}

+const char LL_ATTRIBUTE_URI_PROHIBITS[] =
+ "http://creativecommons.org/ns#prohibits";;
+
char **
ll_get_prohibits (const ll_uri_t u)
{
- return ll_get_attribute (u, "http://creativecommons.org/ns#prohibits";,
- false);
+ return ll_get_attribute (u, LL_ATTRIBUTE_URI_PROHIBITS, false);
}

+const char LL_ATTRIBUTE_URI_PERMITS[] =
+ "http://creativecommons.org/ns#permits";;
+
char **
ll_get_permits (const ll_uri_t u)
{
- return ll_get_attribute (u, "http://creativecommons.org/ns#permits";,
false);
+ return ll_get_attribute (u, LL_ATTRIBUTE_URI_PERMITS, false);
}

+const char LL_ATTRIBUTE_URI_REQUIRES[] =
+ "http://creativecommons.org/ns#requires";;
+
char **
ll_get_requires (const ll_uri_t u)
{
- return ll_get_attribute (u, "http://creativecommons.org/ns#requires";,
- false);
+ return ll_get_attribute (u, LL_ATTRIBUTE_URI_REQUIRES, false);
}

ll_uri_t
@@ -577,7 +614,7 @@
}

char **
-ll_get_attribute (ll_uri_t u, ll_attribute_t a, int locale)
+ll_get_attribute (ll_uri_t u, const char *a, int locale)
{
ll_attribute_search_t *helper;
char *further_search;
Index: liblicense/licenses_cached.c
--- liblicense/licenses_cached.c
+++ liblicense/licenses_cached.c
@@ -145,7 +145,7 @@
if (fileinfo.st_mtime>last_cache) {
/* Get data */
ll_juris_t j = ll_get_jurisdiction(u);
- ll_uri_t *successor =
ll_get_attribute(u,"http://purl.org/dc/elements/1.1/isReplacedBy",0);
+ ll_uri_t *successor = ll_get_attribute(u,
LL_ATTRIBUTE_URI_REPLACED_BY,0);
int obsolete = ll_list_length(successor);
ll_free_list(successor);
char* query;
Index: liblicense/licenses_uncached.c
--- liblicense/licenses_uncached.c
+++ liblicense/licenses_uncached.c
@@ -102,7 +102,8 @@
ll_uri_t *successor;

tmp_j = ll_get_jurisdiction(licenses[z]);
- successor =
ll_get_attribute(licenses[z],"http://purl.org/dc/elements/1.1/isReplacedBy",0);
+ successor = ll_get_attribute(licenses[z],
+ LL_ATTRIBUTE_URI_REPLACED_BY,0);
if(((!tmp_j && !j) || (tmp_j && j && strcmp(tmp_j,j)==0)) &&
successor[0]==NULL)
keep++;
else {
Index: tests/chooser_test.c
--- tests/chooser_test.c
+++ tests/chooser_test.c
@@ -66,15 +66,15 @@
int main(int argc, char *argv[])
{
static const char *attributes[] = {
- "http://creativecommons.org/ns#Distribution";,
- "http://creativecommons.org/ns#CommercialUse";,
- "http://creativecommons.org/ns#DerivativeWorks";,
- "http://creativecommons.org/ns#ShareAlike";,
- "http://creativecommons.org/ns#Attribution";,
+ LL_RIGHTS_URI_DISTRIBUTION,
+ LL_RIGHTS_URI_COMMERCIAL_USE,
+ LL_RIGHTS_URI_DERIVATIVE_WORKS,
+ LL_RIGHTS_URI_SHARE_ALIKE,
+ LL_RIGHTS_URI_ATTRIBUTION,
NULL
};
static const char *attributes2[] = {
- "http://creativecommons.org/ns#DerivativeWorks";,
+ LL_RIGHTS_URI_DERIVATIVE_WORKS,
NULL
};
ll_license_chooser_t *license_chooser;
@@ -90,9 +90,11 @@

license_chooser = ll_new_license_chooser(NULL,attributes);

- permits_flags =
ll_attribute_flag(license_chooser,"http://creativecommons.org/ns#Distribution";)
|
-
ll_attribute_flag(license_chooser,"http://creativecommons.org/ns#DerivativeWorks";);
- requires_flags =
ll_attribute_flag(license_chooser,"http://creativecommons.org/ns#ShareAlike";);
+ permits_flags = ll_attribute_flag(license_chooser,
+ LL_RIGHTS_URI_DISTRIBUTION) |
+ ll_attribute_flag(license_chooser, LL_RIGHTS_URI_DERIVATIVE_WORKS);
+ requires_flags = ll_attribute_flag(license_chooser,
+ LL_RIGHTS_URI_SHARE_ALIKE);
prohibits_flags = LL_UNSPECIFIED;

/*
@@ -105,9 +107,9 @@
print_flags(attributes,permits_flags,requires_flags,prohibits_flags);

print_licenses(ll_get_licenses_from_flags(license_chooser,permits_flags,requires_flags,prohibits_flags));

- permits_flags =
ll_attribute_flag(license_chooser,"http://creativecommons.org/ns#Distribution";);
- requires_flags =
ll_attribute_flag(license_chooser,"http://creativecommons.org/ns#Attribution";);
- prohibits_flags =
ll_attribute_flag(license_chooser,"http://creativecommons.org/ns#CommercialUse";);
+ permits_flags = ll_attribute_flag(license_chooser,
LL_RIGHTS_URI_DISTRIBUTION);
+ requires_flags = ll_attribute_flag(license_chooser,
LL_RIGHTS_URI_ATTRIBUTION);
+ prohibits_flags = ll_attribute_flag(license_chooser,
LL_RIGHTS_URI_COMMERCIAL_USE);

/* returns by-nc-nd */
print_flags(attributes,permits_flags,requires_flags,prohibits_flags);

Attachment: signature.asc
Description: This is a digitally signed message part




Archive powered by MHonArc 2.6.24.

Top of Page