Never mind this query. I got it working.
-------------------------------------------------- From: "Rob Withers" reefedjib@yahoo.com Sent: Friday, July 23, 2010 5:08 AM To: "Squeak Virtual Machine Development Discussion" vm-dev@lists.squeakfoundation.org Subject: Re: [Vm-dev] Changes to plugin variable declarations?
Hmm, I tried this change and it didn't work. Here is my error. If anyone can shed some light on this I would appreciate it. For the first one, encryptwith, I posted the method, in C, below the error. It looks like it is trying to subscript these variables: static sqInt pc1; static sqInt pc2; static sqInt sp1; static sqInt sp2; static sqInt sp3; static sqInt sp4; static sqInt sp5; static sqInt sp6; static sqInt sp7; static sqInt sp8; static sqInt totRot;
Error from make/gcc ../../../src/plugins/DESPlugin/DESPlugin.c: In function `encryptwith': ../../../src/plugins/DESPlugin/DESPlugin.c:173: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:174: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:175: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:176: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:178: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:179: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:180: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:181: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:185: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:186: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:187: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:188: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:190: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:191: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:192: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:193: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c: In function `primitiveDESTransform':
../../../src/plugins/DESPlugin/DESPlugin.c:307: error: parse error before '[' to ken ../../../src/plugins/DESPlugin/DESPlugin.c:326: error: `work' undeclared (first use in this function) ../../../src/plugins/DESPlugin/DESPlugin.c:326: error: (Each undeclared identifi er is reported only once ../../../src/plugins/DESPlugin/DESPlugin.c:326: error: for each function it appe ars in.) ../../../src/plugins/DESPlugin/DESPlugin.c:357: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:358: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:359: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:360: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:362: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:363: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:364: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:365: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:369: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:370: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:371: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:372: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:374: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:375: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:376: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:377: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c: In function `processKeymodeto': ../../../src/plugins/DESPlugin/DESPlugin.c:420: error: parse error before '[' to ken ../../../src/plugins/DESPlugin/DESPlugin.c:421: error: parse error before '[' to ken ../../../src/plugins/DESPlugin/DESPlugin.c:424: error: parse error before '[' to ken ../../../src/plugins/DESPlugin/DESPlugin.c:428: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:430: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:431: error: `pc1m' undeclared (first use in this function) ../../../src/plugins/DESPlugin/DESPlugin.c:445: error: `rawKey' undeclared (firs t use in this function) ../../../src/plugins/DESPlugin/DESPlugin.c:447: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:449: error: `pcr' undeclared (first u se in this function) ../../../src/plugins/DESPlugin/DESPlugin.c:456: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:465: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:466: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:468: error: subscripted value is neit her array nor pointer ../../../src/plugins/DESPlugin/DESPlugin.c:469: error: subscripted value is neit her array nor pointer make[1]: *** [DESPlugin.o] Error 1 make[1]: Leaving directory `/cygdrive/c/Cog/vm-src/cygwinbuild/build/DESPlugin' make: *** [build/vm/DESPlugin.dll] Error 2
C source: static sqInt encryptwith(unsigned long *dataPtr, unsigned long *key) { unsigned long fVal; unsigned long left; unsigned long right; sqInt round; unsigned long work;
left = dataPtr[0]; /* perform required but otherwise pointless bit twizzling */ right = dataPtr[1]; work = ((((usqInt) left) >> 4) ^ right) & 252645135; right = right ^ work; left = left ^ (work << 4); work = ((((usqInt) left) >> 16) ^ right) & 65535; right = right ^ work; left = left ^ (work << 16); work = ((((usqInt) right) >> 2) ^ left) & 858993459; left = left ^ work; right = right ^ (work << 2); work = ((((usqInt) right) >> 8) ^ left) & 16711935; left = left ^ work; right = right ^ (work << 8); right = ((right << 1) | ((((usqInt) right) >> 31) & 1)) &
4294967295U; work = (left ^ right) & 2863311530U; left = left ^ work; right = right ^ work;
/* perform the 8 rounds of real encryption */ left = ((left << 1) | ((((usqInt) left) >> 31) & 1)) & 4294967295U; for (round = 0; round <= 28; round += 4) { work = (right << 28) | (((usqInt) right) >> 4); work = work ^ (key[round]); fVal = sp7[work & 63]; fVal = fVal | (sp5[(((usqInt) work) >> 8) & 63]); fVal = fVal | (sp3[(((usqInt) work) >> 16) & 63]); fVal = fVal | (sp1[(((usqInt) work) >> 24) & 63]); work = right ^ (key[round + 1]); fVal = fVal | (sp8[work & 63]); fVal = fVal | (sp6[(((usqInt) work) >> 8) & 63]); fVal = fVal | (sp4[(((usqInt) work) >> 16) & 63]); fVal = fVal | (sp2[(((usqInt) work) >> 24) & 63]); left = left ^ fVal; work = (left << 28) | (((usqInt) left) >> 4); work = work ^ (key[round + 2]); fVal = sp7[work & 63]; fVal = fVal | (sp5[(((usqInt) work) >> 8) & 63]); fVal = fVal | (sp3[(((usqInt) work) >> 16) & 63]); fVal = fVal | (sp1[(((usqInt) work) >> 24) & 63]); work = left ^ (key[round + 3]); fVal = fVal | (sp8[work & 63]); fVal = fVal | (sp6[(((usqInt) work) >> 8) & 63]); fVal = fVal | (sp4[(((usqInt) work) >> 16) & 63]); fVal = fVal | (sp2[(((usqInt) work) >> 24) & 63]); right = right ^ fVal; } right = (right << 31) | (((usqInt) right) >> 1); work = (left ^ right) & 2863311530U; left = left ^ work; right = right ^ work; left = (left << 31) | (((usqInt) left) >> 1); work = ((((usqInt) left) >> 8) ^ right) & 16711935; right = right ^ work; left = left ^ (work << 8); work = ((((usqInt) left) >> 2) ^ right) & 858993459; right = right ^ work; left = left ^ (work << 2); work = ((((usqInt) right) >> 16) ^ left) & 65535; left = left ^ work; right = right ^ (work << 16); work = ((((usqInt) right) >> 4) ^ left) & 252645135; left = left ^ work; right = right ^ (work << 4); dataPtr[0] = right; dataPtr[1] = left;
}
From: "Rob Withers" reefedjib@yahoo.com Sent: Friday, July 23, 2010 4:14 AM To: "Squeak VM Dev" vm-dev@lists.squeakfoundation.org Subject: [Vm-dev] Changes to plugin variable declarations?
I am trying to compile DESPlugin, DSAPrims, MD5Plugin and SHA256Plugin with Cog. I am getting errors with DESPlugin:
../../../src/plugins/DESPlugin/DESPlugin.c: In function `encryptwith': ../../../src/plugins/DESPlugin/DESPlugin.c:173: error: subscripted value is neit her array nor pointer
Looking into that method, we have:
self var: 'dataPtr' declareC: 'unsigned long *dataPtr'. self var: 'key' declareC: 'unsigned long *key'. self var: 'fVal' declareC: 'unsigned long fVal'. self var: 'work' declareC: 'unsigned long work'. self var: 'right' declareC: 'unsigned long right'. self var: 'left' declareC: 'unsigned long left'.
In browsing the code I see the following in #primitiveRead24BmpLine of BMPReadWriterPlugin (chosen at random):
<var: #formBits type: 'unsigned int *'>
Does this mean my variable definitions should be:
<var: #dataPtr type: 'unsigned long *'> <var: #key type: 'unsigned long *'> <var: #fVal type: 'unsigned long'> <var: #work type: 'unsigned long'> <var: #right type: 'unsigned long'> <var: #left type: 'unsigned long'>
?
WHat other changes are their?
TIA, Rob