X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;f=cll1.h;h=261cd81b9b8527e25801f5140789ab5503689476;hb=097bac9a8882d0e781ca25e53b846981f4f9e05c;hp=cb66f6fda918bfbc6616a772c6df17e1d58b6d63;hpb=956a4c051a02b9c65d81e644c848e4e2f098da7e;p=svn%2FCll1h%2F.git diff --git a/cll1.h b/cll1.h index cb66f6f..261cd81 100644 --- a/cll1.h +++ b/cll1.h @@ -14,12 +14,14 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to - Michael Polak, Svojsikova 7, 169 00 Praha 6 Czech Republic */ -/* ------------------------------------------------------------------- */ -#ifndef __CLL1H__ -#define __CLL1H__ + You should have received a copy of the GNU Lesser General Public License + along with C<<1 header file; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#ifndef _CLL1_H +#define _CLL1_H #include #include @@ -59,7 +61,7 @@ /* ------------------------------------------------------------------- */ #define loop while(TRUE) #define repeat(N) if(N>0) _NEW_I for_range(_I,1,N) -#define for_range(VAR,FROM,TO) for( VAR=FROM ; FROM<=TO?(VAR<=TO):(VAR>=TO) ; FROM<=TO?(VAR++):(VAR--)) +#define for_range(VAR,FROM,TO) for( VAR=FROM ; FROM<=TO?VAR<=TO:VAR>=TO ; FROM<=TO?VAR++:VAR--) #define for_each(A,B) for(A=B; A; A=A->_next) #define for_search(A,B,C) for_each(A,B) if(C) /*to do: #define for_file_lines(STR,F) _NEW_F for() */ @@ -192,11 +194,26 @@ #define textfile(TYPE,LINE) struct TYPE { char *LINE; char _eoln; list(TYPE); } #define date(S) { time_t _T; _T=time(NULL); duplicate(ctime(&_T),S); } -#ifdef USE_LIBRARY_MYSQL /* ------------------------------------------------------------------- */ /* MySQL Infrastructure and basic macros - updated 2007-12-19 by xCh. */ /* ------------------------------------------------------------------- */ +#ifdef USE_LIBRARY_MYSQL #define mysql_connect(S,U,P,D) (create(_Matom,_MStack) && push(_Matom,_Mstack) && (_Matom->M=mysql_init(NULL)),(_Matom->M && mysql_real_connect(_Matom->M,S,U,P,D,0,NULL,0)?_Matom->M:NULL)) #endif - +/* ------------------------------------------------------------------- */ +/* Object infrastructure and basic macros - updated 2008-01-13 by xCh. */ +/* unfinished */ +#define uses_interface(TYPE) struct TYPE *__class +#define method(NAME) +#define interface_implementation(IFACE,TYPE) struct TYPE *__get_##_##IFACE(void) { struct TYPE *_FACE=get_mem(TYPE); __bind_##_##IFACE(_FACE); return _IFC; } void __bind_##_##IFACE(struct TYPE *_FACE) +#define bind_method(METHOD,FUNCTION) _IFACE->METHOD=FUNCTION +#define get_interface(IFACE) __get_##_##IFACE(void) +// must be function #define get_object(TYPE) (_CLL1_MALLOC(TYPE),CLL1_ASSERT(),) +#define _(OBJECT,FUNCTION) OBJECT==NULL?NULL::(*(OBJECT->__class->METHOD))(OBJECT #endif +/* ------------------------------------------------------------------- */ +/* some general ideas, unfinished */ +#define _CLL1_THROW(ERR) +#define _CLL1_TRY _NEW_E for(;;) if () {.... if(_Eatom->SYS) { if(_Eatom->RET) return; else break;} else { } +#define _CLL1_ASSERT(EXPR) assert(EXPR) +#define _CLL1_MALLOC(TYPE) malloc(sizeof(TYPE))