Misplaced Pages

TScript

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

TScript is an object-oriented embeddable scripting language for C++ that supports hierarchical transient typed variables (TVariable). Its main design criterion is to create a scripting language that can interface with C++, transforming data and returning the result. This enables C++ applications to change their functionality after installation.

#636363

58-429: The basic "Hello World!" TScript example. The standard variable can be formed as fixed data such as a Boolean, Integer or Decimal and a variable length variable such as an ASCII string, wide character string or a binary string. The type of the data can be used to define variable or the type can be explicitly declared, so for example the code - variable myInteger = 0; will create a variable called myInteger and assign it

116-539: A numeric character reference . Consider the Chinese character "中", whose numeric code in Unicode is hexadecimal 4E2D, or decimal 20,013. A user whose keyboard offers no method for entering this character could still insert it in an XML document encoded either as &#20013; or &#x4e2d; . Similarly, the string "I <3 Jörg" could be encoded for inclusion in an XML document as I &lt;3 J&#xF6;rg . &#0;

174-477: A defined variables Foo and Bar that supports a constructor. Another striking feature of TScript is the function declarations, which use output parameters rather than return values , and provide syntactic support for these. The standard function in many procedural languages, following Algol, is of the form: In TScript this pattern has been changed to the form: This change has done two things, first it allows multiple output variables and secondly it changed

232-445: A detailed error message. In many languages that use the try {...} catch (...){...} syntax the error is returned via the catch statement and this can make the operational flow of the code awkward in situations where some errors are recoverable. TScript uses the if (...){...} else {...} notation that allows calling code to filter the error, potentially recovering from the error and returning to normal operation, or returning

290-448: A list of syntax rules provided in the specification. Some key points in the fairly lengthy list include: The definition of an XML document excludes texts that contain violations of well-formedness rules; they are simply not XML. An XML processor that encounters such a violation is required to report such errors and to cease normal processing. This policy, occasionally referred to as " draconian error handling", stands in notable contrast to

348-522: A mechanism whereby an XML processor can reliably, without any prior knowledge, determine which encoding is being used. Encodings other than UTF-8 and UTF-16 are not necessarily recognized by every XML parser (and in some cases not even UTF-16, even though the standard mandates it to also be recognized). XML provides escape facilities for including characters that are problematic to include directly. For example: There are five predefined entities : All permitted Unicode characters may be represented with

406-546: A more compact non-XML syntax; the two syntaxes are isomorphic and James Clark 's conversion tool— Trang —can convert between them without loss of information. RELAX NG has a simpler definition and validation framework than XML Schema, making it easier to use and implement. It also has the ability to use datatype framework plug-ins ; a RELAX NG schema author, for example, can require values in an XML document to conform to definitions in XML Schema Datatypes. Schematron

464-506: A rich datatyping system and allow for more detailed constraints on an XML document's logical structure. XSDs also use an XML-based format, which makes it possible to use ordinary XML tools to help process them. xs:schema element that defines a schema: RELAX NG (Regular Language for XML Next Generation) was initially specified by OASIS and is now a standard (Part 2: Regular-grammar-based validation of ISO/IEC 19757 – DSDL ). RELAX NG schemas may be written in either an XML based syntax or

522-434: A third party library and execute through its native interface. This gives TScript the ability to use a wealth of pre-existing functionality and code written in different languages and this can be done without any need to change the shared library's interface or to be compiled with the source code. TScript uses the standard C++ class encapsulation to allocate and de-allocate memory resources. This means that all allocated memory

580-503: A valid variable has been created, the array index subscripting notation can be used to transform it into an array, so for example the code - variable list = {0,2,4,6}; will create an array with four elements. The TVariable type for "list.type" will be that of a structure and each element of list[0].type will be an Integer. Class in TScript are similar to array in how TVariable handle them, but use strings as array scriptures. For example,

638-421: A validity error must be able to report it, but may continue normal processing. A DTD is an example of a schema or grammar . Since the initial publication of XML 1.0, there has been substantial work in the area of schema languages for XML. Such schema languages typically constrain the set of elements that may be used in a document, which attributes may be applied to them, the order in which they may appear, and

SECTION 10

#1732884526637

696-527: A vocabulary to refer to the constructs within an XML document, but does not provide any guidance on how to access this information. A variety of APIs for accessing XML have been developed and used, and some have been standardized. Existing APIs for XML processing tend to fall into these categories: Stream-oriented facilities require less memory and, for certain tasks based on a linear traversal of an XML document, are faster and simpler than other alternatives. Tree-traversal and data-binding APIs typically require

754-458: Is a lexical , event-driven API in which a document is read serially and its contents are reported as callbacks to various methods on a handler object of the user's design. SAX is fast and efficient to implement, but difficult to use for extracting information at random from the XML, since it tends to burden the application author with keeping track of what part of the document is being processed. It

812-726: Is a language for making assertions about the presence or absence of patterns in an XML document. It typically uses XPath expressions. Schematron is now a standard (Part 3: Rule-based validation of ISO/IEC 19757 – DSDL ). DSDL (Document Schema Definition Languages) is a multi-part ISO/IEC standard (ISO/IEC 19757) that brings together a comprehensive set of small schema languages, each targeted at specific problems. DSDL includes RELAX NG full and compact syntax, Schematron assertion language, and languages for defining datatypes, character repertoire constraints, renaming and entity expansion, and namespace-based routing of document fragments to different validators. DSDL schema languages do not have

870-428: Is able to store both primitive and complex variables within the same variable structure. This removes any requirement for any unique difference between primitives and structured data, therefore making the class structure a logical grouping of functionality rather than data storage type. TScript implements concepts of inheritance and code encapsulation through defined variables. For example, the following code snippet show

928-570: Is an XML industry data standard. XML is used extensively to underpin various publishing formats. One of the applications of XML is in the transfer of Operational meteorology (OPMET) information based on IWXXM standards. The material in this section is based on the XML Specification . This is not an exhaustive list of all the constructs that appear in XML; it provides an introduction to the key constructs most often encountered in day-to-day use. XML documents consist entirely of characters from

986-498: Is better suited to situations in which certain types of information are always handled the same way, no matter where they occur in the document. Pull parsing treats the document as a series of items read in sequence using the iterator design pattern . This allows for writing of recursive descent parsers in which the structure of the code performing the parsing mirrors the structure of the XML being parsed, and intermediate parsed results can be used and accessed as local variables within

1044-666: Is designed to allow the running of scripts in a similar way to JavaScript while enabling the usefulness of more powerful scripting languages like Perl . XML Extensible Markup Language ( XML ) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable . The World Wide Web Consortium 's XML 1.0 Specification of 1998 and several other related specifications —all of them free open standards —define XML. The design goals of XML emphasize simplicity, generality, and usability across

1102-442: Is not permitted because the null character is one of the control characters excluded from XML, even when using a numeric character reference. An alternative encoding mechanism such as Base64 is needed to represent such characters. Comments may appear anywhere in a document outside other markup. Comments cannot appear before the XML declaration. Comments begin with <!-- and end with --> . For compatibility with SGML ,

1160-464: Is released when the variable containing it is destroyed and operated differently from the Garbage Collection model of Java or the reference counting model of .NET languages. Operation system resources such as files, sockets and encryption keys are managed via a reference counting mechanism similar to .NET, so they will be released as soon as there are no variables containing their values. With

1218-538: Is when the particular function called is dependent on the type of the variables when the function is called. This is an unusual tactic that has some additional benefits. First it means that there is no need to declare functions before they are used, for example in C++ two functions may call one another, like void Foo (){ Bar ();} and void Bar (){ Bar ();} . In this situation, the Bar () needs to be prototyped in order for

SECTION 20

#1732884526637

1276-549: The Foo() to call it. TScript's run-time linking means the functions can be declared in any order without the need to prototype. This can make writing code much easier for less experienced programmers, allowing them to focus on the logic of the software and not the requirements of the language. Run-time linking also enables the language to support run-time coding with methods like AddMethod and AddDefinedVariable . This enables TScript programs to write themselves. For example, when using

1334-520: The .NET Framework , and the DOM traversal API (NodeIterator and TreeWalker). Errno errno.h is a header file in the standard library of the C programming language . It defines macros for reporting and retrieving error conditions using the symbol errno (short for "error number"). errno acts like an integer variable. A value (the error number) is stored in errno by certain library functions when they detect errors. At program startup,

1392-504: The Internet . It is a textual data format with strong support via Unicode for different human languages . Although the design of XML focuses on documents, the language is widely used for the representation of arbitrary data structures , such as those used in web services . Several schema systems exist to aid in the definition of XML-based languages, while programmers have developed many application programming interfaces (APIs) to aid

1450-583: The SOAP interface, the remote WSDL will be encoded into the script library, allowing the functions within to be called as if they were coded at design time. Additionally it is also possible to write code that can learn for itself, writing new functions when it needs it. TScript is among a small group is scripting languages that provide the functionality to dynamically load and link to existing shared libraries. Java through its JNI and VB6 are two other scripting languages that enable code to be written that would load

1508-453: The Unicode repertoire. Except for a small number of specifically excluded control characters , any character defined by Unicode may appear within the content of an XML document. XML includes facilities for identifying the encoding of the Unicode characters that make up the document, and for expressing characters that, for one reason or another, cannot be used directly. Unicode code points in

1566-410: The infoset augmentation facility and attribute defaults. RELAX NG and Schematron intentionally do not provide these. A cluster of specifications closely related to XML have been developed, starting soon after the initial publication of XML 1.0. It is frequently the case that the term "XML" is used to refer to XML together with one or more of these other technologies that have come to be seen as part of

1624-408: The standard error stream using perror (defined in stdio.h ). As strerror in many Unix-like systems is not thread-safe, a thread-safe version strerror_r is used, but conflicting definitions from POSIX and GNU makes it even less portable than the sys_errlist table. The GNU C library (GLIBC) provides the additional POSIX error values macros in the header file errno.h . These are

1682-429: The XML core. Some other specifications conceived as part of the "XML Core" have failed to find wide adoption, including XInclude , XLink , and XPointer . The design goals of XML include, "It shall be easy to write programs which process XML documents." Despite this, the XML specification contains almost no information about how programmers might go about doing such processing. The XML Infoset specification provides

1740-549: The XML processor inserts in the DTD itself and in the XML document wherever they are referenced, like character escapes. DTD technology is still used in many applications because of its ubiquity. A newer schema language, described by the W3C as the successor of DTDs, is XML Schema , often referred to by the initialism for XML Schema instances, XSD (XML Schema Definition). XSDs are far more powerful than DTDs in describing XML languages. They use

1798-478: The ability to load existing shared libraries, script can access all privileges granted to the user who executes it. To guard against malicious code, all resources beyond the basic memory allocation are required to be granted to each script. This also includes the ability to use message boxes to prompt the user, read and/or write access to any file or directory, or using the Internet connection. This security architecture

TScript - Misplaced Pages Continue

1856-434: The allowable parent/child relationships. The oldest schema language for XML is the document type definition (DTD), inherited from SGML. DTDs have the following benefits: DTDs have the following limitations: Two peculiar features that distinguish DTDs from other schema types are the syntactic support for embedding a DTD within XML documents and for defining entities , which are arbitrary fragments of text or markup that

1914-598: The base language for communication protocols such as SOAP and XMPP . It is one of the message exchange formats used in the Asynchronous JavaScript and XML (AJAX) programming technique. Many industry data standards, such as Health Level 7 , OpenTravel Alliance , FpML , MISMO , and National Information Exchange Model are based on XML and the rich features of the XML schema specification. In publishing, Darwin Information Typing Architecture

1972-401: The behavior of programs that process HTML , which are designed to produce a reasonable result even in the presence of severe markup errors. XML's policy in this area has been criticized as a violation of Postel's law ("Be conservative in what you send; be liberal in what you accept"). The XML specification defines a valid XML document as a well-formed XML document which also conforms to

2030-431: The calling code from catching any errors and they will automatically be return to the parental calling code. Error handling in many other languages is done through the use of exceptions . TScript uses a similar process of error handling, although slightly different. TScript has a global error variable similar to the traditional errno in C, although the error variable in TScript is capable to holding both an error code and

2088-423: The case of C1 characters, this restriction is a backwards incompatibility; it was introduced to allow common encoding errors to be detected. The code point U+0000 (Null) is the only character that is not permitted in any XML 1.1 document. The Unicode character set can be encoded into bytes for storage or transmission in a variety of different ways, called "encodings". Unicode itself defines encodings that cover

2146-432: The code - variable list = { "Monday" => true , "Tuesday" => false }; will create a structured variable where list. Monday is true and list.Tuesday is false. In the native C++ code, structured TVariable elements are accessible in C++ by - list["Monday"]; or by either list.Monday or list["Monday"] in native code. Supporting hierarchical variables, TScript

2204-429: The data structure and contain metadata . What is within the tags is data, encoded in the way the XML standard specifies. An additional XML schema (XSD) defines the necessary metadata for interpreting and validating XML. (This is also referred to as the canonical schema.) An XML document that adheres to basic XML rules is "well-formed"; one that adheres to its schema is "valid." IETF RFC 7303 (which supersedes

2262-442: The direct use of almost any Unicode character in element names, attributes, comments, character data, and processing instructions (other than the ones that have special symbolic meaning in XML itself, such as the less-than sign, "<"). The following is a well-formed XML document including Chinese , Armenian and Cyrillic characters: The XML specification defines an XML document as a well-formed text, meaning that it satisfies

2320-516: The entire repertoire; well-known ones include UTF-8 (which the XML standard recommends using, without a BOM ) and UTF-16 . There are many other text encodings that predate Unicode, such as ASCII and various ISO/IEC 8859 ; their character repertoires are in every case subsets of the Unicode character set. XML allows the use of any of the Unicode-defined encodings and any other encodings whose characters also appear in Unicode. XML also provides

2378-430: The error codes. The C standard library only requires three to be defined: EDOM ERANGE EILSEQ (Required since 1994 Amendment 1 to C89 standard) POSIX compliant operating systems like AIX , Linux or Solaris include many other error values, many of which are used much more often than the above ones, such as EACCES for when a file cannot be opened for reading. C++11 additionally defines many of

TScript - Misplaced Pages Continue

2436-423: The error to its own calling function. C++ supports function overloading , which enables functions to have the same name while being differentiated by their input parameters. This causes TScript an issue while supporting loose type variables, as there is no way to tell what the type of a variable is until the software is being executed. To counter this problem, TScript has been written with run-time linking. This

2494-498: The following ranges are valid in XML 1.0 documents: XML 1.1 extends the set of allowed characters to include all the above, plus the remaining characters in the range U+0001–U+001F. At the same time, however, it restricts the use of C0 and C1 control characters other than U+0009 (Horizontal Tab), U+000A (Line Feed), U+000D (Carriage Return), and U+0085 (Next Line) by requiring them to be written in escaped form (for example U+0001 must be written as &#x01; or its equivalent). In

2552-685: The functions performing the parsing, or passed down (as function parameters) into lower-level functions, or returned (as function return values) to higher-level functions. Examples of pull parsers include Data::Edit::Xml in Perl , StAX in the Java programming language, XMLPullParser in Smalltalk , XMLReader in PHP , ElementTree.iterparse in Python , SmartXML in Red , System.Xml.XmlReader in

2610-550: The older RFC 3023 ), provides rules for the construction of media types for use in XML message. It defines three media types: application/xml ( text/xml is an alias), application/xml-external-parsed-entity ( text/xml-external-parsed-entity is an alias) and application/xml-dtd . They are used for transmitting raw XML files without exposing their internal semantics . RFC 7303 further recommends that XML-based languages be given media types ending in +xml , for example, image/svg+xml for SVG . Further guidelines for

2668-449: The processing of XML data. The main purpose of XML is serialization , i.e. storing, transmitting, and reconstructing arbitrary data. For two disparate systems to exchange information, they need to agree upon a file format. XML standardizes this process. It is therefore analogous to a lingua franca for representing information. As a markup language , XML labels, categorizes, and structurally organizes information. XML tags represent

2726-475: The return statement to an error handling function. Allowing functions to have a list of input and output variables that are separated by the semi column ":", changed the normal flow of how the function are called and used. This removes some of the need for using reference pointers to return multiple variables that is common in C/C++, and the use of references in most other scripting languages is actually prevented, forcing

2784-487: The rules of a Document Type Definition (DTD). In addition to being well formed, an XML document may be valid . This means that it contains a reference to a Document Type Definition (DTD), and that its elements and attributes are declared in that DTD and follow the grammatical rules for them that the DTD specifies. XML processors are classified as validating or non-validating depending on whether or not they check XML documents for validity. A processor that discovers

2842-481: The same values found within the POSIX specification. Traditionally, the first page of Unix system manuals , named intro(2), lists all errno.h macros, but this is not the case with Linux , where these macros are instead listed in the errno(3). An errno can be translated to a descriptive string using strerror (defined in string.h ) or a BSD extension called sys_errlist . The translation can be printed directly to

2900-475: The statement:- return error = "Have an error message"; will terminate the function and return the error message. Alternatively the blank statement;- return; will terminate the function but not return any error. For convenience TScript offers a shorthand function calling in the situation where there is only one returned variable. This notation of will substitute the case of function ( : variable ); for variable = function (); . This short notation prevents

2958-469: The string "--" (double-hyphen) is not allowed inside comments; this means comments cannot be nested. The ampersand has no special significance within comments, so entity and character references are not recognized as such, and there is no way to represent characters outside the character set of the document encoding. An example of a valid comment: <!--no need to escape <code> & such in comments--> XML 1.0 (Fifth Edition) and XML 1.1 support

SECTION 50

#1732884526637

3016-471: The use of XML in a networked context appear in RFC 3470 , also known as IETF BCP 70, a document covering many aspects of designing and deploying an XML-based language. XML has come into common use for the interchange of data over the Internet. Hundreds of document formats using XML syntax have been developed, including RSS , Atom , Office Open XML , OpenDocument , SVG , COLLADA , and XHTML . XML also provides

3074-413: The use of a structure or array to return multiple values. The second noticeable thing about the calling conventions is that now all functions have an integrated error handling purpose similar to try { … } catch ( … ){ … } and throw new Exception () of C++ and Java. In TScript since all functions return an error, the return statement operates similar to the throw statement. For example,

3132-472: The use of much more memory, but are often found more convenient for use by programmers; some include declarative retrieval of document components via the use of XPath expressions. XSLT is designed for declarative description of XML document transformations, and has been widely implemented both in server-side packages and Web browsers. XQuery overlaps XSLT in its functionality, but is designed more for searching of large XML databases . Simple API for XML (SAX)

3190-571: The value of zero. An Integer type can also be declared as - Integer myInteger; and its default value will be set to zero. TVariable are hierarchical in nature and are very similar to XML , JavaScript and PHP variables. The TVariable type is also transient as an Integer can be changed into an AString by assigning it a string value or by casting the variable to an AString. For example, after an integer variable has been created and used, it can be reassigned by equating it to an AString. TVariables can also be used to hold an array of TVariables. Once

3248-464: The value stored is zero. Library functions store only values greater than zero. Any library function can alter the value stored before return, whether or not they detect errors. Most functions indicate that they detected an error by returning a special value, typically NULL for functions that return pointers , and -1 for functions that return integers. A few functions require the caller to preset errno to zero and test it afterwards to see if an error

3306-426: The vendor support of XML Schemas yet, and are to some extent a grassroots reaction of industrial publishers to the lack of utility of XML Schemas for publishing . Some schema languages not only describe the structure of a particular XML format but also offer limited facilities to influence processing of individual XML files that conform to this format. DTDs and XSDs both have this ability; they can for instance provide

3364-443: Was detected. The errno macro expands to an lvalue with type int , sometimes with the extern and/or volatile type specifiers depending upon the platform. Originally this was a static memory location, but macros are almost always used today to allow for multi-threading , so that each thread will see its own thread-local error number. The header file also defines macros that expand to integer constants that represent

#636363