I am sure that you will stop playing “meat”, because what I am about to tell you will seem very interesting to you, if only because you will not understand many special terms.
Jaroslav Hasek
(import (rnrs) (ironscheme) )
(import (rnrs) (ironscheme) (ironscheme clr) )
(import (rnrs) (ironscheme) (ironscheme clr) ) (clr-static-call Console WriteLine "Hello, world")
(import (rnrs) (ironscheme) (ironscheme clr) )
(clr-using System.Threading)
(define (timer-new handler) (clr-new Timer handler) ) (define (timer-change timer due-time period) (clr-call Timer Change timer (clr-cast System.Int32 due-time) (clr-cast System.Int32 period)) )
(define (console-block) (clr-static-call Console WriteLine "Press <Enter> to terminate") (clr-static-call Console ReadLine) )
(define (time-handler obj) ;; some code )
(define timer (timer-new time-handler))
(timer-change timer delay period)
(import (rnrs) (ironscheme) (ironscheme clr) ) (clr-using System.Threading) ;; *************************************** (define (timer-new handler) (clr-new Timer handler) ) (define (timer-change timer due-time period) (clr-call Timer Change timer (clr-cast System.Int32 due-time) (clr-cast System.Int32 period)) ) (define (console-block) (clr-static-call Console WriteLine "Press <Enter> to terminate") (clr-static-call Console ReadLine) ) ;; *************************************** (define counter 0) (define period 1000) ;;ms (define (time-handler obj) (set! counter (+ counter 1)) (displayln counter) ) (define timer (timer-new time-handler)) (timer-change timer 0 period) (console-block)
(import (rnrs) (ironscheme) (ironscheme clr) ) ;; **************** Oracle **************;; (clr-reference System.Data) (clr-reference System.Data.OracleClient) (clr-using System.Data.OracleClient) (define (ora-connection-new connection-string) (clr-new OracleConnection (clr-cast System.String connection-string)) ) (define (ora-connection-open connection) (clr-call OracleConnection Open (clr-cast OracleConnection connection)) ) (define (ora-connection-create connection-string) (define connection (ora-connection-new connection-string)) (ora-connection-open connection) connection ;; return ) (define (ora-command-new connection sql-string) (clr-new OracleCommand (clr-cast System.String sql-string) (clr-cast OracleConnection connection)) ) (define (ora-command-parameter-add command key value) (clr-call OracleParameterCollection Add (clr-prop-get OracleCommand Parameters command) (clr-cast System.String key) (clr-cast System.Object value) ) ) (define (ora-execute-reader command) (clr-call OracleCommand ExecuteReader (clr-cast OracleCommand command)) ) (define (ora-read reader) (clr-call OracleDataReader Read (clr-cast OracleDataReader reader)) ) (define (ora-get-value reader key) (clr-call OracleDataReader GetValue reader (clr-call OracleDataReader GetOrdinal reader key) ) ) (define (ora-get-string reader key) (clr-call Object ToString (ora-get-datetime reader key)) ) (define (ora-get-int32 reader key) (clr-call OracleDataReader GetInt32 reader (clr-call OracleDataReader GetOrdinal reader key) ) ) (define (ora-get-datetime reader key) (clr-call OracleDataReader GetDateTime reader (clr-call OracleDataReader GetOrdinal reader key) ) ) ;;***************************************;; ;; **************** Timer ***************;; (clr-using System.Threading) (define (timer-new handler) (clr-new Timer handler) ) (define (timer-change timer due-time period) (clr-call Timer Change timer (clr-cast System.Int32 due-time) (clr-cast System.Int32 period)) ) (define (console-block) (clr-static-call System.Console WriteLine "Press <Enter> to terminate") (clr-static-call System.Console ReadLine) ) ;;***************************************;; ;;######## GLOBAL #########;; (define connection-string "Data Source=*****;User ID=*****;Password=*****;") ;;#########################;; (define (complect-print reader) (import (srfi :13)) (let loop ((index 1)) (if (ora-read reader) (begin (display " (") (display (string-pad-right (number->string index) 5)) (display (string-pad-right (ora-get-value reader "*****") 15)) (display " ") (display (string-pad-right (ora-get-value reader "*****") 20)) (display " ") (display (ora-get-int32 reader "*****")) (display " ") (display (string-pad-right (ora-get-value reader "*****") 25)) (display " ") (display (ora-get-string reader "*****")) (displayln ")") (loop (+ index 1)) ) ) ) ) (define (complect-display connection status) (define sqlStr "select * from ***** where ***** = :complect_status") (define cmd (ora-command-new connection sqlStr)) (define reader '()) (ora-command-parameter-add cmd "complect_status" status) (set! reader (ora-execute-reader cmd)) (display "(complect-status ") (displayln status) (complect-print reader) (displayln ")") (clr-call OracleDataReader Close reader) ) (define (time-handler obj) (define connection (ora-connection-create connection-string)) (clr-static-call System.Console Clear) (displayln "\n;; ************************************************************************* ;;\n") (complect-display connection 1) (newline) (complect-display connection 2) (newline) (complect-display connection 3) (newline) (complect-display connection 4) (displayln "\n;; ************************************************************************* ;;\n") (clr-call OracleConnection Close connection) ) (define timer (timer-new time-handler)) (timer-change timer 0 3000) (console-block)
(import (rnrs) (ironscheme) (ironscheme clr) ) (clr-reference System.Windows.Forms) (clr-using System.Windows.Forms) (define main-form (clr-new Form)) (clr-prop-set! Form Text main-form "--== Hello, world ==--") (clr-prop-set! Form Size main-form (clr-new System.Drawing.Size 640 480)) (define lbl-message (clr-new Label)) (clr-prop-set! Label Text lbl-message "Message: \"Hello, Windows Forms(IronScheme) World!\"") (clr-prop-set! Label Size lbl-message (clr-new System.Drawing.Size 320 20)) (clr-prop-set! Label Location lbl-message (clr-new System.Drawing.Point 150 200)) (clr-call Form+ControlCollection Add (clr-prop-get Form Controls main-form) lbl-message) (clr-static-call Application Run (clr-cast Form main-form))
Source: https://habr.com/ru/post/267119/