Index: generic/nsfError.c =================================================================== diff -u -rc84389e914e1747d194fa33f9e03412d43546fe8 -r6b1a83846ee9bd80b7ce10d88cc427bdb5585819 --- generic/nsfError.c (.../nsfError.c) (revision c84389e914e1747d194fa33f9e03412d43546fe8) +++ generic/nsfError.c (.../nsfError.c) (revision 6b1a83846ee9bd80b7ce10d88cc427bdb5585819) @@ -1,8 +1,8 @@ -/* +/* * nsfError.c -- - * + * * Error reporting functions for the Next Scripting Framework. - * + * * Copyright (C) 1999-2013 Gustaf Neumann * Copyright (C) 1999-2007 Uwe Zdun * Copyright (C) 2011 Stefan Sobernig @@ -52,15 +52,15 @@ NsfDStringPrintf(Tcl_DString *dsPtr, CONST char *fmt, va_list vargs) { int result, failure, offset = dsPtr->length, avail = dsPtr->spaceAvl; va_list vargsCopy; - - /* - * Work on a copy of the va_list so that the caller's copy is untouched + + /* + * Work on a copy of the va_list so that the caller's copy is untouched */ va_copy(vargsCopy, vargs); result = vsnprintf(dsPtr->string + offset, avail, fmt, vargsCopy); va_end(vargsCopy); - /* + /* * Trap C99+ incompatabilities of certain vsnprintf() implementations * w.r.t. the result value: For example, old *nix implementations of * vsnprintf() as well as C89 implementations (as current MS Visual Compiler @@ -82,19 +82,19 @@ #endif if (likely(failure == 0)) { - /* + /* * vsnprintf() has already copied all content, * we have just to adjust the length. */ Tcl_DStringSetLength(dsPtr, offset + result); } else { int addedStringLength; - /* + /* * vsnprintf() has already not copied all content, * we have to determine the required length (MS), * adjust the DString size and copy again. */ -#if defined(_MSC_VER) +#if defined(_MSC_VER) va_copy(vargsCopy, vargs); addedStringLength = _vscprintf(fmt, vargsCopy); va_end(vargsCopy); @@ -191,7 +191,7 @@ Tcl_Obj *clName, CONST char *procName) { Tcl_DString errMsg; char *cName, *space; - + Tcl_DStringInit(&errMsg); Tcl_DStringAppend(&errMsg, "\n ", -1); if (clName) { @@ -228,7 +228,7 @@ *---------------------------------------------------------------------- */ int -NsfObjWrongArgs(Tcl_Interp *interp, CONST char *msg, Tcl_Obj *cmdName, +NsfObjWrongArgs(Tcl_Interp *interp, CONST char *msg, Tcl_Obj *cmdName, Tcl_Obj *methodName, char *arglist) { int need_space = 0; Tcl_ResetResult(interp); @@ -239,7 +239,7 @@ } if (methodName) { Tcl_Obj *resultObj; - + if (need_space) Tcl_AppendResult(interp, " ", (char *) NULL); resultObj = NsfMethodNamePath(interp, methodName); @@ -301,7 +301,7 @@ *---------------------------------------------------------------------- */ int -NsfUnexpectedArgumentError(Tcl_Interp *interp, CONST char *argumentString, +NsfUnexpectedArgumentError(Tcl_Interp *interp, CONST char *argumentString, Nsf_Object *object, Nsf_Param CONST *paramPtr, Tcl_Obj *procNameObj) { Tcl_DString ds, *dsPtr = &ds; DSTRING_INIT(dsPtr); @@ -331,9 +331,9 @@ *---------------------------------------------------------------------- */ int -NsfUnexpectedNonposArgumentError(Tcl_Interp *interp, - CONST char *argumentString, - Nsf_Object *object, +NsfUnexpectedNonposArgumentError(Tcl_Interp *interp, + CONST char *argumentString, + Nsf_Object *object, Nsf_Param CONST *currentParamPtr, Nsf_Param CONST *paramPtr, Tcl_Obj *procNameObj) { @@ -353,7 +353,7 @@ } Tcl_DStringTrunc(dsPtr, Tcl_DStringLength(dsPtr) - 2); Tcl_DStringAppend(dsPtr, ";\n", 2); - + NsfArgumentError(interp, Tcl_DStringValue(dsPtr), paramPtr, object ? object->cmdName : NULL, procNameObj); @@ -377,11 +377,11 @@ *---------------------------------------------------------------------- */ int -NsfDispatchClientDataError(Tcl_Interp *interp, ClientData clientData, +NsfDispatchClientDataError(Tcl_Interp *interp, ClientData clientData, CONST char *what, CONST char *methodName) { if (clientData) { return NsfPrintError(interp, "method %s not dispatched on valid %s", - methodName, what); + methodName, what); } else { return NsfNoCurrentObjectError(interp, methodName); } @@ -426,11 +426,11 @@ *---------------------------------------------------------------------- */ int -NsfObjErrType(Tcl_Interp *interp, - CONST char *context, - Tcl_Obj *value, - CONST char *type, - Nsf_Param CONST *paramPtr) +NsfObjErrType(Tcl_Interp *interp, + CONST char *context, + Tcl_Obj *value, + CONST char *type, + Nsf_Param CONST *paramPtr) { int named = (paramPtr && (paramPtr->flags & NSF_ARG_UNNAMED) == 0); int returnValue = !named && paramPtr && (paramPtr->flags & NSF_ARG_IS_RETURNVALUE); Index: generic/nsfObj.c =================================================================== diff -u -r5e494cf3cf01d01128b365f91ed3cd9716b1b11e -r6b1a83846ee9bd80b7ce10d88cc427bdb5585819 --- generic/nsfObj.c (.../nsfObj.c) (revision 5e494cf3cf01d01128b365f91ed3cd9716b1b11e) +++ generic/nsfObj.c (.../nsfObj.c) (revision 6b1a83846ee9bd80b7ce10d88cc427bdb5585819) @@ -1,8 +1,8 @@ -/* +/* * nsfError.c -- - * + * * Tcl_Obj types provided by the Next Scripting Framework. - * + * * Copyright (C) 1999-2013 Gustaf Neumann * * Permission is hereby granted, free of charge, to any person obtaining a @@ -58,7 +58,7 @@ NULL /* setFromAnyProc */ }; -/* +/* * freeIntRepProc */ static void @@ -71,7 +71,7 @@ if (mcPtr != NULL) { #if defined(METHOD_OBJECT_TRACE) fprintf(stderr, "MethodFreeInternalRep %p methodContext %p methodEpoch %d type <%s>\n", - objPtr, mcPtr, mcPtr->methodEpoch, + objPtr, mcPtr, mcPtr->methodEpoch, objPtr->typePtr ? objPtr->typePtr->name : "none"); #endif /* @@ -83,7 +83,7 @@ } } -/* +/* * dupIntRepProc */ static void @@ -197,7 +197,7 @@ NULL /* setFromAnyProc */ }; -/* +/* * freeIntRepProc */ static void @@ -225,7 +225,7 @@ } } -/* +/* * dupIntRepProc */ static void @@ -268,7 +268,7 @@ ) { NsfFlag *flagPtr; - + /*fprintf(stderr, "NsfFlagObjSet %p %s signature %p (%d) param %p payload %p flags %.4x\n", objPtr, ObjStr(objPtr), baseParamPtr, serial, paramPtr, payload, flags);*/ @@ -338,7 +338,7 @@ MixinregSetFromAny /* setFromAnyProc */ }; -/* +/* * freeIntRepProc */ static void @@ -356,14 +356,14 @@ */ NsfObjectRefCountDecr(&(mixinRegPtr->mixin)->object); if (mixinRegPtr->guardObj) {DECR_REF_COUNT2("mixinRegPtr->guardObj", mixinRegPtr->guardObj);} - + /* * ... and free structure */ FREE(Mixinreg, mixinRegPtr); } -/* +/* * dupIntRepProc */ static void @@ -376,14 +376,14 @@ assert(srcPtr); #if defined(METHOD_OBJECT_TRACE) - fprintf(stderr, "MixinregDupInternalRep src %p dst %p\n", + fprintf(stderr, "MixinregDupInternalRep src %p dst %p\n", srcObjPtr, dstObjPtr); #endif dstPtr = NEW(Mixinreg); memcpy(dstPtr, srcPtr, sizeof(Mixinreg)); - /* - * increment refcounts + /* + * increment refcounts */ NsfObjectRefCountIncr(&(srcPtr->mixin)->object); if (srcPtr->guardObj) {INCR_REF_COUNT2("mixinRegPtr->guardObj", srcPtr->guardObj);} @@ -396,7 +396,7 @@ } -/* +/* * setFromAnyProc */ static int @@ -423,16 +423,16 @@ return TCL_ERROR; } - /* + /* * Try to resolve unknowns */ if (NsfGetClassFromObj(interp, nameObj, &mixin, 1) != TCL_OK) { return NsfObjErrType(interp, "mixin", nameObj, "a class as mixin", NULL); } - + /* * Conversion was ok. - * Allocate structure ... + * Allocate structure ... */ mixinRegPtr = NEW(Mixinreg); mixinRegPtr->mixin = mixin; @@ -522,7 +522,7 @@ }; -/* +/* * freeIntRepProc */ static void @@ -549,7 +549,7 @@ FREE(Filterreg, filterregPtr); } -/* +/* * dupIntRepProc */ static void @@ -568,8 +568,8 @@ dstPtr = NEW(Filterreg); memcpy(dstPtr, srcPtr, sizeof(Filterreg)); - /* - * increment refcounts + /* + * increment refcounts */ INCR_REF_COUNT2("filterregPtr->filterObj", srcPtr->filterObj); if (srcPtr->guardObj) {INCR_REF_COUNT2("FilterregPtr->guardObj", srcPtr->guardObj);} @@ -581,7 +581,7 @@ dstObjPtr->internalRep.twoPtrValue.ptr1 = dstPtr; } -/* +/* * setFromAnyProc */ static int @@ -609,7 +609,7 @@ /* * Conversion was ok. - * Allocate structure ... + * Allocate structure ... */ filterregPtr = NEW(Filterreg); @@ -667,3 +667,11 @@ /* * Filterreg type end */ + +/* + * Local Variables: + * mode: c + * c-basic-offset: 2 + * fill-column: 72 + * End: + */ Index: generic/nsfPointer.c =================================================================== diff -u -r841e805480b4e7d445a61269249de9007112320d -r6b1a83846ee9bd80b7ce10d88cc427bdb5585819 --- generic/nsfPointer.c (.../nsfPointer.c) (revision 841e805480b4e7d445a61269249de9007112320d) +++ generic/nsfPointer.c (.../nsfPointer.c) (revision 6b1a83846ee9bd80b7ce10d88cc427bdb5585819) @@ -1,9 +1,9 @@ -/* +/* * nsfPointer.c -- - * + * * Provide API for accessing mallocated data via Tcl. * this is used e.q. via the MongoDB interface. - * + * * Copyright (C) 2011 Gustaf Neumann * * Permission is hereby granted, free of charge, to any person obtaining a @@ -138,7 +138,7 @@ Nsf_PointerGetHptr(void *valuePtr) { Tcl_HashEntry *hPtr; Tcl_HashSearch hSrch; - + for (hPtr = Tcl_FirstHashEntry(pointerHashTablePtr, &hSrch); hPtr; hPtr = Tcl_NextHashEntry(&hSrch)) { void *ptr = Tcl_GetHashValue(hPtr); @@ -175,8 +175,8 @@ assert(valuePtr); NsfMutexLock(&pointerMutex); - hPtr = key - ? Tcl_CreateHashEntry(pointerHashTablePtr, key, NULL) + hPtr = key + ? Tcl_CreateHashEntry(pointerHashTablePtr, key, NULL) : Nsf_PointerGetHptr(valuePtr); if (hPtr) { if (free) {ckfree((char *)valuePtr);} @@ -248,7 +248,7 @@ hPtr = Tcl_CreateHashEntry(pointerHashTablePtr, typeName, &isNew); NsfMutexUnlock(&pointerMutex); - + if (isNew) { Tcl_SetHashValue(hPtr, counterPtr); return TCL_OK; @@ -280,7 +280,7 @@ NsfMutexLock(&pointerMutex); hPtr = Tcl_CreateHashEntry(pointerHashTablePtr, typeName, NULL); NsfMutexUnlock(&pointerMutex); - + if (hPtr) { return Tcl_GetHashValue(hPtr); } @@ -357,7 +357,7 @@ Tcl_DeleteHashTable(pointerHashTablePtr); } - + NsfMutexUnlock(&pointerMutex); } Index: generic/nsfProfile.c =================================================================== diff -u -r880487204ff2da18d2d25ebd727b9b4bbda86c8e -r6b1a83846ee9bd80b7ce10d88cc427bdb5585819 --- generic/nsfProfile.c (.../nsfProfile.c) (revision 880487204ff2da18d2d25ebd727b9b4bbda86c8e) +++ generic/nsfProfile.c (.../nsfProfile.c) (revision 6b1a83846ee9bd80b7ce10d88cc427bdb5585819) @@ -1,9 +1,9 @@ -/* +/* * nsfProfile.c -- - * - * Profiling information printout for Next Scripting Framework. + * + * Profiling information printout for Next Scripting Framework. * For profiling infos NSF_PROFILE must be configured. - * + * * Copyright (C) 2010-2013 Gustaf Neumann * * Permission is hereby granted, free of charge, to any person obtaining a @@ -126,7 +126,7 @@ if (cscPtrTop) { NsfClass *cl = cscPtrTop->cl; NsfObject *obj = cscPtrTop->self; - + Tcl_DStringAppend(&methodKey, " ", 1); Tcl_DStringAppend(&methodKey, cl ? ObjStr(cl->object.cmdName) : ObjStr(obj->cmdName), -1); Tcl_DStringAppend(&methodKey, " ", 1); @@ -197,7 +197,7 @@ Tcl_HashEntry *hPtr; assert(table); - for (hPtr = Tcl_FirstHashEntry(table, &hSrch); hPtr; + for (hPtr = Tcl_FirstHashEntry(table, &hSrch); hPtr; hPtr = Tcl_NextHashEntry(&hSrch)) { NsfProfileData *value = (NsfProfileData *) Tcl_GetHashValue(hPtr); ckfree((char *) value); @@ -228,7 +228,7 @@ NsfProfileClearTable(&profilePtr->objectData); NsfProfileClearTable(&profilePtr->methodData); NsfProfileClearTable(&profilePtr->procData); - + gettimeofday(&trt, NULL); profilePtr->startSec = trt.tv_sec; profilePtr->startUSec = trt.tv_usec; @@ -257,7 +257,7 @@ Tcl_HashEntry *hPtr; assert(table); - for (hPtr = Tcl_FirstHashEntry(table, &hSrch); hPtr; + for (hPtr = Tcl_FirstHashEntry(table, &hSrch); hPtr; hPtr = Tcl_NextHashEntry(&hSrch)) { NsfProfileData *value = (NsfProfileData *) Tcl_GetHashValue(hPtr); char *key = Tcl_GetHashKey(table, hPtr); @@ -323,7 +323,7 @@ * *---------------------------------------------------------------------- */ -void +void NsfProfileInit(Tcl_Interp *interp) { NsfProfile *profilePtr = &RUNTIME_STATE(interp)->profile; struct timeval trt; @@ -353,7 +353,7 @@ * *---------------------------------------------------------------------- */ -void +void NsfProfileFree(Tcl_Interp *interp) { NsfProfile *profilePtr = &RUNTIME_STATE(interp)->profile; Index: generic/nsfUtil.c =================================================================== diff -u -r880487204ff2da18d2d25ebd727b9b4bbda86c8e -r6b1a83846ee9bd80b7ce10d88cc427bdb5585819 --- generic/nsfUtil.c (.../nsfUtil.c) (revision 880487204ff2da18d2d25ebd727b9b4bbda86c8e) +++ generic/nsfUtil.c (.../nsfUtil.c) (revision 6b1a83846ee9bd80b7ce10d88cc427bdb5585819) @@ -54,8 +54,8 @@ } needle_len = strlen(needle); - for (p = (char *)buffer, remainder = buffer_len; - p != NULL; + for (p = (char *)buffer, remainder = buffer_len; + p != NULL; p = memchr(p + 1, *needle, remainder-1)) { remainder = buffer_len - (p - buffer); if (remainder < needle_len) break; @@ -72,7 +72,7 @@ *---------------------------------------------------------------------- * Nsf_ltoa -- * - * Convert a long value into a string; this function is a fast + * Convert a long value into a string; this function is a fast * version of sprintf(buf, "%ld", l); * * Results: @@ -88,23 +88,23 @@ int nr_written, negative; char tmp[LONG_AS_STRING], *pointer = &tmp[1], *string, *p; *tmp = 0; - + if (i<0) { i = -i; negative = nr_written = 1; - } else + } else nr_written = negative = 0; - + do { nr_written++; *pointer++ = i%10 + '0'; i/=10; } while (i); - + p = string = buf; if (negative) *p++ = '-'; - + while ((*p++ = *--pointer)); /* copy number (reversed) from tmp to buf */ if (len) *len = nr_written; return string; @@ -140,7 +140,7 @@ currentChar = iss->buffer + iss->bufSize - 2; newch = *(alphabet + chartable[(unsigned)*currentChar]); - + while (1) { if (newch) { /* no overflow */ *currentChar = newch;