diff --git a/src/core/c-frame.c b/src/core/c-frame.c index 9d12e7edb5..b876f385fa 100644 --- a/src/core/c-frame.c +++ b/src/core/c-frame.c @@ -1180,7 +1180,7 @@ */ REBSER* Get_Object_Words(REBVAL *object) /* ** Returns block of object's words converted to simple word (not set-word) -** Note: used in query/mode function to return default modes +** Note: used in query function to return default modes ** ***********************************************************************/ { diff --git a/src/core/p-console.c b/src/core/p-console.c index a89ef38434..cb3cdcee2d 100644 --- a/src/core/p-console.c +++ b/src/core/p-console.c @@ -217,10 +217,11 @@ REBVAL *word = VAL_BLK_DATA(info); for (; NOT_END(word); word++) { if (ANY_WORD(word)) { - if (IS_SET_WORD(word)) { - // keep the set-word in result + if (!IS_GET_WORD(word)) { + // keep the word as a key (converted to the set-word) in the result val = Append_Value(values); *val = *word; + VAL_TYPE(val) = REB_SET_WORD; VAL_SET_LINE(val); } val = Append_Value(values); diff --git a/src/core/p-file.c b/src/core/p-file.c index bd2355f4b8..408248e890 100644 --- a/src/core/p-file.c +++ b/src/core/p-file.c @@ -170,21 +170,22 @@ Trap1(RE_INVALID_ARG, info); } else if (IS_BLOCK(info)) { // example: - // query/mode file [type size] ;== [file 1234] + // query file [:type :size] ;== [file 1234] // or: - // query/mode file [type: size:] ;== [type: file size: 1234] + // query file [type size] ;== [type: file size: 1234] // or combined: - // query/mode file [type: size] ;== [type: file 1234] + // query file [type: :size] ;== [type: file 1234] // When not supported word is used, if will throw an error REBSER *values = Make_Block(2 * BLK_LEN(VAL_SERIES(info))); REBVAL *word = VAL_BLK_DATA(info); for (; NOT_END(word); word++) { if(ANY_WORD(word)) { - if (IS_SET_WORD(word)) { - // keep the set-word in result + if (!IS_GET_WORD(word)) { + // keep the word as a key (converted to the set-word) in the result val = Append_Value(values); *val = *word; + VAL_TYPE(val) = REB_SET_WORD; VAL_SET_LINE(val); } val = Append_Value(values); diff --git a/src/core/p-midi.c b/src/core/p-midi.c index 5039c87b5f..6a32f66fbe 100644 --- a/src/core/p-midi.c +++ b/src/core/p-midi.c @@ -157,10 +157,11 @@ REBVAL *word = VAL_BLK_DATA(field); for (; NOT_END(word); word++) { if (ANY_WORD(word)) { - if (IS_SET_WORD(word)) { - // keep the set-word in result + if (!IS_GET_WORD(word)) { + // keep the word as a key (converted to the set-word) in the result val = Append_Value(values); *val = *word; + VAL_TYPE(val) = REB_SET_WORD; VAL_SET_LINE(val); } val = Append_Value(values); diff --git a/src/core/p-net.c b/src/core/p-net.c index e0a9102365..e32d54de8c 100644 --- a/src/core/p-net.c +++ b/src/core/p-net.c @@ -82,21 +82,22 @@ enum Transport_Types { } else if (IS_BLOCK(info)) { // example: - // query/mode port [remote-ip remote-port] ;== [127.0.0.1 1234] + // query port [:remote-ip :remote-port] ;== [127.0.0.1 1234] // or: - // query/mode port [remote-ip: remote-port:] ;== [remote-ip: 127.0.0.1 remote-port: 1234] + // query port [remote-ip remote-port] ;== [remote-ip: 127.0.0.1 remote-port: 1234] // or combined: - // query/mode file [remote-ip: remote-port] ;== [remote-ip: 127.0.0.1 1234] + // query file [remote-ip: :remote-port] ;== [remote-ip: 127.0.0.1 1234] // When not supported word is used, if will throw an error REBSER *values = Make_Block(2 * BLK_LEN(VAL_SERIES(info))); REBVAL *word = VAL_BLK_DATA(info); for (; NOT_END(word); word++) { if (ANY_WORD(word)) { - if (IS_SET_WORD(word)) { - // keep the set-word in result + if (!IS_GET_WORD(word)) { + // keep the word as a key (converted to the set-word) in the result val = Append_Value(values); *val = *word; + VAL_TYPE(val) = REB_SET_WORD; VAL_SET_LINE(val); } val = Append_Value(values); diff --git a/src/core/t-date.c b/src/core/t-date.c index e63f490c04..3378cf1762 100644 --- a/src/core/t-date.c +++ b/src/core/t-date.c @@ -1049,7 +1049,7 @@ static const REBI64 DAYS_OF_JAN_1ST_1970 = 719468; // number of days for 1st Jan case A_QUERY: spec = Get_System(SYS_STANDARD, STD_DATE_INFO); if (!IS_OBJECT(spec)) Trap_Arg(spec); - REBVAL *field = D_ARG(3); + REBVAL *field = D_ARG(ARG_QUERY_FIELD); if(IS_WORD(field)) { switch(VAL_WORD_CANON(field)) { case SYM_WORDS: @@ -1067,10 +1067,11 @@ static const REBI64 DAYS_OF_JAN_1ST_1970 = 719468; // number of days for 1st Jan REBVAL *word = VAL_BLK_DATA(field); for (; NOT_END(word); word++) { if (ANY_WORD(word)) { - if (IS_SET_WORD(word)) { - // keep the set-word in result + if (!IS_GET_WORD(word)) { + // keep the word as a key (converted to the set-word) in the result out = Append_Value(values); *out = *word; + VAL_TYPE(out) = REB_SET_WORD; VAL_SET_LINE(out); } out = Append_Value(values); diff --git a/src/core/t-handle.c b/src/core/t-handle.c index 091430b7cf..ce05cb47a5 100644 --- a/src/core/t-handle.c +++ b/src/core/t-handle.c @@ -180,7 +180,7 @@ extern void RXI_To_Value(REBVAL *val, RXIARG arg, REBCNT type); // f-extension.c //TODO: this code could be made resusable with other types! spec = Get_System(SYS_STANDARD, STD_HANDLE_INFO); if (!IS_OBJECT(spec)) Trap_Arg(spec); - REBVAL *field = D_ARG(3); + REBVAL *field = D_ARG(ARG_QUERY_FIELD); if (IS_WORD(field)) { switch (VAL_WORD_CANON(field)) { case SYM_WORDS: @@ -198,10 +198,11 @@ extern void RXI_To_Value(REBVAL *val, RXIARG arg, REBCNT type); // f-extension.c REBVAL *word = VAL_BLK_DATA(field); for (; NOT_END(word); word++) { if (ANY_WORD(word)) { - if (IS_SET_WORD(word)) { + if (!IS_GET_WORD(word)) { // keep the set-word in result out = Append_Value(values); *out = *word; + VAL_TYPE(out) = REB_SET_WORD; VAL_SET_LINE(out); } out = Append_Value(values); diff --git a/src/core/t-vector.c b/src/core/t-vector.c index 6433862925..613d9c3310 100644 --- a/src/core/t-vector.c +++ b/src/core/t-vector.c @@ -842,10 +842,11 @@ static void reverse_vector(REBVAL *value, REBCNT len) REBVAL *word = VAL_BLK_DATA(field); for (; NOT_END(word); word++) { if (ANY_WORD(word)) { - if (IS_SET_WORD(word)) { - // keep the set-word in result + if (!IS_GET_WORD(word)) { + // keep the word as a key (converted to the set-word) in the result val = Append_Value(values); *val = *word; + VAL_TYPE(val) = REB_SET_WORD; VAL_SET_LINE(val); } val = Append_Value(values); diff --git a/src/mezz/mezz-files.reb b/src/mezz/mezz-files.reb index a51d2f803f..770ea89322 100644 --- a/src/mezz/mezz-files.reb +++ b/src/mezz/mezz-files.reb @@ -274,7 +274,7 @@ list-dir: closure/with [ value depth /local info date time size ][ - info: query value [name size date] + info: query value [:name :size :date] unless info [ return ajoin [ "^[[1;35m *** Invalid symbolic link: ^[[0;35m" diff --git a/src/mezz/prot-tls.reb b/src/mezz/prot-tls.reb index 0fe88d7288..9568e7f87c 100644 --- a/src/mezz/prot-tls.reb +++ b/src/mezz/prot-tls.reb @@ -2035,7 +2035,7 @@ TLS-server-awake: func [event /local port info serv] [ accept [ serv: event/port port: first serv - info: query port [remote-ip: remote-port:] + info: query port [remote-ip remote-port] ;? info ;? serv port/extra: make TLS-context [ diff --git a/src/modules/httpd.reb b/src/modules/httpd.reb index f6366cce1c..29163afc33 100644 --- a/src/modules/httpd.reb +++ b/src/modules/httpd.reb @@ -263,7 +263,7 @@ sys/make-scheme [ return Actor/On-List-Dir ctx target ] ] - info: query path [modified: size:] + info: query path [modified size] ; prepare modified date of the target modified: info/modified modified/timezone: 0 ; converted to UTC @@ -417,7 +417,7 @@ sys/make-scheme [ append files dirs foreach file files [ - set [size date] query/mode dir/:file [size date] + set [size date] query dir/:file [:size :date] append out ajoin [ {} file { } pad copy "" 50 - length? file @@ -846,7 +846,7 @@ sys/make-scheme [ New-Client: func[port [port!] /local client info err][ client: first port - info: query client [remote-ip: remote-port:] + info: query client [remote-ip remote-port] unless Actor/On-Accept info [ ; connection not allowed log-more ["Client not accepted:^[[22m" info/remote-ip] diff --git a/src/tests/test-midi.r3 b/src/tests/test-midi.r3 index 1587f34e29..80af92eb29 100644 --- a/src/tests/test-midi.r3 +++ b/src/tests/test-midi.r3 @@ -7,7 +7,7 @@ Rebol [ Needs: 3.11.0 ] -midi: query midi:// [devices-in: devices-out:] +midi: query midi:// [devices-in devices-out] unless block? midi [ print as-purple "No MIDI available!" quit] print [as-yellow "Input devices: " length? midi/devices-in] diff --git a/src/tests/test-raw-tcp-read.r3 b/src/tests/test-raw-tcp-read.r3 index caeecde093..878f22931a 100644 --- a/src/tests/test-raw-tcp-read.r3 +++ b/src/tests/test-raw-tcp-read.r3 @@ -20,7 +20,7 @@ wp/awake: func [event /local port] [ read [print ["^/read:" length? port/data] read port] wrote [read port] lookup [ - print query port [remote-ip: remote-port:] + print query port [remote-ip remote-port] open port ] connect [write port http-request] diff --git a/src/tests/units/date-test.r3 b/src/tests/units/date-test.r3 index 49acd2bdc6..8c584188a5 100644 --- a/src/tests/units/date-test.r3 +++ b/src/tests/units/date-test.r3 @@ -358,13 +358,43 @@ Rebol [ all-date-words: words-of system/standard/date-info --assert all-date-words = query date none --assert date/time = query date 'time - --assert [2020 4] = query date [year month] - --assert [month: 4 year: 2020] = query date [month: year:] - --assert equal? query date all-date-words [2020 4 8 12:04:32 8-Apr-2020 2:00 12 4 32 3 99 2:00 8-Apr-2020/10:04:32 2458947.91981481] + --assert [2020 4] = query date [:year :month] + --assert [month: 4 year: 2020] = query date [month year] + --assert equal? query date all-date-words [ + year: 2020 + month: 4 + day: 8 + time: 12:04:32 + date: 8-Apr-2020 + zone: 2:00 + hour: 12 + minute: 4 + second: 32 + weekday: 3 + yearday: 99 + timezone: 2:00 + utc: 8-Apr-2020/10:04:32 + julian: 2458947.91981481 + ] --test-- "query date" date: 8-Apr-2020 ; no time! - --assert equal? query date all-date-words [2020 4 8 #(none) 2020-04-08 #(none) #(none) #(none) #(none) 3 99 #(none) 2020-04-08 2458948.0] + --assert equal? query date all-date-words [ + year: 2020 + month: 4 + day: 8 + time: #(none) + date: 8-Apr-2020 + zone: #(none) + hour: #(none) + minute: #(none) + second: #(none) + weekday: 3 + yearday: 99 + timezone: #(none) + utc: 8-Apr-2020 + julian: 2458948.0 + ] ===end-group=== diff --git a/src/tests/units/file-test.r3 b/src/tests/units/file-test.r3 index b2820dd64f..b4f21fb05d 100644 --- a/src/tests/units/file-test.r3 +++ b/src/tests/units/file-test.r3 @@ -201,7 +201,7 @@ if find [Linux macOS] system/platform [ ===start-group=== "QUERY" --test-- "query dates" write %query-test "test" - probe fields: [modified created accessed] + fields: [:modified :created :accessed] --assert all [ block? probe dates1: query %query-test fields date? dates1/1 diff --git a/src/tests/units/port-test.r3 b/src/tests/units/port-test.r3 index 021e111901..8ebfb2bccf 100644 --- a/src/tests/units/port-test.r3 +++ b/src/tests/units/port-test.r3 @@ -235,8 +235,8 @@ if system/platform = 'Windows [ --assert 'file = query file 'type --assert date? query file 'modified --assert 51732 = query file 'size - --assert [file 51732] = query file [type size] - --assert [type: file size: 51732] = query file [type: size:] + --assert [file 51732] = query file [:type :size] + --assert [type: file size: 51732] = query file [type size] --test-- "query file name" ;@@ https://github.com/Oldes/Rebol-issues/issues/2442 @@ -250,8 +250,8 @@ if system/platform = 'Windows [ --assert 'file = query file 'type --assert date? query file 'modified --assert 51732 = query file 'size - --assert [file 51732] = query file [type size] - --assert [type: file size: 51732] = query file [type: size:] + --assert [file 51732] = query file [:type :size] + --assert [type: file size: 51732] = query file [type size] close file --test-- "write/lines" @@ -695,7 +695,7 @@ if all [ --assert (words-of system/standard/console-info) = m: query system/ports/input none --assert block? v: query system/ports/input m - --assert 4 = length? v + --assert 8 = length? v ===end-group=== ] @@ -733,8 +733,8 @@ if all [ --assert all [ port? wait [port 1] ;= wait for lookup, so remote-ip is resolved 8.8.8.8 = query port 'remote-ip - [80 8.8.8.8] = query port [remote-port remote-ip] - [local-ip: 0.0.0.0 local-port: 0] = query port [local-ip: local-port:] + [80 8.8.8.8] = query port [:remote-port :remote-ip] + [local-ip: 0.0.0.0 local-port: 0] = query port [local-ip local-port] ] try [close port] ===end-group=== diff --git a/src/tests/units/vector-test.r3 b/src/tests/units/vector-test.r3 index 9713337be7..68085827f1 100644 --- a/src/tests/units/vector-test.r3 +++ b/src/tests/units/vector-test.r3 @@ -158,7 +158,7 @@ Rebol [ 3 4 ]} ---test-- "QUERY on vector" +--test-- "QUERY on vector as object" ;@@ https://github.com/Oldes/Rebol-issues/issues/2352 v: make vector! [unsigned integer! 16 2] o: query v object! @@ -167,10 +167,10 @@ Rebol [ --assert o/type = 'integer! --assert o/size = 16 --assert o/length = 2 ---test-- "QUERY/MODE on vector" +--test-- "QUERY on vector" --assert [signed type size length] = query v none - --assert [16 integer!] = query v [size type] - --assert block? b: query v [signed: length:] + --assert [16 integer!] = query v [:size :type] + --assert block? b: query v [signed length] --assert all [not b/signed b/length = 2] --assert 16 = query v 'size --assert 16 = size? v