digitalmars.D - Error Report: Internal error: ..\ztc\dt.c 104 - classgen.d
- Christopher Stevenson (156/156) Aug 05 2004 I've just started playing around with D and Windows programming (with Pe...
- Walter (4/6) Aug 05 2004 my
- Chris Stevenson (180/183) Aug 05 2004 aheh... oops... here:
- Christopher Stevenson (13/14) Aug 05 2004 *sigh* I just figured out my little problem. I changed a named enum to ...
- J C Calvarese (19/41) Aug 05 2004 I agree. Here's a short (yet complete) example that shows how the
I've just started playing around with D and Windows programming (with Petzold's _Programming_Windows_ 5th Ed handy) and I decided to write a D&D (3.5 ed) character generator, to help my mastery of the language. Anyways, this code here, along with another module (diceroll.d) that compiled successfully. I get the error message: Internal error: ..\ztc\dt.c 104 I'd figure this might help in figuring out the error. Also, what part of my program is causing it, so I can figure out a workaround thus far. Thanks, Chris Stevenson begin 0644 classgen.d M(%-/4D-%4D52+`T*("` (%=)6D%21`T*("` ('T-" T*+RHJ*BHJ* T**F5N M8V]N<W0 :6YT($580T507U)/3$P (#T -3L-"F-O;G-T(&EN="!45TE.2U]2 M:6YG(&)E;&]W+B` 5&AE<V4 :6YT96=E<G, <F5P<F5S96YT('1H92!R96QA M=&EV90T*+R\ <')I;W)I='D ;V8 =&AE(&%B:6QI='D <V-O<F5S+"!B>2!C M;&%S<RX (%1H97-E(&%R92!I;B!T:&4 ;W)D97( ;V8 =&AE(`T*+R\ 06)I M;&ET>5-C;W)E<R!E;G5M('1Y<&4 86)O=F4L('=I=& 82!L;W=E<B!N=6UB M="!;-ET 6VEN="YM87A=(&%B:5!R:6]R:71Y(#T-"B` ("!;(%LQ+"`R+"`R M,BP ,RP ,5TL("` ("\O($)A<F0-"B` ("` (%LS+"`S+"`R+"`S+"`Q+"`R M"B` ("` (%LR+"`S+"`S+"`S+"`R+"`Q72P ("` +R\ 4&%L861I; T*("` M+"`Q+"`S+"`R+"`S+"`R72P ("` +R\ 4F]G=64-"B` ("` (%LS+"`R+"`S M+"`R+"`S+"`Q72P ("` +R\ 4V]R8V5R97(-"B` ("` (%LS+"`R+"`R+"`Q M87-S($-H87)A8W1E< T*>PT*("` (&EN=F%R:6%N=`T*("` ('L-"B` ("` M(&ES(&)E='=E96X ;&5V96P ,2`-"B` ("` ("` +R]A;F0 ;&5V96P ,C`N M/#T ;6%X3&5V96P )B8 ;6%X3&5V96P /#T M="!T;W1A;$QE=F5L.PT*("` ("` ("!F;W)E86-H*&EN="!L979E;#L 8VQA M96P /B`P("8F(&QE=F5L(#P M;$QE=F5L(#P M="!;:6YT72!C;&%S<TQE=F5L<SL-"B` ("!I;G1;-ET 86)I;&ET>5-C;W)E M(&EN="!C("D-"B` ("![("` ("` (`T*("` ("` ("` 8VQA<W-,979E;'-; M=& [(&DK*RD-"B` ("` ("` ("` (&-L87-S3&5V96QS6V-;:5U=(#T <F%N M.PT*("` ('T-" T*("` ('9O:60 9V5N97)A=&5!8FEL:71Y4V-O<F5S*&EN M*"!I;G0 8SL 8VAO<V5N*0T*("` ("` ("` >PT*("` ("` ("` ("` ("!F M:#L M("` ("` ("!D:6-E+F1I8V53:7IE(#T -CL-" T*("` ("` ("` <W=I=&-H M("AR;VQL36]D92D-"B` ("` ("` ('L-"B` ("` ("` (&-A<V4 3D]234%, M("` ("!D969A=6QT.B` ("` ("` ("` ("` ("` ("\O+T0 8V]M<&EL97( M;6%Y(&YO="!L:6ME('1H:7,-"B` ("` ("` (&-A<V4 14Q)5$5?4D],3#H- M"B` ("` ("` ("` ("!B<F5A:SL ("` ("` ("` ("` ("` ("` ("` (`T* M;W` ,B!L;W=E<W0-"B` ("` ("` ("` ("!D:6-E+F1I8V5.=6T /2`U.PT* M("` ("` ("` ("!D:6-E+F1I8V53:7IE(#T -#L-"B` ("` ("` ("` ("!D M:6-E+F1I8V5.=6T /2`V.PT*("` ("` ("` ("` (&1I8V4N9')O<$QO=V5S M("` ("` ("!B<F5A:SL-"B` ("` ("` ('T-"B` ("` ("` (`T*("` ("` M("` 9&EC92YR;VQL375L=&EP;&4 *'-C;W)E<UM=*3L-" T*("` ("` ("` M9"!O=70 82!L:71T;&4 =6=L>2X ($AE<F4G<R!T:&4 :61E83H-"B`O+R!P M<FEO<FET>5M=(&AO;&1S('1H92!R96QA=&EV92!P<FEO<FET>2!O9B!T:&4 M-B!A8FEL:71Y('-C;W)E<RP-"B`O+R!W:71H(&$ ;&]W97( ;G5M8F5R(&EN M9&EC871I;F< 82!M;W)E(&EM<&]R=&%N="!P<FEO<FET>2X (&9I;F10<FEO M:"!T:&4 <VUA;&QE<W0 ;G5M8F5R+"!S971S('1H92!P<FEO<FET>0T*("\O M(&]F('1H86X :6YD97 =&\ :6YT+FUA>"`H=&\ <F5M;W9E(&EN(&9R;VT M9G5T=7)E(&-O;G-I9&5R871I;VXI+"!A;F0 <F5T=7)N<PT*("\O('1H870 M:6YD97 N("!)9B!T:&5R92=S(&$ =&EE(&)E='=E96X ='=O(&]R(&UO<F4 M*0T*("` ("` ("` >R`-"B` ("` ("` ("` ("!I;G0 ;&]W97-T(#T :6YT M+FUA>#L- M("` :6YT(&EN9&5X4F5S=6QT.PT*("` ("` ("` ("` (&9O<F5A8V *&EN M="!A8FE);F1E>"QI;G0 8W5R<F5N=#L M("` ("` (&EF("AC=7)R96YT(#P](&QO=V5S="D-"B` ("` ("` ("` ("` M("` >PT*("` ("` ("` ("` ("` ("` ("` (&EF("AC=7)R96YT(#P ;&]W M97-T*2` ("` ("\O('1H:7, =VEL;"!A;'-O(')E<V5T(')E<W5L=%LP72`- M"B` ("` ("` ("` ("` ("` ("` ("![("` ("` ("` ("` ("` ("` ("` M("` ("`O+R!I9B!I="!F;W5N9"!A('1I92!B969O<F4-"B` ("` ("` ("` M("` ("` ("` ("` ("` ;&]W97-T(#T 8W5R<F5N=#L-"B` ("` ("` ("` M("` ("` ("` ("` ("` (')E<W5L=%LP72`](&%B:4EN9&5X.PT*("` ("` M("` ("` ("` ("` ("` ('T-"B` ("` ("` ("` ("` ("` ("` ("!E;'-E M("` ("` ("!R97-U;'0N;&5N9W1H(#T M("` ("` ("` ("` ("` ("` ("` ("` (')E<W5L=%MR97-U;'0N;&5N9W1H M+3%=(#T M=& /B`Q*0T*("` ("` ("` ("` ("` ("!I;F1E>%)E<W5L="`](')A;F0H M("` ("` ('!R:6]R:71Y6W)E<W5L=%MI;F1E>%)E<W5L=%U=(#T :6YT+FUA M>#L-"B` ("` ("` ("` ("!R971U<FX <F5S=6QT6VEN9&5X4F5S=6QT73L- M"B` ("` ("` ('T-"B` ("` ("` (&EN="!S8V]R97-);F1E>#L-"B` ("` M("` (&EN="!I.R` ("` (`T*("` ("` ("` 9F]R("AI/3`[(&D /"!A8FEL M:71Y4V-O<F5S+FQE;F=T:#L :2LK*0T*("` ("` ("` ("` (&%B:6QI='E3 M8V]R97-;9FEN9%!R:6]R:71Y*"E=(#T <V-O<F5S6W-C;W)E<TEN9&5X*RM= M.R` ("` ("` ("` ("`-"B` ("` ("` (`T*("` ("` ("` <F5T=7)N.PT* M("` ('T-"B` ("` ("` (`T*("` ('9O:60 <')I;G1/=71P=70H*0T*("` M("` ("!C;&%S<U-T<FEN9UM"05)"05))04Y=("`](")"87)B87)I86XB.PT* M("` ("` ("` 8VQA<W-3=')I;F=;1%)5241=("` ("` /2`B1')U:60B.PT* M("` ("` ("` 8VQA<W-3=')I;F=;1DE'2%1%4ET ("` /2`B1FEG:'1E<B([ M"B` ("` ("` (&-L87-S4W1R:6YG6U!!3$%$24Y=("` (#T (E!A;&%D:6XB M.PT*("` ("` ("` 8VQA<W-3=')I;F=;4D%.1T5272` ("` /2`B4F%N9V5R M(CL-"B` ("` ("` (&-L87-S4W1R:6YG6U)/1U5%72` ("` (#T (E)O9W5E M(CL-"B` ("` ("` (&-L87-S4W1R:6YG6U-/4D-%4D5272` (#T (E-O<F-E M<F5R(CL-"B` ("` ("` (&-L87-S4W1R:6YG6U=)6D%21%T ("` (#T (E=I M(&-L87-S3&5V96QS*0T*("` ("` ("` ("` ('!R:6YT9B B("` ("`E+BIS M('!R:6YT9B B4U12(#T )61<;B(L(&%B:6QI='E38V]R97-;,%TI.R`-"B` M("` ("` ('!R:6YT9B B1$58(#T )61<;B(L(&%B:6QI='E38V]R97-;,5TI M.R`-"B` ("` ("` ('!R:6YT9B B0T].(#T )61<;B(L(&%B:6QI='E38V]R M97-;,ETI.R`-"B` ("` ("` ('!R:6YT9B B24Y4(#T )61<;B(L(&%B:6QI M='E38V]R97-;,UTI.R`-"B` ("` ("` ('!R:6YT9B B5TE3(#T )61<;B(L M(&%B:6QI='E38V]R97-;-%TI.R`-"B` ("` ("` ('!R:6YT9B B0TA!(#T M)61<;B(L(&%B:6QI='E38V]R97-;-5TI.R`-" T*("` ('T-" T*?2`-" T* M+FUA>$QE=F5L(#T M"B` ("!M92YG96YE<F%T94%B:6QI='E38V]R97,H14Q)5$5?4D],3"D[("` ` end
Aug 05 2004
"Christopher Stevenson" <Christopher_member pathlink.com> wrote in message news:cetlib$1qb7$1 digitaldaemon.com...I'd figure this might help in figuring out the error. Also, what part ofmyprogram is causing it, so I can figure out a workaround thus far.Try deleting code until the minimal code is left that reproduces the error.
Aug 05 2004
I'd figure this might help in figuring out the error. Also, what part of my program is causing it, so I can figure out a workaround thus far. begin 0644 classgen.daheh... oops... here: classgen.d: ---------------------------------------------------------- import std.random; import std.c.stdio; import diceroll; enum { //PHB character classes BARBARIAN = 1, BARD, CLERIC, DRUID, FIGHTER, MONK, PALADIN, RANGER, ROGUE, SORCERER, WIZARD } //diceRoll modes const int NORMAL_ROLL = 3; const int ELITE_ROLL = 4; const int EXCEP_ROLL = 5; const int TWINK_ROLL = 6; // Yeah, this is a little confusing below. These integers represent the relative // priority of the ability scores, by class. These are in the order of the // AbilityScores enum type above, with a lower number indicating a greater priority. const int [6] [int.max] abiPriority = [ [1, 2, 2, 3, 3, 3], // Barbarian [3, 2, 3, 2, 3, 1], // Bard [3, 3, 2, 3, 1, 2], // Cleric [3, 2, 2, 3, 1, 3], // Druid, [1, 2, 2, 3, 3, 3], // Fighter [2, 2, 3, 3, 1, 3], // Monk [2, 3, 3, 3, 2, 1], // Paladin [2, 1, 3, 3, 2, 3], // Ranger [3, 1, 3, 2, 3, 2], // Rogue [3, 2, 3, 2, 3, 1], // Sorcerer [3, 2, 2, 1, 3, 3] ]; // Wizard class Character { invariant { //Check that the character to be generated is between level 1 //and level 20. assert (0 < minLevel && minLevel <= maxLevel && maxLevel <= 20); int totalLevel; foreach(int level; classLevels) { assert(level > 0 && level <= 20); totalLevel += level; } assert(totalLevel <= 20); } private: int [int] classLevels; int[6] abilityScores; public: int minLevel = 1; int maxLevel = 1; void pickClass( int c ) { classLevels[c] = rand() % (maxLevel - minLevel + 1); } void pickClass(int[] c) { int i; for (i=0; i < c.length; i++) classLevels[c[i]] = rand() % ( (maxLevel - minLevel + 1) / c.length); } void generateAbilityScores(int rollMode) { int[6] priority; int[6] scores; int[] chosen = classLevels.keys; foreach( int c; chosen) { for (int stupidCtr; stupidCtr < priority.length; stupidCtr++) priority[stupidCtr] += abiPriority[c][stupidCtr]; } Dice dice = new Dice(); dice.diceSize = 6; switch (rollMode) { case NORMAL_ROLL: dice.diceNum = 3; // 3d6, straight up break; default: ///D compiler may not like this case ELITE_ROLL: dice.diceNum = 4; // 4d6, drop lowest dice.dropLowest = 1; break; case EXCEP_ROLL: // 5d6 drop 2 lowest dice.diceNum = 5; dice.dropLowest = 2; break; case TWINK_ROLL: // 6d6, drop 3 lowest, reroll 1s and 2s dice.diceSize = 4; dice.diceNum = 6; dice.dropLowest = 3; dice.diceMod = 6; break; } dice.rollMultiple (scores[]); scores.sort; // This findPriority() turned out a little ugly. Here's the idea: // priority[] holds the relative priority of the 6 ability scores, // with a lower number indicating a more important priority. findPriority() // finds the index in priority[] with the smallest number, sets the priority // of than index to int.max (to remove in from future consideration), and returns // that index. If there's a tie between two or more indicies, findPriority() // randomly chooses between them. int findPriority() { int lowest = int.max; int []result; int indexResult; foreach (int abiIndex,int current; priority) if (current <= lowest) { if (current < lowest) // this will also reset result[0] { // if it found a tie before lowest = current; result.length = 1; result[0] = abiIndex; } else { result.length = result.length + 1; result[result.length-1] = abiIndex; } } if (result.length > 1) indexResult = rand() % result.length; priority[result[indexResult]] = int.max; return result[indexResult]; } int scoresIndex; int i; for (i=0; i < abilityScores.length; i++) abilityScores[findPriority()] = scores[scoresIndex++]; return; } void printOutput() { char[][int] classString; classString[BARBARIAN] = "Barbarian"; classString[BARD] = "Bard"; classString[CLERIC] = "Cleric"; classString[DRUID] = "Druid"; classString[FIGHTER] = "Fighter"; classString[MONK] = "Monk"; classString[PALADIN] = "Paladin"; classString[RANGER] = "Ranger"; classString[ROGUE] = "Rogue"; classString[SORCERER] = "Sorcerer"; classString[WIZARD] = "Wizard"; foreach (int c, int level; classLevels) printf(" %.*s %d\n" , classString[c] , level); printf("STR = %d\n", abilityScores[0]); printf("DEX = %d\n", abilityScores[1]); printf("CON = %d\n", abilityScores[2]); printf("INT = %d\n", abilityScores[3]); printf("WIS = %d\n", abilityScores[4]); printf("CHA = %d\n", abilityScores[5]); } } /// FOR TESTING ONLY int main() { Character me = new Character(); me.maxLevel = 5; me.pickClass(FIGHTER); me.generateAbilityScores(ELITE_ROLL); me.printOutput(); return 0; }
Aug 05 2004
*sigh* I just figured out my little problem. I changed a named enum to an unnamed one, did a text replacement for the old name to "int", and forgot to modifiy one little bit of code:const int [6] [int.max] abiPriority =..oops The D compiler should have caught that one, with the initializers for a const array not matching the array length. Good luck on refining this new language, and geting the compiler to behave. Now, (for D&D fans) it's on to figuring a neat way to calculate the base to hit mod and save mod, and how to prioritize skill point selection. I think a simple switch statement will handle the former, but the latter is going to be... interesting, esp for multiclassed characters. Sorry for the newsgroup spam... Christopher Stevenson
Aug 05 2004
Christopher Stevenson wrote:*sigh* I just figured out my little problem. I changed a named enum to an unnamed one, did a text replacement for the old name to "int", and forgot to modifiy one little bit of code:I agree. Here's a short (yet complete) example that shows how the problem manifests: const int [6] [int.max] abiPriority = [ [1, 2, 2, 3, 3, 3], [3, 2, 2, 1, 3, 3] ]; Cryptic Error Message: Internal error: ..\ztc\dt.c 104 I'm cross-posting this onto the bugs group to increase the likelihood that Walter fixes it: *web interface* http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs *usenet interface* news://news.digitalmars.com/digitalmars.D.bugsconst int [6] [int.max] abiPriority =...oops The D compiler should have caught that one, with the initializers for a const array not matching the array length. Good luck on refining this new language,and geting the compiler to behave. Now, (for D&D fans) it's on to figuring a neat way to calculate the base to hit mod and save mod, and how to prioritize skill point selection. I think a simple switch statement will handle the former, but the latter is going to be... interesting, esp for multiclassed characters. Sorry for the newsgroup spam...Submitting bug reports is helpful. (Don't be sorry. Be proud.) I don't consider it spam unless you're trying to sell something.Christopher Stevenson-- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
Aug 05 2004