Misplaced Pages

HSL (Fortran library)

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.

HSL , originally the Harwell Subroutine Library , is a collection of Fortran 77 and 95 codes that address core problems in numerical analysis . It is primarily developed by the Numerical Analysis Group at the Rutherford Appleton Laboratory with contributions from other experts in the field.

#993006

80-484: HSL codes are easily recognizable by the format of their names, consisting of two letters followed by two numbers, dating back to early versions of Fortran's limited subroutine name length. The letters denote a broad classification of the problem they solve, and the numbers serve to distinguish different codes. For example, the well known sparse LU code MA28 (superseded by MA48 ) is a Matrix Algebra code number 28. Fortran 95 codes are differentiated from Fortran 77 codes by

160-413: A call stack , a special case of the stack data structure , to implement function calls and returns. Each procedure call creates a new entry, called a stack frame , at the top of the stack; when the procedure returns, its stack frame is deleted from the stack, and its space may be used for other procedure calls. Each stack frame contains the private data of the corresponding call, which typically includes

240-482: A peripheral device , accessing a file , halting the program or the machine, or temporarily pausing program execution. Side effects are considered undesireble by Robert C. Martin , who is known for promoting design principles. Martin argues that side effects can result in temporal coupling or order dependencies. Macro (computer science) In computer programming , a macro (short for " macro instruction "; from Greek μακρο -  'long, large' )

320-485: A capability to programming that has commonality. The term used tends to reflect the context in which it is used – usually based on the language being used. For example: The idea of a callable unit was initially conceived by John Mauchly and Kathleen Antonelli during their work on ENIAC and recorded in a January 1947 Harvard symposium on "Preparation of Problems for EDVAC -type Machines." Maurice Wilkes , David Wheeler , and Stanley Gill are generally credited with

400-636: A dedicated hardware stack to store return addresses—such hardware supports only a few levels of subroutine nesting, but can support recursive subroutines. Machines before the mid-1960s—such as the UNIVAC I , the PDP-1 , and the IBM 1130 —typically use a calling convention which saved the instruction counter in the first memory location of the called subroutine. This allows arbitrarily deep levels of subroutine nesting but does not support recursive subroutines. The IBM System/360 had

480-417: A different name for a callable unit that returns a value ( function or subprogram ) vs. one that does not ( subroutine or procedure ). Other languages, such as C , C++ , C# and Lisp , use only one name for a callable unit, function . The C-family languages use the keyword void to indicate no return value. If declared to return a value, a call can be embedded in an expression in order to consume

560-421: A library, in the literal sense, which kept indexed collections of tapes or decks of cards for collective use. To remove the need for self-modifying code , computer designers eventually provided an indirect jump instruction, whose operand, instead of being the return address itself, was the location of a variable or processor register containing the return address. On those computers, instead of modifying

640-549: A macro pre-processor and an assembler in the same package. In 1959, Douglas E. Eastwood and Douglas McIlroy of Bell Labs introduced conditional and recursive macros into the popular SAP assembler, creating what is known as Macro SAP. McIlroy's 1960 paper was seminal in the area of extending any (including high-level ) programming languages through macro processors . Macro Assemblers allowed assembly language programmers to implement their own macro-language and allowed limited portability of code between two machines running

720-618: A middle step between assembly language programming and the high-level programming languages that followed, such as FORTRAN and COBOL . Two of the earliest programming installations to develop "macro languages" for the IBM 705 computer were at Dow Chemical Corp. in Delaware and the Air Material Command, Ballistics Missile Logistics Office in California. A macro instruction written in the format of

800-499: A new release issued every two to three years. Many older codes have now been superseded and are available in the HSL Archive. The current version, HSL 2007 is a commercial product sold by AspenTech , but is also available without charge to individual academics direct from STFC for teaching and their own academic research purposes. HSL is currently not sold to commercial competitors of Aspen Technology. Obsolete routines are stored in

880-585: A pattern-based system where the syntactic environments of the macro definition and the macro use are distinct, allowing macro definers and users not to worry about inadvertent variable capture (cf. referential transparency ). Hygienic macros have been standardized for Scheme in the R5RS , R6RS , and R7RS standards. A number of competing implementations of hygienic macros exist such as syntax-rules , syntax-case , explicit renaming, and syntactic closures. Both syntax-rules and syntax-case have been standardized in

SECTION 10

#1732859226994

960-463: A programmer for any set of native assembler program instructions, typically macros are associated with macro libraries delivered with the operating system allowing access to operating system functions such as In older operating systems such as those used on IBM mainframes, full operating system functionality was only available to assembler language programs, not to high level language programs (unless assembly language subroutines were used, of course), as

1040-523: A register (macro) what a person types on the keyboard and it can be replayed or edited just like VBA macros for Microsoft Office. Vim also has a scripting language called Vimscript to create macros. Visual Basic for Applications (VBA) is a programming language included in Microsoft Office from Office 97 through Office 2019 (although it was available in some components of Office prior to Office 97). However, its function has evolved from and replaced

1120-559: A scripting language. VBA has access to most Microsoft Windows system calls and executes when documents are opened. This makes it relatively easy to write computer viruses in VBA, commonly known as macro viruses . In the mid-to-late 1990s, this became one of the most common types of computer virus. However, during the late 1990s and to date, Microsoft has been patching and updating its programs. In addition, current anti-virus programs immediately counteract such attacks. A parameterized macro

1200-452: A sequence of numbers, and so on through the list of subroutines needed for a particular problem. ... All these subroutines will then be stored in the machine, and all one needs to do is make a brief reference to them by number, as they are indicated in the coding. Kay McNulty had worked closely with John Mauchly on the ENIAC team and developed an idea for subroutines for the ENIAC computer she

1280-427: A subroutine call instruction that placed the saved instruction counter value into a general-purpose register; this can be used to support arbitrarily deep subroutine nesting and recursive subroutines. The Burroughs B5000 (1961) is one of the first computers to store subroutine return data on a stack. The DEC PDP-6 (1964) is one of the first accumulator-based machines to have a subroutine call instruction that saved

1360-458: A subroutine called MYSUB from the main program. The subroutine would be coded as The JSB instruction placed the address of the NEXT instruction (namely, BB) into the location specified as its operand (namely, MYSUB), and then branched to the NEXT location after that (namely, AA = MYSUB + 1). The subroutine could then return to the main program by executing the indirect jump JMP MYSUB, I which branched to

1440-446: A very different computer with very little effort (for each target machine architecture, just the writing of the rudimentary macro compiler). The advent of modern programming languages, notably C , for which compilers are available on virtually all computers, has rendered such an approach superfluous. This was, however, one of the first instances (if not the first) of compiler bootstrapping . While macro instructions can be defined by

1520-432: Is a callable unit of software logic that has a well-defined interface and behavior and can be invoked multiple times. Callable units provide a powerful programming tool. The primary purpose is to allow for the decomposition of a large and/or complicated problem into chunks that have relatively low cognitive load and to assign the chunks meaningful names (unless they are anonymous). Judicious application can reduce

1600-407: Is a macro that is able to insert given objects into its expansion. This gives the macro some of the power of a function . As a simple example, in the C programming language , this is a typical macro that is not a parameterized macro, i.e., a parameterless macro : This causes PI to always be replaced with 3.14159 wherever it occurs. An example of a parameterized macro, on the other hand,

1680-476: Is a rule or pattern that specifies how a certain input should be mapped to a replacement output. Applying a macro to an input is known as macro expansion . The input and output may be a sequence of lexical tokens or characters , or a syntax tree . Character macros are supported in software applications to make it easy to invoke common command sequences. Token and tree macros are supported in some programming languages to enable code reuse or to extend

SECTION 20

#1732859226994

1760-500: Is a type of programming macro that deliberately captures some form supplied to the macro which may be referred to by an anaphor (an expression referring to another). Anaphoric macros first appeared in Paul Graham's On Lisp and their name is a reference to linguistic anaphora—the use of words as a substitute for preceding words. In the mid-eighties, a number of papers introduced the notion of hygienic macro expansion ( syntax-rules ),

1840-445: Is both a generic component in a hierarchy of nested subassemblies, and a procedure for integrating itself with its subassembly frames (a recursive process that resolves integration conflicts in favor of higher level subassemblies). The outputs are custom documents, typically compilable source modules. Frame technology can avoid the proliferation of similar but subtly different components, an issue that has plagued software development since

1920-415: Is most obvious and objectionable in leaf procedures or leaf functions , which return without making any procedure calls themselves. To reduce that overhead, many modern compilers try to delay the use of a call stack until it is really needed. For example, the call of a procedure P may store the return address and parameters of the called procedure in certain processor registers, and transfer control to

2000-418: Is possible, since all the logical characteristics essential to this procedure are available, to evolve a coding instruction for placing the subroutines in the memory at places known to the machine, and in such a way that they may easily be called into use. In other words, one can designate subroutine A as division and subroutine B as complex multiplication and subroutine C as the evaluation of a standard error of

2080-500: Is this: What this macro expands to depends on what argument x is passed to it. Here are some possible expansions: Parameterized macros are a useful source-level mechanism for performing in-line expansion , but in languages such as C where they use simple textual substitution, they have a number of severe disadvantages over other mechanisms for performing in-line expansion, such as inline functions . The parameterized macros used in languages such as Lisp , PL/I and Scheme , on

2160-401: Is used to declare no return value; for example void in C, C++ and C#. In some languages, such as Python, the difference is whether the body contains a return statement with a value, and a particular callable may return with or without a value based on control flow. In many contexts, a callable may have side effect behavior such as modifying passed or global data, reading from or writing to

2240-438: Is usually implemented as a contiguous area of memory. It is an arbitrary design choice whether the bottom of the stack is the lowest or highest address within this area, so that the stack may grow forwards or backwards in memory; however, many architectures chose the latter. Some designs, notably some Forth implementations, used two separate stacks, one mainly for control information (like return addresses and loop counters) and

2320-476: The HSL archive and are available for personal non-commercial use by anyone following registration with HSL. Commercial use and distribution of these routines still requires a purchased licence. This computer-library -related article is a stub . You can help Misplaced Pages by expanding it . Subroutine In computer programming , a function (also procedure , method , subroutine , routine , or subprogram )

2400-453: The Racket language extends the notion of a macro system to a syntactic tower, where macros can be written in languages including macros, using hygiene to ensure that syntactic layers are distinct and allowing modules to export macros to other modules. Macros are normally used to map a short string (macro invocation) to a longer sequence of instructions. Another, less common, use of macros is to do

2480-694: The conditional assembler program generates and have been used to create entire programs or program suites according to such variables as operating system , platform or other factors. The term derives from "macro instruction", and such expansions were originally used in generating assembly language code. Keyboard macros and mouse macros allow short sequences of keystrokes and mouse actions to transform into other, usually more time-consuming, sequences of keystrokes and mouse actions. In this way, frequently used or repetitive sequences of keystrokes and mouse movements can be automated . Separate programs for creating these macros are called macro recorders . During

HSL (Fortran library) - Misplaced Pages Continue

2560-524: The execution of a program. Execution continues at the next instruction after the call instruction when it returns control. The features of implementations of callable units evolved over time and varies by context. This section describes features of the various common implementations. Most modern programming languages provide features to define and call functions, including syntax for accessing such features, including: Some languages, such as Pascal , Fortran , Ada and many dialects of BASIC , use

2640-407: The token , rather than the character level. However, the macro facilities of more sophisticated assemblers, e.g., IBM High Level Assembler (HLASM) can't be implemented with a preprocessor; the code for assembling instructions and data is interspersed with the code for assembling macro invocations. A classic use of macros is in the computer typesetting system TeX and its derivatives, where most of

2720-425: The 1980s, macro programs – originally SmartKey , then SuperKey, KeyWorks, Prokey – were very popular, first as a means to automatically format screenplays , then for a variety of user-input tasks. These programs were based on the terminate-and-stay-resident mode of operation and applied to all keyboard input, no matter in which context it occurred. They have to some extent fallen into obsolescence following

2800-490: The IBM System/360 , for example, the branch instructions BAL or BALR, designed for procedure calling, would save the return address in a processor register specified in the instruction, by convention register 14. To return, the subroutine had only to execute an indirect branch instruction (BR) through that register. If the subroutine needed that register for some other purpose (such as calling another subroutine), it would save

2880-630: The Scheme standards. Recently, Racket has combined the notions of hygienic macros with a " tower of evaluators ", so that the syntactic expansion time of one macro system is the ordinary runtime of another block of code, and showed how to apply interleaved expansion and parsing in a non-parenthesized language. A number of languages other than Scheme either implement hygienic macros or implement partially hygienic systems. Examples include Scala , Rust , Elixir , Julia , Dylan , Nim , and Nemerle . Felleisen conjectures that these three categories make up

2960-569: The actions. An underlying macro programming language, most commonly a scripting language , with direct access to the features of the application may also exist. The programmers' text editor Emacs (short for "editing macros") follows this idea to a conclusion. In effect, most of the editor is made of macros. Emacs was originally devised as a set of macros in the editing language TECO ; it was later ported to dialects of Lisp . Another programmers' text editor, Vim (a descendant of vi ), also has an implementation of keyboard macros. It can record into

3040-440: The advent of mouse-driven user interfaces and the availability of keyboard and mouse macros in applications, such as word processors and spreadsheets , making it possible to create application-sensitive keyboard macros. Keyboard macros can be used in massively multiplayer online role-playing games (MMORPGs) to perform repetitive, but lucrative tasks, thus accumulating resources. As this is done without human effort, it can skew

3120-556: The basic assembly language code remained the same, only the macro libraries needed to be written for each target language. In modern operating systems such as Unix and its derivatives, operating system access is provided through subroutines, usually provided by dynamic libraries. High-level languages such as C offer comprehensive access to operating system functions, obviating the need for assembler language programs for such functionality. Moreover, standard libraries of several newer programming languages, such as Go , actively discourage

3200-546: The call stack mechanism can be viewed as the earliest and simplest method for automatic memory management . However, another advantage of the call stack method is that it allows recursive function calls , since each nested call to the same procedure gets a separate instance of its private data. In a multi-threaded environment, there is generally more than one stack. An environment that fully supports coroutines or lazy evaluation may use data structures other than stacks to store their activation records. One disadvantage of

3280-448: The call stack mechanism is the increased cost of a procedure call and its matching return. The extra cost includes incrementing and decrementing the stack pointer (and, in some architectures, checking for stack overflow ), and accessing the local variables and parameters by frame-relative addresses, instead of absolute addresses. The cost may be realized in increased execution time, or increased processor complexity, or both. This overhead

HSL (Fortran library) - Misplaced Pages Continue

3360-439: The callable declares as formal parameters . A caller passes actual parameters , a.k.a. arguments , to match. Different programming languages provide different conventions for passing arguments. In some languages, such as BASIC, a callable has different syntax (i.e. keyword) for a callable that returns a value vs. one that does not. In other languages, the syntax is the same regardless. In some of these languages an extra keyword

3440-656: The cost of developing and maintaining software, while increasing its quality and reliability. Callable units are present at multiple levels of abstraction in the programming environment. For example, a programmer may write a function in source code that is compiled to machine code that implements similar semantics . There is a callable unit in the source code and an associated one in the machine code, but they are different kinds of callable units – with different implications and features. The meaning of each callable term (function, procedure, method, ...) is, in fact, different. They are not synonymous . Nevertheless, they each add

3520-466: The early 1980s, to discover the recalculation dependencies in a spreadsheet. Namely, a location was reserved in each cell to store the return address. Since circular references are not allowed for natural recalculation order, this allows a tree walk without reserving space for a stack in memory, which was very limited on small computers such as the IBM PC . Most modern implementations of a function call use

3600-446: The economy of the game. For this reason, use of macros is a violation of the TOS or EULA of most MMORPGs, and their administrators spend considerable effort to suppress them. Keyboard and mouse macros that are created using an application's built-in macro features are sometimes called application macros . They are created by carrying out the sequence once and letting the application record

3680-574: The formal invention of this concept, which they termed a closed sub-routine , contrasted with an open subroutine or macro . However, Alan Turing had discussed subroutines in a paper of 1945 on design proposals for the NPL ACE , going so far as to invent the concept of a return address stack . The idea of a subroutine was worked out after computing machines had already existed for some time. The arithmetic and conditional jump instructions were planned ahead of time and have changed relatively little, but

3760-422: The function's return jump, the calling program would store the return address in a variable so that when the function completed, it would execute an indirect jump that would direct execution to the location given by the predefined variable. Another advance was the jump to subroutine instruction, which combined the saving of the return address with the calling jump, thereby minimizing overhead significantly. In

3840-510: The functionality is based on macros. MacroML is an experimental system that seeks to reconcile static typing and macro systems. Nemerle has typed syntax macros, and one productive way to think of these syntax macros is as a multi-stage computation . Other examples: Some major applications have been written as text macro invoked by other applications, e.g., by XEDIT in CMS. Some languages, such as PHP , can be embedded in free-format text, or

3920-516: The intervening years, HSL has striven to maintain a high standard of reliability and has garnered a worldwide reputation as a prime source of numerical software. It has undergone a number of changes to reflect newly available features of the Fortran language, completing in 1990 the conversion to Fortran 77, and more recently, the entire Library has been made thread safe . Many newer codes are written in Fortran 95. New packages continue to be developed, with

4000-468: The invention of macros and subroutines . Most assembly languages have less powerful procedural macro facilities, for example allowing a block of code to be repeated N times for loop unrolling ; but these have a completely different syntax from the actual assembly language. Macro systems—such as the C preprocessor described earlier—that work at the level of lexical tokens cannot preserve the lexical structure reliably. Syntactic macro systems work instead at

4080-433: The language, sometimes for domain-specific languages . Macros are used to make a sequence of computing instructions available to the programmer as a single program statement , making the programming task less tedious and less error-prone. Thus, they are called "macros" because a "big" block of code can be expanded from a "small" sequence of characters. Macros often allow positional or keyword parameters that dictate what

SECTION 50

#1732859226994

4160-484: The level of abstract syntax trees , and preserve the lexical structure of the original program. The most widely used implementations of syntactic macro systems are found in Lisp -like languages. These languages are especially suited for this style of macro due to their uniform, parenthesized syntax (known as S-expressions ). In particular, uniform syntax makes it easier to determine the invocations of macros. Lisp macros transform

4240-412: The location stored at location MYSUB. Compilers for Fortran and other languages could easily make use of these instructions when available. This approach supported multiple levels of calls; however, since the return address, parameters, and return values of a subroutine were assigned fixed memory locations, it did not allow for recursive calls. Incidentally, a similar method was used by Lotus 1-2-3 , in

4320-578: The macro languages that were originally included in some of these applications. XEDIT , running on the Conversational Monitor System (CMS) component of VM , supports macros written in EXEC , EXEC2 and REXX , and some CMS commands were actually wrappers around XEDIT macros. The Hessling Editor (THE), a partial clone of XEDIT, supports Rexx macros using Regina and Open Object REXX (oorexx). Many common applications, and some on PCs, use Rexx as

4400-431: The need for multiple libraries. In the 1980s and early 1990s, desktop PCs were only running at a few MHz and assembly language routines were commonly used to speed up programs written in C, Fortran, Pascal and others. These languages, at the time, used different calling conventions. Macros could be used to interface routines written in assembly language to the front end of applications written in almost any language. Again,

4480-496: The other for data. The former was, or worked like, a call stack and was only indirectly accessible to the programmer through other language constructs while the latter was more directly accessible. When stack-based procedure calls were first introduced, an important motivation was to save precious memory. With this scheme, the compiler does not have to reserve separate space in memory for the private data (parameters, return address, and local variables) of each procedure. At any moment,

4560-399: The other hand, are much more powerful, able to make decisions about what code to produce based on their arguments; thus, they can effectively be used to perform run-time code generation . Languages such as C and some assembly languages have rudimentary macro systems, implemented as preprocessors to the compiler or assembler. C preprocessor macros work by simple textual substitution at

4640-548: The output of this execution forms part of the code that is compiled. The ability to use a familiar procedural language as the macro language gives power much greater than that of text substitution macros, at the expense of a larger and slower compiler. Macros in PL/I, as well as in many assemblers, may have side effects , e.g., setting variables that other macros can access. Frame technology 's frame macros have their own command syntax but can also contain text in any language. Each frame

4720-527: The prefix HSL_ . Original development of the Harwell Subroutine Library began in 1963 by Mike Powell and Mike Hopper for internal use on an IBM mainframe at AERE Harwell . Early contributors also included Alan Curtis. With a spreading reputation, the Library was distributed externally for the first time in 1964 upon request. The first library catalog (AERE Report M-1748) was released in 1966. Over

4800-622: The primary legitimate uses of macros in such a system. Others have proposed alternative uses of macros, such as anaphoric macros in macro systems that are unhygienic or allow selective unhygienic transformation. The interaction of macros and other language features has been a productive area of research. For example, components and modules are useful for large-scale programming, but the interaction of macros and these other constructs must be defined for their use together. Module and component-systems that can interact with macros have been proposed for Scheme and other languages with macros. For example,

4880-522: The procedure's body by a simple jump. If the procedure P returns without making any other call, the call stack is not used at all. If P needs to call another procedure Q , it will then use the call stack to save the contents of any registers (such as the return address) that will be needed after Q returns. In general, a callable unit is a list of instructions that, starting at the first instruction, executes sequentially except as directed via its internal logic. It can be invoked (called) many times during

SECTION 60

#1732859226994

4960-408: The procedure's parameters and internal variables, and the return address. The call sequence can be implemented by a sequence of ordinary instructions (an approach still used in reduced instruction set computing (RISC) and very long instruction word (VLIW) architectures), but many traditional machines designed since the late 1960s have included special instructions for that purpose. The call stack

5040-421: The program instructions into memory from a punched paper tape . Each subroutine could then be provided by a separate piece of tape, loaded or spliced before or after the main program (or "mainline" ); and the same subroutine tape could then be used by many different programs. A similar approach was used in computers that loaded program instructions from punched cards . The name subroutine library originally meant

5120-543: The program structure itself, with the full language available to express such transformations. While syntactic macros are often found in Lisp-like languages, they are also available in other languages such as Prolog , Erlang , Dylan , Scala , Nemerle , Rust , Elixir , Nim , Haxe , and Julia . They are also available as third-party extensions to JavaScript and C# . Before Lisp had macros, it had so-called FEXPRs , function-like operators whose inputs were not

5200-546: The register's contents to a private memory location or a register stack . In systems such as the HP 2100 , the JSB instruction would perform a similar task, except that the return address was stored in the memory location that was the target of the branch. Execution of the procedure would actually begin at the next memory location. In the HP 2100 assembly language, one would write, for example to call

5280-415: The return address in a stack addressed by an accumulator or index register. The later PDP-10 (1966), PDP-11 (1970) and VAX-11 (1976) lines followed suit; this feature also supports both arbitrarily deep subroutine nesting and recursive subroutines. In the very early assemblers, subroutine support was limited. Subroutines were not explicitly separated from each other or from the main program, and indeed

5360-516: The return value. For example, a square root callable unit might be called like y = sqrt(x) . A callable unit that does not return a value is called as a stand-alone statement like print("hello") . This syntax can also be used for a callable unit that returns a value, but the return value will be ignored. Some older languages require a keyword for calls that do not consume a return value, like CALL print("hello") . Most implementations, especially in modern languages, support parameters which

5440-495: The reverse: to map a sequence of instructions to a macro string. This was the approach taken by the STAGE2 Mobile Programming System , which used a rudimentary macro compiler (called SIMCMP) to map the specific instruction set of a given computer into machine-independent macros. Applications (notably compilers) written in these machine-independent macros can then be run without change on any computer equipped with

5520-407: The rudimentary macro compiler. The first application run in such a context is a more sophisticated and powerful macro compiler, written in the machine-independent macro language. This macro compiler is applied to itself, in a bootstrap fashion, to produce a compiled and much more efficient version of itself. The advantage of this approach is that complex applications can be ported from one computer to

5600-422: The same CPU but different operating systems, for example, early versions of MS-DOS and CP/M-86 . The macro library would need to be written for each target machine but not the overall assembly language program. Note that more powerful macro assemblers allowed use of conditional assembly constructs in macro instructions that could generate different code on different machines or different operating systems, reducing

5680-420: The source code of a subroutine could be interspersed with that of other subprograms. Some assemblers would offer predefined macros to generate the call and return sequences. By the 1960s, assemblers usually had much more sophisticated support for both inline and separately assembled subroutines that could be linked together. One of the first programming languages to support user-written subroutines and functions

5760-446: The source code of other languages. The mechanism by which the code fragments are recognised (for instance, being bracketed by <?php and ?> ) is similar to a textual macro language, but they are much more powerful, fully featured languages. Macros in the PL/I language are written in a subset of PL/I itself: the compiler executes " preprocessor statements" at compilation time, and

5840-618: The special instructions used for procedure calls have changed greatly over the years. The earliest computers and microprocessors, such as the Manchester Baby and the RCA 1802 , did not have a single subroutine call instruction. Subroutines could be implemented, but they required programmers to use the call sequence—a series of instructions—at each call site . Subroutines were implemented in Konrad Zuse 's Z4 in 1945. In 1945, Alan M. Turing used

5920-457: The stack contains only the private data of the calls that are currently active (namely, which have been called but haven't returned yet). Because of the ways in which programs were usually assembled from libraries, it was (and still is) not uncommon to find programs that include thousands of functions, of which only a handful are active at any given moment. For such programs, the call stack mechanism could save significant amounts of memory. Indeed,

6000-573: The standard macro instructions did not always have counterparts in routines available to high-level languages. In the mid-1950s, when assembly language programming was commonly used to write programs for digital computers , the use of macro instructions was initiated for two main purposes: to reduce the amount of program coding that had to be written by generating several assembly language statements from one macro instruction and to enforce program writing standards, e.g. specifying input/output commands in standard ways. Macro instructions were effectively

6080-525: The target assembly language would be processed by a macro compiler, which was a pre-processor to the assembler, to generate one or more assembly language instructions to be processed next by the assembler program that would translate the assembly language instructions into machine language instructions. By the late 1950s the macro language was followed by the Macro Assemblers . This was a combination of both where one program served both functions, that of

6160-478: The terms "bury" and "unbury" as a means of calling and returning from subroutines. In January 1947 John Mauchly presented general notes at 'A Symposium of Large Scale Digital Calculating Machinery' under the joint sponsorship of Harvard University and the Bureau of Ordnance, United States Navy. Here he discusses serial and parallel operation suggesting ...the structure of the machine need not be complicated one bit. It

6240-520: The values computed by the arguments but rather the syntactic forms of the arguments, and whose output were values to be used in the computation. In other words, FEXPRs were implemented at the same level as EVAL, and provided a window into the meta-evaluation layer. This was generally found to be a difficult model to reason about effectively. In 1963, Timothy Hart proposed adding macros to Lisp 1.5 in AI Memo 57: MACRO Definitions for LISP. An anaphoric macro

6320-446: Was FORTRAN II . The IBM FORTRAN II compiler was released in 1958. ALGOL 58 and other early programming languages also supported procedural programming. Even with this cumbersome approach, subroutines proved very useful. They allowed the use of the same code in many different programs. Memory was a very scarce resource on early computers, and subroutines allowed significant savings in the size of programs. Many early computers loaded

6400-522: Was programming during World War II. She and the other ENIAC programmers used the subroutines to help calculate missile trajectories. Goldstine and von Neumann wrote a paper dated 16 August 1948 discussing the use of subroutines. Some very early computers and microprocessors, such as the IBM 1620 , the Intel 4004 and Intel 8008 , and the PIC microcontrollers , have a single-instruction subroutine call that uses

#993006