Appendix A. Caché Objectscript Reference

Total Page:16

File Type:pdf, Size:1020Kb

Appendix A. Caché Objectscript Reference Appendix A. Caché ObjectScript Reference Commands Command Description Break[:cond] Interrupt execution of the current routine for debugging purposes. Break[:cond] [status] Activate or deactivate user interrupts. Close[:cond] device[:parameter] Close the device, make it available again for other users and, possibly, set the device characteristics. CONTINUE[:cond] End the current execution of the code block of a For, WHILE, or Do/WHILE loop and check the condition to determine whether a further iteration follows. Do[:cond] Invoke a subroutine or code block and continue the Do[:cond] {…} WHILE expression program processing with the next command after com- pletion. Do[:cond] entryref[(parameter)] Invoke a subroutine, pass the optional parameter and [:cond] continue the program processing with the next com- mand after completion. Else Execute the following commands only if the value of $Test is 0. Else {…} Execute the following code block only if none of the preceding If and ElseIf conditions were true. ElseIf expression {…} Execute the following command block only if none of the preceding If and ElseIf conditions were true and expres- sion is true. For Execute the remainder of the line or the following code For {…} block until a Quit or Goto command ends the loop. For variable=expression[,...] Repeat the execution of the following commands in the For variable=expression[,...] {…} routine line or the following code block for different For variable=start:increment:[end] values of a local variable. For variable=start:increment:[end] {…} Goto[:cond] Resume the normal execution of a routine that was interrupted with the Break command. Goto[:cond] location[:cond] Continue the program execution at another line or in another routine. Halt[:cond] Terminate the current Caché job and close the terminal session. Hang[:cond] seconds Suspend routine execution for the specified time. If Execute the following commands only if the value of $Test is true. If expression Test the expression and execute the remainder of the line If expression {…} or the following code block if the result is true. Job[:cond] routine[:cond][(routine- Start execution of a new Caché process. parms)][:[process-prams] [:timeout]] 351 Appendix A. Caché-ObjectScript Command Description Reference Kill[:cond] Delete all variables, only the specified variables, or all Kill[:cond] variable except the specified variables. Kill[:cond] (variable) Lock[:cond] Set or remove locks on local or global variables. Lock[:cond] [+/–]variable[,...] [:timeout] Lock[:cond] [+/–](variable[,...]) [:timeout] Merge[:cond] target=source Copy variable trees. New[:cond] Hide all, the specified, or all except the specified local New[:cond] variable[,...] variables in a subroutine. New[:cond] (variable[,...]) Open[:cond] device[:(parameter)] Open a device for later use and optionally set the device [:timeout][:"mnespace"] characteristics. Print [line1[:line2]] Output the specified routine lines to the current device. Quit[:cond] End the execution of a subroutine invoked with Do, Xecute, or For. Quit[:cond] expression End the execution of a user-defined function and return the value of the expression as result. Read[:cond] [f,][string,][f,] Read information from the current device. variable[:timeout] Read[:cond] [f,][string,][f,] *variable[:timeout] Read[:cond] [f,][string,][f,] variable#n[:timeout] Set[:cond] variable=expression Assign a value to one or more variables. Set[:cond] (variablelist)=expression TCommit[:cond] Confirm the current transaction and make all database changes permanent. TROllback[:cond] Abort the current transaction and revoke all database changes. TStart[:cond] Mark the start of a transaction. Use[:cond] device[:(parameter)] Make a previously opened device the current device and [:timeout][:"mnespace"] optionally set the device characteristics. View block Modify a memory location or read and write database View offset:mode:length:new-value blocks. Reserved for internal use by Caché. WHILE expression {…} Repeat execution of the following code block until expression evaluates to false. Do {…} WHILE expression Define the end condition after a Do/WHILE code block. Write[:cond] [f,]expression Output characters to the current device. Write[:cond] [f,]*expression Xecute[:cond] expression[:cond] Execute Caché ObjectScript code that is stored as data. ZBreak Set a break point for debugging purposes. ZInsert "code"[:location] Insert a line into the routine currently being edited. ZKill variable Delete a local or global variable without deleting its child nodes. ZLoad [:cond] Load a routine for editing. ZLoad routine ZNspace expression Change the current namespace. ZPrint Output the specified routine lines to the current device. ZPrint line1[:line2] 352 Command Description Functions ZQuit Remove all or a specified number of execution levels ZQuit[:cond] expression from the execution stack. ZRemove Delete all or the specified lines from the routine currently ZRemove line1[:line2] being edited. ZSave Store the routine (possibly with a different name). ZSave routine ZSYNC Ensure that all logical transactions have also physically completed. ZTrap[:cond] Force an error with the specified message or with the ZTrap[:cond] expression default message <ZTRAP>. ZWrite Write the values of all local variables or of the specified ZWrite variable local or global variable to the current device. ZZDUMP (expression) Write the string as hexadecimal dump to the current device. Functions Function Description $Ascii(expression[,position]) Return the ASCII code of a character. $BIT(bitstring,position[,bitvalue]) Create a new bit string if needed and optionally set the bit value at the specified position. $BITCOUNT(bitstring[,bitvalue]) Count the number of bits in the bit string, either all or those with the specified bit value. $BITFIND(bitstring,bitvalue[,startpos]) Search for a bit value in a bit string and return that position. $BITLOGIC(bitstring_expression Perform a bit logic operation on the bit string. [,length]) $CASE(expression,result:value,…) Evaluate expression and return the value after the result that applies. $Char(expression[,...]) Produce a string with the specified ASCII code from a list of integers. $Data(variable) Specify whether a variable reference is defined, has successors, or both or none applies. $Extract(expression[,from[,to]]) Return apart of a string from a start position to an end position. $Find(string,substring[,position]) Return the end position of the substring in a string. $FNumber(number,format[,decimal]) Return the value of an expression in the format specified by the user. $Get(variable[,default]) Return the value of a variable if it exists. $Increment(variable[,num]) Increment the specified variable by 1 or the specified value. $INumber(number,format[,erropt]) Check a number for the specified format and convert it into the internal representation. $ISOBJECT(variable) Check whether the specified variable is a valid OREF. $Justify(expression,width[,decimal]) Return a right-justified value and optionally format and round it numerically. $Length(expression[,delimiter]) Return the length of a string in characters or the number of substrings separated by the specified delimiter. $LIst(list[,from[,to]]) Return the list elements in the specified range. $ListBuild(element,...) Create a list with the elements specified as arguments. 353 Appendix A. Caché-ObjectScript Function Description Reference $ListData(list[,position]) Test whether an element in the list is present and has a value. $ListFind(list[,value [,start]]) Search for a value in a list beginning at the specified start position. $ListGet(list[,position[,default]]) Return the value of a list element if it exists. $ListLength(list) Return the number of elements in a list. $NAme(variable[,number]) Return the name of variable in canonical form with at most the specified number of dimensions. $Next(variable) Return the next index of a variable in the specified di- mension. $NUMber(number[,format[,min Validate a number and convert it into the canonical [,max]]]) Caché format. $Order(variable[,direction]) Return the next or previous index of a variable in the specified dimension. $Piece(expression,delimiter Return one or more substrings separated by the specified [,from[,to]]) delimiter. $QLength(reference) Return the number of dimensions for the indexed vari- able. $QSubscript(reference,number) Extract the specified number of dimensions from the indexed variable. $Query(reference[,direction]) Return the next or previously defined reference for an indexed variable. $Random(range) Return a pseudo random number in the specified range. $REverse(string) Return the characters of the string in reversed sequence. $Select(expression:value,...) Return the value after the first expression that evaluates to TRUE (i.e., 1). $SORTBEGIN(global) Start a special sorting mode for the specified global. $SORTEND(global[,save]) End the sorting mode for the global and save any up- dated data. $STack(context_level[,code_string]) Return information about the active execution context on the call stack. $Text(location) Return the source text of a routine line. $TRanslate(string,replace[,by]) Return a string in which specified characters were re- placed by other specified characters (or were removed). $View(address[,mode,length]) Return the contents of a memory location. $ZABS(n) Return the absolute value of a number (without sign). $ZARCCOS(n) Return the arccosine of a number between –1 and 1. $ZARCSIN(n) Return the arcsine of a number between –1 and
Recommended publications
  • C Strings and Pointers
    Software Design Lecture Notes Prof. Stewart Weiss C Strings and Pointers C Strings and Pointers Motivation The C++ string class makes it easy to create and manipulate string data, and is a good thing to learn when rst starting to program in C++ because it allows you to work with string data without understanding much about why it works or what goes on behind the scenes. You can declare and initialize strings, read data into them, append to them, get their size, and do other kinds of useful things with them. However, it is at least as important to know how to work with another type of string, the C string. The C string has its detractors, some of whom have well-founded criticism of it. But much of the negative image of the maligned C string comes from its abuse by lazy programmers and hackers. Because C strings are found in so much legacy code, you cannot call yourself a C++ programmer unless you understand them. Even more important, C++'s input/output library is harder to use when it comes to input validation, whereas the C input/output library, which works entirely with C strings, is easy to use, robust, and powerful. In addition, the C++ main() function has, in addition to the prototype int main() the more important prototype int main ( int argc, char* argv[] ) and this latter form is in fact, a prototype whose second argument is an array of C strings. If you ever want to write a program that obtains the command line arguments entered by its user, you need to know how to use C strings.
    [Show full text]
  • Operating System User's Mannal ~Zilog 03-0072-01 Revision a September 1978
    t_ .' Operating System User's Mannal ~Zilog 03-0072-01 Revision A September 1978 Copyright © 1978 by Zilog, Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of Zilog. Zilog assumes no responsibility for the use of any circuitry other than circuitry embodied in a Zilog product. No other circuit patent licenses are implied. zaO-RIO Operating System User's Manual September 1978 TABLE OF CONTENTS CHAPTER 1 - INTRODUCTION AND OVERVIEW • 1 1.1 INTRODUCTION •• 1 1.2 SYSTEM OVERVIEW 3 1.2.1 Hardware Configuration • • • • • • 3 1.2.2 File Systems • • • • • • • . • • 3 1.2.3 System Initialization •••.••• 6 1.2.4 Commands • • .• .•..••• 7 1.2.5 I/O • • • . • • • • • . • • • • • . 7 CHAPTER 2 - RIO EXECUTIVE 9 2.1 SYSTEM INITIALIZATION 9 2.2 FILE NAME CONVENTIONS · 10 2.3 MEMORY MANAGEMENT . • • . 12 2.3.1 MEMMGR • . 13 2.4 COMMAND STRING INTERPRETATION · 13 2.5 ERROR HANDLING • • . 15 2.6 PROGRAM EXECUTION OF COMMANDS · 15 CHAPTER 3 - 1/0 STRUCTURE • · 16 3.1 OVERVIEW . • · 16 3.2 I/O REQUESTS - SYSTEM CALLS · 17 3.3 THE 'ASSIGN' I/O REQUEST ••• • 19 - i - 3.4 STANDARD RIO I/O DEVICES • • • 21 3.4.1 ZDOS . • • • . 21 3.4.2 DFS . 21 3.4.3 NULL . • • • . 21 3.4.4 CON . • • • . • • • • • 22 3.4.5 PCON • 27 3.4.6 FLOPPY • • • • • • • • • • 27 3.4.7 DISK • • • • • • 27 CHAPTER 4 - PROGRAM INTERFACE • • 28 4.1 PROGRAM LOCATION • • • • • 28 4.2 PARAMETER STRING ADDRESS · 29 4.3 PROGRAM STACK SPACE • • • 29 4.4 PROGRAM TERMINATION - ERROR HANDLING ••.
    [Show full text]
  • IODF Explorer
    The Input/Output Definition File (IODF) is a critical Control Point in the management of the IBM z/Series Platform. IODF Explorer Release 4.0 USER GUIDE Contact us for additional information: NewEra Software Technical Support 800-421-5035 [email protected] www.newera.com Rev: 2009-04-24 IODF Explorer 4.0 ¾ Copyright, Trademark and Legal Notices Copyrights This Getting Started Guide and the related Software Product(s) are protected under a Copyright dated 2009 by NewEra Software, Inc. All rights are reserved. License Agreement This Getting Started Guide describes the installation and operation of Image FOCUS, its environment and applications. It is made available only under the terms of a license agreement between the licensee and NewEra Software Inc. No part of this Guide or the related Software Product(s) may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying and recording, for any purpose, without the express written permission of NewEra Software, Inc. Trademarks and Copyrights of Others The following products and/or registered trademarks of International Business Machines Corporation are referenced in this document: MVS, VM, RACF, z/OS, SYSPLEX, JES, VTAM, TSO, ISPF, ICKDSF, DFSMSdss, DF/DSS, and others. 2 NewEra Software, Inc. ‐ Image Control Environment (ICE) Applications IODF Explorer 4.0 ¾ Technical Support Information NewEra Software is dedicated to providing the highest level of technical Around-the-clock- support support to meet our customers’ growing needs. In order to meet these needs, NewEra provides around‐the‐clock technical support, 7 days a week, 24 hours a day.
    [Show full text]
  • Hardware Configuration Definition User's Guide
    z/OS Version 2 Release 3 Hardware Configuration Definition User's Guide IBM SC34-2669-30 Note Before using this information and the product it supports, read the information in “Notices” on page 443. This edition applies to Version 2 Release 3 of z/OS (5650-ZOS) and to all subsequent releases and modifications until otherwise indicated in new editions. Last updated: 2019-02-16 © Copyright International Business Machines Corporation 1994, 2018. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents List of Figures..................................................................................................... xiii List of Tables.....................................................................................................xxiii About this document.......................................................................................... xxv Who this document is for..........................................................................................................................xxv Related information.................................................................................................................................. xxv How to use this document.......................................................................................................................xxvi How this document is organized............................................................................................................. xxvi How to read syntax diagrams................................................................................................................
    [Show full text]
  • THE 1995 STANDARD MUMPS POCKET GUIDE Fifth Edition of the Mumps Pocket Guide Second Printing
    1995 S TA N DA R D M U M P S P O C K E T G U I D E FIFTH EDITION FREDERICK D. S. MARSHALL for Octo Barnett, Bob Greenes, Curt Marbles, Neil Papalardo, and Massachusetts General Hospital who gave the world MUMPS and for Ted O’Neill, Marty Johnson, Henry Heffernan, Bill Glenn, and the MUMPS Development Committee who gave the world standard MUMPS T H E 19 9 5 S TA N DA R D M U M P S P O C K E T G U I D E FREDERICK D. S. MARSHALL MUMPS BOOKS • seattle • 2010 THE 1995 STANDARD MUMPS POCKET GUIDE fifth edition of the mumps pocket guide second printing MUMPS BOOKS an imprint of the Vista Expertise Network 819 North 49th Street, Suite 203 ! Seattle, Washington 98103 www.vistaexpertise.net [email protected] (206) 632-0166 copyright © 2010 by frederick d. s. marshall All rights reserved. V I S t C E X P E R T I S E N E T W O R K C O N T E N T S 1 ! I N T R O D U C T I O N ! 1 1.1 ! Purpose ! 1 1.2 ! Acknowledgments ! 1 2 ! O T H E R R E F E R E N C E S ! 2 3 ! T H E S U I T E O F S T A N D A R D S ! 3 4 ! S Y S T E M M O D E L ! 5 4.1 ! Multi-processing ! 5 4.2 ! Data ! 5 4.3 ! Code ! 7 4.4 ! Environments ! 7 4.5 ! Pack ages ! 7 4.6 ! Char acter Sets ! 7 4.7 ! Input/Output Devices ! 8 5 ! S Y N T A X ! 9 5.1 ! Metalanguage Element Index ! 9 6 ! R O U T I N E S ! 15 6.1 ! Routine Structure ! 15 6.2 ! Lines ! 15 6.3 ! Line References ! 17 6.4 ! Execution ! 19 6.4.1 ! the process stack ! 19 6.4.2 ! block Processing ! 19 6.4.3 ! error codes ! 21 7 ! E X P R E S S I O N S ! 2 3 7.1 ! Values ! 24 7.1.1 ! representation ! 24 7.1.2 ! interpretation
    [Show full text]
  • Blank Space in Python
    Blank Space In Python Is Travers dibranchiate or Mercian when imprecates some bings dollies irrespective? Rid and insomniac Gardner snatches her paean bestiaries disillusions and ruralizing representatively. Is Ludwig bareknuckle when Welsh horde articulately? What of my initial forms, blank in the men and that is whitespace without any backwards compatible of users be useful However, managers of software developers do not understand what writing code is about. Currently is also probably are numeric characters to pay people like the blank space is do you receive amazing, blank spaces and without a couple of the examples are. String methods analyze strings of space in english sentences, conforming to type of the error if not contain any safe location on coding styles? Strings are a sequence of letters, between the functions and the class, and what goes where. In python that some point in python. Most will first parameter is able to grow the blank line containing the blank space in python program repeatedly to a block mixed tabs. Note that the program arguments in the usage message have mnemonic names. You can give arguments for either. Really the best way to deal with primitive software that one should not be writing code in. Most python on how do it difficult, blank space in python installer installs pip in different numbers internally; back to your preferences. How do I convert escaped HTML into a string? Try to find a pattern in what kinds of numbers will result in long decimals. In case of spaces, is not so picky. FORTRAN written on paper, the older languages would stand out in the regression chart.
    [Show full text]
  • String Objects: the String Class Library
    String Objects: The string class library Lecture 12 COP 3014 Spring 2018 March 26, 2018 C-strings vs. string objects I In C++ (and C), there is no built-in string type I Basic strings (C-strings) are implemented as arrays of type char that are terminated with the null character I string literals (i.e. strings in double-quotes) are automatically stored this way I Advantages of C-strings: I Compile-time allocation and determination of size. This makes them more efficient, faster run-time when using them I Simplest possible storage, conserves space I Disadvantages of C-strings: I Fixed size I Primitive C arrays do not track their own size, so programmer has to be careful about boundaries I The C-string library functions do not protect boundaries either! I Less intuitive notation for such usage (library features) string objects I C++ allows the creation of objects, specified in class libraries I Along with this comes the ability to create new versions of familiar operators I Coupled with the notion of dynamic memory allocation (not yet studied in this course), objects can store variable amounts of information inside I Therefore, a string class could allow the creation of string objects so that: I The size of the stored string is variable and changeable I Boundary issues are handled inside the class library I More intuitive notations can be created I One of the standard libraries in C++ is just such a class The string class library I The cstring library consists of functions for working on C-strings.
    [Show full text]
  • Languages and Regular Expressions Lecture 2
    Languages and Regular expressions Lecture 2 1 Strings, Sets of Strings, Sets of Sets of Strings… • We defined strings in the last lecture, and showed some properties. • What about sets of strings? CS 374 2 Σn, Σ*, and Σ+ • Σn is the set of all strings over Σ of length exactly n. Defined inductively as: – Σ0 = {ε} – Σn = ΣΣn-1 if n > 0 • Σ* is the set of all finite length strings: Σ* = ∪n≥0 Σn • Σ+ is the set of all nonempty finite length strings: Σ+ = ∪n≥1 Σn CS 374 3 Σn, Σ*, and Σ+ • |Σn| = ?|Σ |n • |Øn| = ? – Ø0 = {ε} – Øn = ØØn-1 = Ø if n > 0 • |Øn| = 1 if n = 0 |Øn| = 0 if n > 0 CS 374 4 Σn, Σ*, and Σ+ • |Σ*| = ? – Infinity. More precisely, ℵ0 – |Σ*| = |Σ+| = |N| = ℵ0 no longest • How long is the longest string in Σ*? string! • How many infinitely long strings in Σ*? none CS 374 5 Languages 6 Language • Definition: A formal language L is a set of strings 1 ε 0 over some finite alphabet Σ or, equivalently, an 2 0 0 arbitrary subset of Σ*. Convention: Italic Upper case 3 1 1 letters denote languages. 4 00 0 5 01 1 • Examples of languages : 6 10 1 – the empty set Ø 7 11 0 8 000 0 – the set {ε}, 9 001 1 10 010 1 – the set {0,1}* of all boolean finite length strings. 11 011 0 – the set of all strings in {0,1}* with an odd number 12 100 1 of 1’s.
    [Show full text]
  • The Ocaml System Release 4.02
    The OCaml system release 4.02 Documentation and user's manual Xavier Leroy, Damien Doligez, Alain Frisch, Jacques Garrigue, Didier R´emy and J´er^omeVouillon August 29, 2014 Copyright © 2014 Institut National de Recherche en Informatique et en Automatique 2 Contents I An introduction to OCaml 11 1 The core language 13 1.1 Basics . 13 1.2 Data types . 14 1.3 Functions as values . 15 1.4 Records and variants . 16 1.5 Imperative features . 18 1.6 Exceptions . 20 1.7 Symbolic processing of expressions . 21 1.8 Pretty-printing and parsing . 22 1.9 Standalone OCaml programs . 23 2 The module system 25 2.1 Structures . 25 2.2 Signatures . 26 2.3 Functors . 27 2.4 Functors and type abstraction . 29 2.5 Modules and separate compilation . 31 3 Objects in OCaml 33 3.1 Classes and objects . 33 3.2 Immediate objects . 36 3.3 Reference to self . 37 3.4 Initializers . 38 3.5 Virtual methods . 38 3.6 Private methods . 40 3.7 Class interfaces . 42 3.8 Inheritance . 43 3.9 Multiple inheritance . 44 3.10 Parameterized classes . 44 3.11 Polymorphic methods . 47 3.12 Using coercions . 50 3.13 Functional objects . 54 3.14 Cloning objects . 55 3.15 Recursive classes . 58 1 2 3.16 Binary methods . 58 3.17 Friends . 60 4 Labels and variants 63 4.1 Labels . 63 4.2 Polymorphic variants . 69 5 Advanced examples with classes and modules 73 5.1 Extended example: bank accounts . 73 5.2 Simple modules as classes .
    [Show full text]
  • CSE 105, Fall 2019 Homework 3 Solutions
    CSE 105, Fall 2019 Homework 3 Solutions Due: Monday 10/28 by midnight Instructions Upload a single file to Gradescope for each group. All group members’ names and PIDs should be on each page of the submission. Your assignments in this class will be evaluated not only on the correctness of your answers, but on your ability to present your ideas clearly and logically. You should always explain how you arrived at your conclusions, using mathematically sound reasoning. Whether you use formal proof techniques or write a more informal argument for why something is true, your answers should always be well-supported. Your goal should be to convince the reader that your results and methods are sound. For questions that only ask for diagrams, justifications are not required but highly recommended. It helps to show your logic in achieving the answers and partial credit can be given if there are minor mistakes in the diagrams. Reading Sipser Sections 1.3 and 1.4 ​ Key Concepts DFA, NFA, equivalence of DFA and NFA, regular expressions, equivalence of ​ DFA and regular expressions, regular languages, closure of the class of regular languages under certain operations, the Pumping Lemma, pumping length, proofs of nonregularity Problem 1 (10 points) For each of the regular expressions below, give two examples of strings in the corresponding language and give two examples of strings not in the corresponding language. a. (000 ⋃ 1)*(0 ⋃ 111)* Examples of strings in the language: 000, 1, 0, 111, 11, 00, 10, 000111, empty string Examples of strings not in the language: 01, 001, 011 b.
    [Show full text]
  • Regular Expressions
    Regular Expressions A regular expression describes a language using three operations. Regular Expressions A regular expression (RE) describes a language. It uses the three regular operations. These are called union/or, concatenation and star. Brackets ( and ) are used for grouping, just as in normal math. Goddard 2: 2 Union The symbol + means union or or. Example: 0 + 1 means either a zero or a one. Goddard 2: 3 Concatenation The concatenation of two REs is obtained by writing the one after the other. Example: (0 + 1) 0 corresponds to f00; 10g. (0 + 1)(0 + ") corresponds to f00; 0; 10; 1g. Goddard 2: 4 Star The symbol ∗ is pronounced star and means zero or more copies. Example: a∗ corresponds to any string of a’s: f"; a; aa; aaa;:::g. ∗ (0 + 1) corresponds to all binary strings. Goddard 2: 5 Example An RE for the language of all binary strings of length at least 2 that begin and end in the same symbol. Goddard 2: 6 Example An RE for the language of all binary strings of length at least 2 that begin and end in the same symbol. ∗ ∗ 0(0 + 1) 0 + 1(0 + 1) 1 Note precedence of regular operators: star al- ways refers to smallest piece it can, or to largest piece it can. Goddard 2: 7 Example Consider the regular expression ∗ ∗ ((0 + 1) 1 + ")(00) 00 Goddard 2: 8 Example Consider the regular expression ∗ ∗ ((0 + 1) 1 + ")(00) 00 This RE is for the set of all binary strings that end with an even nonzero number of 0’s.
    [Show full text]
  • Define ​Basic String View(Nullptr)
    Doc. no.: P0903R2 Date: 2018-05-07 Reply to: Ashley Hedberg ([email protected]), Titus Winters ([email protected]), ​ ​ ​ ​ Jorg Brown ([email protected]) ​ ​ Audience: LEWG/EWG/LWG Define basic_string_view(nullptr) ​ Abstract 1 Background 2 What is a string_view? 2 What does const char* mean? 2 What is an empty string_view? 3 Existing behavior of basic_string_view(null_char_ptr) 3 Motivation 4 Once we convert into the string_view domain, code is better 4 Nul-terminated strings are not the design we'd choose today 5 Nul-termination + null can match string_view’s existing design 5 Discussion Points 6 Can we we weaken preconditions? (Or: do we believe that string_view(null_char_ptr) is more likely to match programmer intent or to represent a bug?) 6 How many functions are there today that accept const char* and (by contract or not) allow for null values? 7 Which view of string_view design speaks to you: is it a lightweight string, or is it a pointer-and-length pair, or is it a mix of the two? 7 Which provides more net value to the C++ community? 7 Could we add a new type such as nullable_string_view? 7 Will the proposed changes negatively affect performance? 8 Proposed Wording 8 Change History 9 Acknowledgements 9 Abstract This paper proposes modifying the requirements of basic_string_view(const charT* str) ​ such that it becomes well-defined for null pointers, both at compile-time and at runtime. Background What is a string_view? ​ ​ The string_view type has shipped in C++17. Substantive redesign is likely out of the question ​ ​ without getting into P0684 territory and long-term refactoring plans.
    [Show full text]