Changeset: 0e996d20347d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0e996d20347d
Modified Files:
monetdb5/mal/mal_atom.mx
Branch: default
Log Message:
uncrustify this code, it hurts my eyes
diffs (truncated from 420 to 300 lines):
diff --git a/monetdb5/mal/mal_atom.mx b/monetdb5/mal/mal_atom.mx
--- a/monetdb5/mal/mal_atom.mx
+++ b/monetdb5/mal/mal_atom.mx
@@ -99,21 +99,21 @@
A few fields are set only once, at creation time.
They should be implemented with parameter-less functions.
@= setItem
-if( idcmp(@1,name) || pci->argc != 1)
+if (idcmp(@1, name) || pci->argc != 1)
return 0;
-else{
- BATatoms[tpe].@2= (* (@4 (*)(void)) pci->fcn)();
+else {
+ BATatoms[tpe].@2 = (*(@4 (*)(void))pci->fcn)();
setAtomName(pci);
return 1;
}
@-
@= setItemInt
-if( idcmp(@1,name) || pci->argc != 1)
+if (idcmp(@1, name) || pci->argc != 1)
return 0;
- BATatoms[tpe].@2= (*pci->fcn)();
- setAtomName(pci);
- return 1;
+BATatoms[tpe].@2 = (*pci->fcn)();
+setAtomName(pci);
+return 1;
@c
#include "monetdb_config.h"
#include "mal_atom.h"
@@ -124,141 +124,143 @@
#define MAXPATHLEN 1024
#endif
-void setAtomName(InstrPtr pci){
+void setAtomName(InstrPtr pci)
+{
char buf[MAXPATHLEN];
- snprintf(buf,MAXPATHLEN,"#%s", getFunctionId(pci));
- setFunctionId(pci, putName(buf,strlen(buf)));
+ snprintf(buf, MAXPATHLEN, "#%s", getFunctionId(pci));
+ setFunctionId(pci, putName(buf, strlen(buf)));
}
-int malAtomProperty(MalBlkPtr mb, InstrPtr pci){
+int malAtomProperty(MalBlkPtr mb, InstrPtr pci)
+{
str name;
int tpe;
- (void) mb; /* fool compilers */
+ (void)mb; /* fool compilers */
assert(pci != 0);
name = getFunctionId(pci);
- tpe = getTypeIndex(getModuleId(pci), (int) strlen(getModuleId(pci)),
TYPE_any);
- if( tpe<0 || tpe>= GDKatomcnt)
+ tpe = getTypeIndex(getModuleId(pci), (int)strlen(getModuleId(pci)),
TYPE_any);
+ if (tpe < 0 || tpe >= GDKatomcnt)
return 0;
- switch(name[0]){
- case 'd':
- if( idcmp("del",name)==0 && pci->argc==1){
- BATatoms[tpe].atomDel= (void (*)(Heap *, var_t *))
pci->fcn;
+ switch (name[0]) {
+ case 'd':
+ if (idcmp("del", name) == 0 && pci->argc == 1) {
+ BATatoms[tpe].atomDel = (void (*)(Heap *, var_t
*))pci->fcn;
setAtomName(pci);
return 1;
}
break;
- case 'c':
- if( idcmp("cmp",name)==0 && pci->argc==1){
- BATatoms[tpe].atomCmp= (int (*)(ptr, ptr)) pci->fcn;
- setAtomName(pci);
- return 1;
- }
- if( idcmp("convert",name)==0 && pci->argc==1){
- BATatoms[tpe].atomConvert= (void (*)(ptr, int))
pci->fcn;
- setAtomName(pci);
- return 1;
- }
- break;
- case 'f':
- if( idcmp("fromstr",name)==0 && pci->argc==1){
- BATatoms[tpe].atomFromStr= (int (*)(str, int *, ptr *))
pci->fcn;
- setAtomName(pci);
- return 1;
- }
- if( idcmp("fix",name)==0 && pci->argc==1){
- BATatoms[tpe].atomFix= (int (*)(ptr)) pci->fcn;
- setAtomName(pci);
- return 1;
- }
- break;
- case 'h':
- if( idcmp("heap",name)==0 && pci->argc==1){
- /* heap function makes an atom varsized */
- BATatoms[tpe].size = sizeof(var_t);
-
assert_shift_width(ATOMelmshift(BATatoms[tpe].size),BATatoms[tpe].size);
- BATatoms[tpe].varsized = 1;
- BATatoms[tpe].align = sizeof(var_t);
- BATatoms[tpe].atomHeap= (void (*)(Heap *, size_t))
pci->fcn;
- setAtomName(pci);
- return 1;
- }
- if( idcmp("heapconvert",name)==0 && pci->argc==1){
- BATatoms[tpe].atomHeapConvert= (void (*)(Heap *, int))
pci->fcn;
- setAtomName(pci);
- return 1;
- }
- if( idcmp("hash",name)==0 && pci->argc==1){
- BATatoms[tpe].atomHash= (BUN (*)(ptr)) pci->fcn;
- setAtomName(pci);
- return 1;
- }
- if( idcmp("heapcheck",name)==0 && pci->argc==1){
- BATatoms[tpe].atomHeapCheck= (int (*)(Heap *,
HeapRepair *)) pci->fcn;
- setAtomName(pci);
- return 1;
- }
- break;
- case 'l':
- if( idcmp("length",name)==0 && pci->argc==1){
- BATatoms[tpe].atomLen= (int (*)(ptr)) pci->fcn;
- setAtomName(pci);
- return 1;
- }
- break;
- case 'n':
- if( idcmp("null",name)==0 && pci->argc==1){
- ptr atmnull = ((ptr (*)(void)) pci->fcn) ();
-
- BATatoms[tpe].atomNull= atmnull;
+ case 'c':
+ if (idcmp("cmp", name) == 0 && pci->argc == 1) {
+ BATatoms[tpe].atomCmp = (int (*)(ptr, ptr))pci->fcn;
setAtomName(pci);
return 1;
}
- if( idcmp("nequal",name)==0 && pci->argc==1){
- BATatoms[tpe].atomCmp= (int (*)(ptr, ptr)) pci->fcn;
+ if (idcmp("convert", name) == 0 && pci->argc == 1) {
+ BATatoms[tpe].atomConvert = (void (*)(ptr,
int))pci->fcn;
setAtomName(pci);
return 1;
}
- break;
- case 'p':
- if( idcmp("put",name)==0 && pci->argc==1){
- BATatoms[tpe].atomPut= (var_t (*)(Heap *, var_t *,
ptr)) pci->fcn;
+ break;
+ case 'f':
+ if (idcmp("fromstr", name) == 0 && pci->argc == 1) {
+ BATatoms[tpe].atomFromStr = (int (*)(str, int *, ptr
*))pci->fcn;
setAtomName(pci);
return 1;
- }
- break;
- case 's':
- @:setItem("storage",storage,TYPE_int,long)@;
- break;
- case 't':
- if( idcmp("tostr",name)==0 && pci->argc==1){
- BATatoms[tpe].atomToStr= (int (*)(str *, int *, ptr))
pci->fcn;
+ }
+ if (idcmp("fix", name) == 0 && pci->argc == 1) {
+ BATatoms[tpe].atomFix = (int (*)(ptr))pci->fcn;
setAtomName(pci);
return 1;
- }
+ }
break;
- case 'u':
- if( idcmp("unfix",name)==0 && pci->argc==1){
- BATatoms[tpe].atomUnfix= (int (*)(ptr)) pci->fcn;
+ case 'h':
+ if (idcmp("heap", name) == 0 && pci->argc == 1) {
+ /* heap function makes an atom varsized */
+ BATatoms[tpe].size = sizeof(var_t);
+ assert_shift_width(ATOMelmshift(BATatoms[tpe].size),
BATatoms[tpe].size);
+ BATatoms[tpe].varsized = 1;
+ BATatoms[tpe].align = sizeof(var_t);
+ BATatoms[tpe].atomHeap = (void (*)(Heap *,
size_t))pci->fcn;
setAtomName(pci);
return 1;
- }
- break;
- case 'v':
- @:setItem("varsized",varsized,TYPE_int,long)@
- break;
- case 'r':
- if( idcmp("read",name)==0 && pci->argc==1){
- BATatoms[tpe].atomRead= (void *(*)(void *, stream *,
size_t)) pci->fcn;
+ }
+ if (idcmp("heapconvert", name) == 0 && pci->argc == 1) {
+ BATatoms[tpe].atomHeapConvert = (void (*)(Heap *,
int))pci->fcn;
setAtomName(pci);
return 1;
- }
- break;
- case 'w':
- if( idcmp("write",name)==0 && pci->argc==1){
- BATatoms[tpe].atomWrite= (int (*)(void *, stream *,
size_t)) pci->fcn;
+ }
+ if (idcmp("hash", name) == 0 && pci->argc == 1) {
+ BATatoms[tpe].atomHash = (BUN (*)(ptr))pci->fcn;
setAtomName(pci);
return 1;
- }
+ }
+ if (idcmp("heapcheck", name) == 0 && pci->argc == 1) {
+ BATatoms[tpe].atomHeapCheck = (int (*)(Heap *,
HeapRepair *))pci->fcn;
+ setAtomName(pci);
+ return 1;
+ }
+ break;
+ case 'l':
+ if (idcmp("length", name) == 0 && pci->argc == 1) {
+ BATatoms[tpe].atomLen = (int (*)(ptr))pci->fcn;
+ setAtomName(pci);
+ return 1;
+ }
+ break;
+ case 'n':
+ if (idcmp("null", name) == 0 && pci->argc == 1) {
+ ptr atmnull = ((ptr (*)(void))pci->fcn)();
+
+ BATatoms[tpe].atomNull = atmnull;
+ setAtomName(pci);
+ return 1;
+ }
+ if (idcmp("nequal", name) == 0 && pci->argc == 1) {
+ BATatoms[tpe].atomCmp = (int (*)(ptr, ptr))pci->fcn;
+ setAtomName(pci);
+ return 1;
+ }
+ break;
+ case 'p':
+ if (idcmp("put", name) == 0 && pci->argc == 1) {
+ BATatoms[tpe].atomPut = (var_t (*)(Heap *, var_t *,
ptr))pci->fcn;
+ setAtomName(pci);
+ return 1;
+ }
+ break;
+ case 's':
+ @ : setItem("storage", storage, TYPE_int, long) @;
+ break;
+ case 't':
+ if (idcmp("tostr", name) == 0 && pci->argc == 1) {
+ BATatoms[tpe].atomToStr = (int (*)(str *, int *,
ptr))pci->fcn;
+ setAtomName(pci);
+ return 1;
+ }
+ break;
+ case 'u':
+ if (idcmp("unfix", name) == 0 && pci->argc == 1) {
+ BATatoms[tpe].atomUnfix = (int (*)(ptr))pci->fcn;
+ setAtomName(pci);
+ return 1;
+ }
+ break;
+ case 'v':
+ @ : setItem("varsized", varsized, TYPE_int, long) @
+ break;
+ case 'r':
+ if (idcmp("read", name) == 0 && pci->argc == 1) {
+ BATatoms[tpe].atomRead = (void *(*)(void *, stream *,
size_t))pci->fcn;
+ setAtomName(pci);
+ return 1;
+ }
+ break;
+ case 'w':
+ if (idcmp("write", name) == 0 && pci->argc == 1) {
+ BATatoms[tpe].atomWrite = (int (*)(void *, stream *,
size_t))pci->fcn;
+ setAtomName(pci);
+ return 1;
+ }
break;
}
return 0;
@@ -271,32 +273,33 @@
acceptable for the kernel.
@c
-void malAtomDefinition(str name, int tpe){
+void malAtomDefinition(str name, int tpe)
+{
int i;
- if(strlen(name) >= IDLENGTH){
- showException(SYNTAX,"atomDefinition", "Atom name '%s' too
long", name);
+ if (strlen(name) >= IDLENGTH) {
+ showException(SYNTAX, "atomDefinition", "Atom name '%s' too
long", name);
return;
}
- if( ATOMindex(name)>=0){
- showException(TYPE,"atomDefinition", "Redefinition of atom
'%s'", name);
+ if (ATOMindex(name) >= 0) {
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list