-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make ad-hoc OutputChannel for warnings
- Loading branch information
Showing
7 changed files
with
31 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
solve/src/commonMain/kotlin/it/unibo/tuprolog/solve/channel/Channels.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
package it.unibo.tuprolog.solve.channel | ||
|
||
import it.unibo.tuprolog.solve.exception.PrologWarning | ||
|
||
internal expect fun stdin(): InputChannel<String> | ||
|
||
internal expect fun <T> stdout(): OutputChannel<T> | ||
|
||
internal expect fun <T> stderr(): OutputChannel<T> | ||
internal expect fun <T> stderr(): OutputChannel<T> | ||
|
||
internal expect fun warning(): OutputChannel<PrologWarning> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 11 additions & 15 deletions
26
solve/src/jsMain/kotlin/it/unibo/tuprolog/solve/channel/Channels.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
package it.unibo.tuprolog.solve.channel | ||
|
||
internal actual fun stdin(): InputChannel<String> { | ||
return InputChannel.of { | ||
throw IllegalStateException("No default implementation of stdin on JS") | ||
} | ||
} | ||
import it.unibo.tuprolog.solve.exception.PrologWarning | ||
|
||
internal actual fun <T> stderr(): OutputChannel<T> { | ||
return OutputChannel.of { | ||
console.error(it) | ||
} | ||
} | ||
internal actual fun stdin(): InputChannel<String> = | ||
InputChannel.of { throw IllegalStateException("No default implementation of stdin on JS") } | ||
|
||
internal actual fun <T> stdout(): OutputChannel<T> { | ||
return OutputChannel.of { | ||
print(it) | ||
} | ||
} | ||
internal actual fun <T> stderr(): OutputChannel<T> = | ||
OutputChannel.of { console.error(it) } | ||
|
||
internal actual fun <T> stdout(): OutputChannel<T> = | ||
OutputChannel.of { print(it) } | ||
|
||
internal actual fun warning(): OutputChannel<PrologWarning> = | ||
OutputChannel.of { console.warn(it.message) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters