Monk Developer's Reference
Total Page:16
File Type:pdf, Size:1020Kb
Monk Developer’s Reference Release 5.0.5 for Schema Run-time Environment (SRE) Copyright © 2005, 2010, Oracle and/or its affiliates. All rights reserved. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this is software or related software documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable: U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA 94065. This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications which may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. UNIX is a registered trademark licensed through X/Open Company, Ltd. This software or hardware and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services. Version 20100713171925. Monk Developer’s Reference 2 Contents Contents Chapter 1 Introduction 16 Document Purpose and Scope 16 Intended Audience 16 Organization of Information 17 Writing Conventions 18 Supporting Documents 19 Chapter 2 Monk Basics 20 Overview 20 Data Types 21 Latent Data Typing 22 Monk Conventions 23 Naming Conventions 23 Identifiers 23 Comments 24 Whitespace 24 Notations 25 Literals 25 Variables 26 Procedure or Function Calls 26 The Use of Characters 26 Entering Interpreted Characters as Literals 27 Characters to be Escaped in Monk Expressions 27 Representing Control Characters in Monk Expressions 27 Representing Octal or Hex Characters as Monk Expressions 28 Regular Expressions 28 The Simplest Regular Expression 28 Building Complex Regular Expressions 28 Regular Expression Operators 29 Regular Expression Examples 30 Format Specification 33 Monk Developer’s Reference 3 Contents Monk and Event Definitions 36 Contents of an Event Definition 36 Structured Events 37 How Monk Uses Paths to Access Structured Events 38 Delimiter List 40 Node List 42 Behavior of Optional Nodes That Contain No Data 48 Dynamic Parsing of Data 49 Referencing an Instance of a Repeating Node 49 Referencing Data with Byte Count 49 Length Specification, When Assigning Data to Structured Event 50 Use of Variables to Represent Path Elements 51 Path to Any-Ordered Set 51 Sample Programs 52 Chapter 3 Control Flow and Boolean Expressions 55 Overview 55 and 56 begin 57 case 58 case-equal 59 cond 60 do 61 do* 63 if 64 not 65 or 66 Chapter 4 Definition, Binding and Assignment 67 define 68 defined? 69 let 70 let* 71 letrec 72 set 73 set! 74 undefine 75 Chapter 5 Character Functions 76 char? 77 char=? 78 char<? 79 char>? 80 char<=? 81 char>=? 82 char-ci=? 83 char-ci<? 84 Monk Developer’s Reference 4 Contents char-ci>? 85 char-ci<=? 86 char-ci>=? 87 char-alphabetic? 88 char-and 89 char-downcase 90 char-lower-case? 91 char-not 92 char-numeric? 93 char-or 94 char-shift-left 95 char-shift-right 96 char-type 97 char-type! 98 char-type? 99 char-upcase 100 char-upper-case? 101 char-whitespace? 102 char-xor 103 Chapter 6 String Functions 104 format 106 htonl->string 107 htons->string 108 list->string 109 make-string 110 regex 111 string 112 string? 113 string<? 114 string<=? 115 string=? 116 string>? 117 string>=? 118 string-append 119 string-append! 120 string-checksum 121 string-ci=? 122 string-ci<? 123 string-ci>? 124 string-ci<=? 125 string-ci>=? 126 string-copy 127 string-copy! 128 string-crc16 129 string-crc32 130 string-downcase 131 string-empty? 132 string-fill! 133 string-insert! 134 string-left-trim 135 string-length 136 string-length! 137 string->list 138 string-lrc 139 string->ntohl 140 string->ntohs 141 string-ref 142 string-right-trim 143 string-set! 144 Monk Developer’s Reference 5 Contents string-substitute 145 string-tokens 146 string-trim 147 string-type 148 string-type! 149 string-type? 150 string-upcase 151 subseq 152 substring-index 153 Chapter 7 Numerical Expressions 154 * 155 + 156 - 157 / 158 < 159 = 160 <= 161 > 162 >= 163 abs 164 acos 165 asin 166 atan 167 big-endian->integer 168 ceiling 169 cos 170 even? 171 exp 172 expt 173 floor 174 gcd 175 integer? 176 integer->big-endian 177 integer->little-endian 178 lcm 179 little-endian->integer 180 log 181 max 182 min 183 modulo 184 negative? 185 number? 186 number->integer 187 number->real 188 number->uint 189 odd? 190 positive? 191 quotient 192 real? 193 remainder 194 round 195 sin 196 sqrt 197 tan 198 truncate 199 uint? 200 zero? 201 Monk Developer’s Reference 6 Contents Chapter 8 Pairs and Lists 202 append 204 assoc 205 assq 206 assv 207 car 208 cdr 209 caar...cddddr 210 cons 211 length 212 list 213 list? 214 list-ref 215 list-tail 216 member 217 memq 218 memv 219 null? 220 pair? 221 reverse 222 set-car! 223 set-cdr! 224 Chapter 9 Vector Expressions 225 Vectors in Monk 225 The Vector Functions 226 list->vector 227 make-vector 228 vector 229 vector? 230 vector->list 231 vector-fill! 232 vector-length 233 vector-ref 234 vector-set! 235 vector->string 236 Chapter 10 Equivalence Testing 237 eq? 238 equal? 240 eqv? 241 Chapter 11 Conversion Procedures 243 number->string 244 string->number 245 Monk Developer’s Reference 7 Contents keyword? 246 string->symbol 247 symbol->string 248 char->integer 249 integer->char 250 Chapter 12 File I/O Expressions 251 clear-port-callback 252 close-port 253 current-debug-port 254 current-error-port 255 current-input-port 256 current-output-port 257 current-warning-port 258 ftell 259 get-port-callback 260 input-string-port? 261 open-append-file 262 open-input-file 263 open-input-string 264 open-output-file 265 open-output-string 266 open-random-access-file 267 output-port? 268 output-string-port? 269 regex-string-port 270 rewind 271 seek-cur 272 seek-set 273 seek-to-end 274 set-file-encoding-method 275 set-port-callback 276 string-port->string 277 eof-object? 278 read 279 read-char 280 read-line 281 display 282 newline 283 write 284 write-char 285 write-exp 286 Chapter 13 System Interface Functions 287 directory 288 file-delete 289 file-exists? 290 file-rename 291 getenv 292 load 293 load-directory 294 load-extension 295 putenv 296 system 297 Monk Developer’s Reference 8 Contents Chapter 14 Standard Procedures 299 Booleans 299 boolean? 300 Symbols 300 keyword? 301 symbol? 302 sys-procedures 303 sys-symbols 304 Sequence Operators 304 nth 305 qsort 306 Control Features 306 apply 307 map 308 procedure? 309 Evaluation 309 eval 310 Literal Expressions 310 quote 311 quasiquote 312 Procedure 313 lambda 314 lambdaq 316 Comment 316 comment 317 Chapter 15 Event Definitions 318 $event-clear 319 $event-parse 320 $event->string 321 $make-event-map 322 $resolve-event-definition 324 change-pattern 325 copy 327 copy-strip 328 count-data-children 329 count-map-children 330 count-rep 331 data-map 332 display-event-data 334 display-event-dump 336 display-event-map 340 duplicate 343 duplicate-strip 344 file-check 345 file-lookup 346 get 347 list-lookup 348 path-node-has-data? 349 Monk Developer’s Reference 9 Contents not-verify 350 path? 351 path-defined? 352 path-defined-as-repeating? 353 path-event 354 path-event-symbol 355 path-nodeclear 356 path-nodedepth