yaz-moved-to-github.git
16 years agoThe negotiationModel bit is now set by default for init requests.
Adam Dickmeiss [Wed, 2 May 2007 11:51:54 +0000 (11:51 +0000)]
The negotiationModel bit is now set by default for init requests.
This will allow our servers to present the character set that they
support - even in case of no negotiation information from the client
side.

16 years agoAdded flush for yaz_iconv use
Adam Dickmeiss [Wed, 2 May 2007 11:31:59 +0000 (11:31 +0000)]
Added flush for yaz_iconv use

16 years agoNote on SRU and SRW target strings.
Mike Taylor [Tue, 1 May 2007 22:23:30 +0000 (22:23 +0000)]
Note on SRU and SRW target strings.

16 years agoUpdated RPM for YAZ 3. Packages: libyaz3, libyaz3-devel, yaz, yaz-ziffy.
Adam Dickmeiss [Tue, 1 May 2007 21:24:03 +0000 (21:24 +0000)]
Updated RPM for YAZ 3. Packages: libyaz3, libyaz3-devel, yaz, yaz-ziffy.

16 years agoAdded a few casts to throw away const
Adam Dickmeiss [Tue, 1 May 2007 12:54:44 +0000 (12:54 +0000)]
Added a few casts to throw away const

16 years agoBuild yaz3.dll rather than yaz.dll. New sources
Adam Dickmeiss [Tue, 1 May 2007 12:48:07 +0000 (12:48 +0000)]
Build yaz3.dll rather than yaz.dll. New sources

16 years agoTowards YAZ 3.0.0
Adam Dickmeiss [Tue, 1 May 2007 12:35:17 +0000 (12:35 +0000)]
Towards YAZ 3.0.0

16 years agoMore changes
Adam Dickmeiss [Tue, 1 May 2007 12:28:03 +0000 (12:28 +0000)]
More changes

16 years agoMoved stop word support code to separate ccl_stop_words.c and
Adam Dickmeiss [Tue, 1 May 2007 12:22:10 +0000 (12:22 +0000)]
Moved stop word support code to separate ccl_stop_words.c and
encapsulated the private info in opaque ptr ccl_stop_words_t.

16 years agoIn conversion from CCL RPN to RQF handle the empty string properly.
Adam Dickmeiss [Tue, 1 May 2007 12:12:34 +0000 (12:12 +0000)]
In conversion from CCL RPN to RQF handle the empty string properly.

16 years agoAdded stop word support for CCL parser. These are configured with
Adam Dickmeiss [Mon, 30 Apr 2007 19:55:39 +0000 (19:55 +0000)]
Added stop word support for CCL parser. These are configured with
@stop.field t1 t2 t3   .. All terms matching list of t1, t2, ..
in field are removed from resulting RPN.

16 years agoDestroy bibset upon completion
Adam Dickmeiss [Mon, 30 Apr 2007 19:50:22 +0000 (19:50 +0000)]
Destroy bibset upon completion

16 years agoRestructure qualifier handling so we can have more rules per-field -
Adam Dickmeiss [Mon, 30 Apr 2007 11:33:49 +0000 (11:33 +0000)]
Restructure qualifier handling so we can have more rules per-field -
such as stop word handling.

16 years agoNew ZOOM C option, "rpnCharset", which allows client-side conversion of
Adam Dickmeiss [Mon, 30 Apr 2007 08:29:07 +0000 (08:29 +0000)]
New ZOOM C option, "rpnCharset", which allows client-side conversion of
terms in RPN queries.

16 years agoSeparate tokenizer stuff into parsing and configuration types.
Adam Dickmeiss [Fri, 27 Apr 2007 10:09:44 +0000 (10:09 +0000)]
Separate tokenizer stuff into parsing and configuration types.

16 years agoAdded file description
Adam Dickmeiss [Fri, 27 Apr 2007 09:50:35 +0000 (09:50 +0000)]
Added file description

16 years agoFix leak in test
Adam Dickmeiss [Fri, 27 Apr 2007 09:48:28 +0000 (09:48 +0000)]
Fix leak in test

16 years agoDoxygen frindly comments. Minor simplications.
Adam Dickmeiss [Thu, 26 Apr 2007 22:11:32 +0000 (22:11 +0000)]
Doxygen frindly comments. Minor simplications.

16 years agoAdded functions to create CCL RPN nodes. Added small tokenizer
Adam Dickmeiss [Thu, 26 Apr 2007 21:45:16 +0000 (21:45 +0000)]
Added functions to create CCL RPN nodes. Added small tokenizer
utility (tokenizer.[ch]). CCL qualifier spec parsed using tokenizer
which allows more flexible notation in terms of white-space etc.

16 years agoFixed problem with double free of memory
Adam Dickmeiss [Thu, 26 Apr 2007 21:41:57 +0000 (21:41 +0000)]
Fixed problem with double free of memory

16 years agoVarious clean up. Removed function ccl_parset_get_bibset. Removed
Adam Dickmeiss [Thu, 26 Apr 2007 09:11:56 +0000 (09:11 +0000)]
Various clean up. Removed function ccl_parset_get_bibset. Removed
ccl_strdup and use xstrdup instead.

16 years agoClean-up the CCL API. Moved some internal structures from ccl.h to
Adam Dickmeiss [Wed, 25 Apr 2007 20:52:18 +0000 (20:52 +0000)]
Clean-up the CCL API. Moved some internal structures from ccl.h to
private header cclp.h. Changed ccl_parser_create so that a Bibset must
be supplied. Removed tokenize API from ccl.h - including ccl_parser_find.
This is replaced by ccl_parser_find_str which takes a string instead.

16 years agoRemoved ccl_pr_tree_as_qrpn . Implement ccl_pr_tree in terms of
Adam Dickmeiss [Wed, 25 Apr 2007 20:50:56 +0000 (20:50 +0000)]
Removed ccl_pr_tree_as_qrpn . Implement ccl_pr_tree in terms of
ccl_pquery_indent. Saves roughly 50 lines of code (DRY).

16 years agoCommand-line params and params from a param file now go straight into the
Heikki Levanto [Wed, 25 Apr 2007 16:51:47 +0000 (16:51 +0000)]
Command-line params and params from a param file now go straight into the
ILL request. The OCLC test server seems to accept the requesters now, complaining
of a missing item (rightly so).

16 years agoFixed typo WRT Update OIDS
Adam Dickmeiss [Wed, 25 Apr 2007 13:49:52 +0000 (13:49 +0000)]
Fixed typo WRT Update OIDS

16 years agoAdded example of qualifier alias
Adam Dickmeiss [Tue, 24 Apr 2007 12:57:52 +0000 (12:57 +0000)]
Added example of qualifier alias

16 years agoWindows build.
Adam Dickmeiss [Tue, 24 Apr 2007 12:55:15 +0000 (12:55 +0000)]
Windows build.

16 years agoAdded definition of YAZ_IMPORT for DLL import on Windows
Adam Dickmeiss [Tue, 24 Apr 2007 12:54:42 +0000 (12:54 +0000)]
Added definition of YAZ_IMPORT for DLL import on Windows

16 years agoAdded YAZ_EXPORT for new functions
Adam Dickmeiss [Tue, 24 Apr 2007 12:53:56 +0000 (12:53 +0000)]
Added YAZ_EXPORT for new functions

16 years agoFixed call to ZOOM_resultset_sort1
Adam Dickmeiss [Tue, 24 Apr 2007 09:29:34 +0000 (09:29 +0000)]
Fixed call to ZOOM_resultset_sort1

16 years agoIgnore yaz-illclient
Mike Taylor [Mon, 23 Apr 2007 16:15:11 +0000 (16:15 +0000)]
Ignore yaz-illclient

17 years agoIgnore generated files oclc-ill-req-ext.[ch].
Adam Dickmeiss [Wed, 18 Apr 2007 18:47:51 +0000 (18:47 +0000)]
Ignore generated files oclc-ill-req-ext.[ch].

17 years agoFixed missing thread libs in output of 'yaz-config --lalibs threads'.
Adam Dickmeiss [Wed, 18 Apr 2007 18:46:37 +0000 (18:46 +0000)]
Fixed missing thread libs in output of 'yaz-config --lalibs threads'.

17 years agoAdded new option 'static' for yaz-config which makes 'yaz-config --libs'
Adam Dickmeiss [Wed, 18 Apr 2007 13:40:19 +0000 (13:40 +0000)]
Added new option 'static' for yaz-config which makes 'yaz-config --libs'
returns static libs rather than shared libs for in-source compilations.
This is to make Pazpar2 work for local builds when YAZ is built
both statically and with shared objects. We have not seen this problem
before because most other applications are built with Libtool. And
these that aren't, such as PHP / Perl extensions deal with shared
objects fine.

17 years agoAdded the oclc-spcific extension part too. Didn't help.
Heikki Levanto [Wed, 18 Apr 2007 13:21:46 +0000 (13:21 +0000)]
Added the oclc-spcific extension part too. Didn't help.

17 years agot_test() arguments.
Mike Taylor [Wed, 18 Apr 2007 11:50:47 +0000 (11:50 +0000)]
t_test() arguments.

17 years agoDoxygen comments in OID generated files.
Adam Dickmeiss [Wed, 18 Apr 2007 08:08:02 +0000 (08:08 +0000)]
Doxygen comments in OID generated files.

17 years agoAdded ASN.1 and CODEC for OCLC ILL Request Extension.
Adam Dickmeiss [Wed, 18 Apr 2007 07:34:35 +0000 (07:34 +0000)]
Added ASN.1 and CODEC for OCLC ILL Request Extension.

17 years agoNo warnings
Adam Dickmeiss [Wed, 18 Apr 2007 07:17:19 +0000 (07:17 +0000)]
No warnings

17 years agoSplit YAZ library into two libs : libyaz.la and libyaz_server.la.
Adam Dickmeiss [Tue, 17 Apr 2007 20:26:18 +0000 (20:26 +0000)]
Split YAZ library into two libs : libyaz.la and libyaz_server.la.
libyaz.la is the core of YAZ except the generic frontend server and
does not depend on POSIX threads anymore. libyaz_server.la is the
generic frontend server facilities and uses POSIX thread functionality
if available. The libyaz.la no longer depends on POSIX threads because
the number of global structures is limited. NMEM no longer re-uses blocks
between threads ; it simply free's memory immediately but allocates in
"large" chunks as usual. We don't expect any performance penalties
because of this. The yaz_log system is still using a global log_level so
caution must be taken when modifying it with yaz_log_init_.. +
yaz_log_mask_str. This, however, should not cause any trouble because
these functions are called during initialization of application code
anyway. `yaz-config --libs  server` returns libs for server applications;
`yaz-config --libs` returns libs for non-server applications.

17 years agoAttempted to encode the oclc-specific login info.
Heikki Levanto [Tue, 17 Apr 2007 13:23:02 +0000 (13:23 +0000)]
Attempted to encode the oclc-specific login info.
Doesn't seem to work, gives the same error as when it was
not there at all.

17 years agoAuto-generated files specified separately
Adam Dickmeiss [Tue, 17 Apr 2007 08:15:15 +0000 (08:15 +0000)]
Auto-generated files specified separately

17 years agoFixed bug #1052: oid_std.[ch] not made automatically.
Adam Dickmeiss [Tue, 17 Apr 2007 07:37:58 +0000 (07:37 +0000)]
Fixed bug #1052: oid_std.[ch] not made automatically.

17 years agoIgnore oid_std.h
Adam Dickmeiss [Mon, 16 Apr 2007 22:21:48 +0000 (22:21 +0000)]
Ignore oid_std.h

17 years agoIgnore oid_std.c
Adam Dickmeiss [Mon, 16 Apr 2007 22:21:27 +0000 (22:21 +0000)]
Ignore oid_std.c

17 years agoGenerate built-in OIDs from oid.csv.
Adam Dickmeiss [Mon, 16 Apr 2007 21:53:08 +0000 (21:53 +0000)]
Generate built-in OIDs from oid.csv.

17 years agoCommitting the raw version into cvs, just to have a backup.
Heikki Levanto [Mon, 16 Apr 2007 15:33:51 +0000 (15:33 +0000)]
Committing the raw version into cvs, just to have a backup.
It can send an empty request, and parse incoming error messages.
Filling actual data to the request still missing, as is extracting
useful responses (if any).

17 years agoOIDs in a .csv-file.
Adam Dickmeiss [Mon, 16 Apr 2007 11:15:51 +0000 (11:15 +0000)]
OIDs in a .csv-file.

17 years agoAdded functions to return const known OIDs
Adam Dickmeiss [Mon, 16 Apr 2007 08:43:08 +0000 (08:43 +0000)]
Added functions to return const known OIDs

17 years agoMake Variant-1 OID definition. Fix OID for Espec-1
Adam Dickmeiss [Fri, 13 Apr 2007 13:58:00 +0000 (13:58 +0000)]
Make Variant-1 OID definition. Fix OID for Espec-1

17 years agoEnsure YAZ' include files is listed first in output of yaz-config --cflags.
Adam Dickmeiss [Fri, 13 Apr 2007 10:24:32 +0000 (10:24 +0000)]
Ensure YAZ' include files is listed first in output of yaz-config --cflags.

17 years agoAdded utilities z_ext_record_{xml,sutrs,usmarc}.
Adam Dickmeiss [Fri, 13 Apr 2007 09:55:41 +0000 (09:55 +0000)]
Added utilities z_ext_record_{xml,sutrs,usmarc}.

17 years agoAdded inclusion of oid_db.h
Adam Dickmeiss [Fri, 13 Apr 2007 09:55:21 +0000 (09:55 +0000)]
Added inclusion of oid_db.h

17 years agoFunction oid_dotstring_to_oid returns -1 if OID dot-string is ill-formed
Adam Dickmeiss [Fri, 13 Apr 2007 07:04:42 +0000 (07:04 +0000)]
Function oid_dotstring_to_oid returns -1 if OID dot-string is ill-formed

17 years agoAdded inclusion of yaz/oid_util.h
Adam Dickmeiss [Fri, 13 Apr 2007 06:51:57 +0000 (06:51 +0000)]
Added inclusion of yaz/oid_util.h

17 years agoRemoved inclusion of yaz/oid.h
Adam Dickmeiss [Fri, 13 Apr 2007 06:48:35 +0000 (06:48 +0000)]
Removed inclusion of yaz/oid.h

17 years agoAdded function yaz_oid_add which adds custom OID entry to database.
Adam Dickmeiss [Thu, 12 Apr 2007 20:47:27 +0000 (20:47 +0000)]
Added function yaz_oid_add which adds custom OID entry to database.
Re-implemented 'register_oid' for yaz-client.

17 years agoRemoved dead functions
Adam Dickmeiss [Thu, 12 Apr 2007 17:50:26 +0000 (17:50 +0000)]
Removed dead functions

17 years agoBump version to 2.1.99.2
Adam Dickmeiss [Thu, 12 Apr 2007 13:53:33 +0000 (13:53 +0000)]
Bump version to 2.1.99.2

17 years agoNew OID database - with public definitions in oid_db.h. Removed old OID
Adam Dickmeiss [Thu, 12 Apr 2007 13:52:56 +0000 (13:52 +0000)]
New OID database - with public definitions in oid_db.h. Removed old OID
database including the head oid.h and definitions such as enum oid_value
and struct oident. The new OID database uses the same string names as
before but the 'protocol' is gone. There are now only two representations
raw OID (int *) and string. Functions with prefix yaz_string_to_oid
converts from string to OID; functions with prefix yaz_oid_to_string
converts the other way.

17 years agoAdded test for query charset converter. YAZ.before.OID.patch
Adam Dickmeiss [Tue, 10 Apr 2007 14:42:31 +0000 (14:42 +0000)]
Added test for query charset converter.

17 years agoCQL translation fix.
Mike Taylor [Thu, 29 Mar 2007 11:14:47 +0000 (11:14 +0000)]
CQL translation fix.

17 years agoChange to emit_term(): when a term has the /regexp relation modifier,
Mike Taylor [Thu, 29 Mar 2007 11:14:11 +0000 (11:14 +0000)]
Change to emit_term(): when a term has the /regexp relation modifier,
do not process it for leading and trailing "^" and "*", which have
quite different meanings in regular expressions.

17 years agoExplicitly initialise cqltrans to 0
Mike Taylor [Wed, 28 Mar 2007 16:35:47 +0000 (16:35 +0000)]
Explicitly initialise cqltrans to 0

17 years agoFixed tid declaration for non-threaded mode
Adam Dickmeiss [Thu, 22 Mar 2007 09:13:13 +0000 (09:13 +0000)]
Fixed tid declaration for non-threaded mode

17 years agoAdded skeleton for query charset conversion. Bug #977.
Adam Dickmeiss [Wed, 21 Mar 2007 19:47:28 +0000 (19:47 +0000)]
Added skeleton for query charset conversion. Bug #977.

17 years agoRevert ZOOM API changes.
Adam Dickmeiss [Wed, 21 Mar 2007 11:27:46 +0000 (11:27 +0000)]
Revert ZOOM API changes.

17 years agoGet rid of 512 PQF string size limitation in cql2pqf (part of ZOOM C).
Adam Dickmeiss [Wed, 21 Mar 2007 10:22:31 +0000 (10:22 +0000)]
Get rid of 512 PQF string size limitation in cql2pqf (part of ZOOM C).

17 years agoFix prototype for cql_transform
Adam Dickmeiss [Wed, 21 Mar 2007 10:12:09 +0000 (10:12 +0000)]
Fix prototype for cql_transform

17 years agoFix bad memory reference in CQL to PQF conversion which occurred when
Adam Dickmeiss [Wed, 21 Mar 2007 09:23:11 +0000 (09:23 +0000)]
Fix bad memory reference in CQL to PQF conversion which occurred when
error 'Too many characters in query' was issued.

17 years agoAdded yaz_iconv flush.
Adam Dickmeiss [Wed, 21 Mar 2007 08:37:57 +0000 (08:37 +0000)]
Added yaz_iconv flush.

17 years agoAttempted fix of bug #976: Segfault in yaz_iconv. The yaz_iconv function
Adam Dickmeiss [Tue, 20 Mar 2007 21:37:31 +0000 (21:37 +0000)]
Attempted fix of bug #976: Segfault in yaz_iconv. The yaz_iconv function
write handlers no longer carries a 'last' parameter. This will make
yaz_iconv flush "less" characters. A flush is performed by call to
yaz_iconv(cd, 0, 0, &outbut, &outbytesleft) .

17 years agoMore wrbuf_buf woes.
Adam Dickmeiss [Mon, 19 Mar 2007 22:17:41 +0000 (22:17 +0000)]
More wrbuf_buf woes.

17 years agoMoved more members of public struct odr (ODR*) to struct Odr_private.
Adam Dickmeiss [Mon, 19 Mar 2007 21:08:13 +0000 (21:08 +0000)]
Moved more members of public struct odr (ODR*) to struct Odr_private.

17 years agoDefinition of wrbuf_diags moved to querytowrbuf.h. Function wrbuf_put_zquery
Adam Dickmeiss [Mon, 19 Mar 2007 21:07:35 +0000 (21:07 +0000)]
Definition of wrbuf_diags moved to querytowrbuf.h. Function wrbuf_put_zquery
removed, because function yaz_query_to_wrbuf does the same.

17 years agoNotes on ZOOM changes
Adam Dickmeiss [Mon, 19 Mar 2007 20:58:47 +0000 (20:58 +0000)]
Notes on ZOOM changes

17 years agoAPI changes to ZOOM. Functions for setting options returns int, rather
Adam Dickmeiss [Mon, 19 Mar 2007 20:58:34 +0000 (20:58 +0000)]
API changes to ZOOM. Functions for setting options returns int, rather
than void, so we have a way to flag unknown options. ZOOM_resultset_sort1
has become "the" ZOOM_resultset_sort. (and old ZOOM_resultset_sort is
removed). ZOOM_connection_scan1 removed. The generic scan is
ZOOM_connection_scan and the ZOOM_connection_scan_pqf is a handy short-hand
taking a PQF string as argument.

17 years agoAPI changes to WRBUF. wrbuf_free removed; replaced by wrbuf_destroy. And
Adam Dickmeiss [Mon, 19 Mar 2007 14:40:06 +0000 (14:40 +0000)]
API changes to WRBUF. wrbuf_free removed; replaced by wrbuf_destroy. And
wrbuf_puts no longer appends '\0'. Use wrbuf_cstr to get C-string out.
Deprecated functions for yaz_marc-removed.
Changed prototype of yaz_marc_decode_buf: const char for result and size_t
for rsize.

17 years agoNote on branch
Adam Dickmeiss [Mon, 19 Mar 2007 13:32:40 +0000 (13:32 +0000)]
Note on branch

17 years agoNew packges libyaz3, libyaz3-dev with libyaz so version 3.
Adam Dickmeiss [Mon, 19 Mar 2007 13:32:11 +0000 (13:32 +0000)]
New packges libyaz3, libyaz3-dev with libyaz so version 3.

17 years agolibyaz major so version=3
Adam Dickmeiss [Mon, 19 Mar 2007 13:31:48 +0000 (13:31 +0000)]
libyaz major so version=3

17 years agoBump version to 2.1.99
Adam Dickmeiss [Mon, 19 Mar 2007 13:31:05 +0000 (13:31 +0000)]
Bump version to 2.1.99

17 years agoDisable lOG_-defines by default
Adam Dickmeiss [Mon, 19 Mar 2007 12:54:58 +0000 (12:54 +0000)]
Disable lOG_-defines by default

17 years agoAdded continuation line support for MARC line format reader.
Adam Dickmeiss [Sun, 18 Mar 2007 13:00:37 +0000 (13:00 +0000)]
Added continuation line support for MARC line format reader.

17 years agoAdded wrbuf_cut_right which cuts WRBUF by a number of characters (chop
Adam Dickmeiss [Sun, 18 Mar 2007 12:59:56 +0000 (12:59 +0000)]
Added wrbuf_cut_right which cuts WRBUF by a number of characters (chop
right).

17 years agoUse nmem_init + nmem_exit to track memory usage easier.
Adam Dickmeiss [Sat, 17 Mar 2007 09:14:00 +0000 (09:14 +0000)]
Use nmem_init + nmem_exit to track memory usage easier.

17 years agoUse WRBUF for MARC line reading.
Adam Dickmeiss [Sat, 17 Mar 2007 09:13:29 +0000 (09:13 +0000)]
Use WRBUF for MARC line reading.

17 years agoRemove unneeded assert.
Adam Dickmeiss [Sat, 17 Mar 2007 08:44:24 +0000 (08:44 +0000)]
Remove unneeded assert.

17 years agoFixed marc8 flush to deal with sub/sup scripts. Refactor marc-8 page
Adam Dickmeiss [Sat, 17 Mar 2007 00:10:40 +0000 (00:10 +0000)]
Fixed marc8 flush to deal with sub/sup scripts. Refactor marc-8 page
switch code to function yaz_write_marc8_page_chr.

17 years agoVersion 2.1.55.
Adam Dickmeiss [Fri, 16 Mar 2007 10:50:19 +0000 (10:50 +0000)]
Version 2.1.55.

17 years agoFix news version YAZ.2.1.54
Adam Dickmeiss [Fri, 16 Mar 2007 09:12:08 +0000 (09:12 +0000)]
Fix news version

17 years agoFix ChangeLog dist
Adam Dickmeiss [Fri, 16 Mar 2007 08:58:39 +0000 (08:58 +0000)]
Fix ChangeLog dist

17 years agoRemove ether_h echo
Adam Dickmeiss [Fri, 16 Mar 2007 08:11:13 +0000 (08:11 +0000)]
Remove ether_h echo

17 years agoTowards 2.1.54
Adam Dickmeiss [Fri, 16 Mar 2007 08:08:10 +0000 (08:08 +0000)]
Towards 2.1.54

17 years agoMore news
Adam Dickmeiss [Fri, 16 Mar 2007 08:06:38 +0000 (08:06 +0000)]
More news

17 years agoChangeLog part of dist
Adam Dickmeiss [Fri, 16 Mar 2007 08:06:26 +0000 (08:06 +0000)]
ChangeLog part of dist

17 years agoZOOM-C async reconnection.
Mike Taylor [Thu, 15 Mar 2007 14:15:06 +0000 (14:15 +0000)]
ZOOM-C async reconnection.

17 years agoFixed bug #969: Fixed compiltation errors on OpenBSD 4.0.
Adam Dickmeiss [Thu, 15 Mar 2007 14:07:41 +0000 (14:07 +0000)]
Fixed bug #969: Fixed compiltation errors on OpenBSD 4.0.

17 years agoFixed update command so that record ID = none means none.
Adam Dickmeiss [Wed, 14 Mar 2007 11:46:37 +0000 (11:46 +0000)]
Fixed update command so that record ID = none means none.

17 years agoMissing return value for function
Adam Dickmeiss [Tue, 13 Mar 2007 09:12:09 +0000 (09:12 +0000)]
Missing return value for function