Initial commit: ArgyllCMS v3.5.0 and multichannel profiling research

This commit is contained in:
2026-10-31 14:27:14 +03:30
commit 66f664fc82
1828 changed files with 1123613 additions and 0 deletions

32
Argyll_V3.5.0/jcnf/Jamfile Executable file
View File

@@ -0,0 +1,32 @@
# JAM style makefile for jcnf
#PREF_CCFLAGS = $(CCOPTFLAG) ; # Turn optimisation on
PREF_CCFLAGS = $(CCDEBUGFLAG) ; # Debugging flags
#PREF_CCFLAGS = $(CCHEAPDEBUG) ; # Heap Debugging flags
PREF_LINKFLAGS = $(LINKDEBUGFLAG) ; # Link debugging flags
#Products
Libraries = libjcnf ;
Executables = ;
Headers = jcnf.h ;
#Install
#InstallBin $(DESTDIR)$(PREFIX)/bin : $(Executables) ;
#InstallFile $(DESTDIR)$(PREFIX)/h : $(Headers) ;
#InstallLib $(DESTDIR)$(PREFIX)/lib : $(Libraries) ;
HDRS = ../yajl ;
# config parser based on yajl
Library libjcnf : jcnf.c ;
# Link all utilities here with libicc
LINKLIBS = libjcnf ../yajl/libyajl ../numlib/libnum ;
# All utils are made from a single source file
MainsFromSources test.c ;

22
Argyll_V3.5.0/jcnf/Readme.txt Executable file
View File

@@ -0,0 +1,22 @@
This is a library supporting system and application configuration stored in
a flat file format based on the JSON format.
JSON (JavaScript Object Notation) is a lightweight data-interchange format.
It is easy for humans to read and write. It is easy for machines to parse
and generate. It is based on a subset of the JavaScript Programming Language,
Standard ECMA-262 3rd Edition - December 1999. JSON is a text format that is
completely language independent but uses conventions that are familiar to
programmers of the C-family of languages, including C, C++, C#, Java, JavaScript,
Perl, Python, and many others. These properties make JSON an ideal data-interchange
language.
The jcnf library is designed to be used stand alone by applications,
or as a template for a back end to Elektra, as an alternative to other
simple flat file formats such as .ini
It makes use of Lloyd Hilaiel's YAJL to do the generation
and parsing of the JSON configuration files.
- Graeme Gill.

7
Argyll_V3.5.0/jcnf/afiles Executable file
View File

@@ -0,0 +1,7 @@
Jamfile
Readme.txt
afiles
jcnf.c
jcnf.h
test.c
test.jcnf

1253
Argyll_V3.5.0/jcnf/jcnf.c Normal file

File diff suppressed because it is too large Load Diff

199
Argyll_V3.5.0/jcnf/jcnf.h Normal file
View File

@@ -0,0 +1,199 @@
#ifndef JCONF_H
#define JCONF_H
/*
* JSON based configuration format class.
*/
/*************************************************************************
Copyright 2008 Graeme W. Gill
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*************************************************************************/
/* General description:
Key names are UNIX style '/' separated paths, stored
in UTF8 format. The paths should not start with a '/'.
Duplicate key names are supported, but typically
will be avoided by the library user.
Five types are supported, NULL, 32 bit boolean, 64 bit real,
64 bit integer and string. Strings are always nul terminated.
*/
/* jcnf error codes */
typedef enum {
jc_ok = 0, /* No error */
jc_malloc, /* malloc, calloc or realloc failed */
jc_lock_error, /* Error opening lock file */
jc_locked, /* File is locked by someone else */
jc_unlock, /* Unlock failed */
jc_noexisting, /* No existing file to read */
jc_stat, /* Unable to stat file */
jc_changed, /* File has changed since it was read */
jc_read_fail, /* Failure to read from the file */
jc_parse_fail, /* Failure to parse from the file */
jc_write_open, /* Failed to open file for writing */
jc_write_fail, /* Failed to write to file */
jc_write_close, /* Failed to close file after writing */
jc_update_nomod, /* Attempt to update file that wasn't opened for modifications */
jc_bad_addkey_params, /* Bad add_key() parameters */
jc_unknown_key_type, /* An unrecognisd key type was encountered */
jc_ix_oorange, /* Key index is out of range */
jc_no_keyname, /* No key name provided when it is expected */
jc_string_not_terminated /* String doesn't include nul */
} jc_error;
/* Argument types */
typedef enum {
jc_read = 0, /* Just read the config file */
jc_modify = 1 /* Read the config file in preparation to write it */
} jc_mod;
typedef enum {
jc_no_create = 0, /* Don't create the config if it doesn't exist */
jc_create = 1 /* Create the config if it doesn't exist */
} jc_crte;
/* Internal jcnf structure */
/* The different type of values supported */
typedef enum {
jc_null = 0, /* Null value */
jc_boolean = 1, /* Boolean */
jc_real = 2, /* double floating point */
jc_integer = 3, /* 64 bit integer */
jc_string = 4 /* UTF8 string, nul terminated */
} jc_type;
/* A value */
struct _jc_key {
char *key; /* Key path */
jc_type type; /* Type of value */
char *c_comment; /* C Comment */
char *cpp_comment; /* C++ Comment */
unsigned char *data; /* Pointer to data */
size_t dataSize; /* Size of data */
}; typedef struct _jc_key jc_key;
/* A recursion depth record used during parsing */
struct _jc_recd {
char *key; /* Key name, or */
int aix; /* Array index, -2 = no array */
}; typedef struct _jc_recd jc_recd;
/* jcnf Object, representing the keys in a jcnf file */
struct _jcnf {
jc_key **keys; /* Array of pointers to keys */
int nkeys; /* Number of valid key pointers */
int akeys; /* Number of allocated key poiters */
jc_key *lk; /* Last key created */
/* Parsing support, key recursion depth */
jc_recd *recds;
int nrecd; /* Number of ised recd */
int arecd; /* Allocate rec depth */
/* Config & status */
char *fname; /* filename */
FILE *fp; /* opened, locked file */
off_t rsize; /* Size of file when read */
time_t rtime; /* Time the file was read */
int modify; /* Opened for modifications */
int create; /* Create if it doesn't exist */
int locked; /* nz if file is locked */
int modified; /* nz if keys have been modified */
/* Locate the index of the next key matching the key name, starting */
/* at the given index. Update the index to the matching key. */
/* Look for an exact match if exact != 0, or leading match if exact = 0 */
/* Search backwards if bwd != 0 or forwards if bwd = 0 */
/* Set *ix = -1 to begin search from the end. */
/* Return jc_ix_oorange if no more matchs. */
jc_error (*locate_key)(struct _jcnf *p, int *ix, char *key, int exact, int bwd);
/* Retrieve a keys information. Return pointers may be NULL. */
/* If ix >= 0, return the key of the given index. */
/* jc_ix_oorange is returned when past end. */
/* If ix == -1, return the first from the beginning matching key name. */
/* (Returned data is internal to jcnf object, so call must copy it). */
jc_error (*get_key)(struct _jcnf *p, int ix, char **key, jc_type *type, unsigned char **data,
size_t *dataSize, char **comment);
/* Set a keys information. */
/* If ix >= 0, set the key of the given index. */
/* jc_ix_oorange is returned when past end. */
/* If ix == -1, overwrite an existing key with the same name, */
/* or add a new key with that name at the end if there is no existing key. */
jc_error (*set_key)(struct _jcnf *p, int ix, char *key, jc_type type, unsigned char *data,
size_t dataSize, char *comment);
/* Add a key value to the jcnf at the end, irrespective of whether there is */
/* an existing key with that name. */
jc_error (*add_key)(struct _jcnf *p, char *key, jc_type type, unsigned char *data,
size_t dataSize, char *comment);
/* Delete a key. */
/* If ix >= 0, delete the key of the given index. */
/* jc_ix_oorange is returned when past end. */
/* If ix == -1, delete the key with the given name. */
jc_error (*delete_key)(struct _jcnf *p, int ix, char *key);
/* Diagnostic - Print the value of a key */
jc_error (*print_key)(struct _jcnf *p, int ix, FILE *fp);
/* Switch from read only to update of the config file. */
/* (This re-opens the file and checks that it hasn't been */
/* modified since it was read) */
jc_error (*enable_modify)(struct _jcnf *p);
/* Save and changes out to the file, unlock it and and close it. */
/* It can't be udated again after this. */
jc_error (*update)(struct _jcnf *p);
/* Delete this object */
void (*del)(struct _jcnf *p);
}; typedef struct _jcnf jcnf;
/* Create a new jcnf and read it's keys from the file. */
/* Return NULL on error */
jcnf *new_jcnf(
jc_error *pev, /* return error code on error */
char *fname, /* Corresponding filename */
jc_mod modify, /* Flag, nz to open for modification */
jc_crte create /* Flag, nz to create if it doesn't exist (modify must be set) */
);
/* Utilities */
/* Return a pointer to the nth element of the key name. */
/* Return null if it is out of range or malloc failed. */
/* Free the returned value when done. */
char *jc_get_nth_elem(char *path, int n);
#endif /* JCNF_H */

161
Argyll_V3.5.0/jcnf/test.c Normal file
View File

@@ -0,0 +1,161 @@
/* Test out the jcnf object */
/* Reads the file test.jcnf, and copies it to testo.jcnf */
/*************************************************************************
Copyright 2008 Graeme W. Gill
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*************************************************************************/
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "jcnf.h"
#undef TEST_PATH_PARSING
#define TEST_ENABLE_MODIFY
void error(char *fmt, ...);
int
main(int argc, char *argv[]) {
int fa,nfa; /* argument we're looking at */
jcnf *jci, *jco;
jc_error ev;
int ix;
printf("Hi there\n");
#ifdef TEST_PATH_PARSING
{
char *str;
int i, j;
for (i = 0; i < 4; i++) {
if (i == 0)
str = "this/is/a/test";
else if (i == 1)
str = "/this/is/another//test/";
else if (i == 2)
str = "/";
else
str = "";
printf("String = '%s'\n",str);
for (j = 0; j < 10; j++) {
char *s;
s = jc_get_nth_elem(str, j);
if (s == NULL)
break;
printf("%d th element = '%s'\n",j,s);
free(s);
}
}
return 0;
}
#endif /* TEST_PATH_PARSING */
if ((jci = new_jcnf(&ev, "test.jcnf",jc_read,jc_no_create)) == NULL) {
error("new_jcnf '%s' failed with error %d\n","test.jcnf",ev);
}
#ifdef TEST_ENABLE_MODIFY
if ((jco = new_jcnf(&ev, "testo.jcnf",jc_read,jc_no_create)) == NULL) {
jci->del(jci);
error("new_jcnf '%s' failed with error %d\n","testo.jcnf",ev);
}
printf("Read output file, hit return to continue\n");
getchar();
if ((ev = jco->enable_modify(jco)) != jc_ok) {
jci->del(jci);
error("enable_modify '%s' failed with error %d\n","testo.jcnf",ev);
}
#else
if ((jco = new_jcnf(&ev, "testo.jcnf",jc_modify,jc_create)) == NULL) {
jci->del(jci);
error("new_jcnf '%s' failed with error %d\n","testo.jcnf",ev);
}
#endif
/* Delete everything from the second file */
for (ix = jco->nkeys-1; ix >= 0; ix--) {
if ((ev = jco->delete_key(jco, ix, NULL)) != jc_ok) {
jco->del(jco);
jci->del(jci);
error("deleting keys from '%s' failed with error %d\n","testo.jcnf",ev);
}
}
for (ix = 0; ; ix++) {
char *key;
jc_type type;
unsigned char *data;
size_t dataSize;
char *comment;
if ((ev = jci->get_key(jci, ix, &key, &type, &data, &dataSize, &comment)) != jc_ok) {
if (ev != jc_ix_oorange) {
jco->del(jco);
jci->del(jci);
error("get_key failed with %d\n",ev);
}
break;
}
jci->print_key(jci,ix, stderr);
if ((ev = jci->add_key(jco, key, type, data, dataSize, comment)) != jc_ok) {
jco->del(jco);
jci->del(jci);
error("add_key failed with %d\n",ev);
}
}
if ((ev = jco->update(jco)) != 0) {
jco->del(jco);
jci->del(jci);
error("jcnf write failed with error %d\n",ev);
}
jci->del(jci);
jco->del(jco);
printf("We're done\n");
return 0;
}
void
error(char *fmt, ...)
{
va_list args;
fprintf(stderr,"test: Error - ");
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
fprintf(stderr, "\n");
exit (-1);
}

33
Argyll_V3.5.0/jcnf/test.jcnf Executable file
View File

@@ -0,0 +1,33 @@
{ "store": { /* First comment */
"book": [
{ "category": "reference", /* Another comment */
"author": "Nigel Rees", /* A third comment */
"title": "Sayings of the Century",
"price": 8.95
},
{ "category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
},
{ "category": "fiction",
"author": "Herman Melville",
"title": "Moby Dick",
"isbn": "0-553-21311-3",
"price": 8.99
},
{ "category": "fiction",
"author": "J. R. R. Tolkien",
"title": "The Lord of the Rings",
"isbn": "0-395-19395-8",
"price": 22.99
}
],
"bicycle": {
"color": "red",
"price": 19.95,
"price" : { "test1" : "test1 value", "test2" : "test2 value" }
}
}
}