Changeset 108

Show
Ignore:
Timestamp:
07/10/05 23:31:17 (3 years ago)
Author:
pragma
Message:

- finished fromString() runtime string conversion lib
- fixed subtle in/out mistake in OutCode?.d
+ (bugfix) Lib cache 'ballooning' feature doesn't behave correctly. Causes aggregate .dlls to be permanently loaded.
+ (bugfix) <?dsp:output?> and <dsp:output> both require a closing ';' to function

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dsp/DSPGrammar.d

    r104 r108  
    4242    public static char[] servletDecl = "(IDSPRequest request, IDSPResponse response)"; 
    4343     
    44     public static char[] outputFunc = "response.getWriter.put"; 
     44    public static char[] outputFunc = "response.getWriter << "; //"response.getWriter.put"; 
    4545    public static char[] replaceFunc = "std.string.replace"; 
    4646    public static char[] toStringFunc = "std.string.toString"; 
     
    7070     
    7171    public static char[] beginOutput(){ 
    72         return outputFunc ~ "(``"; 
     72        return outputFunc ~ "``"; //"(``"; 
    7373    } 
    7474     
    7575    public static char[] endOutput(){ 
    76         return ");" ~ newline; 
     76        return ";" ~ newline; //");" ~ newline; 
    7777    } 
    7878 
  • trunk/dsp/DSPProcessor.d

    r104 r108  
    6161                case "in": 
    6262                    generator.appendCPIn(data); 
     63                    generator.appendCPIn(";"); 
    6364                    break; 
    6465 
    6566                case "out": 
    6667                    generator.appendCPOut(data); 
     68                    generator.appendCPOut(";"); 
    6769                    break; 
    6870 
     
    8284            else if(name == DSPGrammar.rawPreamble){ 
    8385                generator.appendBody(data); 
     86                generator.appendBody(";"); 
    8487            } 
    8588            else{ 
  • trunk/dsp/Register.d

    r102 r108  
    9494    char[] value; 
    9595    char[] name; 
    96      
     96        
    9797    void appendCode(char[] code){ 
    9898        if(type == RegisterType.TEXT){ 
  • trunk/dsp/ServletGenerator.d

    r107 r108  
    6363    Box[] stack; 
    6464     
    65     int contentMode; 
    66     bit outputSegment; 
     65    public int contentMode; 
     66    public bit outputSegment; 
    6767     
    6868    enum{ 
  • trunk/dsp/servlet/DSPLibraryCache.d

    r107 r108  
    163163    } 
    164164     
    165     protected void dropEntry(DSPLibrary lib){ 
    166         debug printf("dropEntry\n"); 
     165    // removes an entry from the list 
     166    protected void removeEntry(DSPLibrary lib){ 
     167        debug printf("removeEntry\n"); 
    167168        if(lib.next) lib.next.last = lib.last; 
    168169        if(lib.last) lib.last.next = lib.next; 
     
    181182    } 
    182183     
     184    // inserts library at the head of the list 
    183185    protected void makePopular(DSPLibrary lib){ 
    184186        debug printf("makePopular\n"); 
    185         dropEntry(lib); 
     187        removeEntry(lib); 
    186188        if(mostPopular is null){ 
    187189            mostPopular = lib; 
     
    195197    } 
    196198     
    197     protected void dropLeastPopular(){ 
    198         debug printf("dropLeastPopular\n"); 
     199    // attempt to remove the least popular, unused library 
     200    protected void removeLeastPopular(){ 
     201        debug printf("removeLeastPopular\n"); 
     202         
    199203        if(leastPopular){ 
    200             leastPopular.unload(); 
    201             leastPopular = leastPopular.next; 
    202             if(leastPopular){ 
    203                 leastPopular.last = null
     204            // are we being used right now? 
     205            if(!leastPopular.inUse){ 
     206               leastPopular.unload(); 
     207                removeEntry(leastPopular)
    204208            } 
    205209        } 
     
    214218             
    215219            if(freeCount == 0){ 
    216                 //replace oldest cache entry and free the replaced entry 
    217                 map.remove(leastPopular.key); 
     220                //replace oldest cache entry (if possible) and free the replaced entry 
    218221                synchronized(this){ 
    219                     dropLeastPopular(); 
     222                    removeLeastPopular(); 
    220223                    makePopular(lib); 
    221224                } 
     
    237240                //remove this entry from the list 
    238241                synchronized(this){ 
    239                     dropEntry(lib); 
     242                    removeEntry(lib); 
    240243                } 
    241244                freeCount++; 
  • trunk/dsp/tags/Code.d

    r97 r108  
    4141     
    4242    public void endTag(ServletCompilationContext context,char[] name,XMLAttributes attribs,bit isEmpty){ 
    43         context.generator.setContentMode(ServletGenerator.LiteralContentMode);   
     43        with(context){ 
     44            generator.appendBody(";"); 
     45            generator.setContentMode(ServletGenerator.LiteralContentMode);   
     46        } 
    4447    } 
    4548} 
  • trunk/dsp/tags/InCode.d

    r97 r108  
    4040     
    4141    public void endTag(ServletCompilationContext context,char[] name,XMLAttributes attribs,bit isEmpty){ 
    42         context.generator.setContentMode(ServletGenerator.LiteralContentMode);   
     42        with(context){ 
     43            generator.appendCPIn(";"); 
     44            generator.setContentMode(ServletGenerator.LiteralContentMode);   
     45        } 
    4346    } 
    4447} 
  • trunk/dsp/tags/OutCode.d

    r97 r108  
    3636class OutCode : DSPTag{ 
    3737    public void startTag(ServletCompilationContext context,char[] name,XMLAttributes attribs,bit isEmpty){ 
    38         context.generator.setContentMode(ServletGenerator.InCodeContentMode);  
     38        context.generator.setContentMode(ServletGenerator.OutCodeContentMode);     
    3939    } 
    4040     
    4141    public void endTag(ServletCompilationContext context,char[] name,XMLAttributes attribs,bit isEmpty){ 
    42         context.generator.setContentMode(ServletGenerator.LiteralContentMode);   
     42        with(context){ 
     43            generator.appendCPOut(";"); 
     44            generator.setContentMode(ServletGenerator.LiteralContentMode); 
     45        } 
    4346    } 
    4447}