Mercurial > hg > CbC > old > device
comparison Changes @ 357:1057d6740a36
*** empty log message ***
author | kono |
---|---|
date | Sun, 04 Jul 2004 22:08:46 +0900 |
parents | 6818bd03767d |
children | 4f1fe3731ff0 |
comparison
equal
deleted
inserted
replaced
356:6818bd03767d | 357:1057d6740a36 |
---|---|
5459 c2cbc を考えると、やっぱり、構文木で実装するべきでしょ? | 5459 c2cbc を考えると、やっぱり、構文木で実装するべきでしょ? |
5460 | 5460 |
5461 global heap は拡張可能じゃない? local heap がない時に、 | 5461 global heap は拡張可能じゃない? local heap がない時に、 |
5462 やばそうだったら拡張してしまう。realloc でいいし。 | 5462 やばそうだったら拡張してしまう。realloc でいいし。 |
5463 pointer とっているのは scope だけじゃないか? | 5463 pointer とっているのは scope だけじゃないか? |
5464 | |
5465 うーん、やっぱり、global heap の拡張は、それほど単純じゃない | |
5466 みたいね。 | |
5467 | |
5468 | |
5469 41c41,43 | |
5470 < int args,init_vars,heap[HEAPSIZE]; | |
5471 --- | |
5472 > int args,init_vars; | |
5473 > int *heap; | |
5474 > static int HEAPSIZE = HEAPSIZE0; | |
5475 236a234,245 | |
5476 > void | |
5477 > clear_lfree() | |
5478 > { | |
5479 > if (gfree>HEAPSIZE-LHEAPMARGIN) { | |
5480 > HEAPSIZE *= 2; | |
5481 > heap = realloc(heap,HEAPSIZE*sizeof(int)); | |
5482 > if (!heap) error(MMERR); | |
5483 > fprintf(stderr,"heap extended to %d\n",HEAPSIZE); | |
5484 > } | |
5485 > lfree= HEAPSIZE; | |
5486 > } | |
5487 > static void | |
5488 331a353,354 | |
5489 > if (!heap) heap = (int *)malloc(HEAPSIZE*sizeof(int)); | |
5490 > if (!heap) error(MMERR); | |
5491 | |
5492 ぐらいではぜんぜんだめ。 | |
5493 |