3064 ! ! |
3064 ! ! |
3065 |
3065 |
3066 !String methodsFor:'printing & storing'! |
3066 !String methodsFor:'printing & storing'! |
3067 |
3067 |
3068 errorPrint |
3068 errorPrint |
3069 "print the receiver on standard output. |
3069 "print the receiver on standard error, if the global Stderr is nil; |
|
3070 otherwise, fall back to the inherited errorPrint, which sends the string to |
|
3071 the Stderr stream. |
3070 This method does NOT (by purpose) use the stream classes and |
3072 This method does NOT (by purpose) use the stream classes and |
3071 will therefore work even in case of emergency (but only, if Stdout is nil)." |
3073 will therefore work even in case of emergency during early startup |
|
3074 (but only, as long as Stderr is nil, which is set later after startup)." |
3072 |
3075 |
3073 %{ /* NOCONTEXT */ |
3076 %{ /* NOCONTEXT */ |
3074 |
3077 |
3075 if (@global(Stderr) == nil) { |
3078 if (@global(Stderr) == nil) { |
3076 if (__qIsStringLike(self)) { |
3079 if (__qIsStringLike(self)) { |
3077 console_fprintf(stderr, "%s" , __stringVal(self)); |
3080 console_fprintf(stderr, "%s" , __stringVal(self)); |
3078 console_fflush(stderr); |
3081 console_fflush(stderr); |
3079 RETURN (self); |
3082 RETURN (self); |
3080 } |
3083 } |
3081 } |
3084 } |
3089 'Bönnigheim' asUnicodeString errorPrint |
3092 'Bönnigheim' asUnicodeString errorPrint |
3090 " |
3093 " |
3091 ! |
3094 ! |
3092 |
3095 |
3093 errorPrintCR |
3096 errorPrintCR |
3094 "print the receiver on standard output, followed by a cr. |
3097 "print the receiver on standard error, followed by a cr, |
|
3098 if the global Stderr is nil; otherwise, fall back to the inherited errorPrintCR, |
|
3099 which sends the string to the Stderr stream. |
3095 This method does NOT (by purpose) use the stream classes and |
3100 This method does NOT (by purpose) use the stream classes and |
3096 will therefore work even in case of emergency (but only, if Stdout is nil)." |
3101 will therefore work even in case of emergency during early startup |
|
3102 (but only, as long as Stderr is nil, which is set later after startup)." |
3097 |
3103 |
3098 %{ /* NOCONTEXT */ |
3104 %{ /* NOCONTEXT */ |
3099 |
3105 |
3100 if (@global(Stderr) == nil) { |
3106 if (@global(Stderr) == nil) { |
3101 if (__qIsStringLike(self)) { |
3107 if (__qIsStringLike(self)) { |
3102 console_fprintf(stderr, "%s\n" , __stringVal(self)); |
3108 console_fprintf(stderr, "%s\n" , __stringVal(self)); |
3103 console_fflush(stderr); |
3109 console_fflush(stderr); |
3104 RETURN (self); |
3110 RETURN (self); |
3105 } |
3111 } |
3106 } |
3112 } |
3107 %}. |
3113 %}. |
3108 ^ super errorPrintCR |
3114 ^ super errorPrintCR |
3109 ! |
3115 ! |
3110 |
3116 |
3111 print |
3117 print |
3112 "print the receiver on standard output. |
3118 "print the receiver on standard output, if the global Stdout is nil; |
|
3119 otherwise, fall back to the inherited errorPrint, which sends the string to |
|
3120 the Stdout stream. |
3113 This method does NOT (by purpose) use the stream classes and |
3121 This method does NOT (by purpose) use the stream classes and |
3114 will therefore work even in case of emergency (but only, if Stdout is nil)." |
3122 will therefore work even in case of emergency during early startup |
|
3123 (but only, as long as Stdout is nil, which is set later after startup)." |
3115 |
3124 |
3116 %{ /* NOCONTEXT */ |
3125 %{ /* NOCONTEXT */ |
3117 |
3126 |
3118 if (@global(Stdout) == nil) { |
3127 if (@global(Stdout) == nil) { |
3119 if (__qIsStringLike(self)) { |
3128 if (__qIsStringLike(self)) { |
3120 console_fprintf(stdout, "%s" , __stringVal(self)); |
3129 console_fprintf(stdout, "%s" , __stringVal(self)); |
3121 console_fflush(stdout); |
3130 console_fflush(stdout); |
3122 RETURN (self); |
3131 RETURN (self); |
3123 } |
3132 } |
3124 } |
3133 } |
3125 %}. |
3134 %}. |
3126 ^ super print |
3135 ^ super print |
3127 ! |
3136 ! |
3128 |
3137 |
3129 printCR |
3138 printCR |
3130 "print the receiver on standard output, followed by a cr. |
3139 "print the receiver on standard output, followed by a cr, |
|
3140 if the global Stdout is nil; otherwise, fall back to the inherited errorPrintCR, |
|
3141 which sends the string to the Stdout stream. |
3131 This method does NOT (by purpose) use the stream classes and |
3142 This method does NOT (by purpose) use the stream classes and |
3132 will therefore work even in case of emergency (but only, if Stdout is nil)." |
3143 will therefore work even in case of emergency during early startup |
|
3144 (but only, as long as Stdout is nil, which is set later after startup)." |
3133 |
3145 |
3134 %{ /* NOCONTEXT */ |
3146 %{ /* NOCONTEXT */ |
3135 |
3147 |
3136 if (@global(Stdout) == nil) { |
3148 if (@global(Stdout) == nil) { |
3137 if (__qIsStringLike(self)) { |
3149 if (__qIsStringLike(self)) { |
3138 console_fprintf(stdout, "%s\n" , __stringVal(self)); |
3150 console_fprintf(stdout, "%s\n" , __stringVal(self)); |
3139 console_fflush(stdout); |
3151 console_fflush(stdout); |
3140 RETURN (self); |
3152 RETURN (self); |
3141 } |
3153 } |
3142 } |
3154 } |
3147 printfPrintString:formatString |
3159 printfPrintString:formatString |
3148 "non-standard but sometimes useful. |
3160 "non-standard but sometimes useful. |
3149 Return a printed representation of the receiver as specified by formatString, |
3161 Return a printed representation of the receiver as specified by formatString, |
3150 which is defined by printf. |
3162 which is defined by printf. |
3151 This method is NONSTANDARD and may be removed without notice. |
3163 This method is NONSTANDARD and may be removed without notice. |
3152 WARNNG: this goes directly to the C-printf function and may therefore me inherently unsafe. |
3164 WARNNG: this goes directly to the C-printf function and may therefore be inherently unsafe. |
3153 Please use the printf: method, which is safe as it is completely implemented in Smalltalk." |
3165 Please use the printf: method, which is safe as it is completely implemented in Smalltalk." |
3154 |
3166 |
3155 %{ /* STACK: 1000 */ |
3167 %{ /* STACK: 1000 */ |
3156 |
3168 |
3157 char buffer[800]; |
3169 char buffer[800]; |