|
132 | 132 | ***********************************************************************/
|
133 | 133 | {
|
134 | 134 | REBSER *obj;
|
| 135 | + REBVAL *val; |
135 | 136 |
|
136 | 137 | if ( IS_WORD(info) ) {
|
137 | 138 | if(!Set_File_Mode_Value(file, VAL_WORD_CANON(info), ret))
|
138 | 139 | Trap1(RE_INVALID_ARG, info);
|
| 140 | + } else if (IS_BLOCK(info)) { |
| 141 | + // example: |
| 142 | + // query/mode file [type size] ;== [file 1234] |
| 143 | + // or: |
| 144 | + // query/mode file [type: size:] ;== [type: file size: 1234] |
| 145 | + // or combined: |
| 146 | + // query/mode file [type: size] ;== [type: file 1234] |
| 147 | + // When not supported word is used, if will throw an error |
| 148 | + |
| 149 | + REBSER *values = Make_Block(2 * BLK_LEN(VAL_SERIES(info))); |
| 150 | + REBVAL *word = VAL_BLK_DATA(info); |
| 151 | + for (; NOT_END(word); word++) { |
| 152 | + if(ANY_WORD(word)) { |
| 153 | + if (IS_SET_WORD(word)) { |
| 154 | + // keep the set-word in result |
| 155 | + val = Append_Value(values); |
| 156 | + *val = *word; |
| 157 | + VAL_SET_LINE(val); |
| 158 | + } |
| 159 | + val = Append_Value(values); |
| 160 | + if(!Set_File_Mode_Value(file, VAL_WORD_CANON(word), val)) |
| 161 | + Trap1(RE_INVALID_ARG, word); |
| 162 | + } else Trap1(RE_INVALID_ARG, word); |
| 163 | + } |
| 164 | + Set_Series(REB_BLOCK, ret, values); |
139 | 165 | } else {
|
| 166 | + //@@ oldes: is returning object really still needed? |
140 | 167 | info = In_Object(port, STD_PORT_SCHEME, STD_SCHEME_INFO, 0);
|
141 | 168 | if (!info || !IS_OBJECT(info)) Trap_Port(RE_INVALID_SPEC, port, -10);
|
142 | 169 | obj = CLONE_OBJECT(VAL_OBJ_FRAME(info));
|
|
0 commit comments