Programmer, Pseudo Code, Code Style Guide

Example Styles for: Programmer, Pseudo Code, Code Style Guide

The text colors here are mentioned as a guide to style.  This page might look rather messy, as all the information is summarized here in a compact form, but actual documents will look very different from this page (they will for example not have so many colors in a small space).

More detailed description of Program
<span style="color: #005511;">Sample</span>
Web Page Source Code (teal)
<span style="color: #008080;">Web Page Source Code</span>
Short Program Description
<strong><span style="color:#005511;">Short Program Description</span></strong>
Copyright (C) 2015 Gharr (group)
<strong>Copyright (C) 2015 Gharr (group)</strong>
Copy and Paste Text; Rules from GNU General Public License
<span style="color: #777777;">Sample</span>
Miscellaneous
<strong><span style="color: #777777;">Sample</span></strong>
Source Code
<span style="color: #0000da;">Source Code</span>
Sample input to a program
<span style="color: #aaaaaa; background-color: #000000;">Sample input to a program</span>
Warning: notes; highlighted notes for program.
<span style="color: #770000;">Warning: notes; highlighted notes for program.</span>

Commentary Text is indented like a block quote—but uses a different method to achieve the effect.

<p style="padding-left: 30px;"><span style="color: #000080;">Commentary Text is indented like a block quote—but uses a different method to achieve the effect.
</span></p>

Highlighter Text for Commentary Text
<span style="color: #333333;">Highlighter Text for Commentary Text</span>

Pseudo Code And Comments

The list is done manually so it can have indented sections that are named in any way. Ordered lists do have list values based on indentation, but this is not used here.
A) Start
B) Initialize values.

001) Get 4 random numbers.

a) Order the 4 numbers from lowest to highest
# Sorting numbers is a fundamental need in a lot of programs.

..i) Display the numbers to the user

Code And Comments Combined Together

Any “warning” text to help programmers out could be placed here. In the example below: “Don’t allow filename to have the same name as line_number_filename,” might be placed here. Of course, this warning is not needed, as the below program does not make use of, or open any files in its present “modified” form. It is just an example warning for this style manual.

#********************************************************************
# Program Name: Code And Comments Combined Together.
# Don’t allow filename to have the same name as line_number_filename, or your source
# will be destroyed

filename = “Source_file.rb”
line_number_filename=”New_file_with_line_numbers.txt”
#********************************************************************
line_number=0
filepos=0

puts “Line Number = #{line_number}, File Postition = #{filepos}”

puts “Program is ending… bye…”

Modified Program (above) called “Code And Comments Combined Together”: Copyright (C) Jul 2015 Gharr (group)

This Program is just an example, and is not meant to do anything in particular. This modified program is free, $0 cost.

This Modified Program “keeps intact all notices” from the GNU General Public License of the original program: “Program to indent/un-indent text file code (source code) once line numbers are known [article]: http://wp.me/p10Tww-3d9.”

The program is untested, but it should show the values of line_number and filepos to the user. The comments and file-names mentioned are just examples, and no actual files will be opened by this program, and so no file can be destroyed. The purpose of this program code, and comments is for the purposes of giving a example of style for use in a style manual. However a “modified” program might be of interest to the Gharr (group) and other programmers, as the GNU General Public License still apply here or perhaps in more legal terms this modified program “keep intact all notices.” This style manual here tries to encourage, and show programmers how a GNU General Public License and “keep intact all notices” might work in practice, with an actual modified program (that is listed here and called “Code And Comments Combined Together”).

The program above is a snippet, and a modified program (July 2015) from a GNU General Public License program that can be found here: Program to indent/un-indent text file code (source code) once line numbers are known [article]: http://wp.me/p10Tww-3d9. The snippet here is for educational purposes only. Should it be used in any way as a program, it retains all the GNU General Public License the original program had.

This modified program “keep intact all notices.” The previous program had the following notices (which also apply to this modified program).

This “modified” program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This “modified” program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see: http://www.gnu.org/licenses/ .

The terms and conditions for the GNU General Public License are explained here: https://www.gnu.org/copyleft/gpl.html

This is an example of copy and paste rules from GNU General Public License (may change)

The below text is just an example, but may be useful if placed at the end of programs that want to use the GNU General Public License, and by definition be free, or cost $0.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see: http://www.gnu.org/licenses/ .

The terms and conditions for the GNU General Public License are explained here: https://www.gnu.org/copyleft/gpl.html

Code to get this effect

<span style="color:#777777;">This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.</span>

<span style="color:#777777;">This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.</span>

<span style="color:#777777;">You should have received a copy of the GNU General Public License
along with this program. If not, see: <a href="http://www.gnu.org/licenses/" target="_blank">http://www.gnu.org/licenses/</a> .</span>

<strong><span style="color:#005511;">The terms and conditions for the <span style="color:#777777;">GNU General Public License</span> are explained here: <a href="https://www.gnu.org/copyleft/gpl.html" target="_blank">https://www.gnu.org/copyleft/gpl.html</a></span></strong>

Sample Input For A Program

This is very similar to a block quote, the </br> tag is used to get the effect of no breaks between the lines. This saves on having to put in multiple tags to get the colors and background seen here for each line; only a single tag was used for this entire code.

What line would you like to start to add space characters to?        5
After what line would you like to stop adding space characters? 10
How many space characters would you like to insert?                     3

Code To Get Single Span Tag For Input Text

Using pre tags.

<span style="color: #aaaaaa; background-color: #000000;">What line would you like to start to add space characters to?        5
After what line would you like to stop adding space characters? 10
How many space characters would you like to insert?                     3</span>

Input Text Formatted To Left Justified, Can Now Be Put Into Code Tags

Using code tags. Not sure why line breaks are not stored, but left justified text seems to store the line breaks and then the code tags can be used with the below code (which is slightly different from the same program input text above.

What line would you like to start to add space characters to? 5
After what line would you like to stop adding space characters? 10
How many space characters would you like to insert? 3

Again We Have The Input Text for the above left-justified

<p style="text-align: left;"><span style="color: #aaaaaa; background-color: #000000;">What line would you like to start to add space characters to? 5
After what line would you like to stop adding space characters? 10
How many space characters would you like to insert? 3</span></p>

Sample Highlighted Text

Some programs might need special warning text, and this is usually placed under the main heading for the particular program.

Warning: This computer code could delete or damage your existing source file computer code; so make sure that the line_number_filename=”New_file.rb” has a different name from your existing source file. If you are very new to programming: you might want to avoid using this program until you understand exactly how and why it works.

Sample Web Page Code

Effect

———☆☆☆———

Shortened link to article: Heading Name [article]: WordPress_shortened_url

—End of Article—

———☆☆☆———

Code For Effect With Scroll Bar

The code is pasted in at main view (between <pre></pre> tags), and when you check it out in text view, it will have changed the code into an acceptable a text-form for text-view. The <pre></pre> tags have to be put in while in text view, or their form will be corrupted.

<p style="text-align: center;"><span style="color: #aaaaaa;">———☆☆☆———</span></p>
<p style="text-align: left;"><span style="color: #808080;">Shortened link to article: Heading Name [article]:</span> WordPress_shortened_url</p>
<p style="text-align: center;"><span style="color: #888888;">—End of Article—</span></p>
<p style="text-align: center;"><span style="color: #aaaaaa;">———☆☆☆———</span></p>

Code For Effect With Without Scroll Bar

As with all code, the stuff is pasted in the main view, but the code tags are put in at text view.

<p style="text-align: center;"><span style="color: #aaaaaa;">———☆☆☆———</span></p>
<p style="text-align: left;"><span style="color: #808080;">Shortened link to article: Heading Name [article]:</span> WordPress_shortened_url</p>
<p style="text-align: center;"><span style="color: #888888;">—End of Article—</span></p>
<p style="text-align: center;"><span style="color: #aaaaaa;">———☆☆☆———</span></p>

Indenting Computer Code

Use pre-tags, but the pre-tag must contact with the first and last text line. It should be noted that the code was simply cut and pasted between the pre-tags, the code to get the “&lt;” was produced by html code editor that produces the webpage here—the original text file did not have this: “&lt;”

for i in 1..10
   if i < 10
      print "0"
   end
   print "#{i}\n"
end

Code to get this effect

<pre>for i in 1..10
   if i &lt; 10
      print "0"
   end
   print "#{i}\n"
end</pre>

★★★Page and Post Style★★★★★★★★★★

Standard Heading: Standard Heading Title

Heading For Page Or Post Style

Code To Get Page or Post Style

Code to get style.
<h2><strong><span style="color: #008080;">Standard Heading: Standard Heading Title
</span></strong></h2>
<h1><span style="color: #99ccff;">Heading For Page Or Post Style</span></h1>
<h1><span style="color: #0000da;">Code To Get Page or Post Style</span></h1>
<pre><span style="color: #008080;">Code to get style.</span></pre>

★★★★★★★★★★★★★★★★★★★★★★★★★★

—End of Page—

Shortened link to article: ☆ Programmer, Pseudo Code, Code Style Guide [article]: http://wp.me/P10Tww-3qV

~~~

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s