⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tutorial.gml

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 GML
📖 第 1 页 / 共 3 页
字号:
.note
Replace the line
.millust begin
tabletop->rgb(0,255,255);
.millust end
with
.millust begin
tabletop->black();
.millust end
.note
Save your changes by clicking on the "Write the current file to disk"
icon or selecting
.us Save
from the
.us File
menu.
.note
Shut down the &br before re-making the project.
.note
Return to the &vip (by clicking on it if it is visible on your screen,
or by using Alt-Tab).
.note
Click the "Make all targets in the project" icon to re-make the project.
.endnote
.*
.do end
.*
.section Correcting an Error
.*
.if '&lang' eq 'FORTRAN 77' .do begin
.np
We are now going to introduce an error into the source code to
illustrate another feature of the &vip..
.autonote
.note
Double-click on
.fi draw???&cxt.
to load the source file into the editor.
.note
Search for the line containing the text:
.millust begin
c$ifdef undefined
.millust end
.np
For Windows users, "Find" is in the "Edit" menu.
.note
Now, to introduce a syntax error into the application, add the line
.millust begin
hThree_d + 0
.millust end
just before the line containing
.mono c$ifdef.
.note
Save your changes by clicking on the "Write the current file to disk"
icon or select
.us Save
from the
.us File
menu.
.note
Return to the &vip (by clicking on it if it is visible on your screen,
or by using Alt-Tab).
.note
Click the "Make all targets in the project" icon to re-make the project.
.endnote
.do end
.np
An error is encountered during the make and error message(s) appear in
the log window. Additional information on the error is available by
selecting the error, pulling down the
.us Log
menu and selecting the
.us Help on Message
item.
.if '&lang' eq 'C/C++' .do begin
.autonote
.note
Double-click on the error message
.code begin
furnitu.cpp (132): Error! E029: (col 15) symbol 'black' has not been declared.
.code end
.np
The offending source file (
.ct
.fi furnitu&xxt.
.ct )
is loaded into the Editor and the cursor is positioned at the line
which caused the error. Apparently, black has not been defined as a
color.
.note
Restart the &br..
.note
Double-click on
.id color
in the Inheritance window to see the member functions of the class
.id color.
Among our choices are
.id blue(),
.id green(),
and
.id red().
.note
Press the Alt-Tab key combination to return to the Editor and replace
the line
.millust begin
tabletop->black();
.millust end
with
.millust begin
tabletop->red();
.millust end
.note
Save your changes.
.note
Return to the &vip and re-make the project.
.note
Run the program to see the changes you have made to the tabletop.
.endnote
.do end
.if '&lang' eq 'FORTRAN 77' .do begin
.autonote
.note
Double-click on the error message
.code begin
drawwin.for(83): *ERR* ST-17 column 9, undecodeable statement or
misspelled word HTHREE_D
.code end
.np
The offending source file (
.ct
.fi draw???&cxt.
.ct )
is loaded into the Editor and the cursor is positioned at the line
which caused the error.
.note
Delete the line to correct the error.
.note
Save your changes.
.note
Return to the &vip and re-make the project.
.endnote
.do end
.*
.section Editing a Bitmap
.*
.np
You can edit bitmaps, icons, or cursors associated with your project
using &company's Image Editor. Double-click on a file with a
.fi .bmp,
.fi .ico,
or
.fi .cur
extension and the file is loaded into the Image Editor. The editor has
many features to design your images, including resizing, rotation,
shifting, and a utility to take a "snapshot" of another image and
import it.
.np
.figure *depth='4.05' *scale=60 *file='ide11c' The &company Image Editor
.np
Suppose you wanted to change the color of the right-arrow icon in your
application.
.autonote
.note
If the "Folder" icon next to
.fi .bmp
is closed, click on it to restore all the files with a
.fi .bmp
extension to the file list.
.note
Scroll the window until the file
.fi right.bmp
is visible.
.note
Double-click on
.fi right.bmp
in the
.fi draw???.exe
target window.
.note
Select the "Paint Can" icon from the Tool Palette.
.note
Select a color from the Color Palette.
.note
Click on the arrow.
.note
Save your changes using the "Save" icon on the toolbar and exit the
Image Editor.
.note
Click the "Make all targets in the project" icon to rebuild the project
with the change incorporated.
.endnote
.*
.section Editing Menus
.*
.np
Next, you will add source files to the list of items that make up
.fi draw???.exe.
.autonote
.note
Pull down the
.us Sources
menu and select the
.us New Source...
item.
.begnote
.mnote Note:
You can do this either by choosing from the menu bar or by positioning
the mouse over the file list area and clicking the right mouse button.
The &vip displays a pop-up menu from which you can choose the desired
action.
.endnote
.note
Enter the filename
.fi draw.res
(or
.fi drawos2.res
for OS/2).
For OS/2, click OK when you have entered the source file name.
For all other systems, click on Add when you have entered the
source file name and then click on Close.
Now we will remove the
.fi .rc
file from the project so that our changes to the
.fi .res
file will not be overwritten. When an
.fi .rc
file is present, the
.fi .res
file is generated from the
.fi .rc
file.
.note
Right click on
.fi draw.rc
(or
.fi drawos2.rc
for OS/2), then select
.us Remove Source
from the pop-up menu.
.note
Double-click on
.fi draw.res
(or
.fi drawos2.res
.ct ).
The Resource Editor is invoked, displaying all the available resources
(in this case, icons, bitmaps, and menus).
.figure *depth='3.45' *scale=60 *file='ide12c' The &company Resource Editor
.note
Click on "Menu Resources".
.note
Double-click on "DrawMenu" in the right-hand box.
This will bring up the Menu Editor.
The Menu Editor displays the menus defined for the resource
.id DrawMenu.
You can specify pop-up menus, menu items and sub-items, text,
separators, attributes, break styles, and memory flags.
.figure *depth='5.11' *scale=60 *file='ide13c' The &company Menu Editor
.note
Click on
.id MENUITEM "&Dimmer"
in the item list window.
.note
In the "Item Text" window change the item to
.id &Darker
and then click on the "Change" button.
.note
Select
.us Update
from the
.us File
menu or click on the "Update the file with this menu" icon.
.note
Exit the Menu Editor.
.note
Now, select
.us Save
from the
.us File
menu or click on the "Save this file" icon and exit the Resource
Editor.
.note
Click the "Make all targets in the project" icon to re-make the project.
.endnote
.*
.section Sampling and Profiling an Executable
.*
.np
Together, the &smpname and the &prfname allow you to pinpoint the
areas of your code that are the most heavily used, indicating possible
candidates for performance improvements.
.autonote
.note
Click on the
.fi draw???.exe
target.
.note
Select the
.us Sample
item from the
.us Targets
menu item, or click on the "Run and sample the current target" icon
from the toolbar. The &smpname is invoked and your application begins
to execute.
.note
Try rotating and resizing the image a few times. The sampler takes a
"snapshot" of the code that is being executed at regular intervals.
:cmt. When you close your application, a dialog indicates the number of
:cmt. modules found, the rate of sampling, and the total execution time.
Exit the application.
A samples file with extension
.fi .smp
is created in the current directory.
This file is input for the profiler.
.note
You are now ready to profile the executable. Do this by selecting
.us Profile
from the
.us Targets
menu, or by clicking on the "Profile the current target" icon on the toolbar.
The profiler scans the
.fi .smp
file and reports the activity in the various modules of the
application. The percentage of time spent in the modules is indicated
as an absolute percentage (percent of total samples) and as a relative
percentage (percent of samples in the
.fi .exe
image).
.note
Double-click on the module or routine names to step down to the exact
source being executed when a sample was taken. For more details, you
can adjust the sampling rate of the Sampler to get a better picture of
your code. To do this, exit the Profiler, pull down the
.us Targets
menu, and select
.us Target options,
then
.us Sample Switches...
from the pop-up menus. Specify a sampling rate such as 2 (for 2
milliseconds), click on OK, then run the Sampler and Profiler again.
.endnote
.if '&lang' eq 'C/C++' .do begin
.figure *depth='3.46' *scale=45 *file='ide14c' The &prfname
.do end
.if '&lang' eq 'FORTRAN 77' .do begin
.figure *depth='2.85' *scale=40 *file='ide14f' The &prfname
.do end
.*
.section Saving the Project and Terminating the Session
.*
.np
You can now exit the &vip session by selecting
.us Exit
from the
.us File
menu.
If you have not already saved your project, you will be prompted to do
so. Choose "Yes" and the session ends.
.*
.endlevel
.*
.section Tutorial Review
.*
.np
In this tutorial, you created a project called
.fi kitchen.wpj,
which was composed of two targets:
.fi draw???.exe
and
.fi button.lib.
You compiled and linked it into an executable program using the WMAKE
utility, the
.if '&lang' eq 'C/C++' .do begin
&company C and C++ compilers,
.do end
.if '&lang' eq 'FORTRAN 77' .do begin
&product compiler,
.do end
and the &lnkname.. You executed it both directly and under the
control of the &dbgname... You browsed the source, and made
changes using the text and resource editors. Finally, you sampled and
profiled the application.
.np
When you saved the project, you created the following permanent files:
.begbull
.bull
.fi kitchen.wpj
&mdash. describes the screen layout and refers to the target files
called
.fi draw???.tgt
and
.fi button.tgt.
.bull
.fi draw???.tgt
&mdash. describes the target executable
.fi draw???.exe
and all switches required to link it. It also describes the
.if '&lang' eq 'C/C++' .do begin
.fi .c
and
.fi .cpp
.do end
.if '&lang' eq 'FORTRAN 77' .do begin
.fi .for
.do end
files and switches required to compile them.
.bull
.fi button.tgt
&mdash. describes the target library and all switches required to
create it. It also describes the
.fi &cxt.
file and the switches used to build the library.
.endbull

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -