text:
Understanding Air Safety in the Jet Age/Wildlife Encounters/Bird Strikes

Bird strikes are a significant threat to flight safety, and have caused a number of accidents with human casualties. There are over 13,000 bird strikes annually in the US alone. However, the number of major accidents involving civil aircraft is quite low and it has been estimated that there is only about one accident resulting in human death in one billion flying hours. The majority of bird strikes (65%) cause little damage to the aircraft; however the collision is usually fatal to the bird(s) involved.

Most accidents occur when a bird collides with the windscreen or is sucked into the engine of a jet aircraft. Strikes to the propellers can also cause major problems. Bird strikes happen most often during takeoff or landing, or during low altitude flight. However, bird strikes have also been reported at high altitudes, some as high as 6,000 to 9,000m above the ground. For example, an aircraft over the Ivory Coast collided with a Rüppell's vulture at the altitude of 11,300m. The majority of bird collisions occur near or at airports (90%, according to the ICAO) during takeoff, landing and associated phases. According to the FAA wildlife hazard management manual for 2005, less than 8% of strikes occur above 900m and 61% occur at less than 30m.

The point of impact is usually any forward-facing edge of the vehicle such as a wing leading edge, nose cone, jet engine cowling or engine inlet.

Jet engine ingestion is extremely serious due to the rotation speed of the engine fan and engine design. As the bird strikes a fan blade, that blade can be displaced into another blade and so forth, causing a cascading failure. Jet engines are particularly vulnerable during the takeoff phase when the engine is turning at a very high speed and the plane is at a low altitude where birds are more commonly found.

The force of the impact on an aircraft depends on the weight of the animal and the speed difference and direction at the point of impact. The energy of the impact increases with the square of the speed difference. High-speed impacts, as with jet aircraft, can cause considerable damage and even catastrophic failure to the vehicle. The energy of a 5 kg bird moving at a relative velocity of 275 km/h approximately equals the energy of a 100 kg weight dropped from a height of 15 m. However, according to the FAA only 15% of strikes (ICAO 11%) actually result in damage to the aircraft.

Bird strikes can damage vehicle components, or injure passengers. Flocks of birds are especially dangerous and can lead to multiple strikes, with corresponding damage. Depending on the damage, aircraft at low altitudes or during take-off and landing often cannot recover in time.

Countermeasures
There are three approaches to reduce the effect of bird strikes. The vehicles can be designed to be more bird resistant, the birds can be moved out of the way of the vehicle, or the vehicle can be moved out of the way of the birds.

Vehicle design
Most large commercial jet engines include design features that ensure they can shut-down after "ingesting" a bird weighing up to 1.8 kg. The engine does not have to survive the ingestion, just be safely shut down. This is a 'stand-alone' requirement, i.e., the engine, not the aircraft, must pass the test. Multiple strikes (from hitting a bird flock) on twin-engine jet aircraft are very serious events because they can disable multiple aircraft systems, requiring emergency action to land the aircraft.

Modern jet aircraft structures must be able to withstand one 1.8 kg collision; the empennage (tail) must withstand one 3.6 kg bird collision. Cockpit windows on jet aircraft must be able to withstand one 1.8 kg bird collision without yielding or spalling.

At first, bird strike testing by manufacturers involved firing a bird carcass from a gas cannon and sabot system into the tested unit. The carcass was soon replaced with suitable density blocks, often gelatin, to ease testing. Current testing is mainly conducted with computer simulation, although final testing usually involves some physical experiments.

Flight path
Pilots should not take off or land in the presence of wildlife and should avoid migratory routes, wildlife reserves, estuaries and other sites where birds may congregate. When operating in the presence of bird flocks, pilots should seek to climb above 3000 ft as rapidly as possible as most bird strikes occur below 3000 ft. Additionally, pilots should slow down their aircraft when confronted with birds. The energy that must be dissipated in the collision is approximately the relative kinetic energy ($$E_{k}$$) of the bird, defined by the equation $$E_{k} = \frac{1}{2} m v^{2}$$ where $$m$$ is the mass of the bird and $$v$$ is the relative velocity (the difference of the velocities of the bird and the plane, resulting in a lower absolute value if they are flying in the same direction and higher absolute value if they are flying in opposite directions). Therefore, the speed of the aircraft is much more important than the size of the bird when it comes to reducing energy transfer in a collision. The same can be said for jet engines: the slower the rotation of the engine, the less energy which will be imparted onto the engine at collision.

The body density of the bird is also a parameter that influences the amount of damage caused.

The US Military Avian Hazard Advisory System (AHAS) uses near real-time data from the 148 CONUS based National Weather Service Next Generation Weather Radar (NEXRAD or WSR 88-D) system to provide current bird hazard conditions for published military low-level routes, ranges, and military operating areas (MOAs). Additionally, AHAS incorporates weather forecast data with the Bird Avoidance Model (BAM) to predict soaring bird activity within the next 24 hours and then defaults to the BAM for planning purposes when activity is scheduled outside the 24-hour window. The BAM is a static historical hazard model based on many years of bird distribution data from Christmas Bird Counts (CBC), Breeding Bird Surveys (BBS), and National Wildlife Refuge Data. The BAM also incorporates potentially hazardous bird attractions such as landfills and golf courses. AHAS is now an integral part of military low-level mission planning, aircrew being able to access the current bird hazard conditions. AHAS will provide relative risk assessments for the planned mission and give aircrew the opportunity to select a less hazardous route should the planned route be rated severe or moderate. Prior to 2003, the US Air Force BASH Team bird strike database indicated that approximately 25% of all strikes were associated with low-level routes and bombing ranges. More importantly, these strikes accounted for more than 50% of all of the reported damage costs. After a decade of using AHAS for avoiding routes with severe ratings, the strike percentage associated with low-level flight operations has been reduced to 12% and associated costs cut in half.

Avian radar is an important tool for aiding in bird strike mitigation as part of overall safety management systems at civilian and military airfields. Properly designed and equipped avian radars can track thousands of birds simultaneously in real-time, night and day, through 360° of coverage, out to ranges of 10 km and beyond for flocks, updating every target's position (longitude, latitude, altitude), speed, heading, and size every 2–3 seconds. Data from these systems can be used to generate information products ranging from real-time threat alerts to historical analyses of bird activity patterns in both time and space. The United States Federal Aviation Administration (FAA) and the United States Department of Defense (DOD) have conducted extensive science-based field testing and validation of commercial avian radar systems for civil and military applications, respectively. The FAA used evaluations of commercial 3D avian radar systems developed and marketed by Accipiter Radar as the basis for FAA Advisory Circular 150/5220-25 and a guidance letter on using Airport Improvement Program funds to acquire avian radar systems at Part 139 airports. Similarly, the DOD-sponsored Integration and Validation of Avian Radars (IVAR) project evaluated the functional and performance characteristics of Accipiter® avian radars under operational conditions at Navy, Marine Corps, and Air Force airfields. Accipiter avian radar systems operating at Seattle-Tacoma International Airport, Chicago O'Hare International Airport, and Marine Corps Air Station Cherry Point made significant contributions to the evaluations carried out in the aforementioned FAA and DoD initiatives. Additional scientific and technical papers on avian radar systems are listed below,  and on the Accipiter Radar web site.

A US company, DeTect, in 2003, developed the only production model bird radar in operational use for real-time, tactical bird-aircraft strike avoidance by air traffic controllers. These systems are operational at both commercial airports and military airfields. The system has widely used technology available for bird–aircraft strike hazard (BASH) management and for real-time detection, tracking and alerting of hazardous bird activity at commercial airports, military airfields, and military training and bombing ranges. After extensive evaluation and on-site testing, MERLIN technology was chosen by NASA and was ultimately used for detecting and tracking dangerous vulture activity during the 22 space shuttle launches from 2006 to the conclusion of the program in 2011. The US Air Force has contracted DeTect since 2003 to provide the Avian Hazard Advisory System (AHAS)previously mentioned.


text:
User:Docknato

To Read:

 * Read Communication Theory
 * Read Using Wikibooks starting at Using Wikibooks/How To Edit A Wikibook
 * Explore https://tamu.libguides.com/falsenews

To Edit:

 * Film History - (Start from scratch basically)
 * Communication Theory

 * 1) Communication Theory/Uncertainty Reduction: Charles Berger, Richard Calabrese
 * 2) Communication Theory/Propaganda and the Public: Walter Lippmann, Harold D. Lasswell, Edward Bernays, and Jacques Ellul
 * 3) Communication Theory/Uses and Gratifications: Herzog, Katz, and friends - (Update the section "Uses and Gratifications Research in a New Era" to include social media, otherwise it doesn't really cover a "new era").
 * 4) Communication Theory/The Frankfurt School: Max Horkheimer and Theodor Adorno
 * 5) Habermas Commentary
 * 6) Communication Theory/Semiotics and Myth: Roland Barthes
 * 7) Communication Theory/Orality and Literacy: Walter Ong
 * 8) Communication Theory/Diffusion of Innovations: Gabriel Tarde, Everett Rogers
 * 9) Communication Theory/Social Systems: Niklas Luhmann
 * 10) Communication Theory/Network Society: Manuel Castells
 * 11) Communication Theory/Nonverbal Communication

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

title: User:Docknato


text:
User talk:Gifnk dlm 2020

Welcome, Gifnk dlm 2020!

If you have any questions, you can ask in the assistance reading room or possibly contact me personally. —Justin ( koavf ) ❤T☮C☺M☯ 10:47, 6 February 2021 (UTC)

Question
Hi there, thanks for all your input to the recent discussions. I was just wondering: are you thinking about creating a Minecraft book? -- Jules (Mrjulesd) 18:12, 16 March 2021 (UTC)
 * , yes. There’s more than enough content for many Minecraft books. Also, most of the games that I have are for my XBox also uploading screenshots will take a bit longer. Also, I think it makes sense to use as examples popular games because those are the ones people are most likely to want to write about (so to make sure the policy works out properly). -Gifnk dlm 2020 (discuss • contribs) 18:45, 16 March 2021 (UTC)
 * Cool. I think obviously the main trouble will be with images. Now if you have questions about image copyright a good place to ask will be c:Commons:Village pump/Copyright. Now if your images can't be hosted at Commons, you may still be able to host them here; we are currently debating the rules at Reading room/Proposals if you care to take a look. -- Jules (Mrjulesd) 19:15, 16 March 2021 (UTC)

minecraft pictures
Could you add the minecraft pictures? I think they are put under fair use. Pizza0614 (discuss • contribs) 16:11, 15 April 2021 (UTC)
 * , I also think that they are fair use but from what I understand, in the past the rules in English Wikibooks about fair use were very strict (it was legal, but against Wikibooks policies) but recently there was a discussion and they decided to make it less strict. I haven’t followed the discussion so it’s better to ask in the reading room (I think general). Also, fair use must be uploaded to Wikibooks, not to commons, and to do this you either need to have uploader rights or ask someone who has, but I’m not sure were I should upload them for the uploaders to see. -Gifnk dlm 2020 (discuss • contribs) 17:01, 15 April 2021 (UTC)
 * If you need to upload fair-use pictures, please apply at WB:RFP for uploader rights. It is fine to upload fair-use pictures for your books, but please comply with WB:FU. If you need any further explanation please ask. -- Jules (Mrjulesd) 17:11, 15 April 2021 (UTC)

Would you like to add pictures to Minecraft resource gathering?
A question for you: would you like to add pictures to Minecraft resource gathering?

If you would, I can give you uploader rights, and you can locally upload fair use images to Wikibooks; they can then be used for your book. -- Jules (Mrjulesd) 10:04, 17 April 2021 (UTC)
 * , I would like to upload images, but right now I’m a bit busy so I don’t think I will be able to make screenshots and upload them in the near future. Also, I think it would be better to first finish writing all the content and then make screenshots that are related. -Gifnk dlm 2020 (discuss • contribs) 11:46, 17 April 2021 (UTC)
 * OK I've decided to give you uploader rights as you might need it in the future. If you need to locally upload non-free media, see the directions at WB:UPLOAD; freely licensed and public domain images should be uploaded to Commons instead. Screenshots of Minecraft will probably be non-free media. The criteria for uploading is at WB:FU; if you've got any questions please ask me. And thanks again for all your input at the recent proposals. -- Jules (Mrjulesd) 14:12, 17 April 2021 (UTC)
 * , cool! Thank you very much! -Gifnk dlm 2020 (discuss • contribs) 15:46, 17 April 2021 (UTC)
 * Btw, am I an uploader permanently or will this permission expire eventually? Thanks in advance, -Gifnk dlm 2020 (discuss • contribs) 15:50, 17 April 2021 (UTC)
 * There is no expiry date at this time. Leaderboard (discuss • contribs) 15:53, 17 April 2021 (UTC)
 * , cool! Thank you very much! -Gifnk dlm 2020 (discuss • contribs) 15:55, 17 April 2021 (UTC)

Issue with your editing
Evidence indicates that you are behind the account Your favorite emperor which has been indefinitely blocked for making harassing edits. Rather than just blocking you immediately, I'm giving you the opportunity to explain first. QuiteUnusual (discuss • contribs) 14:45, 15 October 2021 (UTC)
 * @QuiteUnusual I've just posted to SRG already, but you still might have more knowledge of this abuser: Given Steward requests/Checkuser/2021-10 and the similar "Columbus" edits, I am pretty sure that Special:CentralAuth/C64 is the best computer can be safely locked as a sock of the "Your favorite emperor" account now as well. 𝟙𝟤𝟯𝟺𝐪𝑤𝒆𝓇𝟷𝟮𝟥𝟜𝓺𝔴𝕖𝖗𝟰 (𝗍𝗮𝘭𝙠) 14:06, 16 October 2021 (UTC)
 * Please respond to this being behind the account Your favorite emperor which has been indefinitely blocked for making harassing edits. 96.18.219.55 (discuss) 15:02, 10 January 2022 (UTC)
 * See incubator:Talk:Wp/enm/Mayne Page, I suppose. 𝟙𝟤𝟯𝟺𝐪𝑤𝒆𝓇𝟷𝟮𝟥𝟜𝓺𝔴𝕖𝖗𝟰 (𝗍𝗮𝘭𝙠) 22:44, 11 January 2022 (UTC)

Reviewer
𝟙𝟤𝟯𝟺𝐪𝑤𝒆𝓇𝟷𝟮𝟥𝟜𝓺𝔴𝕖𝖗𝟰 (𝗍𝗮𝘭𝙠) 13:28, 22 October 2021 (UTC)

I am going to nominate you for admin.
Do you accept? T. Gregtregretgtr (discuss • contribs) 21:30, 12 January 2022 (UTC)

 * , I’m not interested in becoming an admin. Thanks anyways. -Gifnk dlm 2020 Happy New Year 🎄❄⛄🎇 (talk) 09:02, 13 January 2022 (UTC)

You welcomed a banned user.
Just wanted to let you know. T. Gregtregretgtr (discuss • contribs) 17:35, 4 February 2022 (UTC)

 * , just curious to know, which user is that? I just welcomed all users in Special:RecentChanges, with filtering to show only new editors who don’t have a talk page. -Gifnk dlm 2020 From Middle English Wikipedia 📜📖💻 (talk) 18:14, 4 February 2022 (UTC)
 * User:Tok_Pisin_Minecrafter. T. Gregtregretgtr (discuss • contribs) 18:29, 4 February 2022 (UTC)

 * , actually about this user I saw he was banned. I think I saw that 3 days after welcoming me, and if I’m not mistaken I welcomed him before he was banned. Could be wrong. -Gifnk dlm 2020 From Middle English Wikipedia 📜📖💻 (talk) 19:34, 4 February 2022 (UTC)
 * Don't think they were banned, just locked, but the comment "Lock evasion: PhrasebookMasterBot" suggests that their master account was locked on 10 January. 𝟙𝟤𝟯𝟺𝐪𝑤𝒆𝓇𝟷𝟮𝟥𝟜𝓺𝔴𝕖𝖗𝟰 (𝗍𝗮𝘭𝙠) 11:40, 5 February 2022 (UTC)

 * , what’s the difference between a banned account and a locked one? -Gifnk dlm 2020 From Middle English Wikipedia 📜📖💻 (talk) 12:02, 5 February 2022 (UTC)
 * w:WP:BLOCKBANDIFF, pretty much, with the global equivalent of a ban being a global ban and the global equivalent of a block being a (global) lock (which additionally disables the ability to log in to the account). 𝟙𝟤𝟯𝟺𝐪𝑤𝒆𝓇𝟷𝟮𝟥𝟜𝓺𝔴𝕖𝖗𝟰 (𝗍𝗮𝘭𝙠) 12:06, 5 February 2022 (UTC)

Hey.
You should use edit summaries more often. Also, all that "CheckUser" stuff, I saw a talk page post without doing any more resaerch. Also,the admin request, it was so this wiki can be better. T. Gregtregretgtr (discuss • contribs) 17:41, 5 February 2022 (UTC)

 * , ok I will. I refused the admin request because I don’t think I will use any of the admin privileges. I’m not mad on you for submitting it twice. -Gifnk dlm 2020 From Middle English Wikipedia 📜📖💻 (talk) 18:00, 5 February 2022 (UTC)
 * Thanks, because admins are saying I'm a troll. Thanks for apologizing. T. Gregtregretgtr (discuss • contribs) 18:02, 5 February 2022 (UTC)

title: User talk:Gifnk dlm 2020


text: Chinese (Mandarin)/Places

title: Chinese (Mandarin)/Places


text: Chinese (Mandarin)/Geology

title: Chinese (Mandarin)/Geology


text: Chinese (Mandarin)/Toys

title: Chinese (Mandarin)/Toys


text:
Applied Programming/Loops

Overview
This lesson introduces loops, including while, for, do and other loops. Loops allow you to repeat similar operations in your code. A loop executes a block of code until the loop has iterated over an object. In a for loop, as will be further explained, the loop runs until it has iterated over every item in an iterable. For loops help you reduce repetition in your code because they let you execute the same operation multiple times. All loops are sequences of instructions designed to be repeated until a certain condition is met or achieved. Loops only need to be written once but may repeat multiple times over. Because of this, they are used to do certain tasks multiple times based on the program's task, avoiding having to create extra, unnecessary steps in a program.

What are loops:
Loops are a fundamental construct for many programs. In fact, all but the most basic of programs are likely to include at least one loop in them. Loops can be very useful and can save you, the developer, a lot of time.

We can elaborate on the time-saving part. Let's consider a situation when you want to print Hello, World! five times. Output: Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! It was simple, but again, let's consider another situation when you want to write Hello, World! a thousand times. We can certainly not write print statements a thousand times. Almost all the programming languages provide a concept called loop, which helps in executing one or more statements up to a desired number of times. All high-level programming languages provide various forms of loops, which can be used to execute one or more statements repeatedly.

Loop Structure:
They allow you to run one or more lines of code repetitively. You can repeat the statements in a loop structure until a condition is True, until a condition is False, a specified number of times, or once for each element in a collection.

The following fall under the Loop Structure:
 * While Loop
 * Do-While Loop
 * For Loop
 * Break Statement
 * Continue Statement

For loop:
It enables a particular set of conditions to be executed repeatedly until a condition is satisfied. Below is a following example of a For Loop: The Python for statement iterates over the members of a sequence in order, executing the block each time. They are traditionally used when you have a block of code which you want to repeat a fixed number of times.

While loop:
While loops are implemented when there is specific condition to satisfy or to follow. The while loop can be terminated whenever the conditional statement is not satisfied. In other words, when the while loop's test expression becomes false, the code inside of the while loop is neglected, and the following code is executed immediately. Another way to implement the while loop is control the number of repetitions. The repetition of the while can be determined with control variable. The output gives the following results: Welcome to CIS206 Welcome to CIS206 Welcome to CIS206 Welcome to CIS206 Welcome to CIS206 In the while loop operation, there are two distinguished control expressions: "break" and "continue." The use of either break or continue allow more than one conditional statements inside the while loop. break terminates while loop immediately. continue shifts to the alternative conditional statement as long as original while loop's conditional statement is True.

Do-while loop:
Do-while has distinctive difference from the regular while loop. The difference is that the Do-while is executed at least once. Do-while loop is initiated with conditional statement(s).

Infinite loop:
An infinite loop (sometimes called an endless loop ) is a piece of coding that lacks a functional exit so that it repeats indefinitely. Typically, a certain process is done, such as getting an item of data and changing it, and then some condition is checked, such as whether a counter has reached a prescribed number. If the presence of the specified condition cannot be ascertained, the next instruction in the sequence tells the program to return to the first instruction and repeat the sequence, which typically goes on until the program terminates automatically after a certain duration of time, or the operating system terminates the program with an error.

In most cases, infinite loops are unintentional and the result of poor programming. However, there are situations in which infinite loops can be used intentionally. The most common occurrence of this is with the modern computer. Modern interactive computers require that the computer constantly be monitoring for user input or device activity, so at some fundamental level there is an infinite processing idle loop that must continue until the device is turned off or reset.

Examples:
You have 4 apples. You have 5 apples. You have 6 apples. You have 7 apples. You have 8 apples. ... In the example above, the loop is intended to break when the number of apples is at or below three. However, the variable "apples" starts at four. With each iteration of the loop, "apples" increases by one. In this case, "apples" will never fall to zero, and the loop repeats infinitely. This statement is true This statement is true This statement is true This statement is true ... In this example, the programmer has failed to create a break statement to exit the loop. Because there is no break statement or any code that would cause the loop to be "false", the loop repeats infinitely.

Nested loop:
A nested loop occurs when one loop is placed inside the body of another loop. The inside loop is executed each time the outer loop is executed.

Examples
1, 5   2 , 6    3 , 7

The function above contains two "while" loops; one nested within the other. The outer loop is executed first with "i" being less than four. This causes the internal loop to execute with "j" being less than 8. The function then breaks when "i" is no longer less than 4; on the fourth iteration.

Loop keywords:
Break Statement - This statement terminates the loop containing it. Control of the program flows to the statement immediately after the body of the loop. If the statement is inside a nested loop (loop inside another loop), the statement will terminate the innermost loop.

Condition - This statement a loop checks in order to decide if it should loop again or stop looping.. It's a set of rules performed if a certain condition is met. It is sometimes referred to as an If-Then statement, because IF a condition is met, THEN an action is performed.

Continue Statement - This statement is used inside loops. When the statement is encountered inside a loop, control jumps to the beginning of the loop for next iteration, skipping the execution of statements inside the body of loop for the current iteration.

Counting controlled - A loop where a variable (such as a counter) determines how many times a loop will run.

Do-While Loop - A do-while loop is a control flow statement that executes a block of code at least once, and then repeatedly executes the block, or not, depending on a given boolean condition at the end of the block.

Exit - A predefined function used to prematurely stop a program and return to the operating system. It is used to finish or exit the execution of an enclosing loop statement. If the statement includes a condition, then the exit from the loop is conditional. .

Flag - Commonly used to control or to indicate the intermediate state or outcome of a particular operation. It is the value that acts as a signal for a function or process. The value is used to determine the next step of a program

For Loop - A for loop is a control flow statement for specifying iteration, which allows code to be executed repeatedly. A for loop has two parts: a header specifying the iteration, and a body which is executed once per iteration.

For each Loop - For each (or foreach, sometimes called an iterative for-loop) is a control flow statement for traversing items in a collection.

Goto - An unstructured branching command that makes the logic in a program jump to a different location

Infinite Loop (or Endless Loop) - A sequence of instructions in a computer program which loops endlessly, either due to the loop having no terminating condition or having one that can never be met.

Iteration Control Structure - A statement or block that is executed until the program reaches a certain state, or operations have been applied to every element of a collection or array.

Loop Counters - Variable that controls the iterations of a loop (a computer programming language construct). It is named because most uses of this construct result in the variable taking on a range of integer values in some orderly sequences.

Nested Loop - A loop within a loop. The inner loop will repeat depending on the number of iterations in the outer loop.

Pass Statement - This statement is used as a placeholder for future code. When the statement is executed, nothing happens; but you avoid getting an error when empty code is not allowed.

Raise - This keyword is used to raise an exception. You can define what kind of error to raise, and the text to print to the user.

Return - A branching statement that causes a function to jump back to the function that called it. Allowing it to be also used as a way to break out of a loop. A return statement returns occasional results from a function or simply finishes a function. There is an implicit return at the end of any function, so you do not need to use one if your function ends naturally, without returning any value.

Sentinel value - It's a special value in the context of an algorithm which uses its presence as a condition of termination, typically in a loop or recursive algorithm. The value is a form of in-band data that makes it possible to detect the end of the data when no out-of-band data (such as an explicit size indication) is provided.

While Loop - A while loop is a control flow statement that allows code to be executed repeatedly based on a given boolean condition.

title: Applied Programming/Loops


text:
Oberon/V2/Compiler

MODULE Compiler; (*NW 7.6.87 / 16.3.91*) IMPORT Texts, Files, TextFrames, Viewers, Oberon, OCS, OCT, OCC, OCE, OCH; CONST NofCases = 128; MaxEntry = 64; ModNameLen = 20; RecDescSize = 8; AdrSize = 4; ProcSize = 4; PtrSize = 4; XParOrg = 12; LParOrg = 8; LDataSize = 2000H; (*symbol values*) times = 1; slash = 2; div = 3; mod = 4; and = 5; plus = 6; minus = 7; or = 8; eql = 9; neq = 10; lss = 11; leq = 12; gtr = 13; geq = 14; in = 15; is = 16; arrow = 17; period = 18; comma = 19; colon = 20; upto = 21; rparen = 22; rbrak = 23; rbrace = 24; of = 25; then = 26; do = 27; to = 28; lparen = 29; lbrak = 30; lbrace = 31; not = 32; becomes = 33; number = 34; nil = 35; string = 36; ident = 37; semicolon = 38; bar = 39; end = 40; else = 41; elsif = 42; until = 43; if = 44; case = 45; while = 46; repeat = 47; loop = 48; with = 49; exit = 50; return = 51; array = 52; record = 53; pointer = 54; begin = 55; const = 56; type = 57; var = 58; procedure = 59; import = 60; module = 61; (*object and item modes*) Var = 1; Ind = 3; Con = 8; Fld = 12; Typ = 13; LProc = 14; XProc = 15; SProc = 16; CProc = 17; IProc = 18; Mod = 19; (*structure forms*) Undef = 0; Pointer = 13; ProcTyp = 14; Array = 15; DynArr = 16; Record = 17; intSet = {4 .. 6}; labeltyps = {3 .. 6}; 	VAR W: Texts.Writer; sym, entno: INTEGER; newSF: BOOLEAN; LoopLevel, ExitNo: INTEGER; LoopExit: ARRAY 16 OF INTEGER; PROCEDURE^ Type(VAR typ: OCT.Struct); PROCEDURE^ FormalType(VAR typ: OCT.Struct); PROCEDURE^ Expression(VAR x: OCT.Item); PROCEDURE^ Block(VAR dsize: LONGINT); PROCEDURE CheckSym(s: INTEGER); BEGIN IF sym = s THEN OCS.Get(sym) ELSE OCS.Mark(s) END END CheckSym; PROCEDURE qualident(VAR x: OCT.Item); VAR mnolev: INTEGER; obj: OCT.Object; BEGIN (*sym = ident*) OCT.Find(obj, mnolev); OCS.Get(sym); IF (sym = period) & (obj # NIL) & (obj.mode = Mod) THEN OCS.Get(sym); mnolev := SHORT(-obj.a0); IF sym = ident THEN OCT.FindImport(obj, obj); OCS.Get(sym) ELSE OCS.Mark(10); obj := NIL END END ; x.lev := mnolev; x.obj := obj; IF obj # NIL THEN x.mode := obj.mode; x.typ := obj.typ; x.a0 := obj.a0; x.a1 := obj.a1 		ELSE OCS.Mark(0); x.mode := Var; x.typ := OCT.undftyp; x.a0 := 0; x.obj := NIL END END qualident; PROCEDURE ConstExpression(VAR x: OCT.Item); BEGIN Expression(x); IF x.mode # Con THEN OCS.Mark(50); x.mode := Con; x.typ := OCT.inttyp; x.a0 := 1 END END ConstExpression; PROCEDURE NewStr(form: INTEGER): OCT.Struct; VAR typ: OCT.Struct; BEGIN NEW(typ); typ.form := form; typ.mno := 0; typ.size := 4; typ.ref := 0; typ.BaseTyp := OCT.undftyp; typ.strobj := NIL; RETURN typ END NewStr; PROCEDURE CheckMark(VAR mk: BOOLEAN); BEGIN OCS.Get(sym); IF sym = times THEN IF OCC.level = 0 THEN mk := TRUE ELSE mk := FALSE; OCS.Mark(47) END ; OCS.Get(sym) ELSE mk := FALSE END END CheckMark; PROCEDURE CheckUndefPointerTypes; VAR obj: OCT.Object; BEGIN obj := OCT.topScope.next; WHILE obj # NIL DO 			IF obj.mode = Undef THEN OCS.Mark(48) END ; obj := obj.next END END CheckUndefPointerTypes; PROCEDURE RecordType(VAR typ: OCT.Struct); VAR adr, size: LONGINT; fld, fld0, fld1: OCT.Object; ftyp, btyp: OCT.Struct; base: OCT.Item; BEGIN adr := 0; typ := NewStr(Record); typ.BaseTyp := NIL; typ.n := 0; IF sym = lparen THEN OCS.Get(sym); (*record extension*) IF sym = ident THEN qualident(base); IF (base.mode = Typ) & (base.typ.form = Record) THEN typ.BaseTyp := base.typ; typ.n := base.typ.n + 1; adr := base.typ.size ELSE OCS.Mark(52) END ELSE OCS.Mark(10) END ; CheckSym(rparen) END ; OCT.OpenScope(0); fld := NIL; fld1 := OCT.topScope; LOOP IF sym = ident THEN LOOP IF sym = ident THEN IF typ.BaseTyp # NIL THEN OCT.FindField(typ.BaseTyp, fld0); IF fld0 # NIL THEN OCS.Mark(1) END END ; OCT.Insert(OCS.name, fld); CheckMark(fld.marked); fld.mode := Fld ELSE OCS.Mark(10) END ; IF sym = comma THEN OCS.Get(sym) ELSIF sym = ident THEN OCS.Mark(19) ELSE EXIT END END ; CheckSym(colon); Type(ftyp); size := ftyp.size; btyp := ftyp; WHILE btyp.form = Array DO btyp := btyp.BaseTyp END ; IF btyp.size >= 4 THEN INC(adr, (-adr) MOD 4) ELSIF btyp.size = 2 THEN INC(adr, adr MOD 2) END ; WHILE fld1.next # NIL DO 					fld1 := fld1.next; fld1.typ := ftyp; fld1.a0 := adr; INC(adr, size) END END ; IF sym = semicolon THEN OCS.Get(sym) ELSIF sym = ident THEN OCS.Mark(38) ELSE EXIT END END ; typ.size := (-adr) MOD 4 + adr; typ.link := OCT.topScope.next; CheckUndefPointerTypes; OCT.CloseScope END RecordType; PROCEDURE ArrayType(VAR typ: OCT.Struct); VAR x: OCT.Item; f, n: INTEGER; BEGIN typ := NewStr(Array); ConstExpression(x); f := x.typ.form; IF f IN intSet THEN IF (x.a0 > 0) & (x.a0 <= MAX(INTEGER)) THEN n := SHORT(x.a0) ELSE n := 1; OCS.Mark(63) END ELSE OCS.Mark(51); n := 1 END ; typ.n := n; OCC.AllocBounds(0, n-1, typ.adr); IF sym = of THEN OCS.Get(sym); Type(typ.BaseTyp) ELSIF sym = comma THEN OCS.Get(sym); ArrayType(typ.BaseTyp) ELSE OCS.Mark(34) END ; typ.size := n * typ.BaseTyp.size END ArrayType; PROCEDURE FormalParameters(VAR resTyp: OCT.Struct; VAR psize: LONGINT); VAR mode: SHORTINT; adr, size: LONGINT; res: OCT.Item; par, par1: OCT.Object; typ: OCT.Struct; BEGIN par1 := OCT.topScope; adr := 0; IF (sym = ident) OR (sym = var) THEN LOOP IF sym = var THEN OCS.Get(sym); mode := Ind ELSE mode := Var END ; LOOP IF sym = ident THEN OCT.Insert(OCS.name, par); OCS.Get(sym); par.mode := mode ELSE OCS.Mark(10) END ; IF sym = comma THEN OCS.Get(sym) ELSIF sym = ident THEN OCS.Mark(19) ELSIF sym = var THEN OCS.Mark(19); OCS.Get(sym) ELSE EXIT END END ; CheckSym(colon); FormalType(typ); IF mode = Ind THEN (*VAR param*) IF typ.form = Record THEN size := RecDescSize ELSIF typ.form = DynArr THEN size := typ.size ELSE size := AdrSize END ELSE size := (-typ.size) MOD 4 + typ.size END ; WHILE par1.next # NIL DO 					par1 := par1.next; par1.typ := typ; DEC(adr, size); par1.a0 := adr END ; IF sym = semicolon THEN OCS.Get(sym) ELSIF sym = ident THEN OCS.Mark(38) ELSE EXIT END END END ; psize := psize - adr; par := OCT.topScope.next; WHILE par # NIL DO INC(par.a0, psize); par := par.next END ; CheckSym(rparen); IF sym = colon THEN OCS.Get(sym); resTyp := OCT.undftyp; IF sym = ident THEN qualident(res); IF res.mode = Typ THEN IF res.typ.form <= ProcTyp THEN resTyp := res.typ ELSE OCS.Mark(54) END ELSE OCS.Mark(52) END ELSE OCS.Mark(10) END ELSE resTyp := OCT.notyp END END FormalParameters; PROCEDURE ProcType(VAR typ: OCT.Struct); VAR psize: LONGINT; BEGIN typ := NewStr(ProcTyp); typ.size := ProcSize; IF sym = lparen THEN OCS.Get(sym); OCT.OpenScope(OCC.level); psize := XParOrg; FormalParameters(typ.BaseTyp, psize); typ.link := OCT.topScope.next; OCT.CloseScope ELSE typ.BaseTyp := OCT.notyp; typ.link := NIL END END ProcType; PROCEDURE HasPtr(typ: OCT.Struct): BOOLEAN; VAR fld: OCT.Object; BEGIN IF typ.form = Pointer THEN RETURN TRUE ELSIF typ.form = Array THEN RETURN HasPtr(typ.BaseTyp) ELSIF typ.form = Record THEN IF (typ.BaseTyp # NIL) & HasPtr(typ.BaseTyp) THEN RETURN TRUE END ; fld := typ.link; WHILE fld # NIL DO 				IF (fld.name = "") OR HasPtr(fld.typ) THEN RETURN TRUE END ; fld := fld.next END END ; RETURN FALSE END HasPtr; PROCEDURE SetPtrBase(ptyp, btyp: OCT.Struct); BEGIN IF (btyp.form = Record) OR (btyp.form = Array) & ~HasPtr(btyp.BaseTyp) THEN ptyp.BaseTyp := btyp ELSE ptyp.BaseTyp := OCT.undftyp; OCS.Mark(57) END END SetPtrBase; PROCEDURE Type(VAR typ: OCT.Struct); VAR lev: INTEGER; obj: OCT.Object; x: OCT.Item; BEGIN typ := OCT.undftyp; IF sym < lparen THEN OCS.Mark(12); REPEAT OCS.Get(sym) UNTIL sym >= lparen END ; IF sym = ident THEN qualident(x); IF x.mode = Typ THEN typ := x.typ; IF typ = OCT.notyp THEN OCS.Mark(58) END ELSE OCS.Mark(52) END ELSIF sym = array THEN OCS.Get(sym); ArrayType(typ) ELSIF sym = record THEN OCS.Get(sym); RecordType(typ); OCC.AllocTypDesc(typ); CheckSym(end) ELSIF sym = pointer THEN OCS.Get(sym); typ := NewStr(Pointer); typ.link := NIL; typ.size := PtrSize; CheckSym(to); IF sym = ident THEN OCT.Find(obj, lev); IF obj = NIL THEN (*forward ref*) OCT.Insert(OCS.name, obj); typ.BaseTyp := OCT.undftyp; obj.mode := Undef; obj.typ := typ; OCS.Get(sym) ELSE qualident(x); IF x.mode = Typ THEN SetPtrBase(typ, x.typ) ELSE typ.BaseTyp := OCT.undftyp; OCS.Mark(52) END END ELSE Type(x.typ); SetPtrBase(typ, x.typ) END ELSIF sym = procedure THEN OCS.Get(sym); ProcType(typ) ELSE OCS.Mark(12) END ; IF (sym < semicolon) OR (else < sym) THEN OCS.Mark(15); WHILE (sym < ident) OR (else < sym) & (sym < begin) DO 				OCS.Get(sym) END END END Type; PROCEDURE FormalType(VAR typ: OCT.Struct); VAR x: OCT.Item; typ0: OCT.Struct; a, s: LONGINT; BEGIN typ := OCT.undftyp; a := 0; WHILE sym = array DO 			OCS.Get(sym); CheckSym(of); INC(a, 4) END ; IF sym = ident THEN qualident(x); IF x.mode = Typ THEN typ := x.typ; IF typ = OCT.notyp THEN OCS.Mark(58) END ELSE OCS.Mark(52) END ELSIF sym = procedure THEN OCS.Get(sym); ProcType(typ) ELSE OCS.Mark(10) END ; s := a + 8; WHILE a > 0 DO 			typ0 := NewStr(DynArr); typ0.BaseTyp := typ; typ0.size := s-a; typ0.adr := typ0.size-4; typ0.mno := 0; typ := typ0; DEC(a, 4) END END FormalType; PROCEDURE selector(VAR x: OCT.Item); VAR fld: OCT.Object; y: OCT.Item; BEGIN LOOP IF sym = lbrak THEN OCS.Get(sym); LOOP IF (x.typ # NIL) & (x.typ.form = Pointer) THEN OCE.DeRef(x) END ; Expression(y); OCE.Index(x, y); IF sym = comma THEN OCS.Get(sym) ELSE EXIT END END ; CheckSym(rbrak) ELSIF sym = period THEN OCS.Get(sym); IF sym = ident THEN IF x.typ # NIL THEN IF x.typ.form = Pointer THEN OCE.DeRef(x) END ; IF x.typ.form = Record THEN OCT.FindField(x.typ, fld); OCE.Field(x, fld) ELSE OCS.Mark(53) END ELSE OCS.Mark(52) END ; OCS.Get(sym) ELSE OCS.Mark(10) END ELSIF sym = arrow THEN OCS.Get(sym); OCE.DeRef(x) ELSIF (sym = lparen) & (x.mode < Typ) & (x.typ.form # ProcTyp) THEN OCS.Get(sym); IF sym = ident THEN qualident(y); IF y.mode = Typ THEN OCE.TypTest(x, y, FALSE) ELSE OCS.Mark(52) END ELSE OCS.Mark(10) END ; CheckSym(rparen) ELSE EXIT END END END selector; PROCEDURE IsParam(obj: OCT.Object): BOOLEAN; BEGIN RETURN (obj # NIL) & (obj.mode <= Ind) & (obj.a0 > 0) END IsParam; PROCEDURE ActualParameters(VAR x: OCT.Item; fpar: OCT.Object); VAR apar: OCT.Item; R: SET; BEGIN IF sym # rparen THEN R := OCC.RegSet; LOOP Expression(apar); IF IsParam(fpar) THEN OCH.Param(apar, fpar); fpar := fpar.next ELSE OCS.Mark(64) END ; OCC.FreeRegs(R); IF sym = comma THEN OCS.Get(sym) ELSIF (lparen <= sym) & (sym <= ident) THEN OCS.Mark(19) ELSE EXIT END END END ; IF IsParam(fpar) THEN OCS.Mark(65) END END ActualParameters; PROCEDURE StandProcCall(VAR x: OCT.Item); VAR y: OCT.Item; m, n: INTEGER; BEGIN m := SHORT(x.a0); n := 0; IF sym = lparen THEN OCS.Get(sym); IF sym # rparen THEN LOOP IF n = 0 THEN Expression(x); OCE.StPar1(x, m); n := 1 ELSIF n = 1 THEN Expression(y); OCE.StPar2(x, y, m); n := 2 ELSIF n = 2 THEN Expression(y); OCE.StPar3(x, y, m); n := 3 ELSE OCS.Mark(64); Expression(y) END ; IF sym = comma THEN OCS.Get(sym) ELSIF (lparen <= sym) & (sym <= ident) THEN OCS.Mark(19) ELSE EXIT END END ; CheckSym(rparen) ELSE OCS.Get(sym) END ; OCE.StFct(x, m, n) 		ELSE OCS.Mark(29) END END StandProcCall; PROCEDURE Element(VAR x: OCT.Item); VAR e1, e2: OCT.Item; BEGIN Expression(e1); IF sym = upto THEN OCS.Get(sym); Expression(e2); OCE.Set1(x, e1, e2) ELSE OCE.Set0(x, e1) END ; END Element; PROCEDURE Sets(VAR x: OCT.Item); VAR y: OCT.Item; BEGIN x.typ := OCT.settyp; y.typ := OCT.settyp; IF sym # rbrace THEN Element(x); LOOP IF sym = comma THEN OCS.Get(sym) ELSIF (lparen <= sym) & (sym <= ident) THEN OCS.Mark(19) ELSE EXIT END ; Element(y); OCE.Op(plus, x, y) (*x := x+y*) END ELSE x.mode := Con; x.a0 := 0 END ; CheckSym(rbrace) END Sets; PROCEDURE Factor(VAR x: OCT.Item); VAR fpar: OCT.Object; gR, fR: SET; BEGIN IF sym < lparen THEN OCS.Mark(13); REPEAT OCS.Get(sym) UNTIL sym >= lparen END ; IF sym = ident THEN qualident(x); selector(x); IF x.mode = SProc THEN StandProcCall(x) ELSIF sym = lparen THEN OCS.Get(sym); OCH.PrepCall(x, fpar); OCC.SaveRegisters(gR, fR, x); ActualParameters(x, fpar); OCH.Call(x); OCC.RestoreRegisters(gR, fR, x); CheckSym(rparen) END ELSIF sym = number THEN OCS.Get(sym); x.mode := Con; CASE OCS.numtyp OF 				1: x.typ := OCT.chartyp; x.a0 := OCS.intval | 2: x.a0 := OCS.intval; OCE.SetIntType(x) | 3: x.typ := OCT.realtyp; OCE.AssReal(x, OCS.realval) | 4: x.typ := OCT.lrltyp; OCE.AssLReal(x, OCS.lrlval) END ELSIF sym = string THEN x.typ := OCT.stringtyp; x.mode := Con; OCC.AllocString(OCS.name, x); OCS.Get(sym) ELSIF sym = nil THEN OCS.Get(sym); x.typ := OCT.niltyp; x.mode := Con; x.a0 := 0 ELSIF sym = lparen THEN OCS.Get(sym); Expression(x); CheckSym(rparen) ELSIF sym = lbrak THEN OCS.Get(sym); OCS.Mark(29); Expression(x); CheckSym(rparen) ELSIF sym = lbrace THEN OCS.Get(sym); Sets(x) ELSIF sym = not THEN OCS.Get(sym); Factor(x); OCE.MOp(not, x) 		ELSE OCS.Mark(13); OCS.Get(sym); x.typ := OCT.undftyp; x.mode := Var; x.a0 := 0 END END Factor; PROCEDURE Term(VAR x: OCT.Item); VAR y: OCT.Item; mulop: INTEGER; BEGIN Factor(x); WHILE (times <= sym) & (sym <= and) DO 			mulop := sym; OCS.Get(sym); IF mulop = and THEN OCE.MOp(and, x) END ; Factor(y); OCE.Op(mulop, x, y) 		END END Term; PROCEDURE SimpleExpression(VAR x: OCT.Item); VAR y: OCT.Item; addop: INTEGER; BEGIN IF sym = minus THEN OCS.Get(sym); Term(x); OCE.MOp(minus, x) 		ELSIF sym = plus THEN OCS.Get(sym); Term(x); OCE.MOp(plus, x) 		ELSE Term(x) END ; WHILE (plus <= sym) & (sym <= or) DO 			addop := sym; OCS.Get(sym); IF addop = or THEN OCE.MOp(or, x) END ; Term(y); OCE.Op(addop, x, y) 		END END SimpleExpression; PROCEDURE Expression(VAR x: OCT.Item); VAR y: OCT.Item; relation: INTEGER; BEGIN SimpleExpression(x); IF (eql <= sym) & (sym <= geq) THEN relation := sym; OCS.Get(sym); IF x.typ = OCT.booltyp THEN OCE.MOp(relation, x) END ; SimpleExpression(y); OCE.Op(relation, x, y) 		ELSIF sym = in THEN OCS.Get(sym); SimpleExpression(y); OCE.In(x, y) 		ELSIF sym = is THEN IF x.mode >= Typ THEN OCS.Mark(112) END ; OCS.Get(sym); IF sym = ident THEN qualident(y); IF y.mode = Typ THEN OCE.TypTest(x, y, TRUE) ELSE OCS.Mark(52) END ELSE OCS.Mark(10) END END END Expression; PROCEDURE ProcedureDeclaration; VAR proc, proc1, par: OCT.Object; L1: INTEGER; mode: SHORTINT; body: BOOLEAN; psize, dsize: LONGINT; BEGIN dsize := 0; proc := NIL; body := TRUE; IF (sym # ident) & (OCC.level = 0) THEN IF sym = times THEN mode := XProc ELSIF sym = arrow THEN (*forward*) mode := XProc; body := FALSE ELSIF sym = plus THEN mode := IProc ELSIF sym = minus THEN mode := CProc; body := FALSE ELSE mode := LProc; OCS.Mark(10) END ; OCS.Get(sym) ELSE mode := LProc END ; IF sym = ident THEN IF OCC.level = 0 THEN OCT.Find(proc1, L1) ELSE proc1 := NIL END; IF (proc1 # NIL) & (proc1.mode = XProc)&(OCC.Entry(SHORT(proc1.a0)) = 0) THEN (*there exists a corresponding forward declaration*) IF mode = LProc THEN mode := XProc END ; NEW(proc); CheckMark(proc.marked) ELSE IF proc1 # NIL THEN OCS.Mark(1); proc1 := NIL END ; OCT.Insert(OCS.name, proc); CheckMark(proc.marked); IF proc.marked & (mode = LProc) THEN mode := XProc END ; IF mode = LProc THEN proc.a0 := OCC.pc 				ELSIF mode # CProc THEN IF entno < MaxEntry THEN proc.a0 := entno; INC(entno) ELSE proc.a0 := 1; OCS.Mark(226) END END END ; proc.mode := mode; proc.typ := OCT.notyp; proc.dsc := NIL; proc.a1 := 0; INC(OCC.level); OCT.OpenScope(OCC.level); IF (mode = LProc) & (OCC.level = 1) THEN psize := LParOrg ELSE psize := XParOrg END ; IF sym = lparen THEN OCS.Get(sym); FormalParameters(proc.typ, psize); proc.dsc := OCT.topScope.next END ; IF proc1 # NIL THEN (*forward*) OCH.CompareParLists(proc.dsc, proc1.dsc); IF proc.typ # proc1.typ THEN OCS.Mark(118) END ; proc := proc1; proc.dsc := OCT.topScope.next END ; IF mode = CProc THEN IF sym = number THEN proc.a0 := OCS.intval; OCS.Get(sym) ELSE OCS.Mark(17) END END ; IF body THEN CheckSym(semicolon); OCT.topScope.typ := proc.typ; OCT.topScope.a1 := mode*10000H + psize; (*for RETURN statements*) OCH.Enter(mode, proc.a0, L1); par := proc.dsc; WHILE par # NIL DO 					(*code for dynamic array value parameters*) IF (par.typ.form = DynArr) & (par.mode = Var) THEN OCH.CopyDynArray(par.a0, par.typ) END ; par := par.next END ; Block(dsize); proc.dsc := OCT.topScope.next; (*update*) IF proc.typ = OCT.notyp THEN OCH.Return(proc.mode, psize) ELSE OCH.Trap(17) END ; IF dsize >= LDataSize THEN OCS.Mark(209); dsize := 0 END ; OCC.FixupWith(L1, dsize); proc.a2 := OCC.pc; IF sym = ident THEN IF OCS.name # proc.name THEN OCS.Mark(4) END ; OCS.Get(sym) ELSE OCS.Mark(10) END END ; DEC(OCC.level); OCT.CloseScope END END ProcedureDeclaration; PROCEDURE CaseLabelList(LabelForm: INTEGER; 			VAR n: INTEGER; VAR tab: ARRAY OF OCH.LabelRange); VAR x, y: OCT.Item; i, f: INTEGER; BEGIN IF ~(LabelForm IN labeltyps) THEN OCS.Mark(61) END ; LOOP ConstExpression(x); f := x.typ.form; IF f IN intSet THEN IF LabelForm < f THEN OCS.Mark(60) END ELSIF f # LabelForm THEN OCS.Mark(60) END ; IF sym = upto THEN OCS.Get(sym); ConstExpression(y); IF (y.typ.form # f) & ~((f IN intSet) & (y.typ.form IN intSet)) THEN OCS.Mark(60) END ; IF y.a0 < x.a0 THEN OCS.Mark(63); y.a0 := x.a0 END ELSE y := x 			END ; (*enter label range into ordered table*) i := n; 			IF i < NofCases THEN LOOP IF i = 0 THEN EXIT END ; IF tab[i-1].low <= y.a0 THEN IF tab[i-1].high >= x.a0 THEN OCS.Mark(62) END ; EXIT END ; tab[i] := tab[i-1]; DEC(i) END ; tab[i].low := SHORT(x.a0); tab[i].high := SHORT(y.a0); tab[i].label := OCC.pc; INC(n) ELSE OCS.Mark(213) END ; IF sym = comma THEN OCS.Get(sym) ELSIF (sym = number) OR (sym = ident) THEN OCS.Mark(19) ELSE EXIT END END END CaseLabelList; PROCEDURE StatSeq; VAR fpar: OCT.Object; xtyp: OCT.Struct; x, y: OCT.Item; L0, L1, ExitIndex: INTEGER; PROCEDURE CasePart; VAR x: OCT.Item; n, L0, L1, L2, L3: INTEGER; tab: ARRAY NofCases OF OCH.LabelRange; BEGIN n := 0; L3 := 0; Expression(x); OCH.CaseIn(x, L0, L1); OCC.FreeRegs({}); CheckSym(of); LOOP IF sym < bar THEN CaseLabelList(x.typ.form, n, tab); CheckSym(colon); StatSeq; OCH.FJ(L3) END ; IF sym = bar THEN OCS.Get(sym) ELSE EXIT END END ; L2 := OCC.pc; IF sym = else THEN OCS.Get(sym); StatSeq; OCH.FJ(L3) ELSE OCH.Trap(16) END ; OCH.CaseOut(L0, L1, L2, L3, n, tab) END CasePart; BEGIN LOOP IF sym < ident THEN OCS.Mark(14); REPEAT OCS.Get(sym) UNTIL sym >= ident END ; IF sym = ident THEN qualident(x); selector(x); IF sym = becomes THEN OCS.Get(sym); Expression(y); OCH.Assign(x, y, FALSE) ELSIF sym = eql THEN OCS.Mark(33); OCS.Get(sym); Expression(y); OCH.Assign(x, y, FALSE) ELSIF x.mode = SProc THEN StandProcCall(x); IF x.typ # OCT.notyp THEN OCS.Mark(55) END ELSE OCH.PrepCall(x, fpar); IF sym = lparen THEN OCS.Get(sym); ActualParameters(x, fpar); CheckSym(rparen) ELSIF IsParam(fpar) THEN OCS.Mark(65) END ; OCH.Call(x); IF x.typ # OCT.notyp THEN OCS.Mark(55) END END ELSIF sym = if THEN OCS.Get(sym); Expression(x); OCH.CFJ(x, L0); OCC.FreeRegs({}); CheckSym(then); StatSeq; L1 := 0; WHILE sym = elsif DO 					OCS.Get(sym); OCH.FJ(L1); OCC.FixLink(L0); Expression(x); OCH.CFJ(x, L0); OCC.FreeRegs({}); CheckSym(then); StatSeq END ; IF sym = else THEN OCS.Get(sym); OCH.FJ(L1); OCC.FixLink(L0); StatSeq ELSE OCC.FixLink(L0) END ; OCC.FixLink(L1); CheckSym(end) ELSIF sym = case THEN OCS.Get(sym); CasePart; CheckSym(end) ELSIF sym = while THEN OCS.Get(sym); L1 := OCC.pc; Expression(x); OCH.CFJ(x, L0); OCC.FreeRegs({}); CheckSym(do); StatSeq; OCH.BJ(L1); OCC.FixLink(L0); CheckSym(end) ELSIF sym = repeat THEN OCS.Get(sym); L0 := OCC.pc; StatSeq; IF sym = until THEN OCS.Get(sym); Expression(x); OCH.CBJ(x, L0) ELSE OCS.Mark(43) END ELSIF sym = loop THEN OCS.Get(sym); ExitIndex := ExitNo; INC(LoopLevel); L0 := OCC.pc; StatSeq; OCH.BJ(L0); DEC(LoopLevel); WHILE ExitNo > ExitIndex DO 					DEC(ExitNo); OCC.fixup(LoopExit[ExitNo]) END ; CheckSym(end) ELSIF sym = with THEN OCS.Get(sym); x.obj := NIL; xtyp := NIL; IF sym = ident THEN qualident(x); CheckSym(colon); IF sym = ident THEN qualident(y); IF y.mode = Typ THEN IF x.obj # NIL THEN xtyp := x.typ; OCE.TypTest(x, y, FALSE); x.obj.typ := x.typ ELSE OCS.Mark(130) END ELSE OCS.Mark(52) END ELSE OCS.Mark(10) END ELSE OCS.Mark(10) END ; CheckSym(do); OCC.FreeRegs({}); StatSeq; CheckSym(end); IF xtyp# NIL THEN x.obj.typ := xtyp END ELSIF sym = exit THEN OCS.Get(sym); OCH.FJ(L0); IF LoopLevel = 0 THEN OCS.Mark(45) ELSIF ExitNo < 16 THEN LoopExit[ExitNo] := L0; INC(ExitNo) ELSE OCS.Mark(214) END ELSIF sym = return THEN OCS.Get(sym); IF OCC.level > 0 THEN IF sym < semicolon THEN Expression(x); OCH.Result(x, OCT.topScope.typ) ELSIF OCT.topScope.typ # OCT.notyp THEN OCS.Mark(124) END ; OCH.Return(SHORT(OCT.topScope.a1 DIV 10000H), SHORT(OCT.topScope.a1)) ELSE (*return from module body*) IF sym < semicolon THEN Expression(x); OCS.Mark(124) END ; OCH.Return(XProc, XParOrg) END END ; OCC.FreeRegs({}); IF sym = semicolon THEN OCS.Get(sym) ELSIF (sym <= ident) OR (if <= sym) & (sym <= return) THEN OCS.Mark(38) ELSE EXIT END END END StatSeq; PROCEDURE Block(VAR dsize: LONGINT); VAR typ, forward: OCT.Struct; obj, first: OCT.Object; x: OCT.Item; L0: INTEGER; adr, size: LONGINT; mk: BOOLEAN; id0: ARRAY 32 OF CHAR; BEGIN adr := -dsize; obj := OCT.topScope; WHILE obj.next # NIL DO obj := obj.next END ; LOOP IF sym = const THEN OCS.Get(sym); WHILE sym = ident DO 					COPY(OCS.name, id0); CheckMark(mk); IF sym = eql THEN OCS.Get(sym); ConstExpression(x) ELSIF sym = becomes THEN OCS.Mark(9); OCS.Get(sym); ConstExpression(x) ELSE OCS.Mark(9) END ; OCT.Insert(id0, obj); obj.mode := SHORT(x.mode); obj.typ := x.typ; obj.a0 := x.a0; obj.a1 := x.a1; obj.marked := mk; CheckSym(semicolon) END END ; IF sym = type THEN OCS.Get(sym); WHILE sym = ident DO 					typ := OCT.undftyp; OCT.Insert(OCS.name, obj); forward := obj.typ; obj.mode := Typ; obj.typ := OCT.notyp; CheckMark(obj.marked); IF sym = eql THEN OCS.Get(sym); Type(typ) ELSIF (sym = becomes) OR (sym = colon) THEN OCS.Mark(9); OCS.Get(sym); Type(typ) ELSE OCS.Mark(9) END ; obj.typ := typ; IF typ.strobj = NIL THEN typ.strobj := obj END ; IF forward # NIL THEN (*fixup*) SetPtrBase(forward, typ) END ; CheckSym(semicolon) END END ; IF sym = var THEN OCS.Get(sym); WHILE sym = ident DO 					OCT.Insert(OCS.name, obj); first := obj; CheckMark(obj.marked); obj.mode := Var; LOOP IF sym = comma THEN OCS.Get(sym) ELSIF sym = ident THEN OCS.Mark(19) ELSE EXIT END ; IF sym = ident THEN OCT.Insert(OCS.name, obj); CheckMark(obj.marked); obj.mode := Var ELSE OCS.Mark(10) END END ; CheckSym(colon); Type(typ); size := typ.size; IF size >= 4 THEN DEC(adr, adr MOD 4) ELSIF size = 2 THEN DEC(adr, adr MOD 2) END ; WHILE first # NIL DO 						first.typ := typ; DEC(adr, size); first.a0 := adr; first := first.next END ; CheckSym(semicolon) END END ; IF (sym < const) OR (sym > var) THEN EXIT END ; END ; CheckUndefPointerTypes; IF OCC.level = 0 THEN OCH.LFJ(L0) ELSE OCH.FJ(L0) END ; WHILE sym = procedure DO 			OCS.Get(sym); ProcedureDeclaration; CheckSym(semicolon) END ; IF OCC.level = 0 THEN OCC.fixupL(L0); OCC.InitTypDescs ELSE OCC.fixupC(L0) END ; IF sym = begin THEN OCS.Get(sym); StatSeq END ; dsize := (adr MOD 4) - adr; CheckSym(end) END Block; PROCEDURE CompilationUnit(source: Texts.Text; pos: LONGINT); VAR L0: INTEGER; ch: CHAR; time, date, key, dsize: LONGINT; modid, impid, FName: ARRAY 32 OF CHAR; PROCEDURE MakeFileName(VAR name, FName: ARRAY OF CHAR; 				ext: ARRAY OF CHAR); VAR i, j: INTEGER; ch: CHAR; BEGIN i := 0; LOOP ch := name[i]; IF ch = 0X THEN EXIT END ; FName[i] := ch; INC(i) END ; j := 0; REPEAT ch := ext[j]; FName[i] := ch; INC(i); INC(j) UNTIL ch = 0X END MakeFileName; BEGIN entno := 1; dsize := 0; LoopLevel := 0; ExitNo := 0; OCC.Init; OCT.Init; OCS.Init(source, pos); OCS.Get(sym); Texts.WriteString(W, " compiling "); IF sym = module THEN OCS.Get(sym) ELSE OCS.Mark(16) END ; IF sym = ident THEN Texts.WriteString(W, OCS.name); Texts.Append(Oberon.Log, W.buf); L0 := 0; ch := OCS.name[0]; WHILE (ch # 0X) & (L0 < ModNameLen-1) DO 				modid[L0] := ch; INC(L0); ch := OCS.name[L0] END ; modid[L0] := 0X; IF ch # 0X THEN OCS.Mark(228) END ; OCT.OpenScope(0); OCS.Get(sym); CheckSym(semicolon); OCH.Enter(Mod, 0, L0); IF sym = import THEN OCS.Get(sym); LOOP IF sym = ident THEN COPY(OCS.name, impid); OCS.Get(sym); MakeFileName(impid, FName, ".Sym"); IF sym = becomes THEN OCS.Get(sym); IF sym = ident THEN MakeFileName(OCS.name, FName, ".Sym"); OCS.Get(sym) ELSE OCS.Mark(10) END END ; OCT.Import(impid, modid, FName) ELSE OCS.Mark(10) END ; IF sym = comma THEN OCS.Get(sym) ELSIF sym = ident THEN OCS.Mark(19) ELSE EXIT END END ; CheckSym(semicolon) END ; IF ~OCS.scanerr THEN OCC.SetLinkTable(OCT.nofGmod+1); Block(dsize); OCH.Return(XProc, 12); IF sym = ident THEN IF OCS.name # modid THEN OCS.Mark(4) END ; OCS.Get(sym) ELSE OCS.Mark(10) END ; IF sym # period THEN OCS.Mark(18) END ; IF ~OCS.scanerr THEN Oberon.GetClock(time, date); key := (date MOD 4000H) * 20000H + time; MakeFileName(modid, FName, ".Sym"); OCT.Export(modid, FName, newSF, key); IF newSF THEN Texts.WriteString(W, " new symbol file") END ; IF ~OCS.scanerr THEN MakeFileName(modid, FName, ".Obj"); OCC.OutCode(FName, modid, key, entno, dsize); Texts.WriteInt(W, OCC.pc, 6); Texts.WriteInt(W, dsize, 6) END END END ; OCT.CloseScope ELSE OCS.Mark(10) END; OCC.Close; OCT.Close; Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf) END CompilationUnit; PROCEDURE Compile*; VAR beg, end, time: LONGINT; T: Texts.Text; S: Texts.Scanner; v: Viewers.Viewer; PROCEDURE Options; VAR ch: CHAR; BEGIN IF S.nextCh = "/" THEN LOOP Texts.Read(S, ch); IF ch = "x" THEN OCE.inxchk := FALSE ELSIF ch = "t" THEN OCC.typchk := FALSE ELSIF ch = "s" THEN newSF := TRUE ELSE S.nextCh := ch; EXIT END END END END Options; BEGIN OCE.inxchk := TRUE; OCC.typchk := TRUE; newSF := FALSE; Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos); Texts.Scan(S); IF S.class = Texts.Char THEN IF S.c = "*" THEN v := Oberon.MarkedViewer; IF (v.dsc # NIL) & (v.dsc.next IS TextFrames.Frame) THEN Options; CompilationUnit(v.dsc.next(TextFrames.Frame).text, 0) END ELSIF S.c = "^" THEN Oberon.GetSelection(T, beg, end, time); IF time >= 0 THEN Texts.OpenScanner(S, T, beg); Texts.Scan(S); IF S.class = Texts.Name THEN Options; Texts.WriteString(W, S.s); NEW(T); Texts.Open(T, S.s); IF T.len # 0 THEN CompilationUnit(T, 0) ELSE Texts.WriteString(W, " not found"); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf) END END END ELSIF S.c = "@" THEN Oberon.GetSelection(T, beg, end, time); IF time >= 0 THEN Options; CompilationUnit(T, beg) END END ELSE NEW(T); WHILE S.class = Texts.Name DO 				Options; Texts.WriteString(W, S.s); Texts.Open(T, S.s); IF T.len # 0 THEN CompilationUnit(T, 0) ELSE Texts.WriteString(W, " not found"); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf) END ; Texts.Scan(S) END END ; Oberon.Collect(0) END Compile; BEGIN Texts.OpenWriter(W); Texts.WriteString(W, "Compiler NW 1.8.91"); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf) END Compiler.

title: Oberon/V2/Compiler


text:
User talk:184.146.122.152

Unblock
Sorry for the automated filter blocking you, it was a false positive. Leaderboard (discuss • contribs) 20:11, 6 February 2021 (UTC)

title: User talk:184.146.122.152


text:
Oberon/V2/OCS

MODULE OCS; (*NW 7.6.87 / 20.12.90*) IMPORT Files, Reals, Texts, Oberon; (* symbols: 		       | 0       1       2       3       4  		--  		 0     | null    *       /       DIV     MOD  		 5     | &       +       -       OR      =  		10     | #       <       <=      >       >=  		15     | IN      IS      ^       .      ,  		20     | :       ..      )       ]       } 25    | OF      THEN    DO      TO      (  		30     | [       {       ~       :=      number  		35     | NIL     string  ident   ;       |  		40     | END     ELSE    ELSIF   UNTIL   IF  		45     | CASE    WHILE   REPEAT  LOOP    WITH  		50     | EXIT    RETURN  ARRAY   RECORD  POINTER  		55     | BEGIN   CONST   TYPE    VAR     PROCEDURE  		<span style="font-family: Courier, monospace">60     | IMPORT  MODULE  eof *) CONST KW = 43; (*size of hash table*) maxDig = 32; maxInt = 7FFFH; maxShInt = 7FH; maxExp = 38; maxLExp = 308; maxStrLen = 128; (*name, numtyp, intval, realval, lrlval are implicit results of Get*) VAR numtyp* : INTEGER; (* 1 = char, 2 = integer, 3 = real, 4 = longreal*) intval* : LONGINT; realval*: REAL; lrlval* : LONGREAL; scanerr*: BOOLEAN; name* : ARRAY maxStrLen OF CHAR; R: Texts.Reader; W: Texts.Writer; ch: CHAR; (*current character*) lastpos: LONGINT; (*error position in source file*) i: INTEGER; keyTab : ARRAY KW OF 			RECORD symb, alt: INTEGER; id: ARRAY 12 OF CHAR END; PROCEDURE Mark*(n: INTEGER); VAR pos: LONGINT; BEGIN scanerr := TRUE; pos := Texts.Pos(R); IF lastpos + 10 < pos THEN Texts.WriteLn(W); Texts.WriteString(W, " pos"); Texts.WriteInt(W, pos, 6); Texts.WriteString(W, " err"); Texts.WriteInt(W, n, 4); Texts.Append(Oberon.Log, W.buf); lastpos := pos END END Mark; PROCEDURE String(VAR sym: INTEGER); VAR i: INTEGER; BEGIN i := 0; LOOP Texts.Read(R, ch); IF ch = 22X THEN EXIT END ; IF ch < " " THEN Mark(3); EXIT END ; IF i < maxStrLen-1 THEN name[i] := ch; INC(i) ELSE Mark(212); i := 0 END END ; Texts.Read(R, ch); IF i = 1 THEN sym := 34; numtyp := 1; intval := ORD(name[0]) ELSE sym := 36; name[i] := 0X (*string*) END END String; PROCEDURE Identifier(VAR sym: INTEGER); VAR i, k: INTEGER; BEGIN i := 0; k := 0; REPEAT IF i < 31 THEN name[i] := ch; INC(i); INC(k, ORD(ch)) END ; Texts.Read(R, ch) UNTIL (ch < "0") OR ("9" < ch) & (CAP(ch) < "A") OR ("Z" < CAP(ch)); name[i] := 0X; k := (k+i) MOD KW; (*hash function*) IF (keyTab[k].symb # 0) & (keyTab[k].id = name) THEN sym := keyTab[k].symb ELSE k := keyTab[k].alt; IF (keyTab[k].symb # 0) & (keyTab[k].id = name) THEN sym := keyTab[k].symb ELSE sym := 37 (*ident*) END END END Identifier; PROCEDURE Hval(ch: CHAR): INTEGER; VAR d: INTEGER; BEGIN d := ORD(ch) - 30H; (*d >= 0*) IF d >= 10 THEN IF (d >= 17) & (d < 23) THEN DEC(d, 7) ELSE d := 0; Mark(2) END END ; RETURN d 	END Hval; PROCEDURE Number; VAR i, j, h, d, e, n: INTEGER; x, f: REAL; y, g: LONGREAL; lastCh: CHAR; neg: BOOLEAN; dig: ARRAY maxDig OF CHAR; PROCEDURE ReadScaleFactor; BEGIN Texts.Read(R, ch); IF ch = "-" THEN neg := TRUE; Texts.Read(R, ch) ELSE neg := FALSE; IF ch = "+" THEN Texts.Read(R, ch) END END ; IF ("0" <= ch) & (ch <= "9") THEN REPEAT e := e*10 + ORD(ch)-30H; Texts.Read(R, ch) UNTIL (ch < "0") OR (ch >"9") ELSE Mark(2) END END ReadScaleFactor; BEGIN i := 0; REPEAT dig[i] := ch; INC(i); Texts.Read(R, ch) UNTIL (ch < "0") OR ("9" < ch) & (CAP(ch) < "A") OR ("Z" < CAP(ch)); lastCh := ch; j := 0; WHILE (j < i-1) & (dig[j] = "0") DO INC(j) END ; IF ch = "." THEN Texts.Read(R, ch); IF ch = "." THEN lastCh := 0X; ch := 7FX END END ; IF lastCh = "." THEN (*decimal point*) h := i; 			WHILE ("0" <= ch) & (ch <= "9") DO (*read fraction*) IF i < maxDig THEN dig[i] := ch; INC(i) END ; Texts.Read(R, ch) END ; IF ch = "D" THEN y := 0; g := 1; e := 0; WHILE j < h DO y := y*10 + (ORD(dig[j])-30H); INC(j) END ; WHILE j < i DO g := g/10; y := (ORD(dig[j])-30H)*g + y; INC(j) END ; ReadScaleFactor; IF neg THEN IF e <= maxLExp THEN y := y / Reals.TenL(e) ELSE y := 0 END ELSIF e > 0 THEN IF e <= maxLExp THEN y := Reals.TenL(e) * y ELSE y := 0; Mark(203) END END ; numtyp := 4; lrlval := y 			ELSE x := 0; f := 1; e := 0; WHILE j < h DO x := x*10 + (ORD(dig[j])-30H); INC(j) END ; WHILE j < i DO f := f/10; x := (ORD(dig[j])-30H)*f + x; INC(j) END ; IF ch = "E" THEN ReadScaleFactor END ; IF neg THEN IF e <= maxExp THEN x := x / Reals.Ten(e) ELSE x := 0 END ELSIF e > 0 THEN IF e <= maxExp THEN x := Reals.Ten(e) * x ELSE x := 0; Mark(203) END END ; numtyp := 3; realval := x 			END ELSE (*integer*) lastCh := dig[i-1]; intval := 0; IF lastCh = "H" THEN IF j < i THEN DEC(i); intval := Hval(dig[j]); INC(j); IF i-j <= 7 THEN IF (i-j = 7) & (intval >= 8) THEN DEC(intval, 16) END ; WHILE j < i DO intval := Hval(dig[j]) + intval * 10H; INC(j) END ELSE Mark(203) END END ELSIF lastCh = "X" THEN DEC(i); WHILE j < i DO 					intval := Hval(dig[j]) + intval*10H; INC(j); IF intval > 0FFH THEN Mark(203); intval := 0 END END ELSE (*decimal*) WHILE j < i DO 					d := ORD(dig[j]) - 30H; IF d < 10 THEN IF intval <= (MAX(LONGINT) - d) DIV 10 THEN intval := intval*10 + d 						ELSE Mark(203); intval := 0 END ELSE Mark(2); intval := 0 END ; INC(j) END END ; IF lastCh = "X" THEN numtyp := 1 ELSE numtyp := 2 END END END Number; PROCEDURE Get*(VAR sym: INTEGER); VAR s: INTEGER; xch: CHAR; PROCEDURE Comment;   (* do not read after end of file *) BEGIN Texts.Read(R, ch); LOOP LOOP WHILE ch = "(" DO Texts.Read(R, ch); 						IF ch = "*" THEN Comment END 					END ; 					IF ch = "*" THEN Texts.Read(R, ch); EXIT END ; 					IF ch = 0X THEN EXIT END ; 					Texts.Read(R, ch) 				END ; 				IF ch = ")" THEN Texts.Read(R, ch); EXIT END ; IF ch = 0X THEN Mark(5); EXIT END END END Comment; BEGIN LOOP (*ignore control characters*) IF ch <= " " THEN IF ch = 0X THEN ch := " "; EXIT ELSE Texts.Read(R, ch) END ELSIF ch > 7FX THEN Texts.Read(R, ch) ELSE EXIT END END ; CASE ch OF (* " " <= ch <= 7FX *) " " : s := 62; ch := 0X (*eof*) | "!", "$", "%", "'", "?", "@", "\", "_", "`": s := 0; Texts.Read(R, ch) | 22X : String(s) | "#" : s := 10; Texts.Read(R, ch) | "&" : s := 5; Texts.Read(R, ch) | "(" : Texts.Read(R, ch); 				IF ch = "*" THEN Comment; Get(s) 				ELSE s := 29 				END 			| ")" : s := 22; Texts.Read(R, ch) | "*" : s := 1; Texts.Read(R, ch) | "+" : s := 6; Texts.Read(R, ch) | "," : s := 19; Texts.Read(R, ch) | "-" : s := 7; Texts.Read(R, ch) | "." : Texts.Read(R, ch); IF ch = "." THEN Texts.Read(R, ch); s := 21 ELSE s := 18 END | "/" : s := 2; Texts.Read(R, ch) | "0".."9": Number; s := 34 | ":" : Texts.Read(R, ch); IF ch = "=" THEN Texts.Read(R, ch); s := 33 ELSE s := 20 END | ";" : s := 38; Texts.Read(R, ch) | "<" : Texts.Read(R, ch); IF ch = "=" THEN Texts.Read(R, ch); s := 12 ELSE s := 11 END | "=" : s := 9; Texts.Read(R, ch) | ">" : Texts.Read(R, ch); IF ch = "=" THEN Texts.Read(R, ch); s := 14 ELSE s := 13 END | "A".."Z": Identifier(s) | "[" : s := 30; Texts.Read(R, ch) | "]" : s := 23; Texts.Read(R, ch) | "^" : s := 17; Texts.Read(R, ch) | "a".."z": Identifier(s) | "{" : s := 31; Texts.Read(R, ch) | "|" : s := 39; Texts.Read(R, ch) | "}" : s := 24; Texts.Read(R, ch) | "~" : s := 32; Texts.Read(R, ch) | 7FX : s := 21; Texts.Read(R, ch) END ; sym := s 	END Get; PROCEDURE Init*(source: Texts.Text; pos: LONGINT); BEGIN ch := " "; scanerr := FALSE; lastpos := -8; Texts.OpenReader(R, source, pos) END Init; PROCEDURE EnterKW(sym: INTEGER; name: ARRAY OF CHAR); VAR j, k: INTEGER; BEGIN j := 0; k := 0; REPEAT INC(k, ORD(name[j])); INC(j) UNTIL name[j] = 0X; k := (k+j) MOD KW; (*hash function*) IF keyTab[k].symb # 0 THEN j := k; 			REPEAT INC(k) UNTIL keyTab[k].symb = 0; keyTab[j].alt := k 		END ; keyTab[k].symb := sym; COPY(name, keyTab[k].id) END EnterKW; BEGIN i := KW; WHILE i > 0 DO 		DEC(i); keyTab[i].symb := 0; keyTab[i].alt := 0 END ; keyTab[0].id := ""; EnterKW(27, "DO"); EnterKW(44, "IF"); EnterKW(15, "IN"); EnterKW(16, "IS"); EnterKW(25, "OF"); EnterKW( 8, "OR"); EnterKW(40, "END"); EnterKW( 4, "MOD"); EnterKW(35, "NIL"); EnterKW(58, "VAR"); EnterKW(41, "ELSE"); EnterKW(50, "EXIT"); EnterKW(26, "THEN"); EnterKW(49, "WITH"); EnterKW(52, "ARRAY"); EnterKW(55, "BEGIN"); EnterKW(56, "CONST"); EnterKW(42, "ELSIF"); EnterKW(43, "UNTIL"); EnterKW(46, "WHILE"); EnterKW(53, "RECORD"); EnterKW(47, "REPEAT"); EnterKW(51, "RETURN"); EnterKW(59, "PROCEDURE"); EnterKW(28, "TO"); EnterKW( 3, "DIV"); EnterKW(48, "LOOP"); EnterKW(57, "TYPE"); EnterKW(60, "IMPORT"); EnterKW(61, "MODULE"); EnterKW(54, "POINTER"); Texts.OpenWriter(W) END OCS.

title: Oberon/V2/OCS


text:
Wikijunior:My Spoon is Too Small

This is an early phonics reader intended to teach the 'oo' digraph as in 'moon' and in 'foot', along with a few irregular words and some words where it might be expected but doesn't appear.

My Spoon is Too Small

My spoon is too small.

Boo Hoo!

My spoon is too big.

Boo Hoo!

My spoon is just right.

Hooray!

My spoon is on the moon.

Boo Hoo.

My food is on it too.

Boo Hoo.

Where did Mister Roosevelt go?

He traveled to Espoo.

Who are his friends?

Bill Woo and Robinson Crusoe.

What does he do?

He ties up loose strings.

Look at him now. He's reading a book.

He loses his shoe by the brook.

Boo Hoo!

His poor foot steps on a floor with soot.

Boo Hoo!

He puts a boot on his foot.

Hooray!

title: Wikijunior:My Spoon is Too Small


text:
Wikijunior:This is a Book

This is an early phonics reader t o teach the diagraph 'oo' as in book.

This is a Book

This is a book.

(This is NOT a book.)

This is my book.

This is your book.

Look!

Jon took it.

He took my book.

Look!

Sam and Pat took it.

They took your book.

I am shook!

title: Wikijunior:This is a Book


text:
User:Elon musket69/sandbox

piuyguygyvouy

title: User:Elon musket69/sandbox


text:
International Postage Meter Stamp Catalog/Hong Kong/AA1

=Hong Kong Type AA1=

Universal Postal Frankers, Ltd. "Midget".

 * The Midget could print a selected number of values values, each up to a maximum of 25 times the unit value. Machines used in Hong Kong had a unit value of 1c so could print a maximum value of 25c, though see notes for M6.
 * 9 machines are known, numbered M1-M7, M9 and M20. They were distributed by Lane Crawford, Ltd., acting as agents for UPF.
 * Value dies were originally engraved by Huggins, Geyer & Coleman, Ltd., London. From the number of dies dispatched to Hong Kong, it is possible that a tenth machine was also issued.

AA1.M1 (FV-3).

 * A. Lane, Crawford Ltd. Known 11 XII 29 - 18 IV 41
 * TM: DC "VICTORIA / HONG·KONG"
 * Values:
 * Hong Kong Type AA1 M1 2c.jpg Hong Kong Type AA1 M1 3c.jpg  Hong Kong Type AA1 M1 4c.jpg  Hong Kong Type AA1 M1 10c.jpg
 * 2c known 11 XII 29 - 7 III 41
 * 3c known 7 VII 34 - 7 III 41
 * 4c known 16 VII 30 - 9 VIII 30
 * 10c known 3 I 38 - 18 IV 41
 * NOTE: The 3c and 10c dies were replacements and have a sans-serif "1" in the meter number.
 * Slogans:
 * Hong Kong AA1 M1 Slogan A.jpg Hong Kong AA1 M1 Slogan B.jpg  Hong Kong AA1 M1 Slogan C.jpg
 * A. LANE, CRAWFORD LTD. for things worth having. (Image shows a photocopy - actual slogan would be red)
 * Known 11 XII 29
 * B. Try LANE CRAWFORD LTD. First
 * Known 11 VI 30 - 3 IX 30
 * C. A bigger selection at Lane Crawford Ltd.
 * Known 7 VII 34 - 18 IV 41

AA1.M2 (FV-3).

 * A. The Hong Kong Jockey Club. Known postally used on 3 X 31 only
 * TM: DC "VICTORIA / HONG·KONG"
 * Values:
 * Hong Kong Type AA1 M2 1c.jpg Hong Kong Type AA1 M2 2c.jpg  Hong Kong Type AA1 M2 4c.jpg
 * 1c postally used examples not known
 * 2c known 3 X 31
 * 4c postally used examples not known
 * NOTE: Proofs of the 1c, 2c and 4c are known dated 2 X 29.
 * Slogans:
 * Hong Kong M2 Slogan A.jpg Hong Kong M2 Slogan B.jpg  Hong Kong M2 Slogan C.jpg
 * A. LANE, CRAWFORD LTD. ESTABLISHED 1850
 * Examples are known only on proofs dated 2 X 29.
 * B. QUALITY FOR QUALITY LANE CRAWFORD LTD. ARE CHEAPER (Image shows a photocopy - actual slogan would be red)
 * Examples are known only on proofs dated 2 X 29.
 * C. A bigger selection at Lane Crawford Ltd. (Image shows a photocopy - actual slogan would be red)
 * Examples are known only on proofs dated 2 X 29.

AA1.M3 (FV-3).

 * A. The Dairy Farm Ice & Cold Storage Company, Limited. Known 20 XII 29 - 11 VII 41
 * TM: DC "VICTORIA / HONG·KONG"
 * Values:
 * Hong Kong Type AA1 M3 1c.jpg Hong Kong Type AA1 M3 4c.jpg  Hong Kong Type AA1 M3 10c.jpg
 * 1c known 20 XII 29 - 28 V 41
 * 4c known 12 IV 39 - 28 V 41
 * 10c known 2 VII 30 - 11 VII 41
 * NOTE: Proofs of the 1c and 10c are known dated 2 X 29.
 * Slogans:
 * Hong Kong M3 Slogan A.jpg Hong Kong M3 Slogan B.jpg
 * A. DAIRY FARM ICE CREAM Made its way by the way it’s made (Image shows a photocopy - actual slogan would be red)
 * Examples are known only on proofs dated 2 X 29.
 * B. DRINK FRESH MILK for HEALTH (Image shows a photocopy - actual slogan would be red)
 * Examples are known only on proofs dated 2 X 29.

AA1.M4 (FV-3).

 * A. W.R. Loxley & Co. (China) Ltd. Known 26 IX 32 - 12 VI 40
 * TM: DC "VICTORIA / HONG·KONG"
 * Values:
 * Hong Kong Type AA1 M4 1c.jpg Hong Kong Type AA1 M4 4c.jpg  Hong Kong Type AA1 M4 6c.jpg
 * 1c known 26 IX 32 - 12 VI 40
 * 4c known ? V 33 - 12 VI 40
 * 6c known 16 III 33 - 12 VI 40
 * Slogans:
 * Not known on this machine

AA1.M5 (FV-3).

 * A. Gilman & Co., Ltd. Known 12 XII 35 - ? V 41
 * TM: DC "VICTORIA / HONG·KONG"
 * Values:
 * Hong Kong Type AA1 M5 1c.jpg Hong Kong Type AA1 M5 2c.jpg  Hong Kong Type AA1 M5 4c.jpg  Hong Kong Type AA1 M5 10c.jpg
 * 1c known 17 IX 36 - 4 XII 40
 * 2c known 13 XII 35 - 5 III 36
 * 4c known 12 XII 35 - 4 XII 40
 * 10c known 18 VI 36 - ? VI 41
 * NOTE: Either the 1c or 10 are likely to be replacement dies.
 * NOTE: Proofs of the 2c are known dated 2 X 29.
 * Slogans:
 * Not known on this machine

AA1.M6 (FV-5).

 * A. The American Express Company Inc. Known 10 III 30 - 15 XI 41
 * TM: DC "VICTORIA / HONG·KONG"
 * Values:
 * This machine initially printed in multiples of 1c:
 * Hong Kong Type AA1 M6 1c.jpg Hong Kong Type AA1 M6 4c.jpg  Hong Kong Type AA1 M6 10c.jpg  Hong Kong Type AA1 M6 20c.jpg
 * 1c known 6 VI 36 - 22 VI 38
 * 4c known 26 I 31 - 22 VI 38
 * 10c known 10 III 30 - 16 IX 37
 * 20c known 26 I 31 - 28 VII 38
 * ? fifth value not yet identified
 * In late 1938 the machine was modified to print in multiples of 5c:
 * Hong Kong Type AA1 M6 5c.jpg Hong Kong Type AA1 M6 15c.jpg  Hong Kong Type AA1 M6 25c.jpg  Hong Kong Type AA1 M6 75c.jpg  Hong Kong Type AA1 M6 125c.jpg
 * 5c known 27 III 39 - 19 V 41
 * 15c known 16 I 39 - 15 XI 41
 * 25c known 31 XII 38 - 19 V 41
 * 75c known 3 IV 41 - 6 VI 41
 * $1.25 known 14 IV 39 - 15 XI 41
 * Slogans:
 * Not known on this machine

AA1.M7 (FV-5).

 * A. The National City Bank of New York. Known 9 IV 30 - 17 XI 30
 * B. The Mercantile Bank of India, Limited. Known 28 VII 30 - 14 VII 41
 * NOTE: Both companies used the machine simultaneously, until NCBNY were issued with M9.
 * TM: DC "VICTORIA / HONG·KONG"
 * Values:
 * Hong Kong Type AA1 M7 1c.jpg Hong Kong Type AA1 M7 2c.jpg  Hong Kong Type AA1 M7 4c.jpg  Hong Kong Type AA1 M7 10c.jpg  Hong Kong Type AA1 M7 20c.jpg  Hong Kong Type AA1 M7 25c.jpg
 * 1c known 17 XII 36 - 11 II 41
 * 2c known 8 V 30 - 11 III 32
 * 4c known 8 V 30 - 11 II 41
 * 10c known 9 IV 30 - 15 VII 41
 * 20c known 9 I 31 - 19 VII 41
 * 25c known 19 VIII 30 - 1 XI 30
 * NOTE: The 20c was a replacement for the 25c die.
 * Slogans:
 * Not known on this machine

AA1.M9 (FV-5).

 * A. The National City Bank of New York. Known 26 XI 30 - 1 II 37
 * TM: DC "VICTORIA / HONG·KONG"
 * Values:
 * Hong Kong Type AA1 M9 2c.jpg Hong Kong Type AA1 M9 3c.jpg  Hong Kong Type AA1 M9 4c.jpg  Hong Kong Type AA1 M9 8c.jpg  Hong Kong Type AA1 M9 14c.jpg
 * 2c known 26 XI 30 - 1 II 37
 * 3c known 2 VI 31 - 1 II 37
 * 4c known 27 V 31 - 20 XI 34
 * 8c known 26 XI 30 - 13 IX 35
 * 14c known 26 XI 30 - 24 VII 36
 * Slogans:
 * Not known on this machine

AA1.M20 (FV-3).

 * A. General Post Office. Known 26 XI 30 - 1 II 37
 * TM: DC "VICTORIA / HONG·KONG"
 * Values:
 * Hong Kong Type AA1 M20 1c.jpg Hong Kong Type AA1 M20 2c.jpg  Hong Kong Type AA1 M20 4c.jpg
 * 1c one postally used example known, but date not shown
 * 2c postally used examples not known
 * 4c known 16 IV 30 - 18 IX 35
 * NOTE: Proofs of the 1c, 2c and 4c are known dated 4 IV 29.
 * Slogans:
 * Not known on this machine


text:
Micronations/Relations

With Recognized States
By definition a critical factor that separates micronation from a typical state is recognition by other states. However just because a micronation is not recognized by a state does not preclude a state from interaction with a micronation. Naturally these interactions are characterized by the character of both nations.

Sometimes these relationships can be symbiotic, with both states receiving a benefit. An example can be seen in the Conch Republic, which while humorous, was ultimately established to gain the attention of government authorities about an issue that was causing harm to the local tourism economy. Later the Conch Republic itself became a tourist attraction.

Other times relations can be more antagonistic. For example when Liberland established itself on Terra Nullius between two established countries, it effectively entered itself into a border dispute, leading to police vacating the area. The Free State of Jones was able to successfully resist the Confederacy in Jones County, Mississippi during the American Civil War by engaging in guerilla warfare and aligning itself with the Union cause.

title: Micronations/Relations


text:
Micronations/Economics

Income
A means to generate income to cover operational costs is critical to the operation of any state. While recognized nations have a variety of tools at their disposal for this purpose, most Micronations lack the ability to tax a substantial number of citizens.

The Principality of the Hutt River had an economy based on tourism, and when COVID-19 decimated that industry, the micronation fell with it.

title: Micronations/Economics


text:
History of wireless telegraphy and broadcasting in Australia/Topical/Biographies/Walter Francis Maxwell Howden

Walter Francis Maxwell Howden
A comprehensive biography of Walter Francis Maxwell "Max" Howden has not yet been prepared for this Wikibook, however the following resources have been assembled in preparation:

 * Research - Walter Francis Maxwell Howden - Summary of research to date

 * Transcriptions and Notes - Walter Francis Maxwell Howden - More than 50 transcriptions

 * Photos, QSL cards and other graphics - Walter Francis Maxwell Howden - Nothing uploaded as yet, but many relevant QSLs held

 * Incubator of Wikipedia Article on Walter Francis Maxwell Howden - Coming real soon now!

Key internet links:

Maxwell Hull, VK3ZS, Federal Historical Section WIA: biography "Walter Francis Maxwell Howden" in "Amateur Radio" of October 1983

Neville Williams' biography in "When I think Back . . ." section of Electronics Australia of December 1996

Tribute page by Andrew (current 3BQ callsign holder) "A3BQ (VK3BQ) a Very Historic callsign." (includes several other links)

Wonderful 41 minute recording of an oral history interview with Max "Maxwell Howden interviewed by Mel Pratt ion 1972 for the Mel Pratt collection"

Another excellent 35 minute recording of speech by Max in 1974 to the Radio Amateur's Old Timer's Club about amateur radio late 1910s through 1930s Youtube

Pending further progress on the foregoing, the following lovely article from Melbourne's Table Talk, summarising Max's life to 1927, and accompanied by a wonderful caricature touches briefly on how much Max contributed to the development of wireless in Australia in the 1920s "Prominent Personalities. Written by C. R. Bradish. MAX HOWDEN, A RADIO PIONEER. Illustrated by L. F. REYNOLDS. WHY Max Howden allowed a good part of his countenance to retire behind a mass of foliage to give zest to the suspicion that he was either learning painting under Max Meldrum or Bolshevism under Zinobiffsky is, of course, his own affair, but the probable explanation is that he was too busy to shave. When a comparative infant in his early twenties cheerfully stays up late, not for the pastimes that keep most of us out of bed, but for the business of experimenting in wireless, shaving is frequently superfluous and may even become a serious interruption to the scientific purposes of life. Anyhow, Max, christened Maxwell by his parents in his baptism, has allowed his beard to grow and is so content with the innovation that he can gaze without any noticeable increase of pulse on the prettiest shaving soap advertisements and all those other subtly-worded communiques offering miraculous safety razors for immaterial prices. Max Howden is an uncommon young man. To the average listener-in who takes his evening fill of talk on beet growing or fowl-raising interspersed with orchestral selections from the works of Professor Whizzbang, the name of Howden is little known, but to the scattered world of experimentalists he is one of the Columbuses of the ether, a fellow of infinite worth and enterprise. What he has done will go down in the records to remind us of an unflinching pioneering spirit in the face of all sorts of difficulties and discouragements. Remember that he took up the problem of long-distance wireless when it was being cradled in the lap of officialdom. Apparatus was crude and expensive, and other conditions governing research were not attractive. At the beginning Max Howden was allowed to experiment under Permit No. 19 issued by the Navy Office. He was keen, and he possessed a patience and perseverance that nothing could affect. At first he employed a double slide tuner and crystal detector and started to pick up the ships and Australian coastal stations — then considered something like an invigorating mental adventure, though it is hardly ten years ago. Howden, a practised reader of Morse, heard the calls going back and forward for several months, all the while developing his apparatus, but never assuaging his consuming thirst for experiment. Soon he was listening to the messages thrown into the void by the V.L.A. station in New Zealand, and with this awoke the ambition to have the whole world of wireless audible and build a machine that would leap oceans and establish two way communication. In 1920 a boon of great price came into his hands. The first shipment of valves, a mean half-dozen in all, was landed in Melbourne, and he was lucky to get one. It may interest the present-day amateur to learn that those valves were 65/ each, which will give some idea of the high cost of wireless to a moderate pocket. With the single valve installed Howden's range of reception was vastly increased. Though he is now hardened to the sensations of discovery and achievement, he can still recall the thrill when he distinctly heard JOC (Japan) on a wave length of 600 metres. After that exploit several other high-powered stations studding the globe practically became next-door neighbors. Among them was POZ, of Nauen, Germany, celebrated be fore and during the war; FL, attached to the Eiffel Tower, Paris; YL, at Lyons, in the South of France; MUU, of Carnarvon, Wales; and NAA, of Arlington, America. By this time Howden was hard at it. To him wireless had attained the proportions of a fashionable vice. Whilst other young men were wearing their feet sore in the company of syncopated dirges, or were sitting up late trying to make four aces grow where one grew before he was among his instruments, experimenting with R valves, Muirhead Amplifying valves and what not, and losing sleep with the stoicism popularly associated with scientific work. Hereabouts he built his own audio frequency transformer to use additional amplication and received his first transmitting licence, he first practising on a wave length of 400 to 440 metres. Shortly after the Government kept that wave length exclusively for commercial purposes, and amateurs were then only permitted to play with a wave length not exceeding 250 metres. That did not deter Master Howden. As he proved afterwards, no arbitrary rules about wave lengths could keep a resourceful expert isolated from the world abroad. As a matter of fact, just about the height of the first trans-Pacific tests his own specially designed simplex receiver picked up 23 American amateur stations on a 200-metre wavelength, which was an unprecedented patch of purple in the history of wireless experiment in this country. Thereafter he settled down to experiments in transmission, and he and others, including the brilliant Maclurcan, of Sydney, collectively developed shortwave apparatus. His first great success, after infinite endeavor, was to signal through to California. This happened on November 2, 1924, with a wave length of only 87 metres, and Howden's elation in the circumstances can be imagined. Two nights later 1SF (Boston) reported that a message from Howden had leapt the Pacific and the American continent and had been picked up intact. But an even finer triumph was to follow. A little after five in the morning of November 13, the same year, Mr Simmonds, a clever English amateur, officially known as G2OD, heard his call, and in a few seconds he was talking to Simmonds — which was the first two-way wireless communication between England and Australia. That is not the full story of his work, but it must suffice. It indicates in some measure the temperament of the man and the cool, relentless striving that has won him his position in this strange new science. A curious man, this, with a face paled by long vigils and with eyes lighted by the fanaticism of one who has dedicated a life to a passion. The technics of wireless slip off his tongue as glibly as the prayers of a Buddhist monk, and I doubt if he has in recent years ever mentioned any other subject with animation. He has that strange gift of concentration on one thing which marks men of high talent."