q-lang-cvs Mailing List for Q - Equational Programming Language (Page 2)
Brought to you by:
agraef
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(106) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(219) |
Feb
(152) |
Mar
|
Apr
(92) |
May
(45) |
Jun
(3) |
Jul
|
Aug
(3) |
Sep
(111) |
Oct
(52) |
Nov
|
Dec
|
2005 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(23) |
Jun
(46) |
Jul
(158) |
Aug
(22) |
Sep
|
Oct
(26) |
Nov
(11) |
Dec
(49) |
2006 |
Jan
(57) |
Feb
(196) |
Mar
(10) |
Apr
(41) |
May
(149) |
Jun
(308) |
Jul
(11) |
Aug
(25) |
Sep
(15) |
Oct
|
Nov
|
Dec
(15) |
2007 |
Jan
|
Feb
|
Mar
|
Apr
(15) |
May
(204) |
Jun
(112) |
Jul
(7) |
Aug
(16) |
Sep
(134) |
Oct
(313) |
Nov
(262) |
Dec
(83) |
2008 |
Jan
(81) |
Feb
(83) |
Mar
(21) |
Apr
|
May
|
Jun
(1) |
Jul
(2) |
Aug
(6) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Albert G. <ag...@us...> - 2008-03-08 23:02:22
|
Update of /cvsroot/q-lang/q/modules/ggi In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv20802 Modified Files: README-GGI Log Message: update information about recent GGI versions, add notice about x:-inwin bug in GGI 2.2 Index: README-GGI =================================================================== RCS file: /cvsroot/q-lang/q/modules/ggi/README-GGI,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** README-GGI 10 Jul 2005 08:18:35 -0000 1.9 --- README-GGI 8 Mar 2008 23:02:17 -0000 1.10 *************** *** 15,29 **** The module requires that you have libggi (version 2.0 or later) and libgii ! (version 0.8 or later) installed. For the additional font support you also ! need version 2 of the FreeType library (http://www.freetype.org/). ! Since the GGI project at SourceForge (http://sourceforge.net/projects/ggi/) ! only provides source tarballs at this time, and GGI is not yet included in the ! major Linux distributions, we provide some RPMs for the required libraries on ! the Q homepage. NOTE: The Windows package now comes with the most recent GGI ! from CVS, including Peter Ekberg's much improved DirectX driver. To make the ! module work on Windows, please make sure that the GGI_CONFDIR environment ! variable points to your Qpad/ggi/etc/ggi directory. (This should be taken care ! of automagically when running scripts via the Qpad application.) Please see ggi.q for a description of the functions provided by this module. --- 15,30 ---- The module requires that you have libggi (version 2.0 or later) and libgii ! (version 0.8 or later) installed. (We recommend using libggi 2.1/libgii 0.9, ! as later versions appear to have a bug breaking the '-inwin' option of the X11 ! target, which is needed to embed GGI windows inside GUI applications.) For the ! additional font support you also need version 2 of the FreeType library ! (http://www.freetype.org/). ! Binary GGI packages are readily available on most current Linux distributions. ! The Windows package comes with a GGI version from CVS which includes Peter ! Ekberg's much improved DirectX driver. To make the module work on Windows, ! please make sure that the GGI_CONFDIR environment variable points to your ! Qpad/ggi/etc/ggi directory. (This should be taken care of automagically when ! running scripts via the Qpad application.) Please see ggi.q for a description of the functions provided by this module. *************** *** 44,48 **** Enjoy! :) ! Oct 2 2004 Albert Graef ag...@mu..., Dr....@t-... --- 45,49 ---- Enjoy! :) ! Mar 9 2008 Albert Graef ag...@mu..., Dr....@t-... |
From: Albert G. <ag...@us...> - 2008-03-06 21:59:29
|
Update of /cvsroot/q-lang/q-csv In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5606 Modified Files: Makefile Log Message: bump version number Index: Makefile =================================================================== RCS file: /cvsroot/q-lang/q-csv/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile 10 Jan 2008 22:41:21 -0000 1.1.1.1 --- Makefile 6 Mar 2008 21:59:03 -0000 1.2 *************** *** 5,9 **** # version number: ! version = 0.1 dist = q-csv-$(version) --- 5,9 ---- # version number: ! version = 0.2 dist = q-csv-$(version) |
From: Albert G. <ag...@us...> - 2008-03-06 21:57:39
|
Update of /cvsroot/q-lang/q-csv In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv4938 Modified Files: README Log Message: README was updated Index: README =================================================================== RCS file: /cvsroot/q-lang/q-csv/README,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** README 6 Mar 2008 21:24:15 -0000 1.13 --- README 6 Mar 2008 21:57:34 -0000 1.14 *************** *** 66,70 **** reading csv files and "writesamples.q" for writing. ! Jan 10 2008 Eddie Rucker er...@bm... --- 66,70 ---- reading csv files and "writesamples.q" for writing. ! Mar 6 2008 Eddie Rucker er...@bm... |
From: RER <ed...@us...> - 2008-03-06 21:24:25
|
Update of /cvsroot/q-lang/q-csv In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27335 Modified Files: README csv.q Log Message: fixed README and csv.q comments to reflect changes Index: README =================================================================== RCS file: /cvsroot/q-lang/q-csv/README,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** README 11 Feb 2008 14:15:38 -0000 1.12 --- README 6 Mar 2008 21:24:15 -0000 1.13 *************** *** 39,55 **** - fwritecsv is equivalent to swritecsv except that writing is to a file. - The above routines are defined in terms of the following primary interface - functions fread_csvstr, csvstr_to_tuple and tuple_to_csvstr: - - - fread_csvstr reads a single CSV record from a file. This essentially works - like freads, but handles quoted newlines embedded in a field value. Note - that fread_csvstr does *not* verify that the string actually conforms to CSV - syntax. - - - csvstr_to_tuple and tuple_to_csvstr convert CSV formatted strings to tuples - and vice versa. These functions check for correct CSV syntax and proper - field values, respectively, and return a 'csv_error MSG' term in case of an - error condition (see NOTES below). - The routines described above read/write one record at a time. Additional functions (sreadcsvlist, swritecsvlist, freadcsvlist and fwritecsvlist) are --- 39,42 ---- Index: csv.q =================================================================== RCS file: /cvsroot/q-lang/q-csv/csv.q,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** csv.q 6 Mar 2008 16:19:08 -0000 1.18 --- csv.q 6 Mar 2008 21:24:15 -0000 1.19 *************** *** 31,34 **** --- 31,48 ---- from dict import dict, insert, vals, member; + /* Public Routines are defined in terms of the following primary interface + functions fread_csvstr, csvstr_to_tuple and tuple_to_csvstr: + + - fread_csvstr reads a single CSV record from a file. This essentially works + like freads, but handles quoted newlines embedded in a field value. Note + that fread_csvstr does *not* verify that the string actually conforms to CSV + syntax. + + - csvstr_to_tuple and tuple_to_csvstr convert CSV formatted strings to tuples + and vice versa. These functions check for correct CSV syntax and proper + field values, respectively, and return a 'csv_error MSG' term in case of an + error condition. + */ + private extern fread_csvstr FILE QUOTE; private extern tuple_to_csvstr ARGS REC; *************** *** 105,112 **** /* Convert a tuple (record) to a CSV string. Dialect: CSV format specification. If none is given, defaults to RFC4180 for Windows and UNIX for all other OSs. - Rec: Tuple of fields to be converted to CSV format. - NOTE: Rec must contain ONLY strings, integers, and floating point numbers. If a field is some other type, the 'csv_error MSG' rule is invoked. --- 119,125 ---- /* Convert a tuple (record) to a CSV string. + Rec: Tuple of fields to be converted to CSV format. Dialect: CSV format specification. If none is given, defaults to RFC4180 for Windows and UNIX for all other OSs. NOTE: Rec must contain ONLY strings, integers, and floating point numbers. If a field is some other type, the 'csv_error MSG' rule is invoked. *************** *** 126,132 **** /* Convert a tuple (record) to a CSV string Dialect: CSV format specification. If none is given, defaults to RFC4180 for Windows and UNIX for all other OSs. - Rec: Tuple of fields to be converted to CSV format. NOTE: The 'csv_error MSG' rule is invoked on improperly formatted strings. --- 139,145 ---- /* Convert a tuple (record) to a CSV string + Rec: Tuple of fields to be converted to CSV format. Dialect: CSV format specification. If none is given, defaults to RFC4180 for Windows and UNIX for all other OSs. NOTE: The 'csv_error MSG' rule is invoked on improperly formatted strings. |
From: RER <ed...@us...> - 2008-03-06 16:20:06
|
Update of /cvsroot/q-lang/q-csv/examples In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv1836/examples Modified Files: writesamples.q Log Message: Bugfixes and lineterminator defaults Index: writesamples.q =================================================================== RCS file: /cvsroot/q-lang/q-csv/examples/writesamples.q,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** writesamples.q 22 Jan 2008 16:45:17 -0000 1.5 --- writesamples.q 6 Mar 2008 16:19:15 -0000 1.6 *************** *** 23,27 **** def Dialect1 = csv_dialect [csv_quoting,csv_quote_all;]; writefile_string F [] = (); ! writefile_string F [L|Ls] = [fwritecsv (F,Dialect1) L | writefile_string F Ls]; --- 23,27 ---- def Dialect1 = csv_dialect [csv_quoting,csv_quote_all;]; writefile_string F [] = (); ! writefile_string F [L|Ls] = [fwritecsv (F, Dialect1) L | writefile_string F Ls]; |
From: RER <ed...@us...> - 2008-03-06 16:19:54
|
Update of /cvsroot/q-lang/q-csv In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv1836 Modified Files: csv.c csv.q Log Message: Bugfixes and lineterminator defaults Index: csv.c =================================================================== RCS file: /cvsroot/q-lang/q-csv/csv.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** csv.c 29 Feb 2008 21:30:20 -0000 1.19 --- csv.c 6 Mar 2008 16:19:08 -0000 1.20 *************** *** 208,211 **** --- 208,212 ---- st = 1; } else if (!*s || *s == EOF || !strncmp(s, lineterm, n_lineterm)) { + putrec(CSV_QUOTE_ALL); st = 10; } else if (isspace(*s) && skipspace_f) { Index: csv.q =================================================================== RCS file: /cvsroot/q-lang/q-csv/csv.q,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** csv.q 5 Mar 2008 22:04:02 -0000 1.17 --- csv.q 6 Mar 2008 16:19:08 -0000 1.18 *************** *** 20,24 **** /* The CSV library provides an interface to read and write comma separated value files. The reading and writing functions are loosely based on ! Python's csv module (http://docs.python.org/lib/module-csv.html) */ from dict import dict, insert, vals, member; --- 20,31 ---- /* The CSV library provides an interface to read and write comma separated value files. The reading and writing functions are loosely based on ! Python's csv module (http://docs.python.org/lib/module-csv.html) ! ! Bugfix: Wed Mar 5, 2008: Fixed EOF checking for freadcsvlist. ! Bugfix: Thr Mar 6, 2008: Dialect now defaults to '\n' on UNIX and OSX. ! Made Dialect the second option in tuple ! parameters for sread* and swrite*. ! Fixed various bugs. ! */ from dict import dict, insert, vals, member; *************** *** 94,101 **** EXCEL = csv_dialect [csv_quoting, csv_quote_none;]; ! /* Convert a tuple (record) to a CSV string. ! Dialect: CSV format specification. If none is given, defaults to the ! RFC4180 dialect. Rec: Tuple of fields to be converted to CSV format. --- 101,110 ---- EXCEL = csv_dialect [csv_quoting, csv_quote_none;]; ! public const var ! OS_DIALECT = ifelse (fnmatch "*mingw*" sysinfo) RFC4180 UNIX; ! /* Convert a tuple (record) to a CSV string. ! Dialect: CSV format specification. If none is given, defaults to ! RFC4180 for Windows and UNIX for all other OSs. Rec: Tuple of fields to be converted to CSV format. *************** *** 104,122 **** */ public swritecsv ARGS; ! swritecsv (Dialect:Tuple, Rec:Tuple) = tuple_to_csvstr Dialect Rec; swritecsv Rec:Tuple ! = tuple_to_csvstr RFC4180 Rec; /* Convert a list of tuples to a list of CSV formatted strings. */ public swritecsvlist ARGS; ! swritecsvlist (Dialect:Tuple, L:List) = map (tuple_to_csvstr Dialect) L; swritecsvlist L:List ! = map (tuple_to_csvstr RFC4180) L; /* Convert a tuple (record) to a CSV string ! Dialect: CSV format specification. If none is given, defaults to the ! RFC4180 dialect. Rec: Tuple of fields to be converted to CSV format. --- 113,131 ---- */ public swritecsv ARGS; ! swritecsv (Rec:Tuple, Dialect:Tuple) = tuple_to_csvstr Dialect Rec; swritecsv Rec:Tuple ! = tuple_to_csvstr OS_DIALECT Rec; /* Convert a list of tuples to a list of CSV formatted strings. */ public swritecsvlist ARGS; ! swritecsvlist (L:List, Dialect:Tuple) = map (tuple_to_csvstr Dialect) L; swritecsvlist L:List ! = map (tuple_to_csvstr OS_DIALECT) L; /* Convert a tuple (record) to a CSV string ! Dialect: CSV format specification. If none is given, defaults to ! RFC4180 for Windows and UNIX for all other OSs. Rec: Tuple of fields to be converted to CSV format. *************** *** 124,131 **** */ public sreadcsv ARGS; ! sreadcsv (Rec:Tuple, Dialect:Tuple) = csvstr_to_tuple Dialect Rec; ! sreadcsv Rec:Tuple ! = csvstr_to_tuple RFC4180 Rec; /* Convert a list of CSV formatted strings to a list of tuples */ --- 133,140 ---- */ public sreadcsv ARGS; ! sreadcsv (Rec:String, Dialect:Tuple) = csvstr_to_tuple Dialect Rec; ! sreadcsv Rec:String ! = csvstr_to_tuple OS_DIALECT Rec; /* Convert a list of CSV formatted strings to a list of tuples */ *************** *** 134,138 **** = map (csvstr_to_tuple Dialect) L; sreadcsvlist L:List ! = map (csvstr_to_tuple RFC4180) L; /* File handling functions */ --- 143,147 ---- = map (csvstr_to_tuple Dialect) L; sreadcsvlist L:List ! = map (csvstr_to_tuple OS_DIALECT) L; /* File handling functions */ *************** *** 141,145 **** = csvstr_to_tuple Dialect $ fread_csvstr F (Dialect!ord csv_quote); freadcsv F:File ! = csvstr_to_tuple RFC4180 $ fread_csvstr F "\""; public fwritecsv ARGS REC; --- 150,154 ---- = csvstr_to_tuple Dialect $ fread_csvstr F (Dialect!ord csv_quote); freadcsv F:File ! = csvstr_to_tuple OS_DIALECT $ fread_csvstr F "\""; public fwritecsv ARGS REC; *************** *** 147,154 **** = fwrites F $ tuple_to_csvstr Dialect Rec; fwritecsv F:File Rec:Tuple ! = fwrites F $ tuple_to_csvstr RFC4180 Rec; public freadcsvlist ARGS; ! freadcsvlist (F:File, Dialect:Tuple) = [] if feof F; = [freadcsv (F, Dialect) | freadcsvlist (F, Dialect)]; --- 156,163 ---- = fwrites F $ tuple_to_csvstr Dialect Rec; fwritecsv F:File Rec:Tuple ! = fwrites F $ tuple_to_csvstr OS_DIALECT Rec; public freadcsvlist ARGS; ! freadcsvlist (F:File, Dialect:Tuple,) = [] if feof F; = [freadcsv (F, Dialect) | freadcsvlist (F, Dialect)]; *************** *** 159,163 **** public fwritecsvlist ARGS REC; fwritecsvlist (F:File, Dialect:Tuple) L:List ! = do (fwritecsv F Dialect) L; fwritecsvlist F:File L:List = do (fwritecsv F) L; \ No newline at end of file --- 168,172 ---- public fwritecsvlist ARGS REC; fwritecsvlist (F:File, Dialect:Tuple) L:List ! = do (fwritecsv (F, Dialect)) L; fwritecsvlist F:File L:List = do (fwritecsv F) L; \ No newline at end of file |
From: Albert G. <ag...@us...> - 2008-03-06 10:19:07
|
Update of /cvsroot/q-lang/q In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21471 Modified Files: ChangeLog Log Message: update ChangeLog Index: ChangeLog =================================================================== RCS file: /cvsroot/q-lang/q/ChangeLog,v retrieving revision 1.335 retrieving revision 1.336 diff -C2 -d -r1.335 -r1.336 *** ChangeLog 26 Feb 2008 01:21:11 -0000 1.335 --- ChangeLog 6 Mar 2008 10:18:58 -0000 1.336 *************** *** 1,2 **** --- 1,8 ---- + 2008-03-06 Albert Graef <Dr....@t-...> + + * modules/clib/system.c: fix checks for POSIX timers, to properly + detect the (unavailability of the) extension on OS X and older + Cygwin systems + 2008-02-26 Albert Graef <Dr....@t-...> |
From: Albert G. <ag...@us...> - 2008-03-06 10:15:30
|
Update of /cvsroot/q-lang/q/modules/clib In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19816 Modified Files: system.c Log Message: fix checks for POSIX timers availability Index: system.c =================================================================== RCS file: /cvsroot/q-lang/q/modules/clib/system.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** system.c 23 Feb 2008 08:37:30 -0000 1.6 --- system.c 6 Mar 2008 10:15:24 -0000 1.7 *************** *** 1682,1698 **** mkint(IPPROTO_UDP), ! #ifdef _POSIX_TIMERS mkint(CLOCK_REALTIME), ! #ifdef _POSIX_MONOTONIC_CLOCK mkint(CLOCK_MONOTONIC), #else mkvoid, #endif ! #ifdef _POSIX_CPUTIME mkint(CLOCK_PROCESS_CPUTIME_ID), #else mkvoid, #endif ! #ifdef _POSIX_THREAD_CPUTIME mkint(CLOCK_THREAD_CPUTIME_ID), #else --- 1682,1698 ---- mkint(IPPROTO_UDP), ! #if _POSIX_TIMERS > 0 mkint(CLOCK_REALTIME), ! #if defined(_POSIX_MONOTONIC_CLOCK) && (_POSIX_MONOTONIC_CLOCK >= 0) mkint(CLOCK_MONOTONIC), #else mkvoid, #endif ! #if defined(_POSIX_CPUTIME) && (_POSIX_CPUTIME >= 0) mkint(CLOCK_PROCESS_CPUTIME_ID), #else mkvoid, #endif ! #if defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0) mkint(CLOCK_THREAD_CPUTIME_ID), #else *************** *** 5705,5709 **** FUNCTION(system,process_cpu_clockid,argc,argv) { ! #ifdef _POSIX_CPUTIME long pid; if (argc == 1 && isint(argv[0], &pid)) { --- 5705,5709 ---- FUNCTION(system,process_cpu_clockid,argc,argv) { ! #if defined(_POSIX_CPUTIME) && (_POSIX_CPUTIME >= 0) long pid; if (argc == 1 && isint(argv[0], &pid)) { *************** *** 5722,5726 **** FUNCTION(system,thread_cpu_clockid,argc,argv) { ! #ifdef _POSIX_THREAD_CPUTIME THREAD *thr; if (argc == 1 && isobj(argv[0], type(Thread), (void**)&thr)) { --- 5722,5726 ---- FUNCTION(system,thread_cpu_clockid,argc,argv) { ! #if defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0) THREAD *thr; if (argc == 1 && isobj(argv[0], type(Thread), (void**)&thr)) { |
From: RER <ed...@us...> - 2008-03-05 22:04:11
|
Update of /cvsroot/q-lang/q-csv In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv11329 Modified Files: csv.q Log Message: fixed bug in freadcsvlist Index: csv.q =================================================================== RCS file: /cvsroot/q-lang/q-csv/csv.q,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** csv.q 11 Feb 2008 02:31:30 -0000 1.16 --- csv.q 5 Mar 2008 22:04:02 -0000 1.17 *************** *** 151,156 **** --- 151,158 ---- public freadcsvlist ARGS; freadcsvlist (F:File, Dialect:Tuple) + = [] if feof F; = [freadcsv (F, Dialect) | freadcsvlist (F, Dialect)]; freadcsvlist F:File + = [] if feof F; = [freadcsv F | freadcsvlist F]; |
From: RER <ed...@us...> - 2008-02-29 21:30:26
|
Update of /cvsroot/q-lang/q-csv In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18442 Modified Files: csv.c Log Message: Bug Fix (removed debuging printf) Index: csv.c =================================================================== RCS file: /cvsroot/q-lang/q-csv/csv.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** csv.c 29 Feb 2008 21:09:56 -0000 1.18 --- csv.c 29 Feb 2008 21:30:20 -0000 1.19 *************** *** 18,22 **** $Id$ ! Written by Eddie Rucker 3-25 Jan, 2008 */ #include <stdio.h> --- 18,24 ---- $Id$ ! Written by Eddie Rucker 3-25 Jan, 2008 ! Fixed Bug when reading quoted null fields 29 Feb, 2008 ! */ #include <stdio.h> *************** *** 106,110 **** char *p, *t; - printf("%d\n", (s[0]==0)); if (cvt_f) { i = strtol(s, &p, 0); --- 108,111 ---- |
From: RER <ed...@us...> - 2008-02-29 21:10:13
|
Update of /cvsroot/q-lang/q-csv In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9835 Modified Files: csv.c Log Message: Fixed a bug when converting null fields. Index: csv.c =================================================================== RCS file: /cvsroot/q-lang/q-csv/csv.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** csv.c 11 Feb 2008 14:17:48 -0000 1.17 --- csv.c 29 Feb 2008 21:09:56 -0000 1.18 *************** *** 106,109 **** --- 106,110 ---- char *p, *t; + printf("%d\n", (s[0]==0)); if (cvt_f) { i = strtol(s, &p, 0); *************** *** 197,203 **** case 0: fldp = fld; n_fld = 0; if (!strncmp(s, delimiter, n_delimiter)) { - *fldp = 0; putrec(CSV_QUOTE_ALL); s += n_delimiter; --- 198,204 ---- case 0: fldp = fld; + *fldp = 0; n_fld = 0; if (!strncmp(s, delimiter, n_delimiter)) { putrec(CSV_QUOTE_ALL); s += n_delimiter; |
From: Albert G. <ag...@us...> - 2008-02-26 01:21:17
|
Update of /cvsroot/q-lang/q In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26635 Modified Files: ChangeLog Log Message: update ChangeLog Index: ChangeLog =================================================================== RCS file: /cvsroot/q-lang/q/ChangeLog,v retrieving revision 1.334 retrieving revision 1.335 diff -C2 -d -r1.334 -r1.335 *** ChangeLog 26 Feb 2008 00:25:16 -0000 1.334 --- ChangeLog 26 Feb 2008 01:21:11 -0000 1.335 *************** *** 1,4 **** --- 1,14 ---- 2008-02-26 Albert Graef <Dr....@t-...> + * modules/octave/octave.c (octave_get): remove the -save-builins + option, which is not supported in the latest Octave versions + (>= 2.9.x) + + Unfortunately, this means that with older Octave versions it's not + possible to get the values of builtin variables like 'ans' any + more. So if you're still running Octave 2.0.x or 2.1.x you'll have + to edit the definition of cmd_template in octave_get to make it + work again. + * modules/octave/octave.c (start_octave): add check for latest octave versions |
From: Albert G. <ag...@us...> - 2008-02-26 01:20:02
|
Update of /cvsroot/q-lang/q/modules/octave In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26049 Modified Files: README-Octave Log Message: update README Index: README-Octave =================================================================== RCS file: /cvsroot/q-lang/q/modules/octave/README-Octave,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** README-Octave 15 Dec 2003 10:21:23 -0000 1.1.1.1 --- README-Octave 26 Feb 2008 01:19:56 -0000 1.2 *************** *** 19,29 **** it is not already running): ! ==> octave "A=[1,2;3,4]; eig(A)" ! () ! ==> ans = ! 5.37228 ! -0.37228 The command is executed asynchronously in the Octave interpreter, and any --- 19,29 ---- it is not already running): ! ==> octave "A=[1,2;3,4]; eig(A)" ! () ! ==> ans = ! -0.37228 ! 5.37228 The command is executed asynchronously in the Octave interpreter, and any *************** *** 31,37 **** get octave variables: ! ==> octave_set "A" [[1,2],[3,4]] || octave "eig(A);" || \ ! octave_get "ans" ! [[5.37228132326901],[-0.372281323269014]] Supported Octave value types are scalars (real and complex), vectors and --- 31,36 ---- get octave variables: ! ==> octave_set "A" [[1,2],[3,4]] || octave "B = eig(A);" || octave_get "B" ! [[-0.372281323269014],[5.37228132326901]] Supported Octave value types are scalars (real and complex), vectors and *************** *** 52,56 **** Enjoy! :) ! Sep 8 2000 Albert Graef ag...@mu..., Dr....@t-... --- 51,55 ---- Enjoy! :) ! Feb 26 2008 Albert Graef ag...@mu..., Dr....@t-... |
From: Albert G. <ag...@us...> - 2008-02-26 01:19:41
|
Update of /cvsroot/q-lang/q/modules/octave In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv25947 Modified Files: octave.c Log Message: -save-builtins not supported in recent Octave versions, so remove it Index: octave.c =================================================================== RCS file: /cvsroot/q-lang/q/modules/octave/octave.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** octave.c 26 Feb 2008 00:24:47 -0000 1.6 --- octave.c 26 Feb 2008 01:19:32 -0000 1.7 *************** *** 671,675 **** --- 671,682 ---- const char *lock = ".lock"; const char *cmd_template = + #if 0 + /* -save-builtins is required to make builtin variables like ans work + with octave_get in older Octave versions. Unfortunately, the latest + versions (>= 2.9.x?) don't have this option any more. */ "save -binary -save-builtins \"%s\" %s; unlink \"%s\";"; + #else + "save -binary \"%s\" %s; unlink \"%s\";"; + #endif char *l = (char*)alloca(strlen(t)+strlen(lock)+1); char *c = (char*)alloca(strlen(cmd_template)+strlen(s)+2*strlen(t)+ |
From: Albert G. <ag...@us...> - 2008-02-26 00:25:22
|
Update of /cvsroot/q-lang/q In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28655 Modified Files: ChangeLog Log Message: update ChangeLog Index: ChangeLog =================================================================== RCS file: /cvsroot/q-lang/q/ChangeLog,v retrieving revision 1.333 retrieving revision 1.334 diff -C2 -d -r1.333 -r1.334 *** ChangeLog 23 Feb 2008 08:33:31 -0000 1.333 --- ChangeLog 26 Feb 2008 00:25:16 -0000 1.334 *************** *** 1,2 **** --- 1,10 ---- + 2008-02-26 Albert Graef <Dr....@t-...> + + * modules/octave/octave.c (start_octave): add check for latest + octave versions + + This is needed to properly set the prompt strings in newer octave + versions, where the PS? variables are now functions instead. + 2008-02-23 Albert Graef <Dr....@t-...> |
From: Albert G. <ag...@us...> - 2008-02-26 00:24:51
|
Update of /cvsroot/q-lang/q/modules/octave In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28273 Modified Files: octave.c Log Message: fixes for latest octave versions Index: octave.c =================================================================== RCS file: /cvsroot/q-lang/q/modules/octave/octave.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** octave.c 24 Jan 2006 01:21:32 -0000 1.5 --- octave.c 26 Feb 2008 00:24:47 -0000 1.6 *************** *** 293,297 **** } if ((fp = fopen(octaverc, "w"))) { ! fprintf(fp, "PS1 = PS2 = PS4 = \"\";\n"); if (bak && (fp2 = fopen(octaverc_bak, "r"))) { /* copy contents of previous .octaverc */ --- 293,297 ---- } if ((fp = fopen(octaverc, "w"))) { ! fprintf(fp, "if (exist (\"OCTAVE_VERSION\") == 5) eval('PS1(\"\"); PS2(\"\"); PS4(\"\");'); else eval('PS1 = PS2 = PS4 = \"\";'); endif\n"); if (bak && (fp2 = fopen(octaverc_bak, "r"))) { /* copy contents of previous .octaverc */ |
From: Albert G. <ag...@us...> - 2008-02-23 11:29:14
|
Update of /cvsroot/q-lang/q In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv3088 Modified Files: NEWS Log Message: update NEWS Index: NEWS =================================================================== RCS file: /cvsroot/q-lang/q/NEWS,v retrieving revision 1.145 retrieving revision 1.146 diff -C2 -d -r1.145 -r1.146 *** NEWS 23 Feb 2008 08:34:11 -0000 1.145 --- NEWS 23 Feb 2008 11:29:08 -0000 1.146 *************** *** 17,27 **** provided as well. ! - The glob and regex functions were moved back from system into clib. - Added support for highres timers (clock_gettime et al) on systems where the POSIX timer extension is available. The system module provides a number of new functions (nanotime, nanosleep, etc.) to deal with these. Moreover, the ! builtin time function will now also make use of clock_gettime (or ! gettimeofday) if they are available. - Worked around some quirks with the MS Access ODBC driver which caused it to --- 17,31 ---- provided as well. ! - The glob and regex functions were moved back from system into clib. Also, a ! bug in the await function function was fixed (now it properly accepts ! timeouts specified in seconds, not millisecs), and support for mutex and ! semaphore timeouts was added to the try function (this requires a system ! with pthread_mutex_timedlock/sem_timedwait). - Added support for highres timers (clock_gettime et al) on systems where the POSIX timer extension is available. The system module provides a number of new functions (nanotime, nanosleep, etc.) to deal with these. Moreover, the ! builtin time function will now also make use of clock_gettime/gettimeofday ! if they are available. - Worked around some quirks with the MS Access ODBC driver which caused it to |
From: Albert G. <ag...@us...> - 2008-02-23 11:12:19
|
Update of /cvsroot/q-lang/q-xine In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28488 Modified Files: Makefile Log Message: bump version number Index: Makefile =================================================================== RCS file: /cvsroot/q-lang/q-xine/Makefile,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Makefile 8 Dec 2007 08:19:36 -0000 1.6 --- Makefile 23 Feb 2008 11:12:05 -0000 1.7 *************** *** 5,9 **** # version number: ! version = 1.4 dist = q-xine-$(version) --- 5,9 ---- # version number: ! version = 1.5 dist = q-xine-$(version) |
From: Albert G. <ag...@us...> - 2008-02-23 11:11:13
|
Update of /cvsroot/q-lang/q-xine In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28067 Modified Files: NEWS Log Message: update NEWS Index: NEWS =================================================================== RCS file: /cvsroot/q-lang/q-xine/NEWS,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** NEWS 8 Dec 2007 09:17:23 -0000 1.5 --- NEWS 23 Feb 2008 11:11:04 -0000 1.6 *************** *** 1,3 **** --- 1,7 ---- + * 1.5 February 2008 + + Eliminate dependency on Q-Midi (framegrab2.q example). + * 1.4 December 2007 |
From: Albert G. <ag...@us...> - 2008-02-23 11:10:56
|
Update of /cvsroot/q-lang/q-xine In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27772 Modified Files: ChangeLog Log Message: update ChangeLog Index: ChangeLog =================================================================== RCS file: /cvsroot/q-lang/q-xine/ChangeLog,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ChangeLog 8 Dec 2007 09:17:09 -0000 1.8 --- ChangeLog 23 Feb 2008 11:10:51 -0000 1.9 *************** *** 1,2 **** --- 1,8 ---- + 2008-02-23 Albert Graef <Dr....@t-...> + + + Release 1.5 + + * examples/framegrab2.q: eliminate dependency on Q-Midi + 2007-12-08 Albert Graef <Dr....@t-...> |
From: Albert G. <ag...@us...> - 2008-02-23 11:10:14
|
Update of /cvsroot/q-lang/q-xine/examples In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27332 Modified Files: framegrab2.q Log Message: eliminate Q-Midi dependency, use standard system timer instead Index: framegrab2.q =================================================================== RCS file: /cvsroot/q-lang/q-xine/examples/framegrab2.q,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** framegrab2.q 5 Oct 2007 09:40:32 -0000 1.2 --- framegrab2.q 23 Feb 2008 11:10:02 -0000 1.3 *************** *** 1,6 **** ! import ggi, xine, midi, system; ! ! def REF = midi_open "Timer"; def MPEGS = glob "*.mpg"; --- 1,4 ---- ! import ggi, xine, system; def MPEGS = glob "*.mpg"; *************** *** 9,16 **** /* Another demo for the framegrabber interface, which shows how to play a ! video in a GGI window at normal playback speed. IMPORTANT: Uses the Q-Midi ! module for timing purposes, as the standard system timing functions are ! often woefully inadequate for realtime operation. Therefore you must have ! MidiShare installed and running to make this work. :( */ private loop X VIS T0, snapshot X VIS T0; --- 7,13 ---- /* Another demo for the framegrabber interface, which shows how to play a ! video in a GGI window at normal playback speed. NOTE: You'll need a decent ! timer resolution to make this work (recent systems with gettimeofday/ ! nanosleep should usually be ok). */ private loop X VIS T0, snapshot X VIS T0; *************** *** 33,43 **** snapshot X:XineHandle VIS:GGIVisual () = ggi_put_box VIS (0,0) (W,H) PIXELS || ggi_flush VIS || ! (VPTS,midi_time) where (VPTS,W,H,PIXELS) = xine_get_video_frame X; snapshot X:XineHandle VIS:GGIVisual (VPTS0,T0) ! = ggi_put_box VIS (0,0) (W,H) PIXELS || ggi_flush VIS || (VPTS,T) where (VPTS,W,H,PIXELS) = xine_get_video_frame X, ! DT = (VPTS-VPTS0)/90000*1000, ! T = midi_wait REF (T0+round DT); --- 30,41 ---- snapshot X:XineHandle VIS:GGIVisual () = ggi_put_box VIS (0,0) (W,H) PIXELS || ggi_flush VIS || ! (VPTS,time) where (VPTS,W,H,PIXELS) = xine_get_video_frame X; snapshot X:XineHandle VIS:GGIVisual (VPTS0,T0) ! = sleep (T-time) || ! ggi_put_box VIS (0,0) (W,H) PIXELS || ggi_flush VIS || (VPTS,T) where (VPTS,W,H,PIXELS) = xine_get_video_frame X, ! DT = (VPTS-VPTS0)/90000, ! T = T0+DT; |
From: Albert G. <ag...@us...> - 2008-02-23 10:13:04
|
Update of /cvsroot/q-lang/q/modules/clib In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv3296 Modified Files: system.q Log Message: comment change Index: system.q =================================================================== RCS file: /cvsroot/q-lang/q/modules/clib/system.q,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** system.q 23 Feb 2008 08:42:26 -0000 1.7 --- system.q 23 Feb 2008 10:12:59 -0000 1.8 *************** *** 754,764 **** resolution of the given timer. The nanosleep function sleeps for the specified amount of nanoseconds, while the nanosleep_until function sleeps ! until the given (absolute) time arrives. (Just like the sleep function, ! these functions may exit early if a signal is delivered to the process; see ! the manual for details.) In case of any error condition, these functions ! will set errno accordingly. For each of the functions you have to specify an integer-valued timer ! id. In the current implementation, the following timers are supported: - CLOCK_REALTIME: The system clock, measured in nanosecs since the epoch. --- 754,763 ---- resolution of the given timer. The nanosleep function sleeps for the specified amount of nanoseconds, while the nanosleep_until function sleeps ! until the given (absolute) time arrives. In case of an error condition, ! these functions will set errno accordingly. For each of the functions you have to specify an integer-valued timer ! id. In the current implementation, the following timers are supported (the ! corresponding constants are defined at the beginning of this module): - CLOCK_REALTIME: The system clock, measured in nanosecs since the epoch. *************** *** 774,781 **** might be unreliable on SMP systems, see clock_gettime(3) for details.) ! Only CLOCK_REALTIME is guaranteed to be available (on systems which ! implement the highres timers at all, that is). If a given clock is ! unavailable on the host system, the corresponding id will be () (if ! CLOCK_REALTIME is (), then the highres timers are not supported at all). Moreover, if CPU timers are available, then the process_cpu_clockid and --- 773,780 ---- might be unreliable on SMP systems, see clock_gettime(3) for details.) ! Only CLOCK_REALTIME is guaranteed to exist (on systems which implement the ! highres timers at all, that is). If a given clock is unavailable on the ! host system, the corresponding id will be () (if CLOCK_REALTIME is (), then ! the highres timers are not supported at all). Moreover, if CPU timers are available, then the process_cpu_clockid and *************** *** 787,794 **** actual resolutions depend on your system setup and will typically be much coarser (for the system and monotonic clocks, they are usually in the ! milliseconds range on current PCs). Also, you must consider system ! latencies which might cause calls to nanosleep and nanosleep_until to wake ! up late on occasions (use realtime scheduling priorities to mitigate these ! effects). */ public extern nanotime ID, nanores ID; --- 786,792 ---- actual resolutions depend on your system setup and will typically be much coarser (for the system and monotonic clocks, they are usually in the ! milliseconds range on current PCs). Also, be aware that system latencies ! might cause calls to nanosleep and nanosleep_until to wake up late (use ! realtime scheduling priorities to mitigate these effects). */ public extern nanotime ID, nanores ID; |
From: Albert G. <ag...@us...> - 2008-02-23 09:39:35
|
Update of /cvsroot/q-lang/q/doc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv22963 Modified Files: qdoc.texi version.texi Log Message: update documentation Index: qdoc.texi =================================================================== RCS file: /cvsroot/q-lang/q/doc/qdoc.texi,v retrieving revision 1.147 retrieving revision 1.148 diff -C2 -d -r1.147 -r1.148 *** qdoc.texi 22 Feb 2008 09:31:24 -0000 1.147 --- qdoc.texi 23 Feb 2008 09:39:24 -0000 1.148 *************** *** 14198,14204 **** the @code{system} module) are used to return information about the active timezone and the current time, and convert time values to various ! formats. Also available are functions to measure cpu time. These ! functions are in close correspondence with the date and time functions ! of the C library. The calendar date and time functions use two different representations --- 14198,14204 ---- the @code{system} module) are used to return information about the active timezone and the current time, and convert time values to various ! formats. Also available are functions to measure cpu time and ! high-resolution timers. These functions are in close correspondence with ! the date and time functions of the C library. The calendar date and time functions use two different representations *************** *** 14289,14292 **** --- 14289,14294 ---- @end smallexample + @subheading Measuring CPU Time + Two additional functions are provided for measuring cpu time. Note that @code{clock} and @code{times} measure cpu time in different units, given *************** *** 14320,14323 **** --- 14322,14408 ---- approximately every 72 minutes. + @subheading High-Resolution Timers + + On systems where the POSIX 1003.1-2001 timer extension is available (at + the time of this writing, this comprises most recent Linux and Unix + systems, but not Windows), the @code{system} module provides a number of + operations to deal with high-resolution timers. These will be useful for + realtime applications and other programs with strict timing + requirements. + + @findex nanotime + @findex nanores + @findex nanosleep + @findex nanosleep_until + @smallexample + public extern nanotime ID, nanores ID; + public extern nanosleep ID T, nanosleep_until ID T; + @end smallexample + + Note that these operations differ from the builtin @code{time} and + @code{sleep} functions (see @ref{Miscellaneous Functions}) in that they + use integer (unsigned 64 bit) time values specified in nanoseconds. The + @code{nanotime} function returns the current time in nanosecs, the + @code{nanores} function the resolution of the given timer (i.e., the + smallest measurable amount of time in nanosecs). The @code{nanosleep} + function sleeps for the specified amount of nanoseconds, while the + @code{nanosleep_until} function sleeps until the given (absolute) time + arrives. In case of any internal error condition, these functions will + set @code{errno} accordingly. + + Just like the @code{sleep} function, the @code{nanosleep} and + @code{nanosleep_until} functions may wake up early if a signal is + delivered to the process. In this case @code{errno} will be set to + @code{EINTR}, and @code{nanosleep} will return the remaining time until + the planned wakeup, while @code{nanosleep_until} will simply fail. If + the sleep terminates normally, @code{nanosleep} will return zero and + @code{nanosleep_until} @code{()}, respectively. + + For each of the functions you have to specify an integer-valued timer + id. In the current implementation, the following timers are supported: + + @itemize @bullet + @item + @code{CLOCK_REALTIME}: The system clock, measured in nanosecs since the + epoch. This will be the same time as returned by the builtin @code{time} + function (up to rounding issues with the latter). + @item + @code{CLOCK_MONOTONIC}: Monotonic (non-decreasing) time since some + unspecified starting point. This clock cannot be reset by the user and + is thus to be preferred in realtime applications. + @item + @code{CLOCK_PROCESS_CPUTIME}, @code{CLOCK_THREAD_CPUTIME}: Highres + per-process and per-thread CPU timers. (Normally these are for timing + purposes only and might be unreliable on SMP systems, see + @code{clock_gettime}(3) for details.) + @end itemize + + Only @code{CLOCK_REALTIME} is guaranteed to exist (on systems which + implement the highres timers at all, that is). If a given clock is + unavailable on the host system, the corresponding id will be @code{()}. + (If @code{CLOCK_REALTIME} is @code{()} then the highres timers are not + supported at all.) + + Moreover, if CPU timers are available, then the following + @code{process_cpu_clockid} and @code{thread_cpu_clockid} functions can + be used to return the clock id for the given process id (0 denotes the + current process) and the given thread, respectively: + + @findex process_cpu_clockid + @findex thread_cpu_clockid + @smallexample + public extern process_cpu_clockid PID, thread_cpu_clockid THREAD; + @end smallexample + + CAVEAT: While the highres timers nominally support nanoseconds + resolution, the actual resolutions depend on your system setup and will + typically be much coarser (for the system and monotonic clocks, they are + usually in the milliseconds range on current PCs). Also, be aware that + there are system latencies which might cause calls to @code{nanosleep} + and @code{nanosleep_until} to wake up late. You can use realtime + scheduling priorities to mitigate these effects to some extent, see + @ref{Realtime Scheduling}, but some sources of latency will still + remain. + @node Internationalization, Filename Globbing, Time Functions, Clib @section Internationalization Index: version.texi =================================================================== RCS file: /cvsroot/q-lang/q/doc/version.texi,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** version.texi 22 Feb 2008 09:31:24 -0000 1.99 --- version.texi 23 Feb 2008 09:39:24 -0000 1.100 *************** *** 1,3 **** ! @set UPDATED 22 February 2008 @set UPDATED-MONTH February 2008 @set EDITION 7.11 --- 1,3 ---- ! @set UPDATED 23 February 2008 @set UPDATED-MONTH February 2008 @set EDITION 7.11 |
From: Albert G. <ag...@us...> - 2008-02-23 08:42:30
|
Update of /cvsroot/q-lang/q/modules/clib In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31354 Modified Files: system.q Log Message: comment change Index: system.q =================================================================== RCS file: /cvsroot/q-lang/q/modules/clib/system.q,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** system.q 23 Feb 2008 08:37:30 -0000 1.6 --- system.q 23 Feb 2008 08:42:26 -0000 1.7 *************** *** 712,716 **** /* Time functions. Return information about the active timezone and the current time, and convert time values to various formats. Also available ! are functions to measure cpu time and a high-resolution timer. These functions are in close correspondence with the date and time functions of the C library, see the manual for details. */ --- 712,716 ---- /* Time functions. Return information about the active timezone and the current time, and convert time values to various formats. Also available ! are functions to measure cpu time and high-resolution timers. These functions are in close correspondence with the date and time functions of the C library, see the manual for details. */ |
From: Albert G. <ag...@us...> - 2008-02-23 08:37:34
|
Update of /cvsroot/q-lang/q/modules/clib In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv29126/modules/clib Modified Files: system.c system.q Log Message: add hires timer functions Index: system.q =================================================================== RCS file: /cvsroot/q-lang/q/modules/clib/system.q,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** system.q 23 Jan 2008 05:24:32 -0000 1.5 --- system.q 23 Feb 2008 08:37:30 -0000 1.6 *************** *** 34,39 **** using bitwise logical operations as usual. Flag values which are unavailable on the host system will be set to zero, other undefined values ! to -1. Thus undefined values will generally have no effect or cause the ! corresponding operations to fail. */ public var const --- 34,39 ---- using bitwise logical operations as usual. Flag values which are unavailable on the host system will be set to zero, other undefined values ! to -1 (or () in some cases). Thus undefined values will generally have no ! effect or cause the corresponding operations to fail. */ public var const *************** *** 145,148 **** --- 145,153 ---- IPPROTO_IP, IPPROTO_ICMP, IPPROTO_TCP, IPPROTO_UDP, + /* highres timers *********************************************************/ + + CLOCK_REALTIME, CLOCK_MONOTONIC, + CLOCK_PROCESS_CPUTIME, CLOCK_THREAD_CPUTIME, + /* locale-related constants ***********************************************/ *************** *** 241,244 **** --- 246,252 ---- IPPROTO_IP, IPPROTO_ICMP, IPPROTO_TCP, IPPROTO_UDP, + CLOCK_REALTIME, CLOCK_MONOTONIC, + CLOCK_PROCESS_CPUTIME, CLOCK_THREAD_CPUTIME, + LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, LC_TIME, *************** *** 704,710 **** /* Time functions. Return information about the active timezone and the current time, and convert time values to various formats. Also available ! are functions to measure cpu time. These functions are in close ! correspondence with the date and time functions of the C library, see the ! manual for details. */ /* Simple time (T) is represented as seconds since the "epoch", broken-down --- 712,718 ---- /* Time functions. Return information about the active timezone and the current time, and convert time values to various formats. Also available ! are functions to measure cpu time and a high-resolution timer. These ! functions are in close correspondence with the date and time functions of ! the C library, see the manual for details. */ /* Simple time (T) is represented as seconds since the "epoch", broken-down *************** *** 739,742 **** --- 747,799 ---- public extern clock, times; + /* High-resolution timers (U). This requires the POSIX 1003.1-2001 timer + extension, otherwise these functions will fail. Note that these operations + differ from the builtin time and sleep functions in that they use integer + (unsigned 64 bit) time values specified in nanoseconds. The nanotime + function returns the current time in nanosecs, the nanores function the + resolution of the given timer. The nanosleep function sleeps for the + specified amount of nanoseconds, while the nanosleep_until function sleeps + until the given (absolute) time arrives. (Just like the sleep function, + these functions may exit early if a signal is delivered to the process; see + the manual for details.) In case of any error condition, these functions + will set errno accordingly. + + For each of the functions you have to specify an integer-valued timer + id. In the current implementation, the following timers are supported: + + - CLOCK_REALTIME: The system clock, measured in nanosecs since the epoch. + This will be the same time as returned by the builtin time function (up + to rounding issues with the latter). + + - CLOCK_MONOTONIC: Monotonic (non-decreasing) time since some unspecified + starting point. This clock cannot be reset by the user and is thus to be + preferred in realtime applications. + + - CLOCK_PROCESS_CPUTIME, CLOCK_THREAD_CPUTIME: Highres per-process and + per-thread CPU timers. (Normally these are for timing purposes only and + might be unreliable on SMP systems, see clock_gettime(3) for details.) + + Only CLOCK_REALTIME is guaranteed to be available (on systems which + implement the highres timers at all, that is). If a given clock is + unavailable on the host system, the corresponding id will be () (if + CLOCK_REALTIME is (), then the highres timers are not supported at all). + + Moreover, if CPU timers are available, then the process_cpu_clockid and + thread_cpu_clockid functions can be used to return the clock id for the + given process id (0 denotes the current process) and the given thread, + respectively. + + CAVEAT: While these timers nominally support nanoseconds resolution, the + actual resolutions depend on your system setup and will typically be much + coarser (for the system and monotonic clocks, they are usually in the + milliseconds range on current PCs). Also, you must consider system + latencies which might cause calls to nanosleep and nanosleep_until to wake + up late on occasions (use realtime scheduling priorities to mitigate these + effects). */ + + public extern nanotime ID, nanores ID; + public extern nanosleep ID T, nanosleep_until ID T; + public extern process_cpu_clockid PID, thread_cpu_clockid THREAD; + /****************************************************************************/ Index: system.c =================================================================== RCS file: /cvsroot/q-lang/q/modules/clib/system.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** system.c 23 Jan 2008 05:24:32 -0000 1.5 --- system.c 23 Feb 2008 08:37:30 -0000 1.6 *************** *** 316,319 **** --- 316,338 ---- #endif + /* make sure that this matches up with the declaration in clib.c */ + + typedef unsigned char bool; + typedef struct { + bool active, canceled, used; /* status */ + expr arg; /* thread argument */ + expr result; /* thread result, if any */ + expr thread; /* thread object */ + #ifdef USE_THREADS + pthread_t id; /* thread id */ + pthread_mutex_t exit_mutex; /* exit mutex and condition */ + pthread_cond_t exit_cond; + #ifdef WIN32 + HANDLE handle; /* thread handle */ + int pol; /* scheduling policy */ + #endif + #endif + } THREAD; + MODULE(system) *************** *** 1478,1482 **** if (argc != 0) return __FAIL; return mktuplel ! (242, mkint(P_WAIT), mkint(P_NOWAIT), mkint(P_OVERLAY), mkint(P_DETACH), --- 1497,1501 ---- if (argc != 0) return __FAIL; return mktuplel ! (246, mkint(P_WAIT), mkint(P_NOWAIT), mkint(P_OVERLAY), mkint(P_DETACH), *************** *** 1663,1666 **** --- 1682,1709 ---- mkint(IPPROTO_UDP), + #ifdef _POSIX_TIMERS + mkint(CLOCK_REALTIME), + #ifdef _POSIX_MONOTONIC_CLOCK + mkint(CLOCK_MONOTONIC), + #else + mkvoid, + #endif + #ifdef _POSIX_CPUTIME + mkint(CLOCK_PROCESS_CPUTIME_ID), + #else + mkvoid, + #endif + #ifdef _POSIX_THREAD_CPUTIME + mkint(CLOCK_THREAD_CPUTIME_ID), + #else + mkvoid, + #endif + #else + mkvoid, + mkvoid, + mkvoid, + mkvoid, + #endif + #ifdef HAVE_LOCALE_H mkint(LC_ALL), *************** *** 5544,5547 **** --- 5587,5740 ---- } + FUNCTION(system,nanotime,argc,argv) + { + #ifdef HAVE_CLOCK_GETTIME + long id; + if (argc == 1 && isint(argv[0], &id)) { + struct timespec tv; + int res = clock_gettime(id, &tv); + if (res) + return __FAIL; + else { + mpz_t z; + /* two limbs should always be enough */ + if (!mpz_new(z, 2)) return __ERROR; + mpz_set_ui(z, tv.tv_sec); + mpz_mul_ui(z, z, 1000000000UL); + mpz_add_ui(z, z, tv.tv_nsec); + if (!mpz_actsize(z)) return __ERROR; + return mkmpz(z); + } + } else + #endif + return __FAIL; + } + + FUNCTION(system,nanores,argc,argv) + { + #ifdef HAVE_CLOCK_GETRES + long id; + if (argc == 1 && isint(argv[0], &id)) { + struct timespec tv; + int res = clock_getres(id, &tv); + if (res) + return __FAIL; + else { + mpz_t z; + /* two limbs should always be enough */ + if (!mpz_new(z, 2)) return __ERROR; + mpz_set_ui(z, tv.tv_sec); + mpz_mul_ui(z, z, 1000000000UL); + mpz_add_ui(z, z, tv.tv_nsec); + if (!mpz_actsize(z)) return __ERROR; + return mkmpz(z); + } + } else + #endif + return __FAIL; + } + + FUNCTION(system,nanosleep,argc,argv) + { + #ifdef HAVE_CLOCK_NANOSLEEP + long id; + mpz_t z; + if (argc == 2 && isint(argv[0], &id) && ismpz(argv[1], z)) { + int res; + struct timespec tv, rv; + mpz_t s, n; + int l = mpz_size(z); + if (l <= 0) l = 1; + if (!mpz_new(s, l)) return __ERROR; + if (!mpz_new(n, 1)) return __ERROR; + mpz_fdiv_qr_ui(s, n, z, 1000000000UL); + tv.tv_sec = s->_mp_d[0]; + tv.tv_nsec = n->_mp_d[0]; + mpz_clear(s); mpz_clear(n); + res = clock_nanosleep(id, 0, &tv, &rv); + if (res == EINTR) { + /* interrupt, return remaining time */ + mpz_t z; + if (!mpz_new(z, 2)) return __ERROR; + mpz_set_ui(z, rv.tv_sec); + mpz_mul_ui(z, z, 1000000000UL); + mpz_add_ui(z, z, rv.tv_nsec); + if (!mpz_actsize(z)) return __ERROR; + errno = res; + return mkmpz(z); + } else if (res) { + /* other error, set errno appropriately */ + errno = res; + return __FAIL; + } else + /* sleep timed out, return 0 to indicate success */ + return mkint(0); + } else + #endif + return __FAIL; + } + + FUNCTION(system,nanosleep_until,argc,argv) + { + #ifdef HAVE_CLOCK_NANOSLEEP + long id; + mpz_t z; + if (argc == 2 && isint(argv[0], &id) && ismpz(argv[1], z)) { + int res; + struct timespec tv; + mpz_t s, n; + int l = mpz_size(z); + if (l <= 0) l = 1; + if (!mpz_new(s, l)) return __ERROR; + if (!mpz_new(n, 1)) return __ERROR; + mpz_fdiv_qr_ui(s, n, z, 1000000000UL); + tv.tv_sec = s->_mp_d[0]; + tv.tv_nsec = n->_mp_d[0]; + mpz_clear(s); mpz_clear(n); + res = clock_nanosleep(id, TIMER_ABSTIME, &tv, NULL); + if (res) { + errno = res; + return __FAIL; + } else + return mkvoid; + } else + #endif + return __FAIL; + } + + FUNCTION(system,process_cpu_clockid,argc,argv) + { + #ifdef _POSIX_CPUTIME + long pid; + if (argc == 1 && isint(argv[0], &pid)) { + clockid_t id; + int res = clock_getcpuclockid(pid, &id); + if (res) { + errno = res; + return __FAIL; + } else + return mkint(id); + } else + #endif + return __FAIL; + } + + FUNCTION(system,thread_cpu_clockid,argc,argv) + { + #ifdef _POSIX_THREAD_CPUTIME + THREAD *thr; + if (argc == 1 && isobj(argv[0], type(Thread), (void**)&thr)) { + clockid_t id; + int res = pthread_getcpuclockid(thr->id, &id); + if (res) { + errno = res; + return __FAIL; + } else + return mkint(id); + } else + #endif + return __FAIL; + } + /* i18n functions: ********************************************************/ |