Subversion Repositories filter_foundry

Rev

Rev 194 | Rev 206 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 194 Rev 198
Line 65... Line 65...
65
 
65
 
66
                /* expressions, broken into lines no longer than CHOPLINES characters */
66
                /* expressions, broken into lines no longer than CHOPLINES characters */
67
                for( i=0 ; i<4 ; ++i ){
67
                for( i=0 ; i<4 ; ++i ){
68
                        if( (r = expr[i]) )
68
                        if( (r = expr[i]) )
69
                                for( n = strlen(r) ; n ; n -= chunk ){
69
                                for( n = strlen(r) ; n ; n -= chunk ){
70
                                        chunk = n>CHOPLINES ? CHOPLINES : n;
70
                                        chunk = n> (int)CHOPLINES ? (int)CHOPLINES : n;
71
                                        for( j = chunk,q = outbuf ; j-- ; )
71
                                        for( j = chunk,q = outbuf ; j-- ; )
72
                                                if(*r == CR){
72
                                                if(*r == CR){
73
                                                        *q++ = '\\';
73
                                                        *q++ = '\\';
74
                                                        *q++ = 'r';
74
                                                        *q++ = 'r';
75
                                                        ++r;
75
                                                        ++r;
Line 78... Line 78...
78
                                        *q++ = '\r';
78
                                        *q++ = '\r';
79
                                        *q = 0;
79
                                        *q = 0;
80
                                        p = cat(p,outbuf);
80
                                        p = cat(p,outbuf);
81
                                }
81
                                }
82
                        else
82
                        else
83
                                p = cat(p,"(null expr)\r"); // this shouldn't happen
83
                                p = cat(p,_strdup("(null expr)\r")); // this shouldn't happen
84
                        *p++ = '\r';
84
                        *p++ = '\r';
85
                }
85
                }
86
 
86
 
87
//              *p = 0; dbg(start);
87
//              *p = 0; dbg(start);
88
 
88
 
Line 103... Line 103...
103
 
103
 
104
Boolean savefile(StandardFileReply *sfr){
104
Boolean savefile(StandardFileReply *sfr){
105
        FILEREF r;
105
        FILEREF r;
106
        Handle h;
106
        Handle h;
107
        Boolean res = false;
107
        Boolean res = false;
108
        char *reasonstr = "";
108
        char *reasonstr = _strdup("");
109
 
109
 
110
        FSpDelete(&sfr->sfFile);
110
        FSpDelete(&sfr->sfFile);
111
        if(FSpCreate(&sfr->sfFile,SIG_SIMPLETEXT,TEXT_FILETYPE,sfr->sfScript) == noErr)
111
        if(FSpCreate(&sfr->sfFile,SIG_SIMPLETEXT,TEXT_FILETYPE,sfr->sfScript) == noErr)
112
                if(FSpOpenDF(&sfr->sfFile,fsWrPerm,&r) == noErr){
112
                if(FSpOpenDF(&sfr->sfFile,fsWrPerm,&r) == noErr){
113
 
113
 
Line 115... Line 115...
115
                                res = !(saveparams(h) || savehandleintofile(h,r)) ;
115
                                res = !(saveparams(h) || savehandleintofile(h,r)) ;
116
                                PIDISPOSEHANDLE(h);
116
                                PIDISPOSEHANDLE(h);
117
                        }
117
                        }
118
 
118
 
119
                        FSClose(r);
119
                        FSClose(r);
120
                }else reasonstr = (my_strdup("Could not open the file."));
120
                }else reasonstr = (_strdup("Could not open the file."));
121
        else reasonstr = (my_strdup("Could not create the file."));
121
        else reasonstr = (_strdup("Could not create the file."));
122
 
122
 
123
        if(!res)
123
        if(!res)
124
                alertuser(my_strdup("Could not save settings."),reasonstr);
124
                alertuser(_strdup("Could not save settings."),reasonstr);
125
 
125
 
126
        return res;
126
        return res;
127
}
127
}