Updates for more modern (v1.6.0) nim. draft default tip
authorMahlon E. Smith <mahlon@martini.nu>
Wed, 27 Oct 2021 14:36:25 -0700
changeset 10 d63cce6d1a09
parent 9 ad53c6500712
Updates for more modern (v1.6.0) nim.
Makefile
README.md
src/stomp.nim
stomp.nimble
--- a/Makefile	Sun Apr 04 16:12:19 2021 -0700
+++ b/Makefile	Wed Oct 27 14:36:25 2021 -0700
@@ -5,7 +5,7 @@
 default: development
 
 development: ${FILES}
-	nim --debugInfo --assertions:on --linedir:on -d:ssl --define:debug --nimcache:${CACHE} c ${FILES}
+	nim --debugInfo --assertions:on --profiler:on --stackTrace:on --linedir:on -d:ssl --define:debug --nimcache:${CACHE} c ${FILES}
 	@mv src/stomp .
 
 autobuild:
@@ -16,7 +16,7 @@
 	nim --debugger:on --nimcache:${CACHE} c ${FILES}
 
 release: ${FILES}
-	nim -d:release --opt:speed --nimcache:${CACHE} c ${FILES}
+	nim -d:release --opt:speed --panics:on --nimcache:${CACHE} c ${FILES}
 	@mv src/stomp .
 
 docs:
--- a/README.md	Sun Apr 04 16:12:19 2021 -0700
+++ b/README.md	Wed Oct 27 14:36:25 2021 -0700
@@ -153,8 +153,7 @@
 # (This should be compiled with -d:ssl)
 
 import
-   json,
-   net,
+   std/[net,json],
    stomp
 
 let
--- a/src/stomp.nim	Sun Apr 04 16:12:19 2021 -0700
+++ b/src/stomp.nim	Wed Oct 27 14:36:25 2021 -0700
@@ -50,12 +50,12 @@
 ##
 
 import
-    strutils,
-    nativesockets,
-    net,
-    os,
-    times,
-    uri
+    std/nativesockets,
+    std/net,
+    std/os,
+    std/strutils,
+    std/times,
+    std/uri
 
 const
     VERSION = "0.1.3" ## The current program version.
@@ -130,7 +130,7 @@
 
     c.socket.readline( line, c.timeout )
     while not line.is_eol:
-        if defined( debug ): printf " <-- %s\n", line
+        if defined( debug ): printf " <-- %s\n", cstring(line)
         var header = line.split( ":" )
         if header.len < 2: break
         response.headers.add( (header[0], header[1]) )
@@ -206,7 +206,7 @@
     #
     result.frame = line
     if defined( debug ):
-        printf " <-- %s\n", line
+        printf " <-- %s\n", cstring(line)
 
     # Parse headers and body.
     #
@@ -319,7 +319,7 @@
                     result.options.heartbeat = opt[1].parse_int
                 else:
                     discard
-        except IndexError, ValueError:
+        except IndexDefect, ValueError:
             discard
 
     # Set default STOMP port if otherwise unset.
@@ -763,12 +763,6 @@
 
             proc receive_message( c: StompClient, r: StompResponse ) =
                 messages.add( r )
-                case r.frame:
-                    of "RECEIPT":
-                        discard
-                    of "MESSAGE":
-                        discard r.payload
-                        discard r[ "ack" ]
 
             proc seen_heartbeat( c: StompClient, r: StompResponse ) =
                 heartbeats = heartbeats + 1
--- a/stomp.nimble	Sun Apr 04 16:12:19 2021 -0700
+++ b/stomp.nimble	Wed Oct 27 14:36:25 2021 -0700
@@ -11,5 +11,5 @@
 
 # Dependencies
 
-requires "nim >= 0.19.0"
+requires "nim >= 1.4.0"